@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-multi-select",
3
- "version": "0.125.0",
3
+ "version": "0.127.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -10,10 +10,10 @@
10
10
  "build:native": "PLATFORM=native tsup"
11
11
  },
12
12
  "dependencies": {
13
- "@xsolla/xui-checkbox": "0.125.0",
14
- "@xsolla/xui-core": "0.125.0",
15
- "@xsolla/xui-dropdown": "0.125.0",
16
- "@xsolla/xui-primitives-core": "0.125.0"
13
+ "@xsolla/xui-checkbox": "0.127.0",
14
+ "@xsolla/xui-core": "0.127.0",
15
+ "@xsolla/xui-dropdown": "0.127.0",
16
+ "@xsolla/xui-primitives-core": "0.127.0"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",
package/web/index.js CHANGED
@@ -1041,11 +1041,16 @@ var StyledIcon4 = import_styled_components8.default.div`
1041
1041
  var Icon4 = ({ children, ...props }) => {
1042
1042
  return /* @__PURE__ */ (0, import_jsx_runtime395.jsx)(StyledIcon4, { ...props, children });
1043
1043
  };
1044
+ var SELECTABLE_BORDER_RADIUS = 8;
1044
1045
  var Tag = ({
1045
1046
  size = "md",
1046
1047
  tone = "primary",
1047
1048
  type = "solid",
1049
+ variant = "default",
1050
+ selected = false,
1051
+ onPress,
1048
1052
  children,
1053
+ icon,
1049
1054
  iconLeft,
1050
1055
  iconRight,
1051
1056
  onRemove
@@ -1053,6 +1058,20 @@ var Tag = ({
1053
1058
  const { theme } = (0, import_xui_core.useDesignSystem)();
1054
1059
  const sizeStyles = theme.sizing.tag(size);
1055
1060
  const resolveColors = () => {
1061
+ if (variant === "selectable") {
1062
+ if (selected) {
1063
+ return {
1064
+ bg: theme.colors.control.brand.secondary.bg,
1065
+ text: theme.colors.content.brand.primary,
1066
+ border: theme.colors.border.secondary
1067
+ };
1068
+ }
1069
+ return {
1070
+ bg: theme.colors.overlay.mono,
1071
+ text: theme.colors.content.primary,
1072
+ border: theme.colors.border.secondary
1073
+ };
1074
+ }
1056
1075
  if (type === "outlined") {
1057
1076
  switch (tone) {
1058
1077
  case "primary":
@@ -1157,28 +1176,36 @@ var Tag = ({
1157
1176
  }
1158
1177
  };
1159
1178
  const { bg, text, border } = resolveColors();
1179
+ const isSelectable = variant === "selectable";
1160
1180
  const isOutlined = type === "outlined";
1181
+ const hasBorder = isSelectable || isOutlined;
1182
+ const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
1183
+ const resolvedIconLeft = icon || iconLeft;
1161
1184
  return /* @__PURE__ */ (0, import_jsx_runtime396.jsxs)(
1162
1185
  Box2,
1163
1186
  {
1187
+ as: isSelectable ? "button" : void 0,
1188
+ onPress: isSelectable ? onPress : void 0,
1164
1189
  backgroundColor: bg,
1165
- borderRadius: sizeStyles.radius,
1190
+ borderRadius,
1166
1191
  height: sizeStyles.height,
1167
1192
  paddingHorizontal: sizeStyles.padding,
1168
1193
  flexDirection: "row",
1169
1194
  alignItems: "center",
1170
1195
  justifyContent: "center",
1171
1196
  gap: sizeStyles.gap,
1172
- borderWidth: isOutlined ? 1 : 0,
1197
+ borderWidth: hasBorder ? 1 : 0,
1173
1198
  borderColor: border,
1174
- borderStyle: isOutlined ? "solid" : void 0,
1199
+ borderStyle: hasBorder ? "solid" : void 0,
1200
+ cursor: isSelectable ? "pointer" : void 0,
1201
+ hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
1175
1202
  style: {
1176
1203
  overflow: "hidden",
1177
1204
  textOverflow: "ellipsis",
1178
1205
  whiteSpace: "nowrap"
1179
1206
  },
1180
1207
  children: [
1181
- iconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
1208
+ resolvedIconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
1182
1209
  children && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
1183
1210
  Text2,
1184
1211
  {