carbon-react 125.6.0 → 125.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/esm/__internal__/fieldset/fieldset.component.d.ts +13 -1
  2. package/esm/__internal__/fieldset/fieldset.component.js +20 -4
  3. package/esm/__internal__/fieldset/fieldset.style.d.ts +6 -1
  4. package/esm/__internal__/fieldset/fieldset.style.js +27 -1
  5. package/esm/__internal__/label/label.component.d.ts +6 -2
  6. package/esm/__internal__/label/label.component.js +7 -3
  7. package/esm/components/accordion/accordion.component.d.ts +3 -3
  8. package/esm/components/accordion/accordion.component.js +31 -12
  9. package/esm/components/accordion/accordion.style.d.ts +9 -3
  10. package/esm/components/accordion/accordion.style.js +54 -18
  11. package/esm/components/box/box.component.d.ts +2 -0
  12. package/esm/components/box/box.component.js +4 -1
  13. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
  14. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
  15. package/esm/components/button-toggle/button-toggle.style.d.ts +15 -0
  16. package/esm/components/button-toggle/button-toggle.style.js +3 -3
  17. package/esm/components/heading/heading.style.d.ts +1 -1
  18. package/esm/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
  19. package/esm/components/time/__internal__/time-toggle/index.d.ts +2 -0
  20. package/esm/components/time/__internal__/time-toggle/index.js +1 -0
  21. package/esm/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
  22. package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +52 -0
  23. package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
  24. package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +19 -0
  25. package/esm/components/time/index.d.ts +2 -0
  26. package/esm/components/time/index.js +1 -0
  27. package/esm/components/time/time.component.d.ts +73 -0
  28. package/esm/components/time/time.component.js +428 -0
  29. package/esm/components/time/time.style.d.ts +6 -0
  30. package/esm/components/time/time.style.js +19 -0
  31. package/esm/components/typography/typography.component.d.ts +7 -1
  32. package/esm/components/typography/typography.component.js +3 -1
  33. package/esm/components/typography/typography.style.js +5 -0
  34. package/esm/global.d.ts +1 -0
  35. package/esm/locales/__internal__/pl-pl.js +8 -0
  36. package/esm/locales/en-gb.js +8 -0
  37. package/esm/locales/locale.d.ts +8 -0
  38. package/lib/__internal__/fieldset/fieldset.component.d.ts +13 -1
  39. package/lib/__internal__/fieldset/fieldset.component.js +19 -3
  40. package/lib/__internal__/fieldset/fieldset.style.d.ts +6 -1
  41. package/lib/__internal__/fieldset/fieldset.style.js +27 -1
  42. package/lib/__internal__/label/label.component.d.ts +6 -2
  43. package/lib/__internal__/label/label.component.js +7 -3
  44. package/lib/components/accordion/accordion.component.d.ts +3 -3
  45. package/lib/components/accordion/accordion.component.js +31 -12
  46. package/lib/components/accordion/accordion.style.d.ts +9 -3
  47. package/lib/components/accordion/accordion.style.js +54 -18
  48. package/lib/components/box/box.component.d.ts +2 -0
  49. package/lib/components/box/box.component.js +4 -1
  50. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
  51. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
  52. package/lib/components/button-toggle/button-toggle.style.d.ts +15 -0
  53. package/lib/components/button-toggle/button-toggle.style.js +4 -4
  54. package/lib/components/heading/heading.style.d.ts +1 -1
  55. package/lib/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
  56. package/lib/components/time/__internal__/time-toggle/index.d.ts +2 -0
  57. package/lib/components/time/__internal__/time-toggle/index.js +13 -0
  58. package/lib/components/time/__internal__/time-toggle/package.json +6 -0
  59. package/lib/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
  60. package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +61 -0
  61. package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
  62. package/lib/components/time/__internal__/time-toggle/time-toggle.style.js +26 -0
  63. package/lib/components/time/index.d.ts +2 -0
  64. package/lib/components/time/index.js +13 -0
  65. package/lib/components/time/package.json +6 -0
  66. package/lib/components/time/time.component.d.ts +73 -0
  67. package/lib/components/time/time.component.js +437 -0
  68. package/lib/components/time/time.style.d.ts +6 -0
  69. package/lib/components/time/time.style.js +26 -0
  70. package/lib/components/typography/typography.component.d.ts +7 -1
  71. package/lib/components/typography/typography.component.js +3 -1
  72. package/lib/components/typography/typography.style.js +5 -0
  73. package/lib/global.d.ts +1 -0
  74. package/lib/locales/__internal__/pl-pl.js +8 -0
  75. package/lib/locales/en-gb.js +8 -0
  76. package/lib/locales/locale.d.ts +8 -0
  77. package/package.json +1 -1
@@ -325,6 +325,7 @@ FlexTileCell.propTypes = {
325
325
  "trimStart": PropTypes.func.isRequired,
326
326
  "valueOf": PropTypes.func.isRequired
327
327
  })]),
328
+ "aria-hidden": PropTypes.oneOf(["false", "true"]),
328
329
  "as": PropTypes.oneOfType([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"]), PropTypes.func, PropTypes.shape({
329
330
  "childContextTypes": PropTypes.object,
330
331
  "contextType": PropTypes.shape({
@@ -0,0 +1,2 @@
1
+ export { default as TimeToggle } from "./time-toggle.component";
2
+ export type { ToggleProps, ToggleDataProps } from "./time-toggle.component";
@@ -0,0 +1 @@
1
+ export { default as TimeToggle } from "./time-toggle.component";
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { TagProps } from "../../../../__internal__/utils/helpers/tags";
3
+ import { ToggleValue } from "../../time.component";
4
+ export interface ToggleDataProps {
5
+ wrapperProps?: Omit<TagProps, "data-component">;
6
+ amToggleProps?: Omit<TagProps, "data-component">;
7
+ pmToggleProps?: Omit<TagProps, "data-component">;
8
+ }
9
+ export interface ToggleProps extends Omit<TagProps, "data-component"> {
10
+ size?: "small" | "medium" | "large";
11
+ onChange: (pressedValue: ToggleValue) => void;
12
+ toggleValue: ToggleValue;
13
+ disabled?: boolean;
14
+ toggleProps?: ToggleDataProps;
15
+ }
16
+ declare const Toggle: {
17
+ ({ size, onChange, toggleValue, disabled, toggleProps, }: ToggleProps): React.JSX.Element;
18
+ displayName: string;
19
+ };
20
+ export default Toggle;
@@ -0,0 +1,52 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
+ import React, { useRef, useCallback } from "react";
3
+ import PropTypes from "prop-types";
4
+ import guid from "../../../../__internal__/utils/helpers/guid";
5
+ import useLocale from "../../../../hooks/__internal__/useLocale";
6
+ import ButtonToggleGroup from "./time-toggle.style";
7
+ import { ButtonToggle } from "../../../button-toggle";
8
+ const Toggle = ({
9
+ size,
10
+ onChange,
11
+ toggleValue,
12
+ disabled,
13
+ toggleProps
14
+ }) => {
15
+ const locale = useLocale();
16
+ const amText = locale.time.amText();
17
+ const pmText = locale.time.pmText();
18
+ const internalId = useRef(guid());
19
+ const {
20
+ wrapperProps,
21
+ amToggleProps,
22
+ pmToggleProps
23
+ } = toggleProps || /* istanbul ignore next */{};
24
+ const handleChange = useCallback(event => {
25
+ const selectedButtonValue = event.target.value;
26
+ if (selectedButtonValue !== toggleValue) {
27
+ onChange(selectedButtonValue);
28
+ }
29
+ }, [toggleValue, onChange]);
30
+ return /*#__PURE__*/React.createElement(ButtonToggleGroup, _extends({}, wrapperProps, {
31
+ "data-component": "time-button-toggle-group",
32
+ m: "0px 0px 0px 8px",
33
+ id: internalId.current,
34
+ onChange: handleChange,
35
+ value: toggleValue,
36
+ disabled: disabled
37
+ }), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, amToggleProps, {
38
+ "data-component": "am-button-toggle",
39
+ grouped: true,
40
+ value: "AM",
41
+ size: size,
42
+ disabled: disabled
43
+ }), amText), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, pmToggleProps, {
44
+ "data-component": "pm-button-toggle",
45
+ grouped: true,
46
+ value: "PM",
47
+ size: size,
48
+ disabled: disabled
49
+ }), pmText));
50
+ };
51
+ Toggle.displayName = "Toggle";
52
+ export default Toggle;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("styled-components").StyledComponent<{
3
+ ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, labelAlign, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, className, ...props }: import("../../../button-toggle").ButtonToggleGroupProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ }, any, {
6
+ disabled?: boolean | undefined;
7
+ }, never>;
8
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import styled, { css } from "styled-components";
2
+ import { ButtonToggleGroup } from "../../../button-toggle";
3
+
4
+ // TODO this can be removed as part of FE-6335
5
+ export default styled(ButtonToggleGroup)`
6
+ ${({
7
+ disabled
8
+ }) => disabled && css`
9
+ opacity: 0.3;
10
+
11
+ [aria-pressed="true"] {
12
+ cursor: not-allowed;
13
+ :hover {
14
+ background-color: transparent;
15
+ box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500);
16
+ }
17
+ }
18
+ `}
19
+ `;
@@ -0,0 +1,2 @@
1
+ export { default as Time } from "./time.component";
2
+ export type { TimeValue, TimeProps, TimeHandle, ToggleValue, } from "./time.component";
@@ -0,0 +1 @@
1
+ export { default as Time } from "./time.component";
@@ -0,0 +1,73 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { ValidationProps } from "../../__internal__/validations";
4
+ import { TagProps } from "../../__internal__/utils/helpers/tags";
5
+ import { Sizes } from "../../__internal__/input/input-presentation.component";
6
+ import { ToggleDataProps } from "./__internal__/time-toggle";
7
+ export declare type ToggleValue = "AM" | "PM";
8
+ export declare type TimeValue = {
9
+ hours: string;
10
+ minutes: string;
11
+ period?: ToggleValue;
12
+ };
13
+ export interface TimeInputEvent {
14
+ target: {
15
+ name?: string;
16
+ id: string;
17
+ value: TimeValue;
18
+ };
19
+ }
20
+ interface TimeInputProps extends Omit<TagProps, "data-component">, Omit<ValidationProps, "info"> {
21
+ /** Set an id value on the input */
22
+ id?: string;
23
+ /** Override the default label text */
24
+ label?: string;
25
+ /** Override the default aria-label text */
26
+ "aria-label"?: string;
27
+ }
28
+ export interface TimeProps extends Omit<TagProps, "data-component">, MarginProps {
29
+ /** Label text for the component */
30
+ label?: string;
31
+ /** Sets the size of the inputs */
32
+ size?: Sizes;
33
+ /** Additional hint text rendered above the input elements */
34
+ inputHint?: string;
35
+ /**
36
+ * Set custom `data-` and `id` attributes on the input element.
37
+ * Set the `label` and `aria-label` values for the associated Label element.
38
+ * Set the `error` and `warning` states for the input
39
+ * */
40
+ hoursInputProps?: TimeInputProps;
41
+ /**
42
+ * Set custom `data-` and `id` attributes on the input element.
43
+ * Set the `label` and `aria-label` values for the associated Label element.
44
+ * Set the `error` and `warning` states for the input
45
+ * */
46
+ minutesInputProps?: TimeInputProps;
47
+ /** The value of the input elements */
48
+ value: TimeValue;
49
+ /** Callback to handle change events in input elements */
50
+ onChange: (ev: TimeInputEvent) => void;
51
+ /** Set a name value on the component */
52
+ name?: string;
53
+ /** Callback called when focus is lost on input elements */
54
+ onBlur?: (ev?: React.FocusEvent<HTMLInputElement>) => void;
55
+ /** Flag to configure component as mandatory */
56
+ required?: boolean;
57
+ /** Flag to configure component as optional */
58
+ isOptional?: boolean;
59
+ /** If true, the component will be disabled */
60
+ disabled?: boolean;
61
+ /** If true, the component will be read-only */
62
+ readOnly?: boolean;
63
+ /** Set custom data- attributes on the toggle elements */
64
+ toggleProps?: ToggleDataProps;
65
+ }
66
+ export declare type TimeHandle = {
67
+ /** Programmatically focus the hours input. */
68
+ focusHoursInput: () => void;
69
+ /** Programmatically focus the minutes input. */
70
+ focusMinutesInput: () => void;
71
+ } | null;
72
+ declare const Time: React.ForwardRefExoticComponent<TimeProps & React.RefAttributes<TimeHandle>>;
73
+ export default Time;
@@ -0,0 +1,428 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
+ import React, { useCallback, useImperativeHandle, useRef, useState } from "react";
3
+ import PropTypes from "prop-types";
4
+ import guid from "../../__internal__/utils/helpers/guid";
5
+ import useLocale from "../../hooks/__internal__/useLocale";
6
+ import tagComponent from "../../__internal__/utils/helpers/tags/tags";
7
+ import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
8
+ import Fieldset from "../../__internal__/fieldset";
9
+ import Box from "../box";
10
+ import { ErrorBorder } from "../textbox/textbox.style";
11
+ import ValidationMessage from "../../__internal__/validation-message";
12
+ import Number from "../number";
13
+ import Typography from "../typography";
14
+ import { StyledLabel as Label, StyledHintText as Hint } from "./time.style";
15
+ import { TimeToggle } from "./__internal__/time-toggle";
16
+ const Time = /*#__PURE__*/React.forwardRef(({
17
+ label,
18
+ size = "medium",
19
+ inputHint,
20
+ hoursInputProps = {},
21
+ minutesInputProps = {},
22
+ value,
23
+ name,
24
+ onChange,
25
+ onBlur,
26
+ required,
27
+ isOptional,
28
+ disabled,
29
+ readOnly,
30
+ toggleProps = {},
31
+ ...rest
32
+ }, ref) => {
33
+ const {
34
+ id: hoursInputId,
35
+ label: hoursLabel,
36
+ "aria-label": hoursAriaLabel,
37
+ error: hoursError,
38
+ warning: hoursWarning
39
+ } = hoursInputProps;
40
+ const {
41
+ id: minutesInputId,
42
+ label: minutesLabel,
43
+ "aria-label": minutesAriaLabel,
44
+ error: minutesError,
45
+ warning: minutesWarning
46
+ } = minutesInputProps;
47
+ const internalHrsId = useRef(hoursInputId || guid());
48
+ const internalMinsId = useRef(minutesInputId || guid());
49
+ const inputHintId = useRef(guid());
50
+ const internalId = useRef(`${internalHrsId.current} ${internalMinsId.current}`);
51
+ const {
52
+ hours: hourValue,
53
+ minutes: minuteValue,
54
+ period: toggleValue
55
+ } = value;
56
+ const [inputValues, setInputValues] = useState([hourValue, minuteValue]);
57
+ const locale = useLocale();
58
+ const showToggle = toggleValue !== undefined;
59
+ const [period, setPeriod] = useState(toggleValue);
60
+ const hrsLabel = hoursLabel || locale.time.hoursLabelText();
61
+ const minsLabel = minutesLabel || locale.time.minutesLabelText();
62
+ const hrsAriaLabel = hoursAriaLabel || locale.time.hoursAriaLabelText();
63
+ const minsAriaLabel = minutesAriaLabel || locale.time.minutesAriaLabelText();
64
+ const hoursRef = useRef(null);
65
+ const minsRef = useRef(null);
66
+ const computedValidations = (hrs, mins) => {
67
+ const hoursIsString = typeof hrs === "string";
68
+ const minutesIsString = typeof mins === "string";
69
+ if (!hoursIsString && !minutesIsString) {
70
+ return hrs || mins;
71
+ }
72
+ if (hoursIsString && !minutesIsString) {
73
+ return hrs;
74
+ }
75
+ if (minutesIsString && !hoursIsString) {
76
+ return mins;
77
+ }
78
+ return `${hrs} ${mins}`;
79
+ };
80
+ const error = computedValidations(hoursError, minutesError);
81
+ const warning = computedValidations(hoursWarning, minutesWarning);
82
+ const hasValidationFailure = !!(error || warning);
83
+ const {
84
+ validationId,
85
+ ariaDescribedBy
86
+ } = useInputAccessibility({
87
+ id: internalId.current,
88
+ validationRedesignOptIn: true,
89
+ error,
90
+ warning
91
+ });
92
+ const combinedAriaDescribedBy = [ariaDescribedBy, inputHintId.current].filter(Boolean).join(" ");
93
+ useImperativeHandle(ref, () => ({
94
+ focusHoursInput() {
95
+ hoursRef.current?.focus();
96
+ },
97
+ focusMinutesInput() {
98
+ minsRef.current?.focus();
99
+ }
100
+ }), []);
101
+ const handleChange = (ev, inputName) => {
102
+ const hours = inputName === "hrs" ? ev.target.value : inputValues[0];
103
+ const minutes = inputName === "mins" ? ev.target.value : inputValues[1];
104
+ setInputValues([hours, minutes]);
105
+ onChange({
106
+ target: {
107
+ name,
108
+ id: internalId.current,
109
+ value: {
110
+ hours,
111
+ minutes,
112
+ period
113
+ }
114
+ }
115
+ });
116
+ };
117
+ const handlePeriodChange = periodName => {
118
+ const [hours, minutes] = inputValues;
119
+ setPeriod(periodName);
120
+ onChange({
121
+ target: {
122
+ name,
123
+ id: internalId.current,
124
+ value: {
125
+ hours,
126
+ minutes,
127
+ period: periodName
128
+ }
129
+ }
130
+ });
131
+ };
132
+ const handleBlur = useCallback(ev => {
133
+ setTimeout(() => {
134
+ if (hoursRef.current !== document.activeElement && minsRef.current !== document.activeElement) {
135
+ onBlur?.(ev);
136
+ }
137
+ });
138
+ }, [onBlur]);
139
+ return /*#__PURE__*/React.createElement(Fieldset, _extends({
140
+ legend: label,
141
+ legendMargin: {
142
+ mb: 0
143
+ },
144
+ width: "min-content",
145
+ isRequired: required,
146
+ isOptional: isOptional,
147
+ isDisabled: disabled,
148
+ name: name,
149
+ id: internalId.current
150
+ }, rest, tagComponent("time", rest), {
151
+ "aria-describedby": combinedAriaDescribedBy
152
+ }), inputHint && /*#__PURE__*/React.createElement(Hint, {
153
+ id: inputHintId.current,
154
+ isDisabled: disabled
155
+ }, inputHint), /*#__PURE__*/React.createElement(Box, {
156
+ position: "relative"
157
+ }, /*#__PURE__*/React.createElement(ValidationMessage, {
158
+ validationId: validationId,
159
+ error: error,
160
+ warning: warning
161
+ }), hasValidationFailure && /*#__PURE__*/React.createElement(ErrorBorder, {
162
+ warning: !!(!error && warning)
163
+ }), /*#__PURE__*/React.createElement(Box, {
164
+ display: "flex"
165
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, {
166
+ "aria-label": hrsAriaLabel,
167
+ htmlFor: internalHrsId.current,
168
+ disabled: disabled
169
+ }, hrsLabel), /*#__PURE__*/React.createElement(Number, _extends({}, hoursInputProps, {
170
+ label: undefined,
171
+ "data-component": "hours",
172
+ ref: hoursRef,
173
+ value: hourValue,
174
+ onChange: ev => handleChange(ev, "hrs"),
175
+ onBlur: handleBlur,
176
+ id: internalHrsId.current,
177
+ size: size,
178
+ error: !!hoursError,
179
+ warning: !!hoursWarning,
180
+ disabled: disabled,
181
+ readOnly: readOnly
182
+ }))), /*#__PURE__*/React.createElement(Box, {
183
+ display: "flex",
184
+ flexDirection: "column",
185
+ justifyContent: "center",
186
+ mx: 1,
187
+ "aria-hidden": "true"
188
+ }, /*#__PURE__*/React.createElement("span", null, "\xA0"), /*#__PURE__*/React.createElement(Typography, {
189
+ isDisabled: disabled,
190
+ variant: "span",
191
+ mb: "-4px"
192
+ }, ":")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, {
193
+ "aria-label": minsAriaLabel,
194
+ htmlFor: internalMinsId.current,
195
+ disabled: disabled
196
+ }, minsLabel), /*#__PURE__*/React.createElement(Number, _extends({}, minutesInputProps, {
197
+ label: undefined,
198
+ "data-component": "minutes",
199
+ ref: minsRef,
200
+ value: minuteValue,
201
+ onChange: ev => handleChange(ev, "mins"),
202
+ onBlur: handleBlur,
203
+ id: internalMinsId.current,
204
+ size: size,
205
+ error: !!minutesError,
206
+ warning: !!minutesWarning,
207
+ disabled: disabled,
208
+ readOnly: readOnly
209
+ }))), showToggle && /*#__PURE__*/React.createElement(Box, {
210
+ display: "flex",
211
+ flexDirection: "column",
212
+ justifyContent: "flex-end"
213
+ }, /*#__PURE__*/React.createElement(TimeToggle, {
214
+ toggleProps: toggleProps,
215
+ size: size,
216
+ onChange: handlePeriodChange,
217
+ toggleValue: toggleValue,
218
+ disabled: disabled || readOnly
219
+ })))));
220
+ });
221
+ Time.propTypes = {
222
+ "children": PropTypes.node,
223
+ "data-element": PropTypes.string,
224
+ "data-role": PropTypes.string,
225
+ "disabled": PropTypes.bool,
226
+ "hoursInputProps": PropTypes.shape({
227
+ "aria-label": PropTypes.string,
228
+ "data-element": PropTypes.string,
229
+ "data-role": PropTypes.string,
230
+ "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
231
+ "id": PropTypes.string,
232
+ "label": PropTypes.string,
233
+ "warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
234
+ }),
235
+ "inputHint": PropTypes.string,
236
+ "isOptional": PropTypes.bool,
237
+ "label": PropTypes.string,
238
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
239
+ "__@toStringTag": PropTypes.string.isRequired,
240
+ "description": PropTypes.string,
241
+ "toString": PropTypes.func.isRequired,
242
+ "valueOf": PropTypes.func.isRequired
243
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
244
+ "__@toStringTag": PropTypes.string.isRequired,
245
+ "description": PropTypes.string,
246
+ "toString": PropTypes.func.isRequired,
247
+ "valueOf": PropTypes.func.isRequired
248
+ }), PropTypes.string]),
249
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
250
+ "__@toStringTag": PropTypes.string.isRequired,
251
+ "description": PropTypes.string,
252
+ "toString": PropTypes.func.isRequired,
253
+ "valueOf": PropTypes.func.isRequired
254
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
255
+ "__@toStringTag": PropTypes.string.isRequired,
256
+ "description": PropTypes.string,
257
+ "toString": PropTypes.func.isRequired,
258
+ "valueOf": PropTypes.func.isRequired
259
+ }), PropTypes.string]),
260
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
261
+ "__@toStringTag": PropTypes.string.isRequired,
262
+ "description": PropTypes.string,
263
+ "toString": PropTypes.func.isRequired,
264
+ "valueOf": PropTypes.func.isRequired
265
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
266
+ "__@toStringTag": PropTypes.string.isRequired,
267
+ "description": PropTypes.string,
268
+ "toString": PropTypes.func.isRequired,
269
+ "valueOf": PropTypes.func.isRequired
270
+ }), PropTypes.string]),
271
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
272
+ "__@toStringTag": PropTypes.string.isRequired,
273
+ "description": PropTypes.string,
274
+ "toString": PropTypes.func.isRequired,
275
+ "valueOf": PropTypes.func.isRequired
276
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
277
+ "__@toStringTag": PropTypes.string.isRequired,
278
+ "description": PropTypes.string,
279
+ "toString": PropTypes.func.isRequired,
280
+ "valueOf": PropTypes.func.isRequired
281
+ }), PropTypes.string]),
282
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
283
+ "__@toStringTag": PropTypes.string.isRequired,
284
+ "description": PropTypes.string,
285
+ "toString": PropTypes.func.isRequired,
286
+ "valueOf": PropTypes.func.isRequired
287
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
288
+ "__@toStringTag": PropTypes.string.isRequired,
289
+ "description": PropTypes.string,
290
+ "toString": PropTypes.func.isRequired,
291
+ "valueOf": PropTypes.func.isRequired
292
+ }), PropTypes.string]),
293
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
294
+ "__@toStringTag": PropTypes.string.isRequired,
295
+ "description": PropTypes.string,
296
+ "toString": PropTypes.func.isRequired,
297
+ "valueOf": PropTypes.func.isRequired
298
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
299
+ "__@toStringTag": PropTypes.string.isRequired,
300
+ "description": PropTypes.string,
301
+ "toString": PropTypes.func.isRequired,
302
+ "valueOf": PropTypes.func.isRequired
303
+ }), PropTypes.string]),
304
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
305
+ "__@toStringTag": PropTypes.string.isRequired,
306
+ "description": PropTypes.string,
307
+ "toString": PropTypes.func.isRequired,
308
+ "valueOf": PropTypes.func.isRequired
309
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
310
+ "__@toStringTag": PropTypes.string.isRequired,
311
+ "description": PropTypes.string,
312
+ "toString": PropTypes.func.isRequired,
313
+ "valueOf": PropTypes.func.isRequired
314
+ }), PropTypes.string]),
315
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
316
+ "__@toStringTag": PropTypes.string.isRequired,
317
+ "description": PropTypes.string,
318
+ "toString": PropTypes.func.isRequired,
319
+ "valueOf": PropTypes.func.isRequired
320
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
321
+ "__@toStringTag": PropTypes.string.isRequired,
322
+ "description": PropTypes.string,
323
+ "toString": PropTypes.func.isRequired,
324
+ "valueOf": PropTypes.func.isRequired
325
+ }), PropTypes.string]),
326
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
327
+ "__@toStringTag": PropTypes.string.isRequired,
328
+ "description": PropTypes.string,
329
+ "toString": PropTypes.func.isRequired,
330
+ "valueOf": PropTypes.func.isRequired
331
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
332
+ "__@toStringTag": PropTypes.string.isRequired,
333
+ "description": PropTypes.string,
334
+ "toString": PropTypes.func.isRequired,
335
+ "valueOf": PropTypes.func.isRequired
336
+ }), PropTypes.string]),
337
+ "minutesInputProps": PropTypes.shape({
338
+ "aria-label": PropTypes.string,
339
+ "data-element": PropTypes.string,
340
+ "data-role": PropTypes.string,
341
+ "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
342
+ "id": PropTypes.string,
343
+ "label": PropTypes.string,
344
+ "warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
345
+ }),
346
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
347
+ "__@toStringTag": PropTypes.string.isRequired,
348
+ "description": PropTypes.string,
349
+ "toString": PropTypes.func.isRequired,
350
+ "valueOf": PropTypes.func.isRequired
351
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
352
+ "__@toStringTag": PropTypes.string.isRequired,
353
+ "description": PropTypes.string,
354
+ "toString": PropTypes.func.isRequired,
355
+ "valueOf": PropTypes.func.isRequired
356
+ }), PropTypes.string]),
357
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
358
+ "__@toStringTag": PropTypes.string.isRequired,
359
+ "description": PropTypes.string,
360
+ "toString": PropTypes.func.isRequired,
361
+ "valueOf": PropTypes.func.isRequired
362
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
363
+ "__@toStringTag": PropTypes.string.isRequired,
364
+ "description": PropTypes.string,
365
+ "toString": PropTypes.func.isRequired,
366
+ "valueOf": PropTypes.func.isRequired
367
+ }), PropTypes.string]),
368
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
369
+ "__@toStringTag": PropTypes.string.isRequired,
370
+ "description": PropTypes.string,
371
+ "toString": PropTypes.func.isRequired,
372
+ "valueOf": PropTypes.func.isRequired
373
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
374
+ "__@toStringTag": PropTypes.string.isRequired,
375
+ "description": PropTypes.string,
376
+ "toString": PropTypes.func.isRequired,
377
+ "valueOf": PropTypes.func.isRequired
378
+ }), PropTypes.string]),
379
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
380
+ "__@toStringTag": PropTypes.string.isRequired,
381
+ "description": PropTypes.string,
382
+ "toString": PropTypes.func.isRequired,
383
+ "valueOf": PropTypes.func.isRequired
384
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
385
+ "__@toStringTag": PropTypes.string.isRequired,
386
+ "description": PropTypes.string,
387
+ "toString": PropTypes.func.isRequired,
388
+ "valueOf": PropTypes.func.isRequired
389
+ }), PropTypes.string]),
390
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
391
+ "__@toStringTag": PropTypes.string.isRequired,
392
+ "description": PropTypes.string,
393
+ "toString": PropTypes.func.isRequired,
394
+ "valueOf": PropTypes.func.isRequired
395
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
396
+ "__@toStringTag": PropTypes.string.isRequired,
397
+ "description": PropTypes.string,
398
+ "toString": PropTypes.func.isRequired,
399
+ "valueOf": PropTypes.func.isRequired
400
+ }), PropTypes.string]),
401
+ "name": PropTypes.string,
402
+ "onBlur": PropTypes.func,
403
+ "onChange": PropTypes.func.isRequired,
404
+ "readOnly": PropTypes.bool,
405
+ "required": PropTypes.bool,
406
+ "size": PropTypes.oneOf(["large", "medium", "small"]),
407
+ "toggleProps": PropTypes.shape({
408
+ "amToggleProps": PropTypes.shape({
409
+ "data-element": PropTypes.string,
410
+ "data-role": PropTypes.string
411
+ }),
412
+ "pmToggleProps": PropTypes.shape({
413
+ "data-element": PropTypes.string,
414
+ "data-role": PropTypes.string
415
+ }),
416
+ "wrapperProps": PropTypes.shape({
417
+ "data-element": PropTypes.string,
418
+ "data-role": PropTypes.string
419
+ })
420
+ }),
421
+ "value": PropTypes.shape({
422
+ "hours": PropTypes.string.isRequired,
423
+ "minutes": PropTypes.string.isRequired,
424
+ "period": PropTypes.oneOf(["AM", "PM"])
425
+ }).isRequired
426
+ };
427
+ Time.displayName = "Time";
428
+ export default Time;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
3
+ export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {
4
+ isDisabled?: boolean | undefined;
5
+ hasError?: boolean | undefined;
6
+ }, never>;
@@ -0,0 +1,19 @@
1
+ import styled from "styled-components";
2
+ import Label from "../../__internal__/label";
3
+ export const StyledLabel = styled(Label)`
4
+ label {
5
+ font-weight: var(--fontWeights500);
6
+ }
7
+ `;
8
+ export const StyledHintText = styled.div`
9
+ ::after {
10
+ content: " ";
11
+ }
12
+
13
+ margin-top: 0px;
14
+ margin-bottom: var(--spacing150);
15
+ color: ${({
16
+ isDisabled
17
+ }) => isDisabled ? "var(--colorsUtilityYin030)" : "var(--colorsUtilityYin055)"};
18
+ font-size: 14px;
19
+ `;