@gobolt/genesis 0.4.5 → 0.4.9

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.
package/dist/index.js CHANGED
@@ -60232,6 +60232,9 @@ function FaCircleCheck(props) {
60232
60232
  function HiClock(props) {
60233
60233
  return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z", "clipRule": "evenodd" }, "child": [] }] })(props);
60234
60234
  }
60235
+ function HiDotsHorizontal(props) {
60236
+ return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "d": "M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z" }, "child": [] }] })(props);
60237
+ }
60235
60238
  function HiExclamationCircle(props) {
60236
60239
  return GenIcon({ "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z", "clipRule": "evenodd" }, "child": [] }] })(props);
60237
60240
  }
@@ -80497,10 +80500,13 @@ const OverflowMenuItem$1 = styled.div`
80497
80500
  const OverflowMenuItem = ({ children: children2, onClick }) => {
80498
80501
  return /* @__PURE__ */ jsx(OverflowMenuItem$1, { onClick, children: children2 });
80499
80502
  };
80503
+ const DefaultTrigger = () => {
80504
+ return /* @__PURE__ */ jsx(Button$1, { isIconButton: true, themeType: "secondary", size: "small", children: /* @__PURE__ */ jsx(HiDotsHorizontal, {}) });
80505
+ };
80500
80506
  const OverflowMenu = ({
80501
80507
  items,
80502
80508
  children: children2,
80503
- trigger,
80509
+ trigger = /* @__PURE__ */ jsx(DefaultTrigger, {}),
80504
80510
  isOpen: controlledIsOpen,
80505
80511
  onOpenChange,
80506
80512
  placement = "bottom",
@@ -80774,15 +80780,12 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
80774
80780
  );
80775
80781
  };
80776
80782
  const getCombinedPercent = (firstBarData, secondBarData) => {
80777
- if (secondBarData?.value === 0) {
80778
- return firstBarData?.value;
80779
- }
80780
- if (firstBarData?.value && secondBarData?.value) {
80781
- const total = firstBarData?.value + secondBarData?.value;
80783
+ if (firstBarData?.value !== void 0 && secondBarData?.value !== void 0) {
80784
+ const total = firstBarData.value + secondBarData.value;
80782
80785
  const dividedBy = total / 2;
80783
- return dividedBy;
80786
+ return Math.round(dividedBy);
80784
80787
  }
80785
- return 0;
80788
+ return firstBarData?.value || 0;
80786
80789
  };
80787
80790
  const Progress = ({
80788
80791
  firstBarData,
@@ -80801,6 +80804,7 @@ const Progress = ({
80801
80804
  strokeColor: theme?.colors?.inputs?.progress?.[secondBarData.status]
80802
80805
  } : null;
80803
80806
  const stateColor = strokeColor;
80807
+ const percentDisplayWidth = 110;
80804
80808
  const gap = 8;
80805
80809
  if (isSingleBarOverallSuccess && secondBarData !== null) {
80806
80810
  const overallPercent = secondBarData.value;
@@ -80816,30 +80820,79 @@ const Progress = ({
80816
80820
  showInfo: false
80817
80821
  }
80818
80822
  ),
80819
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80820
- overallPercent,
80821
- "%"
80822
- ] }) })
80823
+ /* @__PURE__ */ jsx(
80824
+ "div",
80825
+ {
80826
+ style: {
80827
+ display: "flex",
80828
+ alignItems: "center",
80829
+ width: percentDisplayWidth
80830
+ },
80831
+ children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80832
+ overallPercent,
80833
+ "%"
80834
+ ] })
80835
+ }
80836
+ )
80823
80837
  ] });
80824
80838
  }
80825
80839
  if (isProgressCombined) {
80826
80840
  const combinedPercent = getCombinedPercent(firstBarData, secondBarData);
80827
80841
  const textColor = Number(combinedPercent) === 100 ? "green" : "black";
80842
+ const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
80843
+ const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
80844
+ const secondBarStrokeColor = secondBarData?.value && secondBarData.value > 0 ? theme?.colors?.inputs?.progress?.[secondBarData.status] : null;
80845
+ secondBarData?.value && secondBarData.value > 0 ? {
80846
+ percent: secondBarData.value
80847
+ } : null;
80828
80848
  return /* @__PURE__ */ jsxs(Tile, { style: { width, height, alignItems: "center", gap }, isHorizontal: true, children: [
80849
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%" }, children: [
80850
+ /* @__PURE__ */ jsx(
80851
+ Progress$1,
80852
+ {
80853
+ "data-testid": "progress",
80854
+ percent: adjustedFirstBar,
80855
+ strokeColor: firstBarStrokeColor,
80856
+ showInfo: false
80857
+ }
80858
+ ),
80859
+ secondBarData?.value && secondBarData.value > 0 ? /* @__PURE__ */ jsx(
80860
+ "div",
80861
+ {
80862
+ style: {
80863
+ position: "absolute",
80864
+ top: 0,
80865
+ left: 0,
80866
+ width: "100%",
80867
+ height: "100%",
80868
+ pointerEvents: "none"
80869
+ },
80870
+ children: /* @__PURE__ */ jsx(
80871
+ Progress$1,
80872
+ {
80873
+ percent: secondBarData.value,
80874
+ strokeColor: secondBarStrokeColor,
80875
+ showInfo: false,
80876
+ style: { background: "transparent" }
80877
+ }
80878
+ )
80879
+ }
80880
+ ) : null
80881
+ ] }),
80829
80882
  /* @__PURE__ */ jsx(
80830
- Progress$1,
80883
+ "div",
80831
80884
  {
80832
- "data-testid": "progress",
80833
- percent,
80834
- success,
80835
- strokeColor,
80836
- showInfo: false
80885
+ style: {
80886
+ display: "flex",
80887
+ alignItems: "center",
80888
+ width: percentDisplayWidth
80889
+ },
80890
+ children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80891
+ combinedPercent,
80892
+ "%"
80893
+ ] })
80837
80894
  }
80838
- ),
80839
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80840
- combinedPercent,
80841
- "%"
80842
- ] }) })
80895
+ )
80843
80896
  ] });
80844
80897
  }
80845
80898
  if (isTextBeforeBar) {
@@ -83904,6 +83957,7 @@ function Table({
83904
83957
  size = "small",
83905
83958
  onChange,
83906
83959
  rowSelection,
83960
+ onRowClick,
83907
83961
  pagination,
83908
83962
  isMainContentCell = false,
83909
83963
  isMaterializedView = false,
@@ -83916,6 +83970,7 @@ function Table({
83916
83970
  const [dynamicHeight, setDynamicHeight] = React.useState(
83917
83971
  400
83918
83972
  );
83973
+ const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
83919
83974
  const tableRef = React.useRef(null);
83920
83975
  const containerRef = React.useRef(null);
83921
83976
  React.useEffect(() => {
@@ -84018,6 +84073,61 @@ function Table({
84018
84073
  return rest.scroll;
84019
84074
  }, [isMaterializedView, materializedViewConfig, dynamicHeight, rest.scroll]);
84020
84075
  const tableDataSource = isMaterializedView ? materializedData : dataSource;
84076
+ const handleRowClick = React.useCallback(
84077
+ (record, index2, event) => {
84078
+ console.log("Row clicked:", record, "index:", index2);
84079
+ const target = event.target;
84080
+ const isInteractiveElement = target.closest(
84081
+ 'button, a, input, select, textarea, [role="button"], [onclick]'
84082
+ );
84083
+ console.log("Is interactive element:", isInteractiveElement);
84084
+ if (isInteractiveElement) {
84085
+ console.log("Skipping row selection due to interactive element");
84086
+ return;
84087
+ }
84088
+ if (!rowSelection || !rowSelection.onChange) {
84089
+ console.log("No row selection or onChange handler");
84090
+ return;
84091
+ }
84092
+ if (rowSelection.getCheckboxProps) {
84093
+ const checkboxProps = rowSelection.getCheckboxProps(record);
84094
+ if (checkboxProps.disabled) {
84095
+ console.log("Row is disabled for selection:", record);
84096
+ return;
84097
+ }
84098
+ }
84099
+ const currentSelectedKeys = selectedRowKeys;
84100
+ const recordKey = typeof rowKey === "function" ? rowKey(record) : record[rowKey];
84101
+ console.log("Current selected keys:", currentSelectedKeys);
84102
+ console.log("Record key:", recordKey);
84103
+ const newSelectedKeys = currentSelectedKeys.includes(recordKey) ? currentSelectedKeys.filter((key) => key !== recordKey) : [...currentSelectedKeys, recordKey];
84104
+ console.log("New selected keys:", newSelectedKeys);
84105
+ setSelectedRowKeys(newSelectedKeys);
84106
+ const selectedRows = tableDataSource.filter((record2) => {
84107
+ const key = typeof rowKey === "function" ? rowKey(record2) : record2[rowKey];
84108
+ return newSelectedKeys.includes(key);
84109
+ });
84110
+ console.log("Selected rows:", selectedRows);
84111
+ rowSelection.onChange(newSelectedKeys, selectedRows);
84112
+ },
84113
+ [rowSelection, rowKey, tableDataSource, selectedRowKeys]
84114
+ );
84115
+ const enhancedRowSelection = React.useMemo(() => {
84116
+ if (!rowSelection) return;
84117
+ return {
84118
+ ...rowSelection,
84119
+ selectedRowKeys,
84120
+ // Use internal state
84121
+ // Override the onChange to ensure we get the latest data
84122
+ onChange: (selectedRowKeys2, selectedRows) => {
84123
+ console.log("Row selection changed:", selectedRowKeys2, selectedRows);
84124
+ setSelectedRowKeys(selectedRowKeys2);
84125
+ if (rowSelection.onChange) {
84126
+ rowSelection.onChange(selectedRowKeys2, selectedRows);
84127
+ }
84128
+ }
84129
+ };
84130
+ }, [rowSelection, selectedRowKeys]);
84021
84131
  return /* @__PURE__ */ jsx("div", { ref: containerRef, children: /* @__PURE__ */ jsx(
84022
84132
  Table$1,
84023
84133
  {
@@ -84029,7 +84139,17 @@ function Table({
84029
84139
  locale: { emptyText: "No Data" },
84030
84140
  size,
84031
84141
  onChange,
84032
- rowSelection,
84142
+ rowSelection: enhancedRowSelection,
84143
+ onRow: (record, index2) => {
84144
+ const isDisabled = rowSelection?.getCheckboxProps?.(record)?.disabled ?? false;
84145
+ return {
84146
+ onClick: (event) => handleRowClick(record, index2 ?? 0, event),
84147
+ style: {
84148
+ cursor: rowSelection && !isDisabled ? "pointer" : "default",
84149
+ opacity: isDisabled ? 0.6 : 1
84150
+ }
84151
+ };
84152
+ },
84033
84153
  pagination: paginationConfig,
84034
84154
  scroll: scrollConfig,
84035
84155
  onScroll: isMaterializedView ? handleScroll : void 0,
@@ -84090,6 +84210,9 @@ const defaultRowSelection = (record) => ({
84090
84210
  });
84091
84211
  const useTable = (useTableConfig) => {
84092
84212
  const [isLoading, setLoading] = useState(true);
84213
+ const [hasErrored, setHasErrored] = useState(false);
84214
+ const hasFetchedRef = useRef(false);
84215
+ const isDisabledRef = useRef(false);
84093
84216
  const {
84094
84217
  columns,
84095
84218
  filters = null,
@@ -84116,14 +84239,39 @@ const useTable = (useTableConfig) => {
84116
84239
  error: null
84117
84240
  });
84118
84241
  const [selectedRows, setSelectedRows] = useState([]);
84242
+ const [selectedRowKeys, setSelectedRowKeys] = useState([]);
84243
+ const memoizedFetchOptions = useMemo$1(
84244
+ () => fetchOptions,
84245
+ [fetchOptions.method, fetchOptions.headers, fetchOptions.body]
84246
+ );
84119
84247
  useEffect(() => {
84120
- if (disableAutoFetch && initialDataSource.length > 0) {
84248
+ if (disableAutoFetch) {
84249
+ isDisabledRef.current = true;
84250
+ setLoading(false);
84251
+ return;
84252
+ }
84253
+ if (hasFetchedRef.current || hasErrored || isDisabledRef.current) {
84121
84254
  setLoading(false);
84122
84255
  return;
84123
84256
  }
84124
84257
  const fetchData = async () => {
84125
84258
  try {
84126
- const response = await fetch(fetchUrl, fetchOptions);
84259
+ hasFetchedRef.current = true;
84260
+ const response = await fetch(fetchUrl, memoizedFetchOptions);
84261
+ if (response.status === 404) {
84262
+ console.warn(`Table data not found at ${fetchUrl}, stopping retries`);
84263
+ setHasErrored(true);
84264
+ setData({
84265
+ dataSource: initialDataSource,
84266
+ columns,
84267
+ error: new Error(`Data not found at ${fetchUrl}`)
84268
+ });
84269
+ setLoading(false);
84270
+ return;
84271
+ }
84272
+ if (!response.ok) {
84273
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
84274
+ }
84127
84275
  const result = await response.json();
84128
84276
  const sourceData = result.data || [];
84129
84277
  setOriginalData(sourceData);
@@ -84132,10 +84280,12 @@ const useTable = (useTableConfig) => {
84132
84280
  columns,
84133
84281
  error: null
84134
84282
  });
84283
+ setHasErrored(false);
84135
84284
  } catch (error2) {
84136
84285
  console.error("Error fetching table data:", error2);
84286
+ setHasErrored(true);
84137
84287
  setData({
84138
- dataSource: [],
84288
+ dataSource: initialDataSource,
84139
84289
  columns,
84140
84290
  error: error2 instanceof Error ? error2 : new Error(String(error2))
84141
84291
  });
@@ -84148,11 +84298,19 @@ const useTable = (useTableConfig) => {
84148
84298
  } else {
84149
84299
  fetchData();
84150
84300
  }
84151
- }, [fetchOptions, disableAutoFetch, initialDataSource]);
84301
+ }, [
84302
+ memoizedFetchOptions,
84303
+ disableAutoFetch,
84304
+ hasErrored,
84305
+ fetchUrl,
84306
+ columns,
84307
+ initialDataSource
84308
+ ]);
84152
84309
  const handleRowSelection = useCallback(
84153
- (selectedRowKeys, selectedRows2) => {
84154
- console.log("Row Selected:", selectedRowKeys, selectedRows2);
84155
- setSelectedRows(selectedRows2);
84310
+ (newSelectedRowKeys, newSelectedRows) => {
84311
+ console.log("Row Selected:", newSelectedRowKeys, newSelectedRows);
84312
+ setSelectedRowKeys(newSelectedRowKeys);
84313
+ setSelectedRows(newSelectedRows);
84156
84314
  },
84157
84315
  []
84158
84316
  );
@@ -84163,19 +84321,29 @@ const useTable = (useTableConfig) => {
84163
84321
  dataSource: newDataSource
84164
84322
  }));
84165
84323
  }, []);
84324
+ const retry = useCallback(() => {
84325
+ setHasErrored(false);
84326
+ hasFetchedRef.current = false;
84327
+ isDisabledRef.current = false;
84328
+ setLoading(true);
84329
+ }, []);
84166
84330
  const rowSelection = {
84167
84331
  type: selectionType,
84332
+ selectedRowKeys,
84168
84333
  onChange: handleRowSelection,
84169
84334
  getCheckboxProps: disableRowSelection
84170
84335
  };
84171
84336
  return {
84172
84337
  ...data,
84173
84338
  isLoading,
84339
+ hasErrored,
84174
84340
  rowSelection,
84175
84341
  selectedRows,
84342
+ selectedRowKeys,
84176
84343
  hasSettings,
84177
84344
  hasFilter,
84178
- updateDataSource
84345
+ updateDataSource,
84346
+ retry
84179
84347
  };
84180
84348
  };
84181
84349
  function HiMiniAdjustmentsVertical(props) {
@@ -84449,7 +84617,8 @@ const TableControls = ({
84449
84617
  const TableWithControls = ({
84450
84618
  tableData,
84451
84619
  tableControlsData: tableControlsData2,
84452
- onChange
84620
+ onChange,
84621
+ onRowClick
84453
84622
  }) => {
84454
84623
  const { primaryTableRowData, secondaryTableRowData } = tableControlsData2;
84455
84624
  const {
@@ -84486,6 +84655,7 @@ const TableWithControls = ({
84486
84655
  columns,
84487
84656
  rowSelection,
84488
84657
  onChange: onTableChange,
84658
+ onRowClick,
84489
84659
  isMaterializedView,
84490
84660
  materializedViewConfig
84491
84661
  }
@@ -84549,6 +84719,50 @@ const mockColumns = [
84549
84719
  state: colorStateMap[jobSubtype]
84550
84720
  });
84551
84721
  }
84722
+ },
84723
+ {
84724
+ title: "Progress",
84725
+ dataIndex: "progress",
84726
+ render: (progress) => {
84727
+ if (!progress) return null;
84728
+ return React__default.createElement(Progress, {
84729
+ firstBarData: progress.firstBarData,
84730
+ secondBarData: progress.secondBarData,
84731
+ width: 150,
84732
+ height: 20,
84733
+ isProgressCombined: true
84734
+ });
84735
+ }
84736
+ },
84737
+ {
84738
+ title: "Actions",
84739
+ key: "actions",
84740
+ render: (record) => {
84741
+ const menuItems = [
84742
+ {
84743
+ id: "edit",
84744
+ children: "Edit",
84745
+ onClick: () => {
84746
+ console.log("Edit clicked for record:", record.id);
84747
+ }
84748
+ },
84749
+ {
84750
+ id: "delete",
84751
+ children: "Delete",
84752
+ onClick: () => {
84753
+ console.log("Delete clicked for record:", record.id);
84754
+ }
84755
+ }
84756
+ ];
84757
+ return React__default.createElement(OverflowMenu, {
84758
+ items: menuItems,
84759
+ onItemClick: (item) => {
84760
+ if (item.onClick) {
84761
+ item.onClick();
84762
+ }
84763
+ }
84764
+ });
84765
+ }
84552
84766
  }
84553
84767
  ];
84554
84768
  mockColumns.map((column2) => ({
@@ -84565,7 +84779,19 @@ const mockDataSource = {
84565
84779
  nickname: "Home",
84566
84780
  address: "123 Main St"
84567
84781
  },
84568
- job_subtype: "delivery"
84782
+ job_subtype: "delivery",
84783
+ progress: {
84784
+ firstBarData: {
84785
+ text: "Loading",
84786
+ status: "info",
84787
+ value: 100
84788
+ },
84789
+ secondBarData: {
84790
+ text: "Processing",
84791
+ status: "success",
84792
+ value: 25
84793
+ }
84794
+ }
84569
84795
  },
84570
84796
  {
84571
84797
  id: "2",
@@ -84576,7 +84802,19 @@ const mockDataSource = {
84576
84802
  nickname: "Work",
84577
84803
  address: "456 Elm St"
84578
84804
  },
84579
- job_subtype: "pickup"
84805
+ job_subtype: "pickup",
84806
+ progress: {
84807
+ firstBarData: {
84808
+ text: "Preparing",
84809
+ status: "info",
84810
+ value: 100
84811
+ },
84812
+ secondBarData: {
84813
+ text: "Final Check",
84814
+ status: "success",
84815
+ value: 0
84816
+ }
84817
+ }
84580
84818
  },
84581
84819
  {
84582
84820
  id: "3",
@@ -84587,7 +84825,19 @@ const mockDataSource = {
84587
84825
  nickname: "Store",
84588
84826
  address: "789 Oak St"
84589
84827
  },
84590
- job_subtype: "delivery"
84828
+ job_subtype: "delivery",
84829
+ progress: {
84830
+ firstBarData: {
84831
+ text: "Pending",
84832
+ status: "info",
84833
+ value: 0
84834
+ },
84835
+ secondBarData: {
84836
+ text: "Awaiting",
84837
+ status: "success",
84838
+ value: 0
84839
+ }
84840
+ }
84591
84841
  },
84592
84842
  {
84593
84843
  id: "4",
@@ -84598,7 +84848,19 @@ const mockDataSource = {
84598
84848
  nickname: "Office",
84599
84849
  address: "321 Pine St"
84600
84850
  },
84601
- job_subtype: "pickup"
84851
+ job_subtype: "pickup",
84852
+ progress: {
84853
+ firstBarData: {
84854
+ text: "In Progress",
84855
+ status: "info",
84856
+ value: 100
84857
+ },
84858
+ secondBarData: {
84859
+ text: "Validation",
84860
+ status: "success",
84861
+ value: 30
84862
+ }
84863
+ }
84602
84864
  },
84603
84865
  {
84604
84866
  id: "5",
@@ -84609,7 +84871,19 @@ const mockDataSource = {
84609
84871
  nickname: "Library",
84610
84872
  address: "555 Book Lane"
84611
84873
  },
84612
- job_subtype: "delivery"
84874
+ job_subtype: "delivery",
84875
+ progress: {
84876
+ firstBarData: {
84877
+ text: "Completed",
84878
+ status: "info",
84879
+ value: 100
84880
+ },
84881
+ secondBarData: {
84882
+ text: "Verified",
84883
+ status: "success",
84884
+ value: 100
84885
+ }
84886
+ }
84613
84887
  },
84614
84888
  {
84615
84889
  id: "6",
@@ -84620,7 +84894,19 @@ const mockDataSource = {
84620
84894
  nickname: "Gym",
84621
84895
  address: "777 Fitness Ave"
84622
84896
  },
84623
- job_subtype: "pickup"
84897
+ job_subtype: "pickup",
84898
+ progress: {
84899
+ firstBarData: {
84900
+ text: "Phase 1",
84901
+ status: "info",
84902
+ value: 75
84903
+ },
84904
+ secondBarData: {
84905
+ text: "Phase 2",
84906
+ status: "success",
84907
+ value: 50
84908
+ }
84909
+ }
84624
84910
  },
84625
84911
  {
84626
84912
  id: "7",
@@ -84631,7 +84917,19 @@ const mockDataSource = {
84631
84917
  nickname: "Mall",
84632
84918
  address: "888 Shopping Center"
84633
84919
  },
84634
- job_subtype: "delivery"
84920
+ job_subtype: "delivery",
84921
+ progress: {
84922
+ firstBarData: {
84923
+ text: "Queued",
84924
+ status: "info",
84925
+ value: 0
84926
+ },
84927
+ secondBarData: {
84928
+ text: "Waiting",
84929
+ status: "success",
84930
+ value: 0
84931
+ }
84932
+ }
84635
84933
  },
84636
84934
  {
84637
84935
  id: "8",
@@ -84642,7 +84940,19 @@ const mockDataSource = {
84642
84940
  nickname: "School",
84643
84941
  address: "999 Education Rd"
84644
84942
  },
84645
- job_subtype: "pickup"
84943
+ job_subtype: "pickup",
84944
+ progress: {
84945
+ firstBarData: {
84946
+ text: "Delivered",
84947
+ status: "info",
84948
+ value: 100
84949
+ },
84950
+ secondBarData: {
84951
+ text: "Confirmed",
84952
+ status: "success",
84953
+ value: 100
84954
+ }
84955
+ }
84646
84956
  },
84647
84957
  {
84648
84958
  id: "9",
@@ -84653,7 +84963,19 @@ const mockDataSource = {
84653
84963
  nickname: "Restaurant",
84654
84964
  address: "111 Food Court"
84655
84965
  },
84656
- job_subtype: "delivery"
84966
+ job_subtype: "delivery",
84967
+ progress: {
84968
+ firstBarData: {
84969
+ text: "Preparing",
84970
+ status: "info",
84971
+ value: 100
84972
+ },
84973
+ secondBarData: {
84974
+ text: "Quality Check",
84975
+ status: "success",
84976
+ value: 15
84977
+ }
84978
+ }
84657
84979
  },
84658
84980
  {
84659
84981
  id: "10",
@@ -84664,7 +84986,19 @@ const mockDataSource = {
84664
84986
  nickname: "Park",
84665
84987
  address: "222 Green Ave"
84666
84988
  },
84667
- job_subtype: "pickup"
84989
+ job_subtype: "pickup",
84990
+ progress: {
84991
+ firstBarData: {
84992
+ text: "Processing",
84993
+ status: "info",
84994
+ value: 80
84995
+ },
84996
+ secondBarData: {
84997
+ text: "Review",
84998
+ status: "success",
84999
+ value: 0
85000
+ }
85001
+ }
84668
85002
  },
84669
85003
  {
84670
85004
  id: "11",
@@ -84838,9 +85172,10 @@ const startingUseTableConfig = {
84838
85172
  dataSource: []
84839
85173
  };
84840
85174
  const useTableWithControls = (tableConfig) => {
84841
- const [useTableConfig, setUseTableConfig] = useState(
84842
- startingUseTableConfig
84843
- );
85175
+ const [useTableConfig, setUseTableConfig] = useState(() => ({
85176
+ ...startingUseTableConfig,
85177
+ ...tableConfig
85178
+ }));
84844
85179
  const [groups, setGroups] = useState(
84845
85180
  tableControlsData.secondaryTableRowData.groups
84846
85181
  );
@@ -84851,20 +85186,22 @@ const useTableWithControls = (tableConfig) => {
84851
85186
  });
84852
85187
  const { secondaryTableRowData } = tableControlsData;
84853
85188
  const {
84854
- dataSource,
85189
+ dataSource: hookDataSource,
84855
85190
  columns,
84856
85191
  rowSelection,
85192
+ selectedRows,
85193
+ selectedRowKeys,
84857
85194
  hasSettings,
84858
85195
  hasFilter,
84859
85196
  updateDataSource
84860
85197
  } = useTable(useTableConfig);
85198
+ const dataSource = tableConfig.dataSource || hookDataSource;
84861
85199
  const safeDataSource = dataSource || [];
84862
85200
  const newSecondaryTableRowData = {
84863
85201
  ...secondaryTableRowData,
84864
85202
  groups,
84865
85203
  totalRecords: safeDataSource.length
84866
85204
  };
84867
- if (!dataSource) return null;
84868
85205
  const onGroupItemClick = (title, item) => {
84869
85206
  const newGroups = { ...groups };
84870
85207
  newGroups[title] = newGroups[title].filter((group) => group !== item);
@@ -84954,6 +85291,8 @@ const useTableWithControls = (tableConfig) => {
84954
85291
  dataSource: safeDataSource,
84955
85292
  columns,
84956
85293
  rowSelection,
85294
+ selectedRows,
85295
+ selectedRowKeys,
84957
85296
  updateDataSource
84958
85297
  };
84959
85298
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.4.5",
3
+ "version": "0.4.9",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",