diginet-core-ui 1.3.95 → 1.3.96-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.
@@ -104,9 +104,9 @@ Notify.defaultProps = {
104
104
  Notify.propTypes = {
105
105
  /** Class for component. */
106
106
  className: PropTypes.string,
107
- /**
108
- * used to set position of Alert (is a string or an object)
109
- * string is center (obligatory) as {vertical: 'center', horizontal: 'center'}
107
+ /**
108
+ * used to set position of Alert (is a string or an object)
109
+ * string is center (obligatory) as {vertical: 'center', horizontal: 'center'}
110
110
  */
111
111
  position: PropTypes.oneOfType([PropTypes.oneOf(['center']), PropTypes.shape({
112
112
  horizontal: PropTypes.oneOf(['center', 'left', 'right']),
@@ -116,13 +116,13 @@ Notify.propTypes = {
116
116
  style: PropTypes.object,
117
117
  /** Any [props](https://core.diginet.com.vn/ui/?path=/docs/alert--basic) of Alert */
118
118
  props: PropTypes.any
119
- /**
120
- * ref methods (ref.current.instance.*method*)
121
- *
122
- * * show(message, option): Show notify
123
- * * @param {message} - number
124
- * * @param {options} - object
125
- * * {[Props](https://core.diginet.com.vn/ui/?path=/docs/alert--basic) applied to the `Alert`.}
119
+ /**
120
+ * ref methods (ref.current.instance.*method*)
121
+ *
122
+ * * show(message, option): Show notify
123
+ * * @param {message} - number
124
+ * * @param {options} - object
125
+ * * {[Props](https://core.diginet.com.vn/ui/?path=/docs/alert--basic) applied to the `Alert`.}
126
126
  */
127
127
  };
128
128
 
@@ -201,28 +201,28 @@ Badge.propTypes = {
201
201
  name: PropTypes.string,
202
202
  /** Controls whether the badge is hidden when `content` is zero. */
203
203
  showZero: PropTypes.bool,
204
- /** Size of the components.
205
- *
206
- * * medium (dot 8px, typography p3)
207
- * * large (button 10px, typography p2)
208
- * * giant (button 12px, typography p1)
204
+ /** Size of the components.
205
+ *
206
+ * * medium (dot 8px, typography p3)
207
+ * * large (button 10px, typography p2)
208
+ * * giant (button 12px, typography p1)
209
209
  * */
210
210
  size: PropTypes.oneOf(['medium', 'large', 'giant']),
211
211
  /** Style inline of component. */
212
212
  style: PropTypes.object
213
- /**
214
- * ref methods (ref.current.instance.*method*)
215
- *
216
- * * option(): Gets all UI component properties
217
- * * Returns value - object
218
- * * option(optionName): Gets the value of a single property
219
- * * @param {optionName} - string
220
- * * Returns value - any
221
- * * option(optionName, optionValue): Updates the value of a single property
222
- * * @param {optionName} - string
223
- * * @param {optionValue} - any
224
- * * option(options): Updates the values of several properties
225
- * * @param {options} - object
213
+ /**
214
+ * ref methods (ref.current.instance.*method*)
215
+ *
216
+ * * option(): Gets all UI component properties
217
+ * * Returns value - object
218
+ * * option(optionName): Gets the value of a single property
219
+ * * @param {optionName} - string
220
+ * * Returns value - any
221
+ * * option(optionName, optionValue): Updates the value of a single property
222
+ * * @param {optionName} - string
223
+ * * @param {optionValue} - any
224
+ * * option(options): Updates the values of several properties
225
+ * * @param {options} - object
226
226
  */
227
227
  };
228
228
 
@@ -301,14 +301,14 @@ ButtonIcon.propTypes = {
301
301
  onClick: PropTypes.func,
302
302
  /** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
303
303
  name: PropTypes.string,
304
- /**
305
- * The size of the component.
306
- *
307
- * * tiny (button 24px, icon 16px)
308
- * * small (button 32px, icon 20px)
309
- * * medium (button 40px, icon 24px)
310
- * * large (button 48px, icon 32px)
311
- * * giant (button 56px, icon 40px)
304
+ /**
305
+ * The size of the component.
306
+ *
307
+ * * tiny (button 24px, icon 16px)
308
+ * * small (button 32px, icon 20px)
309
+ * * medium (button 40px, icon 24px)
310
+ * * large (button 48px, icon 32px)
311
+ * * giant (button 56px, icon 40px)
312
312
  * */
313
313
  size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant', 'extraGiant']),
314
314
  /** Style inline of component. */
@@ -319,19 +319,19 @@ ButtonIcon.propTypes = {
319
319
  viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
320
320
  /** Width of the component. */
321
321
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
322
- /**
323
- * ref methods (ref.current.instance.*method*)
324
- *
325
- * * option(): Gets all UI component properties
326
- * * Returns value - object
327
- * * option(optionName): Gets the value of a single property
328
- * * @param {optionName} - string
329
- * * Returns value - any
330
- * * option(optionName, optionValue): Updates the value of a single property
331
- * * @param {optionName} - string
332
- * * @param {optionValue} - any
333
- * * option(options): Updates the values of several properties
334
- * * @param {options} - object
322
+ /**
323
+ * ref methods (ref.current.instance.*method*)
324
+ *
325
+ * * option(): Gets all UI component properties
326
+ * * Returns value - object
327
+ * * option(optionName): Gets the value of a single property
328
+ * * @param {optionName} - string
329
+ * * Returns value - any
330
+ * * option(optionName, optionValue): Updates the value of a single property
331
+ * * @param {optionName} - string
332
+ * * @param {optionValue} - any
333
+ * * option(options): Updates the values of several properties
334
+ * * @param {options} - object
335
335
  */
336
336
  };
337
337
 
@@ -405,19 +405,19 @@ Button.propTypes = {
405
405
  urlParams: PropTypes.object,
406
406
  /** The variant to use. */
407
407
  viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'link'])
408
- /**
409
- * ref methods (ref.current.instance.*method*)
410
- *
411
- * * option(): Gets all UI component properties
412
- * * Returns value - object
413
- * * option(optionName): Gets the value of a single property
414
- * * @param {optionName} - string
415
- * * Returns value - any
416
- * * option(optionName, optionValue): Updates the value of a single property
417
- * * @param {optionName} - string
418
- * * @param {optionValue} - any
419
- * * option(options): Updates the values of several properties
420
- * * @param {options} - object
408
+ /**
409
+ * ref methods (ref.current.instance.*method*)
410
+ *
411
+ * * option(): Gets all UI component properties
412
+ * * Returns value - object
413
+ * * option(optionName): Gets the value of a single property
414
+ * * @param {optionName} - string
415
+ * * Returns value - any
416
+ * * option(optionName, optionValue): Updates the value of a single property
417
+ * * @param {optionName} - string
418
+ * * @param {optionValue} - any
419
+ * * option(options): Updates the values of several properties
420
+ * * @param {options} - object
421
421
  */
422
422
  };
423
423
 
@@ -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 } 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,
@@ -28,6 +20,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
28
20
  popoverProp,
29
21
  style
30
22
  }, reference) => {
23
+ if (!reference) reference = useRef(null);
31
24
  const isOptionFull = optionType === 'full';
32
25
  const ref = useRef(null);
33
26
  const [openState, setOpenState] = useState(false);
@@ -51,7 +44,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
51
44
  });
52
45
  const renderOptions = () => {
53
46
  return options.map((item, idx) => {
54
- if ( /*#__PURE__*/isValidElement(item)) return item;else {
47
+ if (item !== null && item !== void 0 && item.hidden) return;else if ( /*#__PURE__*/isValidElement(item)) return item;else {
55
48
  const icon = item === null || item === void 0 ? void 0 : item.icon;
56
49
  const label = item === null || item === void 0 ? void 0 : item.label;
57
50
  const action = () => {
@@ -69,19 +62,21 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
69
62
  name: icon,
70
63
  width: 20,
71
64
  height: 20,
72
- color: systemDark
65
+ color: 'system/dark'
73
66
  }) : null, jsx(Typography, {
74
67
  css: !icon && iconState && ExtraPaddingCSS,
75
68
  className: 'DGN-UI-ButtonMore-Label',
76
69
  ...labelProp
77
- }, label)) : jsx(ButtonIcon, {
70
+ }, label)) : jsx(Tooltip, {
78
71
  key: idx,
79
72
  className: 'DGN-UI-ButtonMore-Option',
73
+ title: label
74
+ }, jsx(ButtonIcon, {
80
75
  circular: true,
81
76
  name: icon,
82
77
  onClick: action,
83
78
  viewType: 'text'
84
- });
79
+ }));
85
80
  }
86
81
  });
87
82
  };
@@ -132,6 +127,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
132
127
  }, [buttonProps, className, disabled, id, options, optionType, popoverProp, style, iconState, openState]);
133
128
  }));
134
129
  const PopoverCSS = isOptionFull => css`
130
+ ${displayFlex};
135
131
  ${isOptionFull ? flexCol : flexRow};
136
132
  ${pd(isOptionFull ? [1, 0] : [0, 2])}
137
133
  `;
@@ -145,14 +141,14 @@ const OptionFullCSS = css`
145
141
  ${parseHeight(28)};
146
142
  ${pd([0, 4])};
147
143
  ${gap([0, 1])};
148
- ${bgColor('system.white')};
144
+ ${bgColor('system/white')};
149
145
  transition: all 0.5s ease;
150
146
  &:hover,
151
147
  &:focus {
152
- ${bgColor('fill.hover')};
148
+ ${bgColor('fill/hover')};
153
149
  }
154
150
  &:active {
155
- ${bgColor('fill.pressed')};
151
+ ${bgColor('fill/pressed')};
156
152
  }
157
153
  `;
158
154
  const ExtraPaddingCSS = css`
@@ -167,41 +163,27 @@ ButtonMore.defaultProps = {
167
163
  style: {}
168
164
  };
169
165
  ButtonMore.propTypes = {
170
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/buttonicon) applied to the main `ButtonIcon`. */
166
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-buttonicon) applied to the main `ButtonIcon`. */
171
167
  buttonProps: PropTypes.object,
172
168
  /** Class for component. */
173
169
  className: PropTypes.string,
174
170
  /** If `true`, the component is disabled. */
175
171
  disabled: PropTypes.bool,
176
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/typography) applied to the `Typography` label. */
172
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-typography) applied to the `Typography` label. */
177
173
  labelProp: PropTypes.object,
178
174
  /** Option(s) in popover. */
179
175
  option: PropTypes.arrayOf(PropTypes.shape({
180
176
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
181
177
  icon: PropTypes.string,
182
- action: PropTypes.func
178
+ action: PropTypes.func,
179
+ hidden: PropTypes.bool
183
180
  })),
184
181
  /** The variant of option's type. */
185
182
  optionType: PropTypes.oneOf(['full', 'icon']),
186
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/overplay-popover) applied to the main `Popover`. */
183
+ /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-popover) applied to the main `Popover`. */
187
184
  popoverProp: PropTypes.object,
188
185
  /** Style inline of component. */
189
186
  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
203
- */
204
187
  };
205
-
206
188
  export { ButtonMore };
207
189
  export default OptionWrapper(ButtonMore);
@@ -48,7 +48,7 @@ const icons = {
48
48
  };
49
49
  const oldAttached = [];
50
50
  const allNewAttached = new FormData();
51
- const attached = [];
51
+ const attached = []; // attached = [...dataState, ...newDataState]
52
52
  const chosenItems = [];
53
53
  const getType = data => {
54
54
  if (data.type !== undefined) {
@@ -155,10 +155,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
155
155
  const [showModal, setShowModal] = useState(false);
156
156
  const [showPopup, setShowPopup] = useState(false);
157
157
  const [viewTypeState, setViewTypeState] = useState(viewType);
158
- const [isEmpty, setIsEmpty] = useState(null);
159
158
  const [newDataState, setNewDataState] = useState([]);
160
159
  const [dataState, setDataState] = useState([]);
161
160
  const isEnable = !readOnly && !disabled;
161
+ const isEmpty = !((dataState === null || dataState === void 0 ? void 0 : dataState.length) + (newDataState === null || newDataState === void 0 ? void 0 : newDataState.length));
162
162
  const _AttachmentRootCSS = AttachmentRootCSS(isEmpty, isEnable);
163
163
 
164
164
  // Start handler
@@ -222,9 +222,11 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
222
222
  attachedRef.current.appendChild(el);
223
223
  });
224
224
  };
225
- const afterChangeFile = (length = 0) => {
226
- setIsEmpty(!length);
227
- };
225
+
226
+ // const afterChangeFile = (length = 0) => {
227
+ // setIsEmpty(!length);
228
+ // };
229
+
228
230
  const onChangeFiles = async e => {
229
231
  var _e$target, _e$target$files;
230
232
  if (!isEnable) return;
@@ -253,10 +255,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
253
255
  }
254
256
  const length = files.length;
255
257
  if (!lengthAttached && !length) {
256
- afterChangeFile();
258
+ // afterChangeFile();
257
259
  return;
258
260
  }
259
- afterChangeFile(lengthAttached + length);
261
+ // afterChangeFile(lengthAttached + length);
260
262
  if (multiple || inputProps && inputProps.multiple) {
261
263
  for (let i = 0; i < length; i++) {
262
264
  files[i].FileName = files[i].name;
@@ -281,10 +283,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
281
283
  newAttached: files,
282
284
  allNewAttached: allNewAttached.getAll('files')
283
285
  });
284
- } else if (!attached.length) {
285
- afterChangeFile();
286
286
  }
287
+ // else if (!attached.length) {
288
+ // afterChangeFile();
289
+ // }
287
290
  };
291
+
288
292
  const onProgressing = file => {
289
293
  return new Promise((resolve, reject) => {
290
294
  const reader = new FileReader();
@@ -357,28 +361,35 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
357
361
  }
358
362
  };
359
363
  const onRemoveMultiple = () => {
364
+ const attachedItems = [...dataState, ...newDataState];
360
365
  const nodeList = attachedRef.current.querySelectorAll('.chosen');
361
366
  const recentRemovedAttached = [];
367
+ const tempDataState = [...dataState];
368
+ const tempNewDataState = [...newDataState];
362
369
  nodeList.forEach(itemEl => {
363
370
  const parent = itemEl.parentNode;
364
371
  const index = Array.from(attachedRef.current.children).indexOf(parent);
365
- const deletedFile = attached.splice(index, 1)[0];
372
+ const deletedFile = attachedItems[index];
366
373
  removedAttachedRef.current.push(deletedFile);
367
374
  recentRemovedAttached.push(deletedFile);
368
- if (Object.prototype.toString.call(deletedFile) === '[object File]' && newDataState !== null && newDataState !== void 0 && newDataState.length) {
369
- removeFileOutInputFiles(allNewAttached.getAll('files').findIndex(attach => attach.FileName === deletedFile.FileName && attach.CreateDate === deletedFile.CreateDate));
375
+ if (Object.prototype.toString.call(deletedFile) === '[object File]' && tempNewDataState !== null && tempNewDataState !== void 0 && tempNewDataState.length) {
376
+ removeFileOutInputFiles(tempNewDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)));
377
+ tempNewDataState.splice(tempNewDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
378
+ setNewDataState(tempNewDataState);
370
379
  } else {
371
- oldAttached.splice(oldAttached.findIndex(attach => attach.FileName === deletedFile.FileName && attach.CreateDate === deletedFile.CreateDate), 1);
372
- setDataState(dataState.filter(attach => attach.FileName !== deletedFile.FileName && attach.CreateDate !== deletedFile.CreateDate));
380
+ oldAttached.splice(oldAttached.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
381
+ tempDataState.splice(tempDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
382
+ setDataState(tempDataState);
373
383
  }
374
384
  });
375
- if (attached.length < 2) {
376
- afterChangeFile(attached.length);
377
- }
385
+ const tempAttachedItems = [...tempDataState, ...tempNewDataState];
386
+ // if (tempAttachedItems.length < 2) {
387
+ // afterChangeFile(tempAttachedItems?.length || 0);
388
+ // }
378
389
  stripDomain();
379
390
  if (onChange) onChange({
380
391
  element: nodeList,
381
- attached,
392
+ attached: tempAttachedItems,
382
393
  recentRemovedAttached,
383
394
  removedAttached: removedAttachedRef.current,
384
395
  oldAttached,
@@ -442,8 +453,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
442
453
  allNewAttached.delete('files');
443
454
  files.forEach(file => allNewAttached.append('files', file));
444
455
  // newAttachedRef.current = files || [];
445
- setNewDataState(files || []);
456
+ // setNewDataState(files || []);
446
457
  }
458
+
447
459
  attachmentInputRef.current.files = dt.files;
448
460
  return dt.files;
449
461
  };
@@ -735,7 +747,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
735
747
  }, [maxFile, maxSizeProp, multiple, accept]);
736
748
  useEffect(() => {
737
749
  oldAttached.length = 0;
738
- afterChangeFile(((data === null || data === void 0 ? void 0 : data.length) || 0) + ((newDataState === null || newDataState === void 0 ? void 0 : newDataState.length) || 0));
750
+ // afterChangeFile((data?.length || 0) + (newDataState?.length || 0));
739
751
  if (data) {
740
752
  // Load files data was uploaded
741
753
  const length = data.length;
@@ -830,7 +842,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
830
842
  uppercase: true,
831
843
  required: required,
832
844
  type: 'h5',
833
- color: 'text.sub',
845
+ color: 'text/sub',
834
846
  ref: attachTextRef
835
847
  }, label), error ? jsx(HelperText, null, error) : null), jsx("div", {
836
848
  css: AttachmentHeaderIconCSS
@@ -868,11 +880,11 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
868
880
  }), isEmpty ? jsx(Typography, {
869
881
  css: userSelectNone,
870
882
  type: 'p3',
871
- color: 'system.rest'
883
+ color: 'system/rest'
872
884
  }, hintText) : null) : isEmpty ? jsx(Typography, {
873
885
  css: userSelectNone,
874
886
  type: 'p3',
875
- color: 'system.rest'
887
+ color: 'system/rest'
876
888
  }, getGlobal('noFileText')) : null)), allowSort && !isEmpty ? jsx(Popover, {
877
889
  ref: popoverRef,
878
890
  anchor: jsx(ButtonIcon, {
@@ -958,15 +970,15 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
958
970
  }, jsx(Typography, {
959
971
  className: 'username',
960
972
  type: 'p2',
961
- color: 'text.sub'
973
+ color: 'text/sub'
962
974
  }, (item === null || item === void 0 ? void 0 : item.UserName) || item.lastModifiedDate && ownerName || ''), jsx(Typography, {
963
975
  className: 'datetime',
964
976
  type: 'p2',
965
- color: 'text.sub'
977
+ color: 'text/sub'
966
978
  }, getDateTime(date)), jsx(Typography, {
967
979
  className: 'filesize',
968
980
  type: 'p2',
969
- color: 'text.sub'
981
+ color: 'text/sub'
970
982
  }, calculateSize(item.FileSize || item.size))) : null, isNew ? jsx("span", {
971
983
  css: AttachedLinearCSS
972
984
  }, jsx(LinearProgress, {
@@ -1108,9 +1120,9 @@ const AttachedItemInfoIconCSS = css`
1108
1120
  ${positionAbsolute};
1109
1121
  ${borderRadius50};
1110
1122
  ${parseWidthHeight(4, 4)};
1111
- ${bgColor('semantic.success')};
1123
+ ${bgColor('semantic/success')};
1112
1124
  ${top(4.5)};
1113
- ${left(-2)}
1125
+ ${left(-2)};
1114
1126
  }
1115
1127
  `;
1116
1128
  const AttachedItemOwnerCSS = css`
@@ -1119,7 +1131,7 @@ const AttachedItemOwnerCSS = css`
1119
1131
  ${itemsCenter};
1120
1132
  ${userSelectNone};
1121
1133
  ${parseHeight('100%')};
1122
- ${textColor('text.sub')};
1134
+ ${textColor('text/sub')};
1123
1135
  `;
1124
1136
  const DetailInfoCSS = css`
1125
1137
  ${displayFlex};
@@ -1145,7 +1157,7 @@ const AttachedLinearCSS = css`
1145
1157
  ${displayFlex};
1146
1158
  ${positionAbsolute};
1147
1159
  ${itemsCenter};
1148
- ${bgColor('system.white')};
1160
+ ${bgColor('system/white')};
1149
1161
  ${parseWidthHeight('100%')};
1150
1162
  ${top(0)};
1151
1163
  `;
@@ -1242,27 +1254,27 @@ const AttachmentRootCSS = (isEmpty, isEnable) => css`
1242
1254
  ${positionRelative};
1243
1255
  ${borderRadius4px};
1244
1256
  ${boxBorder};
1245
- ${border(1, 'line.normal')};
1257
+ ${border(1, 'line/normal')};
1246
1258
  ${parseHeight(isEmpty && !isEnable ? 120 : 280)};
1247
- ${bgColor('system.white')};
1259
+ ${bgColor('system/white')};
1248
1260
  .css-${AttachedCSS.name} {
1249
1261
  .css-${AttachedItemCSS.name} {
1250
1262
  &:hover {
1251
- ${bgColor('fill.hover')};
1263
+ ${bgColor('fill/hover')};
1252
1264
  .css-${AttachedLinearCSS.name} {
1253
- ${bgColor('fill.hover')};
1265
+ ${bgColor('fill/hover')};
1254
1266
  }
1255
1267
  }
1256
1268
  &:active {
1257
- ${bgColor('fill.pressed')};
1269
+ ${bgColor('fill/pressed')};
1258
1270
  .css-${AttachedLinearCSS.name} {
1259
- ${bgColor('fill.pressed')};
1271
+ ${bgColor('fill/pressed')};
1260
1272
  }
1261
1273
  }
1262
1274
  &.chosen {
1263
- ${bgColor('fill.focus')};
1275
+ ${bgColor('fill/focus')};
1264
1276
  .css-${AttachedItemInfoCSS.name}, .css-${AttachedItemOwnerCSS.name} {
1265
- ${bgColor('fill.focus')};
1277
+ ${bgColor('fill/focus')};
1266
1278
  }
1267
1279
  }
1268
1280
  }
@@ -1277,22 +1289,18 @@ const AttachmentRootCSS = (isEmpty, isEnable) => css`
1277
1289
  }
1278
1290
  `;
1279
1291
  Attachment.defaultProps = {
1280
- allowSort: true,
1281
- className: '',
1282
- data: [],
1283
1292
  deleteNotifyText: getGlobal('deleteNotifyText'),
1284
- disabled: false,
1285
1293
  hintText: getGlobal('dropFileHere'),
1286
1294
  label: getGlobal('attachText'),
1287
- maxFile: Infinity,
1288
- multiple: true,
1289
- style: {},
1295
+ maxSize: getGlobal('maxSizeUpload'),
1290
1296
  uploadErrorInfo: {
1291
1297
  maxFile: getGlobal(['errorDefault', 'maxFile']),
1292
1298
  maxSize: getGlobal(['errorDefault', 'maxSize']),
1293
1299
  fileType: getGlobal(['errorDefault', 'fileType']),
1294
1300
  existingFile: getGlobal(['errorDefault', 'existingFile'])
1295
- }
1301
+ },
1302
+ viewType: 'detail',
1303
+ ...getGlobal(['components', 'attachment', 'defaultProps'])
1296
1304
  };
1297
1305
  Attachment.propTypes = {
1298
1306
  /** File types that can be accepted. */
@@ -1333,7 +1341,7 @@ Attachment.propTypes = {
1333
1341
  /** Limit the number of uploaded files. */
1334
1342
  maxFile: PropTypes.number,
1335
1343
  /** Limit the size of uploaded files. */
1336
- maxSize: PropTypes.string,
1344
+ maxSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
1337
1345
  /** Allows to attach multiple files. */
1338
1346
  multiple: PropTypes.bool,
1339
1347
  /** Callback fired when the files attached is changed. */