@adamjanicki/ui 1.1.5 → 1.1.6
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.
|
@@ -14,11 +14,11 @@ type DefaultButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTM
|
|
|
14
14
|
*/
|
|
15
15
|
LinkElement?: CustomLinkElement;
|
|
16
16
|
};
|
|
17
|
-
type IconButtonProps = Omit<DefaultButtonProps, "children"> & {
|
|
17
|
+
type IconButtonProps = Omit<DefaultButtonProps, "children" | "aria-label"> & {
|
|
18
18
|
/**
|
|
19
19
|
* Name of the button for accessibility purposes
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
"aria-label": string;
|
|
22
22
|
/**
|
|
23
23
|
* Icon to display inside the button
|
|
24
24
|
* I would usually use FontAwesome, but for added flexibility, it's any node
|
|
@@ -33,8 +33,8 @@ export var UnstyledButton = forwardRef(function (_a, ref) {
|
|
|
33
33
|
return _jsx("button", __assign({}, props, { className: className, ref: ref }));
|
|
34
34
|
});
|
|
35
35
|
export var IconButton = forwardRef(function (_a, ref) {
|
|
36
|
-
var
|
|
37
|
-
return (_jsx(UnstyledButton, __assign({}, props, {
|
|
36
|
+
var icon = _a.icon, className = _a.className, props = __rest(_a, ["icon", "className"]);
|
|
37
|
+
return (_jsx(UnstyledButton, __assign({}, props, { className: classNames("ajui-icon-button", className), ref: ref, children: icon })));
|
|
38
38
|
});
|
|
39
39
|
var Button = forwardRef(function (_a, ref) {
|
|
40
40
|
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.corners, corners = _c === void 0 ? "rounded" : _c, className = _a.className, rest = __rest(_a, ["variant", "corners", "className"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CornerType } from "../../utils/types";
|
|
3
|
-
type Props = React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> & {
|
|
3
|
+
type Props = Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "aria-label"> & {
|
|
4
4
|
/**
|
|
5
5
|
* Array of options to display in the select
|
|
6
6
|
*/
|
|
@@ -25,9 +25,9 @@ type Props = React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElemen
|
|
|
25
25
|
*/
|
|
26
26
|
corners?: CornerType;
|
|
27
27
|
/**
|
|
28
|
-
* Name of the select
|
|
28
|
+
* Name of the select for accessibility purposes
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
"aria-label": string;
|
|
31
31
|
};
|
|
32
32
|
declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
33
33
|
export default _default;
|
|
@@ -25,7 +25,7 @@ import { forwardRef } from "react";
|
|
|
25
25
|
import { classNames } from "../../utils/util";
|
|
26
26
|
var identity = function (x) { return x; };
|
|
27
27
|
var Select = function (_a, ref) {
|
|
28
|
-
var className = _a.className, options = _a.options, _b = _a.getOptionValue, getOptionValue = _b === void 0 ? identity : _b, _c = _a.getOptionLabel, getOptionLabel = _c === void 0 ? identity : _c, _d = _a.corners, corners = _d === void 0 ? "rounded" : _d,
|
|
29
|
-
return (_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), className),
|
|
28
|
+
var className = _a.className, options = _a.options, _b = _a.getOptionValue, getOptionValue = _b === void 0 ? identity : _b, _c = _a.getOptionLabel, getOptionLabel = _c === void 0 ? identity : _c, _d = _a.corners, corners = _d === void 0 ? "rounded" : _d, props = __rest(_a, ["className", "options", "getOptionValue", "getOptionLabel", "corners"]);
|
|
29
|
+
return (_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), className), children: options.map(function (option, index) { return (_jsx("option", { value: getOptionValue(option), children: getOptionLabel(option) }, index)); }) })));
|
|
30
30
|
};
|
|
31
31
|
export default forwardRef(Select);
|