carbon-react 109.1.1 → 109.1.2

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.
@@ -10,7 +10,7 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
10
10
  /** Icon type */
11
11
  helpIcon?: IconType;
12
12
  /** Overrides the default tabindex of the Help component */
13
- helpTabIndex?: string;
13
+ helpTabIndex?: number | string;
14
14
  /** A string that represents the ID of another form element */
15
15
  htmlFor?: string;
16
16
  /** The unique id of the label element */
@@ -98,7 +98,7 @@ const Label = ({
98
98
 
99
99
  return help && /*#__PURE__*/React.createElement(StyledIconWrapper, wrapperProps, /*#__PURE__*/React.createElement(Help, {
100
100
  tooltipId: tooltipId,
101
- tabIndex: helpTabIndex,
101
+ tabIndex: Number(helpTabIndex),
102
102
  type: helpIcon,
103
103
  isFocused: isFocused
104
104
  }, help));
@@ -129,7 +129,7 @@ Label.propTypes = {
129
129
  "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
130
130
  "help": PropTypes.node,
131
131
  "helpIcon": PropTypes.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
132
- "helpTabIndex": PropTypes.string,
132
+ "helpTabIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
133
133
  "htmlFor": PropTypes.string,
134
134
  "info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
135
135
  "inline": PropTypes.bool,
@@ -14,7 +14,6 @@ export const CheckboxGroupContext = /*#__PURE__*/React.createContext({});
14
14
  const CheckboxGroup = props => {
15
15
  const {
16
16
  children,
17
- groupName,
18
17
  legend,
19
18
  error,
20
19
  warning,
@@ -45,7 +44,6 @@ const CheckboxGroup = props => {
45
44
  legendInline: legendInline
46
45
  }, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
47
46
  value: {
48
- inputName: groupName,
49
47
  error: !!error,
50
48
  warning: !!warning,
51
49
  info: !!info
@@ -75,9 +73,6 @@ CheckboxGroup.propTypes = {
75
73
  /** The Checkboxes to be rendered in the group */
76
74
  children: PropTypes.node.isRequired,
77
75
 
78
- /** Specifies the name prop to be applied to each button in the group */
79
- groupName: PropTypes.string.isRequired,
80
-
81
76
  /** Indicate that error has occurred
82
77
  Pass string to display icon, tooltip and red border
83
78
  Pass true boolean to only display red border */
@@ -15,8 +15,6 @@ interface CheckboxGroupProps extends ValidationProps, MarginProps {
15
15
  legendSpacing?: 1 | 2;
16
16
  /** The Checkboxes to be rendered in the group */
17
17
  children: React.ReactNode;
18
- /** Specifies the name prop to be applied to each button in the group */
19
- groupName: string;
20
18
  /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
21
19
  labelSpacing?: 1 | 2;
22
20
  /** Flag to configure component as mandatory */
@@ -51,8 +51,7 @@ const Checkbox = ({
51
51
  const {
52
52
  error: contextError,
53
53
  warning: contextWarning,
54
- info: contextInfo,
55
- inputName
54
+ info: contextInfo
56
55
  } = useContext(CheckboxGroupContext);
57
56
  const inputProps = {
58
57
  onClick,
@@ -80,7 +79,6 @@ const Checkbox = ({
80
79
  inputWidth,
81
80
  labelWidth,
82
81
  tooltipPosition,
83
- inputName,
84
82
  ...props
85
83
  };
86
84
  return /*#__PURE__*/React.createElement(TooltipProvider, {
@@ -33,7 +33,8 @@ const Sort = ({
33
33
  sortType: sortType,
34
34
  "aria-labelledby": id.current
35
35
  }, children, sortType && /*#__PURE__*/React.createElement(Icon, {
36
- type: sortType === "ascending" ? "sort_up" : "sort_down"
36
+ type: sortType === "ascending" ? "sort_up" : "sort_down",
37
+ color: "--colorsUtilityMajor200"
37
38
  })), !sortType && /*#__PURE__*/React.createElement(StyledSpaceHolder, null));
38
39
  };
39
40
 
@@ -12,7 +12,6 @@ const StyledSort = styled.div`
12
12
  width: 16px;
13
13
  height: 16px;
14
14
  padding-left: 6px;
15
- color: var(--colorsUtilityMajor200);
16
15
  }
17
16
 
18
17
  :hover {
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { IconType } from "../icon";
4
+ import { TooltipPositions } from "../tooltip/tooltip.config";
5
+ export interface HelpProps extends MarginProps {
6
+ /** Overrides the default 'as' attribute of the Help component */
7
+ as?: keyof JSX.IntrinsicElements;
8
+ /** Aria label */
9
+ ariaLabel?: string;
10
+ /** The message to be displayed within the tooltip */
11
+ children?: React.ReactNode;
12
+ /** [Legacy] A custom class name for the component. */
13
+ className?: string;
14
+ /** The unique id of the component (used with aria-describedby for accessibility) */
15
+ helpId?: string;
16
+ /** A path for the anchor */
17
+ href?: string;
18
+ /** A boolean received from IconWrapper */
19
+ isFocused?: boolean;
20
+ /** Overrides the default tabindex of the component */
21
+ tabIndex?: number;
22
+ /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
23
+ tooltipBgColor?: string;
24
+ /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
25
+ tooltipFontColor?: string;
26
+ /** Overrides the default flip behaviour of the Tooltip,
27
+ * must be an array containing some or all of ["top", "bottom", "left", "right"]
28
+ * (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
29
+ */
30
+ tooltipFlipOverrides?: TooltipPositions[];
31
+ /** Id passed to the tooltip container, used for accessibility purposes */
32
+ tooltipId?: string;
33
+ /** Position of tooltip relative to target */
34
+ tooltipPosition?: TooltipPositions;
35
+ /** Help Icon type */
36
+ type?: IconType;
37
+ [key: string]: any;
38
+ }
39
+ export declare const Help: {
40
+ ({ as, ariaLabel, children, className, href, helpId, isFocused, tabIndex, tooltipBgColor, tooltipFontColor, tooltipFlipOverrides, tooltipId, tooltipPosition, type, ...rest }: HelpProps): JSX.Element;
41
+ displayName: string;
42
+ };
43
+ export default Help;
@@ -1,33 +1,30 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import React, { useContext, useEffect, useState, useRef } from "react";
3
+ import React, { useContext, useEffect, useRef, useState } from "react";
4
4
  import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
6
5
  import Icon from "../icon";
7
6
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
7
  import StyledHelp from "./help.style";
9
8
  import Events from "../../__internal__/utils/helpers/events";
10
9
  import { TooltipContext } from "../../__internal__/tooltip-provider";
11
10
  import { filterStyledSystemMarginProps } from "../../style/utils";
12
- import { HELP_POSITIONS } from "./help.config";
13
11
  import guid from "../../__internal__/utils/helpers/guid";
14
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
15
12
 
16
13
  const Help = ({
14
+ as,
15
+ ariaLabel = "help",
16
+ children,
17
17
  className,
18
18
  href,
19
19
  helpId,
20
- children,
21
- tabIndex,
22
- as,
23
- tooltipPosition,
24
20
  isFocused,
25
- type,
26
- tooltipId,
21
+ tabIndex = 0,
27
22
  tooltipBgColor,
28
23
  tooltipFontColor,
29
24
  tooltipFlipOverrides,
30
- ariaLabel = "help",
25
+ tooltipId,
26
+ tooltipPosition = "top",
27
+ type = "help",
31
28
  ...rest
32
29
  }) => {
33
30
  const defaultTooltipId = useRef(guid());
@@ -37,23 +34,25 @@ const Help = ({
37
34
  helpAriaLabel
38
35
  } = useContext(TooltipContext);
39
36
  useEffect(() => {
37
+ function handleKeyPress(ev) {
38
+ if (Events.isEscKey(ev)) {
39
+ var _helpElement$current;
40
+
41
+ helpElement === null || helpElement === void 0 ? void 0 : (_helpElement$current = helpElement.current) === null || _helpElement$current === void 0 ? void 0 : _helpElement$current.blur();
42
+ updateTooltipVisible(false);
43
+ }
44
+ }
45
+
40
46
  document.addEventListener("keydown", handleKeyPress);
41
47
  return function cleanup() {
42
48
  document.removeEventListener("keydown", handleKeyPress);
43
49
  };
44
50
  });
45
- const tagType = as || href && "a";
46
-
47
- function handleKeyPress(ev) {
48
- if (Events.isEscKey(ev)) {
49
- helpElement.current.blur();
50
- updateTooltipVisible(false);
51
- }
52
- }
51
+ const tagType = as || href && "a" || "div";
53
52
 
54
- function handleFocusBlur(bool) {
53
+ function handleFocusBlur(isVisible) {
55
54
  return () => {
56
- updateTooltipVisible(bool);
55
+ updateTooltipVisible(isVisible);
57
56
  };
58
57
  }
59
58
 
@@ -66,7 +65,9 @@ const Help = ({
66
65
  id: helpId,
67
66
  ref: helpElement,
68
67
  onClick: () => {
69
- helpElement.current.focus();
68
+ var _helpElement$current2;
69
+
70
+ helpElement === null || helpElement === void 0 ? void 0 : (_helpElement$current2 = helpElement.current) === null || _helpElement$current2 === void 0 ? void 0 : _helpElement$current2.focus();
70
71
  },
71
72
  onFocus: handleFocusBlur(true),
72
73
  onBlur: handleFocusBlur(false),
@@ -93,67 +94,176 @@ const Help = ({
93
94
  }));
94
95
  };
95
96
 
96
- Help.propTypes = { ...marginPropTypes,
97
-
98
- /** [Legacy] A custom class name for the component. */
99
- className: PropTypes.string,
100
-
101
- /** Message to display in tooltip */
102
- children: PropTypes.node,
103
-
104
- /** The unique id of the component */
105
- helpId: PropTypes.string,
106
-
107
- /** Overrides the default tabindex of the component */
108
- tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
109
-
110
- /** Overrides the default 'as' attribute of the Help component */
111
- as: PropTypes.string,
112
-
113
- /** Position of tooltip relative to target */
114
- tooltipPosition: PropTypes.oneOf(["bottom", "left", "right", "top"]),
115
-
116
- /** A path for the anchor */
117
- href: PropTypes.string,
118
-
119
- /** A boolean received from IconWrapper */
120
- isFocused: PropTypes.bool,
121
-
122
- /** <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
123
- *
124
- * Icon to display, can be received from label component
125
- *
126
- */
127
- type: PropTypes.string,
128
-
129
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
130
- tooltipBgColor: PropTypes.string,
131
-
132
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
133
- tooltipFontColor: PropTypes.string,
134
-
135
- /** Overrides the default flip behaviour of the Tooltip, must be an array containing some or all of ["top", "bottom", "left", "right"] (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) */
136
- tooltipFlipOverrides: (props, propName, componentName) => {
137
- const prop = props[propName];
138
- const isValid = prop && Array.isArray(prop) && prop.every(placement => HELP_POSITIONS.includes(placement));
139
-
140
- if (!prop || isValid) {
141
- return null;
142
- }
143
-
144
- return new Error( // eslint-disable-next-line max-len
145
- `The \`${propName}\` prop supplied to \`${componentName}\` must be an array containing some or all of ["top", "bottom", "left", "right"].`);
146
- },
147
-
148
- /** Id passed to the tooltip container, used for accessibility purposes. */
149
- tooltipId: PropTypes.string,
150
-
151
- /** Aria label */
152
- ariaLabel: PropTypes.string
153
- };
154
- Help.defaultProps = {
155
- tooltipPosition: "top",
156
- tabIndex: 0,
157
- type: "help"
97
+ Help.propTypes = {
98
+ "ariaLabel": PropTypes.string,
99
+ "as": PropTypes.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]),
100
+ "children": PropTypes.node,
101
+ "className": PropTypes.string,
102
+ "helpId": PropTypes.string,
103
+ "href": PropTypes.string,
104
+ "isFocused": PropTypes.bool,
105
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
106
+ "__@toStringTag": PropTypes.string.isRequired,
107
+ "description": PropTypes.string,
108
+ "toString": PropTypes.func.isRequired,
109
+ "valueOf": PropTypes.func.isRequired
110
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
111
+ "__@toStringTag": PropTypes.string.isRequired,
112
+ "description": PropTypes.string,
113
+ "toString": PropTypes.func.isRequired,
114
+ "valueOf": PropTypes.func.isRequired
115
+ }), PropTypes.string]),
116
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
117
+ "__@toStringTag": PropTypes.string.isRequired,
118
+ "description": PropTypes.string,
119
+ "toString": PropTypes.func.isRequired,
120
+ "valueOf": PropTypes.func.isRequired
121
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
122
+ "__@toStringTag": PropTypes.string.isRequired,
123
+ "description": PropTypes.string,
124
+ "toString": PropTypes.func.isRequired,
125
+ "valueOf": PropTypes.func.isRequired
126
+ }), PropTypes.string]),
127
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
128
+ "__@toStringTag": PropTypes.string.isRequired,
129
+ "description": PropTypes.string,
130
+ "toString": PropTypes.func.isRequired,
131
+ "valueOf": PropTypes.func.isRequired
132
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
133
+ "__@toStringTag": PropTypes.string.isRequired,
134
+ "description": PropTypes.string,
135
+ "toString": PropTypes.func.isRequired,
136
+ "valueOf": PropTypes.func.isRequired
137
+ }), PropTypes.string]),
138
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
139
+ "__@toStringTag": PropTypes.string.isRequired,
140
+ "description": PropTypes.string,
141
+ "toString": PropTypes.func.isRequired,
142
+ "valueOf": PropTypes.func.isRequired
143
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
144
+ "__@toStringTag": PropTypes.string.isRequired,
145
+ "description": PropTypes.string,
146
+ "toString": PropTypes.func.isRequired,
147
+ "valueOf": PropTypes.func.isRequired
148
+ }), PropTypes.string]),
149
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
150
+ "__@toStringTag": PropTypes.string.isRequired,
151
+ "description": PropTypes.string,
152
+ "toString": PropTypes.func.isRequired,
153
+ "valueOf": PropTypes.func.isRequired
154
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
155
+ "__@toStringTag": PropTypes.string.isRequired,
156
+ "description": PropTypes.string,
157
+ "toString": PropTypes.func.isRequired,
158
+ "valueOf": PropTypes.func.isRequired
159
+ }), PropTypes.string]),
160
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
161
+ "__@toStringTag": PropTypes.string.isRequired,
162
+ "description": PropTypes.string,
163
+ "toString": PropTypes.func.isRequired,
164
+ "valueOf": PropTypes.func.isRequired
165
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
166
+ "__@toStringTag": PropTypes.string.isRequired,
167
+ "description": PropTypes.string,
168
+ "toString": PropTypes.func.isRequired,
169
+ "valueOf": PropTypes.func.isRequired
170
+ }), PropTypes.string]),
171
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
172
+ "__@toStringTag": PropTypes.string.isRequired,
173
+ "description": PropTypes.string,
174
+ "toString": PropTypes.func.isRequired,
175
+ "valueOf": PropTypes.func.isRequired
176
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
177
+ "__@toStringTag": PropTypes.string.isRequired,
178
+ "description": PropTypes.string,
179
+ "toString": PropTypes.func.isRequired,
180
+ "valueOf": PropTypes.func.isRequired
181
+ }), PropTypes.string]),
182
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
183
+ "__@toStringTag": PropTypes.string.isRequired,
184
+ "description": PropTypes.string,
185
+ "toString": PropTypes.func.isRequired,
186
+ "valueOf": PropTypes.func.isRequired
187
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
188
+ "__@toStringTag": PropTypes.string.isRequired,
189
+ "description": PropTypes.string,
190
+ "toString": PropTypes.func.isRequired,
191
+ "valueOf": PropTypes.func.isRequired
192
+ }), PropTypes.string]),
193
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
194
+ "__@toStringTag": PropTypes.string.isRequired,
195
+ "description": PropTypes.string,
196
+ "toString": PropTypes.func.isRequired,
197
+ "valueOf": PropTypes.func.isRequired
198
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
199
+ "__@toStringTag": PropTypes.string.isRequired,
200
+ "description": PropTypes.string,
201
+ "toString": PropTypes.func.isRequired,
202
+ "valueOf": PropTypes.func.isRequired
203
+ }), PropTypes.string]),
204
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
205
+ "__@toStringTag": PropTypes.string.isRequired,
206
+ "description": PropTypes.string,
207
+ "toString": PropTypes.func.isRequired,
208
+ "valueOf": PropTypes.func.isRequired
209
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
210
+ "__@toStringTag": PropTypes.string.isRequired,
211
+ "description": PropTypes.string,
212
+ "toString": PropTypes.func.isRequired,
213
+ "valueOf": PropTypes.func.isRequired
214
+ }), PropTypes.string]),
215
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
216
+ "__@toStringTag": PropTypes.string.isRequired,
217
+ "description": PropTypes.string,
218
+ "toString": PropTypes.func.isRequired,
219
+ "valueOf": PropTypes.func.isRequired
220
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
221
+ "__@toStringTag": PropTypes.string.isRequired,
222
+ "description": PropTypes.string,
223
+ "toString": PropTypes.func.isRequired,
224
+ "valueOf": PropTypes.func.isRequired
225
+ }), PropTypes.string]),
226
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
227
+ "__@toStringTag": PropTypes.string.isRequired,
228
+ "description": PropTypes.string,
229
+ "toString": PropTypes.func.isRequired,
230
+ "valueOf": PropTypes.func.isRequired
231
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
232
+ "__@toStringTag": PropTypes.string.isRequired,
233
+ "description": PropTypes.string,
234
+ "toString": PropTypes.func.isRequired,
235
+ "valueOf": PropTypes.func.isRequired
236
+ }), PropTypes.string]),
237
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
238
+ "__@toStringTag": PropTypes.string.isRequired,
239
+ "description": PropTypes.string,
240
+ "toString": PropTypes.func.isRequired,
241
+ "valueOf": PropTypes.func.isRequired
242
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
243
+ "__@toStringTag": PropTypes.string.isRequired,
244
+ "description": PropTypes.string,
245
+ "toString": PropTypes.func.isRequired,
246
+ "valueOf": PropTypes.func.isRequired
247
+ }), PropTypes.string]),
248
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
249
+ "__@toStringTag": PropTypes.string.isRequired,
250
+ "description": PropTypes.string,
251
+ "toString": PropTypes.func.isRequired,
252
+ "valueOf": PropTypes.func.isRequired
253
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
254
+ "__@toStringTag": PropTypes.string.isRequired,
255
+ "description": PropTypes.string,
256
+ "toString": PropTypes.func.isRequired,
257
+ "valueOf": PropTypes.func.isRequired
258
+ }), PropTypes.string]),
259
+ "tabIndex": PropTypes.number,
260
+ "tooltipBgColor": PropTypes.string,
261
+ "tooltipFlipOverrides": PropTypes.arrayOf(PropTypes.oneOf(["bottom", "left", "right", "top"])),
262
+ "tooltipFontColor": PropTypes.string,
263
+ "tooltipId": PropTypes.string,
264
+ "tooltipPosition": PropTypes.oneOf(["bottom", "left", "right", "top"]),
265
+ "type": PropTypes.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"])
158
266
  };
267
+ export { Help };
268
+ Help.displayName = "Help";
159
269
  export default Help;
@@ -0,0 +1 @@
1
+ export declare const HELP_POSITIONS: string[];
@@ -1,2 +1,5 @@
1
+ interface StyledHelpProps {
2
+ href?: string;
3
+ }
4
+ declare const StyledHelp: import("styled-components").StyledComponent<"div", any, StyledHelpProps, never>;
1
5
  export default StyledHelp;
2
- declare const StyledHelp: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1 +1,2 @@
1
- export { default } from "./help";
1
+ export { default } from "./help.component";
2
+ export type { HelpProps } from "./help.component";
@@ -10,7 +10,7 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
10
10
  /** Icon type */
11
11
  helpIcon?: IconType;
12
12
  /** Overrides the default tabindex of the Help component */
13
- helpTabIndex?: string;
13
+ helpTabIndex?: number | string;
14
14
  /** A string that represents the ID of another form element */
15
15
  htmlFor?: string;
16
16
  /** The unique id of the label element */
@@ -117,7 +117,7 @@ const Label = ({
117
117
 
118
118
  return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, wrapperProps, /*#__PURE__*/_react.default.createElement(_help.default, {
119
119
  tooltipId: tooltipId,
120
- tabIndex: helpTabIndex,
120
+ tabIndex: Number(helpTabIndex),
121
121
  type: helpIcon,
122
122
  isFocused: isFocused
123
123
  }, help));
@@ -149,7 +149,7 @@ Label.propTypes = {
149
149
  "error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
150
150
  "help": _propTypes.default.node,
151
151
  "helpIcon": _propTypes.default.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
152
- "helpTabIndex": _propTypes.default.string,
152
+ "helpTabIndex": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
153
153
  "htmlFor": _propTypes.default.string,
154
154
  "info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
155
155
  "inline": _propTypes.default.bool,
@@ -34,7 +34,6 @@ exports.CheckboxGroupContext = CheckboxGroupContext;
34
34
  const CheckboxGroup = props => {
35
35
  const {
36
36
  children,
37
- groupName,
38
37
  legend,
39
38
  error,
40
39
  warning,
@@ -65,7 +64,6 @@ const CheckboxGroup = props => {
65
64
  legendInline: legendInline
66
65
  }, /*#__PURE__*/_react.default.createElement(CheckboxGroupContext.Provider, {
67
66
  value: {
68
- inputName: groupName,
69
67
  error: !!error,
70
68
  warning: !!warning,
71
69
  info: !!info
@@ -95,9 +93,6 @@ CheckboxGroup.propTypes = {
95
93
  /** The Checkboxes to be rendered in the group */
96
94
  children: _propTypes.default.node.isRequired,
97
95
 
98
- /** Specifies the name prop to be applied to each button in the group */
99
- groupName: _propTypes.default.string.isRequired,
100
-
101
96
  /** Indicate that error has occurred
102
97
  Pass string to display icon, tooltip and red border
103
98
  Pass true boolean to only display red border */
@@ -15,8 +15,6 @@ interface CheckboxGroupProps extends ValidationProps, MarginProps {
15
15
  legendSpacing?: 1 | 2;
16
16
  /** The Checkboxes to be rendered in the group */
17
17
  children: React.ReactNode;
18
- /** Specifies the name prop to be applied to each button in the group */
19
- groupName: string;
20
18
  /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
21
19
  labelSpacing?: 1 | 2;
22
20
  /** Flag to configure component as mandatory */
@@ -74,8 +74,7 @@ const Checkbox = ({
74
74
  const {
75
75
  error: contextError,
76
76
  warning: contextWarning,
77
- info: contextInfo,
78
- inputName
77
+ info: contextInfo
79
78
  } = (0, _react.useContext)(_checkboxGroup.CheckboxGroupContext);
80
79
  const inputProps = {
81
80
  onClick,
@@ -103,7 +102,6 @@ const Checkbox = ({
103
102
  inputWidth,
104
103
  labelWidth,
105
104
  tooltipPosition,
106
- inputName,
107
105
  ...props
108
106
  };
109
107
  return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
@@ -51,7 +51,8 @@ const Sort = ({
51
51
  sortType: sortType,
52
52
  "aria-labelledby": id.current
53
53
  }, children, sortType && /*#__PURE__*/_react.default.createElement(_icon.default, {
54
- type: sortType === "ascending" ? "sort_up" : "sort_down"
54
+ type: sortType === "ascending" ? "sort_up" : "sort_down",
55
+ color: "--colorsUtilityMajor200"
55
56
  })), !sortType && /*#__PURE__*/_react.default.createElement(_sort.StyledSpaceHolder, null));
56
57
  };
57
58
 
@@ -23,7 +23,6 @@ const StyledSort = _styledComponents.default.div`
23
23
  width: 16px;
24
24
  height: 16px;
25
25
  padding-left: 6px;
26
- color: var(--colorsUtilityMajor200);
27
26
  }
28
27
 
29
28
  :hover {
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { IconType } from "../icon";
4
+ import { TooltipPositions } from "../tooltip/tooltip.config";
5
+ export interface HelpProps extends MarginProps {
6
+ /** Overrides the default 'as' attribute of the Help component */
7
+ as?: keyof JSX.IntrinsicElements;
8
+ /** Aria label */
9
+ ariaLabel?: string;
10
+ /** The message to be displayed within the tooltip */
11
+ children?: React.ReactNode;
12
+ /** [Legacy] A custom class name for the component. */
13
+ className?: string;
14
+ /** The unique id of the component (used with aria-describedby for accessibility) */
15
+ helpId?: string;
16
+ /** A path for the anchor */
17
+ href?: string;
18
+ /** A boolean received from IconWrapper */
19
+ isFocused?: boolean;
20
+ /** Overrides the default tabindex of the component */
21
+ tabIndex?: number;
22
+ /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
23
+ tooltipBgColor?: string;
24
+ /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
25
+ tooltipFontColor?: string;
26
+ /** Overrides the default flip behaviour of the Tooltip,
27
+ * must be an array containing some or all of ["top", "bottom", "left", "right"]
28
+ * (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
29
+ */
30
+ tooltipFlipOverrides?: TooltipPositions[];
31
+ /** Id passed to the tooltip container, used for accessibility purposes */
32
+ tooltipId?: string;
33
+ /** Position of tooltip relative to target */
34
+ tooltipPosition?: TooltipPositions;
35
+ /** Help Icon type */
36
+ type?: IconType;
37
+ [key: string]: any;
38
+ }
39
+ export declare const Help: {
40
+ ({ as, ariaLabel, children, className, href, helpId, isFocused, tabIndex, tooltipBgColor, tooltipFontColor, tooltipFlipOverrides, tooltipId, tooltipPosition, type, ...rest }: HelpProps): JSX.Element;
41
+ displayName: string;
42
+ };
43
+ export default Help;
@@ -3,14 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.Help = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
- var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
13
-
14
12
  var _icon = _interopRequireDefault(require("../icon"));
15
13
 
16
14
  var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
@@ -23,8 +21,6 @@ var _tooltipProvider = require("../../__internal__/tooltip-provider");
23
21
 
24
22
  var _utils = require("../../style/utils");
25
23
 
26
- var _help2 = require("./help.config");
27
-
28
24
  var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
29
25
 
30
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -35,23 +31,21 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
35
31
 
36
32
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
33
 
38
- const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
39
-
40
34
  const Help = ({
35
+ as,
36
+ ariaLabel = "help",
37
+ children,
41
38
  className,
42
39
  href,
43
40
  helpId,
44
- children,
45
- tabIndex,
46
- as,
47
- tooltipPosition,
48
41
  isFocused,
49
- type,
50
- tooltipId,
42
+ tabIndex = 0,
51
43
  tooltipBgColor,
52
44
  tooltipFontColor,
53
45
  tooltipFlipOverrides,
54
- ariaLabel = "help",
46
+ tooltipId,
47
+ tooltipPosition = "top",
48
+ type = "help",
55
49
  ...rest
56
50
  }) => {
57
51
  const defaultTooltipId = (0, _react.useRef)((0, _guid.default)());
@@ -61,23 +55,25 @@ const Help = ({
61
55
  helpAriaLabel
62
56
  } = (0, _react.useContext)(_tooltipProvider.TooltipContext);
63
57
  (0, _react.useEffect)(() => {
58
+ function handleKeyPress(ev) {
59
+ if (_events.default.isEscKey(ev)) {
60
+ var _helpElement$current;
61
+
62
+ helpElement === null || helpElement === void 0 ? void 0 : (_helpElement$current = helpElement.current) === null || _helpElement$current === void 0 ? void 0 : _helpElement$current.blur();
63
+ updateTooltipVisible(false);
64
+ }
65
+ }
66
+
64
67
  document.addEventListener("keydown", handleKeyPress);
65
68
  return function cleanup() {
66
69
  document.removeEventListener("keydown", handleKeyPress);
67
70
  };
68
71
  });
69
- const tagType = as || href && "a";
72
+ const tagType = as || href && "a" || "div";
70
73
 
71
- function handleKeyPress(ev) {
72
- if (_events.default.isEscKey(ev)) {
73
- helpElement.current.blur();
74
- updateTooltipVisible(false);
75
- }
76
- }
77
-
78
- function handleFocusBlur(bool) {
74
+ function handleFocusBlur(isVisible) {
79
75
  return () => {
80
- updateTooltipVisible(bool);
76
+ updateTooltipVisible(isVisible);
81
77
  };
82
78
  }
83
79
 
@@ -90,7 +86,9 @@ const Help = ({
90
86
  id: helpId,
91
87
  ref: helpElement,
92
88
  onClick: () => {
93
- helpElement.current.focus();
89
+ var _helpElement$current2;
90
+
91
+ helpElement === null || helpElement === void 0 ? void 0 : (_helpElement$current2 = helpElement.current) === null || _helpElement$current2 === void 0 ? void 0 : _helpElement$current2.focus();
94
92
  },
95
93
  onFocus: handleFocusBlur(true),
96
94
  onBlur: handleFocusBlur(false),
@@ -117,68 +115,177 @@ const Help = ({
117
115
  }));
118
116
  };
119
117
 
120
- Help.propTypes = { ...marginPropTypes,
121
-
122
- /** [Legacy] A custom class name for the component. */
123
- className: _propTypes.default.string,
124
-
125
- /** Message to display in tooltip */
126
- children: _propTypes.default.node,
127
-
128
- /** The unique id of the component */
129
- helpId: _propTypes.default.string,
130
-
131
- /** Overrides the default tabindex of the component */
132
- tabIndex: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
133
-
134
- /** Overrides the default 'as' attribute of the Help component */
135
- as: _propTypes.default.string,
136
-
137
- /** Position of tooltip relative to target */
138
- tooltipPosition: _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
139
-
140
- /** A path for the anchor */
141
- href: _propTypes.default.string,
142
-
143
- /** A boolean received from IconWrapper */
144
- isFocused: _propTypes.default.bool,
145
-
146
- /** <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
147
- *
148
- * Icon to display, can be received from label component
149
- *
150
- */
151
- type: _propTypes.default.string,
152
-
153
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
154
- tooltipBgColor: _propTypes.default.string,
155
-
156
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
157
- tooltipFontColor: _propTypes.default.string,
158
-
159
- /** Overrides the default flip behaviour of the Tooltip, must be an array containing some or all of ["top", "bottom", "left", "right"] (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) */
160
- tooltipFlipOverrides: (props, propName, componentName) => {
161
- const prop = props[propName];
162
- const isValid = prop && Array.isArray(prop) && prop.every(placement => _help2.HELP_POSITIONS.includes(placement));
163
-
164
- if (!prop || isValid) {
165
- return null;
166
- }
167
-
168
- return new Error( // eslint-disable-next-line max-len
169
- `The \`${propName}\` prop supplied to \`${componentName}\` must be an array containing some or all of ["top", "bottom", "left", "right"].`);
170
- },
171
-
172
- /** Id passed to the tooltip container, used for accessibility purposes. */
173
- tooltipId: _propTypes.default.string,
174
-
175
- /** Aria label */
176
- ariaLabel: _propTypes.default.string
177
- };
178
- Help.defaultProps = {
179
- tooltipPosition: "top",
180
- tabIndex: 0,
181
- type: "help"
118
+ exports.Help = Help;
119
+ Help.propTypes = {
120
+ "ariaLabel": _propTypes.default.string,
121
+ "as": _propTypes.default.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]),
122
+ "children": _propTypes.default.node,
123
+ "className": _propTypes.default.string,
124
+ "helpId": _propTypes.default.string,
125
+ "href": _propTypes.default.string,
126
+ "isFocused": _propTypes.default.bool,
127
+ "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
128
+ "__@toStringTag": _propTypes.default.string.isRequired,
129
+ "description": _propTypes.default.string,
130
+ "toString": _propTypes.default.func.isRequired,
131
+ "valueOf": _propTypes.default.func.isRequired
132
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
133
+ "__@toStringTag": _propTypes.default.string.isRequired,
134
+ "description": _propTypes.default.string,
135
+ "toString": _propTypes.default.func.isRequired,
136
+ "valueOf": _propTypes.default.func.isRequired
137
+ }), _propTypes.default.string]),
138
+ "margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
139
+ "__@toStringTag": _propTypes.default.string.isRequired,
140
+ "description": _propTypes.default.string,
141
+ "toString": _propTypes.default.func.isRequired,
142
+ "valueOf": _propTypes.default.func.isRequired
143
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
144
+ "__@toStringTag": _propTypes.default.string.isRequired,
145
+ "description": _propTypes.default.string,
146
+ "toString": _propTypes.default.func.isRequired,
147
+ "valueOf": _propTypes.default.func.isRequired
148
+ }), _propTypes.default.string]),
149
+ "marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
150
+ "__@toStringTag": _propTypes.default.string.isRequired,
151
+ "description": _propTypes.default.string,
152
+ "toString": _propTypes.default.func.isRequired,
153
+ "valueOf": _propTypes.default.func.isRequired
154
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
155
+ "__@toStringTag": _propTypes.default.string.isRequired,
156
+ "description": _propTypes.default.string,
157
+ "toString": _propTypes.default.func.isRequired,
158
+ "valueOf": _propTypes.default.func.isRequired
159
+ }), _propTypes.default.string]),
160
+ "marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
161
+ "__@toStringTag": _propTypes.default.string.isRequired,
162
+ "description": _propTypes.default.string,
163
+ "toString": _propTypes.default.func.isRequired,
164
+ "valueOf": _propTypes.default.func.isRequired
165
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
166
+ "__@toStringTag": _propTypes.default.string.isRequired,
167
+ "description": _propTypes.default.string,
168
+ "toString": _propTypes.default.func.isRequired,
169
+ "valueOf": _propTypes.default.func.isRequired
170
+ }), _propTypes.default.string]),
171
+ "marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
172
+ "__@toStringTag": _propTypes.default.string.isRequired,
173
+ "description": _propTypes.default.string,
174
+ "toString": _propTypes.default.func.isRequired,
175
+ "valueOf": _propTypes.default.func.isRequired
176
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
177
+ "__@toStringTag": _propTypes.default.string.isRequired,
178
+ "description": _propTypes.default.string,
179
+ "toString": _propTypes.default.func.isRequired,
180
+ "valueOf": _propTypes.default.func.isRequired
181
+ }), _propTypes.default.string]),
182
+ "marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
183
+ "__@toStringTag": _propTypes.default.string.isRequired,
184
+ "description": _propTypes.default.string,
185
+ "toString": _propTypes.default.func.isRequired,
186
+ "valueOf": _propTypes.default.func.isRequired
187
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
188
+ "__@toStringTag": _propTypes.default.string.isRequired,
189
+ "description": _propTypes.default.string,
190
+ "toString": _propTypes.default.func.isRequired,
191
+ "valueOf": _propTypes.default.func.isRequired
192
+ }), _propTypes.default.string]),
193
+ "marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
194
+ "__@toStringTag": _propTypes.default.string.isRequired,
195
+ "description": _propTypes.default.string,
196
+ "toString": _propTypes.default.func.isRequired,
197
+ "valueOf": _propTypes.default.func.isRequired
198
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
199
+ "__@toStringTag": _propTypes.default.string.isRequired,
200
+ "description": _propTypes.default.string,
201
+ "toString": _propTypes.default.func.isRequired,
202
+ "valueOf": _propTypes.default.func.isRequired
203
+ }), _propTypes.default.string]),
204
+ "marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
205
+ "__@toStringTag": _propTypes.default.string.isRequired,
206
+ "description": _propTypes.default.string,
207
+ "toString": _propTypes.default.func.isRequired,
208
+ "valueOf": _propTypes.default.func.isRequired
209
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
210
+ "__@toStringTag": _propTypes.default.string.isRequired,
211
+ "description": _propTypes.default.string,
212
+ "toString": _propTypes.default.func.isRequired,
213
+ "valueOf": _propTypes.default.func.isRequired
214
+ }), _propTypes.default.string]),
215
+ "mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
216
+ "__@toStringTag": _propTypes.default.string.isRequired,
217
+ "description": _propTypes.default.string,
218
+ "toString": _propTypes.default.func.isRequired,
219
+ "valueOf": _propTypes.default.func.isRequired
220
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
221
+ "__@toStringTag": _propTypes.default.string.isRequired,
222
+ "description": _propTypes.default.string,
223
+ "toString": _propTypes.default.func.isRequired,
224
+ "valueOf": _propTypes.default.func.isRequired
225
+ }), _propTypes.default.string]),
226
+ "ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
227
+ "__@toStringTag": _propTypes.default.string.isRequired,
228
+ "description": _propTypes.default.string,
229
+ "toString": _propTypes.default.func.isRequired,
230
+ "valueOf": _propTypes.default.func.isRequired
231
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
232
+ "__@toStringTag": _propTypes.default.string.isRequired,
233
+ "description": _propTypes.default.string,
234
+ "toString": _propTypes.default.func.isRequired,
235
+ "valueOf": _propTypes.default.func.isRequired
236
+ }), _propTypes.default.string]),
237
+ "mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
238
+ "__@toStringTag": _propTypes.default.string.isRequired,
239
+ "description": _propTypes.default.string,
240
+ "toString": _propTypes.default.func.isRequired,
241
+ "valueOf": _propTypes.default.func.isRequired
242
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
243
+ "__@toStringTag": _propTypes.default.string.isRequired,
244
+ "description": _propTypes.default.string,
245
+ "toString": _propTypes.default.func.isRequired,
246
+ "valueOf": _propTypes.default.func.isRequired
247
+ }), _propTypes.default.string]),
248
+ "mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
249
+ "__@toStringTag": _propTypes.default.string.isRequired,
250
+ "description": _propTypes.default.string,
251
+ "toString": _propTypes.default.func.isRequired,
252
+ "valueOf": _propTypes.default.func.isRequired
253
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
254
+ "__@toStringTag": _propTypes.default.string.isRequired,
255
+ "description": _propTypes.default.string,
256
+ "toString": _propTypes.default.func.isRequired,
257
+ "valueOf": _propTypes.default.func.isRequired
258
+ }), _propTypes.default.string]),
259
+ "mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
260
+ "__@toStringTag": _propTypes.default.string.isRequired,
261
+ "description": _propTypes.default.string,
262
+ "toString": _propTypes.default.func.isRequired,
263
+ "valueOf": _propTypes.default.func.isRequired
264
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
265
+ "__@toStringTag": _propTypes.default.string.isRequired,
266
+ "description": _propTypes.default.string,
267
+ "toString": _propTypes.default.func.isRequired,
268
+ "valueOf": _propTypes.default.func.isRequired
269
+ }), _propTypes.default.string]),
270
+ "my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
271
+ "__@toStringTag": _propTypes.default.string.isRequired,
272
+ "description": _propTypes.default.string,
273
+ "toString": _propTypes.default.func.isRequired,
274
+ "valueOf": _propTypes.default.func.isRequired
275
+ }), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
276
+ "__@toStringTag": _propTypes.default.string.isRequired,
277
+ "description": _propTypes.default.string,
278
+ "toString": _propTypes.default.func.isRequired,
279
+ "valueOf": _propTypes.default.func.isRequired
280
+ }), _propTypes.default.string]),
281
+ "tabIndex": _propTypes.default.number,
282
+ "tooltipBgColor": _propTypes.default.string,
283
+ "tooltipFlipOverrides": _propTypes.default.arrayOf(_propTypes.default.oneOf(["bottom", "left", "right", "top"])),
284
+ "tooltipFontColor": _propTypes.default.string,
285
+ "tooltipId": _propTypes.default.string,
286
+ "tooltipPosition": _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
287
+ "type": _propTypes.default.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"])
182
288
  };
289
+ Help.displayName = "Help";
183
290
  var _default = Help;
184
291
  exports.default = _default;
@@ -0,0 +1 @@
1
+ export declare const HELP_POSITIONS: string[];
@@ -1,2 +1,5 @@
1
+ interface StyledHelpProps {
2
+ href?: string;
3
+ }
4
+ declare const StyledHelp: import("styled-components").StyledComponent<"div", any, StyledHelpProps, never>;
1
5
  export default StyledHelp;
2
- declare const StyledHelp: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1 +1,2 @@
1
- export { default } from "./help";
1
+ export { default } from "./help.component";
2
+ export type { HelpProps } from "./help.component";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "109.1.1",
3
+ "version": "109.1.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,41 +0,0 @@
1
- import * as React from "react";
2
- import { IconType } from "components/icon/icon-type";
3
- import { MarginProps } from "styled-system";
4
-
5
- export interface HelpProps extends MarginProps {
6
- /** Overrides the default 'as' attribute of the Help component */
7
- as?: string;
8
- /** The message to be displayed within the tooltip */
9
- children?: React.ReactNode;
10
- /** [Legacy] A custom class name for the component. */
11
- className?: string;
12
- /** The unique id of the component (used with aria-describedby for accessibility) */
13
- helpId?: string;
14
- /** A path for the anchor */
15
- href?: string;
16
- /** A boolean received from IconWrapper */
17
- isFocused?: boolean;
18
- /** Overrides the default tabindex of the component */
19
- tabIndex?: number | string;
20
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
21
- tooltipBgColor?: string;
22
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
23
- tooltipFontColor?: string;
24
- /** Overrides the default flip behaviour of the Tooltip,
25
- * must be an array containing some or all of ["top", "bottom", "left", "right"]
26
- * (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
27
- */
28
- tooltipFlipOverrides?: ["top" | "bottom" | "left" | "right"];
29
- /** Position of tooltip relative to target */
30
- tooltipPosition?: "top" | "bottom" | "left" | "right";
31
- /** Id passed to the tooltip container, used for accessibility purposes */
32
- tooltipId?: string;
33
- /** Help Icon type */
34
- type?: IconType;
35
- /** Aria label */
36
- ariaLabel?: string;
37
- }
38
-
39
- declare function Help(props: HelpProps): JSX.Element;
40
-
41
- export default Help;
@@ -1,41 +0,0 @@
1
- import * as React from "react";
2
- import { IconType } from "components/icon/icon-type";
3
- import { MarginProps } from "styled-system";
4
-
5
- export interface HelpProps extends MarginProps {
6
- /** Overrides the default 'as' attribute of the Help component */
7
- as?: string;
8
- /** The message to be displayed within the tooltip */
9
- children?: React.ReactNode;
10
- /** [Legacy] A custom class name for the component. */
11
- className?: string;
12
- /** The unique id of the component (used with aria-describedby for accessibility) */
13
- helpId?: string;
14
- /** A path for the anchor */
15
- href?: string;
16
- /** A boolean received from IconWrapper */
17
- isFocused?: boolean;
18
- /** Overrides the default tabindex of the component */
19
- tabIndex?: number | string;
20
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
21
- tooltipBgColor?: string;
22
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
23
- tooltipFontColor?: string;
24
- /** Overrides the default flip behaviour of the Tooltip,
25
- * must be an array containing some or all of ["top", "bottom", "left", "right"]
26
- * (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
27
- */
28
- tooltipFlipOverrides?: ["top" | "bottom" | "left" | "right"];
29
- /** Position of tooltip relative to target */
30
- tooltipPosition?: "top" | "bottom" | "left" | "right";
31
- /** Id passed to the tooltip container, used for accessibility purposes */
32
- tooltipId?: string;
33
- /** Help Icon type */
34
- type?: IconType;
35
- /** Aria label */
36
- ariaLabel?: string;
37
- }
38
-
39
- declare function Help(props: HelpProps): JSX.Element;
40
-
41
- export default Help;