@surveycake/rc 3.0.0-alpha.50 → 3.0.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.0.0-alpha.51](https://fox.25sprout.com/surveycake/sdk/rc/compare/v3.0.0-alpha.50...v3.0.0-alpha.51) (2022-05-23)
6
+
7
+
8
+ ### Features
9
+
10
+ * V1 Typography supports align setting - [SUR-673] ([80d160c](https://fox.25sprout.com/surveycake/sdk/rc/commit/80d160c647992065646108f3675110f31aad5d04))
11
+
5
12
  ## [3.0.0-alpha.50](https://fox.25sprout.com/surveycake/sdk/rc/compare/v3.0.0-alpha.49...v3.0.0-alpha.50) (2022-05-23)
6
13
 
7
14
 
@@ -21,6 +21,7 @@ export interface TypographyProps extends Omit<HTMLAttributes<TypographyElement>,
21
21
  * If `true`, the text will not wrap, but instead will truncate with an ellipsis.
22
22
  */
23
23
  noWrap?: boolean;
24
+ align?: 'C' | 'R' | '';
24
25
  }
25
26
  declare const Typography: React.ForwardRefExoticComponent<TypographyProps & React.RefAttributes<TypographyElement>>;
26
27
  export default Typography;
@@ -2821,6 +2821,10 @@ function resolveThemeColorProp(theme, color) {
2821
2821
  return typeof color === 'function' ? color(theme) : resolveThemeColorByPath(theme, color);
2822
2822
  }
2823
2823
 
2824
+ var ALIGN_MAP = {
2825
+ C: 'center',
2826
+ R: 'right'
2827
+ };
2824
2828
  var useStyles$2 =
2825
2829
  /*#__PURE__*/
2826
2830
  makeStyles([['typography', function (theme, _ref) {
@@ -2828,13 +2832,15 @@ makeStyles([['typography', function (theme, _ref) {
2828
2832
  color = _ref[1],
2829
2833
  weight = _ref[2],
2830
2834
  gutterBottom = _ref[3],
2831
- noWrap = _ref[4];
2835
+ noWrap = _ref[4],
2836
+ align = _ref[5];
2832
2837
  var fontSize = theme.typography.fontSize[variant];
2833
2838
  var fontWeight = theme.typography.fontWeight[weight];
2834
- var lineHeight = fontSize + 8; // On IE11, it's height may be strange when inserted an image children whose width > height.
2839
+ var lineHeight = fontSize + 8;
2840
+ var textAlign = ALIGN_MAP[align]; // On IE11, it's height may be strange when inserted an image children whose width > height.
2835
2841
  // The solution is to add min-height 0.01px. I don't know how it works.
2836
2842
 
2837
- return ["\n\t\t\t\tcolor: " + (resolveThemeColorProp(theme, color) || 'inherit') + ";\n\t\t\t\tfont-weight: " + fontWeight + ";\n\t\t\t\tfont-size: " + fontSize + "px;\n\t\t\t\tline-height: " + lineHeight + "px;\n\t\t\t\tmin-height: 0.01px;\n\t\t\t\tmargin: 0;\n\t\t\t\tmargin-bottom: " + (gutterBottom ? '0.35em' : 0) + ";\n\t\t\t", noWrap && "\n\t\t\t\toverflow: hidden;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\twhite-space: nowrap;\n\t\t\t"];
2843
+ return ["\n\t\t\t\tcolor: " + (resolveThemeColorProp(theme, color) || 'inherit') + ";\n\t\t\t\tfont-weight: " + fontWeight + ";\n\t\t\t\tfont-size: " + fontSize + "px;\n\t\t\t\tline-height: " + lineHeight + "px;\n\t\t\t\tmin-height: 0.01px;\n\t\t\t\tmargin: 0;\n\t\t\t\tmargin-bottom: " + (gutterBottom ? '0.35em' : 0) + ";\n\t\t\t", noWrap && "\n\t\t\t\toverflow: hidden;\n\t\t\t\ttext-overflow: ellipsis;\n\t\t\t\twhite-space: nowrap;\n\t\t\t", textAlign && "text-align: " + textAlign];
2838
2844
  }]]);
2839
2845
 
2840
2846
  var Typography$1 =
@@ -2847,9 +2853,10 @@ React.forwardRef(function (_ref, ref) {
2847
2853
  weight = _ref.weight,
2848
2854
  gutterBottom = _ref.gutterBottom,
2849
2855
  noWrap = _ref.noWrap,
2850
- props = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "color", "weight", "gutterBottom", "noWrap"]);
2856
+ align = _ref.align,
2857
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "color", "weight", "gutterBottom", "noWrap", "align"]);
2851
2858
 
2852
- var styles = useStyles$2([Vari, color, weight, gutterBottom, noWrap]);
2859
+ var styles = useStyles$2([Vari, color, weight, gutterBottom, noWrap, align]);
2853
2860
  return React__default.createElement(Vari, Object.assign({}, props, {
2854
2861
  className: className ? emotion.cx(styles.typography, className) : styles.typography,
2855
2862
  ref: ref