@xaui/native 0.0.8 → 0.0.9
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/dist/accordion/index.cjs +86 -68
- package/dist/accordion/index.js +2 -2
- package/dist/autocomplete/index.cjs +1503 -0
- package/dist/autocomplete/index.d.cts +70 -0
- package/dist/autocomplete/index.d.ts +70 -0
- package/dist/autocomplete/index.js +11 -0
- package/dist/button/index.cjs +87 -69
- package/dist/button/index.js +2 -2
- package/dist/checkbox/index.cjs +48 -30
- package/dist/checkbox/index.js +1 -1
- package/dist/{chunk-B2VGVZ3J.js → chunk-63LRW4QD.js} +1 -1
- package/dist/chunk-6HUSEZDJ.js +1138 -0
- package/dist/chunk-7LXW4BXD.js +606 -0
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/{chunk-R34CVLCX.js → chunk-GNJIET26.js} +1 -1
- package/dist/chunk-NBRASCX4.js +145 -0
- package/dist/chunk-ZYTBRHLJ.js +150 -0
- package/dist/core/index.cjs +68 -10
- package/dist/core/index.d.cts +9 -1
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.js +5 -1
- package/dist/divider/index.cjs +31 -13
- package/dist/divider/index.js +2 -2
- package/dist/icon/index.cjs +680 -0
- package/dist/icon/index.d.cts +36 -0
- package/dist/icon/index.d.ts +36 -0
- package/dist/icon/index.js +13 -0
- package/dist/index.cjs +1641 -53
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -4
- package/dist/indicator/index.cjs +60 -42
- package/dist/indicator/index.js +2 -2
- package/dist/progress/index.cjs +45 -27
- package/dist/progress/index.js +1 -1
- package/dist/select/index.cjs +107 -89
- package/dist/select/index.js +10 -23
- package/dist/switch/index.cjs +58 -40
- package/dist/switch/index.js +1 -1
- package/dist/typography/index.cjs +223 -0
- package/dist/typography/index.d.cts +43 -0
- package/dist/typography/index.d.ts +43 -0
- package/dist/typography/index.js +7 -0
- package/dist/view/index.cjs +8 -2
- package/dist/view/index.d.cts +11 -1
- package/dist/view/index.d.ts +11 -1
- package/dist/view/index.js +8 -2
- package/package.json +16 -1
- package/dist/chunk-ORMNMNOK.js +0 -89
package/dist/checkbox/index.cjs
CHANGED
|
@@ -35,8 +35,8 @@ __export(checkbox_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(checkbox_exports);
|
|
36
36
|
|
|
37
37
|
// src/components/checkbox/checkbox.tsx
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
39
|
+
var import_react_native7 = require("react-native");
|
|
40
40
|
|
|
41
41
|
// src/components/checkbox/checkbox-icon.tsx
|
|
42
42
|
var import_react = __toESM(require("react"), 1);
|
|
@@ -182,21 +182,39 @@ function CheckboxIcon({ isIndeterminate, variant, ...props }) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// src/components/checkbox/checkbox.hook.ts
|
|
185
|
-
var
|
|
185
|
+
var import_react7 = require("react");
|
|
186
186
|
var import_core = require("@xaui/core");
|
|
187
187
|
|
|
188
188
|
// src/core/theme-context.tsx
|
|
189
|
-
var
|
|
190
|
-
var
|
|
189
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
190
|
+
var import_react_native4 = require("react-native");
|
|
191
191
|
var import_theme = require("@xaui/core/theme");
|
|
192
192
|
var import_palette = require("@xaui/core/palette");
|
|
193
|
-
var XUIThemeContext = (0, import_react2.createContext)(null);
|
|
194
193
|
|
|
195
|
-
// src/core/
|
|
194
|
+
// src/core/portal/portal.tsx
|
|
196
195
|
var import_react3 = require("react");
|
|
197
|
-
|
|
196
|
+
|
|
197
|
+
// src/core/portal/portal-context.ts
|
|
198
|
+
var import_react2 = require("react");
|
|
199
|
+
var PortalContext = (0, import_react2.createContext)(null);
|
|
200
|
+
|
|
201
|
+
// src/core/portal/portal-host.tsx
|
|
202
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
203
|
+
var import_react_native3 = require("react-native");
|
|
204
|
+
var hostStyles = import_react_native3.StyleSheet.create({
|
|
205
|
+
container: {
|
|
206
|
+
flex: 1
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// src/core/theme-context.tsx
|
|
211
|
+
var XUIThemeContext = (0, import_react5.createContext)(null);
|
|
212
|
+
|
|
213
|
+
// src/core/theme-hooks.ts
|
|
214
|
+
var import_react6 = require("react");
|
|
215
|
+
var import_react_native5 = require("react-native");
|
|
198
216
|
function useXUITheme() {
|
|
199
|
-
const theme = (0,
|
|
217
|
+
const theme = (0, import_react6.useContext)(XUIThemeContext);
|
|
200
218
|
if (!theme) {
|
|
201
219
|
throw new Error("useXUITheme must be used within XUIProvider");
|
|
202
220
|
}
|
|
@@ -209,7 +227,7 @@ var import_theme2 = require("@xaui/core/theme");
|
|
|
209
227
|
// src/components/checkbox/checkbox.hook.ts
|
|
210
228
|
function useSizeStyles(size, variant) {
|
|
211
229
|
const theme = useXUITheme();
|
|
212
|
-
const sizeStyles = (0,
|
|
230
|
+
const sizeStyles = (0, import_react7.useMemo)(() => {
|
|
213
231
|
const sizes = {
|
|
214
232
|
xs: {
|
|
215
233
|
checkboxSize: 14,
|
|
@@ -238,7 +256,7 @@ function useSizeStyles(size, variant) {
|
|
|
238
256
|
}
|
|
239
257
|
function useRadiusStyles(radius) {
|
|
240
258
|
const theme = useXUITheme();
|
|
241
|
-
const radiusStyles = (0,
|
|
259
|
+
const radiusStyles = (0, import_react7.useMemo)(() => {
|
|
242
260
|
const radii = {
|
|
243
261
|
none: theme.borderRadius.none,
|
|
244
262
|
sm: theme.borderRadius.sm,
|
|
@@ -254,7 +272,7 @@ function useCheckmarkColors(themeColor, variant, isActive) {
|
|
|
254
272
|
const theme = useXUITheme();
|
|
255
273
|
const safeThemeColor = (0, import_core.getSafeThemeColor)(themeColor);
|
|
256
274
|
const colorScheme = theme.colors[safeThemeColor];
|
|
257
|
-
const checkmarkColors = (0,
|
|
275
|
+
const checkmarkColors = (0, import_react7.useMemo)(() => {
|
|
258
276
|
if (variant === "filled") {
|
|
259
277
|
return {
|
|
260
278
|
checked: colorScheme.foreground,
|
|
@@ -284,7 +302,7 @@ function useVariantStyles(themeColor, variant, isActive) {
|
|
|
284
302
|
const theme = useXUITheme();
|
|
285
303
|
const safeThemeColor = (0, import_core.getSafeThemeColor)(themeColor);
|
|
286
304
|
const colorScheme = theme.colors[safeThemeColor];
|
|
287
|
-
const variantStyles = (0,
|
|
305
|
+
const variantStyles = (0, import_react7.useMemo)(() => {
|
|
288
306
|
if (variant === "filled") {
|
|
289
307
|
return {
|
|
290
308
|
backgroundColor: "transparent",
|
|
@@ -301,7 +319,7 @@ function useVariantStyles(themeColor, variant, isActive) {
|
|
|
301
319
|
return variantStyles;
|
|
302
320
|
}
|
|
303
321
|
function useContainerStyles(labelAlignment) {
|
|
304
|
-
const containerStyles = (0,
|
|
322
|
+
const containerStyles = (0, import_react7.useMemo)(() => {
|
|
305
323
|
const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
|
|
306
324
|
return {
|
|
307
325
|
flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
|
|
@@ -312,8 +330,8 @@ function useContainerStyles(labelAlignment) {
|
|
|
312
330
|
}
|
|
313
331
|
|
|
314
332
|
// src/components/checkbox/checkbox.style.ts
|
|
315
|
-
var
|
|
316
|
-
var styles =
|
|
333
|
+
var import_react_native6 = require("react-native");
|
|
334
|
+
var styles = import_react_native6.StyleSheet.create({
|
|
317
335
|
container: {
|
|
318
336
|
flexDirection: "row",
|
|
319
337
|
alignItems: "center",
|
|
@@ -371,18 +389,18 @@ var Checkbox = ({
|
|
|
371
389
|
const theme = useXUITheme();
|
|
372
390
|
const colorScheme = theme.colors[(0, import_core4.getSafeThemeColor)(themeColor)];
|
|
373
391
|
const isControlled = typeof isCheckedProp === "boolean";
|
|
374
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
392
|
+
const [internalChecked, setInternalChecked] = (0, import_react8.useState)(isCheckedProp ?? false);
|
|
375
393
|
const isChecked = isControlled ? isCheckedProp : internalChecked;
|
|
376
|
-
const scale = (0,
|
|
377
|
-
const backgroundScale = (0,
|
|
378
|
-
const backgroundOpacity = (0,
|
|
394
|
+
const scale = (0, import_react8.useRef)(new import_react_native7.Animated.Value(1)).current;
|
|
395
|
+
const backgroundScale = (0, import_react8.useRef)(new import_react_native7.Animated.Value(0.5)).current;
|
|
396
|
+
const backgroundOpacity = (0, import_react8.useRef)(new import_react_native7.Animated.Value(0)).current;
|
|
379
397
|
const isActive = isChecked || isIndeterminate;
|
|
380
398
|
const sizeStyles = useSizeStyles(size, variant);
|
|
381
399
|
const radiusStyles = useRadiusStyles(radius);
|
|
382
400
|
const checkmarkColors = useCheckmarkColors(themeColor, variant, isActive);
|
|
383
401
|
const variantStyles = useVariantStyles(themeColor, variant, isActive);
|
|
384
402
|
const containerStyles = useContainerStyles(labelAlignment);
|
|
385
|
-
(0,
|
|
403
|
+
(0, import_react8.useEffect)(() => {
|
|
386
404
|
if (variant !== "filled") return;
|
|
387
405
|
if (isActive) {
|
|
388
406
|
runBackgroundInAnimation(backgroundScale, backgroundOpacity);
|
|
@@ -410,8 +428,8 @@ var Checkbox = ({
|
|
|
410
428
|
}
|
|
411
429
|
};
|
|
412
430
|
const accessibilityChecked = isIndeterminate ? "mixed" : isChecked;
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
|
|
431
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
432
|
+
import_react_native7.Pressable,
|
|
415
433
|
{
|
|
416
434
|
onPress: handlePress,
|
|
417
435
|
onPressIn: handlePressIn,
|
|
@@ -432,8 +450,8 @@ var Checkbox = ({
|
|
|
432
450
|
style
|
|
433
451
|
]
|
|
434
452
|
},
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
|
|
453
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
454
|
+
import_react_native7.Animated.View,
|
|
437
455
|
{
|
|
438
456
|
style: [
|
|
439
457
|
styles.checkbox,
|
|
@@ -448,8 +466,8 @@ var Checkbox = ({
|
|
|
448
466
|
}
|
|
449
467
|
]
|
|
450
468
|
},
|
|
451
|
-
variant === "filled" && /* @__PURE__ */
|
|
452
|
-
|
|
469
|
+
variant === "filled" && /* @__PURE__ */ import_react8.default.createElement(
|
|
470
|
+
import_react_native7.Animated.View,
|
|
453
471
|
{
|
|
454
472
|
style: [
|
|
455
473
|
styles.background,
|
|
@@ -462,7 +480,7 @@ var Checkbox = ({
|
|
|
462
480
|
]
|
|
463
481
|
}
|
|
464
482
|
),
|
|
465
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ import_react8.default.createElement(import_react_native7.View, { style: styles.checkmarkContainer }, /* @__PURE__ */ import_react8.default.createElement(
|
|
466
484
|
CheckboxIcon,
|
|
467
485
|
{
|
|
468
486
|
isChecked: isActive,
|
|
@@ -474,8 +492,8 @@ var Checkbox = ({
|
|
|
474
492
|
}
|
|
475
493
|
))
|
|
476
494
|
),
|
|
477
|
-
label && /* @__PURE__ */
|
|
478
|
-
|
|
495
|
+
label && /* @__PURE__ */ import_react8.default.createElement(
|
|
496
|
+
import_react_native7.Text,
|
|
479
497
|
{
|
|
480
498
|
style: [
|
|
481
499
|
styles.label,
|
package/dist/checkbox/index.js
CHANGED