@digital-ai/dot-components 2.15.2 → 2.16.0
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/CHANGE_LOG.md +28 -8
- package/index.esm.js +68 -25
- package/index.umd.js +107 -49
- package/lib/components/button/CopyButton.d.ts +10 -3
- package/lib/components/button/CopyButton.stories.d.ts +1 -1
- package/lib/components/button/IconButton.d.ts +5 -3
- package/lib/components/file-upload/FileUpload.d.ts +13 -1
- package/lib/components/file-upload/FileUpload.stories.d.ts +2 -1
- package/lib/components/file-upload/utils/helpers.d.ts +4 -3
- package/lib/components/file-upload/utils/models.d.ts +2 -0
- package/lib/components/tooltip/Tooltip.d.ts +3 -1
- package/lib/components/tooltip/Tooltip.stories.d.ts +1 -1
- package/lib/components/truncate-with-tooltip/TruncateWithTooltip.d.ts +3 -1
- package/lib/components/truncate-with-tooltip/TruncateWithTooltip.stories.d.ts +1 -1
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.16.0](https://www.npmjs.com/package/@digital-ai/dot-components) (09/28/2023)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.15.2...2.16.0)
|
|
6
|
+
|
|
7
|
+
**Features:**
|
|
8
|
+
|
|
9
|
+
- S-96608: `DotFileUpload` Allow to pass props to upload button [\#1627](https://github.com/digital-ai/dot-components/pull/1627) ([angel-git](https://github.com/angel-git))
|
|
10
|
+
- S-96168: Add DotIconButton props to DotCopyButton [\#1626](https://github.com/digital-ai/dot-components/pull/1626) ([jmcnally](https://github.com/jmcnally))
|
|
11
|
+
- D-21922: Support `arrow` prop in tooltip components [\#1615](https://github.com/digital-ai/dot-components/pull/1615) ([BoraAksoy](https://github.com/BoraAksoy))
|
|
12
|
+
|
|
13
|
+
**Fixed bugs:**
|
|
14
|
+
|
|
15
|
+
- D-26820: `DotInputText` Fix double tab issue [\#1629](https://github.com/digital-ai/dot-components/pull/1629) ([dmiletic85](https://github.com/dmiletic85))
|
|
16
|
+
|
|
17
|
+
**Misc:**
|
|
18
|
+
|
|
19
|
+
- Master \> Develop [\#1624](https://github.com/digital-ai/dot-components/pull/1624) ([ryangamble](https://github.com/ryangamble))
|
|
20
|
+
|
|
3
21
|
## [2.15.2](https://www.npmjs.com/package/@digital-ai/dot-components) (09/25/2023)
|
|
4
22
|
|
|
5
23
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.15.1...2.15.2)
|
|
@@ -320,7 +338,6 @@
|
|
|
320
338
|
**Misc:**
|
|
321
339
|
|
|
322
340
|
- S-91314: Remove use of deprecated `StylesProvider` [\#1457](https://github.com/digital-ai/dot-components/pull/1457) ([CWSites](https://github.com/CWSites))
|
|
323
|
-
- S-91975: `TimePicker` - Improve keyboard access [\#1455](https://github.com/digital-ai/dot-components/pull/1455) ([dmiletic85](https://github.com/dmiletic85))
|
|
324
341
|
|
|
325
342
|
## [2.7.0](https://www.npmjs.com/package/@digital-ai/dot-components) (04/14/2023)
|
|
326
343
|
|
|
@@ -335,6 +352,10 @@
|
|
|
335
352
|
|
|
336
353
|
- D-24793: `DotTimePicker` - set clock instead of calendar icon [\#1444](https://github.com/digital-ai/dot-components/pull/1444) ([dmiletic85](https://github.com/dmiletic85))
|
|
337
354
|
|
|
355
|
+
**Misc:**
|
|
356
|
+
|
|
357
|
+
- S-91975: `TimePicker` - Improve keyboard access [\#1455](https://github.com/digital-ai/dot-components/pull/1455) ([dmiletic85](https://github.com/dmiletic85))
|
|
358
|
+
|
|
338
359
|
## [2.6.1](https://www.npmjs.com/package/@digital-ai/dot-components) (04/06/2023)
|
|
339
360
|
|
|
340
361
|
[Full Changelog](https://digital-ai.github.io/dot-components/?path=/story/introduction--page/digital-ai/dot-components/compare/2.6.0...2.6.1)
|
|
@@ -953,7 +974,6 @@
|
|
|
953
974
|
|
|
954
975
|
**Features:**
|
|
955
976
|
|
|
956
|
-
- S-82390: Configure `tsconfig.json` so that `React` imports are obsolete [\#1041](https://github.com/digital-ai/dot-components/pull/1041) ([dmiletic85](https://github.com/dmiletic85))
|
|
957
977
|
- S-81800: `Badge`: Add ability to render the number [\#1037](https://github.com/digital-ai/dot-components/pull/1037) ([dmiletic85](https://github.com/dmiletic85))
|
|
958
978
|
- S-82311: deprecate startIconId, endIconId ListItem props in favor of startIcon, endIcon [\#1035](https://github.com/digital-ai/dot-components/pull/1035) ([selsemore](https://github.com/selsemore))
|
|
959
979
|
|
|
@@ -1013,7 +1033,6 @@
|
|
|
1013
1033
|
- S-81968: `ButtonToggle`: Add class prop into `ButtonToggleProps` and export relevant types and interfaces [\#993](https://github.com/digital-ai/dot-components/pull/993) ([dmiletic85](https://github.com/dmiletic85))
|
|
1014
1034
|
- S-81966: `Divider`: Create and expose `Divider` component [\#992](https://github.com/digital-ai/dot-components/pull/992) ([dmiletic85](https://github.com/dmiletic85))
|
|
1015
1035
|
- S-81656: `Popper`: Create and expose `Popper` component [\#988](https://github.com/digital-ai/dot-components/pull/988) ([dmiletic85](https://github.com/dmiletic85))
|
|
1016
|
-
- S-81802: Add 'Clear all' button to DotTable multiSelect toolbar [\#987](https://github.com/digital-ai/dot-components/pull/987) ([selsemore](https://github.com/selsemore))
|
|
1017
1036
|
- S-81693: `Menu`: add multi-level support [\#981](https://github.com/digital-ai/dot-components/pull/981) ([dmiletic85](https://github.com/dmiletic85))
|
|
1018
1037
|
|
|
1019
1038
|
**Fixed bugs:**
|
|
@@ -1041,6 +1060,7 @@
|
|
|
1041
1060
|
|
|
1042
1061
|
**Features:**
|
|
1043
1062
|
|
|
1063
|
+
- S-81802: Add 'Clear all' button to DotTable multiSelect toolbar [\#987](https://github.com/digital-ai/dot-components/pull/987) ([selsemore](https://github.com/selsemore))
|
|
1044
1064
|
- S-76952: `AutoComplete`: Add dense prop [\#976](https://github.com/digital-ai/dot-components/pull/976) ([dmiletic85](https://github.com/dmiletic85))
|
|
1045
1065
|
- S-81503: `Autocomplete` Improve functionality for adding new item [\#957](https://github.com/digital-ai/dot-components/pull/957) ([dmiletic85](https://github.com/dmiletic85))
|
|
1046
1066
|
|
|
@@ -1127,8 +1147,8 @@
|
|
|
1127
1147
|
- D-19378: `AutoComplete` doesn't have `required` property [\#914](https://github.com/digital-ai/dot-components/pull/914) ([dmiletic85](https://github.com/dmiletic85))
|
|
1128
1148
|
- D-19376: `Menu`: `maxVisibleItems` prop does not control visible items anymore [\#911](https://github.com/digital-ai/dot-components/pull/911) ([dmiletic85](https://github.com/dmiletic85))
|
|
1129
1149
|
- D-19366: `Menu`: Circular dependency [\#909](https://github.com/digital-ai/dot-components/pull/909) ([dmiletic85](https://github.com/dmiletic85))
|
|
1150
|
+
- D-19355: `Breadcrumbs`: invalid combination of props [\#907](https://github.com/digital-ai/dot-components/pull/907) ([dmiletic85](https://github.com/dmiletic85))
|
|
1130
1151
|
- D-19129: `Table`: Cells in the Table component should be wrapped by `DotTypography` [\#900](https://github.com/digital-ai/dot-components/pull/900) ([dmiletic85](https://github.com/dmiletic85))
|
|
1131
|
-
- D-19337: `List`: Circular dependency [\#897](https://github.com/digital-ai/dot-components/pull/897) ([dmiletic85](https://github.com/dmiletic85))
|
|
1132
1152
|
|
|
1133
1153
|
## [1.5.4](https://www.npmjs.com/package/@digital-ai/dot-components) (12/28/2021)
|
|
1134
1154
|
|
|
@@ -1142,7 +1162,7 @@
|
|
|
1142
1162
|
|
|
1143
1163
|
**Fixed bugs:**
|
|
1144
1164
|
|
|
1145
|
-
- D-
|
|
1165
|
+
- D-19337: `List`: Circular dependency [\#897](https://github.com/digital-ai/dot-components/pull/897) ([dmiletic85](https://github.com/dmiletic85))
|
|
1146
1166
|
- D-19330: `AppToolbar` shouldn't have grey dividers [\#891](https://github.com/digital-ai/dot-components/pull/891) ([dmiletic85](https://github.com/dmiletic85))
|
|
1147
1167
|
- D-19200: `List` Nested list drawer is not rendering correctly [\#869](https://github.com/digital-ai/dot-components/pull/869) ([dmiletic85](https://github.com/dmiletic85))
|
|
1148
1168
|
|
|
@@ -1327,7 +1347,6 @@
|
|
|
1327
1347
|
- D-19026: Missing required prop for icon button when importing it to table cell [\#761](https://github.com/digital-ai/dot-components/pull/761) ([monapatel91](https://github.com/monapatel91))
|
|
1328
1348
|
- D-18543: proper export of type and interface [\#760](https://github.com/digital-ai/dot-components/pull/760) ([CWSites](https://github.com/CWSites))
|
|
1329
1349
|
- D-19023: Circular Dependency in `DynamicForm` component [\#759](https://github.com/digital-ai/dot-components/pull/759) ([dmiletic85](https://github.com/dmiletic85))
|
|
1330
|
-
- D-19004: update readme link to be accurate [\#750](https://github.com/digital-ai/dot-components/pull/750) ([CWSites](https://github.com/CWSites))
|
|
1331
1350
|
|
|
1332
1351
|
**Misc:**
|
|
1333
1352
|
|
|
@@ -1345,6 +1364,7 @@
|
|
|
1345
1364
|
**Fixed bugs:**
|
|
1346
1365
|
|
|
1347
1366
|
- D-19011: remove default MUI min width of end icon on list item [\#754](https://github.com/digital-ai/dot-components/pull/754) ([CWSites](https://github.com/CWSites))
|
|
1367
|
+
- D-19004: update readme link to be accurate [\#750](https://github.com/digital-ai/dot-components/pull/750) ([CWSites](https://github.com/CWSites))
|
|
1348
1368
|
- D-18990: allow consumers to pass custom menu item height [\#749](https://github.com/digital-ai/dot-components/pull/749) ([CWSites](https://github.com/CWSites))
|
|
1349
1369
|
- D-18992: Missing disabled prop of icon button when importing it to tablecell [\#745](https://github.com/digital-ai/dot-components/pull/745) ([monapatel91](https://github.com/monapatel91))
|
|
1350
1370
|
- D-18997: when specified width of sidebar, it should be applied properly [\#737](https://github.com/digital-ai/dot-components/pull/737) ([CWSites](https://github.com/CWSites))
|
|
@@ -1438,6 +1458,7 @@
|
|
|
1438
1458
|
- D-18817: set mainMenuItems to `null` by default [\#688](https://github.com/digital-ai/dot-components/pull/688) ([CWSites](https://github.com/CWSites))
|
|
1439
1459
|
- D-18664: update link to allow for keypress [\#686](https://github.com/digital-ai/dot-components/pull/686) ([CWSites](https://github.com/CWSites))
|
|
1440
1460
|
- D-18665: AppToolbar z-index update [\#685](https://github.com/digital-ai/dot-components/pull/685) ([CWSites](https://github.com/CWSites))
|
|
1461
|
+
- D-18663: Update AutoComplete value typing [\#684](https://github.com/digital-ai/dot-components/pull/684) ([CWSites](https://github.com/CWSites))
|
|
1441
1462
|
|
|
1442
1463
|
**Misc:**
|
|
1443
1464
|
|
|
@@ -1461,7 +1482,6 @@
|
|
|
1461
1482
|
|
|
1462
1483
|
**Fixed bugs:**
|
|
1463
1484
|
|
|
1464
|
-
- D-18663: Update AutoComplete value typing [\#684](https://github.com/digital-ai/dot-components/pull/684) ([CWSites](https://github.com/CWSites))
|
|
1465
1485
|
- D-18424: include breadcrumb wrapper with breadcrumb component [\#675](https://github.com/digital-ai/dot-components/pull/675) ([CWSites](https://github.com/CWSites))
|
|
1466
1486
|
- D-18536: material 4.12.3 upgrade [\#667](https://github.com/digital-ai/dot-components/pull/667) ([CWSites](https://github.com/CWSites))
|
|
1467
1487
|
|
|
@@ -1492,6 +1512,7 @@
|
|
|
1492
1512
|
- S-78497: Add 'page' prop to DotTable [\#662](https://github.com/digital-ai/dot-components/pull/662) ([selsemore](https://github.com/selsemore))
|
|
1493
1513
|
- Issue \#632: Add aria-label property [\#659](https://github.com/digital-ai/dot-components/pull/659) ([dmiletic85](https://github.com/dmiletic85))
|
|
1494
1514
|
- S-78464: SonarQube [\#657](https://github.com/digital-ai/dot-components/pull/657) ([CWSites](https://github.com/CWSites))
|
|
1515
|
+
- S-78388: Export interfaces and types needed for table pagination and sorting [\#654](https://github.com/digital-ai/dot-components/pull/654) ([selsemore](https://github.com/selsemore))
|
|
1495
1516
|
- S-77872: gather test coverage in sonarcloud [\#653](https://github.com/digital-ai/dot-components/pull/653) ([CWSites](https://github.com/CWSites))
|
|
1496
1517
|
|
|
1497
1518
|
## [1.0.8](https://www.npmjs.com/package/@digital-ai/dot-components) (08/23/2021)
|
|
@@ -1500,7 +1521,6 @@
|
|
|
1500
1521
|
|
|
1501
1522
|
**Misc:**
|
|
1502
1523
|
|
|
1503
|
-
- S-78388: Export interfaces and types needed for table pagination and sorting [\#654](https://github.com/digital-ai/dot-components/pull/654) ([selsemore](https://github.com/selsemore))
|
|
1504
1524
|
- add export back to component library [\#652](https://github.com/digital-ai/dot-components/pull/652) ([CWSites](https://github.com/CWSites))
|
|
1505
1525
|
- add back missing items from export [\#651](https://github.com/digital-ai/dot-components/pull/651) ([TheKeithStewart](https://github.com/TheKeithStewart))
|
|
1506
1526
|
|
package/index.esm.js
CHANGED
|
@@ -22,6 +22,7 @@ function useStylesWithRootClass(name, className, ...args) {
|
|
|
22
22
|
const DotTooltip = ({
|
|
23
23
|
ariaLabel,
|
|
24
24
|
ariaRole: _ariaRole = 'tooltip',
|
|
25
|
+
arrow: _arrow = true,
|
|
25
26
|
children,
|
|
26
27
|
className,
|
|
27
28
|
'data-testid': dataTestId,
|
|
@@ -35,6 +36,7 @@ const DotTooltip = ({
|
|
|
35
36
|
return title ? jsx(Tooltip, Object.assign({
|
|
36
37
|
"aria-hidden": false,
|
|
37
38
|
"aria-label": ariaLabel || title.toString(),
|
|
39
|
+
arrow: _arrow,
|
|
38
40
|
className: rootClasses,
|
|
39
41
|
"data-testid": dataTestId,
|
|
40
42
|
leaveDelay: leaveDelay,
|
|
@@ -3059,11 +3061,12 @@ const DotInputText = ({
|
|
|
3059
3061
|
shrink: _type === 'date' ? true : shrink
|
|
3060
3062
|
},
|
|
3061
3063
|
inputProps: {
|
|
3062
|
-
'data-testid': dataTestId,
|
|
3063
3064
|
className: inputClassName,
|
|
3064
|
-
|
|
3065
|
+
'data-testid': dataTestId,
|
|
3065
3066
|
max,
|
|
3066
|
-
min
|
|
3067
|
+
min,
|
|
3068
|
+
readOnly: _readOnly,
|
|
3069
|
+
tabIndex: 0
|
|
3067
3070
|
},
|
|
3068
3071
|
inputRef: inputRef,
|
|
3069
3072
|
label: persistentLabel ? null : label,
|
|
@@ -3080,7 +3083,6 @@ const DotInputText = ({
|
|
|
3080
3083
|
required: _required,
|
|
3081
3084
|
role: "textbox",
|
|
3082
3085
|
size: _size,
|
|
3083
|
-
tabIndex: 0,
|
|
3084
3086
|
type: _type,
|
|
3085
3087
|
value: inputTextValue,
|
|
3086
3088
|
variant: "outlined"
|
|
@@ -3169,13 +3171,30 @@ const StyledCopyButton = styled.span.withConfig({
|
|
|
3169
3171
|
|
|
3170
3172
|
const DotCopyButton = ({
|
|
3171
3173
|
ariaLabel: _ariaLabel = 'Copy to clipboard',
|
|
3174
|
+
ariaRole: _ariaRole = 'button',
|
|
3175
|
+
className,
|
|
3176
|
+
color: _color = 'inherit',
|
|
3172
3177
|
copiedTooltip: _copiedTooltip = 'Copied!',
|
|
3173
3178
|
copyTooltip: _copyTooltip = 'Copy to clipboard',
|
|
3174
3179
|
'data-testid': dataTestId = 'dot-copy-button',
|
|
3180
|
+
disabled: _disabled = false,
|
|
3181
|
+
disableRipple: _disableRipple = false,
|
|
3182
|
+
iconId: _iconId = 'duplicate',
|
|
3183
|
+
iconSize: _iconSize = 'small',
|
|
3184
|
+
onClick: _onClick = null,
|
|
3185
|
+
shape: _shape = 'circle',
|
|
3186
|
+
showCopiedIcon: _showCopiedIcon = true,
|
|
3187
|
+
size: _size = 'small',
|
|
3188
|
+
tooltip,
|
|
3175
3189
|
value
|
|
3176
3190
|
}) => {
|
|
3177
|
-
const [
|
|
3178
|
-
const
|
|
3191
|
+
const [timedShowCopiedIcon, setTimedShowCopiedIcon] = useState(false);
|
|
3192
|
+
const [timedDisabled, setTimedDisabled] = useState(false);
|
|
3193
|
+
// To keep backward compatibility if tooltip is not set, use copyTooltip
|
|
3194
|
+
if (!tooltip) {
|
|
3195
|
+
tooltip = _copyTooltip;
|
|
3196
|
+
}
|
|
3197
|
+
const copyToClipboard = useCallback(() => {
|
|
3179
3198
|
// The check for navigator.clipboard.writeText is because this function is
|
|
3180
3199
|
// only supported in secure contexts (https). This will always be the case in
|
|
3181
3200
|
// production but not when running locally.
|
|
@@ -3184,27 +3203,44 @@ const DotCopyButton = ({
|
|
|
3184
3203
|
} else {
|
|
3185
3204
|
navigator.clipboard.writeText(value);
|
|
3186
3205
|
}
|
|
3187
|
-
};
|
|
3188
|
-
const copy = (
|
|
3206
|
+
}, [value]);
|
|
3207
|
+
const copy = useCallback(event => {
|
|
3189
3208
|
copyToClipboard();
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3209
|
+
if (_showCopiedIcon) {
|
|
3210
|
+
setTimedShowCopiedIcon(true);
|
|
3211
|
+
setTimeout(function () {
|
|
3212
|
+
setTimedShowCopiedIcon(false);
|
|
3213
|
+
}, 3000);
|
|
3214
|
+
} else if (!_disabled) {
|
|
3215
|
+
setTimedDisabled(true);
|
|
3216
|
+
setTimeout(function () {
|
|
3217
|
+
setTimedDisabled(false);
|
|
3218
|
+
}, 3000);
|
|
3219
|
+
}
|
|
3220
|
+
if (_onClick) {
|
|
3221
|
+
return _onClick(event);
|
|
3222
|
+
}
|
|
3194
3223
|
return false;
|
|
3195
|
-
};
|
|
3224
|
+
}, [_showCopiedIcon, _disabled, _onClick]);
|
|
3196
3225
|
return jsxs(StyledCopyButton, Object.assign({
|
|
3197
3226
|
className: rootClassName$O,
|
|
3198
3227
|
"data-testid": dataTestId
|
|
3199
3228
|
}, {
|
|
3200
|
-
children: [!
|
|
3201
|
-
ariaLabel: _ariaLabel
|
|
3229
|
+
children: [!timedShowCopiedIcon && jsx(DotIconButton, {
|
|
3230
|
+
ariaLabel: _ariaLabel,
|
|
3231
|
+
ariaRole: _ariaRole,
|
|
3232
|
+
className: className,
|
|
3233
|
+
color: _color,
|
|
3202
3234
|
"data-testid": `${dataTestId}-button`,
|
|
3203
|
-
|
|
3235
|
+
disabled: _disabled || timedDisabled,
|
|
3236
|
+
disableRipple: _disableRipple,
|
|
3237
|
+
iconId: _iconId,
|
|
3238
|
+
iconSize: _iconSize,
|
|
3204
3239
|
onClick: copy,
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3240
|
+
shape: _shape,
|
|
3241
|
+
size: _size,
|
|
3242
|
+
tooltip: tooltip
|
|
3243
|
+
}, void 0), timedShowCopiedIcon && jsx(DotIcon, {
|
|
3208
3244
|
className: "copied-to-clipboard",
|
|
3209
3245
|
"data-testid": `${dataTestId}-icon`,
|
|
3210
3246
|
fontSize: "small",
|
|
@@ -3880,6 +3916,7 @@ const getTooltipLabel = (label, charactersLimit) => {
|
|
|
3880
3916
|
|
|
3881
3917
|
const DotTruncateWithTooltip = ({
|
|
3882
3918
|
ariaLabel,
|
|
3919
|
+
arrow: _arrow = true,
|
|
3883
3920
|
charactersLimit,
|
|
3884
3921
|
className,
|
|
3885
3922
|
'data-testid': dataTestId,
|
|
@@ -3889,6 +3926,7 @@ const DotTruncateWithTooltip = ({
|
|
|
3889
3926
|
const rootClasses = useStylesWithRootClass(rootClassName$L, className, charactersLimit ? 'dot-characters-limit' : '');
|
|
3890
3927
|
return jsx(StyledTruncateWithTooltip, Object.assign({
|
|
3891
3928
|
"aria-label": ariaLabel,
|
|
3929
|
+
arrow: _arrow,
|
|
3892
3930
|
className: rootClasses,
|
|
3893
3931
|
"data-testid": dataTestId,
|
|
3894
3932
|
title: getTooltipLabel(label, charactersLimit),
|
|
@@ -9335,11 +9373,11 @@ const renderMaxFilesMessage = (maxFiles, maxFilesClasses) => jsx(DotTypography,
|
|
|
9335
9373
|
}, {
|
|
9336
9374
|
children: `${maxFiles} files are the maximum number of files you can upload.`
|
|
9337
9375
|
}), void 0);
|
|
9338
|
-
const renderSelectFilesButton = (isUploadDisabled, onButtonClick) => jsx(DotButton, Object.assign({
|
|
9376
|
+
const renderSelectFilesButton = (buttonProps, isUploadDisabled, onButtonClick) => jsx(DotButton, Object.assign({}, buttonProps, {
|
|
9339
9377
|
disabled: isUploadDisabled,
|
|
9340
9378
|
onClick: onButtonClick
|
|
9341
9379
|
}, {
|
|
9342
|
-
children:
|
|
9380
|
+
children: buttonProps.label
|
|
9343
9381
|
}), void 0);
|
|
9344
9382
|
const renderActiveDragArea = () => jsxs(Fragment, {
|
|
9345
9383
|
children: [jsx(DotIcon, {
|
|
@@ -9350,25 +9388,26 @@ const renderActiveDragArea = () => jsxs(Fragment, {
|
|
|
9350
9388
|
children: "Drop the file(s) here ..."
|
|
9351
9389
|
}), void 0)]
|
|
9352
9390
|
}, void 0);
|
|
9353
|
-
const renderDragAndDropArea = (isUploadDisabled, onSelectButtonClick) => jsxs(Fragment, {
|
|
9391
|
+
const renderDragAndDropArea = (buttonProps, isUploadDisabled, onSelectButtonClick) => jsxs(Fragment, {
|
|
9354
9392
|
children: [jsx(DotIcon, {
|
|
9355
9393
|
iconId: "upload-file"
|
|
9356
9394
|
}, void 0), jsxs(DotTypography, Object.assign({
|
|
9357
9395
|
variant: "h3"
|
|
9358
9396
|
}, {
|
|
9359
9397
|
children: ["Drag and drop your file(s) here ", jsx("br", {}, void 0), " or"]
|
|
9360
|
-
}), void 0), renderSelectFilesButton(isUploadDisabled, onSelectButtonClick)]
|
|
9398
|
+
}), void 0), renderSelectFilesButton(buttonProps, isUploadDisabled, onSelectButtonClick)]
|
|
9361
9399
|
}, void 0);
|
|
9362
9400
|
const renderDropzoneContent = ({
|
|
9363
9401
|
buttonOnly,
|
|
9402
|
+
buttonProps,
|
|
9364
9403
|
isDragActive,
|
|
9365
9404
|
isUploadDisabled,
|
|
9366
9405
|
open
|
|
9367
9406
|
}) => {
|
|
9368
9407
|
if (buttonOnly) {
|
|
9369
|
-
return renderSelectFilesButton(isUploadDisabled, open);
|
|
9408
|
+
return renderSelectFilesButton(buttonProps, isUploadDisabled, open);
|
|
9370
9409
|
} else {
|
|
9371
|
-
return isDragActive ? renderActiveDragArea() : renderDragAndDropArea(isUploadDisabled, open);
|
|
9410
|
+
return isDragActive ? renderActiveDragArea() : renderDragAndDropArea(buttonProps, isUploadDisabled, open);
|
|
9372
9411
|
}
|
|
9373
9412
|
};
|
|
9374
9413
|
const getUploadedFilesList = ({
|
|
@@ -9431,6 +9470,9 @@ const DotFileUpload = ({
|
|
|
9431
9470
|
accept,
|
|
9432
9471
|
ariaLabel,
|
|
9433
9472
|
ariaRole: _ariaRole = 'region',
|
|
9473
|
+
buttonProps: _buttonProps = {
|
|
9474
|
+
label: 'Select file(s)'
|
|
9475
|
+
},
|
|
9434
9476
|
buttonOnly: _buttonOnly = false,
|
|
9435
9477
|
className,
|
|
9436
9478
|
'data-testid': dataTestId,
|
|
@@ -9503,6 +9545,7 @@ const DotFileUpload = ({
|
|
|
9503
9545
|
"data-testid": dataTestId
|
|
9504
9546
|
}, {
|
|
9505
9547
|
children: [jsx("input", Object.assign({}, getInputProps()), void 0), renderDropzoneContent({
|
|
9548
|
+
buttonProps: _buttonProps,
|
|
9506
9549
|
buttonOnly: _buttonOnly,
|
|
9507
9550
|
isDragActive,
|
|
9508
9551
|
isUploadDisabled,
|
package/index.umd.js
CHANGED
|
@@ -152,19 +152,22 @@
|
|
|
152
152
|
var ariaLabel = _a.ariaLabel,
|
|
153
153
|
_b = _a.ariaRole,
|
|
154
154
|
ariaRole = _b === void 0 ? 'tooltip' : _b,
|
|
155
|
+
_c = _a.arrow,
|
|
156
|
+
arrow = _c === void 0 ? true : _c,
|
|
155
157
|
children = _a.children,
|
|
156
158
|
className = _a.className,
|
|
157
159
|
dataTestId = _a["data-testid"],
|
|
158
160
|
leaveDelay = _a.leaveDelay,
|
|
159
161
|
onClose = _a.onClose,
|
|
160
162
|
open = _a.open,
|
|
161
|
-
|
|
162
|
-
placement =
|
|
163
|
+
_d = _a.placement,
|
|
164
|
+
placement = _d === void 0 ? 'bottom' : _d,
|
|
163
165
|
title = _a.title;
|
|
164
166
|
var rootClasses = useStylesWithRootClass('dot-tooltip', className);
|
|
165
167
|
return title ? jsxRuntime.jsx(material.Tooltip, __assign({
|
|
166
168
|
"aria-hidden": false,
|
|
167
169
|
"aria-label": ariaLabel || title.toString(),
|
|
170
|
+
arrow: arrow,
|
|
168
171
|
className: rootClasses,
|
|
169
172
|
"data-testid": dataTestId,
|
|
170
173
|
leaveDelay: leaveDelay,
|
|
@@ -3400,11 +3403,12 @@
|
|
|
3400
3403
|
shrink: type === 'date' ? true : shrink
|
|
3401
3404
|
},
|
|
3402
3405
|
inputProps: {
|
|
3403
|
-
'data-testid': dataTestId,
|
|
3404
3406
|
className: inputClassName,
|
|
3405
|
-
|
|
3407
|
+
'data-testid': dataTestId,
|
|
3406
3408
|
max: max,
|
|
3407
|
-
min: min
|
|
3409
|
+
min: min,
|
|
3410
|
+
readOnly: readOnly,
|
|
3411
|
+
tabIndex: 0
|
|
3408
3412
|
},
|
|
3409
3413
|
inputRef: inputRef,
|
|
3410
3414
|
label: persistentLabel ? null : label,
|
|
@@ -3421,7 +3425,6 @@
|
|
|
3421
3425
|
required: required,
|
|
3422
3426
|
role: "textbox",
|
|
3423
3427
|
size: size,
|
|
3424
|
-
tabIndex: 0,
|
|
3425
3428
|
type: type,
|
|
3426
3429
|
value: inputTextValue,
|
|
3427
3430
|
variant: "outlined"
|
|
@@ -3522,17 +3525,46 @@
|
|
|
3522
3525
|
var DotCopyButton = function DotCopyButton(_a) {
|
|
3523
3526
|
var _b = _a.ariaLabel,
|
|
3524
3527
|
ariaLabel = _b === void 0 ? 'Copy to clipboard' : _b,
|
|
3525
|
-
_c = _a.
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3528
|
+
_c = _a.ariaRole,
|
|
3529
|
+
ariaRole = _c === void 0 ? 'button' : _c,
|
|
3530
|
+
className = _a.className,
|
|
3531
|
+
_d = _a.color,
|
|
3532
|
+
color = _d === void 0 ? 'inherit' : _d,
|
|
3533
|
+
_e = _a.copiedTooltip,
|
|
3534
|
+
copiedTooltip = _e === void 0 ? 'Copied!' : _e,
|
|
3535
|
+
_f = _a.copyTooltip,
|
|
3536
|
+
copyTooltip = _f === void 0 ? 'Copy to clipboard' : _f,
|
|
3537
|
+
_g = _a["data-testid"],
|
|
3538
|
+
dataTestId = _g === void 0 ? 'dot-copy-button' : _g,
|
|
3539
|
+
_h = _a.disabled,
|
|
3540
|
+
disabled = _h === void 0 ? false : _h,
|
|
3541
|
+
_j = _a.disableRipple,
|
|
3542
|
+
disableRipple = _j === void 0 ? false : _j,
|
|
3543
|
+
_k = _a.iconId,
|
|
3544
|
+
iconId = _k === void 0 ? 'duplicate' : _k,
|
|
3545
|
+
_l = _a.iconSize,
|
|
3546
|
+
iconSize = _l === void 0 ? 'small' : _l,
|
|
3547
|
+
_m = _a.onClick,
|
|
3548
|
+
onClick = _m === void 0 ? null : _m,
|
|
3549
|
+
_o = _a.shape,
|
|
3550
|
+
shape = _o === void 0 ? 'circle' : _o,
|
|
3551
|
+
_p = _a.showCopiedIcon,
|
|
3552
|
+
showCopiedIcon = _p === void 0 ? true : _p,
|
|
3553
|
+
_q = _a.size,
|
|
3554
|
+
size = _q === void 0 ? 'small' : _q,
|
|
3555
|
+
tooltip = _a.tooltip,
|
|
3531
3556
|
value = _a.value;
|
|
3532
|
-
var
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
var
|
|
3557
|
+
var _r = React.useState(false),
|
|
3558
|
+
timedShowCopiedIcon = _r[0],
|
|
3559
|
+
setTimedShowCopiedIcon = _r[1];
|
|
3560
|
+
var _s = React.useState(false),
|
|
3561
|
+
timedDisabled = _s[0],
|
|
3562
|
+
setTimedDisabled = _s[1];
|
|
3563
|
+
// To keep backward compatibility if tooltip is not set, use copyTooltip
|
|
3564
|
+
if (!tooltip) {
|
|
3565
|
+
tooltip = copyTooltip;
|
|
3566
|
+
}
|
|
3567
|
+
var copyToClipboard = React.useCallback(function () {
|
|
3536
3568
|
// The check for navigator.clipboard.writeText is because this function is
|
|
3537
3569
|
// only supported in secure contexts (https). This will always be the case in
|
|
3538
3570
|
// production but not when running locally.
|
|
@@ -3541,27 +3573,44 @@
|
|
|
3541
3573
|
} else {
|
|
3542
3574
|
navigator.clipboard.writeText(value);
|
|
3543
3575
|
}
|
|
3544
|
-
};
|
|
3545
|
-
var copy = function
|
|
3576
|
+
}, [value]);
|
|
3577
|
+
var copy = React.useCallback(function (event) {
|
|
3546
3578
|
copyToClipboard();
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3579
|
+
if (showCopiedIcon) {
|
|
3580
|
+
setTimedShowCopiedIcon(true);
|
|
3581
|
+
setTimeout(function () {
|
|
3582
|
+
setTimedShowCopiedIcon(false);
|
|
3583
|
+
}, 3000);
|
|
3584
|
+
} else if (!disabled) {
|
|
3585
|
+
setTimedDisabled(true);
|
|
3586
|
+
setTimeout(function () {
|
|
3587
|
+
setTimedDisabled(false);
|
|
3588
|
+
}, 3000);
|
|
3589
|
+
}
|
|
3590
|
+
if (onClick) {
|
|
3591
|
+
return onClick(event);
|
|
3592
|
+
}
|
|
3551
3593
|
return false;
|
|
3552
|
-
};
|
|
3594
|
+
}, [showCopiedIcon, disabled, onClick]);
|
|
3553
3595
|
return jsxRuntime.jsxs(StyledCopyButton, __assign({
|
|
3554
3596
|
className: rootClassName$O,
|
|
3555
3597
|
"data-testid": dataTestId
|
|
3556
3598
|
}, {
|
|
3557
|
-
children: [!
|
|
3558
|
-
ariaLabel: ariaLabel
|
|
3599
|
+
children: [!timedShowCopiedIcon && jsxRuntime.jsx(DotIconButton, {
|
|
3600
|
+
ariaLabel: ariaLabel,
|
|
3601
|
+
ariaRole: ariaRole,
|
|
3602
|
+
className: className,
|
|
3603
|
+
color: color,
|
|
3559
3604
|
"data-testid": dataTestId + "-button",
|
|
3560
|
-
|
|
3605
|
+
disabled: disabled || timedDisabled,
|
|
3606
|
+
disableRipple: disableRipple,
|
|
3607
|
+
iconId: iconId,
|
|
3608
|
+
iconSize: iconSize,
|
|
3561
3609
|
onClick: copy,
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3610
|
+
shape: shape,
|
|
3611
|
+
size: size,
|
|
3612
|
+
tooltip: tooltip
|
|
3613
|
+
}, void 0), timedShowCopiedIcon && jsxRuntime.jsx(DotIcon, {
|
|
3565
3614
|
className: "copied-to-clipboard",
|
|
3566
3615
|
"data-testid": dataTestId + "-icon",
|
|
3567
3616
|
fontSize: "small",
|
|
@@ -4279,6 +4328,8 @@
|
|
|
4279
4328
|
|
|
4280
4329
|
var DotTruncateWithTooltip = function DotTruncateWithTooltip(_a) {
|
|
4281
4330
|
var ariaLabel = _a.ariaLabel,
|
|
4331
|
+
_b = _a.arrow,
|
|
4332
|
+
arrow = _b === void 0 ? true : _b,
|
|
4282
4333
|
charactersLimit = _a.charactersLimit,
|
|
4283
4334
|
className = _a.className,
|
|
4284
4335
|
dataTestId = _a["data-testid"],
|
|
@@ -4287,6 +4338,7 @@
|
|
|
4287
4338
|
var rootClasses = useStylesWithRootClass(rootClassName$L, className, charactersLimit ? 'dot-characters-limit' : '');
|
|
4288
4339
|
return jsxRuntime.jsx(StyledTruncateWithTooltip, __assign({
|
|
4289
4340
|
"aria-label": ariaLabel,
|
|
4341
|
+
arrow: arrow,
|
|
4290
4342
|
className: rootClasses,
|
|
4291
4343
|
"data-testid": dataTestId,
|
|
4292
4344
|
title: getTooltipLabel(label, charactersLimit),
|
|
@@ -10158,12 +10210,12 @@
|
|
|
10158
10210
|
children: maxFiles + " files are the maximum number of files you can upload."
|
|
10159
10211
|
}), void 0);
|
|
10160
10212
|
};
|
|
10161
|
-
var renderSelectFilesButton = function renderSelectFilesButton(isUploadDisabled, onButtonClick) {
|
|
10162
|
-
return jsxRuntime.jsx(DotButton, __assign({
|
|
10213
|
+
var renderSelectFilesButton = function renderSelectFilesButton(buttonProps, isUploadDisabled, onButtonClick) {
|
|
10214
|
+
return jsxRuntime.jsx(DotButton, __assign({}, buttonProps, {
|
|
10163
10215
|
disabled: isUploadDisabled,
|
|
10164
10216
|
onClick: onButtonClick
|
|
10165
10217
|
}, {
|
|
10166
|
-
children:
|
|
10218
|
+
children: buttonProps.label
|
|
10167
10219
|
}), void 0);
|
|
10168
10220
|
};
|
|
10169
10221
|
var renderActiveDragArea = function renderActiveDragArea() {
|
|
@@ -10177,7 +10229,7 @@
|
|
|
10177
10229
|
}), void 0)]
|
|
10178
10230
|
}, void 0);
|
|
10179
10231
|
};
|
|
10180
|
-
var renderDragAndDropArea = function renderDragAndDropArea(isUploadDisabled, onSelectButtonClick) {
|
|
10232
|
+
var renderDragAndDropArea = function renderDragAndDropArea(buttonProps, isUploadDisabled, onSelectButtonClick) {
|
|
10181
10233
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10182
10234
|
children: [jsxRuntime.jsx(DotIcon, {
|
|
10183
10235
|
iconId: "upload-file"
|
|
@@ -10185,18 +10237,19 @@
|
|
|
10185
10237
|
variant: "h3"
|
|
10186
10238
|
}, {
|
|
10187
10239
|
children: ["Drag and drop your file(s) here ", jsxRuntime.jsx("br", {}, void 0), " or"]
|
|
10188
|
-
}), void 0), renderSelectFilesButton(isUploadDisabled, onSelectButtonClick)]
|
|
10240
|
+
}), void 0), renderSelectFilesButton(buttonProps, isUploadDisabled, onSelectButtonClick)]
|
|
10189
10241
|
}, void 0);
|
|
10190
10242
|
};
|
|
10191
10243
|
var renderDropzoneContent = function renderDropzoneContent(_a) {
|
|
10192
10244
|
var buttonOnly = _a.buttonOnly,
|
|
10245
|
+
buttonProps = _a.buttonProps,
|
|
10193
10246
|
isDragActive = _a.isDragActive,
|
|
10194
10247
|
isUploadDisabled = _a.isUploadDisabled,
|
|
10195
10248
|
open = _a.open;
|
|
10196
10249
|
if (buttonOnly) {
|
|
10197
|
-
return renderSelectFilesButton(isUploadDisabled, open);
|
|
10250
|
+
return renderSelectFilesButton(buttonProps, isUploadDisabled, open);
|
|
10198
10251
|
} else {
|
|
10199
|
-
return isDragActive ? renderActiveDragArea() : renderDragAndDropArea(isUploadDisabled, open);
|
|
10252
|
+
return isDragActive ? renderActiveDragArea() : renderDragAndDropArea(buttonProps, isUploadDisabled, open);
|
|
10200
10253
|
}
|
|
10201
10254
|
};
|
|
10202
10255
|
var getUploadedFilesList = function getUploadedFilesList(_a) {
|
|
@@ -10268,8 +10321,12 @@
|
|
|
10268
10321
|
ariaLabel = _a.ariaLabel,
|
|
10269
10322
|
_b = _a.ariaRole,
|
|
10270
10323
|
ariaRole = _b === void 0 ? 'region' : _b,
|
|
10271
|
-
_c = _a.
|
|
10272
|
-
|
|
10324
|
+
_c = _a.buttonProps,
|
|
10325
|
+
buttonProps = _c === void 0 ? {
|
|
10326
|
+
label: 'Select file(s)'
|
|
10327
|
+
} : _c,
|
|
10328
|
+
_d = _a.buttonOnly,
|
|
10329
|
+
buttonOnly = _d === void 0 ? false : _d,
|
|
10273
10330
|
className = _a.className,
|
|
10274
10331
|
dataTestId = _a["data-testid"],
|
|
10275
10332
|
disabled = _a.disabled,
|
|
@@ -10279,12 +10336,12 @@
|
|
|
10279
10336
|
onChange = _a.onChange,
|
|
10280
10337
|
onDragEnter = _a.onDragEnter,
|
|
10281
10338
|
onFileClick = _a.onFileClick;
|
|
10282
|
-
var
|
|
10283
|
-
uploadedFiles =
|
|
10284
|
-
setUploadedFiles =
|
|
10285
|
-
var
|
|
10286
|
-
hasMaxFilesError =
|
|
10287
|
-
setHasMaxFilesError =
|
|
10339
|
+
var _e = React.useState([]),
|
|
10340
|
+
uploadedFiles = _e[0],
|
|
10341
|
+
setUploadedFiles = _e[1];
|
|
10342
|
+
var _f = React.useState(false),
|
|
10343
|
+
hasMaxFilesError = _f[0],
|
|
10344
|
+
setHasMaxFilesError = _f[1];
|
|
10288
10345
|
var isUploadDisabled = disabled || maxFiles && uploadedFiles.length >= maxFiles;
|
|
10289
10346
|
var rootClasses = useStylesWithRootClass(rootClassName$6, className, !buttonOnly ? dropZoneClassName : '', isUploadDisabled ? 'disabled' : '');
|
|
10290
10347
|
var maxFilesClasses = useStylesWithRootClass('dot-max-files-message', hasMaxFilesError ? 'dot-max-files-reached' : '');
|
|
@@ -10309,7 +10366,7 @@
|
|
|
10309
10366
|
var onDrop = React.useCallback(function (acceptedFiles, fileRejections) {
|
|
10310
10367
|
hideFilesList ? setNewlyUploadedFiles(acceptedFiles, fileRejections) : parseFiles(acceptedFiles, fileRejections);
|
|
10311
10368
|
}, [hideFilesList, setNewlyUploadedFiles, parseFiles]);
|
|
10312
|
-
var
|
|
10369
|
+
var _g = reactDropzone.useDropzone({
|
|
10313
10370
|
accept: accept,
|
|
10314
10371
|
disabled: isUploadDisabled,
|
|
10315
10372
|
maxSize: maxSize * 1024 * 1024,
|
|
@@ -10318,10 +10375,10 @@
|
|
|
10318
10375
|
onDragEnter: onDragEnter,
|
|
10319
10376
|
onDrop: onDrop
|
|
10320
10377
|
}),
|
|
10321
|
-
getRootProps =
|
|
10322
|
-
getInputProps =
|
|
10323
|
-
isDragActive =
|
|
10324
|
-
open =
|
|
10378
|
+
getRootProps = _g.getRootProps,
|
|
10379
|
+
getInputProps = _g.getInputProps,
|
|
10380
|
+
isDragActive = _g.isDragActive,
|
|
10381
|
+
open = _g.open;
|
|
10325
10382
|
var deleteFile = function deleteFile(fileIndexToBeRemoved) {
|
|
10326
10383
|
uploadedFiles.splice(fileIndexToBeRemoved, 1);
|
|
10327
10384
|
setUploadedFiles(__spreadArray([], uploadedFiles));
|
|
@@ -10343,6 +10400,7 @@
|
|
|
10343
10400
|
"data-testid": dataTestId
|
|
10344
10401
|
}, {
|
|
10345
10402
|
children: [jsxRuntime.jsx("input", __assign({}, getInputProps()), void 0), renderDropzoneContent({
|
|
10403
|
+
buttonProps: buttonProps,
|
|
10346
10404
|
buttonOnly: buttonOnly,
|
|
10347
10405
|
isDragActive: isDragActive,
|
|
10348
10406
|
isUploadDisabled: isUploadDisabled,
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface CopyButtonProps extends
|
|
1
|
+
import { CommonIconButtonProps } from '../button/IconButton';
|
|
2
|
+
export interface CopyButtonProps extends CommonIconButtonProps {
|
|
3
|
+
/** Tooltip shown briefly after the value has been copied. */
|
|
3
4
|
copiedTooltip?: string;
|
|
5
|
+
/** DEPRECATED Use tooltip instead */
|
|
4
6
|
copyTooltip?: string;
|
|
7
|
+
/** The icon to display on the button, defaults to 'duplicate' */
|
|
8
|
+
iconId?: string;
|
|
9
|
+
/** By default a check icon will briefly display after the content is copied */
|
|
10
|
+
showCopiedIcon?: boolean;
|
|
11
|
+
/** The content which will be copied to the clipboard */
|
|
5
12
|
value: string;
|
|
6
13
|
}
|
|
7
|
-
export declare const DotCopyButton: ({ ariaLabel, copiedTooltip, copyTooltip, "data-testid": dataTestId, value, }: CopyButtonProps) => JSX.Element;
|
|
14
|
+
export declare const DotCopyButton: ({ ariaLabel, ariaRole, className, color, copiedTooltip, copyTooltip, "data-testid": dataTestId, disabled, disableRipple, iconId, iconSize, onClick, shape, showCopiedIcon, size, tooltip, value, }: CopyButtonProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { CopyButtonProps } from './CopyButton';
|
|
3
|
-
declare const _default: ComponentMeta<({ ariaLabel, copiedTooltip, copyTooltip, "data-testid": dataTestId, value, }: CopyButtonProps) => JSX.Element>;
|
|
3
|
+
declare const _default: ComponentMeta<({ ariaLabel, ariaRole, className, color, copiedTooltip, copyTooltip, "data-testid": dataTestId, disabled, disableRipple, iconId, iconSize, onClick, shape, showCopiedIcon, size, tooltip, value, }: CopyButtonProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: any;
|
|
@@ -4,15 +4,13 @@ import { IconFontSize } from '../icon/Icon';
|
|
|
4
4
|
export declare type IconButtonColor = 'default' | 'inherit' | 'primary' | 'secondary';
|
|
5
5
|
export declare type IconButtonSize = 'small' | 'medium';
|
|
6
6
|
export declare type IconButtonShape = 'circle' | 'square';
|
|
7
|
-
export interface
|
|
7
|
+
export interface CommonIconButtonProps extends CommonProps {
|
|
8
8
|
/** 'default', 'inherit', 'primary', 'secondary' */
|
|
9
9
|
color?: IconButtonColor;
|
|
10
10
|
/** If true, the ripple effect is disabled. */
|
|
11
11
|
disableRipple?: boolean;
|
|
12
12
|
/** If true, the button will be disabled. */
|
|
13
13
|
disabled?: boolean;
|
|
14
|
-
/** The icon to display on the button */
|
|
15
|
-
iconId: string;
|
|
16
14
|
/** Determines the size of the icon itself and spacing around it */
|
|
17
15
|
iconSize?: IconFontSize;
|
|
18
16
|
/** Event callback */
|
|
@@ -24,4 +22,8 @@ export interface IconButtonProps extends CommonProps {
|
|
|
24
22
|
/** Help text to be displayed on icon hover */
|
|
25
23
|
tooltip?: string;
|
|
26
24
|
}
|
|
25
|
+
export interface IconButtonProps extends CommonIconButtonProps {
|
|
26
|
+
/** The icon to display on the button */
|
|
27
|
+
iconId: string;
|
|
28
|
+
}
|
|
27
29
|
export declare const DotIconButton: ({ ariaLabel, ariaRole, className, color, "data-testid": dataTestId, disabled, disableRipple, iconId, iconSize, onClick, tooltip, shape, size, }: IconButtonProps) => JSX.Element;
|
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
import { CommonProps } from '../CommonProps';
|
|
3
3
|
import { MappedFile } from './utils/models';
|
|
4
4
|
import { ListItemFile } from './FileListItem';
|
|
5
|
+
import { BaseButtonProps } from '../BaseButtonProps';
|
|
6
|
+
interface OmittedButtonProps {
|
|
7
|
+
disabled: unknown;
|
|
8
|
+
isSubmit: unknown;
|
|
9
|
+
onClick: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare type FileUploadButtonProps = Omit<BaseButtonProps, keyof OmittedButtonProps> & {
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
5
14
|
export interface FileUploadProps extends CommonProps {
|
|
6
15
|
/** Unique file type specifiers <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers" target="_blank">More Info</a> */
|
|
7
16
|
accept?: Array<string>;
|
|
8
17
|
/** If true, will only display the button */
|
|
9
18
|
buttonOnly?: boolean;
|
|
19
|
+
/** the file upload button props, not all button props are available */
|
|
20
|
+
buttonProps?: FileUploadButtonProps;
|
|
10
21
|
/** If true, the upload zone will be disabled */
|
|
11
22
|
disabled?: boolean;
|
|
12
23
|
/** If true, upload file list won't be displayed. Used when consumer wants to render his own list. */
|
|
@@ -22,4 +33,5 @@ export interface FileUploadProps extends CommonProps {
|
|
|
22
33
|
/** Optional callback which gets triggered when the file (from the list) is clicked. */
|
|
23
34
|
onFileClick?: (file: ListItemFile) => void;
|
|
24
35
|
}
|
|
25
|
-
export declare const DotFileUpload: ({ accept, ariaLabel, ariaRole, buttonOnly, className, "data-testid": dataTestId, disabled, hideFilesList, maxFiles, maxSize, onChange, onDragEnter, onFileClick, }: FileUploadProps) => JSX.Element;
|
|
36
|
+
export declare const DotFileUpload: ({ accept, ariaLabel, ariaRole, buttonProps, buttonOnly, className, "data-testid": dataTestId, disabled, hideFilesList, maxFiles, maxSize, onChange, onDragEnter, onFileClick, }: FileUploadProps) => JSX.Element;
|
|
37
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { FileUploadProps } from './';
|
|
3
|
-
declare const _default: ComponentMeta<({ accept, ariaLabel, ariaRole, buttonOnly, className, "data-testid": dataTestId, disabled, hideFilesList, maxFiles, maxSize, onChange, onDragEnter, onFileClick, }: FileUploadProps) => JSX.Element>;
|
|
3
|
+
declare const _default: ComponentMeta<({ accept, ariaLabel, ariaRole, buttonProps, buttonOnly, className, "data-testid": dataTestId, disabled, hideFilesList, maxFiles, maxSize, onChange, onDragEnter, onFileClick, }: FileUploadProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: any;
|
|
6
6
|
export declare const WithSingleFileLimit: any;
|
|
7
7
|
export declare const WithCustomFileUploadList: (args: FileUploadProps) => JSX.Element;
|
|
8
8
|
export declare const WithUploadErrors: (args: FileUploadProps) => JSX.Element;
|
|
9
|
+
export declare const WithCustomButtonProps: (args: FileUploadProps) => JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FileRejection } from 'react-dropzone';
|
|
3
3
|
import { DropzoneContentArgs, FileUploadError, ParseListItemArgs, UploadedFilesListArgs } from './models';
|
|
4
|
+
import { FileUploadButtonProps } from '../FileUpload';
|
|
4
5
|
export declare const renderMaxSizeMessage: (maxSizeMB: number) => ReactNode;
|
|
5
6
|
export declare const renderMaxFilesMessage: (maxFiles: number, maxFilesClasses: string) => ReactNode;
|
|
6
|
-
export declare const renderSelectFilesButton: (isUploadDisabled: boolean, onButtonClick: () => void) => ReactNode;
|
|
7
|
+
export declare const renderSelectFilesButton: (buttonProps: FileUploadButtonProps, isUploadDisabled: boolean, onButtonClick: () => void) => ReactNode;
|
|
7
8
|
export declare const renderActiveDragArea: () => ReactNode;
|
|
8
|
-
export declare const renderDragAndDropArea: (isUploadDisabled: boolean, onSelectButtonClick: () => void) => ReactNode;
|
|
9
|
-
export declare const renderDropzoneContent: ({ buttonOnly, isDragActive, isUploadDisabled, open, }: DropzoneContentArgs) => React.ReactNode;
|
|
9
|
+
export declare const renderDragAndDropArea: (buttonProps: FileUploadButtonProps, isUploadDisabled: boolean, onSelectButtonClick: () => void) => ReactNode;
|
|
10
|
+
export declare const renderDropzoneContent: ({ buttonOnly, buttonProps, isDragActive, isUploadDisabled, open, }: DropzoneContentArgs) => React.ReactNode;
|
|
10
11
|
export declare const getUploadedFilesList: ({ maxSize, onFileClick, onFileDelete, uploadedFiles, }: UploadedFilesListArgs) => {
|
|
11
12
|
child: JSX.Element;
|
|
12
13
|
}[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileWithPath } from 'react-dropzone';
|
|
2
2
|
import { ListItemFile } from '../FileListItem';
|
|
3
|
+
import { FileUploadButtonProps } from '../FileUpload';
|
|
3
4
|
export interface FileUploadError {
|
|
4
5
|
code: string;
|
|
5
6
|
message: string;
|
|
@@ -14,6 +15,7 @@ export interface MappedFile {
|
|
|
14
15
|
}
|
|
15
16
|
export interface DropzoneContentArgs {
|
|
16
17
|
buttonOnly: boolean;
|
|
18
|
+
buttonProps: FileUploadButtonProps;
|
|
17
19
|
isDragActive: boolean;
|
|
18
20
|
isUploadDisabled: boolean;
|
|
19
21
|
open: () => void;
|
|
@@ -2,6 +2,8 @@ import { ReactNode, ReactElement, ChangeEvent } from 'react';
|
|
|
2
2
|
import { CommonProps } from '../CommonProps';
|
|
3
3
|
export declare type tooltipPlacement = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
4
4
|
export interface TooltipProps extends CommonProps {
|
|
5
|
+
/** If true, adds an arrow to the tooltip indicating which element it refers to. */
|
|
6
|
+
arrow?: boolean;
|
|
5
7
|
children: ReactElement;
|
|
6
8
|
leaveDelay?: number;
|
|
7
9
|
onClose?: (event: ChangeEvent) => void;
|
|
@@ -9,4 +11,4 @@ export interface TooltipProps extends CommonProps {
|
|
|
9
11
|
placement?: tooltipPlacement;
|
|
10
12
|
title?: ReactNode | string | number;
|
|
11
13
|
}
|
|
12
|
-
export declare const DotTooltip: ({ ariaLabel, ariaRole, children, className, "data-testid": dataTestId, leaveDelay, onClose, open, placement, title, }: TooltipProps) => JSX.Element;
|
|
14
|
+
export declare const DotTooltip: ({ ariaLabel, ariaRole, arrow, children, className, "data-testid": dataTestId, leaveDelay, onClose, open, placement, title, }: TooltipProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Story, ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { TooltipProps } from './Tooltip';
|
|
3
|
-
declare const _default: ComponentMeta<({ ariaLabel, ariaRole, children, className, "data-testid": dataTestId, leaveDelay, onClose, open, placement, title, }: TooltipProps) => JSX.Element>;
|
|
3
|
+
declare const _default: ComponentMeta<({ ariaLabel, ariaRole, arrow, children, className, "data-testid": dataTestId, leaveDelay, onClose, open, placement, title, }: TooltipProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: Story<TooltipProps>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CommonProps } from '../CommonProps';
|
|
2
2
|
export interface TruncateWithTooltipProps extends CommonProps {
|
|
3
|
+
/** If true, adds an arrow to the tooltip indicating which element it refers to. */
|
|
4
|
+
arrow?: boolean;
|
|
3
5
|
charactersLimit?: number;
|
|
4
6
|
label: string;
|
|
5
7
|
width?: number | string;
|
|
6
8
|
}
|
|
7
|
-
export declare const DotTruncateWithTooltip: ({ ariaLabel, charactersLimit, className, "data-testid": dataTestId, label, width, }: TruncateWithTooltipProps) => JSX.Element;
|
|
9
|
+
export declare const DotTruncateWithTooltip: ({ ariaLabel, arrow, charactersLimit, className, "data-testid": dataTestId, label, width, }: TruncateWithTooltipProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { TruncateWithTooltipProps } from './';
|
|
3
|
-
declare const _default: ComponentMeta<({ ariaLabel, charactersLimit, className, "data-testid": dataTestId, label, width, }: TruncateWithTooltipProps) => JSX.Element>;
|
|
3
|
+
declare const _default: ComponentMeta<({ ariaLabel, arrow, charactersLimit, className, "data-testid": dataTestId, label, width, }: TruncateWithTooltipProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Default: any;
|
|
6
6
|
export declare const WithAutoTruncate: any;
|