@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.
Files changed (303) hide show
  1. package/dist/css/functional/themes/dark-colorblind.css +14 -14
  2. package/dist/css/functional/themes/dark-tritanopia.css +14 -14
  3. package/dist/css/functional/themes/dark.css +14 -14
  4. package/dist/docs/functional/themes/dark-colorblind.json +7 -7
  5. package/dist/docs/functional/themes/dark-tritanopia.json +7 -7
  6. package/dist/docs/functional/themes/dark.json +7 -7
  7. package/dist/figma/scales/dark.json +5 -5
  8. package/dist/figma/themes/dark-colorblind.json +20 -20
  9. package/dist/figma/themes/dark-tritanopia.json +20 -20
  10. package/dist/figma/themes/dark.json +20 -20
  11. package/dist/internalCss/dark-colorblind.css +18 -18
  12. package/dist/internalCss/dark-tritanopia.css +18 -18
  13. package/dist/internalCss/dark.css +18 -18
  14. package/dist/styleLint/functional/themes/dark-colorblind.json +7 -7
  15. package/dist/styleLint/functional/themes/dark-tritanopia.json +7 -7
  16. package/dist/styleLint/functional/themes/dark.json +7 -7
  17. package/package.json +2 -3
  18. package/src/formats/jsonFigma.ts +2 -0
  19. package/src/platforms/figma.ts +1 -1
  20. package/src/schemas/collections.ts +2 -0
  21. package/src/schemas/dimensionToken.ts +1 -1
  22. package/src/schemas/fontFamilyToken.ts +10 -0
  23. package/src/schemas/fontWeightToken.ts +10 -0
  24. package/src/tokens/base/color/dark/dark.json5 +2 -2
  25. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  26. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  27. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  28. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  29. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  30. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  31. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  32. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  33. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  34. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  35. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  36. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  37. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  38. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  39. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  40. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  41. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  42. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  43. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  44. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  45. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  46. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  47. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  48. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  49. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  50. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  51. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  52. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  53. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  54. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  55. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  56. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  57. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  58. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  59. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  60. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  61. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  62. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  63. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  64. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  65. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  66. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  67. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  68. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  69. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  70. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  71. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  72. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  73. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  74. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  75. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  76. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  77. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
  78. package/dist/deprecated/colors.json +0 -7
  79. package/dist/js/colors/dark.d.ts +0 -516
  80. package/dist/js/colors/dark.js +0 -616
  81. package/dist/js/colors/dark_colorblind.d.ts +0 -516
  82. package/dist/js/colors/dark_colorblind.js +0 -616
  83. package/dist/js/colors/dark_dimmed.d.ts +0 -516
  84. package/dist/js/colors/dark_dimmed.js +0 -616
  85. package/dist/js/colors/dark_high_contrast.d.ts +0 -516
  86. package/dist/js/colors/dark_high_contrast.js +0 -616
  87. package/dist/js/colors/dark_tritanopia.d.ts +0 -516
  88. package/dist/js/colors/dark_tritanopia.js +0 -616
  89. package/dist/js/colors/index.d.ts +0 -4638
  90. package/dist/js/colors/index.js +0 -15
  91. package/dist/js/colors/light.d.ts +0 -516
  92. package/dist/js/colors/light.js +0 -616
  93. package/dist/js/colors/light_colorblind.d.ts +0 -516
  94. package/dist/js/colors/light_colorblind.js +0 -616
  95. package/dist/js/colors/light_high_contrast.d.ts +0 -516
  96. package/dist/js/colors/light_high_contrast.js +0 -616
  97. package/dist/js/colors/light_tritanopia.d.ts +0 -516
  98. package/dist/js/colors/light_tritanopia.js +0 -616
  99. package/dist/js/index.d.ts +0 -4655
  100. package/dist/js/index.js +0 -9
  101. package/dist/js/spacing/index.d.ts +0 -6
  102. package/dist/js/spacing/index.js +0 -7
  103. package/dist/js/spacing/normal.d.ts +0 -4
  104. package/dist/js/spacing/normal.js +0 -13
  105. package/dist/js/typography/index.d.ts +0 -11
  106. package/dist/js/typography/index.js +0 -7
  107. package/dist/js/typography/normal.d.ts +0 -9
  108. package/dist/js/typography/normal.js +0 -19
  109. package/dist/json/colors/dark.json +0 -614
  110. package/dist/json/colors/dark_colorblind.json +0 -614
  111. package/dist/json/colors/dark_dimmed.json +0 -614
  112. package/dist/json/colors/dark_high_contrast.json +0 -614
  113. package/dist/json/colors/dark_tritanopia.json +0 -614
  114. package/dist/json/colors/light.json +0 -614
  115. package/dist/json/colors/light_colorblind.json +0 -614
  116. package/dist/json/colors/light_high_contrast.json +0 -614
  117. package/dist/json/colors/light_tritanopia.json +0 -614
  118. package/dist/json/spacing/normal.json +0 -11
  119. package/dist/json/typography/normal.json +0 -17
  120. package/dist/removed/colors.json +0 -432
  121. package/dist/scss/colors/_dark.scss +0 -452
  122. package/dist/scss/colors/_dark_colorblind.scss +0 -452
  123. package/dist/scss/colors/_dark_dimmed.scss +0 -452
  124. package/dist/scss/colors/_dark_high_contrast.scss +0 -452
  125. package/dist/scss/colors/_dark_tritanopia.scss +0 -452
  126. package/dist/scss/colors/_light.scss +0 -452
  127. package/dist/scss/colors/_light_colorblind.scss +0 -452
  128. package/dist/scss/colors/_light_high_contrast.scss +0 -452
  129. package/dist/scss/colors/_light_tritanopia.scss +0 -452
  130. package/dist/scss/spacing/_normal.scss +0 -11
  131. package/dist/scss/typography/_normal.scss +0 -15
  132. package/dist/ts/colors/dark.ts +0 -614
  133. package/dist/ts/colors/dark_colorblind.ts +0 -614
  134. package/dist/ts/colors/dark_dimmed.ts +0 -614
  135. package/dist/ts/colors/dark_high_contrast.ts +0 -614
  136. package/dist/ts/colors/dark_tritanopia.ts +0 -614
  137. package/dist/ts/colors/index.ts +0 -10
  138. package/dist/ts/colors/light.ts +0 -614
  139. package/dist/ts/colors/light_colorblind.ts +0 -614
  140. package/dist/ts/colors/light_high_contrast.ts +0 -614
  141. package/dist/ts/colors/light_tritanopia.ts +0 -614
  142. package/dist/ts/index.ts +0 -4
  143. package/dist/ts/spacing/index.ts +0 -2
  144. package/dist/ts/spacing/normal.ts +0 -11
  145. package/dist/ts/typography/index.ts +0 -2
  146. package/dist/ts/typography/normal.ts +0 -17
  147. package/src/filters/isBorder.test.ts +0 -18
  148. package/src/filters/isColor.test.ts +0 -22
  149. package/src/filters/isColorWithAlpha.test.ts +0 -34
  150. package/src/filters/isColorWithMix.test.ts +0 -108
  151. package/src/filters/isDeprecated.test.ts +0 -56
  152. package/src/filters/isDimension.test.ts +0 -22
  153. package/src/filters/isDuration.test.ts +0 -22
  154. package/src/filters/isFontFamily.test.ts +0 -22
  155. package/src/filters/isFontWeight.test.ts +0 -22
  156. package/src/filters/isFromFile.test.ts +0 -34
  157. package/src/filters/isShadow.test.ts +0 -18
  158. package/src/filters/isSource.test.ts +0 -44
  159. package/src/filters/isTypography.test.ts +0 -18
  160. package/src/formats/cssCustomMedia.test.ts +0 -11
  161. package/src/formats/cssThemed.test.ts +0 -87
  162. package/src/formats/cssWrapMediaQuery.test.ts +0 -170
  163. package/src/formats/javascriptCommonJs.test.ts +0 -43
  164. package/src/formats/javascriptEsm.test.ts +0 -41
  165. package/src/formats/jsonNestedPrefixed.test.ts +0 -73
  166. package/src/formats/jsonOneDimensional.test.ts +0 -56
  167. package/src/formats/typescriptExportDefinition.test.ts +0 -178
  168. package/src/formats/utilities/jsonToFlat.test.ts +0 -47
  169. package/src/formats/utilities/jsonToNestedValue.test.ts +0 -39
  170. package/src/formats/utilities/prefixTokens.test.ts +0 -38
  171. package/src/parsers/w3cJsonParser.test.ts +0 -35
  172. package/src/schemas/alphaValueSchema.test.ts +0 -24
  173. package/src/schemas/baseTokenSchema.test.ts +0 -17
  174. package/src/schemas/borderTokenSchema.test.ts +0 -53
  175. package/src/schemas/collectionSchema.test.ts +0 -58
  176. package/src/schemas/colorHexValueSchema.test.ts +0 -26
  177. package/src/schemas/colorTokenSchema.test.ts +0 -27
  178. package/src/schemas/dimensionTokenSchema.test.ts +0 -28
  179. package/src/schemas/dimensionValueSchema.test.ts +0 -21
  180. package/src/schemas/durationTokenSchema.test.ts +0 -58
  181. package/src/schemas/durationValueSchema.test.ts +0 -25
  182. package/src/schemas/fontFamilyTokenSchema.test.ts +0 -82
  183. package/src/schemas/fontWeightTokenSchema.test.ts +0 -88
  184. package/src/schemas/fontWeightValue.test.ts +0 -17
  185. package/src/schemas/numberTokenSchema.test.ts +0 -82
  186. package/src/schemas/referenceValueSchema.test.ts +0 -20
  187. package/src/schemas/schema.test.ts +0 -33
  188. package/src/schemas/scopeTokenSchema.test.ts +0 -29
  189. package/src/schemas/shadowTokenSchema.test.ts +0 -163
  190. package/src/schemas/stringTokenSchema.test.ts +0 -81
  191. package/src/schemas/tokenNameSchema.test.ts +0 -33
  192. package/src/schemas/typographyTokenSchema.test.ts +0 -58
  193. package/src/schemas/validTokenTypeSchema.test.ts +0 -32
  194. package/src/schemas/viewportRangeTokenSchema.test.ts +0 -59
  195. package/src/transformers/borderToCss.test.ts +0 -58
  196. package/src/transformers/colorToHex.test.ts +0 -27
  197. package/src/transformers/colorToHexAlpha.test.ts +0 -30
  198. package/src/transformers/colorToHexMix.test.ts +0 -83
  199. package/src/transformers/colorToRgbAlpha.test.ts +0 -33
  200. package/src/transformers/colorToRgbaFloat.test.ts +0 -168
  201. package/src/transformers/dimensionToPixelUnitless.test.ts +0 -93
  202. package/src/transformers/dimensionToRem.test.ts +0 -81
  203. package/src/transformers/durationToCss.test.ts +0 -56
  204. package/src/transformers/fontFamilyToCss.test.ts +0 -71
  205. package/src/transformers/fontWeightToNumbers.test.ts +0 -117
  206. package/src/transformers/jsonDeprecated.test.ts +0 -31
  207. package/src/transformers/namePathToCamelCase.test.ts +0 -74
  208. package/src/transformers/namePathToDotNotation.test.ts +0 -74
  209. package/src/transformers/namePathToFigma.test.ts +0 -74
  210. package/src/transformers/namePathToKebabCase.test.ts +0 -74
  211. package/src/transformers/namePathToSlashNotation.test.ts +0 -74
  212. package/src/transformers/shadowToCss.test.ts +0 -175
  213. package/src/transformers/typographyToCss.test.ts +0 -164
  214. package/src/transformers/utilities/alpha.test.ts +0 -28
  215. package/src/transformers/utilities/checkRequiredTokenProperties.test.ts +0 -28
  216. package/src/transformers/utilities/getTokenValue.test.ts +0 -18
  217. package/src/transformers/utilities/hexToRgbaFloat.test.ts +0 -66
  218. package/src/transformers/utilities/invalidTokenError.test.ts +0 -21
  219. package/src/transformers/utilities/isRgbaFloat.test.ts +0 -20
  220. package/src/transformers/utilities/rgbaFloatToHex.test.ts +0 -16
  221. package/src/utilities/getFlag.test.ts +0 -31
  222. package/src/utilities/joinFriendly.test.ts +0 -15
  223. package/src/utilities/toCamelCase.test.ts +0 -27
  224. package/src/utilities/treeWalker.test.ts +0 -51
  225. package/src/utilities/upperCaseFirstCharacter.test.ts +0 -19
  226. package/tokens-next-private/css/base/size/size.css +0 -19
  227. package/tokens-next-private/css/base/typography/typography.css +0 -6
  228. package/tokens-next-private/css/functional/motion/motion.css +0 -5
  229. package/tokens-next-private/css/functional/size/border.css +0 -14
  230. package/tokens-next-private/css/functional/size/breakpoints.css +0 -8
  231. package/tokens-next-private/css/functional/size/size-coarse.css +0 -7
  232. package/tokens-next-private/css/functional/size/size-fine.css +0 -7
  233. package/tokens-next-private/css/functional/size/size.css +0 -74
  234. package/tokens-next-private/css/functional/size/viewport.css +0 -6
  235. package/tokens-next-private/css/functional/themes/dark-colorblind.css +0 -1078
  236. package/tokens-next-private/css/functional/themes/dark-dimmed.css +0 -1078
  237. package/tokens-next-private/css/functional/themes/dark-high-contrast.css +0 -1078
  238. package/tokens-next-private/css/functional/themes/dark-tritanopia.css +0 -1078
  239. package/tokens-next-private/css/functional/themes/dark.css +0 -1078
  240. package/tokens-next-private/css/functional/themes/light-colorblind.css +0 -1078
  241. package/tokens-next-private/css/functional/themes/light-high-contrast.css +0 -1078
  242. package/tokens-next-private/css/functional/themes/light-tritanopia.css +0 -1078
  243. package/tokens-next-private/css/functional/themes/light.css +0 -1078
  244. package/tokens-next-private/css/functional/typography/typography.css +0 -47
  245. package/tokens-next-private/docs/base/size/size.json +0 -427
  246. package/tokens-next-private/docs/base/typography/typography.json +0 -54
  247. package/tokens-next-private/docs/functional/motion/motion.json +0 -47
  248. package/tokens-next-private/docs/functional/size/border.json +0 -234
  249. package/tokens-next-private/docs/functional/size/breakpoints.json +0 -152
  250. package/tokens-next-private/docs/functional/size/size-coarse.json +0 -41
  251. package/tokens-next-private/docs/functional/size/size-fine.json +0 -41
  252. package/tokens-next-private/docs/functional/size/size.json +0 -1838
  253. package/tokens-next-private/docs/functional/size/viewport.json +0 -80
  254. package/tokens-next-private/docs/functional/themes/dark-colorblind.json +0 -16155
  255. package/tokens-next-private/docs/functional/themes/dark-dimmed.json +0 -16159
  256. package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +0 -16175
  257. package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +0 -16161
  258. package/tokens-next-private/docs/functional/themes/dark.json +0 -16159
  259. package/tokens-next-private/docs/functional/themes/light-colorblind.json +0 -16123
  260. package/tokens-next-private/docs/functional/themes/light-high-contrast.json +0 -16125
  261. package/tokens-next-private/docs/functional/themes/light-tritanopia.json +0 -16115
  262. package/tokens-next-private/docs/functional/themes/light.json +0 -16113
  263. package/tokens-next-private/docs/functional/typography/typography.json +0 -663
  264. package/tokens-next-private/fallbacks/base/size/size.json +0 -19
  265. package/tokens-next-private/fallbacks/base/typography/typography.json +0 -6
  266. package/tokens-next-private/fallbacks/color-fallbacks.json +0 -260
  267. package/tokens-next-private/fallbacks/functional/motion/motion.json +0 -5
  268. package/tokens-next-private/fallbacks/functional/size/border.json +0 -14
  269. package/tokens-next-private/fallbacks/functional/size/breakpoints.json +0 -8
  270. package/tokens-next-private/fallbacks/functional/size/size-coarse.json +0 -5
  271. package/tokens-next-private/fallbacks/functional/size/size-fine.json +0 -5
  272. package/tokens-next-private/fallbacks/functional/size/size.json +0 -74
  273. package/tokens-next-private/fallbacks/functional/size/viewport.json +0 -8
  274. package/tokens-next-private/fallbacks/functional/typography/typography.json +0 -47
  275. package/tokens-next-private/internalCss/dark-colorblind.css +0 -1648
  276. package/tokens-next-private/internalCss/dark-dimmed.css +0 -1648
  277. package/tokens-next-private/internalCss/dark-high-contrast.css +0 -1648
  278. package/tokens-next-private/internalCss/dark-tritanopia.css +0 -1648
  279. package/tokens-next-private/internalCss/dark.css +0 -1648
  280. package/tokens-next-private/internalCss/light-colorblind.css +0 -1648
  281. package/tokens-next-private/internalCss/light-high-contrast.css +0 -1648
  282. package/tokens-next-private/internalCss/light-tritanopia.css +0 -1648
  283. package/tokens-next-private/internalCss/light.css +0 -1648
  284. package/tokens-next-private/removed/color.json +0 -421
  285. package/tokens-next-private/styleLint/base/size/size.json +0 -427
  286. package/tokens-next-private/styleLint/base/typography/typography.json +0 -54
  287. package/tokens-next-private/styleLint/functional/motion/motion.json +0 -47
  288. package/tokens-next-private/styleLint/functional/size/border.json +0 -234
  289. package/tokens-next-private/styleLint/functional/size/breakpoints.json +0 -152
  290. package/tokens-next-private/styleLint/functional/size/size-coarse.json +0 -41
  291. package/tokens-next-private/styleLint/functional/size/size-fine.json +0 -41
  292. package/tokens-next-private/styleLint/functional/size/size.json +0 -1838
  293. package/tokens-next-private/styleLint/functional/size/viewport.json +0 -80
  294. package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +0 -16155
  295. package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +0 -16159
  296. package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +0 -16175
  297. package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +0 -16161
  298. package/tokens-next-private/styleLint/functional/themes/dark.json +0 -16159
  299. package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +0 -16123
  300. package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +0 -16125
  301. package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +0 -16115
  302. package/tokens-next-private/styleLint/functional/themes/light.json +0 -16113
  303. 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,6 +0,0 @@
1
- :root {
2
- --base-text-weight-light: 300;
3
- --base-text-weight-normal: 400;
4
- --base-text-weight-medium: 500;
5
- --base-text-weight-semibold: 600;
6
- }
@@ -1,5 +0,0 @@
1
- :root {
2
- --motion-skeletonLoader-shimmer-duration-scale: 1s;
3
- --motion-spinner-duration-rotation: 1s;
4
- --motion-loading-delay-default: 1s;
5
- }
@@ -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,8 +0,0 @@
1
- :root {
2
- --breakpoint-xsmall: 20rem;
3
- --breakpoint-small: 34rem;
4
- --breakpoint-medium: 48rem;
5
- --breakpoint-large: 63.25rem;
6
- --breakpoint-xlarge: 80rem;
7
- --breakpoint-xxlarge: 87.5rem;
8
- }
@@ -1,7 +0,0 @@
1
- @media (pointer: coarse) {
2
- :root {
3
- --control-minTarget-auto: 2.75rem;
4
- --controlStack-small-gap-auto: 1rem;
5
- --controlStack-medium-gap-auto: 0.75rem;
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- @media (pointer: fine) {
2
- :root {
3
- --control-minTarget-auto: 1rem;
4
- --controlStack-small-gap-auto: 0.5rem;
5
- --controlStack-medium-gap-auto: 0.5rem;
6
- }
7
- }
@@ -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);