@cloudscape-design/components 3.0.773 → 3.0.775
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/app-layout/drawer/index.js.map +1 -1
- package/app-layout/drawer/overflow-menu.d.ts +6 -2
- package/app-layout/drawer/overflow-menu.d.ts.map +1 -1
- package/app-layout/drawer/overflow-menu.js +22 -8
- package/app-layout/drawer/overflow-menu.js.map +1 -1
- package/app-layout/interfaces.d.ts +2 -1
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/runtime-api.d.ts +4 -3
- package/app-layout/runtime-api.d.ts.map +1 -1
- package/app-layout/runtime-api.js +15 -11
- package/app-layout/runtime-api.js.map +1 -1
- package/app-layout/test-classes/styles.css.js +20 -19
- package/app-layout/test-classes/styles.scoped.css +23 -19
- package/app-layout/test-classes/styles.selectors.js +20 -19
- package/app-layout/utils/use-drawers.d.ts +12 -1
- package/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/app-layout/utils/use-drawers.js +125 -20
- package/app-layout/utils/use-drawers.js.map +1 -1
- package/app-layout/utils/use-focus-control.d.ts +10 -0
- package/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-focus-control.js +60 -1
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/utils/visibility-context.d.ts +3 -0
- package/app-layout/utils/visibility-context.d.ts.map +1 -0
- package/app-layout/utils/visibility-context.js +5 -0
- package/app-layout/utils/visibility-context.js.map +1 -0
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.d.ts +5 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.js +15 -4
- package/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts +15 -0
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -0
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +71 -0
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -0
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts +6 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +15 -4
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +35 -23
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +10 -6
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +28 -6
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +10 -6
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +60 -6
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.d.ts +10 -1
- package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.d.ts +3 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.js +3 -2
- package/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +17 -16
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +50 -32
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +17 -16
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts +6 -2
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +34 -10
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +5 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +17 -13
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/collection-preferences/analytics-metadata/interfaces.d.ts +43 -0
- package/collection-preferences/analytics-metadata/interfaces.d.ts.map +1 -0
- package/collection-preferences/analytics-metadata/interfaces.js +4 -0
- package/collection-preferences/analytics-metadata/interfaces.js.map +1 -0
- package/collection-preferences/analytics-metadata/styles.css.js +6 -0
- package/collection-preferences/analytics-metadata/styles.scoped.css +7 -0
- package/collection-preferences/analytics-metadata/styles.selectors.js +7 -0
- package/collection-preferences/analytics-metadata/utils.d.ts +9 -0
- package/collection-preferences/analytics-metadata/utils.d.ts.map +1 -0
- package/collection-preferences/analytics-metadata/utils.js +48 -0
- package/collection-preferences/analytics-metadata/utils.js.map +1 -0
- package/collection-preferences/content-display/content-display-option.d.ts +1 -0
- package/collection-preferences/content-display/content-display-option.d.ts.map +1 -1
- package/collection-preferences/content-display/content-display-option.js +2 -2
- package/collection-preferences/content-display/content-display-option.js.map +1 -1
- package/collection-preferences/content-display/draggable-option.d.ts.map +1 -1
- package/collection-preferences/content-display/draggable-option.js +2 -2
- package/collection-preferences/content-display/draggable-option.js.map +1 -1
- package/collection-preferences/content-display/index.d.ts +1 -1
- package/collection-preferences/content-display/index.d.ts.map +1 -1
- package/collection-preferences/content-display/index.js +21 -7
- package/collection-preferences/content-display/index.js.map +1 -1
- package/collection-preferences/content-display/styles.css.js +13 -11
- package/collection-preferences/content-display/styles.scoped.css +19 -17
- package/collection-preferences/content-display/styles.selectors.js +13 -11
- package/collection-preferences/index.d.ts.map +1 -1
- package/collection-preferences/index.js +21 -15
- package/collection-preferences/index.js.map +1 -1
- package/collection-preferences/interfaces.d.ts +29 -0
- package/collection-preferences/interfaces.d.ts.map +1 -1
- package/collection-preferences/interfaces.js.map +1 -1
- package/collection-preferences/styles.css.js +39 -37
- package/collection-preferences/styles.scoped.css +46 -44
- package/collection-preferences/styles.selectors.js +39 -37
- package/collection-preferences/utils.d.ts.map +1 -1
- package/collection-preferences/utils.js +12 -13
- package/collection-preferences/utils.js.map +1 -1
- package/collection-preferences/visible-content.d.ts.map +1 -1
- package/collection-preferences/visible-content.js +2 -1
- package/collection-preferences/visible-content.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +9 -10
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/styles.css.js +38 -39
- package/date-range-picker/styles.scoped.css +47 -51
- package/date-range-picker/styles.selectors.js +38 -39
- package/flashbar/styles.css.js +50 -50
- package/flashbar/styles.scoped.css +156 -149
- package/flashbar/styles.selectors.js +50 -50
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.ar.js +1 -1
- package/i18n/messages/all.ar.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +7 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/analytics/interfaces.d.ts +1 -0
- package/internal/analytics/interfaces.d.ts.map +1 -1
- package/internal/analytics/interfaces.js.map +1 -1
- package/internal/components/drag-handle/index.d.ts +2 -1
- package/internal/components/drag-handle/index.d.ts.map +1 -1
- package/internal/components/drag-handle/index.js +3 -3
- package/internal/components/drag-handle/index.js.map +1 -1
- package/internal/components/drag-handle/styles.css.js +2 -1
- package/internal/components/drag-handle/styles.scoped.css +6 -2
- package/internal/components/drag-handle/styles.selectors.js +2 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/hooks/use-component-analytics/index.d.ts +7 -1
- package/internal/hooks/use-component-analytics/index.d.ts.map +1 -1
- package/internal/hooks/use-component-analytics/index.js +21 -4
- package/internal/hooks/use-component-analytics/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/drawers.d.ts +19 -2
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js +34 -2
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/plugins/helpers/runtime-content-wrapper.d.ts +4 -2
- package/internal/plugins/helpers/runtime-content-wrapper.d.ts.map +1 -1
- package/internal/plugins/helpers/runtime-content-wrapper.js +19 -4
- package/internal/plugins/helpers/runtime-content-wrapper.js.map +1 -1
- package/modal/internal.d.ts +1 -0
- package/modal/internal.d.ts.map +1 -1
- package/modal/internal.js +2 -2
- package/modal/internal.js.map +1 -1
- package/package.json +2 -1
- package/prompt-input/interfaces.d.ts +0 -16
- package/prompt-input/interfaces.d.ts.map +1 -1
- package/prompt-input/interfaces.js.map +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js +11 -28
- package/prompt-input/internal.js.map +1 -1
- package/prompt-input/styles.css.js +8 -14
- package/prompt-input/styles.scoped.css +68 -264
- package/prompt-input/styles.selectors.js +8 -14
- package/prompt-input/test-classes/styles.css.js +3 -5
- package/prompt-input/test-classes/styles.scoped.css +3 -11
- package/prompt-input/test-classes/styles.selectors.js +3 -5
- package/steps/index.d.ts +6 -0
- package/steps/index.d.ts.map +1 -0
- package/steps/index.js +19 -0
- package/steps/index.js.map +1 -0
- package/steps/interfaces.d.ts +40 -0
- package/steps/interfaces.d.ts.map +1 -0
- package/steps/interfaces.js +2 -0
- package/steps/interfaces.js.map +1 -0
- package/steps/internal.d.ts +8 -0
- package/steps/internal.d.ts.map +1 -0
- package/steps/internal.js +21 -0
- package/steps/internal.js.map +1 -0
- package/steps/styles.css.js +11 -0
- package/steps/styles.scoped.css +247 -0
- package/steps/styles.selectors.js +12 -0
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +2 -2
- package/table/internal.js.map +1 -1
- package/test-utils/dom/collection-preferences/content-display-preference.d.ts +9 -0
- package/test-utils/dom/collection-preferences/content-display-preference.js +13 -0
- package/test-utils/dom/collection-preferences/content-display-preference.js.map +1 -1
- package/test-utils/dom/index.d.ts +3 -0
- package/test-utils/dom/index.js +9 -1
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/dom/prompt-input/index.d.ts +0 -2
- package/test-utils/dom/prompt-input/index.js +0 -6
- package/test-utils/dom/prompt-input/index.js.map +1 -1
- package/test-utils/dom/steps/index.d.ts +18 -0
- package/test-utils/dom/steps/index.js +33 -0
- package/test-utils/dom/steps/index.js.map +1 -0
- package/test-utils/selectors/collection-preferences/content-display-preference.d.ts +9 -0
- package/test-utils/selectors/collection-preferences/content-display-preference.js +13 -0
- package/test-utils/selectors/collection-preferences/content-display-preference.js.map +1 -1
- package/test-utils/selectors/index.d.ts +3 -0
- package/test-utils/selectors/index.js +9 -1
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/selectors/prompt-input/index.d.ts +0 -2
- package/test-utils/selectors/prompt-input/index.js +0 -6
- package/test-utils/selectors/prompt-input/index.js.map +1 -1
- package/test-utils/selectors/steps/index.d.ts +18 -0
- package/test-utils/selectors/steps/index.js +33 -0
- package/test-utils/selectors/steps/index.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/analytics-metadata/interfaces.d.ts +35 -0
- package/wizard/analytics-metadata/interfaces.d.ts.map +1 -0
- package/wizard/analytics-metadata/interfaces.js +4 -0
- package/wizard/analytics-metadata/interfaces.js.map +1 -0
- package/wizard/analytics-metadata/styles.css.js +6 -0
- package/wizard/analytics-metadata/styles.scoped.css +7 -0
- package/wizard/analytics-metadata/styles.selectors.js +7 -0
- package/wizard/analytics-metadata/utils.d.ts +7 -0
- package/wizard/analytics-metadata/utils.d.ts.map +1 -0
- package/wizard/analytics-metadata/utils.js +14 -0
- package/wizard/analytics-metadata/utils.js.map +1 -0
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +1 -1
- package/wizard/index.js.map +1 -1
- package/wizard/internal.d.ts +4 -2
- package/wizard/internal.d.ts.map +1 -1
- package/wizard/internal.js +14 -3
- package/wizard/internal.js.map +1 -1
- package/wizard/wizard-actions.d.ts +4 -1
- package/wizard/wizard-actions.d.ts.map +1 -1
- package/wizard/wizard-actions.js +9 -5
- package/wizard/wizard-actions.js.map +1 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +1 -1
- package/wizard/wizard-form.js.map +1 -1
- package/wizard/wizard-navigation.d.ts.map +1 -1
- package/wizard/wizard-navigation.js +12 -6
- package/wizard/wizard-navigation.js.map +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface GeneratedAnalyticsMetadataCollectionPreferencesOpen {
|
|
2
|
+
action: 'open';
|
|
3
|
+
detail: {
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface GeneratedAnalyticsMetadataCollectionPreferencesDismiss {
|
|
8
|
+
action: 'dismiss';
|
|
9
|
+
detail: {
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface GeneratedAnalyticsMetadataCollectionPreferencesConfirm {
|
|
14
|
+
action: 'confirm';
|
|
15
|
+
detail: {
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface GeneratedAnalyticsMetadataCollectionPreferencesCancel {
|
|
20
|
+
action: 'cancel';
|
|
21
|
+
detail: {
|
|
22
|
+
label: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface GeneratedAnalyticsMetadataCollectionPreferencesComponent {
|
|
26
|
+
name: 'awsui.CollectionPreferences';
|
|
27
|
+
label: string;
|
|
28
|
+
properties: {
|
|
29
|
+
disabled: string;
|
|
30
|
+
pageSize?: string;
|
|
31
|
+
wrapLines?: string;
|
|
32
|
+
stripedRows?: string;
|
|
33
|
+
contentDensity?: string;
|
|
34
|
+
visibleContentCount?: string;
|
|
35
|
+
stickyColumnsFirst?: string;
|
|
36
|
+
stickyColumnsLast?: string;
|
|
37
|
+
contentDisplayVisibleCount?: string;
|
|
38
|
+
};
|
|
39
|
+
innerContext?: {
|
|
40
|
+
preference: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mDAAmD;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,sDAAsD;IACrE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,sDAAsD;IACrE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,qDAAqD;IACpE,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,wDAAwD;IACvE,IAAI,EAAE,6BAA6B,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,0BAA0B,CAAC,EAAE,MAAM,CAAC;KACrC,CAAC;IACF,YAAY,CAAC,EAAE;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/collection-preferences/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport interface GeneratedAnalyticsMetadataCollectionPreferencesOpen {\n action: 'open';\n detail: {\n label: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataCollectionPreferencesDismiss {\n action: 'dismiss';\n detail: {\n label: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataCollectionPreferencesConfirm {\n action: 'confirm';\n detail: {\n label: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataCollectionPreferencesCancel {\n action: 'cancel';\n detail: {\n label: string;\n };\n}\n\nexport interface GeneratedAnalyticsMetadataCollectionPreferencesComponent {\n name: 'awsui.CollectionPreferences';\n label: string;\n properties: {\n disabled: string;\n pageSize?: string;\n wrapLines?: string;\n stripedRows?: string;\n contentDensity?: string;\n visibleContentCount?: string;\n stickyColumnsFirst?: string;\n stickyColumnsLast?: string;\n contentDisplayVisibleCount?: string;\n };\n innerContext?: {\n preference: string;\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollectionPreferencesProps } from '../interfaces';
|
|
2
|
+
import { GeneratedAnalyticsMetadataCollectionPreferencesComponent } from './interfaces';
|
|
3
|
+
export declare const getComponentAnalyticsMetadata: (disabled: boolean, preferences?: CollectionPreferencesProps['preferences']) => GeneratedAnalyticsMetadataCollectionPreferencesComponent;
|
|
4
|
+
export declare const getAnalyticsInnerContextAttribute: (preference: string) => {
|
|
5
|
+
"data-awsui-analytics": string;
|
|
6
|
+
} | {
|
|
7
|
+
"data-awsui-analytics"?: undefined;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/analytics-metadata/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,wDAAwD,EAAE,MAAM,cAAc,CAAC;AAIxF,eAAO,MAAM,6BAA6B,aAC9B,OAAO,gBACJ,0BAA0B,CAAC,aAAa,CAAC,KACrD,wDAmCF,CAAC;AAEF,eAAO,MAAM,iCAAiC,eAAgB,MAAM;;;;CAOhE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
4
|
+
import analyticsSelectors from './styles.css.js';
|
|
5
|
+
export const getComponentAnalyticsMetadata = (disabled, preferences = {}) => {
|
|
6
|
+
const metadata = {
|
|
7
|
+
name: 'awsui.CollectionPreferences',
|
|
8
|
+
label: `.${analyticsSelectors['trigger-button']}`,
|
|
9
|
+
properties: {
|
|
10
|
+
disabled: `${!!disabled}`,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
if (preferences.pageSize) {
|
|
14
|
+
metadata.properties.pageSize = `${preferences.pageSize}`;
|
|
15
|
+
}
|
|
16
|
+
if (preferences.wrapLines !== undefined) {
|
|
17
|
+
metadata.properties.wrapLines = `${!!preferences.wrapLines}`;
|
|
18
|
+
}
|
|
19
|
+
if (preferences.stripedRows !== undefined) {
|
|
20
|
+
metadata.properties.stripedRows = `${!!preferences.stripedRows}`;
|
|
21
|
+
}
|
|
22
|
+
if (preferences.contentDensity !== undefined) {
|
|
23
|
+
metadata.properties.contentDensity = preferences.contentDensity;
|
|
24
|
+
}
|
|
25
|
+
if (preferences.visibleContent) {
|
|
26
|
+
metadata.properties.visibleContentCount = `${preferences.visibleContent.length}`;
|
|
27
|
+
}
|
|
28
|
+
if (preferences.stickyColumns) {
|
|
29
|
+
if (preferences.stickyColumns.first) {
|
|
30
|
+
metadata.properties.stickyColumnsFirst = `${preferences.stickyColumns.first}`;
|
|
31
|
+
}
|
|
32
|
+
if (preferences.stickyColumns.last) {
|
|
33
|
+
metadata.properties.stickyColumnsLast = `${preferences.stickyColumns.last}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (preferences.contentDisplay) {
|
|
37
|
+
metadata.properties.contentDisplayVisibleCount = `${preferences.contentDisplay.filter(({ visible }) => !!visible).length}`;
|
|
38
|
+
}
|
|
39
|
+
return metadata;
|
|
40
|
+
};
|
|
41
|
+
export const getAnalyticsInnerContextAttribute = (preference) => getAnalyticsMetadataAttribute({
|
|
42
|
+
component: {
|
|
43
|
+
innerContext: {
|
|
44
|
+
preference,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/collection-preferences/analytics-metadata/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAKjH,OAAO,kBAAkB,MAAM,iBAAiB,CAAC;AAEjD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAiB,EACjB,cAAyD,EAAE,EACD,EAAE;IAC5D,MAAM,QAAQ,GAA6D;QACzE,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;QACjD,UAAU,EAAE;YACV,QAAQ,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE;SAC1B;KACF,CAAC;IACF,IAAI,WAAW,CAAC,QAAQ,EAAE;QACxB,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;KAC1D;IACD,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE;QACvC,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;KAC9D;IACD,IAAI,WAAW,CAAC,WAAW,KAAK,SAAS,EAAE;QACzC,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;KAClE;IACD,IAAI,WAAW,CAAC,cAAc,KAAK,SAAS,EAAE;QAC5C,QAAQ,CAAC,UAAU,CAAC,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;KACjE;IACD,IAAI,WAAW,CAAC,cAAc,EAAE;QAC9B,QAAQ,CAAC,UAAU,CAAC,mBAAmB,GAAG,GAAG,WAAW,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;KAClF;IACD,IAAI,WAAW,CAAC,aAAa,EAAE;QAC7B,IAAI,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE;YACnC,QAAQ,CAAC,UAAU,CAAC,kBAAkB,GAAG,GAAG,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;SAC/E;QACD,IAAI,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE;YAClC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,GAAG,GAAG,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;SAC7E;KACF;IACD,IAAI,WAAW,CAAC,cAAc,EAAE;QAC9B,QAAQ,CAAC,UAAU,CAAC,0BAA0B,GAAG,GAAG,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;KAC5H;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,UAAkB,EAAE,EAAE,CACtE,6BAA6B,CAAC;IAC5B,SAAS,EAAE;QACT,YAAY,EAAE;YACZ,UAAU;SACX;KACF;CACF,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { CollectionPreferencesProps } from '../interfaces';\nimport { GeneratedAnalyticsMetadataCollectionPreferencesComponent } from './interfaces';\n\nimport analyticsSelectors from './styles.css.js';\n\nexport const getComponentAnalyticsMetadata = (\n disabled: boolean,\n preferences: CollectionPreferencesProps['preferences'] = {}\n): GeneratedAnalyticsMetadataCollectionPreferencesComponent => {\n const metadata: GeneratedAnalyticsMetadataCollectionPreferencesComponent = {\n name: 'awsui.CollectionPreferences',\n label: `.${analyticsSelectors['trigger-button']}`,\n properties: {\n disabled: `${!!disabled}`,\n },\n };\n if (preferences.pageSize) {\n metadata.properties.pageSize = `${preferences.pageSize}`;\n }\n if (preferences.wrapLines !== undefined) {\n metadata.properties.wrapLines = `${!!preferences.wrapLines}`;\n }\n if (preferences.stripedRows !== undefined) {\n metadata.properties.stripedRows = `${!!preferences.stripedRows}`;\n }\n if (preferences.contentDensity !== undefined) {\n metadata.properties.contentDensity = preferences.contentDensity;\n }\n if (preferences.visibleContent) {\n metadata.properties.visibleContentCount = `${preferences.visibleContent.length}`;\n }\n if (preferences.stickyColumns) {\n if (preferences.stickyColumns.first) {\n metadata.properties.stickyColumnsFirst = `${preferences.stickyColumns.first}`;\n }\n if (preferences.stickyColumns.last) {\n metadata.properties.stickyColumnsLast = `${preferences.stickyColumns.last}`;\n }\n }\n if (preferences.contentDisplay) {\n metadata.properties.contentDisplayVisibleCount = `${preferences.contentDisplay.filter(({ visible }) => !!visible).length}`;\n }\n return metadata;\n};\n\nexport const getAnalyticsInnerContextAttribute = (preference: string) =>\n getAnalyticsMetadataAttribute({\n component: {\n innerContext: {\n preference,\n },\n },\n });\n"]}
|
|
@@ -7,6 +7,7 @@ export interface ContentDisplayOptionProps {
|
|
|
7
7
|
listeners?: SyntheticListenerMap;
|
|
8
8
|
onToggle?: (option: OptionWithVisibility) => void;
|
|
9
9
|
option: OptionWithVisibility;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const ContentDisplayOption: React.ForwardRefExoticComponent<ContentDisplayOptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
export default ContentDisplayOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-display-option.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/content-display-option.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAK1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,YAAY,YAAa,MAAM,WAAgE,CAAC;AAE7G,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClD,MAAM,EAAE,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"content-display-option.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/content-display-option.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAK1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,YAAY,YAAa,MAAM,WAAgE,CAAC;AAE7G,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClD,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,oBAAoB,kGA8BzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -7,14 +7,14 @@ import InternalToggle from '../../toggle/internal';
|
|
|
7
7
|
import styles from '../styles.css.js';
|
|
8
8
|
const componentPrefix = 'content-display-option';
|
|
9
9
|
export const getClassName = (suffix) => styles[[componentPrefix, suffix].filter(Boolean).join('-')];
|
|
10
|
-
const ContentDisplayOption = forwardRef(({ dragHandleAriaLabel, listeners, onToggle, option }, ref) => {
|
|
10
|
+
const ContentDisplayOption = forwardRef(({ dragHandleAriaLabel, listeners, onToggle, option, disabled }, ref) => {
|
|
11
11
|
const idPrefix = useUniqueId(componentPrefix);
|
|
12
12
|
const controlId = `${idPrefix}-control-${option.id}`;
|
|
13
13
|
const dragHandleAttributes = {
|
|
14
14
|
['aria-label']: [dragHandleAriaLabel, option.label].join(', '),
|
|
15
15
|
};
|
|
16
16
|
return (React.createElement("div", { ref: ref, className: getClassName('content') },
|
|
17
|
-
React.createElement(DragHandle, { attributes: dragHandleAttributes, listeners: listeners }),
|
|
17
|
+
React.createElement(DragHandle, { disabled: disabled, attributes: dragHandleAttributes, listeners: listeners }),
|
|
18
18
|
React.createElement("label", { className: getClassName('label'), htmlFor: controlId }, option.label),
|
|
19
19
|
React.createElement("div", { className: getClassName('toggle') },
|
|
20
20
|
React.createElement(InternalToggle, { checked: !!option.visible, onChange: () => onToggle && onToggle(option), disabled: option.alwaysVisible === true, controlId: controlId }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-display-option.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/content-display-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAGnD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"content-display-option.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/content-display-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAGnD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAU7G,MAAM,oBAAoB,GAAG,UAAU,CACrC,CACE,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAA6B,EACzF,GAAiC,EACjC,EAAE;IACF,MAAM,QAAQ,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,GAAG,QAAQ,YAAY,MAAM,CAAC,EAAE,EAAE,CAAC;IAErD,MAAM,oBAAoB,GAAG;QAC3B,CAAC,YAAY,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KAC/D,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC;QAC/C,oBAAC,UAAU,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,GAAI;QAE1F,+BAAO,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,IACxD,MAAM,CAAC,KAAK,CACP;QACR,6BAAK,SAAS,EAAE,YAAY,CAAC,QAAQ,CAAC;YACpC,oBAAC,cAAc,IACb,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EACzB,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,EAC5C,QAAQ,EAAE,MAAM,CAAC,aAAa,KAAK,IAAI,EACvC,SAAS,EAAE,SAAS,GACpB,CACE,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ForwardedRef, forwardRef } from 'react';\nimport { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';\n\nimport DragHandle from '../../internal/components/drag-handle';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport InternalToggle from '../../toggle/internal';\nimport { OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nconst componentPrefix = 'content-display-option';\nexport const getClassName = (suffix?: string) => styles[[componentPrefix, suffix].filter(Boolean).join('-')];\n\nexport interface ContentDisplayOptionProps {\n dragHandleAriaLabel?: string;\n listeners?: SyntheticListenerMap;\n onToggle?: (option: OptionWithVisibility) => void;\n option: OptionWithVisibility;\n disabled?: boolean;\n}\n\nconst ContentDisplayOption = forwardRef(\n (\n { dragHandleAriaLabel, listeners, onToggle, option, disabled }: ContentDisplayOptionProps,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n const idPrefix = useUniqueId(componentPrefix);\n const controlId = `${idPrefix}-control-${option.id}`;\n\n const dragHandleAttributes = {\n ['aria-label']: [dragHandleAriaLabel, option.label].join(', '),\n };\n\n return (\n <div ref={ref} className={getClassName('content')}>\n <DragHandle disabled={disabled} attributes={dragHandleAttributes} listeners={listeners} />\n\n <label className={getClassName('label')} htmlFor={controlId}>\n {option.label}\n </label>\n <div className={getClassName('toggle')}>\n <InternalToggle\n checked={!!option.visible}\n onChange={() => onToggle && onToggle(option)}\n disabled={option.alwaysVisible === true}\n controlId={controlId}\n />\n </div>\n </div>\n );\n }\n);\n\nexport default ContentDisplayOption;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggable-option.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GACP,EAAE;IACD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,oBAAoB,CAAC;CAC9B,
|
|
1
|
+
{"version":3,"file":"draggable-option.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GACP,EAAE;IACD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,oBAAoB,CAAC;CAC9B,eAgCA"}
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
import ContentDisplayOption, { getClassName } from './content-display-option';
|
|
8
8
|
import styles from '../styles.css.js';
|
|
9
9
|
export default function DraggableOption({ dragHandleAriaLabel, onKeyDown, onToggle, option, }) {
|
|
10
|
-
const { isDragging, isSorting, listeners, setNodeRef, transform } = useSortable({
|
|
10
|
+
const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({
|
|
11
11
|
id: option.id,
|
|
12
12
|
});
|
|
13
13
|
const style = {
|
|
@@ -22,6 +22,6 @@ export default function DraggableOption({ dragHandleAriaLabel, onKeyDown, onTogg
|
|
|
22
22
|
}
|
|
23
23
|
} });
|
|
24
24
|
return (React.createElement("li", { className: clsx(getClassName(), isDragging && styles.placeholder, isSorting && styles.sorting), style: style },
|
|
25
|
-
React.createElement(ContentDisplayOption, { ref: setNodeRef, listeners: combinedListeners, dragHandleAriaLabel: dragHandleAriaLabel, onToggle: onToggle, option: option })));
|
|
25
|
+
React.createElement(ContentDisplayOption, { ref: setNodeRef, listeners: combinedListeners, dragHandleAriaLabel: dragHandleAriaLabel, onToggle: onToggle, option: option, disabled: attributes['aria-disabled'] })));
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=draggable-option.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggable-option.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,oBAAoB,EAAE,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GAMP;IACC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"draggable-option.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,oBAAoB,EAAE,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GAMP;IACC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC1F,EAAE,EAAE,MAAM,CAAC,EAAE;KACd,CAAC,CAAC;IACH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;KAC7C,CAAC;IAEF,MAAM,iBAAiB,mCAClB,SAAS,KACZ,SAAS,EAAE,CAAC,KAA0B,EAAE,EAAE;YACxC,IAAI,SAAS,EAAE;gBACb,SAAS,CAAC,KAAK,CAAC,CAAC;aAClB;YACD,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE;gBACxB,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;aAC5B;QACH,CAAC,GACF,CAAC;IAEF,OAAO,CACL,4BAAI,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK;QAC9G,oBAAC,oBAAoB,IACnB,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,UAAU,CAAC,eAAe,CAAC,GACrC,CACC,CACN,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 { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport clsx from 'clsx';\n\nimport ContentDisplayOption, { getClassName } from './content-display-option';\nimport { OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nexport default function DraggableOption({\n dragHandleAriaLabel,\n onKeyDown,\n onToggle,\n option,\n}: {\n dragHandleAriaLabel?: string;\n onKeyDown?: (event: React.KeyboardEvent) => void;\n onToggle: (option: OptionWithVisibility) => void;\n option: OptionWithVisibility;\n}) {\n const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({\n id: option.id,\n });\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n const combinedListeners = {\n ...listeners,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (onKeyDown) {\n onKeyDown(event);\n }\n if (listeners?.onKeyDown) {\n listeners.onKeyDown(event);\n }\n },\n };\n\n return (\n <li className={clsx(getClassName(), isDragging && styles.placeholder, isSorting && styles.sorting)} style={style}>\n <ContentDisplayOption\n ref={setNodeRef}\n listeners={combinedListeners}\n dragHandleAriaLabel={dragHandleAriaLabel}\n onToggle={onToggle}\n option={option}\n disabled={attributes['aria-disabled']}\n />\n </li>\n );\n}\n"]}
|
|
@@ -4,6 +4,6 @@ interface ContentDisplayPreferenceProps extends CollectionPreferencesProps.Conte
|
|
|
4
4
|
onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;
|
|
5
5
|
value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;
|
|
6
6
|
}
|
|
7
|
-
export default function ContentDisplayPreference({ title, description, options, value, onChange, liveAnnouncementDndStarted, liveAnnouncementDndItemReordered, liveAnnouncementDndItemCommitted, liveAnnouncementDndDiscarded, dragHandleAriaDescription, dragHandleAriaLabel, }: ContentDisplayPreferenceProps): JSX.Element;
|
|
7
|
+
export default function ContentDisplayPreference({ title, description, options, value, onChange, liveAnnouncementDndStarted, liveAnnouncementDndItemReordered, liveAnnouncementDndItemCommitted, liveAnnouncementDndDiscarded, dragHandleAriaDescription, dragHandleAriaLabel, enableColumnFiltering, i18nStrings, }: ContentDisplayPreferenceProps): JSX.Element;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAa3D,UAAU,6BAA8B,SAAQ,0BAA0B,CAAC,wBAAwB;IACjG,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IACxF,KAAK,CAAC,EAAE,aAAa,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;CACtE;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAGG,EACH,QAAQ,EACR,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACnB,qBAA6B,EAC7B,WAAW,GACZ,EAAE,6BAA6B,eA0L/B"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo, useState } from 'react';
|
|
4
4
|
import { DndContext, DragOverlay } from '@dnd-kit/core';
|
|
5
5
|
import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
6
|
+
import InternalBox from '../../box/internal';
|
|
7
|
+
import InternalButton from '../../button/internal';
|
|
6
8
|
import { useInternalI18n } from '../../i18n/context';
|
|
7
9
|
import Portal from '../../internal/components/portal';
|
|
8
10
|
import { useUniqueId } from '../../internal/hooks/use-unique-id';
|
|
11
|
+
import InternalSpaceBetween from '../../space-between/internal';
|
|
12
|
+
import InternalTextFilter from '../../text-filter/internal';
|
|
13
|
+
import { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';
|
|
9
14
|
import ContentDisplayOption from './content-display-option';
|
|
10
15
|
import DraggableOption from './draggable-option';
|
|
11
16
|
import useDragAndDropReorder from './use-drag-and-drop-reorder';
|
|
@@ -17,19 +22,20 @@ const getClassName = (suffix) => styles[`${componentPrefix}-${suffix}`];
|
|
|
17
22
|
export default function ContentDisplayPreference({ title, description, options, value = options.map(({ id }) => ({
|
|
18
23
|
id,
|
|
19
24
|
visible: true,
|
|
20
|
-
})), onChange, liveAnnouncementDndStarted, liveAnnouncementDndItemReordered, liveAnnouncementDndItemCommitted, liveAnnouncementDndDiscarded, dragHandleAriaDescription, dragHandleAriaLabel, }) {
|
|
25
|
+
})), onChange, liveAnnouncementDndStarted, liveAnnouncementDndItemReordered, liveAnnouncementDndItemCommitted, liveAnnouncementDndDiscarded, dragHandleAriaDescription, dragHandleAriaLabel, enableColumnFiltering = false, i18nStrings, }) {
|
|
21
26
|
const idPrefix = useUniqueId(componentPrefix);
|
|
22
27
|
const i18n = useInternalI18n('collection-preferences');
|
|
28
|
+
const [columnFilteringText, setColumnFilteringText] = useState('');
|
|
23
29
|
const onToggle = (option) => {
|
|
24
30
|
onChange(value.map(item => (item.id === option.id ? Object.assign(Object.assign({}, item), { visible: !option.visible }) : item)));
|
|
25
31
|
};
|
|
26
32
|
const titleId = `${idPrefix}-title`;
|
|
27
33
|
const descriptionId = `${idPrefix}-description`;
|
|
28
|
-
const
|
|
34
|
+
const sortedAndFilteredOptions = useMemo(() => getSortedOptions({ options, contentDisplay: value }).filter(option => option.label.toLowerCase().trim().includes(columnFilteringText.toLowerCase().trim())), [columnFilteringText, options, value]);
|
|
29
35
|
const { activeItem, collisionDetection, handleKeyDown, sensors, setActiveItem } = useDragAndDropReorder({
|
|
30
|
-
sortedOptions,
|
|
36
|
+
sortedOptions: sortedAndFilteredOptions,
|
|
31
37
|
});
|
|
32
|
-
const activeOption = activeItem ?
|
|
38
|
+
const activeOption = activeItem ? sortedAndFilteredOptions.find(({ id }) => id === activeItem) : null;
|
|
33
39
|
const announcements = useLiveAnnouncements({
|
|
34
40
|
isDragging: activeItem !== null,
|
|
35
41
|
liveAnnouncementDndStarted: i18n('contentDisplayPreference.liveAnnouncementDndStarted', liveAnnouncementDndStarted, format => (position, total) => format({ position, total })),
|
|
@@ -39,9 +45,17 @@ export default function ContentDisplayPreference({ title, description, options,
|
|
|
39
45
|
sortedOptions: value,
|
|
40
46
|
});
|
|
41
47
|
const renderedDragHandleAriaDescription = i18n('contentDisplayPreference.dragHandleAriaDescription', dragHandleAriaDescription);
|
|
42
|
-
return (React.createElement("div", { className: styles[componentPrefix] },
|
|
48
|
+
return (React.createElement("div", Object.assign({ className: styles[componentPrefix] }, getAnalyticsInnerContextAttribute('contentDisplay')),
|
|
43
49
|
React.createElement("h3", { className: getClassName('title'), id: titleId }, i18n('contentDisplayPreference.title', title)),
|
|
44
50
|
React.createElement("p", { className: getClassName('description'), id: descriptionId }, i18n('contentDisplayPreference.description', description)),
|
|
51
|
+
enableColumnFiltering && (React.createElement("div", { className: getClassName('text-filter') },
|
|
52
|
+
React.createElement(InternalTextFilter, { filteringText: columnFilteringText, filteringPlaceholder: i18n('contentDisplayPreference.i18nStrings.columnFilteringPlaceholder', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringPlaceholder), filteringAriaLabel: i18n('contentDisplayPreference.i18nStrings.columnFilteringAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringAriaLabel), filteringClearAriaLabel: i18n('contentDisplayPreference.i18nStrings.columnFilteringClearFilterText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringClearFilterText), onChange: ({ detail }) => setColumnFilteringText(detail.filteringText), countText: i18n('contentDisplayPreference.i18nStrings.columnFilteringCountText', (i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringCountText)
|
|
53
|
+
? i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringCountText(sortedAndFilteredOptions.length)
|
|
54
|
+
: undefined, format => format({ count: sortedAndFilteredOptions.length })) }))),
|
|
55
|
+
sortedAndFilteredOptions.length === 0 && (React.createElement("div", { className: getClassName('no-match') },
|
|
56
|
+
React.createElement(InternalSpaceBetween, { size: "s", alignItems: "center" },
|
|
57
|
+
React.createElement(InternalBox, { margin: { top: 'm' } }, i18n('contentDisplayPreference.i18nStrings.columnFilteringNoMatchText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringNoMatchText)),
|
|
58
|
+
React.createElement(InternalButton, { onClick: () => setColumnFilteringText('') }, i18n('contentDisplayPreference.i18nStrings.columnFilteringClearFilterText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringClearFilterText))))),
|
|
45
59
|
React.createElement(DndContext, { sensors: sensors, collisionDetection: collisionDetection, accessibility: {
|
|
46
60
|
announcements,
|
|
47
61
|
restoreFocus: false,
|
|
@@ -58,7 +72,7 @@ export default function ContentDisplayPreference({ title, description, options,
|
|
|
58
72
|
}
|
|
59
73
|
}, onDragCancel: () => setActiveItem(null) },
|
|
60
74
|
React.createElement("ul", { className: getClassName('option-list'), "aria-describedby": descriptionId, "aria-labelledby": titleId, role: "list" },
|
|
61
|
-
React.createElement(SortableContext, { items:
|
|
75
|
+
React.createElement(SortableContext, { disabled: columnFilteringText.trim().length > 0, items: sortedAndFilteredOptions.map(({ id }) => id), strategy: verticalListSortingStrategy }, sortedAndFilteredOptions.map(option => {
|
|
62
76
|
return (React.createElement(DraggableOption, { dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel), key: option.id, onKeyDown: handleKeyDown, onToggle: onToggle, option: option }));
|
|
63
77
|
}))),
|
|
64
78
|
React.createElement(Portal, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,eAAe,MAAM,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,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;iBACrD;YACH,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;YAIvC,4BACE,SAAS,EAAE,YAAY,CAAC,aAAa,CAAC,sBACpB,aAAa,qBACd,OAAO,EACxB,IAAI,EAAC,MAAM;gBAEX,oBAAC,eAAe,IAAC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,2BAA2B,IAC7F,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oBAC1B,OAAO,CACL,oBAAC,eAAe,IACd,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;gBACJ,CAAC,CAAC,CACc,CACf;YACL,oBAAC,MAAM;gBAOL,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IACzF,YAAY,IAAI,CACf,oBAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,EACvC,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,GACpB,CACH,CACW,CACP,CACE,CACT,CACP,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 { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\n\nimport { useInternalI18n } from '../../i18n/context';\nimport Portal from '../../internal/components/portal';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { CollectionPreferencesProps } from '../interfaces';\nimport ContentDisplayOption from './content-display-option';\nimport DraggableOption from './draggable-option';\nimport useDragAndDropReorder from './use-drag-and-drop-reorder';\nimport useLiveAnnouncements from './use-live-announcements';\nimport { getSortedOptions, OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n onChange,\n liveAnnouncementDndStarted,\n liveAnnouncementDndItemReordered,\n liveAnnouncementDndItemCommitted,\n liveAnnouncementDndDiscarded,\n dragHandleAriaDescription,\n dragHandleAriaLabel,\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n\n const onToggle = (option: OptionWithVisibility) => {\n onChange(value.map(item => (item.id === option.id ? { ...item, visible: !option.visible } : item)));\n };\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const sortedOptions = getSortedOptions({ options, contentDisplay: value });\n\n const { activeItem, collisionDetection, handleKeyDown, sensors, setActiveItem } = useDragAndDropReorder({\n sortedOptions,\n });\n\n const activeOption = activeItem ? sortedOptions.find(({ id }) => id === activeItem) : null;\n\n const announcements = useLiveAnnouncements({\n isDragging: activeItem !== null,\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n format => (position, total) => format({ position, total })\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n format => (initialPosition, currentPosition, total) =>\n format({ currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n format => (initialPosition, finalPosition, total) =>\n format({ initialPosition, finalPosition, total, isInitialPosition: `${initialPosition === finalPosition}` })\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n sortedOptions: value,\n });\n\n const renderedDragHandleAriaDescription = i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n );\n\n return (\n <div className={styles[componentPrefix]}>\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n <DndContext\n sensors={sensors}\n collisionDetection={collisionDetection}\n accessibility={{\n announcements,\n restoreFocus: false,\n screenReaderInstructions: renderedDragHandleAriaDescription\n ? { draggable: renderedDragHandleAriaDescription }\n : undefined,\n }}\n onDragStart={({ active }) => setActiveItem(active.id)}\n onDragEnd={event => {\n setActiveItem(null);\n const { active, over } = event;\n\n if (over && active.id !== over.id) {\n const oldIndex = value.findIndex(({ id }) => id === active.id);\n const newIndex = value.findIndex(({ id }) => id === over.id);\n onChange(arrayMove([...value], oldIndex, newIndex));\n }\n }}\n onDragCancel={() => setActiveItem(null)}\n >\n {/* Use explicit list role to work around Safari not announcing lists as such when list-style is set to none.\n See https://bugs.webkit.org/show_bug.cgi?id=170179 */}\n <ul\n className={getClassName('option-list')}\n aria-describedby={descriptionId}\n aria-labelledby={titleId}\n role=\"list\"\n >\n <SortableContext items={sortedOptions.map(({ id }) => id)} strategy={verticalListSortingStrategy}>\n {sortedOptions.map(option => {\n return (\n <DraggableOption\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n key={option.id}\n onKeyDown={handleKeyDown}\n onToggle={onToggle}\n option={option}\n />\n );\n })}\n </SortableContext>\n </ul>\n <Portal>\n {/* Make sure that the drag overlay is above the modal\n by assigning the z-index as inline style\n so that it prevails over dnd-kit's inline z-index of 999 */}\n {/* className is a documented prop of the DragOverlay component:\n https://docs.dndkit.com/api-documentation/draggable/drag-overlay#class-name-and-inline-styles */\n /* eslint-disable-next-line react/forbid-component-props */}\n <DragOverlay className={styles['drag-overlay']} dropAnimation={null} style={{ zIndex: 5000 }}>\n {activeOption && (\n <ContentDisplayOption\n listeners={{ onKeyDown: handleKeyDown }}\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n onToggle={onToggle}\n option={activeOption}\n />\n )}\n </DragOverlay>\n </Portal>\n </DndContext>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;A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AC,eAAe,IACd,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;gBACJ,CAAC,CAAC,CACc,CACf;YACL,oBAAC,MAAM;gBAOL,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IACzF,YAAY,IAAI,CACf,oBAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,EACvC,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,GACpB,CACH,CACW,CACP,CACE,CACT,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo, useState } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\n\nimport InternalBox from '../../box/internal';\nimport InternalButton from '../../button/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport Portal from '../../internal/components/portal';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalTextFilter from '../../text-filter/internal';\nimport { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';\nimport { CollectionPreferencesProps } from '../interfaces';\nimport ContentDisplayOption from './content-display-option';\nimport DraggableOption from './draggable-option';\nimport useDragAndDropReorder from './use-drag-and-drop-reorder';\nimport useLiveAnnouncements from './use-live-announcements';\nimport { getSortedOptions, OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n onChange,\n liveAnnouncementDndStarted,\n liveAnnouncementDndItemReordered,\n liveAnnouncementDndItemCommitted,\n liveAnnouncementDndDiscarded,\n dragHandleAriaDescription,\n dragHandleAriaLabel,\n enableColumnFiltering = false,\n i18nStrings,\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n const [columnFilteringText, setColumnFilteringText] = useState('');\n\n const onToggle = (option: OptionWithVisibility) => {\n onChange(value.map(item => (item.id === option.id ? { ...item, visible: !option.visible } : item)));\n };\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const sortedAndFilteredOptions = useMemo(\n () =>\n getSortedOptions({ options, contentDisplay: value }).filter(option =>\n option.label.toLowerCase().trim().includes(columnFilteringText.toLowerCase().trim())\n ),\n [columnFilteringText, options, value]\n );\n\n const { activeItem, collisionDetection, handleKeyDown, sensors, setActiveItem } = useDragAndDropReorder({\n sortedOptions: sortedAndFilteredOptions,\n });\n\n const activeOption = activeItem ? sortedAndFilteredOptions.find(({ id }) => id === activeItem) : null;\n\n const announcements = useLiveAnnouncements({\n isDragging: activeItem !== null,\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n format => (position, total) => format({ position, total })\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n format => (initialPosition, currentPosition, total) =>\n format({ currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n format => (initialPosition, finalPosition, total) =>\n format({ initialPosition, finalPosition, total, isInitialPosition: `${initialPosition === finalPosition}` })\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n sortedOptions: value,\n });\n\n const renderedDragHandleAriaDescription = i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n );\n\n return (\n <div className={styles[componentPrefix]} {...getAnalyticsInnerContextAttribute('contentDisplay')}>\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n\n {/* Filter input */}\n {enableColumnFiltering && (\n <div className={getClassName('text-filter')}>\n <InternalTextFilter\n filteringText={columnFilteringText}\n filteringPlaceholder={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringPlaceholder',\n i18nStrings?.columnFilteringPlaceholder\n )}\n filteringAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringAriaLabel',\n i18nStrings?.columnFilteringAriaLabel\n )}\n filteringClearAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n onChange={({ detail }) => setColumnFilteringText(detail.filteringText)}\n countText={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringCountText',\n i18nStrings?.columnFilteringCountText\n ? i18nStrings?.columnFilteringCountText(sortedAndFilteredOptions.length)\n : undefined,\n format => format({ count: sortedAndFilteredOptions.length })\n )}\n />\n </div>\n )}\n\n {/* No match */}\n {sortedAndFilteredOptions.length === 0 && (\n <div className={getClassName('no-match')}>\n <InternalSpaceBetween size=\"s\" alignItems=\"center\">\n <InternalBox margin={{ top: 'm' }}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringNoMatchText',\n i18nStrings?.columnFilteringNoMatchText\n )}\n </InternalBox>\n <InternalButton onClick={() => setColumnFilteringText('')}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n\n {/* Drag and drop */}\n <DndContext\n sensors={sensors}\n collisionDetection={collisionDetection}\n accessibility={{\n announcements,\n restoreFocus: false,\n screenReaderInstructions: renderedDragHandleAriaDescription\n ? { draggable: renderedDragHandleAriaDescription }\n : undefined,\n }}\n onDragStart={({ active }) => setActiveItem(active.id)}\n onDragEnd={event => {\n setActiveItem(null);\n const { active, over } = event;\n\n if (over && active.id !== over.id) {\n const oldIndex = value.findIndex(({ id }) => id === active.id);\n const newIndex = value.findIndex(({ id }) => id === over.id);\n onChange(arrayMove([...value], oldIndex, newIndex));\n }\n }}\n onDragCancel={() => setActiveItem(null)}\n >\n {/* Use explicit list role to work around Safari not announcing lists as such when list-style is set to none.\n See https://bugs.webkit.org/show_bug.cgi?id=170179 */}\n <ul\n className={getClassName('option-list')}\n aria-describedby={descriptionId}\n aria-labelledby={titleId}\n role=\"list\"\n >\n <SortableContext\n disabled={columnFilteringText.trim().length > 0}\n items={sortedAndFilteredOptions.map(({ id }) => id)}\n strategy={verticalListSortingStrategy}\n >\n {sortedAndFilteredOptions.map(option => {\n return (\n <DraggableOption\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n key={option.id}\n onKeyDown={handleKeyDown}\n onToggle={onToggle}\n option={option}\n />\n );\n })}\n </SortableContext>\n </ul>\n <Portal>\n {/* Make sure that the drag overlay is above the modal\n by assigning the z-index as inline style\n so that it prevails over dnd-kit's inline z-index of 999 */}\n {/* className is a documented prop of the DragOverlay component:\n https://docs.dndkit.com/api-documentation/draggable/drag-overlay#class-name-and-inline-styles */\n /* eslint-disable-next-line react/forbid-component-props */}\n <DragOverlay className={styles['drag-overlay']} dropAnimation={null} style={{ zIndex: 5000 }}>\n {activeOption && (\n <ContentDisplayOption\n listeners={{ onKeyDown: handleKeyDown }}\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n onToggle={onToggle}\n option={activeOption}\n />\n )}\n </DragOverlay>\n </Portal>\n </DndContext>\n </div>\n );\n}\n"]}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"content-display-option-toggle": "awsui_content-display-option-
|
|
5
|
-
"content-display-option-content": "awsui_content-display-option-
|
|
6
|
-
"content-display-option": "awsui_content-display-
|
|
7
|
-
"placeholder": "
|
|
8
|
-
"sorting": "
|
|
9
|
-
"content-display-option-label": "awsui_content-display-option-
|
|
10
|
-
"drag-overlay": "awsui_drag-
|
|
11
|
-
"content-display": "awsui_content-
|
|
12
|
-
"content-display-
|
|
13
|
-
"content-display-
|
|
14
|
-
"content-display-
|
|
4
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_joe0p_281",
|
|
5
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_joe0p_285",
|
|
6
|
+
"content-display-option": "awsui_content-display-option_1f3h0_joe0p_281",
|
|
7
|
+
"placeholder": "awsui_placeholder_1f3h0_joe0p_335",
|
|
8
|
+
"sorting": "awsui_sorting_1f3h0_joe0p_335",
|
|
9
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_joe0p_362",
|
|
10
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_joe0p_369",
|
|
11
|
+
"content-display": "awsui_content-display_1f3h0_joe0p_281",
|
|
12
|
+
"content-display-text-filter": "awsui_content-display-text-filter_1f3h0_joe0p_399",
|
|
13
|
+
"content-display-no-match": "awsui_content-display-no-match_1f3h0_joe0p_400",
|
|
14
|
+
"content-display-title": "awsui_content-display-title_1f3h0_joe0p_404",
|
|
15
|
+
"content-display-description": "awsui_content-display-description_1f3h0_joe0p_413",
|
|
16
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_joe0p_421"
|
|
15
17
|
};
|
|
16
18
|
|
|
@@ -278,11 +278,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
278
278
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
279
279
|
SPDX-License-Identifier: Apache-2.0
|
|
280
280
|
*/
|
|
281
|
-
.awsui_content-display-option-
|
|
281
|
+
.awsui_content-display-option-toggle_1f3h0_joe0p_281:not(#\9) {
|
|
282
282
|
/* used in test-utils */
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
.awsui_content-display-option-
|
|
285
|
+
.awsui_content-display-option-content_1f3h0_joe0p_285:not(#\9) {
|
|
286
286
|
border-collapse: separate;
|
|
287
287
|
border-spacing: 0;
|
|
288
288
|
box-sizing: border-box;
|
|
@@ -328,28 +328,28 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
328
328
|
border-end-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
.awsui_content-display-
|
|
331
|
+
.awsui_content-display-option_1f3h0_joe0p_281:not(#\9) {
|
|
332
332
|
list-style: none;
|
|
333
333
|
position: relative;
|
|
334
334
|
border-block-start: var(--border-divider-list-width-27y3k5, 1px) solid var(--color-border-divider-secondary-alwp8z, #ebebf0);
|
|
335
335
|
}
|
|
336
|
-
.awsui_content-display-
|
|
336
|
+
.awsui_content-display-option_1f3h0_joe0p_281:not(#\9):not(.awsui_placeholder_1f3h0_joe0p_335).awsui_sorting_1f3h0_joe0p_335 {
|
|
337
337
|
transition: transform var(--motion-duration-transition-quick-6npj01, 90ms) var(--motion-easing-transition-quick-l9jfsx, linear);
|
|
338
338
|
}
|
|
339
339
|
@media (prefers-reduced-motion: reduce) {
|
|
340
|
-
.awsui_content-display-
|
|
340
|
+
.awsui_content-display-option_1f3h0_joe0p_281:not(#\9):not(.awsui_placeholder_1f3h0_joe0p_335).awsui_sorting_1f3h0_joe0p_335 {
|
|
341
341
|
animation: none;
|
|
342
342
|
transition: none;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
.awsui-motion-disabled .awsui_content-display-
|
|
345
|
+
.awsui-motion-disabled .awsui_content-display-option_1f3h0_joe0p_281:not(#\9):not(.awsui_placeholder_1f3h0_joe0p_335).awsui_sorting_1f3h0_joe0p_335, .awsui-mode-entering .awsui_content-display-option_1f3h0_joe0p_281:not(#\9):not(.awsui_placeholder_1f3h0_joe0p_335).awsui_sorting_1f3h0_joe0p_335 {
|
|
346
346
|
animation: none;
|
|
347
347
|
transition: none;
|
|
348
348
|
}
|
|
349
|
-
.awsui_content-display-
|
|
349
|
+
.awsui_content-display-option_1f3h0_joe0p_281.awsui_placeholder_1f3h0_joe0p_335 > .awsui_content-display-option-content_1f3h0_joe0p_285:not(#\9) {
|
|
350
350
|
position: relative;
|
|
351
351
|
}
|
|
352
|
-
.awsui_content-display-
|
|
352
|
+
.awsui_content-display-option_1f3h0_joe0p_281.awsui_placeholder_1f3h0_joe0p_335 > .awsui_content-display-option-content_1f3h0_joe0p_285:not(#\9):after {
|
|
353
353
|
content: " ";
|
|
354
354
|
position: absolute;
|
|
355
355
|
inset: 0;
|
|
@@ -360,28 +360,28 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
360
360
|
border-end-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
.awsui_content-display-option-
|
|
363
|
+
.awsui_content-display-option-label_1f3h0_joe0p_362:not(#\9) {
|
|
364
364
|
flex-grow: 1;
|
|
365
365
|
min-inline-size: 0;
|
|
366
366
|
word-break: break-word;
|
|
367
367
|
padding-inline-end: var(--space-l-t419sm, 20px);
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
.awsui_drag-
|
|
370
|
+
.awsui_drag-overlay_1f3h0_joe0p_369:not(#\9) {
|
|
371
371
|
box-shadow: var(--shadow-container-active-kl29x9, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
|
|
372
372
|
border-start-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
373
373
|
border-start-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
374
374
|
border-end-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
375
375
|
border-end-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
376
376
|
}
|
|
377
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
377
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_joe0p_369:not(#\9) {
|
|
378
378
|
position: relative;
|
|
379
379
|
}
|
|
380
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
380
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_joe0p_369:not(#\9) {
|
|
381
381
|
outline: 2px dotted transparent;
|
|
382
382
|
outline-offset: calc(0px - 1px);
|
|
383
383
|
}
|
|
384
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
384
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_joe0p_369:not(#\9)::before {
|
|
385
385
|
content: " ";
|
|
386
386
|
display: block;
|
|
387
387
|
position: absolute;
|
|
@@ -396,11 +396,13 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_nc6j8_369:not(#\9)
|
|
|
396
396
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-nv6mhz, #006ce0);
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
.awsui_content-
|
|
399
|
+
.awsui_content-display_1f3h0_joe0p_281:not(#\9),
|
|
400
|
+
.awsui_content-display-text-filter_1f3h0_joe0p_399:not(#\9),
|
|
401
|
+
.awsui_content-display-no-match_1f3h0_joe0p_400:not(#\9) {
|
|
400
402
|
/* used in test-utils */
|
|
401
403
|
}
|
|
402
404
|
|
|
403
|
-
.awsui_content-display-
|
|
405
|
+
.awsui_content-display-title_1f3h0_joe0p_404:not(#\9) {
|
|
404
406
|
font-size: var(--font-size-body-m-x4okxb, 14px);
|
|
405
407
|
line-height: var(--line-height-body-m-30ar75, 20px);
|
|
406
408
|
font-weight: var(--font-display-label-weight-815ja9, 700);
|
|
@@ -409,7 +411,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_nc6j8_369:not(#\9)
|
|
|
409
411
|
margin-inline: 0;
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
.awsui_content-display-
|
|
414
|
+
.awsui_content-display-description_1f3h0_joe0p_413:not(#\9) {
|
|
413
415
|
color: var(--color-text-form-secondary-54emib, #656871);
|
|
414
416
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
415
417
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -417,7 +419,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_nc6j8_369:not(#\9)
|
|
|
417
419
|
margin-block-start: var(--space-scaled-xxxs-27y4hv, 2px);
|
|
418
420
|
}
|
|
419
421
|
|
|
420
|
-
.awsui_content-display-option-
|
|
422
|
+
.awsui_content-display-option-list_1f3h0_joe0p_421:not(#\9) {
|
|
421
423
|
position: relative;
|
|
422
424
|
list-style: none;
|
|
423
425
|
padding-block: 0;
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"content-display-option-toggle": "awsui_content-display-option-
|
|
6
|
-
"content-display-option-content": "awsui_content-display-option-
|
|
7
|
-
"content-display-option": "awsui_content-display-
|
|
8
|
-
"placeholder": "
|
|
9
|
-
"sorting": "
|
|
10
|
-
"content-display-option-label": "awsui_content-display-option-
|
|
11
|
-
"drag-overlay": "awsui_drag-
|
|
12
|
-
"content-display": "awsui_content-
|
|
13
|
-
"content-display-
|
|
14
|
-
"content-display-
|
|
15
|
-
"content-display-
|
|
5
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_joe0p_281",
|
|
6
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_joe0p_285",
|
|
7
|
+
"content-display-option": "awsui_content-display-option_1f3h0_joe0p_281",
|
|
8
|
+
"placeholder": "awsui_placeholder_1f3h0_joe0p_335",
|
|
9
|
+
"sorting": "awsui_sorting_1f3h0_joe0p_335",
|
|
10
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_joe0p_362",
|
|
11
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_joe0p_369",
|
|
12
|
+
"content-display": "awsui_content-display_1f3h0_joe0p_281",
|
|
13
|
+
"content-display-text-filter": "awsui_content-display-text-filter_1f3h0_joe0p_399",
|
|
14
|
+
"content-display-no-match": "awsui_content-display-no-match_1f3h0_joe0p_400",
|
|
15
|
+
"content-display-title": "awsui_content-display-title_1f3h0_joe0p_404",
|
|
16
|
+
"content-display-description": "awsui_content-display-description_1f3h0_joe0p_413",
|
|
17
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_joe0p_421"
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAiB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EAEvB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,0BAA0B,eA+L5B"}
|