@itcase/ui-core 1.10.50 → 1.10.51

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.
@@ -22,6 +22,7 @@ require('../context/UIContext.js');
22
22
  require('../utils/setViewportProperty.js');
23
23
  require('../context/UrlAssetPrefix.js');
24
24
  require('./useStyles/styleAttributes.js');
25
+ require('lodash/kebabCase');
25
26
  require('lodash/maxBy');
26
27
  require('react-responsive');
27
28
 
@@ -16,6 +16,7 @@ require('../../utils/setViewportProperty.js');
16
16
  require('../../context/UrlAssetPrefix.js');
17
17
  require('../useStyles/styleAttributes.js');
18
18
  require('../useStyles/styleAttributes.helpers.js');
19
+ require('lodash/kebabCase');
19
20
  require('lodash/maxBy');
20
21
 
21
22
 
@@ -9,6 +9,7 @@ var UIContext = require('../../context/UIContext.js');
9
9
  require('../../context/UrlAssetPrefix.js');
10
10
  var styleAttributes = require('../useStyles/styleAttributes.js');
11
11
  var styleAttributes_helpers = require('../useStyles/styleAttributes.helpers.js');
12
+ require('lodash/kebabCase');
12
13
  require('lodash/maxBy');
13
14
  require('react/jsx-runtime');
14
15
  require('uuid');
@@ -4,6 +4,7 @@ var styleAttributes_helpers = require('./styleAttributes.helpers.js');
4
4
  var useStyles = require('./useStyles.js');
5
5
  require('react');
6
6
  require('lodash/camelCase');
7
+ require('lodash/kebabCase');
7
8
  require('lodash/maxBy');
8
9
  require('lodash/upperFirst');
9
10
  require('../../context/Notifications.js');
@@ -30,6 +30,8 @@ var styleAttributes = [
30
30
  'columnWidth',
31
31
  'height',
32
32
  'justifyContent',
33
+ 'justifyItems',
34
+ 'justifySelf',
33
35
  'left',
34
36
  'margin',
35
37
  'marginBottom',
@@ -2,6 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var camelCase = require('lodash/camelCase');
5
+ var kebabCase = require('lodash/kebabCase');
5
6
  var maxBy = require('lodash/maxBy');
6
7
  var upperFirst = require('lodash/upperFirst');
7
8
  require('../../context/Notifications.js');
@@ -16,6 +17,14 @@ require('../useMediaQueries/useMediaQueries.js');
16
17
  require('react-responsive');
17
18
  require('../../utils/setViewportProperty.js');
18
19
 
20
+ const LAYOUT_STYLE_KEYS = new Set([
21
+ 'alignContent',
22
+ 'alignItems',
23
+ 'alignSelf',
24
+ 'justifyContent',
25
+ 'justifyItems',
26
+ 'justifySelf',
27
+ ]);
19
28
  /*
20
29
  * rule of prop key:
21
30
  *
@@ -74,6 +83,11 @@ function useStyles(props) {
74
83
  }
75
84
  }
76
85
  if (value) {
86
+ // flexStart → flex-start for layout props
87
+ if (typeof value === 'string' &&
88
+ LAYOUT_STYLE_KEYS.has(styleAttributeKey)) {
89
+ value = kebabCase(value);
90
+ }
77
91
  // Check not digit symbols. Chars means some unit ("px", "em", "rem" or custom "m")
78
92
  const isValueHasUnit = /\D/.test(value);
79
93
  // If value has some unit
@@ -154,11 +168,12 @@ function useStyles(props) {
154
168
  }
155
169
  }
156
170
  return resultStylesGroups;
171
+ // propsStyleAttributes already tracks relevant prop values
157
172
  // eslint-disable-next-line react-hooks/exhaustive-deps
158
173
  }, [
159
174
  deviceCurrentMainType,
160
175
  deviceCurrentType,
161
- ...Object.values(propsStyleAttributes),
176
+ propsStyleAttributes,
162
177
  ]);
163
178
  return collectedStyles;
164
179
  }
@@ -20,5 +20,6 @@ import '../context/UIContext.js';
20
20
  import '../utils/setViewportProperty.js';
21
21
  import '../context/UrlAssetPrefix.js';
22
22
  import './useStyles/styleAttributes.js';
23
+ import 'lodash/kebabCase';
23
24
  import 'lodash/maxBy';
24
25
  import 'react-responsive';
@@ -14,4 +14,5 @@ import '../../utils/setViewportProperty.js';
14
14
  import '../../context/UrlAssetPrefix.js';
15
15
  import '../useStyles/styleAttributes.js';
16
16
  import '../useStyles/styleAttributes.helpers.js';
17
+ import 'lodash/kebabCase';
17
18
  import 'lodash/maxBy';
@@ -7,6 +7,7 @@ import { useUserDeviceContext } from '../../context/UIContext.js';
7
7
  import '../../context/UrlAssetPrefix.js';
8
8
  import styleAttributes from '../useStyles/styleAttributes.js';
9
9
  import { getStyleAttributeKey } from '../useStyles/styleAttributes.helpers.js';
10
+ import 'lodash/kebabCase';
10
11
  import 'lodash/maxBy';
11
12
  import 'react/jsx-runtime';
12
13
  import 'uuid';
@@ -2,6 +2,7 @@ export { getStyleAttributeKey } from './styleAttributes.helpers.js';
2
2
  export { useStyles } from './useStyles.js';
3
3
  import 'react';
4
4
  import 'lodash/camelCase';
5
+ import 'lodash/kebabCase';
5
6
  import 'lodash/maxBy';
6
7
  import 'lodash/upperFirst';
7
8
  import '../../context/Notifications.js';
@@ -26,6 +26,8 @@ var styleAttributes = [
26
26
  'columnWidth',
27
27
  'height',
28
28
  'justifyContent',
29
+ 'justifyItems',
30
+ 'justifySelf',
29
31
  'left',
30
32
  'margin',
31
33
  'marginBottom',
@@ -1,5 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import camelCase from 'lodash/camelCase';
3
+ import kebabCase from 'lodash/kebabCase';
3
4
  import maxBy from 'lodash/maxBy';
4
5
  import upperFirst from 'lodash/upperFirst';
5
6
  import '../../context/Notifications.js';
@@ -14,6 +15,14 @@ import '../useMediaQueries/useMediaQueries.js';
14
15
  import 'react-responsive';
15
16
  import '../../utils/setViewportProperty.js';
16
17
 
18
+ const LAYOUT_STYLE_KEYS = new Set([
19
+ 'alignContent',
20
+ 'alignItems',
21
+ 'alignSelf',
22
+ 'justifyContent',
23
+ 'justifyItems',
24
+ 'justifySelf',
25
+ ]);
17
26
  /*
18
27
  * rule of prop key:
19
28
  *
@@ -72,6 +81,11 @@ function useStyles(props) {
72
81
  }
73
82
  }
74
83
  if (value) {
84
+ // flexStart → flex-start for layout props
85
+ if (typeof value === 'string' &&
86
+ LAYOUT_STYLE_KEYS.has(styleAttributeKey)) {
87
+ value = kebabCase(value);
88
+ }
75
89
  // Check not digit symbols. Chars means some unit ("px", "em", "rem" or custom "m")
76
90
  const isValueHasUnit = /\D/.test(value);
77
91
  // If value has some unit
@@ -152,11 +166,12 @@ function useStyles(props) {
152
166
  }
153
167
  }
154
168
  return resultStylesGroups;
169
+ // propsStyleAttributes already tracks relevant prop values
155
170
  // eslint-disable-next-line react-hooks/exhaustive-deps
156
171
  }, [
157
172
  deviceCurrentMainType,
158
173
  deviceCurrentType,
159
- ...Object.values(propsStyleAttributes),
174
+ propsStyleAttributes,
160
175
  ]);
161
176
  return collectedStyles;
162
177
  }
@@ -1,13 +1,13 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import type * as CSS from 'csstype';
3
- import { HeightProps, ResizeModeProps, WidthProps } from '@itcase/types-ui';
3
+ import { AlignContentProps, AlignItemsProps, AlignSelfProps, HeightProps, JustifyContentProps, JustifyItemsProps, JustifySelfProps, ResizeModeProps, WidthProps } from '@itcase/types-ui';
4
4
  export interface StyleAttributes {
5
5
  /**
6
6
  * Layout
7
7
  */
8
- alignContent?: CSS.Property.AlignContent;
9
- alignItems?: CSS.Property.AlignItems;
10
- alignSelf?: CSS.Property.AlignSelf;
8
+ alignContent?: AlignContentProps;
9
+ alignItems?: AlignItemsProps;
10
+ alignSelf?: AlignSelfProps;
11
11
  aspectRatio?: CSS.Property.AspectRatio;
12
12
  /**
13
13
  * Filter
@@ -69,6 +69,9 @@ export interface StyleAttributes {
69
69
  gridTemplateColumns?: CSS.Property.GridTemplateColumns;
70
70
  gridTemplateRows?: CSS.Property.GridTemplateRows;
71
71
  height?: CSS.Property.Height | HeightProps;
72
+ justifyContent?: JustifyContentProps;
73
+ justifyItems?: JustifyItemsProps;
74
+ justifySelf?: JustifySelfProps;
72
75
  left?: CSS.Property.Left;
73
76
  letterSpacing?: CSS.Property.LetterSpacing;
74
77
  lineHeight?: CSS.Property.LineHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/ui-core",
3
- "version": "1.10.50",
3
+ "version": "1.10.51",
4
4
  "description": "UI shared components",
5
5
  "keywords": [
6
6
  "Modal",
@@ -76,7 +76,7 @@
76
76
  "@babel/core": "^8.0.1",
77
77
  "@babel/preset-react": "^8.0.1",
78
78
  "@itcase/types-core": "^1.1.74",
79
- "@itcase/types-ui": "^1.1.91",
79
+ "@itcase/types-ui": "^1.1.93",
80
80
  "@rollup/plugin-alias": "^6.0.0",
81
81
  "@rollup/plugin-babel": "^7.1.0",
82
82
  "@rollup/plugin-commonjs": "^29.0.3",
@@ -96,5 +96,5 @@
96
96
  "rollup-plugin-peer-deps-external": "^2.2.4",
97
97
  "rollup-preserve-directives": "^1.1.3"
98
98
  },
99
- "gitHead": "0908a0c0e71a354a7c512fa70ce0c54e76788af7"
99
+ "gitHead": "8e079adc9dbd3b392ba155e2f2b53b0ac79ca6b5"
100
100
  }