@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,371 +0,0 @@
1
- import * as React from "react"
2
- import * as RechartsPrimitive from "recharts"
3
- import type { TooltipValueType } from "recharts"
4
-
5
- import { cn } from "../../lib/utils"
6
-
7
- // Format: { THEME_NAME: CSS_SELECTOR }
8
- const THEMES = { light: "", dark: ".dark" } as const
9
-
10
- const INITIAL_DIMENSION = { width: 320, height: 200 } as const
11
- type TooltipNameType = number | string
12
-
13
- export type ChartConfig = Record<
14
- string,
15
- {
16
- label?: React.ReactNode
17
- icon?: React.ComponentType
18
- } & (
19
- | { color?: string; theme?: never }
20
- | { color?: never; theme: Record<keyof typeof THEMES, string> }
21
- )
22
- >
23
-
24
- type ChartContextProps = {
25
- config: ChartConfig
26
- }
27
-
28
- const ChartContext = React.createContext<ChartContextProps | null>(null)
29
-
30
- function useChart() {
31
- const context = React.useContext(ChartContext)
32
-
33
- if (!context) {
34
- throw new Error("useChart must be used within a <ChartContainer />")
35
- }
36
-
37
- return context
38
- }
39
-
40
- function ChartContainer({
41
- id,
42
- className,
43
- children,
44
- config,
45
- initialDimension = INITIAL_DIMENSION,
46
- ...props
47
- }: React.ComponentProps<"div"> & {
48
- config: ChartConfig
49
- children: React.ComponentProps<
50
- typeof RechartsPrimitive.ResponsiveContainer
51
- >["children"]
52
- initialDimension?: {
53
- width: number
54
- height: number
55
- }
56
- }) {
57
- const uniqueId = React.useId()
58
- const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
59
-
60
- return (
61
- <ChartContext.Provider value={{ config }}>
62
- <div
63
- data-slot="chart"
64
- data-chart={chartId}
65
- className={cn(
66
- "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
67
- className
68
- )}
69
- {...props}
70
- >
71
- <ChartStyle id={chartId} config={config} />
72
- <RechartsPrimitive.ResponsiveContainer
73
- initialDimension={initialDimension}
74
- >
75
- {children}
76
- </RechartsPrimitive.ResponsiveContainer>
77
- </div>
78
- </ChartContext.Provider>
79
- )
80
- }
81
-
82
- const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
83
- const colorConfig = Object.entries(config).filter(
84
- ([, config]) => config.theme ?? config.color
85
- )
86
-
87
- if (!colorConfig.length) {
88
- return null
89
- }
90
-
91
- return (
92
- <style
93
- dangerouslySetInnerHTML={{
94
- __html: Object.entries(THEMES)
95
- .map(
96
- ([theme, prefix]) => `
97
- ${prefix} [data-chart=${id}] {
98
- ${colorConfig
99
- .map(([key, itemConfig]) => {
100
- const color =
101
- itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??
102
- itemConfig.color
103
- return color ? ` --color-${key}: ${color};` : null
104
- })
105
- .join("\n")}
106
- }
107
- `
108
- )
109
- .join("\n"),
110
- }}
111
- />
112
- )
113
- }
114
-
115
- const ChartTooltip = RechartsPrimitive.Tooltip
116
-
117
- function ChartTooltipContent({
118
- active,
119
- payload,
120
- className,
121
- indicator = "dot",
122
- hideLabel = false,
123
- hideIndicator = false,
124
- label,
125
- labelFormatter,
126
- labelClassName,
127
- formatter,
128
- color,
129
- nameKey,
130
- labelKey,
131
- }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
132
- React.ComponentProps<"div"> & {
133
- hideLabel?: boolean
134
- hideIndicator?: boolean
135
- indicator?: "line" | "dot" | "dashed"
136
- nameKey?: string
137
- labelKey?: string
138
- } & Omit<
139
- RechartsPrimitive.DefaultTooltipContentProps<
140
- TooltipValueType,
141
- TooltipNameType
142
- >,
143
- "accessibilityLayer"
144
- >) {
145
- const { config } = useChart()
146
-
147
- const tooltipLabel = React.useMemo(() => {
148
- if (hideLabel || !payload?.length) {
149
- return null
150
- }
151
-
152
- const [item] = payload
153
- const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`
154
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
155
- const value =
156
- !labelKey && typeof label === "string"
157
- ? (config[label]?.label ?? label)
158
- : itemConfig?.label
159
-
160
- if (labelFormatter) {
161
- return (
162
- <div className={cn("font-medium", labelClassName)}>
163
- {labelFormatter(value, payload)}
164
- </div>
165
- )
166
- }
167
-
168
- if (!value) {
169
- return null
170
- }
171
-
172
- return <div className={cn("font-medium", labelClassName)}>{value}</div>
173
- }, [
174
- label,
175
- labelFormatter,
176
- payload,
177
- hideLabel,
178
- labelClassName,
179
- config,
180
- labelKey,
181
- ])
182
-
183
- if (!active || !payload?.length) {
184
- return null
185
- }
186
-
187
- const nestLabel = payload.length === 1 && indicator !== "dot"
188
-
189
- return (
190
- <div
191
- className={cn(
192
- "grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
193
- className
194
- )}
195
- >
196
- {!nestLabel ? tooltipLabel : null}
197
- <div className="grid gap-1.5">
198
- {payload
199
- .filter((item) => item.type !== "none")
200
- .map((item, index) => {
201
- const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`
202
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
203
- const indicatorColor = color ?? item.payload?.fill ?? item.color
204
-
205
- return (
206
- <div
207
- key={index}
208
- className={cn(
209
- "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
210
- indicator === "dot" && "items-center"
211
- )}
212
- >
213
- {formatter && item?.value !== undefined && item.name ? (
214
- formatter(item.value, item.name, item, index, item.payload)
215
- ) : (
216
- <>
217
- {itemConfig?.icon ? (
218
- <itemConfig.icon />
219
- ) : (
220
- !hideIndicator && (
221
- <div
222
- className={cn(
223
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
224
- {
225
- "h-2.5 w-2.5": indicator === "dot",
226
- "w-1": indicator === "line",
227
- "w-0 border-[1.5px] border-dashed bg-transparent":
228
- indicator === "dashed",
229
- "my-0.5": nestLabel && indicator === "dashed",
230
- }
231
- )}
232
- style={
233
- {
234
- "--color-bg": indicatorColor,
235
- "--color-border": indicatorColor,
236
- } as React.CSSProperties
237
- }
238
- />
239
- )
240
- )}
241
- <div
242
- className={cn(
243
- "flex flex-1 justify-between leading-none",
244
- nestLabel ? "items-end" : "items-center"
245
- )}
246
- >
247
- <div className="grid gap-1.5">
248
- {nestLabel ? tooltipLabel : null}
249
- <span className="text-muted-foreground">
250
- {itemConfig?.label ?? item.name}
251
- </span>
252
- </div>
253
- {item.value != null && (
254
- <span className="font-mono font-medium text-foreground tabular-nums">
255
- {typeof item.value === "number"
256
- ? item.value.toLocaleString()
257
- : String(item.value)}
258
- </span>
259
- )}
260
- </div>
261
- </>
262
- )}
263
- </div>
264
- )
265
- })}
266
- </div>
267
- </div>
268
- )
269
- }
270
-
271
- const ChartLegend = RechartsPrimitive.Legend
272
-
273
- function ChartLegendContent({
274
- className,
275
- hideIcon = false,
276
- payload,
277
- verticalAlign = "bottom",
278
- nameKey,
279
- }: React.ComponentProps<"div"> & {
280
- hideIcon?: boolean
281
- nameKey?: string
282
- } & RechartsPrimitive.DefaultLegendContentProps) {
283
- const { config } = useChart()
284
-
285
- if (!payload?.length) {
286
- return null
287
- }
288
-
289
- return (
290
- <div
291
- className={cn(
292
- "flex items-center justify-center gap-4",
293
- verticalAlign === "top" ? "pb-3" : "pt-3",
294
- className
295
- )}
296
- >
297
- {payload
298
- .filter((item) => item.type !== "none")
299
- .map((item, index) => {
300
- const key = `${nameKey ?? item.dataKey ?? "value"}`
301
- const itemConfig = getPayloadConfigFromPayload(config, item, key)
302
-
303
- return (
304
- <div
305
- key={index}
306
- className={cn(
307
- "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
308
- )}
309
- >
310
- {itemConfig?.icon && !hideIcon ? (
311
- <itemConfig.icon />
312
- ) : (
313
- <div
314
- className="h-2 w-2 shrink-0 rounded-[2px]"
315
- style={{
316
- backgroundColor: item.color,
317
- }}
318
- />
319
- )}
320
- {itemConfig?.label}
321
- </div>
322
- )
323
- })}
324
- </div>
325
- )
326
- }
327
-
328
- function getPayloadConfigFromPayload(
329
- config: ChartConfig,
330
- payload: unknown,
331
- key: string
332
- ) {
333
- if (typeof payload !== "object" || payload === null) {
334
- return undefined
335
- }
336
-
337
- const payloadPayload =
338
- "payload" in payload &&
339
- typeof payload.payload === "object" &&
340
- payload.payload !== null
341
- ? payload.payload
342
- : undefined
343
-
344
- let configLabelKey: string = key
345
-
346
- if (
347
- key in payload &&
348
- typeof payload[key as keyof typeof payload] === "string"
349
- ) {
350
- configLabelKey = payload[key as keyof typeof payload] as string
351
- } else if (
352
- payloadPayload &&
353
- key in payloadPayload &&
354
- typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
355
- ) {
356
- configLabelKey = payloadPayload[
357
- key as keyof typeof payloadPayload
358
- ] as string
359
- }
360
-
361
- return configLabelKey in config ? config[configLabelKey] : config[key]
362
- }
363
-
364
- export {
365
- ChartContainer,
366
- ChartTooltip,
367
- ChartTooltipContent,
368
- ChartLegend,
369
- ChartLegendContent,
370
- ChartStyle,
371
- }
@@ -1 +0,0 @@
1
- export * from "./chart"
@@ -1,28 +0,0 @@
1
- "use client"
2
-
3
- import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
4
-
5
- import { cn } from "../../lib/utils"
6
- import { CheckIcon } from "lucide-react"
7
-
8
- function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
9
- return (
10
- <CheckboxPrimitive.Root
11
- data-slot="checkbox"
12
- className={cn(
13
- "peer relative flex size-4 shrink-0 items-center justify-center rounded-[6px] border border-input transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
14
- className
15
- )}
16
- {...props}
17
- >
18
- <CheckboxPrimitive.Indicator
19
- data-slot="checkbox-indicator"
20
- className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
21
- >
22
- <CheckIcon />
23
- </CheckboxPrimitive.Indicator>
24
- </CheckboxPrimitive.Root>
25
- )
26
- }
27
-
28
- export { Checkbox }
@@ -1 +0,0 @@
1
- export * from "./checkbox"
@@ -1,19 +0,0 @@
1
- import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
2
-
3
- function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
4
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
5
- }
6
-
7
- function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
8
- return (
9
- <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
10
- )
11
- }
12
-
13
- function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
14
- return (
15
- <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
16
- )
17
- }
18
-
19
- export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -1 +0,0 @@
1
- export * from "./collapsible"