@ui5/webcomponents-react
Version:
React Wrapper for UI5 Web Components and additional components
237 lines (236 loc) • 12.9 kB
TypeScript
import '@ui5/webcomponents/dist/TreeItemCustom.js';
import type { ListItemAccessibilityAttributes } from '@ui5/webcomponents/dist/ListItem.js';
import type { ListItemBaseClickEventDetail } from '@ui5/webcomponents/dist/ListItemBase.js';
import type Highlight from '@ui5/webcomponents/dist/types/Highlight.js';
import type ListItemAccessibleRole from '@ui5/webcomponents/dist/types/ListItemAccessibleRole.js';
import type ListItemType from '@ui5/webcomponents/dist/types/ListItemType.js';
import type ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
import type { CommonProps, Ui5CustomEvent, Ui5DomRef, UI5WCSlotsNode } from '@ui5/webcomponents-react-base';
import type { ReactNode } from 'react';
interface TreeItemCustomAttributes {
/**
* Defines the additional accessibility attributes that will be applied to the component.
* The following fields are supported:
*
* - **ariaSetsize**: Defines the number of items in the current set when not all items in the set are present in the DOM.
* **Note:** The value is an integer reflecting the number of items in the complete set. If the size of the entire set is unknown, set `-1`.
*
* - **ariaPosinset**: Defines an element's number or position in the current set when not all items are present in the DOM.
* **Note:** The value is an integer greater than or equal to 1, and less than or equal to the size of the set when that size is known.
*
* **Note:** Available since [v1.15.0](https://github.com/UI5/webcomponents/releases/tag/v1.15.0) of **@ui5/webcomponents**.
* @default {}
*/
accessibilityAttributes?: ListItemAccessibilityAttributes;
/**
* Defines the accessible name of the component.
*
* **Note:** Available since [v1.8.0](https://github.com/UI5/webcomponents/releases/tag/v1.8.0) of **@ui5/webcomponents**.
* @default undefined
*/
accessibleName?: string | undefined;
/**
* Used to define the role of the list item.
*
* **Note:** If not set, the role is automatically inherited from the parent `List` based on its `accessible-role` property
* (e.g. `Menu` -> `MenuItem`, `Tree` -> `TreeItem`, `ListBox` -> `Option`).
* An explicitly set `accessible-role` on the list item takes precedence over the inherited role.
*
* **Note:** Available since [v2.23.0](https://github.com/UI5/webcomponents/releases/tag/v2.23.0) of **@ui5/webcomponents**.
* @default undefined
*/
accessibleRole?: ListItemAccessibleRole | undefined | keyof typeof ListItemAccessibleRole;
/**
* Defines the state of the `additionalText`.
*
* Available options are: `"None"` (by default), `"Positive"`, `"Critical"`, `"Information"` and `"Negative"`.
* @default "None"
*/
additionalTextState?: ValueState | keyof typeof ValueState;
/**
* Defines whether the tree list item will show a collapse or expand icon inside its toggle button.
* @default false
*/
expanded?: boolean;
/**
* Defines whether the tree node has children, even if currently no other tree nodes are slotted inside.
*
* **Note:** This property is useful for showing big tree structures where not all nodes are initially loaded due to performance reasons.
* Set this to `true` for nodes you intend to load lazily, when the user clicks the expand button.
* It is not necessary to set this property otherwise. If a tree item has children, the expand button will be displayed anyway.
* @default false
*/
hasChildren?: boolean;
/**
* Defines whether the tree list item should display the selection element.
* @default false
*/
hideSelectionElement?: boolean;
/**
* Defines the highlight state of the list items.
* Available options are: `"None"` (by default), `"Positive"`, `"Critical"`, `"Information"` and `"Negative"`.
*
* **Note:** Available since [v1.24](https://github.com/UI5/webcomponents/releases/tag/v1.24) of **@ui5/webcomponents**.
* @default "None"
*/
highlight?: Highlight | keyof typeof Highlight;
/**
* If set, an icon will be displayed before the text of the tree list item.
* @default undefined
*/
icon?: string | undefined;
/**
* Defines whether the selection of a tree node is displayed as partially selected.
*
* **Note:** The indeterminate state can be set only programmatically and can’t be achieved by user
* interaction, meaning that the resulting visual state depends on the values of the `indeterminate`
* and `selected` properties:
*
* - If a tree node has both `selected` and `indeterminate` set to `true`, it is displayed as partially selected.
* - If a tree node has `selected` set to `true` and `indeterminate` set to `false`, it is displayed as selected.
* - If a tree node has `selected` set to `false`, it is displayed as not selected regardless of the value of the `indeterminate` property.
*
* **Note:** This property takes effect only when the `Tree` is in `Multiple` mode.
*
* **Note:** Available since [v1.1.0](https://github.com/UI5/webcomponents/releases/tag/v1.1.0) of **@ui5/webcomponents**.
* @default false
*/
indeterminate?: boolean;
/**
* Defines whether the item is movable.
*
* **Note:** Available since [v2.0.0](https://github.com/UI5/webcomponents/releases/tag/v2.0.0) of **@ui5/webcomponents**.
* @default false
*/
movable?: boolean;
/**
* The navigated state of the list item.
* If set to `true`, a navigation indicator is displayed at the end of the list item.
*
* **Note:** Available since [v1.10.0](https://github.com/UI5/webcomponents/releases/tag/v1.10.0) of **@ui5/webcomponents**.
* @default false
*/
navigated?: boolean;
/**
* Defines the selected state of the component.
* @default false
*/
selected?: boolean;
/**
* Defines the text of the tooltip that would be displayed for the list item.
*
* **Note:** Available since [v1.23.0](https://github.com/UI5/webcomponents/releases/tag/v1.23.0) of **@ui5/webcomponents**.
* @default undefined
*/
tooltip?: string | undefined;
/**
* Defines the visual indication and behavior of the list items.
* Available options are `Active` (by default), `Inactive`, `Detail` and `Navigation`.
*
* **Note:** When set to `Active` or `Navigation`, the item will provide visual response upon press and hover,
* while with type `Inactive` and `Detail` - will not.
* @default "Active"
*/
type?: ListItemType | keyof typeof ListItemType;
}
interface TreeItemCustomDomRef extends Required<TreeItemCustomAttributes>, Ui5DomRef {
/**
* Call this method to manually switch the `expanded` state of a tree item.
* @returns {void}
*/
toggle: () => void;
}
interface TreeItemCustomPropTypes extends TreeItemCustomAttributes, Omit<CommonProps, keyof TreeItemCustomAttributes | 'children' | 'content' | 'deleteButton' | 'image' | 'onClick' | 'onDetailClick'> {
/**
* Defines the items of the component.
*
* **Note:** Use `TreeItem` or `TreeItemCustom`
*
* __Supported Node Type/s:__ `Array<TreeItemBase>`
*/
children?: ReactNode | ReactNode[];
/**
* Defines the content of the `TreeItem`.
*
* __Note:__ The content of the prop will be rendered into a [<slot>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) by assigning the respective [slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot) attribute (`slot="content"`).
* Since you can't change the DOM order of slots when declaring them within a prop, it might prove beneficial to manually mount them as part of the component's children, especially when facing problems with the reading order of screen readers.
*
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
*
* __Supported Node Type/s:__ `Array<HTMLElement>`
*/
content?: UI5WCSlotsNode;
/**
* Defines the delete button, displayed in "Delete" mode.
* **Note:** While the slot allows custom buttons, to match
* design guidelines, please use the `Button` component.
* **Note:** When the slot is not present, a built-in delete button will be displayed.
*
* __Note:__ The content of the prop will be rendered into a [<slot>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) by assigning the respective [slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot) attribute (`slot="deleteButton"`).
* Since you can't change the DOM order of slots when declaring them within a prop, it might prove beneficial to manually mount them as part of the component's children, especially when facing problems with the reading order of screen readers.
*
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
*
* **Note:** Available since [v1.9.0](https://github.com/UI5/webcomponents/releases/tag/v1.9.0) of **@ui5/webcomponents**.
*
* __Supported Node Type/s:__ `Array<IButton>`
*/
deleteButton?: UI5WCSlotsNode;
/**
* **Note:** While the slot allows option for setting custom avatar, to match the
* design guidelines, please use the `Avatar` with size XS.
*
* **Note:** If bigger `Avatar` needs to be used, then the size of the
* `TreeItem` should be customized in order to fit.
*
* __Note:__ The content of the prop will be rendered into a [<slot>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) by assigning the respective [slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot) attribute (`slot="image"`).
* Since you can't change the DOM order of slots when declaring them within a prop, it might prove beneficial to manually mount them as part of the component's children, especially when facing problems with the reading order of screen readers.
*
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
*
* **Note:** Available since [v2.10.0](https://github.com/UI5/webcomponents/releases/tag/v2.10.0) of **@ui5/webcomponents**.
*
* __Supported Node Type/s:__ `Array<HTMLElement>`
*/
image?: UI5WCSlotsNode;
/**
* Fired when the component is activated either with a mouse/tap or by using the Enter or Space key.
*
* **Note:** The event will not be fired if the `disabled` property is set to `true`.
*
* **Note:** Available since [v2.23.0](https://github.com/UI5/webcomponents/releases/tag/v2.23.0) of **@ui5/webcomponents**.
*
* | cancelable | bubbles |
* | :--------: | :-----: |
* | ❌|✅|
*/
onClick?: (event: Ui5CustomEvent<TreeItemCustomDomRef, ListItemBaseClickEventDetail>) => void;
/**
* Fired when the user clicks on the detail button when type is `Detail`.
*
* | cancelable | bubbles |
* | :--------: | :-----: |
* | ❌|✅|
*/
onDetailClick?: (event: Ui5CustomEvent<TreeItemCustomDomRef>) => void;
}
/**
* The `TreeItemCustom` represents a node in a tree structure, shown as a `List`.
*
* This is the item to use inside a `Tree`.
* You can represent an arbitrary tree structure by recursively nesting tree items.
*
* You can use this item to put any custom content inside the tree item.
*
*
*
* __Note:__ This is a UI5 Web Component! [TreeItemCustom UI5 Web Component Documentation](https://ui5.github.io/webcomponents/components/TreeItemCustom) | [Repository](https://github.com/UI5/webcomponents)
*
* @since [1.9.2](https://github.com/UI5/webcomponents/releases/tag/v1.9.2) of __@ui5/webcomponents__.
*/
declare const TreeItemCustom: import("react").ForwardRefExoticComponent<TreeItemCustomPropTypes & import("@ui5/webcomponents-react-base").WithWebComponentPropTypes & import("react").RefAttributes<TreeItemCustomDomRef>>;
export { TreeItemCustom };
export type { TreeItemCustomDomRef, TreeItemCustomPropTypes };