@gobolt/genesis 0.4.1 → 0.4.2
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.
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { TableProps } from '../Table';
|
|
2
2
|
import { TableControlsData } from '../Table/TableControls/TableControls';
|
|
3
|
+
import { ActionEvent, TableEventPayload } from '../../types/events';
|
|
3
4
|
export interface TableWithControlsProps {
|
|
4
5
|
tableControlsData: TableControlsData;
|
|
5
6
|
tableData: TableProps<Record<string, any>>;
|
|
6
|
-
onChange: (event:
|
|
7
|
-
event: string;
|
|
8
|
-
payload: any;
|
|
9
|
-
}) => void;
|
|
7
|
+
onChange: (event: ActionEvent<TableEventPayload>) => void;
|
|
10
8
|
}
|
|
11
9
|
declare const TableWithControls: ({ tableData, tableControlsData, onChange, }: TableWithControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
export default TableWithControls;
|
package/dist/index.cjs
CHANGED
|
@@ -82128,6 +82128,9 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
|
|
|
82128
82128
|
);
|
|
82129
82129
|
};
|
|
82130
82130
|
const getCombinedPercent = (firstBarData, secondBarData) => {
|
|
82131
|
+
if (secondBarData?.value === 0) {
|
|
82132
|
+
return firstBarData?.value;
|
|
82133
|
+
}
|
|
82131
82134
|
if (firstBarData?.value && secondBarData?.value) {
|
|
82132
82135
|
const total = firstBarData?.value + secondBarData?.value;
|
|
82133
82136
|
const dividedBy = total / 2;
|
|
@@ -82402,7 +82405,7 @@ const Radio = ({ id: id2, label, selectedId, onChange, isDisabled }) => {
|
|
|
82402
82405
|
RadioWrapper,
|
|
82403
82406
|
{
|
|
82404
82407
|
ref: radioReference,
|
|
82405
|
-
$isDisabled: isDisabled,
|
|
82408
|
+
$isDisabled: isDisabled ?? false,
|
|
82406
82409
|
onFocus: (e3) => {
|
|
82407
82410
|
if (isDisabled || e3.target !== radioReference.current) return;
|
|
82408
82411
|
setIsFocused(true);
|
|
@@ -82571,7 +82574,7 @@ const RowLabelValue = ({
|
|
|
82571
82574
|
children: label
|
|
82572
82575
|
}
|
|
82573
82576
|
) }),
|
|
82574
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(RowSkeleton, { isFullWidth }) }) : getBadgeOrTypography(badgeProps, value2) })
|
|
82577
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(RowSkeleton, { isFullWidth: isFullWidth ?? false }) }) : getBadgeOrTypography(badgeProps, value2) })
|
|
82575
82578
|
] });
|
|
82576
82579
|
};
|
|
82577
82580
|
const ActionsContainer = styled.div`
|
|
@@ -82621,13 +82624,13 @@ const Row = ({
|
|
|
82621
82624
|
RowLabelValue,
|
|
82622
82625
|
{
|
|
82623
82626
|
label,
|
|
82624
|
-
value: value2,
|
|
82627
|
+
value: value2 ?? "",
|
|
82625
82628
|
isFullWidth,
|
|
82626
82629
|
isLoading,
|
|
82627
82630
|
badgeProps: badgeProperties
|
|
82628
82631
|
}
|
|
82629
82632
|
),
|
|
82630
|
-
/* @__PURE__ */ jsxRuntime.jsx(RowActions, { actions })
|
|
82633
|
+
/* @__PURE__ */ jsxRuntime.jsx(RowActions, { actions: actions ?? null })
|
|
82631
82634
|
]
|
|
82632
82635
|
}
|
|
82633
82636
|
);
|
|
@@ -82682,11 +82685,14 @@ const SegmentedControls = ({
|
|
|
82682
82685
|
value: id2,
|
|
82683
82686
|
icon
|
|
82684
82687
|
}));
|
|
82688
|
+
const handleChange = (value2) => {
|
|
82689
|
+
onChange(String(value2));
|
|
82690
|
+
};
|
|
82685
82691
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
82686
82692
|
SegmentedControls$1,
|
|
82687
82693
|
{
|
|
82688
82694
|
options: antOptions,
|
|
82689
|
-
onChange,
|
|
82695
|
+
onChange: handleChange,
|
|
82690
82696
|
value: selectedTabId,
|
|
82691
82697
|
block: isScaled
|
|
82692
82698
|
}
|
|
@@ -82944,6 +82950,7 @@ const Select = ({
|
|
|
82944
82950
|
}
|
|
82945
82951
|
};
|
|
82946
82952
|
const getSelectModeValue = (value22) => {
|
|
82953
|
+
if (!value22) return "";
|
|
82947
82954
|
if (Array.isArray(value22)) {
|
|
82948
82955
|
if (selectDisplayMode === "count") {
|
|
82949
82956
|
return `${value22.length} selected`;
|
|
@@ -83935,7 +83942,7 @@ const PrimaryTableControlsRow = ({
|
|
|
83935
83942
|
const onSortChange = (value2) => {
|
|
83936
83943
|
const sortActionEvent = {
|
|
83937
83944
|
event: "primarySortChange",
|
|
83938
|
-
payload: { value: value2 }
|
|
83945
|
+
payload: { value: Array.isArray(value2) ? value2[0] : value2 }
|
|
83939
83946
|
};
|
|
83940
83947
|
onChange?.(sortActionEvent);
|
|
83941
83948
|
};
|
|
@@ -84137,7 +84144,7 @@ const SecondaryTableControlsRow = ({
|
|
|
84137
84144
|
},
|
|
84138
84145
|
children: [
|
|
84139
84146
|
/* @__PURE__ */ jsxRuntime.jsx(GroupsRow, { groups, onGroupItemClick }),
|
|
84140
|
-
totalRecords > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null
|
|
84147
|
+
(totalRecords ?? 0) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null
|
|
84141
84148
|
]
|
|
84142
84149
|
}
|
|
84143
84150
|
);
|
|
@@ -84198,7 +84205,7 @@ const TableWithControls = ({
|
|
|
84198
84205
|
const onTableChange = (pagination, filters, sorter) => {
|
|
84199
84206
|
onChange({
|
|
84200
84207
|
event: "tableChange",
|
|
84201
|
-
payload: { pagination, filters, sorter }
|
|
84208
|
+
payload: { value: "tableChange", pagination, filters, sorter }
|
|
84202
84209
|
});
|
|
84203
84210
|
};
|
|
84204
84211
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
package/dist/index.js
CHANGED
|
@@ -82110,6 +82110,9 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
|
|
|
82110
82110
|
);
|
|
82111
82111
|
};
|
|
82112
82112
|
const getCombinedPercent = (firstBarData, secondBarData) => {
|
|
82113
|
+
if (secondBarData?.value === 0) {
|
|
82114
|
+
return firstBarData?.value;
|
|
82115
|
+
}
|
|
82113
82116
|
if (firstBarData?.value && secondBarData?.value) {
|
|
82114
82117
|
const total = firstBarData?.value + secondBarData?.value;
|
|
82115
82118
|
const dividedBy = total / 2;
|
|
@@ -82384,7 +82387,7 @@ const Radio = ({ id: id2, label, selectedId, onChange, isDisabled }) => {
|
|
|
82384
82387
|
RadioWrapper,
|
|
82385
82388
|
{
|
|
82386
82389
|
ref: radioReference,
|
|
82387
|
-
$isDisabled: isDisabled,
|
|
82390
|
+
$isDisabled: isDisabled ?? false,
|
|
82388
82391
|
onFocus: (e3) => {
|
|
82389
82392
|
if (isDisabled || e3.target !== radioReference.current) return;
|
|
82390
82393
|
setIsFocused(true);
|
|
@@ -82553,7 +82556,7 @@ const RowLabelValue = ({
|
|
|
82553
82556
|
children: label
|
|
82554
82557
|
}
|
|
82555
82558
|
) }),
|
|
82556
|
-
/* @__PURE__ */ jsx("div", { children: isLoading ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(RowSkeleton, { isFullWidth }) }) : getBadgeOrTypography(badgeProps, value2) })
|
|
82559
|
+
/* @__PURE__ */ jsx("div", { children: isLoading ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(RowSkeleton, { isFullWidth: isFullWidth ?? false }) }) : getBadgeOrTypography(badgeProps, value2) })
|
|
82557
82560
|
] });
|
|
82558
82561
|
};
|
|
82559
82562
|
const ActionsContainer = styled.div`
|
|
@@ -82603,13 +82606,13 @@ const Row = ({
|
|
|
82603
82606
|
RowLabelValue,
|
|
82604
82607
|
{
|
|
82605
82608
|
label,
|
|
82606
|
-
value: value2,
|
|
82609
|
+
value: value2 ?? "",
|
|
82607
82610
|
isFullWidth,
|
|
82608
82611
|
isLoading,
|
|
82609
82612
|
badgeProps: badgeProperties
|
|
82610
82613
|
}
|
|
82611
82614
|
),
|
|
82612
|
-
/* @__PURE__ */ jsx(RowActions, { actions })
|
|
82615
|
+
/* @__PURE__ */ jsx(RowActions, { actions: actions ?? null })
|
|
82613
82616
|
]
|
|
82614
82617
|
}
|
|
82615
82618
|
);
|
|
@@ -82664,11 +82667,14 @@ const SegmentedControls = ({
|
|
|
82664
82667
|
value: id2,
|
|
82665
82668
|
icon
|
|
82666
82669
|
}));
|
|
82670
|
+
const handleChange = (value2) => {
|
|
82671
|
+
onChange(String(value2));
|
|
82672
|
+
};
|
|
82667
82673
|
return /* @__PURE__ */ jsx(
|
|
82668
82674
|
SegmentedControls$1,
|
|
82669
82675
|
{
|
|
82670
82676
|
options: antOptions,
|
|
82671
|
-
onChange,
|
|
82677
|
+
onChange: handleChange,
|
|
82672
82678
|
value: selectedTabId,
|
|
82673
82679
|
block: isScaled
|
|
82674
82680
|
}
|
|
@@ -82926,6 +82932,7 @@ const Select = ({
|
|
|
82926
82932
|
}
|
|
82927
82933
|
};
|
|
82928
82934
|
const getSelectModeValue = (value22) => {
|
|
82935
|
+
if (!value22) return "";
|
|
82929
82936
|
if (Array.isArray(value22)) {
|
|
82930
82937
|
if (selectDisplayMode === "count") {
|
|
82931
82938
|
return `${value22.length} selected`;
|
|
@@ -83917,7 +83924,7 @@ const PrimaryTableControlsRow = ({
|
|
|
83917
83924
|
const onSortChange = (value2) => {
|
|
83918
83925
|
const sortActionEvent = {
|
|
83919
83926
|
event: "primarySortChange",
|
|
83920
|
-
payload: { value: value2 }
|
|
83927
|
+
payload: { value: Array.isArray(value2) ? value2[0] : value2 }
|
|
83921
83928
|
};
|
|
83922
83929
|
onChange?.(sortActionEvent);
|
|
83923
83930
|
};
|
|
@@ -84119,7 +84126,7 @@ const SecondaryTableControlsRow = ({
|
|
|
84119
84126
|
},
|
|
84120
84127
|
children: [
|
|
84121
84128
|
/* @__PURE__ */ jsx(GroupsRow, { groups, onGroupItemClick }),
|
|
84122
|
-
totalRecords > 0 ? /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null
|
|
84129
|
+
(totalRecords ?? 0) > 0 ? /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null
|
|
84123
84130
|
]
|
|
84124
84131
|
}
|
|
84125
84132
|
);
|
|
@@ -84180,7 +84187,7 @@ const TableWithControls = ({
|
|
|
84180
84187
|
const onTableChange = (pagination, filters, sorter) => {
|
|
84181
84188
|
onChange({
|
|
84182
84189
|
event: "tableChange",
|
|
84183
|
-
payload: { pagination, filters, sorter }
|
|
84190
|
+
payload: { value: "tableChange", pagination, filters, sorter }
|
|
84184
84191
|
});
|
|
84185
84192
|
};
|
|
84186
84193
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|