gantri-components 2.251.0 → 2.252.0

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 (32) hide show
  1. package/dist/components/picture/__test__/infer-sizes-from-width.test.d.ts +1 -0
  2. package/dist/components/picture/helpers/index.d.ts +1 -0
  3. package/dist/components/picture/helpers/infer-sizes-from-width.d.ts +21 -0
  4. package/dist/components/picture/picture.types.d.ts +19 -1
  5. package/dist/components/table/components/after-row-component/after-row-component.d.ts +1 -2
  6. package/dist/components/table/components/cell-reorder-wrapper/cell-reorder-wrapper.d.ts +1 -2
  7. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.d.ts +1 -2
  8. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.helpers.d.ts +2 -2
  9. package/dist/components/table/components/table-actions-wrapper/hooks/useConfirmInteraction.d.ts +2 -2
  10. package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.d.ts +1 -2
  11. package/dist/components/table/components/table-draggable-row/helpers/flatten-table-rows/flatten-table-rows.d.ts +1 -2
  12. package/dist/components/table/components/table-draggable-row/helpers/is-row-reordering-disabled/is-row-reordering-disabled.d.ts +1 -2
  13. package/dist/components/table/components/table-draggable-row/table-draggable-row.d.ts +1 -2
  14. package/dist/components/table/components/table-footer/table-footer.d.ts +1 -2
  15. package/dist/components/table/components/table-header/components/selectable-row-header-wrapper/selectable-row-header-wrapper.d.ts +1 -2
  16. package/dist/components/table/components/table-header/table-header.d.ts +1 -2
  17. package/dist/components/table/components/table-row/helpers/get-row-component-props/get-row-component-props.d.ts +1 -2
  18. package/dist/components/table/components/table-row/table-row.d.ts +1 -2
  19. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/helpers/get-row-range/get-row-range.d.ts +2 -2
  20. package/dist/components/table/components/table-row-cells/components/selectable-row-cell-wrapper/selectable-row-cell-wrapper.d.ts +1 -2
  21. package/dist/components/table/components/table-row-cells/components/table-cell/table-cell.d.ts +1 -2
  22. package/dist/components/table/components/table-row-cells/table-row-cells.d.ts +1 -2
  23. package/dist/components/table/components/table-row-overlay/table-row-overlay.d.ts +1 -2
  24. package/dist/components/table/hooks/use-drag-and-drop-rows/use-drag-and-drop-rows.d.ts +2 -3
  25. package/dist/components/table/hooks/use-get-selected-table-rows-data/use-get-selected-table-rows-data.d.ts +1 -2
  26. package/dist/components/table/table.adapters.d.ts +3 -3
  27. package/dist/components/table/table.context.d.ts +1 -1
  28. package/dist/components/table/table.d.ts +1 -2
  29. package/dist/components/table/table.helpers.d.ts +1 -2
  30. package/dist/index.cjs.js +1 -1
  31. package/dist/index.esm.js +1 -1
  32. package/package.json +1 -3
@@ -3,3 +3,4 @@ export * from './build-cloudinary-url';
3
3
  export * from './build-srcset';
4
4
  export * from './build-placeholder';
5
5
  export * from './normalize-resolution-aware';
6
+ export * from './infer-sizes-from-width';
@@ -0,0 +1,21 @@
1
+ import { NormalizedResolutionAware } from './normalize-resolution-aware';
2
+ /**
3
+ * Build a `sizes` attribute string from a normalized `width` map so
4
+ * `<Picture width={...} />` doesn't need a hand-written `sizes`. The
5
+ * browser uses `sizes` together with each `<source>`'s `srcset` to pick
6
+ * a single variant per DPR — without an accurate value it defaults to
7
+ * `100vw` and over-fetches on small containers (e.g. a 400-px desktop
8
+ * card pulling the 1200w variant instead of 800w).
9
+ *
10
+ * width=400 → "400px"
11
+ * width={{ lg: 400, sm: 720 }} → "(max-width: 720px) 720px, 400px"
12
+ * width={{ lg: 400, md: 600, sm: 720 }} →
13
+ * "(max-width: 720px) 720px, (max-width: 1024px) 600px, 400px"
14
+ * width=undefined → undefined (caller should fall
15
+ * back to the default `100vw`)
16
+ *
17
+ * When a breakpoint has no explicit width, we substitute `100vw` for
18
+ * that segment so the inferred string never silently invents a desktop
19
+ * size from a sm-only spec.
20
+ */
21
+ export declare const inferSizesFromWidth: (widths: NormalizedResolutionAware<number>) => string | undefined;
@@ -29,6 +29,12 @@ export interface PictureProps extends PicturePassThroughProps {
29
29
  alt: string;
30
30
  /** Override auto-detection of how to render the asset. */
31
31
  as?: PictureAs;
32
+ /**
33
+ * Target render width in px. Drives **both** the container CSS width
34
+ * AND the Cloudinary srcset (DPR multipliers `1x / 2x / 3x` of this
35
+ * value). Use it alongside `fill` to keep the parent-driven layout
36
+ * while still capping the source bytes the browser fetches.
37
+ */
32
38
  width?: ResolutionAwareProp<number>;
33
39
  height?: ResolutionAwareProp<number>;
34
40
  /** e.g. "16:9", "1:1". Drives both CSS aspect-ratio and Cloudinary ar_ transformation. */
@@ -41,7 +47,19 @@ export interface PictureProps extends PicturePassThroughProps {
41
47
  minWidth?: ResolutionAwareProp<Property.MinWidth>;
42
48
  /** CSS min-height on the container. */
43
49
  minHeight?: ResolutionAwareProp<Property.MinHeight>;
44
- /** Image fills its (position: relative) parent. Mutually exclusive with width/height. */
50
+ /**
51
+ * Image fills its (`position: relative`) parent — CSS-wise the container
52
+ * becomes `position: absolute; inset: 0; width/height: 100%`, so the
53
+ * configured `width` / `height` props are ignored for layout.
54
+ *
55
+ * `width` is still honored as a **render hint for srcset**: when set
56
+ * alongside `fill`, the srcset is built from DPR multipliers
57
+ * `[width × 1, width × 2, width × 3]` instead of the default
58
+ * `[320, 640, 1024, 1600, 2400]`. Pair `<Picture fill width={400} />`
59
+ * (with `sizes="400px"` for accuracy) on a 400-px container so the
60
+ * browser fetches an 800-px source on Retina instead of the 1024 it
61
+ * would pick from the default set.
62
+ */
45
63
  fill?: boolean;
46
64
  /** Native sizes attribute. Default: "100vw". Tells the browser how wide the image renders. */
47
65
  sizes?: string;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { AfterRowComponentProps } from './after-row-component.types';
4
- export declare const AfterRowComponent: <TData extends RowData<import("../..").CustomTData>>(props: AfterRowComponentProps<TData>) => React.JSX.Element | null;
3
+ export declare const AfterRowComponent: <TData extends RowData>(props: AfterRowComponentProps<TData>) => React.JSX.Element | null;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { CellReorderWrapperProps } from './cell-reorder-wrapper.types';
4
3
  /** When reordering is provided, wraps the first column in the provided props. */
5
- export declare const CellReorderWrapper: <TData extends RowData<import("../..").CustomTData>>(props: CellReorderWrapperProps<TData>) => React.JSX.Element;
4
+ export declare const CellReorderWrapper: <TData extends RowData>(props: CellReorderWrapperProps<TData>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import React from 'react';
3
2
  import { CustomColumnsWrapperProps } from './custom-columns-toggle.types';
4
- export declare const CustomColumnsToggle: <TData extends RowData<import("../..").CustomTData>>(props: CustomColumnsWrapperProps<TData>) => React.JSX.Element;
3
+ export declare const CustomColumnsToggle: <TData extends RowData>(props: CustomColumnsWrapperProps<TData>) => React.JSX.Element;
@@ -3,5 +3,5 @@ import { CustomColumnOption } from './custom-columns-toggle.types';
3
3
  export interface GetCustomColumnOptionsArgs<TData extends RowData> {
4
4
  table: Table<TData>;
5
5
  }
6
- export declare const getCustomColumnOptions: <TData extends RowData<import("../..").CustomTData>>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
7
- export declare const transformColumnsIntoVisibilityState: <TData extends RowData<import("../..").CustomTData>>(columns: Column<TData, unknown>[]) => Record<string | number, boolean>;
6
+ export declare const getCustomColumnOptions: <TData extends RowData>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
7
+ export declare const transformColumnsIntoVisibilityState: <TData extends RowData>(columns: Column<TData, unknown>[]) => Record<string | number, boolean>;
@@ -4,9 +4,9 @@ export interface UseConfirmInteractionProps<TData extends RowData> {
4
4
  table: Table<TData>;
5
5
  }
6
6
  export type OnConfirmInteraction = (interaction: TableInteraction) => Promise<boolean>;
7
- export declare const useConfirmInteraction: <TData extends RowData<import("../../..").CustomTData>>(props: UseConfirmInteractionProps<TData>) => {
7
+ export declare const useConfirmInteraction: <TData extends RowData>(props: UseConfirmInteractionProps<TData>) => {
8
8
  /** Not necessary for `onConfirmInteraction`. Only provided in case additional logic is needed. */
9
- confirmAllInteractions: boolean;
9
+ confirmAllInteractions: any;
10
10
  /** If applicable, renders a discard selections confirmation modal when called. */
11
11
  onConfirmInteraction: OnConfirmInteraction;
12
12
  };
@@ -1,5 +1,4 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableActionsWrapperProps } from './table-actions-wrapper.types';
4
3
  /** Wraps the table with relevant components for paging, filters, sort, and table actions. */
5
- export declare const TableActionsWrapper: <TData extends RowData<import("../..").CustomTData>>(props: React.PropsWithChildren<TableActionsWrapperProps<TData>>) => React.JSX.Element;
4
+ export declare const TableActionsWrapper: <TData extends RowData>(props: React.PropsWithChildren<TableActionsWrapperProps<TData>>) => React.JSX.Element;
@@ -1,3 +1,2 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import { FlattenTableRowsProps } from './flatten-table-rows.types';
3
- export declare const flattenTableRows: <TData extends RowData<import("../../../..").CustomTData>>(props: FlattenTableRowsProps<TData>) => import("@tanstack/react-table").Row<TData>[];
2
+ export declare const flattenTableRows: <TData extends RowData>(props: FlattenTableRowsProps<TData>) => Row<TData_1>[];
@@ -1,3 +1,2 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import { IsRowReorderDisabledProps } from './is-row-reordering-disabled.types';
3
- export declare const isRowReorderDisabled: <TData extends RowData<import("../../../..").CustomTData>>(props: IsRowReorderDisabledProps<TData>) => boolean;
2
+ export declare const isRowReorderDisabled: <TData extends RowData>(props: IsRowReorderDisabledProps<TData>) => boolean;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { DraggableRowProps } from './table-draggable-row.types';
4
- export declare const TableDraggableRow: <TData extends RowData<import("../..").CustomTData>>(props: DraggableRowProps<TData>) => React.JSX.Element;
3
+ export declare const TableDraggableRow: <TData extends RowData>(props: DraggableRowProps<TData>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableFooterProps } from './table-footer.types';
4
- export declare const TableFooter: <TData extends RowData<import("../..").CustomTData>>(props: TableFooterProps<TData>) => React.JSX.Element;
3
+ export declare const TableFooter: <TData extends RowData>(props: TableFooterProps<TData>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { SelectableRowHeaderWrapperProps } from './selectable-row-header-wrapper.types';
4
- export declare const SelectableRowHeaderWrapper: <TData extends RowData<import("../../../..").CustomTData>>(props: React.PropsWithChildren<SelectableRowHeaderWrapperProps<TData>>) => React.JSX.Element;
3
+ export declare const SelectableRowHeaderWrapper: <TData extends RowData>(props: React.PropsWithChildren<SelectableRowHeaderWrapperProps<TData>>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableHeaderProps } from './table-header.types';
4
- export declare const TableHeader: <TData extends RowData<import("../..").CustomTData>>(props: TableHeaderProps<TData>) => React.JSX.Element;
3
+ export declare const TableHeader: <TData extends RowData>(props: TableHeaderProps<TData>) => React.JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { MouseEvent } from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableRowProps } from '../../table-row.types';
4
- export declare const getRowComponentProps: <TData extends RowData<import("../../../..").CustomTData>>(props: TableRowProps<TData>) => {
3
+ export declare const getRowComponentProps: <TData extends RowData>(props: TableRowProps<TData>) => {
5
4
  className: string;
6
5
  onClick: (event: MouseEvent<HTMLTableRowElement>) => void;
7
6
  "data-is-data-row": string;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableRowProps } from './table-row.types';
4
- export declare const TableRow: <TData extends RowData<import("../..").CustomTData>>(props: TableRowProps<TData>) => React.JSX.Element;
3
+ export declare const TableRow: <TData extends RowData>(props: TableRowProps<TData>) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- import { Row, RowData } from '@tanstack/react-table';
1
+ import { Row } from '@tanstack/react-table';
2
2
  import { GetRowRangeProps } from './get-row-range.types';
3
- export declare const getRowRange: <TData extends RowData<import("../../../../../..").CustomTData>>(props: GetRowRangeProps<TData>) => Row<TData>[];
3
+ export declare const getRowRange: <TData extends RowData>(props: GetRowRangeProps<TData>) => Row<TData>[];
@@ -1,4 +1,3 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { SelectableRowCellWrapperProps } from './selectable-row-cell-wrapper.types';
4
- export declare const SelectableRowCellWrapper: <TData extends RowData<import("../../../..").CustomTData>>(props: React.PropsWithChildren<SelectableRowCellWrapperProps<TData>>) => React.JSX.Element;
3
+ export declare const SelectableRowCellWrapper: <TData extends RowData>(props: React.PropsWithChildren<SelectableRowCellWrapperProps<TData>>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableCellProps } from './table-cell.types';
4
- export declare const TableCell: <TData extends RowData<import("../../../..").CustomTData>>(props: TableCellProps<TData>) => React.JSX.Element;
3
+ export declare const TableCell: <TData extends RowData>(props: TableCellProps<TData>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableRowCellsProps } from './table-row-cells.types';
4
- export declare const TableRowCells: <TData extends RowData<import("../..").CustomTData>>(props: TableRowCellsProps<TData>) => React.JSX.Element;
3
+ export declare const TableRowCells: <TData extends RowData>(props: TableRowCellsProps<TData>) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableRowOverlayProps } from './table-row-overlay.types';
4
- export declare const TableRowOverlay: <TData extends RowData<import("../..").CustomTData>>(props: TableRowOverlayProps<TData>) => React.JSX.Element;
3
+ export declare const TableRowOverlay: <TData extends RowData>(props: TableRowOverlayProps<TData>) => React.JSX.Element;
@@ -1,9 +1,8 @@
1
1
  import { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { UseDragAndDropRowsProps } from './use-drag-and-drop-rows.types';
4
- export declare const useDragAndDropRows: <TData extends RowData<import("../..").CustomTData>>(props: UseDragAndDropRowsProps<TData>) => {
3
+ export declare const useDragAndDropRows: <TData extends RowData>(props: UseDragAndDropRowsProps<TData>) => {
5
4
  draggingItem: TData | undefined;
6
- draggingRow: import("@tanstack/react-table").Row<TData> | undefined;
5
+ draggingRow: any;
7
6
  draggingRowId: string | undefined;
8
7
  handleDragEnd: (event: DragEndEvent) => void;
9
8
  handleDragStart: (event: DragStartEvent) => void;
@@ -1,6 +1,5 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  export declare const useGetSelectedRowsData: () => {
3
- getSelectedRowsData: <TData extends RowData<import("../..").CustomTData>>(props: {
2
+ getSelectedRowsData: <TData extends RowData>(props: {
4
3
  idProperty: keyof TData | undefined;
5
4
  records: TData[];
6
5
  }) => TData[];
@@ -1,9 +1,9 @@
1
- import { ColumnDef, ColumnOrderState, RowData, Table, VisibilityState } from '@tanstack/react-table';
1
+ import { ColumnDef, ColumnOrderState } from '@tanstack/react-table';
2
2
  import { ColumnConfig } from './table.types';
3
3
  export declare const extractColumnIdsFromColumnConfig: (records: ColumnConfig[]) => string[];
4
4
  export declare const extractColumnsVisibilityFromColumnConfig: (records: ColumnConfig[]) => VisibilityState;
5
- export declare const extractColumnsVisibilityFromTable: <TData extends RowData<import("./table.types").CustomTData>>(table: Table<TData>) => {};
6
- export declare const extractColumnsDefinition: <TData extends RowData<import("./table.types").CustomTData>>(columns: ColumnDef<TData, unknown>[]) => {
5
+ export declare const extractColumnsVisibilityFromTable: <TData extends RowData>(table: Table<TData>) => any;
6
+ export declare const extractColumnsDefinition: <TData extends RowData>(columns: ColumnDef<TData>[]) => {
7
7
  order: string[];
8
8
  visibility: Record<string, boolean>;
9
9
  };
@@ -17,5 +17,5 @@ export declare const useTableContext: () => {
17
17
  setIsRowSelectionCheckboxes: Dispatch<SetStateAction<boolean>>;
18
18
  setIsRowSelectionDisabled: Dispatch<SetStateAction<boolean>>;
19
19
  setLastSelectedId: Dispatch<SetStateAction<string>>;
20
- setRowSelectionState: Dispatch<SetStateAction<RowSelectionState>>;
20
+ setRowSelectionState: Dispatch<any>;
21
21
  };
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { RowData } from '@tanstack/react-table';
3
2
  import { TableProps } from './table.types';
4
3
  /**
5
4
  * See https://components.gantri.com/?path=/story/core-table for usage examples.
6
5
  *
7
6
  * Official docs: https://tanstack.com/table/v8/docs/guide/overview
8
7
  */
9
- export declare const Table: <TData extends RowData<import("./table.types").CustomTData>>(incoming: TableProps<TData>) => React.JSX.Element;
8
+ export declare const Table: <TData extends RowData>(incoming: TableProps<TData>) => React.JSX.Element;
@@ -1,5 +1,4 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import { ColumnConfig, GetColumnsConfigFn, TDataWithId } from './table.types';
3
- export declare const addMissingIds: <TData extends RowData<import("./table.types").CustomTData>>(data: TData[]) => TDataWithId<TData>[];
2
+ export declare const addMissingIds: <TData extends RowData>(data: TData[]) => TDataWithId<TData>[];
4
3
  export declare const hyphenateColumnId: ((id: string) => string) & import("lodash").MemoizedFunction;
5
4
  export declare const processColumnsConfigGenerator: (fetchData: GetColumnsConfigFn, handler: (val: ColumnConfig[]) => void, columnsConfiguration: ColumnConfig[]) => Promise<void | ColumnConfig[]>;