@onlynative/components 0.1.0-alpha.3 → 0.1.0
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/appbar/index.js +54 -122
- package/dist/button/index.js +31 -120
- package/dist/card/index.js +20 -89
- package/dist/checkbox/index.js +10 -75
- package/dist/chip/index.js +29 -118
- package/dist/icon-button/index.js +32 -97
- package/dist/index.d.ts +1 -0
- package/dist/index.js +461 -474
- package/dist/keyboard-avoiding-wrapper/index.d.ts +36 -0
- package/dist/keyboard-avoiding-wrapper/index.js +98 -0
- package/dist/list/index.js +5 -50
- package/dist/radio/index.js +8 -35
- package/dist/switch/index.js +12 -77
- package/dist/text-field/index.js +25 -78
- package/package.json +13 -3
- package/src/appbar/AppBar.tsx +1 -1
- package/src/button/Button.tsx +1 -1
- package/src/button/styles.ts +1 -2
- package/src/card/styles.ts +1 -2
- package/src/checkbox/Checkbox.tsx +1 -1
- package/src/checkbox/styles.ts +1 -1
- package/src/chip/Chip.tsx +1 -1
- package/src/chip/styles.ts +1 -2
- package/src/icon-button/IconButton.tsx +5 -2
- package/src/icon-button/styles.ts +1 -1
- package/src/index.ts +3 -0
- package/src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx +69 -0
- package/src/keyboard-avoiding-wrapper/index.ts +2 -0
- package/src/keyboard-avoiding-wrapper/styles.ts +10 -0
- package/src/keyboard-avoiding-wrapper/types.ts +37 -0
- package/src/list/styles.ts +1 -1
- package/src/radio/styles.ts +1 -1
- package/src/switch/Switch.tsx +1 -1
- package/src/switch/styles.ts +1 -1
- package/src/text-field/TextField.tsx +1 -1
- package/src/text-field/styles.ts +1 -2
- package/src/typography/Typography.tsx +2 -0
- package/src/test-utils/render-with-theme.tsx +0 -13
- package/src/utils/color.ts +0 -64
- package/src/utils/elevation.ts +0 -33
- package/src/utils/icon.ts +0 -30
- package/src/utils/rtl.ts +0 -19
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
Column: () => Column,
|
|
40
40
|
Grid: () => Grid,
|
|
41
41
|
IconButton: () => IconButton,
|
|
42
|
+
KeyboardAvoidingWrapper: () => KeyboardAvoidingWrapper,
|
|
42
43
|
Layout: () => Layout,
|
|
43
44
|
List: () => List,
|
|
44
45
|
ListDivider: () => ListDivider,
|
|
@@ -337,119 +338,30 @@ function Grid({
|
|
|
337
338
|
|
|
338
339
|
// src/button/Button.tsx
|
|
339
340
|
var import_react7 = require("react");
|
|
341
|
+
var import_react_native6 = require("react-native");
|
|
340
342
|
var import_react_native7 = require("react-native");
|
|
341
343
|
var import_react_native8 = require("react-native");
|
|
342
|
-
var import_react_native9 = require("react-native");
|
|
343
344
|
var import_core5 = require("@onlynative/core");
|
|
344
|
-
|
|
345
|
-
// src/utils/icon.ts
|
|
346
|
-
var _MCIcons = null;
|
|
347
|
-
var _resolved = false;
|
|
348
|
-
function getMaterialCommunityIcons() {
|
|
349
|
-
if (!_resolved) {
|
|
350
|
-
_resolved = true;
|
|
351
|
-
try {
|
|
352
|
-
const mod = require("@expo/vector-icons/MaterialCommunityIcons");
|
|
353
|
-
_MCIcons = mod.default || mod;
|
|
354
|
-
} catch {
|
|
355
|
-
_MCIcons = null;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (!_MCIcons) {
|
|
359
|
-
throw new Error(
|
|
360
|
-
"@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
return _MCIcons;
|
|
364
|
-
}
|
|
345
|
+
var import_utils2 = require("@onlynative/utils");
|
|
365
346
|
|
|
366
347
|
// src/button/styles.ts
|
|
367
|
-
var import_react_native6 = require("react-native");
|
|
368
|
-
|
|
369
|
-
// src/utils/color.ts
|
|
370
|
-
function parseHexColor(color) {
|
|
371
|
-
const normalized = color.replace("#", "");
|
|
372
|
-
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
373
|
-
return null;
|
|
374
|
-
}
|
|
375
|
-
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
376
|
-
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
377
|
-
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
378
|
-
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
379
|
-
return null;
|
|
380
|
-
}
|
|
381
|
-
return { r, g, b };
|
|
382
|
-
}
|
|
383
|
-
function clampAlpha(alpha) {
|
|
384
|
-
return Math.max(0, Math.min(1, alpha));
|
|
385
|
-
}
|
|
386
|
-
function alphaColor(color, alpha) {
|
|
387
|
-
const channels = parseHexColor(color);
|
|
388
|
-
const boundedAlpha = clampAlpha(alpha);
|
|
389
|
-
if (!channels) {
|
|
390
|
-
return color;
|
|
391
|
-
}
|
|
392
|
-
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
393
|
-
}
|
|
394
|
-
function blendColor(base, overlay, overlayAlpha) {
|
|
395
|
-
const baseChannels = parseHexColor(base);
|
|
396
|
-
const overlayChannels = parseHexColor(overlay);
|
|
397
|
-
const boundedAlpha = clampAlpha(overlayAlpha);
|
|
398
|
-
if (!baseChannels || !overlayChannels) {
|
|
399
|
-
return alphaColor(overlay, boundedAlpha);
|
|
400
|
-
}
|
|
401
|
-
const r = Math.round(
|
|
402
|
-
(1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
|
|
403
|
-
);
|
|
404
|
-
const g = Math.round(
|
|
405
|
-
(1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
|
|
406
|
-
);
|
|
407
|
-
const b = Math.round(
|
|
408
|
-
(1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
|
|
409
|
-
);
|
|
410
|
-
return `rgb(${r}, ${g}, ${b})`;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// src/utils/elevation.ts
|
|
414
348
|
var import_react_native5 = require("react-native");
|
|
415
|
-
|
|
416
|
-
if (import_react_native5.Platform.OS === "web") {
|
|
417
|
-
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
418
|
-
if (shadowOpacity === 0) {
|
|
419
|
-
return { boxShadow: "none" };
|
|
420
|
-
}
|
|
421
|
-
return {
|
|
422
|
-
boxShadow: `${shadowOffset.width}px ${shadowOffset.height}px ${shadowRadius}px rgba(0, 0, 0, ${shadowOpacity})`
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
return {
|
|
426
|
-
shadowColor: level.shadowColor,
|
|
427
|
-
shadowOffset: {
|
|
428
|
-
width: level.shadowOffset.width,
|
|
429
|
-
height: level.shadowOffset.height
|
|
430
|
-
},
|
|
431
|
-
shadowOpacity: level.shadowOpacity,
|
|
432
|
-
shadowRadius: level.shadowRadius,
|
|
433
|
-
elevation: level.elevation
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// src/button/styles.ts
|
|
349
|
+
var import_utils = require("@onlynative/utils");
|
|
438
350
|
function getVariantColors(theme, variant) {
|
|
439
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
440
|
-
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
441
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
351
|
+
const disabledContainerColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
|
|
352
|
+
const disabledLabelColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.38);
|
|
353
|
+
const disabledOutlineColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
|
|
442
354
|
if (variant === "outlined") {
|
|
443
355
|
return {
|
|
444
356
|
backgroundColor: "transparent",
|
|
445
357
|
textColor: theme.colors.primary,
|
|
446
358
|
borderColor: theme.colors.outline,
|
|
447
359
|
borderWidth: 1,
|
|
448
|
-
hoveredBackgroundColor: alphaColor(
|
|
360
|
+
hoveredBackgroundColor: (0, import_utils.alphaColor)(
|
|
449
361
|
theme.colors.primary,
|
|
450
362
|
theme.stateLayer.hoveredOpacity
|
|
451
363
|
),
|
|
452
|
-
pressedBackgroundColor: alphaColor(
|
|
364
|
+
pressedBackgroundColor: (0, import_utils.alphaColor)(
|
|
453
365
|
theme.colors.primary,
|
|
454
366
|
theme.stateLayer.pressedOpacity
|
|
455
367
|
),
|
|
@@ -464,11 +376,11 @@ function getVariantColors(theme, variant) {
|
|
|
464
376
|
textColor: theme.colors.primary,
|
|
465
377
|
borderColor: "transparent",
|
|
466
378
|
borderWidth: 0,
|
|
467
|
-
hoveredBackgroundColor: alphaColor(
|
|
379
|
+
hoveredBackgroundColor: (0, import_utils.alphaColor)(
|
|
468
380
|
theme.colors.primary,
|
|
469
381
|
theme.stateLayer.hoveredOpacity
|
|
470
382
|
),
|
|
471
|
-
pressedBackgroundColor: alphaColor(
|
|
383
|
+
pressedBackgroundColor: (0, import_utils.alphaColor)(
|
|
472
384
|
theme.colors.primary,
|
|
473
385
|
theme.stateLayer.pressedOpacity
|
|
474
386
|
),
|
|
@@ -483,12 +395,12 @@ function getVariantColors(theme, variant) {
|
|
|
483
395
|
textColor: theme.colors.primary,
|
|
484
396
|
borderColor: theme.colors.surfaceContainerLow,
|
|
485
397
|
borderWidth: 0,
|
|
486
|
-
hoveredBackgroundColor: blendColor(
|
|
398
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
487
399
|
theme.colors.surfaceContainerLow,
|
|
488
400
|
theme.colors.primary,
|
|
489
401
|
theme.stateLayer.hoveredOpacity
|
|
490
402
|
),
|
|
491
|
-
pressedBackgroundColor: blendColor(
|
|
403
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
492
404
|
theme.colors.surfaceContainerLow,
|
|
493
405
|
theme.colors.primary,
|
|
494
406
|
theme.stateLayer.pressedOpacity
|
|
@@ -504,12 +416,12 @@ function getVariantColors(theme, variant) {
|
|
|
504
416
|
textColor: theme.colors.onSecondaryContainer,
|
|
505
417
|
borderColor: theme.colors.secondaryContainer,
|
|
506
418
|
borderWidth: 0,
|
|
507
|
-
hoveredBackgroundColor: blendColor(
|
|
419
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
508
420
|
theme.colors.secondaryContainer,
|
|
509
421
|
theme.colors.onSecondaryContainer,
|
|
510
422
|
theme.stateLayer.hoveredOpacity
|
|
511
423
|
),
|
|
512
|
-
pressedBackgroundColor: blendColor(
|
|
424
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
513
425
|
theme.colors.secondaryContainer,
|
|
514
426
|
theme.colors.onSecondaryContainer,
|
|
515
427
|
theme.stateLayer.pressedOpacity
|
|
@@ -524,12 +436,12 @@ function getVariantColors(theme, variant) {
|
|
|
524
436
|
textColor: theme.colors.onPrimary,
|
|
525
437
|
borderColor: theme.colors.primary,
|
|
526
438
|
borderWidth: 0,
|
|
527
|
-
hoveredBackgroundColor: blendColor(
|
|
439
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
528
440
|
theme.colors.primary,
|
|
529
441
|
theme.colors.onPrimary,
|
|
530
442
|
theme.stateLayer.hoveredOpacity
|
|
531
443
|
),
|
|
532
|
-
pressedBackgroundColor: blendColor(
|
|
444
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
533
445
|
theme.colors.primary,
|
|
534
446
|
theme.colors.onPrimary,
|
|
535
447
|
theme.stateLayer.pressedOpacity
|
|
@@ -561,33 +473,33 @@ function applyColorOverrides(theme, colors, containerColor, contentColor) {
|
|
|
561
473
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
562
474
|
result.backgroundColor = containerColor;
|
|
563
475
|
result.borderColor = containerColor;
|
|
564
|
-
result.hoveredBackgroundColor = blendColor(
|
|
476
|
+
result.hoveredBackgroundColor = (0, import_utils.blendColor)(
|
|
565
477
|
containerColor,
|
|
566
478
|
overlay,
|
|
567
479
|
theme.stateLayer.hoveredOpacity
|
|
568
480
|
);
|
|
569
|
-
result.pressedBackgroundColor = blendColor(
|
|
481
|
+
result.pressedBackgroundColor = (0, import_utils.blendColor)(
|
|
570
482
|
containerColor,
|
|
571
483
|
overlay,
|
|
572
484
|
theme.stateLayer.pressedOpacity
|
|
573
485
|
);
|
|
574
486
|
} else if (contentColor) {
|
|
575
487
|
if (colors.backgroundColor === "transparent") {
|
|
576
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
488
|
+
result.hoveredBackgroundColor = (0, import_utils.alphaColor)(
|
|
577
489
|
contentColor,
|
|
578
490
|
theme.stateLayer.hoveredOpacity
|
|
579
491
|
);
|
|
580
|
-
result.pressedBackgroundColor = alphaColor(
|
|
492
|
+
result.pressedBackgroundColor = (0, import_utils.alphaColor)(
|
|
581
493
|
contentColor,
|
|
582
494
|
theme.stateLayer.pressedOpacity
|
|
583
495
|
);
|
|
584
496
|
} else {
|
|
585
|
-
result.hoveredBackgroundColor = blendColor(
|
|
497
|
+
result.hoveredBackgroundColor = (0, import_utils.blendColor)(
|
|
586
498
|
colors.backgroundColor,
|
|
587
499
|
contentColor,
|
|
588
500
|
theme.stateLayer.hoveredOpacity
|
|
589
501
|
);
|
|
590
|
-
result.pressedBackgroundColor = blendColor(
|
|
502
|
+
result.pressedBackgroundColor = (0, import_utils.blendColor)(
|
|
591
503
|
colors.backgroundColor,
|
|
592
504
|
contentColor,
|
|
593
505
|
theme.stateLayer.pressedOpacity
|
|
@@ -611,11 +523,11 @@ function createStyles(theme, variant, hasLeadingIcon, hasTrailingIcon, container
|
|
|
611
523
|
hasLeadingIcon,
|
|
612
524
|
hasTrailingIcon
|
|
613
525
|
);
|
|
614
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
615
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
616
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
526
|
+
const elevationLevel0 = (0, import_utils.elevationStyle)(theme.elevation.level0);
|
|
527
|
+
const elevationLevel1 = (0, import_utils.elevationStyle)(theme.elevation.level1);
|
|
528
|
+
const elevationLevel2 = (0, import_utils.elevationStyle)(theme.elevation.level2);
|
|
617
529
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
618
|
-
return
|
|
530
|
+
return import_react_native5.StyleSheet.create({
|
|
619
531
|
container: {
|
|
620
532
|
alignSelf: "flex-start",
|
|
621
533
|
alignItems: "center",
|
|
@@ -703,7 +615,7 @@ function Button({
|
|
|
703
615
|
const hasLeading = Boolean(leadingIcon);
|
|
704
616
|
const hasTrailing = Boolean(trailingIcon);
|
|
705
617
|
const theme = (0, import_core5.useTheme)();
|
|
706
|
-
const
|
|
618
|
+
const styles3 = (0, import_react7.useMemo)(
|
|
707
619
|
() => createStyles(
|
|
708
620
|
theme,
|
|
709
621
|
variant,
|
|
@@ -714,35 +626,35 @@ function Button({
|
|
|
714
626
|
),
|
|
715
627
|
[theme, variant, hasLeading, hasTrailing, containerColor, contentColor]
|
|
716
628
|
);
|
|
717
|
-
const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
|
|
629
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? (0, import_utils2.getMaterialCommunityIcons)() : null;
|
|
718
630
|
const resolvedIconColor = (0, import_react7.useMemo)(() => {
|
|
719
|
-
const base =
|
|
720
|
-
|
|
721
|
-
isDisabled ?
|
|
631
|
+
const base = import_react_native7.StyleSheet.flatten([
|
|
632
|
+
styles3.label,
|
|
633
|
+
isDisabled ? styles3.disabledLabel : void 0
|
|
722
634
|
]);
|
|
723
635
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
724
|
-
}, [
|
|
636
|
+
}, [styles3.label, styles3.disabledLabel, isDisabled]);
|
|
725
637
|
const computedLabelStyle = (0, import_react7.useMemo)(
|
|
726
638
|
() => [
|
|
727
|
-
|
|
728
|
-
isDisabled ?
|
|
639
|
+
styles3.label,
|
|
640
|
+
isDisabled ? styles3.disabledLabel : void 0,
|
|
729
641
|
labelStyleOverride
|
|
730
642
|
],
|
|
731
|
-
[isDisabled,
|
|
643
|
+
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
732
644
|
);
|
|
733
645
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
734
|
-
|
|
646
|
+
import_react_native6.Pressable,
|
|
735
647
|
{
|
|
736
648
|
...props,
|
|
737
649
|
accessibilityRole: "button",
|
|
738
650
|
accessibilityState: { disabled: isDisabled },
|
|
739
|
-
hitSlop:
|
|
651
|
+
hitSlop: import_react_native6.Platform.OS === "web" ? void 0 : 4,
|
|
740
652
|
disabled: isDisabled,
|
|
741
653
|
style: resolveStyle(
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
654
|
+
styles3.container,
|
|
655
|
+
styles3.hoveredContainer,
|
|
656
|
+
styles3.pressedContainer,
|
|
657
|
+
styles3.disabledContainer,
|
|
746
658
|
isDisabled,
|
|
747
659
|
style
|
|
748
660
|
),
|
|
@@ -753,17 +665,17 @@ function Button({
|
|
|
753
665
|
name: leadingIcon,
|
|
754
666
|
size: iconSize,
|
|
755
667
|
color: resolvedIconColor,
|
|
756
|
-
style:
|
|
668
|
+
style: styles3.leadingIcon
|
|
757
669
|
}
|
|
758
670
|
) : null,
|
|
759
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native8.Text, { style: computedLabelStyle, children }),
|
|
760
672
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
761
673
|
MaterialCommunityIcons,
|
|
762
674
|
{
|
|
763
675
|
name: trailingIcon,
|
|
764
676
|
size: iconSize,
|
|
765
677
|
color: resolvedIconColor,
|
|
766
|
-
style:
|
|
678
|
+
style: styles3.trailingIcon
|
|
767
679
|
}
|
|
768
680
|
) : null
|
|
769
681
|
]
|
|
@@ -773,16 +685,18 @@ function Button({
|
|
|
773
685
|
|
|
774
686
|
// src/icon-button/IconButton.tsx
|
|
775
687
|
var import_react8 = require("react");
|
|
776
|
-
var
|
|
688
|
+
var import_react_native10 = require("react-native");
|
|
777
689
|
var import_core6 = require("@onlynative/core");
|
|
690
|
+
var import_utils4 = require("@onlynative/utils");
|
|
778
691
|
|
|
779
692
|
// src/icon-button/styles.ts
|
|
780
|
-
var
|
|
693
|
+
var import_react_native9 = require("react-native");
|
|
694
|
+
var import_utils3 = require("@onlynative/utils");
|
|
781
695
|
function createStyles2(theme) {
|
|
782
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
783
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
696
|
+
const disabledContainerColor = (0, import_utils3.alphaColor)(theme.colors.onSurface, 0.12);
|
|
697
|
+
const disabledOutlineColor = (0, import_utils3.alphaColor)(theme.colors.onSurface, 0.12);
|
|
784
698
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
785
|
-
return
|
|
699
|
+
return import_react_native9.StyleSheet.create({
|
|
786
700
|
container: {
|
|
787
701
|
borderRadius: theme.shape.cornerFull,
|
|
788
702
|
alignItems: "center",
|
|
@@ -848,160 +762,160 @@ function createStyles2(theme) {
|
|
|
848
762
|
},
|
|
849
763
|
// Hover states (M3: 8% state layer)
|
|
850
764
|
hoveredFilled: {
|
|
851
|
-
backgroundColor: blendColor(
|
|
765
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
852
766
|
theme.colors.primary,
|
|
853
767
|
theme.colors.onPrimary,
|
|
854
768
|
theme.stateLayer.hoveredOpacity
|
|
855
769
|
)
|
|
856
770
|
},
|
|
857
771
|
hoveredFilledToggleUnselected: {
|
|
858
|
-
backgroundColor: blendColor(
|
|
772
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
859
773
|
toggleUnselectedContainerColor,
|
|
860
774
|
theme.colors.primary,
|
|
861
775
|
theme.stateLayer.hoveredOpacity
|
|
862
776
|
)
|
|
863
777
|
},
|
|
864
778
|
hoveredFilledToggleSelected: {
|
|
865
|
-
backgroundColor: blendColor(
|
|
779
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
866
780
|
theme.colors.primary,
|
|
867
781
|
theme.colors.onPrimary,
|
|
868
782
|
theme.stateLayer.hoveredOpacity
|
|
869
783
|
)
|
|
870
784
|
},
|
|
871
785
|
hoveredTonal: {
|
|
872
|
-
backgroundColor: blendColor(
|
|
786
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
873
787
|
theme.colors.secondaryContainer,
|
|
874
788
|
theme.colors.onSecondaryContainer,
|
|
875
789
|
theme.stateLayer.hoveredOpacity
|
|
876
790
|
)
|
|
877
791
|
},
|
|
878
792
|
hoveredTonalToggleUnselected: {
|
|
879
|
-
backgroundColor: blendColor(
|
|
793
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
880
794
|
toggleUnselectedContainerColor,
|
|
881
795
|
theme.colors.onSurfaceVariant,
|
|
882
796
|
theme.stateLayer.hoveredOpacity
|
|
883
797
|
)
|
|
884
798
|
},
|
|
885
799
|
hoveredTonalToggleSelected: {
|
|
886
|
-
backgroundColor: blendColor(
|
|
800
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
887
801
|
theme.colors.secondaryContainer,
|
|
888
802
|
theme.colors.onSecondaryContainer,
|
|
889
803
|
theme.stateLayer.hoveredOpacity
|
|
890
804
|
)
|
|
891
805
|
},
|
|
892
806
|
hoveredOutlined: {
|
|
893
|
-
backgroundColor: alphaColor(
|
|
807
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
894
808
|
theme.colors.onSurfaceVariant,
|
|
895
809
|
theme.stateLayer.hoveredOpacity
|
|
896
810
|
)
|
|
897
811
|
},
|
|
898
812
|
hoveredOutlinedToggleUnselected: {
|
|
899
|
-
backgroundColor: alphaColor(
|
|
813
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
900
814
|
theme.colors.onSurfaceVariant,
|
|
901
815
|
theme.stateLayer.hoveredOpacity
|
|
902
816
|
)
|
|
903
817
|
},
|
|
904
818
|
hoveredOutlinedToggleSelected: {
|
|
905
|
-
backgroundColor: blendColor(
|
|
819
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
906
820
|
theme.colors.inverseSurface,
|
|
907
821
|
theme.colors.inverseOnSurface,
|
|
908
822
|
theme.stateLayer.hoveredOpacity
|
|
909
823
|
)
|
|
910
824
|
},
|
|
911
825
|
hoveredStandard: {
|
|
912
|
-
backgroundColor: alphaColor(
|
|
826
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
913
827
|
theme.colors.onSurfaceVariant,
|
|
914
828
|
theme.stateLayer.hoveredOpacity
|
|
915
829
|
)
|
|
916
830
|
},
|
|
917
831
|
hoveredStandardToggleUnselected: {
|
|
918
|
-
backgroundColor: alphaColor(
|
|
832
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
919
833
|
theme.colors.onSurfaceVariant,
|
|
920
834
|
theme.stateLayer.hoveredOpacity
|
|
921
835
|
)
|
|
922
836
|
},
|
|
923
837
|
hoveredStandardToggleSelected: {
|
|
924
|
-
backgroundColor: alphaColor(
|
|
838
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
925
839
|
theme.colors.primary,
|
|
926
840
|
theme.stateLayer.hoveredOpacity
|
|
927
841
|
)
|
|
928
842
|
},
|
|
929
843
|
// Pressed states (M3: 12% state layer)
|
|
930
844
|
pressedFilled: {
|
|
931
|
-
backgroundColor: blendColor(
|
|
845
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
932
846
|
theme.colors.primary,
|
|
933
847
|
theme.colors.onPrimary,
|
|
934
848
|
theme.stateLayer.pressedOpacity
|
|
935
849
|
)
|
|
936
850
|
},
|
|
937
851
|
pressedFilledToggleUnselected: {
|
|
938
|
-
backgroundColor: blendColor(
|
|
852
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
939
853
|
toggleUnselectedContainerColor,
|
|
940
854
|
theme.colors.primary,
|
|
941
855
|
theme.stateLayer.pressedOpacity
|
|
942
856
|
)
|
|
943
857
|
},
|
|
944
858
|
pressedFilledToggleSelected: {
|
|
945
|
-
backgroundColor: blendColor(
|
|
859
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
946
860
|
theme.colors.primary,
|
|
947
861
|
theme.colors.onPrimary,
|
|
948
862
|
theme.stateLayer.pressedOpacity
|
|
949
863
|
)
|
|
950
864
|
},
|
|
951
865
|
pressedTonal: {
|
|
952
|
-
backgroundColor: blendColor(
|
|
866
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
953
867
|
theme.colors.secondaryContainer,
|
|
954
868
|
theme.colors.onSecondaryContainer,
|
|
955
869
|
theme.stateLayer.pressedOpacity
|
|
956
870
|
)
|
|
957
871
|
},
|
|
958
872
|
pressedTonalToggleUnselected: {
|
|
959
|
-
backgroundColor: blendColor(
|
|
873
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
960
874
|
toggleUnselectedContainerColor,
|
|
961
875
|
theme.colors.onSurfaceVariant,
|
|
962
876
|
theme.stateLayer.pressedOpacity
|
|
963
877
|
)
|
|
964
878
|
},
|
|
965
879
|
pressedTonalToggleSelected: {
|
|
966
|
-
backgroundColor: blendColor(
|
|
880
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
967
881
|
theme.colors.secondaryContainer,
|
|
968
882
|
theme.colors.onSecondaryContainer,
|
|
969
883
|
theme.stateLayer.pressedOpacity
|
|
970
884
|
)
|
|
971
885
|
},
|
|
972
886
|
pressedOutlined: {
|
|
973
|
-
backgroundColor: alphaColor(
|
|
887
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
974
888
|
theme.colors.onSurfaceVariant,
|
|
975
889
|
theme.stateLayer.pressedOpacity
|
|
976
890
|
)
|
|
977
891
|
},
|
|
978
892
|
pressedOutlinedToggleUnselected: {
|
|
979
|
-
backgroundColor: alphaColor(
|
|
893
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
980
894
|
theme.colors.onSurfaceVariant,
|
|
981
895
|
theme.stateLayer.pressedOpacity
|
|
982
896
|
)
|
|
983
897
|
},
|
|
984
898
|
pressedOutlinedToggleSelected: {
|
|
985
|
-
backgroundColor: blendColor(
|
|
899
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
986
900
|
theme.colors.inverseSurface,
|
|
987
901
|
theme.colors.inverseOnSurface,
|
|
988
902
|
theme.stateLayer.pressedOpacity
|
|
989
903
|
)
|
|
990
904
|
},
|
|
991
905
|
pressedStandard: {
|
|
992
|
-
backgroundColor: alphaColor(
|
|
906
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
993
907
|
theme.colors.onSurfaceVariant,
|
|
994
908
|
theme.stateLayer.pressedOpacity
|
|
995
909
|
)
|
|
996
910
|
},
|
|
997
911
|
pressedStandardToggleUnselected: {
|
|
998
|
-
backgroundColor: alphaColor(
|
|
912
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
999
913
|
theme.colors.onSurfaceVariant,
|
|
1000
914
|
theme.stateLayer.pressedOpacity
|
|
1001
915
|
)
|
|
1002
916
|
},
|
|
1003
917
|
pressedStandardToggleSelected: {
|
|
1004
|
-
backgroundColor: alphaColor(
|
|
918
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
1005
919
|
theme.colors.primary,
|
|
1006
920
|
theme.stateLayer.pressedOpacity
|
|
1007
921
|
)
|
|
@@ -1034,7 +948,7 @@ function createStyles2(theme) {
|
|
|
1034
948
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1035
949
|
function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
1036
950
|
if (disabled) {
|
|
1037
|
-
return alphaColor(theme.colors.onSurface, 0.38);
|
|
951
|
+
return (0, import_utils4.alphaColor)(theme.colors.onSurface, 0.38);
|
|
1038
952
|
}
|
|
1039
953
|
if (isToggle) {
|
|
1040
954
|
if (variant === "filled") {
|
|
@@ -1056,38 +970,38 @@ function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
|
1056
970
|
}
|
|
1057
971
|
return theme.colors.onSurfaceVariant;
|
|
1058
972
|
}
|
|
1059
|
-
function getColorStyle(
|
|
973
|
+
function getColorStyle(styles3, variant, isToggle, selected) {
|
|
1060
974
|
if (isToggle) {
|
|
1061
975
|
if (variant === "tonal") {
|
|
1062
|
-
return selected ?
|
|
976
|
+
return selected ? styles3.colorTonalToggleSelected : styles3.colorTonalToggleUnselected;
|
|
1063
977
|
}
|
|
1064
978
|
if (variant === "outlined") {
|
|
1065
|
-
return selected ?
|
|
979
|
+
return selected ? styles3.colorOutlinedToggleSelected : styles3.colorOutlined;
|
|
1066
980
|
}
|
|
1067
981
|
if (variant === "standard") {
|
|
1068
|
-
return selected ?
|
|
982
|
+
return selected ? styles3.colorStandardToggleSelected : styles3.colorStandard;
|
|
1069
983
|
}
|
|
1070
|
-
return selected ?
|
|
984
|
+
return selected ? styles3.colorFilledToggleSelected : styles3.colorFilledToggleUnselected;
|
|
1071
985
|
}
|
|
1072
986
|
if (variant === "tonal") {
|
|
1073
|
-
return
|
|
987
|
+
return styles3.colorTonal;
|
|
1074
988
|
}
|
|
1075
989
|
if (variant === "outlined") {
|
|
1076
|
-
return
|
|
990
|
+
return styles3.colorOutlined;
|
|
1077
991
|
}
|
|
1078
992
|
if (variant === "standard") {
|
|
1079
|
-
return
|
|
993
|
+
return styles3.colorStandard;
|
|
1080
994
|
}
|
|
1081
|
-
return
|
|
995
|
+
return styles3.colorFilled;
|
|
1082
996
|
}
|
|
1083
|
-
function getSizeStyle(
|
|
997
|
+
function getSizeStyle(styles3, size) {
|
|
1084
998
|
if (size === "small") {
|
|
1085
|
-
return
|
|
999
|
+
return styles3.sizeSmall;
|
|
1086
1000
|
}
|
|
1087
1001
|
if (size === "large") {
|
|
1088
|
-
return
|
|
1002
|
+
return styles3.sizeLarge;
|
|
1089
1003
|
}
|
|
1090
|
-
return
|
|
1004
|
+
return styles3.sizeMedium;
|
|
1091
1005
|
}
|
|
1092
1006
|
function getIconPixelSize(size) {
|
|
1093
1007
|
if (size === "small") {
|
|
@@ -1107,65 +1021,65 @@ function getDefaultHitSlop(size) {
|
|
|
1107
1021
|
}
|
|
1108
1022
|
return 4;
|
|
1109
1023
|
}
|
|
1110
|
-
function getHoveredStyle(
|
|
1024
|
+
function getHoveredStyle(styles3, variant, isToggle, selected) {
|
|
1111
1025
|
if (isToggle) {
|
|
1112
1026
|
if (variant === "tonal") {
|
|
1113
|
-
return selected ?
|
|
1027
|
+
return selected ? styles3.hoveredTonalToggleSelected : styles3.hoveredTonalToggleUnselected;
|
|
1114
1028
|
}
|
|
1115
1029
|
if (variant === "outlined") {
|
|
1116
|
-
return selected ?
|
|
1030
|
+
return selected ? styles3.hoveredOutlinedToggleSelected : styles3.hoveredOutlinedToggleUnselected;
|
|
1117
1031
|
}
|
|
1118
1032
|
if (variant === "standard") {
|
|
1119
|
-
return selected ?
|
|
1033
|
+
return selected ? styles3.hoveredStandardToggleSelected : styles3.hoveredStandardToggleUnselected;
|
|
1120
1034
|
}
|
|
1121
|
-
return selected ?
|
|
1035
|
+
return selected ? styles3.hoveredFilledToggleSelected : styles3.hoveredFilledToggleUnselected;
|
|
1122
1036
|
}
|
|
1123
1037
|
if (variant === "tonal") {
|
|
1124
|
-
return
|
|
1038
|
+
return styles3.hoveredTonal;
|
|
1125
1039
|
}
|
|
1126
1040
|
if (variant === "outlined") {
|
|
1127
|
-
return
|
|
1041
|
+
return styles3.hoveredOutlined;
|
|
1128
1042
|
}
|
|
1129
1043
|
if (variant === "standard") {
|
|
1130
|
-
return
|
|
1044
|
+
return styles3.hoveredStandard;
|
|
1131
1045
|
}
|
|
1132
|
-
return
|
|
1046
|
+
return styles3.hoveredFilled;
|
|
1133
1047
|
}
|
|
1134
|
-
function getPressedStyle(
|
|
1048
|
+
function getPressedStyle(styles3, variant, isToggle, selected) {
|
|
1135
1049
|
if (isToggle) {
|
|
1136
1050
|
if (variant === "tonal") {
|
|
1137
|
-
return selected ?
|
|
1051
|
+
return selected ? styles3.pressedTonalToggleSelected : styles3.pressedTonalToggleUnselected;
|
|
1138
1052
|
}
|
|
1139
1053
|
if (variant === "outlined") {
|
|
1140
|
-
return selected ?
|
|
1054
|
+
return selected ? styles3.pressedOutlinedToggleSelected : styles3.pressedOutlinedToggleUnselected;
|
|
1141
1055
|
}
|
|
1142
1056
|
if (variant === "standard") {
|
|
1143
|
-
return selected ?
|
|
1057
|
+
return selected ? styles3.pressedStandardToggleSelected : styles3.pressedStandardToggleUnselected;
|
|
1144
1058
|
}
|
|
1145
|
-
return selected ?
|
|
1059
|
+
return selected ? styles3.pressedFilledToggleSelected : styles3.pressedFilledToggleUnselected;
|
|
1146
1060
|
}
|
|
1147
1061
|
if (variant === "tonal") {
|
|
1148
|
-
return
|
|
1062
|
+
return styles3.pressedTonal;
|
|
1149
1063
|
}
|
|
1150
1064
|
if (variant === "outlined") {
|
|
1151
|
-
return
|
|
1065
|
+
return styles3.pressedOutlined;
|
|
1152
1066
|
}
|
|
1153
1067
|
if (variant === "standard") {
|
|
1154
|
-
return
|
|
1068
|
+
return styles3.pressedStandard;
|
|
1155
1069
|
}
|
|
1156
|
-
return
|
|
1070
|
+
return styles3.pressedFilled;
|
|
1157
1071
|
}
|
|
1158
|
-
function getDisabledStyle(
|
|
1072
|
+
function getDisabledStyle(styles3, variant) {
|
|
1159
1073
|
if (variant === "tonal") {
|
|
1160
|
-
return
|
|
1074
|
+
return styles3.disabledTonal;
|
|
1161
1075
|
}
|
|
1162
1076
|
if (variant === "outlined") {
|
|
1163
|
-
return
|
|
1077
|
+
return styles3.disabledOutlined;
|
|
1164
1078
|
}
|
|
1165
1079
|
if (variant === "standard") {
|
|
1166
|
-
return
|
|
1080
|
+
return styles3.disabledStandard;
|
|
1167
1081
|
}
|
|
1168
|
-
return
|
|
1082
|
+
return styles3.disabledFilled;
|
|
1169
1083
|
}
|
|
1170
1084
|
function IconButton({
|
|
1171
1085
|
icon,
|
|
@@ -1184,9 +1098,9 @@ function IconButton({
|
|
|
1184
1098
|
...props
|
|
1185
1099
|
}) {
|
|
1186
1100
|
var _a;
|
|
1187
|
-
const MaterialCommunityIcons = getMaterialCommunityIcons();
|
|
1101
|
+
const MaterialCommunityIcons = (0, import_utils4.getMaterialCommunityIcons)();
|
|
1188
1102
|
const theme = (0, import_core6.useTheme)();
|
|
1189
|
-
const
|
|
1103
|
+
const styles3 = (0, import_react8.useMemo)(() => createStyles2(theme), [theme]);
|
|
1190
1104
|
const isDisabled = Boolean(disabled);
|
|
1191
1105
|
const isToggle = selected !== void 0;
|
|
1192
1106
|
const isSelected = Boolean(selected);
|
|
@@ -1204,14 +1118,14 @@ function IconButton({
|
|
|
1204
1118
|
borderWidth: 0
|
|
1205
1119
|
},
|
|
1206
1120
|
hovered: {
|
|
1207
|
-
backgroundColor: blendColor(
|
|
1121
|
+
backgroundColor: (0, import_utils4.blendColor)(
|
|
1208
1122
|
containerColor,
|
|
1209
1123
|
overlay,
|
|
1210
1124
|
theme.stateLayer.hoveredOpacity
|
|
1211
1125
|
)
|
|
1212
1126
|
},
|
|
1213
1127
|
pressed: {
|
|
1214
|
-
backgroundColor: blendColor(
|
|
1128
|
+
backgroundColor: (0, import_utils4.blendColor)(
|
|
1215
1129
|
containerColor,
|
|
1216
1130
|
overlay,
|
|
1217
1131
|
theme.stateLayer.pressedOpacity
|
|
@@ -1220,7 +1134,7 @@ function IconButton({
|
|
|
1220
1134
|
};
|
|
1221
1135
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
1222
1136
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1223
|
-
|
|
1137
|
+
import_react_native10.Pressable,
|
|
1224
1138
|
{
|
|
1225
1139
|
...props,
|
|
1226
1140
|
accessibilityRole: "button",
|
|
@@ -1234,13 +1148,13 @@ function IconButton({
|
|
|
1234
1148
|
hovered
|
|
1235
1149
|
}) => {
|
|
1236
1150
|
const base = [
|
|
1237
|
-
|
|
1238
|
-
getSizeStyle(
|
|
1239
|
-
getColorStyle(
|
|
1151
|
+
styles3.container,
|
|
1152
|
+
getSizeStyle(styles3, size),
|
|
1153
|
+
getColorStyle(styles3, variant, isToggle, isSelected),
|
|
1240
1154
|
containerOverrides == null ? void 0 : containerOverrides.base,
|
|
1241
|
-
hovered && !pressed && !isDisabled ? containerOverrides ? containerOverrides.hovered : getHoveredStyle(
|
|
1242
|
-
pressed && !isDisabled ? containerOverrides ? containerOverrides.pressed : getPressedStyle(
|
|
1243
|
-
isDisabled ? getDisabledStyle(
|
|
1155
|
+
hovered && !pressed && !isDisabled ? containerOverrides ? containerOverrides.hovered : getHoveredStyle(styles3, variant, isToggle, isSelected) : void 0,
|
|
1156
|
+
pressed && !isDisabled ? containerOverrides ? containerOverrides.pressed : getPressedStyle(styles3, variant, isToggle, isSelected) : void 0,
|
|
1157
|
+
isDisabled ? getDisabledStyle(styles3, variant) : void 0
|
|
1244
1158
|
];
|
|
1245
1159
|
if (typeof style === "function") {
|
|
1246
1160
|
base.push(style({ pressed }));
|
|
@@ -1263,26 +1177,18 @@ function IconButton({
|
|
|
1263
1177
|
|
|
1264
1178
|
// src/appbar/AppBar.tsx
|
|
1265
1179
|
var import_react9 = require("react");
|
|
1266
|
-
var
|
|
1180
|
+
var import_react_native12 = require("react-native");
|
|
1267
1181
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
1268
1182
|
var import_core8 = require("@onlynative/core");
|
|
1269
|
-
|
|
1270
|
-
// src/utils/rtl.ts
|
|
1271
|
-
var import_react_native12 = require("react-native");
|
|
1272
|
-
function transformOrigin(vertical = "top") {
|
|
1273
|
-
return import_react_native12.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
|
|
1274
|
-
}
|
|
1275
|
-
function selectRTL(ltr, rtl) {
|
|
1276
|
-
return import_react_native12.I18nManager.isRTL ? rtl : ltr;
|
|
1277
|
-
}
|
|
1183
|
+
var import_utils5 = require("@onlynative/utils");
|
|
1278
1184
|
|
|
1279
1185
|
// src/appbar/styles.ts
|
|
1280
|
-
var
|
|
1186
|
+
var import_react_native11 = require("react-native");
|
|
1281
1187
|
var import_core7 = require("@onlynative/core");
|
|
1282
1188
|
function createStyles3(theme) {
|
|
1283
1189
|
var _a;
|
|
1284
1190
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core7.defaultTopAppBarTokens;
|
|
1285
|
-
return
|
|
1191
|
+
return import_react_native11.StyleSheet.create({
|
|
1286
1192
|
root: {
|
|
1287
1193
|
backgroundColor: theme.colors.surface
|
|
1288
1194
|
},
|
|
@@ -1371,10 +1277,10 @@ function createStyles3(theme) {
|
|
|
1371
1277
|
// src/appbar/AppBar.tsx
|
|
1372
1278
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1373
1279
|
function getBackIcon() {
|
|
1374
|
-
if (
|
|
1375
|
-
return selectRTL("chevron-left", "chevron-right");
|
|
1280
|
+
if (import_react_native12.Platform.OS === "ios") {
|
|
1281
|
+
return (0, import_utils5.selectRTL)("chevron-left", "chevron-right");
|
|
1376
1282
|
}
|
|
1377
|
-
return selectRTL("arrow-left", "arrow-right");
|
|
1283
|
+
return (0, import_utils5.selectRTL)("arrow-left", "arrow-right");
|
|
1378
1284
|
}
|
|
1379
1285
|
var titleVariantBySize = {
|
|
1380
1286
|
small: "titleLarge",
|
|
@@ -1392,17 +1298,17 @@ function resolveSize(variant) {
|
|
|
1392
1298
|
}
|
|
1393
1299
|
return "small";
|
|
1394
1300
|
}
|
|
1395
|
-
function getSizeStyle2(
|
|
1301
|
+
function getSizeStyle2(styles3, size) {
|
|
1396
1302
|
if (size === "large") {
|
|
1397
|
-
return
|
|
1303
|
+
return styles3.largeContainer;
|
|
1398
1304
|
}
|
|
1399
|
-
return
|
|
1305
|
+
return styles3.mediumContainer;
|
|
1400
1306
|
}
|
|
1401
1307
|
function withTopInset(enabled, content, style) {
|
|
1402
1308
|
if (enabled) {
|
|
1403
1309
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_safe_area_context2.SafeAreaView, { edges: ["top"], style, children: content });
|
|
1404
1310
|
}
|
|
1405
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style, children: content });
|
|
1406
1312
|
}
|
|
1407
1313
|
function measureWidth(event) {
|
|
1408
1314
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -1425,7 +1331,7 @@ function AppBar({
|
|
|
1425
1331
|
var _a;
|
|
1426
1332
|
const theme = (0, import_core8.useTheme)();
|
|
1427
1333
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core8.defaultTopAppBarTokens;
|
|
1428
|
-
const
|
|
1334
|
+
const styles3 = (0, import_react9.useMemo)(() => createStyles3(theme), [theme]);
|
|
1429
1335
|
const [leadingWidth, setLeadingWidth] = (0, import_react9.useState)(0);
|
|
1430
1336
|
const [actionsWidth, setActionsWidth] = (0, import_react9.useState)(0);
|
|
1431
1337
|
const titleColorStyle = (0, import_react9.useMemo)(
|
|
@@ -1454,7 +1360,7 @@ function AppBar({
|
|
|
1454
1360
|
if (!canGoBack) {
|
|
1455
1361
|
return null;
|
|
1456
1362
|
}
|
|
1457
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1458
1364
|
IconButton,
|
|
1459
1365
|
{
|
|
1460
1366
|
icon: getBackIcon(),
|
|
@@ -1470,7 +1376,7 @@ function AppBar({
|
|
|
1470
1376
|
contentColor,
|
|
1471
1377
|
leading,
|
|
1472
1378
|
onBackPress,
|
|
1473
|
-
|
|
1379
|
+
styles3.iconFrame,
|
|
1474
1380
|
theme.colors.onSurface
|
|
1475
1381
|
]);
|
|
1476
1382
|
const actionsContent = (0, import_react9.useMemo)(() => {
|
|
@@ -1480,10 +1386,10 @@ function AppBar({
|
|
|
1480
1386
|
if (!actions || actions.length === 0) {
|
|
1481
1387
|
return null;
|
|
1482
1388
|
}
|
|
1483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1484
|
-
|
|
1389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1390
|
+
import_react_native12.View,
|
|
1485
1391
|
{
|
|
1486
|
-
style:
|
|
1392
|
+
style: styles3.iconFrame,
|
|
1487
1393
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1488
1394
|
IconButton,
|
|
1489
1395
|
{
|
|
@@ -1499,7 +1405,7 @@ function AppBar({
|
|
|
1499
1405
|
},
|
|
1500
1406
|
`${String(action.icon)}-${index}`
|
|
1501
1407
|
)) });
|
|
1502
|
-
}, [actions, contentColor,
|
|
1408
|
+
}, [actions, contentColor, styles3.actionsRow, styles3.iconFrame, trailing]);
|
|
1503
1409
|
const onLeadingLayout = (0, import_react9.useCallback)((event) => {
|
|
1504
1410
|
const nextWidth = measureWidth(event);
|
|
1505
1411
|
setLeadingWidth((currentWidth) => {
|
|
@@ -1518,48 +1424,48 @@ function AppBar({
|
|
|
1518
1424
|
return nextWidth;
|
|
1519
1425
|
});
|
|
1520
1426
|
}, []);
|
|
1521
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1427
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: styles3.topRow, children: [
|
|
1522
1428
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1523
|
-
|
|
1429
|
+
import_react_native12.View,
|
|
1524
1430
|
{
|
|
1525
1431
|
collapsable: false,
|
|
1526
1432
|
onLayout: onLeadingLayout,
|
|
1527
|
-
style:
|
|
1433
|
+
style: styles3.sideSlot,
|
|
1528
1434
|
children: leadingContent
|
|
1529
1435
|
}
|
|
1530
1436
|
),
|
|
1531
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.topRowSpacer }),
|
|
1532
1438
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1533
|
-
|
|
1439
|
+
import_react_native12.View,
|
|
1534
1440
|
{
|
|
1535
1441
|
collapsable: false,
|
|
1536
1442
|
onLayout: onActionsLayout,
|
|
1537
|
-
style:
|
|
1443
|
+
style: styles3.sideSlot,
|
|
1538
1444
|
children: actionsContent
|
|
1539
1445
|
}
|
|
1540
1446
|
)
|
|
1541
1447
|
] });
|
|
1542
1448
|
const containerOverride = containerColor ? { backgroundColor: containerColor } : void 0;
|
|
1543
1449
|
const rootStyle = [
|
|
1544
|
-
|
|
1545
|
-
elevated ?
|
|
1450
|
+
styles3.root,
|
|
1451
|
+
elevated ? styles3.elevatedRoot : void 0,
|
|
1546
1452
|
containerOverride,
|
|
1547
1453
|
style
|
|
1548
1454
|
];
|
|
1549
1455
|
const safeAreaStyle = [
|
|
1550
|
-
|
|
1551
|
-
elevated ?
|
|
1456
|
+
styles3.safeArea,
|
|
1457
|
+
elevated ? styles3.elevatedSafeArea : void 0,
|
|
1552
1458
|
containerOverride
|
|
1553
1459
|
];
|
|
1554
1460
|
if (isExpanded) {
|
|
1555
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1461
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: [styles3.expandedContainer, getSizeStyle2(styles3, size)], children: [
|
|
1556
1462
|
topRow,
|
|
1557
1463
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1558
|
-
|
|
1464
|
+
import_react_native12.View,
|
|
1559
1465
|
{
|
|
1560
1466
|
style: [
|
|
1561
|
-
|
|
1562
|
-
size === "large" ?
|
|
1467
|
+
styles3.expandedTitleContainer,
|
|
1468
|
+
size === "large" ? styles3.largeTitlePadding : styles3.mediumTitlePadding,
|
|
1563
1469
|
expandedTitleInsetStyle
|
|
1564
1470
|
],
|
|
1565
1471
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1568,9 +1474,9 @@ function AppBar({
|
|
|
1568
1474
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
1569
1475
|
variant: titleVariant,
|
|
1570
1476
|
style: [
|
|
1571
|
-
|
|
1477
|
+
styles3.title,
|
|
1572
1478
|
titleColorStyle,
|
|
1573
|
-
|
|
1479
|
+
styles3.startAlignedTitle,
|
|
1574
1480
|
titleStyle
|
|
1575
1481
|
],
|
|
1576
1482
|
children: title
|
|
@@ -1579,48 +1485,49 @@ function AppBar({
|
|
|
1579
1485
|
}
|
|
1580
1486
|
)
|
|
1581
1487
|
] });
|
|
1582
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1583
1489
|
}
|
|
1584
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1490
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: styles3.smallContainer, children: [
|
|
1585
1491
|
topRow,
|
|
1586
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: [styles3.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1587
1493
|
Typography,
|
|
1588
1494
|
{
|
|
1589
1495
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
1590
1496
|
variant: titleVariant,
|
|
1591
1497
|
style: [
|
|
1592
|
-
|
|
1498
|
+
styles3.title,
|
|
1593
1499
|
titleColorStyle,
|
|
1594
|
-
isCenterAligned ?
|
|
1500
|
+
isCenterAligned ? styles3.centeredTitle : styles3.startAlignedTitle,
|
|
1595
1501
|
titleStyle
|
|
1596
1502
|
],
|
|
1597
1503
|
children: title
|
|
1598
1504
|
}
|
|
1599
1505
|
) })
|
|
1600
1506
|
] });
|
|
1601
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1602
1508
|
}
|
|
1603
1509
|
|
|
1604
1510
|
// src/card/Card.tsx
|
|
1605
1511
|
var import_react10 = require("react");
|
|
1606
|
-
var
|
|
1512
|
+
var import_react_native14 = require("react-native");
|
|
1607
1513
|
var import_core9 = require("@onlynative/core");
|
|
1608
1514
|
|
|
1609
1515
|
// src/card/styles.ts
|
|
1610
|
-
var
|
|
1516
|
+
var import_react_native13 = require("react-native");
|
|
1517
|
+
var import_utils6 = require("@onlynative/utils");
|
|
1611
1518
|
function getVariantColors2(theme, variant) {
|
|
1612
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1613
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1519
|
+
const disabledContainerColor = (0, import_utils6.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1520
|
+
const disabledOutlineColor = (0, import_utils6.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1614
1521
|
if (variant === "outlined") {
|
|
1615
1522
|
return {
|
|
1616
1523
|
backgroundColor: theme.colors.surface,
|
|
1617
1524
|
borderColor: theme.colors.outline,
|
|
1618
1525
|
borderWidth: 1,
|
|
1619
|
-
hoveredBackgroundColor: alphaColor(
|
|
1526
|
+
hoveredBackgroundColor: (0, import_utils6.alphaColor)(
|
|
1620
1527
|
theme.colors.onSurface,
|
|
1621
1528
|
theme.stateLayer.hoveredOpacity
|
|
1622
1529
|
),
|
|
1623
|
-
pressedBackgroundColor: alphaColor(
|
|
1530
|
+
pressedBackgroundColor: (0, import_utils6.alphaColor)(
|
|
1624
1531
|
theme.colors.onSurface,
|
|
1625
1532
|
theme.stateLayer.pressedOpacity
|
|
1626
1533
|
),
|
|
@@ -1633,12 +1540,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1633
1540
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
1634
1541
|
borderColor: "transparent",
|
|
1635
1542
|
borderWidth: 0,
|
|
1636
|
-
hoveredBackgroundColor: blendColor(
|
|
1543
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1637
1544
|
theme.colors.surfaceContainerHighest,
|
|
1638
1545
|
theme.colors.onSurface,
|
|
1639
1546
|
theme.stateLayer.hoveredOpacity
|
|
1640
1547
|
),
|
|
1641
|
-
pressedBackgroundColor: blendColor(
|
|
1548
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1642
1549
|
theme.colors.surfaceContainerHighest,
|
|
1643
1550
|
theme.colors.onSurface,
|
|
1644
1551
|
theme.stateLayer.pressedOpacity
|
|
@@ -1651,12 +1558,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1651
1558
|
backgroundColor: theme.colors.surface,
|
|
1652
1559
|
borderColor: "transparent",
|
|
1653
1560
|
borderWidth: 0,
|
|
1654
|
-
hoveredBackgroundColor: blendColor(
|
|
1561
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1655
1562
|
theme.colors.surface,
|
|
1656
1563
|
theme.colors.onSurface,
|
|
1657
1564
|
theme.stateLayer.hoveredOpacity
|
|
1658
1565
|
),
|
|
1659
|
-
pressedBackgroundColor: blendColor(
|
|
1566
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1660
1567
|
theme.colors.surface,
|
|
1661
1568
|
theme.colors.onSurface,
|
|
1662
1569
|
theme.stateLayer.pressedOpacity
|
|
@@ -1672,12 +1579,12 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1672
1579
|
backgroundColor: containerColor,
|
|
1673
1580
|
borderColor: containerColor,
|
|
1674
1581
|
borderWidth: 0,
|
|
1675
|
-
hoveredBackgroundColor: blendColor(
|
|
1582
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1676
1583
|
containerColor,
|
|
1677
1584
|
theme.colors.onSurface,
|
|
1678
1585
|
theme.stateLayer.hoveredOpacity
|
|
1679
1586
|
),
|
|
1680
|
-
pressedBackgroundColor: blendColor(
|
|
1587
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1681
1588
|
containerColor,
|
|
1682
1589
|
theme.colors.onSurface,
|
|
1683
1590
|
theme.stateLayer.pressedOpacity
|
|
@@ -1687,11 +1594,11 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1687
1594
|
function createStyles4(theme, variant, containerColor) {
|
|
1688
1595
|
const baseColors = getVariantColors2(theme, variant);
|
|
1689
1596
|
const colors = applyColorOverrides2(theme, baseColors, containerColor);
|
|
1690
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1691
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1692
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1597
|
+
const elevationLevel0 = (0, import_utils6.elevationStyle)(theme.elevation.level0);
|
|
1598
|
+
const elevationLevel1 = (0, import_utils6.elevationStyle)(theme.elevation.level1);
|
|
1599
|
+
const elevationLevel2 = (0, import_utils6.elevationStyle)(theme.elevation.level2);
|
|
1693
1600
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
1694
|
-
return
|
|
1601
|
+
return import_react_native13.StyleSheet.create({
|
|
1695
1602
|
container: {
|
|
1696
1603
|
borderRadius: theme.shape.cornerMedium,
|
|
1697
1604
|
backgroundColor: colors.backgroundColor,
|
|
@@ -1736,59 +1643,61 @@ function Card({
|
|
|
1736
1643
|
const isDisabled = Boolean(disabled);
|
|
1737
1644
|
const isInteractive = onPress !== void 0;
|
|
1738
1645
|
const theme = (0, import_core9.useTheme)();
|
|
1739
|
-
const
|
|
1646
|
+
const styles3 = (0, import_react10.useMemo)(
|
|
1740
1647
|
() => createStyles4(theme, variant, containerColor),
|
|
1741
1648
|
[theme, variant, containerColor]
|
|
1742
1649
|
);
|
|
1743
1650
|
if (!isInteractive) {
|
|
1744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native14.View, { ...props, style: [styles3.container, style], children });
|
|
1745
1652
|
}
|
|
1746
1653
|
const resolvedStyle = (state) => [
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
state.hovered && !state.pressed && !isDisabled ?
|
|
1750
|
-
state.pressed && !isDisabled ?
|
|
1751
|
-
isDisabled ?
|
|
1654
|
+
styles3.container,
|
|
1655
|
+
styles3.interactiveContainer,
|
|
1656
|
+
state.hovered && !state.pressed && !isDisabled ? styles3.hoveredContainer : void 0,
|
|
1657
|
+
state.pressed && !isDisabled ? styles3.pressedContainer : void 0,
|
|
1658
|
+
isDisabled ? styles3.disabledContainer : void 0,
|
|
1752
1659
|
typeof style === "function" ? style(state) : style
|
|
1753
1660
|
];
|
|
1754
1661
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1755
|
-
|
|
1662
|
+
import_react_native14.Pressable,
|
|
1756
1663
|
{
|
|
1757
1664
|
...props,
|
|
1758
1665
|
role: "button",
|
|
1759
1666
|
accessibilityState: { disabled: isDisabled },
|
|
1760
|
-
hitSlop:
|
|
1667
|
+
hitSlop: import_react_native14.Platform.OS === "web" ? void 0 : 4,
|
|
1761
1668
|
disabled: isDisabled,
|
|
1762
1669
|
onPress,
|
|
1763
1670
|
style: resolvedStyle,
|
|
1764
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1671
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native14.View, { style: styles3.disabledContent, children }) : children
|
|
1765
1672
|
}
|
|
1766
1673
|
);
|
|
1767
1674
|
}
|
|
1768
1675
|
|
|
1769
1676
|
// src/chip/Chip.tsx
|
|
1770
1677
|
var import_react11 = require("react");
|
|
1771
|
-
var
|
|
1678
|
+
var import_react_native16 = require("react-native");
|
|
1772
1679
|
var import_core10 = require("@onlynative/core");
|
|
1680
|
+
var import_utils8 = require("@onlynative/utils");
|
|
1773
1681
|
|
|
1774
1682
|
// src/chip/styles.ts
|
|
1775
|
-
var
|
|
1683
|
+
var import_react_native15 = require("react-native");
|
|
1684
|
+
var import_utils7 = require("@onlynative/utils");
|
|
1776
1685
|
function getVariantColors3(theme, variant, elevated, selected) {
|
|
1777
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1778
|
-
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
1779
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1686
|
+
const disabledContainerColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1687
|
+
const disabledLabelColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.38);
|
|
1688
|
+
const disabledOutlineColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1780
1689
|
if (variant === "filter" && selected) {
|
|
1781
1690
|
return {
|
|
1782
1691
|
backgroundColor: theme.colors.secondaryContainer,
|
|
1783
1692
|
textColor: theme.colors.onSecondaryContainer,
|
|
1784
1693
|
borderColor: "transparent",
|
|
1785
1694
|
borderWidth: 0,
|
|
1786
|
-
hoveredBackgroundColor: blendColor(
|
|
1695
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1787
1696
|
theme.colors.secondaryContainer,
|
|
1788
1697
|
theme.colors.onSecondaryContainer,
|
|
1789
1698
|
theme.stateLayer.hoveredOpacity
|
|
1790
1699
|
),
|
|
1791
|
-
pressedBackgroundColor: blendColor(
|
|
1700
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1792
1701
|
theme.colors.secondaryContainer,
|
|
1793
1702
|
theme.colors.onSecondaryContainer,
|
|
1794
1703
|
theme.stateLayer.pressedOpacity
|
|
@@ -1805,12 +1714,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1805
1714
|
textColor: textColor2,
|
|
1806
1715
|
borderColor: "transparent",
|
|
1807
1716
|
borderWidth: 0,
|
|
1808
|
-
hoveredBackgroundColor: blendColor(
|
|
1717
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1809
1718
|
theme.colors.surfaceContainerLow,
|
|
1810
1719
|
textColor2,
|
|
1811
1720
|
theme.stateLayer.hoveredOpacity
|
|
1812
1721
|
),
|
|
1813
|
-
pressedBackgroundColor: blendColor(
|
|
1722
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1814
1723
|
theme.colors.surfaceContainerLow,
|
|
1815
1724
|
textColor2,
|
|
1816
1725
|
theme.stateLayer.pressedOpacity
|
|
@@ -1826,12 +1735,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1826
1735
|
textColor,
|
|
1827
1736
|
borderColor: theme.colors.outline,
|
|
1828
1737
|
borderWidth: 1,
|
|
1829
|
-
hoveredBackgroundColor: blendColor(
|
|
1738
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1830
1739
|
theme.colors.surface,
|
|
1831
1740
|
textColor,
|
|
1832
1741
|
theme.stateLayer.hoveredOpacity
|
|
1833
1742
|
),
|
|
1834
|
-
pressedBackgroundColor: blendColor(
|
|
1743
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1835
1744
|
theme.colors.surface,
|
|
1836
1745
|
textColor,
|
|
1837
1746
|
theme.stateLayer.pressedOpacity
|
|
@@ -1851,33 +1760,33 @@ function applyColorOverrides3(theme, colors, containerColor, contentColor) {
|
|
|
1851
1760
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
1852
1761
|
result.backgroundColor = containerColor;
|
|
1853
1762
|
result.borderColor = containerColor;
|
|
1854
|
-
result.hoveredBackgroundColor = blendColor(
|
|
1763
|
+
result.hoveredBackgroundColor = (0, import_utils7.blendColor)(
|
|
1855
1764
|
containerColor,
|
|
1856
1765
|
overlay,
|
|
1857
1766
|
theme.stateLayer.hoveredOpacity
|
|
1858
1767
|
);
|
|
1859
|
-
result.pressedBackgroundColor = blendColor(
|
|
1768
|
+
result.pressedBackgroundColor = (0, import_utils7.blendColor)(
|
|
1860
1769
|
containerColor,
|
|
1861
1770
|
overlay,
|
|
1862
1771
|
theme.stateLayer.pressedOpacity
|
|
1863
1772
|
);
|
|
1864
1773
|
} else if (contentColor) {
|
|
1865
1774
|
if (colors.backgroundColor === "transparent") {
|
|
1866
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
1775
|
+
result.hoveredBackgroundColor = (0, import_utils7.alphaColor)(
|
|
1867
1776
|
contentColor,
|
|
1868
1777
|
theme.stateLayer.hoveredOpacity
|
|
1869
1778
|
);
|
|
1870
|
-
result.pressedBackgroundColor = alphaColor(
|
|
1779
|
+
result.pressedBackgroundColor = (0, import_utils7.alphaColor)(
|
|
1871
1780
|
contentColor,
|
|
1872
1781
|
theme.stateLayer.pressedOpacity
|
|
1873
1782
|
);
|
|
1874
1783
|
} else {
|
|
1875
|
-
result.hoveredBackgroundColor = blendColor(
|
|
1784
|
+
result.hoveredBackgroundColor = (0, import_utils7.blendColor)(
|
|
1876
1785
|
colors.backgroundColor,
|
|
1877
1786
|
contentColor,
|
|
1878
1787
|
theme.stateLayer.hoveredOpacity
|
|
1879
1788
|
);
|
|
1880
|
-
result.pressedBackgroundColor = blendColor(
|
|
1789
|
+
result.pressedBackgroundColor = (0, import_utils7.blendColor)(
|
|
1881
1790
|
colors.backgroundColor,
|
|
1882
1791
|
contentColor,
|
|
1883
1792
|
theme.stateLayer.pressedOpacity
|
|
@@ -1895,12 +1804,12 @@ function createStyles5(theme, variant, elevated, selected, hasLeadingContent, ha
|
|
|
1895
1804
|
contentColor
|
|
1896
1805
|
);
|
|
1897
1806
|
const labelStyle = theme.typography.labelLarge;
|
|
1898
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1899
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1900
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1807
|
+
const elevationLevel0 = (0, import_utils7.elevationStyle)(theme.elevation.level0);
|
|
1808
|
+
const elevationLevel1 = (0, import_utils7.elevationStyle)(theme.elevation.level1);
|
|
1809
|
+
const elevationLevel2 = (0, import_utils7.elevationStyle)(theme.elevation.level2);
|
|
1901
1810
|
const isElevated = elevated && variant !== "input";
|
|
1902
1811
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
1903
|
-
return
|
|
1812
|
+
return import_react_native15.StyleSheet.create({
|
|
1904
1813
|
container: {
|
|
1905
1814
|
alignSelf: "flex-start",
|
|
1906
1815
|
alignItems: "center",
|
|
@@ -1998,9 +1907,9 @@ function Chip({
|
|
|
1998
1907
|
variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
|
|
1999
1908
|
);
|
|
2000
1909
|
const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
|
|
2001
|
-
const MaterialCommunityIcons = needsIcons ? getMaterialCommunityIcons() : null;
|
|
1910
|
+
const MaterialCommunityIcons = needsIcons ? (0, import_utils8.getMaterialCommunityIcons)() : null;
|
|
2002
1911
|
const theme = (0, import_core10.useTheme)();
|
|
2003
|
-
const
|
|
1912
|
+
const styles3 = (0, import_react11.useMemo)(
|
|
2004
1913
|
() => createStyles5(
|
|
2005
1914
|
theme,
|
|
2006
1915
|
variant,
|
|
@@ -2023,23 +1932,23 @@ function Chip({
|
|
|
2023
1932
|
]
|
|
2024
1933
|
);
|
|
2025
1934
|
const resolvedIconColor = (0, import_react11.useMemo)(() => {
|
|
2026
|
-
const base =
|
|
2027
|
-
|
|
2028
|
-
isDisabled ?
|
|
1935
|
+
const base = import_react_native16.StyleSheet.flatten([
|
|
1936
|
+
styles3.label,
|
|
1937
|
+
isDisabled ? styles3.disabledLabel : void 0
|
|
2029
1938
|
]);
|
|
2030
1939
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2031
|
-
}, [
|
|
1940
|
+
}, [styles3.label, styles3.disabledLabel, isDisabled]);
|
|
2032
1941
|
const computedLabelStyle = (0, import_react11.useMemo)(
|
|
2033
1942
|
() => [
|
|
2034
|
-
|
|
2035
|
-
isDisabled ?
|
|
1943
|
+
styles3.label,
|
|
1944
|
+
isDisabled ? styles3.disabledLabel : void 0,
|
|
2036
1945
|
labelStyleOverride
|
|
2037
1946
|
],
|
|
2038
|
-
[isDisabled,
|
|
1947
|
+
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
2039
1948
|
);
|
|
2040
1949
|
const renderLeadingContent = () => {
|
|
2041
1950
|
if (variant === "input" && avatar) {
|
|
2042
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native16.View, { style: styles3.avatar, children: avatar });
|
|
2043
1952
|
}
|
|
2044
1953
|
if (leadingIcon) {
|
|
2045
1954
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -2048,7 +1957,7 @@ function Chip({
|
|
|
2048
1957
|
name: leadingIcon,
|
|
2049
1958
|
size: iconSize,
|
|
2050
1959
|
color: resolvedIconColor,
|
|
2051
|
-
style:
|
|
1960
|
+
style: styles3.leadingIcon
|
|
2052
1961
|
}
|
|
2053
1962
|
);
|
|
2054
1963
|
}
|
|
@@ -2059,14 +1968,14 @@ function Chip({
|
|
|
2059
1968
|
name: "check",
|
|
2060
1969
|
size: iconSize,
|
|
2061
1970
|
color: resolvedIconColor,
|
|
2062
|
-
style:
|
|
1971
|
+
style: styles3.leadingIcon
|
|
2063
1972
|
}
|
|
2064
1973
|
);
|
|
2065
1974
|
}
|
|
2066
1975
|
return null;
|
|
2067
1976
|
};
|
|
2068
1977
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2069
|
-
|
|
1978
|
+
import_react_native16.Pressable,
|
|
2070
1979
|
{
|
|
2071
1980
|
...props,
|
|
2072
1981
|
accessibilityRole: "button",
|
|
@@ -2074,27 +1983,27 @@ function Chip({
|
|
|
2074
1983
|
disabled: isDisabled,
|
|
2075
1984
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
2076
1985
|
},
|
|
2077
|
-
hitSlop:
|
|
1986
|
+
hitSlop: import_react_native16.Platform.OS === "web" ? void 0 : 4,
|
|
2078
1987
|
disabled: isDisabled,
|
|
2079
1988
|
style: resolveStyle2(
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
1989
|
+
styles3.container,
|
|
1990
|
+
styles3.hoveredContainer,
|
|
1991
|
+
styles3.pressedContainer,
|
|
1992
|
+
styles3.disabledContainer,
|
|
2084
1993
|
isDisabled,
|
|
2085
1994
|
style
|
|
2086
1995
|
),
|
|
2087
1996
|
children: [
|
|
2088
1997
|
renderLeadingContent(),
|
|
2089
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native16.Text, { style: computedLabelStyle, children }),
|
|
2090
1999
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2091
|
-
|
|
2000
|
+
import_react_native16.Pressable,
|
|
2092
2001
|
{
|
|
2093
2002
|
onPress: onClose,
|
|
2094
2003
|
accessibilityRole: "button",
|
|
2095
2004
|
accessibilityLabel: "Remove",
|
|
2096
2005
|
hitSlop: 4,
|
|
2097
|
-
style:
|
|
2006
|
+
style: styles3.closeButton,
|
|
2098
2007
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2099
2008
|
MaterialCommunityIcons,
|
|
2100
2009
|
{
|
|
@@ -2112,25 +2021,27 @@ function Chip({
|
|
|
2112
2021
|
|
|
2113
2022
|
// src/checkbox/Checkbox.tsx
|
|
2114
2023
|
var import_react12 = require("react");
|
|
2115
|
-
var
|
|
2024
|
+
var import_react_native18 = require("react-native");
|
|
2116
2025
|
var import_core11 = require("@onlynative/core");
|
|
2026
|
+
var import_utils10 = require("@onlynative/utils");
|
|
2117
2027
|
|
|
2118
2028
|
// src/checkbox/styles.ts
|
|
2119
|
-
var
|
|
2029
|
+
var import_react_native17 = require("react-native");
|
|
2030
|
+
var import_utils9 = require("@onlynative/utils");
|
|
2120
2031
|
function getColors(theme, checked) {
|
|
2121
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2032
|
+
const disabledOnSurface38 = (0, import_utils9.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2122
2033
|
if (checked) {
|
|
2123
2034
|
return {
|
|
2124
2035
|
backgroundColor: theme.colors.primary,
|
|
2125
2036
|
borderColor: "transparent",
|
|
2126
2037
|
borderWidth: 0,
|
|
2127
2038
|
iconColor: theme.colors.onPrimary,
|
|
2128
|
-
hoveredBackgroundColor: blendColor(
|
|
2039
|
+
hoveredBackgroundColor: (0, import_utils9.blendColor)(
|
|
2129
2040
|
theme.colors.primary,
|
|
2130
2041
|
theme.colors.onPrimary,
|
|
2131
2042
|
theme.stateLayer.hoveredOpacity
|
|
2132
2043
|
),
|
|
2133
|
-
pressedBackgroundColor: blendColor(
|
|
2044
|
+
pressedBackgroundColor: (0, import_utils9.blendColor)(
|
|
2134
2045
|
theme.colors.primary,
|
|
2135
2046
|
theme.colors.onPrimary,
|
|
2136
2047
|
theme.stateLayer.pressedOpacity
|
|
@@ -2146,11 +2057,11 @@ function getColors(theme, checked) {
|
|
|
2146
2057
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2147
2058
|
borderWidth: 2,
|
|
2148
2059
|
iconColor: "transparent",
|
|
2149
|
-
hoveredBackgroundColor: alphaColor(
|
|
2060
|
+
hoveredBackgroundColor: (0, import_utils9.alphaColor)(
|
|
2150
2061
|
theme.colors.onSurface,
|
|
2151
2062
|
theme.stateLayer.hoveredOpacity
|
|
2152
2063
|
),
|
|
2153
|
-
pressedBackgroundColor: alphaColor(
|
|
2064
|
+
pressedBackgroundColor: (0, import_utils9.alphaColor)(
|
|
2154
2065
|
theme.colors.onSurface,
|
|
2155
2066
|
theme.stateLayer.pressedOpacity
|
|
2156
2067
|
),
|
|
@@ -2170,12 +2081,12 @@ function applyColorOverrides4(theme, colors, containerColor, contentColor) {
|
|
|
2170
2081
|
const overlay = contentColor != null ? contentColor : colors.iconColor;
|
|
2171
2082
|
result.backgroundColor = containerColor;
|
|
2172
2083
|
result.borderColor = containerColor;
|
|
2173
|
-
result.hoveredBackgroundColor = blendColor(
|
|
2084
|
+
result.hoveredBackgroundColor = (0, import_utils9.blendColor)(
|
|
2174
2085
|
containerColor,
|
|
2175
2086
|
overlay,
|
|
2176
2087
|
theme.stateLayer.hoveredOpacity
|
|
2177
2088
|
);
|
|
2178
|
-
result.pressedBackgroundColor = blendColor(
|
|
2089
|
+
result.pressedBackgroundColor = (0, import_utils9.blendColor)(
|
|
2179
2090
|
containerColor,
|
|
2180
2091
|
overlay,
|
|
2181
2092
|
theme.stateLayer.pressedOpacity
|
|
@@ -2192,7 +2103,7 @@ function createStyles6(theme, checked, containerColor, contentColor) {
|
|
|
2192
2103
|
);
|
|
2193
2104
|
const size = 18;
|
|
2194
2105
|
const touchTarget = 48;
|
|
2195
|
-
return
|
|
2106
|
+
return import_react_native17.StyleSheet.create({
|
|
2196
2107
|
container: {
|
|
2197
2108
|
width: touchTarget,
|
|
2198
2109
|
height: touchTarget,
|
|
@@ -2266,26 +2177,26 @@ function Checkbox({
|
|
|
2266
2177
|
}) {
|
|
2267
2178
|
const isDisabled = Boolean(disabled);
|
|
2268
2179
|
const isChecked = Boolean(value);
|
|
2269
|
-
const MaterialCommunityIcons = isChecked ? getMaterialCommunityIcons() : null;
|
|
2180
|
+
const MaterialCommunityIcons = isChecked ? (0, import_utils10.getMaterialCommunityIcons)() : null;
|
|
2270
2181
|
const theme = (0, import_core11.useTheme)();
|
|
2271
|
-
const
|
|
2182
|
+
const styles3 = (0, import_react12.useMemo)(
|
|
2272
2183
|
() => createStyles6(theme, isChecked, containerColor, contentColor),
|
|
2273
2184
|
[theme, isChecked, containerColor, contentColor]
|
|
2274
2185
|
);
|
|
2275
2186
|
const resolvedIconColor = (0, import_react12.useMemo)(() => {
|
|
2276
|
-
const base =
|
|
2277
|
-
|
|
2278
|
-
isDisabled ?
|
|
2187
|
+
const base = import_react_native18.StyleSheet.flatten([
|
|
2188
|
+
styles3.iconColor,
|
|
2189
|
+
isDisabled ? styles3.disabledIconColor : void 0
|
|
2279
2190
|
]);
|
|
2280
2191
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2281
|
-
}, [
|
|
2192
|
+
}, [styles3.iconColor, styles3.disabledIconColor, isDisabled]);
|
|
2282
2193
|
const handlePress = () => {
|
|
2283
2194
|
if (!isDisabled) {
|
|
2284
2195
|
onValueChange == null ? void 0 : onValueChange(!isChecked);
|
|
2285
2196
|
}
|
|
2286
2197
|
};
|
|
2287
2198
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2288
|
-
|
|
2199
|
+
import_react_native18.Pressable,
|
|
2289
2200
|
{
|
|
2290
2201
|
...props,
|
|
2291
2202
|
accessibilityRole: "checkbox",
|
|
@@ -2293,18 +2204,18 @@ function Checkbox({
|
|
|
2293
2204
|
disabled: isDisabled,
|
|
2294
2205
|
checked: isChecked
|
|
2295
2206
|
},
|
|
2296
|
-
hitSlop:
|
|
2207
|
+
hitSlop: import_react_native18.Platform.OS === "web" ? void 0 : 4,
|
|
2297
2208
|
disabled: isDisabled,
|
|
2298
2209
|
onPress: handlePress,
|
|
2299
2210
|
style: resolveStyle3(
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2211
|
+
styles3.container,
|
|
2212
|
+
styles3.hoveredContainer,
|
|
2213
|
+
styles3.pressedContainer,
|
|
2214
|
+
styles3.disabledContainer,
|
|
2304
2215
|
isDisabled,
|
|
2305
2216
|
style
|
|
2306
2217
|
),
|
|
2307
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native18.View, { style: [styles3.box, isDisabled ? styles3.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2308
2219
|
MaterialCommunityIcons,
|
|
2309
2220
|
{
|
|
2310
2221
|
name: "check",
|
|
@@ -2318,22 +2229,23 @@ function Checkbox({
|
|
|
2318
2229
|
|
|
2319
2230
|
// src/radio/Radio.tsx
|
|
2320
2231
|
var import_react13 = require("react");
|
|
2321
|
-
var
|
|
2232
|
+
var import_react_native20 = require("react-native");
|
|
2322
2233
|
var import_core12 = require("@onlynative/core");
|
|
2323
2234
|
|
|
2324
2235
|
// src/radio/styles.ts
|
|
2325
|
-
var
|
|
2236
|
+
var import_react_native19 = require("react-native");
|
|
2237
|
+
var import_utils11 = require("@onlynative/utils");
|
|
2326
2238
|
function getColors2(theme, selected) {
|
|
2327
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2239
|
+
const disabledOnSurface38 = (0, import_utils11.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2328
2240
|
if (selected) {
|
|
2329
2241
|
return {
|
|
2330
2242
|
borderColor: theme.colors.primary,
|
|
2331
2243
|
dotColor: theme.colors.primary,
|
|
2332
|
-
hoveredBackgroundColor: alphaColor(
|
|
2244
|
+
hoveredBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2333
2245
|
theme.colors.primary,
|
|
2334
2246
|
theme.stateLayer.hoveredOpacity
|
|
2335
2247
|
),
|
|
2336
|
-
pressedBackgroundColor: alphaColor(
|
|
2248
|
+
pressedBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2337
2249
|
theme.colors.primary,
|
|
2338
2250
|
theme.stateLayer.pressedOpacity
|
|
2339
2251
|
),
|
|
@@ -2344,11 +2256,11 @@ function getColors2(theme, selected) {
|
|
|
2344
2256
|
return {
|
|
2345
2257
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2346
2258
|
dotColor: "transparent",
|
|
2347
|
-
hoveredBackgroundColor: alphaColor(
|
|
2259
|
+
hoveredBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2348
2260
|
theme.colors.onSurface,
|
|
2349
2261
|
theme.stateLayer.hoveredOpacity
|
|
2350
2262
|
),
|
|
2351
|
-
pressedBackgroundColor: alphaColor(
|
|
2263
|
+
pressedBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2352
2264
|
theme.colors.onSurface,
|
|
2353
2265
|
theme.stateLayer.pressedOpacity
|
|
2354
2266
|
),
|
|
@@ -2362,11 +2274,11 @@ function applyColorOverrides5(theme, colors, containerColor, contentColor) {
|
|
|
2362
2274
|
if (containerColor) {
|
|
2363
2275
|
result.borderColor = containerColor;
|
|
2364
2276
|
result.dotColor = containerColor;
|
|
2365
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
2277
|
+
result.hoveredBackgroundColor = (0, import_utils11.alphaColor)(
|
|
2366
2278
|
containerColor,
|
|
2367
2279
|
theme.stateLayer.hoveredOpacity
|
|
2368
2280
|
);
|
|
2369
|
-
result.pressedBackgroundColor = alphaColor(
|
|
2281
|
+
result.pressedBackgroundColor = (0, import_utils11.alphaColor)(
|
|
2370
2282
|
containerColor,
|
|
2371
2283
|
theme.stateLayer.pressedOpacity
|
|
2372
2284
|
);
|
|
@@ -2386,7 +2298,7 @@ function createStyles7(theme, selected, containerColor, contentColor) {
|
|
|
2386
2298
|
const outerSize = 20;
|
|
2387
2299
|
const innerSize = 10;
|
|
2388
2300
|
const touchTarget = 48;
|
|
2389
|
-
return
|
|
2301
|
+
return import_react_native19.StyleSheet.create({
|
|
2390
2302
|
container: {
|
|
2391
2303
|
width: touchTarget,
|
|
2392
2304
|
height: touchTarget,
|
|
@@ -2461,7 +2373,7 @@ function Radio({
|
|
|
2461
2373
|
const isDisabled = Boolean(disabled);
|
|
2462
2374
|
const isSelected = Boolean(value);
|
|
2463
2375
|
const theme = (0, import_core12.useTheme)();
|
|
2464
|
-
const
|
|
2376
|
+
const styles3 = (0, import_react13.useMemo)(
|
|
2465
2377
|
() => createStyles7(theme, isSelected, containerColor, contentColor),
|
|
2466
2378
|
[theme, isSelected, containerColor, contentColor]
|
|
2467
2379
|
);
|
|
@@ -2471,7 +2383,7 @@ function Radio({
|
|
|
2471
2383
|
}
|
|
2472
2384
|
};
|
|
2473
2385
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2474
|
-
|
|
2386
|
+
import_react_native20.Pressable,
|
|
2475
2387
|
{
|
|
2476
2388
|
...props,
|
|
2477
2389
|
accessibilityRole: "radio",
|
|
@@ -2479,27 +2391,27 @@ function Radio({
|
|
|
2479
2391
|
disabled: isDisabled,
|
|
2480
2392
|
checked: isSelected
|
|
2481
2393
|
},
|
|
2482
|
-
hitSlop:
|
|
2394
|
+
hitSlop: import_react_native20.Platform.OS === "web" ? void 0 : 4,
|
|
2483
2395
|
disabled: isDisabled,
|
|
2484
2396
|
onPress: handlePress,
|
|
2485
2397
|
style: resolveStyle4(
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2398
|
+
styles3.container,
|
|
2399
|
+
styles3.hoveredContainer,
|
|
2400
|
+
styles3.pressedContainer,
|
|
2401
|
+
styles3.disabledContainer,
|
|
2490
2402
|
isDisabled,
|
|
2491
2403
|
style
|
|
2492
2404
|
),
|
|
2493
2405
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2494
|
-
|
|
2406
|
+
import_react_native20.View,
|
|
2495
2407
|
{
|
|
2496
|
-
style: [
|
|
2408
|
+
style: [styles3.outer, isDisabled ? styles3.disabledOuter : void 0],
|
|
2497
2409
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2498
|
-
|
|
2410
|
+
import_react_native20.View,
|
|
2499
2411
|
{
|
|
2500
2412
|
style: [
|
|
2501
|
-
|
|
2502
|
-
isDisabled ?
|
|
2413
|
+
styles3.inner,
|
|
2414
|
+
isDisabled ? styles3.disabledInner : void 0
|
|
2503
2415
|
]
|
|
2504
2416
|
}
|
|
2505
2417
|
) : null
|
|
@@ -2511,25 +2423,27 @@ function Radio({
|
|
|
2511
2423
|
|
|
2512
2424
|
// src/switch/Switch.tsx
|
|
2513
2425
|
var import_react14 = require("react");
|
|
2514
|
-
var
|
|
2426
|
+
var import_react_native22 = require("react-native");
|
|
2515
2427
|
var import_core13 = require("@onlynative/core");
|
|
2428
|
+
var import_utils13 = require("@onlynative/utils");
|
|
2516
2429
|
|
|
2517
2430
|
// src/switch/styles.ts
|
|
2518
|
-
var
|
|
2431
|
+
var import_react_native21 = require("react-native");
|
|
2432
|
+
var import_utils12 = require("@onlynative/utils");
|
|
2519
2433
|
function getColors3(theme, selected) {
|
|
2520
|
-
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
2521
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2434
|
+
const disabledOnSurface12 = (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.12);
|
|
2435
|
+
const disabledOnSurface38 = (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2522
2436
|
if (selected) {
|
|
2523
2437
|
return {
|
|
2524
2438
|
trackColor: theme.colors.primary,
|
|
2525
2439
|
thumbColor: theme.colors.onPrimary,
|
|
2526
2440
|
iconColor: theme.colors.onPrimaryContainer,
|
|
2527
|
-
hoveredTrackColor: blendColor(
|
|
2441
|
+
hoveredTrackColor: (0, import_utils12.blendColor)(
|
|
2528
2442
|
theme.colors.primary,
|
|
2529
2443
|
theme.colors.onPrimary,
|
|
2530
2444
|
theme.stateLayer.hoveredOpacity
|
|
2531
2445
|
),
|
|
2532
|
-
pressedTrackColor: blendColor(
|
|
2446
|
+
pressedTrackColor: (0, import_utils12.blendColor)(
|
|
2533
2447
|
theme.colors.primary,
|
|
2534
2448
|
theme.colors.onPrimary,
|
|
2535
2449
|
theme.stateLayer.pressedOpacity
|
|
@@ -2546,12 +2460,12 @@ function getColors3(theme, selected) {
|
|
|
2546
2460
|
trackColor: theme.colors.surfaceContainerHighest,
|
|
2547
2461
|
thumbColor: theme.colors.outline,
|
|
2548
2462
|
iconColor: theme.colors.surfaceContainerHighest,
|
|
2549
|
-
hoveredTrackColor: blendColor(
|
|
2463
|
+
hoveredTrackColor: (0, import_utils12.blendColor)(
|
|
2550
2464
|
theme.colors.surfaceContainerHighest,
|
|
2551
2465
|
theme.colors.onSurface,
|
|
2552
2466
|
theme.stateLayer.hoveredOpacity
|
|
2553
2467
|
),
|
|
2554
|
-
pressedTrackColor: blendColor(
|
|
2468
|
+
pressedTrackColor: (0, import_utils12.blendColor)(
|
|
2555
2469
|
theme.colors.surfaceContainerHighest,
|
|
2556
2470
|
theme.colors.onSurface,
|
|
2557
2471
|
theme.stateLayer.pressedOpacity
|
|
@@ -2575,12 +2489,12 @@ function applyColorOverrides6(theme, colors, containerColor, contentColor) {
|
|
|
2575
2489
|
const overlay = contentColor != null ? contentColor : colors.thumbColor;
|
|
2576
2490
|
result.trackColor = containerColor;
|
|
2577
2491
|
result.borderColor = containerColor;
|
|
2578
|
-
result.hoveredTrackColor = blendColor(
|
|
2492
|
+
result.hoveredTrackColor = (0, import_utils12.blendColor)(
|
|
2579
2493
|
containerColor,
|
|
2580
2494
|
overlay,
|
|
2581
2495
|
theme.stateLayer.hoveredOpacity
|
|
2582
2496
|
);
|
|
2583
|
-
result.pressedTrackColor = blendColor(
|
|
2497
|
+
result.pressedTrackColor = (0, import_utils12.blendColor)(
|
|
2584
2498
|
containerColor,
|
|
2585
2499
|
overlay,
|
|
2586
2500
|
theme.stateLayer.pressedOpacity
|
|
@@ -2603,7 +2517,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2603
2517
|
const trackHeight = 32;
|
|
2604
2518
|
const trackPadding = 4;
|
|
2605
2519
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
2606
|
-
return
|
|
2520
|
+
return import_react_native21.StyleSheet.create({
|
|
2607
2521
|
track: {
|
|
2608
2522
|
width: trackWidth,
|
|
2609
2523
|
height: trackHeight,
|
|
@@ -2642,7 +2556,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2642
2556
|
color: colors.iconColor
|
|
2643
2557
|
},
|
|
2644
2558
|
disabledIconColor: {
|
|
2645
|
-
color: alphaColor(theme.colors.onSurface, 0.38)
|
|
2559
|
+
color: (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.38)
|
|
2646
2560
|
}
|
|
2647
2561
|
});
|
|
2648
2562
|
}
|
|
@@ -2682,27 +2596,27 @@ function Switch({
|
|
|
2682
2596
|
const isSelected = Boolean(value);
|
|
2683
2597
|
const hasIcon = isSelected || Boolean(unselectedIcon);
|
|
2684
2598
|
const theme = (0, import_core13.useTheme)();
|
|
2685
|
-
const
|
|
2599
|
+
const styles3 = (0, import_react14.useMemo)(
|
|
2686
2600
|
() => createStyles8(theme, isSelected, hasIcon, containerColor, contentColor),
|
|
2687
2601
|
[theme, isSelected, hasIcon, containerColor, contentColor]
|
|
2688
2602
|
);
|
|
2689
2603
|
const resolvedIconColor = (0, import_react14.useMemo)(() => {
|
|
2690
|
-
const base =
|
|
2691
|
-
|
|
2692
|
-
isDisabled ?
|
|
2604
|
+
const base = import_react_native22.StyleSheet.flatten([
|
|
2605
|
+
styles3.iconColor,
|
|
2606
|
+
isDisabled ? styles3.disabledIconColor : void 0
|
|
2693
2607
|
]);
|
|
2694
2608
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2695
|
-
}, [
|
|
2609
|
+
}, [styles3.iconColor, styles3.disabledIconColor, isDisabled]);
|
|
2696
2610
|
const handlePress = () => {
|
|
2697
2611
|
if (!isDisabled) {
|
|
2698
2612
|
onValueChange == null ? void 0 : onValueChange(!isSelected);
|
|
2699
2613
|
}
|
|
2700
2614
|
};
|
|
2701
2615
|
const iconName = isSelected ? selectedIcon : unselectedIcon;
|
|
2702
|
-
const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
|
|
2616
|
+
const MaterialCommunityIcons = iconName ? (0, import_utils13.getMaterialCommunityIcons)() : null;
|
|
2703
2617
|
const iconSize = 16;
|
|
2704
2618
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2705
|
-
|
|
2619
|
+
import_react_native22.Pressable,
|
|
2706
2620
|
{
|
|
2707
2621
|
...props,
|
|
2708
2622
|
accessibilityRole: "switch",
|
|
@@ -2710,21 +2624,21 @@ function Switch({
|
|
|
2710
2624
|
disabled: isDisabled,
|
|
2711
2625
|
checked: isSelected
|
|
2712
2626
|
},
|
|
2713
|
-
hitSlop:
|
|
2627
|
+
hitSlop: import_react_native22.Platform.OS === "web" ? void 0 : 4,
|
|
2714
2628
|
disabled: isDisabled,
|
|
2715
2629
|
onPress: handlePress,
|
|
2716
2630
|
style: resolveStyle5(
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2631
|
+
styles3.track,
|
|
2632
|
+
styles3.hoveredTrack,
|
|
2633
|
+
styles3.pressedTrack,
|
|
2634
|
+
styles3.disabledTrack,
|
|
2721
2635
|
isDisabled,
|
|
2722
2636
|
style
|
|
2723
2637
|
),
|
|
2724
2638
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2725
|
-
|
|
2639
|
+
import_react_native22.View,
|
|
2726
2640
|
{
|
|
2727
|
-
style: [
|
|
2641
|
+
style: [styles3.thumb, isDisabled ? styles3.disabledThumb : void 0],
|
|
2728
2642
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2729
2643
|
MaterialCommunityIcons,
|
|
2730
2644
|
{
|
|
@@ -2741,11 +2655,13 @@ function Switch({
|
|
|
2741
2655
|
|
|
2742
2656
|
// src/text-field/TextField.tsx
|
|
2743
2657
|
var import_react15 = require("react");
|
|
2744
|
-
var
|
|
2658
|
+
var import_react_native24 = require("react-native");
|
|
2745
2659
|
var import_core14 = require("@onlynative/core");
|
|
2660
|
+
var import_utils15 = require("@onlynative/utils");
|
|
2746
2661
|
|
|
2747
2662
|
// src/text-field/styles.ts
|
|
2748
|
-
var
|
|
2663
|
+
var import_react_native23 = require("react-native");
|
|
2664
|
+
var import_utils14 = require("@onlynative/utils");
|
|
2749
2665
|
var CONTAINER_HEIGHT = 56;
|
|
2750
2666
|
var ICON_SIZE = 24;
|
|
2751
2667
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -2770,15 +2686,15 @@ function getVariantColors4(theme, variant) {
|
|
|
2770
2686
|
focusedLabelColor: theme.colors.primary,
|
|
2771
2687
|
errorLabelColor: theme.colors.error,
|
|
2772
2688
|
textColor: theme.colors.onSurface,
|
|
2773
|
-
disabledTextColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2774
|
-
disabledLabelColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2775
|
-
disabledBorderColor: alphaColor(theme.colors.onSurface, 0.12),
|
|
2689
|
+
disabledTextColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity),
|
|
2690
|
+
disabledLabelColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity),
|
|
2691
|
+
disabledBorderColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, 0.12),
|
|
2776
2692
|
placeholderColor: theme.colors.onSurfaceVariant,
|
|
2777
2693
|
supportingTextColor: theme.colors.onSurfaceVariant,
|
|
2778
2694
|
errorSupportingTextColor: theme.colors.error,
|
|
2779
2695
|
iconColor: theme.colors.onSurfaceVariant,
|
|
2780
2696
|
errorIconColor: theme.colors.error,
|
|
2781
|
-
disabledIconColor: alphaColor(theme.colors.onSurface, disabledOpacity)
|
|
2697
|
+
disabledIconColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity)
|
|
2782
2698
|
};
|
|
2783
2699
|
if (variant === "outlined") {
|
|
2784
2700
|
return {
|
|
@@ -2793,7 +2709,7 @@ function getVariantColors4(theme, variant) {
|
|
|
2793
2709
|
...common,
|
|
2794
2710
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
2795
2711
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2796
|
-
disabledBackgroundColor: alphaColor(theme.colors.onSurface, 0.04),
|
|
2712
|
+
disabledBackgroundColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, 0.04),
|
|
2797
2713
|
labelColor: theme.colors.onSurfaceVariant
|
|
2798
2714
|
};
|
|
2799
2715
|
}
|
|
@@ -2804,7 +2720,7 @@ function createStyles9(theme, variant) {
|
|
|
2804
2720
|
const isFilled = variant === "filled";
|
|
2805
2721
|
return {
|
|
2806
2722
|
colors,
|
|
2807
|
-
styles:
|
|
2723
|
+
styles: import_react_native23.StyleSheet.create({
|
|
2808
2724
|
root: {
|
|
2809
2725
|
alignSelf: "stretch"
|
|
2810
2726
|
},
|
|
@@ -2875,7 +2791,7 @@ function createStyles9(theme, variant) {
|
|
|
2875
2791
|
fontWeight: bodySmall.fontWeight,
|
|
2876
2792
|
letterSpacing: bodySmall.letterSpacing,
|
|
2877
2793
|
color: colors.labelColor,
|
|
2878
|
-
transformOrigin: transformOrigin("top")
|
|
2794
|
+
transformOrigin: (0, import_utils14.transformOrigin)("top")
|
|
2879
2795
|
},
|
|
2880
2796
|
labelNotch: {
|
|
2881
2797
|
paddingHorizontal: 4
|
|
@@ -2968,8 +2884,8 @@ function TextField({
|
|
|
2968
2884
|
const isError = Boolean(error) || Boolean(errorText);
|
|
2969
2885
|
const isFilled = variant === "filled";
|
|
2970
2886
|
const hasLeadingIcon = Boolean(leadingIcon);
|
|
2971
|
-
const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
|
|
2972
|
-
const { colors, styles:
|
|
2887
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? (0, import_utils15.getMaterialCommunityIcons)() : null;
|
|
2888
|
+
const { colors, styles: styles3 } = (0, import_react15.useMemo)(
|
|
2973
2889
|
() => createStyles9(theme, variant),
|
|
2974
2890
|
[theme, variant]
|
|
2975
2891
|
);
|
|
@@ -2981,13 +2897,13 @@ function TextField({
|
|
|
2981
2897
|
const isControlled = value !== void 0;
|
|
2982
2898
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
2983
2899
|
const isLabelFloated = isFocused || hasValue;
|
|
2984
|
-
const labelAnimRef = (0, import_react15.useRef)(new
|
|
2900
|
+
const labelAnimRef = (0, import_react15.useRef)(new import_react_native24.Animated.Value(isLabelFloated ? 1 : 0));
|
|
2985
2901
|
const labelAnim = labelAnimRef.current;
|
|
2986
2902
|
(0, import_react15.useEffect)(() => {
|
|
2987
|
-
|
|
2903
|
+
import_react_native24.Animated.timing(labelAnim, {
|
|
2988
2904
|
toValue: isLabelFloated ? 1 : 0,
|
|
2989
2905
|
duration: 150,
|
|
2990
|
-
useNativeDriver:
|
|
2906
|
+
useNativeDriver: import_react_native24.Platform.OS !== "web"
|
|
2991
2907
|
}).start();
|
|
2992
2908
|
}, [isLabelFloated, labelAnim]);
|
|
2993
2909
|
const labelScale = (0, import_react15.useMemo)(() => {
|
|
@@ -3047,27 +2963,27 @@ function TextField({
|
|
|
3047
2963
|
const iconColor = isDisabled ? colors.disabledIconColor : isError ? colors.errorIconColor : contentColor != null ? contentColor : colors.iconColor;
|
|
3048
2964
|
const containerStyle = (0, import_react15.useMemo)(
|
|
3049
2965
|
() => [
|
|
3050
|
-
|
|
2966
|
+
styles3.container,
|
|
3051
2967
|
containerColor && !isDisabled ? { backgroundColor: containerColor } : void 0,
|
|
3052
|
-
isFocused &&
|
|
3053
|
-
isError && !isFocused &&
|
|
3054
|
-
isDisabled &&
|
|
2968
|
+
isFocused && styles3.containerFocused,
|
|
2969
|
+
isError && !isFocused && styles3.containerError,
|
|
2970
|
+
isDisabled && styles3.containerDisabled
|
|
3055
2971
|
],
|
|
3056
|
-
[
|
|
2972
|
+
[styles3, isFocused, isError, isDisabled, containerColor]
|
|
3057
2973
|
);
|
|
3058
2974
|
const indicatorStyle = (0, import_react15.useMemo)(
|
|
3059
2975
|
() => [
|
|
3060
|
-
|
|
3061
|
-
isFocused &&
|
|
3062
|
-
isError && !isFocused &&
|
|
3063
|
-
isDisabled &&
|
|
2976
|
+
styles3.indicator,
|
|
2977
|
+
isFocused && styles3.indicatorFocused,
|
|
2978
|
+
isError && !isFocused && styles3.indicatorError,
|
|
2979
|
+
isDisabled && styles3.indicatorDisabled
|
|
3064
2980
|
],
|
|
3065
|
-
[
|
|
2981
|
+
[styles3, isFocused, isError, isDisabled]
|
|
3066
2982
|
);
|
|
3067
2983
|
const displaySupportingText = isError ? errorText : supportingText;
|
|
3068
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3069
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3070
|
-
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native24.View, { style: [styles3.root, style], children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native24.View, { style: containerStyle, children: [
|
|
2986
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3071
2987
|
MaterialCommunityIcons,
|
|
3072
2988
|
{
|
|
3073
2989
|
name: leadingIcon,
|
|
@@ -3076,14 +2992,14 @@ function TextField({
|
|
|
3076
2992
|
}
|
|
3077
2993
|
) }) : null,
|
|
3078
2994
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3079
|
-
|
|
2995
|
+
import_react_native24.View,
|
|
3080
2996
|
{
|
|
3081
2997
|
style: [
|
|
3082
|
-
|
|
3083
|
-
label ?
|
|
2998
|
+
styles3.inputWrapper,
|
|
2999
|
+
label ? styles3.inputWrapperWithLabel : void 0
|
|
3084
3000
|
],
|
|
3085
3001
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3086
|
-
|
|
3002
|
+
import_react_native24.TextInput,
|
|
3087
3003
|
{
|
|
3088
3004
|
ref: inputRef,
|
|
3089
3005
|
...textInputProps,
|
|
@@ -3096,8 +3012,8 @@ function TextField({
|
|
|
3096
3012
|
placeholderTextColor: colors.placeholderColor,
|
|
3097
3013
|
multiline,
|
|
3098
3014
|
style: [
|
|
3099
|
-
|
|
3100
|
-
isDisabled ?
|
|
3015
|
+
styles3.input,
|
|
3016
|
+
isDisabled ? styles3.inputDisabled : void 0,
|
|
3101
3017
|
contentColor && !isDisabled ? { color: contentColor } : void 0,
|
|
3102
3018
|
inputStyle
|
|
3103
3019
|
],
|
|
@@ -3109,14 +3025,14 @@ function TextField({
|
|
|
3109
3025
|
}
|
|
3110
3026
|
),
|
|
3111
3027
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3112
|
-
|
|
3028
|
+
import_react_native24.Pressable,
|
|
3113
3029
|
{
|
|
3114
3030
|
onPress: onTrailingIconPress,
|
|
3115
3031
|
disabled: isDisabled || !onTrailingIconPress,
|
|
3116
3032
|
accessibilityRole: "button",
|
|
3117
3033
|
hitSlop: 12,
|
|
3118
|
-
style:
|
|
3119
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3034
|
+
style: styles3.trailingIconPressable,
|
|
3035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3120
3036
|
MaterialCommunityIcons,
|
|
3121
3037
|
{
|
|
3122
3038
|
name: trailingIcon,
|
|
@@ -3127,11 +3043,11 @@ function TextField({
|
|
|
3127
3043
|
}
|
|
3128
3044
|
) : null,
|
|
3129
3045
|
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3130
|
-
|
|
3046
|
+
import_react_native24.Animated.Text,
|
|
3131
3047
|
{
|
|
3132
3048
|
numberOfLines: 1,
|
|
3133
3049
|
style: [
|
|
3134
|
-
|
|
3050
|
+
styles3.label,
|
|
3135
3051
|
{
|
|
3136
3052
|
top: labelStaticTop,
|
|
3137
3053
|
start: labelStart,
|
|
@@ -3142,19 +3058,19 @@ function TextField({
|
|
|
3142
3058
|
{ scale: labelScale }
|
|
3143
3059
|
]
|
|
3144
3060
|
},
|
|
3145
|
-
variant === "outlined" && isLabelFloated ?
|
|
3061
|
+
variant === "outlined" && isLabelFloated ? styles3.labelNotch : void 0
|
|
3146
3062
|
],
|
|
3147
3063
|
children: label
|
|
3148
3064
|
}
|
|
3149
3065
|
) : null,
|
|
3150
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3066
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: indicatorStyle }) : null
|
|
3151
3067
|
] }) }),
|
|
3152
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3153
|
-
|
|
3068
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3069
|
+
import_react_native24.Text,
|
|
3154
3070
|
{
|
|
3155
3071
|
style: [
|
|
3156
|
-
|
|
3157
|
-
isError ?
|
|
3072
|
+
styles3.supportingText,
|
|
3073
|
+
isError ? styles3.errorSupportingText : void 0
|
|
3158
3074
|
],
|
|
3159
3075
|
children: displaySupportingText
|
|
3160
3076
|
}
|
|
@@ -3164,11 +3080,12 @@ function TextField({
|
|
|
3164
3080
|
|
|
3165
3081
|
// src/list/List.tsx
|
|
3166
3082
|
var import_react16 = require("react");
|
|
3167
|
-
var
|
|
3083
|
+
var import_react_native26 = require("react-native");
|
|
3168
3084
|
var import_core15 = require("@onlynative/core");
|
|
3169
3085
|
|
|
3170
3086
|
// src/list/styles.ts
|
|
3171
|
-
var
|
|
3087
|
+
var import_react_native25 = require("react-native");
|
|
3088
|
+
var import_utils16 = require("@onlynative/utils");
|
|
3172
3089
|
var ITEM_PADDING_VERTICAL = 12;
|
|
3173
3090
|
var INSET_START = 56;
|
|
3174
3091
|
var MIN_HEIGHT = {
|
|
@@ -3177,7 +3094,7 @@ var MIN_HEIGHT = {
|
|
|
3177
3094
|
3: 88
|
|
3178
3095
|
};
|
|
3179
3096
|
function createListStyles(theme) {
|
|
3180
|
-
return
|
|
3097
|
+
return import_react_native25.StyleSheet.create({
|
|
3181
3098
|
container: {
|
|
3182
3099
|
paddingVertical: theme.spacing.sm
|
|
3183
3100
|
}
|
|
@@ -3188,12 +3105,12 @@ function getItemColors(theme, containerColor) {
|
|
|
3188
3105
|
if (containerColor) {
|
|
3189
3106
|
return {
|
|
3190
3107
|
backgroundColor: containerColor,
|
|
3191
|
-
hoveredBackgroundColor: blendColor(
|
|
3108
|
+
hoveredBackgroundColor: (0, import_utils16.blendColor)(
|
|
3192
3109
|
containerColor,
|
|
3193
3110
|
theme.colors.onSurface,
|
|
3194
3111
|
theme.stateLayer.hoveredOpacity
|
|
3195
3112
|
),
|
|
3196
|
-
pressedBackgroundColor: blendColor(
|
|
3113
|
+
pressedBackgroundColor: (0, import_utils16.blendColor)(
|
|
3197
3114
|
containerColor,
|
|
3198
3115
|
theme.colors.onSurface,
|
|
3199
3116
|
theme.stateLayer.pressedOpacity
|
|
@@ -3202,11 +3119,11 @@ function getItemColors(theme, containerColor) {
|
|
|
3202
3119
|
}
|
|
3203
3120
|
return {
|
|
3204
3121
|
backgroundColor: base,
|
|
3205
|
-
hoveredBackgroundColor: alphaColor(
|
|
3122
|
+
hoveredBackgroundColor: (0, import_utils16.alphaColor)(
|
|
3206
3123
|
theme.colors.onSurface,
|
|
3207
3124
|
theme.stateLayer.hoveredOpacity
|
|
3208
3125
|
),
|
|
3209
|
-
pressedBackgroundColor: alphaColor(
|
|
3126
|
+
pressedBackgroundColor: (0, import_utils16.alphaColor)(
|
|
3210
3127
|
theme.colors.onSurface,
|
|
3211
3128
|
theme.stateLayer.pressedOpacity
|
|
3212
3129
|
)
|
|
@@ -3214,7 +3131,7 @@ function getItemColors(theme, containerColor) {
|
|
|
3214
3131
|
}
|
|
3215
3132
|
function createListItemStyles(theme, lines, containerColor) {
|
|
3216
3133
|
const colors = getItemColors(theme, containerColor);
|
|
3217
|
-
return
|
|
3134
|
+
return import_react_native25.StyleSheet.create({
|
|
3218
3135
|
container: {
|
|
3219
3136
|
flexDirection: "row",
|
|
3220
3137
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -3269,7 +3186,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
3269
3186
|
});
|
|
3270
3187
|
}
|
|
3271
3188
|
function createDividerStyles(theme, inset) {
|
|
3272
|
-
return
|
|
3189
|
+
return import_react_native25.StyleSheet.create({
|
|
3273
3190
|
divider: {
|
|
3274
3191
|
height: 1,
|
|
3275
3192
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -3282,13 +3199,13 @@ function createDividerStyles(theme, inset) {
|
|
|
3282
3199
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3283
3200
|
function List({ children, style, ...props }) {
|
|
3284
3201
|
const theme = (0, import_core15.useTheme)();
|
|
3285
|
-
const
|
|
3286
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3202
|
+
const styles3 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
|
|
3203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native26.View, { ...props, style: [styles3.container, style], children });
|
|
3287
3204
|
}
|
|
3288
3205
|
|
|
3289
3206
|
// src/list/ListItem.tsx
|
|
3290
3207
|
var import_react17 = require("react");
|
|
3291
|
-
var
|
|
3208
|
+
var import_react_native27 = require("react-native");
|
|
3292
3209
|
var import_core16 = require("@onlynative/core");
|
|
3293
3210
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3294
3211
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
@@ -3316,58 +3233,58 @@ function ListItem({
|
|
|
3316
3233
|
const isInteractive = onPress !== void 0;
|
|
3317
3234
|
const theme = (0, import_core16.useTheme)();
|
|
3318
3235
|
const lines = getLines(supportingText, overlineText, supportingTextNumberOfLines);
|
|
3319
|
-
const
|
|
3236
|
+
const styles3 = (0, import_react17.useMemo)(
|
|
3320
3237
|
() => createListItemStyles(theme, lines, containerColor),
|
|
3321
3238
|
[theme, lines, containerColor]
|
|
3322
3239
|
);
|
|
3323
3240
|
const content = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3324
|
-
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3325
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3326
|
-
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3327
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3241
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { style: styles3.leadingContent, children: leadingContent }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native27.View, { style: styles3.textBlock, children: [
|
|
3243
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.overlineText, numberOfLines: 1, children: overlineText }),
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.headlineText, numberOfLines: 1, children: headlineText }),
|
|
3328
3245
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3329
|
-
|
|
3246
|
+
import_react_native27.Text,
|
|
3330
3247
|
{
|
|
3331
|
-
style:
|
|
3248
|
+
style: styles3.supportingText,
|
|
3332
3249
|
numberOfLines: supportingTextNumberOfLines,
|
|
3333
3250
|
children: supportingText
|
|
3334
3251
|
}
|
|
3335
3252
|
)
|
|
3336
3253
|
] }),
|
|
3337
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3338
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3254
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native27.View, { style: styles3.trailingBlock, children: [
|
|
3255
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
3339
3256
|
trailingContent
|
|
3340
3257
|
] })
|
|
3341
3258
|
] });
|
|
3342
3259
|
if (!isInteractive) {
|
|
3343
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { ...props, style: [styles3.container, style], children: content });
|
|
3344
3261
|
}
|
|
3345
3262
|
const resolvedStyle = (state) => [
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
state.hovered && !state.pressed && !isDisabled ?
|
|
3349
|
-
state.pressed && !isDisabled ?
|
|
3350
|
-
isDisabled ?
|
|
3263
|
+
styles3.container,
|
|
3264
|
+
styles3.interactiveContainer,
|
|
3265
|
+
state.hovered && !state.pressed && !isDisabled ? styles3.hoveredContainer : void 0,
|
|
3266
|
+
state.pressed && !isDisabled ? styles3.pressedContainer : void 0,
|
|
3267
|
+
isDisabled ? styles3.disabledContainer : void 0,
|
|
3351
3268
|
typeof style === "function" ? style(state) : style
|
|
3352
3269
|
];
|
|
3353
3270
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3354
|
-
|
|
3271
|
+
import_react_native27.Pressable,
|
|
3355
3272
|
{
|
|
3356
3273
|
...props,
|
|
3357
3274
|
role: "button",
|
|
3358
3275
|
accessibilityState: { disabled: isDisabled },
|
|
3359
|
-
hitSlop:
|
|
3276
|
+
hitSlop: import_react_native27.Platform.OS === "web" ? void 0 : 4,
|
|
3360
3277
|
disabled: isDisabled,
|
|
3361
3278
|
onPress,
|
|
3362
3279
|
style: resolvedStyle,
|
|
3363
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3280
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { style: styles3.disabledContentWrapper, children: content }) : content
|
|
3364
3281
|
}
|
|
3365
3282
|
);
|
|
3366
3283
|
}
|
|
3367
3284
|
|
|
3368
3285
|
// src/list/ListDivider.tsx
|
|
3369
3286
|
var import_react18 = require("react");
|
|
3370
|
-
var
|
|
3287
|
+
var import_react_native28 = require("react-native");
|
|
3371
3288
|
var import_core17 = require("@onlynative/core");
|
|
3372
3289
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3373
3290
|
function ListDivider({
|
|
@@ -3376,11 +3293,80 @@ function ListDivider({
|
|
|
3376
3293
|
...props
|
|
3377
3294
|
}) {
|
|
3378
3295
|
const theme = (0, import_core17.useTheme)();
|
|
3379
|
-
const
|
|
3296
|
+
const styles3 = (0, import_react18.useMemo)(
|
|
3380
3297
|
() => createDividerStyles(theme, inset),
|
|
3381
3298
|
[theme, inset]
|
|
3382
3299
|
);
|
|
3383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native28.View, { ...props, style: [styles3.divider, style] });
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3304
|
+
var import_react19 = require("react");
|
|
3305
|
+
var import_react_native30 = require("react-native");
|
|
3306
|
+
|
|
3307
|
+
// src/keyboard-avoiding-wrapper/styles.ts
|
|
3308
|
+
var import_react_native29 = require("react-native");
|
|
3309
|
+
var styles2 = import_react_native29.StyleSheet.create({
|
|
3310
|
+
root: {
|
|
3311
|
+
flex: 1
|
|
3312
|
+
},
|
|
3313
|
+
container: {
|
|
3314
|
+
flexGrow: 1
|
|
3315
|
+
}
|
|
3316
|
+
});
|
|
3317
|
+
|
|
3318
|
+
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3319
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3320
|
+
var isIOS = import_react_native30.Platform.OS === "ios";
|
|
3321
|
+
function KeyboardAvoidingWrapper({
|
|
3322
|
+
children,
|
|
3323
|
+
behavior = "padding",
|
|
3324
|
+
keyboardVerticalOffset = 0,
|
|
3325
|
+
enabled = true,
|
|
3326
|
+
scrollViewProps,
|
|
3327
|
+
onKeyboardShow,
|
|
3328
|
+
onKeyboardHide,
|
|
3329
|
+
style,
|
|
3330
|
+
contentContainerStyle
|
|
3331
|
+
}) {
|
|
3332
|
+
(0, import_react19.useEffect)(() => {
|
|
3333
|
+
const subscriptions = [];
|
|
3334
|
+
if (onKeyboardShow) {
|
|
3335
|
+
const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
|
|
3336
|
+
subscriptions.push(
|
|
3337
|
+
import_react_native30.Keyboard.addListener(showEvent, onKeyboardShow)
|
|
3338
|
+
);
|
|
3339
|
+
}
|
|
3340
|
+
if (onKeyboardHide) {
|
|
3341
|
+
const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
|
|
3342
|
+
subscriptions.push(
|
|
3343
|
+
import_react_native30.Keyboard.addListener(hideEvent, onKeyboardHide)
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
return () => {
|
|
3347
|
+
subscriptions.forEach((sub) => sub.remove());
|
|
3348
|
+
};
|
|
3349
|
+
}, [onKeyboardShow, onKeyboardHide]);
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3351
|
+
import_react_native30.KeyboardAvoidingView,
|
|
3352
|
+
{
|
|
3353
|
+
style: [styles2.root, style],
|
|
3354
|
+
behavior,
|
|
3355
|
+
keyboardVerticalOffset,
|
|
3356
|
+
enabled: !isIOS && enabled,
|
|
3357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3358
|
+
import_react_native30.ScrollView,
|
|
3359
|
+
{
|
|
3360
|
+
automaticallyAdjustKeyboardInsets: isIOS && enabled,
|
|
3361
|
+
keyboardShouldPersistTaps: "handled",
|
|
3362
|
+
showsVerticalScrollIndicator: false,
|
|
3363
|
+
...scrollViewProps,
|
|
3364
|
+
contentContainerStyle: [styles2.container, contentContainerStyle],
|
|
3365
|
+
children
|
|
3366
|
+
}
|
|
3367
|
+
)
|
|
3368
|
+
}
|
|
3369
|
+
);
|
|
3384
3370
|
}
|
|
3385
3371
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3386
3372
|
0 && (module.exports = {
|
|
@@ -3393,6 +3379,7 @@ function ListDivider({
|
|
|
3393
3379
|
Column,
|
|
3394
3380
|
Grid,
|
|
3395
3381
|
IconButton,
|
|
3382
|
+
KeyboardAvoidingWrapper,
|
|
3396
3383
|
Layout,
|
|
3397
3384
|
List,
|
|
3398
3385
|
ListDivider,
|