@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.
Files changed (145) hide show
  1. package/components/CapInput/CapInput.js +60 -0
  2. package/components/CapInput/Number.js +39 -0
  3. package/components/CapInput/Search.js +34 -0
  4. package/components/CapInput/TextArea.js +41 -0
  5. package/components/CapInput/index.js +13 -0
  6. package/components/CapInput/messages.js +24 -0
  7. package/components/CapInput/styles.js +8 -0
  8. package/components/CapSkeleton/CapSkeleton.js +24 -0
  9. package/components/CapSkeleton/index.js +7 -0
  10. package/components/CapSpin/CapSpin.js +30 -0
  11. package/components/CapSpin/index.js +7 -0
  12. package/components/CapTable/CapTable.js +118 -0
  13. package/components/CapTable/index.js +7 -0
  14. package/components/CapTable/loadable.js +18 -0
  15. package/components/CapTable/styles.js +23 -0
  16. package/components/CapTestSelect/CapTestSelect.js +36 -0
  17. package/components/CapTestSelect/index.js +7 -0
  18. package/components/CapUnifiedSelect/CapUnifiedSelect.js +359 -0
  19. package/components/CapUnifiedSelect/index.js +7 -0
  20. package/components/CapUnifiedSelect/messages.js +27 -0
  21. package/components/CapUnifiedSelect/styles.js +36 -0
  22. package/components/LocaleHoc/index.js +42 -0
  23. package/components/index.js +33 -0
  24. package/components/styled/index.js +14 -0
  25. package/components/styled/variables.js +70 -0
  26. package/{translations → components/translations}/en.js +37 -35
  27. package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
  28. package/dist/components/CapSkeleton/index.js +13 -0
  29. package/dist/components/CapSpin/CapSpin.js +35 -0
  30. package/dist/components/CapSpin/index.js +13 -0
  31. package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
  32. package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
  33. package/dist/components/CapTestSelect/index.js +13 -0
  34. package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
  35. package/dist/components/CapUnifiedSelect/index.js +13 -0
  36. package/dist/components/CapUnifiedSelect/messages.js +29 -0
  37. package/dist/components/CapUnifiedSelect/styles.js +39 -0
  38. package/dist/{index.js → components/index.js} +27 -0
  39. package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
  40. package/dist/esm/components/CapSkeleton/index.js +1 -0
  41. package/dist/esm/components/CapSpin/CapSpin.js +28 -0
  42. package/dist/esm/components/CapSpin/index.js +1 -0
  43. package/dist/esm/components/CapTable/loadable.js +12 -0
  44. package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
  45. package/dist/esm/components/CapTestSelect/index.js +1 -0
  46. package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
  47. package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
  48. package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
  49. package/dist/esm/{index.js → components/index.js} +5 -1
  50. package/dist/esm/utils/index.js +1 -0
  51. package/dist/esm/utils/withStyles.js +23 -0
  52. package/dist/utils/index.js +13 -0
  53. package/dist/utils/withStyles.js +29 -0
  54. package/package.json +6 -10
  55. package/utils/index.js +7 -0
  56. package/utils/withStyles.js +15 -0
  57. package/CapHeading/CapHeading.js +0 -71
  58. package/CapHeading/index.js +0 -1
  59. package/CapHeading/styles.js +0 -125
  60. package/CapInfoNote/CapInfoNote.js +0 -54
  61. package/CapInfoNote/index.js +0 -1
  62. package/CapInfoNote/styles.js +0 -63
  63. package/CapInput/CapInput.js +0 -67
  64. package/CapInput/Number.js +0 -38
  65. package/CapInput/Search.js +0 -32
  66. package/CapInput/TextArea.js +0 -45
  67. package/CapInput/index.js +0 -10
  68. package/CapInput/loadable.js +0 -9
  69. package/CapInput/messages.js +0 -27
  70. package/CapInput/styles.js +0 -81
  71. package/CapLabel/CapLabel.js +0 -106
  72. package/CapLabel/index.js +0 -1
  73. package/CapLabel/styles.js +0 -221
  74. package/CapRow/CapRow.js +0 -22
  75. package/CapRow/index.js +0 -1
  76. package/CapRow/styles.js +0 -9
  77. package/CapTable/CapTable.js +0 -146
  78. package/CapTable/index.js +0 -3
  79. package/CapTable/loadable.js +0 -13
  80. package/CapTable/styles.js +0 -134
  81. package/CapTooltip/CapTooltip.js +0 -36
  82. package/CapTooltip/index.js +0 -1
  83. package/CapTooltip/styles.js +0 -42
  84. package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
  85. package/CapUnifiedSelect/index.js +0 -4
  86. package/CapUnifiedSelect/loadable.js +0 -3
  87. package/CapUnifiedSelect/messages.js +0 -24
  88. package/CapUnifiedSelect/styles.js +0 -223
  89. package/LocaleHoc/index.js +0 -38
  90. package/dist/235.index.js +0 -2
  91. package/dist/235.index.js.LICENSE.txt +0 -29
  92. package/dist/603.index.js +0 -1
  93. package/dist/esm/CapHeading/CapHeading.js +0 -41
  94. package/dist/esm/CapHeading/index.js +0 -1
  95. package/dist/esm/CapHeading/styles.js +0 -123
  96. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  97. package/dist/esm/CapInfoNote/index.js +0 -1
  98. package/dist/esm/CapInfoNote/styles.js +0 -6
  99. package/dist/esm/CapInput/loadable.js +0 -9
  100. package/dist/esm/CapLabel/CapLabel.js +0 -50
  101. package/dist/esm/CapLabel/index.js +0 -1
  102. package/dist/esm/CapLabel/styles.js +0 -219
  103. package/dist/esm/CapRow/index.js +0 -1
  104. package/dist/esm/CapRow/styles.js +0 -5
  105. package/dist/esm/CapTable/loadable.js +0 -12
  106. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  107. package/dist/esm/CapTooltip/index.js +0 -1
  108. package/dist/esm/CapTooltip/styles.js +0 -6
  109. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  110. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  111. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  112. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  113. package/dist/index.js.LICENSE.txt +0 -7
  114. package/index.js +0 -10
  115. package/styled/index.js +0 -6
  116. package/styled/variables.js +0 -89
  117. /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
  118. /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
  119. /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
  120. /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
  121. /package/dist/{CapInput → components/CapInput}/index.js +0 -0
  122. /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
  123. /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
  124. /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
  125. /package/dist/{CapTable → components/CapTable}/index.js +0 -0
  126. /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
  127. /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  128. /package/dist/{styled → components/styled}/index.js +0 -0
  129. /package/dist/{styled → components/styled}/variables.js +0 -0
  130. /package/dist/{translations → components/translations}/en.js +0 -0
  131. /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
  132. /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
  133. /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
  134. /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
  135. /package/dist/esm/{CapInput → components/CapInput}/index.js +0 -0
  136. /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
  137. /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
  138. /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
  139. /package/dist/esm/{CapTable → components/CapTable}/index.js +0 -0
  140. /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
  141. /package/dist/esm/{CapUnifiedSelect → components/CapUnifiedSelect}/messages.js +0 -0
  142. /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  143. /package/dist/esm/{styled → components/styled}/index.js +0 -0
  144. /package/dist/esm/{styled → components/styled}/variables.js +0 -0
  145. /package/dist/esm/{translations → components/translations}/en.js +0 -0
@@ -1,121 +0,0 @@
1
- // CapUnifiedSelect component using Ant Design v5 Select and TreeSelect directly
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { Select, TreeSelect } from 'antd';
5
- import { SelectWrapper, HeaderWrapper, StyledInfoIcon } from './styles';
6
- import CapLabel from '../CapLabel';
7
- import CapTooltip from '../CapTooltip';
8
-
9
- function CapUnifiedSelect({
10
- type,
11
- options = [],
12
- treeData,
13
- value,
14
- onChange,
15
- placeholder = 'Select an option',
16
- className,
17
- style,
18
- allowClear = false,
19
- showSearch = false,
20
- label,
21
- tooltip,
22
- disabled = false,
23
- }) {
24
- const selectVirtualizationProps = {
25
- listHeight: 256,
26
- };
27
-
28
- const treeSelectVirtualizationProps = {
29
- listHeight: 256,
30
- listItemHeight: 32,
31
- };
32
-
33
- const renderHeader = () => {
34
- if (!label && !tooltip) return null;
35
-
36
- return (
37
- <HeaderWrapper className={disabled ? 'disabled' : ''}>
38
- {label && (
39
- <CapLabel type="label16" className={disabled ? 'disabled' : ''}>
40
- {label}
41
- </CapLabel>
42
- )}
43
- {tooltip && (
44
- <CapTooltip title={tooltip}>
45
- <StyledInfoIcon className={disabled ? 'disabled' : ''} />
46
- </CapTooltip>
47
- )}
48
- </HeaderWrapper>
49
- );
50
- };
51
-
52
- const renderDropdown = () => {
53
- if (type === 'treeSelect' || type === 'multiTreeSelect') {
54
- return (
55
- <TreeSelect
56
- treeData={treeData || options}
57
- value={value}
58
- onChange={onChange}
59
- placeholder={placeholder}
60
- className={className}
61
- style={style}
62
- allowClear={allowClear}
63
- showSearch={showSearch}
64
- multiple={type === 'multiTreeSelect' ? true : false}
65
- virtual
66
- treeDefaultExpandAll
67
- disabled={disabled}
68
- {...treeSelectVirtualizationProps}
69
- />
70
- );
71
- }
72
-
73
- return (
74
- <Select
75
- value={value}
76
- onChange={onChange}
77
- placeholder={placeholder}
78
- className={className}
79
- style={style}
80
- allowClear={allowClear}
81
- showSearch={showSearch}
82
- options={options}
83
- mode={type === 'multiSelect' ? 'multiple' : undefined}
84
- virtual
85
- disabled={disabled}
86
- {...selectVirtualizationProps}
87
- />
88
- );
89
- };
90
-
91
- return (
92
- <SelectWrapper>
93
- {renderHeader()}
94
- {renderDropdown()}
95
- </SelectWrapper>
96
- );
97
- }
98
-
99
- CapUnifiedSelect.propTypes = {
100
- type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
101
- options: PropTypes.array,
102
- treeData: PropTypes.array,
103
- value: PropTypes.any,
104
- onChange: PropTypes.func,
105
- placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
106
- className: PropTypes.string,
107
- style: PropTypes.object,
108
- allowClear: PropTypes.bool,
109
- showSearch: PropTypes.bool,
110
- label: PropTypes.string,
111
- tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
112
- disabled: PropTypes.bool,
113
- };
114
-
115
- CapUnifiedSelect.defaultProps = {
116
- type: 'select',
117
- allowClear: false,
118
- showSearch: false,
119
- };
120
-
121
- export default CapUnifiedSelect;
@@ -1,4 +0,0 @@
1
- import CapUnifiedSelect from './CapUnifiedSelect';
2
- import CapUnifiedSelectLoadable from './loadable';
3
-
4
- export default CapUnifiedSelectLoadable;
@@ -1,3 +0,0 @@
1
- import loadable from '@loadable/component';
2
-
3
- export default loadable(() => import('./CapUnifiedSelect'));
@@ -1,24 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
-
3
- export default defineMessages({
4
- selectPlaceholder: {
5
- id: 'cap.unified.select.placeholder',
6
- defaultMessage: 'Select an option',
7
- },
8
- searchPlaceholder: {
9
- id: 'cap.unified.select.search.placeholder',
10
- defaultMessage: 'Search...',
11
- },
12
- noData: {
13
- id: 'cap.unified.select.no.data',
14
- defaultMessage: 'No data',
15
- },
16
- loading: {
17
- id: 'cap.unified.select.loading',
18
- defaultMessage: 'Loading...',
19
- },
20
- selected: {
21
- id: 'cap.unified.select.selected',
22
- defaultMessage: '{count} items selected',
23
- },
24
- });
@@ -1,223 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import * as styledVars from '../styled/variables';
3
-
4
- export const SelectWrapper = styled.div`
5
- display: flex;
6
- flex-direction: column;
7
- gap: 8px;
8
- width: 100%;
9
-
10
- &.disabled {
11
- cursor: not-allowed;
12
- }
13
- `;
14
-
15
- export const HeaderWrapper = styled.div`
16
- display: flex;
17
- align-items: center;
18
- gap: 4px;
19
-
20
- &.disabled {
21
- opacity: 0.5;
22
- cursor: not-allowed;
23
- }
24
- `;
25
-
26
-
27
-
28
- export const StyledInfoIcon = styled.span`
29
- color: ${styledVars.CAP_G2};
30
- font-size: 16px;
31
- cursor: help;
32
-
33
- &:hover {
34
- color: ${styledVars.CAP_G1};
35
- }
36
-
37
- &.disabled {
38
- cursor: not-allowed;
39
- &:hover {
40
- color: ${styledVars.CAP_G2};
41
- }
42
- }
43
- `;
44
-
45
- export const selectStyles = css`
46
- &.cap-unified-select {
47
- width: 100%;
48
- font-family: ${styledVars.FONT_FAMILY};
49
-
50
- .ant-select-selector {
51
- border-radius: ${styledVars.RADIUS_04};
52
- transition: ${styledVars.TRANSITION_ALL};
53
- padding: 0 12px;
54
- min-height: 32px;
55
- display: flex;
56
- align-items: center;
57
-
58
- &:hover {
59
- border-color: ${styledVars.CAP_G11};
60
- }
61
- }
62
-
63
- /* Right slot content styles */
64
- .cap-unified-select-right-slot {
65
- display: flex;
66
- align-items: center;
67
- gap: 8px;
68
- margin-left: 8px;
69
- }
70
-
71
- &.ant-select-focused {
72
- .ant-select-selector {
73
- border-color: ${styledVars.CAP_G01} !important;
74
- box-shadow: none !important;
75
- }
76
- }
77
-
78
- /* Error state */
79
- &.ant-select-status-error {
80
- .ant-select-selector {
81
- border-color: ${styledVars.CAP_RED};
82
- }
83
- }
84
-
85
- /* Disabled state */
86
- &.ant-select-disabled {
87
- .ant-select-selector {
88
- background-color: ${styledVars.CAP_G08};
89
- cursor: not-allowed;
90
- }
91
- }
92
-
93
- /* Dropdown styles */
94
- .ant-select-dropdown {
95
- padding: 4px;
96
- border-radius: ${styledVars.RADIUS_04};
97
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
98
-
99
- .ant-select-item {
100
- border-radius: ${styledVars.RADIUS_04};
101
- padding: 8px 12px;
102
- transition: ${styledVars.TRANSITION_ALL};
103
-
104
- &-option-selected {
105
- background-color: ${styledVars.CAP_PRIMARY.light};
106
- color: ${styledVars.CAP_PRIMARY.base};
107
- font-weight: 500;
108
- }
109
-
110
- &-option-active {
111
- background-color: ${styledVars.CAP_G08};
112
- }
113
- }
114
-
115
- /* Search input styles */
116
- .ant-select-search {
117
- padding: 8px;
118
-
119
- input {
120
- border-radius: ${styledVars.RADIUS_04};
121
- transition: ${styledVars.TRANSITION_ALL};
122
-
123
- &:focus {
124
- border-color: ${styledVars.CAP_G01};
125
- box-shadow: none;
126
- }
127
- }
128
- }
129
- }
130
-
131
- /* Multiple selection styles */
132
- &.ant-select-multiple {
133
- .ant-select-selection-item {
134
- background-color: ${styledVars.CAP_PRIMARY.light};
135
- border-color: ${styledVars.CAP_PRIMARY.light};
136
- border-radius: ${styledVars.RADIUS_04};
137
- color: ${styledVars.CAP_PRIMARY.base};
138
- margin: 2px 4px 2px 0;
139
- padding: 0 8px;
140
- height: 24px;
141
- line-height: 22px;
142
-
143
- &-remove {
144
- color: ${styledVars.CAP_PRIMARY.base};
145
-
146
- &:hover {
147
- color: ${styledVars.CAP_PRIMARY.hover};
148
- }
149
- }
150
- }
151
-
152
- .ant-select-selection-overflow {
153
- flex-wrap: wrap;
154
- gap: 4px;
155
- }
156
- }
157
-
158
- /* Tree select styles */
159
- .ant-select-tree {
160
- padding: 4px 0;
161
-
162
- .ant-select-tree-node-content-wrapper {
163
- padding: 4px 8px;
164
- border-radius: ${styledVars.RADIUS_04};
165
- transition: ${styledVars.TRANSITION_ALL};
166
-
167
- &:hover {
168
- background-color: ${styledVars.CAP_G08};
169
- }
170
-
171
- &.ant-select-tree-node-selected {
172
- background-color: ${styledVars.CAP_PRIMARY.light};
173
- color: ${styledVars.CAP_PRIMARY.base};
174
- font-weight: 500;
175
- }
176
- }
177
-
178
- .ant-select-tree-switcher {
179
- width: 24px;
180
- height: 24px;
181
- line-height: 24px;
182
- }
183
-
184
- .ant-select-tree-checkbox {
185
- margin: 4px 8px 4px 0;
186
- }
187
- }
188
-
189
- /* Size variations */
190
- &.ant-select-lg {
191
- .ant-select-selector {
192
- height: 40px;
193
- padding: 0 16px;
194
- }
195
-
196
- .ant-select-selection-item {
197
- height: 28px;
198
- line-height: 26px;
199
- }
200
- }
201
-
202
- &.ant-select-sm {
203
- .ant-select-selector {
204
- height: 24px;
205
- padding: 0 8px;
206
- }
207
-
208
- .ant-select-selection-item {
209
- height: 20px;
210
- line-height: 18px;
211
- }
212
- }
213
-
214
- /* Loading state */
215
- &.ant-select-loading {
216
- .ant-select-arrow {
217
- .anticon-loading {
218
- color: ${styledVars.CAP_PRIMARY.base};
219
- }
220
- }
221
- }
222
- }
223
- `;
@@ -1,38 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { injectIntl } from 'react-intl';
3
- import enTranslation from '../translations/en';
4
-
5
- const prefix = `blaze.components`;
6
-
7
- const LocaleHoc = (WrapperComponent, customProps) => {
8
- const Wrapper = (props) => {
9
- const componentName = customProps.key;
10
- const translatedDefaults = enTranslation[componentName];
11
- const { intl } = props;
12
-
13
- const translatedProps = useMemo(() => {
14
- if(!translatedDefaults) return {};
15
- return Object.keys(translatedDefaults).reduce((acc, key) => {
16
- const id = `${prefix}.${componentName}.${key}`
17
- const defaultMessage = translatedDefaults[key]
18
- try{
19
- acc[key] = intl.formatMessage({ id, defaultMessage });
20
- }catch(err){
21
- acc[key] = defaultMessage;
22
- }
23
- return acc;
24
- }, {});
25
- }, [translatedDefaults, intl]);
26
-
27
- return (
28
- <WrapperComponent
29
- {...translatedProps}
30
- {...props}
31
- />
32
- );
33
- }
34
-
35
- return injectIntl(Wrapper);
36
- };
37
-
38
- export default LocaleHoc;