@entur/button 3.1.1 → 3.1.4
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/BaseSquareButton.d.ts +24 -24
- package/dist/Button.d.ts +36 -36
- package/dist/ButtonGroup.d.ts +14 -14
- package/dist/FloatingButton.d.ts +18 -18
- package/dist/IconButton.d.ts +32 -32
- package/dist/NegativeButton.d.ts +29 -29
- package/dist/PrimaryButton.d.ts +29 -29
- package/dist/SecondaryButton.d.ts +29 -29
- package/dist/SecondarySquareButton.d.ts +21 -21
- package/dist/SuccessButton.d.ts +29 -29
- package/dist/SuccessSquareButton.d.ts +21 -21
- package/dist/TertiaryButton.d.ts +29 -29
- package/dist/TertiarySquareButton.d.ts +21 -21
- package/dist/button.cjs.development.js +37 -42
- package/dist/button.cjs.development.js.map +1 -1
- package/dist/button.cjs.production.min.js +1 -1
- package/dist/button.cjs.production.min.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/styles.css +65 -65
- package/package.json +4 -4
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
|
-
type TertiarySquareButtonBaseProps = {
|
|
4
|
-
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Ekstra klassenavn */
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Deaktivering av knappen
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
loading?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type TertiarySquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;
|
|
18
|
-
export type TertiarySquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: TertiarySquareButtonProps<T>) => React.ReactElement | null;
|
|
19
|
-
declare const defaultElement = "button";
|
|
20
|
-
export declare const TertiarySquareButton: TertiarySquareButtonComponent;
|
|
21
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
|
+
type TertiarySquareButtonBaseProps = {
|
|
4
|
+
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Ekstra klassenavn */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Deaktivering av knappen
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type TertiarySquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;
|
|
18
|
+
export type TertiarySquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: TertiarySquareButtonProps<T>) => React.ReactElement | null;
|
|
19
|
+
declare const defaultElement = "button";
|
|
20
|
+
export declare const TertiarySquareButton: TertiarySquareButtonComponent;
|
|
21
|
+
export {};
|
|
@@ -7,10 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var classNames = require('classnames');
|
|
8
8
|
var loader = require('@entur/loader');
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
14
11
|
var n = Object.create(null);
|
|
15
12
|
if (e) {
|
|
16
13
|
Object.keys(e).forEach(function (k) {
|
|
@@ -23,13 +20,11 @@ function _interopNamespace(e) {
|
|
|
23
20
|
}
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
|
-
n
|
|
23
|
+
n.default = e;
|
|
27
24
|
return n;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
var React__namespace = /*#__PURE__*/
|
|
31
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
32
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
28
|
|
|
34
29
|
function _extends() {
|
|
35
30
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -88,7 +83,7 @@ var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
88
83
|
return undefined;
|
|
89
84
|
};
|
|
90
85
|
return React__namespace.createElement(Element, _extends({
|
|
91
|
-
className:
|
|
86
|
+
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),
|
|
92
87
|
ref: ref,
|
|
93
88
|
"aria-busy": loading,
|
|
94
89
|
disabled: disabled,
|
|
@@ -100,10 +95,10 @@ var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
100
95
|
});
|
|
101
96
|
|
|
102
97
|
var defaultElement$9 = 'button';
|
|
103
|
-
var PrimaryButton = /*#__PURE__*/
|
|
98
|
+
var PrimaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
104
99
|
var Element = props.as || defaultElement$9;
|
|
105
100
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
106
|
-
return
|
|
101
|
+
return React.createElement(Button, _extends({
|
|
107
102
|
as: Element
|
|
108
103
|
}, props, {
|
|
109
104
|
ref: ref,
|
|
@@ -112,10 +107,10 @@ var PrimaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
|
112
107
|
});
|
|
113
108
|
|
|
114
109
|
var defaultElement$8 = 'button';
|
|
115
|
-
var SecondaryButton = /*#__PURE__*/
|
|
110
|
+
var SecondaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
116
111
|
var Element = props.as || defaultElement$8;
|
|
117
112
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
118
|
-
return
|
|
113
|
+
return React.createElement(Button, _extends({
|
|
119
114
|
as: Element
|
|
120
115
|
}, props, {
|
|
121
116
|
ref: ref,
|
|
@@ -124,10 +119,10 @@ var SecondaryButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
124
119
|
});
|
|
125
120
|
|
|
126
121
|
var defaultElement$7 = 'button';
|
|
127
|
-
var SuccessButton = /*#__PURE__*/
|
|
122
|
+
var SuccessButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
128
123
|
var Element = props.as || defaultElement$7;
|
|
129
124
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
130
|
-
return
|
|
125
|
+
return React.createElement(Button, _extends({
|
|
131
126
|
as: Element
|
|
132
127
|
}, props, {
|
|
133
128
|
ref: ref,
|
|
@@ -136,10 +131,10 @@ var SuccessButton = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
|
136
131
|
});
|
|
137
132
|
|
|
138
133
|
var defaultElement$6 = 'button';
|
|
139
|
-
var NegativeButton = /*#__PURE__*/
|
|
134
|
+
var NegativeButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
140
135
|
var Element = props.as || defaultElement$6;
|
|
141
136
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
142
|
-
return
|
|
137
|
+
return React.createElement(Button, _extends({
|
|
143
138
|
as: Element
|
|
144
139
|
}, props, {
|
|
145
140
|
ref: ref,
|
|
@@ -148,10 +143,10 @@ var NegativeButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
148
143
|
});
|
|
149
144
|
|
|
150
145
|
var defaultElement$5 = 'button';
|
|
151
|
-
var TertiaryButton = /*#__PURE__*/
|
|
146
|
+
var TertiaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
152
147
|
var Element = props.as || defaultElement$5;
|
|
153
148
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
154
|
-
return
|
|
149
|
+
return React.createElement(Button, _extends({
|
|
155
150
|
as: Element
|
|
156
151
|
}, props, {
|
|
157
152
|
ref: ref,
|
|
@@ -165,8 +160,8 @@ var ButtonGroup = function ButtonGroup(_ref) {
|
|
|
165
160
|
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
166
161
|
className = _ref.className,
|
|
167
162
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
168
|
-
return
|
|
169
|
-
className:
|
|
163
|
+
return React.createElement(Element, _extends({
|
|
164
|
+
className: classNames('eds-button-group', className)
|
|
170
165
|
}, rest));
|
|
171
166
|
};
|
|
172
167
|
|
|
@@ -177,9 +172,9 @@ var FloatingButton = function FloatingButton(_ref) {
|
|
|
177
172
|
_ref$size = _ref.size,
|
|
178
173
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
179
174
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
180
|
-
return
|
|
181
|
-
className:
|
|
182
|
-
'eds-floating-button--extended':
|
|
175
|
+
return React.createElement("button", _extends({
|
|
176
|
+
className: classNames('eds-floating-button', {
|
|
177
|
+
'eds-floating-button--extended': React.Children.count(children) > 1
|
|
183
178
|
}, {
|
|
184
179
|
'eds-floating-button--small': size === 'small'
|
|
185
180
|
}, className),
|
|
@@ -187,8 +182,8 @@ var FloatingButton = function FloatingButton(_ref) {
|
|
|
187
182
|
}, rest), wrapStringsInSpans(children));
|
|
188
183
|
};
|
|
189
184
|
var wrapStringsInSpans = function wrapStringsInSpans(children) {
|
|
190
|
-
return
|
|
191
|
-
return typeof child === 'string' ?
|
|
185
|
+
return React.Children.map(children, function (child) {
|
|
186
|
+
return typeof child === 'string' ? React.createElement("span", null, child) : child;
|
|
192
187
|
});
|
|
193
188
|
};
|
|
194
189
|
|
|
@@ -206,7 +201,7 @@ var BaseSquareButton = /*#__PURE__*/React__namespace.forwardRef(function (_ref,
|
|
|
206
201
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
207
202
|
var Element = as || defaultElement$4;
|
|
208
203
|
return React__namespace.createElement(Element, _extends({
|
|
209
|
-
className:
|
|
204
|
+
className: classNames('eds-square-button', {
|
|
210
205
|
'eds-square-button--success': variant === 'success'
|
|
211
206
|
}, {
|
|
212
207
|
'eds-square-button--secondary': variant === 'secondary'
|
|
@@ -234,11 +229,11 @@ var BaseSquareButton = /*#__PURE__*/React__namespace.forwardRef(function (_ref,
|
|
|
234
229
|
});
|
|
235
230
|
|
|
236
231
|
var defaultElement$3 = 'button';
|
|
237
|
-
var SecondarySquareButton = /*#__PURE__*/
|
|
232
|
+
var SecondarySquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
238
233
|
var Element = props.as || defaultElement$3;
|
|
239
234
|
return (
|
|
240
235
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
241
|
-
|
|
236
|
+
React.createElement(BaseSquareButton, _extends({
|
|
242
237
|
as: Element,
|
|
243
238
|
ref: ref
|
|
244
239
|
}, props, {
|
|
@@ -248,11 +243,11 @@ var SecondarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
248
243
|
});
|
|
249
244
|
|
|
250
245
|
var defaultElement$2 = 'button';
|
|
251
|
-
var SuccessSquareButton = /*#__PURE__*/
|
|
246
|
+
var SuccessSquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
252
247
|
var Element = props.as || defaultElement$2;
|
|
253
248
|
return (
|
|
254
249
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
255
|
-
|
|
250
|
+
React.createElement(BaseSquareButton, _extends({
|
|
256
251
|
as: Element,
|
|
257
252
|
ref: ref
|
|
258
253
|
}, props, {
|
|
@@ -262,11 +257,11 @@ var SuccessSquareButton = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
|
262
257
|
});
|
|
263
258
|
|
|
264
259
|
var defaultElement$1 = 'button';
|
|
265
|
-
var TertiarySquareButton = /*#__PURE__*/
|
|
260
|
+
var TertiarySquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
266
261
|
var Element = props.as || defaultElement$1;
|
|
267
262
|
return (
|
|
268
263
|
// @ts-expect-error type error due to props not being BaseButtonProps
|
|
269
|
-
|
|
264
|
+
React.createElement(BaseSquareButton, _extends({
|
|
270
265
|
as: Element,
|
|
271
266
|
ref: ref
|
|
272
267
|
}, props, {
|
|
@@ -277,7 +272,7 @@ var TertiarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
277
272
|
|
|
278
273
|
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
279
274
|
var defaultElement = 'button';
|
|
280
|
-
var IconButton = /*#__PURE__*/
|
|
275
|
+
var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
281
276
|
var children = _ref.children,
|
|
282
277
|
className = _ref.className,
|
|
283
278
|
_ref$disabled = _ref.disabled,
|
|
@@ -287,30 +282,30 @@ var IconButton = /*#__PURE__*/React__default["default"].forwardRef(function (_re
|
|
|
287
282
|
loading = _ref.loading,
|
|
288
283
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
289
284
|
var Element = as || defaultElement;
|
|
290
|
-
var IconWithAriaHidden =
|
|
291
|
-
if (
|
|
285
|
+
var IconWithAriaHidden = React.Children.map(children, function (child) {
|
|
286
|
+
if (React.isValidElement(child)) {
|
|
292
287
|
// @ts-expect-error aria-hidden does, in fact, exist
|
|
293
|
-
return
|
|
288
|
+
return React.cloneElement(child, {
|
|
294
289
|
'aria-hidden': true
|
|
295
290
|
});
|
|
296
291
|
}
|
|
297
292
|
return child;
|
|
298
293
|
});
|
|
299
|
-
var iconButtonElement =
|
|
300
|
-
className:
|
|
294
|
+
var iconButtonElement = React.createElement(Element, _extends({
|
|
295
|
+
className: classNames('eds-icon-button', className, {
|
|
301
296
|
'eds-icon-button--disabled': disabled
|
|
302
297
|
}, "eds-icon-button--size-" + size),
|
|
303
298
|
disabled: disabled,
|
|
304
299
|
"aria-disabled": disabled,
|
|
305
300
|
"aria-busy": loading,
|
|
306
301
|
ref: ref
|
|
307
|
-
}, rest), loading ?
|
|
302
|
+
}, rest), loading ? React.createElement(loader.LoadingDots, null) : React.createElement(React.Fragment, null, IconWithAriaHidden));
|
|
308
303
|
if (disabled) {
|
|
309
|
-
return
|
|
304
|
+
return React.createElement("div", {
|
|
310
305
|
className: "eds-icon-button--disabled__wrapper"
|
|
311
306
|
}, iconButtonElement);
|
|
312
307
|
}
|
|
313
|
-
return
|
|
308
|
+
return React.createElement(React.Fragment, null, iconButtonElement);
|
|
314
309
|
});
|
|
315
310
|
|
|
316
311
|
utils.warnAboutMissingStyles('button');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs.development.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx","../src/BaseSquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | 'tertiary';\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant,\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseSquareButton.scss';\n\nexport type BaseSquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type BaseSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;\n\nexport type BaseSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: BaseSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: BaseSquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n variant,\n disabled = false,\n loading = false,\n as,\n ...rest\n }: BaseSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n { 'eds-square-button--success': variant === 'success' },\n { 'eds-square-button--secondary': variant === 'secondary' },\n { 'eds-square-button--tertiary': variant === 'tertiary' },\n { 'eds-square-button--loading': loading },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__icon\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"secondary\"\n />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"tertiary\"\n />\n );\n },\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const IconWithAriaHidden = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n // @ts-expect-error aria-hidden does, in fact, exist\n return React.cloneElement(child, { 'aria-hidden': true });\n }\n return child;\n });\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : <>{IconWithAriaHidden}</>}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","children","variant","size","loading","className","disabled","width","ariaLabel","rest","_excluded","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","createElement","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","IconWithAriaHidden","isValidElement","cloneElement","iconButtonElement","Fragment","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAAc,GAAG,QAAQ,CAAA;AAWxB,IAAMC,MAAM,gBAAoBC,gBAAK,CAACC,UAAU,CACrD,UAaEC,IAAAA,EAAAA,GAAsB,EACpB;AAAA,EAAA,IAAA,GAAA,CAAA;EAAA,IAZAC,EAAE,QAAFA,EAAE;AACFC,IAAAA,QAAQ,QAARA,QAAQ;AACRC,IAAAA,OAAO,QAAPA,OAAO;AAAA,IAAA,SAAA,GAAA,IAAA,CACPC,IAAI;AAAJA,IAAAA,IAAI,0BAAG,QAAQ,GAAA,SAAA;AACfC,IAAAA,OAAO,QAAPA,OAAO;AACPC,IAAAA,SAAS,QAATA,SAAS;AAAA,IAAA,aAAA,GAAA,IAAA,CACTC,QAAQ;AAARA,IAAAA,QAAQ,8BAAG,KAAK,GAAA,aAAA;AAAA,IAAA,UAAA,GAAA,IAAA,CAChBC,KAAK;AAALA,IAAAA,KAAK,2BAAG,MAAM,GAAA,UAAA;AACAC,IAAAA,SAAS,QAAvB,YAAY,CAAA;IACTC,IAAI,GAAA,6BAAA,CAAA,IAAA,EAAAC,WAAA,CAAA,CAAA;AAIT,EAAA,IAAMC,OAAO,GAAsBX,EAAE,IAAIL,gBAAc,CAAA;EACv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,EAAG;AAC9D,IAAA,IAAIvB,yBAAK,CAACiD,cAAc,CAAC1B,KAAK,CAAC,EAAE;AAC/B;AACA,MAAA,OAAOvB,yBAAK,CAACkD,YAAY,CAAC3B,KAAK,EAAE;AAAE,QAAA,aAAa,EAAE,IAAA;AAAM,OAAA,CAAC,CAAA;AAC1D,KAAA;AACD,IAAA,OAAOA,KAAK,CAAA;AACd,GAAC,CAAC,CAAA;AAEF,EAAA,IAAM4B,iBAAiB,GACrBnD,yBAAA,CAAAoC,aAAA,CAACtB,OAAO,EAAA,QAAA,CAAA;AACNN,IAAAA,SAAS,EAAE6B,8BAAU,CACnB,iBAAiB,EACjB7B,SAAS,EACT;AACE,MAAA,2BAA2B,EAAEC,QAAAA;KAC9B,EAAA,wBAAA,GACwBH,IAAI,CAC9B;AACDG,IAAAA,QAAQ,EAAEA,QAAQ;AAAA,IAAA,eAAA,EACHA,QAAQ;AACZ,IAAA,WAAA,EAAAF,OAAO;AAClBL,IAAAA,GAAG,EAAEA,GAAAA;GACDU,EAAAA,IAAI,CAEPL,EAAAA,OAAO,GAAGP,wCAAC4B,kBAAW,EAAA,IAAA,CAAG,GAAG5B,yBAAG,CAAAoC,aAAA,CAAApC,yBAAA,CAAAoD,QAAA,EAAA,IAAA,EAAAJ,kBAAkB,CAAI,CAEzD,CAAA;AAED,EAAA,IAAIvC,QAAQ,EAAE;AACZ,IAAA,OACET;AAAKQ,MAAAA,SAAS,EAAC,oCAAA;KACZ,EAAA2C,iBAAiB,CACd,CAAA;AAET,GAAA;EACD,OAAOnD,yBAAA,CAAAoC,aAAA,CAAApC,yBAAA,CAAAoD,QAAA,EAAA,IAAA,EAAGD,iBAAiB,CAAI,CAAA;AACjC,CAAC;;AC1FHE,4BAAsB,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"button.cjs.development.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx","../src/BaseSquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | 'tertiary';\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant,\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseSquareButton.scss';\n\nexport type BaseSquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type BaseSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;\n\nexport type BaseSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: BaseSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: BaseSquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n variant,\n disabled = false,\n loading = false,\n as,\n ...rest\n }: BaseSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n { 'eds-square-button--success': variant === 'success' },\n { 'eds-square-button--secondary': variant === 'secondary' },\n { 'eds-square-button--tertiary': variant === 'tertiary' },\n { 'eds-square-button--loading': loading },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__icon\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"secondary\"\n />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"tertiary\"\n />\n );\n },\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const IconWithAriaHidden = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n // @ts-expect-error aria-hidden does, in fact, exist\n return React.cloneElement(child, { 'aria-hidden': true });\n }\n return child;\n });\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : <>{IconWithAriaHidden}</>}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","children","variant","size","loading","className","disabled","width","ariaLabel","rest","_excluded","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","createElement","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","IconWithAriaHidden","isValidElement","cloneElement","iconButtonElement","Fragment","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAAc,GAAG,QAAQ,CAAA;AAWxB,IAAMC,MAAM,gBAAoBC,gBAAK,CAACC,UAAU,CACrD,UAaEC,IAAAA,EAAAA,GAAsB,EACpB;AAAA,EAAA,IAAA,GAAA,CAAA;EAAA,IAZAC,EAAE,QAAFA,EAAE;AACFC,IAAAA,QAAQ,QAARA,QAAQ;AACRC,I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AApC,KAAA,CAAAoD,QAAA,EAAA,IAAA,EAAAJ,kBAAkB,CAAI,CAEzD,CAAA;AAED,EAAA,IAAIvC,QAAQ,EAAE;AACZ,IAAA,OACET;AAAKQ,MAAAA,SAAS,EAAC,oCAAA;KACZ,EAAA2C,iBAAiB,CACd,CAAA;AAET,GAAA;EACD,OAAOnD,KAAA,CAAAoC,aAAA,CAAApC,KAAA,CAAAoD,QAAA,EAAA,IAAA,EAAGD,iBAAiB,CAAI,CAAA;AACjC,CAAC;;AC1FHE,4BAAsB,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),a=require("classnames"),n=require("@entur/loader");function r(e){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),a=require("classnames"),n=require("@entur/loader");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,t}var s=r(t);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function i(e,t){if(null==e)return{};var a,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(a=s[n])>=0||(r[a]=e[a]);return r}var u=["as","children","variant","size","loading","className","disabled","width","aria-label"],l=s.forwardRef((function(e,t){var r,l=e.as,d=e.children,c=e.variant,f=e.size,b=void 0===f?"medium":f,m=e.loading,v=e.className,g=e.disabled,p=void 0!==g&&g,y=e.width,h=void 0===y?"auto":y,E=e["aria-label"],N=i(e,u),w=l||"button",q=s.Children.toArray(d),x=q.length>1&&"string"!=typeof q[0],B=q.length>1&&"string"!=typeof q[q.length-1],O=q.filter((function(e){return"string"==typeof e})).join(" ");return s.createElement(w,o({className:a("eds-button",(r={},r["eds-button--variant-"+c]=c,r["eds-button--size-"+b]=b,r["eds-button--width-fluid"]="fluid"===h,r["eds-button--loading"]=m,r["eds-button--leading-icon"]=x,r["eds-button--trailing-icon"]=B,r),v),ref:t,"aria-busy":m,disabled:p,"aria-disabled":p,"aria-label":E||(m?O:void 0)},N),m?s.createElement(n.LoadingDots,{className:"eds-button__loading-dots"}):d)})),d=t.forwardRef((function(e,a){return t.createElement(l,o({as:e.as||"button"},e,{ref:a,variant:"primary"}))})),c=t.forwardRef((function(e,a){return t.createElement(l,o({as:e.as||"button"},e,{ref:a,variant:"secondary"}))})),f=t.forwardRef((function(e,a){return t.createElement(l,o({as:e.as||"button"},e,{ref:a,variant:"success"}))})),b=t.forwardRef((function(e,a){return t.createElement(l,o({as:e.as||"button"},e,{ref:a,variant:"negative"}))})),m=t.forwardRef((function(e,a){return t.createElement(l,o({as:e.as||"button"},e,{ref:a,variant:"tertiary"}))})),v=["as","className"],g=["className","children","size"],p=["children","className","variant","disabled","loading","as"],y=s.forwardRef((function(e,t){var r=e.children,u=e.className,l=e.variant,d=e.disabled,c=void 0!==d&&d,f=e.loading,b=void 0!==f&&f,m=e.as,v=i(e,p);return s.createElement(m||"button",o({className:a("eds-square-button",{"eds-square-button--success":"success"===l},{"eds-square-button--secondary":"secondary"===l},{"eds-square-button--tertiary":"tertiary"===l},{"eds-square-button--loading":b},u),"aria-busy":b,disabled:c,"aria-disabled":c,ref:t},v),s.Children.map(r,(function(e){return"string"==typeof e?s.createElement("span",{className:"eds-square-button__label"},e):s.createElement("span",{className:"eds-square-button__icon"},b?s.createElement(n.LoadingDots,{className:"eds-square-button__loading-dots"}):e)})))})),h=t.forwardRef((function(e,a){return t.createElement(y,o({as:e.as||"button",ref:a},e,{variant:"secondary"}))})),E=t.forwardRef((function(e,a){return t.createElement(y,o({as:e.as||"button",ref:a},e,{variant:"success"}))})),N=t.forwardRef((function(e,a){return t.createElement(y,o({as:e.as||"button",ref:a},e,{variant:"tertiary"}))})),w=["children","className","disabled","size","as","loading"],q=t.forwardRef((function(e,r){var s=e.children,u=e.className,l=e.disabled,d=void 0!==l&&l,c=e.size,f=e.as,b=e.loading,m=i(e,w),v=f||"button",g=t.Children.map(s,(function(e){return t.isValidElement(e)?t.cloneElement(e,{"aria-hidden":!0}):e})),p=t.createElement(v,o({className:a("eds-icon-button",u,{"eds-icon-button--disabled":d},"eds-icon-button--size-"+c),disabled:d,"aria-disabled":d,"aria-busy":b,ref:r},m),b?t.createElement(n.LoadingDots,null):t.createElement(t.Fragment,null,g));return d?t.createElement("div",{className:"eds-icon-button--disabled__wrapper"},p):t.createElement(t.Fragment,null,p)}));e.warnAboutMissingStyles("button"),exports.Button=l,exports.ButtonGroup=function(e){var n=e.as,r=void 0===n?"div":n,s=e.className,u=i(e,v);return t.createElement(r,o({className:a("eds-button-group",s)},u))},exports.FloatingButton=function(e){var n=e.className,r=e.children,s=e.size,u=void 0===s?"medium":s,l=i(e,g);return t.createElement("button",o({className:a("eds-floating-button",{"eds-floating-button--extended":t.Children.count(r)>1},{"eds-floating-button--small":"small"===u},n),type:"button"},l),function(e){return t.Children.map(e,(function(e){return"string"==typeof e?t.createElement("span",null,e):e}))}(r))},exports.IconButton=q,exports.NegativeButton=b,exports.PrimaryButton=d,exports.SecondaryButton=c,exports.SecondarySquareButton=h,exports.SuccessButton=f,exports.SuccessSquareButton=E,exports.TertiaryButton=m,exports.TertiarySquareButton=N;
|
|
2
2
|
//# sourceMappingURL=button.cjs.production.min.js.map
|