@cloudscape-design/components-themeable 3.0.1073 → 3.0.1075
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/alert/styles.scss +5 -5
- package/lib/internal/scss/internal/components/drag-handle/styles.scss +4 -0
- package/lib/internal/scss/internal/components/sortable-area/styles.scss +1 -3
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +80 -76
- package/lib/internal/template/alert/index.d.ts.map +1 -1
- package/lib/internal/template/alert/index.js +7 -5
- package/lib/internal/template/alert/index.js.map +1 -1
- package/lib/internal/template/alert/internal.d.ts +1 -1
- package/lib/internal/template/alert/internal.js +1 -1
- package/lib/internal/template/alert/internal.js.map +1 -1
- package/lib/internal/template/alert/style.js +3 -3
- package/lib/internal/template/alert/style.js.map +1 -1
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +46 -46
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/anchor-navigation/internal.d.ts.map +1 -1
- package/lib/internal/template/anchor-navigation/internal.js +1 -1
- package/lib/internal/template/anchor-navigation/internal.js.map +1 -1
- package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +32 -32
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
- package/lib/internal/template/app-layout/index.js.map +1 -1
- package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
- package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +39 -39
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +23 -23
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +46 -46
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +23 -23
- package/lib/internal/template/app-layout-toolbar/index.js.map +1 -1
- package/lib/internal/template/area-chart/internal.d.ts.map +1 -1
- package/lib/internal/template/area-chart/internal.js +1 -1
- package/lib/internal/template/area-chart/internal.js.map +1 -1
- package/lib/internal/template/attribute-editor/internal.js +1 -1
- package/lib/internal/template/attribute-editor/internal.js.map +1 -1
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/box/internal.d.ts.map +1 -1
- package/lib/internal/template/box/internal.js +1 -1
- package/lib/internal/template/box/internal.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
- package/lib/internal/template/breadcrumb-group/skeleton.d.ts +1 -1
- package/lib/internal/template/button/internal.d.ts +2 -2
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +1 -1
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button/styles.css.js +22 -22
- package/lib/internal/template/button/styles.scoped.css +212 -212
- package/lib/internal/template/button/styles.selectors.js +22 -22
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +16 -16
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +27 -27
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +16 -16
- package/lib/internal/template/button-group/internal.js +1 -1
- package/lib/internal/template/button-group/internal.js.map +1 -1
- package/lib/internal/template/checkbox/styles.css.js +3 -3
- package/lib/internal/template/checkbox/styles.scoped.css +11 -11
- package/lib/internal/template/checkbox/styles.selectors.js +3 -3
- package/lib/internal/template/container/internal.d.ts.map +1 -1
- package/lib/internal/template/container/internal.js +1 -1
- package/lib/internal/template/container/internal.js.map +1 -1
- package/lib/internal/template/content-layout/styles.css.js +14 -14
- package/lib/internal/template/content-layout/styles.scoped.css +27 -27
- package/lib/internal/template/content-layout/styles.selectors.js +14 -14
- package/lib/internal/template/copy-to-clipboard/internal.d.ts.map +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.js +1 -1
- package/lib/internal/template/copy-to-clipboard/internal.js.map +1 -1
- package/lib/internal/template/date-input/internal.d.ts +1 -1
- package/lib/internal/template/date-input/internal.js +1 -1
- package/lib/internal/template/date-input/internal.js.map +1 -1
- package/lib/internal/template/file-dropzone/internal.d.ts.map +1 -1
- package/lib/internal/template/file-dropzone/internal.js +1 -1
- package/lib/internal/template/file-dropzone/internal.js.map +1 -1
- package/lib/internal/template/file-input/internal.d.ts +1 -1
- package/lib/internal/template/file-input/internal.d.ts.map +1 -1
- package/lib/internal/template/file-input/internal.js +1 -1
- package/lib/internal/template/file-input/internal.js.map +1 -1
- package/lib/internal/template/file-upload/internal.d.ts +1 -1
- package/lib/internal/template/file-upload/internal.js +1 -1
- package/lib/internal/template/file-upload/internal.js.map +1 -1
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +187 -187
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/form/index.d.ts.map +1 -1
- package/lib/internal/template/form/index.js +6 -5
- package/lib/internal/template/form/index.js.map +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form-field/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal.d.ts.map +1 -1
- package/lib/internal/template/form-field/internal.js +6 -4
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/grid/internal.js +1 -1
- package/lib/internal/template/grid/internal.js.map +1 -1
- package/lib/internal/template/header/internal.d.ts.map +1 -1
- package/lib/internal/template/header/internal.js +1 -1
- package/lib/internal/template/header/internal.js.map +1 -1
- package/lib/internal/template/help-panel/styles.css.js +6 -6
- package/lib/internal/template/help-panel/styles.scoped.css +73 -73
- package/lib/internal/template/help-panel/styles.selectors.js +6 -6
- package/lib/internal/template/icon/internal.js +1 -1
- package/lib/internal/template/icon/internal.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 +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 +8 -4
- package/lib/internal/template/internal/components/drag-handle/button.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/index.d.ts +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 +3 -3
- package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +3 -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 +14 -13
- package/lib/internal/template/internal/components/drag-handle/styles.scoped.css +22 -18
- package/lib/internal/template/internal/components/drag-handle/styles.selectors.js +14 -13
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +10 -9
- package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +2 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +21 -21
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +44 -44
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +21 -21
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +38 -38
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/sortable-area/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/index.js +20 -5
- package/lib/internal/template/internal/components/sortable-area/index.js.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/index.d.ts +20 -5
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/index.js +60 -36
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/index.js.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/events.d.ts +3 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/events.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/events.js +2 -0
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/events.js.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/scroll.d.ts +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/scroll.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/scroll.js +4 -9
- package/lib/internal/template/internal/components/sortable-area/keyboard-sensor/utilities/scroll.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 +15 -19
- package/lib/internal/template/internal/components/sortable-area/styles.selectors.js +8 -8
- package/lib/internal/template/internal/components/sortable-area/use-drag-and-drop-reorder.d.ts +4 -2
- package/lib/internal/template/internal/components/sortable-area/use-drag-and-drop-reorder.d.ts.map +1 -1
- package/lib/internal/template/internal/components/sortable-area/use-drag-and-drop-reorder.js +36 -40
- package/lib/internal/template/internal/components/sortable-area/use-drag-and-drop-reorder.js.map +1 -1
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +4 -0
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/lib/internal/template/internal/generated/custom-css-properties/index.js +79 -75
- package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
- package/lib/internal/template/internal/generated/theming/index.cjs +14 -0
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +63 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +63 -0
- package/lib/internal/template/internal/generated/theming/index.js +14 -0
- package/lib/internal/template/internal/hooks/use-base-component/index.d.ts +5 -5
- package/lib/internal/template/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/use-base-component/index.js.map +1 -1
- package/lib/internal/template/link/internal.d.ts +1 -1
- package/lib/internal/template/link/internal.d.ts.map +1 -1
- package/lib/internal/template/link/internal.js +2 -4
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +103 -103
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/list/internal.d.ts.map +1 -1
- package/lib/internal/template/list/internal.js +1 -1
- package/lib/internal/template/list/internal.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal.js +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal.js.map +1 -1
- package/lib/internal/template/modal/internal.js +1 -1
- package/lib/internal/template/modal/internal.js.map +1 -1
- package/lib/internal/template/multiselect/internal.d.ts +1 -1
- package/lib/internal/template/multiselect/internal.d.ts.map +1 -1
- package/lib/internal/template/multiselect/internal.js +1 -1
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/pagination/internal.d.ts.map +1 -1
- package/lib/internal/template/pagination/internal.js +1 -1
- package/lib/internal/template/pagination/internal.js.map +1 -1
- package/lib/internal/template/popover/internal.js +1 -1
- package/lib/internal/template/popover/internal.js.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +1 -1
- package/lib/internal/template/prompt-input/internal.js.map +1 -1
- package/lib/internal/template/property-filter/interfaces.d.ts +2 -1
- package/lib/internal/template/property-filter/interfaces.d.ts.map +1 -1
- package/lib/internal/template/property-filter/interfaces.js.map +1 -1
- package/lib/internal/template/property-filter/internal.d.ts +1 -1
- package/lib/internal/template/property-filter/internal.d.ts.map +1 -1
- package/lib/internal/template/radio-group/internal.d.ts +1 -1
- package/lib/internal/template/radio-group/internal.d.ts.map +1 -1
- package/lib/internal/template/radio-group/internal.js +1 -1
- package/lib/internal/template/radio-group/internal.js.map +1 -1
- package/lib/internal/template/radio-group/styles.css.js +10 -10
- package/lib/internal/template/radio-group/styles.scoped.css +22 -22
- package/lib/internal/template/radio-group/styles.selectors.js +10 -10
- package/lib/internal/template/segmented-control/internal.d.ts.map +1 -1
- package/lib/internal/template/segmented-control/internal.js +1 -1
- package/lib/internal/template/segmented-control/internal.js.map +1 -1
- package/lib/internal/template/select/internal.js +1 -1
- package/lib/internal/template/select/internal.js.map +1 -1
- package/lib/internal/template/slider/internal.d.ts.map +1 -1
- package/lib/internal/template/slider/internal.js +1 -1
- package/lib/internal/template/slider/internal.js.map +1 -1
- package/lib/internal/template/slider/styles.css.js +26 -26
- package/lib/internal/template/slider/styles.scoped.css +86 -86
- package/lib/internal/template/slider/styles.selectors.js +26 -26
- package/lib/internal/template/space-between/internal.d.ts +1 -1
- package/lib/internal/template/space-between/internal.d.ts.map +1 -1
- package/lib/internal/template/spinner/styles.css.js +13 -13
- package/lib/internal/template/spinner/styles.scoped.css +39 -39
- package/lib/internal/template/spinner/styles.selectors.js +13 -13
- package/lib/internal/template/steps/internal.d.ts +1 -1
- package/lib/internal/template/steps/internal.d.ts.map +1 -1
- package/lib/internal/template/steps/internal.js.map +1 -1
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +66 -66
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/text-filter/internal.d.ts +1 -1
- package/lib/internal/template/text-filter/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.d.ts +1 -1
- package/lib/internal/template/tiles/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.js +1 -1
- package/lib/internal/template/tiles/internal.js.map +1 -1
- package/lib/internal/template/time-input/internal.d.ts +1 -1
- package/lib/internal/template/time-input/internal.d.ts.map +1 -1
- package/lib/internal/template/time-input/internal.js +1 -1
- package/lib/internal/template/time-input/internal.js.map +1 -1
- package/lib/internal/template/toggle/internal.js +1 -1
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/lib/internal/template/toggle/styles.css.js +10 -10
- package/lib/internal/template/toggle/styles.scoped.css +23 -23
- package/lib/internal/template/toggle/styles.selectors.js +10 -10
- package/lib/internal/template/wizard/wizard-form.js +5 -3
- package/lib/internal/template/wizard/wizard-form.js.map +1 -1
- package/package.json +1 -1
|
@@ -142,72 +142,72 @@
|
|
|
142
142
|
*/
|
|
143
143
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
144
144
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
145
|
-
.
|
|
146
|
-
--awsui-content-layout-default-horizontal-padding-
|
|
147
|
-
--awsui-content-layout-max-content-width-
|
|
148
|
-
--awsui-content-layout-main-gap-
|
|
145
|
+
.awsui_layout_5gtk3_b7g6e_145:not(#\9) {
|
|
146
|
+
--awsui-content-layout-default-horizontal-padding-mdigke: var(--space-layout-content-horizontal-q3zhej, 40px);
|
|
147
|
+
--awsui-content-layout-max-content-width-mdigke: 0px;
|
|
148
|
+
--awsui-content-layout-main-gap-mdigke: 0px;
|
|
149
149
|
display: grid;
|
|
150
|
-
grid-template-columns: 0 0 1fr minmax(0, var(--awsui-content-layout-max-content-width-
|
|
151
|
-
grid-template-rows: var(--awsui-content-layout-main-gap-
|
|
150
|
+
grid-template-columns: 0 0 1fr minmax(0, var(--awsui-content-layout-max-content-width-mdigke)) 1fr 0 0;
|
|
151
|
+
grid-template-rows: var(--awsui-content-layout-main-gap-mdigke) min-content min-content auto var(--space-dark-header-overlap-distance-45h6a9, 0px) 1fr;
|
|
152
152
|
min-block-size: 100%;
|
|
153
153
|
}
|
|
154
154
|
@media (max-width: 688px) {
|
|
155
|
-
.
|
|
156
|
-
--awsui-content-layout-default-horizontal-padding-
|
|
155
|
+
.awsui_layout_5gtk3_b7g6e_145:not(#\9) {
|
|
156
|
+
--awsui-content-layout-default-horizontal-padding-mdigke: var(--space-l-3cws6j, 20px);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
.
|
|
159
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_background_5gtk3_b7g6e_159:not(#\9) {
|
|
160
160
|
grid-column: 1/8;
|
|
161
161
|
grid-row: 1/6;
|
|
162
162
|
color: var(--color-text-body-default-5qid0u, #16191f);
|
|
163
163
|
}
|
|
164
|
-
.
|
|
164
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_background_5gtk3_b7g6e_159.awsui_is-overlap-disabled_5gtk3_b7g6e_164:not(#\9) {
|
|
165
165
|
grid-row: 1/5;
|
|
166
166
|
}
|
|
167
|
-
.
|
|
167
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_background_5gtk3_b7g6e_159 > .awsui_header-background_5gtk3_b7g6e_167:not(#\9) {
|
|
168
168
|
inline-size: 100%;
|
|
169
169
|
block-size: 100%;
|
|
170
170
|
}
|
|
171
|
-
.
|
|
171
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_notifications_5gtk3_b7g6e_171:not(#\9) {
|
|
172
172
|
grid-column: 4;
|
|
173
173
|
grid-row: 2;
|
|
174
174
|
padding-block-end: var(--space-xs-kw7k3v, 8px);
|
|
175
175
|
}
|
|
176
|
-
.
|
|
176
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_breadcrumbs_5gtk3_b7g6e_176:not(#\9) {
|
|
177
177
|
grid-column: 4;
|
|
178
178
|
grid-row: 3;
|
|
179
179
|
padding-block-end: var(--space-xs-kw7k3v, 8px);
|
|
180
180
|
}
|
|
181
|
-
.
|
|
182
|
-
--awsui-content-layout-main-gap-
|
|
183
|
-
grid-template-columns: var(--awsui-toggles-left-width-
|
|
181
|
+
.awsui_layout_5gtk3_b7g6e_145.awsui_default-padding_5gtk3_b7g6e_181:not(#\9) {
|
|
182
|
+
--awsui-content-layout-main-gap-mdigke: var(--space-scaled-m-sw9kcx, 16px);
|
|
183
|
+
grid-template-columns: var(--awsui-toggles-left-width-mdigke, 0) var(--awsui-content-layout-default-horizontal-padding-mdigke, 0) 1fr minmax(0, var(--awsui-content-layout-max-content-width-mdigke)) 1fr var(--awsui-content-layout-default-horizontal-padding-mdigke, 0) var(--awsui-toggles-right-width-mdigke, 0);
|
|
184
184
|
}
|
|
185
|
-
.
|
|
185
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_header-wrapper_5gtk3_b7g6e_185:not(#\9) {
|
|
186
186
|
grid-column: 4;
|
|
187
187
|
grid-row: 4;
|
|
188
188
|
padding-block-end: var(--space-content-header-padding-bottom-hjkugf, 16px);
|
|
189
189
|
}
|
|
190
|
-
.
|
|
190
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_header-wrapper_5gtk3_b7g6e_185.awsui_with-divider_5gtk3_b7g6e_190:not(#\9) {
|
|
191
191
|
border-block-end: 1px solid var(--color-border-divider-default-ipvpev, #eaeded);
|
|
192
192
|
}
|
|
193
|
-
.
|
|
193
|
+
.awsui_layout_5gtk3_b7g6e_145 > .awsui_content_5gtk3_b7g6e_193:not(#\9) {
|
|
194
194
|
grid-column: 4;
|
|
195
195
|
grid-row: 5/8;
|
|
196
196
|
}
|
|
197
|
-
.
|
|
198
|
-
grid-template-rows: var(--awsui-content-layout-main-gap-
|
|
197
|
+
.awsui_layout_5gtk3_b7g6e_145:not(#\9):not(.awsui_has-header_5gtk3_b7g6e_197) {
|
|
198
|
+
grid-template-rows: var(--awsui-content-layout-main-gap-mdigke) min-content min-content 0 calc(var(--space-dark-header-overlap-distance-45h6a9, 0px)) 1fr;
|
|
199
199
|
}
|
|
200
|
-
.
|
|
201
|
-
grid-template-rows: var(--awsui-content-layout-main-gap-
|
|
200
|
+
.awsui_layout_5gtk3_b7g6e_145.awsui_is-overlap-disabled_5gtk3_b7g6e_164:not(#\9) {
|
|
201
|
+
grid-template-rows: var(--awsui-content-layout-main-gap-mdigke) min-content min-content auto 0 1fr;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
.
|
|
204
|
+
.awsui_layout_5gtk3_b7g6e_145.awsui_is-visual-refresh_5gtk3_b7g6e_204 > .awsui_background_5gtk3_b7g6e_159.awsui_has-default-background_5gtk3_b7g6e_204:not(#\9) {
|
|
205
205
|
background-color: var(--color-background-layout-main-05m5y6, #f2f3f3);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
.
|
|
209
|
-
--awsui-content-layout-main-gap-
|
|
208
|
+
.awsui_layout_5gtk3_b7g6e_145:not(#\9):not(.awsui_is-visual-refresh_5gtk3_b7g6e_204).awsui_has-notifications_5gtk3_b7g6e_208 {
|
|
209
|
+
--awsui-content-layout-main-gap-mdigke: 0px;
|
|
210
210
|
}
|
|
211
|
-
.
|
|
211
|
+
.awsui_layout_5gtk3_b7g6e_145:not(#\9):not(.awsui_is-visual-refresh_5gtk3_b7g6e_204) > .awsui_notifications_5gtk3_b7g6e_171 {
|
|
212
212
|
grid-column: 1/8;
|
|
213
213
|
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"layout": "
|
|
6
|
-
"background": "
|
|
7
|
-
"is-overlap-disabled": "awsui_is-overlap-
|
|
8
|
-
"header-background": "awsui_header-
|
|
9
|
-
"notifications": "
|
|
10
|
-
"breadcrumbs": "
|
|
11
|
-
"default-padding": "awsui_default-
|
|
12
|
-
"header-wrapper": "awsui_header-
|
|
13
|
-
"with-divider": "awsui_with-
|
|
14
|
-
"content": "
|
|
15
|
-
"has-header": "awsui_has-
|
|
16
|
-
"is-visual-refresh": "awsui_is-visual-
|
|
17
|
-
"has-default-background": "awsui_has-default-
|
|
18
|
-
"has-notifications": "awsui_has-
|
|
5
|
+
"layout": "awsui_layout_5gtk3_b7g6e_145",
|
|
6
|
+
"background": "awsui_background_5gtk3_b7g6e_159",
|
|
7
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_5gtk3_b7g6e_164",
|
|
8
|
+
"header-background": "awsui_header-background_5gtk3_b7g6e_167",
|
|
9
|
+
"notifications": "awsui_notifications_5gtk3_b7g6e_171",
|
|
10
|
+
"breadcrumbs": "awsui_breadcrumbs_5gtk3_b7g6e_176",
|
|
11
|
+
"default-padding": "awsui_default-padding_5gtk3_b7g6e_181",
|
|
12
|
+
"header-wrapper": "awsui_header-wrapper_5gtk3_b7g6e_185",
|
|
13
|
+
"with-divider": "awsui_with-divider_5gtk3_b7g6e_190",
|
|
14
|
+
"content": "awsui_content_5gtk3_b7g6e_193",
|
|
15
|
+
"has-header": "awsui_has-header_5gtk3_b7g6e_197",
|
|
16
|
+
"is-visual-refresh": "awsui_is-visual-refresh_5gtk3_b7g6e_204",
|
|
17
|
+
"has-default-background": "awsui_has-default-background_5gtk3_b7g6e_204",
|
|
18
|
+
"has-notifications": "awsui_has-notifications_5gtk3_b7g6e_208"
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,UAAU,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAElG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,UAAU,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAElG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,GAAG,SAAS,EACb,EAAE,4BAA4B,eAkF9B"}
|
|
@@ -10,7 +10,7 @@ import InternalStatusIndicator from '../status-indicator/internal';
|
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
import testStyles from './test-classes/styles.css.js';
|
|
12
12
|
export default function InternalCopyToClipboard(_a) {
|
|
13
|
-
var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, disabled, disabledReason, __internalRootRef
|
|
13
|
+
var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, textToDisplay, popoverRenderWithPortal, disabled, disabledReason, __internalRootRef } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy", "textToDisplay", "popoverRenderWithPortal", "disabled", "disabledReason", "__internalRootRef"]);
|
|
14
14
|
const [status, setStatus] = useState('pending');
|
|
15
15
|
const [statusText, setStatusText] = useState('');
|
|
16
16
|
const baseProps = getBaseProps(restProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA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AC,IAAI,EAAE,MAAM,IAAG,UAAU,CAA2B,EACtF,QAAQ,EAAE,OAAO,IAEhB,MAAM,CACS,CACnB,CAAC;IAEF,OAAO,CACL,8CAAU,SAAS,IAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,QAAQ,CAAC,CAAC,CAAC,CACV,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,IAC7E,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,UAAU,CACvB,CACF,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalButton from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { CopyToClipboardProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\ninterface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {}\n\nexport default function InternalCopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n textToDisplay,\n popoverRenderWithPortal,\n disabled,\n disabledReason,\n __internalRootRef,\n ...restProps\n}: InternalCopyToClipboardProps) {\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const baseProps = getBaseProps(restProps);\n const onClick = () => {\n if (!navigator.clipboard) {\n // The clipboard API is not available in insecure contexts.\n setStatus('error');\n setStatusText(copyErrorText);\n return;\n }\n\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const isInline = variant === 'inline';\n\n const button = (\n <InternalButton\n ariaLabel={copyButtonAriaLabel ?? copyButtonText}\n iconName=\"copy\"\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n disabled={disabled}\n disabledReason={disabledReason}\n >\n {copyButtonText}\n </InternalButton>\n );\n\n const trigger = disabled ? (\n button\n ) : (\n <InternalPopover\n isInline={isInline}\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={popoverRenderWithPortal}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n __onOpen={onClick}\n >\n {button}\n </InternalPopover>\n );\n\n return (\n <span {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {isInline ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={clsx(testStyles['text-to-display'], testStyles['text-to-copy'])}>\n {textToDisplay ?? textToCopy}\n </span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
3
3
|
import { DateInputProps } from './interfaces';
|
|
4
|
-
declare const InternalDateInput: React.ForwardRefExoticComponent<DateInputProps & InternalBaseComponentProps
|
|
4
|
+
declare const InternalDateInput: React.ForwardRefExoticComponent<DateInputProps & InternalBaseComponentProps & {
|
|
5
5
|
__injectAnalyticsComponentMetadata?: boolean | undefined;
|
|
6
6
|
} & React.RefAttributes<import("..").InputProps.Ref>>;
|
|
7
7
|
export default InternalDateInput;
|
|
@@ -13,7 +13,7 @@ import formatDateLocalized from '../internal/utils/date-time/format-date-localiz
|
|
|
13
13
|
import { generateMaskArgs, normalizeIsoDateString } from './utils';
|
|
14
14
|
import styles from './styles.css.js';
|
|
15
15
|
const InternalDateInput = React.forwardRef((_a, ref) => {
|
|
16
|
-
var { value, onChange, onBlur, onFocus, granularity = 'day', locale, format = 'slashed', inputFormat = 'slashed', __internalRootRef
|
|
16
|
+
var { value, onChange, onBlur, onFocus, granularity = 'day', locale, format = 'slashed', inputFormat = 'slashed', __internalRootRef, __injectAnalyticsComponentMetadata = false } = _a, props = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "granularity", "locale", "format", "inputFormat", "__internalRootRef", "__injectAnalyticsComponentMetadata"]);
|
|
17
17
|
const [isFocused, setIsFocused] = useState(false);
|
|
18
18
|
const inputRef = useRef(null);
|
|
19
19
|
const isIso = format === 'iso' || (format === 'long-localized' && inputFormat === 'iso');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAA4B,MAAM,oBAAoB,CAAC;AACtF,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,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,yBAAyB,EAAE,KAAK,EAChC,yBAAyB,EAAE,IAAI,EAC/B,iBAAiB,EAAE,sBAAsB,EACzC,YAAY,EAAE,KAAK,EACnB,iBAAiB,EAAE,iBAAiB,IAChC,CAAC,kCAAkC;QACrC,CAAC,CAAC,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;QAC1E,CAAC,CAAC,EAAE,CAAC,EACP,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport MaskedInput from '../internal/components/masked-input';\nimport { fireNonCancelableEvent, NonCancelableCustomEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { displayToIso, isoToDisplay } from '../internal/utils/date-time';\nimport formatDateIso from '../internal/utils/date-time/format-date-iso';\nimport formatDateLocalized from '../internal/utils/date-time/format-date-localized';\nimport { GeneratedAnalyticsMetadataDateInputComponent } from './analytics-metadata/interfaces';\nimport { DateInputProps } from './interfaces';\nimport { generateMaskArgs, normalizeIsoDateString } from './utils';\n\nimport styles from './styles.css.js';\n\ntype InternalDateInputProps = DateInputProps &\n InternalBaseComponentProps & {\n __injectAnalyticsComponentMetadata?: boolean;\n };\n\nconst InternalDateInput = React.forwardRef(\n (\n {\n value,\n onChange,\n onBlur,\n onFocus,\n granularity = 'day',\n locale,\n format = 'slashed',\n inputFormat = 'slashed',\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...props\n }: InternalDateInputProps,\n ref: Ref<DateInputProps.Ref>\n ) => {\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const isIso = format === 'iso' || (format === 'long-localized' && inputFormat === 'iso');\n\n useForwardFocus(ref, inputRef);\n\n const onInputFocus = (event: NonCancelableCustomEvent<null>) => {\n setIsFocused(true);\n onFocus?.(event);\n };\n\n const onInputBlur = (event: NonCancelableCustomEvent<null>) => {\n setIsFocused(false);\n onBlur?.(event);\n };\n\n const onInputChange = (event: NonCancelableCustomEvent<{ value: string }>) => {\n const isNonFocusedLongLocalized = format === 'long-localized' && !(isFocused || props.readOnly);\n if (!isNonFocusedLongLocalized) {\n fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) });\n }\n };\n\n const usesLongLocalizedValue = format === 'long-localized' && !(isFocused && !props.readOnly);\n const displayedValue = useMemo(() => {\n if (!value) {\n return '';\n }\n const isoValue = displayToIso(value);\n const formatProps = { hideTimeOffset: true, isDateOnly: true, isMonthOnly: granularity === 'month', locale };\n const normalizedValue = normalizeIsoDateString(isoValue, granularity);\n return usesLongLocalizedValue && normalizedValue\n ? formatDateLocalized({ date: normalizedValue, ...formatProps })\n : isIso\n ? formatDateIso({ date: isoValue, ...formatProps })\n : isoToDisplay(isoValue);\n }, [value, isIso, granularity, locale, usesLongLocalizedValue]);\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataDateInputComponent = {\n name: 'awsui.DateInput',\n label: 'input',\n properties: {\n value: value || '',\n },\n };\n\n return (\n <MaskedInput\n ref={inputRef}\n {...props}\n value={displayedValue}\n onChange={onInputChange}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n className={clsx(styles.root, props.className)}\n mask={generateMaskArgs({ granularity, isIso })}\n autofix={!usesLongLocalizedValue}\n disableAutocompleteOnBlur={false}\n disableBrowserAutocorrect={true}\n showUnmaskedValue={usesLongLocalizedValue}\n autoComplete={false}\n __internalRootRef={__internalRootRef}\n {...(__injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })\n : {})}\n />\n );\n }\n);\n\nexport default InternalDateInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/internal.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EACR,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-dropzone/internal.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,GAAG,SAAS,EACb,EAAE,iBAAiB,GAAG,0BAA0B,eA0ChD"}
|
|
@@ -7,7 +7,7 @@ import { getBaseProps } from '../internal/base-component';
|
|
|
7
7
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
8
8
|
import styles from './styles.css.js';
|
|
9
9
|
export default function InternalFileDropzone(_a) {
|
|
10
|
-
var { onChange, children, __internalRootRef
|
|
10
|
+
var { onChange, children, __internalRootRef } = _a, restProps = __rest(_a, ["onChange", "children", "__internalRootRef"]);
|
|
11
11
|
const [isDropzoneHovered, setDropzoneHovered] = useState(false);
|
|
12
12
|
const baseProps = getBaseProps(restProps);
|
|
13
13
|
const onDragOver = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-dropzone/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AA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,CAAC;QAC1B,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;SACxC;IACH,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAE,EAAE;QACxC,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAE1B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEF,OAAO,CACL,6CACM,SAAS,IACb,GAAG,EAAE,iBAAiB,EACtB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE;YAChD,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB;SACpC,CAAC,EACF,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM;QAEd,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CAC5C,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { FileDropzoneProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport default function InternalFileDropzone({\n onChange,\n children,\n __internalRootRef,\n ...restProps\n}: FileDropzoneProps & InternalBaseComponentProps) {\n const [isDropzoneHovered, setDropzoneHovered] = useState(false);\n const baseProps = getBaseProps(restProps);\n\n const onDragOver = (event: React.DragEvent) => {\n event.preventDefault();\n\n if (event.dataTransfer) {\n setDropzoneHovered(true);\n event.dataTransfer.dropEffect = 'copy';\n }\n };\n\n const onDragLeave = (event: React.DragEvent) => {\n event.preventDefault();\n setDropzoneHovered(false);\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = 'none';\n }\n };\n\n const onDrop = (event: React.DragEvent) => {\n event.preventDefault();\n setDropzoneHovered(false);\n\n fireNonCancelableEvent(onChange, { value: Array.from(event.dataTransfer.files) });\n };\n\n return (\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(baseProps.className, styles.root, {\n [styles.hovered]: isDropzoneHovered,\n })}\n onDragOver={onDragOver}\n onDragLeave={onDragLeave}\n onDrop={onDrop}\n >\n <div className={styles.content}>{children}</div>\n </div>\n );\n}\n"]}
|
|
@@ -6,6 +6,6 @@ interface InternalFileInputProps {
|
|
|
6
6
|
__inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;
|
|
7
7
|
__injectAnalyticsComponentMetadata?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const InternalFileInput: React.ForwardRefExoticComponent<FileInputProps & InternalBaseComponentProps
|
|
9
|
+
declare const InternalFileInput: React.ForwardRefExoticComponent<FileInputProps & InternalBaseComponentProps & InternalFileInputProps & React.RefAttributes<FileInputProps.Ref>>;
|
|
10
10
|
export default InternalFileInput;
|
|
11
11
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAiB7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IACzG,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAiB7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IACzG,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,iBAAiB,iJAwItB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -17,7 +17,7 @@ import { joinStrings } from '../internal/utils/strings';
|
|
|
17
17
|
import styles from './styles.css.js';
|
|
18
18
|
const InternalFileInput = React.forwardRef((_a, ref) => {
|
|
19
19
|
var _b;
|
|
20
|
-
var { accept, ariaRequired, ariaLabel, multiple = false, value, onChange, variant = 'button', children, __internalRootRef
|
|
20
|
+
var { accept, ariaRequired, ariaLabel, multiple = false, value, onChange, variant = 'button', children, __internalRootRef, __inputClassName, __inputNativeAttributes, __injectAnalyticsComponentMetadata } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "ariaLabel", "multiple", "value", "onChange", "variant", "children", "__internalRootRef", "__inputClassName", "__inputNativeAttributes", "__injectAnalyticsComponentMetadata"]);
|
|
21
21
|
const baseProps = getBaseProps(restProps);
|
|
22
22
|
const uploadInputRef = useRef(null);
|
|
23
23
|
const containerRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
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,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAClB;QAGjB,oBAAC,gBAAgB,IAAC,EAAE,EAAE,mBAAmB,IAAG,SAAS,IAAI,QAAQ,CAAoB,CACjF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalButton from '../button/internal';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { joinStrings } from '../internal/utils/strings';\nimport { GeneratedAnalyticsMetadataFileInputComponent } from './analytics-metadata/interfaces';\nimport { FileInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalFileInputProps {\n __inputClassName?: string;\n __inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalFileInput = React.forwardRef(\n (\n {\n accept,\n ariaRequired,\n ariaLabel,\n multiple = false,\n value,\n onChange,\n variant = 'button',\n children,\n __internalRootRef = null,\n __inputClassName,\n __inputNativeAttributes,\n __injectAnalyticsComponentMetadata,\n ...restProps\n }: FileInputProps & InternalBaseComponentProps & InternalFileInputProps,\n ref: Ref<FileInputProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const uploadInputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRefs(__internalRootRef, containerRef);\n\n const uploadButtonLabelId = useUniqueId('upload-button-label');\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('upload-input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n useForwardFocus(ref, uploadInputRef);\n\n const [isFocused, setIsFocused] = useState(false);\n const onUploadButtonClick = () => uploadInputRef.current?.click();\n const onUploadInputFocus = () => {\n setIsFocused(true);\n containerRef.current?.scrollIntoView?.();\n };\n const onUploadInputBlur = () => setIsFocused(false);\n\n const onUploadInputChange = ({ target }: ChangeEvent<HTMLInputElement>) => {\n fireNonCancelableEvent(onChange, { value: target.files ? Array.from(target.files) : [] });\n };\n\n checkControlled('FileInput', 'value', value, 'onChange', onChange);\n\n const nativeAttributes: React.HTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel || children,\n 'aria-labelledby': joinStrings(formFieldContext.ariaLabelledby, uploadButtonLabelId),\n 'aria-describedby': formFieldContext.ariaDescribedby,\n ...__inputNativeAttributes,\n };\n if (formFieldContext.invalid) {\n nativeAttributes['aria-invalid'] = true;\n }\n if (ariaRequired) {\n nativeAttributes['aria-required'] = true;\n }\n\n if (variant === 'icon' && !ariaLabel) {\n warnOnce('FileInput', 'Aria label is required with icon variant.');\n }\n\n // Synchronizing component's value with the native file input state.\n useEffect(() => {\n /* istanbul ignore next: The DataTransfer is not available in jsdom. */\n if (window.DataTransfer) {\n const dataTransfer = new DataTransfer();\n for (const file of value) {\n dataTransfer.items.add(file);\n }\n uploadInputRef.current!.files = dataTransfer.files;\n }\n if (uploadInputRef.current) {\n uploadInputRef.current.value = ''; // reset value to allow calling onChange when the same file is uploaded again\n }\n }, [value]);\n\n const { tabIndex } = useSingleTabStopNavigation(uploadInputRef);\n\n const analyticsLabel = variant === 'button' && children ? 'button' : 'input';\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataFileInputComponent = {\n name: 'awsui.FileInput',\n label: analyticsLabel,\n };\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = { detail: { label: analyticsLabel } };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = componentAnalyticsMetadata;\n }\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(baseProps.className, styles.root)}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n {/* This is the actual interactive and accessible file-upload element. */}\n {/* It is visually hidden to achieve the desired UX design. */}\n <input\n id={controlId}\n ref={uploadInputRef}\n type=\"file\"\n hidden={false}\n multiple={multiple}\n accept={accept}\n onChange={onUploadInputChange}\n onFocus={onUploadInputFocus}\n onBlur={onUploadInputBlur}\n className={clsx(styles['file-input'], styles.hidden, __inputClassName)}\n tabIndex={tabIndex}\n {...nativeAttributes}\n />\n\n {/* The button is decorative. It dispatches clicks to the file input and is ARIA-hidden. */}\n {/* When the input is focused the focus outline is forced on the button. */}\n <InternalButton\n iconName=\"upload\"\n variant={variant === 'icon' ? 'icon' : undefined}\n formAction=\"none\"\n onClick={onUploadButtonClick}\n className={clsx(styles['file-input-button'], {\n [styles['force-focus-outline-button']]: isFocused && variant === 'button',\n [styles['force-focus-outline-icon']]: isFocused && variant === 'icon',\n })}\n nativeButtonAttributes={{ tabIndex: -1, 'aria-hidden': true }}\n __skipNativeAttributesWarnings={true}\n >\n {variant === 'button' && children}\n </InternalButton>\n\n {/* The file input needs to be labelled with provided content. Can't use the button because it is ARIA-hidden. */}\n <ScreenreaderOnly id={uploadButtonLabelId}>{ariaLabel || children}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalFileInput;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OA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CACjF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalButton from '../button/internal';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { joinStrings } from '../internal/utils/strings';\nimport { GeneratedAnalyticsMetadataFileInputComponent } from './analytics-metadata/interfaces';\nimport { FileInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalFileInputProps {\n __inputClassName?: string;\n __inputNativeAttributes?: React.InputHTMLAttributes<HTMLInputElement> | Record<`data-${string}`, string>;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalFileInput = React.forwardRef(\n (\n {\n accept,\n ariaRequired,\n ariaLabel,\n multiple = false,\n value,\n onChange,\n variant = 'button',\n children,\n __internalRootRef,\n __inputClassName,\n __inputNativeAttributes,\n __injectAnalyticsComponentMetadata,\n ...restProps\n }: FileInputProps & InternalBaseComponentProps & InternalFileInputProps,\n ref: Ref<FileInputProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const uploadInputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRefs(__internalRootRef, containerRef);\n\n const uploadButtonLabelId = useUniqueId('upload-button-label');\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('upload-input');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n useForwardFocus(ref, uploadInputRef);\n\n const [isFocused, setIsFocused] = useState(false);\n const onUploadButtonClick = () => uploadInputRef.current?.click();\n const onUploadInputFocus = () => {\n setIsFocused(true);\n containerRef.current?.scrollIntoView?.();\n };\n const onUploadInputBlur = () => setIsFocused(false);\n\n const onUploadInputChange = ({ target }: ChangeEvent<HTMLInputElement>) => {\n fireNonCancelableEvent(onChange, { value: target.files ? Array.from(target.files) : [] });\n };\n\n checkControlled('FileInput', 'value', value, 'onChange', onChange);\n\n const nativeAttributes: React.HTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel || children,\n 'aria-labelledby': joinStrings(formFieldContext.ariaLabelledby, uploadButtonLabelId),\n 'aria-describedby': formFieldContext.ariaDescribedby,\n ...__inputNativeAttributes,\n };\n if (formFieldContext.invalid) {\n nativeAttributes['aria-invalid'] = true;\n }\n if (ariaRequired) {\n nativeAttributes['aria-required'] = true;\n }\n\n if (variant === 'icon' && !ariaLabel) {\n warnOnce('FileInput', 'Aria label is required with icon variant.');\n }\n\n // Synchronizing component's value with the native file input state.\n useEffect(() => {\n /* istanbul ignore next: The DataTransfer is not available in jsdom. */\n if (window.DataTransfer) {\n const dataTransfer = new DataTransfer();\n for (const file of value) {\n dataTransfer.items.add(file);\n }\n uploadInputRef.current!.files = dataTransfer.files;\n }\n if (uploadInputRef.current) {\n uploadInputRef.current.value = ''; // reset value to allow calling onChange when the same file is uploaded again\n }\n }, [value]);\n\n const { tabIndex } = useSingleTabStopNavigation(uploadInputRef);\n\n const analyticsLabel = variant === 'button' && children ? 'button' : 'input';\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataFileInputComponent = {\n name: 'awsui.FileInput',\n label: analyticsLabel,\n };\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = { detail: { label: analyticsLabel } };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = componentAnalyticsMetadata;\n }\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(baseProps.className, styles.root)}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n >\n {/* This is the actual interactive and accessible file-upload element. */}\n {/* It is visually hidden to achieve the desired UX design. */}\n <input\n id={controlId}\n ref={uploadInputRef}\n type=\"file\"\n hidden={false}\n multiple={multiple}\n accept={accept}\n onChange={onUploadInputChange}\n onFocus={onUploadInputFocus}\n onBlur={onUploadInputBlur}\n className={clsx(styles['file-input'], styles.hidden, __inputClassName)}\n tabIndex={tabIndex}\n {...nativeAttributes}\n />\n\n {/* The button is decorative. It dispatches clicks to the file input and is ARIA-hidden. */}\n {/* When the input is focused the focus outline is forced on the button. */}\n <InternalButton\n iconName=\"upload\"\n variant={variant === 'icon' ? 'icon' : undefined}\n formAction=\"none\"\n onClick={onUploadButtonClick}\n className={clsx(styles['file-input-button'], {\n [styles['force-focus-outline-button']]: isFocused && variant === 'button',\n [styles['force-focus-outline-icon']]: isFocused && variant === 'icon',\n })}\n nativeButtonAttributes={{ tabIndex: -1, 'aria-hidden': true }}\n __skipNativeAttributesWarnings={true}\n >\n {variant === 'button' && children}\n </InternalButton>\n\n {/* The file input needs to be labelled with provided content. Can't use the button because it is ARIA-hidden. */}\n <ScreenreaderOnly id={uploadButtonLabelId}>{ariaLabel || children}</ScreenreaderOnly>\n </div>\n );\n }\n);\n\nexport default InternalFileInput;\n"]}
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { ButtonProps } from '../button/interfaces';
|
|
3
3
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
4
4
|
import { FileUploadProps } from './interfaces';
|
|
5
|
-
declare const _default: React.ForwardRefExoticComponent<FileUploadProps & InternalBaseComponentProps
|
|
5
|
+
declare const _default: React.ForwardRefExoticComponent<FileUploadProps & InternalBaseComponentProps & React.RefAttributes<ButtonProps.Ref>>;
|
|
6
6
|
export default _default;
|
|
7
7
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -24,7 +24,7 @@ import styles from './styles.css.js';
|
|
|
24
24
|
export default React.forwardRef(InternalFileUpload);
|
|
25
25
|
function InternalFileUpload(_a, externalRef) {
|
|
26
26
|
var _b, _c, _d;
|
|
27
|
-
var { accept, ariaRequired, multiple = false, onChange, value, tokenLimit, showFileSize, showFileLastModified, showFileThumbnail, i18nStrings, __internalRootRef
|
|
27
|
+
var { accept, ariaRequired, multiple = false, onChange, value, tokenLimit, showFileSize, showFileLastModified, showFileThumbnail, i18nStrings, __internalRootRef, constraintText, errorText, warningText, fileErrors, fileWarnings, fileTokenAlignment = 'vertical' } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "multiple", "onChange", "value", "tokenLimit", "showFileSize", "showFileLastModified", "showFileThumbnail", "i18nStrings", "__internalRootRef", "constraintText", "errorText", "warningText", "fileErrors", "fileWarnings", "fileTokenAlignment"]);
|
|
28
28
|
const [nextFocusIndex, setNextFocusIndex] = useState(null);
|
|
29
29
|
const tokenListRef = useListFocusController({
|
|
30
30
|
nextFocusIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEpG,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,O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AAC,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,CAAC,CAC5D;gBACD,cAAc,EAAE,IAAI,CAAC,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAC;gBAC/E,aAAa,EAAE,IAAI,CAAC,2BAA2B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa,CAAC;gBAC5E,cAAc,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc;gBAC3C,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB;gBAC3D,kBAAkB,EAAE,IAAI,CAAC,gCAAgC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,CAAC;gBAC3F,oBAAoB,EAAE,IAAI,CAAC,kCAAkC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,CAAC;aAClG,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GACxD,CACH,CAAC,CAAC,CAAC,IAAI,CACa,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ForwardedRef, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport InternalFileDropzone from '../file-dropzone/internal';\nimport { useFilesDragging } from '../file-dropzone/use-files-dragging';\nimport InternalFileInput from '../file-input/internal';\nimport InternalFileTokenGroup from '../file-token-group/internal';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FileUploadProps } from './interfaces';\n\nimport fileInputStyles from '../file-input/styles.css.js';\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalFileUploadProps = FileUploadProps & InternalBaseComponentProps;\n\nexport default React.forwardRef(InternalFileUpload);\n\nfunction InternalFileUpload(\n {\n accept,\n ariaRequired,\n multiple = false,\n onChange,\n value,\n tokenLimit,\n showFileSize,\n showFileLastModified,\n showFileThumbnail,\n i18nStrings,\n __internalRootRef = null,\n constraintText,\n errorText,\n warningText,\n fileErrors,\n fileWarnings,\n fileTokenAlignment = 'vertical',\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\n) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${fileInputStyles['file-input']}`,\n });\n\n const i18n = useInternalI18n('file-upload');\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\n\n checkControlled('FileUpload', 'value', value, 'onChange', onChange);\n\n if (!multiple && value.length > 1) {\n warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');\n }\n\n const handleFilesChange = (newFiles: File[]) => {\n const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles.slice(0, 1) : [...value];\n fireNonCancelableEvent(onChange, { value: newValue });\n };\n\n const onFileRemove = (removeFileIndex: number) => {\n const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);\n fireNonCancelableEvent(onChange, { value: newValue });\n setNextFocusIndex(removeFileIndex);\n };\n\n const { areFilesDragging } = useFilesDragging();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : undefined,\n constraintText ? constraintTextId : undefined\n );\n\n const hasError = Boolean(errorText || fileErrors?.filter(Boolean).length);\n const invalid = restProps.invalid || formFieldContext.invalid || hasError;\n\n return (\n <InternalSpaceBetween\n {...baseProps}\n size=\"xs\"\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n ref={tokenListRef}\n >\n <InternalBox>\n {areFilesDragging ? (\n <InternalFileDropzone onChange={event => handleFilesChange(event.detail.value)}>\n {i18n('i18nStrings.dropzoneText', i18nStrings?.dropzoneText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileDropzone>\n ) : (\n <InternalFileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={event => handleFilesChange(event.detail.value)}\n value={value}\n ariaLabelledby={restProps.ariaLabelledby}\n controlId={restProps.controlId}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18n('i18nStrings.uploadButtonText', i18nStrings?.uploadButtonText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError\n id={errorId}\n errorIconAriaLabel={i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel)}\n >\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning\n id={warningId}\n warningIconAriaLabel={i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel)}\n >\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {value.length > 0 ? (\n <InternalFileTokenGroup\n limit={tokenLimit}\n alignment={fileTokenAlignment}\n items={value.map((file, fileIndex) => ({\n file,\n errorText: fileErrors?.[fileIndex],\n warningText: fileWarnings?.[fileIndex],\n }))}\n showFileLastModified={metadata.showFileLastModified}\n showFileSize={metadata.showFileSize}\n showFileThumbnail={metadata.showFileThumbnail}\n i18nStrings={{\n removeFileAriaLabel: i18n(\n 'i18nStrings.removeFileAriaLabel',\n i18nStrings?.removeFileAriaLabel,\n format => fileIndex => format({ fileIndex: fileIndex + 1 })\n ),\n limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings?.limitShowFewer),\n limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings?.limitShowMore),\n formatFileSize: i18nStrings?.formatFileSize,\n formatFileLastModified: i18nStrings?.formatFileLastModified,\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n }}\n onDismiss={event => onFileRemove(event.detail.fileIndex)}\n />\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OA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B,EACnD,YAAY,EAAE,QAAQ,CAAC,YAAY,EACnC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,EAC7C,WAAW,EAAE;gBACX,mBAAmB,EAAE,IAAI,CACvB,iCAAiC,EACjC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,mBAAmB,EAChC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,CAAC,CAC5D;gBACD,cAAc,EAAE,IAAI,CAAC,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAC;gBAC/E,aAAa,EAAE,IAAI,CAAC,2BAA2B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa,CAAC;gBAC5E,cAAc,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc;gBAC3C,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB;gBAC3D,kBAAkB,EAAE,IAAI,CAAC,gCAAgC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,CAAC;gBAC3F,oBAAoB,EAAE,IAAI,CAAC,kCAAkC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,CAAC;aAClG,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GACxD,CACH,CAAC,CAAC,CAAC,IAAI,CACa,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ForwardedRef, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport InternalFileDropzone from '../file-dropzone/internal';\nimport { useFilesDragging } from '../file-dropzone/use-files-dragging';\nimport InternalFileInput from '../file-input/internal';\nimport InternalFileTokenGroup from '../file-token-group/internal';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FileUploadProps } from './interfaces';\n\nimport fileInputStyles from '../file-input/styles.css.js';\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalFileUploadProps = FileUploadProps & InternalBaseComponentProps;\n\nexport default React.forwardRef(InternalFileUpload);\n\nfunction InternalFileUpload(\n {\n accept,\n ariaRequired,\n multiple = false,\n onChange,\n value,\n tokenLimit,\n showFileSize,\n showFileLastModified,\n showFileThumbnail,\n i18nStrings,\n __internalRootRef,\n constraintText,\n errorText,\n warningText,\n fileErrors,\n fileWarnings,\n fileTokenAlignment = 'vertical',\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\n) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${fileInputStyles['file-input']}`,\n });\n\n const i18n = useInternalI18n('file-upload');\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\n\n checkControlled('FileUpload', 'value', value, 'onChange', onChange);\n\n if (!multiple && value.length > 1) {\n warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');\n }\n\n const handleFilesChange = (newFiles: File[]) => {\n const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles.slice(0, 1) : [...value];\n fireNonCancelableEvent(onChange, { value: newValue });\n };\n\n const onFileRemove = (removeFileIndex: number) => {\n const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);\n fireNonCancelableEvent(onChange, { value: newValue });\n setNextFocusIndex(removeFileIndex);\n };\n\n const { areFilesDragging } = useFilesDragging();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : undefined,\n constraintText ? constraintTextId : undefined\n );\n\n const hasError = Boolean(errorText || fileErrors?.filter(Boolean).length);\n const invalid = restProps.invalid || formFieldContext.invalid || hasError;\n\n return (\n <InternalSpaceBetween\n {...baseProps}\n size=\"xs\"\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n ref={tokenListRef}\n >\n <InternalBox>\n {areFilesDragging ? (\n <InternalFileDropzone onChange={event => handleFilesChange(event.detail.value)}>\n {i18n('i18nStrings.dropzoneText', i18nStrings?.dropzoneText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileDropzone>\n ) : (\n <InternalFileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={event => handleFilesChange(event.detail.value)}\n value={value}\n ariaLabelledby={restProps.ariaLabelledby}\n controlId={restProps.controlId}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18n('i18nStrings.uploadButtonText', i18nStrings?.uploadButtonText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError\n id={errorId}\n errorIconAriaLabel={i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel)}\n >\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning\n id={warningId}\n warningIconAriaLabel={i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel)}\n >\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {value.length > 0 ? (\n <InternalFileTokenGroup\n limit={tokenLimit}\n alignment={fileTokenAlignment}\n items={value.map((file, fileIndex) => ({\n file,\n errorText: fileErrors?.[fileIndex],\n warningText: fileWarnings?.[fileIndex],\n }))}\n showFileLastModified={metadata.showFileLastModified}\n showFileSize={metadata.showFileSize}\n showFileThumbnail={metadata.showFileThumbnail}\n i18nStrings={{\n removeFileAriaLabel: i18n(\n 'i18nStrings.removeFileAriaLabel',\n i18nStrings?.removeFileAriaLabel,\n format => fileIndex => format({ fileIndex: fileIndex + 1 })\n ),\n limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings?.limitShowFewer),\n limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings?.limitShowMore),\n formatFileSize: i18nStrings?.formatFileSize,\n formatFileLastModified: i18nStrings?.formatFileLastModified,\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n }}\n onDismiss={event => onFileRemove(event.detail.fileIndex)}\n />\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"flash-with-motion": "awsui_flash-with-
|
|
5
|
-
"enter": "
|
|
6
|
-
"flash-body": "awsui_flash-
|
|
7
|
-
"flash-message": "awsui_flash-
|
|
8
|
-
"flash-header": "awsui_flash-
|
|
9
|
-
"flash-content": "awsui_flash-
|
|
10
|
-
"action-button-wrapper": "awsui_action-button-
|
|
11
|
-
"dismiss-button-wrapper": "awsui_dismiss-button-
|
|
12
|
-
"flash-icon": "awsui_flash-
|
|
13
|
-
"entering": "
|
|
14
|
-
"entered": "
|
|
15
|
-
"exiting": "
|
|
16
|
-
"stack": "
|
|
17
|
-
"animation-running": "awsui_animation-
|
|
18
|
-
"item": "
|
|
19
|
-
"flash-list-item": "awsui_flash-list-
|
|
20
|
-
"notification-bar": "awsui_notification-
|
|
21
|
-
"collapsed": "
|
|
22
|
-
"animation-ready": "awsui_animation-
|
|
23
|
-
"expanded-only": "awsui_expanded-
|
|
24
|
-
"expanded": "
|
|
25
|
-
"flash": "
|
|
26
|
-
"collapsible": "
|
|
27
|
-
"short-list": "awsui_short-
|
|
28
|
-
"visual-refresh": "awsui_visual-
|
|
29
|
-
"status": "
|
|
30
|
-
"header": "
|
|
31
|
-
"item-count": "awsui_item-
|
|
32
|
-
"button": "
|
|
33
|
-
"type-count": "awsui_type-
|
|
34
|
-
"count-number": "awsui_count-
|
|
35
|
-
"icon": "
|
|
36
|
-
"floating": "
|
|
37
|
-
"flashbar": "
|
|
38
|
-
"initial-hidden": "awsui_initial-
|
|
39
|
-
"flash-list": "awsui_flash-
|
|
40
|
-
"flash-focus-container": "awsui_flash-focus-
|
|
41
|
-
"flash-text": "awsui_flash-
|
|
42
|
-
"hidden": "
|
|
43
|
-
"header-replacement": "awsui_header-
|
|
44
|
-
"content-replacement": "awsui_content-
|
|
45
|
-
"dismiss-button": "awsui_dismiss-
|
|
46
|
-
"action-wrapped": "awsui_action-
|
|
47
|
-
"action-button": "awsui_action-
|
|
48
|
-
"action-slot": "awsui_action-
|
|
49
|
-
"flash-type-success": "awsui_flash-type-
|
|
50
|
-
"flash-type-error": "awsui_flash-type-
|
|
51
|
-
"flash-type-info": "awsui_flash-type-
|
|
52
|
-
"flash-type-in-progress": "awsui_flash-type-in-
|
|
53
|
-
"flash-type-warning": "awsui_flash-type-
|
|
4
|
+
"flash-with-motion": "awsui_flash-with-motion_1q84n_1fkye_157",
|
|
5
|
+
"enter": "awsui_enter_1q84n_1fkye_157",
|
|
6
|
+
"flash-body": "awsui_flash-body_1q84n_1fkye_171",
|
|
7
|
+
"flash-message": "awsui_flash-message_1q84n_1fkye_171",
|
|
8
|
+
"flash-header": "awsui_flash-header_1q84n_1fkye_171",
|
|
9
|
+
"flash-content": "awsui_flash-content_1q84n_1fkye_172",
|
|
10
|
+
"action-button-wrapper": "awsui_action-button-wrapper_1q84n_1fkye_173",
|
|
11
|
+
"dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_1fkye_174",
|
|
12
|
+
"flash-icon": "awsui_flash-icon_1q84n_1fkye_197",
|
|
13
|
+
"entering": "awsui_entering_1q84n_1fkye_210",
|
|
14
|
+
"entered": "awsui_entered_1q84n_1fkye_231",
|
|
15
|
+
"exiting": "awsui_exiting_1q84n_1fkye_336",
|
|
16
|
+
"stack": "awsui_stack_1q84n_1fkye_370",
|
|
17
|
+
"animation-running": "awsui_animation-running_1q84n_1fkye_370",
|
|
18
|
+
"item": "awsui_item_1q84n_1fkye_370",
|
|
19
|
+
"flash-list-item": "awsui_flash-list-item_1q84n_1fkye_371",
|
|
20
|
+
"notification-bar": "awsui_notification-bar_1q84n_1fkye_372",
|
|
21
|
+
"collapsed": "awsui_collapsed_1q84n_1fkye_392",
|
|
22
|
+
"animation-ready": "awsui_animation-ready_1q84n_1fkye_392",
|
|
23
|
+
"expanded-only": "awsui_expanded-only_1q84n_1fkye_392",
|
|
24
|
+
"expanded": "awsui_expanded_1q84n_1fkye_392",
|
|
25
|
+
"flash": "awsui_flash_1q84n_1fkye_157",
|
|
26
|
+
"collapsible": "awsui_collapsible_1q84n_1fkye_448",
|
|
27
|
+
"short-list": "awsui_short-list_1q84n_1fkye_454",
|
|
28
|
+
"visual-refresh": "awsui_visual-refresh_1q84n_1fkye_454",
|
|
29
|
+
"status": "awsui_status_1q84n_1fkye_601",
|
|
30
|
+
"header": "awsui_header_1q84n_1fkye_601",
|
|
31
|
+
"item-count": "awsui_item-count_1q84n_1fkye_602",
|
|
32
|
+
"button": "awsui_button_1q84n_1fkye_603",
|
|
33
|
+
"type-count": "awsui_type-count_1q84n_1fkye_636",
|
|
34
|
+
"count-number": "awsui_count-number_1q84n_1fkye_636",
|
|
35
|
+
"icon": "awsui_icon_1q84n_1fkye_674",
|
|
36
|
+
"floating": "awsui_floating_1q84n_1fkye_715",
|
|
37
|
+
"flashbar": "awsui_flashbar_1q84n_1fkye_719",
|
|
38
|
+
"initial-hidden": "awsui_initial-hidden_1q84n_1fkye_778",
|
|
39
|
+
"flash-list": "awsui_flash-list_1q84n_1fkye_371",
|
|
40
|
+
"flash-focus-container": "awsui_flash-focus-container_1q84n_1fkye_802",
|
|
41
|
+
"flash-text": "awsui_flash-text_1q84n_1fkye_832",
|
|
42
|
+
"hidden": "awsui_hidden_1q84n_1fkye_851",
|
|
43
|
+
"header-replacement": "awsui_header-replacement_1q84n_1fkye_856",
|
|
44
|
+
"content-replacement": "awsui_content-replacement_1q84n_1fkye_861",
|
|
45
|
+
"dismiss-button": "awsui_dismiss-button_1q84n_1fkye_174",
|
|
46
|
+
"action-wrapped": "awsui_action-wrapped_1q84n_1fkye_879",
|
|
47
|
+
"action-button": "awsui_action-button_1q84n_1fkye_173",
|
|
48
|
+
"action-slot": "awsui_action-slot_1q84n_1fkye_886",
|
|
49
|
+
"flash-type-success": "awsui_flash-type-success_1q84n_1fkye_890",
|
|
50
|
+
"flash-type-error": "awsui_flash-type-error_1q84n_1fkye_894",
|
|
51
|
+
"flash-type-info": "awsui_flash-type-info_1q84n_1fkye_898",
|
|
52
|
+
"flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_1fkye_899",
|
|
53
|
+
"flash-type-warning": "awsui_flash-type-warning_1q84n_1fkye_903"
|
|
54
54
|
};
|
|
55
55
|
|