@shipfox/react-ui 0.12.0 → 0.14.0

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.
Files changed (100) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/.turbo/turbo-check.log +2 -2
  3. package/.turbo/turbo-type.log +1 -1
  4. package/CHANGELOG.md +12 -0
  5. package/dist/components/badge/index.d.ts +4 -4
  6. package/dist/components/badge/index.d.ts.map +1 -1
  7. package/dist/components/badge/index.js +4 -4
  8. package/dist/components/badge/index.js.map +1 -1
  9. package/dist/components/code-block/code-block-footer.d.ts.map +1 -1
  10. package/dist/components/code-block/code-block-footer.js +11 -5
  11. package/dist/components/code-block/code-block-footer.js.map +1 -1
  12. package/dist/components/confetti/confetti.d.ts +21 -0
  13. package/dist/components/confetti/confetti.d.ts.map +1 -0
  14. package/dist/components/confetti/confetti.js +101 -0
  15. package/dist/components/confetti/confetti.js.map +1 -0
  16. package/dist/components/confetti/confetti.stories.js +41 -0
  17. package/dist/components/confetti/confetti.stories.js.map +1 -0
  18. package/dist/components/confetti/index.d.ts +2 -0
  19. package/dist/components/confetti/index.d.ts.map +1 -0
  20. package/dist/components/confetti/index.js +3 -0
  21. package/dist/components/confetti/index.js.map +1 -0
  22. package/dist/components/dropdown-menu/index.d.ts +1 -2
  23. package/dist/components/dropdown-menu/index.d.ts.map +1 -1
  24. package/dist/components/dropdown-menu/index.js +1 -1
  25. package/dist/components/dropdown-menu/index.js.map +1 -1
  26. package/dist/components/icon/icon.d.ts +3 -2
  27. package/dist/components/icon/icon.d.ts.map +1 -1
  28. package/dist/components/icon/icon.js +7 -2
  29. package/dist/components/icon/icon.js.map +1 -1
  30. package/dist/components/index.d.ts +4 -0
  31. package/dist/components/index.d.ts.map +1 -1
  32. package/dist/components/index.js +4 -0
  33. package/dist/components/index.js.map +1 -1
  34. package/dist/components/modal/index.d.ts +1 -2
  35. package/dist/components/modal/index.d.ts.map +1 -1
  36. package/dist/components/modal/index.js +1 -1
  37. package/dist/components/modal/index.js.map +1 -1
  38. package/dist/components/modal/modal.d.ts +2 -1
  39. package/dist/components/modal/modal.d.ts.map +1 -1
  40. package/dist/components/modal/modal.js +5 -3
  41. package/dist/components/modal/modal.js.map +1 -1
  42. package/dist/components/modal/modal.stories.js +228 -167
  43. package/dist/components/modal/modal.stories.js.map +1 -1
  44. package/dist/components/shiny-text/index.d.ts +2 -0
  45. package/dist/components/shiny-text/index.d.ts.map +1 -0
  46. package/dist/components/shiny-text/index.js +3 -0
  47. package/dist/components/shiny-text/index.js.map +1 -0
  48. package/dist/components/shiny-text/shiny-text.d.ts +10 -0
  49. package/dist/components/shiny-text/shiny-text.d.ts.map +1 -0
  50. package/dist/components/shiny-text/shiny-text.js +17 -0
  51. package/dist/components/shiny-text/shiny-text.js.map +1 -0
  52. package/dist/components/tabs/index.d.ts +2 -0
  53. package/dist/components/tabs/index.d.ts.map +1 -0
  54. package/dist/components/tabs/index.js +3 -0
  55. package/dist/components/tabs/index.js.map +1 -0
  56. package/dist/components/tabs/tabs.d.ts +50 -0
  57. package/dist/components/tabs/tabs.d.ts.map +1 -0
  58. package/dist/components/tabs/tabs.js +243 -0
  59. package/dist/components/tabs/tabs.js.map +1 -0
  60. package/dist/components/tabs/tabs.stories.js +179 -0
  61. package/dist/components/tabs/tabs.stories.js.map +1 -0
  62. package/dist/components/toast/index.d.ts +2 -2
  63. package/dist/components/toast/index.d.ts.map +1 -1
  64. package/dist/components/toast/index.js +2 -2
  65. package/dist/components/toast/index.js.map +1 -1
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +1 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/styles.css +1 -1
  71. package/dist/utils/debounce.d.ts +2 -0
  72. package/dist/utils/debounce.d.ts.map +1 -0
  73. package/dist/utils/debounce.js +13 -0
  74. package/dist/utils/debounce.js.map +1 -0
  75. package/dist/utils/index.d.ts +1 -0
  76. package/dist/utils/index.d.ts.map +1 -1
  77. package/dist/utils/index.js +1 -0
  78. package/dist/utils/index.js.map +1 -1
  79. package/index.css +34 -0
  80. package/package.json +4 -1
  81. package/src/components/badge/index.ts +4 -4
  82. package/src/components/code-block/code-block-footer.tsx +12 -2
  83. package/src/components/confetti/confetti.stories.tsx +38 -0
  84. package/src/components/confetti/confetti.tsx +140 -0
  85. package/src/components/confetti/index.ts +1 -0
  86. package/src/components/dropdown-menu/index.ts +1 -29
  87. package/src/components/icon/icon.tsx +7 -3
  88. package/src/components/index.ts +4 -0
  89. package/src/components/modal/index.ts +1 -23
  90. package/src/components/modal/modal.stories.tsx +60 -6
  91. package/src/components/modal/modal.tsx +4 -2
  92. package/src/components/shiny-text/index.ts +1 -0
  93. package/src/components/shiny-text/shiny-text.tsx +21 -0
  94. package/src/components/tabs/index.ts +1 -0
  95. package/src/components/tabs/tabs.stories.tsx +100 -0
  96. package/src/components/tabs/tabs.tsx +380 -0
  97. package/src/components/toast/index.ts +2 -2
  98. package/src/index.ts +1 -0
  99. package/src/utils/debounce.ts +15 -0
  100. package/src/utils/index.ts +1 -0
@@ -104,14 +104,15 @@ function ModalOverlay({ className, animated = true, transition = modalDefaultTra
104
104
  ...props
105
105
  });
106
106
  }
107
- function ModalContent({ className, children, animated = true, transition = modalDefaultTransition, ...props }) {
107
+ function ModalContent({ className, children, animated = true, transition = modalDefaultTransition, overlayClassName, ...props }) {
108
108
  const { isDesktop } = useModalContext();
109
109
  if (!isDesktop) {
110
110
  return /*#__PURE__*/ _jsxs(ModalPortal, {
111
111
  children: [
112
112
  /*#__PURE__*/ _jsx(ModalOverlay, {
113
113
  animated: animated,
114
- transition: transition
114
+ transition: transition,
115
+ className: overlayClassName
115
116
  }),
116
117
  /*#__PURE__*/ _jsx(VaulDrawer.Content, {
117
118
  className: cn('fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip', className),
@@ -140,7 +141,8 @@ function ModalContent({ className, children, animated = true, transition = modal
140
141
  children: [
141
142
  /*#__PURE__*/ _jsx(ModalOverlay, {
142
143
  animated: animated,
143
- transition: transition
144
+ transition: transition,
145
+ className: overlayClassName
144
146
  }),
145
147
  /*#__PURE__*/ _jsx(DialogPrimitive.Content, {
146
148
  className: baseClasses,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/modal/modal.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport {cva} from 'class-variance-authority';\nimport {Button} from 'components/button';\nimport {Icon} from 'components/icon';\nimport {Text} from 'components/typography';\nimport {motion, type Transition} from 'framer-motion';\nimport {useMediaQuery} from 'hooks/useMediaQuery';\nimport {type ComponentProps, createContext, useContext} from 'react';\nimport {cn} from 'utils/cn';\nimport {Drawer as VaulDrawer} from 'vaul';\n\nconst modalDefaultTransition: Transition = {\n type: 'spring',\n stiffness: 300,\n damping: 30,\n};\n\ntype ModalContextValue = {\n breakpoint: string;\n isDesktop: boolean;\n};\n\nconst ModalContext = createContext<ModalContextValue | null>(null);\n\nfunction useModalContext() {\n const context = useContext(ModalContext);\n if (!context) {\n throw new Error('Modal components must be used within a Modal component');\n }\n return context;\n}\n\nconst modalOverlayVariants = cva(\n 'fixed inset-0 z-40 bg-background-backdrop-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n);\n\nconst modalContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex flex-col overflow-clip bg-background-neutral-base rounded-16 w-full max-w-[576px] -translate-x-1/2 -translate-y-1/2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 shadow-tooltip',\n);\n\nfunction Modal({\n breakpoint = '(min-width: 768px)',\n children,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Root> & {breakpoint?: string}) {\n const isDesktop = useMediaQuery(breakpoint);\n\n const contextValue: ModalContextValue = {\n breakpoint,\n isDesktop,\n };\n\n const Root = isDesktop ? DialogPrimitive.Root : VaulDrawer.Root;\n\n return (\n <ModalContext.Provider value={contextValue}>\n <Root {...props}>{children}</Root>\n </ModalContext.Provider>\n );\n}\n\nfunction ModalTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Trigger {...props} />;\n }\n\n return <VaulDrawer.Trigger {...props} />;\n}\n\nfunction ModalPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Portal {...props} />;\n }\n\n return <VaulDrawer.Portal {...props} />;\n}\n\nfunction ModalClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Close {...props} />;\n }\n\n return <VaulDrawer.Close {...props} />;\n}\n\ntype ModalOverlayProps = ComponentProps<typeof DialogPrimitive.Overlay> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalOverlay({\n className,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalOverlayProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return <VaulDrawer.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n }\n\n if (animated) {\n return (\n <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} asChild {...props}>\n <motion.div\n initial={{opacity: 0}}\n animate={{opacity: 1}}\n exit={{opacity: 0}}\n transition={transition}\n />\n </DialogPrimitive.Overlay>\n );\n }\n\n return <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n}\n\ntype ModalContentProps = ComponentProps<typeof DialogPrimitive.Content> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalContent({\n className,\n children,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalContentProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} />\n <VaulDrawer.Content\n className={cn(\n 'fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip',\n className,\n )}\n {...props}\n >\n <div className=\"relative w-full h-full flex flex-col min-h-0\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-t-16\" />\n <div className=\"flex items-center justify-center pt-8 pb-8 shrink-0\">\n <div className=\"bg-foreground-neutral-subtle w-32 h-4 rounded-full opacity-40\" />\n </div>\n {children}\n </div>\n </VaulDrawer.Content>\n </ModalPortal>\n );\n }\n\n const baseClasses = cn(modalContentVariants(), className);\n\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} />\n <DialogPrimitive.Content className={baseClasses} {...props}>\n <div className=\"relative size-full\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-16\" />\n {children}\n </div>\n </DialogPrimitive.Content>\n </ModalPortal>\n );\n}\n\ntype ModalHeaderProps = ComponentProps<'div'> & {\n title?: string;\n showEscIndicator?: boolean;\n showClose?: boolean;\n};\n\nfunction ModalHeader({\n className,\n title,\n showEscIndicator = true,\n showClose = true,\n children,\n ...props\n}: ModalHeaderProps) {\n const {isDesktop} = useModalContext();\n\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-background-neutral-base flex items-center justify-center gap-20 overflow-clip px-24 py-16 w-full\">\n {title ? (\n <Text size=\"lg\" className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\">\n {title}\n </Text>\n ) : (\n <div className=\"flex-1\">{children}</div>\n )}\n <div className=\"flex items-center gap-8\">\n {isDesktop && showEscIndicator && (\n <kbd className=\"flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4\">\n esc\n </kbd>\n )}\n {showClose && (\n <ModalClose asChild>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n className=\"rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24\"\n >\n <Icon name=\"close\" />\n </Button>\n </ModalClose>\n )}\n </div>\n </div>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n </div>\n );\n}\n\nfunction ModalBody({className, children, ...props}: ComponentProps<'div'>) {\n const {isDesktop} = useModalContext();\n\n return (\n <div\n className={cn(\n 'bg-background-neutral-base flex flex-col items-start px-24 pb-24 pt-16 w-full',\n isDesktop ? 'overflow-clip' : 'overflow-y-auto overflow-x-clip flex-1',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nfunction ModalFooter({className, children, ...props}: ComponentProps<'div'>) {\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n <div className=\"bg-background-neutral-base flex items-end justify-end gap-20 overflow-clip px-24 py-16 w-full\">\n <div className={cn('flex items-center gap-16', className)}>{children}</div>\n </div>\n </div>\n );\n}\n\ntype ModalTitleProps = ComponentProps<typeof DialogPrimitive.Title>;\n\nfunction ModalTitle({className, ...props}: ModalTitleProps) {\n const {isDesktop} = useModalContext();\n\n const titleClassName = cn(\n 'font-medium text-lg leading-20 overflow-ellipsis overflow-hidden text-foreground-neutral-base',\n className,\n );\n\n if (!isDesktop) {\n return <VaulDrawer.Title className={titleClassName} {...props} />;\n }\n\n return <DialogPrimitive.Title className={titleClassName} {...props} />;\n}\n\ntype ModalDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;\n\nfunction ModalDescription({className, ...props}: ModalDescriptionProps) {\n const {isDesktop} = useModalContext();\n\n const descClassName = cn('text-sm leading-20 text-foreground-neutral-subtle', className);\n\n if (!isDesktop) {\n return <VaulDrawer.Description className={descClassName} {...props} />;\n }\n\n return <DialogPrimitive.Description className={descClassName} {...props} />;\n}\n\nexport {\n Modal,\n ModalPortal,\n ModalOverlay,\n ModalTrigger,\n ModalClose,\n ModalContent,\n ModalHeader,\n ModalBody,\n ModalFooter,\n ModalTitle,\n ModalDescription,\n modalContentVariants,\n modalOverlayVariants,\n modalDefaultTransition,\n};\n\nexport type {\n ModalContentProps,\n ModalHeaderProps,\n ModalOverlayProps,\n ModalTitleProps,\n ModalDescriptionProps,\n};\n"],"names":["DialogPrimitive","cva","Button","Icon","Text","motion","useMediaQuery","createContext","useContext","cn","Drawer","VaulDrawer","modalDefaultTransition","type","stiffness","damping","ModalContext","useModalContext","context","Error","modalOverlayVariants","modalContentVariants","Modal","breakpoint","children","props","isDesktop","contextValue","Root","Provider","value","ModalTrigger","Trigger","ModalPortal","Portal","ModalClose","Close","ModalOverlay","className","animated","transition","Overlay","asChild","div","initial","opacity","animate","exit","ModalContent","Content","baseClasses","ModalHeader","title","showEscIndicator","showClose","size","kbd","variant","name","ModalBody","ModalFooter","ModalTitle","titleClassName","Title","ModalDescription","descClassName","Description"],"mappings":";AAAA,YAAYA,qBAAqB,yBAAyB;AAC1D,SAAQC,GAAG,QAAO,2BAA2B;AAC7C,SAAQC,MAAM,QAAO,oBAAoB;AACzC,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAwB,gBAAgB;AACtD,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAA6BC,aAAa,EAAEC,UAAU,QAAO,QAAQ;AACrE,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQC,UAAUC,UAAU,QAAO,OAAO;AAE1C,MAAMC,yBAAqC;IACzCC,MAAM;IACNC,WAAW;IACXC,SAAS;AACX;AAOA,MAAMC,6BAAeT,cAAwC;AAE7D,SAASU;IACP,MAAMC,UAAUV,WAAWQ;IAC3B,IAAI,CAACE,SAAS;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,OAA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QAACzB,WAAWwB;QAAiB,GAAGrC,KAAK;;AACpE;AAIA,SAASuC,iBAAiB,EAAC1B,SAAS,EAAE,GAAGb,OAA6B;IACpE,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,MAAMgD,gBAAgBxD,GAAG,qDAAqD6B;IAE9E,IAAI,CAACZ,WAAW;QACd,qBAAO,KAACf,WAAWuD,WAAW;YAAC5B,WAAW2B;YAAgB,GAAGxC,KAAK;;IACpE;IAEA,qBAAO,KAACzB,gBAAgBkE,WAAW;QAAC5B,WAAW2B;QAAgB,GAAGxC,KAAK;;AACzE;AAEA,SACEH,KAAK,EACLW,WAAW,EACXI,YAAY,EACZN,YAAY,EACZI,UAAU,EACVa,YAAY,EACZG,WAAW,EACXQ,SAAS,EACTC,WAAW,EACXC,UAAU,EACVG,gBAAgB,EAChB3C,oBAAoB,EACpBD,oBAAoB,EACpBR,sBAAsB,GACtB"}
1
+ {"version":3,"sources":["../../../src/components/modal/modal.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport {cva} from 'class-variance-authority';\nimport {Button} from 'components/button';\nimport {Icon} from 'components/icon';\nimport {Text} from 'components/typography';\nimport {motion, type Transition} from 'framer-motion';\nimport {useMediaQuery} from 'hooks/useMediaQuery';\nimport {type ComponentProps, createContext, useContext} from 'react';\nimport {cn} from 'utils/cn';\nimport {Drawer as VaulDrawer} from 'vaul';\n\nconst modalDefaultTransition: Transition = {\n type: 'spring',\n stiffness: 300,\n damping: 30,\n};\n\ntype ModalContextValue = {\n breakpoint: string;\n isDesktop: boolean;\n};\n\nconst ModalContext = createContext<ModalContextValue | null>(null);\n\nfunction useModalContext() {\n const context = useContext(ModalContext);\n if (!context) {\n throw new Error('Modal components must be used within a Modal component');\n }\n return context;\n}\n\nconst modalOverlayVariants = cva(\n 'fixed inset-0 z-40 bg-background-backdrop-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n);\n\nconst modalContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex flex-col overflow-clip bg-background-neutral-base rounded-16 w-full max-w-[576px] -translate-x-1/2 -translate-y-1/2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 shadow-tooltip',\n);\n\nfunction Modal({\n breakpoint = '(min-width: 768px)',\n children,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Root> & {breakpoint?: string}) {\n const isDesktop = useMediaQuery(breakpoint);\n\n const contextValue: ModalContextValue = {\n breakpoint,\n isDesktop,\n };\n\n const Root = isDesktop ? DialogPrimitive.Root : VaulDrawer.Root;\n\n return (\n <ModalContext.Provider value={contextValue}>\n <Root {...props}>{children}</Root>\n </ModalContext.Provider>\n );\n}\n\nfunction ModalTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Trigger {...props} />;\n }\n\n return <VaulDrawer.Trigger {...props} />;\n}\n\nfunction ModalPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Portal {...props} />;\n }\n\n return <VaulDrawer.Portal {...props} />;\n}\n\nfunction ModalClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Close {...props} />;\n }\n\n return <VaulDrawer.Close {...props} />;\n}\n\ntype ModalOverlayProps = ComponentProps<typeof DialogPrimitive.Overlay> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalOverlay({\n className,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalOverlayProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return <VaulDrawer.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n }\n\n if (animated) {\n return (\n <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} asChild {...props}>\n <motion.div\n initial={{opacity: 0}}\n animate={{opacity: 1}}\n exit={{opacity: 0}}\n transition={transition}\n />\n </DialogPrimitive.Overlay>\n );\n }\n\n return <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n}\n\ntype ModalContentProps = ComponentProps<typeof DialogPrimitive.Content> & {\n animated?: boolean;\n transition?: Transition;\n overlayClassName?: string;\n};\n\nfunction ModalContent({\n className,\n children,\n animated = true,\n transition = modalDefaultTransition,\n overlayClassName,\n ...props\n}: ModalContentProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} className={overlayClassName} />\n <VaulDrawer.Content\n className={cn(\n 'fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip',\n className,\n )}\n {...props}\n >\n <div className=\"relative w-full h-full flex flex-col min-h-0\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-t-16\" />\n <div className=\"flex items-center justify-center pt-8 pb-8 shrink-0\">\n <div className=\"bg-foreground-neutral-subtle w-32 h-4 rounded-full opacity-40\" />\n </div>\n {children}\n </div>\n </VaulDrawer.Content>\n </ModalPortal>\n );\n }\n\n const baseClasses = cn(modalContentVariants(), className);\n\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} className={overlayClassName} />\n <DialogPrimitive.Content className={baseClasses} {...props}>\n <div className=\"relative size-full\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-16\" />\n {children}\n </div>\n </DialogPrimitive.Content>\n </ModalPortal>\n );\n}\n\ntype ModalHeaderProps = ComponentProps<'div'> & {\n title?: string;\n showEscIndicator?: boolean;\n showClose?: boolean;\n};\n\nfunction ModalHeader({\n className,\n title,\n showEscIndicator = true,\n showClose = true,\n children,\n ...props\n}: ModalHeaderProps) {\n const {isDesktop} = useModalContext();\n\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-background-neutral-base flex items-center justify-center gap-20 overflow-clip px-24 py-16 w-full\">\n {title ? (\n <Text size=\"lg\" className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\">\n {title}\n </Text>\n ) : (\n <div className=\"flex-1\">{children}</div>\n )}\n <div className=\"flex items-center gap-8\">\n {isDesktop && showEscIndicator && (\n <kbd className=\"flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4\">\n esc\n </kbd>\n )}\n {showClose && (\n <ModalClose asChild>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n className=\"rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24\"\n >\n <Icon name=\"close\" />\n </Button>\n </ModalClose>\n )}\n </div>\n </div>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n </div>\n );\n}\n\nfunction ModalBody({className, children, ...props}: ComponentProps<'div'>) {\n const {isDesktop} = useModalContext();\n\n return (\n <div\n className={cn(\n 'bg-background-neutral-base flex flex-col items-start px-24 pb-24 pt-16 w-full',\n isDesktop ? 'overflow-clip' : 'overflow-y-auto overflow-x-clip flex-1',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nfunction ModalFooter({className, children, ...props}: ComponentProps<'div'>) {\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n <div className=\"bg-background-neutral-base flex items-end justify-end gap-20 overflow-clip px-24 py-16 w-full\">\n <div className={cn('flex items-center gap-16', className)}>{children}</div>\n </div>\n </div>\n );\n}\n\ntype ModalTitleProps = ComponentProps<typeof DialogPrimitive.Title>;\n\nfunction ModalTitle({className, ...props}: ModalTitleProps) {\n const {isDesktop} = useModalContext();\n\n const titleClassName = cn(\n 'font-medium text-lg leading-20 overflow-ellipsis overflow-hidden text-foreground-neutral-base',\n className,\n );\n\n if (!isDesktop) {\n return <VaulDrawer.Title className={titleClassName} {...props} />;\n }\n\n return <DialogPrimitive.Title className={titleClassName} {...props} />;\n}\n\ntype ModalDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;\n\nfunction ModalDescription({className, ...props}: ModalDescriptionProps) {\n const {isDesktop} = useModalContext();\n\n const descClassName = cn('text-sm leading-20 text-foreground-neutral-subtle', className);\n\n if (!isDesktop) {\n return <VaulDrawer.Description className={descClassName} {...props} />;\n }\n\n return <DialogPrimitive.Description className={descClassName} {...props} />;\n}\n\nexport {\n Modal,\n ModalPortal,\n ModalOverlay,\n ModalTrigger,\n ModalClose,\n ModalContent,\n ModalHeader,\n ModalBody,\n ModalFooter,\n ModalTitle,\n ModalDescription,\n modalContentVariants,\n modalOverlayVariants,\n modalDefaultTransition,\n};\n\nexport type {\n ModalContentProps,\n ModalHeaderProps,\n ModalOverlayProps,\n ModalTitleProps,\n ModalDescriptionProps,\n};\n"],"names":["DialogPrimitive","cva","Button","Icon","Text","motion","useMediaQuery","createContext","useContext","cn","Drawer","VaulDrawer","modalDefaultTransition","type","stiffness","damping","ModalContext","useModalContext","context","Error","modalOverlayVariants","modalContentVariants","Modal","breakpoint","children","props","isDesktop","contextValue","Root","Provider","value","ModalTrigger","Trigger","ModalPortal","Portal","ModalClose","Close","ModalOverlay","className","animated","transition","Overlay","asChild","div","initial","opacity","animate","exit","ModalContent","overlayClassName","Content","baseClasses","ModalHeader","title","showEscIndicator","showClose","size","kbd","variant","name","ModalBody","ModalFooter","ModalTitle","titleClassName","Title","ModalDescription","descClassName","Description"],"mappings":";AAAA,YAAYA,qBAAqB,yBAAyB;AAC1D,SAAQC,GAAG,QAAO,2BAA2B;AAC7C,SAAQC,MAAM,QAAO,oBAAoB;AACzC,SAAQC,IAAI,QAAO,kB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,EAAE,GAAGC,OAA6B;IACzE,qBACE,MAACkB;QAAIL,WAAU;QAAiC,GAAGb,KAAK;;0BACtD,KAACkB;gBAAIL,WAAU;;0BACf,KAACK;gBAAIL,WAAU;0BACb,cAAA,KAACK;oBAAIL,WAAW7B,GAAG,4BAA4B6B;8BAAad;;;;;AAIpE;AAIA,SAASsC,WAAW,EAACxB,SAAS,EAAE,GAAGb,OAAuB;IACxD,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,MAAM8C,iBAAiBtD,GACrB,iGACA6B;IAGF,IAAI,CAACZ,WAAW;QACd,qBAAO,KAACf,WAAWqD,KAAK;YAAC1B,WAAWyB;YAAiB,GAAGtC,KAAK;;IAC/D;IAEA,qBAAO,KAACzB,gBAAgBgE,KAAK;QAAC1B,WAAWyB;QAAiB,GAAGtC,KAAK;;AACpE;AAIA,SAASwC,iBAAiB,EAAC3B,SAAS,EAAE,GAAGb,OAA6B;IACpE,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,MAAMiD,gBAAgBzD,GAAG,qDAAqD6B;IAE9E,IAAI,CAACZ,WAAW;QACd,qBAAO,KAACf,WAAWwD,WAAW;YAAC7B,WAAW4B;YAAgB,GAAGzC,KAAK;;IACpE;IAEA,qBAAO,KAACzB,gBAAgBmE,WAAW;QAAC7B,WAAW4B;QAAgB,GAAGzC,KAAK;;AACzE;AAEA,SACEH,KAAK,EACLW,WAAW,EACXI,YAAY,EACZN,YAAY,EACZI,UAAU,EACVa,YAAY,EACZI,WAAW,EACXQ,SAAS,EACTC,WAAW,EACXC,UAAU,EACVG,gBAAgB,EAChB5C,oBAAoB,EACpBD,oBAAoB,EACpBR,sBAAsB,GACtB"}
@@ -4,6 +4,7 @@ import { screen, within } from '@testing-library/react';
4
4
  import userEvent from '@testing-library/user-event';
5
5
  import { Button, ButtonLink } from '../../components/button/index.js';
6
6
  import { CodeBlock, CodeBlockBody, CodeBlockContent, CodeBlockCopyButton, CodeBlockFilename, CodeBlockFiles, CodeBlockFooter, CodeBlockHeader, CodeBlockItem } from '../../components/code-block/index.js';
7
+ import { Confetti } from '../../components/confetti/index.js';
7
8
  import { DatePicker } from '../../components/date-picker/index.js';
8
9
  import { DynamicItem } from '../../components/dynamic-item/index.js';
9
10
  import { Icon } from '../../components/icon/index.js';
@@ -12,7 +13,7 @@ import { ItemTitle } from '../../components/item/index.js';
12
13
  import { Label } from '../../components/label/index.js';
13
14
  import { MovingBorder } from '../../components/moving-border/index.js';
14
15
  import { Text } from '../../components/typography/index.js';
15
- import { useState } from 'react';
16
+ import { useEffect, useRef, useState } from 'react';
16
17
  import { cn } from '../../utils/cn.js';
17
18
  import illustration2 from '../../assets/illustration-2.svg';
18
19
  import illustrationBg from '../../assets/illustration-gradient.svg';
@@ -139,6 +140,7 @@ export const ImportForm = {
139
140
  }),
140
141
  /*#__PURE__*/ _jsxs(ModalContent, {
141
142
  "aria-describedby": undefined,
143
+ overlayClassName: "bg-background-modal-overlay",
142
144
  children: [
143
145
  /*#__PURE__*/ _jsx(ModalTitle, {
144
146
  className: "sr-only",
@@ -249,182 +251,241 @@ export const GithubActions = {
249
251
  },
250
252
  render: ()=>{
251
253
  const [open, setOpen] = useState(false);
252
- return /*#__PURE__*/ _jsx("div", {
254
+ const [footerState, setFooterState] = useState('running');
255
+ const confettiRef = useRef(null);
256
+ useEffect(()=>{
257
+ if (open && footerState === 'running') {
258
+ const timer = setTimeout(()=>{
259
+ setFooterState('done');
260
+ }, 3000);
261
+ return ()=>{
262
+ clearTimeout(timer);
263
+ };
264
+ }
265
+ }, [
266
+ open,
267
+ footerState
268
+ ]);
269
+ useEffect(()=>{
270
+ if (footerState === 'done' && open) {
271
+ const timer = setTimeout(()=>{
272
+ if (confettiRef.current) {
273
+ void confettiRef.current.fire();
274
+ }
275
+ }, 200);
276
+ return ()=>{
277
+ clearTimeout(timer);
278
+ };
279
+ }
280
+ }, [
281
+ footerState,
282
+ open
283
+ ]);
284
+ useEffect(()=>{
285
+ if (!open) {
286
+ setFooterState('running');
287
+ }
288
+ }, [
289
+ open
290
+ ]);
291
+ return /*#__PURE__*/ _jsxs("div", {
253
292
  className: "flex h-[50vh] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
254
- children: /*#__PURE__*/ _jsxs(Modal, {
255
- open: open,
256
- onOpenChange: setOpen,
257
- children: [
258
- /*#__PURE__*/ _jsx(ModalTrigger, {
259
- asChild: true,
260
- children: /*#__PURE__*/ _jsx(Button, {
261
- children: "Run GitHub Actions on Shipfox"
262
- })
263
- }),
264
- /*#__PURE__*/ _jsxs(ModalContent, {
265
- "aria-describedby": undefined,
266
- children: [
267
- /*#__PURE__*/ _jsx(ModalTitle, {
268
- className: "sr-only",
293
+ children: [
294
+ /*#__PURE__*/ _jsx(Confetti, {
295
+ ref: confettiRef,
296
+ manualstart: true,
297
+ options: {
298
+ particleCount: 200,
299
+ spread: 100,
300
+ colors: [
301
+ '#ff6b6b',
302
+ '#4ecdc4',
303
+ '#ffe66d',
304
+ '#95e1d3'
305
+ ]
306
+ },
307
+ className: "fixed inset-0 pointer-events-none z-100",
308
+ style: {
309
+ width: '100%',
310
+ height: '100%'
311
+ }
312
+ }),
313
+ /*#__PURE__*/ _jsxs(Modal, {
314
+ open: open,
315
+ onOpenChange: setOpen,
316
+ children: [
317
+ /*#__PURE__*/ _jsx(ModalTrigger, {
318
+ asChild: true,
319
+ children: /*#__PURE__*/ _jsx(Button, {
269
320
  children: "Run GitHub Actions on Shipfox"
270
- }),
271
- /*#__PURE__*/ _jsx(ModalHeader, {
272
- title: "Run GitHub Actions on Shipfox"
273
- }),
274
- /*#__PURE__*/ _jsxs(ModalBody, {
275
- className: "gap-32",
276
- children: [
277
- /*#__PURE__*/ _jsxs("div", {
278
- className: "flex flex-col gap-20 w-full",
279
- children: [
280
- /*#__PURE__*/ _jsx(Text, {
281
- size: "sm",
282
- className: "text-foreground-neutral-subtle w-full",
283
- children: "This will run your jobs on Shipfox's optimized infrastructure. Giving you faster builds, and dedicated resources."
284
- }),
285
- /*#__PURE__*/ _jsxs("div", {
286
- className: "relative",
287
- children: [
288
- /*#__PURE__*/ _jsx("img", {
289
- src: illustration2,
290
- alt: "illustration-2",
291
- className: "hidden sm:block absolute overflow-clip right-2 top-1/2 -translate-y-1/2 translate-x-8 w-fit object-contain z-50"
292
- }),
293
- /*#__PURE__*/ _jsxs("div", {
294
- className: cn('relative overflow-hidden bg-transparent p-1 rounded-8'),
295
- children: [
296
- /*#__PURE__*/ _jsx("div", {
297
- className: "absolute inset-0",
298
- style: {
299
- borderRadius: 'calc(0.5rem * 0.96)'
300
- },
301
- children: /*#__PURE__*/ _jsx(MovingBorder, {
302
- duration: 6000,
303
- rx: "30%",
304
- ry: "30%",
305
- children: /*#__PURE__*/ _jsx("div", {
306
- className: "h-100 w-200 bg-[radial-gradient(#ff9e7a_40%,transparent_60%)]"
321
+ })
322
+ }),
323
+ /*#__PURE__*/ _jsxs(ModalContent, {
324
+ "aria-describedby": undefined,
325
+ overlayClassName: "bg-background-modal-overlay",
326
+ children: [
327
+ /*#__PURE__*/ _jsx(ModalTitle, {
328
+ className: "sr-only",
329
+ children: "Run GitHub Actions on Shipfox"
330
+ }),
331
+ /*#__PURE__*/ _jsx(ModalHeader, {
332
+ title: "Run GitHub Actions on Shipfox"
333
+ }),
334
+ /*#__PURE__*/ _jsxs(ModalBody, {
335
+ className: "gap-32",
336
+ children: [
337
+ /*#__PURE__*/ _jsxs("div", {
338
+ className: "flex flex-col gap-20 w-full",
339
+ children: [
340
+ /*#__PURE__*/ _jsx(Text, {
341
+ size: "sm",
342
+ className: "text-foreground-neutral-subtle w-full",
343
+ children: "This will run your jobs on Shipfox's optimized infrastructure. Giving you faster builds, and dedicated resources."
344
+ }),
345
+ /*#__PURE__*/ _jsxs("div", {
346
+ className: "relative",
347
+ children: [
348
+ /*#__PURE__*/ _jsx("img", {
349
+ src: illustration2,
350
+ alt: "illustration-2",
351
+ className: "hidden sm:block absolute overflow-clip right-2 top-1/2 -translate-y-1/2 translate-x-8 w-fit object-contain z-50"
352
+ }),
353
+ /*#__PURE__*/ _jsxs("div", {
354
+ className: cn('relative overflow-hidden bg-transparent p-1 rounded-8'),
355
+ children: [
356
+ /*#__PURE__*/ _jsx("div", {
357
+ className: "absolute inset-0",
358
+ style: {
359
+ borderRadius: 'calc(0.5rem * 0.96)'
360
+ },
361
+ children: /*#__PURE__*/ _jsx(MovingBorder, {
362
+ duration: 6000,
363
+ rx: "30%",
364
+ ry: "30%",
365
+ children: /*#__PURE__*/ _jsx("div", {
366
+ className: "h-100 w-200 bg-[radial-gradient(#ff9e7a_40%,transparent_60%)]"
367
+ })
307
368
  })
308
- })
309
- }),
310
- /*#__PURE__*/ _jsx("div", {
311
- className: "relative",
312
- style: {
313
- borderRadius: 'calc(0.5rem * 0.96)'
314
- },
315
- children: /*#__PURE__*/ _jsx(DynamicItem, {
316
- variant: "default",
317
- title: /*#__PURE__*/ _jsxs("div", {
318
- className: "flex items-center gap-6",
319
- children: [
320
- /*#__PURE__*/ _jsx("span", {
321
- className: "flex shrink-0 items-center justify-center text-tag-success-icon w-16 h-16",
322
- children: /*#__PURE__*/ _jsx(Icon, {
323
- name: "money",
324
- size: "sm",
325
- color: "var(--foreground-neutral-subtle, #a1a1aa)"
369
+ }),
370
+ /*#__PURE__*/ _jsx("div", {
371
+ className: "relative",
372
+ style: {
373
+ borderRadius: 'calc(0.5rem * 0.96)'
374
+ },
375
+ children: /*#__PURE__*/ _jsx(DynamicItem, {
376
+ variant: "default",
377
+ title: /*#__PURE__*/ _jsxs("div", {
378
+ className: "flex items-center gap-6",
379
+ children: [
380
+ /*#__PURE__*/ _jsx("span", {
381
+ className: "flex shrink-0 items-center justify-center text-tag-success-icon w-16 h-16",
382
+ children: /*#__PURE__*/ _jsx(Icon, {
383
+ name: "money",
384
+ size: "sm",
385
+ color: "var(--foreground-neutral-subtle, #a1a1aa)"
386
+ })
387
+ }),
388
+ /*#__PURE__*/ _jsx(ItemTitle, {
389
+ children: "6000 free credits/month to run your jobs"
326
390
  })
327
- }),
328
- /*#__PURE__*/ _jsx(ItemTitle, {
329
- children: "6000 free credits/month to run your jobs"
330
- })
331
- ]
332
- }),
333
- description: "~500 builds/month. No payment required.",
334
- rightElement: /*#__PURE__*/ _jsx("img", {
335
- src: illustrationBg,
336
- alt: "illustration-bg",
337
- className: "hidden sm:block absolute overflow-clip right-4 w-fit object-contain scale-105"
391
+ ]
392
+ }),
393
+ description: "~500 builds/month. No payment required.",
394
+ rightElement: /*#__PURE__*/ _jsx("img", {
395
+ src: illustrationBg,
396
+ alt: "illustration-bg",
397
+ className: "hidden sm:block absolute overflow-clip right-4 w-fit object-contain scale-105"
398
+ })
338
399
  })
339
400
  })
340
- })
341
- ]
342
- })
343
- ]
344
- })
345
- ]
346
- }),
347
- /*#__PURE__*/ _jsxs("div", {
348
- className: "flex flex-col gap-20 w-full",
349
- children: [
350
- /*#__PURE__*/ _jsxs("div", {
351
- className: "flex flex-col gap-6",
352
- children: [
353
- /*#__PURE__*/ _jsxs("div", {
354
- className: "flex items-center justify-center w-full",
355
- children: [
356
- /*#__PURE__*/ _jsx(Text, {
357
- className: "flex-1 font-semibold text-foreground-neutral-base overflow-ellipsis overflow-hidden whitespace-nowrap",
358
- children: "Update your GitHub Actions workflow"
359
- }),
360
- /*#__PURE__*/ _jsx(ButtonLink, {
361
- variant: "base",
362
- size: "sm",
363
- href: "#",
364
- iconRight: "bookOpen",
365
- children: "See docs"
366
- })
367
- ]
368
- }),
369
- /*#__PURE__*/ _jsx(Text, {
370
- size: "sm",
371
- className: "text-foreground-neutral-subtle w-full",
372
- children: "Replace the runs-on line in your workflow file to use Shipfox runners."
373
- })
374
- ]
375
- }),
376
- /*#__PURE__*/ _jsxs(CodeBlock, {
377
- data: [
378
- {
379
- language: 'yaml',
380
- filename: '.github/workflows/<workflow-name>.yml',
381
- code: diffCode
382
- }
383
- ],
384
- defaultValue: "yaml",
385
- children: [
386
- /*#__PURE__*/ _jsxs(CodeBlockHeader, {
387
- children: [
388
- /*#__PURE__*/ _jsx(CodeBlockFiles, {
389
- children: (item)=>/*#__PURE__*/ _jsx(CodeBlockFilename, {
390
- value: item.language,
391
- children: item.filename
401
+ ]
402
+ })
403
+ ]
404
+ })
405
+ ]
406
+ }),
407
+ /*#__PURE__*/ _jsxs("div", {
408
+ className: "flex flex-col gap-20 w-full",
409
+ children: [
410
+ /*#__PURE__*/ _jsxs("div", {
411
+ className: "flex flex-col gap-6",
412
+ children: [
413
+ /*#__PURE__*/ _jsxs("div", {
414
+ className: "flex items-center justify-center w-full",
415
+ children: [
416
+ /*#__PURE__*/ _jsx(Text, {
417
+ className: "flex-1 font-semibold text-foreground-neutral-base overflow-ellipsis overflow-hidden whitespace-nowrap",
418
+ children: "Update your GitHub Actions workflow"
419
+ }),
420
+ /*#__PURE__*/ _jsx(ButtonLink, {
421
+ variant: "base",
422
+ size: "sm",
423
+ href: "#",
424
+ iconRight: "bookOpen",
425
+ children: "See docs"
426
+ })
427
+ ]
428
+ }),
429
+ /*#__PURE__*/ _jsx(Text, {
430
+ size: "sm",
431
+ className: "text-foreground-neutral-subtle w-full",
432
+ children: "Replace the runs-on line in your workflow file to use Shipfox runners."
433
+ })
434
+ ]
435
+ }),
436
+ /*#__PURE__*/ _jsxs(CodeBlock, {
437
+ data: [
438
+ {
439
+ language: 'yaml',
440
+ filename: '.github/workflows/<workflow-name>.yml',
441
+ code: diffCode
442
+ }
443
+ ],
444
+ defaultValue: "yaml",
445
+ children: [
446
+ /*#__PURE__*/ _jsxs(CodeBlockHeader, {
447
+ children: [
448
+ /*#__PURE__*/ _jsx(CodeBlockFiles, {
449
+ children: (item)=>/*#__PURE__*/ _jsx(CodeBlockFilename, {
450
+ value: item.language,
451
+ children: item.filename
452
+ })
453
+ }),
454
+ /*#__PURE__*/ _jsx(CodeBlockCopyButton, {})
455
+ ]
456
+ }),
457
+ /*#__PURE__*/ _jsx(CodeBlockBody, {
458
+ children: (item)=>/*#__PURE__*/ _jsx(CodeBlockItem, {
459
+ value: item.language,
460
+ children: /*#__PURE__*/ _jsx(CodeBlockContent, {
461
+ language: item.language,
462
+ children: item.code
392
463
  })
393
- }),
394
- /*#__PURE__*/ _jsx(CodeBlockCopyButton, {})
395
- ]
396
- }),
397
- /*#__PURE__*/ _jsx(CodeBlockBody, {
398
- children: (item)=>/*#__PURE__*/ _jsx(CodeBlockItem, {
399
- value: item.language,
400
- children: /*#__PURE__*/ _jsx(CodeBlockContent, {
401
- language: item.language,
402
- children: item.code
403
464
  })
404
- })
405
- }),
406
- /*#__PURE__*/ _jsx(CodeBlockFooter, {
407
- state: "running",
408
- message: "Waiting for Shipfox runner event…",
409
- description: "This usually takes 30-60 seconds after you commit the workflow file."
410
- })
411
- ]
412
- })
413
- ]
465
+ }),
466
+ /*#__PURE__*/ _jsx(CodeBlockFooter, {
467
+ state: footerState,
468
+ message: footerState === 'running' ? 'Waiting for Shipfox runner event…' : 'Runners connected!',
469
+ description: footerState === 'running' ? 'This usually takes 30-60 seconds after you commit the workflow file.' : ''
470
+ })
471
+ ]
472
+ })
473
+ ]
474
+ })
475
+ ]
476
+ }),
477
+ /*#__PURE__*/ _jsx(ModalFooter, {
478
+ children: /*#__PURE__*/ _jsx(Button, {
479
+ variant: "primary",
480
+ onClick: ()=>setOpen(false),
481
+ children: "Got it"
414
482
  })
415
- ]
416
- }),
417
- /*#__PURE__*/ _jsx(ModalFooter, {
418
- children: /*#__PURE__*/ _jsx(Button, {
419
- variant: "primary",
420
- onClick: ()=>setOpen(false),
421
- children: "Got it"
422
483
  })
423
- })
424
- ]
425
- })
426
- ]
427
- })
484
+ ]
485
+ })
486
+ ]
487
+ })
488
+ ]
428
489
  });
429
490
  }
430
491
  };