@digital-ai/dot-components 1.21.1 → 1.21.2
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 +34 -1
- package/index.esm.js +42 -10
- package/index.umd.js +82 -28
- package/lib/components/file-upload/FileListItem.d.ts +4 -2
- package/lib/components/file-upload/FileUpload.stories.data.d.ts +3 -2
- package/lib/components/file-upload/utils/helpers.d.ts +2 -1
- package/lib/components/inline-edit/InlineEdit.d.ts +3 -1
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.21.2](https://github.com/digital-ai/dot-components/tree/1.21.2) (09/09/2022)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/digital-ai/dot-components/compare/2.0.0-rc.1...1.21.2)
|
|
6
|
+
|
|
7
|
+
**Features:**
|
|
8
|
+
|
|
9
|
+
- Add focus state for Inline Edit component [\#1253](https://github.com/digital-ai/dot-components/issues/1253)
|
|
10
|
+
- Support React 18 [\#1173](https://github.com/digital-ai/dot-components/issues/1173)
|
|
11
|
+
- S-87316 Add focus state for Inline Edit [\#1255](https://github.com/digital-ai/dot-components/pull/1255) ([nikolinadapic](https://github.com/nikolinadapic))
|
|
12
|
+
|
|
13
|
+
**Fixed bugs:**
|
|
14
|
+
|
|
15
|
+
- Use of `release-2.0` branch causes `Typography` to use default styling [\#1151](https://github.com/digital-ai/dot-components/issues/1151)
|
|
16
|
+
- D-22241: `DotFileListItem`: fix focus states and expose `onKeyPress` [\#1254](https://github.com/digital-ai/dot-components/pull/1254) ([dmiletic85](https://github.com/dmiletic85))
|
|
17
|
+
|
|
18
|
+
## [2.0.0-rc.1](https://github.com/digital-ai/dot-components/tree/2.0.0-rc.1) (08/31/2022)
|
|
19
|
+
|
|
20
|
+
[Full Changelog](https://github.com/digital-ai/dot-components/compare/1.21.1...2.0.0-rc.1)
|
|
21
|
+
|
|
22
|
+
**Fixed bugs:**
|
|
23
|
+
|
|
24
|
+
- S-86692: component cleanup [\#1238](https://github.com/digital-ai/dot-components/pull/1238) ([CWSites](https://github.com/CWSites))
|
|
25
|
+
- S-84151: fix e2e tests for Release 2.0 [\#1146](https://github.com/digital-ai/dot-components/pull/1146) ([CWSites](https://github.com/CWSites))
|
|
26
|
+
|
|
27
|
+
**Merged pull requests:**
|
|
28
|
+
|
|
29
|
+
- Release Candidate Workflow [\#1251](https://github.com/digital-ai/dot-components/pull/1251) ([CWSites](https://github.com/CWSites))
|
|
30
|
+
- S-85001: add support for react 18 [\#1244](https://github.com/digital-ai/dot-components/pull/1244) ([CWSites](https://github.com/CWSites))
|
|
31
|
+
- S-86694: Extract agility theme [\#1242](https://github.com/digital-ai/dot-components/pull/1242) ([CWSites](https://github.com/CWSites))
|
|
32
|
+
|
|
3
33
|
## [1.21.1](https://github.com/digital-ai/dot-components/tree/1.21.1) (08/31/2022)
|
|
4
34
|
|
|
5
35
|
[Full Changelog](https://github.com/digital-ai/dot-components/compare/1.21.0...1.21.1)
|
|
@@ -131,7 +161,6 @@
|
|
|
131
161
|
|
|
132
162
|
- Sidebar drawer/expanded does not have a data-testid prop supplied [\#1162](https://github.com/digital-ai/dot-components/issues/1162)
|
|
133
163
|
- D-21245: make sure `data-testid` is passed to nested lists [\#1182](https://github.com/digital-ai/dot-components/pull/1182) ([CWSites](https://github.com/CWSites))
|
|
134
|
-
- D-21267: adjust color of helper text [\#1174](https://github.com/digital-ai/dot-components/pull/1174) ([CWSites](https://github.com/CWSites))
|
|
135
164
|
|
|
136
165
|
## [1.17.1](https://github.com/digital-ai/dot-components/tree/1.17.1) (05/19/2022)
|
|
137
166
|
|
|
@@ -142,6 +171,10 @@
|
|
|
142
171
|
- `DotButtonToggle`: Button size is not respected after tooltip change [\#1170](https://github.com/digital-ai/dot-components/issues/1170)
|
|
143
172
|
- D-21287: `DotButtonToggle`: Button size is not respected after tooltip change [\#1171](https://github.com/digital-ai/dot-components/pull/1171) ([dmiletic85](https://github.com/dmiletic85))
|
|
144
173
|
|
|
174
|
+
**Merged pull requests:**
|
|
175
|
+
|
|
176
|
+
- S-84160: `InputText` and `InputSelect` fields e2e [\#1177](https://github.com/digital-ai/dot-components/pull/1177) ([CWSites](https://github.com/CWSites))
|
|
177
|
+
|
|
145
178
|
## [1.17.0](https://github.com/digital-ai/dot-components/tree/1.17.0) (05/18/2022)
|
|
146
179
|
|
|
147
180
|
[Full Changelog](https://github.com/digital-ai/dot-components/compare/1.16.1...1.17.0)
|
package/index.esm.js
CHANGED
|
@@ -83,7 +83,8 @@ const DotIcon = ({
|
|
|
83
83
|
fontSize: _fontSize === 'small' ? _fontSize : 'medium'
|
|
84
84
|
}, {
|
|
85
85
|
children: jsx("i", {
|
|
86
|
-
className: `icon-${iconId} dot-i
|
|
86
|
+
className: `icon-${iconId} dot-i`,
|
|
87
|
+
"data-testid": dataTestId && `${dataTestId}-i`
|
|
87
88
|
}, void 0)
|
|
88
89
|
}), void 0)
|
|
89
90
|
}), void 0);
|
|
@@ -6105,7 +6106,7 @@ const StyledInlineEdit = styled.div.withConfig({
|
|
|
6105
6106
|
})(["", ""], ({
|
|
6106
6107
|
theme,
|
|
6107
6108
|
fullWidth
|
|
6108
|
-
}) => css(["&.dot-inline-edit{display:", ";align-items:center;color:", ";min-width:", "px;.", "{display:flex;width:100%;position:relative;.dot-edit-icon{height:100%;position:absolute;right:0;width:40px;background-color:", ";border-radius:", ";display:none;.dot-i{margin:0;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}}&:not(.", "):hover{border-radius:", "px;background-color:", ";cursor:pointer;.dot-edit-icon{display:block;}}.dot-view-mode-typography{padding:", ";margin-bottom:0;}}.dot-empty-value fieldset{border-color:", ";}.dot-adornment-error{color:", ";}.MuiInputBase-input{height:auto;}.MuiInputBase-root{margin-bottom:", "px;}", " .", " .dot-input{padding-left:", "px;}.MuiOutlinedInput-input:focus{cursor:auto;}.dot-counter-adornment{.dot-counter-max-length{color:", ";}.dot-counter-length,.dot-counter-max-length{&.dot-counter-limit{color:", ";}}}.dot-read-only-adornment{display:none;}.", "{display:flex;align-items:center;margin:", ";.dot-button{padding:", "px;margin-top:", ";margin-bottom:", ";}}}"], fullWidth ? 'flex' : 'inline-flex', theme.palette.grey[700], theme.spacing(32), viewModeClassName, theme.palette.layer.n50, theme.spacing(0, 0.5, 0.5, 0), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, theme.spacing(1.3125, 1), theme.palette.error[500], theme.palette.error[500], theme.spacing(0), ({
|
|
6109
|
+
}) => css(["&.dot-inline-edit{display:", ";align-items:center;color:", ";min-width:", "px;&:not(.", "):focus-visible{border-radius:", "px;background-color:", ";cursor:pointer;outline:0;.dot-edit-icon{display:block;}}.", "{display:flex;width:100%;position:relative;.dot-edit-icon{height:100%;position:absolute;right:0;width:40px;background-color:", ";border-radius:", ";display:none;.dot-i{margin:0;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}}&:not(.", "):hover{border-radius:", "px;background-color:", ";cursor:pointer;.dot-edit-icon{display:block;}}.dot-view-mode-typography{padding:", ";margin-bottom:0;}}.dot-empty-value fieldset{border-color:", ";}.dot-adornment-error{color:", ";}.MuiInputBase-input{height:auto;}.MuiInputBase-root{margin-bottom:", "px;}", " .", " .dot-input{padding-left:", "px;}.MuiOutlinedInput-input:focus{cursor:auto;}.dot-counter-adornment{.dot-counter-max-length{color:", ";}.dot-counter-length,.dot-counter-max-length{&.dot-counter-limit{color:", ";}}}.dot-read-only-adornment{display:none;}.", "{display:flex;align-items:center;margin:", ";.dot-button{padding:", "px;margin-top:", ";margin-bottom:", ";}}}"], fullWidth ? 'flex' : 'inline-flex', theme.palette.grey[700], theme.spacing(32), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, viewModeClassName, theme.palette.layer.n50, theme.spacing(0, 0.5, 0.5, 0), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, theme.spacing(1.3125, 1), theme.palette.error[500], theme.palette.error[500], theme.spacing(0), ({
|
|
6109
6110
|
typography
|
|
6110
6111
|
}) => typography && `
|
|
6111
6112
|
.MuiInputBase-root {
|
|
@@ -6207,18 +6208,27 @@ const DotInlineEdit = ({
|
|
|
6207
6208
|
onEditStateChange,
|
|
6208
6209
|
readOnly,
|
|
6209
6210
|
selectTextOnEdit,
|
|
6211
|
+
tabIndex: _tabIndex = 0,
|
|
6210
6212
|
tooltip,
|
|
6211
6213
|
typography: _typography = 'body1',
|
|
6212
6214
|
value: _value = ''
|
|
6213
6215
|
}) => {
|
|
6214
6216
|
const [editing, setEditing] = useState(false);
|
|
6217
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
6215
6218
|
const [originalValue, setOriginalValue] = useState('');
|
|
6216
6219
|
const [inputValue, setInputValue] = useState(_value);
|
|
6220
|
+
const isNotReadOnlyOrEditing = !readOnly && !editing;
|
|
6217
6221
|
const inputRef = useRef();
|
|
6218
6222
|
const inlineEditRef = useRef();
|
|
6219
6223
|
const isSaveDisabled = checkIfEmptyValue(inputValue);
|
|
6220
6224
|
const rootClasses = useStylesWithRootClass(rootClassName$n, className, editing ? editModeClassName : '');
|
|
6221
6225
|
|
|
6226
|
+
const handleShowTooltip = visible => {
|
|
6227
|
+
if (isNotReadOnlyOrEditing) {
|
|
6228
|
+
setShowTooltip(visible);
|
|
6229
|
+
}
|
|
6230
|
+
};
|
|
6231
|
+
|
|
6222
6232
|
const handleInlineEditClick = () => {
|
|
6223
6233
|
if (editing) return;
|
|
6224
6234
|
setOriginalValue(inputValue);
|
|
@@ -6232,6 +6242,7 @@ const DotInlineEdit = ({
|
|
|
6232
6242
|
const handleSave = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
6233
6243
|
var _a;
|
|
6234
6244
|
|
|
6245
|
+
setShowTooltip(false);
|
|
6235
6246
|
if (isSaveDisabled) return;
|
|
6236
6247
|
|
|
6237
6248
|
if (onChange) {
|
|
@@ -6251,6 +6262,7 @@ const DotInlineEdit = ({
|
|
|
6251
6262
|
});
|
|
6252
6263
|
|
|
6253
6264
|
const handleCancel = () => {
|
|
6265
|
+
setShowTooltip(false);
|
|
6254
6266
|
setEditing(false);
|
|
6255
6267
|
setInputValue(originalValue);
|
|
6256
6268
|
|
|
@@ -6262,7 +6274,12 @@ const DotInlineEdit = ({
|
|
|
6262
6274
|
const handleKeyPress = event => __awaiter(void 0, void 0, void 0, function* () {
|
|
6263
6275
|
switch (event.key) {
|
|
6264
6276
|
case 'Enter':
|
|
6265
|
-
|
|
6277
|
+
if (!editing) {
|
|
6278
|
+
handleInlineEditClick();
|
|
6279
|
+
return;
|
|
6280
|
+
} // Save only when Enter is pressed within input field
|
|
6281
|
+
|
|
6282
|
+
|
|
6266
6283
|
if (inputRef.current !== event.target) return;
|
|
6267
6284
|
yield handleSave();
|
|
6268
6285
|
break;
|
|
@@ -6274,8 +6291,12 @@ const DotInlineEdit = ({
|
|
|
6274
6291
|
});
|
|
6275
6292
|
|
|
6276
6293
|
const handleBlur = event => __awaiter(void 0, void 0, void 0, function* () {
|
|
6277
|
-
if (!
|
|
6278
|
-
|
|
6294
|
+
if (!editing) {
|
|
6295
|
+
setShowTooltip(false);
|
|
6296
|
+
} else {
|
|
6297
|
+
if (!event.relatedTarget || !inlineEditRef.current.contains(event.relatedTarget)) {
|
|
6298
|
+
yield handleSave();
|
|
6299
|
+
}
|
|
6279
6300
|
}
|
|
6280
6301
|
});
|
|
6281
6302
|
|
|
@@ -6309,7 +6330,8 @@ const DotInlineEdit = ({
|
|
|
6309
6330
|
return tooltip ? jsx(DotTooltip, Object.assign({
|
|
6310
6331
|
title: tooltip,
|
|
6311
6332
|
className: viewModeClasses,
|
|
6312
|
-
"data-testid": dataTestId && `${dataTestId}-view-mode-tooltip-wrapper
|
|
6333
|
+
"data-testid": dataTestId && `${dataTestId}-view-mode-tooltip-wrapper`,
|
|
6334
|
+
open: showTooltip
|
|
6313
6335
|
}, {
|
|
6314
6336
|
children: viewModeChildren
|
|
6315
6337
|
}), void 0) : jsx("div", Object.assign({
|
|
@@ -6381,10 +6403,14 @@ const DotInlineEdit = ({
|
|
|
6381
6403
|
className: rootClasses,
|
|
6382
6404
|
"data-testid": dataTestId,
|
|
6383
6405
|
fullWidth: _fullWidth,
|
|
6384
|
-
onBlur: !readOnly
|
|
6406
|
+
onBlur: !readOnly ? handleBlur : undefined,
|
|
6385
6407
|
onClick: !readOnly ? handleInlineEditClick : undefined,
|
|
6408
|
+
onFocus: () => handleShowTooltip(true),
|
|
6409
|
+
onMouseOver: () => handleShowTooltip(true),
|
|
6410
|
+
onMouseOut: () => handleShowTooltip(false),
|
|
6386
6411
|
onKeyDown: !readOnly ? event => handleKeyPress(event) : undefined,
|
|
6387
6412
|
ref: inlineEditRef,
|
|
6413
|
+
tabIndex: !readOnly ? _tabIndex : undefined,
|
|
6388
6414
|
typography: _typography
|
|
6389
6415
|
}, {
|
|
6390
6416
|
children: editing ? renderEditMode() : renderViewMode()
|
|
@@ -7993,7 +8019,7 @@ const StyledFileListItem = styled(StyledListItem).withConfig({
|
|
|
7993
8019
|
componentId: "sc-6mp1tz-0"
|
|
7994
8020
|
})(["", ""], ({
|
|
7995
8021
|
theme
|
|
7996
|
-
}) => css(["&.", "{border-bottom:1px solid ", ";&:hover{cursor:pointer;background:", ";}&.file-success:not(:hover)
|
|
8022
|
+
}) => css(["&.", "{border-bottom:1px solid ", ";&:hover{cursor:pointer;background:", ";}&:focus-visible{background-color:", ";outline:none;}&.file-success:not(:hover,:focus-visible) .", "-end-icon{i:before{color:", ";}&:focus-visible i:before{color:unset;}}&.file-error:not(:hover,:focus-visible) .", "-end-icon{i:before,.MuiListItemText-secondary{color:", ";}&:focus-visible i:before{color:unset;}}.dot-typography,.file-item-text{flex-grow:2;padding-left:", "px;}.file-item-text{display:flex;flex-direction:column;.MuiTypography-body2{color:", ";}}}"], rootClassName$4, theme.palette.layer.n100, theme.palette.layer.n50, theme.palette.layer.n100, rootClassName$4, theme.palette.secondary.main, rootClassName$4, theme.palette.error.main, theme.spacing(1), theme.palette.error.main));
|
|
7997
8023
|
|
|
7998
8024
|
const DotFileListItem = ({
|
|
7999
8025
|
ariaLabel,
|
|
@@ -8004,7 +8030,9 @@ const DotFileListItem = ({
|
|
|
8004
8030
|
error: _error = false,
|
|
8005
8031
|
errorText,
|
|
8006
8032
|
file,
|
|
8007
|
-
onClick
|
|
8033
|
+
onClick,
|
|
8034
|
+
onKeyPress,
|
|
8035
|
+
tabIndex: _tabIndex = 0
|
|
8008
8036
|
}) => {
|
|
8009
8037
|
const rootClasses = useStylesWithRootClass(rootClassName$4, className, _error ? 'file-error' : 'file-success');
|
|
8010
8038
|
const defaultIcon = _error ? 'error-solid' : 'check-solid';
|
|
@@ -8021,9 +8049,13 @@ const DotFileListItem = ({
|
|
|
8021
8049
|
"aria-label": ariaLabel,
|
|
8022
8050
|
className: rootClasses,
|
|
8023
8051
|
"data-testid": dataTestId,
|
|
8052
|
+
onBlur: () => setEndIcon(defaultIcon),
|
|
8024
8053
|
onClick: handleItemClick(file),
|
|
8054
|
+
onFocus: () => setEndIcon('delete'),
|
|
8025
8055
|
onMouseEnter: () => setEndIcon('delete'),
|
|
8026
|
-
onMouseLeave: () => setEndIcon(defaultIcon)
|
|
8056
|
+
onMouseLeave: () => setEndIcon(defaultIcon),
|
|
8057
|
+
onKeyPress: onKeyPress,
|
|
8058
|
+
tabIndex: _tabIndex
|
|
8027
8059
|
}, {
|
|
8028
8060
|
children: [jsx(DotIcon, {
|
|
8029
8061
|
"data-testid": dataTestId && `${dataTestId}-start-icon`,
|
package/index.umd.js
CHANGED
|
@@ -202,7 +202,8 @@
|
|
|
202
202
|
fontSize: fontSize === 'small' ? fontSize : 'medium'
|
|
203
203
|
}, {
|
|
204
204
|
children: jsxRuntime.jsx("i", {
|
|
205
|
-
className: "icon-" + iconId + " dot-i"
|
|
205
|
+
className: "icon-" + iconId + " dot-i",
|
|
206
|
+
"data-testid": dataTestId && dataTestId + "-i"
|
|
206
207
|
}, void 0)
|
|
207
208
|
}), void 0)
|
|
208
209
|
}), void 0);
|
|
@@ -6516,7 +6517,7 @@
|
|
|
6516
6517
|
})(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
6517
6518
|
var theme = _a.theme,
|
|
6518
6519
|
fullWidth = _a.fullWidth;
|
|
6519
|
-
return styled.css(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n &.dot-inline-edit {\n display: ", ";\n align-items: center;\n color: ", ";\n min-width: ", "px;\n\n .", " {\n display: flex;\n width: 100%;\n position: relative;\n\n .dot-edit-icon {\n height: 100%;\n position: absolute;\n right: 0;\n width: 40px;\n background-color: ", ";\n border-radius: ", ";\n display: none;\n\n .dot-i {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n\n // Display pointer and edit icon only when NOT in read only mode\n &:not(.", "):hover {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .dot-view-mode-typography {\n padding: ", ";\n margin-bottom: 0;\n }\n }\n\n .dot-empty-value fieldset {\n border-color: ", ";\n }\n\n .dot-adornment-error {\n color: ", ";\n }\n\n .MuiInputBase-input {\n height: auto;\n }\n\n .MuiInputBase-root {\n margin-bottom: ", "px;\n }\n\n /* Conditionally setting font related props */\n ", "\n\n .", " .dot-input {\n padding-left: ", "px;\n }\n\n .MuiOutlinedInput-input:focus {\n cursor: auto;\n }\n\n .dot-counter-adornment {\n .dot-counter-max-length {\n color: ", ";\n }\n\n .dot-counter-length,\n .dot-counter-max-length {\n &.dot-counter-limit {\n color: ", ";\n }\n }\n }\n\n .dot-read-only-adornment {\n display: none;\n }\n\n .", " {\n display: flex;\n align-items: center;\n margin: ", ";\n\n .dot-button {\n padding: ", "px;\n margin-top: ", ";\n margin-bottom: ", ";\n }\n }\n }\n "], ["\n &.dot-inline-edit {\n display: ", ";\n align-items: center;\n color: ", ";\n min-width: ", "px;\n\n .", " {\n display: flex;\n width: 100%;\n position: relative;\n\n .dot-edit-icon {\n height: 100%;\n position: absolute;\n right: 0;\n width: 40px;\n background-color: ", ";\n border-radius: ", ";\n display: none;\n\n .dot-i {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n\n // Display pointer and edit icon only when NOT in read only mode\n &:not(.", "):hover {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .dot-view-mode-typography {\n padding: ", ";\n margin-bottom: 0;\n }\n }\n\n .dot-empty-value fieldset {\n border-color: ", ";\n }\n\n .dot-adornment-error {\n color: ", ";\n }\n\n .MuiInputBase-input {\n height: auto;\n }\n\n .MuiInputBase-root {\n margin-bottom: ", "px;\n }\n\n /* Conditionally setting font related props */\n ", "\n\n .", " .dot-input {\n padding-left: ", "px;\n }\n\n .MuiOutlinedInput-input:focus {\n cursor: auto;\n }\n\n .dot-counter-adornment {\n .dot-counter-max-length {\n color: ", ";\n }\n\n .dot-counter-length,\n .dot-counter-max-length {\n &.dot-counter-limit {\n color: ", ";\n }\n }\n }\n\n .dot-read-only-adornment {\n display: none;\n }\n\n .", " {\n display: flex;\n align-items: center;\n margin: ", ";\n\n .dot-button {\n padding: ", "px;\n margin-top: ", ";\n margin-bottom: ", ";\n }\n }\n }\n "])), fullWidth ? 'flex' : 'inline-flex', theme.palette.grey[700], theme.spacing(32), viewModeClassName, theme.palette.layer.n50, theme.spacing(0, 0.5, 0.5, 0), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, theme.spacing(1.3125, 1), theme.palette.error[500], theme.palette.error[500], theme.spacing(0), function (_a) {
|
|
6520
|
+
return styled.css(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n &.dot-inline-edit {\n display: ", ";\n align-items: center;\n color: ", ";\n min-width: ", "px;\n\n &:not(.", "):focus-visible {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n outline: 0;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .", " {\n display: flex;\n width: 100%;\n position: relative;\n\n .dot-edit-icon {\n height: 100%;\n position: absolute;\n right: 0;\n width: 40px;\n background-color: ", ";\n border-radius: ", ";\n display: none;\n\n .dot-i {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n\n // Display pointer and edit icon only when NOT in read only mode\n &:not(.", "):hover {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .dot-view-mode-typography {\n padding: ", ";\n margin-bottom: 0;\n }\n }\n\n .dot-empty-value fieldset {\n border-color: ", ";\n }\n\n .dot-adornment-error {\n color: ", ";\n }\n\n .MuiInputBase-input {\n height: auto;\n }\n\n .MuiInputBase-root {\n margin-bottom: ", "px;\n }\n\n /* Conditionally setting font related props */\n ", "\n\n .", " .dot-input {\n padding-left: ", "px;\n }\n\n .MuiOutlinedInput-input:focus {\n cursor: auto;\n }\n\n .dot-counter-adornment {\n .dot-counter-max-length {\n color: ", ";\n }\n\n .dot-counter-length,\n .dot-counter-max-length {\n &.dot-counter-limit {\n color: ", ";\n }\n }\n }\n\n .dot-read-only-adornment {\n display: none;\n }\n\n .", " {\n display: flex;\n align-items: center;\n margin: ", ";\n\n .dot-button {\n padding: ", "px;\n margin-top: ", ";\n margin-bottom: ", ";\n }\n }\n }\n "], ["\n &.dot-inline-edit {\n display: ", ";\n align-items: center;\n color: ", ";\n min-width: ", "px;\n\n &:not(.", "):focus-visible {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n outline: 0;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .", " {\n display: flex;\n width: 100%;\n position: relative;\n\n .dot-edit-icon {\n height: 100%;\n position: absolute;\n right: 0;\n width: 40px;\n background-color: ", ";\n border-radius: ", ";\n display: none;\n\n .dot-i {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n\n // Display pointer and edit icon only when NOT in read only mode\n &:not(.", "):hover {\n border-radius: ", "px;\n background-color: ", ";\n cursor: pointer;\n\n .dot-edit-icon {\n display: block;\n }\n }\n\n .dot-view-mode-typography {\n padding: ", ";\n margin-bottom: 0;\n }\n }\n\n .dot-empty-value fieldset {\n border-color: ", ";\n }\n\n .dot-adornment-error {\n color: ", ";\n }\n\n .MuiInputBase-input {\n height: auto;\n }\n\n .MuiInputBase-root {\n margin-bottom: ", "px;\n }\n\n /* Conditionally setting font related props */\n ", "\n\n .", " .dot-input {\n padding-left: ", "px;\n }\n\n .MuiOutlinedInput-input:focus {\n cursor: auto;\n }\n\n .dot-counter-adornment {\n .dot-counter-max-length {\n color: ", ";\n }\n\n .dot-counter-length,\n .dot-counter-max-length {\n &.dot-counter-limit {\n color: ", ";\n }\n }\n }\n\n .dot-read-only-adornment {\n display: none;\n }\n\n .", " {\n display: flex;\n align-items: center;\n margin: ", ";\n\n .dot-button {\n padding: ", "px;\n margin-top: ", ";\n margin-bottom: ", ";\n }\n }\n }\n "])), fullWidth ? 'flex' : 'inline-flex', theme.palette.grey[700], theme.spacing(32), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, viewModeClassName, theme.palette.layer.n50, theme.spacing(0, 0.5, 0.5, 0), readOnlyClassName, theme.spacing(0.5), theme.palette.layer.n50, theme.spacing(1.3125, 1), theme.palette.error[500], theme.palette.error[500], theme.spacing(0), function (_a) {
|
|
6520
6521
|
var typography = _a.typography;
|
|
6521
6522
|
return typography && "\n .MuiInputBase-root {\n font-family: " + (theme.typography[typography].fontFamily || 'inherit') + ";\n font-size: " + theme.typography[typography].fontSize + "px;\n line-height: " + (theme.typography[typography].lineHeight || 'normal') + ";\n letter-spacing: " + (theme.typography[typography].letterSpacing || 'normal') + ";\n text-transform: " + (theme.typography[typography].textTransform || 'none') + ";\n }\n ";
|
|
6522
6523
|
}, editTextFieldClassName, theme.spacing(1), theme.palette.layer.n400, theme.palette.error[500], editActionsClassName, theme.spacing(0, 0, 0, 0.5), theme.spacing(0.75), theme.spacing(0), theme.spacing(0));
|
|
@@ -6615,29 +6616,42 @@
|
|
|
6615
6616
|
onEditStateChange = _a.onEditStateChange,
|
|
6616
6617
|
readOnly = _a.readOnly,
|
|
6617
6618
|
selectTextOnEdit = _a.selectTextOnEdit,
|
|
6619
|
+
_c = _a.tabIndex,
|
|
6620
|
+
tabIndex = _c === void 0 ? 0 : _c,
|
|
6618
6621
|
tooltip = _a.tooltip,
|
|
6619
|
-
|
|
6620
|
-
typography =
|
|
6621
|
-
|
|
6622
|
-
value =
|
|
6622
|
+
_d = _a.typography,
|
|
6623
|
+
typography = _d === void 0 ? 'body1' : _d,
|
|
6624
|
+
_e = _a.value,
|
|
6625
|
+
value = _e === void 0 ? '' : _e;
|
|
6623
6626
|
|
|
6624
|
-
var
|
|
6625
|
-
editing =
|
|
6626
|
-
setEditing =
|
|
6627
|
+
var _f = React.useState(false),
|
|
6628
|
+
editing = _f[0],
|
|
6629
|
+
setEditing = _f[1];
|
|
6630
|
+
|
|
6631
|
+
var _g = React.useState(false),
|
|
6632
|
+
showTooltip = _g[0],
|
|
6633
|
+
setShowTooltip = _g[1];
|
|
6627
6634
|
|
|
6628
|
-
var
|
|
6629
|
-
originalValue =
|
|
6630
|
-
setOriginalValue =
|
|
6635
|
+
var _h = React.useState(''),
|
|
6636
|
+
originalValue = _h[0],
|
|
6637
|
+
setOriginalValue = _h[1];
|
|
6631
6638
|
|
|
6632
|
-
var
|
|
6633
|
-
inputValue =
|
|
6634
|
-
setInputValue =
|
|
6639
|
+
var _j = React.useState(value),
|
|
6640
|
+
inputValue = _j[0],
|
|
6641
|
+
setInputValue = _j[1];
|
|
6635
6642
|
|
|
6643
|
+
var isNotReadOnlyOrEditing = !readOnly && !editing;
|
|
6636
6644
|
var inputRef = React.useRef();
|
|
6637
6645
|
var inlineEditRef = React.useRef();
|
|
6638
6646
|
var isSaveDisabled = checkIfEmptyValue(inputValue);
|
|
6639
6647
|
var rootClasses = useStylesWithRootClass(rootClassName$n, className, editing ? editModeClassName : '');
|
|
6640
6648
|
|
|
6649
|
+
var handleShowTooltip = function handleShowTooltip(visible) {
|
|
6650
|
+
if (isNotReadOnlyOrEditing) {
|
|
6651
|
+
setShowTooltip(visible);
|
|
6652
|
+
}
|
|
6653
|
+
};
|
|
6654
|
+
|
|
6641
6655
|
var handleInlineEditClick = function handleInlineEditClick() {
|
|
6642
6656
|
if (editing) return;
|
|
6643
6657
|
setOriginalValue(inputValue);
|
|
@@ -6657,6 +6671,7 @@
|
|
|
6657
6671
|
return __generator(this, function (_b) {
|
|
6658
6672
|
switch (_b.label) {
|
|
6659
6673
|
case 0:
|
|
6674
|
+
setShowTooltip(false);
|
|
6660
6675
|
if (isSaveDisabled) return [2
|
|
6661
6676
|
/*return*/
|
|
6662
6677
|
];
|
|
@@ -6695,6 +6710,7 @@
|
|
|
6695
6710
|
};
|
|
6696
6711
|
|
|
6697
6712
|
var handleCancel = function handleCancel() {
|
|
6713
|
+
setShowTooltip(false);
|
|
6698
6714
|
setEditing(false);
|
|
6699
6715
|
setInputValue(originalValue);
|
|
6700
6716
|
|
|
@@ -6729,7 +6745,14 @@
|
|
|
6729
6745
|
, 4];
|
|
6730
6746
|
|
|
6731
6747
|
case 1:
|
|
6732
|
-
|
|
6748
|
+
if (!editing) {
|
|
6749
|
+
handleInlineEditClick();
|
|
6750
|
+
return [2
|
|
6751
|
+
/*return*/
|
|
6752
|
+
];
|
|
6753
|
+
} // Save only when Enter is pressed within input field
|
|
6754
|
+
|
|
6755
|
+
|
|
6733
6756
|
if (inputRef.current !== event.target) return [2
|
|
6734
6757
|
/*return*/
|
|
6735
6758
|
];
|
|
@@ -6764,19 +6787,28 @@
|
|
|
6764
6787
|
return __generator(this, function (_a) {
|
|
6765
6788
|
switch (_a.label) {
|
|
6766
6789
|
case 0:
|
|
6790
|
+
if (!!editing) return [3
|
|
6791
|
+
/*break*/
|
|
6792
|
+
, 1];
|
|
6793
|
+
setShowTooltip(false);
|
|
6794
|
+
return [3
|
|
6795
|
+
/*break*/
|
|
6796
|
+
, 3];
|
|
6797
|
+
|
|
6798
|
+
case 1:
|
|
6767
6799
|
if (!(!event.relatedTarget || !inlineEditRef.current.contains(event.relatedTarget))) return [3
|
|
6768
6800
|
/*break*/
|
|
6769
|
-
,
|
|
6801
|
+
, 3];
|
|
6770
6802
|
return [4
|
|
6771
6803
|
/*yield*/
|
|
6772
6804
|
, handleSave()];
|
|
6773
6805
|
|
|
6774
|
-
case
|
|
6806
|
+
case 2:
|
|
6775
6807
|
_a.sent();
|
|
6776
6808
|
|
|
6777
|
-
_a.label =
|
|
6809
|
+
_a.label = 3;
|
|
6778
6810
|
|
|
6779
|
-
case
|
|
6811
|
+
case 3:
|
|
6780
6812
|
return [2
|
|
6781
6813
|
/*return*/
|
|
6782
6814
|
];
|
|
@@ -6815,7 +6847,8 @@
|
|
|
6815
6847
|
return tooltip ? jsxRuntime.jsx(DotTooltip, __assign({
|
|
6816
6848
|
title: tooltip,
|
|
6817
6849
|
className: viewModeClasses,
|
|
6818
|
-
"data-testid": dataTestId && dataTestId + "-view-mode-tooltip-wrapper"
|
|
6850
|
+
"data-testid": dataTestId && dataTestId + "-view-mode-tooltip-wrapper",
|
|
6851
|
+
open: showTooltip
|
|
6819
6852
|
}, {
|
|
6820
6853
|
children: viewModeChildren
|
|
6821
6854
|
}), void 0) : jsxRuntime.jsx("div", __assign({
|
|
@@ -6891,12 +6924,22 @@
|
|
|
6891
6924
|
className: rootClasses,
|
|
6892
6925
|
"data-testid": dataTestId,
|
|
6893
6926
|
fullWidth: fullWidth,
|
|
6894
|
-
onBlur: !readOnly
|
|
6927
|
+
onBlur: !readOnly ? handleBlur : undefined,
|
|
6895
6928
|
onClick: !readOnly ? handleInlineEditClick : undefined,
|
|
6929
|
+
onFocus: function () {
|
|
6930
|
+
return handleShowTooltip(true);
|
|
6931
|
+
},
|
|
6932
|
+
onMouseOver: function () {
|
|
6933
|
+
return handleShowTooltip(true);
|
|
6934
|
+
},
|
|
6935
|
+
onMouseOut: function () {
|
|
6936
|
+
return handleShowTooltip(false);
|
|
6937
|
+
},
|
|
6896
6938
|
onKeyDown: !readOnly ? function (event) {
|
|
6897
6939
|
return handleKeyPress(event);
|
|
6898
6940
|
} : undefined,
|
|
6899
6941
|
ref: inlineEditRef,
|
|
6942
|
+
tabIndex: !readOnly ? tabIndex : undefined,
|
|
6900
6943
|
typography: typography
|
|
6901
6944
|
}, {
|
|
6902
6945
|
children: editing ? renderEditMode() : renderViewMode()
|
|
@@ -8674,7 +8717,7 @@
|
|
|
8674
8717
|
componentId: "sc-6mp1tz-0"
|
|
8675
8718
|
})(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
8676
8719
|
var theme = _a.theme;
|
|
8677
|
-
return styled.css(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n &.", " {\n border-bottom: 1px solid ", ";\n &:hover {\n cursor: pointer;\n background: ", ";\n }\n\n &.file-success:not(:hover)
|
|
8720
|
+
return styled.css(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n &.", " {\n border-bottom: 1px solid ", ";\n &:hover {\n cursor: pointer;\n background: ", ";\n }\n\n &:focus-visible {\n background-color: ", ";\n outline: none;\n }\n\n &.file-success:not(:hover, :focus-visible) .", "-end-icon {\n i:before {\n color: ", ";\n }\n\n &:focus-visible i:before {\n color: unset;\n }\n }\n\n &.file-error:not(:hover, :focus-visible) .", "-end-icon {\n i:before,\n .MuiListItemText-secondary {\n color: ", ";\n }\n\n &:focus-visible i:before {\n color: unset;\n }\n }\n\n .dot-typography,\n .file-item-text {\n flex-grow: 2;\n padding-left: ", "px;\n }\n\n .file-item-text {\n display: flex;\n flex-direction: column;\n\n .MuiTypography-body2 {\n color: ", ";\n }\n }\n }\n "], ["\n &.", " {\n border-bottom: 1px solid ", ";\n &:hover {\n cursor: pointer;\n background: ", ";\n }\n\n &:focus-visible {\n background-color: ", ";\n outline: none;\n }\n\n &.file-success:not(:hover, :focus-visible) .", "-end-icon {\n i:before {\n color: ", ";\n }\n\n &:focus-visible i:before {\n color: unset;\n }\n }\n\n &.file-error:not(:hover, :focus-visible) .", "-end-icon {\n i:before,\n .MuiListItemText-secondary {\n color: ", ";\n }\n\n &:focus-visible i:before {\n color: unset;\n }\n }\n\n .dot-typography,\n .file-item-text {\n flex-grow: 2;\n padding-left: ", "px;\n }\n\n .file-item-text {\n display: flex;\n flex-direction: column;\n\n .MuiTypography-body2 {\n color: ", ";\n }\n }\n }\n "])), rootClassName$4, theme.palette.layer.n100, theme.palette.layer.n50, theme.palette.layer.n100, rootClassName$4, theme.palette.secondary.main, rootClassName$4, theme.palette.error.main, theme.spacing(1), theme.palette.error.main);
|
|
8678
8721
|
});
|
|
8679
8722
|
var templateObject_1$4, templateObject_2$4;
|
|
8680
8723
|
|
|
@@ -8688,13 +8731,16 @@
|
|
|
8688
8731
|
error = _b === void 0 ? false : _b,
|
|
8689
8732
|
errorText = _a.errorText,
|
|
8690
8733
|
file = _a.file,
|
|
8691
|
-
onClick = _a.onClick
|
|
8734
|
+
onClick = _a.onClick,
|
|
8735
|
+
onKeyPress = _a.onKeyPress,
|
|
8736
|
+
_c = _a.tabIndex,
|
|
8737
|
+
tabIndex = _c === void 0 ? 0 : _c;
|
|
8692
8738
|
var rootClasses = useStylesWithRootClass(rootClassName$4, className, error ? 'file-error' : 'file-success');
|
|
8693
8739
|
var defaultIcon = error ? 'error-solid' : 'check-solid';
|
|
8694
8740
|
|
|
8695
|
-
var
|
|
8696
|
-
endIcon =
|
|
8697
|
-
setEndIcon =
|
|
8741
|
+
var _d = React.useState(defaultIcon),
|
|
8742
|
+
endIcon = _d[0],
|
|
8743
|
+
setEndIcon = _d[1];
|
|
8698
8744
|
|
|
8699
8745
|
var handleItemClick = function handleItemClick(clickedFile) {
|
|
8700
8746
|
return function (_event) {
|
|
@@ -8713,13 +8759,21 @@
|
|
|
8713
8759
|
"aria-label": ariaLabel,
|
|
8714
8760
|
className: rootClasses,
|
|
8715
8761
|
"data-testid": dataTestId,
|
|
8762
|
+
onBlur: function () {
|
|
8763
|
+
return setEndIcon(defaultIcon);
|
|
8764
|
+
},
|
|
8716
8765
|
onClick: handleItemClick(file),
|
|
8766
|
+
onFocus: function () {
|
|
8767
|
+
return setEndIcon('delete');
|
|
8768
|
+
},
|
|
8717
8769
|
onMouseEnter: function () {
|
|
8718
8770
|
return setEndIcon('delete');
|
|
8719
8771
|
},
|
|
8720
8772
|
onMouseLeave: function () {
|
|
8721
8773
|
return setEndIcon(defaultIcon);
|
|
8722
|
-
}
|
|
8774
|
+
},
|
|
8775
|
+
onKeyPress: onKeyPress,
|
|
8776
|
+
tabIndex: tabIndex
|
|
8723
8777
|
}, {
|
|
8724
8778
|
children: [jsxRuntime.jsx(DotIcon, {
|
|
8725
8779
|
"data-testid": dataTestId && dataTestId + "-start-icon",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
2
|
import { CommonProps } from '../CommonProps';
|
|
3
3
|
export interface ListItemFile {
|
|
4
4
|
id: string | number;
|
|
@@ -11,5 +11,7 @@ export interface FileItemProps extends CommonProps {
|
|
|
11
11
|
errorText?: string;
|
|
12
12
|
file: ListItemFile;
|
|
13
13
|
onClick?: (file: ListItemFile) => void;
|
|
14
|
+
onKeyPress?: (event: KeyboardEvent<Element>) => void;
|
|
15
|
+
tabIndex?: number;
|
|
14
16
|
}
|
|
15
|
-
export declare const DotFileListItem: ({ ariaLabel, className, "data-testid": dataTestId, deleteFile, disableDelete, error, errorText, file, onClick, }: FileItemProps) => JSX.Element;
|
|
17
|
+
export declare const DotFileListItem: ({ ariaLabel, className, "data-testid": dataTestId, deleteFile, disableDelete, error, errorText, file, onClick, onKeyPress, tabIndex, }: FileItemProps) => JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FileUploadProps } from './';
|
|
2
|
+
import { FileUploadProps, MappedListItemFile } from './';
|
|
3
3
|
export interface CustomFileUploadArgs {
|
|
4
|
+
alreadyUploadedFiles?: MappedListItemFile[];
|
|
4
5
|
args: FileUploadProps;
|
|
5
6
|
}
|
|
6
|
-
export declare const CustomFileUpload: ({ args }: CustomFileUploadArgs) => JSX.Element;
|
|
7
|
+
export declare const CustomFileUpload: ({ args, alreadyUploadedFiles, }: CustomFileUploadArgs) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FileRejection } from 'react-dropzone';
|
|
3
|
-
import { DropzoneContentArgs, ParseListItemArgs, UploadedFilesListArgs } from './models';
|
|
3
|
+
import { DropzoneContentArgs, FileUploadError, ParseListItemArgs, UploadedFilesListArgs } from './models';
|
|
4
4
|
export declare const renderMaxSizeMessage: (maxSizeMB: number) => ReactNode;
|
|
5
5
|
export declare const renderMaxFilesMessage: (maxFiles: number, maxFilesClasses: string) => ReactNode;
|
|
6
6
|
export declare const renderSelectFilesButton: (isUploadDisabled: boolean, onButtonClick: () => void) => ReactNode;
|
|
@@ -21,3 +21,4 @@ export declare const joinAcceptedAndRejectedFiles: (filesAccepted: File[], files
|
|
|
21
21
|
file: File;
|
|
22
22
|
errors: any[];
|
|
23
23
|
}[];
|
|
24
|
+
export declare const getErrorMessagesForDisplay: (errors: FileUploadError[]) => string;
|
|
@@ -21,6 +21,8 @@ export interface InlineEditProps extends CommonProps {
|
|
|
21
21
|
readOnly?: boolean;
|
|
22
22
|
/** If true, when starting edit it will select all text in the input */
|
|
23
23
|
selectTextOnEdit?: boolean;
|
|
24
|
+
/** tab order for the inline edit */
|
|
25
|
+
tabIndex?: number;
|
|
24
26
|
/** Tooltip text displayed on hover */
|
|
25
27
|
tooltip?: string;
|
|
26
28
|
/** Typography variant to be used */
|
|
@@ -31,4 +33,4 @@ export interface InlineEditProps extends CommonProps {
|
|
|
31
33
|
/**
|
|
32
34
|
* @experimental This component is still in development
|
|
33
35
|
*/
|
|
34
|
-
export declare const DotInlineEdit: ({ ariaLabel, bindings, charactersLimit, className, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, readOnly, selectTextOnEdit, tooltip, typography, value, }: InlineEditProps) => JSX.Element;
|
|
36
|
+
export declare const DotInlineEdit: ({ ariaLabel, bindings, charactersLimit, className, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, readOnly, selectTextOnEdit, tabIndex, tooltip, typography, value, }: InlineEditProps) => JSX.Element;
|