@linzjs/lui 17.10.3 → 17.11.2

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,24 @@
1
+ ## [17.11.2](https://github.com/linz/lui/compare/v17.11.1...v17.11.2) (2022-08-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * changed margins on banner messages stacked together ([#737](https://github.com/linz/lui/issues/737)) ([59fa68b](https://github.com/linz/lui/commit/59fa68ba22762a96ccd6bde2a1303fd8b4e3275b))
7
+
8
+ ## [17.11.1](https://github.com/linz/lui/compare/v17.11.0...v17.11.1) (2022-08-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **LuiListBox:** Added LuiListbox to exported types ([#736](https://github.com/linz/lui/issues/736)) ([0b1cafa](https://github.com/linz/lui/commit/0b1cafa7f51cb69281bf0972fce4a857fc0cb2a2))
14
+
15
+ # [17.11.0](https://github.com/linz/lui/compare/v17.10.3...v17.11.0) (2022-08-17)
16
+
17
+
18
+ ### Features
19
+
20
+ * **LuiListBox:** Adding LuiListBox an ARIA compliant listbox implementation ([#734](https://github.com/linz/lui/issues/734)) ([c22bb4f](https://github.com/linz/lui/commit/c22bb4fa5647057e72c7dbb65c11a2439ba07136))
21
+
1
22
  ## [17.10.3](https://github.com/linz/lui/compare/v17.10.2...v17.10.3) (2022-08-17)
2
23
 
3
24
  ## [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 declare 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 declare function CheckboxItemRenderer({ item, isSelected, }: IItemRendererProps<ILuiListBoxItem>): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { IItemRendererProps } from '../LuiListBox';
2
+ import { ReactNode } from 'react';
3
+ export declare 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 declare 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>>;
package/dist/index.d.ts CHANGED
@@ -60,3 +60,6 @@ export { LuiSidePanelProvider } from './components/LuiSidePanel/LuiSidePanel';
60
60
  export { LuiSwitchButton } from './components/LuiSwitchButton/LuiSwitchButton';
61
61
  export { LuiAccordicard } from './components/LuiAccordicard/LuiAccordicard';
62
62
  export { LuiAccordicardStatic } from './components/LuiAccordicardStatic/LuiAccordicardStatic';
63
+ export { LuiListBox, ILuiListBoxItem, ILuiListBoxProps, IItemRendererProps, } from './components/LuiListBox/LuiListBox';
64
+ export { RadioItemRenderer } from './components/LuiListBox/Renderers/RadioItemRenderer';
65
+ export { CheckboxItemRenderer } from './components/LuiListBox/Renderers/CheckboxItemRenderer';