@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.d.mts +2 -1
- package/native/index.d.ts +2 -1
- package/native/index.js +59 -93
- package/native/index.js.map +1 -1
- package/native/index.mjs +63 -97
- package/native/index.mjs.map +1 -1
- package/package.json +5 -5
- package/web/index.d.mts +2 -1
- package/web/index.d.ts +2 -1
- package/web/index.js +52 -92
- package/web/index.js.map +1 -1
- package/web/index.mjs +56 -96
- package/web/index.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-multi-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.130.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.
|
|
14
|
-
"@xsolla/xui-core": "0.
|
|
15
|
-
"@xsolla/xui-dropdown": "0.
|
|
16
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-checkbox": "0.130.0",
|
|
14
|
+
"@xsolla/xui-core": "0.130.0",
|
|
15
|
+
"@xsolla/xui-dropdown": "0.130.0",
|
|
16
|
+
"@xsolla/xui-primitives-core": "0.130.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=16.8.0",
|
package/web/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeOverrideProps } from '@xsolla/xui-core';
|
|
3
4
|
|
|
4
5
|
type MultiSelectValue = (string | number)[];
|
|
5
6
|
type MultiSelectVariant = "tag" | "text";
|
|
@@ -10,7 +11,7 @@ interface MultiSelectOption {
|
|
|
10
11
|
value: string | number;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
}
|
|
13
|
-
interface MultiSelectProps {
|
|
14
|
+
interface MultiSelectProps extends ThemeOverrideProps {
|
|
14
15
|
/**
|
|
15
16
|
* Property to define options for the multi-select.
|
|
16
17
|
*/
|
package/web/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeOverrideProps } from '@xsolla/xui-core';
|
|
3
4
|
|
|
4
5
|
type MultiSelectValue = (string | number)[];
|
|
5
6
|
type MultiSelectVariant = "tag" | "text";
|
|
@@ -10,7 +11,7 @@ interface MultiSelectOption {
|
|
|
10
11
|
value: string | number;
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
}
|
|
13
|
-
interface MultiSelectProps {
|
|
14
|
+
interface MultiSelectProps extends ThemeOverrideProps {
|
|
14
15
|
/**
|
|
15
16
|
* Property to define options for the multi-select.
|
|
16
17
|
*/
|
package/web/index.js
CHANGED
|
@@ -75,6 +75,8 @@ var StyledBox = import_styled_components.default.div`
|
|
|
75
75
|
width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
|
|
76
76
|
min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
|
|
77
77
|
min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
|
|
78
|
+
max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
|
|
79
|
+
max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
|
|
78
80
|
|
|
79
81
|
padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
|
|
80
82
|
${(props) => props.paddingHorizontal && `
|
|
@@ -864,6 +866,8 @@ var StyledBox2 = import_styled_components6.default.div`
|
|
|
864
866
|
width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
|
|
865
867
|
min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
|
|
866
868
|
min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
|
|
869
|
+
max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
|
|
870
|
+
max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
|
|
867
871
|
|
|
868
872
|
padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
|
|
869
873
|
${(props) => props.paddingHorizontal && `
|
|
@@ -1050,12 +1054,13 @@ var Tag = ({
|
|
|
1050
1054
|
selected = false,
|
|
1051
1055
|
onPress,
|
|
1052
1056
|
children,
|
|
1053
|
-
icon,
|
|
1054
1057
|
iconLeft,
|
|
1055
1058
|
iconRight,
|
|
1056
|
-
onRemove
|
|
1059
|
+
onRemove,
|
|
1060
|
+
themeMode,
|
|
1061
|
+
themeProductContext
|
|
1057
1062
|
}) => {
|
|
1058
|
-
const { theme } = (0, import_xui_core.
|
|
1063
|
+
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1059
1064
|
const sizeStyles = theme.sizing.tag(size);
|
|
1060
1065
|
const resolveColors = () => {
|
|
1061
1066
|
if (variant === "selectable") {
|
|
@@ -1072,115 +1077,62 @@ var Tag = ({
|
|
|
1072
1077
|
border: theme.colors.border.secondary
|
|
1073
1078
|
};
|
|
1074
1079
|
}
|
|
1075
|
-
|
|
1076
|
-
switch (tone) {
|
|
1077
|
-
case "primary":
|
|
1078
|
-
return {
|
|
1079
|
-
bg: theme.colors.background.primary,
|
|
1080
|
-
text: theme.colors.content.primary,
|
|
1081
|
-
border: theme.colors.border.secondary
|
|
1082
|
-
};
|
|
1083
|
-
case "brand":
|
|
1084
|
-
return {
|
|
1085
|
-
bg: theme.colors.background.brand.secondary,
|
|
1086
|
-
text: theme.colors.content.brand.primary,
|
|
1087
|
-
border: theme.colors.border.brand
|
|
1088
|
-
};
|
|
1089
|
-
case "brandExtra":
|
|
1090
|
-
return {
|
|
1091
|
-
bg: theme.colors.background.brandExtra.secondary,
|
|
1092
|
-
text: theme.colors.content.brandExtra.primary,
|
|
1093
|
-
border: theme.colors.border.brandExtra
|
|
1094
|
-
};
|
|
1095
|
-
case "success":
|
|
1096
|
-
return {
|
|
1097
|
-
bg: theme.colors.background.success.secondary,
|
|
1098
|
-
text: theme.colors.content.success.primary,
|
|
1099
|
-
border: theme.colors.border.success
|
|
1100
|
-
};
|
|
1101
|
-
case "warning":
|
|
1102
|
-
return {
|
|
1103
|
-
bg: theme.colors.background.warning.secondary,
|
|
1104
|
-
text: theme.colors.content.warning.primary,
|
|
1105
|
-
border: theme.colors.border.warning
|
|
1106
|
-
};
|
|
1107
|
-
case "alert":
|
|
1108
|
-
return {
|
|
1109
|
-
bg: theme.colors.background.alert.secondary,
|
|
1110
|
-
text: theme.colors.content.alert.primary,
|
|
1111
|
-
border: theme.colors.border.alert
|
|
1112
|
-
};
|
|
1113
|
-
case "neutral":
|
|
1114
|
-
return {
|
|
1115
|
-
bg: theme.colors.background.neutral.secondary,
|
|
1116
|
-
text: theme.colors.content.neutral.primary,
|
|
1117
|
-
border: theme.colors.border.neutral
|
|
1118
|
-
};
|
|
1119
|
-
default:
|
|
1120
|
-
return {
|
|
1121
|
-
bg: theme.colors.background.primary,
|
|
1122
|
-
text: theme.colors.content.primary,
|
|
1123
|
-
border: theme.colors.border.secondary
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1080
|
+
const isOutlined = type === "outlined";
|
|
1127
1081
|
switch (tone) {
|
|
1128
1082
|
case "primary":
|
|
1129
1083
|
return {
|
|
1130
|
-
bg: theme.colors.background.primary,
|
|
1084
|
+
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
1131
1085
|
text: theme.colors.content.primary,
|
|
1132
|
-
border:
|
|
1086
|
+
border: theme.colors.border.secondary
|
|
1133
1087
|
};
|
|
1134
1088
|
case "brand":
|
|
1135
1089
|
return {
|
|
1136
|
-
bg: theme.colors.background.brand.primary,
|
|
1137
|
-
text: theme.colors.content.on.brand,
|
|
1138
|
-
border:
|
|
1090
|
+
bg: isOutlined ? "transparent" : theme.colors.background.brand.primary,
|
|
1091
|
+
text: isOutlined ? theme.colors.content.brand.primary : theme.colors.content.on.brand,
|
|
1092
|
+
border: theme.colors.border.brand
|
|
1139
1093
|
};
|
|
1140
1094
|
case "brandExtra":
|
|
1141
1095
|
return {
|
|
1142
|
-
bg: theme.colors.background.brandExtra.primary,
|
|
1143
|
-
text: theme.colors.content.on.brandExtra,
|
|
1144
|
-
border:
|
|
1096
|
+
bg: isOutlined ? "transparent" : theme.colors.background.brandExtra.primary,
|
|
1097
|
+
text: isOutlined ? theme.colors.content.brandExtra.primary : theme.colors.content.on.brandExtra,
|
|
1098
|
+
border: theme.colors.border.brandExtra
|
|
1145
1099
|
};
|
|
1146
1100
|
case "success":
|
|
1147
1101
|
return {
|
|
1148
|
-
bg: theme.colors.background.success.primary,
|
|
1149
|
-
text: theme.colors.content.on.success,
|
|
1150
|
-
border:
|
|
1102
|
+
bg: isOutlined ? "transparent" : theme.colors.background.success.primary,
|
|
1103
|
+
text: isOutlined ? theme.colors.content.success.primary : theme.colors.content.on.success,
|
|
1104
|
+
border: theme.colors.border.success
|
|
1151
1105
|
};
|
|
1152
1106
|
case "warning":
|
|
1153
1107
|
return {
|
|
1154
|
-
bg: theme.colors.background.warning.primary,
|
|
1155
|
-
text: theme.colors.content.on.warning,
|
|
1156
|
-
border:
|
|
1108
|
+
bg: isOutlined ? "transparent" : theme.colors.background.warning.primary,
|
|
1109
|
+
text: isOutlined ? theme.colors.content.warning.primary : theme.colors.content.on.warning,
|
|
1110
|
+
border: theme.colors.border.warning
|
|
1157
1111
|
};
|
|
1158
1112
|
case "alert":
|
|
1159
1113
|
return {
|
|
1160
|
-
bg: theme.colors.background.alert.primary,
|
|
1161
|
-
text: theme.colors.content.on.alert,
|
|
1162
|
-
border:
|
|
1114
|
+
bg: isOutlined ? "transparent" : theme.colors.background.alert.primary,
|
|
1115
|
+
text: isOutlined ? theme.colors.content.alert.primary : theme.colors.content.on.alert,
|
|
1116
|
+
border: theme.colors.border.alert
|
|
1163
1117
|
};
|
|
1164
1118
|
case "neutral":
|
|
1165
1119
|
return {
|
|
1166
|
-
bg: theme.colors.background.neutral.primary,
|
|
1167
|
-
text: theme.colors.content.on.neutral,
|
|
1168
|
-
border:
|
|
1120
|
+
bg: isOutlined ? "transparent" : theme.colors.background.neutral.primary,
|
|
1121
|
+
text: isOutlined ? theme.colors.content.neutral.primary : theme.colors.content.on.neutral,
|
|
1122
|
+
border: theme.colors.border.neutral
|
|
1169
1123
|
};
|
|
1170
1124
|
default:
|
|
1171
1125
|
return {
|
|
1172
|
-
bg: theme.colors.background.primary,
|
|
1126
|
+
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
1173
1127
|
text: theme.colors.content.primary,
|
|
1174
|
-
border:
|
|
1128
|
+
border: theme.colors.border.secondary
|
|
1175
1129
|
};
|
|
1176
1130
|
}
|
|
1177
1131
|
};
|
|
1178
1132
|
const { bg, text, border } = resolveColors();
|
|
1179
1133
|
const isSelectable = variant === "selectable";
|
|
1180
|
-
const isOutlined = type === "outlined";
|
|
1181
|
-
const hasBorder = isSelectable || isOutlined;
|
|
1182
1134
|
const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
|
|
1183
|
-
const
|
|
1135
|
+
const isIconOnly = !children && (!!iconLeft || !!iconRight);
|
|
1184
1136
|
return /* @__PURE__ */ (0, import_jsx_runtime396.jsxs)(
|
|
1185
1137
|
Box2,
|
|
1186
1138
|
{
|
|
@@ -1189,15 +1141,16 @@ var Tag = ({
|
|
|
1189
1141
|
backgroundColor: bg,
|
|
1190
1142
|
borderRadius,
|
|
1191
1143
|
height: sizeStyles.height,
|
|
1192
|
-
|
|
1144
|
+
width: isIconOnly ? sizeStyles.height : void 0,
|
|
1145
|
+
paddingHorizontal: isIconOnly ? 0 : sizeStyles.padding,
|
|
1193
1146
|
flexDirection: "row",
|
|
1194
1147
|
alignItems: "center",
|
|
1195
1148
|
justifyContent: "center",
|
|
1196
1149
|
gap: sizeStyles.gap,
|
|
1197
|
-
borderWidth:
|
|
1150
|
+
borderWidth: sizeStyles.borderWidth,
|
|
1198
1151
|
borderColor: border,
|
|
1199
|
-
borderStyle:
|
|
1200
|
-
cursor: isSelectable ? "pointer" :
|
|
1152
|
+
borderStyle: "solid",
|
|
1153
|
+
cursor: isSelectable ? "pointer" : "default",
|
|
1201
1154
|
hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
|
|
1202
1155
|
style: {
|
|
1203
1156
|
overflow: "hidden",
|
|
@@ -1205,7 +1158,7 @@ var Tag = ({
|
|
|
1205
1158
|
whiteSpace: "nowrap"
|
|
1206
1159
|
},
|
|
1207
1160
|
children: [
|
|
1208
|
-
|
|
1161
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
|
|
1209
1162
|
children && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
|
|
1210
1163
|
Text2,
|
|
1211
1164
|
{
|
|
@@ -1220,7 +1173,8 @@ var Tag = ({
|
|
|
1220
1173
|
children
|
|
1221
1174
|
}
|
|
1222
1175
|
),
|
|
1223
|
-
|
|
1176
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight }),
|
|
1177
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Box2, { onPress: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(X2, { size: sizeStyles.iconSize, color: text }) })
|
|
1224
1178
|
]
|
|
1225
1179
|
}
|
|
1226
1180
|
);
|
|
@@ -1240,9 +1194,11 @@ var useMultiSelectControl = ({
|
|
|
1240
1194
|
placeholder,
|
|
1241
1195
|
removeTagsButtons,
|
|
1242
1196
|
disabled,
|
|
1243
|
-
containerRef
|
|
1197
|
+
containerRef,
|
|
1198
|
+
themeMode,
|
|
1199
|
+
themeProductContext
|
|
1244
1200
|
}) => {
|
|
1245
|
-
const { theme } = (0, import_xui_core2.
|
|
1201
|
+
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1246
1202
|
const displayStateRef = (0, import_react5.useRef)(0 /* Placeholder */);
|
|
1247
1203
|
const savedWidthsRef = (0, import_react5.useRef)(null);
|
|
1248
1204
|
const itemsRef = (0, import_react5.useRef)(null);
|
|
@@ -1491,9 +1447,11 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1491
1447
|
iconLeft,
|
|
1492
1448
|
iconRight,
|
|
1493
1449
|
disabled = false,
|
|
1494
|
-
extraClear = false
|
|
1450
|
+
extraClear = false,
|
|
1451
|
+
themeMode,
|
|
1452
|
+
themeProductContext
|
|
1495
1453
|
}, ref) => {
|
|
1496
|
-
const { theme } = (0, import_xui_core3.
|
|
1454
|
+
const { theme } = (0, import_xui_core3.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1497
1455
|
const sizeStyles = theme.sizing.input(size);
|
|
1498
1456
|
const inputColors = theme.colors.control.input;
|
|
1499
1457
|
const state = externalState || (disabled ? "disable" : "default");
|
|
@@ -1730,9 +1688,11 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1730
1688
|
removeTagsButtons = true,
|
|
1731
1689
|
iconLeft,
|
|
1732
1690
|
iconRight,
|
|
1733
|
-
maxHeight = 300
|
|
1691
|
+
maxHeight = 300,
|
|
1692
|
+
themeMode,
|
|
1693
|
+
themeProductContext
|
|
1734
1694
|
}, ref) => {
|
|
1735
|
-
const { theme } = (0, import_xui_core4.
|
|
1695
|
+
const { theme } = (0, import_xui_core4.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1736
1696
|
const controlRef = (0, import_react8.useRef)(null);
|
|
1737
1697
|
const menuRef = (0, import_react8.useRef)(null);
|
|
1738
1698
|
const sizeStyles = theme.sizing.input(size);
|