oneslash-design-system 1.2.23 → 1.2.25
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/components/alert.d.ts +4 -2
- package/dist/components/alert.jsx +18 -13
- package/dist/components/button.d.ts +2 -1
- package/dist/components/button.jsx +5 -2
- package/dist/components/checkBox.d.ts +3 -1
- package/dist/components/checkBox.jsx +28 -9
- package/dist/components/emptyBox.d.ts +2 -1
- package/dist/components/emptyBox.jsx +9 -4
- package/dist/components/icon.d.ts +12 -0
- package/dist/components/icon.jsx +30 -0
- package/dist/components/iconButton.jsx +28 -22
- package/dist/components/line.d.ts +7 -0
- package/dist/components/line.jsx +10 -0
- package/dist/components/link.d.ts +11 -0
- package/dist/components/link.jsx +59 -0
- package/dist/components/menuItem.d.ts +2 -1
- package/dist/components/menuItem.jsx +12 -7
- package/dist/components/modal.d.ts +3 -2
- package/dist/components/modal.jsx +43 -23
- package/dist/components/radioGroup.d.ts +1 -0
- package/dist/components/radioGroup.jsx +4 -1
- package/dist/components/tab.d.ts +6 -1
- package/dist/components/tab.jsx +11 -9
- package/dist/components/tabsContainer.jsx +4 -1
- package/dist/components/tag.d.ts +6 -3
- package/dist/components/tag.jsx +88 -28
- package/dist/components/textField.d.ts +5 -2
- package/dist/components/textField.jsx +29 -16
- package/dist/components/textarea.d.ts +4 -2
- package/dist/components/textarea.jsx +31 -11
- package/dist/output.css +600 -385
- package/dist/stories/Alert.stories.d.ts +15 -0
- package/dist/stories/Alert.stories.jsx +121 -0
- package/dist/stories/Button.stories.d.ts +12 -0
- package/dist/stories/Button.stories.jsx +81 -0
- package/dist/stories/Checkbox.stories.d.ts +10 -0
- package/dist/stories/Checkbox.stories.jsx +45 -0
- package/dist/stories/EmptyBox.stories.d.ts +7 -0
- package/dist/stories/EmptyBox.stories.jsx +30 -0
- package/dist/stories/Icon.stories.d.ts +13 -0
- package/dist/stories/Icon.stories.jsx +130 -0
- package/dist/stories/IconButton.stories.d.ts +13 -0
- package/dist/stories/IconButton.stories.jsx +87 -0
- package/dist/stories/Line.stories.d.ts +9 -0
- package/dist/stories/Line.stories.jsx +64 -0
- package/dist/stories/Link.stories.d.ts +10 -0
- package/dist/stories/Link.stories.jsx +59 -0
- package/dist/stories/LoadingScreen.stories.d.ts +10 -0
- package/dist/stories/LoadingScreen.stories.jsx +39 -0
- package/dist/stories/Menu.stories.d.ts +8 -0
- package/dist/stories/Menu.stories.jsx +42 -0
- package/dist/stories/MenuItem.stories.d.ts +11 -0
- package/dist/stories/MenuItem.stories.jsx +62 -0
- package/dist/stories/Modal.stories.d.ts +10 -0
- package/dist/stories/Modal.stories.jsx +77 -0
- package/dist/stories/Navigation.stories.d.ts +7 -0
- package/dist/stories/Navigation.stories.jsx +31 -0
- package/dist/stories/Popover.stories.d.ts +7 -0
- package/dist/stories/Popover.stories.jsx +47 -0
- package/dist/stories/RadioGroup.stories.d.ts +8 -0
- package/dist/stories/RadioGroup.stories.jsx +53 -0
- package/dist/stories/Select.stories.d.ts +10 -0
- package/dist/stories/Select.stories.jsx +85 -0
- package/dist/stories/Tab.stories.d.ts +11 -0
- package/dist/stories/Tab.stories.jsx +63 -0
- package/dist/stories/Table.stories.d.ts +8 -0
- package/dist/stories/Table.stories.jsx +84 -0
- package/dist/stories/TabsContainer.stories.d.ts +10 -0
- package/dist/stories/TabsContainer.stories.jsx +52 -0
- package/dist/stories/Tag.stories.d.ts +17 -0
- package/dist/stories/Tag.stories.jsx +143 -0
- package/dist/stories/TextField.stories.d.ts +13 -0
- package/dist/stories/TextField.stories.jsx +96 -0
- package/dist/stories/Textarea.stories.d.ts +12 -0
- package/dist/stories/Textarea.stories.jsx +84 -0
- package/dist/stories/TimeStamp.stories.d.ts +16 -0
- package/dist/stories/TimeStamp.stories.jsx +140 -0
- package/dist/stories/Tooltip.stories.d.ts +9 -0
- package/dist/stories/Tooltip.stories.jsx +52 -0
- package/dist/stories/UserImage.stories.d.ts +10 -0
- package/dist/stories/UserImage.stories.jsx +46 -0
- package/dist/tailwind.config.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -3
|
@@ -3,8 +3,10 @@ interface AlertProps {
|
|
|
3
3
|
open?: boolean;
|
|
4
4
|
type: 'success' | 'warning' | 'error' | 'info' | 'default';
|
|
5
5
|
message: string;
|
|
6
|
-
|
|
6
|
+
secondMessage?: string;
|
|
7
|
+
onClose?: () => void;
|
|
7
8
|
showCloseButton?: boolean;
|
|
9
|
+
variant?: 'toast' | 'inline';
|
|
8
10
|
}
|
|
9
|
-
export default function Alert({ open, type, message, onClose, showCloseButton }: AlertProps): React.JSX.Element | null;
|
|
11
|
+
export default function Alert({ open, type, message, secondMessage, onClose, showCloseButton, variant, }: AlertProps): React.JSX.Element | null;
|
|
10
12
|
export {};
|
|
@@ -3,9 +3,9 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import { Info, AlertCircle, AlertTriangle, CheckCircle } from 'lucide-react';
|
|
4
4
|
import IconButton from './iconButton';
|
|
5
5
|
export default function Alert(_a) {
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var _b = _a.open, open = _b === void 0 ? true : _b, type = _a.type, message = _a.message, secondMessage = _a.secondMessage, onClose = _a.onClose, _c = _a.showCloseButton, showCloseButton = _c === void 0 ? false : _c, _d = _a.variant, variant = _d === void 0 ? 'toast' : _d;
|
|
7
|
+
var _e = useState(false), isVisible = _e[0], setIsVisible = _e[1];
|
|
8
|
+
var _f = useState(false), shouldRender = _f[0], setShouldRender = _f[1];
|
|
9
9
|
useEffect(function () {
|
|
10
10
|
if (open) {
|
|
11
11
|
setShouldRender(true);
|
|
@@ -37,7 +37,7 @@ export default function Alert(_a) {
|
|
|
37
37
|
// Wait for animation to complete before unmounting
|
|
38
38
|
setTimeout(function () {
|
|
39
39
|
setShouldRender(false);
|
|
40
|
-
onClose();
|
|
40
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
41
41
|
}, 300);
|
|
42
42
|
};
|
|
43
43
|
if (!shouldRender)
|
|
@@ -77,17 +77,22 @@ export default function Alert(_a) {
|
|
|
77
77
|
bgColor = 'bg-light-secondary-light dark:bg-dark-secondary-light';
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
<div className=
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<div className="flex items-start gap-2 text-light-text-primary dark:text-dark-text-primary">
|
|
85
|
-
{getIcon()}
|
|
80
|
+
var alertContent = (<div className={"flex items-start justify-between w-full p-2 rounded-[8px] transition-opacity duration-200 ease-out ".concat(bgColor, " ").concat(isVisible ? 'opacity-100' : 'opacity-0', " ").concat(variant === 'toast' ? 'max-w-md pointer-events-auto' : '')}>
|
|
81
|
+
<div className="flex items-start gap-2 text-light-text-primary dark:text-dark-text-primary">
|
|
82
|
+
{getIcon()}
|
|
83
|
+
<div className="flex flex-col text-center">
|
|
86
84
|
<span className="body1">{message}</span>
|
|
85
|
+
{secondMessage && (<span className="body2 opacity-70">{secondMessage}</span>)}
|
|
87
86
|
</div>
|
|
88
|
-
{showCloseButton && (<div className="ml-4">
|
|
89
|
-
<IconButton color="iconOnly" state="enabled" size="small" iconName="X" onClick={handleClose}/>
|
|
90
|
-
</div>)}
|
|
91
87
|
</div>
|
|
88
|
+
{showCloseButton && (<div className="ml-4">
|
|
89
|
+
<IconButton color="iconOnly" state="enabled" size="small" iconName="X" onClick={handleClose}/>
|
|
90
|
+
</div>)}
|
|
91
|
+
</div>);
|
|
92
|
+
if (variant === 'inline') {
|
|
93
|
+
return alertContent;
|
|
94
|
+
}
|
|
95
|
+
return (<div className="fixed top-4 inset-x-0 z-50 flex justify-center pointer-events-none">
|
|
96
|
+
{alertContent}
|
|
92
97
|
</div>);
|
|
93
98
|
}
|
|
@@ -4,11 +4,12 @@ interface ButtonProps {
|
|
|
4
4
|
type: 'primary' | 'secondary' | 'tertiary' | 'textOnly';
|
|
5
5
|
state: 'enabled' | 'hovered' | 'focused' | 'disabled';
|
|
6
6
|
label: string;
|
|
7
|
+
secondLabel?: string;
|
|
7
8
|
decoIcon?: string;
|
|
8
9
|
actionIcon?: string;
|
|
9
10
|
onClickButton?: any;
|
|
10
11
|
onClickActionIcon?: () => void;
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
13
|
-
export default function Button({ size, type, state, label, decoIcon, actionIcon, onClickButton, onClickActionIcon, className, }: ButtonProps): React.JSX.Element;
|
|
14
|
+
export default function Button({ size, type, state, label, secondLabel, decoIcon, actionIcon, onClickButton, onClickActionIcon, className, }: ButtonProps): React.JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
39
39
|
export default function Button(_a) {
|
|
40
40
|
var _this = this;
|
|
41
|
-
var size = _a.size, type = _a.type, state = _a.state, label = _a.label, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, onClickButton = _a.onClickButton, onClickActionIcon = _a.onClickActionIcon, _b = _a.className, className = _b === void 0 ? '' : _b;
|
|
41
|
+
var size = _a.size, type = _a.type, state = _a.state, label = _a.label, secondLabel = _a.secondLabel, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, onClickButton = _a.onClickButton, onClickActionIcon = _a.onClickActionIcon, _b = _a.className, className = _b === void 0 ? '' : _b;
|
|
42
42
|
var _c = useState(false), isHovered = _c[0], setIsHovered = _c[1];
|
|
43
43
|
var _d = useState(null), IconLeft = _d[0], setIconLeft = _d[1];
|
|
44
44
|
var _e = useState(null), IconRight = _e[0], setIconRight = _e[1];
|
|
@@ -126,7 +126,10 @@ export default function Button(_a) {
|
|
|
126
126
|
{/* Group IconLeft and label in a flex container for left alignment */}
|
|
127
127
|
<div className="flex items-center">
|
|
128
128
|
{IconLeft && <IconLeft className={sizeIcon} strokeWidth={2}/>}
|
|
129
|
-
<div className="
|
|
129
|
+
<div className="flex flex-col text-center px-2">
|
|
130
|
+
<span className="whitespace-nowrap overflow-hidden truncate">{label}</span>
|
|
131
|
+
{secondLabel && (<span className="whitespace-nowrap overflow-hidden truncate text-body2 opacity-70">{secondLabel}</span>)}
|
|
132
|
+
</div>
|
|
130
133
|
</div>
|
|
131
134
|
{IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
132
135
|
<IconRight className={sizeIcon} strokeWidth={2}/>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
interface CheckboxProps {
|
|
2
2
|
label?: string;
|
|
3
|
+
secondLabel?: string;
|
|
3
4
|
checked?: boolean;
|
|
4
5
|
onChange?: (checked: boolean) => void;
|
|
6
|
+
disabled?: boolean;
|
|
5
7
|
}
|
|
6
|
-
export default function Checkbox({ label, checked, onChange }: CheckboxProps): import("react").JSX.Element;
|
|
8
|
+
export default function Checkbox({ label, secondLabel, checked, onChange, disabled }: CheckboxProps): import("react").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
export default function Checkbox(_a) {
|
|
4
|
-
var label = _a.label, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange;
|
|
5
|
-
var
|
|
4
|
+
var label = _a.label, secondLabel = _a.secondLabel, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
|
|
5
|
+
var _d = useState(checked), isChecked = _d[0], setIsChecked = _d[1];
|
|
6
6
|
var handleToggle = function () {
|
|
7
|
+
if (disabled)
|
|
8
|
+
return;
|
|
7
9
|
var newChecked = !isChecked;
|
|
8
10
|
setIsChecked(newChecked);
|
|
9
11
|
if (onChange) {
|
|
10
12
|
onChange(newChecked);
|
|
11
13
|
}
|
|
12
14
|
};
|
|
13
|
-
return (<label className="flex items-center cursor-pointer
|
|
15
|
+
return (<label className={"flex items-center ".concat(disabled ? 'cursor-not-allowed' : 'cursor-pointer')}>
|
|
14
16
|
<div onClick={handleToggle} className="relative flex items-center justify-center w-6 h-6 group transition-colors duration-200 ease-in-out">
|
|
15
17
|
{/* Circle behind the checkbox */}
|
|
16
|
-
<div className="absolute w-6 h-6 rounded-full
|
|
17
|
-
|
|
18
|
+
<div className={"absolute w-6 h-6 rounded-full ".concat(disabled
|
|
19
|
+
? ''
|
|
20
|
+
: 'group-hover:bg-light-action-selected dark:group-hover:bg-dark-action-selected')}></div>
|
|
21
|
+
|
|
18
22
|
{/* Checkbox */}
|
|
19
|
-
<div className={"relative z-10 w-4 h-4 border-2 rounded ".concat(
|
|
20
|
-
?
|
|
21
|
-
|
|
23
|
+
<div className={"relative z-10 w-4 h-4 border-2 rounded ".concat(disabled
|
|
24
|
+
? isChecked
|
|
25
|
+
? 'bg-light-text-disabled dark:bg-dark-text-disabled border-none'
|
|
26
|
+
: 'border-light-text-disabled dark:border-dark-text-disabled'
|
|
27
|
+
: isChecked
|
|
28
|
+
? 'bg-light-text-primary dark:bg-dark-text-primary border-none'
|
|
29
|
+
: 'border-light-text-secondary dark:border-dark-text-secondary', " flex items-center justify-center")}>
|
|
22
30
|
{isChecked && (<svg className="w-3 h-3 text-light-text-contrast dark:text-dark-text-contrast" fill="none" stroke="currentColor" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
23
31
|
<path strokeWidth="2" d="M1 6l4 3 6-7"/>
|
|
24
32
|
</svg>)}
|
|
25
33
|
</div>
|
|
26
34
|
</div>
|
|
27
|
-
{label && <
|
|
35
|
+
{(label || secondLabel) && (<div className="flex flex-col ml-2">
|
|
36
|
+
{label && (<span className={"text-body1 ".concat(disabled
|
|
37
|
+
? 'text-light-text-disabled dark:text-dark-text-disabled'
|
|
38
|
+
: 'text-light-text-primary dark:text-dark-text-primary')}>
|
|
39
|
+
{label}
|
|
40
|
+
</span>)}
|
|
41
|
+
{secondLabel && (<span className={"text-body2 opacity-70 ".concat(disabled
|
|
42
|
+
? 'text-light-text-disabled dark:text-dark-text-disabled'
|
|
43
|
+
: 'text-light-text-primary dark:text-dark-text-primary')}>
|
|
44
|
+
{secondLabel}
|
|
45
|
+
</span>)}
|
|
46
|
+
</div>)}
|
|
28
47
|
</label>);
|
|
29
48
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface EmptyBoxProps {
|
|
3
3
|
text: string;
|
|
4
|
+
secondText?: string;
|
|
4
5
|
size: "small" | "large";
|
|
5
6
|
}
|
|
6
|
-
export default function EmptyBox({ text, size, }: EmptyBoxProps): React.JSX.Element;
|
|
7
|
+
export default function EmptyBox({ text, secondText, size, }: EmptyBoxProps): React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AlertCircle } from 'lucide-react';
|
|
4
4
|
export default function EmptyBox(_a) {
|
|
5
|
-
var text = _a.text, size = _a.size;
|
|
5
|
+
var text = _a.text, secondText = _a.secondText, size = _a.size;
|
|
6
6
|
var color = 'text-light-text-disabled dark:text-dark-text-disabled';
|
|
7
7
|
var height = size === 'small' ? 'py-6' : 'h-full';
|
|
8
8
|
var iconSize = 'size-6';
|
|
9
9
|
return (<div className={"flex flex-col space-y-2 justify-center items-center w-full ".concat(height)}>
|
|
10
10
|
<AlertCircle className={"".concat(iconSize, " ").concat(color)} strokeWidth={2}/>
|
|
11
|
-
<
|
|
12
|
-
{text}
|
|
13
|
-
|
|
11
|
+
<div className="flex flex-col text-center">
|
|
12
|
+
<p className={"text-body1 ".concat(color)}>
|
|
13
|
+
{text}
|
|
14
|
+
</p>
|
|
15
|
+
{secondText && (<p className={"text-body2 opacity-70 ".concat(color)}>
|
|
16
|
+
{secondText}
|
|
17
|
+
</p>)}
|
|
18
|
+
</div>
|
|
14
19
|
</div>);
|
|
15
20
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { icons } from 'lucide-react';
|
|
3
|
+
type IconName = keyof typeof icons;
|
|
4
|
+
interface IconProps {
|
|
5
|
+
name: IconName;
|
|
6
|
+
size?: 'small' | 'medium' | 'large' | number;
|
|
7
|
+
color?: 'primary' | 'secondary' | 'disabled' | 'error' | 'warning' | 'success' | 'info' | 'accent' | 'inherit';
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function Icon({ name, size, color, strokeWidth, className, }: IconProps): React.JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { icons } from 'lucide-react';
|
|
4
|
+
var sizeMap = {
|
|
5
|
+
small: 16,
|
|
6
|
+
medium: 24,
|
|
7
|
+
large: 32,
|
|
8
|
+
};
|
|
9
|
+
var colorMap = {
|
|
10
|
+
primary: 'text-light-text-primary dark:text-dark-text-primary',
|
|
11
|
+
secondary: 'text-light-text-secondary dark:text-dark-text-secondary',
|
|
12
|
+
disabled: 'text-light-text-disabled dark:text-dark-text-disabled',
|
|
13
|
+
error: 'text-light-error-main dark:text-dark-error-main',
|
|
14
|
+
warning: 'text-light-warning-main dark:text-dark-warning-main',
|
|
15
|
+
success: 'text-light-success-main dark:text-dark-success-main',
|
|
16
|
+
info: 'text-light-info-main dark:text-dark-info-main',
|
|
17
|
+
accent: 'text-light-accent-main dark:text-dark-accent-main',
|
|
18
|
+
inherit: '',
|
|
19
|
+
};
|
|
20
|
+
export default function Icon(_a) {
|
|
21
|
+
var name = _a.name, _b = _a.size, size = _b === void 0 ? 'medium' : _b, _c = _a.color, color = _c === void 0 ? 'primary' : _c, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 2 : _d, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
22
|
+
var LucideIcon = icons[name];
|
|
23
|
+
if (!LucideIcon) {
|
|
24
|
+
console.warn("Icon \"".concat(name, "\" not found in Lucide icons"));
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var iconSize = typeof size === 'number' ? size : sizeMap[size];
|
|
28
|
+
var colorClass = colorMap[color];
|
|
29
|
+
return (<LucideIcon size={iconSize} strokeWidth={strokeWidth} className={"".concat(colorClass, " ").concat(className).trim()}/>);
|
|
30
|
+
}
|
|
@@ -26,36 +26,42 @@ export default function IconButton(_a) {
|
|
|
26
26
|
// Base classes (padding and corner radius)
|
|
27
27
|
var baseClasses = "".concat(sizeClasses[size], " rounded-[8px] leading-none relative");
|
|
28
28
|
// Background color
|
|
29
|
-
var bgColor =
|
|
30
|
-
? 'bg-light-
|
|
31
|
-
: color === '
|
|
32
|
-
? 'bg-light-
|
|
33
|
-
: color === '
|
|
34
|
-
? 'bg-light-
|
|
35
|
-
:
|
|
29
|
+
var bgColor = state === 'selected'
|
|
30
|
+
? 'bg-light-primary-dark dark:bg-dark-primary-dark' // Selected state
|
|
31
|
+
: color === 'primary'
|
|
32
|
+
? 'bg-light-accent-main dark:bg-dark-accent-main' // Primary
|
|
33
|
+
: color === 'secondary'
|
|
34
|
+
? 'bg-light-secondary-main dark:bg-dark-secondary-main' // Secondary
|
|
35
|
+
: color === 'tertiary'
|
|
36
|
+
? 'bg-light-background-accent100 dark:bg-dark-background-accent100' // Tertiary
|
|
37
|
+
: ' '; // iconOnly: none
|
|
36
38
|
// Background hover color
|
|
37
|
-
var bgColorHover =
|
|
38
|
-
? '
|
|
39
|
-
: color === '
|
|
40
|
-
? 'hover:bg-light-
|
|
41
|
-
: color === '
|
|
42
|
-
? 'hover:bg-light-
|
|
43
|
-
:
|
|
39
|
+
var bgColorHover = state === 'selected'
|
|
40
|
+
? '' // No hover effect when selected
|
|
41
|
+
: color === 'primary'
|
|
42
|
+
? 'hover:bg-light-accent-dark hover:dark:bg-dark-accent-dark' // Primary
|
|
43
|
+
: color === 'secondary'
|
|
44
|
+
? 'hover:bg-light-secondary-dark hover:dark:bg-dark-secondary-dark' // Secondary
|
|
45
|
+
: color === 'tertiary'
|
|
46
|
+
? 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200' // Tertiary
|
|
47
|
+
: 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200'; // iconOnly
|
|
44
48
|
// Icon color
|
|
45
|
-
var iconColor =
|
|
46
|
-
? 'text-light-text-
|
|
47
|
-
: color === '
|
|
48
|
-
? 'text-light-text-primary dark:text-dark-text-
|
|
49
|
-
: color === '
|
|
50
|
-
? 'text-light-text-primary dark:text-dark-text-primary' //
|
|
51
|
-
:
|
|
49
|
+
var iconColor = state === 'selected'
|
|
50
|
+
? 'text-light-text-contrast dark:text-dark-text-contrast' // Selected state
|
|
51
|
+
: color === 'primary'
|
|
52
|
+
? 'text-light-text-primary dark:text-dark-text-contrast' // Primary
|
|
53
|
+
: color === 'secondary'
|
|
54
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Secondary
|
|
55
|
+
: color === 'tertiary'
|
|
56
|
+
? 'text-light-text-primary dark:text-dark-text-primary' // Tertiary
|
|
57
|
+
: 'text-light-text-primary dark:text-dark-text-primary'; // iconOnly
|
|
52
58
|
// State classes, including loading
|
|
53
59
|
var stateClasses = loading
|
|
54
60
|
? 'cursor-wait' // Show a waiting cursor during loading
|
|
55
61
|
: state === 'disabled'
|
|
56
62
|
? 'cursor-not-allowed opacity-50'
|
|
57
63
|
: state === 'selected'
|
|
58
|
-
? 'cursor-pointer
|
|
64
|
+
? 'cursor-pointer'
|
|
59
65
|
: isHovered
|
|
60
66
|
? 'cursor-pointer hover:bg-opacity-75'
|
|
61
67
|
: 'cursor-pointer';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function Line(_a) {
|
|
4
|
+
var _b = _a.direction, direction = _b === void 0 ? 'horizontal' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
|
|
5
|
+
var baseClasses = 'bg-light-misc-divider dark:bg-dark-misc-divider';
|
|
6
|
+
if (direction === 'vertical') {
|
|
7
|
+
return (<div className={"".concat(baseClasses, " w-px h-full ").concat(className)}/>);
|
|
8
|
+
}
|
|
9
|
+
return (<div className={"".concat(baseClasses, " h-px w-full ").concat(className)}/>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LinkProps {
|
|
3
|
+
href: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
color?: 'info' | 'error' | 'warning' | 'success';
|
|
6
|
+
size?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption';
|
|
7
|
+
openInNewTab?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function Link({ href, children, color, size, openInNewTab, className, }: LinkProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import NextLink from 'next/link';
|
|
15
|
+
export default function Link(_a) {
|
|
16
|
+
var href = _a.href, children = _a.children, _b = _a.color, color = _b === void 0 ? 'info' : _b, _c = _a.size, size = _c === void 0 ? 'body1' : _c, _d = _a.openInNewTab, openInNewTab = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
17
|
+
// Color classes based on the color prop
|
|
18
|
+
var colorClasses = {
|
|
19
|
+
info: {
|
|
20
|
+
default: 'text-light-info-main dark:text-dark-info-main',
|
|
21
|
+
hover: 'hover:text-light-info-dark hover:dark:text-dark-info-dark',
|
|
22
|
+
visited: 'visited:text-light-info-light visited:dark:text-dark-info-light',
|
|
23
|
+
},
|
|
24
|
+
error: {
|
|
25
|
+
default: 'text-light-error-main dark:text-dark-error-main',
|
|
26
|
+
hover: 'hover:text-light-error-dark hover:dark:text-dark-error-dark',
|
|
27
|
+
visited: 'visited:text-light-error-light visited:dark:text-dark-error-light',
|
|
28
|
+
},
|
|
29
|
+
warning: {
|
|
30
|
+
default: 'text-light-warning-main dark:text-dark-warning-main',
|
|
31
|
+
hover: 'hover:text-light-warning-dark hover:dark:text-dark-warning-dark',
|
|
32
|
+
visited: 'visited:text-light-warning-light visited:dark:text-dark-warning-light',
|
|
33
|
+
},
|
|
34
|
+
success: {
|
|
35
|
+
default: 'text-light-success-main dark:text-dark-success-main',
|
|
36
|
+
hover: 'hover:text-light-success-dark hover:dark:text-dark-success-dark',
|
|
37
|
+
visited: 'visited:text-light-success-light visited:dark:text-dark-success-light',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
var selectedColorClasses = colorClasses[color];
|
|
41
|
+
// Check if href is external (starts with http:// or https://)
|
|
42
|
+
var isExternal = href.startsWith('http://') || href.startsWith('https://');
|
|
43
|
+
// Determine if we should open in new tab
|
|
44
|
+
var shouldOpenInNewTab = openInNewTab || isExternal;
|
|
45
|
+
var linkClasses = "\n text-".concat(size, "\n ").concat(selectedColorClasses.default, "\n ").concat(selectedColorClasses.hover, "\n ").concat(selectedColorClasses.visited, "\n underline\n underline-offset-[2px]\n decoration-2\n cursor-pointer\n transition-colors\n duration-200\n ease-in-out\n ").concat(className, "\n ").trim().replace(/\s+/g, ' ');
|
|
46
|
+
var commonProps = __assign({ className: linkClasses }, (shouldOpenInNewTab && {
|
|
47
|
+
target: '_blank',
|
|
48
|
+
rel: 'noopener noreferrer',
|
|
49
|
+
}));
|
|
50
|
+
// Use NextLink for internal links, regular <a> for external
|
|
51
|
+
if (isExternal || shouldOpenInNewTab) {
|
|
52
|
+
return (<a href={href} {...commonProps}>
|
|
53
|
+
{children}
|
|
54
|
+
</a>);
|
|
55
|
+
}
|
|
56
|
+
return (<NextLink href={href} {...commonProps}>
|
|
57
|
+
{children}
|
|
58
|
+
</NextLink>);
|
|
59
|
+
}
|
|
@@ -5,6 +5,7 @@ interface MenuItemProps {
|
|
|
5
5
|
userHandle?: string;
|
|
6
6
|
userImgUrl?: string;
|
|
7
7
|
label: string;
|
|
8
|
+
secondLabel?: string;
|
|
8
9
|
isSelected?: boolean;
|
|
9
10
|
onClick?: any;
|
|
10
11
|
className?: string;
|
|
@@ -15,5 +16,5 @@ interface MenuItemProps {
|
|
|
15
16
|
};
|
|
16
17
|
iconRight?: string;
|
|
17
18
|
}
|
|
18
|
-
export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, isSelected, onClick, className, size, tag, iconRight, }: MenuItemProps): JSX.Element;
|
|
19
|
+
export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, secondLabel, isSelected, onClick, className, size, tag, iconRight, }: MenuItemProps): JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -41,7 +41,7 @@ import UserImage from './userImage';
|
|
|
41
41
|
import Tag from './tag';
|
|
42
42
|
export default function MenuItem(_a) {
|
|
43
43
|
var _this = this;
|
|
44
|
-
var href = _a.href, iconName = _a.iconName, userHandle = _a.userHandle, userImgUrl = _a.userImgUrl, label = _a.label, isSelected = _a.isSelected, onClick = _a.onClick, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, tag = _a.tag, iconRight = _a.iconRight;
|
|
44
|
+
var href = _a.href, iconName = _a.iconName, userHandle = _a.userHandle, userImgUrl = _a.userImgUrl, label = _a.label, secondLabel = _a.secondLabel, isSelected = _a.isSelected, onClick = _a.onClick, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, tag = _a.tag, iconRight = _a.iconRight;
|
|
45
45
|
var _d = useState(null), IconLeft = _d[0], setIconLeft = _d[1];
|
|
46
46
|
var _e = useState(null), IconRight = _e[0], setIconRight = _e[1];
|
|
47
47
|
var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -93,18 +93,23 @@ export default function MenuItem(_a) {
|
|
|
93
93
|
fetchIcon();
|
|
94
94
|
}, [iconName, iconRight, loadIcon]);
|
|
95
95
|
// Size-based icon and text classes
|
|
96
|
-
var iconSize = size === 'large' ? 'w-
|
|
97
|
-
var labelClass = size === 'large' ? 'text-
|
|
98
|
-
var tagSize = size === 'large' ? '
|
|
96
|
+
var iconSize = size === 'large' ? 'w-5 h-5' : 'w-6 h-6';
|
|
97
|
+
var labelClass = size === 'large' ? 'text-body2' : 'text-body1';
|
|
98
|
+
var tagSize = size === 'large' ? 'small' : 'medium';
|
|
99
99
|
var content = (<div className={"\n flex items-center p-2 rounded-[8px] cursor-pointer justify-between transition-colors duration-200 ease-in-out\n ".concat(isSelected
|
|
100
100
|
? 'bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast'
|
|
101
101
|
: 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200', "\n ").concat(className, "\n ")} style={{ width: '100%' }} onClick={onClick}>
|
|
102
102
|
{/* Left group: icon/userImg + label + tag with 8px gap */}
|
|
103
103
|
<div className="flex items-center gap-2">
|
|
104
104
|
{userImgUrl ? (<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl}/>) : (IconLeft && (<IconLeft className={"".concat(iconSize, " ").concat(isSelected ? 'text-light-text-contrast dark:text-dark-text-contrast' : 'text-light-text-secondary dark:text-dark-text-secondary')} strokeWidth={2}/>))}
|
|
105
|
-
<
|
|
106
|
-
{
|
|
107
|
-
|
|
105
|
+
<div className="flex flex-col">
|
|
106
|
+
<span className={"whitespace-nowrap ".concat(labelClass, " ").concat(isSelected ? 'text-light-text-contrast dark:text-dark-text-contrast' : 'text-light-text-primary dark:text-dark-text-primary')}>
|
|
107
|
+
{label}
|
|
108
|
+
</span>
|
|
109
|
+
{secondLabel && (<span className={"whitespace-nowrap text-body2 opacity-70 ".concat(isSelected ? 'text-light-text-contrast dark:text-dark-text-contrast' : 'text-light-text-primary dark:text-dark-text-primary')}>
|
|
110
|
+
{secondLabel}
|
|
111
|
+
</span>)}
|
|
112
|
+
</div>
|
|
108
113
|
{tag && (<Tag variant="contained" size={tagSize} label={tag.label} iconName={tag.iconName}/>)}
|
|
109
114
|
</div>
|
|
110
115
|
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
interface ModalProps {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
title?: string;
|
|
5
|
+
secondTitle?: string;
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
onClose: () => void;
|
|
7
8
|
actions?: React.ReactNode;
|
|
8
|
-
size?: 'medium' | 'large';
|
|
9
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
10
|
}
|
|
10
|
-
export default function Modal({ isOpen, title, children, onClose, actions, size, }: ModalProps): React.JSX.Element | null;
|
|
11
|
+
export default function Modal({ isOpen, title, secondTitle, children, onClose, actions, size, }: ModalProps): React.JSX.Element | null;
|
|
11
12
|
export {};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
export default function Modal(_a) {
|
|
4
|
-
var isOpen = _a.isOpen, title = _a.title, children = _a.children, onClose = _a.onClose, actions = _a.actions, _b = _a.size, size = _b === void 0 ? 'medium' : _b;
|
|
5
|
-
if (!isOpen)
|
|
6
|
-
return null;
|
|
7
|
-
// close modal by clicking elsewhere
|
|
8
|
-
var handleOverlayClick = function (e) {
|
|
9
|
-
if (e.target === e.currentTarget) {
|
|
10
|
-
onClose();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
4
|
+
var isOpen = _a.isOpen, title = _a.title, secondTitle = _a.secondTitle, children = _a.children, onClose = _a.onClose, actions = _a.actions, _b = _a.size, size = _b === void 0 ? 'medium' : _b;
|
|
13
5
|
// close modal by esc keypress
|
|
14
6
|
useEffect(function () {
|
|
7
|
+
if (!isOpen)
|
|
8
|
+
return;
|
|
15
9
|
var handleKeyDown = function (e) {
|
|
16
10
|
if (e.key === 'Escape') {
|
|
17
11
|
onClose();
|
|
@@ -21,27 +15,53 @@ export default function Modal(_a) {
|
|
|
21
15
|
return function () {
|
|
22
16
|
window.removeEventListener('keydown', handleKeyDown);
|
|
23
17
|
};
|
|
24
|
-
}, [onClose]);
|
|
18
|
+
}, [isOpen, onClose]);
|
|
25
19
|
// Determine width based on size prop
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
var sizeConfig = {
|
|
21
|
+
small: { width: 'w-[480px]', maxWidth: '480px' },
|
|
22
|
+
medium: { width: 'w-[600px]', maxWidth: '600px' },
|
|
23
|
+
large: { width: 'w-[1024px]', maxWidth: '1024px' },
|
|
24
|
+
};
|
|
25
|
+
var _c = sizeConfig[size], modalWidth = _c.width, maxWidth = _c.maxWidth;
|
|
26
|
+
// close modal by clicking elsewhere
|
|
27
|
+
var handleOverlayClick = function (e) {
|
|
28
|
+
if (e.target === e.currentTarget) {
|
|
29
|
+
onClose();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (!isOpen)
|
|
33
|
+
return null;
|
|
34
|
+
return (<div className="fixed bg-black bg-opacity-50 flex items-center justify-center z-50" style={{ top: 0, left: 0, right: 0, bottom: 0 }} onClick={handleOverlayClick} role="dialog" aria-labelledby="modal-title" aria-modal="true" tabIndex={-1}>
|
|
35
|
+
<div className={"bg-light-background-default dark:bg-dark-background-default rounded-[8px] ".concat(modalWidth, " flex flex-col")} style={{
|
|
30
36
|
maxWidth: maxWidth,
|
|
31
37
|
width: 'calc(100vw - 64px)',
|
|
32
|
-
maxHeight: '
|
|
33
|
-
|
|
38
|
+
maxHeight: '90vh',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
}}>
|
|
41
|
+
{(title || actions) && (<div className="px-6 py-3 border-b border-light-misc-divider dark:border-dark-misc-divider flex justify-between items-start" style={{ flexShrink: 0 }}>
|
|
42
|
+
{title && (<div className="flex flex-col">
|
|
43
|
+
<h2 id="modal-title" className="text-h5 text-light-text-primary dark:text-dark-text-primary">
|
|
44
|
+
{title}
|
|
45
|
+
</h2>
|
|
46
|
+
{secondTitle && (<span className="text-body2 opacity-70 text-light-text-primary dark:text-dark-text-primary">
|
|
47
|
+
{secondTitle}
|
|
48
|
+
</span>)}
|
|
49
|
+
</div>)}
|
|
50
|
+
{actions && (<div className="flex space-x-2">
|
|
51
|
+
{actions}
|
|
52
|
+
</div>)}
|
|
53
|
+
</div>)}
|
|
54
|
+
|
|
55
|
+
<div className="text-body1 space-y-4 text-light-text-primary dark:text-dark-text-primary p-6" style={{
|
|
34
56
|
overflowY: 'auto',
|
|
57
|
+
flexGrow: 1,
|
|
58
|
+
minHeight: 0,
|
|
59
|
+
scrollbarWidth: 'none',
|
|
60
|
+
msOverflowStyle: 'none',
|
|
35
61
|
}}>
|
|
36
|
-
{title && (<h2 id="modal-title" className="text-h6">
|
|
37
|
-
{title}
|
|
38
|
-
</h2>)}
|
|
39
|
-
<div className="text-body1 space-y-4">
|
|
40
62
|
{children}
|
|
41
63
|
</div>
|
|
42
|
-
|
|
43
|
-
{actions}
|
|
44
|
-
</div>)}
|
|
64
|
+
|
|
45
65
|
</div>
|
|
46
66
|
</div>);
|
|
47
67
|
}
|
|
@@ -11,7 +11,10 @@ export default function RadioGroup(_a) {
|
|
|
11
11
|
{/* Inner circle */}
|
|
12
12
|
{selectedValue === option.value && (<div className='absolute w-2 h-2 rounded-full bg-light-text-primary dark:bg-dark-text-primary'/>)}
|
|
13
13
|
</div>
|
|
14
|
-
<
|
|
14
|
+
<div className="flex flex-col ml-2">
|
|
15
|
+
<span className="text-body1 text-light-text-primary dark:text-dark-text-primary">{option.label}</span>
|
|
16
|
+
{option.secondLabel && (<span className="text-body2 opacity-70 text-light-text-primary dark:text-dark-text-primary">{option.secondLabel}</span>)}
|
|
17
|
+
</div>
|
|
15
18
|
</label>); })}
|
|
16
19
|
</div>);
|
|
17
20
|
}
|
package/dist/components/tab.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type RouterLike = {
|
|
3
|
+
push: (url: string) => void;
|
|
4
|
+
};
|
|
2
5
|
type TabProps = {
|
|
3
6
|
label: string;
|
|
7
|
+
secondLabel?: string;
|
|
4
8
|
href?: string;
|
|
5
9
|
isSelected: boolean;
|
|
6
10
|
onClickTab: () => void;
|
|
7
11
|
onClickActionIcon?: any;
|
|
8
12
|
decoIcon?: string;
|
|
9
13
|
actionIcon?: string;
|
|
14
|
+
router?: RouterLike;
|
|
10
15
|
};
|
|
11
|
-
export default function Tab({ label, href, isSelected, onClickTab, onClickActionIcon, decoIcon, actionIcon }: TabProps): React.JSX.Element;
|
|
16
|
+
export default function Tab({ label, secondLabel, href, isSelected, onClickTab, onClickActionIcon, decoIcon, actionIcon, router }: TabProps): React.JSX.Element;
|
|
12
17
|
export {};
|