@muraldevkit/ui-toolkit 1.9.1 → 1.10.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/components/button/helpers.d.ts +2 -1
- package/dist/components/focus-trap/MrlFocusTrap.d.ts +26 -0
- package/dist/components/modal/MrlModal/index.d.ts +34 -0
- package/dist/components/modal/MrlModalContent/index.d.ts +16 -0
- package/dist/components/modal/MrlModalFooter/index.d.ts +28 -0
- package/dist/components/modal/MrlModalHeader/index.d.ts +23 -0
- package/dist/components/modal/constants.d.ts +18 -0
- package/dist/components/modal/demo/ModalWithTriggerDemo.d.ts +14 -0
- package/dist/components/modal/index.d.ts +5 -0
- package/dist/components/tooltip/MrlTooltip/MrlTooltip.d.ts +12 -10
- package/dist/index.js +1 -1
- package/dist/styles/MrlModal/mixins.scss +46 -0
- package/dist/styles/MrlModal/module.scss +81 -0
- package/dist/styles/MrlModal/variables.scss +28 -0
- package/dist/styles/MrlModalContent/module.scss +13 -0
- package/dist/styles/MrlModalFooter/module.scss +49 -0
- package/dist/styles/MrlModalFooter/variables.scss +10 -0
- package/dist/styles/MrlModalHeader/module.scss +21 -0
- package/dist/styles/button/global.scss +2 -2
- package/dist/styles/modal/variables.scss +37 -0
- package/dist/utils/isElementScrollable/index.d.ts +7 -0
- package/dist/utils/trapFocus/index.d.ts +16 -0
- package/package.json +2 -1
|
@@ -22,6 +22,7 @@ export declare const _isSelected: (currentState: MrlButtonState, enforcedState?:
|
|
|
22
22
|
/**
|
|
23
23
|
* MrlIconButton and MrlAnimatedIconButton could behave as a toggle button if toggleStyle is 'default' or 'secondary'
|
|
24
24
|
*
|
|
25
|
-
* @param toggleStyle
|
|
25
|
+
* @param {ToggleStyle} toggleStyle type of toggle
|
|
26
|
+
* @returns {boolean} returns boolean if it's togglable
|
|
26
27
|
*/
|
|
27
28
|
export declare const _isToggleButton: (toggleStyle: ToggleStyle) => boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface PropTypes {
|
|
3
|
+
/**
|
|
4
|
+
* Elements to be rendered within the focus trap
|
|
5
|
+
*/
|
|
6
|
+
children: ((ref: React.RefObject<HTMLElement>) => JSX.Element) | React.ReactElement | React.ReactElement[];
|
|
7
|
+
/**
|
|
8
|
+
* Specifies whether the focus trap should be disabled
|
|
9
|
+
*/
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Focus trap container reference. Can be used to specify a custom container if a ref already exists.
|
|
13
|
+
*/
|
|
14
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Focus Trap React Component
|
|
18
|
+
*
|
|
19
|
+
* @param {object} props - The component props.
|
|
20
|
+
* @param {React.ReactElement} props.children - A function that returns the component's child element and receives a ref to the container.
|
|
21
|
+
* @param {boolean} [props.disabled] - Specifies whether the focus trap should be disabled.
|
|
22
|
+
* @param { React.RefObject<HTMLElement>} props.containerRef - Focus trap container reference
|
|
23
|
+
* @returns {React.ReactElement} - The rendered FocusTrap component.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MrlFocusTrap: ({ children, disabled, containerRef }: PropTypes) => JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
import { ModalSize, ModalState } from '../constants';
|
|
4
|
+
interface ModalProps {
|
|
5
|
+
/**
|
|
6
|
+
* Content of the modal
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactElement | React.ReactElement[];
|
|
9
|
+
/** The size of the modal container */
|
|
10
|
+
size?: ModalSize;
|
|
11
|
+
/** Current state of the modal based on user interactions or permissions */
|
|
12
|
+
state?: ModalState;
|
|
13
|
+
/** Additional function to be run when the modal closes */
|
|
14
|
+
hookClose?: (() => void) | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Attributes that are applied to the component during the initial render.
|
|
17
|
+
*
|
|
18
|
+
* Example usage: html attributes, custom data attributes (data-qa), aria
|
|
19
|
+
*/
|
|
20
|
+
attrs?: AttrsObject | string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Modal Component
|
|
24
|
+
*
|
|
25
|
+
* @param {object} props - Modal props
|
|
26
|
+
* @param {ModalSize} props.size - The size of the modal container. Defaults to 'defaults.size'
|
|
27
|
+
* @param {ModalState} props.state - Current state of the modal. Defaults to 'close'
|
|
28
|
+
* @param {Function} props.hookClose - Callback function to be run when the modal closes
|
|
29
|
+
* @param {AttrsObject | string} props.attrs - Additional HTML attributes to be passed in
|
|
30
|
+
* @param {React.ReactElement} props.children - Children to be rendered within the modal. The first child is used as the trigger.
|
|
31
|
+
* @returns {React.ReactElement} an instance of the MrlModal
|
|
32
|
+
*/
|
|
33
|
+
export declare const MrlModal: ({ children, size, state, hookClose, attrs }: ModalProps) => ReactElement;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MrlModalHeaderProps {
|
|
3
|
+
/**
|
|
4
|
+
* Children to be rendered within the component.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactElement | React.ReactElement[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Modal Content component for the MrlModal
|
|
10
|
+
*
|
|
11
|
+
* @param {object} props - The props object
|
|
12
|
+
* @param {React.ReactElement} props.children - The children to be rendered within the component
|
|
13
|
+
* @returns {React.ReactElement}} The rendered MrlModalContent component
|
|
14
|
+
*/
|
|
15
|
+
export declare const MrlModalContent: ({ children }: MrlModalHeaderProps) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
interface MrlModalFooterProps {
|
|
4
|
+
/**
|
|
5
|
+
* Attributes that are applied to the component during the initial render.
|
|
6
|
+
*
|
|
7
|
+
* Example usage: html attributes, custom data attributes (data-qa), aria
|
|
8
|
+
*/
|
|
9
|
+
attrs?: AttrsObject;
|
|
10
|
+
/**
|
|
11
|
+
* Slots for primary, secondary, and tertiary modal regions
|
|
12
|
+
*/
|
|
13
|
+
primary?: React.ReactElement;
|
|
14
|
+
secondary?: React.ReactElement;
|
|
15
|
+
tertiary?: React.ReactElement;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Modal Footer component for the MrlModal
|
|
19
|
+
*
|
|
20
|
+
* @param {MrlModalFooterProps} props - The props for the MrlModalFooter component
|
|
21
|
+
* @param {AttrsObject} props.attrs - Additional HTML attributes for the `mrl-modal` element
|
|
22
|
+
* @param {React.ReactElement} props.primary - primary modal element
|
|
23
|
+
* @param {React.ReactElement} props.secondary - secondary modal element
|
|
24
|
+
* @param {React.ReactElement} props.tertiary - tertiary modal element
|
|
25
|
+
* @returns {React.ReactElement} The rendered MrlModalFooter component
|
|
26
|
+
*/
|
|
27
|
+
export declare const MrlModalFooter: ({ attrs, primary, secondary, tertiary }: MrlModalFooterProps) => JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
interface MrlModalHeaderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Attributes that are applied to the component during the initial render.
|
|
6
|
+
*
|
|
7
|
+
* Example usage: html attributes, custom data attributes (data-qa), aria
|
|
8
|
+
*/
|
|
9
|
+
attrs?: AttrsObject;
|
|
10
|
+
/**
|
|
11
|
+
* Text the h1 element of modal header
|
|
12
|
+
*/
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Modal Footer component for the MrlModal.
|
|
17
|
+
*
|
|
18
|
+
* @param {MrlModalHeaderProps} props - The props for the MrlModalFooter component
|
|
19
|
+
* @param {AttrsObject} props.attrs - Additional HTML attributes for the `mrl-modal` element
|
|
20
|
+
* @returns {React.ReactElement} The rendered MrlModalFooter component
|
|
21
|
+
*/
|
|
22
|
+
export declare const MrlModalHeader: ({ attrs, text }: MrlModalHeaderProps) => JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AttrsObject } from '../../utils';
|
|
2
|
+
export declare const allowedValues: {
|
|
3
|
+
sizes: readonly ["small", "medium", "large"];
|
|
4
|
+
states: readonly ["open", "close"];
|
|
5
|
+
};
|
|
6
|
+
export type ModalSize = (typeof allowedValues.sizes)[number];
|
|
7
|
+
export type ModalState = (typeof allowedValues.states)[number];
|
|
8
|
+
export interface ModalDefaults {
|
|
9
|
+
attrs: AttrsObject;
|
|
10
|
+
size: ModalSize;
|
|
11
|
+
state: ModalState;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Default values for props on the Modal component;
|
|
15
|
+
* Shared between the component and Storybook
|
|
16
|
+
*/
|
|
17
|
+
export declare const defaults: ModalDefaults;
|
|
18
|
+
export declare const TransitionDuration = 300;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ModalDemoProps {
|
|
3
|
+
/** Additional function to be run when the modal closes */
|
|
4
|
+
hookClose?: (() => void) | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Demo for a modal with a trigger button
|
|
8
|
+
*
|
|
9
|
+
* @param {object} props - The props object
|
|
10
|
+
* @param {Function} props.hookClose - hookClose for modal
|
|
11
|
+
* @returns {Element} Rendered demo
|
|
12
|
+
*/
|
|
13
|
+
export declare const ModalWithTriggerDemo: ({ hookClose }: ModalDemoProps) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -2,8 +2,14 @@ import React, { ReactElement } from 'react';
|
|
|
2
2
|
import { AttrsObject } from '../../../utils';
|
|
3
3
|
import { MrlTooltipAnchor, MrlTooltipPosition } from '../constants';
|
|
4
4
|
interface MrlTooltipProps {
|
|
5
|
-
/** The
|
|
6
|
-
|
|
5
|
+
/** The arrow position of the tooltip in relation to its trigger's content */
|
|
6
|
+
anchor?: MrlTooltipAnchor;
|
|
7
|
+
/**
|
|
8
|
+
* Attributes that are applied to the component during the initial render.
|
|
9
|
+
*
|
|
10
|
+
* Example usage: html attributes, custom data attributes (data-qa), aria
|
|
11
|
+
*/
|
|
12
|
+
attrs?: AttrsObject | string;
|
|
7
13
|
/**
|
|
8
14
|
* Children to be rendered within the tooltip. The first child is used as the trigger.
|
|
9
15
|
*
|
|
@@ -11,16 +17,12 @@ interface MrlTooltipProps {
|
|
|
11
17
|
* are passed in the component will not have event handling for the additional child elements.
|
|
12
18
|
*/
|
|
13
19
|
children: React.ReactElement;
|
|
14
|
-
/**
|
|
15
|
-
* Attributes that are applied to the component during the initial render.
|
|
16
|
-
*
|
|
17
|
-
* Example usage: html attributes, custom data attributes (data-qa), aria
|
|
18
|
-
*/
|
|
19
|
-
attrs?: AttrsObject | string;
|
|
20
20
|
/** The placement of the tooltip in relation to its trigger */
|
|
21
21
|
position?: MrlTooltipPosition;
|
|
22
|
-
/** The
|
|
23
|
-
|
|
22
|
+
/** The textual label of tooltip */
|
|
23
|
+
text: string;
|
|
24
|
+
/** A custom class selector to be applied to the tooltip wrapper */
|
|
25
|
+
tooltipClass?: string;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* MrlTooltip Component
|