@boyernick/standard-ui-react 0.1.1-canary.3 → 0.1.1-canary.34

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 (89) hide show
  1. package/package.json +5 -3
  2. package/src/accordion.tsx +5 -2
  3. package/src/alert-dialog.tsx +1 -1
  4. package/src/attachment.tsx +5 -2
  5. package/src/autocomplete.tsx +12 -9
  6. package/src/badge.tsx +73 -9
  7. package/src/block-editor.tsx +1747 -0
  8. package/src/brand.tsx +2 -2
  9. package/src/breadcrumb.tsx +46 -21
  10. package/src/button.tsx +23 -12
  11. package/src/calendar.tsx +25 -11
  12. package/src/card.tsx +57 -14
  13. package/src/carousel.tsx +339 -15
  14. package/src/checkbox.tsx +36 -13
  15. package/src/code-block.tsx +66 -5
  16. package/src/collapsible.tsx +7 -3
  17. package/src/combobox.tsx +17 -15
  18. package/src/command.tsx +41 -14
  19. package/src/context-menu.tsx +6 -3
  20. package/src/date-picker.tsx +174 -0
  21. package/src/dialog.tsx +33 -10
  22. package/src/empty.tsx +4 -4
  23. package/src/field.tsx +4 -3
  24. package/src/filter-group.tsx +143 -0
  25. package/src/icons.tsx +55 -1
  26. package/src/illustrations.tsx +219 -141
  27. package/src/index.ts +263 -18
  28. package/src/input.tsx +8 -5
  29. package/src/kbd.tsx +49 -0
  30. package/src/lib/focus.ts +41 -0
  31. package/src/lib/motion.ts +16 -1
  32. package/src/lib/popup.ts +45 -0
  33. package/src/lifeline/company-icon.tsx +71 -0
  34. package/src/lifeline/index.ts +42 -0
  35. package/src/lifeline/lifeline-data.ts +97 -0
  36. package/src/lifeline/lifeline-desktop.tsx +204 -0
  37. package/src/lifeline/lifeline-event.tsx +108 -0
  38. package/src/lifeline/lifeline-fireworks.tsx +302 -0
  39. package/src/lifeline/lifeline-hover-image.tsx +269 -0
  40. package/src/lifeline/lifeline-icons.tsx +39 -0
  41. package/src/lifeline/lifeline-intro-timing.ts +105 -0
  42. package/src/lifeline/lifeline-labels.tsx +24 -0
  43. package/src/lifeline/lifeline-layout.ts +1 -0
  44. package/src/lifeline/lifeline-legend.tsx +31 -0
  45. package/src/lifeline/lifeline-lightbox.tsx +309 -0
  46. package/src/lifeline/lifeline-marker.tsx +183 -0
  47. package/src/lifeline/lifeline-people.tsx +99 -0
  48. package/src/lifeline/lifeline-photos.tsx +366 -0
  49. package/src/lifeline/lifeline-shell.tsx +135 -0
  50. package/src/lifeline/lifeline-utils.ts +83 -0
  51. package/src/lifeline/lifeline-vertical.tsx +482 -0
  52. package/src/lifeline/lifeline.tsx +69 -0
  53. package/src/lifeline/types.ts +112 -0
  54. package/src/lifeline/use-lifeline-intro.ts +130 -0
  55. package/src/lifeline/use-lifeline-scroll.ts +1011 -0
  56. package/src/lifeline/use-lifeline-vertical-scroll.ts +271 -0
  57. package/src/menu.tsx +7 -4
  58. package/src/menubar.tsx +9 -2
  59. package/src/minimap.tsx +296 -0
  60. package/src/modal.tsx +608 -0
  61. package/src/navigation-menu.tsx +340 -67
  62. package/src/number-field.tsx +336 -61
  63. package/src/otp-field.tsx +4 -3
  64. package/src/pagination.tsx +262 -42
  65. package/src/password-protection.tsx +345 -0
  66. package/src/popover.tsx +3 -1
  67. package/src/preview-card.tsx +3 -1
  68. package/src/progress.tsx +5 -0
  69. package/src/questionnaire.tsx +284 -0
  70. package/src/radio.tsx +4 -2
  71. package/src/scroll-area.tsx +4 -1
  72. package/src/select.tsx +12 -7
  73. package/src/sidebar.tsx +113 -28
  74. package/src/slider.tsx +66 -6
  75. package/src/sounds.tsx +6 -10
  76. package/src/spinner.tsx +105 -32
  77. package/src/switch.tsx +4 -1
  78. package/src/table.tsx +82 -15
  79. package/src/tabs.tsx +189 -38
  80. package/src/text-animate.tsx +71 -28
  81. package/src/textarea.tsx +6 -1
  82. package/src/timeline.tsx +378 -0
  83. package/src/toast.tsx +214 -35
  84. package/src/toggle.tsx +4 -2
  85. package/src/toolbar.tsx +12 -7
  86. package/src/tooltip.tsx +43 -3
  87. package/src/video-player.tsx +396 -127
  88. package/src/image-modal.tsx +0 -110
  89. package/src/markdown-editor.tsx +0 -302
package/src/toggle.tsx CHANGED
@@ -4,6 +4,7 @@ import { Toggle as BaseToggle } from "@base-ui/react/toggle"
4
4
  import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group"
5
5
  import type { ComponentProps } from "react"
6
6
  import { cn } from "./lib/cn"
7
+ import { focusRing } from "./lib/focus"
7
8
  import { motion } from "./lib/motion"
8
9
 
9
10
  export type ToggleProps = ComponentProps<typeof BaseToggle>
@@ -12,9 +13,10 @@ export type ToggleGroupProps = ComponentProps<typeof BaseToggleGroup>
12
13
  export const Toggle = ({ className, ...props }: ToggleProps) => (
13
14
  <BaseToggle
14
15
  className={cn(
15
- "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2.5 text-sm text-fg-secondary outline-none",
16
+ "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2.5 text-sm text-fg-secondary",
16
17
  motion.colors,
17
- "hover:bg-background-tertiary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-background-tertiary data-pressed:text-fg-primary",
18
+ focusRing,
19
+ "hover:bg-background-tertiary data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-background-tertiary data-pressed:text-fg-primary",
18
20
  className,
19
21
  )}
20
22
  {...props}
package/src/toolbar.tsx CHANGED
@@ -3,6 +3,7 @@
3
3
  import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar"
4
4
  import type { ComponentProps } from "react"
5
5
  import { cn } from "./lib/cn"
6
+ import { focusRing, focusRingBorder } from "./lib/focus"
6
7
  import { motion } from "./lib/motion"
7
8
 
8
9
  export type ToolbarProps = ComponentProps<typeof BaseToolbar.Root>
@@ -15,7 +16,7 @@ export type ToolbarSeparatorProps = ComponentProps<typeof BaseToolbar.Separator>
15
16
  export const Toolbar = ({ className, ...props }: ToolbarProps) => (
16
17
  <BaseToolbar.Root
17
18
  className={cn(
18
- "inline-flex items-center gap-0.5 rounded-lg border border-border-primary bg-background-secondary p-0.5",
19
+ "inline-flex items-center gap-0.5 rounded-lg py-0.5 pr-1.5 pl-0.5 shadow-lg",
19
20
  className,
20
21
  )}
21
22
  {...props}
@@ -32,9 +33,11 @@ export const ToolbarGroup = ({ className, ...props }: ToolbarGroupProps) => (
32
33
  export const ToolbarButton = ({ className, ...props }: ToolbarButtonProps) => (
33
34
  <BaseToolbar.Button
34
35
  className={cn(
35
- "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm text-fg-secondary outline-none",
36
+ "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm text-fg-secondary",
37
+ focusRingBorder,
36
38
  motion.colors,
37
- "hover:bg-background-tertiary hover:text-fg-primary outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-background-tertiary data-pressed:text-fg-primary",
39
+ focusRing,
40
+ "hover:bg-background-tertiary hover:text-fg-primary data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-background-tertiary data-pressed:text-fg-primary",
38
41
  className,
39
42
  )}
40
43
  {...props}
@@ -44,9 +47,11 @@ export const ToolbarButton = ({ className, ...props }: ToolbarButtonProps) => (
44
47
  export const ToolbarLink = ({ className, ...props }: ToolbarLinkProps) => (
45
48
  <BaseToolbar.Link
46
49
  className={cn(
47
- "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm text-fg-secondary outline-none",
50
+ "inline-flex h-8 cursor-pointer items-center justify-center gap-1.5 rounded-md px-2.5 text-sm text-fg-secondary",
51
+ focusRingBorder,
48
52
  motion.colors,
49
- "hover:bg-background-tertiary hover:text-fg-primary outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20",
53
+ focusRing,
54
+ "hover:bg-background-tertiary hover:text-fg-primary",
50
55
  className,
51
56
  )}
52
57
  {...props}
@@ -56,8 +61,8 @@ export const ToolbarLink = ({ className, ...props }: ToolbarLinkProps) => (
56
61
  export const ToolbarInput = ({ className, ...props }: ToolbarInputProps) => (
57
62
  <BaseToolbar.Input
58
63
  className={cn(
59
- "h-8 min-w-28 cursor-text rounded-md border border-border-secondary bg-surface px-2.5 text-sm text-fg-primary outline-none placeholder:text-fg-quaternary",
60
- "outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20",
64
+ "h-8 min-w-28 cursor-text rounded-md border border-border-secondary bg-surface px-2.5 text-sm text-fg-primary placeholder:text-fg-quaternary",
65
+ focusRing,
61
66
  className,
62
67
  )}
63
68
  {...props}
package/src/tooltip.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip"
4
+ import { cva, type VariantProps } from "class-variance-authority"
4
5
  import type { ComponentProps } from "react"
5
6
  import { cn } from "./lib/cn"
6
7
  import { motion } from "./lib/motion"
@@ -12,7 +13,8 @@ export type TooltipPortalProps = ComponentProps<typeof BaseTooltip.Portal>
12
13
  export type TooltipPositionerProps = ComponentProps<
13
14
  typeof BaseTooltip.Positioner
14
15
  >
15
- export type TooltipPopupProps = ComponentProps<typeof BaseTooltip.Popup>
16
+ export type TooltipPopupProps = ComponentProps<typeof BaseTooltip.Popup> &
17
+ VariantProps<typeof tooltipPopupVariants>
16
18
 
17
19
  export const TooltipProvider = (props: TooltipProviderProps) => (
18
20
  <BaseTooltip.Provider {...props} />
@@ -43,13 +45,51 @@ export const TooltipPositioner = ({
43
45
  />
44
46
  )
45
47
 
46
- export const TooltipPopup = ({ className, ...props }: TooltipPopupProps) => (
48
+ // Neither variant carries a border — `shadow-md` already composes
49
+ // `--elevation-hairline`, so one would stack a second edge. That hairline is
50
+ // what gives the default popup its edge against a same-coloured page.
51
+ const tooltipPopupVariants = cva(
52
+ cn(
53
+ "z-50 max-w-xs rounded-md px-2.5 py-1 text-xs shadow-md outline-none",
54
+ // A trailing keycap already carries its own inset, so the full 10px beside
55
+ // it reads as a gap rather than padding — but sitting flush on the vertical
56
+ // inset crowds the corner, so it gets a touch more than that.
57
+ //
58
+ // Laying the row out as flex is what centres it. On a text line the keycap
59
+ // is an inline-flex aligned `middle`, which sets its centre against the
60
+ // baseline plus half an x-height rather than the line's centre — at 16px it
61
+ // hung 1.18px low, leaving 6.36px above and 4px below. Scoped to `has-[kbd]`
62
+ // because making every popup a flex container would turn a multi-child
63
+ // tooltip from stacked blocks into a row.
64
+ "has-[kbd]:flex has-[kbd]:items-center has-[kbd]:pr-1.5",
65
+ ),
66
+ {
67
+ variants: {
68
+ variant: {
69
+ // Sits on the page's own surface: white in light mode, dark in dark.
70
+ default: "bg-surface text-fg-primary",
71
+ // Flipped against the page — dark in light mode, light in dark — for
72
+ // a hint that should read as separate from what it floats over.
73
+ inverted: "bg-surface-inverted text-fg-inverted",
74
+ },
75
+ },
76
+ defaultVariants: { variant: "default" },
77
+ },
78
+ )
79
+
80
+ export const TooltipPopup = ({
81
+ className,
82
+ variant,
83
+ ...props
84
+ }: TooltipPopupProps) => (
47
85
  <BaseTooltip.Popup
48
86
  className={cn(
49
- "z-50 max-w-xs rounded-md bg-surface-inverted px-2.5 py-1 text-xs text-fg-inverted shadow-md outline-none",
87
+ tooltipPopupVariants({ variant }),
50
88
  motion.popupAnchor,
51
89
  className,
52
90
  )}
53
91
  {...props}
54
92
  />
55
93
  )
94
+
95
+ export { tooltipPopupVariants }