@flodesk/grain 10.12.0 → 10.12.1

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.
@@ -96,12 +96,12 @@ var spaceProps = styleConfig.spaceProps,
96
96
  borderSideProps = styleConfig.borderSideProps,
97
97
  alignProps = styleConfig.alignProps,
98
98
  weightProps = styleConfig.weightProps,
99
- displayProps = styleConfig.displayProps,
99
+ textDisplayProps = styleConfig.textDisplayProps,
100
100
  zIndexProps = styleConfig.zIndexProps,
101
101
  letterSpacingProps = styleConfig.letterSpacingProps,
102
102
  textTransformProps = styleConfig.textTransformProps;
103
103
  var classAndStyleDeclarationProps = [spaceProps, colorProps, shadowProps, radiusProps, transitionProps, sizeProps, borderColorProps, alignProps];
104
- var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps, weightProps, displayProps, borderSideProps, textTransformProps]);
104
+ var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps, weightProps, textDisplayProps, borderSideProps, textTransformProps]);
105
105
  var styleDeclarationProps = [].concat(classAndStyleDeclarationProps, [dimensionProps, aspectRatioProps, orderProps, flexProps, opacityProps, zIndexProps, letterSpacingProps]);
106
106
  var defaultBorder = "\n [class*=\"bd\"] {\n border-color: var(--grn-color-border);\n border-width: 1px;\n }\n";
107
107
  var utilities = "\n ".concat(defaultBorder, "\n ").concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n");
package/es/types.js CHANGED
@@ -22,6 +22,9 @@ export var positions = ['static', 'relative', 'fixed', 'absolute', 'sticky'];
22
22
  export var cursors = ['default', 'pointer'];
23
23
  export var sides = ['all', 'left', 'right', 'top', 'bottom', 'x', 'y'];
24
24
  export var borderWidths = ['1px', '2px', '3px', '4px'];
25
+ export var textTransforms = ['capitalize', 'uppercase', 'lowercase'];
26
+ export var textDisplays = ['block', 'inline-block', 'inline'];
27
+ export var textAlignments = ['left', 'center', 'right'];
25
28
  export var types = {
26
29
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
27
30
  responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
@@ -32,12 +35,12 @@ export var types = {
32
35
  shadow: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.shadows)), PropTypes.string]),
33
36
  position: PropTypes.oneOf(positions),
34
37
  responsiveTextSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.texts)), PropTypes.string, PropTypes.object]),
35
- responsiveTextAlign: PropTypes.oneOfType([PropTypes.oneOf(['left', 'center', 'right']), PropTypes.string, PropTypes.object]),
38
+ responsiveTextAlign: PropTypes.oneOfType([PropTypes.oneOf(textAlignments), PropTypes.string, PropTypes.object]),
36
39
  iconSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.icons)), PropTypes.number, PropTypes.string]),
37
40
  weight: PropTypes.oneOf(Object.keys(vars.weights)),
38
41
  overflow: PropTypes.oneOf(overflows),
39
42
  textTag: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'label']),
40
- textDisplay: PropTypes.oneOf(['block', 'inline-block', 'inline']),
43
+ textDisplay: PropTypes.oneOf(textDisplays),
41
44
  responsiveColumns: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
42
45
  responsiveRows: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
43
46
  autoFlow: PropTypes.oneOfType([PropTypes.oneOf(autoFlows), PropTypes.string, PropTypes.object]),
@@ -28,7 +28,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
28
28
 
29
29
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
30
30
 
31
- import { alignSelfs, borderWidths, cursors, overflows, positions, sides } from '../types';
31
+ import { alignSelfs, borderWidths, cursors, overflows, positions, sides, textAlignments, textDisplays, textTransforms } from '../types';
32
32
  import { vars } from '../variables';
33
33
  import { getDimension, getSpace, getTextSize, isSpaceVar } from './responsive';
34
34
  import { getColor, getRadius, getShadow, getTransition, getWeight, isColorVar, isRadiusVar, isShadowVar, isTrasitionVar } from './styles';
@@ -38,6 +38,7 @@ var shadows = Object.keys(vars.shadows);
38
38
  var radii = Object.keys(vars.radii);
39
39
  var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
40
40
  var sizes = Object.keys(vars.texts);
41
+ var weights = Object.keys(vars.weights);
41
42
 
42
43
  var borderSideToStyle = function borderSideToStyle(side) {
43
44
  if (side === 'all') return 'solid';
@@ -375,9 +376,9 @@ export var styleConfig = {
375
376
  property: 'text-align',
376
377
  short: 'al'
377
378
  }],
378
- variables: ['left', 'center', 'right'],
379
+ variables: textAlignments,
379
380
  variableChecker: function variableChecker(value) {
380
- return ['left', 'center', 'right'].includes(value);
381
+ return textAlignments.includes(value);
381
382
  },
382
383
  isResponsive: true
383
384
  },
@@ -387,21 +388,21 @@ export var styleConfig = {
387
388
  property: 'font-weight',
388
389
  short: 'w'
389
390
  }],
390
- variables: ['normal', 'medium'],
391
+ variables: weights,
391
392
  variableChecker: function variableChecker(value) {
392
- return ['normal', 'medium'].includes(value);
393
+ return weights.includes(value);
393
394
  },
394
395
  valueTransformer: getWeight
395
396
  },
396
- displayProps: {
397
+ textDisplayProps: {
397
398
  props: [{
398
399
  propName: 'display',
399
400
  property: 'display',
400
401
  short: 'd'
401
402
  }],
402
- variables: ['block', 'inline', 'inline-block'],
403
+ variables: textDisplays,
403
404
  variableChecker: function variableChecker(value) {
404
- return ['block', 'inline', 'inline-block'].includes(value);
405
+ return textDisplays.includes(value);
405
406
  }
406
407
  },
407
408
  letterSpacingProps: {
@@ -417,9 +418,9 @@ export var styleConfig = {
417
418
  property: 'text-transform',
418
419
  short: 'tt'
419
420
  }],
420
- variables: ['capitalize', 'uppercase', 'lowercase'],
421
+ variables: textTransforms,
421
422
  variableChecker: function variableChecker(value) {
422
- return ['capitalize', 'uppercase', 'lowercase'].includes(value);
423
+ return textTransforms.includes(value);
423
424
  }
424
425
  }
425
426
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.12.0",
3
+ "version": "10.12.1",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",