@cloudscape-design/components 3.0.1100 → 3.0.1101

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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-chart-model.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-chart-model.ts"],"names":[],"mappings":"AAEA,OAAc,EAAc,SAAS,EAA8B,MAAM,OAAO,CAAC;AAKjF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AAShH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAQrC,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,aAAa,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;IACxE,iBAAiB,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnD,oBAAoB,EAAE,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,U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CAAC,CAAC,CAAC,CAAC;IACnD,oBAAoB,EAAE,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,UAAU,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;CAC9C;AAGD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EACxE,KAAK,EACL,SAAS,EACT,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EAAE,cAAc,EACtB,KAAK,EACL,UAAU,EACV,UAAU,GACX,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CA0UvC"}
@@ -72,7 +72,13 @@ export default function useChartModel({ isRtl, fitHeight, externalSeries: allSer
72
72
  const offsetX = clientX - svgRect.left;
73
73
  const offsetY = clientY - svgRect.top;
74
74
  const closestX = findClosest(interactions.plot.xy, offsetX, xPoints => xPoints[0].scaled.x);
75
+ if (closestX === null) {
76
+ return;
77
+ }
75
78
  const closestPoint = findClosest(closestX, offsetY, point => point.scaled.y1);
79
+ if (closestPoint === null) {
80
+ return;
81
+ }
76
82
  // If close enough to the point - highlight the point and its column.
77
83
  // If not - only highlight the closest column.
78
84
  if (Math.abs(offsetX - closestPoint.scaled.x) < MAX_HOVER_MARGIN &&
@@ -1 +1 @@
1
- {"version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BAAsB;QACtB,UAAU;QACV,KAAK;KACN,CAAC,CAAC;IAEH,8CAA8C;IAC9C,WAAW,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IAExF,uEAAuE;IACvE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE;YACpE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/B,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, { MouseEvent, RefObject, useEffect, useMemo, useRef } from 'react';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport { XDomain, XScaleType, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\nimport { useHeightMeasure } from '../../internal/hooks/container-queries/use-height-measure';\nimport { KeyCode } from '../../internal/keycode';\nimport { circleIndex } from '../../internal/utils/circle-index';\nimport handleKey from '../../internal/utils/handle-key';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { throttle } from '../../internal/utils/throttle';\nimport { useReaction } from '../async-store';\nimport { AreaChartProps } from '../interfaces';\nimport computeChartProps from './compute-chart-props';\nimport createSeriesDecorator from './create-series-decorator';\nimport { ChartModel } from './index';\nimport InteractionsStore from './interactions-store';\nimport { findClosest } from './utils';\n\nconst MAX_HOVER_MARGIN = 6;\nconst SVG_HOVER_THROTTLE = 25;\nconst POPOVER_DEADZONE = 12;\n\nexport interface UseChartModelProps<T extends AreaChartProps.DataTypes> {\n isRtl?: boolean;\n fitHeight?: boolean;\n externalSeries: readonly AreaChartProps.Series<T>[];\n visibleSeries: readonly AreaChartProps.Series<T>[];\n setVisibleSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n highlightedSeries: null | AreaChartProps.Series<T>;\n setHighlightedSeries: (series: null | AreaChartProps.Series<T>) => void;\n xDomain?: XDomain<T>;\n yDomain?: YDomain;\n xScaleType: XScaleType;\n yScaleType: YScaleType;\n height: number;\n width: number;\n popoverRef: RefObject<HTMLElement>;\n statusType: 'loading' | 'finished' | 'error';\n}\n\n// Represents the core the chart logic, including the model of all allowed user interactions.\nexport default function useChartModel<T extends AreaChartProps.DataTypes>({\n isRtl,\n fitHeight,\n externalSeries: allSeries,\n visibleSeries: series,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height: explicitHeight,\n width,\n popoverRef,\n statusType,\n}: UseChartModelProps<T>): ChartModel<T> {\n // Chart elements refs used in handlers.\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const plotMeasureRef = useRef<SVGLineElement>(null);\n const hasVisibleSeries = series.length > 0;\n const height =\n useHeightMeasure(() => plotMeasureRef.current, !fitHeight, [hasVisibleSeries, statusType]) ?? explicitHeight;\n const stableSetVisibleSeries = useStableCallback(setVisibleSeries);\n\n const model = useMemo(() => {\n // Compute scales, ticks and two-dimensional plots.\n const computed = computeChartProps({\n isRtl,\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n });\n\n // A store for chart interactions that don't require plot recomputation.\n const interactions = new InteractionsStore(series, computed.plot);\n\n const containsMultipleSeries = interactions.series.length > 1;\n\n // A series decorator to provide extra props such as color and marker type.\n const getInternalSeries = createSeriesDecorator(allSeries);\n\n const isMouseOverPopover = (clientX: number, clientY: number) => {\n if (popoverRef.current?.firstChild) {\n const popoverPosition = (popoverRef.current.firstChild as HTMLElement).getBoundingClientRect();\n if (\n clientX > popoverPosition.x - POPOVER_DEADZONE &&\n clientX < popoverPosition.x + popoverPosition.width + POPOVER_DEADZONE &&\n clientY > popoverPosition.y - POPOVER_DEADZONE &&\n clientY < popoverPosition.y + popoverPosition.height + POPOVER_DEADZONE\n ) {\n return true;\n }\n }\n return false;\n };\n\n // A Callback for svg mouseover to hover the plot points.\n // Throttling is necessary for a substantially smoother customer experience.\n const onSVGMouseMoveThrottled = throttle((clientX: number, clientY: number) => {\n // No hover logic when the popover is pinned or no data available.\n if (\n interactions.get().isPopoverPinned ||\n !plotRef.current ||\n interactions.plot.xy.length === 0 ||\n isMouseOverPopover(clientX, clientY)\n ) {\n return;\n }\n\n const svgRect = plotRef.current.svg.getBoundingClientRect();\n const offsetX = clientX - svgRect.left;\n const offsetY = clientY - svgRect.top;\n\n const closestX = findClosest(interactions.plot.xy, offsetX, xPoints => xPoints[0].scaled.x);\n const closestPoint = findClosest(closestX, offsetY, point => point.scaled.y1);\n\n // If close enough to the point - highlight the point and its column.\n // If not - only highlight the closest column.\n if (\n Math.abs(offsetX - closestPoint.scaled.x) < MAX_HOVER_MARGIN &&\n Math.abs(offsetY - closestPoint.scaled.y1) < MAX_HOVER_MARGIN\n ) {\n interactions.highlightPoint(closestPoint);\n } else {\n interactions.highlightX(closestX);\n }\n }, SVG_HOVER_THROTTLE);\n\n const onSVGMouseMove = ({ clientX, clientY }: React.MouseEvent<SVGElement>) =>\n onSVGMouseMoveThrottled(clientX, clientY);\n\n // A callback for svg mouseout to clear all highlights.\n const onSVGMouseOut = (event: React.MouseEvent<SVGElement>) => {\n // Because the mouseover is throttled, in can occur slightly after the mouseout,\n // neglecting its effect; cancelling the throttled function prevents that.\n onSVGMouseMoveThrottled.cancel();\n\n // No hover logic when the popover is pinned or mouse is over popover\n if (interactions.get().isPopoverPinned || isMouseOverPopover(event.clientX, event.clientY)) {\n return;\n }\n\n // Check if the target is contained within svg to allow hovering on the popover body.\n if (!nodeContains(plotRef.current!.svg, event.relatedTarget as Element)) {\n interactions.clearHighlightedLegend();\n interactions.clearHighlight();\n }\n };\n\n // A callback for svg click to pin/unpin the popover.\n const onSVGMouseDown = (event: React.MouseEvent<SVGSVGElement>) => {\n interactions.togglePopoverPin();\n event.preventDefault();\n };\n\n const moveWithinXAxis = (direction: -1 | 1) => {\n if (interactions.get().highlightedPoint) {\n return moveWithinSeries(direction);\n } else if (containsMultipleSeries) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const currentXIndex = highlightedX[0].index.x;\n const nextXIndex = circleIndex(currentXIndex + direction, [0, interactions.plot.xy.length - 1]);\n interactions.highlightX(interactions.plot.xy[nextXIndex]);\n }\n }\n };\n\n // A helper function to highlight the next or previous point within selected series.\n const moveWithinSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted series.\n const sIndex = point.index.s;\n // Take the incremented(circularly) x-index of the currently highlighted point.\n const xIndex = circleIndex(point.index.x + direction, [0, interactions.plot.xs.length - 1]);\n // Highlight the next point using x:s grouped data.\n interactions.highlightPoint(interactions.plot.xs[xIndex][sIndex]);\n };\n\n // A helper function to highlight the next or previous point within the selected column.\n const moveBetweenSeries = (direction: -1 | 1) => {\n const point = interactions.get().highlightedPoint;\n if (!point) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const xIndex = highlightedX[0].index.x;\n const points = interactions.plot.xy[xIndex];\n const yIndex = direction === 1 ? 0 : points.length - 1;\n interactions.highlightPoint(points[yIndex]);\n }\n return;\n }\n\n // Take the index of the currently highlighted column.\n const xIndex = point.index.x;\n const currentYIndex = point.index.y;\n\n if (\n containsMultipleSeries &&\n ((currentYIndex === 0 && direction === -1) ||\n (currentYIndex === interactions.plot.xy[xIndex].length - 1 && direction === 1))\n ) {\n interactions.highlightX(interactions.plot.xy[xIndex]);\n } else {\n // Take the incremented(circularly) y-index of the currently highlighted point.\n const nextYIndex = circleIndex(currentYIndex + direction, [0, interactions.plot.xy[xIndex].length - 1]);\n // Highlight the next point using x:y grouped data.\n interactions.highlightPoint(interactions.plot.xy[xIndex][nextYIndex]);\n }\n };\n\n // A callback for svg keydown to enable motions and popover pin with the keyboard.\n const onSVGKeyDown = (event: React.KeyboardEvent<HTMLElement | SVGElement>) => {\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 // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n // No keydown logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n handleKey(event, {\n onBlockEnd: () => moveBetweenSeries(-1),\n onBlockStart: () => moveBetweenSeries(1),\n onInlineStart: () => moveWithinXAxis(-1),\n onInlineEnd: () => moveWithinXAxis(1),\n onActivate: () => interactions.pinPopover(),\n });\n };\n\n const highlightFirstX = () => {\n interactions.highlightX(interactions.plot.xy[0]);\n };\n\n // A callback for application focus to highlight series.\n const onApplicationFocus = (_event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n // When focus is caused by a click event nothing is expected as clicks are handled separately.\n if (trigger === 'keyboard') {\n const { highlightedX, highlightedPoint, highlightedSeries, legendSeries } = interactions.get();\n if (containsMultipleSeries && !highlightedX && !highlightedPoint && !highlightedSeries && !legendSeries) {\n highlightFirstX();\n } else if (!highlightedX) {\n interactions.highlightFirstPoint();\n }\n }\n };\n\n // A callback for application blur to clear all highlights unless the popover is pinned.\n const onApplicationBlur = (event: React.FocusEvent<Element>) => {\n // Pinned popover stays pinned even if the focus is lost.\n // If blur is not caused by the popover, forget the previously highlighted point.\n if (!nodeBelongs(containerRef.current, event.relatedTarget) && !interactions.get().isPopoverPinned) {\n interactions.clearHighlight();\n }\n };\n\n const onFilterSeries = (series: readonly AreaChartProps.Series<T>[]) => {\n stableSetVisibleSeries(series);\n };\n\n const onLegendHighlight = (series: null | AreaChartProps.Series<T>) => {\n interactions.highlightSeries(series);\n };\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n interactions.unpinPopover();\n\n // Return focus back to the application or plot (when no point is highlighted).\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n if (interactions.get().highlightedPoint || interactions.get().highlightedX) {\n plotRef.current!.focusApplication();\n } else {\n interactions.clearHighlight();\n plotRef.current!.focusPlot();\n }\n }, 0);\n }\n };\n\n const onContainerBlur = () => {\n interactions.clearState();\n };\n\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n interactions.clearHighlight();\n interactions.clearHighlightedLegend();\n }\n };\n\n const onPopoverLeave = (event: MouseEvent) => {\n if (nodeContains(plotRef.current!.svg, event.relatedTarget as Element) || interactions.get().isPopoverPinned) {\n return;\n }\n interactions.clearHighlight();\n interactions.clearHighlightedLegend();\n };\n return {\n width,\n height,\n series,\n allSeries,\n getInternalSeries,\n computed,\n interactions,\n handlers: {\n onSVGMouseMove,\n onSVGMouseOut,\n onSVGMouseDown,\n onSVGKeyDown,\n onApplicationFocus,\n onApplicationBlur,\n onFilterSeries,\n onLegendHighlight,\n onPopoverDismiss,\n onContainerBlur,\n onDocumentKeyDown,\n onPopoverLeave,\n },\n refs: {\n plot: plotRef,\n plotMeasure: plotMeasureRef,\n container: containerRef,\n verticalMarker: verticalMarkerRef,\n popoverRef,\n },\n };\n }, [\n allSeries,\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n stableSetVisibleSeries,\n popoverRef,\n isRtl,\n ]);\n\n // Notify client when series highlight change.\n useReaction(model.interactions, state => state.highlightedSeries, setHighlightedSeries);\n\n // Update interactions store when series highlight in a controlled way.\n useEffect(() => {\n if (highlightedSeries !== model.interactions.get().highlightedSeries) {\n model.interactions.highlightSeries(highlightedSeries);\n }\n }, [model, highlightedSeries]);\n\n return model;\n}\n"]}
1
+ {"version":3,"file":"use-chart-model.js","sourceRoot":"","sources":["../../../../src/area-chart/model/use-chart-model.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAyB,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,qBAAqB,MAAM,2BAA2B,CAAC;AAE9D,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAoB5B,6FAA6F;AAC7F,MAAM,CAAC,OAAO,UAAU,aAAa,CAAqC,EACxE,KAAK,EACL,SAAS,EACT,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EA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AS,EAAE,YAAY;gBACvB,cAAc,EAAE,iBAAiB;gBACjC,UAAU;aACX;SACF,CAAC;IACJ,CAAC,EAAE;QACD,SAAS;QACT,MAAM;QACN,OAAO;QACP,OAAO;QACP,UAAU;QACV,UAAU;QACV,MAAM;QACN,KAAK;QACL,sBAAsB;QACtB,UAAU;QACV,KAAK;KACN,CAAC,CAAC;IAEH,8CAA8C;IAC9C,WAAW,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IAExF,uEAAuE;IACvE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE;YACpE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/B,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, { MouseEvent, RefObject, useEffect, useMemo, useRef } from 'react';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport { XDomain, XScaleType, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\nimport { useHeightMeasure } from '../../internal/hooks/container-queries/use-height-measure';\nimport { KeyCode } from '../../internal/keycode';\nimport { circleIndex } from '../../internal/utils/circle-index';\nimport handleKey from '../../internal/utils/handle-key';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { throttle } from '../../internal/utils/throttle';\nimport { useReaction } from '../async-store';\nimport { AreaChartProps } from '../interfaces';\nimport computeChartProps from './compute-chart-props';\nimport createSeriesDecorator from './create-series-decorator';\nimport { ChartModel } from './index';\nimport InteractionsStore from './interactions-store';\nimport { findClosest } from './utils';\n\nconst MAX_HOVER_MARGIN = 6;\nconst SVG_HOVER_THROTTLE = 25;\nconst POPOVER_DEADZONE = 12;\n\nexport interface UseChartModelProps<T extends AreaChartProps.DataTypes> {\n isRtl?: boolean;\n fitHeight?: boolean;\n externalSeries: readonly AreaChartProps.Series<T>[];\n visibleSeries: readonly AreaChartProps.Series<T>[];\n setVisibleSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n highlightedSeries: null | AreaChartProps.Series<T>;\n setHighlightedSeries: (series: null | AreaChartProps.Series<T>) => void;\n xDomain?: XDomain<T>;\n yDomain?: YDomain;\n xScaleType: XScaleType;\n yScaleType: YScaleType;\n height: number;\n width: number;\n popoverRef: RefObject<HTMLElement>;\n statusType: 'loading' | 'finished' | 'error';\n}\n\n// Represents the core the chart logic, including the model of all allowed user interactions.\nexport default function useChartModel<T extends AreaChartProps.DataTypes>({\n isRtl,\n fitHeight,\n externalSeries: allSeries,\n visibleSeries: series,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height: explicitHeight,\n width,\n popoverRef,\n statusType,\n}: UseChartModelProps<T>): ChartModel<T> {\n // Chart elements refs used in handlers.\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const plotMeasureRef = useRef<SVGLineElement>(null);\n const hasVisibleSeries = series.length > 0;\n const height =\n useHeightMeasure(() => plotMeasureRef.current, !fitHeight, [hasVisibleSeries, statusType]) ?? explicitHeight;\n const stableSetVisibleSeries = useStableCallback(setVisibleSeries);\n\n const model = useMemo(() => {\n // Compute scales, ticks and two-dimensional plots.\n const computed = computeChartProps({\n isRtl,\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n });\n\n // A store for chart interactions that don't require plot recomputation.\n const interactions = new InteractionsStore(series, computed.plot);\n\n const containsMultipleSeries = interactions.series.length > 1;\n\n // A series decorator to provide extra props such as color and marker type.\n const getInternalSeries = createSeriesDecorator(allSeries);\n\n const isMouseOverPopover = (clientX: number, clientY: number) => {\n if (popoverRef.current?.firstChild) {\n const popoverPosition = (popoverRef.current.firstChild as HTMLElement).getBoundingClientRect();\n if (\n clientX > popoverPosition.x - POPOVER_DEADZONE &&\n clientX < popoverPosition.x + popoverPosition.width + POPOVER_DEADZONE &&\n clientY > popoverPosition.y - POPOVER_DEADZONE &&\n clientY < popoverPosition.y + popoverPosition.height + POPOVER_DEADZONE\n ) {\n return true;\n }\n }\n return false;\n };\n\n // A Callback for svg mouseover to hover the plot points.\n // Throttling is necessary for a substantially smoother customer experience.\n const onSVGMouseMoveThrottled = throttle((clientX: number, clientY: number) => {\n // No hover logic when the popover is pinned or no data available.\n if (\n interactions.get().isPopoverPinned ||\n !plotRef.current ||\n interactions.plot.xy.length === 0 ||\n isMouseOverPopover(clientX, clientY)\n ) {\n return;\n }\n\n const svgRect = plotRef.current.svg.getBoundingClientRect();\n const offsetX = clientX - svgRect.left;\n const offsetY = clientY - svgRect.top;\n\n const closestX = findClosest(interactions.plot.xy, offsetX, xPoints => xPoints[0].scaled.x);\n if (closestX === null) {\n return;\n }\n\n const closestPoint = findClosest(closestX, offsetY, point => point.scaled.y1);\n if (closestPoint === null) {\n return;\n }\n\n // If close enough to the point - highlight the point and its column.\n // If not - only highlight the closest column.\n if (\n Math.abs(offsetX - closestPoint.scaled.x) < MAX_HOVER_MARGIN &&\n Math.abs(offsetY - closestPoint.scaled.y1) < MAX_HOVER_MARGIN\n ) {\n interactions.highlightPoint(closestPoint);\n } else {\n interactions.highlightX(closestX);\n }\n }, SVG_HOVER_THROTTLE);\n\n const onSVGMouseMove = ({ clientX, clientY }: React.MouseEvent<SVGElement>) =>\n onSVGMouseMoveThrottled(clientX, clientY);\n\n // A callback for svg mouseout to clear all highlights.\n const onSVGMouseOut = (event: React.MouseEvent<SVGElement>) => {\n // Because the mouseover is throttled, in can occur slightly after the mouseout,\n // neglecting its effect; cancelling the throttled function prevents that.\n onSVGMouseMoveThrottled.cancel();\n\n // No hover logic when the popover is pinned or mouse is over popover\n if (interactions.get().isPopoverPinned || isMouseOverPopover(event.clientX, event.clientY)) {\n return;\n }\n\n // Check if the target is contained within svg to allow hovering on the popover body.\n if (!nodeContains(plotRef.current!.svg, event.relatedTarget as Element)) {\n interactions.clearHighlightedLegend();\n interactions.clearHighlight();\n }\n };\n\n // A callback for svg click to pin/unpin the popover.\n const onSVGMouseDown = (event: React.MouseEvent<SVGSVGElement>) => {\n interactions.togglePopoverPin();\n event.preventDefault();\n };\n\n const moveWithinXAxis = (direction: -1 | 1) => {\n if (interactions.get().highlightedPoint) {\n return moveWithinSeries(direction);\n } else if (containsMultipleSeries) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const currentXIndex = highlightedX[0].index.x;\n const nextXIndex = circleIndex(currentXIndex + direction, [0, interactions.plot.xy.length - 1]);\n interactions.highlightX(interactions.plot.xy[nextXIndex]);\n }\n }\n };\n\n // A helper function to highlight the next or previous point within selected series.\n const moveWithinSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted series.\n const sIndex = point.index.s;\n // Take the incremented(circularly) x-index of the currently highlighted point.\n const xIndex = circleIndex(point.index.x + direction, [0, interactions.plot.xs.length - 1]);\n // Highlight the next point using x:s grouped data.\n interactions.highlightPoint(interactions.plot.xs[xIndex][sIndex]);\n };\n\n // A helper function to highlight the next or previous point within the selected column.\n const moveBetweenSeries = (direction: -1 | 1) => {\n const point = interactions.get().highlightedPoint;\n if (!point) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const xIndex = highlightedX[0].index.x;\n const points = interactions.plot.xy[xIndex];\n const yIndex = direction === 1 ? 0 : points.length - 1;\n interactions.highlightPoint(points[yIndex]);\n }\n return;\n }\n\n // Take the index of the currently highlighted column.\n const xIndex = point.index.x;\n const currentYIndex = point.index.y;\n\n if (\n containsMultipleSeries &&\n ((currentYIndex === 0 && direction === -1) ||\n (currentYIndex === interactions.plot.xy[xIndex].length - 1 && direction === 1))\n ) {\n interactions.highlightX(interactions.plot.xy[xIndex]);\n } else {\n // Take the incremented(circularly) y-index of the currently highlighted point.\n const nextYIndex = circleIndex(currentYIndex + direction, [0, interactions.plot.xy[xIndex].length - 1]);\n // Highlight the next point using x:y grouped data.\n interactions.highlightPoint(interactions.plot.xy[xIndex][nextYIndex]);\n }\n };\n\n // A callback for svg keydown to enable motions and popover pin with the keyboard.\n const onSVGKeyDown = (event: React.KeyboardEvent<HTMLElement | SVGElement>) => {\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 // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n // No keydown logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n handleKey(event, {\n onBlockEnd: () => moveBetweenSeries(-1),\n onBlockStart: () => moveBetweenSeries(1),\n onInlineStart: () => moveWithinXAxis(-1),\n onInlineEnd: () => moveWithinXAxis(1),\n onActivate: () => interactions.pinPopover(),\n });\n };\n\n const highlightFirstX = () => {\n interactions.highlightX(interactions.plot.xy[0]);\n };\n\n // A callback for application focus to highlight series.\n const onApplicationFocus = (_event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n // When focus is caused by a click event nothing is expected as clicks are handled separately.\n if (trigger === 'keyboard') {\n const { highlightedX, highlightedPoint, highlightedSeries, legendSeries } = interactions.get();\n if (containsMultipleSeries && !highlightedX && !highlightedPoint && !highlightedSeries && !legendSeries) {\n highlightFirstX();\n } else if (!highlightedX) {\n interactions.highlightFirstPoint();\n }\n }\n };\n\n // A callback for application blur to clear all highlights unless the popover is pinned.\n const onApplicationBlur = (event: React.FocusEvent<Element>) => {\n // Pinned popover stays pinned even if the focus is lost.\n // If blur is not caused by the popover, forget the previously highlighted point.\n if (!nodeBelongs(containerRef.current, event.relatedTarget) && !interactions.get().isPopoverPinned) {\n interactions.clearHighlight();\n }\n };\n\n const onFilterSeries = (series: readonly AreaChartProps.Series<T>[]) => {\n stableSetVisibleSeries(series);\n };\n\n const onLegendHighlight = (series: null | AreaChartProps.Series<T>) => {\n interactions.highlightSeries(series);\n };\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n interactions.unpinPopover();\n\n // Return focus back to the application or plot (when no point is highlighted).\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n if (interactions.get().highlightedPoint || interactions.get().highlightedX) {\n plotRef.current!.focusApplication();\n } else {\n interactions.clearHighlight();\n plotRef.current!.focusPlot();\n }\n }, 0);\n }\n };\n\n const onContainerBlur = () => {\n interactions.clearState();\n };\n\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n interactions.clearHighlight();\n interactions.clearHighlightedLegend();\n }\n };\n\n const onPopoverLeave = (event: MouseEvent) => {\n if (nodeContains(plotRef.current!.svg, event.relatedTarget as Element) || interactions.get().isPopoverPinned) {\n return;\n }\n interactions.clearHighlight();\n interactions.clearHighlightedLegend();\n };\n return {\n width,\n height,\n series,\n allSeries,\n getInternalSeries,\n computed,\n interactions,\n handlers: {\n onSVGMouseMove,\n onSVGMouseOut,\n onSVGMouseDown,\n onSVGKeyDown,\n onApplicationFocus,\n onApplicationBlur,\n onFilterSeries,\n onLegendHighlight,\n onPopoverDismiss,\n onContainerBlur,\n onDocumentKeyDown,\n onPopoverLeave,\n },\n refs: {\n plot: plotRef,\n plotMeasure: plotMeasureRef,\n container: containerRef,\n verticalMarker: verticalMarkerRef,\n popoverRef,\n },\n };\n }, [\n allSeries,\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n stableSetVisibleSeries,\n popoverRef,\n isRtl,\n ]);\n\n // Notify client when series highlight change.\n useReaction(model.interactions, state => state.highlightedSeries, setHighlightedSeries);\n\n // Update interactions store when series highlight in a controlled way.\n useEffect(() => {\n if (highlightedSeries !== model.interactions.get().highlightedSeries) {\n model.interactions.highlightSeries(highlightedSeries);\n }\n }, [model, highlightedSeries]);\n\n return model;\n}\n"]}
@@ -9,5 +9,5 @@ export declare function computePlotPoints<T>(series: readonly AreaChartProps.Ser
9
9
  xs: ChartModel.PlotPoint<T>[][];
10
10
  sx: ChartModel.PlotPoint<T>[][];
11
11
  };
12
- export declare function findClosest<T>(sortedArray: readonly T[], target: number, getter: (item: T) => number): T;
12
+ export declare function findClosest<T>(sortedArray: readonly T[], target: number, getter: (item: T) => number): null | T;
13
13
  export declare function isSeriesValid<T>(series: readonly AreaChartProps.Series<T>[]): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AACpH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAQrC,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAkBhH;AAGD,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAqC7G;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,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAqC7G;AAID,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC3C,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,iBAAiB,GACxB;IACD,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAChC,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAChC,EAAE,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;CACjC,CA6DA;AAGD,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,CAqB/G;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAc3E"}
@@ -112,7 +112,7 @@ export function computePlotPoints(series, xScale, yScale) {
112
112
  export function findClosest(sortedArray, target, getter) {
113
113
  // The method guarantees to return a point hence empty arrays are not allowed.
114
114
  if (sortedArray.length === 0) {
115
- throw new Error('Invariant violation: array is empty.');
115
+ return null;
116
116
  }
117
117
  const isAscending = getter(sortedArray[0]) < getter(sortedArray[sortedArray.length - 1]);
118
118
  const compare = (x) => (isAscending ? getter(x) < target : getter(x) > target);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/area-chart/model/utils.ts"],"names":[],"mappings":"AAOA,8BAA8B;AAC9B,kEAAkE;AAClE,sGAAsG;AACtG,MAAM,OAAO,GAAG,eAAe,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAA2B,MAA2C;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AAS,gBAAgB,CAAI,MAAa,EAAE,GAAW,EAAE,GAAW,EAAE,KAAQ;IAC5E,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;QAChB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;KAClB;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC3B,CAAC;AAED,kEAAkE;AAClE,SAAS,IAAI,CAAI,GAAiB;IAChC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IACtB,MAAM,SAAS,GAAQ,EAAE,CAAC;IAE1B,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACnB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACf,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartDataTypes, XDomain, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { AreaChartProps } from '../interfaces';\nimport { ChartModel } from './index';\n\n// A sufficiently small value.\n// The Number.EPSILON is not available in the target ECMA version.\n// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON\nconst EPSILON = 0.0000000000001;\n\n// When x-domain is not set explicitly - guess it based on the available data.\nexport function computeDomainX<T extends ChartDataTypes>(series: readonly AreaChartProps.Series<T>[]): XDomain<T> {\n const xValues = getXValues(series);\n\n if (xValues.length === 0) {\n return [] as unknown as XDomain<T>;\n }\n\n // Assuming categorical domain.\n // In that case, all values are to be included.\n if (typeof xValues[0] === 'string') {\n return uniq(xValues) as unknown as XDomain<T>;\n }\n\n // For non-categorical domain find min and max bounds.\n return xValues.reduce(\n ([min, max], x) => [x < min ? x : min, max < x ? x : max],\n [xValues[0], xValues[0]]\n ) as unknown as XDomain<T>;\n}\n\n// When y-domain is not set explicitly - guess it based on the available data and series.\nexport function computeDomainY<T>(series: readonly AreaChartProps.Series<T>[], scaleType: YScaleType): YDomain {\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n\n // Find the min and max for threshold series.\n series.forEach(s => {\n if (s.type === 'threshold') {\n min = Math.min(min, s.y);\n max = Math.max(max, s.y);\n }\n });\n\n // Find the min and max for area series considering their stacking.\n getXValues(series).forEach((_, xIndex) => {\n // Maintains the prev stack level.\n let stackY = scaleType === 'linear' ? 0 : EPSILON;\n\n for (const s of series) {\n if (s.type === 'area') {\n stackY = stackY + (s.data[xIndex]?.y || 0);\n min = Math.min(min, stackY);\n max = Math.max(max, stackY);\n }\n }\n });\n\n // If min/max is not overridden than either series or series data is empty.\n if (min === Number.POSITIVE_INFINITY) {\n return [];\n }\n\n // Log scales can't start from 0, so, if possible, start from 1.\n if (scaleType === 'log' && min === 0 && max > 1) {\n return [1, max];\n }\n\n return [min, max];\n}\n\n// For given data, series and scales, compute all points and group them as\n// x:y, x:series and series:x to allow constant time access to the required point or subset.\nexport function computePlotPoints<T>(\n series: readonly AreaChartProps.Series<T>[],\n xScale: ChartScale,\n yScale: NumericChartScale\n): {\n xy: ChartModel.PlotPoint<T>[][];\n xs: ChartModel.PlotPoint<T>[][];\n sx: ChartModel.PlotPoint<T>[][];\n} {\n const xValues = getXValues(series);\n\n // Lookup for xy[xIndex][yIndex]\n const xy: ChartModel.PlotPoint<T>[][] = [];\n // Lookup for xs[xIndex][seriesIndex]\n const xs: ChartModel.PlotPoint<T>[][] = [];\n // Lookup for sx[seriesIndex][xIndex]\n const sx: ChartModel.PlotPoint<T>[][] = [];\n\n // Filter out the data which is beyond the plot for whatever reason.\n getVisibleData(xValues, xScale).forEach(({ x, scaledX }, xIndex) => {\n // Maintains the prev stack level. Starting from epsilon to not break log scales.\n let stackY = yScale.scaleType === 'linear' ? 0 : EPSILON;\n\n // A column of series points related to the same x.\n const points: ChartModel.PlotPoint<T>[] = [];\n\n // Collect the points, leaving y-index as 0 for now.\n series.forEach((s, sIndex) => {\n if (s.type === 'threshold') {\n const scaledY = yScale.d3Scale(s.y) || 0;\n points.push({\n x: x,\n y0: s.y,\n y1: s.y,\n scaled: { x: scaledX, y0: scaledY, y1: scaledY },\n index: { x: xIndex, s: sIndex, y: 0 },\n value: 0,\n });\n } else {\n const value = s.data[xIndex]?.y || 0;\n const y0 = stackY;\n const y1 = stackY + value;\n points.push({\n x: x,\n y0: y0,\n y1: y1,\n scaled: { x: scaledX, y0: yScale.d3Scale(y0) || 0, y1: yScale.d3Scale(y1) || 0 },\n index: { x: xIndex, s: sIndex, y: 0 },\n value: value,\n });\n\n stackY = y1;\n }\n });\n\n // Sort points by y and insert the missing y-index.\n points\n .sort((p1, p2) => p1.y1 - p2.y1)\n .forEach((point, index) => {\n point.index.y = index;\n\n // Insert the points to the respective two-dimensional lookup arrays.\n insertIntoMatrix(xy, point.index.x, point.index.y, point);\n insertIntoMatrix(xs, point.index.x, point.index.s, point);\n insertIntoMatrix(sx, point.index.s, point.index.x, point);\n });\n });\n\n return { xy, xs, sx };\n}\n\n// Finds the closest point in the sorted array.\nexport function findClosest<T>(sortedArray: readonly T[], target: number, getter: (item: T) => number): T {\n // The method guarantees to return a point hence empty arrays are not allowed.\n if (sortedArray.length === 0) {\n throw new Error('Invariant violation: array is empty.');\n }\n\n const isAscending = getter(sortedArray[0]) < getter(sortedArray[sortedArray.length - 1]);\n const compare = (x: T) => (isAscending ? getter(x) < target : getter(x) > target);\n const delta = (x: T) => Math.abs(getter(x) - target);\n\n // Use binary search to find the closest value in a sorted array.\n let lo = 0;\n let hi = sortedArray.length - 1;\n while (hi - lo > 1) {\n const mid = Math.floor((lo + hi) / 2);\n if (compare(sortedArray[mid])) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return delta(sortedArray[lo]) < delta(sortedArray[hi]) ? sortedArray[lo] : sortedArray[hi];\n}\n\n// Compares all x-values between series to ensure they are consistent.\nexport function isSeriesValid<T>(series: readonly AreaChartProps.Series<T>[]) {\n const sampleXValues = getXValues(series);\n\n for (const s of series) {\n if (s.type === 'area') {\n for (let i = 0; i < Math.max(s.data.length, sampleXValues.length); i++) {\n if (s.data[i]?.x !== sampleXValues[i]) {\n return false;\n }\n }\n }\n }\n\n return true;\n}\n\n// Takes first area series x-values as all data x-values are to match across series.\nfunction getXValues<T>(series: readonly AreaChartProps.Series<T>[]) {\n for (const s of series) {\n if (s.type === 'area') {\n return s.data.map(({ x }) => x);\n }\n }\n\n return [];\n}\n\n// Returns data that is visible in the given scale.\nfunction getVisibleData<T>(data: readonly T[], xScale: ChartScale) {\n const scaledOffsetX = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n\n const visibleData = [];\n for (const x of data) {\n const scaledX = xScale.d3Scale(x as any);\n\n if (scaledX !== undefined) {\n visibleData.push({ x, scaledX: scaledX + scaledOffsetX });\n }\n }\n return visibleData;\n}\n\n// Inserts given value into a two-dimensional array.\nfunction insertIntoMatrix<T>(matrix: T[][], row: number, col: number, value: T) {\n if (!matrix[row]) {\n matrix[row] = [];\n }\n matrix[row][col] = value;\n}\n\n// Creates new array with only unique elements of the given array.\nfunction uniq<T>(arr: readonly T[]): readonly T[] {\n const set = new Set();\n const uniqArray: T[] = [];\n\n for (const value of arr) {\n if (!set.has(value)) {\n set.add(value);\n uniqArray.push(value);\n }\n }\n\n return uniqArray;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/area-chart/model/utils.ts"],"names":[],"mappings":"AAOA,8BAA8B;AAC9B,kEAAkE;AAClE,sGAAsG;AACtG,MAAM,OAAO,GAAG,eAAe,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAA2B,MAA2C;IACl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GAAW,EAAE,GAAW,EAAE,KAAQ;IAC5E,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;QAChB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;KAClB;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC3B,CAAC;AAED,kEAAkE;AAClE,SAAS,IAAI,CAAI,GAAiB;IAChC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IACtB,MAAM,SAAS,GAAQ,EAAE,CAAC;IAE1B,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACnB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACf,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartDataTypes, XDomain, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { AreaChartProps } from '../interfaces';\nimport { ChartModel } from './index';\n\n// A sufficiently small value.\n// The Number.EPSILON is not available in the target ECMA version.\n// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON\nconst EPSILON = 0.0000000000001;\n\n// When x-domain is not set explicitly - guess it based on the available data.\nexport function computeDomainX<T extends ChartDataTypes>(series: readonly AreaChartProps.Series<T>[]): XDomain<T> {\n const xValues = getXValues(series);\n\n if (xValues.length === 0) {\n return [] as unknown as XDomain<T>;\n }\n\n // Assuming categorical domain.\n // In that case, all values are to be included.\n if (typeof xValues[0] === 'string') {\n return uniq(xValues) as unknown as XDomain<T>;\n }\n\n // For non-categorical domain find min and max bounds.\n return xValues.reduce(\n ([min, max], x) => [x < min ? x : min, max < x ? x : max],\n [xValues[0], xValues[0]]\n ) as unknown as XDomain<T>;\n}\n\n// When y-domain is not set explicitly - guess it based on the available data and series.\nexport function computeDomainY<T>(series: readonly AreaChartProps.Series<T>[], scaleType: YScaleType): YDomain {\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n\n // Find the min and max for threshold series.\n series.forEach(s => {\n if (s.type === 'threshold') {\n min = Math.min(min, s.y);\n max = Math.max(max, s.y);\n }\n });\n\n // Find the min and max for area series considering their stacking.\n getXValues(series).forEach((_, xIndex) => {\n // Maintains the prev stack level.\n let stackY = scaleType === 'linear' ? 0 : EPSILON;\n\n for (const s of series) {\n if (s.type === 'area') {\n stackY = stackY + (s.data[xIndex]?.y || 0);\n min = Math.min(min, stackY);\n max = Math.max(max, stackY);\n }\n }\n });\n\n // If min/max is not overridden than either series or series data is empty.\n if (min === Number.POSITIVE_INFINITY) {\n return [];\n }\n\n // Log scales can't start from 0, so, if possible, start from 1.\n if (scaleType === 'log' && min === 0 && max > 1) {\n return [1, max];\n }\n\n return [min, max];\n}\n\n// For given data, series and scales, compute all points and group them as\n// x:y, x:series and series:x to allow constant time access to the required point or subset.\nexport function computePlotPoints<T>(\n series: readonly AreaChartProps.Series<T>[],\n xScale: ChartScale,\n yScale: NumericChartScale\n): {\n xy: ChartModel.PlotPoint<T>[][];\n xs: ChartModel.PlotPoint<T>[][];\n sx: ChartModel.PlotPoint<T>[][];\n} {\n const xValues = getXValues(series);\n\n // Lookup for xy[xIndex][yIndex]\n const xy: ChartModel.PlotPoint<T>[][] = [];\n // Lookup for xs[xIndex][seriesIndex]\n const xs: ChartModel.PlotPoint<T>[][] = [];\n // Lookup for sx[seriesIndex][xIndex]\n const sx: ChartModel.PlotPoint<T>[][] = [];\n\n // Filter out the data which is beyond the plot for whatever reason.\n getVisibleData(xValues, xScale).forEach(({ x, scaledX }, xIndex) => {\n // Maintains the prev stack level. Starting from epsilon to not break log scales.\n let stackY = yScale.scaleType === 'linear' ? 0 : EPSILON;\n\n // A column of series points related to the same x.\n const points: ChartModel.PlotPoint<T>[] = [];\n\n // Collect the points, leaving y-index as 0 for now.\n series.forEach((s, sIndex) => {\n if (s.type === 'threshold') {\n const scaledY = yScale.d3Scale(s.y) || 0;\n points.push({\n x: x,\n y0: s.y,\n y1: s.y,\n scaled: { x: scaledX, y0: scaledY, y1: scaledY },\n index: { x: xIndex, s: sIndex, y: 0 },\n value: 0,\n });\n } else {\n const value = s.data[xIndex]?.y || 0;\n const y0 = stackY;\n const y1 = stackY + value;\n points.push({\n x: x,\n y0: y0,\n y1: y1,\n scaled: { x: scaledX, y0: yScale.d3Scale(y0) || 0, y1: yScale.d3Scale(y1) || 0 },\n index: { x: xIndex, s: sIndex, y: 0 },\n value: value,\n });\n\n stackY = y1;\n }\n });\n\n // Sort points by y and insert the missing y-index.\n points\n .sort((p1, p2) => p1.y1 - p2.y1)\n .forEach((point, index) => {\n point.index.y = index;\n\n // Insert the points to the respective two-dimensional lookup arrays.\n insertIntoMatrix(xy, point.index.x, point.index.y, point);\n insertIntoMatrix(xs, point.index.x, point.index.s, point);\n insertIntoMatrix(sx, point.index.s, point.index.x, point);\n });\n });\n\n return { xy, xs, sx };\n}\n\n// Finds the closest point in the sorted array.\nexport function findClosest<T>(sortedArray: readonly T[], target: number, getter: (item: T) => number): null | T {\n // The method guarantees to return a point hence empty arrays are not allowed.\n if (sortedArray.length === 0) {\n return null;\n }\n const isAscending = getter(sortedArray[0]) < getter(sortedArray[sortedArray.length - 1]);\n const compare = (x: T) => (isAscending ? getter(x) < target : getter(x) > target);\n const delta = (x: T) => Math.abs(getter(x) - target);\n\n // Use binary search to find the closest value in a sorted array.\n let lo = 0;\n let hi = sortedArray.length - 1;\n while (hi - lo > 1) {\n const mid = Math.floor((lo + hi) / 2);\n if (compare(sortedArray[mid])) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return delta(sortedArray[lo]) < delta(sortedArray[hi]) ? sortedArray[lo] : sortedArray[hi];\n}\n\n// Compares all x-values between series to ensure they are consistent.\nexport function isSeriesValid<T>(series: readonly AreaChartProps.Series<T>[]) {\n const sampleXValues = getXValues(series);\n\n for (const s of series) {\n if (s.type === 'area') {\n for (let i = 0; i < Math.max(s.data.length, sampleXValues.length); i++) {\n if (s.data[i]?.x !== sampleXValues[i]) {\n return false;\n }\n }\n }\n }\n\n return true;\n}\n\n// Takes first area series x-values as all data x-values are to match across series.\nfunction getXValues<T>(series: readonly AreaChartProps.Series<T>[]) {\n for (const s of series) {\n if (s.type === 'area') {\n return s.data.map(({ x }) => x);\n }\n }\n\n return [];\n}\n\n// Returns data that is visible in the given scale.\nfunction getVisibleData<T>(data: readonly T[], xScale: ChartScale) {\n const scaledOffsetX = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n\n const visibleData = [];\n for (const x of data) {\n const scaledX = xScale.d3Scale(x as any);\n\n if (scaledX !== undefined) {\n visibleData.push({ x, scaledX: scaledX + scaledOffsetX });\n }\n }\n return visibleData;\n}\n\n// Inserts given value into a two-dimensional array.\nfunction insertIntoMatrix<T>(matrix: T[][], row: number, col: number, value: T) {\n if (!matrix[row]) {\n matrix[row] = [];\n }\n matrix[row][col] = value;\n}\n\n// Creates new array with only unique elements of the given array.\nfunction uniq<T>(arr: readonly T[]): readonly T[] {\n const set = new Set();\n const uniqArray: T[] = [];\n\n for (const value of arr) {\n if (!set.has(value)) {\n set.add(value);\n uniqArray.push(value);\n }\n }\n\n return uniqArray;\n}\n"]}
@@ -2043,5 +2043,5 @@
2043
2043
  }
2044
2044
  }
2045
2045
  :root {
2046
- --awsui-version-info-add1bdd9: true;
2046
+ --awsui-version-info-a4a22ceb: true;
2047
2047
  }
@@ -84,7 +84,7 @@ export function calculateNextState(state, action) {
84
84
  }
85
85
  return state;
86
86
  default:
87
- throw new Error(`The given action type [${action.type}] is not supported.`);
87
+ throw new Error(`Invariant violation: unexpected action type: "${action.type}".`);
88
88
  }
89
89
  }
90
90
  export function getCallbacksForTransition(prevState, nextState) {
@@ -1 +1 @@
1
- {"version":3,"file":"use-drag-handle-interaction-state.js","sourceRoot":"","sources":["../../../../../../src/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAWtD,MAAM,UAAU,kBAAkB,CAChC,KAAoC,EACpC,MAAiB;IAEjB,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,cAAc,CAAC,CAAC;YACnB,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;YACjD,OAAO;gBACL,KAAK,EAAE,WAAW;gBAClB,SAAS,EAAE,WAAW;gBACtB,QAAQ;aACT,CAAC;SACH;QAED,KAAK,cAAc,CAAC,CAAC;YACnB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;YACvC,IAAI,KAAK,CAAC,KAAK,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,KAAK,YAAY,EAAE;gBAC/D,uCACK,KAAK,KACR,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,WAAW,IACtB;aACH;YACD,OAAO,KAAK,CAAC;SACd;QAED,KAAK,YAAY,CAAC,CAAC;YACjB,IAAI,KAAK,CAAC,KAAK,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,KAAK,YAAY,EAAE;gBAC/D,MAAM,mBAAmB,GAAG,KAAK,CAAC,KAAK,CAAC;gBACxC,IAAI,mBAAmB,KAAK,WAAW,EAAE;oBACvC,OAAO;wBACL,KAAK,EAAE,kBAAkB;wBACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,0EAA0E;qBACrG,CAAC;iBACH;qBAAM;oBACL,OAAO;wBACL,KAAK,EAAE,SAAS;wBAChB,SAAS,EAAE,K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gBACpB,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;aAC1C,CAAC,CAAC;QACL,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAmB,EAAE,EAAE;YAC1C,QAAQ,CAAC;gBACP,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;aAChC,CAAC,CAAC;QACL,CAAC;QACD,gBAAgB,EAAE,CAAC,KAAmB,EAAE,EAAE;YACxC,QAAQ,CAAC;gBACP,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;aAChC,CAAC,CAAC;QACL,CAAC;QACD,oBAAoB,EAAE,GAAG,EAAE;YACzB,QAAQ,CAAC;gBACP,IAAI,EAAE,gBAAgB;aACvB,CAAC,CAAC;QACL,CAAC;QACD,cAAc,EAAE,CAAC,KAAmC,EAAE,QAAY,EAAE,EAAE;YACpE,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;YACtB,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,GAAG,EAAE;gBACtD,QAAQ,CAAC;oBACP,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;iBAC3B,CAAC,CAAC;aACJ;QACH,CAAC;QACD,YAAY,EAAE,GAAG,EAAE;YACjB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useReducer, useRef } from 'react';\n\nimport type {\n Action,\n DragHandleInteractionState,\n StateTransitionCallbacks,\n UseDragHandleInteractionStateProps,\n} from './interfaces';\n\nexport { UseDragHandleInteractionStateProps };\n\nexport function calculateNextState<T = void>(\n state: DragHandleInteractionState<T>,\n action: Action<T>\n): DragHandleInteractionState<T> {\n switch (action.type) {\n case 'POINTER_DOWN': {\n const { nativeEvent, metadata } = action.payload;\n return {\n value: 'dnd-start',\n eventData: nativeEvent,\n metadata,\n };\n }\n\n case 'POINTER_MOVE': {\n const { nativeEvent } = action.payload;\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n ...state,\n value: 'dnd-active',\n eventData: nativeEvent,\n };\n }\n return state;\n }\n\n case 'POINTER_UP': {\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n const dndSubStateBeforeUp = state.value;\n if (dndSubStateBeforeUp === 'dnd-start') {\n return {\n value: 'uap-action-start',\n metadata: state.metadata, // Preserve metadata when transitioning from dnd-start to uap-action-start\n };\n } else {\n return {\n value: 'dnd-end',\n eventData: state.eventData,\n };\n }\n }\n return state;\n }\n\n case 'POINTER_CANCEL': {\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n value: 'dnd-end',\n };\n }\n return state;\n }\n\n case 'KEY_DOWN': {\n const { key, metadata } = action.payload;\n\n if (key === 'Enter' || key === ' ') {\n if (state.value === null || state.value === 'uap-action-end' || state.value === 'dnd-end') {\n return {\n value: 'uap-action-start',\n metadata,\n };\n } else if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n } else if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n value: 'uap-action-start',\n metadata,\n };\n }\n } else if (key === 'Escape') {\n if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n }\n }\n return state;\n }\n\n case 'FOCUS':\n return state;\n\n case 'BLUR':\n if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n }\n return state;\n\n default:\n throw new Error(`The given action type [${action.type}] is not supported.`);\n }\n}\n\nexport function getCallbacksForTransition<T = void>(\n prevState: DragHandleInteractionState<T>,\n nextState: DragHandleInteractionState<T>\n): StateTransitionCallbacks<T>[] {\n const callbacks: StateTransitionCallbacks<T>[] = [];\n\n // Transitions from dnd-start or dnd-active to any other state\n if (\n (prevState.value === 'dnd-start' || prevState.value === 'dnd-active') &&\n nextState.value !== 'dnd-start' &&\n nextState.value !== 'dnd-active'\n ) {\n callbacks.push({ type: 'onDndEnd' });\n }\n\n // From uap-action-start to uap-action-end directly\n if (prevState.value === 'uap-action-start' && nextState.value === 'uap-action-end') {\n callbacks.push({ type: 'onUapActionEnd' });\n }\n\n // Transitions to dnd-start\n if (nextState.value === 'dnd-start') {\n callbacks.push({\n type: 'onDndStart',\n payload: nextState.eventData!,\n metadata: nextState.metadata,\n });\n }\n\n // Transitions to dnd-active\n if (nextState.value === 'dnd-active' && prevState.value === 'dnd-start') {\n callbacks.push({\n type: 'onDndActive',\n payload: nextState.eventData!,\n });\n }\n\n // Transitions to uap-action-start\n if (nextState.value === 'uap-action-start') {\n callbacks.push({\n type: 'onUapActionStart',\n metadata: nextState.metadata,\n });\n }\n\n return callbacks;\n}\n\nfunction interactionReducer<T = void>(\n state: DragHandleInteractionState<T>,\n action: Action<T>\n): DragHandleInteractionState<T> {\n if (action.type === 'CLEAR_CALLBACKS') {\n return {\n ...state,\n transitionCallbacks: undefined,\n };\n }\n\n const nextState = calculateNextState(state, action);\n\n // Special handling for POINTER_MOVE to always trigger onDndActive callback\n if (action.type === 'POINTER_MOVE' && action.payload.nativeEvent) {\n const transitionCallbacks = getCallbacksForTransition(state, nextState);\n // Check if there's already an onDndActive callback from the transition\n const hasOnDndActiveCallback = transitionCallbacks.some(callback => callback.type === 'onDndActive');\n const callbacks = hasOnDndActiveCallback\n ? transitionCallbacks\n : [...transitionCallbacks, { type: 'onDndActive' as const, payload: action.payload.nativeEvent }];\n\n return {\n ...nextState,\n transitionCallbacks: callbacks,\n };\n }\n\n // Return current state if state didn't change\n const isDndState = (state: DragHandleInteractionState<T>) => {\n return state.value === 'dnd-start' || state.value === 'dnd-active' || state.value === 'dnd-end';\n };\n if (nextState.value === state.value) {\n if (isDndState(nextState) && isDndState(state)) {\n if (nextState.eventData === state.eventData) {\n return state;\n }\n } else {\n return state;\n }\n }\n\n const callbacks = getCallbacksForTransition(state, nextState);\n return {\n ...nextState,\n transitionCallbacks: callbacks.length > 0 ? callbacks : undefined,\n };\n}\n\nfunction useStateLogger<T = void>(state: DragHandleInteractionState<T>, isEnabled: boolean) {\n const prevStateRef = useRef<DragHandleInteractionState<T>>(state);\n useEffect(() => {\n if (state.value !== prevStateRef.current.value && isEnabled) {\n console.log(`State transition: ${prevStateRef.current.value} -> ${state.value}`, {\n prevState: prevStateRef.current,\n nextState: state,\n });\n }\n prevStateRef.current = state;\n }, [state, isEnabled]);\n}\n\nfunction useCallbackHandler<T = void>(\n pendingCallbacks: StateTransitionCallbacks<T>[] | undefined,\n props: UseDragHandleInteractionStateProps<T>,\n dispatch: React.Dispatch<Action<T>>\n) {\n useEffect(() => {\n if (!pendingCallbacks?.length) {\n return;\n }\n pendingCallbacks.forEach(callback => {\n switch (callback.type) {\n case 'onDndStart':\n props.onDndStartAction?.(callback.payload, callback.metadata);\n break;\n case 'onDndActive':\n props.onDndActiveAction?.(callback.payload);\n break;\n case 'onDndEnd':\n props.onDndEndAction?.();\n break;\n case 'onUapActionStart':\n props.onUapActionStartAction?.(callback.metadata);\n break;\n case 'onUapActionEnd':\n props.onUapActionEndAction?.();\n break;\n }\n });\n\n // Clean up callbacks to prevent re-execution on subsequent re-renders.\n dispatch({ type: 'CLEAR_CALLBACKS' });\n }, [pendingCallbacks, props, dispatch]);\n}\n\n/**\n * Manages interaction states for drag handle components.\n *\n * The hook implements a state machine for drag handles that supports:\n * - Pointer-based drag-and-drop (DnD) interactions\n * - Keyboard-based universal access pattern (UAP) interactions\n * - State transitions with appropriate callbacks\n * - Metadata passing between states\n *\n * States:\n * - null: Idle state with no active interaction\n * - dnd-start: Initial pointer down, beginning of potential drag\n * - dnd-active: Active dragging with pointer movement\n * - dnd-end: Completed drag operation\n * - uap-action-start: Keyboard/accessibility action initiated\n * - uap-action-end: Keyboard/accessibility action completed\n */\nexport default function useDragHandleInteractionState<T = void>(\n props: UseDragHandleInteractionStateProps<T> = {},\n options = { debug: false }\n) {\n const propsRef = useRef<UseDragHandleInteractionStateProps<T>>(props);\n propsRef.current = props;\n\n const [interaction, dispatch] = useReducer(interactionReducer<T>, { value: null } as DragHandleInteractionState<T>);\n useStateLogger(interaction, options.debug);\n useCallbackHandler(interaction.transitionCallbacks, propsRef.current, dispatch);\n return {\n interaction,\n processPointerDown: (event: PointerEvent, metadata?: T) => {\n dispatch({\n type: 'POINTER_DOWN',\n payload: { nativeEvent: event, metadata },\n });\n },\n processPointerMove: (event: PointerEvent) => {\n dispatch({\n type: 'POINTER_MOVE',\n payload: { nativeEvent: event },\n });\n },\n processPointerUp: (event: PointerEvent) => {\n dispatch({\n type: 'POINTER_UP',\n payload: { nativeEvent: event },\n });\n },\n processPointerCancel: () => {\n dispatch({\n type: 'POINTER_CANCEL',\n });\n },\n processKeyDown: (event: React.KeyboardEvent<Element>, metadata?: T) => {\n const key = event.key;\n if (key === 'Enter' || key === 'Escape' || key === ' ') {\n dispatch({\n type: 'KEY_DOWN',\n payload: { key, metadata },\n });\n }\n },\n processFocus: () => {\n dispatch({ type: 'FOCUS' });\n },\n processBlur: () => {\n dispatch({ type: 'BLUR' });\n },\n };\n}\n"]}
1
+ {"version":3,"file":"use-drag-handle-interaction-state.js","sourceRoot":"","sources":["../../../../../../src/internal/components/drag-handle/hooks/use-drag-handle-interaction-state.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAWtD,MAAM,UAAU,kBAAkB,CAChC,KAAoC,EACpC,MAAiB;IAEjB,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,cA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AE;aAChC,CAAC,CAAC;QACL,CAAC;QACD,oBAAoB,EAAE,GAAG,EAAE;YACzB,QAAQ,CAAC;gBACP,IAAI,EAAE,gBAAgB;aACvB,CAAC,CAAC;QACL,CAAC;QACD,cAAc,EAAE,CAAC,KAAmC,EAAE,QAAY,EAAE,EAAE;YACpE,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;YACtB,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,GAAG,EAAE;gBACtD,QAAQ,CAAC;oBACP,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;iBAC3B,CAAC,CAAC;aACJ;QACH,CAAC;QACD,YAAY,EAAE,GAAG,EAAE;YACjB,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useReducer, useRef } from 'react';\n\nimport type {\n Action,\n DragHandleInteractionState,\n StateTransitionCallbacks,\n UseDragHandleInteractionStateProps,\n} from './interfaces';\n\nexport { UseDragHandleInteractionStateProps };\n\nexport function calculateNextState<T = void>(\n state: DragHandleInteractionState<T>,\n action: Action<T>\n): DragHandleInteractionState<T> {\n switch (action.type) {\n case 'POINTER_DOWN': {\n const { nativeEvent, metadata } = action.payload;\n return {\n value: 'dnd-start',\n eventData: nativeEvent,\n metadata,\n };\n }\n\n case 'POINTER_MOVE': {\n const { nativeEvent } = action.payload;\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n ...state,\n value: 'dnd-active',\n eventData: nativeEvent,\n };\n }\n return state;\n }\n\n case 'POINTER_UP': {\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n const dndSubStateBeforeUp = state.value;\n if (dndSubStateBeforeUp === 'dnd-start') {\n return {\n value: 'uap-action-start',\n metadata: state.metadata, // Preserve metadata when transitioning from dnd-start to uap-action-start\n };\n } else {\n return {\n value: 'dnd-end',\n eventData: state.eventData,\n };\n }\n }\n return state;\n }\n\n case 'POINTER_CANCEL': {\n if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n value: 'dnd-end',\n };\n }\n return state;\n }\n\n case 'KEY_DOWN': {\n const { key, metadata } = action.payload;\n\n if (key === 'Enter' || key === ' ') {\n if (state.value === null || state.value === 'uap-action-end' || state.value === 'dnd-end') {\n return {\n value: 'uap-action-start',\n metadata,\n };\n } else if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n } else if (state.value === 'dnd-start' || state.value === 'dnd-active') {\n return {\n value: 'uap-action-start',\n metadata,\n };\n }\n } else if (key === 'Escape') {\n if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n }\n }\n return state;\n }\n\n case 'FOCUS':\n return state;\n\n case 'BLUR':\n if (state.value === 'uap-action-start') {\n return {\n value: 'uap-action-end',\n };\n }\n return state;\n\n default:\n throw new Error(`Invariant violation: unexpected action type: \"${action.type}\".`);\n }\n}\n\nexport function getCallbacksForTransition<T = void>(\n prevState: DragHandleInteractionState<T>,\n nextState: DragHandleInteractionState<T>\n): StateTransitionCallbacks<T>[] {\n const callbacks: StateTransitionCallbacks<T>[] = [];\n\n // Transitions from dnd-start or dnd-active to any other state\n if (\n (prevState.value === 'dnd-start' || prevState.value === 'dnd-active') &&\n nextState.value !== 'dnd-start' &&\n nextState.value !== 'dnd-active'\n ) {\n callbacks.push({ type: 'onDndEnd' });\n }\n\n // From uap-action-start to uap-action-end directly\n if (prevState.value === 'uap-action-start' && nextState.value === 'uap-action-end') {\n callbacks.push({ type: 'onUapActionEnd' });\n }\n\n // Transitions to dnd-start\n if (nextState.value === 'dnd-start') {\n callbacks.push({\n type: 'onDndStart',\n payload: nextState.eventData!,\n metadata: nextState.metadata,\n });\n }\n\n // Transitions to dnd-active\n if (nextState.value === 'dnd-active' && prevState.value === 'dnd-start') {\n callbacks.push({\n type: 'onDndActive',\n payload: nextState.eventData!,\n });\n }\n\n // Transitions to uap-action-start\n if (nextState.value === 'uap-action-start') {\n callbacks.push({\n type: 'onUapActionStart',\n metadata: nextState.metadata,\n });\n }\n\n return callbacks;\n}\n\nfunction interactionReducer<T = void>(\n state: DragHandleInteractionState<T>,\n action: Action<T>\n): DragHandleInteractionState<T> {\n if (action.type === 'CLEAR_CALLBACKS') {\n return {\n ...state,\n transitionCallbacks: undefined,\n };\n }\n\n const nextState = calculateNextState(state, action);\n\n // Special handling for POINTER_MOVE to always trigger onDndActive callback\n if (action.type === 'POINTER_MOVE' && action.payload.nativeEvent) {\n const transitionCallbacks = getCallbacksForTransition(state, nextState);\n // Check if there's already an onDndActive callback from the transition\n const hasOnDndActiveCallback = transitionCallbacks.some(callback => callback.type === 'onDndActive');\n const callbacks = hasOnDndActiveCallback\n ? transitionCallbacks\n : [...transitionCallbacks, { type: 'onDndActive' as const, payload: action.payload.nativeEvent }];\n\n return {\n ...nextState,\n transitionCallbacks: callbacks,\n };\n }\n\n // Return current state if state didn't change\n const isDndState = (state: DragHandleInteractionState<T>) => {\n return state.value === 'dnd-start' || state.value === 'dnd-active' || state.value === 'dnd-end';\n };\n if (nextState.value === state.value) {\n if (isDndState(nextState) && isDndState(state)) {\n if (nextState.eventData === state.eventData) {\n return state;\n }\n } else {\n return state;\n }\n }\n\n const callbacks = getCallbacksForTransition(state, nextState);\n return {\n ...nextState,\n transitionCallbacks: callbacks.length > 0 ? callbacks : undefined,\n };\n}\n\nfunction useStateLogger<T = void>(state: DragHandleInteractionState<T>, isEnabled: boolean) {\n const prevStateRef = useRef<DragHandleInteractionState<T>>(state);\n useEffect(() => {\n if (state.value !== prevStateRef.current.value && isEnabled) {\n console.log(`State transition: ${prevStateRef.current.value} -> ${state.value}`, {\n prevState: prevStateRef.current,\n nextState: state,\n });\n }\n prevStateRef.current = state;\n }, [state, isEnabled]);\n}\n\nfunction useCallbackHandler<T = void>(\n pendingCallbacks: StateTransitionCallbacks<T>[] | undefined,\n props: UseDragHandleInteractionStateProps<T>,\n dispatch: React.Dispatch<Action<T>>\n) {\n useEffect(() => {\n if (!pendingCallbacks?.length) {\n return;\n }\n pendingCallbacks.forEach(callback => {\n switch (callback.type) {\n case 'onDndStart':\n props.onDndStartAction?.(callback.payload, callback.metadata);\n break;\n case 'onDndActive':\n props.onDndActiveAction?.(callback.payload);\n break;\n case 'onDndEnd':\n props.onDndEndAction?.();\n break;\n case 'onUapActionStart':\n props.onUapActionStartAction?.(callback.metadata);\n break;\n case 'onUapActionEnd':\n props.onUapActionEndAction?.();\n break;\n }\n });\n\n // Clean up callbacks to prevent re-execution on subsequent re-renders.\n dispatch({ type: 'CLEAR_CALLBACKS' });\n }, [pendingCallbacks, props, dispatch]);\n}\n\n/**\n * Manages interaction states for drag handle components.\n *\n * The hook implements a state machine for drag handles that supports:\n * - Pointer-based drag-and-drop (DnD) interactions\n * - Keyboard-based universal access pattern (UAP) interactions\n * - State transitions with appropriate callbacks\n * - Metadata passing between states\n *\n * States:\n * - null: Idle state with no active interaction\n * - dnd-start: Initial pointer down, beginning of potential drag\n * - dnd-active: Active dragging with pointer movement\n * - dnd-end: Completed drag operation\n * - uap-action-start: Keyboard/accessibility action initiated\n * - uap-action-end: Keyboard/accessibility action completed\n */\nexport default function useDragHandleInteractionState<T = void>(\n props: UseDragHandleInteractionStateProps<T> = {},\n options = { debug: false }\n) {\n const propsRef = useRef<UseDragHandleInteractionStateProps<T>>(props);\n propsRef.current = props;\n\n const [interaction, dispatch] = useReducer(interactionReducer<T>, { value: null } as DragHandleInteractionState<T>);\n useStateLogger(interaction, options.debug);\n useCallbackHandler(interaction.transitionCallbacks, propsRef.current, dispatch);\n return {\n interaction,\n processPointerDown: (event: PointerEvent, metadata?: T) => {\n dispatch({\n type: 'POINTER_DOWN',\n payload: { nativeEvent: event, metadata },\n });\n },\n processPointerMove: (event: PointerEvent) => {\n dispatch({\n type: 'POINTER_MOVE',\n payload: { nativeEvent: event },\n });\n },\n processPointerUp: (event: PointerEvent) => {\n dispatch({\n type: 'POINTER_UP',\n payload: { nativeEvent: event },\n });\n },\n processPointerCancel: () => {\n dispatch({\n type: 'POINTER_CANCEL',\n });\n },\n processKeyDown: (event: React.KeyboardEvent<Element>, metadata?: T) => {\n const key = event.key;\n if (key === 'Enter' || key === 'Escape' || key === ' ') {\n dispatch({\n type: 'KEY_DOWN',\n payload: { key, metadata },\n });\n }\n },\n processFocus: () => {\n dispatch({ type: 'FOCUS' });\n },\n processBlur: () => {\n dispatch({ type: 'BLUR' });\n },\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (add1bdd9)";
3
- export var GIT_SHA = "add1bdd9";
2
+ export var PACKAGE_VERSION = "3.0.0 (a4a22ceb)";
3
+ export var GIT_SHA = "a4a22ceb";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "console";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (add1bdd9)",
4
- "GIT_SHA": "add1bdd9",
3
+ "PACKAGE_VERSION": "3.0.0 (a4a22ceb)",
4
+ "GIT_SHA": "a4a22ceb",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "console",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "add1bdd9dda20a7828337561c85ed457eaa73984"
2
+ "commit": "a4a22ceb200778c802b252804b3b5e55fad9659d"
3
3
  }
@@ -95,7 +95,7 @@ export default function ChartContainer(_a) {
95
95
  const xAxisProps = bottomAxisProps.axis === 'x' ? bottomAxisProps : leftAxisProps.axis === 'x' ? leftAxisProps : null;
96
96
  const yAxisProps = bottomAxisProps.axis === 'y' ? bottomAxisProps : leftAxisProps.axis === 'y' ? leftAxisProps : null;
97
97
  if (!xAxisProps || !yAxisProps) {
98
- throw new Error('Invariant violation: invalid axis props.');
98
+ throw new Error('Invariant violation: invalid chart axes.');
99
99
  }
100
100
  /**
101
101
  * Interactions
@@ -1 +1 @@
1
- {"version":3,"file":"chart-container.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/chart-container.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAC1E,OAAO,cAAc,EAAE,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,kBAAkB,MAAM,4DAA4D,CAAC;AAC5F,OAAO,gBAAgB,MAAM,0DAA0D,CAAC;AACxF,OAAO,iBAAiB,MAAM,4DAA4D,CAAC;AAE3F,OAAO,aAAa,MAAM,uDAAuD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AACxH,OAAO,iBAAiB,MAAM,4DAA4D,CAAC;AAC3F,OAAO,cAAc,MAAM,wDAAwD,CAAC;AACpF,OAAO,SAA2B,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAA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AAE,eAAe,EAC1B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,mBAAmB,GACxC,CACH;YAED,oBAAC,cAAc,oBACT,mBAAmB,IACvB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,eAAe,CAAC,KAAK,EAC5B,KAAK,EAAE,eAAe,CAAC,KAAK,EAC5B,mBAAmB,EAAE,eAAe,CAAC,mBAAmB,EACxD,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,sBAAsB,GAAG,uBAAuB,EAC5D,WAAW,EAAE,uBAAuB,EACpC,KAAK,EAAE,KAAK,IACZ,CACQ,EAEd,OAAO,EACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,kBAAkB,EAChC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,eAAe,EACzB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,gBAAgB,EAC3B,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,0BAA0B,EAClC,gBAAgB,EAAE,WAAW,CAAC,6BAA6B,EAC3D,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,qBAAqB,GACrC,GAEJ,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { getIsRtl, useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport BlockEndLabels, { useBLockEndLabels } from '../internal/components/cartesian-chart/block-end-labels';\nimport { CartesianChartContainer } from '../internal/components/cartesian-chart/chart-container';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport HighlightedPoint from '../internal/components/cartesian-chart/highlighted-point';\nimport InlineStartLabels from '../internal/components/cartesian-chart/inline-start-labels';\nimport { CartesianChartProps } from '../internal/components/cartesian-chart/interfaces';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { createXTicks, createYTicks, getXTickCount, getYTickCount } from '../internal/components/cartesian-chart/ticks';\nimport VerticalGridLines from '../internal/components/cartesian-chart/vertical-grid-lines';\nimport VerticalMarker from '../internal/components/cartesian-chart/vertical-marker';\nimport ChartPlot, { ChartPlotRef } from '../internal/components/chart-plot';\nimport { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport BarGroups from './bar-groups';\nimport MixedChartPopover from './chart-popover';\nimport DataSeries from './data-series';\nimport { computeDomainX, computeDomainY } from './domain';\nimport formatHighlighted from './format-highlighted';\nimport { useMouseHover } from './hooks/use-mouse-hover';\nimport { useNavigation } from './hooks/use-navigation';\nimport { usePopover } from './hooks/use-popover';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps, ScaleType, VerticalMarkerX } from './interfaces';\nimport makeScaledBarGroups, { ScaledBarGroup } from './make-scaled-bar-groups';\nimport makeScaledSeries, { ScaledPoint } from './make-scaled-series';\nimport { isXThreshold } from './utils';\n\nconst INLINE_START_LABELS_MARGIN = 16;\nconst BLOCK_END_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: ChartDataTypes) => string);\n\nexport interface ChartContainerProps<T extends ChartDataTypes> {\n series: ReadonlyArray<InternalChartSeries<T>>;\n visibleSeries: ReadonlyArray<InternalChartSeries<T>>;\n\n fitHeight?: boolean;\n hasFilters: boolean;\n height: number;\n detailPopoverSize: MixedLineBarChartProps<T>['detailPopoverSize'];\n detailPopoverFooter: MixedLineBarChartProps<T>['detailPopoverFooter'];\n\n xScaleType: ScaleType;\n yScaleType: 'linear' | 'log';\n\n xDomain: MixedLineBarChartProps<T>['xDomain'];\n yDomain: MixedLineBarChartProps<T>['yDomain'];\n\n xTickFormatter?: CartesianChartProps.TickFormatter<T>;\n yTickFormatter?: CartesianChartProps.TickFormatter<number>;\n\n xTitle?: string;\n yTitle?: string;\n\n stackedBars?: boolean;\n emphasizeBaselineAxis: boolean;\n horizontalBars?: boolean;\n\n highlightedSeries?: MixedLineBarChartProps<T>['highlightedSeries'];\n onHighlightChange: (series: InternalChartSeries<T>['series'] | null) => void;\n highlightedPoint: ScaledPoint<T> | null;\n setHighlightedPoint: (point: ScaledPoint<T> | null) => void;\n highlightedGroupIndex: number | null;\n setHighlightedGroupIndex: (groupIndex: number | null) => void;\n\n ariaLabel: MixedLineBarChartProps<T>['ariaLabel'];\n ariaLabelledby: MixedLineBarChartProps<T>['ariaLabelledby'];\n ariaDescription: MixedLineBarChartProps<T>['ariaDescription'];\n i18nStrings: MixedLineBarChartProps<T>['i18nStrings'];\n\n detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent<T>;\n}\n\ninterface BaseAxisProps {\n tickCount: number;\n tickFormatter: TickFormatter;\n title?: string;\n ariaRoleDescription?: string;\n}\n\ninterface XAxisProps extends BaseAxisProps {\n axis: 'x';\n scale: ChartScale;\n ticks: ChartDataTypes[];\n}\n\ninterface YAxisProps extends BaseAxisProps {\n axis: 'y';\n scale: NumericChartScale;\n ticks: number[];\n}\n\nconst fallbackContainerWidth = 500;\n\nexport default function ChartContainer<T extends ChartDataTypes>({\n fitHeight,\n hasFilters,\n height: explicitPlotHeight,\n series,\n visibleSeries,\n highlightedSeries,\n onHighlightChange,\n highlightedPoint,\n setHighlightedPoint,\n highlightedGroupIndex,\n setHighlightedGroupIndex,\n detailPopoverFooter,\n detailPopoverSize = 'medium',\n stackedBars = false,\n horizontalBars = false,\n xScaleType,\n yScaleType,\n xTickFormatter,\n yTickFormatter,\n emphasizeBaselineAxis,\n xTitle,\n yTitle,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings = {},\n detailPopoverSeriesContent,\n ...props\n}: ChartContainerProps<T>) {\n const plotRef = useRef<ChartPlotRef>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const [inlineStartLabelsWidth, setInlineStartLabelsWidth] = useState(0);\n const [verticalMarkerX, setVerticalMarkerX] = useState<VerticalMarkerX<T> | null>(null);\n const [detailsPopoverText, setDetailsPopoverText] = useState('');\n const [containerWidth, containerMeasureRef] = useContainerWidth(fallbackContainerWidth);\n const maxInlineStartLabelsWidth = Math.round(containerWidth / 2);\n const plotWidth = containerWidth\n ? // Calculate the minimum between inlineStartLabelsWidth and maxInlineStartLabelsWidth for extra safety because inlineStarteLabelsWidth could be out of date\n Math.max(\n 0,\n containerWidth - Math.min(inlineStartLabelsWidth, maxInlineStartLabelsWidth) - INLINE_START_LABELS_MARGIN\n )\n : fallbackContainerWidth;\n const containerRefObject = useRef(null);\n const containerRef = useMergeRefs(containerMeasureRef, containerRefObject);\n const popoverRef = useRef<HTMLElement | null>(null);\n\n const isRtl = getIsRtl(containerRefObject.current);\n\n const xDomain = (props.xDomain || computeDomainX(series, xScaleType)) as\n | readonly number[]\n | readonly string[]\n | readonly Date[];\n const yDomain = (props.yDomain || computeDomainY(series, yScaleType, stackedBars)) as readonly number[];\n\n const linesOnly = series.every(({ series }) => series.type === 'line' || series.type === 'threshold');\n\n function getXAxisProps(size: number, range: [from: number, until: number]): XAxisProps {\n const tickCount = getXTickCount(size);\n const scale = new ChartScale(xScaleType, xDomain, range, linesOnly);\n const ticks = createXTicks(scale, tickCount);\n return {\n axis: 'x',\n tickCount,\n scale,\n ticks,\n tickFormatter: xTickFormatter as TickFormatter,\n title: xTitle,\n ariaRoleDescription: i18nStrings.xAxisAriaRoleDescription,\n };\n }\n\n function getYAxisProps(size: number, range: [from: number, until: number]): YAxisProps {\n const tickCount = getYTickCount(size);\n const scale = new NumericChartScale(yScaleType, yDomain, range, props.yDomain ? null : tickCount);\n const ticks = createYTicks(scale, tickCount);\n return {\n axis: 'y',\n tickCount,\n scale,\n ticks,\n tickFormatter: yTickFormatter as TickFormatter,\n title: yTitle,\n ariaRoleDescription: i18nStrings.yAxisAriaRoleDescription,\n };\n }\n\n const bottomAxisProps = !horizontalBars\n ? getXAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0])\n : getYAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0]);\n const blockEndLabelsProps = useBLockEndLabels({ ...bottomAxisProps });\n\n const plotMeasureRef = useRef<SVGLineElement>(null);\n const measuredHeight = useHeightMeasure(() => plotMeasureRef.current, !fitHeight);\n const plotHeight = fitHeight ? (measuredHeight ?? 0) : explicitPlotHeight;\n\n const leftAxisProps = !horizontalBars\n ? getYAxisProps(plotHeight, [plotHeight, 0])\n : getXAxisProps(plotHeight, [0, plotHeight]);\n\n const xAxisProps = bottomAxisProps.axis === 'x' ? bottomAxisProps : leftAxisProps.axis === 'x' ? leftAxisProps : null;\n const yAxisProps = bottomAxisProps.axis === 'y' ? bottomAxisProps : leftAxisProps.axis === 'y' ? leftAxisProps : null;\n if (!xAxisProps || !yAxisProps) {\n throw new Error('Invariant violation: invalid axis props.');\n }\n\n /**\n * Interactions\n */\n const highlightedPointRef = useRef<SVGGElement>(null);\n const highlightedGroupRef = useRef<SVGRectElement>(null);\n\n // Some chart components are rendered against \"x\" or \"y\" axes,\n // When \"horizontalBars\" is enabled, the axes are inverted.\n const x = !horizontalBars ? 'x' : 'y';\n const y = !horizontalBars ? 'y' : 'x';\n\n const scaledSeries = makeScaledSeries(visibleSeries, xAxisProps.scale, yAxisProps.scale);\n const barGroups: ScaledBarGroup<T>[] = makeScaledBarGroups(visibleSeries, xAxisProps.scale, plotWidth, plotHeight, y);\n\n const { isPopoverOpen, isPopoverPinned, showPopover, pinPopover, hidePopover, dismissPopover } = usePopover();\n\n // Allows to add a delay between popover is dismissed and handlers are enabled to prevent immediate popover reopening.\n const [isHandlersDisabled, setHandlersDisabled] = useState(false);\n useEffect(() => {\n if (isPopoverPinned) {\n setHandlersDisabled(true);\n } else {\n const timeoutId = setTimeout(() => setHandlersDisabled(false), 25);\n return () => clearTimeout(timeoutId);\n }\n }, [isPopoverPinned]);\n\n const highlightSeries = useCallback(\n (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n if (series !== highlightedSeries) {\n onHighlightChange(series);\n }\n },\n [highlightedSeries, onHighlightChange]\n );\n\n const highlightPoint = useCallback(\n (point: ScaledPoint<T> | null) => {\n setHighlightedGroupIndex(null);\n setHighlightedPoint(point);\n if (point) {\n highlightSeries(point.series);\n setVerticalMarkerX({ scaledX: point.x, label: point.datum?.x ?? null });\n showPopover();\n }\n },\n [setHighlightedGroupIndex, setHighlightedPoint, highlightSeries, showPopover]\n );\n\n const clearAllHighlights = useCallback(() => {\n setHighlightedPoint(null);\n highlightSeries(null);\n setHighlightedGroupIndex(null);\n }, [highlightSeries, setHighlightedGroupIndex, setHighlightedPoint]);\n\n // Highlight all points at a given X in a line chart\n const highlightX = useCallback(\n (marker: VerticalMarkerX<T> | null) => {\n if (marker) {\n clearAllHighlights();\n }\n setVerticalMarkerX(marker);\n showPopover();\n },\n [clearAllHighlights, showPopover]\n );\n\n // Highlight all points and bars at a given X index in a mixed line and bar chart\n const highlightGroup = useCallback(\n (groupIndex: number) => {\n highlightSeries(null);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(groupIndex);\n showPopover();\n },\n [highlightSeries, setHighlightedPoint, setHighlightedGroupIndex, showPopover]\n );\n\n const clearHighlightedSeries = useCallback(() => {\n clearAllHighlights();\n hidePopover();\n }, [hidePopover, clearAllHighlights]);\n\n const { isGroupNavigation, ...handlers } = useNavigation({\n series,\n visibleSeries,\n scaledSeries,\n barGroups,\n xScale: xAxisProps.scale,\n yScale: yAxisProps.scale,\n highlightedPoint,\n highlightedGroupIndex,\n highlightedSeries,\n isHandlersDisabled,\n pinPopover,\n highlightSeries,\n highlightGroup,\n highlightPoint,\n highlightX,\n clearHighlightedSeries,\n verticalMarkerX,\n isRtl: !!isRtl,\n horizontalBars,\n });\n\n const { onSVGMouseMove, onSVGMouseOut, onPopoverLeave } = useMouseHover<T>({\n scaledSeries,\n barGroups,\n plotRef,\n popoverRef,\n highlightPoint,\n highlightGroup,\n clearHighlightedSeries,\n isGroupNavigation,\n isHandlersDisabled,\n highlightX,\n });\n\n // There are multiple ways to indicate what X is selected.\n // TODO: make a uniform verticalMarkerX state to fit all use-cases.\n const highlightedX = useMemo(() => {\n if (highlightedGroupIndex !== null) {\n return barGroups[highlightedGroupIndex]?.x;\n }\n if (verticalMarkerX !== null) {\n return verticalMarkerX.label;\n }\n return highlightedPoint?.datum?.x ?? null;\n }, [highlightedPoint, verticalMarkerX, highlightedGroupIndex, barGroups]);\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n dismissPopover();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [dismissPopover]);\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n dismissPopover();\n\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n const isSomeElementHighlighted = !!(highlightedPoint || highlightedGroupIndex !== null || verticalMarkerX);\n if (isSomeElementHighlighted) {\n plotRef.current?.focusApplication();\n } else {\n plotRef.current?.focusPlot();\n }\n }, 0);\n } else {\n clearAllHighlights();\n setVerticalMarkerX(null);\n }\n };\n\n const onSVGClick = (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => {\n if (isPopoverOpen) {\n if (isPopoverPinned) {\n dismissPopover();\n } else {\n pinPopover();\n e.preventDefault();\n }\n } else {\n showPopover();\n }\n };\n\n const onApplicationFocus = (event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n if (trigger === 'keyboard') {\n handlers.onFocus();\n } else {\n // noop: clicks are handled separately\n }\n };\n\n const onApplicationBlur = (event: React.FocusEvent<Element>) => {\n const blurTarget = event.relatedTarget || event.target;\n if (\n blurTarget === null ||\n !(blurTarget instanceof Element) ||\n !nodeBelongs(containerRefObject.current, blurTarget)\n ) {\n clearHighlightedSeries();\n setVerticalMarkerX(null);\n\n if (isPopoverOpen && !isPopoverPinned) {\n dismissPopover();\n }\n }\n };\n\n const onSVGKeyDown = handlers.onKeyDown;\n\n const xOffset = xAxisProps.scale.isCategorical() ? Math.max(0, xAxisProps.scale.d3Scale.bandwidth() - 1) / 2 : 0;\n\n let verticalLineX: number | null = null;\n if (verticalMarkerX !== null) {\n verticalLineX = verticalMarkerX.scaledX;\n } else if (isGroupNavigation && highlightedGroupIndex !== null) {\n const x = xAxisProps.scale.d3Scale(barGroups[highlightedGroupIndex]?.x as any) ?? null;\n if (x !== null) {\n verticalLineX = xOffset + x;\n }\n }\n\n const point = useMemo(\n () =>\n highlightedPoint\n ? {\n key: `${highlightedPoint.x}-${highlightedPoint.y}`,\n x: highlightedPoint.x,\n y: highlightedPoint.y,\n color: highlightedPoint.color,\n }\n : null,\n [highlightedPoint]\n );\n\n const verticalMarkers = useMemo(\n () =>\n verticalLineX !== null\n ? scaledSeries\n .filter(({ x, y }) => (x === verticalLineX || isNaN(x)) && !isNaN(y))\n .map(({ x, y, color }, index) => ({\n key: `${index}-${x}-${y}`,\n x: !horizontalBars ? verticalLineX || 0 : y,\n y: !horizontalBars ? y : verticalLineX || 0,\n color: color,\n }))\n : [],\n [scaledSeries, verticalLineX, horizontalBars]\n );\n\n const highlightedElementRef = isGroupNavigation\n ? highlightedGroupRef\n : highlightedPoint\n ? highlightedPointRef\n : verticalMarkerRef;\n\n const highlightDetails = useMemo(() => {\n if (highlightedX === null) {\n return null;\n }\n\n // When series point is highlighted show the corresponding series and matching x-thresholds.\n if (highlightedPoint) {\n const seriesToShow = visibleSeries.filter(\n series => series.series === highlightedPoint?.series || isXThreshold(series.series)\n );\n return formatHighlighted({\n position: highlightedX,\n series: seriesToShow,\n xTickFormatter,\n detailPopoverSeriesContent,\n });\n }\n\n // Otherwise - show all visible series details.\n return formatHighlighted({\n position: highlightedX,\n series: visibleSeries,\n xTickFormatter,\n detailPopoverSeriesContent,\n });\n }, [highlightedX, highlightedPoint, visibleSeries, xTickFormatter, detailPopoverSeriesContent]);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedX ? detailPopoverFooter(highlightedX) : null),\n [detailPopoverFooter, highlightedX]\n );\n\n const activeAriaLabel =\n highlightDetails && detailsPopoverText ? `${highlightDetails.position}, ${detailsPopoverText}` : '';\n\n // Live region is used when nothing is focused e.g. when hovering.\n const activeLiveRegion =\n activeAriaLabel && !highlightedPoint && highlightedGroupIndex === null ? activeAriaLabel : '';\n\n const isLineXKeyboardFocused = !highlightedPoint && verticalMarkerX;\n\n const isRefresh = useVisualRefresh();\n\n return (\n <CartesianChartContainer\n ref={containerRef}\n minHeight={explicitPlotHeight + blockEndLabelsProps.height}\n fitHeight={!!fitHeight}\n hasFilters={hasFilters}\n leftAxisLabel={<AxisLabel axis={y} position=\"left\" title={leftAxisProps.title} />}\n leftAxisLabelMeasure={\n <LabelsMeasure\n ticks={leftAxisProps.ticks}\n scale={leftAxisProps.scale}\n tickFormatter={leftAxisProps.tickFormatter as TickFormatter}\n autoWidth={setInlineStartLabelsWidth}\n maxLabelsWidth={maxInlineStartLabelsWidth}\n />\n }\n bottomAxisLabel={<AxisLabel axis={x} position=\"bottom\" title={bottomAxisProps.title} />}\n chartPlot={\n <ChartPlot\n ref={plotRef}\n width=\"100%\"\n height={fitHeight ? `calc(100% - ${blockEndLabelsProps.height}px)` : plotHeight}\n offsetBottom={blockEndLabelsProps.height}\n isClickable={isPopoverOpen && !isPopoverPinned}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={i18nStrings?.chartAriaRoleDescription}\n ariaLiveRegion={activeLiveRegion}\n activeElementRef={highlightedElementRef}\n activeElementKey={activeAriaLabel}\n activeElementFocusOffset={isGroupNavigation ? 0 : isLineXKeyboardFocused ? { x: 8, y: 0 } : 3}\n onMouseMove={onSVGMouseMove}\n onMouseOut={onSVGMouseOut}\n onClick={onSVGClick}\n onApplicationFocus={onApplicationFocus}\n onApplicationBlur={onApplicationBlur}\n onKeyDown={onSVGKeyDown}\n >\n <line\n ref={plotMeasureRef}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"100%\"\n stroke=\"transparent\"\n strokeWidth={1}\n style={{ pointerEvents: 'none' }}\n />\n\n <InlineStartLabels\n axis={y}\n ticks={leftAxisProps.ticks}\n scale={leftAxisProps.scale}\n tickFormatter={leftAxisProps.tickFormatter as TickFormatter}\n title={leftAxisProps.title}\n ariaRoleDescription={leftAxisProps.ariaRoleDescription}\n maxLabelsWidth={maxInlineStartLabelsWidth}\n plotWidth={plotWidth}\n plotHeight={plotHeight}\n />\n\n {horizontalBars && (\n <VerticalGridLines scale={yAxisProps.scale} ticks={yAxisProps.ticks} height={plotHeight} />\n )}\n\n {emphasizeBaselineAxis && linesOnly && (\n <EmphasizedBaseline axis={x} scale={yAxisProps.scale} width={plotWidth} height={plotHeight} />\n )}\n\n <DataSeries\n axis={x}\n plotWidth={plotWidth}\n plotHeight={plotHeight}\n highlightedSeries={highlightedSeries ?? null}\n highlightedGroupIndex={highlightedGroupIndex}\n stackedBars={stackedBars}\n isGroupNavigation={isGroupNavigation}\n visibleSeries={visibleSeries}\n xScale={xAxisProps.scale}\n yScale={yAxisProps.scale}\n isRtl={!!isRtl}\n />\n\n {emphasizeBaselineAxis && !linesOnly && (\n <EmphasizedBaseline axis={x} scale={yAxisProps.scale} width={plotWidth} height={plotHeight} />\n )}\n\n <VerticalMarker\n key={verticalLineX || ''}\n height={plotHeight}\n showPoints={highlightedPoint === null}\n showLine={!isGroupNavigation}\n points={verticalMarkers}\n ref={verticalMarkerRef}\n />\n\n {highlightedPoint && (\n <HighlightedPoint\n ref={highlightedPointRef}\n point={point}\n role=\"button\"\n ariaLabel={activeAriaLabel}\n ariaHasPopup={true}\n ariaExpanded={isPopoverPinned}\n />\n )}\n\n {isGroupNavigation && xAxisProps.scale.isCategorical() && (\n <BarGroups\n ariaLabel={activeAriaLabel}\n isRefresh={isRefresh}\n isPopoverPinned={isPopoverPinned}\n barGroups={barGroups}\n highlightedGroupIndex={highlightedGroupIndex}\n highlightedGroupRef={highlightedGroupRef}\n />\n )}\n\n <BlockEndLabels\n {...blockEndLabelsProps}\n axis={x}\n scale={bottomAxisProps.scale}\n title={bottomAxisProps.title}\n ariaRoleDescription={bottomAxisProps.ariaRoleDescription}\n height={plotHeight}\n width={plotWidth}\n offsetLeft={inlineStartLabelsWidth + BLOCK_END_LABELS_OFFSET}\n offsetRight={BLOCK_END_LABELS_OFFSET}\n isRTL={isRtl}\n />\n </ChartPlot>\n }\n popover={\n <MixedChartPopover\n ref={popoverRef}\n containerRef={containerRefObject}\n trackRef={highlightedElementRef}\n isOpen={isPopoverOpen}\n isPinned={isPopoverPinned}\n highlightDetails={highlightDetails}\n onDismiss={onPopoverDismiss}\n size={detailPopoverSize}\n footer={detailPopoverFooterContent}\n dismissAriaLabel={i18nStrings.detailPopoverDismissAriaLabel}\n onMouseLeave={onPopoverLeave}\n onBlur={onApplicationBlur}\n setPopoverText={setDetailsPopoverText}\n />\n }\n />\n );\n}\n"]}
1
+ {"version":3,"file":"chart-container.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/chart-container.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,SAAS,MA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,aAAa,EACrB,QAAQ,EAAE,eAAe,EACzB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,gBAAgB,EAC3B,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,0BAA0B,EAClC,gBAAgB,EAAE,WAAW,CAAC,6BAA6B,EAC3D,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,qBAAqB,GACrC,GAEJ,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { getIsRtl, useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport BlockEndLabels, { useBLockEndLabels } from '../internal/components/cartesian-chart/block-end-labels';\nimport { CartesianChartContainer } from '../internal/components/cartesian-chart/chart-container';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport HighlightedPoint from '../internal/components/cartesian-chart/highlighted-point';\nimport InlineStartLabels from '../internal/components/cartesian-chart/inline-start-labels';\nimport { CartesianChartProps } from '../internal/components/cartesian-chart/interfaces';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { createXTicks, createYTicks, getXTickCount, getYTickCount } from '../internal/components/cartesian-chart/ticks';\nimport VerticalGridLines from '../internal/components/cartesian-chart/vertical-grid-lines';\nimport VerticalMarker from '../internal/components/cartesian-chart/vertical-marker';\nimport ChartPlot, { ChartPlotRef } from '../internal/components/chart-plot';\nimport { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport BarGroups from './bar-groups';\nimport MixedChartPopover from './chart-popover';\nimport DataSeries from './data-series';\nimport { computeDomainX, computeDomainY } from './domain';\nimport formatHighlighted from './format-highlighted';\nimport { useMouseHover } from './hooks/use-mouse-hover';\nimport { useNavigation } from './hooks/use-navigation';\nimport { usePopover } from './hooks/use-popover';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps, ScaleType, VerticalMarkerX } from './interfaces';\nimport makeScaledBarGroups, { ScaledBarGroup } from './make-scaled-bar-groups';\nimport makeScaledSeries, { ScaledPoint } from './make-scaled-series';\nimport { isXThreshold } from './utils';\n\nconst INLINE_START_LABELS_MARGIN = 16;\nconst BLOCK_END_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: ChartDataTypes) => string);\n\nexport interface ChartContainerProps<T extends ChartDataTypes> {\n series: ReadonlyArray<InternalChartSeries<T>>;\n visibleSeries: ReadonlyArray<InternalChartSeries<T>>;\n\n fitHeight?: boolean;\n hasFilters: boolean;\n height: number;\n detailPopoverSize: MixedLineBarChartProps<T>['detailPopoverSize'];\n detailPopoverFooter: MixedLineBarChartProps<T>['detailPopoverFooter'];\n\n xScaleType: ScaleType;\n yScaleType: 'linear' | 'log';\n\n xDomain: MixedLineBarChartProps<T>['xDomain'];\n yDomain: MixedLineBarChartProps<T>['yDomain'];\n\n xTickFormatter?: CartesianChartProps.TickFormatter<T>;\n yTickFormatter?: CartesianChartProps.TickFormatter<number>;\n\n xTitle?: string;\n yTitle?: string;\n\n stackedBars?: boolean;\n emphasizeBaselineAxis: boolean;\n horizontalBars?: boolean;\n\n highlightedSeries?: MixedLineBarChartProps<T>['highlightedSeries'];\n onHighlightChange: (series: InternalChartSeries<T>['series'] | null) => void;\n highlightedPoint: ScaledPoint<T> | null;\n setHighlightedPoint: (point: ScaledPoint<T> | null) => void;\n highlightedGroupIndex: number | null;\n setHighlightedGroupIndex: (groupIndex: number | null) => void;\n\n ariaLabel: MixedLineBarChartProps<T>['ariaLabel'];\n ariaLabelledby: MixedLineBarChartProps<T>['ariaLabelledby'];\n ariaDescription: MixedLineBarChartProps<T>['ariaDescription'];\n i18nStrings: MixedLineBarChartProps<T>['i18nStrings'];\n\n detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent<T>;\n}\n\ninterface BaseAxisProps {\n tickCount: number;\n tickFormatter: TickFormatter;\n title?: string;\n ariaRoleDescription?: string;\n}\n\ninterface XAxisProps extends BaseAxisProps {\n axis: 'x';\n scale: ChartScale;\n ticks: ChartDataTypes[];\n}\n\ninterface YAxisProps extends BaseAxisProps {\n axis: 'y';\n scale: NumericChartScale;\n ticks: number[];\n}\n\nconst fallbackContainerWidth = 500;\n\nexport default function ChartContainer<T extends ChartDataTypes>({\n fitHeight,\n hasFilters,\n height: explicitPlotHeight,\n series,\n visibleSeries,\n highlightedSeries,\n onHighlightChange,\n highlightedPoint,\n setHighlightedPoint,\n highlightedGroupIndex,\n setHighlightedGroupIndex,\n detailPopoverFooter,\n detailPopoverSize = 'medium',\n stackedBars = false,\n horizontalBars = false,\n xScaleType,\n yScaleType,\n xTickFormatter,\n yTickFormatter,\n emphasizeBaselineAxis,\n xTitle,\n yTitle,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings = {},\n detailPopoverSeriesContent,\n ...props\n}: ChartContainerProps<T>) {\n const plotRef = useRef<ChartPlotRef>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const [inlineStartLabelsWidth, setInlineStartLabelsWidth] = useState(0);\n const [verticalMarkerX, setVerticalMarkerX] = useState<VerticalMarkerX<T> | null>(null);\n const [detailsPopoverText, setDetailsPopoverText] = useState('');\n const [containerWidth, containerMeasureRef] = useContainerWidth(fallbackContainerWidth);\n const maxInlineStartLabelsWidth = Math.round(containerWidth / 2);\n const plotWidth = containerWidth\n ? // Calculate the minimum between inlineStartLabelsWidth and maxInlineStartLabelsWidth for extra safety because inlineStarteLabelsWidth could be out of date\n Math.max(\n 0,\n containerWidth - Math.min(inlineStartLabelsWidth, maxInlineStartLabelsWidth) - INLINE_START_LABELS_MARGIN\n )\n : fallbackContainerWidth;\n const containerRefObject = useRef(null);\n const containerRef = useMergeRefs(containerMeasureRef, containerRefObject);\n const popoverRef = useRef<HTMLElement | null>(null);\n\n const isRtl = getIsRtl(containerRefObject.current);\n\n const xDomain = (props.xDomain || computeDomainX(series, xScaleType)) as\n | readonly number[]\n | readonly string[]\n | readonly Date[];\n const yDomain = (props.yDomain || computeDomainY(series, yScaleType, stackedBars)) as readonly number[];\n\n const linesOnly = series.every(({ series }) => series.type === 'line' || series.type === 'threshold');\n\n function getXAxisProps(size: number, range: [from: number, until: number]): XAxisProps {\n const tickCount = getXTickCount(size);\n const scale = new ChartScale(xScaleType, xDomain, range, linesOnly);\n const ticks = createXTicks(scale, tickCount);\n return {\n axis: 'x',\n tickCount,\n scale,\n ticks,\n tickFormatter: xTickFormatter as TickFormatter,\n title: xTitle,\n ariaRoleDescription: i18nStrings.xAxisAriaRoleDescription,\n };\n }\n\n function getYAxisProps(size: number, range: [from: number, until: number]): YAxisProps {\n const tickCount = getYTickCount(size);\n const scale = new NumericChartScale(yScaleType, yDomain, range, props.yDomain ? null : tickCount);\n const ticks = createYTicks(scale, tickCount);\n return {\n axis: 'y',\n tickCount,\n scale,\n ticks,\n tickFormatter: yTickFormatter as TickFormatter,\n title: yTitle,\n ariaRoleDescription: i18nStrings.yAxisAriaRoleDescription,\n };\n }\n\n const bottomAxisProps = !horizontalBars\n ? getXAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0])\n : getYAxisProps(plotWidth, !isRtl ? [0, plotWidth] : [plotWidth, 0]);\n const blockEndLabelsProps = useBLockEndLabels({ ...bottomAxisProps });\n\n const plotMeasureRef = useRef<SVGLineElement>(null);\n const measuredHeight = useHeightMeasure(() => plotMeasureRef.current, !fitHeight);\n const plotHeight = fitHeight ? (measuredHeight ?? 0) : explicitPlotHeight;\n\n const leftAxisProps = !horizontalBars\n ? getYAxisProps(plotHeight, [plotHeight, 0])\n : getXAxisProps(plotHeight, [0, plotHeight]);\n\n const xAxisProps = bottomAxisProps.axis === 'x' ? bottomAxisProps : leftAxisProps.axis === 'x' ? leftAxisProps : null;\n const yAxisProps = bottomAxisProps.axis === 'y' ? bottomAxisProps : leftAxisProps.axis === 'y' ? leftAxisProps : null;\n if (!xAxisProps || !yAxisProps) {\n throw new Error('Invariant violation: invalid chart axes.');\n }\n\n /**\n * Interactions\n */\n const highlightedPointRef = useRef<SVGGElement>(null);\n const highlightedGroupRef = useRef<SVGRectElement>(null);\n\n // Some chart components are rendered against \"x\" or \"y\" axes,\n // When \"horizontalBars\" is enabled, the axes are inverted.\n const x = !horizontalBars ? 'x' : 'y';\n const y = !horizontalBars ? 'y' : 'x';\n\n const scaledSeries = makeScaledSeries(visibleSeries, xAxisProps.scale, yAxisProps.scale);\n const barGroups: ScaledBarGroup<T>[] = makeScaledBarGroups(visibleSeries, xAxisProps.scale, plotWidth, plotHeight, y);\n\n const { isPopoverOpen, isPopoverPinned, showPopover, pinPopover, hidePopover, dismissPopover } = usePopover();\n\n // Allows to add a delay between popover is dismissed and handlers are enabled to prevent immediate popover reopening.\n const [isHandlersDisabled, setHandlersDisabled] = useState(false);\n useEffect(() => {\n if (isPopoverPinned) {\n setHandlersDisabled(true);\n } else {\n const timeoutId = setTimeout(() => setHandlersDisabled(false), 25);\n return () => clearTimeout(timeoutId);\n }\n }, [isPopoverPinned]);\n\n const highlightSeries = useCallback(\n (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n if (series !== highlightedSeries) {\n onHighlightChange(series);\n }\n },\n [highlightedSeries, onHighlightChange]\n );\n\n const highlightPoint = useCallback(\n (point: ScaledPoint<T> | null) => {\n setHighlightedGroupIndex(null);\n setHighlightedPoint(point);\n if (point) {\n highlightSeries(point.series);\n setVerticalMarkerX({ scaledX: point.x, label: point.datum?.x ?? null });\n showPopover();\n }\n },\n [setHighlightedGroupIndex, setHighlightedPoint, highlightSeries, showPopover]\n );\n\n const clearAllHighlights = useCallback(() => {\n setHighlightedPoint(null);\n highlightSeries(null);\n setHighlightedGroupIndex(null);\n }, [highlightSeries, setHighlightedGroupIndex, setHighlightedPoint]);\n\n // Highlight all points at a given X in a line chart\n const highlightX = useCallback(\n (marker: VerticalMarkerX<T> | null) => {\n if (marker) {\n clearAllHighlights();\n }\n setVerticalMarkerX(marker);\n showPopover();\n },\n [clearAllHighlights, showPopover]\n );\n\n // Highlight all points and bars at a given X index in a mixed line and bar chart\n const highlightGroup = useCallback(\n (groupIndex: number) => {\n highlightSeries(null);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(groupIndex);\n showPopover();\n },\n [highlightSeries, setHighlightedPoint, setHighlightedGroupIndex, showPopover]\n );\n\n const clearHighlightedSeries = useCallback(() => {\n clearAllHighlights();\n hidePopover();\n }, [hidePopover, clearAllHighlights]);\n\n const { isGroupNavigation, ...handlers } = useNavigation({\n series,\n visibleSeries,\n scaledSeries,\n barGroups,\n xScale: xAxisProps.scale,\n yScale: yAxisProps.scale,\n highlightedPoint,\n highlightedGroupIndex,\n highlightedSeries,\n isHandlersDisabled,\n pinPopover,\n highlightSeries,\n highlightGroup,\n highlightPoint,\n highlightX,\n clearHighlightedSeries,\n verticalMarkerX,\n isRtl: !!isRtl,\n horizontalBars,\n });\n\n const { onSVGMouseMove, onSVGMouseOut, onPopoverLeave } = useMouseHover<T>({\n scaledSeries,\n barGroups,\n plotRef,\n popoverRef,\n highlightPoint,\n highlightGroup,\n clearHighlightedSeries,\n isGroupNavigation,\n isHandlersDisabled,\n highlightX,\n });\n\n // There are multiple ways to indicate what X is selected.\n // TODO: make a uniform verticalMarkerX state to fit all use-cases.\n const highlightedX = useMemo(() => {\n if (highlightedGroupIndex !== null) {\n return barGroups[highlightedGroupIndex]?.x;\n }\n if (verticalMarkerX !== null) {\n return verticalMarkerX.label;\n }\n return highlightedPoint?.datum?.x ?? null;\n }, [highlightedPoint, verticalMarkerX, highlightedGroupIndex, barGroups]);\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n dismissPopover();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [dismissPopover]);\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n dismissPopover();\n\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n const isSomeElementHighlighted = !!(highlightedPoint || highlightedGroupIndex !== null || verticalMarkerX);\n if (isSomeElementHighlighted) {\n plotRef.current?.focusApplication();\n } else {\n plotRef.current?.focusPlot();\n }\n }, 0);\n } else {\n clearAllHighlights();\n setVerticalMarkerX(null);\n }\n };\n\n const onSVGClick = (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => {\n if (isPopoverOpen) {\n if (isPopoverPinned) {\n dismissPopover();\n } else {\n pinPopover();\n e.preventDefault();\n }\n } else {\n showPopover();\n }\n };\n\n const onApplicationFocus = (event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n if (trigger === 'keyboard') {\n handlers.onFocus();\n } else {\n // noop: clicks are handled separately\n }\n };\n\n const onApplicationBlur = (event: React.FocusEvent<Element>) => {\n const blurTarget = event.relatedTarget || event.target;\n if (\n blurTarget === null ||\n !(blurTarget instanceof Element) ||\n !nodeBelongs(containerRefObject.current, blurTarget)\n ) {\n clearHighlightedSeries();\n setVerticalMarkerX(null);\n\n if (isPopoverOpen && !isPopoverPinned) {\n dismissPopover();\n }\n }\n };\n\n const onSVGKeyDown = handlers.onKeyDown;\n\n const xOffset = xAxisProps.scale.isCategorical() ? Math.max(0, xAxisProps.scale.d3Scale.bandwidth() - 1) / 2 : 0;\n\n let verticalLineX: number | null = null;\n if (verticalMarkerX !== null) {\n verticalLineX = verticalMarkerX.scaledX;\n } else if (isGroupNavigation && highlightedGroupIndex !== null) {\n const x = xAxisProps.scale.d3Scale(barGroups[highlightedGroupIndex]?.x as any) ?? null;\n if (x !== null) {\n verticalLineX = xOffset + x;\n }\n }\n\n const point = useMemo(\n () =>\n highlightedPoint\n ? {\n key: `${highlightedPoint.x}-${highlightedPoint.y}`,\n x: highlightedPoint.x,\n y: highlightedPoint.y,\n color: highlightedPoint.color,\n }\n : null,\n [highlightedPoint]\n );\n\n const verticalMarkers = useMemo(\n () =>\n verticalLineX !== null\n ? scaledSeries\n .filter(({ x, y }) => (x === verticalLineX || isNaN(x)) && !isNaN(y))\n .map(({ x, y, color }, index) => ({\n key: `${index}-${x}-${y}`,\n x: !horizontalBars ? verticalLineX || 0 : y,\n y: !horizontalBars ? y : verticalLineX || 0,\n color: color,\n }))\n : [],\n [scaledSeries, verticalLineX, horizontalBars]\n );\n\n const highlightedElementRef = isGroupNavigation\n ? highlightedGroupRef\n : highlightedPoint\n ? highlightedPointRef\n : verticalMarkerRef;\n\n const highlightDetails = useMemo(() => {\n if (highlightedX === null) {\n return null;\n }\n\n // When series point is highlighted show the corresponding series and matching x-thresholds.\n if (highlightedPoint) {\n const seriesToShow = visibleSeries.filter(\n series => series.series === highlightedPoint?.series || isXThreshold(series.series)\n );\n return formatHighlighted({\n position: highlightedX,\n series: seriesToShow,\n xTickFormatter,\n detailPopoverSeriesContent,\n });\n }\n\n // Otherwise - show all visible series details.\n return formatHighlighted({\n position: highlightedX,\n series: visibleSeries,\n xTickFormatter,\n detailPopoverSeriesContent,\n });\n }, [highlightedX, highlightedPoint, visibleSeries, xTickFormatter, detailPopoverSeriesContent]);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedX ? detailPopoverFooter(highlightedX) : null),\n [detailPopoverFooter, highlightedX]\n );\n\n const activeAriaLabel =\n highlightDetails && detailsPopoverText ? `${highlightDetails.position}, ${detailsPopoverText}` : '';\n\n // Live region is used when nothing is focused e.g. when hovering.\n const activeLiveRegion =\n activeAriaLabel && !highlightedPoint && highlightedGroupIndex === null ? activeAriaLabel : '';\n\n const isLineXKeyboardFocused = !highlightedPoint && verticalMarkerX;\n\n const isRefresh = useVisualRefresh();\n\n return (\n <CartesianChartContainer\n ref={containerRef}\n minHeight={explicitPlotHeight + blockEndLabelsProps.height}\n fitHeight={!!fitHeight}\n hasFilters={hasFilters}\n leftAxisLabel={<AxisLabel axis={y} position=\"left\" title={leftAxisProps.title} />}\n leftAxisLabelMeasure={\n <LabelsMeasure\n ticks={leftAxisProps.ticks}\n scale={leftAxisProps.scale}\n tickFormatter={leftAxisProps.tickFormatter as TickFormatter}\n autoWidth={setInlineStartLabelsWidth}\n maxLabelsWidth={maxInlineStartLabelsWidth}\n />\n }\n bottomAxisLabel={<AxisLabel axis={x} position=\"bottom\" title={bottomAxisProps.title} />}\n chartPlot={\n <ChartPlot\n ref={plotRef}\n width=\"100%\"\n height={fitHeight ? `calc(100% - ${blockEndLabelsProps.height}px)` : plotHeight}\n offsetBottom={blockEndLabelsProps.height}\n isClickable={isPopoverOpen && !isPopoverPinned}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={i18nStrings?.chartAriaRoleDescription}\n ariaLiveRegion={activeLiveRegion}\n activeElementRef={highlightedElementRef}\n activeElementKey={activeAriaLabel}\n activeElementFocusOffset={isGroupNavigation ? 0 : isLineXKeyboardFocused ? { x: 8, y: 0 } : 3}\n onMouseMove={onSVGMouseMove}\n onMouseOut={onSVGMouseOut}\n onClick={onSVGClick}\n onApplicationFocus={onApplicationFocus}\n onApplicationBlur={onApplicationBlur}\n onKeyDown={onSVGKeyDown}\n >\n <line\n ref={plotMeasureRef}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"100%\"\n stroke=\"transparent\"\n strokeWidth={1}\n style={{ pointerEvents: 'none' }}\n />\n\n <InlineStartLabels\n axis={y}\n ticks={leftAxisProps.ticks}\n scale={leftAxisProps.scale}\n tickFormatter={leftAxisProps.tickFormatter as TickFormatter}\n title={leftAxisProps.title}\n ariaRoleDescription={leftAxisProps.ariaRoleDescription}\n maxLabelsWidth={maxInlineStartLabelsWidth}\n plotWidth={plotWidth}\n plotHeight={plotHeight}\n />\n\n {horizontalBars && (\n <VerticalGridLines scale={yAxisProps.scale} ticks={yAxisProps.ticks} height={plotHeight} />\n )}\n\n {emphasizeBaselineAxis && linesOnly && (\n <EmphasizedBaseline axis={x} scale={yAxisProps.scale} width={plotWidth} height={plotHeight} />\n )}\n\n <DataSeries\n axis={x}\n plotWidth={plotWidth}\n plotHeight={plotHeight}\n highlightedSeries={highlightedSeries ?? null}\n highlightedGroupIndex={highlightedGroupIndex}\n stackedBars={stackedBars}\n isGroupNavigation={isGroupNavigation}\n visibleSeries={visibleSeries}\n xScale={xAxisProps.scale}\n yScale={yAxisProps.scale}\n isRtl={!!isRtl}\n />\n\n {emphasizeBaselineAxis && !linesOnly && (\n <EmphasizedBaseline axis={x} scale={yAxisProps.scale} width={plotWidth} height={plotHeight} />\n )}\n\n <VerticalMarker\n key={verticalLineX || ''}\n height={plotHeight}\n showPoints={highlightedPoint === null}\n showLine={!isGroupNavigation}\n points={verticalMarkers}\n ref={verticalMarkerRef}\n />\n\n {highlightedPoint && (\n <HighlightedPoint\n ref={highlightedPointRef}\n point={point}\n role=\"button\"\n ariaLabel={activeAriaLabel}\n ariaHasPopup={true}\n ariaExpanded={isPopoverPinned}\n />\n )}\n\n {isGroupNavigation && xAxisProps.scale.isCategorical() && (\n <BarGroups\n ariaLabel={activeAriaLabel}\n isRefresh={isRefresh}\n isPopoverPinned={isPopoverPinned}\n barGroups={barGroups}\n highlightedGroupIndex={highlightedGroupIndex}\n highlightedGroupRef={highlightedGroupRef}\n />\n )}\n\n <BlockEndLabels\n {...blockEndLabelsProps}\n axis={x}\n scale={bottomAxisProps.scale}\n title={bottomAxisProps.title}\n ariaRoleDescription={bottomAxisProps.ariaRoleDescription}\n height={plotHeight}\n width={plotWidth}\n offsetLeft={inlineStartLabelsWidth + BLOCK_END_LABELS_OFFSET}\n offsetRight={BLOCK_END_LABELS_OFFSET}\n isRTL={isRtl}\n />\n </ChartPlot>\n }\n popover={\n <MixedChartPopover\n ref={popoverRef}\n containerRef={containerRefObject}\n trackRef={highlightedElementRef}\n isOpen={isPopoverOpen}\n isPinned={isPopoverPinned}\n highlightDetails={highlightDetails}\n onDismiss={onPopoverDismiss}\n size={detailPopoverSize}\n footer={detailPopoverFooterContent}\n dismissAriaLabel={i18nStrings.detailPopoverDismissAriaLabel}\n onMouseLeave={onPopoverLeave}\n onBlur={onApplicationBlur}\n setPopoverText={setDetailsPopoverText}\n />\n }\n />\n );\n}\n"]}
package/package.json CHANGED
@@ -151,7 +151,7 @@
151
151
  "./internal/base-component/index.js",
152
152
  "./internal/base-component/styles.css.js"
153
153
  ],
154
- "version": "3.0.1100",
154
+ "version": "3.0.1101",
155
155
  "repository": {
156
156
  "type": "git",
157
157
  "url": "https://github.com/cloudscape-design/components.git"
@@ -84,6 +84,8 @@ export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewpor
84
84
  * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.
85
85
  * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.
86
86
  * * `label` [string]: Optional suggestion label to be matched instead of the value.
87
+ * * `tags` [string[]]: Optional list of tags giving further guidance about the option.
88
+ * * `filteringTags` [string[]]: Optional list of additional tags used for automatic filtering.
87
89
  *
88
90
  * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:
89
91
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,qCAAqC,CAAC;AAE7C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MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC7C,eAAe,EAAE,sBAAsB,CAAC;CACzC;AAED,MAAM,WAAW,aAAa,CAAC,UAAU,GAAG,GAAG;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,IAAI,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACvD,QAAQ,EAAE,sBAAsB,CAAC;IACjC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB,CAAC,UAAU,GAAG,GAAG;IAClD,SAAS,EAAE,uBAAuB,CAAC;IACnC,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;CACjF;AAED,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAE/C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,yBAAyB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/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 React from 'react';\n\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterQuery,\n PropertyFilterToken,\n PropertyFilterTokenGroup,\n PropertyFilterTokenType,\n} from '@cloudscape-design/collection-hooks';\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport, FormFieldControlProps {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n * When the `countText` or `query` changes, it will be announced to assistive technologies.\n */\n countText?: string;\n\n /**\n * Set to `true` while the related collection is loading (e.g. during an async filtering action).\n * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.\n */\n loading?: boolean;\n\n /**\n * An object representing the current query displayed in the property filter, which has three properties: `operation`, `tokens`, and `tokenGroups`.\n * The `operation` property has two valid values: \"and\", \"or\", and controls the join operation to be applied between tokens when filtering the items.\n * The `tokens` property is an array of objects that will be displayed to the user beneath the filtering input. When `enableTokenGroups=true`, the\n * `tokenGroups` property is used instead, which supports nested tokens.\n *\n * Each token has the following properties:\n * * value [unknown]: The value of the token to be used as a filter. Can be null or string for default tokens, string[] for enum tokens, and anything for tokens with custom forms.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=' | '^' | '!^']: The operator which indicates how to filter the dataset using this token.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way, or use `readOnlyOperations`.\n *\n * This property cannot be set when `enableTokenGroups=true`.\n */\n hideOperations?: boolean;\n /**\n * If readOnlyOperations it set, the indicator of the operation (that is, `and` or `or`) is shown, but the\n * operation cannot be changed. This is also supported for nested tokens when `enableTokenGroups=true`.\n */\n readOnlyOperations?: boolean;\n /**\n * Activates token grouping mechanism to support token nesting (up to one level).\n * When `true`, the `query.tokens` property is ignored and `query.tokenGroups` is used instead.\n */\n enableTokenGroups?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n * * `label` [string]: Optional suggestion label to be matched instead of the value.\n *\n * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:\n * ```\n * const filteringProperty = {\n * key: 'state',\n * propertyLabel: 'State',\n * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))\n * }\n * const filteringOptions = [\n * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },\n * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },\n * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },\n * ]\n * ```\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * An object configuring the operators for free text filtering, which has the following properties:\n *\n * * operators [Array]: A list of all operators supported for free text filtering. If you omit the contains operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * defaultOperator [ComparisonOperator]: An optional parameter that changes the default operator used for free text filtering. Use this parameter only if your API does not support \"contains\" free test filtering terms.\n */\n freeTextFiltering?: PropertyFilterProps.FreeTextFiltering;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * A slot that replaces the standard \"Clear filter\" button.\n * When using this slot, make sure to still provide a mechanism to clear all filters.\n */\n customFilterActions?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronously. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * The label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel?: string;\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Constraint text that's displayed below the filtering input.\n * Use this to provide additional information about supported filters.\n */\n filteringConstraintText?: React.ReactNode;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: PropertyFilterProps.StatusType;\n\n /**\n * Adds an aria-label to the \"Show fewer\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowFewer` label on one page.\n */\n tokenLimitShowFewerAriaLabel?: string;\n /**\n * Adds an aria-label to the \"Show more\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowMore` label on one page.\n */\n tokenLimitShowMoreAriaLabel?: string;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type TokenGroup = PropertyFilterTokenGroup;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n export type FreeTextFiltering = PropertyFilterFreeTextFiltering;\n export type Query = PropertyFilterQuery;\n export type StatusType = DropdownStatusProps.StatusType;\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `filteringAriaLabel` on the component instead.\n */\n filteringAriaLabel?: string;\n\n /**\n * @deprecated Use `filteringPlaceholder` on the component instead.\n */\n filteringPlaceholder?: string;\n\n dismissAriaLabel?: string;\n clearAriaLabel?: string;\n groupValuesText?: string;\n groupPropertiesText?: string;\n operatorsText?: string;\n\n operationAndText?: string;\n operationOrText?: string;\n\n operatorLessText?: string;\n operatorLessOrEqualText?: string;\n operatorGreaterText?: string;\n operatorGreaterOrEqualText?: string;\n operatorContainsText?: string;\n operatorDoesNotContainText?: string;\n operatorEqualsText?: string;\n operatorDoesNotEqualText?: string;\n operatorStartsWithText?: string;\n operatorDoesNotStartWithText?: string;\n\n editTokenHeader?: string;\n propertyText?: string;\n operatorText?: string;\n valueText?: string;\n cancelActionText?: string;\n applyActionText?: string;\n allPropertiesLabel?: string;\n\n formatToken?: (token: FormattedToken) => string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: FormattedToken) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n }\n\n export interface FormattedToken {\n propertyKey?: string;\n propertyLabel: string;\n operator: ComparisonOperator;\n value: string;\n }\n\n export interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type TokenGroup = PropertyFilterProps.TokenGroup;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FormattedToken = PropertyFilterProps.FormattedToken;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport interface InternalFilteringProperty<TokenValue = any> {\n propertyKey: string;\n propertyLabel: string;\n groupValuesLabel: string;\n propertyGroup?: string;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n getTokenType: (operator?: PropertyFilterOperator) => PropertyFilterTokenType;\n getValueFormatter: (operator?: PropertyFilterOperator) => null | ((value: any) => string);\n getValueFormRenderer: (operator?: PropertyFilterOperator) => null | PropertyFilterOperatorForm<TokenValue>;\n // Original property used in callbacks.\n externalProperty: PropertyFilterProperty;\n}\n\nexport interface InternalFilteringOption {\n property: null | InternalFilteringProperty;\n value: string;\n label: string;\n tags?: ReadonlyArray<string>;\n filteringTags?: ReadonlyArray<string>;\n}\n\nexport interface InternalFreeTextFiltering {\n disabled: boolean;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n}\n\nexport interface InternalToken<TokenValue = any> {\n standaloneIndex?: number;\n property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalTokenGroup<TokenValue = any> {\n operation: PropertyFilterOperation;\n tokens: readonly (InternalToken<TokenValue> | InternalTokenGroup<TokenValue>)[];\n}\n\nexport type InternalQuery = InternalTokenGroup;\n\nexport type ParsedText =\n | { step: 'property'; property: InternalFilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: InternalFilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/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 React from 'react';\n\nimport {\n PropertyFilterFreeTextFiltering,\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterQuery,\n PropertyFilterToken,\n PropertyFilterTokenGroup,\n PropertyFilterTokenType,\n} from '@cloudscape-design/collection-hooks';\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport, FormFieldControlProps {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n * When the `countText` or `query` changes, it will be announced to assistive technologies.\n */\n countText?: string;\n\n /**\n * Set to `true` while the related collection is loading (e.g. during an async filtering action).\n * If set to `true`, the live announcement of countText by assistive technologies will be paused until it changes back to `false`.\n */\n loading?: boolean;\n\n /**\n * An object representing the current query displayed in the property filter, which has three properties: `operation`, `tokens`, and `tokenGroups`.\n * The `operation` property has two valid values: \"and\", \"or\", and controls the join operation to be applied between tokens when filtering the items.\n * The `tokens` property is an array of objects that will be displayed to the user beneath the filtering input. When `enableTokenGroups=true`, the\n * `tokenGroups` property is used instead, which supports nested tokens.\n *\n * Each token has the following properties:\n * * value [unknown]: The value of the token to be used as a filter. Can be null or string for default tokens, string[] for enum tokens, and anything for tokens with custom forms.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=' | '^' | '!^']: The operator which indicates how to filter the dataset using this token.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way, or use `readOnlyOperations`.\n *\n * This property cannot be set when `enableTokenGroups=true`.\n */\n hideOperations?: boolean;\n /**\n * If readOnlyOperations it set, the indicator of the operation (that is, `and` or `or`) is shown, but the\n * operation cannot be changed. This is also supported for nested tokens when `enableTokenGroups=true`.\n */\n readOnlyOperations?: boolean;\n /**\n * Activates token grouping mechanism to support token nesting (up to one level).\n * When `true`, the `query.tokens` property is ignored and `query.tokenGroups` is used instead.\n */\n enableTokenGroups?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n * * `label` [string]: Optional suggestion label to be matched instead of the value.\n * * `tags` [string[]]: Optional list of tags giving further guidance about the option.\n * * `filteringTags` [string[]]: Optional list of additional tags used for automatic filtering.\n *\n * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:\n * ```\n * const filteringProperty = {\n * key: 'state',\n * propertyLabel: 'State',\n * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))\n * }\n * const filteringOptions = [\n * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },\n * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },\n * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },\n * ]\n * ```\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * An object configuring the operators for free text filtering, which has the following properties:\n *\n * * operators [Array]: A list of all operators supported for free text filtering. If you omit the contains operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * defaultOperator [ComparisonOperator]: An optional parameter that changes the default operator used for free text filtering. Use this parameter only if your API does not support \"contains\" free test filtering terms.\n */\n freeTextFiltering?: PropertyFilterProps.FreeTextFiltering;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * A slot that replaces the standard \"Clear filter\" button.\n * When using this slot, make sure to still provide a mechanism to clear all filters.\n */\n customFilterActions?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronously. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * The label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel?: string;\n /**\n * Placeholder for the filtering input.\n */\n filteringPlaceholder?: string;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Constraint text that's displayed below the filtering input.\n * Use this to provide additional information about supported filters.\n */\n filteringConstraintText?: React.ReactNode;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: PropertyFilterProps.StatusType;\n\n /**\n * Adds an aria-label to the \"Show fewer\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowFewer` label on one page.\n */\n tokenLimitShowFewerAriaLabel?: string;\n /**\n * Adds an aria-label to the \"Show more\" button for the token group control.\n * Use to assign unique labels when there are multiple token groups with the same `tokenLimitShowMore` label on one page.\n */\n tokenLimitShowMoreAriaLabel?: string;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type TokenGroup = PropertyFilterTokenGroup;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n export type FreeTextFiltering = PropertyFilterFreeTextFiltering;\n export type Query = PropertyFilterQuery;\n export type StatusType = DropdownStatusProps.StatusType;\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `filteringAriaLabel` on the component instead.\n */\n filteringAriaLabel?: string;\n\n /**\n * @deprecated Use `filteringPlaceholder` on the component instead.\n */\n filteringPlaceholder?: string;\n\n dismissAriaLabel?: string;\n clearAriaLabel?: string;\n groupValuesText?: string;\n groupPropertiesText?: string;\n operatorsText?: string;\n\n operationAndText?: string;\n operationOrText?: string;\n\n operatorLessText?: string;\n operatorLessOrEqualText?: string;\n operatorGreaterText?: string;\n operatorGreaterOrEqualText?: string;\n operatorContainsText?: string;\n operatorDoesNotContainText?: string;\n operatorEqualsText?: string;\n operatorDoesNotEqualText?: string;\n operatorStartsWithText?: string;\n operatorDoesNotStartWithText?: string;\n\n editTokenHeader?: string;\n propertyText?: string;\n operatorText?: string;\n valueText?: string;\n cancelActionText?: string;\n applyActionText?: string;\n allPropertiesLabel?: string;\n\n formatToken?: (token: FormattedToken) => string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText?: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel?: (token: FormattedToken) => string;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n\n groupEditAriaLabel?: (group: FormattedTokenGroup) => string;\n tokenEditorTokenActionsAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveAriaLabel?: (token: FormattedToken) => string;\n tokenEditorTokenRemoveLabel?: string;\n tokenEditorTokenRemoveFromGroupLabel?: string;\n tokenEditorAddNewTokenLabel?: string;\n tokenEditorAddTokenActionsAriaLabel?: string;\n tokenEditorAddExistingTokenAriaLabel?: (token: FormattedToken) => string;\n tokenEditorAddExistingTokenLabel?: (token: FormattedToken) => string;\n }\n\n export interface FormattedToken {\n propertyKey?: string;\n propertyLabel: string;\n operator: ComparisonOperator;\n value: string;\n }\n\n export interface FormattedTokenGroup {\n tokens: FormattedToken[];\n operation: string;\n operationLabel: string;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type TokenGroup = PropertyFilterProps.TokenGroup;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FormattedToken = PropertyFilterProps.FormattedToken;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport interface InternalFilteringProperty<TokenValue = any> {\n propertyKey: string;\n propertyLabel: string;\n groupValuesLabel: string;\n propertyGroup?: string;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n getTokenType: (operator?: PropertyFilterOperator) => PropertyFilterTokenType;\n getValueFormatter: (operator?: PropertyFilterOperator) => null | ((value: any) => string);\n getValueFormRenderer: (operator?: PropertyFilterOperator) => null | PropertyFilterOperatorForm<TokenValue>;\n // Original property used in callbacks.\n externalProperty: PropertyFilterProperty;\n}\n\nexport interface InternalFilteringOption {\n property: null | InternalFilteringProperty;\n value: string;\n label: string;\n tags?: ReadonlyArray<string>;\n filteringTags?: ReadonlyArray<string>;\n}\n\nexport interface InternalFreeTextFiltering {\n disabled: boolean;\n operators: readonly PropertyFilterOperator[];\n defaultOperator: PropertyFilterOperator;\n}\n\nexport interface InternalToken<TokenValue = any> {\n standaloneIndex?: number;\n property: null | InternalFilteringProperty<TokenValue>;\n operator: PropertyFilterOperator;\n value: TokenValue;\n}\n\nexport interface InternalTokenGroup<TokenValue = any> {\n operation: PropertyFilterOperation;\n tokens: readonly (InternalToken<TokenValue> | InternalTokenGroup<TokenValue>)[];\n}\n\nexport type InternalQuery = InternalTokenGroup;\n\nexport type ParsedText =\n | { step: 'property'; property: InternalFilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: InternalFilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}