@cloudscape-design/components 3.0.847 → 3.0.849

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 (39) hide show
  1. package/internal/environment.js +1 -1
  2. package/internal/environment.json +1 -1
  3. package/internal/manifest.json +1 -1
  4. package/package.json +1 -1
  5. package/s3-resource-selector/s3-modal/buckets-table.js +7 -7
  6. package/s3-resource-selector/s3-modal/buckets-table.js.map +1 -1
  7. package/table/body-cell/inline-editor.js +1 -1
  8. package/table/body-cell/inline-editor.js.map +1 -1
  9. package/table/body-cell/styles.css.js +45 -46
  10. package/table/body-cell/styles.scoped.css +382 -304
  11. package/table/body-cell/styles.selectors.js +45 -46
  12. package/table/body-cell/td-element.d.ts +2 -1
  13. package/table/body-cell/td-element.d.ts.map +1 -1
  14. package/table/body-cell/td-element.js +4 -3
  15. package/table/body-cell/td-element.js.map +1 -1
  16. package/table/column-widths-utils.d.ts +6 -1
  17. package/table/column-widths-utils.d.ts.map +1 -1
  18. package/table/column-widths-utils.js.map +1 -1
  19. package/table/header-cell/index.d.ts +3 -2
  20. package/table/header-cell/index.d.ts.map +1 -1
  21. package/table/header-cell/index.js +2 -2
  22. package/table/header-cell/index.js.map +1 -1
  23. package/table/header-cell/th-element.d.ts +3 -2
  24. package/table/header-cell/th-element.d.ts.map +1 -1
  25. package/table/header-cell/th-element.js +2 -2
  26. package/table/header-cell/th-element.js.map +1 -1
  27. package/table/internal.d.ts.map +1 -1
  28. package/table/internal.js +5 -7
  29. package/table/internal.js.map +1 -1
  30. package/table/styles.css.js +34 -34
  31. package/table/styles.scoped.css +42 -41
  32. package/table/styles.selectors.js +34 -34
  33. package/table/thead.js +1 -1
  34. package/table/thead.js.map +1 -1
  35. package/table/use-column-widths.d.ts +3 -5
  36. package/table/use-column-widths.d.ts.map +1 -1
  37. package/table/use-column-widths.js.map +1 -1
  38. package/wizard/interfaces.d.ts +1 -1
  39. package/wizard/interfaces.js.map +1 -1
@@ -2,39 +2,39 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_wih1l_1cend_153",
6
- "tools": "awsui_tools_wih1l_1cend_164",
7
- "tools-filtering": "awsui_tools-filtering_wih1l_1cend_172",
8
- "tools-align-right": "awsui_tools-align-right_wih1l_1cend_186",
9
- "tools-pagination": "awsui_tools-pagination_wih1l_1cend_190",
10
- "tools-preferences": "awsui_tools-preferences_wih1l_1cend_190",
11
- "tools-small": "awsui_tools-small_wih1l_1cend_196",
12
- "table": "awsui_table_wih1l_1cend_202",
13
- "table-layout-fixed": "awsui_table-layout-fixed_wih1l_1cend_208",
14
- "wrapper": "awsui_wrapper_wih1l_1cend_212",
15
- "variant-stacked": "awsui_variant-stacked_wih1l_1cend_219",
16
- "wrapper-content-measure": "awsui_wrapper-content-measure_wih1l_1cend_219",
17
- "variant-container": "awsui_variant-container_wih1l_1cend_219",
18
- "has-footer": "awsui_has-footer_wih1l_1cend_222",
19
- "has-header": "awsui_has-header_wih1l_1cend_225",
20
- "cell-merged": "awsui_cell-merged_wih1l_1cend_242",
21
- "cell-merged-content": "awsui_cell-merged-content_wih1l_1cend_254",
22
- "empty": "awsui_empty_wih1l_1cend_270",
23
- "loading": "awsui_loading_wih1l_1cend_274",
24
- "selection-control": "awsui_selection-control_wih1l_1cend_283",
25
- "selection-control-header": "awsui_selection-control-header_wih1l_1cend_290",
26
- "header-secondary": "awsui_header-secondary_wih1l_1cend_296",
27
- "variant-full-page": "awsui_variant-full-page_wih1l_1cend_308",
28
- "table-has-header": "awsui_table-has-header_wih1l_1cend_314",
29
- "header-controls": "awsui_header-controls_wih1l_1cend_325",
30
- "variant-embedded": "awsui_variant-embedded_wih1l_1cend_334",
31
- "variant-borderless": "awsui_variant-borderless_wih1l_1cend_334",
32
- "footer-wrapper": "awsui_footer-wrapper_wih1l_1cend_339",
33
- "footer": "awsui_footer_wih1l_1cend_339",
34
- "footer-with-pagination": "awsui_footer-with-pagination_wih1l_1cend_347",
35
- "footer-pagination": "awsui_footer-pagination_wih1l_1cend_355",
36
- "thead-active": "awsui_thead-active_wih1l_1cend_359",
37
- "row": "awsui_row_wih1l_1cend_360",
38
- "row-selected": "awsui_row-selected_wih1l_1cend_361"
5
+ "root": "awsui_root_wih1l_g0tym_153",
6
+ "tools": "awsui_tools_wih1l_g0tym_164",
7
+ "tools-filtering": "awsui_tools-filtering_wih1l_g0tym_172",
8
+ "tools-align-right": "awsui_tools-align-right_wih1l_g0tym_186",
9
+ "tools-pagination": "awsui_tools-pagination_wih1l_g0tym_190",
10
+ "tools-preferences": "awsui_tools-preferences_wih1l_g0tym_190",
11
+ "tools-small": "awsui_tools-small_wih1l_g0tym_196",
12
+ "table": "awsui_table_wih1l_g0tym_202",
13
+ "table-layout-fixed": "awsui_table-layout-fixed_wih1l_g0tym_209",
14
+ "wrapper": "awsui_wrapper_wih1l_g0tym_213",
15
+ "variant-stacked": "awsui_variant-stacked_wih1l_g0tym_220",
16
+ "wrapper-content-measure": "awsui_wrapper-content-measure_wih1l_g0tym_220",
17
+ "variant-container": "awsui_variant-container_wih1l_g0tym_220",
18
+ "has-footer": "awsui_has-footer_wih1l_g0tym_223",
19
+ "has-header": "awsui_has-header_wih1l_g0tym_226",
20
+ "cell-merged": "awsui_cell-merged_wih1l_g0tym_243",
21
+ "cell-merged-content": "awsui_cell-merged-content_wih1l_g0tym_255",
22
+ "empty": "awsui_empty_wih1l_g0tym_271",
23
+ "loading": "awsui_loading_wih1l_g0tym_275",
24
+ "selection-control": "awsui_selection-control_wih1l_g0tym_284",
25
+ "selection-control-header": "awsui_selection-control-header_wih1l_g0tym_291",
26
+ "header-secondary": "awsui_header-secondary_wih1l_g0tym_297",
27
+ "variant-full-page": "awsui_variant-full-page_wih1l_g0tym_309",
28
+ "table-has-header": "awsui_table-has-header_wih1l_g0tym_315",
29
+ "header-controls": "awsui_header-controls_wih1l_g0tym_326",
30
+ "variant-embedded": "awsui_variant-embedded_wih1l_g0tym_335",
31
+ "variant-borderless": "awsui_variant-borderless_wih1l_g0tym_335",
32
+ "footer-wrapper": "awsui_footer-wrapper_wih1l_g0tym_340",
33
+ "footer": "awsui_footer_wih1l_g0tym_340",
34
+ "footer-with-pagination": "awsui_footer-with-pagination_wih1l_g0tym_348",
35
+ "footer-pagination": "awsui_footer-pagination_wih1l_g0tym_356",
36
+ "thead-active": "awsui_thead-active_wih1l_g0tym_360",
37
+ "row": "awsui_row_wih1l_g0tym_361",
38
+ "row-selected": "awsui_row-selected_wih1l_g0tym_362"
39
39
  };
40
40
 
package/table/thead.js CHANGED
@@ -35,7 +35,7 @@ const Thead = React.forwardRef(({ selectionType, getSelectAllProps, columnDefini
35
35
  })))) : null,
36
36
  columnDefinitions.map((column, colIndex) => {
37
37
  const columnId = getColumnKey(column, colIndex);
38
- return (React.createElement(TableHeaderCell, Object.assign({}, commonCellProps, { key: columnId, style: getColumnStyles(sticky, columnId), tabIndex: sticky ? -1 : 0, focusedComponent: focusedComponent, column: column, activeSortingColumn: sortingColumn, sortingDescending: sortingDescending, sortingDisabled: sortingDisabled, wrapLines: wrapLines, colIndex: selectionType ? colIndex + 1 : colIndex, columnId: columnId, updateColumn: updateColumn, onResizeFinish: () => onResizeFinish(columnWidths), resizableColumns: resizableColumns, onClick: detail => {
38
+ return (React.createElement(TableHeaderCell, Object.assign({}, commonCellProps, { key: columnId, tabIndex: sticky ? -1 : 0, focusedComponent: focusedComponent, column: column, activeSortingColumn: sortingColumn, sortingDescending: sortingDescending, sortingDisabled: sortingDisabled, wrapLines: wrapLines, colIndex: selectionType ? colIndex + 1 : colIndex, columnId: columnId, updateColumn: updateColumn, onResizeFinish: () => onResizeFinish(columnWidths), resizableColumns: resizableColumns, resizableStyle: getColumnStyles(sticky, columnId), onClick: detail => {
39
39
  setLastUserAction('sorting');
40
40
  fireNonCancelableEvent(onSortingChange, detail);
41
41
  }, isEditable: !!column.editConfig, cellRef: node => setCell(sticky, columnId, node), tableRole: tableRole, resizerRoleDescription: resizerRoleDescription,
@@ -1 +1 @@
1
- {"version":3,"file":"thead.js","sourceRoot":"","sources":["../../../src/table/thead.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAa,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AA8BrC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,EACE,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,WAAW,EACX,eAAe,EACf,cAAc,EACd,8BAA8B,EAC9B,WAAW,EACX,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACd,KAAK,GAAG,KAAK,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,GACN,EACb,QAAwC,EACxC,EAAE;IACF,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,eAAe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on.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { GeneratedAnalyticsMetadataTableSelectAll } from './analytics-metadata/interfaces';\nimport { TableHeaderCell } from './header-cell';\nimport { TableProps } from './interfaces';\nimport { focusMarkers, SelectionProps } from './selection';\nimport { TableHeaderSelectionCell } from './selection/selection-cell';\nimport { StickyColumnsModel } from './sticky-columns';\nimport { getTableHeaderRowRoleProps, TableRole } from './table-role';\nimport { useColumnWidths } from './use-column-widths';\nimport { getColumnKey } from './utils';\n\nimport styles from './styles.css.js';\n\nexport interface TheadProps {\n selectionType: TableProps.SelectionType | undefined;\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<any>>;\n sortingColumn: TableProps.SortingColumn<any> | undefined;\n sortingDescending: boolean | undefined;\n sortingDisabled: boolean | undefined;\n variant: TableProps.Variant;\n wrapLines: boolean | undefined;\n resizableColumns: boolean | undefined;\n getSelectAllProps?: () => SelectionProps;\n onFocusMove: ((sourceElement: HTMLElement, fromIndex: number, direction: -1 | 1) => void) | undefined;\n onResizeFinish: (newWidths: Map<PropertyKey, number>) => void;\n onSortingChange: NonCancelableEventHandler<TableProps.SortingState<any>> | undefined;\n sticky?: boolean;\n hidden?: boolean;\n stuck?: boolean;\n singleSelectionHeaderAriaLabel?: string;\n resizerRoleDescription?: string;\n stripedRows?: boolean;\n stickyState: StickyColumnsModel;\n selectionColumnId: PropertyKey;\n focusedComponent?: null | string;\n onFocusedComponentChange?: (focusId: null | string) => void;\n tableRole: TableRole;\n isExpandable?: boolean;\n setLastUserAction: (name: string) => void;\n}\n\nconst Thead = React.forwardRef(\n (\n {\n selectionType,\n getSelectAllProps,\n columnDefinitions,\n sortingColumn,\n sortingDisabled,\n sortingDescending,\n resizableColumns,\n variant,\n wrapLines,\n onFocusMove,\n onSortingChange,\n onResizeFinish,\n singleSelectionHeaderAriaLabel,\n stripedRows,\n sticky = false,\n hidden = false,\n stuck = false,\n stickyState,\n selectionColumnId,\n focusedComponent,\n onFocusedComponentChange,\n tableRole,\n resizerRoleDescription,\n isExpandable,\n setLastUserAction,\n }: TheadProps,\n outerRef: React.Ref<HTMLTableRowElement>\n ) => {\n const { getColumnStyles, columnWidths, updateColumn, setCell } = useColumnWidths();\n\n const commonCellProps = {\n stuck,\n sticky,\n hidden,\n stripedRows,\n tableRole,\n variant,\n stickyState,\n };\n\n return (\n <thead className={clsx(!hidden && styles['thead-active'])}>\n <tr\n {...focusMarkers.all}\n ref={outerRef}\n aria-rowindex={1}\n {...getTableHeaderRowRoleProps({ tableRole })}\n onFocus={event => {\n const focusControlElement = findUpUntil(event.target, element => !!element.getAttribute('data-focus-id'));\n const focusId = focusControlElement?.getAttribute('data-focus-id') ?? null;\n onFocusedComponentChange?.(focusId);\n }}\n onBlur={() => onFocusedComponentChange?.(null)}\n >\n {selectionType ? (\n <TableHeaderSelectionCell\n {...commonCellProps}\n focusedComponent={focusedComponent}\n columnId={selectionColumnId}\n getSelectAllProps={getSelectAllProps}\n onFocusMove={onFocusMove}\n singleSelectionHeaderAriaLabel={singleSelectionHeaderAriaLabel}\n {...getAnalyticsMetadataAttribute({\n action: 'selectAll',\n } as Partial<GeneratedAnalyticsMetadataTableSelectAll>)}\n />\n ) : null}\n\n {columnDefinitions.map((column, colIndex) => {\n const columnId = getColumnKey(column, colIndex);\n return (\n <TableHeaderCell\n {...commonCellProps}\n key={columnId}\n style={getColumnStyles(sticky, columnId)}\n tabIndex={sticky ? -1 : 0}\n focusedComponent={focusedComponent}\n column={column}\n activeSortingColumn={sortingColumn}\n sortingDescending={sortingDescending}\n sortingDisabled={sortingDisabled}\n wrapLines={wrapLines}\n colIndex={selectionType ? colIndex + 1 : colIndex}\n columnId={columnId}\n updateColumn={updateColumn}\n onResizeFinish={() => onResizeFinish(columnWidths)}\n resizableColumns={resizableColumns}\n onClick={detail => {\n setLastUserAction('sorting');\n fireNonCancelableEvent(onSortingChange, detail);\n }}\n isEditable={!!column.editConfig}\n cellRef={node => setCell(sticky, columnId, node)}\n tableRole={tableRole}\n resizerRoleDescription={resizerRoleDescription}\n // Expandable option is only applicable to the first data column of the table.\n // When present, the header content receives extra padding to match the first offset in the data cells.\n isExpandable={colIndex === 0 && isExpandable}\n hasDynamicContent={hidden && !resizableColumns && column.hasDynamicContent}\n />\n );\n })}\n </tr>\n </thead>\n );\n }\n);\n\nexport default Thead;\n"]}
1
+ {"version":3,"file":"thead.js","sourceRoot":"","sources":["../../../src/table/thead.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAa,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AA8BrC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,EACE,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,gBAAgB,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QAAQ,EAAE,IAAI,CAAC,EAChD,SAAS,EAAE,SAAS,EACpB,sBAAsB,EAAE,sBAAsB;oBAC9C,8EAA8E;oBAC9E,uGAAuG;oBACvG,YAAY,EAAE,QAAQ,KAAK,CAAC,IAAI,YAAY,EAC5C,iBAAiB,EAAE,MAAM,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,iBAAiB,IAC1E,CACH,CAAC;YACJ,CAAC,CAAC,CACC,CACC,CACT,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { GeneratedAnalyticsMetadataTableSelectAll } from './analytics-metadata/interfaces';\nimport { TableHeaderCell } from './header-cell';\nimport { TableProps } from './interfaces';\nimport { focusMarkers, SelectionProps } from './selection';\nimport { TableHeaderSelectionCell } from './selection/selection-cell';\nimport { StickyColumnsModel } from './sticky-columns';\nimport { getTableHeaderRowRoleProps, TableRole } from './table-role';\nimport { useColumnWidths } from './use-column-widths';\nimport { getColumnKey } from './utils';\n\nimport styles from './styles.css.js';\n\nexport interface TheadProps {\n selectionType: TableProps.SelectionType | undefined;\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<any>>;\n sortingColumn: TableProps.SortingColumn<any> | undefined;\n sortingDescending: boolean | undefined;\n sortingDisabled: boolean | undefined;\n variant: TableProps.Variant;\n wrapLines: boolean | undefined;\n resizableColumns: boolean | undefined;\n getSelectAllProps?: () => SelectionProps;\n onFocusMove: ((sourceElement: HTMLElement, fromIndex: number, direction: -1 | 1) => void) | undefined;\n onResizeFinish: (newWidths: Map<PropertyKey, number>) => void;\n onSortingChange: NonCancelableEventHandler<TableProps.SortingState<any>> | undefined;\n sticky?: boolean;\n hidden?: boolean;\n stuck?: boolean;\n singleSelectionHeaderAriaLabel?: string;\n resizerRoleDescription?: string;\n stripedRows?: boolean;\n stickyState: StickyColumnsModel;\n selectionColumnId: PropertyKey;\n focusedComponent?: null | string;\n onFocusedComponentChange?: (focusId: null | string) => void;\n tableRole: TableRole;\n isExpandable?: boolean;\n setLastUserAction: (name: string) => void;\n}\n\nconst Thead = React.forwardRef(\n (\n {\n selectionType,\n getSelectAllProps,\n columnDefinitions,\n sortingColumn,\n sortingDisabled,\n sortingDescending,\n resizableColumns,\n variant,\n wrapLines,\n onFocusMove,\n onSortingChange,\n onResizeFinish,\n singleSelectionHeaderAriaLabel,\n stripedRows,\n sticky = false,\n hidden = false,\n stuck = false,\n stickyState,\n selectionColumnId,\n focusedComponent,\n onFocusedComponentChange,\n tableRole,\n resizerRoleDescription,\n isExpandable,\n setLastUserAction,\n }: TheadProps,\n outerRef: React.Ref<HTMLTableRowElement>\n ) => {\n const { getColumnStyles, columnWidths, updateColumn, setCell } = useColumnWidths();\n\n const commonCellProps = {\n stuck,\n sticky,\n hidden,\n stripedRows,\n tableRole,\n variant,\n stickyState,\n };\n\n return (\n <thead className={clsx(!hidden && styles['thead-active'])}>\n <tr\n {...focusMarkers.all}\n ref={outerRef}\n aria-rowindex={1}\n {...getTableHeaderRowRoleProps({ tableRole })}\n onFocus={event => {\n const focusControlElement = findUpUntil(event.target, element => !!element.getAttribute('data-focus-id'));\n const focusId = focusControlElement?.getAttribute('data-focus-id') ?? null;\n onFocusedComponentChange?.(focusId);\n }}\n onBlur={() => onFocusedComponentChange?.(null)}\n >\n {selectionType ? (\n <TableHeaderSelectionCell\n {...commonCellProps}\n focusedComponent={focusedComponent}\n columnId={selectionColumnId}\n getSelectAllProps={getSelectAllProps}\n onFocusMove={onFocusMove}\n singleSelectionHeaderAriaLabel={singleSelectionHeaderAriaLabel}\n {...getAnalyticsMetadataAttribute({\n action: 'selectAll',\n } as Partial<GeneratedAnalyticsMetadataTableSelectAll>)}\n />\n ) : null}\n\n {columnDefinitions.map((column, colIndex) => {\n const columnId = getColumnKey(column, colIndex);\n return (\n <TableHeaderCell\n {...commonCellProps}\n key={columnId}\n tabIndex={sticky ? -1 : 0}\n focusedComponent={focusedComponent}\n column={column}\n activeSortingColumn={sortingColumn}\n sortingDescending={sortingDescending}\n sortingDisabled={sortingDisabled}\n wrapLines={wrapLines}\n colIndex={selectionType ? colIndex + 1 : colIndex}\n columnId={columnId}\n updateColumn={updateColumn}\n onResizeFinish={() => onResizeFinish(columnWidths)}\n resizableColumns={resizableColumns}\n resizableStyle={getColumnStyles(sticky, columnId)}\n onClick={detail => {\n setLastUserAction('sorting');\n fireNonCancelableEvent(onSortingChange, detail);\n }}\n isEditable={!!column.editConfig}\n cellRef={node => setCell(sticky, columnId, node)}\n tableRole={tableRole}\n resizerRoleDescription={resizerRoleDescription}\n // Expandable option is only applicable to the first data column of the table.\n // When present, the header content receives extra padding to match the first offset in the data cells.\n isExpandable={colIndex === 0 && isExpandable}\n hasDynamicContent={hidden && !resizableColumns && column.hasDynamicContent}\n />\n );\n })}\n </tr>\n </thead>\n );\n }\n);\n\nexport default Thead;\n"]}
@@ -1,13 +1,11 @@
1
1
  import React from 'react';
2
+ import { ColumnWidthStyle } from './column-widths-utils';
2
3
  export declare const DEFAULT_COLUMN_WIDTH = 120;
3
- export interface ColumnWidthDefinition {
4
+ export interface ColumnWidthDefinition extends ColumnWidthStyle {
4
5
  id: PropertyKey;
5
- minWidth?: string | number;
6
- maxWidth?: string | number;
7
- width?: string | number;
8
6
  }
9
7
  interface WidthsContext {
10
- getColumnStyles(sticky: boolean, columnId: PropertyKey): React.CSSProperties;
8
+ getColumnStyles(sticky: boolean, columnId: PropertyKey): ColumnWidthStyle;
11
9
  columnWidths: Map<PropertyKey, number>;
12
10
  updateColumn: (columnId: PropertyKey, newWidth: number) => void;
13
11
  setCell: (sticky: boolean, columnId: PropertyKey, node: null | HTMLElement) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-column-widths.d.ts","sourceRoot":"","sources":["../../../src/table/use-column-widths.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAOtF,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,WAAW,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AA8CD,UAAU,aAAa;IACrB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC;IAC7E,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACvC,YAAY,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,KAAK,IAAI,CAAC;CACrF;AAED,QAAA,MAAM,aAAa,8BAKjB,CAAC;AAEH,UAAU,kBAAkB;IAC1B,cAAc,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjD,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,kBAAkB,eAwHpH;AAED,wBAAgB,eAAe,kBAE9B"}
1
+ {"version":3,"file":"use-column-widths.d.ts","sourceRoot":"","sources":["../../../src/table/use-column-widths.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiE,MAAM,OAAO,CAAC;AAKtF,OAAO,EAAE,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAE3E,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,EAAE,EAAE,WAAW,CAAC;CACjB;AA8CD,UAAU,aAAa;IACrB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,gBAAgB,CAAC;IAC1E,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACvC,YAAY,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,KAAK,IAAI,CAAC;CACrF;AAED,QAAA,MAAM,aAAa,8BAKjB,CAAC;AAEH,UAAU,kBAAkB;IAC1B,cAAc,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjD,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,kBAAkB,eAwHpH;AAED,wBAAgB,eAAe,kBAE9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-column-widths.js","sourceRoot":"","sources":["../../../src/table/use-column-widths.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,E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SPDX-License-Identifier: Apache-2.0\nimport React, { createContext, useContext, useEffect, useRef, useState } from 'react';\n\nimport { useResizeObserver, useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { setElementWidths } from './column-widths-utils';\n\nexport const DEFAULT_COLUMN_WIDTH = 120;\n\nexport interface ColumnWidthDefinition {\n id: PropertyKey;\n minWidth?: string | number;\n maxWidth?: string | number;\n width?: string | number;\n}\n\nfunction readWidths(\n getCell: (columnId: PropertyKey) => null | HTMLElement,\n visibleColumns: readonly ColumnWidthDefinition[]\n) {\n const result = new Map<PropertyKey, number>();\n for (let index = 0; index < visibleColumns.length; index++) {\n const column = visibleColumns[index];\n let width = (column.width as number) || 0;\n const minWidth = (column.minWidth as number) || width || DEFAULT_COLUMN_WIDTH;\n if (\n !width && // read width from the DOM if it is missing in the config\n index !== visibleColumns.length - 1 // skip reading for the last column, because it expands to fully fit the container\n ) {\n const colEl = getCell(column.id);\n width = colEl ? getLogicalBoundingClientRect(colEl).inlineSize : DEFAULT_COLUMN_WIDTH;\n }\n result.set(column.id, Math.max(width, minWidth));\n }\n return result;\n}\n\nfunction updateWidths(\n visibleColumns: readonly ColumnWidthDefinition[],\n oldWidths: Map<PropertyKey, number>,\n newWidth: number,\n columnId: PropertyKey\n) {\n const column = visibleColumns.find(column => column.id === columnId);\n let minWidth = DEFAULT_COLUMN_WIDTH;\n if (typeof column?.width === 'number' && column.width < DEFAULT_COLUMN_WIDTH) {\n minWidth = column?.width;\n }\n if (typeof column?.minWidth === 'number') {\n minWidth = column?.minWidth;\n }\n newWidth = Math.max(newWidth, minWidth);\n if (oldWidths.get(columnId) === newWidth) {\n return oldWidths;\n }\n const newWidths = new Map(oldWidths);\n newWidths.set(columnId, newWidth);\n return newWidths;\n}\n\ninterface WidthsContext {\n getColumnStyles(sticky: boolean, columnId: PropertyKey): React.CSSProperties;\n columnWidths: Map<PropertyKey, number>;\n updateColumn: (columnId: PropertyKey, newWidth: number) => void;\n setCell: (sticky: boolean, columnId: PropertyKey, node: null | HTMLElement) => void;\n}\n\nconst WidthsContext = createContext<WidthsContext>({\n getColumnStyles: () => ({}),\n columnWidths: new Map(),\n updateColumn: () => {},\n setCell: () => {},\n});\n\ninterface WidthProviderProps {\n visibleColumns: readonly ColumnWidthDefinition[];\n resizableColumns: boolean | undefined;\n containerRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nexport function ColumnWidthsProvider({ visibleColumns, resizableColumns, containerRef, children }: WidthProviderProps) {\n const visibleColumnsRef = useRef<PropertyKey[] | null>(null);\n const containerWidthRef = useRef(0);\n const [columnWidths, setColumnWidths] = useState<null | Map<PropertyKey, number>>(null);\n\n const cellsRef = useRef(new Map<PropertyKey, HTMLElement>());\n const stickyCellsRef = useRef(new Map<PropertyKey, HTMLElement>());\n const getCell = (columnId: PropertyKey): null | HTMLElement => cellsRef.current.get(columnId) ?? null;\n const setCell = (sticky: boolean, columnId: PropertyKey, node: null | HTMLElement) => {\n const ref = sticky ? stickyCellsRef : cellsRef;\n if (node) {\n ref.current.set(columnId, node);\n } else {\n ref.current.delete(columnId);\n }\n };\n\n const getColumnStyles = (sticky: boolean, columnId: PropertyKey): React.CSSProperties => {\n const column = visibleColumns.find(column => column.id === columnId);\n if (!column) {\n return {};\n }\n\n if (sticky) {\n return {\n width:\n cellsRef.current.get(column.id)?.getBoundingClientRect().width ||\n (columnWidths?.get(column.id) ?? column.width),\n };\n }\n\n if (resizableColumns && columnWidths) {\n const isLastColumn = column.id === visibleColumns[visibleColumns.length - 1]?.id;\n const totalWidth = visibleColumns.reduce(\n (sum, { id }) => sum + (columnWidths.get(id) || DEFAULT_COLUMN_WIDTH),\n 0\n );\n if (isLastColumn && containerWidthRef.current > totalWidth) {\n return { width: 'auto', minWidth: column?.minWidth };\n } else {\n return { width: columnWidths.get(column.id), minWidth: column?.minWidth };\n }\n }\n return {\n width: column.width,\n minWidth: column.minWidth,\n maxWidth: !resizableColumns ? column.maxWidth : undefined,\n };\n };\n\n // Imperatively sets width style for a cell avoiding React state.\n // This allows setting the style as soon container's size change is observed.\n const updateColumnWidths = useStableCallback(() => {\n for (const { id } of visibleColumns) {\n const element = cellsRef.current.get(id);\n if (element) {\n setElementWidths(element, getColumnStyles(false, id));\n }\n }\n // Sticky column widths must be synchronized once all real column widths are assigned.\n for (const { id } of visibleColumns) {\n const element = stickyCellsRef.current.get(id);\n if (element) {\n setElementWidths(element, getColumnStyles(true, id));\n }\n }\n });\n\n // Observes container size and requests an update to the last cell width as it depends on the container's width.\n useResizeObserver(containerRef, ({ contentBoxWidth: containerWidth }) => {\n containerWidthRef.current = containerWidth;\n requestAnimationFrame(() => updateColumnWidths());\n });\n\n // The widths of the dynamically added columns (after the first render) if not set explicitly\n // will default to the DEFAULT_COLUMN_WIDTH.\n useEffect(() => {\n updateColumnWidths();\n\n if (!resizableColumns) {\n return;\n }\n let updated = false;\n const newColumnWidths = new Map(columnWidths);\n const lastVisible = visibleColumnsRef.current;\n if (lastVisible) {\n for (let index = 0; index < visibleColumns.length; index++) {\n const column = visibleColumns[index];\n if (!columnWidths?.get(column.id) && lastVisible.indexOf(column.id) === -1) {\n updated = true;\n newColumnWidths.set(column.id, (column.width as number) || DEFAULT_COLUMN_WIDTH);\n }\n }\n if (updated) {\n setColumnWidths(newColumnWidths);\n }\n }\n visibleColumnsRef.current = visibleColumns.map(column => column.id);\n }, [columnWidths, resizableColumns, visibleColumns, updateColumnWidths]);\n\n // Read the actual column widths after the first render to employ the browser defaults for\n // those columns without explicit width.\n useEffect(() => {\n if (!resizableColumns) {\n return;\n }\n setColumnWidths(() => readWidths(getCell, visibleColumns));\n // This code is intended to run only at the first render and should not re-run when table props change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n function updateColumn(columnId: PropertyKey, newWidth: number) {\n setColumnWidths(columnWidths => updateWidths(visibleColumns, columnWidths ?? new Map(), newWidth, columnId));\n }\n\n return (\n <WidthsContext.Provider value={{ getColumnStyles, columnWidths: columnWidths ?? new Map(), updateColumn, setCell }}>\n {children}\n </WidthsContext.Provider>\n );\n}\n\nexport function useColumnWidths() {\n return useContext(WidthsContext);\n}\n"]}
1
+ {"version":3,"file":"use-column-widths.js","sourceRoot":"","sources":["../../../src/table/use-column-widths.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAoB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAMxC,SAAS,UAAU,CACjB,OAAsD,EACtD,cAAgD;IAEhD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC1D,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,KAAK,GAAI,MAAM,CAAC,KAAgB,IAAI,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAI,MAAM,CAAC,QAAmB,IAAI,KAAK,IAAI,oBAAoB,CAAC;QAC9E,IACE,CAAC,KAAK,IAAI,yDAAyD;YACnE,KAAK,KAAK,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,kFAAkF;UACtH;YACA,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAA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C,QAAQ,IAAC,KAAK,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,GAAG,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,IAC/G,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { createContext, useContext, useEffect, useRef, useState } from 'react';\n\nimport { useResizeObserver, useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ColumnWidthStyle, setElementWidths } from './column-widths-utils';\n\nexport const DEFAULT_COLUMN_WIDTH = 120;\n\nexport interface ColumnWidthDefinition extends ColumnWidthStyle {\n id: PropertyKey;\n}\n\nfunction readWidths(\n getCell: (columnId: PropertyKey) => null | HTMLElement,\n visibleColumns: readonly ColumnWidthDefinition[]\n) {\n const result = new Map<PropertyKey, number>();\n for (let index = 0; index < visibleColumns.length; index++) {\n const column = visibleColumns[index];\n let width = (column.width as number) || 0;\n const minWidth = (column.minWidth as number) || width || DEFAULT_COLUMN_WIDTH;\n if (\n !width && // read width from the DOM if it is missing in the config\n index !== visibleColumns.length - 1 // skip reading for the last column, because it expands to fully fit the container\n ) {\n const colEl = getCell(column.id);\n width = colEl ? getLogicalBoundingClientRect(colEl).inlineSize : DEFAULT_COLUMN_WIDTH;\n }\n result.set(column.id, Math.max(width, minWidth));\n }\n return result;\n}\n\nfunction updateWidths(\n visibleColumns: readonly ColumnWidthDefinition[],\n oldWidths: Map<PropertyKey, number>,\n newWidth: number,\n columnId: PropertyKey\n) {\n const column = visibleColumns.find(column => column.id === columnId);\n let minWidth = DEFAULT_COLUMN_WIDTH;\n if (typeof column?.width === 'number' && column.width < DEFAULT_COLUMN_WIDTH) {\n minWidth = column?.width;\n }\n if (typeof column?.minWidth === 'number') {\n minWidth = column?.minWidth;\n }\n newWidth = Math.max(newWidth, minWidth);\n if (oldWidths.get(columnId) === newWidth) {\n return oldWidths;\n }\n const newWidths = new Map(oldWidths);\n newWidths.set(columnId, newWidth);\n return newWidths;\n}\n\ninterface WidthsContext {\n getColumnStyles(sticky: boolean, columnId: PropertyKey): ColumnWidthStyle;\n columnWidths: Map<PropertyKey, number>;\n updateColumn: (columnId: PropertyKey, newWidth: number) => void;\n setCell: (sticky: boolean, columnId: PropertyKey, node: null | HTMLElement) => void;\n}\n\nconst WidthsContext = createContext<WidthsContext>({\n getColumnStyles: () => ({}),\n columnWidths: new Map(),\n updateColumn: () => {},\n setCell: () => {},\n});\n\ninterface WidthProviderProps {\n visibleColumns: readonly ColumnWidthDefinition[];\n resizableColumns: boolean | undefined;\n containerRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nexport function ColumnWidthsProvider({ visibleColumns, resizableColumns, containerRef, children }: WidthProviderProps) {\n const visibleColumnsRef = useRef<PropertyKey[] | null>(null);\n const containerWidthRef = useRef(0);\n const [columnWidths, setColumnWidths] = useState<null | Map<PropertyKey, number>>(null);\n\n const cellsRef = useRef(new Map<PropertyKey, HTMLElement>());\n const stickyCellsRef = useRef(new Map<PropertyKey, HTMLElement>());\n const getCell = (columnId: PropertyKey): null | HTMLElement => cellsRef.current.get(columnId) ?? null;\n const setCell = (sticky: boolean, columnId: PropertyKey, node: null | HTMLElement) => {\n const ref = sticky ? stickyCellsRef : cellsRef;\n if (node) {\n ref.current.set(columnId, node);\n } else {\n ref.current.delete(columnId);\n }\n };\n\n const getColumnStyles = (sticky: boolean, columnId: PropertyKey): ColumnWidthStyle => {\n const column = visibleColumns.find(column => column.id === columnId);\n if (!column) {\n return {};\n }\n\n if (sticky) {\n return {\n width:\n cellsRef.current.get(column.id)?.getBoundingClientRect().width ||\n (columnWidths?.get(column.id) ?? column.width),\n };\n }\n\n if (resizableColumns && columnWidths) {\n const isLastColumn = column.id === visibleColumns[visibleColumns.length - 1]?.id;\n const totalWidth = visibleColumns.reduce(\n (sum, { id }) => sum + (columnWidths.get(id) || DEFAULT_COLUMN_WIDTH),\n 0\n );\n if (isLastColumn && containerWidthRef.current > totalWidth) {\n return { width: 'auto', minWidth: column?.minWidth };\n } else {\n return { width: columnWidths.get(column.id), minWidth: column?.minWidth };\n }\n }\n return {\n width: column.width,\n minWidth: column.minWidth,\n maxWidth: !resizableColumns ? column.maxWidth : undefined,\n };\n };\n\n // Imperatively sets width style for a cell avoiding React state.\n // This allows setting the style as soon container's size change is observed.\n const updateColumnWidths = useStableCallback(() => {\n for (const { id } of visibleColumns) {\n const element = cellsRef.current.get(id);\n if (element) {\n setElementWidths(element, getColumnStyles(false, id));\n }\n }\n // Sticky column widths must be synchronized once all real column widths are assigned.\n for (const { id } of visibleColumns) {\n const element = stickyCellsRef.current.get(id);\n if (element) {\n setElementWidths(element, getColumnStyles(true, id));\n }\n }\n });\n\n // Observes container size and requests an update to the last cell width as it depends on the container's width.\n useResizeObserver(containerRef, ({ contentBoxWidth: containerWidth }) => {\n containerWidthRef.current = containerWidth;\n requestAnimationFrame(() => updateColumnWidths());\n });\n\n // The widths of the dynamically added columns (after the first render) if not set explicitly\n // will default to the DEFAULT_COLUMN_WIDTH.\n useEffect(() => {\n updateColumnWidths();\n\n if (!resizableColumns) {\n return;\n }\n let updated = false;\n const newColumnWidths = new Map(columnWidths);\n const lastVisible = visibleColumnsRef.current;\n if (lastVisible) {\n for (let index = 0; index < visibleColumns.length; index++) {\n const column = visibleColumns[index];\n if (!columnWidths?.get(column.id) && lastVisible.indexOf(column.id) === -1) {\n updated = true;\n newColumnWidths.set(column.id, (column.width as number) || DEFAULT_COLUMN_WIDTH);\n }\n }\n if (updated) {\n setColumnWidths(newColumnWidths);\n }\n }\n visibleColumnsRef.current = visibleColumns.map(column => column.id);\n }, [columnWidths, resizableColumns, visibleColumns, updateColumnWidths]);\n\n // Read the actual column widths after the first render to employ the browser defaults for\n // those columns without explicit width.\n useEffect(() => {\n if (!resizableColumns) {\n return;\n }\n setColumnWidths(() => readWidths(getCell, visibleColumns));\n // This code is intended to run only at the first render and should not re-run when table props change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n function updateColumn(columnId: PropertyKey, newWidth: number) {\n setColumnWidths(columnWidths => updateWidths(visibleColumns, columnWidths ?? new Map(), newWidth, columnId));\n }\n\n return (\n <WidthsContext.Provider value={{ getColumnStyles, columnWidths: columnWidths ?? new Map(), updateColumn, setCell }}>\n {children}\n </WidthsContext.Provider>\n );\n}\n\nexport function useColumnWidths() {\n return useContext(WidthsContext);\n}\n"]}
@@ -61,7 +61,7 @@ export interface WizardProps extends BaseComponentProps {
61
61
  * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.
62
62
  * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.
63
63
  * - `nextButton` (string) - The text of the button that enables the user to move to the next step.
64
- * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.
64
+ * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property. `submitButton` is not supported by the I18nProvider.
65
65
  * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.
66
66
  * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.
67
67
  * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace WizardProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n }\n}\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * @analytics\n */\n analyticsMetadata?: WizardProps.AnalyticsMetadata;\n\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n * - `analyticsMetadata` (WizardProps.StepAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * @analytics\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings?: WizardProps.I18nStrings;\n\n /**\n * The text of the button that enables the user to submit the form.\n */\n submitButtonText?: string;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface StepAnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n analyticsMetadata?: StepAnalyticsMetadata;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `submitButtonText` on the component instead.\n */\n submitButton?: string;\n\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { FlowType } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport namespace WizardProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n flowType?: FlowType;\n resourceType?: string;\n }\n}\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * * `flowType` - Identifies the type of flow represented by the component.\n * * `resourceType` - Identifies the type of resource represented by the flow. **Note:** This API is currently experimental.\n * @analytics\n */\n analyticsMetadata?: WizardProps.AnalyticsMetadata;\n\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n * - `analyticsMetadata` (WizardProps.StepAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * @analytics\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form. **Deprecated**, replaced by the `submitButtonText` component property. `submitButton` is not supported by the I18nProvider.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n * - `nextButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *next* button is in a loading state.\n * - `submitButtonLoadingAnnouncement` (string) - The text that a screen reader announces when the *submit* button is in a loading state.\n * @i18n\n */\n i18nStrings?: WizardProps.I18nStrings;\n\n /**\n * The text of the button that enables the user to submit the form.\n */\n submitButtonText?: string;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface StepAnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n analyticsMetadata?: StepAnalyticsMetadata;\n }\n\n export interface I18nStrings {\n /**\n * @deprecated Use `submitButtonText` on the component instead.\n */\n submitButton?: string;\n\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n optional?: string;\n nextButtonLoadingAnnouncement?: string;\n submitButtonLoadingAnnouncement?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}