@xsolla/xui-multi-select 0.118.0 → 0.119.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 +61 -36
- package/native/index.js.map +1 -1
- package/native/index.mjs +61 -36
- package/native/index.mjs.map +1 -1
- package/package.json +5 -5
- package/web/index.js +61 -36
- package/web/index.js.map +1 -1
- package/web/index.mjs +61 -36
- package/web/index.mjs.map +1 -1
package/native/index.js
CHANGED
|
@@ -1070,33 +1070,69 @@ 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;
|
|
1074
1073
|
var Tag = ({
|
|
1075
1074
|
size = "md",
|
|
1076
1075
|
tone = "primary",
|
|
1077
|
-
|
|
1078
|
-
selected = false,
|
|
1079
|
-
onPress,
|
|
1076
|
+
type = "solid",
|
|
1080
1077
|
children,
|
|
1081
|
-
|
|
1078
|
+
iconLeft,
|
|
1079
|
+
iconRight,
|
|
1082
1080
|
onRemove
|
|
1083
1081
|
}) => {
|
|
1084
1082
|
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
1085
1083
|
const sizeStyles = theme.sizing.tag(size);
|
|
1086
1084
|
const resolveColors = () => {
|
|
1087
|
-
if (
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1085
|
+
if (type === "outlined") {
|
|
1086
|
+
switch (tone) {
|
|
1087
|
+
case "primary":
|
|
1088
|
+
return {
|
|
1089
|
+
bg: theme.colors.background.primary,
|
|
1090
|
+
text: theme.colors.content.primary,
|
|
1091
|
+
border: theme.colors.border.secondary
|
|
1092
|
+
};
|
|
1093
|
+
case "brand":
|
|
1094
|
+
return {
|
|
1095
|
+
bg: theme.colors.background.brand.secondary,
|
|
1096
|
+
text: theme.colors.content.brand.primary,
|
|
1097
|
+
border: theme.colors.border.brand
|
|
1098
|
+
};
|
|
1099
|
+
case "brandExtra":
|
|
1100
|
+
return {
|
|
1101
|
+
bg: theme.colors.background.brandExtra.secondary,
|
|
1102
|
+
text: theme.colors.content.brandExtra.primary,
|
|
1103
|
+
border: theme.colors.border.brandExtra
|
|
1104
|
+
};
|
|
1105
|
+
case "success":
|
|
1106
|
+
return {
|
|
1107
|
+
bg: theme.colors.background.success.secondary,
|
|
1108
|
+
text: theme.colors.content.success.primary,
|
|
1109
|
+
border: theme.colors.border.success
|
|
1110
|
+
};
|
|
1111
|
+
case "warning":
|
|
1112
|
+
return {
|
|
1113
|
+
bg: theme.colors.background.warning.secondary,
|
|
1114
|
+
text: theme.colors.content.warning.primary,
|
|
1115
|
+
border: theme.colors.border.warning
|
|
1116
|
+
};
|
|
1117
|
+
case "alert":
|
|
1118
|
+
return {
|
|
1119
|
+
bg: theme.colors.background.alert.secondary,
|
|
1120
|
+
text: theme.colors.content.alert.primary,
|
|
1121
|
+
border: theme.colors.border.alert
|
|
1122
|
+
};
|
|
1123
|
+
case "neutral":
|
|
1124
|
+
return {
|
|
1125
|
+
bg: theme.colors.background.neutral.secondary,
|
|
1126
|
+
text: theme.colors.content.neutral.primary,
|
|
1127
|
+
border: theme.colors.border.neutral
|
|
1128
|
+
};
|
|
1129
|
+
default:
|
|
1130
|
+
return {
|
|
1131
|
+
bg: theme.colors.background.primary,
|
|
1132
|
+
text: theme.colors.content.primary,
|
|
1133
|
+
border: theme.colors.border.secondary
|
|
1134
|
+
};
|
|
1094
1135
|
}
|
|
1095
|
-
return {
|
|
1096
|
-
bg: theme.colors.overlay.mono,
|
|
1097
|
-
text: theme.colors.content.primary,
|
|
1098
|
-
border: theme.colors.border.secondary
|
|
1099
|
-
};
|
|
1100
1136
|
}
|
|
1101
1137
|
switch (tone) {
|
|
1102
1138
|
case "primary":
|
|
@@ -1105,12 +1141,6 @@ var Tag = ({
|
|
|
1105
1141
|
text: theme.colors.content.primary,
|
|
1106
1142
|
border: void 0
|
|
1107
1143
|
};
|
|
1108
|
-
case "secondary":
|
|
1109
|
-
return {
|
|
1110
|
-
bg: theme.colors.background.secondary,
|
|
1111
|
-
text: theme.colors.content.primary,
|
|
1112
|
-
border: void 0
|
|
1113
|
-
};
|
|
1114
1144
|
case "brand":
|
|
1115
1145
|
return {
|
|
1116
1146
|
bg: theme.colors.background.brand.primary,
|
|
@@ -1156,34 +1186,29 @@ var Tag = ({
|
|
|
1156
1186
|
}
|
|
1157
1187
|
};
|
|
1158
1188
|
const { bg, text, border } = resolveColors();
|
|
1159
|
-
const
|
|
1160
|
-
const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
|
|
1189
|
+
const isOutlined = type === "outlined";
|
|
1161
1190
|
return /* @__PURE__ */ (0, import_jsx_runtime396.jsxs)(
|
|
1162
1191
|
Box2,
|
|
1163
1192
|
{
|
|
1164
|
-
as: isSelectable ? "button" : void 0,
|
|
1165
|
-
onPress: isSelectable ? onPress : void 0,
|
|
1166
1193
|
backgroundColor: bg,
|
|
1167
|
-
borderRadius,
|
|
1194
|
+
borderRadius: sizeStyles.radius,
|
|
1168
1195
|
height: sizeStyles.height,
|
|
1169
1196
|
paddingHorizontal: sizeStyles.padding,
|
|
1170
1197
|
flexDirection: "row",
|
|
1171
1198
|
alignItems: "center",
|
|
1172
1199
|
justifyContent: "center",
|
|
1173
1200
|
gap: sizeStyles.gap,
|
|
1174
|
-
borderWidth:
|
|
1201
|
+
borderWidth: isOutlined ? 1 : 0,
|
|
1175
1202
|
borderColor: border,
|
|
1176
|
-
borderStyle:
|
|
1177
|
-
cursor: isSelectable ? "pointer" : void 0,
|
|
1178
|
-
hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
|
|
1203
|
+
borderStyle: isOutlined ? "solid" : void 0,
|
|
1179
1204
|
style: {
|
|
1180
1205
|
overflow: "hidden",
|
|
1181
1206
|
textOverflow: "ellipsis",
|
|
1182
1207
|
whiteSpace: "nowrap"
|
|
1183
1208
|
},
|
|
1184
1209
|
children: [
|
|
1185
|
-
|
|
1186
|
-
/* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
|
|
1210
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
|
|
1211
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
|
|
1187
1212
|
Text2,
|
|
1188
1213
|
{
|
|
1189
1214
|
color: text,
|
|
@@ -1197,7 +1222,7 @@ var Tag = ({
|
|
|
1197
1222
|
children
|
|
1198
1223
|
}
|
|
1199
1224
|
),
|
|
1200
|
-
onRemove
|
|
1225
|
+
onRemove ? /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Box2, { onPress: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(X2, { size: sizeStyles.iconSize, color: text }) }) : iconRight && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight })
|
|
1201
1226
|
]
|
|
1202
1227
|
}
|
|
1203
1228
|
);
|
|
@@ -1332,7 +1357,7 @@ var useMultiSelectControl = ({
|
|
|
1332
1357
|
Tag,
|
|
1333
1358
|
{
|
|
1334
1359
|
size,
|
|
1335
|
-
tone: "
|
|
1360
|
+
tone: "primary",
|
|
1336
1361
|
onRemove: removeTagsButtons && !isCount ? (e) => {
|
|
1337
1362
|
e?.stopPropagation();
|
|
1338
1363
|
if (!disabled) removeValue(item.value, e);
|