@zendeskgarden/react-typography 9.0.0-next.9 → 9.0.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.
@@ -7,6 +7,7 @@
7
7
  import React, { useRef, useMemo } from 'react';
8
8
  import Highlight, { Prism } from 'prism-react-renderer';
9
9
  import { useScrollRegion } from '@zendeskgarden/container-scrollregion';
10
+ import { ThemeProvider } from '@zendeskgarden/react-theming';
10
11
  import { LANGUAGES } from '../types/index.js';
11
12
  import '../styled/StyledBlockquote.js';
12
13
  import '../styled/StyledCode.js';
@@ -28,8 +29,8 @@ const CodeBlock = React.forwardRef((_ref, ref) => {
28
29
  highlightLines,
29
30
  isLight,
30
31
  isNumbered,
31
- language,
32
- size,
32
+ language = 'tsx',
33
+ size = 'medium',
33
34
  ...other
34
35
  } = _ref;
35
36
  const containerRef = useRef(null);
@@ -71,32 +72,36 @@ const CodeBlock = React.forwardRef((_ref, ref) => {
71
72
  getLineProps,
72
73
  getTokenProps
73
74
  } = _ref2;
74
- return React.createElement(StyledCodeBlock, Object.assign({
75
+ return React.createElement(ThemeProvider, {
76
+ theme: parentTheme => ({
77
+ ...parentTheme,
78
+ colors: {
79
+ ...parentTheme.colors,
80
+ base: isLight ? 'light' : 'dark'
81
+ }
82
+ })
83
+ }, React.createElement(StyledCodeBlock, Object.assign({
75
84
  className: className,
76
- ref: ref,
77
- isLight: isLight
78
- }, other), tokens.map((line, index) => React.createElement(StyledCodeBlockLine, Object.assign({}, getLineProps({
85
+ ref: ref
86
+ }, other), tokens.map((line, index) =>
87
+ React.createElement(StyledCodeBlockLine, Object.assign({}, getLineProps({
79
88
  line
80
89
  }), {
81
90
  key: index,
82
91
  language: language,
83
- isHighlighted: highlightLines && highlightLines.includes(index + 1),
84
- isLight: isLight,
92
+ isHighlighted: highlightLines?.includes(index + 1),
85
93
  isNumbered: isNumbered,
86
94
  diff: getDiff(line),
87
- size: size
95
+ size: size,
96
+ style: undefined
88
97
  }), line.map((token, tokenKey) => React.createElement(StyledCodeBlockToken, Object.assign({}, getTokenProps({
89
98
  token
90
99
  }), {
91
100
  key: tokenKey,
92
- isLight: isLight
93
- }), token.empty ? '\n' : token.content)))));
101
+ style: undefined
102
+ }), token.empty ? '\n' : token.content))))));
94
103
  }));
95
104
  });
96
105
  CodeBlock.displayName = 'CodeBlock';
97
- CodeBlock.defaultProps = {
98
- language: 'tsx',
99
- size: 'medium'
100
- };
101
106
 
102
107
  export { CodeBlock };
@@ -5,19 +5,19 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { getColor, retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
  import { THEME_SIZES } from './StyledFont.js';
10
10
 
11
11
  const COMPONENT_ID = 'typography.blockquote';
12
12
  const StyledBlockquote = styled.blockquote.attrs({
13
13
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.0.0-next.9'
14
+ 'data-garden-version': '9.0.0'
15
15
  }).withConfig({
16
16
  displayName: "StyledBlockquote",
17
17
  componentId: "sc-1tt3ye0-0"
18
- })(["margin:0;border-", ":", " solid;border-color:", ";padding:0;padding-", ":", "px;direction:", ";& + &,p + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.shadowWidths.sm, props => getColorV8('neutralHue', 400, props.theme), props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 4, props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.lineHeights[THEME_SIZES[props.size]], props => retrieveComponentStyles(COMPONENT_ID, props));
19
- StyledBlockquote.defaultProps = {
20
- theme: DEFAULT_THEME
21
- };
18
+ })(["margin:0;border-", ":", " solid;border-color:", ";padding:0;padding-", ":", "px;direction:", ";& + &,p + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.shadowWidths.sm, props => getColor({
19
+ theme: props.theme,
20
+ variable: 'border.default'
21
+ }), props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 4, props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.lineHeights[THEME_SIZES[props.size]], props => retrieveComponentStyles(COMPONENT_ID, props));
22
22
 
23
23
  export { StyledBlockquote };
@@ -5,29 +5,61 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledFont } from './StyledFont.js';
10
10
 
11
11
  const COMPONENT_ID = 'typography.code';
12
- const colorStyles = props => {
13
- const hue = props.hue || 'neutralHue';
14
- const backgroundColor = getColorV8(hue, 200, props.theme);
15
- const shade = hue === 'yellow' ? 800 : 700;
16
- const foregroundColor = getColorV8(hue, shade, props.theme);
12
+ const colorStyles = _ref => {
13
+ let {
14
+ hue,
15
+ theme
16
+ } = _ref;
17
+ const bgColorArgs = {
18
+ theme,
19
+ light: {
20
+ offset: 100
21
+ },
22
+ dark: {
23
+ offset: -100
24
+ }
25
+ };
26
+ const fgColorArgs = {
27
+ theme
28
+ };
29
+ switch (hue) {
30
+ case 'green':
31
+ bgColorArgs.variable = 'background.success';
32
+ fgColorArgs.variable = 'foreground.successEmphasis';
33
+ break;
34
+ case 'red':
35
+ bgColorArgs.variable = 'background.danger';
36
+ fgColorArgs.variable = 'foreground.dangerEmphasis';
37
+ break;
38
+ case 'yellow':
39
+ bgColorArgs.variable = 'background.warning';
40
+ fgColorArgs.variable = 'foreground.warningEmphasis';
41
+ break;
42
+ default:
43
+ fgColorArgs.variable = 'foreground.default';
44
+ bgColorArgs.variable = 'background.subtle';
45
+ break;
46
+ }
47
+ const backgroundColor = getColor(bgColorArgs);
48
+ const foregroundColor = getColor(fgColorArgs);
17
49
  return css(["background-color:", ";color:", ";a &{color:inherit;}"], backgroundColor, foregroundColor);
18
50
  };
19
51
  const StyledCode = styled(StyledFont).attrs({
20
52
  'data-garden-id': COMPONENT_ID,
21
- 'data-garden-version': '9.0.0-next.9',
22
- as: 'code'
53
+ 'data-garden-version': '9.0.0',
54
+ as: 'code',
55
+ isMonospace: true
23
56
  }).withConfig({
24
57
  displayName: "StyledCode",
25
58
  componentId: "sc-l8yvmf-0"
26
59
  })(["border-radius:", ";padding:1.5px;", ";", ";"], props => props.theme.borderRadii.sm, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
27
60
  StyledCode.defaultProps = {
28
61
  theme: DEFAULT_THEME,
29
- isMonospace: true,
30
- hue: 'neutralHue',
62
+ hue: 'grey',
31
63
  size: 'inherit'
32
64
  };
33
65
 
@@ -5,23 +5,29 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'typography.codeblock';
11
- const colorStyles = props => {
12
- const backgroundColor = getColorV8('neutralHue', props.isLight ? 100 : 1000, props.theme);
13
- const foregroundColor = props.isLight ? getColorV8('foreground', 600 , props.theme) : getColorV8('neutralHue', 300, props.theme);
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const backgroundColor = getColor({
16
+ theme,
17
+ variable: 'background.recessed'
18
+ });
19
+ const foregroundColor = getColor({
20
+ theme,
21
+ variable: 'foreground.default'
22
+ });
14
23
  return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
15
24
  };
16
25
  const StyledCodeBlock = styled.pre.attrs({
17
26
  'data-garden-id': COMPONENT_ID,
18
- 'data-garden-version': '9.0.0-next.9'
27
+ 'data-garden-version': '9.0.0'
19
28
  }).withConfig({
20
29
  displayName: "StyledCodeBlock",
21
30
  componentId: "sc-5wky57-0"
22
- })(["display:table;margin:0;padding:", "px;box-sizing:border-box;width:100%;direction:ltr;white-space:pre;counter-reset:linenumber;", ";", ";"], props => props.theme.space.base * 3, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
23
- StyledCodeBlock.defaultProps = {
24
- theme: DEFAULT_THEME
25
- };
31
+ })(["display:table;margin:0;padding:", "px;box-sizing:border-box;width:100%;direction:ltr;white-space:pre;counter-reset:linenumber;", ";", ";"], props => props.theme.space.base * 3, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
26
32
 
27
33
  export { StyledCodeBlock };
@@ -5,20 +5,17 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { focusStyles, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { focusStyles, retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'typography.codeblock_container';
11
11
  const StyledCodeBlockContainer = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.9'
13
+ 'data-garden-version': '9.0.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledCodeBlockContainer",
16
16
  componentId: "sc-14zgbfw-0"
17
17
  })(["transition:box-shadow 0.1s ease-in-out;overflow:auto;", " ", ";"], props => focusStyles({
18
18
  theme: props.theme
19
19
  }), props => retrieveComponentStyles(COMPONENT_ID, props));
20
- StyledCodeBlockContainer.defaultProps = {
21
- theme: DEFAULT_THEME
22
- };
23
20
 
24
21
  export { StyledCodeBlockContainer };
@@ -5,46 +5,72 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledFont, THEME_SIZES } from './StyledFont.js';
10
10
 
11
11
  const COMPONENT_ID = 'typography.codeblock_code';
12
- const colorStyles = props => {
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ diff,
16
+ isHighlighted
17
+ } = _ref;
13
18
  let backgroundColor;
14
- if (props.diff) {
15
- let hue;
16
- switch (props.diff) {
17
- case 'hunk':
18
- hue = 'royal';
19
- break;
20
- case 'add':
21
- hue = 'lime';
22
- break;
23
- case 'delete':
24
- hue = 'crimson';
25
- break;
26
- case 'change':
27
- hue = 'lemon';
28
- break;
29
- }
30
- backgroundColor = getColorV8(hue, 400, props.theme, 0.2);
31
- } else if (props.isHighlighted) {
32
- const hue = props.isLight ? props.theme.palette.black : props.theme.palette.white;
33
- backgroundColor = getColorV8(hue, 600, props.theme, 0.1);
19
+ if (diff) {
20
+ const hues = {
21
+ hunk: 'royal',
22
+ add: 'lime',
23
+ delete: 'crimson',
24
+ change: 'lemon'
25
+ };
26
+ backgroundColor = getColor({
27
+ theme,
28
+ hue: hues[diff],
29
+ dark: {
30
+ shade: 600
31
+ },
32
+ light: {
33
+ shade: 400
34
+ },
35
+ transparency: theme.opacity[300]
36
+ });
37
+ } else if (isHighlighted) {
38
+ backgroundColor = getColor({
39
+ theme,
40
+ dark: {
41
+ hue: 'white'
42
+ },
43
+ light: {
44
+ hue: 'neutralHue',
45
+ shade: 700
46
+ },
47
+ transparency: theme.opacity[100]
48
+ });
34
49
  }
35
50
  return css(["background-color:", ";"], backgroundColor);
36
51
  };
37
- const lineNumberStyles = props => {
38
- const color = getColorV8('neutralHue', props.isLight ? 600 : 500, props.theme);
52
+ const lineNumberStyles = _ref2 => {
53
+ let {
54
+ theme,
55
+ language,
56
+ size
57
+ } = _ref2;
58
+ const color = getColor({
59
+ theme,
60
+ variable: 'foreground.subtle',
61
+ light: {
62
+ offset: -100
63
+ }
64
+ });
39
65
  let padding;
40
- if (props.language && props.language === 'diff') {
66
+ if (language && language === 'diff') {
41
67
  padding = 0;
42
- } else if (props.size === 'small') {
43
- padding = props.theme.space.base * 4;
44
- } else if (props.size === 'large') {
45
- padding = props.theme.space.base * 7;
68
+ } else if (size === 'small') {
69
+ padding = theme.space.base * 4;
70
+ } else if (size === 'large') {
71
+ padding = theme.space.base * 7;
46
72
  } else {
47
- padding = props.theme.space.base * 6;
73
+ padding = theme.space.base * 6;
48
74
  }
49
75
  return `
50
76
  &::before {
@@ -60,15 +86,12 @@ const lineNumberStyles = props => {
60
86
  };
61
87
  const StyledCodeBlockLine = styled(StyledFont).attrs({
62
88
  'data-garden-id': COMPONENT_ID,
63
- 'data-garden-version': '9.0.0-next.9',
89
+ 'data-garden-version': '9.0.0',
64
90
  as: 'code',
65
91
  isMonospace: true
66
92
  }).withConfig({
67
93
  displayName: "StyledCodeBlockLine",
68
94
  componentId: "sc-1goay17-0"
69
- })(["display:table-row;height:", ";direction:ltr;", ";", ";&::after{display:inline-block;width:", "px;content:'';}", ";"], props => props.theme.lineHeights[THEME_SIZES[props.size]], props => colorStyles(props), props => props.isNumbered && lineNumberStyles(props), props => props.theme.space.base * 3, props => retrieveComponentStyles(COMPONENT_ID, props));
70
- StyledCodeBlockLine.defaultProps = {
71
- theme: DEFAULT_THEME
72
- };
95
+ })(["display:table-row;height:", ";direction:ltr;", ";", ";&::after{display:inline-block;width:", "px;content:'';}", ";"], props => props.theme.lineHeights[THEME_SIZES[props.size]], colorStyles, props => props.isNumbered && lineNumberStyles(props), props => props.theme.space.base * 3, props => retrieveComponentStyles(COMPONENT_ID, props));
73
96
 
74
97
  export { StyledCodeBlockLine };
@@ -5,40 +5,176 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledCodeBlock } from './StyledCodeBlock.js';
10
10
 
11
11
  const COMPONENT_ID = 'typography.codeblock_token';
12
- const colorStyles = props => {
13
- const palette = props.theme.palette;
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
14
16
  const colors = {
15
- boolean: props.isLight ? palette.royal[600] : palette.azure[400],
16
- builtin: palette.teal[400],
17
- comment: props.isLight ? palette.lime[600] : palette.mint[400],
18
- constant: props.isLight ? palette.azure[400] : palette.blue[500],
19
- coord: props.isLight ? palette.purple[600] : palette.blue[200],
20
- deleted: props.isLight ? palette.red[700] : palette.red[200],
21
- diff: props.isLight ? palette.yellow[800] : palette.yellow[200],
22
- function: props.isLight ? palette.orange['M600'] : palette.yellow[300],
23
- inserted: props.isLight ? palette.green[700] : palette.green[200],
24
- keyword: palette.fuschia['M400'],
25
- name: props.isLight ? palette.crimson[400] : palette.blue[300],
26
- number: props.isLight ? palette.green[600] : palette.green[300],
27
- punctuation: props.isLight ? palette.red[800] : palette.grey[600],
28
- regex: palette.red[400],
29
- value: props.isLight ? palette.red[700] : palette.crimson['M400']
17
+ boolean: getColor({
18
+ theme,
19
+ dark: {
20
+ hue: 'azure',
21
+ shade: 600
22
+ },
23
+ light: {
24
+ hue: 'royal',
25
+ shade: 700
26
+ }
27
+ }),
28
+ builtin: getColor({
29
+ theme,
30
+ hue: 'teal',
31
+ dark: {
32
+ shade: 600
33
+ },
34
+ light: {
35
+ shade: 700
36
+ }
37
+ }),
38
+ comment: getColor({
39
+ theme,
40
+ dark: {
41
+ hue: 'mint',
42
+ shade: 600
43
+ },
44
+ light: {
45
+ hue: 'lime',
46
+ shade: 700
47
+ }
48
+ }),
49
+ constant: getColor({
50
+ theme,
51
+ dark: {
52
+ hue: 'blue',
53
+ shade: 600
54
+ },
55
+ light: {
56
+ hue: 'azure',
57
+ shade: 700
58
+ }
59
+ }),
60
+ coord: getColor({
61
+ theme,
62
+ hue: 'blue',
63
+ dark: {
64
+ shade: 200
65
+ },
66
+ light: {
67
+ shade: 800
68
+ }
69
+ }),
70
+ deleted: getColor({
71
+ theme,
72
+ hue: 'red',
73
+ dark: {
74
+ shade: 200
75
+ },
76
+ light: {
77
+ shade: 800
78
+ }
79
+ }),
80
+ diff: getColor({
81
+ theme,
82
+ hue: 'yellow',
83
+ dark: {
84
+ shade: 200
85
+ },
86
+ light: {
87
+ shade: 800
88
+ }
89
+ }),
90
+ function: getColor({
91
+ theme,
92
+ dark: {
93
+ hue: 'yellow',
94
+ shade: 300
95
+ },
96
+ light: {
97
+ hue: 'orange',
98
+ shade: 700
99
+ }
100
+ }),
101
+ inserted: getColor({
102
+ theme,
103
+ hue: 'green',
104
+ dark: {
105
+ shade: 200
106
+ },
107
+ light: {
108
+ shade: 800
109
+ }
110
+ }),
111
+ keyword: getColor({
112
+ theme,
113
+ hue: 'fuschia',
114
+ dark: {
115
+ shade: 600
116
+ },
117
+ light: {
118
+ shade: 700
119
+ }
120
+ }),
121
+ name: getColor({
122
+ theme,
123
+ dark: {
124
+ hue: 'blue',
125
+ shade: 400
126
+ },
127
+ light: {
128
+ hue: 'crimson',
129
+ shade: 700
130
+ }
131
+ }),
132
+ number: getColor({
133
+ theme,
134
+ hue: 'green',
135
+ dark: {
136
+ shade: 400
137
+ },
138
+ light: {
139
+ shade: 700
140
+ }
141
+ }),
142
+ punctuation: getColor({
143
+ theme,
144
+ dark: {
145
+ hue: 'grey',
146
+ shade: 700
147
+ },
148
+ light: {
149
+ hue: 'red',
150
+ shade: 900
151
+ }
152
+ }),
153
+ regex: getColor({
154
+ theme,
155
+ hue: 'red',
156
+ shade: 600
157
+ }),
158
+ value: getColor({
159
+ theme,
160
+ dark: {
161
+ hue: 'crimson',
162
+ shade: 600
163
+ },
164
+ light: {
165
+ hue: 'red',
166
+ shade: 800
167
+ }
168
+ })
30
169
  };
31
170
  return css(["&.builtin,&.class-name,&.tag:not(.punctuation):not(.attr-name):not(.attr-value):not(.script){color:", ";}&.doctype,&.prolog,&.tag.punctuation:not(.attr-value):not(.script):not(.spread){color:", ";}&.attribute.value,&.attr-value,&.atrule,&.cdata,&.string,&.url.content{color:", ";}&.constant,&.interpolation-punctuation{color:", ";}&.attr-name,&.attr-value.spread,&.environment,&.interpolation,&.parameter,&.property,&.property-access,&.variable{color:", ";}&.parameter.punctuation,&.attr-name + .attr-value.punctuation{color:inherit;}&.regex{color:", ";}&.boolean,&.bold:not(.diff),&.entity,&.important,&.tag:not(.punctuation):not(.attr-name):not(.attr-value):not(.script):not(.class-name){color:", ";}&.number,&.unit{color:", ";}&.assign-left,&.function,&.selector:not(.attribute){color:", ";}&.atrule.rule,&.keyword{color:", ";}&.blockquote,&.comment,&.shebang{color:", ";}", ".language-css &&.plain{color:", ";}", ".language-diff &&.coord{color:", ";}", ".language-diff &&.deleted{color:", ";}", ".language-diff &&.diff{color:", ";}", ".language-diff &&.inserted{color:", ";}"], colors.builtin, colors.punctuation, colors.value, colors.constant, colors.name, colors.regex, colors.boolean, colors.number, colors.function, colors.keyword, colors.comment, StyledCodeBlock, colors.value, StyledCodeBlock, colors.coord, StyledCodeBlock, colors.deleted, StyledCodeBlock, colors.diff, StyledCodeBlock, colors.inserted);
32
171
  };
33
172
  const StyledCodeBlockToken = styled.span.attrs({
34
173
  'data-garden-id': COMPONENT_ID,
35
- 'data-garden-version': '9.0.0-next.9'
174
+ 'data-garden-version': '9.0.0'
36
175
  }).withConfig({
37
176
  displayName: "StyledCodeBlockToken",
38
177
  componentId: "sc-1hkshdq-0"
39
- })(["display:inline-block;&.bold:not(.diff){font-weight:", ";}&.coord{padding-left:0.75em;}&.italic{font-style:italic;}&.prefix{width:2em;text-align:center;}", ";", ";"], props => props.theme.fontWeights.semibold, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
40
- StyledCodeBlockToken.defaultProps = {
41
- theme: DEFAULT_THEME
42
- };
178
+ })(["display:inline-block;&.bold:not(.diff){font-weight:", ";}&.coord{padding-left:0.75em;}&.italic{font-style:italic;}&.prefix{width:2em;text-align:center;}", ";", ";"], props => props.theme.fontWeights.semibold, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
43
179
 
44
180
  export { StyledCodeBlockToken };
@@ -5,18 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'typography.ellipsis';
11
11
  const StyledEllipsis = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.9'
13
+ 'data-garden-version': '9.0.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledEllipsis",
16
16
  componentId: "sc-1u4uqmy-0"
17
17
  })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:", ";", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => retrieveComponentStyles(COMPONENT_ID, props));
18
- StyledEllipsis.defaultProps = {
19
- theme: DEFAULT_THEME
20
- };
21
18
 
22
19
  export { StyledEllipsis };
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
8
  import { hideVisually, math } from 'polished';
9
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
10
10
  import { SIZE } from '../types/index.js';
11
11
 
12
12
  const COMPONENT_ID = 'typography.font';
@@ -19,42 +19,55 @@ const THEME_SIZES = {
19
19
  '2xlarge': 'xxl',
20
20
  '3xlarge': 'xxxl'
21
21
  };
22
- const fontStyles = props => {
23
- const monospace = props.isMonospace && ['inherit', 'small', 'medium', 'large'].indexOf(props.size) !== -1;
24
- const fontFamily = monospace && props.theme.fonts.mono;
25
- const direction = props.theme.rtl ? 'rtl' : 'ltr';
22
+ const fontStyles = _ref => {
23
+ let {
24
+ hue,
25
+ isBold,
26
+ isMonospace,
27
+ size,
28
+ theme
29
+ } = _ref;
30
+ const monospace = isMonospace && ['inherit', 'small', 'medium', 'large'].indexOf(size) !== -1;
31
+ const fontFamily = monospace && theme.fonts.mono;
32
+ const direction = theme.rtl ? 'rtl' : 'ltr';
26
33
  let fontSize;
27
34
  let fontWeight;
28
35
  let lineHeight;
29
36
  let color;
30
37
  if (monospace) {
31
- if (props.size === 'inherit') {
38
+ if (size === 'inherit') {
32
39
  fontSize = 'calc(1em - 1px)';
33
40
  lineHeight = 'normal';
34
41
  } else {
35
- const themeSize = THEME_SIZES[props.size];
36
- fontSize = math(`${props.theme.fontSizes[themeSize]} - 1px`);
37
- lineHeight = math(`${props.theme.lineHeights[themeSize]} - 1px`);
42
+ const themeSize = THEME_SIZES[size];
43
+ fontSize = math(`${theme.fontSizes[themeSize]} - 1px`);
44
+ lineHeight = math(`${theme.lineHeights[themeSize]} - 1px`);
38
45
  }
39
- } else if (props.size !== 'inherit') {
40
- const themeSize = THEME_SIZES[props.size];
41
- fontSize = props.theme.fontSizes[themeSize];
42
- lineHeight = props.theme.lineHeights[themeSize];
46
+ } else if (size !== 'inherit') {
47
+ const themeSize = THEME_SIZES[size];
48
+ fontSize = theme.fontSizes[themeSize];
49
+ lineHeight = theme.lineHeights[themeSize];
43
50
  }
44
- if (props.isBold === true) {
45
- fontWeight = props.theme.fontWeights.semibold;
46
- } else if (props.isBold === false || props.size !== 'inherit') {
47
- fontWeight = props.theme.fontWeights.regular;
51
+ if (isBold === true) {
52
+ fontWeight = theme.fontWeights.semibold;
53
+ } else if (isBold === false || size !== 'inherit') {
54
+ fontWeight = theme.fontWeights.regular;
48
55
  }
49
- if (props.hue) {
50
- const shade = props.hue === 'yellow' ? 700 : 600;
51
- color = getColorV8(props.hue, shade, props.theme);
56
+ if (hue) {
57
+ const options = hue.includes('.') ? {
58
+ variable: hue,
59
+ theme
60
+ } : {
61
+ hue,
62
+ theme
63
+ };
64
+ color = getColor(options);
52
65
  }
53
- return css(["line-height:", ";color:", ";font-family:", ";font-size:", ";font-weight:", ";direction:", ";"], lineHeight, color, fontFamily, fontSize, fontWeight, direction);
66
+ return css(["transition:color 0.1s ease-in-out;line-height:", ";color:", ";font-family:", ";font-size:", ";font-weight:", ";direction:", ";"], lineHeight, color, fontFamily, fontSize, fontWeight, direction);
54
67
  };
55
68
  const StyledFont = styled.div.attrs({
56
69
  'data-garden-id': COMPONENT_ID,
57
- 'data-garden-version': '9.0.0-next.9'
70
+ 'data-garden-version': '9.0.0'
58
71
  }).withConfig({
59
72
  displayName: "StyledFont",
60
73
  componentId: "sc-1iildbo-0"