@xsolla/xui-multi-select 0.128.0 → 0.129.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/native/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/native/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/native/index.js
CHANGED
|
@@ -80,6 +80,10 @@ var Box = ({
|
|
|
80
80
|
left,
|
|
81
81
|
right,
|
|
82
82
|
width,
|
|
83
|
+
minWidth,
|
|
84
|
+
minHeight,
|
|
85
|
+
maxWidth,
|
|
86
|
+
maxHeight,
|
|
83
87
|
flex,
|
|
84
88
|
overflow,
|
|
85
89
|
zIndex,
|
|
@@ -111,6 +115,10 @@ var Box = ({
|
|
|
111
115
|
zIndex,
|
|
112
116
|
height,
|
|
113
117
|
width,
|
|
118
|
+
minWidth,
|
|
119
|
+
minHeight,
|
|
120
|
+
maxWidth,
|
|
121
|
+
maxHeight,
|
|
114
122
|
padding,
|
|
115
123
|
paddingHorizontal,
|
|
116
124
|
paddingVertical,
|
|
@@ -239,7 +247,7 @@ var Text = ({
|
|
|
239
247
|
}
|
|
240
248
|
const incomingStyle = import_react_native2.StyleSheet.flatten(styleProp);
|
|
241
249
|
const baseStyle = {
|
|
242
|
-
color,
|
|
250
|
+
color: color ?? incomingStyle?.color,
|
|
243
251
|
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
244
252
|
fontWeight,
|
|
245
253
|
fontFamily: resolvedFontFamily,
|
|
@@ -893,6 +901,8 @@ var StyledBox = import_styled_components3.default.div`
|
|
|
893
901
|
width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
|
|
894
902
|
min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
|
|
895
903
|
min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
|
|
904
|
+
max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
|
|
905
|
+
max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
|
|
896
906
|
|
|
897
907
|
padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
|
|
898
908
|
${(props) => props.paddingHorizontal && `
|
|
@@ -1079,12 +1089,13 @@ var Tag = ({
|
|
|
1079
1089
|
selected = false,
|
|
1080
1090
|
onPress,
|
|
1081
1091
|
children,
|
|
1082
|
-
icon,
|
|
1083
1092
|
iconLeft,
|
|
1084
1093
|
iconRight,
|
|
1085
|
-
onRemove
|
|
1094
|
+
onRemove,
|
|
1095
|
+
themeMode,
|
|
1096
|
+
themeProductContext
|
|
1086
1097
|
}) => {
|
|
1087
|
-
const { theme } = (0, import_xui_core.
|
|
1098
|
+
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1088
1099
|
const sizeStyles = theme.sizing.tag(size);
|
|
1089
1100
|
const resolveColors = () => {
|
|
1090
1101
|
if (variant === "selectable") {
|
|
@@ -1101,115 +1112,62 @@ var Tag = ({
|
|
|
1101
1112
|
border: theme.colors.border.secondary
|
|
1102
1113
|
};
|
|
1103
1114
|
}
|
|
1104
|
-
|
|
1105
|
-
switch (tone) {
|
|
1106
|
-
case "primary":
|
|
1107
|
-
return {
|
|
1108
|
-
bg: theme.colors.background.primary,
|
|
1109
|
-
text: theme.colors.content.primary,
|
|
1110
|
-
border: theme.colors.border.secondary
|
|
1111
|
-
};
|
|
1112
|
-
case "brand":
|
|
1113
|
-
return {
|
|
1114
|
-
bg: theme.colors.background.brand.secondary,
|
|
1115
|
-
text: theme.colors.content.brand.primary,
|
|
1116
|
-
border: theme.colors.border.brand
|
|
1117
|
-
};
|
|
1118
|
-
case "brandExtra":
|
|
1119
|
-
return {
|
|
1120
|
-
bg: theme.colors.background.brandExtra.secondary,
|
|
1121
|
-
text: theme.colors.content.brandExtra.primary,
|
|
1122
|
-
border: theme.colors.border.brandExtra
|
|
1123
|
-
};
|
|
1124
|
-
case "success":
|
|
1125
|
-
return {
|
|
1126
|
-
bg: theme.colors.background.success.secondary,
|
|
1127
|
-
text: theme.colors.content.success.primary,
|
|
1128
|
-
border: theme.colors.border.success
|
|
1129
|
-
};
|
|
1130
|
-
case "warning":
|
|
1131
|
-
return {
|
|
1132
|
-
bg: theme.colors.background.warning.secondary,
|
|
1133
|
-
text: theme.colors.content.warning.primary,
|
|
1134
|
-
border: theme.colors.border.warning
|
|
1135
|
-
};
|
|
1136
|
-
case "alert":
|
|
1137
|
-
return {
|
|
1138
|
-
bg: theme.colors.background.alert.secondary,
|
|
1139
|
-
text: theme.colors.content.alert.primary,
|
|
1140
|
-
border: theme.colors.border.alert
|
|
1141
|
-
};
|
|
1142
|
-
case "neutral":
|
|
1143
|
-
return {
|
|
1144
|
-
bg: theme.colors.background.neutral.secondary,
|
|
1145
|
-
text: theme.colors.content.neutral.primary,
|
|
1146
|
-
border: theme.colors.border.neutral
|
|
1147
|
-
};
|
|
1148
|
-
default:
|
|
1149
|
-
return {
|
|
1150
|
-
bg: theme.colors.background.primary,
|
|
1151
|
-
text: theme.colors.content.primary,
|
|
1152
|
-
border: theme.colors.border.secondary
|
|
1153
|
-
};
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1115
|
+
const isOutlined = type === "outlined";
|
|
1156
1116
|
switch (tone) {
|
|
1157
1117
|
case "primary":
|
|
1158
1118
|
return {
|
|
1159
|
-
bg: theme.colors.background.primary,
|
|
1119
|
+
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
1160
1120
|
text: theme.colors.content.primary,
|
|
1161
|
-
border:
|
|
1121
|
+
border: theme.colors.border.secondary
|
|
1162
1122
|
};
|
|
1163
1123
|
case "brand":
|
|
1164
1124
|
return {
|
|
1165
|
-
bg: theme.colors.background.brand.primary,
|
|
1166
|
-
text: theme.colors.content.on.brand,
|
|
1167
|
-
border:
|
|
1125
|
+
bg: isOutlined ? "transparent" : theme.colors.background.brand.primary,
|
|
1126
|
+
text: isOutlined ? theme.colors.content.brand.primary : theme.colors.content.on.brand,
|
|
1127
|
+
border: theme.colors.border.brand
|
|
1168
1128
|
};
|
|
1169
1129
|
case "brandExtra":
|
|
1170
1130
|
return {
|
|
1171
|
-
bg: theme.colors.background.brandExtra.primary,
|
|
1172
|
-
text: theme.colors.content.on.brandExtra,
|
|
1173
|
-
border:
|
|
1131
|
+
bg: isOutlined ? "transparent" : theme.colors.background.brandExtra.primary,
|
|
1132
|
+
text: isOutlined ? theme.colors.content.brandExtra.primary : theme.colors.content.on.brandExtra,
|
|
1133
|
+
border: theme.colors.border.brandExtra
|
|
1174
1134
|
};
|
|
1175
1135
|
case "success":
|
|
1176
1136
|
return {
|
|
1177
|
-
bg: theme.colors.background.success.primary,
|
|
1178
|
-
text: theme.colors.content.on.success,
|
|
1179
|
-
border:
|
|
1137
|
+
bg: isOutlined ? "transparent" : theme.colors.background.success.primary,
|
|
1138
|
+
text: isOutlined ? theme.colors.content.success.primary : theme.colors.content.on.success,
|
|
1139
|
+
border: theme.colors.border.success
|
|
1180
1140
|
};
|
|
1181
1141
|
case "warning":
|
|
1182
1142
|
return {
|
|
1183
|
-
bg: theme.colors.background.warning.primary,
|
|
1184
|
-
text: theme.colors.content.on.warning,
|
|
1185
|
-
border:
|
|
1143
|
+
bg: isOutlined ? "transparent" : theme.colors.background.warning.primary,
|
|
1144
|
+
text: isOutlined ? theme.colors.content.warning.primary : theme.colors.content.on.warning,
|
|
1145
|
+
border: theme.colors.border.warning
|
|
1186
1146
|
};
|
|
1187
1147
|
case "alert":
|
|
1188
1148
|
return {
|
|
1189
|
-
bg: theme.colors.background.alert.primary,
|
|
1190
|
-
text: theme.colors.content.on.alert,
|
|
1191
|
-
border:
|
|
1149
|
+
bg: isOutlined ? "transparent" : theme.colors.background.alert.primary,
|
|
1150
|
+
text: isOutlined ? theme.colors.content.alert.primary : theme.colors.content.on.alert,
|
|
1151
|
+
border: theme.colors.border.alert
|
|
1192
1152
|
};
|
|
1193
1153
|
case "neutral":
|
|
1194
1154
|
return {
|
|
1195
|
-
bg: theme.colors.background.neutral.primary,
|
|
1196
|
-
text: theme.colors.content.on.neutral,
|
|
1197
|
-
border:
|
|
1155
|
+
bg: isOutlined ? "transparent" : theme.colors.background.neutral.primary,
|
|
1156
|
+
text: isOutlined ? theme.colors.content.neutral.primary : theme.colors.content.on.neutral,
|
|
1157
|
+
border: theme.colors.border.neutral
|
|
1198
1158
|
};
|
|
1199
1159
|
default:
|
|
1200
1160
|
return {
|
|
1201
|
-
bg: theme.colors.background.primary,
|
|
1161
|
+
bg: isOutlined ? "transparent" : theme.colors.background.primary,
|
|
1202
1162
|
text: theme.colors.content.primary,
|
|
1203
|
-
border:
|
|
1163
|
+
border: theme.colors.border.secondary
|
|
1204
1164
|
};
|
|
1205
1165
|
}
|
|
1206
1166
|
};
|
|
1207
1167
|
const { bg, text, border } = resolveColors();
|
|
1208
1168
|
const isSelectable = variant === "selectable";
|
|
1209
|
-
const isOutlined = type === "outlined";
|
|
1210
|
-
const hasBorder = isSelectable || isOutlined;
|
|
1211
1169
|
const borderRadius = isSelectable ? SELECTABLE_BORDER_RADIUS : sizeStyles.radius;
|
|
1212
|
-
const
|
|
1170
|
+
const isIconOnly = !children && (!!iconLeft || !!iconRight);
|
|
1213
1171
|
return /* @__PURE__ */ (0, import_jsx_runtime396.jsxs)(
|
|
1214
1172
|
Box2,
|
|
1215
1173
|
{
|
|
@@ -1218,15 +1176,16 @@ var Tag = ({
|
|
|
1218
1176
|
backgroundColor: bg,
|
|
1219
1177
|
borderRadius,
|
|
1220
1178
|
height: sizeStyles.height,
|
|
1221
|
-
|
|
1179
|
+
width: isIconOnly ? sizeStyles.height : void 0,
|
|
1180
|
+
paddingHorizontal: isIconOnly ? 0 : sizeStyles.padding,
|
|
1222
1181
|
flexDirection: "row",
|
|
1223
1182
|
alignItems: "center",
|
|
1224
1183
|
justifyContent: "center",
|
|
1225
1184
|
gap: sizeStyles.gap,
|
|
1226
|
-
borderWidth:
|
|
1185
|
+
borderWidth: sizeStyles.borderWidth,
|
|
1227
1186
|
borderColor: border,
|
|
1228
|
-
borderStyle:
|
|
1229
|
-
cursor: isSelectable ? "pointer" :
|
|
1187
|
+
borderStyle: "solid",
|
|
1188
|
+
cursor: isSelectable ? "pointer" : "default",
|
|
1230
1189
|
hoverStyle: isSelectable && !selected ? { backgroundColor: theme.colors.control.brand.tertiary.bgHover } : void 0,
|
|
1231
1190
|
style: {
|
|
1232
1191
|
overflow: "hidden",
|
|
@@ -1234,7 +1193,7 @@ var Tag = ({
|
|
|
1234
1193
|
whiteSpace: "nowrap"
|
|
1235
1194
|
},
|
|
1236
1195
|
children: [
|
|
1237
|
-
|
|
1196
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconLeft }),
|
|
1238
1197
|
children && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(
|
|
1239
1198
|
Text2,
|
|
1240
1199
|
{
|
|
@@ -1249,7 +1208,8 @@ var Tag = ({
|
|
|
1249
1208
|
children
|
|
1250
1209
|
}
|
|
1251
1210
|
),
|
|
1252
|
-
|
|
1211
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Icon4, { size: sizeStyles.iconSize, color: text, children: iconRight }),
|
|
1212
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(Box2, { onPress: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime396.jsx)(X2, { size: sizeStyles.iconSize, color: text }) })
|
|
1253
1213
|
]
|
|
1254
1214
|
}
|
|
1255
1215
|
);
|
|
@@ -1269,9 +1229,11 @@ var useMultiSelectControl = ({
|
|
|
1269
1229
|
placeholder,
|
|
1270
1230
|
removeTagsButtons,
|
|
1271
1231
|
disabled,
|
|
1272
|
-
containerRef
|
|
1232
|
+
containerRef,
|
|
1233
|
+
themeMode,
|
|
1234
|
+
themeProductContext
|
|
1273
1235
|
}) => {
|
|
1274
|
-
const { theme } = (0, import_xui_core2.
|
|
1236
|
+
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1275
1237
|
const displayStateRef = (0, import_react5.useRef)(0 /* Placeholder */);
|
|
1276
1238
|
const savedWidthsRef = (0, import_react5.useRef)(null);
|
|
1277
1239
|
const itemsRef = (0, import_react5.useRef)(null);
|
|
@@ -1520,9 +1482,11 @@ var MultiSelectControl = (0, import_react6.forwardRef)(
|
|
|
1520
1482
|
iconLeft,
|
|
1521
1483
|
iconRight,
|
|
1522
1484
|
disabled = false,
|
|
1523
|
-
extraClear = false
|
|
1485
|
+
extraClear = false,
|
|
1486
|
+
themeMode,
|
|
1487
|
+
themeProductContext
|
|
1524
1488
|
}, ref) => {
|
|
1525
|
-
const { theme } = (0, import_xui_core3.
|
|
1489
|
+
const { theme } = (0, import_xui_core3.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1526
1490
|
const sizeStyles = theme.sizing.input(size);
|
|
1527
1491
|
const inputColors = theme.colors.control.input;
|
|
1528
1492
|
const state = externalState || (disabled ? "disable" : "default");
|
|
@@ -1759,9 +1723,11 @@ var MultiSelect = (0, import_react8.forwardRef)(
|
|
|
1759
1723
|
removeTagsButtons = true,
|
|
1760
1724
|
iconLeft,
|
|
1761
1725
|
iconRight,
|
|
1762
|
-
maxHeight = 300
|
|
1726
|
+
maxHeight = 300,
|
|
1727
|
+
themeMode,
|
|
1728
|
+
themeProductContext
|
|
1763
1729
|
}, ref) => {
|
|
1764
|
-
const { theme } = (0, import_xui_core4.
|
|
1730
|
+
const { theme } = (0, import_xui_core4.useResolvedTheme)({ themeMode, themeProductContext });
|
|
1765
1731
|
const controlRef = (0, import_react8.useRef)(null);
|
|
1766
1732
|
const menuRef = (0, import_react8.useRef)(null);
|
|
1767
1733
|
const sizeStyles = theme.sizing.input(size);
|