diginet-core-ui 1.3.33 → 1.3.34
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/assets/avatar/default.svg +2 -2
- package/assets/images/menu/dhr/ALL.svg +6 -0
- package/assets/images/menu/dhr/D00.svg +12 -0
- package/assets/images/menu/dhr/D09.svg +8 -0
- package/assets/images/menu/dhr/D13.svg +10 -0
- package/assets/images/menu/dhr/D15.svg +10 -0
- package/assets/images/menu/dhr/D21.svg +10 -0
- package/assets/images/menu/dhr/D25.svg +11 -0
- package/assets/images/menu/dhr/D29.svg +11 -0
- package/assets/images/menu/dhr/D38.svg +6 -0
- package/assets/images/menu/dhr/D39.svg +10 -0
- package/assets/images/menu/dhr/D51.svg +12 -0
- package/assets/images/menu/dhr/D52.svg +16 -0
- package/assets/images/menu/dhr/D77.svg +16 -0
- package/assets/images/menu/dhr/D84.svg +12 -0
- package/assets/images/menu/dhr/D89.svg +8 -0
- package/components/avatar/index.js +153 -204
- package/components/badge/index.js +120 -80
- package/components/button/icon.js +193 -170
- package/components/button/index.js +16 -9
- package/components/button/ripple-effect.js +2 -0
- package/components/chip/index.js +139 -137
- package/components/form-control/dropdown/index.js +337 -316
- package/components/form-control/dropdown-box/index.js +3 -3
- package/components/form-control/toggle/index.js +5 -12
- package/components/typography/index.js +92 -47
- package/icons/basic.js +74 -0
- package/icons/effect.js +51 -23
- package/package.json +1 -1
- package/readme.md +21 -0
- package/styles/colors.js +2 -2
- package/styles/general.js +15 -2
|
@@ -13,7 +13,7 @@ import Icon from '../../icons';
|
|
|
13
13
|
import Ripple from './ripple-effect';
|
|
14
14
|
import { getClassNameFromColor, getRippleColor } from '.';
|
|
15
15
|
import CircularProgress from '../progress/circular';
|
|
16
|
-
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, cursorPointer, flexRow, inlineFlex, justifyCenter, noBorder, outlineNone,
|
|
16
|
+
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, cursorPointer, flexRow, inlineFlex, justifyCenter, noBorder, outlineNone, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
|
|
17
17
|
const {
|
|
18
18
|
system: {
|
|
19
19
|
active,
|
|
@@ -87,189 +87,200 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
87
87
|
const ref = useRef(null);
|
|
88
88
|
const buttonSize = ((_sizeMap$get = sizeMap.get(size)) === null || _sizeMap$get === void 0 ? void 0 : _sizeMap$get.buttonSize) || '40px';
|
|
89
89
|
const iconSize = width ? isNaN(width) ? '60%' : customIconSize(parseInt(width)) + 'px' : ((_sizeMap$get2 = sizeMap.get(size)) === null || _sizeMap$get2 === void 0 ? void 0 : _sizeMap$get2.iconSize) || '24px';
|
|
90
|
+
const isViewTypeGhost = viewType === 'ghost';
|
|
91
|
+
|
|
92
|
+
const _width = isNaN(width) ? width : width + 'px';
|
|
93
|
+
|
|
94
|
+
const _height = isNaN(height) ? height : height + 'px';
|
|
95
|
+
|
|
90
96
|
colorHover = colorMap.get(colorHover) || colorHover;
|
|
91
97
|
const ButtonRoot = css`
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
${inlineFlex}
|
|
99
|
+
${positionRelative}
|
|
94
100
|
${justifyCenter}
|
|
95
101
|
${alignCenter}
|
|
96
102
|
${outlineNone}
|
|
97
103
|
${borderBox}
|
|
98
|
-
${overflowHidden}
|
|
99
104
|
${cursorPointer}
|
|
100
105
|
${userSelectNone}
|
|
101
106
|
padding: 0;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
border-radius: ${circular ? '50%' : '4px'};
|
|
108
|
+
transition: background-color 0.5s, filter 0.5s;
|
|
109
|
+
.DGN-UI-ButtonIcon-Icon {
|
|
110
|
+
${flexRow}
|
|
111
|
+
${positionRelative}
|
|
107
112
|
${borderBox}
|
|
108
113
|
${justifyCenter}
|
|
109
114
|
${alignCenter}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
&.button-icon--loading {
|
|
127
|
-
${pointerEventsNone}
|
|
128
|
-
}
|
|
129
|
-
&.${size} {
|
|
130
|
-
width: ${width ? isNaN(width) ? width : width + 'px' : buttonSize};
|
|
131
|
-
height: ${height ? isNaN(height) ? height : height + 'px' : buttonSize};
|
|
132
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
133
|
-
height: ${iconSize};
|
|
134
|
-
width: ${iconSize};
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
&.outlined {
|
|
138
|
-
${backgroundTransparent}
|
|
139
|
-
&.default {
|
|
140
|
-
${border(1, rest)}
|
|
141
|
-
color: ${rest};
|
|
142
|
-
&.button-icon--loading,
|
|
143
|
-
&:hover,
|
|
144
|
-
&:focus,
|
|
145
|
-
&:active {
|
|
146
|
-
color: ${colorHover};
|
|
147
|
-
border-color: ${colorHover};
|
|
115
|
+
}
|
|
116
|
+
&.button-icon--disabled {
|
|
117
|
+
cursor: not-allowed !important;
|
|
118
|
+
color: ${systemDisabled} !important;
|
|
119
|
+
&.outlined {
|
|
120
|
+
border-color: ${systemDisabled} !important;
|
|
121
|
+
background-color: transparent !important;
|
|
122
|
+
}
|
|
123
|
+
&.filled {
|
|
124
|
+
background-color: ${fillDisabled} !important;
|
|
125
|
+
filter: brightness(1) !important;
|
|
126
|
+
}
|
|
127
|
+
&.text {
|
|
128
|
+
background-color: transparent !important;
|
|
129
|
+
}
|
|
148
130
|
}
|
|
149
131
|
&.button-icon--loading {
|
|
150
|
-
|
|
132
|
+
${pointerEventsNone}
|
|
133
|
+
}
|
|
134
|
+
&.${size} {
|
|
135
|
+
width: ${width ? _width : buttonSize};
|
|
136
|
+
min-width: ${width ? _width : buttonSize};
|
|
137
|
+
height: ${height ? _height : buttonSize};
|
|
138
|
+
min-height: ${height ? _height : buttonSize};
|
|
139
|
+
.DGN-UI-ButtonIcon-Icon {
|
|
140
|
+
height: ${iconSize};
|
|
141
|
+
min-height: ${iconSize};
|
|
142
|
+
width: ${iconSize};
|
|
143
|
+
min-width: ${iconSize};
|
|
144
|
+
}
|
|
151
145
|
}
|
|
152
|
-
|
|
146
|
+
&.outlined {
|
|
147
|
+
${backgroundTransparent}
|
|
148
|
+
&.default {
|
|
149
|
+
${border(1, rest)}
|
|
150
|
+
color: ${rest};
|
|
151
|
+
&.button-icon--loading,
|
|
152
|
+
&:hover,
|
|
153
|
+
&:focus,
|
|
154
|
+
&:active {
|
|
155
|
+
color: ${colorHover};
|
|
156
|
+
border-color: ${colorHover};
|
|
157
|
+
}
|
|
158
|
+
&.button-icon--loading {
|
|
159
|
+
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
160
|
+
}
|
|
161
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
153
162
|
background-color: ${hexToRGBA(colorHover, alphaArr[key])};
|
|
154
163
|
}`)}// &:hover | &:focus | &:active
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
}
|
|
165
|
+
&.${color} {
|
|
166
|
+
${color !== 'default' && border(1, colorMap.get(color))}
|
|
167
|
+
color: ${colorMap.get(color)};
|
|
168
|
+
&.button-icon--loading {
|
|
169
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
170
|
+
}
|
|
171
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
163
172
|
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
164
173
|
}`)}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
}
|
|
175
|
+
&.custom-color {
|
|
176
|
+
${border(1, color)}
|
|
177
|
+
color: ${color};
|
|
178
|
+
&.button-icon--loading {
|
|
179
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
180
|
+
}
|
|
181
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
173
182
|
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
174
183
|
}`)}
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
&.filled {
|
|
178
|
-
${borderNone}
|
|
179
|
-
color: ${white};
|
|
180
|
-
font-weight: bold;
|
|
181
|
-
&.button-icon--loading,
|
|
182
|
-
&:hover,
|
|
183
|
-
&:focus {
|
|
184
|
-
filter: brightness(0.85);
|
|
185
|
-
}
|
|
186
|
-
&:active {
|
|
187
|
-
filter: brightness(0.7);
|
|
188
|
-
}
|
|
189
|
-
&.default {
|
|
190
|
-
background-color: ${rest};
|
|
191
|
-
&.button-icon--loading,
|
|
192
|
-
&:hover,
|
|
193
|
-
&:focus,
|
|
194
|
-
&:active {
|
|
195
|
-
background-color: ${colorHover};
|
|
184
|
+
}
|
|
196
185
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
186
|
+
&.filled {
|
|
187
|
+
${borderNone}
|
|
188
|
+
color: ${white};
|
|
189
|
+
font-weight: bold;
|
|
190
|
+
&.button-icon--loading,
|
|
191
|
+
&:hover,
|
|
192
|
+
&:focus {
|
|
193
|
+
filter: brightness(0.85);
|
|
194
|
+
}
|
|
195
|
+
&:active {
|
|
196
|
+
filter: brightness(0.7);
|
|
197
|
+
}
|
|
198
|
+
&.default {
|
|
199
|
+
background-color: ${rest};
|
|
200
|
+
&.button-icon--loading,
|
|
201
|
+
&:hover,
|
|
202
|
+
&:focus,
|
|
203
|
+
&:active {
|
|
204
|
+
background-color: ${colorHover};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
&.${color} {
|
|
208
|
+
background-color: ${colorMap.get(color)};
|
|
209
|
+
}
|
|
210
|
+
&.custom-color {
|
|
211
|
+
background-color: ${color};
|
|
212
|
+
}
|
|
214
213
|
}
|
|
215
|
-
&.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
214
|
+
&.text {
|
|
215
|
+
${noBorder}
|
|
216
|
+
${backgroundTransparent}
|
|
217
|
+
&.default {
|
|
218
|
+
color: ${rest};
|
|
219
|
+
&:hover,
|
|
220
|
+
&:focus,
|
|
221
|
+
&:active {
|
|
222
|
+
color: ${colorHover};
|
|
223
|
+
}
|
|
224
|
+
&.button-icon--loading {
|
|
225
|
+
color: ${active};
|
|
226
|
+
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
227
|
+
}
|
|
228
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
220
229
|
background-color: ${hexToRGBA(colorHover, alphaArr[key])};
|
|
221
230
|
}`)}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
}
|
|
232
|
+
&.${color} {
|
|
233
|
+
color: ${colorMap.get(color)};
|
|
234
|
+
&.button-icon--loading {
|
|
235
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
236
|
+
}
|
|
237
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
229
238
|
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
230
239
|
}`)}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
}
|
|
241
|
+
&.custom-color {
|
|
242
|
+
color: ${color};
|
|
243
|
+
&.button-icon--loading {
|
|
244
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
245
|
+
}
|
|
246
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
238
247
|
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
239
248
|
}`)}
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
&.ghost {
|
|
243
|
-
${backgroundTransparent}
|
|
244
|
-
${noBorder}
|
|
245
|
-
color: ${rest};
|
|
246
|
-
&.${size} {
|
|
247
|
-
height: ${iconSize};
|
|
248
|
-
width: ${iconSize};
|
|
249
|
-
}
|
|
250
|
-
&.default {
|
|
251
|
-
&:hover,
|
|
252
|
-
&:focus,
|
|
253
|
-
&:active {
|
|
254
|
-
color: ${iconColorMap.get(capitalize(name)) || colorHover};
|
|
249
|
+
}
|
|
255
250
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
251
|
+
&.ghost {
|
|
252
|
+
${backgroundTransparent}
|
|
253
|
+
${noBorder}
|
|
254
|
+
color: ${rest};
|
|
255
|
+
&.${size} {
|
|
256
|
+
height: ${height ? _height : iconSize};
|
|
257
|
+
min-height: ${height ? _height : iconSize};
|
|
258
|
+
width: ${width ? _width : iconSize};
|
|
259
|
+
min-width: ${width ? _width : iconSize};
|
|
260
|
+
}
|
|
261
|
+
&.loading,
|
|
262
|
+
&:hover,
|
|
263
|
+
&:focus {
|
|
264
|
+
filter: brightness(0.85);
|
|
265
|
+
}
|
|
266
|
+
&:active {
|
|
267
|
+
filter: brightness(0.7);
|
|
268
|
+
}
|
|
269
|
+
&.default {
|
|
270
|
+
&:hover,
|
|
271
|
+
&:focus,
|
|
272
|
+
&:active {
|
|
273
|
+
color: ${iconColorMap.get(capitalize(name)) || colorHover};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
&.${color} {
|
|
277
|
+
color: ${colorMap.get(color)};
|
|
278
|
+
}
|
|
279
|
+
&.custom-color {
|
|
280
|
+
color: ${color};
|
|
281
|
+
}
|
|
269
282
|
}
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
`;
|
|
283
|
+
`;
|
|
273
284
|
useImperativeHandle(reference, () => {
|
|
274
285
|
const currentRef = ref.current || {};
|
|
275
286
|
const _instance = {}; // methods
|
|
@@ -302,10 +313,10 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
302
313
|
if (!node) {
|
|
303
314
|
node = jsx(Icon, {
|
|
304
315
|
name: name,
|
|
305
|
-
width: iconSize,
|
|
306
|
-
height: iconSize,
|
|
316
|
+
width: isViewTypeGhost ? width ? _width : iconSize : iconSize,
|
|
317
|
+
height: isViewTypeGhost ? height ? _height : iconSize : iconSize,
|
|
307
318
|
color: 'currentColor',
|
|
308
|
-
viewBox:
|
|
319
|
+
viewBox: viewBox
|
|
309
320
|
});
|
|
310
321
|
}
|
|
311
322
|
|
|
@@ -320,7 +331,8 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
320
331
|
}, loading && iconLoading(), !loading && jsx("span", {
|
|
321
332
|
className: 'DGN-UI-ButtonIcon-Icon'
|
|
322
333
|
}, " ", node, " "), !disabled && !loading && viewType !== 'ghost' && jsx(Ripple, {
|
|
323
|
-
color: getRippleColor(color, viewType, allColors)
|
|
334
|
+
color: getRippleColor(color, viewType, allColors),
|
|
335
|
+
circular: true
|
|
324
336
|
}));
|
|
325
337
|
}, [size, viewType, color, colorHover, disabled, name, children, onClick, loading, circular, viewBox, width, height]);
|
|
326
338
|
}));
|
|
@@ -347,14 +359,14 @@ ButtonIcon.propTypes = {
|
|
|
347
359
|
/** custom hover color for button with color 'default' */
|
|
348
360
|
colorHover: PropTypes.string,
|
|
349
361
|
|
|
350
|
-
/**
|
|
351
|
-
* size of button
|
|
352
|
-
*
|
|
353
|
-
* * tiny (button 24px, icon 16px)
|
|
354
|
-
* * small (button 32px, icon 20px)
|
|
355
|
-
* * medium (button 40px, icon 24px)
|
|
356
|
-
* * large (button 48px, icon 32px)
|
|
357
|
-
* * giant (button 56px, icon 40px)
|
|
362
|
+
/**
|
|
363
|
+
* size of button
|
|
364
|
+
*
|
|
365
|
+
* * tiny (button 24px, icon 16px)
|
|
366
|
+
* * small (button 32px, icon 20px)
|
|
367
|
+
* * medium (button 40px, icon 24px)
|
|
368
|
+
* * large (button 48px, icon 32px)
|
|
369
|
+
* * giant (button 56px, icon 40px)
|
|
358
370
|
* */
|
|
359
371
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
360
372
|
|
|
@@ -391,12 +403,23 @@ ButtonIcon.propTypes = {
|
|
|
391
403
|
/** status loading of button */
|
|
392
404
|
loading: PropTypes.bool,
|
|
393
405
|
|
|
394
|
-
/**
|
|
395
|
-
* ref methods
|
|
396
|
-
*
|
|
397
|
-
* *
|
|
406
|
+
/**
|
|
407
|
+
* ref methods
|
|
408
|
+
*
|
|
409
|
+
* * option(): Gets all UI component properties
|
|
410
|
+
* * Returns value - object
|
|
411
|
+
* * option(optionName): Gets the value of a single property
|
|
412
|
+
* * @param {optionName} - string
|
|
413
|
+
* * Returns value - any
|
|
414
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
415
|
+
* * @param {optionName} - string
|
|
416
|
+
* * @param {optionValue} - any
|
|
417
|
+
* * option(options): Updates the values of several properties
|
|
418
|
+
* * @param {options} - object
|
|
398
419
|
*/
|
|
399
|
-
reference: PropTypes.func
|
|
420
|
+
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
421
|
+
current: PropTypes.instanceOf(Element)
|
|
422
|
+
})])
|
|
400
423
|
};
|
|
401
424
|
export { ButtonIcon };
|
|
402
425
|
export default OptionWrapper(ButtonIcon);
|
|
@@ -485,15 +485,22 @@ Button.propTypes = {
|
|
|
485
485
|
loading: PropTypes.bool,
|
|
486
486
|
|
|
487
487
|
/**
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
*
|
|
492
|
-
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
|
|
496
|
-
|
|
488
|
+
* ref methods
|
|
489
|
+
*
|
|
490
|
+
* * option(): Gets all UI component properties
|
|
491
|
+
* * Returns value - object
|
|
492
|
+
* * option(optionName): Gets the value of a single property
|
|
493
|
+
* * @param {optionName} - string
|
|
494
|
+
* * Returns value - any
|
|
495
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
496
|
+
* * @param {optionName} - string
|
|
497
|
+
* * @param {optionValue} - any
|
|
498
|
+
* * option(options): Updates the values of several properties
|
|
499
|
+
* * @param {options} - object
|
|
500
|
+
*/
|
|
501
|
+
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
502
|
+
current: PropTypes.instanceOf(Element)
|
|
503
|
+
})])
|
|
497
504
|
};
|
|
498
505
|
export { Button };
|
|
499
506
|
export default OptionWrapper(Button);
|
|
@@ -18,6 +18,7 @@ const useDebouncedRippleCleanUp = (rippleCount, duration, cleanUpFunction) => {
|
|
|
18
18
|
const Ripple = ({
|
|
19
19
|
duration = 850,
|
|
20
20
|
color = '#fff',
|
|
21
|
+
circular = false,
|
|
21
22
|
...props
|
|
22
23
|
}) => {
|
|
23
24
|
const [rippleArray, setRippleArray] = useState([]);
|
|
@@ -31,6 +32,7 @@ const Ripple = ({
|
|
|
31
32
|
right: 0;
|
|
32
33
|
bottom: 0;
|
|
33
34
|
left: 0;
|
|
35
|
+
${circular && 'border-radius: 50%;'}
|
|
34
36
|
|
|
35
37
|
span {
|
|
36
38
|
transform: scale(0);
|