@linzjs/lui 17.10.3 → 17.11.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.11.0](https://github.com/linz/lui/compare/v17.10.3...v17.11.0) (2022-08-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * **LuiListBox:** Adding LuiListBox an ARIA compliant listbox implementation ([#734](https://github.com/linz/lui/issues/734)) ([c22bb4f](https://github.com/linz/lui/commit/c22bb4fa5647057e72c7dbb65c11a2439ba07136))
7
+
1
8
  ## [17.10.3](https://github.com/linz/lui/compare/v17.10.2...v17.10.3) (2022-08-17)
2
9
 
3
10
  ## [17.10.2](https://github.com/linz/lui/compare/v17.10.1...v17.10.2) (2022-08-17)
@@ -0,0 +1,33 @@
1
+ import './LuiListBox.scss';
2
+ import { HTMLAttributes, Key, ReactNode } from 'react';
3
+ import { SelectionBehavior, SelectionMode } from '@react-types/shared';
4
+ import { AriaListBoxOptions } from '@react-aria/listbox';
5
+ export declare type ItemWithKey<T> = T & {
6
+ key: Key;
7
+ };
8
+ export interface ILuiListBoxItem extends Object {
9
+ key: Key;
10
+ label: ReactNode;
11
+ }
12
+ export interface ILuiListBoxProps<T = ILuiListBoxItem> extends Omit<HTMLAttributes<HTMLUListElement>, 'onChange'> {
13
+ ariaLabel?: string;
14
+ ariaLabelledBy?: string;
15
+ items?: T[];
16
+ value?: Key | Key[];
17
+ disabled?: boolean;
18
+ onChange?: (keys: Key[], items: T[]) => void;
19
+ ariaProps?: Omit<AriaListBoxOptions<ItemWithKey<T>>, 'children' | 'selectedKeys' | 'onSelectionChange' | 'selectionMode'>;
20
+ selectionMode?: SelectionMode;
21
+ selectionBehavior?: SelectionBehavior;
22
+ itemRenderer?: (props: IItemRendererProps<T>) => ReactNode;
23
+ getKey?: (item: T) => Key;
24
+ loadingIndicator?: () => ReactNode;
25
+ emptyIndicator?: () => ReactNode;
26
+ }
27
+ export interface IItemRendererProps<T> {
28
+ item: T;
29
+ isSelected: boolean;
30
+ isDisabled: boolean;
31
+ isFocusVisible: boolean;
32
+ }
33
+ export default function LuiListBox<T extends object = ILuiListBoxItem>({ ariaLabel, ariaLabelledBy, itemRenderer, loadingIndicator, emptyIndicator, selectionMode, selectionBehavior, disabled, items, value, onChange, getKey, ariaProps, className, ...ulProps }: ILuiListBoxProps<T>): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Node } from '@react-types/shared';
2
+ import { ReactNode } from 'react';
3
+ import { IItemRendererProps } from './LuiListBox';
4
+ import { ListState } from '@react-stately/list';
5
+ export interface ILuiListBoxItemProps<T> {
6
+ node: Node<T>;
7
+ state: ListState<T>;
8
+ renderer?: (item: IItemRendererProps<T>) => ReactNode;
9
+ }
10
+ export default function LuiListBoxItem<T>({ node, state, renderer, }: ILuiListBoxItemProps<T>): JSX.Element;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import './CheckboxItemRenderer.scss';
3
+ import { IItemRendererProps, ILuiListBoxItem } from '../LuiListBox';
4
+ export default function CheckboxItemRenderer({ item, isSelected, }: IItemRendererProps<ILuiListBoxItem>): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { IItemRendererProps } from '../LuiListBox';
2
+ import { ReactNode } from 'react';
3
+ export default function DefaultItemRenderer<T extends object>({ item, }: IItemRendererProps<T>): ReactNode;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import './RadioItemRenderer.scss';
3
+ import { IItemRendererProps, ILuiListBoxItem } from '../LuiListBox';
4
+ export default function RadioItemRenderer({ item, isSelected, }: IItemRendererProps<ILuiListBoxItem>): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ListProps } from '@react-stately/list';
2
+ import { ILuiListBoxProps, ItemWithKey } from './LuiListBox';
3
+ export declare function mapToAriaListBoxProps<T extends object>({ selectionMode, selectionBehavior, items, value, onChange, ariaProps, getKey, }: ILuiListBoxProps<T>): ListProps<ItemWithKey<T>>;