@gobolt/genesis 0.4.4 → 0.4.7

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,13 +1,17 @@
1
1
  import { default as React } from 'react';
2
+ import { OverflowMenuItemProps } from '../OverflowMenuItem';
2
3
  export interface OverflowMenuProps {
3
- children: React.ReactNode;
4
+ items?: OverflowMenuItemProps[];
5
+ children?: React.ReactNode;
4
6
  trigger: React.ReactNode;
5
7
  isOpen?: boolean;
6
8
  onOpenChange?: (open: boolean) => void;
7
9
  placement?: "bottom" | "top" | "left" | "right";
10
+ alignment?: "left" | "right";
8
11
  offset?: number;
9
12
  className?: string;
10
13
  style?: React.CSSProperties;
14
+ onItemClick?: (item: OverflowMenuItemProps) => void;
11
15
  }
12
16
  declare const OverflowMenu: React.FC<OverflowMenuProps>;
13
17
  export default OverflowMenu;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface OverflowMenuItemProps {
3
+ id?: string;
4
+ children: React.ReactNode;
5
+ onClick?: () => void;
6
+ }
7
+ declare const OverflowMenuItem: ({ children, onClick }: OverflowMenuItemProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default OverflowMenuItem;
@@ -0,0 +1,2 @@
1
+ export { default } from './OverflowMenuItem';
2
+ export type { OverflowMenuItemProps } from './OverflowMenuItem';
@@ -0,0 +1,6 @@
1
+ import { GenesisTheme } from '../../styles/theme/genesis-theme.types';
2
+ interface StyledOverflowMenuItemProperties {
3
+ theme?: GenesisTheme;
4
+ }
5
+ export declare const OverflowMenuItem: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledOverflowMenuItemProperties>> & string;
6
+ export {};
@@ -9,6 +9,18 @@ export interface AppointmentWithSimpleAddress {
9
9
  address: string;
10
10
  };
11
11
  job_subtype: "delivery" | "pickup";
12
+ progress?: {
13
+ firstBarData: {
14
+ text: string;
15
+ status: string;
16
+ value: number;
17
+ };
18
+ secondBarData?: {
19
+ text: string;
20
+ status: string;
21
+ value: number;
22
+ };
23
+ };
12
24
  }
13
25
  export interface MockDataSource {
14
26
  appointments: AppointmentWithSimpleAddress[];
@@ -41,6 +41,8 @@ export { default as Notification } from './Notification';
41
41
  export type { NotificationProps } from './Notification';
42
42
  export { default as OverflowMenu } from './OverflowMenu';
43
43
  export type { OverflowMenuProps } from './OverflowMenu';
44
+ export { default as OverflowMenuItem } from './OverflowMenuItem';
45
+ export type { OverflowMenuItemProps } from './OverflowMenuItem';
44
46
  export { default as Popover } from './Popover';
45
47
  export type { PopoverProps } from './Popover';
46
48
  export { default as Progress } from './Progress';
package/dist/index.cjs CHANGED
@@ -80499,15 +80499,34 @@ const OverflowMenuContainer = styled.div`
80499
80499
  contain: layout style paint;
80500
80500
  isolation: isolate;
80501
80501
  `;
80502
+ const OverflowMenuItem$1 = styled.div`
80503
+ padding: 8px 12px;
80504
+ cursor: pointer;
80505
+ background-color: ${({ theme }) => theme.colors.surface.default?.backgroundColor || "#ffffff"};
80506
+
80507
+ &:hover {
80508
+ background-color: ${({ theme }) => theme.colors.surface.hover?.backgroundColor || "#F4F4F4"};
80509
+ }
80510
+
80511
+ &:active {
80512
+ background-color: ${({ theme }) => theme.colors.surface.active?.backgroundColor || "#E0E0E0"};
80513
+ }
80514
+ `;
80515
+ const OverflowMenuItem = ({ children: children2, onClick }) => {
80516
+ return /* @__PURE__ */ jsxRuntime.jsx(OverflowMenuItem$1, { onClick, children: children2 });
80517
+ };
80502
80518
  const OverflowMenu = ({
80519
+ items,
80503
80520
  children: children2,
80504
80521
  trigger,
80505
80522
  isOpen: controlledIsOpen,
80506
80523
  onOpenChange,
80507
80524
  placement = "bottom",
80525
+ alignment = "left",
80508
80526
  offset: offset2 = 8,
80509
80527
  className,
80510
- style: style2
80528
+ style: style2,
80529
+ onItemClick
80511
80530
  }) => {
80512
80531
  const [internalIsOpen, setInternalIsOpen] = React.useState(false);
80513
80532
  const [isAnimating, setIsAnimating] = React.useState(false);
@@ -80515,21 +80534,27 @@ const OverflowMenu = ({
80515
80534
  const menuRef = React.useRef(null);
80516
80535
  const { theme } = useGenesis();
80517
80536
  const isOpen = controlledIsOpen === void 0 ? internalIsOpen : controlledIsOpen;
80518
- const handleOpenChange = (open) => {
80519
- if (onOpenChange) {
80520
- onOpenChange(open);
80521
- } else {
80522
- setInternalIsOpen(open);
80523
- }
80524
- };
80537
+ const handleOpenChange = React.useCallback(
80538
+ (open) => {
80539
+ if (onOpenChange) {
80540
+ onOpenChange(open);
80541
+ } else {
80542
+ setInternalIsOpen(open);
80543
+ }
80544
+ },
80545
+ [onOpenChange]
80546
+ );
80525
80547
  const handleTriggerClick = () => {
80526
80548
  handleOpenChange(!isOpen);
80527
80549
  };
80528
- const handleClickOutside = (event) => {
80529
- if (triggerRef.current && menuRef.current && !triggerRef.current.contains(event.target) && !menuRef.current.contains(event.target)) {
80530
- handleOpenChange(false);
80531
- }
80532
- };
80550
+ const handleClickOutside = React.useCallback(
80551
+ (event) => {
80552
+ if (triggerRef.current && menuRef.current && !triggerRef.current.contains(event.target) && !menuRef.current.contains(event.target)) {
80553
+ handleOpenChange(false);
80554
+ }
80555
+ },
80556
+ [handleOpenChange]
80557
+ );
80533
80558
  React.useEffect(() => {
80534
80559
  if (isOpen) {
80535
80560
  const timer2 = setTimeout(() => {
@@ -80544,8 +80569,8 @@ const OverflowMenu = ({
80544
80569
  setIsAnimating(false);
80545
80570
  document.removeEventListener("mousedown", handleClickOutside);
80546
80571
  }
80547
- }, [isOpen]);
80548
- const getMenuStyle = () => {
80572
+ }, [isOpen, handleClickOutside]);
80573
+ const getMenuStyle = React.useMemo(() => {
80549
80574
  const baseStyle = {
80550
80575
  position: "absolute",
80551
80576
  zIndex: 1e3,
@@ -80556,37 +80581,68 @@ const OverflowMenu = ({
80556
80581
  return {
80557
80582
  ...baseStyle,
80558
80583
  top: `calc(100% + ${offset2}px)`,
80559
- left: 0,
80560
- right: 0
80584
+ ...alignment === "right" ? { right: 0 } : { left: 0 }
80561
80585
  };
80562
80586
  }
80563
80587
  case "top": {
80564
80588
  return {
80565
80589
  ...baseStyle,
80566
80590
  bottom: `calc(100% + ${offset2}px)`,
80567
- left: 0,
80568
- right: 0
80591
+ ...alignment === "right" ? { right: 0 } : { left: 0 }
80569
80592
  };
80570
80593
  }
80571
80594
  case "left": {
80572
80595
  return {
80573
80596
  ...baseStyle,
80574
80597
  top: 0,
80575
- right: `calc(100% + ${offset2}px)`
80598
+ right: `calc(100% + ${offset2}px)`,
80599
+ ...alignment === "right" ? { bottom: 0 } : {}
80576
80600
  };
80577
80601
  }
80578
80602
  case "right": {
80579
80603
  return {
80580
80604
  ...baseStyle,
80581
80605
  top: 0,
80582
- left: `calc(100% + ${offset2}px)`
80606
+ left: `calc(100% + ${offset2}px)`,
80607
+ ...alignment === "right" ? { bottom: 0 } : {}
80583
80608
  };
80584
80609
  }
80585
80610
  default: {
80586
80611
  return baseStyle;
80587
80612
  }
80588
80613
  }
80589
- };
80614
+ }, [placement, alignment, offset2, style2]);
80615
+ const handleItemClick = React.useCallback(
80616
+ (item) => {
80617
+ onItemClick?.(item);
80618
+ handleOpenChange(false);
80619
+ },
80620
+ [onItemClick, handleOpenChange]
80621
+ );
80622
+ if (items && items.length > 0) {
80623
+ return /* @__PURE__ */ jsxRuntime.jsxs(OverflowMenuWrapper, { children: [
80624
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
80625
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx(
80626
+ OverflowMenuContainer,
80627
+ {
80628
+ ref: menuRef,
80629
+ theme,
80630
+ className,
80631
+ style: getMenuStyle,
80632
+ $isAnimating: isAnimating,
80633
+ $placement: placement,
80634
+ children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
80635
+ OverflowMenuItem,
80636
+ {
80637
+ ...item,
80638
+ onClick: () => handleItemClick(item)
80639
+ },
80640
+ item.id
80641
+ ))
80642
+ }
80643
+ )
80644
+ ] });
80645
+ }
80590
80646
  return /* @__PURE__ */ jsxRuntime.jsxs(OverflowMenuWrapper, { children: [
80591
80647
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
80592
80648
  isOpen && /* @__PURE__ */ jsxRuntime.jsx(
@@ -80595,7 +80651,7 @@ const OverflowMenu = ({
80595
80651
  ref: menuRef,
80596
80652
  theme,
80597
80653
  className,
80598
- style: getMenuStyle(),
80654
+ style: getMenuStyle,
80599
80655
  $isAnimating: isAnimating,
80600
80656
  $placement: placement,
80601
80657
  children: children2
@@ -80736,15 +80792,12 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
80736
80792
  );
80737
80793
  };
80738
80794
  const getCombinedPercent = (firstBarData, secondBarData) => {
80739
- if (secondBarData?.value === 0) {
80740
- return firstBarData?.value;
80741
- }
80742
- if (firstBarData?.value && secondBarData?.value) {
80743
- const total = firstBarData?.value + secondBarData?.value;
80795
+ if (firstBarData?.value !== void 0 && secondBarData?.value !== void 0) {
80796
+ const total = firstBarData.value + secondBarData.value;
80744
80797
  const dividedBy = total / 2;
80745
- return dividedBy;
80798
+ return Math.round(dividedBy * 10) / 10;
80746
80799
  }
80747
- return 0;
80800
+ return firstBarData?.value || 0;
80748
80801
  };
80749
80802
  const Progress = ({
80750
80803
  firstBarData,
@@ -80763,6 +80816,7 @@ const Progress = ({
80763
80816
  strokeColor: theme?.colors?.inputs?.progress?.[secondBarData.status]
80764
80817
  } : null;
80765
80818
  const stateColor = strokeColor;
80819
+ const percentDisplayWidth = 110;
80766
80820
  const gap = 8;
80767
80821
  if (isSingleBarOverallSuccess && secondBarData !== null) {
80768
80822
  const overallPercent = secondBarData.value;
@@ -80778,30 +80832,79 @@ const Progress = ({
80778
80832
  showInfo: false
80779
80833
  }
80780
80834
  ),
80781
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
80782
- overallPercent,
80783
- "%"
80784
- ] }) })
80835
+ /* @__PURE__ */ jsxRuntime.jsx(
80836
+ "div",
80837
+ {
80838
+ style: {
80839
+ display: "flex",
80840
+ alignItems: "center",
80841
+ width: percentDisplayWidth
80842
+ },
80843
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
80844
+ overallPercent,
80845
+ "%"
80846
+ ] })
80847
+ }
80848
+ )
80785
80849
  ] });
80786
80850
  }
80787
80851
  if (isProgressCombined) {
80788
80852
  const combinedPercent = getCombinedPercent(firstBarData, secondBarData);
80789
80853
  const textColor = Number(combinedPercent) === 100 ? "green" : "black";
80854
+ const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
80855
+ const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
80856
+ const secondBarStrokeColor = secondBarData?.value && secondBarData.value > 0 ? theme?.colors?.inputs?.progress?.[secondBarData.status] : null;
80857
+ secondBarData?.value && secondBarData.value > 0 ? {
80858
+ percent: secondBarData.value
80859
+ } : null;
80790
80860
  return /* @__PURE__ */ jsxRuntime.jsxs(Tile, { style: { width, height, alignItems: "center", gap }, isHorizontal: true, children: [
80861
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: "100%" }, children: [
80862
+ /* @__PURE__ */ jsxRuntime.jsx(
80863
+ Progress$1,
80864
+ {
80865
+ "data-testid": "progress",
80866
+ percent: adjustedFirstBar,
80867
+ strokeColor: firstBarStrokeColor,
80868
+ showInfo: false
80869
+ }
80870
+ ),
80871
+ secondBarData?.value && secondBarData.value > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
80872
+ "div",
80873
+ {
80874
+ style: {
80875
+ position: "absolute",
80876
+ top: 0,
80877
+ left: 0,
80878
+ width: "100%",
80879
+ height: "100%",
80880
+ pointerEvents: "none"
80881
+ },
80882
+ children: /* @__PURE__ */ jsxRuntime.jsx(
80883
+ Progress$1,
80884
+ {
80885
+ percent: secondBarData.value,
80886
+ strokeColor: secondBarStrokeColor,
80887
+ showInfo: false,
80888
+ style: { background: "transparent" }
80889
+ }
80890
+ )
80891
+ }
80892
+ ) : null
80893
+ ] }),
80791
80894
  /* @__PURE__ */ jsxRuntime.jsx(
80792
- Progress$1,
80895
+ "div",
80793
80896
  {
80794
- "data-testid": "progress",
80795
- percent,
80796
- success,
80797
- strokeColor,
80798
- showInfo: false
80897
+ style: {
80898
+ display: "flex",
80899
+ alignItems: "center",
80900
+ width: percentDisplayWidth
80901
+ },
80902
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
80903
+ combinedPercent,
80904
+ "%"
80905
+ ] })
80799
80906
  }
80800
- ),
80801
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { color: textColor, variant: "digits3", children: [
80802
- combinedPercent,
80803
- "%"
80804
- ] }) })
80907
+ )
80805
80908
  ] });
80806
80909
  }
80807
80910
  if (isTextBeforeBar) {
@@ -84511,6 +84614,20 @@ const mockColumns = [
84511
84614
  state: colorStateMap[jobSubtype]
84512
84615
  });
84513
84616
  }
84617
+ },
84618
+ {
84619
+ title: "Progress",
84620
+ dataIndex: "progress",
84621
+ render: (progress) => {
84622
+ if (!progress) return null;
84623
+ return React.createElement(Progress, {
84624
+ firstBarData: progress.firstBarData,
84625
+ secondBarData: progress.secondBarData,
84626
+ width: 150,
84627
+ height: 20,
84628
+ isProgressCombined: true
84629
+ });
84630
+ }
84514
84631
  }
84515
84632
  ];
84516
84633
  mockColumns.map((column2) => ({
@@ -84527,7 +84644,19 @@ const mockDataSource = {
84527
84644
  nickname: "Home",
84528
84645
  address: "123 Main St"
84529
84646
  },
84530
- job_subtype: "delivery"
84647
+ job_subtype: "delivery",
84648
+ progress: {
84649
+ firstBarData: {
84650
+ text: "Loading",
84651
+ status: "info",
84652
+ value: 100
84653
+ },
84654
+ secondBarData: {
84655
+ text: "Processing",
84656
+ status: "success",
84657
+ value: 25
84658
+ }
84659
+ }
84531
84660
  },
84532
84661
  {
84533
84662
  id: "2",
@@ -84538,7 +84667,19 @@ const mockDataSource = {
84538
84667
  nickname: "Work",
84539
84668
  address: "456 Elm St"
84540
84669
  },
84541
- job_subtype: "pickup"
84670
+ job_subtype: "pickup",
84671
+ progress: {
84672
+ firstBarData: {
84673
+ text: "Preparing",
84674
+ status: "info",
84675
+ value: 100
84676
+ },
84677
+ secondBarData: {
84678
+ text: "Final Check",
84679
+ status: "success",
84680
+ value: 0
84681
+ }
84682
+ }
84542
84683
  },
84543
84684
  {
84544
84685
  id: "3",
@@ -84549,7 +84690,19 @@ const mockDataSource = {
84549
84690
  nickname: "Store",
84550
84691
  address: "789 Oak St"
84551
84692
  },
84552
- job_subtype: "delivery"
84693
+ job_subtype: "delivery",
84694
+ progress: {
84695
+ firstBarData: {
84696
+ text: "Pending",
84697
+ status: "info",
84698
+ value: 0
84699
+ },
84700
+ secondBarData: {
84701
+ text: "Awaiting",
84702
+ status: "success",
84703
+ value: 0
84704
+ }
84705
+ }
84553
84706
  },
84554
84707
  {
84555
84708
  id: "4",
@@ -84560,7 +84713,19 @@ const mockDataSource = {
84560
84713
  nickname: "Office",
84561
84714
  address: "321 Pine St"
84562
84715
  },
84563
- job_subtype: "pickup"
84716
+ job_subtype: "pickup",
84717
+ progress: {
84718
+ firstBarData: {
84719
+ text: "In Progress",
84720
+ status: "info",
84721
+ value: 100
84722
+ },
84723
+ secondBarData: {
84724
+ text: "Validation",
84725
+ status: "success",
84726
+ value: 30
84727
+ }
84728
+ }
84564
84729
  },
84565
84730
  {
84566
84731
  id: "5",
@@ -84571,7 +84736,19 @@ const mockDataSource = {
84571
84736
  nickname: "Library",
84572
84737
  address: "555 Book Lane"
84573
84738
  },
84574
- job_subtype: "delivery"
84739
+ job_subtype: "delivery",
84740
+ progress: {
84741
+ firstBarData: {
84742
+ text: "Completed",
84743
+ status: "info",
84744
+ value: 100
84745
+ },
84746
+ secondBarData: {
84747
+ text: "Verified",
84748
+ status: "success",
84749
+ value: 100
84750
+ }
84751
+ }
84575
84752
  },
84576
84753
  {
84577
84754
  id: "6",
@@ -84582,7 +84759,19 @@ const mockDataSource = {
84582
84759
  nickname: "Gym",
84583
84760
  address: "777 Fitness Ave"
84584
84761
  },
84585
- job_subtype: "pickup"
84762
+ job_subtype: "pickup",
84763
+ progress: {
84764
+ firstBarData: {
84765
+ text: "Phase 1",
84766
+ status: "info",
84767
+ value: 75
84768
+ },
84769
+ secondBarData: {
84770
+ text: "Phase 2",
84771
+ status: "success",
84772
+ value: 50
84773
+ }
84774
+ }
84586
84775
  },
84587
84776
  {
84588
84777
  id: "7",
@@ -84593,7 +84782,19 @@ const mockDataSource = {
84593
84782
  nickname: "Mall",
84594
84783
  address: "888 Shopping Center"
84595
84784
  },
84596
- job_subtype: "delivery"
84785
+ job_subtype: "delivery",
84786
+ progress: {
84787
+ firstBarData: {
84788
+ text: "Queued",
84789
+ status: "info",
84790
+ value: 0
84791
+ },
84792
+ secondBarData: {
84793
+ text: "Waiting",
84794
+ status: "success",
84795
+ value: 0
84796
+ }
84797
+ }
84597
84798
  },
84598
84799
  {
84599
84800
  id: "8",
@@ -84604,7 +84805,19 @@ const mockDataSource = {
84604
84805
  nickname: "School",
84605
84806
  address: "999 Education Rd"
84606
84807
  },
84607
- job_subtype: "pickup"
84808
+ job_subtype: "pickup",
84809
+ progress: {
84810
+ firstBarData: {
84811
+ text: "Delivered",
84812
+ status: "info",
84813
+ value: 100
84814
+ },
84815
+ secondBarData: {
84816
+ text: "Confirmed",
84817
+ status: "success",
84818
+ value: 100
84819
+ }
84820
+ }
84608
84821
  },
84609
84822
  {
84610
84823
  id: "9",
@@ -84615,7 +84828,19 @@ const mockDataSource = {
84615
84828
  nickname: "Restaurant",
84616
84829
  address: "111 Food Court"
84617
84830
  },
84618
- job_subtype: "delivery"
84831
+ job_subtype: "delivery",
84832
+ progress: {
84833
+ firstBarData: {
84834
+ text: "Preparing",
84835
+ status: "info",
84836
+ value: 100
84837
+ },
84838
+ secondBarData: {
84839
+ text: "Quality Check",
84840
+ status: "success",
84841
+ value: 15
84842
+ }
84843
+ }
84619
84844
  },
84620
84845
  {
84621
84846
  id: "10",
@@ -84626,7 +84851,19 @@ const mockDataSource = {
84626
84851
  nickname: "Park",
84627
84852
  address: "222 Green Ave"
84628
84853
  },
84629
- job_subtype: "pickup"
84854
+ job_subtype: "pickup",
84855
+ progress: {
84856
+ firstBarData: {
84857
+ text: "Processing",
84858
+ status: "info",
84859
+ value: 80
84860
+ },
84861
+ secondBarData: {
84862
+ text: "Review",
84863
+ status: "success",
84864
+ value: 0
84865
+ }
84866
+ }
84630
84867
  },
84631
84868
  {
84632
84869
  id: "11",
@@ -85075,6 +85312,7 @@ exports.LineChart = LineChart;
85075
85312
  exports.Message = Message;
85076
85313
  exports.Notification = Notification;
85077
85314
  exports.OverflowMenu = OverflowMenu;
85315
+ exports.OverflowMenuItem = OverflowMenuItem;
85078
85316
  exports.Popover = Popover;
85079
85317
  exports.Progress = Progress;
85080
85318
  exports.RadioGroup = RadioGroup;
package/dist/index.js CHANGED
@@ -80481,15 +80481,34 @@ const OverflowMenuContainer = styled.div`
80481
80481
  contain: layout style paint;
80482
80482
  isolation: isolate;
80483
80483
  `;
80484
+ const OverflowMenuItem$1 = styled.div`
80485
+ padding: 8px 12px;
80486
+ cursor: pointer;
80487
+ background-color: ${({ theme }) => theme.colors.surface.default?.backgroundColor || "#ffffff"};
80488
+
80489
+ &:hover {
80490
+ background-color: ${({ theme }) => theme.colors.surface.hover?.backgroundColor || "#F4F4F4"};
80491
+ }
80492
+
80493
+ &:active {
80494
+ background-color: ${({ theme }) => theme.colors.surface.active?.backgroundColor || "#E0E0E0"};
80495
+ }
80496
+ `;
80497
+ const OverflowMenuItem = ({ children: children2, onClick }) => {
80498
+ return /* @__PURE__ */ jsx(OverflowMenuItem$1, { onClick, children: children2 });
80499
+ };
80484
80500
  const OverflowMenu = ({
80501
+ items,
80485
80502
  children: children2,
80486
80503
  trigger,
80487
80504
  isOpen: controlledIsOpen,
80488
80505
  onOpenChange,
80489
80506
  placement = "bottom",
80507
+ alignment = "left",
80490
80508
  offset: offset2 = 8,
80491
80509
  className,
80492
- style: style2
80510
+ style: style2,
80511
+ onItemClick
80493
80512
  }) => {
80494
80513
  const [internalIsOpen, setInternalIsOpen] = useState(false);
80495
80514
  const [isAnimating, setIsAnimating] = useState(false);
@@ -80497,21 +80516,27 @@ const OverflowMenu = ({
80497
80516
  const menuRef = useRef(null);
80498
80517
  const { theme } = useGenesis();
80499
80518
  const isOpen = controlledIsOpen === void 0 ? internalIsOpen : controlledIsOpen;
80500
- const handleOpenChange = (open) => {
80501
- if (onOpenChange) {
80502
- onOpenChange(open);
80503
- } else {
80504
- setInternalIsOpen(open);
80505
- }
80506
- };
80519
+ const handleOpenChange = useCallback(
80520
+ (open) => {
80521
+ if (onOpenChange) {
80522
+ onOpenChange(open);
80523
+ } else {
80524
+ setInternalIsOpen(open);
80525
+ }
80526
+ },
80527
+ [onOpenChange]
80528
+ );
80507
80529
  const handleTriggerClick = () => {
80508
80530
  handleOpenChange(!isOpen);
80509
80531
  };
80510
- const handleClickOutside = (event) => {
80511
- if (triggerRef.current && menuRef.current && !triggerRef.current.contains(event.target) && !menuRef.current.contains(event.target)) {
80512
- handleOpenChange(false);
80513
- }
80514
- };
80532
+ const handleClickOutside = useCallback(
80533
+ (event) => {
80534
+ if (triggerRef.current && menuRef.current && !triggerRef.current.contains(event.target) && !menuRef.current.contains(event.target)) {
80535
+ handleOpenChange(false);
80536
+ }
80537
+ },
80538
+ [handleOpenChange]
80539
+ );
80515
80540
  useEffect(() => {
80516
80541
  if (isOpen) {
80517
80542
  const timer2 = setTimeout(() => {
@@ -80526,8 +80551,8 @@ const OverflowMenu = ({
80526
80551
  setIsAnimating(false);
80527
80552
  document.removeEventListener("mousedown", handleClickOutside);
80528
80553
  }
80529
- }, [isOpen]);
80530
- const getMenuStyle = () => {
80554
+ }, [isOpen, handleClickOutside]);
80555
+ const getMenuStyle = useMemo$1(() => {
80531
80556
  const baseStyle = {
80532
80557
  position: "absolute",
80533
80558
  zIndex: 1e3,
@@ -80538,37 +80563,68 @@ const OverflowMenu = ({
80538
80563
  return {
80539
80564
  ...baseStyle,
80540
80565
  top: `calc(100% + ${offset2}px)`,
80541
- left: 0,
80542
- right: 0
80566
+ ...alignment === "right" ? { right: 0 } : { left: 0 }
80543
80567
  };
80544
80568
  }
80545
80569
  case "top": {
80546
80570
  return {
80547
80571
  ...baseStyle,
80548
80572
  bottom: `calc(100% + ${offset2}px)`,
80549
- left: 0,
80550
- right: 0
80573
+ ...alignment === "right" ? { right: 0 } : { left: 0 }
80551
80574
  };
80552
80575
  }
80553
80576
  case "left": {
80554
80577
  return {
80555
80578
  ...baseStyle,
80556
80579
  top: 0,
80557
- right: `calc(100% + ${offset2}px)`
80580
+ right: `calc(100% + ${offset2}px)`,
80581
+ ...alignment === "right" ? { bottom: 0 } : {}
80558
80582
  };
80559
80583
  }
80560
80584
  case "right": {
80561
80585
  return {
80562
80586
  ...baseStyle,
80563
80587
  top: 0,
80564
- left: `calc(100% + ${offset2}px)`
80588
+ left: `calc(100% + ${offset2}px)`,
80589
+ ...alignment === "right" ? { bottom: 0 } : {}
80565
80590
  };
80566
80591
  }
80567
80592
  default: {
80568
80593
  return baseStyle;
80569
80594
  }
80570
80595
  }
80571
- };
80596
+ }, [placement, alignment, offset2, style2]);
80597
+ const handleItemClick = useCallback(
80598
+ (item) => {
80599
+ onItemClick?.(item);
80600
+ handleOpenChange(false);
80601
+ },
80602
+ [onItemClick, handleOpenChange]
80603
+ );
80604
+ if (items && items.length > 0) {
80605
+ return /* @__PURE__ */ jsxs(OverflowMenuWrapper, { children: [
80606
+ /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
80607
+ isOpen && /* @__PURE__ */ jsx(
80608
+ OverflowMenuContainer,
80609
+ {
80610
+ ref: menuRef,
80611
+ theme,
80612
+ className,
80613
+ style: getMenuStyle,
80614
+ $isAnimating: isAnimating,
80615
+ $placement: placement,
80616
+ children: items.map((item) => /* @__PURE__ */ jsx(
80617
+ OverflowMenuItem,
80618
+ {
80619
+ ...item,
80620
+ onClick: () => handleItemClick(item)
80621
+ },
80622
+ item.id
80623
+ ))
80624
+ }
80625
+ )
80626
+ ] });
80627
+ }
80572
80628
  return /* @__PURE__ */ jsxs(OverflowMenuWrapper, { children: [
80573
80629
  /* @__PURE__ */ jsx("div", { ref: triggerRef, onClick: handleTriggerClick, children: trigger }),
80574
80630
  isOpen && /* @__PURE__ */ jsx(
@@ -80577,7 +80633,7 @@ const OverflowMenu = ({
80577
80633
  ref: menuRef,
80578
80634
  theme,
80579
80635
  className,
80580
- style: getMenuStyle(),
80636
+ style: getMenuStyle,
80581
80637
  $isAnimating: isAnimating,
80582
80638
  $placement: placement,
80583
80639
  children: children2
@@ -80718,15 +80774,12 @@ const getTextComponent = (firstBarData, secondBarData, stateColor, theme, isText
80718
80774
  );
80719
80775
  };
80720
80776
  const getCombinedPercent = (firstBarData, secondBarData) => {
80721
- if (secondBarData?.value === 0) {
80722
- return firstBarData?.value;
80723
- }
80724
- if (firstBarData?.value && secondBarData?.value) {
80725
- const total = firstBarData?.value + secondBarData?.value;
80777
+ if (firstBarData?.value !== void 0 && secondBarData?.value !== void 0) {
80778
+ const total = firstBarData.value + secondBarData.value;
80726
80779
  const dividedBy = total / 2;
80727
- return dividedBy;
80780
+ return Math.round(dividedBy * 10) / 10;
80728
80781
  }
80729
- return 0;
80782
+ return firstBarData?.value || 0;
80730
80783
  };
80731
80784
  const Progress = ({
80732
80785
  firstBarData,
@@ -80745,6 +80798,7 @@ const Progress = ({
80745
80798
  strokeColor: theme?.colors?.inputs?.progress?.[secondBarData.status]
80746
80799
  } : null;
80747
80800
  const stateColor = strokeColor;
80801
+ const percentDisplayWidth = 110;
80748
80802
  const gap = 8;
80749
80803
  if (isSingleBarOverallSuccess && secondBarData !== null) {
80750
80804
  const overallPercent = secondBarData.value;
@@ -80760,30 +80814,79 @@ const Progress = ({
80760
80814
  showInfo: false
80761
80815
  }
80762
80816
  ),
80763
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80764
- overallPercent,
80765
- "%"
80766
- ] }) })
80817
+ /* @__PURE__ */ jsx(
80818
+ "div",
80819
+ {
80820
+ style: {
80821
+ display: "flex",
80822
+ alignItems: "center",
80823
+ width: percentDisplayWidth
80824
+ },
80825
+ children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80826
+ overallPercent,
80827
+ "%"
80828
+ ] })
80829
+ }
80830
+ )
80767
80831
  ] });
80768
80832
  }
80769
80833
  if (isProgressCombined) {
80770
80834
  const combinedPercent = getCombinedPercent(firstBarData, secondBarData);
80771
80835
  const textColor = Number(combinedPercent) === 100 ? "green" : "black";
80836
+ const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
80837
+ const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
80838
+ const secondBarStrokeColor = secondBarData?.value && secondBarData.value > 0 ? theme?.colors?.inputs?.progress?.[secondBarData.status] : null;
80839
+ secondBarData?.value && secondBarData.value > 0 ? {
80840
+ percent: secondBarData.value
80841
+ } : null;
80772
80842
  return /* @__PURE__ */ jsxs(Tile, { style: { width, height, alignItems: "center", gap }, isHorizontal: true, children: [
80843
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%" }, children: [
80844
+ /* @__PURE__ */ jsx(
80845
+ Progress$1,
80846
+ {
80847
+ "data-testid": "progress",
80848
+ percent: adjustedFirstBar,
80849
+ strokeColor: firstBarStrokeColor,
80850
+ showInfo: false
80851
+ }
80852
+ ),
80853
+ secondBarData?.value && secondBarData.value > 0 ? /* @__PURE__ */ jsx(
80854
+ "div",
80855
+ {
80856
+ style: {
80857
+ position: "absolute",
80858
+ top: 0,
80859
+ left: 0,
80860
+ width: "100%",
80861
+ height: "100%",
80862
+ pointerEvents: "none"
80863
+ },
80864
+ children: /* @__PURE__ */ jsx(
80865
+ Progress$1,
80866
+ {
80867
+ percent: secondBarData.value,
80868
+ strokeColor: secondBarStrokeColor,
80869
+ showInfo: false,
80870
+ style: { background: "transparent" }
80871
+ }
80872
+ )
80873
+ }
80874
+ ) : null
80875
+ ] }),
80773
80876
  /* @__PURE__ */ jsx(
80774
- Progress$1,
80877
+ "div",
80775
80878
  {
80776
- "data-testid": "progress",
80777
- percent,
80778
- success,
80779
- strokeColor,
80780
- showInfo: false
80879
+ style: {
80880
+ display: "flex",
80881
+ alignItems: "center",
80882
+ width: percentDisplayWidth
80883
+ },
80884
+ children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80885
+ combinedPercent,
80886
+ "%"
80887
+ ] })
80781
80888
  }
80782
- ),
80783
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", width: 80 }, children: /* @__PURE__ */ jsxs(Typography, { color: textColor, variant: "digits3", children: [
80784
- combinedPercent,
80785
- "%"
80786
- ] }) })
80889
+ )
80787
80890
  ] });
80788
80891
  }
80789
80892
  if (isTextBeforeBar) {
@@ -84493,6 +84596,20 @@ const mockColumns = [
84493
84596
  state: colorStateMap[jobSubtype]
84494
84597
  });
84495
84598
  }
84599
+ },
84600
+ {
84601
+ title: "Progress",
84602
+ dataIndex: "progress",
84603
+ render: (progress) => {
84604
+ if (!progress) return null;
84605
+ return React__default.createElement(Progress, {
84606
+ firstBarData: progress.firstBarData,
84607
+ secondBarData: progress.secondBarData,
84608
+ width: 150,
84609
+ height: 20,
84610
+ isProgressCombined: true
84611
+ });
84612
+ }
84496
84613
  }
84497
84614
  ];
84498
84615
  mockColumns.map((column2) => ({
@@ -84509,7 +84626,19 @@ const mockDataSource = {
84509
84626
  nickname: "Home",
84510
84627
  address: "123 Main St"
84511
84628
  },
84512
- job_subtype: "delivery"
84629
+ job_subtype: "delivery",
84630
+ progress: {
84631
+ firstBarData: {
84632
+ text: "Loading",
84633
+ status: "info",
84634
+ value: 100
84635
+ },
84636
+ secondBarData: {
84637
+ text: "Processing",
84638
+ status: "success",
84639
+ value: 25
84640
+ }
84641
+ }
84513
84642
  },
84514
84643
  {
84515
84644
  id: "2",
@@ -84520,7 +84649,19 @@ const mockDataSource = {
84520
84649
  nickname: "Work",
84521
84650
  address: "456 Elm St"
84522
84651
  },
84523
- job_subtype: "pickup"
84652
+ job_subtype: "pickup",
84653
+ progress: {
84654
+ firstBarData: {
84655
+ text: "Preparing",
84656
+ status: "info",
84657
+ value: 100
84658
+ },
84659
+ secondBarData: {
84660
+ text: "Final Check",
84661
+ status: "success",
84662
+ value: 0
84663
+ }
84664
+ }
84524
84665
  },
84525
84666
  {
84526
84667
  id: "3",
@@ -84531,7 +84672,19 @@ const mockDataSource = {
84531
84672
  nickname: "Store",
84532
84673
  address: "789 Oak St"
84533
84674
  },
84534
- job_subtype: "delivery"
84675
+ job_subtype: "delivery",
84676
+ progress: {
84677
+ firstBarData: {
84678
+ text: "Pending",
84679
+ status: "info",
84680
+ value: 0
84681
+ },
84682
+ secondBarData: {
84683
+ text: "Awaiting",
84684
+ status: "success",
84685
+ value: 0
84686
+ }
84687
+ }
84535
84688
  },
84536
84689
  {
84537
84690
  id: "4",
@@ -84542,7 +84695,19 @@ const mockDataSource = {
84542
84695
  nickname: "Office",
84543
84696
  address: "321 Pine St"
84544
84697
  },
84545
- job_subtype: "pickup"
84698
+ job_subtype: "pickup",
84699
+ progress: {
84700
+ firstBarData: {
84701
+ text: "In Progress",
84702
+ status: "info",
84703
+ value: 100
84704
+ },
84705
+ secondBarData: {
84706
+ text: "Validation",
84707
+ status: "success",
84708
+ value: 30
84709
+ }
84710
+ }
84546
84711
  },
84547
84712
  {
84548
84713
  id: "5",
@@ -84553,7 +84718,19 @@ const mockDataSource = {
84553
84718
  nickname: "Library",
84554
84719
  address: "555 Book Lane"
84555
84720
  },
84556
- job_subtype: "delivery"
84721
+ job_subtype: "delivery",
84722
+ progress: {
84723
+ firstBarData: {
84724
+ text: "Completed",
84725
+ status: "info",
84726
+ value: 100
84727
+ },
84728
+ secondBarData: {
84729
+ text: "Verified",
84730
+ status: "success",
84731
+ value: 100
84732
+ }
84733
+ }
84557
84734
  },
84558
84735
  {
84559
84736
  id: "6",
@@ -84564,7 +84741,19 @@ const mockDataSource = {
84564
84741
  nickname: "Gym",
84565
84742
  address: "777 Fitness Ave"
84566
84743
  },
84567
- job_subtype: "pickup"
84744
+ job_subtype: "pickup",
84745
+ progress: {
84746
+ firstBarData: {
84747
+ text: "Phase 1",
84748
+ status: "info",
84749
+ value: 75
84750
+ },
84751
+ secondBarData: {
84752
+ text: "Phase 2",
84753
+ status: "success",
84754
+ value: 50
84755
+ }
84756
+ }
84568
84757
  },
84569
84758
  {
84570
84759
  id: "7",
@@ -84575,7 +84764,19 @@ const mockDataSource = {
84575
84764
  nickname: "Mall",
84576
84765
  address: "888 Shopping Center"
84577
84766
  },
84578
- job_subtype: "delivery"
84767
+ job_subtype: "delivery",
84768
+ progress: {
84769
+ firstBarData: {
84770
+ text: "Queued",
84771
+ status: "info",
84772
+ value: 0
84773
+ },
84774
+ secondBarData: {
84775
+ text: "Waiting",
84776
+ status: "success",
84777
+ value: 0
84778
+ }
84779
+ }
84579
84780
  },
84580
84781
  {
84581
84782
  id: "8",
@@ -84586,7 +84787,19 @@ const mockDataSource = {
84586
84787
  nickname: "School",
84587
84788
  address: "999 Education Rd"
84588
84789
  },
84589
- job_subtype: "pickup"
84790
+ job_subtype: "pickup",
84791
+ progress: {
84792
+ firstBarData: {
84793
+ text: "Delivered",
84794
+ status: "info",
84795
+ value: 100
84796
+ },
84797
+ secondBarData: {
84798
+ text: "Confirmed",
84799
+ status: "success",
84800
+ value: 100
84801
+ }
84802
+ }
84590
84803
  },
84591
84804
  {
84592
84805
  id: "9",
@@ -84597,7 +84810,19 @@ const mockDataSource = {
84597
84810
  nickname: "Restaurant",
84598
84811
  address: "111 Food Court"
84599
84812
  },
84600
- job_subtype: "delivery"
84813
+ job_subtype: "delivery",
84814
+ progress: {
84815
+ firstBarData: {
84816
+ text: "Preparing",
84817
+ status: "info",
84818
+ value: 100
84819
+ },
84820
+ secondBarData: {
84821
+ text: "Quality Check",
84822
+ status: "success",
84823
+ value: 15
84824
+ }
84825
+ }
84601
84826
  },
84602
84827
  {
84603
84828
  id: "10",
@@ -84608,7 +84833,19 @@ const mockDataSource = {
84608
84833
  nickname: "Park",
84609
84834
  address: "222 Green Ave"
84610
84835
  },
84611
- job_subtype: "pickup"
84836
+ job_subtype: "pickup",
84837
+ progress: {
84838
+ firstBarData: {
84839
+ text: "Processing",
84840
+ status: "info",
84841
+ value: 80
84842
+ },
84843
+ secondBarData: {
84844
+ text: "Review",
84845
+ status: "success",
84846
+ value: 0
84847
+ }
84848
+ }
84612
84849
  },
84613
84850
  {
84614
84851
  id: "11",
@@ -85058,6 +85295,7 @@ export {
85058
85295
  Message,
85059
85296
  Notification,
85060
85297
  OverflowMenu,
85298
+ OverflowMenuItem,
85061
85299
  Popover,
85062
85300
  Progress,
85063
85301
  RadioGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.4.4",
3
+ "version": "0.4.7",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",