@vellira-ui/react-native 2.27.0 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +43 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2503,6 +2503,9 @@ var createStyles22 = (theme) => StyleSheet22.create({
2503
2503
  alignItems: "center",
2504
2504
  gap: theme.tokens.spacing[3]
2505
2505
  },
2506
+ wrapperLabelStart: {
2507
+ flexDirection: "row-reverse"
2508
+ },
2506
2509
  iconOnly: {
2507
2510
  justifyContent: "center",
2508
2511
  minWidth: 44,
@@ -2536,16 +2539,16 @@ var createStyles22 = (theme) => StyleSheet22.create({
2536
2539
  borderWidth: 2
2537
2540
  },
2538
2541
  boxChecked: {
2539
- backgroundColor: theme.components.checkbox.checked.default.bg,
2540
- borderColor: theme.components.checkbox.checked.default.border
2542
+ backgroundColor: theme.components.checkbox.primary.default.bg,
2543
+ borderColor: theme.components.checkbox.primary.default.border
2541
2544
  },
2542
2545
  boxCheckedHover: {
2543
- backgroundColor: theme.components.checkbox.checked.hover.bg,
2544
- borderColor: theme.components.checkbox.checked.hover.border
2546
+ backgroundColor: theme.components.checkbox.primary.hover.bg,
2547
+ borderColor: theme.components.checkbox.primary.hover.border
2545
2548
  },
2546
2549
  boxCheckedPressed: {
2547
- backgroundColor: theme.components.checkbox.checked.pressed.bg,
2548
- borderColor: theme.components.checkbox.checked.pressed.border
2550
+ backgroundColor: theme.components.checkbox.primary.pressed.bg,
2551
+ borderColor: theme.components.checkbox.primary.pressed.border
2549
2552
  },
2550
2553
  boxDisabled: {
2551
2554
  backgroundColor: theme.components.checkbox.disabled.bg,
@@ -2555,25 +2558,25 @@ var createStyles22 = (theme) => StyleSheet22.create({
2555
2558
  borderColor: theme.components.checkbox.error.border
2556
2559
  },
2557
2560
  checkmark: {
2558
- color: theme.components.checkbox.checked.default.fg
2561
+ color: theme.components.checkbox.primary.default.fg
2559
2562
  },
2560
2563
  checkmarkHover: {
2561
- color: theme.components.checkbox.checked.hover.fg
2564
+ color: theme.components.checkbox.primary.hover.fg
2562
2565
  },
2563
2566
  checkmarkPressed: {
2564
- color: theme.components.checkbox.checked.pressed.fg
2567
+ color: theme.components.checkbox.primary.pressed.fg
2565
2568
  },
2566
2569
  indeterminateMark: {
2567
2570
  width: "60%",
2568
2571
  height: 2,
2569
- backgroundColor: theme.components.checkbox.checked.default.fg,
2572
+ backgroundColor: theme.components.checkbox.primary.default.fg,
2570
2573
  borderRadius: theme.tokens.radius.full
2571
2574
  },
2572
2575
  indeterminateMarkHover: {
2573
- backgroundColor: theme.components.checkbox.checked.hover.fg
2576
+ backgroundColor: theme.components.checkbox.primary.hover.fg
2574
2577
  },
2575
2578
  indeterminateMarkPressed: {
2576
- backgroundColor: theme.components.checkbox.checked.pressed.fg
2579
+ backgroundColor: theme.components.checkbox.primary.pressed.fg
2577
2580
  },
2578
2581
  label: {
2579
2582
  flexShrink: 1,
@@ -2581,13 +2584,13 @@ var createStyles22 = (theme) => StyleSheet22.create({
2581
2584
  color: theme.components.checkbox.default.fg
2582
2585
  },
2583
2586
  labelChecked: {
2584
- color: theme.components.checkbox.checked.default.labelFg
2587
+ color: theme.components.checkbox.primary.default.labelFg
2585
2588
  },
2586
2589
  labelCheckedHover: {
2587
- color: theme.components.checkbox.checked.hover.labelFg
2590
+ color: theme.components.checkbox.primary.hover.labelFg
2588
2591
  },
2589
2592
  labelCheckedPressed: {
2590
- color: theme.components.checkbox.checked.pressed.labelFg
2593
+ color: theme.components.checkbox.primary.pressed.labelFg
2591
2594
  },
2592
2595
  labelSm: {
2593
2596
  fontSize: theme.tokens.typography.size.sm,
@@ -2644,12 +2647,16 @@ var Checkbox = forwardRef2(
2644
2647
  ({
2645
2648
  label,
2646
2649
  description,
2650
+ icon,
2651
+ indeterminateIcon,
2647
2652
  checked,
2648
2653
  defaultChecked = false,
2649
2654
  disabled = false,
2650
2655
  required = false,
2651
2656
  indeterminate = false,
2652
2657
  size = "md",
2658
+ color = "primary",
2659
+ labelPosition = "end",
2653
2660
  onCheckedChange,
2654
2661
  error,
2655
2662
  style,
@@ -2659,6 +2666,7 @@ var Checkbox = forwardRef2(
2659
2666
  }, ref) => {
2660
2667
  const { theme } = useTheme();
2661
2668
  const styles = useThemeStyles(createStyles22);
2669
+ const checkboxColor = theme.components.checkbox[color];
2662
2670
  const boxSizeStyle = {
2663
2671
  sm: styles.boxSm,
2664
2672
  md: styles.boxMd,
@@ -2710,13 +2718,14 @@ var Checkbox = forwardRef2(
2710
2718
  accessibilityLabel: resolvedAccessibilityLabel,
2711
2719
  style: [
2712
2720
  styles.wrapper,
2721
+ labelPosition === "start" && styles.wrapperLabelStart,
2713
2722
  !label && styles.iconOnly,
2714
2723
  disabled && styles.disabled,
2715
2724
  style
2716
2725
  ],
2717
2726
  children: ({ pressed }) => {
2718
2727
  const isSelected = isChecked || indeterminate;
2719
- const checkColor = disabled ? theme.components.checkbox.disabled.fg : pressed && isSelected ? theme.components.checkbox.checked.pressed.fg : theme.components.checkbox.checked.default.fg;
2728
+ const checkColor = disabled ? theme.components.checkbox.disabled.fg : pressed && isSelected ? checkboxColor.pressed.fg : checkboxColor.default.fg;
2720
2729
  return /* @__PURE__ */ jsxs13(Fragment4, { children: [
2721
2730
  /* @__PURE__ */ jsx24(
2722
2731
  View20,
@@ -2724,20 +2733,29 @@ var Checkbox = forwardRef2(
2724
2733
  style: [
2725
2734
  styles.box,
2726
2735
  boxSizeStyle[size],
2727
- isSelected && styles.boxChecked,
2728
- isSelected && pressed && styles.boxCheckedPressed,
2736
+ isSelected && {
2737
+ backgroundColor: checkboxColor.default.bg,
2738
+ borderColor: checkboxColor.default.border
2739
+ },
2740
+ isSelected && pressed && {
2741
+ backgroundColor: checkboxColor.pressed.bg,
2742
+ borderColor: checkboxColor.pressed.border,
2743
+ transform: [{ scale: 0.96 }]
2744
+ },
2729
2745
  hasError && styles.boxError,
2730
2746
  disabled && styles.boxDisabled
2731
2747
  ],
2732
- children: indeterminate ? /* @__PURE__ */ jsx24(
2748
+ children: indeterminate ? indeterminateIcon ?? /* @__PURE__ */ jsx24(
2733
2749
  View20,
2734
2750
  {
2735
2751
  style: [
2736
2752
  styles.indeterminateMark,
2737
- pressed && styles.indeterminateMarkPressed
2753
+ {
2754
+ backgroundColor: pressed ? checkboxColor.pressed.fg : checkboxColor.default.fg
2755
+ }
2738
2756
  ]
2739
2757
  }
2740
- ) : isChecked && /* @__PURE__ */ jsx24(Check, { size: iconSizeBySize[size], color: checkColor })
2758
+ ) : isChecked && (icon ?? /* @__PURE__ */ jsx24(Check, { size: iconSizeBySize[size], color: checkColor }))
2741
2759
  }
2742
2760
  ),
2743
2761
  label && /* @__PURE__ */ jsxs13(
@@ -2746,8 +2764,10 @@ var Checkbox = forwardRef2(
2746
2764
  style: [
2747
2765
  styles.label,
2748
2766
  labelSizeStyle[size],
2749
- isSelected && styles.labelChecked,
2750
- isSelected && pressed && styles.labelCheckedPressed,
2767
+ isSelected && { color: checkboxColor.default.labelFg },
2768
+ isSelected && pressed && {
2769
+ color: checkboxColor.pressed.labelFg
2770
+ },
2751
2771
  disabled && styles.labelDisabled
2752
2772
  ],
2753
2773
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellira-ui/react-native",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "description": "React Native components for Vellira Design System",
5
5
  "author": "Roman Bakurov",
6
6
  "license": "MIT",