@primer/primitives 7.17.0-rc.61b28bca → 7.17.0-rc.8ff6ed39
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/css/functional/themes/dark-colorblind.css +14 -14
- package/dist/css/functional/themes/dark-tritanopia.css +14 -14
- package/dist/css/functional/themes/dark.css +14 -14
- package/dist/docs/functional/themes/dark-colorblind.json +7 -7
- package/dist/docs/functional/themes/dark-tritanopia.json +7 -7
- package/dist/docs/functional/themes/dark.json +7 -7
- package/dist/figma/scales/dark.json +5 -5
- package/dist/figma/themes/dark-colorblind.json +20 -20
- package/dist/figma/themes/dark-tritanopia.json +20 -20
- package/dist/figma/themes/dark.json +20 -20
- package/dist/internalCss/dark-colorblind.css +18 -18
- package/dist/internalCss/dark-tritanopia.css +18 -18
- package/dist/internalCss/dark.css +18 -18
- package/dist/styleLint/functional/themes/dark-colorblind.json +7 -7
- package/dist/styleLint/functional/themes/dark-tritanopia.json +7 -7
- package/dist/styleLint/functional/themes/dark.json +7 -7
- package/package.json +2 -3
- package/src/formats/jsonFigma.ts +2 -0
- package/src/platforms/figma.ts +1 -1
- package/src/schemas/collections.ts +2 -0
- package/src/schemas/dimensionToken.ts +1 -1
- package/src/schemas/fontFamilyToken.ts +10 -0
- package/src/schemas/fontWeightToken.ts +10 -0
- package/src/tokens/base/color/dark/dark.json5 +2 -2
- package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
- package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
- package/dist/deprecated/colors.json +0 -7
- package/dist/js/colors/dark.d.ts +0 -516
- package/dist/js/colors/dark.js +0 -616
- package/dist/js/colors/dark_colorblind.d.ts +0 -516
- package/dist/js/colors/dark_colorblind.js +0 -616
- package/dist/js/colors/dark_dimmed.d.ts +0 -516
- package/dist/js/colors/dark_dimmed.js +0 -616
- package/dist/js/colors/dark_high_contrast.d.ts +0 -516
- package/dist/js/colors/dark_high_contrast.js +0 -616
- package/dist/js/colors/dark_tritanopia.d.ts +0 -516
- package/dist/js/colors/dark_tritanopia.js +0 -616
- package/dist/js/colors/index.d.ts +0 -4638
- package/dist/js/colors/index.js +0 -15
- package/dist/js/colors/light.d.ts +0 -516
- package/dist/js/colors/light.js +0 -616
- package/dist/js/colors/light_colorblind.d.ts +0 -516
- package/dist/js/colors/light_colorblind.js +0 -616
- package/dist/js/colors/light_high_contrast.d.ts +0 -516
- package/dist/js/colors/light_high_contrast.js +0 -616
- package/dist/js/colors/light_tritanopia.d.ts +0 -516
- package/dist/js/colors/light_tritanopia.js +0 -616
- package/dist/js/index.d.ts +0 -4655
- package/dist/js/index.js +0 -9
- package/dist/js/spacing/index.d.ts +0 -6
- package/dist/js/spacing/index.js +0 -7
- package/dist/js/spacing/normal.d.ts +0 -4
- package/dist/js/spacing/normal.js +0 -13
- package/dist/js/typography/index.d.ts +0 -11
- package/dist/js/typography/index.js +0 -7
- package/dist/js/typography/normal.d.ts +0 -9
- package/dist/js/typography/normal.js +0 -19
- package/dist/json/colors/dark.json +0 -614
- package/dist/json/colors/dark_colorblind.json +0 -614
- package/dist/json/colors/dark_dimmed.json +0 -614
- package/dist/json/colors/dark_high_contrast.json +0 -614
- package/dist/json/colors/dark_tritanopia.json +0 -614
- package/dist/json/colors/light.json +0 -614
- package/dist/json/colors/light_colorblind.json +0 -614
- package/dist/json/colors/light_high_contrast.json +0 -614
- package/dist/json/colors/light_tritanopia.json +0 -614
- package/dist/json/spacing/normal.json +0 -11
- package/dist/json/typography/normal.json +0 -17
- package/dist/removed/colors.json +0 -432
- package/dist/scss/colors/_dark.scss +0 -452
- package/dist/scss/colors/_dark_colorblind.scss +0 -452
- package/dist/scss/colors/_dark_dimmed.scss +0 -452
- package/dist/scss/colors/_dark_high_contrast.scss +0 -452
- package/dist/scss/colors/_dark_tritanopia.scss +0 -452
- package/dist/scss/colors/_light.scss +0 -452
- package/dist/scss/colors/_light_colorblind.scss +0 -452
- package/dist/scss/colors/_light_high_contrast.scss +0 -452
- package/dist/scss/colors/_light_tritanopia.scss +0 -452
- package/dist/scss/spacing/_normal.scss +0 -11
- package/dist/scss/typography/_normal.scss +0 -15
- package/dist/ts/colors/dark.ts +0 -614
- package/dist/ts/colors/dark_colorblind.ts +0 -614
- package/dist/ts/colors/dark_dimmed.ts +0 -614
- package/dist/ts/colors/dark_high_contrast.ts +0 -614
- package/dist/ts/colors/dark_tritanopia.ts +0 -614
- package/dist/ts/colors/index.ts +0 -10
- package/dist/ts/colors/light.ts +0 -614
- package/dist/ts/colors/light_colorblind.ts +0 -614
- package/dist/ts/colors/light_high_contrast.ts +0 -614
- package/dist/ts/colors/light_tritanopia.ts +0 -614
- package/dist/ts/index.ts +0 -4
- package/dist/ts/spacing/index.ts +0 -2
- package/dist/ts/spacing/normal.ts +0 -11
- package/dist/ts/typography/index.ts +0 -2
- package/dist/ts/typography/normal.ts +0 -17
- package/src/filters/isBorder.test.ts +0 -18
- package/src/filters/isColor.test.ts +0 -22
- package/src/filters/isColorWithAlpha.test.ts +0 -34
- package/src/filters/isColorWithMix.test.ts +0 -108
- package/src/filters/isDeprecated.test.ts +0 -56
- package/src/filters/isDimension.test.ts +0 -22
- package/src/filters/isDuration.test.ts +0 -22
- package/src/filters/isFontFamily.test.ts +0 -22
- package/src/filters/isFontWeight.test.ts +0 -22
- package/src/filters/isFromFile.test.ts +0 -34
- package/src/filters/isShadow.test.ts +0 -18
- package/src/filters/isSource.test.ts +0 -44
- package/src/filters/isTypography.test.ts +0 -18
- package/src/formats/cssCustomMedia.test.ts +0 -11
- package/src/formats/cssThemed.test.ts +0 -87
- package/src/formats/cssWrapMediaQuery.test.ts +0 -170
- package/src/formats/javascriptCommonJs.test.ts +0 -43
- package/src/formats/javascriptEsm.test.ts +0 -41
- package/src/formats/jsonNestedPrefixed.test.ts +0 -73
- package/src/formats/jsonOneDimensional.test.ts +0 -56
- package/src/formats/typescriptExportDefinition.test.ts +0 -178
- package/src/formats/utilities/jsonToFlat.test.ts +0 -47
- package/src/formats/utilities/jsonToNestedValue.test.ts +0 -39
- package/src/formats/utilities/prefixTokens.test.ts +0 -38
- package/src/parsers/w3cJsonParser.test.ts +0 -35
- package/src/schemas/alphaValueSchema.test.ts +0 -24
- package/src/schemas/baseTokenSchema.test.ts +0 -17
- package/src/schemas/borderTokenSchema.test.ts +0 -53
- package/src/schemas/collectionSchema.test.ts +0 -58
- package/src/schemas/colorHexValueSchema.test.ts +0 -26
- package/src/schemas/colorTokenSchema.test.ts +0 -27
- package/src/schemas/dimensionTokenSchema.test.ts +0 -28
- package/src/schemas/dimensionValueSchema.test.ts +0 -21
- package/src/schemas/durationTokenSchema.test.ts +0 -58
- package/src/schemas/durationValueSchema.test.ts +0 -25
- package/src/schemas/fontFamilyTokenSchema.test.ts +0 -82
- package/src/schemas/fontWeightTokenSchema.test.ts +0 -88
- package/src/schemas/fontWeightValue.test.ts +0 -17
- package/src/schemas/numberTokenSchema.test.ts +0 -82
- package/src/schemas/referenceValueSchema.test.ts +0 -20
- package/src/schemas/schema.test.ts +0 -33
- package/src/schemas/scopeTokenSchema.test.ts +0 -29
- package/src/schemas/shadowTokenSchema.test.ts +0 -163
- package/src/schemas/stringTokenSchema.test.ts +0 -81
- package/src/schemas/tokenNameSchema.test.ts +0 -33
- package/src/schemas/typographyTokenSchema.test.ts +0 -58
- package/src/schemas/validTokenTypeSchema.test.ts +0 -32
- package/src/schemas/viewportRangeTokenSchema.test.ts +0 -59
- package/src/transformers/borderToCss.test.ts +0 -58
- package/src/transformers/colorToHex.test.ts +0 -27
- package/src/transformers/colorToHexAlpha.test.ts +0 -30
- package/src/transformers/colorToHexMix.test.ts +0 -83
- package/src/transformers/colorToRgbAlpha.test.ts +0 -33
- package/src/transformers/colorToRgbaFloat.test.ts +0 -168
- package/src/transformers/dimensionToPixelUnitless.test.ts +0 -93
- package/src/transformers/dimensionToRem.test.ts +0 -81
- package/src/transformers/durationToCss.test.ts +0 -56
- package/src/transformers/fontFamilyToCss.test.ts +0 -71
- package/src/transformers/fontWeightToNumbers.test.ts +0 -117
- package/src/transformers/jsonDeprecated.test.ts +0 -31
- package/src/transformers/namePathToCamelCase.test.ts +0 -74
- package/src/transformers/namePathToDotNotation.test.ts +0 -74
- package/src/transformers/namePathToFigma.test.ts +0 -74
- package/src/transformers/namePathToKebabCase.test.ts +0 -74
- package/src/transformers/namePathToSlashNotation.test.ts +0 -74
- package/src/transformers/shadowToCss.test.ts +0 -175
- package/src/transformers/typographyToCss.test.ts +0 -164
- package/src/transformers/utilities/alpha.test.ts +0 -28
- package/src/transformers/utilities/checkRequiredTokenProperties.test.ts +0 -28
- package/src/transformers/utilities/getTokenValue.test.ts +0 -18
- package/src/transformers/utilities/hexToRgbaFloat.test.ts +0 -66
- package/src/transformers/utilities/invalidTokenError.test.ts +0 -21
- package/src/transformers/utilities/isRgbaFloat.test.ts +0 -20
- package/src/transformers/utilities/rgbaFloatToHex.test.ts +0 -16
- package/src/utilities/getFlag.test.ts +0 -31
- package/src/utilities/joinFriendly.test.ts +0 -15
- package/src/utilities/toCamelCase.test.ts +0 -27
- package/src/utilities/treeWalker.test.ts +0 -51
- package/src/utilities/upperCaseFirstCharacter.test.ts +0 -19
- package/tokens-next-private/css/base/size/size.css +0 -19
- package/tokens-next-private/css/base/typography/typography.css +0 -6
- package/tokens-next-private/css/functional/motion/motion.css +0 -5
- package/tokens-next-private/css/functional/size/border.css +0 -14
- package/tokens-next-private/css/functional/size/breakpoints.css +0 -8
- package/tokens-next-private/css/functional/size/size-coarse.css +0 -7
- package/tokens-next-private/css/functional/size/size-fine.css +0 -7
- package/tokens-next-private/css/functional/size/size.css +0 -74
- package/tokens-next-private/css/functional/size/viewport.css +0 -6
- package/tokens-next-private/css/functional/themes/dark-colorblind.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-dimmed.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-high-contrast.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-tritanopia.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-colorblind.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-high-contrast.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-tritanopia.css +0 -1078
- package/tokens-next-private/css/functional/themes/light.css +0 -1078
- package/tokens-next-private/css/functional/typography/typography.css +0 -47
- package/tokens-next-private/docs/base/size/size.json +0 -427
- package/tokens-next-private/docs/base/typography/typography.json +0 -54
- package/tokens-next-private/docs/functional/motion/motion.json +0 -47
- package/tokens-next-private/docs/functional/size/border.json +0 -234
- package/tokens-next-private/docs/functional/size/breakpoints.json +0 -152
- package/tokens-next-private/docs/functional/size/size-coarse.json +0 -41
- package/tokens-next-private/docs/functional/size/size-fine.json +0 -41
- package/tokens-next-private/docs/functional/size/size.json +0 -1838
- package/tokens-next-private/docs/functional/size/viewport.json +0 -80
- package/tokens-next-private/docs/functional/themes/dark-colorblind.json +0 -16155
- package/tokens-next-private/docs/functional/themes/dark-dimmed.json +0 -16159
- package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +0 -16175
- package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +0 -16161
- package/tokens-next-private/docs/functional/themes/dark.json +0 -16159
- package/tokens-next-private/docs/functional/themes/light-colorblind.json +0 -16123
- package/tokens-next-private/docs/functional/themes/light-high-contrast.json +0 -16125
- package/tokens-next-private/docs/functional/themes/light-tritanopia.json +0 -16115
- package/tokens-next-private/docs/functional/themes/light.json +0 -16113
- package/tokens-next-private/docs/functional/typography/typography.json +0 -663
- package/tokens-next-private/fallbacks/base/size/size.json +0 -19
- package/tokens-next-private/fallbacks/base/typography/typography.json +0 -6
- package/tokens-next-private/fallbacks/color-fallbacks.json +0 -260
- package/tokens-next-private/fallbacks/functional/motion/motion.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/border.json +0 -14
- package/tokens-next-private/fallbacks/functional/size/breakpoints.json +0 -8
- package/tokens-next-private/fallbacks/functional/size/size-coarse.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/size-fine.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/size.json +0 -74
- package/tokens-next-private/fallbacks/functional/size/viewport.json +0 -8
- package/tokens-next-private/fallbacks/functional/typography/typography.json +0 -47
- package/tokens-next-private/internalCss/dark-colorblind.css +0 -1648
- package/tokens-next-private/internalCss/dark-dimmed.css +0 -1648
- package/tokens-next-private/internalCss/dark-high-contrast.css +0 -1648
- package/tokens-next-private/internalCss/dark-tritanopia.css +0 -1648
- package/tokens-next-private/internalCss/dark.css +0 -1648
- package/tokens-next-private/internalCss/light-colorblind.css +0 -1648
- package/tokens-next-private/internalCss/light-high-contrast.css +0 -1648
- package/tokens-next-private/internalCss/light-tritanopia.css +0 -1648
- package/tokens-next-private/internalCss/light.css +0 -1648
- package/tokens-next-private/removed/color.json +0 -421
- package/tokens-next-private/styleLint/base/size/size.json +0 -427
- package/tokens-next-private/styleLint/base/typography/typography.json +0 -54
- package/tokens-next-private/styleLint/functional/motion/motion.json +0 -47
- package/tokens-next-private/styleLint/functional/size/border.json +0 -234
- package/tokens-next-private/styleLint/functional/size/breakpoints.json +0 -152
- package/tokens-next-private/styleLint/functional/size/size-coarse.json +0 -41
- package/tokens-next-private/styleLint/functional/size/size-fine.json +0 -41
- package/tokens-next-private/styleLint/functional/size/size.json +0 -1838
- package/tokens-next-private/styleLint/functional/size/viewport.json +0 -80
- package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +0 -16155
- package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +0 -16159
- package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +0 -16175
- package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +0 -16161
- package/tokens-next-private/styleLint/functional/themes/dark.json +0 -16159
- package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +0 -16123
- package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +0 -16125
- package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +0 -16115
- package/tokens-next-private/styleLint/functional/themes/light.json +0 -16113
- package/tokens-next-private/styleLint/functional/typography/typography.json +0 -663
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../../test-utilities'
|
|
2
|
-
import {getTokenValue} from './getTokenValue'
|
|
3
|
-
|
|
4
|
-
describe('Utilities: getTokenValue', () => {
|
|
5
|
-
it('it retrieves the token value', () => {
|
|
6
|
-
const token = getMockToken({
|
|
7
|
-
value: '#223344',
|
|
8
|
-
})
|
|
9
|
-
expect(getTokenValue(token)).toStrictEqual('#223344')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('it throws a typeError if invalid input is used', () => {
|
|
13
|
-
expect(() => {
|
|
14
|
-
// @ts-expect-error due to testing wrong input
|
|
15
|
-
getTokenValue('invalid')
|
|
16
|
-
}).toThrow(TypeError)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {hexToRgbaFloat} from './hexToRgbaFloat'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: hexToRgbaFloat', () => {
|
|
4
|
-
it('it converts hex3', () => {
|
|
5
|
-
expect(hexToRgbaFloat('#369')).toStrictEqual({a: 1, b: 0.6, g: 0.4, r: 0.2})
|
|
6
|
-
expect(hexToRgbaFloat('369')).toStrictEqual({a: 1, b: 0.6, g: 0.4, r: 0.2})
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('it converts hex4', () => {
|
|
10
|
-
expect(hexToRgbaFloat('#3696')).toStrictEqual({a: 0.4, b: 0.6, g: 0.4, r: 0.2})
|
|
11
|
-
expect(hexToRgbaFloat('3696')).toStrictEqual({a: 0.4, b: 0.6, g: 0.4, r: 0.2})
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('it converts hex6', () => {
|
|
15
|
-
expect(hexToRgbaFloat('#223344')).toStrictEqual({a: 1, b: 0.26666666666666666, g: 0.2, r: 0.13333333333333333})
|
|
16
|
-
expect(hexToRgbaFloat('223344')).toStrictEqual({a: 1, b: 0.26666666666666666, g: 0.2, r: 0.13333333333333333})
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('it converts hex8', () => {
|
|
20
|
-
expect(hexToRgbaFloat('#00334466')).toStrictEqual({
|
|
21
|
-
a: 0.4,
|
|
22
|
-
b: 0.26666666666666666,
|
|
23
|
-
g: 0.2,
|
|
24
|
-
r: 0,
|
|
25
|
-
})
|
|
26
|
-
expect(hexToRgbaFloat('00334466')).toStrictEqual({
|
|
27
|
-
a: 0.4,
|
|
28
|
-
b: 0.26666666666666666,
|
|
29
|
-
g: 0.2,
|
|
30
|
-
r: 0,
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('it converts hex6 with additional alpha', () => {
|
|
35
|
-
expect(hexToRgbaFloat('#003344', 0.7)).toStrictEqual({
|
|
36
|
-
a: 0.7,
|
|
37
|
-
b: 0.26666666666666666,
|
|
38
|
-
g: 0.2,
|
|
39
|
-
r: 0,
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('it converts hex8 with additional alpha', () => {
|
|
44
|
-
expect(hexToRgbaFloat('#00334466', 0.6)).toStrictEqual({
|
|
45
|
-
a: 0.6,
|
|
46
|
-
b: 0.26666666666666666,
|
|
47
|
-
g: 0.2,
|
|
48
|
-
r: 0,
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('it converts hex without #', () => {
|
|
53
|
-
expect(hexToRgbaFloat('003344', 0.6)).toStrictEqual({
|
|
54
|
-
a: 0.6,
|
|
55
|
-
b: 0.26666666666666666,
|
|
56
|
-
g: 0.2,
|
|
57
|
-
r: 0,
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('it throws if invalid input is used', () => {
|
|
62
|
-
expect(() => {
|
|
63
|
-
hexToRgbaFloat('invalid')
|
|
64
|
-
}).toThrow('Invalid hex value in "hexToRgbaFloat". Please provide a valid hex3, hex4, hex6 or hex8 value.')
|
|
65
|
-
})
|
|
66
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../../test-utilities'
|
|
2
|
-
import {invalidTokenValueError} from './invalidTokenError'
|
|
3
|
-
|
|
4
|
-
describe('Utilities: invalidTokenValueError', () => {
|
|
5
|
-
it('it throws with token', () => {
|
|
6
|
-
expect(() => {
|
|
7
|
-
throw new invalidTokenValueError(
|
|
8
|
-
getMockToken({
|
|
9
|
-
value: '42px',
|
|
10
|
-
}),
|
|
11
|
-
)
|
|
12
|
-
}).toThrow(invalidTokenValueError)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('it throws TypeError if no token is provided', () => {
|
|
16
|
-
expect(() => {
|
|
17
|
-
// @ts-expect-error due to testing wrong input
|
|
18
|
-
throw new invalidTokenValueError('42px')
|
|
19
|
-
}).toThrow(TypeError)
|
|
20
|
-
})
|
|
21
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {isRgbaFloat} from './isRgbaFloat'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: isRgbaFloat', () => {
|
|
4
|
-
it('valid RgbaFloat', () => {
|
|
5
|
-
expect(isRgbaFloat({a: 1, b: 0.6, g: 0.4, r: 0.2})).toStrictEqual(true)
|
|
6
|
-
expect(isRgbaFloat({a: 0, b: 0.2, g: 0.4, r: 0.2})).toStrictEqual(true)
|
|
7
|
-
expect(isRgbaFloat({b: 0.6, g: 0.4, r: 0.2})).toStrictEqual(true)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('RgbaFloat as string', () => {
|
|
11
|
-
expect(isRgbaFloat('{a: 1, b: 0.6, g: 0.4, r: 0.2}')).toStrictEqual(false)
|
|
12
|
-
})
|
|
13
|
-
it('Invalid values', () => {
|
|
14
|
-
expect(isRgbaFloat({a: 1, b: 0.6, g: 0.4})).toStrictEqual(false)
|
|
15
|
-
expect(isRgbaFloat({a: 1, b: 0.6, g: 0.4, r: 1.1})).toStrictEqual(false)
|
|
16
|
-
expect(isRgbaFloat('#334455')).toStrictEqual(false)
|
|
17
|
-
expect(isRgbaFloat(undefined)).toStrictEqual(false)
|
|
18
|
-
expect(isRgbaFloat(null)).toStrictEqual(false)
|
|
19
|
-
})
|
|
20
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {rgbaFloatToHex} from './rgbaFloatToHex'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: rgbaFloatToHex', () => {
|
|
4
|
-
it('valid RgbaFloat value', () => {
|
|
5
|
-
expect(rgbaFloatToHex({a: 1, b: 0.6, g: 0.4, r: 0.2})).toStrictEqual('#336699')
|
|
6
|
-
expect(rgbaFloatToHex({a: 0, b: 0.3, g: 0.4, r: 0.2})).toStrictEqual('#33664c')
|
|
7
|
-
expect(rgbaFloatToHex({b: 0.6, g: 0.4, r: 0.2})).toStrictEqual('#336699')
|
|
8
|
-
expect(rgbaFloatToHex({b: 0.56, g: 0.35, r: 0.123344})).toStrictEqual('#1f598e')
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('Invalid values', () => {
|
|
12
|
-
expect(() => rgbaFloatToHex({a: 1, b: 0.6, g: 0.4, r: 2})).toThrow(
|
|
13
|
-
'Invalid RgbaFloat value. R, G and B values must be between 0 and 1',
|
|
14
|
-
)
|
|
15
|
-
})
|
|
16
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {getFlag} from './getFlag'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: getFlag', () => {
|
|
4
|
-
jest.replaceProperty(process, 'argv', [
|
|
5
|
-
'ts-node',
|
|
6
|
-
'src/utilities/getFlag.test.ts',
|
|
7
|
-
'--outFile=test.json',
|
|
8
|
-
'--silent',
|
|
9
|
-
'-D',
|
|
10
|
-
])
|
|
11
|
-
|
|
12
|
-
it('return null if flag is not found', () => {
|
|
13
|
-
expect(getFlag('--format')).toStrictEqual(null)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('return flag if flag has no value', () => {
|
|
17
|
-
expect(getFlag('--silent')).toStrictEqual('--silent')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('return value if flag has value', () => {
|
|
21
|
-
expect(getFlag('--outFile')).toStrictEqual('test.json')
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('return value if flag param has no --', () => {
|
|
25
|
-
expect(getFlag('outFile')).toStrictEqual('test.json')
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('allow other prefix', () => {
|
|
29
|
-
expect(getFlag('D', '-')).toStrictEqual('-D')
|
|
30
|
-
})
|
|
31
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {joinFriendly} from './joinFriendly'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: joinFriendly', () => {
|
|
4
|
-
it('it joins items with and for last item', () => {
|
|
5
|
-
expect(joinFriendly(['one', 'two', 'three'])).toStrictEqual('one, two and three')
|
|
6
|
-
expect(joinFriendly(['one', 'two'])).toStrictEqual('one and two')
|
|
7
|
-
})
|
|
8
|
-
it('it joins items with or for last item', () => {
|
|
9
|
-
expect(joinFriendly(['one', 'two', 'three'], 'or')).toStrictEqual('one, two or three')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('it joins items with and for last item', () => {
|
|
13
|
-
expect(joinFriendly(['one', 'two', 'three'], undefined)).toStrictEqual('one, two and three')
|
|
14
|
-
})
|
|
15
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {toCamelCase} from './toCamelCase'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: toCamelCase', () => {
|
|
4
|
-
it('it transforms all lowercase word', () => {
|
|
5
|
-
expect(toCamelCase('primer')).toStrictEqual('primer')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
it('it transforms all lowercase sentence (words with spaces)', () => {
|
|
9
|
-
expect(toCamelCase('primer design token')).toStrictEqual('primerDesignToken')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('it transforms all words with special chars', () => {
|
|
13
|
-
expect(toCamelCase('primer_design-token+edition')).toStrictEqual('primerDesignTokenEdition')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('it preserves casing for words that are already all uppercased', () => {
|
|
17
|
-
expect(toCamelCase('PRIMER')).toStrictEqual('PRIMER')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('it transforms all camelCase word', () => {
|
|
21
|
-
expect(toCamelCase('camelCase')).toStrictEqual('camelCase')
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
it('it transforms array of words', () => {
|
|
25
|
-
expect(toCamelCase(['primer', 'design', 'token'])).toStrictEqual('primerDesignToken')
|
|
26
|
-
})
|
|
27
|
-
})
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {treeWalker} from './treeWalker'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: treeWalker', () => {
|
|
4
|
-
const isValidItem = (item: unknown) => {
|
|
5
|
-
return typeof item === 'object' && item !== null && 'value' in item
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const callback = (_item: unknown) => {
|
|
9
|
-
return 'validItem'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
it('returns undefined if item is not valid', () => {
|
|
13
|
-
const tree = {
|
|
14
|
-
invalidItem: 'pumpkin',
|
|
15
|
-
subItem: {
|
|
16
|
-
invalidSubitem: 'squash',
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const expectedOutput = {
|
|
21
|
-
invalidItem: undefined,
|
|
22
|
-
subItem: {
|
|
23
|
-
invalidSubitem: undefined,
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
expect(treeWalker(tree, callback, isValidItem)).toStrictEqual(expectedOutput)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('returns callback return value if item is valid', () => {
|
|
31
|
-
const tree = {
|
|
32
|
-
validItem: {
|
|
33
|
-
value: 'pumpkin',
|
|
34
|
-
},
|
|
35
|
-
subItem: {
|
|
36
|
-
validSubitem: {
|
|
37
|
-
value: 'squash',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const expectedOutput = {
|
|
43
|
-
validItem: 'validItem',
|
|
44
|
-
subItem: {
|
|
45
|
-
validSubitem: 'validItem',
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
expect(treeWalker(tree, callback, isValidItem)).toStrictEqual(expectedOutput)
|
|
50
|
-
})
|
|
51
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {upperCaseFirstCharacter} from './upperCaseFirstCharacter'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: upperCaseFirstCharacter', () => {
|
|
4
|
-
it('it transforms all lowercase word', () => {
|
|
5
|
-
expect(upperCaseFirstCharacter('primer')).toStrictEqual('Primer')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
it('it transforms all lowercase sentence (words with spaces)', () => {
|
|
9
|
-
expect(upperCaseFirstCharacter('primer design token')).toStrictEqual('Primer design token')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('it preserves casing for words that are already all uppercased', () => {
|
|
13
|
-
expect(upperCaseFirstCharacter('PRIMER')).toStrictEqual('PRIMER')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('it transforms all camelCase word', () => {
|
|
17
|
-
expect(upperCaseFirstCharacter('camelCase')).toStrictEqual('CamelCase')
|
|
18
|
-
})
|
|
19
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--base-size-4: 0.25rem;
|
|
3
|
-
--base-size-8: 0.5rem;
|
|
4
|
-
--base-size-12: 0.75rem;
|
|
5
|
-
--base-size-16: 1rem;
|
|
6
|
-
--base-size-20: 1.25rem;
|
|
7
|
-
--base-size-24: 1.5rem;
|
|
8
|
-
--base-size-28: 1.75rem;
|
|
9
|
-
--base-size-32: 2rem;
|
|
10
|
-
--base-size-36: 2.25rem;
|
|
11
|
-
--base-size-40: 2.5rem;
|
|
12
|
-
--base-size-44: 2.75rem;
|
|
13
|
-
--base-size-48: 3rem;
|
|
14
|
-
--base-size-64: 4rem;
|
|
15
|
-
--base-size-80: 5rem;
|
|
16
|
-
--base-size-96: 6rem;
|
|
17
|
-
--base-size-112: 7rem;
|
|
18
|
-
--base-size-128: 8rem;
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--boxShadow-thin: inset 0 0 0 max(1px, 0.0625rem);
|
|
3
|
-
--boxShadow-thick: inset 0 0 0 max(2px, 0.125rem);
|
|
4
|
-
--boxShadow-thicker: inset 0 0 0 max(4px, 0.25rem);
|
|
5
|
-
--borderWidth-thin: max(1px, 0.0625rem);
|
|
6
|
-
--borderWidth-thick: max(2px, 0.125rem);
|
|
7
|
-
--borderWidth-thicker: max(4px, 0.25rem);
|
|
8
|
-
--borderRadius-small: 0.1875rem;
|
|
9
|
-
--borderRadius-medium: 0.375rem;
|
|
10
|
-
--borderRadius-large: 0.75rem;
|
|
11
|
-
--borderRadius-full: 624.9375rem;
|
|
12
|
-
--outline-focus-offset: -0.125rem;
|
|
13
|
-
--outline-focus-width: 0.125rem;
|
|
14
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--control-minTarget-fine: 1rem;
|
|
3
|
-
--control-minTarget-coarse: 2.75rem;
|
|
4
|
-
--control-xsmall-size: 1.5rem;
|
|
5
|
-
--control-xsmall-lineBoxHeight: 1.25rem;
|
|
6
|
-
--control-xsmall-paddingBlock: 0.125rem;
|
|
7
|
-
--control-xsmall-paddingInline-condensed: 0.25rem;
|
|
8
|
-
--control-xsmall-paddingInline-normal: 0.5rem;
|
|
9
|
-
--control-xsmall-paddingInline-spacious: 0.75rem;
|
|
10
|
-
--control-xsmall-gap: 0.25rem;
|
|
11
|
-
--control-small-size: 1.75rem;
|
|
12
|
-
--control-small-lineBoxHeight: 1.25rem;
|
|
13
|
-
--control-small-paddingBlock: 0.25rem;
|
|
14
|
-
--control-small-paddingInline-condensed: 0.5rem;
|
|
15
|
-
--control-small-paddingInline-normal: 0.75rem;
|
|
16
|
-
--control-small-gap: 0.25rem;
|
|
17
|
-
--control-medium-size: 2rem;
|
|
18
|
-
--control-medium-lineBoxHeight: 1.25rem;
|
|
19
|
-
--control-medium-paddingBlock: 0.375rem;
|
|
20
|
-
--control-medium-paddingInline-condensed: 0.5rem;
|
|
21
|
-
--control-medium-paddingInline-normal: 0.75rem;
|
|
22
|
-
--control-medium-paddingInline-spacious: 1rem;
|
|
23
|
-
--control-medium-gap: 0.5rem;
|
|
24
|
-
--control-large-size: 2.5rem;
|
|
25
|
-
--control-large-lineBoxHeight: 1.25rem;
|
|
26
|
-
--control-large-paddingBlock: 0.625rem;
|
|
27
|
-
--control-large-paddingInline-normal: 0.75rem;
|
|
28
|
-
--control-large-paddingInline-spacious: 1rem;
|
|
29
|
-
--control-large-gap: 0.5rem;
|
|
30
|
-
--control-xlarge-size: 3rem;
|
|
31
|
-
--control-xlarge-lineBoxHeight: 1.25rem;
|
|
32
|
-
--control-xlarge-paddingBlock: 0.875rem;
|
|
33
|
-
--control-xlarge-paddingInline-normal: 0.75rem;
|
|
34
|
-
--control-xlarge-paddingInline-spacious: 1rem;
|
|
35
|
-
--control-xlarge-gap: 0.5rem;
|
|
36
|
-
--controlStack-small-gap-condensed: 0.5rem;
|
|
37
|
-
--controlStack-small-gap-spacious: 1rem;
|
|
38
|
-
--controlStack-medium-gap-condensed: 0.5rem;
|
|
39
|
-
--controlStack-medium-gap-spacious: 0.75rem;
|
|
40
|
-
--controlStack-large-gap-auto: 0.5rem;
|
|
41
|
-
--controlStack-large-gap-condensed: 0.5rem;
|
|
42
|
-
--controlStack-large-gap-spacious: 0.75rem;
|
|
43
|
-
--space-xxsmall: 0.125rem;
|
|
44
|
-
--space-xsmall: 0.25rem;
|
|
45
|
-
--space-small: 0.375rem;
|
|
46
|
-
--space-medium: 0.5rem;
|
|
47
|
-
--space-large: 0.75rem;
|
|
48
|
-
--space-xlarge: 1rem;
|
|
49
|
-
--spinner-strokeWidth-default: 0.125rem;
|
|
50
|
-
--spinner-size-small: 1rem;
|
|
51
|
-
--spinner-size-medium: 2rem;
|
|
52
|
-
--spinner-size-large: 4rem;
|
|
53
|
-
--stack-padding-condensed: 0.5rem;
|
|
54
|
-
--stack-padding-normal: 1rem;
|
|
55
|
-
--stack-padding-spacious: 1.5rem;
|
|
56
|
-
--stack-gap-condensed: 0.5rem;
|
|
57
|
-
--stack-gap-normal: 1rem;
|
|
58
|
-
--stack-gap-spacious: 1.5rem;
|
|
59
|
-
--overlay-width-xsmall: 12rem;
|
|
60
|
-
--overlay-width-small: 20rem;
|
|
61
|
-
--overlay-width-medium: 30rem;
|
|
62
|
-
--overlay-width-large: 40rem;
|
|
63
|
-
--overlay-width-xlarge: 60rem;
|
|
64
|
-
--overlay-height-small: 16rem;
|
|
65
|
-
--overlay-height-medium: 20rem;
|
|
66
|
-
--overlay-height-large: 27rem;
|
|
67
|
-
--overlay-height-xlarge: 37.5rem;
|
|
68
|
-
--overlay-padding-normal: 1rem;
|
|
69
|
-
--overlay-padding-condensed: 0.5rem;
|
|
70
|
-
--overlay-paddingBlock-condensed: 0.25rem;
|
|
71
|
-
--overlay-paddingBlock-normal: 0.75rem;
|
|
72
|
-
--overlay-borderRadius: 0.375rem;
|
|
73
|
-
--overlay-offset: 0.25rem;
|
|
74
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
@custom-media --viewportRange-narrow (max-width: calc(48rem - 0.02px));
|
|
2
|
-
@custom-media --viewportRange-narrowLandscape (max-width: calc(63.25rem - 0.02px) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));
|
|
3
|
-
@custom-media --viewportRange-regular (min-width: 48rem);
|
|
4
|
-
@custom-media --viewportRange-wide (min-width: 87.5rem);
|
|
5
|
-
@custom-media --viewportRange-portrait (orientation: portrait);
|
|
6
|
-
@custom-media --viewportRange-landscape (orientation: landscape);
|