@vellira-ui/react-native 2.28.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 +42 -21
- 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(
|
|
@@ -3184,12 +3186,12 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3184
3186
|
backgroundColor: theme.components.radio.default.bg
|
|
3185
3187
|
},
|
|
3186
3188
|
controlChecked: {
|
|
3187
|
-
borderColor: theme.components.radio.
|
|
3188
|
-
backgroundColor: theme.components.radio.
|
|
3189
|
+
borderColor: theme.components.radio.primary.default.border,
|
|
3190
|
+
backgroundColor: theme.components.radio.primary.default.bg
|
|
3189
3191
|
},
|
|
3190
3192
|
controlCheckedPressed: {
|
|
3191
|
-
borderColor: theme.components.radio.
|
|
3192
|
-
backgroundColor: theme.components.radio.
|
|
3193
|
+
borderColor: theme.components.radio.primary.pressed.border,
|
|
3194
|
+
backgroundColor: theme.components.radio.primary.pressed.bg
|
|
3193
3195
|
},
|
|
3194
3196
|
controlInvalid: {
|
|
3195
3197
|
borderColor: theme.components.radio.invalid.border
|
|
@@ -3199,18 +3201,18 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3199
3201
|
backgroundColor: theme.components.radio.disabled.bg
|
|
3200
3202
|
},
|
|
3201
3203
|
controlCheckedDisabled: {
|
|
3202
|
-
borderColor: theme.components.radio.
|
|
3203
|
-
backgroundColor: theme.components.radio.
|
|
3204
|
+
borderColor: theme.components.radio.selectedDisabled.border,
|
|
3205
|
+
backgroundColor: theme.components.radio.selectedDisabled.bg
|
|
3204
3206
|
},
|
|
3205
3207
|
indicator: {
|
|
3206
3208
|
borderRadius: theme.tokens.radius.full,
|
|
3207
|
-
backgroundColor: theme.components.radio.
|
|
3209
|
+
backgroundColor: theme.components.radio.primary.default.fg
|
|
3208
3210
|
},
|
|
3209
3211
|
indicatorPressed: {
|
|
3210
|
-
backgroundColor: theme.components.radio.
|
|
3212
|
+
backgroundColor: theme.components.radio.primary.pressed.fg
|
|
3211
3213
|
},
|
|
3212
3214
|
indicatorDisabled: {
|
|
3213
|
-
backgroundColor: theme.components.radio.
|
|
3215
|
+
backgroundColor: theme.components.radio.selectedDisabled.fg
|
|
3214
3216
|
},
|
|
3215
3217
|
content: {
|
|
3216
3218
|
flexShrink: 1,
|
|
@@ -3221,10 +3223,10 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3221
3223
|
fontFamily: theme.tokens.typography.family.regular
|
|
3222
3224
|
},
|
|
3223
3225
|
labelChecked: {
|
|
3224
|
-
color: theme.components.radio.
|
|
3226
|
+
color: theme.components.radio.primary.default.labelFg
|
|
3225
3227
|
},
|
|
3226
3228
|
labelCheckedPressed: {
|
|
3227
|
-
color: theme.components.radio.
|
|
3229
|
+
color: theme.components.radio.primary.pressed.labelFg
|
|
3228
3230
|
},
|
|
3229
3231
|
labelInvalid: {
|
|
3230
3232
|
color: theme.components.radio.invalid.fg
|
|
@@ -3243,7 +3245,7 @@ var createStyles24 = (theme) => StyleSheet24.create({
|
|
|
3243
3245
|
});
|
|
3244
3246
|
|
|
3245
3247
|
// src/primitives/Radio/Radio.tsx
|
|
3246
|
-
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";
|
|
3247
3249
|
var controlSizeBySize = {
|
|
3248
3250
|
sm: 14,
|
|
3249
3251
|
md: 16,
|
|
@@ -3262,9 +3264,11 @@ var Radio = forwardRef4(
|
|
|
3262
3264
|
disabled: disabledProp = false,
|
|
3263
3265
|
required: requiredProp = false,
|
|
3264
3266
|
size: sizeProp,
|
|
3267
|
+
color: colorProp,
|
|
3265
3268
|
onCheckedChange,
|
|
3266
3269
|
label,
|
|
3267
3270
|
description,
|
|
3271
|
+
icon,
|
|
3268
3272
|
error,
|
|
3269
3273
|
accessibilityLabel,
|
|
3270
3274
|
accessibilityHint,
|
|
@@ -3289,6 +3293,8 @@ var Radio = forwardRef4(
|
|
|
3289
3293
|
const resolvedRequired = Boolean(group?.required) || requiredProp;
|
|
3290
3294
|
const resolvedInvalid = Boolean(group?.invalid) || Boolean(error);
|
|
3291
3295
|
const resolvedSize = sizeProp ?? group?.size ?? "md";
|
|
3296
|
+
const resolvedColor = colorProp ?? group?.color ?? "primary";
|
|
3297
|
+
const radioColor = theme.components.radio[resolvedColor];
|
|
3292
3298
|
const controlSize = controlSizeBySize[resolvedSize];
|
|
3293
3299
|
const indicatorSize = indicatorSizeBySize[resolvedSize];
|
|
3294
3300
|
const typographySizeByRadioSize = {
|
|
@@ -3343,7 +3349,7 @@ var Radio = forwardRef4(
|
|
|
3343
3349
|
typeof style === "function" ? style(state) : style
|
|
3344
3350
|
];
|
|
3345
3351
|
return /* @__PURE__ */ jsxs15(View22, { style: [styles.root, containerStyle], children: [
|
|
3346
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ jsx26(
|
|
3347
3353
|
Pressable13,
|
|
3348
3354
|
{
|
|
3349
3355
|
...rest,
|
|
@@ -3358,7 +3364,7 @@ var Radio = forwardRef4(
|
|
|
3358
3364
|
disabled: resolvedDisabled,
|
|
3359
3365
|
onPress: handlePress,
|
|
3360
3366
|
style: resolvePressableStyle,
|
|
3361
|
-
children: [
|
|
3367
|
+
children: (state) => /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
3362
3368
|
/* @__PURE__ */ jsx26(
|
|
3363
3369
|
View22,
|
|
3364
3370
|
{
|
|
@@ -3370,23 +3376,33 @@ var Radio = forwardRef4(
|
|
|
3370
3376
|
height: controlSize,
|
|
3371
3377
|
marginTop: controlMarginTop
|
|
3372
3378
|
},
|
|
3373
|
-
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
|
+
},
|
|
3374
3388
|
resolvedInvalid && styles.controlInvalid,
|
|
3375
|
-
resolvedDisabled && styles.controlDisabled
|
|
3389
|
+
resolvedDisabled && styles.controlDisabled,
|
|
3390
|
+
resolvedChecked && resolvedDisabled && styles.controlCheckedDisabled
|
|
3376
3391
|
],
|
|
3377
|
-
children: resolvedChecked && /* @__PURE__ */ jsx26(
|
|
3392
|
+
children: resolvedChecked && (icon ?? /* @__PURE__ */ jsx26(
|
|
3378
3393
|
View22,
|
|
3379
3394
|
{
|
|
3380
3395
|
style: [
|
|
3381
3396
|
styles.indicator,
|
|
3382
3397
|
{
|
|
3383
3398
|
width: indicatorSize,
|
|
3384
|
-
height: indicatorSize
|
|
3399
|
+
height: indicatorSize,
|
|
3400
|
+
backgroundColor: state.pressed && !resolvedDisabled ? radioColor.pressed.fg : radioColor.default.fg
|
|
3385
3401
|
},
|
|
3386
3402
|
resolvedDisabled && styles.indicatorDisabled
|
|
3387
3403
|
]
|
|
3388
3404
|
}
|
|
3389
|
-
)
|
|
3405
|
+
))
|
|
3390
3406
|
}
|
|
3391
3407
|
),
|
|
3392
3408
|
(label || description) && /* @__PURE__ */ jsxs15(View22, { pointerEvents: "none", style: styles.content, children: [
|
|
@@ -3399,7 +3415,12 @@ var Radio = forwardRef4(
|
|
|
3399
3415
|
fontSize: typographySize.labelSize,
|
|
3400
3416
|
lineHeight: typographySize.labelLineHeight
|
|
3401
3417
|
},
|
|
3402
|
-
resolvedChecked &&
|
|
3418
|
+
resolvedChecked && {
|
|
3419
|
+
color: radioColor.default.labelFg
|
|
3420
|
+
},
|
|
3421
|
+
resolvedChecked && state.pressed && !resolvedDisabled && {
|
|
3422
|
+
color: radioColor.pressed.labelFg
|
|
3423
|
+
},
|
|
3403
3424
|
resolvedInvalid && styles.labelInvalid,
|
|
3404
3425
|
resolvedDisabled && styles.textDisabled,
|
|
3405
3426
|
labelStyle
|
|
@@ -3423,7 +3444,7 @@ var Radio = forwardRef4(
|
|
|
3423
3444
|
}
|
|
3424
3445
|
) : description)
|
|
3425
3446
|
] })
|
|
3426
|
-
]
|
|
3447
|
+
] })
|
|
3427
3448
|
}
|
|
3428
3449
|
),
|
|
3429
3450
|
error && /* @__PURE__ */ jsx26(
|