@muraldevkit/ui-toolkit 1.6.3 → 1.7.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.
@@ -3,6 +3,10 @@ import { MrlButtonKind, MrlButtonSize, MrlButtonState, ToggleAria, ToggleStyle,
3
3
  import { AttrsObject } from '../../../utils';
4
4
  import './MrlButton.global.scss';
5
5
  interface MrlButtonProps {
6
+ /**
7
+ * Applies additional HTML attributes to the button element.
8
+ */
9
+ attrs?: AttrsObject;
6
10
  /**
7
11
  * Allow developers to add badge to buttons.
8
12
  */
@@ -12,26 +16,31 @@ interface MrlButtonProps {
12
16
  * Allow developers to change the disabled state based on user interactions.
13
17
  */
14
18
  disabled?: boolean;
19
+ /**
20
+ * Allows developers the ability to disable built in event listeners so they can manage user
21
+ * interactions from the application.
22
+ */
23
+ disableEvents?: boolean;
15
24
  /**
16
25
  * Allow developers to add icon to buttons.
17
26
  */
18
27
  icon?: React.ReactElement;
19
28
  /**
20
- * onClick event for the button.
29
+ * Allows developers to right-align an icon within a button.
21
30
  */
22
- onClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;
31
+ iconPos?: IconPosition;
23
32
  /**
24
33
  * Changes the visual emphasis of the button.
25
34
  */
26
35
  kind?: MrlButtonKind;
27
36
  /**
28
- * Changes the size of the button so it can scale with its surrounding context.
37
+ * onClick event for the button.
29
38
  */
30
- size?: MrlButtonSize;
39
+ onClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;
31
40
  /**
32
- * The textual label describing the button's purpose/action.
41
+ * Changes the size of the button so it can scale with its surrounding context.
33
42
  */
34
- text: string;
43
+ size?: MrlButtonSize;
35
44
  /**
36
45
  * Changes the state of the button based on user permissions or actions.
37
46
  *
@@ -41,12 +50,10 @@ interface MrlButtonProps {
41
50
  */
42
51
  state: MrlButtonState;
43
52
  /**
44
- * Selected state variant when the button is a Toggle Button. The visual styles
45
- * are also impacted by the "kind" prop. Toggle buttons are only supported
46
- * when "kind" is set to either "ghost" or "ghost-inverse". Setting this prop
47
- * informs the component that this is a toggle button and to add that functionality
53
+ * The textual label describing the button's purpose/action.
54
+ * Icon buttons require a text label to ensure accessibility.
48
55
  */
49
- toggleStyle?: ToggleStyle;
56
+ text: string;
50
57
  /**
51
58
  * Determines which aria setup to use for various toggle/selected styles.
52
59
  * pressed - use for an traditional “toggle button”
@@ -57,22 +64,12 @@ interface MrlButtonProps {
57
64
  */
58
65
  toggleAria?: ToggleAria;
59
66
  /**
60
- * Allows developers to right-align an icon within a button.
61
- */
62
- iconPos?: IconPosition;
63
- /**
64
- * Applies additional HTML attributes to the nested `button` element during the
65
- * hydration process.
66
- * When using in a framework wrapper (e.g., React), treat it as an object and don't stringify.
67
- * Otherwise, the value object needs to be stringified to not receive `"[Object object]"`.
68
- * Example: `attrs='{ "type": "reset" }'`
69
- */
70
- attrs?: AttrsObject | string;
71
- /**
72
- * Allows developers the ability to disable built in event listeners so they can manage user
73
- * interactions from the application.
67
+ * Selected state variant when the button is a Toggle Button. The visual styles
68
+ * are also impacted by the "kind" prop. Toggle buttons are only supported
69
+ * when "kind" is set to either "ghost" or "ghost-inverse". Setting this prop
70
+ * informs the component that this is a toggle button and to add that functionality
74
71
  */
75
- disableEvents?: boolean;
72
+ toggleStyle?: ToggleStyle;
76
73
  }
77
74
  export declare const MrlButton: React.ForwardRefExoticComponent<MrlButtonProps & React.RefAttributes<HTMLButtonElement>>;
78
75
  export {};
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import { MrlButtonKind, MrlButtonSize, MrlButtonState, MrlGhostIconButtonSize, ToggleAria, ToggleStyle } from '../constants';
3
+ import { AttrsObject } from '../../../utils';
4
+ import { MrlTooltipAnchor, MrlTooltipPosition } from '../../tooltip/constants';
5
+ import './MrlIconButton.scss';
6
+ interface MrlIconButtonProps {
7
+ /**
8
+ * Applies additional HTML attributes to the button element.
9
+ */
10
+ attrs?: AttrsObject;
11
+ /**
12
+ * Allow developers to add badge to buttons.
13
+ */
14
+ badge?: React.ReactElement;
15
+ /**
16
+ * Allows developers the ability to disable built in event listeners so they can manage user
17
+ * interactions from the application.
18
+ */
19
+ disableEvents?: boolean;
20
+ /**
21
+ * The icon that will be rendered.
22
+ */
23
+ icon: React.ReactElement;
24
+ /**
25
+ * Changes the visual emphasis of the button.
26
+ */
27
+ kind?: MrlButtonKind;
28
+ /**
29
+ * onClick event for the button.
30
+ */
31
+ onClick: (e: React.SyntheticEvent<HTMLButtonElement>) => void;
32
+ /**
33
+ * The placement of the tooltip in relation to the button.
34
+ */
35
+ position?: MrlTooltipPosition;
36
+ /**
37
+ * Changes the size of the button so it can scale with its surrounding context.
38
+ */
39
+ size?: MrlButtonSize | MrlGhostIconButtonSize;
40
+ /**
41
+ * Changes the state of the button based on user permissions or actions.
42
+ *
43
+ * Note: The Basic Button does not fully support state="disabled", use
44
+ * the 'disabled' prop instead. Since it does not support state="disabled",
45
+ * it also doesn't not support state="selected-disabled".
46
+ */
47
+ state: MrlButtonState;
48
+ /**
49
+ * The textual label describing the button's purpose/action.
50
+ * Icon buttons require a text label to ensure accessibility.
51
+ */
52
+ text: string;
53
+ /**
54
+ * The arrow position of the tooltip in relation to the button.
55
+ */
56
+ tipAnchor?: MrlTooltipAnchor;
57
+ /**
58
+ * Determines which aria setup to use for various toggle/selected styles.
59
+ * pressed - use for an traditional “toggle button”
60
+ * selected - use for tabs and custom select options
61
+ * expanded - use for menus, panels, and popovers
62
+ * checked - use for custom [radiobutton](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/#wai-aria-roles-states-and-properties-16)
63
+ * or [checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/#wai-aria-roles-states-and-properties-5) inputs
64
+ */
65
+ toggleAria?: ToggleAria;
66
+ /**
67
+ * Selected state variant when the button is a Toggle Button. The visual styles
68
+ * are also impacted by the "kind" prop. Toggle buttons are only supported
69
+ * when "kind" is set to either "ghost" or "ghost-inverse". Setting this prop
70
+ * informs the component that this is a toggle button and to add that functionality
71
+ */
72
+ toggleStyle?: ToggleStyle;
73
+ }
74
+ export declare const MrlIconButton: React.ForwardRefExoticComponent<MrlIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
75
+ export {};
@@ -0,0 +1 @@
1
+ export { MrlIconButton } from "./MrlIconButton";
@@ -1,4 +1,4 @@
1
- import { MrlButtonState } from '../constants';
1
+ import { MrlButtonState } from './constants';
2
2
  /**
3
3
  * Determines if the button is disabled since multiple states represent disabled
4
4
  *
@@ -1 +1,2 @@
1
1
  export * from "./MrlButton";
2
+ export * from "./MrlIconButton";
@@ -1,9 +1,4 @@
1
1
  import { AttrsObject } from '../../utils';
2
- /**
3
- * Important Note:
4
- * If you update this file, you need to update the constants file in "component-button"
5
- * because the Icon button uses the tooltip component. This is known tech debt.
6
- */
7
2
  /**
8
3
  * Defines all the values allowed for tooltip props.
9
4
  * Used for Storybook and testing