@xsolla/xui-multi-select 0.125.0 → 0.127.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 CHANGED
@@ -1070,11 +1070,16 @@ var StyledIcon3 = import_styled_components5.default.div`
1070
1070
  var Icon4 = ({ children, ...props }) => {
1071
1071
  return /* @__PURE__ */ (0, import_jsx_runtime395.jsx)(StyledIcon3, { ...props, children });
1072
1072
  };
1073
+ var SELECTABLE_BORDER_RADIUS = 8;
1073
1074
  var Tag = ({
1074
1075
  size = "md",
1075
1076
  tone = "primary",
1076
1077
  type = "solid",
1078
+ variant = "default",
1079
+ selected = false,
1080
+ onPress,
1077
1081
  children,
1082
+ icon,
1078
1083
  iconLeft,
1079
1084
  iconRight,
1080
1085
  onRemove
@@ -1082,6 +1087,20 @@ var Tag = ({
1082
1087
  const { theme } = (0, import_xui_core.useDesignSystem)();
1083
1088
  const sizeStyles = theme.sizing.tag(size);
1084
1089
  const resolveColors = () => {
1090
+ if (variant === "selectable") {
1091
+ if (selected) {
1092
+ return {
1093
+ bg: theme.colors.control.brand.secondary.bg,
1094
+ text: theme.colors.content.brand.primary,
1095
+ border: theme.colors.border.secondary
1096
+ };
1097
+ }
1098
+ return {
1099
+ bg: theme.colors.overlay.mono,
1100
+ text: theme.colors.content.primary,
1101
+ border: theme.colors.border.secondary
1102
+ };
1103
+ }
1085
1104
  if (type === "outlined") {
1086
1105
  switch (tone) {
1087
1106
  case "primary":
@@ -1186,28 +1205,36 @@ var Tag = ({
1186
1205
  }
1187
1206
  };
1188
1207
  const { bg, text, border } = resolveColors();
1208
+ const isSelectable = variant === "selectable";
1189
1209
  const isOutlined = type === "outlined";
1210
+ const hasBorder = isSelectable || isOutlined;
1211
+ const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
1212
+ const resolvedIconLeft = icon || iconLeft;
1190
1213
  return /* @__PURE__ */ (0, import_jsx_runtime396.jsxs)(
1191
1214
  Box2,
1192
1215
  {
1216
+ as: isSelectable ? "button" : void 0,
1217
+ onPress: isSelectable ? onPress : void 0,
1193
1218
  backgroundColor: bg,
1194
- borderRadius: sizeStyles.radius,
1219
+ borderRadius,
1195
1220
  height: sizeStyles.height,
1196
1221
  paddingHorizontal: sizeStyles.padding,
1197
1222
  flexDirection: "row",
1198
1223
  alignItems: "center",
1199
1224
  justifyContent: "center",
1200
1225
  gap: sizeStyles.gap,
1201
- borderWidth: isOutlined ? 1 : 0,
1226
+ borderWidth: hasBorder ? 1 : 0,
1202
1227
  borderColor: border,
1203
- borderStyle: isOutlined ? "solid" : void 0,
1228
+ borderStyle: hasBorder ? "solid" : void 0,
1229
+ cursor: isSelectable ? "pointer" : void 0,
1230
+ hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
1204
1231
  style: {
1205
1232
  overflow: "hidden",
1206
1233
  textOverflow: "ellipsis",
1207
1234
  whiteSpace: "nowrap"
1208
1235
  },
1209
1236
  children: [
1210
- iconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
1237
+ resolvedIconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
1211
1238
  children && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
1212
1239
  Text2,
1213
1240
  {