diginet-core-ui 1.3.93-beta.4 → 1.3.94-beta.1

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.
@@ -1,20 +1,12 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { ButtonIcon, Icon, Popover, Typography } from "./..";
4
+ import { ButtonIcon, Icon, Popover, Tooltip, Typography } from "./..";
5
+ import OptionWrapper from "../others/option-wrapper";
5
6
  import PropTypes from 'prop-types';
6
7
  import React, { forwardRef, isValidElement, memo, useImperativeHandle, useMemo, useRef, useState } from 'react';
7
8
  import { bgColor, borderNone, cursorPointer, displayFlex, flexCol, flexRow, gap, itemsCenter, outlineNone, parseHeight, pd, pdl } from "../../styles/general";
8
- import { useTheme } from "../../theme";
9
9
  import { classNames, refType as ref } from "../../utils";
10
- import OptionWrapper from "../others/option-wrapper";
11
- const {
12
- colors: {
13
- system: {
14
- dark: systemDark
15
- }
16
- }
17
- } = useTheme();
18
10
  const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
19
11
  action = {},
20
12
  anchor,
@@ -69,19 +61,21 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
61
  name: icon,
70
62
  width: 20,
71
63
  height: 20,
72
- color: systemDark
64
+ color: 'system/dark'
73
65
  }) : null, jsx(Typography, {
74
66
  css: !icon && iconState && ExtraPaddingCSS,
75
67
  className: 'DGN-UI-ButtonMore-Label',
76
68
  ...labelProp
77
- }, label)) : jsx(ButtonIcon, {
69
+ }, label)) : jsx(Tooltip, {
78
70
  key: idx,
79
71
  className: 'DGN-UI-ButtonMore-Option',
72
+ title: label
73
+ }, jsx(ButtonIcon, {
80
74
  circular: true,
81
75
  name: icon,
82
76
  onClick: action,
83
77
  viewType: 'text'
84
- });
78
+ }));
85
79
  }
86
80
  });
87
81
  };
@@ -132,6 +126,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
132
126
  }, [buttonProps, className, disabled, id, options, optionType, popoverProp, style, iconState, openState]);
133
127
  }));
134
128
  const PopoverCSS = isOptionFull => css`
129
+ ${displayFlex};
135
130
  ${isOptionFull ? flexCol : flexRow};
136
131
  ${pd(isOptionFull ? [1, 0] : [0, 2])}
137
132
  `;
@@ -145,14 +140,14 @@ const OptionFullCSS = css`
145
140
  ${parseHeight(28)};
146
141
  ${pd([0, 4])};
147
142
  ${gap([0, 1])};
148
- ${bgColor('system.white')};
143
+ ${bgColor('system/white')};
149
144
  transition: all 0.5s ease;
150
145
  &:hover,
151
146
  &:focus {
152
- ${bgColor('fill.hover')};
147
+ ${bgColor('fill/hover')};
153
148
  }
154
149
  &:active {
155
- ${bgColor('fill.pressed')};
150
+ ${bgColor('fill/pressed')};
156
151
  }
157
152
  `;
158
153
  const ExtraPaddingCSS = css`
@@ -167,13 +162,13 @@ ButtonMore.defaultProps = {
167
162
  style: {}
168
163
  };
169
164
  ButtonMore.propTypes = {
170
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/buttonicon) applied to the main `ButtonIcon`. */
165
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-buttonicon) applied to the main `ButtonIcon`. */
171
166
  buttonProps: PropTypes.object,
172
167
  /** Class for component. */
173
168
  className: PropTypes.string,
174
169
  /** If `true`, the component is disabled. */
175
170
  disabled: PropTypes.bool,
176
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/typography) applied to the `Typography` label. */
171
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-typography) applied to the `Typography` label. */
177
172
  labelProp: PropTypes.object,
178
173
  /** Option(s) in popover. */
179
174
  option: PropTypes.arrayOf(PropTypes.shape({
@@ -183,25 +178,25 @@ ButtonMore.propTypes = {
183
178
  })),
184
179
  /** The variant of option's type. */
185
180
  optionType: PropTypes.oneOf(['full', 'icon']),
186
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/overplay-popover) applied to the main `Popover`. */
181
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-popover) applied to the main `Popover`. */
187
182
  popoverProp: PropTypes.object,
188
183
  /** Style inline of component. */
189
184
  style: PropTypes.object,
190
- /**
191
- * ref methods (ref.current.instance.*method*)
192
- *
193
- * * option(): Gets all UI component properties
194
- * * Returns value - object
195
- * * option(optionName): Gets the value of a single property
196
- * * @param {optionName} - string
197
- * * Returns value - any
198
- * * option(optionName, optionValue): Updates the value of a single property
199
- * * @param {optionName} - string
200
- * * @param {optionValue} - any
201
- * * option(options): Updates the values of several properties
202
- * * @param {options} - object
185
+ /**
186
+ * ref methods (ref.current.instance.*method*)
187
+ *
188
+ * * option(): Gets all UI component properties
189
+ * * Returns value - object
190
+ * * option(optionName): Gets the value of a single property
191
+ * * @param {optionName} - string
192
+ * * Returns value - any
193
+ * * option(optionName, optionValue): Updates the value of a single property
194
+ * * @param {optionName} - string
195
+ * * @param {optionValue} - any
196
+ * * option(options): Updates the values of several properties
197
+ * * @param {options} - object
203
198
  */
204
- reference: ref
199
+ ref: ref
205
200
  };
206
201
  export { ButtonMore };
207
202
  export default OptionWrapper(ButtonMore);
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
4
4
  import { ButtonIcon, Typography } from "./..";
5
5
  import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
7
- import { bgColor, boxBorder, cursorMove, flexRow, itemsCenter, justifyBetween, order, parseWidthHeight, positionRelative } from "../../styles/general";
7
+ import { bgColor, boxBorder, cursorMove, displayFlex, flexRow, itemsCenter, justifyBetween, mgl, order, parseWidth, parseWidthHeight, positionRelative, truncate } from "../../styles/general";
8
8
  import { useTheme } from "../../theme";
9
9
  import { classNames, handleBreakpoints } from "../../utils";
10
10
  import ModalContext from "./context";
@@ -12,6 +12,9 @@ const {
12
12
  boxShadows: {
13
13
  small: smallBoxShadow
14
14
  },
15
+ typography: {
16
+ heading3
17
+ },
15
18
  spacing
16
19
  } = useTheme();
17
20
  export const responsivePaddingCSS = handleBreakpoints({
@@ -43,6 +46,14 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
43
46
  currentRef.instance = _instance;
44
47
  return currentRef;
45
48
  });
49
+ const renderTitle = content => {
50
+ if (!content) return null;
51
+ return jsx(Typography, {
52
+ css: [truncate, parseWidth('100%')],
53
+ fullWidth: false,
54
+ type: 'h3'
55
+ }, content);
56
+ };
46
57
  return useMemo(() => {
47
58
  return jsx("div", {
48
59
  css: _ModalHeaderCSS,
@@ -51,38 +62,40 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
51
62
  className: classNames('DGN-UI-Modal-Header', className),
52
63
  style: style,
53
64
  onMouseDown: modal.onMoveModal
54
- }, jsx(Typography, {
55
- type: 'h3',
56
- style: {
57
- whiteSpace: 'nowrap',
58
- overflow: 'hidden',
59
- textOverflow: 'ellipsis',
60
- width: '100%'
61
- }
62
- }, children ? children : title), showClose ? jsx(ButtonIcon, {
65
+ }, typeof children === 'string' ? renderTitle(children) : children, title || showClose ? jsx("div", {
66
+ css: [TitleContainerCSS, title && parseWidth('100%')],
67
+ className: 'DGN-UI-Modal-Header-Title'
68
+ }, renderTitle(title), showClose ? jsx(ButtonIcon, {
69
+ css: mgl([children || title ? 4 : 'auto']),
63
70
  viewType: 'ghost',
64
71
  name: 'Close',
65
- style: {
66
- marginLeft: spacing(4)
67
- },
68
72
  onClick: modal.close
69
- }) : null);
73
+ }) : null) : null);
70
74
  }, [children, className, id, showClose, style, title]);
71
75
  }));
72
76
  const ModalHeaderCSS = modal => css`
77
+ ${displayFlex};
73
78
  ${flexRow};
74
79
  ${positionRelative};
75
80
  ${justifyBetween};
76
81
  ${itemsCenter};
77
82
  ${boxBorder};
83
+ ${heading3};
78
84
  ${parseWidthHeight('100%', 56)};
79
- ${bgColor('fill.headerbar')}
85
+ ${bgColor('fill/headerbar')}
80
86
  ${modal.onMoveModal && cursorMove};
81
87
  ${order(1)};
82
88
  border-radius: 4px 4px 0px 0px;
83
89
  box-shadow: ${smallBoxShadow};
84
90
  ${responsivePaddingCSS};
85
91
  `;
92
+ const TitleContainerCSS = css`
93
+ ${displayFlex};
94
+ ${flexRow};
95
+ ${positionRelative};
96
+ ${justifyBetween};
97
+ ${itemsCenter};
98
+ `;
86
99
  ModalHeader.defaultProps = {
87
100
  className: '',
88
101
  showClose: true,
@@ -607,7 +607,6 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
607
607
  }, selectBox || multiple ? jsx("span", {
608
608
  className: 'TreeView-Item-Checkbox'
609
609
  }, jsx(Checkbox, {
610
- forTreeView: true,
611
610
  checked: isTrue,
612
611
  value: typeof data === 'object' ? data[valueExpr] : data,
613
612
  stopPropagation: false,
@@ -627,7 +626,6 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
627
626
  }, selectBox || multiple ? jsx("span", {
628
627
  className: 'TreeView-Item-Checkbox'
629
628
  }, jsx(Checkbox, {
630
- forTreeView: true,
631
629
  checked: isTrue,
632
630
  value: typeof data === 'object' ? data[valueExpr] : data,
633
631
  stopPropagation: false,
@@ -782,7 +780,6 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
782
780
  }) : null, multiple && selectAll ? jsx(Fragment, null, jsx("div", {
783
781
  className: 'TreeView-All'
784
782
  }, jsx(Checkbox, {
785
- forTreeView: true,
786
783
  label: selectAllLabel,
787
784
  onChange: onSelectAll,
788
785
  inputRef: selectAllRef,
package/icons/effect.js CHANGED
@@ -105,19 +105,19 @@ Icon.propTypes = {
105
105
  viewBox: PropTypes.bool,
106
106
  /** Width of the component. */
107
107
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
108
- /**
109
- * ref methods (ref.current.instance.*method*)
110
- *
111
- * * option(): Gets all UI component properties
112
- * * Returns value - object
113
- * * option(optionName): Gets the value of a single property
114
- * * @param {optionName} - string
115
- * * Returns value - any
116
- * * option(optionName, optionValue): Updates the value of a single property
117
- * * @param {optionName} - string
118
- * * @param {optionValue} - any
119
- * * option(options): Updates the values of several properties
120
- * * @param {options} - object
108
+ /**
109
+ * ref methods (ref.current.instance.*method*)
110
+ *
111
+ * * option(): Gets all UI component properties
112
+ * * Returns value - object
113
+ * * option(optionName): Gets the value of a single property
114
+ * * @param {optionName} - string
115
+ * * Returns value - any
116
+ * * option(optionName, optionValue): Updates the value of a single property
117
+ * * @param {optionName} - string
118
+ * * @param {optionValue} - any
119
+ * * option(options): Updates the values of several properties
120
+ * * @param {options} - object
121
121
  */
122
122
  ref: ref
123
123
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.93-beta.4",
3
+ "version": "1.3.94-beta.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/readme.md CHANGED
@@ -38,6 +38,14 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.3.94
42
+ - \[Changed\]: Breadcrumb – Update design
43
+ - \[Changed\]: Button – Add text sentence for Button
44
+ - \[Changed\]: Accordion – Add prop fullHeight
45
+ - \[Changed\]: Divider – Optimize code
46
+ - \[Changed\]: Icon – Add color default
47
+ - \[Fixed\]: Accordion – Fix UI background color
48
+
41
49
  ## 1.3.93
42
50
  - \[Changed\]: Dropdown – Apply multilineSelectedItem to renderSelectedItem
43
51
  - \[Fixed\]: Checkbox – Fix bug still uncheck when not set state