@zerodev/react-ui 0.0.4 → 0.0.6

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 (38) hide show
  1. package/dist/_types/components/DataRow/index.d.ts +7 -2
  2. package/dist/_types/components/DataRow/index.d.ts.map +1 -1
  3. package/dist/_types/components/InfoCard/index.d.ts +17 -0
  4. package/dist/_types/components/InfoCard/index.d.ts.map +1 -0
  5. package/dist/_types/components/Pill/index.d.ts.map +1 -1
  6. package/dist/_types/components/ProgressStep/index.d.ts +20 -0
  7. package/dist/_types/components/ProgressStep/index.d.ts.map +1 -0
  8. package/dist/_types/components/Screen/index.d.ts +4 -1
  9. package/dist/_types/components/Screen/index.d.ts.map +1 -1
  10. package/dist/_types/components/Section/MessageDetails/index.d.ts +5 -0
  11. package/dist/_types/components/Section/MessageDetails/index.d.ts.map +1 -0
  12. package/dist/_types/components/Section/index.d.ts +11 -0
  13. package/dist/_types/components/Section/index.d.ts.map +1 -0
  14. package/dist/_types/components/Tooltip/index.d.ts +43 -0
  15. package/dist/_types/components/Tooltip/index.d.ts.map +1 -0
  16. package/dist/_types/components/TopNav/index.d.ts.map +1 -1
  17. package/dist/_types/index.d.ts +6 -1
  18. package/dist/_types/index.d.ts.map +1 -1
  19. package/dist/_types/utils/common.d.ts +4 -0
  20. package/dist/_types/utils/common.d.ts.map +1 -1
  21. package/dist/index.cjs +16 -16
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.mjs +2791 -2159
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/styles.css +1 -1
  26. package/package.json +1 -1
  27. package/src/components/DataRow/index.tsx +67 -35
  28. package/src/components/InfoCard/index.tsx +104 -0
  29. package/src/components/Pill/index.tsx +5 -3
  30. package/src/components/ProgressStep/index.tsx +121 -0
  31. package/src/components/Screen/index.tsx +23 -2
  32. package/src/components/Section/MessageDetails/index.tsx +19 -0
  33. package/src/components/Section/index.tsx +50 -0
  34. package/src/components/Tooltip/index.tsx +94 -0
  35. package/src/components/TopNav/index.tsx +8 -2
  36. package/src/index.ts +26 -1
  37. package/src/utils/common.ts +15 -0
  38. package/tailwind.config.ts +8 -0
@@ -0,0 +1,94 @@
1
+ import { Tooltip as TooltipPrimitive } from 'radix-ui'
2
+ import type { ComponentProps, ReactNode, Ref } from 'react'
3
+
4
+ import { cn } from '../../utils/common'
5
+
6
+ /**
7
+ * Floating tooltip wrapping the Radix primitive with our token palette.
8
+ *
9
+ * The primitive is unopinionated about presentation — this file adds:
10
+ * - default styling (dark ink bg, white text, 8px offset, subtle shadow)
11
+ * - a bundled `Provider` so the common case (a single tooltip in a row)
12
+ * doesn't require the consumer to remember to wrap the tree
13
+ * - a Portal render so tooltips escape overflow-hidden ancestors
14
+ *
15
+ * For dense trees where mount overhead matters, use `TooltipProvider` at
16
+ * the app root and drop the internal Provider by importing `TooltipRoot`
17
+ * / `TooltipTrigger` / `TooltipContent` directly.
18
+ */
19
+
20
+ export const TooltipProvider = TooltipPrimitive.Provider
21
+ export const TooltipRoot = TooltipPrimitive.Root
22
+ export const TooltipTrigger = TooltipPrimitive.Trigger
23
+ export const TooltipPortal = TooltipPrimitive.Portal
24
+
25
+ export interface TooltipContentProps
26
+ extends ComponentProps<typeof TooltipPrimitive.Content> {
27
+ ref?: Ref<HTMLDivElement>
28
+ }
29
+
30
+ /** Styled content surface — dark chip, ~11.5px semibold copy, arrow-less. */
31
+ export function TooltipContent({
32
+ ref,
33
+ className,
34
+ sideOffset = 8,
35
+ ...props
36
+ }: TooltipContentProps) {
37
+ return (
38
+ <TooltipPrimitive.Content
39
+ ref={ref}
40
+ sideOffset={sideOffset}
41
+ className={cn(
42
+ 'zd:z-50 zd:max-w-[220px] zd:rounded-lg zd:px-2 zd:py-1.5',
43
+ 'zd:text-body3 zd:font-semibold zd:text-white zd:text-center',
44
+ 'zd:shadow-[0_8px_22px_-10px_rgba(25,17,11,0.45)]',
45
+ // Match the popper-in animation used by Select so all our floating
46
+ // surfaces share one motion vocabulary.
47
+ 'zd:data-[state=delayed-open]:animate-popper-in',
48
+ className,
49
+ )}
50
+ style={{ backgroundColor: 'rgba(25, 17, 11, 0.94)' }}
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ export interface TooltipProps {
57
+ /** Trigger element — receives Radix's ref + event handlers via `asChild`. */
58
+ children: ReactNode
59
+ /** Tooltip copy. When omitted, the trigger renders without a tooltip. */
60
+ content?: ReactNode
61
+ /** Delay before the tooltip appears on hover. Defaults to 200ms. */
62
+ delayDuration?: number
63
+ /** Side to render on. Defaults to `top`. */
64
+ side?: ComponentProps<typeof TooltipPrimitive.Content>['side']
65
+ /** Alignment along `side`. Defaults to `center`. */
66
+ align?: ComponentProps<typeof TooltipPrimitive.Content>['align']
67
+ }
68
+
69
+ /**
70
+ * Opinionated one-shot tooltip. Wraps its child in a Radix Trigger and mounts
71
+ * a portalled content surface; no-op when `content` is empty so callers can
72
+ * pass an optional string without conditional rendering.
73
+ */
74
+ export function Tooltip({
75
+ children,
76
+ content,
77
+ delayDuration = 200,
78
+ side = 'top',
79
+ align = 'center',
80
+ }: TooltipProps) {
81
+ if (!content) return <>{children}</>
82
+ return (
83
+ <TooltipProvider delayDuration={delayDuration}>
84
+ <TooltipRoot>
85
+ <TooltipTrigger asChild>{children}</TooltipTrigger>
86
+ <TooltipPortal>
87
+ <TooltipContent side={side} align={align}>
88
+ {content}
89
+ </TooltipContent>
90
+ </TooltipPortal>
91
+ </TooltipRoot>
92
+ </TooltipProvider>
93
+ )
94
+ }
@@ -34,13 +34,19 @@ export function TopNav({
34
34
  return (
35
35
  <div
36
36
  className={cn(
37
- 'zd:absolute zd:top-4 zd:left-0 zd:right-0 zd:flex zd:flex-row zd:items-center zd:justify-between',
37
+ // Spans the card edge-to-edge; internal px-4 aligns icons with
38
+ // the scroll container's 16px inset.
39
+ 'zd:absolute zd:top-0 zd:left-0 zd:right-0 zd:z-20 zd:flex zd:flex-row zd:items-center zd:justify-between zd:px-4 zd:pt-4',
40
+ // Frosted bg masks scrolled content passing under the nav.
41
+ 'zd:backdrop-blur-[15px]',
38
42
  className,
39
43
  )}
40
44
  // Scale via --zd-spacing (the 4px base) like every spacing utility, so
41
45
  // the nav height tracks the density variants and doesn't eat a
42
46
  // disproportionate share of the shrunken frame at smaller sizes.
43
- style={{ height: `calc(${TOP_NAV_HEIGHT / 4} * var(--zd-spacing))` }}
47
+ style={{
48
+ height: `calc(${(TOP_NAV_HEIGHT + 24) / 4} * var(--zd-spacing))`,
49
+ }}
44
50
  >
45
51
  {onLeftButtonClick ? (
46
52
  <IconButton iconName={leftButtonIcon} onClick={onLeftButtonClick} />
package/src/index.ts CHANGED
@@ -30,6 +30,11 @@ export {
30
30
  icons,
31
31
  } from './components/Icon'
32
32
  export { IconButton, type IconButtonProps } from './components/IconButton'
33
+ export {
34
+ InfoCard,
35
+ type InfoCardImageStyle,
36
+ type InfoCardProps,
37
+ } from './components/InfoCard'
33
38
  export { Input, type InputProps } from './components/Input'
34
39
  export {
35
40
  ListItem,
@@ -45,7 +50,17 @@ export {
45
50
  PillSkeleton,
46
51
  } from './components/Pill'
47
52
  export { PoweredBy } from './components/PoweredBy'
53
+ export {
54
+ ProgressStep,
55
+ type ProgressStepProps,
56
+ type ProgressStepStatus,
57
+ } from './components/ProgressStep'
48
58
  export { Screen } from './components/Screen'
59
+ export { Section, type SectionProps } from './components/Section'
60
+ export {
61
+ MessageDetails,
62
+ type MessageDetailsProps,
63
+ } from './components/Section/MessageDetails'
49
64
  export {
50
65
  Select,
51
66
  SelectContent,
@@ -64,6 +79,16 @@ export {
64
79
  type TokenListItemIconVariant,
65
80
  type TokenListItemProps,
66
81
  } from './components/TokenListItem'
82
+ export {
83
+ Tooltip,
84
+ TooltipContent,
85
+ type TooltipContentProps,
86
+ TooltipPortal,
87
+ type TooltipProps,
88
+ TooltipProvider,
89
+ TooltipRoot,
90
+ TooltipTrigger,
91
+ } from './components/Tooltip'
67
92
  export { TopNav, type TopNavProps } from './components/TopNav'
68
93
  export {
69
94
  WrappedPressable,
@@ -80,4 +105,4 @@ export {
80
105
  ZeroDevLogo,
81
106
  type ZeroDevLogoProps,
82
107
  } from './components/ZeroDevLogo'
83
- export { cn } from './utils/common'
108
+ export { camelCaseToTitle, cn } from './utils/common'
@@ -15,3 +15,18 @@ const customTwMerge = extendTailwindMerge({
15
15
  export function cn(...inputs: ClassValue[]) {
16
16
  return customTwMerge(clsx(inputs))
17
17
  }
18
+
19
+ /** Turn `"fromAddress"` into `"From Address"`. Leaves strings that already
20
+ * start with uppercase (i.e. already display-cased) untouched, so callers can
21
+ * pass either camelCase keys or human-readable labels through unchanged. */
22
+ export function camelCaseToTitle(str: string): string {
23
+ if (str.length === 0 || str.at(0) === str.at(0)?.toUpperCase()) {
24
+ return str
25
+ }
26
+ return str
27
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
28
+ .trim()
29
+ .split(' ')
30
+ .map((word) => (word.at(0) ?? '').toUpperCase() + word.slice(1))
31
+ .join(' ')
32
+ }
@@ -87,6 +87,13 @@ const config: Config = {
87
87
  from: { opacity: '0', transform: 'scale(0.97) translateY(-3px)' },
88
88
  to: { opacity: '1', transform: 'scale(1) translateY(0)' },
89
89
  },
90
+ // Fresh-value flash for live-updating fee estimates: fades and lifts
91
+ // in when the underlying quote changes, so a route swap visibly
92
+ // recalculates rather than silently snapping.
93
+ 'fee-flash': {
94
+ from: { opacity: '0', transform: 'translateY(-3px) scale(0.96)' },
95
+ to: { opacity: '1', transform: 'none' },
96
+ },
90
97
  },
91
98
  animation: {
92
99
  'sheet-in': 'sheet-in 300ms cubic-bezier(0.32, 0.72, 0, 1) forwards',
@@ -95,6 +102,7 @@ const config: Config = {
95
102
  'backdrop-out': 'backdrop-out 200ms ease-out forwards',
96
103
  'skel-pulse': 'skel-pulse 1.1s ease-in-out infinite',
97
104
  'popper-in': 'popper-in 160ms ease-out both',
105
+ 'fee-flash': 'fee-flash 420ms cubic-bezier(0.2, 0.9, 0.3, 1) both',
98
106
  },
99
107
  },
100
108
  },