@simplybusiness/mobius 5.29.6 → 5.29.7
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/CHANGELOG.md +6 -0
- package/dist/cjs/index.js +15 -8
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/index.js +15 -8
- package/dist/types/src/components/Combobox/Listbox.d.ts +2 -1
- package/dist/types/src/components/Radio/RadioGroup.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Checkbox/CheckboxGroup.tsx +1 -0
- package/src/components/Combobox/Combobox.css +7 -0
- package/src/components/Combobox/Combobox.test.tsx +15 -8
- package/src/components/Combobox/Combobox.tsx +12 -15
- package/src/components/Combobox/Listbox.tsx +10 -1
- package/src/components/NumberField/NumberField.tsx +3 -1
- package/src/components/Radio/Radio.test.tsx +19 -1
- package/src/components/Radio/RadioGroup.tsx +6 -5
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1289,19 +1289,25 @@ var Option = ({
|
|
|
1289
1289
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1290
1290
|
var Listbox = ({
|
|
1291
1291
|
id,
|
|
1292
|
+
isOpen = false,
|
|
1292
1293
|
options,
|
|
1293
1294
|
highlightedIndex,
|
|
1294
1295
|
highlightedGroupIndex,
|
|
1295
1296
|
onOptionSelect,
|
|
1296
1297
|
optionComponent
|
|
1297
1298
|
}) => {
|
|
1298
|
-
const classes = (0, import_classnames2.default)("mobius-combobox__list"
|
|
1299
|
+
const classes = (0, import_classnames2.default)("mobius-combobox__list", {
|
|
1300
|
+
"mobius-combobox__list--hidden": !isOpen
|
|
1301
|
+
});
|
|
1299
1302
|
function getOptionId(option, groupIndex, index) {
|
|
1300
1303
|
if (typeof option === "object" && "id" in option && typeof option.id === "string") {
|
|
1301
1304
|
return option.id;
|
|
1302
1305
|
}
|
|
1303
1306
|
return isOptionGroup(options) ? `${id}-option-${groupIndex}-${index}` : `${id}-option-${index}`;
|
|
1304
1307
|
}
|
|
1308
|
+
if (!isOpen) {
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { role: "listbox", id, className: classes });
|
|
1310
|
+
}
|
|
1305
1311
|
if (options && options.length === 0) {
|
|
1306
1312
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { role: "listbox", id, className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mobius-combobox__no-options", children: "No options" }) });
|
|
1307
1313
|
}
|
|
@@ -1552,7 +1558,6 @@ var ComboboxInner = (0, import_react25.forwardRef)(
|
|
|
1552
1558
|
highlightLastOption,
|
|
1553
1559
|
clearHighlight
|
|
1554
1560
|
} = useComboboxHighlight(filteredOptions);
|
|
1555
|
-
const showListbox = isOpen && filteredOptions && filteredOptions.length > 0;
|
|
1556
1561
|
const inputRef = ref || fallbackRef;
|
|
1557
1562
|
const listboxId = (0, import_react25.useId)();
|
|
1558
1563
|
const statusId = (0, import_react25.useId)();
|
|
@@ -1712,18 +1717,19 @@ var ComboboxInner = (0, import_react25.forwardRef)(
|
|
|
1712
1717
|
"aria-describedby": isLoading ? statusId : void 0,
|
|
1713
1718
|
"aria-autocomplete": "list",
|
|
1714
1719
|
"aria-haspopup": "listbox",
|
|
1715
|
-
"aria-controls":
|
|
1716
|
-
"aria-expanded":
|
|
1720
|
+
"aria-controls": listboxId,
|
|
1721
|
+
"aria-expanded": isOpen,
|
|
1717
1722
|
"aria-activedescendant": highlightedIndex === -1 ? void 0 : getHighlightedOptionId(),
|
|
1718
1723
|
prefixInside: icon,
|
|
1719
1724
|
ref: inputRef,
|
|
1720
1725
|
errorMessage: errorMessage || error3?.message || void 0
|
|
1721
1726
|
}
|
|
1722
1727
|
),
|
|
1723
|
-
|
|
1728
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1724
1729
|
Listbox,
|
|
1725
1730
|
{
|
|
1726
1731
|
id: listboxId,
|
|
1732
|
+
isOpen,
|
|
1727
1733
|
isLoading,
|
|
1728
1734
|
options: filteredOptions,
|
|
1729
1735
|
highlightedIndex,
|
|
@@ -3246,7 +3252,7 @@ var NumberField = (0, import_react57.forwardRef)((props, ref) => {
|
|
|
3246
3252
|
max: maxValue ?? void 0,
|
|
3247
3253
|
step,
|
|
3248
3254
|
ref,
|
|
3249
|
-
defaultValue: defaultValue != null ? defaultValue
|
|
3255
|
+
defaultValue: defaultValue != null ? defaultValue?.toString() : defaultValue
|
|
3250
3256
|
}
|
|
3251
3257
|
);
|
|
3252
3258
|
});
|
|
@@ -3609,8 +3615,8 @@ var Radio = (0, import_react63.forwardRef)(
|
|
|
3609
3615
|
Radio.displayName = "Radio";
|
|
3610
3616
|
|
|
3611
3617
|
// src/components/Radio/RadioGroup.tsx
|
|
3612
|
-
var import_react64 = require("react");
|
|
3613
3618
|
var import_dedupe39 = __toESM(require("classnames/dedupe"));
|
|
3619
|
+
var import_react64 = require("react");
|
|
3614
3620
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3615
3621
|
var getDefaultVal = (children, defaultValue) => {
|
|
3616
3622
|
if (Array.isArray(children) && defaultValue) {
|
|
@@ -3632,12 +3638,13 @@ var RadioGroup = (0, import_react64.forwardRef)((props, ref) => {
|
|
|
3632
3638
|
errorMessage,
|
|
3633
3639
|
children,
|
|
3634
3640
|
defaultValue,
|
|
3641
|
+
value,
|
|
3635
3642
|
isReadOnly,
|
|
3636
3643
|
name,
|
|
3637
3644
|
onChange,
|
|
3638
3645
|
...rest
|
|
3639
3646
|
} = props;
|
|
3640
|
-
const defaultSelected = getDefaultVal(children, defaultValue);
|
|
3647
|
+
const defaultSelected = getDefaultVal(children, defaultValue || value);
|
|
3641
3648
|
const [selected, setSelected] = (0, import_react64.useState)(defaultSelected);
|
|
3642
3649
|
const validationClasses = useValidationClasses({
|
|
3643
3650
|
validationState,
|