@cloudscape-design/components-themeable 3.0.1319 → 3.0.1320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/attribute-editor/styles.scss +5 -0
- package/lib/internal/scss/expandable-section/styles.scss +4 -5
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/app-layout/drawer/overflow-menu.d.ts +2 -1
- package/lib/internal/template/app-layout/drawer/overflow-menu.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/overflow-menu.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -25
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/breadcrumb-group/implementation.d.ts +2 -1
- package/lib/internal/template/breadcrumb-group/implementation.d.ts.map +1 -1
- package/lib/internal/template/breadcrumb-group/implementation.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/interfaces.d.ts +0 -4
- package/lib/internal/template/breadcrumb-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/breadcrumb-group/interfaces.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/internal-interfaces.d.ts +6 -0
- package/lib/internal/template/breadcrumb-group/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/breadcrumb-group/internal-interfaces.js +2 -0
- package/lib/internal/template/breadcrumb-group/internal-interfaces.js.map +1 -0
- package/lib/internal/template/breadcrumb-group/skeleton.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts +0 -101
- package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/button-dropdown/internal-interfaces.d.ts +104 -0
- package/lib/internal/template/button-dropdown/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/button-dropdown/internal-interfaces.js +2 -0
- package/lib/internal/template/button-dropdown/internal-interfaces.js.map +1 -0
- package/lib/internal/template/button-dropdown/internal.d.ts +2 -1
- package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
- package/lib/internal/template/button-dropdown/items-list.d.ts +1 -1
- package/lib/internal/template/button-dropdown/items-list.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/items-list.js.map +1 -1
- package/lib/internal/template/button-group/icon-button-item.d.ts +2 -1
- package/lib/internal/template/button-group/icon-button-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/icon-button-item.js.map +1 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.d.ts +2 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/icon-toggle-button-item.js.map +1 -1
- package/lib/internal/template/button-group/interfaces.d.ts +0 -14
- package/lib/internal/template/button-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-group/interfaces.js.map +1 -1
- package/lib/internal/template/button-group/internal-interfaces.d.ts +16 -0
- package/lib/internal/template/button-group/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/button-group/internal-interfaces.js +2 -0
- package/lib/internal/template/button-group/internal-interfaces.js.map +1 -0
- package/lib/internal/template/button-group/internal.d.ts +2 -1
- package/lib/internal/template/button-group/internal.d.ts.map +1 -1
- package/lib/internal/template/button-group/internal.js.map +1 -1
- package/lib/internal/template/column-layout/flexible-column-layout/index.d.ts +1 -1
- package/lib/internal/template/column-layout/flexible-column-layout/index.d.ts.map +1 -1
- package/lib/internal/template/column-layout/flexible-column-layout/index.js.map +1 -1
- package/lib/internal/template/column-layout/grid-column-layout.d.ts +1 -1
- package/lib/internal/template/column-layout/grid-column-layout.d.ts.map +1 -1
- package/lib/internal/template/column-layout/grid-column-layout.js.map +1 -1
- package/lib/internal/template/column-layout/interfaces.d.ts +0 -9
- package/lib/internal/template/column-layout/interfaces.d.ts.map +1 -1
- package/lib/internal/template/column-layout/interfaces.js.map +1 -1
- package/lib/internal/template/column-layout/internal-interfaces.d.ts +11 -0
- package/lib/internal/template/column-layout/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/column-layout/internal-interfaces.js +2 -0
- package/lib/internal/template/column-layout/internal-interfaces.js.map +1 -0
- package/lib/internal/template/column-layout/internal.d.ts +1 -1
- package/lib/internal/template/column-layout/internal.d.ts.map +1 -1
- package/lib/internal/template/column-layout/internal.js.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-container.d.ts +1 -1
- package/lib/internal/template/expandable-section/expandable-section-container.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-container.js.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.d.ts +2 -1
- package/lib/internal/template/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
- package/lib/internal/template/expandable-section/interfaces.d.ts +0 -1
- package/lib/internal/template/expandable-section/interfaces.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/interfaces.js.map +1 -1
- package/lib/internal/template/expandable-section/internal-interfaces.d.ts +3 -0
- package/lib/internal/template/expandable-section/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/expandable-section/internal-interfaces.js +2 -0
- package/lib/internal/template/expandable-section/internal-interfaces.js.map +1 -0
- package/lib/internal/template/expandable-section/internal.d.ts +2 -1
- package/lib/internal/template/expandable-section/internal.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/internal.js.map +1 -1
- package/lib/internal/template/expandable-section/styles.css.js +35 -35
- package/lib/internal/template/expandable-section/styles.scoped.css +71 -74
- package/lib/internal/template/expandable-section/styles.selectors.js +35 -35
- package/lib/internal/template/expandable-section/utils.d.ts +1 -1
- package/lib/internal/template/expandable-section/utils.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/utils.js.map +1 -1
- package/lib/internal/template/flashbar/collapsible-flashbar.d.ts +1 -1
- package/lib/internal/template/flashbar/collapsible-flashbar.d.ts.map +1 -1
- package/lib/internal/template/flashbar/collapsible-flashbar.js.map +1 -1
- package/lib/internal/template/flashbar/common.d.ts +2 -1
- package/lib/internal/template/flashbar/common.d.ts.map +1 -1
- package/lib/internal/template/flashbar/common.js.map +1 -1
- package/lib/internal/template/flashbar/implementation.d.ts +1 -1
- package/lib/internal/template/flashbar/implementation.d.ts.map +1 -1
- package/lib/internal/template/flashbar/implementation.js.map +1 -1
- package/lib/internal/template/flashbar/interfaces.d.ts +0 -2
- package/lib/internal/template/flashbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/flashbar/interfaces.js.map +1 -1
- package/lib/internal/template/flashbar/internal-interfaces.d.ts +4 -0
- package/lib/internal/template/flashbar/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/flashbar/internal-interfaces.js +2 -0
- package/lib/internal/template/flashbar/internal-interfaces.js.map +1 -0
- package/lib/internal/template/flashbar/non-collapsible-flashbar.d.ts +1 -1
- package/lib/internal/template/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
- package/lib/internal/template/flashbar/non-collapsible-flashbar.js.map +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts +2 -15
- package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form-field/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal-interfaces.d.ts +17 -0
- package/lib/internal/template/form-field/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/form-field/internal-interfaces.js +2 -0
- package/lib/internal/template/form-field/internal-interfaces.js.map +1 -0
- package/lib/internal/template/form-field/internal.d.ts +1 -1
- package/lib/internal/template/form-field/internal.d.ts.map +1 -1
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/menu-dropdown/interfaces.d.ts +1 -1
- package/lib/internal/template/internal/components/menu-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/menu-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/item-card/interfaces.d.ts +0 -19
- package/lib/internal/template/item-card/interfaces.d.ts.map +1 -1
- package/lib/internal/template/item-card/interfaces.js.map +1 -1
- package/lib/internal/template/item-card/internal-interfaces.d.ts +22 -0
- package/lib/internal/template/item-card/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/item-card/internal-interfaces.js +2 -0
- package/lib/internal/template/item-card/internal-interfaces.js.map +1 -0
- package/lib/internal/template/item-card/internal.d.ts +1 -1
- package/lib/internal/template/item-card/internal.d.ts.map +1 -1
- package/lib/internal/template/item-card/internal.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/chart-legend.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/data-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/domain.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/domain.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/domain.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/format-highlighted.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/interfaces.d.ts +0 -5
- package/lib/internal/template/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/internal-interfaces.d.ts +7 -0
- package/lib/internal/template/mixed-line-bar-chart/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/mixed-line-bar-chart/internal-interfaces.js +2 -0
- package/lib/internal/template/mixed-line-bar-chart/internal-interfaces.js.map +1 -0
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-bar-groups.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/make-scaled-series.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/utils.d.ts +2 -1
- package/lib/internal/template/mixed-line-bar-chart/utils.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/utils.js.map +1 -1
- package/lib/internal/template/navigable-group/interfaces.d.ts +0 -3
- package/lib/internal/template/navigable-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/navigable-group/interfaces.js.map +1 -1
- package/lib/internal/template/navigable-group/internal-interfaces.d.ts +5 -0
- package/lib/internal/template/navigable-group/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/navigable-group/internal-interfaces.js +4 -0
- package/lib/internal/template/navigable-group/internal-interfaces.js.map +1 -0
- package/lib/internal/template/navigable-group/internal.d.ts +2 -1
- package/lib/internal/template/navigable-group/internal.d.ts.map +1 -1
- package/lib/internal/template/navigable-group/internal.js.map +1 -1
- package/lib/internal/template/popover/arrow.d.ts +1 -1
- package/lib/internal/template/popover/arrow.d.ts.map +1 -1
- package/lib/internal/template/popover/arrow.js.map +1 -1
- package/lib/internal/template/popover/container.d.ts +2 -1
- package/lib/internal/template/popover/container.d.ts.map +1 -1
- package/lib/internal/template/popover/container.js.map +1 -1
- package/lib/internal/template/popover/interfaces.d.ts +0 -4
- package/lib/internal/template/popover/interfaces.d.ts.map +1 -1
- package/lib/internal/template/popover/interfaces.js.map +1 -1
- package/lib/internal/template/popover/internal-interfaces.d.ts +5 -0
- package/lib/internal/template/popover/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/popover/internal-interfaces.js +4 -0
- package/lib/internal/template/popover/internal-interfaces.js.map +1 -0
- package/lib/internal/template/popover/use-popover-position.d.ts +2 -1
- package/lib/internal/template/popover/use-popover-position.d.ts.map +1 -1
- package/lib/internal/template/popover/use-popover-position.js.map +1 -1
- package/lib/internal/template/popover/utils/positions.d.ts +2 -1
- package/lib/internal/template/popover/utils/positions.d.ts.map +1 -1
- package/lib/internal/template/popover/utils/positions.js.map +1 -1
- package/lib/internal/template/property-filter/controller.d.ts +2 -1
- package/lib/internal/template/property-filter/controller.d.ts.map +1 -1
- package/lib/internal/template/property-filter/controller.js.map +1 -1
- package/lib/internal/template/property-filter/i18n-utils.d.ts +2 -1
- package/lib/internal/template/property-filter/i18n-utils.d.ts.map +1 -1
- package/lib/internal/template/property-filter/i18n-utils.js.map +1 -1
- package/lib/internal/template/property-filter/interfaces.d.ts +1 -50
- package/lib/internal/template/property-filter/interfaces.d.ts.map +1 -1
- package/lib/internal/template/property-filter/interfaces.js.map +1 -1
- package/lib/internal/template/property-filter/internal-interfaces.d.ts +52 -0
- package/lib/internal/template/property-filter/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/property-filter/internal-interfaces.js +4 -0
- package/lib/internal/template/property-filter/internal-interfaces.js.map +1 -0
- package/lib/internal/template/property-filter/internal.d.ts.map +1 -1
- package/lib/internal/template/property-filter/internal.js.map +1 -1
- package/lib/internal/template/property-filter/property-editor.d.ts +2 -1
- package/lib/internal/template/property-filter/property-editor.d.ts.map +1 -1
- package/lib/internal/template/property-filter/property-editor.js.map +1 -1
- package/lib/internal/template/property-filter/token-editor-inputs.d.ts +2 -1
- package/lib/internal/template/property-filter/token-editor-inputs.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token-editor-inputs.js.map +1 -1
- package/lib/internal/template/property-filter/token-editor.d.ts +2 -1
- package/lib/internal/template/property-filter/token-editor.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token-editor.js.map +1 -1
- package/lib/internal/template/property-filter/token.d.ts +2 -1
- package/lib/internal/template/property-filter/token.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token.js.map +1 -1
- package/lib/internal/template/property-filter/utils.d.ts +2 -1
- package/lib/internal/template/property-filter/utils.d.ts.map +1 -1
- package/lib/internal/template/property-filter/utils.js.map +1 -1
- package/lib/internal/template/table/interfaces.d.ts +0 -1
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal-interfaces.d.ts +3 -0
- package/lib/internal/template/table/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/table/internal-interfaces.js +2 -0
- package/lib/internal/template/table/internal-interfaces.js.map +1 -0
- package/lib/internal/template/table/selection/use-group-selection.d.ts +2 -1
- package/lib/internal/template/table/selection/use-group-selection.d.ts.map +1 -1
- package/lib/internal/template/table/selection/use-group-selection.js.map +1 -1
- package/lib/internal/template/table/selection/use-selection-focus-move.d.ts +1 -1
- package/lib/internal/template/table/selection/use-selection-focus-move.d.ts.map +1 -1
- package/lib/internal/template/table/selection/use-selection-focus-move.js.map +1 -1
- package/lib/internal/template/table/selection/use-selection.d.ts +2 -1
- package/lib/internal/template/table/selection/use-selection.d.ts.map +1 -1
- package/lib/internal/template/table/selection/use-selection.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts +2 -1
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/table/use-table-focus-navigation.d.ts +2 -1
- package/lib/internal/template/table/use-table-focus-navigation.d.ts.map +1 -1
- package/lib/internal/template/table/use-table-focus-navigation.js.map +1 -1
- package/lib/internal/template/tooltip/interfaces.d.ts +0 -10
- package/lib/internal/template/tooltip/interfaces.d.ts.map +1 -1
- package/lib/internal/template/tooltip/interfaces.js.map +1 -1
- package/lib/internal/template/tooltip/internal-interfaces.d.ts +12 -0
- package/lib/internal/template/tooltip/internal-interfaces.d.ts.map +1 -0
- package/lib/internal/template/tooltip/internal-interfaces.js +2 -0
- package/lib/internal/template/tooltip/internal-interfaces.js.map +1 -0
- package/lib/internal/template/tooltip/internal.d.ts +1 -1
- package/lib/internal/template/tooltip/internal.d.ts.map +1 -1
- package/lib/internal/template/tooltip/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAG5E,OAAO,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"data-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAG5E,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,qEAAqE;AACrE,MAAM,YAAY,GAAG,CAAC,CAAC;AAoBvB,MAAM,CAAC,OAAO,UAAU,UAAU,CAA2B,EAC3D,IAAI,EACJ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,MAAM,EACN,KAAK,GACc;IACnB,MAAM,iBAAiB,GAAG,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAEjF,yHAAyH;IACzH,MAAM,gBAAgB,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;IAEtE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;QACpC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,OAAO,GAAmE,EAAE,CAAC;QACnF,aAAa,CAAC,OAAO,CAAC,CAAC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,KAAK,EACxB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE;4BAC/D,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,aAAa;4BAC9C,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ;yBACrC,CAAC;wBAEF,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,gBAAgB,GACnC,CACA,CACL,CAAC;gBACJ,CAAC;gBAED,KAAK,KAAK;oBACR,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,MAAM,EAC3E,WAAW,EAAE,KAAK,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAC/C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,QAAQ,EAChB,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB,EAC5C,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;YACN,CAAC;QACH,CAAC,CAAC,CACA,CACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport BarSeries from './bar-series';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\nimport LineSeries from './line-series';\nimport { calculateStackedBarValues } from './utils';\n\nimport styles from './styles.css.js';\n\n// Should have the same value as the `border-line-chart-width` token.\nconst STROKE_WIDTH = 2;\n\ninterface DataSeriesProps<T> {\n axis: 'x' | 'y';\n\n plotHeight: number;\n plotWidth: number;\n\n highlightedSeries: MixedLineBarChartProps.ChartSeries<T> | null;\n highlightedGroupIndex: number | null;\n\n stackedBars: boolean;\n isGroupNavigation: boolean;\n\n visibleSeries: ReadonlyArray<InternalChartSeries<T>>;\n xScale: ChartScale;\n yScale: NumericChartScale;\n isRtl?: boolean;\n}\n\nexport default function DataSeries<T extends ChartDataTypes>({\n axis,\n plotHeight,\n plotWidth,\n highlightedGroupIndex,\n highlightedSeries,\n stackedBars,\n isGroupNavigation,\n visibleSeries,\n xScale,\n yScale,\n isRtl,\n}: DataSeriesProps<T>) {\n const chartAreaClipPath = useUniqueId('awsui-mixed-line-bar-chart__chart-area-');\n\n // Lines get a small extra space at the top and bottom to account for the strokes when they are at the edge of the graph.\n const lineAreaClipPath = useUniqueId('awsui-line-chart__chart-area-');\n\n const stackedBarValues = useMemo(() => {\n if (!stackedBars) {\n return undefined;\n }\n const barData: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]> = [];\n visibleSeries.forEach(({ series }) => {\n if (series.type === 'bar') {\n barData.push(series.data);\n } else {\n barData.push([]);\n }\n });\n return calculateStackedBarValues(barData);\n }, [visibleSeries, stackedBars]);\n\n return (\n <>\n <defs aria-hidden=\"true\">\n <clipPath id={chartAreaClipPath}>\n <rect x={0} y={0} width={plotWidth} height={plotHeight} />\n </clipPath>\n <clipPath id={lineAreaClipPath}>\n <rect x={0} y={-STROKE_WIDTH / 2} width={plotWidth} height={plotHeight + STROKE_WIDTH} />\n </clipPath>\n </defs>\n <g aria-hidden={isGroupNavigation ? true : undefined} role=\"group\">\n {visibleSeries.map(({ series, color }, index) => {\n const isHighlighted = series === highlightedSeries;\n const isDimmed = !!highlightedSeries && !isHighlighted;\n\n switch (series.type) {\n case 'line':\n case 'threshold': {\n return (\n <g\n key={index}\n role=\"group\"\n aria-label={series.title}\n className={clsx(styles.series, styles[`series--${series.type}`], {\n [styles['series--highlighted']]: isHighlighted,\n [styles['series--dimmed']]: isDimmed,\n })}\n >\n <LineSeries\n axis={axis}\n series={series}\n color={color}\n xScale={xScale}\n yScale={yScale}\n chartAreaClipPath={lineAreaClipPath}\n />\n </g>\n );\n }\n\n case 'bar':\n return (\n <BarSeries\n key={index}\n axis={axis}\n series={series}\n color={color}\n totalSeriesCount={visibleSeries.filter(s => s.series.type === 'bar').length}\n seriesIndex={index}\n xScale={xScale}\n yScale={yScale}\n plotSize={axis === 'y' ? plotWidth : plotHeight}\n highlighted={isHighlighted}\n dimmed={isDimmed}\n chartAreaClipPath={chartAreaClipPath}\n stackedBarValues={stackedBarValues}\n highlightedGroupIndex={highlightedGroupIndex}\n isRtl={isRtl}\n />\n );\n }\n })}\n </g>\n </>\n );\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ScaleType } from './interfaces';
|
|
2
|
+
import { InternalChartSeries } from './internal-interfaces';
|
|
2
3
|
export declare function computeDomainX<T>(series: readonly InternalChartSeries<T>[], xScaleType: ScaleType): T[];
|
|
3
4
|
export declare function computeDomainY<T>(series: readonly InternalChartSeries<T>[], scaleType: 'linear' | 'log', stackedBars: boolean): number[];
|
|
4
5
|
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/domain.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/domain.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,OA4CjG;AAED,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,EACzC,SAAS,EAAE,QAAQ,GAAG,KAAK,EAC3B,WAAW,EAAE,OAAO,YAuErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/domain.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/domain.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE7E,MAAM,UAAU,cAAc,CAAI,MAAyC,EAAE,UAAqB;IAChG,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YAC9B,IAAI,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE;oBAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;wBAC1B,GAAG,CAAC,IAAI,CAAC,CAAC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EAAE,CAAC;QAC5D,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MixedLineBarChartProps, ScaleType } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\nimport { isDataSeries, isXThreshold, isYThreshold, matchesX } from './utils';\n\nexport function computeDomainX<T>(series: readonly InternalChartSeries<T>[], xScaleType: ScaleType) {\n if (xScaleType === 'categorical') {\n return series.reduce((acc, s) => {\n if (isDataSeries(s.series)) {\n s.series.data.forEach(({ x }) => {\n if (acc.indexOf(x) === -1) {\n acc.push(x);\n }\n });\n }\n if (isXThreshold(s.series)) {\n if (acc.indexOf(s.series.x) === -1) {\n acc.push(s.series.x);\n }\n }\n return acc;\n }, [] as T[]);\n }\n\n return series.reduce((acc, curr) => {\n // Y-thresholds don't have X value.\n if (isYThreshold(curr.series)) {\n return acc;\n }\n\n // Compare x-threshold X with current min, max.\n if (isXThreshold(curr.series)) {\n const [min, max] = acc;\n const newMin = min === undefined || min === null || curr.series.x < min ? curr.series.x : min;\n const newMax = max === undefined || max === null || max < curr.series.x ? curr.series.x : max;\n return [newMin, newMax] as T[];\n }\n\n // Compare all series X values with current min, max.\n if (isDataSeries(curr.series)) {\n return curr.series.data.reduce(([min, max], { x }) => {\n const newMin = min === undefined || min === null || x < min ? x : min;\n const newMax = max === undefined || max === null || max < x ? x : max;\n return [newMin, newMax] as T[];\n }, acc);\n }\n\n return acc;\n }, [] as T[]);\n}\n\nexport function computeDomainY<T>(\n series: readonly InternalChartSeries<T>[],\n scaleType: 'linear' | 'log',\n stackedBars: boolean\n) {\n let _series = series;\n\n // For stacked bars, we need to accumulate all the bar series into a positive and a negative series\n if (stackedBars) {\n const { positiveData, negativeData } = series.reduce(\n (acc, curr) => {\n if (curr.series.type === 'bar') {\n curr.series.data.forEach(({ x, y }) => {\n const data = y < 0 ? acc.negativeData : acc.positiveData;\n const stackedDatum = data.find(el => matchesX(el.x, x));\n if (stackedDatum) {\n stackedDatum.y += y;\n } else {\n data.push({ x, y });\n }\n return acc;\n });\n }\n return acc;\n },\n { positiveData: [] as MixedLineBarChartProps.Datum<T>[], negativeData: [] as MixedLineBarChartProps.Datum<T>[] }\n );\n\n // Artificial series with the sum of all bars when stacked\n const stackedSeries: InternalChartSeries<T>[] = [\n { color: '', index: NaN, series: { type: 'bar', title: 'positive', data: positiveData as any } },\n { color: '', index: NaN, series: { type: 'bar', title: 'negative', data: negativeData as any } },\n ];\n\n // MixedLineBarChart can also contain other non-bar series,\n // so we replace all bars with the artificial bar series\n // Then proceed to compute range with it and the remaining (non-bar) series\n _series = [...stackedSeries, ..._series.filter(s => s.series.type !== 'bar')];\n }\n\n const domain = _series.reduce(\n (acc, curr) => {\n // Compare threshold Y value with current min, max.\n if (isYThreshold(curr.series)) {\n const [min, max] = acc;\n const newMin = min === undefined || curr.series.y < min ? curr.series.y : min;\n const newMax = max === undefined || max < curr.series.y ? curr.series.y : max;\n return [newMin, newMax];\n }\n\n // X-thresholds don't have Y value.\n if (isXThreshold(curr.series)) {\n return acc;\n }\n\n // Compare all series Y values with current min, max.\n if (isDataSeries(curr.series)) {\n return curr.series.data.reduce(([min, max], { y }) => {\n const newMin = min === undefined || y < min ? y : min;\n const newMax = max === undefined || max < y ? y : max;\n return [newMin, newMax];\n }, acc);\n }\n\n return acc;\n },\n [0, 0]\n );\n\n // Log scales can't start from 0, so if possible, start from 1.\n if (scaleType === 'log' && domain[0] === 0 && domain[1] > 1) {\n return [1, domain[1]];\n }\n return domain;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartSeriesDetailItem } from '../internal/components/chart-series-details';
|
|
2
2
|
import { CartesianChartProps } from '../types/cartesian-chart';
|
|
3
|
-
import { ChartDataTypes,
|
|
3
|
+
import { ChartDataTypes, MixedLineBarChartProps } from './interfaces';
|
|
4
|
+
import { InternalChartSeries } from './internal-interfaces';
|
|
4
5
|
export interface HighlightDetails {
|
|
5
6
|
position: string;
|
|
6
7
|
details: ChartSeriesDetailItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-highlighted.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/format-highlighted.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"format-highlighted.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/format-highlighted.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAED,uEAAuE;AACvE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,EAClE,QAAQ,EACR,MAAM,EACN,cAAc,EACd,0BAA0B,GAC3B,EAAE;IACD,QAAQ,EAAE,CAAC,CAAC;IACZ,MAAM,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,cAAc,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACtD,0BAA0B,CAAC,EAAE,sBAAsB,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;CACnF,GAAG,gBAAgB,CAYnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-highlighted.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/format-highlighted.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"format-highlighted.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/format-highlighted.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAMzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7E,uEAAuE;AACvE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAA2B,EAClE,QAAQ,EACR,MAAM,EACN,cAAc,EACd,0BAA0B,GAM3B;IACC,MAAM,iBAAiB,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAE1F,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACjB,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,CAAC,CAAC;QACrG,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAI,EAC1B,cAAc,EACd,OAAO,EACP,0BAA0B,GAK3B;;IACC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,C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ACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ChartSeriesDetailItem } from '../internal/components/chart-series-details';\nimport { CartesianChartProps } from '../types/cartesian-chart';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\nimport { isDataSeries, isXThreshold, isYThreshold, matchesX } from './utils';\n\nexport interface HighlightDetails {\n position: string;\n details: ChartSeriesDetailItem[];\n}\n\n/** Formats provided x-position and its corresponding series values. */\nexport default function formatHighlighted<T extends ChartDataTypes>({\n position,\n series,\n xTickFormatter,\n detailPopoverSeriesContent,\n}: {\n position: T;\n series: readonly InternalChartSeries<T>[];\n xTickFormatter?: CartesianChartProps.TickFormatter<T>;\n detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent<T>;\n}): HighlightDetails {\n const formattedPosition = xTickFormatter ? xTickFormatter(position) : position.toString();\n\n const details: ChartSeriesDetailItem[] = [];\n series.forEach(s => {\n const detail = getSeriesDetail({ internalSeries: s, targetX: position, detailPopoverSeriesContent });\n if (detail) {\n details.push(detail);\n }\n });\n\n return { position: formattedPosition, details };\n}\n\nfunction getSeriesDetail<T>({\n internalSeries,\n targetX,\n detailPopoverSeriesContent,\n}: {\n internalSeries: InternalChartSeries<T>;\n targetX: T;\n detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent<T>;\n}): ChartSeriesDetailItem | null {\n const { series, color } = internalSeries;\n\n // X-thresholds are only shown when X matches.\n if (isXThreshold(series)) {\n return series.x === targetX\n ? {\n key: series.title,\n value: '',\n color,\n markerType: 'dashed',\n }\n : null;\n }\n\n if (isYThreshold(series)) {\n return {\n key: series.title,\n value: series.valueFormatter ? series.valueFormatter(series.y) : series.y,\n color,\n markerType: 'dashed',\n };\n }\n\n if (isDataSeries(series)) {\n for (const datum of series.data) {\n if (matchesX(targetX, datum.x)) {\n const customContent = detailPopoverSeriesContent\n ? detailPopoverSeriesContent({ series, x: targetX, y: datum.y })\n : undefined;\n const hasSubItems = !!customContent?.subItems?.length;\n const isExpandable = customContent?.expandable && hasSubItems;\n const isKeyString = typeof customContent?.key === 'string';\n const key = customContent?.key && (!isExpandable || isKeyString) ? customContent.key : series.title;\n\n if (customContent?.expandable && !hasSubItems) {\n warnOnce(\n 'MixedLineBarChart',\n '`expandable` was set to `true` for a series without sub-items. This property will be ignored.'\n );\n }\n if (isExpandable && !isKeyString) {\n warnOnce(\n 'MixedLineBarChart',\n 'A ReactNode was used for the key of an expandable series. The series title will be used instead because nested interactive elements can cause accessiblity issues.'\n );\n }\n if (!isKeyString && !isExpandable && customContent?.value && typeof customContent.value !== 'string') {\n warnOnce(\n 'MixedLineBarChart',\n 'Use a ReactNode for the key or the value of a series, but not for both. It is not recommended to use links for key and value at the same time.'\n );\n }\n\n return {\n key,\n value: customContent?.value || (series.valueFormatter ? series.valueFormatter(datum.y, targetX) : datum.y),\n color,\n markerType: series.type === 'line' ? 'line' : 'rectangle',\n subItems: customContent?.subItems,\n expandableId: isExpandable ? series.title : undefined,\n };\n }\n }\n }\n\n return null;\n}\n"]}
|
|
@@ -2,11 +2,6 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { CartesianChartProps } from '../types/cartesian-chart';
|
|
3
3
|
export type ChartDataTypes = number | string | Date;
|
|
4
4
|
export type ScaleType = 'linear' | 'log' | 'time' | 'categorical';
|
|
5
|
-
export interface InternalChartSeries<T> {
|
|
6
|
-
index: number;
|
|
7
|
-
color: string;
|
|
8
|
-
series: MixedLineBarChartProps.ChartSeries<T>;
|
|
9
|
-
}
|
|
10
5
|
export interface CommonMixedChartProps<T extends ChartDataTypes> extends CartesianChartProps<T, MixedLineBarChartProps.ChartSeries<T>> {
|
|
11
6
|
/**
|
|
12
7
|
* When set to `true`, adds a visual emphasis on the zero baseline axis.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,aAAa,CAAC;AAGlE,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,cAAc,CAC7D,SAAQ,mBAAmB,CAAC,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACrE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,0BAA0B,CAAC,EAAE,sBAAsB,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IAChG;;;;;;;;;;OAUG;IACH,MAAM,EAAE,aAAa,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7D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AC,CAAC;QACvB,CAAC,EAAE,CAAC,CAAC;QACL,CAAC,EAAE,MAAM,CAAC;KACX;IAED,MAAM,WAAW,+BAA+B;QAC9C,GAAG,EAAE,SAAS,CAAC;QACf,KAAK,EAAE,SAAS,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;YAAE,GAAG,EAAE,SAAS,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,CAAC,CAAC;KAChE;IAED,MAAM,WAAW,0BAA0B,CAAC,CAAC;QAC3C,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC;KACrE;;CACF;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from 'react';\n\nimport { CartesianChartProps } from '../types/cartesian-chart';\n\nexport type ChartDataTypes = number | string | Date;\n\nexport type ScaleType = 'linear' | 'log' | 'time' | 'categorical';\n\
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from 'react';\n\nimport { CartesianChartProps } from '../types/cartesian-chart';\n\nexport type ChartDataTypes = number | string | Date;\n\nexport type ScaleType = 'linear' | 'log' | 'time' | 'categorical';\n\n// Properties that are shared as is (including API doc comments) by mixed, line and bar charts.\nexport interface CommonMixedChartProps<T extends ChartDataTypes>\n extends CartesianChartProps<T, MixedLineBarChartProps.ChartSeries<T>> {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n * See the usage guidelines for more details.\n */\n emphasizeBaselineAxis?: boolean;\n\n /**\n * A function that determines the details that are displayed in the popover for each series.\n * Use this for wrapping keys or values in external links, or to display a metric breakdown by adding an additional level of nested items.\n *\n * The function is called with the parameters `{ series, x, y }` representing the series, the highlighted x coordinate value and its corresponding y value respectively,\n * and should return the following properties:\n * * `key` (ReactNode) - Name of the series.\n * * `value` (ReactNode) - Value of the series at the highlighted x coordinate.\n * * `subItems` (ReadonlyArray<{ key: ReactNode; value: ReactNode }>) - (Optional) List of nested key-value pairs.\n * * `expandable` (boolean) - (Optional) Determines whether the optional list of nested items provided via `subItems` is expandable. This is `false` by default.\n */\n detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent<T>;\n}\n\nexport interface MixedLineBarChartProps<T extends ChartDataTypes> extends CommonMixedChartProps<T> {\n /**\n * Array that represents the source of data for the displayed chart.\n * Each element can represent a line series, bar series, or a threshold, and can have the following properties:\n *\n * * `title` (string): A human-readable title for this series.\n * * `type` (string): Series type (`\"line\"`, `\"bar\"`, or `\"threshold\"`).\n * * `data` (Array): For line and bar series, an array of data points, represented as objects with `x` and `y` properties.\n * * `y` (number): For threshold series, the value of the threshold.\n * * `color` (string): (Optional) A color hex value for this series. When assigned, it takes priority over the automatically assigned color.\n * * `valueFormatter` (Function): (Optional) A function that formats data values before rendering in the UI, For example, in the details popover.\n */\n series: ReadonlyArray<MixedLineBarChartProps.ChartSeries<T>>;\n\n /**\n * When set to `true`, bars in the same data point are stacked instead of grouped next to each other.\n */\n stackedBars?: boolean;\n\n /**\n * When set to `true`, the x and y axes are flipped, which causes any bars to be rendered horizontally instead of vertically.\n * This can only be used when the chart consists exclusively of bar series.\n */\n horizontalBars?: boolean;\n\n /**\n * Determines the type of scale for values on the x axis.\n * Use `categorical` for charts with bars.\n */\n xScaleType?: ScaleType;\n}\n\nexport namespace MixedLineBarChartProps {\n export interface Datum<T> {\n x: T;\n y: number;\n }\n\n interface IDataSeries<T> {\n type: 'line' | 'bar' | 'threshold';\n title: string;\n color?: string;\n\n // This makes sure that the element type of the array is reduced to just one type,\n // even if `T` is a union type, e.g. `number | string`.\n data: T extends unknown ? ReadonlyArray<Datum<T>> : ReadonlyArray<Datum<T>>;\n valueFormatter?: T extends unknown\n ? CartesianChartProps.ValueFormatter<number, T>\n : CartesianChartProps.ValueFormatter<number, T>;\n }\n\n export interface BarDataSeries<T> extends IDataSeries<T> {\n type: 'bar';\n }\n\n export interface LineDataSeries<T> extends IDataSeries<T> {\n type: 'line';\n }\n\n export interface ThresholdSeries<T = any> extends Omit<IDataSeries<never>, 'data' | 'valueFormatter'> {\n type: 'threshold';\n y?: number;\n x?: T;\n valueFormatter?: CartesianChartProps.TickFormatter<number>;\n }\n\n export interface YThresholdSeries extends Omit<ThresholdSeries<never>, 'x'> {\n type: 'threshold';\n y: number;\n valueFormatter?: CartesianChartProps.TickFormatter<number>;\n }\n\n export interface XThresholdSeries<T> extends Omit<ThresholdSeries<T>, 'y' | 'valueFormatter'> {\n type: 'threshold';\n x: T;\n }\n\n export type DataSeries<T> = LineDataSeries<T> | BarDataSeries<T>;\n\n export type ChartSeries<T> = DataSeries<T> | ThresholdSeries<T>;\n\n export type FilterChangeDetail<T> = CartesianChartProps.FilterChangeDetail<ChartSeries<T>>;\n\n export type HighlightChangeDetail<T> = CartesianChartProps.HighlightChangeDetail<ChartSeries<T>>;\n\n export type TickFormatter<T> = CartesianChartProps.TickFormatter<T>;\n\n export type ValueFormatter<YType, XType = null> = CartesianChartProps.ValueFormatter<YType, XType>;\n\n export type I18nStrings<T> = CartesianChartProps.I18nStrings<T>;\n\n export interface DetailPopoverSeriesData<T> {\n series: ChartSeries<T>;\n x: T;\n y: number;\n }\n\n export interface DetailPopoverSeriesKeyValuePair {\n key: ReactNode;\n value: ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: ReactNode; value: ReactNode }>;\n }\n\n export interface DetailPopoverSeriesContent<T> {\n (data: DetailPopoverSeriesData<T>): DetailPopoverSeriesKeyValuePair;\n }\n}\n\nexport interface VerticalMarkerX<T> {\n scaledX: number;\n label: T | null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-interfaces.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/internal-interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-interfaces.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/internal-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MixedLineBarChartProps } from './interfaces';\n\nexport interface InternalChartSeries<T> {\n index: number;\n color: string;\n series: MixedLineBarChartProps.ChartSeries<T>;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChartScale } from '../internal/components/cartesian-chart/scales';
|
|
2
|
-
import { ChartDataTypes
|
|
2
|
+
import { ChartDataTypes } from './interfaces';
|
|
3
|
+
import { InternalChartSeries } from './internal-interfaces';
|
|
3
4
|
export interface ScaledBarGroup<T> {
|
|
4
5
|
x: T;
|
|
5
6
|
hasData: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-bar-groups.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"make-scaled-bar-groups.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAA0B,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,CAAC,EAAE,CAAC,CAAC;IACL,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAClE,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAC7C,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,GAAG,GAAG,GACd,cAAc,CAAC,CAAC,CAAC,EAAE,CA0CrB"}
|
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"make-scaled-bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,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AAE;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 { ChartScale } from '../internal/components/cartesian-chart/scales';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\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"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';
|
|
2
|
-
import { ChartDataTypes,
|
|
2
|
+
import { ChartDataTypes, MixedLineBarChartProps } from './interfaces';
|
|
3
|
+
import { InternalChartSeries } from './internal-interfaces';
|
|
3
4
|
export interface ScaledPoint<T> {
|
|
4
5
|
x: number;
|
|
5
6
|
y: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"make-scaled-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACpD,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC/C;AAED,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAC/D,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAChD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,iBAAiB,GACxB,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,CA6E3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"make-scaled-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUrD,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAgD,EAChD,MAAkB,EAClB,MAAyB;IAEzB,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;IAC7F,MAAM,MAAM,GAAG,CAAC,CAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC;IACnE,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,SAAS,oCAAoC,CAC3C,YAA8B,EAC9B,gBAAsE,EACtE,qBAA6B;;QAE7B,MAAM,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAErC,yEAAyE;QACzE,IAAI,WAAW,GAAG,CAAC,CA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AACjC,CAAC;AAED,SAAS,OAAO,CAAI,MAAa;IAC/B,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\nimport { isXThreshold, isYThreshold } from './utils';\n\nexport interface ScaledPoint<T> {\n x: number;\n y: number;\n color: string;\n datum?: MixedLineBarChartProps.Datum<T> | undefined;\n series: MixedLineBarChartProps.ChartSeries<T>;\n}\n\n/** Combine all line series into an array of scaled data points with the given scales. */\nexport default function makeScaledSeries<T extends ChartDataTypes>(\n allSeries: ReadonlyArray<InternalChartSeries<T>>,\n xScale: ChartScale,\n yScale: NumericChartScale\n): readonly ScaledPoint<T>[] {\n const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n const scaleX = (x: T) => (xScale.d3Scale(x as any) || 0) + xOffset;\n const scaleY = (y: number) => yScale.d3Scale(y) || 0;\n const allX = getAllX(allSeries);\n\n function mergeLineSeriesPointsWithXThresholds(\n scaledPoints: ScaledPoint<T>[],\n xThresholdSeries: MixedLineBarChartProps.ThresholdSeries<T> & { x: T },\n xThresholdSeriesColor: string\n ) {\n const x = scaleX(xThresholdSeries.x);\n\n // Locate a point the x-threshold can be inserted after (if such exists).\n let bisectIndex = -1;\n for (let i = 0; i < scaledPoints.length - 1; i++) {\n if (scaledPoints[i].x < x && x < scaledPoints[i + 1].x) {\n bisectIndex = i;\n break;\n }\n }\n\n // Insert x-threshold point into the given series using extrapolated Y value.\n // The extrapolated value is only used to render highlighted point on the chart plot.\n if (bisectIndex !== -1) {\n const prevY = scaledPoints[bisectIndex].datum?.y || 0;\n const nextY = scaledPoints[bisectIndex + 1].datum?.y || 0;\n const averageY = (prevY + nextY) / 2;\n scaledPoints.push({\n x: x,\n y: scaleY(averageY),\n datum: { x: xThresholdSeries.x, y: NaN },\n series: scaledPoints[bisectIndex].series,\n color: xThresholdSeriesColor,\n });\n }\n }\n\n const scaledSeriesX = allSeries.map(({ series, color }) => {\n const scaledPoints: ScaledPoint<T>[] = [];\n\n // Scale and add all line series data points.\n if (series.type === 'line') {\n for (const datum of series.data as MixedLineBarChartProps.Datum<T>[]) {\n scaledPoints.push({ x: scaleX(datum.x), y: scaleY(datum.y), datum, series, color });\n }\n\n // Sort scaled points to ensure correct x-thresholds insertion.\n scaledPoints.sort((s1, s2) => s1.x - s2.x);\n\n // Merge x-thresholds into series if they don't have a shared coordinate.\n for (const otherSeries of allSeries) {\n if (isXThreshold(otherSeries.series)) {\n mergeLineSeriesPointsWithXThresholds(scaledPoints, otherSeries.series, otherSeries.color);\n }\n }\n }\n // Y-thresholds only have Y. To make thresholds navigable they are mapped to all defined X values.\n else if (isYThreshold(series)) {\n for (const x of allX) {\n scaledPoints.push({ x: scaleX(x), y: scaleY(series.y), datum: { x, y: series.y }, series, color });\n }\n // Support threshold-only setup.\n if (allX.length === 0) {\n scaledPoints.push({ x: NaN, y: scaleY(series.y), series, color });\n }\n }\n // X-thresholds only have X. The y value is taken as NaN which means there is no associated point - only vertical marker.\n else if (isXThreshold(series)) {\n scaledPoints.push({ x: scaleX(series.x), y: NaN, datum: { x: series.x, y: NaN }, series, color });\n }\n // Bar series are handled separately.\n return scaledPoints;\n });\n\n // Sort scaled points by x to ensure their order matches visual order in the chart to support navigation.\n return flatten(scaledSeriesX).sort((s1, s2) => s1.x - s2.x);\n}\n\n/** Collect unique x values from all data series. */\nfunction getAllX<T>(series: ReadonlyArray<InternalChartSeries<T>>) {\n const addDataXSet = new Set<T>();\n for (const { series: s } of series) {\n switch (s.type) {\n // Add all X values from data series.\n case 'bar':\n case 'line':\n for (const d of s.data) {\n addDataXSet.add(d.x);\n }\n break;\n\n case 'threshold':\n // X-thresholds have a single X value.\n if (isXThreshold(s)) {\n addDataXSet.add(s.x);\n }\n // Thresholds don't have X values.\n break;\n }\n }\n return Array.from(addDataXSet);\n}\n\nfunction flatten<T>(arrays: T[][]): T[] {\n return arrays.flat();\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChartSeriesMarkerType } from '../internal/components/chart-series-marker';
|
|
2
|
-
import { ChartDataTypes,
|
|
2
|
+
import { ChartDataTypes, MixedLineBarChartProps } from './interfaces';
|
|
3
|
+
import { InternalChartSeries } from './internal-interfaces';
|
|
3
4
|
import { ScaledBarGroup } from './make-scaled-bar-groups';
|
|
4
5
|
export declare const chartLegendMap: Record<string, ChartSeriesMarkerType>;
|
|
5
6
|
export declare const nextValidDomainIndex: <T>(nextGroupIndex: number, barGroups: ScaledBarGroup<T>[], direction?: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAIhE,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,gBAAgB,MAAM,EAAE,WAAW,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,kBAAa,WAqB5G,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;;;EAgB1G;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,YAKvC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAIzE,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,KAAK,CAAC,SAAS,sBAAsB,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,GAC3E,gBAAgB,CAmBlB;AAED,4DAA4D;AAC5D,eAAO,MAAM,WAAW,GAAI,KAAK,cAAc,oBAAgD,CAAC;AAEhG,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,GAC5C,MAAM,IAAI,sBAAsB,CAAC,gBAAgB,CAGnD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,GAC5C,MAAM,IAAI,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAGtD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,GAC5C,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAC,CAEhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,cAAc,G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AAI,KAAK,KAAK,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartSeriesMarkerType } from '../internal/components/chart-series-marker';\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport { InternalChartSeries } from './internal-interfaces';\nimport { ScaledBarGroup } from './make-scaled-bar-groups';\n\nexport const chartLegendMap: Record<string, ChartSeriesMarkerType> = {\n line: 'line',\n bar: 'rectangle',\n threshold: 'dashed',\n};\n\n// Starting from the given index, find the first x value in the x domain that has bar data attached to it.\nexport const nextValidDomainIndex = <T>(nextGroupIndex: number, barGroups: ScaledBarGroup<T>[], direction = 1) => {\n let index = nextGroupIndex;\n\n if (index < 0 || index >= barGroups.length) {\n index = 0;\n }\n\n do {\n if (barGroups[index].isValid && barGroups[index].hasData) {\n return index;\n }\n index += direction;\n\n // Loop back to the beginning if necessary\n if (index >= barGroups.length) {\n index = 0;\n } else if (index < 0) {\n index = barGroups.length - 1;\n }\n } while (index !== nextGroupIndex);\n return 0;\n};\n\n/**\n * Find the subset of series that are individually navigable with keyboard.\n * Lines and thresholds are navigated individually, while bar series are grouped as one.\n */\nexport function findNavigableSeries<T extends ChartDataTypes>(series: ReadonlyArray<InternalChartSeries<T>>) {\n const navigableSeries: Array<MixedLineBarChartProps.ChartSeries<T>> = [];\n let navigableBarSeriesIndex = -1;\n\n series.forEach(internalSeries => {\n if (internalSeries.series.type === 'bar') {\n // Only include the first bar series because all bar series are handled as one\n if (navigableBarSeriesIndex === -1) {\n navigableBarSeriesIndex = navigableSeries.length;\n navigableSeries.push(internalSeries.series);\n }\n } else {\n navigableSeries.push(internalSeries.series);\n }\n });\n return { navigableSeries, navigableBarSeriesIndex };\n}\n\n/**\n * Checks if two x values are equal.\n * With a special treat for Date values which need to be converted to numbers first.\n */\nexport const matchesX = <T>(x1: T, x2: T) => {\n if (x1 instanceof Date && x2 instanceof Date) {\n return x1.getTime() === x2.getTime();\n }\n return x1 === x2;\n};\n\nexport type StackedBarValues = Map<string | number, Map<number, number>>;\n\n// Unlike for regular bars, stacked bar series values depend on the predecessors.\n// The function computes all stacked values grouped by X and series index.\nexport function calculateStackedBarValues(\n dataBySeries: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]>\n): StackedBarValues {\n const negativeValues = new Map<string | number, number>();\n const positiveValues = new Map<string | number, number>();\n const values = new Map<string | number, Map<number, number>>();\n for (let seriesIndex = 0; seriesIndex < dataBySeries.length; seriesIndex++) {\n for (const datum of dataBySeries[seriesIndex]) {\n const key = getKeyValue(datum.x);\n if (datum.y < 0) {\n negativeValues.set(key, (negativeValues.get(key) ?? 0) + datum.y);\n } else {\n positiveValues.set(key, (positiveValues.get(key) ?? 0) + datum.y);\n }\n const seriesValue = (datum.y < 0 ? negativeValues.get(key) : positiveValues.get(key)) ?? 0;\n const valuesByIndex = values.get(key) ?? new Map<number, number>();\n valuesByIndex.set(seriesIndex, seriesValue);\n values.set(key, valuesByIndex);\n }\n }\n return values;\n}\n\n/** Returns string or number value for ChartDataTypes key */\nexport const getKeyValue = (key: ChartDataTypes) => (key instanceof Date ? key.getTime() : key);\n\nexport function isYThreshold<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.YThresholdSeries {\n const key: keyof MixedLineBarChartProps.YThresholdSeries = 'y';\n return series.type === 'threshold' && key in series;\n}\n\nexport function isXThreshold<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.XThresholdSeries<T> {\n const key: keyof MixedLineBarChartProps.XThresholdSeries<T> = 'x';\n return series.type === 'threshold' && key in series;\n}\n\nexport function isDataSeries<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.DataSeries<T> {\n return series.type === 'line' || series.type === 'bar';\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
2
1
|
import { BaseComponentProps } from '../types/base-component';
|
|
3
2
|
export interface NavigableGroupProps extends BaseComponentProps {
|
|
4
3
|
/**
|
|
@@ -25,8 +24,6 @@ export interface NavigableGroupProps extends BaseComponentProps {
|
|
|
25
24
|
*/
|
|
26
25
|
navigationDirection?: 'horizontal' | 'vertical' | 'both';
|
|
27
26
|
}
|
|
28
|
-
export interface InternalNavigableGroupProps extends NavigableGroupProps, InternalBaseComponentProps {
|
|
29
|
-
}
|
|
30
27
|
export declare namespace NavigableGroupProps {
|
|
31
28
|
interface Ref {
|
|
32
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;;;;;;;;OASG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,CAAC;IAC7C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;CAC1D;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/navigable-group/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../types/base-component';\n\nexport interface NavigableGroupProps extends BaseComponentProps {\n /**\n * The children that will be rendered inside the navigation group.\n *\n * The following Cloudscape components are supported, but do not\n * need to be direct children of the group:\n * - Button\n * - Button dropdown\n * - Toggle button\n * - Link\n */\n children: React.ReactNode;\n /**\n * A method that should return a unique identifier for a given element.\n * The element passed will be the first focusable descendent of a child component.\n */\n getItemKey: (element: HTMLElement) => string;\n /**\n * Determines which arrow keys move focus sequentially within the group:\n * - `horizontal` - left and right arrow keys\n * - `vertical` - up and down arrow keys\n * - `both` - all arrow keys\n */\n navigationDirection?: 'horizontal' | 'vertical' | 'both';\n}\n\nexport namespace NavigableGroupProps {\n export interface Ref {\n /**\n * Focuses the first focusable element (or previously focused element) in the navigation group.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
2
|
+
import { NavigableGroupProps } from './interfaces';
|
|
3
|
+
export interface InternalNavigableGroupProps extends NavigableGroupProps, InternalBaseComponentProps {
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=internal-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-interfaces.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/internal-interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB,EAAE,0BAA0B;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-interfaces.js","sourceRoot":"","sources":["../../../src/navigable-group/internal-interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { NavigableGroupProps } from './interfaces';\n\nexport interface InternalNavigableGroupProps extends NavigableGroupProps, InternalBaseComponentProps {}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigableGroupProps } from './interfaces';
|
|
3
|
+
import { InternalNavigableGroupProps } from './internal-interfaces';
|
|
3
4
|
declare const InternalNavigableGroup: React.ForwardRefExoticComponent<InternalNavigableGroupProps & React.RefAttributes<NavigableGroupProps.Ref>>;
|
|
4
5
|
export default InternalNavigableGroup;
|
|
5
6
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAelF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAelF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAKpE,QAAA,MAAM,sBAAsB,6GAgJ3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,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U,IAAI,OAAO,EAAE,CAAC;gBAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC;YAC1B,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;IAED,OAAO,CACL,gCACM,SAAS,EACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACtE,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS;QAEpB,oBAAC,+BAA+B,IAC9B,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,IAAI,EACtB,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,IAErC,QAAQ,CACuB,CAC9B,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport {\n SingleTabStopNavigationAPI,\n SingleTabStopNavigationProvider,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { getAllFocusables } from '../internal/components/focus-lock/utils';\nimport { hasModifierKeys } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { circleIndex } from '../internal/utils/circle-index';\nimport handleKey from '../internal/utils/handle-key';\nimport { InternalNavigableGroupProps, NavigableGroupProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nconst InternalNavigableGroup = forwardRef(\n (\n {\n children,\n getItemKey,\n navigationDirection = 'horizontal',\n __internalRootRef,\n ...props\n }: InternalNavigableGroupProps,\n ref: React.Ref<NavigableGroupProps.Ref>\n ) => {\n const baseProps = getBaseProps(props);\n const navigationAPI = useRef<SingleTabStopNavigationAPI>(null);\n const containerObjectRef = useRef<HTMLDivElement>(null);\n const containerRef = useMergeRefs(containerObjectRef, __internalRootRef);\n const focusedIdRef = useRef<string>();\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n const target = getNextFocusTarget();\n if (target) {\n target.focus();\n }\n },\n }));\n\n function getNextFocusTarget(): null | HTMLElement {\n if (containerObjectRef.current) {\n const focusables = getFocusablesFrom(containerObjectRef.current);\n return focusables.find(el => getItemKey(el) === focusedIdRef.current) ?? focusables[0] ?? null;\n }\n return null;\n }\n\n function onUnregisterActive(focusableElement: HTMLElement) {\n // Only refocus when the node is actually removed (no such element anymore).\n const target = navigationAPI.current?.getFocusTarget();\n\n if (target && getItemKey(target) !== getItemKey(focusableElement)) {\n target.focus();\n }\n }\n\n useEffect(() => {\n navigationAPI.current?.updateFocusTarget();\n });\n\n function onFocus(event: React.FocusEvent) {\n if (event.target instanceof HTMLElement && navigationAPI.current?.isRegistered(event.target)) {\n focusedIdRef.current = getItemKey(event.target);\n }\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onBlur() {\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onKeyDown(event: React.KeyboardEvent) {\n const focusTarget = navigationAPI.current?.getFocusTarget();\n let specialKeys = [];\n switch (navigationDirection) {\n case 'horizontal':\n specialKeys = [KeyCode.right, KeyCode.left];\n break;\n case 'vertical':\n specialKeys = [KeyCode.down, KeyCode.up];\n break;\n case 'both':\n specialKeys = [KeyCode.right, KeyCode.left, KeyCode.down, KeyCode.up];\n break;\n }\n specialKeys.push(KeyCode.end, KeyCode.home, KeyCode.pageUp, KeyCode.pageDown);\n if (hasModifierKeys(event) || specialKeys.indexOf(event.keyCode) === -1) {\n return;\n }\n if (!containerObjectRef.current || !focusTarget) {\n return;\n }\n // Ignore navigation when the focused element is not a registered focusable.\n if (document.activeElement && !navigationAPI.current?.isRegistered(document.activeElement)) {\n return;\n }\n event.preventDefault();\n\n const focusables = getFocusablesFrom(containerObjectRef.current);\n const activeIndex = focusables.indexOf(focusTarget);\n const getNextIndex = (delta: number) => {\n const newIndex = activeIndex + delta;\n return circleIndex(newIndex, [0, focusables.length - 1]);\n };\n\n handleKey(event as any, {\n onHome: () => focusElement(focusables[0]),\n onEnd: () => focusElement(focusables[focusables.length - 1]),\n onInlineStart: () => focusElement(focusables[getNextIndex(-1)]),\n onBlockStart: () => focusElement(focusables[getNextIndex(-1)]),\n onInlineEnd: () => focusElement(focusables[getNextIndex(1)]),\n onBlockEnd: () => focusElement(focusables[getNextIndex(1)]),\n });\n }\n\n function focusElement(element: HTMLElement) {\n element.focus();\n }\n\n // List all non-disabled and registered focusables: those are eligible for keyboard navigation.\n function getFocusablesFrom(target: HTMLElement) {\n function isElementRegistered(element: HTMLElement) {\n return navigationAPI.current?.isRegistered(element) ?? false;\n }\n\n function isElementDisabled(element: HTMLElement) {\n // eslint-disable-next-line no-restricted-syntax -- DOM element capability check\n if ('disabled' in element) {\n return element.disabled;\n }\n\n return false;\n }\n\n return getAllFocusables(target).filter(el => isElementRegistered(el) && !isElementDisabled(el));\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, testUtilStyles.root, baseProps.className)}\n ref={containerRef}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n >\n <SingleTabStopNavigationProvider\n ref={navigationAPI}\n navigationActive={true}\n getNextFocusTarget={getNextFocusTarget}\n onUnregisterActive={onUnregisterActive}\n >\n {children}\n </SingleTabStopNavigationProvider>\n </div>\n );\n }\n);\n\nexport default InternalNavigableGroup;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/navigable-group/internal.tsx"],"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B,CAAC,OAAoB;YAC7C,gFAAgF;YAChF,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;gBAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC;YAC1B,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;IAED,OAAO,CACL,gCACM,SAAS,EACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EACtE,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS;QAEpB,oBAAC,+BAA+B,IAC9B,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,IAAI,EACtB,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,IAErC,QAAQ,CACuB,CAC9B,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\nimport {\n SingleTabStopNavigationAPI,\n SingleTabStopNavigationProvider,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { getAllFocusables } from '../internal/components/focus-lock/utils';\nimport { hasModifierKeys } from '../internal/events';\nimport { KeyCode } from '../internal/keycode';\nimport { circleIndex } from '../internal/utils/circle-index';\nimport handleKey from '../internal/utils/handle-key';\nimport { NavigableGroupProps } from './interfaces';\nimport { InternalNavigableGroupProps } from './internal-interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nconst InternalNavigableGroup = forwardRef(\n (\n {\n children,\n getItemKey,\n navigationDirection = 'horizontal',\n __internalRootRef,\n ...props\n }: InternalNavigableGroupProps,\n ref: React.Ref<NavigableGroupProps.Ref>\n ) => {\n const baseProps = getBaseProps(props);\n const navigationAPI = useRef<SingleTabStopNavigationAPI>(null);\n const containerObjectRef = useRef<HTMLDivElement>(null);\n const containerRef = useMergeRefs(containerObjectRef, __internalRootRef);\n const focusedIdRef = useRef<string>();\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n const target = getNextFocusTarget();\n if (target) {\n target.focus();\n }\n },\n }));\n\n function getNextFocusTarget(): null | HTMLElement {\n if (containerObjectRef.current) {\n const focusables = getFocusablesFrom(containerObjectRef.current);\n return focusables.find(el => getItemKey(el) === focusedIdRef.current) ?? focusables[0] ?? null;\n }\n return null;\n }\n\n function onUnregisterActive(focusableElement: HTMLElement) {\n // Only refocus when the node is actually removed (no such element anymore).\n const target = navigationAPI.current?.getFocusTarget();\n\n if (target && getItemKey(target) !== getItemKey(focusableElement)) {\n target.focus();\n }\n }\n\n useEffect(() => {\n navigationAPI.current?.updateFocusTarget();\n });\n\n function onFocus(event: React.FocusEvent) {\n if (event.target instanceof HTMLElement && navigationAPI.current?.isRegistered(event.target)) {\n focusedIdRef.current = getItemKey(event.target);\n }\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onBlur() {\n navigationAPI.current?.updateFocusTarget();\n }\n\n function onKeyDown(event: React.KeyboardEvent) {\n const focusTarget = navigationAPI.current?.getFocusTarget();\n let specialKeys = [];\n switch (navigationDirection) {\n case 'horizontal':\n specialKeys = [KeyCode.right, KeyCode.left];\n break;\n case 'vertical':\n specialKeys = [KeyCode.down, KeyCode.up];\n break;\n case 'both':\n specialKeys = [KeyCode.right, KeyCode.left, KeyCode.down, KeyCode.up];\n break;\n }\n specialKeys.push(KeyCode.end, KeyCode.home, KeyCode.pageUp, KeyCode.pageDown);\n if (hasModifierKeys(event) || specialKeys.indexOf(event.keyCode) === -1) {\n return;\n }\n if (!containerObjectRef.current || !focusTarget) {\n return;\n }\n // Ignore navigation when the focused element is not a registered focusable.\n if (document.activeElement && !navigationAPI.current?.isRegistered(document.activeElement)) {\n return;\n }\n event.preventDefault();\n\n const focusables = getFocusablesFrom(containerObjectRef.current);\n const activeIndex = focusables.indexOf(focusTarget);\n const getNextIndex = (delta: number) => {\n const newIndex = activeIndex + delta;\n return circleIndex(newIndex, [0, focusables.length - 1]);\n };\n\n handleKey(event as any, {\n onHome: () => focusElement(focusables[0]),\n onEnd: () => focusElement(focusables[focusables.length - 1]),\n onInlineStart: () => focusElement(focusables[getNextIndex(-1)]),\n onBlockStart: () => focusElement(focusables[getNextIndex(-1)]),\n onInlineEnd: () => focusElement(focusables[getNextIndex(1)]),\n onBlockEnd: () => focusElement(focusables[getNextIndex(1)]),\n });\n }\n\n function focusElement(element: HTMLElement) {\n element.focus();\n }\n\n // List all non-disabled and registered focusables: those are eligible for keyboard navigation.\n function getFocusablesFrom(target: HTMLElement) {\n function isElementRegistered(element: HTMLElement) {\n return navigationAPI.current?.isRegistered(element) ?? false;\n }\n\n function isElementDisabled(element: HTMLElement) {\n // eslint-disable-next-line no-restricted-syntax -- DOM element capability check\n if ('disabled' in element) {\n return element.disabled;\n }\n\n return false;\n }\n\n return getAllFocusables(target).filter(el => isElementRegistered(el) && !isElementDisabled(el));\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(styles.root, testUtilStyles.root, baseProps.className)}\n ref={containerRef}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n >\n <SingleTabStopNavigationProvider\n ref={navigationAPI}\n navigationActive={true}\n getNextFocusTarget={getNextFocusTarget}\n onUnregisterActive={onUnregisterActive}\n >\n {children}\n </SingleTabStopNavigationProvider>\n </div>\n );\n }\n);\n\nexport default InternalNavigableGroup;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../src/popover/arrow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../src/popover/arrow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,UAAU,UAAU;IAClB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC9B;0EAEqC,UAAU;AAUhD,wBAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../../../src/popover/arrow.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAc,EAAE,EAAE;IAClD,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,kBAAkB,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QAC1G,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI;QACzC,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,CAAC,GAAI,CAC9E,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalPosition } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface ArrowProps {\n position: InternalPosition | null;\n variant?: 'default' | 'info';\n}\n\nconst Arrow = ({ position, variant }: ArrowProps) => {\n const isVisualRefresh = useVisualRefresh();\n return (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`], styles[`arrow-variant-${variant}`])}>\n <div className={styles['arrow-outer']} />\n <div className={clsx(styles['arrow-inner'], isVisualRefresh && styles.refresh)} />\n </div>\n );\n};\n\nexport default React.memo(Arrow);\n"]}
|
|
1
|
+
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../../../src/popover/arrow.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAc,EAAE,EAAE;IAClD,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,kBAAkB,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QAC1G,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI;QACzC,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,CAAC,GAAI,CAC9E,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { InternalPosition } from './internal-interfaces';\n\nimport styles from './styles.css.js';\n\ninterface ArrowProps {\n position: InternalPosition | null;\n variant?: 'default' | 'info';\n}\n\nconst Arrow = ({ position, variant }: ArrowProps) => {\n const isVisualRefresh = useVisualRefresh();\n return (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`], styles[`arrow-variant-${variant}`])}>\n <div className={styles['arrow-outer']} />\n <div className={clsx(styles['arrow-inner'], isVisualRefresh && styles.refresh)} />\n </div>\n );\n};\n\nexport default React.memo(Arrow);\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PopoverProps } from './interfaces';
|
|
3
|
+
import { InternalPosition } from './internal-interfaces';
|
|
3
4
|
interface PopoverContainerProps {
|
|
4
5
|
/** References the element the container is positioned against. */
|
|
5
6
|
trackRef?: React.RefObject<HTMLElement | SVGElement>;
|