oneslash-design-system 1.1.24 → 1.1.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.
@@ -2,6 +2,7 @@
2
2
  import React, { useState } from 'react';
3
3
  import * as HeroIcons24 from '@heroicons/react/24/outline';
4
4
  import * as HeroIcons20 from '@heroicons/react/20/solid';
5
+ import { LoadingSmall } from './loadingScreen';
5
6
 
6
7
  interface IconButtonProps {
7
8
  color: "primary" | "secondary" | "tertiary" | "iconOnly";
@@ -9,6 +10,7 @@ interface IconButtonProps {
9
10
  size: "large" | "medium" | "small";
10
11
  iconName: keyof typeof HeroIcons24 & keyof typeof HeroIcons20;
11
12
  onClick?: any;
13
+ loading?: boolean;
12
14
  }
13
15
 
14
16
  type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
@@ -19,6 +21,7 @@ export default function IconButton({
19
21
  size,
20
22
  iconName,
21
23
  onClick,
24
+ loading = false, // Default to false
22
25
  }: IconButtonProps) {
23
26
  const [isHovered, setIsHovered] = useState(false);
24
27
 
@@ -41,7 +44,7 @@ export default function IconButton({
41
44
  };
42
45
 
43
46
  // Base classes (padding and corner radius)
44
- const baseClasses = `${sizeClasses[size]} rounded-[8px] leading-none`;
47
+ const baseClasses = `${sizeClasses[size]} rounded-[8px] leading-none relative`;
45
48
 
46
49
  // Background color
47
50
  const bgColor = color === 'primary'
@@ -70,8 +73,10 @@ export default function IconButton({
70
73
  ? 'text-light-text-primary dark:text-dark-text-primary' // Tertiary
71
74
  : 'text-light-text-primary dark:text-dark-text-primary'; // iconOnly
72
75
 
73
- // state
74
- const stateClasses = state === 'disabled'
76
+ // State classes, including loading
77
+ const stateClasses = loading
78
+ ? 'cursor-wait' // Show a waiting cursor during loading
79
+ : state === 'disabled'
75
80
  ? 'cursor-not-allowed opacity-50'
76
81
  : state === 'selected'
77
82
  ? 'cursor-pointer ring-2 ring-offset-2 ring-blue-500'
@@ -81,13 +86,18 @@ export default function IconButton({
81
86
 
82
87
  return (
83
88
  <button
84
- className={`${baseClasses} ${bgColor} ${iconColor} ${bgColorHover} ${stateClasses} transition-colors duration-200 ease-in-out`}
85
- disabled={state === 'disabled'}
89
+ className={`${baseClasses} ${bgColor} ${iconColor} ${bgColorHover} ${stateClasses} transition-colors duration-200 ease-in-out flex items-center justify-center`}
90
+ disabled={state === 'disabled' || loading} // Disable button during loading
86
91
  onMouseEnter={() => setIsHovered(true)}
87
92
  onMouseLeave={() => setIsHovered(false)}
88
93
  onClick={onClick}
94
+ aria-label={loading ? 'Loading' : 'Reload'}
89
95
  >
90
- {Icon && <Icon className={iconSizeClasses[size]} />}
96
+ {loading ? (
97
+ <LoadingSmall size={size} /> // Pass the size prop to match the icon
98
+ ) : (
99
+ Icon && <Icon className={iconSizeClasses[size]} /> // Show icon when not loading
100
+ )}
91
101
  </button>
92
102
  );
93
103
  }
@@ -1,6 +1,10 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
 
4
+ interface LoadingSmallProps {
5
+ size?: 'large' | 'medium' | 'small'; // Match IconButton sizes
6
+ }
7
+
4
8
  export default function LoadingScreen() {
5
9
  return (
6
10
  <div className="flex justify-center items-center h-full w-full min-h-[200px]">
@@ -9,10 +13,18 @@ export default function LoadingScreen() {
9
13
  );
10
14
  };
11
15
 
12
- export function LoadingSmall() {
16
+ export function LoadingSmall({ size = 'medium' }: LoadingSmallProps) {
17
+ const spinnerSizeClasses = {
18
+ large: 'w-6 h-6 border-2', // 24px, border-2 for proportional thickness
19
+ medium: 'w-6 h-6 border-2', // 24px, border-2
20
+ small: 'w-5 h-5 border-2', // 20px, slightly thinner border
21
+ };
22
+
13
23
  return (
14
- <div className="flex justify-center items-center h-[40px] w-[40px]">
15
- <div className="w-[40px] h-[40px] border-4 border-t-transparent border-light-accent-main rounded-full animate-spin"></div>
24
+ <div className="flex justify-center items-center">
25
+ <div
26
+ className={`border-t-transparent border-light-accent-main rounded-full animate-spin ${spinnerSizeClasses[size]}`}
27
+ />
16
28
  </div>
17
29
  );
18
- };
30
+ }
@@ -125,7 +125,7 @@ export default function Button(_a) {
125
125
  : 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-light-actionBackground-disabled dark:bg-dark-actionBackground-disabled',
126
126
  };
127
127
  // Build the button classes dynamically
128
- var buttonClasses = "\n flex flex-row space-x-2 items-center rounded-[8px]\n ".concat(sizeClasses, "\n ").concat(state === 'enabled' ? baseTypeClasses : '', "\n ").concat(state === 'focused' ? stateClasses.focused : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled : baseTypeClasses, "\n ").concat(state !== 'disabled' && isHovered ? hoverTypeClasses : '', "\n ");
128
+ var buttonClasses = "\n flex flex-row space-x-2 items-center rounded-[8px] transition-colors duration-200 ease-in-out\n ".concat(sizeClasses, "\n ").concat(state === 'enabled' ? baseTypeClasses : '', "\n ").concat(state === 'focused' ? stateClasses.focused : '', "\n ").concat(state === 'disabled' ? stateClasses.disabled : baseTypeClasses, "\n ").concat(state !== 'disabled' && isHovered ? hoverTypeClasses : '', "\n ");
129
129
  return (<button className={buttonClasses} onMouseEnter={function () { if (state !== 'disabled')
130
130
  setIsHovered(true); }} onMouseLeave={function () { if (state !== 'disabled')
131
131
  setIsHovered(false); }} onClick={onClickButton} // Button click action
@@ -11,14 +11,14 @@ export default function Checkbox(_a) {
11
11
  }
12
12
  };
13
13
  return (<label className="flex items-center cursor-pointer">
14
- <div onClick={handleToggle} className="relative flex items-center justify-center w-6 h-6 group">
14
+ <div onClick={handleToggle} className="relative flex items-center justify-center w-6 h-6 group transition-colors duration-200 ease-in-out">
15
15
  {/* Circle behind the checkbox */}
16
- <div className="absolute w-6 h-6 rounded-full group-hover:bg-light-action-selected dark:group-hover:bg-dark-action-selected transition-all"></div>
16
+ <div className="absolute w-6 h-6 rounded-full group-hover:bg-light-action-selected dark:group-hover:bg-dark-action-selected"></div>
17
17
 
18
18
  {/* Checkbox */}
19
19
  <div className={"relative z-10 w-4 h-4 border-2 rounded ".concat(isChecked
20
20
  ? 'bg-light-text-primary dark:bg-dark-text-primary border-none'
21
- : 'border-light-text-secondary dark:border-dark-text-secondary', " flex items-center justify-center transition-colors duration-200 ease-in-out")}>
21
+ : 'border-light-text-secondary dark:border-dark-text-secondary', " flex items-center justify-center")}>
22
22
  {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
23
  <path strokeWidth="2" d="M1 6l4 3 6-7"/>
24
24
  </svg>)}
@@ -7,6 +7,7 @@ interface IconButtonProps {
7
7
  size: "large" | "medium" | "small";
8
8
  iconName: keyof typeof HeroIcons24 & keyof typeof HeroIcons20;
9
9
  onClick?: any;
10
+ loading?: boolean;
10
11
  }
11
- export default function IconButton({ color, state, size, iconName, onClick, }: IconButtonProps): React.JSX.Element;
12
+ export default function IconButton({ color, state, size, iconName, onClick, loading, }: IconButtonProps): React.JSX.Element;
12
13
  export {};
@@ -2,9 +2,10 @@
2
2
  import React, { useState } from 'react';
3
3
  import * as HeroIcons24 from '@heroicons/react/24/outline';
4
4
  import * as HeroIcons20 from '@heroicons/react/20/solid';
5
+ import { LoadingSmall } from './loadingScreen';
5
6
  export default function IconButton(_a) {
6
- var color = _a.color, state = _a.state, size = _a.size, iconName = _a.iconName, onClick = _a.onClick;
7
- var _b = useState(false), isHovered = _b[0], setIsHovered = _b[1];
7
+ var color = _a.color, state = _a.state, size = _a.size, iconName = _a.iconName, onClick = _a.onClick, _b = _a.loading, loading = _b === void 0 ? false : _b;
8
+ var _c = useState(false), isHovered = _c[0], setIsHovered = _c[1];
8
9
  // Select icon based on size
9
10
  var Icon = size === 'small'
10
11
  ? HeroIcons20[iconName]
@@ -21,7 +22,7 @@ export default function IconButton(_a) {
21
22
  small: 'size-5', // 20px
22
23
  };
23
24
  // Base classes (padding and corner radius)
24
- var baseClasses = "".concat(sizeClasses[size], " rounded-[8px] leading-none");
25
+ var baseClasses = "".concat(sizeClasses[size], " rounded-[8px] leading-none relative");
25
26
  // Background color
26
27
  var bgColor = color === 'primary'
27
28
  ? 'bg-light-accent-main dark:bg-dark-accent-main' // Primary
@@ -46,15 +47,20 @@ export default function IconButton(_a) {
46
47
  : color === 'tertiary'
47
48
  ? 'text-light-text-primary dark:text-dark-text-primary' // Tertiary
48
49
  : 'text-light-text-primary dark:text-dark-text-primary'; // iconOnly
49
- // state
50
- var stateClasses = state === 'disabled'
51
- ? 'cursor-not-allowed opacity-50'
52
- : state === 'selected'
53
- ? 'cursor-pointer ring-2 ring-offset-2 ring-blue-500'
54
- : isHovered
55
- ? 'cursor-pointer hover:bg-opacity-75'
56
- : 'cursor-pointer';
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]}/>}
50
+ // State classes, including loading
51
+ var stateClasses = loading
52
+ ? 'cursor-wait' // Show a waiting cursor during loading
53
+ : state === 'disabled'
54
+ ? 'cursor-not-allowed opacity-50'
55
+ : state === 'selected'
56
+ ? 'cursor-pointer ring-2 ring-offset-2 ring-blue-500'
57
+ : isHovered
58
+ ? 'cursor-pointer hover:bg-opacity-75'
59
+ : 'cursor-pointer';
60
+ return (<button className={"".concat(baseClasses, " ").concat(bgColor, " ").concat(iconColor, " ").concat(bgColorHover, " ").concat(stateClasses, " transition-colors duration-200 ease-in-out flex items-center justify-center")} disabled={state === 'disabled' || loading} // Disable button during loading
61
+ onMouseEnter={function () { return setIsHovered(true); }} onMouseLeave={function () { return setIsHovered(false); }} onClick={onClick} aria-label={loading ? 'Loading' : 'Reload'}>
62
+ {loading ? (<LoadingSmall size={size}/> // Pass the size prop to match the icon
63
+ ) : (Icon && <Icon className={iconSizeClasses[size]}/> // Show icon when not loading
64
+ )}
59
65
  </button>);
60
66
  }
@@ -1,3 +1,7 @@
1
1
  import React from 'react';
2
+ interface LoadingSmallProps {
3
+ size?: 'large' | 'medium' | 'small';
4
+ }
2
5
  export default function LoadingScreen(): React.JSX.Element;
3
- export declare function LoadingSmall(): React.JSX.Element;
6
+ export declare function LoadingSmall({ size }: LoadingSmallProps): React.JSX.Element;
7
+ export {};
@@ -6,9 +6,14 @@ export default function LoadingScreen() {
6
6
  </div>);
7
7
  }
8
8
  ;
9
- export function LoadingSmall() {
10
- return (<div className="flex justify-center items-center h-[40px] w-[40px]">
11
- <div className="w-[40px] h-[40px] border-4 border-t-transparent border-light-accent-main rounded-full animate-spin"></div>
9
+ export function LoadingSmall(_a) {
10
+ var _b = _a.size, size = _b === void 0 ? 'medium' : _b;
11
+ var spinnerSizeClasses = {
12
+ large: 'w-6 h-6 border-2', // 24px, border-2 for proportional thickness
13
+ medium: 'w-6 h-6 border-2', // 24px, border-2
14
+ small: 'w-5 h-5 border-2', // 20px, slightly thinner border
15
+ };
16
+ return (<div className="flex justify-center items-center">
17
+ <div className={"border-t-transparent border-light-accent-main rounded-full animate-spin ".concat(spinnerSizeClasses[size])}/>
12
18
  </div>);
13
19
  }
14
- ;
@@ -42,7 +42,6 @@ export default function MenuItem(_a) {
42
42
  var _this = this;
43
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
44
  var _c = useState(null), IconLeft = _c[0], setIconLeft = _c[1];
45
- // Import icon dynamically
46
45
  var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
47
46
  var module_1, IconComponent, error_1;
48
47
  return __generator(this, function (_a) {
@@ -85,14 +84,14 @@ export default function MenuItem(_a) {
85
84
  fetchIcon();
86
85
  }, [iconName, loadIcon]);
87
86
  return (<NextLink href={href}>
88
- <div className={"\n flex items-center space-x-2 p-2 rounded-[8px] cursor-pointer justify-start\n ".concat(isSelected
87
+ <div className={"\n flex items-center space-x-2 p-2 rounded-[8px] cursor-pointer justify-start transition-colors duration-200 ease-in-out\n ".concat(isSelected
89
88
  ? 'bg-light-background-accent200 dark:bg-dark-background-accent200 hover:bg-light-background-accent300 dark:hover:bg-dark-background-accent300'
90
89
  : 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100', "\n ")} style={{ width: '100%' }} onClick={onClick}>
91
- {/* render userImage. render dynamic icon if userImage is not available */}
92
- {userImgUrl || userHandle ? (<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl || ''}/>) : (IconLeft && <IconLeft className="w-6 h-6"/>)}
90
+ {/* Render UserImage or dynamic icon */}
91
+ {userImgUrl || userHandle ? (<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl || ''}/>) : (IconLeft && (<IconLeft className="w-6 h-6 text-light-text-secondary dark:text-dark-text-secondary"/>))}
93
92
 
94
- {/* label */}
95
- <span className="whitespace-nowrap text-body1 px-2 text-light-text-secondary dark:text-dark-text-secondary">
93
+ {/* Label */}
94
+ <span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
96
95
  {label}
97
96
  </span>
98
97
  </div>
@@ -99,7 +99,7 @@ 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 py-1 px-[6px] rounded-[8px] cursor-pointer justify-start transition-colors duration-200 ease-in-outh\n ".concat(isSelected
102
+ 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
103
  ? 'bg-light-primary-dark dark:bg-dark-primary-dark text-light-text-contrast dark:text-dark-text-contrast'
104
104
  : 'hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200', "\n ")} onClick={handleClick}>
105
105
  {IconLeft && <IconLeft className="w-6 h-6"/>}
@@ -4,7 +4,7 @@ interface TagProps {
4
4
  variant: 'contained' | 'textOnly';
5
5
  size: 'medium' | 'small';
6
6
  state?: 'enabled' | 'selected';
7
- label: string;
7
+ label: React.ReactNode;
8
8
  iconName?: keyof typeof HeroIcons;
9
9
  onClick?: React.MouseEventHandler<HTMLDivElement>;
10
10
  color?: 'default' | 'info';
@@ -78,7 +78,7 @@ module.exports = {
78
78
  // dark
79
79
  dark: {
80
80
  text: {
81
- primary: '#ebebeb',
81
+ primary: '#eeeeee',
82
82
  secondary: '#B0B0B0',
83
83
  disabled: '#6D6D6D',
84
84
  contrast: '#000000',
@@ -220,7 +220,7 @@ module.exports = {
220
220
  weight: '400',
221
221
  size: '12px',
222
222
  lineHeight: '150%',
223
- letterSpacing: '0.3px',
223
+ letterSpacing: '0.5px',
224
224
  },
225
225
  alignments: {
226
226
  left: 'left',
package/dist/output.css CHANGED
@@ -582,9 +582,6 @@ video {
582
582
  .h-6 {
583
583
  height: 1.5rem;
584
584
  }
585
- .h-\[40px\] {
586
- height: 40px;
587
- }
588
585
  .h-full {
589
586
  height: 100%;
590
587
  }
@@ -612,9 +609,6 @@ video {
612
609
  .w-\[1200px\] {
613
610
  width: 1200px;
614
611
  }
615
- .w-\[40px\] {
616
- width: 40px;
617
- }
618
612
  .w-\[600px\] {
619
613
  width: 600px;
620
614
  }
@@ -645,6 +639,9 @@ video {
645
639
  .cursor-pointer {
646
640
  cursor: pointer;
647
641
  }
642
+ .cursor-wait {
643
+ cursor: wait;
644
+ }
648
645
  .flex-row {
649
646
  flex-direction: row;
650
647
  }
@@ -888,7 +885,7 @@ video {
888
885
  }
889
886
  .text-dark-text-primary {
890
887
  --tw-text-opacity: 1;
891
- color: rgb(255 255 255 / var(--tw-text-opacity));
888
+ color: rgb(238 238 238 / var(--tw-text-opacity));
892
889
  }
893
890
  .text-light-error-main {
894
891
  --tw-text-opacity: 1;
@@ -956,18 +953,13 @@ video {
956
953
  --tw-blur: blur(8px);
957
954
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
958
955
  }
959
- .transition-all {
960
- transition-property: all;
961
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
962
- transition-duration: 150ms;
963
- }
964
956
  .transition-colors {
965
957
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
966
958
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
967
959
  transition-duration: 150ms;
968
960
  }
969
- .duration-300 {
970
- transition-duration: 300ms;
961
+ .duration-200 {
962
+ transition-duration: 200ms;
971
963
  }
972
964
  .ease-in-out {
973
965
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@@ -1031,7 +1023,7 @@ body {
1031
1023
 
1032
1024
  .dark\:border-dark-text-primary {
1033
1025
  --tw-border-opacity: 1;
1034
- border-color: rgb(255 255 255 / var(--tw-border-opacity));
1026
+ border-color: rgb(238 238 238 / var(--tw-border-opacity));
1035
1027
  }
1036
1028
 
1037
1029
  .dark\:border-dark-text-secondary {
@@ -1096,7 +1088,7 @@ body {
1096
1088
 
1097
1089
  .dark\:bg-dark-text-primary {
1098
1090
  --tw-bg-opacity: 1;
1099
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
1091
+ background-color: rgb(238 238 238 / var(--tw-bg-opacity));
1100
1092
  }
1101
1093
 
1102
1094
  .dark\:bg-dark-warning-main {
@@ -1126,7 +1118,7 @@ body {
1126
1118
 
1127
1119
  .dark\:text-dark-text-primary {
1128
1120
  --tw-text-opacity: 1;
1129
- color: rgb(255 255 255 / var(--tw-text-opacity));
1121
+ color: rgb(238 238 238 / var(--tw-text-opacity));
1130
1122
  }
1131
1123
 
1132
1124
  .dark\:text-dark-text-secondary {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oneslash-design-system",
3
3
  "description": "A design system for the Oneslash projects",
4
- "version": "1.1.24",
4
+ "version": "1.1.25",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",