@rovula/ui 0.0.9 → 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.
- package/dist/cjs/bundle.css +429 -3
- package/dist/cjs/bundle.js +1 -1
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/AlertDialog/Alert.stories.d.ts +20 -0
- package/dist/cjs/types/components/AlertDialog/AlertDialog.d.ts +20 -0
- package/dist/cjs/types/components/Button/Button.styles.d.ts +1 -1
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
- package/dist/cjs/types/components/Dialog/Dialog.d.ts +19 -0
- package/dist/cjs/types/components/Dialog/Dialog.stories.d.ts +25 -0
- package/dist/cjs/types/components/Input/Input.d.ts +5 -0
- package/dist/cjs/types/components/Input/Input.stories.d.ts +314 -0
- package/dist/cjs/types/components/Label/Label.d.ts +5 -0
- package/dist/cjs/types/components/Label/Label.stories.d.ts +286 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
- package/dist/cjs/types/components/Table/Datagrid.d.ts +11 -0
- package/dist/cjs/types/components/Table/Table.d.ts +10 -11
- package/dist/cjs/types/components/Table/Table.stories.d.ts +283 -0
- package/dist/cjs/types/components/Tabs/Tabs.d.ts +7 -5
- package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +49 -0
- package/dist/cjs/types/index.d.ts +7 -1
- package/dist/cjs/types/utils/cn.d.ts +2 -0
- package/dist/components/AlertDialog/Alert.stories.js +39 -0
- package/dist/components/AlertDialog/AlertDialog.js +73 -0
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button.styles.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +37 -0
- package/dist/components/Checkbox/Checkbox.stories.js +49 -0
- package/dist/components/Dialog/Dialog.js +63 -0
- package/dist/components/Dialog/Dialog.stories.js +52 -0
- package/dist/components/Input/Input.js +31 -0
- package/dist/components/Input/Input.stories.js +37 -0
- package/dist/components/Label/Label.js +35 -0
- package/dist/components/Label/Label.stories.js +38 -0
- package/dist/components/RadioGroup/RadioGroup.js +41 -0
- package/dist/components/RadioGroup/RadioGroup.stories.js +44 -0
- package/dist/components/Table/Datagrid.js +6 -0
- package/dist/components/Table/Table.js +65 -5
- package/dist/components/Table/Table.stories.js +32 -0
- package/dist/components/Tabs/Tabs.js +10 -4
- package/dist/components/Tabs/Tabs.stories.js +60 -0
- package/dist/esm/bundle.css +429 -3
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/AlertDialog/Alert.stories.d.ts +20 -0
- package/dist/esm/types/components/AlertDialog/AlertDialog.d.ts +20 -0
- package/dist/esm/types/components/Button/Button.styles.d.ts +1 -1
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +308 -0
- package/dist/esm/types/components/Dialog/Dialog.d.ts +19 -0
- package/dist/esm/types/components/Dialog/Dialog.stories.d.ts +25 -0
- package/dist/esm/types/components/Input/Input.d.ts +5 -0
- package/dist/esm/types/components/Input/Input.stories.d.ts +314 -0
- package/dist/esm/types/components/Label/Label.d.ts +5 -0
- package/dist/esm/types/components/Label/Label.stories.d.ts +286 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +299 -0
- package/dist/esm/types/components/Table/Datagrid.d.ts +11 -0
- package/dist/esm/types/components/Table/Table.d.ts +10 -11
- package/dist/esm/types/components/Table/Table.stories.d.ts +283 -0
- package/dist/esm/types/components/Tabs/Tabs.d.ts +7 -5
- package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +49 -0
- package/dist/esm/types/index.d.ts +7 -1
- package/dist/esm/types/utils/cn.d.ts +2 -0
- package/dist/index.d.ts +82 -28
- package/dist/index.js +7 -1
- package/dist/src/theme/global.css +511 -3
- package/dist/theme/global.css +57 -0
- package/dist/theme/main-preset.js +29 -1
- package/dist/theme/presets/colors.js +19 -0
- package/dist/utils/cn.js +9 -0
- package/package.json +9 -1
- package/src/components/AlertDialog/Alert.stories.tsx +67 -0
- package/src/components/AlertDialog/AlertDialog.tsx +142 -0
- package/src/components/Button/Button.styles.ts +1 -1
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Checkbox/Checkbox.stories.tsx +91 -0
- package/src/components/Checkbox/Checkbox.tsx +36 -0
- package/src/components/Dialog/Dialog.stories.tsx +118 -0
- package/src/components/Dialog/Dialog.tsx +119 -0
- package/src/components/Input/Input.stories.tsx +40 -0
- package/src/components/Input/Input.tsx +25 -0
- package/src/components/Label/Label.stories.tsx +45 -0
- package/src/components/Label/Label.tsx +26 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +71 -0
- package/src/components/RadioGroup/RadioGroup.tsx +59 -0
- package/src/components/Table/Datagrid.tsx +36 -0
- package/src/components/Table/Table.stories.tsx +79 -0
- package/src/components/Table/Table.tsx +116 -35
- package/src/components/Tabs/Tabs.stories.tsx +75 -0
- package/src/components/Tabs/Tabs.tsx +39 -10
- package/src/index.ts +8 -1
- package/src/theme/global.css +57 -0
- package/src/theme/main-preset.js +29 -1
- package/src/theme/presets/colors.js +19 -0
- package/src/utils/cn.ts +6 -0
|
@@ -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
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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="
|
|
18
|
-
<div
|
|
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
|
-
|
|
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
|
|
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
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
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";
|
|
10
15
|
|
|
11
16
|
// UTILS
|
|
12
17
|
export {
|
|
@@ -17,6 +22,8 @@ export {
|
|
|
17
22
|
getTimestampUTC,
|
|
18
23
|
} from "./utils/datetime";
|
|
19
24
|
|
|
25
|
+
export { cn } from "./utils/cn";
|
|
26
|
+
|
|
20
27
|
// const mainPreset = require("./theme/main-preset");
|
|
21
28
|
|
|
22
29
|
// export { mainPreset };
|
package/src/theme/global.css
CHANGED
|
@@ -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
|
}
|
package/src/theme/main-preset.js
CHANGED
|
@@ -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
|
},
|