@sb1/ffe-form-react 20.0.3 → 20.1.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/es/Checkbox.js +2 -1
- package/es/InputGroup.js +13 -6
- package/es/Label.js +2 -1
- package/es/RadioButton.js +5 -2
- package/es/RadioButtonInputGroup.js +10 -6
- package/es/Tooltip.js +2 -1
- package/es/message/BaseFieldMessage.js +2 -2
- package/lib/Checkbox.js +2 -1
- package/lib/InputGroup.js +13 -6
- package/lib/Label.js +2 -1
- package/lib/RadioButton.js +5 -2
- package/lib/RadioButtonInputGroup.js +10 -6
- package/lib/Tooltip.js +2 -1
- package/lib/message/BaseFieldMessage.js +2 -2
- package/package.json +4 -4
- package/types/Checkbox.d.ts +2 -0
- package/types/InputGroup.d.ts +5 -0
- package/types/Label.d.ts +2 -0
- package/types/RadioButton.d.ts +2 -0
- package/types/RadioButtonInputGroup.d.ts +6 -1
- package/types/Tooltip.d.ts +2 -0
- package/types/message/BaseFieldMessage.d.ts +2 -0
package/es/Checkbox.js
CHANGED
|
@@ -24,7 +24,7 @@ import React, { useRef } from 'react';
|
|
|
24
24
|
import { v4 as uuid } from 'uuid';
|
|
25
25
|
import classNames from 'classnames';
|
|
26
26
|
export var Checkbox = React.forwardRef(function (_a, ref) {
|
|
27
|
-
var children = _a.children, hiddenLabel = _a.hiddenLabel, _b = _a.inline, inline = _b === void 0 ? true : _b, noMargins = _a.noMargins, id = _a.id, rest = __rest(_a, ["children", "hiddenLabel", "inline", "noMargins", "id"]);
|
|
27
|
+
var children = _a.children, hiddenLabel = _a.hiddenLabel, _b = _a.inline, inline = _b === void 0 ? true : _b, noMargins = _a.noMargins, id = _a.id, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["children", "hiddenLabel", "inline", "noMargins", "id", "onColoredBg"]);
|
|
28
28
|
var generatedId = useRef(id !== null && id !== void 0 ? id : "checkbox-".concat(uuid())).current;
|
|
29
29
|
var labelProps = {
|
|
30
30
|
className: classNames({
|
|
@@ -32,6 +32,7 @@ export var Checkbox = React.forwardRef(function (_a, ref) {
|
|
|
32
32
|
'ffe-checkbox--inline': inline,
|
|
33
33
|
'ffe-checkbox--no-margin': noMargins,
|
|
34
34
|
'ffe-checkbox--hidden-label': hiddenLabel,
|
|
35
|
+
'ffe-checkbox--on-colored-bg': onColoredBg,
|
|
35
36
|
}),
|
|
36
37
|
htmlFor: generatedId,
|
|
37
38
|
};
|
package/es/InputGroup.js
CHANGED
|
@@ -36,7 +36,7 @@ var getChildrenWithExtraProps = function (children, extraProps) {
|
|
|
36
36
|
return children;
|
|
37
37
|
};
|
|
38
38
|
export var InputGroup = function (_a) {
|
|
39
|
-
var inputId = _a.inputId, children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, label = _a.label, fieldMessage = _a.fieldMessage, tooltip = _a.tooltip, onTooltipToggle = _a.onTooltipToggle, labelId = _a.labelId, rest = __rest(_a, ["inputId", "children", "className", "extraMargin", "description", "label", "fieldMessage", "tooltip", "onTooltipToggle", "labelId"]);
|
|
39
|
+
var inputId = _a.inputId, children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, label = _a.label, fieldMessage = _a.fieldMessage, tooltip = _a.tooltip, onTooltipToggle = _a.onTooltipToggle, labelId = _a.labelId, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["inputId", "children", "className", "extraMargin", "description", "label", "fieldMessage", "tooltip", "onTooltipToggle", "labelId", "onColoredBg"]);
|
|
40
40
|
var id = useRef(inputId ? inputId : "input-".concat(uuid())).current;
|
|
41
41
|
var descriptionId = description ? "".concat(id, "-description") : undefined;
|
|
42
42
|
if (React.Children.count(children) > 1) {
|
|
@@ -74,22 +74,29 @@ export var InputGroup = function (_a) {
|
|
|
74
74
|
id: id,
|
|
75
75
|
'aria-invalid': isInvalid ? 'true' : 'false',
|
|
76
76
|
'aria-describedby': ariaDescribedBy,
|
|
77
|
+
onColoredBg: onColoredBg,
|
|
77
78
|
};
|
|
78
79
|
var modifiedChildren = getChildrenWithExtraProps(children, extraProps);
|
|
79
|
-
return (React.createElement("div", __assign({ className: classNames('ffe-input-group', {
|
|
80
|
-
|
|
80
|
+
return (React.createElement("div", __assign({ className: classNames('ffe-input-group', {
|
|
81
|
+
'ffe-input-group--on-colored-bg': onColoredBg,
|
|
82
|
+
'ffe-input-group--no-extra-margin': !extraMargin,
|
|
83
|
+
'ffe-input-group--message': hasMessage,
|
|
84
|
+
}, className) }, rest),
|
|
85
|
+
typeof label === 'string' ? (React.createElement(Label, { htmlFor: id, id: labelId, onColoredBg: onColoredBg }, label)) : (React.isValidElement(label) &&
|
|
81
86
|
React.cloneElement(label, {
|
|
82
87
|
htmlFor: id,
|
|
83
88
|
id: labelId,
|
|
89
|
+
onColoredBg: onColoredBg,
|
|
84
90
|
})),
|
|
85
|
-
typeof tooltip === 'string' && (React.createElement(Tooltip, { onClick: onTooltipToggle }, tooltip)),
|
|
86
|
-
tooltip === true && React.createElement(Tooltip, { onClick: onTooltipToggle }),
|
|
91
|
+
typeof tooltip === 'string' && (React.createElement(Tooltip, { onClick: onTooltipToggle, onColoredBg: onColoredBg }, tooltip)),
|
|
92
|
+
tooltip === true && (React.createElement(Tooltip, { onClick: onTooltipToggle, onColoredBg: onColoredBg })),
|
|
87
93
|
React.isValidElement(tooltip) && tooltip,
|
|
88
94
|
description && (React.createElement("div", { className: "ffe-small-text ffe-input-group__description", id: descriptionId }, description)),
|
|
89
95
|
modifiedChildren,
|
|
90
|
-
typeof fieldMessage === 'string' && (React.createElement(ErrorFieldMessage, { as: "p", id: fieldMessageId }, fieldMessage)),
|
|
96
|
+
typeof fieldMessage === 'string' && (React.createElement(ErrorFieldMessage, { as: "p", id: fieldMessageId, onColoredBg: onColoredBg }, fieldMessage)),
|
|
91
97
|
React.isValidElement(fieldMessage) &&
|
|
92
98
|
React.cloneElement(fieldMessage, {
|
|
93
99
|
id: fieldMessageId,
|
|
100
|
+
onColoredBg: onColoredBg,
|
|
94
101
|
})));
|
|
95
102
|
};
|
package/es/Label.js
CHANGED
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
export var Label = function (_a) {
|
|
26
|
-
var block = _a.block, children = _a.children, className = _a.className, htmlFor = _a.htmlFor, rest = __rest(_a, ["block", "children", "className", "htmlFor"]);
|
|
26
|
+
var block = _a.block, children = _a.children, className = _a.className, htmlFor = _a.htmlFor, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["block", "children", "className", "htmlFor", "onColoredBg"]);
|
|
27
27
|
return (React.createElement("label", __assign({ className: classNames('ffe-form-label', className, {
|
|
28
28
|
'ffe-form-label--block': block,
|
|
29
|
+
'ffe-form-label--on-colored-bg': onColoredBg,
|
|
29
30
|
}), htmlFor: htmlFor }, rest), children));
|
|
30
31
|
};
|
package/es/RadioButton.js
CHANGED
|
@@ -24,6 +24,9 @@ import React from 'react';
|
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
import { BaseRadioButton } from './BaseRadioButton';
|
|
26
26
|
export var RadioButton = function (_a) {
|
|
27
|
-
var className = _a.className, inline = _a.inline, rest = __rest(_a, ["className", "inline"]);
|
|
28
|
-
return (React.createElement(BaseRadioButton, __assign({ className: classNames('ffe-radio-button', {
|
|
27
|
+
var className = _a.className, inline = _a.inline, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["className", "inline", "onColoredBg"]);
|
|
28
|
+
return (React.createElement(BaseRadioButton, __assign({ className: classNames('ffe-radio-button', {
|
|
29
|
+
'ffe-radio-button--inline': inline,
|
|
30
|
+
'ffe-radio-button--on-colored-bg': onColoredBg,
|
|
31
|
+
}, className) }, rest)));
|
|
29
32
|
};
|
|
@@ -26,17 +26,17 @@ import { ErrorFieldMessage } from './message';
|
|
|
26
26
|
import { Tooltip } from './Tooltip';
|
|
27
27
|
import { v4 as uuid } from 'uuid';
|
|
28
28
|
export var RadioButtonInputGroup = function (_a) {
|
|
29
|
-
var children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, fieldMessage = _a.fieldMessage, inline = _a.inline, label = _a.label, name = _a.name, selectedValue = _a.selectedValue, tooltip = _a.tooltip, onChange = _a.onChange, rest = __rest(_a, ["children", "className", "extraMargin", "description", "fieldMessage", "inline", "label", "name", "selectedValue", "tooltip", "onChange"]);
|
|
29
|
+
var children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, fieldMessage = _a.fieldMessage, inline = _a.inline, label = _a.label, name = _a.name, selectedValue = _a.selectedValue, tooltip = _a.tooltip, onChange = _a.onChange, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["children", "className", "extraMargin", "description", "fieldMessage", "inline", "label", "name", "selectedValue", "tooltip", "onChange", "onColoredBg"]);
|
|
30
30
|
if (tooltip && description) {
|
|
31
31
|
throw new Error('Don\'t use both "tooltip" and "description" on an <RadioButtonInputGroup />, pick one of them');
|
|
32
32
|
}
|
|
33
33
|
var id = useRef(uuid()).current;
|
|
34
|
-
return (React.createElement("fieldset", __assign({ "aria-labelledby": id, className: classNames('ffe-input-group', { 'ffe-input-group--no-extra-margin': !extraMargin }, { 'ffe-input-group--message': !!fieldMessage }, className) }, rest),
|
|
35
|
-
label && (React.createElement("div", { id: id, className: classNames('ffe-form-label', 'ffe-form-label--block') },
|
|
34
|
+
return (React.createElement("fieldset", __assign({ "aria-labelledby": id, className: classNames('ffe-input-group', { 'ffe-input-group--on-colored-bg': onColoredBg }, { 'ffe-input-group--no-extra-margin': !extraMargin }, { 'ffe-input-group--message': !!fieldMessage }, className) }, rest),
|
|
35
|
+
label && (React.createElement("div", { id: id, className: classNames('ffe-form-label', 'ffe-form-label--block', { 'ffe-form-label--on-colored-bg': onColoredBg }) },
|
|
36
36
|
label,
|
|
37
|
-
typeof tooltip === 'string' && (React.createElement(Tooltip,
|
|
37
|
+
typeof tooltip === 'string' && (React.createElement(Tooltip, { onColoredBg: onColoredBg }, tooltip)),
|
|
38
38
|
React.isValidElement(tooltip) && tooltip)),
|
|
39
|
-
|
|
39
|
+
description && (React.createElement("div", { className: "ffe-input-group__description ffe-small-text" }, description)),
|
|
40
40
|
children({
|
|
41
41
|
inline: inline,
|
|
42
42
|
name: name,
|
|
@@ -44,6 +44,10 @@ export var RadioButtonInputGroup = function (_a) {
|
|
|
44
44
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
45
45
|
},
|
|
46
46
|
selectedValue: selectedValue,
|
|
47
|
+
onColoredBg: onColoredBg,
|
|
47
48
|
}),
|
|
48
|
-
typeof fieldMessage === 'string' ? (React.createElement(ErrorFieldMessage, { as: "p" }, fieldMessage)) : (fieldMessage)
|
|
49
|
+
typeof fieldMessage === 'string' ? (React.createElement(ErrorFieldMessage, { as: "p", onColoredBg: onColoredBg }, fieldMessage)) : (React.isValidElement(fieldMessage) &&
|
|
50
|
+
React.cloneElement(fieldMessage, {
|
|
51
|
+
onColoredBg: onColoredBg,
|
|
52
|
+
}))));
|
|
49
53
|
};
|
package/es/Tooltip.js
CHANGED
|
@@ -14,7 +14,7 @@ import classNames from 'classnames';
|
|
|
14
14
|
import { Collapse } from '@sb1/ffe-collapse-react';
|
|
15
15
|
import { v4 as uuid } from 'uuid';
|
|
16
16
|
export var Tooltip = React.forwardRef(function (_a, ref) {
|
|
17
|
-
var initialIsOpen = _a.isOpen, ariaControls = _a["aria-controls"], _b = _a["aria-label"], ariaLabel = _b === void 0 ? 'Vis hjelpetekst' : _b, children = _a.children, className = _a.className, onClick = _a.onClick, tabIndex = _a.tabIndex, containerProps = _a.containerProps;
|
|
17
|
+
var initialIsOpen = _a.isOpen, ariaControls = _a["aria-controls"], _b = _a["aria-label"], ariaLabel = _b === void 0 ? 'Vis hjelpetekst' : _b, children = _a.children, className = _a.className, onClick = _a.onClick, tabIndex = _a.tabIndex, containerProps = _a.containerProps, onColoredBg = _a.onColoredBg;
|
|
18
18
|
var tooltipButtonId = useRef(uuid()).current;
|
|
19
19
|
var tooltipId = useRef(uuid()).current;
|
|
20
20
|
var _c = useState(!!initialIsOpen), isOpen = _c[0], setIsOpen = _c[1];
|
|
@@ -26,6 +26,7 @@ export var Tooltip = React.forwardRef(function (_a, ref) {
|
|
|
26
26
|
};
|
|
27
27
|
return (React.createElement("div", __assign({}, containerProps, { className: classNames('ffe-tooltip', {
|
|
28
28
|
'ffe-tooltip--open': isOpen,
|
|
29
|
+
'ffe-tooltip--on-colored-bg': onColoredBg,
|
|
29
30
|
}) }),
|
|
30
31
|
React.createElement("button", { ref: ref, "aria-expanded": isOpen, "aria-controls": children ? tooltipId : ariaControls, "aria-label": ariaLabel, className: "ffe-tooltip__icon", onClick: handleClick, type: "button", tabIndex: tabIndex, id: tooltipButtonId },
|
|
31
32
|
React.createElement("span", { "aria-hidden": true }, "?")),
|
|
@@ -28,11 +28,11 @@ import classNames from 'classnames';
|
|
|
28
28
|
* @ignore
|
|
29
29
|
*/
|
|
30
30
|
export var BaseFieldMessage = function (props) {
|
|
31
|
-
var children = props.children, className = props.className, _a = props.as, Comp = _a === void 0 ? 'div' : _a, type = props.type, _b = props.role, role = _b === void 0 ? 'status' : _b, rest = __rest(props, ["children", "className", "as", "type", "role"]);
|
|
31
|
+
var children = props.children, className = props.className, _a = props.as, Comp = _a === void 0 ? 'div' : _a, type = props.type, _b = props.role, role = _b === void 0 ? 'status' : _b, onColoredBg = props.onColoredBg, rest = __rest(props, ["children", "className", "as", "type", "role", "onColoredBg"]);
|
|
32
32
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
33
33
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
34
34
|
var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
35
|
-
return (React.createElement(Comp, __assign({ className: classNames("ffe-field-message", "ffe-field-message--".concat(type), className), role: role }, rest),
|
|
35
|
+
return (React.createElement(Comp, __assign({ className: classNames("ffe-field-message", { 'ffe-field-message--on-colored-bg': onColoredBg }, "ffe-field-message--".concat(type), className), role: role }, rest),
|
|
36
36
|
React.createElement("span", { className: classNames("ffe-field-message__icon", "ffe-field-message__icon--".concat(type, "'")) }, (function () {
|
|
37
37
|
switch (type) {
|
|
38
38
|
case 'error':
|
package/lib/Checkbox.js
CHANGED
|
@@ -53,7 +53,7 @@ var react_1 = __importStar(require("react"));
|
|
|
53
53
|
var uuid_1 = require("uuid");
|
|
54
54
|
var classnames_1 = __importDefault(require("classnames"));
|
|
55
55
|
exports.Checkbox = react_1.default.forwardRef(function (_a, ref) {
|
|
56
|
-
var children = _a.children, hiddenLabel = _a.hiddenLabel, _b = _a.inline, inline = _b === void 0 ? true : _b, noMargins = _a.noMargins, id = _a.id, rest = __rest(_a, ["children", "hiddenLabel", "inline", "noMargins", "id"]);
|
|
56
|
+
var children = _a.children, hiddenLabel = _a.hiddenLabel, _b = _a.inline, inline = _b === void 0 ? true : _b, noMargins = _a.noMargins, id = _a.id, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["children", "hiddenLabel", "inline", "noMargins", "id", "onColoredBg"]);
|
|
57
57
|
var generatedId = (0, react_1.useRef)(id !== null && id !== void 0 ? id : "checkbox-".concat((0, uuid_1.v4)())).current;
|
|
58
58
|
var labelProps = {
|
|
59
59
|
className: (0, classnames_1.default)({
|
|
@@ -61,6 +61,7 @@ exports.Checkbox = react_1.default.forwardRef(function (_a, ref) {
|
|
|
61
61
|
'ffe-checkbox--inline': inline,
|
|
62
62
|
'ffe-checkbox--no-margin': noMargins,
|
|
63
63
|
'ffe-checkbox--hidden-label': hiddenLabel,
|
|
64
|
+
'ffe-checkbox--on-colored-bg': onColoredBg,
|
|
64
65
|
}),
|
|
65
66
|
htmlFor: generatedId,
|
|
66
67
|
};
|
package/lib/InputGroup.js
CHANGED
|
@@ -65,7 +65,7 @@ var getChildrenWithExtraProps = function (children, extraProps) {
|
|
|
65
65
|
return children;
|
|
66
66
|
};
|
|
67
67
|
var InputGroup = function (_a) {
|
|
68
|
-
var inputId = _a.inputId, children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, label = _a.label, fieldMessage = _a.fieldMessage, tooltip = _a.tooltip, onTooltipToggle = _a.onTooltipToggle, labelId = _a.labelId, rest = __rest(_a, ["inputId", "children", "className", "extraMargin", "description", "label", "fieldMessage", "tooltip", "onTooltipToggle", "labelId"]);
|
|
68
|
+
var inputId = _a.inputId, children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, label = _a.label, fieldMessage = _a.fieldMessage, tooltip = _a.tooltip, onTooltipToggle = _a.onTooltipToggle, labelId = _a.labelId, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["inputId", "children", "className", "extraMargin", "description", "label", "fieldMessage", "tooltip", "onTooltipToggle", "labelId", "onColoredBg"]);
|
|
69
69
|
var id = (0, react_1.useRef)(inputId ? inputId : "input-".concat((0, uuid_1.v4)())).current;
|
|
70
70
|
var descriptionId = description ? "".concat(id, "-description") : undefined;
|
|
71
71
|
if (react_1.default.Children.count(children) > 1) {
|
|
@@ -103,23 +103,30 @@ var InputGroup = function (_a) {
|
|
|
103
103
|
id: id,
|
|
104
104
|
'aria-invalid': isInvalid ? 'true' : 'false',
|
|
105
105
|
'aria-describedby': ariaDescribedBy,
|
|
106
|
+
onColoredBg: onColoredBg,
|
|
106
107
|
};
|
|
107
108
|
var modifiedChildren = getChildrenWithExtraProps(children, extraProps);
|
|
108
|
-
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('ffe-input-group', {
|
|
109
|
-
|
|
109
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('ffe-input-group', {
|
|
110
|
+
'ffe-input-group--on-colored-bg': onColoredBg,
|
|
111
|
+
'ffe-input-group--no-extra-margin': !extraMargin,
|
|
112
|
+
'ffe-input-group--message': hasMessage,
|
|
113
|
+
}, className) }, rest),
|
|
114
|
+
typeof label === 'string' ? (react_1.default.createElement(Label_1.Label, { htmlFor: id, id: labelId, onColoredBg: onColoredBg }, label)) : (react_1.default.isValidElement(label) &&
|
|
110
115
|
react_1.default.cloneElement(label, {
|
|
111
116
|
htmlFor: id,
|
|
112
117
|
id: labelId,
|
|
118
|
+
onColoredBg: onColoredBg,
|
|
113
119
|
})),
|
|
114
|
-
typeof tooltip === 'string' && (react_1.default.createElement(Tooltip_1.Tooltip, { onClick: onTooltipToggle }, tooltip)),
|
|
115
|
-
tooltip === true && react_1.default.createElement(Tooltip_1.Tooltip, { onClick: onTooltipToggle }),
|
|
120
|
+
typeof tooltip === 'string' && (react_1.default.createElement(Tooltip_1.Tooltip, { onClick: onTooltipToggle, onColoredBg: onColoredBg }, tooltip)),
|
|
121
|
+
tooltip === true && (react_1.default.createElement(Tooltip_1.Tooltip, { onClick: onTooltipToggle, onColoredBg: onColoredBg })),
|
|
116
122
|
react_1.default.isValidElement(tooltip) && tooltip,
|
|
117
123
|
description && (react_1.default.createElement("div", { className: "ffe-small-text ffe-input-group__description", id: descriptionId }, description)),
|
|
118
124
|
modifiedChildren,
|
|
119
|
-
typeof fieldMessage === 'string' && (react_1.default.createElement(message_1.ErrorFieldMessage, { as: "p", id: fieldMessageId }, fieldMessage)),
|
|
125
|
+
typeof fieldMessage === 'string' && (react_1.default.createElement(message_1.ErrorFieldMessage, { as: "p", id: fieldMessageId, onColoredBg: onColoredBg }, fieldMessage)),
|
|
120
126
|
react_1.default.isValidElement(fieldMessage) &&
|
|
121
127
|
react_1.default.cloneElement(fieldMessage, {
|
|
122
128
|
id: fieldMessageId,
|
|
129
|
+
onColoredBg: onColoredBg,
|
|
123
130
|
})));
|
|
124
131
|
};
|
|
125
132
|
exports.InputGroup = InputGroup;
|
package/lib/Label.js
CHANGED
|
@@ -29,9 +29,10 @@ exports.Label = void 0;
|
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
var Label = function (_a) {
|
|
32
|
-
var block = _a.block, children = _a.children, className = _a.className, htmlFor = _a.htmlFor, rest = __rest(_a, ["block", "children", "className", "htmlFor"]);
|
|
32
|
+
var block = _a.block, children = _a.children, className = _a.className, htmlFor = _a.htmlFor, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["block", "children", "className", "htmlFor", "onColoredBg"]);
|
|
33
33
|
return (react_1.default.createElement("label", __assign({ className: (0, classnames_1.default)('ffe-form-label', className, {
|
|
34
34
|
'ffe-form-label--block': block,
|
|
35
|
+
'ffe-form-label--on-colored-bg': onColoredBg,
|
|
35
36
|
}), htmlFor: htmlFor }, rest), children));
|
|
36
37
|
};
|
|
37
38
|
exports.Label = Label;
|
package/lib/RadioButton.js
CHANGED
|
@@ -30,7 +30,10 @@ var react_1 = __importDefault(require("react"));
|
|
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
var BaseRadioButton_1 = require("./BaseRadioButton");
|
|
32
32
|
var RadioButton = function (_a) {
|
|
33
|
-
var className = _a.className, inline = _a.inline, rest = __rest(_a, ["className", "inline"]);
|
|
34
|
-
return (react_1.default.createElement(BaseRadioButton_1.BaseRadioButton, __assign({ className: (0, classnames_1.default)('ffe-radio-button', {
|
|
33
|
+
var className = _a.className, inline = _a.inline, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["className", "inline", "onColoredBg"]);
|
|
34
|
+
return (react_1.default.createElement(BaseRadioButton_1.BaseRadioButton, __assign({ className: (0, classnames_1.default)('ffe-radio-button', {
|
|
35
|
+
'ffe-radio-button--inline': inline,
|
|
36
|
+
'ffe-radio-button--on-colored-bg': onColoredBg,
|
|
37
|
+
}, className) }, rest)));
|
|
35
38
|
};
|
|
36
39
|
exports.RadioButton = RadioButton;
|
|
@@ -55,17 +55,17 @@ var message_1 = require("./message");
|
|
|
55
55
|
var Tooltip_1 = require("./Tooltip");
|
|
56
56
|
var uuid_1 = require("uuid");
|
|
57
57
|
var RadioButtonInputGroup = function (_a) {
|
|
58
|
-
var children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, fieldMessage = _a.fieldMessage, inline = _a.inline, label = _a.label, name = _a.name, selectedValue = _a.selectedValue, tooltip = _a.tooltip, onChange = _a.onChange, rest = __rest(_a, ["children", "className", "extraMargin", "description", "fieldMessage", "inline", "label", "name", "selectedValue", "tooltip", "onChange"]);
|
|
58
|
+
var children = _a.children, className = _a.className, _b = _a.extraMargin, extraMargin = _b === void 0 ? true : _b, description = _a.description, fieldMessage = _a.fieldMessage, inline = _a.inline, label = _a.label, name = _a.name, selectedValue = _a.selectedValue, tooltip = _a.tooltip, onChange = _a.onChange, onColoredBg = _a.onColoredBg, rest = __rest(_a, ["children", "className", "extraMargin", "description", "fieldMessage", "inline", "label", "name", "selectedValue", "tooltip", "onChange", "onColoredBg"]);
|
|
59
59
|
if (tooltip && description) {
|
|
60
60
|
throw new Error('Don\'t use both "tooltip" and "description" on an <RadioButtonInputGroup />, pick one of them');
|
|
61
61
|
}
|
|
62
62
|
var id = (0, react_1.useRef)((0, uuid_1.v4)()).current;
|
|
63
|
-
return (react_1.default.createElement("fieldset", __assign({ "aria-labelledby": id, className: (0, classnames_1.default)('ffe-input-group', { 'ffe-input-group--no-extra-margin': !extraMargin }, { 'ffe-input-group--message': !!fieldMessage }, className) }, rest),
|
|
64
|
-
label && (react_1.default.createElement("div", { id: id, className: (0, classnames_1.default)('ffe-form-label', 'ffe-form-label--block') },
|
|
63
|
+
return (react_1.default.createElement("fieldset", __assign({ "aria-labelledby": id, className: (0, classnames_1.default)('ffe-input-group', { 'ffe-input-group--on-colored-bg': onColoredBg }, { 'ffe-input-group--no-extra-margin': !extraMargin }, { 'ffe-input-group--message': !!fieldMessage }, className) }, rest),
|
|
64
|
+
label && (react_1.default.createElement("div", { id: id, className: (0, classnames_1.default)('ffe-form-label', 'ffe-form-label--block', { 'ffe-form-label--on-colored-bg': onColoredBg }) },
|
|
65
65
|
label,
|
|
66
|
-
typeof tooltip === 'string' && (react_1.default.createElement(Tooltip_1.Tooltip,
|
|
66
|
+
typeof tooltip === 'string' && (react_1.default.createElement(Tooltip_1.Tooltip, { onColoredBg: onColoredBg }, tooltip)),
|
|
67
67
|
react_1.default.isValidElement(tooltip) && tooltip)),
|
|
68
|
-
|
|
68
|
+
description && (react_1.default.createElement("div", { className: "ffe-input-group__description ffe-small-text" }, description)),
|
|
69
69
|
children({
|
|
70
70
|
inline: inline,
|
|
71
71
|
name: name,
|
|
@@ -73,7 +73,11 @@ var RadioButtonInputGroup = function (_a) {
|
|
|
73
73
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
74
74
|
},
|
|
75
75
|
selectedValue: selectedValue,
|
|
76
|
+
onColoredBg: onColoredBg,
|
|
76
77
|
}),
|
|
77
|
-
typeof fieldMessage === 'string' ? (react_1.default.createElement(message_1.ErrorFieldMessage, { as: "p" }, fieldMessage)) : (fieldMessage)
|
|
78
|
+
typeof fieldMessage === 'string' ? (react_1.default.createElement(message_1.ErrorFieldMessage, { as: "p", onColoredBg: onColoredBg }, fieldMessage)) : (react_1.default.isValidElement(fieldMessage) &&
|
|
79
|
+
react_1.default.cloneElement(fieldMessage, {
|
|
80
|
+
onColoredBg: onColoredBg,
|
|
81
|
+
}))));
|
|
78
82
|
};
|
|
79
83
|
exports.RadioButtonInputGroup = RadioButtonInputGroup;
|
package/lib/Tooltip.js
CHANGED
|
@@ -43,7 +43,7 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
43
43
|
var ffe_collapse_react_1 = require("@sb1/ffe-collapse-react");
|
|
44
44
|
var uuid_1 = require("uuid");
|
|
45
45
|
exports.Tooltip = react_1.default.forwardRef(function (_a, ref) {
|
|
46
|
-
var initialIsOpen = _a.isOpen, ariaControls = _a["aria-controls"], _b = _a["aria-label"], ariaLabel = _b === void 0 ? 'Vis hjelpetekst' : _b, children = _a.children, className = _a.className, onClick = _a.onClick, tabIndex = _a.tabIndex, containerProps = _a.containerProps;
|
|
46
|
+
var initialIsOpen = _a.isOpen, ariaControls = _a["aria-controls"], _b = _a["aria-label"], ariaLabel = _b === void 0 ? 'Vis hjelpetekst' : _b, children = _a.children, className = _a.className, onClick = _a.onClick, tabIndex = _a.tabIndex, containerProps = _a.containerProps, onColoredBg = _a.onColoredBg;
|
|
47
47
|
var tooltipButtonId = (0, react_1.useRef)((0, uuid_1.v4)()).current;
|
|
48
48
|
var tooltipId = (0, react_1.useRef)((0, uuid_1.v4)()).current;
|
|
49
49
|
var _c = (0, react_1.useState)(!!initialIsOpen), isOpen = _c[0], setIsOpen = _c[1];
|
|
@@ -55,6 +55,7 @@ exports.Tooltip = react_1.default.forwardRef(function (_a, ref) {
|
|
|
55
55
|
};
|
|
56
56
|
return (react_1.default.createElement("div", __assign({}, containerProps, { className: (0, classnames_1.default)('ffe-tooltip', {
|
|
57
57
|
'ffe-tooltip--open': isOpen,
|
|
58
|
+
'ffe-tooltip--on-colored-bg': onColoredBg,
|
|
58
59
|
}) }),
|
|
59
60
|
react_1.default.createElement("button", { ref: ref, "aria-expanded": isOpen, "aria-controls": children ? tooltipId : ariaControls, "aria-label": ariaLabel, className: "ffe-tooltip__icon", onClick: handleClick, type: "button", tabIndex: tabIndex, id: tooltipButtonId },
|
|
60
61
|
react_1.default.createElement("span", { "aria-hidden": true }, "?")),
|
|
@@ -34,11 +34,11 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
34
34
|
* @ignore
|
|
35
35
|
*/
|
|
36
36
|
var BaseFieldMessage = function (props) {
|
|
37
|
-
var children = props.children, className = props.className, _a = props.as, Comp = _a === void 0 ? 'div' : _a, type = props.type, _b = props.role, role = _b === void 0 ? 'status' : _b, rest = __rest(props, ["children", "className", "as", "type", "role"]);
|
|
37
|
+
var children = props.children, className = props.className, _a = props.as, Comp = _a === void 0 ? 'div' : _a, type = props.type, _b = props.role, role = _b === void 0 ? 'status' : _b, onColoredBg = props.onColoredBg, rest = __rest(props, ["children", "className", "as", "type", "role", "onColoredBg"]);
|
|
38
38
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
39
39
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
40
40
|
var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
41
|
-
return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)("ffe-field-message", "ffe-field-message--".concat(type), className), role: role }, rest),
|
|
41
|
+
return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)("ffe-field-message", { 'ffe-field-message--on-colored-bg': onColoredBg }, "ffe-field-message--".concat(type), className), role: role }, rest),
|
|
42
42
|
react_1.default.createElement("span", { className: (0, classnames_1.default)("ffe-field-message__icon", "ffe-field-message__icon--".concat(type, "'")) }, (function () {
|
|
43
43
|
switch (type) {
|
|
44
44
|
case 'error':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-form-react",
|
|
3
|
-
"version": "20.0
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "React component for form elements in ffe",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"test:watch": "ffe-buildtool jest --watch"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sb1/ffe-collapse-react": "^4.0.
|
|
30
|
-
"@sb1/ffe-form": "^29.0
|
|
29
|
+
"@sb1/ffe-collapse-react": "^4.0.10",
|
|
30
|
+
"@sb1/ffe-form": "^29.1.0",
|
|
31
31
|
"@sb1/ffe-icons-react": "^10.0.5",
|
|
32
32
|
"@types/uuid": "^9.0.0",
|
|
33
33
|
"classnames": "^2.3.1",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "02233b655c8ecfe9066cc50bd67f0a299e9ab549"
|
|
49
49
|
}
|
package/types/Checkbox.d.ts
CHANGED
|
@@ -9,5 +9,7 @@ export interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<'inpu
|
|
|
9
9
|
className: string;
|
|
10
10
|
htmlFor: string;
|
|
11
11
|
}) => React.ReactNode);
|
|
12
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
13
|
+
onColoredBg?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
package/types/InputGroup.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type ChildrenExtraProps = {
|
|
|
4
4
|
id: string;
|
|
5
5
|
'aria-invalid': 'true' | 'false';
|
|
6
6
|
'aria-describedby': string | undefined;
|
|
7
|
+
onColoredBg?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export interface InputGroupProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
9
10
|
/** The id that will be used on the input child if you don't want a generated one */
|
|
@@ -20,6 +21,7 @@ export interface InputGroupProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
20
21
|
/** Use the ErrorFieldMessage component if you need more flexibility in how the content is rendered. */
|
|
21
22
|
fieldMessage?: string | React.ReactElement<{
|
|
22
23
|
id: string;
|
|
24
|
+
onColoredBg?: boolean;
|
|
23
25
|
}> | null;
|
|
24
26
|
/** To just render a static, always visible tooltip, use this. */
|
|
25
27
|
description?: string;
|
|
@@ -27,10 +29,13 @@ export interface InputGroupProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
27
29
|
label?: string | React.ReactElement<{
|
|
28
30
|
id: string;
|
|
29
31
|
htmlFor: string;
|
|
32
|
+
onColoredBg?: boolean;
|
|
30
33
|
}>;
|
|
31
34
|
onTooltipToggle?: TooltipProps['onClick'];
|
|
32
35
|
/** Use the Tooltip component if you need more flexibility in how the content is rendered. */
|
|
33
36
|
tooltip?: React.ReactNode;
|
|
37
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
38
|
+
onColoredBg?: boolean;
|
|
34
39
|
}
|
|
35
40
|
export declare const InputGroup: React.FC<InputGroupProps>;
|
|
36
41
|
export {};
|
package/types/Label.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export interface LabelProps extends React.ComponentPropsWithoutRef<'label'> {
|
|
|
5
5
|
* Set this to `true` if you don't use tooltips and need the label to be `display: block;`.
|
|
6
6
|
*/
|
|
7
7
|
block?: boolean;
|
|
8
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
9
|
+
onColoredBg?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const Label: React.FC<LabelProps>;
|
package/types/RadioButton.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ import { BaseRadioButtonProps } from './BaseRadioButton';
|
|
|
3
3
|
export interface RadioButtonProps extends BaseRadioButtonProps {
|
|
4
4
|
/** Indicates whether the radio button is rendered inline or as a block */
|
|
5
5
|
inline?: boolean;
|
|
6
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
7
|
+
onColoredBg?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare const RadioButton: React.FC<RadioButtonProps>;
|
|
@@ -10,6 +10,7 @@ export interface RadioButtonInputGroupProps extends Omit<React.ComponentPropsWit
|
|
|
10
10
|
name: string;
|
|
11
11
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
12
12
|
selectedValue?: boolean | string | number | null;
|
|
13
|
+
onColoredBg?: boolean;
|
|
13
14
|
}) => React.ReactNode;
|
|
14
15
|
/** Additional class names applied to the fieldset */
|
|
15
16
|
className?: string;
|
|
@@ -21,7 +22,9 @@ export interface RadioButtonInputGroupProps extends Omit<React.ComponentPropsWit
|
|
|
21
22
|
*/
|
|
22
23
|
extraMargin?: boolean;
|
|
23
24
|
/** String or ErrorFieldMessage component with message */
|
|
24
|
-
fieldMessage?: React.
|
|
25
|
+
fieldMessage?: string | React.ReactElement<{
|
|
26
|
+
onColoredBg?: boolean;
|
|
27
|
+
}> | null;
|
|
25
28
|
/**
|
|
26
29
|
* Indicates whether the radio buttons inside this radio button group is
|
|
27
30
|
* rendered inline or as a block.
|
|
@@ -44,5 +47,7 @@ export interface RadioButtonInputGroupProps extends Omit<React.ComponentPropsWit
|
|
|
44
47
|
* set
|
|
45
48
|
* */
|
|
46
49
|
tooltip?: React.ReactNode;
|
|
50
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
51
|
+
onColoredBg?: boolean;
|
|
47
52
|
}
|
|
48
53
|
export declare const RadioButtonInputGroup: React.FC<RadioButtonInputGroupProps>;
|
package/types/Tooltip.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export interface TooltipProps extends Pick<React.ComponentProps<'button'>, 'aria-controls' | 'aria-label' | 'children' | 'className' | 'onClick' | 'tabIndex'> {
|
|
3
3
|
containerProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
4
4
|
isOpen?: boolean;
|
|
5
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
6
|
+
onColoredBg?: boolean;
|
|
5
7
|
}
|
|
6
8
|
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -3,6 +3,8 @@ import { ComponentWithoutRefAsPropParams } from '../types';
|
|
|
3
3
|
export type BaseFieldMessageProps<As extends ElementType = any> = ComponentWithoutRefAsPropParams<As> & {
|
|
4
4
|
type: 'success' | 'info' | 'error';
|
|
5
5
|
role: 'status' | 'alert' | 'none';
|
|
6
|
+
/** Adds alternative styling for better contrast on certain backgrounds */
|
|
7
|
+
onColoredBg?: boolean;
|
|
6
8
|
};
|
|
7
9
|
/**
|
|
8
10
|
* Internal factory component
|