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.
@@ -1,7 +1,20 @@
1
1
  'use client';
2
2
  import React, { useEffect } from 'react';
3
3
 
4
- export default function Alert({ open, type, message, onClose }: AlertProps) {
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,7 +1,11 @@
1
1
  'use client';
2
2
  import React, { useState } from 'react';
3
3
 
4
-
4
+ interface CheckboxProps {
5
+ label?: string;
6
+ checked?: boolean;
7
+ onChange?: (checked: boolean) => void;
8
+ }
5
9
 
6
10
  export default function Checkbox({
7
11
  label,
@@ -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,6 +1,14 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
 
4
+ interface ModalProps {
5
+ isOpen: boolean;
6
+ title: string;
7
+ children: React.ReactNode;
8
+ onClose: () => void;
9
+ actions?: React.ReactNode;
10
+ }
11
+
4
12
  export default function Modal({
5
13
  isOpen,
6
14
  title,
@@ -1,7 +1,21 @@
1
1
  'use client';
2
2
  import React, { useState, useRef, useEffect } from 'react';
3
3
 
4
- export default function Popover({ anchorEl, open, onClose, children }: PopoverProps) {
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
 
@@ -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
- router.push(href);
47
+ router.push(href);
41
48
  }
42
49
  };
43
50
 
@@ -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
- export default function Tooltip({ title, children }: TooltipProps) {
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);
@@ -1,5 +1,11 @@
1
+ 'use client';
1
2
  import React from 'react';
2
3
 
4
+ interface UserImageProps {
5
+ userHandle: string;
6
+ userImgUrl?: string;
7
+ }
8
+
3
9
  export default function UserImage({
4
10
  userHandle,
5
11
  userImgUrl,
package/global.d.ts CHANGED
@@ -122,7 +122,7 @@ declare global {
122
122
 
123
123
  interface AlertProps {
124
124
  open: boolean;
125
- type: string;
125
+ type: 'success' | 'warning' | 'error' | 'info';
126
126
  message: string;
127
127
  onClose: () => void;
128
128
  }
package/index.ts CHANGED
@@ -1,7 +1,5 @@
1
- import './index.css';
2
- import Button from './components/button/button';
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
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "oneslash-design-system",
3
- "version": "1.0.3",
3
+ "description": "A design system for the Oneslash projects",
4
+ "version": "1.0.4",
4
5
  "private": false,
5
6
  "scripts": {
6
7
  "dev": "next dev",
package/tsconfig.json CHANGED
@@ -32,9 +32,10 @@
32
32
  "next-env.d.ts",
33
33
  "**/*.ts",
34
34
  "**/*.tsx",
35
- ".next/types/**/*.ts"
35
+ ".next/types/**/*.ts",
36
+ "types/**/*.d.ts"
36
37
  ],
37
38
  "exclude": [
38
39
  "node_modules"
39
40
  ]
40
- }
41
+ }