diginet-core-ui 1.3.42 → 1.3.43
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/images/menu/dhr/MHRM00N0002.svg +22 -0
- package/assets/images/menu/dhr/MHRM00N0003.svg +17 -0
- package/assets/images/menu/dhr/MHRM00N0004.svg +12 -0
- package/assets/images/menu/dhr/MHRM13N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRM13N0003.svg +12 -0
- package/assets/images/menu/dhr/MHRM29N0004.svg +18 -0
- package/assets/images/menu/dhr/MHRM39N0017.svg +14 -0
- package/assets/images/menu/dhr/MHRM39N0018.svg +5 -0
- package/assets/images/menu/dhr/MHRM39N0019.svg +11 -0
- package/components/alert/notify.js +16 -16
- package/components/badge/index.js +5 -5
- package/components/button/index.js +13 -13
- package/components/form-control/attachment/index.js +20 -20
- package/components/form-control/calendar/function.js +113 -113
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/checkbox/index.js +152 -154
- package/components/form-control/date-range-picker/index.js +6 -6
- package/components/form-control/dropdown-box/index.js +3 -9
- package/components/form-control/form-group/index.js +40 -36
- package/components/form-control/label/index.js +12 -6
- package/components/form-control/number-input/index2.js +21 -19
- package/components/form-control/text-input/index.js +21 -19
- package/components/form-control/toggle/index.js +46 -56
- package/components/paging/page-info.js +9 -9
- package/components/popover/index.js +21 -21
- package/components/popup/v2/index.js +7 -7
- package/components/progress/circular.js +12 -12
- package/components/tab/tab-container.js +19 -11
- package/components/tab/tab-header.js +34 -31
- package/components/tab/tab-panel.js +15 -12
- package/components/tab/tab.js +60 -58
- package/icons/effect.js +15 -15
- package/package.json +1 -1
- package/readme.md +49 -33
- package/utils/number.js +6 -6
|
@@ -5,20 +5,25 @@ import { css, jsx } from '@emotion/core';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { forwardRef, memo, useEffect, useRef, useState, useImperativeHandle } from 'react';
|
|
7
7
|
import { Typography } from '../..';
|
|
8
|
-
import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow,
|
|
8
|
+
import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow, positionAbsolute, positionRelative, cursorNoDrop } from '../../../styles/general';
|
|
9
9
|
import { randomString } from '../../../utils';
|
|
10
10
|
import { color as colors } from '../../../styles/colors';
|
|
11
|
+
import theme from '../../../theme/settings';
|
|
11
12
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
colors: {
|
|
14
|
+
system: {
|
|
15
|
+
rest,
|
|
16
|
+
white
|
|
17
|
+
},
|
|
18
|
+
fill: {
|
|
19
|
+
hover: clFillHover,
|
|
20
|
+
pressed: clFillPressed
|
|
21
|
+
},
|
|
22
|
+
disabled: clDisabled,
|
|
23
|
+
formal2: clFormal2
|
|
16
24
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
focusshd
|
|
20
|
-
}
|
|
21
|
-
} = colors;
|
|
25
|
+
spacing
|
|
26
|
+
} = theme;
|
|
22
27
|
const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
23
28
|
id,
|
|
24
29
|
className,
|
|
@@ -36,6 +41,8 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
41
|
children,
|
|
37
42
|
inputProps,
|
|
38
43
|
forTreeView,
|
|
44
|
+
width,
|
|
45
|
+
labelProps,
|
|
39
46
|
...props
|
|
40
47
|
}, reference) => {
|
|
41
48
|
if (!inputRef) {
|
|
@@ -43,7 +50,9 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
const ref = useRef(null);
|
|
53
|
+
if (typeof width === 'number') width += 'px';
|
|
46
54
|
const [checkedState, setCheckedState] = useState(checked || defaultChecked);
|
|
55
|
+
const padding = spacing(0.5);
|
|
47
56
|
|
|
48
57
|
if (!id) {
|
|
49
58
|
[id] = useState('DGN-UI-' + randomString(10, {
|
|
@@ -52,140 +61,122 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
52
61
|
}));
|
|
53
62
|
}
|
|
54
63
|
|
|
55
|
-
const
|
|
56
|
-
&:checked + span {
|
|
57
|
-
background-color: ${colors[color] || color};
|
|
58
|
-
border-color: ${colors[color] || color};
|
|
59
|
-
&.determinate {
|
|
60
|
-
&::after {
|
|
61
|
-
transform: translate(-50%, -66%) scale(1) rotate(-45deg);
|
|
62
|
-
background:
|
|
63
|
-
linear-gradient(${white}, ${white}) left bottom/2px 100%,
|
|
64
|
-
linear-gradient(${white}, ${white}) left bottom/100% 2px;
|
|
65
|
-
background-repeat: no-repeat;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
&.indeterminate {
|
|
69
|
-
&::after {
|
|
70
|
-
transform: scale(1);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
64
|
+
const clMain = colors[color] || color;
|
|
75
65
|
const CheckBoxSquare = css`
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
${flexRow};
|
|
67
|
+
${positionRelative};
|
|
68
|
+
${cursorPointer};
|
|
69
|
+
${borderBox};
|
|
70
|
+
width: ${width};
|
|
71
|
+
min-width: ${width};
|
|
72
|
+
height: ${width};
|
|
73
|
+
min-height: ${width};
|
|
74
|
+
background-color: ${white};
|
|
75
|
+
border: 2px solid ${rest};
|
|
76
|
+
border-radius: 2px;
|
|
77
|
+
margin-right: ${spacing(2)}px;
|
|
78
|
+
&.determinate {
|
|
79
|
+
&::after {
|
|
80
|
+
${displayBlock}
|
|
81
|
+
${positionAbsolute}
|
|
90
82
|
content : '';
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
height: 7px;
|
|
84
|
+
left: 50%;
|
|
85
|
+
top: 43%;
|
|
86
|
+
transform: translate(-50%, -50%) scale(0) rotate(45deg);
|
|
87
|
+
transition: transform 0.3s;
|
|
88
|
+
width: 12.6px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
&.indeterminate {
|
|
92
|
+
&::after {
|
|
93
|
+
${flexRow}
|
|
94
|
+
${positionAbsolute}
|
|
103
95
|
content: "";
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
96
|
+
background-color: white;
|
|
97
|
+
left: 2px;
|
|
98
|
+
top: 6px;
|
|
99
|
+
width: 10px;
|
|
100
|
+
height: 2px;
|
|
101
|
+
transition: transform 0.3s;
|
|
102
|
+
transform: scale(0);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
&:not(.disabled):not(.read-only) {
|
|
106
|
+
&:hover {
|
|
107
|
+
box-shadow: 0 0 0 3px ${clFillHover};
|
|
108
|
+
background-color: ${clFillHover};
|
|
109
|
+
border-color: ${clMain};
|
|
110
|
+
}
|
|
111
|
+
&:focus,
|
|
112
|
+
&:active {
|
|
113
|
+
box-shadow: 0 0 0 3px ${clFillPressed};
|
|
114
|
+
background-color: ${clFillPressed};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
&:not(disabled):focus {
|
|
118
|
+
box-shadow: 0 0 0 3px ${clFillPressed};
|
|
119
|
+
background-color: ${clFillPressed};
|
|
120
|
+
}
|
|
121
|
+
&.disabled,
|
|
122
|
+
&.read-only {
|
|
123
|
+
${cursorNoDrop};
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
const CheckBoxInput = css`
|
|
127
|
+
&:checked + label > span.css-${CheckBoxSquare.name} {
|
|
128
|
+
&.determinate {
|
|
129
|
+
&::after {
|
|
130
|
+
transform: translate(-50%, -66%) scale(1) rotate(-45deg);
|
|
131
|
+
background: linear-gradient(${white}, ${white}) left bottom/2px 100%,
|
|
132
|
+
linear-gradient(${white}, ${white}) left bottom/100% 2px;
|
|
133
|
+
background-repeat: no-repeat;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
&.indeterminate {
|
|
137
|
+
&::after {
|
|
138
|
+
transform: scale(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
&:checked:not(:disabled) + label > span.css-${CheckBoxSquare.name} {
|
|
143
|
+
background-color: ${clMain} !important;
|
|
144
|
+
border-color: ${clMain} !important;
|
|
145
|
+
}
|
|
146
|
+
&:checked:disabled {
|
|
147
|
+
& + label > span.css-${CheckBoxSquare.name} {
|
|
148
|
+
&:not(.indeterminate) {
|
|
149
|
+
background-color: ${clDisabled} !important;
|
|
150
|
+
}
|
|
151
|
+
&.indeterminate {
|
|
152
|
+
background-color: ${clFormal2} !important;
|
|
153
|
+
border-color: ${clFormal2} !important;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
&:disabled {
|
|
158
|
+
& + label > span.css-${CheckBoxSquare.name} {
|
|
159
|
+
border-color: ${clDisabled};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
120
163
|
const CheckBoxLabel = css`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
164
|
+
${flexRow};
|
|
165
|
+
${positionRelative};
|
|
166
|
+
${alignCenter};
|
|
167
|
+
${borderBox};
|
|
168
|
+
margin-bottom: 0 !important;
|
|
169
|
+
`;
|
|
127
170
|
const CheckBoxRoot = css`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
${userSelectNone}
|
|
133
|
-
${borderBox}
|
|
134
|
-
margin: 3px 0;
|
|
135
|
-
&.disabled {
|
|
136
|
-
${pointerEventsNone}
|
|
137
|
-
.css-${CheckBoxSquare.name} {
|
|
138
|
-
border-color:${systemDisabled};
|
|
139
|
-
}
|
|
140
|
-
.css-${CheckBoxInput.name} {
|
|
141
|
-
&:checked {
|
|
142
|
-
&.determinate + span::after {
|
|
143
|
-
background:
|
|
144
|
-
linear-gradient(${white},${white}) left bottom/2px 100%,
|
|
145
|
-
linear-gradient(${white},${white}) left bottom/ 100% 2px;
|
|
146
|
-
background-repeat: no-repeat;
|
|
147
|
-
}
|
|
148
|
-
&.indeterminate + span::after {
|
|
149
|
-
background-color: ${white};
|
|
150
|
-
}
|
|
151
|
-
& + span {
|
|
152
|
-
background-color:${systemDisabled};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
&.read-only {
|
|
158
|
-
${pointerEventsNone}
|
|
159
|
-
${userSelectNone}
|
|
160
|
-
}
|
|
161
|
-
&:not(.disabled):hover {
|
|
162
|
-
.css-${CheckBoxSquare.name} {
|
|
163
|
-
background-color:${hover};
|
|
164
|
-
border-color:${colors[color] || color};
|
|
165
|
-
}
|
|
166
|
-
.css-${CheckBoxInput.name} {
|
|
167
|
-
&:checked {
|
|
168
|
-
&.determinate + span::after {
|
|
169
|
-
background:
|
|
170
|
-
linear-gradient(${colors[color] || color},${colors[color] || color}) left bottom/2px 100%,
|
|
171
|
-
linear-gradient(${colors[color] || color},${colors[color] || color}) left bottom/100% 2px;
|
|
172
|
-
background-repeat: no-repeat;
|
|
173
|
-
}
|
|
174
|
-
&.indeterminate + span::after {
|
|
175
|
-
background-color: ${colors[color] || color};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
`;
|
|
171
|
+
${flexRow};
|
|
172
|
+
${alignStart};
|
|
173
|
+
${borderBox};
|
|
174
|
+
`;
|
|
181
175
|
const CheckboxContainer = css`
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
cursor: no-drop;
|
|
187
|
-
}
|
|
188
|
-
`;
|
|
176
|
+
${displayBlock};
|
|
177
|
+
${positionRelative};
|
|
178
|
+
padding: ${padding}px;
|
|
179
|
+
`;
|
|
189
180
|
|
|
190
181
|
const handleChange = () => {
|
|
191
182
|
if (readOnly || inputProps.readOnly || disabled || inputProps.disabled) return;
|
|
@@ -235,7 +226,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
235
226
|
return jsx("div", {
|
|
236
227
|
id: 'DGN-UI-Checkbox-' + id.replace('DGN-UI-', ''),
|
|
237
228
|
css: CheckboxContainer,
|
|
238
|
-
className: ['DGN-UI-Checkbox',
|
|
229
|
+
className: ['DGN-UI-Checkbox', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
239
230
|
ref: ref,
|
|
240
231
|
...props,
|
|
241
232
|
onClick: handleChange
|
|
@@ -256,16 +247,15 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
256
247
|
checked: checkedState,
|
|
257
248
|
onChange: handleChange,
|
|
258
249
|
hidden: true
|
|
259
|
-
}), jsx("
|
|
260
|
-
css: CheckBoxSquare,
|
|
261
|
-
className: determinate ? 'determinate' : 'indeterminate'
|
|
262
|
-
}), (children || label) && jsx("div", {
|
|
250
|
+
}), jsx("label", {
|
|
263
251
|
css: CheckBoxLabel
|
|
264
|
-
}, jsx(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
252
|
+
}, jsx("span", {
|
|
253
|
+
className: [determinate ? 'determinate' : 'indeterminate', readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' '),
|
|
254
|
+
css: CheckBoxSquare
|
|
255
|
+
}), (children || label) && jsx(Typography, {
|
|
256
|
+
type: 'p1',
|
|
257
|
+
color: disabled ? clDisabled : '',
|
|
258
|
+
...labelProps
|
|
269
259
|
}, children || label))));
|
|
270
260
|
}));
|
|
271
261
|
Checkbox.defaultProps = {
|
|
@@ -276,7 +266,9 @@ Checkbox.defaultProps = {
|
|
|
276
266
|
readOnly: false,
|
|
277
267
|
defaultChecked: false,
|
|
278
268
|
determinate: true,
|
|
279
|
-
inputProps: {}
|
|
269
|
+
inputProps: {},
|
|
270
|
+
labelProps: {},
|
|
271
|
+
width: 18
|
|
280
272
|
};
|
|
281
273
|
Checkbox.propTypes = {
|
|
282
274
|
/** value to check/uncheck square */
|
|
@@ -312,17 +304,23 @@ Checkbox.propTypes = {
|
|
|
312
304
|
/** color of checkbox background ['primary', 'info', 'success', 'warning', 'danger', #hex, rgb(#, #, #)] */
|
|
313
305
|
color: PropTypes.string,
|
|
314
306
|
|
|
307
|
+
/** props for Typography of label */
|
|
308
|
+
labelProps: PropTypes.object,
|
|
309
|
+
|
|
315
310
|
/** props for input */
|
|
316
311
|
inputProps: PropTypes.object,
|
|
317
312
|
|
|
313
|
+
/** width is a number || string, width of Checkbox default 18 */
|
|
314
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
315
|
+
|
|
318
316
|
/** The function will run to return a true or false value of Radio Component */
|
|
319
317
|
onChange: PropTypes.func,
|
|
320
318
|
|
|
321
|
-
/**
|
|
322
|
-
* ref methods
|
|
323
|
-
|
|
324
|
-
* * setChecked: Set check for input
|
|
325
|
-
* * getChecked: Get check of input
|
|
319
|
+
/**
|
|
320
|
+
* ref methods
|
|
321
|
+
*
|
|
322
|
+
* * setChecked: Set check for input
|
|
323
|
+
* * getChecked: Get check of input
|
|
326
324
|
*/
|
|
327
325
|
ref: PropTypes.any
|
|
328
326
|
};
|
|
@@ -462,8 +462,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
462
462
|
tableData = [],
|
|
463
463
|
weekDateFirst = getDateOfWeek(firstDay),
|
|
464
464
|
weekDateLast = getDateOfWeek(lastDay);
|
|
465
|
-
/**
|
|
466
|
-
* days of previous month
|
|
465
|
+
/**
|
|
466
|
+
* days of previous month
|
|
467
467
|
*/
|
|
468
468
|
|
|
469
469
|
for (let i = weekDateFirst; i > 0; i--) {
|
|
@@ -476,8 +476,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
476
476
|
className: unique.day.day
|
|
477
477
|
})));
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
480
|
-
* days of current month
|
|
479
|
+
/**
|
|
480
|
+
* days of current month
|
|
481
481
|
*/
|
|
482
482
|
|
|
483
483
|
|
|
@@ -491,8 +491,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
491
491
|
}, jsx(Typography, { ...typographyProps(unique.day.day)
|
|
492
492
|
}, i + 1)));
|
|
493
493
|
}
|
|
494
|
-
/**
|
|
495
|
-
* days of next month
|
|
494
|
+
/**
|
|
495
|
+
* days of next month
|
|
496
496
|
*/
|
|
497
497
|
|
|
498
498
|
|
|
@@ -122,13 +122,6 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
const _onChangeInput = e => {
|
|
126
|
-
const timeout = setTimeout(() => {
|
|
127
|
-
onChangeInput === null || onChangeInput === void 0 ? void 0 : onChangeInput(e);
|
|
128
|
-
}, delayOnInput);
|
|
129
|
-
return () => clearTimeout(timeout);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
125
|
useEffect(() => {
|
|
133
126
|
return () => {
|
|
134
127
|
closeDropdownBox();
|
|
@@ -160,7 +153,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
160
153
|
style: style
|
|
161
154
|
}, label ? jsx(Label, { ...labelProps
|
|
162
155
|
}, label) : null, jsx(InputBase, { ...inputProps,
|
|
163
|
-
className: open
|
|
156
|
+
className: open ? 'dropdown-focus' : '',
|
|
164
157
|
style: inputStyle,
|
|
165
158
|
viewType: viewType,
|
|
166
159
|
inputRef: inputRef,
|
|
@@ -168,7 +161,8 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
168
161
|
value: value,
|
|
169
162
|
startIcon: startIcon,
|
|
170
163
|
endIcon: renderEndIcon(),
|
|
171
|
-
onChange:
|
|
164
|
+
onChange: onChangeInput,
|
|
165
|
+
delayOnChange: delayOnInput,
|
|
172
166
|
onClick: openOnClickAt === 'full' ? onTriggerDropdown : null
|
|
173
167
|
})), open && /*#__PURE__*/createPortal(jsx("div", {
|
|
174
168
|
ref: dropdownBoxRef,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useRef, useEffect, forwardRef, Children,
|
|
4
|
+
import { memo, useRef, useEffect, forwardRef, Children, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
-
|
|
7
|
+
import theme from '../../../theme/settings';
|
|
8
|
+
const {
|
|
9
|
+
spacing
|
|
10
|
+
} = theme;
|
|
11
|
+
const FormGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
8
12
|
fullWidth,
|
|
9
13
|
oneHelperText,
|
|
10
14
|
marginRight,
|
|
@@ -16,42 +20,42 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
16
20
|
const previousError = useRef(false);
|
|
17
21
|
/* Start styled */
|
|
18
22
|
|
|
19
|
-
const FormGroupRoot = css`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
flex: 1 1 auto;
|
|
28
|
-
.DGN-UI-TextInput {
|
|
23
|
+
const FormGroupRoot = css`
|
|
24
|
+
position: relative;
|
|
25
|
+
align-items: flex-end;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
width: auto;
|
|
28
|
+
margin-bottom: ${spacing(4)}px;
|
|
29
|
+
&.Form-Group-full-width {
|
|
30
|
+
width: 100% !important;
|
|
29
31
|
flex: 1 1 auto;
|
|
32
|
+
.DGN-UI-TextInput {
|
|
33
|
+
flex: 1 1 auto;
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
&.Form-Group-Common {
|
|
37
|
+
margin-bottom: 20px;
|
|
38
|
+
width: max-content;
|
|
39
|
+
.DGN-UI-HelperText {
|
|
40
|
+
width: 100%;
|
|
41
|
+
left: 0;
|
|
42
|
+
}
|
|
43
|
+
.DGN-UI-TextInput {
|
|
44
|
+
position: initial;
|
|
45
|
+
margin-bottom: 0 !important;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
.DGN-UI-TextInput {
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
height: 100%;
|
|
53
|
+
margin-bottom: 20px !important;
|
|
54
|
+
&:not(:last-of-type) {
|
|
55
|
+
margin-right: ${isNaN(marginRight) ? marginRight : marginRight + 'px'};
|
|
56
|
+
}
|
|
42
57
|
}
|
|
43
|
-
|
|
44
|
-
.DGN-UI-TextInput {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
justify-content: space-between;
|
|
48
|
-
height: 100%;
|
|
49
|
-
margin-bottom: 20px !important;
|
|
50
|
-
&:not(:last-of-type) {
|
|
51
|
-
margin-right: ${isNaN(marginRight) ? marginRight : marginRight + 'px'};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
58
|
+
`;
|
|
55
59
|
/* End styled */
|
|
56
60
|
|
|
57
61
|
/* Start handler */
|
|
@@ -101,17 +105,17 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
101
105
|
...props
|
|
102
106
|
}, children);
|
|
103
107
|
}));
|
|
104
|
-
|
|
108
|
+
FormGroup.defaultProps = {
|
|
105
109
|
marginRight: 16,
|
|
106
110
|
fullWidth: false,
|
|
107
111
|
oneHelperText: false,
|
|
108
112
|
className: ''
|
|
109
113
|
};
|
|
110
|
-
|
|
114
|
+
FormGroup.propTypes = {
|
|
111
115
|
fullWidth: PropTypes.bool,
|
|
112
116
|
oneHelperText: PropTypes.bool,
|
|
113
117
|
marginRight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
114
118
|
className: PropTypes.string,
|
|
115
119
|
children: PropTypes.node.isRequired
|
|
116
120
|
};
|
|
117
|
-
export default
|
|
121
|
+
export default FormGroup;
|
|
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { Typography } from '../../';
|
|
8
8
|
import { color as colors } from '../../../styles/colors';
|
|
9
|
-
import { ellipsis } from '../../../styles/general';
|
|
10
9
|
const {
|
|
11
10
|
system: {
|
|
12
11
|
disabled: systemDisabled
|
|
@@ -24,15 +23,15 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
24
23
|
disabled,
|
|
25
24
|
readOnly,
|
|
26
25
|
className,
|
|
26
|
+
lineClamp,
|
|
27
27
|
...props
|
|
28
28
|
}, ref) => {
|
|
29
29
|
const LabelComp = useMemo(() => jsx(Typography, {
|
|
30
|
-
type: 'h6',
|
|
31
|
-
color: normal_label,
|
|
32
30
|
fullWidth: false,
|
|
33
31
|
ref: ref,
|
|
34
32
|
mapping: 'label',
|
|
35
33
|
css: LabelRootCSS,
|
|
34
|
+
lineClamp: lineClamp,
|
|
36
35
|
className: ['DGN-UI-Label', className, readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' ').trim().replace(/\s+/g, ' '),
|
|
37
36
|
...props
|
|
38
37
|
}, children, required ? jsx("span", {
|
|
@@ -41,7 +40,6 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
40
|
return LabelComp;
|
|
42
41
|
}));
|
|
43
42
|
const LabelRootCSS = css`
|
|
44
|
-
${ellipsis}
|
|
45
43
|
min-height: 16px;
|
|
46
44
|
margin: 0px;
|
|
47
45
|
&.read-only,
|
|
@@ -55,7 +53,10 @@ const LabelRootCSS = css`
|
|
|
55
53
|
margin-top: 2px;
|
|
56
54
|
}
|
|
57
55
|
`;
|
|
58
|
-
Label.defaultProps = {
|
|
56
|
+
Label.defaultProps = { ...Typography.defaultProps,
|
|
57
|
+
type: 'h6',
|
|
58
|
+
color: normal_label,
|
|
59
|
+
lineClamp: 1,
|
|
59
60
|
required: false,
|
|
60
61
|
disabled: false,
|
|
61
62
|
readOnly: false,
|
|
@@ -79,6 +80,11 @@ Label.propTypes = {
|
|
|
79
80
|
children: PropTypes.node,
|
|
80
81
|
|
|
81
82
|
/** any props else */
|
|
82
|
-
props: PropTypes.any
|
|
83
|
+
props: PropTypes.any,
|
|
84
|
+
// Reuse from Typography
|
|
85
|
+
type: Typography.propTypes.type,
|
|
86
|
+
lineClamp: Typography.propTypes.lineClamp,
|
|
87
|
+
hoverTooltip: Typography.propTypes.hoverTooltip,
|
|
88
|
+
color: Typography.propTypes.color
|
|
83
89
|
};
|
|
84
90
|
export default Label;
|