carbon-react 107.1.3 → 107.1.6

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.
Files changed (83) hide show
  1. package/esm/__internal__/input/input.component.js +3 -0
  2. package/esm/__internal__/label/icon-wrapper.style.d.ts +2 -0
  3. package/esm/__internal__/label/icon-wrapper.style.js +4 -4
  4. package/esm/__internal__/label/index.d.ts +2 -1
  5. package/esm/__internal__/label/label.component.d.ts +27 -0
  6. package/esm/__internal__/label/label.component.js +42 -80
  7. package/esm/__internal__/label/label.style.d.ts +23 -3
  8. package/esm/__internal__/label/label.style.js +4 -19
  9. package/esm/__internal__/utils/helpers/events/events.d.ts +0 -58
  10. package/esm/__internal__/utils/helpers/events/events.js +12 -128
  11. package/esm/__spec_helper__/test-utils.d.ts +4 -25
  12. package/esm/__spec_helper__/test-utils.js +12 -25
  13. package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -2
  14. package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.component.d.ts +19 -0
  15. package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.component.js +14 -21
  16. package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.d.ts +5 -0
  17. package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js +0 -4
  18. package/esm/components/anchor-navigation/anchor-navigation.component.d.ts +14 -0
  19. package/esm/components/anchor-navigation/anchor-navigation.component.js +55 -72
  20. package/esm/components/anchor-navigation/anchor-navigation.style.d.ts +4 -0
  21. package/esm/components/anchor-navigation/anchor-section-divider.component.d.ts +4 -0
  22. package/esm/components/anchor-navigation/{anchor-section-divider/anchor-section-divider.style.js → anchor-section-divider.component.js} +3 -2
  23. package/esm/components/anchor-navigation/index.d.ts +5 -3
  24. package/esm/components/anchor-navigation/index.js +1 -1
  25. package/esm/components/date/__internal__/date-picker/date-picker.component.js +10 -1
  26. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +1 -0
  27. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -0
  28. package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +1 -0
  29. package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +3 -3
  30. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +1 -0
  31. package/esm/components/help/help.style.d.ts +2 -0
  32. package/esm/components/menu/__internal__/spec-helper/index.js +1 -2
  33. package/esm/components/menu/__internal__/submenu/submenu.component.js +1 -1
  34. package/esm/components/multi-action-button/multi-action-button.component.js +3 -0
  35. package/esm/components/numeral-date/numeral-date.component.js +1 -1
  36. package/esm/components/search/search.component.js +1 -2
  37. package/esm/components/tabs/tabs.component.js +28 -20
  38. package/lib/__internal__/input/input.component.js +3 -0
  39. package/lib/__internal__/label/icon-wrapper.style.d.ts +2 -0
  40. package/lib/__internal__/label/icon-wrapper.style.js +2 -2
  41. package/lib/__internal__/label/index.d.ts +2 -1
  42. package/lib/__internal__/label/label.component.d.ts +27 -0
  43. package/lib/__internal__/label/label.component.js +40 -78
  44. package/lib/__internal__/label/label.style.d.ts +23 -3
  45. package/lib/__internal__/label/label.style.js +4 -22
  46. package/lib/__internal__/utils/helpers/events/events.d.ts +0 -58
  47. package/lib/__internal__/utils/helpers/events/events.js +12 -128
  48. package/lib/__spec_helper__/test-utils.d.ts +4 -25
  49. package/lib/__spec_helper__/test-utils.js +12 -25
  50. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -2
  51. package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.component.d.ts +19 -0
  52. package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.component.js +14 -21
  53. package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.d.ts +5 -0
  54. package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.style.js +0 -7
  55. package/lib/components/anchor-navigation/anchor-navigation.component.d.ts +14 -0
  56. package/lib/components/anchor-navigation/anchor-navigation.component.js +57 -73
  57. package/lib/components/anchor-navigation/anchor-navigation.style.d.ts +4 -0
  58. package/lib/components/anchor-navigation/anchor-section-divider.component.d.ts +4 -0
  59. package/lib/components/anchor-navigation/{anchor-section-divider/anchor-section-divider.style.js → anchor-section-divider.component.js} +3 -2
  60. package/lib/components/anchor-navigation/index.d.ts +5 -3
  61. package/lib/components/anchor-navigation/index.js +1 -1
  62. package/lib/components/date/__internal__/date-picker/date-picker.component.js +10 -1
  63. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +1 -0
  64. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -0
  65. package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +1 -0
  66. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +2 -4
  67. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +1 -0
  68. package/lib/components/help/help.style.d.ts +2 -0
  69. package/lib/components/menu/__internal__/spec-helper/index.js +1 -2
  70. package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -1
  71. package/lib/components/multi-action-button/multi-action-button.component.js +3 -0
  72. package/lib/components/numeral-date/numeral-date.component.js +1 -1
  73. package/lib/components/search/search.component.js +1 -3
  74. package/lib/components/tabs/tabs.component.js +28 -20
  75. package/package.json +4 -4
  76. package/esm/__internal__/label/label.d.ts +0 -43
  77. package/esm/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.d.ts +0 -23
  78. package/esm/components/anchor-navigation/anchor-navigation.d.ts +0 -11
  79. package/esm/components/anchor-navigation/anchor-section-divider/anchor-section-divider.d.ts +0 -12
  80. package/lib/__internal__/label/label.d.ts +0 -43
  81. package/lib/components/anchor-navigation/anchor-navigation-item/anchor-navigation-item.d.ts +0 -23
  82. package/lib/components/anchor-navigation/anchor-navigation.d.ts +0 -11
  83. package/lib/components/anchor-navigation/anchor-section-divider/anchor-section-divider.d.ts +0 -12
@@ -33,12 +33,9 @@ const Tabs = ({
33
33
  const filteredChildren = useMemo(() => Children.toArray(children).filter(child => child), [children]);
34
34
  /** Array of the tabIds for the child nodes */
35
35
 
36
- const tabIds = () => {
37
- return filteredChildren.map(child => child.props.tabId);
38
- };
36
+ const tabIds = useMemo(() => filteredChildren.map(child => child.props.tabId), [filteredChildren]);
39
37
  /** Array of refs to the TabTitle nodes */
40
38
 
41
-
42
39
  const tabRefs = useMemo(() => Array.from({
43
40
  length: filteredChildren.length
44
41
  }).map(() => /*#__PURE__*/createRef()), [filteredChildren.length]);
@@ -54,14 +51,14 @@ const Tabs = ({
54
51
  useLayoutEffect(() => {
55
52
  const selectedTab = selectedTabId || Children.toArray(children)[0].props.tabId;
56
53
 
57
- if (!tabIds().includes(selectedTabId)) {
54
+ if (!tabIds.includes(selectedTabId)) {
58
55
  setTabStopId(React.Children.toArray(children)[0].props.tabId);
59
56
  } else {
60
57
  setTabStopId(selectedTab);
61
58
  }
62
59
 
63
- setSelectedTabIdState(selectedTab); // eslint-disable-next-line react-hooks/exhaustive-deps
64
- }, []);
60
+ setSelectedTabIdState(selectedTab);
61
+ }, [children, selectedTabId, tabIds]);
65
62
  const updateErrors = useCallback((id, hasError) => {
66
63
  if (tabsErrors[id] !== hasError) {
67
64
  setTabsErrors({ ...tabsErrors,
@@ -102,6 +99,27 @@ const Tabs = ({
102
99
  onTabChange(tabid);
103
100
  }
104
101
  }, [onTabChange, isTabSelected, hasTabStop]);
102
+ const blurPreviousSelectedTab = useCallback(() => {
103
+ const previousTabIndex = tabIds.indexOf(previousSelectedTabId.current);
104
+ /* istanbul ignore else */
105
+
106
+ if (previousTabIndex !== -1) {
107
+ var _previousTabRef$curre;
108
+
109
+ const previousTabRef = tabRefs[previousTabIndex];
110
+ (_previousTabRef$curre = previousTabRef.current) === null || _previousTabRef$curre === void 0 ? void 0 : _previousTabRef$curre.blur();
111
+ }
112
+ }, [tabIds, tabRefs]);
113
+ useEffect(() => {
114
+ if (previousSelectedTabId.current !== selectedTabId) {
115
+ if (selectedTabId !== selectedTabIdState) {
116
+ setSelectedTabIdState(selectedTabId);
117
+ blurPreviousSelectedTab();
118
+ }
119
+
120
+ previousSelectedTabId.current = selectedTabId;
121
+ }
122
+ }, [blurPreviousSelectedTab, previousSelectedTabId, selectedTabId, selectedTabIdState]);
105
123
  /** Determines if the tab titles are in a vertical format. */
106
124
 
107
125
  const isVertical = currentPosition => currentPosition === "left";
@@ -128,15 +146,14 @@ const Tabs = ({
128
146
  const goToTab = (event, index) => {
129
147
  event.preventDefault();
130
148
  let newIndex = index;
131
- const ids = tabIds();
132
149
 
133
150
  if (index < 0) {
134
- newIndex = ids.length - 1;
135
- } else if (index === ids.length) {
151
+ newIndex = tabIds.length - 1;
152
+ } else if (index === tabIds.length) {
136
153
  newIndex = 0;
137
154
  }
138
155
 
139
- const nextTabId = ids[newIndex];
156
+ const nextTabId = tabIds[newIndex];
140
157
  const nextRef = tabRefs[newIndex];
141
158
  updateVisibleTab(nextTabId);
142
159
  focusTab(nextRef);
@@ -274,15 +291,6 @@ const Tabs = ({
274
291
  return tabs;
275
292
  };
276
293
 
277
- useEffect(() => {
278
- if (previousSelectedTabId.current !== selectedTabId) {
279
- if (selectedTabId !== selectedTabIdState) {
280
- setSelectedTabIdState(selectedTabId);
281
- }
282
-
283
- previousSelectedTabId.current = selectedTabId;
284
- }
285
- }, [previousSelectedTabId, selectedTabId, selectedTabIdState]);
286
294
  return /*#__PURE__*/React.createElement(StyledTabs, _extends({
287
295
  className: className,
288
296
  position: isInSidebar ? "left" : position,
@@ -238,6 +238,9 @@ Input.propTypes = {
238
238
  "contentEditable": _propTypes.default.oneOfType([_propTypes.default.oneOf(["false", "inherit", "true"]), _propTypes.default.bool]),
239
239
  "contextMenu": _propTypes.default.string,
240
240
  "crossOrigin": _propTypes.default.string,
241
+ "css": _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
242
+ "__emotion_styles": _propTypes.default.any.isRequired
243
+ }), _propTypes.default.string, _propTypes.default.bool]),
241
244
  "dangerouslySetInnerHTML": _propTypes.default.shape({
242
245
  "__html": _propTypes.default.string.isRequired
243
246
  }),
@@ -0,0 +1,2 @@
1
+ declare const StyledIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export default StyledIconWrapper;
@@ -13,7 +13,7 @@ var _help = _interopRequireDefault(require("../../components/help/help.style"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const IconWrapperStyle = _styledComponents.default.div`
16
+ const StyledIconWrapper = _styledComponents.default.div`
17
17
  display: inline-block;
18
18
  margin: 0;
19
19
  margin-left: 4px;
@@ -32,5 +32,5 @@ const IconWrapperStyle = _styledComponents.default.div`
32
32
  position: static;
33
33
  }
34
34
  `;
35
- var _default = IconWrapperStyle;
35
+ var _default = StyledIconWrapper;
36
36
  exports.default = _default;
@@ -1 +1,2 @@
1
- export { default } from "./label";
1
+ export { default } from "./label.component";
2
+ export type { LabelProps } from "./label.component";
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { StyledLabelProps, StyledLabelContainerProps } from "./label.style";
3
+ import { ValidationProps } from "../validations";
4
+ import { IconType } from "../../components/icon";
5
+ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLabelContainerProps {
6
+ /** Children elements */
7
+ children?: React.ReactNode;
8
+ /** A message that the Help component will display */
9
+ help?: React.ReactNode;
10
+ /** Icon type */
11
+ helpIcon?: IconType;
12
+ /** Overrides the default tabindex of the Help component */
13
+ helpTabIndex?: string;
14
+ /** A string that represents the ID of another form element */
15
+ htmlFor?: string;
16
+ /** The unique id of the label element */
17
+ labelId?: string;
18
+ /** The unique id of the Help component tooltip, used for accessibility */
19
+ tooltipId?: string;
20
+ /** Whether to show the validation icon */
21
+ useValidationIcon?: boolean;
22
+ /** Id of the validation icon */
23
+ validationIconId?: string;
24
+ }
25
+ export declare const Label: ({ align, children, disabled, error, help, helpIcon, helpTabIndex, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => JSX.Element;
26
+ declare const _default: React.MemoExoticComponent<({ align, children, disabled, error, help, helpIcon, helpTabIndex, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => JSX.Element>;
27
+ export default _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.Label = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
@@ -41,30 +41,30 @@ const tooltipPosition = ({
41
41
  info,
42
42
  inline
43
43
  }) => {
44
- return (error || warning || info) && inline === true ? "top" : "right";
44
+ return (error || warning || info) && inline ? "top" : "right";
45
45
  };
46
46
 
47
47
  const Label = ({
48
- disabled,
49
- inline,
50
48
  align = "right",
51
- width,
52
- optional,
53
- labelId,
54
- tooltipId,
55
49
  children,
50
+ disabled,
56
51
  error,
57
- warning,
58
- info,
59
52
  help,
60
53
  helpIcon,
61
54
  helpTabIndex,
62
- useValidationIcon = true,
63
55
  htmlFor,
56
+ info,
57
+ inline,
58
+ isRequired,
59
+ labelId,
60
+ optional,
64
61
  pr,
65
62
  pl,
66
- isRequired,
67
- validationIconId
63
+ tooltipId,
64
+ useValidationIcon = true,
65
+ validationIconId,
66
+ warning,
67
+ width = 30
68
68
  }) => {
69
69
  const [isFocused, setFocus] = (0, _react.useState)(false);
70
70
  const {
@@ -76,14 +76,14 @@ const Label = ({
76
76
  onMouseLeave: onGroupMouseLeave
77
77
  } = (0, _react.useContext)(_inputBehaviour.InputGroupContext);
78
78
 
79
- const handleMouseEnter = ev => {
80
- if (onMouseEnter) onMouseEnter(ev);
81
- if (onGroupMouseEnter) onGroupMouseEnter(ev);
79
+ const handleMouseEnter = () => {
80
+ if (onMouseEnter) onMouseEnter();
81
+ if (onGroupMouseEnter) onGroupMouseEnter();
82
82
  };
83
83
 
84
- const handleMouseLeave = ev => {
85
- if (onMouseLeave) onMouseLeave(ev);
86
- if (onGroupMouseLeave) onGroupMouseLeave(ev);
84
+ const handleMouseLeave = () => {
85
+ if (onMouseLeave) onMouseLeave();
86
+ if (onGroupMouseLeave) onGroupMouseLeave();
87
87
  };
88
88
 
89
89
  const icon = () => {
@@ -141,66 +141,28 @@ const Label = ({
141
141
  }, children), icon());
142
142
  };
143
143
 
144
+ exports.Label = Label;
144
145
  Label.propTypes = {
145
- /** Label width */
146
- width: _propTypes.default.number,
147
-
148
- /** Label alignment */
149
- align: _propTypes.default.oneOf(["left", "right"]),
150
-
151
- /** When true, label is placed in line an input */
152
- inline: _propTypes.default.bool,
153
-
154
- /** If true, the component will be disabled */
155
- disabled: _propTypes.default.bool,
156
-
157
- /** Flag to configure component as optional in Form */
158
- optional: _propTypes.default.bool,
159
-
160
- /** The unique id of the label element */
161
- labelId: _propTypes.default.string,
162
-
163
- /** The unique id of the Help component tooltip, used for accessibility */
164
- tooltipId: _propTypes.default.string,
165
-
166
- /** Children elements */
167
- children: _propTypes.default.node,
168
-
169
- /** Status of error validations */
170
- error: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
171
-
172
- /** Status of warnings */
173
- warning: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
174
-
175
- /** Status of info */
176
- info: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
177
-
178
- /** A message that the Help component will display */
179
- help: _propTypes.default.node,
180
-
181
- /** Icon type */
182
- helpIcon: _propTypes.default.string,
183
-
184
- /** Overrides the default tabindex of the Help component */
185
- helpTabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
186
-
187
- /** Whether to show the validation icon */
188
- useValidationIcon: _propTypes.default.bool,
189
-
190
- /** A string that represents the ID of another form element */
191
- htmlFor: _propTypes.default.string,
192
-
193
- /** Padding right, integer multiplied by base spacing constant (8) */
194
- pr: _propTypes.default.oneOf([1, 2]),
195
-
196
- /** Padding left, integer multiplied by base spacing constant (8) */
197
- pl: _propTypes.default.oneOf([1, 2]),
198
-
199
- /** Flag to configure component as mandatory */
200
- isRequired: _propTypes.default.bool,
201
-
202
- /** Id of the validation icon */
203
- validationIconId: _propTypes.default.string
146
+ "align": _propTypes.default.oneOf(["left", "right"]),
147
+ "children": _propTypes.default.node,
148
+ "disabled": _propTypes.default.bool,
149
+ "error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
150
+ "help": _propTypes.default.node,
151
+ "helpIcon": _propTypes.default.oneOf(["add", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "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", "copy", "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", "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", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "messages", "minus_large", "minus", "mobile", "money_bag", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "three_boxes", "tick_circle", "tick", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
152
+ "helpTabIndex": _propTypes.default.string,
153
+ "htmlFor": _propTypes.default.string,
154
+ "info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
155
+ "inline": _propTypes.default.bool,
156
+ "isRequired": _propTypes.default.bool,
157
+ "labelId": _propTypes.default.string,
158
+ "optional": _propTypes.default.bool,
159
+ "pl": _propTypes.default.oneOf([1, 2]),
160
+ "pr": _propTypes.default.oneOf([1, 2]),
161
+ "tooltipId": _propTypes.default.string,
162
+ "useValidationIcon": _propTypes.default.bool,
163
+ "validationIconId": _propTypes.default.string,
164
+ "warning": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
165
+ "width": _propTypes.default.number
204
166
  };
205
167
 
206
168
  var _default = /*#__PURE__*/_react.default.memo(Label);
@@ -1,3 +1,23 @@
1
- export const StyledLabelContainer: any;
2
- export default LabelStyle;
3
- declare const LabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
1
+ export interface StyledLabelProps {
2
+ /** If true, the component will be disabled */
3
+ disabled?: boolean;
4
+ /** Flag to configure component as mandatory */
5
+ isRequired?: boolean;
6
+ }
7
+ declare const StyledLabel: import("styled-components").StyledComponent<"label", any, StyledLabelProps, never>;
8
+ export interface StyledLabelContainerProps {
9
+ /** Label alignment */
10
+ align?: "left" | "right";
11
+ /** When true, label is placed in line an input */
12
+ inline?: boolean;
13
+ /** Flag to configure component as optional in Form */
14
+ optional?: boolean;
15
+ /** Padding right, integer multiplied by base spacing constant (8) */
16
+ pr?: 1 | 2;
17
+ /** Padding left, integer multiplied by base spacing constant (8) */
18
+ pl?: 1 | 2;
19
+ /** Label width */
20
+ width?: number;
21
+ }
22
+ export declare const StyledLabelContainer: import("styled-components").StyledComponent<"div", any, StyledLabelContainerProps, never>;
23
+ export default StyledLabel;
@@ -7,15 +7,11 @@ exports.default = exports.StyledLabelContainer = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
15
11
 
16
12
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
13
 
18
- const LabelStyle = _styledComponents.default.label`
14
+ const StyledLabel = _styledComponents.default.label`
19
15
  color: var(--colorsUtilityYin090);
20
16
  display: block;
21
17
  font-weight: 600; //TODO: (tokens) use token var(--fontWeights500)
@@ -37,10 +33,7 @@ const LabelStyle = _styledComponents.default.label`
37
33
  color: var(--colorsUtilityYin030);
38
34
  `}
39
35
  `;
40
- LabelStyle.propTypes = {
41
- disabled: _propTypes.default.bool,
42
- isRequired: _propTypes.default.bool
43
- };
36
+ const DEFAULT_CONTAINER_WIDTH = 30;
44
37
  const StyledLabelContainer = _styledComponents.default.div`
45
38
  display: flex;
46
39
  align-items: center;
@@ -62,7 +55,7 @@ const StyledLabelContainer = _styledComponents.default.div`
62
55
  padding-left: var(${pl === 1 ? "--spacing100" : "--spacing200"});
63
56
  `};
64
57
  justify-content: ${align === "right" ? "flex-end" : "flex-start"};
65
- width: ${width === 0 ? StyledLabelContainer.defaultProps.width : width}%;
58
+ width: ${width || DEFAULT_CONTAINER_WIDTH}%;
66
59
  `}
67
60
 
68
61
  ${({
@@ -76,16 +69,5 @@ const StyledLabelContainer = _styledComponents.default.div`
76
69
  `}
77
70
  `;
78
71
  exports.StyledLabelContainer = StyledLabelContainer;
79
- StyledLabelContainer.defaultProps = {
80
- align: "right",
81
- width: 30
82
- };
83
- StyledLabelContainer.propTypes = {
84
- align: _propTypes.default.oneOf(["left", "right"]),
85
- inline: _propTypes.default.bool,
86
- width: _propTypes.default.number,
87
- pr: _propTypes.default.number,
88
- pl: _propTypes.default.number
89
- };
90
- var _default = LabelStyle;
72
+ var _default = StyledLabel;
91
73
  exports.default = _default;
@@ -13,41 +13,11 @@ declare const Events: {
13
13
  * A method to determine if an event is of a particular type
14
14
  * */
15
15
  isEventType: (ev: React.SyntheticEvent | Event, type: string) => boolean;
16
- /**
17
- * A method to determine whether a key down event was an arrow key
18
- * */
19
- isNavigationKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
20
- /**
21
- * A method to determine whether a key down event was an enter key
22
- * */
23
- isEnterKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
24
- /**
25
- * A method to determine whether a key up event is allowed or not.
26
- * */
27
- isValidKeypress: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
28
16
  /**
29
17
  * Determines if a number key along the top of the keyboard or a number key on the
30
18
  * keypad is pressed
31
19
  * */
32
20
  isNumberKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
33
- /**
34
- * Determines if the key pressed is part of the numpad
35
- * includes symbols
36
- * */
37
- isNumpadKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
38
- /**
39
- * Determines if the key pressed is a alphabet key
40
- * Case insensitive
41
- * */
42
- isAlphabetKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
43
- /**
44
- * Determines if the key pressed is a valid symbol
45
- * */
46
- isSymbolKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
47
- /**
48
- * Determines if the key pressed is a navigation key
49
- * */
50
- isNavigationKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
51
21
  /**
52
22
  * Determines if the key pressed is a navigation left key
53
23
  * */
@@ -64,10 +34,6 @@ declare const Events: {
64
34
  * Determines if the key pressed is a navigation down key
65
35
  * */
66
36
  isDownKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
67
- /**
68
- * Determines if the key pressed is a meta key
69
- * */
70
- isMetaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
71
37
  /**
72
38
  * Determines if the key pressed is the escape key
73
39
  * */
@@ -80,18 +46,6 @@ declare const Events: {
80
46
  * Determines if the key pressed is the tab key
81
47
  * */
82
48
  isTabKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
83
- /**
84
- * Determines if the key pressed is the backspace key
85
- * */
86
- isBackspaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
87
- /**
88
- * Determines if the key pressed is the delete key
89
- * */
90
- isDeleteKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
91
- /**
92
- * Determines if the key pressed is the backspace or delete key
93
- * */
94
- isDeletingKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
95
49
  /**
96
50
  * Determines if the key pressed is the shift key
97
51
  * */
@@ -104,18 +58,6 @@ declare const Events: {
104
58
  * Determines if the key pressed is the space key or enter key
105
59
  * */
106
60
  isEnterOrSpaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
107
- /**
108
- * Determines if the key pressed is the period key
109
- * */
110
- isPeriodKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
111
- /**
112
- * Determines if the key pressed is the comma key
113
- * */
114
- isCommaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
115
- /**
116
- * Determines if the key pressed is the minus key
117
- * */
118
- isMinusKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
119
61
  /**
120
62
  * Determines if the key pressed is the home key
121
63
  * */