@muraldevkit/ui-toolkit 2.0.0 → 2.1.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/form/checkbox/MrlCheckbox/MrlCheckbox.d.ts +19 -2
- package/dist/components/form/label/MrlLabelWithDescription/MrlLabelWithDescription.d.ts +32 -0
- package/dist/components/form/label/MrlLabelWithDescription/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/styles/MrlCheckbox/global.scss +0 -5
- package/dist/styles/MrlCheckbox/module.scss +3 -11
- package/dist/styles/MrlCheckbox/variables.scss +0 -23
- package/dist/styles/MrlLabelWithDescription/module.scss +62 -0
- package/dist/styles/MrlLabelWithDescription/variables.scss +21 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AttrsObject } from '../../../../utils';
|
|
3
3
|
import { CheckboxSelected, CheckboxStates, StaticIconConfig } from '../../constants';
|
|
4
4
|
import './MrlCheckbox.global.scss';
|
|
@@ -7,6 +7,8 @@ interface MrlCheckboxProps {
|
|
|
7
7
|
attrs?: AttrsObject;
|
|
8
8
|
/** Additional class to add to the container of the checkbox and label */
|
|
9
9
|
className?: string;
|
|
10
|
+
/** Adjusts the styles of the label, icon and description when the label is multiline */
|
|
11
|
+
hasMultilineLabel?: boolean;
|
|
10
12
|
/** The current state of the checkbox input based on user interactions or permissions */
|
|
11
13
|
state?: CheckboxStates;
|
|
12
14
|
/** Sets what selection state the checkbox is in. */
|
|
@@ -15,6 +17,21 @@ interface MrlCheckboxProps {
|
|
|
15
17
|
label: string;
|
|
16
18
|
/** Leading label icon */
|
|
17
19
|
icon?: StaticIconConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Description, additional context text for the user.
|
|
22
|
+
* It can be a string or a React component for custom render.
|
|
23
|
+
* When using a React component it's necessary to add an id to the custom element and
|
|
24
|
+
* pass it to the MrlCheckbox through 'attrs["aria-describedby"]' to make it accessible
|
|
25
|
+
* to screen readers.
|
|
26
|
+
* Custom description should also implement the disabled state styles
|
|
27
|
+
* for text when the input is disabled or set color: inherit.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <MrlCheckbox attrs={{ 'aria-describedby': customId }} description={
|
|
31
|
+
* <p id={customId}>description</p>
|
|
32
|
+
* }>
|
|
33
|
+
*/
|
|
34
|
+
description?: string | React.ReactNode;
|
|
18
35
|
}
|
|
19
36
|
/**
|
|
20
37
|
* Form element with an associated text label that allows the user to select one or more options
|
|
@@ -23,5 +40,5 @@ interface MrlCheckboxProps {
|
|
|
23
40
|
* @param {MrlCheckboxProps} props - the component props
|
|
24
41
|
* @returns a checkbox element with an associated label
|
|
25
42
|
*/
|
|
26
|
-
export declare function MrlCheckbox({ attrs, className, state, selected, icon, label }: MrlCheckboxProps): JSX.Element;
|
|
43
|
+
export declare function MrlCheckbox({ attrs, className, description, hasMultilineLabel, state, selected, icon, label }: MrlCheckboxProps): JSX.Element;
|
|
27
44
|
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StaticIconConfig } from '../../constants';
|
|
3
|
+
interface MrlLabelWithDescriptionProps {
|
|
4
|
+
/** Additional class to add to the container of the label and description */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Description text or a custom component */
|
|
7
|
+
description?: string | React.ReactNode;
|
|
8
|
+
/** The id that's linked to the form element "aria-describedby" attribute */
|
|
9
|
+
descriptionId?: string;
|
|
10
|
+
/** disabled state */
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
/** indeterminate state */
|
|
13
|
+
isIndeterminate?: boolean;
|
|
14
|
+
/** selected state */
|
|
15
|
+
isSelected?: boolean;
|
|
16
|
+
/** Adjusts the styles of the label, icon and description when the label is multiline */
|
|
17
|
+
hasMultilineLabel?: boolean;
|
|
18
|
+
/** ID of the form elements so all users can understand the relationship between the two elements */
|
|
19
|
+
htmlFor: string;
|
|
20
|
+
/** Leading label icon */
|
|
21
|
+
icon?: StaticIconConfig;
|
|
22
|
+
/** The text to display as the label */
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Form control label that can render a label, an icon and description text
|
|
27
|
+
*
|
|
28
|
+
* @param {MrlLabelWithDescriptionProps} props - the component props
|
|
29
|
+
* @returns a form control label with description
|
|
30
|
+
*/
|
|
31
|
+
export declare function MrlLabelWithDescription({ className, description, descriptionId, isDisabled, isIndeterminate, isSelected, hasMultilineLabel, htmlFor, icon, label }: MrlLabelWithDescriptionProps): JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MrlLabelWithDescription';
|