carbon-react 125.7.0 → 125.9.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 +3 -1
- 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/image/image.component.d.ts +1 -1
- package/esm/components/image/image.component.js +11 -1
- package/esm/components/image/image.style.d.ts +18 -2
- package/esm/components/image/image.style.js +26 -2
- 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 +3 -1
- 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/image/image.component.d.ts +1 -1
- package/lib/components/image/image.component.js +11 -1
- package/lib/components/image/image.style.d.ts +18 -2
- package/lib/components/image/image.style.js +26 -2
- 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
|
@@ -27,28 +27,44 @@ const Fieldset = ({
|
|
|
27
27
|
info,
|
|
28
28
|
isRequired,
|
|
29
29
|
blockGroupBehaviour,
|
|
30
|
+
legendMargin = {},
|
|
31
|
+
isDisabled,
|
|
32
|
+
isOptional,
|
|
30
33
|
...rest
|
|
31
34
|
}) => {
|
|
32
35
|
const {
|
|
33
36
|
validationRedesignOptIn
|
|
34
37
|
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
35
38
|
const marginProps = (0, _useFormSpacing.default)(rest);
|
|
39
|
+
const [ref, setRef] = (0, _react.useState)(null);
|
|
40
|
+
(0, _react.useEffect)(() => {
|
|
41
|
+
if (ref && isRequired) {
|
|
42
|
+
Array.from(ref.querySelectorAll("input") || /* istanbul ignore next */[]).forEach(el => {
|
|
43
|
+
el.setAttribute("required", "");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, [ref, isRequired]);
|
|
36
47
|
return /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupBehaviour, {
|
|
37
48
|
blockGroupBehaviour: blockGroupBehaviour
|
|
38
49
|
}, /*#__PURE__*/_react.default.createElement(_fieldset.StyledFieldset, _extends({
|
|
50
|
+
ref: setRef,
|
|
39
51
|
"data-component": "fieldset"
|
|
40
52
|
}, rest, marginProps), legend && /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupContext.Consumer, null, ({
|
|
41
53
|
onMouseEnter,
|
|
42
54
|
onMouseLeave
|
|
43
|
-
}) => /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, {
|
|
55
|
+
}) => /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, _extends({
|
|
44
56
|
onMouseEnter: onMouseEnter,
|
|
45
57
|
onMouseLeave: onMouseLeave,
|
|
46
58
|
inline: inline,
|
|
47
59
|
width: legendWidth,
|
|
48
60
|
align: legendAlign,
|
|
49
61
|
rightPadding: legendSpacing
|
|
50
|
-
},
|
|
51
|
-
|
|
62
|
+
}, legendMargin, {
|
|
63
|
+
"data-element": "legend"
|
|
64
|
+
}), /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegendContent, {
|
|
65
|
+
isRequired: isRequired,
|
|
66
|
+
isOptional: isOptional,
|
|
67
|
+
isDisabled: isDisabled
|
|
52
68
|
}, legend, !validationRedesignOptIn && /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
|
|
53
69
|
error: error,
|
|
54
70
|
warning: warning,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
declare
|
|
1
|
+
declare type StyledFieldsetProps = {
|
|
2
|
+
width?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const StyledFieldset: import("styled-components").StyledComponent<"fieldset", any, StyledFieldsetProps, never>;
|
|
2
5
|
declare type StyledLegendContentProps = {
|
|
3
6
|
isRequired?: boolean;
|
|
7
|
+
isOptional?: boolean;
|
|
8
|
+
isDisabled?: boolean;
|
|
4
9
|
};
|
|
5
10
|
declare const StyledLegendContent: import("styled-components").StyledComponent<"span", any, StyledLegendContentProps, never>;
|
|
6
11
|
declare type StyledLegendProps = {
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ export declare type BoxSizing = "content-box" | "border-box";
|
|
|
9
9
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
10
10
|
declare type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
|
|
11
11
|
declare type BorderRadiusType = Extract<DesignTokensType, `borderRadius${string}`>;
|
|
12
|
-
export interface BoxProps extends
|
|
12
|
+
export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, LayoutProps, Omit<PositionProps, "zIndex">, SpaceProps, TagProps {
|
|
13
13
|
as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
|
|
14
14
|
/** Set the ID attribute of the Box component */
|
|
15
15
|
id?: string;
|
|
@@ -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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyledImageProps } from "./image.style";
|
|
3
3
|
export declare const Image: {
|
|
4
|
-
({ alt, decorative, src, children, ...rest }: StyledImageProps): React.JSX.Element;
|
|
4
|
+
({ alt, decorative, src, children, position, top, right, bottom, left, ...rest }: StyledImageProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default Image;
|
|
@@ -15,6 +15,11 @@ const Image = ({
|
|
|
15
15
|
decorative = false,
|
|
16
16
|
src,
|
|
17
17
|
children,
|
|
18
|
+
position,
|
|
19
|
+
top,
|
|
20
|
+
right,
|
|
21
|
+
bottom,
|
|
22
|
+
left,
|
|
18
23
|
...rest
|
|
19
24
|
}) => {
|
|
20
25
|
!(!src || !children) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : (0, _invariant.default)(false) : void 0;
|
|
@@ -22,7 +27,12 @@ const Image = ({
|
|
|
22
27
|
return /*#__PURE__*/_react.default.createElement(_image.StyledImage, _extends({
|
|
23
28
|
alt: alt,
|
|
24
29
|
decorative: decorative,
|
|
25
|
-
src: src
|
|
30
|
+
src: src,
|
|
31
|
+
position: position,
|
|
32
|
+
top: top,
|
|
33
|
+
right: right,
|
|
34
|
+
bottom: bottom,
|
|
35
|
+
left: left
|
|
26
36
|
}, rest), children);
|
|
27
37
|
};
|
|
28
38
|
exports.Image = Image;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
3
|
-
export
|
|
3
|
+
export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
|
|
4
|
+
export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
|
|
4
5
|
/** HTML alt property to display when an img fails to load */
|
|
5
6
|
alt?: string;
|
|
6
7
|
/** Prop to specify if the image is decorative */
|
|
@@ -11,11 +12,26 @@ export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutPr
|
|
|
11
12
|
hidden?: boolean;
|
|
12
13
|
/** Children elements, will only render if component is a div element */
|
|
13
14
|
children?: React.ReactNode;
|
|
15
|
+
/** Any valid CSS string for position */
|
|
16
|
+
position?: PositionProps;
|
|
17
|
+
/** Any valid CSS string for top */
|
|
18
|
+
top?: string;
|
|
19
|
+
/** Any valid CSS string for right */
|
|
20
|
+
right?: string;
|
|
21
|
+
/** Any valid CSS string for bottom */
|
|
22
|
+
bottom?: string;
|
|
23
|
+
/** Any valid CSS string for left */
|
|
24
|
+
left?: string;
|
|
14
25
|
}
|
|
15
26
|
declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
|
|
16
27
|
children: import("react").ReactNode;
|
|
17
28
|
src: string | undefined;
|
|
18
29
|
hidden: boolean;
|
|
30
|
+
position: PositionProps | undefined;
|
|
31
|
+
top: string | undefined;
|
|
32
|
+
right: string | undefined;
|
|
33
|
+
bottom: string | undefined;
|
|
34
|
+
left: string | undefined;
|
|
19
35
|
as?: string | undefined;
|
|
20
|
-
} & StyledImageProps, "hidden" | "children" | "as" | "src">;
|
|
36
|
+
} & StyledImageProps, "hidden" | "children" | "as" | "left" | "right" | "bottom" | "top" | "src" | "position">;
|
|
21
37
|
export { StyledImage };
|
|
@@ -12,18 +12,42 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
12
12
|
const StyledImage = exports.StyledImage = _styledComponents.default.div.attrs(({
|
|
13
13
|
src,
|
|
14
14
|
children,
|
|
15
|
-
hidden = false
|
|
15
|
+
hidden = false,
|
|
16
|
+
position,
|
|
17
|
+
top,
|
|
18
|
+
right,
|
|
19
|
+
bottom,
|
|
20
|
+
left
|
|
16
21
|
}) => ({
|
|
17
22
|
...(src && {
|
|
18
23
|
as: "img"
|
|
19
24
|
}),
|
|
20
25
|
children: src ? undefined : children,
|
|
21
26
|
src,
|
|
22
|
-
hidden
|
|
27
|
+
hidden,
|
|
28
|
+
position,
|
|
29
|
+
top,
|
|
30
|
+
right,
|
|
31
|
+
bottom,
|
|
32
|
+
left
|
|
23
33
|
}))`
|
|
24
34
|
${_styledSystem.margin}
|
|
25
35
|
${_styledSystem.layout}
|
|
26
36
|
|
|
37
|
+
${({
|
|
38
|
+
position,
|
|
39
|
+
top,
|
|
40
|
+
right,
|
|
41
|
+
bottom,
|
|
42
|
+
left
|
|
43
|
+
}) => (0, _styledComponents.css)`
|
|
44
|
+
position: ${position};
|
|
45
|
+
top: ${top};
|
|
46
|
+
right: ${right};
|
|
47
|
+
bottom: ${bottom};
|
|
48
|
+
left: ${left};
|
|
49
|
+
`}
|
|
50
|
+
|
|
27
51
|
${({
|
|
28
52
|
as
|
|
29
53
|
}) => as !== "img" && (0, _styledComponents.css)`
|
|
@@ -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 }; }
|