@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/web/index.mjs
CHANGED
|
@@ -1010,11 +1010,16 @@ var StyledIcon4 = styled32.div`
|
|
|
1010
1010
|
var Icon4 = ({ children, ...props }) => {
|
|
1011
1011
|
return /* @__PURE__ */ jsx390(StyledIcon4, { ...props, children });
|
|
1012
1012
|
};
|
|
1013
|
+
var SELECTABLE_BORDER_RADIUS = 8;
|
|
1013
1014
|
var Tag = ({
|
|
1014
1015
|
size = "md",
|
|
1015
1016
|
tone = "primary",
|
|
1016
1017
|
type = "solid",
|
|
1018
|
+
variant = "default",
|
|
1019
|
+
selected = false,
|
|
1020
|
+
onPress,
|
|
1017
1021
|
children,
|
|
1022
|
+
icon,
|
|
1018
1023
|
iconLeft,
|
|
1019
1024
|
iconRight,
|
|
1020
1025
|
onRemove
|
|
@@ -1022,6 +1027,20 @@ var Tag = ({
|
|
|
1022
1027
|
const { theme } = useDesignSystem();
|
|
1023
1028
|
const sizeStyles = theme.sizing.tag(size);
|
|
1024
1029
|
const resolveColors = () => {
|
|
1030
|
+
if (variant === "selectable") {
|
|
1031
|
+
if (selected) {
|
|
1032
|
+
return {
|
|
1033
|
+
bg: theme.colors.control.brand.secondary.bg,
|
|
1034
|
+
text: theme.colors.content.brand.primary,
|
|
1035
|
+
border: theme.colors.border.secondary
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
return {
|
|
1039
|
+
bg: theme.colors.overlay.mono,
|
|
1040
|
+
text: theme.colors.content.primary,
|
|
1041
|
+
border: theme.colors.border.secondary
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1025
1044
|
if (type === "outlined") {
|
|
1026
1045
|
switch (tone) {
|
|
1027
1046
|
case "primary":
|
|
@@ -1126,28 +1145,36 @@ var Tag = ({
|
|
|
1126
1145
|
}
|
|
1127
1146
|
};
|
|
1128
1147
|
const { bg, text, border } = resolveColors();
|
|
1148
|
+
const isSelectable = variant === "selectable";
|
|
1129
1149
|
const isOutlined = type === "outlined";
|
|
1150
|
+
const hasBorder = isSelectable || isOutlined;
|
|
1151
|
+
const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
|
|
1152
|
+
const resolvedIconLeft = icon || iconLeft;
|
|
1130
1153
|
return /* @__PURE__ */ jsxs(
|
|
1131
1154
|
Box2,
|
|
1132
1155
|
{
|
|
1156
|
+
as: isSelectable ? "button" : void 0,
|
|
1157
|
+
onPress: isSelectable ? onPress : void 0,
|
|
1133
1158
|
backgroundColor: bg,
|
|
1134
|
-
borderRadius
|
|
1159
|
+
borderRadius,
|
|
1135
1160
|
height: sizeStyles.height,
|
|
1136
1161
|
paddingHorizontal: sizeStyles.padding,
|
|
1137
1162
|
flexDirection: "row",
|
|
1138
1163
|
alignItems: "center",
|
|
1139
1164
|
justifyContent: "center",
|
|
1140
1165
|
gap: sizeStyles.gap,
|
|
1141
|
-
borderWidth:
|
|
1166
|
+
borderWidth: hasBorder ? 1 : 0,
|
|
1142
1167
|
borderColor: border,
|
|
1143
|
-
borderStyle:
|
|
1168
|
+
borderStyle: hasBorder ? "solid" : void 0,
|
|
1169
|
+
cursor: isSelectable ? "pointer" : void 0,
|
|
1170
|
+
hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
|
|
1144
1171
|
style: {
|
|
1145
1172
|
overflow: "hidden",
|
|
1146
1173
|
textOverflow: "ellipsis",
|
|
1147
1174
|
whiteSpace: "nowrap"
|
|
1148
1175
|
},
|
|
1149
1176
|
children: [
|
|
1150
|
-
|
|
1177
|
+
resolvedIconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
|
|
1151
1178
|
children && /* @__PURE__ */ jsx410(
|
|
1152
1179
|
Text2,
|
|
1153
1180
|
{
|