@capillarytech/blaze-ui 0.1.6-alpha.66 → 0.1.6-alpha.67
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/CapLabel/styles.js
CHANGED
|
@@ -6,7 +6,7 @@ export const StyledLabelDiv = styled.div`
|
|
|
6
6
|
font-size: ${({ typeStyles }) => typeStyles?.fontSize || '0.857rem'};
|
|
7
7
|
font-weight: ${({ typeStyles, fontWeight }) => fontWeight || typeStyles?.fontWeight || styledVars.FONT_WEIGHT_REGULAR};
|
|
8
8
|
color: ${({ typeStyles }) => typeStyles?.color || styledVars.CAP_G04};
|
|
9
|
-
line-height: ${({ typeStyles, lineHeight }) => lineHeight || typeStyles?.lineHeight ||
|
|
9
|
+
line-height: ${({ typeStyles, lineHeight }) => lineHeight || typeStyles?.lineHeight || styledVars.NORMAL_LINE_HEIGHT};
|
|
10
10
|
margin: 0;
|
|
11
11
|
padding: 0;
|
|
12
12
|
`;
|
|
@@ -16,7 +16,7 @@ export const StyledLabelSpan = styled.span`
|
|
|
16
16
|
font-size: ${({ typeStyles }) => typeStyles?.fontSize || '0.857rem'};
|
|
17
17
|
font-weight: ${({ typeStyles, fontWeight }) => fontWeight || typeStyles?.fontWeight || styledVars.FONT_WEIGHT_REGULAR};
|
|
18
18
|
color: ${({ typeStyles }) => typeStyles?.color || styledVars.CAP_G04};
|
|
19
|
-
line-height: ${({ typeStyles, lineHeight }) => lineHeight || typeStyles?.lineHeight ||
|
|
19
|
+
line-height: ${({ typeStyles, lineHeight }) => lineHeight || typeStyles?.lineHeight || styledVars.NORMAL_LINE_HEIGHT};
|
|
20
20
|
margin: 0;
|
|
21
21
|
padding: 0;
|
|
22
22
|
`;
|
|
@@ -44,28 +44,20 @@ const CapTooltipWithInfo = ({
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
CapTooltipWithInfo.propTypes = {
|
|
47
|
-
/** Content to display in the tooltip */
|
|
48
47
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
49
|
-
/** Size of the info icon */
|
|
50
48
|
iconSize: PropTypes.oneOf(['xs', 's', 'm', 'l']),
|
|
51
|
-
/** Type of icon to display */
|
|
52
49
|
iconType: PropTypes.string,
|
|
53
|
-
/** Placement of the tooltip relative to the icon */
|
|
54
50
|
placement: PropTypes.oneOf([
|
|
55
51
|
'top', 'left', 'right', 'bottom',
|
|
56
52
|
'topLeft', 'topRight', 'bottomLeft', 'bottomRight',
|
|
57
53
|
'leftTop', 'leftBottom', 'rightTop', 'rightBottom',
|
|
58
54
|
]),
|
|
59
|
-
/** How the tooltip is triggered */
|
|
60
55
|
trigger: PropTypes.oneOfType([
|
|
61
56
|
PropTypes.string,
|
|
62
57
|
PropTypes.arrayOf(PropTypes.string),
|
|
63
58
|
]),
|
|
64
|
-
/** Additional class name */
|
|
65
59
|
className: PropTypes.string,
|
|
66
|
-
/** Additional props passed to the CapTooltip component */
|
|
67
60
|
tooltipProps: PropTypes.object,
|
|
68
|
-
/** Additional props passed to the CapIcon component */
|
|
69
61
|
iconProps: PropTypes.object,
|
|
70
62
|
};
|
|
71
63
|
|
|
@@ -9,6 +9,13 @@ import withStyles from '../utils/withStyles';
|
|
|
9
9
|
import withMemo from '../utils/withMemo';
|
|
10
10
|
import { HeaderWrapper, selectStyles } from './styles';
|
|
11
11
|
|
|
12
|
+
const SELECT_TYPES = {
|
|
13
|
+
SELECT: 'select',
|
|
14
|
+
MULTI_SELECT: 'multiSelect',
|
|
15
|
+
TREE_SELECT: 'treeSelect',
|
|
16
|
+
MULTI_TREE_SELECT: 'multiTreeSelect'
|
|
17
|
+
};
|
|
18
|
+
|
|
12
19
|
const StyledTreeSelect = styled(TreeSelect)`
|
|
13
20
|
${selectStyles}
|
|
14
21
|
`;
|
|
@@ -168,8 +175,8 @@ const CapUnifiedSelect = ({
|
|
|
168
175
|
if (!isEqual) setTempValue(value);
|
|
169
176
|
}, [value]);
|
|
170
177
|
|
|
171
|
-
const isMulti = useMemo(() => type ===
|
|
172
|
-
const isTree = useMemo(() => type ===
|
|
178
|
+
const isMulti = useMemo(() => type === SELECT_TYPES.MULTI_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
|
|
179
|
+
const isTree = useMemo(() => type === SELECT_TYPES.TREE_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
|
|
173
180
|
|
|
174
181
|
const dataSource = useMemo(() => {
|
|
175
182
|
if (!options?.length) return [];
|
|
@@ -396,7 +403,7 @@ const CapUnifiedSelect = ({
|
|
|
396
403
|
</div>
|
|
397
404
|
)}
|
|
398
405
|
|
|
399
|
-
{(type ===
|
|
406
|
+
{(type === SELECT_TYPES.SELECT || type === SELECT_TYPES.TREE_SELECT) && (
|
|
400
407
|
<CapRow className="cap-unified-select-tree-clear-container" onClick={handleClearAll}>
|
|
401
408
|
<CapLabel className="cap-unified-select-tree-clear-label">{clearText}</CapLabel>
|
|
402
409
|
</CapRow>
|
|
@@ -471,7 +478,7 @@ const CapUnifiedSelect = ({
|
|
|
471
478
|
{...rest}
|
|
472
479
|
/>
|
|
473
480
|
{isError && (
|
|
474
|
-
<CapLabel className="cap-unified-select-status" style={{ color:
|
|
481
|
+
<CapLabel className="cap-unified-select-status" style={{ color: styledVars.CAP_RED }}>
|
|
475
482
|
{errorMessage}
|
|
476
483
|
</CapLabel>
|
|
477
484
|
)}
|
|
@@ -480,7 +487,7 @@ const CapUnifiedSelect = ({
|
|
|
480
487
|
};
|
|
481
488
|
|
|
482
489
|
CapUnifiedSelect.propTypes = {
|
|
483
|
-
type: PropTypes.oneOf(
|
|
490
|
+
type: PropTypes.oneOf(Object.values(SELECT_TYPES)),
|
|
484
491
|
options: PropTypes.array,
|
|
485
492
|
value: PropTypes.any,
|
|
486
493
|
containerClassName: PropTypes.string,
|
|
@@ -509,7 +516,7 @@ CapUnifiedSelect.propTypes = {
|
|
|
509
516
|
};
|
|
510
517
|
|
|
511
518
|
CapUnifiedSelect.defaultProps = {
|
|
512
|
-
type:
|
|
519
|
+
type: SELECT_TYPES.SELECT,
|
|
513
520
|
placeholder: 'Select an option',
|
|
514
521
|
searchBasedOn: 'label',
|
|
515
522
|
noResultCustomText: 'No results found',
|
|
@@ -75,7 +75,6 @@ export const selectStyles = css`
|
|
|
75
75
|
|
|
76
76
|
.cap-unified-tree-select {
|
|
77
77
|
min-width: 14.286rem;
|
|
78
|
-
margin-top: 0.571rem;
|
|
79
78
|
|
|
80
79
|
&.cap-unified-tree-select-readonly {
|
|
81
80
|
pointer-events: none;
|
|
@@ -124,7 +123,7 @@ export const selectStyles = css`
|
|
|
124
123
|
align-self: center;
|
|
125
124
|
}
|
|
126
125
|
.cap-unified-tree-select .ant-select-selector:focus {
|
|
127
|
-
border:
|
|
126
|
+
border: 0.071rem solid ${styledVars.CAP_G11};
|
|
128
127
|
}
|
|
129
128
|
.cap-unified-tree-select .ant-select-tree-treenode {
|
|
130
129
|
padding-left: ${styledVars.SPACING_04};
|
|
@@ -136,7 +135,7 @@ export const selectStyles = css`
|
|
|
136
135
|
|
|
137
136
|
/* Common styles for all types */
|
|
138
137
|
&.custom-popup-container {
|
|
139
|
-
width: max-content
|
|
138
|
+
width: max-content;
|
|
140
139
|
|
|
141
140
|
.ant-select-tree {
|
|
142
141
|
.ant-select-tree-node-content-wrapper {
|
|
@@ -191,7 +190,7 @@ export const selectStyles = css`
|
|
|
191
190
|
}
|
|
192
191
|
.ant-select-tree-node-content-wrapper {
|
|
193
192
|
border-radius: 0;
|
|
194
|
-
padding-left:
|
|
193
|
+
padding-left: 0.214rem;
|
|
195
194
|
}
|
|
196
195
|
.ant-select-tree-indent {
|
|
197
196
|
margin-left: ${styledVars.SPACING_12};
|
package/package.json
CHANGED
package/styled/variables.js
CHANGED