carbon-react 106.0.2 → 106.0.3

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 (114) hide show
  1. package/esm/__internal__/input/index.d.ts +5 -5
  2. package/esm/__internal__/input/input-presentation.component.d.ts +21 -27
  3. package/esm/__internal__/input/input-presentation.component.js +7 -20
  4. package/esm/__internal__/input/input-presentation.style.d.ts +5 -8
  5. package/esm/__internal__/input/input-presentation.style.js +37 -53
  6. package/esm/__internal__/input/input-sizes.style.d.ts +8 -18
  7. package/esm/__internal__/input/input-sizes.style.js +3 -2
  8. package/esm/__internal__/input/input.component.d.ts +39 -2
  9. package/esm/__internal__/input/input.component.js +84 -66
  10. package/esm/__internal__/input/input.style.d.ts +2 -1
  11. package/esm/__internal__/input/input.style.js +0 -4
  12. package/esm/__internal__/input-behaviour/index.d.ts +2 -1
  13. package/esm/__internal__/input-behaviour/input-behaviour.component.d.ts +7 -10
  14. package/esm/__internal__/input-behaviour/input-behaviour.component.js +2 -7
  15. package/esm/__internal__/input-behaviour/input-group-behaviour.component.d.ts +8 -12
  16. package/esm/__internal__/input-behaviour/input-group-behaviour.component.js +1 -7
  17. package/esm/__internal__/input-behaviour/useInputBehaviour.d.ts +14 -10
  18. package/esm/__internal__/label/label.d.ts +1 -1
  19. package/esm/components/badge/badge.component.d.ts +10 -13
  20. package/esm/components/badge/badge.component.js +60 -24
  21. package/esm/components/badge/badge.style.d.ts +7 -5
  22. package/esm/components/badge/index.d.ts +2 -1
  23. package/esm/components/carbon-provider/carbon-provider.component.d.ts +8 -14
  24. package/esm/components/carbon-provider/carbon-provider.component.js +110 -14
  25. package/esm/components/carbon-provider/index.d.ts +2 -1
  26. package/esm/components/date-range/date-range.style.js +2 -2
  27. package/esm/components/decimal/decimal.component.js +2 -1
  28. package/esm/components/heading/heading.style.d.ts +1 -2
  29. package/esm/components/inline-inputs/index.d.ts +2 -1
  30. package/esm/components/inline-inputs/index.js +1 -1
  31. package/esm/components/inline-inputs/inline-inputs.component.d.ts +25 -22
  32. package/esm/components/inline-inputs/inline-inputs.component.js +96 -60
  33. package/esm/components/inline-inputs/inline-inputs.config.d.ts +1 -1
  34. package/esm/components/inline-inputs/inline-inputs.style.d.ts +5 -3
  35. package/esm/components/inline-inputs/inline-inputs.style.js +2 -2
  36. package/esm/components/link/index.d.ts +1 -2
  37. package/esm/components/link/link.component.d.ts +37 -2
  38. package/esm/components/link/link.component.js +1243 -124
  39. package/esm/components/link/link.config.d.ts +2 -2
  40. package/esm/components/link/link.style.d.ts +7 -2
  41. package/esm/components/link/link.style.js +0 -5
  42. package/esm/components/pager/pager.style.d.ts +1 -2
  43. package/esm/components/pod/pod.style.d.ts +1 -2
  44. package/esm/components/simple-color-picker/simple-color-input/simple-color-input.style.d.ts +1 -1
  45. package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
  46. package/esm/components/tile-select/tile-select.style.d.ts +1 -1
  47. package/lib/__internal__/input/index.d.ts +5 -5
  48. package/lib/__internal__/input/input-presentation.component.d.ts +21 -27
  49. package/lib/__internal__/input/input-presentation.component.js +7 -23
  50. package/lib/__internal__/input/input-presentation.style.d.ts +5 -8
  51. package/lib/__internal__/input/input-presentation.style.js +37 -54
  52. package/lib/__internal__/input/input-sizes.style.d.ts +8 -18
  53. package/lib/__internal__/input/input-sizes.style.js +2 -1
  54. package/lib/__internal__/input/input.component.d.ts +39 -2
  55. package/lib/__internal__/input/input.component.js +85 -69
  56. package/lib/__internal__/input/input.style.d.ts +2 -1
  57. package/lib/__internal__/input/input.style.js +0 -7
  58. package/lib/__internal__/input-behaviour/index.d.ts +2 -1
  59. package/lib/__internal__/input-behaviour/input-behaviour.component.d.ts +7 -10
  60. package/lib/__internal__/input-behaviour/input-behaviour.component.js +3 -10
  61. package/lib/__internal__/input-behaviour/input-group-behaviour.component.d.ts +8 -12
  62. package/lib/__internal__/input-behaviour/input-group-behaviour.component.js +2 -10
  63. package/lib/__internal__/input-behaviour/useInputBehaviour.d.ts +14 -10
  64. package/lib/__internal__/label/label.d.ts +1 -1
  65. package/lib/components/badge/badge.component.d.ts +10 -13
  66. package/lib/components/badge/badge.component.js +51 -29
  67. package/lib/components/badge/badge.style.d.ts +7 -5
  68. package/lib/components/badge/index.d.ts +2 -1
  69. package/lib/components/carbon-provider/carbon-provider.component.d.ts +8 -14
  70. package/lib/components/carbon-provider/carbon-provider.component.js +115 -20
  71. package/lib/components/carbon-provider/index.d.ts +2 -1
  72. package/lib/components/date-range/date-range.style.js +4 -4
  73. package/lib/components/decimal/decimal.component.js +2 -1
  74. package/lib/components/heading/heading.style.d.ts +1 -2
  75. package/lib/components/inline-inputs/index.d.ts +2 -1
  76. package/lib/components/inline-inputs/index.js +10 -2
  77. package/lib/components/inline-inputs/inline-inputs.component.d.ts +25 -22
  78. package/lib/components/inline-inputs/inline-inputs.component.js +143 -68
  79. package/lib/components/inline-inputs/inline-inputs.config.d.ts +1 -1
  80. package/lib/components/inline-inputs/inline-inputs.style.d.ts +5 -3
  81. package/lib/components/inline-inputs/inline-inputs.style.js +2 -2
  82. package/lib/components/link/index.d.ts +1 -2
  83. package/lib/components/link/link.component.d.ts +37 -2
  84. package/lib/components/link/link.component.js +764 -146
  85. package/lib/components/link/link.config.d.ts +2 -2
  86. package/lib/components/link/link.style.d.ts +7 -2
  87. package/lib/components/link/link.style.js +0 -6
  88. package/lib/components/pager/pager.style.d.ts +1 -2
  89. package/lib/components/pod/pod.style.d.ts +1 -2
  90. package/lib/components/simple-color-picker/simple-color-input/simple-color-input.style.d.ts +1 -1
  91. package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
  92. package/lib/components/tile-select/tile-select.style.d.ts +1 -1
  93. package/package.json +1 -1
  94. package/esm/__internal__/input/extract-props/extract-props.d.ts +0 -1
  95. package/esm/__internal__/input/extract-props/extract-props.js +0 -11
  96. package/esm/__internal__/input/extract-props/index.d.ts +0 -1
  97. package/esm/__internal__/input/extract-props/index.js +0 -1
  98. package/esm/__internal__/input/input-presentation.d.ts +0 -24
  99. package/esm/__internal__/input/input.d.ts +0 -54
  100. package/esm/components/badge/badge.d.ts +0 -14
  101. package/esm/components/carbon-provider/carbon-provider.d.ts +0 -12
  102. package/esm/components/inline-inputs/inline-inputs.d.ts +0 -30
  103. package/esm/components/link/link.d.ts +0 -47
  104. package/lib/__internal__/input/extract-props/extract-props.d.ts +0 -1
  105. package/lib/__internal__/input/extract-props/extract-props.js +0 -18
  106. package/lib/__internal__/input/extract-props/index.d.ts +0 -1
  107. package/lib/__internal__/input/extract-props/index.js +0 -15
  108. package/lib/__internal__/input/extract-props/package.json +0 -6
  109. package/lib/__internal__/input/input-presentation.d.ts +0 -24
  110. package/lib/__internal__/input/input.d.ts +0 -54
  111. package/lib/components/badge/badge.d.ts +0 -14
  112. package/lib/components/carbon-provider/carbon-provider.d.ts +0 -12
  113. package/lib/components/inline-inputs/inline-inputs.d.ts +0 -30
  114. package/lib/components/link/link.d.ts +0 -47
@@ -1,14 +1,11 @@
1
- export default Badge;
2
- declare function Badge({ children, counter, onClick }: {
3
- children: any;
4
- counter: any;
5
- onClick: any;
6
- }): JSX.Element;
7
- declare namespace Badge {
8
- namespace propTypes {
9
- const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
10
- const counter: PropTypes.Requireable<string | number>;
11
- const onClick: PropTypes.Requireable<(...args: any[]) => any>;
12
- }
1
+ import React from "react";
2
+ export interface BadgeProps {
3
+ /** The badge will be added to this element */
4
+ children: React.ReactNode;
5
+ /** The number rendered in the badge component */
6
+ counter?: string | number;
7
+ /** Callback fired when badge is clicked */
8
+ onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
13
9
  }
14
- import PropTypes from "prop-types";
10
+ export declare const Badge: ({ children, counter, onClick }: BadgeProps) => JSX.Element;
11
+ export default Badge;
@@ -1,32 +1,68 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { StyledBadgeWrapper, StyledButton, StyledCrossIcon, StyledCounter } from "./badge.style";
4
-
5
- const Badge = ({
6
- children,
7
- counter,
8
- onClick
9
- }) => {
10
- return /*#__PURE__*/React.createElement(StyledBadgeWrapper, null, counter > 0 && /*#__PURE__*/React.createElement(StyledButton, {
11
- "data-component": "badge",
12
- buttonType: "secondary",
13
- onClick: onClick
14
- }, /*#__PURE__*/React.createElement(StyledCrossIcon, {
15
- "data-element": "badge-cross-icon",
16
- type: "cross"
17
- }), /*#__PURE__*/React.createElement(StyledCounter, {
18
- "data-element": "badge-counter"
19
- }, counter > 99 ? 99 : counter)), children);
3
+ import {
4
+ StyledBadgeWrapper,
5
+ StyledButton,
6
+ StyledCrossIcon,
7
+ StyledCounter,
8
+ } from "./badge.style";
9
+ const Badge = ({ children, counter = 0, onClick }) => {
10
+ return /*#__PURE__*/ React.createElement(
11
+ StyledBadgeWrapper,
12
+ null,
13
+ counter > 0 &&
14
+ /*#__PURE__*/ React.createElement(
15
+ StyledButton,
16
+ {
17
+ "data-component": "badge",
18
+ buttonType: "secondary",
19
+ onClick: onClick,
20
+ },
21
+ /*#__PURE__*/ React.createElement(StyledCrossIcon, {
22
+ "data-element": "badge-cross-icon",
23
+ type: "cross",
24
+ }),
25
+ /*#__PURE__*/ React.createElement(
26
+ StyledCounter,
27
+ {
28
+ "data-element": "badge-counter",
29
+ },
30
+ counter > 99 ? 99 : counter
31
+ )
32
+ ),
33
+ children
34
+ );
20
35
  };
21
36
 
22
37
  Badge.propTypes = {
23
- /** The badge will be added to this element */
24
- children: PropTypes.node.isRequired,
25
-
26
- /** The number rendered in the badge component */
38
+ /**
39
+ * The badge will be added to this element
40
+ */
41
+ children: PropTypes.node,
42
+ /**
43
+ * The number rendered in the badge component
44
+ */
27
45
  counter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
46
+ /**
47
+ * Callback fired when badge is clicked
48
+ */
49
+ onClick: PropTypes.func,
50
+ };
28
51
 
29
- /** Callback fired when badge is clicked */
30
- onClick: PropTypes.func
52
+ Badge.propTypes = {
53
+ /**
54
+ * The badge will be added to this element
55
+ */
56
+ children: PropTypes.node,
57
+ /**
58
+ * The number rendered in the badge component
59
+ */
60
+ counter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
61
+ /**
62
+ * Callback fired when badge is clicked
63
+ */
64
+ onClick: PropTypes.func,
31
65
  };
32
- export default Badge;
66
+
67
+ export { Badge };
68
+ export default Badge;
@@ -1,8 +1,10 @@
1
- export const StyledBadgeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export const StyledButton: import("styled-components").StyledComponent<{
1
+ /// <reference types="react" />
2
+ import Icon from "../icon";
3
+ declare const StyledBadgeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ declare const StyledCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ declare const StyledButton: import("styled-components").StyledComponent<{
3
6
  ({ size, subtext, as, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: import("../button").ButtonProps): JSX.Element;
4
7
  displayName: string;
5
8
  }, any, {}, never>;
6
- export const StyledCrossIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
7
- export const StyledCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
8
- import Icon from "../icon";
9
+ declare const StyledCrossIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
10
+ export { StyledBadgeWrapper, StyledButton, StyledCrossIcon, StyledCounter };
@@ -1 +1,2 @@
1
- export { default } from "./badge";
1
+ export { default } from "./badge.component";
2
+ export type { BadgeProps } from "./badge.component";
@@ -1,16 +1,10 @@
1
- export const NewValidationContext: React.Context<{}>;
2
- export default CarbonProvider;
3
1
  import React from "react";
4
- declare function CarbonProvider({ children, theme, validationRedesignOptIn, }: {
5
- children: any;
6
- theme?: import("../../style/themes/base").ThemeObject | undefined;
7
- validationRedesignOptIn?: boolean | undefined;
8
- }): JSX.Element;
9
- declare namespace CarbonProvider {
10
- namespace propTypes {
11
- const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
12
- const theme: PropTypes.Requireable<object>;
13
- const validationRedesignOptIn: PropTypes.Requireable<boolean>;
14
- }
2
+ import { ThemeObject } from "../../style/themes/base";
3
+ export interface CarbonProviderProps {
4
+ theme?: ThemeObject;
5
+ children: React.ReactNode;
6
+ validationRedesignOptIn?: boolean;
15
7
  }
16
- import PropTypes from "prop-types";
8
+ export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn">>;
9
+ export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, }: CarbonProviderProps) => JSX.Element;
10
+ export default CarbonProvider;
@@ -3,23 +3,119 @@ import PropTypes from "prop-types";
3
3
  import { ThemeProvider } from "styled-components";
4
4
  import mintTheme from "../../style/themes/mint";
5
5
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider";
6
- export const NewValidationContext = /*#__PURE__*/createContext({});
7
-
6
+ export const NewValidationContext = /*#__PURE__*/ createContext({});
8
7
  const CarbonProvider = ({
9
8
  children,
10
9
  theme = mintTheme,
11
- validationRedesignOptIn = false
12
- }) => /*#__PURE__*/React.createElement(ThemeProvider, {
13
- theme: theme
14
- }, /*#__PURE__*/React.createElement(CarbonScopedTokensProvider, null, /*#__PURE__*/React.createElement(NewValidationContext.Provider, {
15
- value: {
16
- validationRedesignOptIn
17
- }
18
- }, children)));
10
+ validationRedesignOptIn = false,
11
+ }) =>
12
+ /*#__PURE__*/ React.createElement(
13
+ ThemeProvider,
14
+ {
15
+ theme: theme,
16
+ },
17
+ /*#__PURE__*/ React.createElement(
18
+ CarbonScopedTokensProvider,
19
+ null,
20
+ /*#__PURE__*/ React.createElement(
21
+ NewValidationContext.Provider,
22
+ {
23
+ value: {
24
+ validationRedesignOptIn,
25
+ },
26
+ },
27
+ children
28
+ )
29
+ )
30
+ );
19
31
 
20
32
  CarbonProvider.propTypes = {
21
- children: PropTypes.node.isRequired,
22
- theme: PropTypes.object,
23
- validationRedesignOptIn: PropTypes.bool
33
+ children: PropTypes.node,
34
+ theme: PropTypes.shape({
35
+ colors: PropTypes.shape({
36
+ destructive: PropTypes.shape({
37
+ hover: PropTypes.string.isRequired,
38
+ }).isRequired,
39
+ error: PropTypes.string.isRequired,
40
+ focus: PropTypes.string.isRequired,
41
+ info: PropTypes.string.isRequired,
42
+ loadingBarBackground: PropTypes.string.isRequired,
43
+ placeholder: PropTypes.string.isRequired,
44
+ primary: PropTypes.string.isRequired,
45
+ secondary: PropTypes.string.isRequired,
46
+ tertiary: PropTypes.string.isRequired,
47
+ warning: PropTypes.string.isRequired,
48
+ warningText: PropTypes.string.isRequired,
49
+ white: PropTypes.oneOf(["#FFFFFF"]).isRequired,
50
+ }).isRequired,
51
+ disabled: PropTypes.shape({
52
+ background: PropTypes.string.isRequired,
53
+ }).isRequired,
54
+ name: PropTypes.string.isRequired,
55
+ palette: PropTypes.shape({
56
+ blackOpacity: PropTypes.func.isRequired,
57
+ whiteOpacity: PropTypes.func.isRequired,
58
+ }).isRequired,
59
+ space: PropTypes.arrayOf(PropTypes.string).isRequired,
60
+ spacing: PropTypes.number.isRequired,
61
+ zIndex: PropTypes.shape({
62
+ aboveAll: PropTypes.number.isRequired,
63
+ fullScreenModal: PropTypes.number.isRequired,
64
+ header: PropTypes.number.isRequired,
65
+ modal: PropTypes.number.isRequired,
66
+ nav: PropTypes.number.isRequired,
67
+ notification: PropTypes.number.isRequired,
68
+ overlay: PropTypes.number.isRequired,
69
+ popover: PropTypes.number.isRequired,
70
+ smallOverlay: PropTypes.number.isRequired,
71
+ }).isRequired,
72
+ }),
73
+ validationRedesignOptIn: PropTypes.bool,
24
74
  };
25
- export default CarbonProvider;
75
+
76
+ CarbonProvider.propTypes = {
77
+ children: PropTypes.node,
78
+ theme: PropTypes.shape({
79
+ colors: PropTypes.shape({
80
+ destructive: PropTypes.shape({
81
+ hover: PropTypes.string.isRequired,
82
+ }).isRequired,
83
+ error: PropTypes.string.isRequired,
84
+ focus: PropTypes.string.isRequired,
85
+ info: PropTypes.string.isRequired,
86
+ loadingBarBackground: PropTypes.string.isRequired,
87
+ placeholder: PropTypes.string.isRequired,
88
+ primary: PropTypes.string.isRequired,
89
+ secondary: PropTypes.string.isRequired,
90
+ tertiary: PropTypes.string.isRequired,
91
+ warning: PropTypes.string.isRequired,
92
+ warningText: PropTypes.string.isRequired,
93
+ white: PropTypes.oneOf(["#FFFFFF"]).isRequired,
94
+ }).isRequired,
95
+ disabled: PropTypes.shape({
96
+ background: PropTypes.string.isRequired,
97
+ }).isRequired,
98
+ name: PropTypes.string.isRequired,
99
+ palette: PropTypes.shape({
100
+ blackOpacity: PropTypes.func.isRequired,
101
+ whiteOpacity: PropTypes.func.isRequired,
102
+ }).isRequired,
103
+ space: PropTypes.arrayOf(PropTypes.string).isRequired,
104
+ spacing: PropTypes.number.isRequired,
105
+ zIndex: PropTypes.shape({
106
+ aboveAll: PropTypes.number.isRequired,
107
+ fullScreenModal: PropTypes.number.isRequired,
108
+ header: PropTypes.number.isRequired,
109
+ modal: PropTypes.number.isRequired,
110
+ nav: PropTypes.number.isRequired,
111
+ notification: PropTypes.number.isRequired,
112
+ overlay: PropTypes.number.isRequired,
113
+ popover: PropTypes.number.isRequired,
114
+ smallOverlay: PropTypes.number.isRequired,
115
+ }).isRequired,
116
+ }),
117
+ validationRedesignOptIn: PropTypes.bool,
118
+ };
119
+
120
+ export { CarbonProvider };
121
+ export default CarbonProvider;
@@ -1 +1,2 @@
1
- export { default } from "./carbon-provider";
1
+ export { default } from "./carbon-provider.component";
2
+ export type { CarbonProviderProps } from "./carbon-provider.component";
@@ -1,8 +1,8 @@
1
1
  import styled from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import StyledDateInput from "../date/date.style";
4
- import { StyledLabelContainer } from "../../__internal__/label/label.style.js";
5
- import { StyledInputPresentationContainer } from "../../__internal__/input/input-presentation.style.js";
4
+ import { StyledLabelContainer } from "../../__internal__/label/label.style";
5
+ import { StyledInputPresentationContainer } from "../../__internal__/input/input-presentation.style";
6
6
  import baseTheme from "../../style/themes/base";
7
7
  const StyledDateRange = styled.div`
8
8
  ${margin}
@@ -190,7 +190,8 @@ const Decimal = ({
190
190
  onChange: handleOnChange,
191
191
  onBlur: handleOnBlur,
192
192
  value: stateValue,
193
- "data-component": "decimal"
193
+ "data-component": "decimal",
194
+ id: id
194
195
  }, rest)), /*#__PURE__*/React.createElement("input", {
195
196
  name: name,
196
197
  value: toStandardDecimal(stateValue),
@@ -7,9 +7,8 @@ export const StyledHeaderHelp: import("styled-components").StyledComponent<typeo
7
7
  export const StyledHeadingTitle: import("styled-components").StyledComponent<typeof Typography, any, {}, never>;
8
8
  export const StyledDivider: import("styled-components").StyledComponent<({ adaptiveMxBreakpoint, ml, mr, ...rest }: import("../hr/hr.component").HrProps) => JSX.Element, any, {}, never>;
9
9
  export const StyledHeaderContent: import("styled-components").StyledComponent<"div", any, {}, never>;
10
- export const StyledHeadingBackButton: import("styled-components").StyledComponent<typeof Link, any, {}, never>;
10
+ export const StyledHeadingBackButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../link/link.component").LinkProps & import("react").RefAttributes<HTMLLinkElement | HTMLButtonElement>>, any, {}, never>;
11
11
  export const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
12
12
  import Icon from "../icon";
13
13
  import Help from "../help";
14
14
  import Typography from "../typography";
15
- import Link from "../link";
@@ -1 +1,2 @@
1
- export { default } from "./inline-inputs";
1
+ export { default, InlineInputsContext } from "./inline-inputs.component";
2
+ export type { InlineInputsProps } from "./inline-inputs.component";
@@ -1 +1 @@
1
- export { default } from "./inline-inputs.component";
1
+ export { default, InlineInputsContext } from "./inline-inputs.component";
@@ -1,24 +1,27 @@
1
- export const InlineInputsContext: React.Context<{}>;
2
- export default InlineInputs;
3
1
  import React from "react";
4
- declare function InlineInputs(props: any): JSX.Element;
5
- declare namespace InlineInputs {
6
- namespace propTypes {
7
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
8
- const className: PropTypes.Requireable<string>;
9
- const label: PropTypes.Requireable<string>;
10
- const htmlFor: PropTypes.Requireable<string>;
11
- const gutter: PropTypes.Requireable<string>;
12
- const inputWidth: PropTypes.Requireable<number>;
13
- const labelWidth: PropTypes.Requireable<number>;
14
- }
15
- namespace defaultProps {
16
- const children_1: null;
17
- export { children_1 as children };
18
- const className_1: string;
19
- export { className_1 as className };
20
- const gutter_1: string;
21
- export { gutter_1 as gutter };
22
- }
2
+ interface InlineInputsContextProps {
3
+ ariaLabelledBy?: string;
4
+ }
5
+ declare type GutterOptions = "none" | "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
6
+ export interface InlineInputsProps {
7
+ /** Children elements */
8
+ children?: React.ReactNode;
9
+ /** [Legacy prop] A custom class name for the component. */
10
+ className?: string;
11
+ /** Gutter prop gets passed down to Row component if false gutter value is "none" */
12
+ gutter?: GutterOptions;
13
+ /** The id of the corresponding input control for the label */
14
+ htmlFor?: string;
15
+ /** Width of the inline inputs container in percentage */
16
+ inputWidth?: number;
17
+ /** Defines the label text for the heading. */
18
+ label?: string;
19
+ /** Width of a label in percentage */
20
+ labelWidth?: number;
23
21
  }
24
- import PropTypes from "prop-types";
22
+ export declare const InlineInputsContext: React.Context<InlineInputsContextProps>;
23
+ declare const InlineInputs: {
24
+ ({ label, htmlFor, children, className, gutter, inputWidth, labelWidth, }: InlineInputsProps): JSX.Element;
25
+ displayName: string;
26
+ };
27
+ export default InlineInputs;
@@ -1,82 +1,118 @@
1
1
  import React, { useRef } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import Label from "../../__internal__/label";
4
- import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from "./inline-inputs.style";
4
+ import StyledInlineInputs, {
5
+ StyledContentContainer,
6
+ StyledInlineInput,
7
+ } from "./inline-inputs.style";
5
8
  import createGuid from "../../__internal__/utils/helpers/guid";
6
- export const InlineInputsContext = /*#__PURE__*/React.createContext({});
9
+ export const InlineInputsContext = /*#__PURE__*/ React.createContext({});
7
10
 
8
11
  const columnWrapper = (children, gutter, labelId) => {
9
- return React.Children.map(children, input => {
10
- return /*#__PURE__*/React.createElement(InlineInputsContext.Provider, {
11
- value: {
12
- ariaLabelledBy: labelId
13
- }
14
- }, /*#__PURE__*/React.createElement(StyledInlineInput, {
15
- gutter: gutter,
16
- "data-element": "inline-input"
17
- }, input));
12
+ return React.Children.map(children, (input) => {
13
+ return /*#__PURE__*/ React.createElement(
14
+ InlineInputsContext.Provider,
15
+ {
16
+ value: {
17
+ ariaLabelledBy: labelId,
18
+ },
19
+ },
20
+ /*#__PURE__*/ React.createElement(
21
+ StyledInlineInput,
22
+ {
23
+ gutter: gutter,
24
+ "data-element": "inline-input",
25
+ },
26
+ input
27
+ )
28
+ );
18
29
  });
19
30
  };
20
31
 
21
- const InlineInputs = props => {
22
- const {
23
- label,
24
- htmlFor,
25
- children,
26
- className,
27
- gutter,
28
- inputWidth,
29
- labelWidth
30
- } = props;
32
+ const InlineInputs = ({
33
+ label,
34
+ htmlFor,
35
+ children = null,
36
+ className = "",
37
+ gutter = "none",
38
+ inputWidth,
39
+ labelWidth,
40
+ }) => {
31
41
  const labelId = useRef(createGuid());
32
42
 
33
43
  function renderLabel() {
34
44
  if (!label) return null;
35
- return /*#__PURE__*/React.createElement(Label, {
36
- labelId: labelId.current,
37
- inline: true,
38
- htmlFor: htmlFor
39
- }, label);
45
+ return /*#__PURE__*/ React.createElement(
46
+ Label,
47
+ {
48
+ labelId: labelId.current,
49
+ inline: true,
50
+ htmlFor: htmlFor,
51
+ },
52
+ label
53
+ );
40
54
  }
41
55
 
42
- return /*#__PURE__*/React.createElement(StyledInlineInputs, {
43
- gutter: gutter,
44
- "data-component": "inline-inputs",
45
- className: className,
46
- labelWidth: labelWidth
47
- }, renderLabel(), /*#__PURE__*/React.createElement(StyledContentContainer, {
48
- gutter: gutter,
49
- "data-element": "inline-inputs-container",
50
- inputWidth: inputWidth
51
- }, columnWrapper(children, gutter, label ? labelId.current : undefined)));
52
- }; // Assign props over for demo site
53
-
56
+ return /*#__PURE__*/ React.createElement(
57
+ StyledInlineInputs,
58
+ {
59
+ gutter: gutter,
60
+ "data-component": "inline-inputs",
61
+ className: className,
62
+ labelWidth: labelWidth,
63
+ },
64
+ renderLabel(),
65
+ /*#__PURE__*/ React.createElement(
66
+ StyledContentContainer,
67
+ {
68
+ gutter: gutter,
69
+ "data-element": "inline-inputs-container",
70
+ inputWidth: inputWidth,
71
+ },
72
+ columnWrapper(children, gutter, label ? labelId.current : undefined)
73
+ )
74
+ );
75
+ };
54
76
 
55
77
  InlineInputs.propTypes = {
56
- /** Children elements */
78
+ /**
79
+ * Children elements
80
+ */
57
81
  children: PropTypes.node,
58
-
59
- /** [Legacy prop] A custom class name for the component. */
82
+ /**
83
+ * [Legacy prop] A custom class name for the component.
84
+ */
60
85
  className: PropTypes.string,
61
-
62
- /** Defines the label text for the heading. */
63
- label: PropTypes.string,
64
-
65
- /** The id of the corresponding input control for the label */
86
+ /**
87
+ * Gutter prop gets passed down to Row component if false gutter value is "none"
88
+ */
89
+ gutter: PropTypes.oneOf([
90
+ "extra-large",
91
+ "extra-small",
92
+ "large",
93
+ "medium-large",
94
+ "medium-small",
95
+ "medium",
96
+ "none",
97
+ "small",
98
+ ]),
99
+ /**
100
+ * The id of the corresponding input control for the label
101
+ */
66
102
  htmlFor: PropTypes.string,
67
-
68
- /** Gutter prop gets passed down to Row component if false gutter value is "none" */
69
- gutter: PropTypes.oneOf(["none", "extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large"]),
70
-
71
- /** Width of the inline inputs container in percentage */
103
+ /**
104
+ * Width of the inline inputs container in percentage
105
+ */
72
106
  inputWidth: PropTypes.number,
73
-
74
- /** Width of a label in percentage */
75
- labelWidth: PropTypes.number
76
- };
77
- InlineInputs.defaultProps = {
78
- children: null,
79
- className: "",
80
- gutter: "none"
107
+ /**
108
+ * Defines the label text for the heading.
109
+ */
110
+ label: PropTypes.string,
111
+ /**
112
+ * Width of a label in percentage
113
+ */
114
+ labelWidth: PropTypes.number,
81
115
  };
82
- export default InlineInputs;
116
+
117
+ InlineInputs.displayName = "InlineInputs";
118
+ export default InlineInputs;
@@ -1 +1 @@
1
- export const INLINE_INPUTS_SIZES: string[];
1
+ export declare const INLINE_INPUTS_SIZES: string[];
@@ -1,4 +1,6 @@
1
+ import { InlineInputsProps } from "./inline-inputs.component";
2
+ declare const StyledInlineInput: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "gutter">, never>;
3
+ declare const StyledContentContainer: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "inputWidth" | "gutter">, never>;
4
+ declare const StyledInlineInputs: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "labelWidth" | "gutter">, never>;
5
+ export { StyledContentContainer, StyledInlineInput };
1
6
  export default StyledInlineInputs;
2
- export const StyledContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export const StyledInlineInput: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- declare const StyledInlineInputs: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -17,7 +17,7 @@ const StyledInlineInput = styled.div`
17
17
 
18
18
  ${({
19
19
  gutter
20
- }) => css`
20
+ }) => gutter && css`
21
21
  margin-bottom: 0;
22
22
  padding-left: ${spacings[gutter]}px;
23
23
  `}
@@ -30,7 +30,7 @@ const StyledContentContainer = styled.div`
30
30
 
31
31
  ${({
32
32
  gutter
33
- }) => css`
33
+ }) => gutter && css`
34
34
  margin-bottom: 0;
35
35
  margin-left: -${spacings[gutter]}px;
36
36
 
@@ -1,2 +1 @@
1
- export { default } from "./link";
2
- export * from "./link";
1
+ export { default } from "./link.component";