@enya-learning/nova 0.4.0 → 0.4.1

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 (139) hide show
  1. package/dist/chunks/vendor-base-ui-efqwzv4oinwg1f0d.js.map +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/package.json +26 -11
  4. package/changelog.md +0 -44
  5. package/components.json +0 -23
  6. package/eslint.config.js +0 -30
  7. package/plopfile.mjs +0 -49
  8. package/src/components/.gitkeep +0 -0
  9. package/src/components/accordion/accordion.mdx +0 -83
  10. package/src/components/accordion/accordion.tsx +0 -81
  11. package/src/components/accordion/index.ts +0 -1
  12. package/src/components/alert/alert.tsx +0 -76
  13. package/src/components/alert/index.ts +0 -1
  14. package/src/components/alert-dialog/alert-dialog.tsx +0 -187
  15. package/src/components/alert-dialog/index.ts +0 -1
  16. package/src/components/aspect-ratio/aspect-ratio.tsx +0 -22
  17. package/src/components/aspect-ratio/index.ts +0 -1
  18. package/src/components/avatar/avatar.tsx +0 -107
  19. package/src/components/avatar/index.ts +0 -1
  20. package/src/components/badge/badge.tsx +0 -52
  21. package/src/components/badge/index.ts +0 -1
  22. package/src/components/breadcrumb/breadcrumb.tsx +0 -122
  23. package/src/components/breadcrumb/index.ts +0 -1
  24. package/src/components/button/button.mdx +0 -255
  25. package/src/components/button/button.tsx +0 -59
  26. package/src/components/button/index.ts +0 -1
  27. package/src/components/button-group/button-group.tsx +0 -87
  28. package/src/components/button-group/index.ts +0 -1
  29. package/src/components/calendar/calendar.tsx +0 -228
  30. package/src/components/calendar/index.ts +0 -1
  31. package/src/components/card/card.tsx +0 -100
  32. package/src/components/card/index.ts +0 -1
  33. package/src/components/carousel/carousel.tsx +0 -243
  34. package/src/components/carousel/index.ts +0 -1
  35. package/src/components/chart/chart.tsx +0 -371
  36. package/src/components/chart/index.ts +0 -1
  37. package/src/components/checkbox/checkbox.tsx +0 -28
  38. package/src/components/checkbox/index.ts +0 -1
  39. package/src/components/collapsible/collapsible.tsx +0 -19
  40. package/src/components/collapsible/index.ts +0 -1
  41. package/src/components/combobox/combobox.tsx +0 -298
  42. package/src/components/combobox/index.ts +0 -1
  43. package/src/components/command/command.tsx +0 -193
  44. package/src/components/command/index.ts +0 -1
  45. package/src/components/context-menu/context-menu.tsx +0 -272
  46. package/src/components/context-menu/index.ts +0 -1
  47. package/src/components/dialog/dialog.tsx +0 -157
  48. package/src/components/dialog/index.ts +0 -1
  49. package/src/components/direction/direction.tsx +0 -4
  50. package/src/components/direction/index.ts +0 -1
  51. package/src/components/drawer/drawer.tsx +0 -134
  52. package/src/components/drawer/index.ts +0 -1
  53. package/src/components/dropdown-menu/dropdown-menu.tsx +0 -270
  54. package/src/components/dropdown-menu/index.ts +0 -1
  55. package/src/components/empty/empty.tsx +0 -104
  56. package/src/components/empty/index.ts +0 -1
  57. package/src/components/enya-logo/enya-logo.mdx +0 -174
  58. package/src/components/enya-logo/enya-logo.tsx +0 -383
  59. package/src/components/enya-logo/index.ts +0 -1
  60. package/src/components/field/field.tsx +0 -236
  61. package/src/components/field/index.ts +0 -1
  62. package/src/components/hover-card/hover-card.tsx +0 -51
  63. package/src/components/hover-card/index.ts +0 -1
  64. package/src/components/input/index.ts +0 -1
  65. package/src/components/input/input.tsx +0 -20
  66. package/src/components/input-group/index.ts +0 -1
  67. package/src/components/input-group/input-group.tsx +0 -157
  68. package/src/components/input-otp/index.ts +0 -1
  69. package/src/components/input-otp/input-otp.tsx +0 -84
  70. package/src/components/item/index.ts +0 -1
  71. package/src/components/item/item.tsx +0 -201
  72. package/src/components/kbd/index.ts +0 -1
  73. package/src/components/kbd/kbd.tsx +0 -26
  74. package/src/components/label/index.ts +0 -1
  75. package/src/components/label/label.tsx +0 -20
  76. package/src/components/menubar/index.ts +0 -1
  77. package/src/components/menubar/menubar.tsx +0 -281
  78. package/src/components/native-select/index.ts +0 -1
  79. package/src/components/native-select/native-select.tsx +0 -65
  80. package/src/components/navigation-menu/index.ts +0 -1
  81. package/src/components/navigation-menu/navigation-menu.tsx +0 -171
  82. package/src/components/pagination/index.ts +0 -1
  83. package/src/components/pagination/pagination.tsx +0 -133
  84. package/src/components/popover/index.ts +0 -1
  85. package/src/components/popover/popover.tsx +0 -88
  86. package/src/components/progress/index.ts +0 -1
  87. package/src/components/progress/progress.tsx +0 -83
  88. package/src/components/radio-group/index.ts +0 -1
  89. package/src/components/radio-group/radio-group.tsx +0 -36
  90. package/src/components/resizable/index.ts +0 -1
  91. package/src/components/resizable/resizable.tsx +0 -50
  92. package/src/components/scroll-area/index.ts +0 -1
  93. package/src/components/scroll-area/scroll-area.tsx +0 -53
  94. package/src/components/select/index.ts +0 -1
  95. package/src/components/select/select.tsx +0 -205
  96. package/src/components/separator/index.ts +0 -1
  97. package/src/components/separator/separator.tsx +0 -23
  98. package/src/components/sheet/index.ts +0 -1
  99. package/src/components/sheet/sheet.tsx +0 -137
  100. package/src/components/sidebar/index.ts +0 -1
  101. package/src/components/sidebar/sidebar.tsx +0 -722
  102. package/src/components/skeleton/index.ts +0 -1
  103. package/src/components/skeleton/skeleton.tsx +0 -13
  104. package/src/components/slider/index.ts +0 -1
  105. package/src/components/slider/slider.tsx +0 -52
  106. package/src/components/sonner/index.ts +0 -1
  107. package/src/components/sonner/sonner.tsx +0 -45
  108. package/src/components/spinner/index.ts +0 -1
  109. package/src/components/spinner/spinner.tsx +0 -15
  110. package/src/components/switch/index.ts +0 -1
  111. package/src/components/switch/switch.tsx +0 -30
  112. package/src/components/table/index.ts +0 -1
  113. package/src/components/table/table.tsx +0 -116
  114. package/src/components/tabs/index.ts +0 -1
  115. package/src/components/tabs/tabs.tsx +0 -80
  116. package/src/components/textarea/index.ts +0 -1
  117. package/src/components/textarea/textarea.tsx +0 -18
  118. package/src/components/toggle/index.ts +0 -1
  119. package/src/components/toggle/toggle.tsx +0 -45
  120. package/src/components/toggle-group/index.ts +0 -1
  121. package/src/components/toggle-group/toggle-group.tsx +0 -87
  122. package/src/components/tooltip/index.ts +0 -1
  123. package/src/components/tooltip/tooltip.tsx +0 -64
  124. package/src/hooks/use-mobile.ts +0 -21
  125. package/src/index.ts +0 -58
  126. package/src/lib/.gitkeep +0 -0
  127. package/src/lib/utils.ts +0 -6
  128. package/src/styles/nova-binding.css +0 -290
  129. package/src/styles/nova.css +0 -58
  130. package/src/styles/theme-nova.css +0 -201
  131. package/src/styles/typography.css +0 -215
  132. package/src/utils/index.ts +0 -1
  133. package/templates/component/component.tsx.hbs +0 -16
  134. package/templates/component/index.ts.hbs +0 -1
  135. package/templates/component/stories.tsx.hbs +0 -13
  136. package/tsconfig.json +0 -18
  137. package/tsconfig.lint.json +0 -14
  138. package/vite.config.ts +0 -101
  139. /package/{src → dist}/styles/globals.css +0 -0
@@ -1,107 +0,0 @@
1
- import * as React from "react"
2
- import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar"
3
-
4
- import { cn } from "../../lib/utils"
5
-
6
- function Avatar({
7
- className,
8
- size = "default",
9
- ...props
10
- }: AvatarPrimitive.Root.Props & {
11
- size?: "default" | "sm" | "lg"
12
- }) {
13
- return (
14
- <AvatarPrimitive.Root
15
- data-slot="avatar"
16
- data-size={size}
17
- className={cn(
18
- "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
19
- className
20
- )}
21
- {...props}
22
- />
23
- )
24
- }
25
-
26
- function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
27
- return (
28
- <AvatarPrimitive.Image
29
- data-slot="avatar-image"
30
- className={cn(
31
- "aspect-square size-full rounded-full object-cover",
32
- className
33
- )}
34
- {...props}
35
- />
36
- )
37
- }
38
-
39
- function AvatarFallback({
40
- className,
41
- ...props
42
- }: AvatarPrimitive.Fallback.Props) {
43
- return (
44
- <AvatarPrimitive.Fallback
45
- data-slot="avatar-fallback"
46
- className={cn(
47
- "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
48
- className
49
- )}
50
- {...props}
51
- />
52
- )
53
- }
54
-
55
- function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
56
- return (
57
- <span
58
- data-slot="avatar-badge"
59
- className={cn(
60
- "absolute end-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
61
- "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
62
- "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
63
- "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
64
- className
65
- )}
66
- {...props}
67
- />
68
- )
69
- }
70
-
71
- function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
72
- return (
73
- <div
74
- data-slot="avatar-group"
75
- className={cn(
76
- "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
77
- className
78
- )}
79
- {...props}
80
- />
81
- )
82
- }
83
-
84
- function AvatarGroupCount({
85
- className,
86
- ...props
87
- }: React.ComponentProps<"div">) {
88
- return (
89
- <div
90
- data-slot="avatar-group-count"
91
- className={cn(
92
- "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
93
- className
94
- )}
95
- {...props}
96
- />
97
- )
98
- }
99
-
100
- export {
101
- Avatar,
102
- AvatarImage,
103
- AvatarFallback,
104
- AvatarGroup,
105
- AvatarGroupCount,
106
- AvatarBadge,
107
- }
@@ -1 +0,0 @@
1
- export * from "./avatar"
@@ -1,52 +0,0 @@
1
- import { mergeProps } from "@base-ui/react/merge-props"
2
- import { useRender } from "@base-ui/react/use-render"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "../../lib/utils"
6
-
7
- const badgeVariants = cva(
8
- "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
13
- secondary:
14
- "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
15
- destructive:
16
- "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
17
- outline:
18
- "border-border bg-input/30 text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
19
- ghost:
20
- "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
21
- link: "text-primary underline-offset-4 hover:underline",
22
- },
23
- },
24
- defaultVariants: {
25
- variant: "default",
26
- },
27
- }
28
- )
29
-
30
- function Badge({
31
- className,
32
- variant = "default",
33
- render,
34
- ...props
35
- }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
36
- return useRender({
37
- defaultTagName: "span",
38
- props: mergeProps<"span">(
39
- {
40
- className: cn(badgeVariants({ variant }), className),
41
- },
42
- props
43
- ),
44
- render,
45
- state: {
46
- slot: "badge",
47
- variant,
48
- },
49
- })
50
- }
51
-
52
- export { Badge, badgeVariants }
@@ -1 +0,0 @@
1
- export * from "./badge"
@@ -1,122 +0,0 @@
1
- import * as React from "react"
2
- import { mergeProps } from "@base-ui/react/merge-props"
3
- import { useRender } from "@base-ui/react/use-render"
4
-
5
- import { cn } from "../../lib/utils"
6
- import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
7
-
8
- function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
9
- return (
10
- <nav
11
- aria-label="breadcrumb"
12
- data-slot="breadcrumb"
13
- className={cn(className)}
14
- {...props}
15
- />
16
- )
17
- }
18
-
19
- function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
20
- return (
21
- <ol
22
- data-slot="breadcrumb-list"
23
- className={cn(
24
- "flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5",
25
- className
26
- )}
27
- {...props}
28
- />
29
- )
30
- }
31
-
32
- function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
33
- return (
34
- <li
35
- data-slot="breadcrumb-item"
36
- className={cn("inline-flex items-center gap-1.5", className)}
37
- {...props}
38
- />
39
- )
40
- }
41
-
42
- function BreadcrumbLink({
43
- className,
44
- render,
45
- ...props
46
- }: useRender.ComponentProps<"a">) {
47
- return useRender({
48
- defaultTagName: "a",
49
- props: mergeProps<"a">(
50
- {
51
- className: cn("transition-colors hover:text-foreground", className),
52
- },
53
- props
54
- ),
55
- render,
56
- state: {
57
- slot: "breadcrumb-link",
58
- },
59
- })
60
- }
61
-
62
- function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
63
- return (
64
- <span
65
- data-slot="breadcrumb-page"
66
- role="link"
67
- aria-disabled="true"
68
- aria-current="page"
69
- className={cn("font-normal text-foreground", className)}
70
- {...props}
71
- />
72
- )
73
- }
74
-
75
- function BreadcrumbSeparator({
76
- children,
77
- className,
78
- ...props
79
- }: React.ComponentProps<"li">) {
80
- return (
81
- <li
82
- data-slot="breadcrumb-separator"
83
- role="presentation"
84
- aria-hidden="true"
85
- className={cn("[&>svg]:size-3.5", className)}
86
- {...props}
87
- >
88
- {children ?? <ChevronRightIcon className="rtl:rotate-180" />}
89
- </li>
90
- )
91
- }
92
-
93
- function BreadcrumbEllipsis({
94
- className,
95
- ...props
96
- }: React.ComponentProps<"span">) {
97
- return (
98
- <span
99
- data-slot="breadcrumb-ellipsis"
100
- role="presentation"
101
- aria-hidden="true"
102
- className={cn(
103
- "flex size-5 items-center justify-center [&>svg]:size-4",
104
- className
105
- )}
106
- {...props}
107
- >
108
- <MoreHorizontalIcon />
109
- <span className="sr-only">More</span>
110
- </span>
111
- )
112
- }
113
-
114
- export {
115
- Breadcrumb,
116
- BreadcrumbList,
117
- BreadcrumbItem,
118
- BreadcrumbLink,
119
- BreadcrumbPage,
120
- BreadcrumbSeparator,
121
- BreadcrumbEllipsis,
122
- }
@@ -1 +0,0 @@
1
- export * from "./breadcrumb"
@@ -1,255 +0,0 @@
1
- ---
2
- title: Button
3
- description: Triggers an action or event when activated.
4
- ---
5
-
6
- import { Meta, Canvas, Controls } from '@storybook/blocks';
7
- import * as ButtonStories from './button.stories';
8
- import { Button, buttonVariants } from './button';
9
- import { Spinner } from '../spinner';
10
- import { ButtonGroup } from '../button-group';
11
- import { MailIcon, ArrowRightIcon, PlusIcon } from 'lucide-react';
12
-
13
- <Meta of={ButtonStories} />
14
-
15
- # Button
16
-
17
- Triggers an action or event when activated. Use buttons for form submissions, confirmations, and primary user actions.
18
-
19
- ## Usage
20
-
21
- ```tsx
22
- import { Button } from "@enya-learning/nova/components/button";
23
- ```
24
-
25
- ```tsx
26
- <Button variant="outline">Button</Button>
27
- ```
28
-
29
- ## Examples
30
-
31
- ### Variants
32
-
33
- Seven visual variants for different levels of emphasis.
34
-
35
- <div className="my-4 flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/30 p-8">
36
- <Button variant="default">Default</Button>
37
- <Button variant="accent">Accent</Button>
38
- <Button variant="outline">Outline</Button>
39
- <Button variant="secondary">Secondary</Button>
40
- <Button variant="ghost">Ghost</Button>
41
- <Button variant="destructive">Destructive</Button>
42
- <Button variant="link">Link</Button>
43
- </div>
44
-
45
- <Canvas of={ButtonStories.AllVariants} />
46
-
47
- ### Default
48
-
49
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
50
- <Button>Button</Button>
51
- </div>
52
-
53
- <Canvas of={ButtonStories.Default} />
54
-
55
- ### Accent
56
-
57
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
58
- <Button variant="accent">Button</Button>
59
- </div>
60
-
61
- <Canvas of={ButtonStories.Accent} />
62
-
63
- ### Outline
64
-
65
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
66
- <Button variant="outline">Button</Button>
67
- </div>
68
-
69
- <Canvas of={ButtonStories.Outline} />
70
-
71
- ### Secondary
72
-
73
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
74
- <Button variant="secondary">Button</Button>
75
- </div>
76
-
77
- <Canvas of={ButtonStories.Secondary} />
78
-
79
- ### Ghost
80
-
81
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
82
- <Button variant="ghost">Button</Button>
83
- </div>
84
-
85
- <Canvas of={ButtonStories.Ghost} />
86
-
87
- ### Destructive
88
-
89
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
90
- <Button variant="destructive">Button</Button>
91
- </div>
92
-
93
- <Canvas of={ButtonStories.Destructive} />
94
-
95
- ### Link
96
-
97
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
98
- <Button variant="link">Button</Button>
99
- </div>
100
-
101
- <Canvas of={ButtonStories.Link} />
102
-
103
- ### Size
104
-
105
- Use the `size` prop to change the size of the button.
106
-
107
- <div className="my-4 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-muted/30 p-8">
108
- <Button size="xs">Extra Small</Button>
109
- <Button size="sm">Small</Button>
110
- <Button size="default">Default</Button>
111
- <Button size="lg">Large</Button>
112
- <Button size="xl">Extra Large</Button>
113
- </div>
114
-
115
- <Canvas of={ButtonStories.AllSizes} />
116
-
117
- ### Icon
118
-
119
- Use `size="icon"` for square icon-only buttons. Always include an accessible `aria-label`.
120
-
121
- ```tsx
122
- <Button size="icon" aria-label="Add">
123
- <PlusIcon />
124
- </Button>
125
- ```
126
-
127
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
128
- <Button size="icon" aria-label="Add">
129
- <PlusIcon />
130
- </Button>
131
- </div>
132
-
133
- <Canvas of={ButtonStories.Icon} />
134
-
135
- ### With Icon
136
-
137
- Add `data-icon="inline-start"` or `data-icon="inline-end"` to the icon for correct spacing.
138
-
139
- ```tsx
140
- <Button>
141
- <MailIcon data-icon="inline-start" />
142
- Send email
143
- </Button>
144
-
145
- <Button>
146
- Continue
147
- <ArrowRightIcon data-icon="inline-end" />
148
- </Button>
149
- ```
150
-
151
- <div className="my-4 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-muted/30 p-8">
152
- <Button><MailIcon data-icon="inline-start" /> Send email</Button>
153
- <Button>Continue <ArrowRightIcon data-icon="inline-end" /></Button>
154
- </div>
155
-
156
- <Canvas of={ButtonStories.WithIconStart} />
157
-
158
- <Canvas of={ButtonStories.WithIconEnd} />
159
-
160
- ### Rounded
161
-
162
- Add `className="rounded-full"` to make the button fully rounded.
163
-
164
- ```tsx
165
- <Button className="rounded-full">Rounded</Button>
166
- ```
167
-
168
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
169
- <Button className="rounded-full">Button</Button>
170
- </div>
171
-
172
- <Canvas of={ButtonStories.Rounded} />
173
-
174
- ### Spinner
175
-
176
- Render a `<Spinner />` inside the button to show a loading state. Add `data-icon="inline-start"` or `data-icon="inline-end"` for correct spacing.
177
-
178
- ```tsx
179
- <Button disabled>
180
- <Spinner data-icon="inline-start" />
181
- Processing
182
- </Button>
183
- ```
184
-
185
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
186
- <Button disabled><Spinner data-icon="inline-start" /> Processing</Button>
187
- </div>
188
-
189
- <Canvas of={ButtonStories.WithSpinner} />
190
-
191
- ### Disabled
192
-
193
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
194
- <Button disabled>Button</Button>
195
- </div>
196
-
197
- <Canvas of={ButtonStories.Disabled} />
198
-
199
- ### Button Group
200
-
201
- To create a button group, use the `ButtonGroup` component. See the [Button Group](?path=/docs/components-button-group--docs) story for details.
202
-
203
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
204
- <ButtonGroup>
205
- <Button variant="outline">Back</Button>
206
- <Button variant="outline">Cancel</Button>
207
- <Button>Save</Button>
208
- </ButtonGroup>
209
- </div>
210
-
211
- <Canvas of={ButtonStories.ButtonGroupDemo} />
212
-
213
- ### As Link
214
-
215
- Use the `buttonVariants` helper to style any element as a button. This is the correct approach for links — **do not** use `<Button render={<a />} />` because Base UI always applies `role="button"`, which overrides the semantic link role on `<a>` elements.
216
-
217
- ```tsx
218
- import { buttonVariants } from "@enya-learning/nova/components/button";
219
-
220
- <a href="/dashboard" className={buttonVariants({ variant: "default" })}>
221
- Go to Dashboard
222
- </a>
223
- ```
224
-
225
- <div className="my-4 flex items-center justify-center rounded-xl border border-border bg-muted/30 p-8">
226
- <a href="#" className={buttonVariants({ variant: "default" })}>Link as Button</a>
227
- </div>
228
-
229
- <Canvas of={ButtonStories.AsLink} />
230
-
231
- ## API Reference
232
-
233
- ### Button
234
-
235
- | Prop | Type | Default |
236
- |------|------|---------|
237
- | `variant` | `"default" \| "accent" \| "outline" \| "secondary" \| "ghost" \| "destructive" \| "link"` | `"default"` |
238
- | `size` | `"default" \| "xs" \| "sm" \| "lg" \| "xl" \| "icon" \| "icon-xs" \| "icon-sm" \| "icon-lg" \| "icon-xl"` | `"default"` |
239
- | `disabled` | `boolean` | `false` |
240
- | `className` | `string` | — |
241
- | `children` | `React.ReactNode` | — |
242
-
243
- All other props are forwarded to the underlying [Base UI Button](https://base-ui.com/components/button) element.
244
-
245
- ### buttonVariants
246
-
247
- ```tsx
248
- import { buttonVariants } from "@enya-learning/nova/components/button";
249
-
250
- buttonVariants({ variant?: ButtonVariant, size?: ButtonSize }): string
251
- ```
252
-
253
- Returns the computed class string for the given variant and size. Use this to style non-`<button>` elements (e.g. `<a>`, `<Link>`) with button appearance.
254
-
255
- <Controls of={ButtonStories.Default} />
@@ -1,59 +0,0 @@
1
- import { Button as ButtonPrimitive } from "@base-ui/react/button"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
-
4
- import { cn } from "../../lib/utils"
5
-
6
- const buttonVariants = cva(
7
- "group/button inline-flex shrink-0 items-center justify-center rounded-4xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all duration-150 outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
8
- {
9
- variants: {
10
- variant: {
11
- accent: "bg-accent text-primary-foreground hover:bg-accent/80",
12
- default: "bg-foreground text-primary-foreground hover:bg-foreground/80",
13
- outline:
14
- "border-border bg-nova-white hover:bg-input/30 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
15
- secondary:
16
- "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
17
- ghost:
18
- "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
19
- destructive:
20
- "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
21
- link: "text-primary underline-offset-4 hover:underline",
22
- },
23
- size: {
24
- default:
25
- "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pe-2.5 has-data-[icon=inline-start]:ps-2.5",
26
- xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2 [&_svg:not([class*='size-'])]:size-3",
27
- sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",
28
- lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3",
29
- xl: "h-15 gap-2 rounded-full px-5 text-2xl has-data-[icon=inline-end]:pe-4 has-data-[icon=inline-start]:ps-4",
30
- icon: "size-9",
31
- "icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
32
- "icon-sm": "size-8",
33
- "icon-lg": "size-10",
34
- "icon-xl": "size-12",
35
- },
36
- },
37
- defaultVariants: {
38
- variant: "default",
39
- size: "default",
40
- },
41
- }
42
- )
43
-
44
- function Button({
45
- className,
46
- variant = "default",
47
- size = "default",
48
- ...props
49
- }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
50
- return (
51
- <ButtonPrimitive
52
- data-slot="button"
53
- className={cn(buttonVariants({ variant, size, className }))}
54
- {...props}
55
- />
56
- )
57
- }
58
-
59
- export { Button, buttonVariants }
@@ -1 +0,0 @@
1
- export * from "./button"
@@ -1,87 +0,0 @@
1
- import { mergeProps } from "@base-ui/react/merge-props"
2
- import { useRender } from "@base-ui/react/use-render"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "../../lib/utils"
6
- import { Separator } from "../separator"
7
-
8
- const buttonGroupVariants = cva(
9
- "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-e-4xl [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
10
- {
11
- variants: {
12
- orientation: {
13
- horizontal:
14
- "*:data-slot:rounded-e-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-e-4xl! [&>[data-slot]~[data-slot]]:rounded-s-none [&>[data-slot]~[data-slot]]:border-s-0",
15
- vertical:
16
- "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-4xl! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
17
- },
18
- },
19
- defaultVariants: {
20
- orientation: "horizontal",
21
- },
22
- }
23
- )
24
-
25
- function ButtonGroup({
26
- className,
27
- orientation,
28
- ...props
29
- }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
30
- return (
31
- <div
32
- role="group"
33
- data-slot="button-group"
34
- data-orientation={orientation}
35
- className={cn(buttonGroupVariants({ orientation }), className)}
36
- {...props}
37
- />
38
- )
39
- }
40
-
41
- function ButtonGroupText({
42
- className,
43
- render,
44
- ...props
45
- }: useRender.ComponentProps<"div">) {
46
- return useRender({
47
- defaultTagName: "div",
48
- props: mergeProps<"div">(
49
- {
50
- className: cn(
51
- "flex items-center gap-2 rounded-4xl border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
52
- className
53
- ),
54
- },
55
- props
56
- ),
57
- render,
58
- state: {
59
- slot: "button-group-text",
60
- },
61
- })
62
- }
63
-
64
- function ButtonGroupSeparator({
65
- className,
66
- orientation = "vertical",
67
- ...props
68
- }: React.ComponentProps<typeof Separator>) {
69
- return (
70
- <Separator
71
- data-slot="button-group-separator"
72
- orientation={orientation}
73
- className={cn(
74
- "relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
75
- className
76
- )}
77
- {...props}
78
- />
79
- )
80
- }
81
-
82
- export {
83
- ButtonGroup,
84
- ButtonGroupSeparator,
85
- ButtonGroupText,
86
- buttonGroupVariants,
87
- }