@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/web/index.mjs CHANGED
@@ -39,6 +39,8 @@ var StyledBox = styled.div`
39
39
  width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
40
40
  min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
41
41
  min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
42
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
43
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
42
44
 
43
45
  padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
44
46
  ${(props) => props.paddingHorizontal && `
@@ -226,11 +228,11 @@ var Icon = ({ children, ...props }) => {
226
228
  };
227
229
 
228
230
  // src/MultiSelect.tsx
229
- import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
231
+ import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
230
232
 
231
233
  // src/MultiSelectControl.tsx
232
234
  import { forwardRef as forwardRef3, useRef as useRef2 } from "react";
233
- import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
235
+ import { useResolvedTheme as useResolvedTheme3 } from "@xsolla/xui-core";
234
236
 
235
237
  // ../icons-base/dist/web/index.mjs
236
238
  import styled4 from "styled-components";
@@ -692,7 +694,7 @@ import styled22 from "styled-components";
692
694
  import { jsx as jsx2101 } from "react/jsx-runtime";
693
695
  import styled32 from "styled-components";
694
696
  import { jsx as jsx390 } from "react/jsx-runtime";
695
- import { useDesignSystem } from "@xsolla/xui-core";
697
+ import { useResolvedTheme } from "@xsolla/xui-core";
696
698
 
697
699
  // ../icons/dist/web/index.mjs
698
700
  import styled5 from "styled-components";
@@ -833,6 +835,8 @@ var StyledBox2 = styled6.div`
833
835
  width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
834
836
  min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
835
837
  min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
838
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
839
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
836
840
 
837
841
  padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
838
842
  ${(props) => props.paddingHorizontal && `
@@ -1019,12 +1023,13 @@ var Tag = ({
1019
1023
  selected = false,
1020
1024
  onPress,
1021
1025
  children,
1022
- icon,
1023
1026
  iconLeft,
1024
1027
  iconRight,
1025
- onRemove
1028
+ onRemove,
1029
+ themeMode,
1030
+ themeProductContext
1026
1031
  }) => {
1027
- const { theme } = useDesignSystem();
1032
+ const { theme } = useResolvedTheme({ themeMode, themeProductContext });
1028
1033
  const sizeStyles = theme.sizing.tag(size);
1029
1034
  const resolveColors = () => {
1030
1035
  if (variant === "selectable") {
@@ -1041,115 +1046,62 @@ var Tag = ({
1041
1046
  border: theme.colors.border.secondary
1042
1047
  };
1043
1048
  }
1044
- if (type === "outlined") {
1045
- switch (tone) {
1046
- case "primary":
1047
- return {
1048
- bg: theme.colors.background.primary,
1049
- text: theme.colors.content.primary,
1050
- border: theme.colors.border.secondary
1051
- };
1052
- case "brand":
1053
- return {
1054
- bg: theme.colors.background.brand.secondary,
1055
- text: theme.colors.content.brand.primary,
1056
- border: theme.colors.border.brand
1057
- };
1058
- case "brandExtra":
1059
- return {
1060
- bg: theme.colors.background.brandExtra.secondary,
1061
- text: theme.colors.content.brandExtra.primary,
1062
- border: theme.colors.border.brandExtra
1063
- };
1064
- case "success":
1065
- return {
1066
- bg: theme.colors.background.success.secondary,
1067
- text: theme.colors.content.success.primary,
1068
- border: theme.colors.border.success
1069
- };
1070
- case "warning":
1071
- return {
1072
- bg: theme.colors.background.warning.secondary,
1073
- text: theme.colors.content.warning.primary,
1074
- border: theme.colors.border.warning
1075
- };
1076
- case "alert":
1077
- return {
1078
- bg: theme.colors.background.alert.secondary,
1079
- text: theme.colors.content.alert.primary,
1080
- border: theme.colors.border.alert
1081
- };
1082
- case "neutral":
1083
- return {
1084
- bg: theme.colors.background.neutral.secondary,
1085
- text: theme.colors.content.neutral.primary,
1086
- border: theme.colors.border.neutral
1087
- };
1088
- default:
1089
- return {
1090
- bg: theme.colors.background.primary,
1091
- text: theme.colors.content.primary,
1092
- border: theme.colors.border.secondary
1093
- };
1094
- }
1095
- }
1049
+ const isOutlined = type === "outlined";
1096
1050
  switch (tone) {
1097
1051
  case "primary":
1098
1052
  return {
1099
- bg: theme.colors.background.primary,
1053
+ bg: isOutlined ? "transparent" : theme.colors.background.primary,
1100
1054
  text: theme.colors.content.primary,
1101
- border: void 0
1055
+ border: theme.colors.border.secondary
1102
1056
  };
1103
1057
  case "brand":
1104
1058
  return {
1105
- bg: theme.colors.background.brand.primary,
1106
- text: theme.colors.content.on.brand,
1107
- border: void 0
1059
+ bg: isOutlined ? "transparent" : theme.colors.background.brand.primary,
1060
+ text: isOutlined ? theme.colors.content.brand.primary : theme.colors.content.on.brand,
1061
+ border: theme.colors.border.brand
1108
1062
  };
1109
1063
  case "brandExtra":
1110
1064
  return {
1111
- bg: theme.colors.background.brandExtra.primary,
1112
- text: theme.colors.content.on.brandExtra,
1113
- border: void 0
1065
+ bg: isOutlined ? "transparent" : theme.colors.background.brandExtra.primary,
1066
+ text: isOutlined ? theme.colors.content.brandExtra.primary : theme.colors.content.on.brandExtra,
1067
+ border: theme.colors.border.brandExtra
1114
1068
  };
1115
1069
  case "success":
1116
1070
  return {
1117
- bg: theme.colors.background.success.primary,
1118
- text: theme.colors.content.on.success,
1119
- border: void 0
1071
+ bg: isOutlined ? "transparent" : theme.colors.background.success.primary,
1072
+ text: isOutlined ? theme.colors.content.success.primary : theme.colors.content.on.success,
1073
+ border: theme.colors.border.success
1120
1074
  };
1121
1075
  case "warning":
1122
1076
  return {
1123
- bg: theme.colors.background.warning.primary,
1124
- text: theme.colors.content.on.warning,
1125
- border: void 0
1077
+ bg: isOutlined ? "transparent" : theme.colors.background.warning.primary,
1078
+ text: isOutlined ? theme.colors.content.warning.primary : theme.colors.content.on.warning,
1079
+ border: theme.colors.border.warning
1126
1080
  };
1127
1081
  case "alert":
1128
1082
  return {
1129
- bg: theme.colors.background.alert.primary,
1130
- text: theme.colors.content.on.alert,
1131
- border: void 0
1083
+ bg: isOutlined ? "transparent" : theme.colors.background.alert.primary,
1084
+ text: isOutlined ? theme.colors.content.alert.primary : theme.colors.content.on.alert,
1085
+ border: theme.colors.border.alert
1132
1086
  };
1133
1087
  case "neutral":
1134
1088
  return {
1135
- bg: theme.colors.background.neutral.primary,
1136
- text: theme.colors.content.on.neutral,
1137
- border: void 0
1089
+ bg: isOutlined ? "transparent" : theme.colors.background.neutral.primary,
1090
+ text: isOutlined ? theme.colors.content.neutral.primary : theme.colors.content.on.neutral,
1091
+ border: theme.colors.border.neutral
1138
1092
  };
1139
1093
  default:
1140
1094
  return {
1141
- bg: theme.colors.background.primary,
1095
+ bg: isOutlined ? "transparent" : theme.colors.background.primary,
1142
1096
  text: theme.colors.content.primary,
1143
- border: void 0
1097
+ border: theme.colors.border.secondary
1144
1098
  };
1145
1099
  }
1146
1100
  };
1147
1101
  const { bg, text, border } = resolveColors();
1148
1102
  const isSelectable = variant === "selectable";
1149
- const isOutlined = type === "outlined";
1150
- const hasBorder = isSelectable || isOutlined;
1151
1103
  const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
1152
- const resolvedIconLeft = icon || iconLeft;
1104
+ const isIconOnly = !children && (!!iconLeft || !!iconRight);
1153
1105
  return /* @__PURE__ */ jsxs(
1154
1106
  Box2,
1155
1107
  {
@@ -1158,15 +1110,16 @@ var Tag = ({
1158
1110
  backgroundColor: bg,
1159
1111
  borderRadius,
1160
1112
  height: sizeStyles.height,
1161
- paddingHorizontal: sizeStyles.padding,
1113
+ width: isIconOnly ? sizeStyles.height : void 0,
1114
+ paddingHorizontal: isIconOnly ? 0 : sizeStyles.padding,
1162
1115
  flexDirection: "row",
1163
1116
  alignItems: "center",
1164
1117
  justifyContent: "center",
1165
1118
  gap: sizeStyles.gap,
1166
- borderWidth: hasBorder ? 1 : 0,
1119
+ borderWidth: sizeStyles.borderWidth,
1167
1120
  borderColor: border,
1168
- borderStyle: hasBorder ? "solid" : void 0,
1169
- cursor: isSelectable ? "pointer" : void 0,
1121
+ borderStyle: "solid",
1122
+ cursor: isSelectable ? "pointer" : "default",
1170
1123
  hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
1171
1124
  style: {
1172
1125
  overflow: "hidden",
@@ -1174,7 +1127,7 @@ var Tag = ({
1174
1127
  whiteSpace: "nowrap"
1175
1128
  },
1176
1129
  children: [
1177
- resolvedIconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: resolvedIconLeft }),
1130
+ iconLeft && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
1178
1131
  children && /* @__PURE__ */ jsx410(
1179
1132
  Text2,
1180
1133
  {
@@ -1189,14 +1142,15 @@ var Tag = ({
1189
1142
  children
1190
1143
  }
1191
1144
  ),
1192
- 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 })
1145
+ iconRight && /* @__PURE__ */ jsx410(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight }),
1146
+ onRemove && /* @__PURE__ */ jsx410(Box2, { onPress: onRemove, children: /* @__PURE__ */ jsx410(X2, { size: sizeStyles.iconSize, color: text }) })
1193
1147
  ]
1194
1148
  }
1195
1149
  );
1196
1150
  };
1197
1151
 
1198
1152
  // src/useMultiSelectControl.tsx
1199
- import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
1153
+ import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
1200
1154
  import { jsx as jsx391, jsxs as jsxs2 } from "react/jsx-runtime";
1201
1155
  var COUNT_ITEM_VALUE = "count-item";
1202
1156
  var useMultiSelectControl = ({
@@ -1209,9 +1163,11 @@ var useMultiSelectControl = ({
1209
1163
  placeholder,
1210
1164
  removeTagsButtons,
1211
1165
  disabled,
1212
- containerRef
1166
+ containerRef,
1167
+ themeMode,
1168
+ themeProductContext
1213
1169
  }) => {
1214
- const { theme } = useDesignSystem2();
1170
+ const { theme } = useResolvedTheme2({ themeMode, themeProductContext });
1215
1171
  const displayStateRef = useRef(0 /* Placeholder */);
1216
1172
  const savedWidthsRef = useRef(null);
1217
1173
  const itemsRef = useRef(null);
@@ -1460,9 +1416,11 @@ var MultiSelectControl = forwardRef3(
1460
1416
  iconLeft,
1461
1417
  iconRight,
1462
1418
  disabled = false,
1463
- extraClear = false
1419
+ extraClear = false,
1420
+ themeMode,
1421
+ themeProductContext
1464
1422
  }, ref) => {
1465
- const { theme } = useDesignSystem3();
1423
+ const { theme } = useResolvedTheme3({ themeMode, themeProductContext });
1466
1424
  const sizeStyles = theme.sizing.input(size);
1467
1425
  const inputColors = theme.colors.control.input;
1468
1426
  const state = externalState || (disabled ? "disable" : "default");
@@ -1699,9 +1657,11 @@ var MultiSelect = forwardRef4(
1699
1657
  removeTagsButtons = true,
1700
1658
  iconLeft,
1701
1659
  iconRight,
1702
- maxHeight = 300
1660
+ maxHeight = 300,
1661
+ themeMode,
1662
+ themeProductContext
1703
1663
  }, ref) => {
1704
- const { theme } = useDesignSystem4();
1664
+ const { theme } = useResolvedTheme4({ themeMode, themeProductContext });
1705
1665
  const controlRef = useRef4(null);
1706
1666
  const menuRef = useRef4(null);
1707
1667
  const sizeStyles = theme.sizing.input(size);