@delightui/components 0.1.104 → 0.1.105
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/cjs/components/molecules/Popover/Popover.presenter.d.ts +26 -0
- package/dist/cjs/components/molecules/Select/Option/Option.types.d.ts +6 -0
- package/dist/cjs/components/molecules/Select/Select.Context.d.ts +1 -1
- package/dist/cjs/components/molecules/Select/Select.d.ts +5 -5
- package/dist/cjs/components/molecules/Select/Select.presenter.d.ts +1 -0
- package/dist/cjs/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/cjs/components/molecules/Select/index.d.ts +2 -9
- package/dist/cjs/components/utils/accessibilityUtils.d.ts +41 -0
- package/dist/cjs/components/utils/index.d.ts +2 -0
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Popover/Popover.presenter.d.ts +26 -0
- package/dist/esm/components/molecules/Select/Option/Option.types.d.ts +6 -0
- package/dist/esm/components/molecules/Select/Select.Context.d.ts +1 -1
- package/dist/esm/components/molecules/Select/Select.d.ts +5 -5
- package/dist/esm/components/molecules/Select/Select.presenter.d.ts +1 -0
- package/dist/esm/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/esm/components/molecules/Select/index.d.ts +2 -9
- package/dist/esm/components/utils/accessibilityUtils.d.ts +41 -0
- package/dist/esm/components/utils/index.d.ts +2 -0
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +50 -12
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PopoverProps } from './Popover.types';
|
|
2
|
+
declare const usePresenter: (props: PopoverProps) => {
|
|
3
|
+
show: boolean;
|
|
4
|
+
offset: import("react-overlays/esm/usePopper").Offset | undefined;
|
|
5
|
+
placement: import("@popperjs/core").Placement;
|
|
6
|
+
handleOnHide: () => void;
|
|
7
|
+
openPopover: () => void;
|
|
8
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
9
|
+
targetRef: import("react").RefObject<HTMLDivElement>;
|
|
10
|
+
initialTransformRef: import("react").MutableRefObject<string | undefined>;
|
|
11
|
+
action: import("./Popover.types").ActionType;
|
|
12
|
+
hideOnClickAway: boolean;
|
|
13
|
+
defaultShow: boolean;
|
|
14
|
+
keepContentOnItemClick: boolean;
|
|
15
|
+
contentPosition: "fixed" | "absolute";
|
|
16
|
+
onClickListener: (() => false | void) | undefined;
|
|
17
|
+
onDoubleClickListener: (() => false | void) | undefined;
|
|
18
|
+
onMouseOutListener: (() => void) | undefined;
|
|
19
|
+
onMouseOverListener: (() => void) | undefined;
|
|
20
|
+
targetOnClickListener: () => false | void;
|
|
21
|
+
targetOnDoubleClickListener: () => false | void;
|
|
22
|
+
popoverAccessibilityProps: import("../../utils/accessibilityUtils").AccessibilityProps;
|
|
23
|
+
targetAccessibilityProps: import("../../utils/accessibilityUtils").AccessibilityProps;
|
|
24
|
+
otherProps: {};
|
|
25
|
+
};
|
|
26
|
+
export default usePresenter;
|
|
@@ -29,4 +29,10 @@ export type OptionProps = LiHTMLAttributes<HTMLLIElement> & {
|
|
|
29
29
|
* Children elements or text content of the option.
|
|
30
30
|
*/
|
|
31
31
|
children?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if the option is selected.
|
|
34
|
+
* For internal use, not to be set by the user.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
closeSelectOptions?: () => void;
|
|
32
38
|
};
|
|
@@ -14,4 +14,4 @@ export declare const useSelectContext: () => SelectContextType;
|
|
|
14
14
|
* @param props - Props for configuring the SelectProvider.
|
|
15
15
|
* @returns JSX element that provides context to its children.
|
|
16
16
|
*/
|
|
17
|
-
export declare const SelectProvider: ({ children, value, multiple, disabled, invalid, onValueChange, }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const SelectProvider: ({ children, value, multiple, disabled, invalid, onValueChange, closeSelectOptions, }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SelectProps } from './Select.types';
|
|
2
2
|
/**
|
|
3
|
-
* Select component
|
|
4
|
-
*
|
|
3
|
+
* Select component that wraps SelectComponent with SelectProvider.
|
|
4
|
+
* Provides state management and context to SelectComponent.
|
|
5
5
|
*
|
|
6
6
|
* @param props - Props for configuring the Select component.
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns JSX element that renders the SelectComponent wrapped with SelectProvider.
|
|
8
8
|
*/
|
|
9
|
-
declare const Select: (props:
|
|
9
|
+
declare const Select: (props: SelectProps) => JSX.Element;
|
|
10
10
|
export default Select;
|
|
@@ -23,6 +23,7 @@ declare const usePresenter: (props: SelectProps) => {
|
|
|
23
23
|
invalid?: boolean;
|
|
24
24
|
onValueChange?: ((value: import("../..").FieldValue) => void) | undefined;
|
|
25
25
|
initialValue?: import("../..").FieldValue | undefined;
|
|
26
|
+
closeSelectOptions?: () => void;
|
|
26
27
|
role?: import("react").AriaRole | undefined;
|
|
27
28
|
onLoad?: import("react").ReactEventHandler<HTMLElement> | undefined;
|
|
28
29
|
onError?: import("react").ReactEventHandler<HTMLElement> | undefined;
|
|
@@ -47,6 +47,11 @@ export type SelectProviderProps = ControlledFormComponentProps<FieldValue> & {
|
|
|
47
47
|
* @default false
|
|
48
48
|
*/
|
|
49
49
|
hasDefaultOption?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Function to close the select options menu.
|
|
52
|
+
* @param value - The new selected value.
|
|
53
|
+
*/
|
|
54
|
+
closeSelectOptions?: () => void;
|
|
50
55
|
};
|
|
51
56
|
/**
|
|
52
57
|
* Enum representing different states of the Select component.
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
+
import Select from './Select';
|
|
1
2
|
import { SelectProvider, useSelectContext } from './Select.Context';
|
|
2
3
|
import type { SelectProps } from './Select.types';
|
|
3
4
|
export type { SelectProps };
|
|
5
|
+
export * from './Option';
|
|
4
6
|
export { default as Option } from './Option';
|
|
5
7
|
export { SelectProvider, useSelectContext };
|
|
6
|
-
export * from './Option';
|
|
7
|
-
/**
|
|
8
|
-
* Select component that wraps SelectComponent with SelectProvider.
|
|
9
|
-
* Provides state management and context to SelectComponent.
|
|
10
|
-
*
|
|
11
|
-
* @param props - Props for configuring the Select component.
|
|
12
|
-
* @returns JSX element that renders the SelectComponent wrapped with SelectProvider.
|
|
13
|
-
*/
|
|
14
|
-
declare const Select: (props: SelectProps) => JSX.Element;
|
|
15
8
|
export default Select;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AriaRole, KeyboardEventHandler, SyntheticEvent } from 'react';
|
|
2
|
+
export type ArrowDirectionEnum = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight';
|
|
3
|
+
export type AccessibilityActions = {
|
|
4
|
+
onClick?: (event?: SyntheticEvent) => void;
|
|
5
|
+
onTab?: (forward: boolean) => void;
|
|
6
|
+
onEsc?: () => void;
|
|
7
|
+
onArrowNavigation?: (direction: ArrowDirectionEnum) => void;
|
|
8
|
+
};
|
|
9
|
+
export type AccessibilityProps = {
|
|
10
|
+
tabIndex?: number;
|
|
11
|
+
role?: AriaRole;
|
|
12
|
+
onKeyDown?: KeyboardEventHandler<unknown>;
|
|
13
|
+
};
|
|
14
|
+
/** Executes the provided function with setTimeout with 0 delay */
|
|
15
|
+
export declare const runInNextCycle: (func: (() => void)) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Generates accessibility properties for clickable elements.
|
|
18
|
+
* @param {boolean} [addIndex] -
|
|
19
|
+
* @param {AriaRole} [role='button'] - ARIA role attribute to be assigned to the element.
|
|
20
|
+
* @returns {AccessibilityProps}
|
|
21
|
+
*/
|
|
22
|
+
export declare const getClickAccessibilityProps: (params: {
|
|
23
|
+
/** Object containing action handlers for various key events. */
|
|
24
|
+
actions: AccessibilityActions;
|
|
25
|
+
/** If true, sets the tabIndex to 0 to make the element focusable. */
|
|
26
|
+
addIndex?: boolean;
|
|
27
|
+
/** Accessibility properties including ARIA role and key event handlers. */
|
|
28
|
+
role?: AriaRole;
|
|
29
|
+
}) => AccessibilityProps;
|
|
30
|
+
/**
|
|
31
|
+
* Handles arrow key navigation for category elements.
|
|
32
|
+
*
|
|
33
|
+
* This function allows users to navigate through keys.
|
|
34
|
+
* It focuses on the next or previous element and optionally triggers a callback.
|
|
35
|
+
*
|
|
36
|
+
* @param {boolean} forward - Whether to move forward (true) or backward (false) in the tab order.
|
|
37
|
+
* @param {number} index - The current index of the focused element.
|
|
38
|
+
* @param {HTMLAnchorElement[]} arrayOfRefs - Array of element references to navigate through.
|
|
39
|
+
* @param {(nextIndex: number) => void} [selectFunction] - Optional callback to handle selection.
|
|
40
|
+
*/
|
|
41
|
+
export declare const handleKeyboardNavigation: (forward: boolean, index: number, arrayOfRefs: HTMLAnchorElement[] | HTMLButtonElement[] | HTMLElement[], selectFunction?: (nextIndex: number) => void, shouldFocusNextElement?: boolean) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ConditionalView } from './ConditionalView';
|
|
2
2
|
export { WrapTextNodes } from './WrapTextNodes';
|
|
3
3
|
export { RenderStateView } from './RenderStateView';
|
|
4
|
+
export type { AccessibilityActions, AccessibilityProps } from './accessibilityUtils';
|
|
5
|
+
export { getClickAccessibilityProps } from './accessibilityUtils';
|
|
4
6
|
export * from './ConditionalView';
|
|
5
7
|
export * from './WrapTextNodes';
|
|
6
8
|
export * from './RenderStateView';
|