@cloudscape-design/components-themeable 3.0.285 → 3.0.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/collection-preferences/content-display/content-display-option.scss +0 -1
- package/lib/internal/scss/collection-preferences/styles.scss +6 -1
- package/lib/internal/scss/table/body-cell/styles.scss +52 -0
- package/lib/internal/scss/table/header-cell/styles.scss +28 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts +5 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts.map +1 -1
- package/lib/internal/template/checkbox/base-checkbox.js.map +1 -1
- package/lib/internal/template/checkbox/internal.d.ts.map +1 -1
- package/lib/internal/template/checkbox/internal.js +2 -2
- package/lib/internal/template/checkbox/internal.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/styles.css.js +11 -11
- package/lib/internal/template/collection-preferences/content-display/styles.scoped.css +17 -18
- package/lib/internal/template/collection-preferences/content-display/styles.selectors.js +11 -11
- package/lib/internal/template/collection-preferences/index.d.ts +1 -1
- package/lib/internal/template/collection-preferences/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/index.js +6 -4
- package/lib/internal/template/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts +42 -12
- package/lib/internal/template/collection-preferences/interfaces.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.js.map +1 -1
- package/lib/internal/template/collection-preferences/styles.css.js +37 -32
- package/lib/internal/template/collection-preferences/styles.scoped.css +44 -40
- package/lib/internal/template/collection-preferences/styles.selectors.js +37 -32
- package/lib/internal/template/collection-preferences/utils.d.ts +12 -1
- package/lib/internal/template/collection-preferences/utils.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/utils.js +15 -1
- package/lib/internal/template/collection-preferences/utils.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +14 -0
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts +2 -1
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/abstract-switch/index.js +6 -5
- package/lib/internal/template/internal/components/abstract-switch/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/progress-bar/internal.d.ts.map +1 -1
- package/lib/internal/template/progress-bar/internal.js +1 -1
- package/lib/internal/template/progress-bar/internal.js.map +1 -1
- package/lib/internal/template/table/body-cell/styles.css.js +28 -23
- package/lib/internal/template/table/body-cell/styles.scoped.css +111 -55
- package/lib/internal/template/table/body-cell/styles.selectors.js +28 -23
- package/lib/internal/template/table/body-cell/td-element.d.ts +3 -0
- package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -1
- package/lib/internal/template/table/body-cell/td-element.js +16 -2
- package/lib/internal/template/table/body-cell/td-element.js.map +1 -1
- package/lib/internal/template/table/header-cell/index.d.ts +4 -1
- package/lib/internal/template/table/header-cell/index.d.ts.map +1 -1
- package/lib/internal/template/table/header-cell/index.js +9 -2
- package/lib/internal/template/table/header-cell/index.js.map +1 -1
- package/lib/internal/template/table/header-cell/styles.css.js +24 -19
- package/lib/internal/template/table/header-cell/styles.scoped.css +67 -32
- package/lib/internal/template/table/header-cell/styles.selectors.js +24 -19
- package/lib/internal/template/table/interfaces.d.ts +14 -0
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +19 -6
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts +2 -0
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +12 -4
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/table/use-sticky-columns.d.ts.map +1 -1
- package/lib/internal/template/table/use-sticky-columns.js +5 -1
- package/lib/internal/template/table/use-sticky-columns.js.map +1 -1
- package/lib/internal/template/table/utils.d.ts +4 -0
- package/lib/internal/template/table/utils.d.ts.map +1 -1
- package/lib/internal/template/table/utils.js +8 -0
- package/lib/internal/template/table/utils.js.map +1 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js +6 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.js +23 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js +6 -1
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.js +23 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/tiles/interfaces.d.ts +5 -0
- package/lib/internal/template/tiles/interfaces.d.ts.map +1 -1
- package/lib/internal/template/tiles/interfaces.js.map +1 -1
- package/lib/internal/template/tiles/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.js +2 -2
- package/lib/internal/template/tiles/internal.js.map +1 -1
- package/lib/internal/template/toggle/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle/internal.js +2 -2
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,15 +6,17 @@ import InternalCheckbox from '../checkbox/internal';
|
|
|
6
6
|
import InternalColumnLayout from '../column-layout/internal';
|
|
7
7
|
import InternalFormField from '../form-field/internal';
|
|
8
8
|
import InternalRadioGroup from '../radio-group/internal';
|
|
9
|
+
import InternalSpaceBetween from '../space-between/internal';
|
|
9
10
|
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
|
|
10
11
|
import styles from './styles.css.js';
|
|
11
|
-
export const copyPreferences = ({ pageSize, wrapLines, stripedRows, contentDensity, visibleContent, contentDisplay, custom, }) => ({
|
|
12
|
+
export const copyPreferences = ({ pageSize, wrapLines, stripedRows, contentDensity, visibleContent, contentDisplay, stickyColumns, custom, }) => ({
|
|
12
13
|
pageSize,
|
|
13
14
|
wrapLines,
|
|
14
15
|
stripedRows,
|
|
15
16
|
contentDensity,
|
|
16
17
|
visibleContent,
|
|
17
18
|
contentDisplay,
|
|
19
|
+
stickyColumns,
|
|
18
20
|
custom,
|
|
19
21
|
});
|
|
20
22
|
export const mergePreferences = (newPref, oldPref) => {
|
|
@@ -27,6 +29,7 @@ export const mergePreferences = (newPref, oldPref) => {
|
|
|
27
29
|
'visibleContent',
|
|
28
30
|
'custom',
|
|
29
31
|
'contentDisplay',
|
|
32
|
+
'stickyColumns',
|
|
30
33
|
];
|
|
31
34
|
for (const prefName of prefNames) {
|
|
32
35
|
if (newPref[prefName] !== undefined) {
|
|
@@ -55,6 +58,17 @@ export const PageSizePreference = ({ title, options, value, onChange }) => (Reac
|
|
|
55
58
|
export const WrapLinesPreference = ({ label, description, value, onChange }) => (React.createElement(InternalCheckbox, { checked: !!value, description: description, onChange: ({ detail }) => onChange(detail.checked), className: styles['wrap-lines'] }, label));
|
|
56
59
|
export const StripedRowsPreference = ({ label, description, value, onChange }) => (React.createElement(InternalCheckbox, { checked: !!value, description: description, onChange: ({ detail }) => onChange(detail.checked), className: styles['striped-rows'] }, label));
|
|
57
60
|
export const ContentDensityPreference = ({ label, description, value, onChange }) => (React.createElement(InternalCheckbox, { checked: value === 'compact', description: description, onChange: ({ detail }) => onChange(detail.checked ? 'compact' : 'comfortable'), className: styles['content-density'] }, label));
|
|
61
|
+
const StickyPreference = ({ firstOrLast, preference, value, onChange }) => {
|
|
62
|
+
const { title, description, options } = preference;
|
|
63
|
+
return (React.createElement("div", { className: styles[`sticky-columns-${firstOrLast}`] },
|
|
64
|
+
React.createElement(InternalFormField, { className: styles['sticky-columns-form-field'], label: title, description: description },
|
|
65
|
+
React.createElement(InternalRadioGroup, { className: styles['sticky-columns-radio-group'], value: typeof value !== 'undefined' ? `${value}` : null, items: options.map(({ label, value }) => ({ label, value: `${value}` })), onChange: ({ detail }) => onChange(Number(detail.value)) }))));
|
|
66
|
+
};
|
|
67
|
+
export const StickyColumnsPreference = ({ firstColumns, lastColumns, onChange, value, }) => {
|
|
68
|
+
return (React.createElement(InternalSpaceBetween, { className: styles['sticky-columns'], size: "l" },
|
|
69
|
+
firstColumns && (React.createElement(StickyPreference, { firstOrLast: "first", preference: firstColumns, value: value === null || value === void 0 ? void 0 : value.first, onChange: newValue => onChange(Object.assign(Object.assign({}, value), { first: newValue })) })),
|
|
70
|
+
lastColumns && (React.createElement(StickyPreference, { firstOrLast: "last", preference: lastColumns, value: value === null || value === void 0 ? void 0 : value.last, onChange: newValue => onChange(Object.assign(Object.assign({}, value), { last: newValue })) }))));
|
|
71
|
+
};
|
|
58
72
|
export const CustomPreference = ({ value, customPreference, onChange }) => {
|
|
59
73
|
const [customState, setCustomState] = useState(value);
|
|
60
74
|
if (customPreference) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["collection-preferences/utils.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,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,CAAC,MAAM,IAC1B,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YACrC,uDAAuD;YACvD,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACE,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalRadioGroup from '../radio-group/internal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport const copyPreferences = ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n contentDisplay,\n custom,\n}: CollectionPreferencesProps.Preferences): CollectionPreferencesProps.Preferences => ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n contentDisplay,\n custom,\n});\n\ntype CopyPreferenceName = keyof CollectionPreferencesProps.Preferences;\n\nexport const mergePreferences = (\n newPref: CollectionPreferencesProps.Preferences,\n oldPref: CollectionPreferencesProps.Preferences\n): CollectionPreferencesProps.Preferences => {\n const newObj = { ...oldPref };\n const prefNames: CopyPreferenceName[] = [\n 'pageSize',\n 'wrapLines',\n 'stripedRows',\n 'contentDensity',\n 'visibleContent',\n 'custom',\n 'contentDisplay',\n ];\n for (const prefName of prefNames) {\n if (newPref[prefName] !== undefined) {\n newObj[prefName] = newPref[prefName];\n }\n }\n return newObj;\n};\n\ninterface ModalContentLayoutProps {\n left: React.ReactNode;\n right: React.ReactNode;\n}\n\nexport const ModalContentLayout = ({ left, right }: ModalContentLayoutProps) => {\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const smallContainer = breakpoint === 'default';\n\n if (smallContainer) {\n return (\n <div ref={ref}>\n {left && <div>{left}</div>}\n {right && <div className={clsx(left && styles['second-column-small'])}>{right}</div>}\n </div>\n );\n }\n\n const columns = left && right ? 2 : 1;\n return (\n <div ref={ref}>\n <InternalColumnLayout columns={columns} variant=\"text-grid\">\n {left && <div>{left}</div>}\n {right && <div>{right}</div>}\n </InternalColumnLayout>\n </div>\n );\n};\n\ninterface PageSizePreferenceProps extends CollectionPreferencesProps.PageSizePreference {\n onChange: (value: number) => void;\n value?: number;\n}\n\nexport const PageSizePreference = ({ title, options, value, onChange }: PageSizePreferenceProps) => (\n <div className={styles['page-size']}>\n <InternalFormField label={title} stretch={true} className={styles['page-size-form-field']}>\n <InternalRadioGroup\n className={styles['page-size-radio-group']}\n value={`${value}`}\n items={options.map(({ label, value }) => ({ label, value: `${value}` }))}\n onChange={({ detail }) => onChange(parseInt(detail.value, 10))}\n />\n </InternalFormField>\n </div>\n);\n\ninterface WrapLinesPreferenceProps extends CollectionPreferencesProps.WrapLinesPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const WrapLinesPreference = ({ label, description, value, onChange }: WrapLinesPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['wrap-lines']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface StripedRowsPreferenceProps extends CollectionPreferencesProps.StripedRowsPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const StripedRowsPreference = ({ label, description, value, onChange }: StripedRowsPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['striped-rows']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface ContentDensityPreferenceProps extends CollectionPreferencesProps.ContentDensityPreference {\n onChange: (value: 'comfortable' | 'compact') => void;\n value?: 'comfortable' | 'compact';\n}\n\nexport const ContentDensityPreference = ({ label, description, value, onChange }: ContentDensityPreferenceProps) => (\n <InternalCheckbox\n checked={value === 'compact'}\n description={description}\n onChange={({ detail }) => onChange(detail.checked ? 'compact' : 'comfortable')}\n className={styles['content-density']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface CustomPreferenceProps<T = any> extends Pick<CollectionPreferencesProps<T>, 'customPreference'> {\n onChange: (value: T) => void;\n value: T;\n}\nexport const CustomPreference = ({ value, customPreference, onChange }: CustomPreferenceProps) => {\n const [customState, setCustomState] = useState(value);\n if (customPreference) {\n return (\n <div className={styles.custom}>\n {customPreference(customState, value => {\n // prevent value to be treated as a functional callback\n setCustomState(() => value);\n onChange(value);\n })}\n </div>\n );\n }\n return null;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["collection-preferences/utils.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,EACb,MAAM,GACiC,EAA0C,EAAE,CAAC,CAAC;IACrF,QAAQ;IACR,SAAS;IACT,WAAW;IACX,cAAc;IACd,cAAc;IACd,cAAc;IACd,aAAa;IACb,MAAM;CACP,CAAC,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,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,IAAI,gBAAgB,EAAE;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAC1B,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YACrC,uDAAuD;YACvD,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACE,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\nimport InternalCheckbox from '../checkbox/internal';\nimport InternalColumnLayout from '../column-layout/internal';\nimport InternalFormField from '../form-field/internal';\nimport InternalRadioGroup from '../radio-group/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport const copyPreferences = ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n contentDisplay,\n stickyColumns,\n custom,\n}: CollectionPreferencesProps.Preferences): CollectionPreferencesProps.Preferences => ({\n pageSize,\n wrapLines,\n stripedRows,\n contentDensity,\n visibleContent,\n contentDisplay,\n stickyColumns,\n custom,\n});\n\ntype CopyPreferenceName = keyof CollectionPreferencesProps.Preferences;\n\nexport const mergePreferences = (\n newPref: CollectionPreferencesProps.Preferences,\n oldPref: CollectionPreferencesProps.Preferences\n): CollectionPreferencesProps.Preferences => {\n const newObj = { ...oldPref };\n const prefNames: CopyPreferenceName[] = [\n 'pageSize',\n 'wrapLines',\n 'stripedRows',\n 'contentDensity',\n 'visibleContent',\n 'custom',\n 'contentDisplay',\n 'stickyColumns',\n ];\n for (const prefName of prefNames) {\n if (newPref[prefName] !== undefined) {\n newObj[prefName] = newPref[prefName];\n }\n }\n return newObj;\n};\n\ninterface ModalContentLayoutProps {\n left: React.ReactNode;\n right: React.ReactNode;\n}\n\nexport const ModalContentLayout = ({ left, right }: ModalContentLayoutProps) => {\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const smallContainer = breakpoint === 'default';\n\n if (smallContainer) {\n return (\n <div ref={ref}>\n {left && <div>{left}</div>}\n {right && <div className={clsx(left && styles['second-column-small'])}>{right}</div>}\n </div>\n );\n }\n\n const columns = left && right ? 2 : 1;\n return (\n <div ref={ref}>\n <InternalColumnLayout columns={columns} variant=\"text-grid\">\n {left && <div>{left}</div>}\n {right && <div>{right}</div>}\n </InternalColumnLayout>\n </div>\n );\n};\n\ninterface PageSizePreferenceProps extends CollectionPreferencesProps.PageSizePreference {\n onChange: (value: number) => void;\n value?: number;\n}\n\nexport const PageSizePreference = ({ title, options, value, onChange }: PageSizePreferenceProps) => (\n <div className={styles['page-size']}>\n <InternalFormField label={title} stretch={true} className={styles['page-size-form-field']}>\n <InternalRadioGroup\n className={styles['page-size-radio-group']}\n value={`${value}`}\n items={options.map(({ label, value }) => ({ label, value: `${value}` }))}\n onChange={({ detail }) => onChange(parseInt(detail.value, 10))}\n />\n </InternalFormField>\n </div>\n);\n\ninterface WrapLinesPreferenceProps extends CollectionPreferencesProps.WrapLinesPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const WrapLinesPreference = ({ label, description, value, onChange }: WrapLinesPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['wrap-lines']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface StripedRowsPreferenceProps extends CollectionPreferencesProps.StripedRowsPreference {\n onChange: (value: boolean) => void;\n value?: boolean;\n}\n\nexport const StripedRowsPreference = ({ label, description, value, onChange }: StripedRowsPreferenceProps) => (\n <InternalCheckbox\n checked={!!value}\n description={description}\n onChange={({ detail }) => onChange(detail.checked)}\n className={styles['striped-rows']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface ContentDensityPreferenceProps extends CollectionPreferencesProps.ContentDensityPreference {\n onChange: (value: 'comfortable' | 'compact') => void;\n value?: 'comfortable' | 'compact';\n}\n\nexport const ContentDensityPreference = ({ label, description, value, onChange }: ContentDensityPreferenceProps) => (\n <InternalCheckbox\n checked={value === 'compact'}\n description={description}\n onChange={({ detail }) => onChange(detail.checked ? 'compact' : 'comfortable')}\n className={styles['content-density']}\n >\n {label}\n </InternalCheckbox>\n);\n\ninterface StickyColumnsPreferenceProps extends CollectionPreferencesProps.StickyColumnsPreference {\n onChange: (value?: { first?: number; last?: number }) => void;\n value?: { first?: number; last?: number };\n}\ninterface StickyPreference extends CollectionPreferencesProps.StickyColumnsPreference {\n onChange: (value: number) => void;\n preference: {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n };\n value?: number;\n firstOrLast: 'first' | 'last';\n}\n\nconst StickyPreference = ({ firstOrLast, preference, value, onChange }: StickyPreference) => {\n const { title, description, options } = preference;\n return (\n <div className={styles[`sticky-columns-${firstOrLast}`]}>\n <InternalFormField className={styles['sticky-columns-form-field']} label={title} description={description}>\n <InternalRadioGroup\n className={styles['sticky-columns-radio-group']}\n value={typeof value !== 'undefined' ? `${value}` : null}\n items={options.map(({ label, value }) => ({ label, value: `${value}` }))}\n onChange={({ detail }) => onChange(Number(detail.value))}\n />\n </InternalFormField>\n </div>\n );\n};\n\nexport const StickyColumnsPreference = ({\n firstColumns,\n lastColumns,\n onChange,\n value,\n}: StickyColumnsPreferenceProps) => {\n return (\n <InternalSpaceBetween className={styles['sticky-columns']} size=\"l\">\n {firstColumns && (\n <StickyPreference\n firstOrLast=\"first\"\n preference={firstColumns}\n value={value?.first}\n onChange={newValue => onChange({ ...value, first: newValue })}\n />\n )}\n {lastColumns && (\n <StickyPreference\n firstOrLast=\"last\"\n preference={lastColumns}\n value={value?.last}\n onChange={newValue => onChange({ ...value, last: newValue })}\n />\n )}\n </InternalSpaceBetween>\n );\n};\n\ninterface CustomPreferenceProps<T = any> extends Pick<CollectionPreferencesProps<T>, 'customPreference'> {\n onChange: (value: T) => void;\n value: T;\n}\nexport const CustomPreference = ({ value, customPreference, onChange }: CustomPreferenceProps) => {\n const [customState, setCustomState] = useState(value);\n if (customPreference) {\n return (\n <div className={styles.custom}>\n {customPreference(customState, value => {\n // prevent value to be treated as a functional callback\n setCustomState(() => value);\n onChange(value);\n })}\n </div>\n );\n }\n return null;\n};\n"]}
|
|
@@ -465,6 +465,7 @@
|
|
|
465
465
|
--motion-duration-slow-0273ow:180ms;
|
|
466
466
|
--motion-duration-transition-quick-x85tae:90ms;
|
|
467
467
|
--motion-duration-transition-show-paced-ai4wlf:180ms;
|
|
468
|
+
--motion-duration-transition-show-quick-w3nd9c:90ms;
|
|
468
469
|
--motion-easing-ease-out-quart-z687ml:cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
469
470
|
--motion-easing-refresh-only-a-sy0g8m:cubic-bezier(0, 0, 0, 1);
|
|
470
471
|
--motion-easing-refresh-only-b-nspng9:cubic-bezier(1, 0, 0.83, 1);
|
|
@@ -591,6 +592,8 @@
|
|
|
591
592
|
--shadow-split-side-dzdo00:0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15);
|
|
592
593
|
--shadow-sticky-thyisb:0px 1px 4px -2px rgba(0, 28, 36, 0.5);
|
|
593
594
|
--shadow-sticky-embedded-5acv0s:0px 1px 4px -2px rgba(0, 28, 36, 0.5);
|
|
595
|
+
--shadow-sticky-column-first-wg40pz:4px 0 8px 0 rgba(0, 28, 36, 0.1);
|
|
596
|
+
--shadow-sticky-column-last-ew47wj:-4px 0 8px 0 rgba(0, 28, 36, 0.1);
|
|
594
597
|
}
|
|
595
598
|
|
|
596
599
|
.awsui-dark-mode:not(#\9) {
|
|
@@ -936,6 +939,8 @@
|
|
|
936
939
|
--shadow-split-side-dzdo00:0 1px 1px 0 rgba(0, 0, 0, 0.3), 1px 1px 1px 0 rgba(0, 0, 0, 0.3), -1px 1px 1px 0 rgba(0, 0, 0, 0.3);
|
|
937
940
|
--shadow-sticky-thyisb:0px 1px 4px -2px rgba(0, 0, 0, 0.5);
|
|
938
941
|
--shadow-sticky-embedded-5acv0s:0px 1px 4px -2px rgba(0, 0, 0, 0.5);
|
|
942
|
+
--shadow-sticky-column-first-wg40pz:4px 0 8px 0 rgba(0, 0, 0, 0.5);
|
|
943
|
+
--shadow-sticky-column-last-ew47wj:-4px 0 8px 0 rgba(0, 0, 0, 0.5);
|
|
939
944
|
}
|
|
940
945
|
|
|
941
946
|
.awsui-compact-mode:not(#\9) {
|
|
@@ -986,6 +991,7 @@
|
|
|
986
991
|
--motion-duration-slow-0273ow:0ms;
|
|
987
992
|
--motion-duration-transition-quick-x85tae:0ms;
|
|
988
993
|
--motion-duration-transition-show-paced-ai4wlf:0ms;
|
|
994
|
+
--motion-duration-transition-show-quick-w3nd9c:0ms;
|
|
989
995
|
--motion-duration-responsive-6gesm2:0ms;
|
|
990
996
|
--motion-duration-expressive-7zlqxq:0ms;
|
|
991
997
|
--motion-duration-complex-0dbuo2:0ms;
|
|
@@ -1538,6 +1544,8 @@
|
|
|
1538
1544
|
--shadow-split-side-dzdo00:-1px 0px 1px 0px #e9ebed, -36px 6px 36px -36px rgba(0, 7, 22, 0.10);
|
|
1539
1545
|
--shadow-sticky-thyisb:0px 4px 20px 1px rgba(0, 7, 22, 0.10);
|
|
1540
1546
|
--shadow-sticky-embedded-5acv0s:0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.10);
|
|
1547
|
+
--shadow-sticky-column-first-wg40pz:4px 0px 20px 1px rgba(0, 7, 22, 0.1);
|
|
1548
|
+
--shadow-sticky-column-last-ew47wj:-4px 0 20px 1px rgba(0, 28, 36, 0.1);
|
|
1541
1549
|
}
|
|
1542
1550
|
|
|
1543
1551
|
.awsui-dark-mode.awsui-visual-refresh:not(#\9) {
|
|
@@ -1744,6 +1752,8 @@
|
|
|
1744
1752
|
--shadow-split-side-dzdo00:-1px 0px 1px 0px #192534, -36px 6px 36px -36px rgba(0, 7, 22, 1);
|
|
1745
1753
|
--shadow-sticky-thyisb:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
1746
1754
|
--shadow-sticky-embedded-5acv0s:0px 2px 0px 0px #414d5c, 0px 16px 16px -12px rgba(0, 7, 22, 1);
|
|
1755
|
+
--shadow-sticky-column-first-wg40pz:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
1756
|
+
--shadow-sticky-column-last-ew47wj:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
1747
1757
|
}
|
|
1748
1758
|
|
|
1749
1759
|
.awsui-compact-mode.awsui-visual-refresh:not(#\9) {
|
|
@@ -2365,6 +2375,8 @@
|
|
|
2365
2375
|
--shadow-split-side-dzdo00:-1px 0px 1px 0px #192534, -36px 6px 36px -36px rgba(0, 7, 22, 1);
|
|
2366
2376
|
--shadow-sticky-thyisb:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2367
2377
|
--shadow-sticky-embedded-5acv0s:0px 2px 0px 0px #414d5c, 0px 16px 16px -12px rgba(0, 7, 22, 1);
|
|
2378
|
+
--shadow-sticky-column-first-wg40pz:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2379
|
+
--shadow-sticky-column-last-ew47wj:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2368
2380
|
}
|
|
2369
2381
|
|
|
2370
2382
|
.awsui-context-content-header.awsui-visual-refresh:not(#\9) {
|
|
@@ -2560,6 +2572,8 @@
|
|
|
2560
2572
|
--shadow-split-side-dzdo00:-1px 0px 1px 0px #192534, -36px 6px 36px -36px rgba(0, 7, 22, 1);
|
|
2561
2573
|
--shadow-sticky-thyisb:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2562
2574
|
--shadow-sticky-embedded-5acv0s:0px 2px 0px 0px #414d5c, 0px 16px 16px -12px rgba(0, 7, 22, 1);
|
|
2575
|
+
--shadow-sticky-column-first-wg40pz:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2576
|
+
--shadow-sticky-column-last-ew47wj:0px 4px 20px 1px rgba(0, 7, 22, 1);
|
|
2563
2577
|
}
|
|
2564
2578
|
|
|
2565
2579
|
.awsui-visual-refresh .awsui-context-flashbar:not(#\9) {
|
|
@@ -14,7 +14,8 @@ export interface AbstractSwitchProps extends React.HTMLAttributes<HTMLElement>,
|
|
|
14
14
|
ariaLabel?: string;
|
|
15
15
|
ariaLabelledby?: string;
|
|
16
16
|
ariaDescribedby?: string;
|
|
17
|
+
ariaControls?: string;
|
|
17
18
|
onClick: () => void;
|
|
18
19
|
}
|
|
19
|
-
export default function AbstractSwitch({ controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, onClick, __internalRootRef, ...rest }: AbstractSwitchProps): JSX.Element;
|
|
20
|
+
export default function AbstractSwitch({ controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef, ...rest }: AbstractSwitchProps): JSX.Element;
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/abstract-switch/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,0BAA0B;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;IAC1F,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/abstract-switch/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,0BAA0B;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;IAC1F,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eAgErB"}
|
|
@@ -9,7 +9,7 @@ function joinString(values) {
|
|
|
9
9
|
return values.filter((value) => !!value).join(' ');
|
|
10
10
|
}
|
|
11
11
|
export default function AbstractSwitch(_a) {
|
|
12
|
-
var { controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, onClick, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "controlClassName", "outlineClassName", "showOutline", "disabled", "nativeControl", "styledControl", "label", "description", "descriptionBottomPadding", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "onClick", "__internalRootRef"]);
|
|
12
|
+
var { controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "controlClassName", "outlineClassName", "showOutline", "disabled", "nativeControl", "styledControl", "label", "description", "descriptionBottomPadding", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "ariaControls", "onClick", "__internalRootRef"]);
|
|
13
13
|
const uniqueId = useUniqueId();
|
|
14
14
|
const id = controlId || uniqueId;
|
|
15
15
|
const labelId = `${id}-label`;
|
|
@@ -21,12 +21,12 @@ export default function AbstractSwitch(_a) {
|
|
|
21
21
|
if (ariaLabelledby) {
|
|
22
22
|
ariaLabelledByIds.push(ariaLabelledby);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const ariaDescriptions = [];
|
|
25
25
|
if (ariaDescribedby) {
|
|
26
|
-
|
|
26
|
+
ariaDescriptions.push(ariaDescribedby);
|
|
27
27
|
}
|
|
28
28
|
if (description) {
|
|
29
|
-
|
|
29
|
+
ariaDescriptions.push(descriptionId);
|
|
30
30
|
}
|
|
31
31
|
return (React.createElement("span", Object.assign({}, rest, { className: clsx(styles.wrapper, rest.className), ref: __internalRootRef }),
|
|
32
32
|
React.createElement("span", { className: styles['label-wrapper'], "aria-disabled": disabled ? 'true' : undefined, onClick: disabled ? undefined : onClick },
|
|
@@ -36,9 +36,10 @@ export default function AbstractSwitch(_a) {
|
|
|
36
36
|
id,
|
|
37
37
|
disabled,
|
|
38
38
|
className: styles['native-input'],
|
|
39
|
-
'aria-describedby':
|
|
39
|
+
'aria-describedby': ariaDescriptions.length ? joinString(ariaDescriptions) : undefined,
|
|
40
40
|
'aria-labelledby': ariaLabelledByIds.length ? joinString(ariaLabelledByIds) : undefined,
|
|
41
41
|
'aria-label': ariaLabel,
|
|
42
|
+
'aria-controls': ariaControls,
|
|
42
43
|
}),
|
|
43
44
|
React.createElement("span", { className: clsx(styles.outline, outlineClassName, showOutline && styles['show-outline']) })),
|
|
44
45
|
React.createElement("span", { className: clsx(styles.content, !label && !description && styles['empty-content']) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/abstract-switch/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/abstract-switch/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAqBxD,SAAS,UAAU,CAAC,MAA8B;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAkBjB;QAlBiB,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,EACP,iBAAiB,OAEG,EADjB,IAAI,cAjB8B,wQAkBtC,CADQ;IAEP,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,GAAG,SAAS,IAAI,QAAQ,CAAC;IAEjC,MAAM,OAAO,GAAG,GAAG,EAAE,QAAQ,CAAC;IAC9B,MAAM,aAAa,GAAG,GAAG,EAAE,cAAc,CAA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AO,EAAE,gBAAgB,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC7F;YACP,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;gBACrF,KAAK,IAAI,CACR,8BAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IACvF,KAAK,CACD,CACR;gBACA,WAAW,IAAI,CACd,8BACE,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;wBAClC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,QAAQ;wBAC1C,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,wBAAwB;qBACjE,CAAC,IAED,WAAW,CACP,CACR,CACI,CACF,CACF,CACR,CAAC;AACJ,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';\nimport styles from './styles.css.js';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component/index.js';\n\nexport interface AbstractSwitchProps extends React.HTMLAttributes<HTMLElement>, InternalBaseComponentProps {\n controlId?: string;\n controlClassName: string;\n outlineClassName: string;\n showOutline?: boolean;\n disabled?: boolean;\n nativeControl: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactElement;\n styledControl: React.ReactElement;\n label?: React.ReactNode;\n description?: React.ReactNode;\n descriptionBottomPadding?: boolean;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n ariaControls?: string;\n onClick: () => void;\n}\n\nfunction joinString(values: (string | undefined)[]) {\n return values.filter((value): value is string => !!value).join(' ');\n}\n\nexport default function AbstractSwitch({\n controlId,\n controlClassName,\n outlineClassName,\n showOutline,\n disabled,\n nativeControl,\n styledControl,\n label,\n description,\n descriptionBottomPadding,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaControls,\n onClick,\n __internalRootRef,\n ...rest\n}: AbstractSwitchProps) {\n const uniqueId = useUniqueId();\n const id = controlId || uniqueId;\n\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n\n const ariaLabelledByIds = [];\n if (label) {\n ariaLabelledByIds.push(labelId);\n }\n if (ariaLabelledby) {\n ariaLabelledByIds.push(ariaLabelledby);\n }\n\n const ariaDescriptions = [];\n if (ariaDescribedby) {\n ariaDescriptions.push(ariaDescribedby);\n }\n if (description) {\n ariaDescriptions.push(descriptionId);\n }\n\n return (\n <span {...rest} className={clsx(styles.wrapper, rest.className)} ref={__internalRootRef}>\n <span\n className={styles['label-wrapper']}\n aria-disabled={disabled ? 'true' : undefined}\n onClick={disabled ? undefined : onClick}\n >\n <span className={clsx(styles.control, controlClassName)}>\n {styledControl}\n {nativeControl({\n id,\n disabled,\n className: styles['native-input'],\n 'aria-describedby': ariaDescriptions.length ? joinString(ariaDescriptions) : undefined,\n 'aria-labelledby': ariaLabelledByIds.length ? joinString(ariaLabelledByIds) : undefined,\n 'aria-label': ariaLabel,\n 'aria-controls': ariaControls,\n })}\n <span className={clsx(styles.outline, outlineClassName, showOutline && styles['show-outline'])} />\n </span>\n <span className={clsx(styles.content, !label && !description && styles['empty-content'])}>\n {label && (\n <span id={labelId} className={clsx(styles.label, { [styles['label-disabled']]: disabled })}>\n {label}\n </span>\n )}\n {description && (\n <span\n id={descriptionId}\n className={clsx(styles.description, {\n [styles['description-disabled']]: disabled,\n [styles['description-bottom-padding']]: descriptionBottomPadding,\n })}\n >\n {description}\n </span>\n )}\n </span>\n </span>\n </span>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,eAAO,MAAM,QAAQ,kCAAmC,aAAa,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,eAAO,MAAM,QAAQ,kCAAmC,aAAa,gBAuBpE,CAAC;AAEF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,SAAS,wBAAyB,cAAc,gBAM5D,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,iEAAkE,gBAAgB,gBAqBzG,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const Progress = ({ value, isInFlash, labelId }) => {
|
|
|
14
14
|
const roundedValue = Math.round(value);
|
|
15
15
|
const progressValue = clamp(roundedValue, 0, MAX_VALUE);
|
|
16
16
|
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']),
|
|
17
|
+
React.createElement("progress", { className: clsx(styles.progress, progressValue >= MAX_VALUE && styles.complete, isInFlash && styles['progress-in-flash']), max: MAX_VALUE, value: progressValue, "aria-labelledby": labelId }),
|
|
18
18
|
React.createElement("span", { "aria-hidden": "true", className: styles['percentage-container'] },
|
|
19
19
|
React.createElement(InternalBox, { className: styles.percentage, variant: "small", color: isInFlash ? 'inherit' : undefined }, `${progressValue}%`))));
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["progress-bar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,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;AAOF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAiB,EAAE,EAAE;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AgB,CAAC;IAE3C,IAAI,SAAS,EAAE;QACb,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,oBAAoB,MAAM,EAAE,CAAC,eAAY,QAAQ,iBAAa,MAAM;YACzF,8BAAM,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAAG,UAAU,CAAQ,CACvD,CACP,CAAC;KACH;IAED,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,oBAAoB,MAAM,EAAE,CAAC,eAAY,QAAQ,iBAAa,MAAM;QACzF,8BAAM,SAAS,EAAE,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACpE,oBAAC,uBAAuB,IAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;gBACvE,8BAAM,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,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';\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';\n\nimport { ProgressBarProps } from './interfaces';\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 labelId: string;\n}\nexport const Progress = ({ value, isInFlash, labelId }: ProgressProps) => {\n const roundedValue = Math.round(value);\n const progressValue = clamp(roundedValue, 0, MAX_VALUE);\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-labelledby={labelId}\n />\n <span aria-hidden=\"true\" className={styles['percentage-container']}>\n <InternalBox className={styles.percentage} variant=\"small\" color={isInFlash ? 'inherit' : undefined}>\n {`${progressValue}%`}\n </InternalBox>\n </span>\n </div>\n );\n};\n\ninterface SmallTextProps {\n color?: BoxProps.Color;\n children: React.ReactNode;\n}\n\nexport const SmallText = ({ color, children }: SmallTextProps) => {\n return (\n <InternalBox className={styles['word-wrap']} variant=\"small\" display=\"block\" color={color}>\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}`]} aria-live=\"polite\" aria-atomic=\"true\">\n <span className={styles['result-text']}>{resultText}</span>\n </div>\n );\n }\n\n return (\n <div className={styles[`result-container-${status}`]} aria-live=\"polite\" aria-atomic=\"true\">\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,28 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"body-cell": "awsui_body-
|
|
5
|
-
"body-cell-wrap": "awsui_body-cell-
|
|
6
|
-
"is-visual-refresh": "awsui_is-visual-
|
|
7
|
-
"has-striped-rows": "awsui_has-striped-
|
|
8
|
-
"body-cell-edit-active": "awsui_body-cell-edit-
|
|
9
|
-
"body-cell-editable": "awsui_body-cell-
|
|
10
|
-
"has-
|
|
11
|
-
"
|
|
12
|
-
"body-cell-
|
|
13
|
-
"body-cell-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"body-cell-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"body-cell-
|
|
22
|
-
"body-cell-
|
|
23
|
-
"body-cell-
|
|
24
|
-
"body-cell-
|
|
25
|
-
"body-cell-
|
|
26
|
-
"body-cell-
|
|
4
|
+
"body-cell": "awsui_body-cell_c6tup_acs3p_93",
|
|
5
|
+
"body-cell-wrap": "awsui_body-cell-wrap_c6tup_acs3p_103",
|
|
6
|
+
"is-visual-refresh": "awsui_is-visual-refresh_c6tup_acs3p_115",
|
|
7
|
+
"has-striped-rows": "awsui_has-striped-rows_c6tup_acs3p_127",
|
|
8
|
+
"body-cell-edit-active": "awsui_body-cell-edit-active_c6tup_acs3p_130",
|
|
9
|
+
"body-cell-editable": "awsui_body-cell-editable_c6tup_acs3p_130",
|
|
10
|
+
"has-striped-rows-sticky-cell-pad-left": "awsui_has-striped-rows-sticky-cell-pad-left_c6tup_acs3p_136",
|
|
11
|
+
"has-selection": "awsui_has-selection_c6tup_acs3p_139",
|
|
12
|
+
"body-cell-first-row": "awsui_body-cell-first-row_c6tup_acs3p_145",
|
|
13
|
+
"body-cell-last-row": "awsui_body-cell-last-row_c6tup_acs3p_148",
|
|
14
|
+
"body-cell-selected": "awsui_body-cell-selected_c6tup_acs3p_148",
|
|
15
|
+
"has-footer": "awsui_has-footer_c6tup_acs3p_148",
|
|
16
|
+
"body-cell-shaded": "awsui_body-cell-shaded_c6tup_acs3p_158",
|
|
17
|
+
"sticky-cell": "awsui_sticky-cell_c6tup_acs3p_175",
|
|
18
|
+
"sticky-cell-pad-left": "awsui_sticky-cell-pad-left_c6tup_acs3p_183",
|
|
19
|
+
"sticky-cell-last-right": "awsui_sticky-cell-last-right_c6tup_acs3p_200",
|
|
20
|
+
"sticky-cell-last-left": "awsui_sticky-cell-last-left_c6tup_acs3p_204",
|
|
21
|
+
"body-cell-next-selected": "awsui_body-cell-next-selected_c6tup_acs3p_227",
|
|
22
|
+
"body-cell-prev-selected": "awsui_body-cell-prev-selected_c6tup_acs3p_231",
|
|
23
|
+
"body-cell-success": "awsui_body-cell-success_c6tup_acs3p_255",
|
|
24
|
+
"body-cell-editor": "awsui_body-cell-editor_c6tup_acs3p_255",
|
|
25
|
+
"body-cell-success-form": "awsui_body-cell-success-form_c6tup_acs3p_277",
|
|
26
|
+
"body-cell-editor-form": "awsui_body-cell-editor-form_c6tup_acs3p_277",
|
|
27
|
+
"body-cell-success-row": "awsui_body-cell-success-row_c6tup_acs3p_286",
|
|
28
|
+
"body-cell-editor-row": "awsui_body-cell-editor-row_c6tup_acs3p_286",
|
|
29
|
+
"body-cell-success-controls": "awsui_body-cell-success-controls_c6tup_acs3p_296",
|
|
30
|
+
"body-cell-editor-controls": "awsui_body-cell-editor-controls_c6tup_acs3p_296",
|
|
31
|
+
"body-cell-has-success": "awsui_body-cell-has-success_c6tup_acs3p_315"
|
|
27
32
|
};
|
|
28
33
|
|