@muraldevkit/ui-toolkit 2.4.2 → 2.5.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/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
  Shared React components for use across the Mural platform.
3
3
 
4
4
  - [Component standards](./docs/component-standards.md)
5
- - [Contribution Guide](./CONTRIBUTING.md)
5
+ - [Contribution Guide](./CONTRIBUTING.md)
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { StaticIconConfig } from '../../constants';
3
+ interface MrlRadioButtonProps extends React.ComponentPropsWithoutRef<'input'> {
4
+ /** Additional class to add to the container element */
5
+ className?: string;
6
+ /** Adjusts the styles of the label, icon and description when the label is multiline */
7
+ hasMultilineLabel?: boolean;
8
+ /** The text to display as the radio button's label */
9
+ label: string;
10
+ /** The radio button's name that will group it with others in a radio group */
11
+ name: string;
12
+ /** The radio button's value */
13
+ value: string;
14
+ /** Indicates if the radio button is disabled */
15
+ disabled?: boolean;
16
+ /** Indicates if the radio button has an error */
17
+ hasError?: boolean;
18
+ /** Leading label icon */
19
+ icon?: StaticIconConfig;
20
+ /** Styles applied to the container element */
21
+ style?: React.CSSProperties;
22
+ /**
23
+ * Description, additional context text for the user.
24
+ * It can be a string or a React component for custom render.
25
+ * When using a React component it's necessary to add an id to the custom element and
26
+ * pass it to the MrlRadioButton through "aria-describedby" to make it accessible
27
+ * to screen readers.
28
+ * Custom description should also implement the disabled state styles
29
+ * for text when the input is disabled or set color: inherit.
30
+ *
31
+ * @example
32
+ * <MrlRadioButton aria-describedby={customId} description={
33
+ * <p id={customId}>description</p>
34
+ * }>
35
+ */
36
+ description?: string | React.ReactNode;
37
+ }
38
+ /**
39
+ * Form element with an associated text label and description that allows the user to select one
40
+ * option from a provided list
41
+ *
42
+ * @param {MrlRadioButtonProps} props - the component props
43
+ * @returns an input with type "radio" with an associated label
44
+ */
45
+ export declare function MrlRadioButton({ className, description, hasMultilineLabel, name, value, icon, disabled, hasError, label, style, ...rest }: MrlRadioButtonProps): JSX.Element;
46
+ export {};
@@ -0,0 +1 @@
1
+ export * from './MrlRadioButton';
@@ -79,4 +79,16 @@ type CallbackType = (_debounce: number) => void;
79
79
  * @todo - 4969 investigate combining this debounce function with the modal debounce function
80
80
  */
81
81
  export declare const debounce: (func: () => void, timeout: number | undefined, debounce: DebounceType, callback: CallbackType) => (() => void);
82
+ type GetAriaDescribedByReturn = {
83
+ ['aria-describedby']?: string;
84
+ } | {
85
+ ['aria-describedby']: string;
86
+ };
87
+ /**
88
+ * Generates the 'aria-describedby' attribute from multiple ids
89
+ *
90
+ * @param {Array<string | undefined>} args ids
91
+ * @returns {GetAriaDescribedByReturn} an object with aria-describedby
92
+ */
93
+ export declare function getDescribedby(...args: Array<string | undefined>): GetAriaDescribedByReturn;
82
94
  export {};
@@ -0,0 +1,8 @@
1
+
2
+ .MrlRadioButton {
3
+ align-items: center;
4
+ display: flex;
5
+ :first-child {
6
+ align-self: flex-start;
7
+ }
8
+ }
@@ -5,11 +5,11 @@
5
5
  @use './MrlRadioButtonStandalone.variables.scss';
6
6
  .MrlRadioButtonStandalone {
7
7
  display: inline-block;
8
- height: var(--mrl-radio-button-height);
9
8
  margin: calc(var(--mrl-spacing-02) + var(--mrl-spacing-01));
10
9
  margin-left: var(--mrl-spacing-01);
10
+ min-height: var(--mrl-radio-button-height);
11
+ min-width: var(--mrl-radio-button-width);
11
12
  position: relative;
12
- width: var(--mrl-radio-button-width);
13
13
  }
14
14
  .MrlRadioButtonStandalone-input {
15
15
  appearance: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muraldevkit/ui-toolkit",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "Mural's UI Toolkit",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -100,6 +100,7 @@
100
100
  "lint-staged": "13.2.2",
101
101
  "null-loader": "4.0.1",
102
102
  "prettier": "2.8.8",
103
+ "react-markdown": "8.0.7",
103
104
  "rimraf": "5.0.0",
104
105
  "sass": "1.62.1",
105
106
  "sass-loader": "13.2.2",