carbon-react 125.7.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.
- package/esm/__internal__/fieldset/fieldset.component.d.ts +13 -1
- package/esm/__internal__/fieldset/fieldset.component.js +20 -4
- package/esm/__internal__/fieldset/fieldset.style.d.ts +6 -1
- package/esm/__internal__/fieldset/fieldset.style.js +27 -1
- package/esm/__internal__/label/label.component.d.ts +6 -2
- package/esm/__internal__/label/label.component.js +7 -3
- package/esm/components/box/box.component.d.ts +2 -0
- package/esm/components/box/box.component.js +4 -1
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
- package/esm/components/button-toggle/button-toggle.style.d.ts +15 -0
- package/esm/components/button-toggle/button-toggle.style.js +3 -3
- package/esm/components/heading/heading.style.d.ts +1 -1
- package/esm/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
- package/esm/components/time/__internal__/time-toggle/index.d.ts +2 -0
- package/esm/components/time/__internal__/time-toggle/index.js +1 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +52 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +19 -0
- package/esm/components/time/index.d.ts +2 -0
- package/esm/components/time/index.js +1 -0
- package/esm/components/time/time.component.d.ts +73 -0
- package/esm/components/time/time.component.js +428 -0
- package/esm/components/time/time.style.d.ts +6 -0
- package/esm/components/time/time.style.js +19 -0
- package/esm/components/typography/typography.component.d.ts +7 -1
- package/esm/components/typography/typography.component.js +3 -1
- package/esm/components/typography/typography.style.js +5 -0
- package/esm/locales/__internal__/pl-pl.js +8 -0
- package/esm/locales/en-gb.js +8 -0
- package/esm/locales/locale.d.ts +8 -0
- package/lib/__internal__/fieldset/fieldset.component.d.ts +13 -1
- package/lib/__internal__/fieldset/fieldset.component.js +19 -3
- package/lib/__internal__/fieldset/fieldset.style.d.ts +6 -1
- package/lib/__internal__/fieldset/fieldset.style.js +27 -1
- package/lib/__internal__/label/label.component.d.ts +6 -2
- package/lib/__internal__/label/label.component.js +7 -3
- package/lib/components/box/box.component.d.ts +2 -0
- package/lib/components/box/box.component.js +4 -1
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
- package/lib/components/button-toggle/button-toggle.style.d.ts +15 -0
- package/lib/components/button-toggle/button-toggle.style.js +4 -4
- package/lib/components/heading/heading.style.d.ts +1 -1
- package/lib/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
- package/lib/components/time/__internal__/time-toggle/index.d.ts +2 -0
- package/lib/components/time/__internal__/time-toggle/index.js +13 -0
- package/lib/components/time/__internal__/time-toggle/package.json +6 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +61 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.style.js +26 -0
- package/lib/components/time/index.d.ts +2 -0
- package/lib/components/time/index.js +13 -0
- package/lib/components/time/package.json +6 -0
- package/lib/components/time/time.component.d.ts +73 -0
- package/lib/components/time/time.component.js +437 -0
- package/lib/components/time/time.style.d.ts +6 -0
- package/lib/components/time/time.style.js +26 -0
- package/lib/components/typography/typography.component.d.ts +7 -1
- package/lib/components/typography/typography.component.js +3 -1
- package/lib/components/typography/typography.style.js +5 -0
- package/lib/locales/__internal__/pl-pl.js +8 -0
- package/lib/locales/en-gb.js +8 -0
- package/lib/locales/locale.d.ts +8 -0
- package/package.json +1 -1
|
@@ -17,6 +17,9 @@ const StyledFieldset = exports.StyledFieldset = _styledComponents.default.fields
|
|
|
17
17
|
padding: 0;
|
|
18
18
|
min-width: 0;
|
|
19
19
|
min-inline-size: 0;
|
|
20
|
+
${({
|
|
21
|
+
width
|
|
22
|
+
}) => width && `width: ${width};`}
|
|
20
23
|
`;
|
|
21
24
|
StyledFieldset.defaultProps = {
|
|
22
25
|
theme: _base.default
|
|
@@ -34,13 +37,35 @@ const StyledLegendContent = exports.StyledLegendContent = _styledComponents.defa
|
|
|
34
37
|
color: var(--colorsSemanticNegative500);
|
|
35
38
|
font-weight: 700;
|
|
36
39
|
margin-left: var(--spacing100);
|
|
40
|
+
position: relative;
|
|
41
|
+
top: 1px;
|
|
42
|
+
left: -4px;
|
|
43
|
+
}
|
|
44
|
+
`}
|
|
45
|
+
|
|
46
|
+
${({
|
|
47
|
+
isOptional
|
|
48
|
+
}) => isOptional && (0, _styledComponents.css)`
|
|
49
|
+
::after {
|
|
50
|
+
content: "(optional)";
|
|
51
|
+
font-weight: 350; //TODO: (tokens) use token var(--fontWeights400) - FE-6022
|
|
52
|
+
margin-left: 4px;
|
|
53
|
+
}
|
|
54
|
+
`}
|
|
55
|
+
|
|
56
|
+
${({
|
|
57
|
+
isDisabled
|
|
58
|
+
}) => isDisabled && (0, _styledComponents.css)`
|
|
59
|
+
color: var(--colorsUtilityYin030);
|
|
60
|
+
::after {
|
|
61
|
+
color: var(--colorsUtilityYin030);
|
|
37
62
|
}
|
|
38
63
|
`}
|
|
39
64
|
`;
|
|
40
65
|
const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
|
|
41
66
|
display: flex;
|
|
42
67
|
align-items: center;
|
|
43
|
-
margin-bottom:
|
|
68
|
+
margin-bottom: var(--spacing100);
|
|
44
69
|
padding: 0;
|
|
45
70
|
font-weight: 600;
|
|
46
71
|
${({
|
|
@@ -56,4 +81,5 @@ const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
|
|
|
56
81
|
justify-content: ${align === "right" ? "flex-end" : "flex-start"};
|
|
57
82
|
padding-right: ${rightPadding === 1 ? "var(--spacing100)" : "var(--spacing200)"};
|
|
58
83
|
`}
|
|
84
|
+
${_styledSystem.margin}
|
|
59
85
|
`;
|
|
@@ -20,7 +20,11 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
20
20
|
useValidationIcon?: boolean;
|
|
21
21
|
/** Id of the validation icon */
|
|
22
22
|
validationIconId?: string;
|
|
23
|
+
/** Sets className for component */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Sets aria-label for label element */
|
|
26
|
+
"aria-label"?: string;
|
|
23
27
|
}
|
|
24
|
-
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element;
|
|
25
|
-
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element>;
|
|
28
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
|
|
29
|
+
declare const _default: 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, }: LabelProps) => React.JSX.Element>;
|
|
26
30
|
export default _default;
|
|
@@ -52,7 +52,9 @@ const Label = ({
|
|
|
52
52
|
useValidationIcon = true,
|
|
53
53
|
validationIconId,
|
|
54
54
|
warning,
|
|
55
|
-
width = 30
|
|
55
|
+
width = 30,
|
|
56
|
+
className,
|
|
57
|
+
"aria-label": ariaLabel
|
|
56
58
|
}) => {
|
|
57
59
|
const [isFocused, setFocus] = (0, _react.useState)(false);
|
|
58
60
|
const {
|
|
@@ -109,7 +111,8 @@ const Label = ({
|
|
|
109
111
|
width: width,
|
|
110
112
|
optional: optional,
|
|
111
113
|
pr: pr,
|
|
112
|
-
pl: pl
|
|
114
|
+
pl: pl,
|
|
115
|
+
className: className
|
|
113
116
|
}, /*#__PURE__*/_react.default.createElement(_label.default, _extends({
|
|
114
117
|
"data-element": "label",
|
|
115
118
|
disabled: disabled,
|
|
@@ -120,7 +123,8 @@ const Label = ({
|
|
|
120
123
|
onMouseEnter: handleMouseEnter,
|
|
121
124
|
onMouseLeave: handleMouseLeave,
|
|
122
125
|
isRequired: isRequired,
|
|
123
|
-
as: as
|
|
126
|
+
as: as,
|
|
127
|
+
"aria-label": ariaLabel
|
|
124
128
|
}), children), icon());
|
|
125
129
|
};
|
|
126
130
|
exports.Label = Label;
|
|
@@ -45,6 +45,8 @@ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<Gr
|
|
|
45
45
|
backgroundColor?: string;
|
|
46
46
|
/** Set the opacity attribute of the Box component */
|
|
47
47
|
opacity?: string | number;
|
|
48
|
+
/** Set the container to be hidden from screen readers */
|
|
49
|
+
"aria-hidden"?: "true" | "false";
|
|
48
50
|
}
|
|
49
51
|
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
52
|
export default Box;
|
|
@@ -31,6 +31,7 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
31
31
|
borderRadius,
|
|
32
32
|
color,
|
|
33
33
|
opacity,
|
|
34
|
+
"aria-hidden": ariaHidden,
|
|
34
35
|
...rest
|
|
35
36
|
}, ref) => {
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_box.default, _extends({
|
|
@@ -51,7 +52,8 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
51
52
|
boxShadow: boxShadow,
|
|
52
53
|
borderRadius: borderRadius,
|
|
53
54
|
color: color,
|
|
54
|
-
opacity: opacity
|
|
55
|
+
opacity: opacity,
|
|
56
|
+
"aria-hidden": ariaHidden
|
|
55
57
|
}, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest), (0, _utils.filterStyledSystemFlexboxProps)(rest), (0, _utils.filterStyledSystemGridProps)(rest), (0, _utils.filterStyledSystemLayoutProps)(rest)), children);
|
|
56
58
|
});
|
|
57
59
|
Box.propTypes = {
|
|
@@ -358,6 +360,7 @@ Box.propTypes = {
|
|
|
358
360
|
"trimStart": _propTypes.default.func.isRequired,
|
|
359
361
|
"valueOf": _propTypes.default.func.isRequired
|
|
360
362
|
})]),
|
|
363
|
+
"aria-hidden": _propTypes.default.oneOf(["false", "true"]),
|
|
361
364
|
"as": _propTypes.default.oneOfType([_propTypes.default.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]), _propTypes.default.func, _propTypes.default.shape({
|
|
362
365
|
"childContextTypes": _propTypes.default.object,
|
|
363
366
|
"contextType": _propTypes.default.shape({
|
|
@@ -44,6 +44,11 @@ export interface ButtonToggleGroupProps extends MarginProps, TagProps {
|
|
|
44
44
|
helpAriaLabel?: string;
|
|
45
45
|
/** set this to true to allow the buttons within the group to be deselected when already selected, leaving no selected button */
|
|
46
46
|
allowDeselect?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @private @ignore
|
|
49
|
+
* Set a class on the component
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
47
52
|
}
|
|
48
53
|
declare type ButtonToggleGroupContextType = {
|
|
49
54
|
onButtonClick: (value: string) => void;
|
|
@@ -58,7 +63,7 @@ declare type ButtonToggleGroupContextType = {
|
|
|
58
63
|
};
|
|
59
64
|
export declare const ButtonToggleGroupContext: React.Context<ButtonToggleGroupContextType>;
|
|
60
65
|
declare const ButtonToggleGroup: {
|
|
61
|
-
({ 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, ...props }: ButtonToggleGroupProps): React.JSX.Element;
|
|
66
|
+
({ 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 }: ButtonToggleGroupProps): React.JSX.Element;
|
|
62
67
|
displayName: string;
|
|
63
68
|
};
|
|
64
69
|
export default ButtonToggleGroup;
|
|
@@ -51,6 +51,7 @@ const ButtonToggleGroup = ({
|
|
|
51
51
|
helpAriaLabel,
|
|
52
52
|
id,
|
|
53
53
|
allowDeselect,
|
|
54
|
+
className,
|
|
54
55
|
...props
|
|
55
56
|
}) => {
|
|
56
57
|
const hasCorrectItemStructure = (0, _react.useMemo)(() => {
|
|
@@ -161,7 +162,9 @@ const ButtonToggleGroup = ({
|
|
|
161
162
|
"data-role": dataRole,
|
|
162
163
|
"data-element": dataElement,
|
|
163
164
|
id: id
|
|
164
|
-
}, (0, _utils.filterStyledSystemMarginProps)(props)
|
|
165
|
+
}, (0, _utils.filterStyledSystemMarginProps)(props), {
|
|
166
|
+
className: className
|
|
167
|
+
}), children))))));
|
|
165
168
|
};
|
|
166
169
|
ButtonToggleGroup.displayName = "ButtonToggleGroup";
|
|
167
170
|
var _default = exports.default = ButtonToggleGroup;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { IconType } from "../icon";
|
|
2
2
|
export declare type ButtonToggleIconSizes = "small" | "large";
|
|
3
|
+
export declare const heightConfig: {
|
|
4
|
+
small: number;
|
|
5
|
+
medium: number;
|
|
6
|
+
large: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const fontSizeConfig: {
|
|
9
|
+
small: number;
|
|
10
|
+
medium: number;
|
|
11
|
+
large: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const paddingConfig: {
|
|
14
|
+
small: number;
|
|
15
|
+
medium: number;
|
|
16
|
+
large: number;
|
|
17
|
+
};
|
|
3
18
|
declare const StyledButtonToggleContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
19
|
export interface StyledButtonToggleProps {
|
|
5
20
|
/** The icon to be rendered inside of the button */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledButtonToggleWrapper = exports.StyledButtonToggleIcon = exports.StyledButtonToggleContentWrapper = exports.StyledButtonToggle = void 0;
|
|
6
|
+
exports.paddingConfig = exports.heightConfig = exports.fontSizeConfig = exports.StyledButtonToggleWrapper = exports.StyledButtonToggleIcon = exports.StyledButtonToggleContentWrapper = exports.StyledButtonToggle = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
9
9
|
var _addFocusStyling = _interopRequireDefault(require("../../style/utils/add-focus-styling"));
|
|
@@ -11,17 +11,17 @@ var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
const heightConfig = {
|
|
14
|
+
const heightConfig = exports.heightConfig = {
|
|
15
15
|
small: 32,
|
|
16
16
|
medium: 40,
|
|
17
17
|
large: 48
|
|
18
18
|
};
|
|
19
|
-
const fontSizeConfig = {
|
|
19
|
+
const fontSizeConfig = exports.fontSizeConfig = {
|
|
20
20
|
small: 14,
|
|
21
21
|
medium: 14,
|
|
22
22
|
large: 16
|
|
23
23
|
};
|
|
24
|
-
const paddingConfig = {
|
|
24
|
+
const paddingConfig = exports.paddingConfig = {
|
|
25
25
|
small: 16,
|
|
26
26
|
medium: 24,
|
|
27
27
|
large: 32
|
|
@@ -12,7 +12,7 @@ declare type StyledHeadingTitleProps = {
|
|
|
12
12
|
withMargin?: boolean;
|
|
13
13
|
};
|
|
14
14
|
declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
|
|
15
|
-
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
15
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
}, any, StyledHeadingTitleProps, never>;
|
|
18
18
|
declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -333,6 +333,7 @@ FlexTileCell.propTypes = {
|
|
|
333
333
|
"trimStart": _propTypes.default.func.isRequired,
|
|
334
334
|
"valueOf": _propTypes.default.func.isRequired
|
|
335
335
|
})]),
|
|
336
|
+
"aria-hidden": _propTypes.default.oneOf(["false", "true"]),
|
|
336
337
|
"as": _propTypes.default.oneOfType([_propTypes.default.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]), _propTypes.default.func, _propTypes.default.shape({
|
|
337
338
|
"childContextTypes": _propTypes.default.object,
|
|
338
339
|
"contextType": _propTypes.default.shape({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "TimeToggle", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _timeToggle.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _timeToggle = _interopRequireDefault(require("./time-toggle.component"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _guid = _interopRequireDefault(require("../../../../__internal__/utils/helpers/guid"));
|
|
10
|
+
var _useLocale = _interopRequireDefault(require("../../../../hooks/__internal__/useLocale"));
|
|
11
|
+
var _timeToggle = _interopRequireDefault(require("./time-toggle.style"));
|
|
12
|
+
var _buttonToggle = require("../../../button-toggle");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
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); }
|
|
17
|
+
const Toggle = ({
|
|
18
|
+
size,
|
|
19
|
+
onChange,
|
|
20
|
+
toggleValue,
|
|
21
|
+
disabled,
|
|
22
|
+
toggleProps
|
|
23
|
+
}) => {
|
|
24
|
+
const locale = (0, _useLocale.default)();
|
|
25
|
+
const amText = locale.time.amText();
|
|
26
|
+
const pmText = locale.time.pmText();
|
|
27
|
+
const internalId = (0, _react.useRef)((0, _guid.default)());
|
|
28
|
+
const {
|
|
29
|
+
wrapperProps,
|
|
30
|
+
amToggleProps,
|
|
31
|
+
pmToggleProps
|
|
32
|
+
} = toggleProps || /* istanbul ignore next */{};
|
|
33
|
+
const handleChange = (0, _react.useCallback)(event => {
|
|
34
|
+
const selectedButtonValue = event.target.value;
|
|
35
|
+
if (selectedButtonValue !== toggleValue) {
|
|
36
|
+
onChange(selectedButtonValue);
|
|
37
|
+
}
|
|
38
|
+
}, [toggleValue, onChange]);
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_timeToggle.default, _extends({}, wrapperProps, {
|
|
40
|
+
"data-component": "time-button-toggle-group",
|
|
41
|
+
m: "0px 0px 0px 8px",
|
|
42
|
+
id: internalId.current,
|
|
43
|
+
onChange: handleChange,
|
|
44
|
+
value: toggleValue,
|
|
45
|
+
disabled: disabled
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement(_buttonToggle.ButtonToggle, _extends({}, amToggleProps, {
|
|
47
|
+
"data-component": "am-button-toggle",
|
|
48
|
+
grouped: true,
|
|
49
|
+
value: "AM",
|
|
50
|
+
size: size,
|
|
51
|
+
disabled: disabled
|
|
52
|
+
}), amText), /*#__PURE__*/_react.default.createElement(_buttonToggle.ButtonToggle, _extends({}, pmToggleProps, {
|
|
53
|
+
"data-component": "pm-button-toggle",
|
|
54
|
+
grouped: true,
|
|
55
|
+
value: "PM",
|
|
56
|
+
size: size,
|
|
57
|
+
disabled: disabled
|
|
58
|
+
}), pmText));
|
|
59
|
+
};
|
|
60
|
+
Toggle.displayName = "Toggle";
|
|
61
|
+
var _default = exports.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,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _buttonToggle = require("../../../button-toggle");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
// TODO this can be removed as part of FE-6335
|
|
12
|
+
var _default = exports.default = (0, _styledComponents.default)(_buttonToggle.ButtonToggleGroup)`
|
|
13
|
+
${({
|
|
14
|
+
disabled
|
|
15
|
+
}) => disabled && (0, _styledComponents.css)`
|
|
16
|
+
opacity: 0.3;
|
|
17
|
+
|
|
18
|
+
[aria-pressed="true"] {
|
|
19
|
+
cursor: not-allowed;
|
|
20
|
+
:hover {
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Time", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _time.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _time = _interopRequireDefault(require("./time.component"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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;
|