New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tds/core-button-group

Package Overview
Dependencies
Maintainers
8
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tds/core-button-group - npm Package Compare versions

Comparing version 1.0.17 to 2.0.0

2

__tests__/ButtonGroup.spec.jsx

@@ -36,3 +36,3 @@ import React from 'react'

it('renders', () => {
const buttonGroup = doShallow()
const buttonGroup = doMount()

@@ -39,0 +39,0 @@ expect(buttonGroup).toMatchSnapshot()

@@ -8,2 +8,3 @@ import React from 'react'

import styled from 'styled-components'
import ButtonGroupItem from './ButtonGroupItem/ButtonGroupItem'

@@ -14,3 +15,6 @@

import styles from './ButtonGroup.modules.scss'
const StyledButtonGroup = styled(Box)({
flexFlow: 'row wrap',
maxWidth: '784px',
})

@@ -43,2 +47,3 @@ /**

}
return (

@@ -52,5 +57,5 @@ <fieldset {...safeRest(rest)} name={name}>

<Box between={3} inline className={styles.buttonGroup}>
<StyledButtonGroup between={3} inline>
{passedButtons}
</Box>
</StyledButtonGroup>
</fieldset>

@@ -57,0 +62,0 @@ )

@@ -6,7 +6,66 @@ import React from 'react'

import styled from 'styled-components'
import { borders, forms } from '@tds/shared-styles'
import { medium, boldFont } from '@tds/shared-typography'
import { media } from '@tds/core-responsive'
import { colorTelusPurple, colorWhite } from '@tds/core-colours'
import generateId from '../../../shared/utils/generateId/generateId'
import safeRest from '../../../shared/utils/safeRest'
import generateId from '../../../shared/utils/generateId/generateId'
import styles from './ButtonGroupItem.modules.scss'
const baseButton = {
margin: 0,
padding: '0 2rem',
cursor: 'pointer',
background: 'none',
transition: 'background 0.2s',
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'center',
...media.from('md').css({
display: 'inline-flex',
width: 'auto',
minWidth: '136px',
}),
}
const StyledButtonGroupItem = styled.div({
margin: '0.5rem 0',
})
const StyledInput = styled.input({
position: 'fixed',
opacity: '0',
'&:checked ~ label': {
backgroundColor: colorTelusPurple,
boxShadow: `0px 0px 0px 0px ${colorTelusPurple}`,
color: colorWhite,
},
'&:focus ~ label': {
boxShadow: `0px 0px 0px 2px ${colorTelusPurple}, 0px 0px 8px 1px ${colorTelusPurple}`,
},
})
const StyledLabel = styled.label(
borders.none,
borders.rounded,
medium,
boldFont,
forms.height,
forms.font,
baseButton,
{
transition: 'background 0.2s, color 0.2s, box-shadow 0.2s',
backgroundColor: colorWhite,
boxShadow: `0px 0px 0px 1px ${colorTelusPurple}`,
color: colorTelusPurple,
whiteSpace: 'nowrap',
minWidth: '136px',
'&:hover': {
backgroundColor: colorWhite,
color: colorTelusPurple,
boxShadow: `0px 0px 0px 2px ${colorTelusPurple}, 0px 0px 8px 1px ${colorTelusPurple}`,
},
}
)
const ButtonGroupItem = ({

@@ -24,4 +83,4 @@ name,

return (
<div {...safeRest(rest)} className={styles.itemContainer}>
<input
<StyledButtonGroupItem {...safeRest(rest)}>
<StyledInput
id={itemId}

@@ -35,8 +94,5 @@ name={name}

onBlur={onBlur}
className={styles.hiddenRadio}
/>
<label htmlFor={itemId} className={styles.itemButton}>
{children}
</label>
</div>
<StyledLabel htmlFor={itemId}>{children}</StyledLabel>
</StyledButtonGroupItem>
)

@@ -43,0 +99,0 @@ }

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

# [2.0.0](https://github.com/telusdigital/tds-core/compare/@tds/core-button-group@1.0.17...@tds/core-button-group@2.0.0) (2019-05-06)
### Features
* **core-button-group:** upgrade to styled components ([5f358fd](https://github.com/telusdigital/tds-core/commit/5f358fd))
### BREAKING CHANGES
* **core-button-group:** styled components 4.1.3 and react 16.8.2 are peer dependencies
## [1.0.17](https://github.com/telusdigital/tds-core/compare/@tds/core-button-group@1.0.16...@tds/core-button-group@1.0.17) (2019-05-01)

@@ -8,0 +24,0 @@

@@ -10,2 +10,6 @@ 'use strict';

var utilPropTypes = require('@tds/util-prop-types');
var styled = _interopDefault(require('styled-components'));
var sharedStyles = require('@tds/shared-styles');
var sharedTypography = require('@tds/shared-typography');
var coreResponsive = require('@tds/core-responsive');

@@ -76,11 +80,6 @@ function createCommonjsModule(fn, module) {

var safeRest = (function (_ref) {
var style = _ref.style,
className = _ref.className,
as = _ref.as,
props = objectWithoutProperties(_ref, ["style", "className", "as"]);
// colours
var colorTelusPurple = '#4b286d';
var colorWhite = '#fff';
return props;
});
function find(t,n,r){if("function"==typeof Array.prototype.find)return t.find(n,r);r=r||this;var f=t.length;if("function"!=typeof n)throw new TypeError(n+" is not a function");for(var o=0;o<f;o++)if(n.call(r,t[o],o,t))return t[o]}

@@ -110,4 +109,65 @@

var styles = {"itemContainer":"TDS_ButtonGroupItem-modules__itemContainer___3a5w6","itemButton":"TDS_ButtonGroupItem-modules__itemButton___31uOH TDS_BaseButton-modules__sizing___2kf7G TDS_BaseButton-modules__base___61gnI TDS_BaseButton-modules__wordBreak___1qfBE TDS_Borders-modules__none___1fCjZ TDS_Borders-modules__rounded___3df1Q TDS_BaseButton-modules__medium___P82Pj TDS_BaseButton-modules__wordBreak___1qfBE TDS_BaseButton-modules__boldFont___1EFV0 TDS_BaseButton-modules__wordBreak___1qfBE TDS_Forms-modules__height___W6QXx TDS_Forms-modules__font___g7OGX","hiddenRadio":"TDS_ButtonGroupItem-modules__hiddenRadio___2vB96"};
var safeRest = (function (_ref) {
var style = _ref.style,
className = _ref.className,
as = _ref.as,
props = objectWithoutProperties(_ref, ["style", "className", "as"]);
return props;
});
var baseButton = _extends_1({
margin: 0,
padding: '0 2rem',
cursor: 'pointer',
background: 'none',
transition: 'background 0.2s',
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'center'
}, coreResponsive.media.from('md').css({
display: 'inline-flex',
width: 'auto',
minWidth: '136px'
}));
var StyledButtonGroupItem = styled.div.withConfig({
displayName: "ButtonGroupItem__StyledButtonGroupItem",
componentId: "drabnz-0"
})({
margin: '0.5rem 0'
});
var StyledInput = styled.input.withConfig({
displayName: "ButtonGroupItem__StyledInput",
componentId: "drabnz-1"
})({
position: 'fixed',
opacity: '0',
'&:checked ~ label': {
backgroundColor: colorTelusPurple,
boxShadow: "0px 0px 0px 0px ".concat(colorTelusPurple),
color: colorWhite
},
'&:focus ~ label': {
boxShadow: "0px 0px 0px 2px ".concat(colorTelusPurple, ", 0px 0px 8px 1px ").concat(colorTelusPurple)
}
});
var StyledLabel = styled.label.withConfig({
displayName: "ButtonGroupItem__StyledLabel",
componentId: "drabnz-2"
})(sharedStyles.borders.none, sharedStyles.borders.rounded, sharedTypography.medium, sharedTypography.boldFont, sharedStyles.forms.height, sharedStyles.forms.font, baseButton, {
transition: 'background 0.2s, color 0.2s, box-shadow 0.2s',
backgroundColor: colorWhite,
boxShadow: "0px 0px 0px 1px ".concat(colorTelusPurple),
color: colorTelusPurple,
whiteSpace: 'nowrap',
minWidth: '136px',
'&:hover': {
backgroundColor: colorWhite,
color: colorTelusPurple,
boxShadow: "0px 0px 0px 2px ".concat(colorTelusPurple, ", 0px 0px 8px 1px ").concat(colorTelusPurple)
}
});
var ButtonGroupItem = function ButtonGroupItem(_ref) {

@@ -124,5 +184,3 @@ var name = _ref.name,

var itemId = generateId(name).postfix(value);
return React.createElement("div", _extends_1({}, safeRest(rest), {
className: styles.itemContainer
}), React.createElement("input", {
return React.createElement(StyledButtonGroupItem, safeRest(rest), React.createElement(StyledInput, {
id: itemId,

@@ -135,7 +193,5 @@ name: name,

onFocus: onFocus,
onBlur: onBlur,
className: styles.hiddenRadio
}), React.createElement("label", {
htmlFor: itemId,
className: styles.itemButton
onBlur: onBlur
}), React.createElement(StyledLabel, {
htmlFor: itemId
}, children));

@@ -208,4 +264,6 @@ };

var styles$1 = {"buttonGroup":"TDS_ButtonGroup-modules__buttonGroup___2jYkO"};
var StyledButtonGroup = styled(Box)({
flexFlow: 'row wrap',
maxWidth: '784px'
});
/**

@@ -249,6 +307,5 @@ * An input component utilizing buttons that act as radios.

size: "medium"
}, label)), React.createElement(Box, {
}, label)), React.createElement(StyledButtonGroup, {
between: 3,
inline: true,
className: styles$1.buttonGroup
inline: true
}, passedButtons));

@@ -255,0 +312,0 @@ };

@@ -6,2 +6,6 @@ import React from 'react';

import { or, componentWithName } from '@tds/util-prop-types';
import styled from 'styled-components';
import { borders, forms } from '@tds/shared-styles';
import { medium, boldFont } from '@tds/shared-typography';
import { media } from '@tds/core-responsive';

@@ -72,11 +76,6 @@ function createCommonjsModule(fn, module) {

var safeRest = (function (_ref) {
var style = _ref.style,
className = _ref.className,
as = _ref.as,
props = objectWithoutProperties(_ref, ["style", "className", "as"]);
// colours
var colorTelusPurple = '#4b286d';
var colorWhite = '#fff';
return props;
});
function find(t,n,r){if("function"==typeof Array.prototype.find)return t.find(n,r);r=r||this;var f=t.length;if("function"!=typeof n)throw new TypeError(n+" is not a function");for(var o=0;o<f;o++)if(n.call(r,t[o],o,t))return t[o]}

@@ -106,4 +105,65 @@

var styles = {"itemContainer":"TDS_ButtonGroupItem-modules__itemContainer___3a5w6","itemButton":"TDS_ButtonGroupItem-modules__itemButton___31uOH TDS_BaseButton-modules__sizing___2kf7G TDS_BaseButton-modules__base___61gnI TDS_BaseButton-modules__wordBreak___1qfBE TDS_Borders-modules__none___1fCjZ TDS_Borders-modules__rounded___3df1Q TDS_BaseButton-modules__medium___P82Pj TDS_BaseButton-modules__wordBreak___1qfBE TDS_BaseButton-modules__boldFont___1EFV0 TDS_BaseButton-modules__wordBreak___1qfBE TDS_Forms-modules__height___W6QXx TDS_Forms-modules__font___g7OGX","hiddenRadio":"TDS_ButtonGroupItem-modules__hiddenRadio___2vB96"};
var safeRest = (function (_ref) {
var style = _ref.style,
className = _ref.className,
as = _ref.as,
props = objectWithoutProperties(_ref, ["style", "className", "as"]);
return props;
});
var baseButton = _extends_1({
margin: 0,
padding: '0 2rem',
cursor: 'pointer',
background: 'none',
transition: 'background 0.2s',
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'center'
}, media.from('md').css({
display: 'inline-flex',
width: 'auto',
minWidth: '136px'
}));
var StyledButtonGroupItem = styled.div.withConfig({
displayName: "ButtonGroupItem__StyledButtonGroupItem",
componentId: "drabnz-0"
})({
margin: '0.5rem 0'
});
var StyledInput = styled.input.withConfig({
displayName: "ButtonGroupItem__StyledInput",
componentId: "drabnz-1"
})({
position: 'fixed',
opacity: '0',
'&:checked ~ label': {
backgroundColor: colorTelusPurple,
boxShadow: "0px 0px 0px 0px ".concat(colorTelusPurple),
color: colorWhite
},
'&:focus ~ label': {
boxShadow: "0px 0px 0px 2px ".concat(colorTelusPurple, ", 0px 0px 8px 1px ").concat(colorTelusPurple)
}
});
var StyledLabel = styled.label.withConfig({
displayName: "ButtonGroupItem__StyledLabel",
componentId: "drabnz-2"
})(borders.none, borders.rounded, medium, boldFont, forms.height, forms.font, baseButton, {
transition: 'background 0.2s, color 0.2s, box-shadow 0.2s',
backgroundColor: colorWhite,
boxShadow: "0px 0px 0px 1px ".concat(colorTelusPurple),
color: colorTelusPurple,
whiteSpace: 'nowrap',
minWidth: '136px',
'&:hover': {
backgroundColor: colorWhite,
color: colorTelusPurple,
boxShadow: "0px 0px 0px 2px ".concat(colorTelusPurple, ", 0px 0px 8px 1px ").concat(colorTelusPurple)
}
});
var ButtonGroupItem = function ButtonGroupItem(_ref) {

@@ -120,5 +180,3 @@ var name = _ref.name,

var itemId = generateId(name).postfix(value);
return React.createElement("div", _extends_1({}, safeRest(rest), {
className: styles.itemContainer
}), React.createElement("input", {
return React.createElement(StyledButtonGroupItem, safeRest(rest), React.createElement(StyledInput, {
id: itemId,

@@ -131,7 +189,5 @@ name: name,

onFocus: onFocus,
onBlur: onBlur,
className: styles.hiddenRadio
}), React.createElement("label", {
htmlFor: itemId,
className: styles.itemButton
onBlur: onBlur
}), React.createElement(StyledLabel, {
htmlFor: itemId
}, children));

@@ -204,4 +260,6 @@ };

var styles$1 = {"buttonGroup":"TDS_ButtonGroup-modules__buttonGroup___2jYkO"};
var StyledButtonGroup = styled(Box)({
flexFlow: 'row wrap',
maxWidth: '784px'
});
/**

@@ -245,6 +303,5 @@ * An input component utilizing buttons that act as radios.

size: "medium"
}, label)), React.createElement(Box, {
}, label)), React.createElement(StyledButtonGroup, {
between: 3,
inline: true,
className: styles$1.buttonGroup
inline: true
}, passedButtons));

@@ -251,0 +308,0 @@ };

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

require('./dist/index.css')
const ButtonGroup = require('./dist/index.cjs')
module.exports = ButtonGroup

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

import './dist/index.css'
import ButtonGroup from './dist/index.es'
export default ButtonGroup
{
"name": "@tds/core-button-group",
"version": "1.0.17",
"version": "2.0.0",
"description": "An input component utilizing buttons that act as radios.",

@@ -24,8 +24,12 @@ "main": "index.cjs.js",

"peerDependencies": {
"react": ">=15",
"react-dom": ">=15"
"react": "^16.8.2",
"react-dom": "^16.8.2",
"styled-components": "^4.1.3"
},
"dependencies": {
"@tds/core-box": "^1.2.3",
"@tds/core-responsive": "^1.2.0",
"@tds/core-text": "^1.0.11",
"@tds/shared-styles": "^1.0.1",
"@tds/shared-typography": "^1.2.2",
"@tds/util-prop-types": "^1.3.1",

@@ -39,3 +43,3 @@ "prop-types": "^15.5.10"

},
"gitHead": "24679ca1369e64d054bf825ab56b54cbb38180b4"
"gitHead": "9a6257afa04405b207017dd9fa32a2452aa03a51"
}

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