@idealyst/datepicker 1.0.58 → 1.0.59

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": "@idealyst/datepicker",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "description": "Cross-platform date and time picker components for React and React Native",
5
5
  "documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/datepicker#readme",
6
6
  "readme": "README.md",
@@ -36,8 +36,8 @@
36
36
  "publish:npm": "npm publish"
37
37
  },
38
38
  "peerDependencies": {
39
- "@idealyst/components": "^1.0.58",
40
- "@idealyst/theme": "^1.0.58",
39
+ "@idealyst/components": "^1.0.59",
40
+ "@idealyst/theme": "^1.0.59",
41
41
  "react": ">=16.8.0",
42
42
  "react-native": ">=0.60.0",
43
43
  "react-native-svg": ">=13.0.0",
@@ -18,12 +18,18 @@ export const DateInput: React.FC<DateInputProps> = (props) => {
18
18
  ...baseProps
19
19
  } = props;
20
20
 
21
- // Initialize styles
22
- dateInputStyles.useVariants({
23
- size,
24
- variant,
25
- state: disabled ? 'disabled' : error ? 'error' : undefined,
26
- });
21
+ // Determine input style based on state
22
+ const getInputStyle = () => {
23
+ const styles = [dateInputStyles.input];
24
+
25
+ if (disabled) {
26
+ styles.push(dateInputStyles.inputDisabled);
27
+ } else if (error) {
28
+ styles.push(dateInputStyles.inputError);
29
+ }
30
+
31
+ return styles;
32
+ };
27
33
 
28
34
  return (
29
35
  <View style={style} testID={testID}>
@@ -54,7 +60,7 @@ export const DateInput: React.FC<DateInputProps> = (props) => {
54
60
  onBlur={onBlur}
55
61
  placeholder={placeholder}
56
62
  editable={editable}
57
- style={[inputStyleProp, inputStyle]}
63
+ style={[...getInputStyle(), inputStyle]}
58
64
  testID={inputTestID}
59
65
  autoComplete="off"
60
66
  autoCorrect={false}
@@ -1,118 +1,80 @@
1
- import { createStyleSheet } from 'react-native-unistyles';
1
+ import { StyleSheet } from 'react-native-unistyles';
2
2
 
3
- export const dateInputStyles = createStyleSheet((theme) => ({
3
+ export const dateInputStyles = StyleSheet.create((theme) => ({
4
4
  container: {
5
5
  width: '100%',
6
6
  },
7
7
 
8
8
  input: {
9
9
  borderWidth: 1,
10
- borderColor: theme.colors.border,
11
- borderRadius: theme.radius.medium,
12
- paddingHorizontal: theme.spacing.medium,
13
- paddingVertical: theme.spacing.small,
14
- fontSize: theme.typography.body.fontSize,
15
- fontFamily: theme.typography.body.fontFamily,
16
- color: theme.colors.text,
17
- backgroundColor: theme.colors.background,
18
-
19
- variants: {
20
- size: {
21
- small: {
22
- paddingHorizontal: theme.spacing.small,
23
- paddingVertical: theme.spacing.xs,
24
- fontSize: theme.typography.caption.fontSize,
25
- },
26
- medium: {
27
- paddingHorizontal: theme.spacing.medium,
28
- paddingVertical: theme.spacing.small,
29
- fontSize: theme.typography.body.fontSize,
30
- },
31
- large: {
32
- paddingHorizontal: theme.spacing.large,
33
- paddingVertical: theme.spacing.medium,
34
- fontSize: theme.typography.subtitle.fontSize,
35
- },
36
- },
37
-
38
- variant: {
39
- outlined: {
40
- borderWidth: 1,
41
- backgroundColor: 'transparent',
42
- },
43
- filled: {
44
- borderWidth: 0,
45
- backgroundColor: theme.colors.surfaceVariant,
46
- },
47
- },
48
-
49
- state: {
50
- focused: {
51
- borderColor: theme.colors.primary,
52
- borderWidth: 2,
53
- },
54
- disabled: {
55
- backgroundColor: theme.colors.disabled,
56
- color: theme.colors.onDisabled,
57
- borderColor: theme.colors.outline,
58
- },
59
- error: {
60
- borderColor: theme.colors.error,
61
- borderWidth: 2,
62
- },
63
- },
64
- },
10
+ borderColor: theme.colors?.border?.primary || '#e5e7eb',
11
+ borderRadius: theme.borderRadius?.md || 8,
12
+ paddingHorizontal: theme.spacing?.md || 12,
13
+ paddingVertical: theme.spacing?.sm || 8,
14
+ fontSize: theme.typography?.sizes?.medium || 16,
15
+ color: theme.colors?.text?.primary || '#1f2937',
16
+ backgroundColor: theme.colors?.surface?.primary || '#ffffff',
65
17
 
66
18
  _web: {
67
19
  outlineStyle: 'none',
68
20
  cursor: 'text',
69
-
70
- ':focus': {
71
- borderColor: theme.colors.primary,
72
- borderWidth: 2,
73
- },
74
-
75
- ':disabled': {
76
- cursor: 'not-allowed',
77
- },
21
+ border: `1px solid ${theme.colors?.border?.primary || '#e5e7eb'}`,
22
+ borderWidth: undefined,
23
+ borderColor: undefined,
78
24
  },
79
25
  },
80
26
 
81
27
  inputError: {
82
- borderColor: theme.colors.error,
28
+ borderColor: theme.colors?.text?.error || '#dc2626',
83
29
  borderWidth: 2,
30
+
31
+ _web: {
32
+ border: `2px solid ${theme.colors?.text?.error || '#dc2626'}`,
33
+ borderWidth: undefined,
34
+ borderColor: undefined,
35
+ },
84
36
  },
85
37
 
86
38
  inputFocused: {
87
- borderColor: theme.colors.primary,
39
+ borderColor: theme.colors?.primary || '#3b82f6',
88
40
  borderWidth: 2,
41
+
42
+ _web: {
43
+ border: `2px solid ${theme.colors?.primary || '#3b82f6'}`,
44
+ borderWidth: undefined,
45
+ borderColor: undefined,
46
+ },
89
47
  },
90
48
 
91
49
  inputDisabled: {
92
- backgroundColor: theme.colors.disabled,
93
- color: theme.colors.onDisabled,
94
- borderColor: theme.colors.outline,
50
+ backgroundColor: theme.colors?.surface?.disabled || '#f9fafb',
51
+ color: theme.colors?.text?.disabled || '#9ca3af',
52
+ borderColor: theme.colors?.border?.disabled || '#d1d5db',
53
+
54
+ _web: {
55
+ cursor: 'not-allowed',
56
+ border: `1px solid ${theme.colors?.border?.disabled || '#d1d5db'}`,
57
+ borderWidth: undefined,
58
+ borderColor: undefined,
59
+ },
95
60
  },
96
61
 
97
62
  label: {
98
- fontSize: theme.typography.caption.fontSize,
99
- fontFamily: theme.typography.caption.fontFamily,
100
- color: theme.colors.onSurface,
101
- marginBottom: theme.spacing.xs,
63
+ fontSize: theme.typography?.sizes?.small || 14,
64
+ color: theme.colors?.text?.primary || '#1f2937',
65
+ marginBottom: theme.spacing?.xs || 4,
102
66
  fontWeight: '500',
103
67
  },
104
68
 
105
69
  helperText: {
106
- fontSize: theme.typography.caption.fontSize,
107
- fontFamily: theme.typography.caption.fontFamily,
108
- color: theme.colors.onSurfaceVariant,
109
- marginTop: theme.spacing.xs,
70
+ fontSize: theme.typography?.sizes?.small || 12,
71
+ color: theme.colors?.text?.secondary || '#6b7280',
72
+ marginTop: theme.spacing?.xs || 4,
110
73
  },
111
74
 
112
75
  errorText: {
113
- fontSize: theme.typography.caption.fontSize,
114
- fontFamily: theme.typography.caption.fontFamily,
115
- color: theme.colors.error,
116
- marginTop: theme.spacing.xs,
76
+ fontSize: theme.typography?.sizes?.small || 12,
77
+ color: theme.colors?.text?.error || '#dc2626',
78
+ marginTop: theme.spacing?.xs || 4,
117
79
  },
118
80
  }));
@@ -18,12 +18,18 @@ export const DateInput: React.FC<DateInputProps> = (props) => {
18
18
  ...baseProps
19
19
  } = props;
20
20
 
21
- // Initialize styles
22
- dateInputStyles.useVariants({
23
- size,
24
- variant,
25
- state: disabled ? 'disabled' : error ? 'error' : undefined,
26
- });
21
+ // Determine input style based on state
22
+ const getInputStyle = () => {
23
+ const styles = [dateInputStyles.input];
24
+
25
+ if (disabled) {
26
+ styles.push(dateInputStyles.inputDisabled);
27
+ } else if (error) {
28
+ styles.push(dateInputStyles.inputError);
29
+ }
30
+
31
+ return styles;
32
+ };
27
33
 
28
34
  return (
29
35
  <View style={style} testID={testID}>
@@ -54,7 +60,7 @@ export const DateInput: React.FC<DateInputProps> = (props) => {
54
60
  onBlur={onBlur}
55
61
  placeholder={placeholder}
56
62
  editable={editable}
57
- style={[inputStyleProp, inputStyle]}
63
+ style={[...getInputStyle(), inputStyle]}
58
64
  testID={inputTestID}
59
65
  autoComplete="off"
60
66
  autoCorrect={false}
@@ -222,10 +222,7 @@ export const DateInputBase: React.FC<DateInputBaseProps> = ({
222
222
  onBlur: handleBlur,
223
223
  placeholder,
224
224
  editable: !disabled,
225
- style: [
226
- dateInputStyles.input,
227
- hasError && dateInputStyles.inputError,
228
- ],
225
+ style: inputStyleProp,
229
226
  testID: testID ? `${testID}-input` : undefined,
230
227
  })}
231
228
  </View>