@idealyst/datepicker 1.2.57 → 1.2.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 +3 -3
- package/src/DateInput.web.tsx +2 -1
- package/src/flattenStyle.ts +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/datepicker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.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,7 +36,7 @@
|
|
|
36
36
|
"publish:npm": "npm publish"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@idealyst/theme": "^1.2.
|
|
39
|
+
"@idealyst/theme": "^1.2.59",
|
|
40
40
|
"@mdi/js": ">=7.0.0",
|
|
41
41
|
"@mdi/react": ">=1.6.0",
|
|
42
42
|
"react": ">=16.8.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@idealyst/theme": "^1.2.
|
|
72
|
+
"@idealyst/theme": "^1.2.59",
|
|
73
73
|
"@mdi/js": "^7.4.47",
|
|
74
74
|
"@mdi/react": "^1.6.1",
|
|
75
75
|
"@types/react": "^19.1.0",
|
package/src/DateInput.web.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { IconSvg } from './IconSvg.web';
|
|
|
7
7
|
import { DatePicker } from './DatePicker';
|
|
8
8
|
import { dateTimeInputStyles } from './InputStyles';
|
|
9
9
|
import type { DateInputProps } from './types';
|
|
10
|
+
import { flattenStyle } from './flattenStyle';
|
|
10
11
|
|
|
11
12
|
export const DateInput: React.FC<DateInputProps> = ({
|
|
12
13
|
value,
|
|
@@ -107,7 +108,7 @@ export const DateInput: React.FC<DateInputProps> = ({
|
|
|
107
108
|
const popoverProps = getWebProps([popoverContentStyle]);
|
|
108
109
|
|
|
109
110
|
return (
|
|
110
|
-
<div style={style
|
|
111
|
+
<div style={flattenStyle(style)}>
|
|
111
112
|
{label && (
|
|
112
113
|
<span {...labelProps}>{label}</span>
|
|
113
114
|
)}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StyleProp } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Flattens a style prop (which can be a single style, an array of styles,
|
|
5
|
+
* or nested arrays) into a single style object.
|
|
6
|
+
*/
|
|
7
|
+
export function flattenStyle<T extends object>(
|
|
8
|
+
style: StyleProp<T> | React.CSSProperties | undefined
|
|
9
|
+
): React.CSSProperties {
|
|
10
|
+
if (!style) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(style)) {
|
|
15
|
+
return style.reduce<React.CSSProperties>((acc, s) => {
|
|
16
|
+
return { ...acc, ...flattenStyle(s as StyleProp<T>) };
|
|
17
|
+
}, {});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return style as React.CSSProperties;
|
|
21
|
+
}
|