@xsolla/xui-multi-select 0.128.0 → 0.130.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.mjs CHANGED
@@ -48,6 +48,10 @@ var Box = ({
48
48
  left,
49
49
  right,
50
50
  width,
51
+ minWidth,
52
+ minHeight,
53
+ maxWidth,
54
+ maxHeight,
51
55
  flex,
52
56
  overflow,
53
57
  zIndex,
@@ -79,6 +83,10 @@ var Box = ({
79
83
  zIndex,
80
84
  height,
81
85
  width,
86
+ minWidth,
87
+ minHeight,
88
+ maxWidth,
89
+ maxHeight,
82
90
  padding,
83
91
  paddingHorizontal,
84
92
  paddingVertical,
@@ -210,7 +218,7 @@ var Text = ({
210
218
  }
211
219
  const incomingStyle = StyleSheet.flatten(styleProp);
212
220
  const baseStyle = {
213
- color,
221
+ color: color ?? incomingStyle?.color,
214
222
  fontSize: typeof fontSize === "number" ? fontSize : void 0,
215
223
  fontWeight,
216
224
  fontFamily: resolvedFontFamily,
@@ -262,11 +270,11 @@ var Icon = ({ children, color, size }) => {
262
270
  };
263
271
 
264
272
  // src/MultiSelect.tsx
265
- import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
273
+ import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
266
274
 
267
275
  // src/MultiSelectControl.tsx
268
276
  import { forwardRef as forwardRef3, useRef as useRef2 } from "react";
269
- import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
277
+ import { useResolvedTheme as useResolvedTheme3 } from "@xsolla/xui-core";
270
278
 
271
279
  // ../icons-base/dist/web/index.mjs
272
280
  import styled from "styled-components";
@@ -728,7 +736,7 @@ import styled22 from "styled-components";
728
736
  import { jsx as jsx2101 } from "react/jsx-runtime";
729
737
  import styled32 from "styled-components";
730
738
  import { jsx as jsx390 } from "react/jsx-runtime";
731
- import { useDesignSystem } from "@xsolla/xui-core";
739
+ import { useResolvedTheme } from "@xsolla/xui-core";
732
740
 
733
741
  // ../icons/dist/web/index.mjs
734
742
  import styled2 from "styled-components";
@@ -869,6 +877,8 @@ var StyledBox = styled3.div`
869
877
  width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
870
878
  min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
871
879
  min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
880
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
881
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
872
882
 
873
883
  padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
874
884
  ${(props) => props.paddingHorizontal && `
@@ -1055,12 +1065,13 @@ var Tag = ({
1055
1065
  selected = false,
1056
1066
  onPress,
1057
1067
  children,
1058
- icon,
1059
1068
  iconLeft,
1060
1069
  iconRight,
1061
- onRemove
1070
+ onRemove,
1071
+ themeMode,
1072
+ themeProductContext
1062
1073
  }) => {
1063
- const { theme } = useDesignSystem();
1074
+ const { theme } = useResolvedTheme({ themeMode, themeProductContext });
1064
1075
  const sizeStyles = theme.sizing.tag(size);
1065
1076
  const resolveColors = () => {
1066
1077
  if (variant === "selectable") {
@@ -1077,115 +1088,62 @@ var Tag = ({
1077
1088
  border: theme.colors.border.secondary
1078
1089
  };
1079
1090
  }
1080
- if (type === "outlined") {
1081
- switch (tone) {
1082
- case "primary":
1083
- return {
1084
- bg: theme.colors.background.primary,
1085
- text: theme.colors.content.primary,
1086
- border: theme.colors.border.secondary
1087
- };
1088
- case "brand":
1089
- return {
1090
- bg: theme.colors.background.brand.secondary,
1091
- text: theme.colors.content.brand.primary,
1092
- border: theme.colors.border.brand
1093
- };
1094
- case "brandExtra":
1095
- return {
1096
- bg: theme.colors.background.brandExtra.secondary,
1097
- text: theme.colors.content.brandExtra.primary,
1098
- border: theme.colors.border.brandExtra
1099
- };
1100
- case "success":
1101
- return {
1102
- bg: theme.colors.background.success.secondary,
1103
- text: theme.colors.content.success.primary,
1104
- border: theme.colors.border.success
1105
- };
1106
- case "warning":
1107
- return {
1108
- bg: theme.colors.background.warning.secondary,
1109
- text: theme.colors.content.warning.primary,
1110
- border: theme.colors.border.warning
1111
- };
1112
- case "alert":
1113
- return {
1114
- bg: theme.colors.background.alert.secondary,
1115
- text: theme.colors.content.alert.primary,
1116
- border: theme.colors.border.alert
1117
- };
1118
- case "neutral":
1119
- return {
1120
- bg: theme.colors.background.neutral.secondary,
1121
- text: theme.colors.content.neutral.primary,
1122
- border: theme.colors.border.neutral
1123
- };
1124
- default:
1125
- return {
1126
- bg: theme.colors.background.primary,
1127
- text: theme.colors.content.primary,
1128
- border: theme.colors.border.secondary
1129
- };
1130
- }
1131
- }
1091
+ const isOutlined = type === "outlined";
1132
1092
  switch (tone) {
1133
1093
  case "primary":
1134
1094
  return {
1135
- bg: theme.colors.background.primary,
1095
+ bg: isOutlined ? "transparent" : theme.colors.background.primary,
1136
1096
  text: theme.colors.content.primary,
1137
- border: void 0
1097
+ border: theme.colors.border.secondary
1138
1098
  };
1139
1099
  case "brand":
1140
1100
  return {
1141
- bg: theme.colors.background.brand.primary,
1142
- text: theme.colors.content.on.brand,
1143
- border: void 0
1101
+ bg: isOutlined ? "transparent" : theme.colors.background.brand.primary,
1102
+ text: isOutlined ? theme.colors.content.brand.primary : theme.colors.content.on.brand,
1103
+ border: theme.colors.border.brand
1144
1104
  };
1145
1105
  case "brandExtra":
1146
1106
  return {
1147
- bg: theme.colors.background.brandExtra.primary,
1148
- text: theme.colors.content.on.brandExtra,
1149
- border: void 0
1107
+ bg: isOutlined ? "transparent" : theme.colors.background.brandExtra.primary,
1108
+ text: isOutlined ? theme.colors.content.brandExtra.primary : theme.colors.content.on.brandExtra,
1109
+ border: theme.colors.border.brandExtra
1150
1110
  };
1151
1111
  case "success":
1152
1112
  return {
1153
- bg: theme.colors.background.success.primary,
1154
- text: theme.colors.content.on.success,
1155
- border: void 0
1113
+ bg: isOutlined ? "transparent" : theme.colors.background.success.primary,
1114
+ text: isOutlined ? theme.colors.content.success.primary : theme.colors.content.on.success,
1115
+ border: theme.colors.border.success
1156
1116
  };
1157
1117
  case "warning":
1158
1118
  return {
1159
- bg: theme.colors.background.warning.primary,
1160
- text: theme.colors.content.on.warning,
1161
- border: void 0
1119
+ bg: isOutlined ? "transparent" : theme.colors.background.warning.primary,
1120
+ text: isOutlined ? theme.colors.content.warning.primary : theme.colors.content.on.warning,
1121
+ border: theme.colors.border.warning
1162
1122
  };
1163
1123
  case "alert":
1164
1124
  return {
1165
- bg: theme.colors.background.alert.primary,
1166
- text: theme.colors.content.on.alert,
1167
- border: void 0
1125
+ bg: isOutlined ? "transparent" : theme.colors.background.alert.primary,
1126
+ text: isOutlined ? theme.colors.content.alert.primary : theme.colors.content.on.alert,
1127
+ border: theme.colors.border.alert
1168
1128
  };
1169
1129
  case "neutral":
1170
1130
  return {
1171
- bg: theme.colors.background.neutral.primary,
1172
- text: theme.colors.content.on.neutral,
1173
- border: void 0
1131
+ bg: isOutlined ? "transparent" : theme.colors.background.neutral.primary,
1132
+ text: isOutlined ? theme.colors.content.neutral.primary : theme.colors.content.on.neutral,
1133
+ border: theme.colors.border.neutral
1174
1134
  };
1175
1135
  default:
1176
1136
  return {
1177
- bg: theme.colors.background.primary,
1137
+ bg: isOutlined ? "transparent" : theme.colors.background.primary,
1178
1138
  text: theme.colors.content.primary,
1179
- border: void 0
1139
+ border: theme.colors.border.secondary
1180
1140
  };
1181
1141
  }
1182
1142
  };
1183
1143
  const { bg, text, border } = resolveColors();
1184
1144
  const isSelectable = variant === "selectable";
1185
- const isOutlined = type === "outlined";
1186
- const hasBorder = isSelectable || isOutlined;
1187
1145
  const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
1188
- const resolvedIconLeft = icon || iconLeft;
1146
+ const isIconOnly = !children && (!!iconLeft || !!iconRight);
1189
1147
  return /* @__PURE__ */ jsxs(
1190
1148
  Box2,
1191
1149
  {
@@ -1194,15 +1152,16 @@ var Tag = ({
1194
1152
  backgroundColor: bg,
1195
1153
  borderRadius,
1196
1154
  height: sizeStyles.height,
1197
- paddingHorizontal: sizeStyles.padding,
1155
+ width: isIconOnly ? sizeStyles.height : void 0,
1156
+ paddingHorizontal: isIconOnly ? 0 : sizeStyles.padding,
1198
1157
  flexDirection: "row",
1199
1158
  alignItems: "center",
1200
1159
  justifyContent: "center",
1201
1160
  gap: sizeStyles.gap,
1202
- borderWidth: hasBorder ? 1 : 0,
1161
+ borderWidth: sizeStyles.borderWidth,
1203
1162
  borderColor: border,
1204
- borderStyle: hasBorder ? "solid" : void 0,
1205
- cursor: isSelectable ? "pointer" : void 0,
1163
+ borderStyle: "solid",
1164
+ cursor: isSelectable ? "pointer" : "default",
1206
1165
  hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
1207
1166
  style: {
1208
1167
  overflow: "hidden",
@@ -1210,7 +1169,7 @@ var Tag = ({
1210
1169
  whiteSpace: "nowrap"
1211
1170
  },
1212
1171
  children: [
1213
- resolvedIconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
1172
+ iconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
1214
1173
  children && /* @__PURE__ */ jsx410(
1215
1174
  Text2,
1216
1175
  {
@@ -1225,14 +1184,15 @@ var Tag = ({
1225
1184
  children
1226
1185
  }
1227
1186
  ),
1228
- onRemove ? /* @__PURE__ */ jsx410(Box2, { onPress: onRemove, children: /* @__PURE__ */ jsx410(X2, { size: sizeStyles.iconSize, color: text }) }) : iconRight && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight })
1187
+ iconRight && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight }),
1188
+ onRemove && /* @__PURE__ */ jsx410(Box2, { onPress: onRemove, children: /* @__PURE__ */ jsx410(X2, { size: sizeStyles.iconSize, color: text }) })
1229
1189
  ]
1230
1190
  }
1231
1191
  );
1232
1192
  };
1233
1193
 
1234
1194
  // src/useMultiSelectControl.tsx
1235
- import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
1195
+ import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
1236
1196
  import { jsx as jsx391, jsxs as jsxs2 } from "react/jsx-runtime";
1237
1197
  var COUNT_ITEM_VALUE = "count-item";
1238
1198
  var useMultiSelectControl = ({
@@ -1245,9 +1205,11 @@ var useMultiSelectControl = ({
1245
1205
  placeholder,
1246
1206
  removeTagsButtons,
1247
1207
  disabled,
1248
- containerRef
1208
+ containerRef,
1209
+ themeMode,
1210
+ themeProductContext
1249
1211
  }) => {
1250
- const { theme } = useDesignSystem2();
1212
+ const { theme } = useResolvedTheme2({ themeMode, themeProductContext });
1251
1213
  const displayStateRef = useRef(0 /* Placeholder */);
1252
1214
  const savedWidthsRef = useRef(null);
1253
1215
  const itemsRef = useRef(null);
@@ -1496,9 +1458,11 @@ var MultiSelectControl = forwardRef3(
1496
1458
  iconLeft,
1497
1459
  iconRight,
1498
1460
  disabled = false,
1499
- extraClear = false
1461
+ extraClear = false,
1462
+ themeMode,
1463
+ themeProductContext
1500
1464
  }, ref) => {
1501
- const { theme } = useDesignSystem3();
1465
+ const { theme } = useResolvedTheme3({ themeMode, themeProductContext });
1502
1466
  const sizeStyles = theme.sizing.input(size);
1503
1467
  const inputColors = theme.colors.control.input;
1504
1468
  const state = externalState || (disabled ? "disable" : "default");
@@ -1735,9 +1699,11 @@ var MultiSelect = forwardRef4(
1735
1699
  removeTagsButtons = true,
1736
1700
  iconLeft,
1737
1701
  iconRight,
1738
- maxHeight = 300
1702
+ maxHeight = 300,
1703
+ themeMode,
1704
+ themeProductContext
1739
1705
  }, ref) => {
1740
- const { theme } = useDesignSystem4();
1706
+ const { theme } = useResolvedTheme4({ themeMode, themeProductContext });
1741
1707
  const controlRef = useRef4(null);
1742
1708
  const menuRef = useRef4(null);
1743
1709
  const sizeStyles = theme.sizing.input(size);