@cloudscape-design/components 3.0.220 → 3.0.222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/index.js +4 -4
- package/alert/index.js.map +1 -1
- package/alert/internal.js +14 -15
- package/alert/internal.js.map +1 -1
- package/annotation-context/annotation/annotation-icon.js +1 -2
- package/annotation-context/annotation/annotation-icon.js.map +1 -1
- package/annotation-context/annotation/annotation-popover.js +6 -7
- package/annotation-context/annotation/annotation-popover.js.map +1 -1
- package/annotation-context/annotation/annotation-trigger.js +4 -6
- package/annotation-context/annotation/annotation-trigger.js.map +1 -1
- package/annotation-context/annotation/closed-annotation.js +4 -5
- package/annotation-context/annotation/closed-annotation.js.map +1 -1
- package/annotation-context/annotation/open-annotation.js +2 -3
- package/annotation-context/annotation/open-annotation.js.map +1 -1
- package/annotation-context/context.js +7 -7
- package/annotation-context/context.js.map +1 -1
- package/annotation-context/index.js +62 -69
- package/annotation-context/index.js.map +1 -1
- package/app-layout/content-wrapper/index.js +2 -3
- package/app-layout/content-wrapper/index.js.map +1 -1
- package/app-layout/defaults.js +13 -14
- package/app-layout/defaults.js.map +1 -1
- package/app-layout/drawer.js +16 -18
- package/app-layout/drawer.js.map +1 -1
- package/app-layout/index.js +111 -113
- package/app-layout/index.js.map +1 -1
- package/app-layout/mobile-toolbar/index.js +7 -9
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/navigation-panel.js +5 -8
- package/app-layout/navigation-panel.js.map +1 -1
- package/app-layout/notifications/index.js +2 -2
- package/app-layout/notifications/index.js.map +1 -1
- package/app-layout/toggles/index.js +14 -22
- package/app-layout/toggles/index.js.map +1 -1
- package/app-layout/tools-and-split-panel.js +6 -9
- package/app-layout/tools-and-split-panel.js.map +1 -1
- package/app-layout/utils/use-content-height.js +14 -15
- package/app-layout/utils/use-content-height.js.map +1 -1
- package/app-layout/utils/use-content-width.js +8 -8
- package/app-layout/utils/use-content-width.js.map +1 -1
- package/app-layout/utils/use-focus-control.js +7 -8
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/utils/use-observed-element.js +3 -3
- package/app-layout/utils/use-observed-element.js.map +1 -1
- package/app-layout/utils/use-window-width.js +4 -4
- package/app-layout/utils/use-window-width.js.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +19 -20
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/background.js +9 -10
- package/app-layout/visual-refresh/background.js.map +1 -1
- package/app-layout/visual-refresh/context.js +101 -59
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/header.js +6 -7
- package/app-layout/visual-refresh/header.js.map +1 -1
- package/app-layout/visual-refresh/index.js +3 -4
- package/app-layout/visual-refresh/index.js.map +1 -1
- package/app-layout/visual-refresh/layout.js +18 -21
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh/main.js +17 -18
- package/app-layout/visual-refresh/main.js.map +1 -1
- package/app-layout/visual-refresh/navigation.js +22 -24
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/notifications.js +6 -7
- package/app-layout/visual-refresh/notifications.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +36 -43
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/app-layout/visual-refresh/tools.js +32 -34
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +5 -8
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/area-chart/chart-container.js +18 -19
- package/area-chart/chart-container.js.map +1 -1
- package/area-chart/elements/area-chart-filter.js +7 -8
- package/area-chart/elements/area-chart-filter.js.map +1 -1
- package/area-chart/elements/area-chart-legend.js +6 -9
- package/area-chart/elements/area-chart-legend.js.map +1 -1
- package/area-chart/elements/area-series.js +12 -13
- package/area-chart/elements/area-series.js.map +1 -1
- package/area-chart/elements/chart-popover.js +4 -6
- package/area-chart/elements/chart-popover.js.map +1 -1
- package/area-chart/elements/data-series.js +14 -17
- package/area-chart/elements/data-series.js.map +1 -1
- package/area-chart/elements/highlighted-point.js +6 -7
- package/area-chart/elements/highlighted-point.js.map +1 -1
- package/area-chart/elements/threshold-series.js +5 -7
- package/area-chart/elements/threshold-series.js.map +1 -1
- package/area-chart/elements/use-highlight-details.js +28 -30
- package/area-chart/elements/use-highlight-details.js.map +1 -1
- package/area-chart/elements/vertical-marker.js +6 -7
- package/area-chart/elements/vertical-marker.js.map +1 -1
- package/area-chart/index.js +4 -4
- package/area-chart/index.js.map +1 -1
- package/area-chart/internal.js +40 -41
- package/area-chart/internal.js.map +1 -1
- package/area-chart/model/async-store.js +23 -30
- package/area-chart/model/async-store.js.map +1 -1
- package/area-chart/model/compute-chart-props.js +11 -12
- package/area-chart/model/compute-chart-props.js.map +1 -1
- package/area-chart/model/create-series-decorator.js +11 -13
- package/area-chart/model/create-series-decorator.js.map +1 -1
- package/area-chart/model/interactions-store.js +47 -54
- package/area-chart/model/interactions-store.js.map +1 -1
- package/area-chart/model/use-chart-model.js +85 -89
- package/area-chart/model/use-chart-model.js.map +1 -1
- package/area-chart/model/use-filter-props.js +6 -6
- package/area-chart/model/use-filter-props.js.map +1 -1
- package/area-chart/model/use-highlight-props.js +6 -6
- package/area-chart/model/use-highlight-props.js.map +1 -1
- package/area-chart/model/utils.js +46 -59
- package/area-chart/model/utils.js.map +1 -1
- package/attribute-editor/additional-info.js +2 -5
- package/attribute-editor/additional-info.js.map +1 -1
- package/attribute-editor/index.js +5 -5
- package/attribute-editor/index.js.map +1 -1
- package/attribute-editor/internal.js +20 -20
- package/attribute-editor/internal.js.map +1 -1
- package/attribute-editor/row.js +17 -25
- package/attribute-editor/row.js.map +1 -1
- package/autosuggest/autosuggest-option.js +12 -12
- package/autosuggest/autosuggest-option.js.map +1 -1
- package/autosuggest/index.js +6 -6
- package/autosuggest/index.js.map +1 -1
- package/autosuggest/internal.js +39 -39
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/load-more-controller.js +10 -14
- package/autosuggest/load-more-controller.js.map +1 -1
- package/autosuggest/options-controller.js +31 -32
- package/autosuggest/options-controller.js.map +1 -1
- package/autosuggest/options-list.js +12 -13
- package/autosuggest/options-list.js.map +1 -1
- package/autosuggest/plain-list.js +15 -17
- package/autosuggest/plain-list.js.map +1 -1
- package/autosuggest/utils/utils.js +12 -12
- package/autosuggest/utils/utils.js.map +1 -1
- package/autosuggest/virtual-list.js +14 -16
- package/autosuggest/virtual-list.js.map +1 -1
- package/badge/index.js +6 -6
- package/badge/index.js.map +1 -1
- package/bar-chart/index.js +6 -6
- package/bar-chart/index.js.map +1 -1
- package/box/index.js +4 -4
- package/box/index.js.map +1 -1
- package/box/internal.js +12 -12
- package/box/internal.js.map +1 -1
- package/breadcrumb-group/index.js +4 -4
- package/breadcrumb-group/index.js.map +1 -1
- package/breadcrumb-group/internal.js +24 -25
- package/breadcrumb-group/internal.js.map +1 -1
- package/breadcrumb-group/item/item.js +32 -34
- package/breadcrumb-group/item/item.js.map +1 -1
- package/button/icon-helper.js +6 -6
- package/button/icon-helper.js.map +1 -1
- package/button/index.js +6 -6
- package/button/index.js.map +1 -1
- package/button/internal.js +32 -33
- package/button/internal.js.map +1 -1
- package/button-dropdown/category-elements/category-element.js +3 -5
- package/button-dropdown/category-elements/category-element.js.map +1 -1
- package/button-dropdown/category-elements/expandable-category-element.js +23 -26
- package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.js +27 -30
- package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/button-dropdown/index.js +6 -6
- package/button-dropdown/index.js.map +1 -1
- package/button-dropdown/internal.js +28 -29
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.js +30 -36
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/items-list.js +3 -4
- package/button-dropdown/items-list.js.map +1 -1
- package/button-dropdown/mobile-expandable-group/mobile-expandable-group.js +2 -4
- package/button-dropdown/mobile-expandable-group/mobile-expandable-group.js.map +1 -1
- package/button-dropdown/tooltip.js +22 -24
- package/button-dropdown/tooltip.js.map +1 -1
- package/button-dropdown/utils/create-items-tree.js +21 -23
- package/button-dropdown/utils/create-items-tree.js.map +1 -1
- package/button-dropdown/utils/menu-item.js +6 -9
- package/button-dropdown/utils/menu-item.js.map +1 -1
- package/button-dropdown/utils/move-highlight.js +3 -4
- package/button-dropdown/utils/move-highlight.js.map +1 -1
- package/button-dropdown/utils/use-button-dropdown.js +31 -33
- package/button-dropdown/utils/use-button-dropdown.js.map +1 -1
- package/button-dropdown/utils/use-hidden-description.js +3 -3
- package/button-dropdown/utils/use-hidden-description.js.map +1 -1
- package/button-dropdown/utils/use-highlighted-menu.js +40 -42
- package/button-dropdown/utils/use-highlighted-menu.js.map +1 -1
- package/button-dropdown/utils/utils.js +5 -9
- package/button-dropdown/utils/utils.js.map +1 -1
- package/calendar/grid/index.js +25 -28
- package/calendar/grid/index.js.map +1 -1
- package/calendar/header/header-button.js +4 -6
- package/calendar/header/header-button.js.map +1 -1
- package/calendar/header/index.js +1 -2
- package/calendar/header/index.js.map +1 -1
- package/calendar/index.js +4 -4
- package/calendar/index.js.map +1 -1
- package/calendar/internal.js +27 -27
- package/calendar/internal.js.map +1 -1
- package/calendar/utils/intl.js +12 -13
- package/calendar/utils/intl.js.map +1 -1
- package/calendar/utils/navigation.js +3 -3
- package/calendar/utils/navigation.js.map +1 -1
- package/cards/cards-layout-helper.js +12 -12
- package/cards/cards-layout-helper.js.map +1 -1
- package/cards/index.js +53 -63
- package/cards/index.js.map +1 -1
- package/checkbox/index.js +4 -4
- package/checkbox/index.js.map +1 -1
- package/checkbox/internal.d.ts +1 -0
- package/checkbox/internal.d.ts.map +1 -1
- package/checkbox/internal.js +9 -9
- package/checkbox/internal.js.map +1 -1
- package/code-editor/ace-modes.js +1 -1
- package/code-editor/ace-modes.js.map +1 -1
- package/code-editor/ace-themes.js +2 -2
- package/code-editor/ace-themes.js.map +1 -1
- package/code-editor/error-screen.js +3 -4
- package/code-editor/error-screen.js.map +1 -1
- package/code-editor/index.js +61 -65
- package/code-editor/index.js.map +1 -1
- package/code-editor/listeners.js +5 -5
- package/code-editor/listeners.js.map +1 -1
- package/code-editor/loading-screen.js +2 -2
- package/code-editor/loading-screen.js.map +1 -1
- package/code-editor/pane.js +21 -25
- package/code-editor/pane.js.map +1 -1
- package/code-editor/preferences-modal.js +12 -13
- package/code-editor/preferences-modal.js.map +1 -1
- package/code-editor/resizable-box/index.js +14 -15
- package/code-editor/resizable-box/index.js.map +1 -1
- package/code-editor/setup-editor.js +20 -20
- package/code-editor/setup-editor.js.map +1 -1
- package/code-editor/status-bar.js +19 -22
- package/code-editor/status-bar.js.map +1 -1
- package/code-editor/tab-button.js +7 -10
- package/code-editor/tab-button.js.map +1 -1
- package/code-editor/util.js +6 -6
- package/code-editor/util.js.map +1 -1
- package/collection-preferences/index.js +21 -23
- package/collection-preferences/index.js.map +1 -1
- package/collection-preferences/utils.js +25 -57
- package/collection-preferences/utils.js.map +1 -1
- package/collection-preferences/visible-content.js +23 -27
- package/collection-preferences/visible-content.js.map +1 -1
- package/column-layout/index.js +6 -6
- package/column-layout/index.js.map +1 -1
- package/column-layout/internal.js +20 -21
- package/column-layout/internal.js.map +1 -1
- package/column-layout/util.js +2 -2
- package/column-layout/util.js.map +1 -1
- package/container/index.js +5 -5
- package/container/index.js.map +1 -1
- package/container/internal.js +30 -31
- package/container/internal.js.map +1 -1
- package/container/use-sticky-header.js +25 -25
- package/container/use-sticky-header.js.map +1 -1
- package/content-layout/index.js +2 -3
- package/content-layout/index.js.map +1 -1
- package/content-layout/internal.js +15 -16
- package/content-layout/internal.js.map +1 -1
- package/date-input/index.js +3 -4
- package/date-input/index.js.map +1 -1
- package/date-input/internal.js +8 -8
- package/date-input/internal.js.map +1 -1
- package/date-picker/index.js +28 -28
- package/date-picker/index.js.map +1 -1
- package/date-range-picker/calendar/grids/grid.js +54 -57
- package/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/date-range-picker/calendar/grids/index.js +27 -28
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/header/header-button.js +4 -6
- package/date-range-picker/calendar/header/header-button.js.map +1 -1
- package/date-range-picker/calendar/header/index.js +6 -7
- package/date-range-picker/calendar/header/index.js.map +1 -1
- package/date-range-picker/calendar/index.js +40 -45
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/range-inputs.js +5 -6
- package/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/date-range-picker/calendar/utils.js +2 -2
- package/date-range-picker/calendar/utils.js.map +1 -1
- package/date-range-picker/dropdown.js +29 -34
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/index.js +40 -43
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/mode-switcher.js +2 -3
- package/date-range-picker/mode-switcher.js.map +1 -1
- package/date-range-picker/relative-range/index.js +36 -40
- package/date-range-picker/relative-range/index.js.map +1 -1
- package/date-range-picker/time-offset.js +5 -5
- package/date-range-picker/time-offset.js.map +1 -1
- package/date-range-picker/utils.js +4 -5
- package/date-range-picker/utils.js.map +1 -1
- package/expandable-section/expandable-section-container.js +5 -5
- package/expandable-section/expandable-section-container.js.map +1 -1
- package/expandable-section/expandable-section-header.js +18 -23
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/index.js +4 -4
- package/expandable-section/index.js.map +1 -1
- package/expandable-section/internal.js +22 -22
- package/expandable-section/internal.js.map +1 -1
- package/flashbar/collapsible-flashbar.js +103 -118
- package/flashbar/collapsible-flashbar.js.map +1 -1
- package/flashbar/common.js +26 -35
- package/flashbar/common.js.map +1 -1
- package/flashbar/constant.js +1 -1
- package/flashbar/constant.js.map +1 -1
- package/flashbar/flash.js +23 -26
- package/flashbar/flash.js.map +1 -1
- package/flashbar/index.js +3 -4
- package/flashbar/index.js.map +1 -1
- package/flashbar/internal/analytics.js +12 -12
- package/flashbar/internal/analytics.js.map +1 -1
- package/flashbar/non-collapsible-flashbar.js +10 -10
- package/flashbar/non-collapsible-flashbar.js.map +1 -1
- package/flashbar/utils.js +25 -27
- package/flashbar/utils.js.map +1 -1
- package/form/index.js +4 -4
- package/form/index.js.map +1 -1
- package/form/internal.js +5 -6
- package/form/internal.js.map +1 -1
- package/form-field/index.js +4 -4
- package/form-field/index.js.map +1 -1
- package/form-field/internal.js +20 -23
- package/form-field/internal.js.map +1 -1
- package/form-field/util.js +9 -10
- package/form-field/util.js.map +1 -1
- package/grid/index.js +6 -6
- package/grid/index.js.map +1 -1
- package/grid/internal.js +14 -15
- package/grid/internal.js.map +1 -1
- package/header/index.js +4 -4
- package/header/index.js.map +1 -1
- package/header/internal.js +15 -15
- package/header/internal.js.map +1 -1
- package/help-panel/index.js +7 -7
- package/help-panel/index.js.map +1 -1
- package/hotspot/index.js +12 -12
- package/hotspot/index.js.map +1 -1
- package/icon/icons.js +1 -1
- package/icon/index.js +4 -4
- package/icon/index.js.map +1 -1
- package/icon/internal.js +18 -18
- package/icon/internal.js.map +1 -1
- package/input/index.js +36 -17
- package/input/index.js.map +1 -1
- package/input/internal.js +30 -25
- package/input/internal.js.map +1 -1
- package/input/utils.js +4 -5
- package/input/utils.js.map +1 -1
- package/internal/animate.js +27 -32
- package/internal/animate.js.map +1 -1
- package/internal/base-component/index.js +2 -2
- package/internal/base-component/index.js.map +1 -1
- package/internal/breakpoints.js +7 -12
- package/internal/breakpoints.js.map +1 -1
- package/internal/components/abstract-switch/index.d.ts +2 -1
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +19 -19
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/abstract-switch/styles.css.js +13 -12
- package/internal/components/abstract-switch/styles.scoped.css +21 -21
- package/internal/components/abstract-switch/styles.selectors.js +13 -12
- package/internal/components/autosuggest-input/index.js +38 -38
- package/internal/components/autosuggest-input/index.js.map +1 -1
- package/internal/components/button-trigger/index.js +7 -7
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/cartesian-chart/axis-label.js +1 -2
- package/internal/components/cartesian-chart/axis-label.js.map +1 -1
- package/internal/components/cartesian-chart/bottom-labels.js +20 -26
- package/internal/components/cartesian-chart/bottom-labels.js.map +1 -1
- package/internal/components/cartesian-chart/constants.js +5 -5
- package/internal/components/cartesian-chart/constants.js.map +1 -1
- package/internal/components/cartesian-chart/emphasized-baseline.js +4 -5
- package/internal/components/cartesian-chart/emphasized-baseline.js.map +1 -1
- package/internal/components/cartesian-chart/highlighted-point.js +1 -2
- package/internal/components/cartesian-chart/highlighted-point.js.map +1 -1
- package/internal/components/cartesian-chart/label-utils.js +20 -24
- package/internal/components/cartesian-chart/label-utils.js.map +1 -1
- package/internal/components/cartesian-chart/labels-measure.js +6 -7
- package/internal/components/cartesian-chart/labels-measure.js.map +1 -1
- package/internal/components/cartesian-chart/left-labels.js +13 -17
- package/internal/components/cartesian-chart/left-labels.js.map +1 -1
- package/internal/components/cartesian-chart/scales.js +21 -26
- package/internal/components/cartesian-chart/scales.js.map +1 -1
- package/internal/components/cartesian-chart/ticks.js +9 -10
- package/internal/components/cartesian-chart/ticks.js.map +1 -1
- package/internal/components/cartesian-chart/vertical-grid-lines.js +3 -4
- package/internal/components/cartesian-chart/vertical-grid-lines.js.map +1 -1
- package/internal/components/cartesian-chart/vertical-marker.js +3 -4
- package/internal/components/cartesian-chart/vertical-marker.js.map +1 -1
- package/internal/components/chart-filter/index.js +13 -14
- package/internal/components/chart-filter/index.js.map +1 -1
- package/internal/components/chart-legend/index.js +26 -29
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/chart-plot/application-controller.js +21 -25
- package/internal/components/chart-plot/application-controller.js.map +1 -1
- package/internal/components/chart-plot/focus-outline.js +7 -8
- package/internal/components/chart-plot/focus-outline.js.map +1 -1
- package/internal/components/chart-plot/index.js +33 -34
- package/internal/components/chart-plot/index.js.map +1 -1
- package/internal/components/chart-popover/index.js +11 -12
- package/internal/components/chart-popover/index.js.map +1 -1
- package/internal/components/chart-series-details/index.js +13 -17
- package/internal/components/chart-series-details/index.js.map +1 -1
- package/internal/components/chart-series-marker/index.js +2 -3
- package/internal/components/chart-series-marker/index.js.map +1 -1
- package/internal/components/chart-status-container/index.js +8 -10
- package/internal/components/chart-status-container/index.js.map +1 -1
- package/internal/components/checkbox-icon/index.js +18 -19
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/components/dark-ribbon/index.js +13 -14
- package/internal/components/dark-ribbon/index.js.map +1 -1
- package/internal/components/dropdown/context.js +4 -5
- package/internal/components/dropdown/context.js.map +1 -1
- package/internal/components/dropdown/dropdown-fit-handler.js +74 -81
- package/internal/components/dropdown/dropdown-fit-handler.js.map +1 -1
- package/internal/components/dropdown/index.js +57 -65
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/components/dropdown-footer/index.js +2 -6
- package/internal/components/dropdown-footer/index.js.map +1 -1
- package/internal/components/dropdown-status/index.js +5 -7
- package/internal/components/dropdown-status/index.js.map +1 -1
- package/internal/components/filtering-token/index.js +4 -6
- package/internal/components/filtering-token/index.js.map +1 -1
- package/internal/components/focus-lock/index.js +10 -11
- package/internal/components/focus-lock/index.js.map +1 -1
- package/internal/components/focus-lock/utils.js +4 -4
- package/internal/components/focus-lock/utils.js.map +1 -1
- package/internal/components/live-region/index.js +10 -10
- package/internal/components/live-region/index.js.map +1 -1
- package/internal/components/masked-input/index.js +22 -24
- package/internal/components/masked-input/index.js.map +1 -1
- package/internal/components/masked-input/keyboard-handler.js +18 -18
- package/internal/components/masked-input/keyboard-handler.js.map +1 -1
- package/internal/components/masked-input/use-mask.js +24 -28
- package/internal/components/masked-input/use-mask.js.map +1 -1
- package/internal/components/masked-input/utils/keys.js +4 -6
- package/internal/components/masked-input/utils/keys.js.map +1 -1
- package/internal/components/masked-input/utils/mask-format.js +103 -113
- package/internal/components/masked-input/utils/mask-format.js.map +1 -1
- package/internal/components/masked-input/utils/strings.js +1 -4
- package/internal/components/masked-input/utils/strings.js.map +1 -1
- package/internal/components/menu-dropdown/index.js +10 -12
- package/internal/components/menu-dropdown/index.js.map +1 -1
- package/internal/components/option/highlight-match.js +14 -18
- package/internal/components/option/highlight-match.js.map +1 -1
- package/internal/components/option/index.js +13 -13
- package/internal/components/option/index.js.map +1 -1
- package/internal/components/option/option-announcer.js +1 -1
- package/internal/components/option/option-announcer.js.map +1 -1
- package/internal/components/option/option-parts.js +28 -45
- package/internal/components/option/option-parts.js.map +1 -1
- package/internal/components/option/utils/filter-options.js +16 -19
- package/internal/components/option/utils/filter-options.js.map +1 -1
- package/internal/components/option/utils/flatten-options.js +15 -15
- package/internal/components/option/utils/flatten-options.js.map +1 -1
- package/internal/components/option/utils/prepare-options.js +3 -3
- package/internal/components/option/utils/prepare-options.js.map +1 -1
- package/internal/components/options-list/index.js +19 -20
- package/internal/components/options-list/index.js.map +1 -1
- package/internal/components/options-list/utils/test-indexes.js +11 -11
- package/internal/components/options-list/utils/test-indexes.js.map +1 -1
- package/internal/components/options-list/utils/use-highlight-option.js +17 -21
- package/internal/components/options-list/utils/use-highlight-option.js.map +1 -1
- package/internal/components/options-list/utils/use-ids.js +2 -2
- package/internal/components/options-list/utils/use-ids.js.map +1 -1
- package/internal/components/options-list/utils/use-keyboard.js +6 -8
- package/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/internal/components/options-list/utils/use-open-state.js +6 -7
- package/internal/components/options-list/utils/use-open-state.js.map +1 -1
- package/internal/components/portal/index.js +5 -6
- package/internal/components/portal/index.js.map +1 -1
- package/internal/components/screenreader-only/index.js +1 -2
- package/internal/components/screenreader-only/index.js.map +1 -1
- package/internal/components/selectable-item/index.js +25 -26
- package/internal/components/selectable-item/index.js.map +1 -1
- package/internal/components/tab-trap/index.js +1 -2
- package/internal/components/tab-trap/index.js.map +1 -1
- package/internal/components/transition/index.js +16 -16
- package/internal/components/transition/index.js.map +1 -1
- package/internal/components/visual-context/index.js +6 -7
- package/internal/components/visual-context/index.js.map +1 -1
- package/internal/context/app-layout-context.js +2 -2
- package/internal/context/app-layout-context.js.map +1 -1
- package/internal/context/form-field-context.js +4 -4
- package/internal/context/form-field-context.js.map +1 -1
- package/internal/context/split-panel-context.js +3 -3
- package/internal/context/split-panel-context.js.map +1 -1
- package/internal/debounce.js +6 -11
- package/internal/debounce.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/events/index.js +12 -16
- package/internal/events/index.js.map +1 -1
- package/internal/focus-tracker.js +22 -27
- package/internal/focus-tracker.js.map +1 -1
- package/internal/generated/custom-css-properties/index.js +2 -2
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/hooks/check-controlled/index.js +1 -1
- package/internal/hooks/check-controlled/index.js.map +1 -1
- package/internal/hooks/container-queries/use-container-breakpoints.js +2 -2
- package/internal/hooks/container-queries/use-container-breakpoints.js.map +1 -1
- package/internal/hooks/container-queries/use-container-query.js +5 -6
- package/internal/hooks/container-queries/use-container-query.js.map +1 -1
- package/internal/hooks/container-queries/use-resize-observer.js +13 -13
- package/internal/hooks/container-queries/use-resize-observer.js.map +1 -1
- package/internal/hooks/focus-visible/index.js +8 -8
- package/internal/hooks/focus-visible/index.js.map +1 -1
- package/internal/hooks/forward-focus/index.js +5 -9
- package/internal/hooks/forward-focus/index.js.map +1 -1
- package/internal/hooks/forward-focus/radio-group.js +7 -7
- package/internal/hooks/forward-focus/radio-group.js.map +1 -1
- package/internal/hooks/use-base-component/component-metadata.js +5 -5
- package/internal/hooks/use-base-component/component-metadata.js.map +1 -1
- package/internal/hooks/use-base-component/index.js +1 -1
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/hooks/use-controllable/index.js +16 -17
- package/internal/hooks/use-controllable/index.js.map +1 -1
- package/internal/hooks/use-date-cache/index.js +2 -2
- package/internal/hooks/use-date-cache/index.js.map +1 -1
- package/internal/hooks/use-debounce-callback/index.js +3 -7
- package/internal/hooks/use-debounce-callback/index.js.map +1 -1
- package/internal/hooks/use-dynamic-overlap/index.js +4 -4
- package/internal/hooks/use-dynamic-overlap/index.js.map +1 -1
- package/internal/hooks/use-effect-on-update.js +2 -2
- package/internal/hooks/use-effect-on-update.js.map +1 -1
- package/internal/hooks/use-focus-tracker.js +7 -8
- package/internal/hooks/use-focus-tracker.js.map +1 -1
- package/internal/hooks/use-has-rendered/index.js +6 -6
- package/internal/hooks/use-has-rendered/index.js.map +1 -1
- package/internal/hooks/use-merge-refs/index.js +5 -9
- package/internal/hooks/use-merge-refs/index.js.map +1 -1
- package/internal/hooks/use-mobile/index.js +7 -7
- package/internal/hooks/use-mobile/index.js.map +1 -1
- package/internal/hooks/use-mouse-down-target.js +5 -5
- package/internal/hooks/use-mouse-down-target.js.map +1 -1
- package/internal/hooks/use-mutation-observer/index.js +5 -5
- package/internal/hooks/use-mutation-observer/index.js.map +1 -1
- package/internal/hooks/use-portal-mode-classes/index.js +10 -12
- package/internal/hooks/use-portal-mode-classes/index.js.map +1 -1
- package/internal/hooks/use-previous/index.js +3 -3
- package/internal/hooks/use-previous/index.js.map +1 -1
- package/internal/hooks/use-scroll-sync/index.js +8 -9
- package/internal/hooks/use-scroll-sync/index.js.map +1 -1
- package/internal/hooks/use-singleton-handler/index.js +12 -14
- package/internal/hooks/use-singleton-handler/index.js.map +1 -1
- package/internal/hooks/use-stable-event-handler/index.js +3 -10
- package/internal/hooks/use-stable-event-handler/index.js.map +1 -1
- package/internal/hooks/use-telemetry/index.js +2 -2
- package/internal/hooks/use-telemetry/index.js.map +1 -1
- package/internal/hooks/use-telemetry/telemetry.js +3 -4
- package/internal/hooks/use-telemetry/telemetry.js.map +1 -1
- package/internal/hooks/use-unique-id/index.js +3 -3
- package/internal/hooks/use-unique-id/index.js.map +1 -1
- package/internal/hooks/use-visual-mode/index.js +11 -11
- package/internal/hooks/use-visual-mode/index.js.map +1 -1
- package/internal/is-development.js +1 -1
- package/internal/is-development.js.map +1 -1
- package/internal/logging.js +2 -2
- package/internal/logging.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/metrics/log-clients.js +18 -27
- package/internal/metrics/log-clients.js.map +1 -1
- package/internal/metrics/metrics-formatters.js +11 -14
- package/internal/metrics/metrics-formatters.js.map +1 -1
- package/internal/metrics/metrics.js +27 -33
- package/internal/metrics/metrics.js.map +1 -1
- package/internal/motion.js +2 -2
- package/internal/motion.js.map +1 -1
- package/internal/styles/colors.js +1 -1
- package/internal/styles/colors.js.map +1 -1
- package/internal/utils/browser-scrollbar-size.js +5 -5
- package/internal/utils/browser-scrollbar-size.js.map +1 -1
- package/internal/utils/calculate-once.js +2 -2
- package/internal/utils/calculate-once.js.map +1 -1
- package/internal/utils/check-safe-url.js +4 -4
- package/internal/utils/check-safe-url.js.map +1 -1
- package/internal/utils/create-category-color-scale.js +6 -9
- package/internal/utils/create-category-color-scale.js.map +1 -1
- package/internal/utils/date-time/format-date-range.js +3 -3
- package/internal/utils/date-time/format-date-range.js.map +1 -1
- package/internal/utils/date-time/format-date.js +4 -4
- package/internal/utils/date-time/format-date.js.map +1 -1
- package/internal/utils/date-time/format-time.js +5 -5
- package/internal/utils/date-time/format-time.js.map +1 -1
- package/internal/utils/date-time/format-timezone-offset.js +4 -4
- package/internal/utils/date-time/format-timezone-offset.js.map +1 -1
- package/internal/utils/date-time/is-iso-date-only.js +1 -1
- package/internal/utils/date-time/is-iso-date-only.js.map +1 -1
- package/internal/utils/date-time/join-date-time.js +3 -3
- package/internal/utils/date-time/join-date-time.js.map +1 -1
- package/internal/utils/date-time/parse-date.js +5 -6
- package/internal/utils/date-time/parse-date.js.map +1 -1
- package/internal/utils/date-time/parse-timezone-offset.js +5 -5
- package/internal/utils/date-time/parse-timezone-offset.js.map +1 -1
- package/internal/utils/date-time/shift-timezone-offset.js +6 -6
- package/internal/utils/date-time/shift-timezone-offset.js.map +1 -1
- package/internal/utils/dom.js +12 -12
- package/internal/utils/dom.js.map +1 -1
- package/internal/utils/external-props.js +3 -3
- package/internal/utils/external-props.js.map +1 -1
- package/internal/utils/focus-svg-element.js +1 -1
- package/internal/utils/focus-svg-element.js.map +1 -1
- package/internal/utils/locale/merge-locales.js +1 -1
- package/internal/utils/locale/merge-locales.js.map +1 -1
- package/internal/utils/locale/normalize-locale.js +3 -3
- package/internal/utils/locale/normalize-locale.js.map +1 -1
- package/internal/utils/promises.js +7 -11
- package/internal/utils/promises.js.map +1 -1
- package/internal/utils/scrollable-containers.js +14 -18
- package/internal/utils/scrollable-containers.js.map +1 -1
- package/internal/utils/strings/join-strings.js +1 -5
- package/internal/utils/strings/join-strings.js.map +1 -1
- package/internal/utils/strings/pad-left-zeros.js +1 -1
- package/internal/utils/strings/pad-left-zeros.js.map +1 -1
- package/internal/utils/throttle.js +10 -15
- package/internal/utils/throttle.js.map +1 -1
- package/internal/utils/use-container-width.js +3 -5
- package/internal/utils/use-container-width.js.map +1 -1
- package/line-chart/index.js +6 -6
- package/line-chart/index.js.map +1 -1
- package/link/index.js +5 -5
- package/link/index.js.map +1 -1
- package/link/internal.js +25 -25
- package/link/internal.js.map +1 -1
- package/mixed-line-bar-chart/bar-groups.js +3 -4
- package/mixed-line-bar-chart/bar-groups.js.map +1 -1
- package/mixed-line-bar-chart/bar-series.js +24 -33
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +123 -138
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/chart-filters.js +10 -17
- package/mixed-line-bar-chart/chart-filters.js.map +1 -1
- package/mixed-line-bar-chart/chart-legend.js +9 -13
- package/mixed-line-bar-chart/chart-legend.js.map +1 -1
- package/mixed-line-bar-chart/chart-popover.js +3 -4
- package/mixed-line-bar-chart/chart-popover.js.map +1 -1
- package/mixed-line-bar-chart/data-series.js +13 -17
- package/mixed-line-bar-chart/data-series.js.map +1 -1
- package/mixed-line-bar-chart/domain.js +32 -39
- package/mixed-line-bar-chart/domain.js.map +1 -1
- package/mixed-line-bar-chart/format-highlighted.js +13 -14
- package/mixed-line-bar-chart/format-highlighted.js.map +1 -1
- package/mixed-line-bar-chart/hooks/use-mouse-hover.js +32 -34
- package/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
- package/mixed-line-bar-chart/hooks/use-navigation.js +48 -57
- package/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
- package/mixed-line-bar-chart/hooks/use-popover.js +7 -7
- package/mixed-line-bar-chart/hooks/use-popover.js.map +1 -1
- package/mixed-line-bar-chart/index.js +4 -4
- package/mixed-line-bar-chart/index.js.map +1 -1
- package/mixed-line-bar-chart/internal.js +47 -49
- package/mixed-line-bar-chart/internal.js.map +1 -1
- package/mixed-line-bar-chart/line-series.js +19 -24
- package/mixed-line-bar-chart/line-series.js.map +1 -1
- package/mixed-line-bar-chart/make-scaled-bar-groups.js +10 -11
- package/mixed-line-bar-chart/make-scaled-bar-groups.js.map +1 -1
- package/mixed-line-bar-chart/make-scaled-series.js +30 -38
- package/mixed-line-bar-chart/make-scaled-series.js.map +1 -1
- package/mixed-line-bar-chart/utils.js +18 -21
- package/mixed-line-bar-chart/utils.js.map +1 -1
- package/modal/body-scroll.js +4 -4
- package/modal/body-scroll.js.map +1 -1
- package/modal/index.js +4 -4
- package/modal/index.js.map +1 -1
- package/modal/internal.js +24 -25
- package/modal/internal.js.map +1 -1
- package/multiselect/index.js +5 -5
- package/multiselect/index.js.map +1 -1
- package/multiselect/internal.js +81 -88
- package/multiselect/internal.js.map +1 -1
- package/package.json +1 -1
- package/pagination/index.js +2 -3
- package/pagination/index.js.map +1 -1
- package/pagination/internal.js +16 -17
- package/pagination/internal.js.map +1 -1
- package/pagination/utils.js +12 -12
- package/pagination/utils.js.map +1 -1
- package/pie-chart/index.js +38 -39
- package/pie-chart/index.js.map +1 -1
- package/pie-chart/labels.js +38 -42
- package/pie-chart/labels.js.map +1 -1
- package/pie-chart/pie-chart.js +65 -67
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/responsive-text.js +9 -10
- package/pie-chart/responsive-text.js.map +1 -1
- package/pie-chart/segments.js +27 -31
- package/pie-chart/segments.js.map +1 -1
- package/pie-chart/utils.js +32 -35
- package/pie-chart/utils.js.map +1 -1
- package/popover/arrow.js +2 -2
- package/popover/arrow.js.map +1 -1
- package/popover/body.js +16 -19
- package/popover/body.js.map +1 -1
- package/popover/container.js +52 -55
- package/popover/container.js.map +1 -1
- package/popover/index.js +6 -6
- package/popover/index.js.map +1 -1
- package/popover/internal.js +28 -28
- package/popover/internal.js.map +1 -1
- package/popover/utils/positions.js +54 -66
- package/popover/utils/positions.js.map +1 -1
- package/progress-bar/index.js +17 -17
- package/progress-bar/index.js.map +1 -1
- package/progress-bar/internal.js +12 -16
- package/progress-bar/internal.js.map +1 -1
- package/property-filter/controller.js +117 -125
- package/property-filter/controller.js.map +1 -1
- package/property-filter/filter-options.js +8 -11
- package/property-filter/filter-options.js.map +1 -1
- package/property-filter/index.js +50 -50
- package/property-filter/index.js.map +1 -1
- package/property-filter/property-editor.js +4 -5
- package/property-filter/property-editor.js.map +1 -1
- package/property-filter/property-filter-autosuggest.js +39 -39
- package/property-filter/property-filter-autosuggest.js.map +1 -1
- package/property-filter/token-editor.js +55 -66
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.js +9 -11
- package/property-filter/token.js.map +1 -1
- package/property-filter/use-load-items.js +8 -12
- package/property-filter/use-load-items.js.map +1 -1
- package/property-filter/utils.js +13 -18
- package/property-filter/utils.js.map +1 -1
- package/radio-group/index.js +3 -4
- package/radio-group/index.js.map +1 -1
- package/radio-group/internal.js +9 -9
- package/radio-group/internal.js.map +1 -1
- package/radio-group/radio-button.js +12 -15
- package/radio-group/radio-button.js.map +1 -1
- package/s3-resource-selector/index.js +29 -29
- package/s3-resource-selector/index.js.map +1 -1
- package/s3-resource-selector/s3-in-context/index.js +16 -18
- package/s3-resource-selector/s3-in-context/index.js.map +1 -1
- package/s3-resource-selector/s3-in-context/search-input.js +3 -4
- package/s3-resource-selector/s3-in-context/search-input.js.map +1 -1
- package/s3-resource-selector/s3-in-context/use-versions-fetch.js +16 -16
- package/s3-resource-selector/s3-in-context/use-versions-fetch.js.map +1 -1
- package/s3-resource-selector/s3-in-context/validation.js +6 -6
- package/s3-resource-selector/s3-in-context/validation.js.map +1 -1
- package/s3-resource-selector/s3-modal/basic-table.js +19 -20
- package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/buckets-table.js +11 -13
- package/s3-resource-selector/s3-modal/buckets-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/column-formats.js +5 -5
- package/s3-resource-selector/s3-modal/column-formats.js.map +1 -1
- package/s3-resource-selector/s3-modal/empty-state.js +1 -2
- package/s3-resource-selector/s3-modal/empty-state.js.map +1 -1
- package/s3-resource-selector/s3-modal/index.js +37 -43
- package/s3-resource-selector/s3-modal/index.js.map +1 -1
- package/s3-resource-selector/s3-modal/objects-table.js +12 -14
- package/s3-resource-selector/s3-modal/objects-table.js.map +1 -1
- package/s3-resource-selector/s3-modal/table-utils.js +9 -12
- package/s3-resource-selector/s3-modal/table-utils.js.map +1 -1
- package/s3-resource-selector/s3-modal/versions-table.js +10 -12
- package/s3-resource-selector/s3-modal/versions-table.js.map +1 -1
- package/s3-resource-selector/utils.js +1 -1
- package/s3-resource-selector/utils.js.map +1 -1
- package/segmented-control/index.js +2 -3
- package/segmented-control/index.js.map +1 -1
- package/segmented-control/internal-segmented-control.js +16 -17
- package/segmented-control/internal-segmented-control.js.map +1 -1
- package/segmented-control/internal.js +14 -14
- package/segmented-control/internal.js.map +1 -1
- package/segmented-control/segment.js +3 -6
- package/segmented-control/segment.js.map +1 -1
- package/select/index.js +6 -6
- package/select/index.js.map +1 -1
- package/select/internal.js +58 -58
- package/select/internal.js.map +1 -1
- package/select/parts/filter.js +4 -4
- package/select/parts/filter.js.map +1 -1
- package/select/parts/item.js +10 -10
- package/select/parts/item.js.map +1 -1
- package/select/parts/multiselect-item.js +13 -14
- package/select/parts/multiselect-item.js.map +1 -1
- package/select/parts/plain-list.js +13 -15
- package/select/parts/plain-list.js.map +1 -1
- package/select/parts/trigger.js +7 -9
- package/select/parts/trigger.js.map +1 -1
- package/select/parts/virtual-list.js +27 -33
- package/select/parts/virtual-list.js.map +1 -1
- package/select/utils/check-option-value-field.js +2 -2
- package/select/utils/check-option-value-field.js.map +1 -1
- package/select/utils/connect-options.js +6 -7
- package/select/utils/connect-options.js.map +1 -1
- package/select/utils/get-item-props.js +4 -7
- package/select/utils/get-item-props.js.map +1 -1
- package/select/utils/render-options.js +13 -15
- package/select/utils/render-options.js.map +1 -1
- package/select/utils/use-announcement.js +10 -11
- package/select/utils/use-announcement.js.map +1 -1
- package/select/utils/use-load-items.js +16 -19
- package/select/utils/use-load-items.js.map +1 -1
- package/select/utils/use-native-search.js +20 -29
- package/select/utils/use-native-search.js.map +1 -1
- package/select/utils/use-select.js +89 -96
- package/select/utils/use-select.js.map +1 -1
- package/side-navigation/index.js +10 -10
- package/side-navigation/index.js.map +1 -1
- package/side-navigation/internal.js +35 -46
- package/side-navigation/internal.js.map +1 -1
- package/side-navigation/util.js +9 -12
- package/side-navigation/util.js.map +1 -1
- package/space-between/index.js +4 -4
- package/space-between/index.js.map +1 -1
- package/space-between/internal.js +7 -7
- package/space-between/internal.js.map +1 -1
- package/spinner/index.js +4 -4
- package/spinner/index.js.map +1 -1
- package/spinner/internal.js +4 -4
- package/spinner/internal.js.map +1 -1
- package/split-panel/bottom.js +22 -25
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/icons/bottom-icon-refresh.js +11 -13
- package/split-panel/icons/bottom-icon-refresh.js.map +1 -1
- package/split-panel/icons/bottom-icon.js +1 -1
- package/split-panel/icons/bottom-icon.js.map +1 -1
- package/split-panel/icons/resize-handler.js +3 -6
- package/split-panel/icons/resize-handler.js.map +1 -1
- package/split-panel/icons/side-position-refresh.js +12 -14
- package/split-panel/icons/side-position-refresh.js.map +1 -1
- package/split-panel/icons/side-position.js +1 -1
- package/split-panel/icons/side-position.js.map +1 -1
- package/split-panel/index.js +65 -65
- package/split-panel/index.js.map +1 -1
- package/split-panel/preferences-modal.js +9 -9
- package/split-panel/preferences-modal.js.map +1 -1
- package/split-panel/side.js +12 -15
- package/split-panel/side.js.map +1 -1
- package/split-panel/utils/size-utils.js +3 -3
- package/split-panel/utils/size-utils.js.map +1 -1
- package/split-panel/utils/use-keyboard-events.js +13 -17
- package/split-panel/utils/use-keyboard-events.js.map +1 -1
- package/split-panel/utils/use-pointer-events.js +12 -13
- package/split-panel/utils/use-pointer-events.js.map +1 -1
- package/status-indicator/index.js +4 -4
- package/status-indicator/index.js.map +1 -1
- package/status-indicator/internal.js +9 -10
- package/status-indicator/internal.js.map +1 -1
- package/table/body-cell/click-away.js +9 -10
- package/table/body-cell/click-away.js.map +1 -1
- package/table/body-cell/index.js +18 -18
- package/table/body-cell/index.js.map +1 -1
- package/table/body-cell/inline-editor.js +32 -46
- package/table/body-cell/inline-editor.js.map +1 -1
- package/table/body-cell/td-element.js +2 -4
- package/table/body-cell/td-element.js.map +1 -1
- package/table/body-cell/use-stable-scroll-position.js +10 -13
- package/table/body-cell/use-stable-scroll-position.js.map +1 -1
- package/table/header-cell/index.d.ts +4 -2
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +33 -34
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/utils.js +10 -12
- package/table/header-cell/utils.js.map +1 -1
- package/table/index.js +5 -5
- package/table/index.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +94 -118
- package/table/internal.js.map +1 -1
- package/table/resizer/index.d.ts +5 -1
- package/table/resizer/index.d.ts.map +1 -1
- package/table/resizer/index.js +40 -39
- package/table/resizer/index.js.map +1 -1
- package/table/selection-control/index.d.ts +4 -1
- package/table/selection-control/index.d.ts.map +1 -1
- package/table/selection-control/index.js +11 -11
- package/table/selection-control/index.js.map +1 -1
- package/table/sticky-header.d.ts +2 -2
- package/table/sticky-header.d.ts.map +1 -1
- package/table/sticky-header.js +16 -15
- package/table/sticky-header.js.map +1 -1
- package/table/sticky-scrollbar.js +5 -6
- package/table/sticky-scrollbar.js.map +1 -1
- package/table/sticky-scrolling.js +10 -10
- package/table/sticky-scrolling.js.map +1 -1
- package/table/thead.d.ts +11 -3
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +13 -13
- package/table/thead.js.map +1 -1
- package/table/tools-header.js +4 -5
- package/table/tools-header.js.map +1 -1
- package/table/use-column-widths.js +34 -44
- package/table/use-column-widths.js.map +1 -1
- package/table/use-row-events.js +10 -11
- package/table/use-row-events.js.map +1 -1
- package/table/use-selection.js +75 -81
- package/table/use-selection.js.map +1 -1
- package/table/use-sticky-header.js +16 -16
- package/table/use-sticky-header.js.map +1 -1
- package/table/use-sticky-scrollbar.js +42 -42
- package/table/use-sticky-scrollbar.js.map +1 -1
- package/table/use-table-focus-navigation.js +27 -28
- package/table/use-table-focus-navigation.js.map +1 -1
- package/table/utils.js +7 -7
- package/table/utils.js.map +1 -1
- package/tabs/index.js +30 -33
- package/tabs/index.js.map +1 -1
- package/tabs/scroll-utils.js +12 -13
- package/tabs/scroll-utils.js.map +1 -1
- package/tabs/smooth-scroll.js +17 -17
- package/tabs/smooth-scroll.js.map +1 -1
- package/tabs/tab-header-bar.js +61 -66
- package/tabs/tab-header-bar.js.map +1 -1
- package/tag-editor/index.js +59 -72
- package/tag-editor/index.js.map +1 -1
- package/tag-editor/internal.js +21 -29
- package/tag-editor/internal.js.map +1 -1
- package/tag-editor/utils.js +7 -8
- package/tag-editor/utils.js.map +1 -1
- package/tag-editor/validation.js +16 -18
- package/tag-editor/validation.js.map +1 -1
- package/text-content/index.js +6 -6
- package/text-content/index.js.map +1 -1
- package/text-filter/index.js +3 -4
- package/text-filter/index.js.map +1 -1
- package/text-filter/internal.js +10 -10
- package/text-filter/internal.js.map +1 -1
- package/textarea/index.js +23 -24
- package/textarea/index.js.map +1 -1
- package/theming/index.js +2 -3
- package/theming/index.js.map +1 -1
- package/tiles/index.js +3 -4
- package/tiles/index.js.map +1 -1
- package/tiles/internal.js +17 -17
- package/tiles/internal.js.map +1 -1
- package/tiles/tile.js +7 -9
- package/tiles/tile.js.map +1 -1
- package/time-input/index.js +5 -5
- package/time-input/index.js.map +1 -1
- package/time-input/internal.js +9 -9
- package/time-input/internal.js.map +1 -1
- package/toggle/index.js +3 -4
- package/toggle/index.js.map +1 -1
- package/toggle/internal.js +15 -16
- package/toggle/internal.js.map +1 -1
- package/token-group/dismiss-button.js +5 -7
- package/token-group/dismiss-button.js.map +1 -1
- package/token-group/index.js +4 -4
- package/token-group/index.js.map +1 -1
- package/token-group/internal.js +14 -14
- package/token-group/internal.js.map +1 -1
- package/token-group/toggle.js +7 -9
- package/token-group/toggle.js.map +1 -1
- package/top-navigation/1.0-beta/index.js +4 -4
- package/top-navigation/1.0-beta/index.js.map +1 -1
- package/top-navigation/1.0-beta/internal.js +43 -46
- package/top-navigation/1.0-beta/internal.js.map +1 -1
- package/top-navigation/1.0-beta/parts/overflow-menu.js +16 -17
- package/top-navigation/1.0-beta/parts/overflow-menu.js.map +1 -1
- package/top-navigation/1.0-beta/parts/utility.js +9 -12
- package/top-navigation/1.0-beta/parts/utility.js.map +1 -1
- package/top-navigation/1.0-beta/use-top-navigation.js +46 -54
- package/top-navigation/1.0-beta/use-top-navigation.js.map +1 -1
- package/top-navigation/index.js +4 -4
- package/top-navigation/index.js.map +1 -1
- package/top-navigation/internal.js +64 -71
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/parts/overflow-menu/header.js +3 -4
- package/top-navigation/parts/overflow-menu/header.js.map +1 -1
- package/top-navigation/parts/overflow-menu/index.js +4 -5
- package/top-navigation/parts/overflow-menu/index.js.map +1 -1
- package/top-navigation/parts/overflow-menu/menu-item.js +56 -61
- package/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
- package/top-navigation/parts/overflow-menu/router.js +11 -13
- package/top-navigation/parts/overflow-menu/router.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/submenu.js +6 -8
- package/top-navigation/parts/overflow-menu/views/submenu.js.map +1 -1
- package/top-navigation/parts/overflow-menu/views/utilities.js +5 -7
- package/top-navigation/parts/overflow-menu/views/utilities.js.map +1 -1
- package/top-navigation/parts/utility.js +12 -15
- package/top-navigation/parts/utility.js.map +1 -1
- package/top-navigation/use-top-navigation.js +52 -59
- package/top-navigation/use-top-navigation.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/congratulation-screen.js +5 -7
- package/tutorial-panel/components/tutorial-detail-view/congratulation-screen.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.js +6 -7
- package/tutorial-panel/components/tutorial-detail-view/index.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task-list.js +8 -15
- package/tutorial-panel/components/tutorial-detail-view/task-list.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task.js +5 -6
- package/tutorial-panel/components/tutorial-detail-view/task.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +19 -22
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/tutorial-panel/index.js +8 -8
- package/tutorial-panel/index.js.map +1 -1
- package/wizard/index.js +28 -28
- package/wizard/index.js.map +1 -1
- package/wizard/internal/analytics.js +32 -42
- package/wizard/internal/analytics.js.map +1 -1
- package/wizard/unmount.js +6 -13
- package/wizard/unmount.js.map +1 -1
- package/wizard/wizard-actions.js +7 -8
- package/wizard/wizard-actions.js.map +1 -1
- package/wizard/wizard-form-header.js +2 -3
- package/wizard/wizard-form-header.js.map +1 -1
- package/wizard/wizard-form.js +14 -16
- package/wizard/wizard-form.js.map +1 -1
- package/wizard/wizard-navigation.js +19 -25
- package/wizard/wizard-navigation.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../../../src/mixed-line-bar-chart/hooks/use-navigation.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,WAAW,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,IAAI,kBAAkB,EAAE;YACtB,OAAO;SACR;QAED,IAAI,OAAO,KAAK,OAAO,CAAC,IAAI,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE;YACtD,iBAAiB,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACtD;aAAM,IAAI,OAAO,KAAK,OAAO,CAAC,IAAI,IAAI,OAAO,KAAK,OAAO,CAAC,KAAK,EAAE;YAChE,eAAe,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACrD;aAAM,IAAI,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,OAAO,CAAC,KAAK,EAAE;YACjE,UAAU,EAAE,CAAC;SACd;IACH,CAAC,EACD,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,CAAC,CACrE,CAAC;IAEF,OAAO,EAAE,iBAAiB,mBAAA,EAAE,OAAO,SAAA,EAAE,SAAS,WAAA,EAAE,MAAM,QAAA,EAAE,CAAC;AAC3D,CAAC;AAED,kFAAkF;AAClF,SAAS,WAAW,CAAC,KAAa,EAAE,EAA4B;QAA3B,IAAI,QAAA,EAAE,EAAE,QAAA;IAC3C,IAAI,KAAK,GAAG,IAAI,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,GAAG,EAAE,EAAE;QACd,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { KeyCode } from '../../internal/keycode';\nimport { ChartContainerProps } from '../chart-container';\nimport { ChartDataTypes, MixedLineBarChartProps, VerticalMarkerX } from '../interfaces';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { findNavigableSeries, isXThreshold, isYThreshold, nextValidDomainIndex } from '../utils';\nimport { ScaledPoint } from '../make-scaled-series';\nimport { ScaledBarGroup } from '../make-scaled-bar-groups';\n\nexport type UseNavigationProps<T extends ChartDataTypes> = Pick<\n ChartContainerProps<T>,\n 'highlightedSeries' | 'series' | 'visibleSeries'\n> & {\n xScale: ChartScale;\n yScale: NumericChartScale;\n barGroups: ScaledBarGroup<T>[];\n scaledSeries: ReadonlyArray<ScaledPoint<T>>;\n\n highlightedPoint: ScaledPoint<T> | null;\n highlightedGroupIndex: number | null;\n isHandlersDisabled: boolean;\n\n pinPopover(pinned?: boolean): void;\n highlightSeries(series: MixedLineBarChartProps.ChartSeries<T> | null): void;\n highlightGroup(groupIndex: number): void;\n highlightPoint(point: ScaledPoint<T> | null): void;\n highlightX: (verticalMarker: VerticalMarkerX<T> | null) => void;\n clearHighlightedSeries(): void;\n verticalMarkerX: VerticalMarkerX<T> | null;\n};\n\nexport function useNavigation<T extends ChartDataTypes>({\n series,\n visibleSeries,\n scaledSeries,\n barGroups,\n xScale,\n yScale,\n highlightedPoint,\n highlightedGroupIndex,\n highlightedSeries,\n isHandlersDisabled,\n pinPopover,\n highlightSeries,\n highlightGroup,\n highlightPoint,\n highlightX,\n verticalMarkerX,\n}: UseNavigationProps<T>) {\n const [targetX, setTargetX] = useState<T | null>(null);\n const [xIndex, setXIndex] = useState(0);\n\n // There are two different types of navigation:\n // 1) Group navigation for any chart that contains a bar series\n // 2) Line navigation for any chart that only contains lines and thresholds\n const isGroupNavigation = useMemo(() => visibleSeries.some(({ series }) => series.type === 'bar'), [visibleSeries]);\n\n // Make a list of series that can be navigated between. Bar series are treated as one.\n const { navigableSeries } = useMemo(() => findNavigableSeries(visibleSeries), [visibleSeries]);\n const containsMultipleSeries = navigableSeries.length > 1;\n\n const onBarGroupFocus = () => {\n const groupIndex = highlightedGroupIndex ?? 0;\n setTargetX((xScale.domain as T[])[groupIndex]);\n highlightGroup(groupIndex);\n };\n\n const onLineFocus = () => {\n if (verticalMarkerX === null) {\n if (containsMultipleSeries) {\n moveToLineGroupIndex(0);\n } else {\n moveBetweenSeries(0);\n }\n }\n };\n\n const onFocus = () => {\n if (isGroupNavigation) {\n onBarGroupFocus();\n } else {\n onLineFocus();\n }\n };\n\n // Returns all the unique X coordinates in scaledSeries.\n // Assumes scaledSeries is sorted by `x`.\n const allUniqueX = useMemo(() => {\n const result = [];\n for (let i = 0; i < scaledSeries.length; i += 1) {\n const point = scaledSeries[i];\n if (point !== undefined && (!result.length || result[result.length - 1].scaledX !== point.x)) {\n result.push({ scaledX: point.x, datum: point.datum });\n }\n }\n return result;\n }, [scaledSeries]);\n\n const moveBetweenSeries = useCallback(\n (direction: number) => {\n if (isGroupNavigation) {\n return;\n }\n\n const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n const MAX_SERIES_INDEX = navigableSeries.length - 1;\n\n // Find the index of the currently highlighted series (if any)\n let previousSeriesIndex = -1;\n if (highlightedSeries) {\n previousSeriesIndex = navigableSeries.indexOf(highlightedSeries);\n }\n\n // Move forwards or backwards to the new series\n // If index === -1, show all data points from all series at the given X instead of one single series\n const firstPossibleIndex = containsMultipleSeries ? -1 : 0;\n let nextSeriesIndex = 0;\n if (previousSeriesIndex !== null) {\n nextSeriesIndex = previousSeriesIndex + direction;\n if (nextSeriesIndex > MAX_SERIES_INDEX) {\n nextSeriesIndex = firstPossibleIndex;\n } else if (nextSeriesIndex < firstPossibleIndex) {\n nextSeriesIndex = MAX_SERIES_INDEX;\n }\n }\n if (nextSeriesIndex === -1) {\n highlightSeries(null);\n highlightPoint(null);\n return;\n }\n const nextSeries = navigableSeries[nextSeriesIndex];\n const nextInternalSeries = series.filter(({ series }) => series === nextSeries)[0];\n\n // 2. Find point in the next series\n let targetXPoint = (xScale.d3Scale(targetX as any) ?? NaN) + xOffset;\n if (!isFinite(targetXPoint)) {\n targetXPoint = 0;\n }\n\n if (nextSeries.type === 'line') {\n const nextScaledSeries = scaledSeries.filter(it => it.series === nextSeries);\n const closestNextSeriesPoint = nextScaledSeries.reduce(\n (prev, curr) => (Math.abs(curr.x - targetXPoint) < Math.abs(prev.x - targetXPoint) ? curr : prev),\n { x: -Infinity, y: -Infinity }\n );\n highlightPoint({ ...closestNextSeriesPoint, color: nextInternalSeries.color, series: nextSeries });\n } else if (isYThreshold(nextSeries)) {\n const scaledTargetIndex = scaledSeries.map(it => it.datum?.x || null).indexOf(targetX);\n highlightPoint({\n x: targetXPoint,\n y: yScale.d3Scale(nextSeries.y) ?? NaN,\n color: nextInternalSeries.color,\n series: nextSeries,\n datum: scaledSeries[scaledTargetIndex]?.datum,\n });\n } else if (isXThreshold(nextSeries)) {\n highlightPoint({\n x: xScale.d3Scale(nextSeries.x as any) ?? NaN,\n y: yScale.d3Scale.range()[0],\n color: nextInternalSeries.color,\n series: nextSeries,\n datum: { x: nextSeries.x, y: NaN },\n });\n }\n },\n [\n isGroupNavigation,\n xScale,\n navigableSeries,\n highlightedSeries,\n containsMultipleSeries,\n highlightSeries,\n highlightPoint,\n series,\n targetX,\n scaledSeries,\n yScale,\n ]\n );\n\n const moveWithinSeries = useCallback(\n (direction: number) => {\n const series = highlightedSeries || visibleSeries[0].series;\n\n if (series.type === 'line' || isYThreshold(series)) {\n const targetScaledSeries = scaledSeries.filter(it => it.series === series);\n const previousPoint = highlightedPoint || targetScaledSeries[0];\n const indexOfPreviousPoint = targetScaledSeries.map(it => it.x).indexOf(previousPoint.x);\n const nextPointIndex = circleIndex(indexOfPreviousPoint + direction, [0, targetScaledSeries.length - 1]);\n const nextPoint = targetScaledSeries[nextPointIndex];\n\n setTargetX(nextPoint.datum?.x || null);\n setXIndex(nextPointIndex);\n highlightPoint(nextPoint);\n } else if (series.type === 'bar') {\n const xDomain = xScale.domain as T[];\n const MAX_GROUP_INDEX = xDomain.length - 1;\n\n let nextGroupIndex = 0;\n if (highlightedGroupIndex !== null) {\n // find next group\n nextGroupIndex = highlightedGroupIndex + direction;\n if (nextGroupIndex > MAX_GROUP_INDEX) {\n nextGroupIndex = 0;\n } else if (nextGroupIndex < 0) {\n nextGroupIndex = MAX_GROUP_INDEX;\n }\n }\n\n const nextDomainIndex = nextValidDomainIndex(nextGroupIndex, barGroups, direction);\n setTargetX(xDomain[nextDomainIndex]);\n highlightGroup(nextDomainIndex);\n }\n },\n [\n highlightedSeries,\n visibleSeries,\n scaledSeries,\n highlightedPoint,\n highlightPoint,\n xScale.domain,\n highlightedGroupIndex,\n barGroups,\n highlightGroup,\n ]\n );\n\n const moveToLineGroupIndex = useCallback(\n (index: number) => {\n const point = allUniqueX[index];\n setXIndex(index);\n setTargetX(point.datum?.x || null);\n highlightX({ scaledX: point?.scaledX ?? null, label: point.datum?.x ?? null });\n },\n [allUniqueX, highlightX]\n );\n\n const moveWithinXAxis = useCallback(\n (direction: number) => {\n if (highlightedSeries || isGroupNavigation) {\n moveWithinSeries(direction);\n } else {\n const nextPointGroupIndex = circleIndex(xIndex + direction, [0, allUniqueX.length - 1]);\n moveToLineGroupIndex(nextPointGroupIndex);\n }\n },\n [highlightedSeries, isGroupNavigation, moveWithinSeries, xIndex, allUniqueX.length, moveToLineGroupIndex]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.up &&\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.down &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.space &&\n keyCode !== KeyCode.enter\n ) {\n return;\n }\n\n event.preventDefault();\n\n if (isHandlersDisabled) {\n return;\n }\n\n if (keyCode === KeyCode.down || keyCode === KeyCode.up) {\n moveBetweenSeries(keyCode === KeyCode.down ? 1 : -1);\n } else if (keyCode === KeyCode.left || keyCode === KeyCode.right) {\n moveWithinXAxis(keyCode === KeyCode.right ? 1 : -1);\n } else if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n pinPopover();\n }\n },\n [isHandlersDisabled, moveBetweenSeries, moveWithinXAxis, pinPopover]\n );\n\n return { isGroupNavigation, onFocus, onKeyDown, xIndex };\n}\n\n// Returns given index if it is in range or the opposite range boundary otherwise.\nfunction circleIndex(index: number, [from, to]: [number, number]): number {\n if (index < from) {\n return to;\n }\n if (index > to) {\n return from;\n }\n return index;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../../../src/mixed-line-bar-chart/hooks/use-navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAIjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA0BjG,MAAM,UAAU,aAAa,CAA2B,EACtD,MAAM,EACN,aAAa,EACb,YAAY,EACZ,SAAS,EACT,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,UAAU,EACV,eAAe,GACO;IACtB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExC,+CAA+C;IAC/C,+DAA+D;IAC/D,2EAA2E;IAC3E,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpH,sFAAs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KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { KeyCode } from '../../internal/keycode';\nimport { ChartContainerProps } from '../chart-container';\nimport { ChartDataTypes, MixedLineBarChartProps, VerticalMarkerX } from '../interfaces';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { findNavigableSeries, isXThreshold, isYThreshold, nextValidDomainIndex } from '../utils';\nimport { ScaledPoint } from '../make-scaled-series';\nimport { ScaledBarGroup } from '../make-scaled-bar-groups';\n\nexport type UseNavigationProps<T extends ChartDataTypes> = Pick<\n ChartContainerProps<T>,\n 'highlightedSeries' | 'series' | 'visibleSeries'\n> & {\n xScale: ChartScale;\n yScale: NumericChartScale;\n barGroups: ScaledBarGroup<T>[];\n scaledSeries: ReadonlyArray<ScaledPoint<T>>;\n\n highlightedPoint: ScaledPoint<T> | null;\n highlightedGroupIndex: number | null;\n isHandlersDisabled: boolean;\n\n pinPopover(pinned?: boolean): void;\n highlightSeries(series: MixedLineBarChartProps.ChartSeries<T> | null): void;\n highlightGroup(groupIndex: number): void;\n highlightPoint(point: ScaledPoint<T> | null): void;\n highlightX: (verticalMarker: VerticalMarkerX<T> | null) => void;\n clearHighlightedSeries(): void;\n verticalMarkerX: VerticalMarkerX<T> | null;\n};\n\nexport function useNavigation<T extends ChartDataTypes>({\n series,\n visibleSeries,\n scaledSeries,\n barGroups,\n xScale,\n yScale,\n highlightedPoint,\n highlightedGroupIndex,\n highlightedSeries,\n isHandlersDisabled,\n pinPopover,\n highlightSeries,\n highlightGroup,\n highlightPoint,\n highlightX,\n verticalMarkerX,\n}: UseNavigationProps<T>) {\n const [targetX, setTargetX] = useState<T | null>(null);\n const [xIndex, setXIndex] = useState(0);\n\n // There are two different types of navigation:\n // 1) Group navigation for any chart that contains a bar series\n // 2) Line navigation for any chart that only contains lines and thresholds\n const isGroupNavigation = useMemo(() => visibleSeries.some(({ series }) => series.type === 'bar'), [visibleSeries]);\n\n // Make a list of series that can be navigated between. Bar series are treated as one.\n const { navigableSeries } = useMemo(() => findNavigableSeries(visibleSeries), [visibleSeries]);\n const containsMultipleSeries = navigableSeries.length > 1;\n\n const onBarGroupFocus = () => {\n const groupIndex = highlightedGroupIndex ?? 0;\n setTargetX((xScale.domain as T[])[groupIndex]);\n highlightGroup(groupIndex);\n };\n\n const onLineFocus = () => {\n if (verticalMarkerX === null) {\n if (containsMultipleSeries) {\n moveToLineGroupIndex(0);\n } else {\n moveBetweenSeries(0);\n }\n }\n };\n\n const onFocus = () => {\n if (isGroupNavigation) {\n onBarGroupFocus();\n } else {\n onLineFocus();\n }\n };\n\n // Returns all the unique X coordinates in scaledSeries.\n // Assumes scaledSeries is sorted by `x`.\n const allUniqueX = useMemo(() => {\n const result = [];\n for (let i = 0; i < scaledSeries.length; i += 1) {\n const point = scaledSeries[i];\n if (point !== undefined && (!result.length || result[result.length - 1].scaledX !== point.x)) {\n result.push({ scaledX: point.x, datum: point.datum });\n }\n }\n return result;\n }, [scaledSeries]);\n\n const moveBetweenSeries = useCallback(\n (direction: number) => {\n if (isGroupNavigation) {\n return;\n }\n\n const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n const MAX_SERIES_INDEX = navigableSeries.length - 1;\n\n // Find the index of the currently highlighted series (if any)\n let previousSeriesIndex = -1;\n if (highlightedSeries) {\n previousSeriesIndex = navigableSeries.indexOf(highlightedSeries);\n }\n\n // Move forwards or backwards to the new series\n // If index === -1, show all data points from all series at the given X instead of one single series\n const firstPossibleIndex = containsMultipleSeries ? -1 : 0;\n let nextSeriesIndex = 0;\n if (previousSeriesIndex !== null) {\n nextSeriesIndex = previousSeriesIndex + direction;\n if (nextSeriesIndex > MAX_SERIES_INDEX) {\n nextSeriesIndex = firstPossibleIndex;\n } else if (nextSeriesIndex < firstPossibleIndex) {\n nextSeriesIndex = MAX_SERIES_INDEX;\n }\n }\n if (nextSeriesIndex === -1) {\n highlightSeries(null);\n highlightPoint(null);\n return;\n }\n const nextSeries = navigableSeries[nextSeriesIndex];\n const nextInternalSeries = series.filter(({ series }) => series === nextSeries)[0];\n\n // 2. Find point in the next series\n let targetXPoint = (xScale.d3Scale(targetX as any) ?? NaN) + xOffset;\n if (!isFinite(targetXPoint)) {\n targetXPoint = 0;\n }\n\n if (nextSeries.type === 'line') {\n const nextScaledSeries = scaledSeries.filter(it => it.series === nextSeries);\n const closestNextSeriesPoint = nextScaledSeries.reduce(\n (prev, curr) => (Math.abs(curr.x - targetXPoint) < Math.abs(prev.x - targetXPoint) ? curr : prev),\n { x: -Infinity, y: -Infinity }\n );\n highlightPoint({ ...closestNextSeriesPoint, color: nextInternalSeries.color, series: nextSeries });\n } else if (isYThreshold(nextSeries)) {\n const scaledTargetIndex = scaledSeries.map(it => it.datum?.x || null).indexOf(targetX);\n highlightPoint({\n x: targetXPoint,\n y: yScale.d3Scale(nextSeries.y) ?? NaN,\n color: nextInternalSeries.color,\n series: nextSeries,\n datum: scaledSeries[scaledTargetIndex]?.datum,\n });\n } else if (isXThreshold(nextSeries)) {\n highlightPoint({\n x: xScale.d3Scale(nextSeries.x as any) ?? NaN,\n y: yScale.d3Scale.range()[0],\n color: nextInternalSeries.color,\n series: nextSeries,\n datum: { x: nextSeries.x, y: NaN },\n });\n }\n },\n [\n isGroupNavigation,\n xScale,\n navigableSeries,\n highlightedSeries,\n containsMultipleSeries,\n highlightSeries,\n highlightPoint,\n series,\n targetX,\n scaledSeries,\n yScale,\n ]\n );\n\n const moveWithinSeries = useCallback(\n (direction: number) => {\n const series = highlightedSeries || visibleSeries[0].series;\n\n if (series.type === 'line' || isYThreshold(series)) {\n const targetScaledSeries = scaledSeries.filter(it => it.series === series);\n const previousPoint = highlightedPoint || targetScaledSeries[0];\n const indexOfPreviousPoint = targetScaledSeries.map(it => it.x).indexOf(previousPoint.x);\n const nextPointIndex = circleIndex(indexOfPreviousPoint + direction, [0, targetScaledSeries.length - 1]);\n const nextPoint = targetScaledSeries[nextPointIndex];\n\n setTargetX(nextPoint.datum?.x || null);\n setXIndex(nextPointIndex);\n highlightPoint(nextPoint);\n } else if (series.type === 'bar') {\n const xDomain = xScale.domain as T[];\n const MAX_GROUP_INDEX = xDomain.length - 1;\n\n let nextGroupIndex = 0;\n if (highlightedGroupIndex !== null) {\n // find next group\n nextGroupIndex = highlightedGroupIndex + direction;\n if (nextGroupIndex > MAX_GROUP_INDEX) {\n nextGroupIndex = 0;\n } else if (nextGroupIndex < 0) {\n nextGroupIndex = MAX_GROUP_INDEX;\n }\n }\n\n const nextDomainIndex = nextValidDomainIndex(nextGroupIndex, barGroups, direction);\n setTargetX(xDomain[nextDomainIndex]);\n highlightGroup(nextDomainIndex);\n }\n },\n [\n highlightedSeries,\n visibleSeries,\n scaledSeries,\n highlightedPoint,\n highlightPoint,\n xScale.domain,\n highlightedGroupIndex,\n barGroups,\n highlightGroup,\n ]\n );\n\n const moveToLineGroupIndex = useCallback(\n (index: number) => {\n const point = allUniqueX[index];\n setXIndex(index);\n setTargetX(point.datum?.x || null);\n highlightX({ scaledX: point?.scaledX ?? null, label: point.datum?.x ?? null });\n },\n [allUniqueX, highlightX]\n );\n\n const moveWithinXAxis = useCallback(\n (direction: number) => {\n if (highlightedSeries || isGroupNavigation) {\n moveWithinSeries(direction);\n } else {\n const nextPointGroupIndex = circleIndex(xIndex + direction, [0, allUniqueX.length - 1]);\n moveToLineGroupIndex(nextPointGroupIndex);\n }\n },\n [highlightedSeries, isGroupNavigation, moveWithinSeries, xIndex, allUniqueX.length, moveToLineGroupIndex]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.up &&\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.down &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.space &&\n keyCode !== KeyCode.enter\n ) {\n return;\n }\n\n event.preventDefault();\n\n if (isHandlersDisabled) {\n return;\n }\n\n if (keyCode === KeyCode.down || keyCode === KeyCode.up) {\n moveBetweenSeries(keyCode === KeyCode.down ? 1 : -1);\n } else if (keyCode === KeyCode.left || keyCode === KeyCode.right) {\n moveWithinXAxis(keyCode === KeyCode.right ? 1 : -1);\n } else if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n pinPopover();\n }\n },\n [isHandlersDisabled, moveBetweenSeries, moveWithinXAxis, pinPopover]\n );\n\n return { isGroupNavigation, onFocus, onKeyDown, xIndex };\n}\n\n// Returns given index if it is in range or the opposite range boundary otherwise.\nfunction circleIndex(index: number, [from, to]: [number, number]): number {\n if (index < from) {\n return to;\n }\n if (index > to) {\n return from;\n }\n return index;\n}\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { useCallback, useState } from 'react';
|
|
4
4
|
export function usePopover() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return { isPopoverOpen
|
|
5
|
+
const [state, setState] = useState('closed');
|
|
6
|
+
const isPopoverOpen = state !== 'closed';
|
|
7
|
+
const isPopoverPinned = state === 'pinned';
|
|
8
|
+
const showPopover = useCallback(() => setState('open'), []);
|
|
9
|
+
const pinPopover = useCallback(() => setState('pinned'), []);
|
|
10
|
+
const dismissPopover = useCallback(() => setState('closed'), []);
|
|
11
|
+
return { isPopoverOpen, isPopoverPinned, showPopover, pinPopover, dismissPopover };
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=use-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-popover.js","sourceRoot":"","sources":["../../../../src/mixed-line-bar-chart/hooks/use-popover.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,UAAU,UAAU;
|
|
1
|
+
{"version":3,"file":"use-popover.js","sourceRoot":"","sources":["../../../../src/mixed-line-bar-chart/hooks/use-popover.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,UAAU,UAAU;IACxB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA+B,QAAQ,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,KAAK,KAAK,QAAQ,CAAC;IACzC,MAAM,eAAe,GAAG,KAAK,KAAK,QAAQ,CAAC;IAE3C,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AACrF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback, useState } from 'react';\n\nexport function usePopover() {\n const [state, setState] = useState<'open' | 'closed' | 'pinned'>('closed');\n\n const isPopoverOpen = state !== 'closed';\n const isPopoverPinned = state === 'pinned';\n\n const showPopover = useCallback(() => setState('open'), []);\n const pinPopover = useCallback(() => setState('pinned'), []);\n const dismissPopover = useCallback(() => setState('closed'), []);\n\n return { isPopoverOpen, isPopoverPinned, showPopover, pinPopover, dismissPopover };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
@@ -6,9 +6,9 @@ import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
|
6
6
|
import InternalMixedLineBarChart from './internal';
|
|
7
7
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
8
8
|
function MixedLineBarChart(_a) {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
return (React.createElement(InternalMixedLineBarChart,
|
|
9
|
+
var { series = [], height = 500, xScaleType = 'linear', yScaleType = 'linear', stackedBars = false, horizontalBars = false, statusType = 'finished', detailPopoverSize = 'medium', emphasizeBaselineAxis = true } = _a, props = __rest(_a, ["series", "height", "xScaleType", "yScaleType", "stackedBars", "horizontalBars", "statusType", "detailPopoverSize", "emphasizeBaselineAxis"]);
|
|
10
|
+
const baseComponentProps = useBaseComponent('MixedLineBarChart');
|
|
11
|
+
return (React.createElement(InternalMixedLineBarChart, Object.assign({ series: series, height: height, xScaleType: xScaleType, yScaleType: yScaleType, stackedBars: stackedBars, horizontalBars: horizontalBars, statusType: statusType, detailPopoverSize: detailPopoverSize, emphasizeBaselineAxis: emphasizeBaselineAxis }, props, baseComponentProps)));
|
|
12
12
|
}
|
|
13
13
|
applyDisplayName(MixedLineBarChart, 'MixedLineBarChart');
|
|
14
14
|
export default MixedLineBarChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,yBAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,SAAS,iBAAiB,CAAmC,EAWjC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,yBAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,SAAS,iBAAiB,CAAmC,EAWjC;QAXiC,EAC3D,MAAM,GAAG,EAAE,EACX,MAAM,GAAG,GAAG,EACZ,UAAU,GAAG,QAAQ,EACrB,UAAU,GAAG,QAAQ,EACrB,WAAW,GAAG,KAAK,EACnB,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,UAAU,EACvB,iBAAiB,GAAG,QAAQ,EAC5B,qBAAqB,GAAG,IAAI,OAEF,EADvB,KAAK,cAVmD,6IAW5D,CADS;IAER,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACjE,OAAO,CACL,oBAAC,yBAAyB,kBACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,qBAAqB,EAAE,qBAAqB,IACxC,KAAK,EACL,kBAAkB,EACtB,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAEzD,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\n\nimport { MixedLineBarChartProps } from './interfaces';\nimport InternalMixedLineBarChart from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { MixedLineBarChartProps };\n\nfunction MixedLineBarChart<T extends number | string | Date>({\n series = [],\n height = 500,\n xScaleType = 'linear',\n yScaleType = 'linear',\n stackedBars = false,\n horizontalBars = false,\n statusType = 'finished',\n detailPopoverSize = 'medium',\n emphasizeBaselineAxis = true,\n ...props\n}: MixedLineBarChartProps<T>) {\n const baseComponentProps = useBaseComponent('MixedLineBarChart');\n return (\n <InternalMixedLineBarChart\n series={series}\n height={height}\n xScaleType={xScaleType}\n yScaleType={yScaleType}\n stackedBars={stackedBars}\n horizontalBars={horizontalBars}\n statusType={statusType}\n detailPopoverSize={detailPopoverSize}\n emphasizeBaselineAxis={emphasizeBaselineAxis}\n {...props}\n {...baseComponentProps}\n />\n );\n}\n\napplyDisplayName(MixedLineBarChart, 'MixedLineBarChart');\n\nexport default MixedLineBarChart;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -21,77 +21,75 @@ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
|
21
21
|
import { nodeContains } from '../internal/utils/dom';
|
|
22
22
|
import { isXThreshold, isYThreshold } from './utils';
|
|
23
23
|
export default function InternalMixedLineBarChart(_a) {
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var gotLineSeries = externalSeries.some(function (s) { return s.type === 'line'; });
|
|
24
|
+
var { height, xScaleType, yScaleType, xDomain, yDomain, highlightedSeries: controlledHighlightedSeries, visibleSeries: controlledVisibleSeries, series: externalSeries, onFilterChange, onHighlightChange: controlledOnHighlightChange, i18nStrings, ariaLabel, ariaLabelledby, ariaDescription, xTitle, yTitle, stackedBars, horizontalBars, hideFilter, additionalFilters, hideLegend, legendTitle, statusType, detailPopoverSize, emphasizeBaselineAxis, empty, noMatch, errorText, loadingText, recoveryText, onRecoveryClick, __internalRootRef = null } = _a, props = __rest(_a, ["height", "xScaleType", "yScaleType", "xDomain", "yDomain", "highlightedSeries", "visibleSeries", "series", "onFilterChange", "onHighlightChange", "i18nStrings", "ariaLabel", "ariaLabelledby", "ariaDescription", "xTitle", "yTitle", "stackedBars", "horizontalBars", "hideFilter", "additionalFilters", "hideLegend", "legendTitle", "statusType", "detailPopoverSize", "emphasizeBaselineAxis", "empty", "noMatch", "errorText", "loadingText", "recoveryText", "onRecoveryClick", "__internalRootRef"]);
|
|
25
|
+
const baseProps = getBaseProps(props);
|
|
26
|
+
const containerRef = useRef(null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const gotBarSeries = externalSeries.some(s => s.type === 'bar');
|
|
29
|
+
const gotLineSeries = externalSeries.some(s => s.type === 'line');
|
|
31
30
|
if (xScaleType !== 'categorical' && gotBarSeries) {
|
|
32
|
-
warnOnce('MixedLineBarChart',
|
|
31
|
+
warnOnce('MixedLineBarChart', `Bar series cannot be used with a ${xScaleType} scale. Use a categorical x axis instead.`);
|
|
33
32
|
}
|
|
34
33
|
if (horizontalBars && gotLineSeries) {
|
|
35
|
-
warnOnce('MixedLineBarChart',
|
|
34
|
+
warnOnce('MixedLineBarChart', `Property horizontalBars can only be used with charts that contain only bar or threshold series.`);
|
|
36
35
|
}
|
|
37
|
-
for (
|
|
38
|
-
var s = externalSeries_1[_i];
|
|
36
|
+
for (const s of externalSeries) {
|
|
39
37
|
if (s.type === 'threshold' && s.x !== undefined && s.y !== undefined) {
|
|
40
|
-
warnOnce('MixedLineBarChart',
|
|
38
|
+
warnOnce('MixedLineBarChart', `Series of type "threshold" must contain either x or y property.`);
|
|
41
39
|
}
|
|
42
40
|
if (s.type === 'threshold' && s.x === undefined && s.y === undefined) {
|
|
43
|
-
warnOnce('MixedLineBarChart',
|
|
41
|
+
warnOnce('MixedLineBarChart', `Series of type "threshold" must contain either x or y property.`);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
}, [xScaleType, horizontalBars, externalSeries]);
|
|
47
|
-
|
|
45
|
+
const series = useMemo(() => {
|
|
48
46
|
// Generate series colors if not explicitly provided.
|
|
49
47
|
// The thresholds use a dedicated colour scale.
|
|
50
|
-
|
|
51
|
-
return externalSeries.map(
|
|
48
|
+
const colors = createCategoryColorScale(externalSeries, it => isYThreshold(it) || isXThreshold(it), it => it.color || null);
|
|
49
|
+
return externalSeries.map((s, i) => ({ index: i, color: colors[i], series: s }));
|
|
52
50
|
}, [externalSeries]);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
const [highlightedPoint, setHighlightedPoint] = useState(null);
|
|
52
|
+
const [highlightedGroupIndex, setHighlightedGroupIndex] = useState(null);
|
|
53
|
+
const [highlightedSeries = null, setHighlightedSeries] = useControllable(controlledHighlightedSeries, controlledOnHighlightChange, null, {
|
|
56
54
|
componentName: 'MixedLineBarChart',
|
|
57
55
|
controlledProp: 'highlightedSeries',
|
|
58
|
-
changeHandler: 'onHighlightChange'
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
useEffect(
|
|
56
|
+
changeHandler: 'onHighlightChange',
|
|
57
|
+
});
|
|
58
|
+
const [legendSeries, setLegendSeries] = useState(highlightedSeries);
|
|
59
|
+
useEffect(() => {
|
|
62
60
|
setLegendSeries(controlledHighlightedSeries || null);
|
|
63
61
|
}, [controlledHighlightedSeries]);
|
|
64
|
-
|
|
62
|
+
const [externalVisibleSeries, setExternalVisibleSeries] = useControllable(controlledVisibleSeries, onFilterChange, externalSeries, {
|
|
65
63
|
componentName: 'MixedLineBarChart',
|
|
66
64
|
controlledProp: 'visibleSeries',
|
|
67
|
-
changeHandler: 'onFilterChange'
|
|
68
|
-
})
|
|
65
|
+
changeHandler: 'onFilterChange',
|
|
66
|
+
});
|
|
69
67
|
if (isDevelopment) {
|
|
70
68
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const previousSeries = usePrevious(externalSeries);
|
|
70
|
+
const hasPrevious = !!(previousSeries && previousSeries.length);
|
|
71
|
+
const hasCurrent = !!externalSeries.length;
|
|
74
72
|
if (hasPrevious && hasCurrent && externalSeries !== previousSeries && !controlledVisibleSeries && !hideFilter) {
|
|
75
73
|
warnOnce('MixedLineBarChart', 'The `series` value passed into the component changed. ' +
|
|
76
74
|
'This may cause problems with filtering - we recommend that you make the `series` value constant, ' +
|
|
77
75
|
'or provide a `visibleSeries` value that derives from the current `series` value.');
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
const visibleSeries = useMemo(() => series.filter(s => (externalVisibleSeries === null || externalVisibleSeries === void 0 ? void 0 : externalVisibleSeries.indexOf(s.series)) !== -1), [series, externalVisibleSeries]);
|
|
79
|
+
const filterChange = (selectedSeries) => {
|
|
82
80
|
setExternalVisibleSeries(selectedSeries);
|
|
83
81
|
fireNonCancelableEvent(onFilterChange, {
|
|
84
|
-
visibleSeries: selectedSeries
|
|
82
|
+
visibleSeries: selectedSeries,
|
|
85
83
|
});
|
|
86
84
|
};
|
|
87
|
-
|
|
85
|
+
const onHighlightChange = (series) => {
|
|
88
86
|
setHighlightedSeries(series);
|
|
89
87
|
fireNonCancelableEvent(controlledOnHighlightChange, {
|
|
90
|
-
highlightedSeries: series
|
|
88
|
+
highlightedSeries: series,
|
|
91
89
|
});
|
|
92
90
|
setLegendSeries(series);
|
|
93
91
|
};
|
|
94
|
-
|
|
92
|
+
const onBlur = (event) => {
|
|
95
93
|
if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {
|
|
96
94
|
highlightedSeries && onHighlightChange(highlightedSeries);
|
|
97
95
|
setHighlightedPoint(null);
|
|
@@ -99,23 +97,23 @@ export default function InternalMixedLineBarChart(_a) {
|
|
|
99
97
|
setLegendSeries(null);
|
|
100
98
|
}
|
|
101
99
|
};
|
|
102
|
-
|
|
100
|
+
const { isEmpty, isNoMatch, showChart } = getChartStatus({
|
|
103
101
|
externalData: externalSeries,
|
|
104
102
|
visibleData: visibleSeries || [],
|
|
105
|
-
statusType
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return (React.createElement("div",
|
|
103
|
+
statusType,
|
|
104
|
+
});
|
|
105
|
+
const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch);
|
|
106
|
+
const showLegend = !hideLegend && !isEmpty && statusType === 'finished';
|
|
107
|
+
const reserveLegendSpace = !showChart && !hideLegend;
|
|
108
|
+
const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);
|
|
109
|
+
const mergedRef = useMergeRefs(containerRef, __internalRootRef);
|
|
110
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef, onBlur: onBlur }),
|
|
113
111
|
showFilters && (React.createElement(InternalBox, { className: cartesianStyles['filter-container'], margin: { bottom: 'l' } },
|
|
114
112
|
React.createElement(InternalChartFilters, { series: series, visibleSeries: externalVisibleSeries || [], onChange: filterChange, i18nStrings: i18nStrings, hideFilter: hideFilter, additionalFilters: additionalFilters }))),
|
|
115
|
-
React.createElement("div", { className: clsx(styles.content,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
React.createElement("div", { className: clsx(styles.content, {
|
|
114
|
+
[styles['content--reserve-filter']]: reserveFilterSpace,
|
|
115
|
+
[styles['content--reserve-legend']]: reserveLegendSpace,
|
|
116
|
+
}), style: { minHeight: height } },
|
|
119
117
|
React.createElement(ChartStatusContainer, { isEmpty: isEmpty, isNoMatch: isNoMatch, showChart: showChart, statusType: statusType, empty: empty, noMatch: noMatch, loadingText: loadingText, errorText: errorText, recoveryText: recoveryText, onRecoveryClick: onRecoveryClick }),
|
|
120
118
|
showChart && (React.createElement(ChartContainer, { height: height, xScaleType: xScaleType, yScaleType: yScaleType, xDomain: xDomain, yDomain: yDomain, xTickFormatter: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.xTickFormatter, yTickFormatter: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.yTickFormatter, emphasizeBaselineAxis: emphasizeBaselineAxis, stackedBars: stackedBars, horizontalBars: horizontalBars, series: series, visibleSeries: visibleSeries, highlightedSeries: highlightedSeries, onHighlightChange: onHighlightChange, highlightedPoint: highlightedPoint, setHighlightedPoint: setHighlightedPoint, highlightedGroupIndex: highlightedGroupIndex, setHighlightedGroupIndex: setHighlightedGroupIndex, detailPopoverSize: detailPopoverSize, xTitle: xTitle, yTitle: yTitle, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, i18nStrings: i18nStrings, plotContainerRef: containerRef }))),
|
|
121
119
|
showLegend && (React.createElement(InternalBox, { margin: { top: 'm' } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAA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iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,YAAY,GAC9B,CACH,CACG;QAEL,UAAU,IAAI,CACb,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,mBAAmB,IAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,qBAAqB,IAAI,EAAE,EAC1C,iBAAiB,EAAE,YAAY,EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { warnOnce } from '../internal/logging';\n\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport InternalChartFilters from './chart-filters';\nimport InternalChartLegend from './chart-legend';\nimport ChartContainer from './chart-container';\nimport cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport { ScaledPoint } from './make-scaled-series';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { nodeContains } from '../internal/utils/dom';\nimport { SomeRequired } from '../internal/types';\nimport { isXThreshold, isYThreshold } from './utils';\n\ntype InternalMixedLineBarChartProps<T extends ChartDataTypes> = SomeRequired<\n MixedLineBarChartProps<T>,\n | 'series'\n | 'height'\n | 'xScaleType'\n | 'yScaleType'\n | 'stackedBars'\n | 'horizontalBars'\n | 'statusType'\n | 'detailPopoverSize'\n | 'emphasizeBaselineAxis'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalMixedLineBarChart<T extends number | string | Date>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n stackedBars,\n horizontalBars,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n emphasizeBaselineAxis,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalMixedLineBarChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const gotBarSeries = externalSeries.some(s => s.type === 'bar');\n const gotLineSeries = externalSeries.some(s => s.type === 'line');\n\n if (xScaleType !== 'categorical' && gotBarSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Bar series cannot be used with a ${xScaleType} scale. Use a categorical x axis instead.`\n );\n }\n\n if (horizontalBars && gotLineSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Property horizontalBars can only be used with charts that contain only bar or threshold series.`\n );\n }\n\n for (const s of externalSeries) {\n if (s.type === 'threshold' && s.x !== undefined && s.y !== undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n if (s.type === 'threshold' && s.x === undefined && s.y === undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n }\n }, [xScaleType, horizontalBars, externalSeries]);\n\n const series = useMemo(() => {\n // Generate series colors if not explicitly provided.\n // The thresholds use a dedicated colour scale.\n const colors = createCategoryColorScale(\n externalSeries,\n it => isYThreshold(it) || isXThreshold(it),\n it => it.color || null\n );\n\n return externalSeries.map((s, i) => ({ index: i, color: colors[i], series: s }));\n }, [externalSeries]);\n\n const [highlightedPoint, setHighlightedPoint] = useState<ScaledPoint<T> | null>(null);\n const [highlightedGroupIndex, setHighlightedGroupIndex] = useState<number | null>(null);\n const [highlightedSeries = null, setHighlightedSeries] = useControllable(\n controlledHighlightedSeries,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'highlightedSeries',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSeries, setLegendSeries] = useState<MixedLineBarChartProps.ChartSeries<T> | null>(highlightedSeries);\n useEffect(() => {\n setLegendSeries(controlledHighlightedSeries || null);\n }, [controlledHighlightedSeries]);\n\n const [externalVisibleSeries, setExternalVisibleSeries] = useControllable(\n controlledVisibleSeries,\n onFilterChange,\n externalSeries,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'visibleSeries',\n changeHandler: 'onFilterChange',\n }\n );\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousSeries = usePrevious(externalSeries);\n\n const hasPrevious = !!(previousSeries && previousSeries.length);\n const hasCurrent = !!externalSeries.length;\n\n if (hasPrevious && hasCurrent && externalSeries !== previousSeries && !controlledVisibleSeries && !hideFilter) {\n warnOnce(\n 'MixedLineBarChart',\n 'The `series` value passed into the component changed. ' +\n 'This may cause problems with filtering - we recommend that you make the `series` value constant, ' +\n 'or provide a `visibleSeries` value that derives from the current `series` value.'\n );\n }\n }\n\n const visibleSeries = useMemo(\n () => series.filter(s => externalVisibleSeries?.indexOf(s.series) !== -1),\n [series, externalVisibleSeries]\n );\n\n const filterChange = (selectedSeries: ReadonlyArray<MixedLineBarChartProps.ChartSeries<T>>) => {\n setExternalVisibleSeries(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSeries: selectedSeries,\n });\n };\n\n const onHighlightChange = (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n setHighlightedSeries(series);\n fireNonCancelableEvent(controlledOnHighlightChange, {\n highlightedSeries: series,\n });\n setLegendSeries(series);\n };\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSeries && onHighlightChange(highlightedSeries);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(null);\n setLegendSeries(null);\n }\n };\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries || [],\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef} onBlur={onBlur}>\n {showFilters && (\n <InternalBox className={cartesianStyles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalChartFilters\n series={series}\n visibleSeries={externalVisibleSeries || []}\n onChange={filterChange}\n i18nStrings={i18nStrings}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n />\n </InternalBox>\n )}\n\n <div\n className={clsx(styles.content, {\n [styles['content--reserve-filter']]: reserveFilterSpace,\n [styles['content--reserve-legend']]: reserveLegendSpace,\n })}\n style={{ minHeight: height }}\n >\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n {showChart && (\n <ChartContainer\n height={height}\n xScaleType={xScaleType}\n yScaleType={yScaleType}\n xDomain={xDomain}\n yDomain={yDomain}\n xTickFormatter={i18nStrings?.xTickFormatter}\n yTickFormatter={i18nStrings?.yTickFormatter}\n emphasizeBaselineAxis={emphasizeBaselineAxis}\n stackedBars={stackedBars}\n horizontalBars={horizontalBars}\n series={series}\n visibleSeries={visibleSeries}\n highlightedSeries={highlightedSeries}\n onHighlightChange={onHighlightChange}\n highlightedPoint={highlightedPoint}\n setHighlightedPoint={setHighlightedPoint}\n highlightedGroupIndex={highlightedGroupIndex}\n setHighlightedGroupIndex={setHighlightedGroupIndex}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n plotContainerRef={containerRef}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <InternalChartLegend\n series={series}\n visibleSeries={externalVisibleSeries || []}\n highlightedSeries={legendSeries}\n onHighlightChange={onHighlightChange}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,WAAW,MAAM,iBAA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AW,EACxB,gBAAgB,EAAE,YAAY,GAC9B,CACH,CACG;QAEL,UAAU,IAAI,CACb,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,mBAAmB,IAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,qBAAqB,IAAI,EAAE,EAC1C,iBAAiB,EAAE,YAAY,EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { warnOnce } from '../internal/logging';\n\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport InternalChartFilters from './chart-filters';\nimport InternalChartLegend from './chart-legend';\nimport ChartContainer from './chart-container';\nimport cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport { ScaledPoint } from './make-scaled-series';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { nodeContains } from '../internal/utils/dom';\nimport { SomeRequired } from '../internal/types';\nimport { isXThreshold, isYThreshold } from './utils';\n\ntype InternalMixedLineBarChartProps<T extends ChartDataTypes> = SomeRequired<\n MixedLineBarChartProps<T>,\n | 'series'\n | 'height'\n | 'xScaleType'\n | 'yScaleType'\n | 'stackedBars'\n | 'horizontalBars'\n | 'statusType'\n | 'detailPopoverSize'\n | 'emphasizeBaselineAxis'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalMixedLineBarChart<T extends number | string | Date>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n stackedBars,\n horizontalBars,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n emphasizeBaselineAxis,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalMixedLineBarChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const gotBarSeries = externalSeries.some(s => s.type === 'bar');\n const gotLineSeries = externalSeries.some(s => s.type === 'line');\n\n if (xScaleType !== 'categorical' && gotBarSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Bar series cannot be used with a ${xScaleType} scale. Use a categorical x axis instead.`\n );\n }\n\n if (horizontalBars && gotLineSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Property horizontalBars can only be used with charts that contain only bar or threshold series.`\n );\n }\n\n for (const s of externalSeries) {\n if (s.type === 'threshold' && s.x !== undefined && s.y !== undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n if (s.type === 'threshold' && s.x === undefined && s.y === undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n }\n }, [xScaleType, horizontalBars, externalSeries]);\n\n const series = useMemo(() => {\n // Generate series colors if not explicitly provided.\n // The thresholds use a dedicated colour scale.\n const colors = createCategoryColorScale(\n externalSeries,\n it => isYThreshold(it) || isXThreshold(it),\n it => it.color || null\n );\n\n return externalSeries.map((s, i) => ({ index: i, color: colors[i], series: s }));\n }, [externalSeries]);\n\n const [highlightedPoint, setHighlightedPoint] = useState<ScaledPoint<T> | null>(null);\n const [highlightedGroupIndex, setHighlightedGroupIndex] = useState<number | null>(null);\n const [highlightedSeries = null, setHighlightedSeries] = useControllable(\n controlledHighlightedSeries,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'highlightedSeries',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSeries, setLegendSeries] = useState<MixedLineBarChartProps.ChartSeries<T> | null>(highlightedSeries);\n useEffect(() => {\n setLegendSeries(controlledHighlightedSeries || null);\n }, [controlledHighlightedSeries]);\n\n const [externalVisibleSeries, setExternalVisibleSeries] = useControllable(\n controlledVisibleSeries,\n onFilterChange,\n externalSeries,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'visibleSeries',\n changeHandler: 'onFilterChange',\n }\n );\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousSeries = usePrevious(externalSeries);\n\n const hasPrevious = !!(previousSeries && previousSeries.length);\n const hasCurrent = !!externalSeries.length;\n\n if (hasPrevious && hasCurrent && externalSeries !== previousSeries && !controlledVisibleSeries && !hideFilter) {\n warnOnce(\n 'MixedLineBarChart',\n 'The `series` value passed into the component changed. ' +\n 'This may cause problems with filtering - we recommend that you make the `series` value constant, ' +\n 'or provide a `visibleSeries` value that derives from the current `series` value.'\n );\n }\n }\n\n const visibleSeries = useMemo(\n () => series.filter(s => externalVisibleSeries?.indexOf(s.series) !== -1),\n [series, externalVisibleSeries]\n );\n\n const filterChange = (selectedSeries: ReadonlyArray<MixedLineBarChartProps.ChartSeries<T>>) => {\n setExternalVisibleSeries(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSeries: selectedSeries,\n });\n };\n\n const onHighlightChange = (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n setHighlightedSeries(series);\n fireNonCancelableEvent(controlledOnHighlightChange, {\n highlightedSeries: series,\n });\n setLegendSeries(series);\n };\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSeries && onHighlightChange(highlightedSeries);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(null);\n setLegendSeries(null);\n }\n };\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries || [],\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef} onBlur={onBlur}>\n {showFilters && (\n <InternalBox className={cartesianStyles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalChartFilters\n series={series}\n visibleSeries={externalVisibleSeries || []}\n onChange={filterChange}\n i18nStrings={i18nStrings}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n />\n </InternalBox>\n )}\n\n <div\n className={clsx(styles.content, {\n [styles['content--reserve-filter']]: reserveFilterSpace,\n [styles['content--reserve-legend']]: reserveLegendSpace,\n })}\n style={{ minHeight: height }}\n >\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n {showChart && (\n <ChartContainer\n height={height}\n xScaleType={xScaleType}\n yScaleType={yScaleType}\n xDomain={xDomain}\n yDomain={yDomain}\n xTickFormatter={i18nStrings?.xTickFormatter}\n yTickFormatter={i18nStrings?.yTickFormatter}\n emphasizeBaselineAxis={emphasizeBaselineAxis}\n stackedBars={stackedBars}\n horizontalBars={horizontalBars}\n series={series}\n visibleSeries={visibleSeries}\n highlightedSeries={highlightedSeries}\n onHighlightChange={onHighlightChange}\n highlightedPoint={highlightedPoint}\n setHighlightedPoint={setHighlightedPoint}\n highlightedGroupIndex={highlightedGroupIndex}\n setHighlightedGroupIndex={setHighlightedGroupIndex}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n plotContainerRef={containerRef}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <InternalChartLegend\n series={series}\n visibleSeries={externalVisibleSeries || []}\n highlightedSeries={legendSeries}\n onHighlightChange={onHighlightChange}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1,47 +1,42 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { line } from 'd3-shape';
|
|
6
5
|
import { isXThreshold, isYThreshold } from './utils';
|
|
7
|
-
export default function LineSeries(
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var commonProps = { 'aria-hidden': true, stroke: color, clipPath: "url(#".concat(chartAreaClipPath, ")") };
|
|
6
|
+
export default function LineSeries({ axis, series, color, xScale, yScale, chartAreaClipPath }) {
|
|
7
|
+
var _a;
|
|
8
|
+
const commonProps = { 'aria-hidden': true, stroke: color, clipPath: `url(#${chartAreaClipPath})` };
|
|
11
9
|
// Render data path. The chart orientation is ignored as only horizontally-oriented lines are supported.
|
|
12
10
|
if (series.type === 'line') {
|
|
13
|
-
|
|
14
|
-
.x(
|
|
15
|
-
|
|
11
|
+
const lineGenerator = line()
|
|
12
|
+
.x((d) => {
|
|
13
|
+
let x = xScale.d3Scale(d.x) || 0;
|
|
16
14
|
if (xScale.isCategorical()) {
|
|
17
|
-
|
|
15
|
+
const offset = Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2;
|
|
18
16
|
x += offset;
|
|
19
17
|
}
|
|
20
18
|
return x;
|
|
21
19
|
})
|
|
22
|
-
.y(
|
|
20
|
+
.y((d) => yScale.d3Scale(d.y) || 0);
|
|
23
21
|
// Filter out any data that is not part of the xScale
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return xScale.d3Scale(x) !== undefined;
|
|
27
|
-
});
|
|
28
|
-
return (React.createElement("path", __assign({}, commonProps, { d: lineGenerator(visibleData) || '' })));
|
|
22
|
+
const visibleData = series.data.filter(({ x }) => xScale.d3Scale(x) !== undefined);
|
|
23
|
+
return (React.createElement("path", Object.assign({}, commonProps, { d: lineGenerator(visibleData) || '' })));
|
|
29
24
|
}
|
|
30
25
|
// Render a horizontal line (vertical if chart orientation is inverted).
|
|
31
26
|
else if (isYThreshold(series)) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return React.createElement("line",
|
|
27
|
+
const [x1, x2] = xScale.d3Scale.range();
|
|
28
|
+
const y = yScale.d3Scale(series.y);
|
|
29
|
+
const coordinates = axis === 'x' ? { x1, x2, y1: y, y2: y } : { x1: y, x2: y, y1: x1, y2: x2 };
|
|
30
|
+
return React.createElement("line", Object.assign({}, commonProps, coordinates));
|
|
36
31
|
}
|
|
37
32
|
// Render a vertical line (horizontal if chart orientation is inverted).
|
|
38
33
|
// The offset is necessary for categorical scale to render the line in the middle of the category bar.
|
|
39
34
|
else if (isXThreshold(series)) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return React.createElement("line",
|
|
35
|
+
const [y1, y2] = yScale.d3Scale.range();
|
|
36
|
+
const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;
|
|
37
|
+
const x = ((_a = xScale.d3Scale(series.x)) !== null && _a !== void 0 ? _a : NaN) + xOffset;
|
|
38
|
+
const coordinates = axis === 'x' ? { x1: x, x2: x, y1, y2 } : { x1: y1, x2: y2, y1: x, y2: x };
|
|
39
|
+
return React.createElement("line", Object.assign({}, commonProps, coordinates));
|
|
45
40
|
}
|
|
46
41
|
// Bar series are handled separately.
|
|
47
42
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/line-series.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"line-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/line-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAarD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAsB;;IAClH,MAAM,WAAW,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,iBAAiB,GAAG,EAAE,CAAC;IAEnG,wGAAwG;IACxG,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE;QAC1B,MAAM,aAAa,GAAG,IAAI,EAAmC;aAC1D,CAAC,CAAC,CAAC,CAAkC,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAQ,CAAC,I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wE;IACxE,sGAAsG;SACjG,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,CAAC,GAAG,CAAC,MAAA,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAQ,CAAC,mCAAI,GAAG,CAAC,GAAG,OAAO,CAAC;QAC7D,MAAM,WAAW,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QAC/F,OAAO,8CAAU,WAAW,EAAM,WAAW,EAAI,CAAC;KACnD;IACD,qCAAqC;SAChC;QACH,OAAO,IAAI,CAAC;KACb;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { line } from 'd3-shape';\n\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { MixedLineBarChartProps } from './interfaces';\nimport { isXThreshold, isYThreshold } from './utils';\n\nexport interface LineSeriesProps<T> {\n axis: 'x' | 'y';\n series: MixedLineBarChartProps.LineDataSeries<T> | MixedLineBarChartProps.ThresholdSeries<T>;\n\n color: string;\n chartAreaClipPath: string;\n\n xScale: ChartScale;\n yScale: NumericChartScale;\n}\n\nexport default function LineSeries<T>({ axis, series, color, xScale, yScale, chartAreaClipPath }: LineSeriesProps<T>) {\n const commonProps = { 'aria-hidden': true, stroke: color, clipPath: `url(#${chartAreaClipPath})` };\n\n // Render data path. The chart orientation is ignored as only horizontally-oriented lines are supported.\n if (series.type === 'line') {\n const lineGenerator = line<MixedLineBarChartProps.Datum<T>>()\n .x((d: MixedLineBarChartProps.Datum<T>) => {\n let x = xScale.d3Scale(d.x as any) || 0;\n if (xScale.isCategorical()) {\n const offset = Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2;\n x += offset;\n }\n return x;\n })\n .y((d: MixedLineBarChartProps.Datum<T>) => yScale.d3Scale(d.y) || 0);\n\n // Filter out any data that is not part of the xScale\n const visibleData = series.data.filter(({ x }) => xScale.d3Scale(x as any) !== undefined);\n\n return (\n <path\n {...commonProps}\n d={lineGenerator(visibleData as unknown as Array<MixedLineBarChartProps.Datum<T>>) || ''}\n />\n );\n }\n // Render a horizontal line (vertical if chart orientation is inverted).\n else if (isYThreshold(series)) {\n const [x1, x2] = xScale.d3Scale.range();\n const y = yScale.d3Scale(series.y);\n const coordinates = axis === 'x' ? { x1, x2, y1: y, y2: y } : { x1: y, x2: y, y1: x1, y2: x2 };\n return <line {...commonProps} {...coordinates} />;\n }\n // Render a vertical line (horizontal if chart orientation is inverted).\n // The offset is necessary for categorical scale to render the line in the middle of the category bar.\n else if (isXThreshold(series)) {\n const [y1, y2] = yScale.d3Scale.range();\n const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n const x = (xScale.d3Scale(series.x as any) ?? NaN) + xOffset;\n const coordinates = axis === 'x' ? { x1: x, x2: x, y1, y2 } : { x1: y1, x2: y2, y1: x, y2: x };\n return <line {...commonProps} {...coordinates} />;\n }\n // Bar series are handled separately.\n else {\n return null;\n }\n}\n"]}
|
|
@@ -6,14 +6,13 @@ export default function makeScaledBarGroups(series, xScale, plotWidth, plotHeigh
|
|
|
6
6
|
if (!xScale.isCategorical()) {
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
9
|
-
return xScale.domain.map(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
return xScale.domain.map(x => {
|
|
10
|
+
const scaledX = xScale.d3Scale(x);
|
|
11
|
+
const isValid = typeof scaledX !== 'undefined' && isFinite(scaledX);
|
|
12
12
|
return {
|
|
13
|
-
x
|
|
14
|
-
isValid
|
|
15
|
-
hasData: series.some(
|
|
16
|
-
var series = _a.series;
|
|
13
|
+
x,
|
|
14
|
+
isValid,
|
|
15
|
+
hasData: series.some(({ series }) => {
|
|
17
16
|
// If there is a threshold series, every valid group will have a data point.
|
|
18
17
|
if (isYThreshold(series)) {
|
|
19
18
|
return true;
|
|
@@ -23,7 +22,7 @@ export default function makeScaledBarGroups(series, xScale, plotWidth, plotHeigh
|
|
|
23
22
|
return false;
|
|
24
23
|
}
|
|
25
24
|
if (isDataSeries(series)) {
|
|
26
|
-
return series.data.some(
|
|
25
|
+
return series.data.some(datum => matchesX(datum.x, x));
|
|
27
26
|
}
|
|
28
27
|
return false;
|
|
29
28
|
}),
|
|
@@ -32,14 +31,14 @@ export default function makeScaledBarGroups(series, xScale, plotWidth, plotHeigh
|
|
|
32
31
|
x: 0,
|
|
33
32
|
y: isValid ? scaledX || 0 : 0,
|
|
34
33
|
width: plotWidth,
|
|
35
|
-
height: xScale.d3Scale.bandwidth()
|
|
34
|
+
height: xScale.d3Scale.bandwidth(),
|
|
36
35
|
}
|
|
37
36
|
: {
|
|
38
37
|
x: isValid ? scaledX || 0 : 0,
|
|
39
38
|
y: 0,
|
|
40
39
|
width: xScale.d3Scale.bandwidth(),
|
|
41
|
-
height: plotHeight
|
|
42
|
-
}
|
|
40
|
+
height: plotHeight,
|
|
41
|
+
},
|
|
43
42
|
};
|
|
44
43
|
});
|
|
45
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc7E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,MAA6C,EAC7C,MAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,IAAe;IAEf,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IAED,OAAQ,MAAM,CAAC,MAA2B,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"make-scaled-bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc7E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,MAA6C,EAC7C,MAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,IAAe;IAEf,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IAED,OAAQ,MAAM,CAAC,MAA2B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEpE,OAAO;YACL,CAAC;YACD,OAAO;YACP,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;gBAClC,4EAA4E;gBAC5E,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAO,IAAI,CAAC;iBACb;gBACD,6CAA6C;gBAC7C,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;gBACD,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAQ,MAAM,CAAC,IAAuD,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;iBAC5G;gBACD,OAAO,KAAK,CAAC;YACf,CAAC,CAAC;YACF,QAAQ,EACN,IAAI,KAAK,GAAG;gBACV,CAAC,CAAC;oBACE,CAAC,EAAE,CAAC;oBACJ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7B,KAAK,EAAE,SAAS;oBAChB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;iBACnC;gBACH,CAAC,CAAC;oBACE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7B,CAAC,EAAE,CAAC;oBACJ,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;oBACjC,MAAM,EAAE,UAAU;iBACnB;SACR,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\nimport { ChartScale } from '../internal/components/cartesian-chart/scales';\nimport { isDataSeries, isXThreshold, isYThreshold, matchesX } from './utils';\n\nexport interface ScaledBarGroup<T> {\n x: T;\n hasData: boolean;\n isValid: boolean;\n position: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\n/**\n * Creates a list of all bar (and mixed) groups in the series with their scaled positions.\n */\nexport default function makeScaledBarGroups<T extends ChartDataTypes>(\n series: ReadonlyArray<InternalChartSeries<T>>,\n xScale: ChartScale,\n plotWidth: number,\n plotHeight: number,\n axis: 'x' | 'y'\n): ScaledBarGroup<T>[] {\n if (!xScale.isCategorical()) {\n return [];\n }\n\n return (xScale.domain as ReadonlyArray<T>).map(x => {\n const scaledX = xScale.d3Scale(x);\n const isValid = typeof scaledX !== 'undefined' && isFinite(scaledX);\n\n return {\n x,\n isValid,\n hasData: series.some(({ series }) => {\n // If there is a threshold series, every valid group will have a data point.\n if (isYThreshold(series)) {\n return true;\n }\n // X-thresholds do not have associated value.\n if (isXThreshold(series)) {\n return false;\n }\n if (isDataSeries(series)) {\n return (series.data as ReadonlyArray<MixedLineBarChartProps.Datum<T>>).some(datum => matchesX(datum.x, x));\n }\n return false;\n }),\n position:\n axis === 'x'\n ? {\n x: 0,\n y: isValid ? scaledX || 0 : 0,\n width: plotWidth,\n height: xScale.d3Scale.bandwidth(),\n }\n : {\n x: isValid ? scaledX || 0 : 0,\n y: 0,\n width: xScale.d3Scale.bandwidth(),\n height: plotHeight,\n },\n };\n });\n}\n"]}
|