@onlynative/components 0.1.1-alpha.0 → 0.1.1-alpha.2
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.d.ts +21 -2
- package/dist/appbar/index.js +207 -81
- 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.d.ts +1 -1
- package/dist/index.js +409 -270
- 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 +18 -7
- 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,29 +1273,81 @@ 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
|
-
function
|
|
1283
|
+
function getColorSchemeColors(theme, colorScheme) {
|
|
1284
|
+
switch (colorScheme) {
|
|
1285
|
+
case "surfaceContainerLowest":
|
|
1286
|
+
return {
|
|
1287
|
+
containerColor: theme.colors.surfaceContainerLowest,
|
|
1288
|
+
elevatedContainerColor: theme.colors.surfaceContainerLowest,
|
|
1289
|
+
contentColor: theme.colors.onSurface
|
|
1290
|
+
};
|
|
1291
|
+
case "surfaceContainerLow":
|
|
1292
|
+
return {
|
|
1293
|
+
containerColor: theme.colors.surfaceContainerLow,
|
|
1294
|
+
elevatedContainerColor: theme.colors.surfaceContainerLow,
|
|
1295
|
+
contentColor: theme.colors.onSurface
|
|
1296
|
+
};
|
|
1297
|
+
case "surfaceContainer":
|
|
1298
|
+
return {
|
|
1299
|
+
containerColor: theme.colors.surfaceContainer,
|
|
1300
|
+
elevatedContainerColor: theme.colors.surfaceContainer,
|
|
1301
|
+
contentColor: theme.colors.onSurface
|
|
1302
|
+
};
|
|
1303
|
+
case "surfaceContainerHigh":
|
|
1304
|
+
return {
|
|
1305
|
+
containerColor: theme.colors.surfaceContainerHigh,
|
|
1306
|
+
elevatedContainerColor: theme.colors.surfaceContainerHigh,
|
|
1307
|
+
contentColor: theme.colors.onSurface
|
|
1308
|
+
};
|
|
1309
|
+
case "surfaceContainerHighest":
|
|
1310
|
+
return {
|
|
1311
|
+
containerColor: theme.colors.surfaceContainerHighest,
|
|
1312
|
+
elevatedContainerColor: theme.colors.surfaceContainerHighest,
|
|
1313
|
+
contentColor: theme.colors.onSurface
|
|
1314
|
+
};
|
|
1315
|
+
case "primary":
|
|
1316
|
+
return {
|
|
1317
|
+
containerColor: theme.colors.primary,
|
|
1318
|
+
elevatedContainerColor: theme.colors.primary,
|
|
1319
|
+
contentColor: theme.colors.onPrimary
|
|
1320
|
+
};
|
|
1321
|
+
case "primaryContainer":
|
|
1322
|
+
return {
|
|
1323
|
+
containerColor: theme.colors.primaryContainer,
|
|
1324
|
+
elevatedContainerColor: theme.colors.primaryContainer,
|
|
1325
|
+
contentColor: theme.colors.onPrimaryContainer
|
|
1326
|
+
};
|
|
1327
|
+
case "surface":
|
|
1328
|
+
default:
|
|
1329
|
+
return {
|
|
1330
|
+
containerColor: theme.colors.surface,
|
|
1331
|
+
elevatedContainerColor: theme.colors.surfaceContainer,
|
|
1332
|
+
contentColor: theme.colors.onSurface
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function createStyles3(theme, schemeColors) {
|
|
1189
1337
|
var _a;
|
|
1190
1338
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core7.defaultTopAppBarTokens;
|
|
1191
|
-
return
|
|
1339
|
+
return import_react_native13.StyleSheet.create({
|
|
1192
1340
|
root: {
|
|
1193
|
-
backgroundColor:
|
|
1341
|
+
backgroundColor: schemeColors.containerColor
|
|
1194
1342
|
},
|
|
1195
1343
|
safeArea: {
|
|
1196
|
-
backgroundColor:
|
|
1344
|
+
backgroundColor: schemeColors.containerColor
|
|
1197
1345
|
},
|
|
1198
1346
|
elevatedRoot: {
|
|
1199
|
-
backgroundColor:
|
|
1347
|
+
backgroundColor: schemeColors.elevatedContainerColor
|
|
1200
1348
|
},
|
|
1201
1349
|
elevatedSafeArea: {
|
|
1202
|
-
backgroundColor:
|
|
1350
|
+
backgroundColor: schemeColors.elevatedContainerColor
|
|
1203
1351
|
},
|
|
1204
1352
|
smallContainer: {
|
|
1205
1353
|
height: topAppBar.smallContainerHeight,
|
|
@@ -1277,10 +1425,10 @@ function createStyles3(theme) {
|
|
|
1277
1425
|
// src/appbar/AppBar.tsx
|
|
1278
1426
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1279
1427
|
function getBackIcon() {
|
|
1280
|
-
if (
|
|
1281
|
-
return
|
|
1428
|
+
if (import_react_native14.Platform.OS === "ios") {
|
|
1429
|
+
return selectRTL("chevron-left", "chevron-right");
|
|
1282
1430
|
}
|
|
1283
|
-
return
|
|
1431
|
+
return selectRTL("arrow-left", "arrow-right");
|
|
1284
1432
|
}
|
|
1285
1433
|
var titleVariantBySize = {
|
|
1286
1434
|
small: "titleLarge",
|
|
@@ -1308,7 +1456,7 @@ function withTopInset(enabled, content, style) {
|
|
|
1308
1456
|
if (enabled) {
|
|
1309
1457
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_safe_area_context2.SafeAreaView, { edges: ["top"], style, children: content });
|
|
1310
1458
|
}
|
|
1311
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style, children: content });
|
|
1312
1460
|
}
|
|
1313
1461
|
function measureWidth(event) {
|
|
1314
1462
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -1316,6 +1464,7 @@ function measureWidth(event) {
|
|
|
1316
1464
|
function AppBar({
|
|
1317
1465
|
title,
|
|
1318
1466
|
variant = "small",
|
|
1467
|
+
colorScheme = "surface",
|
|
1319
1468
|
canGoBack = false,
|
|
1320
1469
|
onBackPress,
|
|
1321
1470
|
insetTop = false,
|
|
@@ -1331,12 +1480,20 @@ function AppBar({
|
|
|
1331
1480
|
var _a;
|
|
1332
1481
|
const theme = (0, import_core8.useTheme)();
|
|
1333
1482
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core8.defaultTopAppBarTokens;
|
|
1334
|
-
const
|
|
1483
|
+
const schemeColors = (0, import_react9.useMemo)(
|
|
1484
|
+
() => getColorSchemeColors(theme, colorScheme),
|
|
1485
|
+
[theme, colorScheme]
|
|
1486
|
+
);
|
|
1487
|
+
const resolvedContentColor = contentColor != null ? contentColor : schemeColors.contentColor;
|
|
1488
|
+
const styles3 = (0, import_react9.useMemo)(
|
|
1489
|
+
() => createStyles3(theme, schemeColors),
|
|
1490
|
+
[theme, schemeColors]
|
|
1491
|
+
);
|
|
1335
1492
|
const [leadingWidth, setLeadingWidth] = (0, import_react9.useState)(0);
|
|
1336
1493
|
const [actionsWidth, setActionsWidth] = (0, import_react9.useState)(0);
|
|
1337
1494
|
const titleColorStyle = (0, import_react9.useMemo)(
|
|
1338
|
-
() => ({ color:
|
|
1339
|
-
[
|
|
1495
|
+
() => ({ color: resolvedContentColor }),
|
|
1496
|
+
[resolvedContentColor]
|
|
1340
1497
|
);
|
|
1341
1498
|
const size = resolveSize(variant);
|
|
1342
1499
|
const titleVariant = titleVariantBySize[size];
|
|
@@ -1360,25 +1517,18 @@ function AppBar({
|
|
|
1360
1517
|
if (!canGoBack) {
|
|
1361
1518
|
return null;
|
|
1362
1519
|
}
|
|
1363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1364
1521
|
IconButton,
|
|
1365
1522
|
{
|
|
1366
1523
|
icon: getBackIcon(),
|
|
1367
1524
|
size: "medium",
|
|
1368
1525
|
variant: "standard",
|
|
1369
|
-
iconColor:
|
|
1526
|
+
iconColor: resolvedContentColor,
|
|
1370
1527
|
accessibilityLabel: "Go back",
|
|
1371
1528
|
onPress: onBackPress
|
|
1372
1529
|
}
|
|
1373
1530
|
) });
|
|
1374
|
-
}, [
|
|
1375
|
-
canGoBack,
|
|
1376
|
-
contentColor,
|
|
1377
|
-
leading,
|
|
1378
|
-
onBackPress,
|
|
1379
|
-
styles3.iconFrame,
|
|
1380
|
-
theme.colors.onSurface
|
|
1381
|
-
]);
|
|
1531
|
+
}, [canGoBack, resolvedContentColor, leading, onBackPress, styles3.iconFrame]);
|
|
1382
1532
|
const actionsContent = (0, import_react9.useMemo)(() => {
|
|
1383
1533
|
if (trailing) {
|
|
1384
1534
|
return trailing;
|
|
@@ -1386,8 +1536,8 @@ function AppBar({
|
|
|
1386
1536
|
if (!actions || actions.length === 0) {
|
|
1387
1537
|
return null;
|
|
1388
1538
|
}
|
|
1389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1390
|
-
|
|
1539
|
+
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)(
|
|
1540
|
+
import_react_native14.View,
|
|
1391
1541
|
{
|
|
1392
1542
|
style: styles3.iconFrame,
|
|
1393
1543
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1396,7 +1546,7 @@ function AppBar({
|
|
|
1396
1546
|
icon: action.icon,
|
|
1397
1547
|
size: "medium",
|
|
1398
1548
|
variant: "standard",
|
|
1399
|
-
iconColor:
|
|
1549
|
+
iconColor: resolvedContentColor,
|
|
1400
1550
|
accessibilityLabel: action.accessibilityLabel,
|
|
1401
1551
|
onPress: action.onPress,
|
|
1402
1552
|
disabled: action.disabled
|
|
@@ -1405,7 +1555,7 @@ function AppBar({
|
|
|
1405
1555
|
},
|
|
1406
1556
|
`${String(action.icon)}-${index}`
|
|
1407
1557
|
)) });
|
|
1408
|
-
}, [actions,
|
|
1558
|
+
}, [actions, resolvedContentColor, styles3.actionsRow, styles3.iconFrame, trailing]);
|
|
1409
1559
|
const onLeadingLayout = (0, import_react9.useCallback)((event) => {
|
|
1410
1560
|
const nextWidth = measureWidth(event);
|
|
1411
1561
|
setLeadingWidth((currentWidth) => {
|
|
@@ -1424,9 +1574,9 @@ function AppBar({
|
|
|
1424
1574
|
return nextWidth;
|
|
1425
1575
|
});
|
|
1426
1576
|
}, []);
|
|
1427
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1577
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.topRow, children: [
|
|
1428
1578
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1429
|
-
|
|
1579
|
+
import_react_native14.View,
|
|
1430
1580
|
{
|
|
1431
1581
|
collapsable: false,
|
|
1432
1582
|
onLayout: onLeadingLayout,
|
|
@@ -1434,9 +1584,9 @@ function AppBar({
|
|
|
1434
1584
|
children: leadingContent
|
|
1435
1585
|
}
|
|
1436
1586
|
),
|
|
1437
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.topRowSpacer }),
|
|
1438
1588
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1439
|
-
|
|
1589
|
+
import_react_native14.View,
|
|
1440
1590
|
{
|
|
1441
1591
|
collapsable: false,
|
|
1442
1592
|
onLayout: onActionsLayout,
|
|
@@ -1458,10 +1608,10 @@ function AppBar({
|
|
|
1458
1608
|
containerOverride
|
|
1459
1609
|
];
|
|
1460
1610
|
if (isExpanded) {
|
|
1461
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1611
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: [styles3.expandedContainer, getSizeStyle2(styles3, size)], children: [
|
|
1462
1612
|
topRow,
|
|
1463
1613
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1464
|
-
|
|
1614
|
+
import_react_native14.View,
|
|
1465
1615
|
{
|
|
1466
1616
|
style: [
|
|
1467
1617
|
styles3.expandedTitleContainer,
|
|
@@ -1485,11 +1635,11 @@ function AppBar({
|
|
|
1485
1635
|
}
|
|
1486
1636
|
)
|
|
1487
1637
|
] });
|
|
1488
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1489
1639
|
}
|
|
1490
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1640
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.smallContainer, children: [
|
|
1491
1641
|
topRow,
|
|
1492
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: [styles3.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1493
1643
|
Typography,
|
|
1494
1644
|
{
|
|
1495
1645
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
@@ -1504,30 +1654,29 @@ function AppBar({
|
|
|
1504
1654
|
}
|
|
1505
1655
|
) })
|
|
1506
1656
|
] });
|
|
1507
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1508
1658
|
}
|
|
1509
1659
|
|
|
1510
1660
|
// src/card/Card.tsx
|
|
1511
1661
|
var import_react10 = require("react");
|
|
1512
|
-
var
|
|
1662
|
+
var import_react_native16 = require("react-native");
|
|
1513
1663
|
var import_core9 = require("@onlynative/core");
|
|
1514
1664
|
|
|
1515
1665
|
// src/card/styles.ts
|
|
1516
|
-
var
|
|
1517
|
-
var import_utils6 = require("@onlynative/utils");
|
|
1666
|
+
var import_react_native15 = require("react-native");
|
|
1518
1667
|
function getVariantColors2(theme, variant) {
|
|
1519
|
-
const disabledContainerColor =
|
|
1520
|
-
const disabledOutlineColor =
|
|
1668
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1669
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1521
1670
|
if (variant === "outlined") {
|
|
1522
1671
|
return {
|
|
1523
1672
|
backgroundColor: theme.colors.surface,
|
|
1524
1673
|
borderColor: theme.colors.outline,
|
|
1525
1674
|
borderWidth: 1,
|
|
1526
|
-
hoveredBackgroundColor:
|
|
1675
|
+
hoveredBackgroundColor: alphaColor(
|
|
1527
1676
|
theme.colors.onSurface,
|
|
1528
1677
|
theme.stateLayer.hoveredOpacity
|
|
1529
1678
|
),
|
|
1530
|
-
pressedBackgroundColor:
|
|
1679
|
+
pressedBackgroundColor: alphaColor(
|
|
1531
1680
|
theme.colors.onSurface,
|
|
1532
1681
|
theme.stateLayer.pressedOpacity
|
|
1533
1682
|
),
|
|
@@ -1540,12 +1689,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1540
1689
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
1541
1690
|
borderColor: "transparent",
|
|
1542
1691
|
borderWidth: 0,
|
|
1543
|
-
hoveredBackgroundColor:
|
|
1692
|
+
hoveredBackgroundColor: blendColor(
|
|
1544
1693
|
theme.colors.surfaceContainerHighest,
|
|
1545
1694
|
theme.colors.onSurface,
|
|
1546
1695
|
theme.stateLayer.hoveredOpacity
|
|
1547
1696
|
),
|
|
1548
|
-
pressedBackgroundColor:
|
|
1697
|
+
pressedBackgroundColor: blendColor(
|
|
1549
1698
|
theme.colors.surfaceContainerHighest,
|
|
1550
1699
|
theme.colors.onSurface,
|
|
1551
1700
|
theme.stateLayer.pressedOpacity
|
|
@@ -1558,12 +1707,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1558
1707
|
backgroundColor: theme.colors.surface,
|
|
1559
1708
|
borderColor: "transparent",
|
|
1560
1709
|
borderWidth: 0,
|
|
1561
|
-
hoveredBackgroundColor:
|
|
1710
|
+
hoveredBackgroundColor: blendColor(
|
|
1562
1711
|
theme.colors.surface,
|
|
1563
1712
|
theme.colors.onSurface,
|
|
1564
1713
|
theme.stateLayer.hoveredOpacity
|
|
1565
1714
|
),
|
|
1566
|
-
pressedBackgroundColor:
|
|
1715
|
+
pressedBackgroundColor: blendColor(
|
|
1567
1716
|
theme.colors.surface,
|
|
1568
1717
|
theme.colors.onSurface,
|
|
1569
1718
|
theme.stateLayer.pressedOpacity
|
|
@@ -1579,12 +1728,12 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1579
1728
|
backgroundColor: containerColor,
|
|
1580
1729
|
borderColor: containerColor,
|
|
1581
1730
|
borderWidth: 0,
|
|
1582
|
-
hoveredBackgroundColor:
|
|
1731
|
+
hoveredBackgroundColor: blendColor(
|
|
1583
1732
|
containerColor,
|
|
1584
1733
|
theme.colors.onSurface,
|
|
1585
1734
|
theme.stateLayer.hoveredOpacity
|
|
1586
1735
|
),
|
|
1587
|
-
pressedBackgroundColor:
|
|
1736
|
+
pressedBackgroundColor: blendColor(
|
|
1588
1737
|
containerColor,
|
|
1589
1738
|
theme.colors.onSurface,
|
|
1590
1739
|
theme.stateLayer.pressedOpacity
|
|
@@ -1594,11 +1743,11 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1594
1743
|
function createStyles4(theme, variant, containerColor) {
|
|
1595
1744
|
const baseColors = getVariantColors2(theme, variant);
|
|
1596
1745
|
const colors = applyColorOverrides2(theme, baseColors, containerColor);
|
|
1597
|
-
const elevationLevel0 =
|
|
1598
|
-
const elevationLevel1 =
|
|
1599
|
-
const elevationLevel2 =
|
|
1746
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1747
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1748
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1600
1749
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
1601
|
-
return
|
|
1750
|
+
return import_react_native15.StyleSheet.create({
|
|
1602
1751
|
container: {
|
|
1603
1752
|
borderRadius: theme.shape.cornerMedium,
|
|
1604
1753
|
backgroundColor: colors.backgroundColor,
|
|
@@ -1648,7 +1797,7 @@ function Card({
|
|
|
1648
1797
|
[theme, variant, containerColor]
|
|
1649
1798
|
);
|
|
1650
1799
|
if (!isInteractive) {
|
|
1651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { ...props, style: [styles3.container, style], children });
|
|
1652
1801
|
}
|
|
1653
1802
|
const resolvedStyle = (state) => [
|
|
1654
1803
|
styles3.container,
|
|
@@ -1659,45 +1808,43 @@ function Card({
|
|
|
1659
1808
|
typeof style === "function" ? style(state) : style
|
|
1660
1809
|
];
|
|
1661
1810
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1662
|
-
|
|
1811
|
+
import_react_native16.Pressable,
|
|
1663
1812
|
{
|
|
1664
1813
|
...props,
|
|
1665
1814
|
role: "button",
|
|
1666
1815
|
accessibilityState: { disabled: isDisabled },
|
|
1667
|
-
hitSlop:
|
|
1816
|
+
hitSlop: import_react_native16.Platform.OS === "web" ? void 0 : 4,
|
|
1668
1817
|
disabled: isDisabled,
|
|
1669
1818
|
onPress,
|
|
1670
1819
|
style: resolvedStyle,
|
|
1671
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1820
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { style: styles3.disabledContent, children }) : children
|
|
1672
1821
|
}
|
|
1673
1822
|
);
|
|
1674
1823
|
}
|
|
1675
1824
|
|
|
1676
1825
|
// src/chip/Chip.tsx
|
|
1677
1826
|
var import_react11 = require("react");
|
|
1678
|
-
var
|
|
1827
|
+
var import_react_native18 = require("react-native");
|
|
1679
1828
|
var import_core10 = require("@onlynative/core");
|
|
1680
|
-
var import_utils8 = require("@onlynative/utils");
|
|
1681
1829
|
|
|
1682
1830
|
// src/chip/styles.ts
|
|
1683
|
-
var
|
|
1684
|
-
var import_utils7 = require("@onlynative/utils");
|
|
1831
|
+
var import_react_native17 = require("react-native");
|
|
1685
1832
|
function getVariantColors3(theme, variant, elevated, selected) {
|
|
1686
|
-
const disabledContainerColor =
|
|
1687
|
-
const disabledLabelColor =
|
|
1688
|
-
const disabledOutlineColor =
|
|
1833
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1834
|
+
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
1835
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1689
1836
|
if (variant === "filter" && selected) {
|
|
1690
1837
|
return {
|
|
1691
1838
|
backgroundColor: theme.colors.secondaryContainer,
|
|
1692
1839
|
textColor: theme.colors.onSecondaryContainer,
|
|
1693
1840
|
borderColor: "transparent",
|
|
1694
1841
|
borderWidth: 0,
|
|
1695
|
-
hoveredBackgroundColor:
|
|
1842
|
+
hoveredBackgroundColor: blendColor(
|
|
1696
1843
|
theme.colors.secondaryContainer,
|
|
1697
1844
|
theme.colors.onSecondaryContainer,
|
|
1698
1845
|
theme.stateLayer.hoveredOpacity
|
|
1699
1846
|
),
|
|
1700
|
-
pressedBackgroundColor:
|
|
1847
|
+
pressedBackgroundColor: blendColor(
|
|
1701
1848
|
theme.colors.secondaryContainer,
|
|
1702
1849
|
theme.colors.onSecondaryContainer,
|
|
1703
1850
|
theme.stateLayer.pressedOpacity
|
|
@@ -1714,12 +1861,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1714
1861
|
textColor: textColor2,
|
|
1715
1862
|
borderColor: "transparent",
|
|
1716
1863
|
borderWidth: 0,
|
|
1717
|
-
hoveredBackgroundColor:
|
|
1864
|
+
hoveredBackgroundColor: blendColor(
|
|
1718
1865
|
theme.colors.surfaceContainerLow,
|
|
1719
1866
|
textColor2,
|
|
1720
1867
|
theme.stateLayer.hoveredOpacity
|
|
1721
1868
|
),
|
|
1722
|
-
pressedBackgroundColor:
|
|
1869
|
+
pressedBackgroundColor: blendColor(
|
|
1723
1870
|
theme.colors.surfaceContainerLow,
|
|
1724
1871
|
textColor2,
|
|
1725
1872
|
theme.stateLayer.pressedOpacity
|
|
@@ -1735,12 +1882,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1735
1882
|
textColor,
|
|
1736
1883
|
borderColor: theme.colors.outline,
|
|
1737
1884
|
borderWidth: 1,
|
|
1738
|
-
hoveredBackgroundColor:
|
|
1885
|
+
hoveredBackgroundColor: blendColor(
|
|
1739
1886
|
theme.colors.surface,
|
|
1740
1887
|
textColor,
|
|
1741
1888
|
theme.stateLayer.hoveredOpacity
|
|
1742
1889
|
),
|
|
1743
|
-
pressedBackgroundColor:
|
|
1890
|
+
pressedBackgroundColor: blendColor(
|
|
1744
1891
|
theme.colors.surface,
|
|
1745
1892
|
textColor,
|
|
1746
1893
|
theme.stateLayer.pressedOpacity
|
|
@@ -1760,33 +1907,33 @@ function applyColorOverrides3(theme, colors, containerColor, contentColor) {
|
|
|
1760
1907
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
1761
1908
|
result.backgroundColor = containerColor;
|
|
1762
1909
|
result.borderColor = containerColor;
|
|
1763
|
-
result.hoveredBackgroundColor =
|
|
1910
|
+
result.hoveredBackgroundColor = blendColor(
|
|
1764
1911
|
containerColor,
|
|
1765
1912
|
overlay,
|
|
1766
1913
|
theme.stateLayer.hoveredOpacity
|
|
1767
1914
|
);
|
|
1768
|
-
result.pressedBackgroundColor =
|
|
1915
|
+
result.pressedBackgroundColor = blendColor(
|
|
1769
1916
|
containerColor,
|
|
1770
1917
|
overlay,
|
|
1771
1918
|
theme.stateLayer.pressedOpacity
|
|
1772
1919
|
);
|
|
1773
1920
|
} else if (contentColor) {
|
|
1774
1921
|
if (colors.backgroundColor === "transparent") {
|
|
1775
|
-
result.hoveredBackgroundColor =
|
|
1922
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
1776
1923
|
contentColor,
|
|
1777
1924
|
theme.stateLayer.hoveredOpacity
|
|
1778
1925
|
);
|
|
1779
|
-
result.pressedBackgroundColor =
|
|
1926
|
+
result.pressedBackgroundColor = alphaColor(
|
|
1780
1927
|
contentColor,
|
|
1781
1928
|
theme.stateLayer.pressedOpacity
|
|
1782
1929
|
);
|
|
1783
1930
|
} else {
|
|
1784
|
-
result.hoveredBackgroundColor =
|
|
1931
|
+
result.hoveredBackgroundColor = blendColor(
|
|
1785
1932
|
colors.backgroundColor,
|
|
1786
1933
|
contentColor,
|
|
1787
1934
|
theme.stateLayer.hoveredOpacity
|
|
1788
1935
|
);
|
|
1789
|
-
result.pressedBackgroundColor =
|
|
1936
|
+
result.pressedBackgroundColor = blendColor(
|
|
1790
1937
|
colors.backgroundColor,
|
|
1791
1938
|
contentColor,
|
|
1792
1939
|
theme.stateLayer.pressedOpacity
|
|
@@ -1804,12 +1951,12 @@ function createStyles5(theme, variant, elevated, selected, hasLeadingContent, ha
|
|
|
1804
1951
|
contentColor
|
|
1805
1952
|
);
|
|
1806
1953
|
const labelStyle = theme.typography.labelLarge;
|
|
1807
|
-
const elevationLevel0 =
|
|
1808
|
-
const elevationLevel1 =
|
|
1809
|
-
const elevationLevel2 =
|
|
1954
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1955
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1956
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1810
1957
|
const isElevated = elevated && variant !== "input";
|
|
1811
1958
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
1812
|
-
return
|
|
1959
|
+
return import_react_native17.StyleSheet.create({
|
|
1813
1960
|
container: {
|
|
1814
1961
|
alignSelf: "flex-start",
|
|
1815
1962
|
alignItems: "center",
|
|
@@ -1907,7 +2054,7 @@ function Chip({
|
|
|
1907
2054
|
variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
|
|
1908
2055
|
);
|
|
1909
2056
|
const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
|
|
1910
|
-
const MaterialCommunityIcons = needsIcons ?
|
|
2057
|
+
const MaterialCommunityIcons = needsIcons ? getMaterialCommunityIcons() : null;
|
|
1911
2058
|
const theme = (0, import_core10.useTheme)();
|
|
1912
2059
|
const styles3 = (0, import_react11.useMemo)(
|
|
1913
2060
|
() => createStyles5(
|
|
@@ -1932,7 +2079,7 @@ function Chip({
|
|
|
1932
2079
|
]
|
|
1933
2080
|
);
|
|
1934
2081
|
const resolvedIconColor = (0, import_react11.useMemo)(() => {
|
|
1935
|
-
const base =
|
|
2082
|
+
const base = import_react_native18.StyleSheet.flatten([
|
|
1936
2083
|
styles3.label,
|
|
1937
2084
|
isDisabled ? styles3.disabledLabel : void 0
|
|
1938
2085
|
]);
|
|
@@ -1948,7 +2095,7 @@ function Chip({
|
|
|
1948
2095
|
);
|
|
1949
2096
|
const renderLeadingContent = () => {
|
|
1950
2097
|
if (variant === "input" && avatar) {
|
|
1951
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.View, { style: styles3.avatar, children: avatar });
|
|
1952
2099
|
}
|
|
1953
2100
|
if (leadingIcon) {
|
|
1954
2101
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -1975,7 +2122,7 @@ function Chip({
|
|
|
1975
2122
|
return null;
|
|
1976
2123
|
};
|
|
1977
2124
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1978
|
-
|
|
2125
|
+
import_react_native18.Pressable,
|
|
1979
2126
|
{
|
|
1980
2127
|
...props,
|
|
1981
2128
|
accessibilityRole: "button",
|
|
@@ -1983,7 +2130,7 @@ function Chip({
|
|
|
1983
2130
|
disabled: isDisabled,
|
|
1984
2131
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
1985
2132
|
},
|
|
1986
|
-
hitSlop:
|
|
2133
|
+
hitSlop: import_react_native18.Platform.OS === "web" ? void 0 : 4,
|
|
1987
2134
|
disabled: isDisabled,
|
|
1988
2135
|
style: resolveStyle2(
|
|
1989
2136
|
styles3.container,
|
|
@@ -1995,9 +2142,9 @@ function Chip({
|
|
|
1995
2142
|
),
|
|
1996
2143
|
children: [
|
|
1997
2144
|
renderLeadingContent(),
|
|
1998
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2145
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.Text, { style: computedLabelStyle, children }),
|
|
1999
2146
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2000
|
-
|
|
2147
|
+
import_react_native18.Pressable,
|
|
2001
2148
|
{
|
|
2002
2149
|
onPress: onClose,
|
|
2003
2150
|
accessibilityRole: "button",
|
|
@@ -2021,27 +2168,25 @@ function Chip({
|
|
|
2021
2168
|
|
|
2022
2169
|
// src/checkbox/Checkbox.tsx
|
|
2023
2170
|
var import_react12 = require("react");
|
|
2024
|
-
var
|
|
2171
|
+
var import_react_native20 = require("react-native");
|
|
2025
2172
|
var import_core11 = require("@onlynative/core");
|
|
2026
|
-
var import_utils10 = require("@onlynative/utils");
|
|
2027
2173
|
|
|
2028
2174
|
// src/checkbox/styles.ts
|
|
2029
|
-
var
|
|
2030
|
-
var import_utils9 = require("@onlynative/utils");
|
|
2175
|
+
var import_react_native19 = require("react-native");
|
|
2031
2176
|
function getColors(theme, checked) {
|
|
2032
|
-
const disabledOnSurface38 =
|
|
2177
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2033
2178
|
if (checked) {
|
|
2034
2179
|
return {
|
|
2035
2180
|
backgroundColor: theme.colors.primary,
|
|
2036
2181
|
borderColor: "transparent",
|
|
2037
2182
|
borderWidth: 0,
|
|
2038
2183
|
iconColor: theme.colors.onPrimary,
|
|
2039
|
-
hoveredBackgroundColor:
|
|
2184
|
+
hoveredBackgroundColor: blendColor(
|
|
2040
2185
|
theme.colors.primary,
|
|
2041
2186
|
theme.colors.onPrimary,
|
|
2042
2187
|
theme.stateLayer.hoveredOpacity
|
|
2043
2188
|
),
|
|
2044
|
-
pressedBackgroundColor:
|
|
2189
|
+
pressedBackgroundColor: blendColor(
|
|
2045
2190
|
theme.colors.primary,
|
|
2046
2191
|
theme.colors.onPrimary,
|
|
2047
2192
|
theme.stateLayer.pressedOpacity
|
|
@@ -2057,11 +2202,11 @@ function getColors(theme, checked) {
|
|
|
2057
2202
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2058
2203
|
borderWidth: 2,
|
|
2059
2204
|
iconColor: "transparent",
|
|
2060
|
-
hoveredBackgroundColor:
|
|
2205
|
+
hoveredBackgroundColor: alphaColor(
|
|
2061
2206
|
theme.colors.onSurface,
|
|
2062
2207
|
theme.stateLayer.hoveredOpacity
|
|
2063
2208
|
),
|
|
2064
|
-
pressedBackgroundColor:
|
|
2209
|
+
pressedBackgroundColor: alphaColor(
|
|
2065
2210
|
theme.colors.onSurface,
|
|
2066
2211
|
theme.stateLayer.pressedOpacity
|
|
2067
2212
|
),
|
|
@@ -2081,12 +2226,12 @@ function applyColorOverrides4(theme, colors, containerColor, contentColor) {
|
|
|
2081
2226
|
const overlay = contentColor != null ? contentColor : colors.iconColor;
|
|
2082
2227
|
result.backgroundColor = containerColor;
|
|
2083
2228
|
result.borderColor = containerColor;
|
|
2084
|
-
result.hoveredBackgroundColor =
|
|
2229
|
+
result.hoveredBackgroundColor = blendColor(
|
|
2085
2230
|
containerColor,
|
|
2086
2231
|
overlay,
|
|
2087
2232
|
theme.stateLayer.hoveredOpacity
|
|
2088
2233
|
);
|
|
2089
|
-
result.pressedBackgroundColor =
|
|
2234
|
+
result.pressedBackgroundColor = blendColor(
|
|
2090
2235
|
containerColor,
|
|
2091
2236
|
overlay,
|
|
2092
2237
|
theme.stateLayer.pressedOpacity
|
|
@@ -2103,7 +2248,7 @@ function createStyles6(theme, checked, containerColor, contentColor) {
|
|
|
2103
2248
|
);
|
|
2104
2249
|
const size = 18;
|
|
2105
2250
|
const touchTarget = 48;
|
|
2106
|
-
return
|
|
2251
|
+
return import_react_native19.StyleSheet.create({
|
|
2107
2252
|
container: {
|
|
2108
2253
|
width: touchTarget,
|
|
2109
2254
|
height: touchTarget,
|
|
@@ -2177,14 +2322,14 @@ function Checkbox({
|
|
|
2177
2322
|
}) {
|
|
2178
2323
|
const isDisabled = Boolean(disabled);
|
|
2179
2324
|
const isChecked = Boolean(value);
|
|
2180
|
-
const MaterialCommunityIcons = isChecked ?
|
|
2325
|
+
const MaterialCommunityIcons = isChecked ? getMaterialCommunityIcons() : null;
|
|
2181
2326
|
const theme = (0, import_core11.useTheme)();
|
|
2182
2327
|
const styles3 = (0, import_react12.useMemo)(
|
|
2183
2328
|
() => createStyles6(theme, isChecked, containerColor, contentColor),
|
|
2184
2329
|
[theme, isChecked, containerColor, contentColor]
|
|
2185
2330
|
);
|
|
2186
2331
|
const resolvedIconColor = (0, import_react12.useMemo)(() => {
|
|
2187
|
-
const base =
|
|
2332
|
+
const base = import_react_native20.StyleSheet.flatten([
|
|
2188
2333
|
styles3.iconColor,
|
|
2189
2334
|
isDisabled ? styles3.disabledIconColor : void 0
|
|
2190
2335
|
]);
|
|
@@ -2196,7 +2341,7 @@ function Checkbox({
|
|
|
2196
2341
|
}
|
|
2197
2342
|
};
|
|
2198
2343
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2199
|
-
|
|
2344
|
+
import_react_native20.Pressable,
|
|
2200
2345
|
{
|
|
2201
2346
|
...props,
|
|
2202
2347
|
accessibilityRole: "checkbox",
|
|
@@ -2204,7 +2349,7 @@ function Checkbox({
|
|
|
2204
2349
|
disabled: isDisabled,
|
|
2205
2350
|
checked: isChecked
|
|
2206
2351
|
},
|
|
2207
|
-
hitSlop:
|
|
2352
|
+
hitSlop: import_react_native20.Platform.OS === "web" ? void 0 : 4,
|
|
2208
2353
|
disabled: isDisabled,
|
|
2209
2354
|
onPress: handlePress,
|
|
2210
2355
|
style: resolveStyle3(
|
|
@@ -2215,7 +2360,7 @@ function Checkbox({
|
|
|
2215
2360
|
isDisabled,
|
|
2216
2361
|
style
|
|
2217
2362
|
),
|
|
2218
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2363
|
+
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
2364
|
MaterialCommunityIcons,
|
|
2220
2365
|
{
|
|
2221
2366
|
name: "check",
|
|
@@ -2229,23 +2374,22 @@ function Checkbox({
|
|
|
2229
2374
|
|
|
2230
2375
|
// src/radio/Radio.tsx
|
|
2231
2376
|
var import_react13 = require("react");
|
|
2232
|
-
var
|
|
2377
|
+
var import_react_native22 = require("react-native");
|
|
2233
2378
|
var import_core12 = require("@onlynative/core");
|
|
2234
2379
|
|
|
2235
2380
|
// src/radio/styles.ts
|
|
2236
|
-
var
|
|
2237
|
-
var import_utils11 = require("@onlynative/utils");
|
|
2381
|
+
var import_react_native21 = require("react-native");
|
|
2238
2382
|
function getColors2(theme, selected) {
|
|
2239
|
-
const disabledOnSurface38 =
|
|
2383
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2240
2384
|
if (selected) {
|
|
2241
2385
|
return {
|
|
2242
2386
|
borderColor: theme.colors.primary,
|
|
2243
2387
|
dotColor: theme.colors.primary,
|
|
2244
|
-
hoveredBackgroundColor:
|
|
2388
|
+
hoveredBackgroundColor: alphaColor(
|
|
2245
2389
|
theme.colors.primary,
|
|
2246
2390
|
theme.stateLayer.hoveredOpacity
|
|
2247
2391
|
),
|
|
2248
|
-
pressedBackgroundColor:
|
|
2392
|
+
pressedBackgroundColor: alphaColor(
|
|
2249
2393
|
theme.colors.primary,
|
|
2250
2394
|
theme.stateLayer.pressedOpacity
|
|
2251
2395
|
),
|
|
@@ -2256,11 +2400,11 @@ function getColors2(theme, selected) {
|
|
|
2256
2400
|
return {
|
|
2257
2401
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2258
2402
|
dotColor: "transparent",
|
|
2259
|
-
hoveredBackgroundColor:
|
|
2403
|
+
hoveredBackgroundColor: alphaColor(
|
|
2260
2404
|
theme.colors.onSurface,
|
|
2261
2405
|
theme.stateLayer.hoveredOpacity
|
|
2262
2406
|
),
|
|
2263
|
-
pressedBackgroundColor:
|
|
2407
|
+
pressedBackgroundColor: alphaColor(
|
|
2264
2408
|
theme.colors.onSurface,
|
|
2265
2409
|
theme.stateLayer.pressedOpacity
|
|
2266
2410
|
),
|
|
@@ -2274,11 +2418,11 @@ function applyColorOverrides5(theme, colors, containerColor, contentColor) {
|
|
|
2274
2418
|
if (containerColor) {
|
|
2275
2419
|
result.borderColor = containerColor;
|
|
2276
2420
|
result.dotColor = containerColor;
|
|
2277
|
-
result.hoveredBackgroundColor =
|
|
2421
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
2278
2422
|
containerColor,
|
|
2279
2423
|
theme.stateLayer.hoveredOpacity
|
|
2280
2424
|
);
|
|
2281
|
-
result.pressedBackgroundColor =
|
|
2425
|
+
result.pressedBackgroundColor = alphaColor(
|
|
2282
2426
|
containerColor,
|
|
2283
2427
|
theme.stateLayer.pressedOpacity
|
|
2284
2428
|
);
|
|
@@ -2298,7 +2442,7 @@ function createStyles7(theme, selected, containerColor, contentColor) {
|
|
|
2298
2442
|
const outerSize = 20;
|
|
2299
2443
|
const innerSize = 10;
|
|
2300
2444
|
const touchTarget = 48;
|
|
2301
|
-
return
|
|
2445
|
+
return import_react_native21.StyleSheet.create({
|
|
2302
2446
|
container: {
|
|
2303
2447
|
width: touchTarget,
|
|
2304
2448
|
height: touchTarget,
|
|
@@ -2383,7 +2527,7 @@ function Radio({
|
|
|
2383
2527
|
}
|
|
2384
2528
|
};
|
|
2385
2529
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2386
|
-
|
|
2530
|
+
import_react_native22.Pressable,
|
|
2387
2531
|
{
|
|
2388
2532
|
...props,
|
|
2389
2533
|
accessibilityRole: "radio",
|
|
@@ -2391,7 +2535,7 @@ function Radio({
|
|
|
2391
2535
|
disabled: isDisabled,
|
|
2392
2536
|
checked: isSelected
|
|
2393
2537
|
},
|
|
2394
|
-
hitSlop:
|
|
2538
|
+
hitSlop: import_react_native22.Platform.OS === "web" ? void 0 : 4,
|
|
2395
2539
|
disabled: isDisabled,
|
|
2396
2540
|
onPress: handlePress,
|
|
2397
2541
|
style: resolveStyle4(
|
|
@@ -2403,11 +2547,11 @@ function Radio({
|
|
|
2403
2547
|
style
|
|
2404
2548
|
),
|
|
2405
2549
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2406
|
-
|
|
2550
|
+
import_react_native22.View,
|
|
2407
2551
|
{
|
|
2408
2552
|
style: [styles3.outer, isDisabled ? styles3.disabledOuter : void 0],
|
|
2409
2553
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2410
|
-
|
|
2554
|
+
import_react_native22.View,
|
|
2411
2555
|
{
|
|
2412
2556
|
style: [
|
|
2413
2557
|
styles3.inner,
|
|
@@ -2423,27 +2567,25 @@ function Radio({
|
|
|
2423
2567
|
|
|
2424
2568
|
// src/switch/Switch.tsx
|
|
2425
2569
|
var import_react14 = require("react");
|
|
2426
|
-
var
|
|
2570
|
+
var import_react_native24 = require("react-native");
|
|
2427
2571
|
var import_core13 = require("@onlynative/core");
|
|
2428
|
-
var import_utils13 = require("@onlynative/utils");
|
|
2429
2572
|
|
|
2430
2573
|
// src/switch/styles.ts
|
|
2431
|
-
var
|
|
2432
|
-
var import_utils12 = require("@onlynative/utils");
|
|
2574
|
+
var import_react_native23 = require("react-native");
|
|
2433
2575
|
function getColors3(theme, selected) {
|
|
2434
|
-
const disabledOnSurface12 =
|
|
2435
|
-
const disabledOnSurface38 =
|
|
2576
|
+
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
2577
|
+
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2436
2578
|
if (selected) {
|
|
2437
2579
|
return {
|
|
2438
2580
|
trackColor: theme.colors.primary,
|
|
2439
2581
|
thumbColor: theme.colors.onPrimary,
|
|
2440
2582
|
iconColor: theme.colors.onPrimaryContainer,
|
|
2441
|
-
hoveredTrackColor:
|
|
2583
|
+
hoveredTrackColor: blendColor(
|
|
2442
2584
|
theme.colors.primary,
|
|
2443
2585
|
theme.colors.onPrimary,
|
|
2444
2586
|
theme.stateLayer.hoveredOpacity
|
|
2445
2587
|
),
|
|
2446
|
-
pressedTrackColor:
|
|
2588
|
+
pressedTrackColor: blendColor(
|
|
2447
2589
|
theme.colors.primary,
|
|
2448
2590
|
theme.colors.onPrimary,
|
|
2449
2591
|
theme.stateLayer.pressedOpacity
|
|
@@ -2460,12 +2602,12 @@ function getColors3(theme, selected) {
|
|
|
2460
2602
|
trackColor: theme.colors.surfaceContainerHighest,
|
|
2461
2603
|
thumbColor: theme.colors.outline,
|
|
2462
2604
|
iconColor: theme.colors.surfaceContainerHighest,
|
|
2463
|
-
hoveredTrackColor:
|
|
2605
|
+
hoveredTrackColor: blendColor(
|
|
2464
2606
|
theme.colors.surfaceContainerHighest,
|
|
2465
2607
|
theme.colors.onSurface,
|
|
2466
2608
|
theme.stateLayer.hoveredOpacity
|
|
2467
2609
|
),
|
|
2468
|
-
pressedTrackColor:
|
|
2610
|
+
pressedTrackColor: blendColor(
|
|
2469
2611
|
theme.colors.surfaceContainerHighest,
|
|
2470
2612
|
theme.colors.onSurface,
|
|
2471
2613
|
theme.stateLayer.pressedOpacity
|
|
@@ -2489,12 +2631,12 @@ function applyColorOverrides6(theme, colors, containerColor, contentColor) {
|
|
|
2489
2631
|
const overlay = contentColor != null ? contentColor : colors.thumbColor;
|
|
2490
2632
|
result.trackColor = containerColor;
|
|
2491
2633
|
result.borderColor = containerColor;
|
|
2492
|
-
result.hoveredTrackColor =
|
|
2634
|
+
result.hoveredTrackColor = blendColor(
|
|
2493
2635
|
containerColor,
|
|
2494
2636
|
overlay,
|
|
2495
2637
|
theme.stateLayer.hoveredOpacity
|
|
2496
2638
|
);
|
|
2497
|
-
result.pressedTrackColor =
|
|
2639
|
+
result.pressedTrackColor = blendColor(
|
|
2498
2640
|
containerColor,
|
|
2499
2641
|
overlay,
|
|
2500
2642
|
theme.stateLayer.pressedOpacity
|
|
@@ -2517,7 +2659,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2517
2659
|
const trackHeight = 32;
|
|
2518
2660
|
const trackPadding = 4;
|
|
2519
2661
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
2520
|
-
return
|
|
2662
|
+
return import_react_native23.StyleSheet.create({
|
|
2521
2663
|
track: {
|
|
2522
2664
|
width: trackWidth,
|
|
2523
2665
|
height: trackHeight,
|
|
@@ -2556,7 +2698,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2556
2698
|
color: colors.iconColor
|
|
2557
2699
|
},
|
|
2558
2700
|
disabledIconColor: {
|
|
2559
|
-
color:
|
|
2701
|
+
color: alphaColor(theme.colors.onSurface, 0.38)
|
|
2560
2702
|
}
|
|
2561
2703
|
});
|
|
2562
2704
|
}
|
|
@@ -2601,7 +2743,7 @@ function Switch({
|
|
|
2601
2743
|
[theme, isSelected, hasIcon, containerColor, contentColor]
|
|
2602
2744
|
);
|
|
2603
2745
|
const resolvedIconColor = (0, import_react14.useMemo)(() => {
|
|
2604
|
-
const base =
|
|
2746
|
+
const base = import_react_native24.StyleSheet.flatten([
|
|
2605
2747
|
styles3.iconColor,
|
|
2606
2748
|
isDisabled ? styles3.disabledIconColor : void 0
|
|
2607
2749
|
]);
|
|
@@ -2613,10 +2755,10 @@ function Switch({
|
|
|
2613
2755
|
}
|
|
2614
2756
|
};
|
|
2615
2757
|
const iconName = isSelected ? selectedIcon : unselectedIcon;
|
|
2616
|
-
const MaterialCommunityIcons = iconName ?
|
|
2758
|
+
const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
|
|
2617
2759
|
const iconSize = 16;
|
|
2618
2760
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2619
|
-
|
|
2761
|
+
import_react_native24.Pressable,
|
|
2620
2762
|
{
|
|
2621
2763
|
...props,
|
|
2622
2764
|
accessibilityRole: "switch",
|
|
@@ -2624,7 +2766,7 @@ function Switch({
|
|
|
2624
2766
|
disabled: isDisabled,
|
|
2625
2767
|
checked: isSelected
|
|
2626
2768
|
},
|
|
2627
|
-
hitSlop:
|
|
2769
|
+
hitSlop: import_react_native24.Platform.OS === "web" ? void 0 : 4,
|
|
2628
2770
|
disabled: isDisabled,
|
|
2629
2771
|
onPress: handlePress,
|
|
2630
2772
|
style: resolveStyle5(
|
|
@@ -2636,7 +2778,7 @@ function Switch({
|
|
|
2636
2778
|
style
|
|
2637
2779
|
),
|
|
2638
2780
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2639
|
-
|
|
2781
|
+
import_react_native24.View,
|
|
2640
2782
|
{
|
|
2641
2783
|
style: [styles3.thumb, isDisabled ? styles3.disabledThumb : void 0],
|
|
2642
2784
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -2655,13 +2797,11 @@ function Switch({
|
|
|
2655
2797
|
|
|
2656
2798
|
// src/text-field/TextField.tsx
|
|
2657
2799
|
var import_react15 = require("react");
|
|
2658
|
-
var
|
|
2800
|
+
var import_react_native26 = require("react-native");
|
|
2659
2801
|
var import_core14 = require("@onlynative/core");
|
|
2660
|
-
var import_utils15 = require("@onlynative/utils");
|
|
2661
2802
|
|
|
2662
2803
|
// src/text-field/styles.ts
|
|
2663
|
-
var
|
|
2664
|
-
var import_utils14 = require("@onlynative/utils");
|
|
2804
|
+
var import_react_native25 = require("react-native");
|
|
2665
2805
|
var CONTAINER_HEIGHT = 56;
|
|
2666
2806
|
var ICON_SIZE = 24;
|
|
2667
2807
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -2686,15 +2826,15 @@ function getVariantColors4(theme, variant) {
|
|
|
2686
2826
|
focusedLabelColor: theme.colors.primary,
|
|
2687
2827
|
errorLabelColor: theme.colors.error,
|
|
2688
2828
|
textColor: theme.colors.onSurface,
|
|
2689
|
-
disabledTextColor:
|
|
2690
|
-
disabledLabelColor:
|
|
2691
|
-
disabledBorderColor:
|
|
2829
|
+
disabledTextColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2830
|
+
disabledLabelColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2831
|
+
disabledBorderColor: alphaColor(theme.colors.onSurface, 0.12),
|
|
2692
2832
|
placeholderColor: theme.colors.onSurfaceVariant,
|
|
2693
2833
|
supportingTextColor: theme.colors.onSurfaceVariant,
|
|
2694
2834
|
errorSupportingTextColor: theme.colors.error,
|
|
2695
2835
|
iconColor: theme.colors.onSurfaceVariant,
|
|
2696
2836
|
errorIconColor: theme.colors.error,
|
|
2697
|
-
disabledIconColor:
|
|
2837
|
+
disabledIconColor: alphaColor(theme.colors.onSurface, disabledOpacity)
|
|
2698
2838
|
};
|
|
2699
2839
|
if (variant === "outlined") {
|
|
2700
2840
|
return {
|
|
@@ -2709,7 +2849,7 @@ function getVariantColors4(theme, variant) {
|
|
|
2709
2849
|
...common,
|
|
2710
2850
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
2711
2851
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2712
|
-
disabledBackgroundColor:
|
|
2852
|
+
disabledBackgroundColor: alphaColor(theme.colors.onSurface, 0.04),
|
|
2713
2853
|
labelColor: theme.colors.onSurfaceVariant
|
|
2714
2854
|
};
|
|
2715
2855
|
}
|
|
@@ -2720,7 +2860,7 @@ function createStyles9(theme, variant) {
|
|
|
2720
2860
|
const isFilled = variant === "filled";
|
|
2721
2861
|
return {
|
|
2722
2862
|
colors,
|
|
2723
|
-
styles:
|
|
2863
|
+
styles: import_react_native25.StyleSheet.create({
|
|
2724
2864
|
root: {
|
|
2725
2865
|
alignSelf: "stretch"
|
|
2726
2866
|
},
|
|
@@ -2791,7 +2931,7 @@ function createStyles9(theme, variant) {
|
|
|
2791
2931
|
fontWeight: bodySmall.fontWeight,
|
|
2792
2932
|
letterSpacing: bodySmall.letterSpacing,
|
|
2793
2933
|
color: colors.labelColor,
|
|
2794
|
-
transformOrigin:
|
|
2934
|
+
transformOrigin: transformOrigin("top")
|
|
2795
2935
|
},
|
|
2796
2936
|
labelNotch: {
|
|
2797
2937
|
paddingHorizontal: 4
|
|
@@ -2884,7 +3024,7 @@ function TextField({
|
|
|
2884
3024
|
const isError = Boolean(error) || Boolean(errorText);
|
|
2885
3025
|
const isFilled = variant === "filled";
|
|
2886
3026
|
const hasLeadingIcon = Boolean(leadingIcon);
|
|
2887
|
-
const MaterialCommunityIcons = leadingIcon || trailingIcon ?
|
|
3027
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
|
|
2888
3028
|
const { colors, styles: styles3 } = (0, import_react15.useMemo)(
|
|
2889
3029
|
() => createStyles9(theme, variant),
|
|
2890
3030
|
[theme, variant]
|
|
@@ -2897,13 +3037,13 @@ function TextField({
|
|
|
2897
3037
|
const isControlled = value !== void 0;
|
|
2898
3038
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
2899
3039
|
const isLabelFloated = isFocused || hasValue;
|
|
2900
|
-
const labelAnimRef = (0, import_react15.useRef)(new
|
|
3040
|
+
const labelAnimRef = (0, import_react15.useRef)(new import_react_native26.Animated.Value(isLabelFloated ? 1 : 0));
|
|
2901
3041
|
const labelAnim = labelAnimRef.current;
|
|
2902
3042
|
(0, import_react15.useEffect)(() => {
|
|
2903
|
-
|
|
3043
|
+
import_react_native26.Animated.timing(labelAnim, {
|
|
2904
3044
|
toValue: isLabelFloated ? 1 : 0,
|
|
2905
3045
|
duration: 150,
|
|
2906
|
-
useNativeDriver:
|
|
3046
|
+
useNativeDriver: import_react_native26.Platform.OS !== "web"
|
|
2907
3047
|
}).start();
|
|
2908
3048
|
}, [isLabelFloated, labelAnim]);
|
|
2909
3049
|
const labelScale = (0, import_react15.useMemo)(() => {
|
|
@@ -2981,9 +3121,9 @@ function TextField({
|
|
|
2981
3121
|
[styles3, isFocused, isError, isDisabled]
|
|
2982
3122
|
);
|
|
2983
3123
|
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)(
|
|
3124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: [styles3.root, style], children: [
|
|
3125
|
+
/* @__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: [
|
|
3126
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2987
3127
|
MaterialCommunityIcons,
|
|
2988
3128
|
{
|
|
2989
3129
|
name: leadingIcon,
|
|
@@ -2992,14 +3132,14 @@ function TextField({
|
|
|
2992
3132
|
}
|
|
2993
3133
|
) }) : null,
|
|
2994
3134
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2995
|
-
|
|
3135
|
+
import_react_native26.View,
|
|
2996
3136
|
{
|
|
2997
3137
|
style: [
|
|
2998
3138
|
styles3.inputWrapper,
|
|
2999
3139
|
label ? styles3.inputWrapperWithLabel : void 0
|
|
3000
3140
|
],
|
|
3001
3141
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3002
|
-
|
|
3142
|
+
import_react_native26.TextInput,
|
|
3003
3143
|
{
|
|
3004
3144
|
ref: inputRef,
|
|
3005
3145
|
...textInputProps,
|
|
@@ -3025,14 +3165,14 @@ function TextField({
|
|
|
3025
3165
|
}
|
|
3026
3166
|
),
|
|
3027
3167
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3028
|
-
|
|
3168
|
+
import_react_native26.Pressable,
|
|
3029
3169
|
{
|
|
3030
3170
|
onPress: onTrailingIconPress,
|
|
3031
3171
|
disabled: isDisabled || !onTrailingIconPress,
|
|
3032
3172
|
accessibilityRole: "button",
|
|
3033
3173
|
hitSlop: 12,
|
|
3034
3174
|
style: styles3.trailingIconPressable,
|
|
3035
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3036
3176
|
MaterialCommunityIcons,
|
|
3037
3177
|
{
|
|
3038
3178
|
name: trailingIcon,
|
|
@@ -3043,7 +3183,7 @@ function TextField({
|
|
|
3043
3183
|
}
|
|
3044
3184
|
) : null,
|
|
3045
3185
|
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3046
|
-
|
|
3186
|
+
import_react_native26.Animated.Text,
|
|
3047
3187
|
{
|
|
3048
3188
|
numberOfLines: 1,
|
|
3049
3189
|
style: [
|
|
@@ -3063,10 +3203,10 @@ function TextField({
|
|
|
3063
3203
|
children: label
|
|
3064
3204
|
}
|
|
3065
3205
|
) : null,
|
|
3066
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3206
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: indicatorStyle }) : null
|
|
3067
3207
|
] }) }),
|
|
3068
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3069
|
-
|
|
3208
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3209
|
+
import_react_native26.Text,
|
|
3070
3210
|
{
|
|
3071
3211
|
style: [
|
|
3072
3212
|
styles3.supportingText,
|
|
@@ -3080,12 +3220,11 @@ function TextField({
|
|
|
3080
3220
|
|
|
3081
3221
|
// src/list/List.tsx
|
|
3082
3222
|
var import_react16 = require("react");
|
|
3083
|
-
var
|
|
3223
|
+
var import_react_native28 = require("react-native");
|
|
3084
3224
|
var import_core15 = require("@onlynative/core");
|
|
3085
3225
|
|
|
3086
3226
|
// src/list/styles.ts
|
|
3087
|
-
var
|
|
3088
|
-
var import_utils16 = require("@onlynative/utils");
|
|
3227
|
+
var import_react_native27 = require("react-native");
|
|
3089
3228
|
var ITEM_PADDING_VERTICAL = 12;
|
|
3090
3229
|
var INSET_START = 56;
|
|
3091
3230
|
var MIN_HEIGHT = {
|
|
@@ -3094,7 +3233,7 @@ var MIN_HEIGHT = {
|
|
|
3094
3233
|
3: 88
|
|
3095
3234
|
};
|
|
3096
3235
|
function createListStyles(theme) {
|
|
3097
|
-
return
|
|
3236
|
+
return import_react_native27.StyleSheet.create({
|
|
3098
3237
|
container: {
|
|
3099
3238
|
paddingVertical: theme.spacing.sm
|
|
3100
3239
|
}
|
|
@@ -3105,12 +3244,12 @@ function getItemColors(theme, containerColor) {
|
|
|
3105
3244
|
if (containerColor) {
|
|
3106
3245
|
return {
|
|
3107
3246
|
backgroundColor: containerColor,
|
|
3108
|
-
hoveredBackgroundColor:
|
|
3247
|
+
hoveredBackgroundColor: blendColor(
|
|
3109
3248
|
containerColor,
|
|
3110
3249
|
theme.colors.onSurface,
|
|
3111
3250
|
theme.stateLayer.hoveredOpacity
|
|
3112
3251
|
),
|
|
3113
|
-
pressedBackgroundColor:
|
|
3252
|
+
pressedBackgroundColor: blendColor(
|
|
3114
3253
|
containerColor,
|
|
3115
3254
|
theme.colors.onSurface,
|
|
3116
3255
|
theme.stateLayer.pressedOpacity
|
|
@@ -3119,11 +3258,11 @@ function getItemColors(theme, containerColor) {
|
|
|
3119
3258
|
}
|
|
3120
3259
|
return {
|
|
3121
3260
|
backgroundColor: base,
|
|
3122
|
-
hoveredBackgroundColor:
|
|
3261
|
+
hoveredBackgroundColor: alphaColor(
|
|
3123
3262
|
theme.colors.onSurface,
|
|
3124
3263
|
theme.stateLayer.hoveredOpacity
|
|
3125
3264
|
),
|
|
3126
|
-
pressedBackgroundColor:
|
|
3265
|
+
pressedBackgroundColor: alphaColor(
|
|
3127
3266
|
theme.colors.onSurface,
|
|
3128
3267
|
theme.stateLayer.pressedOpacity
|
|
3129
3268
|
)
|
|
@@ -3131,7 +3270,7 @@ function getItemColors(theme, containerColor) {
|
|
|
3131
3270
|
}
|
|
3132
3271
|
function createListItemStyles(theme, lines, containerColor) {
|
|
3133
3272
|
const colors = getItemColors(theme, containerColor);
|
|
3134
|
-
return
|
|
3273
|
+
return import_react_native27.StyleSheet.create({
|
|
3135
3274
|
container: {
|
|
3136
3275
|
flexDirection: "row",
|
|
3137
3276
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -3186,7 +3325,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
3186
3325
|
});
|
|
3187
3326
|
}
|
|
3188
3327
|
function createDividerStyles(theme, inset) {
|
|
3189
|
-
return
|
|
3328
|
+
return import_react_native27.StyleSheet.create({
|
|
3190
3329
|
divider: {
|
|
3191
3330
|
height: 1,
|
|
3192
3331
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -3200,12 +3339,12 @@ var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
|
3200
3339
|
function List({ children, style, ...props }) {
|
|
3201
3340
|
const theme = (0, import_core15.useTheme)();
|
|
3202
3341
|
const styles3 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
|
|
3203
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native28.View, { ...props, style: [styles3.container, style], children });
|
|
3204
3343
|
}
|
|
3205
3344
|
|
|
3206
3345
|
// src/list/ListItem.tsx
|
|
3207
3346
|
var import_react17 = require("react");
|
|
3208
|
-
var
|
|
3347
|
+
var import_react_native29 = require("react-native");
|
|
3209
3348
|
var import_core16 = require("@onlynative/core");
|
|
3210
3349
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3211
3350
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
@@ -3238,12 +3377,12 @@ function ListItem({
|
|
|
3238
3377
|
[theme, lines, containerColor]
|
|
3239
3378
|
);
|
|
3240
3379
|
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)(
|
|
3380
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.leadingContent, children: leadingContent }),
|
|
3381
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.textBlock, children: [
|
|
3382
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.overlineText, numberOfLines: 1, children: overlineText }),
|
|
3383
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.headlineText, numberOfLines: 1, children: headlineText }),
|
|
3245
3384
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3246
|
-
|
|
3385
|
+
import_react_native29.Text,
|
|
3247
3386
|
{
|
|
3248
3387
|
style: styles3.supportingText,
|
|
3249
3388
|
numberOfLines: supportingTextNumberOfLines,
|
|
@@ -3251,13 +3390,13 @@ function ListItem({
|
|
|
3251
3390
|
}
|
|
3252
3391
|
)
|
|
3253
3392
|
] }),
|
|
3254
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3255
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3393
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.trailingBlock, children: [
|
|
3394
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
3256
3395
|
trailingContent
|
|
3257
3396
|
] })
|
|
3258
3397
|
] });
|
|
3259
3398
|
if (!isInteractive) {
|
|
3260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { ...props, style: [styles3.container, style], children: content });
|
|
3261
3400
|
}
|
|
3262
3401
|
const resolvedStyle = (state) => [
|
|
3263
3402
|
styles3.container,
|
|
@@ -3268,23 +3407,23 @@ function ListItem({
|
|
|
3268
3407
|
typeof style === "function" ? style(state) : style
|
|
3269
3408
|
];
|
|
3270
3409
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3271
|
-
|
|
3410
|
+
import_react_native29.Pressable,
|
|
3272
3411
|
{
|
|
3273
3412
|
...props,
|
|
3274
3413
|
role: "button",
|
|
3275
3414
|
accessibilityState: { disabled: isDisabled },
|
|
3276
|
-
hitSlop:
|
|
3415
|
+
hitSlop: import_react_native29.Platform.OS === "web" ? void 0 : 4,
|
|
3277
3416
|
disabled: isDisabled,
|
|
3278
3417
|
onPress,
|
|
3279
3418
|
style: resolvedStyle,
|
|
3280
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3419
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.disabledContentWrapper, children: content }) : content
|
|
3281
3420
|
}
|
|
3282
3421
|
);
|
|
3283
3422
|
}
|
|
3284
3423
|
|
|
3285
3424
|
// src/list/ListDivider.tsx
|
|
3286
3425
|
var import_react18 = require("react");
|
|
3287
|
-
var
|
|
3426
|
+
var import_react_native30 = require("react-native");
|
|
3288
3427
|
var import_core17 = require("@onlynative/core");
|
|
3289
3428
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3290
3429
|
function ListDivider({
|
|
@@ -3297,16 +3436,16 @@ function ListDivider({
|
|
|
3297
3436
|
() => createDividerStyles(theme, inset),
|
|
3298
3437
|
[theme, inset]
|
|
3299
3438
|
);
|
|
3300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native30.View, { ...props, style: [styles3.divider, style] });
|
|
3301
3440
|
}
|
|
3302
3441
|
|
|
3303
3442
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3304
3443
|
var import_react19 = require("react");
|
|
3305
|
-
var
|
|
3444
|
+
var import_react_native32 = require("react-native");
|
|
3306
3445
|
|
|
3307
3446
|
// src/keyboard-avoiding-wrapper/styles.ts
|
|
3308
|
-
var
|
|
3309
|
-
var styles2 =
|
|
3447
|
+
var import_react_native31 = require("react-native");
|
|
3448
|
+
var styles2 = import_react_native31.StyleSheet.create({
|
|
3310
3449
|
root: {
|
|
3311
3450
|
flex: 1
|
|
3312
3451
|
},
|
|
@@ -3317,7 +3456,7 @@ var styles2 = import_react_native29.StyleSheet.create({
|
|
|
3317
3456
|
|
|
3318
3457
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3319
3458
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3320
|
-
var isIOS =
|
|
3459
|
+
var isIOS = import_react_native32.Platform.OS === "ios";
|
|
3321
3460
|
function KeyboardAvoidingWrapper({
|
|
3322
3461
|
children,
|
|
3323
3462
|
behavior = "padding",
|
|
@@ -3334,13 +3473,13 @@ function KeyboardAvoidingWrapper({
|
|
|
3334
3473
|
if (onKeyboardShow) {
|
|
3335
3474
|
const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
|
|
3336
3475
|
subscriptions.push(
|
|
3337
|
-
|
|
3476
|
+
import_react_native32.Keyboard.addListener(showEvent, onKeyboardShow)
|
|
3338
3477
|
);
|
|
3339
3478
|
}
|
|
3340
3479
|
if (onKeyboardHide) {
|
|
3341
3480
|
const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
|
|
3342
3481
|
subscriptions.push(
|
|
3343
|
-
|
|
3482
|
+
import_react_native32.Keyboard.addListener(hideEvent, onKeyboardHide)
|
|
3344
3483
|
);
|
|
3345
3484
|
}
|
|
3346
3485
|
return () => {
|
|
@@ -3348,14 +3487,14 @@ function KeyboardAvoidingWrapper({
|
|
|
3348
3487
|
};
|
|
3349
3488
|
}, [onKeyboardShow, onKeyboardHide]);
|
|
3350
3489
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3351
|
-
|
|
3490
|
+
import_react_native32.KeyboardAvoidingView,
|
|
3352
3491
|
{
|
|
3353
3492
|
style: [styles2.root, style],
|
|
3354
3493
|
behavior,
|
|
3355
3494
|
keyboardVerticalOffset,
|
|
3356
3495
|
enabled: !isIOS && enabled,
|
|
3357
3496
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3358
|
-
|
|
3497
|
+
import_react_native32.ScrollView,
|
|
3359
3498
|
{
|
|
3360
3499
|
automaticallyAdjustKeyboardInsets: isIOS && enabled,
|
|
3361
3500
|
keyboardShouldPersistTaps: "handled",
|