@expo/ui 0.2.0-alpha.2 → 0.2.0-alpha.4
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/CHANGELOG.md +9 -0
- package/android/build.gradle +2 -2
- package/build/swift-ui/Chart/index.d.ts +163 -0
- package/build/swift-ui/Chart/index.d.ts.map +1 -0
- package/build/swift-ui/Chart/index.js +11 -0
- package/build/swift-ui/Chart/index.js.map +1 -0
- package/build/swift-ui/index.d.ts +1 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/index.js +1 -0
- package/build/swift-ui/index.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +12 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.js +4 -0
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ChartView.swift +170 -0
- package/ios/ExpoUIModule.swift +1 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +67 -6
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.module} +7 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/swift-ui/Chart/index.tsx +189 -0
- package/src/swift-ui/index.tsx +1 -0
- package/src/swift-ui/modifiers/index.ts +14 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.md5 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha1 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha256 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha512 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.aar} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.md5 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha1 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha256 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha512 → 0.2.0-alpha.4/expo.modules.ui-0.2.0-alpha.4.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.2.0-alpha.4 — 2025-08-19
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 0.2.0-alpha.3 — 2025-08-18
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 0.2.0-alpha.2 — 2025-08-16
|
|
14
22
|
|
|
15
23
|
_This version does not introduce any user-facing changes._
|
|
@@ -42,6 +50,7 @@ _This version does not introduce any user-facing changes._
|
|
|
42
50
|
- Add `SecureField` component. ([#37642](https://github.com/expo/expo/pull/37642) by [@aleqsio](https://github.com/aleqsio))
|
|
43
51
|
- [Android] Add `AlertDialog` component. ([#38266](https://github.com/expo/expo/pull/38266) by [@mateoguzmana](https://github.com/mateoguzmana))
|
|
44
52
|
- Added SwiftUI view modifiers support. ([#38543](https://github.com/expo/expo/pull/38543) by [@kudo](https://github.com/kudo))
|
|
53
|
+
- [iOS] Add SwiftUI Chart component. ([#38128](https://github.com/expo/expo/pull/38517) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
45
54
|
|
|
46
55
|
### 🐛 Bug fixes
|
|
47
56
|
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '0.2.0-alpha.
|
|
15
|
+
version = '0.2.0-alpha.4'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "0.2.0-alpha.
|
|
21
|
+
versionName "0.2.0-alpha.4"
|
|
22
22
|
}
|
|
23
23
|
buildFeatures {
|
|
24
24
|
compose true
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { ColorValue, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { CommonViewModifierProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The type of chart to display.
|
|
5
|
+
* - `line` charts show continuous lines with optional dash array, width, point symbols, and color.
|
|
6
|
+
* - `point` charts show discrete colored points with optional point style (circle, square, diamond) and size.
|
|
7
|
+
* - `bar` charts show vertical bars using system colors or individual ChartDataPoint colors, with optional corner radius and width styling.
|
|
8
|
+
* - `area` charts show filled areas under lines with color.
|
|
9
|
+
* - `pie` charts show pie slices with optional inner radius and angular inset. Pie charts require iOS 17.0+.
|
|
10
|
+
* @platform ios
|
|
11
|
+
*/
|
|
12
|
+
export type ChartType = 'line' | 'point' | 'bar' | 'area' | 'pie';
|
|
13
|
+
/**
|
|
14
|
+
* Point symbol style options.
|
|
15
|
+
* @platform ios
|
|
16
|
+
*/
|
|
17
|
+
export type PointStyle = 'circle' | 'square' | 'diamond';
|
|
18
|
+
/**
|
|
19
|
+
* Data point for the chart.
|
|
20
|
+
* @platform ios
|
|
21
|
+
*/
|
|
22
|
+
export type ChartDataPoint = {
|
|
23
|
+
/**
|
|
24
|
+
* X-axis value (label).
|
|
25
|
+
*/
|
|
26
|
+
x: string;
|
|
27
|
+
/**
|
|
28
|
+
* Y-axis value (numeric).
|
|
29
|
+
*/
|
|
30
|
+
y: number;
|
|
31
|
+
/**
|
|
32
|
+
* Optional color for this specific data point.
|
|
33
|
+
*/
|
|
34
|
+
color?: ColorValue;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Line chart specific styling options.
|
|
38
|
+
*/
|
|
39
|
+
export type LineChartStyle = {
|
|
40
|
+
/**
|
|
41
|
+
* Dash pattern array. Empty array or undefined for solid lines.
|
|
42
|
+
* @example [5, 5] for dashed line, [2, 2] for dotted line
|
|
43
|
+
*/
|
|
44
|
+
dashArray?: number[];
|
|
45
|
+
/**
|
|
46
|
+
* Line stroke width.
|
|
47
|
+
*/
|
|
48
|
+
width?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Point symbol style.
|
|
51
|
+
*/
|
|
52
|
+
pointStyle?: PointStyle;
|
|
53
|
+
/**
|
|
54
|
+
* Point symbol size.
|
|
55
|
+
*/
|
|
56
|
+
pointSize?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Line color.
|
|
59
|
+
*/
|
|
60
|
+
color?: ColorValue;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Area chart specific styling options.
|
|
64
|
+
*/
|
|
65
|
+
export type AreaChartStyle = {
|
|
66
|
+
/**
|
|
67
|
+
* Area fill color.
|
|
68
|
+
*/
|
|
69
|
+
color?: ColorValue;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Bar chart specific styling options.
|
|
73
|
+
*/
|
|
74
|
+
export type BarChartStyle = {
|
|
75
|
+
/**
|
|
76
|
+
* Corner radius for rounded bar corners.
|
|
77
|
+
*/
|
|
78
|
+
cornerRadius?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Custom bar width.
|
|
81
|
+
*/
|
|
82
|
+
width?: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Pie chart specific styling options.
|
|
86
|
+
*/
|
|
87
|
+
export type PieChartStyle = {
|
|
88
|
+
/**
|
|
89
|
+
* Inner radius ratio (0.0 = full pie, 0.5 = donut).
|
|
90
|
+
*/
|
|
91
|
+
innerRadius?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Space between slices in points.
|
|
94
|
+
*/
|
|
95
|
+
angularInset?: number;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Point chart specific styling options.
|
|
99
|
+
*/
|
|
100
|
+
export type PointChartStyle = {
|
|
101
|
+
/**
|
|
102
|
+
* Point symbol style.
|
|
103
|
+
*/
|
|
104
|
+
pointStyle?: PointStyle;
|
|
105
|
+
/**
|
|
106
|
+
* Point symbol size.
|
|
107
|
+
*/
|
|
108
|
+
pointSize?: number;
|
|
109
|
+
};
|
|
110
|
+
export type ChartProps = {
|
|
111
|
+
/**
|
|
112
|
+
* Array of data points to display.
|
|
113
|
+
*/
|
|
114
|
+
data: ChartDataPoint[];
|
|
115
|
+
/**
|
|
116
|
+
* Type of chart to render.
|
|
117
|
+
*/
|
|
118
|
+
type?: ChartType;
|
|
119
|
+
/**
|
|
120
|
+
* Whether to show grid lines.
|
|
121
|
+
*/
|
|
122
|
+
showGrid?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether to animate chart changes.
|
|
125
|
+
*/
|
|
126
|
+
animate?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether to show chart legend.
|
|
129
|
+
* - Only works when individual dataPoint colors are NOT provided (uses categorical styling)
|
|
130
|
+
* - Useful for `bar` and `pie` charts (shows category colors)
|
|
131
|
+
* - Not applicable for `line` and `area` charts (single-series data)
|
|
132
|
+
* - If dataPoint has individual colors, legend won't appear - use data without colors to see legend
|
|
133
|
+
*/
|
|
134
|
+
showLegend?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Line chart specific styling options.
|
|
137
|
+
*/
|
|
138
|
+
lineStyle?: LineChartStyle;
|
|
139
|
+
/**
|
|
140
|
+
* Point chart specific styling options.
|
|
141
|
+
*/
|
|
142
|
+
pointStyle?: PointChartStyle;
|
|
143
|
+
/**
|
|
144
|
+
* Area chart specific styling options.
|
|
145
|
+
*/
|
|
146
|
+
areaStyle?: AreaChartStyle;
|
|
147
|
+
/**
|
|
148
|
+
* Bar chart specific styling options.
|
|
149
|
+
*/
|
|
150
|
+
barStyle?: BarChartStyle;
|
|
151
|
+
/**
|
|
152
|
+
* Pie chart specific styling options.
|
|
153
|
+
*/
|
|
154
|
+
pieStyle?: PieChartStyle;
|
|
155
|
+
} & CommonViewModifierProps;
|
|
156
|
+
/**
|
|
157
|
+
* Renders a native Chart component using Swift Charts.
|
|
158
|
+
* @platform ios
|
|
159
|
+
*/
|
|
160
|
+
export declare function Chart({ style, data, modifiers, ...props }: ChartProps & {
|
|
161
|
+
style?: StyleProp<ViewStyle>;
|
|
162
|
+
}): import("react").JSX.Element;
|
|
163
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swift-ui/Chart/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAE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AC7B;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,GAAG,uBAAuB,CAAC;AAI5B;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,+BAS/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
3
|
+
const ChartNativeView = requireNativeView('ExpoUI', 'ChartView');
|
|
4
|
+
/**
|
|
5
|
+
* Renders a native Chart component using Swift Charts.
|
|
6
|
+
* @platform ios
|
|
7
|
+
*/
|
|
8
|
+
export function Chart({ style, data, modifiers, ...props }) {
|
|
9
|
+
return (<ChartNativeView data={data} modifiers={modifiers} {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)} {...props}/>);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/swift-ui/Chart/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAqKrE,MAAM,eAAe,GAAoC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAElG;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACsC;IAC9C,OAAO,CACL,CAAC,eAAe,CACd,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,+BAA+B,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CACzE,IAAI,KAAK,CAAC,EACV,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { ColorValue, StyleProp, ViewStyle } from 'react-native';\n\nimport { createViewModifierEventListener } from '../modifiers/utils';\nimport { CommonViewModifierProps } from '../types';\n\n/**\n * The type of chart to display.\n * - `line` charts show continuous lines with optional dash array, width, point symbols, and color.\n * - `point` charts show discrete colored points with optional point style (circle, square, diamond) and size.\n * - `bar` charts show vertical bars using system colors or individual ChartDataPoint colors, with optional corner radius and width styling.\n * - `area` charts show filled areas under lines with color.\n * - `pie` charts show pie slices with optional inner radius and angular inset. Pie charts require iOS 17.0+.\n * @platform ios\n */\nexport type ChartType = 'line' | 'point' | 'bar' | 'area' | 'pie';\n\n/**\n * Point symbol style options.\n * @platform ios\n */\nexport type PointStyle = 'circle' | 'square' | 'diamond';\n\n/**\n * Data point for the chart.\n * @platform ios\n */\nexport type ChartDataPoint = {\n /**\n * X-axis value (label).\n */\n x: string;\n /**\n * Y-axis value (numeric).\n */\n y: number;\n /**\n * Optional color for this specific data point.\n */\n color?: ColorValue;\n};\n\n/**\n * Line chart specific styling options.\n */\nexport type LineChartStyle = {\n /**\n * Dash pattern array. Empty array or undefined for solid lines.\n * @example [5, 5] for dashed line, [2, 2] for dotted line\n */\n dashArray?: number[];\n /**\n * Line stroke width.\n */\n width?: number;\n /**\n * Point symbol style.\n */\n pointStyle?: PointStyle;\n /**\n * Point symbol size.\n */\n pointSize?: number;\n /**\n * Line color.\n */\n color?: ColorValue;\n};\n\n/**\n * Area chart specific styling options.\n */\nexport type AreaChartStyle = {\n /**\n * Area fill color.\n */\n color?: ColorValue;\n};\n\n/**\n * Bar chart specific styling options.\n */\nexport type BarChartStyle = {\n /**\n * Corner radius for rounded bar corners.\n */\n cornerRadius?: number;\n /**\n * Custom bar width.\n */\n width?: number;\n};\n\n/**\n * Pie chart specific styling options.\n */\nexport type PieChartStyle = {\n /**\n * Inner radius ratio (0.0 = full pie, 0.5 = donut).\n */\n innerRadius?: number;\n /**\n * Space between slices in points.\n */\n angularInset?: number;\n};\n\n/**\n * Point chart specific styling options.\n */\nexport type PointChartStyle = {\n /**\n * Point symbol style.\n */\n pointStyle?: PointStyle;\n /**\n * Point symbol size.\n */\n pointSize?: number;\n};\n\nexport type ChartProps = {\n /**\n * Array of data points to display.\n */\n data: ChartDataPoint[];\n /**\n * Type of chart to render.\n */\n type?: ChartType;\n /**\n * Whether to show grid lines.\n */\n showGrid?: boolean;\n /**\n * Whether to animate chart changes.\n */\n animate?: boolean;\n /**\n * Whether to show chart legend.\n * - Only works when individual dataPoint colors are NOT provided (uses categorical styling)\n * - Useful for `bar` and `pie` charts (shows category colors)\n * - Not applicable for `line` and `area` charts (single-series data)\n * - If dataPoint has individual colors, legend won't appear - use data without colors to see legend\n */\n showLegend?: boolean;\n /**\n * Line chart specific styling options.\n */\n lineStyle?: LineChartStyle;\n /**\n * Point chart specific styling options.\n */\n pointStyle?: PointChartStyle;\n /**\n * Area chart specific styling options.\n */\n areaStyle?: AreaChartStyle;\n /**\n * Bar chart specific styling options.\n */\n barStyle?: BarChartStyle;\n /**\n * Pie chart specific styling options.\n */\n pieStyle?: PieChartStyle;\n} & CommonViewModifierProps;\n\nconst ChartNativeView: React.ComponentType<ChartProps> = requireNativeView('ExpoUI', 'ChartView');\n\n/**\n * Renders a native Chart component using Swift Charts.\n * @platform ios\n */\nexport function Chart({\n style,\n data,\n modifiers,\n ...props\n}: ChartProps & { style?: StyleProp<ViewStyle> }) {\n return (\n <ChartNativeView\n data={data}\n modifiers={modifiers}\n {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}\n {...props}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/swift-ui/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/swift-ui/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
package/build/swift-ui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swift-ui/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC","sourcesContent":["export * from './BottomSheet';\nexport * from './Button';\nexport * from './ColorPicker';\nexport * from './ContentUnavailableView';\nexport * from './ContextMenu';\nexport * from './DatePicker';\nexport * from './DisclosureGroup';\nexport * from './Form';\nexport * from './Gauge';\nexport * from './Host';\nexport * from './Image';\nexport * from './Label';\nexport * from './Layout';\nexport * from './List';\nexport * from './Picker';\nexport * from './Progress';\nexport * from './Section';\nexport * from './ShareLink';\nexport * from './Slider';\nexport * from './Spacer';\nexport * from './Switch';\nexport * from './Text';\nexport * from './TextField';\nexport * from './SecureField';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swift-ui/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC","sourcesContent":["export * from './BottomSheet';\nexport * from './Button';\nexport * from './Chart';\nexport * from './ColorPicker';\nexport * from './ContentUnavailableView';\nexport * from './ContextMenu';\nexport * from './DatePicker';\nexport * from './DisclosureGroup';\nexport * from './Form';\nexport * from './Gauge';\nexport * from './Host';\nexport * from './Image';\nexport * from './Label';\nexport * from './Layout';\nexport * from './List';\nexport * from './Picker';\nexport * from './Progress';\nexport * from './Section';\nexport * from './ShareLink';\nexport * from './Slider';\nexport * from './Spacer';\nexport * from './Switch';\nexport * from './Text';\nexport * from './TextField';\nexport * from './SecureField';\n"]}
|
|
@@ -226,11 +226,22 @@ export declare const aspectRatio: (params: {
|
|
|
226
226
|
* @param clipped - Whether to clip content
|
|
227
227
|
*/
|
|
228
228
|
export declare const clipped: (clipped?: boolean) => ModifierConfig;
|
|
229
|
+
/**
|
|
230
|
+
* Applies a glass effect to a view.
|
|
231
|
+
*/
|
|
232
|
+
export declare const glassEffect: (params?: {
|
|
233
|
+
glass?: {
|
|
234
|
+
variant: "regular" | "clear" | "identity";
|
|
235
|
+
interactive?: boolean;
|
|
236
|
+
tint?: string;
|
|
237
|
+
};
|
|
238
|
+
shape?: "circle" | "capsule" | "rectangle" | "ellipse";
|
|
239
|
+
}) => ModifierConfig;
|
|
229
240
|
/**
|
|
230
241
|
* Union type of all built-in modifier return types.
|
|
231
242
|
* This provides type safety for the modifiers array.
|
|
232
243
|
*/
|
|
233
|
-
export type BuiltInModifier = ReturnType<typeof background> | ReturnType<typeof cornerRadius> | ReturnType<typeof shadow> | ReturnType<typeof frame> | ReturnType<typeof padding> | ReturnType<typeof fixedSize> | ReturnType<typeof onTapGesture> | ReturnType<typeof onLongPressGesture> | ReturnType<typeof opacity> | ReturnType<typeof clipShape> | ReturnType<typeof border> | ReturnType<typeof scaleEffect> | ReturnType<typeof rotationEffect> | ReturnType<typeof offset> | ReturnType<typeof foregroundColor> | ReturnType<typeof tint> | ReturnType<typeof hidden> | ReturnType<typeof zIndex> | ReturnType<typeof blur> | ReturnType<typeof brightness> | ReturnType<typeof contrast> | ReturnType<typeof saturation> | ReturnType<typeof hueRotation> | ReturnType<typeof colorInvert> | ReturnType<typeof grayscale> | ReturnType<typeof accessibilityLabel> | ReturnType<typeof accessibilityHint> | ReturnType<typeof accessibilityValue> | ReturnType<typeof layoutPriority> | ReturnType<typeof mask> | ReturnType<typeof overlay> | ReturnType<typeof backgroundOverlay> | ReturnType<typeof aspectRatio> | ReturnType<typeof clipped>;
|
|
244
|
+
export type BuiltInModifier = ReturnType<typeof background> | ReturnType<typeof cornerRadius> | ReturnType<typeof shadow> | ReturnType<typeof frame> | ReturnType<typeof padding> | ReturnType<typeof fixedSize> | ReturnType<typeof onTapGesture> | ReturnType<typeof onLongPressGesture> | ReturnType<typeof opacity> | ReturnType<typeof clipShape> | ReturnType<typeof border> | ReturnType<typeof scaleEffect> | ReturnType<typeof rotationEffect> | ReturnType<typeof offset> | ReturnType<typeof foregroundColor> | ReturnType<typeof tint> | ReturnType<typeof hidden> | ReturnType<typeof zIndex> | ReturnType<typeof blur> | ReturnType<typeof brightness> | ReturnType<typeof contrast> | ReturnType<typeof saturation> | ReturnType<typeof hueRotation> | ReturnType<typeof colorInvert> | ReturnType<typeof grayscale> | ReturnType<typeof accessibilityLabel> | ReturnType<typeof accessibilityHint> | ReturnType<typeof accessibilityValue> | ReturnType<typeof layoutPriority> | ReturnType<typeof mask> | ReturnType<typeof overlay> | ReturnType<typeof backgroundOverlay> | ReturnType<typeof aspectRatio> | ReturnType<typeof clipped> | ReturnType<typeof glassEffect>;
|
|
234
245
|
/**
|
|
235
246
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
|
236
247
|
* 3rd party modifiers should return ModifierConfig objects with their own type strings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,cAAc,CAEtF;AAiBD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,mBAA4C,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,mBAA+C,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,QAAQ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;I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B,UAAU,CAAC,OAAO,eAAe,CAAC,GAClC,UAAU,CAAC,OAAO,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,UAAU,CAAC,GAC7B,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,SAAS,CAAC,GAC5B,UAAU,CAAC,OAAO,kBAAkB,CAAC,GACrC,UAAU,CAAC,OAAO,iBAAiB,CAAC,GACpC,UAAU,CAAC,OAAO,kBAAkB,CAAC,GACrC,UAAU,CAAC,OAAO,cAAc,CAAC,GACjC,UAAU,CAAC,OAAO,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,OAAO,CAAC,GAC1B,UAAU,CAAC,OAAO,iBAAiB,CAAC,GACpC,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,OAAO,CAAC,GAC1B,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,cAAc,CAAC;AAM5D;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cAEhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,OAAO,EAAE,KAAG,cAAc,EAEpE,CAAC"}
|
|
@@ -194,6 +194,10 @@ export const aspectRatio = (params) => createModifier('aspectRatio', params);
|
|
|
194
194
|
* @param clipped - Whether to clip content
|
|
195
195
|
*/
|
|
196
196
|
export const clipped = (clipped = true) => createModifier('clipped', { clipped });
|
|
197
|
+
/**
|
|
198
|
+
* Applies a glass effect to a view.
|
|
199
|
+
*/
|
|
200
|
+
export const glassEffect = (params) => createModifier('glassEffect', params);
|
|
197
201
|
// =============================================================================
|
|
198
202
|
// Utility Functions
|
|
199
203
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,SAA8B,EAAE;IACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,SAAS,+BAA+B,CACtC,IAAY,EACZ,aAAkC,EAClC,SAA8B,EAAE;IAEhC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC;AAED,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,cAAc,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAkE,EAAE,EAAE,CAC3F,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAmBrB,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAQvB,EAAE,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AAC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAGjC,EAAE,EAAE,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAuD,EAAE,EAAE,CACrF,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,UAAmB,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAoD3F,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAA2B,EAAE;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAoB,EAAE;IACxE,OAAO,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["/**\n * Core modifier factory and type definitions for SwiftUI view modifiers.\n * This system allows both built-in and 3rd party modifiers to use the same API.\n */\n\n/**\n * Base interface for all view modifiers.\n * All modifiers must have a type field and can include arbitrary parameters.\n */\nexport interface ModifierConfig {\n $type: string;\n [key: string]: any;\n eventListener?: (args: any) => void;\n}\n\n/**\n * Factory function to create modifier configuration objects.\n * This is used internally by all modifier functions.\n */\nfunction createModifier(type: string, params: Record<string, any> = {}): ModifierConfig {\n return { $type: type, ...params };\n}\n\n/**\n * Creates a modifier with an event listener.\n */\nfunction createModifierWithEventListener(\n type: string,\n eventListener: (args: any) => void,\n params: Record<string, any> = {}\n): ModifierConfig {\n return { $type: type, ...params, eventListener };\n}\n\n// =============================================================================\n// Built-in Modifier Functions\n// =============================================================================\n\n/**\n * Sets the background of a view.\n * @param color - The background color (hex string, e.g., '#FF0000')\n */\nexport const background = (color: string) => createModifier('background', { color });\n\n/**\n * Applies corner radius to a view.\n * @param radius - The corner radius value\n */\nexport const cornerRadius = (radius: number) => createModifier('cornerRadius', { radius });\n\n/**\n * Adds a shadow to a view.\n */\nexport const shadow = (params: { radius: number; x?: number; y?: number; color?: string }) =>\n createModifier('shadow', params);\n\n/**\n * Sets the frame properties of a view.\n */\nexport const frame = (params: {\n width?: number;\n height?: number;\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n idealWidth?: number;\n idealHeight?: number;\n alignment?:\n | 'center'\n | 'leading'\n | 'trailing'\n | 'top'\n | 'bottom'\n | 'topLeading'\n | 'topTrailing'\n | 'bottomLeading'\n | 'bottomTrailing';\n}) => createModifier('frame', params);\n\n/**\n * Sets padding on a view.\n * Supports individual edges or shorthand properties.\n */\nexport const padding = (params: {\n top?: number;\n bottom?: number;\n leading?: number;\n trailing?: number;\n horizontal?: number;\n vertical?: number;\n all?: number;\n}) => createModifier('padding', params);\n\n/**\n * Controls fixed size behavior.\n * @param enabled - Whether the view should use its natural size\n */\nexport const fixedSize = (enabled: boolean = true) => createModifier('fixedSize', { enabled });\n\n/**\n * Adds a tap gesture recognizer.\n * @param handler - Function to call when tapped\n */\nexport const onTapGesture = (handler: () => void) =>\n createModifierWithEventListener('onTapGesture', handler);\n\n/**\n * Adds a long press gesture recognizer.\n * @param handler - Function to call when long pressed\n * @param minimumDuration - Minimum duration for long press (default: 0.5s)\n */\nexport const onLongPressGesture = (handler: () => void, minimumDuration?: number) =>\n createModifierWithEventListener('onLongPressGesture', handler, {\n minimumDuration: minimumDuration ?? 0.5,\n });\n\n// Note: Complex gesture modifiers like onDragGesture are not available\n// in the modifier system. Use component-level props instead.\n\n/**\n * Sets the opacity of a view.\n * @param value - Opacity value between 0 and 1\n */\nexport const opacity = (value: number) => createModifier('opacity', { value });\n\n/**\n * Clips the view to a specific shape.\n * @param shape - The clipping shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const clipShape = (\n shape: 'rectangle' | 'circle' | 'roundedRectangle',\n cornerRadius?: number\n) => createModifier('clipShape', { shape, cornerRadius });\n\n/**\n * Adds a border to a view.\n */\nexport const border = (params: { color: string; width?: number }) =>\n createModifier('border', params);\n\n/**\n * Applies scaling transformation.\n * @param scale - Scale factor (1.0 = normal size)\n */\nexport const scaleEffect = (scale: number) => createModifier('scaleEffect', { scale });\n\n/**\n * Applies rotation transformation.\n * @param angle - Rotation angle in degrees\n */\nexport const rotationEffect = (angle: number) => createModifier('rotationEffect', { angle });\n\n/**\n * Applies an offset (translation) to a view.\n */\nexport const offset = (params: { x?: number; y?: number }) => createModifier('offset', params);\n\n/**\n * Sets the foreground color/tint of a view.\n * @param color - The foreground color (hex string)\n */\nexport const foregroundColor = (color: string) => createModifier('foregroundColor', { color });\n\n/**\n * Sets the tint color of a view.\n * @param color - The tint color (hex string)\n */\nexport const tint = (color: string) => createModifier('tint', { color });\n\n/**\n * Hides or shows a view.\n * @param hidden - Whether the view should be hidden\n */\nexport const hidden = (hidden: boolean = true) => createModifier('hidden', { hidden });\n\n/**\n * Sets the z-index (display order) of a view.\n * @param index - The z-index value\n */\nexport const zIndex = (index: number) => createModifier('zIndex', { index });\n\n/**\n * Applies blur to a view.\n * @param radius - The blur radius\n */\nexport const blur = (radius: number) => createModifier('blur', { radius });\n\n/**\n * Adjusts the brightness of a view.\n * @param amount - Brightness adjustment (-1 to 1)\n */\nexport const brightness = (amount: number) => createModifier('brightness', { amount });\n\n/**\n * Adjusts the contrast of a view.\n * @param amount - Contrast multiplier (0 to infinity, 1 = normal)\n */\nexport const contrast = (amount: number) => createModifier('contrast', { amount });\n\n/**\n * Adjusts the saturation of a view.\n * @param amount - Saturation multiplier (0 to infinity, 1 = normal)\n */\nexport const saturation = (amount: number) => createModifier('saturation', { amount });\n\n/**\n * Applies a hue rotation to a view.\n * @param angle - Hue rotation angle in degrees\n */\nexport const hueRotation = (angle: number) => createModifier('hueRotation', { angle });\n\n/**\n * Inverts the colors of a view.\n * @param inverted - Whether to invert colors\n */\nexport const colorInvert = (inverted: boolean = true) =>\n createModifier('colorInvert', { inverted });\n\n/**\n * Makes a view grayscale.\n * @param amount - Grayscale amount (0 to 1)\n */\nexport const grayscale = (amount: number) => createModifier('grayscale', { amount });\n\n/**\n * Sets accessibility label for the view.\n * @param label - The accessibility label\n */\nexport const accessibilityLabel = (label: string) =>\n createModifier('accessibilityLabel', { label });\n\n/**\n * Sets accessibility hint for the view.\n * @param hint - The accessibility hint\n */\nexport const accessibilityHint = (hint: string) => createModifier('accessibilityHint', { hint });\n\n/**\n * Sets accessibility value for the view.\n * @param value - The accessibility value\n */\nexport const accessibilityValue = (value: string) =>\n createModifier('accessibilityValue', { value });\n\n/**\n * Sets layout priority for the view.\n * @param priority - Layout priority value\n */\nexport const layoutPriority = (priority: number) => createModifier('layoutPriority', { priority });\n\n/**\n * Applies a mask to the view.\n * @param shape - The masking shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const mask = (shape: 'rectangle' | 'circle' | 'roundedRectangle', cornerRadius?: number) =>\n createModifier('mask', { shape, cornerRadius });\n\n/**\n * Overlays another view on top.\n * @param color - Overlay color\n * @param alignment - Overlay alignment\n */\nexport const overlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('overlay', params);\n\n/**\n * Adds a background behind the view.\n * @param color - Background color\n * @param alignment - Background alignment\n */\nexport const backgroundOverlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('backgroundOverlay', params);\n\n/**\n * Sets aspect ratio constraint.\n * @param ratio - Width/height aspect ratio\n * @param contentMode - How content fits the aspect ratio\n */\nexport const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill' }) =>\n createModifier('aspectRatio', params);\n\n/**\n * Clips content to bounds.\n * @param clipped - Whether to clip content\n */\nexport const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });\n\n// =============================================================================\n// Type Definitions\n// =============================================================================\n\n/**\n * Union type of all built-in modifier return types.\n * This provides type safety for the modifiers array.\n */\nexport type BuiltInModifier =\n | ReturnType<typeof background>\n | ReturnType<typeof cornerRadius>\n | ReturnType<typeof shadow>\n | ReturnType<typeof frame>\n | ReturnType<typeof padding>\n | ReturnType<typeof fixedSize>\n | ReturnType<typeof onTapGesture>\n | ReturnType<typeof onLongPressGesture>\n | ReturnType<typeof opacity>\n | ReturnType<typeof clipShape>\n | ReturnType<typeof border>\n | ReturnType<typeof scaleEffect>\n | ReturnType<typeof rotationEffect>\n | ReturnType<typeof offset>\n | ReturnType<typeof foregroundColor>\n | ReturnType<typeof tint>\n | ReturnType<typeof hidden>\n | ReturnType<typeof zIndex>\n | ReturnType<typeof blur>\n | ReturnType<typeof brightness>\n | ReturnType<typeof contrast>\n | ReturnType<typeof saturation>\n | ReturnType<typeof hueRotation>\n | ReturnType<typeof colorInvert>\n | ReturnType<typeof grayscale>\n | ReturnType<typeof accessibilityLabel>\n | ReturnType<typeof accessibilityHint>\n | ReturnType<typeof accessibilityValue>\n | ReturnType<typeof layoutPriority>\n | ReturnType<typeof mask>\n | ReturnType<typeof overlay>\n | ReturnType<typeof backgroundOverlay>\n | ReturnType<typeof aspectRatio>\n | ReturnType<typeof clipped>;\n\n/**\n * Main ViewModifier type that supports both built-in and 3rd party modifiers.\n * 3rd party modifiers should return ModifierConfig objects with their own type strings.\n */\nexport type ViewModifier = BuiltInModifier | ModifierConfig;\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\n/**\n * Creates a custom modifier for 3rd party libraries.\n * This function is exported so 3rd party packages can create their own modifiers.\n *\n * @example\n * ```typescript\n * // In a 3rd party package\n * export const blurEffect = (params: { radius: number; style?: string }) =>\n * createModifier('blurEffect', params);\n * ```\n */\nexport { createModifier };\n\n/**\n * Type guard to check if a value is a valid modifier.\n */\nexport const isModifier = (value: any): value is ModifierConfig => {\n return typeof value === 'object' && value !== null && typeof value.$type === 'string';\n};\n\n/**\n * Filters an array to only include valid modifiers.\n */\nexport const filterModifiers = (modifiers: unknown[]): ModifierConfig[] => {\n return modifiers.filter(isModifier);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,SAA8B,EAAE;IACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,SAAS,+BAA+B,CACtC,IAAY,EACZ,aAAkC,EAClC,SAA8B,EAAE;IAEhC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC;AAED,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,cAAc,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAkE,EAAE,EAAE,CAC3F,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAmBrB,EAAE,EAAE,CAAC,cAAc,CAAC,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G;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAGvB,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAGjC,EAAE,EAAE,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAuD,EAAE,EAAE,CACrF,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,UAAmB,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAO3B,EAAE,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAqD5C,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAA2B,EAAE;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAoB,EAAE;IACxE,OAAO,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["/**\n * Core modifier factory and type definitions for SwiftUI view modifiers.\n * This system allows both built-in and 3rd party modifiers to use the same API.\n */\n\n/**\n * Base interface for all view modifiers.\n * All modifiers must have a type field and can include arbitrary parameters.\n */\nexport interface ModifierConfig {\n $type: string;\n [key: string]: any;\n eventListener?: (args: any) => void;\n}\n\n/**\n * Factory function to create modifier configuration objects.\n * This is used internally by all modifier functions.\n */\nfunction createModifier(type: string, params: Record<string, any> = {}): ModifierConfig {\n return { $type: type, ...params };\n}\n\n/**\n * Creates a modifier with an event listener.\n */\nfunction createModifierWithEventListener(\n type: string,\n eventListener: (args: any) => void,\n params: Record<string, any> = {}\n): ModifierConfig {\n return { $type: type, ...params, eventListener };\n}\n\n// =============================================================================\n// Built-in Modifier Functions\n// =============================================================================\n\n/**\n * Sets the background of a view.\n * @param color - The background color (hex string, e.g., '#FF0000')\n */\nexport const background = (color: string) => createModifier('background', { color });\n\n/**\n * Applies corner radius to a view.\n * @param radius - The corner radius value\n */\nexport const cornerRadius = (radius: number) => createModifier('cornerRadius', { radius });\n\n/**\n * Adds a shadow to a view.\n */\nexport const shadow = (params: { radius: number; x?: number; y?: number; color?: string }) =>\n createModifier('shadow', params);\n\n/**\n * Sets the frame properties of a view.\n */\nexport const frame = (params: {\n width?: number;\n height?: number;\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n idealWidth?: number;\n idealHeight?: number;\n alignment?:\n | 'center'\n | 'leading'\n | 'trailing'\n | 'top'\n | 'bottom'\n | 'topLeading'\n | 'topTrailing'\n | 'bottomLeading'\n | 'bottomTrailing';\n}) => createModifier('frame', params);\n\n/**\n * Sets padding on a view.\n * Supports individual edges or shorthand properties.\n */\nexport const padding = (params: {\n top?: number;\n bottom?: number;\n leading?: number;\n trailing?: number;\n horizontal?: number;\n vertical?: number;\n all?: number;\n}) => createModifier('padding', params);\n\n/**\n * Controls fixed size behavior.\n * @param enabled - Whether the view should use its natural size\n */\nexport const fixedSize = (enabled: boolean = true) => createModifier('fixedSize', { enabled });\n\n/**\n * Adds a tap gesture recognizer.\n * @param handler - Function to call when tapped\n */\nexport const onTapGesture = (handler: () => void) =>\n createModifierWithEventListener('onTapGesture', handler);\n\n/**\n * Adds a long press gesture recognizer.\n * @param handler - Function to call when long pressed\n * @param minimumDuration - Minimum duration for long press (default: 0.5s)\n */\nexport const onLongPressGesture = (handler: () => void, minimumDuration?: number) =>\n createModifierWithEventListener('onLongPressGesture', handler, {\n minimumDuration: minimumDuration ?? 0.5,\n });\n\n// Note: Complex gesture modifiers like onDragGesture are not available\n// in the modifier system. Use component-level props instead.\n\n/**\n * Sets the opacity of a view.\n * @param value - Opacity value between 0 and 1\n */\nexport const opacity = (value: number) => createModifier('opacity', { value });\n\n/**\n * Clips the view to a specific shape.\n * @param shape - The clipping shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const clipShape = (\n shape: 'rectangle' | 'circle' | 'roundedRectangle',\n cornerRadius?: number\n) => createModifier('clipShape', { shape, cornerRadius });\n\n/**\n * Adds a border to a view.\n */\nexport const border = (params: { color: string; width?: number }) =>\n createModifier('border', params);\n\n/**\n * Applies scaling transformation.\n * @param scale - Scale factor (1.0 = normal size)\n */\nexport const scaleEffect = (scale: number) => createModifier('scaleEffect', { scale });\n\n/**\n * Applies rotation transformation.\n * @param angle - Rotation angle in degrees\n */\nexport const rotationEffect = (angle: number) => createModifier('rotationEffect', { angle });\n\n/**\n * Applies an offset (translation) to a view.\n */\nexport const offset = (params: { x?: number; y?: number }) => createModifier('offset', params);\n\n/**\n * Sets the foreground color/tint of a view.\n * @param color - The foreground color (hex string)\n */\nexport const foregroundColor = (color: string) => createModifier('foregroundColor', { color });\n\n/**\n * Sets the tint color of a view.\n * @param color - The tint color (hex string)\n */\nexport const tint = (color: string) => createModifier('tint', { color });\n\n/**\n * Hides or shows a view.\n * @param hidden - Whether the view should be hidden\n */\nexport const hidden = (hidden: boolean = true) => createModifier('hidden', { hidden });\n\n/**\n * Sets the z-index (display order) of a view.\n * @param index - The z-index value\n */\nexport const zIndex = (index: number) => createModifier('zIndex', { index });\n\n/**\n * Applies blur to a view.\n * @param radius - The blur radius\n */\nexport const blur = (radius: number) => createModifier('blur', { radius });\n\n/**\n * Adjusts the brightness of a view.\n * @param amount - Brightness adjustment (-1 to 1)\n */\nexport const brightness = (amount: number) => createModifier('brightness', { amount });\n\n/**\n * Adjusts the contrast of a view.\n * @param amount - Contrast multiplier (0 to infinity, 1 = normal)\n */\nexport const contrast = (amount: number) => createModifier('contrast', { amount });\n\n/**\n * Adjusts the saturation of a view.\n * @param amount - Saturation multiplier (0 to infinity, 1 = normal)\n */\nexport const saturation = (amount: number) => createModifier('saturation', { amount });\n\n/**\n * Applies a hue rotation to a view.\n * @param angle - Hue rotation angle in degrees\n */\nexport const hueRotation = (angle: number) => createModifier('hueRotation', { angle });\n\n/**\n * Inverts the colors of a view.\n * @param inverted - Whether to invert colors\n */\nexport const colorInvert = (inverted: boolean = true) =>\n createModifier('colorInvert', { inverted });\n\n/**\n * Makes a view grayscale.\n * @param amount - Grayscale amount (0 to 1)\n */\nexport const grayscale = (amount: number) => createModifier('grayscale', { amount });\n\n/**\n * Sets accessibility label for the view.\n * @param label - The accessibility label\n */\nexport const accessibilityLabel = (label: string) =>\n createModifier('accessibilityLabel', { label });\n\n/**\n * Sets accessibility hint for the view.\n * @param hint - The accessibility hint\n */\nexport const accessibilityHint = (hint: string) => createModifier('accessibilityHint', { hint });\n\n/**\n * Sets accessibility value for the view.\n * @param value - The accessibility value\n */\nexport const accessibilityValue = (value: string) =>\n createModifier('accessibilityValue', { value });\n\n/**\n * Sets layout priority for the view.\n * @param priority - Layout priority value\n */\nexport const layoutPriority = (priority: number) => createModifier('layoutPriority', { priority });\n\n/**\n * Applies a mask to the view.\n * @param shape - The masking shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const mask = (shape: 'rectangle' | 'circle' | 'roundedRectangle', cornerRadius?: number) =>\n createModifier('mask', { shape, cornerRadius });\n\n/**\n * Overlays another view on top.\n * @param color - Overlay color\n * @param alignment - Overlay alignment\n */\nexport const overlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('overlay', params);\n\n/**\n * Adds a background behind the view.\n * @param color - Background color\n * @param alignment - Background alignment\n */\nexport const backgroundOverlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('backgroundOverlay', params);\n\n/**\n * Sets aspect ratio constraint.\n * @param ratio - Width/height aspect ratio\n * @param contentMode - How content fits the aspect ratio\n */\nexport const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill' }) =>\n createModifier('aspectRatio', params);\n\n/**\n * Clips content to bounds.\n * @param clipped - Whether to clip content\n */\nexport const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });\n\n/**\n * Applies a glass effect to a view.\n */\nexport const glassEffect = (params?: {\n glass?: {\n variant: 'regular' | 'clear' | 'identity';\n interactive?: boolean;\n tint?: string;\n };\n shape?: 'circle' | 'capsule' | 'rectangle' | 'ellipse';\n}) => createModifier('glassEffect', params);\n\n// =============================================================================\n// Type Definitions\n// =============================================================================\n\n/**\n * Union type of all built-in modifier return types.\n * This provides type safety for the modifiers array.\n */\nexport type BuiltInModifier =\n | ReturnType<typeof background>\n | ReturnType<typeof cornerRadius>\n | ReturnType<typeof shadow>\n | ReturnType<typeof frame>\n | ReturnType<typeof padding>\n | ReturnType<typeof fixedSize>\n | ReturnType<typeof onTapGesture>\n | ReturnType<typeof onLongPressGesture>\n | ReturnType<typeof opacity>\n | ReturnType<typeof clipShape>\n | ReturnType<typeof border>\n | ReturnType<typeof scaleEffect>\n | ReturnType<typeof rotationEffect>\n | ReturnType<typeof offset>\n | ReturnType<typeof foregroundColor>\n | ReturnType<typeof tint>\n | ReturnType<typeof hidden>\n | ReturnType<typeof zIndex>\n | ReturnType<typeof blur>\n | ReturnType<typeof brightness>\n | ReturnType<typeof contrast>\n | ReturnType<typeof saturation>\n | ReturnType<typeof hueRotation>\n | ReturnType<typeof colorInvert>\n | ReturnType<typeof grayscale>\n | ReturnType<typeof accessibilityLabel>\n | ReturnType<typeof accessibilityHint>\n | ReturnType<typeof accessibilityValue>\n | ReturnType<typeof layoutPriority>\n | ReturnType<typeof mask>\n | ReturnType<typeof overlay>\n | ReturnType<typeof backgroundOverlay>\n | ReturnType<typeof aspectRatio>\n | ReturnType<typeof clipped>\n | ReturnType<typeof glassEffect>;\n\n/**\n * Main ViewModifier type that supports both built-in and 3rd party modifiers.\n * 3rd party modifiers should return ModifierConfig objects with their own type strings.\n */\nexport type ViewModifier = BuiltInModifier | ModifierConfig;\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\n/**\n * Creates a custom modifier for 3rd party libraries.\n * This function is exported so 3rd party packages can create their own modifiers.\n *\n * @example\n * ```typescript\n * // In a 3rd party package\n * export const blurEffect = (params: { radius: number; style?: string }) =>\n * createModifier('blurEffect', params);\n * ```\n */\nexport { createModifier };\n\n/**\n * Type guard to check if a value is a valid modifier.\n */\nexport const isModifier = (value: any): value is ModifierConfig => {\n return typeof value === 'object' && value !== null && typeof value.$type === 'string';\n};\n\n/**\n * Filters an array to only include valid modifiers.\n */\nexport const filterModifiers = (modifiers: unknown[]): ModifierConfig[] => {\n return modifiers.filter(isModifier);\n};\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Copyright 2025-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import SwiftUI
|
|
4
|
+
import ExpoModulesCore
|
|
5
|
+
import Charts
|
|
6
|
+
|
|
7
|
+
enum ChartType: String, Enumerable {
|
|
8
|
+
case line
|
|
9
|
+
case point
|
|
10
|
+
case bar
|
|
11
|
+
case area
|
|
12
|
+
case pie
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct ChartDataPoint: Record {
|
|
16
|
+
@Field var x: String
|
|
17
|
+
@Field var y: Double
|
|
18
|
+
@Field var color: Color?
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
enum PointStyle: String, Enumerable {
|
|
22
|
+
case circle
|
|
23
|
+
case square
|
|
24
|
+
case diamond
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct LineChartStyle: Record {
|
|
28
|
+
@Field var dashArray: [Double]?
|
|
29
|
+
@Field var width: Double = 2.0
|
|
30
|
+
@Field var pointStyle: PointStyle = .circle
|
|
31
|
+
@Field var pointSize: Double = 6.0
|
|
32
|
+
@Field var color: Color?
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
struct AreaChartStyle: Record {
|
|
36
|
+
@Field var color: Color?
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
struct BarChartStyle: Record {
|
|
40
|
+
@Field var cornerRadius: Double = 0.0
|
|
41
|
+
@Field var width: Double?
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
struct PieChartStyle: Record {
|
|
45
|
+
@Field var innerRadius: Double = 0.3
|
|
46
|
+
@Field var angularInset: Double = 2.0
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
struct PointChartStyle: Record {
|
|
50
|
+
@Field var pointStyle: PointStyle = .circle
|
|
51
|
+
@Field var pointSize: Double = 6.0
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
final class ChartProps: ExpoSwiftUI.ViewProps, CommonViewModifierProps {
|
|
55
|
+
@Field var modifiers: ModifierArray?
|
|
56
|
+
@Field var fixedSize: Bool?
|
|
57
|
+
@Field var frame: FrameOptions?
|
|
58
|
+
@Field var padding: PaddingOptions?
|
|
59
|
+
@Field var testID: String?
|
|
60
|
+
@Field var data: [ChartDataPoint] = []
|
|
61
|
+
@Field var type: ChartType = .line
|
|
62
|
+
@Field var showGrid: Bool = true
|
|
63
|
+
@Field var animate: Bool = true
|
|
64
|
+
@Field var showLegend: Bool = false
|
|
65
|
+
@Field var lineStyle: LineChartStyle?
|
|
66
|
+
@Field var pointStyle: PointChartStyle?
|
|
67
|
+
@Field var areaStyle: AreaChartStyle?
|
|
68
|
+
@Field var barStyle: BarChartStyle?
|
|
69
|
+
@Field var pieStyle: PieChartStyle?
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
struct ChartView: ExpoSwiftUI.View {
|
|
73
|
+
@ObservedObject var props: ChartProps
|
|
74
|
+
|
|
75
|
+
@available(iOS 16.0, *)
|
|
76
|
+
private func createBaseBarMark(for dataPoint: ChartDataPoint) -> BarMark {
|
|
77
|
+
props.barStyle?.width != nil ?
|
|
78
|
+
BarMark(x: .value("X", dataPoint.x), y: .value("Y", dataPoint.y), width: .fixed(CGFloat(props.barStyle?.width ?? 0))) :
|
|
79
|
+
BarMark(x: .value("X", dataPoint.x), y: .value("Y", dataPoint.y))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@available(iOS 17.0, *)
|
|
83
|
+
private func createBasePieMark(for dataPoint: ChartDataPoint) -> SectorMark {
|
|
84
|
+
let style = props.pieStyle ?? PieChartStyle()
|
|
85
|
+
return SectorMark(angle: .value("Value", dataPoint.y), innerRadius: .ratio(style.innerRadius), angularInset: style.angularInset)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@available(iOS 16.0, *)
|
|
89
|
+
private func createAreaMark(for dataPoint: ChartDataPoint) -> some ChartContent {
|
|
90
|
+
AreaMark(x: .value("X", dataPoint.x), y: .value("Y", dataPoint.y))
|
|
91
|
+
.foregroundStyle(props.areaStyle?.color ?? .blue)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@available(iOS 16.0, *)
|
|
95
|
+
private func createLineMark(for dataPoint: ChartDataPoint) -> some ChartContent {
|
|
96
|
+
LineMark(x: .value("X", dataPoint.x), y: .value("Y", dataPoint.y))
|
|
97
|
+
.foregroundStyle(props.lineStyle?.color ?? .blue)
|
|
98
|
+
.symbol(getSymbol(props.lineStyle?.pointStyle ?? .circle))
|
|
99
|
+
.symbolSize(CGFloat(props.lineStyle?.pointSize ?? 6.0))
|
|
100
|
+
.lineStyle(getLineStyle(props.lineStyle?.dashArray ?? []))
|
|
101
|
+
.lineStyle(.init(lineWidth: CGFloat(props.lineStyle?.width ?? 2.0)))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@available(iOS 16.0, *)
|
|
105
|
+
private func createPointMark(for dataPoint: ChartDataPoint) -> some ChartContent {
|
|
106
|
+
PointMark(x: .value("X", dataPoint.x), y: .value("Y", dataPoint.y))
|
|
107
|
+
.foregroundStyle(dataPoint.color ?? .blue)
|
|
108
|
+
.symbol(getSymbol(props.pointStyle?.pointStyle ?? .circle))
|
|
109
|
+
.symbolSize(CGFloat(props.pointStyle?.pointSize ?? 6.0))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var body: some View {
|
|
113
|
+
if #available(iOS 16.0, *) {
|
|
114
|
+
let hasIndividualColors = props.data.contains { $0.color != nil }
|
|
115
|
+
|
|
116
|
+
Chart(props.data, id: \.x) { dataPoint in
|
|
117
|
+
switch props.type {
|
|
118
|
+
case .line:
|
|
119
|
+
createLineMark(for: dataPoint)
|
|
120
|
+
case .point:
|
|
121
|
+
createPointMark(for: dataPoint)
|
|
122
|
+
case .bar:
|
|
123
|
+
if hasIndividualColors {
|
|
124
|
+
createBaseBarMark(for: dataPoint).foregroundStyle(dataPoint.color ?? .blue).cornerRadius(CGFloat(props.barStyle?.cornerRadius ?? 0.0))
|
|
125
|
+
} else {
|
|
126
|
+
createBaseBarMark(for: dataPoint).foregroundStyle(by: .value("Category", dataPoint.x)).cornerRadius(CGFloat(props.barStyle?.cornerRadius ?? 0.0))
|
|
127
|
+
}
|
|
128
|
+
case .area:
|
|
129
|
+
createAreaMark(for: dataPoint)
|
|
130
|
+
case .pie:
|
|
131
|
+
if #available(iOS 17.0, *) {
|
|
132
|
+
if hasIndividualColors {
|
|
133
|
+
createBasePieMark(for: dataPoint).foregroundStyle(dataPoint.color ?? .blue).opacity(0.8)
|
|
134
|
+
} else {
|
|
135
|
+
createBasePieMark(for: dataPoint).foregroundStyle(by: .value("Category", dataPoint.x)).opacity(0.8)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
.chartXAxis(props.showGrid ? .visible : .hidden)
|
|
141
|
+
.chartYAxis(props.showGrid ? .visible : .hidden)
|
|
142
|
+
.if(props.animate) { chart in
|
|
143
|
+
chart.animation(.easeInOut, value: props.data.count)
|
|
144
|
+
}
|
|
145
|
+
.if(props.showLegend) { chart in
|
|
146
|
+
chart.chartLegend(position: .automatic, spacing: 16)
|
|
147
|
+
}
|
|
148
|
+
.if(!props.showLegend) { chart in
|
|
149
|
+
chart.chartLegend(.hidden)
|
|
150
|
+
}
|
|
151
|
+
.modifier(CommonViewModifiers(props: props))
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@available(iOS 16.0, *)
|
|
156
|
+
private func getSymbol(_ pointStyle: PointStyle) -> BasicChartSymbolShape {
|
|
157
|
+
switch pointStyle {
|
|
158
|
+
case .circle:
|
|
159
|
+
return .circle
|
|
160
|
+
case .square:
|
|
161
|
+
return .square
|
|
162
|
+
case .diamond:
|
|
163
|
+
return .diamond
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private func getLineStyle(_ dashArray: [Double]) -> StrokeStyle {
|
|
168
|
+
StrokeStyle(dash: dashArray.map { CGFloat($0) })
|
|
169
|
+
}
|
|
170
|
+
}
|
package/ios/ExpoUIModule.swift
CHANGED
|
@@ -212,14 +212,15 @@ internal struct ClipShapeModifier: ViewModifier {
|
|
|
212
212
|
let shape: String
|
|
213
213
|
let cornerRadius: CGFloat
|
|
214
214
|
|
|
215
|
+
@ViewBuilder
|
|
215
216
|
func body(content: Content) -> some View {
|
|
216
217
|
switch shape {
|
|
217
218
|
case "circle":
|
|
218
|
-
|
|
219
|
+
content.clipShape(Circle())
|
|
219
220
|
case "roundedRectangle":
|
|
220
|
-
|
|
221
|
+
content.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
|
221
222
|
default:
|
|
222
|
-
|
|
223
|
+
content.clipShape(Rectangle())
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
}
|
|
@@ -322,14 +323,15 @@ internal struct MaskModifier: ViewModifier {
|
|
|
322
323
|
let shape: String
|
|
323
324
|
let cornerRadius: CGFloat
|
|
324
325
|
|
|
326
|
+
@ViewBuilder
|
|
325
327
|
func body(content: Content) -> some View {
|
|
326
328
|
switch shape {
|
|
327
329
|
case "circle":
|
|
328
|
-
|
|
330
|
+
content.mask(Circle())
|
|
329
331
|
case "roundedRectangle":
|
|
330
|
-
|
|
332
|
+
content.mask(RoundedRectangle(cornerRadius: cornerRadius))
|
|
331
333
|
default:
|
|
332
|
-
|
|
334
|
+
content.mask(Rectangle())
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
337
|
}
|
|
@@ -377,6 +379,50 @@ internal struct AnyViewModifier: ViewModifier {
|
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
381
|
|
|
382
|
+
internal struct GlassEffectModifier: ViewModifier {
|
|
383
|
+
let glassVariant: String
|
|
384
|
+
let interactive: Bool
|
|
385
|
+
let tint: Color?
|
|
386
|
+
let shape: String
|
|
387
|
+
|
|
388
|
+
@ViewBuilder
|
|
389
|
+
func body(content: Content) -> some View {
|
|
390
|
+
if #available(iOS 26.0, *) {
|
|
391
|
+
#if compiler(>=6.2) // Xcode 26
|
|
392
|
+
let glass = parseGlassVariant(glassVariant)
|
|
393
|
+
switch shape {
|
|
394
|
+
case "capsule":
|
|
395
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Capsule())
|
|
396
|
+
case "circle":
|
|
397
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Circle())
|
|
398
|
+
case "ellipse":
|
|
399
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Ellipse())
|
|
400
|
+
default:
|
|
401
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Rectangle())
|
|
402
|
+
}
|
|
403
|
+
#else
|
|
404
|
+
content
|
|
405
|
+
#endif
|
|
406
|
+
} else {
|
|
407
|
+
content
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
#if compiler(>=6.2) // Xcode 26
|
|
412
|
+
@available(iOS 26.0, *)
|
|
413
|
+
private func parseGlassVariant(_ glassString: String) -> Glass {
|
|
414
|
+
switch glassString {
|
|
415
|
+
case "regular":
|
|
416
|
+
return .regular
|
|
417
|
+
case "clear":
|
|
418
|
+
return .clear
|
|
419
|
+
default:
|
|
420
|
+
return .identity
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
#endif
|
|
424
|
+
}
|
|
425
|
+
|
|
380
426
|
// MARK: - Registry
|
|
381
427
|
|
|
382
428
|
/**
|
|
@@ -660,6 +706,21 @@ extension ViewModifierRegistry {
|
|
|
660
706
|
let alignment = parseAlignment(alignmentString)
|
|
661
707
|
return BackgroundOverlayModifier(color: color, alignment: alignment)
|
|
662
708
|
}
|
|
709
|
+
|
|
710
|
+
register("glassEffect") { params, _ in
|
|
711
|
+
let glassDict = params["glass"] as? [String: Any]
|
|
712
|
+
let glassVariant = glassDict?["variant"] as? String ?? "regular"
|
|
713
|
+
let interactive = glassDict?["interactive"] as? Bool ?? false
|
|
714
|
+
let tintColor = (glassDict?["tint"] as? String).map { Color(hex: $0) }
|
|
715
|
+
let shape = params["shape"] as? String ?? "capsule"
|
|
716
|
+
|
|
717
|
+
return GlassEffectModifier(
|
|
718
|
+
glassVariant: glassVariant,
|
|
719
|
+
interactive: interactive,
|
|
720
|
+
tint: tintColor,
|
|
721
|
+
shape: shape
|
|
722
|
+
)
|
|
723
|
+
}
|
|
663
724
|
}
|
|
664
725
|
}
|
|
665
726
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "expo.modules.ui",
|
|
5
5
|
"module": "expo.modules.ui",
|
|
6
|
-
"version": "0.2.0-alpha.
|
|
6
|
+
"version": "0.2.0-alpha.4",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
28
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
27
|
+
"name": "expo.modules.ui-0.2.0-alpha.4.aar",
|
|
28
|
+
"url": "expo.modules.ui-0.2.0-alpha.4.aar",
|
|
29
29
|
"size": 290997,
|
|
30
30
|
"sha512": "384cd29a311455c4ae4cf149d310dcfe14a19327037155ed2d92caaa560f8dddb508848c5d53f4df052616c6a7ea375f7c71c65005b033059cbb2371347cc41c",
|
|
31
31
|
"sha256": "b1c1a4d274c028b10bac4f977b1cfb740b2b70099a3d5dda908d8672810ad77c",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
],
|
|
103
103
|
"files": [
|
|
104
104
|
{
|
|
105
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
106
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
105
|
+
"name": "expo.modules.ui-0.2.0-alpha.4.aar",
|
|
106
|
+
"url": "expo.modules.ui-0.2.0-alpha.4.aar",
|
|
107
107
|
"size": 290997,
|
|
108
108
|
"sha512": "384cd29a311455c4ae4cf149d310dcfe14a19327037155ed2d92caaa560f8dddb508848c5d53f4df052616c6a7ea375f7c71c65005b033059cbb2371347cc41c",
|
|
109
109
|
"sha256": "b1c1a4d274c028b10bac4f977b1cfb740b2b70099a3d5dda908d8672810ad77c",
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
},
|
|
123
123
|
"files": [
|
|
124
124
|
{
|
|
125
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
126
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
125
|
+
"name": "expo.modules.ui-0.2.0-alpha.4-sources.jar",
|
|
126
|
+
"url": "expo.modules.ui-0.2.0-alpha.4-sources.jar",
|
|
127
127
|
"size": 18894,
|
|
128
128
|
"sha512": "b6fd029855da3e7ceb97e20cf9dbcbf73f0b81342a24eb9e1988d7d05734fb038080702280129e643d1acab4b1ca0d9d2147d54f64906f6824659640bcc12b46",
|
|
129
129
|
"sha256": "ab99988e09f8bda506deaa7eded3b45bfa56f444c6f55c78d7814cfb6c40918b",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d3707c8fc68367d427a648be7f169757
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7e4951e603241046e1edabfdcba7561bca1a189f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
849491fbc841e784857f7a77394a48042872aa09bdfea7f6b1739e561cb736e7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
54cd4c1734fbd2fb68a02b9766bd283a86309a409deecf0a002f8a592f105190281b57b0137ce5bc4105eeeace94669f484cf884bde10bfe4bb189088b7fa272
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>expo.modules.ui</groupId>
|
|
11
11
|
<artifactId>expo.modules.ui</artifactId>
|
|
12
|
-
<version>0.2.0-alpha.
|
|
12
|
+
<version>0.2.0-alpha.4</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.ui</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
75722adf092779a7590e996f73e18b4d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0648eab630c5de347b712fbb19c64d63694df48d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bae1f7fb71954a534a51a69165749687b76152719e9a27c416171c1c4fa3d331
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8a2ba4f990a0c9e4290244c08c2d2f63a05e4099db98b981bacf7fc5ea3ca1abf17fc45de49160e685f8fa053f6eeb0b6044a51e39794a85f5426119049b069b
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>expo.modules.ui</groupId>
|
|
4
4
|
<artifactId>expo.modules.ui</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>0.2.0-alpha.
|
|
7
|
-
<release>0.2.0-alpha.
|
|
6
|
+
<latest>0.2.0-alpha.4</latest>
|
|
7
|
+
<release>0.2.0-alpha.4</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>0.2.0-alpha.
|
|
9
|
+
<version>0.2.0-alpha.4</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250819175536</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d659af2e40c0c2f279bc102e20ded541
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fc75cf1c3d69673ce289ec32bb75b03c2aa4d4f7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
cbbe7320ee2f19031ae39d5aecacbd97386bc239f5eeb0110d510e47d0a3cfe8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7c278857384e85da96ff2efd929a67383d4dda5b9f011d96cadc3b3cf132fc7ab3141917951567fcbf1d13496fdc6e1f2eb1fc308d8750844a84aa2a909b74d4
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/ui",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.4",
|
|
4
4
|
"description": "A collection of UI components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "expo-module build",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-native": "*"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "de2ce610a804a8f3ddcee6ea9474543e81b903bd"
|
|
38
38
|
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { ColorValue, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
import { CommonViewModifierProps } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The type of chart to display.
|
|
9
|
+
* - `line` charts show continuous lines with optional dash array, width, point symbols, and color.
|
|
10
|
+
* - `point` charts show discrete colored points with optional point style (circle, square, diamond) and size.
|
|
11
|
+
* - `bar` charts show vertical bars using system colors or individual ChartDataPoint colors, with optional corner radius and width styling.
|
|
12
|
+
* - `area` charts show filled areas under lines with color.
|
|
13
|
+
* - `pie` charts show pie slices with optional inner radius and angular inset. Pie charts require iOS 17.0+.
|
|
14
|
+
* @platform ios
|
|
15
|
+
*/
|
|
16
|
+
export type ChartType = 'line' | 'point' | 'bar' | 'area' | 'pie';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Point symbol style options.
|
|
20
|
+
* @platform ios
|
|
21
|
+
*/
|
|
22
|
+
export type PointStyle = 'circle' | 'square' | 'diamond';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Data point for the chart.
|
|
26
|
+
* @platform ios
|
|
27
|
+
*/
|
|
28
|
+
export type ChartDataPoint = {
|
|
29
|
+
/**
|
|
30
|
+
* X-axis value (label).
|
|
31
|
+
*/
|
|
32
|
+
x: string;
|
|
33
|
+
/**
|
|
34
|
+
* Y-axis value (numeric).
|
|
35
|
+
*/
|
|
36
|
+
y: number;
|
|
37
|
+
/**
|
|
38
|
+
* Optional color for this specific data point.
|
|
39
|
+
*/
|
|
40
|
+
color?: ColorValue;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Line chart specific styling options.
|
|
45
|
+
*/
|
|
46
|
+
export type LineChartStyle = {
|
|
47
|
+
/**
|
|
48
|
+
* Dash pattern array. Empty array or undefined for solid lines.
|
|
49
|
+
* @example [5, 5] for dashed line, [2, 2] for dotted line
|
|
50
|
+
*/
|
|
51
|
+
dashArray?: number[];
|
|
52
|
+
/**
|
|
53
|
+
* Line stroke width.
|
|
54
|
+
*/
|
|
55
|
+
width?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Point symbol style.
|
|
58
|
+
*/
|
|
59
|
+
pointStyle?: PointStyle;
|
|
60
|
+
/**
|
|
61
|
+
* Point symbol size.
|
|
62
|
+
*/
|
|
63
|
+
pointSize?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Line color.
|
|
66
|
+
*/
|
|
67
|
+
color?: ColorValue;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Area chart specific styling options.
|
|
72
|
+
*/
|
|
73
|
+
export type AreaChartStyle = {
|
|
74
|
+
/**
|
|
75
|
+
* Area fill color.
|
|
76
|
+
*/
|
|
77
|
+
color?: ColorValue;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Bar chart specific styling options.
|
|
82
|
+
*/
|
|
83
|
+
export type BarChartStyle = {
|
|
84
|
+
/**
|
|
85
|
+
* Corner radius for rounded bar corners.
|
|
86
|
+
*/
|
|
87
|
+
cornerRadius?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Custom bar width.
|
|
90
|
+
*/
|
|
91
|
+
width?: number;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Pie chart specific styling options.
|
|
96
|
+
*/
|
|
97
|
+
export type PieChartStyle = {
|
|
98
|
+
/**
|
|
99
|
+
* Inner radius ratio (0.0 = full pie, 0.5 = donut).
|
|
100
|
+
*/
|
|
101
|
+
innerRadius?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Space between slices in points.
|
|
104
|
+
*/
|
|
105
|
+
angularInset?: number;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Point chart specific styling options.
|
|
110
|
+
*/
|
|
111
|
+
export type PointChartStyle = {
|
|
112
|
+
/**
|
|
113
|
+
* Point symbol style.
|
|
114
|
+
*/
|
|
115
|
+
pointStyle?: PointStyle;
|
|
116
|
+
/**
|
|
117
|
+
* Point symbol size.
|
|
118
|
+
*/
|
|
119
|
+
pointSize?: number;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type ChartProps = {
|
|
123
|
+
/**
|
|
124
|
+
* Array of data points to display.
|
|
125
|
+
*/
|
|
126
|
+
data: ChartDataPoint[];
|
|
127
|
+
/**
|
|
128
|
+
* Type of chart to render.
|
|
129
|
+
*/
|
|
130
|
+
type?: ChartType;
|
|
131
|
+
/**
|
|
132
|
+
* Whether to show grid lines.
|
|
133
|
+
*/
|
|
134
|
+
showGrid?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether to animate chart changes.
|
|
137
|
+
*/
|
|
138
|
+
animate?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether to show chart legend.
|
|
141
|
+
* - Only works when individual dataPoint colors are NOT provided (uses categorical styling)
|
|
142
|
+
* - Useful for `bar` and `pie` charts (shows category colors)
|
|
143
|
+
* - Not applicable for `line` and `area` charts (single-series data)
|
|
144
|
+
* - If dataPoint has individual colors, legend won't appear - use data without colors to see legend
|
|
145
|
+
*/
|
|
146
|
+
showLegend?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Line chart specific styling options.
|
|
149
|
+
*/
|
|
150
|
+
lineStyle?: LineChartStyle;
|
|
151
|
+
/**
|
|
152
|
+
* Point chart specific styling options.
|
|
153
|
+
*/
|
|
154
|
+
pointStyle?: PointChartStyle;
|
|
155
|
+
/**
|
|
156
|
+
* Area chart specific styling options.
|
|
157
|
+
*/
|
|
158
|
+
areaStyle?: AreaChartStyle;
|
|
159
|
+
/**
|
|
160
|
+
* Bar chart specific styling options.
|
|
161
|
+
*/
|
|
162
|
+
barStyle?: BarChartStyle;
|
|
163
|
+
/**
|
|
164
|
+
* Pie chart specific styling options.
|
|
165
|
+
*/
|
|
166
|
+
pieStyle?: PieChartStyle;
|
|
167
|
+
} & CommonViewModifierProps;
|
|
168
|
+
|
|
169
|
+
const ChartNativeView: React.ComponentType<ChartProps> = requireNativeView('ExpoUI', 'ChartView');
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Renders a native Chart component using Swift Charts.
|
|
173
|
+
* @platform ios
|
|
174
|
+
*/
|
|
175
|
+
export function Chart({
|
|
176
|
+
style,
|
|
177
|
+
data,
|
|
178
|
+
modifiers,
|
|
179
|
+
...props
|
|
180
|
+
}: ChartProps & { style?: StyleProp<ViewStyle> }) {
|
|
181
|
+
return (
|
|
182
|
+
<ChartNativeView
|
|
183
|
+
data={data}
|
|
184
|
+
modifiers={modifiers}
|
|
185
|
+
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
186
|
+
{...props}
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
package/src/swift-ui/index.tsx
CHANGED
|
@@ -292,6 +292,18 @@ export const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill
|
|
|
292
292
|
*/
|
|
293
293
|
export const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Applies a glass effect to a view.
|
|
297
|
+
*/
|
|
298
|
+
export const glassEffect = (params?: {
|
|
299
|
+
glass?: {
|
|
300
|
+
variant: 'regular' | 'clear' | 'identity';
|
|
301
|
+
interactive?: boolean;
|
|
302
|
+
tint?: string;
|
|
303
|
+
};
|
|
304
|
+
shape?: 'circle' | 'capsule' | 'rectangle' | 'ellipse';
|
|
305
|
+
}) => createModifier('glassEffect', params);
|
|
306
|
+
|
|
295
307
|
// =============================================================================
|
|
296
308
|
// Type Definitions
|
|
297
309
|
// =============================================================================
|
|
@@ -334,7 +346,8 @@ export type BuiltInModifier =
|
|
|
334
346
|
| ReturnType<typeof overlay>
|
|
335
347
|
| ReturnType<typeof backgroundOverlay>
|
|
336
348
|
| ReturnType<typeof aspectRatio>
|
|
337
|
-
| ReturnType<typeof clipped
|
|
349
|
+
| ReturnType<typeof clipped>
|
|
350
|
+
| ReturnType<typeof glassEffect>;
|
|
338
351
|
|
|
339
352
|
/**
|
|
340
353
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ebd622454b8774b1d8ab9e5e13faef28
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
72cb5c3cd1ca2c656fd9f9c5a82e39e076b998e6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
51b8e44c8de591afb564cca40096f2923a77c03577e8aa204aa187d6dd871aa8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
acd769c1604cc8b0ef715b2f02991e2a52a6157f5c1c101092bcbb9baadb42ffba7963415b68a9716e0274e12cec59481b8436e795f1e7d9ee11af7b3adfa523
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
732bab5d7fc9465e34d27e82c59951f5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
99c4b297650ecd03d9207c8380a537e1e9fea2fd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1dfbdb4e571d7f6434abdca55138ea887a886e1c8c6df3ab1bedb0a576f02551
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0b1ca33275c23c58e10e53cfdb637b81b1cc07d9daa34d0def0ec3b2d2e4f3cb92688325ecee2c9d9afb45575d71bdf1faaa65d69dca03140004d5f52bedd7f9
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|