@muraldevkit/ui-toolkit 2.0.1 → 2.2.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.
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
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';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { GridColumns } from '../constants';
3
+ interface MrlCol extends GridColumns {
4
+ /**
5
+ * Children to be rendered within the component.
6
+ */
7
+ children: React.ReactNode;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * MrlCol React component.
12
+ *
13
+ * @param props - component props
14
+ * @returns a MrlCol React component.
15
+ */
16
+ export declare function MrlCol(props: MrlCol): JSX.Element;
17
+ export {};
@@ -0,0 +1 @@
1
+ export { MrlCol } from './MrlCol';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import '../grid.variables.scss';
3
+ import '../grid.global.scss';
4
+ interface MrlGrid {
5
+ /**
6
+ * Children to be rendered within the component.
7
+ */
8
+ children: React.ReactNode;
9
+ className?: string;
10
+ }
11
+ /**
12
+ * MrlCol React component.
13
+ *
14
+ * @param props - component props
15
+ * @returns a MrlCol React component.
16
+ */
17
+ export declare function MrlGrid({ children, className }: MrlGrid): JSX.Element;
18
+ export {};
@@ -0,0 +1 @@
1
+ export { MrlGrid } from './MrlGrid';
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { AlignOptions, GutterSizes, JustifyOptions } from '../constants';
3
+ interface MrlRow {
4
+ /**
5
+ * Flex alignment of the children within the component.
6
+ */
7
+ align?: AlignOptions;
8
+ /**
9
+ * Children to be rendered within the component.
10
+ */
11
+ children: React.ReactNode;
12
+ className?: string;
13
+ /**
14
+ * Gutter size for columns within the row
15
+ */
16
+ gutter?: GutterSizes;
17
+ /**
18
+ * Justify content of the children within the component.
19
+ */
20
+ justify?: JustifyOptions;
21
+ }
22
+ /**
23
+ * MrlRow React component.
24
+ *
25
+ * @param props - component props
26
+ * @returns a MrlRow React component.
27
+ */
28
+ export declare function MrlRow({ align, children, className, gutter, justify }: MrlRow): JSX.Element;
29
+ export {};
@@ -0,0 +1 @@
1
+ export { MrlRow } from './MrlRow';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Alignment & justification options for grid containers
3
+ */
4
+ export type AlignOptions = 'start' | 'center' | 'end';
5
+ export type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';
6
+ /**
7
+ * Available grid sizes
8
+ */
9
+ export declare const GridSizes: string[];
10
+ /**
11
+ * Number of columns that will be span on the grid.
12
+ */
13
+ export type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
14
+ /**
15
+ * The type of classes that can be configured based on the bootstrap API.
16
+ * Current supported:
17
+ * - columns "col-<size>-<number>"
18
+ * - offsets "offset-<size>-<number>""
19
+ */
20
+ type GridClass = 'col' | 'offset';
21
+ /**
22
+ * Interface of available class selectors based on GridClass
23
+ *
24
+ * Example interface:
25
+ * {
26
+ * col?: number,
27
+ * offset?: number
28
+ * }
29
+ */
30
+ type GridClassConfig = {
31
+ [key in GridClass]?: NumCols;
32
+ };
33
+ /**
34
+ * Options to configure the number of columns to span on different screen sizes.
35
+ */
36
+ type ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;
37
+ export interface GridColumns {
38
+ xs?: ColumnConfig;
39
+ sm?: ColumnConfig;
40
+ md?: ColumnConfig;
41
+ lg?: ColumnConfig;
42
+ xl?: ColumnConfig;
43
+ xxl?: ColumnConfig;
44
+ }
45
+ /**
46
+ * Available gutter sizes for customizing the grid
47
+ */
48
+ export type GutterSizes = 0 | 1 | 2;
49
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './MrlGrid';
2
+ export * from './MrlRow';
3
+ export * from './MrlCol';
@@ -2,6 +2,7 @@ export * from './button';
2
2
  export * from './divider';
3
3
  export * from './focus-trap';
4
4
  export * from './form';
5
+ export * from './grid';
5
6
  export * from './link';
6
7
  export * from './modal';
7
8
  export * from './notification';