@linzjs/lui 17.25.1 → 17.26.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [17.26.0](https://github.com/linz/lui/compare/v17.25.1...v17.26.0) (2023-01-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* LuiListBox now passes down disabledKeys ([#810](https://github.com/linz/lui/issues/810)) ([64c1b7b](https://github.com/linz/lui/commit/64c1b7bef3f630306e4b361ede0aa55fe3434cee))
|
|
7
|
+
|
|
1
8
|
## [17.25.1](https://github.com/linz/lui/compare/v17.25.0...v17.25.1) (2023-01-05)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -35,6 +35,7 @@ export interface ILuiListBoxProps<T = ILuiListBoxItem> extends Omit<HTMLAttribut
|
|
|
35
35
|
ariaProps?: Omit<AriaListBoxOptions<ILuiListItemNode<T>>, 'children' | 'selectedKeys' | 'onSelectionChange' | 'selectionMode'>;
|
|
36
36
|
selectionMode?: SelectionMode;
|
|
37
37
|
selectionBehavior?: SelectionBehavior;
|
|
38
|
+
disabledKeys?: Key[];
|
|
38
39
|
itemRenderer?: (props: IItemRendererProps<T>) => ReactNode;
|
|
39
40
|
groupHeadingRenderer?: (props: IGroupHeadingRendererProps) => ReactNode;
|
|
40
41
|
getKey?: KeyGetter<T>;
|
|
@@ -43,4 +44,4 @@ export interface ILuiListBoxProps<T = ILuiListBoxItem> extends Omit<HTMLAttribut
|
|
|
43
44
|
loadingIndicator?: () => ReactNode;
|
|
44
45
|
emptyIndicator?: () => ReactNode;
|
|
45
46
|
}
|
|
46
|
-
export declare function LuiListBox<T extends object = ILuiListBoxItem>({ ariaLabel, ariaLabelledBy, itemRenderer, groupHeadingRenderer, loadingIndicator, emptyIndicator, selectionMode, selectionBehavior, disabled, items, value, onChange, getKey, getGroup, getLabel, ariaProps, className, ...ulProps }: ILuiListBoxProps<T>): JSX.Element;
|
|
47
|
+
export declare function LuiListBox<T extends object = ILuiListBoxItem>({ ariaLabel, ariaLabelledBy, itemRenderer, groupHeadingRenderer, loadingIndicator, emptyIndicator, selectionMode, selectionBehavior, disabled, disabledKeys, items, value, onChange, getKey, getGroup, getLabel, ariaProps, className, ...ulProps }: ILuiListBoxProps<T>): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ListProps } from '@react-stately/list';
|
|
2
2
|
import { ILuiListBoxProps, ILuiListItemNode } from './LuiListBox';
|
|
3
|
-
export declare function useLuiListBox<T extends object>({ selectionMode, selectionBehavior, items, value, onChange, ariaProps, getGroup, getKey, getLabel, }: ILuiListBoxProps<T>): ListProps<ILuiListItemNode<T>>;
|
|
3
|
+
export declare function useLuiListBox<T extends object>({ selectionMode, selectionBehavior, items, value, onChange, ariaProps, disabledKeys, getGroup, getKey, getLabel, }: ILuiListBoxProps<T>): ListProps<ILuiListItemNode<T>>;
|
package/dist/index.js
CHANGED
|
@@ -41116,7 +41116,7 @@ function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
|
|
|
41116
41116
|
}
|
|
41117
41117
|
|
|
41118
41118
|
function useLuiListBox(_a) {
|
|
41119
|
-
var selectionMode = _a.selectionMode, selectionBehavior = _a.selectionBehavior, _b = _a.items, items = _b === void 0 ? [] : _b, value = _a.value, onChange = _a.onChange, ariaProps = _a.ariaProps, _c = _a.getGroup, getGroup = _c === void 0 ? defaultGroupGetter : _c, _d = _a.getKey, getKey = _d === void 0 ? defaultKeyGetter : _d, _e = _a.getLabel, getLabel = _e === void 0 ? defaultLabelGetter : _e;
|
|
41119
|
+
var selectionMode = _a.selectionMode, selectionBehavior = _a.selectionBehavior, _b = _a.items, items = _b === void 0 ? [] : _b, value = _a.value, onChange = _a.onChange, ariaProps = _a.ariaProps, disabledKeys = _a.disabledKeys, _c = _a.getGroup, getGroup = _c === void 0 ? defaultGroupGetter : _c, _d = _a.getKey, getKey = _d === void 0 ? defaultKeyGetter : _d, _e = _a.getLabel, getLabel = _e === void 0 ? defaultLabelGetter : _e;
|
|
41120
41120
|
var children = React.useCallback(function (item) {
|
|
41121
41121
|
return item.childNodes ? (React__default["default"].createElement($9fc4852771d079eb$export$6e2c8f0811a474ce, { key: item.key, items: item.childNodes, title: item.textValue }, function (item) { return React__default["default"].createElement($c1d7fb2ec91bae71$export$6d08773d2e66f8f2, null, String(item.key)); })) : (React__default["default"].createElement($c1d7fb2ec91bae71$export$6d08773d2e66f8f2, null, String(item.key)));
|
|
41122
41122
|
}, []);
|
|
@@ -41127,7 +41127,7 @@ function useLuiListBox(_a) {
|
|
|
41127
41127
|
onChange(keys === 'all' ? items.map(function (item) { return getKey(item); }) : Array.from(keys), keys === 'all' ? items : items.filter(function (item) { return keys.has(getKey(item)); }));
|
|
41128
41128
|
}, [items, onChange, getKey]);
|
|
41129
41129
|
var nodes = React.useMemo(function () { return mapItemsToNodes(items, getKey, getGroup, getLabel); }, [items, getKey, getGroup, getLabel]);
|
|
41130
|
-
return __assign(__assign({}, ariaProps), { items: nodes, selectionMode: selectionMode, selectionBehavior: selectionBehavior, selectedKeys: (Array.isArray(value) ? value : [value]).filter(Boolean), children: children, onSelectionChange: onSelectionChange });
|
|
41130
|
+
return __assign(__assign({}, ariaProps), { items: nodes, selectionMode: selectionMode, selectionBehavior: selectionBehavior, selectedKeys: (Array.isArray(value) ? value : [value]).filter(Boolean), children: children, onSelectionChange: onSelectionChange, disabledKeys: disabledKeys });
|
|
41131
41131
|
}
|
|
41132
41132
|
function mapItemsToNodes(items, getKey, getGroup, getLabel) {
|
|
41133
41133
|
var rootNodes = new Map();
|
|
@@ -44278,7 +44278,7 @@ function LuiListBoxGroup(_a) {
|
|
|
44278
44278
|
}
|
|
44279
44279
|
|
|
44280
44280
|
function LuiListBox(_a) {
|
|
44281
|
-
var ariaLabel = _a.ariaLabel, ariaLabelledBy = _a.ariaLabelledBy, _b = _a.itemRenderer, itemRenderer = _b === void 0 ? DefaultItemRenderer : _b, _c = _a.groupHeadingRenderer, groupHeadingRenderer = _c === void 0 ? DefaultGroupHeadingRenderer : _c, _d = _a.loadingIndicator, loadingIndicator = _d === void 0 ? DefaultLoadingIndicator : _d, _e = _a.emptyIndicator, emptyIndicator = _e === void 0 ? DefaultEmptyIndicator : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? 'single' : _f, _g = _a.selectionBehavior, selectionBehavior = _g === void 0 ? 'toggle' : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, items = _a.items, value = _a.value, onChange = _a.onChange, getKey = _a.getKey, getGroup = _a.getGroup, getLabel = _a.getLabel, ariaProps = _a.ariaProps, className = _a.className, ulProps = __rest(_a, ["ariaLabel", "ariaLabelledBy", "itemRenderer", "groupHeadingRenderer", "loadingIndicator", "emptyIndicator", "selectionMode", "selectionBehavior", "disabled", "items", "value", "onChange", "getKey", "getGroup", "getLabel", "ariaProps", "className"]);
|
|
44281
|
+
var ariaLabel = _a.ariaLabel, ariaLabelledBy = _a.ariaLabelledBy, _b = _a.itemRenderer, itemRenderer = _b === void 0 ? DefaultItemRenderer : _b, _c = _a.groupHeadingRenderer, groupHeadingRenderer = _c === void 0 ? DefaultGroupHeadingRenderer : _c, _d = _a.loadingIndicator, loadingIndicator = _d === void 0 ? DefaultLoadingIndicator : _d, _e = _a.emptyIndicator, emptyIndicator = _e === void 0 ? DefaultEmptyIndicator : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? 'single' : _f, _g = _a.selectionBehavior, selectionBehavior = _g === void 0 ? 'toggle' : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, _j = _a.disabledKeys, disabledKeys = _j === void 0 ? [] : _j, items = _a.items, value = _a.value, onChange = _a.onChange, getKey = _a.getKey, getGroup = _a.getGroup, getLabel = _a.getLabel, ariaProps = _a.ariaProps, className = _a.className, ulProps = __rest(_a, ["ariaLabel", "ariaLabelledBy", "itemRenderer", "groupHeadingRenderer", "loadingIndicator", "emptyIndicator", "selectionMode", "selectionBehavior", "disabled", "disabledKeys", "items", "value", "onChange", "getKey", "getGroup", "getLabel", "ariaProps", "className"]);
|
|
44282
44282
|
var listProps = useLuiListBox({
|
|
44283
44283
|
selectionMode: selectionMode,
|
|
44284
44284
|
selectionBehavior: selectionBehavior,
|
|
@@ -44289,7 +44289,8 @@ function LuiListBox(_a) {
|
|
|
44289
44289
|
getGroup: getGroup,
|
|
44290
44290
|
getLabel: getLabel,
|
|
44291
44291
|
ariaProps: ariaProps,
|
|
44292
|
-
disabled: disabled
|
|
44292
|
+
disabled: disabled,
|
|
44293
|
+
disabledKeys: disabledKeys
|
|
44293
44294
|
});
|
|
44294
44295
|
var ariaListBoxProps = React.useMemo(function () { return (__assign({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }, listProps)); }, [listProps, ariaLabel, ariaLabelledBy]);
|
|
44295
44296
|
var ref = React.useRef(null);
|