@enonic/ui 1.4.0 → 1.6.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/README.md +52 -0
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +129 -126
- package/dist/style.cjs +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/style.css +1 -1
- package/dist/types/components/combobox/combobox.d.ts +3 -2
- package/dist/types/components/dialog/dialog-actions.d.ts +33 -0
- package/dist/types/components/dialog/dialog.d.ts +17 -1
- package/dist/types/components/dialog/index.d.ts +2 -1
- package/dist/types/components/icon-button/icon-button.d.ts +4 -1
- package/dist/types/components/search-field/search-field.d.ts +4 -2
- package/dist/types/components/stepper/index.d.ts +1 -1
- package/dist/types/components/stepper/stepper.d.ts +12 -0
- package/dist/types/components/tab/tab.d.ts +4 -0
- package/dist/types/components/tab/tab.phrases.d.ts +4 -0
- package/dist/types/components/tag/tag.d.ts +2 -6
- package/dist/types/components/toast/toast.d.ts +2 -1
- package/dist/types/components/tree-list/tree-list.d.ts +2 -2
- package/dist/types/components/virtualized-tree-list/virtualized-tree-list.d.ts +3 -2
- package/dist/types/hooks/use-focus-outside.d.ts +9 -0
- package/dist/types/hooks/use-portal-focus-container.d.ts +6 -2
- package/dist/types/i18n/phrases.d.ts +3 -0
- package/dist/types/providers/combobox-provider.d.ts +1 -0
- package/dist/types/providers/context-menu-content-provider.d.ts +1 -0
- package/dist/types/providers/dialog-provider.d.ts +6 -5
- package/dist/types/providers/focus-container-provider.d.ts +3 -1
- package/dist/types/providers/menu-provider.d.ts +1 -0
- package/dist/types/providers/stepper-provider.d.ts +2 -0
- package/dist/types/utils/dom.d.ts +8 -0
- package/package.json +13 -13
|
@@ -46,7 +46,8 @@ export declare const Toast: import('preact').FunctionalComponent<import('preact/
|
|
|
46
46
|
}>;
|
|
47
47
|
Close: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<{
|
|
48
48
|
asChild?: boolean;
|
|
49
|
-
|
|
49
|
+
'aria-label'?: string;
|
|
50
|
+
} & Omit<IconButtonProps, "aria-label" | "icon">> & {
|
|
50
51
|
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
51
52
|
}>;
|
|
52
53
|
};
|
|
@@ -6,7 +6,6 @@ export declare const treeListRowVariants: (props?: ({
|
|
|
6
6
|
active?: boolean | null | undefined;
|
|
7
7
|
selected?: boolean | null | undefined;
|
|
8
8
|
disabled?: boolean | null | undefined;
|
|
9
|
-
selectable?: boolean | null | undefined;
|
|
10
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
10
|
export type TreeListRootProps = {
|
|
12
11
|
selection?: ReadonlySet<string>;
|
|
@@ -146,8 +145,9 @@ export type TreeListRowExpandControlProps = {
|
|
|
146
145
|
onToggle?: () => void;
|
|
147
146
|
icon?: LucideIcon;
|
|
148
147
|
selected?: boolean;
|
|
148
|
+
'aria-label'?: string;
|
|
149
149
|
className?: string;
|
|
150
|
-
} & Omit<IconButtonProps, 'icon' | 'onClick'>;
|
|
150
|
+
} & Omit<IconButtonProps, 'icon' | 'onClick' | 'aria-label'>;
|
|
151
151
|
export declare const TreeListRowExpandControl: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<TreeListRowExpandControlProps> & {
|
|
152
152
|
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
153
153
|
}>;
|
|
@@ -206,7 +206,7 @@ export type VirtualizedTreeListRowProps = {
|
|
|
206
206
|
selected?: boolean;
|
|
207
207
|
/** Whether this row is disabled */
|
|
208
208
|
disabled?: boolean;
|
|
209
|
-
/**
|
|
209
|
+
/** @deprecated Has no effect. Selection is governed by `getItemInteraction` and `RowSelectionControl`'s `selectable`. */
|
|
210
210
|
selectable?: boolean;
|
|
211
211
|
/** Additional class names */
|
|
212
212
|
className?: string;
|
|
@@ -234,8 +234,9 @@ export type VirtualizedTreeListRowExpandControlProps = {
|
|
|
234
234
|
onToggle?: () => void;
|
|
235
235
|
icon?: LucideIcon;
|
|
236
236
|
selected?: boolean;
|
|
237
|
+
'aria-label'?: string;
|
|
237
238
|
className?: string;
|
|
238
|
-
} & Omit<IconButtonProps, 'icon' | 'onClick'>;
|
|
239
|
+
} & Omit<IconButtonProps, 'icon' | 'onClick' | 'aria-label'>;
|
|
239
240
|
export declare const VirtualizedTreeListRowExpandControl: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<VirtualizedTreeListRowExpandControlProps> & {
|
|
240
241
|
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
241
242
|
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
type UseFocusOutsideConfig = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
contentRef: RefObject<HTMLElement | null>;
|
|
5
|
+
onInteractOutside?: (event: Event) => void;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useFocusOutside: ({ enabled, contentRef, onInteractOutside, onClose, }: UseFocusOutsideConfig) => ((branch: HTMLElement) => () => void);
|
|
9
|
+
export {};
|
|
@@ -6,6 +6,7 @@ import { RefObject } from 'react';
|
|
|
6
6
|
*
|
|
7
7
|
* @param elementRef - Ref to the popup element to register
|
|
8
8
|
* @param isEnabled - Whether registration is active (typically: open && isPortalMode)
|
|
9
|
+
* @returns A stable callback for cancellable focus after the parent trap acknowledges the container.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```tsx
|
|
@@ -18,7 +19,10 @@ import { RefObject } from 'react';
|
|
|
18
19
|
* setIsPortalMode(contentRef.current.parentElement === portalContainer);
|
|
19
20
|
* }, [open, portalContainer]);
|
|
20
21
|
*
|
|
21
|
-
* usePortalFocusContainer(contentRef, isPortalMode);
|
|
22
|
+
* const requestFocus = usePortalFocusContainer(contentRef, open && isPortalMode);
|
|
23
|
+
* useLayoutEffect(() => {
|
|
24
|
+
* if (open) return requestFocus(() => contentRef.current?.focus());
|
|
25
|
+
* }, [open, requestFocus]);
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
|
-
export declare const usePortalFocusContainer: (elementRef: RefObject<HTMLElement | null>, isEnabled: boolean) => void;
|
|
28
|
+
export declare const usePortalFocusContainer: (elementRef: RefObject<HTMLElement | null>, isEnabled: boolean) => ((focus: () => void) => () => void);
|
|
@@ -23,6 +23,9 @@ export declare const uiPhrases: Readonly<{
|
|
|
23
23
|
readonly 'enonic.ui.stepper.goToStep': "Go to step {0}";
|
|
24
24
|
} & {
|
|
25
25
|
readonly 'enonic.ui.dialog.close': "Close";
|
|
26
|
+
} & {
|
|
27
|
+
readonly 'enonic.ui.tab.scrollLeft': "Scroll tabs left";
|
|
28
|
+
readonly 'enonic.ui.tab.scrollRight': "Scroll tabs right";
|
|
26
29
|
} & {
|
|
27
30
|
readonly 'enonic.ui.timePicker.hour': "Hour";
|
|
28
31
|
readonly 'enonic.ui.timePicker.minute': "Minute";
|
|
@@ -10,6 +10,7 @@ export type ComboboxContextValue = {
|
|
|
10
10
|
baseId: string;
|
|
11
11
|
contentRef: RefObject<HTMLDivElement>;
|
|
12
12
|
controlRef: RefObject<HTMLDivElement> | null;
|
|
13
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
13
14
|
applyRef: RefObject<HTMLButtonElement>;
|
|
14
15
|
popupRef: RefObject<HTMLDivElement>;
|
|
15
16
|
restoreFocusOnCloseRef: RefObject<boolean>;
|
|
@@ -14,6 +14,7 @@ export type ContextMenuContentContextValue = {
|
|
|
14
14
|
getItems: () => string[];
|
|
15
15
|
isItemDisabled: (id: string) => boolean;
|
|
16
16
|
getItemElement: (id: string) => HTMLElement | null;
|
|
17
|
+
registerFocusBranch: (element: HTMLElement) => () => void;
|
|
17
18
|
/**
|
|
18
19
|
* Safe-triangle check registered by a currently-open child `Sub`. When non-null,
|
|
19
20
|
* the Content's pointer-move capture handler consults it to decide whether to
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { Dispatch, ReactElement, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
export type DialogContextValue = {
|
|
3
3
|
open: boolean;
|
|
4
4
|
setOpen: (next: boolean) => void;
|
|
5
|
-
titleId: string;
|
|
6
|
-
descriptionId: string;
|
|
7
|
-
setTitleId:
|
|
8
|
-
setDescriptionId:
|
|
5
|
+
titleId: string | undefined;
|
|
6
|
+
descriptionId: string | undefined;
|
|
7
|
+
setTitleId: Dispatch<SetStateAction<string | undefined>>;
|
|
8
|
+
setDescriptionId: Dispatch<SetStateAction<string | undefined>>;
|
|
9
|
+
isUsingStepper?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export type DialogProviderProps = {
|
|
11
12
|
value: DialogContextValue;
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* Used by Dialog.Content to extend focus-trap-react's containerElements
|
|
5
5
|
* to include portaled popups (e.g., Combobox.Popup in portal mode).
|
|
6
6
|
*
|
|
7
|
-
* @see
|
|
7
|
+
* @see docs/patterns.md — "Focus Trap with Portaled Content"
|
|
8
8
|
*/
|
|
9
9
|
export type FocusContainerRegistry = {
|
|
10
10
|
register: (element: HTMLElement) => void;
|
|
11
11
|
unregister: (element: HTMLElement) => void;
|
|
12
|
+
/** Focus once the trap has acknowledged this container. Returns a cancellation callback. */
|
|
13
|
+
requestFocus?: (container: HTMLElement, focus: () => void) => () => void;
|
|
12
14
|
};
|
|
13
15
|
export declare const FocusContainerContext: import('preact').Context<FocusContainerRegistry | null>;
|
|
14
16
|
/**
|
|
@@ -11,6 +11,7 @@ export type MenuContextValue = {
|
|
|
11
11
|
isItemDisabled: (id: string) => boolean;
|
|
12
12
|
getItemElement: (id: string) => HTMLElement | null;
|
|
13
13
|
triggerRef: RefObject<HTMLButtonElement> | null;
|
|
14
|
+
contentRef: RefObject<HTMLDivElement>;
|
|
14
15
|
};
|
|
15
16
|
export type MenuProviderProps = {
|
|
16
17
|
value: MenuContextValue;
|
|
@@ -19,4 +19,6 @@ export declare const StepperProvider: {
|
|
|
19
19
|
({ value, children }: StepperProviderProps): ReactElement;
|
|
20
20
|
displayName: string;
|
|
21
21
|
};
|
|
22
|
+
/** The enclosing stepper, if any — for parts that adapt to steps without requiring them. */
|
|
23
|
+
export declare const useStepperOptional: () => StepperContextValue | undefined;
|
|
22
24
|
export declare const useStepper: () => StepperContextValue;
|
|
@@ -20,3 +20,11 @@ export declare const getActiveElement: () => Element | null;
|
|
|
20
20
|
* node focused inside a nested root reads as outside the host that holds it.
|
|
21
21
|
*/
|
|
22
22
|
export declare const containsDeep: (container: Node | null | undefined, node: Node | null | undefined) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The element a container asks to receive focus: the first `[data-autofocus]` that is not under a
|
|
25
|
+
* `[hidden]` ancestor. The consumer marks the target; the caller decides when focus moves.
|
|
26
|
+
*
|
|
27
|
+
* `data-autofocus="false"` is skipped, since Preact writes a `false` boolean to a `data-*`
|
|
28
|
+
* attribute as a string — toggle the marker with `data-autofocus={condition || undefined}`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getAutofocusTarget: (container: Element | null | undefined) => HTMLElement | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Enonic UI Component Library",
|
|
5
5
|
"author": "Enonic",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -90,26 +90,26 @@
|
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@preact/preset-vite": "~2.10.6",
|
|
92
92
|
"@radix-ui/react-slot": "^1.3.3",
|
|
93
|
-
"@size-limit/preset-small-lib": "~14.
|
|
94
|
-
"@storybook/addon-a11y": "~10.6.
|
|
95
|
-
"@storybook/addon-docs": "~10.6.
|
|
96
|
-
"@storybook/addon-themes": "~10.6.
|
|
97
|
-
"@storybook/preact-vite": "~10.6.
|
|
98
|
-
"@storybook/test-runner": "^0.
|
|
93
|
+
"@size-limit/preset-small-lib": "~14.3.0",
|
|
94
|
+
"@storybook/addon-a11y": "~10.6.3",
|
|
95
|
+
"@storybook/addon-docs": "~10.6.3",
|
|
96
|
+
"@storybook/addon-themes": "~10.6.3",
|
|
97
|
+
"@storybook/preact-vite": "~10.6.3",
|
|
98
|
+
"@storybook/test-runner": "^0.26.0",
|
|
99
99
|
"@tailwindcss/vite": "~4.3.3",
|
|
100
100
|
"@types/node": "~26.4.1",
|
|
101
101
|
"@types/react": "~19.3.0",
|
|
102
102
|
"@types/react-dom": "~19.3.0",
|
|
103
103
|
"@typescript/typescript6": "~6.0.2",
|
|
104
104
|
"http-server": "^14.1.1",
|
|
105
|
-
"lucide-preact": "~1.
|
|
105
|
+
"lucide-preact": "~1.65.0",
|
|
106
106
|
"playwright": "^1.62.1",
|
|
107
107
|
"publint": "^0.3.24",
|
|
108
|
-
"react-doctor": "0.9.
|
|
108
|
+
"react-doctor": "0.9.18",
|
|
109
109
|
"react-virtuoso": "^4.18.11",
|
|
110
110
|
"rollup-plugin-visualizer": "~7.1.1",
|
|
111
|
-
"size-limit": "~14.
|
|
112
|
-
"storybook": "~10.6.
|
|
111
|
+
"size-limit": "~14.3.0",
|
|
112
|
+
"storybook": "~10.6.3",
|
|
113
113
|
"tailwindcss": "~4.3.3",
|
|
114
114
|
"terser": "~5.51.2",
|
|
115
115
|
"tw-animate-css": "^1.4.0",
|
|
@@ -130,14 +130,14 @@
|
|
|
130
130
|
"ignore": [
|
|
131
131
|
"focus-trap-react"
|
|
132
132
|
],
|
|
133
|
-
"limit": "
|
|
133
|
+
"limit": "65 KB"
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
"path": "dist/enonic-ui.cjs",
|
|
137
137
|
"ignore": [
|
|
138
138
|
"focus-trap-react"
|
|
139
139
|
],
|
|
140
|
-
"limit": "
|
|
140
|
+
"limit": "65 KB"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"path": "dist/styles/style.css",
|