oneslash-design-system 1.1.13 → 1.1.15
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/components/iconButton.tsx +54 -66
- package/components/menuItem.tsx +4 -4
- package/components/tab.tsx +6 -6
- package/components/tabsContainer.tsx +23 -0
- package/dist/components/iconButton.d.ts +6 -5
- package/dist/components/iconButton.jsx +47 -113
- package/dist/components/menuItem.d.ts +4 -2
- package/dist/components/menuItem.jsx +4 -3
- package/dist/components/tab.jsx +5 -5
- package/dist/components/tabsContainer.d.ts +6 -0
- package/dist/components/tabsContainer.jsx +9 -0
- package/dist/output.css +26 -25
- package/package.json +3 -3
|
@@ -1,84 +1,74 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React, { useState
|
|
3
|
-
import * as
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import * as HeroIcons24 from '@heroicons/react/24/outline';
|
|
4
|
+
import * as HeroIcons20 from '@heroicons/react/20/solid';
|
|
4
5
|
|
|
5
|
-
interface IconButtonProps{
|
|
6
|
-
|
|
7
|
-
color: "primary" | "secondary";
|
|
6
|
+
interface IconButtonProps {
|
|
7
|
+
color: "primary" | "secondary" | "tertiary" | "iconOnly";
|
|
8
8
|
state: "enabled" | "selected" | "disabled";
|
|
9
|
-
|
|
9
|
+
size: "large" | "medium" | "small";
|
|
10
|
+
iconName: keyof typeof HeroIcons24 & keyof typeof HeroIcons20;
|
|
10
11
|
onClick?: any;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
14
15
|
|
|
15
16
|
export default function IconButton({
|
|
16
|
-
variant,
|
|
17
17
|
color,
|
|
18
18
|
state,
|
|
19
|
+
size,
|
|
19
20
|
iconName,
|
|
20
|
-
|
|
21
|
+
onClick,
|
|
21
22
|
}: IconButtonProps) {
|
|
22
|
-
|
|
23
23
|
const [isHovered, setIsHovered] = useState(false);
|
|
24
|
-
const [Icon, setIcon] = useState<React.ComponentType<React.SVGProps<SVGSVGElement>> | null>(null);
|
|
25
|
-
|
|
26
|
-
// import icon
|
|
27
|
-
const loadIcon = useCallback(async (iconName?: string) => {
|
|
28
|
-
if (!iconName) return null;
|
|
29
|
-
try {
|
|
30
|
-
const module = await import('@heroicons/react/24/outline');
|
|
31
|
-
const Icon = module[iconName as keyof typeof module] as IconType;
|
|
32
|
-
return Icon || null;
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error(`Failed to load icon ${iconName}:`, error);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}, []);
|
|
38
24
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setIcon(await loadIcon(iconName));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
fetchIcons();
|
|
47
|
-
}, [iconName, loadIcon]);
|
|
25
|
+
// Select icon based on size
|
|
26
|
+
const Icon: IconType = size === 'small'
|
|
27
|
+
? HeroIcons20[iconName]
|
|
28
|
+
: HeroIcons24[iconName];
|
|
48
29
|
|
|
30
|
+
// Size-based classes
|
|
31
|
+
const sizeClasses = {
|
|
32
|
+
large: 'p-2', // 8px padding
|
|
33
|
+
medium: 'p-1', // 4px padding
|
|
34
|
+
small: 'p-1', // 4px padding
|
|
35
|
+
};
|
|
49
36
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: '
|
|
37
|
+
const iconSizeClasses = {
|
|
38
|
+
large: 'size-6', // 24px
|
|
39
|
+
medium: 'size-6', // 24px
|
|
40
|
+
small: 'size-5', // 20px
|
|
41
|
+
};
|
|
54
42
|
|
|
55
|
-
//
|
|
56
|
-
const
|
|
57
|
-
? color === 'primary'
|
|
58
|
-
? 'bg-light-primary-main dark:bg-dark-primary-main' // contained && primary
|
|
59
|
-
: 'bg-light-background-accent200 dark:bg-dark-background-accent200' // contained && secondary
|
|
60
|
-
: color === 'primary'
|
|
61
|
-
? ' ' // textOnly && primary
|
|
62
|
-
: ' '; // textOnly && secondary
|
|
43
|
+
// Base classes (padding and corner radius)
|
|
44
|
+
const baseClasses = `${sizeClasses[size]} rounded-[8px] leading-none`;
|
|
63
45
|
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
// Background color
|
|
47
|
+
const bgColor = color === 'primary'
|
|
48
|
+
? 'bg-light-accent-main dark:bg-dark-accent-main' // Primary: accent/main
|
|
49
|
+
: color === 'secondary'
|
|
50
|
+
? 'bg-light-primary-main dark:bg-dark-primary-main' // Secondary: primary/main
|
|
51
|
+
: color === 'tertiary'
|
|
52
|
+
? 'bg-light-background-accent200 dark:bg-dark-background-accent200' // Tertiary: background/accent200
|
|
53
|
+
: ' '; // iconOnly: none
|
|
72
54
|
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
?
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
: color === '
|
|
79
|
-
? '
|
|
80
|
-
: '
|
|
55
|
+
// Background hover color
|
|
56
|
+
const bgColorHover = color === 'primary'
|
|
57
|
+
? 'hover:bg-light-accent-dark hover:dark:bg-dark-accent-dark' // Primary: accent/dark
|
|
58
|
+
: color === 'secondary'
|
|
59
|
+
? 'hover:bg-light-primary-dark hover:dark:bg-dark-primary-dark' // Secondary: primary/dark
|
|
60
|
+
: color === 'tertiary'
|
|
61
|
+
? 'hover:bg-light-background-accent300 hover:dark:bg-dark-background-accent300' // Tertiary: background/accent300
|
|
62
|
+
: 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100'; // iconOnly: background/accent100
|
|
81
63
|
|
|
64
|
+
// Icon color
|
|
65
|
+
const iconColor = color === 'primary'
|
|
66
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Primary: text/primary
|
|
67
|
+
: color === 'secondary'
|
|
68
|
+
? 'text-light-primary-contrast dark:text-dark-primary-contrast' // Secondary: text/contrast
|
|
69
|
+
: color === 'tertiary'
|
|
70
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Tertiary: text/primary
|
|
71
|
+
: 'text-light-text-primary dark:text-dark-text-primary'; // iconOnly: text/primary
|
|
82
72
|
|
|
83
73
|
// state
|
|
84
74
|
const stateClasses = state === 'disabled'
|
|
@@ -89,17 +79,15 @@ export default function IconButton({
|
|
|
89
79
|
? 'cursor-pointer hover:bg-opacity-75'
|
|
90
80
|
: 'cursor-pointer';
|
|
91
81
|
|
|
92
|
-
|
|
93
|
-
|
|
94
82
|
return (
|
|
95
83
|
<button
|
|
96
|
-
className={`${baseClasses} ${bgColor} ${iconColor} ${bgColorHover} ${stateClasses}
|
|
84
|
+
className={`${baseClasses} ${bgColor} ${iconColor} ${bgColorHover} ${stateClasses}`}
|
|
97
85
|
disabled={state === 'disabled'}
|
|
98
86
|
onMouseEnter={() => setIsHovered(true)}
|
|
99
87
|
onMouseLeave={() => setIsHovered(false)}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
onClick={onClick}
|
|
89
|
+
>
|
|
90
|
+
{Icon && <Icon className={iconSizeClasses[size]} />}
|
|
103
91
|
</button>
|
|
104
92
|
);
|
|
105
93
|
}
|
package/components/menuItem.tsx
CHANGED
|
@@ -64,10 +64,10 @@ export default function MenuItem({
|
|
|
64
64
|
>
|
|
65
65
|
{/* render userImage. render dynamic icon if userImage is not available */}
|
|
66
66
|
{userImgUrl || userHandle ? (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl || ''} />
|
|
68
|
+
) : (
|
|
69
|
+
IconLeft && <IconLeft className="w-6 h-6" />
|
|
70
|
+
)}
|
|
71
71
|
|
|
72
72
|
{/* label */}
|
|
73
73
|
<span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
|
package/components/tab.tsx
CHANGED
|
@@ -64,20 +64,20 @@ export default function Tab({
|
|
|
64
64
|
return (
|
|
65
65
|
<div
|
|
66
66
|
className={`
|
|
67
|
-
flex items-center space-x-1
|
|
67
|
+
flex items-center space-x-1 py-1 px-[6px] rounded-[8px] cursor-pointer justify-start transition-all duration-300 ease-in-out
|
|
68
68
|
${isSelected
|
|
69
|
-
? 'bg-light-primary-
|
|
70
|
-
: '
|
|
69
|
+
? 'bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast'
|
|
70
|
+
: 'hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200'}
|
|
71
71
|
`}
|
|
72
72
|
onClick={handleClick}
|
|
73
73
|
>
|
|
74
|
-
{IconLeft && <IconLeft className="w-
|
|
75
|
-
<span className="whitespace-nowrap text-body1 px-
|
|
74
|
+
{IconLeft && <IconLeft className="w-6 h-6" />}
|
|
75
|
+
<span className="whitespace-nowrap text-body1 px-[6px]">
|
|
76
76
|
{label}
|
|
77
77
|
</span>
|
|
78
78
|
{IconRight && (
|
|
79
79
|
<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
80
|
-
<IconRight className="w-
|
|
80
|
+
<IconRight className="w-6 h-6" />
|
|
81
81
|
</div>
|
|
82
82
|
)}
|
|
83
83
|
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface TabsContainerProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function TabsContainer({
|
|
9
|
+
children,
|
|
10
|
+
}: TabsContainerProps) {
|
|
11
|
+
const tabCount = React.Children.count(children);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={`
|
|
16
|
+
flex space-x-2 p-1 rounded-[12px]
|
|
17
|
+
${tabCount > 0 ? 'bg-light-background-accent200 dark:bg-dark-background-accent200' : 'bg-transparent'}
|
|
18
|
+
`}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import * as
|
|
2
|
+
import * as HeroIcons24 from '@heroicons/react/24/outline';
|
|
3
|
+
import * as HeroIcons20 from '@heroicons/react/20/solid';
|
|
3
4
|
interface IconButtonProps {
|
|
4
|
-
|
|
5
|
-
color: "primary" | "secondary";
|
|
5
|
+
color: "primary" | "secondary" | "tertiary" | "iconOnly";
|
|
6
6
|
state: "enabled" | "selected" | "disabled";
|
|
7
|
-
|
|
7
|
+
size: "large" | "medium" | "small";
|
|
8
|
+
iconName: keyof typeof HeroIcons24 & keyof typeof HeroIcons20;
|
|
8
9
|
onClick?: any;
|
|
9
10
|
}
|
|
10
|
-
export default function IconButton({
|
|
11
|
+
export default function IconButton({ color, state, size, iconName, onClick, }: IconButtonProps): React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,117 +1,51 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import * as HeroIcons24 from '@heroicons/react/24/outline';
|
|
4
|
+
import * as HeroIcons20 from '@heroicons/react/20/solid';
|
|
39
5
|
export default function IconButton(_a) {
|
|
40
|
-
var
|
|
41
|
-
var variant = _a.variant, color = _a.color, state = _a.state, iconName = _a.iconName, onClick = _a.onClick;
|
|
6
|
+
var color = _a.color, state = _a.state, size = _a.size, iconName = _a.iconName, onClick = _a.onClick;
|
|
42
7
|
var _b = useState(false), isHovered = _b[0], setIsHovered = _b[1];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}); };
|
|
85
|
-
fetchIcons();
|
|
86
|
-
}, [iconName, loadIcon]);
|
|
87
|
-
// padding, corner
|
|
88
|
-
var baseClasses = variant === 'contained'
|
|
89
|
-
? 'p-2 rounded-[8px] leading-none '
|
|
90
|
-
: 'p-2 rounded-[8px] leading-none ';
|
|
91
|
-
// bg color
|
|
92
|
-
var bgColor = variant === 'contained'
|
|
93
|
-
? color === 'primary'
|
|
94
|
-
? 'bg-light-primary-main dark:bg-dark-primary-main' // contained && primary
|
|
95
|
-
: 'bg-light-background-accent200 dark:bg-dark-background-accent200' // contained && secondary
|
|
96
|
-
: color === 'primary'
|
|
97
|
-
? ' ' // textOnly && primary
|
|
98
|
-
: ' '; // textOnly && secondary
|
|
99
|
-
// bg color hover
|
|
100
|
-
var bgColorHover = variant === 'contained'
|
|
101
|
-
? color === 'primary'
|
|
102
|
-
? 'hover:bg-light-primary-dark hover:dark:bg-dark-primary-dark' // contained && primary
|
|
103
|
-
: 'hover:bg-light-background-accent300 hover:dark:bg-dark-background-accent300' // contained && secondary
|
|
104
|
-
: color === 'primary'
|
|
105
|
-
? 'hover:bg-light-action-hover hover:dark:bg-dark-action-hover' // textOnly && primary
|
|
106
|
-
: 'hover:bg-light-action-hover hover:dark:bg-dark-action-hover'; // textOnly && secondary
|
|
107
|
-
// icon color
|
|
108
|
-
var iconColor = variant === 'contained'
|
|
109
|
-
? color === 'primary'
|
|
110
|
-
? 'text-light-primary-contrast dark:text-dark-primary-contrast' // contained && primary
|
|
111
|
-
: 'text-light-text-primary dark:text-dark-text-primary' // contained && secondary
|
|
112
|
-
: color === 'primary'
|
|
113
|
-
? ' text-light-text-primary dark:text-dark-text-primary' // textOnly && primary
|
|
114
|
-
: ' text-light-text-primary dark:text-dark-text-primary'; // textOnly && secondary
|
|
8
|
+
// Select icon based on size
|
|
9
|
+
var Icon = size === 'small'
|
|
10
|
+
? HeroIcons20[iconName]
|
|
11
|
+
: HeroIcons24[iconName];
|
|
12
|
+
// Size-based classes
|
|
13
|
+
var sizeClasses = {
|
|
14
|
+
large: 'p-2', // 8px padding
|
|
15
|
+
medium: 'p-1', // 4px padding
|
|
16
|
+
small: 'p-1', // 4px padding
|
|
17
|
+
};
|
|
18
|
+
var iconSizeClasses = {
|
|
19
|
+
large: 'size-6', // 24px
|
|
20
|
+
medium: 'size-6', // 24px
|
|
21
|
+
small: 'size-5', // 20px
|
|
22
|
+
};
|
|
23
|
+
// Base classes (padding and corner radius)
|
|
24
|
+
var baseClasses = "".concat(sizeClasses[size], " rounded-[8px] leading-none");
|
|
25
|
+
// Background color
|
|
26
|
+
var bgColor = color === 'primary'
|
|
27
|
+
? 'bg-light-accent-main dark:bg-dark-accent-main' // Primary: accent/main
|
|
28
|
+
: color === 'secondary'
|
|
29
|
+
? 'bg-light-primary-main dark:bg-dark-primary-main' // Secondary: primary/main
|
|
30
|
+
: color === 'tertiary'
|
|
31
|
+
? 'bg-light-background-accent200 dark:bg-dark-background-accent200' // Tertiary: background/accent200
|
|
32
|
+
: ' '; // iconOnly: none
|
|
33
|
+
// Background hover color
|
|
34
|
+
var bgColorHover = color === 'primary'
|
|
35
|
+
? 'hover:bg-light-accent-dark hover:dark:bg-dark-accent-dark' // Primary: accent/dark
|
|
36
|
+
: color === 'secondary'
|
|
37
|
+
? 'hover:bg-light-primary-dark hover:dark:bg-dark-primary-dark' // Secondary: primary/dark
|
|
38
|
+
: color === 'tertiary'
|
|
39
|
+
? 'hover:bg-light-background-accent300 hover:dark:bg-dark-background-accent300' // Tertiary: background/accent300
|
|
40
|
+
: 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100'; // iconOnly: background/accent100
|
|
41
|
+
// Icon color
|
|
42
|
+
var iconColor = color === 'primary'
|
|
43
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Primary: text/primary
|
|
44
|
+
: color === 'secondary'
|
|
45
|
+
? 'text-light-primary-contrast dark:text-dark-primary-contrast' // Secondary: text/contrast
|
|
46
|
+
: color === 'tertiary'
|
|
47
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Tertiary: text/primary
|
|
48
|
+
: 'text-light-text-primary dark:text-dark-text-primary'; // iconOnly: text/primary
|
|
115
49
|
// state
|
|
116
50
|
var stateClasses = state === 'disabled'
|
|
117
51
|
? 'cursor-not-allowed opacity-50'
|
|
@@ -120,7 +54,7 @@ export default function IconButton(_a) {
|
|
|
120
54
|
: isHovered
|
|
121
55
|
? 'cursor-pointer hover:bg-opacity-75'
|
|
122
56
|
: 'cursor-pointer';
|
|
123
|
-
return (<button className={"".concat(baseClasses, " ").concat(bgColor, " ").concat(iconColor, " ").concat(bgColorHover, " ").concat(stateClasses
|
|
124
|
-
|
|
57
|
+
return (<button className={"".concat(baseClasses, " ").concat(bgColor, " ").concat(iconColor, " ").concat(bgColorHover, " ").concat(stateClasses)} disabled={state === 'disabled'} onMouseEnter={function () { return setIsHovered(true); }} onMouseLeave={function () { return setIsHovered(false); }} onClick={onClick}>
|
|
58
|
+
{Icon && <Icon className={iconSizeClasses[size]}/>}
|
|
125
59
|
</button>);
|
|
126
60
|
}
|
|
@@ -2,9 +2,11 @@ import React from 'react';
|
|
|
2
2
|
interface MenuItemProps {
|
|
3
3
|
href?: string;
|
|
4
4
|
iconName?: string;
|
|
5
|
+
userHandle?: string;
|
|
6
|
+
userImgUrl?: string;
|
|
5
7
|
label: string;
|
|
6
8
|
isSelected?: boolean;
|
|
7
|
-
onClick
|
|
9
|
+
onClick?: any;
|
|
8
10
|
}
|
|
9
|
-
export default function MenuItem({ href, iconName, label, isSelected, onClick, }: MenuItemProps): React.JSX.Element;
|
|
11
|
+
export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, isSelected, onClick, }: MenuItemProps): React.JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -37,10 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
39
39
|
import NextLink from 'next/link';
|
|
40
|
+
import UserImage from './userImage';
|
|
40
41
|
export default function MenuItem(_a) {
|
|
41
42
|
var _this = this;
|
|
42
|
-
var _b = _a.href, href = _b === void 0 ? '#' : _b, iconName = _a.iconName, label = _a.label, isSelected = _a.isSelected, onClick = _a.onClick;
|
|
43
|
-
var _c = useState(null),
|
|
43
|
+
var _b = _a.href, href = _b === void 0 ? '#' : _b, iconName = _a.iconName, userHandle = _a.userHandle, userImgUrl = _a.userImgUrl, label = _a.label, isSelected = _a.isSelected, onClick = _a.onClick;
|
|
44
|
+
var _c = useState(null), IconLeft = _c[0], setIconLeft = _c[1];
|
|
44
45
|
// Import icon dynamically
|
|
45
46
|
var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
|
|
46
47
|
var module_1, IconComponent, error_1;
|
|
@@ -72,7 +73,7 @@ export default function MenuItem(_a) {
|
|
|
72
73
|
switch (_b.label) {
|
|
73
74
|
case 0:
|
|
74
75
|
if (!iconName) return [3 /*break*/, 2];
|
|
75
|
-
_a =
|
|
76
|
+
_a = setIconLeft;
|
|
76
77
|
return [4 /*yield*/, loadIcon(iconName)];
|
|
77
78
|
case 1:
|
|
78
79
|
_a.apply(void 0, [_b.sent()]);
|
package/dist/components/tab.jsx
CHANGED
|
@@ -99,15 +99,15 @@ export default function Tab(_a) {
|
|
|
99
99
|
router.push(href);
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
-
return (<div className={"\n flex items-center space-x-1
|
|
102
|
+
return (<div className={"\n flex items-center space-x-1 py-1 px-[6px] rounded-[8px] cursor-pointer justify-start transition-all duration-300 ease-in-out\n ".concat(isSelected
|
|
103
103
|
? 'bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast'
|
|
104
|
-
: '
|
|
105
|
-
{IconLeft && <IconLeft className="w-
|
|
106
|
-
<span className="whitespace-nowrap text-body1 px-
|
|
104
|
+
: 'hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200', "\n ")} onClick={handleClick}>
|
|
105
|
+
{IconLeft && <IconLeft className="w-6 h-6"/>}
|
|
106
|
+
<span className="whitespace-nowrap text-body1 px-[6px]">
|
|
107
107
|
{label}
|
|
108
108
|
</span>
|
|
109
109
|
{IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
110
|
-
<IconRight className="w-
|
|
110
|
+
<IconRight className="w-6 h-6"/>
|
|
111
111
|
</div>)}
|
|
112
112
|
</div>);
|
|
113
113
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function TabsContainer(_a) {
|
|
4
|
+
var children = _a.children;
|
|
5
|
+
var tabCount = React.Children.count(children);
|
|
6
|
+
return (<div className={"\n flex space-x-2 p-1 rounded-[12px]\n ".concat(tabCount > 0 ? 'bg-light-background-accent200 dark:bg-dark-background-accent200' : 'bg-transparent', "\n ")}>
|
|
7
|
+
{children}
|
|
8
|
+
</div>);
|
|
9
|
+
}
|
package/dist/output.css
CHANGED
|
@@ -556,6 +556,10 @@ video {
|
|
|
556
556
|
.flex {
|
|
557
557
|
display: flex;
|
|
558
558
|
}
|
|
559
|
+
.size-5 {
|
|
560
|
+
width: 1.25rem;
|
|
561
|
+
height: 1.25rem;
|
|
562
|
+
}
|
|
559
563
|
.size-6 {
|
|
560
564
|
width: 1.5rem;
|
|
561
565
|
height: 1.5rem;
|
|
@@ -698,6 +702,9 @@ video {
|
|
|
698
702
|
.rounded {
|
|
699
703
|
border-radius: 0.25rem;
|
|
700
704
|
}
|
|
705
|
+
.rounded-\[12px\] {
|
|
706
|
+
border-radius: 12px;
|
|
707
|
+
}
|
|
701
708
|
.rounded-\[8px\] {
|
|
702
709
|
border-radius: 8px;
|
|
703
710
|
}
|
|
@@ -755,10 +762,6 @@ video {
|
|
|
755
762
|
--tw-bg-opacity: 1;
|
|
756
763
|
background-color: rgb(238 174 3 / var(--tw-bg-opacity));
|
|
757
764
|
}
|
|
758
|
-
.bg-light-action-selected {
|
|
759
|
-
--tw-bg-opacity: 1;
|
|
760
|
-
background-color: rgb(227 227 227 / var(--tw-bg-opacity));
|
|
761
|
-
}
|
|
762
765
|
.bg-light-actionBackground-disabled {
|
|
763
766
|
--tw-bg-opacity: 1;
|
|
764
767
|
background-color: rgb(238 238 238 / var(--tw-bg-opacity));
|
|
@@ -783,6 +786,10 @@ video {
|
|
|
783
786
|
--tw-bg-opacity: 1;
|
|
784
787
|
background-color: rgb(0 135 212 / var(--tw-bg-opacity));
|
|
785
788
|
}
|
|
789
|
+
.bg-light-primary-dark {
|
|
790
|
+
--tw-bg-opacity: 1;
|
|
791
|
+
background-color: rgb(38 38 38 / var(--tw-bg-opacity));
|
|
792
|
+
}
|
|
786
793
|
.bg-light-primary-main {
|
|
787
794
|
--tw-bg-opacity: 1;
|
|
788
795
|
background-color: rgb(69 69 69 / var(--tw-bg-opacity));
|
|
@@ -824,6 +831,10 @@ video {
|
|
|
824
831
|
padding-left: 0.5rem;
|
|
825
832
|
padding-right: 0.5rem;
|
|
826
833
|
}
|
|
834
|
+
.px-\[6px\] {
|
|
835
|
+
padding-left: 6px;
|
|
836
|
+
padding-right: 6px;
|
|
837
|
+
}
|
|
827
838
|
.py-1 {
|
|
828
839
|
padding-top: 0.25rem;
|
|
829
840
|
padding-bottom: 0.25rem;
|
|
@@ -978,24 +989,19 @@ body {
|
|
|
978
989
|
background-color: rgb(206 134 2 / var(--tw-bg-opacity));
|
|
979
990
|
}
|
|
980
991
|
|
|
981
|
-
.hover\:bg-light-action-hover:hover {
|
|
982
|
-
--tw-bg-opacity: 1;
|
|
983
|
-
background-color: rgb(243 243 243 / var(--tw-bg-opacity));
|
|
984
|
-
}
|
|
985
|
-
|
|
986
992
|
.hover\:bg-light-background-accent100:hover {
|
|
987
993
|
--tw-bg-opacity: 1;
|
|
988
994
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
|
989
995
|
}
|
|
990
996
|
|
|
991
|
-
.hover\:bg-light-background-
|
|
997
|
+
.hover\:bg-light-background-accent200:hover {
|
|
992
998
|
--tw-bg-opacity: 1;
|
|
993
|
-
background-color: rgb(
|
|
999
|
+
background-color: rgb(250 250 250 / var(--tw-bg-opacity));
|
|
994
1000
|
}
|
|
995
1001
|
|
|
996
|
-
.hover\:bg-light-background-
|
|
1002
|
+
.hover\:bg-light-background-accent300:hover {
|
|
997
1003
|
--tw-bg-opacity: 1;
|
|
998
|
-
background-color: rgb(
|
|
1004
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
999
1005
|
}
|
|
1000
1006
|
|
|
1001
1007
|
.hover\:bg-light-primary-dark:hover {
|
|
@@ -1034,11 +1040,6 @@ body {
|
|
|
1034
1040
|
background-color: rgb(255 205 41 / var(--tw-bg-opacity));
|
|
1035
1041
|
}
|
|
1036
1042
|
|
|
1037
|
-
.dark\:bg-dark-action-selected {
|
|
1038
|
-
--tw-bg-opacity: 1;
|
|
1039
|
-
background-color: rgb(78 78 78 / var(--tw-bg-opacity));
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
1043
|
.dark\:bg-dark-actionBackground-disabled {
|
|
1043
1044
|
--tw-bg-opacity: 1;
|
|
1044
1045
|
background-color: rgb(56 56 56 / var(--tw-bg-opacity));
|
|
@@ -1069,6 +1070,11 @@ body {
|
|
|
1069
1070
|
background-color: rgb(0 175 255 / var(--tw-bg-opacity));
|
|
1070
1071
|
}
|
|
1071
1072
|
|
|
1073
|
+
.dark\:bg-dark-primary-dark {
|
|
1074
|
+
--tw-bg-opacity: 1;
|
|
1075
|
+
background-color: rgb(233 233 233 / var(--tw-bg-opacity));
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1072
1078
|
.dark\:bg-dark-primary-main {
|
|
1073
1079
|
--tw-bg-opacity: 1;
|
|
1074
1080
|
background-color: rgb(213 213 213 / var(--tw-bg-opacity));
|
|
@@ -1138,9 +1144,9 @@ body {
|
|
|
1138
1144
|
background-color: rgb(78 78 78 / var(--tw-bg-opacity));
|
|
1139
1145
|
}
|
|
1140
1146
|
|
|
1141
|
-
.dark\:hover\:bg-dark-
|
|
1147
|
+
.dark\:hover\:bg-dark-background-accent200:hover {
|
|
1142
1148
|
--tw-bg-opacity: 1;
|
|
1143
|
-
background-color: rgb(
|
|
1149
|
+
background-color: rgb(69 69 69 / var(--tw-bg-opacity));
|
|
1144
1150
|
}
|
|
1145
1151
|
|
|
1146
1152
|
.dark\:hover\:bg-dark-background-accent300:hover {
|
|
@@ -1158,11 +1164,6 @@ body {
|
|
|
1158
1164
|
background-color: rgb(206 134 2 / var(--tw-bg-opacity));
|
|
1159
1165
|
}
|
|
1160
1166
|
|
|
1161
|
-
.hover\:dark\:bg-dark-action-hover:hover {
|
|
1162
|
-
--tw-bg-opacity: 1;
|
|
1163
|
-
background-color: rgb(61 61 61 / var(--tw-bg-opacity));
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
1167
|
.hover\:dark\:bg-dark-background-accent100:hover {
|
|
1167
1168
|
--tw-bg-opacity: 1;
|
|
1168
1169
|
background-color: rgb(51 51 51 / var(--tw-bg-opacity));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneslash-design-system",
|
|
3
3
|
"description": "A design system for the Oneslash projects",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.15",
|
|
5
5
|
"private": false,
|
|
6
|
-
"main": "./dist/index.js",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "next dev",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint": "next lint"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@heroicons/react": "^2.
|
|
16
|
+
"@heroicons/react": "^2.2.0",
|
|
17
17
|
"@popperjs/core": "^2.11.8",
|
|
18
18
|
"next": "14.2.13",
|
|
19
19
|
"react": "^18",
|