oneslash-design-system 1.1.5 → 1.1.7

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.
Files changed (43) hide show
  1. package/components/button.tsx +23 -3
  2. package/components/menuItem.tsx +17 -4
  3. package/components/modal.tsx +11 -10
  4. package/components/radioGroup.tsx +66 -0
  5. package/package.json +1 -1
  6. package/{tailwind.config.ts → tailwind.config.js} +102 -11
  7. package/dist/components/alert.d.ts +0 -9
  8. package/dist/components/alert.jsx +0 -38
  9. package/dist/components/button.d.ts +0 -13
  10. package/dist/components/button.jsx +0 -141
  11. package/dist/components/checkBox.d.ts +0 -7
  12. package/dist/components/checkBox.jsx +0 -29
  13. package/dist/components/emptyBox.d.ts +0 -7
  14. package/dist/components/emptyBox.jsx +0 -17
  15. package/dist/components/iconButton.d.ts +0 -11
  16. package/dist/components/iconButton.jsx +0 -126
  17. package/dist/components/loadingScreen.d.ts +0 -3
  18. package/dist/components/loadingScreen.jsx +0 -14
  19. package/dist/components/menuItem.d.ts +0 -10
  20. package/dist/components/menuItem.jsx +0 -96
  21. package/dist/components/modal.d.ts +0 -11
  22. package/dist/components/modal.jsx +0 -49
  23. package/dist/components/popover.d.ts +0 -10
  24. package/dist/components/popover.jsx +0 -52
  25. package/dist/components/tab.d.ts +0 -12
  26. package/dist/components/tab.jsx +0 -113
  27. package/dist/components/tag.d.ts +0 -15
  28. package/dist/components/tag.jsx +0 -123
  29. package/dist/components/textField.d.ts +0 -20
  30. package/dist/components/textField.jsx +0 -55
  31. package/dist/components/timeStamp.d.ts +0 -7
  32. package/dist/components/timeStamp.jsx +0 -58
  33. package/dist/components/tooltip.d.ts +0 -7
  34. package/dist/components/tooltip.jsx +0 -41
  35. package/dist/components/userImage.d.ts +0 -7
  36. package/dist/components/userImage.jsx +0 -13
  37. package/dist/designTokens.d.ts +0 -354
  38. package/dist/designTokens.js +0 -232
  39. package/dist/index.d.ts +0 -17
  40. package/dist/index.js +0 -17
  41. package/dist/output.css +0 -1166
  42. package/dist/tailwind.config.d.ts +0 -3
  43. package/dist/tailwind.config.js +0 -214
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import React, { useState, useEffect, useCallback } from 'react';
3
+ import UserImage from './userImage';
3
4
 
4
5
  interface ButtonProps{
5
6
  size: 'small' | 'medium' | 'large';
@@ -7,6 +8,8 @@ interface ButtonProps{
7
8
  state: 'enabled' | 'hovered' | 'focused' | 'disabled';
8
9
  label: string;
9
10
  decoIcon?: string;
11
+ userHandle?: string;
12
+ userImgUrl?: string;
10
13
  actionIcon?: string;
11
14
  onClickButton?: any;
12
15
  onClickActionIcon?: () => void;
@@ -20,6 +23,8 @@ export default function Button({
20
23
  state,
21
24
  label,
22
25
  decoIcon,
26
+ userHandle,
27
+ userImgUrl,
23
28
  actionIcon,
24
29
  onClickButton,
25
30
  onClickActionIcon,
@@ -108,12 +113,27 @@ export default function Button({
108
113
  onMouseLeave={() => { if (state !== 'disabled') setIsHovered(false); }}
109
114
  onClick={onClickButton} // Button click action
110
115
  >
111
- {IconLeft && (
116
+ {/* conditionally render left section */}
117
+ {(IconLeft || userImgUrl || userHandle) && (
118
+ <div className="flex items-center space-x-2">
119
+ {/* Render dynamic icon if available */}
120
+ {IconLeft && (
112
121
  <IconLeft className={sizeIcon} />
113
- )}
114
- <div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2">
122
+ )}
123
+
124
+ {/* Render UserImage if userImgUrl or userHandle is provided */}
125
+ {(userImgUrl || userHandle) && (
126
+ <UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl} />
127
+ )}
128
+ </div>
129
+ )}
130
+
131
+ {/* label */}
132
+ <div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2 text-left">
115
133
  {label}
116
134
  </div>
135
+
136
+ {/* right icon */}
117
137
  {IconRight && (
118
138
  <div onClick={onClickActionIcon} className="cursor-pointer">
119
139
  <IconRight className={sizeIcon} />
@@ -1,12 +1,15 @@
1
1
  'use client';
2
2
  import React, { useState, useEffect, useCallback, SVGProps } from 'react';
3
3
  import NextLink from 'next/link';
4
+ import UserImage from './userImage';
4
5
 
5
6
  type IconType = (props: SVGProps<SVGSVGElement>) => JSX.Element;
6
7
 
7
8
  interface MenuItemProps {
8
9
  href?: string;
9
10
  iconName?: string;
11
+ userHandle?: string;
12
+ userImgUrl?: string;
10
13
  label: string;
11
14
  isSelected?: boolean;
12
15
  onClick: any;
@@ -14,13 +17,15 @@ interface MenuItemProps {
14
17
 
15
18
  export default function MenuItem({
16
19
  href = '#',
17
- iconName,
20
+ iconName,
21
+ userHandle,
22
+ userImgUrl,
18
23
  label,
19
24
  isSelected,
20
25
  onClick, }
21
26
  : MenuItemProps) {
22
27
 
23
- const [Icon, setIcon] = useState<IconType | null>(null);
28
+ const [IconLeft, setIconLeft] = useState<IconType | null>(null);
24
29
 
25
30
  // Import icon dynamically
26
31
  const loadIcon = useCallback(async (iconName?: string) => {
@@ -38,7 +43,7 @@ export default function MenuItem({
38
43
  useEffect(() => {
39
44
  const fetchIcon = async () => {
40
45
  if (iconName) {
41
- setIcon(await loadIcon(iconName));
46
+ setIconLeft(await loadIcon(iconName));
42
47
  }
43
48
  };
44
49
  fetchIcon();
@@ -57,10 +62,18 @@ export default function MenuItem({
57
62
  style={{ width: '100%' }}
58
63
  onClick={onClick}
59
64
  >
60
- {Icon && <Icon className="w-6 h-6" />}
65
+ {/* render userImage. render dynamic icon if userImage is not available */}
66
+ {userImgUrl || userHandle ? (
67
+ <UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl || ''} />
68
+ ) : (
69
+ IconLeft && <IconLeft className="w-6 h-6" />
70
+ )}
71
+
72
+ {/* label */}
61
73
  <span className="whitespace-nowrap text-body1 px-2">
62
74
  {label}
63
75
  </span>
76
+
64
77
  </div>
65
78
  </NextLink>
66
79
  );
@@ -41,10 +41,10 @@ export default function Modal({
41
41
  };
42
42
  }, [onClose]);
43
43
 
44
- // Determine width based on size prop
45
- const modalWidth = size === 'large' ? 'w-[1200px]' : 'w-[600px]';
46
- const maxWidth = size === 'large' ? '1200px' : '600px';
47
-
44
+ // Define dimensions based on size
45
+ const dimensions = size === 'large'
46
+ ? { width: '1200px', height: '800px' }
47
+ : { width: '600px' };
48
48
 
49
49
 
50
50
  return (
@@ -57,21 +57,22 @@ export default function Modal({
57
57
  tabIndex={-1}
58
58
  >
59
59
  <div
60
- className={`flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4 ${modalWidth}`}
61
60
  style={{
62
- maxWidth,
61
+ maxWidth: dimensions.width,
62
+ ...(size === 'large' && { maxHeight: dimensions.height }),
63
63
  width: 'calc(100vw - 64px)',
64
- maxHeight: '800px',
65
- height: 'auto',
66
- overflowY: 'auto',
64
+ height: size === 'large' ? 'calc(100vh - 64px)' : 'auto',
65
+ overflowY: size === 'large' ? 'auto' : 'visible',
67
66
  }}
67
+ className={`flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4`}
68
+
68
69
  >
69
70
  {title && (
70
71
  <h2 id="modal-title" className="text-h6">
71
72
  {title}
72
73
  </h2>
73
74
  )}
74
- <div className="text-body1">
75
+ <div className="flex-grow overflow-auto">
75
76
  {children}
76
77
  </div>
77
78
  {actions && (
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ interface RadioOption {
5
+ label: string;
6
+ value: string;
7
+ }
8
+
9
+ interface RadioGroupProps {
10
+ options: RadioOption[];
11
+ selectedValue: string;
12
+ onChange: (value: string) => void;
13
+ name: string;
14
+ direction?: 'horizontal' | 'vertical';
15
+ }
16
+
17
+ export default function RadioGroup({
18
+ options,
19
+ selectedValue,
20
+ onChange,
21
+ name,
22
+ direction = 'vertical',
23
+ }: RadioGroupProps) {
24
+ return (
25
+ <div
26
+ className={`flex ${
27
+ direction === 'horizontal' ? 'space-x-4' : 'flex-col space-y-2'
28
+ }`}
29
+ >
30
+ {options.map((option) => (
31
+ <label
32
+ key={option.value}
33
+ className="flex items-center cursor-pointer"
34
+ >
35
+ <div
36
+ onClick={() => onChange(option.value)}
37
+ className="relative flex items-center justify-center w-6 h-6 group"
38
+ >
39
+ {/* Hover background circle */}
40
+ <div
41
+ className={`absolute w-6 h-6 rounded-full transition-all
42
+ hover:bg-light-action-hovered dark:group-hover:bg-dark-action-hovered
43
+ bg-transparent group-hover:w-7 group-hover:h-7`}
44
+ ></div>
45
+
46
+ {/* Outer circle */}
47
+ <div
48
+ className={`relative z-10 w-4 h-4 border-2 rounded-full transition-colors
49
+ ${selectedValue === option.value ? 'border-light-text-primary dark:border-dark-text-primary' : 'border-light-text-secondary dark:border-dark-text-secondary'}
50
+ `}
51
+ >
52
+
53
+ {/* Inner circle when selected */}
54
+ {selectedValue === option.value && (
55
+ <div
56
+ className="w-2 h-2 bg-light-text-primary dark:bg-dark-text-primary rounded-full absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
57
+ />
58
+ )}
59
+ </div>
60
+ </div>
61
+ <span className="ml-2 text-body1">{option.label}</span>
62
+ </label>
63
+ ))}
64
+ </div>
65
+ );
66
+ }
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.5",
4
+ "version": "1.1.7",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -1,12 +1,11 @@
1
- import type { Config } from "tailwindcss";
2
-
3
1
  const designTokens = require('./designTokens');
4
2
 
5
- const config: Config = {
3
+ module.exports = {
4
+ darkMode: 'class',
6
5
  content: [
7
- "./app/**/*.{js,ts,jsx,tsx}",
6
+ "./src/**/*.{js,jsx,ts,tsx}",
7
+ "./dist/**/*.{html,js}",
8
8
  "./components/**/*.{js,ts,jsx,tsx}",
9
- "./pages/**/*.{js,ts,jsx,tsx}",
10
9
  ],
11
10
  theme: {
12
11
  extend: {
@@ -156,12 +155,11 @@ const config: Config = {
156
155
  'dark-misc-scrollbar-bg': designTokens.colors.dark.background.default,
157
156
  'dark-misc-scrollbar-thumb': designTokens.colors.dark.background.accent200,
158
157
  },
159
- spacing: ({ theme }) => ({
160
- ...theme('spacing'), // Retain default spacing
158
+ spacing: {
161
159
  small: designTokens.spacing.small,
162
160
  medium: designTokens.spacing.medium,
163
161
  large: designTokens.spacing.large,
164
- }),
162
+ },
165
163
  fontSize: {
166
164
  h1: designTokens.typography.h1.size,
167
165
  h2: designTokens.typography.h2.size,
@@ -229,7 +227,100 @@ const config: Config = {
229
227
  require('tailwindcss'),
230
228
  require('autoprefixer'),
231
229
  require('tailwind-scrollbar'),
232
-
230
+ function({ addUtilities, theme }) {
231
+ const newUtilities = {
232
+ '.text-h1': {
233
+ fontSize: theme('fontSize.h1'),
234
+ fontWeight: theme('fontWeight.h1'),
235
+ letterSpacing: theme('letterSpacing.h1'),
236
+ lineHeight: theme('lineHeight.h1'),
237
+ fontFamily: theme('fontFamily.inter'),
238
+ },
239
+ '.text-h2': {
240
+ fontSize: theme('fontSize.h2'),
241
+ fontWeight: theme('fontWeight.h2'),
242
+ letterSpacing: theme('letterSpacing.h2'),
243
+ lineHeight: theme('lineHeight.h2'),
244
+ fontFamily: theme('fontFamily.inter'),
245
+ },
246
+ '.text-h3': {
247
+ fontSize: theme('fontSize.h3'),
248
+ fontWeight: theme('fontWeight.h3'),
249
+ letterSpacing: theme('letterSpacing.h3'),
250
+ lineHeight: theme('lineHeight.h3'),
251
+ fontFamily: theme('fontFamily.inter'),
252
+ },
253
+ '.text-h4': {
254
+ fontSize: theme('fontSize.h4'),
255
+ fontWeight: theme('fontWeight.h4'),
256
+ letterSpacing: theme('letterSpacing.h4'),
257
+ lineHeight: theme('lineHeight.h4'),
258
+ fontFamily: theme('fontFamily.inter'),
259
+ },
260
+ '.text-h5': {
261
+ fontSize: theme('fontSize.h5'),
262
+ fontWeight: theme('fontWeight.h5'),
263
+ letterSpacing: theme('letterSpacing.h5'),
264
+ lineHeight: theme('lineHeight.h5'),
265
+ fontFamily: theme('fontFamily.inter'),
266
+ },
267
+ '.text-h6': {
268
+ fontSize: theme('fontSize.h6'),
269
+ fontWeight: theme('fontWeight.h6'),
270
+ letterSpacing: theme('letterSpacing.h6'),
271
+ lineHeight: theme('lineHeight.h6'),
272
+ fontFamily: theme('fontFamily.inter'),
273
+ },
274
+ '.text-subtitle1': {
275
+ fontSize: theme('fontSize.subtitle1'),
276
+ fontWeight: theme('fontWeight.subtitle1'),
277
+ letterSpacing: theme('letterSpacing.subtitle1'),
278
+ lineHeight: theme('lineHeight.subtitle1'),
279
+ fontFamily: theme('fontFamily.inter'),
280
+ },
281
+ '.text-subtitle2': {
282
+ fontSize: theme('fontSize.subtitle2'),
283
+ fontWeight: theme('fontWeight.subtitle2'),
284
+ letterSpacing: theme('letterSpacing.subtitle2'),
285
+ lineHeight: theme('lineHeight.subtitle2'),
286
+ fontFamily: theme('fontFamily.inter'),
287
+ },
288
+ '.text-body1': {
289
+ fontSize: theme('fontSize.body1'),
290
+ fontWeight: theme('fontWeight.body1'),
291
+ letterSpacing: theme('letterSpacing.body1'),
292
+ lineHeight: theme('lineHeight.body1'),
293
+ fontFamily: theme('fontFamily.inter'),
294
+ },
295
+ '.text-body2': {
296
+ fontSize: theme('fontSize.body2'),
297
+ fontWeight: theme('fontWeight.body2'),
298
+ letterSpacing: theme('letterSpacing.body2'),
299
+ lineHeight: theme('lineHeight.body2'),
300
+ fontFamily: theme('fontFamily.inter'),
301
+ },
302
+ '.text-caption': {
303
+ fontSize: theme('fontSize.caption'),
304
+ fontWeight: theme('fontWeight.caption'),
305
+ letterSpacing: theme('letterSpacing.caption'),
306
+ lineHeight: theme('lineHeight.caption'),
307
+ fontFamily: theme('fontFamily.inter'),
308
+ },
309
+ '.text-left': {
310
+ textAlign: theme('textAlign.left'),
311
+ },
312
+ '.text-center': {
313
+ textAlign: theme('textAlign.center'),
314
+ },
315
+ '.text-right': {
316
+ textAlign: theme('textAlign.right'),
317
+ },
318
+ '.text-justify': {
319
+ textAlign: theme('textAlign.justify'),
320
+ },
321
+ };
322
+
323
+ addUtilities(newUtilities);
324
+ },
233
325
  ],
234
- };
235
- export default config;
326
+ }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface AlertProps {
3
- open?: boolean;
4
- type: 'success' | 'warning' | 'error' | 'info';
5
- message: string;
6
- onClose: () => void;
7
- }
8
- export default function Alert({ open, type, message, onClose }: AlertProps): React.JSX.Element | null;
9
- export {};
@@ -1,38 +0,0 @@
1
- 'use client';
2
- import React, { useEffect } from 'react';
3
- export default function Alert(_a) {
4
- var open = _a.open, type = _a.type, message = _a.message, onClose = _a.onClose;
5
- useEffect(function () {
6
- if (open) {
7
- var timer_1 = setTimeout(function () {
8
- onClose();
9
- }, 3000);
10
- return function () { return clearTimeout(timer_1); };
11
- }
12
- }, [open, onClose]);
13
- if (!open)
14
- return null;
15
- var bgColor;
16
- switch (type) {
17
- case 'error':
18
- bgColor = 'bg-light-error-main dark:bg-dark-error-main';
19
- break;
20
- case 'warning':
21
- bgColor = 'bg-light-warning-main dark:bg-dark-warning-main';
22
- break;
23
- case 'info':
24
- bgColor = 'bg-light-info-main dark:bg-dark-info-main';
25
- break;
26
- case 'success':
27
- bgColor = 'bg-light-success-main dark:bg-dark-success-main';
28
- break;
29
- }
30
- return (<div className="fixed top-4 inset-x-0 z-50 flex justify-center">
31
- <div className={"flex items-center justify-between w-full max-w-md p-4 rounded-[8px] shadow-lg text-light-text-contrast dark:text-dark-text-contrast ".concat(bgColor)}>
32
- <span>{message}</span>
33
- <button onClick={onClose} className="ml-4 text-xl font-bold">
34
- &times;
35
- </button>
36
- </div>
37
- </div>);
38
- }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- interface ButtonProps {
3
- size: 'small' | 'medium' | 'large';
4
- type: 'primary' | 'secondary' | 'tertiary' | 'textOnly';
5
- state: 'enabled' | 'hovered' | 'focused' | 'disabled';
6
- label: string;
7
- decoIcon?: string;
8
- actionIcon?: string;
9
- onClickButton?: any;
10
- onClickActionIcon?: () => void;
11
- }
12
- export default function Button({ size, type, state, label, decoIcon, actionIcon, onClickButton, onClickActionIcon, }: ButtonProps): React.JSX.Element;
13
- export {};
@@ -1,141 +0,0 @@
1
- 'use client';
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- import React, { useState, useEffect, useCallback } from 'react';
39
- export default function Button(_a) {
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;
42
- var _b = useState(false), isHovered = _b[0], setIsHovered = _b[1];
43
- var _c = useState(null), IconLeft = _c[0], setIconLeft = _c[1];
44
- var _d = useState(null), IconRight = _d[0], setIconRight = _d[1];
45
- // Import icon dynamically
46
- var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
47
- var module_1, Icon, error_1;
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0:
51
- if (!iconName)
52
- return [2 /*return*/, null];
53
- _a.label = 1;
54
- case 1:
55
- _a.trys.push([1, 3, , 4]);
56
- return [4 /*yield*/, import('@heroicons/react/24/outline')];
57
- case 2:
58
- module_1 = _a.sent();
59
- Icon = module_1[iconName];
60
- return [2 /*return*/, Icon || null];
61
- case 3:
62
- error_1 = _a.sent();
63
- console.error("Failed to load icon ".concat(iconName, ":"), error_1);
64
- return [2 /*return*/, null];
65
- case 4: return [2 /*return*/];
66
- }
67
- });
68
- }); }, []);
69
- useEffect(function () {
70
- var fetchIcons = function () { return __awaiter(_this, void 0, void 0, function () {
71
- var _a, _b;
72
- return __generator(this, function (_c) {
73
- switch (_c.label) {
74
- case 0:
75
- if (!decoIcon) return [3 /*break*/, 2];
76
- _a = setIconLeft;
77
- return [4 /*yield*/, loadIcon(decoIcon)];
78
- case 1:
79
- _a.apply(void 0, [_c.sent()]);
80
- _c.label = 2;
81
- case 2:
82
- if (!actionIcon) return [3 /*break*/, 4];
83
- _b = setIconRight;
84
- return [4 /*yield*/, loadIcon(actionIcon)];
85
- case 3:
86
- _b.apply(void 0, [_c.sent()]);
87
- _c.label = 4;
88
- case 4: return [2 /*return*/];
89
- }
90
- });
91
- }); };
92
- fetchIcons();
93
- }, [decoIcon, actionIcon, loadIcon]);
94
- // Define classes for size
95
- var sizeClasses = {
96
- large: 'text-body1 p-2',
97
- medium: 'text-body1 p-1',
98
- small: 'text-body2 p-1',
99
- }[size];
100
- // Define icon size classes
101
- var sizeIcon = {
102
- large: 'w-6 h-6',
103
- medium: 'w-5 h-5',
104
- small: 'w-4 h-4',
105
- }[size];
106
- // Define classes for button types
107
- var baseTypeClasses = {
108
- primary: 'bg-light-accent-main dark:bg-dark-accent-main text-light-text-primary dark:text-dark-text-contrast',
109
- secondary: 'bg-light-primary-main dark:bg-dark-primary-main text-light-text-contrast dark:text-dark-text-contrast',
110
- tertiary: 'bg-light-background-accent200 dark:bg-dark-background-accent200 text-light-text-primary dark:text-dark-text-primary',
111
- textOnly: 'text-light-text-primary dark:text-dark-text-primary',
112
- }[type];
113
- var hoverTypeClasses = {
114
- primary: 'hover:bg-light-accent-dark hover:dark:bg-dark-accent-dark',
115
- secondary: 'hover:bg-light-primary-dark dark:hover:bg-dark-primary-dark',
116
- tertiary: 'hover:bg-light-background-accent300 hover:dark:bg-dark-background-accent300',
117
- textOnly: 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100',
118
- }[type];
119
- // State classes
120
- var stateClasses = {
121
- enabled: 'cursor-pointer',
122
- focused: 'ring-2 ring-offset-4 ring-offset-light-background-default dark:ring-offset-dark-background-default ring-light-accent-main dark:ring-dark-accent-main',
123
- disabled: type === 'textOnly'
124
- ? 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-transparent'
125
- : 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-light-actionBackground-disabled dark:bg-dark-actionBackground-disabled',
126
- };
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 ");
129
- return (<button className={buttonClasses} onMouseEnter={function () { if (state !== 'disabled')
130
- setIsHovered(true); }} onMouseLeave={function () { if (state !== 'disabled')
131
- setIsHovered(false); }} onClick={onClickButton} // Button click action
132
- >
133
- {IconLeft && (<IconLeft className={sizeIcon}/>)}
134
- <div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2">
135
- {label}
136
- </div>
137
- {IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
138
- <IconRight className={sizeIcon}/>
139
- </div>)}
140
- </button>);
141
- }
@@ -1,7 +0,0 @@
1
- interface CheckboxProps {
2
- label?: string;
3
- checked?: boolean;
4
- onChange?: (checked: boolean) => void;
5
- }
6
- export default function Checkbox({ label, checked, onChange }: CheckboxProps): import("react").JSX.Element;
7
- export {};
@@ -1,29 +0,0 @@
1
- 'use client';
2
- import { useState } from 'react';
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 _c = useState(checked), isChecked = _c[0], setIsChecked = _c[1];
6
- var handleToggle = function () {
7
- var newChecked = !isChecked;
8
- setIsChecked(newChecked);
9
- if (onChange) {
10
- onChange(newChecked);
11
- }
12
- };
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">
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>
17
-
18
- {/* Checkbox */}
19
- <div className={"relative z-10 w-4 h-4 border-2 rounded ".concat(isChecked
20
- ? 'bg-light-accent-main dark:bg-dark-accent-main border-none'
21
- : 'border-light-text-secondary dark:border-dark-text-secondary', " flex items-center justify-center transition-colors")}>
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
- <path strokeWidth="2" d="M1 6l4 3 6-7"/>
24
- </svg>)}
25
- </div>
26
- </div>
27
- {label && <span className="ml-2">{label}</span>}
28
- </label>);
29
- }
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface EmptyBoxProps {
3
- text: string;
4
- size: "small" | "large";
5
- }
6
- export default function EmptyBox({ text, size, }: EmptyBoxProps): React.JSX.Element;
7
- export {};
@@ -1,17 +0,0 @@
1
- 'use client';
2
- import React from 'react';
3
- import { ExclamationCircleIcon } from '@heroicons/react/24/outline';
4
- export default function EmptyBox(_a) {
5
- var text = _a.text, size = _a.size;
6
- var color = 'text-light-text-disabled dark:text-dark-text-disabled';
7
- var height = size === 'small'
8
- ? 'py-6'
9
- : 'h-full';
10
- var iconSize = 'size-6';
11
- return (<div className={"flex flex-col space-y-2 justify-center items-center w-full ".concat(height)}>
12
- <ExclamationCircleIcon className={"".concat(iconSize, " ").concat(color)}/>
13
- <p className={"text-body1 ".concat(color)} text-center>
14
- {text}
15
- </p>
16
- </div>);
17
- }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import * as HeroIcons from '@heroicons/react/24/outline';
3
- interface IconButtonProps {
4
- variant: "contained" | "iconOnly";
5
- color: "primary" | "secondary";
6
- state: "enabled" | "selected" | "disabled";
7
- iconName: keyof typeof HeroIcons;
8
- onClick?: any;
9
- }
10
- export default function IconButton({ variant, color, state, iconName, onClick, }: IconButtonProps): React.JSX.Element;
11
- export {};