@mpen/react-basic-inputs 0.1.8 → 0.1.11
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/bundle.cjs +7 -2
- package/dist/bundle.mjs +7 -2
- package/dist/components/RadioMenu.d.ts +4 -1
- package/package.json +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -159,7 +159,8 @@ function Select({options, value, invalidValueOption = defaultMakeInvalidValueOpt
|
|
|
159
159
|
const fixedKey = fixer.fix(opt, idx);
|
|
160
160
|
return React.createElement("option", {
|
|
161
161
|
...optAttrs,
|
|
162
|
-
key: fixedKey
|
|
162
|
+
key: fixedKey,
|
|
163
|
+
value: fixedKey
|
|
163
164
|
}, opt.text);
|
|
164
165
|
}))
|
|
165
166
|
});
|
|
@@ -289,21 +290,25 @@ function RadioMenu(menu) {
|
|
|
289
290
|
return jsxRuntime.jsx("ul", {
|
|
290
291
|
className: menu.className,
|
|
291
292
|
children: fixedOptions.map(((opt, idx) => {
|
|
292
|
-
const {value, text, key, itemClassName, ...rest} = opt;
|
|
293
|
+
const {value, text, key, itemClassName, labelClassName, inputClassName, textClassName, ...rest} = opt;
|
|
293
294
|
const fixedKey = fixer.fix(opt, idx);
|
|
294
295
|
if (menu.value !== undefined) {
|
|
295
296
|
rest.checked = eq(value, menu.value);
|
|
296
297
|
}
|
|
297
298
|
return jsxRuntime.jsx("li", {
|
|
298
299
|
className: itemClassName,
|
|
300
|
+
"aria-disabled": rest.disabled,
|
|
299
301
|
children: jsxRuntime.jsxs("label", {
|
|
302
|
+
className: labelClassName,
|
|
300
303
|
children: [ jsxRuntime.jsx("input", {
|
|
301
304
|
...rest,
|
|
305
|
+
className: inputClassName,
|
|
302
306
|
value: idx,
|
|
303
307
|
onChange,
|
|
304
308
|
name,
|
|
305
309
|
type: "radio"
|
|
306
310
|
}), jsxRuntime.jsx("span", {
|
|
311
|
+
className: textClassName,
|
|
307
312
|
children: text
|
|
308
313
|
}) ]
|
|
309
314
|
})
|
package/dist/bundle.mjs
CHANGED
|
@@ -157,7 +157,8 @@ function Select({options, value, invalidValueOption = defaultMakeInvalidValueOpt
|
|
|
157
157
|
const fixedKey = fixer.fix(opt, idx);
|
|
158
158
|
return createElement("option", {
|
|
159
159
|
...optAttrs,
|
|
160
|
-
key: fixedKey
|
|
160
|
+
key: fixedKey,
|
|
161
|
+
value: fixedKey
|
|
161
162
|
}, opt.text);
|
|
162
163
|
}))
|
|
163
164
|
});
|
|
@@ -287,21 +288,25 @@ function RadioMenu(menu) {
|
|
|
287
288
|
return jsx("ul", {
|
|
288
289
|
className: menu.className,
|
|
289
290
|
children: fixedOptions.map(((opt, idx) => {
|
|
290
|
-
const {value, text, key, itemClassName, ...rest} = opt;
|
|
291
|
+
const {value, text, key, itemClassName, labelClassName, inputClassName, textClassName, ...rest} = opt;
|
|
291
292
|
const fixedKey = fixer.fix(opt, idx);
|
|
292
293
|
if (menu.value !== undefined) {
|
|
293
294
|
rest.checked = eq(value, menu.value);
|
|
294
295
|
}
|
|
295
296
|
return jsx("li", {
|
|
296
297
|
className: itemClassName,
|
|
298
|
+
"aria-disabled": rest.disabled,
|
|
297
299
|
children: jsxs("label", {
|
|
300
|
+
className: labelClassName,
|
|
298
301
|
children: [ jsx("input", {
|
|
299
302
|
...rest,
|
|
303
|
+
className: inputClassName,
|
|
300
304
|
value: idx,
|
|
301
305
|
onChange,
|
|
302
306
|
name,
|
|
303
307
|
type: "radio"
|
|
304
308
|
}), jsx("span", {
|
|
309
|
+
className: textClassName,
|
|
305
310
|
children: text
|
|
306
311
|
}) ]
|
|
307
312
|
})
|
|
@@ -7,7 +7,10 @@ export type RadioMenuOption<T extends NonNil> = OverrideProps<'input', {
|
|
|
7
7
|
text: ReactNode;
|
|
8
8
|
key?: Resolvable<Key, [RadioMenuOption<T>, number]>;
|
|
9
9
|
itemClassName?: string;
|
|
10
|
-
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
inputClassName?: string;
|
|
12
|
+
textClassName?: string;
|
|
13
|
+
}, 'type' | 'children' | 'checked' | 'name' | 'className'>;
|
|
11
14
|
export type RadioMenuChangeEvent<T> = {
|
|
12
15
|
value: T;
|
|
13
16
|
index: number;
|