@enderfall/ui 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enderfall/ui",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -0,0 +1,108 @@
1
+ .ef-tabs {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 12px;
5
+ width: 100%;
6
+ }
7
+
8
+ .ef-tabs--vertical {
9
+ flex-direction: row;
10
+ align-items: flex-start;
11
+ }
12
+
13
+ .ef-tabs-list {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ gap: 10px;
17
+ padding: 10px;
18
+ border-radius: 16px;
19
+ background:
20
+ linear-gradient(#0b0c1a, #0b0c1a) padding-box,
21
+ linear-gradient(135deg, rgba(0, 229, 255, 0.5), rgba(124, 77, 255, 0.5), rgba(255, 77, 210, 0.5)) border-box;
22
+ border: 1px solid transparent;
23
+ }
24
+
25
+ .ef-tabs-list--vertical {
26
+ flex-direction: column;
27
+ min-width: 220px;
28
+ }
29
+
30
+ .ef-tab {
31
+ border: 2px solid transparent;
32
+ padding: 8px 18px;
33
+ border-radius: 8px;
34
+ background: rgba(15, 18, 28, 0.7);
35
+ color: rgba(238, 241, 246, 0.75);
36
+ font-weight: 600;
37
+ cursor: pointer;
38
+ font-family: inherit;
39
+ letter-spacing: 0.08em;
40
+ transition: color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
41
+ display: inline-flex;
42
+ align-items: center;
43
+ gap: 8px;
44
+ }
45
+
46
+ .ef-tab:hover {
47
+ color: #eef1f6;
48
+ box-shadow: 0 0 18px rgba(124, 77, 255, 0.35);
49
+ transform: translateY(-1px);
50
+ }
51
+
52
+ .ef-tab.is-active {
53
+ background:
54
+ linear-gradient(#0b0c1a, #0b0c1a) padding-box,
55
+ linear-gradient(135deg, #00e5ff, #7c4dff, #ff4dd2, #ffb74d) border-box;
56
+ color: #f6f5ff;
57
+ box-shadow: 0 0 32px rgba(124, 77, 255, 0.65);
58
+ }
59
+
60
+ .ef-tab--vertical {
61
+ width: 100%;
62
+ justify-content: flex-start;
63
+ }
64
+
65
+ .ef-tab-icon {
66
+ display: inline-flex;
67
+ }
68
+
69
+ .ef-tab-text {
70
+ display: inline-flex;
71
+ }
72
+
73
+ .ef-tab-active-indicator {
74
+ margin-left: auto;
75
+ width: 2px;
76
+ height: 22px;
77
+ border-radius: 999px;
78
+ background: linear-gradient(180deg, #00e5ff, #7c4dff, #ff4dd2);
79
+ }
80
+
81
+ .ef-tabs-content {
82
+ min-width: 0;
83
+ flex: 1;
84
+ }
85
+
86
+ .ef-tabs-content--background {
87
+ border-radius: 16px;
88
+ padding: 12px;
89
+ background:
90
+ linear-gradient(#0b0c1a, #0b0c1a) padding-box,
91
+ linear-gradient(135deg, rgba(0, 229, 255, 0.35), rgba(124, 77, 255, 0.35), rgba(255, 77, 210, 0.35)) border-box;
92
+ border: 1px solid transparent;
93
+ }
94
+
95
+ @media (max-width: 768px) {
96
+ .ef-tabs--vertical {
97
+ flex-direction: column;
98
+ }
99
+
100
+ .ef-tabs-list--vertical {
101
+ min-width: 100%;
102
+ }
103
+
104
+ .ef-tab {
105
+ width: 100%;
106
+ justify-content: flex-start;
107
+ }
108
+ }
@@ -0,0 +1,68 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export type TabsItem = {
4
+ id: string;
5
+ label: string;
6
+ icon?: ReactNode;
7
+ content?: ReactNode;
8
+ };
9
+
10
+ type TabsProps = {
11
+ tabs: TabsItem[];
12
+ activeTab: string;
13
+ onChange: (tabId: string) => void;
14
+ orientation?: "horizontal" | "vertical";
15
+ showContentBackground?: boolean;
16
+ className?: string;
17
+ tabContentClassName?: string;
18
+ renderTabContent?: (tab: TabsItem) => ReactNode;
19
+ };
20
+
21
+ export const Tabs = ({
22
+ tabs,
23
+ activeTab,
24
+ onChange,
25
+ orientation = "horizontal",
26
+ showContentBackground = false,
27
+ className,
28
+ tabContentClassName,
29
+ renderTabContent,
30
+ }: TabsProps) => {
31
+ const isVertical = orientation === "vertical";
32
+ const active = tabs.find((tab) => tab.id === activeTab);
33
+
34
+ return (
35
+ <div className={["ef-tabs", isVertical ? "ef-tabs--vertical" : "", className].filter(Boolean).join(" ")}>
36
+ <div className={["ef-tabs-list", isVertical ? "ef-tabs-list--vertical" : ""].filter(Boolean).join(" ")}>
37
+ {tabs.map((tab) => (
38
+ <button
39
+ key={tab.id}
40
+ type="button"
41
+ className={["ef-tab", isVertical ? "ef-tab--vertical" : "", tab.id === activeTab ? "is-active" : ""]
42
+ .filter(Boolean)
43
+ .join(" ")}
44
+ onClick={() => onChange(tab.id)}
45
+ >
46
+ {tab.icon ? <span className="ef-tab-icon">{tab.icon}</span> : null}
47
+ <span className="ef-tab-text">{tab.label}</span>
48
+ {isVertical && tab.id === activeTab ? <span className="ef-tab-active-indicator" /> : null}
49
+ </button>
50
+ ))}
51
+ </div>
52
+
53
+ {(active?.content || renderTabContent) && (
54
+ <div
55
+ className={[
56
+ "ef-tabs-content",
57
+ showContentBackground ? "ef-tabs-content--background" : "",
58
+ tabContentClassName,
59
+ ]
60
+ .filter(Boolean)
61
+ .join(" ")}
62
+ >
63
+ {renderTabContent ? renderTabContent(active as TabsItem) : active?.content}
64
+ </div>
65
+ )}
66
+ </div>
67
+ );
68
+ };
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export { PreferencesModal } from "./components/PreferencesModal";
13
13
  export { Toggle } from "./components/Toggle";
14
14
  export { Slider } from "./components/Slider";
15
15
  export { StatDots } from "./components/StatDots";
16
+ export { Tabs } from "./components/Tabs";
16
17
  export { SideMenu, SideMenuSubmenu } from "./components/SideMenu";
17
18
 
18
19
  type ThemeOptions<T extends ThemeMode> = {
package/styles.css CHANGED
@@ -7,6 +7,7 @@
7
7
  @import "./src/components/Input.css";
8
8
  @import "./src/components/Toggle.css";
9
9
  @import "./src/components/Slider.css";
10
+ @import "./src/components/Tabs.css";
10
11
  @import "./src/components/StackedCard.css";
11
12
  @import "./src/components/Panel.css";
12
13
  @import "./src/components/Modal.css";