cynx-lib 1.3.32 → 1.3.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-lib",
3
- "version": "1.3.32",
3
+ "version": "1.3.33",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -13,6 +13,7 @@ export default function Input({
13
13
  hint,
14
14
  error,
15
15
  size = 'md',
16
+ type = 'text',
16
17
  icon,
17
18
  iconRight,
18
19
  clearable = false,
@@ -29,6 +30,18 @@ export default function Input({
29
30
  const [hovered, setHovered] = useState(false);
30
31
  const s = SIZES[size] || SIZES.md;
31
32
 
33
+ const isPasswd = type === 'passwd';
34
+ const resolvedType = isPasswd ? 'text' : type;
35
+ const hasValue = value !== undefined && value !== null && value !== '';
36
+
37
+ const passwdStyle = isPasswd ? {
38
+ WebkitTextSecurity: 'disc',
39
+ textSecurity: 'disc',
40
+ fontFamily: hasValue ? 'monospace' : 'var(--f,var(--sans,inherit))',
41
+ fontWeight: hasValue ? 700 : 'normal',
42
+ letterSpacing: hasValue ? '0.15em' : 'normal',
43
+ } : {};
44
+
32
45
  function handleClear() {
33
46
  if (props.onChange) props.onChange({ target: { value: '' } });
34
47
  if (onClear) onClear();
@@ -137,6 +150,7 @@ export default function Input({
137
150
  ) : (
138
151
  <input
139
152
  ref={inputRef}
153
+ type={resolvedType}
140
154
  className={className}
141
155
  style={{
142
156
  display: 'block',
@@ -160,6 +174,7 @@ export default function Input({
160
174
  : 'var(--shadow,0 1px 3px rgba(20,22,41,.1))',
161
175
  opacity: props.disabled ? 0.5 : 1,
162
176
  cursor: props.disabled ? 'not-allowed' : undefined,
177
+ ...passwdStyle,
163
178
  ...style,
164
179
  }}
165
180
  value={value}