@rovula/ui 0.0.8 → 0.0.10

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 (129) hide show
  1. package/dist/cjs/bundle.css +497 -4
  2. package/dist/cjs/bundle.js +1 -1
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/AlertDialog/Alert.stories.d.ts +20 -0
  5. package/dist/cjs/types/components/AlertDialog/AlertDialog.d.ts +20 -0
  6. package/dist/cjs/types/components/Button/Button.styles.d.ts +1 -1
  7. package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +4 -0
  8. package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
  9. package/dist/cjs/types/components/Dialog/Dialog.d.ts +19 -0
  10. package/dist/cjs/types/components/Dialog/Dialog.stories.d.ts +25 -0
  11. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +26 -0
  12. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +367 -0
  13. package/dist/cjs/types/components/Dropdown/Dropdown.styles.d.ts +11 -0
  14. package/dist/cjs/types/components/Input/Input.d.ts +5 -0
  15. package/dist/cjs/types/components/Input/Input.stories.d.ts +314 -0
  16. package/dist/cjs/types/components/Label/Label.d.ts +5 -0
  17. package/dist/cjs/types/components/Label/Label.stories.d.ts +286 -0
  18. package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +5 -0
  19. package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
  20. package/dist/cjs/types/components/Table/Datagrid.d.ts +11 -0
  21. package/dist/cjs/types/components/Table/Table.d.ts +10 -11
  22. package/dist/cjs/types/components/Table/Table.stories.d.ts +283 -0
  23. package/dist/cjs/types/components/Tabs/Tabs.d.ts +7 -5
  24. package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +49 -0
  25. package/dist/cjs/types/components/TextInput/TextInput.d.ts +3 -2
  26. package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +2 -16
  27. package/dist/cjs/types/index.d.ts +8 -2
  28. package/dist/cjs/types/utils/cn.d.ts +2 -0
  29. package/dist/components/AlertDialog/Alert.stories.js +39 -0
  30. package/dist/components/AlertDialog/AlertDialog.js +73 -0
  31. package/dist/components/Button/Button.js +3 -3
  32. package/dist/components/Button/Button.styles.js +1 -1
  33. package/dist/components/Checkbox/Checkbox.js +37 -0
  34. package/dist/components/Checkbox/Checkbox.stories.js +49 -0
  35. package/dist/components/Dialog/Dialog.js +63 -0
  36. package/dist/components/Dialog/Dialog.stories.js +52 -0
  37. package/dist/components/Dropdown/Dropdown.js +58 -0
  38. package/dist/components/{Select/Select.stories.js → Dropdown/Dropdown.stories.js} +8 -11
  39. package/dist/components/Dropdown/Dropdown.styles.js +47 -0
  40. package/dist/components/Input/Input.js +31 -0
  41. package/dist/components/Input/Input.stories.js +37 -0
  42. package/dist/components/Label/Label.js +35 -0
  43. package/dist/components/Label/Label.stories.js +38 -0
  44. package/dist/components/RadioGroup/RadioGroup.js +41 -0
  45. package/dist/components/RadioGroup/RadioGroup.stories.js +44 -0
  46. package/dist/components/Table/Datagrid.js +6 -0
  47. package/dist/components/Table/Table.js +65 -5
  48. package/dist/components/Table/Table.stories.js +32 -0
  49. package/dist/components/Tabs/Tabs.js +10 -4
  50. package/dist/components/Tabs/Tabs.stories.js +60 -0
  51. package/dist/components/TextInput/TextInput.js +3 -3
  52. package/dist/esm/bundle.css +497 -4
  53. package/dist/esm/bundle.js +1 -1
  54. package/dist/esm/bundle.js.map +1 -1
  55. package/dist/esm/types/components/AlertDialog/Alert.stories.d.ts +20 -0
  56. package/dist/esm/types/components/AlertDialog/AlertDialog.d.ts +20 -0
  57. package/dist/esm/types/components/Button/Button.styles.d.ts +1 -1
  58. package/dist/esm/types/components/Checkbox/Checkbox.d.ts +4 -0
  59. package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
  60. package/dist/esm/types/components/Dialog/Dialog.d.ts +19 -0
  61. package/dist/esm/types/components/Dialog/Dialog.stories.d.ts +25 -0
  62. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +26 -0
  63. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +367 -0
  64. package/dist/esm/types/components/Dropdown/Dropdown.styles.d.ts +11 -0
  65. package/dist/esm/types/components/Input/Input.d.ts +5 -0
  66. package/dist/esm/types/components/Input/Input.stories.d.ts +314 -0
  67. package/dist/esm/types/components/Label/Label.d.ts +5 -0
  68. package/dist/esm/types/components/Label/Label.stories.d.ts +286 -0
  69. package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +5 -0
  70. package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
  71. package/dist/esm/types/components/Table/Datagrid.d.ts +11 -0
  72. package/dist/esm/types/components/Table/Table.d.ts +10 -11
  73. package/dist/esm/types/components/Table/Table.stories.d.ts +283 -0
  74. package/dist/esm/types/components/Tabs/Tabs.d.ts +7 -5
  75. package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +49 -0
  76. package/dist/esm/types/components/TextInput/TextInput.d.ts +3 -2
  77. package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +2 -16
  78. package/dist/esm/types/index.d.ts +8 -2
  79. package/dist/esm/types/utils/cn.d.ts +2 -0
  80. package/dist/index.d.ts +88 -30
  81. package/dist/index.js +8 -2
  82. package/dist/src/theme/global.css +598 -4
  83. package/dist/theme/global.css +57 -0
  84. package/dist/theme/main-preset.js +29 -1
  85. package/dist/theme/presets/colors.js +19 -0
  86. package/dist/utils/cn.js +9 -0
  87. package/package.json +9 -1
  88. package/src/components/AlertDialog/Alert.stories.tsx +67 -0
  89. package/src/components/AlertDialog/AlertDialog.tsx +142 -0
  90. package/src/components/Button/Button.styles.ts +1 -1
  91. package/src/components/Button/Button.tsx +4 -4
  92. package/src/components/Checkbox/Checkbox.stories.tsx +91 -0
  93. package/src/components/Checkbox/Checkbox.tsx +36 -0
  94. package/src/components/Dialog/Dialog.stories.tsx +118 -0
  95. package/src/components/Dialog/Dialog.tsx +119 -0
  96. package/src/components/{Select/Select.stories.tsx → Dropdown/Dropdown.stories.tsx} +11 -14
  97. package/src/components/Dropdown/Dropdown.styles.ts +54 -0
  98. package/src/components/Dropdown/Dropdown.tsx +151 -0
  99. package/src/components/Input/Input.stories.tsx +40 -0
  100. package/src/components/Input/Input.tsx +25 -0
  101. package/src/components/Label/Label.stories.tsx +45 -0
  102. package/src/components/Label/Label.tsx +26 -0
  103. package/src/components/RadioGroup/RadioGroup.stories.tsx +71 -0
  104. package/src/components/RadioGroup/RadioGroup.tsx +59 -0
  105. package/src/components/Table/Datagrid.tsx +36 -0
  106. package/src/components/Table/Table.stories.tsx +79 -0
  107. package/src/components/Table/Table.tsx +116 -35
  108. package/src/components/Tabs/Tabs.stories.tsx +75 -0
  109. package/src/components/Tabs/Tabs.tsx +39 -10
  110. package/src/components/TextInput/TextInput.tsx +11 -2
  111. package/src/index.ts +9 -2
  112. package/src/theme/global.css +57 -0
  113. package/src/theme/main-preset.js +29 -1
  114. package/src/theme/presets/colors.js +19 -0
  115. package/src/utils/cn.ts +6 -0
  116. package/dist/cjs/types/components/Select/Select copy.d.ts +0 -23
  117. package/dist/cjs/types/components/Select/Select.d.ts +0 -23
  118. package/dist/cjs/types/components/Select/Select.stories.d.ts +0 -348
  119. package/dist/cjs/types/components/Select/Select.styles.d.ts +0 -14
  120. package/dist/components/Select/Select copy.js +0 -42
  121. package/dist/components/Select/Select.js +0 -21
  122. package/dist/components/Select/Select.styles.js +0 -100
  123. package/dist/esm/types/components/Select/Select copy.d.ts +0 -23
  124. package/dist/esm/types/components/Select/Select.d.ts +0 -23
  125. package/dist/esm/types/components/Select/Select.stories.d.ts +0 -348
  126. package/dist/esm/types/components/Select/Select.styles.d.ts +0 -14
  127. package/src/components/Select/Select copy.tsx +0 -103
  128. package/src/components/Select/Select.styles.ts +0 -111
  129. package/src/components/Select/Select.tsx +0 -54
@@ -145,5 +145,62 @@
145
145
  --input-disabled-background-color: 247 247 247;
146
146
 
147
147
  --input-label-background-color: 249 251 255;
148
+
149
+ /* Text */
150
+ --text-default-dark: 1 1 68;
151
+ --text-default-medium: 47 78 255;
152
+ --text-default-light: 213 230 255;
153
+
154
+ --text-grey-dark: 29 30 39;
155
+ --text-grey-medium: 117 121 128;
156
+ --text-grey-light: 164 169 178;
157
+ --text-white: 255 255 255;
158
+
159
+ /* Other/Popup */
160
+ --popup-background: 249 251 255;
161
+ /* Other/Popup Curtain */
162
+ --popup-overlay: 0 0 0;
163
+ --popup-overlay-alpha: 0.48;
164
+ --popup-rounded: 24px;
165
+
166
+ /* TODO for shadcn, wait for refactor */
167
+ /* --background: 0 0% 100%; */
168
+ --background: 220 100% 99%;
169
+ --foreground: 222.2 47.4% 11.2%;
170
+
171
+ --muted: 210 40% 96.1%;
172
+ --muted-foreground: 215.4 16.3% 46.9%;
173
+
174
+ --popover: 0 0% 100%;
175
+ --popover-foreground: 222.2 47.4% 11.2%;
176
+
177
+ --border: 214.3 31.8% 91.4%;
178
+ --input: 214.3 31.8% 91.4%;
179
+
180
+ --card: 0 0% 100%;
181
+ --card-foreground: 222.2 47.4% 11.2%;
182
+
183
+ --primary: var(--primary-default);
184
+
185
+ --secondary: var(--secondary-default);
186
+
187
+ --accent: 210 40% 96.1%;
188
+ --accent-foreground: 222.2 47.4% 11.2%;
189
+
190
+ --destructive: 0 100% 50%;
191
+ --destructive-foreground: 210 40% 98%;
192
+
193
+ --ring: 215 20.2% 65.1%;
194
+
195
+ --radius: 0.5rem;
196
+ }
197
+ }
198
+
199
+ @layer base {
200
+ * {
201
+ @apply border-border;
202
+ }
203
+ body {
204
+ @apply bg-background text-foreground;
148
205
  }
149
206
  }
@@ -1,7 +1,16 @@
1
+ const { fontFamily } = require("tailwindcss/defaultTheme");
2
+
1
3
  /** @type {import('tailwindcss').Config} */
2
4
  module.exports = {
3
5
  darkMode: "class",
4
6
  theme: {
7
+ container: {
8
+ center: true,
9
+ padding: "2rem",
10
+ screens: {
11
+ "2xl": "1400px",
12
+ },
13
+ },
5
14
  extend: {
6
15
  fontSize: {
7
16
  h1: [
@@ -152,8 +161,27 @@ module.exports = {
152
161
  },
153
162
  ],
154
163
  },
164
+ borderRadius: {
165
+ lg: `var(--radius)`,
166
+ md: `calc(var(--radius) - 2px)`,
167
+ sm: "calc(var(--radius) - 4px)",
168
+ },
169
+ keyframes: {
170
+ "accordion-down": {
171
+ from: { height: "0" },
172
+ to: { height: "var(--radix-accordion-content-height)" },
173
+ },
174
+ "accordion-up": {
175
+ from: { height: "var(--radix-accordion-content-height)" },
176
+ to: { height: "0" },
177
+ },
178
+ },
179
+ animation: {
180
+ "accordion-down": "accordion-down 0.2s ease-out",
181
+ "accordion-up": "accordion-up 0.2s ease-out",
182
+ },
155
183
  },
156
184
  },
157
- presets: [require("./presets/colors")],
185
+ presets: [require("./presets/colors"), require("tailwindcss-animate")],
158
186
  plugins: [require("./plugins/utilities/typography")],
159
187
  };
@@ -5,6 +5,10 @@ module.exports = {
5
5
  theme: {
6
6
  extend: {
7
7
  colors: {
8
+ border: "hsl(var(--border))",
9
+ ring: "hsl(var(--ring))",
10
+ background: "hsl(var(--background))",
11
+ foreground: "hsl(var(--foreground))",
8
12
  // Palette colors
9
13
  themes: {
10
14
  50: "rgb(var(--themes-50) / <alpha-value>)",
@@ -160,6 +164,21 @@ module.exports = {
160
164
  "rgb(var(--input-label-background-color) / <alpha-value>)",
161
165
  },
162
166
  },
167
+ textcolor: {
168
+ dark: "rgb(var(--text-default-dark) / <alpha-value>)",
169
+ medium: "rgb(var(--text-default-medium) / <alpha-value>)",
170
+ light: "rgb(var(--text-default-light) / <alpha-value>)",
171
+ grey: {
172
+ dark: "rgb(var(--text-grey-dark) / <alpha-value>)",
173
+ medium: "rgb(var(--text-grey-medium) / <alpha-value>)",
174
+ light: "rgb(var(--text-grey-light) / <alpha-value>)",
175
+ },
176
+ white: "rgb(var(--text-white) / <alpha-value>)",
177
+ },
178
+ popup: {
179
+ background: "rgb(var(--popup-background) / <alpha-value>)",
180
+ overlay: "rgb(var(--popup-overlay) / var(--popup-overlay-alpha))",
181
+ },
163
182
  },
164
183
  },
165
184
  },
@@ -0,0 +1,9 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn() {
4
+ var inputs = [];
5
+ for (var _i = 0; _i < arguments.length; _i++) {
6
+ inputs[_i] = arguments[_i];
7
+ }
8
+ return twMerge(clsx(inputs));
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -60,6 +60,7 @@
60
60
  "storybook": "^8.1.3",
61
61
  "style-loader": "^4.0.0",
62
62
  "tailwindcss": "^3.4.3",
63
+ "tsconfig-paths-webpack-plugin": "^4.1.0",
63
64
  "typescript": "^5.4.5",
64
65
  "webpack": "^5.91.0",
65
66
  "webpack-cli": "^5.1.4"
@@ -67,6 +68,12 @@
67
68
  "dependencies": {
68
69
  "@headlessui/react": "^2.0.3",
69
70
  "@heroicons/react": "^2.1.3",
71
+ "@radix-ui/react-alert-dialog": "^1.0.5",
72
+ "@radix-ui/react-checkbox": "^1.0.4",
73
+ "@radix-ui/react-dialog": "^1.0.5",
74
+ "@radix-ui/react-label": "^2.0.2",
75
+ "@radix-ui/react-radio-group": "^1.1.3",
76
+ "@radix-ui/react-slot": "^1.0.2",
70
77
  "@types/react": "^18.3.2",
71
78
  "axios": "^1.6.4",
72
79
  "class-variance-authority": "^0.7.0",
@@ -74,6 +81,7 @@
74
81
  "react": "^17.0.0 || ^18.0.0",
75
82
  "react-dom": "^17.0.0 || ^18.0.0",
76
83
  "tailwind-merge": "^2.3.0",
84
+ "tailwindcss-animate": "^1.0.7",
77
85
  "yup": "^1.4.0"
78
86
  },
79
87
  "peerDependencies": {
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import {
4
+ AlertDialog,
5
+ AlertDialogAction,
6
+ AlertDialogCancel,
7
+ AlertDialogContent,
8
+ AlertDialogDescription,
9
+ AlertDialogFooter,
10
+ AlertDialogHeader,
11
+ AlertDialogTitle,
12
+ AlertDialogTrigger,
13
+ } from "./AlertDialog";
14
+
15
+ // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
16
+ const meta = {
17
+ title: "Components/Alert",
18
+ component: AlertDialog,
19
+ tags: ["autodocs"],
20
+ parameters: {
21
+ // More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
22
+ layout: "fullscreen",
23
+ },
24
+ decorators: [
25
+ (Story) => (
26
+ <div className="p-5 flex w-full">
27
+ <Story />
28
+ </div>
29
+ ),
30
+ ],
31
+ } satisfies Meta<typeof AlertDialog>;
32
+
33
+ export default meta;
34
+
35
+ export const Default = {
36
+ args: {
37
+ // label: "Lorem Ipsum",
38
+ // value: "Lorem Ipsum",
39
+ // fullwidth: true,
40
+ },
41
+ render: (args) => {
42
+ console.log("args ", args);
43
+ const props: typeof args = {
44
+ ...args,
45
+ };
46
+ return (
47
+ <div className="flex flex-row gap-4 w-full">
48
+ <AlertDialog>
49
+ <AlertDialogTrigger>Open</AlertDialogTrigger>
50
+ <AlertDialogContent>
51
+ <AlertDialogHeader>
52
+ <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
53
+ <AlertDialogDescription>
54
+ This action cannot be undone. This will permanently delete your
55
+ account and remove your data from our servers.
56
+ </AlertDialogDescription>
57
+ </AlertDialogHeader>
58
+ <AlertDialogFooter>
59
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
60
+ <AlertDialogAction>Continue</AlertDialogAction>
61
+ </AlertDialogFooter>
62
+ </AlertDialogContent>
63
+ </AlertDialog>
64
+ </div>
65
+ );
66
+ },
67
+ } satisfies StoryObj;
@@ -0,0 +1,142 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
5
+
6
+ import { cn } from "@/utils/cn";
7
+ import { buttonVariants } from "../Button/Button.styles";
8
+
9
+ const AlertDialog = AlertDialogPrimitive.Root;
10
+
11
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
12
+
13
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
+
15
+ const AlertDialogOverlay = React.forwardRef<
16
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
18
+ >(({ className, ...props }, ref) => (
19
+ <AlertDialogPrimitive.Overlay
20
+ className={cn(
21
+ "fixed inset-0 bg-popup-overlay z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
+ className
23
+ )}
24
+ {...props}
25
+ ref={ref}
26
+ />
27
+ ));
28
+
29
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
30
+
31
+ const AlertDialogContent = React.forwardRef<
32
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
33
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
34
+ >(({ className, ...props }, ref) => (
35
+ <AlertDialogPortal>
36
+ <AlertDialogOverlay />
37
+ <AlertDialogPrimitive.Content
38
+ ref={ref}
39
+ className={cn(
40
+ "fixed text-textcolor-grey-dark left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-6 border bg-popup-background p-8 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-[var(--popup-rounded)]",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ </AlertDialogPortal>
46
+ ));
47
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
48
+
49
+ const AlertDialogHeader = ({
50
+ className,
51
+ ...props
52
+ }: React.HTMLAttributes<HTMLDivElement>) => (
53
+ <div
54
+ className={cn(
55
+ "flex flex-col space-y-2 text-center sm:text-left",
56
+ className
57
+ )}
58
+ {...props}
59
+ />
60
+ );
61
+ AlertDialogHeader.displayName = "AlertDialogHeader";
62
+
63
+ const AlertDialogFooter = ({
64
+ className,
65
+ ...props
66
+ }: React.HTMLAttributes<HTMLDivElement>) => (
67
+ <div
68
+ className={cn(
69
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
70
+ className
71
+ )}
72
+ {...props}
73
+ />
74
+ );
75
+ AlertDialogFooter.displayName = "AlertDialogFooter";
76
+
77
+ const AlertDialogTitle = React.forwardRef<
78
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
79
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
80
+ >(({ className, ...props }, ref) => (
81
+ <AlertDialogPrimitive.Title
82
+ ref={ref}
83
+ className={cn("typography-h5", className)}
84
+ {...props}
85
+ />
86
+ ));
87
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
88
+
89
+ const AlertDialogDescription = React.forwardRef<
90
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
91
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
92
+ >(({ className, ...props }, ref) => (
93
+ <AlertDialogPrimitive.Description
94
+ ref={ref}
95
+ className={cn("text-sm", className)}
96
+ {...props}
97
+ />
98
+ ));
99
+ AlertDialogDescription.displayName =
100
+ AlertDialogPrimitive.Description.displayName;
101
+
102
+ const AlertDialogAction = React.forwardRef<
103
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
104
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
105
+ >(({ className, ...props }, ref) => (
106
+ <AlertDialogPrimitive.Action
107
+ ref={ref}
108
+ className={cn(buttonVariants({ fullwidth: false }), className)}
109
+ {...props}
110
+ />
111
+ ));
112
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
113
+
114
+ const AlertDialogCancel = React.forwardRef<
115
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
116
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
117
+ >(({ className, ...props }, ref) => (
118
+ <AlertDialogPrimitive.Cancel
119
+ ref={ref}
120
+ className={cn(
121
+ buttonVariants({ fullwidth: false, variant: "outline" }),
122
+ "mt-2 sm:mt-0",
123
+ className
124
+ )}
125
+ {...props}
126
+ />
127
+ ));
128
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
129
+
130
+ export {
131
+ AlertDialog,
132
+ AlertDialogPortal,
133
+ AlertDialogOverlay,
134
+ AlertDialogTrigger,
135
+ AlertDialogContent,
136
+ AlertDialogHeader,
137
+ AlertDialogFooter,
138
+ AlertDialogTitle,
139
+ AlertDialogDescription,
140
+ AlertDialogAction,
141
+ AlertDialogCancel,
142
+ };
@@ -1,6 +1,6 @@
1
1
  import { cva } from "class-variance-authority";
2
2
 
3
- export const buttonCva = cva(
3
+ export const buttonVariants = cva(
4
4
  [
5
5
  // "inline-flex items-center justify-center align-middle no-underline transition-colors ease-in-out duration-300",
6
6
  // "font-sans appearance-none select-none rounded-sm border font-medium tracking-[.02857em]",
@@ -1,6 +1,6 @@
1
1
  import React, { FC, ReactElement } from "react";
2
- import { twMerge } from "tailwind-merge";
3
- import { buttonCva } from "./Button.styles";
2
+ import { buttonVariants } from "./Button.styles";
3
+ import { cn } from "@/utils/cn";
4
4
 
5
5
  type ButtonProps = {
6
6
  title?: string;
@@ -44,8 +44,8 @@ const Button: FC<ButtonProps> = ({
44
44
  {...props}
45
45
  aria-disabled={isDisabled || undefined}
46
46
  tabIndex={isDisabled ? -1 : 0}
47
- className={twMerge(
48
- buttonCva({ size, color, variant, disabled, fullwidth }),
47
+ className={cn(
48
+ buttonVariants({ size, color, variant, disabled, fullwidth }),
49
49
  className
50
50
  )}
51
51
  disabled={isDisabled}
@@ -0,0 +1,91 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Checkbox } from "./Checkbox";
4
+
5
+ const meta = {
6
+ title: "Components/Checkbox",
7
+ component: Checkbox,
8
+ tags: ["autodocs"],
9
+ parameters: {
10
+ layout: "fullscreen",
11
+ },
12
+ decorators: [
13
+ (Story) => (
14
+ <div className="p-5 flex w-full">
15
+ <Story />
16
+ </div>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof Checkbox>;
20
+
21
+ export default meta;
22
+
23
+ export const Default = {
24
+ args: {
25
+ checked: false,
26
+ disabled: false,
27
+ },
28
+ render: (args) => {
29
+ const props: typeof args = {
30
+ ...args,
31
+ };
32
+ return (
33
+ <div className="flex flex-row gap-4 w-full">
34
+ <div className="flex items-center space-x-2">
35
+ <Checkbox id="terms" {...props} />
36
+ <label
37
+ htmlFor="terms"
38
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
39
+ >
40
+ Accept terms and conditions
41
+ </label>
42
+ </div>
43
+ </div>
44
+ );
45
+ },
46
+ } satisfies StoryObj;
47
+
48
+ export const WithText = {
49
+ args: {},
50
+ render: (args) => {
51
+ const props: typeof args = {
52
+ ...args,
53
+ };
54
+ return (
55
+ <div className="items-top flex space-x-2">
56
+ <Checkbox id="terms1" />
57
+ <div className="grid gap-1.5 leading-none">
58
+ <label
59
+ htmlFor="terms1"
60
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
61
+ >
62
+ Accept terms and conditions
63
+ </label>
64
+ <p className="text-sm text-muted-foreground">
65
+ You agree to our Terms of Service and Privacy Policy.
66
+ </p>
67
+ </div>
68
+ </div>
69
+ );
70
+ },
71
+ } satisfies StoryObj;
72
+
73
+ export const Diabled = {
74
+ args: {},
75
+ render: (args) => {
76
+ const props: typeof args = {
77
+ ...args,
78
+ };
79
+ return (
80
+ <div className="flex items-center space-x-2">
81
+ <Checkbox id="terms2" disabled />
82
+ <label
83
+ htmlFor="terms2"
84
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
85
+ >
86
+ Accept terms and conditions
87
+ </label>
88
+ </div>
89
+ );
90
+ },
91
+ } satisfies StoryObj;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
+
6
+ import { CheckIcon } from "@heroicons/react/16/solid";
7
+
8
+ import { cn } from "@/utils/cn";
9
+
10
+ const Checkbox = React.forwardRef<
11
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
12
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
13
+ >(({ className, ...props }, ref) => (
14
+ <CheckboxPrimitive.Root
15
+ ref={ref}
16
+ className={cn(
17
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary-30 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:border-socondary-120 disabled:border-socondary-110",
18
+ {
19
+ "data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground":
20
+ !props.disabled,
21
+ "bg-grey2-300": props.checked && props.disabled,
22
+ },
23
+ className
24
+ )}
25
+ {...props}
26
+ >
27
+ <CheckboxPrimitive.Indicator
28
+ className={cn("flex items-center justify-center text-current")}
29
+ >
30
+ <CheckIcon className="h-4 w-4" />
31
+ </CheckboxPrimitive.Indicator>
32
+ </CheckboxPrimitive.Root>
33
+ ));
34
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
35
+
36
+ export { Checkbox };
@@ -0,0 +1,118 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import {
4
+ Dialog,
5
+ DialogContent,
6
+ DialogDescription,
7
+ DialogFooter,
8
+ DialogHeader,
9
+ DialogTitle,
10
+ DialogTrigger,
11
+ } from "./Dialog";
12
+ import Button from "../Button/Button";
13
+ import { Label } from "../Label/Label";
14
+ import { Input } from "../Input/Input";
15
+
16
+ const meta = {
17
+ title: "Components/Dialog",
18
+ component: Dialog,
19
+ tags: ["autodocs"],
20
+ parameters: {
21
+ layout: "fullscreen",
22
+ },
23
+ decorators: [
24
+ (Story) => (
25
+ <div className="p-5 flex w-full">
26
+ <Story />
27
+ </div>
28
+ ),
29
+ ],
30
+ } satisfies Meta<typeof Dialog>;
31
+
32
+ export default meta;
33
+
34
+ export const Default = {
35
+ args: {
36
+ // label: "Lorem Ipsum",
37
+ // value: "Lorem Ipsum",
38
+ // fullwidth: true,
39
+ },
40
+ render: (args) => {
41
+ console.log("args ", args);
42
+ const props: typeof args = {
43
+ ...args,
44
+ };
45
+ return (
46
+ <div className="flex flex-row gap-4 w-full">
47
+ <Dialog>
48
+ <DialogTrigger>Open</DialogTrigger>
49
+ <DialogContent>
50
+ <DialogHeader>
51
+ <DialogTitle>Are you absolutely sure?</DialogTitle>
52
+ <DialogDescription>
53
+ This action cannot be undone. This will permanently delete your
54
+ account and remove your data from our servers.
55
+ </DialogDescription>
56
+ </DialogHeader>
57
+ </DialogContent>
58
+ </Dialog>
59
+ </div>
60
+ );
61
+ },
62
+ } satisfies StoryObj;
63
+
64
+ export const Demo = {
65
+ args: {
66
+ // label: "Lorem Ipsum",
67
+ // value: "Lorem Ipsum",
68
+ // fullwidth: true,
69
+ },
70
+ render: (args) => {
71
+ console.log("args ", args);
72
+ const props: typeof args = {
73
+ ...args,
74
+ };
75
+ return (
76
+ <div className="flex flex-row gap-4 w-full">
77
+ <Dialog>
78
+ <DialogTrigger asChild>
79
+ <Button variant="outline">Edit Profile</Button>
80
+ </DialogTrigger>
81
+ <DialogContent className="sm:max-w-[425px]">
82
+ <DialogHeader>
83
+ <DialogTitle>Edit profile</DialogTitle>
84
+ <DialogDescription>
85
+ Make changes to your profile here. Click save when you're done.
86
+ </DialogDescription>
87
+ </DialogHeader>
88
+ <div className="grid gap-4 py-4">
89
+ <div className="grid grid-cols-4 items-center gap-4">
90
+ <Label htmlFor="name" className="text-right">
91
+ Name
92
+ </Label>
93
+ <Input
94
+ id="name"
95
+ defaultValue="Pedro Duarte"
96
+ className="col-span-3"
97
+ />
98
+ </div>
99
+ <div className="grid grid-cols-4 items-center gap-4">
100
+ <Label htmlFor="username" className="text-right">
101
+ Username
102
+ </Label>
103
+ <Input
104
+ id="username"
105
+ defaultValue="@peduarte"
106
+ className="col-span-3"
107
+ />
108
+ </div>
109
+ </div>
110
+ <DialogFooter>
111
+ <Button type="submit">Save changes</Button>
112
+ </DialogFooter>
113
+ </DialogContent>
114
+ </Dialog>
115
+ </div>
116
+ );
117
+ },
118
+ } satisfies StoryObj;