@gobolt/genesis 0.4.32 → 0.4.35

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.
@@ -3,6 +3,7 @@ export type GoBoltUser = {
3
3
  first_name: string;
4
4
  last_name: string;
5
5
  image_url?: string;
6
+ url?: string;
6
7
  };
7
8
  export interface AvatarProps {
8
9
  size?: number;
@@ -11,6 +12,8 @@ export interface AvatarProps {
11
12
  children?: string;
12
13
  backgroundColor?: string;
13
14
  user?: GoBoltUser | null;
15
+ url?: string;
16
+ alt?: string;
14
17
  }
15
- declare const Avatar: ({ size, shape, children, backgroundColor, user, }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const Avatar: ({ size, shape, children, backgroundColor, user, url, alt, ...rest }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
16
19
  export default Avatar;
@@ -13,6 +13,7 @@ export interface OverflowMenuProps {
13
13
  style?: React.CSSProperties;
14
14
  onItemClick?: (item: OverflowMenuItemProps) => void;
15
15
  overrideTextColor?: string;
16
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
16
17
  }
17
18
  declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLDivElement>>;
18
19
  export default OverflowMenu;
@@ -1,3 +1,3 @@
1
1
  import { InfiniteScrollTableProps } from './types';
2
- declare const InfiniteScrollTable: <T>({ columns: initialColumns, fetchService, title, scrollHeight, scrollWidth, useWindowScroll, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, filterFn, }: InfiniteScrollTableProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const InfiniteScrollTable: <T>({ columns: initialColumns, fetchService, title, scrollHeight, scrollWidth, useWindowScroll, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, filterFn, hasBulkSelection, }: InfiniteScrollTableProps<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default InfiniteScrollTable;
@@ -12,6 +12,7 @@ export interface InfiniteScrollConfig<T = any> {
12
12
  scrollHeight?: number;
13
13
  scrollWidth?: number;
14
14
  useWindowScroll?: boolean;
15
+ filterFn: (data: T[]) => T[];
15
16
  }
16
17
  export interface TableProps<T extends Record<string, any>> {
17
18
  dataSource: T[];
@@ -54,6 +55,7 @@ export interface TableProps<T extends Record<string, any>> {
54
55
  index: number;
55
56
  error: Error;
56
57
  }) => void;
58
+ hasBulkSelection?: boolean;
57
59
  }
58
60
  export type TablePaginationType = {
59
61
  pageSize?: number;
@@ -67,5 +69,5 @@ export type SorterResult<T> = {
67
69
  field?: keyof T | string | React.Key | readonly React.Key[];
68
70
  columnKey?: React.Key;
69
71
  };
70
- declare function Table<T extends Record<string, any>>({ columns, dataSource, rowKey, size, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, pagination, isMainContentCell, isInfiniteScroll, infiniteScrollConfig, enableRowKeyValidation, onRowKeyError, ...rest }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
72
+ declare function Table<T extends Record<string, any>>({ columns, dataSource, rowKey, size, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, pagination, isMainContentCell, isInfiniteScroll, infiniteScrollConfig, enableRowKeyValidation, onRowKeyError, hasBulkSelection, ...rest }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
71
73
  export default Table;
@@ -10,6 +10,7 @@ export interface TablePaginationProps<T> {
10
10
  paginationStyle?: PaginationStyle;
11
11
  pageSize?: number;
12
12
  isMainContentCell?: boolean;
13
+ hasBulkSelection?: boolean;
13
14
  }
14
- declare const TablePagination: <T extends Record<string, any>>({ columns, dataSource, rowSelection, onChange, onRowClick, paginationStyle, pageSize, isMainContentCell, }: TablePaginationProps<T>) => import("react/jsx-runtime").JSX.Element;
15
+ declare const TablePagination: <T extends Record<string, any>>({ columns, dataSource, rowSelection, onChange, onRowClick, paginationStyle, pageSize, isMainContentCell, hasBulkSelection, }: TablePaginationProps<T>) => import("react/jsx-runtime").JSX.Element;
15
16
  export default TablePagination;
@@ -15,8 +15,9 @@ export type UseTableConfig = {
15
15
  hasFilter?: boolean;
16
16
  disableAutoFetch?: boolean;
17
17
  dataSource?: any[];
18
+ hasBulkSelection?: boolean;
18
19
  };
19
- export declare const useTable: <T extends Record<string, any>>(useTableConfig: any) => {
20
+ export declare const useTable: <T extends Record<string, any>>(useTableConfig: UseTableConfig) => {
20
21
  dataSource: (T & {
21
22
  isSelected: boolean;
22
23
  })[];
@@ -30,7 +31,7 @@ export declare const useTable: <T extends Record<string, any>>(useTableConfig: a
30
31
  disabled?: boolean;
31
32
  name?: string;
32
33
  };
33
- };
34
+ } | undefined;
34
35
  selectedRows: T[];
35
36
  selectedRowKeys: import('react').Key[];
36
37
  hasSettings: boolean;
@@ -16,6 +16,7 @@ export interface TableWithControlsProps {
16
16
  onRowClick?: (record: Record<string, any>, index: number, event: React.MouseEvent) => void;
17
17
  onRowSelectionChange?: (setSelectedRowKeys: (keys: React.Key[]) => void) => void;
18
18
  onDataChange?: (data: Record<string, any>[]) => void;
19
+ hasBulkSelection?: boolean;
19
20
  }
20
- declare const TableWithControls: ({ tableData, tableControlsData, onChange, onRowClick, onRowSelectionChange, onDataChange, tableType, isInfiniteScroll, infiniteScrollConfig, paginationStyle, }: TableWithControlsProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const TableWithControls: ({ tableData, tableControlsData, onChange, onRowClick, onRowSelectionChange, onDataChange, tableType, isInfiniteScroll, infiniteScrollConfig, paginationStyle, hasBulkSelection, }: TableWithControlsProps) => import("react/jsx-runtime").JSX.Element;
21
22
  export default TableWithControls;
@@ -30,7 +30,7 @@ export declare const useTableWithControls: (tableConfig: UseTableConfig) => {
30
30
  disabled?: boolean;
31
31
  name?: string;
32
32
  };
33
- };
33
+ } | undefined;
34
34
  selectedRows: Record<string, any>[];
35
35
  selectedRowKeys: import('react').Key[];
36
36
  updateDataSource: (newDataSource: Record<string, any>[]) => void;
package/dist/index.cjs CHANGED
@@ -60441,7 +60441,10 @@ const Avatar = ({
60441
60441
  shape = "circle",
60442
60442
  children: children2,
60443
60443
  backgroundColor = "#00282B",
60444
- user = null
60444
+ user = null,
60445
+ url: url3,
60446
+ alt,
60447
+ ...rest
60445
60448
  }) => {
60446
60449
  if (!user) {
60447
60450
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -60451,7 +60454,9 @@ const Avatar = ({
60451
60454
  shape,
60452
60455
  size,
60453
60456
  alt: "Default Avatar",
60454
- style: { backgroundColor }
60457
+ style: { backgroundColor },
60458
+ src: url3,
60459
+ ...rest
60455
60460
  }
60456
60461
  );
60457
60462
  }
@@ -60459,7 +60464,9 @@ const Avatar = ({
60459
60464
  if (user && !user?.image_url) {
60460
60465
  const simpleUser = {
60461
60466
  first_name: parseFirstName(user.first_name),
60462
- last_name: user.last_name
60467
+ last_name: user.last_name,
60468
+ image_url: user.image_url,
60469
+ url: user.url
60463
60470
  };
60464
60471
  const initials = createInitials(simpleUser);
60465
60472
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -60470,6 +60477,7 @@ const Avatar = ({
60470
60477
  size,
60471
60478
  alt: fullName,
60472
60479
  style: { backgroundColor },
60480
+ ...rest,
60473
60481
  children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", color: "white", style: { fontWeight: 600 }, children: initials })
60474
60482
  }
60475
60483
  );
@@ -60481,9 +60489,10 @@ const Avatar = ({
60481
60489
  "data-testid": "avatar",
60482
60490
  shape,
60483
60491
  size,
60484
- src: user?.image_url,
60492
+ src: url3 || user?.image_url,
60485
60493
  alt: fullName,
60486
60494
  style: { backgroundColor },
60495
+ ...rest,
60487
60496
  children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", color: "white", style: { fontWeight: 600 }, children: children2 })
60488
60497
  }
60489
60498
  );
@@ -60491,10 +60500,11 @@ const Avatar = ({
60491
60500
  return /* @__PURE__ */ jsxRuntime.jsx(
60492
60501
  Avatar$1,
60493
60502
  {
60503
+ ...rest,
60494
60504
  "data-testid": "avatar",
60495
60505
  shape,
60496
60506
  size,
60497
- src: user?.image_url,
60507
+ src: url3 || user?.image_url,
60498
60508
  alt: fullName
60499
60509
  }
60500
60510
  );
@@ -81295,10 +81305,12 @@ const OverflowMenu = React.forwardRef(
81295
81305
  className,
81296
81306
  style: style2,
81297
81307
  onItemClick,
81298
- overrideTextColor
81308
+ overrideTextColor,
81309
+ getPopupContainer = () => document.body
81299
81310
  }, ref) => {
81300
81311
  const [internalIsOpen, setInternalIsOpen] = React.useState(false);
81301
81312
  const [isAnimating, setIsAnimating] = React.useState(false);
81313
+ const [triggerRect, setTriggerRect] = React.useState(null);
81302
81314
  const triggerRef = React.useRef(null);
81303
81315
  const menuRef = React.useRef(null);
81304
81316
  const { theme } = useGenesis();
@@ -81326,6 +81338,10 @@ const OverflowMenu = React.forwardRef(
81326
81338
  );
81327
81339
  React.useEffect(() => {
81328
81340
  if (isOpen) {
81341
+ if (getPopupContainer && triggerRef.current) {
81342
+ const rect = triggerRef.current.getBoundingClientRect();
81343
+ setTriggerRect(rect);
81344
+ }
81329
81345
  const timer2 = setTimeout(() => {
81330
81346
  setIsAnimating(true);
81331
81347
  }, 10);
@@ -81336,15 +81352,54 @@ const OverflowMenu = React.forwardRef(
81336
81352
  };
81337
81353
  } else {
81338
81354
  setIsAnimating(false);
81355
+ setTriggerRect(null);
81339
81356
  document.removeEventListener("mousedown", handleClickOutside);
81340
81357
  }
81341
- }, [isOpen, handleClickOutside]);
81358
+ }, [isOpen, handleClickOutside, getPopupContainer]);
81342
81359
  const getMenuStyle = React.useMemo(() => {
81343
81360
  const baseStyle = {
81344
- position: "absolute",
81361
+ position: getPopupContainer ? "fixed" : "absolute",
81345
81362
  zIndex: 1e3,
81346
81363
  ...style2
81347
81364
  };
81365
+ if (getPopupContainer && triggerRect) {
81366
+ const { top, left, right, bottom, width, height } = triggerRect;
81367
+ switch (placement) {
81368
+ case "bottom": {
81369
+ return {
81370
+ ...baseStyle,
81371
+ top: bottom + offset2,
81372
+ ...alignment === "right" ? { right: window.innerWidth - right } : { left }
81373
+ };
81374
+ }
81375
+ case "top": {
81376
+ return {
81377
+ ...baseStyle,
81378
+ bottom: window.innerHeight - top + offset2,
81379
+ ...alignment === "right" ? { right: window.innerWidth - right } : { left }
81380
+ };
81381
+ }
81382
+ case "left": {
81383
+ return {
81384
+ ...baseStyle,
81385
+ top,
81386
+ right: window.innerWidth - left + offset2,
81387
+ ...alignment === "right" ? { bottom: window.innerHeight - bottom } : {}
81388
+ };
81389
+ }
81390
+ case "right": {
81391
+ return {
81392
+ ...baseStyle,
81393
+ top,
81394
+ left: right + offset2,
81395
+ ...alignment === "right" ? { bottom: window.innerHeight - bottom } : {}
81396
+ };
81397
+ }
81398
+ default: {
81399
+ return baseStyle;
81400
+ }
81401
+ }
81402
+ }
81348
81403
  switch (placement) {
81349
81404
  case "bottom": {
81350
81405
  return {
@@ -81380,7 +81435,7 @@ const OverflowMenu = React.forwardRef(
81380
81435
  return baseStyle;
81381
81436
  }
81382
81437
  }
81383
- }, [placement, alignment, offset2, style2]);
81438
+ }, [placement, alignment, offset2, style2, getPopupContainer, triggerRect]);
81384
81439
  const handleItemClick = React.useCallback(
81385
81440
  (item) => {
81386
81441
  onItemClick?.(item);
@@ -81388,6 +81443,25 @@ const OverflowMenu = React.forwardRef(
81388
81443
  },
81389
81444
  [onItemClick, handleOpenChange]
81390
81445
  );
81446
+ const renderMenuContent = (content2) => /* @__PURE__ */ jsxRuntime.jsx(
81447
+ OverflowMenuContainer,
81448
+ {
81449
+ ref: menuRef,
81450
+ theme,
81451
+ className,
81452
+ style: getMenuStyle,
81453
+ $isAnimating: isAnimating,
81454
+ $placement: placement,
81455
+ children: content2
81456
+ }
81457
+ );
81458
+ const renderMenu = (content2) => {
81459
+ if (getPopupContainer && triggerRef.current) {
81460
+ const container = getPopupContainer(triggerRef.current);
81461
+ return ReactDOM.createPortal(renderMenuContent(content2), container);
81462
+ }
81463
+ return renderMenuContent(content2);
81464
+ };
81391
81465
  if (items && items.length > 0) {
81392
81466
  return /* @__PURE__ */ jsxRuntime.jsxs(OverflowMenuWrapper, { ref, children: [
81393
81467
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: overrideTextColor ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -81396,41 +81470,21 @@ const OverflowMenu = React.forwardRef(
81396
81470
  overrideTextColor
81397
81471
  }
81398
81472
  ) : trigger }),
81399
- isOpen && /* @__PURE__ */ jsxRuntime.jsx(
81400
- OverflowMenuContainer,
81401
- {
81402
- ref: menuRef,
81403
- theme,
81404
- className,
81405
- style: getMenuStyle,
81406
- $isAnimating: isAnimating,
81407
- $placement: placement,
81408
- children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
81409
- OverflowMenuItem,
81410
- {
81411
- ...item,
81412
- onClick: () => handleItemClick(item)
81413
- },
81414
- item.id
81415
- ))
81416
- }
81473
+ isOpen && renderMenu(
81474
+ items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
81475
+ OverflowMenuItem,
81476
+ {
81477
+ ...item,
81478
+ onClick: () => handleItemClick(item)
81479
+ },
81480
+ item.id
81481
+ ))
81417
81482
  )
81418
81483
  ] });
81419
81484
  }
81420
81485
  return /* @__PURE__ */ jsxRuntime.jsxs(OverflowMenuWrapper, { ref, children: [
81421
81486
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
81422
- isOpen && /* @__PURE__ */ jsxRuntime.jsx(
81423
- OverflowMenuContainer,
81424
- {
81425
- ref: menuRef,
81426
- theme,
81427
- className,
81428
- style: getMenuStyle,
81429
- $isAnimating: isAnimating,
81430
- $placement: placement,
81431
- children: children2
81432
- }
81433
- )
81487
+ isOpen && renderMenu(children2)
81434
81488
  ] });
81435
81489
  }
81436
81490
  );
@@ -84825,7 +84879,8 @@ const InfiniteScrollTable = ({
84825
84879
  onRowClick,
84826
84880
  onRowSelectionChange,
84827
84881
  onDataChange,
84828
- filterFn
84882
+ filterFn,
84883
+ hasBulkSelection = true
84829
84884
  }) => {
84830
84885
  const observer = React.useRef();
84831
84886
  const [scrollableNode, setScrollableNode] = React.useState(
@@ -85002,7 +85057,7 @@ const InfiniteScrollTable = ({
85002
85057
  scroll: useWindowScroll ? { x: scrollWidth } : { y: scrollHeight, x: scrollWidth },
85003
85058
  onChange: () => {
85004
85059
  },
85005
- rowSelection: finalRowSelection,
85060
+ ...hasBulkSelection ? { rowSelection: finalRowSelection } : {},
85006
85061
  onRow: (record, index2) => {
85007
85062
  const rowProps = {};
85008
85063
  if (index2 === dataSource.length - 1) {
@@ -85108,6 +85163,7 @@ function Table({
85108
85163
  infiniteScrollConfig,
85109
85164
  enableRowKeyValidation = process.env.NODE_ENV === "development",
85110
85165
  onRowKeyError,
85166
+ hasBulkSelection = true,
85111
85167
  ...rest
85112
85168
  }) {
85113
85169
  const [selectedRowKeys, setSelectedRowKeys] = React__namespace.useState([]);
@@ -85160,7 +85216,9 @@ function Table({
85160
85216
  useWindowScroll: infiniteScrollConfig.useWindowScroll,
85161
85217
  onChange: isInfiniteScroll ? onChange : onChange,
85162
85218
  onRowSelectionChange,
85163
- onDataChange
85219
+ onDataChange,
85220
+ hasBulkSelection,
85221
+ filterFn: infiniteScrollConfig.filterFn
85164
85222
  }
85165
85223
  );
85166
85224
  }
@@ -85284,7 +85342,7 @@ function Table({
85284
85342
  locale: { emptyText: "No Data" },
85285
85343
  size,
85286
85344
  onChange,
85287
- rowSelection: enhancedRowSelection,
85345
+ ...hasBulkSelection ? { rowSelection: enhancedRowSelection } : {},
85288
85346
  onRow: (record, index2) => {
85289
85347
  const isDisabled = rowSelection?.getCheckboxProps?.(record)?.disabled ?? false;
85290
85348
  const recordKey = getRowKey(
@@ -85323,7 +85381,8 @@ const TablePagination = ({
85323
85381
  onRowClick,
85324
85382
  paginationStyle = PaginationStyle.SIMPLE,
85325
85383
  pageSize = 10,
85326
- isMainContentCell
85384
+ isMainContentCell,
85385
+ hasBulkSelection = true
85327
85386
  }) => {
85328
85387
  const [current, setCurrent] = React.useState(1);
85329
85388
  const total = dataSource.length;
@@ -85337,7 +85396,7 @@ const TablePagination = ({
85337
85396
  {
85338
85397
  columns,
85339
85398
  dataSource: paginatedData,
85340
- rowSelection,
85399
+ ...hasBulkSelection ? { rowSelection } : {},
85341
85400
  onChange,
85342
85401
  onRowClick,
85343
85402
  pagination: false,
@@ -85389,7 +85448,8 @@ const useTable = (useTableConfig) => {
85389
85448
  hasSettings = true,
85390
85449
  hasFilter = true,
85391
85450
  disableAutoFetch = false,
85392
- dataSource: initialDataSource = []
85451
+ dataSource: initialDataSource = [],
85452
+ hasBulkSelection = true
85393
85453
  } = useTableConfig;
85394
85454
  const [originalData, setOriginalData] = React.useState(initialDataSource);
85395
85455
  const [data, setData] = React.useState({
@@ -85407,6 +85467,11 @@ const useTable = (useTableConfig) => {
85407
85467
  if (disableAutoFetch) {
85408
85468
  isDisabledRef.current = true;
85409
85469
  setLoading(false);
85470
+ setData({
85471
+ dataSource: initialDataSource,
85472
+ columns,
85473
+ error: null
85474
+ });
85410
85475
  return;
85411
85476
  }
85412
85477
  if (hasFetchedRef.current || hasErrored || isDisabledRef.current) {
@@ -85485,12 +85550,12 @@ const useTable = (useTableConfig) => {
85485
85550
  isDisabledRef.current = false;
85486
85551
  setLoading(true);
85487
85552
  }, []);
85488
- const rowSelection = {
85553
+ const rowSelection = hasBulkSelection ? {
85489
85554
  type: selectionType,
85490
85555
  selectedRowKeys,
85491
85556
  onChange: handleRowSelection,
85492
85557
  getCheckboxProps: disableRowSelection
85493
- };
85558
+ } : void 0;
85494
85559
  const enhancedDataSource = React.useMemo(() => {
85495
85560
  return data.dataSource.map((record) => {
85496
85561
  const isSelected = selectedRowKeys.includes(record.id);
@@ -85862,7 +85927,8 @@ const TableWithControls = ({
85862
85927
  tableType = "table",
85863
85928
  isInfiniteScroll,
85864
85929
  infiniteScrollConfig,
85865
- paginationStyle
85930
+ paginationStyle,
85931
+ hasBulkSelection = true
85866
85932
  }) => {
85867
85933
  const [infiniteScrollData, setInfiniteScrollData] = React.useState({
85868
85934
  totalPages: 0,
@@ -85921,7 +85987,8 @@ const TableWithControls = ({
85921
85987
  scrollWidth: infiniteScrollConfig.scrollWidth,
85922
85988
  useWindowScroll: infiniteScrollConfig.useWindowScroll,
85923
85989
  onChange: onInfiniteScrollTableChange,
85924
- rowSelection,
85990
+ ...hasBulkSelection ? { rowSelection } : {},
85991
+ hasBulkSelection,
85925
85992
  onRowClick: tableOnRowClick || onRowClick,
85926
85993
  onRowSelectionChange,
85927
85994
  onDataChange
@@ -85934,7 +86001,7 @@ const TableWithControls = ({
85934
86001
  {
85935
86002
  dataSource,
85936
86003
  columns,
85937
- rowSelection,
86004
+ ...hasBulkSelection ? { rowSelection } : {},
85938
86005
  onChange: onTableChange,
85939
86006
  onRowClick,
85940
86007
  paginationStyle
@@ -85948,7 +86015,7 @@ const TableWithControls = ({
85948
86015
  {
85949
86016
  dataSource,
85950
86017
  columns,
85951
- rowSelection,
86018
+ ...hasBulkSelection ? { rowSelection } : {},
85952
86019
  onChange: onTableChange,
85953
86020
  onRowClick,
85954
86021
  onRowSelectionChange
package/dist/index.js CHANGED
@@ -60423,7 +60423,10 @@ const Avatar = ({
60423
60423
  shape = "circle",
60424
60424
  children: children2,
60425
60425
  backgroundColor = "#00282B",
60426
- user = null
60426
+ user = null,
60427
+ url: url3,
60428
+ alt,
60429
+ ...rest
60427
60430
  }) => {
60428
60431
  if (!user) {
60429
60432
  return /* @__PURE__ */ jsx(
@@ -60433,7 +60436,9 @@ const Avatar = ({
60433
60436
  shape,
60434
60437
  size,
60435
60438
  alt: "Default Avatar",
60436
- style: { backgroundColor }
60439
+ style: { backgroundColor },
60440
+ src: url3,
60441
+ ...rest
60437
60442
  }
60438
60443
  );
60439
60444
  }
@@ -60441,7 +60446,9 @@ const Avatar = ({
60441
60446
  if (user && !user?.image_url) {
60442
60447
  const simpleUser = {
60443
60448
  first_name: parseFirstName(user.first_name),
60444
- last_name: user.last_name
60449
+ last_name: user.last_name,
60450
+ image_url: user.image_url,
60451
+ url: user.url
60445
60452
  };
60446
60453
  const initials = createInitials(simpleUser);
60447
60454
  return /* @__PURE__ */ jsx(
@@ -60452,6 +60459,7 @@ const Avatar = ({
60452
60459
  size,
60453
60460
  alt: fullName,
60454
60461
  style: { backgroundColor },
60462
+ ...rest,
60455
60463
  children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "white", style: { fontWeight: 600 }, children: initials })
60456
60464
  }
60457
60465
  );
@@ -60463,9 +60471,10 @@ const Avatar = ({
60463
60471
  "data-testid": "avatar",
60464
60472
  shape,
60465
60473
  size,
60466
- src: user?.image_url,
60474
+ src: url3 || user?.image_url,
60467
60475
  alt: fullName,
60468
60476
  style: { backgroundColor },
60477
+ ...rest,
60469
60478
  children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "white", style: { fontWeight: 600 }, children: children2 })
60470
60479
  }
60471
60480
  );
@@ -60473,10 +60482,11 @@ const Avatar = ({
60473
60482
  return /* @__PURE__ */ jsx(
60474
60483
  Avatar$1,
60475
60484
  {
60485
+ ...rest,
60476
60486
  "data-testid": "avatar",
60477
60487
  shape,
60478
60488
  size,
60479
- src: user?.image_url,
60489
+ src: url3 || user?.image_url,
60480
60490
  alt: fullName
60481
60491
  }
60482
60492
  );
@@ -81277,10 +81287,12 @@ const OverflowMenu = forwardRef(
81277
81287
  className,
81278
81288
  style: style2,
81279
81289
  onItemClick,
81280
- overrideTextColor
81290
+ overrideTextColor,
81291
+ getPopupContainer = () => document.body
81281
81292
  }, ref) => {
81282
81293
  const [internalIsOpen, setInternalIsOpen] = useState(false);
81283
81294
  const [isAnimating, setIsAnimating] = useState(false);
81295
+ const [triggerRect, setTriggerRect] = useState(null);
81284
81296
  const triggerRef = useRef(null);
81285
81297
  const menuRef = useRef(null);
81286
81298
  const { theme } = useGenesis();
@@ -81308,6 +81320,10 @@ const OverflowMenu = forwardRef(
81308
81320
  );
81309
81321
  useEffect(() => {
81310
81322
  if (isOpen) {
81323
+ if (getPopupContainer && triggerRef.current) {
81324
+ const rect = triggerRef.current.getBoundingClientRect();
81325
+ setTriggerRect(rect);
81326
+ }
81311
81327
  const timer2 = setTimeout(() => {
81312
81328
  setIsAnimating(true);
81313
81329
  }, 10);
@@ -81318,15 +81334,54 @@ const OverflowMenu = forwardRef(
81318
81334
  };
81319
81335
  } else {
81320
81336
  setIsAnimating(false);
81337
+ setTriggerRect(null);
81321
81338
  document.removeEventListener("mousedown", handleClickOutside);
81322
81339
  }
81323
- }, [isOpen, handleClickOutside]);
81340
+ }, [isOpen, handleClickOutside, getPopupContainer]);
81324
81341
  const getMenuStyle = useMemo$1(() => {
81325
81342
  const baseStyle = {
81326
- position: "absolute",
81343
+ position: getPopupContainer ? "fixed" : "absolute",
81327
81344
  zIndex: 1e3,
81328
81345
  ...style2
81329
81346
  };
81347
+ if (getPopupContainer && triggerRect) {
81348
+ const { top, left, right, bottom, width, height } = triggerRect;
81349
+ switch (placement) {
81350
+ case "bottom": {
81351
+ return {
81352
+ ...baseStyle,
81353
+ top: bottom + offset2,
81354
+ ...alignment === "right" ? { right: window.innerWidth - right } : { left }
81355
+ };
81356
+ }
81357
+ case "top": {
81358
+ return {
81359
+ ...baseStyle,
81360
+ bottom: window.innerHeight - top + offset2,
81361
+ ...alignment === "right" ? { right: window.innerWidth - right } : { left }
81362
+ };
81363
+ }
81364
+ case "left": {
81365
+ return {
81366
+ ...baseStyle,
81367
+ top,
81368
+ right: window.innerWidth - left + offset2,
81369
+ ...alignment === "right" ? { bottom: window.innerHeight - bottom } : {}
81370
+ };
81371
+ }
81372
+ case "right": {
81373
+ return {
81374
+ ...baseStyle,
81375
+ top,
81376
+ left: right + offset2,
81377
+ ...alignment === "right" ? { bottom: window.innerHeight - bottom } : {}
81378
+ };
81379
+ }
81380
+ default: {
81381
+ return baseStyle;
81382
+ }
81383
+ }
81384
+ }
81330
81385
  switch (placement) {
81331
81386
  case "bottom": {
81332
81387
  return {
@@ -81362,7 +81417,7 @@ const OverflowMenu = forwardRef(
81362
81417
  return baseStyle;
81363
81418
  }
81364
81419
  }
81365
- }, [placement, alignment, offset2, style2]);
81420
+ }, [placement, alignment, offset2, style2, getPopupContainer, triggerRect]);
81366
81421
  const handleItemClick = useCallback(
81367
81422
  (item) => {
81368
81423
  onItemClick?.(item);
@@ -81370,6 +81425,25 @@ const OverflowMenu = forwardRef(
81370
81425
  },
81371
81426
  [onItemClick, handleOpenChange]
81372
81427
  );
81428
+ const renderMenuContent = (content2) => /* @__PURE__ */ jsx(
81429
+ OverflowMenuContainer,
81430
+ {
81431
+ ref: menuRef,
81432
+ theme,
81433
+ className,
81434
+ style: getMenuStyle,
81435
+ $isAnimating: isAnimating,
81436
+ $placement: placement,
81437
+ children: content2
81438
+ }
81439
+ );
81440
+ const renderMenu = (content2) => {
81441
+ if (getPopupContainer && triggerRef.current) {
81442
+ const container = getPopupContainer(triggerRef.current);
81443
+ return createPortal(renderMenuContent(content2), container);
81444
+ }
81445
+ return renderMenuContent(content2);
81446
+ };
81373
81447
  if (items && items.length > 0) {
81374
81448
  return /* @__PURE__ */ jsxs(OverflowMenuWrapper, { ref, children: [
81375
81449
  /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: overrideTextColor ? /* @__PURE__ */ jsx(
@@ -81378,41 +81452,21 @@ const OverflowMenu = forwardRef(
81378
81452
  overrideTextColor
81379
81453
  }
81380
81454
  ) : trigger }),
81381
- isOpen && /* @__PURE__ */ jsx(
81382
- OverflowMenuContainer,
81383
- {
81384
- ref: menuRef,
81385
- theme,
81386
- className,
81387
- style: getMenuStyle,
81388
- $isAnimating: isAnimating,
81389
- $placement: placement,
81390
- children: items.map((item) => /* @__PURE__ */ jsx(
81391
- OverflowMenuItem,
81392
- {
81393
- ...item,
81394
- onClick: () => handleItemClick(item)
81395
- },
81396
- item.id
81397
- ))
81398
- }
81455
+ isOpen && renderMenu(
81456
+ items.map((item) => /* @__PURE__ */ jsx(
81457
+ OverflowMenuItem,
81458
+ {
81459
+ ...item,
81460
+ onClick: () => handleItemClick(item)
81461
+ },
81462
+ item.id
81463
+ ))
81399
81464
  )
81400
81465
  ] });
81401
81466
  }
81402
81467
  return /* @__PURE__ */ jsxs(OverflowMenuWrapper, { ref, children: [
81403
81468
  /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
81404
- isOpen && /* @__PURE__ */ jsx(
81405
- OverflowMenuContainer,
81406
- {
81407
- ref: menuRef,
81408
- theme,
81409
- className,
81410
- style: getMenuStyle,
81411
- $isAnimating: isAnimating,
81412
- $placement: placement,
81413
- children: children2
81414
- }
81415
- )
81469
+ isOpen && renderMenu(children2)
81416
81470
  ] });
81417
81471
  }
81418
81472
  );
@@ -84807,7 +84861,8 @@ const InfiniteScrollTable = ({
84807
84861
  onRowClick,
84808
84862
  onRowSelectionChange,
84809
84863
  onDataChange,
84810
- filterFn
84864
+ filterFn,
84865
+ hasBulkSelection = true
84811
84866
  }) => {
84812
84867
  const observer = useRef();
84813
84868
  const [scrollableNode, setScrollableNode] = useState(
@@ -84984,7 +85039,7 @@ const InfiniteScrollTable = ({
84984
85039
  scroll: useWindowScroll ? { x: scrollWidth } : { y: scrollHeight, x: scrollWidth },
84985
85040
  onChange: () => {
84986
85041
  },
84987
- rowSelection: finalRowSelection,
85042
+ ...hasBulkSelection ? { rowSelection: finalRowSelection } : {},
84988
85043
  onRow: (record, index2) => {
84989
85044
  const rowProps = {};
84990
85045
  if (index2 === dataSource.length - 1) {
@@ -85090,6 +85145,7 @@ function Table({
85090
85145
  infiniteScrollConfig,
85091
85146
  enableRowKeyValidation = process.env.NODE_ENV === "development",
85092
85147
  onRowKeyError,
85148
+ hasBulkSelection = true,
85093
85149
  ...rest
85094
85150
  }) {
85095
85151
  const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
@@ -85142,7 +85198,9 @@ function Table({
85142
85198
  useWindowScroll: infiniteScrollConfig.useWindowScroll,
85143
85199
  onChange: isInfiniteScroll ? onChange : onChange,
85144
85200
  onRowSelectionChange,
85145
- onDataChange
85201
+ onDataChange,
85202
+ hasBulkSelection,
85203
+ filterFn: infiniteScrollConfig.filterFn
85146
85204
  }
85147
85205
  );
85148
85206
  }
@@ -85266,7 +85324,7 @@ function Table({
85266
85324
  locale: { emptyText: "No Data" },
85267
85325
  size,
85268
85326
  onChange,
85269
- rowSelection: enhancedRowSelection,
85327
+ ...hasBulkSelection ? { rowSelection: enhancedRowSelection } : {},
85270
85328
  onRow: (record, index2) => {
85271
85329
  const isDisabled = rowSelection?.getCheckboxProps?.(record)?.disabled ?? false;
85272
85330
  const recordKey = getRowKey(
@@ -85305,7 +85363,8 @@ const TablePagination = ({
85305
85363
  onRowClick,
85306
85364
  paginationStyle = PaginationStyle.SIMPLE,
85307
85365
  pageSize = 10,
85308
- isMainContentCell
85366
+ isMainContentCell,
85367
+ hasBulkSelection = true
85309
85368
  }) => {
85310
85369
  const [current, setCurrent] = useState(1);
85311
85370
  const total = dataSource.length;
@@ -85319,7 +85378,7 @@ const TablePagination = ({
85319
85378
  {
85320
85379
  columns,
85321
85380
  dataSource: paginatedData,
85322
- rowSelection,
85381
+ ...hasBulkSelection ? { rowSelection } : {},
85323
85382
  onChange,
85324
85383
  onRowClick,
85325
85384
  pagination: false,
@@ -85371,7 +85430,8 @@ const useTable = (useTableConfig) => {
85371
85430
  hasSettings = true,
85372
85431
  hasFilter = true,
85373
85432
  disableAutoFetch = false,
85374
- dataSource: initialDataSource = []
85433
+ dataSource: initialDataSource = [],
85434
+ hasBulkSelection = true
85375
85435
  } = useTableConfig;
85376
85436
  const [originalData, setOriginalData] = useState(initialDataSource);
85377
85437
  const [data, setData] = useState({
@@ -85389,6 +85449,11 @@ const useTable = (useTableConfig) => {
85389
85449
  if (disableAutoFetch) {
85390
85450
  isDisabledRef.current = true;
85391
85451
  setLoading(false);
85452
+ setData({
85453
+ dataSource: initialDataSource,
85454
+ columns,
85455
+ error: null
85456
+ });
85392
85457
  return;
85393
85458
  }
85394
85459
  if (hasFetchedRef.current || hasErrored || isDisabledRef.current) {
@@ -85467,12 +85532,12 @@ const useTable = (useTableConfig) => {
85467
85532
  isDisabledRef.current = false;
85468
85533
  setLoading(true);
85469
85534
  }, []);
85470
- const rowSelection = {
85535
+ const rowSelection = hasBulkSelection ? {
85471
85536
  type: selectionType,
85472
85537
  selectedRowKeys,
85473
85538
  onChange: handleRowSelection,
85474
85539
  getCheckboxProps: disableRowSelection
85475
- };
85540
+ } : void 0;
85476
85541
  const enhancedDataSource = useMemo$1(() => {
85477
85542
  return data.dataSource.map((record) => {
85478
85543
  const isSelected = selectedRowKeys.includes(record.id);
@@ -85844,7 +85909,8 @@ const TableWithControls = ({
85844
85909
  tableType = "table",
85845
85910
  isInfiniteScroll,
85846
85911
  infiniteScrollConfig,
85847
- paginationStyle
85912
+ paginationStyle,
85913
+ hasBulkSelection = true
85848
85914
  }) => {
85849
85915
  const [infiniteScrollData, setInfiniteScrollData] = useState({
85850
85916
  totalPages: 0,
@@ -85903,7 +85969,8 @@ const TableWithControls = ({
85903
85969
  scrollWidth: infiniteScrollConfig.scrollWidth,
85904
85970
  useWindowScroll: infiniteScrollConfig.useWindowScroll,
85905
85971
  onChange: onInfiniteScrollTableChange,
85906
- rowSelection,
85972
+ ...hasBulkSelection ? { rowSelection } : {},
85973
+ hasBulkSelection,
85907
85974
  onRowClick: tableOnRowClick || onRowClick,
85908
85975
  onRowSelectionChange,
85909
85976
  onDataChange
@@ -85916,7 +85983,7 @@ const TableWithControls = ({
85916
85983
  {
85917
85984
  dataSource,
85918
85985
  columns,
85919
- rowSelection,
85986
+ ...hasBulkSelection ? { rowSelection } : {},
85920
85987
  onChange: onTableChange,
85921
85988
  onRowClick,
85922
85989
  paginationStyle
@@ -85930,7 +85997,7 @@ const TableWithControls = ({
85930
85997
  {
85931
85998
  dataSource,
85932
85999
  columns,
85933
- rowSelection,
86000
+ ...hasBulkSelection ? { rowSelection } : {},
85934
86001
  onChange: onTableChange,
85935
86002
  onRowClick,
85936
86003
  onRowSelectionChange
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.4.32",
3
+ "version": "0.4.35",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",