diginet-core-ui 1.3.66 → 1.3.68
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/storybook/avatar01.svg +9 -0
- package/assets/storybook/cover01.svg +9 -0
- package/components/accordion/css.js +6 -6
- package/components/accordion/details.js +13 -18
- package/components/accordion/group.js +16 -17
- package/components/accordion/index.js +17 -22
- package/components/accordion/summary.js +55 -32
- package/components/avatar/index.js +4 -9
- package/components/badge/index.js +4 -9
- package/components/button/icon.js +4 -9
- package/components/button/index.js +287 -292
- package/components/card/body.js +47 -0
- package/components/card/extra.js +47 -0
- package/components/card/footer.js +47 -0
- package/components/card/header.js +50 -0
- package/components/card/index.js +175 -37
- package/components/chart/Pie-v2/Sector.js +2 -2
- package/components/chip/attach.js +5 -5
- package/components/form-control/attachment/index.js +5 -3
- package/components/form-control/calendar/function.js +20 -10
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/dropdown/index.js +71 -10
- package/components/form-control/helper-text/index.js +8 -3
- package/components/form-control/input-base/index.js +47 -10
- package/components/form-control/money-input/index.js +6 -2
- package/components/form-control/number-input/index.js +11 -11
- package/components/form-control/number-input/index2.js +13 -4
- package/components/form-control/phone-input/index.js +13 -9
- package/components/form-control/text-input/index.js +13 -3
- package/components/grid/Container.js +110 -0
- package/components/grid/Row.js +1 -1
- package/components/grid/index.js +35 -5
- package/components/index.js +7 -2
- package/components/others/option-wrapper/index.js +21 -27
- package/components/paging/page-info.js +263 -88
- package/components/paging/page-selector2.js +95 -56
- package/components/popover/index.js +8 -6
- package/components/progress/circular.js +12 -12
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +10 -6
- package/icons/basic.js +120 -0
- package/icons/effect.js +19 -24
- package/package.json +1 -1
- package/readme.md +20 -0
- package/styles/color-helper.js +103 -103
- package/styles/utils.js +14 -2
- package/utils/classNames.js +30 -0
- package/utils/error/error.js +2 -2
- package/utils/index.js +1 -0
- package/utils/renderIcon.js +5 -5
- package/utils/useInput.js +1 -8
- package/components/card/body-card.js +0 -65
- package/components/card/card.js +0 -125
- package/components/card/context.js +0 -6
package/components/grid/index.js
CHANGED
|
@@ -22,11 +22,13 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
22
22
|
container,
|
|
23
23
|
direction,
|
|
24
24
|
item,
|
|
25
|
+
leftSpacing: leftSpacingProp,
|
|
25
26
|
lg,
|
|
26
27
|
md,
|
|
27
28
|
rowSpacing: rowSpacingProp,
|
|
28
29
|
sm,
|
|
29
30
|
spacing,
|
|
31
|
+
topSpacing: topSpacingProp,
|
|
30
32
|
wrap,
|
|
31
33
|
xl,
|
|
32
34
|
xs,
|
|
@@ -36,11 +38,13 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
38
|
const rowSpacing = rowSpacingProp || spacing;
|
|
37
39
|
const columnSpacing = columnSpacingProp || spacing;
|
|
38
40
|
const columns = container ? columnsProp : columnsContext;
|
|
41
|
+
const topSpacing = topSpacingProp || rowSpacing;
|
|
42
|
+
const leftSpacing = leftSpacingProp || columnSpacing;
|
|
39
43
|
const ref = useRef(null);
|
|
40
44
|
|
|
41
45
|
const _GridCSS = GridCSS(direction, zeroMinWidth, container, item, wrap);
|
|
42
46
|
|
|
43
|
-
const _GridSpacingCSS = GridSpacingCSS(rowSpacing, columnSpacing);
|
|
47
|
+
const _GridSpacingCSS = GridSpacingCSS(rowSpacing, columnSpacing, topSpacing, leftSpacing);
|
|
44
48
|
|
|
45
49
|
const _HandleGridCSS = HandleGridCSS([xs, sm, md, lg, xl], columns);
|
|
46
50
|
|
|
@@ -63,7 +67,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
63
67
|
}, jsx(GridContext.Provider, {
|
|
64
68
|
value: columns
|
|
65
69
|
}, children));
|
|
66
|
-
}, [id, container, item, direction, wrap, rowSpacing, columnSpacing, xs, sm, md, lg, xl, spacing, zeroMinWidth, className, columns, children]);
|
|
70
|
+
}, [id, container, item, direction, leftSpacing, wrap, rowSpacing, columnSpacing, xs, sm, md, lg, xl, spacing, topSpacing, zeroMinWidth, className, columns, children]);
|
|
67
71
|
}));
|
|
68
72
|
|
|
69
73
|
const getOffset = val => {
|
|
@@ -151,19 +155,40 @@ const GridCSS = (direction, zeroMinWidth, container, item, wrap) => css`
|
|
|
151
155
|
})};
|
|
152
156
|
`;
|
|
153
157
|
|
|
154
|
-
const GridSpacingCSS = (rowSpacing, columnSpacing) => css`
|
|
155
|
-
${
|
|
158
|
+
const GridSpacingCSS = (rowSpacing, columnSpacing, topSpacing, leftSpacing) => css`
|
|
159
|
+
${topSpacing && handleBreakpoints(topSpacing, propValue => {
|
|
156
160
|
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
157
161
|
|
|
158
162
|
if (spacing !== '0px') {
|
|
159
163
|
return `
|
|
160
164
|
margin-top: -${getOffset(spacing)};
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return '';
|
|
169
|
+
})};
|
|
170
|
+
${rowSpacing && handleBreakpoints(rowSpacing, propValue => {
|
|
171
|
+
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
172
|
+
|
|
173
|
+
if (spacing !== '0px') {
|
|
174
|
+
return `
|
|
161
175
|
& > .DGN-UI-Grid-item {
|
|
162
176
|
padding-top: ${getOffset(spacing)};
|
|
163
177
|
}
|
|
164
178
|
`;
|
|
165
179
|
}
|
|
166
180
|
|
|
181
|
+
return '';
|
|
182
|
+
})};
|
|
183
|
+
${leftSpacing && handleBreakpoints(leftSpacing, propValue => {
|
|
184
|
+
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
185
|
+
|
|
186
|
+
if (spacing !== '0px') {
|
|
187
|
+
return `
|
|
188
|
+
margin-left: -${getOffset(spacing)};
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
167
192
|
return '';
|
|
168
193
|
})};
|
|
169
194
|
${columnSpacing && handleBreakpoints(columnSpacing, propValue => {
|
|
@@ -172,7 +197,6 @@ const GridSpacingCSS = (rowSpacing, columnSpacing) => css`
|
|
|
172
197
|
if (spacing !== '0px') {
|
|
173
198
|
return `
|
|
174
199
|
width: calc(100% + ${getOffset(spacing)});
|
|
175
|
-
margin-left: -${getOffset(spacing)};
|
|
176
200
|
& > .DGN-UI-Grid-item {
|
|
177
201
|
padding-left: ${getOffset(spacing)};
|
|
178
202
|
}
|
|
@@ -230,6 +254,9 @@ Grid.propTypes = {
|
|
|
230
254
|
/** If `true`, the component will have the flex *item* behavior. You should be wrapping *items* with a *container*. */
|
|
231
255
|
item: PropTypes.bool,
|
|
232
256
|
|
|
257
|
+
/** Defines the horizontal space of `container` components. */
|
|
258
|
+
leftSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
259
|
+
|
|
233
260
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `lg` breakpoint and wider screens if not overridden. */
|
|
234
261
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
235
262
|
|
|
@@ -245,6 +272,9 @@ Grid.propTypes = {
|
|
|
245
272
|
/** Defines the space between the type `item` components. It can only be used on a type `container` component. */
|
|
246
273
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
247
274
|
|
|
275
|
+
/** Defines the vertical space of `container` components. */
|
|
276
|
+
topSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
277
|
+
|
|
248
278
|
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
249
279
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
250
280
|
|
package/components/index.js
CHANGED
|
@@ -22,7 +22,11 @@ export { default as Badge } from './badge'; // BUTTON
|
|
|
22
22
|
export { default as Button } from './button';
|
|
23
23
|
export { default as ButtonIcon } from './button/icon'; // CARD
|
|
24
24
|
|
|
25
|
-
export { default as
|
|
25
|
+
export { default as Card } from './card';
|
|
26
|
+
export { default as CardHeader } from './card/header';
|
|
27
|
+
export { default as CardBody } from './card/body';
|
|
28
|
+
export { default as CardFooter } from './card/footer';
|
|
29
|
+
export { default as CardExtra } from './card/extra'; // CHART
|
|
26
30
|
|
|
27
31
|
export { default as PieChart } from './chart/Pie';
|
|
28
32
|
export { default as ColumnChart } from './chart/bar';
|
|
@@ -57,7 +61,8 @@ export { default as Toggle } from './form-control/toggle'; // Grid
|
|
|
57
61
|
|
|
58
62
|
export { default as Grid } from './grid';
|
|
59
63
|
export { default as Row } from './grid/Row';
|
|
60
|
-
export { default as Col } from './grid/Col';
|
|
64
|
+
export { default as Col } from './grid/Col';
|
|
65
|
+
export { default as Container } from './grid/Container'; //Icon
|
|
61
66
|
|
|
62
67
|
export { default as Icon } from '../icons/index'; // List
|
|
63
68
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { useRef,
|
|
4
|
+
import { useRef, useState, forwardRef, useImperativeHandle, useEffect } from 'react';
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
|
|
7
7
|
const OptionWrapper = WrappedComponent => {
|
|
@@ -10,17 +10,15 @@ const OptionWrapper = WrappedComponent => {
|
|
|
10
10
|
ref = useRef(null);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const [options, setOptions] = useState(
|
|
13
|
+
const [options, setOptions] = useState({});
|
|
14
14
|
const componentRef = useRef(null);
|
|
15
15
|
|
|
16
16
|
const option = (option, optionValue) => {
|
|
17
17
|
if (typeof option === 'undefined') {
|
|
18
|
-
return
|
|
18
|
+
return props;
|
|
19
19
|
} else if (typeof option === 'string') {
|
|
20
|
-
if (typeof optionValue === 'undefined') return
|
|
21
|
-
|
|
22
|
-
[option]: optionValue
|
|
23
|
-
}
|
|
20
|
+
if (typeof optionValue === 'undefined') return props[option];else setOptions({
|
|
21
|
+
[option]: optionValue
|
|
24
22
|
});
|
|
25
23
|
} else if (typeof option === 'object') {
|
|
26
24
|
setOptions({ ...options,
|
|
@@ -29,26 +27,22 @@ const OptionWrapper = WrappedComponent => {
|
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}; // methods
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
useEffect(() => setOptions({ ...options,
|
|
49
|
-
...props
|
|
50
|
-
}), [props]);
|
|
51
|
-
return jsx(WrappedComponent, { ...options,
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setOptions({});
|
|
32
|
+
}, [props]);
|
|
33
|
+
useImperativeHandle(ref, () => ({ ...componentRef.current,
|
|
34
|
+
instance: { ...componentRef.current.instance,
|
|
35
|
+
option
|
|
36
|
+
} // const currentRef = componentRef.current || {};
|
|
37
|
+
// const _instance = { ...componentRef.current.instance, option }; // methods
|
|
38
|
+
// _instance.__proto__ = { ...componentRef.current.instance?.__proto__ }; // hidden methods
|
|
39
|
+
// currentRef.instance = _instance;
|
|
40
|
+
// console.log('currentRef', currentRef.instance);
|
|
41
|
+
// return currentRef;
|
|
42
|
+
|
|
43
|
+
}));
|
|
44
|
+
return jsx(WrappedComponent, { ...props,
|
|
45
|
+
...options,
|
|
52
46
|
ref: componentRef
|
|
53
47
|
});
|
|
54
48
|
});
|