cynx-lib 1.3.31 → 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.31",
3
+ "version": "1.3.33",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -327,7 +327,7 @@ export function DatePicker({ value, onChange, label, placeholder = 'Select date'
327
327
  return (
328
328
  <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 4, padding: '4px 0' }}>
329
329
  {MONTHS.map((name, i) => {
330
- const sel = value && value.getFullYear() === y && value.getMonth() === i;
330
+ const sel = valDate && valDate.getFullYear() === y && valDate.getMonth() === i;
331
331
  const monthStart = new Date(y, i, 1);
332
332
  const monthEnd = new Date(y, i + 1, 0, 23, 59, 59, 999);
333
333
  const disMin = minD && monthEnd < new Date(new Date(minD).setHours(0, 0, 0, 0));
@@ -377,7 +377,7 @@ export function DatePicker({ value, onChange, label, placeholder = 'Select date'
377
377
  return (
378
378
  <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 4, padding: '4px 0' }}>
379
379
  {years.map(yr => {
380
- const sel = value && value.getFullYear() === yr;
380
+ const sel = valDate && valDate.getFullYear() === yr;
381
381
  const yrStart = new Date(yr, 0, 1);
382
382
  const yrEnd = new Date(yr, 11, 31, 23, 59, 59, 999);
383
383
  const disMin = minD && yrEnd < new Date(new Date(minD).setHours(0, 0, 0, 0));
@@ -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}