@onlynative/components 0.1.0 → 0.1.1-alpha.1
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 +133 -62
- package/dist/button/index.js +125 -33
- package/dist/card/index.js +88 -20
- package/dist/checkbox/index.js +88 -17
- package/dist/chip/index.js +122 -30
- package/dist/icon-button/index.js +107 -36
- package/dist/index.js +335 -251
- package/dist/list/index.js +71 -24
- package/dist/radio/index.js +43 -14
- package/dist/switch/index.js +90 -19
- package/dist/text-field/index.js +82 -26
- package/package.json +4 -23
- package/src/appbar/AppBar.tsx +0 -302
- package/src/appbar/index.ts +0 -2
- package/src/appbar/styles.ts +0 -92
- package/src/appbar/types.ts +0 -67
- package/src/button/Button.tsx +0 -133
- package/src/button/index.ts +0 -2
- package/src/button/styles.ts +0 -287
- package/src/button/types.ts +0 -42
- package/src/card/Card.tsx +0 -69
- package/src/card/index.ts +0 -2
- package/src/card/styles.ts +0 -150
- package/src/card/types.ts +0 -27
- package/src/checkbox/Checkbox.tsx +0 -113
- package/src/checkbox/index.ts +0 -2
- package/src/checkbox/styles.ts +0 -155
- package/src/checkbox/types.ts +0 -20
- package/src/chip/Chip.tsx +0 -188
- package/src/chip/index.ts +0 -2
- package/src/chip/styles.ts +0 -239
- package/src/chip/types.ts +0 -58
- package/src/icon-button/IconButton.tsx +0 -362
- package/src/icon-button/index.ts +0 -6
- package/src/icon-button/styles.ts +0 -259
- package/src/icon-button/types.ts +0 -55
- package/src/index.ts +0 -54
- package/src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx +0 -69
- package/src/keyboard-avoiding-wrapper/index.ts +0 -2
- package/src/keyboard-avoiding-wrapper/styles.ts +0 -10
- package/src/keyboard-avoiding-wrapper/types.ts +0 -37
- package/src/layout/Box.tsx +0 -99
- package/src/layout/Column.tsx +0 -16
- package/src/layout/Grid.tsx +0 -49
- package/src/layout/Layout.tsx +0 -81
- package/src/layout/Row.tsx +0 -22
- package/src/layout/index.ts +0 -13
- package/src/layout/resolveSpacing.ts +0 -11
- package/src/layout/types.ts +0 -82
- package/src/list/List.tsx +0 -17
- package/src/list/ListDivider.tsx +0 -20
- package/src/list/ListItem.tsx +0 -128
- package/src/list/index.ts +0 -9
- package/src/list/styles.ts +0 -132
- package/src/list/types.ts +0 -54
- package/src/radio/Radio.tsx +0 -103
- package/src/radio/index.ts +0 -2
- package/src/radio/styles.ts +0 -139
- package/src/radio/types.ts +0 -20
- package/src/switch/Switch.tsx +0 -121
- package/src/switch/index.ts +0 -2
- package/src/switch/styles.ts +0 -172
- package/src/switch/types.ts +0 -32
- package/src/text-field/TextField.tsx +0 -301
- package/src/text-field/index.ts +0 -2
- package/src/text-field/styles.ts +0 -239
- package/src/text-field/types.ts +0 -49
- package/src/typography/Typography.tsx +0 -79
- package/src/typography/index.ts +0 -3
- package/src/typography/types.ts +0 -17
package/dist/index.js
CHANGED
|
@@ -338,30 +338,128 @@ function Grid({
|
|
|
338
338
|
|
|
339
339
|
// src/button/Button.tsx
|
|
340
340
|
var import_react7 = require("react");
|
|
341
|
-
var import_react_native6 = require("react-native");
|
|
342
|
-
var import_react_native7 = require("react-native");
|
|
343
341
|
var import_react_native8 = require("react-native");
|
|
342
|
+
var import_react_native9 = require("react-native");
|
|
343
|
+
var import_react_native10 = require("react-native");
|
|
344
344
|
var import_core5 = require("@onlynative/core");
|
|
345
|
-
var import_utils2 = require("@onlynative/utils");
|
|
346
345
|
|
|
347
|
-
//
|
|
346
|
+
// ../utils/dist/chunk-OQRDRRQA.mjs
|
|
347
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
348
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
349
|
+
}) : x)(function(x) {
|
|
350
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
351
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// ../utils/dist/index.mjs
|
|
348
355
|
var import_react_native5 = require("react-native");
|
|
349
|
-
var
|
|
356
|
+
var import_react_native6 = require("react-native");
|
|
357
|
+
function parseHexColor(color) {
|
|
358
|
+
const normalized = color.replace("#", "");
|
|
359
|
+
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
363
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
364
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
365
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
return { r, g, b };
|
|
369
|
+
}
|
|
370
|
+
function clampAlpha(alpha) {
|
|
371
|
+
return Math.max(0, Math.min(1, alpha));
|
|
372
|
+
}
|
|
373
|
+
function alphaColor(color, alpha) {
|
|
374
|
+
const channels = parseHexColor(color);
|
|
375
|
+
const boundedAlpha = clampAlpha(alpha);
|
|
376
|
+
if (!channels) {
|
|
377
|
+
return color;
|
|
378
|
+
}
|
|
379
|
+
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
380
|
+
}
|
|
381
|
+
function blendColor(base, overlay, overlayAlpha) {
|
|
382
|
+
const baseChannels = parseHexColor(base);
|
|
383
|
+
const overlayChannels = parseHexColor(overlay);
|
|
384
|
+
const boundedAlpha = clampAlpha(overlayAlpha);
|
|
385
|
+
if (!baseChannels || !overlayChannels) {
|
|
386
|
+
return alphaColor(overlay, boundedAlpha);
|
|
387
|
+
}
|
|
388
|
+
const r = Math.round(
|
|
389
|
+
(1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
|
|
390
|
+
);
|
|
391
|
+
const g = Math.round(
|
|
392
|
+
(1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
|
|
393
|
+
);
|
|
394
|
+
const b = Math.round(
|
|
395
|
+
(1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
|
|
396
|
+
);
|
|
397
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
398
|
+
}
|
|
399
|
+
function elevationStyle(level) {
|
|
400
|
+
if (import_react_native5.Platform.OS === "web") {
|
|
401
|
+
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
402
|
+
if (shadowOpacity === 0) {
|
|
403
|
+
return { boxShadow: "none" };
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
boxShadow: `${shadowOffset.width}px ${shadowOffset.height}px ${shadowRadius}px rgba(0, 0, 0, ${shadowOpacity})`
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
shadowColor: level.shadowColor,
|
|
411
|
+
shadowOffset: {
|
|
412
|
+
width: level.shadowOffset.width,
|
|
413
|
+
height: level.shadowOffset.height
|
|
414
|
+
},
|
|
415
|
+
shadowOpacity: level.shadowOpacity,
|
|
416
|
+
shadowRadius: level.shadowRadius,
|
|
417
|
+
elevation: level.elevation
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
var _MCIcons = null;
|
|
421
|
+
var _resolved = false;
|
|
422
|
+
function getMaterialCommunityIcons() {
|
|
423
|
+
if (!_resolved) {
|
|
424
|
+
_resolved = true;
|
|
425
|
+
try {
|
|
426
|
+
const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
|
|
427
|
+
_MCIcons = mod.default || mod;
|
|
428
|
+
} catch {
|
|
429
|
+
_MCIcons = null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (!_MCIcons) {
|
|
433
|
+
throw new Error(
|
|
434
|
+
"@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
return _MCIcons;
|
|
438
|
+
}
|
|
439
|
+
function transformOrigin(vertical = "top") {
|
|
440
|
+
return import_react_native6.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
|
|
441
|
+
}
|
|
442
|
+
function selectRTL(ltr, rtl) {
|
|
443
|
+
return import_react_native6.I18nManager.isRTL ? rtl : ltr;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/button/styles.ts
|
|
447
|
+
var import_react_native7 = require("react-native");
|
|
350
448
|
function getVariantColors(theme, variant) {
|
|
351
|
-
const disabledContainerColor =
|
|
352
|
-
const disabledLabelColor =
|
|
353
|
-
const disabledOutlineColor =
|
|
449
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
450
|
+
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
451
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
354
452
|
if (variant === "outlined") {
|
|
355
453
|
return {
|
|
356
454
|
backgroundColor: "transparent",
|
|
357
455
|
textColor: theme.colors.primary,
|
|
358
456
|
borderColor: theme.colors.outline,
|
|
359
457
|
borderWidth: 1,
|
|
360
|
-
hoveredBackgroundColor:
|
|
458
|
+
hoveredBackgroundColor: alphaColor(
|
|
361
459
|
theme.colors.primary,
|
|
362
460
|
theme.stateLayer.hoveredOpacity
|
|
363
461
|
),
|
|
364
|
-
pressedBackgroundColor:
|
|
462
|
+
pressedBackgroundColor: alphaColor(
|
|
365
463
|
theme.colors.primary,
|
|
366
464
|
theme.stateLayer.pressedOpacity
|
|
367
465
|
),
|
|
@@ -376,11 +474,11 @@ function getVariantColors(theme, variant) {
|
|
|
376
474
|
textColor: theme.colors.primary,
|
|
377
475
|
borderColor: "transparent",
|
|
378
476
|
borderWidth: 0,
|
|
379
|
-
hoveredBackgroundColor:
|
|
477
|
+
hoveredBackgroundColor: alphaColor(
|
|
380
478
|
theme.colors.primary,
|
|
381
479
|
theme.stateLayer.hoveredOpacity
|
|
382
480
|
),
|
|
383
|
-
pressedBackgroundColor:
|
|
481
|
+
pressedBackgroundColor: alphaColor(
|
|
384
482
|
theme.colors.primary,
|
|
385
483
|
theme.stateLayer.pressedOpacity
|
|
386
484
|
),
|
|
@@ -395,12 +493,12 @@ function getVariantColors(theme, variant) {
|
|
|
395
493
|
textColor: theme.colors.primary,
|
|
396
494
|
borderColor: theme.colors.surfaceContainerLow,
|
|
397
495
|
borderWidth: 0,
|
|
398
|
-
hoveredBackgroundColor:
|
|
496
|
+
hoveredBackgroundColor: blendColor(
|
|
399
497
|
theme.colors.surfaceContainerLow,
|
|
400
498
|
theme.colors.primary,
|
|
401
499
|
theme.stateLayer.hoveredOpacity
|
|
402
500
|
),
|
|
403
|
-
pressedBackgroundColor:
|
|
501
|
+
pressedBackgroundColor: blendColor(
|
|
404
502
|
theme.colors.surfaceContainerLow,
|
|
405
503
|
theme.colors.primary,
|
|
406
504
|
theme.stateLayer.pressedOpacity
|
|
@@ -416,12 +514,12 @@ function getVariantColors(theme, variant) {
|
|
|
416
514
|
textColor: theme.colors.onSecondaryContainer,
|
|
417
515
|
borderColor: theme.colors.secondaryContainer,
|
|
418
516
|
borderWidth: 0,
|
|
419
|
-
hoveredBackgroundColor:
|
|
517
|
+
hoveredBackgroundColor: blendColor(
|
|
420
518
|
theme.colors.secondaryContainer,
|
|
421
519
|
theme.colors.onSecondaryContainer,
|
|
422
520
|
theme.stateLayer.hoveredOpacity
|
|
423
521
|
),
|
|
424
|
-
pressedBackgroundColor:
|
|
522
|
+
pressedBackgroundColor: blendColor(
|
|
425
523
|
theme.colors.secondaryContainer,
|
|
426
524
|
theme.colors.onSecondaryContainer,
|
|
427
525
|
theme.stateLayer.pressedOpacity
|
|
@@ -436,12 +534,12 @@ function getVariantColors(theme, variant) {
|
|
|
436
534
|
textColor: theme.colors.onPrimary,
|
|
437
535
|
borderColor: theme.colors.primary,
|
|
438
536
|
borderWidth: 0,
|
|
439
|
-
hoveredBackgroundColor:
|
|
537
|
+
hoveredBackgroundColor: blendColor(
|
|
440
538
|
theme.colors.primary,
|
|
441
539
|
theme.colors.onPrimary,
|
|
442
540
|
theme.stateLayer.hoveredOpacity
|
|
443
541
|
),
|
|
444
|
-
pressedBackgroundColor:
|
|
542
|
+
pressedBackgroundColor: blendColor(
|
|
445
543
|
theme.colors.primary,
|
|
446
544
|
theme.colors.onPrimary,
|
|
447
545
|
theme.stateLayer.pressedOpacity
|
|
@@ -473,33 +571,33 @@ function applyColorOverrides(theme, colors, containerColor, contentColor) {
|
|
|
473
571
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
474
572
|
result.backgroundColor = containerColor;
|
|
475
573
|
result.borderColor = containerColor;
|
|
476
|
-
result.hoveredBackgroundColor =
|
|
574
|
+
result.hoveredBackgroundColor = blendColor(
|
|
477
575
|
containerColor,
|
|
478
576
|
overlay,
|
|
479
577
|
theme.stateLayer.hoveredOpacity
|
|
480
578
|
);
|
|
481
|
-
result.pressedBackgroundColor =
|
|
579
|
+
result.pressedBackgroundColor = blendColor(
|
|
482
580
|
containerColor,
|
|
483
581
|
overlay,
|
|
484
582
|
theme.stateLayer.pressedOpacity
|
|
485
583
|
);
|
|
486
584
|
} else if (contentColor) {
|
|
487
585
|
if (colors.backgroundColor === "transparent") {
|
|
488
|
-
result.hoveredBackgroundColor =
|
|
586
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
489
587
|
contentColor,
|
|
490
588
|
theme.stateLayer.hoveredOpacity
|
|
491
589
|
);
|
|
492
|
-
result.pressedBackgroundColor =
|
|
590
|
+
result.pressedBackgroundColor = alphaColor(
|
|
493
591
|
contentColor,
|
|
494
592
|
theme.stateLayer.pressedOpacity
|
|
495
593
|
);
|
|
496
594
|
} else {
|
|
497
|
-
result.hoveredBackgroundColor =
|
|
595
|
+
result.hoveredBackgroundColor = blendColor(
|
|
498
596
|
colors.backgroundColor,
|
|
499
597
|
contentColor,
|
|
500
598
|
theme.stateLayer.hoveredOpacity
|
|
501
599
|
);
|
|
502
|
-
result.pressedBackgroundColor =
|
|
600
|
+
result.pressedBackgroundColor = blendColor(
|
|
503
601
|
colors.backgroundColor,
|
|
504
602
|
contentColor,
|
|
505
603
|
theme.stateLayer.pressedOpacity
|
|
@@ -523,11 +621,11 @@ function createStyles(theme, variant, hasLeadingIcon, hasTrailingIcon, container
|
|
|
523
621
|
hasLeadingIcon,
|
|
524
622
|
hasTrailingIcon
|
|
525
623
|
);
|
|
526
|
-
const elevationLevel0 =
|
|
527
|
-
const elevationLevel1 =
|
|
528
|
-
const elevationLevel2 =
|
|
624
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
625
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
626
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
529
627
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
530
|
-
return
|
|
628
|
+
return import_react_native7.StyleSheet.create({
|
|
531
629
|
container: {
|
|
532
630
|
alignSelf: "flex-start",
|
|
533
631
|
alignItems: "center",
|
|
@@ -626,9 +724,9 @@ function Button({
|
|
|
626
724
|
),
|
|
627
725
|
[theme, variant, hasLeading, hasTrailing, containerColor, contentColor]
|
|
628
726
|
);
|
|
629
|
-
const MaterialCommunityIcons = leadingIcon || trailingIcon ?
|
|
727
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
|
|
630
728
|
const resolvedIconColor = (0, import_react7.useMemo)(() => {
|
|
631
|
-
const base =
|
|
729
|
+
const base = import_react_native9.StyleSheet.flatten([
|
|
632
730
|
styles3.label,
|
|
633
731
|
isDisabled ? styles3.disabledLabel : void 0
|
|
634
732
|
]);
|
|
@@ -643,12 +741,12 @@ function Button({
|
|
|
643
741
|
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
644
742
|
);
|
|
645
743
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
646
|
-
|
|
744
|
+
import_react_native8.Pressable,
|
|
647
745
|
{
|
|
648
746
|
...props,
|
|
649
747
|
accessibilityRole: "button",
|
|
650
748
|
accessibilityState: { disabled: isDisabled },
|
|
651
|
-
hitSlop:
|
|
749
|
+
hitSlop: import_react_native8.Platform.OS === "web" ? void 0 : 4,
|
|
652
750
|
disabled: isDisabled,
|
|
653
751
|
style: resolveStyle(
|
|
654
752
|
styles3.container,
|
|
@@ -668,7 +766,7 @@ function Button({
|
|
|
668
766
|
style: styles3.leadingIcon
|
|
669
767
|
}
|
|
670
768
|
) : null,
|
|
671
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: computedLabelStyle, children }),
|
|
672
770
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
673
771
|
MaterialCommunityIcons,
|
|
674
772
|
{
|
|
@@ -685,18 +783,16 @@ function Button({
|
|
|
685
783
|
|
|
686
784
|
// src/icon-button/IconButton.tsx
|
|
687
785
|
var import_react8 = require("react");
|
|
688
|
-
var
|
|
786
|
+
var import_react_native12 = require("react-native");
|
|
689
787
|
var import_core6 = require("@onlynative/core");
|
|
690
|
-
var import_utils4 = require("@onlynative/utils");
|
|
691
788
|
|
|
692
789
|
// src/icon-button/styles.ts
|
|
693
|
-
var
|
|
694
|
-
var import_utils3 = require("@onlynative/utils");
|
|
790
|
+
var import_react_native11 = require("react-native");
|
|
695
791
|
function createStyles2(theme) {
|
|
696
|
-
const disabledContainerColor =
|
|
697
|
-
const disabledOutlineColor =
|
|
792
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
793
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
698
794
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
699
|
-
return
|
|
795
|
+
return import_react_native11.StyleSheet.create({
|
|
700
796
|
container: {
|
|
701
797
|
borderRadius: theme.shape.cornerFull,
|
|
702
798
|
alignItems: "center",
|
|
@@ -762,160 +858,160 @@ function createStyles2(theme) {
|
|
|
762
858
|
},
|
|
763
859
|
// Hover states (M3: 8% state layer)
|
|
764
860
|
hoveredFilled: {
|
|
765
|
-
backgroundColor:
|
|
861
|
+
backgroundColor: blendColor(
|
|
766
862
|
theme.colors.primary,
|
|
767
863
|
theme.colors.onPrimary,
|
|
768
864
|
theme.stateLayer.hoveredOpacity
|
|
769
865
|
)
|
|
770
866
|
},
|
|
771
867
|
hoveredFilledToggleUnselected: {
|
|
772
|
-
backgroundColor:
|
|
868
|
+
backgroundColor: blendColor(
|
|
773
869
|
toggleUnselectedContainerColor,
|
|
774
870
|
theme.colors.primary,
|
|
775
871
|
theme.stateLayer.hoveredOpacity
|
|
776
872
|
)
|
|
777
873
|
},
|
|
778
874
|
hoveredFilledToggleSelected: {
|
|
779
|
-
backgroundColor:
|
|
875
|
+
backgroundColor: blendColor(
|
|
780
876
|
theme.colors.primary,
|
|
781
877
|
theme.colors.onPrimary,
|
|
782
878
|
theme.stateLayer.hoveredOpacity
|
|
783
879
|
)
|
|
784
880
|
},
|
|
785
881
|
hoveredTonal: {
|
|
786
|
-
backgroundColor:
|
|
882
|
+
backgroundColor: blendColor(
|
|
787
883
|
theme.colors.secondaryContainer,
|
|
788
884
|
theme.colors.onSecondaryContainer,
|
|
789
885
|
theme.stateLayer.hoveredOpacity
|
|
790
886
|
)
|
|
791
887
|
},
|
|
792
888
|
hoveredTonalToggleUnselected: {
|
|
793
|
-
backgroundColor:
|
|
889
|
+
backgroundColor: blendColor(
|
|
794
890
|
toggleUnselectedContainerColor,
|
|
795
891
|
theme.colors.onSurfaceVariant,
|
|
796
892
|
theme.stateLayer.hoveredOpacity
|
|
797
893
|
)
|
|
798
894
|
},
|
|
799
895
|
hoveredTonalToggleSelected: {
|
|
800
|
-
backgroundColor:
|
|
896
|
+
backgroundColor: blendColor(
|
|
801
897
|
theme.colors.secondaryContainer,
|
|
802
898
|
theme.colors.onSecondaryContainer,
|
|
803
899
|
theme.stateLayer.hoveredOpacity
|
|
804
900
|
)
|
|
805
901
|
},
|
|
806
902
|
hoveredOutlined: {
|
|
807
|
-
backgroundColor:
|
|
903
|
+
backgroundColor: alphaColor(
|
|
808
904
|
theme.colors.onSurfaceVariant,
|
|
809
905
|
theme.stateLayer.hoveredOpacity
|
|
810
906
|
)
|
|
811
907
|
},
|
|
812
908
|
hoveredOutlinedToggleUnselected: {
|
|
813
|
-
backgroundColor:
|
|
909
|
+
backgroundColor: alphaColor(
|
|
814
910
|
theme.colors.onSurfaceVariant,
|
|
815
911
|
theme.stateLayer.hoveredOpacity
|
|
816
912
|
)
|
|
817
913
|
},
|
|
818
914
|
hoveredOutlinedToggleSelected: {
|
|
819
|
-
backgroundColor:
|
|
915
|
+
backgroundColor: blendColor(
|
|
820
916
|
theme.colors.inverseSurface,
|
|
821
917
|
theme.colors.inverseOnSurface,
|
|
822
918
|
theme.stateLayer.hoveredOpacity
|
|
823
919
|
)
|
|
824
920
|
},
|
|
825
921
|
hoveredStandard: {
|
|
826
|
-
backgroundColor:
|
|
922
|
+
backgroundColor: alphaColor(
|
|
827
923
|
theme.colors.onSurfaceVariant,
|
|
828
924
|
theme.stateLayer.hoveredOpacity
|
|
829
925
|
)
|
|
830
926
|
},
|
|
831
927
|
hoveredStandardToggleUnselected: {
|
|
832
|
-
backgroundColor:
|
|
928
|
+
backgroundColor: alphaColor(
|
|
833
929
|
theme.colors.onSurfaceVariant,
|
|
834
930
|
theme.stateLayer.hoveredOpacity
|
|
835
931
|
)
|
|
836
932
|
},
|
|
837
933
|
hoveredStandardToggleSelected: {
|
|
838
|
-
backgroundColor:
|
|
934
|
+
backgroundColor: alphaColor(
|
|
839
935
|
theme.colors.primary,
|
|
840
936
|
theme.stateLayer.hoveredOpacity
|
|
841
937
|
)
|
|
842
938
|
},
|
|
843
939
|
// Pressed states (M3: 12% state layer)
|
|
844
940
|
pressedFilled: {
|
|
845
|
-
backgroundColor:
|
|
941
|
+
backgroundColor: blendColor(
|
|
846
942
|
theme.colors.primary,
|
|
847
943
|
theme.colors.onPrimary,
|
|
848
944
|
theme.stateLayer.pressedOpacity
|
|
849
945
|
)
|
|
850
946
|
},
|
|
851
947
|
pressedFilledToggleUnselected: {
|
|
852
|
-
backgroundColor:
|
|
948
|
+
backgroundColor: blendColor(
|
|
853
949
|
toggleUnselectedContainerColor,
|
|
854
950
|
theme.colors.primary,
|
|
855
951
|
theme.stateLayer.pressedOpacity
|
|
856
952
|
)
|
|
857
953
|
},
|
|
858
954
|
pressedFilledToggleSelected: {
|
|
859
|
-
backgroundColor:
|
|
955
|
+
backgroundColor: blendColor(
|
|
860
956
|
theme.colors.primary,
|
|
861
957
|
theme.colors.onPrimary,
|
|
862
958
|
theme.stateLayer.pressedOpacity
|
|
863
959
|
)
|
|
864
960
|
},
|
|
865
961
|
pressedTonal: {
|
|
866
|
-
backgroundColor:
|
|
962
|
+
backgroundColor: blendColor(
|
|
867
963
|
theme.colors.secondaryContainer,
|
|
868
964
|
theme.colors.onSecondaryContainer,
|
|
869
965
|
theme.stateLayer.pressedOpacity
|
|
870
966
|
)
|
|
871
967
|
},
|
|
872
968
|
pressedTonalToggleUnselected: {
|
|
873
|
-
backgroundColor:
|
|
969
|
+
backgroundColor: blendColor(
|
|
874
970
|
toggleUnselectedContainerColor,
|
|
875
971
|
theme.colors.onSurfaceVariant,
|
|
876
972
|
theme.stateLayer.pressedOpacity
|
|
877
973
|
)
|
|
878
974
|
},
|
|
879
975
|
pressedTonalToggleSelected: {
|
|
880
|
-
backgroundColor:
|
|
976
|
+
backgroundColor: blendColor(
|
|
881
977
|
theme.colors.secondaryContainer,
|
|
882
978
|
theme.colors.onSecondaryContainer,
|
|
883
979
|
theme.stateLayer.pressedOpacity
|
|
884
980
|
)
|
|
885
981
|
},
|
|
886
982
|
pressedOutlined: {
|
|
887
|
-
backgroundColor:
|
|
983
|
+
backgroundColor: alphaColor(
|
|
888
984
|
theme.colors.onSurfaceVariant,
|
|
889
985
|
theme.stateLayer.pressedOpacity
|
|
890
986
|
)
|
|
891
987
|
},
|
|
892
988
|
pressedOutlinedToggleUnselected: {
|
|
893
|
-
backgroundColor:
|
|
989
|
+
backgroundColor: alphaColor(
|
|
894
990
|
theme.colors.onSurfaceVariant,
|
|
895
991
|
theme.stateLayer.pressedOpacity
|
|
896
992
|
)
|
|
897
993
|
},
|
|
898
994
|
pressedOutlinedToggleSelected: {
|
|
899
|
-
backgroundColor:
|
|
995
|
+
backgroundColor: blendColor(
|
|
900
996
|
theme.colors.inverseSurface,
|
|
901
997
|
theme.colors.inverseOnSurface,
|
|
902
998
|
theme.stateLayer.pressedOpacity
|
|
903
999
|
)
|
|
904
1000
|
},
|
|
905
1001
|
pressedStandard: {
|
|
906
|
-
backgroundColor:
|
|
1002
|
+
backgroundColor: alphaColor(
|
|
907
1003
|
theme.colors.onSurfaceVariant,
|
|
908
1004
|
theme.stateLayer.pressedOpacity
|
|
909
1005
|
)
|
|
910
1006
|
},
|
|
911
1007
|
pressedStandardToggleUnselected: {
|
|
912
|
-
backgroundColor:
|
|
1008
|
+
backgroundColor: alphaColor(
|
|
913
1009
|
theme.colors.onSurfaceVariant,
|
|
914
1010
|
theme.stateLayer.pressedOpacity
|
|
915
1011
|
)
|
|
916
1012
|
},
|
|
917
1013
|
pressedStandardToggleSelected: {
|
|
918
|
-
backgroundColor:
|
|
1014
|
+
backgroundColor: alphaColor(
|
|
919
1015
|
theme.colors.primary,
|
|
920
1016
|
theme.stateLayer.pressedOpacity
|
|
921
1017
|
)
|
|
@@ -948,7 +1044,7 @@ function createStyles2(theme) {
|
|
|
948
1044
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
949
1045
|
function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
950
1046
|
if (disabled) {
|
|
951
|
-
return
|
|
1047
|
+
return alphaColor(theme.colors.onSurface, 0.38);
|
|
952
1048
|
}
|
|
953
1049
|
if (isToggle) {
|
|
954
1050
|
if (variant === "filled") {
|
|
@@ -1098,7 +1194,7 @@ function IconButton({
|
|
|
1098
1194
|
...props
|
|
1099
1195
|
}) {
|
|
1100
1196
|
var _a;
|
|
1101
|
-
const MaterialCommunityIcons =
|
|
1197
|
+
const MaterialCommunityIcons = getMaterialCommunityIcons();
|
|
1102
1198
|
const theme = (0, import_core6.useTheme)();
|
|
1103
1199
|
const styles3 = (0, import_react8.useMemo)(() => createStyles2(theme), [theme]);
|
|
1104
1200
|
const isDisabled = Boolean(disabled);
|
|
@@ -1118,14 +1214,14 @@ function IconButton({
|
|
|
1118
1214
|
borderWidth: 0
|
|
1119
1215
|
},
|
|
1120
1216
|
hovered: {
|
|
1121
|
-
backgroundColor:
|
|
1217
|
+
backgroundColor: blendColor(
|
|
1122
1218
|
containerColor,
|
|
1123
1219
|
overlay,
|
|
1124
1220
|
theme.stateLayer.hoveredOpacity
|
|
1125
1221
|
)
|
|
1126
1222
|
},
|
|
1127
1223
|
pressed: {
|
|
1128
|
-
backgroundColor:
|
|
1224
|
+
backgroundColor: blendColor(
|
|
1129
1225
|
containerColor,
|
|
1130
1226
|
overlay,
|
|
1131
1227
|
theme.stateLayer.pressedOpacity
|
|
@@ -1134,7 +1230,7 @@ function IconButton({
|
|
|
1134
1230
|
};
|
|
1135
1231
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
1136
1232
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1137
|
-
|
|
1233
|
+
import_react_native12.Pressable,
|
|
1138
1234
|
{
|
|
1139
1235
|
...props,
|
|
1140
1236
|
accessibilityRole: "button",
|
|
@@ -1177,18 +1273,17 @@ function IconButton({
|
|
|
1177
1273
|
|
|
1178
1274
|
// src/appbar/AppBar.tsx
|
|
1179
1275
|
var import_react9 = require("react");
|
|
1180
|
-
var
|
|
1276
|
+
var import_react_native14 = require("react-native");
|
|
1181
1277
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
1182
1278
|
var import_core8 = require("@onlynative/core");
|
|
1183
|
-
var import_utils5 = require("@onlynative/utils");
|
|
1184
1279
|
|
|
1185
1280
|
// src/appbar/styles.ts
|
|
1186
|
-
var
|
|
1281
|
+
var import_react_native13 = require("react-native");
|
|
1187
1282
|
var import_core7 = require("@onlynative/core");
|
|
1188
1283
|
function createStyles3(theme) {
|
|
1189
1284
|
var _a;
|
|
1190
1285
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core7.defaultTopAppBarTokens;
|
|
1191
|
-
return
|
|
1286
|
+
return import_react_native13.StyleSheet.create({
|
|
1192
1287
|
root: {
|
|
1193
1288
|
backgroundColor: theme.colors.surface
|
|
1194
1289
|
},
|
|
@@ -1277,10 +1372,10 @@ function createStyles3(theme) {
|
|
|
1277
1372
|
// src/appbar/AppBar.tsx
|
|
1278
1373
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1279
1374
|
function getBackIcon() {
|
|
1280
|
-
if (
|
|
1281
|
-
return
|
|
1375
|
+
if (import_react_native14.Platform.OS === "ios") {
|
|
1376
|
+
return selectRTL("chevron-left", "chevron-right");
|
|
1282
1377
|
}
|
|
1283
|
-
return
|
|
1378
|
+
return selectRTL("arrow-left", "arrow-right");
|
|
1284
1379
|
}
|
|
1285
1380
|
var titleVariantBySize = {
|
|
1286
1381
|
small: "titleLarge",
|
|
@@ -1308,7 +1403,7 @@ function withTopInset(enabled, content, style) {
|
|
|
1308
1403
|
if (enabled) {
|
|
1309
1404
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_safe_area_context2.SafeAreaView, { edges: ["top"], style, children: content });
|
|
1310
1405
|
}
|
|
1311
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style, children: content });
|
|
1312
1407
|
}
|
|
1313
1408
|
function measureWidth(event) {
|
|
1314
1409
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -1360,7 +1455,7 @@ function AppBar({
|
|
|
1360
1455
|
if (!canGoBack) {
|
|
1361
1456
|
return null;
|
|
1362
1457
|
}
|
|
1363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1364
1459
|
IconButton,
|
|
1365
1460
|
{
|
|
1366
1461
|
icon: getBackIcon(),
|
|
@@ -1386,8 +1481,8 @@ function AppBar({
|
|
|
1386
1481
|
if (!actions || actions.length === 0) {
|
|
1387
1482
|
return null;
|
|
1388
1483
|
}
|
|
1389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1390
|
-
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1485
|
+
import_react_native14.View,
|
|
1391
1486
|
{
|
|
1392
1487
|
style: styles3.iconFrame,
|
|
1393
1488
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1424,9 +1519,9 @@ function AppBar({
|
|
|
1424
1519
|
return nextWidth;
|
|
1425
1520
|
});
|
|
1426
1521
|
}, []);
|
|
1427
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1522
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.topRow, children: [
|
|
1428
1523
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1429
|
-
|
|
1524
|
+
import_react_native14.View,
|
|
1430
1525
|
{
|
|
1431
1526
|
collapsable: false,
|
|
1432
1527
|
onLayout: onLeadingLayout,
|
|
@@ -1434,9 +1529,9 @@ function AppBar({
|
|
|
1434
1529
|
children: leadingContent
|
|
1435
1530
|
}
|
|
1436
1531
|
),
|
|
1437
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.topRowSpacer }),
|
|
1438
1533
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1439
|
-
|
|
1534
|
+
import_react_native14.View,
|
|
1440
1535
|
{
|
|
1441
1536
|
collapsable: false,
|
|
1442
1537
|
onLayout: onActionsLayout,
|
|
@@ -1458,10 +1553,10 @@ function AppBar({
|
|
|
1458
1553
|
containerOverride
|
|
1459
1554
|
];
|
|
1460
1555
|
if (isExpanded) {
|
|
1461
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1556
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: [styles3.expandedContainer, getSizeStyle2(styles3, size)], children: [
|
|
1462
1557
|
topRow,
|
|
1463
1558
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1464
|
-
|
|
1559
|
+
import_react_native14.View,
|
|
1465
1560
|
{
|
|
1466
1561
|
style: [
|
|
1467
1562
|
styles3.expandedTitleContainer,
|
|
@@ -1485,11 +1580,11 @@ function AppBar({
|
|
|
1485
1580
|
}
|
|
1486
1581
|
)
|
|
1487
1582
|
] });
|
|
1488
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1489
1584
|
}
|
|
1490
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1585
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.smallContainer, children: [
|
|
1491
1586
|
topRow,
|
|
1492
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: [styles3.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1493
1588
|
Typography,
|
|
1494
1589
|
{
|
|
1495
1590
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
@@ -1504,30 +1599,29 @@ function AppBar({
|
|
|
1504
1599
|
}
|
|
1505
1600
|
) })
|
|
1506
1601
|
] });
|
|
1507
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1508
1603
|
}
|
|
1509
1604
|
|
|
1510
1605
|
// src/card/Card.tsx
|
|
1511
1606
|
var import_react10 = require("react");
|
|
1512
|
-
var
|
|
1607
|
+
var import_react_native16 = require("react-native");
|
|
1513
1608
|
var import_core9 = require("@onlynative/core");
|
|
1514
1609
|
|
|
1515
1610
|
// src/card/styles.ts
|
|
1516
|
-
var
|
|
1517
|
-
var import_utils6 = require("@onlynative/utils");
|
|
1611
|
+
var import_react_native15 = require("react-native");
|
|
1518
1612
|
function getVariantColors2(theme, variant) {
|
|
1519
|
-
const disabledContainerColor =
|
|
1520
|
-
const disabledOutlineColor =
|
|
1613
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1614
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1521
1615
|
if (variant === "outlined") {
|
|
1522
1616
|
return {
|
|
1523
1617
|
backgroundColor: theme.colors.surface,
|
|
1524
1618
|
borderColor: theme.colors.outline,
|
|
1525
1619
|
borderWidth: 1,
|
|
1526
|
-
hoveredBackgroundColor:
|
|
1620
|
+
hoveredBackgroundColor: alphaColor(
|
|
1527
1621
|
theme.colors.onSurface,
|
|
1528
1622
|
theme.stateLayer.hoveredOpacity
|
|
1529
1623
|
),
|
|
1530
|
-
pressedBackgroundColor:
|
|
1624
|
+
pressedBackgroundColor: alphaColor(
|
|
1531
1625
|
theme.colors.onSurface,
|
|
1532
1626
|
theme.stateLayer.pressedOpacity
|
|
1533
1627
|
),
|
|
@@ -1540,12 +1634,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1540
1634
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
1541
1635
|
borderColor: "transparent",
|
|
1542
1636
|
borderWidth: 0,
|
|
1543
|
-
hoveredBackgroundColor:
|
|
1637
|
+
hoveredBackgroundColor: blendColor(
|
|
1544
1638
|
theme.colors.surfaceContainerHighest,
|
|
1545
1639
|
theme.colors.onSurface,
|
|
1546
1640
|
theme.stateLayer.hoveredOpacity
|
|
1547
1641
|
),
|
|
1548
|
-
pressedBackgroundColor:
|
|
1642
|
+
pressedBackgroundColor: blendColor(
|
|
1549
1643
|
theme.colors.surfaceContainerHighest,
|
|
1550
1644
|
theme.colors.onSurface,
|
|
1551
1645
|
theme.stateLayer.pressedOpacity
|
|
@@ -1558,12 +1652,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1558
1652
|
backgroundColor: theme.colors.surface,
|
|
1559
1653
|
borderColor: "transparent",
|
|
1560
1654
|
borderWidth: 0,
|
|
1561
|
-
hoveredBackgroundColor:
|
|
1655
|
+
hoveredBackgroundColor: blendColor(
|
|
1562
1656
|
theme.colors.surface,
|
|
1563
1657
|
theme.colors.onSurface,
|
|
1564
1658
|
theme.stateLayer.hoveredOpacity
|
|
1565
1659
|
),
|
|
1566
|
-
pressedBackgroundColor:
|
|
1660
|
+
pressedBackgroundColor: blendColor(
|
|
1567
1661
|
theme.colors.surface,
|
|
1568
1662
|
theme.colors.onSurface,
|
|
1569
1663
|
theme.stateLayer.pressedOpacity
|
|
@@ -1579,12 +1673,12 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1579
1673
|
backgroundColor: containerColor,
|
|
1580
1674
|
borderColor: containerColor,
|
|
1581
1675
|
borderWidth: 0,
|
|
1582
|
-
hoveredBackgroundColor:
|
|
1676
|
+
hoveredBackgroundColor: blendColor(
|
|
1583
1677
|
containerColor,
|
|
1584
1678
|
theme.colors.onSurface,
|
|
1585
1679
|
theme.stateLayer.hoveredOpacity
|
|
1586
1680
|
),
|
|
1587
|
-
pressedBackgroundColor:
|
|
1681
|
+
pressedBackgroundColor: blendColor(
|
|
1588
1682
|
containerColor,
|
|
1589
1683
|
theme.colors.onSurface,
|
|
1590
1684
|
theme.stateLayer.pressedOpacity
|
|
@@ -1594,11 +1688,11 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1594
1688
|
function createStyles4(theme, variant, containerColor) {
|
|
1595
1689
|
const baseColors = getVariantColors2(theme, variant);
|
|
1596
1690
|
const colors = applyColorOverrides2(theme, baseColors, containerColor);
|
|
1597
|
-
const elevationLevel0 =
|
|
1598
|
-
const elevationLevel1 =
|
|
1599
|
-
const elevationLevel2 =
|
|
1691
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1692
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1693
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1600
1694
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
1601
|
-
return
|
|
1695
|
+
return import_react_native15.StyleSheet.create({
|
|
1602
1696
|
container: {
|
|
1603
1697
|
borderRadius: theme.shape.cornerMedium,
|
|
1604
1698
|
backgroundColor: colors.backgroundColor,
|
|
@@ -1648,7 +1742,7 @@ function Card({
|
|
|
1648
1742
|
[theme, variant, containerColor]
|
|
1649
1743
|
);
|
|
1650
1744
|
if (!isInteractive) {
|
|
1651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { ...props, style: [styles3.container, style], children });
|
|
1652
1746
|
}
|
|
1653
1747
|
const resolvedStyle = (state) => [
|
|
1654
1748
|
styles3.container,
|
|
@@ -1659,45 +1753,43 @@ function Card({
|
|
|
1659
1753
|
typeof style === "function" ? style(state) : style
|
|
1660
1754
|
];
|
|
1661
1755
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1662
|
-
|
|
1756
|
+
import_react_native16.Pressable,
|
|
1663
1757
|
{
|
|
1664
1758
|
...props,
|
|
1665
1759
|
role: "button",
|
|
1666
1760
|
accessibilityState: { disabled: isDisabled },
|
|
1667
|
-
hitSlop:
|
|
1761
|
+
hitSlop: import_react_native16.Platform.OS === "web" ? void 0 : 4,
|
|
1668
1762
|
disabled: isDisabled,
|
|
1669
1763
|
onPress,
|
|
1670
1764
|
style: resolvedStyle,
|
|
1671
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1765
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { style: styles3.disabledContent, children }) : children
|
|
1672
1766
|
}
|
|
1673
1767
|
);
|
|
1674
1768
|
}
|
|
1675
1769
|
|
|
1676
1770
|
// src/chip/Chip.tsx
|
|
1677
1771
|
var import_react11 = require("react");
|
|
1678
|
-
var
|
|
1772
|
+
var import_react_native18 = require("react-native");
|
|
1679
1773
|
var import_core10 = require("@onlynative/core");
|
|
1680
|
-
var import_utils8 = require("@onlynative/utils");
|
|
1681
1774
|
|
|
1682
1775
|
// src/chip/styles.ts
|
|
1683
|
-
var
|
|
1684
|
-
var import_utils7 = require("@onlynative/utils");
|
|
1776
|
+
var import_react_native17 = require("react-native");
|
|
1685
1777
|
function getVariantColors3(theme, variant, elevated, selected) {
|
|
1686
|
-
const disabledContainerColor =
|
|
1687
|
-
const disabledLabelColor =
|
|
1688
|
-
const disabledOutlineColor =
|
|
1778
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1779
|
+
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
1780
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1689
1781
|
if (variant === "filter" && selected) {
|
|
1690
1782
|
return {
|
|
1691
1783
|
backgroundColor: theme.colors.secondaryContainer,
|
|
1692
1784
|
textColor: theme.colors.onSecondaryContainer,
|
|
1693
1785
|
borderColor: "transparent",
|
|
1694
1786
|
borderWidth: 0,
|
|
1695
|
-
hoveredBackgroundColor:
|
|
1787
|
+
hoveredBackgroundColor: blendColor(
|
|
1696
1788
|
theme.colors.secondaryContainer,
|
|
1697
1789
|
theme.colors.onSecondaryContainer,
|
|
1698
1790
|
theme.stateLayer.hoveredOpacity
|
|
1699
1791
|
),
|
|
1700
|
-
pressedBackgroundColor:
|
|
1792
|
+
pressedBackgroundColor: blendColor(
|
|
1701
1793
|
theme.colors.secondaryContainer,
|
|
1702
1794
|
theme.colors.onSecondaryContainer,
|
|
1703
1795
|
theme.stateLayer.pressedOpacity
|
|
@@ -1714,12 +1806,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1714
1806
|
textColor: textColor2,
|
|
1715
1807
|
borderColor: "transparent",
|
|
1716
1808
|
borderWidth: 0,
|
|
1717
|
-
hoveredBackgroundColor:
|
|
1809
|
+
hoveredBackgroundColor: blendColor(
|
|
1718
1810
|
theme.colors.surfaceContainerLow,
|
|
1719
1811
|
textColor2,
|
|
1720
1812
|
theme.stateLayer.hoveredOpacity
|
|
1721
1813
|
),
|
|
1722
|
-
pressedBackgroundColor:
|
|
1814
|
+
pressedBackgroundColor: blendColor(
|
|
1723
1815
|
theme.colors.surfaceContainerLow,
|
|
1724
1816
|
textColor2,
|
|
1725
1817
|
theme.stateLayer.pressedOpacity
|
|
@@ -1735,12 +1827,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1735
1827
|
textColor,
|
|
1736
1828
|
borderColor: theme.colors.outline,
|
|
1737
1829
|
borderWidth: 1,
|
|
1738
|
-
hoveredBackgroundColor:
|
|
1830
|
+
hoveredBackgroundColor: blendColor(
|
|
1739
1831
|
theme.colors.surface,
|
|
1740
1832
|
textColor,
|
|
1741
1833
|
theme.stateLayer.hoveredOpacity
|
|
1742
1834
|
),
|
|
1743
|
-
pressedBackgroundColor:
|
|
1835
|
+
pressedBackgroundColor: blendColor(
|
|
1744
1836
|
theme.colors.surface,
|
|
1745
1837
|
textColor,
|
|
1746
1838
|
theme.stateLayer.pressedOpacity
|
|
@@ -1760,33 +1852,33 @@ function applyColorOverrides3(theme, colors, containerColor, contentColor) {
|
|
|
1760
1852
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
1761
1853
|
result.backgroundColor = containerColor;
|
|
1762
1854
|
result.borderColor = containerColor;
|
|
1763
|
-
result.hoveredBackgroundColor =
|
|
1855
|
+
result.hoveredBackgroundColor = blendColor(
|
|
1764
1856
|
containerColor,
|
|
1765
1857
|
overlay,
|
|
1766
1858
|
theme.stateLayer.hoveredOpacity
|
|
1767
1859
|
);
|
|
1768
|
-
result.pressedBackgroundColor =
|
|
1860
|
+
result.pressedBackgroundColor = blendColor(
|
|
1769
1861
|
containerColor,
|
|
1770
1862
|
overlay,
|
|
1771
1863
|
theme.stateLayer.pressedOpacity
|
|
1772
1864
|
);
|
|
1773
1865
|
} else if (contentColor) {
|
|
1774
1866
|
if (colors.backgroundColor === "transparent") {
|
|
1775
|
-
result.hoveredBackgroundColor =
|
|
1867
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
1776
1868
|
contentColor,
|
|
1777
1869
|
theme.stateLayer.hoveredOpacity
|
|
1778
1870
|
);
|
|
1779
|
-
result.pressedBackgroundColor =
|
|
1871
|
+
result.pressedBackgroundColor = alphaColor(
|
|
1780
1872
|
contentColor,
|
|
1781
1873
|
theme.stateLayer.pressedOpacity
|
|
1782
1874
|
);
|
|
1783
1875
|
} else {
|
|
1784
|
-
result.hoveredBackgroundColor =
|
|
1876
|
+
result.hoveredBackgroundColor = blendColor(
|
|
1785
1877
|
colors.backgroundColor,
|
|
1786
1878
|
contentColor,
|
|
1787
1879
|
theme.stateLayer.hoveredOpacity
|
|
1788
1880
|
);
|
|
1789
|
-
result.pressedBackgroundColor =
|
|
1881
|
+
result.pressedBackgroundColor = blendColor(
|
|
1790
1882
|
colors.backgroundColor,
|
|
1791
1883
|
contentColor,
|
|
1792
1884
|
theme.stateLayer.pressedOpacity
|
|
@@ -1804,12 +1896,12 @@ function createStyles5(theme, variant, elevated, selected, hasLeadingContent, ha
|
|
|
1804
1896
|
contentColor
|
|
1805
1897
|
);
|
|
1806
1898
|
const labelStyle = theme.typography.labelLarge;
|
|
1807
|
-
const elevationLevel0 =
|
|
1808
|
-
const elevationLevel1 =
|
|
1809
|
-
const elevationLevel2 =
|
|
1899
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1900
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1901
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1810
1902
|
const isElevated = elevated && variant !== "input";
|
|
1811
1903
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
1812
|
-
return
|
|
1904
|
+
return import_react_native17.StyleSheet.create({
|
|
1813
1905
|
container: {
|
|
1814
1906
|
alignSelf: "flex-start",
|
|
1815
1907
|
alignItems: "center",
|
|
@@ -1907,7 +1999,7 @@ function Chip({
|
|
|
1907
1999
|
variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
|
|
1908
2000
|
);
|
|
1909
2001
|
const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
|
|
1910
|
-
const MaterialCommunityIcons = needsIcons ?
|
|
2002
|
+
const MaterialCommunityIcons = needsIcons ? getMaterialCommunityIcons() : null;
|
|
1911
2003
|
const theme = (0, import_core10.useTheme)();
|
|
1912
2004
|
const styles3 = (0, import_react11.useMemo)(
|
|
1913
2005
|
() => createStyles5(
|
|
@@ -1932,7 +2024,7 @@ function Chip({
|
|
|
1932
2024
|
]
|
|
1933
2025
|
);
|
|
1934
2026
|
const resolvedIconColor = (0, import_react11.useMemo)(() => {
|
|
1935
|
-
const base =
|
|
2027
|
+
const base = import_react_native18.StyleSheet.flatten([
|
|
1936
2028
|
styles3.label,
|
|
1937
2029
|
isDisabled ? styles3.disabledLabel : void 0
|
|
1938
2030
|
]);
|
|
@@ -1948,7 +2040,7 @@ function Chip({
|
|
|
1948
2040
|
);
|
|
1949
2041
|
const renderLeadingContent = () => {
|
|
1950
2042
|
if (variant === "input" && avatar) {
|
|
1951
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.View, { style: styles3.avatar, children: avatar });
|
|
1952
2044
|
}
|
|
1953
2045
|
if (leadingIcon) {
|
|
1954
2046
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -1975,7 +2067,7 @@ function Chip({
|
|
|
1975
2067
|
return null;
|
|
1976
2068
|
};
|
|
1977
2069
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1978
|
-
|
|
2070
|
+
import_react_native18.Pressable,
|
|
1979
2071
|
{
|
|
1980
2072
|
...props,
|
|
1981
2073
|
accessibilityRole: "button",
|
|
@@ -1983,7 +2075,7 @@ function Chip({
|
|
|
1983
2075
|
disabled: isDisabled,
|
|
1984
2076
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
1985
2077
|
},
|
|
1986
|
-
hitSlop:
|
|
2078
|
+
hitSlop: import_react_native18.Platform.OS === "web" ? void 0 : 4,
|
|
1987
2079
|
disabled: isDisabled,
|
|
1988
2080
|
style: resolveStyle2(
|
|
1989
2081
|
styles3.container,
|
|
@@ -1995,9 +2087,9 @@ function Chip({
|
|
|
1995
2087
|
),
|
|
1996
2088
|
children: [
|
|
1997
2089
|
renderLeadingContent(),
|
|
1998
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.Text, { style: computedLabelStyle, children }),
|
|
1999
2091
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2000
|
-
|
|
2092
|
+
import_react_native18.Pressable,
|
|
2001
2093
|
{
|
|
2002
2094
|
onPress: onClose,
|
|
2003
2095
|
accessibilityRole: "button",
|
|
@@ -2021,27 +2113,25 @@ function Chip({
|
|
|
2021
2113
|
|
|
2022
2114
|
// src/checkbox/Checkbox.tsx
|
|
2023
2115
|
var import_react12 = require("react");
|
|
2024
|
-
var
|
|
2116
|
+
var import_react_native20 = require("react-native");
|
|
2025
2117
|
var import_core11 = require("@onlynative/core");
|
|
2026
|
-
var import_utils10 = require("@onlynative/utils");
|
|
2027
2118
|
|
|
2028
2119
|
// src/checkbox/styles.ts
|
|
2029
|
-
var
|
|
2030
|
-
var import_utils9 = require("@onlynative/utils");
|
|
2120
|
+
var import_react_native19 = require("react-native");
|
|
2031
2121
|
function getColors(theme, checked) {
|
|
2032
|
-
const disabledOnSurface38 =
|
|
2122
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2033
2123
|
if (checked) {
|
|
2034
2124
|
return {
|
|
2035
2125
|
backgroundColor: theme.colors.primary,
|
|
2036
2126
|
borderColor: "transparent",
|
|
2037
2127
|
borderWidth: 0,
|
|
2038
2128
|
iconColor: theme.colors.onPrimary,
|
|
2039
|
-
hoveredBackgroundColor:
|
|
2129
|
+
hoveredBackgroundColor: blendColor(
|
|
2040
2130
|
theme.colors.primary,
|
|
2041
2131
|
theme.colors.onPrimary,
|
|
2042
2132
|
theme.stateLayer.hoveredOpacity
|
|
2043
2133
|
),
|
|
2044
|
-
pressedBackgroundColor:
|
|
2134
|
+
pressedBackgroundColor: blendColor(
|
|
2045
2135
|
theme.colors.primary,
|
|
2046
2136
|
theme.colors.onPrimary,
|
|
2047
2137
|
theme.stateLayer.pressedOpacity
|
|
@@ -2057,11 +2147,11 @@ function getColors(theme, checked) {
|
|
|
2057
2147
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2058
2148
|
borderWidth: 2,
|
|
2059
2149
|
iconColor: "transparent",
|
|
2060
|
-
hoveredBackgroundColor:
|
|
2150
|
+
hoveredBackgroundColor: alphaColor(
|
|
2061
2151
|
theme.colors.onSurface,
|
|
2062
2152
|
theme.stateLayer.hoveredOpacity
|
|
2063
2153
|
),
|
|
2064
|
-
pressedBackgroundColor:
|
|
2154
|
+
pressedBackgroundColor: alphaColor(
|
|
2065
2155
|
theme.colors.onSurface,
|
|
2066
2156
|
theme.stateLayer.pressedOpacity
|
|
2067
2157
|
),
|
|
@@ -2081,12 +2171,12 @@ function applyColorOverrides4(theme, colors, containerColor, contentColor) {
|
|
|
2081
2171
|
const overlay = contentColor != null ? contentColor : colors.iconColor;
|
|
2082
2172
|
result.backgroundColor = containerColor;
|
|
2083
2173
|
result.borderColor = containerColor;
|
|
2084
|
-
result.hoveredBackgroundColor =
|
|
2174
|
+
result.hoveredBackgroundColor = blendColor(
|
|
2085
2175
|
containerColor,
|
|
2086
2176
|
overlay,
|
|
2087
2177
|
theme.stateLayer.hoveredOpacity
|
|
2088
2178
|
);
|
|
2089
|
-
result.pressedBackgroundColor =
|
|
2179
|
+
result.pressedBackgroundColor = blendColor(
|
|
2090
2180
|
containerColor,
|
|
2091
2181
|
overlay,
|
|
2092
2182
|
theme.stateLayer.pressedOpacity
|
|
@@ -2103,7 +2193,7 @@ function createStyles6(theme, checked, containerColor, contentColor) {
|
|
|
2103
2193
|
);
|
|
2104
2194
|
const size = 18;
|
|
2105
2195
|
const touchTarget = 48;
|
|
2106
|
-
return
|
|
2196
|
+
return import_react_native19.StyleSheet.create({
|
|
2107
2197
|
container: {
|
|
2108
2198
|
width: touchTarget,
|
|
2109
2199
|
height: touchTarget,
|
|
@@ -2177,14 +2267,14 @@ function Checkbox({
|
|
|
2177
2267
|
}) {
|
|
2178
2268
|
const isDisabled = Boolean(disabled);
|
|
2179
2269
|
const isChecked = Boolean(value);
|
|
2180
|
-
const MaterialCommunityIcons = isChecked ?
|
|
2270
|
+
const MaterialCommunityIcons = isChecked ? getMaterialCommunityIcons() : null;
|
|
2181
2271
|
const theme = (0, import_core11.useTheme)();
|
|
2182
2272
|
const styles3 = (0, import_react12.useMemo)(
|
|
2183
2273
|
() => createStyles6(theme, isChecked, containerColor, contentColor),
|
|
2184
2274
|
[theme, isChecked, containerColor, contentColor]
|
|
2185
2275
|
);
|
|
2186
2276
|
const resolvedIconColor = (0, import_react12.useMemo)(() => {
|
|
2187
|
-
const base =
|
|
2277
|
+
const base = import_react_native20.StyleSheet.flatten([
|
|
2188
2278
|
styles3.iconColor,
|
|
2189
2279
|
isDisabled ? styles3.disabledIconColor : void 0
|
|
2190
2280
|
]);
|
|
@@ -2196,7 +2286,7 @@ function Checkbox({
|
|
|
2196
2286
|
}
|
|
2197
2287
|
};
|
|
2198
2288
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2199
|
-
|
|
2289
|
+
import_react_native20.Pressable,
|
|
2200
2290
|
{
|
|
2201
2291
|
...props,
|
|
2202
2292
|
accessibilityRole: "checkbox",
|
|
@@ -2204,7 +2294,7 @@ function Checkbox({
|
|
|
2204
2294
|
disabled: isDisabled,
|
|
2205
2295
|
checked: isChecked
|
|
2206
2296
|
},
|
|
2207
|
-
hitSlop:
|
|
2297
|
+
hitSlop: import_react_native20.Platform.OS === "web" ? void 0 : 4,
|
|
2208
2298
|
disabled: isDisabled,
|
|
2209
2299
|
onPress: handlePress,
|
|
2210
2300
|
style: resolveStyle3(
|
|
@@ -2215,7 +2305,7 @@ function Checkbox({
|
|
|
2215
2305
|
isDisabled,
|
|
2216
2306
|
style
|
|
2217
2307
|
),
|
|
2218
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native20.View, { style: [styles3.box, isDisabled ? styles3.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2219
2309
|
MaterialCommunityIcons,
|
|
2220
2310
|
{
|
|
2221
2311
|
name: "check",
|
|
@@ -2229,23 +2319,22 @@ function Checkbox({
|
|
|
2229
2319
|
|
|
2230
2320
|
// src/radio/Radio.tsx
|
|
2231
2321
|
var import_react13 = require("react");
|
|
2232
|
-
var
|
|
2322
|
+
var import_react_native22 = require("react-native");
|
|
2233
2323
|
var import_core12 = require("@onlynative/core");
|
|
2234
2324
|
|
|
2235
2325
|
// src/radio/styles.ts
|
|
2236
|
-
var
|
|
2237
|
-
var import_utils11 = require("@onlynative/utils");
|
|
2326
|
+
var import_react_native21 = require("react-native");
|
|
2238
2327
|
function getColors2(theme, selected) {
|
|
2239
|
-
const disabledOnSurface38 =
|
|
2328
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2240
2329
|
if (selected) {
|
|
2241
2330
|
return {
|
|
2242
2331
|
borderColor: theme.colors.primary,
|
|
2243
2332
|
dotColor: theme.colors.primary,
|
|
2244
|
-
hoveredBackgroundColor:
|
|
2333
|
+
hoveredBackgroundColor: alphaColor(
|
|
2245
2334
|
theme.colors.primary,
|
|
2246
2335
|
theme.stateLayer.hoveredOpacity
|
|
2247
2336
|
),
|
|
2248
|
-
pressedBackgroundColor:
|
|
2337
|
+
pressedBackgroundColor: alphaColor(
|
|
2249
2338
|
theme.colors.primary,
|
|
2250
2339
|
theme.stateLayer.pressedOpacity
|
|
2251
2340
|
),
|
|
@@ -2256,11 +2345,11 @@ function getColors2(theme, selected) {
|
|
|
2256
2345
|
return {
|
|
2257
2346
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2258
2347
|
dotColor: "transparent",
|
|
2259
|
-
hoveredBackgroundColor:
|
|
2348
|
+
hoveredBackgroundColor: alphaColor(
|
|
2260
2349
|
theme.colors.onSurface,
|
|
2261
2350
|
theme.stateLayer.hoveredOpacity
|
|
2262
2351
|
),
|
|
2263
|
-
pressedBackgroundColor:
|
|
2352
|
+
pressedBackgroundColor: alphaColor(
|
|
2264
2353
|
theme.colors.onSurface,
|
|
2265
2354
|
theme.stateLayer.pressedOpacity
|
|
2266
2355
|
),
|
|
@@ -2274,11 +2363,11 @@ function applyColorOverrides5(theme, colors, containerColor, contentColor) {
|
|
|
2274
2363
|
if (containerColor) {
|
|
2275
2364
|
result.borderColor = containerColor;
|
|
2276
2365
|
result.dotColor = containerColor;
|
|
2277
|
-
result.hoveredBackgroundColor =
|
|
2366
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
2278
2367
|
containerColor,
|
|
2279
2368
|
theme.stateLayer.hoveredOpacity
|
|
2280
2369
|
);
|
|
2281
|
-
result.pressedBackgroundColor =
|
|
2370
|
+
result.pressedBackgroundColor = alphaColor(
|
|
2282
2371
|
containerColor,
|
|
2283
2372
|
theme.stateLayer.pressedOpacity
|
|
2284
2373
|
);
|
|
@@ -2298,7 +2387,7 @@ function createStyles7(theme, selected, containerColor, contentColor) {
|
|
|
2298
2387
|
const outerSize = 20;
|
|
2299
2388
|
const innerSize = 10;
|
|
2300
2389
|
const touchTarget = 48;
|
|
2301
|
-
return
|
|
2390
|
+
return import_react_native21.StyleSheet.create({
|
|
2302
2391
|
container: {
|
|
2303
2392
|
width: touchTarget,
|
|
2304
2393
|
height: touchTarget,
|
|
@@ -2383,7 +2472,7 @@ function Radio({
|
|
|
2383
2472
|
}
|
|
2384
2473
|
};
|
|
2385
2474
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2386
|
-
|
|
2475
|
+
import_react_native22.Pressable,
|
|
2387
2476
|
{
|
|
2388
2477
|
...props,
|
|
2389
2478
|
accessibilityRole: "radio",
|
|
@@ -2391,7 +2480,7 @@ function Radio({
|
|
|
2391
2480
|
disabled: isDisabled,
|
|
2392
2481
|
checked: isSelected
|
|
2393
2482
|
},
|
|
2394
|
-
hitSlop:
|
|
2483
|
+
hitSlop: import_react_native22.Platform.OS === "web" ? void 0 : 4,
|
|
2395
2484
|
disabled: isDisabled,
|
|
2396
2485
|
onPress: handlePress,
|
|
2397
2486
|
style: resolveStyle4(
|
|
@@ -2403,11 +2492,11 @@ function Radio({
|
|
|
2403
2492
|
style
|
|
2404
2493
|
),
|
|
2405
2494
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2406
|
-
|
|
2495
|
+
import_react_native22.View,
|
|
2407
2496
|
{
|
|
2408
2497
|
style: [styles3.outer, isDisabled ? styles3.disabledOuter : void 0],
|
|
2409
2498
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2410
|
-
|
|
2499
|
+
import_react_native22.View,
|
|
2411
2500
|
{
|
|
2412
2501
|
style: [
|
|
2413
2502
|
styles3.inner,
|
|
@@ -2423,27 +2512,25 @@ function Radio({
|
|
|
2423
2512
|
|
|
2424
2513
|
// src/switch/Switch.tsx
|
|
2425
2514
|
var import_react14 = require("react");
|
|
2426
|
-
var
|
|
2515
|
+
var import_react_native24 = require("react-native");
|
|
2427
2516
|
var import_core13 = require("@onlynative/core");
|
|
2428
|
-
var import_utils13 = require("@onlynative/utils");
|
|
2429
2517
|
|
|
2430
2518
|
// src/switch/styles.ts
|
|
2431
|
-
var
|
|
2432
|
-
var import_utils12 = require("@onlynative/utils");
|
|
2519
|
+
var import_react_native23 = require("react-native");
|
|
2433
2520
|
function getColors3(theme, selected) {
|
|
2434
|
-
const disabledOnSurface12 =
|
|
2435
|
-
const disabledOnSurface38 =
|
|
2521
|
+
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
2522
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2436
2523
|
if (selected) {
|
|
2437
2524
|
return {
|
|
2438
2525
|
trackColor: theme.colors.primary,
|
|
2439
2526
|
thumbColor: theme.colors.onPrimary,
|
|
2440
2527
|
iconColor: theme.colors.onPrimaryContainer,
|
|
2441
|
-
hoveredTrackColor:
|
|
2528
|
+
hoveredTrackColor: blendColor(
|
|
2442
2529
|
theme.colors.primary,
|
|
2443
2530
|
theme.colors.onPrimary,
|
|
2444
2531
|
theme.stateLayer.hoveredOpacity
|
|
2445
2532
|
),
|
|
2446
|
-
pressedTrackColor:
|
|
2533
|
+
pressedTrackColor: blendColor(
|
|
2447
2534
|
theme.colors.primary,
|
|
2448
2535
|
theme.colors.onPrimary,
|
|
2449
2536
|
theme.stateLayer.pressedOpacity
|
|
@@ -2460,12 +2547,12 @@ function getColors3(theme, selected) {
|
|
|
2460
2547
|
trackColor: theme.colors.surfaceContainerHighest,
|
|
2461
2548
|
thumbColor: theme.colors.outline,
|
|
2462
2549
|
iconColor: theme.colors.surfaceContainerHighest,
|
|
2463
|
-
hoveredTrackColor:
|
|
2550
|
+
hoveredTrackColor: blendColor(
|
|
2464
2551
|
theme.colors.surfaceContainerHighest,
|
|
2465
2552
|
theme.colors.onSurface,
|
|
2466
2553
|
theme.stateLayer.hoveredOpacity
|
|
2467
2554
|
),
|
|
2468
|
-
pressedTrackColor:
|
|
2555
|
+
pressedTrackColor: blendColor(
|
|
2469
2556
|
theme.colors.surfaceContainerHighest,
|
|
2470
2557
|
theme.colors.onSurface,
|
|
2471
2558
|
theme.stateLayer.pressedOpacity
|
|
@@ -2489,12 +2576,12 @@ function applyColorOverrides6(theme, colors, containerColor, contentColor) {
|
|
|
2489
2576
|
const overlay = contentColor != null ? contentColor : colors.thumbColor;
|
|
2490
2577
|
result.trackColor = containerColor;
|
|
2491
2578
|
result.borderColor = containerColor;
|
|
2492
|
-
result.hoveredTrackColor =
|
|
2579
|
+
result.hoveredTrackColor = blendColor(
|
|
2493
2580
|
containerColor,
|
|
2494
2581
|
overlay,
|
|
2495
2582
|
theme.stateLayer.hoveredOpacity
|
|
2496
2583
|
);
|
|
2497
|
-
result.pressedTrackColor =
|
|
2584
|
+
result.pressedTrackColor = blendColor(
|
|
2498
2585
|
containerColor,
|
|
2499
2586
|
overlay,
|
|
2500
2587
|
theme.stateLayer.pressedOpacity
|
|
@@ -2517,7 +2604,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2517
2604
|
const trackHeight = 32;
|
|
2518
2605
|
const trackPadding = 4;
|
|
2519
2606
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
2520
|
-
return
|
|
2607
|
+
return import_react_native23.StyleSheet.create({
|
|
2521
2608
|
track: {
|
|
2522
2609
|
width: trackWidth,
|
|
2523
2610
|
height: trackHeight,
|
|
@@ -2556,7 +2643,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2556
2643
|
color: colors.iconColor
|
|
2557
2644
|
},
|
|
2558
2645
|
disabledIconColor: {
|
|
2559
|
-
color:
|
|
2646
|
+
color: alphaColor(theme.colors.onSurface, 0.38)
|
|
2560
2647
|
}
|
|
2561
2648
|
});
|
|
2562
2649
|
}
|
|
@@ -2601,7 +2688,7 @@ function Switch({
|
|
|
2601
2688
|
[theme, isSelected, hasIcon, containerColor, contentColor]
|
|
2602
2689
|
);
|
|
2603
2690
|
const resolvedIconColor = (0, import_react14.useMemo)(() => {
|
|
2604
|
-
const base =
|
|
2691
|
+
const base = import_react_native24.StyleSheet.flatten([
|
|
2605
2692
|
styles3.iconColor,
|
|
2606
2693
|
isDisabled ? styles3.disabledIconColor : void 0
|
|
2607
2694
|
]);
|
|
@@ -2613,10 +2700,10 @@ function Switch({
|
|
|
2613
2700
|
}
|
|
2614
2701
|
};
|
|
2615
2702
|
const iconName = isSelected ? selectedIcon : unselectedIcon;
|
|
2616
|
-
const MaterialCommunityIcons = iconName ?
|
|
2703
|
+
const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
|
|
2617
2704
|
const iconSize = 16;
|
|
2618
2705
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2619
|
-
|
|
2706
|
+
import_react_native24.Pressable,
|
|
2620
2707
|
{
|
|
2621
2708
|
...props,
|
|
2622
2709
|
accessibilityRole: "switch",
|
|
@@ -2624,7 +2711,7 @@ function Switch({
|
|
|
2624
2711
|
disabled: isDisabled,
|
|
2625
2712
|
checked: isSelected
|
|
2626
2713
|
},
|
|
2627
|
-
hitSlop:
|
|
2714
|
+
hitSlop: import_react_native24.Platform.OS === "web" ? void 0 : 4,
|
|
2628
2715
|
disabled: isDisabled,
|
|
2629
2716
|
onPress: handlePress,
|
|
2630
2717
|
style: resolveStyle5(
|
|
@@ -2636,7 +2723,7 @@ function Switch({
|
|
|
2636
2723
|
style
|
|
2637
2724
|
),
|
|
2638
2725
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2639
|
-
|
|
2726
|
+
import_react_native24.View,
|
|
2640
2727
|
{
|
|
2641
2728
|
style: [styles3.thumb, isDisabled ? styles3.disabledThumb : void 0],
|
|
2642
2729
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -2655,13 +2742,11 @@ function Switch({
|
|
|
2655
2742
|
|
|
2656
2743
|
// src/text-field/TextField.tsx
|
|
2657
2744
|
var import_react15 = require("react");
|
|
2658
|
-
var
|
|
2745
|
+
var import_react_native26 = require("react-native");
|
|
2659
2746
|
var import_core14 = require("@onlynative/core");
|
|
2660
|
-
var import_utils15 = require("@onlynative/utils");
|
|
2661
2747
|
|
|
2662
2748
|
// src/text-field/styles.ts
|
|
2663
|
-
var
|
|
2664
|
-
var import_utils14 = require("@onlynative/utils");
|
|
2749
|
+
var import_react_native25 = require("react-native");
|
|
2665
2750
|
var CONTAINER_HEIGHT = 56;
|
|
2666
2751
|
var ICON_SIZE = 24;
|
|
2667
2752
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -2686,15 +2771,15 @@ function getVariantColors4(theme, variant) {
|
|
|
2686
2771
|
focusedLabelColor: theme.colors.primary,
|
|
2687
2772
|
errorLabelColor: theme.colors.error,
|
|
2688
2773
|
textColor: theme.colors.onSurface,
|
|
2689
|
-
disabledTextColor:
|
|
2690
|
-
disabledLabelColor:
|
|
2691
|
-
disabledBorderColor:
|
|
2774
|
+
disabledTextColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2775
|
+
disabledLabelColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2776
|
+
disabledBorderColor: alphaColor(theme.colors.onSurface, 0.12),
|
|
2692
2777
|
placeholderColor: theme.colors.onSurfaceVariant,
|
|
2693
2778
|
supportingTextColor: theme.colors.onSurfaceVariant,
|
|
2694
2779
|
errorSupportingTextColor: theme.colors.error,
|
|
2695
2780
|
iconColor: theme.colors.onSurfaceVariant,
|
|
2696
2781
|
errorIconColor: theme.colors.error,
|
|
2697
|
-
disabledIconColor:
|
|
2782
|
+
disabledIconColor: alphaColor(theme.colors.onSurface, disabledOpacity)
|
|
2698
2783
|
};
|
|
2699
2784
|
if (variant === "outlined") {
|
|
2700
2785
|
return {
|
|
@@ -2709,7 +2794,7 @@ function getVariantColors4(theme, variant) {
|
|
|
2709
2794
|
...common,
|
|
2710
2795
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
2711
2796
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2712
|
-
disabledBackgroundColor:
|
|
2797
|
+
disabledBackgroundColor: alphaColor(theme.colors.onSurface, 0.04),
|
|
2713
2798
|
labelColor: theme.colors.onSurfaceVariant
|
|
2714
2799
|
};
|
|
2715
2800
|
}
|
|
@@ -2720,7 +2805,7 @@ function createStyles9(theme, variant) {
|
|
|
2720
2805
|
const isFilled = variant === "filled";
|
|
2721
2806
|
return {
|
|
2722
2807
|
colors,
|
|
2723
|
-
styles:
|
|
2808
|
+
styles: import_react_native25.StyleSheet.create({
|
|
2724
2809
|
root: {
|
|
2725
2810
|
alignSelf: "stretch"
|
|
2726
2811
|
},
|
|
@@ -2791,7 +2876,7 @@ function createStyles9(theme, variant) {
|
|
|
2791
2876
|
fontWeight: bodySmall.fontWeight,
|
|
2792
2877
|
letterSpacing: bodySmall.letterSpacing,
|
|
2793
2878
|
color: colors.labelColor,
|
|
2794
|
-
transformOrigin:
|
|
2879
|
+
transformOrigin: transformOrigin("top")
|
|
2795
2880
|
},
|
|
2796
2881
|
labelNotch: {
|
|
2797
2882
|
paddingHorizontal: 4
|
|
@@ -2884,7 +2969,7 @@ function TextField({
|
|
|
2884
2969
|
const isError = Boolean(error) || Boolean(errorText);
|
|
2885
2970
|
const isFilled = variant === "filled";
|
|
2886
2971
|
const hasLeadingIcon = Boolean(leadingIcon);
|
|
2887
|
-
const MaterialCommunityIcons = leadingIcon || trailingIcon ?
|
|
2972
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
|
|
2888
2973
|
const { colors, styles: styles3 } = (0, import_react15.useMemo)(
|
|
2889
2974
|
() => createStyles9(theme, variant),
|
|
2890
2975
|
[theme, variant]
|
|
@@ -2897,13 +2982,13 @@ function TextField({
|
|
|
2897
2982
|
const isControlled = value !== void 0;
|
|
2898
2983
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
2899
2984
|
const isLabelFloated = isFocused || hasValue;
|
|
2900
|
-
const labelAnimRef = (0, import_react15.useRef)(new
|
|
2985
|
+
const labelAnimRef = (0, import_react15.useRef)(new import_react_native26.Animated.Value(isLabelFloated ? 1 : 0));
|
|
2901
2986
|
const labelAnim = labelAnimRef.current;
|
|
2902
2987
|
(0, import_react15.useEffect)(() => {
|
|
2903
|
-
|
|
2988
|
+
import_react_native26.Animated.timing(labelAnim, {
|
|
2904
2989
|
toValue: isLabelFloated ? 1 : 0,
|
|
2905
2990
|
duration: 150,
|
|
2906
|
-
useNativeDriver:
|
|
2991
|
+
useNativeDriver: import_react_native26.Platform.OS !== "web"
|
|
2907
2992
|
}).start();
|
|
2908
2993
|
}, [isLabelFloated, labelAnim]);
|
|
2909
2994
|
const labelScale = (0, import_react15.useMemo)(() => {
|
|
@@ -2981,9 +3066,9 @@ function TextField({
|
|
|
2981
3066
|
[styles3, isFocused, isError, isDisabled]
|
|
2982
3067
|
);
|
|
2983
3068
|
const displaySupportingText = isError ? errorText : supportingText;
|
|
2984
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2985
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2986
|
-
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: [styles3.root, style], children: [
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: containerStyle, children: [
|
|
3071
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2987
3072
|
MaterialCommunityIcons,
|
|
2988
3073
|
{
|
|
2989
3074
|
name: leadingIcon,
|
|
@@ -2992,14 +3077,14 @@ function TextField({
|
|
|
2992
3077
|
}
|
|
2993
3078
|
) }) : null,
|
|
2994
3079
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2995
|
-
|
|
3080
|
+
import_react_native26.View,
|
|
2996
3081
|
{
|
|
2997
3082
|
style: [
|
|
2998
3083
|
styles3.inputWrapper,
|
|
2999
3084
|
label ? styles3.inputWrapperWithLabel : void 0
|
|
3000
3085
|
],
|
|
3001
3086
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3002
|
-
|
|
3087
|
+
import_react_native26.TextInput,
|
|
3003
3088
|
{
|
|
3004
3089
|
ref: inputRef,
|
|
3005
3090
|
...textInputProps,
|
|
@@ -3025,14 +3110,14 @@ function TextField({
|
|
|
3025
3110
|
}
|
|
3026
3111
|
),
|
|
3027
3112
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3028
|
-
|
|
3113
|
+
import_react_native26.Pressable,
|
|
3029
3114
|
{
|
|
3030
3115
|
onPress: onTrailingIconPress,
|
|
3031
3116
|
disabled: isDisabled || !onTrailingIconPress,
|
|
3032
3117
|
accessibilityRole: "button",
|
|
3033
3118
|
hitSlop: 12,
|
|
3034
3119
|
style: styles3.trailingIconPressable,
|
|
3035
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3036
3121
|
MaterialCommunityIcons,
|
|
3037
3122
|
{
|
|
3038
3123
|
name: trailingIcon,
|
|
@@ -3043,7 +3128,7 @@ function TextField({
|
|
|
3043
3128
|
}
|
|
3044
3129
|
) : null,
|
|
3045
3130
|
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3046
|
-
|
|
3131
|
+
import_react_native26.Animated.Text,
|
|
3047
3132
|
{
|
|
3048
3133
|
numberOfLines: 1,
|
|
3049
3134
|
style: [
|
|
@@ -3063,10 +3148,10 @@ function TextField({
|
|
|
3063
3148
|
children: label
|
|
3064
3149
|
}
|
|
3065
3150
|
) : null,
|
|
3066
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3151
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: indicatorStyle }) : null
|
|
3067
3152
|
] }) }),
|
|
3068
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3069
|
-
|
|
3153
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3154
|
+
import_react_native26.Text,
|
|
3070
3155
|
{
|
|
3071
3156
|
style: [
|
|
3072
3157
|
styles3.supportingText,
|
|
@@ -3080,12 +3165,11 @@ function TextField({
|
|
|
3080
3165
|
|
|
3081
3166
|
// src/list/List.tsx
|
|
3082
3167
|
var import_react16 = require("react");
|
|
3083
|
-
var
|
|
3168
|
+
var import_react_native28 = require("react-native");
|
|
3084
3169
|
var import_core15 = require("@onlynative/core");
|
|
3085
3170
|
|
|
3086
3171
|
// src/list/styles.ts
|
|
3087
|
-
var
|
|
3088
|
-
var import_utils16 = require("@onlynative/utils");
|
|
3172
|
+
var import_react_native27 = require("react-native");
|
|
3089
3173
|
var ITEM_PADDING_VERTICAL = 12;
|
|
3090
3174
|
var INSET_START = 56;
|
|
3091
3175
|
var MIN_HEIGHT = {
|
|
@@ -3094,7 +3178,7 @@ var MIN_HEIGHT = {
|
|
|
3094
3178
|
3: 88
|
|
3095
3179
|
};
|
|
3096
3180
|
function createListStyles(theme) {
|
|
3097
|
-
return
|
|
3181
|
+
return import_react_native27.StyleSheet.create({
|
|
3098
3182
|
container: {
|
|
3099
3183
|
paddingVertical: theme.spacing.sm
|
|
3100
3184
|
}
|
|
@@ -3105,12 +3189,12 @@ function getItemColors(theme, containerColor) {
|
|
|
3105
3189
|
if (containerColor) {
|
|
3106
3190
|
return {
|
|
3107
3191
|
backgroundColor: containerColor,
|
|
3108
|
-
hoveredBackgroundColor:
|
|
3192
|
+
hoveredBackgroundColor: blendColor(
|
|
3109
3193
|
containerColor,
|
|
3110
3194
|
theme.colors.onSurface,
|
|
3111
3195
|
theme.stateLayer.hoveredOpacity
|
|
3112
3196
|
),
|
|
3113
|
-
pressedBackgroundColor:
|
|
3197
|
+
pressedBackgroundColor: blendColor(
|
|
3114
3198
|
containerColor,
|
|
3115
3199
|
theme.colors.onSurface,
|
|
3116
3200
|
theme.stateLayer.pressedOpacity
|
|
@@ -3119,11 +3203,11 @@ function getItemColors(theme, containerColor) {
|
|
|
3119
3203
|
}
|
|
3120
3204
|
return {
|
|
3121
3205
|
backgroundColor: base,
|
|
3122
|
-
hoveredBackgroundColor:
|
|
3206
|
+
hoveredBackgroundColor: alphaColor(
|
|
3123
3207
|
theme.colors.onSurface,
|
|
3124
3208
|
theme.stateLayer.hoveredOpacity
|
|
3125
3209
|
),
|
|
3126
|
-
pressedBackgroundColor:
|
|
3210
|
+
pressedBackgroundColor: alphaColor(
|
|
3127
3211
|
theme.colors.onSurface,
|
|
3128
3212
|
theme.stateLayer.pressedOpacity
|
|
3129
3213
|
)
|
|
@@ -3131,7 +3215,7 @@ function getItemColors(theme, containerColor) {
|
|
|
3131
3215
|
}
|
|
3132
3216
|
function createListItemStyles(theme, lines, containerColor) {
|
|
3133
3217
|
const colors = getItemColors(theme, containerColor);
|
|
3134
|
-
return
|
|
3218
|
+
return import_react_native27.StyleSheet.create({
|
|
3135
3219
|
container: {
|
|
3136
3220
|
flexDirection: "row",
|
|
3137
3221
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -3186,7 +3270,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
3186
3270
|
});
|
|
3187
3271
|
}
|
|
3188
3272
|
function createDividerStyles(theme, inset) {
|
|
3189
|
-
return
|
|
3273
|
+
return import_react_native27.StyleSheet.create({
|
|
3190
3274
|
divider: {
|
|
3191
3275
|
height: 1,
|
|
3192
3276
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -3200,12 +3284,12 @@ var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
|
3200
3284
|
function List({ children, style, ...props }) {
|
|
3201
3285
|
const theme = (0, import_core15.useTheme)();
|
|
3202
3286
|
const styles3 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
|
|
3203
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native28.View, { ...props, style: [styles3.container, style], children });
|
|
3204
3288
|
}
|
|
3205
3289
|
|
|
3206
3290
|
// src/list/ListItem.tsx
|
|
3207
3291
|
var import_react17 = require("react");
|
|
3208
|
-
var
|
|
3292
|
+
var import_react_native29 = require("react-native");
|
|
3209
3293
|
var import_core16 = require("@onlynative/core");
|
|
3210
3294
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3211
3295
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
@@ -3238,12 +3322,12 @@ function ListItem({
|
|
|
3238
3322
|
[theme, lines, containerColor]
|
|
3239
3323
|
);
|
|
3240
3324
|
const content = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3241
|
-
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3242
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3243
|
-
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3244
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3325
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.leadingContent, children: leadingContent }),
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.textBlock, children: [
|
|
3327
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.overlineText, numberOfLines: 1, children: overlineText }),
|
|
3328
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.headlineText, numberOfLines: 1, children: headlineText }),
|
|
3245
3329
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3246
|
-
|
|
3330
|
+
import_react_native29.Text,
|
|
3247
3331
|
{
|
|
3248
3332
|
style: styles3.supportingText,
|
|
3249
3333
|
numberOfLines: supportingTextNumberOfLines,
|
|
@@ -3251,13 +3335,13 @@ function ListItem({
|
|
|
3251
3335
|
}
|
|
3252
3336
|
)
|
|
3253
3337
|
] }),
|
|
3254
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3255
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3338
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.trailingBlock, children: [
|
|
3339
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
3256
3340
|
trailingContent
|
|
3257
3341
|
] })
|
|
3258
3342
|
] });
|
|
3259
3343
|
if (!isInteractive) {
|
|
3260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { ...props, style: [styles3.container, style], children: content });
|
|
3261
3345
|
}
|
|
3262
3346
|
const resolvedStyle = (state) => [
|
|
3263
3347
|
styles3.container,
|
|
@@ -3268,23 +3352,23 @@ function ListItem({
|
|
|
3268
3352
|
typeof style === "function" ? style(state) : style
|
|
3269
3353
|
];
|
|
3270
3354
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3271
|
-
|
|
3355
|
+
import_react_native29.Pressable,
|
|
3272
3356
|
{
|
|
3273
3357
|
...props,
|
|
3274
3358
|
role: "button",
|
|
3275
3359
|
accessibilityState: { disabled: isDisabled },
|
|
3276
|
-
hitSlop:
|
|
3360
|
+
hitSlop: import_react_native29.Platform.OS === "web" ? void 0 : 4,
|
|
3277
3361
|
disabled: isDisabled,
|
|
3278
3362
|
onPress,
|
|
3279
3363
|
style: resolvedStyle,
|
|
3280
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3364
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.disabledContentWrapper, children: content }) : content
|
|
3281
3365
|
}
|
|
3282
3366
|
);
|
|
3283
3367
|
}
|
|
3284
3368
|
|
|
3285
3369
|
// src/list/ListDivider.tsx
|
|
3286
3370
|
var import_react18 = require("react");
|
|
3287
|
-
var
|
|
3371
|
+
var import_react_native30 = require("react-native");
|
|
3288
3372
|
var import_core17 = require("@onlynative/core");
|
|
3289
3373
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3290
3374
|
function ListDivider({
|
|
@@ -3297,16 +3381,16 @@ function ListDivider({
|
|
|
3297
3381
|
() => createDividerStyles(theme, inset),
|
|
3298
3382
|
[theme, inset]
|
|
3299
3383
|
);
|
|
3300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native30.View, { ...props, style: [styles3.divider, style] });
|
|
3301
3385
|
}
|
|
3302
3386
|
|
|
3303
3387
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3304
3388
|
var import_react19 = require("react");
|
|
3305
|
-
var
|
|
3389
|
+
var import_react_native32 = require("react-native");
|
|
3306
3390
|
|
|
3307
3391
|
// src/keyboard-avoiding-wrapper/styles.ts
|
|
3308
|
-
var
|
|
3309
|
-
var styles2 =
|
|
3392
|
+
var import_react_native31 = require("react-native");
|
|
3393
|
+
var styles2 = import_react_native31.StyleSheet.create({
|
|
3310
3394
|
root: {
|
|
3311
3395
|
flex: 1
|
|
3312
3396
|
},
|
|
@@ -3317,7 +3401,7 @@ var styles2 = import_react_native29.StyleSheet.create({
|
|
|
3317
3401
|
|
|
3318
3402
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3319
3403
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3320
|
-
var isIOS =
|
|
3404
|
+
var isIOS = import_react_native32.Platform.OS === "ios";
|
|
3321
3405
|
function KeyboardAvoidingWrapper({
|
|
3322
3406
|
children,
|
|
3323
3407
|
behavior = "padding",
|
|
@@ -3334,13 +3418,13 @@ function KeyboardAvoidingWrapper({
|
|
|
3334
3418
|
if (onKeyboardShow) {
|
|
3335
3419
|
const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
|
|
3336
3420
|
subscriptions.push(
|
|
3337
|
-
|
|
3421
|
+
import_react_native32.Keyboard.addListener(showEvent, onKeyboardShow)
|
|
3338
3422
|
);
|
|
3339
3423
|
}
|
|
3340
3424
|
if (onKeyboardHide) {
|
|
3341
3425
|
const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
|
|
3342
3426
|
subscriptions.push(
|
|
3343
|
-
|
|
3427
|
+
import_react_native32.Keyboard.addListener(hideEvent, onKeyboardHide)
|
|
3344
3428
|
);
|
|
3345
3429
|
}
|
|
3346
3430
|
return () => {
|
|
@@ -3348,14 +3432,14 @@ function KeyboardAvoidingWrapper({
|
|
|
3348
3432
|
};
|
|
3349
3433
|
}, [onKeyboardShow, onKeyboardHide]);
|
|
3350
3434
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3351
|
-
|
|
3435
|
+
import_react_native32.KeyboardAvoidingView,
|
|
3352
3436
|
{
|
|
3353
3437
|
style: [styles2.root, style],
|
|
3354
3438
|
behavior,
|
|
3355
3439
|
keyboardVerticalOffset,
|
|
3356
3440
|
enabled: !isIOS && enabled,
|
|
3357
3441
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3358
|
-
|
|
3442
|
+
import_react_native32.ScrollView,
|
|
3359
3443
|
{
|
|
3360
3444
|
automaticallyAdjustKeyboardInsets: isIOS && enabled,
|
|
3361
3445
|
keyboardShouldPersistTaps: "handled",
|