@muraldevkit/ui-toolkit 1.10.1 → 1.12.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/MrlSelect/SelectContext.d.ts +47 -0
- package/dist/components/form/MrlSelect/index.d.ts +9 -0
- package/dist/components/form/MrlSelect/select.d.ts +50 -0
- package/dist/components/form/MrlSelectItem/index.d.ts +32 -0
- package/dist/components/form/MrlSelectMenu/index.d.ts +47 -0
- package/dist/components/form/constants.d.ts +77 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/utils.d.ts +81 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/text/MrlText/MrlText.d.ts +38 -0
- package/dist/components/text/MrlText/index.d.ts +1 -0
- package/dist/components/text/MrlTextHeading/MrlTextHeading.d.ts +31 -0
- package/dist/components/text/MrlTextHeading/index.d.ts +1 -0
- package/dist/components/text/constants.d.ts +44 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/styles/MrlSelect/module.scss +108 -0
- package/dist/styles/MrlSelectItem/module.scss +57 -0
- package/dist/styles/MrlSelectMenu/module.scss +44 -0
- package/dist/styles/MrlText/module.scss +14 -0
- package/dist/styles/MrlText/variables.scss +39 -0
- package/dist/styles/MrlTextHeading/module.scss +35 -0
- package/dist/styles/MrlTextHeading/variables.scss +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type Action = {
|
|
3
|
+
type: 'open';
|
|
4
|
+
} | {
|
|
5
|
+
type: 'close';
|
|
6
|
+
} | {
|
|
7
|
+
type: 'focus';
|
|
8
|
+
payload: number;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'default';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'disabled';
|
|
13
|
+
} | {
|
|
14
|
+
type: 'select';
|
|
15
|
+
payload: string;
|
|
16
|
+
};
|
|
17
|
+
type Dispatch = (action: Action) => void;
|
|
18
|
+
type State = {
|
|
19
|
+
open: boolean;
|
|
20
|
+
focus: boolean;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
focusIndex?: number;
|
|
23
|
+
selectedId?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
};
|
|
26
|
+
type SelectProviderProps = {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
hookChange?: (newValue?: string) => void | undefined;
|
|
29
|
+
id?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Select provider
|
|
33
|
+
*
|
|
34
|
+
* @param {SelectProviderProps} props SelectProvider props
|
|
35
|
+
* @returns {React.ReactElement} returns a booted select provider.
|
|
36
|
+
*/
|
|
37
|
+
declare function SelectProvider({ children, hookChange, id }: SelectProviderProps): React.ReactElement;
|
|
38
|
+
/**
|
|
39
|
+
* useSelect hook
|
|
40
|
+
*
|
|
41
|
+
* @returns returns hook for the select provider.
|
|
42
|
+
*/
|
|
43
|
+
declare function useSelect(): {
|
|
44
|
+
state: State;
|
|
45
|
+
dispatch: Dispatch;
|
|
46
|
+
};
|
|
47
|
+
export { SelectProvider, useSelect };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MrlSelectProptypes } from './select';
|
|
3
|
+
/**
|
|
4
|
+
* Creates and exports component class for Mural Select
|
|
5
|
+
*
|
|
6
|
+
* @param {MrlSelectProptypes} props MrlSelectProptypes
|
|
7
|
+
* @returns {React.ReactElement} returns a MrlSelect wrapped in a select provider.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MrlSelect: ({ hookChange, id, children, ...rest }: MrlSelectProptypes) => React.ReactElement;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SelectStates, InputKinds, InputSizes } from '../constants';
|
|
3
|
+
import { AttrsObject } from '../../../utils';
|
|
4
|
+
export interface MrlSelectProptypes extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Additional function to be run when the value of the select changes */
|
|
6
|
+
hookChange?: (newValue?: string) => void | undefined;
|
|
7
|
+
/** State of the select element based on user actions or permissions */
|
|
8
|
+
state?: SelectStates;
|
|
9
|
+
/** Current value of the select input */
|
|
10
|
+
value?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Because this is a custom element, we can't use a standard "for" attribute setup. The label
|
|
13
|
+
* element needs to have an id and then we reference via the select with aria
|
|
14
|
+
*/
|
|
15
|
+
labelId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Changes the visual style of the select trigger; Use 'inline when your select is inline
|
|
18
|
+
* with other content
|
|
19
|
+
*/
|
|
20
|
+
kind?: InputKinds;
|
|
21
|
+
/**
|
|
22
|
+
* Changes the visual size of the select trigger; Currently only supported when kind="inline"
|
|
23
|
+
*/
|
|
24
|
+
size?: InputSizes;
|
|
25
|
+
/**
|
|
26
|
+
* Applies additional HTML attributes to the `mrl-select` element after the
|
|
27
|
+
* hydration process. It is recommended only to use when overwriting an attribute
|
|
28
|
+
* assigned internally by the design system.
|
|
29
|
+
* When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.
|
|
30
|
+
* Otherwise, the value object needs to be stringified to not receive `"[Object object]"`.
|
|
31
|
+
* Example: `attrs='{ "tabindex": "1" }'`
|
|
32
|
+
*/
|
|
33
|
+
attrs?: AttrsObject | string;
|
|
34
|
+
/**
|
|
35
|
+
* menu - list of options for the user to chose from; expects an `MrlSelectMenu` component
|
|
36
|
+
*/
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* optional id - we will generate a unique one if it isn't given.
|
|
40
|
+
* ID will be decorated with `${id}-mrl-select` to not conflict with aria controls.
|
|
41
|
+
*/
|
|
42
|
+
id?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates and exports component class for Mural Select
|
|
46
|
+
*
|
|
47
|
+
* @param {MrlSelectProptypes} props the props for your MrlLink
|
|
48
|
+
* @returns {React.ReactElement} an a element containing the text you pass
|
|
49
|
+
*/
|
|
50
|
+
export declare const MrlSelect: ({ attrs, children, kind, labelId, size, state, value, id, ...theRest }: MrlSelectProptypes) => React.ReactElement;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
export interface MrlSelectItemProptypes extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* value of the select item that is stored as the selected value of the select input
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* index of the select item starting at 0
|
|
10
|
+
*/
|
|
11
|
+
index: number;
|
|
12
|
+
/**
|
|
13
|
+
* Applies additional HTML attributes to the `mrl-select-item` element after the
|
|
14
|
+
* hydration process. It is recommended only to use when overwriting an attribute
|
|
15
|
+
* assigned internally by the design system.
|
|
16
|
+
* When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.
|
|
17
|
+
* Otherwise, the value object needs to be stringified to not receive `"[Object object]"`.
|
|
18
|
+
* Example: `attrs='{ "aria-disabled": "true" }'`
|
|
19
|
+
*/
|
|
20
|
+
attrs?: AttrsObject;
|
|
21
|
+
/**
|
|
22
|
+
* content for the item
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Renders a select component
|
|
28
|
+
*
|
|
29
|
+
* @param {MrlSelectItemProptypes} props the props for your MrlLink
|
|
30
|
+
* @returns {React.ReactElement} an a element containing the text you pass
|
|
31
|
+
*/
|
|
32
|
+
export declare const MrlSelectItem: ({ attrs, children, index, value, ...theRest }: MrlSelectItemProptypes) => React.ReactElement;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SelectMenuPositions } from '../constants';
|
|
3
|
+
import { AttrsObject } from '../../../utils';
|
|
4
|
+
export interface MrlSelectMenuProptypes extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The placement of the menu in relation to its trigger */
|
|
6
|
+
position?: SelectMenuPositions;
|
|
7
|
+
/** Current value of the select input */
|
|
8
|
+
value?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Allows the select component to pass through which item should be focused;
|
|
11
|
+
* Set it to the index of the focused item
|
|
12
|
+
*/
|
|
13
|
+
focused?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Allows the select component to pass through which item should be selected
|
|
16
|
+
* Set it to the id of the selected item
|
|
17
|
+
*/
|
|
18
|
+
selected?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Applies additional HTML attributes to the `mrl-select-menu` elements
|
|
21
|
+
* It is recommended only to use when overwriting an attribute
|
|
22
|
+
* assigned internally by the design system.
|
|
23
|
+
* When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.
|
|
24
|
+
* Otherwise, the value object needs to be stringified to not receive `"[Object object]"`.
|
|
25
|
+
* Example: `attrs='{ "tabindex": "0" }'`
|
|
26
|
+
*/
|
|
27
|
+
attrs?: AttrsObject | string;
|
|
28
|
+
/**
|
|
29
|
+
* menu - list of options for the user to chose from; expects an `MrlSelectMenu` component
|
|
30
|
+
*/
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* label element needs to have an id and then we reference via the select with aria
|
|
34
|
+
*/
|
|
35
|
+
labelId: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creating and exporting component class for Mural Select Menu
|
|
39
|
+
* Note, this component doesn't doesn't handle any functionality
|
|
40
|
+
* For accessibility and keyboard support, all functionality is
|
|
41
|
+
* controlled by the wrapping mrl-select but we need this component
|
|
42
|
+
* within our HTML structure for valid aria usage.
|
|
43
|
+
*
|
|
44
|
+
* @param {MrlSelectMenuProptypes} props MrlSelectMenuProptypes
|
|
45
|
+
* @returns {React.ReactElement} returns a MrlSelectMenu
|
|
46
|
+
*/
|
|
47
|
+
export declare const MrlSelectMenu: ({ attrs, children, selected, labelId, position, ...theRest }: MrlSelectMenuProptypes) => React.ReactElement;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type InputStates = 'disabled' | 'error';
|
|
2
|
+
export type InputKinds = 'default' | 'inline';
|
|
3
|
+
export type InputSizes = 'default' | 'large';
|
|
4
|
+
export declare const allowedCheckboxValues: {
|
|
5
|
+
selected: readonly ["default", "checked", "indeterminate"];
|
|
6
|
+
states: readonly ["default", "disabled", "error"];
|
|
7
|
+
};
|
|
8
|
+
export type CheckboxStates = (typeof allowedCheckboxValues.states)[number];
|
|
9
|
+
export type CheckboxSelected = (typeof allowedCheckboxValues.selected)[number];
|
|
10
|
+
interface CheckboxDefaults {
|
|
11
|
+
selected: CheckboxSelected;
|
|
12
|
+
state: CheckboxStates;
|
|
13
|
+
}
|
|
14
|
+
export declare const checkboxDefaults: CheckboxDefaults;
|
|
15
|
+
export declare const allowedSelectItemValues: {
|
|
16
|
+
states: readonly ["default", "disabled", "selected"];
|
|
17
|
+
};
|
|
18
|
+
export type SelectItemStates = (typeof allowedSelectItemValues.states)[number];
|
|
19
|
+
interface SelectItemDefaults {
|
|
20
|
+
state: SelectItemStates;
|
|
21
|
+
}
|
|
22
|
+
export declare const selectItemDefaults: SelectItemDefaults;
|
|
23
|
+
export declare const allowedSelectMenuValues: {
|
|
24
|
+
positions: readonly ["bottom", "top"];
|
|
25
|
+
};
|
|
26
|
+
export type SelectMenuPositions = (typeof allowedSelectMenuValues.positions)[number];
|
|
27
|
+
interface SelectMenuDefaults {
|
|
28
|
+
position: SelectMenuPositions;
|
|
29
|
+
}
|
|
30
|
+
export declare const selectMenuDefaults: SelectMenuDefaults;
|
|
31
|
+
export declare const allowedSelectValues: {
|
|
32
|
+
states: readonly ["default", "disabled", "open"];
|
|
33
|
+
};
|
|
34
|
+
export type SelectStates = (typeof allowedSelectValues.states)[number];
|
|
35
|
+
interface SelectDefaults {
|
|
36
|
+
size: InputSizes;
|
|
37
|
+
kind: InputKinds;
|
|
38
|
+
state: SelectStates;
|
|
39
|
+
}
|
|
40
|
+
export declare const selectDefaults: SelectDefaults;
|
|
41
|
+
export interface StaticIconConfig {
|
|
42
|
+
icon: Record<string, unknown>;
|
|
43
|
+
theme?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface RightActionConfig extends StaticIconConfig {
|
|
46
|
+
action: (event: MouseEvent) => void;
|
|
47
|
+
label: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const allowedLabelValues: {
|
|
50
|
+
kinds: readonly ["block", "inline"];
|
|
51
|
+
states: readonly ["default", "disabled"];
|
|
52
|
+
};
|
|
53
|
+
export type LabelStates = (typeof allowedLabelValues.states)[number];
|
|
54
|
+
export type LabelKind = (typeof allowedLabelValues.kinds)[number];
|
|
55
|
+
interface LabelDefaults {
|
|
56
|
+
kind: LabelKind;
|
|
57
|
+
state: LabelStates;
|
|
58
|
+
}
|
|
59
|
+
export declare const labelDefaults: LabelDefaults;
|
|
60
|
+
export interface FormControlDefaults {
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
label: string;
|
|
63
|
+
}
|
|
64
|
+
export interface FieldsetDefault {
|
|
65
|
+
label: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Default values for props on the Fieldset component;
|
|
69
|
+
* Shared between the component and Storybook
|
|
70
|
+
*/
|
|
71
|
+
export declare const fieldsetDefault: FieldsetDefault;
|
|
72
|
+
/**
|
|
73
|
+
* Default values for props on the Fieldset component which is used to group Textarea components;
|
|
74
|
+
* Shared between the component and Storybook
|
|
75
|
+
*/
|
|
76
|
+
export declare const textareaDefaults: FormControlDefaults;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines all of the possible actions a user can take with their keyboard in a select.
|
|
3
|
+
* This is used to create a more human-friendly connection between the actions and
|
|
4
|
+
* keyboard short cuts since multiple keys may perform the same action.
|
|
5
|
+
* See getActionFromKey for more details.
|
|
6
|
+
*
|
|
7
|
+
* @todo - need to verify what the pageDown/Up keys do differently. They have a
|
|
8
|
+
* different action in the getUpdatedIndex function but need to understand
|
|
9
|
+
* a bit more. This is not merge blocking for MVP
|
|
10
|
+
*/
|
|
11
|
+
export declare const actions: {
|
|
12
|
+
Close: number;
|
|
13
|
+
CloseSelect: number;
|
|
14
|
+
First: number;
|
|
15
|
+
Last: number;
|
|
16
|
+
Next: number;
|
|
17
|
+
Open: number;
|
|
18
|
+
PageDown: number;
|
|
19
|
+
PageUp: number;
|
|
20
|
+
Previous: number;
|
|
21
|
+
Type: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Map a key press to an action (see the )
|
|
25
|
+
*
|
|
26
|
+
* @param {React.KeyboardEvent} event - keyboard event
|
|
27
|
+
* @param {boolean} isMenuOpen - dropdown menu state
|
|
28
|
+
* @param {string | undefined} search - current searchstring to determine how to handle space presses
|
|
29
|
+
* @returns {number | undefined} - returns action number or quits from function execution
|
|
30
|
+
*/
|
|
31
|
+
export declare const getActionFromKey: (event: React.KeyboardEvent, isMenuOpen: boolean, search?: string | undefined) => number | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get an updated item index based on the action
|
|
34
|
+
*
|
|
35
|
+
* @param {number} currentIndex - index of the active menu item
|
|
36
|
+
* @param {number} maxIndex - last menu item's index
|
|
37
|
+
* @param {action} action - keyboard key action
|
|
38
|
+
* @returns {number} - returns updated index
|
|
39
|
+
*/
|
|
40
|
+
export declare const getUpdatedIndex: (currentIndex: number, maxIndex: number | undefined, action: number) => number;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the select menu items has scrollable overflow
|
|
43
|
+
*
|
|
44
|
+
* @param {HTMLElement} menu - select menu component
|
|
45
|
+
* @returns {boolean} - true if the menu has overflow content
|
|
46
|
+
*/
|
|
47
|
+
export declare const isScrollable: (menu: HTMLElement) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Ensures a given child element is within the parents's visible scroll area.
|
|
50
|
+
* If the child is not visible, it scrolls the parent element.
|
|
51
|
+
*
|
|
52
|
+
* @param {HTMLElement} childEl - clicked/focused select item
|
|
53
|
+
* @param {HTMLElement} scrollParent - select menu component
|
|
54
|
+
* @todo - POST MVP - this could be a more reusable util function for other components
|
|
55
|
+
* @todo - POST MVP - the marginY should be more dynamic
|
|
56
|
+
*/
|
|
57
|
+
export declare const maintainScrollVisibility: (childEl: HTMLElement, scrollParent: HTMLElement) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the index of an option from an array of options, based on a search string
|
|
60
|
+
* if the filter is multiple iterations of the same letter (e.g "aaa"), then cycle through first-letter matches
|
|
61
|
+
*
|
|
62
|
+
* @param {Element[]} options - menu items list
|
|
63
|
+
* @param {string} filter - pressed letters combination
|
|
64
|
+
* @param {number} startIndex - start index
|
|
65
|
+
* @returns {number} - menu item's index
|
|
66
|
+
*/
|
|
67
|
+
export declare const getIndexByLetter: (options: Element[], filter: string, startIndex?: number) => number;
|
|
68
|
+
type DebounceType = number | null | undefined;
|
|
69
|
+
type CallbackType = (_debounce: number) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Waits a predetermined time before calling a function
|
|
72
|
+
*
|
|
73
|
+
* @param {Function} func - function to call after timeout
|
|
74
|
+
* @param {number} timeout - time to wait before calling function
|
|
75
|
+
* @param {number} debounce - existing debounce to clear
|
|
76
|
+
* @param {Function} callback - callback function to update debounce
|
|
77
|
+
* @returns {Function} - function to reset debounce and call callback
|
|
78
|
+
* @todo - 4969 investigate combining this debounce function with the modal debounce function
|
|
79
|
+
*/
|
|
80
|
+
export declare const debounce: (func: () => void, timeout: number | undefined, debounce: DebounceType, callback: CallbackType) => (() => void);
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
import { TextHierarchies, TextKinds, TextSizes } from '../constants';
|
|
4
|
+
interface CommonProps {
|
|
5
|
+
/** Applies additional HTML attributes to the text element */
|
|
6
|
+
attrs?: AttrsObject;
|
|
7
|
+
/** Children to be rendered within the text component */
|
|
8
|
+
children?: React.ReactNode | string;
|
|
9
|
+
/** Hierarchy level within the use case and sizing scales */
|
|
10
|
+
hierarchy?: TextHierarchies;
|
|
11
|
+
/** Textual content when it's a static string; if you have nested elements, use children to provide content */
|
|
12
|
+
text?: string;
|
|
13
|
+
}
|
|
14
|
+
interface DefaultKindWithSize extends CommonProps {
|
|
15
|
+
/**
|
|
16
|
+
* Visual kind of the text
|
|
17
|
+
* If the value is default it allows to change the "size" prop
|
|
18
|
+
*/
|
|
19
|
+
kind: 'default';
|
|
20
|
+
/** Visual size of the text, only applies if kind="default" */
|
|
21
|
+
size: TextSizes;
|
|
22
|
+
}
|
|
23
|
+
interface KindWithoutSize extends CommonProps {
|
|
24
|
+
/**
|
|
25
|
+
* Visual kind of the text
|
|
26
|
+
* If the value is default it allows to change the "size" prop
|
|
27
|
+
*/
|
|
28
|
+
kind: Exclude<TextKinds, 'default'>;
|
|
29
|
+
}
|
|
30
|
+
type MrlTextProps = DefaultKindWithSize | KindWithoutSize;
|
|
31
|
+
/**
|
|
32
|
+
* MrlText Component
|
|
33
|
+
*
|
|
34
|
+
* @param {MrlTextProps} props - MrlText component props
|
|
35
|
+
* @returns a paragraph element
|
|
36
|
+
*/
|
|
37
|
+
export declare function MrlText(props: MrlTextProps): JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MrlText';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttrsObject } from '../../../utils';
|
|
3
|
+
import { LevelType, HeadingSizes, TextSizes, TextHierarchies, HeadingKinds } from '../constants';
|
|
4
|
+
interface MrlTextHeadingProps {
|
|
5
|
+
/** Applies additional HTML attributes to the text element */
|
|
6
|
+
attrs?: AttrsObject;
|
|
7
|
+
/** Children to be rendered within the text heading component */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Set the semantic level of the heading based on its usage in the page hierarchy */
|
|
10
|
+
level?: LevelType;
|
|
11
|
+
/** Visual styling use case for the heading */
|
|
12
|
+
kind?: HeadingKinds;
|
|
13
|
+
/**
|
|
14
|
+
* Visual size of the heading
|
|
15
|
+
* xsmall and xxsmall are only supported when kind="title"
|
|
16
|
+
*/
|
|
17
|
+
size?: HeadingSizes | TextSizes;
|
|
18
|
+
/** Clear and concise description of the content that the heading describes */
|
|
19
|
+
text?: string;
|
|
20
|
+
/** Hierarchy level within the use case and sizing scales */
|
|
21
|
+
hierarchy?: TextHierarchies;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* MuralTextHeading component
|
|
25
|
+
* Used for creating semantic headings within a page
|
|
26
|
+
*
|
|
27
|
+
* @param {MrlTextHeadingProps} props - MrlTextHeading component props
|
|
28
|
+
* @returns a heading element
|
|
29
|
+
*/
|
|
30
|
+
export declare function MrlTextHeading({ attrs, children, hierarchy, kind, level, size, text }: MrlTextHeadingProps): JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MrlTextHeading';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AttrsObject } from '../../utils';
|
|
2
|
+
export type TextSizes = 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large';
|
|
3
|
+
export type TextHierarchies = 'primary' | 'secondary';
|
|
4
|
+
export type TextKinds = 'default' | 'body' | 'meta' | 'supporting';
|
|
5
|
+
export interface TextDefaults {
|
|
6
|
+
attrs: AttrsObject;
|
|
7
|
+
hierarchy: TextHierarchies;
|
|
8
|
+
size: TextSizes;
|
|
9
|
+
kind: TextKinds;
|
|
10
|
+
}
|
|
11
|
+
export declare const textAllowedValues: {
|
|
12
|
+
hierarchy: string[];
|
|
13
|
+
kind: string[];
|
|
14
|
+
sizes: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Default values for props on the Text component;
|
|
18
|
+
* Shared between the component and Storybook
|
|
19
|
+
*/
|
|
20
|
+
export declare const textDefaults: TextDefaults;
|
|
21
|
+
export type LevelType = '1' | '2' | '3' | '4' | '5' | '6';
|
|
22
|
+
export type HeadingKinds = 'poster' | 'display' | 'headline' | 'title';
|
|
23
|
+
export type HeadingSizes = 'small' | 'medium' | 'large';
|
|
24
|
+
export interface HeadingDefaults {
|
|
25
|
+
attrs: AttrsObject;
|
|
26
|
+
hierarchy: TextHierarchies;
|
|
27
|
+
kind: HeadingKinds;
|
|
28
|
+
level: LevelType;
|
|
29
|
+
size: HeadingSizes | TextSizes;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Defines all of classes allowed for the type attribute;
|
|
33
|
+
* used for Storybook and testing
|
|
34
|
+
*/
|
|
35
|
+
export declare const headingAllowedValues: {
|
|
36
|
+
kinds: string[];
|
|
37
|
+
level: string[];
|
|
38
|
+
sizes: string[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Default values for props on the Text component;
|
|
42
|
+
* Shared between the component and Storybook
|
|
43
|
+
*/
|
|
44
|
+
export declare const headingDefaults: HeadingDefaults;
|