@impulse-ui-native/toolkit 2.1.6 → 2.3.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/README.md +189 -22
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -1,42 +1,90 @@
|
|
|
1
1
|
# @impulse-ui-native/toolkit
|
|
2
2
|
|
|
3
|
-
The complete Impulse UI Native component
|
|
3
|
+
The complete Impulse UI Native component library in one package.
|
|
4
|
+
|
|
5
|
+
`@impulse-ui-native/toolkit` provides token-driven React Native primitives, form controls, date and time pickers, charts, loading and empty states, flyouts, portals, and shared utilities through a single package entrypoint. It is the recommended package for applications that want the full library and the package listed in the React Native Directory.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- React Native components with TypeScript types.
|
|
10
|
+
- One theme system shared by every component.
|
|
11
|
+
- Works with native applications and React Native Web.
|
|
12
|
+
- Gesture-driven flyouts and app-wide overlay management.
|
|
13
|
+
- Single- and multi-select controls, date/time pickers, charts, skeletons, and data states.
|
|
14
|
+
- Modular internals: applications with a narrow use case can install an individual `@impulse-ui-native/*` package instead.
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- React 18 or newer.
|
|
19
|
+
- React Native 0.73 or newer.
|
|
20
|
+
- The native peer dependencies listed below.
|
|
21
|
+
|
|
22
|
+
The toolkit supports the React Native versions expressed by its peer dependencies. When using Expo, install native packages with `expo install` so Expo selects versions compatible with the SDK in your application.
|
|
4
23
|
|
|
5
24
|
## Installation
|
|
6
25
|
|
|
26
|
+
Install the toolkit:
|
|
27
|
+
|
|
7
28
|
```sh
|
|
8
29
|
pnpm add @impulse-ui-native/toolkit
|
|
9
30
|
```
|
|
10
31
|
|
|
11
|
-
Install
|
|
32
|
+
Install its native peers:
|
|
12
33
|
|
|
13
34
|
```sh
|
|
14
35
|
pnpm add @shopify/flash-list @shopify/react-native-skia react-native-gesture-handler react-native-reanimated react-native-safe-area-context react-native-svg react-native-worklets
|
|
15
36
|
```
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
In an Expo application, use:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npx expo install @shopify/flash-list @shopify/react-native-skia react-native-gesture-handler react-native-reanimated react-native-safe-area-context react-native-svg react-native-worklets
|
|
42
|
+
npm install @impulse-ui-native/toolkit
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Complete the platform setup required by Gesture Handler, Reanimated, Worklets, Skia, and Safe Area Context for the versions used by your project. Native applications must be rebuilt after adding native dependencies.
|
|
46
|
+
|
|
47
|
+
The endpoint factories are included in the toolkit but have two additional peers. Install them only when using the endpoint API:
|
|
18
48
|
|
|
19
49
|
```sh
|
|
20
50
|
pnpm add axios @tanstack/react-query
|
|
21
51
|
```
|
|
22
52
|
|
|
23
|
-
|
|
53
|
+
Icons are intentionally distributed separately so the toolkit does not expose thousands of icon modules from its root. Install the icon package when needed:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm add @impulse-ui-native/icon react-native-svg
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Application setup
|
|
24
60
|
|
|
25
|
-
|
|
61
|
+
Mount the providers and global renderers once at the application root. This is the recommended Expo Router layout:
|
|
26
62
|
|
|
27
63
|
```tsx
|
|
28
64
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
29
65
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
66
|
+
import { Stack } from "expo-router";
|
|
30
67
|
|
|
31
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
LayerCenter,
|
|
70
|
+
PortalProvider,
|
|
71
|
+
PortalsHost,
|
|
72
|
+
PortalStore,
|
|
73
|
+
ThemeProvider,
|
|
74
|
+
} from "@impulse-ui-native/toolkit";
|
|
32
75
|
|
|
33
|
-
|
|
76
|
+
const portalStore = new PortalStore();
|
|
77
|
+
|
|
78
|
+
export default function RootLayout() {
|
|
34
79
|
return (
|
|
35
80
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
36
81
|
<SafeAreaProvider>
|
|
37
82
|
<ThemeProvider>
|
|
38
|
-
{
|
|
39
|
-
|
|
83
|
+
<PortalProvider store={portalStore}>
|
|
84
|
+
<Stack />
|
|
85
|
+
<LayerCenter />
|
|
86
|
+
<PortalsHost />
|
|
87
|
+
</PortalProvider>
|
|
40
88
|
</ThemeProvider>
|
|
41
89
|
</SafeAreaProvider>
|
|
42
90
|
</GestureHandlerRootView>
|
|
@@ -44,27 +92,146 @@ export function App() {
|
|
|
44
92
|
}
|
|
45
93
|
```
|
|
46
94
|
|
|
47
|
-
|
|
95
|
+
Keep `portalStore` outside the component so the same store survives every render. In an application that does not use Expo Router, replace `<Stack />` with your navigator or root application content and keep the surrounding hierarchy unchanged.
|
|
96
|
+
|
|
97
|
+
| Root element | Purpose |
|
|
98
|
+
| ------------------------ | ------------------------------------------------------------------------ |
|
|
99
|
+
| `GestureHandlerRootView` | Enables native gesture handling for flyouts and gesture-driven controls. |
|
|
100
|
+
| `SafeAreaProvider` | Supplies safe-area measurements to primitives and overlays. |
|
|
101
|
+
| `ThemeProvider` | Supplies primitive, semantic, and component design tokens. |
|
|
102
|
+
| `PortalProvider` | Connects the tree to the stable `PortalStore`. |
|
|
103
|
+
| `LayerCenter` | Renders flyouts registered through the app-wide layer registry. |
|
|
104
|
+
| `PortalsHost` | Renders content sent to the default portal host. |
|
|
105
|
+
|
|
106
|
+
`LayerCenter` and `PortalsHost` should be siblings of the navigator and children of `PortalProvider`. Mount only one of each at the root.
|
|
107
|
+
|
|
108
|
+
## Basic usage
|
|
109
|
+
|
|
110
|
+
All toolkit components and public types are available from the package root:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { useState } from "react";
|
|
114
|
+
|
|
115
|
+
import { Button, Input, Typography, View } from "@impulse-ui-native/toolkit";
|
|
116
|
+
|
|
117
|
+
export function SignInForm() {
|
|
118
|
+
const [email, setEmail] = useState("");
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<View gap="md" padding="lg">
|
|
122
|
+
<Typography.Title2>Welcome back</Typography.Title2>
|
|
123
|
+
<Input
|
|
124
|
+
autoCapitalize="none"
|
|
125
|
+
keyboardType="email-address"
|
|
126
|
+
label="Email"
|
|
127
|
+
onChangeText={setEmail}
|
|
128
|
+
placeholder="you@example.com"
|
|
129
|
+
value={email}
|
|
130
|
+
/>
|
|
131
|
+
<Button onPress={() => {}}>Continue</Button>
|
|
132
|
+
</View>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Selects and flyouts
|
|
138
|
+
|
|
139
|
+
`Select`, `MultiSelect`, and the date/time pickers use the root `LayerCenter`. Once the application setup above is in place, a select can be rendered anywhere below it:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { useState } from "react";
|
|
143
|
+
|
|
144
|
+
import { Select } from "@impulse-ui-native/toolkit";
|
|
145
|
+
|
|
146
|
+
const options = [
|
|
147
|
+
{ label: "Design", value: "design" },
|
|
148
|
+
{ label: "Engineering", value: "engineering" },
|
|
149
|
+
{ label: "Operations", value: "operations" },
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
export function DepartmentField() {
|
|
153
|
+
const [value, setValue] = useState<string>();
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<Select
|
|
157
|
+
label="Department"
|
|
158
|
+
onChange={setValue}
|
|
159
|
+
options={options}
|
|
160
|
+
placeholder="Choose a department"
|
|
161
|
+
value={value}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Do not mount another `LayerCenter` beside the control; registered overlays are rendered by the single application-level instance.
|
|
168
|
+
|
|
169
|
+
## Theming
|
|
170
|
+
|
|
171
|
+
`ThemeProvider` uses the light theme by default. Select a scheme and override only the tokens your application needs:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
<ThemeProvider
|
|
175
|
+
scheme="dark"
|
|
176
|
+
theme={{
|
|
177
|
+
dark: {
|
|
178
|
+
colors: {
|
|
179
|
+
primary: {
|
|
180
|
+
value: "#8b7cff",
|
|
181
|
+
contrast: "#ffffff",
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
{/* application */}
|
|
188
|
+
</ThemeProvider>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Theme overrides are deep partials. Hooks including `useTheme`, `useColors`, `useSpace`, `useBorder`, `useRadii`, `useComponentsTokens`, and `useThemedStyles` are available for application components.
|
|
48
192
|
|
|
49
193
|
## Included APIs
|
|
50
194
|
|
|
51
|
-
- Foundations:
|
|
195
|
+
- Foundations: theme tokens and hooks, shared types, styling utilities, and core helpers.
|
|
196
|
+
- Primitives: `View`, `SafeAreaView`, typography presets, `Pressable`, `Button`, `IconButton`, `Tag`, and compound control primitives.
|
|
52
197
|
- Inputs: `Input`, `Select`, and `MultiSelect`.
|
|
53
198
|
- Date and time: `DatePicker`, `DateRangePicker`, `DatetimePicker`, `DatetimeRangePicker`, and `TimePicker`.
|
|
54
|
-
- Charts:
|
|
199
|
+
- Charts: line, bar, pie, multi-series chart components, axes, grids, labels, hooks, and utilities.
|
|
55
200
|
- Feedback: `Skeleton`, `DataView`, `LoadingView`, `EmptyView`, and `ErrorView`.
|
|
56
|
-
- Navigation and overlays: `Stepper`, `Flyout`, `LayerCenter`, the flyout registry, and portal
|
|
57
|
-
-
|
|
201
|
+
- Navigation and overlays: `Stepper`, `Flyout`, `LayerCenter`, the flyout registry, `Portal`, `PortalProvider`, `PortalStore`, and portal hosts.
|
|
202
|
+
- Data utilities: `EchoInstance`, echo hooks, and typed Axios/TanStack Query endpoint factories.
|
|
58
203
|
|
|
59
|
-
|
|
204
|
+
## Icons
|
|
205
|
+
|
|
206
|
+
Import icons through per-icon entrypoints from `@impulse-ui-native/icon`:
|
|
60
207
|
|
|
61
208
|
```tsx
|
|
62
|
-
import {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
ThemeProvider,
|
|
67
|
-
} from "@impulse-ui-native/toolkit";
|
|
209
|
+
import { Icon } from "@impulse-ui-native/icon/components/icon";
|
|
210
|
+
import { HeartIcon } from "@impulse-ui-native/icon/icons/heart";
|
|
211
|
+
|
|
212
|
+
<Icon icon={HeartIcon} variant="duotone" size="large" color="#6d5dfc" />;
|
|
68
213
|
```
|
|
69
214
|
|
|
70
|
-
|
|
215
|
+
Per-icon entrypoints let Metro include only the icons used by the application. Available weights are `bold`, `duotone`, `fill`, `light`, `regular`, and `thin`.
|
|
216
|
+
|
|
217
|
+
## Toolkit or individual packages?
|
|
218
|
+
|
|
219
|
+
Use `@impulse-ui-native/toolkit` when you want one dependency and one import path for the complete component API. Install individual packages such as `@impulse-ui-native/theme`, `@impulse-ui-native/primitives`, or `@impulse-ui-native/select` when you want a smaller, explicit dependency surface.
|
|
220
|
+
|
|
221
|
+
The toolkit uses ES modules and declares itself side-effect free, allowing compatible bundlers to remove exports that are not used. The icon library remains separate because its generated per-icon entrypoints are best consumed directly.
|
|
222
|
+
|
|
223
|
+
## Troubleshooting
|
|
224
|
+
|
|
225
|
+
- If gestures do not respond, verify that `GestureHandlerRootView` is the outermost application view and has `flex: 1`.
|
|
226
|
+
- If a select or registered flyout does not appear, verify that one `LayerCenter` is mounted inside the root providers.
|
|
227
|
+
- If portal content does not appear, verify that `PortalProvider` and `PortalsHost` use the same stable store and host name.
|
|
228
|
+
- If content overlaps a notch or system bar, verify that `SafeAreaProvider` wraps the themed application.
|
|
229
|
+
- If a native dependency was just installed, rebuild the native application rather than relying only on a JavaScript refresh.
|
|
230
|
+
|
|
231
|
+
## Documentation and source
|
|
232
|
+
|
|
233
|
+
The source, package-specific guides, Storybook examples, and issue tracker are available at [github.com/apolyanov/impulse-ui-native](https://github.com/apolyanov/impulse-ui-native).
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
Impulse UI Native is released under the [MIT license](./LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.mts",
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@impulse-ui-native/charts": "2.3.
|
|
23
|
-
"@impulse-ui-native/
|
|
24
|
-
"@impulse-ui-native/endpoint": "2.
|
|
25
|
-
"@impulse-ui-native/
|
|
26
|
-
"@impulse-ui-native/
|
|
27
|
-
"@impulse-ui-native/
|
|
28
|
-
"@impulse-ui-native/
|
|
29
|
-
"@impulse-ui-native/
|
|
30
|
-
"@impulse-ui-native/
|
|
31
|
-
"@impulse-ui-native/
|
|
32
|
-
"@impulse-ui-native/
|
|
33
|
-
"@impulse-ui-native/
|
|
34
|
-
"@impulse-ui-native/
|
|
35
|
-
"@impulse-ui-native/
|
|
36
|
-
"@impulse-ui-native/portal": "2.
|
|
37
|
-
"@impulse-ui-native/
|
|
22
|
+
"@impulse-ui-native/charts": "2.3.4",
|
|
23
|
+
"@impulse-ui-native/echo": "2.3.4",
|
|
24
|
+
"@impulse-ui-native/endpoint": "2.3.4",
|
|
25
|
+
"@impulse-ui-native/flyout": "2.3.4",
|
|
26
|
+
"@impulse-ui-native/stepper": "2.3.4",
|
|
27
|
+
"@impulse-ui-native/input": "2.3.4",
|
|
28
|
+
"@impulse-ui-native/layers": "2.3.4",
|
|
29
|
+
"@impulse-ui-native/core": "2.3.4",
|
|
30
|
+
"@impulse-ui-native/types": "2.3.4",
|
|
31
|
+
"@impulse-ui-native/data-state": "2.3.4",
|
|
32
|
+
"@impulse-ui-native/skeleton": "2.3.4",
|
|
33
|
+
"@impulse-ui-native/primitives": "2.3.4",
|
|
34
|
+
"@impulse-ui-native/theme": "2.3.4",
|
|
35
|
+
"@impulse-ui-native/datetime": "2.3.4",
|
|
36
|
+
"@impulse-ui-native/portal": "2.3.4",
|
|
37
|
+
"@impulse-ui-native/select": "2.3.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "~19.2.14",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"react": "19.2.3",
|
|
44
44
|
"react-native": "0.86.2",
|
|
45
45
|
"typescript": "~6.0.3",
|
|
46
|
-
"@impulse-ui-native/
|
|
46
|
+
"@impulse-ui-native/prettier-config": "1.0.0",
|
|
47
47
|
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
48
|
-
"@impulse-ui-native/
|
|
48
|
+
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@shopify/flash-list": ">=2",
|