@cloudscape-design/components 3.0.297 → 3.0.299
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/alert/interfaces.d.ts +1 -0
- package/alert/interfaces.d.ts.map +1 -1
- package/alert/interfaces.js.map +1 -1
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +30 -30
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/interfaces.d.ts +1 -0
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/visual-refresh/background.d.ts +1 -5
- package/app-layout/visual-refresh/background.d.ts.map +1 -1
- package/app-layout/visual-refresh/background.js +8 -13
- package/app-layout/visual-refresh/background.js.map +1 -1
- package/app-layout/visual-refresh/breadcrumbs.d.ts +3 -0
- package/app-layout/visual-refresh/breadcrumbs.d.ts.map +1 -0
- package/app-layout/visual-refresh/breadcrumbs.js +17 -0
- package/app-layout/visual-refresh/breadcrumbs.js.map +1 -0
- package/app-layout/visual-refresh/context.js +3 -3
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/header.d.ts +0 -4
- package/app-layout/visual-refresh/header.d.ts.map +1 -1
- package/app-layout/visual-refresh/header.js +0 -4
- package/app-layout/visual-refresh/header.js.map +1 -1
- package/app-layout/visual-refresh/index.d.ts +0 -8
- package/app-layout/visual-refresh/index.d.ts.map +1 -1
- package/app-layout/visual-refresh/index.js +4 -13
- package/app-layout/visual-refresh/index.js.map +1 -1
- package/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/app-layout/visual-refresh/layout.js +31 -19
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh/main.d.ts.map +1 -1
- package/app-layout/visual-refresh/main.js +2 -6
- package/app-layout/visual-refresh/main.js.map +1 -1
- package/app-layout/visual-refresh/mobile-toolbar.d.ts +3 -0
- package/app-layout/visual-refresh/mobile-toolbar.d.ts.map +1 -0
- package/app-layout/visual-refresh/{app-bar.js → mobile-toolbar.js} +9 -18
- package/app-layout/visual-refresh/mobile-toolbar.js.map +1 -0
- package/app-layout/visual-refresh/navigation.js +1 -1
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/notifications.d.ts +0 -4
- package/app-layout/visual-refresh/notifications.d.ts.map +1 -1
- package/app-layout/visual-refresh/notifications.js +4 -9
- package/app-layout/visual-refresh/notifications.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +1 -1
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +68 -72
- package/app-layout/visual-refresh/styles.scoped.css +400 -576
- package/app-layout/visual-refresh/styles.selectors.js +68 -72
- package/attribute-editor/interfaces.d.ts +2 -1
- package/attribute-editor/interfaces.d.ts.map +1 -1
- package/attribute-editor/interfaces.js.map +1 -1
- package/attribute-editor/row.d.ts +1 -1
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js +3 -1
- package/attribute-editor/row.js.map +1 -1
- package/autosuggest/autosuggest-option.d.ts +1 -1
- package/autosuggest/autosuggest-option.d.ts.map +1 -1
- package/autosuggest/autosuggest-option.js +3 -1
- package/autosuggest/autosuggest-option.js.map +1 -1
- package/autosuggest/interfaces.d.ts +3 -1
- package/autosuggest/interfaces.d.ts.map +1 -1
- package/autosuggest/interfaces.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +4 -0
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/plain-list.d.ts +1 -1
- package/autosuggest/plain-list.d.ts.map +1 -1
- package/autosuggest/plain-list.js.map +1 -1
- package/breadcrumb-group/interfaces.d.ts +1 -0
- package/breadcrumb-group/interfaces.d.ts.map +1 -1
- package/breadcrumb-group/interfaces.js.map +1 -1
- package/calendar/interfaces.d.ts +3 -0
- package/calendar/interfaces.d.ts.map +1 -1
- package/calendar/interfaces.js.map +1 -1
- package/cards/interfaces.d.ts +1 -0
- package/cards/interfaces.d.ts.map +1 -1
- package/cards/interfaces.js.map +1 -1
- package/cards/styles.css.js +37 -37
- package/cards/styles.scoped.css +53 -53
- package/cards/styles.selectors.js +37 -37
- package/code-editor/interfaces.d.ts +1 -0
- package/code-editor/interfaces.d.ts.map +1 -1
- package/code-editor/interfaces.js.map +1 -1
- package/collection-preferences/content-display/index.d.ts.map +1 -1
- package/collection-preferences/content-display/index.js +14 -9
- package/collection-preferences/content-display/index.js.map +1 -1
- package/collection-preferences/index.d.ts.map +1 -1
- package/collection-preferences/index.js +6 -4
- package/collection-preferences/index.js.map +1 -1
- package/collection-preferences/interfaces.d.ts +21 -12
- package/collection-preferences/interfaces.d.ts.map +1 -1
- package/collection-preferences/interfaces.js.map +1 -1
- package/collection-preferences/utils.d.ts +1 -1
- package/collection-preferences/utils.d.ts.map +1 -1
- package/collection-preferences/utils.js +19 -6
- package/collection-preferences/utils.js.map +1 -1
- package/content-layout/internal.d.ts.map +1 -1
- package/content-layout/internal.js +1 -3
- package/content-layout/internal.js.map +1 -1
- package/content-layout/styles.css.js +6 -7
- package/content-layout/styles.scoped.css +9 -19
- package/content-layout/styles.selectors.js +6 -7
- package/date-range-picker/calendar/grids/grid.d.ts +1 -1
- package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts +1 -1
- package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/header/header-button.d.ts +1 -1
- package/date-range-picker/calendar/header/header-button.d.ts.map +1 -1
- package/date-range-picker/calendar/header/header-button.js.map +1 -1
- package/date-range-picker/calendar/header/index.d.ts +2 -2
- package/date-range-picker/calendar/header/index.d.ts.map +1 -1
- package/date-range-picker/calendar/header/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts +1 -1
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +11 -8
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/range-inputs.d.ts +1 -1
- package/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/date-range-picker/calendar/range-inputs.js +7 -5
- package/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +2 -1
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +7 -5
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +13 -4
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +22 -21
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/mode-switcher.d.ts +1 -1
- package/date-range-picker/mode-switcher.d.ts.map +1 -1
- package/date-range-picker/mode-switcher.js +4 -2
- package/date-range-picker/mode-switcher.js.map +1 -1
- package/date-range-picker/relative-range/index.d.ts +1 -1
- package/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/date-range-picker/relative-range/index.js +14 -10
- package/date-range-picker/relative-range/index.js.map +1 -1
- package/flashbar/interfaces.d.ts +1 -0
- package/flashbar/interfaces.d.ts.map +1 -1
- package/flashbar/interfaces.js.map +1 -1
- package/flashbar/styles.css.js +45 -45
- package/flashbar/styles.scoped.css +169 -169
- package/flashbar/styles.selectors.js +45 -45
- package/form/interfaces.d.ts +1 -0
- package/form/interfaces.d.ts.map +1 -1
- package/form/interfaces.js.map +1 -1
- package/form-field/interfaces.d.ts +1 -0
- package/form-field/interfaces.d.ts.map +1 -1
- package/form-field/interfaces.js.map +1 -1
- package/help-panel/interfaces.d.ts +1 -0
- package/help-panel/interfaces.d.ts.map +1 -1
- package/help-panel/interfaces.js.map +1 -1
- package/i18n/context.d.ts +20 -0
- package/i18n/context.d.ts.map +1 -0
- package/i18n/context.js +17 -0
- package/i18n/context.js.map +1 -0
- package/i18n/index.d.ts +2 -0
- package/i18n/index.d.ts.map +1 -0
- package/i18n/index.js +4 -0
- package/i18n/index.js.map +1 -0
- package/i18n/messages/all.all.d.ts +3 -0
- package/i18n/messages/all.all.js +5473 -0
- package/i18n/messages/all.all.json +5518 -0
- package/i18n/messages/all.de.d.ts +3 -0
- package/i18n/messages/all.de.js +446 -0
- package/i18n/messages/all.de.json +454 -0
- package/i18n/messages/all.en-GB.d.ts +3 -0
- package/i18n/messages/all.en-GB.js +436 -0
- package/i18n/messages/all.en-GB.json +439 -0
- package/i18n/messages/all.en.d.ts +3 -0
- package/i18n/messages/all.en.js +722 -0
- package/i18n/messages/all.en.json +721 -0
- package/i18n/messages/all.es.d.ts +3 -0
- package/i18n/messages/all.es.js +437 -0
- package/i18n/messages/all.es.json +439 -0
- package/i18n/messages/all.fr.d.ts +3 -0
- package/i18n/messages/all.fr.js +451 -0
- package/i18n/messages/all.fr.json +452 -0
- package/i18n/messages/all.id.d.ts +3 -0
- package/i18n/messages/all.id.js +427 -0
- package/i18n/messages/all.id.json +435 -0
- package/i18n/messages/all.it.d.ts +3 -0
- package/i18n/messages/all.it.js +437 -0
- package/i18n/messages/all.it.json +441 -0
- package/i18n/messages/all.ja.d.ts +3 -0
- package/i18n/messages/all.ja.js +441 -0
- package/i18n/messages/all.ja.json +445 -0
- package/i18n/messages/all.ko.d.ts +3 -0
- package/i18n/messages/all.ko.js +419 -0
- package/i18n/messages/all.ko.json +426 -0
- package/i18n/messages/all.pt-BR.d.ts +3 -0
- package/i18n/messages/all.pt-BR.js +444 -0
- package/i18n/messages/all.pt-BR.json +443 -0
- package/i18n/messages/all.zh-CN.d.ts +3 -0
- package/i18n/messages/all.zh-CN.js +429 -0
- package/i18n/messages/all.zh-CN.json +434 -0
- package/i18n/messages/all.zh-TW.d.ts +3 -0
- package/i18n/messages/all.zh-TW.js +428 -0
- package/i18n/messages/all.zh-TW.json +433 -0
- package/i18n/provider.d.ts +20 -0
- package/i18n/provider.d.ts.map +1 -0
- package/i18n/provider.js +105 -0
- package/i18n/provider.js.map +1 -0
- package/i18n/testing.d.ts +8 -0
- package/i18n/testing.d.ts.map +1 -0
- package/i18n/testing.js +8 -0
- package/i18n/testing.js.map +1 -0
- package/input/interfaces.d.ts +1 -0
- package/input/interfaces.d.ts.map +1 -1
- package/input/interfaces.js.map +1 -1
- package/internal/base-component/styles.scoped.css +0 -2
- package/internal/components/dropdown-status/interfaces.d.ts +3 -0
- package/internal/components/dropdown-status/interfaces.d.ts.map +1 -1
- package/internal/components/dropdown-status/interfaces.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +37 -32
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/i18n/context.d.ts +1 -19
- package/internal/i18n/context.d.ts.map +1 -1
- package/internal/i18n/context.js +1 -14
- package/internal/i18n/context.js.map +1 -1
- package/internal/i18n/index.d.ts +1 -1
- package/internal/i18n/index.js +1 -1
- package/internal/i18n/index.js.map +1 -1
- package/internal/i18n/messages/all.all.js +3541 -30
- package/internal/i18n/messages/all.all.json +3599 -52
- package/internal/i18n/messages/all.de.js +280 -1
- package/internal/i18n/messages/all.de.json +290 -3
- package/internal/i18n/messages/all.en-GB.js +270 -1
- package/internal/i18n/messages/all.en-GB.json +275 -3
- package/internal/i18n/messages/all.en.js +556 -1
- package/internal/i18n/messages/all.en.json +558 -4
- package/internal/i18n/messages/all.es.js +271 -1
- package/internal/i18n/messages/all.es.json +275 -3
- package/internal/i18n/messages/all.fr.js +289 -5
- package/internal/i18n/messages/all.fr.json +292 -7
- package/internal/i18n/messages/all.id.js +261 -1
- package/internal/i18n/messages/all.id.json +271 -3
- package/internal/i18n/messages/all.it.js +271 -1
- package/internal/i18n/messages/all.it.json +277 -3
- package/internal/i18n/messages/all.ja.js +267 -1
- package/internal/i18n/messages/all.ja.json +273 -3
- package/internal/i18n/messages/all.ko.js +257 -2
- package/internal/i18n/messages/all.ko.json +263 -4
- package/internal/i18n/messages/all.pt-BR.js +280 -3
- package/internal/i18n/messages/all.pt-BR.json +281 -5
- package/internal/i18n/messages/all.zh-CN.js +272 -9
- package/internal/i18n/messages/all.zh-CN.json +276 -11
- package/internal/i18n/messages/all.zh-TW.js +264 -1
- package/internal/i18n/messages/all.zh-TW.json +268 -3
- package/internal/i18n/provider.d.ts +1 -19
- package/internal/i18n/provider.d.ts.map +1 -1
- package/internal/i18n/provider.js +1 -102
- package/internal/i18n/provider.js.map +1 -1
- package/internal/i18n/testing.d.ts +1 -7
- package/internal/i18n/testing.d.ts.map +1 -1
- package/internal/i18n/testing.js +1 -5
- package/internal/i18n/testing.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/link/interfaces.d.ts +1 -0
- package/link/interfaces.d.ts.map +1 -1
- package/link/interfaces.js.map +1 -1
- package/modal/interfaces.d.ts +1 -0
- package/modal/interfaces.d.ts.map +1 -1
- package/modal/interfaces.js.map +1 -1
- package/multiselect/interfaces.d.ts +1 -0
- package/multiselect/interfaces.d.ts.map +1 -1
- package/multiselect/interfaces.js.map +1 -1
- package/package.json +28 -1
- package/pagination/interfaces.d.ts +1 -0
- package/pagination/interfaces.d.ts.map +1 -1
- package/pagination/interfaces.js.map +1 -1
- package/property-filter/interfaces.d.ts +1 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/s3-resource-selector/interfaces.d.ts +48 -47
- package/s3-resource-selector/interfaces.d.ts.map +1 -1
- package/s3-resource-selector/interfaces.js.map +1 -1
- package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-in-context/index.js +11 -9
- package/s3-resource-selector/s3-in-context/index.js.map +1 -1
- package/s3-resource-selector/s3-in-context/validation.d.ts +2 -1
- package/s3-resource-selector/s3-in-context/validation.d.ts.map +1 -1
- package/s3-resource-selector/s3-in-context/validation.js +2 -2
- package/s3-resource-selector/s3-in-context/validation.js.map +1 -1
- package/s3-resource-selector/s3-modal/basic-table.d.ts +2 -1
- package/s3-resource-selector/s3-modal/basic-table.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/basic-table.js +7 -7
- package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/buckets-table.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/buckets-table.js +10 -7
- package/s3-resource-selector/s3-modal/buckets-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/index.js +8 -6
- package/s3-resource-selector/s3-modal/index.js.map +1 -1
- package/s3-resource-selector/s3-modal/objects-table.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/objects-table.js +10 -7
- package/s3-resource-selector/s3-modal/objects-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/table-utils.d.ts +2 -1
- package/s3-resource-selector/s3-modal/table-utils.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/table-utils.js +5 -9
- package/s3-resource-selector/s3-modal/table-utils.js.map +1 -1
- package/s3-resource-selector/s3-modal/versions-table.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/versions-table.js +10 -7
- package/s3-resource-selector/s3-modal/versions-table.js.map +1 -1
- package/select/interfaces.d.ts +2 -0
- package/select/interfaces.d.ts.map +1 -1
- package/select/interfaces.js.map +1 -1
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +16 -13
- package/split-panel/index.js.map +1 -1
- package/split-panel/interfaces.d.ts +4 -3
- package/split-panel/interfaces.d.ts.map +1 -1
- package/split-panel/interfaces.js.map +1 -1
- package/split-panel/side.d.ts +3 -3
- package/split-panel/side.d.ts.map +1 -1
- package/split-panel/side.js +2 -2
- package/split-panel/side.js.map +1 -1
- package/table/body-cell/index.d.ts.map +1 -1
- package/table/body-cell/index.js +3 -1
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/inline-editor.d.ts.map +1 -1
- package/table/body-cell/inline-editor.js +5 -1
- package/table/body-cell/inline-editor.js.map +1 -1
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +3 -1
- package/table/header-cell/index.js.map +1 -1
- package/table/interfaces.d.ts +2 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/styles.css.js +36 -35
- package/table/styles.scoped.css +46 -43
- package/table/styles.selectors.js +36 -35
- package/tabs/interfaces.d.ts +1 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tag-editor/index.d.ts.map +1 -1
- package/tag-editor/index.js +19 -16
- package/tag-editor/index.js.map +1 -1
- package/tag-editor/interfaces.d.ts +33 -32
- package/tag-editor/interfaces.d.ts.map +1 -1
- package/tag-editor/interfaces.js.map +1 -1
- package/tag-editor/internal.d.ts +6 -6
- package/tag-editor/internal.d.ts.map +1 -1
- package/tag-editor/internal.js.map +1 -1
- package/tag-editor/validation.d.ts +2 -1
- package/tag-editor/validation.d.ts.map +1 -1
- package/tag-editor/validation.js +8 -8
- package/tag-editor/validation.js.map +1 -1
- package/token-group/interfaces.d.ts +1 -0
- package/token-group/interfaces.d.ts.map +1 -1
- package/token-group/interfaces.js.map +1 -1
- package/top-navigation/interfaces.d.ts +4 -3
- package/top-navigation/interfaces.d.ts.map +1 -1
- package/top-navigation/interfaces.js.map +1 -1
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js +6 -4
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/parts/overflow-menu/index.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/index.js +6 -2
- package/top-navigation/parts/overflow-menu/index.js.map +1 -1
- package/wizard/interfaces.d.ts +1 -0
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/styles.css.js +31 -32
- package/wizard/styles.scoped.css +64 -67
- package/wizard/styles.selectors.js +31 -32
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +1 -1
- package/wizard/wizard-form.js.map +1 -1
- package/app-layout/visual-refresh/app-bar.d.ts +0 -7
- package/app-layout/visual-refresh/app-bar.d.ts.map +0 -1
- package/app-layout/visual-refresh/app-bar.js.map +0 -1
|
@@ -12,6 +12,7 @@ import { ObjectsTable } from './objects-table';
|
|
|
12
12
|
import { VersionsTable } from './versions-table';
|
|
13
13
|
import styles from './styles.css.js';
|
|
14
14
|
import { joinObjectPath } from '../utils';
|
|
15
|
+
import { useInternalI18n } from '../../internal/i18n/context';
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
17
|
function assertNever(_value) {
|
|
17
18
|
return null;
|
|
@@ -52,25 +53,26 @@ function createResourceInfo({ currentView, breadcrumbs, selectedItem }) {
|
|
|
52
53
|
return { uri: prefix + joinObjectPath([...breadcrumbs, selectedItem]) };
|
|
53
54
|
}
|
|
54
55
|
export function S3Modal({ i18nStrings, alert, selectableItemsTypes, fetchBuckets, bucketsVisibleColumns, bucketsIsItemDisabled, fetchObjects, objectsVisibleColumns, objectsIsItemDisabled, fetchVersions, versionsVisibleColumns, versionsIsItemDisabled, onSubmit, onDismiss, }) {
|
|
55
|
-
var _a
|
|
56
|
+
var _a;
|
|
56
57
|
const [{ currentView, breadcrumbs, selectedItem }, dispatch] = useReducer(s3BrowseReducer, initialBrowseState);
|
|
57
58
|
const forwardFocusRef = useRef(null);
|
|
59
|
+
const i18n = useInternalI18n('s3-resource-selector');
|
|
58
60
|
const isVisualRefresh = useVisualRefresh();
|
|
59
61
|
useEffectOnUpdate(() => {
|
|
60
62
|
var _a;
|
|
61
63
|
(_a = forwardFocusRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
62
64
|
}, [breadcrumbs]);
|
|
63
65
|
return (React.createElement("div", null,
|
|
64
|
-
React.createElement(InternalModal, { visible: true, size: "max", closeAriaLabel:
|
|
65
|
-
React.createElement(InternalButton, { variant: "link", formAction: "none", onClick: onDismiss }, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalCancelButton),
|
|
66
|
-
React.createElement(InternalButton, { variant: "primary", className: styles['submit-button'], disabled: !selectedItem, formAction: "none", onClick: () => onSubmit(createResourceInfo({ currentView, breadcrumbs, selectedItem })) }, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalSubmitButton)) },
|
|
66
|
+
React.createElement(InternalModal, { visible: true, size: "max", closeAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelModalDismiss, onDismiss: onDismiss, header: i18n('i18nStrings.modalTitle', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalTitle), footer: React.createElement(InternalSpaceBetween, { className: styles['modal-actions'], size: "xs", direction: "horizontal" },
|
|
67
|
+
React.createElement(InternalButton, { variant: "link", formAction: "none", onClick: onDismiss }, i18n('i18nStrings.modalCancelButton', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalCancelButton)),
|
|
68
|
+
React.createElement(InternalButton, { variant: "primary", className: styles['submit-button'], disabled: !selectedItem, formAction: "none", onClick: () => onSubmit(createResourceInfo({ currentView, breadcrumbs, selectedItem })) }, i18n('i18nStrings.modalSubmitButton', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalSubmitButton))) },
|
|
67
69
|
React.createElement(InternalSpaceBetween, { size: isVisualRefresh ? 'xxs' : 'xs' },
|
|
68
|
-
React.createElement(InternalBreadcrumbGroup, { ariaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelBreadcrumbs, expandAriaLabel: "Show path", onFollow: event => {
|
|
70
|
+
React.createElement(InternalBreadcrumbGroup, { ariaLabel: i18n('i18nStrings.labelBreadcrumbs', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelBreadcrumbs), expandAriaLabel: "Show path", onFollow: event => {
|
|
69
71
|
event.preventDefault();
|
|
70
72
|
event.detail.item.meta.onClick();
|
|
71
73
|
}, items: [
|
|
72
74
|
{
|
|
73
|
-
text: (
|
|
75
|
+
text: (_a = i18n('i18nStrings.modalBreadcrumbRootItem', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.modalBreadcrumbRootItem)) !== null && _a !== void 0 ? _a : '',
|
|
74
76
|
href: '',
|
|
75
77
|
meta: { onClick: () => dispatch({ type: 'browse-buckets' }) },
|
|
76
78
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,uBAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAmB1C,6DAA6D;AAC7D,SAAS,WAAW,CAAC,MAAa;IAChC,OAAO,IAAI,CAAC;AACd,CAAC;AAaD,MAAM,kBAAkB,GAAkB;IACxC,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,EAAE;CAChB,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C,CACzB,CACoB,CACT,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useReducer, useRef } from 'react';\nimport InternalBreadcrumbGroup from '../../breadcrumb-group/internal';\nimport { InternalButton } from '../../button/internal';\nimport InternalModal from '../../modal/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport { ForwardFocusRef } from '../../internal/hooks/forward-focus';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\nimport { S3ResourceSelectorProps } from '../interfaces';\nimport { BucketsTable } from './buckets-table';\nimport { ObjectsTable } from './objects-table';\nimport { VersionsTable } from './versions-table';\nimport styles from './styles.css.js';\nimport { joinObjectPath } from '../utils';\n\nexport interface S3ModalProps {\n alert: React.ReactNode;\n selectableItemsTypes: S3ResourceSelectorProps['selectableItemsTypes'];\n fetchBuckets: S3ResourceSelectorProps['fetchBuckets'];\n bucketsVisibleColumns: ReadonlyArray<string>;\n bucketsIsItemDisabled: S3ResourceSelectorProps['bucketsIsItemDisabled'];\n fetchObjects: S3ResourceSelectorProps['fetchObjects'];\n objectsVisibleColumns: ReadonlyArray<string>;\n objectsIsItemDisabled: S3ResourceSelectorProps['objectsIsItemDisabled'];\n fetchVersions: S3ResourceSelectorProps['fetchVersions'];\n versionsVisibleColumns: ReadonlyArray<string>;\n versionsIsItemDisabled: S3ResourceSelectorProps['versionsIsItemDisabled'];\n i18nStrings: S3ResourceSelectorProps.I18nStrings | undefined;\n onDismiss: () => void;\n onSubmit: (resource: S3ResourceSelectorProps.Resource) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction assertNever(_value: never) {\n return null;\n}\n\ninterface S3BrowseState {\n selectedItem: string | null;\n currentView: 'buckets' | 'objects' | 'versions';\n breadcrumbs: ReadonlyArray<string>;\n}\n\ntype S3BrowseActions =\n | { type: 'browse-buckets' }\n | { type: 'browse-objects' | 'browse-versions'; breadcrumbs: S3BrowseState['breadcrumbs'] }\n | { type: 'select-item'; item: string };\n\nconst initialBrowseState: S3BrowseState = {\n selectedItem: null,\n currentView: 'buckets',\n breadcrumbs: [],\n};\n\nfunction s3BrowseReducer(state: S3BrowseState, action: S3BrowseActions) {\n switch (action.type) {\n case 'browse-buckets':\n return initialBrowseState;\n case 'browse-objects':\n return {\n selectedItem: null,\n currentView: 'objects' as const,\n breadcrumbs: action.breadcrumbs,\n };\n case 'browse-versions':\n return {\n selectedItem: null,\n currentView: 'versions' as const,\n breadcrumbs: action.breadcrumbs,\n };\n case 'select-item':\n return {\n ...state,\n selectedItem: action.item,\n };\n default:\n assertNever(action);\n }\n return state;\n}\n\nfunction createResourceInfo({ currentView, breadcrumbs, selectedItem }: S3BrowseState) {\n const prefix = 's3://';\n if (currentView === 'versions') {\n return { uri: prefix + joinObjectPath(breadcrumbs), versionId: selectedItem ?? undefined };\n }\n return { uri: prefix + joinObjectPath([...breadcrumbs, selectedItem!]) };\n}\n\nexport function S3Modal({\n i18nStrings,\n alert,\n selectableItemsTypes,\n fetchBuckets,\n bucketsVisibleColumns,\n bucketsIsItemDisabled,\n fetchObjects,\n objectsVisibleColumns,\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns,\n versionsIsItemDisabled,\n onSubmit,\n onDismiss,\n}: S3ModalProps) {\n const [{ currentView, breadcrumbs, selectedItem }, dispatch] = useReducer(s3BrowseReducer, initialBrowseState);\n const forwardFocusRef = useRef<ForwardFocusRef>(null);\n\n const isVisualRefresh = useVisualRefresh();\n\n useEffectOnUpdate(() => {\n forwardFocusRef.current?.focus();\n }, [breadcrumbs]);\n\n return (\n <div>\n <InternalModal\n visible={true}\n size=\"max\"\n closeAriaLabel={i18nStrings?.labelModalDismiss ?? ''}\n onDismiss={onDismiss}\n header={i18nStrings?.modalTitle}\n footer={\n <InternalSpaceBetween className={styles['modal-actions']} size=\"xs\" direction=\"horizontal\">\n <InternalButton variant=\"link\" formAction=\"none\" onClick={onDismiss}>\n {i18nStrings?.modalCancelButton}\n </InternalButton>\n <InternalButton\n variant=\"primary\"\n className={styles['submit-button']}\n disabled={!selectedItem}\n formAction=\"none\"\n onClick={() => onSubmit(createResourceInfo({ currentView, breadcrumbs, selectedItem }))}\n >\n {i18nStrings?.modalSubmitButton}\n </InternalButton>\n </InternalSpaceBetween>\n }\n >\n <InternalSpaceBetween size={isVisualRefresh ? 'xxs' : 'xs'}>\n <InternalBreadcrumbGroup\n ariaLabel={i18nStrings?.labelBreadcrumbs}\n expandAriaLabel=\"Show path\"\n onFollow={event => {\n event.preventDefault();\n event.detail.item.meta.onClick();\n }}\n items={[\n {\n text: i18nStrings?.modalBreadcrumbRootItem ?? '',\n href: '',\n meta: { onClick: () => dispatch({ type: 'browse-buckets' }) },\n },\n ...breadcrumbs.map((segment, index) => ({\n text: segment,\n href: '',\n meta: {\n onClick: () =>\n dispatch({\n type: 'browse-objects',\n breadcrumbs: breadcrumbs.slice(0, index + 1),\n }),\n },\n })),\n ]}\n />\n {alert}\n {currentView === 'buckets' ? (\n <BucketsTable\n forwardFocusRef={forwardFocusRef}\n fetchData={fetchBuckets}\n visibleColumns={bucketsVisibleColumns}\n isItemDisabled={bucketsIsItemDisabled}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onDrilldown={path =>\n dispatch({\n type: 'browse-objects',\n breadcrumbs: [path],\n })\n }\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : currentView === 'objects' ? (\n <ObjectsTable\n forwardFocusRef={forwardFocusRef}\n pathSegments={breadcrumbs}\n fetchData={fetchObjects}\n visibleColumns={objectsVisibleColumns}\n isItemDisabled={objectsIsItemDisabled}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onDrilldown={item => {\n dispatch({\n type: item.IsFolder ? 'browse-objects' : 'browse-versions',\n breadcrumbs: [...breadcrumbs, item.Key!],\n });\n }}\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : currentView === 'versions' ? (\n <VersionsTable\n forwardFocusRef={forwardFocusRef}\n pathSegments={breadcrumbs}\n fetchData={fetchVersions}\n visibleColumns={versionsVisibleColumns}\n isItemDisabled={versionsIsItemDisabled}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : (\n assertNever(currentView)\n )}\n </InternalSpaceBetween>\n </InternalModal>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,uBAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAmB9D,6DAA6D;AAC7D,SAAS,WAAW,CAAC,MAAa;IAChC,OAAO,IAAI,CAAC;AACd,CAAC;AAaD,M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AY,EAAE,WAAW,EACzB,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,sBAAsB,EACtC,cAAc,EAAE,sBAAsB,EACtC,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,GACzD,CACH,CAAC,CAAC,CAAC,CACF,WAAW,CAAC,WAAW,CAAC,CACzB,CACoB,CACT,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useReducer, useRef } from 'react';\nimport InternalBreadcrumbGroup from '../../breadcrumb-group/internal';\nimport { InternalButton } from '../../button/internal';\nimport InternalModal from '../../modal/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport { ForwardFocusRef } from '../../internal/hooks/forward-focus';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\nimport { S3ResourceSelectorProps } from '../interfaces';\nimport { BucketsTable } from './buckets-table';\nimport { ObjectsTable } from './objects-table';\nimport { VersionsTable } from './versions-table';\nimport styles from './styles.css.js';\nimport { joinObjectPath } from '../utils';\nimport { useInternalI18n } from '../../internal/i18n/context';\n\nexport interface S3ModalProps {\n alert: React.ReactNode;\n selectableItemsTypes: S3ResourceSelectorProps['selectableItemsTypes'];\n fetchBuckets: S3ResourceSelectorProps['fetchBuckets'];\n bucketsVisibleColumns: ReadonlyArray<string>;\n bucketsIsItemDisabled: S3ResourceSelectorProps['bucketsIsItemDisabled'];\n fetchObjects: S3ResourceSelectorProps['fetchObjects'];\n objectsVisibleColumns: ReadonlyArray<string>;\n objectsIsItemDisabled: S3ResourceSelectorProps['objectsIsItemDisabled'];\n fetchVersions: S3ResourceSelectorProps['fetchVersions'];\n versionsVisibleColumns: ReadonlyArray<string>;\n versionsIsItemDisabled: S3ResourceSelectorProps['versionsIsItemDisabled'];\n i18nStrings: S3ResourceSelectorProps.I18nStrings | undefined;\n onDismiss: () => void;\n onSubmit: (resource: S3ResourceSelectorProps.Resource) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction assertNever(_value: never) {\n return null;\n}\n\ninterface S3BrowseState {\n selectedItem: string | null;\n currentView: 'buckets' | 'objects' | 'versions';\n breadcrumbs: ReadonlyArray<string>;\n}\n\ntype S3BrowseActions =\n | { type: 'browse-buckets' }\n | { type: 'browse-objects' | 'browse-versions'; breadcrumbs: S3BrowseState['breadcrumbs'] }\n | { type: 'select-item'; item: string };\n\nconst initialBrowseState: S3BrowseState = {\n selectedItem: null,\n currentView: 'buckets',\n breadcrumbs: [],\n};\n\nfunction s3BrowseReducer(state: S3BrowseState, action: S3BrowseActions) {\n switch (action.type) {\n case 'browse-buckets':\n return initialBrowseState;\n case 'browse-objects':\n return {\n selectedItem: null,\n currentView: 'objects' as const,\n breadcrumbs: action.breadcrumbs,\n };\n case 'browse-versions':\n return {\n selectedItem: null,\n currentView: 'versions' as const,\n breadcrumbs: action.breadcrumbs,\n };\n case 'select-item':\n return {\n ...state,\n selectedItem: action.item,\n };\n default:\n assertNever(action);\n }\n return state;\n}\n\nfunction createResourceInfo({ currentView, breadcrumbs, selectedItem }: S3BrowseState) {\n const prefix = 's3://';\n if (currentView === 'versions') {\n return { uri: prefix + joinObjectPath(breadcrumbs), versionId: selectedItem ?? undefined };\n }\n return { uri: prefix + joinObjectPath([...breadcrumbs, selectedItem!]) };\n}\n\nexport function S3Modal({\n i18nStrings,\n alert,\n selectableItemsTypes,\n fetchBuckets,\n bucketsVisibleColumns,\n bucketsIsItemDisabled,\n fetchObjects,\n objectsVisibleColumns,\n objectsIsItemDisabled,\n fetchVersions,\n versionsVisibleColumns,\n versionsIsItemDisabled,\n onSubmit,\n onDismiss,\n}: S3ModalProps) {\n const [{ currentView, breadcrumbs, selectedItem }, dispatch] = useReducer(s3BrowseReducer, initialBrowseState);\n const forwardFocusRef = useRef<ForwardFocusRef>(null);\n const i18n = useInternalI18n('s3-resource-selector');\n\n const isVisualRefresh = useVisualRefresh();\n\n useEffectOnUpdate(() => {\n forwardFocusRef.current?.focus();\n }, [breadcrumbs]);\n\n return (\n <div>\n <InternalModal\n visible={true}\n size=\"max\"\n closeAriaLabel={i18nStrings?.labelModalDismiss}\n onDismiss={onDismiss}\n header={i18n('i18nStrings.modalTitle', i18nStrings?.modalTitle)}\n footer={\n <InternalSpaceBetween className={styles['modal-actions']} size=\"xs\" direction=\"horizontal\">\n <InternalButton variant=\"link\" formAction=\"none\" onClick={onDismiss}>\n {i18n('i18nStrings.modalCancelButton', i18nStrings?.modalCancelButton)}\n </InternalButton>\n <InternalButton\n variant=\"primary\"\n className={styles['submit-button']}\n disabled={!selectedItem}\n formAction=\"none\"\n onClick={() => onSubmit(createResourceInfo({ currentView, breadcrumbs, selectedItem }))}\n >\n {i18n('i18nStrings.modalSubmitButton', i18nStrings?.modalSubmitButton)}\n </InternalButton>\n </InternalSpaceBetween>\n }\n >\n <InternalSpaceBetween size={isVisualRefresh ? 'xxs' : 'xs'}>\n <InternalBreadcrumbGroup\n ariaLabel={i18n('i18nStrings.labelBreadcrumbs', i18nStrings?.labelBreadcrumbs)}\n expandAriaLabel=\"Show path\"\n onFollow={event => {\n event.preventDefault();\n event.detail.item.meta.onClick();\n }}\n items={[\n {\n text: i18n('i18nStrings.modalBreadcrumbRootItem', i18nStrings?.modalBreadcrumbRootItem) ?? '',\n href: '',\n meta: { onClick: () => dispatch({ type: 'browse-buckets' }) },\n },\n ...breadcrumbs.map((segment, index) => ({\n text: segment,\n href: '',\n meta: {\n onClick: () =>\n dispatch({\n type: 'browse-objects',\n breadcrumbs: breadcrumbs.slice(0, index + 1),\n }),\n },\n })),\n ]}\n />\n {alert}\n {currentView === 'buckets' ? (\n <BucketsTable\n forwardFocusRef={forwardFocusRef}\n fetchData={fetchBuckets}\n visibleColumns={bucketsVisibleColumns}\n isItemDisabled={bucketsIsItemDisabled}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onDrilldown={path =>\n dispatch({\n type: 'browse-objects',\n breadcrumbs: [path],\n })\n }\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : currentView === 'objects' ? (\n <ObjectsTable\n forwardFocusRef={forwardFocusRef}\n pathSegments={breadcrumbs}\n fetchData={fetchObjects}\n visibleColumns={objectsVisibleColumns}\n isItemDisabled={objectsIsItemDisabled}\n selectableItemsTypes={selectableItemsTypes}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onDrilldown={item => {\n dispatch({\n type: item.IsFolder ? 'browse-objects' : 'browse-versions',\n breadcrumbs: [...breadcrumbs, item.Key!],\n });\n }}\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : currentView === 'versions' ? (\n <VersionsTable\n forwardFocusRef={forwardFocusRef}\n pathSegments={breadcrumbs}\n fetchData={fetchVersions}\n visibleColumns={versionsVisibleColumns}\n isItemDisabled={versionsIsItemDisabled}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n onSelect={item => dispatch({ type: 'select-item', item })}\n />\n ) : (\n assertNever(currentView)\n )}\n </InternalSpaceBetween>\n </InternalModal>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects-table.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/objects-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAIxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"objects-table.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/objects-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAIxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAMrE,UAAU,iBAAiB;IACzB,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5C,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC,uBAAuB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACtF,oBAAoB,EAAE,uBAAuB,CAAC,sBAAsB,CAAC,CAAC;IACtE,SAAS,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACnD,WAAW,EAAE,uBAAuB,CAAC,WAAW,GAAG,SAAS,CAAC;IAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,uBAAuB,CAAC,MAAM,KAAK,IAAI,CAAC;IAC5D,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,EAC3B,eAAe,EACf,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,WAAW,EACX,QAAQ,GACT,EAAE,iBAAiB,eAgGnB"}
|
|
@@ -7,17 +7,20 @@ import InternalLink from '../../link/internal';
|
|
|
7
7
|
import { formatSize, formatDefault } from './column-formats';
|
|
8
8
|
import { BasicS3Table, getSharedI18Strings } from './basic-table';
|
|
9
9
|
import { joinObjectPath } from '../utils';
|
|
10
|
+
import { useInternalI18n } from '../../internal/i18n/context';
|
|
10
11
|
export function ObjectsTable({ forwardFocusRef, pathSegments, i18nStrings, isVisualRefresh, isItemDisabled, selectableItemsTypes, fetchData, visibleColumns, onDrilldown, onSelect, }) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const i18n = useInternalI18n('s3-resource-selector');
|
|
11
14
|
return (React.createElement(BasicS3Table, {
|
|
12
15
|
// remount fresh component every we change the path to reset the inner state (e.g. selection/filtering)
|
|
13
16
|
key: pathSegments.join('/'), forwardFocusRef: forwardFocusRef, trackBy: "Key", fetchData: () => {
|
|
14
17
|
const [bucketName, ...rest] = pathSegments;
|
|
15
18
|
return fetchData(bucketName, joinObjectPath(rest));
|
|
16
|
-
}, i18nStrings: Object.assign(Object.assign({}, getSharedI18Strings(i18nStrings)), { header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjects, filteringAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelFiltering(i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjects), filteringPlaceholder: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjectsSearchPlaceholder,
|
|
19
|
+
}, i18nStrings: Object.assign(Object.assign({}, getSharedI18Strings(i18n, i18nStrings)), { header: i18n('i18nStrings.selectionObjects', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjects), loadingText: i18n('i18nStrings.selectionObjectsLoading', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjectsLoading), filteringAriaLabel: (_a = i18n('i18nStrings.labelFiltering', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelFiltering, format => itemsType => format({ itemsType }))) === null || _a === void 0 ? void 0 : _a((_b = i18n('i18nStrings.selectionObjects', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjects)) !== null && _b !== void 0 ? _b : ''), filteringPlaceholder: i18n('i18nStrings.selectionObjectsSearchPlaceholder', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjectsSearchPlaceholder), emptyText: i18n('i18nStrings.selectionObjectsNoItems', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionObjectsNoItems), selectionLabels: Object.assign(Object.assign({}, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsObjectsSelection), { selectionGroupLabel: i18n('i18nStrings.labelsObjectsSelection.selectionGroupLabel', (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsObjectsSelection) === null || _c === void 0 ? void 0 : _c.selectionGroupLabel), itemSelectionLabel: i18n('i18nStrings.labelsObjectsSelection.itemSelectionLabel', (_d = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsObjectsSelection) === null || _d === void 0 ? void 0 : _d.itemSelectionLabel, format => (data, item) => { var _a; return format({ item__Key: (_a = item.Key) !== null && _a !== void 0 ? _a : '' }); }) }) }), isVisualRefresh: isVisualRefresh, visibleColumns: visibleColumns, isItemDisabled: isItemDisabled || (() => !includes(selectableItemsTypes, 'objects')), columnDefinitions: [
|
|
17
20
|
{
|
|
18
21
|
id: 'Key',
|
|
19
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectKey,
|
|
20
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectKey),
|
|
22
|
+
header: i18n('i18nStrings.columnObjectKey', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectKey),
|
|
23
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnObjectKey', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectKey)),
|
|
21
24
|
sortingField: 'Key',
|
|
22
25
|
cell: item => {
|
|
23
26
|
const isClickable = item.IsFolder || includes(selectableItemsTypes, 'versions');
|
|
@@ -30,15 +33,15 @@ export function ObjectsTable({ forwardFocusRef, pathSegments, i18nStrings, isVis
|
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
35
|
id: 'LastModified',
|
|
33
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectLastModified,
|
|
34
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectLastModified),
|
|
36
|
+
header: i18n('i18nStrings.columnObjectLastModified', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectLastModified),
|
|
37
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnObjectLastModified', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectLastModified)),
|
|
35
38
|
sortingComparator: (a, b) => compareDates(a.LastModified, b.LastModified),
|
|
36
39
|
cell: item => formatDefault(item.LastModified),
|
|
37
40
|
},
|
|
38
41
|
{
|
|
39
42
|
id: 'Size',
|
|
40
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectSize,
|
|
41
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectSize),
|
|
43
|
+
header: i18n('i18nStrings.columnObjectSize', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectSize),
|
|
44
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnObjectSize', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnObjectSize)),
|
|
42
45
|
sortingField: 'Size',
|
|
43
46
|
cell: item => formatSize(item.Size),
|
|
44
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects-table.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/objects-table.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EA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c;gBAClB,MAAM,EAAE,IAAI,CAAC,sCAAsC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,wBAAwB,CAAC;gBAC3F,SAAS,EAAE,kBAAkB,CAC3B,IAAI,EACJ,WAAW,EACX,IAAI,CAAC,sCAAsC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,wBAAwB,CAAC,CACpF;gBACD,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,YAAY,CAAC;gBACzE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC;aAC/C;YACD;gBACE,EAAE,EAAE,MAAM;gBACV,MAAM,EAAE,IAAI,CAAC,8BAA8B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,CAAC;gBAC3E,SAAS,EAAE,kBAAkB,CAC3B,IAAI,EACJ,WAAW,EACX,IAAI,CAAC,8BAA8B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,CAAC,CACpE;gBACD,YAAY,EAAE,MAAM;gBACpB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aACpC;SACF,EACD,QAAQ,EAAE,IAAI,CAAC,EAAE,WAAC,OAAA,QAAQ,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,mCAAI,EAAE,CAAC,CAAA,EAAA,GAC3C,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { S3ResourceSelectorProps } from '../interfaces';\nimport { compareDates, getColumnAriaLabel, includes } from './table-utils';\nimport InternalIcon from '../../icon/internal';\nimport InternalLink from '../../link/internal';\nimport { TableProps } from '../../table/interfaces';\nimport { ForwardFocusRef } from '../../internal/hooks/forward-focus';\nimport { formatSize, formatDefault } from './column-formats';\nimport { BasicS3Table, getSharedI18Strings } from './basic-table';\nimport { joinObjectPath } from '../utils';\nimport { useInternalI18n } from '../../internal/i18n/context';\n\ninterface ObjectsTableProps {\n forwardFocusRef: React.Ref<ForwardFocusRef>;\n pathSegments: ReadonlyArray<string>;\n visibleColumns: ReadonlyArray<string>;\n isItemDisabled: TableProps.IsItemDisabled<S3ResourceSelectorProps.Object> | undefined;\n selectableItemsTypes: S3ResourceSelectorProps['selectableItemsTypes'];\n fetchData: S3ResourceSelectorProps['fetchObjects'];\n i18nStrings: S3ResourceSelectorProps.I18nStrings | undefined;\n isVisualRefresh?: boolean;\n onDrilldown: (path: S3ResourceSelectorProps.Object) => void;\n onSelect: (uri: string) => void;\n}\n\nexport function ObjectsTable({\n forwardFocusRef,\n pathSegments,\n i18nStrings,\n isVisualRefresh,\n isItemDisabled,\n selectableItemsTypes,\n fetchData,\n visibleColumns,\n onDrilldown,\n onSelect,\n}: ObjectsTableProps) {\n const i18n = useInternalI18n('s3-resource-selector');\n\n return (\n <BasicS3Table<S3ResourceSelectorProps.Object>\n // remount fresh component every we change the path to reset the inner state (e.g. selection/filtering)\n key={pathSegments.join('/')}\n forwardFocusRef={forwardFocusRef}\n trackBy=\"Key\"\n fetchData={() => {\n const [bucketName, ...rest] = pathSegments;\n return fetchData(bucketName, joinObjectPath(rest));\n }}\n i18nStrings={{\n ...getSharedI18Strings(i18n, i18nStrings),\n header: i18n('i18nStrings.selectionObjects', i18nStrings?.selectionObjects),\n loadingText: i18n('i18nStrings.selectionObjectsLoading', i18nStrings?.selectionObjectsLoading),\n filteringAriaLabel: i18n(\n 'i18nStrings.labelFiltering',\n i18nStrings?.labelFiltering,\n format => itemsType => format({ itemsType })\n )?.(i18n('i18nStrings.selectionObjects', i18nStrings?.selectionObjects) ?? ''),\n filteringPlaceholder: i18n(\n 'i18nStrings.selectionObjectsSearchPlaceholder',\n i18nStrings?.selectionObjectsSearchPlaceholder\n ),\n emptyText: i18n('i18nStrings.selectionObjectsNoItems', i18nStrings?.selectionObjectsNoItems),\n selectionLabels: {\n ...i18nStrings?.labelsObjectsSelection,\n selectionGroupLabel: i18n(\n 'i18nStrings.labelsObjectsSelection.selectionGroupLabel',\n i18nStrings?.labelsObjectsSelection?.selectionGroupLabel\n ),\n itemSelectionLabel: i18n(\n 'i18nStrings.labelsObjectsSelection.itemSelectionLabel',\n i18nStrings?.labelsObjectsSelection?.itemSelectionLabel,\n format => (data, item) => format({ item__Key: item.Key ?? '' })\n ),\n },\n }}\n isVisualRefresh={isVisualRefresh}\n visibleColumns={visibleColumns}\n isItemDisabled={isItemDisabled || (() => !includes(selectableItemsTypes, 'objects'))}\n columnDefinitions={[\n {\n id: 'Key',\n header: i18n('i18nStrings.columnObjectKey', i18nStrings?.columnObjectKey),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnObjectKey', i18nStrings?.columnObjectKey)\n ),\n sortingField: 'Key',\n cell: item => {\n const isClickable = item.IsFolder || includes(selectableItemsTypes, 'versions');\n return (\n <>\n <InternalIcon name={item.IsFolder ? 'folder' : 'file'} />{' '}\n {isClickable ? (\n <InternalLink onFollow={() => item.Key && onDrilldown(item)} variant=\"link\">\n {item.Key}\n </InternalLink>\n ) : (\n item.Key\n )}\n </>\n );\n },\n minWidth: '250px',\n },\n {\n id: 'LastModified',\n header: i18n('i18nStrings.columnObjectLastModified', i18nStrings?.columnObjectLastModified),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnObjectLastModified', i18nStrings?.columnObjectLastModified)\n ),\n sortingComparator: (a, b) => compareDates(a.LastModified, b.LastModified),\n cell: item => formatDefault(item.LastModified),\n },\n {\n id: 'Size',\n header: i18n('i18nStrings.columnObjectSize', i18nStrings?.columnObjectSize),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnObjectSize', i18nStrings?.columnObjectSize)\n ),\n sortingField: 'Size',\n cell: item => formatSize(item.Size),\n },\n ]}\n onSelect={item => onSelect(item?.Key ?? '')}\n />\n );\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { S3ResourceSelectorProps } from '../interfaces';
|
|
2
2
|
import { TableProps } from '../../table/interfaces';
|
|
3
|
+
import { ComponentFormatFunction } from '../../internal/i18n/context';
|
|
3
4
|
export declare function includes<T>(array: ReadonlyArray<T> | undefined, item: T): boolean;
|
|
4
5
|
export declare const compareDates: (itemA: string | undefined, itemB: string | undefined) => number;
|
|
5
|
-
export declare function getColumnAriaLabel(i18nStrings?: Pick<S3ResourceSelectorProps.I18nStrings, 'labelNotSorted' | 'labelSortedDescending' | 'labelSortedAscending'>, columnName?: string): ({ sorted, descending }: TableProps.LabelData) => string;
|
|
6
|
+
export declare function getColumnAriaLabel(i18n: ComponentFormatFunction, i18nStrings?: Pick<S3ResourceSelectorProps.I18nStrings, 'labelNotSorted' | 'labelSortedDescending' | 'labelSortedAscending'>, columnName?: string): ({ sorted, descending }: TableProps.LabelData) => string;
|
|
6
7
|
//# sourceMappingURL=table-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-utils.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/table-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"table-utils.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/table-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,WAEvE;AAED,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,SAAS,SAAS,MAAM,GAAG,SAAS,WAIhF,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,CAAC,EAAE,IAAI,CAChB,uBAAuB,CAAC,WAAW,EACnC,gBAAgB,GAAG,uBAAuB,GAAG,sBAAsB,CACpE,EACD,UAAU,SAAK,4BAEiB,WAAW,SAAS,YAqBrD"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const defaultLabels = {
|
|
2
|
-
labelNotSorted: () => '',
|
|
3
|
-
labelSortedDescending: () => '',
|
|
4
|
-
labelSortedAscending: () => '',
|
|
5
|
-
};
|
|
6
1
|
export function includes(array, item) {
|
|
7
2
|
return !!array && array.indexOf(item) > -1;
|
|
8
3
|
}
|
|
@@ -11,15 +6,16 @@ export const compareDates = (itemA, itemB) => {
|
|
|
11
6
|
const timeB = itemB ? new Date(itemB).getTime() : 0;
|
|
12
7
|
return timeA - timeB;
|
|
13
8
|
};
|
|
14
|
-
export function getColumnAriaLabel(i18nStrings
|
|
9
|
+
export function getColumnAriaLabel(i18n, i18nStrings, columnName = '') {
|
|
15
10
|
return ({ sorted, descending }) => {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16
12
|
if (!sorted) {
|
|
17
|
-
return i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelNotSorted(columnName);
|
|
13
|
+
return ((_b = i18n('i18nStrings.labelNotSorted', (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelNotSorted) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, columnName), format => format({ columnName }))) !== null && _b !== void 0 ? _b : '');
|
|
18
14
|
}
|
|
19
15
|
if (descending) {
|
|
20
|
-
return i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelSortedDescending(columnName);
|
|
16
|
+
return ((_d = i18n('i18nStrings.labelSortedDescending', (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelSortedDescending) === null || _c === void 0 ? void 0 : _c.call(i18nStrings, columnName), format => format({ columnName }))) !== null && _d !== void 0 ? _d : '');
|
|
21
17
|
}
|
|
22
|
-
return i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelSortedAscending(columnName);
|
|
18
|
+
return ((_f = i18n('i18nStrings.labelSortedAscending', (_e = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelSortedAscending) === null || _e === void 0 ? void 0 : _e.call(i18nStrings, columnName), format => format({ columnName }))) !== null && _f !== void 0 ? _f : '');
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
//# sourceMappingURL=table-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-utils.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/table-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-utils.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/table-utils.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,QAAQ,CAAI,KAAmC,EAAE,IAAO;IACtE,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAyB,EAAE,KAAyB,EAAE,EAAE;IACnF,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,KAAK,GAAG,KAAK,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAChC,IAA6B,EAC7B,WAGC,EACD,UAAU,GAAG,EAAE;IAEf,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,EAAwB,EAAE,EAAE;;QACtD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CACL,MAAA,IAAI,CAAC,4BAA4B,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,4DAAG,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,CACrF,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CACvB,mCAAI,EAAE,CACR,CAAC;SACH;QACD,IAAI,UAAU,EAAE;YACd,OAAO,CACL,MAAA,IAAI,CAAC,mCAAmC,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,qBAAqB,4DAAG,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,CACnG,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CACvB,mCAAI,EAAE,CACR,CAAC;SACH;QACD,OAAO,CACL,MAAA,IAAI,CAAC,kCAAkC,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,4DAAG,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,CACjG,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CACvB,mCAAI,EAAE,CACR,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { S3ResourceSelectorProps } from '../interfaces';\nimport { TableProps } from '../../table/interfaces';\nimport { ComponentFormatFunction } from '../../internal/i18n/context';\n\nexport function includes<T>(array: ReadonlyArray<T> | undefined, item: T) {\n return !!array && array.indexOf(item) > -1;\n}\n\nexport const compareDates = (itemA: string | undefined, itemB: string | undefined) => {\n const timeA = itemA ? new Date(itemA).getTime() : 0;\n const timeB = itemB ? new Date(itemB).getTime() : 0;\n return timeA - timeB;\n};\n\nexport function getColumnAriaLabel(\n i18n: ComponentFormatFunction,\n i18nStrings?: Pick<\n S3ResourceSelectorProps.I18nStrings,\n 'labelNotSorted' | 'labelSortedDescending' | 'labelSortedAscending'\n >,\n columnName = ''\n) {\n return ({ sorted, descending }: TableProps.LabelData) => {\n if (!sorted) {\n return (\n i18n('i18nStrings.labelNotSorted', i18nStrings?.labelNotSorted?.(columnName), format =>\n format({ columnName })\n ) ?? ''\n );\n }\n if (descending) {\n return (\n i18n('i18nStrings.labelSortedDescending', i18nStrings?.labelSortedDescending?.(columnName), format =>\n format({ columnName })\n ) ?? ''\n );\n }\n return (\n i18n('i18nStrings.labelSortedAscending', i18nStrings?.labelSortedAscending?.(columnName), format =>\n format({ columnName })\n ) ?? ''\n );\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions-table.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/versions-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"versions-table.d.ts","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/versions-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAMrE,UAAU,kBAAkB;IAC1B,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5C,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACvF,SAAS,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;IACpD,WAAW,EAAE,uBAAuB,CAAC,WAAW,GAAG,SAAS,CAAC;IAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,aAAa,CAAC,EAC5B,eAAe,EACf,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,SAAS,EACT,cAAc,EACd,QAAQ,GACT,EAAE,kBAAkB,eAgFpB"}
|
|
@@ -5,30 +5,33 @@ import { getColumnAriaLabel, compareDates } from './table-utils';
|
|
|
5
5
|
import { formatSize, formatDefault } from './column-formats';
|
|
6
6
|
import { BasicS3Table, getSharedI18Strings } from './basic-table';
|
|
7
7
|
import { joinObjectPath } from '../utils';
|
|
8
|
+
import { useInternalI18n } from '../../internal/i18n/context';
|
|
8
9
|
export function VersionsTable({ forwardFocusRef, pathSegments, i18nStrings, isVisualRefresh, isItemDisabled, fetchData, visibleColumns, onSelect, }) {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
const i18n = useInternalI18n('s3-resource-selector');
|
|
9
12
|
return (React.createElement(BasicS3Table, { forwardFocusRef: forwardFocusRef, trackBy: "VersionId", fetchData: () => {
|
|
10
13
|
const [bucketName, ...rest] = pathSegments;
|
|
11
14
|
return fetchData(bucketName, joinObjectPath(rest));
|
|
12
|
-
}, i18nStrings: Object.assign(Object.assign({}, getSharedI18Strings(i18nStrings)), { header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersions, filteringAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelFiltering(i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersions), filteringPlaceholder: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersionsSearchPlaceholder,
|
|
15
|
+
}, i18nStrings: Object.assign(Object.assign({}, getSharedI18Strings(i18n, i18nStrings)), { header: i18n('i18nStrings.selectionVersions', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersions), loadingText: i18n('i18nStrings.selectionVersionsLoading', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersionsLoading), filteringAriaLabel: (_a = i18n('i18nStrings.labelFiltering', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelFiltering, format => itemsType => format({ itemsType }))) === null || _a === void 0 ? void 0 : _a((_b = i18n('i18nStrings.selectionVersions', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersions)) !== null && _b !== void 0 ? _b : ''), filteringPlaceholder: i18n('i18nStrings.selectionVersionsSearchPlaceholder', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersionsSearchPlaceholder), emptyText: i18n('i18nStrings.selectionVersionsNoItems', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.selectionVersionsNoItems), selectionLabels: Object.assign(Object.assign({}, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsVersionsSelection), { selectionGroupLabel: i18n('i18nStrings.labelsVersionsSelection.selectionGroupLabel', (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsVersionsSelection) === null || _c === void 0 ? void 0 : _c.selectionGroupLabel), itemSelectionLabel: i18n('i18nStrings.labelsVersionsSelection.itemSelectionLabel', (_d = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.labelsVersionsSelection) === null || _d === void 0 ? void 0 : _d.itemSelectionLabel, format => (data, item) => { var _a; return format({ item__VersionId: (_a = item.VersionId) !== null && _a !== void 0 ? _a : '' }); }) }) }), isVisualRefresh: isVisualRefresh, visibleColumns: visibleColumns, isItemDisabled: isItemDisabled, columnDefinitions: [
|
|
13
16
|
{
|
|
14
17
|
id: 'ID',
|
|
15
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionID,
|
|
16
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionID),
|
|
18
|
+
header: i18n('i18nStrings.columnVersionID', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionID),
|
|
19
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnVersionID', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionID)),
|
|
17
20
|
sortingField: 'VersionId',
|
|
18
21
|
cell: item => item.VersionId,
|
|
19
22
|
minWidth: '250px',
|
|
20
23
|
},
|
|
21
24
|
{
|
|
22
25
|
id: 'LastModified',
|
|
23
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionLastModified,
|
|
24
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionLastModified),
|
|
26
|
+
header: i18n('i18nStrings.columnVersionLastModified', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionLastModified),
|
|
27
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnVersionLastModified', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionLastModified)),
|
|
25
28
|
sortingComparator: (a, b) => compareDates(a.LastModified, b.LastModified),
|
|
26
29
|
cell: item => formatDefault(item.LastModified),
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
32
|
id: 'Size',
|
|
30
|
-
header: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionSize,
|
|
31
|
-
ariaLabel: getColumnAriaLabel(i18nStrings, i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionSize),
|
|
33
|
+
header: i18n('i18nStrings.columnVersionSize', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionSize),
|
|
34
|
+
ariaLabel: getColumnAriaLabel(i18n, i18nStrings, i18n('i18nStrings.columnVersionSize', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.columnVersionSize)),
|
|
32
35
|
sortingField: 'Size',
|
|
33
36
|
cell: item => formatSize(item.Size),
|
|
34
37
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions-table.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/versions-table.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"versions-table.js","sourceRoot":"lib/default/","sources":["s3-resource-selector/s3-modal/versions-table.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,M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AC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,YAAY,CAAC;gBACzE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC;aAC/C;YACD;gBACE,EAAE,EAAE,MAAM;gBACV,MAAM,EAAE,IAAI,CAAC,+BAA+B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,iBAAiB,CAAC;gBAC7E,SAAS,EAAE,kBAAkB,CAC3B,IAAI,EACJ,WAAW,EACX,IAAI,CAAC,+BAA+B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,iBAAiB,CAAC,CACtE;gBACD,YAAY,EAAE,MAAM;gBACpB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aACpC;SACF,EACD,QAAQ,EAAE,IAAI,CAAC,EAAE,WAAC,OAAA,QAAQ,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,EAAE,CAAC,CAAA,EAAA,GACjD,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { S3ResourceSelectorProps } from '../interfaces';\nimport { getColumnAriaLabel, compareDates } from './table-utils';\nimport { TableProps } from '../../table/interfaces';\nimport { ForwardFocusRef } from '../../internal/hooks/forward-focus';\nimport { formatSize, formatDefault } from './column-formats';\nimport { BasicS3Table, getSharedI18Strings } from './basic-table';\nimport { joinObjectPath } from '../utils';\nimport { useInternalI18n } from '../../internal/i18n/context';\n\ninterface VersionsTableProps {\n forwardFocusRef: React.Ref<ForwardFocusRef>;\n pathSegments: ReadonlyArray<string>;\n visibleColumns: ReadonlyArray<string>;\n isItemDisabled: TableProps.IsItemDisabled<S3ResourceSelectorProps.Version> | undefined;\n fetchData: S3ResourceSelectorProps['fetchVersions'];\n i18nStrings: S3ResourceSelectorProps.I18nStrings | undefined;\n isVisualRefresh?: boolean;\n onSelect: (versionId: string) => void;\n}\n\nexport function VersionsTable({\n forwardFocusRef,\n pathSegments,\n i18nStrings,\n isVisualRefresh,\n isItemDisabled,\n fetchData,\n visibleColumns,\n onSelect,\n}: VersionsTableProps) {\n const i18n = useInternalI18n('s3-resource-selector');\n\n return (\n <BasicS3Table<S3ResourceSelectorProps.Version>\n forwardFocusRef={forwardFocusRef}\n trackBy=\"VersionId\"\n fetchData={() => {\n const [bucketName, ...rest] = pathSegments;\n return fetchData(bucketName, joinObjectPath(rest));\n }}\n i18nStrings={{\n ...getSharedI18Strings(i18n, i18nStrings),\n header: i18n('i18nStrings.selectionVersions', i18nStrings?.selectionVersions),\n loadingText: i18n('i18nStrings.selectionVersionsLoading', i18nStrings?.selectionVersionsLoading),\n filteringAriaLabel: i18n(\n 'i18nStrings.labelFiltering',\n i18nStrings?.labelFiltering,\n format => itemsType => format({ itemsType })\n )?.(i18n('i18nStrings.selectionVersions', i18nStrings?.selectionVersions) ?? ''),\n filteringPlaceholder: i18n(\n 'i18nStrings.selectionVersionsSearchPlaceholder',\n i18nStrings?.selectionVersionsSearchPlaceholder\n ),\n emptyText: i18n('i18nStrings.selectionVersionsNoItems', i18nStrings?.selectionVersionsNoItems),\n selectionLabels: {\n ...i18nStrings?.labelsVersionsSelection,\n selectionGroupLabel: i18n(\n 'i18nStrings.labelsVersionsSelection.selectionGroupLabel',\n i18nStrings?.labelsVersionsSelection?.selectionGroupLabel\n ),\n itemSelectionLabel: i18n(\n 'i18nStrings.labelsVersionsSelection.itemSelectionLabel',\n i18nStrings?.labelsVersionsSelection?.itemSelectionLabel,\n format => (data, item) => format({ item__VersionId: item.VersionId ?? '' })\n ),\n },\n }}\n isVisualRefresh={isVisualRefresh}\n visibleColumns={visibleColumns}\n isItemDisabled={isItemDisabled}\n columnDefinitions={[\n {\n id: 'ID',\n header: i18n('i18nStrings.columnVersionID', i18nStrings?.columnVersionID),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnVersionID', i18nStrings?.columnVersionID)\n ),\n sortingField: 'VersionId',\n cell: item => item.VersionId,\n minWidth: '250px',\n },\n {\n id: 'LastModified',\n header: i18n('i18nStrings.columnVersionLastModified', i18nStrings?.columnVersionLastModified),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnVersionLastModified', i18nStrings?.columnVersionLastModified)\n ),\n sortingComparator: (a, b) => compareDates(a.LastModified, b.LastModified),\n cell: item => formatDefault(item.LastModified),\n },\n {\n id: 'Size',\n header: i18n('i18nStrings.columnVersionSize', i18nStrings?.columnVersionSize),\n ariaLabel: getColumnAriaLabel(\n i18n,\n i18nStrings,\n i18n('i18nStrings.columnVersionSize', i18nStrings?.columnVersionSize)\n ),\n sortingField: 'Size',\n cell: item => formatSize(item.Size),\n },\n ]}\n onSelect={item => onSelect(item?.VersionId ?? '')}\n />\n );\n}\n"]}
|
package/select/interfaces.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export interface BaseSelectProps extends BaseDropdownHostProps, BaseComponentPro
|
|
|
73
73
|
filteringAriaLabel?: string;
|
|
74
74
|
/**
|
|
75
75
|
* Adds an `aria-label` to the clear button inside the search input.
|
|
76
|
+
* @i18n
|
|
76
77
|
*/
|
|
77
78
|
filteringClearAriaLabel?: string;
|
|
78
79
|
/**
|
|
@@ -99,6 +100,7 @@ export interface BaseSelectProps extends BaseDropdownHostProps, BaseComponentPro
|
|
|
99
100
|
* Specifies the localized string that describes an option as being selected.
|
|
100
101
|
* This is required to provide a good screen reader experience. For more information, see the
|
|
101
102
|
* [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).
|
|
103
|
+
* @i18n
|
|
102
104
|
*/
|
|
103
105
|
selectedAriaLabel?: string;
|
|
104
106
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["select/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACxF,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,eACf,SAAQ,qBAAqB,EAC3B,kBAAkB,EAClB,+BAA+B,EAC/B,mBAAmB;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8BI;IACJ,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;IAC9B;;;;;;;;;;;;;;;QAeI;IACJ,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5E;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["select/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAA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AS,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC;AAED,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;OAEG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC;IAC5C;;;OAGG;IACH,cAAc,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAE/D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,yBAAiB,WAAW,CAAC;IAC3B,KAAY,aAAa,GAAG,oBAAoB,CAAC;IACjD,KAAY,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;IAEhD,KAAY,MAAM,GAAG,gBAAgB,CAAC;IACtC,KAAY,WAAW,GAAG,qBAAqB,CAAC;IAChD,KAAY,OAAO,GAAG,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;IAE1D,KAAY,eAAe,GAAG,sBAAsB,CAAC;IAErD,UAAiB,YAAY;QAC3B,cAAc,EAAE,MAAM,CAAC;KACxB;IAED,UAAiB,8BAA8B;QAC7C,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;KAC/C;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
package/select/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["select/interfaces.ts"],"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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { OptionDefinition, OptionGroup as OptionGroupDefinition } from '../internal/components/option/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\n\nexport interface BaseSelectProps\n extends BaseDropdownHostProps,\n BaseComponentProps,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: SelectProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Determines whether the whole select component is disabled.\n */\n disabled?: boolean;\n /**\n * Specifies the placeholder to display in the filtering input if filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n /**\n * Adds an `aria-label` on the built-in filtering input if filtering is enabled.\n */\n filteringAriaLabel?: string;\n /**\n * Adds an `aria-label` to the clear button inside the search input.\n */\n filteringClearAriaLabel?: string;\n /**\n * @deprecated Has no effect.\n */\n name?: string;\n /**\n * Specifies the hint text that's displayed in the field when no option has been selected.\n */\n placeholder?: string;\n /**\n * Specifies the ID for the trigger component. It uses an automatically generated ID by default.\n */\n controlId?: string;\n /**\n * Adds `aria-required` to the native input element.\n */\n ariaRequired?: boolean;\n /**\n * Adds `aria-label` to the select element.\n */\n ariaLabel?: string;\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n /**\n * Displayed for `filteringType=\"auto\"` when there are no matches for the filtering.\n */\n noMatch?: React.ReactNode;\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n /**\n * Called when input focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n}\n\nexport interface SelectProps extends BaseSelectProps {\n /**\n * Defines the variant of the trigger. You can use a simple label or the entire option (`label | option`)\n */\n triggerVariant?: SelectProps.TriggerVariant;\n /**\n * Specifies the currently selected option.\n * If you want to clear the selection, use `null`.\n */\n selectedOption: SelectProps.Option | null;\n /**\n * Called when the user selects an option.\n * The event `detail` contains the current `selectedOption`.\n */\n onChange?: NonCancelableEventHandler<SelectProps.ChangeDetail>;\n\n /**\n * Automatically focuses the trigger when component is mounted.\n */\n autoFocus?: boolean;\n}\n\nexport namespace SelectProps {\n export type FilteringType = OptionsFilteringType;\n export type TriggerVariant = 'label' | 'option';\n\n export type Option = OptionDefinition;\n export type OptionGroup = OptionGroupDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n\n export interface ChangeDetail {\n selectedOption: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the element without opening the dropdown or showing a visual focus indicator.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["select/interfaces.ts"],"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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { OptionDefinition, OptionGroup as OptionGroupDefinition } from '../internal/components/option/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsFilteringType,\n OptionsLoadItemsDetail,\n} from '../internal/components/dropdown/interfaces';\n\nexport interface BaseSelectProps\n extends BaseDropdownHostProps,\n BaseComponentProps,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: SelectProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Determines whether the whole select component is disabled.\n */\n disabled?: boolean;\n /**\n * Specifies the placeholder to display in the filtering input if filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n /**\n * Adds an `aria-label` on the built-in filtering input if filtering is enabled.\n */\n filteringAriaLabel?: string;\n /**\n * Adds an `aria-label` to the clear button inside the search input.\n * @i18n\n */\n filteringClearAriaLabel?: string;\n /**\n * @deprecated Has no effect.\n */\n name?: string;\n /**\n * Specifies the hint text that's displayed in the field when no option has been selected.\n */\n placeholder?: string;\n /**\n * Specifies the ID for the trigger component. It uses an automatically generated ID by default.\n */\n controlId?: string;\n /**\n * Adds `aria-required` to the native input element.\n */\n ariaRequired?: boolean;\n /**\n * Adds `aria-label` to the select element.\n */\n ariaLabel?: string;\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n /**\n * Displayed for `filteringType=\"auto\"` when there are no matches for the filtering.\n */\n noMatch?: React.ReactNode;\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n /**\n * Called when input focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n}\n\nexport interface SelectProps extends BaseSelectProps {\n /**\n * Defines the variant of the trigger. You can use a simple label or the entire option (`label | option`)\n */\n triggerVariant?: SelectProps.TriggerVariant;\n /**\n * Specifies the currently selected option.\n * If you want to clear the selection, use `null`.\n */\n selectedOption: SelectProps.Option | null;\n /**\n * Called when the user selects an option.\n * The event `detail` contains the current `selectedOption`.\n */\n onChange?: NonCancelableEventHandler<SelectProps.ChangeDetail>;\n\n /**\n * Automatically focuses the trigger when component is mounted.\n */\n autoFocus?: boolean;\n}\n\nexport namespace SelectProps {\n export type FilteringType = OptionsFilteringType;\n export type TriggerVariant = 'label' | 'option';\n\n export type Option = OptionDefinition;\n export type OptionGroup = OptionGroupDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n\n export interface ChangeDetail {\n selectedOption: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the element without opening the dropdown or showing a visual focus indicator.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["split-panel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAkBjE,OAAO,EAAE,eAAe,EAAE,CAAC;AAK3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,qBAA6B,EAC7B,aAA0B,EAC1B,WAAW,EACX,GAAG,SAAS,EACb,EAAE,eAAe,eAsRjB"}
|
package/split-panel/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
|
21
21
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
22
22
|
import { SplitPanelContentSide } from './side';
|
|
23
23
|
import { SplitPanelContentBottom } from './bottom';
|
|
24
|
+
import { useInternalI18n } from '../internal/i18n/context';
|
|
24
25
|
const MIN_HEIGHT = 160;
|
|
25
26
|
const MIN_WIDTH = 280;
|
|
26
27
|
export default function SplitPanel(_a) {
|
|
@@ -29,15 +30,17 @@ export default function SplitPanel(_a) {
|
|
|
29
30
|
const { __internalRootRef } = useBaseComponent('SplitPanel');
|
|
30
31
|
const { size, getMaxWidth, getMaxHeight, position, topOffset, bottomOffset, rightOffset, contentWidthStyles, isOpen, isForcedPosition, onPreferencesChange, onResize, onToggle, reportSize, setSplitPanelToggle, refs, } = useSplitPanelContext();
|
|
31
32
|
const baseProps = getBaseProps(restProps);
|
|
33
|
+
const i18n = useInternalI18n('split-panel');
|
|
32
34
|
const [isPreferencesOpen, setPreferencesOpen] = useState(false);
|
|
33
35
|
const [relativeSize, setRelativeSize] = useState(0);
|
|
34
36
|
const [maxSize, setMaxSize] = useState(size);
|
|
35
37
|
const minSize = position === 'bottom' ? MIN_HEIGHT : MIN_WIDTH;
|
|
36
38
|
const cappedSize = getLimitedValue(minSize, size, maxSize);
|
|
37
39
|
const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;
|
|
40
|
+
const openButtonAriaLabel = i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel);
|
|
38
41
|
useEffect(() => {
|
|
39
|
-
setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel:
|
|
40
|
-
}, [setSplitPanelToggle,
|
|
42
|
+
setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });
|
|
43
|
+
}, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);
|
|
41
44
|
useEffect(() => {
|
|
42
45
|
// effects are called inside out in the components tree
|
|
43
46
|
// wait one frame to allow app-layout to complete its calculations
|
|
@@ -90,10 +93,10 @@ export default function SplitPanel(_a) {
|
|
|
90
93
|
React.createElement("h2", { className: styles['header-text'], id: panelHeaderId }, header),
|
|
91
94
|
React.createElement("div", { className: styles['header-actions'] },
|
|
92
95
|
!hidePreferencesButton && isOpen && (React.createElement(React.Fragment, null,
|
|
93
|
-
React.createElement(InternalButton, { className: styles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18nStrings.preferencesTitle, ref: refs.preferences }),
|
|
96
|
+
React.createElement(InternalButton, { className: styles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18n('i18nStrings.preferencesTitle', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesTitle), ref: refs.preferences }),
|
|
94
97
|
React.createElement("span", { className: styles.divider }))),
|
|
95
|
-
isOpen ? (React.createElement(InternalButton, { className: styles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: styles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
|
|
96
|
-
const resizeHandle = (React.createElement("div", { ref: refs.slider, role: "slider", tabIndex: 0, "aria-label": i18nStrings.resizeHandleAriaLabel, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": position === 'bottom' ? relativeSize : 100 - relativeSize, className: clsx(styles.slider, styles[`slider-${position}`]), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
|
|
98
|
+
isOpen ? (React.createElement(InternalButton, { className: styles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18n('i18nStrings.closeButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.closeButtonAriaLabel), ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: styles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel), ref: refs.toggle, ariaExpanded: isOpen })))));
|
|
99
|
+
const resizeHandle = (React.createElement("div", { ref: refs.slider, role: "slider", tabIndex: 0, "aria-label": i18n('i18nStrings.resizeHandleAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.resizeHandleAriaLabel), "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": position === 'bottom' ? relativeSize : 100 - relativeSize, className: clsx(styles.slider, styles[`slider-${position}`]), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
|
|
97
100
|
React.createElement(ResizeHandler, { className: clsx(styles['slider-icon'], styles[`slider-icon-${position}`]) })));
|
|
98
101
|
/*
|
|
99
102
|
This effect forces the browser to recalculate the layout
|
|
@@ -129,16 +132,16 @@ export default function SplitPanel(_a) {
|
|
|
129
132
|
return React.createElement(React.Fragment, null);
|
|
130
133
|
}
|
|
131
134
|
return (React.createElement(Transition, { in: isOpen !== null && isOpen !== void 0 ? isOpen : false }, (state, transitioningElementRef) => (React.createElement(React.Fragment, null,
|
|
132
|
-
position === 'side' && (React.createElement(SplitPanelContentSide, { resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: cappedSize, onToggle: onToggle, i18nStrings: i18nStrings, toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId }, wrappedChildren)),
|
|
135
|
+
position === 'side' && (React.createElement(SplitPanelContentSide, { resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: cappedSize, onToggle: onToggle, openButtonAriaLabel: i18n('i18nStrings.openButtonAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.openButtonAriaLabel), toggleRef: refs.toggle, header: wrappedHeader, panelHeaderId: panelHeaderId }, wrappedChildren)),
|
|
133
136
|
position === 'bottom' && (React.createElement(SplitPanelContentBottom, { resizeHandle: resizeHandle, baseProps: baseProps, isOpen: isOpen, splitPanelRef: mergedRef, cappedSize: cappedSize, onToggle: onToggle, header: wrappedHeader, panelHeaderId: panelHeaderId, state: state, transitioningElementRef: transitioningElementRef, appLayoutMaxWidth: appLayoutMaxWidth }, wrappedChildren)),
|
|
134
137
|
isPreferencesOpen && (React.createElement(PreferencesModal, { visible: true, preferences: { position }, disabledSidePosition: position === 'bottom' && isForcedPosition, isRefresh: isRefresh, i18nStrings: {
|
|
135
|
-
header: i18nStrings.preferencesTitle,
|
|
136
|
-
confirm: i18nStrings.preferencesConfirm,
|
|
137
|
-
cancel: i18nStrings.preferencesCancel,
|
|
138
|
-
positionLabel: i18nStrings.preferencesPositionLabel,
|
|
139
|
-
positionDescription: i18nStrings.preferencesPositionDescription,
|
|
140
|
-
positionBottom: i18nStrings.preferencesPositionBottom,
|
|
141
|
-
positionSide: i18nStrings.preferencesPositionSide,
|
|
138
|
+
header: i18n('i18nStrings.preferencesTitle', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesTitle),
|
|
139
|
+
confirm: i18n('i18nStrings.preferencesConfirm', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesConfirm),
|
|
140
|
+
cancel: i18n('i18nStrings.preferencesCancel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesCancel),
|
|
141
|
+
positionLabel: i18n('i18nStrings.preferencesPositionLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionLabel),
|
|
142
|
+
positionDescription: i18n('i18nStrings.preferencesPositionDescription', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionDescription),
|
|
143
|
+
positionBottom: i18n('i18nStrings.preferencesPositionBottom', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionBottom),
|
|
144
|
+
positionSide: i18n('i18nStrings.preferencesPositionSide', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.preferencesPositionSide),
|
|
142
145
|
}, onConfirm: preferences => {
|
|
143
146
|
onPreferencesChange(Object.assign({}, preferences));
|
|
144
147
|
setPreferencesOpen(false);
|