@capillarytech/blaze-ui 0.1.4-alpha.6 → 0.1.5
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/CapInput/index.js +3 -4
- package/CapInput/loadable.js +1 -1
- package/CapTable/CapTable.js +95 -111
- package/CapTable/index.js +3 -1
- package/CapTable/loadable.js +13 -0
- package/CapTable/styles.js +60 -20
- package/CapUnifiedSelect/CapUnifiedSelect.js +159 -0
- package/CapUnifiedSelect/index.js +4 -0
- package/CapUnifiedSelect/loadable.js +3 -0
- package/CapUnifiedSelect/messages.js +24 -0
- package/CapUnifiedSelect/styles.js +182 -0
- package/LocaleHoc/index.js +38 -0
- package/dist/235.index.js +2 -0
- package/dist/235.index.js.LICENSE.txt +29 -0
- package/dist/603.index.js +1 -0
- package/dist/esm/CapInput/index.js +2 -4
- package/dist/esm/CapInput/loadable.js +1 -1
- package/dist/esm/CapTable/CapTable.js +93 -78
- package/dist/esm/CapTable/index.js +2 -1
- package/dist/esm/CapTable/loadable.js +12 -0
- package/dist/esm/CapTable/styles.js +17 -2
- package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +151 -0
- package/dist/esm/CapUnifiedSelect/index.js +3 -0
- package/dist/esm/CapUnifiedSelect/loadable.js +4 -0
- package/dist/esm/CapUnifiedSelect/messages.js +23 -0
- package/dist/esm/CapUnifiedSelect/styles.js +3 -0
- package/dist/esm/LocaleHoc/index.js +31 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/translations/en.js +329 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -10
- package/index.js +4 -0
- package/package.json +1 -1
- package/translations/en.js +331 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import * as styledVars from '../styled/variables';
|
|
3
|
+
|
|
4
|
+
export const selectStyles = css`
|
|
5
|
+
&.cap-unified-select {
|
|
6
|
+
width: 100%;
|
|
7
|
+
font-family: ${styledVars.FONT_FAMILY};
|
|
8
|
+
|
|
9
|
+
.ant-select-selector {
|
|
10
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
11
|
+
transition: ${styledVars.TRANSITION_ALL};
|
|
12
|
+
padding: 0 12px;
|
|
13
|
+
min-height: 32px;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
border-color: ${styledVars.CAP_G11};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Right slot content styles */
|
|
23
|
+
.cap-unified-select-right-slot {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 8px;
|
|
27
|
+
margin-left: 8px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.ant-select-focused {
|
|
31
|
+
.ant-select-selector {
|
|
32
|
+
border-color: ${styledVars.CAP_G01} !important;
|
|
33
|
+
box-shadow: none !important;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Error state */
|
|
38
|
+
&.ant-select-status-error {
|
|
39
|
+
.ant-select-selector {
|
|
40
|
+
border-color: ${styledVars.CAP_RED};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Disabled state */
|
|
45
|
+
&.ant-select-disabled {
|
|
46
|
+
.ant-select-selector {
|
|
47
|
+
background-color: ${styledVars.CAP_G08};
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Dropdown styles */
|
|
53
|
+
.ant-select-dropdown {
|
|
54
|
+
padding: 4px;
|
|
55
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
56
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
57
|
+
|
|
58
|
+
.ant-select-item {
|
|
59
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
60
|
+
padding: 8px 12px;
|
|
61
|
+
transition: ${styledVars.TRANSITION_ALL};
|
|
62
|
+
|
|
63
|
+
&-option-selected {
|
|
64
|
+
background-color: ${styledVars.CAP_PRIMARY.light};
|
|
65
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&-option-active {
|
|
70
|
+
background-color: ${styledVars.CAP_G08};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Search input styles */
|
|
75
|
+
.ant-select-search {
|
|
76
|
+
padding: 8px;
|
|
77
|
+
|
|
78
|
+
input {
|
|
79
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
80
|
+
transition: ${styledVars.TRANSITION_ALL};
|
|
81
|
+
|
|
82
|
+
&:focus {
|
|
83
|
+
border-color: ${styledVars.CAP_G01};
|
|
84
|
+
box-shadow: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Multiple selection styles */
|
|
91
|
+
&.ant-select-multiple {
|
|
92
|
+
.ant-select-selection-item {
|
|
93
|
+
background-color: ${styledVars.CAP_PRIMARY.light};
|
|
94
|
+
border-color: ${styledVars.CAP_PRIMARY.light};
|
|
95
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
96
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
97
|
+
margin: 2px 4px 2px 0;
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
height: 24px;
|
|
100
|
+
line-height: 22px;
|
|
101
|
+
|
|
102
|
+
&-remove {
|
|
103
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
color: ${styledVars.CAP_PRIMARY.hover};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ant-select-selection-overflow {
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
gap: 4px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Tree select styles */
|
|
118
|
+
.ant-select-tree {
|
|
119
|
+
padding: 4px 0;
|
|
120
|
+
|
|
121
|
+
.ant-select-tree-node-content-wrapper {
|
|
122
|
+
padding: 4px 8px;
|
|
123
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
124
|
+
transition: ${styledVars.TRANSITION_ALL};
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
background-color: ${styledVars.CAP_G08};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&.ant-select-tree-node-selected {
|
|
131
|
+
background-color: ${styledVars.CAP_PRIMARY.light};
|
|
132
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ant-select-tree-switcher {
|
|
138
|
+
width: 24px;
|
|
139
|
+
height: 24px;
|
|
140
|
+
line-height: 24px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ant-select-tree-checkbox {
|
|
144
|
+
margin: 4px 8px 4px 0;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Size variations */
|
|
149
|
+
&.ant-select-lg {
|
|
150
|
+
.ant-select-selector {
|
|
151
|
+
height: 40px;
|
|
152
|
+
padding: 0 16px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ant-select-selection-item {
|
|
156
|
+
height: 28px;
|
|
157
|
+
line-height: 26px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.ant-select-sm {
|
|
162
|
+
.ant-select-selector {
|
|
163
|
+
height: 24px;
|
|
164
|
+
padding: 0 8px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ant-select-selection-item {
|
|
168
|
+
height: 20px;
|
|
169
|
+
line-height: 18px;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Loading state */
|
|
174
|
+
&.ant-select-loading {
|
|
175
|
+
.ant-select-arrow {
|
|
176
|
+
.anticon-loading {
|
|
177
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
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;
|