@cloudscape-design/components-themeable 3.0.1022 → 3.0.1024
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 +2 -14
- package/lib/internal/scss/flashbar/collapsible.scss +20 -8
- package/lib/internal/scss/internal/components/drag-handle/styles.scss +2 -6
- package/lib/internal/scss/internal/components/sortable-area/styles.scss +1 -0
- package/lib/internal/scss/internal/components/structured-item/styles.scss +46 -0
- package/lib/internal/scss/internal/components/structured-item/test-classes/styles.scss +11 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/list/styles.scss +39 -0
- package/lib/internal/scss/list/test-classes/styles.scss +9 -0
- package/lib/internal/template/collection-preferences/content-display/content-display-option.d.ts +0 -2
- package/lib/internal/template/collection-preferences/content-display/content-display-option.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/content-display-option.js +1 -4
- package/lib/internal/template/collection-preferences/content-display/content-display-option.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/index.js +17 -24
- package/lib/internal/template/collection-preferences/content-display/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts +2 -7
- 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 +36 -38
- package/lib/internal/template/collection-preferences/styles.scoped.css +39 -51
- package/lib/internal/template/collection-preferences/styles.selectors.js +36 -38
- package/lib/internal/template/flashbar/collapsible-flashbar.d.ts +0 -8
- package/lib/internal/template/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/lib/internal/template/flashbar/collapsible-flashbar.js +3 -50
- package/lib/internal/template/flashbar/collapsible-flashbar.js.map +1 -1
- package/lib/internal/template/flashbar/flash.d.ts.map +1 -1
- package/lib/internal/template/flashbar/flash.js +5 -27
- package/lib/internal/template/flashbar/flash.js.map +1 -1
- package/lib/internal/template/flashbar/interfaces.d.ts +51 -9
- package/lib/internal/template/flashbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/flashbar/interfaces.js.map +1 -1
- package/lib/internal/template/flashbar/style.d.ts +36 -0
- package/lib/internal/template/flashbar/style.d.ts.map +1 -0
- package/lib/internal/template/flashbar/style.js +105 -0
- package/lib/internal/template/flashbar/style.js.map +1 -0
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +153 -152
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.ar.js +1 -1
- package/lib/internal/template/i18n/messages/all.ar.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.th.js +1 -1
- package/lib/internal/template/i18n/messages/all.th.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/i18n/messages-types.d.ts +20 -0
- package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages-types.js.map +1 -1
- package/lib/internal/template/index.d.ts +1 -0
- package/lib/internal/template/index.d.ts.map +1 -1
- package/lib/internal/template/index.js +1 -0
- package/lib/internal/template/index.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/drag-handle/button.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/button.js +2 -2
- package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.js +2 -2
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/styles.css.js +13 -12
- package/lib/internal/template/internal/components/drag-handle/styles.scoped.css +18 -21
- package/lib/internal/template/internal/components/drag-handle/styles.selectors.js +13 -12
- package/lib/internal/template/internal/components/sortable-area/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/index.js +5 -1
- package/lib/internal/template/internal/components/sortable-area/index.js.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/components/sortable-area/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/styles.css.js +8 -8
- package/lib/internal/template/internal/components/sortable-area/styles.scoped.css +18 -17
- package/lib/internal/template/internal/components/sortable-area/styles.selectors.js +8 -8
- package/lib/internal/template/internal/components/sortable-area/use-live-announcements.d.ts +5 -0
- package/lib/internal/template/internal/components/sortable-area/use-live-announcements.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/use-live-announcements.js +8 -0
- package/lib/internal/template/internal/components/sortable-area/use-live-announcements.js.map +1 -1
- package/lib/internal/template/internal/components/structured-item/index.d.ts +5 -0
- package/lib/internal/template/internal/components/structured-item/index.d.ts.map +1 -0
- package/lib/internal/template/internal/components/structured-item/index.js +16 -0
- package/lib/internal/template/internal/components/structured-item/index.js.map +1 -0
- package/lib/internal/template/internal/components/structured-item/interfaces.d.ts +9 -0
- package/lib/internal/template/internal/components/structured-item/interfaces.d.ts.map +1 -0
- package/lib/internal/template/internal/components/structured-item/interfaces.js +4 -0
- package/lib/internal/template/internal/components/structured-item/interfaces.js.map +1 -0
- package/lib/internal/template/internal/components/structured-item/styles.css.js +11 -0
- package/lib/internal/template/internal/components/structured-item/styles.scoped.css +212 -0
- package/lib/internal/template/internal/components/structured-item/styles.selectors.js +12 -0
- package/lib/internal/template/internal/components/structured-item/test-classes/styles.css.js +9 -0
- package/lib/internal/template/internal/components/structured-item/test-classes/styles.scoped.css +10 -0
- package/lib/internal/template/internal/components/structured-item/test-classes/styles.selectors.js +10 -0
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/list/index.d.ts +5 -0
- package/lib/internal/template/list/index.d.ts.map +1 -0
- package/lib/internal/template/list/index.js +12 -0
- package/lib/internal/template/list/index.js.map +1 -0
- package/lib/internal/template/list/interfaces.d.ts +83 -0
- package/lib/internal/template/list/interfaces.d.ts.map +1 -0
- package/lib/internal/template/list/interfaces.js +4 -0
- package/lib/internal/template/list/interfaces.js.map +1 -0
- package/lib/internal/template/list/internal.d.ts +7 -0
- package/lib/internal/template/list/internal.d.ts.map +1 -0
- package/lib/internal/template/list/internal.js +62 -0
- package/lib/internal/template/list/internal.js.map +1 -0
- package/lib/internal/template/list/styles.css.js +10 -0
- package/lib/internal/template/list/styles.scoped.css +202 -0
- package/lib/internal/template/list/styles.selectors.js +11 -0
- package/lib/internal/template/list/test-classes/styles.css.js +7 -0
- package/lib/internal/template/list/test-classes/styles.scoped.css +8 -0
- package/lib/internal/template/list/test-classes/styles.selectors.js +8 -0
- package/lib/internal/template/package.json +1 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.js +17 -6
- package/lib/internal/template/test-utils/dom/collection-preferences/content-display-preference.js.map +1 -1
- package/lib/internal/template/test-utils/dom/index.d.ts +20 -0
- package/lib/internal/template/test-utils/dom/index.js +13 -2
- package/lib/internal/template/test-utils/dom/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/structured-item.d.ts +8 -0
- package/lib/internal/template/test-utils/dom/internal/structured-item.js +23 -0
- package/lib/internal/template/test-utils/dom/internal/structured-item.js.map +1 -0
- package/lib/internal/template/test-utils/dom/list/index.d.ts +23 -0
- package/lib/internal/template/test-utils/dom/list/index.js +41 -0
- package/lib/internal/template/test-utils/dom/list/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.js +13 -6
- package/lib/internal/template/test-utils/selectors/collection-preferences/content-display-preference.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/index.d.ts +18 -0
- package/lib/internal/template/test-utils/selectors/index.js +13 -2
- package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/structured-item.d.ts +8 -0
- package/lib/internal/template/test-utils/selectors/internal/structured-item.js +23 -0
- package/lib/internal/template/test-utils/selectors/internal/structured-item.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/list/index.d.ts +23 -0
- package/lib/internal/template/test-utils/selectors/list/index.js +41 -0
- package/lib/internal/template/test-utils/selectors/list/index.js.map +1 -0
- package/package.json +1 -1
package/lib/internal/scss/collection-preferences/content-display/content-display-option.scss
CHANGED
|
@@ -14,28 +14,16 @@
|
|
|
14
14
|
@include styles.styles-reset;
|
|
15
15
|
display: flex;
|
|
16
16
|
align-items: flex-start;
|
|
17
|
-
padding-block: awsui.$space-xs;
|
|
18
|
-
padding-inline-
|
|
19
|
-
padding-inline-end: awsui.$space-scaled-xs;
|
|
20
|
-
background-color: awsui.$color-background-container-content;
|
|
17
|
+
padding-block: awsui.$space-scaled-xs;
|
|
18
|
+
padding-inline-end: awsui.$space-xs;
|
|
21
19
|
border-start-start-radius: awsui.$border-radius-item;
|
|
22
20
|
border-start-end-radius: awsui.$border-radius-item;
|
|
23
21
|
border-end-start-radius: awsui.$border-radius-item;
|
|
24
22
|
border-end-end-radius: awsui.$border-radius-item;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
.content-display-option {
|
|
28
|
-
list-style: none;
|
|
29
|
-
position: relative;
|
|
30
|
-
border-block-start: awsui.$border-divider-list-width solid awsui.$color-border-divider-secondary;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
25
|
.content-display-option-label {
|
|
34
26
|
flex-grow: 1;
|
|
35
27
|
@include styles.text-wrapping;
|
|
36
28
|
padding-inline-end: awsui.$space-l;
|
|
37
29
|
}
|
|
38
|
-
|
|
39
|
-
.drag-handle-wrapper {
|
|
40
|
-
margin-inline: awsui.$space-scaled-xxs;
|
|
41
|
-
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use '../internal/generated/custom-css-properties/index.scss' as custom-props;
|
|
7
7
|
@use '@cloudscape-design/component-toolkit/internal/focus-visible' as focus-visible;
|
|
8
8
|
@use '../internal/styles/tokens' as awsui;
|
|
9
|
+
@use '../internal/styles/foundation' as foundation;
|
|
9
10
|
@use '../internal/styles' as styles;
|
|
10
11
|
@use '../internal/styles/typography' as typography;
|
|
11
12
|
@use './collapsible.motion';
|
|
@@ -84,9 +85,8 @@ the grid layout will be:
|
|
|
84
85
|
This makes them look better during the collapse animation, in which they are already empty.
|
|
85
86
|
*/
|
|
86
87
|
min-block-size: calc(
|
|
87
|
-
#{awsui.$line-height-body-m} +
|
|
88
|
-
|
|
89
|
-
) * 2
|
|
88
|
+
#{awsui.$line-height-body-m} +
|
|
89
|
+
(#{awsui.$space-scaled-xs} + #{awsui.$border-width-field} + #{awsui.$space-scaled-xxs}) * 2
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -112,13 +112,15 @@ the grid layout will be:
|
|
|
112
112
|
/* $notification-bar-line-height + 2 * $notification-bar-padding-vertical + 2 * $border-width
|
|
113
113
|
is the full height of the notification bar */
|
|
114
114
|
#{custom-props.$stackedNotificationsDefaultBottomMargin}: calc(
|
|
115
|
-
#{$notification-bar-line-height} + 2 * #{$notification-bar-padding-vertical} + 2 * #{$border-width} -
|
|
115
|
+
#{$notification-bar-line-height} + 2 * #{$notification-bar-padding-vertical} + 2 * #{$border-width} -
|
|
116
|
+
#{$top-overlap}
|
|
116
117
|
);
|
|
117
118
|
margin-block-end: calc(
|
|
118
119
|
var(
|
|
119
120
|
#{custom-props.$stackedNotificationsBottomMargin},
|
|
120
121
|
var(#{custom-props.$stackedNotificationsDefaultBottomMargin})
|
|
121
|
-
) +
|
|
122
|
+
) +
|
|
123
|
+
#{$buffer-bottom} + #{$offset-bottom}
|
|
122
124
|
);
|
|
123
125
|
|
|
124
126
|
> .notification-bar {
|
|
@@ -126,8 +128,8 @@ the grid layout will be:
|
|
|
126
128
|
/* $notification-bar-line-height + 2 * $notification-bar-padding-vertical + 2 * $border-width
|
|
127
129
|
is the full height of the notification bar */
|
|
128
130
|
margin-block-end: calc(
|
|
129
|
-
#{$top-overlap} - #{$notification-bar-line-height} - 2 * #{$notification-bar-padding-vertical} - 2 *
|
|
130
|
-
#{$offset-bottom}
|
|
131
|
+
#{$top-overlap} - #{$notification-bar-line-height} - 2 * #{$notification-bar-padding-vertical} - 2 *
|
|
132
|
+
#{$border-width} - #{$offset-bottom}
|
|
131
133
|
);
|
|
132
134
|
padding-block: $notification-bar-padding-vertical;
|
|
133
135
|
}
|
|
@@ -300,6 +302,9 @@ the grid layout will be:
|
|
|
300
302
|
border-block: 0;
|
|
301
303
|
border-inline: none;
|
|
302
304
|
padding-block: 0;
|
|
305
|
+
#{custom-props.$styleFocusRingBoxShadow}: 0 0 0
|
|
306
|
+
var(#{custom-props.$styleFocusRingBorderWidth}, foundation.$box-shadow-focused-width)
|
|
307
|
+
var(#{custom-props.$styleFocusRingBorderColor}, awsui.$color-border-item-focused);
|
|
303
308
|
|
|
304
309
|
> .icon {
|
|
305
310
|
@include styles.with-motion {
|
|
@@ -315,7 +320,14 @@ the grid layout will be:
|
|
|
315
320
|
}
|
|
316
321
|
|
|
317
322
|
@include focus-visible.when-visible {
|
|
318
|
-
@include styles.focus-highlight(
|
|
323
|
+
@include styles.focus-highlight(
|
|
324
|
+
$gutter: 0px,
|
|
325
|
+
$border-radius: var(
|
|
326
|
+
#{custom-props.$styleFocusRingBorderRadius},
|
|
327
|
+
awsui.$border-radius-control-default-focus-ring
|
|
328
|
+
),
|
|
329
|
+
$box-shadow: var(#{custom-props.$styleFocusRingBoxShadow})
|
|
330
|
+
);
|
|
319
331
|
}
|
|
320
332
|
}
|
|
321
333
|
}
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
block-size: awsui.$line-height-body-s;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
&-drag-indicator {
|
|
32
|
+
&-drag-indicator:not(&-disabled) {
|
|
33
33
|
cursor: grab;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
&.active {
|
|
36
36
|
cursor: grabbing;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -53,10 +53,6 @@
|
|
|
53
53
|
cursor: ns-resize;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
&-disabled {
|
|
57
|
-
cursor: default;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
56
|
&:hover {
|
|
61
57
|
color: awsui.$color-text-interactive-hover;
|
|
62
58
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
@use '../../styles' as styles;
|
|
6
|
+
@use '../../styles/tokens' as awsui;
|
|
7
|
+
|
|
8
|
+
.root {
|
|
9
|
+
@include styles.styles-reset;
|
|
10
|
+
@include styles.text-wrapping;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex: 1;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
align-items: baseline;
|
|
15
|
+
column-gap: awsui.$space-xs;
|
|
16
|
+
&.disable-paddings {
|
|
17
|
+
column-gap: 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.main {
|
|
22
|
+
flex-grow: 1;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.content-wrap {
|
|
28
|
+
flex-grow: 1;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: baseline;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
column-gap: awsui.$space-xs;
|
|
34
|
+
.disable-paddings > .main > & {
|
|
35
|
+
column-gap: 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.content {
|
|
40
|
+
flex-grow: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.actions {
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
margin-inline-start: auto;
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
@use '../internal/styles' as styles;
|
|
6
|
+
@use '../internal/styles/tokens' as awsui;
|
|
7
|
+
|
|
8
|
+
.root {
|
|
9
|
+
@include styles.styles-reset;
|
|
10
|
+
list-style: none;
|
|
11
|
+
padding-block: 0;
|
|
12
|
+
padding-inline: 0;
|
|
13
|
+
margin-block: 0;
|
|
14
|
+
margin-inline: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.item {
|
|
19
|
+
&:not(:last-child) {
|
|
20
|
+
border-block-end: awsui.$border-divider-list-width solid awsui.$color-border-divider-secondary;
|
|
21
|
+
}
|
|
22
|
+
&:not(.disable-item-paddings) {
|
|
23
|
+
padding-block: awsui.$space-scaled-xs;
|
|
24
|
+
}
|
|
25
|
+
&:first-child.disable-paddings {
|
|
26
|
+
padding-block-start: 0;
|
|
27
|
+
}
|
|
28
|
+
&:last-child.disable-paddings {
|
|
29
|
+
padding-block-end: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sortable-item {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: baseline;
|
|
36
|
+
&:not(.disable-item-paddings) {
|
|
37
|
+
column-gap: awsui.$space-xxs;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/lib/internal/template/collection-preferences/content-display/content-display-option.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DragHandleProps } from '../../internal/components/drag-handle';
|
|
3
2
|
import { OptionWithVisibility } from './utils';
|
|
4
3
|
export declare const getClassName: (suffix?: string) => string;
|
|
5
4
|
interface ContentDisplayOptionProps {
|
|
6
|
-
dragHandleProps: DragHandleProps;
|
|
7
5
|
onToggle?: (option: OptionWithVisibility) => void;
|
|
8
6
|
option: OptionWithVisibility;
|
|
9
7
|
}
|
package/lib/internal/template/collection-preferences/content-display/content-display-option.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAKxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,YAAY,YAAa,MAAM,WAAgE,CAAC;AAE7G,UAAU,yBAAyB;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClD,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,QAAA,MAAM,oBAAoB,kGAoBzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
package/lib/internal/template/collection-preferences/content-display/content-display-option.js
CHANGED
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
|
|
5
|
-
import DragHandle from '../../internal/components/drag-handle';
|
|
6
5
|
import InternalToggle from '../../toggle/internal';
|
|
7
6
|
import styles from '../styles.css.js';
|
|
8
7
|
const componentPrefix = 'content-display-option';
|
|
9
8
|
export const getClassName = (suffix) => styles[[componentPrefix, suffix].filter(Boolean).join('-')];
|
|
10
|
-
const ContentDisplayOption = forwardRef(({
|
|
9
|
+
const ContentDisplayOption = forwardRef(({ onToggle, option }, ref) => {
|
|
11
10
|
const idPrefix = useUniqueId(componentPrefix);
|
|
12
11
|
const controlId = `${idPrefix}-control-${option.id}`;
|
|
13
12
|
return (React.createElement("div", { ref: ref, className: getClassName('content') },
|
|
14
|
-
React.createElement("div", { className: styles['drag-handle-wrapper'] },
|
|
15
|
-
React.createElement(DragHandle, Object.assign({}, dragHandleProps))),
|
|
16
13
|
React.createElement("label", { className: getClassName('label'), htmlFor: controlId }, option.label),
|
|
17
14
|
React.createElement("div", { className: getClassName('toggle') },
|
|
18
15
|
React.createElement(InternalToggle, { checked: !!option.visible, onChange: () => onToggle && onToggle(option), disabled: option.alwaysVisible === true, controlId: controlId }))));
|
package/lib/internal/template/collection-preferences/content-display/content-display-option.js.map
CHANGED
|
@@ -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;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,
|
|
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;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,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;AAO7G,MAAM,oBAAoB,GAAG,UAAU,CACrC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAA6B,EAAE,GAAiC,EAAE,EAAE;IACrF,MAAM,QAAQ,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,GAAG,QAAQ,YAAY,MAAM,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC;QAC/C,+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';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\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\ninterface ContentDisplayOptionProps {\n onToggle?: (option: OptionWithVisibility) => void;\n option: OptionWithVisibility;\n}\n\nconst ContentDisplayOption = forwardRef(\n ({ onToggle, option }: ContentDisplayOptionProps, ref: ForwardedRef<HTMLDivElement>) => {\n const idPrefix = useUniqueId(componentPrefix);\n const controlId = `${idPrefix}-control-${option.id}`;\n return (\n <div ref={ref} className={getClassName('content')}>\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":"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":";AAkBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAU3D,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,eA0H/B"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useMemo, useState } from 'react';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
4
|
import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
|
|
6
5
|
import InternalBox from '../../box/internal';
|
|
7
6
|
import InternalButton from '../../button/internal';
|
|
8
7
|
import { useInternalI18n } from '../../i18n/context';
|
|
9
|
-
import
|
|
8
|
+
import { formatDndItemCommitted, formatDndItemReordered, formatDndStarted, } from '../../internal/components/sortable-area/use-live-announcements';
|
|
9
|
+
import InternalList from '../../list/internal';
|
|
10
10
|
import InternalSpaceBetween from '../../space-between/internal';
|
|
11
11
|
import InternalTextFilter from '../../text-filter/internal';
|
|
12
12
|
import { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';
|
|
13
|
-
import ContentDisplayOption
|
|
13
|
+
import ContentDisplayOption from './content-display-option';
|
|
14
14
|
import { getFilteredOptions, getSortedOptions } from './utils';
|
|
15
15
|
import styles from '../styles.css.js';
|
|
16
16
|
const componentPrefix = 'content-display';
|
|
@@ -45,26 +45,19 @@ export default function ContentDisplayPreference({ title, description, options,
|
|
|
45
45
|
React.createElement(InternalSpaceBetween, { size: "s", alignItems: "center" },
|
|
46
46
|
React.createElement(InternalBox, { margin: { top: 'm' } }, i18n('contentDisplayPreference.i18nStrings.columnFilteringNoMatchText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringNoMatchText)),
|
|
47
47
|
React.createElement(InternalButton, { onClick: () => setColumnFilteringText('') }, i18n('contentDisplayPreference.i18nStrings.columnFilteringClearFilterText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnFilteringClearFilterText))))),
|
|
48
|
-
React.createElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
total,
|
|
63
|
-
isInitialPosition: `${initialPosition === finalPosition}`,
|
|
64
|
-
})),
|
|
65
|
-
liveAnnouncementDndDiscarded: i18n('contentDisplayPreference.liveAnnouncementDndDiscarded', liveAnnouncementDndDiscarded),
|
|
66
|
-
dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel),
|
|
67
|
-
dragHandleAriaDescription: i18n('contentDisplayPreference.dragHandleAriaDescription', dragHandleAriaDescription),
|
|
68
|
-
} }))));
|
|
48
|
+
React.createElement(InternalList, { items: sortedAndFilteredOptions, renderItem: item => ({
|
|
49
|
+
id: item.id,
|
|
50
|
+
content: React.createElement(ContentDisplayOption, { option: item, onToggle: onToggle }),
|
|
51
|
+
announcementLabel: item.label,
|
|
52
|
+
}), disableItemPaddings: true, sortable: true, sortDisabled: columnFilteringText.trim().length > 0, onSortingChange: ({ detail: { items } }) => {
|
|
53
|
+
onChange(items);
|
|
54
|
+
}, ariaDescribedby: descriptionId, ariaLabelledby: titleId, i18nStrings: {
|
|
55
|
+
liveAnnouncementDndStarted: i18n('contentDisplayPreference.liveAnnouncementDndStarted', liveAnnouncementDndStarted, formatDndStarted),
|
|
56
|
+
liveAnnouncementDndItemReordered: i18n('contentDisplayPreference.liveAnnouncementDndItemReordered', liveAnnouncementDndItemReordered, formatDndItemReordered),
|
|
57
|
+
liveAnnouncementDndItemCommitted: i18n('contentDisplayPreference.liveAnnouncementDndItemCommitted', liveAnnouncementDndItemCommitted, formatDndItemCommitted),
|
|
58
|
+
liveAnnouncementDndDiscarded: i18n('contentDisplayPreference.liveAnnouncementDndDiscarded', liveAnnouncementDndDiscarded),
|
|
59
|
+
dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel),
|
|
60
|
+
dragHandleAriaDescription: i18n('contentDisplayPreference.dragHandleAriaDescription', dragHandleAriaDescription),
|
|
61
|
+
} })));
|
|
69
62
|
}
|
|
70
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sour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ACJ,CAAC,EACD,WAAW,EAAE;oBACX,0BAA0B,EAAE,IAAI,CAC9B,qDAAqD,EACrD,0BAA0B,EAC1B,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAC3D;oBACD,gCAAgC,EAAE,IAAI,CACpC,2DAA2D,EAC3D,gCAAgC,EAChC,MAAM,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,CACpD,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,eAAe,KAAK,eAAe,EAAE,EAAE,CAAC,CAClG;oBACD,gCAAgC,EAAE,IAAI,CACpC,2DAA2D,EAC3D,gCAAgC,EAChC,MAAM,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CAClD,MAAM,CAAC;wBACL,eAAe;wBACf,aAAa;wBACb,KAAK;wBACL,iBAAiB,EAAE,GAAG,eAAe,KAAK,aAAa,EAAE;qBAC1D,CAAC,CACL;oBACD,4BAA4B,EAAE,IAAI,CAChC,uDAAuD,EACvD,4BAA4B,CAC7B;oBACD,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC;oBAC9F,yBAAyB,EAAE,IAAI,CAC7B,oDAAoD,EACpD,yBAAyB,CAC1B;iBACF,GACD,CACC,CACD,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 clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport InternalButton from '../../button/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport SortableArea from '../../internal/components/sortable-area';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalTextFilter from '../../text-filter/internal';\nimport { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';\nimport { CollectionPreferencesProps } from '../interfaces';\nimport ContentDisplayOption, { getClassName as getOptionClassName } from './content-display-option';\nimport { getFilteredOptions, 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 titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const [sortedOptions, sortedAndFilteredOptions] = useMemo(() => {\n const sorted = getSortedOptions({ options, contentDisplay: value });\n const filtered = getFilteredOptions(sorted, columnFilteringText);\n return [sorted, filtered];\n }, [columnFilteringText, options, value]);\n\n const onToggle = (option: OptionWithVisibility) => {\n // We use sortedOptions as base and not value because there might be options that\n // are not in the value yet, so they're added as non-visible after the known ones.\n onChange(sortedOptions.map(({ id, visible }) => ({ id, visible: id === option.id ? !option.visible : visible })));\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 {/* 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 <SortableArea\n items={sortedAndFilteredOptions}\n itemDefinition={{ id: item => item.id, label: item => item.label }}\n onItemsChange={({ detail }) => onChange(detail.items)}\n disableReorder={columnFilteringText.trim().length > 0}\n renderItem={({ ref, item, style, className, dragHandleProps, isDragGhost }) => {\n className = clsx(className, getOptionClassName());\n const content = (\n <ContentDisplayOption ref={ref} option={item} onToggle={onToggle} dragHandleProps={dragHandleProps} />\n );\n if (isDragGhost) {\n return content;\n }\n return (\n <li className={className} style={style}>\n {content}\n </li>\n );\n }}\n i18nStrings={{\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({\n initialPosition,\n finalPosition,\n total,\n isInitialPosition: `${initialPosition === finalPosition}`,\n })\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel),\n dragHandleAriaDescription: i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n ),\n }}\n />\n </ul>\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;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,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WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,8BAA8B,CAC5C,CACc,CACI,CACnB,CACP;QAED,oBAAC,YAAY,IACX,KAAK,EAAE,wBAAwB,EAC/B,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,OAAO,EAAE,oBAAC,oBAAoB,IAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAI;gBACnE,iBAAiB,EAAE,IAAI,CAAC,KAAK;aAC9B,CAAC,EACF,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,IAAI,EACd,YAAY,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EACnD,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;gBACzC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,EACD,eAAe,EAAE,aAAa,EAC9B,cAAc,EAAE,OAAO,EACvB,WAAW,EAAE;gBACX,0BAA0B,EAAE,IAAI,CAC9B,qDAAqD,EACrD,0BAA0B,EAC1B,gBAAgB,CACjB;gBACD,gCAAgC,EAAE,IAAI,CACpC,2DAA2D,EAC3D,gCAAgC,EAChC,sBAAsB,CACvB;gBACD,gCAAgC,EAAE,IAAI,CACpC,2DAA2D,EAC3D,gCAAgC,EAChC,sBAAsB,CACvB;gBACD,4BAA4B,EAAE,IAAI,CAChC,uDAAuD,EACvD,4BAA4B,CAC7B;gBACD,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC;gBAC9F,yBAAyB,EAAE,IAAI,CAC7B,oDAAoD,EACpD,yBAAyB,CAC1B;aACF,GACD,CACE,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';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport InternalButton from '../../button/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport {\n formatDndItemCommitted,\n formatDndItemReordered,\n formatDndStarted,\n} from '../../internal/components/sortable-area/use-live-announcements';\nimport InternalList from '../../list/internal';\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 { getFilteredOptions, 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 titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const [sortedOptions, sortedAndFilteredOptions] = useMemo(() => {\n const sorted = getSortedOptions({ options, contentDisplay: value });\n const filtered = getFilteredOptions(sorted, columnFilteringText);\n return [sorted, filtered];\n }, [columnFilteringText, options, value]);\n\n const onToggle = (option: OptionWithVisibility) => {\n // We use sortedOptions as base and not value because there might be options that\n // are not in the value yet, so they're added as non-visible after the known ones.\n onChange(sortedOptions.map(({ id, visible }) => ({ id, visible: id === option.id ? !option.visible : visible })));\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 <InternalList\n items={sortedAndFilteredOptions}\n renderItem={item => ({\n id: item.id,\n content: <ContentDisplayOption option={item} onToggle={onToggle} />,\n announcementLabel: item.label,\n })}\n disableItemPaddings={true}\n sortable={true}\n sortDisabled={columnFilteringText.trim().length > 0}\n onSortingChange={({ detail: { items } }) => {\n onChange(items);\n }}\n ariaDescribedby={descriptionId}\n ariaLabelledby={titleId}\n i18nStrings={{\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n formatDndStarted\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n formatDndItemReordered\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n formatDndItemCommitted\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel),\n dragHandleAriaDescription: i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n ),\n }}\n />\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
import { SortableAreaProps } from '../internal/components/sortable-area';
|
|
3
4
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
5
|
import { BaseModalProps } from '../modal/interfaces';
|
|
5
6
|
export interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {
|
|
@@ -217,16 +218,10 @@ export declare namespace CollectionPreferencesProps {
|
|
|
217
218
|
contentDisplay?: ReadonlyArray<ContentDisplayItem>;
|
|
218
219
|
custom?: CustomPreferenceType;
|
|
219
220
|
}
|
|
220
|
-
export interface ContentDisplayPreference {
|
|
221
|
+
export interface ContentDisplayPreference extends SortableAreaProps.DndAreaI18nStrings {
|
|
221
222
|
title?: string;
|
|
222
223
|
description?: string;
|
|
223
224
|
options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;
|
|
224
|
-
liveAnnouncementDndStarted?: (position: number, total: number) => string;
|
|
225
|
-
liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;
|
|
226
|
-
liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;
|
|
227
|
-
liveAnnouncementDndDiscarded?: string;
|
|
228
|
-
dragHandleAriaLabel?: string;
|
|
229
|
-
dragHandleAriaDescription?: string;
|
|
230
225
|
enableColumnFiltering?: boolean;
|
|
231
226
|
i18nStrings?: ContentDisplayPreferenceI18nStrings;
|
|
232
227
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,0BAA0B,CAAC,oBAAoB,GAAG,GAAG,CAAE,SAAQ,kBAAkB,EAAE,cAAc;IAChH;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,0BAA0B,CAAC,kBAAkB,CAAC;IACnE;;;;;;;;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AC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAED,UAAU,aAAa;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAU,sBAAsB;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,aAAa,CAAC;YACrB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ;IACD,MAAM,WAAW,uBAAuB;QACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC;QACtC,WAAW,CAAC,EAAE,sBAAsB,CAAC;KACtC;IAED,MAAM,WAAW,mCAAmC;QAClD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAElC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAErD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACzC;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Adds an aria-label to the close button, for accessibility.\n * @i18n\n */\n closeAriaLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference that can be set for both left and right columns.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of the table columns.\n *\n * Recommended for table and not applicable for cards.\n *\n * Cannot be used together with `visibleContentPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n * - `enableColumnFiltering` (boolean) - Adds a columns filter.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in visible sections preference for cards or visible columns for table.\n *\n * Recommended for cards. For table use `contentDisplayPreference` instead.\n *\n * Cannot be used together with `contentDisplayPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an array of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n /**\n * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { SortableAreaProps } from '../internal/components/sortable-area';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Adds an aria-label to the close button, for accessibility.\n * @i18n\n */\n closeAriaLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference that can be set for both left and right columns.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of the table columns.\n *\n * Recommended for table and not applicable for cards.\n *\n * Cannot be used together with `visibleContentPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n * - `enableColumnFiltering` (boolean) - Adds a columns filter.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in visible sections preference for cards or visible columns for table.\n *\n * Recommended for cards. For table use `contentDisplayPreference` instead.\n *\n * Cannot be used together with `contentDisplayPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an array of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n /**\n * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference extends SortableAreaProps.DndAreaI18nStrings {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
|