oneslash-design-system 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/alert/alert.tsx +14 -1
- package/components/button/button.tsx +11 -0
- package/components/checkBox/checkBox.tsx +5 -1
- package/components/iconButton/iconButton.tsx +9 -0
- package/components/menuItem/menuItem.tsx +8 -0
- package/components/modal/modal.tsx +8 -0
- package/components/popover/popover.tsx +15 -1
- package/components/tab/tab.tsx +8 -1
- package/components/tag/tag.tsx +14 -0
- package/components/textField/textField.tsx +13 -0
- package/components/tooltip/tooltip.tsx +10 -1
- package/components/userImage/userImage.tsx +6 -0
- package/global.d.ts +1 -1
- package/index.ts +2 -4
- package/package.json +2 -1
- package/tsconfig.json +3 -2
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface AlertProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
type: 'success' | 'warning' | 'error' | 'info';
|
|
7
|
+
message: string;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function Alert({
|
|
12
|
+
open,
|
|
13
|
+
type,
|
|
14
|
+
message,
|
|
15
|
+
onClose
|
|
16
|
+
}: AlertProps) {
|
|
17
|
+
|
|
5
18
|
useEffect(() => {
|
|
6
19
|
if (open) {
|
|
7
20
|
const timer = setTimeout(() => {
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import * as HeroIcons from '@heroicons/react/24/outline';
|
|
4
|
+
|
|
5
|
+
interface ButtonProps {
|
|
6
|
+
size: 'large' | 'medium' | 'small';
|
|
7
|
+
type: 'primary' | 'secondary' | 'tertiary' | 'textOnly';
|
|
8
|
+
state: 'enabled' | 'hovered' | 'selected' | 'focused' | 'disabled';
|
|
9
|
+
label: string;
|
|
10
|
+
iconLeftName?: keyof typeof HeroIcons; // Reference to HeroIcons
|
|
11
|
+
iconRightName?: keyof typeof HeroIcons; // Reference to HeroIcons
|
|
12
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
13
|
+
}
|
|
3
14
|
|
|
4
15
|
type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
5
16
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import * as HeroIcons from '@heroicons/react/24/outline';
|
|
4
|
+
|
|
5
|
+
interface IconButtonProps{
|
|
6
|
+
variant: "contained" | "iconOnly";
|
|
7
|
+
color: "primary" | "secondary";
|
|
8
|
+
state: "enabled" | "selected" | "disabled";
|
|
9
|
+
iconName: keyof typeof HeroIcons;
|
|
10
|
+
onClick?: any;
|
|
11
|
+
}
|
|
3
12
|
|
|
4
13
|
type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
5
14
|
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import NextLink from 'next/link';
|
|
4
4
|
|
|
5
|
+
interface MenuItemProps {
|
|
6
|
+
href?: string;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
isSelected?: boolean;
|
|
10
|
+
onClick: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
export default function MenuItem({
|
|
6
14
|
href = '#',
|
|
7
15
|
iconName,
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface PopoverProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
anchorEl: HTMLElement | null;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
children: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Popover({
|
|
13
|
+
anchorEl,
|
|
14
|
+
open,
|
|
15
|
+
onClose,
|
|
16
|
+
children
|
|
17
|
+
}: PopoverProps) {
|
|
18
|
+
|
|
5
19
|
const [popoverStyle, setPopoverStyle] = useState<React.CSSProperties>({});
|
|
6
20
|
const popoverRef = useRef<HTMLDivElement>(null);
|
|
7
21
|
|
package/components/tab/tab.tsx
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { useRouter, usePathname } from 'next/navigation';
|
|
4
4
|
|
|
5
|
+
type TabProps = {
|
|
6
|
+
label: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
iconName?: string;
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
const TabIcon: React.FC<{ iconName?: string }> = ({ iconName }) => {
|
|
7
14
|
const [Icon, setIcon] = useState<React.ComponentType<React.SVGProps<SVGSVGElement>> | null>(null);
|
|
@@ -37,7 +44,7 @@ const Tab: React.FC<TabProps> = ({ label, href, isSelected, onClick, iconName })
|
|
|
37
44
|
const handleClick = () => {
|
|
38
45
|
onClick();
|
|
39
46
|
if (href) {
|
|
40
|
-
|
|
47
|
+
router.push(href);
|
|
41
48
|
}
|
|
42
49
|
};
|
|
43
50
|
|
package/components/tag/tag.tsx
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import * as HeroIcons from '@heroicons/react/24/outline';
|
|
4
|
+
|
|
5
|
+
interface TagProps{
|
|
6
|
+
key?: any;
|
|
7
|
+
variant: "contained" | "textOnly";
|
|
8
|
+
size: "medium" | "small";
|
|
9
|
+
state?: "enabled" | "selected" ;
|
|
10
|
+
label: any;
|
|
11
|
+
iconName?: keyof typeof HeroIcons;
|
|
12
|
+
isDeletable?: keyof typeof HeroIcons;
|
|
13
|
+
onClick?: any;
|
|
14
|
+
color?: 'default' | 'info';
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
5
18
|
|
|
@@ -14,6 +27,7 @@ export default function Tag({
|
|
|
14
27
|
onClick,
|
|
15
28
|
color = 'default',
|
|
16
29
|
}: TagProps) {
|
|
30
|
+
|
|
17
31
|
const [isHovered, setIsHovered] = useState(false);
|
|
18
32
|
const [Icon, setIcon] = useState<IconType | null>(null);
|
|
19
33
|
const [DeleteIcon, setDeleteIcon] = useState<IconType | null>(null);
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
|
|
4
|
+
interface TextFieldProps {
|
|
5
|
+
id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: any;
|
|
9
|
+
iconLeft?: any;
|
|
10
|
+
iconRight?: React.ReactNode | React.ComponentType<any>;
|
|
11
|
+
multiline?: boolean;
|
|
12
|
+
maxRows?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
4
17
|
export default function TextField({
|
|
5
18
|
id,
|
|
6
19
|
label,
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface TooltipProps {
|
|
5
|
+
title: string;
|
|
6
|
+
children: React.ReactElement;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function Tooltip({
|
|
10
|
+
title,
|
|
11
|
+
children
|
|
12
|
+
}: TooltipProps) {
|
|
13
|
+
|
|
5
14
|
const [visible, setVisible] = useState(false);
|
|
6
15
|
const [position, setPosition] = useState<'top' | 'bottom'>('bottom');
|
|
7
16
|
const tooltipRef = useRef<HTMLDivElement>(null);
|
package/global.d.ts
CHANGED
package/index.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import './index.css';
|
|
2
|
-
|
|
3
|
-
export { Button };
|
|
4
|
-
|
|
1
|
+
import './index.css';
|
|
2
|
+
export * from './components/button/button';
|
|
5
3
|
export * from './components/alert/alert';
|
|
6
4
|
export * from './components/button/button';
|
|
7
5
|
export * from './components/checkBox/checkBox';
|
package/package.json
CHANGED