@gobolt/genesis 0.4.35 → 0.4.38

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,5 +1,6 @@
1
1
  import { Change } from '../Table';
2
2
  import { InfiniteScrollChangeEvent } from '../InfiniteScrollTable/types';
3
+ import * as React from "react";
3
4
  export type Groups = {
4
5
  [key: string]: string[];
5
6
  };
@@ -10,6 +11,7 @@ export interface SecondaryTableControlsRowProps {
10
11
  infiniteScrollData?: InfiniteScrollChangeEvent;
11
12
  intialRowTotal?: number;
12
13
  hasExternalFilters?: boolean;
14
+ getCustomIcon?: (title: string) => React.ReactNode | null;
13
15
  }
14
- declare const SecondaryTableControlsRow: ({ groups, totalRecords, onChange, infiniteScrollData, intialRowTotal, hasExternalFilters, }: SecondaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
16
+ declare const SecondaryTableControlsRow: ({ groups, totalRecords, onChange, infiniteScrollData, intialRowTotal, hasExternalFilters, getCustomIcon, }: SecondaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
15
17
  export default SecondaryTableControlsRow;
package/dist/index.cjs CHANGED
@@ -81253,12 +81253,10 @@ const OverflowMenuContainer = styled.div`
81253
81253
  transform: translateZ(0);
81254
81254
  transform-style: preserve-3d;
81255
81255
 
81256
- /* Initial hidden state to prevent flash */
81257
- ${({ $isAnimating }) => !$isAnimating && `
81258
- opacity: 0;
81259
- transform: scale(0.96) translateY(-6px);
81260
- pointer-events: none;
81261
- `}
81256
+ /* Initial visible state - let animation handle the entrance */
81257
+ opacity: 1;
81258
+
81259
+ /* Animation will override initial state when $isAnimating is true */
81262
81260
 
81263
81261
  /* Prevent layout shifts and ensure smooth rendering */
81264
81262
  contain: layout style paint;
@@ -81338,16 +81336,13 @@ const OverflowMenu = React.forwardRef(
81338
81336
  );
81339
81337
  React.useEffect(() => {
81340
81338
  if (isOpen) {
81341
- if (getPopupContainer && triggerRef.current) {
81339
+ if (getPopupContainer !== void 0 && triggerRef.current) {
81342
81340
  const rect = triggerRef.current.getBoundingClientRect();
81343
81341
  setTriggerRect(rect);
81344
81342
  }
81345
- const timer2 = setTimeout(() => {
81346
- setIsAnimating(true);
81347
- }, 10);
81343
+ setIsAnimating(true);
81348
81344
  document.addEventListener("mousedown", handleClickOutside);
81349
81345
  return () => {
81350
- clearTimeout(timer2);
81351
81346
  document.removeEventListener("mousedown", handleClickOutside);
81352
81347
  };
81353
81348
  } else {
@@ -81358,11 +81353,11 @@ const OverflowMenu = React.forwardRef(
81358
81353
  }, [isOpen, handleClickOutside, getPopupContainer]);
81359
81354
  const getMenuStyle = React.useMemo(() => {
81360
81355
  const baseStyle = {
81361
- position: getPopupContainer ? "fixed" : "absolute",
81356
+ position: getPopupContainer !== void 0 ? "fixed" : "absolute",
81362
81357
  zIndex: 1e3,
81363
81358
  ...style2
81364
81359
  };
81365
- if (getPopupContainer && triggerRect) {
81360
+ if (getPopupContainer !== void 0 && triggerRect) {
81366
81361
  const { top, left, right, bottom, width, height } = triggerRect;
81367
81362
  switch (placement) {
81368
81363
  case "bottom": {
@@ -81456,7 +81451,7 @@ const OverflowMenu = React.forwardRef(
81456
81451
  }
81457
81452
  );
81458
81453
  const renderMenu = (content2) => {
81459
- if (getPopupContainer && triggerRef.current) {
81454
+ if (getPopupContainer !== void 0 && triggerRef.current) {
81460
81455
  const container = getPopupContainer(triggerRef.current);
81461
81456
  return ReactDOM.createPortal(renderMenuContent(content2), container);
81462
81457
  }
@@ -81681,7 +81676,7 @@ const Progress = ({
81681
81676
  }
81682
81677
  if (isProgressCombined) {
81683
81678
  const combinedPercent = getCombinedPercent(
81684
- firstBarData,
81679
+ firstBarData || null,
81685
81680
  secondBarData || null
81686
81681
  );
81687
81682
  const textColor = Number(combinedPercent) === 100 ? "green" : "black";
@@ -85739,7 +85734,12 @@ const PrimaryTableControlsRow = ({
85739
85734
  }
85740
85735
  );
85741
85736
  };
85742
- const GroupItem = ({ title, items, onGroupItemClick }) => {
85737
+ const GroupItem = ({
85738
+ title,
85739
+ items,
85740
+ onGroupItemClick,
85741
+ getCustomIcon
85742
+ }) => {
85743
85743
  if (items.length === 0) return null;
85744
85744
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
85745
85745
  /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, { tip: title, isAbsolutePositioned: false, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -85752,7 +85752,7 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
85752
85752
  width: 24,
85753
85753
  height: 24
85754
85754
  },
85755
- children: getIcon$1(title)
85755
+ children: getCustomIcon ? getCustomIcon(title) : getIcon$1(title)
85756
85756
  }
85757
85757
  ) }),
85758
85758
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 4 }, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -85769,7 +85769,11 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
85769
85769
  )) })
85770
85770
  ] });
85771
85771
  };
85772
- const GroupsRow = ({ groups, onGroupItemClick }) => {
85772
+ const GroupsRow = ({
85773
+ groups,
85774
+ onGroupItemClick,
85775
+ getCustomIcon
85776
+ }) => {
85773
85777
  if (!groups) return null;
85774
85778
  const groupArray = Object.entries(groups).map(([title, items]) => ({
85775
85779
  title,
@@ -85780,7 +85784,8 @@ const GroupsRow = ({ groups, onGroupItemClick }) => {
85780
85784
  {
85781
85785
  title: group.title,
85782
85786
  items: group.items,
85783
- onGroupItemClick
85787
+ onGroupItemClick,
85788
+ getCustomIcon
85784
85789
  },
85785
85790
  group.title
85786
85791
  )) : null });
@@ -85791,7 +85796,8 @@ const SecondaryTableControlsRow = ({
85791
85796
  onChange,
85792
85797
  infiniteScrollData,
85793
85798
  intialRowTotal = 40,
85794
- hasExternalFilters = false
85799
+ hasExternalFilters = false,
85800
+ getCustomIcon
85795
85801
  }) => {
85796
85802
  const [hasChanged, setHasChanged] = React__namespace.useState(false);
85797
85803
  const onGroupItemClick = (title, item) => {
@@ -85834,7 +85840,14 @@ const SecondaryTableControlsRow = ({
85834
85840
  marginTop: 8
85835
85841
  },
85836
85842
  children: [
85837
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(GroupsRow, { groups, onGroupItemClick }) }),
85843
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
85844
+ GroupsRow,
85845
+ {
85846
+ groups,
85847
+ onGroupItemClick,
85848
+ getCustomIcon
85849
+ }
85850
+ ) }),
85838
85851
  (totalRecords ?? 0) > 0 && !infiniteScrollData ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null,
85839
85852
  /* @__PURE__ */ jsxRuntime.jsxs(
85840
85853
  "div",
package/dist/index.js CHANGED
@@ -81235,12 +81235,10 @@ const OverflowMenuContainer = styled.div`
81235
81235
  transform: translateZ(0);
81236
81236
  transform-style: preserve-3d;
81237
81237
 
81238
- /* Initial hidden state to prevent flash */
81239
- ${({ $isAnimating }) => !$isAnimating && `
81240
- opacity: 0;
81241
- transform: scale(0.96) translateY(-6px);
81242
- pointer-events: none;
81243
- `}
81238
+ /* Initial visible state - let animation handle the entrance */
81239
+ opacity: 1;
81240
+
81241
+ /* Animation will override initial state when $isAnimating is true */
81244
81242
 
81245
81243
  /* Prevent layout shifts and ensure smooth rendering */
81246
81244
  contain: layout style paint;
@@ -81320,16 +81318,13 @@ const OverflowMenu = forwardRef(
81320
81318
  );
81321
81319
  useEffect(() => {
81322
81320
  if (isOpen) {
81323
- if (getPopupContainer && triggerRef.current) {
81321
+ if (getPopupContainer !== void 0 && triggerRef.current) {
81324
81322
  const rect = triggerRef.current.getBoundingClientRect();
81325
81323
  setTriggerRect(rect);
81326
81324
  }
81327
- const timer2 = setTimeout(() => {
81328
- setIsAnimating(true);
81329
- }, 10);
81325
+ setIsAnimating(true);
81330
81326
  document.addEventListener("mousedown", handleClickOutside);
81331
81327
  return () => {
81332
- clearTimeout(timer2);
81333
81328
  document.removeEventListener("mousedown", handleClickOutside);
81334
81329
  };
81335
81330
  } else {
@@ -81340,11 +81335,11 @@ const OverflowMenu = forwardRef(
81340
81335
  }, [isOpen, handleClickOutside, getPopupContainer]);
81341
81336
  const getMenuStyle = useMemo$1(() => {
81342
81337
  const baseStyle = {
81343
- position: getPopupContainer ? "fixed" : "absolute",
81338
+ position: getPopupContainer !== void 0 ? "fixed" : "absolute",
81344
81339
  zIndex: 1e3,
81345
81340
  ...style2
81346
81341
  };
81347
- if (getPopupContainer && triggerRect) {
81342
+ if (getPopupContainer !== void 0 && triggerRect) {
81348
81343
  const { top, left, right, bottom, width, height } = triggerRect;
81349
81344
  switch (placement) {
81350
81345
  case "bottom": {
@@ -81438,7 +81433,7 @@ const OverflowMenu = forwardRef(
81438
81433
  }
81439
81434
  );
81440
81435
  const renderMenu = (content2) => {
81441
- if (getPopupContainer && triggerRef.current) {
81436
+ if (getPopupContainer !== void 0 && triggerRef.current) {
81442
81437
  const container = getPopupContainer(triggerRef.current);
81443
81438
  return createPortal(renderMenuContent(content2), container);
81444
81439
  }
@@ -81663,7 +81658,7 @@ const Progress = ({
81663
81658
  }
81664
81659
  if (isProgressCombined) {
81665
81660
  const combinedPercent = getCombinedPercent(
81666
- firstBarData,
81661
+ firstBarData || null,
81667
81662
  secondBarData || null
81668
81663
  );
81669
81664
  const textColor = Number(combinedPercent) === 100 ? "green" : "black";
@@ -85721,7 +85716,12 @@ const PrimaryTableControlsRow = ({
85721
85716
  }
85722
85717
  );
85723
85718
  };
85724
- const GroupItem = ({ title, items, onGroupItemClick }) => {
85719
+ const GroupItem = ({
85720
+ title,
85721
+ items,
85722
+ onGroupItemClick,
85723
+ getCustomIcon
85724
+ }) => {
85725
85725
  if (items.length === 0) return null;
85726
85726
  return /* @__PURE__ */ jsxs(Fragment, { children: [
85727
85727
  /* @__PURE__ */ jsx(Tooltip2, { tip: title, isAbsolutePositioned: false, children: /* @__PURE__ */ jsx(
@@ -85734,7 +85734,7 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
85734
85734
  width: 24,
85735
85735
  height: 24
85736
85736
  },
85737
- children: getIcon$1(title)
85737
+ children: getCustomIcon ? getCustomIcon(title) : getIcon$1(title)
85738
85738
  }
85739
85739
  ) }),
85740
85740
  /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4 }, children: items.map((item) => /* @__PURE__ */ jsx(
@@ -85751,7 +85751,11 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
85751
85751
  )) })
85752
85752
  ] });
85753
85753
  };
85754
- const GroupsRow = ({ groups, onGroupItemClick }) => {
85754
+ const GroupsRow = ({
85755
+ groups,
85756
+ onGroupItemClick,
85757
+ getCustomIcon
85758
+ }) => {
85755
85759
  if (!groups) return null;
85756
85760
  const groupArray = Object.entries(groups).map(([title, items]) => ({
85757
85761
  title,
@@ -85762,7 +85766,8 @@ const GroupsRow = ({ groups, onGroupItemClick }) => {
85762
85766
  {
85763
85767
  title: group.title,
85764
85768
  items: group.items,
85765
- onGroupItemClick
85769
+ onGroupItemClick,
85770
+ getCustomIcon
85766
85771
  },
85767
85772
  group.title
85768
85773
  )) : null });
@@ -85773,7 +85778,8 @@ const SecondaryTableControlsRow = ({
85773
85778
  onChange,
85774
85779
  infiniteScrollData,
85775
85780
  intialRowTotal = 40,
85776
- hasExternalFilters = false
85781
+ hasExternalFilters = false,
85782
+ getCustomIcon
85777
85783
  }) => {
85778
85784
  const [hasChanged, setHasChanged] = React.useState(false);
85779
85785
  const onGroupItemClick = (title, item) => {
@@ -85816,7 +85822,14 @@ const SecondaryTableControlsRow = ({
85816
85822
  marginTop: 8
85817
85823
  },
85818
85824
  children: [
85819
- /* @__PURE__ */ jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsx(GroupsRow, { groups, onGroupItemClick }) }),
85825
+ /* @__PURE__ */ jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsx(
85826
+ GroupsRow,
85827
+ {
85828
+ groups,
85829
+ onGroupItemClick,
85830
+ getCustomIcon
85831
+ }
85832
+ ) }),
85820
85833
  (totalRecords ?? 0) > 0 && !infiniteScrollData ? /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` }) : null,
85821
85834
  /* @__PURE__ */ jsxs(
85822
85835
  "div",
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  export declare const getIcon: (name: string) => import("react/jsx-runtime").JSX.Element | null;
2
3
  export declare const getIconColor: (state: any, theme: any) => any;
3
- export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: React.ReactNode | null | undefined) => string | number | true | Iterable<import('react').ReactNode> | import("react/jsx-runtime").JSX.Element | null;
4
+ export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: React.ReactNode | null | undefined) => string | number | true | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.4.35",
3
+ "version": "0.4.38",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",