oneslash-design-system 1.2.24 → 1.2.26
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 +3 -2
- package/dist/components/button.jsx +7 -3
- package/dist/components/checkBox.d.ts +2 -1
- package/dist/components/checkBox.jsx +13 -6
- 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/line.d.ts +7 -0
- package/dist/components/line.jsx +10 -0
- package/dist/components/menuItem.d.ts +4 -1
- package/dist/components/menuItem.jsx +17 -10
- 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 +7 -4
- package/dist/components/tag.jsx +105 -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 +549 -446
- package/dist/stories/Alert.stories.d.ts +15 -0
- package/dist/stories/Alert.stories.jsx +121 -0
- package/dist/stories/Button.stories.d.ts +13 -0
- package/dist/stories/Button.stories.jsx +89 -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 +12 -0
- package/dist/stories/MenuItem.stories.jsx +70 -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 +19 -0
- package/dist/stories/Tag.stories.jsx +168 -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
|
}
|
|
@@ -2,13 +2,14 @@ import React from 'react';
|
|
|
2
2
|
interface ButtonProps {
|
|
3
3
|
size: 'small' | 'medium' | 'large';
|
|
4
4
|
type: 'primary' | 'secondary' | 'tertiary' | 'textOnly';
|
|
5
|
-
state: 'enabled' | 'hovered' | 'focused' | 'disabled';
|
|
5
|
+
state: 'enabled' | 'hovered' | 'focused' | 'disabled' | 'selected';
|
|
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];
|
|
@@ -118,15 +118,19 @@ export default function Button(_a) {
|
|
|
118
118
|
disabled: type === 'textOnly'
|
|
119
119
|
? 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-transparent'
|
|
120
120
|
: 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-light-actionBackground-disabled dark:bg-dark-actionBackground-disabled',
|
|
121
|
+
selected: 'cursor-pointer bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast',
|
|
121
122
|
};
|
|
122
|
-
var buttonClasses = "\n flex flex-row items-center rounded-[8px] transition-colors duration-200 ease-in-out justify-between\n ".concat(sizeClasses, "\n ").concat(state === 'enabled' ? baseTypeClasses : '', "\n ").concat(state === 'focused' ? stateClasses.focused : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled :
|
|
123
|
+
var buttonClasses = "\n flex flex-row items-center rounded-[8px] transition-colors duration-200 ease-in-out justify-between\n ".concat(sizeClasses, "\n ").concat(state === 'selected' ? stateClasses.selected : '', "\n ").concat(state === 'enabled' ? baseTypeClasses : '', "\n ").concat(state === 'focused' ? "".concat(baseTypeClasses, " ").concat(stateClasses.focused) : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled : '', "\n ").concat(state !== 'disabled' && state !== 'selected' && isHovered ? hoverTypeClasses : '', "\n ").concat(state === 'hovered' ? "".concat(baseTypeClasses, " ").concat(hoverTypeClasses) : '', "\n ").concat(className, "\n ");
|
|
123
124
|
return (<button className={buttonClasses} onMouseEnter={function () { if (state !== 'disabled')
|
|
124
125
|
setIsHovered(true); }} onMouseLeave={function () { if (state !== 'disabled')
|
|
125
126
|
setIsHovered(false); }} onClick={onClickButton}>
|
|
126
127
|
{/* Group IconLeft and label in a flex container for left alignment */}
|
|
127
128
|
<div className="flex items-center">
|
|
128
129
|
{IconLeft && <IconLeft className={sizeIcon} strokeWidth={2}/>}
|
|
129
|
-
<div className="
|
|
130
|
+
<div className="flex flex-col text-center px-2">
|
|
131
|
+
<span className="whitespace-nowrap overflow-hidden truncate">{label}</span>
|
|
132
|
+
{secondLabel && (<span className="whitespace-nowrap overflow-hidden truncate text-body2 opacity-70">{secondLabel}</span>)}
|
|
133
|
+
</div>
|
|
130
134
|
</div>
|
|
131
135
|
{IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
132
136
|
<IconRight className={sizeIcon} strokeWidth={2}/>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
interface CheckboxProps {
|
|
2
2
|
label?: string;
|
|
3
|
+
secondLabel?: string;
|
|
3
4
|
checked?: boolean;
|
|
4
5
|
onChange?: (checked: boolean) => void;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export default function Checkbox({ label, checked, onChange, disabled }: CheckboxProps): import("react").JSX.Element;
|
|
8
|
+
export default function Checkbox({ label, secondLabel, checked, onChange, disabled }: CheckboxProps): import("react").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
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, _c = _a.disabled, disabled = _c === void 0 ? false : _c;
|
|
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
5
|
var _d = useState(checked), isChecked = _d[0], setIsChecked = _d[1];
|
|
6
6
|
var handleToggle = function () {
|
|
7
7
|
if (disabled)
|
|
@@ -32,10 +32,17 @@ export default function Checkbox(_a) {
|
|
|
32
32
|
</svg>)}
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
35
|
-
{label && (<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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>)}
|
|
40
47
|
</label>);
|
|
41
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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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;
|
|
@@ -12,8 +13,10 @@ interface MenuItemProps {
|
|
|
12
13
|
tag?: {
|
|
13
14
|
label: React.ReactNode;
|
|
14
15
|
iconName?: string;
|
|
16
|
+
color?: 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
17
|
+
variant?: 'contained' | 'textOnly' | 'dot';
|
|
15
18
|
};
|
|
16
19
|
iconRight?: string;
|
|
17
20
|
}
|
|
18
|
-
export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, isSelected, onClick, className, size, tag, iconRight, }: MenuItemProps): JSX.Element;
|
|
21
|
+
export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, secondLabel, isSelected, onClick, className, size, tag, iconRight, }: MenuItemProps): JSX.Element;
|
|
19
22
|
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 () {
|
|
@@ -99,17 +99,24 @@ export default function MenuItem(_a) {
|
|
|
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
|
-
{/* Left group: icon/userImg + label
|
|
103
|
-
<div className="flex items-center gap-2">
|
|
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
|
-
|
|
108
|
-
|
|
102
|
+
{/* Left group: icon/userImg + label with 8px gap */}
|
|
103
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
104
|
+
{userImgUrl ? (<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl}/>) : (IconLeft && (<IconLeft className={"".concat(iconSize, " flex-shrink-0 ").concat(isSelected ? 'text-light-text-contrast dark:text-dark-text-contrast' : 'text-light-text-secondary dark:text-dark-text-secondary')} strokeWidth={2}/>))}
|
|
105
|
+
<div className="flex flex-col min-w-0">
|
|
106
|
+
<span className={"truncate ".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={"truncate 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>
|
|
109
113
|
</div>
|
|
110
114
|
|
|
111
|
-
{/* Right icon aligned to the right */}
|
|
112
|
-
|
|
115
|
+
{/* Right group: tag + icon aligned to the right */}
|
|
116
|
+
<div className="flex items-center gap-2 flex-shrink-0">
|
|
117
|
+
{tag && (<Tag variant={tag.variant || 'contained'} size={tagSize} label={tag.label} iconName={tag.iconName} color={tag.color}/>)}
|
|
118
|
+
{IconRight && (<IconRight className={"".concat(iconSize, " ").concat(isSelected ? 'text-light-text-contrast dark:text-dark-text-contrast' : 'text-light-text-secondary dark:text-dark-text-secondary', " flex-shrink-0")} strokeWidth={2}/>)}
|
|
119
|
+
</div>
|
|
113
120
|
</div>);
|
|
114
121
|
return href ? <NextLink href={href}>{content}</NextLink> : content;
|
|
115
122
|
}
|
|
@@ -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 {};
|
package/dist/components/tab.jsx
CHANGED
|
@@ -36,12 +36,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
39
|
-
import { useRouter, usePathname } from 'next/navigation';
|
|
40
39
|
export default function Tab(_a) {
|
|
41
40
|
var _this = this;
|
|
42
|
-
var label = _a.label, href = _a.href, isSelected = _a.isSelected, onClickTab = _a.onClickTab, onClickActionIcon = _a.onClickActionIcon, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon;
|
|
43
|
-
var router = useRouter();
|
|
44
|
-
var pathname = usePathname();
|
|
41
|
+
var label = _a.label, secondLabel = _a.secondLabel, href = _a.href, isSelected = _a.isSelected, onClickTab = _a.onClickTab, onClickActionIcon = _a.onClickActionIcon, decoIcon = _a.decoIcon, actionIcon = _a.actionIcon, router = _a.router;
|
|
45
42
|
var _b = useState(null), IconLeft = _b[0], setIconLeft = _b[1];
|
|
46
43
|
var _c = useState(null), IconRight = _c[0], setIconRight = _c[1];
|
|
47
44
|
// Load icon dynamically
|
|
@@ -95,17 +92,22 @@ export default function Tab(_a) {
|
|
|
95
92
|
}, [decoIcon, actionIcon, loadIcon]);
|
|
96
93
|
var handleClick = function () {
|
|
97
94
|
onClickTab();
|
|
98
|
-
if (href) {
|
|
95
|
+
if (href && router) {
|
|
99
96
|
router.push(href);
|
|
100
97
|
}
|
|
101
98
|
};
|
|
102
99
|
return (<div className={"\n flex items-center space-x-1 py-1 px-[6px] rounded-[8px] cursor-pointer justify-start transition-colors duration-200 ease-in-out\n ".concat(isSelected
|
|
103
100
|
? 'bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast'
|
|
104
|
-
: 'hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200', "\n ")} onClick={handleClick}>
|
|
101
|
+
: 'text-light-text-primary dark:text-dark-text-primary hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200', "\n ")} onClick={handleClick}>
|
|
105
102
|
{IconLeft && <IconLeft className="w-6 h-6" strokeWidth={2}/>}
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
<div className="flex flex-col px-[6px] text-center">
|
|
104
|
+
<span className="whitespace-nowrap text-body1">
|
|
105
|
+
{label}
|
|
106
|
+
</span>
|
|
107
|
+
{secondLabel && (<span className="whitespace-nowrap text-body2 opacity-70">
|
|
108
|
+
{secondLabel}
|
|
109
|
+
</span>)}
|
|
110
|
+
</div>
|
|
109
111
|
{IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
110
112
|
<IconRight className="w-6 h-6" strokeWidth={2}/>
|
|
111
113
|
</div>)}
|
|
@@ -3,7 +3,10 @@ import React from 'react';
|
|
|
3
3
|
export default function TabsContainer(_a) {
|
|
4
4
|
var children = _a.children;
|
|
5
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-accent100 dark:bg-dark-background-accent100' : 'bg-transparent', "\n ")}
|
|
6
|
+
return (<div className={"\n flex space-x-2 p-1 rounded-[12px] overflow-x-auto\n ".concat(tabCount > 0 ? 'bg-light-background-accent100 dark:bg-dark-background-accent100' : 'bg-transparent', "\n ")} style={{
|
|
7
|
+
scrollbarWidth: 'none',
|
|
8
|
+
msOverflowStyle: 'none',
|
|
9
|
+
}}>
|
|
7
10
|
{children}
|
|
8
11
|
</div>);
|
|
9
12
|
}
|
package/dist/components/tag.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { icons } from 'lucide-react';
|
|
3
|
+
type IconName = keyof typeof icons;
|
|
3
4
|
interface TagProps {
|
|
4
|
-
variant: 'contained' | 'textOnly';
|
|
5
|
+
variant: 'contained' | 'textOnly' | 'dot';
|
|
5
6
|
size: 'medium' | 'small';
|
|
6
7
|
state?: 'enabled' | 'selected';
|
|
8
|
+
color?: 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
7
9
|
label: React.ReactNode;
|
|
8
|
-
|
|
10
|
+
secondLabel?: string;
|
|
11
|
+
iconName?: IconName;
|
|
9
12
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
10
13
|
}
|
|
11
|
-
export default function Tag({ variant, size, state, label, iconName, onClick, }: TagProps): JSX.Element;
|
|
14
|
+
export default function Tag({ variant, size, state, color, label, secondLabel, iconName, onClick, }: TagProps): JSX.Element;
|
|
12
15
|
export {};
|