@govuk-react/lib
Advanced tools
Comparing version 0.8.0 to 0.9.0
var _printFriendly; | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_links.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_links.scss | ||
import { FOCUSABLE_FILL, MEDIA_QUERIES } from '@govuk-react/constants'; | ||
@@ -6,0 +6,0 @@ import { BLACK // in lieu of a FOCUS_TEXT_COLOUR... |
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_shape-arrow.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_shape-arrow.scss | ||
var root3 = 1.732; // Math.sqrt(3); | ||
@@ -6,0 +6,0 @@ |
@@ -0,7 +1,9 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
// This lib is effectively a port of govuk-frontend's spacing sass helpers | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_spacing.scss | ||
// Further references: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/overrides/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/settings/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/overrides/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/settings/_spacing.scss | ||
import PropTypes from 'prop-types'; | ||
@@ -28,3 +30,3 @@ import { MEDIA_QUERIES, SPACING_MAP, SPACING_MAP_INDEX, SPACING_POINTS, WIDTHS } from '@govuk-react/constants'; | ||
export function responsive(_temp) { | ||
var _Object$assign; | ||
var _extends2; | ||
@@ -61,3 +63,3 @@ var _ref2 = _temp === void 0 ? {} : _temp, | ||
return Object.assign({}, styleForDirection(scale.mobile * polarity + adjustment, property, direction), (_Object$assign = {}, _Object$assign[MEDIA_QUERIES.TABLET] = styleForDirection(scale.tablet * polarity + adjustment, property, direction), _Object$assign)); | ||
return _extends({}, styleForDirection(scale.mobile * polarity + adjustment, property, direction), (_extends2 = {}, _extends2[MEDIA_QUERIES.TABLET] = styleForDirection(scale.tablet * polarity + adjustment, property, direction), _extends2)); | ||
} | ||
@@ -64,0 +66,0 @@ export function responsiveMargin(value) { |
var _textColour; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
// This lib is effectively a port of govuk-frontend's typography sass helpers | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_typography.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_typography.scss | ||
import { FONT_STACK, FONT_STACK_PRINT, FONT_STACK_TABULAR, FONT_WEIGHTS, MEDIA_QUERIES, TYPOGRAPHY_SCALE } from '@govuk-react/constants'; | ||
@@ -42,3 +44,3 @@ import { BLACK } from 'govuk-colours'; | ||
export function responsive(size, overrideLineHeight) { | ||
var _Object$assign; | ||
var _extends2; | ||
@@ -51,3 +53,3 @@ var scale = TYPOGRAPHY_SCALE[size]; | ||
return Object.assign({}, getSizeStyle(scale.mobile, overrideLineHeight), (_Object$assign = {}, _Object$assign[MEDIA_QUERIES.TABLET] = getSizeStyle(scale.tablet, overrideLineHeight), _Object$assign[MEDIA_QUERIES.PRINT] = getSizeStyle(scale.print, overrideLineHeight), _Object$assign)); | ||
return _extends({}, getSizeStyle(scale.mobile, overrideLineHeight), (_extends2 = {}, _extends2[MEDIA_QUERIES.TABLET] = getSizeStyle(scale.tablet, overrideLineHeight), _extends2[MEDIA_QUERIES.PRINT] = getSizeStyle(scale.print, overrideLineHeight), _extends2)); | ||
} | ||
@@ -63,3 +65,3 @@ export function font(_temp) { | ||
return Object.assign({}, common(tabular ? FONT_STACK_TABULAR : undefined), FONT_WEIGHTS[weight] ? { | ||
return _extends({}, common(tabular ? FONT_STACK_TABULAR : undefined), FONT_WEIGHTS[weight] ? { | ||
fontWeight: FONT_WEIGHTS[weight] | ||
@@ -66,0 +68,0 @@ } : undefined, size ? responsive(size, lineHeight) : undefined); |
@@ -0,1 +1,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import { FONT_STACK, FONT_STACK_PRINT, FONT_STACK_TABULAR, FONT_WEIGHTS, MEDIA_QUERIES, TYPOGRAPHY_SCALE } from '@govuk-react/constants'; | ||
@@ -68,3 +70,3 @@ import * as typography from '.'; | ||
var style = typography.font(); | ||
expect(style).toEqual(Object.assign({}, typography.common(), { | ||
expect(style).toEqual(_extends({}, typography.common(), { | ||
fontWeight: FONT_WEIGHTS.regular | ||
@@ -71,0 +73,0 @@ })); |
@@ -0,4 +1,6 @@ |
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } |
// This lib is effectively a port of govuk-frontend's visually-hidden sass helpers |
// Tracking: |
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_visually-hidden.scss |
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_visually-hidden.scss |
function visuallyHidden(_temp) { |
@@ -12,3 +14,3 @@ var _ref = _temp === void 0 ? {} : _temp, |
var important = isImportant ? ' !important' : ''; |
return Object.assign({}, { |
return _extends({ |
position: "absolute" + important, |
@@ -15,0 +17,0 @@ width: "1px" + important, |
@@ -9,3 +9,3 @@ "use strict"; | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_shape-arrow.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_shape-arrow.scss | ||
var root3 = 1.732; // Math.sqrt(3); | ||
@@ -12,0 +12,0 @@ |
@@ -17,8 +17,4 @@ "use strict"; | ||
// This lib is effectively a port of govuk-frontend's spacing sass helpers | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_spacing.scss | ||
// Further references: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/overrides/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/settings/_spacing.scss | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function simple(size) { | ||
@@ -44,3 +40,3 @@ var scale = _constants.SPACING_POINTS[Math.abs(size)]; | ||
function responsive(_temp) { | ||
var _Object$assign; | ||
var _extends2; | ||
@@ -78,3 +74,3 @@ var _ref2 = _temp === void 0 ? {} : _temp, | ||
return Object.assign({}, styleForDirection(scale.mobile * polarity + adjustment, property, direction), (_Object$assign = {}, _Object$assign[_constants.MEDIA_QUERIES.TABLET] = styleForDirection(scale.tablet * polarity + adjustment, property, direction), _Object$assign)); | ||
return _extends({}, styleForDirection(scale.mobile * polarity + adjustment, property, direction), (_extends2 = {}, _extends2[_constants.MEDIA_QUERIES.TABLET] = styleForDirection(scale.tablet * polarity + adjustment, property, direction), _extends2)); | ||
} | ||
@@ -81,0 +77,0 @@ |
@@ -15,2 +15,4 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var textColour = (_textColour = { | ||
@@ -53,3 +55,3 @@ color: _govukColours.BLACK | ||
function responsive(size, overrideLineHeight) { | ||
var _Object$assign; | ||
var _extends2; | ||
@@ -62,3 +64,3 @@ var scale = _constants.TYPOGRAPHY_SCALE[size]; | ||
return Object.assign({}, getSizeStyle(scale.mobile, overrideLineHeight), (_Object$assign = {}, _Object$assign[_constants.MEDIA_QUERIES.TABLET] = getSizeStyle(scale.tablet, overrideLineHeight), _Object$assign[_constants.MEDIA_QUERIES.PRINT] = getSizeStyle(scale.print, overrideLineHeight), _Object$assign)); | ||
return _extends({}, getSizeStyle(scale.mobile, overrideLineHeight), (_extends2 = {}, _extends2[_constants.MEDIA_QUERIES.TABLET] = getSizeStyle(scale.tablet, overrideLineHeight), _extends2[_constants.MEDIA_QUERIES.PRINT] = getSizeStyle(scale.print, overrideLineHeight), _extends2)); | ||
} | ||
@@ -75,3 +77,3 @@ | ||
return Object.assign({}, common(tabular ? _constants.FONT_STACK_TABULAR : undefined), _constants.FONT_WEIGHTS[weight] ? { | ||
return _extends({}, common(tabular ? _constants.FONT_STACK_TABULAR : undefined), _constants.FONT_WEIGHTS[weight] ? { | ||
fontWeight: _constants.FONT_WEIGHTS[weight] | ||
@@ -78,0 +80,0 @@ } : undefined, size ? responsive(size, lineHeight) : undefined); |
@@ -11,2 +11,4 @@ "use strict"; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
describe('typography lib', function () { | ||
@@ -77,3 +79,3 @@ it('includes textColour', function () { | ||
var style = typography.font(); | ||
expect(style).toEqual(Object.assign({}, typography.common(), { | ||
expect(style).toEqual(_extends({}, typography.common(), { | ||
fontWeight: _constants.FONT_WEIGHTS.regular | ||
@@ -80,0 +82,0 @@ })); |
@@ -7,5 +7,7 @@ "use strict"; |
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } |
// This lib is effectively a port of govuk-frontend's visually-hidden sass helpers |
// Tracking: |
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_visually-hidden.scss |
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_visually-hidden.scss |
function visuallyHidden(_temp) { |
@@ -19,3 +21,3 @@ var _ref = _temp === void 0 ? {} : _temp, |
var important = isImportant ? ' !important' : ''; |
return Object.assign({}, { |
return _extends({ |
position: "absolute" + important, |
@@ -22,0 +24,0 @@ width: "1px" + important, |
{ | ||
"name": "@govuk-react/lib", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.8.0", | ||
"@govuk-react/constants": "^0.9.0", | ||
"govuk-colours": "^1.1.0" | ||
@@ -7,0 +7,0 @@ }, |
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_links.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_links.scss | ||
import { FOCUSABLE_FILL, MEDIA_QUERIES } from '@govuk-react/constants'; | ||
@@ -4,0 +4,0 @@ import { |
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_shape-arrow.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_shape-arrow.scss | ||
const root3 = 1.732; // Math.sqrt(3); | ||
@@ -4,0 +4,0 @@ |
@@ -12,3 +12,3 @@ import * as shape from '.'; | ||
it('returns styles for an arrow for up/down/left/right directions', () => { | ||
directions.forEach(direction => { | ||
directions.forEach((direction) => { | ||
expect(shape.arrow({ direction })).toBeTruthy(); | ||
@@ -15,0 +15,0 @@ }); |
// This lib is effectively a port of govuk-frontend's spacing sass helpers | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_spacing.scss | ||
// Further references: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/overrides/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/settings/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/overrides/_spacing.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/settings/_spacing.scss | ||
@@ -47,7 +47,7 @@ import PropTypes from 'prop-types'; | ||
{}, | ||
...direction.map(dir => styleForDirection(scale.mobile * polarity + adjustment, property, dir)), | ||
...direction.map((dir) => styleForDirection(scale.mobile * polarity + adjustment, property, dir)), | ||
{ | ||
[MEDIA_QUERIES.TABLET]: Object.assign( | ||
{}, | ||
...direction.map(dir => styleForDirection(scale.tablet * polarity + adjustment, property, dir)) | ||
...direction.map((dir) => styleForDirection(scale.tablet * polarity + adjustment, property, dir)) | ||
), | ||
@@ -58,5 +58,6 @@ } | ||
return Object.assign({}, styleForDirection(scale.mobile * polarity + adjustment, property, direction), { | ||
return { | ||
...styleForDirection(scale.mobile * polarity + adjustment, property, direction), | ||
[MEDIA_QUERIES.TABLET]: styleForDirection(scale.tablet * polarity + adjustment, property, direction), | ||
}); | ||
}; | ||
} | ||
@@ -112,3 +113,3 @@ | ||
if (Array.isArray(margin)) { | ||
styles.push(margin.map(val => responsiveMargin(val))); | ||
styles.push(margin.map((val) => responsiveMargin(val))); | ||
} else { | ||
@@ -121,3 +122,3 @@ styles.push(responsiveMargin(margin)); | ||
if (Array.isArray(padding)) { | ||
styles.push(padding.map(val => responsivePadding(val))); | ||
styles.push(padding.map((val) => responsivePadding(val))); | ||
} else { | ||
@@ -124,0 +125,0 @@ styles.push(responsivePadding(padding)); |
@@ -8,3 +8,3 @@ import { MEDIA_QUERIES, SPACING_MAP, SPACING_MAP_INDEX, SPACING_POINTS, WIDTHS } from '@govuk-react/constants'; | ||
it('returns spacing values from the spacing scale', () => { | ||
Object.keys(SPACING_POINTS).forEach(key => { | ||
Object.keys(SPACING_POINTS).forEach((key) => { | ||
expect(spacing.simple(key)).toEqual(SPACING_POINTS[key]); | ||
@@ -15,3 +15,3 @@ }); | ||
it('returns negative spacing values from the spacing scale', () => { | ||
Object.keys(SPACING_POINTS).forEach(key => { | ||
Object.keys(SPACING_POINTS).forEach((key) => { | ||
// skip zero, as -0 !== 0 in JS | ||
@@ -36,3 +36,3 @@ if (`${key}` !== '0') { | ||
it('returns spacing styles for given sizes on the spacing scale', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
const style = spacing.responsive({ size, property: 'test' }); | ||
@@ -46,3 +46,3 @@ | ||
it('returns negative spacing styles for given sizes on the spacing scale', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
// skip zero, as -0 !== 0 in JS | ||
@@ -134,3 +134,3 @@ if (size !== 0) { | ||
it('returns margin styles for given sizes on the spacing scale', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
expect(spacing.responsiveMargin({ size })).toEqual(spacing.responsive({ size, property: 'margin' })); | ||
@@ -141,3 +141,3 @@ }); | ||
it('returns margin styles for given sizes on the spacing scale using simple numeric value', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
expect(spacing.responsiveMargin(size)).toEqual(spacing.responsive({ size, property: 'margin' })); | ||
@@ -150,3 +150,3 @@ }); | ||
it('returns padding styles for given sizes on the spacing scale', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
expect(spacing.responsivePadding({ size })).toEqual(spacing.responsive({ size, property: 'padding' })); | ||
@@ -157,3 +157,3 @@ }); | ||
it('returns padding styles for given sizes on the spacing scale using simple numeric value', () => { | ||
SPACING_MAP_INDEX.forEach(size => { | ||
SPACING_MAP_INDEX.forEach((size) => { | ||
expect(spacing.responsivePadding(size)).toEqual(spacing.responsive({ size, property: 'padding' })); | ||
@@ -294,3 +294,3 @@ }); | ||
['95%', '200px'].forEach(setWidth => { | ||
['95%', '200px'].forEach((setWidth) => { | ||
const widthStyle = widthFunc({ setWidth }); | ||
@@ -328,3 +328,3 @@ | ||
['95%', '200px'].forEach(setWidth => { | ||
['95%', '200px'].forEach((setWidth) => { | ||
const widthStyle = widthFunc({ setWidth }); | ||
@@ -355,3 +355,3 @@ | ||
['95%', '200px'].forEach(setWidth => { | ||
['95%', '200px'].forEach((setWidth) => { | ||
const widthStyle = widthFunc({ setWidth }); | ||
@@ -366,3 +366,3 @@ | ||
Object.values(WIDTHS).forEach(setWidth => { | ||
Object.values(WIDTHS).forEach((setWidth) => { | ||
const widthStyle = widthFunc({ setWidth }); | ||
@@ -369,0 +369,0 @@ |
@@ -5,3 +5,3 @@ import * as packageExports from '.'; | ||
// all exports are truthy | ||
Object.keys(packageExports).map(exportName => | ||
Object.keys(packageExports).map((exportName) => | ||
it(`${exportName} is truthy`, () => { | ||
@@ -8,0 +8,0 @@ expect(!!packageExports[exportName]).toBe(true); |
// This lib is effectively a port of govuk-frontend's typography sass helpers | ||
// Tracking: | ||
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_typography.scss | ||
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_typography.scss | ||
@@ -49,15 +49,15 @@ import { | ||
return Object.assign({}, getSizeStyle(scale.mobile, overrideLineHeight), { | ||
return { | ||
...getSizeStyle(scale.mobile, overrideLineHeight), | ||
[MEDIA_QUERIES.TABLET]: getSizeStyle(scale.tablet, overrideLineHeight), | ||
[MEDIA_QUERIES.PRINT]: getSizeStyle(scale.print, overrideLineHeight), | ||
}); | ||
}; | ||
} | ||
export function font({ size, weight = 'regular', tabular = false, lineHeight } = {}) { | ||
return Object.assign( | ||
{}, | ||
common(tabular ? FONT_STACK_TABULAR : undefined), | ||
FONT_WEIGHTS[weight] ? { fontWeight: FONT_WEIGHTS[weight] } : undefined, | ||
size ? responsive(size, lineHeight) : undefined | ||
); | ||
return { | ||
...common(tabular ? FONT_STACK_TABULAR : undefined), | ||
...(FONT_WEIGHTS[weight] ? { fontWeight: FONT_WEIGHTS[weight] } : undefined), | ||
...(size ? responsive(size, lineHeight) : undefined), | ||
}; | ||
} |
@@ -38,3 +38,3 @@ import { | ||
it('allows any font size defined in the typography scale', () => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach(size => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach((size) => { | ||
expect(() => typography.responsive(size)).not.toThrow(); | ||
@@ -59,3 +59,3 @@ }); | ||
it('can override lineHeight', () => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach(size => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach((size) => { | ||
const style = typography.responsive(size, 999); | ||
@@ -83,7 +83,3 @@ | ||
expect(style).toEqual( | ||
Object.assign({}, typography.common(), { | ||
fontWeight: FONT_WEIGHTS.regular, | ||
}) | ||
); | ||
expect(style).toEqual({ ...typography.common(), fontWeight: FONT_WEIGHTS.regular }); | ||
}); | ||
@@ -108,3 +104,3 @@ | ||
it('allows size and custom lineHeight to be set', () => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach(size => { | ||
Object.keys(TYPOGRAPHY_SCALE).forEach((size) => { | ||
const style = typography.font({ size, lineHeight: 999 }); | ||
@@ -111,0 +107,0 @@ |
// This lib is effectively a port of govuk-frontend's visually-hidden sass helpers |
// Tracking: |
// https://github.com/alphagov/govuk-frontend/blob/master/src/helpers/_visually-hidden.scss |
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/helpers/_visually-hidden.scss |
function visuallyHidden({ important: isImportant = true, focusable: isFocusable = false } = {}) { |
const important = isImportant ? ' !important' : ''; |
return Object.assign( |
{}, |
{ |
position: `absolute${important}`, |
return { |
position: `absolute${important}`, |
width: `1px${important}`, |
height: `1px${important}`, |
margin: `0${important}`, |
width: `1px${important}`, |
height: `1px${important}`, |
margin: `0${important}`, |
overflow: `hidden${important}`, |
clip: `rect(0 0 0 0)${important}`, |
clipPath: `inset(50%)${important}`, |
overflow: `hidden${important}`, |
clip: `rect(0 0 0 0)${important}`, |
clipPath: `inset(50%)${important}`, |
border: `0${important}`, |
border: `0${important}`, |
whiteSpace: `nowrap${important}`, |
}, |
isFocusable |
whiteSpace: `nowrap${important}`, |
...(isFocusable |
? { |
@@ -42,4 +39,4 @@ '&:active,&:focus': { |
padding: `0${important}`, |
} |
); |
}), |
}; |
} |
@@ -46,0 +43,0 @@ |
@@ -15,3 +15,3 @@ import visuallyHidden, { focusable } from '.'; |
Object.values(style).forEach(value => { |
Object.values(style).forEach((value) => { |
expect(value).toContain(' !important'); |
@@ -24,3 +24,3 @@ }); |
Object.values(style).forEach(value => { |
Object.values(style).forEach((value) => { |
expect(value).not.toContain('!important'); |
@@ -38,3 +38,5 @@ }); |
const hasStyles = Object.keys(style).some(key => [':focus', ':active'].some(checkKey => key.includes(checkKey))); |
const hasStyles = Object.keys(style).some((key) => |
[':focus', ':active'].some((checkKey) => key.includes(checkKey)) |
); |
@@ -48,4 +50,4 @@ expect(hasStyles).toBe(true); |
Object.entries(style).forEach(([key, value]) => { |
if ([':focus', ':active'].some(checkKey => key.includes(checkKey))) { |
Object.values(value).forEach(activeValue => { |
if ([':focus', ':active'].some((checkKey) => key.includes(checkKey))) { |
Object.values(value).forEach((activeValue) => { |
expect(activeValue).toContain(' !important'); |
@@ -63,4 +65,4 @@ }); |
Object.entries(style).forEach(([key, value]) => { |
if ([':focus', ':active'].some(checkKey => key.includes(checkKey))) { |
Object.values(value).forEach(activeValue => { |
if ([':focus', ':active'].some((checkKey) => key.includes(checkKey))) { |
Object.values(value).forEach((activeValue) => { |
expect(activeValue).not.toContain(' !important'); |
@@ -67,0 +69,0 @@ }); |
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259869
3003
+ Added@govuk-react/constants@0.9.1(transitive)
- Removed@govuk-react/constants@0.8.0(transitive)