@zendeskgarden/react-typography 9.0.0-next.2 → 9.0.0-next.20
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/esm/elements/Blockquote.js +34 -0
- package/dist/esm/elements/Code.js +43 -0
- package/dist/esm/elements/CodeBlock.js +124 -0
- package/dist/esm/elements/Ellipsis.js +50 -0
- package/dist/esm/elements/LG.js +43 -0
- package/dist/esm/elements/MD.js +43 -0
- package/dist/esm/elements/Paragraph.js +34 -0
- package/dist/esm/elements/SM.js +43 -0
- package/dist/esm/elements/XL.js +42 -0
- package/dist/esm/elements/XXL.js +42 -0
- package/dist/esm/elements/XXXL.js +42 -0
- package/dist/esm/elements/lists/OrderedList.js +53 -0
- package/dist/esm/elements/lists/OrderedListItem.js +34 -0
- package/dist/esm/elements/lists/UnorderedList.js +53 -0
- package/dist/esm/elements/lists/UnorderedListItem.js +34 -0
- package/dist/esm/elements/span/Icon.js +25 -0
- package/dist/esm/elements/span/Span.js +49 -0
- package/dist/esm/elements/span/StartIcon.js +27 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/styled/StyledBlockquote.js +26 -0
- package/dist/esm/styled/StyledCode.js +66 -0
- package/dist/esm/styled/StyledCodeBlock.js +36 -0
- package/dist/esm/styled/StyledCodeBlockContainer.js +24 -0
- package/dist/esm/styled/StyledCodeBlockLine.js +100 -0
- package/dist/esm/styled/StyledCodeBlockToken.js +183 -0
- package/dist/esm/styled/StyledEllipsis.js +22 -0
- package/dist/esm/styled/StyledFont.js +76 -0
- package/dist/esm/styled/StyledIcon.js +27 -0
- package/dist/esm/styled/StyledList.js +37 -0
- package/dist/esm/styled/StyledListItem.js +48 -0
- package/dist/esm/styled/StyledParagraph.js +23 -0
- package/dist/esm/types/index.js +14 -0
- package/dist/esm/utils/useOrderedListContext.js +18 -0
- package/dist/esm/utils/useUnorderedListContext.js +18 -0
- package/dist/index.cjs.js +377 -162
- package/dist/typings/elements/span/Icon.d.ts +3 -3
- package/dist/typings/elements/span/StartIcon.d.ts +3 -3
- package/dist/typings/styled/StyledCode.d.ts +3 -2
- package/dist/typings/styled/StyledCodeBlock.d.ts +1 -4
- package/dist/typings/styled/StyledCodeBlockLine.d.ts +0 -5
- package/dist/typings/styled/StyledCodeBlockToken.d.ts +1 -4
- package/dist/typings/styled/StyledIcon.d.ts +3 -3
- package/dist/typings/types/index.d.ts +1 -1
- package/package.json +10 -9
- package/dist/index.esm.js +0 -769
|
@@ -0,0 +1,53 @@
|
|
|
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, useMemo } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { Item } from './UnorderedListItem.js';
|
|
10
|
+
import { SIZE, TYPE_UNORDERED_LIST } from '../../types/index.js';
|
|
11
|
+
import { UnorderedListContext } from '../../utils/useUnorderedListContext.js';
|
|
12
|
+
import '../../styled/StyledBlockquote.js';
|
|
13
|
+
import '../../styled/StyledCode.js';
|
|
14
|
+
import '../../styled/StyledCodeBlock.js';
|
|
15
|
+
import '../../styled/StyledCodeBlockContainer.js';
|
|
16
|
+
import '../../styled/StyledCodeBlockLine.js';
|
|
17
|
+
import '../../styled/StyledCodeBlockToken.js';
|
|
18
|
+
import '../../styled/StyledEllipsis.js';
|
|
19
|
+
import '../../styled/StyledFont.js';
|
|
20
|
+
import '../../styled/StyledIcon.js';
|
|
21
|
+
import { StyledUnorderedList } from '../../styled/StyledList.js';
|
|
22
|
+
import '../../styled/StyledListItem.js';
|
|
23
|
+
import '../../styled/StyledParagraph.js';
|
|
24
|
+
|
|
25
|
+
const UnorderedListComponent = forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
size,
|
|
28
|
+
type,
|
|
29
|
+
...other
|
|
30
|
+
} = _ref;
|
|
31
|
+
const value = useMemo(() => ({
|
|
32
|
+
size: size
|
|
33
|
+
}), [size]);
|
|
34
|
+
return React.createElement(UnorderedListContext.Provider, {
|
|
35
|
+
value: value
|
|
36
|
+
}, React.createElement(StyledUnorderedList, Object.assign({
|
|
37
|
+
ref: ref,
|
|
38
|
+
listType: type
|
|
39
|
+
}, other)));
|
|
40
|
+
});
|
|
41
|
+
UnorderedListComponent.displayName = 'UnorderedList';
|
|
42
|
+
UnorderedListComponent.propTypes = {
|
|
43
|
+
size: PropTypes.oneOf(SIZE),
|
|
44
|
+
type: PropTypes.oneOf(TYPE_UNORDERED_LIST)
|
|
45
|
+
};
|
|
46
|
+
UnorderedListComponent.defaultProps = {
|
|
47
|
+
size: 'medium',
|
|
48
|
+
type: 'disc'
|
|
49
|
+
};
|
|
50
|
+
const UnorderedList = UnorderedListComponent;
|
|
51
|
+
UnorderedList.Item = Item;
|
|
52
|
+
|
|
53
|
+
export { UnorderedList };
|
|
@@ -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,26 @@
|
|
|
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 { getColor, 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.20'
|
|
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 => 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
|
+
StyledBlockquote.defaultProps = {
|
|
23
|
+
theme: DEFAULT_THEME
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { StyledBlockquote };
|
|
@@ -0,0 +1,66 @@
|
|
|
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, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledFont } from './StyledFont.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'typography.code';
|
|
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);
|
|
49
|
+
return css(["background-color:", ";color:", ";a &{color:inherit;}"], backgroundColor, foregroundColor);
|
|
50
|
+
};
|
|
51
|
+
const StyledCode = styled(StyledFont).attrs({
|
|
52
|
+
'data-garden-id': COMPONENT_ID,
|
|
53
|
+
'data-garden-version': '9.0.0-next.20',
|
|
54
|
+
as: 'code',
|
|
55
|
+
isMonospace: true
|
|
56
|
+
}).withConfig({
|
|
57
|
+
displayName: "StyledCode",
|
|
58
|
+
componentId: "sc-l8yvmf-0"
|
|
59
|
+
})(["border-radius:", ";padding:1.5px;", ";", ";"], props => props.theme.borderRadii.sm, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
60
|
+
StyledCode.defaultProps = {
|
|
61
|
+
theme: DEFAULT_THEME,
|
|
62
|
+
hue: 'grey',
|
|
63
|
+
size: 'inherit'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { StyledCode };
|
|
@@ -0,0 +1,36 @@
|
|
|
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, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'typography.codeblock';
|
|
11
|
+
const colorStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const backgroundColor = getColor({
|
|
16
|
+
theme,
|
|
17
|
+
variable: theme.colors.base === 'light' ? 'background.subtle' : 'background.default'
|
|
18
|
+
});
|
|
19
|
+
const foregroundColor = getColor({
|
|
20
|
+
theme,
|
|
21
|
+
variable: 'foreground.default'
|
|
22
|
+
});
|
|
23
|
+
return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
|
|
24
|
+
};
|
|
25
|
+
const StyledCodeBlock = styled.pre.attrs({
|
|
26
|
+
'data-garden-id': COMPONENT_ID,
|
|
27
|
+
'data-garden-version': '9.0.0-next.20'
|
|
28
|
+
}).withConfig({
|
|
29
|
+
displayName: "StyledCodeBlock",
|
|
30
|
+
componentId: "sc-5wky57-0"
|
|
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));
|
|
32
|
+
StyledCodeBlock.defaultProps = {
|
|
33
|
+
theme: DEFAULT_THEME
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
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.20'
|
|
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,100 @@
|
|
|
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, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledFont, THEME_SIZES } from './StyledFont.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'typography.codeblock_code';
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
diff,
|
|
16
|
+
isHighlighted
|
|
17
|
+
} = _ref;
|
|
18
|
+
let backgroundColor;
|
|
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
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return css(["background-color:", ";"], backgroundColor);
|
|
51
|
+
};
|
|
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
|
+
});
|
|
65
|
+
let padding;
|
|
66
|
+
if (language && language === 'diff') {
|
|
67
|
+
padding = 0;
|
|
68
|
+
} else if (size === 'small') {
|
|
69
|
+
padding = theme.space.base * 4;
|
|
70
|
+
} else if (size === 'large') {
|
|
71
|
+
padding = theme.space.base * 7;
|
|
72
|
+
} else {
|
|
73
|
+
padding = theme.space.base * 6;
|
|
74
|
+
}
|
|
75
|
+
return `
|
|
76
|
+
&::before {
|
|
77
|
+
display: table-cell;
|
|
78
|
+
padding-right: ${padding}px;
|
|
79
|
+
width: 1px;
|
|
80
|
+
text-align: right;
|
|
81
|
+
color: ${color};
|
|
82
|
+
content: counter(linenumber);
|
|
83
|
+
counter-increment: linenumber;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
};
|
|
87
|
+
const StyledCodeBlockLine = styled(StyledFont).attrs({
|
|
88
|
+
'data-garden-id': COMPONENT_ID,
|
|
89
|
+
'data-garden-version': '9.0.0-next.20',
|
|
90
|
+
as: 'code',
|
|
91
|
+
isMonospace: true
|
|
92
|
+
}).withConfig({
|
|
93
|
+
displayName: "StyledCodeBlockLine",
|
|
94
|
+
componentId: "sc-1goay17-0"
|
|
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));
|
|
96
|
+
StyledCodeBlockLine.defaultProps = {
|
|
97
|
+
theme: DEFAULT_THEME
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { StyledCodeBlockLine };
|
|
@@ -0,0 +1,183 @@
|
|
|
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, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledCodeBlock } from './StyledCodeBlock.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'typography.codeblock_token';
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
const colors = {
|
|
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
|
+
})
|
|
169
|
+
};
|
|
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);
|
|
171
|
+
};
|
|
172
|
+
const StyledCodeBlockToken = styled.span.attrs({
|
|
173
|
+
'data-garden-id': COMPONENT_ID,
|
|
174
|
+
'data-garden-version': '9.0.0-next.20'
|
|
175
|
+
}).withConfig({
|
|
176
|
+
displayName: "StyledCodeBlockToken",
|
|
177
|
+
componentId: "sc-1hkshdq-0"
|
|
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));
|
|
179
|
+
StyledCodeBlockToken.defaultProps = {
|
|
180
|
+
theme: DEFAULT_THEME
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
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.20'
|
|
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 };
|