@xaui/native 0.0.21 → 0.0.24
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 +195 -2
- package/dist/alert/index.js +1 -2
- package/dist/app-bar/index.cjs +217 -0
- package/dist/app-bar/index.d.cts +52 -0
- package/dist/app-bar/index.d.ts +52 -0
- package/dist/app-bar/index.js +142 -0
- package/dist/autocomplete/index.js +48 -36
- package/dist/avatar/index.js +1 -2
- package/dist/badge/index.js +1 -2
- package/dist/bottom-sheet/index.js +1 -2
- package/dist/bottom-tab-bar/index.cjs +571 -0
- package/dist/bottom-tab-bar/index.d.cts +211 -0
- package/dist/bottom-tab-bar/index.d.ts +211 -0
- package/dist/bottom-tab-bar/index.js +497 -0
- package/dist/button/index.d.cts +102 -5
- package/dist/button/index.d.ts +102 -5
- package/dist/button/index.js +2 -3
- package/dist/button.type-j1ZdkkSl.d.cts +4 -0
- package/dist/button.type-j1ZdkkSl.d.ts +4 -0
- package/dist/card/index.cjs +2 -0
- package/dist/card/index.d.cts +6 -1
- package/dist/card/index.d.ts +6 -1
- package/dist/card/index.js +4 -2
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +1067 -0
- package/dist/chart/index.d.cts +218 -0
- package/dist/chart/index.d.ts +218 -0
- package/dist/chart/index.js +1026 -0
- package/dist/checkbox/index.js +1 -2
- package/dist/chip/index.js +1 -2
- package/dist/chunk-3XSXTM3G.js +661 -0
- package/dist/chunk-4KSZLONZ.js +79 -0
- package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
- package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
- package/dist/chunk-I4V5Y5GD.js +76 -0
- package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
- package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
- package/dist/chunk-URBEEDFX.js +79 -0
- package/dist/core/index.js +3 -5
- package/dist/datepicker/index.js +1 -2
- package/dist/divider/index.js +2 -3
- package/dist/drawer/index.cjs +310 -0
- package/dist/drawer/index.d.cts +58 -0
- package/dist/drawer/index.d.ts +58 -0
- package/dist/drawer/index.js +236 -0
- package/dist/{accordion → expansion-panel}/index.cjs +45 -45
- package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
- package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
- package/dist/{accordion → expansion-panel}/index.js +40 -41
- package/dist/fab/index.d.cts +3 -3
- package/dist/fab/index.d.ts +3 -3
- package/dist/fab/index.js +3 -4
- package/dist/fab-menu/index.d.cts +2 -2
- package/dist/fab-menu/index.d.ts +2 -2
- package/dist/fab-menu/index.js +3 -4
- package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
- package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
- package/dist/feature-discovery/index.cjs +531 -0
- package/dist/feature-discovery/index.d.cts +82 -0
- package/dist/feature-discovery/index.d.ts +82 -0
- package/dist/feature-discovery/index.js +464 -0
- package/dist/indicator/index.js +2 -3
- package/dist/input/index.cjs +258 -164
- package/dist/input/index.d.cts +15 -1
- package/dist/input/index.d.ts +15 -1
- package/dist/input/index.js +219 -126
- package/dist/list/index.js +1 -2
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +369 -0
- package/dist/menubox/index.d.cts +98 -0
- package/dist/menubox/index.d.ts +98 -0
- package/dist/menubox/index.js +296 -0
- package/dist/pager/index.cjs +243 -0
- package/dist/pager/index.d.cts +93 -0
- package/dist/pager/index.d.ts +93 -0
- package/dist/pager/index.js +205 -0
- package/dist/progress/index.js +1 -2
- package/dist/radio/index.cjs +537 -0
- package/dist/radio/index.d.cts +145 -0
- package/dist/radio/index.d.ts +145 -0
- package/dist/radio/index.js +464 -0
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.js +22 -10
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +655 -0
- package/dist/slider/index.d.cts +171 -0
- package/dist/slider/index.d.ts +171 -0
- package/dist/slider/index.js +575 -0
- package/dist/stepper/index.cjs +624 -0
- package/dist/stepper/index.d.cts +137 -0
- package/dist/stepper/index.d.ts +137 -0
- package/dist/stepper/index.js +549 -0
- package/dist/switch/index.js +1 -2
- package/dist/tabs/index.cjs +523 -0
- package/dist/tabs/index.d.cts +176 -0
- package/dist/tabs/index.d.ts +176 -0
- package/dist/tabs/index.js +438 -0
- package/dist/timepicker/index.cjs +1280 -0
- package/dist/timepicker/index.d.cts +215 -0
- package/dist/timepicker/index.d.ts +215 -0
- package/dist/timepicker/index.js +1181 -0
- package/dist/toolbar/index.cjs +395 -0
- package/dist/toolbar/index.d.cts +100 -0
- package/dist/toolbar/index.d.ts +100 -0
- package/dist/toolbar/index.js +325 -0
- package/dist/typography/index.js +1 -2
- package/dist/view/index.cjs +16 -2
- package/dist/view/index.js +16 -2
- package/package.json +73 -8
- package/dist/button.type-D8tzEBo7.d.ts +0 -104
- package/dist/button.type-ikaWzhIg.d.cts +0 -104
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-JEGEPGVU.js +0 -287
package/README.md
CHANGED
|
@@ -79,8 +79,6 @@ function Banner() {
|
|
|
79
79
|
</Button>
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
`useButtonStyles` exposes the internal calculations if you need to derive custom layouts (spacing, colors, shadows, spinner size).
|
|
83
|
-
|
|
84
82
|
### `ActivityIndicator`
|
|
85
83
|
|
|
86
84
|
- Variants: `circular` (default size 40) and `linear` (custom height)
|
|
@@ -96,6 +94,201 @@ function Banner() {
|
|
|
96
94
|
/>
|
|
97
95
|
```
|
|
98
96
|
|
|
97
|
+
### `ExpansionPanel`
|
|
98
|
+
|
|
99
|
+
- Variants: `light`, `bordered`, `splitted`
|
|
100
|
+
- Selection modes: `toggle` (single expansion) or `multiple` (simultaneous expansions)
|
|
101
|
+
- Supports disabled items, compact mode, and custom appearance
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { ExpansionPanel, ExpansionPanelItem } from '@xaui/native/expansion-panel'
|
|
105
|
+
|
|
106
|
+
;<ExpansionPanel variant="light" selectionMode="toggle" showDivider>
|
|
107
|
+
<ExpansionPanelItem title="Section 1" itemKey="section1">
|
|
108
|
+
<Text>Content for section 1</Text>
|
|
109
|
+
</ExpansionPanelItem>
|
|
110
|
+
<ExpansionPanelItem title="Section 2" itemKey="section2">
|
|
111
|
+
<Text>Content for section 2</Text>
|
|
112
|
+
</ExpansionPanelItem>
|
|
113
|
+
</ExpansionPanel>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### `Avatar`
|
|
117
|
+
|
|
118
|
+
- Variants: `circle`, `square`, `rounded`
|
|
119
|
+
- Sizes: `xs`, `sm`, `md`, `lg`, `xl`
|
|
120
|
+
- Supports images, icons, or text initials
|
|
121
|
+
- Fallback support when image fails to load
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { Avatar } from '@xaui/native/avatar'
|
|
125
|
+
|
|
126
|
+
// With image
|
|
127
|
+
<Avatar src="https://example.com/avatar.jpg" size="lg" variant="circle" />
|
|
128
|
+
|
|
129
|
+
// With icon
|
|
130
|
+
<Avatar icon={<UserIcon />} size="md" variant="rounded" />
|
|
131
|
+
|
|
132
|
+
// With text initials
|
|
133
|
+
<Avatar name="John Doe" size="sm" variant="square" />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `Badge`
|
|
137
|
+
|
|
138
|
+
- Variants: `solid`, `outlined`, `flat`, `light`, `faded`
|
|
139
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
140
|
+
- Supports icons, custom colors, and notification dots
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { Badge } from '@xaui/native/badge'
|
|
144
|
+
|
|
145
|
+
<Badge themeColor="danger" variant="solid" size="md">
|
|
146
|
+
99+
|
|
147
|
+
</Badge>
|
|
148
|
+
|
|
149
|
+
<Badge themeColor="success" variant="outlined" showDot>
|
|
150
|
+
Online
|
|
151
|
+
</Badge>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `Checkbox`
|
|
155
|
+
|
|
156
|
+
- Variants: `solid`, `outlined`, `flat`
|
|
157
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
158
|
+
- Supports indeterminate state, custom icons, and line-through text
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { Checkbox } from '@xaui/native/checkbox'
|
|
162
|
+
|
|
163
|
+
;<Checkbox
|
|
164
|
+
isSelected={isChecked}
|
|
165
|
+
onValueChange={setIsChecked}
|
|
166
|
+
themeColor="primary"
|
|
167
|
+
size="md"
|
|
168
|
+
>
|
|
169
|
+
Accept terms and conditions
|
|
170
|
+
</Checkbox>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### `Chip`
|
|
174
|
+
|
|
175
|
+
- Variants: `solid`, `outlined`, `flat`, `light`, `faded`
|
|
176
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
177
|
+
- Supports start/end content, close button, and selection state
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Chip } onPress={() => console.log('Chip pressed')}>
|
|
181
|
+
Tag Label
|
|
182
|
+
</Chip>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### `Divider`
|
|
186
|
+
|
|
187
|
+
- Orientations: `horizontal`, `vertical`
|
|
188
|
+
- Supports custom color and size
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { Divider } from '@xaui/native/divider'
|
|
192
|
+
|
|
193
|
+
<Divider orientation="horizontal" size={2} />
|
|
194
|
+
<Divider orientation="vertical" size={1} color="#E5E7EB" />
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### `Radio` & `RadioGroup`
|
|
198
|
+
|
|
199
|
+
- Variants: `solid`, `outlined`, `flat`
|
|
200
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
201
|
+
- Group support with controlled state
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { Radio, RadioGroup } from '@xaui/native/radio'
|
|
205
|
+
|
|
206
|
+
;<RadioGroup value={selected} onValueChange={setSelected}>
|
|
207
|
+
<Radio value="option1" themeColor="primary">
|
|
208
|
+
Option 1
|
|
209
|
+
</Radio>
|
|
210
|
+
<Radio value="option2" themeColor="primary">
|
|
211
|
+
Option 2
|
|
212
|
+
</Radio>
|
|
213
|
+
</RadioGroup>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### `Switch`
|
|
217
|
+
|
|
218
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
219
|
+
- Supports icons inside the thumb
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import { Switch } from '@xaui/native/switch'
|
|
223
|
+
|
|
224
|
+
;<Switch
|
|
225
|
+
isSelected={isEnabled}
|
|
226
|
+
onValueChange={setIsEnabled}
|
|
227
|
+
size="md"
|
|
228
|
+
themeColor="success"
|
|
229
|
+
/>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### View Components
|
|
233
|
+
|
|
234
|
+
#### `Center`
|
|
235
|
+
|
|
236
|
+
Centers its child both vertically and horizontally.
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import { Center } from '@xaui/native/center'
|
|
240
|
+
|
|
241
|
+
;<Center style={{ flex: 1 }}>
|
|
242
|
+
<Text>Centered content</Text>
|
|
243
|
+
</Center>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### `Column` & `Row`
|
|
247
|
+
|
|
248
|
+
Flexbox layout helpers with Flutter-like API.
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
import { Column, Row } from '@xaui/native/view'
|
|
252
|
+
|
|
253
|
+
<Column mainAxisAlignment="center" crossAxisAlignment="stretch" gap={16}>
|
|
254
|
+
<Text>Item 1</Text>
|
|
255
|
+
<Text>Item 2</Text>
|
|
256
|
+
</Column>
|
|
257
|
+
|
|
258
|
+
<Row mainAxisAlignment="space-between" crossAxisAlignment="center">
|
|
259
|
+
<Text>Left</Text>
|
|
260
|
+
<Text>Right</Text>
|
|
261
|
+
</Row>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### `Spacer` & `SizedBox`
|
|
265
|
+
|
|
266
|
+
Utility components for spacing.
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
import { Spacer, SizedBox } from '@xaui/native/view'
|
|
270
|
+
|
|
271
|
+
<Row>
|
|
272
|
+
<Text>Left</Text>
|
|
273
|
+
<Spacer />
|
|
274
|
+
<Text>Right</Text>
|
|
275
|
+
</Row>
|
|
276
|
+
|
|
277
|
+
<SizedBox height={20} width={10} />
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### `RoundedView`
|
|
281
|
+
|
|
282
|
+
View with rounded corners and optional border.
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import { RoundedView } from '@xaui/native/rounded-view'
|
|
286
|
+
|
|
287
|
+
;<RoundedView borderRadius={16} borderWidth={2} borderColor="#E5E7EB" padding={20}>
|
|
288
|
+
<Text>Content with rounded corners</Text>
|
|
289
|
+
</RoundedView>
|
|
290
|
+
```
|
|
291
|
+
|
|
99
292
|
## Theme hooks & utilities
|
|
100
293
|
|
|
101
294
|
- `useXUITheme()` must be used within `XUIProvider`; it throws if the provider is missing.
|
package/dist/alert/index.js
CHANGED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/app-bar/index.ts
|
|
31
|
+
var app_bar_exports = {};
|
|
32
|
+
__export(app_bar_exports, {
|
|
33
|
+
AppBar: () => AppBar,
|
|
34
|
+
AppBarContent: () => AppBarContent,
|
|
35
|
+
AppBarEndContent: () => AppBarEndContent,
|
|
36
|
+
AppBarStartContent: () => AppBarStartContent
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(app_bar_exports);
|
|
39
|
+
|
|
40
|
+
// src/components/app-bar/app-bar.tsx
|
|
41
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
42
|
+
var import_react_native5 = require("react-native");
|
|
43
|
+
var import_core2 = require("@xaui/core");
|
|
44
|
+
|
|
45
|
+
// src/core/theme-context.tsx
|
|
46
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
47
|
+
var import_react_native2 = require("react-native");
|
|
48
|
+
var import_theme = require("@xaui/core/theme");
|
|
49
|
+
var import_palette = require("@xaui/core/palette");
|
|
50
|
+
|
|
51
|
+
// src/core/portal/portal.tsx
|
|
52
|
+
var import_react2 = require("react");
|
|
53
|
+
|
|
54
|
+
// src/core/portal/portal-context.ts
|
|
55
|
+
var import_react = require("react");
|
|
56
|
+
var PortalContext = (0, import_react.createContext)(null);
|
|
57
|
+
|
|
58
|
+
// src/core/portal/portal-host.tsx
|
|
59
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
60
|
+
var import_react_native = require("react-native");
|
|
61
|
+
var hostStyles = import_react_native.StyleSheet.create({
|
|
62
|
+
container: {
|
|
63
|
+
flex: 1
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// src/core/theme-context.tsx
|
|
68
|
+
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
69
|
+
|
|
70
|
+
// src/core/theme-hooks.ts
|
|
71
|
+
var import_react5 = require("react");
|
|
72
|
+
var import_react_native3 = require("react-native");
|
|
73
|
+
function useXUITheme() {
|
|
74
|
+
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
75
|
+
if (!theme) {
|
|
76
|
+
throw new Error("useXUITheme must be used within XUIProvider");
|
|
77
|
+
}
|
|
78
|
+
return theme;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/core/index.ts
|
|
82
|
+
var import_theme2 = require("@xaui/core/theme");
|
|
83
|
+
|
|
84
|
+
// src/components/app-bar/app-bar.hook.ts
|
|
85
|
+
var import_react6 = require("react");
|
|
86
|
+
var resolveShadowStyle = (elevation, shadows) => {
|
|
87
|
+
if (elevation <= 1) {
|
|
88
|
+
return shadows.sm;
|
|
89
|
+
}
|
|
90
|
+
if (elevation <= 2) {
|
|
91
|
+
return shadows.md;
|
|
92
|
+
}
|
|
93
|
+
if (elevation <= 3) {
|
|
94
|
+
return shadows.lg;
|
|
95
|
+
}
|
|
96
|
+
return shadows.xl;
|
|
97
|
+
};
|
|
98
|
+
var useAppBarElevationStyles = (elevation = 0) => {
|
|
99
|
+
const theme = useXUITheme();
|
|
100
|
+
return (0, import_react6.useMemo)(() => {
|
|
101
|
+
if (elevation <= 0) {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
...resolveShadowStyle(elevation, theme.shadows),
|
|
106
|
+
elevation
|
|
107
|
+
};
|
|
108
|
+
}, [elevation, theme.shadows]);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// src/components/app-bar/app-bar.style.ts
|
|
112
|
+
var import_react_native4 = require("react-native");
|
|
113
|
+
var styles = import_react_native4.StyleSheet.create({
|
|
114
|
+
container: {
|
|
115
|
+
width: "100%"
|
|
116
|
+
},
|
|
117
|
+
floatingContainer: {
|
|
118
|
+
paddingHorizontal: 16,
|
|
119
|
+
paddingVertical: 8
|
|
120
|
+
},
|
|
121
|
+
appBar: {
|
|
122
|
+
minHeight: 64,
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
paddingHorizontal: 16
|
|
126
|
+
},
|
|
127
|
+
docked: {
|
|
128
|
+
width: "100%",
|
|
129
|
+
borderRadius: 0
|
|
130
|
+
},
|
|
131
|
+
floating: {
|
|
132
|
+
width: "92%",
|
|
133
|
+
borderRadius: 9999,
|
|
134
|
+
alignSelf: "center"
|
|
135
|
+
},
|
|
136
|
+
startContent: {
|
|
137
|
+
flexShrink: 0,
|
|
138
|
+
flexDirection: "row",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
gap: 8,
|
|
141
|
+
minWidth: 40
|
|
142
|
+
},
|
|
143
|
+
content: {
|
|
144
|
+
flex: 1,
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
justifyContent: "center",
|
|
147
|
+
paddingHorizontal: 12
|
|
148
|
+
},
|
|
149
|
+
endContent: {
|
|
150
|
+
flexShrink: 0,
|
|
151
|
+
flexDirection: "row",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
justifyContent: "flex-end",
|
|
154
|
+
gap: 8,
|
|
155
|
+
minWidth: 40
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// src/components/app-bar/app-bar.tsx
|
|
160
|
+
var AppBar = ({
|
|
161
|
+
variant = "docked",
|
|
162
|
+
elevation = 0,
|
|
163
|
+
themeColor = "default",
|
|
164
|
+
children,
|
|
165
|
+
style
|
|
166
|
+
}) => {
|
|
167
|
+
const theme = useXUITheme();
|
|
168
|
+
const elevationStyles = useAppBarElevationStyles(elevation);
|
|
169
|
+
const isFloating = variant === "floating";
|
|
170
|
+
const safeThemeColor = (0, import_core2.getSafeThemeColor)(themeColor);
|
|
171
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
172
|
+
const isDefaultThemeColor = safeThemeColor === "default";
|
|
173
|
+
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : "#FFFFFF" : colorScheme.background;
|
|
174
|
+
const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
|
|
175
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ import_react7.default.createElement(
|
|
176
|
+
import_react_native5.View,
|
|
177
|
+
{
|
|
178
|
+
style: [
|
|
179
|
+
styles.appBar,
|
|
180
|
+
isFloating ? styles.floating : styles.docked,
|
|
181
|
+
{
|
|
182
|
+
backgroundColor,
|
|
183
|
+
borderBottomWidth: isFloating ? 0 : 1,
|
|
184
|
+
borderBottomColor
|
|
185
|
+
},
|
|
186
|
+
elevationStyles,
|
|
187
|
+
style
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
children
|
|
191
|
+
));
|
|
192
|
+
};
|
|
193
|
+
var AppBarStartContent = ({
|
|
194
|
+
children,
|
|
195
|
+
style
|
|
196
|
+
}) => {
|
|
197
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.startContent, style] }, children);
|
|
198
|
+
};
|
|
199
|
+
var AppBarContent = ({
|
|
200
|
+
children,
|
|
201
|
+
style
|
|
202
|
+
}) => {
|
|
203
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.content, style] }, children);
|
|
204
|
+
};
|
|
205
|
+
var AppBarEndContent = ({
|
|
206
|
+
children,
|
|
207
|
+
style
|
|
208
|
+
}) => {
|
|
209
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.endContent, style] }, children);
|
|
210
|
+
};
|
|
211
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
212
|
+
0 && (module.exports = {
|
|
213
|
+
AppBar,
|
|
214
|
+
AppBarContent,
|
|
215
|
+
AppBarEndContent,
|
|
216
|
+
AppBarStartContent
|
|
217
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
4
|
+
|
|
5
|
+
type AppBarVariant = 'docked' | 'floating';
|
|
6
|
+
type AppBarProps = {
|
|
7
|
+
/**
|
|
8
|
+
* AppBar layout variant.
|
|
9
|
+
* - docked: full-width app bar
|
|
10
|
+
* - floating: rounded app bar that does not span full screen width
|
|
11
|
+
* @default 'docked'
|
|
12
|
+
*/
|
|
13
|
+
variant?: AppBarVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Elevation intensity.
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
elevation?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Theme color used for the app bar surface.
|
|
21
|
+
* @default 'default'
|
|
22
|
+
*/
|
|
23
|
+
themeColor?: ThemeColor;
|
|
24
|
+
/**
|
|
25
|
+
* AppBar content.
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Custom style for the app bar surface.
|
|
30
|
+
*/
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
};
|
|
33
|
+
type AppBarSlotProps = {
|
|
34
|
+
/**
|
|
35
|
+
* Slot content.
|
|
36
|
+
*/
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Custom style for this slot.
|
|
40
|
+
*/
|
|
41
|
+
style?: StyleProp<ViewStyle>;
|
|
42
|
+
};
|
|
43
|
+
type AppBarStartContentProps = AppBarSlotProps;
|
|
44
|
+
type AppBarContentProps = AppBarSlotProps;
|
|
45
|
+
type AppBarEndContentProps = AppBarSlotProps;
|
|
46
|
+
|
|
47
|
+
declare const AppBar: React.FC<AppBarProps>;
|
|
48
|
+
declare const AppBarStartContent: React.FC<AppBarStartContentProps>;
|
|
49
|
+
declare const AppBarContent: React.FC<AppBarContentProps>;
|
|
50
|
+
declare const AppBarEndContent: React.FC<AppBarEndContentProps>;
|
|
51
|
+
|
|
52
|
+
export { AppBar, AppBarContent, type AppBarContentProps, AppBarEndContent, type AppBarEndContentProps, type AppBarProps, type AppBarSlotProps, AppBarStartContent, type AppBarStartContentProps, type AppBarVariant };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
4
|
+
|
|
5
|
+
type AppBarVariant = 'docked' | 'floating';
|
|
6
|
+
type AppBarProps = {
|
|
7
|
+
/**
|
|
8
|
+
* AppBar layout variant.
|
|
9
|
+
* - docked: full-width app bar
|
|
10
|
+
* - floating: rounded app bar that does not span full screen width
|
|
11
|
+
* @default 'docked'
|
|
12
|
+
*/
|
|
13
|
+
variant?: AppBarVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Elevation intensity.
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
elevation?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Theme color used for the app bar surface.
|
|
21
|
+
* @default 'default'
|
|
22
|
+
*/
|
|
23
|
+
themeColor?: ThemeColor;
|
|
24
|
+
/**
|
|
25
|
+
* AppBar content.
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Custom style for the app bar surface.
|
|
30
|
+
*/
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
};
|
|
33
|
+
type AppBarSlotProps = {
|
|
34
|
+
/**
|
|
35
|
+
* Slot content.
|
|
36
|
+
*/
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Custom style for this slot.
|
|
40
|
+
*/
|
|
41
|
+
style?: StyleProp<ViewStyle>;
|
|
42
|
+
};
|
|
43
|
+
type AppBarStartContentProps = AppBarSlotProps;
|
|
44
|
+
type AppBarContentProps = AppBarSlotProps;
|
|
45
|
+
type AppBarEndContentProps = AppBarSlotProps;
|
|
46
|
+
|
|
47
|
+
declare const AppBar: React.FC<AppBarProps>;
|
|
48
|
+
declare const AppBarStartContent: React.FC<AppBarStartContentProps>;
|
|
49
|
+
declare const AppBarContent: React.FC<AppBarContentProps>;
|
|
50
|
+
declare const AppBarEndContent: React.FC<AppBarEndContentProps>;
|
|
51
|
+
|
|
52
|
+
export { AppBar, AppBarContent, type AppBarContentProps, AppBarEndContent, type AppBarEndContentProps, type AppBarProps, type AppBarSlotProps, AppBarStartContent, type AppBarStartContentProps, type AppBarVariant };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useXUITheme
|
|
3
|
+
} from "../chunk-4KSZLONZ.js";
|
|
4
|
+
|
|
5
|
+
// src/components/app-bar/app-bar.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View } from "react-native";
|
|
8
|
+
import { getSafeThemeColor } from "@xaui/core";
|
|
9
|
+
|
|
10
|
+
// src/components/app-bar/app-bar.hook.ts
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
var resolveShadowStyle = (elevation, shadows) => {
|
|
13
|
+
if (elevation <= 1) {
|
|
14
|
+
return shadows.sm;
|
|
15
|
+
}
|
|
16
|
+
if (elevation <= 2) {
|
|
17
|
+
return shadows.md;
|
|
18
|
+
}
|
|
19
|
+
if (elevation <= 3) {
|
|
20
|
+
return shadows.lg;
|
|
21
|
+
}
|
|
22
|
+
return shadows.xl;
|
|
23
|
+
};
|
|
24
|
+
var useAppBarElevationStyles = (elevation = 0) => {
|
|
25
|
+
const theme = useXUITheme();
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
if (elevation <= 0) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
...resolveShadowStyle(elevation, theme.shadows),
|
|
32
|
+
elevation
|
|
33
|
+
};
|
|
34
|
+
}, [elevation, theme.shadows]);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/components/app-bar/app-bar.style.ts
|
|
38
|
+
import { StyleSheet } from "react-native";
|
|
39
|
+
var styles = StyleSheet.create({
|
|
40
|
+
container: {
|
|
41
|
+
width: "100%"
|
|
42
|
+
},
|
|
43
|
+
floatingContainer: {
|
|
44
|
+
paddingHorizontal: 16,
|
|
45
|
+
paddingVertical: 8
|
|
46
|
+
},
|
|
47
|
+
appBar: {
|
|
48
|
+
minHeight: 64,
|
|
49
|
+
flexDirection: "row",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
paddingHorizontal: 16
|
|
52
|
+
},
|
|
53
|
+
docked: {
|
|
54
|
+
width: "100%",
|
|
55
|
+
borderRadius: 0
|
|
56
|
+
},
|
|
57
|
+
floating: {
|
|
58
|
+
width: "92%",
|
|
59
|
+
borderRadius: 9999,
|
|
60
|
+
alignSelf: "center"
|
|
61
|
+
},
|
|
62
|
+
startContent: {
|
|
63
|
+
flexShrink: 0,
|
|
64
|
+
flexDirection: "row",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
gap: 8,
|
|
67
|
+
minWidth: 40
|
|
68
|
+
},
|
|
69
|
+
content: {
|
|
70
|
+
flex: 1,
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
paddingHorizontal: 12
|
|
74
|
+
},
|
|
75
|
+
endContent: {
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
flexDirection: "row",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "flex-end",
|
|
80
|
+
gap: 8,
|
|
81
|
+
minWidth: 40
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// src/components/app-bar/app-bar.tsx
|
|
86
|
+
var AppBar = ({
|
|
87
|
+
variant = "docked",
|
|
88
|
+
elevation = 0,
|
|
89
|
+
themeColor = "default",
|
|
90
|
+
children,
|
|
91
|
+
style
|
|
92
|
+
}) => {
|
|
93
|
+
const theme = useXUITheme();
|
|
94
|
+
const elevationStyles = useAppBarElevationStyles(elevation);
|
|
95
|
+
const isFloating = variant === "floating";
|
|
96
|
+
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
97
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
98
|
+
const isDefaultThemeColor = safeThemeColor === "default";
|
|
99
|
+
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : "#FFFFFF" : colorScheme.background;
|
|
100
|
+
const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
|
|
101
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ React.createElement(
|
|
102
|
+
View,
|
|
103
|
+
{
|
|
104
|
+
style: [
|
|
105
|
+
styles.appBar,
|
|
106
|
+
isFloating ? styles.floating : styles.docked,
|
|
107
|
+
{
|
|
108
|
+
backgroundColor,
|
|
109
|
+
borderBottomWidth: isFloating ? 0 : 1,
|
|
110
|
+
borderBottomColor
|
|
111
|
+
},
|
|
112
|
+
elevationStyles,
|
|
113
|
+
style
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
children
|
|
117
|
+
));
|
|
118
|
+
};
|
|
119
|
+
var AppBarStartContent = ({
|
|
120
|
+
children,
|
|
121
|
+
style
|
|
122
|
+
}) => {
|
|
123
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.startContent, style] }, children);
|
|
124
|
+
};
|
|
125
|
+
var AppBarContent = ({
|
|
126
|
+
children,
|
|
127
|
+
style
|
|
128
|
+
}) => {
|
|
129
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.content, style] }, children);
|
|
130
|
+
};
|
|
131
|
+
var AppBarEndContent = ({
|
|
132
|
+
children,
|
|
133
|
+
style
|
|
134
|
+
}) => {
|
|
135
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.endContent, style] }, children);
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
AppBar,
|
|
139
|
+
AppBarContent,
|
|
140
|
+
AppBarEndContent,
|
|
141
|
+
AppBarStartContent
|
|
142
|
+
};
|