@edux-design/forms 0.0.13 → 0.0.15
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -6
- package/dist/index.mjs +25 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -247,6 +247,7 @@ declare const Option: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
|
247
247
|
* @property {string} [listClassName] - optional class for the list element
|
|
248
248
|
* @property {string} [optionClassName] - optional class for each option
|
|
249
249
|
* @property {"default"|"small"} [size="default"] - size variant for the combobox input
|
|
250
|
+
* @property {"full"|"small"|"medium"|"large"} [width="full"] - width size for the combobox container
|
|
250
251
|
*/
|
|
251
252
|
declare const ComboboxRoot: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
252
253
|
|
package/dist/index.d.ts
CHANGED
|
@@ -247,6 +247,7 @@ declare const Option: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
|
247
247
|
* @property {string} [listClassName] - optional class for the list element
|
|
248
248
|
* @property {string} [optionClassName] - optional class for each option
|
|
249
249
|
* @property {"default"|"small"} [size="default"] - size variant for the combobox input
|
|
250
|
+
* @property {"full"|"small"|"medium"|"large"} [width="full"] - width size for the combobox container
|
|
250
251
|
*/
|
|
251
252
|
declare const ComboboxRoot: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
|
|
252
253
|
|
package/dist/index.js
CHANGED
|
@@ -885,6 +885,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
885
885
|
listClassName,
|
|
886
886
|
optionClassName,
|
|
887
887
|
size = "default",
|
|
888
|
+
width = "full",
|
|
888
889
|
...inputProps
|
|
889
890
|
}, ref) => {
|
|
890
891
|
const {
|
|
@@ -1003,6 +1004,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1003
1004
|
setContentWidth(anchorRef.current.offsetWidth);
|
|
1004
1005
|
}
|
|
1005
1006
|
}, [open]);
|
|
1007
|
+
const isNarrowPopover = contentWidth > 0 && contentWidth < 100;
|
|
1006
1008
|
const emitChange = (0, import_react10.useCallback)(
|
|
1007
1009
|
(nextValue, option) => {
|
|
1008
1010
|
if (!isControlled) {
|
|
@@ -1163,6 +1165,12 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1163
1165
|
input: "text-sm py-0.5"
|
|
1164
1166
|
}
|
|
1165
1167
|
};
|
|
1168
|
+
const widthStyles = {
|
|
1169
|
+
full: "w-full",
|
|
1170
|
+
small: "w-[60px]",
|
|
1171
|
+
medium: "w-[320px]",
|
|
1172
|
+
large: "w-[400px]"
|
|
1173
|
+
};
|
|
1166
1174
|
const selectedChips = isMultiSelectEnabled && multiSelectedOptions.length > 0 ? multiSelectedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1167
1175
|
import_chips.Chip,
|
|
1168
1176
|
{
|
|
@@ -1182,7 +1190,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1182
1190
|
"div",
|
|
1183
1191
|
{
|
|
1184
1192
|
ref: anchorRef,
|
|
1185
|
-
className: (0, import_utils7.cx)(
|
|
1193
|
+
className: (0, import_utils7.cx)(widthStyles[width], wrapperClassName),
|
|
1186
1194
|
onMouseDown: isMultiSelectEnabled ? void 0 : handleSingleAnchorMouseDown,
|
|
1187
1195
|
children: isMultiSelectEnabled ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1188
1196
|
"div",
|
|
@@ -1293,7 +1301,7 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1293
1301
|
disableOutsidePointerEvents: false,
|
|
1294
1302
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
1295
1303
|
className: (0, import_utils7.cx)(
|
|
1296
|
-
"rounded-md border border-bg-base bg-white shadow-lg p-0 mt-1 max-h-60 overflow-auto",
|
|
1304
|
+
"rounded-md border border-bg-base bg-white shadow-lg p-0 mt-1 max-h-60 overflow-auto overflow-x-hidden",
|
|
1297
1305
|
contentClassName
|
|
1298
1306
|
),
|
|
1299
1307
|
style: { width: contentWidth || void 0 },
|
|
@@ -1322,12 +1330,14 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1322
1330
|
isActive && "bg-bg-subtle text-fg-base",
|
|
1323
1331
|
isSelected && "font-medium",
|
|
1324
1332
|
option.disabled && "opacity-50 cursor-not-allowed",
|
|
1333
|
+
isNarrowPopover && "min-w-0 px-8 justify-center",
|
|
1325
1334
|
optionClassName,
|
|
1326
1335
|
option.element.props.className
|
|
1327
1336
|
);
|
|
1328
1337
|
const originalOnClick = option.element.props.onClick;
|
|
1329
1338
|
const originalOnMouseDown = option.element.props.onMouseDown;
|
|
1330
1339
|
const optionContent = option.element.props.children ?? option.label;
|
|
1340
|
+
const optionContentClassName = isNarrowPopover ? "w-full text-center truncate" : "truncate";
|
|
1331
1341
|
const checkboxIndicator = isMultiSelectEnabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1332
1342
|
"span",
|
|
1333
1343
|
{
|
|
@@ -1363,10 +1373,19 @@ var ComboboxRoot = (0, import_react10.forwardRef)(
|
|
|
1363
1373
|
if (event.defaultPrevented) return;
|
|
1364
1374
|
selectOption(option);
|
|
1365
1375
|
},
|
|
1366
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1377
|
+
"span",
|
|
1378
|
+
{
|
|
1379
|
+
className: (0, import_utils7.cx)(
|
|
1380
|
+
"flex w-full items-center gap-8",
|
|
1381
|
+
isNarrowPopover ? "justify-center" : "justify-between"
|
|
1382
|
+
),
|
|
1383
|
+
children: [
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: optionContentClassName, children: optionContent }),
|
|
1385
|
+
checkboxIndicator
|
|
1386
|
+
]
|
|
1387
|
+
}
|
|
1388
|
+
)
|
|
1370
1389
|
});
|
|
1371
1390
|
})
|
|
1372
1391
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -856,6 +856,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
856
856
|
listClassName,
|
|
857
857
|
optionClassName,
|
|
858
858
|
size = "default",
|
|
859
|
+
width = "full",
|
|
859
860
|
...inputProps
|
|
860
861
|
}, ref) => {
|
|
861
862
|
const {
|
|
@@ -974,6 +975,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
974
975
|
setContentWidth(anchorRef.current.offsetWidth);
|
|
975
976
|
}
|
|
976
977
|
}, [open]);
|
|
978
|
+
const isNarrowPopover = contentWidth > 0 && contentWidth < 100;
|
|
977
979
|
const emitChange = useCallback4(
|
|
978
980
|
(nextValue, option) => {
|
|
979
981
|
if (!isControlled) {
|
|
@@ -1134,6 +1136,12 @@ var ComboboxRoot = forwardRef6(
|
|
|
1134
1136
|
input: "text-sm py-0.5"
|
|
1135
1137
|
}
|
|
1136
1138
|
};
|
|
1139
|
+
const widthStyles = {
|
|
1140
|
+
full: "w-full",
|
|
1141
|
+
small: "w-[60px]",
|
|
1142
|
+
medium: "w-[320px]",
|
|
1143
|
+
large: "w-[400px]"
|
|
1144
|
+
};
|
|
1137
1145
|
const selectedChips = isMultiSelectEnabled && multiSelectedOptions.length > 0 ? multiSelectedOptions.map((option) => /* @__PURE__ */ jsx9(
|
|
1138
1146
|
Chip,
|
|
1139
1147
|
{
|
|
@@ -1153,7 +1161,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
1153
1161
|
"div",
|
|
1154
1162
|
{
|
|
1155
1163
|
ref: anchorRef,
|
|
1156
|
-
className: cx7(
|
|
1164
|
+
className: cx7(widthStyles[width], wrapperClassName),
|
|
1157
1165
|
onMouseDown: isMultiSelectEnabled ? void 0 : handleSingleAnchorMouseDown,
|
|
1158
1166
|
children: isMultiSelectEnabled ? /* @__PURE__ */ jsxs8(
|
|
1159
1167
|
"div",
|
|
@@ -1264,7 +1272,7 @@ var ComboboxRoot = forwardRef6(
|
|
|
1264
1272
|
disableOutsidePointerEvents: false,
|
|
1265
1273
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
1266
1274
|
className: cx7(
|
|
1267
|
-
"rounded-md border border-bg-base bg-white shadow-lg p-0 mt-1 max-h-60 overflow-auto",
|
|
1275
|
+
"rounded-md border border-bg-base bg-white shadow-lg p-0 mt-1 max-h-60 overflow-auto overflow-x-hidden",
|
|
1268
1276
|
contentClassName
|
|
1269
1277
|
),
|
|
1270
1278
|
style: { width: contentWidth || void 0 },
|
|
@@ -1293,12 +1301,14 @@ var ComboboxRoot = forwardRef6(
|
|
|
1293
1301
|
isActive && "bg-bg-subtle text-fg-base",
|
|
1294
1302
|
isSelected && "font-medium",
|
|
1295
1303
|
option.disabled && "opacity-50 cursor-not-allowed",
|
|
1304
|
+
isNarrowPopover && "min-w-0 px-8 justify-center",
|
|
1296
1305
|
optionClassName,
|
|
1297
1306
|
option.element.props.className
|
|
1298
1307
|
);
|
|
1299
1308
|
const originalOnClick = option.element.props.onClick;
|
|
1300
1309
|
const originalOnMouseDown = option.element.props.onMouseDown;
|
|
1301
1310
|
const optionContent = option.element.props.children ?? option.label;
|
|
1311
|
+
const optionContentClassName = isNarrowPopover ? "w-full text-center truncate" : "truncate";
|
|
1302
1312
|
const checkboxIndicator = isMultiSelectEnabled && /* @__PURE__ */ jsx9(
|
|
1303
1313
|
"span",
|
|
1304
1314
|
{
|
|
@@ -1334,10 +1344,19 @@ var ComboboxRoot = forwardRef6(
|
|
|
1334
1344
|
if (event.defaultPrevented) return;
|
|
1335
1345
|
selectOption(option);
|
|
1336
1346
|
},
|
|
1337
|
-
children: /* @__PURE__ */ jsxs8(
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1347
|
+
children: /* @__PURE__ */ jsxs8(
|
|
1348
|
+
"span",
|
|
1349
|
+
{
|
|
1350
|
+
className: cx7(
|
|
1351
|
+
"flex w-full items-center gap-8",
|
|
1352
|
+
isNarrowPopover ? "justify-center" : "justify-between"
|
|
1353
|
+
),
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ jsx9("span", { className: optionContentClassName, children: optionContent }),
|
|
1356
|
+
checkboxIndicator
|
|
1357
|
+
]
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1341
1360
|
});
|
|
1342
1361
|
})
|
|
1343
1362
|
}
|