@cloudscape-design/components 3.0.1127 → 3.0.1129
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/styles.css.js +27 -27
- package/alert/styles.scoped.css +50 -50
- package/alert/styles.selectors.js +27 -27
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +32 -32
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/visual-refresh/styles.css.js +86 -86
- package/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +30 -30
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +87 -87
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +30 -30
- package/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -27
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +54 -54
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -27
- package/attribute-editor/index.d.ts.map +1 -1
- package/attribute-editor/index.js +2 -2
- package/attribute-editor/index.js.map +1 -1
- package/attribute-editor/interfaces.d.ts +8 -0
- package/attribute-editor/interfaces.d.ts.map +1 -1
- package/attribute-editor/interfaces.js.map +1 -1
- package/attribute-editor/internal.d.ts.map +1 -1
- package/attribute-editor/internal.js +9 -6
- package/attribute-editor/internal.js.map +1 -1
- package/attribute-editor/styles.css.js +15 -15
- package/attribute-editor/styles.scoped.css +28 -28
- package/attribute-editor/styles.selectors.js +15 -15
- package/breadcrumb-group/item/styles.css.js +7 -7
- package/breadcrumb-group/item/styles.scoped.css +28 -28
- package/breadcrumb-group/item/styles.selectors.js +7 -7
- package/button/styles.css.js +22 -22
- package/button/styles.scoped.css +256 -256
- package/button/styles.selectors.js +22 -22
- package/button-dropdown/item-element/styles.css.js +16 -16
- package/button-dropdown/item-element/styles.scoped.css +27 -27
- package/button-dropdown/item-element/styles.selectors.js +16 -16
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +11 -11
- package/checkbox/styles.selectors.js +3 -3
- package/content-layout/styles.css.js +14 -14
- package/content-layout/styles.scoped.css +27 -27
- package/content-layout/styles.selectors.js +14 -14
- package/flashbar/styles.css.js +50 -50
- package/flashbar/styles.scoped.css +187 -187
- package/flashbar/styles.selectors.js +50 -50
- package/header/analytics/use-table-integration.d.ts +2 -1
- package/header/analytics/use-table-integration.d.ts.map +1 -1
- package/header/analytics/use-table-integration.js +8 -1
- package/header/analytics/use-table-integration.js.map +1 -1
- package/header/interfaces.d.ts +2 -2
- package/header/interfaces.d.ts.map +1 -1
- package/header/interfaces.js.map +1 -1
- package/help-panel/styles.css.js +6 -6
- package/help-panel/styles.scoped.css +73 -73
- package/help-panel/styles.selectors.js +6 -6
- package/icon/generated/icons.d.ts +1 -0
- package/icon/generated/icons.d.ts.map +1 -1
- package/icon/generated/icons.js +3 -0
- package/icon/generated/icons.js.map +1 -1
- package/icon/interfaces.d.ts +1 -1
- package/icon/interfaces.d.ts.map +1 -1
- package/icon/interfaces.js.map +1 -1
- package/icon-provider/interfaces.d.ts +1 -0
- package/icon-provider/interfaces.d.ts.map +1 -1
- package/icon-provider/interfaces.js.map +1 -1
- package/input/styles.css.js +13 -13
- package/input/styles.scoped.css +65 -65
- package/input/styles.selectors.js +13 -13
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/drag-handle-wrapper/styles.css.js +20 -20
- package/internal/components/drag-handle-wrapper/styles.scoped.css +48 -48
- package/internal/components/drag-handle-wrapper/styles.selectors.js +20 -20
- package/internal/components/dropdown/styles.css.js +20 -20
- package/internal/components/dropdown/styles.scoped.css +38 -38
- package/internal/components/dropdown/styles.selectors.js +20 -20
- package/internal/components/token-list/styles.css.js +10 -10
- package/internal/components/token-list/styles.scoped.css +25 -25
- package/internal/components/token-list/styles.selectors.js +10 -10
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/custom-css-properties/index.d.ts +4 -0
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +102 -98
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/generated/styles/tokens.d.ts +50 -75
- package/internal/generated/styles/tokens.js +50 -75
- package/internal/generated/theming/index.cjs +305 -461
- package/internal/generated/theming/index.js +305 -461
- package/internal/manifest.json +1 -1
- package/link/styles.css.js +20 -20
- package/link/styles.scoped.css +103 -103
- package/link/styles.selectors.js +20 -20
- package/package.json +1 -1
- package/progress-bar/index.d.ts.map +1 -1
- package/progress-bar/index.js +14 -54
- package/progress-bar/interfaces.d.ts +18 -0
- package/progress-bar/interfaces.d.ts.map +1 -1
- package/progress-bar/interfaces.js.map +1 -1
- package/progress-bar/internal-do-not-use-core.js +58 -0
- package/progress-bar/internal-do-not-use-core.js.map +1 -0
- package/progress-bar/internal.d.ts +3 -1
- package/progress-bar/internal.d.ts.map +1 -1
- package/progress-bar/internal.js +7 -3
- package/progress-bar/internal.js.map +1 -1
- package/progress-bar/styles.css.js +19 -19
- package/progress-bar/styles.d.ts +15 -0
- package/progress-bar/styles.d.ts.map +1 -0
- package/progress-bar/styles.js +33 -0
- package/progress-bar/styles.js.map +1 -0
- package/progress-bar/styles.scoped.css +56 -56
- package/progress-bar/styles.selectors.js +19 -19
- package/radio-group/analytics-metadata/interfaces.d.ts +1 -0
- package/radio-group/analytics-metadata/interfaces.d.ts.map +1 -1
- package/radio-group/analytics-metadata/interfaces.js.map +1 -1
- package/radio-group/analytics-metadata/styles.css.js +6 -0
- package/radio-group/analytics-metadata/styles.scoped.css +7 -0
- package/radio-group/analytics-metadata/styles.selectors.js +7 -0
- package/radio-group/index.d.ts.map +1 -1
- package/radio-group/internal-do-not-use-core.js +2 -0
- package/radio-group/internal-do-not-use-core.js.map +1 -1
- package/radio-group/internal.d.ts.map +1 -1
- package/radio-group/internal.js +2 -1
- package/radio-group/internal.js.map +1 -1
- package/radio-group/styles.css.js +10 -10
- package/radio-group/styles.scoped.css +22 -22
- package/radio-group/styles.selectors.js +10 -10
- package/s3-resource-selector/index.d.ts.map +1 -1
- package/s3-resource-selector/index.js +2 -2
- package/s3-resource-selector/index.js.map +1 -1
- package/s3-resource-selector/interfaces.d.ts +8 -0
- package/s3-resource-selector/interfaces.d.ts.map +1 -1
- package/s3-resource-selector/interfaces.js.map +1 -1
- package/s3-resource-selector/s3-in-context/index.d.ts +3 -0
- package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-in-context/index.js +8 -2
- package/s3-resource-selector/s3-in-context/index.js.map +1 -1
- package/slider/styles.css.js +26 -26
- package/slider/styles.scoped.css +86 -86
- package/slider/styles.selectors.js +26 -26
- package/spinner/styles.css.js +13 -13
- package/spinner/styles.scoped.css +39 -39
- package/spinner/styles.selectors.js +13 -13
- package/tag-editor/styles.css.js +3 -3
- package/tag-editor/styles.scoped.css +13 -13
- package/tag-editor/styles.selectors.js +3 -3
- package/text-content/styles.css.js +1 -1
- package/text-content/styles.scoped.css +66 -66
- package/text-content/styles.selectors.js +1 -1
- package/textarea/styles.css.js +5 -5
- package/textarea/styles.scoped.css +41 -41
- package/textarea/styles.selectors.js +5 -5
- package/toggle/styles.css.js +10 -10
- package/toggle/styles.scoped.css +23 -23
- package/toggle/styles.selectors.js +10 -10
- package/progress-bar/index.js.map +0 -1
package/progress-bar/index.js
CHANGED
|
@@ -1,58 +1,18 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
-
import { getBaseProps } from '../internal/base-component';
|
|
9
|
-
import { fireNonCancelableEvent } from '../internal/events';
|
|
10
|
-
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import CoreComponent from './internal-do-not-use-core';
|
|
11
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const baseProps = getBaseProps(rest);
|
|
24
|
-
const generatedName = useUniqueId('awsui-progress-bar-');
|
|
25
|
-
const labelId = `${generatedName}-label`;
|
|
26
|
-
const isInFlash = variant === 'flash';
|
|
27
|
-
const isInProgressState = status === 'in-progress';
|
|
28
|
-
const descriptionId = useUniqueId('progressbar-description-');
|
|
29
|
-
const additionalInfoId = useUniqueId('progressbar-additional-info-');
|
|
30
|
-
const [announcedValue, setAnnouncedValue] = useState('');
|
|
31
|
-
const throttledAssertion = useMemo(() => {
|
|
32
|
-
return throttle((value) => {
|
|
33
|
-
setAnnouncedValue(`${value}%`);
|
|
34
|
-
}, ASSERTION_FREQUENCY);
|
|
35
|
-
}, []);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
throttledAssertion(value);
|
|
38
|
-
}, [throttledAssertion, value]);
|
|
39
|
-
if (isInFlash && resultButtonText) {
|
|
40
|
-
warnOnce('ProgressBar', 'The `resultButtonText` is ignored if you set `variant="flash"`, and the result button is not displayed. Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item in which the progress bar component is embedded.');
|
|
41
|
-
}
|
|
42
|
-
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root, variant && styles[variant]), ref: __internalRootRef }),
|
|
43
|
-
React.createElement("div", { className: isInFlash ? styles['flash-container'] : undefined },
|
|
44
|
-
React.createElement("div", { className: clsx(styles['word-wrap'], styles[`label-${variant}`]), id: labelId }, label),
|
|
45
|
-
description && (React.createElement(SmallText, { color: isInFlash ? 'inherit' : undefined, id: descriptionId }, description)),
|
|
46
|
-
React.createElement("div", null, isInProgressState ? (React.createElement(React.Fragment, null,
|
|
47
|
-
React.createElement(Progress, { value: value, ariaLabel: ariaLabel, ariaLabelledby: joinStrings(labelId, ariaLabelledby), ariaDescribedby: joinStrings(description ? descriptionId : undefined, additionalInfo ? additionalInfoId : undefined, ariaDescribedby), isInFlash: isInFlash }),
|
|
48
|
-
React.createElement(InternalLiveRegion, { hidden: true, tagName: "span", delay: 0 },
|
|
49
|
-
label,
|
|
50
|
-
label ? ': ' : null,
|
|
51
|
-
announcedValue))) : (React.createElement(InternalLiveRegion, { hidden: false, tagName: "span", delay: 0 },
|
|
52
|
-
React.createElement(ResultState, { resultText: resultText, isInFlash: isInFlash, resultButtonText: resultButtonText, status: status, onClick: () => {
|
|
53
|
-
fireNonCancelableEvent(onResultButtonClick);
|
|
54
|
-
} }))))),
|
|
55
|
-
additionalInfo && (React.createElement(SmallText, { className: styles['additional-info'], color: isInFlash ? 'inherit' : undefined, id: additionalInfoId }, additionalInfo))));
|
|
56
|
-
}
|
|
7
|
+
import { validateProps } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ProgressBar = (props) => {
|
|
12
|
+
validateProps('ProgressBar', props, ["style"], {}, 'console');
|
|
13
|
+
return React.createElement(CoreComponent, props);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
57
17
|
applyDisplayName(ProgressBar, 'ProgressBar');
|
|
58
|
-
|
|
18
|
+
export default ProgressBar;
|
|
@@ -68,8 +68,26 @@ export interface ProgressBarProps extends BaseComponentProps {
|
|
|
68
68
|
* Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item instead.
|
|
69
69
|
*/
|
|
70
70
|
onResultButtonClick?: NonCancelableEventHandler;
|
|
71
|
+
/**
|
|
72
|
+
* @awsuiSystem core
|
|
73
|
+
*/
|
|
71
74
|
}
|
|
72
75
|
export declare namespace ProgressBarProps {
|
|
73
76
|
type Status = 'in-progress' | 'success' | 'error';
|
|
74
77
|
type Variant = 'standalone' | 'flash' | 'key-value';
|
|
78
|
+
interface Style {
|
|
79
|
+
progressBar?: {
|
|
80
|
+
backgroundColor?: string;
|
|
81
|
+
borderRadius?: string;
|
|
82
|
+
height?: string;
|
|
83
|
+
};
|
|
84
|
+
progressValue?: {
|
|
85
|
+
backgroundColor?: string;
|
|
86
|
+
};
|
|
87
|
+
progressPercentage?: {
|
|
88
|
+
color?: string;
|
|
89
|
+
fontSize?: string;
|
|
90
|
+
fontWeight?: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
75
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAEjC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAEnC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eA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mBAAmB,CAAC,EAAE,yBAAyB,CAAC;IAEhD;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC;CAChC;AAED,yBAAiB,gBAAgB,CAAC;IAChC,KAAY,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACzD,KAAY,OAAO,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;IAE3D,UAAiB,KAAK;QACpB,WAAW,CAAC,EAAE;YACZ,eAAe,CAAC,EAAE,MAAM,CAAC;YACzB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,aAAa,CAAC,EAAE;YACd,eAAe,CAAC,EAAE,MAAM,CAAC;SAC1B,CAAC;QACF,kBAAkB,CAAC,EAAE;YACnB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/progress-bar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface ProgressBarProps extends BaseComponentProps {\n /**\n * Indicates the current progress as a percentage. The value must be between 0 and 100. Decimals are rounded.\n */\n value?: number;\n\n /**\n * Specifies the status of the progress bar. You can set it to one of the following:\n *\n * - `\"in-progress\"` - Displays a progress bar.\n * - `\"success\"` or `\"error\"` - Displays a result state and replaces the progress element with a status indicator,\n * `resultText`, and a result button.\n */\n status?: ProgressBarProps.Status;\n\n /**\n * Enables the correct styling of the progress bar in different contexts. You can set it to one of the following:\n *\n * - `\"flash\"` - Use this variatn when using the progress bar within a flash component.\n * Note that the result button isn't displayed when using this variant.\n * Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item instead of the result button provided by the progress bar.\n * - `\"key-value\"` - Use this variant when using the progress bar within the key-value pairs pattern.\n * - `\"standalone\"` Use in all other cases. This is the default value.\n */\n variant?: ProgressBarProps.Variant;\n\n /**\n * Specifies the text for the button that's displayed when the `status` is set to `error` or `success`.\n * If `resultButtonText` is empty, the result button isn't displayed.\n *\n * Note: If you use the `flash` variant, the result button isn't displayed.\n * Add a button using the `action` property of the flashbar item instead.\n */\n resultButtonText?: string;\n\n /**\n * Adds an `aria-label` to the progress bar.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the progress bar.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the progress bar.\n */\n ariaDescribedby?: string;\n\n /**\n * Short description of the operation that appears at the top of the component.\n *\n * Make sure that you always provide a label for accessibility.\n */\n label?: React.ReactNode;\n\n /**\n * More detailed information about the operation that appears below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Information that's displayed below the progress bar or status text.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Content that's displayed when `status` is set to `error` or `success`.\n */\n resultText?: React.ReactNode;\n\n /**\n * Called when the user clicks the result state button.\n *\n * Note: If you are using the `flash` variant, the result button isn't displayed.\n * Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item instead.\n */\n onResultButtonClick?: NonCancelableEventHandler;\n}\n\nexport namespace ProgressBarProps {\n export type Status = 'in-progress' | 'success' | 'error';\n export type Variant = 'standalone' | 'flash' | 'key-value';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/progress-bar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface ProgressBarProps extends BaseComponentProps {\n /**\n * Indicates the current progress as a percentage. The value must be between 0 and 100. Decimals are rounded.\n */\n value?: number;\n\n /**\n * Specifies the status of the progress bar. You can set it to one of the following:\n *\n * - `\"in-progress\"` - Displays a progress bar.\n * - `\"success\"` or `\"error\"` - Displays a result state and replaces the progress element with a status indicator,\n * `resultText`, and a result button.\n */\n status?: ProgressBarProps.Status;\n\n /**\n * Enables the correct styling of the progress bar in different contexts. You can set it to one of the following:\n *\n * - `\"flash\"` - Use this variatn when using the progress bar within a flash component.\n * Note that the result button isn't displayed when using this variant.\n * Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item instead of the result button provided by the progress bar.\n * - `\"key-value\"` - Use this variant when using the progress bar within the key-value pairs pattern.\n * - `\"standalone\"` Use in all other cases. This is the default value.\n */\n variant?: ProgressBarProps.Variant;\n\n /**\n * Specifies the text for the button that's displayed when the `status` is set to `error` or `success`.\n * If `resultButtonText` is empty, the result button isn't displayed.\n *\n * Note: If you use the `flash` variant, the result button isn't displayed.\n * Add a button using the `action` property of the flashbar item instead.\n */\n resultButtonText?: string;\n\n /**\n * Adds an `aria-label` to the progress bar.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the progress bar.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the progress bar.\n */\n ariaDescribedby?: string;\n\n /**\n * Short description of the operation that appears at the top of the component.\n *\n * Make sure that you always provide a label for accessibility.\n */\n label?: React.ReactNode;\n\n /**\n * More detailed information about the operation that appears below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Information that's displayed below the progress bar or status text.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Content that's displayed when `status` is set to `error` or `success`.\n */\n resultText?: React.ReactNode;\n\n /**\n * Called when the user clicks the result state button.\n *\n * Note: If you are using the `flash` variant, the result button isn't displayed.\n * Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item instead.\n */\n onResultButtonClick?: NonCancelableEventHandler;\n\n /**\n * @awsuiSystem core\n */\n style?: ProgressBarProps.Style;\n}\n\nexport namespace ProgressBarProps {\n export type Status = 'in-progress' | 'success' | 'error';\n export type Variant = 'standalone' | 'flash' | 'key-value';\n\n export interface Style {\n progressBar?: {\n backgroundColor?: string;\n borderRadius?: string;\n height?: string;\n };\n progressValue?: {\n backgroundColor?: string;\n };\n progressPercentage?: {\n color?: string;\n fontSize?: string;\n fontWeight?: string;\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import { __rest } from "tslib";
|
|
5
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
import { getBaseProps } from '../internal/base-component';
|
|
9
|
+
import { fireNonCancelableEvent } from '../internal/events';
|
|
10
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
11
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
12
|
+
import { joinStrings } from '../internal/utils/strings';
|
|
13
|
+
import { throttle } from '../internal/utils/throttle';
|
|
14
|
+
import InternalLiveRegion from '../live-region/internal';
|
|
15
|
+
import { Progress, ResultState, SmallText } from './internal';
|
|
16
|
+
import styles from './styles.css.js';
|
|
17
|
+
const ASSERTION_FREQUENCY = 5000; // interval in ms between progress announcements
|
|
18
|
+
export default function ProgressBar(_a) {
|
|
19
|
+
var { value = 0, status = 'in-progress', variant = 'standalone', resultButtonText, label, ariaLabel, ariaLabelledby, ariaDescribedby, description, additionalInfo, resultText, onResultButtonClick, style } = _a, rest = __rest(_a, ["value", "status", "variant", "resultButtonText", "label", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "description", "additionalInfo", "resultText", "onResultButtonClick", "style"]);
|
|
20
|
+
const { __internalRootRef } = useBaseComponent('ProgressBar', {
|
|
21
|
+
props: { variant },
|
|
22
|
+
});
|
|
23
|
+
const baseProps = getBaseProps(rest);
|
|
24
|
+
const generatedName = useUniqueId('awsui-progress-bar-');
|
|
25
|
+
const labelId = `${generatedName}-label`;
|
|
26
|
+
const isInFlash = variant === 'flash';
|
|
27
|
+
const isInProgressState = status === 'in-progress';
|
|
28
|
+
const descriptionId = useUniqueId('progressbar-description-');
|
|
29
|
+
const additionalInfoId = useUniqueId('progressbar-additional-info-');
|
|
30
|
+
const [announcedValue, setAnnouncedValue] = useState('');
|
|
31
|
+
const throttledAssertion = useMemo(() => {
|
|
32
|
+
return throttle((value) => {
|
|
33
|
+
setAnnouncedValue(`${value}%`);
|
|
34
|
+
}, ASSERTION_FREQUENCY);
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
throttledAssertion(value);
|
|
38
|
+
}, [throttledAssertion, value]);
|
|
39
|
+
if (isInFlash && resultButtonText) {
|
|
40
|
+
warnOnce('ProgressBar', 'The `resultButtonText` is ignored if you set `variant="flash"`, and the result button is not displayed. Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item in which the progress bar component is embedded.');
|
|
41
|
+
}
|
|
42
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root, variant && styles[variant]), ref: __internalRootRef }),
|
|
43
|
+
React.createElement("div", { className: isInFlash ? styles['flash-container'] : undefined },
|
|
44
|
+
React.createElement("div", { className: clsx(styles['word-wrap'], styles[`label-${variant}`]), id: labelId }, label),
|
|
45
|
+
description && (React.createElement(SmallText, { color: isInFlash ? 'inherit' : undefined, id: descriptionId }, description)),
|
|
46
|
+
React.createElement("div", null, isInProgressState ? (React.createElement(React.Fragment, null,
|
|
47
|
+
React.createElement(Progress, { value: value, ariaLabel: ariaLabel, ariaLabelledby: joinStrings(labelId, ariaLabelledby), ariaDescribedby: joinStrings(description ? descriptionId : undefined, additionalInfo ? additionalInfoId : undefined, ariaDescribedby), isInFlash: isInFlash, style: style }),
|
|
48
|
+
React.createElement(InternalLiveRegion, { hidden: true, tagName: "span", delay: 0 },
|
|
49
|
+
label,
|
|
50
|
+
label ? ': ' : null,
|
|
51
|
+
announcedValue))) : (React.createElement(InternalLiveRegion, { hidden: false, tagName: "span", delay: 0 },
|
|
52
|
+
React.createElement(ResultState, { resultText: resultText, isInFlash: isInFlash, resultButtonText: resultButtonText, status: status, onClick: () => {
|
|
53
|
+
fireNonCancelableEvent(onResultButtonClick);
|
|
54
|
+
} }))))),
|
|
55
|
+
additionalInfo && (React.createElement(SmallText, { className: styles['additional-info'], color: isInFlash ? 'inherit' : undefined, id: additionalInfoId }, additionalInfo))));
|
|
56
|
+
}
|
|
57
|
+
applyDisplayName(ProgressBar, 'ProgressBar');
|
|
58
|
+
//# sourceMappingURL=internal-do-not-use-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/progress-bar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,WAA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AAI,EAAE,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,CAAC;oBACtD,KAAK;oBACL,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;oBACnB,cAAc,CACI,CACpB,CACJ,CAAC,CAAC,CAAC,CACF,oBAAC,kBAAkB,IAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,CAAC;gBACxD,oBAAC,WAAW,IACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;oBAC9C,CAAC,GACD,CACiB,CACtB,CACG,CACF;QACL,cAAc,IAAI,CACjB,oBAAC,SAAS,IACR,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACxC,EAAE,EAAE,gBAAgB,IAEnB,cAAc,CACL,CACb,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { joinStrings } from '../internal/utils/strings';\nimport { throttle } from '../internal/utils/throttle';\nimport InternalLiveRegion from '../live-region/internal';\nimport { ProgressBarProps } from './interfaces';\nimport { Progress, ResultState, SmallText } from './internal';\n\nimport styles from './styles.css.js';\n\nconst ASSERTION_FREQUENCY = 5000; // interval in ms between progress announcements\n\nexport { ProgressBarProps };\n\nexport default function ProgressBar({\n value = 0,\n status = 'in-progress',\n variant = 'standalone',\n resultButtonText,\n label,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n description,\n additionalInfo,\n resultText,\n onResultButtonClick,\n style,\n ...rest\n}: ProgressBarProps) {\n const { __internalRootRef } = useBaseComponent('ProgressBar', {\n props: { variant },\n });\n const baseProps = getBaseProps(rest);\n const generatedName = useUniqueId('awsui-progress-bar-');\n\n const labelId = `${generatedName}-label`;\n const isInFlash = variant === 'flash';\n const isInProgressState = status === 'in-progress';\n\n const descriptionId = useUniqueId('progressbar-description-');\n const additionalInfoId = useUniqueId('progressbar-additional-info-');\n\n const [announcedValue, setAnnouncedValue] = useState('');\n const throttledAssertion = useMemo(() => {\n return throttle((value: ProgressBarProps['value']) => {\n setAnnouncedValue(`${value}%`);\n }, ASSERTION_FREQUENCY);\n }, []);\n\n useEffect(() => {\n throttledAssertion(value);\n }, [throttledAssertion, value]);\n\n if (isInFlash && resultButtonText) {\n warnOnce(\n 'ProgressBar',\n 'The `resultButtonText` is ignored if you set `variant=\"flash\"`, and the result button is not displayed. Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item in which the progress bar component is embedded.'\n );\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, variant && styles[variant])}\n ref={__internalRootRef}\n >\n <div className={isInFlash ? styles['flash-container'] : undefined}>\n <div className={clsx(styles['word-wrap'], styles[`label-${variant}`])} id={labelId}>\n {label}\n </div>\n {description && (\n <SmallText color={isInFlash ? 'inherit' : undefined} id={descriptionId}>\n {description}\n </SmallText>\n )}\n <div>\n {isInProgressState ? (\n <>\n <Progress\n value={value}\n ariaLabel={ariaLabel}\n ariaLabelledby={joinStrings(labelId, ariaLabelledby)}\n ariaDescribedby={joinStrings(\n description ? descriptionId : undefined,\n additionalInfo ? additionalInfoId : undefined,\n ariaDescribedby\n )}\n isInFlash={isInFlash}\n style={style}\n />\n <InternalLiveRegion hidden={true} tagName=\"span\" delay={0}>\n {label}\n {label ? ': ' : null}\n {announcedValue}\n </InternalLiveRegion>\n </>\n ) : (\n <InternalLiveRegion hidden={false} tagName=\"span\" delay={0}>\n <ResultState\n resultText={resultText}\n isInFlash={isInFlash}\n resultButtonText={resultButtonText}\n status={status}\n onClick={() => {\n fireNonCancelableEvent(onResultButtonClick);\n }}\n />\n </InternalLiveRegion>\n )}\n </div>\n </div>\n {additionalInfo && (\n <SmallText\n className={styles['additional-info']}\n color={isInFlash ? 'inherit' : undefined}\n id={additionalInfoId}\n >\n {additionalInfo}\n </SmallText>\n )}\n </div>\n );\n}\n\napplyDisplayName(ProgressBar, 'ProgressBar');\n"]}
|
|
@@ -7,13 +7,15 @@ interface ProgressProps {
|
|
|
7
7
|
ariaLabel?: string;
|
|
8
8
|
ariaLabelledby?: string;
|
|
9
9
|
ariaDescribedby?: string;
|
|
10
|
+
style?: ProgressBarProps.Style;
|
|
10
11
|
}
|
|
11
12
|
export declare const Progress: ({
|
|
12
13
|
value,
|
|
13
14
|
isInFlash,
|
|
14
15
|
ariaLabel,
|
|
15
16
|
ariaLabelledby,
|
|
16
|
-
ariaDescribedby
|
|
17
|
+
ariaDescribedby,
|
|
18
|
+
style
|
|
17
19
|
}: ProgressProps) => JSX.Element;
|
|
18
20
|
interface SmallTextProps {
|
|
19
21
|
color?: BoxProps.Color;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWhD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC;CAChC;AAED,eAAO,MAAM,QAAQ,GAAI,yEAAyE,aAAa,gBAuC9G,CAAC;AAEF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,GAAI,oCAAoC,cAAc,gBAM3E,CAAC;AAYF,UAAU,gBAAgB;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,GAAI,8DAA8D,gBAAgB,gBAqBzG,CAAC"}
|
package/progress-bar/internal.js
CHANGED
|
@@ -5,18 +5,22 @@ import clsx from 'clsx';
|
|
|
5
5
|
import InternalBox from '../box/internal';
|
|
6
6
|
import { InternalButton } from '../button/internal';
|
|
7
7
|
import InternalStatusIndicator from '../status-indicator/internal';
|
|
8
|
+
import { getProgressPercentageStyles, getProgressStyles, getProgressValueStyles } from './styles';
|
|
8
9
|
import styles from './styles.css.js';
|
|
9
10
|
const MAX_VALUE = 100;
|
|
10
11
|
const clamp = (value, lowerLimit, upperLimit) => {
|
|
11
12
|
return Math.max(Math.min(value, upperLimit), lowerLimit);
|
|
12
13
|
};
|
|
13
|
-
export const Progress = ({ value, isInFlash, ariaLabel, ariaLabelledby, ariaDescribedby }) => {
|
|
14
|
+
export const Progress = ({ value, isInFlash, ariaLabel, ariaLabelledby, ariaDescribedby, style }) => {
|
|
14
15
|
const roundedValue = Math.round(value);
|
|
15
16
|
const progressValue = clamp(roundedValue, 0, MAX_VALUE);
|
|
17
|
+
const progressBarStyles = getProgressStyles(style);
|
|
18
|
+
const progressValueStyles = getProgressValueStyles(style);
|
|
19
|
+
const progressPercentageStyles = getProgressPercentageStyles(style);
|
|
16
20
|
return (React.createElement("div", { className: styles['progress-container'] },
|
|
17
|
-
React.createElement("progress", { className: clsx(styles.progress, progressValue >= MAX_VALUE && styles.complete, isInFlash && styles['progress-in-flash']), max: MAX_VALUE, value: progressValue, "aria-label": ariaLabel, "aria-labelledby": !ariaLabel ? ariaLabelledby : undefined, "aria-describedby": ariaDescribedby }),
|
|
21
|
+
React.createElement("progress", { className: clsx(styles.progress, progressValue >= MAX_VALUE && styles.complete, isInFlash && styles['progress-in-flash']), max: MAX_VALUE, value: progressValue, "aria-label": ariaLabel, "aria-labelledby": !ariaLabel ? ariaLabelledby : undefined, "aria-describedby": ariaDescribedby, style: Object.assign(Object.assign({}, (progressBarStyles || {})), (progressValueStyles || {})) }),
|
|
18
22
|
React.createElement("span", { "aria-hidden": "true", className: styles['percentage-container'] },
|
|
19
|
-
React.createElement(InternalBox, { className: styles.percentage, variant: "small", color: isInFlash ? 'inherit' : undefined }, `${progressValue}%`))));
|
|
23
|
+
React.createElement(InternalBox, { className: styles.percentage, variant: "small", color: isInFlash ? 'inherit' : undefined, nativeAttributes: progressPercentageStyles ? { style: progressPercentageStyles } : undefined }, `${progressValue}%`))));
|
|
20
24
|
};
|
|
21
25
|
export const SmallText = ({ color, children, className, id }) => {
|
|
22
26
|
return (React.createElement(InternalBox, { className: clsx(styles['word-wrap'], className), variant: "small", display: "block", color: color, id: id }, children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,UAAkB,EAAE,UAAkB,EAAE,EAAE;IACtE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAiB,EAAE,EAAE;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,IAAG,UAAU,CAAQ,CACnC,CACrB;QACN,eAAe,IAAI,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,IAAG,gBAAgB,CAAgB,CACjF,CACP,CAAC;AACJ,CAAC,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 { BoxProps } from '../box/interfaces';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { ProgressBarProps } from './interfaces';\nimport { getProgressPercentageStyles, getProgressStyles, getProgressValueStyles } from './styles';\n\nimport styles from './styles.css.js';\n\nconst MAX_VALUE = 100;\n\nconst clamp = (value: number, lowerLimit: number, upperLimit: number) => {\n return Math.max(Math.min(value, upperLimit), lowerLimit);\n};\n\ninterface ProgressProps {\n value: number;\n isInFlash: boolean;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n style?: ProgressBarProps.Style;\n}\n\nexport const Progress = ({ value, isInFlash, ariaLabel, ariaLabelledby, ariaDescribedby, style }: ProgressProps) => {\n const roundedValue = Math.round(value);\n const progressValue = clamp(roundedValue, 0, MAX_VALUE);\n\n const progressBarStyles = getProgressStyles(style);\n const progressValueStyles = getProgressValueStyles(style);\n const progressPercentageStyles = getProgressPercentageStyles(style);\n\n return (\n <div className={styles['progress-container']}>\n <progress\n className={clsx(\n styles.progress,\n progressValue >= MAX_VALUE && styles.complete,\n isInFlash && styles['progress-in-flash']\n )}\n max={MAX_VALUE}\n value={progressValue}\n aria-label={ariaLabel}\n // Ensures aria-label takes precedence over aria-labelledby\n aria-labelledby={!ariaLabel ? ariaLabelledby : undefined}\n aria-describedby={ariaDescribedby}\n style={{\n ...(progressBarStyles || {}),\n ...(progressValueStyles || {}),\n }}\n />\n <span aria-hidden=\"true\" className={styles['percentage-container']}>\n <InternalBox\n className={styles.percentage}\n variant=\"small\"\n color={isInFlash ? 'inherit' : undefined}\n nativeAttributes={progressPercentageStyles ? { style: progressPercentageStyles } : undefined}\n >\n {`${progressValue}%`}\n </InternalBox>\n </span>\n </div>\n );\n};\n\ninterface SmallTextProps {\n color?: BoxProps.Color;\n id?: string;\n children: React.ReactNode;\n className?: string;\n}\n\nexport const SmallText = ({ color, children, className, id }: SmallTextProps) => {\n return (\n <InternalBox className={clsx(styles['word-wrap'], className)} variant=\"small\" display=\"block\" color={color} id={id}>\n {children}\n </InternalBox>\n );\n};\n\nconst ResultButton = ({ onClick, children }: ButtonProps) => {\n return (\n <div className={styles['result-button']}>\n <InternalButton formAction=\"none\" onClick={onClick}>\n {children}\n </InternalButton>\n </div>\n );\n};\n\ninterface ResultStateProps {\n isInFlash: boolean;\n resultText: React.ReactNode;\n resultButtonText?: string;\n status: ProgressBarProps.Status;\n onClick: () => void;\n}\n\nexport const ResultState = ({ isInFlash, resultText, resultButtonText, status, onClick }: ResultStateProps) => {\n const hasResultButton = !!resultButtonText;\n\n if (isInFlash) {\n return (\n <div className={styles[`result-container-${status}`]}>\n <span className={styles['result-text']}>{resultText}</span>\n </div>\n );\n }\n\n return (\n <div className={styles[`result-container-${status}`]}>\n <span className={clsx(hasResultButton && styles['with-result-button'])}>\n <InternalStatusIndicator type={status === 'success' ? 'success' : 'error'}>\n <span className={styles['result-text']}>{resultText}</span>\n </InternalStatusIndicator>\n </span>\n {hasResultButton && <ResultButton onClick={onClick}>{resultButtonText}</ResultButton>}\n </div>\n );\n};\n"]}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"progress": "
|
|
5
|
-
"result-state": "awsui_result-
|
|
6
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
7
|
-
"root": "
|
|
8
|
-
"with-result-button": "awsui_with-result-
|
|
9
|
-
"result-text": "awsui_result-
|
|
10
|
-
"result-container-error": "awsui_result-container-
|
|
11
|
-
"result-container-success": "awsui_result-container-
|
|
12
|
-
"result-button": "awsui_result-
|
|
13
|
-
"word-wrap": "awsui_word-
|
|
14
|
-
"label-flash": "awsui_label-
|
|
15
|
-
"label-key-value": "awsui_label-key-
|
|
16
|
-
"flash": "
|
|
17
|
-
"progress-container": "awsui_progress-
|
|
18
|
-
"percentage-container": "awsui_percentage-
|
|
19
|
-
"percentage": "
|
|
20
|
-
"complete": "
|
|
21
|
-
"progress-in-flash": "awsui_progress-in-
|
|
22
|
-
"additional-info": "awsui_additional-
|
|
4
|
+
"progress": "awsui_progress_11huc_2e4fw_189",
|
|
5
|
+
"result-state": "awsui_result-state_11huc_2e4fw_203",
|
|
6
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_11huc_2e4fw_1",
|
|
7
|
+
"root": "awsui_root_11huc_2e4fw_225",
|
|
8
|
+
"with-result-button": "awsui_with-result-button_11huc_2e4fw_257",
|
|
9
|
+
"result-text": "awsui_result-text_11huc_2e4fw_261",
|
|
10
|
+
"result-container-error": "awsui_result-container-error_11huc_2e4fw_265",
|
|
11
|
+
"result-container-success": "awsui_result-container-success_11huc_2e4fw_265",
|
|
12
|
+
"result-button": "awsui_result-button_11huc_2e4fw_269",
|
|
13
|
+
"word-wrap": "awsui_word-wrap_11huc_2e4fw_275",
|
|
14
|
+
"label-flash": "awsui_label-flash_11huc_2e4fw_280",
|
|
15
|
+
"label-key-value": "awsui_label-key-value_11huc_2e4fw_284",
|
|
16
|
+
"flash": "awsui_flash_11huc_2e4fw_292",
|
|
17
|
+
"progress-container": "awsui_progress-container_11huc_2e4fw_296",
|
|
18
|
+
"percentage-container": "awsui_percentage-container_11huc_2e4fw_303",
|
|
19
|
+
"percentage": "awsui_percentage_11huc_2e4fw_303",
|
|
20
|
+
"complete": "awsui_complete_11huc_2e4fw_349",
|
|
21
|
+
"progress-in-flash": "awsui_progress-in-flash_11huc_2e4fw_362",
|
|
22
|
+
"additional-info": "awsui_additional-info_11huc_2e4fw_375"
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import customCssProps from '../internal/generated/custom-css-properties';
|
|
2
|
+
import { ProgressBarProps } from './interfaces';
|
|
3
|
+
export declare function getProgressStyles(style: ProgressBarProps['style']): {
|
|
4
|
+
[customCssProps.progressBarBackgroundColor]: string | undefined;
|
|
5
|
+
[customCssProps.progressBarBorderRadius]: string | undefined;
|
|
6
|
+
[customCssProps.progressBarHeight]: string | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export declare function getProgressValueStyles(style: ProgressBarProps['style']): {
|
|
9
|
+
[customCssProps.progressValueBackgroundColor]: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
export declare function getProgressPercentageStyles(style: ProgressBarProps['style']): {
|
|
12
|
+
color: string | undefined;
|
|
13
|
+
fontSize: string | undefined;
|
|
14
|
+
fontWeight: string | undefined;
|
|
15
|
+
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/styles.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAM9D,CAAC,cAAc,CAAC,0BAA0B,CAAC,qBAAmC;IAC9E,CAAC,cAAc,CAAC,uBAAuB,CAAC,qBAAgC;IACxE,CAAC,cAAc,CAAC,iBAAiB,CAAC,qBAA0B;cAE/D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAMnE,CAAC,cAAc,CAAC,4BAA4B,CAAC,qBAAqC;cAErF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC;;;;cAU3E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SYSTEM } from '../internal/environment';
|
|
4
|
+
import customCssProps from '../internal/generated/custom-css-properties';
|
|
5
|
+
export function getProgressStyles(style) {
|
|
6
|
+
if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.progressBar)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
[customCssProps.progressBarBackgroundColor]: style.progressBar.backgroundColor,
|
|
11
|
+
[customCssProps.progressBarBorderRadius]: style.progressBar.borderRadius,
|
|
12
|
+
[customCssProps.progressBarHeight]: style.progressBar.height,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function getProgressValueStyles(style) {
|
|
16
|
+
if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.progressValue)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
[customCssProps.progressValueBackgroundColor]: style.progressValue.backgroundColor,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function getProgressPercentageStyles(style) {
|
|
24
|
+
if (SYSTEM !== 'core' || !(style === null || style === void 0 ? void 0 : style.progressPercentage)) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
color: style.progressPercentage.color,
|
|
29
|
+
fontSize: style.progressPercentage.fontSize,
|
|
30
|
+
fontWeight: style.progressPercentage.fontWeight,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/progress-bar/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,C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2.0\nimport { SYSTEM } from '../internal/environment';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { ProgressBarProps } from './interfaces';\n\nexport function getProgressStyles(style: ProgressBarProps['style']) {\n if (SYSTEM !== 'core' || !style?.progressBar) {\n return undefined;\n }\n\n return {\n [customCssProps.progressBarBackgroundColor]: style.progressBar.backgroundColor,\n [customCssProps.progressBarBorderRadius]: style.progressBar.borderRadius,\n [customCssProps.progressBarHeight]: style.progressBar.height,\n };\n}\n\nexport function getProgressValueStyles(style: ProgressBarProps['style']) {\n if (SYSTEM !== 'core' || !style?.progressValue) {\n return undefined;\n }\n\n return {\n [customCssProps.progressValueBackgroundColor]: style.progressValue.backgroundColor,\n };\n}\n\nexport function getProgressPercentageStyles(style: ProgressBarProps['style']) {\n if (SYSTEM !== 'core' || !style?.progressPercentage) {\n return undefined;\n }\n\n return {\n color: style.progressPercentage.color,\n fontSize: style.progressPercentage.fontSize,\n fontWeight: style.progressPercentage.fontWeight,\n };\n}\n"]}
|