@zendeskgarden/react-theming 8.54.3 → 8.56.0

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/index.cjs.js CHANGED
@@ -71,7 +71,7 @@ function _defineProperty(obj, key, value) {
71
71
  }
72
72
 
73
73
  function _extends() {
74
- _extends = Object.assign || function (target) {
74
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
75
75
  for (var i = 1; i < arguments.length; i++) {
76
76
  var source = arguments[i];
77
77
 
@@ -84,7 +84,6 @@ function _extends() {
84
84
 
85
85
  return target;
86
86
  };
87
-
88
87
  return _extends.apply(this, arguments);
89
88
  }
90
89
 
@@ -689,11 +688,8 @@ function arrowStyles(position) {
689
688
  }
690
689
 
691
690
  var useText = function useText(component, props, name, text) {
692
- var _useState = React.useState(props[name]),
693
- _useState2 = _slicedToArray(_useState, 2),
694
- value = _useState2[0],
695
- setValue = _useState2[1];
696
- React.useEffect(function () {
691
+ var value = props[name];
692
+ return React.useMemo(function () {
697
693
  if (name === 'children') {
698
694
  throw new Error('Error: `children` is not a valid `getText` prop.');
699
695
  } else if (value === null || value === '') {
@@ -702,10 +698,10 @@ var useText = function useText(component, props, name, text) {
702
698
  if (process.env.NODE_ENV === 'development') {
703
699
  console.warn(component.displayName ? "Warning: you did not provide a customized/translated `".concat(name, "` text value for <").concat(component.displayName, ">. Zendesk Garden is rendering <").concat(component.displayName, " ").concat(name, "=\"").concat(text, "\"> by default.") : "Warning: you did not provide a customized/translated `".concat(name, "` text value. Zendesk Garden is rendering ").concat(name, "=\"").concat(text, "\" by default."));
704
700
  }
705
- setValue(text);
701
+ return text;
706
702
  }
707
- }, [name, value, component.displayName, text]);
708
- return value;
703
+ return value;
704
+ }, [component.displayName, value, name, text]);
709
705
  };
710
706
 
711
707
  var animationStyles = function animationStyles(position, options) {
package/dist/index.esm.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
 
8
- import React, { useState, useEffect, useRef } from 'react';
8
+ import React, { useState, useEffect, useRef, useMemo } from 'react';
9
9
  import { ThemeProvider as ThemeProvider$1, withTheme as withTheme$1, css, keyframes } from 'styled-components';
10
10
  import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
11
11
  import { getControlledValue } from '@zendeskgarden/container-utilities';
@@ -63,7 +63,7 @@ function _defineProperty(obj, key, value) {
63
63
  }
64
64
 
65
65
  function _extends() {
66
- _extends = Object.assign || function (target) {
66
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
67
67
  for (var i = 1; i < arguments.length; i++) {
68
68
  var source = arguments[i];
69
69
 
@@ -76,7 +76,6 @@ function _extends() {
76
76
 
77
77
  return target;
78
78
  };
79
-
80
79
  return _extends.apply(this, arguments);
81
80
  }
82
81
 
@@ -681,11 +680,8 @@ function arrowStyles(position) {
681
680
  }
682
681
 
683
682
  var useText = function useText(component, props, name, text) {
684
- var _useState = useState(props[name]),
685
- _useState2 = _slicedToArray(_useState, 2),
686
- value = _useState2[0],
687
- setValue = _useState2[1];
688
- useEffect(function () {
683
+ var value = props[name];
684
+ return useMemo(function () {
689
685
  if (name === 'children') {
690
686
  throw new Error('Error: `children` is not a valid `getText` prop.');
691
687
  } else if (value === null || value === '') {
@@ -694,10 +690,10 @@ var useText = function useText(component, props, name, text) {
694
690
  if (process.env.NODE_ENV === 'development') {
695
691
  console.warn(component.displayName ? "Warning: you did not provide a customized/translated `".concat(name, "` text value for <").concat(component.displayName, ">. Zendesk Garden is rendering <").concat(component.displayName, " ").concat(name, "=\"").concat(text, "\"> by default.") : "Warning: you did not provide a customized/translated `".concat(name, "` text value. Zendesk Garden is rendering ").concat(name, "=\"").concat(text, "\" by default."));
696
692
  }
697
- setValue(text);
693
+ return text;
698
694
  }
699
- }, [name, value, component.displayName, text]);
700
- return value;
695
+ return value;
696
+ }, [component.displayName, value, name, text]);
701
697
  };
702
698
 
703
699
  var animationStyles = function animationStyles(position, options) {
@@ -5,4 +5,4 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import { DefaultTheme } from 'styled-components';
8
- export declare const useDocument: (theme?: Partial<DefaultTheme> | undefined) => Document | undefined;
8
+ export declare const useDocument: (theme?: Partial<DefaultTheme>) => Document | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "8.54.3",
3
+ "version": "8.56.0",
4
4
  "description": "Theming utilities and components within the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -41,5 +41,5 @@
41
41
  "access": "public"
42
42
  },
43
43
  "zendeskgarden:src": "src/index.ts",
44
- "gitHead": "a0cee36de7275885b23776c0cb02dedeb63613b3"
44
+ "gitHead": "c0e1cb7669a366ff510cc9613e2b426d48019732"
45
45
  }