@capillarytech/blaze-ui 0.1.5 → 0.1.6-alpha.1

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 (40) hide show
  1. package/CapHeading/CapHeading.js +71 -0
  2. package/CapHeading/index.js +1 -0
  3. package/CapHeading/styles.js +125 -0
  4. package/CapInfoNote/CapInfoNote.js +54 -0
  5. package/CapInfoNote/index.js +1 -0
  6. package/CapInfoNote/styles.js +63 -0
  7. package/CapLabel/CapLabel.js +106 -0
  8. package/CapLabel/index.js +1 -0
  9. package/CapLabel/styles.js +221 -0
  10. package/CapRow/CapRow.js +22 -0
  11. package/CapRow/index.js +1 -0
  12. package/CapRow/styles.js +9 -0
  13. package/CapTooltip/CapTooltip.js +36 -0
  14. package/CapTooltip/index.js +1 -0
  15. package/CapTooltip/styles.js +42 -0
  16. package/CapUnifiedSelect/CapUnifiedSelect.js +90 -128
  17. package/CapUnifiedSelect/styles.js +42 -1
  18. package/dist/esm/CapHeading/CapHeading.js +41 -0
  19. package/dist/esm/CapHeading/index.js +1 -0
  20. package/dist/esm/CapHeading/styles.js +123 -0
  21. package/dist/esm/CapInfoNote/CapInfoNote.js +62 -0
  22. package/dist/esm/CapInfoNote/index.js +1 -0
  23. package/dist/esm/CapInfoNote/styles.js +6 -0
  24. package/dist/esm/CapLabel/CapLabel.js +50 -0
  25. package/dist/esm/CapLabel/index.js +1 -0
  26. package/dist/esm/CapLabel/styles.js +219 -0
  27. package/dist/esm/CapRow/CapRow.js +22 -0
  28. package/dist/esm/CapRow/index.js +1 -0
  29. package/dist/esm/CapRow/styles.js +5 -0
  30. package/dist/esm/CapTooltip/CapTooltip.js +34 -0
  31. package/dist/esm/CapTooltip/index.js +1 -0
  32. package/dist/esm/CapTooltip/styles.js +6 -0
  33. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +82 -132
  34. package/dist/esm/CapUnifiedSelect/styles.js +13 -1
  35. package/dist/esm/styled/index.js +0 -4
  36. package/dist/esm/styled/variables.js +50 -15
  37. package/dist/index.js +1 -1
  38. package/package.json +1 -1
  39. package/styled/index.js +1 -6
  40. package/styled/variables.js +49 -14
@@ -0,0 +1 @@
1
+ export { default } from './CapLabel';
@@ -0,0 +1,219 @@
1
+ import styled, { css } from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ var labels = {
4
+ label1: {
5
+ color: styledVars.CAP_G04,
6
+ fontSize: '12px',
7
+ fontWeight: 'normal',
8
+ lineHeight: 'normal'
9
+ },
10
+ label2: {
11
+ color: styledVars.CAP_G01,
12
+ fontSize: '12px',
13
+ fontWeight: 'normal',
14
+ lineHeight: 'normal'
15
+ },
16
+ label3: {
17
+ color: styledVars.CAP_G05,
18
+ fontSize: '12px',
19
+ fontWeight: 'normal',
20
+ lineHeight: 'normal'
21
+ },
22
+ label4: {
23
+ color: styledVars.CAP_G01,
24
+ fontSize: '12px',
25
+ fontWeight: '500',
26
+ lineHeight: 'normal'
27
+ },
28
+ label5: {
29
+ color: styledVars.CAP_G01,
30
+ fontSize: '10px',
31
+ fontWeight: 'normal',
32
+ lineHeight: 'normal'
33
+ },
34
+ label6: {
35
+ color: styledVars.CAP_G06,
36
+ fontSize: '12px',
37
+ fontWeight: 'normal',
38
+ lineHeight: 'normal'
39
+ },
40
+ label7: {
41
+ color: styledVars.CAP_G04,
42
+ fontSize: '14px',
43
+ fontWeight: '500',
44
+ lineHeight: 'normal'
45
+ },
46
+ label8: {
47
+ color: styledVars.CAP_G01,
48
+ fontSize: '12px',
49
+ fontWeight: '500',
50
+ lineHeight: 'normal'
51
+ },
52
+ label9: {
53
+ color: styledVars.CAP_G01,
54
+ fontSize: '12px',
55
+ fontWeight: 'normal',
56
+ lineHeight: '16px'
57
+ },
58
+ label10: {
59
+ color: styledVars.CAP_WHITE,
60
+ fontSize: '12px',
61
+ fontWeight: 'normal',
62
+ lineHeight: '16px'
63
+ },
64
+ label11: {
65
+ color: styledVars.CAP_G04,
66
+ fontSize: '10px',
67
+ fontWeight: 'normal',
68
+ lineHeight: 'normal'
69
+ },
70
+ label12: {
71
+ color: styledVars.CAP_WHITE,
72
+ fontSize: '12px',
73
+ fontWeight: 'normal',
74
+ lineHeight: 'normal'
75
+ },
76
+ label13: {
77
+ color: styledVars.CAP_G05,
78
+ fontSize: '10px',
79
+ fontWeight: 'normal',
80
+ lineHeight: 'normal'
81
+ },
82
+ label14: {
83
+ color: styledVars.CAP_G03,
84
+ fontSize: '14px',
85
+ fontWeight: 'normal',
86
+ lineHeight: 'normal'
87
+ },
88
+ label15: {
89
+ color: styledVars.CAP_G01,
90
+ fontSize: '14px',
91
+ fontWeight: 'normal',
92
+ lineHeight: 'normal'
93
+ },
94
+ label16: {
95
+ color: styledVars.CAP_G01,
96
+ fontSize: '14px',
97
+ fontWeight: '500',
98
+ lineHeight: 'normal'
99
+ },
100
+ label17: {
101
+ color: styledVars.CAP_G01,
102
+ fontSize: '16px',
103
+ fontWeight: '500',
104
+ lineHeight: 'normal'
105
+ },
106
+ label18: {
107
+ color: styledVars.CAP_G04,
108
+ fontSize: '14px',
109
+ fontWeight: 'normal',
110
+ lineHeight: 'normal'
111
+ },
112
+ label19: {
113
+ color: 'rgba(0, 0, 0, 0.87)',
114
+ fontSize: '12px',
115
+ fontWeight: 'normal',
116
+ lineHeight: '16px'
117
+ },
118
+ label20: {
119
+ color: styledVars.CAP_SECONDARY.base,
120
+ fontSize: '14px',
121
+ fontWeight: '500',
122
+ lineHeight: 'normal'
123
+ },
124
+ label21: {
125
+ color: styledVars.CAP_SECONDARY.base,
126
+ fontSize: '12px',
127
+ fontWeight: 'normal',
128
+ lineHeight: 'normal'
129
+ },
130
+ label22: {
131
+ color: styledVars.CAP_G04,
132
+ fontSize: '24px',
133
+ fontWeight: 'normal',
134
+ lineHeight: '28px'
135
+ },
136
+ label23: {
137
+ color: styledVars.CAP_WHITE,
138
+ fontSize: '14px',
139
+ fontWeight: 'normal',
140
+ lineHeight: 'normal'
141
+ },
142
+ label24: {
143
+ fontSize: '14px',
144
+ fontWeight: '400',
145
+ color: styledVars.CAP_G04,
146
+ lineHeight: '20px'
147
+ },
148
+ label25: {
149
+ fontSize: '14px',
150
+ fontWeight: '500',
151
+ color: styledVars.CAP_G04,
152
+ lineHeight: '20px'
153
+ },
154
+ label26: {
155
+ fontSize: '10px',
156
+ fontWeight: '400',
157
+ color: styledVars.CAP_G01,
158
+ lineHeight: '12px'
159
+ },
160
+ label27: {
161
+ fontSize: '12px',
162
+ fontWeight: '500',
163
+ color: styledVars.CAP_SECONDARY.base,
164
+ lineHeight: '16px'
165
+ },
166
+ label28: {
167
+ fontSize: '12px',
168
+ fontWeight: '500',
169
+ color: styledVars.CAP_WHITE,
170
+ lineHeight: '16px'
171
+ },
172
+ label29: {
173
+ fontSize: '10px',
174
+ fontWeight: '400',
175
+ color: styledVars.CAP_WHITE,
176
+ lineHeight: '12px'
177
+ },
178
+ label30: {
179
+ fontSize: '10px',
180
+ fontWeight: '400',
181
+ color: styledVars.CAP_WHITE,
182
+ lineHeight: '12px'
183
+ },
184
+ label31: {
185
+ color: styledVars.CAP_G01,
186
+ fontSize: '12px',
187
+ fontWeight: '400',
188
+ lineHeight: '16px'
189
+ },
190
+ label32: {
191
+ color: styledVars.CAP_WHITE,
192
+ fontSize: '14px',
193
+ fontWeight: '500',
194
+ lineHeight: '20px'
195
+ },
196
+ label33: {
197
+ color: styledVars.CAP_SECONDARY.base,
198
+ fontSize: '14px',
199
+ fontWeight: '500',
200
+ lineHeight: '20px'
201
+ }
202
+ };
203
+ var labelStyles = css(["font-size:", ";font-weight:", ";color:", ";line-height:", ";margin:0;padding:0;"], function (props) {
204
+ return labels[props.type].fontSize;
205
+ }, function (props) {
206
+ return props.fontWeight || labels[props.type].fontWeight;
207
+ }, function (props) {
208
+ return labels[props.type].color;
209
+ }, function (props) {
210
+ return props.lineHeight || labels[props.type].lineHeight || 'initial';
211
+ });
212
+ export var LabelWrapper = styled.div.withConfig({
213
+ displayName: "LabelWrapper",
214
+ componentId: "sc-1xg855n-0"
215
+ })(["", ""], labelStyles);
216
+ export var LabelInline = styled.span.withConfig({
217
+ displayName: "LabelInline",
218
+ componentId: "sc-1xg855n-1"
219
+ })(["", " display:inline-block;"], labelStyles);
@@ -0,0 +1,22 @@
1
+ var _excluded = ["className", "children"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Row } from 'antd';
8
+ import classNames from 'classnames';
9
+ import { RowWrapper } from './styles';
10
+ var CapRow = function CapRow(_ref) {
11
+ var className = _ref.className,
12
+ children = _ref.children,
13
+ rest = _objectWithoutProperties(_ref, _excluded);
14
+ return /*#__PURE__*/React.createElement(RowWrapper, null, /*#__PURE__*/React.createElement(Row, _extends({}, rest, {
15
+ className: classNames('cap-row', className)
16
+ }), React.Children.toArray(children)));
17
+ };
18
+ CapRow.propTypes = {
19
+ children: PropTypes.node,
20
+ className: PropTypes.string
21
+ };
22
+ export default CapRow;
@@ -0,0 +1 @@
1
+ export { default } from './CapRow';
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export var RowWrapper = styled.div.withConfig({
3
+ displayName: "RowWrapper",
4
+ componentId: "sc-y3x4h8-0"
5
+ })([".cap-row{display:flex;flex-flow:row wrap;min-width:0;}"]);
@@ -0,0 +1,34 @@
1
+ var _excluded = ["overlayClassName", "children"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Tooltip } from 'antd';
8
+ import classNames from 'classnames';
9
+ import { TooltipWrapper } from './styles';
10
+ var CapTooltip = function CapTooltip(_ref) {
11
+ var overlayClassName = _ref.overlayClassName,
12
+ children = _ref.children,
13
+ rest = _objectWithoutProperties(_ref, _excluded);
14
+ return /*#__PURE__*/React.createElement(TooltipWrapper, null, /*#__PURE__*/React.createElement(Tooltip, _extends({
15
+ overlayClassName: classNames('cap-tooltip', overlayClassName)
16
+ }, rest), children));
17
+ };
18
+
19
+ /*
20
+ NOTE:
21
+ While using a disabled button with tooltip, wrap the button with an element with className "button-disabled-tooltip-wrapper".
22
+
23
+ <CapTooltip title="disabled button with tooltip">
24
+ <span className="button-disabled-tooltip-wrapper">
25
+ <CapButton disabled>Button</CapButton>
26
+ </span>
27
+ </CapTooltip>
28
+ */
29
+
30
+ CapTooltip.propTypes = {
31
+ overlayClassName: PropTypes.string,
32
+ children: PropTypes.node
33
+ };
34
+ export default CapTooltip;
@@ -0,0 +1 @@
1
+ export { default } from './CapTooltip';
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ export var TooltipWrapper = styled.span.withConfig({
4
+ displayName: "TooltipWrapper",
5
+ componentId: "sc-17x5zp5-0"
6
+ })([".cap-tooltip{max-width:324px;.ant-tooltip-inner{background-color:", ";font-size:", ";font-weight:", ";padding:6px 8px;min-height:32px;border-radius:", ";}&.cap-bgcolor-tooltip{.ant-tooltip-inner{background-color:", ";}}&.hide-tooltip-pointer{.ant-tooltip-arrow{display:none;}}}.button-disabled-tooltip-wrapper{display:inline-flex;cursor:not-allowed;.cap-button.ant-btn[disabled]{pointer-events:none;& > *{pointer-events:auto;cursor:not-allowed;}}}"], styledVars.FONT_COLOR_01, styledVars.FONT_SIZE_M, styledVars.FONT_WEIGHT_MEDIUM, styledVars.RADIUS_04, styledVars.FONT_COLOR_05);
@@ -1,151 +1,101 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["type", "options", "treeData", "value", "onChange", "onSearch", "placeholder", "disabled", "loading", "allowClear", "enableSearch", "maxTagCount", "size", "status", "className", "style", "rightSlotContent", "virtualized"];
3
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
11
- import React, { useMemo, useCallback } from 'react';
2
+ // CapUnifiedSelect component using Ant Design v5 Select and TreeSelect directly
3
+ import React from 'react';
12
4
  import PropTypes from 'prop-types';
13
5
  import { Select, TreeSelect } from 'antd';
14
- import styled from 'styled-components';
15
- import { selectStyles } from './styles';
16
- import { useIntl } from 'react-intl';
17
- import messages from './messages';
18
- var StyledSelect = styled(Select).withConfig({
19
- displayName: "StyledSelect",
20
- componentId: "sc-wsphu8-0"
21
- })(["", ""], selectStyles);
22
- var StyledTreeSelect = styled(TreeSelect).withConfig({
23
- displayName: "StyledTreeSelect",
24
- componentId: "sc-wsphu8-1"
25
- })(["", ""], selectStyles);
26
- var CapUnifiedSelect = function CapUnifiedSelect(_ref) {
6
+ import { SelectWrapper, HeaderWrapper, StyledInfoIcon } from './styles';
7
+ import CapLabel from '../CapLabel';
8
+ import CapTooltip from '../CapTooltip';
9
+ function CapUnifiedSelect(_ref) {
27
10
  var type = _ref.type,
28
- options = _ref.options,
11
+ _ref$options = _ref.options,
12
+ options = _ref$options === void 0 ? [] : _ref$options,
29
13
  treeData = _ref.treeData,
30
14
  value = _ref.value,
31
15
  onChange = _ref.onChange,
32
- onSearch = _ref.onSearch,
33
- placeholder = _ref.placeholder,
34
- disabled = _ref.disabled,
35
- loading = _ref.loading,
36
- allowClear = _ref.allowClear,
37
- enableSearch = _ref.enableSearch,
38
- maxTagCount = _ref.maxTagCount,
39
- size = _ref.size,
40
- status = _ref.status,
16
+ _ref$placeholder = _ref.placeholder,
17
+ placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
41
18
  className = _ref.className,
42
19
  style = _ref.style,
43
- rightSlotContent = _ref.rightSlotContent,
44
- virtualized = _ref.virtualized,
45
- restProps = _objectWithoutProperties(_ref, _excluded);
46
- var intl = useIntl();
47
- var handleChange = useCallback(function (newValue, option) {
48
- if (onChange) {
49
- onChange(newValue, option);
20
+ _ref$allowClear = _ref.allowClear,
21
+ allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
22
+ _ref$showSearch = _ref.showSearch,
23
+ showSearch = _ref$showSearch === void 0 ? false : _ref$showSearch,
24
+ label = _ref.label,
25
+ tooltip = _ref.tooltip,
26
+ _ref$disabled = _ref.disabled,
27
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
28
+ var selectVirtualizationProps = {
29
+ listHeight: 256
30
+ };
31
+ var treeSelectVirtualizationProps = {
32
+ listHeight: 256,
33
+ listItemHeight: 32
34
+ };
35
+ var renderHeader = function renderHeader() {
36
+ if (!label && !tooltip) return null;
37
+ return /*#__PURE__*/React.createElement(HeaderWrapper, {
38
+ className: disabled ? 'disabled' : ''
39
+ }, label && /*#__PURE__*/React.createElement(CapLabel, {
40
+ type: "label16",
41
+ className: disabled ? 'disabled' : ''
42
+ }, label), tooltip && /*#__PURE__*/React.createElement(CapTooltip, {
43
+ title: tooltip
44
+ }, /*#__PURE__*/React.createElement(StyledInfoIcon, {
45
+ className: disabled ? 'disabled' : ''
46
+ })));
47
+ };
48
+ var renderDropdown = function renderDropdown() {
49
+ if (type === 'treeSelect' || type === 'multiTreeSelect') {
50
+ return /*#__PURE__*/React.createElement(TreeSelect, _extends({
51
+ treeData: treeData || options,
52
+ value: value,
53
+ onChange: onChange,
54
+ placeholder: placeholder,
55
+ className: className,
56
+ style: style,
57
+ allowClear: allowClear,
58
+ showSearch: showSearch,
59
+ multiple: type === 'multiTreeSelect' ? true : false,
60
+ virtual: true,
61
+ treeDefaultExpandAll: true,
62
+ disabled: disabled
63
+ }, treeSelectVirtualizationProps));
50
64
  }
51
- }, [onChange]);
52
- var handleSearch = useCallback(function (searchText) {
53
- if (onSearch) {
54
- onSearch(searchText);
55
- }
56
- }, [onSearch]);
57
- var mergedClassName = useMemo(function () {
58
- var classes = ['cap-unified-select'];
59
- if (className) classes.push(className);
60
- return classes.join(' ');
61
- }, [className]);
62
-
63
- // Common props for both Select and TreeSelect
64
- var commonProps = _objectSpread({
65
- value: value,
66
- onChange: handleChange,
67
- onSearch: enableSearch ? handleSearch : undefined,
68
- placeholder: placeholder || intl.formatMessage(messages.selectPlaceholder),
69
- disabled: disabled,
70
- loading: loading,
71
- allowClear: allowClear,
72
- showSearch: enableSearch,
73
- maxTagCount: maxTagCount,
74
- size: size,
75
- status: status,
76
- className: mergedClassName,
77
- style: style,
78
- virtual: virtualized,
79
- notFoundContent: loading ? intl.formatMessage(messages.loading) : intl.formatMessage(messages.noData)
80
- }, restProps);
81
-
82
- // Render right slot content if provided
83
- var suffixIcon = rightSlotContent && /*#__PURE__*/React.createElement("div", {
84
- className: "cap-unified-select-right-slot"
85
- }, rightSlotContent);
86
-
87
- // For tree-based selects
88
- if (type === 'treeSelect' || type === 'multiTreeSelect') {
89
- return /*#__PURE__*/React.createElement(StyledTreeSelect, _extends({}, commonProps, {
90
- treeData: treeData,
91
- multiple: type === 'multiTreeSelect',
92
- suffixIcon: suffixIcon
93
- }));
94
- }
95
-
96
- // For regular selects
97
- return /*#__PURE__*/React.createElement(StyledSelect, _extends({}, commonProps, {
98
- mode: type === 'multiSelect' ? 'multiple' : undefined,
99
- options: options,
100
- suffixIcon: suffixIcon
101
- }));
102
- };
65
+ return /*#__PURE__*/React.createElement(Select, _extends({
66
+ value: value,
67
+ onChange: onChange,
68
+ placeholder: placeholder,
69
+ className: className,
70
+ style: style,
71
+ allowClear: allowClear,
72
+ showSearch: showSearch,
73
+ options: options,
74
+ mode: type === 'multiSelect' ? 'multiple' : undefined,
75
+ virtual: true,
76
+ disabled: disabled
77
+ }, selectVirtualizationProps));
78
+ };
79
+ return /*#__PURE__*/React.createElement(SelectWrapper, null, renderHeader(), renderDropdown());
80
+ }
103
81
  CapUnifiedSelect.propTypes = {
104
- type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']).isRequired,
105
- options: PropTypes.arrayOf(PropTypes.shape({
106
- label: PropTypes.node,
107
- value: PropTypes.any,
108
- disabled: PropTypes.bool
109
- })),
110
- treeData: PropTypes.arrayOf(PropTypes.shape({
111
- title: PropTypes.node,
112
- value: PropTypes.any,
113
- children: PropTypes.array,
114
- disabled: PropTypes.bool
115
- })),
82
+ type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
83
+ options: PropTypes.array,
84
+ treeData: PropTypes.array,
116
85
  value: PropTypes.any,
117
86
  onChange: PropTypes.func,
118
- onSearch: PropTypes.func,
119
- placeholder: PropTypes.string,
120
- disabled: PropTypes.bool,
121
- loading: PropTypes.bool,
122
- allowClear: PropTypes.bool,
123
- enableSearch: PropTypes.bool,
124
- maxTagCount: PropTypes.number,
125
- size: PropTypes.oneOf(['small', 'middle', 'large']),
126
- status: PropTypes.oneOf(['error', 'warning']),
87
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
127
88
  className: PropTypes.string,
128
89
  style: PropTypes.object,
129
- rightSlotContent: PropTypes.node,
130
- virtualized: PropTypes.bool
90
+ allowClear: PropTypes.bool,
91
+ showSearch: PropTypes.bool,
92
+ label: PropTypes.string,
93
+ tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
94
+ disabled: PropTypes.bool
131
95
  };
132
96
  CapUnifiedSelect.defaultProps = {
133
- options: [],
134
- treeData: [],
135
- value: undefined,
136
- onChange: undefined,
137
- onSearch: undefined,
138
- placeholder: '',
139
- disabled: false,
140
- loading: false,
141
- allowClear: true,
142
- enableSearch: false,
143
- maxTagCount: undefined,
144
- size: 'middle',
145
- status: undefined,
146
- className: '',
147
- style: {},
148
- rightSlotContent: null,
149
- virtualized: true
97
+ type: 'select',
98
+ allowClear: false,
99
+ showSearch: false
150
100
  };
151
101
  export default CapUnifiedSelect;
@@ -1,3 +1,15 @@
1
- import { css } from 'styled-components';
1
+ import styled, { css } from 'styled-components';
2
2
  import * as styledVars from '../styled/variables';
3
+ export var SelectWrapper = styled.div.withConfig({
4
+ displayName: "SelectWrapper",
5
+ componentId: "sc-3v7xpu-0"
6
+ })(["display:flex;flex-direction:column;gap:8px;width:100%;&.disabled{cursor:not-allowed;}"]);
7
+ export var HeaderWrapper = styled.div.withConfig({
8
+ displayName: "HeaderWrapper",
9
+ componentId: "sc-3v7xpu-1"
10
+ })(["display:flex;align-items:center;gap:4px;&.disabled{opacity:0.5;cursor:not-allowed;}"]);
11
+ export var StyledInfoIcon = styled.span.withConfig({
12
+ displayName: "StyledInfoIcon",
13
+ componentId: "sc-3v7xpu-2"
14
+ })(["color:", ";font-size:16px;cursor:help;&:hover{color:", ";}&.disabled{cursor:not-allowed;&:hover{color:", ";}}"], styledVars.CAP_G2, styledVars.CAP_G1, styledVars.CAP_G2);
3
15
  export var selectStyles = css(["&.cap-unified-select{width:100%;font-family:", ";.ant-select-selector{border-radius:", ";transition:", ";padding:0 12px;min-height:32px;display:flex;align-items:center;&:hover{border-color:", ";}}.cap-unified-select-right-slot{display:flex;align-items:center;gap:8px;margin-left:8px;}&.ant-select-focused{.ant-select-selector{border-color:", " !important;box-shadow:none !important;}}&.ant-select-status-error{.ant-select-selector{border-color:", ";}}&.ant-select-disabled{.ant-select-selector{background-color:", ";cursor:not-allowed;}}.ant-select-dropdown{padding:4px;border-radius:", ";box-shadow:0 2px 8px rgba(0,0,0,0.15);.ant-select-item{border-radius:", ";padding:8px 12px;transition:", ";&-option-selected{background-color:", ";color:", ";font-weight:500;}&-option-active{background-color:", ";}}.ant-select-search{padding:8px;input{border-radius:", ";transition:", ";&:focus{border-color:", ";box-shadow:none;}}}}&.ant-select-multiple{.ant-select-selection-item{background-color:", ";border-color:", ";border-radius:", ";color:", ";margin:2px 4px 2px 0;padding:0 8px;height:24px;line-height:22px;&-remove{color:", ";&:hover{color:", ";}}}.ant-select-selection-overflow{flex-wrap:wrap;gap:4px;}}.ant-select-tree{padding:4px 0;.ant-select-tree-node-content-wrapper{padding:4px 8px;border-radius:", ";transition:", ";&:hover{background-color:", ";}&.ant-select-tree-node-selected{background-color:", ";color:", ";font-weight:500;}}.ant-select-tree-switcher{width:24px;height:24px;line-height:24px;}.ant-select-tree-checkbox{margin:4px 8px 4px 0;}}&.ant-select-lg{.ant-select-selector{height:40px;padding:0 16px;}.ant-select-selection-item{height:28px;line-height:26px;}}&.ant-select-sm{.ant-select-selector{height:24px;padding:0 8px;}.ant-select-selection-item{height:20px;line-height:18px;}}&.ant-select-loading{.ant-select-arrow{.anticon-loading{color:", ";}}}}"], styledVars.FONT_FAMILY, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G11, styledVars.CAP_G01, styledVars.CAP_RED, styledVars.CAP_G08, styledVars.RADIUS_04, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.base, styledVars.CAP_G08, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G01, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.light, styledVars.RADIUS_04, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.hover, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G08, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base);
@@ -1,5 +1 @@
1
- import * as styledVars from './variables';
2
- export default styledVars;
3
-
4
- // Re-export all variables for easier access
5
1
  export * from './variables';
@@ -5,13 +5,14 @@
5
5
  export var CAP_PRIMARY = {
6
6
  base: "#47af46",
7
7
  hover: "#1f9a1d",
8
- disabled: "#a1d8a0"
8
+ disabled: "#a1d8a0",
9
+ light: "rgba(71, 175, 70, 0.1)"
9
10
  };
10
11
 
11
12
  // Secondary colors
12
13
  export var CAP_SECONDARY = {
13
14
  base: "#2466ea",
14
- light: 'rgba("#2466ea", 0.1)'
15
+ light: "rgba(36, 102, 234, 0.1)"
15
16
  };
16
17
 
17
18
  // Custom colors
@@ -69,20 +70,54 @@ export var FONT_FAMILY = '"Roboto", sans-serif';
69
70
  export var FONT_WEIGHT_REGULAR = 400;
70
71
  export var FONT_WEIGHT_MEDIUM = 500;
71
72
 
72
- /* Spacing */
73
- // ==============
74
- export var SPACING_04 = "4px";
75
- export var SPACING_08 = "8px";
76
- export var SPACING_12 = "12px";
77
- export var SPACING_16 = "16px";
78
- export var SPACING_24 = "24px";
79
- export var SPACING_32 = "32px";
73
+ // Font colors
74
+ export var FONT_COLOR_01 = "#091E42";
75
+ export var FONT_COLOR_02 = "#5E6C84";
76
+ export var FONT_COLOR_03 = "#97A0AF";
77
+ export var FONT_COLOR_04 = "#B3BAC5";
78
+ export var FONT_COLOR_05 = "#2466EA";
79
+ export var FONT_COLOR_06 = "#FFFFFF";
80
80
 
81
- /* Border Radius */
82
- // ==============
81
+ // Font sizes
82
+ export var FONT_SIZE_VL = "24px";
83
+ export var FONT_SIZE_L = "16px";
84
+ export var FONT_SIZE_M = "14px";
85
+ export var FONT_SIZE_S = "12px";
86
+ export var FONT_SIZE_VS = "10px";
87
+
88
+ // Icon sizes
89
+ export var ICON_SIZE_XS = "12px";
90
+ export var ICON_SIZE_S = "16px";
91
+ export var ICON_SIZE_M = "24px";
92
+ export var ICON_SIZE_L = "32px";
93
+
94
+ // Sizes & Spacings (1rem === 14px as base font size of root is 14px)
95
+ export var CAP_SPACE_02 = "0.142rem";
96
+ export var CAP_SPACE_04 = "0.285rem";
97
+ export var CAP_SPACE_08 = "0.571rem";
98
+ export var CAP_SPACE_12 = "0.857rem";
99
+ export var CAP_SPACE_16 = "1.142rem";
100
+ export var CAP_SPACE_20 = "1.428rem";
101
+ export var CAP_SPACE_24 = "1.714rem";
102
+ export var CAP_SPACE_28 = "2rem";
103
+ export var CAP_SPACE_32 = "2.285rem";
104
+ export var CAP_SPACE_36 = "2.571rem";
105
+ export var CAP_SPACE_40 = "2.857rem";
106
+ export var CAP_SPACE_44 = "3.142rem";
107
+ export var CAP_SPACE_48 = "3.428rem";
108
+ export var CAP_SPACE_52 = "3.714rem";
109
+ export var CAP_SPACE_56 = "4rem";
110
+ export var CAP_SPACE_60 = "4.286rem";
111
+ export var CAP_SPACE_64 = "4.571rem";
112
+ export var CAP_SPACE_72 = "5.143rem";
113
+ export var CAP_SPACE_80 = "5.714rem";
114
+ export var CAP_SPACE_140 = "10rem";
115
+
116
+ // Border Radius
117
+ export var RADIUS_02 = "2px";
83
118
  export var RADIUS_04 = "4px";
84
119
  export var RADIUS_08 = "8px";
120
+ export var RADIUS_16 = "16px";
85
121
 
86
- /* Transition */
87
- // ==============
88
- export var TRANSITION_ALL = "all 0.3s ease";
122
+ // Transitions
123
+ export var TRANSITION_ALL = "all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)";