@stonedogcode/style 0.10.0 → 0.10.1
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/package.json
CHANGED
|
@@ -57,6 +57,28 @@ export interface StyledIconButtonProps extends HTMLStyledProps<"button"> {
|
|
|
57
57
|
rel?: string;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Props this component used to accept and no longer honours (NEH-498).
|
|
62
|
+
*
|
|
63
|
+
* They are dropped rather than forwarded because everything else in `rest` is
|
|
64
|
+
* spread onto the element: left alone, `confirm={true}` reaches the DOM as an
|
|
65
|
+
* invalid attribute and React warns about each one in the consumer's console.
|
|
66
|
+
* The doc above already promised these were ignored — this is what makes that
|
|
67
|
+
* true.
|
|
68
|
+
*
|
|
69
|
+
* This is a migration seam with an end date. Delete it once no consumer passes
|
|
70
|
+
* any of them; none does today, which is why they were removed in the first
|
|
71
|
+
* place.
|
|
72
|
+
*/
|
|
73
|
+
const REMOVED_PROPS = [
|
|
74
|
+
"confirm",
|
|
75
|
+
"confirmTitle",
|
|
76
|
+
"confirmBody",
|
|
77
|
+
"onConfirm",
|
|
78
|
+
"loading",
|
|
79
|
+
"noBackground",
|
|
80
|
+
] as const;
|
|
81
|
+
|
|
60
82
|
/** Map the full vocabulary onto what the recipe can actually paint. */
|
|
61
83
|
function toIconVariant(variant: AllowedVariant): IconButtonVariant {
|
|
62
84
|
if (variant === "unstyled") return "ghost";
|
|
@@ -92,6 +114,10 @@ const StyledIconButton = React.forwardRef<HTMLButtonElement, StyledIconButtonPro
|
|
|
92
114
|
// ignored.
|
|
93
115
|
const { zIndex, style, className: incoming, ...restWithoutZIndex } = rest;
|
|
94
116
|
|
|
117
|
+
for (const prop of REMOVED_PROPS) {
|
|
118
|
+
delete (restWithoutZIndex as Record<string, unknown>)[prop];
|
|
119
|
+
}
|
|
120
|
+
|
|
95
121
|
return (
|
|
96
122
|
<StyledTooltip tooltip={tooltip} placement={placement}>
|
|
97
123
|
<Element
|
|
@@ -32,6 +32,14 @@ import { useResolvedVariant } from "../config/style-config";
|
|
|
32
32
|
* radio rather than the group or the selection — reliably the wrong element.
|
|
33
33
|
* It now points at the group container. Nothing was using it.
|
|
34
34
|
*
|
|
35
|
+
* ## `onChange` is optional, and its absence means read-only (NEH-498)
|
|
36
|
+
*
|
|
37
|
+
* `checked` is always passed, so the inputs are controlled whether or not a
|
|
38
|
+
* handler is. Without one React reverts every click *and* warns once per radio
|
|
39
|
+
* in the consumer's console — a warning about nothing, which is the kind that
|
|
40
|
+
* teaches people to ignore the real ones. The inputs are marked `readOnly`
|
|
41
|
+
* instead, which is what the group actually is.
|
|
42
|
+
*
|
|
35
43
|
* The container is a plain `<div>` rather than `StyledBox`, which is what the
|
|
36
44
|
* original used. `StyledBox` wraps its children in an inner element unless told
|
|
37
45
|
* not to, and that element would sit between the `radiogroup` and its radios —
|
|
@@ -121,7 +129,10 @@ const StyledInputRadio = React.forwardRef<HTMLDivElement, StyledInputRadioProps>
|
|
|
121
129
|
value={radio.value}
|
|
122
130
|
checked={value === radio.value}
|
|
123
131
|
disabled={radio.disabled}
|
|
124
|
-
onChange
|
|
132
|
+
// A group with no `onChange` really is read-only — React reverts
|
|
133
|
+
// the click on a controlled input either way — so say so rather
|
|
134
|
+
// than leave React to warn about it in every consumer's console.
|
|
135
|
+
{...(onChange ? { onChange } : { readOnly: true })}
|
|
125
136
|
className={input}
|
|
126
137
|
/>
|
|
127
138
|
<div className={control}>
|