@rovula/ui 0.0.9 → 0.0.11

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 (135) hide show
  1. package/dist/cjs/bundle.css +443 -3
  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.d.ts +14 -3
  7. package/dist/cjs/types/components/Button/Button.styles.d.ts +1 -1
  8. package/dist/cjs/types/components/Button/Buttons.stories.d.ts +8 -6
  9. package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +4 -0
  10. package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
  11. package/dist/cjs/types/components/DataTable/DataTable.d.ts +14 -0
  12. package/dist/cjs/types/components/DataTable/DataTable.stories.d.ts +19 -0
  13. package/dist/cjs/types/components/Dialog/Dialog.d.ts +19 -0
  14. package/dist/cjs/types/components/Dialog/Dialog.stories.d.ts +25 -0
  15. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +29 -3
  16. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +31 -30
  17. package/dist/cjs/types/components/Input/Input.d.ts +5 -0
  18. package/dist/cjs/types/components/Input/Input.stories.d.ts +314 -0
  19. package/dist/cjs/types/components/Label/Label.d.ts +5 -0
  20. package/dist/cjs/types/components/Label/Label.stories.d.ts +286 -0
  21. package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +5 -0
  22. package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
  23. package/dist/cjs/types/components/Table/Datagrid.d.ts +11 -0
  24. package/dist/cjs/types/components/Table/Table.d.ts +10 -11
  25. package/dist/cjs/types/components/Table/Table.stories.d.ts +283 -0
  26. package/dist/cjs/types/components/Tabs/Tabs.d.ts +7 -5
  27. package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +49 -0
  28. package/dist/cjs/types/components/Text/Text.d.ts +3 -3
  29. package/dist/cjs/types/components/Text/Text.stories.d.ts +3 -9
  30. package/dist/cjs/types/components/TextInput/TextInput.d.ts +20 -2
  31. package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +28 -1
  32. package/dist/cjs/types/components/ui/table.d.ts +10 -0
  33. package/dist/cjs/types/index.d.ts +10 -1
  34. package/dist/cjs/types/utils/cn.d.ts +2 -0
  35. package/dist/components/AlertDialog/Alert.stories.js +39 -0
  36. package/dist/components/AlertDialog/AlertDialog.js +73 -0
  37. package/dist/components/Button/Button.js +6 -5
  38. package/dist/components/Button/Button.styles.js +1 -1
  39. package/dist/components/Checkbox/Checkbox.js +37 -0
  40. package/dist/components/Checkbox/Checkbox.stories.js +49 -0
  41. package/dist/components/DataTable/DataTable.js +32 -0
  42. package/dist/components/DataTable/DataTable.stories.js +66 -0
  43. package/dist/components/Dialog/Dialog.js +63 -0
  44. package/dist/components/Dialog/Dialog.stories.js +52 -0
  45. package/dist/components/Dropdown/Dropdown.js +15 -5
  46. package/dist/components/Dropdown/Dropdown.stories.js +48 -0
  47. package/dist/components/Input/Input.js +31 -0
  48. package/dist/components/Input/Input.stories.js +37 -0
  49. package/dist/components/Label/Label.js +35 -0
  50. package/dist/components/Label/Label.stories.js +38 -0
  51. package/dist/components/RadioGroup/RadioGroup.js +41 -0
  52. package/dist/components/RadioGroup/RadioGroup.stories.js +44 -0
  53. package/dist/components/Table/Datagrid.js +6 -0
  54. package/dist/components/Table/Table.js +65 -5
  55. package/dist/components/Table/Table.stories.js +32 -0
  56. package/dist/components/Tabs/Tabs.js +10 -4
  57. package/dist/components/Tabs/Tabs.stories.js +60 -0
  58. package/dist/components/Text/Text.js +3 -2
  59. package/dist/components/TextInput/TextInput.js +5 -7
  60. package/dist/components/TextInput/TextInput.stories.js +22 -0
  61. package/dist/components/ui/table.js +66 -0
  62. package/dist/esm/bundle.css +443 -3
  63. package/dist/esm/bundle.js +1 -1
  64. package/dist/esm/bundle.js.map +1 -1
  65. package/dist/esm/types/components/AlertDialog/Alert.stories.d.ts +20 -0
  66. package/dist/esm/types/components/AlertDialog/AlertDialog.d.ts +20 -0
  67. package/dist/esm/types/components/Button/Button.d.ts +14 -3
  68. package/dist/esm/types/components/Button/Button.styles.d.ts +1 -1
  69. package/dist/esm/types/components/Button/Buttons.stories.d.ts +8 -6
  70. package/dist/esm/types/components/Checkbox/Checkbox.d.ts +4 -0
  71. package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
  72. package/dist/esm/types/components/DataTable/DataTable.d.ts +14 -0
  73. package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +19 -0
  74. package/dist/esm/types/components/Dialog/Dialog.d.ts +19 -0
  75. package/dist/esm/types/components/Dialog/Dialog.stories.d.ts +25 -0
  76. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +29 -3
  77. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +31 -30
  78. package/dist/esm/types/components/Input/Input.d.ts +5 -0
  79. package/dist/esm/types/components/Input/Input.stories.d.ts +314 -0
  80. package/dist/esm/types/components/Label/Label.d.ts +5 -0
  81. package/dist/esm/types/components/Label/Label.stories.d.ts +286 -0
  82. package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +5 -0
  83. package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
  84. package/dist/esm/types/components/Table/Datagrid.d.ts +11 -0
  85. package/dist/esm/types/components/Table/Table.d.ts +10 -11
  86. package/dist/esm/types/components/Table/Table.stories.d.ts +283 -0
  87. package/dist/esm/types/components/Tabs/Tabs.d.ts +7 -5
  88. package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +49 -0
  89. package/dist/esm/types/components/Text/Text.d.ts +3 -3
  90. package/dist/esm/types/components/Text/Text.stories.d.ts +3 -9
  91. package/dist/esm/types/components/TextInput/TextInput.d.ts +20 -2
  92. package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +28 -1
  93. package/dist/esm/types/components/ui/table.d.ts +10 -0
  94. package/dist/esm/types/index.d.ts +10 -1
  95. package/dist/esm/types/utils/cn.d.ts +2 -0
  96. package/dist/index.d.ts +139 -31
  97. package/dist/index.js +7 -1
  98. package/dist/src/theme/global.css +529 -3
  99. package/dist/theme/global.css +57 -0
  100. package/dist/theme/main-preset.js +29 -1
  101. package/dist/theme/presets/colors.js +19 -0
  102. package/dist/utils/cn.js +9 -0
  103. package/package.json +10 -1
  104. package/src/components/AlertDialog/Alert.stories.tsx +67 -0
  105. package/src/components/AlertDialog/AlertDialog.tsx +142 -0
  106. package/src/components/Button/Button.styles.ts +1 -1
  107. package/src/components/Button/Button.tsx +49 -41
  108. package/src/components/Checkbox/Checkbox.stories.tsx +91 -0
  109. package/src/components/Checkbox/Checkbox.tsx +36 -0
  110. package/src/components/DataTable/DataTable.stories.tsx +76 -0
  111. package/src/components/DataTable/DataTable.tsx +105 -0
  112. package/src/components/Dialog/Dialog.stories.tsx +118 -0
  113. package/src/components/Dialog/Dialog.tsx +119 -0
  114. package/src/components/Dropdown/Dropdown.stories.tsx +87 -3
  115. package/src/components/Dropdown/Dropdown.tsx +147 -109
  116. package/src/components/Input/Input.stories.tsx +40 -0
  117. package/src/components/Input/Input.tsx +25 -0
  118. package/src/components/Label/Label.stories.tsx +45 -0
  119. package/src/components/Label/Label.tsx +26 -0
  120. package/src/components/RadioGroup/RadioGroup.stories.tsx +71 -0
  121. package/src/components/RadioGroup/RadioGroup.tsx +59 -0
  122. package/src/components/Table/Datagrid.tsx +36 -0
  123. package/src/components/Table/Table.stories.tsx +79 -0
  124. package/src/components/Table/Table.tsx +116 -35
  125. package/src/components/Tabs/Tabs.stories.tsx +75 -0
  126. package/src/components/Tabs/Tabs.tsx +39 -10
  127. package/src/components/Text/Text.tsx +21 -19
  128. package/src/components/TextInput/TextInput.stories.tsx +46 -1
  129. package/src/components/TextInput/TextInput.tsx +7 -7
  130. package/src/components/ui/table.tsx +117 -0
  131. package/src/index.ts +13 -1
  132. package/src/theme/global.css +57 -0
  133. package/src/theme/main-preset.js +29 -1
  134. package/src/theme/presets/colors.js +19 -0
  135. package/src/utils/cn.ts +6 -0
@@ -1,36 +1,117 @@
1
- import React from "react";
2
-
3
- interface Column {
4
- header: string;
5
- accessor: string;
6
- }
7
-
8
- interface TableProps {
9
- columns: Column[];
10
- data: Record<string, any>[];
11
- }
12
-
13
- const Table: React.FC<TableProps> = ({ columns, data }) => {
14
- return (
15
- <table className="table">
16
- <thead>
17
- <tr>
18
- {columns.map((column, index) => (
19
- <th key={index}>{column.header}</th>
20
- ))}
21
- </tr>
22
- </thead>
23
- <tbody>
24
- {data.map((row, rowIndex) => (
25
- <tr key={rowIndex}>
26
- {columns.map((column, colIndex) => (
27
- <td key={colIndex}>{row[column.accessor]}</td>
28
- ))}
29
- </tr>
30
- ))}
31
- </tbody>
32
- </table>
33
- );
34
- };
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/utils/cn";
4
+
5
+ const Table = React.forwardRef<
6
+ HTMLTableElement,
7
+ React.HTMLAttributes<HTMLTableElement>
8
+ >(({ className, ...props }, ref) => (
9
+ <div className="relative w-full overflow-auto">
10
+ <table
11
+ ref={ref}
12
+ className={cn("w-full caption-bottom text-sm", className)}
13
+ {...props}
14
+ />
15
+ </div>
16
+ ));
17
+ Table.displayName = "Table";
18
+
19
+ const TableHeader = React.forwardRef<
20
+ HTMLTableSectionElement,
21
+ React.HTMLAttributes<HTMLTableSectionElement>
22
+ >(({ className, ...props }, ref) => (
23
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
24
+ ));
25
+ TableHeader.displayName = "TableHeader";
26
+
27
+ const TableBody = React.forwardRef<
28
+ HTMLTableSectionElement,
29
+ React.HTMLAttributes<HTMLTableSectionElement>
30
+ >(({ className, ...props }, ref) => (
31
+ <tbody
32
+ ref={ref}
33
+ className={cn("[&_tr:last-child]:border-0", className)}
34
+ {...props}
35
+ />
36
+ ));
37
+ TableBody.displayName = "TableBody";
38
+
39
+ const TableFooter = React.forwardRef<
40
+ HTMLTableSectionElement,
41
+ React.HTMLAttributes<HTMLTableSectionElement>
42
+ >(({ className, ...props }, ref) => (
43
+ <tfoot
44
+ ref={ref}
45
+ className={cn(
46
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ));
52
+ TableFooter.displayName = "TableFooter";
35
53
 
36
- export default Table;
54
+ const TableRow = React.forwardRef<
55
+ HTMLTableRowElement,
56
+ React.HTMLAttributes<HTMLTableRowElement>
57
+ >(({ className, ...props }, ref) => (
58
+ <tr
59
+ ref={ref}
60
+ className={cn(
61
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ ));
67
+ TableRow.displayName = "TableRow";
68
+
69
+ const TableHead = React.forwardRef<
70
+ HTMLTableCellElement,
71
+ React.ThHTMLAttributes<HTMLTableCellElement>
72
+ >(({ className, ...props }, ref) => (
73
+ <th
74
+ ref={ref}
75
+ className={cn(
76
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ ));
82
+ TableHead.displayName = "TableHead";
83
+
84
+ const TableCell = React.forwardRef<
85
+ HTMLTableCellElement,
86
+ React.TdHTMLAttributes<HTMLTableCellElement>
87
+ >(({ className, ...props }, ref) => (
88
+ <td
89
+ ref={ref}
90
+ className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
91
+ {...props}
92
+ />
93
+ ));
94
+ TableCell.displayName = "TableCell";
95
+
96
+ const TableCaption = React.forwardRef<
97
+ HTMLTableCaptionElement,
98
+ React.HTMLAttributes<HTMLTableCaptionElement>
99
+ >(({ className, ...props }, ref) => (
100
+ <caption
101
+ ref={ref}
102
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
103
+ {...props}
104
+ />
105
+ ));
106
+ TableCaption.displayName = "TableCaption";
107
+
108
+ export {
109
+ Table,
110
+ TableHeader,
111
+ TableBody,
112
+ TableFooter,
113
+ TableHead,
114
+ TableRow,
115
+ TableCell,
116
+ TableCaption,
117
+ };
@@ -0,0 +1,75 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import Tabs from "./Tabs";
4
+ import { ChevronDownIcon, ArchiveBoxIcon } from "@heroicons/react/16/solid";
5
+
6
+ const meta = {
7
+ title: "Components/Tabs",
8
+ component: Tabs,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "fullscreen",
12
+ },
13
+ decorators: [
14
+ (Story) => (
15
+ <div className="p-5 flex w-full">
16
+ <Story />
17
+ </div>
18
+ ),
19
+ ],
20
+ } satisfies Meta<typeof Tabs>;
21
+
22
+ export default meta;
23
+
24
+ const tabs = [
25
+ {
26
+ label: "Tab1",
27
+ content: <p>Tab 1 content</p>,
28
+ },
29
+ {
30
+ label: "Tab2",
31
+ content: <p>Tab 2 content</p>,
32
+ },
33
+ {
34
+ label: "Tab3",
35
+ content: <p>Tab 3 content</p>,
36
+ },
37
+ ];
38
+
39
+ export const Default = {
40
+ args: {
41
+ initialTab: 0,
42
+ tabs,
43
+ },
44
+ render: (args) => {
45
+ const props: typeof args = {
46
+ ...args,
47
+ };
48
+ return (
49
+ <div className="flex flex-row gap-4 w-full">
50
+ <Tabs tabs={tabs} {...props} />
51
+ </div>
52
+ );
53
+ },
54
+ } satisfies StoryObj;
55
+
56
+ export const CustomTab = {
57
+ args: {
58
+ initialTab: 0,
59
+ tabs: tabs.map((tab) => ({
60
+ ...tab,
61
+ startTabContent: <ArchiveBoxIcon className="size-3 " />,
62
+ endTabContent: <ChevronDownIcon className="size-3" />,
63
+ })),
64
+ },
65
+ render: (args) => {
66
+ const props: typeof args = {
67
+ ...args,
68
+ };
69
+ return (
70
+ <div className="flex flex-row gap-4 w-full">
71
+ <Tabs tabs={tabs} {...props} />
72
+ </div>
73
+ );
74
+ },
75
+ } satisfies StoryObj;
@@ -1,32 +1,61 @@
1
- import React, { useState } from "react";
1
+ "use client";
2
2
 
3
- interface Tab {
3
+ import { cn } from "@/utils/cn";
4
+ import React, { ReactElement, useState } from "react";
5
+
6
+ type Tab = {
4
7
  label: string;
8
+ startTabContent?: ReactElement;
9
+ endTabContent?: ReactElement;
5
10
  content: React.ReactNode;
6
- }
11
+ };
7
12
 
8
- interface TabsProps {
13
+ type TabsProps = {
9
14
  tabs: Tab[];
10
15
  initialTab?: number;
11
- }
16
+ };
12
17
 
13
- const Tabs: React.FC<TabsProps> = ({ tabs, initialTab = 0 }) => {
18
+ const Tabs: React.FC<TabsProps> = ({ tabs = [], initialTab = 0 }) => {
14
19
  const [activeTab, setActiveTab] = useState(initialTab);
15
20
 
16
21
  return (
17
- <div className="tabs">
18
- <div className="tab-buttons">
22
+ <div className="w-full space-y-4">
23
+ <div
24
+ className="flex border-b border-primary-10 gap-6 h-[54px] box-border"
25
+ role="tablist"
26
+ >
19
27
  {tabs.map((tab, index) => (
20
28
  <button
21
29
  key={index}
22
- className={index === activeTab ? "active" : ""}
30
+ role="tab"
31
+ aria-selected={index === activeTab}
32
+ aria-controls={`tab-content-${index}`}
33
+ id={`tab-${index}`}
34
+ className={cn(
35
+ "flex flex-row items-center py-4 px-1 cursor-pointer transition-colors duration-300 box-border gap-3",
36
+ {
37
+ "typography-body2 text-textcolor-dark border-b-[3px] border-textcolor-dark":
38
+ index === activeTab,
39
+ "typography-body1 text-textcolor-grey-light border-b-[3px] border-transparent hover:text-textcolor-dark ":
40
+ index !== activeTab,
41
+ }
42
+ )}
23
43
  onClick={() => setActiveTab(index)}
24
44
  >
45
+ {tab.startTabContent}
25
46
  {tab.label}
47
+ {tab.endTabContent}
26
48
  </button>
27
49
  ))}
28
50
  </div>
29
- <div className="tab-content">{tabs[activeTab].content}</div>
51
+ <div
52
+ className=""
53
+ role="tabpanel"
54
+ id={`tab-content-${activeTab}`}
55
+ aria-labelledby={`tab-${activeTab}`}
56
+ >
57
+ {tabs[activeTab]?.content}
58
+ </div>
30
59
  </div>
31
60
  );
32
61
  };
@@ -1,6 +1,6 @@
1
- import React, { FC } from "react";
1
+ import React, { FC, forwardRef } from "react";
2
2
 
3
- type TextProps = {
3
+ export type TextProps = {
4
4
  variant?:
5
5
  | "h1"
6
6
  | "h2"
@@ -38,22 +38,24 @@ type TextProps = {
38
38
  id?: string;
39
39
  };
40
40
 
41
- const Text: FC<TextProps> = ({
42
- variant = "body1",
43
- tag: Tag = "p",
44
- children,
45
- className,
46
- color,
47
- style,
48
- }) => {
49
- return (
50
- <Tag
51
- className={`typography-${variant} text-${color} ${className}`}
52
- style={style}
53
- >
54
- {children}
55
- </Tag>
56
- );
57
- };
41
+ const Text = forwardRef<TextProps["tag"], TextProps>(
42
+ ({
43
+ variant = "body1",
44
+ tag: Tag = "p",
45
+ children,
46
+ className,
47
+ color,
48
+ style,
49
+ }) => {
50
+ return (
51
+ <Tag
52
+ className={`typography-${variant} text-${color} ${className}`}
53
+ style={style}
54
+ >
55
+ {children}
56
+ </Tag>
57
+ );
58
+ }
59
+ );
58
60
 
59
61
  export default Text;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useRef } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
  import TextInput from "./TextInput";
4
4
 
@@ -42,3 +42,48 @@ export const Default = {
42
42
  );
43
43
  },
44
44
  } satisfies StoryObj;
45
+
46
+ const InputWithRef = (props: any) => {
47
+ const inputRef = useRef<HTMLInputElement | null>(null);
48
+
49
+ return (
50
+ <TextInput
51
+ id="1"
52
+ size="lg"
53
+ {...props}
54
+ ref={inputRef}
55
+ labelClassName="peer-focus:bg-red-500"
56
+ onKeyDown={(e) => {
57
+ if (e.code === "Enter") {
58
+ inputRef.current?.blur?.();
59
+ }
60
+ }}
61
+ />
62
+ );
63
+ };
64
+
65
+ export const CustomLabel = {
66
+ args: {
67
+ label: "Lorem Ipsum",
68
+ // value: "Lorem Ipsum",
69
+ fullwidth: true,
70
+ },
71
+ render: (args) => {
72
+ console.log("args ", args);
73
+ const props: typeof args = {
74
+ ...args,
75
+ };
76
+ return (
77
+ <div className="flex flex-row gap-4 w-full">
78
+ <TextInput
79
+ id="1"
80
+ size="lg"
81
+ {...args}
82
+ labelClassName="peer-focus:bg-red-500"
83
+ />
84
+ <InputWithRef id="2" size="md" {...args} />
85
+ <TextInput id="3" size="sm" {...args} />
86
+ </div>
87
+ );
88
+ },
89
+ } satisfies StoryObj;
@@ -12,8 +12,8 @@ import {
12
12
  inputVariant,
13
13
  labelVariant,
14
14
  } from "./TextInput.styles";
15
- import { twMerge } from "tailwind-merge";
16
15
  import { XCircleIcon, ExclamationCircleIcon } from "@heroicons/react/16/solid";
16
+ import { cn } from "@/utils/cn";
17
17
 
18
18
  export type InputProps = {
19
19
  id?: string;
@@ -31,9 +31,10 @@ export type InputProps = {
31
31
  hasClearIcon?: boolean;
32
32
  endIcon?: ReactNode;
33
33
  className?: string;
34
+ labelClassName?: string;
34
35
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
35
36
 
36
- const TextInput: FC<InputProps> = forwardRef(
37
+ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
37
38
  (
38
39
  {
39
40
  id,
@@ -50,6 +51,7 @@ const TextInput: FC<InputProps> = forwardRef(
50
51
  required = true,
51
52
  hasClearIcon = true,
52
53
  endIcon,
54
+ labelClassName,
53
55
  ...props
54
56
  },
55
57
  ref
@@ -74,9 +76,7 @@ const TextInput: FC<InputProps> = forwardRef(
74
76
  const iconWrapperClassname = iconWrapperVariant({ size });
75
77
  const iconClassname = iconVariant({ size });
76
78
 
77
- useImperativeHandle(ref, () => ({
78
- clearInput: handleClearInput,
79
- }));
79
+ useImperativeHandle(ref, () => inputRef?.current as HTMLInputElement);
80
80
 
81
81
  const handleClearInput = () => {
82
82
  if (inputRef.current) {
@@ -94,7 +94,7 @@ const TextInput: FC<InputProps> = forwardRef(
94
94
  type={type}
95
95
  id={_id}
96
96
  disabled={disabled}
97
- className={twMerge(inputClassname, props.className)}
97
+ className={cn(inputClassname, props.className)}
98
98
  />
99
99
  {hasClearIcon && (
100
100
  <div className={iconWrapperClassname}>
@@ -106,7 +106,7 @@ const TextInput: FC<InputProps> = forwardRef(
106
106
  </div>
107
107
  )}
108
108
  {endIcon}
109
- <label htmlFor={_id} className={labelClassname}>
109
+ <label htmlFor={_id} className={cn(labelClassname, labelClassName)}>
110
110
  {label} {required && <span className="text-error">*</span>}
111
111
  </label>
112
112
  </div>
@@ -0,0 +1,117 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/utils/cn"
4
+
5
+ const Table = React.forwardRef<
6
+ HTMLTableElement,
7
+ React.HTMLAttributes<HTMLTableElement>
8
+ >(({ className, ...props }, ref) => (
9
+ <div className="relative w-full overflow-auto">
10
+ <table
11
+ ref={ref}
12
+ className={cn("w-full caption-bottom text-sm", className)}
13
+ {...props}
14
+ />
15
+ </div>
16
+ ))
17
+ Table.displayName = "Table"
18
+
19
+ const TableHeader = React.forwardRef<
20
+ HTMLTableSectionElement,
21
+ React.HTMLAttributes<HTMLTableSectionElement>
22
+ >(({ className, ...props }, ref) => (
23
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
24
+ ))
25
+ TableHeader.displayName = "TableHeader"
26
+
27
+ const TableBody = React.forwardRef<
28
+ HTMLTableSectionElement,
29
+ React.HTMLAttributes<HTMLTableSectionElement>
30
+ >(({ className, ...props }, ref) => (
31
+ <tbody
32
+ ref={ref}
33
+ className={cn("[&_tr:last-child]:border-0", className)}
34
+ {...props}
35
+ />
36
+ ))
37
+ TableBody.displayName = "TableBody"
38
+
39
+ const TableFooter = React.forwardRef<
40
+ HTMLTableSectionElement,
41
+ React.HTMLAttributes<HTMLTableSectionElement>
42
+ >(({ className, ...props }, ref) => (
43
+ <tfoot
44
+ ref={ref}
45
+ className={cn(
46
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ))
52
+ TableFooter.displayName = "TableFooter"
53
+
54
+ const TableRow = React.forwardRef<
55
+ HTMLTableRowElement,
56
+ React.HTMLAttributes<HTMLTableRowElement>
57
+ >(({ className, ...props }, ref) => (
58
+ <tr
59
+ ref={ref}
60
+ className={cn(
61
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ ))
67
+ TableRow.displayName = "TableRow"
68
+
69
+ const TableHead = React.forwardRef<
70
+ HTMLTableCellElement,
71
+ React.ThHTMLAttributes<HTMLTableCellElement>
72
+ >(({ className, ...props }, ref) => (
73
+ <th
74
+ ref={ref}
75
+ className={cn(
76
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ ))
82
+ TableHead.displayName = "TableHead"
83
+
84
+ const TableCell = React.forwardRef<
85
+ HTMLTableCellElement,
86
+ React.TdHTMLAttributes<HTMLTableCellElement>
87
+ >(({ className, ...props }, ref) => (
88
+ <td
89
+ ref={ref}
90
+ className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
91
+ {...props}
92
+ />
93
+ ))
94
+ TableCell.displayName = "TableCell"
95
+
96
+ const TableCaption = React.forwardRef<
97
+ HTMLTableCaptionElement,
98
+ React.HTMLAttributes<HTMLTableCaptionElement>
99
+ >(({ className, ...props }, ref) => (
100
+ <caption
101
+ ref={ref}
102
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
103
+ {...props}
104
+ />
105
+ ))
106
+ TableCaption.displayName = "TableCaption"
107
+
108
+ export {
109
+ Table,
110
+ TableHeader,
111
+ TableBody,
112
+ TableFooter,
113
+ TableHead,
114
+ TableRow,
115
+ TableCell,
116
+ TableCaption,
117
+ }
package/src/index.ts CHANGED
@@ -2,11 +2,21 @@
2
2
  // import "./src/styles/style.css";
3
3
  import "./theme/global.css";
4
4
  export { default as Button } from "./components/Button/Button";
5
- export { default as Table } from "./components/Table/Table";
6
5
  export { default as TextInput } from "./components/TextInput/TextInput";
7
6
  export { default as Text } from "./components/Text/Text";
8
7
  export { default as Tabs } from "./components/Tabs/Tabs";
9
8
  export { default as Dropdown } from "./components/Dropdown/Dropdown";
9
+ export { Checkbox } from "./components/Checkbox/Checkbox";
10
+ export { Label } from "./components/Label/Label";
11
+ export { Input } from "./components/Input/Input";
12
+ export * from "./components/Table/Table";
13
+ export * from "./components/Dialog/Dialog";
14
+ export * from "./components/AlertDialog/AlertDialog";
15
+
16
+ // Export component types
17
+ export type { ButtonProps } from "./components/Button/Button";
18
+ export type { InputProps } from "./components/TextInput/TextInput";
19
+ export type { DropdownProps } from "./components/Dropdown/Dropdown";
10
20
 
11
21
  // UTILS
12
22
  export {
@@ -17,6 +27,8 @@ export {
17
27
  getTimestampUTC,
18
28
  } from "./utils/datetime";
19
29
 
30
+ export { cn } from "./utils/cn";
31
+
20
32
  // const mainPreset = require("./theme/main-preset");
21
33
 
22
34
  // export { mainPreset };
@@ -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
  }