@cloudscape-design/components 3.0.840 → 3.0.841
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/annotation-context/annotation/annotation-icon.d.ts +2 -1
- package/annotation-context/annotation/annotation-icon.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-icon.js.map +1 -1
- package/annotation-context/annotation/annotation-popover.d.ts +2 -1
- package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-popover.js.map +1 -1
- package/annotation-context/annotation/annotation-trigger.d.ts +1 -1
- package/annotation-context/annotation/annotation-trigger.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-trigger.js.map +1 -1
- package/annotation-context/annotation/closed-annotation.d.ts +2 -1
- package/annotation-context/annotation/closed-annotation.d.ts.map +1 -1
- package/annotation-context/annotation/closed-annotation.js.map +1 -1
- package/annotation-context/annotation/open-annotation.d.ts +2 -1
- package/annotation-context/annotation/open-annotation.d.ts.map +1 -1
- package/annotation-context/annotation/open-annotation.js.map +1 -1
- package/app-layout/classic.d.ts.map +1 -1
- package/app-layout/classic.js +7 -3
- package/app-layout/classic.js.map +1 -1
- package/app-layout/defaults.d.ts +2 -1
- package/app-layout/defaults.d.ts.map +1 -1
- package/app-layout/defaults.js.map +1 -1
- package/app-layout/split-panel/split-panel-forced-position.d.ts +5 -0
- package/app-layout/split-panel/split-panel-forced-position.d.ts.map +1 -0
- package/app-layout/split-panel/split-panel-forced-position.js +30 -0
- package/app-layout/split-panel/split-panel-forced-position.js.map +1 -0
- package/app-layout/utils/use-resize.d.ts +1 -1
- package/app-layout/utils/use-resize.d.ts.map +1 -1
- package/app-layout/utils/use-resize.js.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.d.ts +2 -1
- package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +5 -8
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/drawers.d.ts +0 -8
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +1 -1
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/compute-layout.js +6 -2
- package/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +32 -2
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.d.ts +1 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.js +3 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +3 -5
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +4 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/area-chart/elements/area-series.d.ts +1 -1
- package/area-chart/elements/area-series.d.ts.map +1 -1
- package/area-chart/elements/area-series.js.map +1 -1
- package/area-chart/elements/threshold-series.d.ts +1 -1
- package/area-chart/elements/threshold-series.d.ts.map +1 -1
- package/area-chart/elements/threshold-series.js.map +1 -1
- package/attribute-editor/internal.d.ts.map +1 -1
- package/attribute-editor/internal.js +5 -1
- package/attribute-editor/internal.js.map +1 -1
- package/attribute-editor/row.d.ts +2 -1
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js.map +1 -1
- package/autosuggest/analytics-metadata/interfaces.d.ts +0 -4
- package/autosuggest/analytics-metadata/interfaces.d.ts.map +1 -1
- package/autosuggest/analytics-metadata/interfaces.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.map +1 -1
- package/autosuggest/internal.d.ts +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/load-more-controller.d.ts +3 -2
- package/autosuggest/load-more-controller.d.ts.map +1 -1
- package/autosuggest/load-more-controller.js.map +1 -1
- package/autosuggest/options-list.d.ts +2 -1
- package/autosuggest/options-list.d.ts.map +1 -1
- package/autosuggest/options-list.js.map +1 -1
- package/breadcrumb-group/analytics-metadata/interfaces.d.ts +0 -7
- package/breadcrumb-group/analytics-metadata/interfaces.d.ts.map +1 -1
- package/breadcrumb-group/analytics-metadata/interfaces.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +4 -3
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/item-element/index.d.ts +0 -7
- package/button-dropdown/item-element/index.d.ts.map +1 -1
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/mobile-expandable-group/mobile-expandable-group.d.ts +1 -1
- package/button-dropdown/mobile-expandable-group/mobile-expandable-group.d.ts.map +1 -1
- package/button-dropdown/mobile-expandable-group/mobile-expandable-group.js.map +1 -1
- package/button-dropdown/tooltip.d.ts +2 -1
- package/button-dropdown/tooltip.d.ts.map +1 -1
- package/button-dropdown/tooltip.js.map +1 -1
- package/button-dropdown/utils/menu-item.d.ts +3 -2
- package/button-dropdown/utils/menu-item.d.ts.map +1 -1
- package/button-dropdown/utils/menu-item.js.map +1 -1
- package/calendar/grid/index.d.ts +2 -1
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js.map +1 -1
- package/code-editor/pane.d.ts +2 -1
- package/code-editor/pane.d.ts.map +1 -1
- package/code-editor/pane.js.map +1 -1
- package/collection-preferences/analytics-metadata/interfaces.d.ts +0 -24
- package/collection-preferences/analytics-metadata/interfaces.d.ts.map +1 -1
- package/collection-preferences/analytics-metadata/interfaces.js.map +1 -1
- package/collection-preferences/content-display/content-display-option.d.ts +1 -1
- package/collection-preferences/content-display/content-display-option.d.ts.map +1 -1
- package/collection-preferences/content-display/content-display-option.js.map +1 -1
- package/collection-preferences/content-display/index.d.ts.map +1 -1
- package/collection-preferences/content-display/index.js +18 -42
- package/collection-preferences/content-display/index.js.map +1 -1
- package/collection-preferences/content-display/styles.css.js +12 -13
- package/collection-preferences/content-display/styles.scoped.css +15 -44
- package/collection-preferences/content-display/styles.selectors.js +12 -13
- package/collection-preferences/styles.css.js +38 -39
- package/collection-preferences/styles.scoped.css +42 -71
- package/collection-preferences/styles.selectors.js +38 -39
- package/copy-to-clipboard/internal.d.ts +2 -1
- package/copy-to-clipboard/internal.d.ts.map +1 -1
- package/copy-to-clipboard/internal.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts +2 -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/grids/monthly-grid.d.ts +2 -1
- package/date-range-picker/calendar/grids/monthly-grid.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/monthly-grid.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.map +1 -1
- package/date-range-picker/dropdown.d.ts +2 -2
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +1 -1
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +2 -1
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/relative-range/index.d.ts +2 -1
- package/date-range-picker/relative-range/index.d.ts.map +1 -1
- package/date-range-picker/relative-range/index.js.map +1 -1
- package/drawer/implementation.d.ts +2 -1
- package/drawer/implementation.d.ts.map +1 -1
- package/drawer/implementation.js.map +1 -1
- package/drawer/interfaces.d.ts +2 -1
- package/drawer/interfaces.d.ts.map +1 -1
- package/drawer/interfaces.js.map +1 -1
- package/expandable-section/expandable-section-container.d.ts +2 -1
- package/expandable-section/expandable-section-container.d.ts.map +1 -1
- package/expandable-section/expandable-section-container.js.map +1 -1
- package/expandable-section/expandable-section-header.d.ts +0 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +1 -1
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/internal.d.ts +2 -1
- package/expandable-section/internal.d.ts.map +1 -1
- package/expandable-section/internal.js.map +1 -1
- package/file-token-group/file-token.d.ts +1 -1
- package/file-token-group/file-token.d.ts.map +1 -1
- package/file-token-group/file-token.js.map +1 -1
- package/file-upload/interfaces.d.ts +0 -5
- package/file-upload/interfaces.d.ts.map +1 -1
- package/file-upload/interfaces.js.map +1 -1
- package/flashbar/analytics-metadata/interfaces.d.ts +0 -6
- package/flashbar/analytics-metadata/interfaces.d.ts.map +1 -1
- package/flashbar/analytics-metadata/interfaces.js.map +1 -1
- package/flashbar/collapsible-flashbar.d.ts +0 -1
- package/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/flash.d.ts +2 -1
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js.map +1 -1
- package/flashbar/non-collapsible-flashbar.d.ts +0 -1
- package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
- package/flashbar/non-collapsible-flashbar.js.map +1 -1
- package/flashbar/utils.d.ts +2 -1
- package/flashbar/utils.d.ts.map +1 -1
- package/flashbar/utils.js.map +1 -1
- package/grid/internal.d.ts +1 -1
- package/grid/internal.d.ts.map +1 -1
- package/grid/internal.js.map +1 -1
- package/help-panel/implementation.d.ts +2 -1
- package/help-panel/implementation.d.ts.map +1 -1
- package/help-panel/implementation.js.map +1 -1
- package/i18n/context.d.ts +1 -1
- package/i18n/context.d.ts.map +1 -1
- package/i18n/context.js.map +1 -1
- package/i18n/testing.d.ts +2 -1
- package/i18n/testing.d.ts.map +1 -1
- package/i18n/testing.js.map +1 -1
- package/internal/analytics/components/analytics-funnel.d.ts +0 -1
- package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/internal/analytics/components/analytics-funnel.js +1 -1
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/analytics/interfaces.d.ts +17 -24
- package/internal/analytics/interfaces.d.ts.map +1 -1
- package/internal/analytics/interfaces.js.map +1 -1
- package/internal/analytics/selectors.d.ts +1 -1
- package/internal/analytics/selectors.d.ts.map +1 -1
- package/internal/analytics/selectors.js +2 -1
- package/internal/analytics/selectors.js.map +1 -1
- package/internal/components/autosuggest-input/index.d.ts +2 -2
- package/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/internal/components/autosuggest-input/index.js.map +1 -1
- package/internal/components/cartesian-chart/highlighted-point.d.ts +1 -1
- package/internal/components/cartesian-chart/highlighted-point.d.ts.map +1 -1
- package/internal/components/cartesian-chart/highlighted-point.js.map +1 -1
- package/internal/components/cartesian-chart/scales.d.ts +4 -5
- package/internal/components/cartesian-chart/scales.d.ts.map +1 -1
- package/internal/components/cartesian-chart/scales.js +1 -1
- package/internal/components/cartesian-chart/scales.js.map +1 -1
- package/internal/components/cartesian-chart/vertical-marker.d.ts +1 -1
- package/internal/components/cartesian-chart/vertical-marker.d.ts.map +1 -1
- package/internal/components/cartesian-chart/vertical-marker.js.map +1 -1
- package/internal/components/chart-filter/index.d.ts +1 -1
- package/internal/components/chart-filter/index.d.ts.map +1 -1
- package/internal/components/chart-filter/index.js.map +1 -1
- package/internal/components/chart-legend/index.d.ts +1 -1
- package/internal/components/chart-legend/index.d.ts.map +1 -1
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/chart-plot/application-controller.d.ts +1 -1
- package/internal/components/chart-plot/application-controller.d.ts.map +1 -1
- package/internal/components/chart-plot/application-controller.js.map +1 -1
- package/internal/components/chart-plot/focus-outline.d.ts +2 -1
- package/internal/components/chart-plot/focus-outline.d.ts.map +1 -1
- package/internal/components/chart-plot/focus-outline.js.map +1 -1
- package/internal/components/chart-plot/index.d.ts +1 -1
- package/internal/components/chart-plot/index.d.ts.map +1 -1
- package/internal/components/chart-plot/index.js.map +1 -1
- package/internal/components/chart-popover/index.d.ts +1 -1
- package/internal/components/chart-popover/index.d.ts.map +1 -1
- package/internal/components/chart-popover/index.js.map +1 -1
- package/internal/components/chart-series-details/index.d.ts +1 -1
- package/internal/components/chart-series-details/index.d.ts.map +1 -1
- package/internal/components/chart-series-details/index.js.map +1 -1
- package/internal/components/checkbox-icon/index.d.ts +1 -10
- package/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/internal/components/checkbox-icon/index.js +1 -1
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/components/dnd-container/index.d.ts +28 -0
- package/internal/components/dnd-container/index.d.ts.map +1 -0
- package/internal/components/dnd-container/index.js +67 -0
- package/internal/components/dnd-container/index.js.map +1 -0
- package/internal/components/dnd-container/interfaces.d.ts +13 -0
- package/internal/components/dnd-container/interfaces.d.ts.map +1 -0
- package/internal/components/dnd-container/interfaces.js +4 -0
- package/internal/components/dnd-container/interfaces.js.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/defaults.d.ts.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/defaults.js.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/index.d.ts.map +1 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/index.js +1 -1
- package/internal/components/dnd-container/keyboard-sensor/index.js.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/events.d.ts +7 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/events.d.ts.map +1 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/utilities/events.js +0 -4
- package/internal/components/dnd-container/keyboard-sensor/utilities/events.js.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/listeners.d.ts.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/listeners.js.map +1 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/scroll.d.ts +8 -0
- package/internal/components/dnd-container/keyboard-sensor/utilities/scroll.d.ts.map +1 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/utilities/scroll.js +2 -2
- package/internal/components/dnd-container/keyboard-sensor/utilities/scroll.js.map +1 -0
- package/internal/components/dnd-container/styles.css.js +6 -0
- package/internal/components/dnd-container/styles.scoped.css +168 -0
- package/internal/components/dnd-container/styles.selectors.js +7 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/use-drag-and-drop-reorder.d.ts +2 -4
- package/internal/components/dnd-container/use-drag-and-drop-reorder.d.ts.map +1 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/use-drag-and-drop-reorder.js +4 -4
- package/internal/components/dnd-container/use-drag-and-drop-reorder.js.map +1 -0
- package/internal/components/dnd-container/use-live-announcements.d.ts +11 -0
- package/internal/components/dnd-container/use-live-announcements.d.ts.map +1 -0
- package/{collection-preferences/content-display → internal/components/dnd-container}/use-live-announcements.js +6 -6
- package/internal/components/dnd-container/use-live-announcements.js.map +1 -0
- package/internal/components/dropdown/dropdown-fit-handler.d.ts +0 -30
- package/internal/components/dropdown/dropdown-fit-handler.d.ts.map +1 -1
- package/internal/components/dropdown/dropdown-fit-handler.js +4 -4
- package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
- package/internal/components/focus-lock/utils.d.ts +0 -1
- package/internal/components/focus-lock/utils.d.ts.map +1 -1
- package/internal/components/focus-lock/utils.js +1 -1
- package/internal/components/focus-lock/utils.js.map +1 -1
- package/internal/components/masked-input/index.d.ts +1 -2
- package/internal/components/masked-input/index.d.ts.map +1 -1
- package/internal/components/masked-input/index.js +0 -1
- package/internal/components/masked-input/index.js.map +1 -1
- package/internal/components/masked-input/utils/mask-format.d.ts +1 -1
- package/internal/components/masked-input/utils/mask-format.d.ts.map +1 -1
- package/internal/components/masked-input/utils/mask-format.js.map +1 -1
- package/internal/components/option/highlight-match.d.ts +2 -1
- package/internal/components/option/highlight-match.d.ts.map +1 -1
- package/internal/components/option/highlight-match.js.map +1 -1
- package/internal/components/option/interfaces.d.ts +3 -2
- package/internal/components/option/interfaces.d.ts.map +1 -1
- package/internal/components/option/interfaces.js.map +1 -1
- package/internal/components/options-list/utils/use-highlight-option.d.ts +2 -1
- package/internal/components/options-list/utils/use-highlight-option.d.ts.map +1 -1
- package/internal/components/options-list/utils/use-highlight-option.js +2 -2
- package/internal/components/options-list/utils/use-highlight-option.js.map +1 -1
- package/internal/components/screenreader-only/index.d.ts +2 -1
- package/internal/components/screenreader-only/index.d.ts.map +1 -1
- package/internal/components/screenreader-only/index.js.map +1 -1
- package/internal/components/tab-trap/index.d.ts +2 -1
- package/internal/components/tab-trap/index.d.ts.map +1 -1
- package/internal/components/tab-trap/index.js.map +1 -1
- package/internal/components/transition/index.d.ts +2 -1
- package/internal/components/transition/index.d.ts.map +1 -1
- package/internal/components/transition/index.js.map +1 -1
- package/internal/context/single-tab-stop-navigation-context.d.ts +2 -4
- package/internal/context/single-tab-stop-navigation-context.d.ts.map +1 -1
- package/internal/context/single-tab-stop-navigation-context.js.map +1 -1
- package/internal/context/table-component-context.d.ts +2 -2
- package/internal/context/table-component-context.d.ts.map +1 -1
- package/internal/context/table-component-context.js +1 -1
- package/internal/context/table-component-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/hooks/forward-focus/radio-group.d.ts +2 -1
- package/internal/hooks/forward-focus/radio-group.d.ts.map +1 -1
- package/internal/hooks/forward-focus/radio-group.js.map +1 -1
- package/internal/hooks/use-dynamic-overlap/index.d.ts +2 -1
- package/internal/hooks/use-dynamic-overlap/index.d.ts.map +1 -1
- package/internal/hooks/use-dynamic-overlap/index.js.map +1 -1
- package/internal/keycode.d.ts +1 -5
- package/internal/keycode.d.ts.map +1 -1
- package/internal/keycode.js +0 -4
- package/internal/keycode.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/action-buttons.d.ts +1 -1
- package/internal/plugins/controllers/action-buttons.d.ts.map +1 -1
- package/internal/plugins/controllers/action-buttons.js.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.d.ts +3 -3
- package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
- package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
- package/internal/plugins/controllers/app-layout-widget.d.ts +1 -1
- package/internal/plugins/controllers/app-layout-widget.d.ts.map +1 -1
- package/internal/plugins/controllers/app-layout-widget.js.map +1 -1
- package/internal/plugins/controllers/drawers.d.ts +4 -4
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/internal/utils/handle-key.d.ts +2 -1
- package/internal/utils/handle-key.d.ts.map +1 -1
- package/internal/utils/handle-key.js.map +1 -1
- package/internal/utils/throttle.d.ts +2 -1
- package/internal/utils/throttle.d.ts.map +1 -1
- package/internal/utils/throttle.js.map +1 -1
- package/live-region/internal.d.ts +1 -1
- package/live-region/internal.d.ts.map +1 -1
- package/live-region/internal.js.map +1 -1
- package/mixed-line-bar-chart/bar-groups.d.ts +2 -1
- package/mixed-line-bar-chart/bar-groups.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-groups.js.map +1 -1
- package/mixed-line-bar-chart/bar-series.d.ts +2 -1
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/data-series.d.ts +2 -1
- package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/data-series.js.map +1 -1
- package/mixed-line-bar-chart/interfaces.d.ts +0 -2
- package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/mixed-line-bar-chart/line-series.d.ts +2 -1
- package/mixed-line-bar-chart/line-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/line-series.js.map +1 -1
- package/modal/index.d.ts.map +1 -1
- package/modal/index.js +8 -2
- package/modal/index.js.map +1 -1
- package/multiselect/analytics-metadata/interfaces.d.ts +0 -4
- package/multiselect/analytics-metadata/interfaces.d.ts.map +1 -1
- package/multiselect/analytics-metadata/interfaces.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/interfaces.d.ts +2 -1
- package/pie-chart/interfaces.d.ts.map +1 -1
- package/pie-chart/interfaces.js.map +1 -1
- package/pie-chart/labels.d.ts +1 -1
- package/pie-chart/labels.d.ts.map +1 -1
- package/pie-chart/labels.js.map +1 -1
- package/pie-chart/pie-chart.d.ts +2 -7
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js.map +1 -1
- package/popover/arrow.d.ts +1 -1
- package/popover/arrow.d.ts.map +1 -1
- package/popover/arrow.js.map +1 -1
- package/popover/container.d.ts +2 -1
- package/popover/container.d.ts.map +1 -1
- package/popover/container.js.map +1 -1
- package/prompt-input/internal.d.ts +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js.map +1 -1
- package/property-filter/analytics-metadata/interfaces.d.ts +0 -15
- package/property-filter/analytics-metadata/interfaces.d.ts.map +1 -1
- package/property-filter/analytics-metadata/interfaces.js.map +1 -1
- package/property-filter/controller.d.ts +0 -1
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/controller.js +1 -1
- package/property-filter/controller.js.map +1 -1
- package/property-filter/interfaces.d.ts +1 -6
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/internal.d.ts +0 -2
- package/property-filter/internal.d.ts.map +1 -1
- package/property-filter/internal.js.map +1 -1
- package/property-filter/utils.d.ts +0 -1
- package/property-filter/utils.d.ts.map +1 -1
- package/property-filter/utils.js +1 -1
- package/property-filter/utils.js.map +1 -1
- package/s3-resource-selector/s3-modal/basic-table.d.ts +0 -6
- package/s3-resource-selector/s3-modal/basic-table.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/basic-table.js +1 -1
- package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
- package/segmented-control/segment.d.ts +2 -1
- package/segmented-control/segment.d.ts.map +1 -1
- package/segmented-control/segment.js.map +1 -1
- package/select/analytics-metadata/interfaces.d.ts +0 -4
- package/select/analytics-metadata/interfaces.d.ts.map +1 -1
- package/select/analytics-metadata/interfaces.js.map +1 -1
- package/select/utils/render-options.d.ts +2 -1
- package/select/utils/render-options.d.ts.map +1 -1
- package/select/utils/render-options.js.map +1 -1
- package/select/utils/use-native-search.d.ts +0 -1
- package/select/utils/use-native-search.d.ts.map +1 -1
- package/select/utils/use-native-search.js +1 -1
- package/select/utils/use-native-search.js.map +1 -1
- package/side-navigation/analytics-metadata/interfaces.d.ts +0 -2
- package/side-navigation/analytics-metadata/interfaces.d.ts.map +1 -1
- package/side-navigation/analytics-metadata/interfaces.js.map +1 -1
- package/side-navigation/implementation.d.ts +2 -1
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/parts.d.ts +2 -2
- package/side-navigation/parts.d.ts.map +1 -1
- package/side-navigation/parts.js.map +1 -1
- package/slider/internal.d.ts +2 -1
- package/slider/internal.d.ts.map +1 -1
- package/slider/internal.js.map +1 -1
- package/slider/slider-labels.d.ts +2 -1
- package/slider/slider-labels.d.ts.map +1 -1
- package/slider/slider-labels.js.map +1 -1
- package/slider/tick-marks.d.ts +2 -4
- package/slider/tick-marks.d.ts.map +1 -1
- package/slider/tick-marks.js.map +1 -1
- package/split-panel/bottom.d.ts.map +1 -1
- package/split-panel/bottom.js +13 -3
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/implementation.js +1 -1
- package/split-panel/implementation.js.map +1 -1
- package/split-panel/styles.css.js +26 -26
- package/split-panel/styles.scoped.css +43 -48
- package/split-panel/styles.selectors.js +26 -26
- package/steps/internal.d.ts +1 -1
- package/steps/internal.d.ts.map +1 -1
- package/steps/internal.js +1 -1
- package/steps/internal.js.map +1 -1
- package/table/interfaces.d.ts +3 -2
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.js +2 -2
- package/table/internal.js.map +1 -1
- package/table/progressive-loading/loader-cell.d.ts +2 -1
- package/table/progressive-loading/loader-cell.d.ts.map +1 -1
- package/table/progressive-loading/loader-cell.js.map +1 -1
- package/table/selection/utils.d.ts +0 -1
- package/table/selection/utils.d.ts.map +1 -1
- package/table/selection/utils.js +1 -1
- package/table/selection/utils.js.map +1 -1
- package/table/sticky-columns/use-sticky-columns.d.ts +1 -21
- package/table/sticky-columns/use-sticky-columns.d.ts.map +1 -1
- package/table/sticky-columns/use-sticky-columns.js +1 -1
- package/table/sticky-columns/use-sticky-columns.js.map +1 -1
- package/table/table-role/grid-navigation.js +10 -0
- package/table/table-role/grid-navigation.js.map +1 -1
- package/table/table-role/index.d.ts +1 -1
- package/table/table-role/index.d.ts.map +1 -1
- package/table/table-role/index.js.map +1 -1
- package/table/use-cell-editing.d.ts +1 -1
- package/table/use-cell-editing.d.ts.map +1 -1
- package/table/use-cell-editing.js.map +1 -1
- package/tabs/tab-header-bar.d.ts +2 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js.map +1 -1
- package/tag-editor/internal.d.ts +2 -1
- package/tag-editor/internal.d.ts.map +1 -1
- package/tag-editor/internal.js.map +1 -1
- package/test-utils/dom/anchor-navigation/index.d.ts +2 -1
- package/test-utils/dom/anchor-navigation/index.js +0 -2
- package/test-utils/dom/anchor-navigation/index.js.map +1 -1
- package/test-utils/dom/autosuggest/index.d.ts +0 -3
- package/test-utils/dom/autosuggest/index.js +1 -2
- package/test-utils/dom/autosuggest/index.js.map +1 -1
- package/test-utils/dom/cards/index.d.ts +3 -2
- package/test-utils/dom/cards/index.js +0 -3
- package/test-utils/dom/cards/index.js.map +1 -1
- package/test-utils/dom/key-value-pairs/index.d.ts +3 -2
- package/test-utils/dom/key-value-pairs/index.js +0 -3
- package/test-utils/dom/key-value-pairs/index.js.map +1 -1
- package/test-utils/dom/steps/index.d.ts +2 -1
- package/test-utils/dom/steps/index.js +0 -2
- package/test-utils/dom/steps/index.js.map +1 -1
- package/test-utils/dom/tabs/index.d.ts +2 -1
- package/test-utils/dom/tabs/index.js +0 -2
- package/test-utils/dom/tabs/index.js.map +1 -1
- package/test-utils/dom/tag-editor/index.d.ts +2 -1
- package/test-utils/dom/tag-editor/index.js +0 -2
- package/test-utils/dom/tag-editor/index.js.map +1 -1
- package/test-utils/selectors/anchor-navigation/index.d.ts +2 -1
- package/test-utils/selectors/anchor-navigation/index.js +0 -2
- package/test-utils/selectors/anchor-navigation/index.js.map +1 -1
- package/test-utils/selectors/autosuggest/index.d.ts +0 -3
- package/test-utils/selectors/autosuggest/index.js +1 -2
- package/test-utils/selectors/autosuggest/index.js.map +1 -1
- package/test-utils/selectors/cards/index.d.ts +3 -2
- package/test-utils/selectors/cards/index.js +0 -3
- package/test-utils/selectors/cards/index.js.map +1 -1
- package/test-utils/selectors/key-value-pairs/index.d.ts +3 -2
- package/test-utils/selectors/key-value-pairs/index.js +0 -3
- package/test-utils/selectors/key-value-pairs/index.js.map +1 -1
- package/test-utils/selectors/steps/index.d.ts +2 -1
- package/test-utils/selectors/steps/index.js +0 -2
- package/test-utils/selectors/steps/index.js.map +1 -1
- package/test-utils/selectors/tabs/index.d.ts +2 -1
- package/test-utils/selectors/tabs/index.js +0 -2
- package/test-utils/selectors/tabs/index.js.map +1 -1
- package/test-utils/selectors/tag-editor/index.d.ts +2 -1
- package/test-utils/selectors/tag-editor/index.js +0 -2
- package/test-utils/selectors/tag-editor/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/text-filter/analytics-metadata/interfaces.d.ts +0 -2
- package/text-filter/analytics-metadata/interfaces.d.ts.map +1 -1
- package/text-filter/analytics-metadata/interfaces.js.map +1 -1
- package/toggle-button/internal.d.ts +0 -1
- package/toggle-button/internal.d.ts.map +1 -1
- package/toggle-button/internal.js +0 -1
- package/toggle-button/internal.js.map +1 -1
- package/token-group/analytics-metadata/interfaces.d.ts +0 -2
- package/token-group/analytics-metadata/interfaces.d.ts.map +1 -1
- package/token-group/analytics-metadata/interfaces.js.map +1 -1
- package/top-navigation/1.0-beta/internal.d.ts +2 -1
- package/top-navigation/1.0-beta/internal.d.ts.map +1 -1
- package/top-navigation/1.0-beta/internal.js.map +1 -1
- package/top-navigation/1.0-beta/parts/overflow-menu.d.ts +2 -1
- package/top-navigation/1.0-beta/parts/overflow-menu.d.ts.map +1 -1
- package/top-navigation/1.0-beta/parts/overflow-menu.js.map +1 -1
- package/top-navigation/1.0-beta/use-top-navigation.d.ts +4 -24
- package/top-navigation/1.0-beta/use-top-navigation.d.ts.map +1 -1
- package/top-navigation/1.0-beta/use-top-navigation.js +2 -2
- package/top-navigation/1.0-beta/use-top-navigation.js.map +1 -1
- package/top-navigation/internal.d.ts +2 -1
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/parts/overflow-menu/router.d.ts +1 -10
- package/top-navigation/parts/overflow-menu/router.d.ts.map +1 -1
- package/top-navigation/parts/overflow-menu/router.js +1 -1
- package/top-navigation/parts/overflow-menu/router.js.map +1 -1
- package/top-navigation/use-top-navigation.d.ts +4 -3
- package/top-navigation/use-top-navigation.d.ts.map +1 -1
- package/top-navigation/use-top-navigation.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task-list.d.ts +2 -1
- package/tutorial-panel/components/tutorial-detail-view/task-list.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task-list.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts +2 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/wizard/analytics-metadata/interfaces.d.ts +0 -21
- package/wizard/analytics-metadata/interfaces.d.ts.map +1 -1
- package/wizard/analytics-metadata/interfaces.js.map +1 -1
- package/wizard/wizard-form.d.ts +1 -4
- 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/collection-preferences/content-display/draggable-option.d.ts +0 -9
- package/collection-preferences/content-display/draggable-option.d.ts.map +0 -1
- package/collection-preferences/content-display/draggable-option.js +0 -27
- package/collection-preferences/content-display/draggable-option.js.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/defaults.d.ts.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/defaults.js.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/index.d.ts.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/index.js.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/events.d.ts +0 -11
- package/collection-preferences/content-display/keyboard-sensor/utilities/events.d.ts.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/events.js.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/listeners.d.ts.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/listeners.js.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/scroll.d.ts +0 -30
- package/collection-preferences/content-display/keyboard-sensor/utilities/scroll.d.ts.map +0 -1
- package/collection-preferences/content-display/keyboard-sensor/utilities/scroll.js.map +0 -1
- package/collection-preferences/content-display/use-drag-and-drop-reorder.d.ts.map +0 -1
- package/collection-preferences/content-display/use-drag-and-drop-reorder.js.map +0 -1
- package/collection-preferences/content-display/use-live-announcements.d.ts +0 -12
- package/collection-preferences/content-display/use-live-announcements.d.ts.map +0 -1
- package/collection-preferences/content-display/use-live-announcements.js.map +0 -1
- package/internal/hooks/use-mutation-observer/index.d.ts +0 -8
- package/internal/hooks/use-mutation-observer/index.d.ts.map +0 -1
- package/internal/hooks/use-mutation-observer/index.js +0 -26
- package/internal/hooks/use-mutation-observer/index.js.map +0 -1
- /package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/defaults.d.ts +0 -0
- /package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/defaults.js +0 -0
- /package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/index.d.ts +0 -0
- /package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/utilities/listeners.d.ts +0 -0
- /package/{collection-preferences/content-display → internal/components/dnd-container}/keyboard-sensor/utilities/listeners.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-top-navigation.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/use-top-navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,
|
|
1
|
+
{"version":3,"file":"use-top-navigation.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/use-top-navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,EAAE,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;CACzD;AAED,UAAU,eAAe;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EA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CAAC,iBAAiB,CAAC;QAC3F,MAAM,kBAAkB,GAAG,aAAa,GAAG,WAAW,GAAG,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,CAAC;QAClH,IAAI,kBAAkB,IAAI,cAAc,GAAG,qBAAqB,EAAE;YAChE,OAAO,KAAK,CAAC;SACd;KACF;IAED,wDAAwD;IACxD,OAAO,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { TopNavigationProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface UseTopNavigationParams {\n identity: TopNavigationProps['identity'];\n search: TopNavigationProps['search'];\n utilities: NonNullable<TopNavigationProps['utilities']>;\n}\n\nexport interface ResponsiveState {\n hideUtilityText?: boolean;\n hideSearch?: boolean;\n hideUtilities?: number[];\n hideTitle?: boolean;\n}\n\nexport interface TopNavigationSizeConfiguration {\n hasSearch: boolean;\n availableWidth: number;\n utilitiesLeftPadding: number;\n fullIdentityWidth: number;\n titleWidth: number;\n searchSlotWidth: number;\n searchUtilityWidth: number;\n utilityWithLabelWidths: number[];\n utilityWithoutLabelWidths: number[];\n menuTriggerUtilityWidth: number;\n}\n\nexport interface UseTopNavigation {\n mainRef: React.Ref<HTMLDivElement>;\n virtualRef: React.Ref<HTMLDivElement>;\n\n responsiveState: ResponsiveState;\n breakpoint: 'default' | 'xxs' | 's';\n isSearchExpanded: boolean;\n onSearchUtilityClick: () => void;\n}\n\n// A small buffer to make calculations more lenient against browser lag or padding adjustments.\nconst RESPONSIVENESS_BUFFER = 20;\n\nexport function useTopNavigation({ identity, search, utilities }: UseTopNavigationParams): UseTopNavigation {\n // Refs and breakpoints\n const mainRef = useRef<HTMLElement | null>(null);\n const virtualRef = useRef<HTMLDivElement | null>(null);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['xxs', 's']);\n\n // Responsiveness state\n // The component works by calculating the possible resize states that it can\n // be in, and having a state variable to track which state we're currently in.\n const hasSearch = !!search;\n const hasTitleWithLogo = identity && !!identity.logo && !!identity.title;\n const responsiveStates = useMemo<ReadonlyArray<ResponsiveState>>(() => {\n return generateResponsiveStateKeys(utilities, hasSearch, hasTitleWithLogo);\n }, [utilities, hasSearch, hasTitleWithLogo]);\n\n // To hide/show elements dynamically, we need to know how much space they take up,\n // even if they're not being rendered. The top navigation elements are hidden/resized\n // based on the available size or if a search bar is open, and they need to be available\n // for calculations so we know where to toggle them. So we render a second, more stable\n // top-nav off screen to do these calculations against.\n //\n // We can't \"affix\" these values to pixels because they can depend on spacing tokens.\n // It's easier to render all of these utilities separately rather than figuring out\n // spacing token values, icon sizes, text widths, etc.\n const [responsiveState, setResponsiveState] = useState<ResponsiveState | undefined>();\n const recalculateFit = useCallback(() => {\n if (!mainRef?.current || !virtualRef.current) {\n setResponsiveState(responsiveStates[0]);\n return;\n }\n\n // Get available width from the visible top navigation.\n const availableWidth = getContentBoxWidth(mainRef.current.querySelector(`.${styles['padding-box']}`)!);\n if (availableWidth === 0) {\n // Likely in an SSR or Jest situation.\n setResponsiveState(responsiveStates[0]);\n return;\n }\n\n const sizeConfiguration = {\n hasSearch,\n availableWidth,\n\n // Get widths from the hidden top navigation\n fullIdentityWidth: virtualRef.current.querySelector(`.${styles.identity}`)!.getBoundingClientRect().width,\n titleWidth: virtualRef.current.querySelector(`.${styles.title}`)?.getBoundingClientRect().width ?? 0,\n searchSlotWidth: virtualRef.current.querySelector(`.${styles.search}`)?.getBoundingClientRect().width ?? 0,\n searchUtilityWidth: virtualRef.current.querySelector('[data-utility-special=\"search\"]')!.getBoundingClientRect()\n .width,\n utilitiesLeftPadding: parseFloat(\n getComputedStyle(virtualRef.current.querySelector(`.${styles.utilities}`)!).paddingLeft || '0px'\n ),\n utilityWithLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"false\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n utilityWithoutLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"true\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n menuTriggerUtilityWidth: virtualRef.current\n .querySelector('[data-utility-special=\"menu-trigger\"]')!\n .getBoundingClientRect().width,\n };\n setResponsiveState(determineBestResponsiveState(responsiveStates, sizeConfiguration));\n }, [responsiveStates, hasSearch]);\n\n const [, containerQueryRef] = useContainerQuery(() => {\n recalculateFit();\n }, [recalculateFit]);\n\n // Due to being rendered in a portal, the virtual navigation isn't rendered\n // at the same time as the main one.\n const onVirtualMount = useCallback(\n (element: HTMLDivElement | null) => {\n virtualRef.current = element;\n recalculateFit();\n },\n [recalculateFit]\n );\n\n // Search slot expansion on small screens\n const [isSearchMinimized, setSearchMinimized] = useState(true);\n const isSearchExpanded = !isSearchMinimized && hasSearch && responsiveState?.hideSearch;\n\n // If the search was expanded, and then the screen resized so that the\n // expansion is no longer necessary. So we implicitly minimize it.\n useEffect(() => {\n if (!responsiveState?.hideSearch) {\n setSearchMinimized(true);\n }\n }, [responsiveState]);\n\n // If the search is expanded after clicking on the search utility, move\n // the focus to the input. Since this is a user-controlled slot, we're just\n // assuming that it contains an input, though it's a pretty safe guess.\n useEffect(() => {\n if (isSearchExpanded) {\n mainRef?.current?.querySelector<HTMLInputElement>(`.${styles.search} input`)?.focus();\n }\n }, [isSearchExpanded, mainRef]);\n\n const mergedMainRef = useMergeRefs(mainRef, containerQueryRef, breakpointRef);\n\n return {\n mainRef: mergedMainRef,\n virtualRef: onVirtualMount,\n responsiveState: responsiveState ?? responsiveStates[0],\n breakpoint: breakpoint ?? 'default',\n isSearchExpanded: !!isSearchExpanded,\n onSearchUtilityClick: () => setSearchMinimized(isSearchMinimized => !isSearchMinimized),\n };\n}\n\n/**\n * Get the width of the content box (assuming the element's box-sizing is border-box).\n */\nfunction getContentBoxWidth(element: Element): number {\n const style = getComputedStyle(element);\n return (\n parseFloat(style.width || '0px') - parseFloat(style.paddingLeft || '0px') - parseFloat(style.paddingRight || '0px')\n );\n}\n\n/**\n * Generates the series of responsive steps that can be performed on the header in order.\n */\nexport function generateResponsiveStateKeys(\n utilities: ReadonlyArray<TopNavigationProps.Utility>,\n canHideSearch: boolean,\n canHideTitle: boolean\n): ReadonlyArray<ResponsiveState> {\n const states: ResponsiveState[] = [{}];\n if (utilities.some(utility => utility.text)) {\n states.push({ hideUtilityText: true });\n }\n if (canHideSearch) {\n states.push({\n hideUtilityText: true,\n hideSearch: true,\n });\n }\n const hiddenUtilties = [];\n for (let i = 0; i < utilities.length; i++) {\n if (!utilities[i].disableUtilityCollapse) {\n hiddenUtilties.push(i);\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n });\n }\n }\n if (canHideTitle) {\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n hideTitle: true,\n });\n }\n return states;\n}\n\n/**\n * Determines the best responsive state configuration of the top navigation, based on the given list of possible responsive states\n * and the current sizes of all elements inside the navigation bar.\n */\nexport function determineBestResponsiveState(\n possibleStates: ReadonlyArray<ResponsiveState>,\n sizes: TopNavigationSizeConfiguration\n): ResponsiveState {\n const {\n hasSearch,\n availableWidth,\n utilitiesLeftPadding,\n fullIdentityWidth,\n titleWidth,\n searchSlotWidth,\n searchUtilityWidth,\n utilityWithLabelWidths,\n utilityWithoutLabelWidths,\n menuTriggerUtilityWidth,\n } = sizes;\n // Iterate through each state and calculate its expected required width.\n for (const state of possibleStates) {\n const searchWidth = hasSearch ? (state.hideSearch ? searchUtilityWidth : searchSlotWidth) : 0;\n const utilitiesWidth: number = (state.hideUtilityText ? utilityWithoutLabelWidths : utilityWithLabelWidths)\n .filter((_width, i) => !state.hideUtilities || state.hideUtilities.indexOf(i) === -1)\n .reduce((sum, width) => sum + width, 0);\n const menuTriggerWidth = state.hideUtilities ? menuTriggerUtilityWidth : 0;\n const identityWidth = state.hideTitle ? fullIdentityWidth - titleWidth : fullIdentityWidth;\n const expectedInnerWidth = identityWidth + searchWidth + utilitiesLeftPadding + utilitiesWidth + menuTriggerWidth;\n if (expectedInnerWidth <= availableWidth - RESPONSIVENESS_BUFFER) {\n return state;\n }\n }\n\n // If nothing matches, pick the smallest possible state.\n return possibleStates[possibleStates.length - 1];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-top-navigation.js","sourceRoot":"","sources":["../../../src/top-navigation/use-top-navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAsCrC,+FAA+F;AAC/F,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAA0B;IACtF,uBAAuB;IACvB,MAAM,OAAO,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,uBAAuB,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IA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BAAsB,CAAC;aACxG,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;aACpF,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;QAC1C,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAC3F,MAAM,kBAAkB,GAAG,aAAa,GAAG,WAAW,GAAG,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,CAAC;QAClH,IAAI,kBAAkB,IAAI,cAAc,GAAG,qBAAqB,EAAE;YAChE,OAAO,KAAK,CAAC;SACd;KACF;IAED,wDAAwD;IACxD,OAAO,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\n\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { TopNavigationProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface UseTopNavigationParams {\n identity: TopNavigationProps['identity'];\n search: TopNavigationProps['search'];\n utilities: NonNullable<TopNavigationProps['utilities']>;\n}\n\ninterface ResponsiveState {\n hideUtilityText?: boolean;\n hideSearch?: boolean;\n hideUtilities?: number[];\n hideTitle?: boolean;\n}\n\nexport interface TopNavigationSizeConfiguration {\n hasSearch: boolean;\n availableWidth: number;\n utilitiesLeftPadding: number;\n fullIdentityWidth: number;\n titleWidth: number;\n searchSlotWidth: number;\n searchUtilityWidth: number;\n utilityWithLabelWidths: number[];\n utilityWithoutLabelWidths: number[];\n menuTriggerUtilityWidth: number;\n}\n\ninterface UseTopNavigation {\n mainRef: React.Ref<HTMLDivElement>;\n virtualRef: React.Ref<HTMLDivElement>;\n\n responsiveState: ResponsiveState;\n breakpoint: 'default' | 'xxs' | 's';\n isSearchExpanded: boolean;\n onSearchUtilityClick: () => void;\n}\n\n// A small buffer to make calculations more lenient against browser lag or padding adjustments.\nconst RESPONSIVENESS_BUFFER = 20;\n\nexport function useTopNavigation({ identity, search, utilities }: UseTopNavigationParams): UseTopNavigation {\n // Refs and breakpoints\n const mainRef = useRef<HTMLElement | null>(null);\n const virtualRef = useRef<HTMLDivElement | null>(null);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['xxs', 's']);\n\n // Responsiveness state\n // The component works by calculating the possible resize states that it can\n // be in, and having a state variable to track which state we're currently in.\n const hasSearch = !!search;\n const hasTitleWithLogo = identity && !!identity.logo && !!identity.title;\n const responsiveStates = useMemo<ReadonlyArray<ResponsiveState>>(() => {\n return generateResponsiveStateKeys(utilities, hasSearch, hasTitleWithLogo);\n }, [utilities, hasSearch, hasTitleWithLogo]);\n\n // To hide/show elements dynamically, we need to know how much space they take up,\n // even if they're not being rendered. The top navigation elements are hidden/resized\n // based on the available size or if a search bar is open, and they need to be available\n // for calculations so we know where to toggle them. So we render a second, more stable\n // top-nav off screen to do these calculations against.\n //\n // We can't \"affix\" these values to pixels because they can depend on spacing tokens.\n // It's easier to render all of these utilities separately rather than figuring out\n // spacing token values, icon sizes, text widths, etc.\n const [responsiveState, setResponsiveState] = useState<ResponsiveState | undefined>();\n const recalculateFit = useCallback(() => {\n if (!mainRef?.current || !virtualRef.current) {\n setResponsiveState(responsiveStates[0]);\n return;\n }\n\n // Get available width from the visible top navigation.\n const availableWidth = getContentBoxWidth(mainRef.current.querySelector(`.${styles['padding-box']}`)!);\n if (availableWidth === 0) {\n // Likely in an SSR or Jest situation.\n setResponsiveState(responsiveStates[0]);\n return;\n }\n\n const sizeConfiguration = {\n hasSearch,\n availableWidth,\n\n // Get widths from the hidden top navigation\n fullIdentityWidth: virtualRef.current.querySelector(`.${styles.identity}`)!.getBoundingClientRect().width,\n titleWidth: virtualRef.current.querySelector(`.${styles.title}`)?.getBoundingClientRect().width ?? 0,\n searchSlotWidth: virtualRef.current.querySelector(`.${styles.search}`)?.getBoundingClientRect().width ?? 0,\n searchUtilityWidth: virtualRef.current.querySelector('[data-utility-special=\"search\"]')!.getBoundingClientRect()\n .width,\n utilitiesLeftPadding: parseFloat(\n getComputedStyle(virtualRef.current.querySelector(`.${styles.utilities}`)!).paddingLeft || '0px'\n ),\n utilityWithLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"false\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n utilityWithoutLabelWidths: Array.prototype.slice\n .call(virtualRef.current.querySelectorAll(`[data-utility-hide=\"true\"]`))\n .map((element: Element) => element.getBoundingClientRect().width),\n menuTriggerUtilityWidth: virtualRef.current\n .querySelector('[data-utility-special=\"menu-trigger\"]')!\n .getBoundingClientRect().width,\n };\n setResponsiveState(determineBestResponsiveState(responsiveStates, sizeConfiguration));\n }, [responsiveStates, hasSearch]);\n\n const [, containerQueryRef] = useContainerQuery(() => {\n recalculateFit();\n }, [recalculateFit]);\n\n // Due to being rendered in a portal, the virtual navigation isn't rendered\n // at the same time as the main one.\n const onVirtualMount = useCallback(\n (element: HTMLDivElement | null) => {\n virtualRef.current = element;\n recalculateFit();\n },\n [recalculateFit]\n );\n\n // Search slot expansion on small screens\n const [isSearchMinimized, setSearchMinimized] = useState(true);\n const isSearchExpanded = !isSearchMinimized && hasSearch && responsiveState?.hideSearch;\n\n // If the search was expanded, and then the screen resized so that the\n // expansion is no longer necessary. So we implicitly minimize it.\n useEffect(() => {\n if (!responsiveState?.hideSearch) {\n setSearchMinimized(true);\n }\n }, [responsiveState]);\n\n // If the search is expanded after clicking on the search utility, move\n // the focus to the input. Since this is a user-controlled slot, we're just\n // assuming that it contains an input, though it's a pretty safe guess.\n useEffect(() => {\n if (isSearchExpanded) {\n mainRef?.current?.querySelector<HTMLInputElement>(`.${styles.search} input`)?.focus();\n }\n }, [isSearchExpanded, mainRef]);\n\n const mergedMainRef = useMergeRefs(mainRef, containerQueryRef, breakpointRef);\n\n return {\n mainRef: mergedMainRef,\n virtualRef: onVirtualMount,\n responsiveState: responsiveState ?? responsiveStates[0],\n breakpoint: breakpoint ?? 'default',\n isSearchExpanded: !!isSearchExpanded,\n onSearchUtilityClick: () => setSearchMinimized(isSearchMinimized => !isSearchMinimized),\n };\n}\n\n/**\n * Get the width of the content box (assuming the element's box-sizing is border-box).\n */\nfunction getContentBoxWidth(element: Element): number {\n const style = getComputedStyle(element);\n return (\n parseFloat(style.width || '0px') - parseFloat(style.paddingLeft || '0px') - parseFloat(style.paddingRight || '0px')\n );\n}\n\n/**\n * Generates the series of responsive steps that can be performed on the header in order.\n */\nexport function generateResponsiveStateKeys(\n utilities: ReadonlyArray<TopNavigationProps.Utility>,\n canHideSearch: boolean,\n canHideTitle: boolean\n): ReadonlyArray<ResponsiveState> {\n const states: ResponsiveState[] = [{}];\n if (utilities.some(utility => utility.text)) {\n states.push({ hideUtilityText: true });\n }\n if (canHideSearch) {\n states.push({\n hideUtilityText: true,\n hideSearch: true,\n });\n }\n const hiddenUtilties = [];\n for (let i = 0; i < utilities.length; i++) {\n if (!utilities[i].disableUtilityCollapse) {\n hiddenUtilties.push(i);\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n });\n }\n }\n if (canHideTitle) {\n states.push({\n hideUtilityText: true,\n hideSearch: canHideSearch || undefined,\n hideUtilities: hiddenUtilties.length > 0 ? hiddenUtilties.slice() : undefined,\n hideTitle: true,\n });\n }\n return states;\n}\n\n/**\n * Determines the best responsive state configuration of the top navigation, based on the given list of possible responsive states\n * and the current sizes of all elements inside the navigation bar.\n */\nexport function determineBestResponsiveState(\n possibleStates: ReadonlyArray<ResponsiveState>,\n sizes: TopNavigationSizeConfiguration\n): ResponsiveState {\n const {\n hasSearch,\n availableWidth,\n utilitiesLeftPadding,\n fullIdentityWidth,\n titleWidth,\n searchSlotWidth,\n searchUtilityWidth,\n utilityWithLabelWidths,\n utilityWithoutLabelWidths,\n menuTriggerUtilityWidth,\n } = sizes;\n // Iterate through each state and calculate its expected required width.\n for (const state of possibleStates) {\n const searchWidth = hasSearch ? (state.hideSearch ? searchUtilityWidth : searchSlotWidth) : 0;\n const utilitiesWidth: number = (state.hideUtilityText ? utilityWithoutLabelWidths : utilityWithLabelWidths)\n .filter((_width, i) => !state.hideUtilities || state.hideUtilities.indexOf(i) === -1)\n .reduce((sum, width) => sum + width, 0);\n const menuTriggerWidth = state.hideUtilities ? menuTriggerUtilityWidth : 0;\n const identityWidth = state.hideTitle ? fullIdentityWidth - titleWidth : fullIdentityWidth;\n const expectedInnerWidth = identityWidth + searchWidth + utilitiesLeftPadding + utilitiesWidth + menuTriggerWidth;\n if (expectedInnerWidth <= availableWidth - RESPONSIVENESS_BUFFER) {\n return state;\n }\n }\n\n // If nothing matches, pick the smallest possible state.\n return possibleStates[possibleStates.length - 1];\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HotspotContext } from '../../../annotation-context/context';
|
|
3
3
|
import { TutorialPanelProps } from '../../interfaces';
|
|
4
|
-
|
|
4
|
+
interface TaskListProps {
|
|
5
5
|
tasks: ReadonlyArray<TutorialPanelProps.Task>;
|
|
6
6
|
onExitTutorial: () => void;
|
|
7
7
|
currentGlobalStepIndex: HotspotContext['currentStepIndex'];
|
|
8
8
|
i18nStrings: TutorialPanelProps['i18nStrings'];
|
|
9
9
|
}
|
|
10
10
|
export declare function TaskList({ tasks, onExitTutorial, currentGlobalStepIndex, i18nStrings }: TaskListProps): JSX.Element;
|
|
11
|
+
export {};
|
|
11
12
|
//# sourceMappingURL=task-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-detail-view/task-list.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKtD,
|
|
1
|
+
{"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-detail-view/task-list.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAKrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKtD,UAAU,aAAa;IACrB,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC9C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,sBAAsB,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAC3D,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,WAAW,EAAE,EAAE,aAAa,eAmCrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-list.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-detail-view/task-list.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,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ACV,SAAS,EAAE,KAAK,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAA,aAAa,CAAC,KAAK,CAAC,mCAAI,KAAK,EACvC,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,GACxB,CACH,CAAA;SAAA,CAAC,CACC;QACL,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;YAClC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,EAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAC3F,WAAW,CAAC,yBAAyB,CACvB,CACL,CACO,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useState } from 'react';\n\nimport { HotspotContext } from '../../../annotation-context/context';\nimport { getStepInfo } from '../../../annotation-context/utils';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport { TutorialPanelProps } from '../../interfaces';\nimport { Task } from './task';\n\nimport styles from './styles.css.js';\n\
|
|
1
|
+
{"version":3,"file":"task-list.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-detail-view/task-list.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,MAAM,MAA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,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;YAClC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,EAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAC3F,WAAW,CAAC,yBAAyB,CACvB,CACL,CACO,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useState } from 'react';\n\nimport { HotspotContext } from '../../../annotation-context/context';\nimport { getStepInfo } from '../../../annotation-context/utils';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport { TutorialPanelProps } from '../../interfaces';\nimport { Task } from './task';\n\nimport styles from './styles.css.js';\n\ninterface TaskListProps {\n tasks: ReadonlyArray<TutorialPanelProps.Task>;\n onExitTutorial: () => void;\n currentGlobalStepIndex: HotspotContext['currentStepIndex'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n}\n\nexport function TaskList({ tasks, onExitTutorial, currentGlobalStepIndex, i18nStrings }: TaskListProps) {\n const currentTaskIndex = getStepInfo(tasks, currentGlobalStepIndex ?? 0).taskIndex;\n const [expandedTasks, setExpandedTasks] = useState({ [currentTaskIndex]: true });\n\n const onToggleExpand = useCallback((stepIndex: number) => {\n setExpandedTasks(prevTasks => ({ ...prevTasks, [stepIndex]: !prevTasks[stepIndex] }));\n }, []);\n\n // When the user progresses to a different task, all tasks except this one are collapsed.\n useEffect(() => {\n setExpandedTasks({ [currentTaskIndex]: true });\n }, [currentTaskIndex]);\n\n return (\n <InternalSpaceBetween size=\"xxl\">\n <ol className={styles['tutorial-list']}>\n {tasks.map((task, index) => (\n <Task\n task={task}\n key={index}\n taskIndex={index}\n currentTaskIndex={currentTaskIndex}\n expanded={expandedTasks[index] ?? false}\n onToggleExpand={onToggleExpand}\n i18nStrings={i18nStrings}\n />\n ))}\n </ol>\n <InternalBox margin={{ top: 'xxxs' }}>\n <InternalButton onClick={onExitTutorial} formAction=\"none\" className={styles['dismiss-button']}>\n {i18nStrings.dismissTutorialButtonText}\n </InternalButton>\n </InternalBox>\n </InternalSpaceBetween>\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HotspotContext } from '../../../annotation-context/context.js';
|
|
3
3
|
import { TutorialPanelProps } from '../../interfaces';
|
|
4
|
-
|
|
4
|
+
interface TutorialListProps {
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
tutorials: TutorialPanelProps['tutorials'];
|
|
7
7
|
onStartTutorial: HotspotContext['onStartTutorial'];
|
|
@@ -9,4 +9,5 @@ export interface TutorialListProps {
|
|
|
9
9
|
downloadUrl: TutorialPanelProps['downloadUrl'];
|
|
10
10
|
}
|
|
11
11
|
export default function TutorialList({ i18nStrings, tutorials, loading, onStartTutorial, downloadUrl, }: TutorialListProps): JSX.Element;
|
|
12
|
+
export {};
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAYxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAItD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAYxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAItD,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC3C,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IACnD,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAC/C,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,SAAS,EACT,OAAe,EACf,eAAe,EACf,WAAW,GACZ,EAAE,iBAAiB,eA8CnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AAGzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,S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KAAK,IAEtB,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAClF,CACL,CACO,CACnB,CACQ,CACZ,CACH,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport InternalAlert from '../../../alert/internal';\nimport { HotspotContext } from '../../../annotation-context/context.js';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalIcon from '../../../icon/internal';\nimport { fireNonCancelableEvent } from '../../../internal/events/index.js';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id/index.js';\nimport { useVisualRefresh } from '../../../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../../../internal/utils/check-safe-url';\nimport InternalLink from '../../../link/internal';\nimport InternalLiveRegion from '../../../live-region/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport { TutorialPanelProps } from '../../interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface TutorialListProps {\n loading?: boolean;\n tutorials: TutorialPanelProps['tutorials'];\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n downloadUrl: TutorialPanelProps['downloadUrl'];\n}\n\nexport default function TutorialList({\n i18nStrings,\n tutorials,\n loading = false,\n onStartTutorial,\n downloadUrl,\n}: TutorialListProps) {\n checkSafeUrl('TutorialPanel', downloadUrl);\n\n const isRefresh = useVisualRefresh();\n\n return (\n <>\n <InternalSpaceBetween size=\"s\">\n <InternalSpaceBetween size=\"m\">\n <InternalBox variant=\"h2\" fontSize={isRefresh ? 'heading-m' : 'heading-l'} padding={{ bottom: 'n' }}>\n {i18nStrings.tutorialListTitle}\n </InternalBox>\n <InternalBox variant=\"p\" color=\"text-body-secondary\" padding=\"n\">\n {i18nStrings.tutorialListDescription}\n </InternalBox>\n </InternalSpaceBetween>\n <InternalSpaceBetween size=\"l\">\n {downloadUrl && (\n <a\n href={downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={styles['download-link']}\n aria-label={i18nStrings.labelTutorialListDownloadLink}\n >\n <InternalIcon name=\"download\" />\n <InternalBox padding={{ left: 'xs' }} color=\"inherit\" fontWeight=\"bold\" display=\"inline\">\n {i18nStrings.tutorialListDownloadLinkText}\n </InternalBox>\n </a>\n )}\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">{i18nStrings.loadingText}</InternalLiveRegion>\n </InternalStatusIndicator>\n ) : (\n <ul className={styles['tutorial-list']} role=\"list\">\n {tutorials.map((tutorial, index) => (\n <Tutorial tutorial={tutorial} key={index} onStartTutorial={onStartTutorial} i18nStrings={i18nStrings} />\n ))}\n </ul>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </>\n );\n}\n\nfunction Tutorial({\n tutorial,\n onStartTutorial: onStartTutorialEventHandler,\n i18nStrings,\n}: {\n tutorial: TutorialPanelProps.Tutorial;\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n}) {\n checkSafeUrl('TutorialPanel', tutorial.learnMoreUrl);\n const controlId = useUniqueId();\n const triggerControldId = useUniqueId();\n const headerId = useUniqueId();\n\n const isRefresh = useVisualRefresh();\n\n const onStartTutorial = useCallback(() => {\n fireNonCancelableEvent(onStartTutorialEventHandler, { tutorial });\n }, [onStartTutorialEventHandler, tutorial]);\n\n const [expanded, setExpanded] = useState(!tutorial.prerequisitesNeeded && !tutorial.completed);\n\n const onClick = useCallback(() => {\n setExpanded(expanded => !expanded);\n }, []);\n\n return (\n <li className={styles['tutorial-box']} role=\"listitem\">\n <InternalSpaceBetween size=\"xs\">\n <div className={styles['tutorial-box-title']}>\n <InternalBox\n variant=\"h3\"\n fontSize={isRefresh ? 'heading-s' : 'heading-m'}\n id={headerId}\n margin={{ right: 'xs' }}\n padding=\"n\"\n className={styles.title}\n >\n {tutorial.title}\n </InternalBox>\n <div className={styles['button-wrapper']}>\n <InternalButton\n id={triggerControldId}\n variant=\"icon\"\n ariaExpanded={expanded}\n __nativeAttributes={{\n 'aria-controls': controlId,\n 'aria-labelledby': headerId,\n }}\n formAction=\"none\"\n onClick={onClick}\n className={expanded ? styles['collapse-button'] : styles['expand-button']}\n iconName={expanded ? 'angle-up' : 'angle-down'}\n />\n </div>\n </div>\n\n {tutorial.completed ? (\n <InternalStatusIndicator __size=\"inherit\" type=\"success\" className={styles.completed} wrapText={true}>\n {i18nStrings.tutorialCompletedText}\n </InternalStatusIndicator>\n ) : null}\n </InternalSpaceBetween>\n\n <div aria-live=\"polite\">\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }}>\n <div className={clsx(styles['expandable-section'], expanded && styles.expanded)} id={controlId}>\n <InternalSpaceBetween size=\"l\">\n <InternalSpaceBetween size=\"m\">\n {tutorial.prerequisitesNeeded && tutorial.prerequisitesAlert && (\n <InternalAlert type=\"info\" className={styles['prerequisites-alert']}>\n {tutorial.prerequisitesAlert}\n </InternalAlert>\n )}\n <InternalSpaceBetween size=\"s\">\n <InternalBox color=\"text-body-secondary\">\n <div\n className={clsx(\n styles['tutorial-description'],\n typeof tutorial.description === 'string' && styles['tutorial-description-plaintext']\n )}\n >\n {tutorial.description}\n </div>\n </InternalBox>\n {tutorial.learnMoreUrl && (\n <InternalLink\n href={tutorial.learnMoreUrl}\n className={styles['learn-more-link']}\n externalIconAriaLabel={i18nStrings.labelLearnMoreExternalIcon}\n ariaLabel={i18nStrings.labelLearnMoreLink}\n external={true}\n variant=\"primary\"\n >\n {i18nStrings.learnMoreLinkText}\n </InternalLink>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n\n <InternalBox margin={{ bottom: 'xxs' }}>\n <InternalButton\n onClick={onStartTutorial}\n disabled={tutorial.prerequisitesNeeded ?? false}\n formAction=\"none\"\n className={styles.start}\n >\n {tutorial.completed ? i18nStrings.restartTutorialButtonText : i18nStrings.startTutorialButtonText}\n </InternalButton>\n </InternalBox>\n </InternalSpaceBetween>\n </div>\n </CSSTransition>\n </div>\n </li>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AAGzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,SAAS,EACT,OAAO,GAAG,KAAK,EACf,eAAe,EACf,WAAW,GACO;IAClB,YAAY,CAAC,eAAe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CAAC,CAAC,WAAW,CAAC,uBAAuB,CAClF,CACL,CACO,CACnB,CACQ,CACZ,CACH,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport InternalAlert from '../../../alert/internal';\nimport { HotspotContext } from '../../../annotation-context/context.js';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalIcon from '../../../icon/internal';\nimport { fireNonCancelableEvent } from '../../../internal/events/index.js';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id/index.js';\nimport { useVisualRefresh } from '../../../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../../../internal/utils/check-safe-url';\nimport InternalLink from '../../../link/internal';\nimport InternalLiveRegion from '../../../live-region/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport { TutorialPanelProps } from '../../interfaces';\n\nimport styles from './styles.css.js';\n\ninterface TutorialListProps {\n loading?: boolean;\n tutorials: TutorialPanelProps['tutorials'];\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n downloadUrl: TutorialPanelProps['downloadUrl'];\n}\n\nexport default function TutorialList({\n i18nStrings,\n tutorials,\n loading = false,\n onStartTutorial,\n downloadUrl,\n}: TutorialListProps) {\n checkSafeUrl('TutorialPanel', downloadUrl);\n\n const isRefresh = useVisualRefresh();\n\n return (\n <>\n <InternalSpaceBetween size=\"s\">\n <InternalSpaceBetween size=\"m\">\n <InternalBox variant=\"h2\" fontSize={isRefresh ? 'heading-m' : 'heading-l'} padding={{ bottom: 'n' }}>\n {i18nStrings.tutorialListTitle}\n </InternalBox>\n <InternalBox variant=\"p\" color=\"text-body-secondary\" padding=\"n\">\n {i18nStrings.tutorialListDescription}\n </InternalBox>\n </InternalSpaceBetween>\n <InternalSpaceBetween size=\"l\">\n {downloadUrl && (\n <a\n href={downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={styles['download-link']}\n aria-label={i18nStrings.labelTutorialListDownloadLink}\n >\n <InternalIcon name=\"download\" />\n <InternalBox padding={{ left: 'xs' }} color=\"inherit\" fontWeight=\"bold\" display=\"inline\">\n {i18nStrings.tutorialListDownloadLinkText}\n </InternalBox>\n </a>\n )}\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">{i18nStrings.loadingText}</InternalLiveRegion>\n </InternalStatusIndicator>\n ) : (\n <ul className={styles['tutorial-list']} role=\"list\">\n {tutorials.map((tutorial, index) => (\n <Tutorial tutorial={tutorial} key={index} onStartTutorial={onStartTutorial} i18nStrings={i18nStrings} />\n ))}\n </ul>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </>\n );\n}\n\nfunction Tutorial({\n tutorial,\n onStartTutorial: onStartTutorialEventHandler,\n i18nStrings,\n}: {\n tutorial: TutorialPanelProps.Tutorial;\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n}) {\n checkSafeUrl('TutorialPanel', tutorial.learnMoreUrl);\n const controlId = useUniqueId();\n const triggerControldId = useUniqueId();\n const headerId = useUniqueId();\n\n const isRefresh = useVisualRefresh();\n\n const onStartTutorial = useCallback(() => {\n fireNonCancelableEvent(onStartTutorialEventHandler, { tutorial });\n }, [onStartTutorialEventHandler, tutorial]);\n\n const [expanded, setExpanded] = useState(!tutorial.prerequisitesNeeded && !tutorial.completed);\n\n const onClick = useCallback(() => {\n setExpanded(expanded => !expanded);\n }, []);\n\n return (\n <li className={styles['tutorial-box']} role=\"listitem\">\n <InternalSpaceBetween size=\"xs\">\n <div className={styles['tutorial-box-title']}>\n <InternalBox\n variant=\"h3\"\n fontSize={isRefresh ? 'heading-s' : 'heading-m'}\n id={headerId}\n margin={{ right: 'xs' }}\n padding=\"n\"\n className={styles.title}\n >\n {tutorial.title}\n </InternalBox>\n <div className={styles['button-wrapper']}>\n <InternalButton\n id={triggerControldId}\n variant=\"icon\"\n ariaExpanded={expanded}\n __nativeAttributes={{\n 'aria-controls': controlId,\n 'aria-labelledby': headerId,\n }}\n formAction=\"none\"\n onClick={onClick}\n className={expanded ? styles['collapse-button'] : styles['expand-button']}\n iconName={expanded ? 'angle-up' : 'angle-down'}\n />\n </div>\n </div>\n\n {tutorial.completed ? (\n <InternalStatusIndicator __size=\"inherit\" type=\"success\" className={styles.completed} wrapText={true}>\n {i18nStrings.tutorialCompletedText}\n </InternalStatusIndicator>\n ) : null}\n </InternalSpaceBetween>\n\n <div aria-live=\"polite\">\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }}>\n <div className={clsx(styles['expandable-section'], expanded && styles.expanded)} id={controlId}>\n <InternalSpaceBetween size=\"l\">\n <InternalSpaceBetween size=\"m\">\n {tutorial.prerequisitesNeeded && tutorial.prerequisitesAlert && (\n <InternalAlert type=\"info\" className={styles['prerequisites-alert']}>\n {tutorial.prerequisitesAlert}\n </InternalAlert>\n )}\n <InternalSpaceBetween size=\"s\">\n <InternalBox color=\"text-body-secondary\">\n <div\n className={clsx(\n styles['tutorial-description'],\n typeof tutorial.description === 'string' && styles['tutorial-description-plaintext']\n )}\n >\n {tutorial.description}\n </div>\n </InternalBox>\n {tutorial.learnMoreUrl && (\n <InternalLink\n href={tutorial.learnMoreUrl}\n className={styles['learn-more-link']}\n externalIconAriaLabel={i18nStrings.labelLearnMoreExternalIcon}\n ariaLabel={i18nStrings.labelLearnMoreLink}\n external={true}\n variant=\"primary\"\n >\n {i18nStrings.learnMoreLinkText}\n </InternalLink>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n\n <InternalBox margin={{ bottom: 'xxs' }}>\n <InternalButton\n onClick={onStartTutorial}\n disabled={tutorial.prerequisitesNeeded ?? false}\n formAction=\"none\"\n className={styles.start}\n >\n {tutorial.completed ? i18nStrings.restartTutorialButtonText : i18nStrings.startTutorialButtonText}\n </InternalButton>\n </InternalBox>\n </InternalSpaceBetween>\n </div>\n </CSSTransition>\n </div>\n </li>\n );\n}\n"]}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
2
|
-
import { WizardProps } from '../interfaces';
|
|
3
|
-
export interface GeneratedAnalyticsMetadataWizardCancel {
|
|
4
|
-
action: 'cancel';
|
|
5
|
-
detail: {
|
|
6
|
-
label: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface GeneratedAnalyticsMetadataWizardSubmit {
|
|
10
|
-
action: 'submit';
|
|
11
|
-
detail: {
|
|
12
|
-
label: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface GeneratedAnalyticsMetadataWizardNavigate {
|
|
16
|
-
action: 'navigate';
|
|
17
|
-
detail: {
|
|
18
|
-
label: string;
|
|
19
|
-
targetStepIndex: string;
|
|
20
|
-
reason: WizardProps.NavigationReason;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
2
|
export interface GeneratedAnalyticsMetadataWizardComponent {
|
|
24
3
|
name: 'awsui.Wizard';
|
|
25
4
|
label: LabelIdentifier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/wizard/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAEnG,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/wizard/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AAEnG,MAAM,WAAW,yCAAyC;IACxD,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/wizard/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/wizard/analytics-metadata/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LabelIdentifier } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nexport interface GeneratedAnalyticsMetadataWizardComponent {\n name: 'awsui.Wizard';\n label: LabelIdentifier;\n properties: {\n stepsCount: string;\n activeStepIndex: string;\n activeStepLabel: string;\n instanceIdentifier?: string;\n flowType?: string;\n resourceType?: string;\n };\n}\n"]}
|
package/wizard/wizard-form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
3
3
|
import { WizardProps } from './interfaces';
|
|
4
4
|
interface WizardFormProps extends InternalBaseComponentProps {
|
|
@@ -17,8 +17,5 @@ interface WizardFormProps extends InternalBaseComponentProps {
|
|
|
17
17
|
}
|
|
18
18
|
export declare const STEP_NAME_SELECTOR: string;
|
|
19
19
|
export default function WizardFormWithAnalytics(props: WizardFormProps): JSX.Element;
|
|
20
|
-
export declare function WizardForm({ __internalRootRef, stepHeaderRef, steps, activeStepIndex, showCollapsedSteps, i18nStrings, submitButtonText, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }: WizardFormProps & {
|
|
21
|
-
stepHeaderRef: MutableRefObject<HTMLDivElement | null>;
|
|
22
|
-
}): JSX.Element;
|
|
23
20
|
export {};
|
|
24
21
|
//# sourceMappingURL=wizard-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-form.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"wizard-form.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAanE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,UAAU,eAAgB,SAAQ,0BAA0B;IAC1D,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,kBAAkB,QAAsD,CAAC;AAEtF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,eAAe,eAuBrE"}
|
package/wizard/wizard-form.js
CHANGED
|
@@ -29,7 +29,7 @@ export default function WizardFormWithAnalytics(props) {
|
|
|
29
29
|
return (React.createElement(AnalyticsFunnelStep, { stepIdentifier: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier, stepErrorContext: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext, stepNameSelector: STEP_NAME_SELECTOR, stepNumber: props.activeStepIndex + 1 },
|
|
30
30
|
React.createElement(WizardForm, Object.assign({ stepHeaderRef: stepHeaderRef, __internalRootRef: __internalRootRef }, props))));
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
function WizardForm({ __internalRootRef, stepHeaderRef, steps, activeStepIndex, showCollapsedSteps, i18nStrings, submitButtonText, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }) {
|
|
33
33
|
var _a;
|
|
34
34
|
const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};
|
|
35
35
|
const isLastStep = activeStepIndex >= steps.length - 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-form.js","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE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+BAA+B,CAAC,CAAC,CAAC,WAAW,CAAC,6BAA6B,EAEtG,kBAAkB,EAAE,WAAW,CAAC,cAAc,EAC9C,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,EACrD,YAAY,EAAE,eAAe,KAAK,CAAC,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,iBAAiB,GAClC,EAEJ,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,IAC9C,eAAe,GAElB,OAAO,CACK,CACd,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAsC,EAAE,eAAuB;IAC5F,IAAI,qBAAqB,GAAG,eAAe,CAAC;IAC5C,GAAG;QACD,qBAAqB,EAAE,CAAC;KACzB,QAAQ,qBAAqB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE;IAE9F,OAAO,qBAAqB,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { MutableRefObject, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\nimport { useFunnel, useFunnelStep } from '../internal/analytics/hooks/use-funnel';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_STEP_NAME } from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { WizardProps } from './interfaces';\nimport WizardActions from './wizard-actions';\nimport WizardFormHeader from './wizard-form-header';\n\nimport styles from './styles.css.js';\n\ninterface WizardFormProps extends InternalBaseComponentProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n submitButtonText?: string;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport const STEP_NAME_SELECTOR = `[${DATA_ATTR_FUNNEL_KEY}=${FUNNEL_KEY_STEP_NAME}]`;\n\nexport default function WizardFormWithAnalytics(props: WizardFormProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(\n props.steps[props.activeStepIndex] as BasePropsWithAnalyticsMetadata\n );\n const __internalRootRef = useComponentMetadata('WizardForm', PACKAGE_VERSION, { ...analyticsMetadata });\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [props.activeStepIndex]);\n\n return (\n <AnalyticsFunnelStep\n stepIdentifier={analyticsMetadata?.instanceIdentifier}\n stepErrorContext={analyticsMetadata?.errorContext}\n stepNameSelector={STEP_NAME_SELECTOR}\n stepNumber={props.activeStepIndex + 1}\n >\n <WizardForm stepHeaderRef={stepHeaderRef} __internalRootRef={__internalRootRef} {...props} />\n </AnalyticsFunnelStep>\n );\n}\n\nexport function WizardForm({\n __internalRootRef,\n stepHeaderRef,\n steps,\n activeStepIndex,\n showCollapsedSteps,\n i18nStrings,\n submitButtonText,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps & { stepHeaderRef: MutableRefObject<HTMLDivElement | null> }) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n\n const { funnelInteractionId, funnelIdentifier } = useFunnel();\n const { funnelStepProps, stepErrorContext } = useFunnelStep();\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n useEffect(() => {\n if (funnelInteractionId && errorText && isLastStep) {\n FunnelMetrics.funnelError({\n funnelInteractionId,\n funnelIdentifier,\n funnelErrorContext: stepErrorContext,\n });\n }\n }, [funnelInteractionId, funnelIdentifier, isLastStep, errorText, stepErrorContext]);\n\n return (\n <>\n <WizardFormHeader>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n <span {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_STEP_NAME }}>{title}</span>\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n\n <InternalForm\n __internalRootRef={__internalRootRef}\n className={styles['form-component']}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? submitButtonText ?? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n isLastStep={isLastStep}\n activeStepIndex={activeStepIndex}\n skipToStepIndex={skipToTargetIndex}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepProps}\n >\n {content}\n </InternalForm>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"wizard-form.js","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,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AkB,EAAE,WAAW,CAAC,cAAc,EAC9C,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,EACrD,YAAY,EAAE,eAAe,KAAK,CAAC,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,iBAAiB,GAClC,EAEJ,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,IAC9C,eAAe,GAElB,OAAO,CACK,CACd,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAsC,EAAE,eAAuB;IAC5F,IAAI,qBAAqB,GAAG,eAAe,CAAC;IAC5C,GAAG;QACD,qBAAqB,EAAE,CAAC;KACzB,QAAQ,qBAAqB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE;IAE9F,OAAO,qBAAqB,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { MutableRefObject, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\nimport { useFunnel, useFunnelStep } from '../internal/analytics/hooks/use-funnel';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_STEP_NAME } from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { WizardProps } from './interfaces';\nimport WizardActions from './wizard-actions';\nimport WizardFormHeader from './wizard-form-header';\n\nimport styles from './styles.css.js';\n\ninterface WizardFormProps extends InternalBaseComponentProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n submitButtonText?: string;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport const STEP_NAME_SELECTOR = `[${DATA_ATTR_FUNNEL_KEY}=${FUNNEL_KEY_STEP_NAME}]`;\n\nexport default function WizardFormWithAnalytics(props: WizardFormProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(\n props.steps[props.activeStepIndex] as BasePropsWithAnalyticsMetadata\n );\n const __internalRootRef = useComponentMetadata('WizardForm', PACKAGE_VERSION, { ...analyticsMetadata });\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [props.activeStepIndex]);\n\n return (\n <AnalyticsFunnelStep\n stepIdentifier={analyticsMetadata?.instanceIdentifier}\n stepErrorContext={analyticsMetadata?.errorContext}\n stepNameSelector={STEP_NAME_SELECTOR}\n stepNumber={props.activeStepIndex + 1}\n >\n <WizardForm stepHeaderRef={stepHeaderRef} __internalRootRef={__internalRootRef} {...props} />\n </AnalyticsFunnelStep>\n );\n}\n\nfunction WizardForm({\n __internalRootRef,\n stepHeaderRef,\n steps,\n activeStepIndex,\n showCollapsedSteps,\n i18nStrings,\n submitButtonText,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps & { stepHeaderRef: MutableRefObject<HTMLDivElement | null> }) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n\n const { funnelInteractionId, funnelIdentifier } = useFunnel();\n const { funnelStepProps, stepErrorContext } = useFunnelStep();\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n useEffect(() => {\n if (funnelInteractionId && errorText && isLastStep) {\n FunnelMetrics.funnelError({\n funnelInteractionId,\n funnelIdentifier,\n funnelErrorContext: stepErrorContext,\n });\n }\n }, [funnelInteractionId, funnelIdentifier, isLastStep, errorText, stepErrorContext]);\n\n return (\n <>\n <WizardFormHeader>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef}>\n <span {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_STEP_NAME }}>{title}</span>\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n\n <InternalForm\n __internalRootRef={__internalRootRef}\n className={styles['form-component']}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? submitButtonText ?? i18nStrings.submitButton : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n isLastStep={isLastStep}\n activeStepIndex={activeStepIndex}\n skipToStepIndex={skipToTargetIndex}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepProps}\n >\n {content}\n </InternalForm>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { OptionWithVisibility } from './utils';
|
|
3
|
-
export default function DraggableOption({ dragHandleAriaLabel, onKeyDown, onToggle, option, }: {
|
|
4
|
-
dragHandleAriaLabel?: string;
|
|
5
|
-
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
6
|
-
onToggle: (option: OptionWithVisibility) => void;
|
|
7
|
-
option: OptionWithVisibility;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
-
//# sourceMappingURL=draggable-option.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draggable-option.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GACP,EAAE;IACD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,oBAAoB,CAAC;CAC9B,eAgCA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
5
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import ContentDisplayOption, { getClassName } from './content-display-option';
|
|
8
|
-
import styles from '../styles.css.js';
|
|
9
|
-
export default function DraggableOption({ dragHandleAriaLabel, onKeyDown, onToggle, option, }) {
|
|
10
|
-
const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({
|
|
11
|
-
id: option.id,
|
|
12
|
-
});
|
|
13
|
-
const style = {
|
|
14
|
-
transform: CSS.Translate.toString(transform),
|
|
15
|
-
};
|
|
16
|
-
const combinedListeners = Object.assign(Object.assign({}, listeners), { onKeyDown: (event) => {
|
|
17
|
-
if (onKeyDown) {
|
|
18
|
-
onKeyDown(event);
|
|
19
|
-
}
|
|
20
|
-
if (listeners === null || listeners === void 0 ? void 0 : listeners.onKeyDown) {
|
|
21
|
-
listeners.onKeyDown(event);
|
|
22
|
-
}
|
|
23
|
-
} });
|
|
24
|
-
return (React.createElement("li", { className: clsx(getClassName(), isDragging && styles.placeholder, isSorting && styles.sorting), style: style },
|
|
25
|
-
React.createElement(ContentDisplayOption, { ref: setNodeRef, listeners: combinedListeners, dragHandleAriaLabel: dragHandleAriaLabel, onToggle: onToggle, option: option, disabled: attributes['aria-disabled'] })));
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=draggable-option.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draggable-option.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/draggable-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,oBAAoB,EAAE,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,MAAM,GAMP;IACC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC1F,EAAE,EAAE,MAAM,CAAC,EAAE;KACd,CAAC,CAAC;IACH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;KAC7C,CAAC;IAEF,MAAM,iBAAiB,mCAClB,SAAS,KACZ,SAAS,EAAE,CAAC,KAA0B,EAAE,EAAE;YACxC,IAAI,SAAS,EAAE;gBACb,SAAS,CAAC,KAAK,CAAC,CAAC;aAClB;YACD,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE;gBACxB,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;aAC5B;QACH,CAAC,GACF,CAAC;IAEF,OAAO,CACL,4BAAI,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK;QAC9G,oBAAC,oBAAoB,IACnB,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,UAAU,CAAC,eAAe,CAAC,GACrC,CACC,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport clsx from 'clsx';\n\nimport ContentDisplayOption, { getClassName } from './content-display-option';\nimport { OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nexport default function DraggableOption({\n dragHandleAriaLabel,\n onKeyDown,\n onToggle,\n option,\n}: {\n dragHandleAriaLabel?: string;\n onKeyDown?: (event: React.KeyboardEvent) => void;\n onToggle: (option: OptionWithVisibility) => void;\n option: OptionWithVisibility;\n}) {\n const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({\n id: option.id,\n });\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n const combinedListeners = {\n ...listeners,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (onKeyDown) {\n onKeyDown(event);\n }\n if (listeners?.onKeyDown) {\n listeners.onKeyDown(event);\n }\n },\n };\n\n return (\n <li className={clsx(getClassName(), isDragging && styles.placeholder, isSorting && styles.sorting)} style={style}>\n <ContentDisplayOption\n ref={setNodeRef}\n listeners={combinedListeners}\n dragHandleAriaLabel={dragHandleAriaLabel}\n onToggle={onToggle}\n option={option}\n disabled={attributes['aria-disabled']}\n />\n </li>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../../src/collection-preferences/content-display/keyboard-sensor/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,aAIlC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../src/collection-preferences/content-display/keyboard-sensor/defaults.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,KAAK,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC/C,MAAM,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC;IAC1B,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;CAC9C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyboardCode, KeyboardCodes } from '@dnd-kit/core';\n\nexport const defaultKeyboardCodes: KeyboardCodes = {\n start: [KeyboardCode.Space, KeyboardCode.Enter],\n cancel: [KeyboardCode.Esc],\n end: [KeyboardCode.Space, KeyboardCode.Enter],\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/collection-preferences/content-display/keyboard-sensor/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAyB3E,qBAAa,cAAe,YAAW,cAAc;IAMvC,OAAO,CAAC,KAAK;IALlB,iBAAiB,UAAS;IACjC,OAAO,CAAC,oBAAoB,CAA0B;IACtD,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,eAAe,CAAY;gBAEf,KAAK,EAAE,mBAAmB;IAc9C,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,MAAM;IAQd,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,qBAAqB,CAAC,CAuBlD;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/collection-preferences/content-display/keyboard-sensor/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAEL,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,IAAI,mBAAmB,GAChC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,0DAA0D;AAC1D,wGAAwG;AAExG,6EAA6E;AAC7E,2DAA2D;AAC3D,sEAAsE;AACtE,yEAAyE;AAEzE,8DAA8D;AAE9D,MAAM,OAAO,cAAc;IAMzB,YAAoB,KAA0B;QAA1B,UAAK,GAAL,KAAK,CAAqB;QALvC,sBAAiB,GAAG,KAAK,CAAC;QAM/B,MAAM,EACJ,KA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ACnC,CAAC;;AAEM,yBAAU,GAAsC;IACrD;QACE,SAAS,EAAE,WAAoB;QAC/B,OAAO,EAAE,CAAC,KAA0B,EAAE,EAAE,aAAa,GAAG,oBAAoB,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1G,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC;YAEnC,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;gBAE/C,IAAI,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;oBAC3C,OAAO,KAAK,CAAC;iBACd;gBAED,KAAK,CAAC,cAAc,EAAE,CAAC;gBAEvB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAE7C,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KACF;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport type { Activators, SensorInstance } from '@dnd-kit/core';\nimport { defaultCoordinates } from '@dnd-kit/core';\nimport { KeyboardSensorOptions, KeyboardSensorProps } from '@dnd-kit/core';\nimport {\n Coordinates,\n getOwnerDocument,\n getWindow,\n isKeyboardEvent,\n subtract as getCoordinatesDelta,\n} from '@dnd-kit/utilities';\n\nimport { scrollElementIntoView } from '../../../internal/utils/scrollable-containers';\nimport { defaultKeyboardCodes } from './defaults';\nimport { EventName } from './utilities/events';\nimport { Listeners } from './utilities/listeners';\nimport { applyScroll } from './utilities/scroll';\n\n// Slightly modified version of @dnd-kit's KeyboardSensor:\n// https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/sensors/keyboard/KeyboardSensor.ts\n\n// The only difference is that here, reordering is deactivated on blur, as in\n// this PR: https://github.com/clauderic/dnd-kit/pull/1087.\n// If it is merged, then @dnd-kit's KeyboardSensor can be used instead\n// and all files under this directory (`keyboard-sensor`) can be removed.\n\n// Changes from mainstream are marked below as \"Customization\"\n\nexport class KeyboardSensor implements SensorInstance {\n public autoScrollEnabled = false;\n private referenceCoordinates: Coordinates | undefined;\n private listeners: Listeners;\n private windowListeners: Listeners;\n\n constructor(private props: KeyboardSensorProps) {\n const {\n event: { target },\n } = props;\n\n this.props = props;\n this.listeners = new Listeners(getOwnerDocument(target));\n this.windowListeners = new Listeners(getWindow(target));\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n\n this.attach();\n }\n\n private attach() {\n this.handleStart();\n\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n\n // Customization: deactivate reordering on blur event\n this.props.event.target?.addEventListener(EventName.Blur, this.handleCancel);\n\n setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));\n }\n\n private handleStart() {\n const { activeNode, onStart } = this.props;\n const node = activeNode.node.current;\n\n if (node) {\n scrollElementIntoView(node);\n }\n\n onStart(defaultCoordinates);\n }\n\n private handleKeyDown(event: Event) {\n if (isKeyboardEvent(event)) {\n const { active, context, options } = this.props;\n const { keyboardCodes = defaultKeyboardCodes, coordinateGetter } = options;\n const { code } = event;\n\n if (keyboardCodes.end.indexOf(code) !== -1) {\n this.handleEnd(event);\n return;\n }\n\n if (keyboardCodes.cancel.indexOf(code) !== -1) {\n this.handleCancel(event);\n return;\n }\n\n const { collisionRect } = context.current;\n const currentCoordinates = collisionRect ? { x: collisionRect.left, y: collisionRect.top } : defaultCoordinates;\n\n if (!this.referenceCoordinates) {\n this.referenceCoordinates = currentCoordinates;\n }\n\n if (!coordinateGetter) {\n return;\n }\n\n const newCoordinates = coordinateGetter(event, {\n active,\n context: context.current,\n currentCoordinates,\n });\n\n if (newCoordinates) {\n const { scrollableAncestors } = context.current;\n const direction = event.code;\n\n const scrolled = applyScroll({ currentCoordinates, direction, newCoordinates, scrollableAncestors });\n\n if (!scrolled) {\n this.handleMove(event, getCoordinatesDelta(newCoordinates, this.referenceCoordinates));\n }\n }\n }\n }\n\n private handleMove(event: Event, coordinates: Coordinates) {\n const { onMove } = this.props;\n\n event.preventDefault();\n onMove(coordinates);\n }\n\n private handleEnd(event: Event) {\n const { onEnd } = this.props;\n\n event.preventDefault();\n this.detach();\n onEnd();\n }\n\n private handleCancel(event: Event) {\n const { onCancel } = this.props;\n\n // Customization: do not prevent browser from managing native focus\n if (event.type !== EventName.Blur) {\n event.preventDefault();\n }\n this.detach();\n onCancel();\n }\n\n private detach() {\n // Customization: clean up listener for blur event\n this.props.event.target?.removeEventListener(EventName.Blur, this.handleCancel);\n\n this.listeners.removeAll();\n this.windowListeners.removeAll();\n }\n\n static activators: Activators<KeyboardSensorOptions> = [\n {\n eventName: 'onKeyDown' as const,\n handler: (event: React.KeyboardEvent, { keyboardCodes = defaultKeyboardCodes, onActivation }, { active }) => {\n const { code } = event.nativeEvent;\n\n if (keyboardCodes.start.indexOf(code) !== -1) {\n const activator = active.activatorNode.current;\n\n if (activator && event.target !== activator) {\n return false;\n }\n\n event.preventDefault();\n\n onActivation?.({ event: event.nativeEvent });\n\n return true;\n }\n\n return false;\n },\n },\n ];\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare enum EventName {
|
|
2
|
-
Blur = "blur",
|
|
3
|
-
Click = "click",
|
|
4
|
-
DragStart = "dragstart",
|
|
5
|
-
Keydown = "keydown",
|
|
6
|
-
ContextMenu = "contextmenu",
|
|
7
|
-
Resize = "resize",
|
|
8
|
-
SelectionChange = "selectionchange",
|
|
9
|
-
VisibilityChange = "visibilitychange"
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/events.ts"],"names":[],"mappings":"AAEA,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;IACjB,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;CACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/events.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;IACnB,wCAA2B,CAAA;IAC3B,8BAAiB,CAAA;IACjB,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;AACvC,CAAC,EATW,SAAS,KAAT,SAAS,QASpB","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport enum EventName {\n Blur = 'blur',\n Click = 'click',\n DragStart = 'dragstart',\n Keydown = 'keydown',\n ContextMenu = 'contextmenu',\n Resize = 'resize',\n SelectionChange = 'selectionchange',\n VisibilityChange = 'visibilitychange',\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/listeners.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGR,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAqG;gBAElG,MAAM,EAAE,WAAW,GAAG,IAAI;IAEvC,GAAG,CAAC,CAAC,SAAS,KAAK,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO;IAMtC,SAAS,aAEd;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/listeners.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,OAAO,SAAS;IAGpB,YAAoB,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;QAFtC,cAAS,GAAkG,EAAE,CAAC;QAa/G,cAAS,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAA,EAAA,CAAC,CAAC;QACpF,CAAC,CAAC;IAb+C,CAAC;IAE3C,GAAG,CACR,SAAiB,EACjB,OAA2B,EAC3B,OAA2C;;QAE3C,MAAA,IAAI,CAAC,MAAM,0CAAE,gBAAgB,CAAC,SAAS,EAAE,OAAwB,EAAE,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAwB,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;CAKF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport class Listeners {\n private listeners: [string, EventListenerOrEventListenerObject, AddEventListenerOptions | boolean | undefined][] = [];\n\n constructor(private target: EventTarget | null) {}\n\n public add<T extends Event>(\n eventName: string,\n handler: (event: T) => void,\n options?: AddEventListenerOptions | boolean\n ) {\n this.target?.addEventListener(eventName, handler as EventListener, options);\n this.listeners.push([eventName, handler as EventListener, options]);\n }\n\n public removeAll = () => {\n this.listeners.forEach(listener => this.target?.removeEventListener(...listener));\n };\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Coordinates } from '@dnd-kit/utilities';
|
|
2
|
-
export declare function getScrollPosition(scrollingContainer: Element): {
|
|
3
|
-
isTop: boolean;
|
|
4
|
-
isLeft: boolean;
|
|
5
|
-
isBottom: boolean;
|
|
6
|
-
isRight: boolean;
|
|
7
|
-
maxScroll: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
};
|
|
11
|
-
minScroll: {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare function getScrollElementRect(element: Element): {
|
|
17
|
-
top: number;
|
|
18
|
-
left: number;
|
|
19
|
-
right: number;
|
|
20
|
-
bottom: number;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
};
|
|
24
|
-
export declare function applyScroll({ currentCoordinates, direction, newCoordinates, scrollableAncestors, }: {
|
|
25
|
-
currentCoordinates: Coordinates;
|
|
26
|
-
direction: string;
|
|
27
|
-
newCoordinates: Coordinates;
|
|
28
|
-
scrollableAncestors: Element[];
|
|
29
|
-
}): boolean;
|
|
30
|
-
//# sourceMappingURL=scroll.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/scroll.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,WAAW,EAAmC,MAAM,oBAAoB,CAAC;AAU7F,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,OAAO;;;;;;;;;;;;;EAgC5D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO;;;;;;;EAwBpD;AAED,wBAAgB,WAAW,CAAC,EAC1B,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,mBAAmB,GACpB,EAAE;IACD,kBAAkB,EAAE,WAAW,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,WAAW,CAAC;IAC5B,mBAAmB,EAAE,OAAO,EAAE,CAAC;CAChC,WA0CA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../../../../src/collection-preferences/content-display/keyboard-sensor/utilities/scroll.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAe,QAAQ,IAAI,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,SAAS,0BAA0B,CAAC,OAAuB;IACzD,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,OAAO,KAAK,QAAQ,CAAC,gBAAgB,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,kBAA2B;IAC3D,MAAM,SAAS,GAAG;QAChB,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC;IACF,MAAM,UAAU,GAAG,0BAA0B,CAAC,kBAAkB,CAAC;QAC/D,CAAC,CAAC;YACE,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,KAAK,EAAE,MAAM,CAAC,UAAU;SACzB;QACH,CAAC,CAAC;YACE,MAAM,EAAE,kBAAkB,CAAC,YAAY;YACvC,KAAK,EAAE,kBAAkB,CAAC,WAAW;SACtC,CAAC;IACN,MAAM,SAAS,GAAG;QAChB,CAAC,EAAE,kBAAkB,CAAC,WAAW,GAAG,UAAU,CAAC,KAAK;QACpD,CAAC,EAAE,kBAAkB,CAAC,YAAY,GAAG,UAAU,CAAC,MAAM;KACvD,CAAC;IAEF,MAAM,KAAK,GAAG,kBAAkB,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,IAAI,SAAS,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ates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyboardCode } from '@dnd-kit/core';\nimport { canUseDOM, Coordinates, subtract as getCoordinatesDelta } from '@dnd-kit/utilities';\n\nfunction isDocumentScrollingElement(element: Element | null) {\n if (!canUseDOM || !element) {\n return false;\n }\n\n return element === document.scrollingElement;\n}\n\nexport function getScrollPosition(scrollingContainer: Element) {\n const minScroll = {\n x: 0,\n y: 0,\n };\n const dimensions = isDocumentScrollingElement(scrollingContainer)\n ? {\n height: window.innerHeight,\n width: window.innerWidth,\n }\n : {\n height: scrollingContainer.clientHeight,\n width: scrollingContainer.clientWidth,\n };\n const maxScroll = {\n x: scrollingContainer.scrollWidth - dimensions.width,\n y: scrollingContainer.scrollHeight - dimensions.height,\n };\n\n const isTop = scrollingContainer.scrollTop <= minScroll.y;\n const isLeft = scrollingContainer.scrollLeft <= minScroll.x;\n const isBottom = scrollingContainer.scrollTop >= maxScroll.y;\n const isRight = scrollingContainer.scrollLeft >= maxScroll.x;\n\n return {\n isTop,\n isLeft,\n isBottom,\n isRight,\n maxScroll,\n minScroll,\n };\n}\n\nexport function getScrollElementRect(element: Element) {\n if (element === document.scrollingElement) {\n const { innerWidth, innerHeight } = window;\n\n return {\n top: 0,\n left: 0,\n right: innerWidth,\n bottom: innerHeight,\n width: innerWidth,\n height: innerHeight,\n };\n }\n\n const { top, left, right, bottom } = element.getBoundingClientRect();\n\n return {\n top,\n left,\n right,\n bottom,\n width: element.clientWidth,\n height: element.clientHeight,\n };\n}\n\nexport function applyScroll({\n currentCoordinates,\n direction,\n newCoordinates,\n scrollableAncestors,\n}: {\n currentCoordinates: Coordinates;\n direction: string;\n newCoordinates: Coordinates;\n scrollableAncestors: Element[];\n}) {\n for (const scrollContainer of scrollableAncestors) {\n const coordinatesDelta = getCoordinatesDelta(newCoordinates, currentCoordinates);\n const { isTop, isBottom, maxScroll, minScroll } = getScrollPosition(scrollContainer);\n const scrollElementRect = getScrollElementRect(scrollContainer);\n\n const clampedCoordinates = {\n y: Math.min(\n direction === KeyboardCode.Down\n ? scrollElementRect.bottom - scrollElementRect.height / 2\n : scrollElementRect.bottom,\n Math.max(\n direction === KeyboardCode.Down\n ? scrollElementRect.top\n : scrollElementRect.top + scrollElementRect.height / 2,\n newCoordinates.y\n )\n ),\n };\n\n const canScrollY = (direction === KeyboardCode.Down && !isBottom) || (direction === KeyboardCode.Up && !isTop);\n\n if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {\n const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;\n const canScrollToNewCoordinates =\n (direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y) ||\n (direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y);\n\n if (canScrollToNewCoordinates) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n top: newScrollCoordinates,\n behavior: 'smooth',\n });\n return true;\n }\n\n break;\n }\n }\n return false;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-drag-and-drop-reorder.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/use-drag-and-drop-reorder.ts"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAGL,kBAAkB,EAElB,wBAAwB,EAExB,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AA8B3D,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,aAAa,GACd,EAAE;IACD,aAAa,EAAE,aAAa,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;CAC/E;;;;2BAa+B,mBAAmB;;wBARtB,gBAAgB,GAAG,IAAI;EA+GnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-drag-and-drop-reorder.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content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CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;AACnH,CAAC;AAED,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,SAAS,EACT,mBAAmB,GAKpB;IACC,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC1B,OAAO;KACR;IACD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;IAClF,IAAI,kBAAkB,EAAE;QACtB,OAAO;YACL,EAAE,EAAE,kBAAkB,CAAC,EAAE;YACzB,IAAI,EAAE;gBACJ,kBAAkB,EAAE,kBAAkB;gBACtC,KAAK,EAAE,CAAC;aACT;SACF,CAAC;KACH;AACH,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport {\n Active,\n closestCenter,\n CollisionDetection,\n DroppableContainer,\n KeyboardCoordinateGetter,\n PointerSensor,\n UniqueIdentifier,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport { hasSortableData } from '@dnd-kit/sortable';\n\nimport { CollectionPreferencesProps } from '../interfaces';\nimport { KeyboardSensor } from './keyboard-sensor';\n\nenum KeyboardCode {\n Space = 'Space',\n Down = 'ArrowDown',\n Right = 'ArrowRight',\n Left = 'ArrowLeft',\n Up = 'ArrowUp',\n Esc = 'Escape',\n Enter = 'Enter',\n}\n\n// A custom collision detection algorithm is used when using a keyboard to\n// work around an unexpected behavior when reordering items of variable height\n// with the keyboard.\n\n// Neither closestCenter nor closestCorners work really well for this case,\n// because the center (or corners) of a tall rectangle might be so low that it\n// is detected as being closest to the rectangle below of the one it should\n// actually swap with.\n\n// Instead of relying on coordinates, the expected results are achieved by\n// moving X positions up or down in the initially sorted array, depending on\n// the desired direction.\n\n// We let our collisionDetection and customCoordinateGetter use the same\n// getClosestId function which takes its value from the current component\n// state, to make sure they are always in sync.\n\nexport default function useDragAndDropReorder({\n sortedOptions,\n}: {\n sortedOptions: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n}) {\n const isKeyboard = useRef(false);\n const positionDelta = useRef(0);\n const [activeItemId, setActiveItemId] = useState<UniqueIdentifier | null>(null);\n\n const setActiveItem = (id: UniqueIdentifier | null) => {\n setActiveItemId(id);\n if (!id) {\n isKeyboard.current = false;\n positionDelta.current = 0;\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isKeyboard.current && activeItemId) {\n const currentTargetIndex = sortedOptions.findIndex(({ id }) => id === activeItemId) + positionDelta.current;\n if (event.key === 'ArrowDown' && currentTargetIndex < sortedOptions.length - 1) {\n positionDelta.current += 1;\n } else if (event.key === 'ArrowUp' && currentTargetIndex > 0) {\n positionDelta.current -= 1;\n }\n }\n if (activeItemId && isEscape(event.key)) {\n // Prevent modal from closing when pressing Esc to cancel the dragging action\n event.stopPropagation();\n }\n };\n\n const getClosestId = (active: Active) => {\n if (positionDelta.current === 0) {\n return active.id;\n }\n const currentIndex = sortedOptions.findIndex(({ id }) => id === active.id);\n const newIndex = Math.max(0, Math.min(sortedOptions.length - 1, currentIndex + positionDelta.current));\n return sortedOptions[newIndex].id;\n };\n\n const collisionDetection: CollisionDetection = ({\n active,\n collisionRect,\n droppableContainers,\n droppableRects,\n pointerCoordinates,\n }) => {\n if (isKeyboard.current) {\n // For keyboard interaction, determine the colliding container based on the movements made by the arrow keys,\n // via getClosestId\n const collidingContainer = getCollidingContainer({\n activeId: active.id,\n closestId: getClosestId(active),\n droppableContainers,\n });\n return collidingContainer ? [collidingContainer] : [];\n } else {\n // For mouse interaction, use the closest center algorithm\n return closestCenter({ active, collisionRect, droppableRects, droppableContainers, pointerCoordinates });\n }\n };\n\n const coordinateGetter: KeyboardCoordinateGetter = (\n event,\n { context: { active, collisionRect, droppableRects, droppableContainers } }\n ) => {\n if (event.code === KeyboardCode.Up || event.code === KeyboardCode.Down) {\n event.preventDefault();\n\n if (!active || !collisionRect) {\n return;\n }\n\n const closestId = getClosestId(active);\n\n if (closestId !== null) {\n const activeDroppable = droppableContainers.get(active.id);\n const newDroppable = droppableContainers.get(closestId);\n const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;\n const newNode = newDroppable?.node.current;\n\n if (newNode && newRect && activeDroppable && newDroppable) {\n const isAfterActive = isAfter(activeDroppable, newDroppable);\n const offset = {\n x: isAfterActive ? collisionRect.width - newRect.width : 0,\n y: isAfterActive ? collisionRect.height - newRect.height : 0,\n };\n const rectCoordinates = {\n x: newRect.left,\n y: newRect.top,\n };\n\n return {\n x: rectCoordinates.x - offset.x,\n y: rectCoordinates.y - offset.y,\n };\n }\n }\n }\n };\n\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter,\n onActivation: () => {\n isKeyboard.current = true;\n },\n })\n );\n\n return {\n activeItem: activeItemId,\n collisionDetection,\n coordinateGetter,\n handleKeyDown,\n sensors,\n setActiveItem,\n };\n}\n\nfunction isAfter(a: DroppableContainer, b: DroppableContainer) {\n return hasSortableData(a) && hasSortableData(b) && a.data.current.sortable.index < b.data.current.sortable.index;\n}\n\nfunction getCollidingContainer({\n activeId,\n closestId,\n droppableContainers,\n}: {\n activeId: UniqueIdentifier;\n closestId: UniqueIdentifier;\n droppableContainers: DroppableContainer[];\n}) {\n if (closestId === activeId) {\n return;\n }\n const collidingContainer = droppableContainers.find(({ id }) => id === closestId);\n if (collidingContainer) {\n return {\n id: collidingContainer.id,\n data: {\n droppableContainer: collidingContainer,\n value: 0,\n },\n };\n }\n}\n\nconst isEscape = (key: string) => key === 'Escape' || key === 'Esc';\n"]}
|