@enonic/ui 0.18.1 → 0.20.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/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +79 -60
- package/dist/styles/style.css +1 -1
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/toggle-group/index.d.ts +2 -0
- package/dist/types/components/toggle-group/toggle-group.d.ts +37 -0
- package/dist/types/components/toolbar/index.d.ts +1 -0
- package/dist/types/components/toolbar/toolbar-toggle-group.d.ts +37 -0
- package/dist/types/components/toolbar/toolbar.d.ts +157 -0
- package/dist/types/components/tree-list/index.d.ts +1 -0
- package/dist/types/components/tree-list/tree-list.d.ts +114 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/use-sync-value.d.ts +7 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/providers/toggle-group-provider.d.ts +20 -0
- package/dist/types/providers/tree-list-provider.d.ts +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Signalish } from 'preact';
|
|
2
|
+
/**
|
|
3
|
+
* Syncs a value related to a setter function with a value from arguments
|
|
4
|
+
* @param value - The value to sync with
|
|
5
|
+
* @param setValue - The setter function to update the value to be synced
|
|
6
|
+
*/
|
|
7
|
+
export declare const useSyncValue: <T>(value: Signalish<T> | undefined | null, setValue: (value: T) => void) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type ToggleGroupContextValue = {
|
|
3
|
+
selectionMode: 'single' | 'multiple';
|
|
4
|
+
value: string | string[];
|
|
5
|
+
onValueChange: (value: string) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
registerItem: (id: string, disabled?: boolean) => void;
|
|
8
|
+
unregisterItem: (id: string) => void;
|
|
9
|
+
getItems: () => string[];
|
|
10
|
+
isItemDisabled: (id: string) => boolean;
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
active?: string;
|
|
13
|
+
setActive?: (id: string | undefined) => void;
|
|
14
|
+
};
|
|
15
|
+
export type ToggleGroupProviderProps = {
|
|
16
|
+
value: ToggleGroupContextValue;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare const ToggleGroupProvider: ({ value, children }: ToggleGroupProviderProps) => ReactElement;
|
|
20
|
+
export declare const useToggleGroup: () => ToggleGroupContextValue;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TreeNode } from '../components/tree-list/tree-list';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export type TreeListContextValue<T extends TreeNode = TreeNode> = {
|
|
4
|
+
baseId: string;
|
|
5
|
+
items: readonly T[];
|
|
6
|
+
loadMore: (parent?: string) => void;
|
|
7
|
+
isItemSelectable: (item: T) => boolean;
|
|
8
|
+
active?: string;
|
|
9
|
+
selection?: ReadonlySet<string>;
|
|
10
|
+
expanded?: ReadonlySet<string>;
|
|
11
|
+
toggleSelection?: (id: string) => void;
|
|
12
|
+
toggleExpanded: (id: string) => void;
|
|
13
|
+
selectionMode: 'single' | 'multiple';
|
|
14
|
+
isFocused: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type TreeListProviderProps<T extends TreeNode = TreeNode> = {
|
|
17
|
+
value: TreeListContextValue<T>;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export declare const TreeListProvider: <T extends TreeNode = TreeNode>({ value, children, }: TreeListProviderProps<T>) => ReactElement;
|
|
21
|
+
export declare const useTreeList: <T extends TreeNode = TreeNode>() => TreeListContextValue<T>;
|