@zendeskgarden/react-typography 9.0.0-next.7 → 9.0.0-next.8

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.
Files changed (37) hide show
  1. package/dist/esm/elements/Blockquote.js +34 -0
  2. package/dist/esm/elements/Code.js +43 -0
  3. package/dist/esm/elements/CodeBlock.js +102 -0
  4. package/dist/esm/elements/Ellipsis.js +50 -0
  5. package/dist/esm/elements/LG.js +43 -0
  6. package/dist/esm/elements/MD.js +43 -0
  7. package/dist/esm/elements/Paragraph.js +34 -0
  8. package/dist/esm/elements/SM.js +43 -0
  9. package/dist/esm/elements/XL.js +42 -0
  10. package/dist/esm/elements/XXL.js +42 -0
  11. package/dist/esm/elements/XXXL.js +42 -0
  12. package/dist/esm/elements/lists/OrderedList.js +53 -0
  13. package/dist/esm/elements/lists/OrderedListItem.js +34 -0
  14. package/dist/esm/elements/lists/UnorderedList.js +53 -0
  15. package/dist/esm/elements/lists/UnorderedListItem.js +34 -0
  16. package/dist/esm/elements/span/Icon.js +25 -0
  17. package/dist/esm/elements/span/Span.js +49 -0
  18. package/dist/esm/elements/span/StartIcon.js +27 -0
  19. package/dist/esm/index.js +20 -0
  20. package/dist/esm/styled/StyledBlockquote.js +23 -0
  21. package/dist/esm/styled/StyledCode.js +34 -0
  22. package/dist/esm/styled/StyledCodeBlock.js +27 -0
  23. package/dist/esm/styled/StyledCodeBlockContainer.js +24 -0
  24. package/dist/esm/styled/StyledCodeBlockLine.js +74 -0
  25. package/dist/esm/styled/StyledCodeBlockToken.js +44 -0
  26. package/dist/esm/styled/StyledEllipsis.js +22 -0
  27. package/dist/esm/styled/StyledFont.js +67 -0
  28. package/dist/esm/styled/StyledIcon.js +35 -0
  29. package/dist/esm/styled/StyledList.js +37 -0
  30. package/dist/esm/styled/StyledListItem.js +48 -0
  31. package/dist/esm/styled/StyledParagraph.js +23 -0
  32. package/dist/esm/types/index.js +14 -0
  33. package/dist/esm/utils/useOrderedListContext.js +18 -0
  34. package/dist/esm/utils/useUnorderedListContext.js +18 -0
  35. package/dist/index.cjs.js +39 -55
  36. package/package.json +5 -5
  37. package/dist/index.esm.js +0 -769
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { forwardRef } from 'react';
8
+ import useUnorderedListContext from '../../utils/useUnorderedListContext.js';
9
+ import '../../styled/StyledBlockquote.js';
10
+ import '../../styled/StyledCode.js';
11
+ import '../../styled/StyledCodeBlock.js';
12
+ import '../../styled/StyledCodeBlockContainer.js';
13
+ import '../../styled/StyledCodeBlockLine.js';
14
+ import '../../styled/StyledCodeBlockToken.js';
15
+ import '../../styled/StyledEllipsis.js';
16
+ import '../../styled/StyledFont.js';
17
+ import '../../styled/StyledIcon.js';
18
+ import '../../styled/StyledList.js';
19
+ import { StyledUnorderedListItem } from '../../styled/StyledListItem.js';
20
+ import '../../styled/StyledParagraph.js';
21
+
22
+ const UnorderedListItem = forwardRef((props, ref) => {
23
+ const {
24
+ size
25
+ } = useUnorderedListContext();
26
+ return React.createElement(StyledUnorderedListItem, Object.assign({
27
+ ref: ref,
28
+ space: size
29
+ }, props));
30
+ });
31
+ UnorderedListItem.displayName = 'UnorderedList.Item';
32
+ const Item = UnorderedListItem;
33
+
34
+ export { Item };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ import '../../styled/StyledBlockquote.js';
9
+ import '../../styled/StyledCode.js';
10
+ import '../../styled/StyledCodeBlock.js';
11
+ import '../../styled/StyledCodeBlockContainer.js';
12
+ import '../../styled/StyledCodeBlockLine.js';
13
+ import '../../styled/StyledCodeBlockToken.js';
14
+ import '../../styled/StyledEllipsis.js';
15
+ import '../../styled/StyledFont.js';
16
+ import { StyledIcon } from '../../styled/StyledIcon.js';
17
+ import '../../styled/StyledList.js';
18
+ import '../../styled/StyledListItem.js';
19
+ import '../../styled/StyledParagraph.js';
20
+
21
+ const IconComponent = props => React.createElement(StyledIcon, props);
22
+ IconComponent.displayName = 'Span.Icon';
23
+ const Icon = IconComponent;
24
+
25
+ export { Icon };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React, { forwardRef } from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import '../../styled/StyledBlockquote.js';
10
+ import '../../styled/StyledCode.js';
11
+ import '../../styled/StyledCodeBlock.js';
12
+ import '../../styled/StyledCodeBlockContainer.js';
13
+ import '../../styled/StyledCodeBlockLine.js';
14
+ import '../../styled/StyledCodeBlockToken.js';
15
+ import '../../styled/StyledEllipsis.js';
16
+ import { StyledFont } from '../../styled/StyledFont.js';
17
+ import '../../styled/StyledIcon.js';
18
+ import '../../styled/StyledList.js';
19
+ import '../../styled/StyledListItem.js';
20
+ import '../../styled/StyledParagraph.js';
21
+ import { StartIcon } from './StartIcon.js';
22
+ import { Icon } from './Icon.js';
23
+
24
+ const SpanComponent = forwardRef((_ref, ref) => {
25
+ let {
26
+ tag,
27
+ ...other
28
+ } = _ref;
29
+ return React.createElement(StyledFont, Object.assign({
30
+ as: tag,
31
+ ref: ref,
32
+ size: "inherit"
33
+ }, other));
34
+ });
35
+ SpanComponent.displayName = 'Span';
36
+ SpanComponent.propTypes = {
37
+ tag: PropTypes.any,
38
+ isBold: PropTypes.bool,
39
+ isMonospace: PropTypes.bool,
40
+ hue: PropTypes.string
41
+ };
42
+ SpanComponent.defaultProps = {
43
+ tag: 'span'
44
+ };
45
+ const Span = SpanComponent;
46
+ Span.Icon = Icon;
47
+ Span.StartIcon = StartIcon;
48
+
49
+ export { Span };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ import '../../styled/StyledBlockquote.js';
9
+ import '../../styled/StyledCode.js';
10
+ import '../../styled/StyledCodeBlock.js';
11
+ import '../../styled/StyledCodeBlockContainer.js';
12
+ import '../../styled/StyledCodeBlockLine.js';
13
+ import '../../styled/StyledCodeBlockToken.js';
14
+ import '../../styled/StyledEllipsis.js';
15
+ import '../../styled/StyledFont.js';
16
+ import { StyledIcon } from '../../styled/StyledIcon.js';
17
+ import '../../styled/StyledList.js';
18
+ import '../../styled/StyledListItem.js';
19
+ import '../../styled/StyledParagraph.js';
20
+
21
+ const StartIconComponent = props => React.createElement(StyledIcon, Object.assign({
22
+ isStart: true
23
+ }, props));
24
+ StartIconComponent.displayName = 'Span.StartIcon';
25
+ const StartIcon = StartIconComponent;
26
+
27
+ export { StartIcon };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ export { SM } from './elements/SM.js';
8
+ export { MD } from './elements/MD.js';
9
+ export { LG } from './elements/LG.js';
10
+ export { XL } from './elements/XL.js';
11
+ export { XXL } from './elements/XXL.js';
12
+ export { XXXL } from './elements/XXXL.js';
13
+ export { Blockquote } from './elements/Blockquote.js';
14
+ export { Code } from './elements/Code.js';
15
+ export { CodeBlock } from './elements/CodeBlock.js';
16
+ export { Ellipsis } from './elements/Ellipsis.js';
17
+ export { Paragraph } from './elements/Paragraph.js';
18
+ export { OrderedList } from './elements/lists/OrderedList.js';
19
+ export { UnorderedList } from './elements/lists/UnorderedList.js';
20
+ export { Span } from './elements/span/Span.js';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled from 'styled-components';
8
+ import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { THEME_SIZES } from './StyledFont.js';
10
+
11
+ const COMPONENT_ID = 'typography.blockquote';
12
+ const StyledBlockquote = styled.blockquote.attrs({
13
+ 'data-garden-id': COMPONENT_ID,
14
+ 'data-garden-version': '9.0.0-next.8'
15
+ }).withConfig({
16
+ displayName: "StyledBlockquote",
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
+ };
22
+
23
+ export { StyledBlockquote };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { StyledFont } from './StyledFont.js';
10
+
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);
17
+ return css(["background-color:", ";color:", ";a &{color:inherit;}"], backgroundColor, foregroundColor);
18
+ };
19
+ const StyledCode = styled(StyledFont).attrs({
20
+ 'data-garden-id': COMPONENT_ID,
21
+ 'data-garden-version': '9.0.0-next.8',
22
+ as: 'code'
23
+ }).withConfig({
24
+ displayName: "StyledCode",
25
+ componentId: "sc-l8yvmf-0"
26
+ })(["border-radius:", ";padding:1.5px;", ";", ";"], props => props.theme.borderRadii.sm, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
27
+ StyledCode.defaultProps = {
28
+ theme: DEFAULT_THEME,
29
+ isMonospace: true,
30
+ hue: 'neutralHue',
31
+ size: 'inherit'
32
+ };
33
+
34
+ export { StyledCode };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+
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);
14
+ return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
15
+ };
16
+ const StyledCodeBlock = styled.pre.attrs({
17
+ 'data-garden-id': COMPONENT_ID,
18
+ 'data-garden-version': '9.0.0-next.8'
19
+ }).withConfig({
20
+ displayName: "StyledCodeBlock",
21
+ 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
+ };
26
+
27
+ export { StyledCodeBlock };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled from 'styled-components';
8
+ import { focusStyles, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'typography.codeblock_container';
11
+ const StyledCodeBlockContainer = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.8'
14
+ }).withConfig({
15
+ displayName: "StyledCodeBlockContainer",
16
+ componentId: "sc-14zgbfw-0"
17
+ })(["transition:box-shadow 0.1s ease-in-out;overflow:auto;", " ", ";"], props => focusStyles({
18
+ theme: props.theme
19
+ }), props => retrieveComponentStyles(COMPONENT_ID, props));
20
+ StyledCodeBlockContainer.defaultProps = {
21
+ theme: DEFAULT_THEME
22
+ };
23
+
24
+ export { StyledCodeBlockContainer };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { StyledFont, THEME_SIZES } from './StyledFont.js';
10
+
11
+ const COMPONENT_ID = 'typography.codeblock_code';
12
+ const colorStyles = props => {
13
+ 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);
34
+ }
35
+ return css(["background-color:", ";"], backgroundColor);
36
+ };
37
+ const lineNumberStyles = props => {
38
+ const color = getColorV8('neutralHue', props.isLight ? 600 : 500, props.theme);
39
+ let padding;
40
+ if (props.language && props.language === 'diff') {
41
+ 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;
46
+ } else {
47
+ padding = props.theme.space.base * 6;
48
+ }
49
+ return `
50
+ &::before {
51
+ display: table-cell;
52
+ padding-right: ${padding}px;
53
+ width: 1px;
54
+ text-align: right;
55
+ color: ${color};
56
+ content: counter(linenumber);
57
+ counter-increment: linenumber;
58
+ }
59
+ `;
60
+ };
61
+ const StyledCodeBlockLine = styled(StyledFont).attrs({
62
+ 'data-garden-id': COMPONENT_ID,
63
+ 'data-garden-version': '9.0.0-next.8',
64
+ as: 'code',
65
+ isMonospace: true
66
+ }).withConfig({
67
+ displayName: "StyledCodeBlockLine",
68
+ 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
+ };
73
+
74
+ export { StyledCodeBlockLine };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { StyledCodeBlock } from './StyledCodeBlock.js';
10
+
11
+ const COMPONENT_ID = 'typography.codeblock_token';
12
+ const colorStyles = props => {
13
+ const palette = props.theme.palette;
14
+ 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']
30
+ };
31
+ 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
+ };
33
+ const StyledCodeBlockToken = styled.span.attrs({
34
+ 'data-garden-id': COMPONENT_ID,
35
+ 'data-garden-version': '9.0.0-next.8'
36
+ }).withConfig({
37
+ displayName: "StyledCodeBlockToken",
38
+ 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
+ };
43
+
44
+ export { StyledCodeBlockToken };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'typography.ellipsis';
11
+ const StyledEllipsis = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.8'
14
+ }).withConfig({
15
+ displayName: "StyledEllipsis",
16
+ componentId: "sc-1u4uqmy-0"
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
+
22
+ export { StyledEllipsis };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { hideVisually, math } from 'polished';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
10
+ import { SIZE } from '../types/index.js';
11
+
12
+ const COMPONENT_ID = 'typography.font';
13
+ [...SIZE, 'extralarge', '2xlarge', '3xlarge'];
14
+ const THEME_SIZES = {
15
+ small: 'sm',
16
+ medium: 'md',
17
+ large: 'lg',
18
+ extralarge: 'xl',
19
+ '2xlarge': 'xxl',
20
+ '3xlarge': 'xxxl'
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';
26
+ let fontSize;
27
+ let fontWeight;
28
+ let lineHeight;
29
+ let color;
30
+ if (monospace) {
31
+ if (props.size === 'inherit') {
32
+ fontSize = 'calc(1em - 1px)';
33
+ lineHeight = 'normal';
34
+ } else {
35
+ const themeSize = THEME_SIZES[props.size];
36
+ fontSize = math(`${props.theme.fontSizes[themeSize]} - 1px`);
37
+ lineHeight = math(`${props.theme.lineHeights[themeSize]} - 1px`);
38
+ }
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];
43
+ }
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;
48
+ }
49
+ if (props.hue) {
50
+ const shade = props.hue === 'yellow' ? 700 : 600;
51
+ color = getColorV8(props.hue, shade, props.theme);
52
+ }
53
+ return css(["line-height:", ";color:", ";font-family:", ";font-size:", ";font-weight:", ";direction:", ";"], lineHeight, color, fontFamily, fontSize, fontWeight, direction);
54
+ };
55
+ const StyledFont = styled.div.attrs({
56
+ 'data-garden-id': COMPONENT_ID,
57
+ 'data-garden-version': '9.0.0-next.8'
58
+ }).withConfig({
59
+ displayName: "StyledFont",
60
+ componentId: "sc-1iildbo-0"
61
+ })(["", ";&[hidden]{display:inline;", ";}", ";"], props => !props.hidden && fontStyles(props), hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
62
+ StyledFont.defaultProps = {
63
+ theme: DEFAULT_THEME,
64
+ size: 'inherit'
65
+ };
66
+
67
+ export { StyledFont, THEME_SIZES };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import React, { Children } from 'react';
9
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'typography.icon';
12
+ const sizeStyles = props => {
13
+ const margin = props.isStart && `${props.theme.space.base * 2}px`;
14
+ const size = props.theme.iconSizes.md;
15
+ return css(["margin-", ":", ";width:", ";height:", ";"], props.theme.rtl ? 'left' : 'right', margin, size, size);
16
+ };
17
+ const StyledIcon = styled(_ref => {
18
+ let {
19
+ children,
20
+ isStart,
21
+ ...props
22
+ } = _ref;
23
+ return React.cloneElement(Children.only(children), props);
24
+ }).attrs({
25
+ 'data-garden-id': COMPONENT_ID,
26
+ 'data-garden-version': '9.0.0-next.8'
27
+ }).withConfig({
28
+ displayName: "StyledIcon",
29
+ componentId: "sc-10rfb5b-0"
30
+ })(["position:relative;top:-1px;vertical-align:middle;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
31
+ StyledIcon.defaultProps = {
32
+ theme: DEFAULT_THEME
33
+ };
34
+
35
+ export { StyledIcon };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const listStyles = props => {
11
+ const rtl = props.theme.rtl;
12
+ return css(["direction:", ";margin:0;margin-", ":24px;padding:0;list-style-position:outside;list-style-type:", ";"], rtl ? 'rtl' : 'ltr', rtl ? 'right' : 'left', props.listType);
13
+ };
14
+ const ORDERED_ID = 'typography.ordered_list';
15
+ const StyledOrderedList = styled.ol.attrs({
16
+ 'data-garden-id': ORDERED_ID,
17
+ 'data-garden-version': '9.0.0-next.8'
18
+ }).withConfig({
19
+ displayName: "StyledList__StyledOrderedList",
20
+ componentId: "sc-jdbsfi-0"
21
+ })(["", ";", ";"], props => listStyles(props), props => retrieveComponentStyles(ORDERED_ID, props));
22
+ StyledOrderedList.defaultProps = {
23
+ theme: DEFAULT_THEME
24
+ };
25
+ const UNORDERED_ID = 'typography.unordered_list';
26
+ const StyledUnorderedList = styled.ul.attrs({
27
+ 'data-garden-id': UNORDERED_ID,
28
+ 'data-garden-version': '9.0.0-next.8'
29
+ }).withConfig({
30
+ displayName: "StyledList__StyledUnorderedList",
31
+ componentId: "sc-jdbsfi-1"
32
+ })(["", ";", ";"], props => listStyles(props), props => retrieveComponentStyles(UNORDERED_ID, props));
33
+ StyledUnorderedList.defaultProps = {
34
+ theme: DEFAULT_THEME
35
+ };
36
+
37
+ export { StyledOrderedList, StyledUnorderedList };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { math } from 'polished';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
10
+ import { StyledOrderedList, StyledUnorderedList } from './StyledList.js';
11
+ import { StyledFont } from './StyledFont.js';
12
+
13
+ const listItemPaddingStyles = props => {
14
+ const base = props.theme.space.base;
15
+ const paddingTop = props.space === 'large' ? `${base * 2}px` : `${base}px`;
16
+ return css(["padding-top:", ";", " > &:first-child,", " > &:first-child{padding-top:0;}", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child{padding-top:", ";}"], paddingTop, StyledOrderedList, StyledUnorderedList, StyledOrderedList, StyledOrderedList, StyledOrderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, paddingTop);
17
+ };
18
+ const listItemStyles = props => {
19
+ return css(["line-height:", ";", ";"], getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props.space !== 'small' && listItemPaddingStyles(props));
20
+ };
21
+ const ORDERED_ID = 'typography.ordered_list_item';
22
+ const StyledOrderedListItem = styled(StyledFont).attrs({
23
+ 'data-garden-id': ORDERED_ID,
24
+ 'data-garden-version': '9.0.0-next.8',
25
+ as: 'li'
26
+ }).withConfig({
27
+ displayName: "StyledListItem__StyledOrderedListItem",
28
+ componentId: "sc-9rsipg-0"
29
+ })(["margin-", ":", ";padding-", ":", ";", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * -1px`), props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 1px`), props => listItemStyles(props), props => retrieveComponentStyles(ORDERED_ID, props));
30
+ StyledOrderedListItem.defaultProps = {
31
+ space: 'medium',
32
+ theme: DEFAULT_THEME
33
+ };
34
+ const UNORDERED_ID = 'typography.unordered_list_item';
35
+ const StyledUnorderedListItem = styled(StyledFont).attrs({
36
+ 'data-garden-id': UNORDERED_ID,
37
+ 'data-garden-version': '9.0.0-next.8',
38
+ as: 'li'
39
+ }).withConfig({
40
+ displayName: "StyledListItem__StyledUnorderedListItem",
41
+ componentId: "sc-9rsipg-1"
42
+ })(["", ";", ";"], props => listItemStyles(props), props => retrieveComponentStyles(UNORDERED_ID, props));
43
+ StyledUnorderedListItem.defaultProps = {
44
+ space: 'medium',
45
+ theme: DEFAULT_THEME
46
+ };
47
+
48
+ export { StyledOrderedListItem, StyledUnorderedListItem };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { THEME_SIZES } from './StyledFont.js';
10
+
11
+ const COMPONENT_ID = 'typography.paragraph';
12
+ const StyledParagraph = styled.p.attrs({
13
+ 'data-garden-id': COMPONENT_ID,
14
+ 'data-garden-version': '9.0.0-next.8'
15
+ }).withConfig({
16
+ displayName: "StyledParagraph",
17
+ componentId: "sc-zkuftz-0"
18
+ })(["margin:0;padding:0;direction:", ";& + &,blockquote + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.lineHeights[THEME_SIZES[props.size]], props => retrieveComponentStyles(COMPONENT_ID, props));
19
+ StyledParagraph.defaultProps = {
20
+ theme: DEFAULT_THEME
21
+ };
22
+
23
+ export { StyledParagraph };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ const HUE = ['grey', 'red', 'green', 'yellow'];
8
+ const SIZE = ['small', 'medium', 'large'];
9
+ const INHERIT_SIZE = ['inherit', ...SIZE];
10
+ const TYPE_ORDERED_LIST = ['decimal', 'decimal-leading-zero', 'lower-alpha', 'lower-roman', 'upper-alpha', 'upper-roman'];
11
+ const TYPE_UNORDERED_LIST = ['circle', 'disc', 'square'];
12
+ const LANGUAGES = ['markup', 'bash', 'clike', 'c', 'cpp', 'css', 'javascript', 'jsx', 'coffeescript', 'actionscript', 'css-extr', 'diff', 'git', 'go', 'graphql', 'handlebars', 'json', 'less', 'makefile', 'markdown', 'objectivec', 'ocaml', 'python', 'reason', 'sass', 'scss', 'sql', 'stylus', 'tsx', 'typescript', 'wasm', 'yaml'];
13
+
14
+ export { HUE, INHERIT_SIZE, LANGUAGES, SIZE, TYPE_ORDERED_LIST, TYPE_UNORDERED_LIST };