@gobolt/genesis 0.4.23 → 0.4.25

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.
@@ -12,6 +12,7 @@ export interface OverflowMenuProps {
12
12
  className?: string;
13
13
  style?: React.CSSProperties;
14
14
  onItemClick?: (item: OverflowMenuItemProps) => void;
15
+ overrideTextColor?: string;
15
16
  }
16
17
  declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLDivElement>>;
17
18
  export default OverflowMenu;
@@ -1,5 +1,6 @@
1
1
  export type BarData = {
2
2
  text: string;
3
+ overrideTextColor?: string;
3
4
  status: string;
4
5
  value: number;
5
6
  };
@@ -8,13 +9,14 @@ export type Percent = {
8
9
  strokeColor: string;
9
10
  };
10
11
  export interface ProgressProps {
11
- firstBarData: BarData | null;
12
+ firstBarData?: BarData | null;
12
13
  secondBarData?: BarData | null;
13
14
  width?: number;
14
15
  height?: number;
15
16
  isTextBeforeBar?: boolean;
16
17
  isProgressCombined?: boolean;
17
18
  isSingleBarOverallSuccess?: boolean;
19
+ overrideTextColor?: string;
18
20
  }
19
- declare const Progress: ({ firstBarData, secondBarData, width, height, isTextBeforeBar, isProgressCombined, isSingleBarOverallSuccess, }: ProgressProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const Progress: ({ firstBarData, secondBarData, width, height, isTextBeforeBar, isProgressCombined, isSingleBarOverallSuccess, overrideTextColor, }: ProgressProps) => import("react/jsx-runtime").JSX.Element;
20
22
  export default Progress;
@@ -4,6 +4,7 @@ export interface AppointmentWithSimpleAddress {
4
4
  number: string;
5
5
  timerange: string;
6
6
  status: AppointmentStatus;
7
+ isSelected?: boolean;
7
8
  address: {
8
9
  nickname: string;
9
10
  address: string;
@@ -17,6 +17,9 @@ export type UseTableConfig = {
17
17
  dataSource?: any[];
18
18
  };
19
19
  export declare const useTable: <T extends Record<string, any>>(useTableConfig: any) => {
20
+ dataSource: (T & {
21
+ isSelected: boolean;
22
+ })[];
20
23
  isLoading: boolean;
21
24
  hasErrored: boolean;
22
25
  rowSelection: {
@@ -34,7 +37,6 @@ export declare const useTable: <T extends Record<string, any>>(useTableConfig: a
34
37
  hasFilter: boolean;
35
38
  updateDataSource: (newDataSource: T[]) => void;
36
39
  retry: () => void;
37
- dataSource: T[];
38
40
  columns: ColumnsType<T>;
39
41
  error: Error | null;
40
42
  };
package/dist/index.cjs CHANGED
@@ -81263,6 +81263,11 @@ const OverflowMenuItem = ({ children: children2, onClick }) => {
81263
81263
  const DefaultTrigger = () => {
81264
81264
  return /* @__PURE__ */ jsxRuntime.jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(HiDotsHorizontal, {}) });
81265
81265
  };
81266
+ const DefaultTriggerWithOverrideTextColor = ({
81267
+ overrideTextColor
81268
+ }) => {
81269
+ return /* @__PURE__ */ jsxRuntime.jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(HiDotsHorizontal, { style: { color: overrideTextColor } }) });
81270
+ };
81266
81271
  const OverflowMenu = React.forwardRef(
81267
81272
  ({
81268
81273
  items,
@@ -81275,7 +81280,8 @@ const OverflowMenu = React.forwardRef(
81275
81280
  offset: offset2 = 8,
81276
81281
  className,
81277
81282
  style: style2,
81278
- onItemClick
81283
+ onItemClick,
81284
+ overrideTextColor
81279
81285
  }, ref) => {
81280
81286
  const [internalIsOpen, setInternalIsOpen] = React.useState(false);
81281
81287
  const [isAnimating, setIsAnimating] = React.useState(false);
@@ -81370,7 +81376,12 @@ const OverflowMenu = React.forwardRef(
81370
81376
  );
81371
81377
  if (items && items.length > 0) {
81372
81378
  return /* @__PURE__ */ jsxRuntime.jsxs(OverflowMenuWrapper, { ref, children: [
81373
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
81379
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: overrideTextColor ? /* @__PURE__ */ jsxRuntime.jsx(
81380
+ DefaultTriggerWithOverrideTextColor,
81381
+ {
81382
+ overrideTextColor
81383
+ }
81384
+ ) : trigger }),
81374
81385
  isOpen && /* @__PURE__ */ jsxRuntime.jsx(
81375
81386
  OverflowMenuContainer,
81376
81387
  {
@@ -81557,7 +81568,8 @@ const Progress = ({
81557
81568
  height = 24,
81558
81569
  isTextBeforeBar = false,
81559
81570
  isProgressCombined = false,
81560
- isSingleBarOverallSuccess = false
81571
+ isSingleBarOverallSuccess = false,
81572
+ overrideTextColor
81561
81573
  }) => {
81562
81574
  const theme = styled.useTheme();
81563
81575
  const percent = firstBarData?.value || 0;
@@ -81591,7 +81603,7 @@ const Progress = ({
81591
81603
  alignItems: "center",
81592
81604
  width: percentDisplayWidth
81593
81605
  },
81594
- children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
81606
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: overrideTextColor ?? textColor, variant: "digits3", children: [
81595
81607
  overallPercent,
81596
81608
  "%"
81597
81609
  ] })
@@ -81650,7 +81662,7 @@ const Progress = ({
81650
81662
  alignItems: "center",
81651
81663
  width: percentDisplayWidth
81652
81664
  },
81653
- children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
81665
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: overrideTextColor ?? textColor, variant: "digits3", children: [
81654
81666
  combinedPercent,
81655
81667
  "%"
81656
81668
  ] })
@@ -84867,7 +84879,11 @@ const InfiniteScrollTable = ({
84867
84879
  [isFetchingNextPage, hasNextPage, fetchNextPage, scrollableNode]
84868
84880
  );
84869
84881
  const rawDataSource = data?.pages.flatMap((page) => page.docs) ?? [];
84870
- const dataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
84882
+ const filteredDataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
84883
+ const dataSource = filteredDataSource.map((record) => ({
84884
+ ...record,
84885
+ isSelected: selectedRowKeys.includes(record.id)
84886
+ }));
84871
84887
  const totalDocs = data?.pages?.[0]?.totalDocs ?? 0;
84872
84888
  React.useEffect(() => {
84873
84889
  if (onRowSelectionChange) {
@@ -84932,7 +84948,7 @@ const InfiniteScrollTable = ({
84932
84948
  }
84933
84949
  ` }),
84934
84950
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "infinite-scroll-table", children: /* @__PURE__ */ jsxRuntime.jsx(
84935
- ForwardTable,
84951
+ Table$1,
84936
84952
  {
84937
84953
  dataSource,
84938
84954
  columns: resizableColumns,
@@ -85099,7 +85115,7 @@ function Table({
85099
85115
  title: infiniteScrollConfig.title,
85100
85116
  scrollHeight: infiniteScrollConfig.scrollHeight,
85101
85117
  scrollWidth: infiniteScrollConfig.scrollWidth,
85102
- onChange,
85118
+ onChange: isInfiniteScroll ? onChange : onChange,
85103
85119
  onRowSelectionChange,
85104
85120
  onDataChange,
85105
85121
  filterFn: infiniteScrollConfig.filterFn
@@ -85409,7 +85425,6 @@ const useTable = (useTableConfig) => {
85409
85425
  ]);
85410
85426
  const handleRowSelection = React.useCallback(
85411
85427
  (newSelectedRowKeys, newSelectedRows) => {
85412
- console.log("Row Selected:", newSelectedRowKeys, newSelectedRows);
85413
85428
  setSelectedRowKeys(newSelectedRowKeys);
85414
85429
  setSelectedRows(newSelectedRows);
85415
85430
  },
@@ -85434,8 +85449,19 @@ const useTable = (useTableConfig) => {
85434
85449
  onChange: handleRowSelection,
85435
85450
  getCheckboxProps: disableRowSelection
85436
85451
  };
85452
+ const enhancedDataSource = React.useMemo(() => {
85453
+ return data.dataSource.map((record) => {
85454
+ const isSelected = selectedRowKeys.includes(record.id);
85455
+ return {
85456
+ ...record,
85457
+ isSelected
85458
+ };
85459
+ });
85460
+ }, [data.dataSource, selectedRowKeys]);
85437
85461
  return {
85438
85462
  ...data,
85463
+ dataSource: enhancedDataSource,
85464
+ // Use enhanced data source instead of original
85439
85465
  isLoading,
85440
85466
  hasErrored,
85441
85467
  rowSelection,
@@ -86722,11 +86748,14 @@ const mockColumns = [
86722
86748
  {
86723
86749
  key: "address",
86724
86750
  title: "Address",
86725
- render: (appointment) => {
86726
- const {
86727
- address: { nickname, address }
86728
- } = appointment;
86729
- return nickname ? `${nickname} (${address})` : address;
86751
+ render: (appointment, record) => {
86752
+ const { address } = appointment;
86753
+ const textColor = record.isSelected ? "white" : "#6c6c6c";
86754
+ return React.createElement(Typography, {
86755
+ variant: "body2",
86756
+ children: address,
86757
+ color: `${textColor}`
86758
+ });
86730
86759
  }
86731
86760
  },
86732
86761
  {
@@ -86746,8 +86775,9 @@ const mockColumns = [
86746
86775
  {
86747
86776
  title: "Progress",
86748
86777
  dataIndex: "progress",
86749
- render: (progress) => {
86778
+ render: (progress, record) => {
86750
86779
  if (!progress) return null;
86780
+ const textColor = record.isSelected ? "white" : void 0;
86751
86781
  let firstBarData, secondBarData;
86752
86782
  if ("firstBarData" in progress) {
86753
86783
  firstBarData = progress.firstBarData;
@@ -86769,37 +86799,42 @@ const mockColumns = [
86769
86799
  secondBarData,
86770
86800
  width: 150,
86771
86801
  height: 20,
86772
- isProgressCombined: true
86802
+ isProgressCombined: true,
86803
+ overrideTextColor: textColor
86773
86804
  });
86774
86805
  }
86775
86806
  },
86776
86807
  {
86777
86808
  title: "Actions",
86778
86809
  key: "actions",
86779
- render: (record) => {
86810
+ render: (value2, record, index2) => {
86780
86811
  const menuItems = [
86781
86812
  {
86782
86813
  id: "edit",
86783
- children: "Edit",
86814
+ children: record.isSelected ? "Edit Selected" : "Edit",
86784
86815
  onClick: () => {
86785
86816
  console.log("Edit clicked for record:", record.id);
86817
+ console.log("Is selected:", record.isSelected);
86786
86818
  }
86787
86819
  },
86788
86820
  {
86789
86821
  id: "delete",
86790
- children: "Delete",
86822
+ children: record.isSelected ? "Delete Selected" : "Delete",
86791
86823
  onClick: () => {
86792
86824
  console.log("Delete clicked for record:", record.id);
86825
+ console.log("Is selected:", record.isSelected);
86793
86826
  }
86794
86827
  }
86795
86828
  ];
86829
+ const textColor = record.isSelected ? "white" : void 0;
86796
86830
  return React.createElement(OverflowMenu, {
86797
86831
  items: menuItems,
86798
86832
  onItemClick: (item) => {
86799
86833
  if (item.onClick) {
86800
86834
  item.onClick();
86801
86835
  }
86802
- }
86836
+ },
86837
+ overrideTextColor: textColor
86803
86838
  });
86804
86839
  }
86805
86840
  }
package/dist/index.js CHANGED
@@ -81245,6 +81245,11 @@ const OverflowMenuItem = ({ children: children2, onClick }) => {
81245
81245
  const DefaultTrigger = () => {
81246
81246
  return /* @__PURE__ */ jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsx(HiDotsHorizontal, {}) });
81247
81247
  };
81248
+ const DefaultTriggerWithOverrideTextColor = ({
81249
+ overrideTextColor
81250
+ }) => {
81251
+ return /* @__PURE__ */ jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsx(HiDotsHorizontal, { style: { color: overrideTextColor } }) });
81252
+ };
81248
81253
  const OverflowMenu = forwardRef(
81249
81254
  ({
81250
81255
  items,
@@ -81257,7 +81262,8 @@ const OverflowMenu = forwardRef(
81257
81262
  offset: offset2 = 8,
81258
81263
  className,
81259
81264
  style: style2,
81260
- onItemClick
81265
+ onItemClick,
81266
+ overrideTextColor
81261
81267
  }, ref) => {
81262
81268
  const [internalIsOpen, setInternalIsOpen] = useState(false);
81263
81269
  const [isAnimating, setIsAnimating] = useState(false);
@@ -81352,7 +81358,12 @@ const OverflowMenu = forwardRef(
81352
81358
  );
81353
81359
  if (items && items.length > 0) {
81354
81360
  return /* @__PURE__ */ jsxs(OverflowMenuWrapper, { ref, children: [
81355
- /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
81361
+ /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: overrideTextColor ? /* @__PURE__ */ jsx(
81362
+ DefaultTriggerWithOverrideTextColor,
81363
+ {
81364
+ overrideTextColor
81365
+ }
81366
+ ) : trigger }),
81356
81367
  isOpen && /* @__PURE__ */ jsx(
81357
81368
  OverflowMenuContainer,
81358
81369
  {
@@ -81539,7 +81550,8 @@ const Progress = ({
81539
81550
  height = 24,
81540
81551
  isTextBeforeBar = false,
81541
81552
  isProgressCombined = false,
81542
- isSingleBarOverallSuccess = false
81553
+ isSingleBarOverallSuccess = false,
81554
+ overrideTextColor
81543
81555
  }) => {
81544
81556
  const theme = useTheme$1();
81545
81557
  const percent = firstBarData?.value || 0;
@@ -81573,7 +81585,7 @@ const Progress = ({
81573
81585
  alignItems: "center",
81574
81586
  width: percentDisplayWidth
81575
81587
  },
81576
- children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
81588
+ children: /* @__PURE__ */ jsxs(Typography, { color: overrideTextColor ?? textColor, variant: "digits3", children: [
81577
81589
  overallPercent,
81578
81590
  "%"
81579
81591
  ] })
@@ -81632,7 +81644,7 @@ const Progress = ({
81632
81644
  alignItems: "center",
81633
81645
  width: percentDisplayWidth
81634
81646
  },
81635
- children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
81647
+ children: /* @__PURE__ */ jsxs(Typography, { color: overrideTextColor ?? textColor, variant: "digits3", children: [
81636
81648
  combinedPercent,
81637
81649
  "%"
81638
81650
  ] })
@@ -84849,7 +84861,11 @@ const InfiniteScrollTable = ({
84849
84861
  [isFetchingNextPage, hasNextPage, fetchNextPage, scrollableNode]
84850
84862
  );
84851
84863
  const rawDataSource = data?.pages.flatMap((page) => page.docs) ?? [];
84852
- const dataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
84864
+ const filteredDataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
84865
+ const dataSource = filteredDataSource.map((record) => ({
84866
+ ...record,
84867
+ isSelected: selectedRowKeys.includes(record.id)
84868
+ }));
84853
84869
  const totalDocs = data?.pages?.[0]?.totalDocs ?? 0;
84854
84870
  useEffect(() => {
84855
84871
  if (onRowSelectionChange) {
@@ -84914,7 +84930,7 @@ const InfiniteScrollTable = ({
84914
84930
  }
84915
84931
  ` }),
84916
84932
  /* @__PURE__ */ jsx("div", { className: "infinite-scroll-table", children: /* @__PURE__ */ jsx(
84917
- ForwardTable,
84933
+ Table$1,
84918
84934
  {
84919
84935
  dataSource,
84920
84936
  columns: resizableColumns,
@@ -85081,7 +85097,7 @@ function Table({
85081
85097
  title: infiniteScrollConfig.title,
85082
85098
  scrollHeight: infiniteScrollConfig.scrollHeight,
85083
85099
  scrollWidth: infiniteScrollConfig.scrollWidth,
85084
- onChange,
85100
+ onChange: isInfiniteScroll ? onChange : onChange,
85085
85101
  onRowSelectionChange,
85086
85102
  onDataChange,
85087
85103
  filterFn: infiniteScrollConfig.filterFn
@@ -85391,7 +85407,6 @@ const useTable = (useTableConfig) => {
85391
85407
  ]);
85392
85408
  const handleRowSelection = useCallback(
85393
85409
  (newSelectedRowKeys, newSelectedRows) => {
85394
- console.log("Row Selected:", newSelectedRowKeys, newSelectedRows);
85395
85410
  setSelectedRowKeys(newSelectedRowKeys);
85396
85411
  setSelectedRows(newSelectedRows);
85397
85412
  },
@@ -85416,8 +85431,19 @@ const useTable = (useTableConfig) => {
85416
85431
  onChange: handleRowSelection,
85417
85432
  getCheckboxProps: disableRowSelection
85418
85433
  };
85434
+ const enhancedDataSource = useMemo$1(() => {
85435
+ return data.dataSource.map((record) => {
85436
+ const isSelected = selectedRowKeys.includes(record.id);
85437
+ return {
85438
+ ...record,
85439
+ isSelected
85440
+ };
85441
+ });
85442
+ }, [data.dataSource, selectedRowKeys]);
85419
85443
  return {
85420
85444
  ...data,
85445
+ dataSource: enhancedDataSource,
85446
+ // Use enhanced data source instead of original
85421
85447
  isLoading,
85422
85448
  hasErrored,
85423
85449
  rowSelection,
@@ -86704,11 +86730,14 @@ const mockColumns = [
86704
86730
  {
86705
86731
  key: "address",
86706
86732
  title: "Address",
86707
- render: (appointment) => {
86708
- const {
86709
- address: { nickname, address }
86710
- } = appointment;
86711
- return nickname ? `${nickname} (${address})` : address;
86733
+ render: (appointment, record) => {
86734
+ const { address } = appointment;
86735
+ const textColor = record.isSelected ? "white" : "#6c6c6c";
86736
+ return React__default.createElement(Typography, {
86737
+ variant: "body2",
86738
+ children: address,
86739
+ color: `${textColor}`
86740
+ });
86712
86741
  }
86713
86742
  },
86714
86743
  {
@@ -86728,8 +86757,9 @@ const mockColumns = [
86728
86757
  {
86729
86758
  title: "Progress",
86730
86759
  dataIndex: "progress",
86731
- render: (progress) => {
86760
+ render: (progress, record) => {
86732
86761
  if (!progress) return null;
86762
+ const textColor = record.isSelected ? "white" : void 0;
86733
86763
  let firstBarData, secondBarData;
86734
86764
  if ("firstBarData" in progress) {
86735
86765
  firstBarData = progress.firstBarData;
@@ -86751,37 +86781,42 @@ const mockColumns = [
86751
86781
  secondBarData,
86752
86782
  width: 150,
86753
86783
  height: 20,
86754
- isProgressCombined: true
86784
+ isProgressCombined: true,
86785
+ overrideTextColor: textColor
86755
86786
  });
86756
86787
  }
86757
86788
  },
86758
86789
  {
86759
86790
  title: "Actions",
86760
86791
  key: "actions",
86761
- render: (record) => {
86792
+ render: (value2, record, index2) => {
86762
86793
  const menuItems = [
86763
86794
  {
86764
86795
  id: "edit",
86765
- children: "Edit",
86796
+ children: record.isSelected ? "Edit Selected" : "Edit",
86766
86797
  onClick: () => {
86767
86798
  console.log("Edit clicked for record:", record.id);
86799
+ console.log("Is selected:", record.isSelected);
86768
86800
  }
86769
86801
  },
86770
86802
  {
86771
86803
  id: "delete",
86772
- children: "Delete",
86804
+ children: record.isSelected ? "Delete Selected" : "Delete",
86773
86805
  onClick: () => {
86774
86806
  console.log("Delete clicked for record:", record.id);
86807
+ console.log("Is selected:", record.isSelected);
86775
86808
  }
86776
86809
  }
86777
86810
  ];
86811
+ const textColor = record.isSelected ? "white" : void 0;
86778
86812
  return React__default.createElement(OverflowMenu, {
86779
86813
  items: menuItems,
86780
86814
  onItemClick: (item) => {
86781
86815
  if (item.onClick) {
86782
86816
  item.onClick();
86783
86817
  }
86784
- }
86818
+ },
86819
+ overrideTextColor: textColor
86785
86820
  });
86786
86821
  }
86787
86822
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.4.23",
3
+ "version": "0.4.25",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",