@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
@@ -0,0 +1,44 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { RadioGroup, RadioGroupItem } from "./RadioGroup";
14
+ import { Label } from "../Label/Label";
15
+ var meta = {
16
+ title: "Components/RadioGroup",
17
+ component: RadioGroup,
18
+ tags: ["autodocs"],
19
+ parameters: {
20
+ layout: "fullscreen",
21
+ },
22
+ decorators: [
23
+ function (Story) { return (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })); },
24
+ ],
25
+ };
26
+ export default meta;
27
+ export var Default = {
28
+ args: {
29
+ disabled: false,
30
+ },
31
+ render: function (args) {
32
+ var props = __assign({}, args);
33
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(RadioGroup, __assign({ defaultValue: "option-one" }, props, { children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-one", id: "option-one" }), _jsx(Label, { htmlFor: "option-one", children: "Option One" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-two", id: "option-two" }), _jsx(Label, { htmlFor: "option-two", children: "Option Two" })] })] })) }));
34
+ },
35
+ };
36
+ export var Diabled = {
37
+ args: {
38
+ disabled: true,
39
+ },
40
+ render: function (args) {
41
+ var props = __assign({}, args);
42
+ return (_jsx("div", { className: "flex items-center space-x-2", children: _jsxs(RadioGroup, { defaultValue: "option-one", disabled: true, children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-one", id: "option-one" }), _jsx(Label, { htmlFor: "option-one", children: "Option One" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-two", id: "option-two" }), _jsx(Label, { htmlFor: "option-two", children: "Option Two" })] })] }) }));
43
+ },
44
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ var Table = function (_a) {
3
+ var columns = _a.columns, data = _a.data;
4
+ return (_jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map(function (column, index) { return (_jsx("th", { children: column.header }, index)); }) }) }), _jsx("tbody", { children: data.map(function (row, rowIndex) { return (_jsx("tr", { children: columns.map(function (column, colIndex) { return (_jsx("td", { children: row[column.accessor] }, colIndex)); }) }, rowIndex)); }) })] }));
5
+ };
6
+ export default Table;
@@ -1,6 +1,66 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- var Table = function (_a) {
3
- var columns = _a.columns, data = _a.data;
4
- return (_jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map(function (column, index) { return (_jsx("th", { children: column.header }, index)); }) }) }), _jsx("tbody", { children: data.map(function (row, rowIndex) { return (_jsx("tr", { children: columns.map(function (column, colIndex) { return (_jsx("td", { children: row[column.accessor] }, colIndex)); }) }, rowIndex)); }) })] }));
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
5
11
  };
6
- export default Table;
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import * as React from "react";
25
+ import { cn } from "@/utils/cn";
26
+ var Table = React.forwardRef(function (_a, ref) {
27
+ var className = _a.className, props = __rest(_a, ["className"]);
28
+ return (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", __assign({ ref: ref, className: cn("w-full caption-bottom text-sm", className) }, props)) }));
29
+ });
30
+ Table.displayName = "Table";
31
+ var TableHeader = React.forwardRef(function (_a, ref) {
32
+ var className = _a.className, props = __rest(_a, ["className"]);
33
+ return (_jsx("thead", __assign({ ref: ref, className: cn("[&_tr]:border-b", className) }, props)));
34
+ });
35
+ TableHeader.displayName = "TableHeader";
36
+ var TableBody = React.forwardRef(function (_a, ref) {
37
+ var className = _a.className, props = __rest(_a, ["className"]);
38
+ return (_jsx("tbody", __assign({ ref: ref, className: cn("[&_tr:last-child]:border-0", className) }, props)));
39
+ });
40
+ TableBody.displayName = "TableBody";
41
+ var TableFooter = React.forwardRef(function (_a, ref) {
42
+ var className = _a.className, props = __rest(_a, ["className"]);
43
+ return (_jsx("tfoot", __assign({ ref: ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className) }, props)));
44
+ });
45
+ TableFooter.displayName = "TableFooter";
46
+ var TableRow = React.forwardRef(function (_a, ref) {
47
+ var className = _a.className, props = __rest(_a, ["className"]);
48
+ return (_jsx("tr", __assign({ ref: ref, className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className) }, props)));
49
+ });
50
+ TableRow.displayName = "TableRow";
51
+ var TableHead = React.forwardRef(function (_a, ref) {
52
+ var className = _a.className, props = __rest(_a, ["className"]);
53
+ return (_jsx("th", __assign({ ref: ref, className: cn("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", className) }, props)));
54
+ });
55
+ TableHead.displayName = "TableHead";
56
+ var TableCell = React.forwardRef(function (_a, ref) {
57
+ var className = _a.className, props = __rest(_a, ["className"]);
58
+ return (_jsx("td", __assign({ ref: ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className) }, props)));
59
+ });
60
+ TableCell.displayName = "TableCell";
61
+ var TableCaption = React.forwardRef(function (_a, ref) {
62
+ var className = _a.className, props = __rest(_a, ["className"]);
63
+ return (_jsx("caption", __assign({ ref: ref, className: cn("mt-4 text-sm text-muted-foreground", className) }, props)));
64
+ });
65
+ TableCaption.displayName = "TableCaption";
66
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
@@ -0,0 +1,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, } from "./Table";
14
+ var meta = {
15
+ title: "Components/Table",
16
+ component: Table,
17
+ tags: ["autodocs"],
18
+ parameters: {
19
+ layout: "fullscreen",
20
+ },
21
+ decorators: [
22
+ function (Story) { return (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })); },
23
+ ],
24
+ };
25
+ export default meta;
26
+ export var Default = {
27
+ args: {},
28
+ render: function (args) {
29
+ var props = __assign({}, args);
30
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(Table, { children: [_jsx(TableCaption, { children: "A list of your recent invoices." }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "w-[100px]", children: "Invoice" }), _jsx(TableHead, { children: "Status" }), _jsx(TableHead, { children: "Method" }), _jsx(TableHead, { className: "text-right", children: "Amount" })] }) }), _jsxs(TableBody, { children: [_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] })] })] }) }));
31
+ },
32
+ };
@@ -1,8 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from "@/utils/cn";
2
4
  import { useState } from "react";
3
5
  var Tabs = function (_a) {
4
- var tabs = _a.tabs, _b = _a.initialTab, initialTab = _b === void 0 ? 0 : _b;
5
- var _c = useState(initialTab), activeTab = _c[0], setActiveTab = _c[1];
6
- return (_jsxs("div", { className: "tabs", children: [_jsx("div", { className: "tab-buttons", children: tabs.map(function (tab, index) { return (_jsx("button", { className: index === activeTab ? "active" : "", onClick: function () { return setActiveTab(index); }, children: tab.label }, index)); }) }), _jsx("div", { className: "tab-content", children: tabs[activeTab].content })] }));
6
+ var _b;
7
+ var _c = _a.tabs, tabs = _c === void 0 ? [] : _c, _d = _a.initialTab, initialTab = _d === void 0 ? 0 : _d;
8
+ var _e = useState(initialTab), activeTab = _e[0], setActiveTab = _e[1];
9
+ return (_jsxs("div", { className: "w-full space-y-4", children: [_jsx("div", { className: "flex border-b border-primary-10 gap-6 h-[54px] box-border", role: "tablist", children: tabs.map(function (tab, index) { return (_jsxs("button", { role: "tab", "aria-selected": index === activeTab, "aria-controls": "tab-content-".concat(index), id: "tab-".concat(index), className: cn("flex flex-row items-center py-4 px-1 cursor-pointer transition-colors duration-300 box-border gap-3", {
10
+ "typography-body2 text-textcolor-dark border-b-[3px] border-textcolor-dark": index === activeTab,
11
+ "typography-body1 text-textcolor-grey-light border-b-[3px] border-transparent hover:text-textcolor-dark ": index !== activeTab,
12
+ }), onClick: function () { return setActiveTab(index); }, children: [tab.startTabContent, tab.label, tab.endTabContent] }, index)); }) }), _jsx("div", { className: "", role: "tabpanel", id: "tab-content-".concat(activeTab), "aria-labelledby": "tab-".concat(activeTab), children: (_b = tabs[activeTab]) === null || _b === void 0 ? void 0 : _b.content })] }));
7
13
  };
8
14
  export default Tabs;
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import Tabs from "./Tabs";
14
+ import { ChevronDownIcon, ArchiveBoxIcon } from "@heroicons/react/16/solid";
15
+ var meta = {
16
+ title: "Components/Tabs",
17
+ component: Tabs,
18
+ tags: ["autodocs"],
19
+ parameters: {
20
+ layout: "fullscreen",
21
+ },
22
+ decorators: [
23
+ function (Story) { return (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })); },
24
+ ],
25
+ };
26
+ export default meta;
27
+ var tabs = [
28
+ {
29
+ label: "Tab1",
30
+ content: _jsx("p", { children: "Tab 1 content" }),
31
+ },
32
+ {
33
+ label: "Tab2",
34
+ content: _jsx("p", { children: "Tab 2 content" }),
35
+ },
36
+ {
37
+ label: "Tab3",
38
+ content: _jsx("p", { children: "Tab 3 content" }),
39
+ },
40
+ ];
41
+ export var Default = {
42
+ args: {
43
+ initialTab: 0,
44
+ tabs: tabs,
45
+ },
46
+ render: function (args) {
47
+ var props = __assign({}, args);
48
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs, __assign({ tabs: tabs }, props)) }));
49
+ },
50
+ };
51
+ export var CustomTab = {
52
+ args: {
53
+ initialTab: 0,
54
+ tabs: tabs.map(function (tab) { return (__assign(__assign({}, tab), { startTabContent: _jsx(ArchiveBoxIcon, { className: "size-3 " }), endTabContent: _jsx(ChevronDownIcon, { className: "size-3" }) })); }),
55
+ },
56
+ render: function (args) {
57
+ var props = __assign({}, args);
58
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs, __assign({ tabs: tabs }, props)) }));
59
+ },
60
+ };
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- var Text = function (_a) {
2
+ import { forwardRef } from "react";
3
+ var Text = forwardRef(function (_a) {
3
4
  var _b = _a.variant, variant = _b === void 0 ? "body1" : _b, _c = _a.tag, Tag = _c === void 0 ? "p" : _c, children = _a.children, className = _a.className, color = _a.color, style = _a.style;
4
5
  return (_jsx(Tag, { className: "typography-".concat(variant, " text-").concat(color, " ").concat(className), style: style, children: children }));
5
- };
6
+ });
6
7
  export default Text;
@@ -23,10 +23,10 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import { forwardRef, useImperativeHandle, useRef, } from "react";
25
25
  import { helperTextVariant, iconVariant, iconWrapperVariant, inputVariant, labelVariant, } from "./TextInput.styles";
26
- import { twMerge } from "tailwind-merge";
27
26
  import { XCircleIcon, ExclamationCircleIcon } from "@heroicons/react/16/solid";
28
- var TextInput = forwardRef(function (_a, ref) {
29
- var id = _a.id, label = _a.label, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.rounded, rounded = _c === void 0 ? "normal" : _c, _d = _a.variant, variant = _d === void 0 ? "outline" : _d, _e = _a.type, type = _e === void 0 ? "text" : _e, helperText = _a.helperText, errorMessage = _a.errorMessage, _f = _a.fullwidth, fullwidth = _f === void 0 ? true : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? true : _j, _k = _a.hasClearIcon, hasClearIcon = _k === void 0 ? true : _k, endIcon = _a.endIcon, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "type", "helperText", "errorMessage", "fullwidth", "disabled", "error", "required", "hasClearIcon", "endIcon"]);
27
+ import { cn } from "@/utils/cn";
28
+ export var TextInput = forwardRef(function (_a, ref) {
29
+ var id = _a.id, label = _a.label, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.rounded, rounded = _c === void 0 ? "normal" : _c, _d = _a.variant, variant = _d === void 0 ? "outline" : _d, _e = _a.type, type = _e === void 0 ? "text" : _e, helperText = _a.helperText, errorMessage = _a.errorMessage, _f = _a.fullwidth, fullwidth = _f === void 0 ? true : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? true : _j, _k = _a.hasClearIcon, hasClearIcon = _k === void 0 ? true : _k, endIcon = _a.endIcon, labelClassName = _a.labelClassName, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "type", "helperText", "errorMessage", "fullwidth", "disabled", "error", "required", "hasClearIcon", "endIcon", "labelClassName"]);
30
30
  var inputRef = useRef(null);
31
31
  var _id = id || "".concat(type, "-").concat(label, "-input");
32
32
  var inputClassname = inputVariant({
@@ -46,14 +46,12 @@ var TextInput = forwardRef(function (_a, ref) {
46
46
  var helperTextClassname = helperTextVariant({ size: size, error: error, disabled: disabled });
47
47
  var iconWrapperClassname = iconWrapperVariant({ size: size });
48
48
  var iconClassname = iconVariant({ size: size });
49
- useImperativeHandle(ref, function () { return ({
50
- clearInput: handleClearInput,
51
- }); });
49
+ useImperativeHandle(ref, function () { return inputRef === null || inputRef === void 0 ? void 0 : inputRef.current; });
52
50
  var handleClearInput = function () {
53
51
  if (inputRef.current) {
54
52
  inputRef.current.value = "";
55
53
  }
56
54
  };
57
- return (_jsxs("div", { className: "inline-flex flex-col ".concat(fullwidth ? "w-full" : ""), children: [_jsxs("div", { className: "relative", children: [_jsx("input", __assign({}, props, { placeholder: " ", ref: inputRef, type: type, id: _id, disabled: disabled, className: twMerge(inputClassname, props.className) })), hasClearIcon && (_jsx("div", { className: iconWrapperClassname, children: _jsx(XCircleIcon, { type: "button", className: iconClassname, onMouseDown: handleClearInput }) })), endIcon, _jsxs("label", { htmlFor: _id, className: labelClassname, children: [label, " ", required && _jsx("span", { className: "text-error", children: "*" })] })] }), (errorMessage || helperText) && (_jsxs("span", { className: helperTextClassname, children: [_jsx(ExclamationCircleIcon, { width: 16, height: 16, className: error ? "fill-error" : "" }), " ", errorMessage || helperText] }))] }));
55
+ return (_jsxs("div", { className: "inline-flex flex-col ".concat(fullwidth ? "w-full" : ""), children: [_jsxs("div", { className: "relative", children: [_jsx("input", __assign({}, props, { placeholder: " ", ref: inputRef, type: type, id: _id, disabled: disabled, className: cn(inputClassname, props.className) })), hasClearIcon && (_jsx("div", { className: iconWrapperClassname, children: _jsx(XCircleIcon, { type: "button", className: iconClassname, onMouseDown: handleClearInput }) })), endIcon, _jsxs("label", { htmlFor: _id, className: cn(labelClassname, labelClassName), children: [label, " ", required && _jsx("span", { className: "text-error", children: "*" })] })] }), (errorMessage || helperText) && (_jsxs("span", { className: helperTextClassname, children: [_jsx(ExclamationCircleIcon, { width: 16, height: 16, className: error ? "fill-error" : "" }), " ", errorMessage || helperText] }))] }));
58
56
  });
59
57
  export default TextInput;
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useRef } from "react";
13
14
  import TextInput from "./TextInput";
14
15
  // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
15
16
  var meta = {
@@ -37,3 +38,24 @@ export var Default = {
37
38
  return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput, __assign({ id: "1", size: "lg" }, args)), _jsx(TextInput, __assign({ id: "2", size: "md" }, args)), _jsx(TextInput, __assign({ id: "3", size: "sm" }, args))] }));
38
39
  },
39
40
  };
41
+ var InputWithRef = function (props) {
42
+ var inputRef = useRef(null);
43
+ return (_jsx(TextInput, __assign({ id: "1", size: "lg" }, props, { ref: inputRef, labelClassName: "peer-focus:bg-red-500", onKeyDown: function (e) {
44
+ var _a, _b;
45
+ if (e.code === "Enter") {
46
+ (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur) === null || _b === void 0 ? void 0 : _b.call(_a);
47
+ }
48
+ } })));
49
+ };
50
+ export var CustomLabel = {
51
+ args: {
52
+ label: "Lorem Ipsum",
53
+ // value: "Lorem Ipsum",
54
+ fullwidth: true,
55
+ },
56
+ render: function (args) {
57
+ console.log("args ", args);
58
+ var props = __assign({}, args);
59
+ return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput, __assign({ id: "1", size: "lg" }, args, { labelClassName: "peer-focus:bg-red-500" })), _jsx(InputWithRef, __assign({ id: "2", size: "md" }, args)), _jsx(TextInput, __assign({ id: "3", size: "sm" }, args))] }));
60
+ },
61
+ };
@@ -0,0 +1,66 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import * as React from "react";
25
+ import { cn } from "@/utils/cn";
26
+ var Table = React.forwardRef(function (_a, ref) {
27
+ var className = _a.className, props = __rest(_a, ["className"]);
28
+ return (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", __assign({ ref: ref, className: cn("w-full caption-bottom text-sm", className) }, props)) }));
29
+ });
30
+ Table.displayName = "Table";
31
+ var TableHeader = React.forwardRef(function (_a, ref) {
32
+ var className = _a.className, props = __rest(_a, ["className"]);
33
+ return (_jsx("thead", __assign({ ref: ref, className: cn("[&_tr]:border-b", className) }, props)));
34
+ });
35
+ TableHeader.displayName = "TableHeader";
36
+ var TableBody = React.forwardRef(function (_a, ref) {
37
+ var className = _a.className, props = __rest(_a, ["className"]);
38
+ return (_jsx("tbody", __assign({ ref: ref, className: cn("[&_tr:last-child]:border-0", className) }, props)));
39
+ });
40
+ TableBody.displayName = "TableBody";
41
+ var TableFooter = React.forwardRef(function (_a, ref) {
42
+ var className = _a.className, props = __rest(_a, ["className"]);
43
+ return (_jsx("tfoot", __assign({ ref: ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className) }, props)));
44
+ });
45
+ TableFooter.displayName = "TableFooter";
46
+ var TableRow = React.forwardRef(function (_a, ref) {
47
+ var className = _a.className, props = __rest(_a, ["className"]);
48
+ return (_jsx("tr", __assign({ ref: ref, className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className) }, props)));
49
+ });
50
+ TableRow.displayName = "TableRow";
51
+ var TableHead = React.forwardRef(function (_a, ref) {
52
+ var className = _a.className, props = __rest(_a, ["className"]);
53
+ return (_jsx("th", __assign({ ref: ref, className: cn("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", className) }, props)));
54
+ });
55
+ TableHead.displayName = "TableHead";
56
+ var TableCell = React.forwardRef(function (_a, ref) {
57
+ var className = _a.className, props = __rest(_a, ["className"]);
58
+ return (_jsx("td", __assign({ ref: ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className) }, props)));
59
+ });
60
+ TableCell.displayName = "TableCell";
61
+ var TableCaption = React.forwardRef(function (_a, ref) {
62
+ var className = _a.className, props = __rest(_a, ["className"]);
63
+ return (_jsx("caption", __assign({ ref: ref, className: cn("mt-4 text-sm text-muted-foreground", className) }, props)));
64
+ });
65
+ TableCaption.displayName = "TableCaption";
66
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };