@oaknational/oak-components 3.7.1 → 3.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/dist/npm/cjs/index.js
CHANGED
|
@@ -3171,7 +3171,7 @@ var StyledFlexBox$3 = styled__default.default(OakFlex)(templateObject_2$x || (te
|
|
|
3171
3171
|
}, parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), StyledOakIcon$2, parseColorFilter("icon-primary"), parseColor("bg-inverted"), parseColor("text-inverted"), StyledOakIcon$2, function (props) {
|
|
3172
3172
|
return props.$keepIconColor ? "none" : parseColorFilter("text-inverted");
|
|
3173
3173
|
});
|
|
3174
|
-
var getColorSchemeTokens = function (colorScheme) {
|
|
3174
|
+
var getColorSchemeTokens = function (colorScheme, isSubdued) {
|
|
3175
3175
|
switch (colorScheme) {
|
|
3176
3176
|
case "primary":
|
|
3177
3177
|
return {
|
|
@@ -3191,9 +3191,13 @@ var getColorSchemeTokens = function (colorScheme) {
|
|
|
3191
3191
|
};
|
|
3192
3192
|
default:
|
|
3193
3193
|
return {
|
|
3194
|
-
background:
|
|
3194
|
+
background: isSubdued
|
|
3195
|
+
? "bg-".concat(colorScheme, "-very-subdued")
|
|
3196
|
+
: "bg-".concat(colorScheme, "-main"),
|
|
3195
3197
|
hoverBackground: "bg-".concat(colorScheme, "-very-subdued"),
|
|
3196
|
-
borderColor:
|
|
3198
|
+
borderColor: isSubdued
|
|
3199
|
+
? "border-neutral-lighter"
|
|
3200
|
+
: "border-".concat(colorScheme),
|
|
3197
3201
|
disabledBackground: "bg-btn-secondary-disabled",
|
|
3198
3202
|
disabledBorderColor: "border-neutral-lighter",
|
|
3199
3203
|
};
|
|
@@ -3204,7 +3208,7 @@ var getColorSchemeTokens = function (colorScheme) {
|
|
|
3204
3208
|
*/
|
|
3205
3209
|
var OakRadioAsButton = function (props) {
|
|
3206
3210
|
var id = React.useId();
|
|
3207
|
-
var value = props.value, disabled = props.disabled, innerRef = props.innerRef, displayValue = props.displayValue, onChange = props.onChange, keepIconColor = props.keepIconColor, _a = props.colorScheme, colorScheme = _a === void 0 ? "primary" : _a, width = props.width, rest = tslib.__rest(props, ["value", "disabled", "innerRef", "displayValue", "onChange", "keepIconColor", "colorScheme", "width"]);
|
|
3211
|
+
var value = props.value, disabled = props.disabled, isSubdued = props.isSubdued, innerRef = props.innerRef, displayValue = props.displayValue, onChange = props.onChange, keepIconColor = props.keepIconColor, _a = props.colorScheme, colorScheme = _a === void 0 ? "primary" : _a, width = props.width, rest = tslib.__rest(props, ["value", "disabled", "isSubdued", "innerRef", "displayValue", "onChange", "keepIconColor", "colorScheme", "width"]);
|
|
3208
3212
|
var _b = React.useContext(RadioContext), name = _b.name, onValueUpdated = _b.onValueUpdated, currentValue = _b.currentValue;
|
|
3209
3213
|
var defaultRef = React.useRef(null);
|
|
3210
3214
|
var inputRef = innerRef !== null && innerRef !== void 0 ? innerRef : defaultRef;
|
|
@@ -3216,7 +3220,7 @@ var OakRadioAsButton = function (props) {
|
|
|
3216
3220
|
}
|
|
3217
3221
|
};
|
|
3218
3222
|
var isChecked = currentValue === value;
|
|
3219
|
-
var colorSchemeTokens = getColorSchemeTokens(colorScheme);
|
|
3223
|
+
var colorSchemeTokens = getColorSchemeTokens(colorScheme, isSubdued);
|
|
3220
3224
|
var _c = rest; _c.icon; _c.variant; var restWithoutVariantProps = tslib.__rest(_c, ["icon", "variant"]);
|
|
3221
3225
|
var radio = (React__default.default.createElement(InternalRadioWrapper, { radioBorderColor: "border-neutral", radioOuterSize: "spacing-20", size: "spacing-20", disableFocusRing: true, internalRadio: React__default.default.createElement(InternalRadio, tslib.__assign({}, restWithoutVariantProps, { id: id, value: value, disabled: disabled, ref: inputRef, onChange: function (e) {
|
|
3222
3226
|
onValueUpdated === null || onValueUpdated === void 0 ? void 0 : onValueUpdated(e);
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -2630,6 +2630,7 @@ type OakRadioAsButtonProps = Omit<BaseRadioProps, "defaultChecked" | "id" | "che
|
|
|
2630
2630
|
*/
|
|
2631
2631
|
keepIconColor?: boolean;
|
|
2632
2632
|
disabled?: HTMLInputElement["disabled"];
|
|
2633
|
+
isSubdued?: boolean;
|
|
2633
2634
|
"aria-labelledby"?: React$1.AriaAttributes["aria-labelledby"];
|
|
2634
2635
|
"aria-label"?: React$1.AriaAttributes["aria-label"];
|
|
2635
2636
|
/**
|
|
@@ -35,7 +35,7 @@ var StyledFlexBox = styled(OakFlex)(templateObject_2 || (templateObject_2 = __ma
|
|
|
35
35
|
}, parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), StyledOakIcon, parseColorFilter("icon-primary"), parseColor("bg-inverted"), parseColor("text-inverted"), StyledOakIcon, function (props) {
|
|
36
36
|
return props.$keepIconColor ? "none" : parseColorFilter("text-inverted");
|
|
37
37
|
});
|
|
38
|
-
var getColorSchemeTokens = function (colorScheme) {
|
|
38
|
+
var getColorSchemeTokens = function (colorScheme, isSubdued) {
|
|
39
39
|
switch (colorScheme) {
|
|
40
40
|
case "primary":
|
|
41
41
|
return {
|
|
@@ -55,9 +55,13 @@ var getColorSchemeTokens = function (colorScheme) {
|
|
|
55
55
|
};
|
|
56
56
|
default:
|
|
57
57
|
return {
|
|
58
|
-
background:
|
|
58
|
+
background: isSubdued
|
|
59
|
+
? "bg-".concat(colorScheme, "-very-subdued")
|
|
60
|
+
: "bg-".concat(colorScheme, "-main"),
|
|
59
61
|
hoverBackground: "bg-".concat(colorScheme, "-very-subdued"),
|
|
60
|
-
borderColor:
|
|
62
|
+
borderColor: isSubdued
|
|
63
|
+
? "border-neutral-lighter"
|
|
64
|
+
: "border-".concat(colorScheme),
|
|
61
65
|
disabledBackground: "bg-btn-secondary-disabled",
|
|
62
66
|
disabledBorderColor: "border-neutral-lighter",
|
|
63
67
|
};
|
|
@@ -68,7 +72,7 @@ var getColorSchemeTokens = function (colorScheme) {
|
|
|
68
72
|
*/
|
|
69
73
|
var OakRadioAsButton = function (props) {
|
|
70
74
|
var id = useId();
|
|
71
|
-
var value = props.value, disabled = props.disabled, innerRef = props.innerRef, displayValue = props.displayValue, onChange = props.onChange, keepIconColor = props.keepIconColor, _a = props.colorScheme, colorScheme = _a === void 0 ? "primary" : _a, width = props.width, rest = __rest(props, ["value", "disabled", "innerRef", "displayValue", "onChange", "keepIconColor", "colorScheme", "width"]);
|
|
75
|
+
var value = props.value, disabled = props.disabled, isSubdued = props.isSubdued, innerRef = props.innerRef, displayValue = props.displayValue, onChange = props.onChange, keepIconColor = props.keepIconColor, _a = props.colorScheme, colorScheme = _a === void 0 ? "primary" : _a, width = props.width, rest = __rest(props, ["value", "disabled", "isSubdued", "innerRef", "displayValue", "onChange", "keepIconColor", "colorScheme", "width"]);
|
|
72
76
|
var _b = useContext(RadioContext), name = _b.name, onValueUpdated = _b.onValueUpdated, currentValue = _b.currentValue;
|
|
73
77
|
var defaultRef = useRef(null);
|
|
74
78
|
var inputRef = innerRef !== null && innerRef !== void 0 ? innerRef : defaultRef;
|
|
@@ -80,7 +84,7 @@ var OakRadioAsButton = function (props) {
|
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
var isChecked = currentValue === value;
|
|
83
|
-
var colorSchemeTokens = getColorSchemeTokens(colorScheme);
|
|
87
|
+
var colorSchemeTokens = getColorSchemeTokens(colorScheme, isSubdued);
|
|
84
88
|
var _c = rest; _c.icon; _c.variant; var restWithoutVariantProps = __rest(_c, ["icon", "variant"]);
|
|
85
89
|
var radio = (React.createElement(InternalRadioWrapper, { radioBorderColor: "border-neutral", radioOuterSize: "spacing-20", size: "spacing-20", disableFocusRing: true, internalRadio: React.createElement(InternalRadio, __assign({}, restWithoutVariantProps, { id: id, value: value, disabled: disabled, ref: inputRef, onChange: function (e) {
|
|
86
90
|
onValueUpdated === null || onValueUpdated === void 0 ? void 0 : onValueUpdated(e);
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -2630,6 +2630,7 @@ type OakRadioAsButtonProps = Omit<BaseRadioProps, "defaultChecked" | "id" | "che
|
|
|
2630
2630
|
*/
|
|
2631
2631
|
keepIconColor?: boolean;
|
|
2632
2632
|
disabled?: HTMLInputElement["disabled"];
|
|
2633
|
+
isSubdued?: boolean;
|
|
2633
2634
|
"aria-labelledby"?: React$1.AriaAttributes["aria-labelledby"];
|
|
2634
2635
|
"aria-label"?: React$1.AriaAttributes["aria-label"];
|
|
2635
2636
|
/**
|