@cloudscape-design/components-themeable 3.0.285 → 3.0.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/collection-preferences/content-display/content-display-option.scss +0 -1
- package/lib/internal/scss/collection-preferences/styles.scss +6 -1
- package/lib/internal/scss/table/body-cell/styles.scss +52 -0
- package/lib/internal/scss/table/header-cell/styles.scss +28 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts +5 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts.map +1 -1
- package/lib/internal/template/checkbox/base-checkbox.js.map +1 -1
- package/lib/internal/template/checkbox/internal.d.ts.map +1 -1
- package/lib/internal/template/checkbox/internal.js +2 -2
- package/lib/internal/template/checkbox/internal.js.map +1 -1
- package/lib/internal/template/collection-preferences/content-display/styles.css.js +11 -11
- package/lib/internal/template/collection-preferences/content-display/styles.scoped.css +17 -18
- package/lib/internal/template/collection-preferences/content-display/styles.selectors.js +11 -11
- package/lib/internal/template/collection-preferences/index.d.ts +1 -1
- package/lib/internal/template/collection-preferences/index.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/index.js +6 -4
- package/lib/internal/template/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.d.ts +42 -12
- package/lib/internal/template/collection-preferences/interfaces.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/interfaces.js.map +1 -1
- package/lib/internal/template/collection-preferences/styles.css.js +37 -32
- package/lib/internal/template/collection-preferences/styles.scoped.css +44 -40
- package/lib/internal/template/collection-preferences/styles.selectors.js +37 -32
- package/lib/internal/template/collection-preferences/utils.d.ts +12 -1
- package/lib/internal/template/collection-preferences/utils.d.ts.map +1 -1
- package/lib/internal/template/collection-preferences/utils.js +15 -1
- package/lib/internal/template/collection-preferences/utils.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +14 -0
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts +2 -1
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/abstract-switch/index.js +6 -5
- package/lib/internal/template/internal/components/abstract-switch/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/progress-bar/internal.d.ts.map +1 -1
- package/lib/internal/template/progress-bar/internal.js +1 -1
- package/lib/internal/template/progress-bar/internal.js.map +1 -1
- package/lib/internal/template/table/body-cell/styles.css.js +28 -23
- package/lib/internal/template/table/body-cell/styles.scoped.css +111 -55
- package/lib/internal/template/table/body-cell/styles.selectors.js +28 -23
- package/lib/internal/template/table/body-cell/td-element.d.ts +3 -0
- package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -1
- package/lib/internal/template/table/body-cell/td-element.js +16 -2
- package/lib/internal/template/table/body-cell/td-element.js.map +1 -1
- package/lib/internal/template/table/header-cell/index.d.ts +4 -1
- package/lib/internal/template/table/header-cell/index.d.ts.map +1 -1
- package/lib/internal/template/table/header-cell/index.js +9 -2
- package/lib/internal/template/table/header-cell/index.js.map +1 -1
- package/lib/internal/template/table/header-cell/styles.css.js +24 -19
- package/lib/internal/template/table/header-cell/styles.scoped.css +67 -32
- package/lib/internal/template/table/header-cell/styles.selectors.js +24 -19
- package/lib/internal/template/table/interfaces.d.ts +14 -0
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +19 -6
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts +2 -0
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +12 -4
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/table/use-sticky-columns.d.ts.map +1 -1
- package/lib/internal/template/table/use-sticky-columns.js +5 -1
- package/lib/internal/template/table/use-sticky-columns.js.map +1 -1
- package/lib/internal/template/table/utils.d.ts +4 -0
- package/lib/internal/template/table/utils.d.ts.map +1 -1
- package/lib/internal/template/table/utils.js +8 -0
- package/lib/internal/template/table/utils.js.map +1 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js +6 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.js +23 -0
- package/lib/internal/template/test-utils/dom/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js +6 -1
- package/lib/internal/template/test-utils/selectors/collection-preferences/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.js +23 -0
- package/lib/internal/template/test-utils/selectors/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/tiles/interfaces.d.ts +5 -0
- package/lib/internal/template/tiles/interfaces.d.ts.map +1 -1
- package/lib/internal/template/tiles/interfaces.js.map +1 -1
- package/lib/internal/template/tiles/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.js +2 -2
- package/lib/internal/template/tiles/internal.js.map +1 -1
- package/lib/internal/template/toggle/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle/internal.js +2 -2
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/package.json +1 -1
package/lib/internal/scss/collection-preferences/content-display/content-display-option.scss
CHANGED
|
@@ -40,7 +40,6 @@ $border-radius: awsui.$border-radius-item;
|
|
|
40
40
|
border-top: awsui.$border-divider-list-width solid awsui.$color-border-divider-default;
|
|
41
41
|
&:not(.placeholder).sorting {
|
|
42
42
|
@include animated;
|
|
43
|
-
z-index: 1;
|
|
44
43
|
}
|
|
45
44
|
&.placeholder {
|
|
46
45
|
> .content-display-option-content {
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
.content-density,
|
|
27
27
|
.page-size,
|
|
28
28
|
.page-size-form-field,
|
|
29
|
-
.page-size-radio-group
|
|
29
|
+
.page-size-radio-group,
|
|
30
|
+
.sticky-columns,
|
|
31
|
+
.sticky-columns-form-field,
|
|
32
|
+
.sticky-columns-radio-group,
|
|
33
|
+
.sticky-columns-first,
|
|
34
|
+
.sticky-columns-last {
|
|
30
35
|
/* used in test-utils */
|
|
31
36
|
}
|
|
@@ -53,6 +53,9 @@ $border-placeholder: awsui.$border-item-width solid transparent;
|
|
|
53
53
|
*/
|
|
54
54
|
&:first-child.has-striped-rows {
|
|
55
55
|
padding-left: awsui.$space-xxs;
|
|
56
|
+
&-sticky-cell-pad-left {
|
|
57
|
+
padding-left: awsui.$space-table-horizontal;
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
/*
|
|
@@ -102,6 +105,48 @@ $border-placeholder: awsui.$border-item-width solid transparent;
|
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
108
|
+
&.sticky-cell {
|
|
109
|
+
position: sticky;
|
|
110
|
+
background: awsui.$color-background-container-content;
|
|
111
|
+
z-index: 798; // Our sticky elements should have z-index in the range of 800-850, this value needs to be lower
|
|
112
|
+
&-pad-left:not(.has-selection):not(.is-visual-refresh.body-cell:first-child.has-striped-rows) {
|
|
113
|
+
padding-left: awsui.$space-table-horizontal;
|
|
114
|
+
}
|
|
115
|
+
&.body-cell-shaded {
|
|
116
|
+
background: awsui.$color-background-cell-shaded;
|
|
117
|
+
}
|
|
118
|
+
&.body-cell-selected {
|
|
119
|
+
background-color: awsui.$color-background-item-selected;
|
|
120
|
+
|
|
121
|
+
// Create a background using box-shadow and clip path to hide underlying elements
|
|
122
|
+
&:first-child {
|
|
123
|
+
box-shadow: 0 0 0 4px awsui.$color-background-container-content;
|
|
124
|
+
clip-path: inset(0 0 0 0);
|
|
125
|
+
}
|
|
126
|
+
&:last-child {
|
|
127
|
+
box-shadow: 4px 0 0 0 awsui.$color-background-container-content;
|
|
128
|
+
clip-path: inset(0 0 0 0);
|
|
129
|
+
&.sticky-cell-last-right {
|
|
130
|
+
box-shadow: awsui.$shadow-sticky-column-last, 8px 0 0 0 awsui.$color-background-container-content;
|
|
131
|
+
clip-path: inset(0 0 0 -24px);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
&-last-left {
|
|
136
|
+
box-shadow: awsui.$shadow-sticky-column-first;
|
|
137
|
+
clip-path: inset(0px -24px 0px 0px);
|
|
138
|
+
}
|
|
139
|
+
&-last-right {
|
|
140
|
+
box-shadow: awsui.$shadow-sticky-column-last;
|
|
141
|
+
clip-path: inset(0 0 0 -24px);
|
|
142
|
+
}
|
|
143
|
+
@include styles.with-motion {
|
|
144
|
+
transition-property: padding;
|
|
145
|
+
transition-duration: awsui.$motion-duration-transition-show-quick;
|
|
146
|
+
transition-timing-function: awsui.$motion-easing-sticky;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
105
150
|
// Use padding as a selected border placeholder to make sure rows don't change height on selection (visual refresh)
|
|
106
151
|
&-selected:not(:first-child) {
|
|
107
152
|
padding-top: $cell-vertical-padding-w-border;
|
|
@@ -193,8 +238,15 @@ $border-placeholder: awsui.$border-item-width solid transparent;
|
|
|
193
238
|
position: relative;
|
|
194
239
|
cursor: pointer;
|
|
195
240
|
|
|
241
|
+
&.sticky-cell {
|
|
242
|
+
position: sticky;
|
|
243
|
+
}
|
|
244
|
+
|
|
196
245
|
&.body-cell-edit-active {
|
|
197
246
|
overflow: visible;
|
|
247
|
+
&.sticky-cell {
|
|
248
|
+
position: sticky;
|
|
249
|
+
}
|
|
198
250
|
}
|
|
199
251
|
|
|
200
252
|
&:not(.body-cell-edit-active) {
|
|
@@ -31,6 +31,31 @@
|
|
|
31
31
|
padding-right: awsui.$space-xs;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
&.sticky-cell {
|
|
35
|
+
position: sticky;
|
|
36
|
+
background: awsui.$color-background-table-header;
|
|
37
|
+
z-index: 798; // Lower than the AppLayout's notification slot z-index(799)
|
|
38
|
+
&-pad-left:not(.has-selection) {
|
|
39
|
+
padding-left: awsui.$space-table-horizontal;
|
|
40
|
+
}
|
|
41
|
+
&-last-left {
|
|
42
|
+
box-shadow: awsui.$shadow-sticky-column-first;
|
|
43
|
+
clip-path: inset(0px -24px 0px 0px);
|
|
44
|
+
&:not(.header-cell-resizable):before {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
&-last-right {
|
|
49
|
+
box-shadow: awsui.$shadow-sticky-column-last;
|
|
50
|
+
clip-path: inset(0 0 0 -24px);
|
|
51
|
+
}
|
|
52
|
+
@include styles.with-motion {
|
|
53
|
+
transition-property: padding;
|
|
54
|
+
transition-duration: awsui.$motion-duration-transition-show-quick;
|
|
55
|
+
transition-timing-function: awsui.$motion-easing-sticky;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
34
59
|
&:not(:last-child):before {
|
|
35
60
|
$gap: calc(2 * #{awsui.$space-xs} + #{awsui.$space-xxxs});
|
|
36
61
|
|
|
@@ -139,6 +164,9 @@ settings icon in the pagination slot.
|
|
|
139
164
|
.header-cell.is-visual-refresh {
|
|
140
165
|
&:first-child:not(.has-striped-rows) {
|
|
141
166
|
padding-left: awsui.$space-xxxs;
|
|
167
|
+
&.sticky-cell-pad-left {
|
|
168
|
+
padding-left: awsui.$space-table-horizontal;
|
|
169
|
+
}
|
|
142
170
|
}
|
|
143
171
|
|
|
144
172
|
/*
|
|
@@ -41,5 +41,10 @@ export interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlP
|
|
|
41
41
|
* Description that appears below the label.
|
|
42
42
|
*/
|
|
43
43
|
description?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Adds `aria-controls` attribute to the component.
|
|
46
|
+
* If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.
|
|
47
|
+
*/
|
|
48
|
+
ariaControls?: string;
|
|
44
49
|
}
|
|
45
50
|
//# sourceMappingURL=base-checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,qBAAqB;IAClF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,qBAAqB;IAClF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-checkbox.js","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. By default, it uses an automatically generated ID.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-checkbox.js","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. By default, it uses an automatically generated ID.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,yFA6ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import styles from './styles.css.js';
|
|
|
11
11
|
import CheckboxIcon from '../internal/components/checkbox-icon';
|
|
12
12
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
13
13
|
const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
14
|
-
var { controlId, name, checked, disabled, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex, showOutline, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "__internalRootRef"]);
|
|
14
|
+
var { controlId, name, checked, disabled, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex, showOutline, ariaControls, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "ariaControls", "__internalRootRef"]);
|
|
15
15
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
16
16
|
const baseProps = getBaseProps(rest);
|
|
17
17
|
const checkboxRef = useRef(null);
|
|
@@ -21,7 +21,7 @@ const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
|
21
21
|
checkboxRef.current.indeterminate = Boolean(indeterminate);
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
|
|
24
|
+
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
|
|
25
25
|
// empty handler to suppress React controllability warning
|
|
26
26
|
onChange: () => { } }))), onClick: () => {
|
|
27
27
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAO7E,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,CACE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAC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xB,aAAa,EAAE,kBAAkB,CAAC,EAAE,CAAC,CACnC,+CACM,kBAAkB,IACtB,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,mBACK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAChD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC;YAC5C,0DAA0D;YAC1D,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,IAClB,CACH,EACD,OAAO,EAAE,GAAG,EAAE;;YACZ,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC7B,sBAAsB,CACpB,QAAQ;YACR,4EAA4E;YAC5E,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CACtG,CAAC;QACJ,CAAC,EACD,aAAa,EAAE,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAI,EACnG,iBAAiB,EAAE,iBAAiB,IACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useRef } from 'react';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { CheckboxProps } from './interfaces';\nimport styles from './styles.css.js';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex,\n showOutline,\n ariaControls,\n __internalRootRef,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={<CheckboxIcon checked={checked} indeterminate={indeterminate} disabled={disabled} />}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
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-title": "awsui_content-display-
|
|
13
|
-
"content-display-description": "awsui_content-display-
|
|
14
|
-
"content-display-option-list": "awsui_content-display-option-
|
|
4
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_vuun8_185",
|
|
5
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_vuun8_189",
|
|
6
|
+
"content-display-option": "awsui_content-display-option_1f3h0_vuun8_185",
|
|
7
|
+
"placeholder": "awsui_placeholder_1f3h0_vuun8_212",
|
|
8
|
+
"sorting": "awsui_sorting_1f3h0_vuun8_212",
|
|
9
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_vuun8_239",
|
|
10
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_vuun8_247",
|
|
11
|
+
"content-display": "awsui_content-display_1f3h0_vuun8_185",
|
|
12
|
+
"content-display-title": "awsui_content-display-title_1f3h0_vuun8_274",
|
|
13
|
+
"content-display-description": "awsui_content-display-description_1f3h0_vuun8_282",
|
|
14
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_vuun8_290"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -182,11 +182,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
182
182
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
183
183
|
SPDX-License-Identifier: Apache-2.0
|
|
184
184
|
*/
|
|
185
|
-
.awsui_content-display-option-
|
|
185
|
+
.awsui_content-display-option-toggle_1f3h0_vuun8_185:not(#\9) {
|
|
186
186
|
/* used in test-utils */
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
.awsui_content-display-option-
|
|
189
|
+
.awsui_content-display-option-content_1f3h0_vuun8_189:not(#\9) {
|
|
190
190
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
191
191
|
border-collapse: separate;
|
|
192
192
|
border-spacing: 0;
|
|
@@ -230,29 +230,28 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
230
230
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.awsui_content-display-
|
|
233
|
+
.awsui_content-display-option_1f3h0_vuun8_185:not(#\9) {
|
|
234
234
|
list-style: none;
|
|
235
235
|
position: relative;
|
|
236
236
|
border-top: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-k96bks, #eaeded);
|
|
237
237
|
}
|
|
238
|
-
.awsui_content-display-
|
|
238
|
+
.awsui_content-display-option_1f3h0_vuun8_185:not(#\9):not(.awsui_placeholder_1f3h0_vuun8_212).awsui_sorting_1f3h0_vuun8_212 {
|
|
239
239
|
transition: transform var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
|
|
240
|
-
z-index: 1;
|
|
241
240
|
}
|
|
242
241
|
@media (prefers-reduced-motion: reduce) {
|
|
243
|
-
.awsui_content-display-
|
|
242
|
+
.awsui_content-display-option_1f3h0_vuun8_185:not(#\9):not(.awsui_placeholder_1f3h0_vuun8_212).awsui_sorting_1f3h0_vuun8_212 {
|
|
244
243
|
animation: none;
|
|
245
244
|
transition: none;
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
|
-
.awsui-motion-disabled .awsui_content-display-
|
|
247
|
+
.awsui-motion-disabled .awsui_content-display-option_1f3h0_vuun8_185:not(#\9):not(.awsui_placeholder_1f3h0_vuun8_212).awsui_sorting_1f3h0_vuun8_212, .awsui-mode-entering .awsui_content-display-option_1f3h0_vuun8_185:not(#\9):not(.awsui_placeholder_1f3h0_vuun8_212).awsui_sorting_1f3h0_vuun8_212 {
|
|
249
248
|
animation: none;
|
|
250
249
|
transition: none;
|
|
251
250
|
}
|
|
252
|
-
.awsui_content-display-
|
|
251
|
+
.awsui_content-display-option_1f3h0_vuun8_185.awsui_placeholder_1f3h0_vuun8_212 > .awsui_content-display-option-content_1f3h0_vuun8_189:not(#\9) {
|
|
253
252
|
position: relative;
|
|
254
253
|
}
|
|
255
|
-
.awsui_content-display-
|
|
254
|
+
.awsui_content-display-option_1f3h0_vuun8_185.awsui_placeholder_1f3h0_vuun8_212 > .awsui_content-display-option-content_1f3h0_vuun8_189:not(#\9):after {
|
|
256
255
|
content: " ";
|
|
257
256
|
position: absolute;
|
|
258
257
|
top: 0;
|
|
@@ -263,7 +262,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
263
262
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
264
263
|
}
|
|
265
264
|
|
|
266
|
-
.awsui_content-display-option-
|
|
265
|
+
.awsui_content-display-option-label_1f3h0_vuun8_239:not(#\9) {
|
|
267
266
|
flex-grow: 1;
|
|
268
267
|
min-width: 0;
|
|
269
268
|
-ms-word-break: break-all;
|
|
@@ -271,18 +270,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
271
270
|
padding-right: var(--space-l-4vl6xu, 20px);
|
|
272
271
|
}
|
|
273
272
|
|
|
274
|
-
.awsui_drag-
|
|
273
|
+
.awsui_drag-overlay_1f3h0_vuun8_247:not(#\9) {
|
|
275
274
|
box-shadow: var(--shadow-container-active-h4jsj2, 0px 4px 8px rgba(0, 28, 36, 0.45));
|
|
276
275
|
border-radius: var(--border-radius-item-wjpc1f, 0px);
|
|
277
276
|
}
|
|
278
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
277
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_vuun8_247:not(#\9) {
|
|
279
278
|
position: relative;
|
|
280
279
|
}
|
|
281
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
280
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_vuun8_247:not(#\9) {
|
|
282
281
|
outline: 2px dotted transparent;
|
|
283
282
|
outline-offset: calc(0px - 1px);
|
|
284
283
|
}
|
|
285
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
284
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_vuun8_247:not(#\9)::before {
|
|
286
285
|
content: " ";
|
|
287
286
|
display: block;
|
|
288
287
|
position: absolute;
|
|
@@ -294,11 +293,11 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_p05e7_248:not(#\9)
|
|
|
294
293
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
295
294
|
}
|
|
296
295
|
|
|
297
|
-
.awsui_content-
|
|
296
|
+
.awsui_content-display_1f3h0_vuun8_185:not(#\9) {
|
|
298
297
|
/* used in test-utils */
|
|
299
298
|
}
|
|
300
299
|
|
|
301
|
-
.awsui_content-display-
|
|
300
|
+
.awsui_content-display-title_1f3h0_vuun8_274:not(#\9) {
|
|
302
301
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
303
302
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
304
303
|
font-weight: var(--font-display-label-weight-tjy9e4, 400);
|
|
@@ -306,7 +305,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_p05e7_248:not(#\9)
|
|
|
306
305
|
margin: 0;
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
.awsui_content-display-
|
|
308
|
+
.awsui_content-display-description_1f3h0_vuun8_282:not(#\9) {
|
|
310
309
|
color: var(--color-text-form-secondary-1c3szk, #687078);
|
|
311
310
|
font-size: var(--font-body-s-size-ukw2p9, 12px);
|
|
312
311
|
line-height: var(--font-body-s-line-height-kdsbrl, 16px);
|
|
@@ -314,7 +313,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_p05e7_248:not(#\9)
|
|
|
314
313
|
margin-top: var(--space-scaled-xxxs-lo883m, 2px);
|
|
315
314
|
}
|
|
316
315
|
|
|
317
|
-
.awsui_content-display-option-
|
|
316
|
+
.awsui_content-display-option-list_1f3h0_vuun8_290:not(#\9) {
|
|
318
317
|
position: relative;
|
|
319
318
|
list-style: none;
|
|
320
319
|
padding: 0;
|
|
@@ -2,16 +2,16 @@
|
|
|
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-title": "awsui_content-display-
|
|
14
|
-
"content-display-description": "awsui_content-display-
|
|
15
|
-
"content-display-option-list": "awsui_content-display-option-
|
|
5
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_vuun8_185",
|
|
6
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_vuun8_189",
|
|
7
|
+
"content-display-option": "awsui_content-display-option_1f3h0_vuun8_185",
|
|
8
|
+
"placeholder": "awsui_placeholder_1f3h0_vuun8_212",
|
|
9
|
+
"sorting": "awsui_sorting_1f3h0_vuun8_212",
|
|
10
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_vuun8_239",
|
|
11
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_vuun8_247",
|
|
12
|
+
"content-display": "awsui_content-display_1f3h0_vuun8_185",
|
|
13
|
+
"content-display-title": "awsui_content-display-title_1f3h0_vuun8_274",
|
|
14
|
+
"content-display-description": "awsui_content-display-description_1f3h0_vuun8_282",
|
|
15
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_vuun8_290"
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CollectionPreferencesProps } from './interfaces';
|
|
3
3
|
export { CollectionPreferencesProps };
|
|
4
|
-
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, preferences, customPreference, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
4
|
+
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAO1D,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,GAAG,IAAI,EACR,EAAE,0BAA0B,eAoK5B"}
|
|
@@ -9,7 +9,7 @@ import InternalBox from '../box/internal';
|
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
10
10
|
import InternalModal from '../modal/internal';
|
|
11
11
|
import InternalSpaceBetween from '../space-between/internal';
|
|
12
|
-
import { copyPreferences, mergePreferences, ModalContentLayout, PageSizePreference, WrapLinesPreference, StripedRowsPreference, ContentDensityPreference, CustomPreference, } from './utils';
|
|
12
|
+
import { copyPreferences, mergePreferences, ModalContentLayout, PageSizePreference, WrapLinesPreference, StripedRowsPreference, ContentDensityPreference, StickyColumnsPreference, CustomPreference, } from './utils';
|
|
13
13
|
import VisibleContentPreference from './visible-content';
|
|
14
14
|
import checkControlled from '../internal/hooks/check-controlled';
|
|
15
15
|
import styles from './styles.css.js';
|
|
@@ -19,9 +19,9 @@ import ContentDisplayPreference from './content-display';
|
|
|
19
19
|
import { warnOnce } from '../internal/logging';
|
|
20
20
|
const componentName = 'CollectionPreferences';
|
|
21
21
|
export default function CollectionPreferences(_a) {
|
|
22
|
-
var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, preferences, customPreference } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "preferences", "customPreference"]);
|
|
23
|
-
const { __internalRootRef } = useBaseComponent(
|
|
24
|
-
checkControlled(
|
|
22
|
+
var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "stickyColumnsPreference", "preferences", "customPreference"]);
|
|
23
|
+
const { __internalRootRef } = useBaseComponent('CollectionPreferences');
|
|
24
|
+
checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);
|
|
25
25
|
const baseProps = getBaseProps(rest);
|
|
26
26
|
const [modalVisible, setModalVisible] = useState(false);
|
|
27
27
|
const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));
|
|
@@ -48,6 +48,7 @@ export default function CollectionPreferences(_a) {
|
|
|
48
48
|
wrapLinesPreference ||
|
|
49
49
|
stripedRowsPreference ||
|
|
50
50
|
contentDensityPreference ||
|
|
51
|
+
stickyColumnsPreference ||
|
|
51
52
|
customPreference);
|
|
52
53
|
const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);
|
|
53
54
|
const onChange = (changedPreferences) => setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));
|
|
@@ -68,6 +69,7 @@ export default function CollectionPreferences(_a) {
|
|
|
68
69
|
wrapLinesPreference && (React.createElement(WrapLinesPreference, Object.assign({ value: temporaryPreferences.wrapLines }, wrapLinesPreference, { onChange: wrapLines => onChange({ wrapLines }) }))),
|
|
69
70
|
stripedRowsPreference && (React.createElement(StripedRowsPreference, Object.assign({ value: temporaryPreferences.stripedRows }, stripedRowsPreference, { onChange: stripedRows => onChange({ stripedRows }) }))),
|
|
70
71
|
contentDensityPreference && (React.createElement(ContentDensityPreference, Object.assign({ value: temporaryPreferences.contentDensity }, contentDensityPreference, { onChange: contentDensity => onChange({ contentDensity }) }))),
|
|
72
|
+
stickyColumnsPreference && (React.createElement(StickyColumnsPreference, Object.assign({ value: temporaryPreferences.stickyColumns }, stickyColumnsPreference, { onChange: stickyColumns => onChange({ stickyColumns }) }))),
|
|
71
73
|
customPreference && (React.createElement(CustomPreference, { value: temporaryPreferences.custom, customPreference: customPreference, onChange: custom => onChange({ custom }) })))), right: contentDisplayPreference ? (React.createElement(ContentDisplayPreference, Object.assign({}, contentDisplayPreference, { value: temporaryPreferences.contentDisplay, onChange: contentDisplay => onChange({ contentDisplay }) }))) : (visibleContentPreference && (React.createElement(VisibleContentPreference, Object.assign({ value: temporaryPreferences.visibleContent }, visibleContentPreference, { onChange: visibleItems => onChange({ visibleContent: visibleItems }) })))) })))));
|
|
72
74
|
}
|
|
73
75
|
applyDisplayName(CollectionPreferences, componentName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,wBAAwB,MAAM,mBAAmB,CAAC;AACzD,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO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AAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport ContentDisplayPreference from './content-display';\nimport { warnOnce } from '../internal/logging';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent(componentName);\n checkControlled(componentName, 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO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CAAC,MAAM,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,GACxC,CACH,CACoB,CACxB,EAEH,KAAK,EACH,wBAAwB,CAAC,CAAC,CAAC,CACzB,oBAAC,wBAAwB,oBACnB,wBAAwB,IAC5B,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAC1C,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,IACxD,CACH,CAAC,CAAC,CAAC,CACF,wBAAwB,IAAI,CAC1B,oBAAC,wBAAwB,kBACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n StickyColumnsPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport ContentDisplayPreference from './content-display';\nimport { warnOnce } from '../internal/logging';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent('CollectionPreferences');\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|