@muraldevkit/ui-toolkit 4.11.1 → 4.13.0-dev-u4HR.1

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.
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { RovingPropTypes } from '../../rovingTabindex';
3
+ import { DataQa } from '../../../utils/dataQa';
4
+ export type MrlFilterProps = {
5
+ /**
6
+ * The label for the radio group.
7
+ */
8
+ radioGroupLabel: string;
9
+ /**
10
+ * The children elements to be rendered within the MrlFilter component.
11
+ */
12
+ children?: React.ReactNode;
13
+ /**
14
+ * Callback function that is called when the filter value changes.
15
+ */
16
+ onFilterChange?: (checked: string) => void;
17
+ /**
18
+ * The default checked value for the filter. It will match the value of the MrlFilterItem.
19
+ */
20
+ defaultCheckedValue?: string;
21
+ } & Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultChecked' | 'defaultValue'> & Required<Pick<RovingPropTypes, 'orientation'>> & DataQa;
22
+ /**
23
+ * MrlFilter component.
24
+ *
25
+ * @param props - The component props.
26
+ * @returns The MrlFilter component.
27
+ */
28
+ export declare function MrlFilter(props: MrlFilterProps): React.ReactElement;
@@ -0,0 +1 @@
1
+ export * from './MrlFilter';
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { MrlFilterProps } from '../MrlFilter/MrlFilter';
3
+ type MrlFilterState = {
4
+ checked: string;
5
+ };
6
+ type MrlFilterContextValue = {
7
+ state: MrlFilterState;
8
+ dispatch: React.Dispatch<MrlFilterAction>;
9
+ };
10
+ type SET_CHECKED = {
11
+ type: 'SET_CHECKED';
12
+ payload: string;
13
+ };
14
+ type MrlFilterAction = SET_CHECKED;
15
+ type MrlFilterContextProviderProps = {
16
+ children: React.ReactNode;
17
+ } & Pick<MrlFilterProps, 'defaultCheckedValue' | 'onFilterChange'>;
18
+ /**
19
+ * MrlFilterContextProvider component.
20
+ *
21
+ * @param props - The component props.
22
+ * @returns The MrlFilterContextProvider component.
23
+ */
24
+ export declare function MrlFilterContextProvider(props: MrlFilterContextProviderProps): JSX.Element;
25
+ /**
26
+ * Custom hook to use the MrlFilterContext.
27
+ *
28
+ * This hook provides access to the MrlFilterContext value.
29
+ *
30
+ * @returns The MrlFilterContext value.
31
+ * @throws Will throw an error if used outside of a MrlFilterContextProvider.
32
+ */
33
+ export declare const useMrlFilterContext: () => MrlFilterContextValue;
34
+ export {};
@@ -0,0 +1 @@
1
+ export * from './MrlFilterContext';
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { DataQa } from '../../../utils/dataQa';
3
+ export type MrlFilterItemProps = {
4
+ /**
5
+ * The filter item's value.
6
+ */
7
+ value: string;
8
+ /**
9
+ * The content to be displayed within the filter item.
10
+ */
11
+ children?: React.ReactNode;
12
+ /**
13
+ * The count of items for this filter option.
14
+ */
15
+ count?: number;
16
+ } & React.ComponentPropsWithoutRef<'span'> & DataQa;
17
+ /**
18
+ * MrlFilterItem component.
19
+ *
20
+ * @param props - The component props.
21
+ * @returns The MrlFilterItem component.
22
+ */
23
+ export declare function MrlFilterItem(props: MrlFilterItemProps): React.ReactElement;
@@ -0,0 +1 @@
1
+ export * from './MrlFilterItem';
@@ -0,0 +1,3 @@
1
+ export * from './MrlFilterContext';
2
+ export * from './MrlFilterItem';
3
+ export * from './MrlFilter';
@@ -29,3 +29,4 @@ export * from './callout';
29
29
  export * from './panel';
30
30
  export * from './rovingTabindex';
31
31
  export * from './toolbar';
32
+ export * from './filter';
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { MenuPosition, ActionState, MenuAlignment } from '../../menu/constants';
3
+ interface PopoverWithSelectProps {
4
+ hasCloseButton?: boolean;
5
+ menuAlign?: MenuPosition;
6
+ spacing?: 'default' | 'compact';
7
+ alignment?: MenuAlignment;
8
+ actionState?: ActionState;
9
+ onClose?: () => void;
10
+ triggerAlignment?: 'left' | 'right' | 'center';
11
+ kind?: 'inverse' | 'primary';
12
+ point?: boolean;
13
+ disableFocusTrap?: boolean;
14
+ scrolling?: boolean;
15
+ position?: MenuPosition;
16
+ }
17
+ /**
18
+ * Demo of a popover with a select inside
19
+ *
20
+ * @param {PopoverWithSelectProps} props - The props for the menu with trigger
21
+ * @returns {Element} The menu with trigger demo
22
+ */
23
+ export declare const PopoverWithSelect: ({ menuAlign, alignment, actionState, onClose, triggerAlignment, spacing, kind, point, hasCloseButton, disableFocusTrap }: PopoverWithSelectProps) => JSX.Element;
24
+ export {};
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Hook to detect clicks outside of a given DOM element.
2
+ * Hook to detect clicks outside of a given DOM element, with an optional exclusion for selectors.
3
3
  *
4
- * @param menuRef - Reference to the DOM element that caused this menu to be shown.
4
+ * @param menuRef - Reference to the DOM element to detect outside clicks for.
5
5
  * @param triggerRef - Reference to the DOM element that caused this menu to be shown.
6
- * @param eventType - Event type to listen for
7
- * @param onOutsideClick - Function to call when a click is detected outside the menuRef element
8
- * @param disabled - If the hook should be disabled
6
+ * @param eventType - Event type to listen for.
7
+ * @param onOutsideClick - Function to call when a click is detected outside the menuRef element.
8
+ * @param disabled - If the hook should be disabled.
9
+ * @param excludeSelectors - Optional array of CSS selectors to exclude from the outside click detection.
9
10
  */
10
- export declare const useClickOutside: (menuRef: React.RefObject<HTMLElement>, triggerRef: React.RefObject<HTMLElement> | undefined, eventType: "click" | "mousedown" | "mouseup" | undefined, onOutsideClick: () => void, disabled?: boolean) => void;
11
+ export declare const useClickOutside: (menuRef: React.RefObject<HTMLElement>, triggerRef: React.RefObject<HTMLElement> | undefined, eventType: "click" | "mousedown" | "mouseup" | undefined, onOutsideClick: () => void, disabled?: boolean, excludeSelectors?: string[]) => void;