Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@entur/button

Package Overview
Dependencies
Maintainers
10
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entur/button - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

## [2.5.1](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.5.0...@entur/button@2.5.1) (2021-02-17)
### Bug Fixes
- **polymorphism:** update polymorphism dependency ([dc4c31d](https://bitbucket.org/enturas/design-system/commits/dc4c31d8e891a46c1f0c1fbd0a6a026c1638accc))
# [2.5.0](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.4.2...@entur/button@2.5.0) (2021-01-29)

@@ -8,0 +14,0 @@

8

dist/BaseSquareButton.d.ts

@@ -1,3 +0,3 @@

import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import * as React from 'react';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
import './BaseSquareButton.scss';

@@ -21,5 +21,5 @@ import './LoadingSpinner.scss';

};
export declare type BaseSquareButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, BaseSquareButtonBaseProps>;
export declare type BaseSquareButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<BaseSquareButtonBaseProps, T>;
declare const defaultElement = "button";
export declare const BaseSquareButton: <E extends React.ElementType = typeof defaultElement>(props: BaseSquareButtonProps<E>) => React.ReactElement | null;
export declare const BaseSquareButton: PolymorphicForwardRefExoticComponent<BaseSquareButtonBaseProps, typeof defaultElement>;
export {};

@@ -8,3 +8,4 @@ 'use strict';

var utils = require('@entur/utils');
var React = _interopDefault(require('react'));
var React = require('react');
var React__default = _interopDefault(React);
var classNames = _interopDefault(require('classnames'));

@@ -31,3 +32,4 @@

var variant = _ref.variant,
var as = _ref.as,
variant = _ref.variant,
_ref$size = _ref.size,

@@ -42,9 +44,9 @@ size = _ref$size === void 0 ? 'medium' : _ref$size,

width = _ref$width === void 0 ? 'auto' : _ref$width,
rest = _objectWithoutPropertiesLoose(_ref, ["variant", "size", "loading", "className", "children", "disabled", "width"]);
rest = _objectWithoutPropertiesLoose(_ref, ["as", "variant", "size", "loading", "className", "children", "disabled", "width"]);
var Element = as || defaultElement;
var childrenArray = React.Children.toArray(children);
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
return React.createElement(utils.Box, Object.assign({
as: defaultElement,
return React.createElement(Element, Object.assign({
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),

@@ -61,5 +63,6 @@ ref: ref,

var defaultElement$1 = 'button';
var PrimaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$1
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$1;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -72,5 +75,6 @@ ref: ref,

var defaultElement$2 = 'button';
var SecondaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$2
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$2;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -83,5 +87,6 @@ ref: ref,

var defaultElement$3 = 'button';
var SuccessButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$3
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$3;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -94,5 +99,6 @@ ref: ref,

var defaultElement$4 = 'button';
var NegativeButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$4
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$4;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -105,5 +111,6 @@ ref: ref,

var defaultElement$5 = 'button';
var TertiaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$5
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$5;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -121,3 +128,3 @@ ref: ref,

return React.createElement(Element, Object.assign({
return React__default.createElement(Element, Object.assign({
className: classNames('eds-button-group', className)

@@ -134,5 +141,5 @@ }, rest));

return React.createElement("button", Object.assign({
return React__default.createElement("button", Object.assign({
className: classNames('eds-floating-button', {
'eds-floating-button--extended': React.Children.count(children) > 1
'eds-floating-button--extended': React__default.Children.count(children) > 1
}, {

@@ -146,4 +153,4 @@ 'eds-floating-button--small': size === 'small'

var wrapStringsInSpans = function wrapStringsInSpans(children) {
return React.Children.map(children, function (child) {
return typeof child === 'string' ? React.createElement("span", null, child) : child;
return React__default.Children.map(children, function (child) {
return typeof child === 'string' ? React__default.createElement("span", null, child) : child;
});

@@ -161,6 +168,7 @@ };

loading = _ref$loading === void 0 ? false : _ref$loading,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "loading"]);
as = _ref.as,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "loading", "as"]);
return React.createElement(utils.Box, Object.assign({
as: defaultElement$6,
var Element = as || defaultElement$6;
return React.createElement(Element, Object.assign({
className: classNames('eds-square-button', {

@@ -193,5 +201,6 @@ 'eds-square-button--success': variant === 'success'

var defaultElement$7 = 'button';
var SecondarySquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(BaseSquareButton, Object.assign({
as: defaultElement$7,
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$7;
return React__default.createElement(BaseSquareButton, Object.assign({
as: Element,
ref: ref

@@ -204,5 +213,6 @@ }, props, {

var defaultElement$8 = 'button';
var SuccessSquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(BaseSquareButton, Object.assign({
as: defaultElement$8,
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$8;
return React__default.createElement(BaseSquareButton, Object.assign({
as: Element,
ref: ref

@@ -215,3 +225,3 @@ }, props, {

var defaultElement$9 = 'button';
var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
var children = _ref.children,

@@ -222,6 +232,7 @@ className = _ref.className,

size = _ref.size,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "disabled", "size"]);
as = _ref.as,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "disabled", "size", "as"]);
return React.createElement(utils.Box, Object.assign({
as: defaultElement$9,
var Element = as || defaultElement$9;
return React__default.createElement(Element, Object.assign({
className: classNames('eds-icon-button', className, {

@@ -228,0 +239,0 @@ 'eds-icon-button--disabled': disabled

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),n=e(require("react")),a=e(require("classnames"));function s(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)t.indexOf(n=r[a])>=0||(s[n]=e[n]);return s}var r=n.forwardRef((function(e,r){var i,o=e.variant,u=e.size,d=void 0===u?"medium":u,c=e.loading,l=e.className,b=e.children,f=e.disabled,m=void 0!==f&&f,g=e.width,v=void 0===g?"auto":g,p=s(e,["variant","size","loading","className","children","disabled","width"]),y=n.Children.toArray(b),N=y.length>1&&"string"!=typeof y[0],h=y.length>1&&"string"!=typeof y[y.length-1];return n.createElement(t.Box,Object.assign({as:"button",className:a("eds-button",(i={},i["eds-button--variant-"+o]=o,i["eds-button--size-"+d]=d,i["eds-button--width-fluid"]="fluid"===v,i["eds-button--loading"]=c,i["eds-button--leading-icon"]=N,i["eds-button--trailing-icon"]=h,i),l),ref:r,"aria-busy":c,disabled:m,"aria-disabled":m},p),c?n.createElement("div",{className:"eds-button__spinner"}):b)})),i=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({as:"button"},e,{ref:t,variant:"primary"}))})),o=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({as:"button"},e,{ref:t,variant:"secondary"}))})),u=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({as:"button"},e,{ref:t,variant:"success"}))})),d=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({as:"button"},e,{ref:t,variant:"negative"}))})),c=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({as:"button"},e,{ref:t,variant:"tertiary"}))})),l=n.forwardRef((function(e,r){var i=e.children,o=e.className,u=e.variant,d=e.disabled,c=void 0!==d&&d,l=e.loading,b=void 0!==l&&l,f=s(e,["children","className","variant","disabled","loading"]);return n.createElement(t.Box,Object.assign({as:"button",className:a("eds-square-button",{"eds-square-button--success":"success"===u},{"eds-square-button--secondary":"secondary"===u},{"eds-square-button--loading":b},o),"aria-busy":b,disabled:c,"aria-disabled":c,ref:r},f),n.Children.map(i,(function(e){return"string"==typeof e?n.createElement("span",{className:"eds-square-button__label"},e):n.createElement("span",{className:"eds-square-button__icon"},b?n.createElement("div",{className:"eds-button__spinner"}):e)})))})),b=n.forwardRef((function(e,t){return n.createElement(l,Object.assign({as:"button",ref:t},e,{variant:"secondary"}))})),f=n.forwardRef((function(e,t){return n.createElement(l,Object.assign({as:"button",ref:t},e,{variant:"success"}))})),m=n.forwardRef((function(e,r){var i=e.children,o=e.className,u=e.disabled,d=void 0!==u&&u,c=e.size,l=s(e,["children","className","disabled","size"]);return n.createElement(t.Box,Object.assign({as:"button",className:a("eds-icon-button",o,{"eds-icon-button--disabled":d},"eds-icon-button--size-"+c),disabled:d,"aria-disabled":d,ref:r},l),i)}));t.warnAboutMissingStyles("button"),exports.Button=r,exports.ButtonGroup=function(e){var t=e.as,r=void 0===t?"div":t,i=e.className,o=s(e,["as","className"]);return n.createElement(r,Object.assign({className:a("eds-button-group",i)},o))},exports.FloatingButton=function(e){var t=e.className,r=e.children,i=e.size,o=void 0===i?"medium":i,u=s(e,["className","children","size"]);return n.createElement("button",Object.assign({className:a("eds-floating-button",{"eds-floating-button--extended":n.Children.count(r)>1},{"eds-floating-button--small":"small"===o},t),type:"button"},u),function(e){return n.Children.map(e,(function(e){return"string"==typeof e?n.createElement("span",null,e):e}))}(r))},exports.IconButton=m,exports.NegativeButton=d,exports.PrimaryButton=i,exports.SecondaryButton=o,exports.SecondarySquareButton=b,exports.SuccessButton=u,exports.SuccessSquareButton=f,exports.TertiaryButton=c;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),a=require("react"),n=e(a),s=e(require("classnames"));function r(e,t){if(null==e)return{};var a,n,s={},r=Object.keys(e);for(n=0;n<r.length;n++)t.indexOf(a=r[n])>=0||(s[a]=e[a]);return s}var i=a.forwardRef((function(e,t){var n,i=e.as,o=e.variant,u=e.size,d=void 0===u?"medium":u,c=e.loading,l=e.className,b=e.children,f=e.disabled,m=void 0!==f&&f,g=e.width,v=void 0===g?"auto":g,p=r(e,["as","variant","size","loading","className","children","disabled","width"]),y=i||"button",N=a.Children.toArray(b),h=N.length>1&&"string"!=typeof N[0],E=N.length>1&&"string"!=typeof N[N.length-1];return a.createElement(y,Object.assign({className:s("eds-button",(n={},n["eds-button--variant-"+o]=o,n["eds-button--size-"+d]=d,n["eds-button--width-fluid"]="fluid"===v,n["eds-button--loading"]=c,n["eds-button--leading-icon"]=h,n["eds-button--trailing-icon"]=E,n),l),ref:t,"aria-busy":c,disabled:m,"aria-disabled":m},p),c?a.createElement("div",{className:"eds-button__spinner"}):b)})),o=n.forwardRef((function(e,t){return n.createElement(i,Object.assign({as:e.as||"button"},e,{ref:t,variant:"primary"}))})),u=n.forwardRef((function(e,t){return n.createElement(i,Object.assign({as:e.as||"button"},e,{ref:t,variant:"secondary"}))})),d=n.forwardRef((function(e,t){return n.createElement(i,Object.assign({as:e.as||"button"},e,{ref:t,variant:"success"}))})),c=n.forwardRef((function(e,t){return n.createElement(i,Object.assign({as:e.as||"button"},e,{ref:t,variant:"negative"}))})),l=n.forwardRef((function(e,t){return n.createElement(i,Object.assign({as:e.as||"button"},e,{ref:t,variant:"tertiary"}))})),b=a.forwardRef((function(e,t){var n=e.children,i=e.className,o=e.variant,u=e.disabled,d=void 0!==u&&u,c=e.loading,l=void 0!==c&&c,b=e.as,f=r(e,["children","className","variant","disabled","loading","as"]);return a.createElement(b||"button",Object.assign({className:s("eds-square-button",{"eds-square-button--success":"success"===o},{"eds-square-button--secondary":"secondary"===o},{"eds-square-button--loading":l},i),"aria-busy":l,disabled:d,"aria-disabled":d,ref:t},f),a.Children.map(n,(function(e){return"string"==typeof e?a.createElement("span",{className:"eds-square-button__label"},e):a.createElement("span",{className:"eds-square-button__icon"},l?a.createElement("div",{className:"eds-button__spinner"}):e)})))})),f=n.forwardRef((function(e,t){return n.createElement(b,Object.assign({as:e.as||"button",ref:t},e,{variant:"secondary"}))})),m=n.forwardRef((function(e,t){return n.createElement(b,Object.assign({as:e.as||"button",ref:t},e,{variant:"success"}))})),g=n.forwardRef((function(e,t){var a=e.children,i=e.className,o=e.disabled,u=void 0!==o&&o,d=e.size,c=e.as,l=r(e,["children","className","disabled","size","as"]);return n.createElement(c||"button",Object.assign({className:s("eds-icon-button",i,{"eds-icon-button--disabled":u},"eds-icon-button--size-"+d),disabled:u,"aria-disabled":u,ref:t},l),a)}));t.warnAboutMissingStyles("button"),exports.Button=i,exports.ButtonGroup=function(e){var t=e.as,a=void 0===t?"div":t,i=e.className,o=r(e,["as","className"]);return n.createElement(a,Object.assign({className:s("eds-button-group",i)},o))},exports.FloatingButton=function(e){var t=e.className,a=e.children,i=e.size,o=void 0===i?"medium":i,u=r(e,["className","children","size"]);return n.createElement("button",Object.assign({className:s("eds-floating-button",{"eds-floating-button--extended":n.Children.count(a)>1},{"eds-floating-button--small":"small"===o},t),type:"button"},u),function(e){return n.Children.map(e,(function(e){return"string"==typeof e?n.createElement("span",null,e):e}))}(a))},exports.IconButton=g,exports.NegativeButton=c,exports.PrimaryButton=o,exports.SecondaryButton=u,exports.SecondarySquareButton=f,exports.SuccessButton=d,exports.SuccessSquareButton=m,exports.TertiaryButton=l;
//# sourceMappingURL=button.cjs.production.min.js.map

@@ -1,3 +0,3 @@

import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import * as React from 'react';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
import './Button.scss';

@@ -29,5 +29,5 @@ import './LoadingSpinner.scss';

};
export declare type ButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, ButtonBaseProps>;
declare const defaultElement = "button";
export declare const Button: <E extends React.ElementType = typeof defaultElement>(props: ButtonProps<E>) => React.ReactElement | null;
export declare type ButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<ButtonBaseProps, T>;
export declare const Button: PolymorphicForwardRefExoticComponent<ButtonBaseProps, typeof defaultElement>;
export {};

@@ -1,3 +0,3 @@

import { Box, warnAboutMissingStyles } from '@entur/utils';
import React from 'react';
import { warnAboutMissingStyles } from '@entur/utils';
import React__default, { forwardRef, Children, createElement } from 'react';
import classNames from 'classnames';

@@ -21,6 +21,7 @@

var defaultElement = 'button';
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
var _cx;
var variant = _ref.variant,
var as = _ref.as,
variant = _ref.variant,
_ref$size = _ref.size,

@@ -35,9 +36,9 @@ size = _ref$size === void 0 ? 'medium' : _ref$size,

width = _ref$width === void 0 ? 'auto' : _ref$width,
rest = _objectWithoutPropertiesLoose(_ref, ["variant", "size", "loading", "className", "children", "disabled", "width"]);
rest = _objectWithoutPropertiesLoose(_ref, ["as", "variant", "size", "loading", "className", "children", "disabled", "width"]);
var childrenArray = React.Children.toArray(children);
var Element = as || defaultElement;
var childrenArray = Children.toArray(children);
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
return React.createElement(Box, Object.assign({
as: defaultElement,
return createElement(Element, Object.assign({
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),

@@ -48,3 +49,3 @@ ref: ref,

"aria-disabled": disabled
}, rest), loading ? React.createElement("div", {
}, rest), loading ? createElement("div", {
className: "eds-button__spinner"

@@ -55,5 +56,6 @@ }) : children);

var defaultElement$1 = 'button';
var PrimaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$1
var PrimaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$1;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -66,5 +68,6 @@ ref: ref,

var defaultElement$2 = 'button';
var SecondaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$2
var SecondaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$2;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -77,5 +80,6 @@ ref: ref,

var defaultElement$3 = 'button';
var SuccessButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$3
var SuccessButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$3;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -88,5 +92,6 @@ ref: ref,

var defaultElement$4 = 'button';
var NegativeButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$4
var NegativeButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$4;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -99,5 +104,6 @@ ref: ref,

var defaultElement$5 = 'button';
var TertiaryButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(Button, Object.assign({
as: defaultElement$5
var TertiaryButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$5;
return React__default.createElement(Button, Object.assign({
as: Element
}, props, {

@@ -115,3 +121,3 @@ ref: ref,

return React.createElement(Element, Object.assign({
return React__default.createElement(Element, Object.assign({
className: classNames('eds-button-group', className)

@@ -128,5 +134,5 @@ }, rest));

return React.createElement("button", Object.assign({
return React__default.createElement("button", Object.assign({
className: classNames('eds-floating-button', {
'eds-floating-button--extended': React.Children.count(children) > 1
'eds-floating-button--extended': React__default.Children.count(children) > 1
}, {

@@ -140,4 +146,4 @@ 'eds-floating-button--small': size === 'small'

var wrapStringsInSpans = function wrapStringsInSpans(children) {
return React.Children.map(children, function (child) {
return typeof child === 'string' ? React.createElement("span", null, child) : child;
return React__default.Children.map(children, function (child) {
return typeof child === 'string' ? React__default.createElement("span", null, child) : child;
});

@@ -147,3 +153,3 @@ };

var defaultElement$6 = 'button';
var BaseSquareButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var BaseSquareButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
var children = _ref.children,

@@ -156,6 +162,7 @@ className = _ref.className,

loading = _ref$loading === void 0 ? false : _ref$loading,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "loading"]);
as = _ref.as,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "loading", "as"]);
return React.createElement(Box, Object.assign({
as: defaultElement$6,
var Element = as || defaultElement$6;
return createElement(Element, Object.assign({
className: classNames('eds-square-button', {

@@ -172,5 +179,5 @@ 'eds-square-button--success': variant === 'success'

ref: ref
}, rest), React.Children.map(children, function (child) {
}, rest), Children.map(children, function (child) {
if (typeof child === 'string') {
return React.createElement("span", {
return createElement("span", {
className: "eds-square-button__label"

@@ -180,5 +187,5 @@ }, child);

return React.createElement("span", {
return createElement("span", {
className: "eds-square-button__icon"
}, loading ? React.createElement("div", {
}, loading ? createElement("div", {
className: "eds-button__spinner"

@@ -190,5 +197,6 @@ }) : child);

var defaultElement$7 = 'button';
var SecondarySquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(BaseSquareButton, Object.assign({
as: defaultElement$7,
var SecondarySquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$7;
return React__default.createElement(BaseSquareButton, Object.assign({
as: Element,
ref: ref

@@ -201,5 +209,6 @@ }, props, {

var defaultElement$8 = 'button';
var SuccessSquareButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
return React.createElement(BaseSquareButton, Object.assign({
as: defaultElement$8,
var SuccessSquareButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
var Element = props.as || defaultElement$8;
return React__default.createElement(BaseSquareButton, Object.assign({
as: Element,
ref: ref

@@ -212,3 +221,3 @@ }, props, {

var defaultElement$9 = 'button';
var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var IconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
var children = _ref.children,

@@ -219,6 +228,7 @@ className = _ref.className,

size = _ref.size,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "disabled", "size"]);
as = _ref.as,
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "disabled", "size", "as"]);
return React.createElement(Box, Object.assign({
as: defaultElement$9,
var Element = as || defaultElement$9;
return React__default.createElement(Element, Object.assign({
className: classNames('eds-icon-button', className, {

@@ -225,0 +235,0 @@ 'eds-icon-button--disabled': disabled

import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
import './IconButton.scss';

@@ -23,4 +23,4 @@ export declare type IconButtonBaseProps = {

declare const defaultElement = "button";
export declare type IconButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, IconButtonBaseProps>;
export declare const IconButton: <E extends React.ElementType = typeof defaultElement>(props: IconButtonProps<E>) => React.ReactElement | null;
export declare type IconButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<IconButtonBaseProps, E>;
export declare const IconButton: PolymorphicForwardRefExoticComponent<IconButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicPropsWithRef, PolymorphicForwardRefExoticComponent } from '@entur/utils';
export declare type NegativeButtonBaseProps = {

@@ -24,6 +24,7 @@ /** Størrelsen på knappen

children: React.ReactNode;
as?: 'button' | React.ElementType;
};
export declare type NegativeButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, NegativeButtonBaseProps>;
export declare type NegativeButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<NegativeButtonBaseProps, T>;
declare const defaultElement = "button";
export declare const NegativeButton: <E extends React.ElementType = typeof defaultElement>(props: NegativeButtonProps<E>) => React.ReactElement | null;
export declare const NegativeButton: PolymorphicForwardRefExoticComponent<NegativeButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
export declare type PrimaryButtonBaseProps = {

@@ -25,5 +25,5 @@ /** Størrelsen på knappen

};
export declare type PrimaryButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, PrimaryButtonBaseProps>;
export declare type PrimaryButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<PrimaryButtonBaseProps, T>;
declare const defaultElement = "button";
export declare const PrimaryButton: <E extends React.ElementType = typeof defaultElement>(props: PrimaryButtonProps<E>) => React.ReactElement | null;
export declare const PrimaryButton: PolymorphicForwardRefExoticComponent<PrimaryButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
export declare type SecondaryButtonBaseProps = {

@@ -25,5 +25,5 @@ /** Størrelsen på knappen

};
export declare type SecondaryButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, SecondaryButtonBaseProps>;
export declare type SecondaryButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<SecondaryButtonBaseProps, T>;
declare const defaultElement = "button";
export declare const SecondaryButton: <E extends React.ElementType = typeof defaultElement>(props: SecondaryButtonProps<E>) => React.ReactElement | null;
export declare const SecondaryButton: PolymorphicForwardRefExoticComponent<SecondaryButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
declare type SecondarySquareButtonBaseProps = {
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
export declare type SecondarySquareButtonBaseProps = {
/** Tekst og ikon, ikon og tekst, eller bare ikon */

@@ -17,5 +17,5 @@ children: React.ReactNode;

};
export declare type SecondarySquareButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, SecondarySquareButtonBaseProps>;
export declare type SecondarySquareButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<SecondarySquareButtonBaseProps, E>;
declare const defaultElement = "button";
export declare const SecondarySquareButton: <E extends React.ElementType = typeof defaultElement>(props: SecondarySquareButtonProps<E>) => React.ReactElement | null;
export declare const SecondarySquareButton: PolymorphicForwardRefExoticComponent<SecondarySquareButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
declare type SuccessButtonBaseProps = {

@@ -25,5 +25,5 @@ /** Størrelsen på knappen

};
export declare type SuccessButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, SuccessButtonBaseProps>;
export declare type SuccessButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<SuccessButtonBaseProps, E>;
declare const defaultElement = "button";
export declare const SuccessButton: <E extends React.ElementType = typeof defaultElement>(props: SuccessButtonProps<E>) => React.ReactElement | null;
export declare const SuccessButton: PolymorphicForwardRefExoticComponent<SuccessButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicForwardRefExoticComponent, PolymorphicPropsWithRef } from '@entur/utils';
declare type SuccessSquareButtonBaseProps = {

@@ -17,5 +17,5 @@ /** Tekst og ikon, ikon og tekst, eller bare ikon */

};
export declare type SuccessSquareButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, SuccessSquareButtonBaseProps>;
export declare type SuccessSquareButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<SuccessSquareButtonBaseProps, E>;
declare const defaultElement = "button";
export declare const SuccessSquareButton: <E extends React.ElementType = typeof defaultElement>(props: SuccessSquareButtonProps<E>) => React.ReactElement | null;
export declare const SuccessSquareButton: PolymorphicForwardRefExoticComponent<SuccessSquareButtonBaseProps, typeof defaultElement>;
export {};
import React from 'react';
import { PolymorphicComponentProps } from '@entur/utils';
import { PolymorphicPropsWithRef, PolymorphicForwardRefExoticComponent } from '@entur/utils';
export declare type TertiaryButtonBaseProps = {

@@ -13,5 +13,5 @@ /** Ekstra klassenavn */

};
export declare type TertiaryButtonProps<E extends React.ElementType> = PolymorphicComponentProps<E, TertiaryButtonBaseProps>;
export declare type TertiaryButtonProps<E extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithRef<TertiaryButtonBaseProps, E>;
declare const defaultElement = "button";
export declare const TertiaryButton: <E extends React.ElementType = typeof defaultElement>(props: TertiaryButtonProps<E>) => React.ReactElement | null;
export declare const TertiaryButton: PolymorphicForwardRefExoticComponent<TertiaryButtonBaseProps, typeof defaultElement>;
export {};
{
"name": "@entur/button",
"version": "2.5.0",
"version": "2.5.1",
"license": "EUPL-1.2",

@@ -30,3 +30,3 @@ "main": "dist/index.js",

"dependencies": {
"@entur/utils": "^0.4.0",
"@entur/utils": "^0.4.1",
"classnames": "^2.2.6"

@@ -37,3 +37,3 @@ },

},
"gitHead": "962f9ba2636854b89184db216ccf180ca818852b"
"gitHead": "5d8ff0f845ac9b78a53760040c6dc4c84be612c2"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc