@atlaskit/inline-edit 13.7.8 → 14.0.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/CHANGELOG.md +26 -0
- package/dist/cjs/inline-edit.compiled.css +2 -0
- package/dist/cjs/inline-edit.js +21 -23
- package/dist/cjs/inline-editable-textfield.compiled.css +9 -0
- package/dist/cjs/inline-editable-textfield.js +18 -21
- package/dist/cjs/internal/buttons.compiled.css +18 -0
- package/dist/cjs/internal/buttons.js +35 -62
- package/dist/cjs/internal/read-view.compiled.css +28 -0
- package/dist/cjs/internal/read-view.js +21 -55
- package/dist/es2019/inline-edit.compiled.css +2 -0
- package/dist/es2019/inline-edit.js +20 -25
- package/dist/es2019/inline-editable-textfield.compiled.css +9 -0
- package/dist/es2019/inline-editable-textfield.js +16 -19
- package/dist/es2019/internal/buttons.compiled.css +18 -0
- package/dist/es2019/internal/buttons.js +18 -60
- package/dist/es2019/internal/read-view.compiled.css +28 -0
- package/dist/es2019/internal/read-view.js +18 -54
- package/dist/esm/inline-edit.compiled.css +2 -0
- package/dist/esm/inline-edit.js +20 -25
- package/dist/esm/inline-editable-textfield.compiled.css +9 -0
- package/dist/esm/inline-editable-textfield.js +16 -19
- package/dist/esm/internal/buttons.compiled.css +18 -0
- package/dist/esm/internal/buttons.js +32 -60
- package/dist/esm/internal/read-view.compiled.css +28 -0
- package/dist/esm/internal/read-view.js +21 -54
- package/dist/types/entry-points/types.d.ts +1 -1
- package/dist/types/inline-edit.d.ts +2 -2
- package/dist/types/internal/buttons.d.ts +1 -11
- package/dist/types/internal/read-view.d.ts +1 -2
- package/dist/types-ts4.5/entry-points/types.d.ts +1 -1
- package/dist/types-ts4.5/inline-edit.d.ts +2 -2
- package/dist/types-ts4.5/internal/buttons.d.ts +1 -11
- package/dist/types-ts4.5/internal/read-view.d.ts +1 -2
- package/package.json +17 -16
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
/* inline-edit.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import "./inline-edit.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
4
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
5
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
10
6
|
import Field from '@atlaskit/form/Field';
|
|
11
7
|
import Form from '@atlaskit/form/Form';
|
|
12
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import Pressable from '@atlaskit/primitives/
|
|
9
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
14
10
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
15
11
|
import Buttons from './internal/buttons';
|
|
16
12
|
import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
|
|
17
13
|
import ReadView from './internal/read-view';
|
|
18
|
-
const fieldStyles =
|
|
19
|
-
maxWidth: '100%',
|
|
20
|
-
position: 'relative'
|
|
21
|
-
});
|
|
14
|
+
const fieldStyles = null;
|
|
22
15
|
const analyticsAttributes = {
|
|
23
16
|
componentName: 'inlineEdit',
|
|
24
17
|
packageName: "@atlaskit/inline-edit",
|
|
25
|
-
packageVersion: "
|
|
18
|
+
packageVersion: "14.0.0"
|
|
26
19
|
};
|
|
27
20
|
const InnerInlineEdit = props => {
|
|
28
21
|
const {
|
|
@@ -136,7 +129,7 @@ const InnerInlineEdit = props => {
|
|
|
136
129
|
return `${editButtonLabel}, ${editLabel}`;
|
|
137
130
|
};
|
|
138
131
|
const renderReadView = () => {
|
|
139
|
-
return
|
|
132
|
+
return /*#__PURE__*/React.createElement(ReadView, {
|
|
140
133
|
editButtonLabel: concatenatedEditButtonLabel(),
|
|
141
134
|
onEditRequested: onEditRequested,
|
|
142
135
|
postReadViewClick: doNotFocusOnEditButton,
|
|
@@ -146,7 +139,7 @@ const InnerInlineEdit = props => {
|
|
|
146
139
|
testId: testId
|
|
147
140
|
});
|
|
148
141
|
};
|
|
149
|
-
return
|
|
142
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
150
143
|
onSubmit: data => onConfirm(data.inlineEdit)
|
|
151
144
|
}, ({
|
|
152
145
|
formProps: {
|
|
@@ -155,7 +148,7 @@ const InnerInlineEdit = props => {
|
|
|
155
148
|
ref: formRef
|
|
156
149
|
},
|
|
157
150
|
reset
|
|
158
|
-
}) =>
|
|
151
|
+
}) => /*#__PURE__*/React.createElement("form", {
|
|
159
152
|
/**
|
|
160
153
|
* It is not normally acceptable to add key handlers to non-interactive elements
|
|
161
154
|
* as this is an accessibility anti-pattern. However, because this instance is
|
|
@@ -175,7 +168,7 @@ const InnerInlineEdit = props => {
|
|
|
175
168
|
},
|
|
176
169
|
onSubmit: onSubmit,
|
|
177
170
|
ref: formRef
|
|
178
|
-
}, shouldBeEditing ?
|
|
171
|
+
}, shouldBeEditing ? /*#__PURE__*/React.createElement(Field, {
|
|
179
172
|
name: "inlineEdit",
|
|
180
173
|
label: label,
|
|
181
174
|
defaultValue: defaultValue,
|
|
@@ -185,18 +178,18 @@ const InnerInlineEdit = props => {
|
|
|
185
178
|
}, ({
|
|
186
179
|
fieldProps,
|
|
187
180
|
error
|
|
188
|
-
}) =>
|
|
189
|
-
css: fieldStyles,
|
|
181
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
190
182
|
onBlur: e => {
|
|
191
183
|
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
192
184
|
onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
|
|
193
185
|
}
|
|
194
186
|
},
|
|
195
|
-
onFocus: onEditViewWrapperFocus
|
|
187
|
+
onFocus: onEditViewWrapperFocus,
|
|
188
|
+
className: ax(["_p12f1osq _kqswh2mm"])
|
|
196
189
|
}, editView({
|
|
197
190
|
...fieldProps,
|
|
198
191
|
errorMessage: error
|
|
199
|
-
}, editViewRef), !hideActionButtons ?
|
|
192
|
+
}, editViewRef), !hideActionButtons ? /*#__PURE__*/React.createElement(Buttons, {
|
|
200
193
|
testId: testId,
|
|
201
194
|
cancelButtonLabel: cancelButtonLabel,
|
|
202
195
|
confirmButtonLabel: confirmButtonLabel,
|
|
@@ -211,17 +204,19 @@ const InnerInlineEdit = props => {
|
|
|
211
204
|
onCancelClick(e);
|
|
212
205
|
}
|
|
213
206
|
}) :
|
|
207
|
+
/*#__PURE__*/
|
|
214
208
|
/**
|
|
215
209
|
* This is to allow Ctrl + Enter to submit without action buttons
|
|
216
210
|
*/
|
|
217
|
-
|
|
211
|
+
React.createElement(Pressable, {
|
|
218
212
|
hidden: true,
|
|
219
213
|
type: "submit"
|
|
220
|
-
},
|
|
214
|
+
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, "Submit")))) :
|
|
215
|
+
/*#__PURE__*/
|
|
221
216
|
/**
|
|
222
217
|
* Field is used here only for the label and spacing
|
|
223
218
|
*/
|
|
224
|
-
|
|
219
|
+
React.createElement(Field, {
|
|
225
220
|
name: "inlineEdit",
|
|
226
221
|
label: label,
|
|
227
222
|
defaultValue: "",
|
|
@@ -231,7 +226,7 @@ const InnerInlineEdit = props => {
|
|
|
231
226
|
};
|
|
232
227
|
const InlineEdit = props => {
|
|
233
228
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
234
|
-
return
|
|
229
|
+
return /*#__PURE__*/React.createElement(InnerInlineEdit, props);
|
|
235
230
|
};
|
|
236
231
|
|
|
237
232
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._18zr12x7{padding-inline:var(--ds-space-075,6px)}
|
|
3
|
+
._1rjc1b66{padding-block:var(--ds-space-050,4px)}
|
|
4
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1nmz1hna{word-break:break-word}
|
|
7
|
+
._p12f1osq{max-width:100%}
|
|
8
|
+
._vwz41osq{line-height:100%}
|
|
9
|
+
._y4ti12x7{padding-inline-end:var(--ds-space-075,6px)}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
+
/* inline-editable-textfield.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./inline-editable-textfield.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
5
|
import React, { useCallback, useRef } from 'react';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
3
7
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
4
8
|
import InlineDialog from '@atlaskit/inline-dialog';
|
|
5
|
-
import { Box
|
|
9
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
10
|
import Textfield from '@atlaskit/textfield';
|
|
7
11
|
import { R400 } from '@atlaskit/theme/colors';
|
|
8
12
|
import InlineEdit from './inline-edit';
|
|
9
|
-
const errorIconContainerStyles =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
paddingInline: 'space.075',
|
|
19
|
-
wordBreak: 'break-word'
|
|
20
|
-
});
|
|
21
|
-
const compactStyles = xcss({
|
|
22
|
-
paddingBlock: 'space.050',
|
|
23
|
-
paddingInline: 'space.075'
|
|
24
|
-
});
|
|
13
|
+
const errorIconContainerStyles = {
|
|
14
|
+
root: "_vwz41osq _y4ti12x7"
|
|
15
|
+
};
|
|
16
|
+
const readViewForTextFieldStyles = {
|
|
17
|
+
root: "_1e0c1txw _11c81oud _p12f1osq _1rjcu2gc _18zr12x7 _1nmz1hna"
|
|
18
|
+
};
|
|
19
|
+
const compactStyles = {
|
|
20
|
+
root: "_1rjc1b66 _18zr12x7"
|
|
21
|
+
};
|
|
25
22
|
const InlineEditableTextfield = props => {
|
|
26
23
|
const {
|
|
27
24
|
isCompact = false,
|
|
@@ -53,7 +50,7 @@ const InlineEditableTextfield = props => {
|
|
|
53
50
|
}, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
54
51
|
ref: textFieldRef,
|
|
55
52
|
elemAfterInput: isInvalid && /*#__PURE__*/React.createElement(Box, {
|
|
56
|
-
xcss: errorIconContainerStyles
|
|
53
|
+
xcss: errorIconContainerStyles.root
|
|
57
54
|
}, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
58
55
|
label: "error",
|
|
59
56
|
primaryColor: `var(--ds-icon-danger, ${R400})`
|
|
@@ -63,7 +60,7 @@ const InlineEditableTextfield = props => {
|
|
|
63
60
|
autoFocus: true
|
|
64
61
|
}))),
|
|
65
62
|
readView: () => /*#__PURE__*/React.createElement(Box, {
|
|
66
|
-
xcss:
|
|
63
|
+
xcss: cx(readViewForTextFieldStyles.root, isCompact && compactStyles.root),
|
|
67
64
|
"data-compact": isCompact,
|
|
68
65
|
testId: testId && `read-view-${testId}`
|
|
69
66
|
}, defaultValue || placeholder)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._2rko1sit{border-radius:var(--ds-border-radius,3px)}
|
|
3
|
+
._152t1osq{inset-block-start:100%}
|
|
4
|
+
._16qs1kf5{box-shadow:var(--ds-shadow-overlay,0 4px 8px -2px rgba(9,30,66,.25),0 0 1px rgba(9,30,66,.31))}
|
|
5
|
+
._1bsbxy5q{width:var(--ds-space-400,2pc)}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1mpy1b66:last-child{margin-inline-start:var(--ds-space-050,4px)}
|
|
8
|
+
._1nlxs66q>button{background-color:var(--ds-surface-overlay,rgba(9,30,66,.04))}
|
|
9
|
+
._1o9zidpf{flex-shrink:0}
|
|
10
|
+
._1pby1kze{z-index:200}
|
|
11
|
+
._1pfh12x7{margin-block-start:var(--ds-space-075,6px)}
|
|
12
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
13
|
+
._kqswstnw{position:absolute}
|
|
14
|
+
._rjxpidpf{inset-inline-end:0}
|
|
15
|
+
._vchhusvi{box-sizing:border-box}
|
|
16
|
+
._l2uv88o1>button:hover{background-color:var(--ds-surface-overlay-hovered,rgba(9,30,66,.08))}
|
|
17
|
+
._7mfvdecw>button:active{background-color:var(--ds-surface-overlay-pressed,rgba(179,212,255,.6))}
|
|
18
|
+
._szlb1x4z>button:active{color:var(--ds-text,#0052cc)}
|
|
@@ -1,59 +1,17 @@
|
|
|
1
|
+
/* buttons.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./buttons.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
6
|
/* eslint-disable @atlaskit/design-system/no-nested-styles */
|
|
3
7
|
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
|
|
4
|
-
/**
|
|
5
|
-
* @jsxRuntime classic
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
8
8
|
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
-
import { css, jsx } from '@emotion/react';
|
|
11
9
|
import { IconButton } from '@atlaskit/button/new';
|
|
12
10
|
import ConfirmIcon from '@atlaskit/icon/glyph/check';
|
|
13
11
|
import CancelIcon from '@atlaskit/icon/glyph/cross';
|
|
14
12
|
import { B400, N0, N20A, N30A, N50A, N60A } from '@atlaskit/theme/colors';
|
|
15
|
-
const buttonsContainerStyles =
|
|
16
|
-
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
flexShrink: 0,
|
|
19
|
-
insetBlockStart: '100%',
|
|
20
|
-
insetInlineEnd: 0,
|
|
21
|
-
marginBlockStart: "var(--ds-space-075, 6px)"
|
|
22
|
-
});
|
|
23
|
-
const buttonWrapperBaseStyles = css({
|
|
24
|
-
boxSizing: 'border-box',
|
|
25
|
-
width: "var(--ds-space-400, 32px)",
|
|
26
|
-
zIndex: 200,
|
|
27
|
-
backgroundColor: `var(--ds-surface-overlay, ${N0})`,
|
|
28
|
-
borderRadius: "var(--ds-border-radius, 3px)",
|
|
29
|
-
boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
|
|
30
|
-
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
31
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
32
|
-
'&:last-child': {
|
|
33
|
-
marginInlineStart: "var(--ds-space-050, 4px)"
|
|
34
|
-
},
|
|
35
|
-
'& > button': {
|
|
36
|
-
backgroundColor: `var(--ds-surface-overlay, ${N20A})`
|
|
37
|
-
},
|
|
38
|
-
'& > button:hover': {
|
|
39
|
-
backgroundColor: `var(--ds-surface-overlay-hovered, ${N30A})`
|
|
40
|
-
},
|
|
41
|
-
'& > button:active': {
|
|
42
|
-
backgroundColor: "var(--ds-surface-overlay-pressed, rgba(179, 212, 255, 0.6))",
|
|
43
|
-
color: `var(--ds-text, ${B400})`
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
47
|
-
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
48
|
-
/**
|
|
49
|
-
* __Buttons__
|
|
50
|
-
*
|
|
51
|
-
* A buttons {description}.
|
|
52
|
-
*
|
|
53
|
-
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
54
|
-
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
55
|
-
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
56
|
-
*/
|
|
13
|
+
const buttonsContainerStyles = null;
|
|
14
|
+
const buttonWrapperBaseStyles = null;
|
|
57
15
|
const Buttons = ({
|
|
58
16
|
confirmButtonLabel,
|
|
59
17
|
cancelButtonLabel,
|
|
@@ -61,24 +19,24 @@ const Buttons = ({
|
|
|
61
19
|
onCancelClick,
|
|
62
20
|
testId
|
|
63
21
|
}) => {
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: ax(["_1e0c1txw _kqswstnw _1o9zidpf _152t1osq _rjxpidpf _1pfh12x7"])
|
|
24
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
tabIndex: -1,
|
|
26
|
+
className: ax(["_vchhusvi _1bsbxy5q _1pby1kze _bfhk1bhr _2rko1sit _16qs1kf5 _11c81oud _1mpy1b66 _1nlxs66q _l2uv88o1 _7mfvdecw _szlb1x4z"])
|
|
27
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
70
28
|
type: "submit",
|
|
71
|
-
icon: iconProps =>
|
|
29
|
+
icon: iconProps => /*#__PURE__*/React.createElement(ConfirmIcon, _extends({}, iconProps, {
|
|
72
30
|
size: "small"
|
|
73
31
|
})),
|
|
74
32
|
onMouseDown: onMouseDown,
|
|
75
33
|
label: confirmButtonLabel,
|
|
76
34
|
testId: testId && `${testId}--confirm`
|
|
77
|
-
})),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
icon: iconProps =>
|
|
35
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
tabIndex: -1,
|
|
37
|
+
className: ax(["_vchhusvi _1bsbxy5q _1pby1kze _bfhk1bhr _2rko1sit _16qs1kf5 _11c81oud _1mpy1b66 _1nlxs66q _l2uv88o1 _7mfvdecw _szlb1x4z"])
|
|
38
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
39
|
+
icon: iconProps => /*#__PURE__*/React.createElement(CancelIcon, _extends({}, iconProps, {
|
|
82
40
|
size: "small"
|
|
83
41
|
})),
|
|
84
42
|
label: cancelButtonLabel,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
._18s8ze3t{margin:var(--ds-space-0,0)}
|
|
3
|
+
._1yt4ze3t{padding:var(--ds-space-0,0)}
|
|
4
|
+
._2rko1sit{border-radius:var(--ds-border-radius,3px)}
|
|
5
|
+
._v564thzt{transition:background .2s}
|
|
6
|
+
._14ly1bk5:focus+div{border-width:var(--ds-border-width-outline,2px)}
|
|
7
|
+
._189e1bk5{border-width:var(--ds-border-width-outline,2px)}
|
|
8
|
+
._189e1grb{border-width:var(--ds-border-width-0,0)}
|
|
9
|
+
._1dqoglyw{border-style:none}
|
|
10
|
+
._1dqonqa1{border-style:solid}
|
|
11
|
+
._1h6d1j28{border-color:transparent}
|
|
12
|
+
._1j8znqa1:focus+div{border-style:solid}
|
|
13
|
+
._1xp41p6i:focus+div{border-color:var(--ds-border-focused,#388bff)}
|
|
14
|
+
._12ji1r31{outline-color:currentColor}
|
|
15
|
+
._12y3idpf{outline-width:0}
|
|
16
|
+
._1bsb1osq{width:100%}
|
|
17
|
+
._1bsb1wug{width:auto}
|
|
18
|
+
._1e0c1o8l{display:inline-block}
|
|
19
|
+
._1e0c1ule{display:block}
|
|
20
|
+
._1qu2glyw{outline-style:none}
|
|
21
|
+
._bfhk18uv{background-color:initial}
|
|
22
|
+
._p12f1osq{max-width:100%}
|
|
23
|
+
._r06hglyw{-webkit-appearance:none;appearance:none}
|
|
24
|
+
._vchhusvi{box-sizing:border-box}
|
|
25
|
+
._vwz4kb7n{line-height:1}._128midpf:focus-visible{outline-width:0}
|
|
26
|
+
._mizu1r31:focus-visible{outline-color:currentColor}
|
|
27
|
+
._ra3xglyw:focus-visible{outline-style:none}
|
|
28
|
+
._irr314ae:hover{background-color:var(--ds-background-neutral-subtle-hovered,#ebecf0)}
|
|
@@ -1,51 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
/* read-view.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
2
|
+
import "./read-view.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
4
|
import React, { useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
10
6
|
import { N30 } from '@atlaskit/theme/colors';
|
|
11
|
-
const readViewContainerStyles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
padding: 'space.0',
|
|
18
|
-
appearance: 'none',
|
|
19
|
-
background: 'transparent',
|
|
20
|
-
border: 0,
|
|
21
|
-
lineHeight: 1,
|
|
22
|
-
outline: 0,
|
|
23
|
-
':focus-visible': {
|
|
24
|
-
outline: 0
|
|
25
|
-
},
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
28
|
-
':focus + div': {
|
|
29
|
-
borderColor: 'color.border.focused',
|
|
30
|
-
borderWidth: 'border.width.outline',
|
|
31
|
-
borderStyle: 'solid'
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const readViewWrapperStyles = css({
|
|
35
|
-
display: 'inline-block',
|
|
36
|
-
boxSizing: 'border-box',
|
|
37
|
-
width: 'auto',
|
|
38
|
-
maxWidth: '100%',
|
|
39
|
-
border: '2px solid transparent',
|
|
40
|
-
borderRadius: "var(--ds-border-radius, 3px)",
|
|
41
|
-
transition: 'background 0.2s',
|
|
42
|
-
'&:hover': {
|
|
43
|
-
background: `var(--ds-background-neutral-subtle-hovered, ${N30})`
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const readViewFitContainerWidthStyles = css({
|
|
47
|
-
width: '100%'
|
|
48
|
-
});
|
|
7
|
+
const readViewContainerStyles = null;
|
|
8
|
+
const editButtonStyles = {
|
|
9
|
+
root: "_1e0c1ule _18s8ze3t _1yt4ze3t _r06hglyw _bfhk18uv _189e1grb _1dqoglyw _1h6d1j28 _vwz4kb7n _12ji1r31 _1qu2glyw _12y3idpf _1xp41p6i _14ly1bk5 _1j8znqa1 _mizu1r31 _ra3xglyw _128midpf"
|
|
10
|
+
};
|
|
11
|
+
const readViewWrapperStyles = null;
|
|
12
|
+
const readViewFitContainerWidthStyles = null;
|
|
49
13
|
const DRAG_THRESHOLD = 5;
|
|
50
14
|
const ReadView = ({
|
|
51
15
|
editButtonLabel,
|
|
@@ -72,16 +36,15 @@ const ReadView = ({
|
|
|
72
36
|
postReadViewClick();
|
|
73
37
|
}
|
|
74
38
|
};
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
xcss: editButtonStyles,
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: ax(["_vwz4kb7n"])
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
42
|
+
xcss: editButtonStyles.root,
|
|
79
43
|
onClick: onEditRequested,
|
|
80
44
|
ref: editButtonRef,
|
|
81
45
|
testId: testId && `${testId}--edit-button`,
|
|
82
46
|
"aria-label": editButtonLabel
|
|
83
|
-
}),
|
|
84
|
-
css: [readViewWrapperStyles, readViewFitContainerWidth && readViewFitContainerWidthStyles]
|
|
47
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
85
48
|
/**
|
|
86
49
|
* It is not normally acceptable to add click handlers to non-interactive elements
|
|
87
50
|
* as this is an accessibility anti-pattern. However, because this instance is
|
|
@@ -89,14 +52,15 @@ const ReadView = ({
|
|
|
89
52
|
* creating an inaccessible custom element, we can add role="presentation" so that
|
|
90
53
|
* there is no negative impacts to assistive technologies.
|
|
91
54
|
* (Why links are embeeded in inline-edit is for another day...)
|
|
92
|
-
|
|
55
|
+
*/
|
|
93
56
|
role: "presentation",
|
|
94
57
|
onClick: onReadViewClick,
|
|
95
58
|
onMouseDown: e => {
|
|
96
59
|
startX.current = e.clientX;
|
|
97
60
|
startY.current = e.clientY;
|
|
98
61
|
},
|
|
99
|
-
"data-read-view-fit-container-width": readViewFitContainerWidth
|
|
62
|
+
"data-read-view-fit-container-width": readViewFitContainerWidth,
|
|
63
|
+
className: ax(["_1e0c1o8l _vchhusvi _1bsb1wug _p12f1osq _1h6d1j28 _2rko1sit _1dqonqa1 _189e1bk5 _v564thzt _irr314ae", readViewFitContainerWidth && "_1bsb1osq"])
|
|
100
64
|
}, readView()));
|
|
101
65
|
};
|
|
102
66
|
export default ReadView;
|
package/dist/esm/inline-edit.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
+
/* inline-edit.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./inline-edit.compiled.css";
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
3
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
/**
|
|
6
|
-
* @jsxRuntime classic
|
|
7
|
-
* @jsx jsx
|
|
8
|
-
*/
|
|
9
8
|
import React, { useCallback, useRef, useState } from 'react';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
|
-
import { css, jsx } from '@emotion/react';
|
|
13
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
14
10
|
import Field from '@atlaskit/form/Field';
|
|
15
11
|
import Form from '@atlaskit/form/Form';
|
|
16
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
-
import Pressable from '@atlaskit/primitives/
|
|
13
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
18
14
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
15
|
import Buttons from './internal/buttons';
|
|
20
16
|
import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
|
|
21
17
|
import ReadView from './internal/read-view';
|
|
22
|
-
var fieldStyles =
|
|
23
|
-
maxWidth: '100%',
|
|
24
|
-
position: 'relative'
|
|
25
|
-
});
|
|
18
|
+
var fieldStyles = null;
|
|
26
19
|
var analyticsAttributes = {
|
|
27
20
|
componentName: 'inlineEdit',
|
|
28
21
|
packageName: "@atlaskit/inline-edit",
|
|
29
|
-
packageVersion: "
|
|
22
|
+
packageVersion: "14.0.0"
|
|
30
23
|
};
|
|
31
24
|
var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
32
25
|
var _props$startWithEditV = props.startWithEditViewOpen,
|
|
@@ -150,7 +143,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
150
143
|
return "".concat(editButtonLabel, ", ").concat(editLabel);
|
|
151
144
|
};
|
|
152
145
|
var renderReadView = function renderReadView() {
|
|
153
|
-
return
|
|
146
|
+
return /*#__PURE__*/React.createElement(ReadView, {
|
|
154
147
|
editButtonLabel: concatenatedEditButtonLabel(),
|
|
155
148
|
onEditRequested: onEditRequested,
|
|
156
149
|
postReadViewClick: doNotFocusOnEditButton,
|
|
@@ -160,7 +153,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
160
153
|
testId: testId
|
|
161
154
|
});
|
|
162
155
|
};
|
|
163
|
-
return
|
|
156
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
164
157
|
onSubmit: function onSubmit(data) {
|
|
165
158
|
return onConfirm(data.inlineEdit);
|
|
166
159
|
}
|
|
@@ -170,7 +163,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
170
163
|
onSubmit = _ref$formProps.onSubmit,
|
|
171
164
|
formRef = _ref$formProps.ref,
|
|
172
165
|
reset = _ref.reset;
|
|
173
|
-
return
|
|
166
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
174
167
|
/**
|
|
175
168
|
* It is not normally acceptable to add key handlers to non-interactive elements
|
|
176
169
|
* as this is an accessibility anti-pattern. However, because this instance is
|
|
@@ -190,7 +183,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
190
183
|
},
|
|
191
184
|
onSubmit: onSubmit,
|
|
192
185
|
ref: formRef
|
|
193
|
-
}, shouldBeEditing ?
|
|
186
|
+
}, shouldBeEditing ? /*#__PURE__*/React.createElement(Field, {
|
|
194
187
|
name: "inlineEdit",
|
|
195
188
|
label: label,
|
|
196
189
|
defaultValue: defaultValue,
|
|
@@ -200,17 +193,17 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
200
193
|
}, function (_ref2) {
|
|
201
194
|
var fieldProps = _ref2.fieldProps,
|
|
202
195
|
error = _ref2.error;
|
|
203
|
-
return
|
|
204
|
-
css: fieldStyles,
|
|
196
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
205
197
|
onBlur: function onBlur(e) {
|
|
206
198
|
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
207
199
|
onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
|
|
208
200
|
}
|
|
209
201
|
},
|
|
210
|
-
onFocus: onEditViewWrapperFocus
|
|
202
|
+
onFocus: onEditViewWrapperFocus,
|
|
203
|
+
className: ax(["_p12f1osq _kqswh2mm"])
|
|
211
204
|
}, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
|
|
212
205
|
errorMessage: error
|
|
213
|
-
}), editViewRef), !hideActionButtons ?
|
|
206
|
+
}), editViewRef), !hideActionButtons ? /*#__PURE__*/React.createElement(Buttons, {
|
|
214
207
|
testId: testId,
|
|
215
208
|
cancelButtonLabel: cancelButtonLabel,
|
|
216
209
|
confirmButtonLabel: confirmButtonLabel,
|
|
@@ -225,18 +218,20 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
225
218
|
_onCancelClick(e);
|
|
226
219
|
}
|
|
227
220
|
}) :
|
|
221
|
+
/*#__PURE__*/
|
|
228
222
|
/**
|
|
229
223
|
* This is to allow Ctrl + Enter to submit without action buttons
|
|
230
224
|
*/
|
|
231
|
-
|
|
225
|
+
React.createElement(Pressable, {
|
|
232
226
|
hidden: true,
|
|
233
227
|
type: "submit"
|
|
234
|
-
},
|
|
228
|
+
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, "Submit")));
|
|
235
229
|
}) :
|
|
230
|
+
/*#__PURE__*/
|
|
236
231
|
/**
|
|
237
232
|
* Field is used here only for the label and spacing
|
|
238
233
|
*/
|
|
239
|
-
|
|
234
|
+
React.createElement(Field, {
|
|
240
235
|
name: "inlineEdit",
|
|
241
236
|
label: label,
|
|
242
237
|
defaultValue: "",
|
|
@@ -247,7 +242,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
247
242
|
};
|
|
248
243
|
var InlineEdit = function InlineEdit(props) {
|
|
249
244
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
250
|
-
return
|
|
245
|
+
return /*#__PURE__*/React.createElement(InnerInlineEdit, props);
|
|
251
246
|
};
|
|
252
247
|
|
|
253
248
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._11c81oud{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._18zr12x7{padding-inline:var(--ds-space-075,6px)}
|
|
3
|
+
._1rjc1b66{padding-block:var(--ds-space-050,4px)}
|
|
4
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1nmz1hna{word-break:break-word}
|
|
7
|
+
._p12f1osq{max-width:100%}
|
|
8
|
+
._vwz41osq{line-height:100%}
|
|
9
|
+
._y4ti12x7{padding-inline-end:var(--ds-space-075,6px)}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
+
/* inline-editable-textfield.tsx generated by @compiled/babel-plugin v0.32.2 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["errorMessage", "isInvalid"];
|
|
5
|
+
import "./inline-editable-textfield.compiled.css";
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
7
|
import React, { useCallback, useRef } from 'react';
|
|
8
|
+
import { cx } from '@atlaskit/css';
|
|
5
9
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
10
|
import InlineDialog from '@atlaskit/inline-dialog';
|
|
7
|
-
import { Box
|
|
11
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
12
|
import Textfield from '@atlaskit/textfield';
|
|
9
13
|
import { R400 } from '@atlaskit/theme/colors';
|
|
10
14
|
import InlineEdit from './inline-edit';
|
|
11
|
-
var errorIconContainerStyles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
paddingInline: 'space.075',
|
|
21
|
-
wordBreak: 'break-word'
|
|
22
|
-
});
|
|
23
|
-
var compactStyles = xcss({
|
|
24
|
-
paddingBlock: 'space.050',
|
|
25
|
-
paddingInline: 'space.075'
|
|
26
|
-
});
|
|
15
|
+
var errorIconContainerStyles = {
|
|
16
|
+
root: "_vwz41osq _y4ti12x7"
|
|
17
|
+
};
|
|
18
|
+
var readViewForTextFieldStyles = {
|
|
19
|
+
root: "_1e0c1txw _11c81oud _p12f1osq _1rjcu2gc _18zr12x7 _1nmz1hna"
|
|
20
|
+
};
|
|
21
|
+
var compactStyles = {
|
|
22
|
+
root: "_1rjc1b66 _18zr12x7"
|
|
23
|
+
};
|
|
27
24
|
var InlineEditableTextfield = function InlineEditableTextfield(props) {
|
|
28
25
|
var _props$isCompact = props.isCompact,
|
|
29
26
|
isCompact = _props$isCompact === void 0 ? false : _props$isCompact,
|
|
@@ -54,7 +51,7 @@ var InlineEditableTextfield = function InlineEditableTextfield(props) {
|
|
|
54
51
|
}, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
55
52
|
ref: textFieldRef,
|
|
56
53
|
elemAfterInput: isInvalid && /*#__PURE__*/React.createElement(Box, {
|
|
57
|
-
xcss: errorIconContainerStyles
|
|
54
|
+
xcss: errorIconContainerStyles.root
|
|
58
55
|
}, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
59
56
|
label: "error",
|
|
60
57
|
primaryColor: "var(--ds-icon-danger, ".concat(R400, ")")
|
|
@@ -66,7 +63,7 @@ var InlineEditableTextfield = function InlineEditableTextfield(props) {
|
|
|
66
63
|
},
|
|
67
64
|
readView: function readView() {
|
|
68
65
|
return /*#__PURE__*/React.createElement(Box, {
|
|
69
|
-
xcss:
|
|
66
|
+
xcss: cx(readViewForTextFieldStyles.root, isCompact && compactStyles.root),
|
|
70
67
|
"data-compact": isCompact,
|
|
71
68
|
testId: testId && "read-view-".concat(testId)
|
|
72
69
|
}, defaultValue || placeholder);
|