@xsolla/xui-multi-select 0.124.0 → 0.126.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/native/index.js +31 -4
- package/native/index.js.map +1 -1
- package/native/index.mjs +31 -4
- package/native/index.mjs.map +1 -1
- package/package.json +5 -5
- package/web/index.js +31 -4
- package/web/index.js.map +1 -1
- package/web/index.mjs +31 -4
- package/web/index.mjs.map +1 -1
package/native/index.mjs
CHANGED
|
@@ -1046,11 +1046,16 @@ var StyledIcon3 = styled32.div`
|
|
|
1046
1046
|
var Icon4 = ({ children, ...props }) => {
|
|
1047
1047
|
return /* @__PURE__ */ jsx390(StyledIcon3, { ...props, children });
|
|
1048
1048
|
};
|
|
1049
|
+
var SELECTABLE_BORDER_RADIUS = 8;
|
|
1049
1050
|
var Tag = ({
|
|
1050
1051
|
size = "md",
|
|
1051
1052
|
tone = "primary",
|
|
1052
1053
|
type = "solid",
|
|
1054
|
+
variant = "default",
|
|
1055
|
+
selected = false,
|
|
1056
|
+
onPress,
|
|
1053
1057
|
children,
|
|
1058
|
+
icon,
|
|
1054
1059
|
iconLeft,
|
|
1055
1060
|
iconRight,
|
|
1056
1061
|
onRemove
|
|
@@ -1058,6 +1063,20 @@ var Tag = ({
|
|
|
1058
1063
|
const { theme } = useDesignSystem();
|
|
1059
1064
|
const sizeStyles = theme.sizing.tag(size);
|
|
1060
1065
|
const resolveColors = () => {
|
|
1066
|
+
if (variant === "selectable") {
|
|
1067
|
+
if (selected) {
|
|
1068
|
+
return {
|
|
1069
|
+
bg: theme.colors.control.brand.secondary.bg,
|
|
1070
|
+
text: theme.colors.content.brand.primary,
|
|
1071
|
+
border: theme.colors.border.secondary
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
return {
|
|
1075
|
+
bg: theme.colors.overlay.mono,
|
|
1076
|
+
text: theme.colors.content.primary,
|
|
1077
|
+
border: theme.colors.border.secondary
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1061
1080
|
if (type === "outlined") {
|
|
1062
1081
|
switch (tone) {
|
|
1063
1082
|
case "primary":
|
|
@@ -1162,28 +1181,36 @@ var Tag = ({
|
|
|
1162
1181
|
}
|
|
1163
1182
|
};
|
|
1164
1183
|
const { bg, text, border } = resolveColors();
|
|
1184
|
+
const isSelectable = variant === "selectable";
|
|
1165
1185
|
const isOutlined = type === "outlined";
|
|
1186
|
+
const hasBorder = isSelectable || isOutlined;
|
|
1187
|
+
const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
|
|
1188
|
+
const resolvedIconLeft = icon || iconLeft;
|
|
1166
1189
|
return /* @__PURE__ */ jsxs(
|
|
1167
1190
|
Box2,
|
|
1168
1191
|
{
|
|
1192
|
+
as: isSelectable ? "button" : void 0,
|
|
1193
|
+
onPress: isSelectable ? onPress : void 0,
|
|
1169
1194
|
backgroundColor: bg,
|
|
1170
|
-
borderRadius
|
|
1195
|
+
borderRadius,
|
|
1171
1196
|
height: sizeStyles.height,
|
|
1172
1197
|
paddingHorizontal: sizeStyles.padding,
|
|
1173
1198
|
flexDirection: "row",
|
|
1174
1199
|
alignItems: "center",
|
|
1175
1200
|
justifyContent: "center",
|
|
1176
1201
|
gap: sizeStyles.gap,
|
|
1177
|
-
borderWidth:
|
|
1202
|
+
borderWidth: hasBorder ? 1 : 0,
|
|
1178
1203
|
borderColor: border,
|
|
1179
|
-
borderStyle:
|
|
1204
|
+
borderStyle: hasBorder ? "solid" : void 0,
|
|
1205
|
+
cursor: isSelectable ? "pointer" : void 0,
|
|
1206
|
+
hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
|
|
1180
1207
|
style: {
|
|
1181
1208
|
overflow: "hidden",
|
|
1182
1209
|
textOverflow: "ellipsis",
|
|
1183
1210
|
whiteSpace: "nowrap"
|
|
1184
1211
|
},
|
|
1185
1212
|
children: [
|
|
1186
|
-
|
|
1213
|
+
resolvedIconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
|
|
1187
1214
|
children && /* @__PURE__ */ jsx410(
|
|
1188
1215
|
Text2,
|
|
1189
1216
|
{
|