@entur/button 2.10.5 → 2.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button.cjs.development.js +34 -52
- package/dist/button.cjs.development.js.map +1 -1
- package/dist/button.cjs.production.min.js.map +1 -1
- package/dist/button.esm.js +34 -52
- package/dist/button.esm.js.map +1 -1
- package/dist/styles.css +8 -9
- package/package.json +14 -9
- package/CHANGELOG.md +0 -451
package/dist/button.esm.js
CHANGED
|
@@ -8,32 +8,26 @@ function _extends() {
|
|
|
8
8
|
_extends = Object.assign || function (target) {
|
|
9
9
|
for (var i = 1; i < arguments.length; i++) {
|
|
10
10
|
var source = arguments[i];
|
|
11
|
-
|
|
12
11
|
for (var key in source) {
|
|
13
12
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
13
|
target[key] = source[key];
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
return target;
|
|
20
18
|
};
|
|
21
|
-
|
|
22
19
|
return _extends.apply(this, arguments);
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
26
22
|
if (source == null) return {};
|
|
27
23
|
var target = {};
|
|
28
24
|
var sourceKeys = Object.keys(source);
|
|
29
25
|
var key, i;
|
|
30
|
-
|
|
31
26
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
32
27
|
key = sourceKeys[i];
|
|
33
28
|
if (excluded.indexOf(key) >= 0) continue;
|
|
34
29
|
target[key] = source[key];
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return target;
|
|
38
32
|
}
|
|
39
33
|
|
|
@@ -41,21 +35,19 @@ var _excluded$4 = ["as", "variant", "size", "loading", "className", "children",
|
|
|
41
35
|
var defaultElement$a = 'button';
|
|
42
36
|
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
43
37
|
var _cx;
|
|
44
|
-
|
|
45
38
|
var as = _ref.as,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
variant = _ref.variant,
|
|
40
|
+
_ref$size = _ref.size,
|
|
41
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
42
|
+
loading = _ref.loading,
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
children = _ref.children,
|
|
45
|
+
_ref$disabled = _ref.disabled,
|
|
46
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
47
|
+
_ref$width = _ref.width,
|
|
48
|
+
width = _ref$width === void 0 ? 'auto' : _ref$width,
|
|
49
|
+
ariaLabel = _ref['aria-label'],
|
|
50
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
59
51
|
var Element = as || defaultElement$a;
|
|
60
52
|
var childrenArray = React.Children.toArray(children);
|
|
61
53
|
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
|
|
@@ -63,13 +55,11 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
63
55
|
var ariaLabelWhenLoading = childrenArray.filter(function (child) {
|
|
64
56
|
return typeof child === 'string';
|
|
65
57
|
}).join(' ');
|
|
66
|
-
|
|
67
58
|
var ariaLabelValue = function ariaLabelValue() {
|
|
68
59
|
if (ariaLabel) return ariaLabel;
|
|
69
60
|
if (loading) return ariaLabelWhenLoading;
|
|
70
61
|
return undefined;
|
|
71
62
|
};
|
|
72
|
-
|
|
73
63
|
return React.createElement(Element, _extends({
|
|
74
64
|
className: classNames('eds-button', (_cx = {}, _cx["eds-button--variant-" + variant] = variant, _cx["eds-button--size-" + size] = size, _cx['eds-button--width-fluid'] = width === 'fluid', _cx['eds-button--loading'] = loading, _cx['eds-button--leading-icon'] = hasLeadingIcon, _cx['eds-button--trailing-icon'] = hasTrailingIcon, _cx), className),
|
|
75
65
|
ref: ref,
|
|
@@ -140,10 +130,9 @@ var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
140
130
|
var _excluded$3 = ["as", "className"];
|
|
141
131
|
var ButtonGroup = function ButtonGroup(_ref) {
|
|
142
132
|
var _ref$as = _ref.as,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
133
|
+
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
134
|
+
className = _ref.className,
|
|
135
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
147
136
|
return React__default.createElement(Element, _extends({
|
|
148
137
|
className: classNames('eds-button-group', className)
|
|
149
138
|
}, rest));
|
|
@@ -152,11 +141,10 @@ var ButtonGroup = function ButtonGroup(_ref) {
|
|
|
152
141
|
var _excluded$2 = ["className", "children", "size"];
|
|
153
142
|
var FloatingButton = function FloatingButton(_ref) {
|
|
154
143
|
var className = _ref.className,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
144
|
+
children = _ref.children,
|
|
145
|
+
_ref$size = _ref.size,
|
|
146
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
147
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
160
148
|
return React__default.createElement("button", _extends({
|
|
161
149
|
className: classNames('eds-floating-button', {
|
|
162
150
|
'eds-floating-button--extended': React__default.Children.count(children) > 1
|
|
@@ -166,7 +154,6 @@ var FloatingButton = function FloatingButton(_ref) {
|
|
|
166
154
|
type: "button"
|
|
167
155
|
}, rest), wrapStringsInSpans(children));
|
|
168
156
|
};
|
|
169
|
-
|
|
170
157
|
var wrapStringsInSpans = function wrapStringsInSpans(children) {
|
|
171
158
|
return React__default.Children.map(children, function (child) {
|
|
172
159
|
return typeof child === 'string' ? React__default.createElement("span", null, child) : child;
|
|
@@ -177,15 +164,14 @@ var _excluded$1 = ["children", "className", "variant", "disabled", "loading", "a
|
|
|
177
164
|
var defaultElement$4 = 'button';
|
|
178
165
|
var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
179
166
|
var children = _ref.children,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
167
|
+
className = _ref.className,
|
|
168
|
+
variant = _ref.variant,
|
|
169
|
+
_ref$disabled = _ref.disabled,
|
|
170
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
171
|
+
_ref$loading = _ref.loading,
|
|
172
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
173
|
+
as = _ref.as,
|
|
174
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
189
175
|
var Element = as || defaultElement$4;
|
|
190
176
|
return React.createElement(Element, _extends({
|
|
191
177
|
className: classNames('eds-square-button', {
|
|
@@ -207,7 +193,6 @@ var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
207
193
|
className: "eds-square-button__label"
|
|
208
194
|
}, child);
|
|
209
195
|
}
|
|
210
|
-
|
|
211
196
|
return React.createElement("span", {
|
|
212
197
|
className: "eds-square-button__icon"
|
|
213
198
|
}, loading ? React.createElement(LoadingDots, {
|
|
@@ -253,14 +238,13 @@ var _excluded = ["children", "className", "disabled", "size", "as", "loading"];
|
|
|
253
238
|
var defaultElement = 'button';
|
|
254
239
|
var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
255
240
|
var children = _ref.children,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
241
|
+
className = _ref.className,
|
|
242
|
+
_ref$disabled = _ref.disabled,
|
|
243
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
244
|
+
size = _ref.size,
|
|
245
|
+
as = _ref.as,
|
|
246
|
+
loading = _ref.loading,
|
|
247
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
264
248
|
var Element = as || defaultElement;
|
|
265
249
|
var iconButtonElement = React__default.createElement(Element, _extends({
|
|
266
250
|
className: classNames('eds-icon-button', className, {
|
|
@@ -271,13 +255,11 @@ var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
271
255
|
"aria-busy": loading,
|
|
272
256
|
ref: ref
|
|
273
257
|
}, rest), loading ? React__default.createElement(LoadingDots, null) : children);
|
|
274
|
-
|
|
275
258
|
if (disabled) {
|
|
276
259
|
return React__default.createElement("div", {
|
|
277
260
|
className: "eds-icon-button--disabled__wrapper"
|
|
278
261
|
}, iconButtonElement);
|
|
279
262
|
}
|
|
280
|
-
|
|
281
263
|
return React__default.createElement(React__default.Fragment, null, iconButtonElement);
|
|
282
264
|
});
|
|
283
265
|
|
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,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,QAAIL,OAAJ,EAAa,OAAOc,oBAAP;AACb,WAAO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;"}
|
|
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,QAAQ;IAKlBC,MAAM,gBAGfC,KAAK,CAACC,UAAU,CAClB,gBAaEC,GAA4C;;MAX1CC,EAAE,QAAFA,EAAE;IACFC,OAAO,QAAPA,OAAO;IAAA,iBACPC,IAAI;IAAJA,IAAI,0BAAG,QAAQ;IACfC,OAAO,QAAPA,OAAO;IACPC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IAAA,qBACRC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAA,kB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O;IAClBJ,GAAG,EAAEA;KACDU,IAAI,GAEPN,OAAO,GAAGN,6BAAC2B,WAAW,OAAG,GAAGnB,QAAQ,CAExC;EAED,IAAIC,QAAQ,EAAE;IACZ,OACET;MAAKO,SAAS,EAAC;OACZuC,iBAAiB,CACd;;EAGV,OAAO9C,4DAAG8C,iBAAiB,CAAI;AACjC,CAAC;;ACpFHC,sBAAsB,CAAC,QAAQ,CAAC;;;;"}
|
package/dist/styles.css
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
--eds-button: 1;
|
|
3
3
|
}/* DO NOT CHANGE!*/
|
|
4
4
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
5
|
+
.eds-button-group .eds-button {
|
|
6
|
+
margin-right: 0.75rem;
|
|
7
|
+
margin-bottom: 0.75rem;
|
|
8
|
+
}
|
|
9
|
+
.eds-button-group .eds-button:only-child {
|
|
10
|
+
margin: 0;
|
|
11
|
+
}/* DO NOT CHANGE!*/
|
|
12
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
5
13
|
a.eds-button {
|
|
6
14
|
padding: 0.5rem 1rem;
|
|
7
15
|
}
|
|
@@ -217,14 +225,6 @@ a.eds-button--size-large {
|
|
|
217
225
|
color: #aeb7e2;
|
|
218
226
|
}/* DO NOT CHANGE!*/
|
|
219
227
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
220
|
-
.eds-button-group .eds-button {
|
|
221
|
-
margin-right: 0.75rem;
|
|
222
|
-
margin-bottom: 0.75rem;
|
|
223
|
-
}
|
|
224
|
-
.eds-button-group .eds-button:only-child {
|
|
225
|
-
margin: 0;
|
|
226
|
-
}/* DO NOT CHANGE!*/
|
|
227
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
228
228
|
.eds-icon-button {
|
|
229
229
|
border: 0.0625rem solid transparent;
|
|
230
230
|
border-radius: 0.25rem;
|
|
@@ -274,7 +274,6 @@ a.eds-button--size-large {
|
|
|
274
274
|
}
|
|
275
275
|
.eds-icon-button--disabled__wrapper {
|
|
276
276
|
cursor: not-allowed;
|
|
277
|
-
width: -webkit-fit-content;
|
|
278
277
|
width: -moz-fit-content;
|
|
279
278
|
width: fit-content;
|
|
280
279
|
}/* DO NOT CHANGE!*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/button",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/button.esm.js",
|
|
@@ -17,22 +17,27 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"start": "dts watch --noClean",
|
|
21
|
-
"build": "dts build",
|
|
22
|
-
"test": "dts test --env=jsdom",
|
|
23
|
-
"lint": "dts lint"
|
|
20
|
+
"start": "yarn run dts watch --noClean",
|
|
21
|
+
"build": "yarn run dts build",
|
|
22
|
+
"test": "yarn run dts test --env=jsdom",
|
|
23
|
+
"lint": "yarn run dts lint"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": ">=16.8.0",
|
|
27
27
|
"react-dom": ">=16.8.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@entur/loader": "^0.4.
|
|
31
|
-
"@entur/utils": "^0.4.
|
|
30
|
+
"@entur/loader": "^0.4.14",
|
|
31
|
+
"@entur/utils": "^0.4.7",
|
|
32
32
|
"classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@entur/tokens": "^3.4.
|
|
35
|
+
"@entur/tokens": "^3.4.2",
|
|
36
|
+
"dts-cli": "^1.1.6",
|
|
37
|
+
"jest": "^27.0.0",
|
|
38
|
+
"jest-watch-typeahead": "^2.2.0",
|
|
39
|
+
"ts-jest": "^27.0.0",
|
|
40
|
+
"typescript": "^4.8.0"
|
|
36
41
|
},
|
|
37
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8915b1630bd936740ba9a4a88883f3432948a80e"
|
|
38
43
|
}
|