@enonic/ui 1.4.0 → 1.5.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 +44 -0
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +116 -116
- package/dist/types/components/dialog/dialog-actions.d.ts +18 -0
- package/dist/types/components/dialog/dialog.d.ts +17 -1
- package/dist/types/components/dialog/index.d.ts +2 -1
- package/dist/types/providers/combobox-provider.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type DialogShortcutType = 'primary' | 'secondary';
|
|
2
|
+
export type DialogActionRegistration = {
|
|
3
|
+
element: HTMLButtonElement | null;
|
|
4
|
+
pending: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type DialogActionScope = {
|
|
7
|
+
parent: DialogActionScope | undefined;
|
|
8
|
+
actions: Record<DialogShortcutType, DialogActionRegistration[]>;
|
|
9
|
+
onEscape: (event: KeyboardEvent) => void;
|
|
10
|
+
containsShortcutEvent: (event: KeyboardEvent) => boolean;
|
|
11
|
+
getActionBoundaries: () => Element[];
|
|
12
|
+
focusContent: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const DialogActionContext: import('preact').Context<DialogActionScope | undefined>;
|
|
15
|
+
export declare const getDialogShortcutKeys: (shortcut: DialogShortcutType, targetDocument?: Document | undefined) => string;
|
|
16
|
+
/** One bubbling listener per document, shared by all open dialog content scopes. */
|
|
17
|
+
export declare const activateDialogScope: (document: Document, scope: DialogActionScope) => (() => void);
|
|
18
|
+
export declare const registerDialogAction: (scope: DialogActionScope, shortcut: DialogShortcutType, action: DialogActionRegistration) => (() => void);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { StepperDotsProps } from '../stepper';
|
|
3
|
+
import { DialogShortcutType } from './dialog-actions';
|
|
3
4
|
export type DialogRootProps = {
|
|
4
5
|
open?: boolean;
|
|
5
6
|
defaultOpen?: boolean;
|
|
@@ -44,6 +45,16 @@ declare const DialogHeader: import('preact').FunctionalComponent<import('preact/
|
|
|
44
45
|
export type DialogCloseProps = {
|
|
45
46
|
asChild?: boolean;
|
|
46
47
|
} & ComponentPropsWithoutRef<'button'>;
|
|
48
|
+
export type DialogShortcutProps = {
|
|
49
|
+
/** Register as primary (default) or secondary for this dialog. */
|
|
50
|
+
shortcut?: DialogShortcutType;
|
|
51
|
+
/** Compose with a child that forwards its ref to a native button. Defaults to false. */
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
/** Toggle shortcut registration without unmounting or disabling the button. Defaults to true. */
|
|
54
|
+
shortcutEnabled?: boolean;
|
|
55
|
+
/** Suppress shortcut activation while the action is pending. */
|
|
56
|
+
pending?: boolean;
|
|
57
|
+
} & ComponentPropsWithoutRef<'button'>;
|
|
47
58
|
export type DialogTitleProps = {
|
|
48
59
|
id?: string;
|
|
49
60
|
asChild?: boolean;
|
|
@@ -91,6 +102,8 @@ export type DialogStepIndicatorProps = {
|
|
|
91
102
|
dots?: boolean;
|
|
92
103
|
disabled?: boolean;
|
|
93
104
|
pending?: boolean;
|
|
105
|
+
/** Register Previous as secondary and Next/the final action as primary. Defaults to false. */
|
|
106
|
+
keyboardShortcuts?: boolean;
|
|
94
107
|
renderDot?: StepperDotsProps['renderDot'];
|
|
95
108
|
};
|
|
96
109
|
export declare const Dialog: {
|
|
@@ -120,6 +133,9 @@ export declare const Dialog: {
|
|
|
120
133
|
Close: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<DialogCloseProps> & {
|
|
121
134
|
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
122
135
|
}>;
|
|
136
|
+
Shortcut: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<DialogShortcutProps> & {
|
|
137
|
+
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
138
|
+
}>;
|
|
123
139
|
Title: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<DialogTitleProps> & {
|
|
124
140
|
ref?: import('preact').Ref<HTMLHeadingElement> | undefined;
|
|
125
141
|
}>;
|
|
@@ -148,7 +164,7 @@ export declare const Dialog: {
|
|
|
148
164
|
displayName: string;
|
|
149
165
|
};
|
|
150
166
|
StepIndicator: {
|
|
151
|
-
({ previousLabel, nextLabel, lastStepLabel, onLastStep, dots, disabled, pending, renderDot, }: DialogStepIndicatorProps): ReactElement;
|
|
167
|
+
({ previousLabel, nextLabel, lastStepLabel, onLastStep, dots, disabled, pending, keyboardShortcuts, renderDot, }: DialogStepIndicatorProps): ReactElement;
|
|
152
168
|
displayName: string;
|
|
153
169
|
};
|
|
154
170
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Dialog, type DialogBodyProps, type DialogCloseProps, type DialogContentProps, type DialogDefaultHeaderProps, type DialogDescriptionProps, type DialogFooterProps, type DialogHeaderProps, type DialogOverlayProps, type DialogPortalProps, type DialogRootProps, type DialogStepContentProps, type DialogStepHeaderProps, type DialogStepIndicatorProps, type DialogTitleProps, type DialogTriggerProps, } from './dialog';
|
|
1
|
+
export { Dialog, type DialogShortcutProps, type DialogBodyProps, type DialogCloseProps, type DialogContentProps, type DialogDefaultHeaderProps, type DialogDescriptionProps, type DialogFooterProps, type DialogHeaderProps, type DialogOverlayProps, type DialogPortalProps, type DialogRootProps, type DialogStepContentProps, type DialogStepHeaderProps, type DialogStepIndicatorProps, type DialogTitleProps, type DialogTriggerProps, } from './dialog';
|
|
2
|
+
export { type DialogShortcutType, getDialogShortcutKeys } from './dialog-actions';
|
|
@@ -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>;
|