@capillarytech/blaze-ui 0.1.6-alpha.42 → 0.1.6-alpha.43

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.
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
4
+ import { CapTooltip, CapIcon } from '../';
5
+ import withStyles from '../utils/withStyles';
6
+ import { tooltipWithInfoStyles } from './styles';
7
+
8
+ /**
9
+ * CapTooltipWithInfo - A component that combines an info icon with a tooltip
10
+ * for displaying additional information on hover or other trigger events.
11
+ */
12
+ const CapTooltipWithInfo = ({
13
+ title,
14
+ iconSize = 's',
15
+ iconType = 'info-circle',
16
+ placement = 'top',
17
+ trigger = 'hover',
18
+ className = '',
19
+ tooltipProps = {},
20
+ iconProps = {},
21
+ ...rest
22
+ }) => {
23
+ return (
24
+ <span
25
+ className={classnames('cap-tooltip-with-info', className)}
26
+ {...rest}
27
+ >
28
+ <CapTooltip
29
+ title={title}
30
+ placement={placement}
31
+ trigger={trigger}
32
+ {...tooltipProps}
33
+ >
34
+ <span className="cap-tooltip-with-info-icon">
35
+ <CapIcon
36
+ type={iconType}
37
+ size={iconSize}
38
+ {...iconProps}
39
+ />
40
+ </span>
41
+ </CapTooltip>
42
+ </span>
43
+ );
44
+ };
45
+
46
+ CapTooltipWithInfo.propTypes = {
47
+ /** Content to display in the tooltip */
48
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
49
+ /** Size of the info icon */
50
+ iconSize: PropTypes.oneOf(['xs', 's', 'm', 'l']),
51
+ /** Type of icon to display */
52
+ iconType: PropTypes.string,
53
+ /** Placement of the tooltip relative to the icon */
54
+ placement: PropTypes.oneOf([
55
+ 'top', 'left', 'right', 'bottom',
56
+ 'topLeft', 'topRight', 'bottomLeft', 'bottomRight',
57
+ 'leftTop', 'leftBottom', 'rightTop', 'rightBottom',
58
+ ]),
59
+ /** How the tooltip is triggered */
60
+ trigger: PropTypes.oneOfType([
61
+ PropTypes.string,
62
+ PropTypes.arrayOf(PropTypes.string),
63
+ ]),
64
+ /** Additional class name */
65
+ className: PropTypes.string,
66
+ /** Additional props passed to the CapTooltip component */
67
+ tooltipProps: PropTypes.object,
68
+ /** Additional props passed to the CapIcon component */
69
+ iconProps: PropTypes.object,
70
+ };
71
+
72
+ CapTooltipWithInfo.defaultProps = {
73
+ iconSize: 's',
74
+ iconType: 'info-circle',
75
+ placement: 'top',
76
+ trigger: 'hover',
77
+ className: '',
78
+ tooltipProps: {},
79
+ iconProps: {},
80
+ };
81
+
82
+ export default withStyles(CapTooltipWithInfo, tooltipWithInfoStyles);
@@ -0,0 +1,3 @@
1
+ import CapTooltipWithInfo from './CapTooltipWithInfo';
2
+
3
+ export default CapTooltipWithInfo;
@@ -0,0 +1,22 @@
1
+ import { css } from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+
4
+ export const tooltipWithInfoStyles = css`
5
+ &.cap-tooltip-with-info {
6
+ display: inline-flex;
7
+ align-items: center;
8
+ cursor: default;
9
+
10
+ .cap-tooltip-with-info-icon {
11
+ color: ${styledVars.CAP_G06};
12
+ margin-left: 4px;
13
+ cursor: help;
14
+
15
+ &:hover {
16
+ color: ${styledVars.CAP_G07};
17
+ }
18
+ }
19
+ }
20
+ `;
21
+
22
+ export default tooltipWithInfoStyles;
@@ -5,9 +5,9 @@ import classnames from 'classnames';
5
5
  import { TreeSelect, Input, Button } from 'antd-v5';
6
6
  import styled from 'styled-components';
7
7
  import * as styledVars from '../styled/variables';
8
- import { CapLabel, CapTooltip, CapRow, CapIcon } from '../';
8
+ import { CapLabel, CapTooltipWithInfo, CapRow, CapIcon } from '../';
9
9
  import withStyles from '../utils/withStyles';
10
- import { SelectWrapper, selectStyles } from './styles';
10
+ import { SelectWrapper, HeaderWrapper, selectStyles } from './styles';
11
11
 
12
12
  const StyledTreeSelect = styled(TreeSelect)`
13
13
  ${selectStyles}
@@ -157,18 +157,16 @@ const CapUnifiedSelect = ({
157
157
  if (!headerLabel && !tooltip) return null;
158
158
  return (
159
159
  <>
160
- <CapRow
161
- className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header')}
162
- align="middle"
163
- gap={8}
164
- >
160
+ <HeaderWrapper className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header')}>
165
161
  {headerLabel && <CapLabel type="label16" className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header-label')}>{headerLabel}</CapLabel>}
166
162
  {tooltip && (
167
- <CapTooltip title={tooltip} className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header-tooltip')}>
168
- <CapIcon type="info-circle" size="s" />
169
- </CapTooltip>
163
+ <CapTooltipWithInfo
164
+ title={tooltip}
165
+ className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header-tooltip')}
166
+ iconProps={{ disabled }}
167
+ />
170
168
  )}
171
- </CapRow>
169
+ </HeaderWrapper>
172
170
  <div className="cap-unified-select-header-byline-text">
173
171
  {bylineText && <CapLabel className={classnames(disabled ? 'disabled' : '', 'cap-unified-select-header-byline-text')}>{bylineText}</CapLabel>}
174
172
  </div>
package/index.js CHANGED
@@ -7,6 +7,7 @@ export { default as CapSkeleton } from './CapSkeleton';
7
7
  export { default as CapSpin } from './CapSpin';
8
8
  export { default as CapTable } from './CapTable';
9
9
  export { default as CapTooltip } from './CapTooltip';
10
+ export { default as CapTooltipWithInfo } from './CapTooltipWithInfo';
10
11
  export { default as CapUnifiedSelect } from './CapUnifiedSelect';
11
12
 
12
13
  // Export utilities
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/blaze-ui",
3
3
  "author": "Capillary Technologies",
4
- "version": "0.1.6-alpha.42",
4
+ "version": "0.1.6-alpha.43",
5
5
  "description": "Capillary UI component library with Ant Design v5",
6
6
  "main": "./index.js",
7
7
  "sideEffects": [