@entur/button 3.3.13-beta.1 → 3.3.13-beta.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/Button.d.ts +42 -0
- package/dist/ButtonGroup.d.ts +14 -0
- package/dist/FloatingButton.d.ts +18 -0
- package/dist/IconButton.d.ts +32 -0
- package/dist/NegativeButton.d.ts +29 -0
- package/dist/PrimaryButton.d.ts +29 -0
- package/dist/SecondaryButton.d.ts +29 -0
- package/dist/SecondarySquareButton.d.ts +21 -0
- package/dist/SquareButton.d.ts +26 -0
- package/dist/SuccessButton.d.ts +29 -0
- package/dist/SuccessSquareButton.d.ts +21 -0
- package/dist/TertiaryButton.d.ts +30 -0
- package/dist/TertiarySquareButton.d.ts +23 -0
- package/dist/button.cjs.development.js +309 -0
- package/dist/button.cjs.development.js.map +1 -0
- package/dist/button.cjs.production.min.js +2 -0
- package/dist/button.cjs.production.min.js.map +1 -0
- package/dist/button.esm.js +269 -245
- package/dist/button.esm.js.map +1 -1
- package/dist/index.d.ts +13 -383
- package/dist/index.js +8 -0
- package/dist/styles.css +466 -448
- package/package.json +13 -31
- package/dist/button.cjs.js +0 -268
- package/dist/button.cjs.js.map +0 -1
package/dist/button.esm.js
CHANGED
|
@@ -1,252 +1,276 @@
|
|
|
1
|
-
import { warnAboutMissingStyles } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const childrenArray = React.Children.toArray(children);
|
|
23
|
-
const hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== "string";
|
|
24
|
-
const hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== "string";
|
|
25
|
-
const ariaLabelWhenLoading = childrenArray.filter((child) => typeof child === "string").join(" ");
|
|
26
|
-
const ariaLabelValue = () => {
|
|
27
|
-
if (ariaLabel) return ariaLabel;
|
|
28
|
-
if (loading) return ariaLabelWhenLoading;
|
|
29
|
-
return void 0;
|
|
30
|
-
};
|
|
31
|
-
return /* @__PURE__ */ jsx(
|
|
32
|
-
Element,
|
|
33
|
-
{
|
|
34
|
-
className: classNames(
|
|
35
|
-
"eds-button",
|
|
36
|
-
{
|
|
37
|
-
[`eds-button--variant-${variant}`]: variant,
|
|
38
|
-
[`eds-button--size-${size}`]: size,
|
|
39
|
-
"eds-button--width-fluid": width === "fluid",
|
|
40
|
-
"eds-button--loading": loading,
|
|
41
|
-
"eds-button--leading-icon": hasLeadingIcon,
|
|
42
|
-
"eds-button--trailing-icon": hasTrailingIcon
|
|
43
|
-
},
|
|
44
|
-
className
|
|
45
|
-
),
|
|
46
|
-
ref,
|
|
47
|
-
"aria-busy": loading,
|
|
48
|
-
disabled,
|
|
49
|
-
"aria-disabled": disabled,
|
|
50
|
-
"aria-label": ariaLabelValue(),
|
|
51
|
-
...rest,
|
|
52
|
-
children: loading ? /* @__PURE__ */ jsx(LoadingDots, { className: "eds-button__loading-dots" }) : children
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
const defaultElement$8 = "button";
|
|
58
|
-
const PrimaryButton = React__default.forwardRef(
|
|
59
|
-
(props, ref) => {
|
|
60
|
-
const Element = props.as || defaultElement$8;
|
|
61
|
-
return /* @__PURE__ */ jsx(Button, { as: Element, ...props, ref, variant: "primary" });
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
const defaultElement$7 = "button";
|
|
65
|
-
const SecondaryButton = React__default.forwardRef(
|
|
66
|
-
(props, ref) => {
|
|
67
|
-
const Element = props.as || defaultElement$7;
|
|
68
|
-
return /* @__PURE__ */ jsx(Button, { as: Element, ...props, ref, variant: "secondary" });
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
const defaultElement$6 = "button";
|
|
72
|
-
const SuccessButton = React__default.forwardRef(
|
|
73
|
-
(props, ref) => {
|
|
74
|
-
const Element = props.as || defaultElement$6;
|
|
75
|
-
return /* @__PURE__ */ jsx(Button, { as: Element, ...props, ref, variant: "success" });
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
const defaultElement$5 = "button";
|
|
79
|
-
const NegativeButton = React__default.forwardRef(
|
|
80
|
-
(props, ref) => {
|
|
81
|
-
const Element = props.as || defaultElement$5;
|
|
82
|
-
return /* @__PURE__ */ jsx(Button, { as: Element, ...props, ref, variant: "negative" });
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
const defaultElement$4 = "button";
|
|
86
|
-
const TertiaryButton = React__default.forwardRef(
|
|
87
|
-
(props, ref) => {
|
|
88
|
-
const Element = props.as || defaultElement$4;
|
|
89
|
-
return /* @__PURE__ */ jsx(
|
|
90
|
-
Button,
|
|
91
|
-
{
|
|
92
|
-
as: Element,
|
|
93
|
-
...props,
|
|
94
|
-
ref,
|
|
95
|
-
variant: "tertiary",
|
|
96
|
-
size: "small"
|
|
97
|
-
}
|
|
98
|
-
);
|
|
1
|
+
import { warnAboutMissingStyles } from '@entur/utils';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { LoadingDots } from '@entur/loader';
|
|
6
|
+
|
|
7
|
+
function _extends() {
|
|
8
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
9
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
10
|
+
var t = arguments[e];
|
|
11
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
12
|
+
}
|
|
13
|
+
return n;
|
|
14
|
+
}, _extends.apply(null, arguments);
|
|
15
|
+
}
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
17
|
+
if (null == r) return {};
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
20
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
21
|
+
t[n] = r[n];
|
|
99
22
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var _excluded$4 = ["as", "children", "variant", "size", "loading", "className", "disabled", "width", "aria-label"];
|
|
27
|
+
var defaultElement$9 = 'button';
|
|
28
|
+
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
29
|
+
var _cx;
|
|
30
|
+
var as = _ref.as,
|
|
31
|
+
children = _ref.children,
|
|
32
|
+
_ref$variant = _ref.variant,
|
|
33
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
34
|
+
_ref$size = _ref.size,
|
|
35
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
36
|
+
loading = _ref.loading,
|
|
37
|
+
className = _ref.className,
|
|
38
|
+
_ref$disabled = _ref.disabled,
|
|
39
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
40
|
+
_ref$width = _ref.width,
|
|
41
|
+
width = _ref$width === void 0 ? 'auto' : _ref$width,
|
|
42
|
+
ariaLabel = _ref['aria-label'],
|
|
43
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
44
|
+
var Element = as || defaultElement$9;
|
|
45
|
+
var childrenArray = React.Children.toArray(children);
|
|
46
|
+
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
|
|
47
|
+
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
|
|
48
|
+
var ariaLabelWhenLoading = childrenArray.filter(function (child) {
|
|
49
|
+
return typeof child === 'string';
|
|
50
|
+
}).join(' ');
|
|
51
|
+
var ariaLabelValue = function ariaLabelValue() {
|
|
52
|
+
if (ariaLabel) return ariaLabel;
|
|
53
|
+
if (loading) return ariaLabelWhenLoading;
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
return React.createElement(Element, _extends({
|
|
57
|
+
className: classNames('eds-button', (_cx = {}, _cx["eds-button--variant-" + variant] = variant, _cx["eds-button--size-" + size] = size, _cx['eds-button--width-fluid'] = width === 'fluid', _cx['eds-button--loading'] = loading, _cx['eds-button--leading-icon'] = hasLeadingIcon, _cx['eds-button--trailing-icon'] = hasTrailingIcon, _cx), className),
|
|
58
|
+
ref: ref,
|
|
59
|
+
"aria-busy": loading,
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
"aria-disabled": disabled,
|
|
62
|
+
"aria-label": ariaLabelValue()
|
|
63
|
+
}, rest), loading ? React.createElement(LoadingDots, {
|
|
64
|
+
className: "eds-button__loading-dots"
|
|
65
|
+
}) : children);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var defaultElement$8 = 'button';
|
|
69
|
+
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
70
|
+
var Element = props.as || defaultElement$8;
|
|
71
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
72
|
+
return React__default.createElement(Button, _extends({
|
|
73
|
+
as: Element
|
|
74
|
+
}, props, {
|
|
75
|
+
ref: ref,
|
|
76
|
+
variant: "primary"
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
var defaultElement$7 = 'button';
|
|
81
|
+
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
82
|
+
var Element = props.as || defaultElement$7;
|
|
83
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
84
|
+
return React__default.createElement(Button, _extends({
|
|
85
|
+
as: Element
|
|
86
|
+
}, props, {
|
|
87
|
+
ref: ref,
|
|
88
|
+
variant: "secondary"
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
var defaultElement$6 = 'button';
|
|
93
|
+
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
94
|
+
var Element = props.as || defaultElement$6;
|
|
95
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
96
|
+
return React__default.createElement(Button, _extends({
|
|
97
|
+
as: Element
|
|
98
|
+
}, props, {
|
|
99
|
+
ref: ref,
|
|
100
|
+
variant: "success"
|
|
101
|
+
}));
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
var defaultElement$5 = 'button';
|
|
105
|
+
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
106
|
+
var Element = props.as || defaultElement$5;
|
|
107
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
108
|
+
return React__default.createElement(Button, _extends({
|
|
109
|
+
as: Element
|
|
110
|
+
}, props, {
|
|
111
|
+
ref: ref,
|
|
112
|
+
variant: "negative"
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
var defaultElement$4 = 'button';
|
|
117
|
+
/** @deprecated use SecondaryButton size="small" instead */
|
|
118
|
+
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
119
|
+
var Element = props.as || defaultElement$4;
|
|
120
|
+
return React__default.createElement(Button, _extends({
|
|
121
|
+
as: Element
|
|
122
|
+
}, props, {
|
|
123
|
+
ref: ref,
|
|
124
|
+
variant: "tertiary",
|
|
125
|
+
size: "small"
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
var _excluded$3 = ["as", "className"];
|
|
130
|
+
var ButtonGroup = function ButtonGroup(_ref) {
|
|
131
|
+
var _ref$as = _ref.as,
|
|
132
|
+
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
133
|
+
className = _ref.className,
|
|
134
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
135
|
+
return React__default.createElement(Element, _extends({
|
|
136
|
+
className: classNames('eds-button-group', className)
|
|
137
|
+
}, rest));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var _excluded$2 = ["className", "children", "size"];
|
|
141
|
+
var FloatingButton = function FloatingButton(_ref) {
|
|
142
|
+
var className = _ref.className,
|
|
143
|
+
children = _ref.children,
|
|
144
|
+
_ref$size = _ref.size,
|
|
145
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
146
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
147
|
+
return React__default.createElement("button", _extends({
|
|
148
|
+
className: classNames('eds-floating-button', {
|
|
149
|
+
'eds-floating-button--extended': React__default.Children.count(children) > 1
|
|
150
|
+
}, {
|
|
151
|
+
'eds-floating-button--small': size === 'small'
|
|
152
|
+
}, className),
|
|
153
|
+
type: "button"
|
|
154
|
+
}, rest), wrapStringsInSpans(children));
|
|
107
155
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
156
|
+
var wrapStringsInSpans = function wrapStringsInSpans(children) {
|
|
157
|
+
return React__default.Children.map(children, function (child) {
|
|
158
|
+
return typeof child === 'string' ? React__default.createElement("span", null, child) : child;
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var _excluded$1 = ["as", "children", "className", "disabled", "loading", "variant"];
|
|
163
|
+
var defaultElement$3 = 'button';
|
|
164
|
+
var SquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
165
|
+
var as = _ref.as,
|
|
166
|
+
children = _ref.children,
|
|
167
|
+
className = _ref.className,
|
|
168
|
+
_ref$disabled = _ref.disabled,
|
|
169
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
170
|
+
_ref$loading = _ref.loading,
|
|
171
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
172
|
+
_ref$variant = _ref.variant,
|
|
173
|
+
variant = _ref$variant === void 0 ? 'secondary' : _ref$variant,
|
|
174
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
175
|
+
var Element = as || defaultElement$3;
|
|
176
|
+
return React.createElement(Element, _extends({
|
|
177
|
+
className: classNames('eds-square-button', "eds-square-button--" + variant, {
|
|
178
|
+
'eds-square-button--loading': loading
|
|
179
|
+
}, className),
|
|
180
|
+
"aria-busy": loading,
|
|
181
|
+
disabled: disabled,
|
|
182
|
+
"aria-disabled": disabled,
|
|
183
|
+
ref: ref
|
|
184
|
+
}, rest), React.Children.map(children, function (child) {
|
|
185
|
+
if (typeof child === 'string') {
|
|
186
|
+
return React.createElement("span", {
|
|
187
|
+
className: "eds-square-button__label"
|
|
188
|
+
}, child);
|
|
126
189
|
}
|
|
190
|
+
return React.createElement("span", {
|
|
191
|
+
className: "eds-square-button__button"
|
|
192
|
+
}, loading ? React.createElement(LoadingDots, {
|
|
193
|
+
className: "eds-square-button__loading-dots"
|
|
194
|
+
}) : child);
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
var defaultElement$2 = 'button';
|
|
199
|
+
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
200
|
+
var Element = props.as || defaultElement$2;
|
|
201
|
+
return (
|
|
202
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
203
|
+
React__default.createElement(SquareButton, _extends({
|
|
204
|
+
as: Element,
|
|
205
|
+
ref: ref
|
|
206
|
+
}, props, {
|
|
207
|
+
variant: "secondary"
|
|
208
|
+
}))
|
|
127
209
|
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
);
|
|
171
|
-
const defaultElement$2 = "button";
|
|
172
|
-
const SecondarySquareButton = React__default.forwardRef(
|
|
173
|
-
(props, ref) => {
|
|
174
|
-
const Element = props.as || defaultElement$2;
|
|
175
|
-
return (
|
|
176
|
-
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
177
|
-
/* @__PURE__ */ jsx(SquareButton, { as: Element, ref, ...props, variant: "secondary" })
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
const defaultElement$1 = "button";
|
|
182
|
-
const SuccessSquareButton = React__default.forwardRef(
|
|
183
|
-
(props, ref) => {
|
|
184
|
-
const Element = props.as || defaultElement$1;
|
|
185
|
-
return (
|
|
186
|
-
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
187
|
-
/* @__PURE__ */ jsx(SquareButton, { as: Element, ref, ...props, variant: "success" })
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
const TertiarySquareButton = React__default.forwardRef(
|
|
192
|
-
(props, ref) => /* @__PURE__ */ jsx(SquareButton, { ref, ...props, variant: "tertiary" })
|
|
193
|
-
);
|
|
194
|
-
const defaultElement = "button";
|
|
195
|
-
const IconButton = React__default.forwardRef(
|
|
196
|
-
({
|
|
197
|
-
children,
|
|
198
|
-
className,
|
|
199
|
-
disabled = false,
|
|
200
|
-
size = "medium",
|
|
201
|
-
as,
|
|
202
|
-
loading,
|
|
203
|
-
...rest
|
|
204
|
-
}, ref) => {
|
|
205
|
-
const Element = as || defaultElement;
|
|
206
|
-
const IconWithAriaHidden = React__default.Children.map(children, (child) => {
|
|
207
|
-
if (React__default.isValidElement(child)) {
|
|
208
|
-
return React__default.cloneElement(child, { "aria-hidden": true });
|
|
209
|
-
}
|
|
210
|
-
return child;
|
|
211
|
-
});
|
|
212
|
-
const iconButtonElement = /* @__PURE__ */ jsx(
|
|
213
|
-
Element,
|
|
214
|
-
{
|
|
215
|
-
className: classNames(
|
|
216
|
-
"eds-icon-button",
|
|
217
|
-
className,
|
|
218
|
-
{
|
|
219
|
-
"eds-icon-button--disabled": disabled
|
|
220
|
-
},
|
|
221
|
-
`eds-icon-button--size-${size}`
|
|
222
|
-
),
|
|
223
|
-
disabled,
|
|
224
|
-
"aria-disabled": disabled,
|
|
225
|
-
"aria-busy": loading,
|
|
226
|
-
ref,
|
|
227
|
-
...rest,
|
|
228
|
-
children: loading ? /* @__PURE__ */ jsx(LoadingDots, {}) : /* @__PURE__ */ jsx(Fragment, { children: IconWithAriaHidden })
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
if (disabled) {
|
|
232
|
-
return /* @__PURE__ */ jsx("div", { className: "eds-icon-button--disabled__wrapper", children: iconButtonElement });
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
var defaultElement$1 = 'button';
|
|
213
|
+
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
214
|
+
var Element = props.as || defaultElement$1;
|
|
215
|
+
return (
|
|
216
|
+
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
217
|
+
React__default.createElement(SquareButton, _extends({
|
|
218
|
+
as: Element,
|
|
219
|
+
ref: ref
|
|
220
|
+
}, props, {
|
|
221
|
+
variant: "success"
|
|
222
|
+
}))
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
var TertiarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
227
|
+
return React__default.createElement(SquareButton, _extends({
|
|
228
|
+
ref: ref
|
|
229
|
+
}, props, {
|
|
230
|
+
variant: "tertiary"
|
|
231
|
+
}));
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
235
|
+
var defaultElement = 'button';
|
|
236
|
+
var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
237
|
+
var children = _ref.children,
|
|
238
|
+
className = _ref.className,
|
|
239
|
+
_ref$disabled = _ref.disabled,
|
|
240
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
241
|
+
_ref$size = _ref.size,
|
|
242
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
243
|
+
as = _ref.as,
|
|
244
|
+
loading = _ref.loading,
|
|
245
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
246
|
+
var Element = as || defaultElement;
|
|
247
|
+
var IconWithAriaHidden = React__default.Children.map(children, function (child) {
|
|
248
|
+
if (React__default.isValidElement(child)) {
|
|
249
|
+
// @ts-expect-error aria-hidden does, in fact, exist
|
|
250
|
+
return React__default.cloneElement(child, {
|
|
251
|
+
'aria-hidden': true
|
|
252
|
+
});
|
|
233
253
|
}
|
|
234
|
-
return
|
|
254
|
+
return child;
|
|
255
|
+
});
|
|
256
|
+
var iconButtonElement = React__default.createElement(Element, _extends({
|
|
257
|
+
className: classNames('eds-icon-button', className, {
|
|
258
|
+
'eds-icon-button--disabled': disabled
|
|
259
|
+
}, "eds-icon-button--size-" + size),
|
|
260
|
+
disabled: disabled,
|
|
261
|
+
"aria-disabled": disabled,
|
|
262
|
+
"aria-busy": loading,
|
|
263
|
+
ref: ref
|
|
264
|
+
}, rest), loading ? React__default.createElement(LoadingDots, null) : React__default.createElement(React__default.Fragment, null, IconWithAriaHidden));
|
|
265
|
+
if (disabled) {
|
|
266
|
+
return React__default.createElement("div", {
|
|
267
|
+
className: "eds-icon-button--disabled__wrapper"
|
|
268
|
+
}, iconButtonElement);
|
|
235
269
|
}
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
IconButton,
|
|
243
|
-
NegativeButton,
|
|
244
|
-
PrimaryButton,
|
|
245
|
-
SecondaryButton,
|
|
246
|
-
SecondarySquareButton,
|
|
247
|
-
SuccessButton,
|
|
248
|
-
SuccessSquareButton,
|
|
249
|
-
TertiaryButton,
|
|
250
|
-
TertiarySquareButton
|
|
251
|
-
};
|
|
270
|
+
return React__default.createElement(React__default.Fragment, null, iconButtonElement);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
warnAboutMissingStyles('button');
|
|
274
|
+
|
|
275
|
+
export { Button, ButtonGroup, FloatingButton, IconButton, NegativeButton, PrimaryButton, SecondaryButton, SecondarySquareButton, SuccessButton, SuccessSquareButton, TertiaryButton, TertiarySquareButton };
|
|
252
276
|
//# sourceMappingURL=button.esm.js.map
|