@capillarytech/blaze-ui 0.1.6-alpha.3 → 0.1.6-alpha.32
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/components/CapInput/CapInput.js +60 -0
- package/components/CapInput/Number.js +39 -0
- package/components/CapInput/Search.js +34 -0
- package/components/CapInput/TextArea.js +41 -0
- package/components/CapInput/index.js +13 -0
- package/components/CapInput/messages.js +24 -0
- package/components/CapInput/styles.js +8 -0
- package/components/CapSkeleton/CapSkeleton.js +24 -0
- package/components/CapSkeleton/index.js +7 -0
- package/components/CapSpin/CapSpin.js +30 -0
- package/components/CapSpin/index.js +7 -0
- package/components/CapTable/CapTable.js +118 -0
- package/components/CapTable/index.js +7 -0
- package/components/CapTable/loadable.js +18 -0
- package/components/CapTable/styles.js +23 -0
- package/components/CapTestSelect/CapTestSelect.js +36 -0
- package/components/CapTestSelect/index.js +7 -0
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +359 -0
- package/components/CapUnifiedSelect/index.js +7 -0
- package/components/CapUnifiedSelect/messages.js +27 -0
- package/components/CapUnifiedSelect/styles.js +36 -0
- package/components/LocaleHoc/index.js +42 -0
- package/components/index.js +33 -0
- package/components/styled/index.js +14 -0
- package/components/styled/variables.js +70 -0
- package/{translations → components/translations}/en.js +37 -35
- package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
- package/dist/components/CapSkeleton/index.js +13 -0
- package/dist/components/CapSpin/CapSpin.js +35 -0
- package/dist/components/CapSpin/index.js +13 -0
- package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
- package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
- package/dist/components/CapTestSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
- package/dist/components/CapUnifiedSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/messages.js +29 -0
- package/dist/components/CapUnifiedSelect/styles.js +39 -0
- package/dist/{index.js → components/index.js} +27 -0
- package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
- package/dist/esm/components/CapSkeleton/index.js +1 -0
- package/dist/esm/components/CapSpin/CapSpin.js +28 -0
- package/dist/esm/components/CapSpin/index.js +1 -0
- package/dist/esm/components/CapTable/loadable.js +12 -0
- package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
- package/dist/esm/components/CapTestSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
- package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
- package/dist/esm/{index.js → components/index.js} +5 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/withStyles.js +23 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/withStyles.js +29 -0
- package/package.json +6 -10
- package/utils/index.js +7 -0
- package/utils/withStyles.js +15 -0
- package/CapHeading/CapHeading.js +0 -71
- package/CapHeading/index.js +0 -1
- package/CapHeading/styles.js +0 -125
- package/CapInfoNote/CapInfoNote.js +0 -54
- package/CapInfoNote/index.js +0 -1
- package/CapInfoNote/styles.js +0 -63
- package/CapInput/CapInput.js +0 -67
- package/CapInput/Number.js +0 -38
- package/CapInput/Search.js +0 -32
- package/CapInput/TextArea.js +0 -45
- package/CapInput/index.js +0 -10
- package/CapInput/loadable.js +0 -9
- package/CapInput/messages.js +0 -27
- package/CapInput/styles.js +0 -81
- package/CapLabel/CapLabel.js +0 -106
- package/CapLabel/index.js +0 -1
- package/CapLabel/styles.js +0 -221
- package/CapRow/CapRow.js +0 -22
- package/CapRow/index.js +0 -1
- package/CapRow/styles.js +0 -9
- package/CapTable/CapTable.js +0 -146
- package/CapTable/index.js +0 -3
- package/CapTable/loadable.js +0 -13
- package/CapTable/styles.js +0 -134
- package/CapTooltip/CapTooltip.js +0 -36
- package/CapTooltip/index.js +0 -1
- package/CapTooltip/styles.js +0 -42
- package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
- package/CapUnifiedSelect/index.js +0 -4
- package/CapUnifiedSelect/loadable.js +0 -3
- package/CapUnifiedSelect/messages.js +0 -24
- package/CapUnifiedSelect/styles.js +0 -223
- package/LocaleHoc/index.js +0 -38
- package/dist/235.index.js +0 -2
- package/dist/235.index.js.LICENSE.txt +0 -29
- package/dist/603.index.js +0 -1
- package/dist/esm/CapHeading/CapHeading.js +0 -41
- package/dist/esm/CapHeading/index.js +0 -1
- package/dist/esm/CapHeading/styles.js +0 -123
- package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
- package/dist/esm/CapInfoNote/index.js +0 -1
- package/dist/esm/CapInfoNote/styles.js +0 -6
- package/dist/esm/CapInput/loadable.js +0 -9
- package/dist/esm/CapLabel/CapLabel.js +0 -50
- package/dist/esm/CapLabel/index.js +0 -1
- package/dist/esm/CapLabel/styles.js +0 -219
- package/dist/esm/CapRow/index.js +0 -1
- package/dist/esm/CapRow/styles.js +0 -5
- package/dist/esm/CapTable/loadable.js +0 -12
- package/dist/esm/CapTooltip/CapTooltip.js +0 -34
- package/dist/esm/CapTooltip/index.js +0 -1
- package/dist/esm/CapTooltip/styles.js +0 -6
- package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
- package/dist/esm/CapUnifiedSelect/index.js +0 -3
- package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
- package/dist/esm/CapUnifiedSelect/styles.js +0 -15
- package/dist/index.js.LICENSE.txt +0 -7
- package/index.js +0 -10
- package/styled/index.js +0 -6
- package/styled/variables.js +0 -89
- /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/{styled → components/styled}/index.js +0 -0
- /package/dist/{styled → components/styled}/variables.js +0 -0
- /package/dist/{translations → components/translations}/en.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/esm/{CapUnifiedSelect → components/CapUnifiedSelect}/messages.js +0 -0
- /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/variables.js +0 -0
- /package/dist/esm/{translations → components/translations}/en.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapTestSelect';
|
|
@@ -0,0 +1,398 @@
|
|
|
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
|
+
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 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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
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); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
// Enhanced CapUnifiedSelect supporting 4 scenarios with advanced features
|
|
15
|
+
import React, { useState, useEffect } from 'react';
|
|
16
|
+
import PropTypes from 'prop-types';
|
|
17
|
+
import classnames from 'classnames';
|
|
18
|
+
import { Select, TreeSelect, Tooltip, Input, Button } from 'antd';
|
|
19
|
+
import styled from 'styled-components';
|
|
20
|
+
import { InfoCircleOutlined, SearchOutlined, WarningFilled, DownOutlined } from '@ant-design/icons';
|
|
21
|
+
import withStyles from '../utils/withStyles'; // Updated import path
|
|
22
|
+
import { SelectWrapper, HeaderWrapper, selectStyles } from './styles';
|
|
23
|
+
var CapUnifiedSelect = function CapUnifiedSelect(_ref) {
|
|
24
|
+
var type = _ref.type,
|
|
25
|
+
_ref$options = _ref.options,
|
|
26
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
27
|
+
treeData = _ref.treeData,
|
|
28
|
+
value = _ref.value,
|
|
29
|
+
onChange = _ref.onChange,
|
|
30
|
+
_ref$placeholder = _ref.placeholder,
|
|
31
|
+
placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
style = _ref.style,
|
|
34
|
+
status = _ref.status,
|
|
35
|
+
statusMessage = _ref.statusMessage,
|
|
36
|
+
_ref$allowClear = _ref.allowClear,
|
|
37
|
+
allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
|
|
38
|
+
label = _ref.label,
|
|
39
|
+
tooltip = _ref.tooltip,
|
|
40
|
+
_ref$disabled = _ref.disabled,
|
|
41
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
42
|
+
_ref$treeCheckable = _ref.treeCheckable,
|
|
43
|
+
treeCheckable = _ref$treeCheckable === void 0 ? false : _ref$treeCheckable,
|
|
44
|
+
_ref$customPopupRende = _ref.customPopupRender,
|
|
45
|
+
customPopupRender = _ref$customPopupRende === void 0 ? false : _ref$customPopupRende,
|
|
46
|
+
onConfirm = _ref.onConfirm,
|
|
47
|
+
onCancel = _ref.onCancel;
|
|
48
|
+
var StyledSelect = styled(Select).withConfig({
|
|
49
|
+
displayName: "StyledSelect",
|
|
50
|
+
componentId: "sc-wsphu8-0"
|
|
51
|
+
})(["", ""], selectStyles);
|
|
52
|
+
var StyledTreeSelect = styled(TreeSelect).withConfig({
|
|
53
|
+
displayName: "StyledTreeSelect",
|
|
54
|
+
componentId: "sc-wsphu8-1"
|
|
55
|
+
})(["", ""], selectStyles);
|
|
56
|
+
var _useState = useState(''),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
searchText = _useState2[0],
|
|
59
|
+
setSearchText = _useState2[1];
|
|
60
|
+
var _useState3 = useState(value),
|
|
61
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
62
|
+
tempValue = _useState4[0],
|
|
63
|
+
setTempValue = _useState4[1];
|
|
64
|
+
var _useState5 = useState(false),
|
|
65
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
66
|
+
allSelected = _useState6[0],
|
|
67
|
+
setAllSelected = _useState6[1];
|
|
68
|
+
|
|
69
|
+
// Update tempValue when value changes
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
setTempValue(value);
|
|
72
|
+
}, [value]);
|
|
73
|
+
var selectVirtualizationProps = {
|
|
74
|
+
listHeight: 256
|
|
75
|
+
};
|
|
76
|
+
var treeSelectVirtualizationProps = {
|
|
77
|
+
listHeight: 256,
|
|
78
|
+
listItemHeight: 32
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// No results component
|
|
82
|
+
var NoResult = function NoResult() {
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
style: {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
height: 200,
|
|
90
|
+
color: '#8c8c8c',
|
|
91
|
+
fontSize: 14
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement(WarningFilled, {
|
|
94
|
+
style: {
|
|
95
|
+
fontSize: 36,
|
|
96
|
+
marginBottom: 8,
|
|
97
|
+
color: '#bfbfbf'
|
|
98
|
+
}
|
|
99
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
style: {
|
|
101
|
+
fontWeight: 500
|
|
102
|
+
}
|
|
103
|
+
}, "No results found"));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Filter tree data based on search text
|
|
107
|
+
var getFilteredTreeData = function getFilteredTreeData(data, search) {
|
|
108
|
+
if (!search) return data;
|
|
109
|
+
var filterNode = function filterNode(node) {
|
|
110
|
+
var _node$title, _node$label;
|
|
111
|
+
var titleText = ((_node$title = node.title) === null || _node$title === void 0 ? void 0 : _node$title.toLowerCase()) || '';
|
|
112
|
+
var labelText = ((_node$label = node.label) === null || _node$label === void 0 ? void 0 : _node$label.toLowerCase()) || '';
|
|
113
|
+
return titleText.includes(search.toLowerCase()) || labelText.includes(search.toLowerCase());
|
|
114
|
+
};
|
|
115
|
+
var _loop = function loop(data) {
|
|
116
|
+
return data.map(function (item) {
|
|
117
|
+
var children = item.children ? _loop(item.children) : [];
|
|
118
|
+
if (filterNode(item) || children.length) {
|
|
119
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
120
|
+
children: children
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}).filter(Boolean);
|
|
125
|
+
};
|
|
126
|
+
return _loop(data);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Get all leaf node values from tree data
|
|
130
|
+
var _flattenedLeafValues = function flattenedLeafValues(nodes) {
|
|
131
|
+
return (nodes === null || nodes === void 0 ? void 0 : nodes.flatMap(function (node) {
|
|
132
|
+
return node.children ? _flattenedLeafValues(node.children) : [node.value];
|
|
133
|
+
})) || [];
|
|
134
|
+
};
|
|
135
|
+
var filteredTree = getFilteredTreeData(treeData || options, searchText);
|
|
136
|
+
var filteredOptions = !searchText ? options : options.filter(function (opt) {
|
|
137
|
+
var _opt$label;
|
|
138
|
+
return (_opt$label = opt.label) === null || _opt$label === void 0 ? void 0 : _opt$label.toLowerCase().includes(searchText.toLowerCase());
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// All available leaf values for the current filtered tree data
|
|
142
|
+
var leafValues = _flattenedLeafValues(filteredTree);
|
|
143
|
+
|
|
144
|
+
// Handles select all checkbox click
|
|
145
|
+
var handleSelectAll = function handleSelectAll() {
|
|
146
|
+
var isTree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
147
|
+
var availableValues = isTree ? leafValues : filteredOptions.map(function (opt) {
|
|
148
|
+
return opt.value;
|
|
149
|
+
});
|
|
150
|
+
if (allSelected) {
|
|
151
|
+
setTempValue([]);
|
|
152
|
+
} else {
|
|
153
|
+
setTempValue(availableValues);
|
|
154
|
+
}
|
|
155
|
+
setAllSelected(!allSelected);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Update allSelected state when value changes
|
|
159
|
+
useEffect(function () {
|
|
160
|
+
var isMultipleMode = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
161
|
+
if (isMultipleMode && Array.isArray(tempValue)) {
|
|
162
|
+
var availableValues = type.includes('tree') ? leafValues : filteredOptions.map(function (opt) {
|
|
163
|
+
return opt.value;
|
|
164
|
+
});
|
|
165
|
+
setAllSelected(tempValue.length > 0 && tempValue.length === availableValues.length);
|
|
166
|
+
}
|
|
167
|
+
}, [tempValue, filteredOptions, leafValues, type]);
|
|
168
|
+
|
|
169
|
+
// Handle confirmation
|
|
170
|
+
var handleConfirm = function handleConfirm() {
|
|
171
|
+
if (onConfirm) {
|
|
172
|
+
onConfirm(tempValue);
|
|
173
|
+
} else {
|
|
174
|
+
onChange(tempValue);
|
|
175
|
+
}
|
|
176
|
+
setSearchText('');
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Handle cancellation
|
|
180
|
+
var handleCancel = function handleCancel() {
|
|
181
|
+
if (onCancel) {
|
|
182
|
+
onCancel();
|
|
183
|
+
}
|
|
184
|
+
setTempValue(value);
|
|
185
|
+
setSearchText('');
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Handle temporary value change
|
|
189
|
+
var handleTempChange = function handleTempChange(newValue) {
|
|
190
|
+
setTempValue(newValue);
|
|
191
|
+
};
|
|
192
|
+
var suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "+", value.length - 1, " more", /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(DownOutlined, null);
|
|
193
|
+
var prefix = function prefix() {
|
|
194
|
+
if ((type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 0) {
|
|
195
|
+
var selectedLabels = options.filter(function (opt) {
|
|
196
|
+
return value.includes(opt.value);
|
|
197
|
+
}).map(function (opt) {
|
|
198
|
+
return opt.label;
|
|
199
|
+
});
|
|
200
|
+
return selectedLabels[0];
|
|
201
|
+
} else {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var renderHeader = function renderHeader() {
|
|
206
|
+
if (!label && !tooltip) return null;
|
|
207
|
+
return /*#__PURE__*/React.createElement(HeaderWrapper, {
|
|
208
|
+
className: disabled ? 'disabled' : ''
|
|
209
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
210
|
+
type: "label16",
|
|
211
|
+
className: disabled ? 'disabled' : ''
|
|
212
|
+
}, label), tooltip && /*#__PURE__*/React.createElement(Tooltip, {
|
|
213
|
+
title: tooltip
|
|
214
|
+
}, /*#__PURE__*/React.createElement(InfoCircleOutlined, {
|
|
215
|
+
className: disabled ? 'disabled' : '',
|
|
216
|
+
style: {
|
|
217
|
+
color: '#B3BAC5'
|
|
218
|
+
}
|
|
219
|
+
})));
|
|
220
|
+
};
|
|
221
|
+
var renderDropdown = function renderDropdown() {
|
|
222
|
+
var isMultipleSelect = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
223
|
+
var isTreeMode = type === 'treeSelect' || type === 'multiTreeSelect';
|
|
224
|
+
var currentItems = isTreeMode ? filteredTree : filteredOptions;
|
|
225
|
+
var selectedCount = Array.isArray(tempValue) ? tempValue.length : tempValue ? 1 : 0;
|
|
226
|
+
|
|
227
|
+
// Custom dropdown render for both Select and TreeSelect
|
|
228
|
+
var renderCustomDropdown = function renderCustomDropdown(menu) {
|
|
229
|
+
if (!customPopupRender) return menu;
|
|
230
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
231
|
+
style: {
|
|
232
|
+
borderBottom: '1px solid #f0f0f0'
|
|
233
|
+
}
|
|
234
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
235
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
|
|
236
|
+
style: {
|
|
237
|
+
color: "#B3BAC5"
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
placeholder: "Search",
|
|
241
|
+
variant: "borderless",
|
|
242
|
+
value: searchText,
|
|
243
|
+
onChange: function onChange(e) {
|
|
244
|
+
return setSearchText(e.target.value);
|
|
245
|
+
},
|
|
246
|
+
onKeyDown: function onKeyDown(e) {
|
|
247
|
+
return e.stopPropagation();
|
|
248
|
+
}
|
|
249
|
+
})), isMultipleSelect && currentItems.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
250
|
+
style: {
|
|
251
|
+
padding: '8px 12px',
|
|
252
|
+
cursor: 'pointer',
|
|
253
|
+
display: 'flex',
|
|
254
|
+
alignItems: 'center',
|
|
255
|
+
borderBottom: '1px solid #f0f0f0'
|
|
256
|
+
},
|
|
257
|
+
onClick: function onClick(e) {
|
|
258
|
+
// Prevent event propagation to keep dropdown open
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
handleSelectAll(isTreeMode);
|
|
261
|
+
}
|
|
262
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
263
|
+
type: "checkbox",
|
|
264
|
+
checked: allSelected,
|
|
265
|
+
readOnly: true,
|
|
266
|
+
style: {
|
|
267
|
+
cursor: 'pointer'
|
|
268
|
+
},
|
|
269
|
+
onClick: function onClick(e) {
|
|
270
|
+
return e.stopPropagation();
|
|
271
|
+
}
|
|
272
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
273
|
+
style: {
|
|
274
|
+
marginLeft: 8,
|
|
275
|
+
cursor: 'pointer'
|
|
276
|
+
}
|
|
277
|
+
}, "Select all")), currentItems.length === 0 ? /*#__PURE__*/React.createElement(NoResult, null) : menu, currentItems.length > 0 && isMultipleSelect && /*#__PURE__*/React.createElement("div", {
|
|
278
|
+
style: {
|
|
279
|
+
display: 'flex',
|
|
280
|
+
justifyContent: 'space-between',
|
|
281
|
+
alignItems: 'center',
|
|
282
|
+
padding: '8px 12px',
|
|
283
|
+
borderTop: '1px solid #f0f0f0'
|
|
284
|
+
}
|
|
285
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
286
|
+
type: "primary",
|
|
287
|
+
size: "small",
|
|
288
|
+
style: {
|
|
289
|
+
marginRight: 8
|
|
290
|
+
},
|
|
291
|
+
onClick: function onClick(e) {
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
handleConfirm();
|
|
294
|
+
}
|
|
295
|
+
}, "Confirm"), /*#__PURE__*/React.createElement(Button, {
|
|
296
|
+
type: "text",
|
|
297
|
+
size: "small",
|
|
298
|
+
onClick: function onClick(e) {
|
|
299
|
+
e.stopPropagation();
|
|
300
|
+
handleCancel();
|
|
301
|
+
}
|
|
302
|
+
}, "Cancel")), selectedCount > 0 && /*#__PURE__*/React.createElement("span", {
|
|
303
|
+
style: {
|
|
304
|
+
color: '#8c8c8c',
|
|
305
|
+
fontSize: '14px'
|
|
306
|
+
}
|
|
307
|
+
}, selectedCount, " selected")));
|
|
308
|
+
};
|
|
309
|
+
if (type === 'treeSelect' || type === 'multiTreeSelect') {
|
|
310
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledTreeSelect, _extends({
|
|
311
|
+
treeData: filteredTree,
|
|
312
|
+
value: customPopupRender ? tempValue : value,
|
|
313
|
+
onChange: customPopupRender ? handleTempChange : onChange,
|
|
314
|
+
placeholder: placeholder,
|
|
315
|
+
maxTagCount: 0,
|
|
316
|
+
maxTagPlaceholder: function maxTagPlaceholder() {
|
|
317
|
+
return null;
|
|
318
|
+
},
|
|
319
|
+
prefix: type === "multiTreeSelect" && value.length > 0 && prefix(),
|
|
320
|
+
suffixIcon: suffix,
|
|
321
|
+
className: classnames("cap-unified-tree-select ".concat(className || '')),
|
|
322
|
+
style: style,
|
|
323
|
+
status: status,
|
|
324
|
+
allowClear: allowClear,
|
|
325
|
+
showSearch: false,
|
|
326
|
+
multiple: type === 'multiTreeSelect',
|
|
327
|
+
treeCheckable: treeCheckable,
|
|
328
|
+
showCheckedStrategy: TreeSelect.SHOW_PARENT,
|
|
329
|
+
virtual: true,
|
|
330
|
+
disabled: disabled,
|
|
331
|
+
filterTreeNode: false
|
|
332
|
+
}, treeSelectVirtualizationProps, {
|
|
333
|
+
popupRender: renderCustomDropdown
|
|
334
|
+
})), status === 'error' && /*#__PURE__*/React.createElement("div", {
|
|
335
|
+
style: {
|
|
336
|
+
color: '#E83135'
|
|
337
|
+
},
|
|
338
|
+
className: "cap-unified-select-status"
|
|
339
|
+
}, statusMessage));
|
|
340
|
+
}
|
|
341
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledSelect, _extends({
|
|
342
|
+
options: filteredOptions,
|
|
343
|
+
value: customPopupRender ? tempValue : value,
|
|
344
|
+
onChange: customPopupRender ? handleTempChange : onChange,
|
|
345
|
+
placeholder: placeholder,
|
|
346
|
+
maxTagCount: 0,
|
|
347
|
+
maxTagPlaceholder: function maxTagPlaceholder() {
|
|
348
|
+
return null;
|
|
349
|
+
},
|
|
350
|
+
prefix: type === "multiSelect" && value.length > 0 && prefix(),
|
|
351
|
+
suffixIcon: suffix,
|
|
352
|
+
className: classnames('cap-unified-select', className),
|
|
353
|
+
style: style,
|
|
354
|
+
allowClear: allowClear,
|
|
355
|
+
showSearch: false,
|
|
356
|
+
mode: type === 'multiSelect' ? 'multiple' : undefined,
|
|
357
|
+
virtual: true,
|
|
358
|
+
disabled: disabled,
|
|
359
|
+
status: status
|
|
360
|
+
}, selectVirtualizationProps, {
|
|
361
|
+
popupRender: renderCustomDropdown
|
|
362
|
+
})), status === 'error' && /*#__PURE__*/React.createElement("div", {
|
|
363
|
+
style: {
|
|
364
|
+
color: '#E83135'
|
|
365
|
+
},
|
|
366
|
+
className: "cap-unified-select-status"
|
|
367
|
+
}, statusMessage));
|
|
368
|
+
};
|
|
369
|
+
return /*#__PURE__*/React.createElement(SelectWrapper, {
|
|
370
|
+
className: classnames("cap-unified-select-container ".concat(className || ''))
|
|
371
|
+
}, renderHeader(), renderDropdown());
|
|
372
|
+
};
|
|
373
|
+
CapUnifiedSelect.propTypes = {
|
|
374
|
+
type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
|
|
375
|
+
options: PropTypes.array,
|
|
376
|
+
treeData: PropTypes.array,
|
|
377
|
+
value: PropTypes.any,
|
|
378
|
+
onChange: PropTypes.func,
|
|
379
|
+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
380
|
+
className: PropTypes.string,
|
|
381
|
+
style: PropTypes.object,
|
|
382
|
+
allowClear: PropTypes.bool,
|
|
383
|
+
label: PropTypes.string,
|
|
384
|
+
tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
385
|
+
disabled: PropTypes.bool,
|
|
386
|
+
treeCheckable: PropTypes.bool,
|
|
387
|
+
customPopupRender: PropTypes.bool,
|
|
388
|
+
onConfirm: PropTypes.func,
|
|
389
|
+
onCancel: PropTypes.func
|
|
390
|
+
};
|
|
391
|
+
CapUnifiedSelect.defaultProps = {
|
|
392
|
+
type: 'select',
|
|
393
|
+
allowClear: false,
|
|
394
|
+
customPopupRender: false,
|
|
395
|
+
treeCheckable: false,
|
|
396
|
+
className: ''
|
|
397
|
+
};
|
|
398
|
+
export default withStyles(CapUnifiedSelect, selectStyles);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapUnifiedSelect';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
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 DropdownFooter = styled.div.withConfig({
|
|
12
|
+
displayName: "DropdownFooter",
|
|
13
|
+
componentId: "sc-3v7xpu-2"
|
|
14
|
+
})(["display:flex;justify-content:space-between;align-items:center;padding:8px;border-top:1px solid #f0f0f0;.footer-buttons{display:flex;align-items:center;gap:8px;}.total-count{color:#8c8c8c;font-size:12px;}"]);
|
|
15
|
+
export var SearchInputWrapper = styled.div.withConfig({
|
|
16
|
+
displayName: "SearchInputWrapper",
|
|
17
|
+
componentId: "sc-3v7xpu-3"
|
|
18
|
+
})(["padding:8px;border-bottom:1px solid #f0f0f0;"]);
|
|
19
|
+
export var SelectAllCheckbox = styled.div.withConfig({
|
|
20
|
+
displayName: "SelectAllCheckbox",
|
|
21
|
+
componentId: "sc-3v7xpu-4"
|
|
22
|
+
})(["display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-weight:500;border-bottom:1px solid #f0f0f0;user-select:none;input[type=\"checkbox\"]{cursor:pointer;}"]);
|
|
23
|
+
export var NoResultWrapper = styled.div.withConfig({
|
|
24
|
+
displayName: "NoResultWrapper",
|
|
25
|
+
componentId: "sc-3v7xpu-5"
|
|
26
|
+
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:200px;color:#8c8c8c;font-size:14px;"]);
|
|
27
|
+
export var StyledInfoIcon = styled.span.withConfig({
|
|
28
|
+
displayName: "StyledInfoIcon",
|
|
29
|
+
componentId: "sc-3v7xpu-6"
|
|
30
|
+
})(["color:", ";font-size:16px;cursor:help;margin-left:4px;display:flex;align-items:center;&:hover{color:", ";}&.disabled{cursor:not-allowed;&:hover{color:", ";}}"], styledVars.CAP_G05, styledVars.CAP_G03, styledVars.CAP_G05);
|
|
31
|
+
export var selectStyles = css(["&.cap-unified-select{width:100%;font-family:", ";}&.cap-unified-select-container{.ant-select-prefix{margin-left:-5px !important;font-size:14px !important;font-weight:400 !important;color:#091E42 !important;line-height:20px !important;}}"], styledVars.FONT_FAMILY);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Import and export all components
|
|
2
2
|
export { default as CapInput } from './CapInput';
|
|
3
3
|
export { default as CapTable } from './CapTable';
|
|
4
|
+
export { default as CapTestSelect } from './CapTestSelect'; // Test component for Ant Design v5 integration
|
|
4
5
|
|
|
5
6
|
// Export utilities
|
|
6
7
|
export { default as LocaleHoc } from './LocaleHoc';
|
|
@@ -8,4 +9,7 @@ export { default as LocaleHoc } from './LocaleHoc';
|
|
|
8
9
|
// Export styled utilities
|
|
9
10
|
import * as _styledVars from './styled/variables';
|
|
10
11
|
export { _styledVars as styledVars };
|
|
11
|
-
export { default as styled } from './styled';
|
|
12
|
+
export { default as styled } from './styled';
|
|
13
|
+
|
|
14
|
+
// Export utils
|
|
15
|
+
export * from '../utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as withStyles } from './withStyles';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enhances a React component with additional styles using styled-components.
|
|
5
|
+
* @param {React.ComponentType} WrappedComponent - The React component to enhance.
|
|
6
|
+
* @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
|
|
7
|
+
* @returns {React.ComponentType} Returns the enhanced styled component.
|
|
8
|
+
*/
|
|
9
|
+
var withStyledComponent = function withStyledComponent(WrappedComponent, styles) {
|
|
10
|
+
/**
|
|
11
|
+
* A styled component generated by combining WrappedComponent with additional styles.
|
|
12
|
+
* @type {React.ComponentType}
|
|
13
|
+
*/
|
|
14
|
+
var StyledComponent = styled(WrappedComponent).withConfig({
|
|
15
|
+
displayName: "StyledComponent",
|
|
16
|
+
componentId: "sc-ujcdm3-0"
|
|
17
|
+
})(["", ";"], styles);
|
|
18
|
+
|
|
19
|
+
// Set default props from the original component to the styled component
|
|
20
|
+
StyledComponent.defaultProps = WrappedComponent.defaultProps;
|
|
21
|
+
return StyledComponent;
|
|
22
|
+
};
|
|
23
|
+
export default withStyledComponent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "withStyles", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _withStyles["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _withStyles = _interopRequireDefault(require("./withStyles"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
/**
|
|
10
|
+
* Enhances a React component with additional styles using styled-components.
|
|
11
|
+
* @param {React.ComponentType} WrappedComponent - The React component to enhance.
|
|
12
|
+
* @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
|
|
13
|
+
* @returns {React.ComponentType} Returns the enhanced styled component.
|
|
14
|
+
*/
|
|
15
|
+
var withStyledComponent = function withStyledComponent(WrappedComponent, styles) {
|
|
16
|
+
/**
|
|
17
|
+
* A styled component generated by combining WrappedComponent with additional styles.
|
|
18
|
+
* @type {React.ComponentType}
|
|
19
|
+
*/
|
|
20
|
+
var StyledComponent = (0, _styledComponents["default"])(WrappedComponent).withConfig({
|
|
21
|
+
displayName: "StyledComponent",
|
|
22
|
+
componentId: "sc-ujcdm3-0"
|
|
23
|
+
})(["", ";"], styles);
|
|
24
|
+
|
|
25
|
+
// Set default props from the original component to the styled component
|
|
26
|
+
StyledComponent.defaultProps = WrappedComponent.defaultProps;
|
|
27
|
+
return StyledComponent;
|
|
28
|
+
};
|
|
29
|
+
var _default = exports["default"] = withStyledComponent;
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/blaze-ui",
|
|
3
3
|
"author": "Capillary Technologies",
|
|
4
|
-
"version": "0.1.6-alpha.
|
|
5
|
-
"description": "Capillary UI component library",
|
|
6
|
-
"main": "./
|
|
7
|
-
"module": "./dist/esm/index.js",
|
|
8
|
-
"jsnext:main": "./dist/esm/index.js",
|
|
4
|
+
"version": "0.1.6-alpha.32",
|
|
5
|
+
"description": "Capillary UI component library with Ant Design v5",
|
|
6
|
+
"main": "./components/index.js",
|
|
9
7
|
"sideEffects": [
|
|
10
8
|
"*.css",
|
|
11
9
|
"*.less",
|
|
@@ -26,14 +24,12 @@
|
|
|
26
24
|
"!**/tests"
|
|
27
25
|
],
|
|
28
26
|
"homepage": "https://github.com/Capillary/blaze-ui",
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
31
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
32
|
-
},
|
|
33
27
|
"dependencies": {
|
|
28
|
+
"@ant-design/icons": "^5.2.6",
|
|
34
29
|
"@capillarytech/cap-ui-utils": "^3.0.4",
|
|
30
|
+
"antd": "^5.12.0",
|
|
35
31
|
"prop-types": "^15.8.1",
|
|
36
32
|
"styled-components": "^5.3.11",
|
|
37
|
-
"react-intl": "
|
|
33
|
+
"react-intl": "2.7.2"
|
|
38
34
|
}
|
|
39
35
|
}
|
package/utils/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.withStyles = void 0;
|
|
5
|
+
var _withStyles = _interopRequireDefault(require("./withStyles"));
|
|
6
|
+
exports.withStyles = _withStyles.default;
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
const withStyledComponent = (WrappedComponent, styles) => {
|
|
8
|
+
const StyledComponent = (0, _styledComponents.default)(WrappedComponent).withConfig({
|
|
9
|
+
displayName: "StyledComponent",
|
|
10
|
+
componentId: "sc-ujcdm3-0"
|
|
11
|
+
})(["", ";"], styles);
|
|
12
|
+
StyledComponent.defaultProps = WrappedComponent.defaultProps;
|
|
13
|
+
return StyledComponent;
|
|
14
|
+
};
|
|
15
|
+
var _default = exports.default = withStyledComponent;
|
package/CapHeading/CapHeading.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { HeadingWrapper, HeadingSpan } from './styles';
|
|
4
|
-
|
|
5
|
-
const CapHeading = ({ type = 'h5', children, as, ...rest }) => {
|
|
6
|
-
return (
|
|
7
|
-
<HeadingWrapper type={type} as={as || 'div'} {...rest}>
|
|
8
|
-
{children}
|
|
9
|
-
</HeadingWrapper>
|
|
10
|
-
);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
CapHeading.propTypes = {
|
|
14
|
-
type: PropTypes.oneOf([
|
|
15
|
-
'h0',
|
|
16
|
-
'h1',
|
|
17
|
-
'h2',
|
|
18
|
-
'h3',
|
|
19
|
-
'h4',
|
|
20
|
-
'h5',
|
|
21
|
-
'h6',
|
|
22
|
-
'h7',
|
|
23
|
-
'h8',
|
|
24
|
-
'h9',
|
|
25
|
-
'h10',
|
|
26
|
-
'label1',
|
|
27
|
-
'label2',
|
|
28
|
-
'label3',
|
|
29
|
-
'label4',
|
|
30
|
-
'label5',
|
|
31
|
-
'label6',
|
|
32
|
-
]),
|
|
33
|
-
children: PropTypes.node,
|
|
34
|
-
as: PropTypes.string,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Inline span version
|
|
38
|
-
const CapHeadingSpan = ({ type = 'h5', children, ...rest }) => {
|
|
39
|
-
return (
|
|
40
|
-
<HeadingSpan type={type} {...rest}>
|
|
41
|
-
{children}
|
|
42
|
-
</HeadingSpan>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
CapHeadingSpan.propTypes = {
|
|
47
|
-
type: PropTypes.oneOf([
|
|
48
|
-
'h0',
|
|
49
|
-
'h1',
|
|
50
|
-
'h2',
|
|
51
|
-
'h3',
|
|
52
|
-
'h4',
|
|
53
|
-
'h5',
|
|
54
|
-
'h6',
|
|
55
|
-
'h7',
|
|
56
|
-
'h8',
|
|
57
|
-
'h9',
|
|
58
|
-
'h10',
|
|
59
|
-
'label1',
|
|
60
|
-
'label2',
|
|
61
|
-
'label3',
|
|
62
|
-
'label4',
|
|
63
|
-
'label5',
|
|
64
|
-
'label6',
|
|
65
|
-
]),
|
|
66
|
-
children: PropTypes.node,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
CapHeading.Span = CapHeadingSpan;
|
|
70
|
-
|
|
71
|
-
export default CapHeading;
|
package/CapHeading/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapHeading';
|