@mzc-fe/design-system 0.0.1 → 0.0.2-rc.0

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 (219) hide show
  1. package/dist/components/accordion.d.ts +7 -0
  2. package/dist/components/alert-dialog.d.ts +14 -0
  3. package/dist/components/alert.d.ts +9 -0
  4. package/dist/components/aspect-ratio.d.ts +3 -0
  5. package/dist/components/avatar.d.ts +6 -0
  6. package/dist/components/badge.d.ts +9 -0
  7. package/dist/components/breadcrumb.d.ts +11 -0
  8. package/dist/components/button-group.d.ts +11 -0
  9. package/dist/components/button.d.ts +10 -0
  10. package/dist/components/calendar.d.ts +8 -0
  11. package/dist/components/card.d.ts +9 -0
  12. package/dist/components/carousel.d.ts +19 -0
  13. package/dist/components/chart.d.ts +40 -0
  14. package/dist/components/checkbox.d.ts +4 -0
  15. package/dist/components/collapsible.d.ts +5 -0
  16. package/dist/components/command.d.ts +18 -0
  17. package/dist/components/context-menu.d.ts +25 -0
  18. package/dist/components/dialog.d.ts +15 -0
  19. package/dist/components/drawer.d.ts +13 -0
  20. package/dist/components/dropdown-menu.d.ts +25 -0
  21. package/dist/components/empty.d.ts +11 -0
  22. package/dist/components/field.d.ts +24 -0
  23. package/dist/components/form.d.ts +24 -0
  24. package/dist/components/hover-card.d.ts +6 -0
  25. package/dist/components/input-group.d.ts +16 -0
  26. package/dist/components/input-otp.d.ts +11 -0
  27. package/dist/components/input.d.ts +3 -0
  28. package/dist/components/item.d.ts +23 -0
  29. package/dist/components/kbd.d.ts +3 -0
  30. package/dist/components/label.d.ts +4 -0
  31. package/dist/components/menubar.d.ts +26 -0
  32. package/dist/components/navigation-menu.d.ts +14 -0
  33. package/dist/components/pagination.d.ts +13 -0
  34. package/dist/components/popover.d.ts +7 -0
  35. package/dist/components/progress.d.ts +4 -0
  36. package/dist/components/radio-group.d.ts +5 -0
  37. package/dist/components/resizable.d.ts +8 -0
  38. package/dist/components/scroll-area.d.ts +5 -0
  39. package/dist/components/select.d.ts +15 -0
  40. package/dist/components/separator.d.ts +4 -0
  41. package/dist/components/sheet.d.ts +13 -0
  42. package/dist/components/sidebar.d.ts +69 -0
  43. package/dist/components/skeleton.d.ts +2 -0
  44. package/dist/components/slider.d.ts +4 -0
  45. package/dist/components/sonner.d.ts +3 -0
  46. package/dist/components/spinner.d.ts +2 -0
  47. package/dist/components/switch.d.ts +4 -0
  48. package/dist/components/table.d.ts +10 -0
  49. package/dist/components/tabs.d.ts +7 -0
  50. package/dist/components/textarea.d.ts +3 -0
  51. package/dist/components/toggle-group.d.ts +9 -0
  52. package/dist/components/toggle.d.ts +9 -0
  53. package/dist/components/tooltip.d.ts +7 -0
  54. package/dist/design-system.css +1 -0
  55. package/dist/design-system.es.js +30200 -0
  56. package/dist/design-system.umd.js +260 -0
  57. package/dist/foundations/ThemeProvider.d.ts +13 -0
  58. package/dist/hooks/use-mobile.d.ts +1 -0
  59. package/dist/index.d.ts +54 -0
  60. package/dist/lib/utils.d.ts +2 -0
  61. package/package.json +14 -1
  62. package/.husky/pre-push +0 -21
  63. package/.storybook/main.ts +0 -11
  64. package/.storybook/preview.tsx +0 -30
  65. package/.vscode/settings.json +0 -12
  66. package/.vscode/tailwind.json +0 -105
  67. package/bitbucket-pipelines.yml +0 -50
  68. package/components.json +0 -21
  69. package/eslint.config.js +0 -38
  70. package/src/components/accordion.stories.tsx +0 -258
  71. package/src/components/accordion.test.tsx +0 -390
  72. package/src/components/accordion.tsx +0 -64
  73. package/src/components/alert-dialog.stories.tsx +0 -213
  74. package/src/components/alert-dialog.test.tsx +0 -80
  75. package/src/components/alert-dialog.tsx +0 -155
  76. package/src/components/alert.stories.tsx +0 -84
  77. package/src/components/alert.test.tsx +0 -35
  78. package/src/components/alert.tsx +0 -66
  79. package/src/components/aspect-ratio.stories.tsx +0 -97
  80. package/src/components/aspect-ratio.test.tsx +0 -47
  81. package/src/components/aspect-ratio.tsx +0 -11
  82. package/src/components/avatar.stories.tsx +0 -76
  83. package/src/components/avatar.test.tsx +0 -50
  84. package/src/components/avatar.tsx +0 -51
  85. package/src/components/badge.stories.tsx +0 -64
  86. package/src/components/badge.test.tsx +0 -34
  87. package/src/components/badge.tsx +0 -46
  88. package/src/components/breadcrumb.stories.tsx +0 -86
  89. package/src/components/breadcrumb.test.tsx +0 -74
  90. package/src/components/breadcrumb.tsx +0 -109
  91. package/src/components/button-group.stories.tsx +0 -62
  92. package/src/components/button-group.tsx +0 -83
  93. package/src/components/button.stories.tsx +0 -118
  94. package/src/components/button.test.tsx +0 -64
  95. package/src/components/button.tsx +0 -62
  96. package/src/components/calendar.stories.tsx +0 -81
  97. package/src/components/calendar.tsx +0 -220
  98. package/src/components/card.stories.tsx +0 -110
  99. package/src/components/card.test.tsx +0 -56
  100. package/src/components/card.tsx +0 -92
  101. package/src/components/carousel.stories.tsx +0 -90
  102. package/src/components/carousel.tsx +0 -239
  103. package/src/components/chart.tsx +0 -357
  104. package/src/components/checkbox.stories.tsx +0 -108
  105. package/src/components/checkbox.test.tsx +0 -67
  106. package/src/components/checkbox.tsx +0 -32
  107. package/src/components/collapsible.stories.tsx +0 -106
  108. package/src/components/collapsible.test.tsx +0 -92
  109. package/src/components/collapsible.tsx +0 -31
  110. package/src/components/command.stories.tsx +0 -90
  111. package/src/components/command.tsx +0 -182
  112. package/src/components/context-menu.stories.tsx +0 -63
  113. package/src/components/context-menu.tsx +0 -252
  114. package/src/components/dialog.stories.tsx +0 -128
  115. package/src/components/dialog.tsx +0 -141
  116. package/src/components/drawer.stories.tsx +0 -104
  117. package/src/components/drawer.tsx +0 -135
  118. package/src/components/dropdown-menu.stories.tsx +0 -97
  119. package/src/components/dropdown-menu.tsx +0 -255
  120. package/src/components/empty.stories.tsx +0 -90
  121. package/src/components/empty.test.tsx +0 -55
  122. package/src/components/empty.tsx +0 -104
  123. package/src/components/field.tsx +0 -246
  124. package/src/components/form.tsx +0 -168
  125. package/src/components/hover-card.stories.tsx +0 -66
  126. package/src/components/hover-card.tsx +0 -44
  127. package/src/components/input-group.stories.tsx +0 -57
  128. package/src/components/input-group.test.tsx +0 -40
  129. package/src/components/input-group.tsx +0 -170
  130. package/src/components/input-otp.stories.tsx +0 -94
  131. package/src/components/input-otp.test.tsx +0 -60
  132. package/src/components/input-otp.tsx +0 -75
  133. package/src/components/input.stories.tsx +0 -94
  134. package/src/components/input.test.tsx +0 -53
  135. package/src/components/input.tsx +0 -21
  136. package/src/components/item.tsx +0 -193
  137. package/src/components/kbd.stories.tsx +0 -100
  138. package/src/components/kbd.test.tsx +0 -28
  139. package/src/components/kbd.tsx +0 -28
  140. package/src/components/label.stories.tsx +0 -48
  141. package/src/components/label.test.tsx +0 -28
  142. package/src/components/label.tsx +0 -24
  143. package/src/components/menubar.tsx +0 -274
  144. package/src/components/navigation-menu.tsx +0 -168
  145. package/src/components/pagination.stories.tsx +0 -107
  146. package/src/components/pagination.tsx +0 -127
  147. package/src/components/popover.stories.tsx +0 -102
  148. package/src/components/popover.tsx +0 -48
  149. package/src/components/progress.stories.tsx +0 -76
  150. package/src/components/progress.test.tsx +0 -36
  151. package/src/components/progress.tsx +0 -29
  152. package/src/components/radio-group.stories.tsx +0 -73
  153. package/src/components/radio-group.test.tsx +0 -74
  154. package/src/components/radio-group.tsx +0 -45
  155. package/src/components/resizable.stories.tsx +0 -120
  156. package/src/components/resizable.tsx +0 -54
  157. package/src/components/scroll-area.stories.tsx +0 -64
  158. package/src/components/scroll-area.test.tsx +0 -46
  159. package/src/components/scroll-area.tsx +0 -58
  160. package/src/components/select.stories.tsx +0 -111
  161. package/src/components/select.test.tsx +0 -90
  162. package/src/components/select.tsx +0 -188
  163. package/src/components/separator.stories.tsx +0 -76
  164. package/src/components/separator.test.tsx +0 -24
  165. package/src/components/separator.tsx +0 -28
  166. package/src/components/sheet.stories.tsx +0 -122
  167. package/src/components/sheet.tsx +0 -137
  168. package/src/components/sidebar.tsx +0 -726
  169. package/src/components/skeleton.stories.tsx +0 -53
  170. package/src/components/skeleton.test.tsx +0 -24
  171. package/src/components/skeleton.tsx +0 -13
  172. package/src/components/slider.stories.tsx +0 -97
  173. package/src/components/slider.test.tsx +0 -49
  174. package/src/components/slider.tsx +0 -63
  175. package/src/components/sonner.stories.tsx +0 -96
  176. package/src/components/sonner.tsx +0 -38
  177. package/src/components/spinner.stories.tsx +0 -54
  178. package/src/components/spinner.test.tsx +0 -30
  179. package/src/components/spinner.tsx +0 -16
  180. package/src/components/switch.stories.tsx +0 -108
  181. package/src/components/switch.test.tsx +0 -62
  182. package/src/components/switch.tsx +0 -31
  183. package/src/components/table.stories.tsx +0 -139
  184. package/src/components/table.test.tsx +0 -85
  185. package/src/components/table.tsx +0 -114
  186. package/src/components/tabs.stories.tsx +0 -99
  187. package/src/components/tabs.test.tsx +0 -64
  188. package/src/components/tabs.tsx +0 -66
  189. package/src/components/textarea.stories.tsx +0 -89
  190. package/src/components/textarea.test.tsx +0 -53
  191. package/src/components/textarea.tsx +0 -18
  192. package/src/components/toggle-group.stories.tsx +0 -108
  193. package/src/components/toggle-group.test.tsx +0 -66
  194. package/src/components/toggle-group.tsx +0 -81
  195. package/src/components/toggle.stories.tsx +0 -98
  196. package/src/components/toggle.test.tsx +0 -42
  197. package/src/components/toggle.tsx +0 -45
  198. package/src/components/tooltip.stories.tsx +0 -111
  199. package/src/components/tooltip.tsx +0 -61
  200. package/src/foundations/README.md +0 -141
  201. package/src/foundations/ThemeProvider.tsx +0 -77
  202. package/src/foundations/color.css +0 -232
  203. package/src/foundations/color.stories.tsx +0 -719
  204. package/src/foundations/palette.css +0 -249
  205. package/src/foundations/spacing.css +0 -8
  206. package/src/foundations/typography.css +0 -143
  207. package/src/foundations/typography.stories.tsx +0 -17
  208. package/src/hooks/use-mobile.ts +0 -19
  209. package/src/index.css +0 -176
  210. package/src/index.ts +0 -336
  211. package/src/lib/utils.ts +0 -6
  212. package/src/test/setup.ts +0 -8
  213. package/src/vite-env.d.ts +0 -1
  214. package/tsconfig.app.json +0 -33
  215. package/tsconfig.json +0 -13
  216. package/tsconfig.node.json +0 -25
  217. package/vite.config.ts +0 -30
  218. package/vitest.config.ts +0 -25
  219. /package/{public → dist}/vite.svg +0 -0
@@ -1,193 +0,0 @@
1
- import * as React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { cva, type VariantProps } from "class-variance-authority";
4
-
5
- import { cn } from "@/lib/utils";
6
- import { Separator } from "@/components/separator";
7
-
8
- function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
9
- return (
10
- <div
11
- role="list"
12
- data-slot="item-group"
13
- className={cn("group/item-group flex flex-col", className)}
14
- {...props}
15
- />
16
- );
17
- }
18
-
19
- function ItemSeparator({
20
- className,
21
- ...props
22
- }: React.ComponentProps<typeof Separator>) {
23
- return (
24
- <Separator
25
- data-slot="item-separator"
26
- orientation="horizontal"
27
- className={cn("my-0", className)}
28
- {...props}
29
- />
30
- );
31
- }
32
-
33
- const itemVariants = cva(
34
- "group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
35
- {
36
- variants: {
37
- variant: {
38
- default: "bg-transparent",
39
- outline: "border-border",
40
- muted: "bg-muted/50",
41
- },
42
- size: {
43
- default: "p-4 gap-4 ",
44
- sm: "py-3 px-4 gap-2.5",
45
- },
46
- },
47
- defaultVariants: {
48
- variant: "default",
49
- size: "default",
50
- },
51
- }
52
- );
53
-
54
- function Item({
55
- className,
56
- variant = "default",
57
- size = "default",
58
- asChild = false,
59
- ...props
60
- }: React.ComponentProps<"div"> &
61
- VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62
- const Comp = asChild ? Slot : "div";
63
- return (
64
- <Comp
65
- data-slot="item"
66
- data-variant={variant}
67
- data-size={size}
68
- className={cn(itemVariants({ variant, size, className }))}
69
- {...props}
70
- />
71
- );
72
- }
73
-
74
- const itemMediaVariants = cva(
75
- "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5",
76
- {
77
- variants: {
78
- variant: {
79
- default: "bg-transparent",
80
- icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
81
- image:
82
- "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover",
83
- },
84
- },
85
- defaultVariants: {
86
- variant: "default",
87
- },
88
- }
89
- );
90
-
91
- function ItemMedia({
92
- className,
93
- variant = "default",
94
- ...props
95
- }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
96
- return (
97
- <div
98
- data-slot="item-media"
99
- data-variant={variant}
100
- className={cn(itemMediaVariants({ variant, className }))}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
107
- return (
108
- <div
109
- data-slot="item-content"
110
- className={cn(
111
- "flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
112
- className
113
- )}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
120
- return (
121
- <div
122
- data-slot="item-title"
123
- className={cn(
124
- "flex w-fit items-center gap-2 text-sm leading-snug font-medium",
125
- className
126
- )}
127
- {...props}
128
- />
129
- );
130
- }
131
-
132
- function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
133
- return (
134
- <p
135
- data-slot="item-description"
136
- className={cn(
137
- "text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
138
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
139
- className
140
- )}
141
- {...props}
142
- />
143
- );
144
- }
145
-
146
- function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
147
- return (
148
- <div
149
- data-slot="item-actions"
150
- className={cn("flex items-center gap-2", className)}
151
- {...props}
152
- />
153
- );
154
- }
155
-
156
- function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
157
- return (
158
- <div
159
- data-slot="item-header"
160
- className={cn(
161
- "flex basis-full items-center justify-between gap-2",
162
- className
163
- )}
164
- {...props}
165
- />
166
- );
167
- }
168
-
169
- function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
170
- return (
171
- <div
172
- data-slot="item-footer"
173
- className={cn(
174
- "flex basis-full items-center justify-between gap-2",
175
- className
176
- )}
177
- {...props}
178
- />
179
- );
180
- }
181
-
182
- export {
183
- Item,
184
- ItemMedia,
185
- ItemContent,
186
- ItemActions,
187
- ItemGroup,
188
- ItemSeparator,
189
- ItemTitle,
190
- ItemDescription,
191
- ItemHeader,
192
- ItemFooter,
193
- };
@@ -1,100 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { Kbd, KbdGroup } from "./kbd";
3
-
4
- const meta = {
5
- title: "Components/Kbd",
6
- component: Kbd,
7
- parameters: {
8
- layout: "padded",
9
- },
10
- tags: ["autodocs"],
11
- } satisfies Meta<typeof Kbd>;
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof meta>;
15
-
16
- export const Default: Story = {
17
- render: () => (
18
- <div className="space-y-4">
19
- <div>
20
- Press <Kbd>⌘</Kbd> + <Kbd>K</Kbd> to open command menu
21
- </div>
22
- <div>
23
- Press <Kbd>Ctrl</Kbd> + <Kbd>Alt</Kbd> + <Kbd>Del</Kbd>
24
- </div>
25
- </div>
26
- ),
27
- };
28
-
29
- export const WithGroup: Story = {
30
- render: () => (
31
- <div className="space-y-4">
32
- <div>
33
- <KbdGroup>
34
- <Kbd>⌘</Kbd>
35
- <Kbd>K</Kbd>
36
- </KbdGroup>
37
- </div>
38
- <div>
39
- <KbdGroup>
40
- <Kbd>Ctrl</Kbd>
41
- <Kbd>Shift</Kbd>
42
- <Kbd>P</Kbd>
43
- </KbdGroup>
44
- </div>
45
- </div>
46
- ),
47
- };
48
-
49
- export const InText: Story = {
50
- render: () => (
51
- <div className="space-y-2 text-sm">
52
- <p>
53
- Use <Kbd>Tab</Kbd> to navigate through form fields.
54
- </p>
55
- <p>
56
- Press <Kbd>Enter</Kbd> to submit the form.
57
- </p>
58
- <p>
59
- Use <Kbd>Esc</Kbd> to close dialogs.
60
- </p>
61
- </div>
62
- ),
63
- };
64
-
65
- export const Shortcuts: Story = {
66
- render: () => (
67
- <div className="space-y-2">
68
- <div className="flex items-center justify-between">
69
- <span className="text-sm">Copy</span>
70
- <KbdGroup>
71
- <Kbd>⌘</Kbd>
72
- <Kbd>C</Kbd>
73
- </KbdGroup>
74
- </div>
75
- <div className="flex items-center justify-between">
76
- <span className="text-sm">Paste</span>
77
- <KbdGroup>
78
- <Kbd>⌘</Kbd>
79
- <Kbd>V</Kbd>
80
- </KbdGroup>
81
- </div>
82
- <div className="flex items-center justify-between">
83
- <span className="text-sm">Undo</span>
84
- <KbdGroup>
85
- <Kbd>⌘</Kbd>
86
- <Kbd>Z</Kbd>
87
- </KbdGroup>
88
- </div>
89
- <div className="flex items-center justify-between">
90
- <span className="text-sm">Redo</span>
91
- <KbdGroup>
92
- <Kbd>⌘</Kbd>
93
- <Kbd>Shift</Kbd>
94
- <Kbd>Z</Kbd>
95
- </KbdGroup>
96
- </div>
97
- </div>
98
- ),
99
- };
100
-
@@ -1,28 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import { Kbd, KbdGroup } from "./kbd";
4
-
5
- describe("Kbd", () => {
6
- it("should render kbd element", () => {
7
- const { container } = render(<Kbd>⌘</Kbd>);
8
- const kbd = container.querySelector('[data-slot="kbd"]');
9
- expect(kbd).toBeInTheDocument();
10
- });
11
-
12
- it("should render kbd with text", () => {
13
- const { getByText } = render(<Kbd>Ctrl</Kbd>);
14
- expect(getByText("Ctrl")).toBeInTheDocument();
15
- });
16
-
17
- it("should render kbd group", () => {
18
- const { container } = render(
19
- <KbdGroup>
20
- <Kbd>⌘</Kbd>
21
- <Kbd>K</Kbd>
22
- </KbdGroup>
23
- );
24
- const group = container.querySelector('[data-slot="kbd-group"]');
25
- expect(group).toBeInTheDocument();
26
- });
27
- });
28
-
@@ -1,28 +0,0 @@
1
- import { cn } from "@/lib/utils"
2
-
3
- function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
4
- return (
5
- <kbd
6
- data-slot="kbd"
7
- className={cn(
8
- "bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
9
- "[&_svg:not([class*='size-'])]:size-3",
10
- "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
11
- className
12
- )}
13
- {...props}
14
- />
15
- )
16
- }
17
-
18
- function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
19
- return (
20
- <kbd
21
- data-slot="kbd-group"
22
- className={cn("inline-flex items-center gap-1", className)}
23
- {...props}
24
- />
25
- )
26
- }
27
-
28
- export { Kbd, KbdGroup }
@@ -1,48 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { Label } from "./label";
3
- import { Input } from "./input";
4
-
5
- const meta = {
6
- title: "Components/Label",
7
- component: Label,
8
- parameters: {
9
- layout: "padded",
10
- },
11
- tags: ["autodocs"],
12
- } satisfies Meta<typeof Label>;
13
-
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
-
17
- export const Default: Story = {
18
- render: () => (
19
- <div className="space-y-2 w-[350px]">
20
- <Label htmlFor="email">Email</Label>
21
- <Input id="email" type="email" placeholder="name@example.com" />
22
- </div>
23
- ),
24
- };
25
-
26
- export const Required: Story = {
27
- render: () => (
28
- <div className="space-y-2 w-[350px]">
29
- <Label htmlFor="required">
30
- Email <span className="text-destructive">*</span>
31
- </Label>
32
- <Input id="required" type="email" placeholder="name@example.com" />
33
- </div>
34
- ),
35
- };
36
-
37
- export const WithDescription: Story = {
38
- render: () => (
39
- <div className="space-y-2 w-[350px]">
40
- <Label htmlFor="password">Password</Label>
41
- <Input id="password" type="password" placeholder="Enter password" />
42
- <p className="text-sm text-muted-foreground">
43
- Must be at least 8 characters long.
44
- </p>
45
- </div>
46
- ),
47
- };
48
-
@@ -1,28 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { render } from "@testing-library/react";
3
- import { Label } from "./label";
4
-
5
- describe("Label", () => {
6
- it("should render label", () => {
7
- const { container } = render(<Label>Label text</Label>);
8
- const label = container.querySelector('[data-slot="label"]');
9
- expect(label).toBeInTheDocument();
10
- });
11
-
12
- it("should associate label with input using htmlFor", () => {
13
- const { container } = render(
14
- <>
15
- <Label htmlFor="test-input">Test Label</Label>
16
- <input id="test-input" />
17
- </>
18
- );
19
- const label = container.querySelector('[data-slot="label"]');
20
- expect(label).toHaveAttribute("for", "test-input");
21
- });
22
-
23
- it("should render label text", () => {
24
- const { getByText } = render(<Label>Email</Label>);
25
- expect(getByText("Email")).toBeInTheDocument();
26
- });
27
- });
28
-
@@ -1,24 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as LabelPrimitive from "@radix-ui/react-label"
5
-
6
- import { cn } from "@/lib/utils"
7
-
8
- function Label({
9
- className,
10
- ...props
11
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
12
- return (
13
- <LabelPrimitive.Root
14
- data-slot="label"
15
- className={cn(
16
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
17
- className
18
- )}
19
- {...props}
20
- />
21
- )
22
- }
23
-
24
- export { Label }