oneslash-design-system 1.1.25 → 1.1.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.
@@ -1,15 +1,16 @@
1
1
  'use client';
2
2
  import React, { useState, useEffect, useCallback } from 'react';
3
3
 
4
- interface ButtonProps{
4
+ interface ButtonProps {
5
5
  size: 'small' | 'medium' | 'large';
6
6
  type: 'primary' | 'secondary' | 'tertiary' | 'textOnly';
7
7
  state: 'enabled' | 'hovered' | 'focused' | 'disabled';
8
8
  label: string;
9
9
  decoIcon?: string;
10
10
  actionIcon?: string;
11
- onClickButton?: any;
11
+ onClickButton?: any;
12
12
  onClickActionIcon?: () => void;
13
+ className?: string;
13
14
  }
14
15
 
15
16
  type IconType = React.ComponentType<React.SVGProps<SVGSVGElement>>;
@@ -23,12 +24,12 @@ export default function Button({
23
24
  actionIcon,
24
25
  onClickButton,
25
26
  onClickActionIcon,
27
+ className = '',
26
28
  }: ButtonProps) {
27
29
  const [isHovered, setIsHovered] = useState(false);
28
30
  const [IconLeft, setIconLeft] = useState<IconType | null>(null);
29
31
  const [IconRight, setIconRight] = useState<IconType | null>(null);
30
32
 
31
- // Import icon dynamically
32
33
  const loadIcon = useCallback(async (iconName?: string) => {
33
34
  if (!iconName) return null;
34
35
  try {
@@ -53,21 +54,18 @@ export default function Button({
53
54
  fetchIcons();
54
55
  }, [decoIcon, actionIcon, loadIcon]);
55
56
 
56
- // Define classes for size
57
57
  const sizeClasses = {
58
58
  large: 'text-body1 p-2',
59
59
  medium: 'text-body1 p-1',
60
60
  small: 'text-body2 p-1',
61
61
  }[size];
62
62
 
63
- // Define icon size classes
64
63
  const sizeIcon = {
65
64
  large: 'w-6 h-6',
66
65
  medium: 'w-5 h-5',
67
66
  small: 'w-4 h-4',
68
67
  }[size];
69
68
 
70
- // Define classes for button types
71
69
  const baseTypeClasses = {
72
70
  primary: 'bg-light-accent-main dark:bg-dark-accent-main text-light-text-primary dark:text-dark-text-contrast',
73
71
  secondary: 'bg-light-secondary-main dark:bg-dark-secondary-main text-light-text-primary dark:text-dark-text-primary',
@@ -82,7 +80,6 @@ export default function Button({
82
80
  textOnly: 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100',
83
81
  }[type];
84
82
 
85
- // State classes
86
83
  const stateClasses = {
87
84
  enabled: 'cursor-pointer',
88
85
  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',
@@ -91,28 +88,27 @@ export default function Button({
91
88
  : 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-light-actionBackground-disabled dark:bg-dark-actionBackground-disabled',
92
89
  };
93
90
 
94
- // Build the button classes dynamically
95
91
  const buttonClasses = `
96
- flex flex-row space-x-2 items-center rounded-[8px] transition-colors duration-200 ease-in-out
92
+ flex flex-row items-center rounded-[8px] transition-colors duration-200 ease-in-out justify-between
97
93
  ${sizeClasses}
98
94
  ${state === 'enabled' ? baseTypeClasses : ''}
99
95
  ${state === 'focused' ? stateClasses.focused : ''}
100
96
  ${state === 'disabled' ? stateClasses.disabled : baseTypeClasses}
101
97
  ${state !== 'disabled' && isHovered ? hoverTypeClasses : ''}
102
- `;
98
+ ${className}
99
+ `;
103
100
 
104
101
  return (
105
102
  <button
106
- className={buttonClasses}
103
+ className={buttonClasses}
107
104
  onMouseEnter={() => { if (state !== 'disabled') setIsHovered(true); }}
108
105
  onMouseLeave={() => { if (state !== 'disabled') setIsHovered(false); }}
109
- onClick={onClickButton} // Button click action
106
+ onClick={onClickButton}
110
107
  >
111
- {IconLeft && (
112
- <IconLeft className={sizeIcon} />
113
- )}
114
- <div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2">
115
- {label}
108
+ {/* Group IconLeft and label in a flex container for left alignment */}
109
+ <div className="flex items-center space-x-2">
110
+ {IconLeft && <IconLeft className={sizeIcon} />}
111
+ <div className="whitespace-nowrap overflow-hidden truncate">{label}</div>
116
112
  </div>
117
113
  {IconRight && (
118
114
  <div onClick={onClickActionIcon} className="cursor-pointer">
@@ -62,7 +62,7 @@ export default function IconButton({
62
62
  ? 'hover:bg-light-secondary-dark hover:dark:bg-dark-secondary-dark' // Secondary
63
63
  : color === 'tertiary'
64
64
  ? 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200' // Tertiary
65
- : 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100'; // iconOnly
65
+ : 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200'; // iconOnly
66
66
 
67
67
  // Icon color
68
68
  const iconColor = color === 'primary'
@@ -13,16 +13,18 @@ interface MenuItemProps {
13
13
  label: string;
14
14
  isSelected?: boolean;
15
15
  onClick?: any;
16
+ className?: string;
16
17
  }
17
18
 
18
19
  export default function MenuItem({
19
- href = '#',
20
+ href,
20
21
  iconName,
21
22
  userHandle,
22
23
  userImgUrl,
23
24
  label,
24
25
  isSelected,
25
26
  onClick,
27
+ className = '',
26
28
  }: MenuItemProps) {
27
29
  const [IconLeft, setIconLeft] = useState<IconType | null>(null);
28
30
 
@@ -47,34 +49,32 @@ export default function MenuItem({
47
49
  fetchIcon();
48
50
  }, [iconName, loadIcon]);
49
51
 
50
- return (
51
- <NextLink href={href}>
52
- <div
53
- className={`
54
- flex items-center space-x-2 p-2 rounded-[8px] cursor-pointer justify-start transition-colors duration-200 ease-in-out
55
- ${isSelected
56
- ? 'bg-light-background-accent200 dark:bg-dark-background-accent200 hover:bg-light-background-accent300 dark:hover:bg-dark-background-accent300'
57
- : 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100'}
58
- `}
59
- style={{ width: '100%' }}
60
- onClick={onClick}
61
- >
62
- {/* Render UserImage or dynamic icon */}
63
- {userImgUrl || userHandle ? (
64
- <UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl || ''} />
65
- ) : (
66
- IconLeft && (
67
- <IconLeft
68
- className="w-6 h-6 text-light-text-secondary dark:text-dark-text-secondary"
69
- />
70
- )
71
- )}
72
-
73
- {/* Label */}
74
- <span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
75
- {label}
76
- </span>
77
- </div>
78
- </NextLink>
52
+ const content = (
53
+ <div
54
+ className={`
55
+ flex items-center space-x-2 p-2 rounded-[8px] cursor-pointer justify-start transition-colors duration-200 ease-in-out
56
+ ${isSelected
57
+ ? 'bg-light-background-accent300 dark:bg-dark-background-accent300 hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200'
58
+ : 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200'}
59
+ ${className}
60
+ `}
61
+ style={{ width: '100%' }}
62
+ onClick={onClick}
63
+ >
64
+ {userImgUrl ? (
65
+ <UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl} />
66
+ ) : (
67
+ IconLeft && (
68
+ <IconLeft
69
+ className="w-6 h-6 text-light-text-secondary dark:text-dark-text-secondary"
70
+ />
71
+ )
72
+ )}
73
+ <span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
74
+ {label}
75
+ </span>
76
+ </div>
79
77
  );
78
+
79
+ return href ? <NextLink href={href}>{content}</NextLink> : content;
80
80
  }
@@ -59,7 +59,7 @@ export default function Popover({
59
59
  ref={setPopoverElement}
60
60
  style={{ ...styles.popper, display: open ? 'block' : 'none' }}
61
61
  {...attributes.popper}
62
- className="bg-light-background-accent100 dark:bg-dark-background-accent100 rounded-[8px] shadow-lg p-2"
62
+ className="bg-light-background-accent300 dark:bg-dark-background-accent300 rounded-[8px] shadow-lg p-2"
63
63
  role="dialog"
64
64
  >
65
65
  {children}
@@ -16,6 +16,7 @@ interface TextFieldProps {
16
16
  maxRows?: number;
17
17
  disabled?: boolean;
18
18
  error?: boolean;
19
+ size?: 'large' | 'medium' | 'small';
19
20
  }
20
21
 
21
22
  export default function TextField({
@@ -33,16 +34,25 @@ export default function TextField({
33
34
  maxRows = 6,
34
35
  disabled = false,
35
36
  error = false,
37
+ size = 'medium',
36
38
  }: TextFieldProps) {
37
39
  const [isFocused, setIsFocused] = useState(false);
38
40
 
39
- const baseClasses = 'w-full border rounded-[8px] p-2';
41
+ // Define classes for size: text size and padding
42
+ const sizeClasses = {
43
+ large: 'text-body1 p-[7px] leading-[22px]', // body1 (16px), padding 8px(7 + border 1) height 40
44
+ medium: 'text-body1 p-[3px] leading-[22px]', // body1 (16px), padding 4px(3 + border 1), height 32
45
+ small: 'text-body2 p-[3px] leading-[18px]', // body2 (14px), padding 4px(3 + border 1), height 28
46
+ }[size];
47
+
48
+ const baseClasses = 'w-full border rounded-[8px]';
40
49
  const bgColor = 'bg-light-background-default dark:bg-dark-background-default transition-colors duration-200 ease-in-out';
41
50
  const borderColor = 'border-light-outlinedBorder-active dark:border-dark-outlinedBorder-active';
42
51
  const containerClasses = `
43
52
  ${bgColor}
44
53
  ${borderColor}
45
54
  ${baseClasses}
55
+ ${sizeClasses}
46
56
  ${disabled ? 'bg-gray-200 cursor-not-allowed' : ''}
47
57
  ${error ? 'border-red-500 focus:ring-red-500' : ''}
48
58
  ${isFocused ? 'focus:border-light-accent-main focus:dark:border-dark-accent-main outline-none' : ''}
@@ -96,6 +106,7 @@ export default function TextField({
96
106
  onKeyDown={onKeyDown}
97
107
  autoFocus={autoFocus} // Pass autoFocus to textarea
98
108
  disabled={disabled}
109
+ autoComplete="off" // Disable browser autocomplete/autofill
99
110
  />
100
111
  ) : (
101
112
  <input
@@ -115,6 +126,7 @@ export default function TextField({
115
126
  onKeyDown={onKeyDown}
116
127
  autoFocus={autoFocus} // Pass autoFocus to input
117
128
  disabled={disabled}
129
+ autoComplete="off" // Disable browser autocomplete/autofill
118
130
  />
119
131
  )}
120
132
  </div>
@@ -8,6 +8,7 @@ interface ButtonProps {
8
8
  actionIcon?: string;
9
9
  onClickButton?: any;
10
10
  onClickActionIcon?: () => void;
11
+ className?: string;
11
12
  }
12
- export default function Button({ size, type, state, label, decoIcon, actionIcon, onClickButton, onClickActionIcon, }: ButtonProps): React.JSX.Element;
13
+ export default function Button({ size, type, state, label, decoIcon, actionIcon, onClickButton, onClickActionIcon, className, }: ButtonProps): React.JSX.Element;
13
14
  export {};
@@ -38,11 +38,10 @@ 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;
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
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;
42
+ var _c = useState(false), isHovered = _c[0], setIsHovered = _c[1];
43
+ var _d = useState(null), IconLeft = _d[0], setIconLeft = _d[1];
44
+ var _e = useState(null), IconRight = _e[0], setIconRight = _e[1];
46
45
  var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
47
46
  var module_1, Icon, error_1;
48
47
  return __generator(this, function (_a) {
@@ -91,19 +90,16 @@ export default function Button(_a) {
91
90
  }); };
92
91
  fetchIcons();
93
92
  }, [decoIcon, actionIcon, loadIcon]);
94
- // Define classes for size
95
93
  var sizeClasses = {
96
94
  large: 'text-body1 p-2',
97
95
  medium: 'text-body1 p-1',
98
96
  small: 'text-body2 p-1',
99
97
  }[size];
100
- // Define icon size classes
101
98
  var sizeIcon = {
102
99
  large: 'w-6 h-6',
103
100
  medium: 'w-5 h-5',
104
101
  small: 'w-4 h-4',
105
102
  }[size];
106
- // Define classes for button types
107
103
  var baseTypeClasses = {
108
104
  primary: 'bg-light-accent-main dark:bg-dark-accent-main text-light-text-primary dark:text-dark-text-contrast',
109
105
  secondary: 'bg-light-secondary-main dark:bg-dark-secondary-main text-light-text-primary dark:text-dark-text-primary',
@@ -116,7 +112,6 @@ export default function Button(_a) {
116
112
  tertiary: 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200',
117
113
  textOnly: 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100',
118
114
  }[type];
119
- // State classes
120
115
  var stateClasses = {
121
116
  enabled: 'cursor-pointer',
122
117
  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',
@@ -124,15 +119,14 @@ export default function Button(_a) {
124
119
  ? 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-transparent'
125
120
  : 'cursor-not-allowed text-light-text-disabled dark:text-dark-text-disabled bg-light-actionBackground-disabled dark:bg-dark-actionBackground-disabled',
126
121
  };
127
- // Build the button classes dynamically
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 ");
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 : baseTypeClasses, "\n ").concat(state !== 'disabled' && isHovered ? hoverTypeClasses : '', "\n ").concat(className, "\n ");
129
123
  return (<button className={buttonClasses} onMouseEnter={function () { if (state !== 'disabled')
130
124
  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}
125
+ setIsHovered(false); }} onClick={onClickButton}>
126
+ {/* Group IconLeft and label in a flex container for left alignment */}
127
+ <div className="flex items-center space-x-2">
128
+ {IconLeft && <IconLeft className={sizeIcon}/>}
129
+ <div className="whitespace-nowrap overflow-hidden truncate">{label}</div>
136
130
  </div>
137
131
  {IconRight && (<div onClick={onClickActionIcon} className="cursor-pointer">
138
132
  <IconRight className={sizeIcon}/>
@@ -38,7 +38,7 @@ export default function IconButton(_a) {
38
38
  ? 'hover:bg-light-secondary-dark hover:dark:bg-dark-secondary-dark' // Secondary
39
39
  : color === 'tertiary'
40
40
  ? 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200' // Tertiary
41
- : 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100'; // iconOnly
41
+ : 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200'; // iconOnly
42
42
  // Icon color
43
43
  var iconColor = color === 'primary'
44
44
  ? 'text-light-text-primary dark:text-dark-text-contrast' // Primary
@@ -7,6 +7,7 @@ interface MenuItemProps {
7
7
  label: string;
8
8
  isSelected?: boolean;
9
9
  onClick?: any;
10
+ className?: string;
10
11
  }
11
- export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, isSelected, onClick, }: MenuItemProps): React.JSX.Element;
12
+ export default function MenuItem({ href, iconName, userHandle, userImgUrl, label, isSelected, onClick, className, }: MenuItemProps): React.JSX.Element;
12
13
  export {};
@@ -40,7 +40,7 @@ import NextLink from 'next/link';
40
40
  import UserImage from './userImage';
41
41
  export default function MenuItem(_a) {
42
42
  var _this = this;
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;
43
+ 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;
44
44
  var _c = useState(null), IconLeft = _c[0], setIconLeft = _c[1];
45
45
  var loadIcon = useCallback(function (iconName) { return __awaiter(_this, void 0, void 0, function () {
46
46
  var module_1, IconComponent, error_1;
@@ -83,17 +83,13 @@ export default function MenuItem(_a) {
83
83
  }); };
84
84
  fetchIcon();
85
85
  }, [iconName, loadIcon]);
86
- return (<NextLink href={href}>
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
88
- ? 'bg-light-background-accent200 dark:bg-dark-background-accent200 hover:bg-light-background-accent300 dark:hover:bg-dark-background-accent300'
89
- : 'hover:bg-light-background-accent100 hover:dark:bg-dark-background-accent100', "\n ")} style={{ width: '100%' }} onClick={onClick}>
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"/>))}
92
-
93
- {/* Label */}
94
- <span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
95
- {label}
96
- </span>
97
- </div>
98
- </NextLink>);
86
+ var content = (<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
87
+ ? 'bg-light-background-accent300 dark:bg-dark-background-accent300 hover:bg-light-background-accent200 dark:hover:bg-dark-background-accent200'
88
+ : 'hover:bg-light-background-accent200 hover:dark:bg-dark-background-accent200', "\n ").concat(className, "\n ")} style={{ width: '100%' }} onClick={onClick}>
89
+ {userImgUrl ? (<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl}/>) : (IconLeft && (<IconLeft className="w-6 h-6 text-light-text-secondary dark:text-dark-text-secondary"/>))}
90
+ <span className="whitespace-nowrap text-body1 px-2 text-light-text-primary dark:text-dark-text-primary">
91
+ {label}
92
+ </span>
93
+ </div>);
94
+ return href ? <NextLink href={href}>{content}</NextLink> : content;
99
95
  }
@@ -45,7 +45,7 @@ export default function Popover(_a) {
45
45
  if (!open || !hasMounted || !anchorEl)
46
46
  return null;
47
47
  // Render popover in a portal to prevent layout shifts and positioning issues
48
- return createPortal(<div id={id} ref={setPopoverElement} style={__assign(__assign({}, styles.popper), { display: open ? 'block' : 'none' })} {...attributes.popper} className="bg-light-background-accent100 dark:bg-dark-background-accent100 rounded-[8px] shadow-lg p-2" role="dialog">
48
+ return createPortal(<div id={id} ref={setPopoverElement} style={__assign(__assign({}, styles.popper), { display: open ? 'block' : 'none' })} {...attributes.popper} className="bg-light-background-accent300 dark:bg-dark-background-accent300 rounded-[8px] shadow-lg p-2" role="dialog">
49
49
  {children}
50
50
  </div>, document.body // Mounting the popover in the document body for isolation
51
51
  );
@@ -14,7 +14,8 @@ interface TextFieldProps {
14
14
  maxRows?: number;
15
15
  disabled?: boolean;
16
16
  error?: boolean;
17
+ size?: 'large' | 'medium' | 'small';
17
18
  }
18
19
  export default function TextField({ id, label, value, onChange, onBlur, onFocus, onKeyDown, autoFocus, // Accept the autoFocus prop with default value
19
- iconLeft, iconRight, multiline, maxRows, disabled, error, }: TextFieldProps): React.JSX.Element;
20
+ iconLeft, iconRight, multiline, maxRows, disabled, error, size, }: TextFieldProps): React.JSX.Element;
20
21
  export {};
@@ -2,12 +2,18 @@
2
2
  import React, { useState } from 'react';
3
3
  export default function TextField(_a) {
4
4
  var id = _a.id, label = _a.label, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyDown = _a.onKeyDown, _b = _a.autoFocus, autoFocus = _b === void 0 ? false : _b, // Accept the autoFocus prop with default value
5
- iconLeft = _a.iconLeft, iconRight = _a.iconRight, _c = _a.multiline, multiline = _c === void 0 ? false : _c, _d = _a.maxRows, maxRows = _d === void 0 ? 6 : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.error, error = _f === void 0 ? false : _f;
6
- var _g = useState(false), isFocused = _g[0], setIsFocused = _g[1];
7
- var baseClasses = 'w-full border rounded-[8px] p-2';
5
+ iconLeft = _a.iconLeft, iconRight = _a.iconRight, _c = _a.multiline, multiline = _c === void 0 ? false : _c, _d = _a.maxRows, maxRows = _d === void 0 ? 6 : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.error, error = _f === void 0 ? false : _f, _g = _a.size, size = _g === void 0 ? 'medium' : _g;
6
+ var _h = useState(false), isFocused = _h[0], setIsFocused = _h[1];
7
+ // Define classes for size: text size and padding
8
+ var sizeClasses = {
9
+ large: 'text-body1 p-[7px] leading-[22px]', // body1 (16px), padding 8px(7 + border 1) height 40
10
+ medium: 'text-body1 p-[3px] leading-[22px]', // body1 (16px), padding 4px(3 + border 1), height 32
11
+ small: 'text-body2 p-[3px] leading-[18px]', // body2 (14px), padding 4px(3 + border 1), height 28
12
+ }[size];
13
+ var baseClasses = 'w-full border rounded-[8px]';
8
14
  var bgColor = 'bg-light-background-default dark:bg-dark-background-default transition-colors duration-200 ease-in-out';
9
15
  var borderColor = 'border-light-outlinedBorder-active dark:border-dark-outlinedBorder-active';
10
- var containerClasses = "\n ".concat(bgColor, "\n ").concat(borderColor, "\n ").concat(baseClasses, "\n ").concat(disabled ? 'bg-gray-200 cursor-not-allowed' : '', "\n ").concat(error ? 'border-red-500 focus:ring-red-500' : '', "\n ").concat(isFocused ? 'focus:border-light-accent-main focus:dark:border-dark-accent-main outline-none' : '', "\n ").concat(!disabled && !error ? 'hover:border-light-outlinedBorder-hover' : '', "\n border-gray-300\n ");
16
+ var containerClasses = "\n ".concat(bgColor, "\n ").concat(borderColor, "\n ").concat(baseClasses, "\n ").concat(sizeClasses, "\n ").concat(disabled ? 'bg-gray-200 cursor-not-allowed' : '', "\n ").concat(error ? 'border-red-500 focus:ring-red-500' : '', "\n ").concat(isFocused ? 'focus:border-light-accent-main focus:dark:border-dark-accent-main outline-none' : '', "\n ").concat(!disabled && !error ? 'hover:border-light-outlinedBorder-hover' : '', "\n border-gray-300\n ");
11
17
  var renderIconRight = function () {
12
18
  if (React.isValidElement(iconRight)) {
13
19
  return iconRight;
@@ -37,7 +43,8 @@ export default function TextField(_a) {
37
43
  if (onBlur)
38
44
  onBlur(e);
39
45
  }} onKeyDown={onKeyDown} autoFocus={autoFocus} // Pass autoFocus to textarea
40
- disabled={disabled}/>) : (<input id={id} type="text" className={containerClasses} value={value} onChange={onChange} onFocus={function (e) {
46
+ disabled={disabled} autoComplete="off" // Disable browser autocomplete/autofill
47
+ />) : (<input id={id} type="text" className={containerClasses} value={value} onChange={onChange} onFocus={function (e) {
41
48
  setIsFocused(true);
42
49
  if (onFocus)
43
50
  onFocus(e);
@@ -46,7 +53,8 @@ export default function TextField(_a) {
46
53
  if (onBlur)
47
54
  onBlur(e);
48
55
  }} onKeyDown={onKeyDown} autoFocus={autoFocus} // Pass autoFocus to input
49
- disabled={disabled}/>)}
56
+ disabled={disabled} autoComplete="off" // Disable browser autocomplete/autofill
57
+ />)}
50
58
  </div>
51
59
  {error && (<p className="mt-1 text-light-error-main text-body2">
52
60
  This field is required
package/dist/output.css CHANGED
@@ -497,6 +497,39 @@ video {
497
497
  scrollbar-color: initial;
498
498
  scrollbar-width: initial;
499
499
  }
500
+ .container {
501
+ width: 100%;
502
+ }
503
+ @media (min-width: 640px) {
504
+
505
+ .container {
506
+ max-width: 640px;
507
+ }
508
+ }
509
+ @media (min-width: 768px) {
510
+
511
+ .container {
512
+ max-width: 768px;
513
+ }
514
+ }
515
+ @media (min-width: 1024px) {
516
+
517
+ .container {
518
+ max-width: 1024px;
519
+ }
520
+ }
521
+ @media (min-width: 1280px) {
522
+
523
+ .container {
524
+ max-width: 1280px;
525
+ }
526
+ }
527
+ @media (min-width: 1536px) {
528
+
529
+ .container {
530
+ max-width: 1536px;
531
+ }
532
+ }
500
533
  .visible {
501
534
  visibility: visible;
502
535
  }
@@ -618,9 +651,6 @@ video {
618
651
  .max-w-md {
619
652
  max-width: 28rem;
620
653
  }
621
- .flex-1 {
622
- flex: 1 1 0%;
623
- }
624
654
  .transform {
625
655
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
626
656
  }
@@ -832,6 +862,12 @@ video {
832
862
  .p-6 {
833
863
  padding: 1.5rem;
834
864
  }
865
+ .p-\[3px\] {
866
+ padding: 3px;
867
+ }
868
+ .p-\[7px\] {
869
+ padding: 7px;
870
+ }
835
871
  .px-2 {
836
872
  padding-left: 0.5rem;
837
873
  padding-right: 0.5rem;
@@ -880,6 +916,12 @@ video {
880
916
  .font-bold {
881
917
  font-weight: 700;
882
918
  }
919
+ .leading-\[18px\] {
920
+ line-height: 18px;
921
+ }
922
+ .leading-\[22px\] {
923
+ line-height: 22px;
924
+ }
883
925
  .leading-none {
884
926
  line-height: 1;
885
927
  }
@@ -990,11 +1032,6 @@ body {
990
1032
  background-color: rgb(247 247 247 / var(--tw-bg-opacity));
991
1033
  }
992
1034
 
993
- .hover\:bg-light-background-accent300:hover {
994
- --tw-bg-opacity: 1;
995
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
996
- }
997
-
998
1035
  .hover\:bg-light-secondary-dark:hover {
999
1036
  --tw-bg-opacity: 1;
1000
1037
  background-color: rgb(136 136 136 / var(--tw-bg-opacity));
@@ -1150,11 +1187,6 @@ body {
1150
1187
  background-color: rgb(69 69 69 / var(--tw-bg-opacity));
1151
1188
  }
1152
1189
 
1153
- .dark\:hover\:bg-dark-background-accent300:hover {
1154
- --tw-bg-opacity: 1;
1155
- background-color: rgb(79 79 79 / var(--tw-bg-opacity));
1156
- }
1157
-
1158
1190
  .dark\:hover\:bg-dark-secondary-dark:hover {
1159
1191
  --tw-bg-opacity: 1;
1160
1192
  background-color: rgb(69 69 69 / var(--tw-bg-opacity));
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.25",
4
+ "version": "1.1.26",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",