@cloudscape-design/components 3.0.632 → 3.0.634

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.
Files changed (81) hide show
  1. package/app-layout/split-panel/styles.css.js +2 -2
  2. package/app-layout/split-panel/styles.scoped.css +3 -2
  3. package/app-layout/split-panel/styles.selectors.js +2 -2
  4. package/cards/index.d.ts.map +1 -1
  5. package/cards/index.js +6 -6
  6. package/cards/index.js.map +1 -1
  7. package/cards/interfaces.d.ts +1 -1
  8. package/cards/interfaces.js.map +1 -1
  9. package/copy-to-clipboard/index.d.ts +1 -1
  10. package/copy-to-clipboard/index.d.ts.map +1 -1
  11. package/copy-to-clipboard/index.js +7 -42
  12. package/copy-to-clipboard/index.js.map +1 -1
  13. package/copy-to-clipboard/internal.d.ts +7 -0
  14. package/copy-to-clipboard/internal.d.ts.map +1 -0
  15. package/copy-to-clipboard/internal.js +44 -0
  16. package/copy-to-clipboard/internal.js.map +1 -0
  17. package/internal/direction.d.ts +1 -1
  18. package/internal/direction.d.ts.map +1 -1
  19. package/internal/direction.js +3 -0
  20. package/internal/direction.js.map +1 -1
  21. package/internal/environment.js +1 -1
  22. package/internal/environment.json +1 -1
  23. package/internal/manifest.json +1 -1
  24. package/mixed-line-bar-chart/bar-series.d.ts +2 -1
  25. package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
  26. package/mixed-line-bar-chart/bar-series.js +6 -3
  27. package/mixed-line-bar-chart/bar-series.js.map +1 -1
  28. package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
  29. package/mixed-line-bar-chart/chart-container.js +3 -3
  30. package/mixed-line-bar-chart/chart-container.js.map +1 -1
  31. package/mixed-line-bar-chart/data-series.d.ts +2 -1
  32. package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
  33. package/mixed-line-bar-chart/data-series.js +2 -2
  34. package/mixed-line-bar-chart/data-series.js.map +1 -1
  35. package/package.json +1 -1
  36. package/progress-bar/index.d.ts.map +1 -1
  37. package/progress-bar/index.js +1 -1
  38. package/progress-bar/index.js.map +1 -1
  39. package/progress-bar/internal.d.ts +2 -1
  40. package/progress-bar/internal.d.ts.map +1 -1
  41. package/progress-bar/internal.js +2 -2
  42. package/progress-bar/internal.js.map +1 -1
  43. package/property-filter/index.d.ts.map +1 -1
  44. package/property-filter/index.js +8 -2
  45. package/property-filter/index.js.map +1 -1
  46. package/property-filter/interfaces.d.ts +5 -0
  47. package/property-filter/interfaces.d.ts.map +1 -1
  48. package/property-filter/interfaces.js.map +1 -1
  49. package/property-filter/styles.css.js +32 -31
  50. package/property-filter/styles.scoped.css +41 -33
  51. package/property-filter/styles.selectors.js +32 -31
  52. package/table/interfaces.d.ts +13 -11
  53. package/table/interfaces.d.ts.map +1 -1
  54. package/table/interfaces.js.map +1 -1
  55. package/table/internal.d.ts.map +1 -1
  56. package/table/internal.js +9 -4
  57. package/table/internal.js.map +1 -1
  58. package/table/selection/interfaces.d.ts +1 -0
  59. package/table/selection/interfaces.d.ts.map +1 -1
  60. package/table/selection/interfaces.js.map +1 -1
  61. package/table/selection/use-selection.d.ts +5 -4
  62. package/table/selection/use-selection.d.ts.map +1 -1
  63. package/table/selection/use-selection.js +55 -36
  64. package/table/selection/use-selection.js.map +1 -1
  65. package/table/thead.d.ts +1 -1
  66. package/table/thead.d.ts.map +1 -1
  67. package/table/thead.js +1 -1
  68. package/table/thead.js.map +1 -1
  69. package/test-utils/dom/progress-bar/index.d.ts +1 -0
  70. package/test-utils/dom/progress-bar/index.js +3 -0
  71. package/test-utils/dom/progress-bar/index.js.map +1 -1
  72. package/test-utils/dom/property-filter/index.d.ts +4 -0
  73. package/test-utils/dom/property-filter/index.js +6 -0
  74. package/test-utils/dom/property-filter/index.js.map +1 -1
  75. package/test-utils/selectors/progress-bar/index.d.ts +1 -0
  76. package/test-utils/selectors/progress-bar/index.js +3 -0
  77. package/test-utils/selectors/progress-bar/index.js.map +1 -1
  78. package/test-utils/selectors/property-filter/index.d.ts +4 -0
  79. package/test-utils/selectors/property-filter/index.js +6 -0
  80. package/test-utils/selectors/property-filter/index.js.map +1 -1
  81. package/test-utils/tsconfig.tsbuildinfo +1 -1
@@ -1,7 +1,7 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "drawer-displayed": "awsui_drawer-displayed_1lh3u_1yevz_103",
5
- "drawer-content": "awsui_drawer-content_1lh3u_1yevz_107"
4
+ "drawer-displayed": "awsui_drawer-displayed_1lh3u_17q8n_103",
5
+ "drawer-content": "awsui_drawer-content_1lh3u_17q8n_107"
6
6
  };
7
7
 
@@ -100,10 +100,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
100
100
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
101
101
  SPDX-License-Identifier: Apache-2.0
102
102
  */
103
- .awsui_drawer-displayed_1lh3u_1yevz_103:not(#\9) {
103
+ .awsui_drawer-displayed_1lh3u_17q8n_103:not(#\9) {
104
104
  min-inline-size: 40px;
105
105
  }
106
106
 
107
- .awsui_drawer-content_1lh3u_1yevz_107:not(#\9) {
107
+ .awsui_drawer-content_1lh3u_17q8n_107:not(#\9) {
108
108
  position: fixed;
109
+ z-index: 830;
109
110
  }
@@ -2,7 +2,7 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "drawer-displayed": "awsui_drawer-displayed_1lh3u_1yevz_103",
6
- "drawer-content": "awsui_drawer-content_1lh3u_1yevz_107"
5
+ "drawer-displayed": "awsui_drawer-displayed_1lh3u_17q8n_103",
6
+ "drawer-content": "awsui_drawer-content_1lh3u_17q8n_107"
7
7
  };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA6Kc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA4Kc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
package/cards/index.js CHANGED
@@ -45,7 +45,7 @@ const Cards = React.forwardRef(function (_a, ref) {
45
45
  const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);
46
46
  const getMouseDownTarget = useMouseDownTarget();
47
47
  const i18n = useInternalI18n('cards');
48
- const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({
48
+ const { isItemSelected, getItemSelectionProps } = useSelection({
49
49
  items,
50
50
  trackBy,
51
51
  selectedItems,
@@ -94,10 +94,10 @@ const Cards = React.forwardRef(function (_a, ref) {
94
94
  React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences })))), footer: hasFooterPagination && React.createElement("div", { className: styles['footer-pagination'] }, pagination), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef, __darkHeader: computedVariant === 'full-page', __disableFooterDivider: true },
95
95
  React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header'], isRefresh && styles.refresh, styles[`header-variant-${computedVariant}`], shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']) },
96
96
  !!renderAriaLive && !!firstIndex && (React.createElement(LiveRegion, null,
97
- React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus, ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.cardsLabel, ariaLabelledby: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined, entireCardClickable: entireCardClickable }))))))));
97
+ React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, onFocus: onCardFocus, ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.cardsLabel, ariaLabelledby: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined, entireCardClickable: entireCardClickable }))))))));
98
98
  });
99
99
  export default Cards;
100
- const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections, updateShiftToggle, onFocus, ariaLabelledby, ariaLabel, entireCardClickable, }) => {
100
+ const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections, onFocus, ariaLabelledby, ariaLabel, entireCardClickable, }) => {
101
101
  const selectable = !!selectionType;
102
102
  const canClickEntireCard = selectable && entireCardClickable;
103
103
  const isRefresh = useVisualRefresh();
@@ -119,15 +119,15 @@ const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isI
119
119
  React.createElement("div", { className: clsx(styles['card-inner'], isRefresh && styles.refresh), onClick: canClickEntireCard
120
120
  ? event => {
121
121
  var _a;
122
- getItemSelectionProps(item).onChange();
122
+ getItemSelectionProps === null || getItemSelectionProps === void 0 ? void 0 : getItemSelectionProps(item).onChange();
123
123
  // Manually move focus to the native input (checkbox or radio button)
124
124
  (_a = event.currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
125
125
  }
126
126
  : undefined },
127
127
  React.createElement("div", { className: styles['card-header'] },
128
128
  React.createElement("div", { className: styles['card-header-inner'] }, cardDefinition.header ? cardDefinition.header(item) : ''),
129
- selectable && (React.createElement("div", { className: styles['selection-control'] },
130
- React.createElement(SelectionControl, Object.assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp, onShiftToggle: updateShiftToggle }, getItemSelectionProps(item)))))),
129
+ getItemSelectionProps && (React.createElement("div", { className: styles['selection-control'] },
130
+ React.createElement(SelectionControl, Object.assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp }, getItemSelectionProps(item)))))),
131
131
  visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (React.createElement("div", { key: id || index, className: styles.section, style: { width: `${width}%` } },
132
132
  header ? React.createElement("div", { className: styles['section-header'] }, header) : '',
133
133
  content ? React.createElement("div", { className: styles['section-content'] }, content(item)) : '')))))))));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAEhB,YAAY,EACZ,qBAAqB,EACrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;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AK,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE;gBAC5E,MAAM,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,MAAM,CAAO,CAAC,CAAC,CAAC,EAAE;gBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"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aAAa,CAAC;gBACnC,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IACxC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CACrD;gBACL,qBAAqB,IAAI,CACxB,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBACzC,oBAAC,gBAAgB,kBACf,WAAW,EAAE,aAAa,EAC1B,SAAS,EAAE,WAAW,IAClB,qBAAqB,CAAC,IAAI,CAAC,EAC/B,CACE,CACP,CACG;YACL,yBAAyB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9E,6BAAK,GAAG,EAAE,EAAE,IAAI,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE;gBAC5E,MAAM,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,MAAM,CAAO,CAAC,CAAC,CAAC,EAAE;gBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps?: (item: T) => SelectionControlProps;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps?.(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {getItemSelectionProps && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
@@ -177,8 +177,8 @@ export interface CardsProps<T = any> extends BaseComponentProps {
177
177
  * Use this function to announce page changes to screen reader users.
178
178
  * The function argument takes the following properties:
179
179
  * * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.
180
- * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.
181
180
  * * `lastIndex` (number) - The index of the last visible item of the table.
181
+ * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.
182
182
  */
183
183
  renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;
184
184
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined.\n */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * The function argument takes the following properties:\n * * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.\n * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.\n * * `lastIndex` (number) - The index of the last visible item of the table.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n\n /**\n * Activating this property makes the entire card clickable to select it.\n * Don't use this property if the card has any other interactive elements.\n */\n entireCardClickable?: boolean;\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n firstIndex: number;\n lastIndex: number;\n totalItemsCount?: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined.\n */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * The function argument takes the following properties:\n * * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.\n * * `lastIndex` (number) - The index of the last visible item of the table.\n * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n\n /**\n * Activating this property makes the entire card clickable to select it.\n * Don't use this property if the card has any other interactive elements.\n */\n entireCardClickable?: boolean;\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n firstIndex: number;\n lastIndex: number;\n totalItemsCount?: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { CopyToClipboardProps } from './interfaces';
3
3
  export { CopyToClipboardProps };
4
- export default function CopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, ...restProps }: CopyToClipboardProps): JSX.Element;
4
+ export default function CopyToClipboard({ variant, ...restProps }: CopyToClipboardProps): JSX.Element;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAUpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,GAAG,SAAS,EACb,EAAE,oBAAoB,eAuEtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,OAAkB,EAAE,GAAG,SAAS,EAAE,EAAE,oBAAoB,eAOjG"}
@@ -1,53 +1,18 @@
1
1
  import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React, { useState } from 'react';
5
- import { getBaseProps } from '../internal/base-component';
4
+ import React from 'react';
6
5
  import { applyDisplayName } from '../internal/utils/apply-display-name';
7
6
  import useBaseComponent from '../internal/hooks/use-base-component';
8
- import InternalButton from '../button/internal';
9
- import InternalPopover from '../popover/internal';
10
- import InternalStatusIndicator from '../status-indicator/internal';
11
- import styles from './styles.css.js';
12
- import testStyles from './test-classes/styles.css.js';
13
- import clsx from 'clsx';
7
+ import InternalCopyToClipboard from './internal';
8
+ import { getExternalProps } from '../internal/utils/external-props';
14
9
  export default function CopyToClipboard(_a) {
15
- var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy"]);
16
- const { __internalRootRef } = useBaseComponent('CopyToClipboard', {
10
+ var { variant = 'button' } = _a, restProps = __rest(_a, ["variant"]);
11
+ const baseProps = useBaseComponent('CopyToClipboard', {
17
12
  props: { variant },
18
13
  });
19
- const baseProps = getBaseProps(restProps);
20
- const copyButtonProps = variant === 'button'
21
- ? { children: copyButtonText, ariaLabel: copyButtonAriaLabel }
22
- : { ariaLabel: copyButtonAriaLabel !== null && copyButtonAriaLabel !== void 0 ? copyButtonAriaLabel : copyButtonText };
23
- const [status, setStatus] = useState('pending');
24
- const [statusText, setStatusText] = useState('');
25
- const onClick = () => {
26
- if (navigator.clipboard) {
27
- setStatus('pending');
28
- setStatusText('');
29
- navigator.clipboard
30
- .writeText(textToCopy)
31
- .then(() => {
32
- setStatus('success');
33
- setStatusText(copySuccessText);
34
- })
35
- .catch(() => {
36
- setStatus('error');
37
- setStatusText(copyErrorText);
38
- });
39
- }
40
- };
41
- const triggerVariant = {
42
- button: 'normal',
43
- icon: 'icon',
44
- inline: 'inline-icon',
45
- }[variant];
46
- const trigger = (React.createElement(InternalPopover, { size: "medium", position: "top", triggerType: "custom", dismissButton: false, renderWithPortal: true, content: React.createElement(InternalStatusIndicator, { type: status }, statusText) },
47
- React.createElement(InternalButton, Object.assign({}, copyButtonProps, { iconName: "copy", onClick: onClick, variant: triggerVariant, wrapText: false, formAction: "none" }))));
48
- return (React.createElement("span", Object.assign({ ref: __internalRootRef }, baseProps, { className: clsx(baseProps.className, styles.root, testStyles.root) }), variant === 'inline' ? (React.createElement("span", { className: styles['inline-container'] },
49
- React.createElement("span", { className: styles['inline-container-trigger'] }, trigger),
50
- React.createElement("span", { className: testStyles['text-to-copy'] }, textToCopy))) : (trigger)));
14
+ const filteredProps = getExternalProps(restProps);
15
+ return React.createElement(InternalCopyToClipboard, Object.assign({ variant: variant }, baseProps, filteredProps));
51
16
  }
52
17
  applyDisplayName(CopyToClipboard, 'CopyToClipboard');
53
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAQjB;QARiB,EACtC,OAAO,GAAG,QAAQ,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,OAEW,EADlB,SAAS,cAP0B,sGAQvC,CADa;IAEZ,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QAChE,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE1C,MAAM,eAAe,GAC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Ae,IACnB,QAAQ,EAAC,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,KAAK,EACf,UAAU,EAAC,MAAM,IACjB,CACc,CACnB,CAAC;IAEF,OAAO,CACL,4CAAM,GAAG,EAAE,iBAAiB,IAAM,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CACtB,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,IAAG,UAAU,CAAQ,CAC3D,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { CopyToClipboardProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport InternalButton from '../button/internal';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\nimport clsx from 'clsx';\n\nexport { CopyToClipboardProps };\n\nexport default function CopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n ...restProps\n}: CopyToClipboardProps) {\n const { __internalRootRef } = useBaseComponent('CopyToClipboard', {\n props: { variant },\n });\n const baseProps = getBaseProps(restProps);\n\n const copyButtonProps =\n variant === 'button'\n ? { children: copyButtonText, ariaLabel: copyButtonAriaLabel }\n : { ariaLabel: copyButtonAriaLabel ?? copyButtonText };\n\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const onClick = () => {\n if (navigator.clipboard) {\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n }\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const trigger = (\n <InternalPopover\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={true}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n >\n <InternalButton\n {...copyButtonProps}\n iconName=\"copy\"\n onClick={onClick}\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n />\n </InternalPopover>\n );\n\n return (\n <span ref={__internalRootRef} {...baseProps} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {variant === 'inline' ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={testStyles['text-to-copy']}>{textToCopy}</span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n\napplyDisplayName(CopyToClipboard, 'CopyToClipboard');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,uBAAuB,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAA0D;QAA1D,EAAE,OAAO,GAAG,QAAQ,OAAsC,EAAjC,SAAS,cAAlC,WAAoC,CAAF;IACxE,MAAM,SAAS,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QACpD,KAAK,EAAE,EAAE,OAAO,EAAE;KACnB,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAElD,OAAO,oBAAC,uBAAuB,kBAAC,OAAO,EAAE,OAAO,IAAM,SAAS,EAAM,aAAa,EAAI,CAAC;AACzF,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { CopyToClipboardProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport InternalCopyToClipboard from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\n\nexport { CopyToClipboardProps };\n\nexport default function CopyToClipboard({ variant = 'button', ...restProps }: CopyToClipboardProps) {\n const baseProps = useBaseComponent('CopyToClipboard', {\n props: { variant },\n });\n const filteredProps = getExternalProps(restProps);\n\n return <InternalCopyToClipboard variant={variant} {...baseProps} {...filteredProps} />;\n}\n\napplyDisplayName(CopyToClipboard, 'CopyToClipboard');\n"]}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { CopyToClipboardProps } from './interfaces';
3
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
4
+ export interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {
5
+ }
6
+ export default function InternalCopyToClipboard({ variant, copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, __internalRootRef, ...restProps }: InternalCopyToClipboardProps): JSX.Element;
7
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB,EAAE,0BAA0B;CAAG;AAEzG,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,OAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,4BAA4B,eAgE9B"}
@@ -0,0 +1,44 @@
1
+ import { __rest } from "tslib";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import React, { useState } from 'react';
5
+ import InternalButton from '../button/internal';
6
+ import InternalPopover from '../popover/internal';
7
+ import InternalStatusIndicator from '../status-indicator/internal';
8
+ import styles from './styles.css.js';
9
+ import testStyles from './test-classes/styles.css.js';
10
+ import clsx from 'clsx';
11
+ import { getBaseProps } from '../internal/base-component';
12
+ export default function InternalCopyToClipboard(_a) {
13
+ var { variant = 'button', copyButtonAriaLabel, copyButtonText, copySuccessText, copyErrorText, textToCopy, __internalRootRef = null } = _a, restProps = __rest(_a, ["variant", "copyButtonAriaLabel", "copyButtonText", "copySuccessText", "copyErrorText", "textToCopy", "__internalRootRef"]);
14
+ const [status, setStatus] = useState('pending');
15
+ const [statusText, setStatusText] = useState('');
16
+ const baseProps = getBaseProps(restProps);
17
+ const onClick = () => {
18
+ if (navigator.clipboard) {
19
+ setStatus('pending');
20
+ setStatusText('');
21
+ navigator.clipboard
22
+ .writeText(textToCopy)
23
+ .then(() => {
24
+ setStatus('success');
25
+ setStatusText(copySuccessText);
26
+ })
27
+ .catch(() => {
28
+ setStatus('error');
29
+ setStatusText(copyErrorText);
30
+ });
31
+ }
32
+ };
33
+ const triggerVariant = {
34
+ button: 'normal',
35
+ icon: 'icon',
36
+ inline: 'inline-icon',
37
+ }[variant];
38
+ const trigger = (React.createElement(InternalPopover, { size: "medium", position: "top", triggerType: "custom", dismissButton: false, renderWithPortal: true, content: React.createElement(InternalStatusIndicator, { type: status }, statusText) },
39
+ React.createElement(InternalButton, { ariaLabel: copyButtonAriaLabel !== null && copyButtonAriaLabel !== void 0 ? copyButtonAriaLabel : copyButtonText, iconName: "copy", onClick: onClick, variant: triggerVariant, wrapText: false, formAction: "none" }, copyButtonText)));
40
+ return (React.createElement("span", Object.assign({}, baseProps, { ref: __internalRootRef, className: clsx(baseProps.className, styles.root, testStyles.root) }), variant === 'inline' ? (React.createElement("span", { className: styles['inline-container'] },
41
+ React.createElement("span", { className: styles['inline-container-trigger'] }, trigger),
42
+ React.createElement("span", { className: testStyles['text-to-copy'] }, textToCopy))) : (trigger)));
43
+ }
44
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/copy-to-clipboard/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EASjB;QATiB,EAC9C,OAAO,GAAG,QAAQ,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,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,EAChD,QAAQ,EAAC,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,KAAK,EACf,UAAU,EAAC,MAAM,IAEhB,cAAc,CACA,CACD,CACnB,CAAC;IAEF,OAAO,CACL,8CAAU,SAAS,IAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAC5G,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CACtB,8BAAM,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;QACzC,8BAAM,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,IAAG,OAAO,CAAQ;QACrE,8BAAM,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,IAAG,UAAU,CAAQ,CAC3D,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CACI,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { CopyToClipboardProps } from './interfaces';\nimport InternalButton from '../button/internal';\nimport InternalPopover from '../popover/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\n\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\nimport clsx from 'clsx';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {}\n\nexport default function InternalCopyToClipboard({\n variant = 'button',\n copyButtonAriaLabel,\n copyButtonText,\n copySuccessText,\n copyErrorText,\n textToCopy,\n __internalRootRef = null,\n ...restProps\n}: InternalCopyToClipboardProps) {\n const [status, setStatus] = useState<'pending' | 'success' | 'error'>('pending');\n const [statusText, setStatusText] = useState('');\n\n const baseProps = getBaseProps(restProps);\n const onClick = () => {\n if (navigator.clipboard) {\n setStatus('pending');\n setStatusText('');\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n setStatus('success');\n setStatusText(copySuccessText);\n })\n .catch(() => {\n setStatus('error');\n setStatusText(copyErrorText);\n });\n }\n };\n\n const triggerVariant = (\n {\n button: 'normal',\n icon: 'icon',\n inline: 'inline-icon',\n } as const\n )[variant];\n\n const trigger = (\n <InternalPopover\n size=\"medium\"\n position=\"top\"\n triggerType=\"custom\"\n dismissButton={false}\n renderWithPortal={true}\n content={<InternalStatusIndicator type={status}>{statusText}</InternalStatusIndicator>}\n >\n <InternalButton\n ariaLabel={copyButtonAriaLabel ?? copyButtonText}\n iconName=\"copy\"\n onClick={onClick}\n variant={triggerVariant}\n wrapText={false}\n formAction=\"none\"\n >\n {copyButtonText}\n </InternalButton>\n </InternalPopover>\n );\n\n return (\n <span {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n {variant === 'inline' ? (\n <span className={styles['inline-container']}>\n <span className={styles['inline-container-trigger']}>{trigger}</span>\n <span className={testStyles['text-to-copy']}>{textToCopy}</span>\n </span>\n ) : (\n trigger\n )}\n </span>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare function getIsRtl(element: HTMLElement | SVGElement): boolean;
1
+ export declare function getIsRtl(element: null | HTMLElement | SVGElement): boolean;
2
2
  export declare function getOffsetInlineStart(element: HTMLElement): number;
3
3
  /**
4
4
  * The scrollLeft value will be a negative number if the direction is RTL and
@@ -1 +1 @@
1
- {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,WAEzD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAGxD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAExD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,UAEpE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU;;;;;;;EAoB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,UAIhD"}
1
+ {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAK1E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAGxD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAExD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,UAEpE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU;;;;;;;EAoB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,UAIhD"}
@@ -1,6 +1,9 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  export function getIsRtl(element) {
4
+ if (!element) {
5
+ return false;
6
+ }
4
7
  return getComputedStyle(element).direction === 'rtl';
5
8
  }
6
9
  export function getOffsetInlineStart(element) {
@@ -1 +1 @@
1
- {"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,QAAQ,CAAC,OAAiC;IACxD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,oBAAoB,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C;IAC5B,MAAM,cAAc,GAAG,gBAAgB,GAAG,UAAU,CAAC;IAErD,OAAO;QACL,SAAS;QACT,UAAU;QACV,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,MAAM,YAAY,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAClE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK;QACpD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;AAClB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getIsRtl(element: HTMLElement | SVGElement) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\nexport function getOffsetInlineStart(element: HTMLElement) {\n const offsetParentWidth = element.offsetParent?.clientWidth ?? 0;\n return getIsRtl(element) ? offsetParentWidth - element.offsetWidth - element.offsetLeft : element.offsetLeft;\n}\n\n/**\n * The scrollLeft value will be a negative number if the direction is RTL and\n * needs to be converted to a positive value for direction independent scroll\n * computations. Additionally, the scrollLeft value can be a decimal value on\n * systems using display scaling requiring the floor and ceiling calls.\n */\nexport function getScrollInlineStart(element: HTMLElement) {\n return getIsRtl(element) ? Math.floor(element.scrollLeft) * -1 : Math.ceil(element.scrollLeft);\n}\n\n/**\n * The clientX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalClientX(event: PointerEvent, IsRtl: boolean) {\n return IsRtl ? document.documentElement.clientWidth - event.clientX : event.clientX;\n}\n\n/**\n * The getBoundingClientRect() function returns values relative to the top left\n * corner of the document regardless of document direction. The left/right position\n * will be transformed to insetInlineStart based on element direction in order to\n * support direction agnostic position computation.\n */\nexport function getLogicalBoundingClientRect(element: HTMLElement | SVGElement) {\n const boundingClientRect = element.getBoundingClientRect();\n\n const blockSize = boundingClientRect.height;\n const inlineSize = boundingClientRect.width;\n const insetBlockStart = boundingClientRect.top;\n const insetBlockEnd = boundingClientRect.bottom;\n const insetInlineStart = getIsRtl(element)\n ? document.documentElement.clientWidth - boundingClientRect.right\n : boundingClientRect.left;\n const insetInlineEnd = insetInlineStart + inlineSize;\n\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetBlockEnd,\n insetInlineStart,\n insetInlineEnd,\n };\n}\n\n/**\n * The pageX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalPageX(event: MouseEvent) {\n return event.target instanceof HTMLElement && getIsRtl(event.target)\n ? document.documentElement.clientWidth - event.pageX\n : event.pageX;\n}\n"]}
1
+ {"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,QAAQ,CAAC,OAAwC;IAC/D,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAC;KACd;IACD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAoB;;IACvD,MAAM,iBAAiB,GAAG,MAAA,MAAA,OAAO,CAAC,YAAY,0CAAE,WAAW,mCAAI,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC/G,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CA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right Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getIsRtl(element: null | HTMLElement | SVGElement): boolean {\n if (!element) {\n return false;\n }\n return getComputedStyle(element).direction === 'rtl';\n}\n\nexport function getOffsetInlineStart(element: HTMLElement) {\n const offsetParentWidth = element.offsetParent?.clientWidth ?? 0;\n return getIsRtl(element) ? offsetParentWidth - element.offsetWidth - element.offsetLeft : element.offsetLeft;\n}\n\n/**\n * The scrollLeft value will be a negative number if the direction is RTL and\n * needs to be converted to a positive value for direction independent scroll\n * computations. Additionally, the scrollLeft value can be a decimal value on\n * systems using display scaling requiring the floor and ceiling calls.\n */\nexport function getScrollInlineStart(element: HTMLElement) {\n return getIsRtl(element) ? Math.floor(element.scrollLeft) * -1 : Math.ceil(element.scrollLeft);\n}\n\n/**\n * The clientX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalClientX(event: PointerEvent, IsRtl: boolean) {\n return IsRtl ? document.documentElement.clientWidth - event.clientX : event.clientX;\n}\n\n/**\n * The getBoundingClientRect() function returns values relative to the top left\n * corner of the document regardless of document direction. The left/right position\n * will be transformed to insetInlineStart based on element direction in order to\n * support direction agnostic position computation.\n */\nexport function getLogicalBoundingClientRect(element: HTMLElement | SVGElement) {\n const boundingClientRect = element.getBoundingClientRect();\n\n const blockSize = boundingClientRect.height;\n const inlineSize = boundingClientRect.width;\n const insetBlockStart = boundingClientRect.top;\n const insetBlockEnd = boundingClientRect.bottom;\n const insetInlineStart = getIsRtl(element)\n ? document.documentElement.clientWidth - boundingClientRect.right\n : boundingClientRect.left;\n const insetInlineEnd = insetInlineStart + inlineSize;\n\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetBlockEnd,\n insetInlineStart,\n insetInlineEnd,\n };\n}\n\n/**\n * The pageX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalPageX(event: MouseEvent) {\n return event.target instanceof HTMLElement && getIsRtl(event.target)\n ? document.documentElement.clientWidth - event.pageX\n : event.pageX;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (8f694589)";
2
+ export var PACKAGE_VERSION = "3.0.0 (365869a6)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (8f694589)",
3
+ "PACKAGE_VERSION": "3.0.0 (365869a6)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "8f694589be7e61c091c04ec8831369259d3b3dfc"
2
+ "commit": "365869a60717d4833051ca758b6b1d0da22339e4"
3
3
  }
@@ -16,6 +16,7 @@ export interface BarSeriesProps<T> {
16
16
  dimmed: boolean;
17
17
  highlightedGroupIndex: number | null;
18
18
  stackedBarValues?: StackedBarValues;
19
+ isRtl?: boolean;
19
20
  }
20
- export default function BarSeries<T extends ChartDataTypes>({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, }: BarSeriesProps<T>): JSX.Element;
21
+ export default function BarSeries<T extends ChartDataTypes>({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, isRtl, }: BarSeriesProps<T>): JSX.Element;
21
22
  //# sourceMappingURL=bar-series.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-series.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO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,GAAG,CAAC;IAEhB,MAAM,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEhD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,EAC1D,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,MAAM,EACN,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,GACN,EAAE,cAAc,CAAC,CAAC,CAAC,eAiInB"}
@@ -6,7 +6,7 @@ import { matchesX, getKeyValue } from './utils';
6
6
  import styles from './styles.css.js';
7
7
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
8
8
  import { createOneSideRoundedRectPath } from './create-one-side-rounded-rect-path';
9
- export default function BarSeries({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, }) {
9
+ export default function BarSeries({ axis, series, color, xScale, yScale, highlighted, dimmed, highlightedGroupIndex, totalSeriesCount, seriesIndex, plotSize, chartAreaClipPath, stackedBarValues, isRtl, }) {
10
10
  const isRefresh = useVisualRefresh();
11
11
  const isStacked = !!stackedBarValues;
12
12
  const isVertical = axis === 'x';
@@ -81,7 +81,7 @@ export default function BarSeries({ axis, series, color, xScale, yScale, highlig
81
81
  height: height - heightOffset,
82
82
  }
83
83
  : {
84
- x: y - height + heightOffset / 2,
84
+ x: y - (!isRtl ? height : 0) + heightOffset / 2,
85
85
  y: x + widthOffset / 2,
86
86
  width: height - heightOffset,
87
87
  height: width - widthOffset,
@@ -100,9 +100,12 @@ export default function BarSeries({ axis, series, color, xScale, yScale, highlig
100
100
  else if (isVertical) {
101
101
  side = isRoundedStart ? 'bottom' : 'top';
102
102
  }
103
- else {
103
+ else if (!isRtl) {
104
104
  side = isRoundedStart ? 'left' : 'right';
105
105
  }
106
+ else {
107
+ side = isRoundedStart ? 'right' : 'left';
108
+ }
106
109
  if (side === 'all') {
107
110
  return React.createElement("rect", Object.assign({ key: i }, placement, styleProps, { rx: rx }));
108
111
  }