@vellira-ui/react-native 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +85 -44
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1118,6 +1118,7 @@ var RadioGroup = forwardRef(
|
|
|
1118
1118
|
disabled = false,
|
|
1119
1119
|
required = false,
|
|
1120
1120
|
size = "md",
|
|
1121
|
+
color = "primary",
|
|
1121
1122
|
orientation = "vertical",
|
|
1122
1123
|
label,
|
|
1123
1124
|
description,
|
|
@@ -1166,6 +1167,7 @@ var RadioGroup = forwardRef(
|
|
|
1166
1167
|
required,
|
|
1167
1168
|
invalid,
|
|
1168
1169
|
size,
|
|
1170
|
+
color,
|
|
1169
1171
|
onValueChange: setSelectedValue
|
|
1170
1172
|
},
|
|
1171
1173
|
children: /* @__PURE__ */ jsx15(
|
|
@@ -2503,6 +2505,9 @@ var createStyles22 = (theme) => StyleSheet22.create({
|
|
|
2503
2505
|
alignItems: "center",
|
|
2504
2506
|
gap: theme.tokens.spacing[3]
|
|
2505
2507
|
},
|
|
2508
|
+
wrapperLabelStart: {
|
|
2509
|
+
flexDirection: "row-reverse"
|
|
2510
|
+
},
|
|
2506
2511
|
iconOnly: {
|
|
2507
2512
|
justifyContent: "center",
|
|
2508
2513
|
minWidth: 44,
|
|
@@ -2536,16 +2541,16 @@ var createStyles22 = (theme) => StyleSheet22.create({
|
|
|
2536
2541
|
borderWidth: 2
|
|
2537
2542
|
},
|
|
2538
2543
|
boxChecked: {
|
|
2539
|
-
backgroundColor: theme.components.checkbox.
|
|
2540
|
-
borderColor: theme.components.checkbox.
|
|
2544
|
+
backgroundColor: theme.components.checkbox.primary.default.bg,
|
|
2545
|
+
borderColor: theme.components.checkbox.primary.default.border
|
|
2541
2546
|
},
|
|
2542
2547
|
boxCheckedHover: {
|
|
2543
|
-
backgroundColor: theme.components.checkbox.
|
|
2544
|
-
borderColor: theme.components.checkbox.
|
|
2548
|
+
backgroundColor: theme.components.checkbox.primary.hover.bg,
|
|
2549
|
+
borderColor: theme.components.checkbox.primary.hover.border
|
|
2545
2550
|
},
|
|
2546
2551
|
boxCheckedPressed: {
|
|
2547
|
-
backgroundColor: theme.components.checkbox.
|
|
2548
|
-
borderColor: theme.components.checkbox.
|
|
2552
|
+
backgroundColor: theme.components.checkbox.primary.pressed.bg,
|
|
2553
|
+
borderColor: theme.components.checkbox.primary.pressed.border
|
|
2549
2554
|
},
|
|
2550
2555
|
boxDisabled: {
|
|
2551
2556
|
backgroundColor: theme.components.checkbox.disabled.bg,
|
|
@@ -2555,25 +2560,25 @@ var createStyles22 = (theme) => StyleSheet22.create({
|
|
|
2555
2560
|
borderColor: theme.components.checkbox.error.border
|
|
2556
2561
|
},
|
|
2557
2562
|
checkmark: {
|
|
2558
|
-
color: theme.components.checkbox.
|
|
2563
|
+
color: theme.components.checkbox.primary.default.fg
|
|
2559
2564
|
},
|
|
2560
2565
|
checkmarkHover: {
|
|
2561
|
-
color: theme.components.checkbox.
|
|
2566
|
+
color: theme.components.checkbox.primary.hover.fg
|
|
2562
2567
|
},
|
|
2563
2568
|
checkmarkPressed: {
|
|
2564
|
-
color: theme.components.checkbox.
|
|
2569
|
+
color: theme.components.checkbox.primary.pressed.fg
|
|
2565
2570
|
},
|
|
2566
2571
|
indeterminateMark: {
|
|
2567
2572
|
width: "60%",
|
|
2568
2573
|
height: 2,
|
|
2569
|
-
backgroundColor: theme.components.checkbox.
|
|
2574
|
+
backgroundColor: theme.components.checkbox.primary.default.fg,
|
|
2570
2575
|
borderRadius: theme.tokens.radius.full
|
|
2571
2576
|
},
|
|
2572
2577
|
indeterminateMarkHover: {
|
|
2573
|
-
backgroundColor: theme.components.checkbox.
|
|
2578
|
+
backgroundColor: theme.components.checkbox.primary.hover.fg
|
|
2574
2579
|
},
|
|
2575
2580
|
indeterminateMarkPressed: {
|
|
2576
|
-
backgroundColor: theme.components.checkbox.
|
|
2581
|
+
backgroundColor: theme.components.checkbox.primary.pressed.fg
|
|
2577
2582
|
},
|
|
2578
2583
|
label: {
|
|
2579
2584
|
flexShrink: 1,
|
|
@@ -2581,13 +2586,13 @@ var createStyles22 = (theme) => StyleSheet22.create({
|
|
|
2581
2586
|
color: theme.components.checkbox.default.fg
|
|
2582
2587
|
},
|
|
2583
2588
|
labelChecked: {
|
|
2584
|
-
color: theme.components.checkbox.
|
|
2589
|
+
color: theme.components.checkbox.primary.default.labelFg
|
|
2585
2590
|
},
|
|
2586
2591
|
labelCheckedHover: {
|
|
2587
|
-
color: theme.components.checkbox.
|
|
2592
|
+
color: theme.components.checkbox.primary.hover.labelFg
|
|
2588
2593
|
},
|
|
2589
2594
|
labelCheckedPressed: {
|
|
2590
|
-
color: theme.components.checkbox.
|
|
2595
|
+
color: theme.components.checkbox.primary.pressed.labelFg
|
|
2591
2596
|
},
|
|
2592
2597
|
labelSm: {
|
|
2593
2598
|
fontSize: theme.tokens.typography.size.sm,
|
|
@@ -2644,12 +2649,16 @@ var Checkbox = forwardRef2(
|
|
|
2644
2649
|
({
|
|
2645
2650
|
label,
|
|
2646
2651
|
description,
|
|
2652
|
+
icon,
|
|
2653
|
+
indeterminateIcon,
|
|
2647
2654
|
checked,
|
|
2648
2655
|
defaultChecked = false,
|
|
2649
2656
|
disabled = false,
|
|
2650
2657
|
required = false,
|
|
2651
2658
|
indeterminate = false,
|
|
2652
2659
|
size = "md",
|
|
2660
|
+
color = "primary",
|
|
2661
|
+
labelPosition = "end",
|
|
2653
2662
|
onCheckedChange,
|
|
2654
2663
|
error,
|
|
2655
2664
|
style,
|
|
@@ -2659,6 +2668,7 @@ var Checkbox = forwardRef2(
|
|
|
2659
2668
|
}, ref) => {
|
|
2660
2669
|
const { theme } = useTheme();
|
|
2661
2670
|
const styles = useThemeStyles(createStyles22);
|
|
2671
|
+
const checkboxColor = theme.components.checkbox[color];
|
|
2662
2672
|
const boxSizeStyle = {
|
|
2663
2673
|
sm: styles.boxSm,
|
|
2664
2674
|
md: styles.boxMd,
|
|
@@ -2710,13 +2720,14 @@ var Checkbox = forwardRef2(
|
|
|
2710
2720
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
2711
2721
|
style: [
|
|
2712
2722
|
styles.wrapper,
|
|
2723
|
+
labelPosition === "start" && styles.wrapperLabelStart,
|
|
2713
2724
|
!label && styles.iconOnly,
|
|
2714
2725
|
disabled && styles.disabled,
|
|
2715
2726
|
style
|
|
2716
2727
|
],
|
|
2717
2728
|
children: ({ pressed }) => {
|
|
2718
2729
|
const isSelected = isChecked || indeterminate;
|
|
2719
|
-
const checkColor = disabled ? theme.components.checkbox.disabled.fg : pressed && isSelected ?
|
|
2730
|
+
const checkColor = disabled ? theme.components.checkbox.disabled.fg : pressed && isSelected ? checkboxColor.pressed.fg : checkboxColor.default.fg;
|
|
2720
2731
|
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2721
2732
|
/* @__PURE__ */ jsx24(
|
|
2722
2733
|
View20,
|
|
@@ -2724,20 +2735,29 @@ var Checkbox = forwardRef2(
|
|
|
2724
2735
|
style: [
|
|
2725
2736
|
styles.box,
|
|
2726
2737
|
boxSizeStyle[size],
|
|
2727
|
-
isSelected &&
|
|
2728
|
-
|
|
2738
|
+
isSelected && {
|
|
2739
|
+
backgroundColor: checkboxColor.default.bg,
|
|
2740
|
+
borderColor: checkboxColor.default.border
|
|
2741
|
+
},
|
|
2742
|
+
isSelected && pressed && {
|
|
2743
|
+
backgroundColor: checkboxColor.pressed.bg,
|
|
2744
|
+
borderColor: checkboxColor.pressed.border,
|
|
2745
|
+
transform: [{ scale: 0.96 }]
|
|
2746
|
+
},
|
|
2729
2747
|
hasError && styles.boxError,
|
|
2730
2748
|
disabled && styles.boxDisabled
|
|
2731
2749
|
],
|
|
2732
|
-
children: indeterminate ? /* @__PURE__ */ jsx24(
|
|
2750
|
+
children: indeterminate ? indeterminateIcon ?? /* @__PURE__ */ jsx24(
|
|
2733
2751
|
View20,
|
|
2734
2752
|
{
|
|
2735
2753
|
style: [
|
|
2736
2754
|
styles.indeterminateMark,
|
|
2737
|
-
|
|
2755
|
+
{
|
|
2756
|
+
backgroundColor: pressed ? checkboxColor.pressed.fg : checkboxColor.default.fg
|
|
2757
|
+
}
|
|
2738
2758
|
]
|
|
2739
2759
|
}
|
|
2740
|
-
) : isChecked && /* @__PURE__ */ jsx24(Check, { size: iconSizeBySize[size], color: checkColor })
|
|
2760
|
+
) : isChecked && (icon ?? /* @__PURE__ */ jsx24(Check, { size: iconSizeBySize[size], color: checkColor }))
|
|
2741
2761
|
}
|
|
2742
2762
|
),
|
|
2743
2763
|
label && /* @__PURE__ */ jsxs13(
|
|
@@ -2746,8 +2766,10 @@ var Checkbox = forwardRef2(
|
|
|
2746
2766
|
style: [
|
|
2747
2767
|
styles.label,
|
|
2748
2768
|
labelSizeStyle[size],
|
|
2749
|
-
isSelected &&
|
|
2750
|
-
isSelected && pressed &&
|
|
2769
|
+
isSelected && { color: checkboxColor.default.labelFg },
|
|
2770
|
+
isSelected && pressed && {
|
|
2771
|
+
color: checkboxColor.pressed.labelFg
|
|
2772
|
+
},
|
|
2751
2773
|
disabled && styles.labelDisabled
|
|
2752
2774
|
],
|
|
2753
2775
|
children: [
|
|
@@ -3164,12 +3186,12 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3164
3186
|
backgroundColor: theme.components.radio.default.bg
|
|
3165
3187
|
},
|
|
3166
3188
|
controlChecked: {
|
|
3167
|
-
borderColor: theme.components.radio.
|
|
3168
|
-
backgroundColor: theme.components.radio.
|
|
3189
|
+
borderColor: theme.components.radio.primary.default.border,
|
|
3190
|
+
backgroundColor: theme.components.radio.primary.default.bg
|
|
3169
3191
|
},
|
|
3170
3192
|
controlCheckedPressed: {
|
|
3171
|
-
borderColor: theme.components.radio.
|
|
3172
|
-
backgroundColor: theme.components.radio.
|
|
3193
|
+
borderColor: theme.components.radio.primary.pressed.border,
|
|
3194
|
+
backgroundColor: theme.components.radio.primary.pressed.bg
|
|
3173
3195
|
},
|
|
3174
3196
|
controlInvalid: {
|
|
3175
3197
|
borderColor: theme.components.radio.invalid.border
|
|
@@ -3179,18 +3201,18 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3179
3201
|
backgroundColor: theme.components.radio.disabled.bg
|
|
3180
3202
|
},
|
|
3181
3203
|
controlCheckedDisabled: {
|
|
3182
|
-
borderColor: theme.components.radio.
|
|
3183
|
-
backgroundColor: theme.components.radio.
|
|
3204
|
+
borderColor: theme.components.radio.selectedDisabled.border,
|
|
3205
|
+
backgroundColor: theme.components.radio.selectedDisabled.bg
|
|
3184
3206
|
},
|
|
3185
3207
|
indicator: {
|
|
3186
3208
|
borderRadius: theme.tokens.radius.full,
|
|
3187
|
-
backgroundColor: theme.components.radio.
|
|
3209
|
+
backgroundColor: theme.components.radio.primary.default.fg
|
|
3188
3210
|
},
|
|
3189
3211
|
indicatorPressed: {
|
|
3190
|
-
backgroundColor: theme.components.radio.
|
|
3212
|
+
backgroundColor: theme.components.radio.primary.pressed.fg
|
|
3191
3213
|
},
|
|
3192
3214
|
indicatorDisabled: {
|
|
3193
|
-
backgroundColor: theme.components.radio.
|
|
3215
|
+
backgroundColor: theme.components.radio.selectedDisabled.fg
|
|
3194
3216
|
},
|
|
3195
3217
|
content: {
|
|
3196
3218
|
flexShrink: 1,
|
|
@@ -3201,10 +3223,10 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3201
3223
|
fontFamily: theme.tokens.typography.family.regular
|
|
3202
3224
|
},
|
|
3203
3225
|
labelChecked: {
|
|
3204
|
-
color: theme.components.radio.
|
|
3226
|
+
color: theme.components.radio.primary.default.labelFg
|
|
3205
3227
|
},
|
|
3206
3228
|
labelCheckedPressed: {
|
|
3207
|
-
color: theme.components.radio.
|
|
3229
|
+
color: theme.components.radio.primary.pressed.labelFg
|
|
3208
3230
|
},
|
|
3209
3231
|
labelInvalid: {
|
|
3210
3232
|
color: theme.components.radio.invalid.fg
|
|
@@ -3223,7 +3245,7 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3223
3245
|
});
|
|
3224
3246
|
|
|
3225
3247
|
// src/primitives/Radio/Radio.tsx
|
|
3226
|
-
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3248
|
+
import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3227
3249
|
var controlSizeBySize = {
|
|
3228
3250
|
sm: 14,
|
|
3229
3251
|
md: 16,
|
|
@@ -3242,9 +3264,11 @@ var Radio = forwardRef4(
|
|
|
3242
3264
|
disabled: disabledProp = false,
|
|
3243
3265
|
required: requiredProp = false,
|
|
3244
3266
|
size: sizeProp,
|
|
3267
|
+
color: colorProp,
|
|
3245
3268
|
onCheckedChange,
|
|
3246
3269
|
label,
|
|
3247
3270
|
description,
|
|
3271
|
+
icon,
|
|
3248
3272
|
error,
|
|
3249
3273
|
accessibilityLabel,
|
|
3250
3274
|
accessibilityHint,
|
|
@@ -3269,6 +3293,8 @@ var Radio = forwardRef4(
|
|
|
3269
3293
|
const resolvedRequired = Boolean(group?.required) || requiredProp;
|
|
3270
3294
|
const resolvedInvalid = Boolean(group?.invalid) || Boolean(error);
|
|
3271
3295
|
const resolvedSize = sizeProp ?? group?.size ?? "md";
|
|
3296
|
+
const resolvedColor = colorProp ?? group?.color ?? "primary";
|
|
3297
|
+
const radioColor = theme.components.radio[resolvedColor];
|
|
3272
3298
|
const controlSize = controlSizeBySize[resolvedSize];
|
|
3273
3299
|
const indicatorSize = indicatorSizeBySize[resolvedSize];
|
|
3274
3300
|
const typographySizeByRadioSize = {
|
|
@@ -3323,7 +3349,7 @@ var Radio = forwardRef4(
|
|
|
3323
3349
|
typeof style === "function" ? style(state) : style
|
|
3324
3350
|
];
|
|
3325
3351
|
return /* @__PURE__ */ jsxs15(View22, { style: [styles.root, containerStyle], children: [
|
|
3326
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ jsx26(
|
|
3327
3353
|
Pressable13,
|
|
3328
3354
|
{
|
|
3329
3355
|
...rest,
|
|
@@ -3338,7 +3364,7 @@ var Radio = forwardRef4(
|
|
|
3338
3364
|
disabled: resolvedDisabled,
|
|
3339
3365
|
onPress: handlePress,
|
|
3340
3366
|
style: resolvePressableStyle,
|
|
3341
|
-
children: [
|
|
3367
|
+
children: (state) => /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
3342
3368
|
/* @__PURE__ */ jsx26(
|
|
3343
3369
|
View22,
|
|
3344
3370
|
{
|
|
@@ -3350,23 +3376,33 @@ var Radio = forwardRef4(
|
|
|
3350
3376
|
height: controlSize,
|
|
3351
3377
|
marginTop: controlMarginTop
|
|
3352
3378
|
},
|
|
3353
|
-
resolvedChecked &&
|
|
3379
|
+
resolvedChecked && {
|
|
3380
|
+
backgroundColor: radioColor.default.bg,
|
|
3381
|
+
borderColor: radioColor.default.border
|
|
3382
|
+
},
|
|
3383
|
+
resolvedChecked && state.pressed && !resolvedDisabled && {
|
|
3384
|
+
backgroundColor: radioColor.pressed.bg,
|
|
3385
|
+
borderColor: radioColor.pressed.border,
|
|
3386
|
+
transform: [{ scale: 0.96 }]
|
|
3387
|
+
},
|
|
3354
3388
|
resolvedInvalid && styles.controlInvalid,
|
|
3355
|
-
resolvedDisabled && styles.controlDisabled
|
|
3389
|
+
resolvedDisabled && styles.controlDisabled,
|
|
3390
|
+
resolvedChecked && resolvedDisabled && styles.controlCheckedDisabled
|
|
3356
3391
|
],
|
|
3357
|
-
children: resolvedChecked && /* @__PURE__ */ jsx26(
|
|
3392
|
+
children: resolvedChecked && (icon ?? /* @__PURE__ */ jsx26(
|
|
3358
3393
|
View22,
|
|
3359
3394
|
{
|
|
3360
3395
|
style: [
|
|
3361
3396
|
styles.indicator,
|
|
3362
3397
|
{
|
|
3363
3398
|
width: indicatorSize,
|
|
3364
|
-
height: indicatorSize
|
|
3399
|
+
height: indicatorSize,
|
|
3400
|
+
backgroundColor: state.pressed && !resolvedDisabled ? radioColor.pressed.fg : radioColor.default.fg
|
|
3365
3401
|
},
|
|
3366
3402
|
resolvedDisabled && styles.indicatorDisabled
|
|
3367
3403
|
]
|
|
3368
3404
|
}
|
|
3369
|
-
)
|
|
3405
|
+
))
|
|
3370
3406
|
}
|
|
3371
3407
|
),
|
|
3372
3408
|
(label || description) && /* @__PURE__ */ jsxs15(View22, { pointerEvents: "none", style: styles.content, children: [
|
|
@@ -3379,7 +3415,12 @@ var Radio = forwardRef4(
|
|
|
3379
3415
|
fontSize: typographySize.labelSize,
|
|
3380
3416
|
lineHeight: typographySize.labelLineHeight
|
|
3381
3417
|
},
|
|
3382
|
-
resolvedChecked &&
|
|
3418
|
+
resolvedChecked && {
|
|
3419
|
+
color: radioColor.default.labelFg
|
|
3420
|
+
},
|
|
3421
|
+
resolvedChecked && state.pressed && !resolvedDisabled && {
|
|
3422
|
+
color: radioColor.pressed.labelFg
|
|
3423
|
+
},
|
|
3383
3424
|
resolvedInvalid && styles.labelInvalid,
|
|
3384
3425
|
resolvedDisabled && styles.textDisabled,
|
|
3385
3426
|
labelStyle
|
|
@@ -3403,7 +3444,7 @@ var Radio = forwardRef4(
|
|
|
3403
3444
|
}
|
|
3404
3445
|
) : description)
|
|
3405
3446
|
] })
|
|
3406
|
-
]
|
|
3447
|
+
] })
|
|
3407
3448
|
}
|
|
3408
3449
|
),
|
|
3409
3450
|
error && /* @__PURE__ */ jsx26(
|