@entur/button 2.7.4 → 2.8.2
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/CHANGELOG.md +14 -0
- package/dist/BaseSquareButton.d.ts +1 -1
- package/dist/TertiarySquareButton.d.ts +20 -0
- package/dist/button.cjs.development.js +122 -64
- 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/button.esm.js +82 -45
- package/dist/button.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/styles.css +53 -3
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.8.2](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.8.1...@entur/button@2.8.2) (2022-05-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @entur/button
|
|
9
|
+
|
|
10
|
+
## [2.8.1](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.8.0...@entur/button@2.8.1) (2022-04-27)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @entur/button
|
|
13
|
+
|
|
14
|
+
# [2.8.0](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.7.4...@entur/button@2.8.0) (2022-02-09)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **square button:** add tertiary square button style ([fe083e3](https://bitbucket.org/enturas/design-system/commits/fe083e3603cb3e037456f9485d5c71d4364d20ee))
|
|
19
|
+
|
|
6
20
|
## [2.7.4](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.7.3...@entur/button@2.7.4) (2021-11-17)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @entur/button
|
|
@@ -7,7 +7,7 @@ export declare type BaseSquareButtonBaseProps = {
|
|
|
7
7
|
/** Ekstra klassenavn */
|
|
8
8
|
className?: string;
|
|
9
9
|
/** En type knapp */
|
|
10
|
-
variant: 'success' | 'secondary';
|
|
10
|
+
variant: 'success' | 'secondary' | 'tertiary';
|
|
11
11
|
/** Deaktivering av knappen
|
|
12
12
|
* @default false
|
|
13
13
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
|
|
3
|
+
export declare 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 declare type TertiarySquareButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<TertiarySquareButtonBaseProps, E>;
|
|
18
|
+
declare const defaultElement = "button";
|
|
19
|
+
export declare const TertiarySquareButton: PolymorphicForwardRefExoticComponent<TertiarySquareButtonBaseProps, typeof defaultElement>;
|
|
20
|
+
export {};
|
|
@@ -2,14 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
5
|
var utils = require('@entur/utils');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var
|
|
10
|
-
var classNames = _interopDefault(require('classnames'));
|
|
7
|
+
var classNames = require('classnames');
|
|
11
8
|
var loader = require('@entur/loader');
|
|
12
9
|
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n["default"] = e;
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
32
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
33
|
+
|
|
34
|
+
function _extends() {
|
|
35
|
+
_extends = Object.assign || function (target) {
|
|
36
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
37
|
+
var source = arguments[i];
|
|
38
|
+
|
|
39
|
+
for (var key in source) {
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
41
|
+
target[key] = source[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return target;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return _extends.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
|
|
13
52
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
14
53
|
if (source == null) return {};
|
|
15
54
|
var target = {};
|
|
@@ -25,8 +64,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
25
64
|
return target;
|
|
26
65
|
}
|
|
27
66
|
|
|
28
|
-
var
|
|
29
|
-
var
|
|
67
|
+
var _excluded$4 = ["as", "variant", "size", "loading", "className", "children", "disabled", "width"];
|
|
68
|
+
var defaultElement$a = 'button';
|
|
69
|
+
var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
30
70
|
var _cx;
|
|
31
71
|
|
|
32
72
|
var as = _ref.as,
|
|
@@ -40,27 +80,27 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
40
80
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
41
81
|
_ref$width = _ref.width,
|
|
42
82
|
width = _ref$width === void 0 ? 'auto' : _ref$width,
|
|
43
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
83
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
44
84
|
|
|
45
|
-
var Element = as || defaultElement;
|
|
46
|
-
var childrenArray =
|
|
85
|
+
var Element = as || defaultElement$a;
|
|
86
|
+
var childrenArray = React__namespace.Children.toArray(children);
|
|
47
87
|
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
|
|
48
88
|
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
|
|
49
|
-
return
|
|
50
|
-
className:
|
|
89
|
+
return React__namespace.createElement(Element, _extends({
|
|
90
|
+
className: classNames__default["default"]('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),
|
|
51
91
|
ref: ref,
|
|
52
92
|
"aria-busy": loading,
|
|
53
93
|
disabled: disabled,
|
|
54
94
|
"aria-disabled": disabled
|
|
55
|
-
}, rest), loading ?
|
|
95
|
+
}, rest), loading ? React__namespace.createElement(loader.LoadingDots, {
|
|
56
96
|
className: "eds-button__loading-dots"
|
|
57
97
|
}) : children);
|
|
58
98
|
});
|
|
59
99
|
|
|
60
|
-
var defaultElement$
|
|
61
|
-
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
62
|
-
var Element = props.as || defaultElement$
|
|
63
|
-
return React__default.createElement(Button,
|
|
100
|
+
var defaultElement$9 = 'button';
|
|
101
|
+
var PrimaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
102
|
+
var Element = props.as || defaultElement$9;
|
|
103
|
+
return React__default["default"].createElement(Button, _extends({
|
|
64
104
|
as: Element
|
|
65
105
|
}, props, {
|
|
66
106
|
ref: ref,
|
|
@@ -68,10 +108,10 @@ var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
68
108
|
}));
|
|
69
109
|
});
|
|
70
110
|
|
|
71
|
-
var defaultElement$
|
|
72
|
-
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
73
|
-
var Element = props.as || defaultElement$
|
|
74
|
-
return React__default.createElement(Button,
|
|
111
|
+
var defaultElement$8 = 'button';
|
|
112
|
+
var SecondaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
113
|
+
var Element = props.as || defaultElement$8;
|
|
114
|
+
return React__default["default"].createElement(Button, _extends({
|
|
75
115
|
as: Element
|
|
76
116
|
}, props, {
|
|
77
117
|
ref: ref,
|
|
@@ -79,10 +119,10 @@ var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, re
|
|
|
79
119
|
}));
|
|
80
120
|
});
|
|
81
121
|
|
|
82
|
-
var defaultElement$
|
|
83
|
-
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
84
|
-
var Element = props.as || defaultElement$
|
|
85
|
-
return React__default.createElement(Button,
|
|
122
|
+
var defaultElement$7 = 'button';
|
|
123
|
+
var SuccessButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
124
|
+
var Element = props.as || defaultElement$7;
|
|
125
|
+
return React__default["default"].createElement(Button, _extends({
|
|
86
126
|
as: Element
|
|
87
127
|
}, props, {
|
|
88
128
|
ref: ref,
|
|
@@ -90,10 +130,10 @@ var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
90
130
|
}));
|
|
91
131
|
});
|
|
92
132
|
|
|
93
|
-
var defaultElement$
|
|
94
|
-
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
95
|
-
var Element = props.as || defaultElement$
|
|
96
|
-
return React__default.createElement(Button,
|
|
133
|
+
var defaultElement$6 = 'button';
|
|
134
|
+
var NegativeButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
135
|
+
var Element = props.as || defaultElement$6;
|
|
136
|
+
return React__default["default"].createElement(Button, _extends({
|
|
97
137
|
as: Element
|
|
98
138
|
}, props, {
|
|
99
139
|
ref: ref,
|
|
@@ -102,9 +142,9 @@ var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
102
142
|
});
|
|
103
143
|
|
|
104
144
|
var defaultElement$5 = 'button';
|
|
105
|
-
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
145
|
+
var TertiaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
106
146
|
var Element = props.as || defaultElement$5;
|
|
107
|
-
return React__default.createElement(Button,
|
|
147
|
+
return React__default["default"].createElement(Button, _extends({
|
|
108
148
|
as: Element
|
|
109
149
|
}, props, {
|
|
110
150
|
ref: ref,
|
|
@@ -112,27 +152,29 @@ var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
112
152
|
}));
|
|
113
153
|
});
|
|
114
154
|
|
|
155
|
+
var _excluded$3 = ["as", "className"];
|
|
115
156
|
var ButtonGroup = function ButtonGroup(_ref) {
|
|
116
157
|
var _ref$as = _ref.as,
|
|
117
158
|
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
118
159
|
className = _ref.className,
|
|
119
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
160
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
120
161
|
|
|
121
|
-
return React__default.createElement(Element,
|
|
122
|
-
className:
|
|
162
|
+
return React__default["default"].createElement(Element, _extends({
|
|
163
|
+
className: classNames__default["default"]('eds-button-group', className)
|
|
123
164
|
}, rest));
|
|
124
165
|
};
|
|
125
166
|
|
|
167
|
+
var _excluded$2 = ["className", "children", "size"];
|
|
126
168
|
var FloatingButton = function FloatingButton(_ref) {
|
|
127
169
|
var className = _ref.className,
|
|
128
170
|
children = _ref.children,
|
|
129
171
|
_ref$size = _ref.size,
|
|
130
172
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
131
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
173
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
132
174
|
|
|
133
|
-
return React__default.createElement("button",
|
|
134
|
-
className:
|
|
135
|
-
'eds-floating-button--extended': React__default.Children.count(children) > 1
|
|
175
|
+
return React__default["default"].createElement("button", _extends({
|
|
176
|
+
className: classNames__default["default"]('eds-floating-button', {
|
|
177
|
+
'eds-floating-button--extended': React__default["default"].Children.count(children) > 1
|
|
136
178
|
}, {
|
|
137
179
|
'eds-floating-button--small': size === 'small'
|
|
138
180
|
}, className),
|
|
@@ -141,13 +183,14 @@ var FloatingButton = function FloatingButton(_ref) {
|
|
|
141
183
|
};
|
|
142
184
|
|
|
143
185
|
var wrapStringsInSpans = function wrapStringsInSpans(children) {
|
|
144
|
-
return React__default.Children.map(children, function (child) {
|
|
145
|
-
return typeof child === 'string' ? React__default.createElement("span", null, child) : child;
|
|
186
|
+
return React__default["default"].Children.map(children, function (child) {
|
|
187
|
+
return typeof child === 'string' ? React__default["default"].createElement("span", null, child) : child;
|
|
146
188
|
});
|
|
147
189
|
};
|
|
148
190
|
|
|
149
|
-
var
|
|
150
|
-
var
|
|
191
|
+
var _excluded$1 = ["children", "className", "variant", "disabled", "loading", "as"];
|
|
192
|
+
var defaultElement$4 = 'button';
|
|
193
|
+
var BaseSquareButton = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
151
194
|
var children = _ref.children,
|
|
152
195
|
className = _ref.className,
|
|
153
196
|
variant = _ref.variant,
|
|
@@ -156,14 +199,16 @@ var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
156
199
|
_ref$loading = _ref.loading,
|
|
157
200
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
158
201
|
as = _ref.as,
|
|
159
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
202
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
160
203
|
|
|
161
|
-
var Element = as || defaultElement$
|
|
162
|
-
return
|
|
163
|
-
className:
|
|
204
|
+
var Element = as || defaultElement$4;
|
|
205
|
+
return React__namespace.createElement(Element, _extends({
|
|
206
|
+
className: classNames__default["default"]('eds-square-button', {
|
|
164
207
|
'eds-square-button--success': variant === 'success'
|
|
165
208
|
}, {
|
|
166
209
|
'eds-square-button--secondary': variant === 'secondary'
|
|
210
|
+
}, {
|
|
211
|
+
'eds-square-button--tertiary': variant === 'tertiary'
|
|
167
212
|
}, {
|
|
168
213
|
'eds-square-button--loading': loading
|
|
169
214
|
}, className),
|
|
@@ -171,25 +216,25 @@ var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
171
216
|
disabled: disabled,
|
|
172
217
|
"aria-disabled": disabled,
|
|
173
218
|
ref: ref
|
|
174
|
-
}, rest),
|
|
219
|
+
}, rest), React__namespace.Children.map(children, function (child) {
|
|
175
220
|
if (typeof child === 'string') {
|
|
176
|
-
return
|
|
221
|
+
return React__namespace.createElement("span", {
|
|
177
222
|
className: "eds-square-button__label"
|
|
178
223
|
}, child);
|
|
179
224
|
}
|
|
180
225
|
|
|
181
|
-
return
|
|
226
|
+
return React__namespace.createElement("span", {
|
|
182
227
|
className: "eds-square-button__icon"
|
|
183
|
-
}, loading ?
|
|
228
|
+
}, loading ? React__namespace.createElement(loader.LoadingDots, {
|
|
184
229
|
className: "eds-square-button__loading-dots"
|
|
185
230
|
}) : child);
|
|
186
231
|
}));
|
|
187
232
|
});
|
|
188
233
|
|
|
189
|
-
var defaultElement$
|
|
190
|
-
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
191
|
-
var Element = props.as || defaultElement$
|
|
192
|
-
return React__default.createElement(BaseSquareButton,
|
|
234
|
+
var defaultElement$3 = 'button';
|
|
235
|
+
var SecondarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
236
|
+
var Element = props.as || defaultElement$3;
|
|
237
|
+
return React__default["default"].createElement(BaseSquareButton, _extends({
|
|
193
238
|
as: Element,
|
|
194
239
|
ref: ref
|
|
195
240
|
}, props, {
|
|
@@ -197,10 +242,10 @@ var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (pro
|
|
|
197
242
|
}));
|
|
198
243
|
});
|
|
199
244
|
|
|
200
|
-
var defaultElement$
|
|
201
|
-
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
202
|
-
var Element = props.as || defaultElement$
|
|
203
|
-
return React__default.createElement(BaseSquareButton,
|
|
245
|
+
var defaultElement$2 = 'button';
|
|
246
|
+
var SuccessSquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
247
|
+
var Element = props.as || defaultElement$2;
|
|
248
|
+
return React__default["default"].createElement(BaseSquareButton, _extends({
|
|
204
249
|
as: Element,
|
|
205
250
|
ref: ref
|
|
206
251
|
}, props, {
|
|
@@ -208,8 +253,20 @@ var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props
|
|
|
208
253
|
}));
|
|
209
254
|
});
|
|
210
255
|
|
|
211
|
-
var defaultElement$
|
|
212
|
-
var
|
|
256
|
+
var defaultElement$1 = 'button';
|
|
257
|
+
var TertiarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
258
|
+
var Element = props.as || defaultElement$1;
|
|
259
|
+
return React__default["default"].createElement(BaseSquareButton, _extends({
|
|
260
|
+
as: Element,
|
|
261
|
+
ref: ref
|
|
262
|
+
}, props, {
|
|
263
|
+
variant: "tertiary"
|
|
264
|
+
}));
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
268
|
+
var defaultElement = 'button';
|
|
269
|
+
var IconButton = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
213
270
|
var children = _ref.children,
|
|
214
271
|
className = _ref.className,
|
|
215
272
|
_ref$disabled = _ref.disabled,
|
|
@@ -217,17 +274,17 @@ var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
217
274
|
size = _ref.size,
|
|
218
275
|
as = _ref.as,
|
|
219
276
|
loading = _ref.loading,
|
|
220
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
277
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
221
278
|
|
|
222
|
-
var Element = as || defaultElement
|
|
223
|
-
return React__default.createElement(Element,
|
|
224
|
-
className:
|
|
279
|
+
var Element = as || defaultElement;
|
|
280
|
+
return React__default["default"].createElement(Element, _extends({
|
|
281
|
+
className: classNames__default["default"]('eds-icon-button', className, {
|
|
225
282
|
'eds-icon-button--disabled': disabled
|
|
226
283
|
}, "eds-icon-button--size-" + size),
|
|
227
284
|
disabled: disabled,
|
|
228
285
|
"aria-disabled": disabled,
|
|
229
286
|
ref: ref
|
|
230
|
-
}, rest), loading ? React__default.createElement(loader.LoadingDots, null) : children);
|
|
287
|
+
}, rest), loading ? React__default["default"].createElement(loader.LoadingDots, null) : children);
|
|
231
288
|
});
|
|
232
289
|
|
|
233
290
|
utils.warnAboutMissingStyles('button');
|
|
@@ -243,4 +300,5 @@ exports.SecondarySquareButton = SecondarySquareButton;
|
|
|
243
300
|
exports.SuccessButton = SuccessButton;
|
|
244
301
|
exports.SuccessSquareButton = SuccessSquareButton;
|
|
245
302
|
exports.TertiaryButton = TertiaryButton;
|
|
303
|
+
exports.TertiarySquareButton = TertiarySquareButton;
|
|
246
304
|
//# sourceMappingURL=button.cjs.development.js.map
|
|
@@ -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/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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';\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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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--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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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 './IconButton';\n"],"names":["defaultElement","Button","React","ref","as","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","forwardRef","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","Children","count","type","wrapStringsInSpans","map","child","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","IconButton","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,cAAc,GAAG,QAAvB;IAMaC,MAAM,gBAGfC,gBAAA,CACF,gBAYEC,GAZF;;;MAEIC,UAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;2BACA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ACEE,4BAAA,CAACmC,gBAAD;AAAkBjC,IAAAA,EAAE,EAAES;AAASV,IAAAA,GAAG,EAAEA;KAASoB;AAAOlB,IAAAA,OAAO,EAAC;IAA5D,CADF;AAGD,CATC,CAHG;;ACIP,IAAML,gBAAc,GAAG,QAAvB;AAMA,IAAawC,UAAU,gBAGnBtC,cAAK,CAACoB,UAAN,CACF,gBAUEnB,GAVF;MAEIM,gBAAAA;MACAD,iBAAAA;2BACAE;MAAAA,sCAAW;MACXJ,YAAAA;MACAF,UAAAA;MACAG,eAAAA;MACGK;;AAIL,MAAMC,OAAO,GAAsBT,EAAE,IAAIJ,gBAAzC;AACA,SACEE,4BAAA,CAACW,OAAD;AACEL,IAAAA,SAAS,EAAEqB,UAAU,CACnB,iBADmB,EAEnBrB,SAFmB,EAGnB;AACE,mCAA6BE;AAD/B,KAHmB,6BAMMJ,IANN;AAQrBI,IAAAA,QAAQ,EAAEA;qBACKA;AACfP,IAAAA,GAAG,EAAEA;KACDS,KAZN,EAcGL,OAAO,GAAGL,4BAAA,CAACkB,kBAAD,MAAA,CAAH,GAAqBX,QAd/B,CADF;AAkBD,CAhCC,CAHG;;ACpCPgC,4BAAsB,CAAC,QAAD,CAAtB;;;;;;;;;;;;;;"}
|
|
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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<TertiarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: PolymorphicForwardRefExoticComponent<\n TertiarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"tertiary\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","child","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAA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AAEqB,8BAAU,CACnB,iBADmB,EAEnBrB,SAFmB,EAGnB;AACE,mCAA6BE;AAD/B,KAHmB,6BAMMJ,IANN,CADvB;AASEI,IAAAA,QAAQ,EAAEA,QATZ;qBAUiBA,QAVjB;AAWEP,IAAAA,GAAG,EAAEA;AAXP,KAYMS,IAZN,GAcGL,OAAO,GAAGN,uCAAA,CAACoB,kBAAD,MAAA,CAAH,GAAqBZ,QAd/B,CADF;AAkBD,CAhCC;;ACvCJgC,4BAAsB,CAAC,QAAD,CAAtB;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),a=require("classnames"),r=require("@entur/loader");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,t}var u=s(t),o=n(t),d=n(a);function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},i.apply(this,arguments)}function l(e,t){if(null==e)return{};var a,r,n={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(a=s[r])>=0||(n[a]=e[a]);return n}var c=["as","variant","size","loading","className","children","disabled","width"],f=u.forwardRef((function(e,t){var a,n=e.as,s=e.variant,o=e.size,f=void 0===o?"medium":o,b=e.loading,m=e.className,v=e.children,g=e.disabled,p=void 0!==g&&g,y=e.width,h=void 0===y?"auto":y,E=l(e,c),N=n||"button",w=u.Children.toArray(v),q=w.length>1&&"string"!=typeof w[0],x=w.length>1&&"string"!=typeof w[w.length-1];return u.createElement(N,i({className:d.default("eds-button",(a={},a["eds-button--variant-"+s]=s,a["eds-button--size-"+f]=f,a["eds-button--width-fluid"]="fluid"===h,a["eds-button--loading"]=b,a["eds-button--leading-icon"]=q,a["eds-button--trailing-icon"]=x,a),m),ref:t,"aria-busy":b,disabled:p,"aria-disabled":p},E),b?u.createElement(r.LoadingDots,{className:"eds-button__loading-dots"}):v)})),b=o.default.forwardRef((function(e,t){return o.default.createElement(f,i({as:e.as||"button"},e,{ref:t,variant:"primary"}))})),m=o.default.forwardRef((function(e,t){return o.default.createElement(f,i({as:e.as||"button"},e,{ref:t,variant:"secondary"}))})),v=o.default.forwardRef((function(e,t){return o.default.createElement(f,i({as:e.as||"button"},e,{ref:t,variant:"success"}))})),g=o.default.forwardRef((function(e,t){return o.default.createElement(f,i({as:e.as||"button"},e,{ref:t,variant:"negative"}))})),p=o.default.forwardRef((function(e,t){return o.default.createElement(f,i({as:e.as||"button"},e,{ref:t,variant:"tertiary"}))})),y=["as","className"],h=["className","children","size"],E=["children","className","variant","disabled","loading","as"],N=u.forwardRef((function(e,t){var a=e.children,n=e.className,s=e.variant,o=e.disabled,c=void 0!==o&&o,f=e.loading,b=void 0!==f&&f,m=e.as,v=l(e,E);return u.createElement(m||"button",i({className:d.default("eds-square-button",{"eds-square-button--success":"success"===s},{"eds-square-button--secondary":"secondary"===s},{"eds-square-button--tertiary":"tertiary"===s},{"eds-square-button--loading":b},n),"aria-busy":b,disabled:c,"aria-disabled":c,ref:t},v),u.Children.map(a,(function(e){return"string"==typeof e?u.createElement("span",{className:"eds-square-button__label"},e):u.createElement("span",{className:"eds-square-button__icon"},b?u.createElement(r.LoadingDots,{className:"eds-square-button__loading-dots"}):e)})))})),w=o.default.forwardRef((function(e,t){return o.default.createElement(N,i({as:e.as||"button",ref:t},e,{variant:"secondary"}))})),q=o.default.forwardRef((function(e,t){return o.default.createElement(N,i({as:e.as||"button",ref:t},e,{variant:"success"}))})),x=o.default.forwardRef((function(e,t){return o.default.createElement(N,i({as:e.as||"button",ref:t},e,{variant:"tertiary"}))})),B=["children","className","disabled","size","as","loading"],_=o.default.forwardRef((function(e,t){var a=e.children,n=e.className,s=e.disabled,u=void 0!==s&&s,c=e.size,f=e.as,b=e.loading,m=l(e,B);return o.default.createElement(f||"button",i({className:d.default("eds-icon-button",n,{"eds-icon-button--disabled":u},"eds-icon-button--size-"+c),disabled:u,"aria-disabled":u,ref:t},m),b?o.default.createElement(r.LoadingDots,null):a)}));e.warnAboutMissingStyles("button"),exports.Button=f,exports.ButtonGroup=function(e){var t=e.as,a=void 0===t?"div":t,r=e.className,n=l(e,y);return o.default.createElement(a,i({className:d.default("eds-button-group",r)},n))},exports.FloatingButton=function(e){var t=e.className,a=e.children,r=e.size,n=void 0===r?"medium":r,s=l(e,h);return o.default.createElement("button",i({className:d.default("eds-floating-button",{"eds-floating-button--extended":o.default.Children.count(a)>1},{"eds-floating-button--small":"small"===n},t),type:"button"},s),function(e){return o.default.Children.map(e,(function(e){return"string"==typeof e?o.default.createElement("span",null,e):e}))}(a))},exports.IconButton=_,exports.NegativeButton=g,exports.PrimaryButton=b,exports.SecondaryButton=m,exports.SecondarySquareButton=w,exports.SuccessButton=v,exports.SuccessSquareButton=q,exports.TertiaryButton=p,exports.TertiarySquareButton=x;
|
|
2
2
|
//# sourceMappingURL=button.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs.production.min.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/BaseSquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/IconButton.tsx","../src/index.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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';\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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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--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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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 './IconButton';\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"],"names":["Button","React","ref","as","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","forwardRef","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","BaseSquareButton","classNames","map","child","SecondarySquareButton","SuccessSquareButton","IconButton","warnAboutMissingStyles","Children","count","type","wrapStringsInSpans"],"mappings":"4XAmCA,IAMaA,EAGTC,cACF,WAYEC,SAVEC,IAAAA,GACAC,IAAAA,YACAC,KAAAA,aAAO,WACPC,IAAAA,QACAC,IAAAA,UACAC,IAAAA,aACAC,SAAAA,oBACAC,MAAAA,aAAQ,SACLC,mFAICC,EAA6BT,GAxBhB,SAyBbU,EAAgBZ,WAAea,QAAQN,GACvCO,EACJF,EAAcG,OAAS,GAAiC,iBAArBH,EAAc,GAC7CI,EACJJ,EAAcG,OAAS,GAC4B,iBAA5CH,EAAcA,EAAcG,OAAS,UAG5Cf,gBAACW,iBACCL,UAAWW,EACT,4CAE0Bd,GAAYA,wBACfC,GAASA,IAC9B,2BAAqC,UAAVK,IAC3B,uBAAuBJ,IACvB,4BAA4BS,IAC5B,6BAA6BE,KAE/BV,GAEFL,IAAKA,cACMI,EACXG,SAAUA,kBACKA,GACXE,GAEHL,EACCL,gBAACkB,eAAYZ,UAAU,6BAEvBC,MCrDGY,EAGTnB,EAAMoB,YACR,SACEC,EACApB,UAGOD,gBAACD,iBAAOG,GADoBmB,EAAMnB,IAVtB,UAWamB,GAAOpB,IAAKA,EAAKE,QAAQ,gBCThDmB,EAGTtB,EAAMoB,YACR,SACEC,EACApB,UAGOD,gBAACD,iBAAOG,GADoBmB,EAAMnB,IAVtB,UAWamB,GAAOpB,IAAKA,EAAKE,QAAQ,kBCThDoB,EAGTvB,EAAMoB,YACR,SACEC,EACApB,UAGOD,gBAACD,iBAAOG,GADoBmB,EAAMnB,IAVtB,UAWamB,GAAO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HL,EAAUL,gBAACkB,oBAAiBX,MCpErC0B,yBAAuB,+CCagC,oBACrD/B,GAAIS,aAAU,QACdL,IAAAA,UACGI,iCAGDV,gBAACW,iBAAQL,UAAWqB,EAAW,mBAAoBrB,IAAgBI,4BCFV,gBAC3DJ,IAAAA,UACAC,IAAAA,aACAH,KAAAA,aAAO,WACJM,8CAGDV,wCACEM,UAAWqB,EACT,sBACA,iCAAmC3B,EAAMkC,SAASC,MAAM5B,GAAY,GACpE,8BAAyC,UAATH,GAChCE,GAEF8B,KAAK,UACD1B,GAOiB,SAACH,UAC1BP,EAAMkC,SAASN,IAAIrB,GAAU,SAAAsB,SACV,iBAAVA,EAAqB7B,4BAAO6B,GAAgBA,KAPhDQ,CAAmB9B"}
|
|
1
|
+
{"version":3,"file":"button.cjs.production.min.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/BaseSquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<TertiarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: PolymorphicForwardRefExoticComponent<\n TertiarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"tertiary\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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","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"],"names":["Button","React","forwardRef","ref","as","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","BaseSquareButton","classNames","map","child","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","warnAboutMissingStyles","count","type","wrapStringsInSpans"],"mappings":"+7BAyCaA,EAGTC,EAAMC,YACR,WAYEC,SAVEC,IAAAA,GACAC,IAAAA,YACAC,KAAAA,aAAO,WACPC,IAAAA,QACAC,IAAAA,UACAC,IAAAA,aACAC,SAAAA,oBACAC,MAAAA,aAAQ,SACLC,SAICC,EAA6BT,GAxBhB,SAyBbU,EAAgBb,EAAMc,SAASC,QAAQP,GACvCQ,EACJH,EAAcI,OAAS,GAAiC,iBAArBJ,EAAc,GAC7CK,EACJL,EAAcI,OAAS,GAC4B,iBAA5CJ,EAAcA,EAAcI,OAAS,UAG5CjB,gBAACY,KACCL,UAAWY,UACT,4CAE0Bf,GAAYA,wBACfC,GAASA,IAC9B,2BAAqC,UAAVK,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b,UAAU,oCAEvBuB,UC9CHC,EAGT/B,UAAMC,YACR,SACEqB,EACApB,UAIEF,wBAAC2B,KAAiBxB,GAFemB,EAAMnB,IAVtB,SAYcD,IAAKA,GAASoB,GAAOlB,QAAQ,kBCVrD4B,EAGThC,UAAMC,YACR,SACEqB,EACApB,UAIEF,wBAAC2B,KAAiBxB,GAFemB,EAAMnB,IAVtB,SAYcD,IAAKA,GAASoB,GAAOlB,QAAQ,gBCVrD6B,EAGTjC,UAAMC,YACR,SACEqB,EACApB,UAIEF,wBAAC2B,KAAiBxB,GAFemB,EAAMnB,IAVtB,SAYcD,IAAKA,GAASoB,GAAOlB,QAAQ,6ECArD8B,EAGTlC,UAAMC,YACR,WAUEC,OAREM,IAAAA,SACAD,IAAAA,cACAE,SAAAA,gBACAJ,IAAAA,KACAF,IAAAA,GACAG,IAAAA,QACGK,gBAMHX,wBAFiCG,GAtBhB,YAyBfI,UAAWqB,UACT,kBACArB,EACA,6BAC+BE,4BAENJ,GAE3BI,SAAUA,kBACKA,EACfP,IAAKA,GACDS,GAEHL,EAAUN,wBAACoB,oBAAiBZ,MCpErC2B,yBAAuB,+CCagC,oBACrDhC,GAAIS,aAAU,QACdL,IAAAA,UACGI,gBAGDX,wBAACY,KAAQL,UAAWqB,UAAW,mBAAoBrB,IAAgBI,4BCFV,gBAC3DJ,IAAAA,UACAC,IAAAA,aACAH,KAAAA,aAAO,WACJM,gBAGDX,oCACEO,UAAWqB,UACT,sBACA,iCAAmC5B,UAAMc,SAASsB,MAAM5B,GAAY,GACpE,8BAAyC,UAATH,GAChCE,GAEF8B,KAAK,UACD1B,GAOiB,SAACH,UAC1BR,UAAMc,SAASe,IAAIrB,GAAU,SAAAsB,SACV,iBAAVA,EAAqB9B,oCAAO8B,GAAgBA,KAPhDQ,CAAmB9B"}
|
package/dist/button.esm.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import { warnAboutMissingStyles } from '@entur/utils';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import { LoadingDots } from '@entur/loader';
|
|
5
6
|
|
|
7
|
+
function _extends() {
|
|
8
|
+
_extends = Object.assign || function (target) {
|
|
9
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10
|
+
var source = arguments[i];
|
|
11
|
+
|
|
12
|
+
for (var key in source) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
+
target[key] = source[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return _extends.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
6
25
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7
26
|
if (source == null) return {};
|
|
8
27
|
var target = {};
|
|
@@ -18,8 +37,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
18
37
|
return target;
|
|
19
38
|
}
|
|
20
39
|
|
|
21
|
-
var
|
|
22
|
-
var
|
|
40
|
+
var _excluded$4 = ["as", "variant", "size", "loading", "className", "children", "disabled", "width"];
|
|
41
|
+
var defaultElement$a = 'button';
|
|
42
|
+
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
23
43
|
var _cx;
|
|
24
44
|
|
|
25
45
|
var as = _ref.as,
|
|
@@ -33,27 +53,27 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
33
53
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
34
54
|
_ref$width = _ref.width,
|
|
35
55
|
width = _ref$width === void 0 ? 'auto' : _ref$width,
|
|
36
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
56
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
37
57
|
|
|
38
|
-
var Element = as || defaultElement;
|
|
39
|
-
var childrenArray = Children.toArray(children);
|
|
58
|
+
var Element = as || defaultElement$a;
|
|
59
|
+
var childrenArray = React.Children.toArray(children);
|
|
40
60
|
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
|
|
41
61
|
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
|
|
42
|
-
return createElement(Element,
|
|
62
|
+
return React.createElement(Element, _extends({
|
|
43
63
|
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),
|
|
44
64
|
ref: ref,
|
|
45
65
|
"aria-busy": loading,
|
|
46
66
|
disabled: disabled,
|
|
47
67
|
"aria-disabled": disabled
|
|
48
|
-
}, rest), loading ? createElement(LoadingDots, {
|
|
68
|
+
}, rest), loading ? React.createElement(LoadingDots, {
|
|
49
69
|
className: "eds-button__loading-dots"
|
|
50
70
|
}) : children);
|
|
51
71
|
});
|
|
52
72
|
|
|
53
|
-
var defaultElement$
|
|
73
|
+
var defaultElement$9 = 'button';
|
|
54
74
|
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
55
|
-
var Element = props.as || defaultElement$
|
|
56
|
-
return React__default.createElement(Button,
|
|
75
|
+
var Element = props.as || defaultElement$9;
|
|
76
|
+
return React__default.createElement(Button, _extends({
|
|
57
77
|
as: Element
|
|
58
78
|
}, props, {
|
|
59
79
|
ref: ref,
|
|
@@ -61,10 +81,10 @@ var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
61
81
|
}));
|
|
62
82
|
});
|
|
63
83
|
|
|
64
|
-
var defaultElement$
|
|
84
|
+
var defaultElement$8 = 'button';
|
|
65
85
|
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
66
|
-
var Element = props.as || defaultElement$
|
|
67
|
-
return React__default.createElement(Button,
|
|
86
|
+
var Element = props.as || defaultElement$8;
|
|
87
|
+
return React__default.createElement(Button, _extends({
|
|
68
88
|
as: Element
|
|
69
89
|
}, props, {
|
|
70
90
|
ref: ref,
|
|
@@ -72,10 +92,10 @@ var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, re
|
|
|
72
92
|
}));
|
|
73
93
|
});
|
|
74
94
|
|
|
75
|
-
var defaultElement$
|
|
95
|
+
var defaultElement$7 = 'button';
|
|
76
96
|
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
77
|
-
var Element = props.as || defaultElement$
|
|
78
|
-
return React__default.createElement(Button,
|
|
97
|
+
var Element = props.as || defaultElement$7;
|
|
98
|
+
return React__default.createElement(Button, _extends({
|
|
79
99
|
as: Element
|
|
80
100
|
}, props, {
|
|
81
101
|
ref: ref,
|
|
@@ -83,10 +103,10 @@ var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
83
103
|
}));
|
|
84
104
|
});
|
|
85
105
|
|
|
86
|
-
var defaultElement$
|
|
106
|
+
var defaultElement$6 = 'button';
|
|
87
107
|
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
88
|
-
var Element = props.as || defaultElement$
|
|
89
|
-
return React__default.createElement(Button,
|
|
108
|
+
var Element = props.as || defaultElement$6;
|
|
109
|
+
return React__default.createElement(Button, _extends({
|
|
90
110
|
as: Element
|
|
91
111
|
}, props, {
|
|
92
112
|
ref: ref,
|
|
@@ -97,7 +117,7 @@ var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
97
117
|
var defaultElement$5 = 'button';
|
|
98
118
|
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
99
119
|
var Element = props.as || defaultElement$5;
|
|
100
|
-
return React__default.createElement(Button,
|
|
120
|
+
return React__default.createElement(Button, _extends({
|
|
101
121
|
as: Element
|
|
102
122
|
}, props, {
|
|
103
123
|
ref: ref,
|
|
@@ -105,25 +125,27 @@ var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
105
125
|
}));
|
|
106
126
|
});
|
|
107
127
|
|
|
128
|
+
var _excluded$3 = ["as", "className"];
|
|
108
129
|
var ButtonGroup = function ButtonGroup(_ref) {
|
|
109
130
|
var _ref$as = _ref.as,
|
|
110
131
|
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
111
132
|
className = _ref.className,
|
|
112
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
133
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
113
134
|
|
|
114
|
-
return React__default.createElement(Element,
|
|
135
|
+
return React__default.createElement(Element, _extends({
|
|
115
136
|
className: classNames('eds-button-group', className)
|
|
116
137
|
}, rest));
|
|
117
138
|
};
|
|
118
139
|
|
|
140
|
+
var _excluded$2 = ["className", "children", "size"];
|
|
119
141
|
var FloatingButton = function FloatingButton(_ref) {
|
|
120
142
|
var className = _ref.className,
|
|
121
143
|
children = _ref.children,
|
|
122
144
|
_ref$size = _ref.size,
|
|
123
145
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
124
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
146
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
125
147
|
|
|
126
|
-
return React__default.createElement("button",
|
|
148
|
+
return React__default.createElement("button", _extends({
|
|
127
149
|
className: classNames('eds-floating-button', {
|
|
128
150
|
'eds-floating-button--extended': React__default.Children.count(children) > 1
|
|
129
151
|
}, {
|
|
@@ -139,8 +161,9 @@ var wrapStringsInSpans = function wrapStringsInSpans(children) {
|
|
|
139
161
|
});
|
|
140
162
|
};
|
|
141
163
|
|
|
142
|
-
var
|
|
143
|
-
var
|
|
164
|
+
var _excluded$1 = ["children", "className", "variant", "disabled", "loading", "as"];
|
|
165
|
+
var defaultElement$4 = 'button';
|
|
166
|
+
var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
144
167
|
var children = _ref.children,
|
|
145
168
|
className = _ref.className,
|
|
146
169
|
variant = _ref.variant,
|
|
@@ -149,14 +172,16 @@ var BaseSquareButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
149
172
|
_ref$loading = _ref.loading,
|
|
150
173
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
151
174
|
as = _ref.as,
|
|
152
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
175
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
153
176
|
|
|
154
|
-
var Element = as || defaultElement$
|
|
155
|
-
return createElement(Element,
|
|
177
|
+
var Element = as || defaultElement$4;
|
|
178
|
+
return React.createElement(Element, _extends({
|
|
156
179
|
className: classNames('eds-square-button', {
|
|
157
180
|
'eds-square-button--success': variant === 'success'
|
|
158
181
|
}, {
|
|
159
182
|
'eds-square-button--secondary': variant === 'secondary'
|
|
183
|
+
}, {
|
|
184
|
+
'eds-square-button--tertiary': variant === 'tertiary'
|
|
160
185
|
}, {
|
|
161
186
|
'eds-square-button--loading': loading
|
|
162
187
|
}, className),
|
|
@@ -164,25 +189,25 @@ var BaseSquareButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
164
189
|
disabled: disabled,
|
|
165
190
|
"aria-disabled": disabled,
|
|
166
191
|
ref: ref
|
|
167
|
-
}, rest), Children.map(children, function (child) {
|
|
192
|
+
}, rest), React.Children.map(children, function (child) {
|
|
168
193
|
if (typeof child === 'string') {
|
|
169
|
-
return createElement("span", {
|
|
194
|
+
return React.createElement("span", {
|
|
170
195
|
className: "eds-square-button__label"
|
|
171
196
|
}, child);
|
|
172
197
|
}
|
|
173
198
|
|
|
174
|
-
return createElement("span", {
|
|
199
|
+
return React.createElement("span", {
|
|
175
200
|
className: "eds-square-button__icon"
|
|
176
|
-
}, loading ? createElement(LoadingDots, {
|
|
201
|
+
}, loading ? React.createElement(LoadingDots, {
|
|
177
202
|
className: "eds-square-button__loading-dots"
|
|
178
203
|
}) : child);
|
|
179
204
|
}));
|
|
180
205
|
});
|
|
181
206
|
|
|
182
|
-
var defaultElement$
|
|
207
|
+
var defaultElement$3 = 'button';
|
|
183
208
|
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
184
|
-
var Element = props.as || defaultElement$
|
|
185
|
-
return React__default.createElement(BaseSquareButton,
|
|
209
|
+
var Element = props.as || defaultElement$3;
|
|
210
|
+
return React__default.createElement(BaseSquareButton, _extends({
|
|
186
211
|
as: Element,
|
|
187
212
|
ref: ref
|
|
188
213
|
}, props, {
|
|
@@ -190,10 +215,10 @@ var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (pro
|
|
|
190
215
|
}));
|
|
191
216
|
});
|
|
192
217
|
|
|
193
|
-
var defaultElement$
|
|
218
|
+
var defaultElement$2 = 'button';
|
|
194
219
|
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
195
|
-
var Element = props.as || defaultElement$
|
|
196
|
-
return React__default.createElement(BaseSquareButton,
|
|
220
|
+
var Element = props.as || defaultElement$2;
|
|
221
|
+
return React__default.createElement(BaseSquareButton, _extends({
|
|
197
222
|
as: Element,
|
|
198
223
|
ref: ref
|
|
199
224
|
}, props, {
|
|
@@ -201,7 +226,19 @@ var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props
|
|
|
201
226
|
}));
|
|
202
227
|
});
|
|
203
228
|
|
|
204
|
-
var defaultElement$
|
|
229
|
+
var defaultElement$1 = 'button';
|
|
230
|
+
var TertiarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
231
|
+
var Element = props.as || defaultElement$1;
|
|
232
|
+
return React__default.createElement(BaseSquareButton, _extends({
|
|
233
|
+
as: Element,
|
|
234
|
+
ref: ref
|
|
235
|
+
}, props, {
|
|
236
|
+
variant: "tertiary"
|
|
237
|
+
}));
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
241
|
+
var defaultElement = 'button';
|
|
205
242
|
var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
206
243
|
var children = _ref.children,
|
|
207
244
|
className = _ref.className,
|
|
@@ -210,10 +247,10 @@ var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
210
247
|
size = _ref.size,
|
|
211
248
|
as = _ref.as,
|
|
212
249
|
loading = _ref.loading,
|
|
213
|
-
rest = _objectWithoutPropertiesLoose(_ref,
|
|
250
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
214
251
|
|
|
215
|
-
var Element = as || defaultElement
|
|
216
|
-
return React__default.createElement(Element,
|
|
252
|
+
var Element = as || defaultElement;
|
|
253
|
+
return React__default.createElement(Element, _extends({
|
|
217
254
|
className: classNames('eds-icon-button', className, {
|
|
218
255
|
'eds-icon-button--disabled': disabled
|
|
219
256
|
}, "eds-icon-button--size-" + size),
|
|
@@ -225,5 +262,5 @@ var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
225
262
|
|
|
226
263
|
warnAboutMissingStyles('button');
|
|
227
264
|
|
|
228
|
-
export { Button, ButtonGroup, FloatingButton, IconButton, NegativeButton, PrimaryButton, SecondaryButton, SecondarySquareButton, SuccessButton, SuccessSquareButton, TertiaryButton };
|
|
265
|
+
export { Button, ButtonGroup, FloatingButton, IconButton, NegativeButton, PrimaryButton, SecondaryButton, SecondarySquareButton, SuccessButton, SuccessSquareButton, TertiaryButton, TertiarySquareButton };
|
|
229
266
|
//# sourceMappingURL=button.esm.js.map
|
package/dist/button.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.esm.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/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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';\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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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--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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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 './IconButton';\n"],"names":["defaultElement","Button","React","ref","as","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","forwardRef","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","Children","count","type","wrapStringsInSpans","map","child","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","IconButton","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,cAAc,GAAG,QAAvB;IAMaC,MAAM,gBAGfC,UAAA,CACF,gBAYEC,GAZF;;;MAEIC,UAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;2BACAC;MAAAA,sCAAW;wBACXC;MAAAA,gCAAQ;MACLC;;AAIL,MAAMC,OAAO,GAAsBT,EAAE,IAAIJ,cAAzC;AACA,MAAMc,aAAa,GAAGZ,QAAA,CAAea,OAAf,CAAuBN,QAAvB,CAAtB;AACA,MAAMO,cAAc,GAClBF,aAAa,CAACG,MAAd,GAAuB,CAAvB,IAA4B,OAAOH,aAAa,CAAC,CAAD,CAApB,KAA4B,QAD1D;AAEA,MAAMI,eAAe,GACnBJ,aAAa,CAACG,MAAd,GAAuB,CAAvB,IACA,OAAOH,aAAa,CAACA,aAAa,CAACG,MAAd,GAAuB,CAAxB,CAApB,KA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4BAAA,CAACW,OAAD;AACEL,IAAAA,SAAS,EAAEqB,UAAU,CACnB,iBADmB,EAEnBrB,SAFmB,EAGnB;AACE,mCAA6BE;AAD/B,KAHmB,6BAMMJ,IANN;AAQrBI,IAAAA,QAAQ,EAAEA;qBACKA;AACfP,IAAAA,GAAG,EAAEA;KACDS,KAZN,EAcGL,OAAO,GAAGL,4BAAA,CAACkB,WAAD,MAAA,CAAH,GAAqBX,QAd/B,CADF;AAkBD,CAhCC,CAHG;;ACpCPgC,sBAAsB,CAAC,QAAD,CAAtB;;;;"}
|
|
1
|
+
{"version":3,"file":"button.esm.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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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\nconst defaultElement = 'button';\n\nexport type ButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<ButtonBaseProps, T>;\n\nexport const Button: PolymorphicForwardRefExoticComponent<\n ButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n variant,\n size = 'medium',\n loading,\n className,\n children,\n disabled = false,\n width = 'auto',\n ...rest\n }: PolymorphicPropsWithoutRef<ButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 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 {...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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PolymorphicForwardRefExoticComponent<\n PrimaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<PrimaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: PolymorphicForwardRefExoticComponent<\n SecondaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\ntype 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: PolymorphicForwardRefExoticComponent<\n SuccessButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} 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 as?: 'button' | React.ElementType;\n};\n\nexport type NegativeButtonProps<\n T extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: PolymorphicForwardRefExoticComponent<\n NegativeButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<NegativeButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n PolymorphicForwardRefExoticComponent,\n} from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\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 /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: PolymorphicForwardRefExoticComponent<\n TertiaryButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiaryButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\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 {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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<\n T extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: PolymorphicForwardRefExoticComponent<\n BaseSquareButtonBaseProps,\n typeof defaultElement\n> = 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 }: PolymorphicPropsWithoutRef<BaseSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<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 {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: PolymorphicForwardRefExoticComponent<\n SecondarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SecondarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n PolymorphicPropsWithoutRef,\n} 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: PolymorphicForwardRefExoticComponent<\n SuccessSquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<SuccessSquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport {\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithoutRef,\n PolymorphicPropsWithRef,\n} from '@entur/utils';\n\nexport type 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<\n E extends React.ElementType = typeof defaultElement,\n> = PolymorphicPropsWithRef<TertiarySquareButtonBaseProps, E>;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: PolymorphicForwardRefExoticComponent<\n TertiarySquareButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PolymorphicPropsWithoutRef<TertiarySquareButtonBaseProps, T>,\n ref: React.ForwardedRef<React.ElementRef<T>>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"tertiary\" />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n PolymorphicPropsWithoutRef,\n PolymorphicForwardRefExoticComponent,\n PolymorphicPropsWithRef,\n} 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 /** 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<\n E extends React.ElementType = typeof defaultElement\n> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;\n\nexport const IconButton: PolymorphicForwardRefExoticComponent<\n IconButtonBaseProps,\n typeof defaultElement\n> = React.forwardRef(\n <E extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: PolymorphicPropsWithoutRef<IconButtonBaseProps, E>,\n ref: React.ForwardedRef<React.ElementRef<E>>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\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 ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\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","variant","size","loading","className","children","disabled","width","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","child","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAAc,GAAG,QAAvB;IAMaC,MAAM,gBAGfC,KAAK,CAACC,UAAN,CACF,gBAYEC,GAZF;;;MAEIC,UAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;2BACAC;MAAAA,sCAAW;wBACXC;MAAAA,gCAAQ;MACLC;;AAIL,MAAMC,OAAO,GAAsBT,EAAE,IAAIL,gBAAzC;AACA,MAAMe,aAAa,GAAGb,KAAK,CAACc,QAAN,CAAeC,OAAf,CAAuBP,QAAvB,CAAtB;AACA,MAAMQ,cAAc,GAClBH,aAAa,CAACI,MAAd,GAAuB,CAAvB,IAA4B,OAAOJ,aAAa,CAAC,CAAD,CAApB,KAA4B,QAD1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;AAA+BV,IAAAA,GAAG,EAAEA;AAApC,KAA6CoB,KAA7C;AAAoDlB,IAAAA,OAAO,EAAC;AAA5D,KADF;AAGD,CATC;;ACLJ,IAAMN,gBAAc,GAAG,QAAvB;IAEawC,oBAAoB,gBAG7BtC,cAAK,CAACC,UAAN,CACF,UACEqB,KADF,EAEEpB,GAFF;AAIE,MAAMU,OAAO,GAAsBU,KAAK,CAACnB,EAAN,IAAYL,gBAA/C;AACA,SACEE,4BAAA,CAACmC,gBAAD;AAAkBhC,IAAAA,EAAE,EAAES,OAAtB;AAA+BV,IAAAA,GAAG,EAAEA;AAApC,KAA6CoB,KAA7C;AAAoDlB,IAAAA,OAAO,EAAC;AAA5D,KADF;AAGD,CATC;;;ACCJ,IAAMN,cAAc,GAAG,QAAvB;IAMayC,UAAU,gBAGnBvC,cAAK,CAACC,UAAN,CACF,gBAUEC,GAVF;MAEIM,gBAAAA;MACAD,iBAAAA;2BACAE;MAAAA,sCAAW;MACXJ,YAAAA;MACAF,UAAAA;MACAG,eAAAA;MACGK;;AAIL,MAAMC,OAAO,GAAsBT,EAAE,IAAIL,cAAzC;AACA,SACEE,4BAAA,CAACY,OAAD;AACEL,IAAAA,SAAS,EAAEqB,UAAU,CACnB,iBADmB,EAEnBrB,SAFmB,EAGnB;AACE,mCAA6BE;AAD/B,KAHmB,6BAMMJ,IANN,CADvB;AASEI,IAAAA,QAAQ,EAAEA,QATZ;qBAUiBA,QAVjB;AAWEP,IAAAA,GAAG,EAAEA;AAXP,KAYMS,IAZN,GAcGL,OAAO,GAAGN,4BAAA,CAACoB,WAAD,MAAA,CAAH,GAAqBZ,QAd/B,CADF;AAkBD,CAhCC;;ACvCJgC,sBAAsB,CAAC,QAAD,CAAtB;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/styles.css
CHANGED
|
@@ -19,7 +19,9 @@ a.eds-button--size-large {
|
|
|
19
19
|
font-size: inherit;
|
|
20
20
|
cursor: pointer;
|
|
21
21
|
display: inline-block;
|
|
22
|
-
appearance: none;
|
|
22
|
+
-webkit-appearance: none;
|
|
23
|
+
-moz-appearance: none;
|
|
24
|
+
appearance: none;
|
|
23
25
|
text-decoration: none;
|
|
24
26
|
padding: 0 1rem;
|
|
25
27
|
height: 3rem;
|
|
@@ -273,7 +275,9 @@ a.eds-button--size-large {
|
|
|
273
275
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
274
276
|
.eds-floating-button {
|
|
275
277
|
align-items: center;
|
|
276
|
-
appearance: none;
|
|
278
|
+
-webkit-appearance: none;
|
|
279
|
+
-moz-appearance: none;
|
|
280
|
+
appearance: none;
|
|
277
281
|
background: #181c56;
|
|
278
282
|
border: 0;
|
|
279
283
|
border-radius: 1.5rem;
|
|
@@ -341,7 +345,9 @@ a.eds-button--size-large {
|
|
|
341
345
|
--icon-background: transparent;
|
|
342
346
|
--border-color: transparent;
|
|
343
347
|
align-items: center;
|
|
344
|
-
appearance: none;
|
|
348
|
+
-webkit-appearance: none;
|
|
349
|
+
-moz-appearance: none;
|
|
350
|
+
appearance: none;
|
|
345
351
|
background: transparent;
|
|
346
352
|
border: 0;
|
|
347
353
|
border-radius: 0.25rem;
|
|
@@ -436,4 +442,48 @@ a.eds-button--size-large {
|
|
|
436
442
|
.eds-square-button__label + .eds-square-button__icon,
|
|
437
443
|
.eds-square-button__icon + .eds-square-button__label {
|
|
438
444
|
margin-left: 1rem;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.eds-square-button--tertiary {
|
|
448
|
+
--icon-background: transparent;
|
|
449
|
+
--border-color: #181c56;
|
|
450
|
+
font-size: 0.875rem;
|
|
451
|
+
}
|
|
452
|
+
.eds-square-button--tertiary .eds-square-button__label + .eds-square-button__icon,
|
|
453
|
+
.eds-square-button--tertiary .eds-square-button__icon + .eds-square-button__label {
|
|
454
|
+
margin-left: 0.75rem;
|
|
455
|
+
}
|
|
456
|
+
.eds-square-button--tertiary .eds-square-button__icon {
|
|
457
|
+
height: 2rem;
|
|
458
|
+
width: 2rem;
|
|
459
|
+
border-width: 0.0625rem;
|
|
460
|
+
}
|
|
461
|
+
.eds-square-button--tertiary .eds-square-button__loading-dots .eds-loading-dots__dot {
|
|
462
|
+
background: #181c56;
|
|
463
|
+
}
|
|
464
|
+
.eds-square-button--tertiary:hover {
|
|
465
|
+
--icon-background: #d1d4e3;
|
|
466
|
+
}
|
|
467
|
+
.eds-square-button--tertiary:active {
|
|
468
|
+
--icon-background: #181c56;
|
|
469
|
+
--icon-color: #ffffff;
|
|
470
|
+
}
|
|
471
|
+
.eds-square-button--tertiary:active .eds-square-button__loading-dots .eds-loading-dots__dot {
|
|
472
|
+
background: #ffffff;
|
|
473
|
+
}
|
|
474
|
+
.eds-contrast .eds-square-button--tertiary {
|
|
475
|
+
--border-color: #ffffff;
|
|
476
|
+
}
|
|
477
|
+
.eds-contrast .eds-square-button--tertiary:hover {
|
|
478
|
+
--icon-background: rgba(255, 255, 255, 0.2);
|
|
479
|
+
}
|
|
480
|
+
.eds-contrast .eds-square-button--tertiary:active {
|
|
481
|
+
--icon-background: #ffffff;
|
|
482
|
+
--icon-color: #181c56;
|
|
483
|
+
}
|
|
484
|
+
.eds-contrast .eds-square-button--tertiary:active .eds-square-button__loading-dots .eds-loading-dots__dot {
|
|
485
|
+
background: #181c56;
|
|
486
|
+
}
|
|
487
|
+
.eds-contrast .eds-square-button--tertiary .eds-square-button__loading-dots .eds-loading-dots__dot {
|
|
488
|
+
background: #ffffff;
|
|
439
489
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/button",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/button.esm.js",
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"start": "
|
|
21
|
-
"build": "
|
|
22
|
-
"test": "
|
|
23
|
-
"lint": "
|
|
20
|
+
"start": "dts watch --noClean",
|
|
21
|
+
"build": "dts build",
|
|
22
|
+
"test": "dts test --env=jsdom",
|
|
23
|
+
"lint": "dts lint"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": ">=16.8.0",
|
|
27
27
|
"react-dom": ">=16.8.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@entur/loader": "^0.4.
|
|
31
|
-
"@entur/utils": "^0.4.
|
|
30
|
+
"@entur/loader": "^0.4.7",
|
|
31
|
+
"@entur/utils": "^0.4.3",
|
|
32
32
|
"classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@entur/tokens": "^3.3.
|
|
35
|
+
"@entur/tokens": "^3.3.2"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "9e25b2a4a4ab659dc368f51ad0e0b74bee26e1d0"
|
|
38
38
|
}
|