@entur/button 2.10.7 → 2.10.8
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 +6 -0
- package/dist/BaseSquareButton.d.ts +4 -3
- package/dist/Button.d.ts +4 -3
- package/dist/IconButton.d.ts +4 -3
- package/dist/NegativeButton.d.ts +4 -4
- package/dist/PrimaryButton.d.ts +4 -3
- package/dist/SecondaryButton.d.ts +5 -4
- package/dist/SecondarySquareButton.d.ts +5 -4
- package/dist/SuccessButton.d.ts +6 -5
- package/dist/SuccessSquareButton.d.ts +4 -3
- package/dist/TertiaryButton.d.ts +15 -6
- package/dist/TertiarySquareButton.d.ts +5 -4
- package/dist/button.cjs.development.js +36 -25
- 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 +36 -25
- package/dist/button.esm.js.map +1 -1
- package/dist/styles.css +0 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.10.8](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.10.7...@entur/button@2.10.8) (2023-01-19)
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
- **button:** remove usage of react-polymorphic-types in favor of own implementation in button packa ([d15d852](https://bitbucket.org/enturas/design-system/commits/d15d85245d7f7273f0700fafcef3201d4fa2e0ff))
|
|
11
|
+
|
|
6
12
|
## [2.10.7](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.10.4...@entur/button@2.10.7) (2022-12-09)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @entur/button
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
import './BaseSquareButton.scss';
|
|
4
4
|
export declare type BaseSquareButtonBaseProps = {
|
|
5
5
|
/** Tekst og ikon */
|
|
@@ -17,7 +17,8 @@ export declare type BaseSquareButtonBaseProps = {
|
|
|
17
17
|
*/
|
|
18
18
|
loading?: boolean;
|
|
19
19
|
};
|
|
20
|
-
export declare type BaseSquareButtonProps<T extends React.ElementType
|
|
20
|
+
export declare type BaseSquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;
|
|
21
|
+
export declare type BaseSquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: BaseSquareButtonProps<T>) => React.ReactElement | null;
|
|
21
22
|
declare const defaultElement = "button";
|
|
22
|
-
export declare const BaseSquareButton:
|
|
23
|
+
export declare const BaseSquareButton: BaseSquareButtonComponent;
|
|
23
24
|
export {};
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
import './Button.scss';
|
|
4
4
|
declare type ButtonBaseProps = {
|
|
5
5
|
/** Farge og uttrykk på knappen */
|
|
@@ -30,6 +30,7 @@ declare type ButtonBaseProps = {
|
|
|
30
30
|
'aria-label'?: string;
|
|
31
31
|
};
|
|
32
32
|
declare const defaultElement = "button";
|
|
33
|
-
export declare type ButtonProps<T extends React.ElementType
|
|
34
|
-
export declare
|
|
33
|
+
export declare type ButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;
|
|
34
|
+
export declare type ButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: ButtonProps<T>) => React.ReactElement | null;
|
|
35
|
+
export declare const Button: ButtonComponent;
|
|
35
36
|
export {};
|
package/dist/IconButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
import './IconButton.scss';
|
|
4
4
|
export declare type IconButtonBaseProps = {
|
|
5
5
|
/** Ikonet som du vil ha inne i knappen */
|
|
@@ -26,6 +26,7 @@ export declare type IconButtonBaseProps = {
|
|
|
26
26
|
loading?: boolean;
|
|
27
27
|
};
|
|
28
28
|
declare const defaultElement = "button";
|
|
29
|
-
export declare type IconButtonProps<
|
|
30
|
-
export declare
|
|
29
|
+
export declare type IconButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;
|
|
30
|
+
export declare type IconButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: IconButtonProps<T>) => React.ReactElement | null;
|
|
31
|
+
export declare const IconButton: IconButtonComponent;
|
|
31
32
|
export {};
|
package/dist/NegativeButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
export declare type NegativeButtonBaseProps = {
|
|
4
4
|
/** Størrelsen på knappen
|
|
5
5
|
* @default 'medium'
|
|
@@ -21,9 +21,9 @@ export declare type NegativeButtonBaseProps = {
|
|
|
21
21
|
width?: 'fluid' | 'auto';
|
|
22
22
|
/** Innholdet i knappen */
|
|
23
23
|
children: React.ReactNode;
|
|
24
|
-
as?: 'button' | React.ElementType;
|
|
25
24
|
};
|
|
26
|
-
export declare type NegativeButtonProps<T extends React.ElementType
|
|
25
|
+
export declare type NegativeButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;
|
|
26
|
+
export declare type NegativeButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: NegativeButtonProps<T>) => React.ReactElement | null;
|
|
27
27
|
declare const defaultElement = "button";
|
|
28
|
-
export declare const NegativeButton:
|
|
28
|
+
export declare const NegativeButton: NegativeButtonComponent;
|
|
29
29
|
export {};
|
package/dist/PrimaryButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
export declare type PrimaryButtonBaseProps = {
|
|
4
4
|
/** Størrelsen på knappen
|
|
5
5
|
* @default 'medium'
|
|
@@ -22,7 +22,8 @@ export declare type PrimaryButtonBaseProps = {
|
|
|
22
22
|
/** Innholdet i knappen */
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
};
|
|
25
|
-
export declare type PrimaryButtonProps<T extends React.ElementType
|
|
25
|
+
export declare type PrimaryButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;
|
|
26
|
+
export declare type PrimaryButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: PrimaryButtonProps<T>) => React.ReactElement | null;
|
|
26
27
|
declare const defaultElement = "button";
|
|
27
|
-
export declare const PrimaryButton:
|
|
28
|
+
export declare const PrimaryButton: PrimaryButtonComponent;
|
|
28
29
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
export declare type SecondaryButtonBaseProps = {
|
|
4
4
|
/** Størrelsen på knappen
|
|
5
5
|
* @default 'medium'
|
|
@@ -15,14 +15,15 @@ export declare type SecondaryButtonBaseProps = {
|
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
disabled?: boolean;
|
|
18
|
-
/** Bredden på knappen
|
|
18
|
+
/** Bredden på knappen.
|
|
19
19
|
* @default 'auto'
|
|
20
20
|
*/
|
|
21
21
|
width?: 'fluid' | 'auto';
|
|
22
22
|
/** Innholdet i knappen */
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
};
|
|
25
|
-
export declare type SecondaryButtonProps<T extends React.ElementType
|
|
25
|
+
export declare type SecondaryButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;
|
|
26
|
+
export declare type SecondaryButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: SecondaryButtonProps<T>) => React.ReactElement | null;
|
|
26
27
|
declare const defaultElement = "button";
|
|
27
|
-
export declare const SecondaryButton:
|
|
28
|
+
export declare const SecondaryButton: SecondaryButtonComponent;
|
|
28
29
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
|
+
declare type SecondarySquareButtonBaseProps = {
|
|
4
4
|
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
/** Ekstra klassenavn */
|
|
@@ -14,7 +14,8 @@ export declare type SecondarySquareButtonBaseProps = {
|
|
|
14
14
|
*/
|
|
15
15
|
loading?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export declare type SecondarySquareButtonProps<
|
|
17
|
+
export declare type SecondarySquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;
|
|
18
|
+
export declare type SecondarySquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: SecondarySquareButtonProps<T>) => React.ReactElement | null;
|
|
18
19
|
declare const defaultElement = "button";
|
|
19
|
-
export declare const SecondarySquareButton:
|
|
20
|
+
export declare const SecondarySquareButton: SecondarySquareButtonComponent;
|
|
20
21
|
export {};
|
package/dist/SuccessButton.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare type SuccessButtonBaseProps = {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
|
+
export declare type SuccessButtonBaseProps = {
|
|
4
4
|
/** Størrelsen på knappen
|
|
5
5
|
* @default 'medium'
|
|
6
6
|
*/
|
|
@@ -15,14 +15,15 @@ declare type SuccessButtonBaseProps = {
|
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
disabled?: boolean;
|
|
18
|
-
/** Bredden på knappen
|
|
18
|
+
/** Bredden på knappen.
|
|
19
19
|
* @default 'auto'
|
|
20
20
|
*/
|
|
21
21
|
width?: 'fluid' | 'auto';
|
|
22
22
|
/** Innholdet i knappen */
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
};
|
|
25
|
-
export declare type SuccessButtonProps<
|
|
25
|
+
export declare type SuccessButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;
|
|
26
|
+
export declare type SuccessButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: SuccessButtonProps<T>) => React.ReactElement | null;
|
|
26
27
|
declare const defaultElement = "button";
|
|
27
|
-
export declare const SuccessButton:
|
|
28
|
+
export declare const SuccessButton: SuccessButtonComponent;
|
|
28
29
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
declare type SuccessSquareButtonBaseProps = {
|
|
4
4
|
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -14,7 +14,8 @@ declare type SuccessSquareButtonBaseProps = {
|
|
|
14
14
|
*/
|
|
15
15
|
loading?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export declare type SuccessSquareButtonProps<
|
|
17
|
+
export declare type SuccessSquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;
|
|
18
|
+
export declare type SuccessSquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: SuccessSquareButtonProps<T>) => React.ReactElement | null;
|
|
18
19
|
declare const defaultElement = "button";
|
|
19
|
-
export declare const SuccessSquareButton:
|
|
20
|
+
export declare const SuccessSquareButton: SuccessSquareButtonComponent;
|
|
20
21
|
export {};
|
package/dist/TertiaryButton.d.ts
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
3
|
export declare type TertiaryButtonBaseProps = {
|
|
4
|
+
/** Størrelsen på knappen
|
|
5
|
+
* @default 'medium'
|
|
6
|
+
*/
|
|
7
|
+
size?: 'medium' | 'large';
|
|
8
|
+
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
loading?: boolean;
|
|
4
12
|
/** Ekstra klassenavn */
|
|
5
13
|
className?: string;
|
|
6
14
|
/** Deaktivering av knappen
|
|
7
15
|
* @default false
|
|
8
16
|
*/
|
|
9
17
|
disabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @default
|
|
18
|
+
/** Bredden på knappen.
|
|
19
|
+
* @default 'auto'
|
|
12
20
|
*/
|
|
13
|
-
|
|
21
|
+
width?: 'fluid' | 'auto';
|
|
14
22
|
/** Innholdet i knappen */
|
|
15
23
|
children: React.ReactNode;
|
|
16
24
|
};
|
|
17
|
-
export declare type TertiaryButtonProps<
|
|
25
|
+
export declare type TertiaryButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;
|
|
26
|
+
export declare type TertiaryButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: TertiaryButtonProps<T>) => React.ReactElement | null;
|
|
18
27
|
declare const defaultElement = "button";
|
|
19
|
-
export declare const TertiaryButton:
|
|
28
|
+
export declare const TertiaryButton: TertiaryButtonComponent;
|
|
20
29
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { PolymorphicComponentPropsWithRef } from '@entur/utils';
|
|
3
|
+
declare type TertiarySquareButtonBaseProps = {
|
|
4
4
|
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
/** Ekstra klassenavn */
|
|
@@ -14,7 +14,8 @@ export declare type TertiarySquareButtonBaseProps = {
|
|
|
14
14
|
*/
|
|
15
15
|
loading?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export declare type TertiarySquareButtonProps<
|
|
17
|
+
export declare type TertiarySquareButtonProps<T extends React.ElementType> = PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;
|
|
18
|
+
export declare type TertiarySquareButtonComponent = <T extends React.ElementType = typeof defaultElement>(props: TertiarySquareButtonProps<T>) => React.ReactElement | null;
|
|
18
19
|
declare const defaultElement = "button";
|
|
19
|
-
export declare const TertiarySquareButton:
|
|
20
|
+
export declare const TertiarySquareButton: TertiarySquareButtonComponent;
|
|
20
21
|
export {};
|
|
@@ -64,18 +64,18 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
64
64
|
return target;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
var _excluded$4 = ["as", "variant", "size", "loading", "className", "
|
|
67
|
+
var _excluded$4 = ["as", "children", "variant", "size", "loading", "className", "disabled", "width", "aria-label"];
|
|
68
68
|
var defaultElement$a = 'button';
|
|
69
69
|
var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
70
70
|
var _cx;
|
|
71
71
|
|
|
72
72
|
var as = _ref.as,
|
|
73
|
+
children = _ref.children,
|
|
73
74
|
variant = _ref.variant,
|
|
74
75
|
_ref$size = _ref.size,
|
|
75
76
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
76
77
|
loading = _ref.loading,
|
|
77
78
|
className = _ref.className,
|
|
78
|
-
children = _ref.children,
|
|
79
79
|
_ref$disabled = _ref.disabled,
|
|
80
80
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
81
81
|
_ref$width = _ref.width,
|
|
@@ -111,7 +111,8 @@ var Button = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
111
111
|
|
|
112
112
|
var defaultElement$9 = 'button';
|
|
113
113
|
var PrimaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
114
|
-
var Element = props.as || defaultElement$9;
|
|
114
|
+
var Element = props.as || defaultElement$9; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
115
|
+
|
|
115
116
|
return React__default["default"].createElement(Button, _extends({
|
|
116
117
|
as: Element
|
|
117
118
|
}, props, {
|
|
@@ -122,7 +123,8 @@ var PrimaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
|
122
123
|
|
|
123
124
|
var defaultElement$8 = 'button';
|
|
124
125
|
var SecondaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
125
|
-
var Element = props.as || defaultElement$8;
|
|
126
|
+
var Element = props.as || defaultElement$8; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
127
|
+
|
|
126
128
|
return React__default["default"].createElement(Button, _extends({
|
|
127
129
|
as: Element
|
|
128
130
|
}, props, {
|
|
@@ -133,7 +135,8 @@ var SecondaryButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
133
135
|
|
|
134
136
|
var defaultElement$7 = 'button';
|
|
135
137
|
var SuccessButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
136
|
-
var Element = props.as || defaultElement$7;
|
|
138
|
+
var Element = props.as || defaultElement$7; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
139
|
+
|
|
137
140
|
return React__default["default"].createElement(Button, _extends({
|
|
138
141
|
as: Element
|
|
139
142
|
}, props, {
|
|
@@ -144,7 +147,8 @@ var SuccessButton = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
|
144
147
|
|
|
145
148
|
var defaultElement$6 = 'button';
|
|
146
149
|
var NegativeButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
147
|
-
var Element = props.as || defaultElement$6;
|
|
150
|
+
var Element = props.as || defaultElement$6; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
151
|
+
|
|
148
152
|
return React__default["default"].createElement(Button, _extends({
|
|
149
153
|
as: Element
|
|
150
154
|
}, props, {
|
|
@@ -155,7 +159,8 @@ var NegativeButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
155
159
|
|
|
156
160
|
var defaultElement$5 = 'button';
|
|
157
161
|
var TertiaryButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
158
|
-
var Element = props.as || defaultElement$5;
|
|
162
|
+
var Element = props.as || defaultElement$5; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
163
|
+
|
|
159
164
|
return React__default["default"].createElement(Button, _extends({
|
|
160
165
|
as: Element
|
|
161
166
|
}, props, {
|
|
@@ -246,34 +251,40 @@ var BaseSquareButton = /*#__PURE__*/React__namespace.forwardRef(function (_ref,
|
|
|
246
251
|
var defaultElement$3 = 'button';
|
|
247
252
|
var SecondarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
248
253
|
var Element = props.as || defaultElement$3;
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
255
|
+
React__default["default"].createElement(BaseSquareButton, _extends({
|
|
256
|
+
as: Element,
|
|
257
|
+
ref: ref
|
|
258
|
+
}, props, {
|
|
259
|
+
variant: "secondary"
|
|
260
|
+
}))
|
|
261
|
+
);
|
|
255
262
|
});
|
|
256
263
|
|
|
257
264
|
var defaultElement$2 = 'button';
|
|
258
265
|
var SuccessSquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
259
266
|
var Element = props.as || defaultElement$2;
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
267
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
268
|
+
React__default["default"].createElement(BaseSquareButton, _extends({
|
|
269
|
+
as: Element,
|
|
270
|
+
ref: ref
|
|
271
|
+
}, props, {
|
|
272
|
+
variant: "success"
|
|
273
|
+
}))
|
|
274
|
+
);
|
|
266
275
|
});
|
|
267
276
|
|
|
268
277
|
var defaultElement$1 = 'button';
|
|
269
278
|
var TertiarySquareButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
270
279
|
var Element = props.as || defaultElement$1;
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
281
|
+
React__default["default"].createElement(BaseSquareButton, _extends({
|
|
282
|
+
as: Element,
|
|
283
|
+
ref: ref
|
|
284
|
+
}, props, {
|
|
285
|
+
variant: "tertiary"
|
|
286
|
+
}))
|
|
287
|
+
);
|
|
277
288
|
});
|
|
278
289
|
|
|
279
290
|
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs.development.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx","../src/BaseSquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport {\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 * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType = 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 'aria-label': ariaLabel,\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 const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\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 /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<\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\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","variant","size","loading","className","children","disabled","width","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAMA,gBAAc,GAAG,QAAvB;IAKaC,MAAM,gBAGfC,gBAAK,CAACC,UAAN,CACF,gBAaEC,GAbF;;;MAEIC,UAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;2BACAC;MAAAA,sCAAW;wBACXC;MAAAA,gCAAQ;MACMC,iBAAd;MACGC;;AAIL,MAAMC,OAAO,GAAsBV,EAAE,IAAIL,gBAAzC;AACA,MAAMgB,aAAa,GAAGd,gBAAK,CAACe,QAAN,CAAeC,OAAf,CAAuBR,QAAvB,CAAtB;AACA,MAAMS,cAAc,GAClBH,aAAa,CAACI,MAAd,GAAuB,CAAvB,IAA4B,OAAOJ,aAAa,CAAC,CAAD,CAApB,KAA4B,QAD1D;AAEA,MAAMK,eAAe,GACnBL,aAAa,CAACI,MAAd,GAAuB,CAAvB,IACA,OAAOJ,aAAa,CAACA,aAAa,CAACI,MAAd,GAAuB,CAAxB,CAApB,KAAmD,QAFrD;AAIA,MAAME,oBAAoB,GAAGN,aAAa,CACvCO,MAD0B,CACnB,UAAAC,KAAK;AAAA,WAAI,OAAOA,KAAP,KAAiB,QAArB;AAAA,GADc,EAE1BC,IAF0B,CAErB,GAFqB,CA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KO,MAAAA,SAAS,EAAC;KAAf,EACGuC,iBADH,CADF;AAKD;;AACD,SAAO9C,uCAAA,mCAAA,MAAA,EAAG8C,iBAAH,CAAP;AACD,CA3CC;;ACzCJC,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 { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | 'tertiary';\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant,\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseSquareButton.scss';\n\nexport type BaseSquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type BaseSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;\n\nexport type BaseSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: BaseSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: BaseSquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n variant,\n disabled = false,\n loading = false,\n as,\n ...rest\n }: BaseSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n { 'eds-square-button--success': variant === 'success' },\n { 'eds-square-button--secondary': variant === 'secondary' },\n { 'eds-square-button--tertiary': variant === 'tertiary' },\n { 'eds-square-button--loading': loading },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__icon\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"secondary\"\n />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"tertiary\"\n />\n );\n },\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","children","variant","size","loading","className","disabled","width","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAAc,GAAG,QAAvB;IAWaC,MAAM,gBAAoBC,gBAAK,CAACC,UAAN,CACrC,gBAaEC,GAbF;;;MAEIC,UAAAA;MACAC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AO,EAAC;AAJV;AAFF;AASD,CAfH;;;ACAF,IAAMP,cAAc,GAAG,QAAvB;IAWa+C,UAAU,gBAAwB7C,yBAAK,CAACC,UAAN,CAC7C,gBAUEC,GAVF;MAEIE,gBAAAA;MACAI,iBAAAA;2BACAC;MAAAA,sCAAW;MACXH,YAAAA;MACAH,UAAAA;MACAI,eAAAA;MACGK;;AAIL,MAAMC,OAAO,GAAsBV,EAAE,IAAIL,cAAzC;AAEA,MAAMgD,iBAAiB,GACrB9C,uCAAA,CAACa,OAAD;AACEL,IAAAA,SAAS,EAAE2B,8BAAU,CACnB,iBADmB,EAEnB3B,SAFmB,EAGnB;AACE,mCAA6BC;AAD/B,KAHmB,6BAMMH,IANN,CADvB;AASEG,IAAAA,QAAQ,EAAEA,QATZ;qBAUiBA,QAVjB;iBAWaF,OAXb;AAYEL,IAAAA,GAAG,EAAEA;AAZP,KAaMU,IAbN,GAeGL,OAAO,GAAGP,uCAAA,CAAC2B,kBAAD,MAAA,CAAH,GAAqBvB,QAf/B,CADF;;AAoBA,MAAIK,QAAJ,EAAc;AACZ,WACET,uCAAA,MAAA;AAAKQ,MAAAA,SAAS,EAAC;KAAf,EACGsC,iBADH,CADF;AAKD;;AACD,SAAO9C,uCAAA,mCAAA,MAAA,EAAG8C,iBAAH,CAAP;AACD,CA3C4C;;ACvC/CC,4BAAsB,CAAC,QAAD,CAAtB;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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),i=n(a);function l(){return l=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},l.apply(this,arguments)}function d(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","
|
|
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),i=n(a);function l(){return l=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},l.apply(this,arguments)}function d(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","children","variant","size","loading","className","disabled","width","aria-label"],f=u.forwardRef((function(e,t){var a,n=e.as,s=e.children,o=e.variant,f=e.size,b=void 0===f?"medium":f,m=e.loading,v=e.className,p=e.disabled,g=void 0!==p&&p,y=e.width,h=void 0===y?"auto":y,E=e["aria-label"],N=d(e,c),w=n||"button",q=u.Children.toArray(s),x=q.length>1&&"string"!=typeof q[0],_=q.length>1&&"string"!=typeof q[q.length-1],B=q.filter((function(e){return"string"==typeof e})).join(" ");return u.createElement(w,l({className:i.default("eds-button",(a={},a["eds-button--variant-"+o]=o,a["eds-button--size-"+b]=b,a["eds-button--width-fluid"]="fluid"===h,a["eds-button--loading"]=m,a["eds-button--leading-icon"]=x,a["eds-button--trailing-icon"]=_,a),v),ref:t,"aria-busy":m,disabled:g,"aria-disabled":g,"aria-label":E||(m?B:void 0)},N),m?u.createElement(r.LoadingDots,{className:"eds-button__loading-dots"}):s)})),b=o.default.forwardRef((function(e,t){return o.default.createElement(f,l({as:e.as||"button"},e,{ref:t,variant:"primary"}))})),m=o.default.forwardRef((function(e,t){return o.default.createElement(f,l({as:e.as||"button"},e,{ref:t,variant:"secondary"}))})),v=o.default.forwardRef((function(e,t){return o.default.createElement(f,l({as:e.as||"button"},e,{ref:t,variant:"success"}))})),p=o.default.forwardRef((function(e,t){return o.default.createElement(f,l({as:e.as||"button"},e,{ref:t,variant:"negative"}))})),g=o.default.forwardRef((function(e,t){return o.default.createElement(f,l({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=d(e,E);return u.createElement(m||"button",l({className:i.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,l({as:e.as||"button",ref:t},e,{variant:"secondary"}))})),q=o.default.forwardRef((function(e,t){return o.default.createElement(N,l({as:e.as||"button",ref:t},e,{variant:"success"}))})),x=o.default.forwardRef((function(e,t){return o.default.createElement(N,l({as:e.as||"button",ref:t},e,{variant:"tertiary"}))})),_=["children","className","disabled","size","as","loading"],B=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=d(e,_),v=o.default.createElement(f||"button",l({className:i.default("eds-icon-button",n,{"eds-icon-button--disabled":u},"eds-icon-button--size-"+c),disabled:u,"aria-disabled":u,"aria-busy":b,ref:t},m),b?o.default.createElement(r.LoadingDots,null):a);return u?o.default.createElement("div",{className:"eds-icon-button--disabled__wrapper"},v):o.default.createElement(o.default.Fragment,null,v)}));e.warnAboutMissingStyles("button"),exports.Button=f,exports.ButtonGroup=function(e){var t=e.as,a=void 0===t?"div":t,r=e.className,n=d(e,y);return o.default.createElement(a,l({className:i.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=d(e,h);return o.default.createElement("button",l({className:i.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=B,exports.NegativeButton=p,exports.PrimaryButton=b,exports.SecondaryButton=m,exports.SecondarySquareButton=w,exports.SuccessButton=v,exports.SuccessSquareButton=q,exports.TertiaryButton=g,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/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 * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType = 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 'aria-label': ariaLabel,\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 const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\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 /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<\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\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n","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","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","BaseSquareButton","classNames","map","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles","count","type","wrapStringsInSpans"],"mappings":"48BA4CaA,EAGTC,EAAMC,YACR,WAaEC,SAXEC,IAAAA,GACAC,IAAAA,YACAC,KAAAA,aAAO,WACPC,IAAAA,QACAC,IAAAA,UACAC,IAAAA,aACAC,SAAAA,oBACAC,MAAAA,aAAQ,SACMC,IAAd,cACGC,SAICC,EAA6BV,GAxBhB,SAyBbW,EAAgBd,EAAMe,SAASC,QAAQR,GACvCS,EACJH,EAAcI,OAAS,GAAiC,iBAArBJ,EAAc,GAC7CK,EACJL,EAAcI,OAAS,GAC4B,iBAA5CJ,EAAcA,EAAcI,OAAS,GAExCE,EAAuBN,EAC1BO,QAAO,SAAAC,SAA0B,iBAAVA,KACvBC,KAAK,YASNvB,gBAACa,KACCN,UAAWiB,UACT,4CAE0BpB,GAAYA,wBACfC,GAASA,IAC9B,2BAAqC,UAAVK,IAC3B,uBAAuBJ,IACvB,4BAA4BW,IAC5B,6BAA6BE,KAE/BZ,GAEFL,IAAKA,cACMI,EACXG,SAAUA,kBACKA,eAtBbE,IACAL,EAAgBc,WAuBdR,GAEHN,EACCN,gBAACyB,eAAYlB,UAAU,6BAEvBC,MCpEGkB,EAGT1B,UAAMC,YACR,SACE0B,EACAzB,UAGOF,wBAACD,KAAOI,GADoBwB,EAAMxB,IAVtB,UAWawB,GAAOzB,IAAKA,EAAKE,QAAQ,gBCThDwB,EAGT5B,UAAMC,YACR,SAC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C,YACR,SACE0B,EACAzB,UAIEF,wBAACgC,KAAiB7B,GAFewB,EAAMxB,IAVtB,SAYcD,IAAKA,GAASyB,GAAOvB,QAAQ,6ECErDkC,EAGTtC,UAAMC,YACR,WAUEC,OAREM,IAAAA,SACAD,IAAAA,cACAE,SAAAA,gBACAJ,IAAAA,KACAF,IAAAA,GACAG,IAAAA,QACGM,SAMC2B,EACJvC,wBAHiCG,GAtBhB,YA0BfI,UAAW0B,UACT,kBACA1B,EACA,6BAC+BE,4BAENJ,GAE3BI,SAAUA,kBACKA,cACJH,EACXJ,IAAKA,GACDU,GAEHN,EAAUN,wBAACyB,oBAAiBjB,UAI7BC,EAEAT,+BAAKO,UAAU,sCACZgC,GAIAvC,gDAAGuC,MCnFdC,yBAAuB,+CCagC,oBACrDrC,GAAIU,aAAU,QACdN,IAAAA,UACGK,gBAGDZ,wBAACa,KAAQN,UAAW0B,UAAW,mBAAoB1B,IAAgBK,4BCFV,gBAC3DL,IAAAA,UACAC,IAAAA,aACAH,KAAAA,aAAO,WACJO,gBAGDZ,oCACEO,UAAW0B,UACT,sBACA,iCAAmCjC,UAAMe,SAAS0B,MAAMjC,GAAY,GACpE,8BAAyC,UAATH,GAChCE,GAEFmC,KAAK,UACD9B,GAOiB,SAACJ,UAC1BR,UAAMe,SAASmB,IAAI1B,GAAU,SAAAc,SACV,iBAAVA,EAAqBtB,oCAAOsB,GAAgBA,KAPhDqB,CAAmBnC"}
|
|
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 { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | 'tertiary';\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant,\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseSquareButton.scss';\n\nexport type BaseSquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type BaseSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;\n\nexport type BaseSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: BaseSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: BaseSquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n variant,\n disabled = false,\n loading = false,\n as,\n ...rest\n }: BaseSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n { 'eds-square-button--success': variant === 'success' },\n { 'eds-square-button--secondary': variant === 'secondary' },\n { 'eds-square-button--tertiary': variant === 'tertiary' },\n { 'eds-square-button--loading': loading },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__icon\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"secondary\"\n />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"tertiary\"\n />\n );\n },\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n","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","children","variant","size","loading","className","disabled","width","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","BaseSquareButton","classNames","map","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles","count","type","wrapStringsInSpans"],"mappings":"48BA8CaA,EAA0BC,EAAMC,YAC3C,WAaEC,SAXEC,IAAAA,GACAC,IAAAA,SACAC,IAAAA,YACAC,KAAAA,aAAO,WACPC,IAAAA,QACAC,IAAAA,cACAC,SAAAA,oBACAC,MAAAA,aAAQ,SACMC,IAAd,cACGC,SAICC,EAA6BV,GA3BhB,SA4BbW,EAAgBd,EAAMe,SAASC,QAAQZ,GACvCa,EACJH,EAAcI,OAAS,GAAiC,iBAArBJ,EAAc,GAC7CK,EACJL,EAAcI,OAAS,GAC4B,iBAA5CJ,EAAcA,EAAcI,OAAS,GAExCE,EAAuBN,EAC1BO,QAAO,SAAAC,SAA0B,iBAAVA,KACvBC,KAAK,YASNvB,gBAACa,KACCL,UAAWgB,UACT,4CAE0BnB,GAAYA,wBACfC,GAASA,IAC9B,2BAAqC,UAAVI,IAC3B,uBAAuBH,IACvB,4BAA4BU,IAC5B,6BAA6BE,KAE/BX,GAEFN,IAAKA,cACMK,EACXE,SAAUA,kBACKA,eAtBbE,IACAJ,EAAgBa,WAuBdR,GAEHL,EACCP,gBAACyB,eAAYjB,UAAU,6BAEvBJ,MClEGsB,EAAwC1B,UAAMC,YACzD,SACE0B,EACAzB,UAIOF,wBAACD,KAAOI,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ACAzB,UAKEF,wBAACgC,KAAiB7B,GAHewB,EAAMxB,IARxB,SAWgBD,IAAKA,GAASyB,GAAOtB,QAAQ,gBCTvDgC,EACXrC,UAAMC,YACJ,SACE0B,EACAzB,UAKEF,wBAACgC,KACC7B,GAJ+BwB,EAAMxB,IARxB,SAabD,IAAKA,GACDyB,GACJtB,QAAQ,6ECDLiC,EAAkCtC,UAAMC,YACnD,WAUEC,OAREE,IAAAA,SACAI,IAAAA,cACAC,SAAAA,gBACAH,IAAAA,KACAH,IAAAA,GACAI,IAAAA,QACGK,SAMC2B,EACJvC,wBAHiCG,GAxBhB,YA4BfK,UAAWyB,UACT,kBACAzB,EACA,6BAC+BC,4BAENH,GAE3BG,SAAUA,kBACKA,cACJF,EACXL,IAAKA,GACDU,GAEHL,EAAUP,wBAACyB,oBAAiBrB,UAI7BK,EAEAT,+BAAKQ,UAAU,sCACZ+B,GAIAvC,gDAAGuC,MCjFdC,yBAAuB,+CCagC,oBACrDrC,GAAIU,aAAU,QACdL,IAAAA,UACGI,gBAGDZ,wBAACa,KAAQL,UAAWyB,UAAW,mBAAoBzB,IAAgBI,4BCFV,gBAC3DJ,IAAAA,UACAJ,IAAAA,aACAE,KAAAA,aAAO,WACJM,gBAGDZ,oCACEQ,UAAWyB,UACT,sBACA,iCAAmCjC,UAAMe,SAAS0B,MAAMrC,GAAY,GACpE,8BAAyC,UAATE,GAChCE,GAEFkC,KAAK,UACD9B,GAOiB,SAACR,UAC1BJ,UAAMe,SAASmB,IAAI9B,GAAU,SAAAkB,SACV,iBAAVA,EAAqBtB,oCAAOsB,GAAgBA,KAPhDqB,CAAmBvC"}
|
package/dist/button.esm.js
CHANGED
|
@@ -37,18 +37,18 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
37
37
|
return target;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var _excluded$4 = ["as", "variant", "size", "loading", "className", "
|
|
40
|
+
var _excluded$4 = ["as", "children", "variant", "size", "loading", "className", "disabled", "width", "aria-label"];
|
|
41
41
|
var defaultElement$a = 'button';
|
|
42
42
|
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
43
43
|
var _cx;
|
|
44
44
|
|
|
45
45
|
var as = _ref.as,
|
|
46
|
+
children = _ref.children,
|
|
46
47
|
variant = _ref.variant,
|
|
47
48
|
_ref$size = _ref.size,
|
|
48
49
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
49
50
|
loading = _ref.loading,
|
|
50
51
|
className = _ref.className,
|
|
51
|
-
children = _ref.children,
|
|
52
52
|
_ref$disabled = _ref.disabled,
|
|
53
53
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
54
54
|
_ref$width = _ref.width,
|
|
@@ -84,7 +84,8 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
84
84
|
|
|
85
85
|
var defaultElement$9 = 'button';
|
|
86
86
|
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
87
|
-
var Element = props.as || defaultElement$9;
|
|
87
|
+
var Element = props.as || defaultElement$9; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
88
|
+
|
|
88
89
|
return React__default.createElement(Button, _extends({
|
|
89
90
|
as: Element
|
|
90
91
|
}, props, {
|
|
@@ -95,7 +96,8 @@ var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
95
96
|
|
|
96
97
|
var defaultElement$8 = 'button';
|
|
97
98
|
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
98
|
-
var Element = props.as || defaultElement$8;
|
|
99
|
+
var Element = props.as || defaultElement$8; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
100
|
+
|
|
99
101
|
return React__default.createElement(Button, _extends({
|
|
100
102
|
as: Element
|
|
101
103
|
}, props, {
|
|
@@ -106,7 +108,8 @@ var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, re
|
|
|
106
108
|
|
|
107
109
|
var defaultElement$7 = 'button';
|
|
108
110
|
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
109
|
-
var Element = props.as || defaultElement$7;
|
|
111
|
+
var Element = props.as || defaultElement$7; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
112
|
+
|
|
110
113
|
return React__default.createElement(Button, _extends({
|
|
111
114
|
as: Element
|
|
112
115
|
}, props, {
|
|
@@ -117,7 +120,8 @@ var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
|
117
120
|
|
|
118
121
|
var defaultElement$6 = 'button';
|
|
119
122
|
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
120
|
-
var Element = props.as || defaultElement$6;
|
|
123
|
+
var Element = props.as || defaultElement$6; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
124
|
+
|
|
121
125
|
return React__default.createElement(Button, _extends({
|
|
122
126
|
as: Element
|
|
123
127
|
}, props, {
|
|
@@ -128,7 +132,8 @@ var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
128
132
|
|
|
129
133
|
var defaultElement$5 = 'button';
|
|
130
134
|
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
131
|
-
var Element = props.as || defaultElement$5;
|
|
135
|
+
var Element = props.as || defaultElement$5; // @ts-expect-error type error due to props not being BaseButtonProps
|
|
136
|
+
|
|
132
137
|
return React__default.createElement(Button, _extends({
|
|
133
138
|
as: Element
|
|
134
139
|
}, props, {
|
|
@@ -219,34 +224,40 @@ var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
219
224
|
var defaultElement$3 = 'button';
|
|
220
225
|
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
221
226
|
var Element = props.as || defaultElement$3;
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
228
|
+
React__default.createElement(BaseSquareButton, _extends({
|
|
229
|
+
as: Element,
|
|
230
|
+
ref: ref
|
|
231
|
+
}, props, {
|
|
232
|
+
variant: "secondary"
|
|
233
|
+
}))
|
|
234
|
+
);
|
|
228
235
|
});
|
|
229
236
|
|
|
230
237
|
var defaultElement$2 = 'button';
|
|
231
238
|
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
232
239
|
var Element = props.as || defaultElement$2;
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
241
|
+
React__default.createElement(BaseSquareButton, _extends({
|
|
242
|
+
as: Element,
|
|
243
|
+
ref: ref
|
|
244
|
+
}, props, {
|
|
245
|
+
variant: "success"
|
|
246
|
+
}))
|
|
247
|
+
);
|
|
239
248
|
});
|
|
240
249
|
|
|
241
250
|
var defaultElement$1 = 'button';
|
|
242
251
|
var TertiarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
243
252
|
var Element = props.as || defaultElement$1;
|
|
244
|
-
return
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
return (// @ts-expect-error type error due to props not being BaseButtonProps
|
|
254
|
+
React__default.createElement(BaseSquareButton, _extends({
|
|
255
|
+
as: Element,
|
|
256
|
+
ref: ref
|
|
257
|
+
}, props, {
|
|
258
|
+
variant: "tertiary"
|
|
259
|
+
}))
|
|
260
|
+
);
|
|
250
261
|
});
|
|
251
262
|
|
|
252
263
|
var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
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/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 * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType = 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 'aria-label': ariaLabel,\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 const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport {\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 /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<\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\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","variant","size","loading","className","children","disabled","width","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAMA,gBAAc,GAAG,QAAvB;IAKaC,MAAM,gBAGfC,KAAK,CAACC,UAAN,CACF,gBAaEC,GAbF;;;MAEIC,UAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;2BACAC;MAAAA,sCAAW;wBACXC;MAAAA,gCAAQ;MACMC,iBAAd;MACGC;;AAIL,MAAMC,OAAO,GAAsBV,EAAE,IAAIL,gBAAzC;AACA,MAAMgB,aAAa,GAAGd,KAAK,CAACe,QAAN,CAAeC,OAAf,CAAuBR,QAAvB,CAAtB;AACA,MAAMS,cAAc,GAClBH,aAAa,CAACI,MAAd,GAAuB,CA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EAEnB5B,SAFmB,EAGnB;AACE,mCAA6BE;AAD/B,KAHmB,6BAMMJ,IANN,CADvB;AASEI,IAAAA,QAAQ,EAAEA,QATZ;qBAUiBA,QAVjB;iBAWaH,OAXb;AAYEJ,IAAAA,GAAG,EAAEA;AAZP,KAaMU,IAbN,GAeGN,OAAO,GAAGN,4BAAA,CAAC2B,WAAD,MAAA,CAAH,GAAqBnB,QAf/B,CADF;;AAoBA,MAAIC,QAAJ,EAAc;AACZ,WACET,4BAAA,MAAA;AAAKO,MAAAA,SAAS,EAAC;KAAf,EACGuC,iBADH,CADF;AAKD;;AACD,SAAO9C,4BAAA,wBAAA,MAAA,EAAG8C,iBAAH,CAAP;AACD,CA3CC;;ACzCJC,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 { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | 'tertiary';\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant,\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"tertiary\" />;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseSquareButton.scss';\n\nexport type BaseSquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type BaseSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, BaseSquareButtonBaseProps>;\n\nexport type BaseSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: BaseSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const BaseSquareButton: BaseSquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n variant,\n disabled = false,\n loading = false,\n as,\n ...rest\n }: BaseSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n { 'eds-square-button--success': variant === 'success' },\n { 'eds-square-button--secondary': variant === 'secondary' },\n { 'eds-square-button--tertiary': variant === 'tertiary' },\n { 'eds-square-button--loading': loading },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__icon\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"secondary\"\n />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { BaseSquareButton } from './BaseSquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <BaseSquareButton\n as={Element}\n ref={ref}\n {...props}\n variant=\"tertiary\"\n />\n );\n },\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default \"medium\"\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size,\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : children}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","ref","as","children","variant","size","loading","className","disabled","width","ariaLabel","rest","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","classNames","FloatingButton","count","type","wrapStringsInSpans","map","BaseSquareButton","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","iconButtonElement","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAMA,gBAAc,GAAG,QAAvB;IAWaC,MAAM,gBAAoBC,KAAK,CAACC,UAAN,CACrC,gBAaEC,GAbF;;;MAEIC,UAAAA;MACAC,gBAAAA;MACAC,eAAAA;uBACAC;MAAAA,8BAAO;MACPC,eAAAA;MACAC,iBAAAA;2BACAC;MAAAA,sCAAW;wBACXC;MAAAA,gCAAQ;MACMC,iBAAd;MACGC;;AAIL,MAAMC,OAAO,GAAsBV,EAAE,IAAIL,gBAAzC;AACA,MAAMgB,aAAa,GAAGd,KAAK,CAACe,QAAN,CAAeC,OAAf,CAAuBZ,QAAvB,CAAtB;AACA,MAAMa,cAAc,GAClBH,aAAa,CAACI,MAAd,GAAuB,CAAvB,IAA4B,OAAOJ,aAAa,CAAC,CAAD,CAApB,KAA4B,QAD1D;AAEA,MAAMK,eAAe,GACnBL,aAAa,CAACI,MAAd,GAAuB,CAAvB,IACA,OAAOJ,aAAa,CAACA,aAAa,CAACI,MAAd,GAAuB,CAAxB,CAApB,KAAmD,QAFrD;AAIA,MAAME,oBAAoB,GAAGN,aAAa,CACvCO,MAD0B,CACnB,UAAAC,KAAK;AAAA,WAAI,OAAOA,KAAP,KAAiB,QAArB;AAAA,GADc,EAE1BC,IAF0B,CAErB,GAFqB,CAA7B;;AAIA,MAAMC,cAAc,GAAG,SAAjBA,cAAiB;AACrB,QAAIb,SAAJ,EAAe,OAAOA,SAAP;AACf,QAAIJ,OAAJ,EAAa,OAAOa,oBAAP;AACb,WAAOK,SAAP;AACD,GAJD;;AAMA,SACEzB,mBAAA,CAACa,OAAD;AACEL,IAAAA,SAAS,EAAEkB,UAAE,CACX,YADW,0CAGerB,OAHf,IAG2BA,OAH3B,4BAIYC,IAJZ,IAIqBA,IAJrB,MAK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
|
3
|
+
"version": "2.10.8",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/button.esm.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"start": "dts watch --noClean",
|
|
21
21
|
"build": "dts build",
|
|
22
|
-
"test": "dts test
|
|
22
|
+
"test": "dts test",
|
|
23
23
|
"lint": "dts lint"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -27,12 +27,12 @@
|
|
|
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.16",
|
|
31
|
+
"@entur/utils": "^0.4.9",
|
|
32
32
|
"classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@entur/tokens": "^3.4.
|
|
35
|
+
"@entur/tokens": "^3.4.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "de71e205560a699e2dce301e133966dc9348c459"
|
|
38
38
|
}
|