@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/brand.tsx CHANGED
@@ -45,13 +45,13 @@ export const BrandWordmark = ({
45
45
  compact = false,
46
46
  size = "md",
47
47
  }: BrandWordmarkProps) => {
48
- const resolvedMarkSize = markSize ?? (size === "sm" ? 16 : 28)
48
+ const resolvedMarkSize = markSize ?? (size === "sm" ? 16 : 32)
49
49
 
50
50
  return (
51
51
  <span
52
52
  className={cn(
53
53
  "inline-flex items-center",
54
- size === "sm" ? "gap-1" : "gap-1.5",
54
+ size === "sm" ? "gap-1.5" : "gap-2",
55
55
  className,
56
56
  )}
57
57
  aria-label="StandardUI"
@@ -1,16 +1,31 @@
1
- import type { ComponentProps, ReactNode } from "react";
2
- import { IconChevronRightSmall } from "./icons";
3
- import { cn } from "./lib/cn";
4
- import { motion } from "./lib/motion";
1
+ import { cva, type VariantProps } from "class-variance-authority"
2
+ import type { ComponentProps, ReactNode } from "react"
3
+ import { IconChevronRightSmall } from "./icons"
4
+ import { cn } from "./lib/cn"
5
+ import { focusRing, focusRingBorder } from "./lib/focus"
6
+ import { motion } from "./lib/motion"
7
+
8
+ export type BreadcrumbProps = ComponentProps<"nav">
9
+ export type BreadcrumbListProps = ComponentProps<"ol">
10
+ export type BreadcrumbItemProps = ComponentProps<"li">
11
+ export type BreadcrumbLinkProps = ComponentProps<"a">
12
+ export type BreadcrumbPageProps = ComponentProps<"span">
13
+
14
+ const breadcrumbSeparatorVariants = cva("text-fg-tertiary", {
15
+ variants: {
16
+ variant: {
17
+ chevron: "[&_svg]:size-3.5",
18
+ slash: "",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "slash",
23
+ },
24
+ })
5
25
 
6
- export type BreadcrumbProps = ComponentProps<"nav">;
7
- export type BreadcrumbListProps = ComponentProps<"ol">;
8
- export type BreadcrumbItemProps = ComponentProps<"li">;
9
- export type BreadcrumbLinkProps = ComponentProps<"a">;
10
- export type BreadcrumbPageProps = ComponentProps<"span">;
11
26
  export type BreadcrumbSeparatorProps = ComponentProps<"li"> & {
12
- children?: ReactNode;
13
- };
27
+ children?: ReactNode
28
+ } & VariantProps<typeof breadcrumbSeparatorVariants>
14
29
 
15
30
  export const Breadcrumb = ({ className, ...props }: BreadcrumbProps) => (
16
31
  <nav
@@ -18,17 +33,17 @@ export const Breadcrumb = ({ className, ...props }: BreadcrumbProps) => (
18
33
  className={cn("text-sm text-fg-secondary", className)}
19
34
  {...props}
20
35
  />
21
- );
36
+ )
22
37
 
23
38
  export const BreadcrumbList = ({
24
39
  className,
25
40
  ...props
26
41
  }: BreadcrumbListProps) => (
27
42
  <ol
28
- className={cn("flex flex-wrap items-center gap-1.5", className)}
43
+ className={cn("flex flex-wrap items-center gap-x-3 gap-y-1.5", className)}
29
44
  {...props}
30
45
  />
31
- );
46
+ )
32
47
 
33
48
  export const BreadcrumbItem = ({
34
49
  className,
@@ -38,7 +53,7 @@ export const BreadcrumbItem = ({
38
53
  className={cn("inline-flex items-center gap-1.5", className)}
39
54
  {...props}
40
55
  />
41
- );
56
+ )
42
57
 
43
58
  export const BreadcrumbLink = ({
44
59
  className,
@@ -46,13 +61,15 @@ export const BreadcrumbLink = ({
46
61
  }: BreadcrumbLinkProps) => (
47
62
  <a
48
63
  className={cn(
49
- "cursor-pointer rounded-sm text-fg-secondary outline-none hover:text-fg-primary 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
+ "cursor-pointer rounded-sm text-fg-secondary hover:text-fg-primary",
65
+ focusRingBorder,
66
+ focusRing,
50
67
  motion.colors,
51
68
  className,
52
69
  )}
53
70
  {...props}
54
71
  />
55
- );
72
+ )
56
73
 
57
74
  export const BreadcrumbPage = ({
58
75
  className,
@@ -63,19 +80,27 @@ export const BreadcrumbPage = ({
63
80
  className={cn("font-medium text-fg-primary", className)}
64
81
  {...props}
65
82
  />
66
- );
83
+ )
67
84
 
68
85
  export const BreadcrumbSeparator = ({
69
86
  className,
70
87
  children,
88
+ variant = "slash",
71
89
  ...props
72
90
  }: BreadcrumbSeparatorProps) => (
73
91
  <li
74
92
  role="presentation"
75
93
  aria-hidden
76
- className={cn("text-fg-tertiary [&_svg]:size-3.5", className)}
94
+ className={cn(breadcrumbSeparatorVariants({ variant }), className)}
77
95
  {...props}
78
96
  >
79
- {children ?? <IconChevronRightSmall />}
97
+ {children ??
98
+ (variant === "chevron" ? (
99
+ <IconChevronRightSmall aria-hidden />
100
+ ) : (
101
+ "/"
102
+ ))}
80
103
  </li>
81
- );
104
+ )
105
+
106
+ export { breadcrumbSeparatorVariants }
package/src/button.tsx CHANGED
@@ -1,22 +1,33 @@
1
1
  import { cva, type VariantProps } from "class-variance-authority"
2
2
  import type { ButtonHTMLAttributes, ReactNode } from "react"
3
3
  import { cn } from "./lib/cn"
4
+ import { focusRing, focusRingDestructive } from "./lib/focus"
4
5
 
5
6
  const buttonVariants = cva(
6
- "text-sm inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-[var(--duration-sm)] ease-enter outline-none focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 active:translate-y-px [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
+ "text-sm inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-[var(--duration-sm)] ease-enter disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 active:translate-y-px [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
8
  {
8
9
  variants: {
9
10
  variant: {
10
- primary:
11
- "border border-brand-primary-border bg-brand-primary text-brand-foreground inset-shadow-solid-top hover:bg-brand-primary-hover active:bg-brand-primary-active focus-visible:border-ring focus-visible:ring-ring/20",
12
- secondary:
13
- "border border-transparent bg-background-tertiary text-fg-primary hover:bg-background-quaternary active:bg-background-active focus-visible:border-ring focus-visible:ring-ring/20 dark:bg-gray-250 dark:hover:bg-gray-350 dark:active:bg-gray-200",
14
- outline:
15
- "border border-border-secondary bg-surface text-fg-primary inset-shadow-outline-top hover:bg-background-tertiary focus-visible:border-ring focus-visible:ring-ring/20",
16
- ghost:
17
- "border border-transparent text-fg-secondary hover:bg-background-tertiary hover:text-fg-primary focus-visible:border-ring focus-visible:ring-ring/20",
18
- destructive:
19
- "border border-destructive-active bg-destructive text-white inset-shadow-solid-top hover:bg-destructive-active focus-visible:border-destructive focus-visible:ring-destructive/20",
11
+ primary: cn(
12
+ "border border-brand-primary-border bg-brand-primary text-brand-foreground inset-shadow-solid-top hover:bg-brand-primary-hover active:bg-brand-primary-active",
13
+ focusRing,
14
+ ),
15
+ secondary: cn(
16
+ "border border-transparent bg-background-tertiary text-fg-primary hover:bg-background-quaternary active:bg-background-active dark:bg-gray-250 dark:hover:bg-gray-350 dark:active:bg-gray-200",
17
+ focusRing,
18
+ ),
19
+ outline: cn(
20
+ "border border-border-secondary bg-surface text-fg-primary inset-shadow-outline-top hover:bg-background-tertiary",
21
+ focusRing,
22
+ ),
23
+ ghost: cn(
24
+ "border border-transparent text-fg-secondary hover:bg-background-tertiary hover:text-fg-primary",
25
+ focusRing,
26
+ ),
27
+ destructive: cn(
28
+ "border border-destructive-active bg-destructive text-white inset-shadow-solid-top hover:bg-destructive-active",
29
+ focusRingDestructive,
30
+ ),
20
31
  },
21
32
  size: {
22
33
  sm: "h-8 px-3",
@@ -25,7 +36,7 @@ const buttonVariants = cva(
25
36
  },
26
37
  rounded: {
27
38
  true: "rounded-full",
28
- false: "rounded-md",
39
+ false: "rounded-lg",
29
40
  },
30
41
  iconOnly: {
31
42
  true: "px-0",
package/src/calendar.tsx CHANGED
@@ -3,14 +3,16 @@
3
3
  import { DayPicker, type ChevronProps, type DayPickerProps } from "react-day-picker"
4
4
  import { IconChevronBottom } from "./icons"
5
5
  import { cn } from "./lib/cn"
6
+ import { focusRing } from "./lib/focus"
6
7
  import { motion } from "./lib/motion"
7
8
 
8
9
  export type CalendarProps = DayPickerProps
9
10
 
10
11
  const navButtonClassName = cn(
11
- "inline-flex size-8 items-center justify-center rounded-md text-fg-tertiary",
12
+ "inline-flex size-6 items-center justify-center rounded-md border border-transparent text-fg-tertiary",
12
13
  motion.colors,
13
- "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 disabled:cursor-not-allowed disabled:opacity-50",
14
+ focusRing,
15
+ "hover:bg-background-tertiary hover:text-fg-primary focus-visible:bg-background-tertiary focus-visible:text-fg-primary disabled:cursor-not-allowed disabled:opacity-50",
14
16
  )
15
17
 
16
18
  const CalendarChevron = ({
@@ -40,34 +42,46 @@ export const Calendar = ({
40
42
  className,
41
43
  classNames,
42
44
  showOutsideDays = true,
45
+ weekStartsOn = 1,
43
46
  components,
44
47
  ...props
45
48
  }: CalendarProps) => (
46
49
  <DayPicker
47
50
  showOutsideDays={showOutsideDays}
48
- className={cn("w-fit p-3", className)}
51
+ weekStartsOn={weekStartsOn}
52
+ className={cn(
53
+ "w-64 rounded-xl border border-border-primary bg-surface p-3",
54
+ className,
55
+ )}
49
56
  classNames={{
50
57
  months: "relative flex flex-col gap-4 sm:flex-row",
51
- month: "flex w-full flex-col gap-3",
52
- month_caption: "relative flex h-8 items-center justify-center px-8",
58
+ month: "flex w-full flex-col",
59
+ month_caption: "flex h-8 items-start justify-start",
53
60
  caption_label: "text-sm-strong text-fg-primary",
54
- nav: "absolute inset-x-0 top-0 flex items-center justify-between",
61
+ nav: "absolute top-0 right-0 flex items-center",
55
62
  button_previous: navButtonClassName,
56
63
  button_next: navButtonClassName,
57
64
  month_grid: "w-full border-collapse",
58
65
  weekdays: "flex",
59
66
  weekday:
60
- "flex size-8 items-center justify-center text-xs font-normal text-fg-tertiary",
61
- weeks: "flex flex-col",
62
- week: "mt-0.5 flex w-full",
67
+ "flex w-8 items-center justify-center pb-1 text-xs font-normal text-fg-tertiary select-none",
68
+ weeks: "flex flex-col gap-1",
69
+ week: "flex w-full",
63
70
  day: "relative p-0 text-center",
64
71
  day_button: cn(
65
- "inline-flex size-8 items-center justify-center rounded-md text-sm text-fg-primary",
72
+ "inline-flex size-8 items-center justify-center rounded-lg border border-transparent text-sm text-fg-primary tabular-nums",
66
73
  motion.colors,
67
- "hover:bg-background-tertiary 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 disabled:cursor-not-allowed disabled:opacity-50 aria-selected:opacity-100",
74
+ focusRing,
75
+ "hover:bg-background-tertiary focus-visible:z-10 disabled:cursor-not-allowed disabled:opacity-50 aria-selected:opacity-100",
68
76
  ),
69
77
  selected:
70
78
  "[&>button]:bg-brand-primary [&>button]:text-brand-foreground [&>button]:ring-0 [&>button]:hover:bg-brand-primary-hover [&>button]:hover:text-brand-foreground",
79
+ range_start:
80
+ "rounded-l-lg bg-brand-primary/10 last:rounded-r-lg [&>button]:relative [&>button]:z-[1]",
81
+ range_middle:
82
+ "bg-brand-primary/10 first:rounded-l-lg last:rounded-r-lg [&>button]:!rounded-none [&>button]:!bg-transparent [&>button]:!text-fg-primary [&>button]:hover:!bg-brand-primary/15",
83
+ range_end:
84
+ "rounded-r-lg bg-brand-primary/10 first:rounded-l-lg [&>button]:relative [&>button]:z-[1]",
71
85
  today:
72
86
  "[&>button]:font-medium [&>button]:ring-1 [&>button]:ring-inset [&>button]:ring-border-secondary",
73
87
  outside: "[&>button]:text-fg-quaternary",
package/src/card.tsx CHANGED
@@ -1,32 +1,59 @@
1
+ import { cva, type VariantProps } from "class-variance-authority"
1
2
  import type { HTMLAttributes } from "react"
2
3
  import { cn } from "./lib/cn"
3
4
 
4
- export type CardProps = HTMLAttributes<HTMLDivElement>
5
+ const cardVariants = cva("flex flex-col rounded-xl bg-surface text-fg-primary", {
6
+ variants: {
7
+ variant: {
8
+ elevated: "shadow-lg",
9
+ outline: "border border-border-primary",
10
+ ghost: "",
11
+ },
12
+ padding: {
13
+ md: "gap-6 py-6",
14
+ none: "",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "elevated",
19
+ padding: "md",
20
+ },
21
+ })
22
+
23
+ export type CardProps = HTMLAttributes<HTMLDivElement> &
24
+ VariantProps<typeof cardVariants>
5
25
  export type CardHeaderProps = HTMLAttributes<HTMLDivElement>
6
26
  export type CardTitleProps = HTMLAttributes<HTMLHeadingElement>
7
27
  export type CardDescriptionProps = HTMLAttributes<HTMLParagraphElement>
28
+ export type CardActionProps = HTMLAttributes<HTMLDivElement>
8
29
  export type CardContentProps = HTMLAttributes<HTMLDivElement>
9
30
  export type CardFooterProps = HTMLAttributes<HTMLDivElement>
10
31
 
11
- export const Card = ({ className, ...props }: CardProps) => (
32
+ export const Card = ({ className, variant, padding, ...props }: CardProps) => (
12
33
  <div
13
- className={cn(
14
- "flex flex-col overflow-hidden rounded-xl border border-border-primary bg-surface",
15
- className,
16
- )}
17
34
  {...props}
35
+ data-slot="card"
36
+ className={cn(cardVariants({ variant, padding }), className)}
18
37
  />
19
38
  )
20
39
 
21
40
  export const CardHeader = ({ className, ...props }: CardHeaderProps) => (
22
41
  <div
23
- className={cn("flex flex-col gap-1 px-5 pt-5 pb-3", className)}
24
42
  {...props}
43
+ data-slot="card-header"
44
+ className={cn(
45
+ "grid auto-rows-min items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
46
+ className,
47
+ )}
25
48
  />
26
49
  )
27
50
 
28
51
  export const CardTitle = ({ className, ...props }: CardTitleProps) => (
29
- <h3 className={cn("text-sm-strong text-fg-primary", className)} {...props} />
52
+ <h3
53
+ {...props}
54
+ data-slot="card-title"
55
+ className={cn("text-sm-strong leading-none text-fg-primary", className)}
56
+ />
30
57
  )
31
58
 
32
59
  export const CardDescription = ({
@@ -34,21 +61,37 @@ export const CardDescription = ({
34
61
  ...props
35
62
  }: CardDescriptionProps) => (
36
63
  <p
37
- className={cn("text-sm leading-relaxed text-fg-secondary", className)}
38
64
  {...props}
65
+ data-slot="card-description"
66
+ className={cn("text-sm text-fg-secondary", className)}
67
+ />
68
+ )
69
+
70
+ export const CardAction = ({ className, ...props }: CardActionProps) => (
71
+ <div
72
+ {...props}
73
+ data-slot="card-action"
74
+ className={cn(
75
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
76
+ className,
77
+ )}
39
78
  />
40
79
  )
41
80
 
42
81
  export const CardContent = ({ className, ...props }: CardContentProps) => (
43
- <div className={cn("px-5 pb-5", className)} {...props} />
82
+ <div
83
+ {...props}
84
+ data-slot="card-content"
85
+ className={cn("px-6", className)}
86
+ />
44
87
  )
45
88
 
46
89
  export const CardFooter = ({ className, ...props }: CardFooterProps) => (
47
90
  <div
48
- className={cn(
49
- "flex items-center gap-2 border-t border-border-primary px-5 py-4",
50
- className,
51
- )}
52
91
  {...props}
92
+ data-slot="card-footer"
93
+ className={cn("flex items-center gap-2 px-6", className)}
53
94
  />
54
95
  )
96
+
97
+ export { cardVariants }