@atlaskit/link-picker 3.9.2 → 3.9.4
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 +16 -0
- package/dist/cjs/ui/link-picker/index.js +2 -1
- package/dist/cjs/ui/link-picker/text-input/index.compiled.css +3 -0
- package/dist/cjs/ui/link-picker/text-input/index.js +21 -15
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/ui/link-picker/index.js +2 -1
- package/dist/es2019/ui/link-picker/text-input/index.compiled.css +3 -0
- package/dist/es2019/ui/link-picker/text-input/index.js +18 -13
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/ui/link-picker/index.js +2 -1
- package/dist/esm/ui/link-picker/text-input/index.compiled.css +3 -0
- package/dist/esm/ui/link-picker/text-input/index.js +22 -16
- package/dist/esm/ui/main.js +1 -1
- package/dist/types/common/analytics/input-field-tracking.d.ts +4 -4
- package/dist/types/common/generic-error-svg/index.d.ts +0 -1
- package/dist/types/common/ui/empty-state/index.d.ts +0 -1
- package/dist/types/services/use-plugins/reducer.d.ts +0 -1
- package/dist/types/ui/error-boundary/error-boundary-fallback/index.d.ts +0 -1
- package/dist/types/ui/index.d.ts +0 -1
- package/dist/types/ui/lazy.d.ts +0 -1
- package/dist/types/ui/link-picker/form-footer/index.d.ts +0 -1
- package/dist/types/ui/link-picker/index.d.ts +0 -1
- package/dist/types/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.d.ts +0 -1
- package/dist/types/ui/link-picker/search-results/scrolling-tabs/index.d.ts +0 -1
- package/dist/types/ui/link-picker/search-results/search-results-container/index.d.ts +0 -1
- package/dist/types/ui/link-picker/text-input/index.d.ts +1 -1
- package/dist/types/ui/loader-fallback/index.d.ts +0 -1
- package/dist/types-ts4.5/common/analytics/input-field-tracking.d.ts +4 -4
- package/dist/types-ts4.5/common/generic-error-svg/index.d.ts +0 -1
- package/dist/types-ts4.5/common/ui/empty-state/index.d.ts +0 -1
- package/dist/types-ts4.5/services/use-plugins/reducer.d.ts +0 -1
- package/dist/types-ts4.5/ui/error-boundary/error-boundary-fallback/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/lazy.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/form-footer/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/search-results/link-search-list/link-search-no-results/no-results-svg/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/search-results/scrolling-tabs/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/search-results/search-results-container/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-picker/text-input/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/loader-fallback/index.d.ts +0 -1
- package/lazy/package.json +1 -1
- package/package.json +9 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/link-picker
|
|
2
2
|
|
|
3
|
+
## 3.9.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`65822cbb7d2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/65822cbb7d2df) -
|
|
8
|
+
[ux] NAVX-1368 Adding required field and corresponding aria-describedby label for link-picker
|
|
9
|
+
label
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.9.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`e178e7edf0f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e178e7edf0f80) -
|
|
17
|
+
Clean up jsc_inline_editing_field_refactor FG.
|
|
18
|
+
|
|
3
19
|
## 3.9.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -444,7 +444,8 @@ var LinkPicker = exports.LinkPicker = (0, _analytics.withLinkPickerAnalyticsCont
|
|
|
444
444
|
onClear: handleUrlClear,
|
|
445
445
|
onKeyDown: handleKeyDown,
|
|
446
446
|
onChange: handleChangeUrl,
|
|
447
|
-
inputRef: inputRef
|
|
447
|
+
inputRef: inputRef,
|
|
448
|
+
isRequired: true
|
|
448
449
|
})), !hideDisplayText && /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement(DisplayTextInputField, {
|
|
449
450
|
autoComplete: "off",
|
|
450
451
|
name: "displayText",
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
._2hwx1b66{margin-right:var(--ds-space-050,4px)}
|
|
5
5
|
._7yjtidpf >div{margin-top:0}
|
|
6
6
|
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
7
|
+
._bozgv77o{padding-inline-start:var(--ds-space-025,2px)}
|
|
7
8
|
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
9
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
8
10
|
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
9
11
|
._onzypxbi+._onzypxbi{margin-top:var(--ds-space-200,1pc)}
|
|
10
12
|
._s7n4nkob{vertical-align:middle}
|
|
13
|
+
._syaz1tmw{color:var(--ds-text-danger,#ae2e24)}
|
|
11
14
|
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
@@ -21,10 +21,11 @@ var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
|
21
21
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
22
22
|
var _conditionalSpotlightTargetWrapper = require("./conditional-spotlight-target-wrapper");
|
|
23
23
|
var _utils = require("./utils");
|
|
24
|
-
var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName", "inputRef"];
|
|
24
|
+
var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName", "inputRef", "isRequired"];
|
|
25
25
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
26
|
var styles = {
|
|
27
|
-
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob"
|
|
27
|
+
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob",
|
|
28
|
+
requiredIndicatorStyles: "_syaz1tmw _ect41gqc _bozgv77o"
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -33,6 +34,13 @@ var styles = {
|
|
|
33
34
|
*/
|
|
34
35
|
var baseFieldStyles = null;
|
|
35
36
|
var newFieldStyles = null;
|
|
37
|
+
var RequiredAsterisk = function RequiredAsterisk() {
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
39
|
+
as: "span",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
xcss: styles.requiredIndicatorStyles
|
|
42
|
+
}, "*");
|
|
43
|
+
};
|
|
36
44
|
var testIds = exports.testIds = {
|
|
37
45
|
urlError: 'link-error',
|
|
38
46
|
clearUrlButton: 'clear-text'
|
|
@@ -49,6 +57,8 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
49
57
|
error = _ref.error,
|
|
50
58
|
spotlightTargetName = _ref.spotlightTargetName,
|
|
51
59
|
inputRefProp = _ref.inputRef,
|
|
60
|
+
_ref$isRequired = _ref.isRequired,
|
|
61
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
52
62
|
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
63
|
var inputRef = (0, _react.useRef)(null);
|
|
54
64
|
var handleRef = (0, _react.useCallback)(function (input) {
|
|
@@ -62,17 +72,10 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
62
72
|
}
|
|
63
73
|
}
|
|
64
74
|
}, [autoFocus]);
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return [handleRef, inputRefProp].filter(Boolean);
|
|
70
|
-
}, [handleRef, inputRefProp]);
|
|
71
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
72
|
-
textfieldRef = (0, _useCallbackRef.useMergeRefs)(refs);
|
|
73
|
-
} else {
|
|
74
|
-
textfieldRef = handleRef;
|
|
75
|
-
}
|
|
75
|
+
var refs = (0, _react.useMemo)(function () {
|
|
76
|
+
return [handleRef, inputRefProp].filter(Boolean);
|
|
77
|
+
}, [handleRef, inputRefProp]);
|
|
78
|
+
var textfieldRef = (0, _useCallbackRef.useMergeRefs)(refs);
|
|
76
79
|
var handleKeydown = (0, _react.useCallback)(function (e) {
|
|
77
80
|
if (typeof onUndo === 'function' && (0, _utils.isUndoEvent)(e)) {
|
|
78
81
|
e.preventDefault();
|
|
@@ -108,7 +111,8 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
108
111
|
className: (0, _runtime.ax)(["_7yjtidpf _onzypxbi", "_11c81vhk"])
|
|
109
112
|
}, /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
110
113
|
label: label,
|
|
111
|
-
name: name
|
|
114
|
+
name: name,
|
|
115
|
+
elementAfterLabel: isRequired && (0, _platformFeatureFlags.fg)('navx-1368-link-picker-a11y-mandatory-states') ? /*#__PURE__*/_react.default.createElement(RequiredAsterisk, null) : undefined
|
|
112
116
|
}, function (_ref2) {
|
|
113
117
|
var fieldProps = _ref2.fieldProps;
|
|
114
118
|
return /*#__PURE__*/_react.default.createElement(_conditionalSpotlightTargetWrapper.ConditionalSpotlightTargetWrapper, {
|
|
@@ -118,7 +122,9 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
118
122
|
ref: textfieldRef,
|
|
119
123
|
elemAfterInput: clearText,
|
|
120
124
|
isInvalid: !!error
|
|
121
|
-
}
|
|
125
|
+
}, (0, _platformFeatureFlags.fg)('navx-1368-link-picker-a11y-mandatory-states') ? {
|
|
126
|
+
"aria-describedby": "".concat(restProps["aria-describedby"], " ").concat(fieldProps.id, "-error")
|
|
127
|
+
} : {})), error && /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, {
|
|
122
128
|
testId: testIds.urlError
|
|
123
129
|
}, error)));
|
|
124
130
|
}));
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -25,7 +25,7 @@ var testIds = exports.testIds = {
|
|
|
25
25
|
};
|
|
26
26
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
27
27
|
packageName: "@atlaskit/link-picker" || '',
|
|
28
|
-
packageVersion: "3.9.
|
|
28
|
+
packageVersion: "3.9.3" || '',
|
|
29
29
|
componentName: _constants.COMPONENT_NAME,
|
|
30
30
|
source: _constants.COMPONENT_NAME
|
|
31
31
|
};
|
|
@@ -399,7 +399,8 @@ export const LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(({
|
|
|
399
399
|
onClear: handleUrlClear,
|
|
400
400
|
onKeyDown: handleKeyDown,
|
|
401
401
|
onChange: handleChangeUrl,
|
|
402
|
-
inputRef: inputRef
|
|
402
|
+
inputRef: inputRef,
|
|
403
|
+
isRequired: true
|
|
403
404
|
})), !hideDisplayText && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DisplayTextInputField, {
|
|
404
405
|
autoComplete: "off",
|
|
405
406
|
name: "displayText",
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
._2hwx1b66{margin-right:var(--ds-space-050,4px)}
|
|
5
5
|
._7yjtidpf >div{margin-top:0}
|
|
6
6
|
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
7
|
+
._bozgv77o{padding-inline-start:var(--ds-space-025,2px)}
|
|
7
8
|
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
9
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
8
10
|
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
9
11
|
._onzypxbi+._onzypxbi{margin-top:var(--ds-space-200,1pc)}
|
|
10
12
|
._s7n4nkob{vertical-align:middle}
|
|
13
|
+
._syaz1tmw{color:var(--ds-text-danger,#ae2e24)}
|
|
11
14
|
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
@@ -7,13 +7,14 @@ import { useMergeRefs } from 'use-callback-ref';
|
|
|
7
7
|
import { ErrorMessage, Field } from '@atlaskit/form';
|
|
8
8
|
import Selectclear from '@atlaskit/icon/core/migration/cross-circle--select-clear';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
10
|
+
import { Box, Pressable } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import Textfield from '@atlaskit/textfield';
|
|
12
12
|
import Tooltip from '@atlaskit/tooltip';
|
|
13
13
|
import { ConditionalSpotlightTargetWrapper } from './conditional-spotlight-target-wrapper';
|
|
14
14
|
import { isRedoEvent, isUndoEvent } from './utils';
|
|
15
15
|
const styles = {
|
|
16
|
-
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob"
|
|
16
|
+
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob",
|
|
17
|
+
requiredIndicatorStyles: "_syaz1tmw _ect41gqc _bozgv77o"
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -22,6 +23,13 @@ const styles = {
|
|
|
22
23
|
*/
|
|
23
24
|
const baseFieldStyles = null;
|
|
24
25
|
const newFieldStyles = null;
|
|
26
|
+
const RequiredAsterisk = () => {
|
|
27
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
28
|
+
as: "span",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
xcss: styles.requiredIndicatorStyles
|
|
31
|
+
}, "*");
|
|
32
|
+
};
|
|
25
33
|
export const testIds = {
|
|
26
34
|
urlError: 'link-error',
|
|
27
35
|
clearUrlButton: 'clear-text'
|
|
@@ -38,6 +46,7 @@ export const TextInput = ({
|
|
|
38
46
|
error,
|
|
39
47
|
spotlightTargetName,
|
|
40
48
|
inputRef: inputRefProp,
|
|
49
|
+
isRequired = false,
|
|
41
50
|
...restProps
|
|
42
51
|
}) => {
|
|
43
52
|
const inputRef = useRef(null);
|
|
@@ -52,15 +61,8 @@ export const TextInput = ({
|
|
|
52
61
|
}
|
|
53
62
|
}
|
|
54
63
|
}, [autoFocus]);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
58
|
-
const refs = useMemo(() => [handleRef, inputRefProp].filter(Boolean), [handleRef, inputRefProp]);
|
|
59
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
60
|
-
textfieldRef = useMergeRefs(refs);
|
|
61
|
-
} else {
|
|
62
|
-
textfieldRef = handleRef;
|
|
63
|
-
}
|
|
64
|
+
const refs = useMemo(() => [handleRef, inputRefProp].filter(Boolean), [handleRef, inputRefProp]);
|
|
65
|
+
const textfieldRef = useMergeRefs(refs);
|
|
64
66
|
const handleKeydown = useCallback(e => {
|
|
65
67
|
if (typeof onUndo === 'function' && isUndoEvent(e)) {
|
|
66
68
|
e.preventDefault();
|
|
@@ -96,7 +98,8 @@ export const TextInput = ({
|
|
|
96
98
|
className: ax(["_7yjtidpf _onzypxbi", "_11c81vhk"])
|
|
97
99
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
98
100
|
label: label,
|
|
99
|
-
name: name
|
|
101
|
+
name: name,
|
|
102
|
+
elementAfterLabel: isRequired && fg('navx-1368-link-picker-a11y-mandatory-states') ? /*#__PURE__*/React.createElement(RequiredAsterisk, null) : undefined
|
|
100
103
|
}, ({
|
|
101
104
|
fieldProps
|
|
102
105
|
}) => {
|
|
@@ -107,7 +110,9 @@ export const TextInput = ({
|
|
|
107
110
|
ref: textfieldRef,
|
|
108
111
|
elemAfterInput: clearText,
|
|
109
112
|
isInvalid: !!error
|
|
110
|
-
}
|
|
113
|
+
}, fg('navx-1368-link-picker-a11y-mandatory-states') ? {
|
|
114
|
+
"aria-describedby": `${restProps["aria-describedby"]} ${fieldProps.id}-error`
|
|
115
|
+
} : {})), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
111
116
|
testId: testIds.urlError
|
|
112
117
|
}, error)));
|
|
113
118
|
}));
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -435,7 +435,8 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
435
435
|
onClear: handleUrlClear,
|
|
436
436
|
onKeyDown: handleKeyDown,
|
|
437
437
|
onChange: handleChangeUrl,
|
|
438
|
-
inputRef: inputRef
|
|
438
|
+
inputRef: inputRef,
|
|
439
|
+
isRequired: true
|
|
439
440
|
})), !hideDisplayText && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DisplayTextInputField, {
|
|
440
441
|
autoComplete: "off",
|
|
441
442
|
name: "displayText",
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
._2hwx1b66{margin-right:var(--ds-space-050,4px)}
|
|
5
5
|
._7yjtidpf >div{margin-top:0}
|
|
6
6
|
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
7
|
+
._bozgv77o{padding-inline-start:var(--ds-space-025,2px)}
|
|
7
8
|
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
9
|
+
._ect41gqc{font-family:var(--ds-font-family-body,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
8
10
|
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
9
11
|
._onzypxbi+._onzypxbi{margin-top:var(--ds-space-200,1pc)}
|
|
10
12
|
._s7n4nkob{vertical-align:middle}
|
|
13
|
+
._syaz1tmw{color:var(--ds-text-danger,#ae2e24)}
|
|
11
14
|
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName", "inputRef"];
|
|
4
|
+
var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName", "inputRef", "isRequired"];
|
|
5
5
|
import "./index.compiled.css";
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import React, { Fragment, useCallback, useMemo, useRef } from 'react';
|
|
@@ -9,13 +9,14 @@ import { useMergeRefs } from 'use-callback-ref';
|
|
|
9
9
|
import { ErrorMessage, Field } from '@atlaskit/form';
|
|
10
10
|
import Selectclear from '@atlaskit/icon/core/migration/cross-circle--select-clear';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
12
|
+
import { Box, Pressable } from '@atlaskit/primitives/compiled';
|
|
13
13
|
import Textfield from '@atlaskit/textfield';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
15
|
import { ConditionalSpotlightTargetWrapper } from './conditional-spotlight-target-wrapper';
|
|
16
16
|
import { isRedoEvent, isUndoEvent } from './utils';
|
|
17
17
|
var styles = {
|
|
18
|
-
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob"
|
|
18
|
+
clearTextButton: "_19itglyw _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _2hwx1b66 _bfhksm61 _s7n4nkob",
|
|
19
|
+
requiredIndicatorStyles: "_syaz1tmw _ect41gqc _bozgv77o"
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -24,6 +25,13 @@ var styles = {
|
|
|
24
25
|
*/
|
|
25
26
|
var baseFieldStyles = null;
|
|
26
27
|
var newFieldStyles = null;
|
|
28
|
+
var RequiredAsterisk = function RequiredAsterisk() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
30
|
+
as: "span",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
xcss: styles.requiredIndicatorStyles
|
|
33
|
+
}, "*");
|
|
34
|
+
};
|
|
27
35
|
export var testIds = {
|
|
28
36
|
urlError: 'link-error',
|
|
29
37
|
clearUrlButton: 'clear-text'
|
|
@@ -40,6 +48,8 @@ export var TextInput = function TextInput(_ref) {
|
|
|
40
48
|
error = _ref.error,
|
|
41
49
|
spotlightTargetName = _ref.spotlightTargetName,
|
|
42
50
|
inputRefProp = _ref.inputRef,
|
|
51
|
+
_ref$isRequired = _ref.isRequired,
|
|
52
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
43
53
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
44
54
|
var inputRef = useRef(null);
|
|
45
55
|
var handleRef = useCallback(function (input) {
|
|
@@ -53,17 +63,10 @@ export var TextInput = function TextInput(_ref) {
|
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
}, [autoFocus]);
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return [handleRef, inputRefProp].filter(Boolean);
|
|
61
|
-
}, [handleRef, inputRefProp]);
|
|
62
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
63
|
-
textfieldRef = useMergeRefs(refs);
|
|
64
|
-
} else {
|
|
65
|
-
textfieldRef = handleRef;
|
|
66
|
-
}
|
|
66
|
+
var refs = useMemo(function () {
|
|
67
|
+
return [handleRef, inputRefProp].filter(Boolean);
|
|
68
|
+
}, [handleRef, inputRefProp]);
|
|
69
|
+
var textfieldRef = useMergeRefs(refs);
|
|
67
70
|
var handleKeydown = useCallback(function (e) {
|
|
68
71
|
if (typeof onUndo === 'function' && isUndoEvent(e)) {
|
|
69
72
|
e.preventDefault();
|
|
@@ -99,7 +102,8 @@ export var TextInput = function TextInput(_ref) {
|
|
|
99
102
|
className: ax(["_7yjtidpf _onzypxbi", "_11c81vhk"])
|
|
100
103
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
101
104
|
label: label,
|
|
102
|
-
name: name
|
|
105
|
+
name: name,
|
|
106
|
+
elementAfterLabel: isRequired && fg('navx-1368-link-picker-a11y-mandatory-states') ? /*#__PURE__*/React.createElement(RequiredAsterisk, null) : undefined
|
|
103
107
|
}, function (_ref2) {
|
|
104
108
|
var fieldProps = _ref2.fieldProps;
|
|
105
109
|
return /*#__PURE__*/React.createElement(ConditionalSpotlightTargetWrapper, {
|
|
@@ -109,7 +113,9 @@ export var TextInput = function TextInput(_ref) {
|
|
|
109
113
|
ref: textfieldRef,
|
|
110
114
|
elemAfterInput: clearText,
|
|
111
115
|
isInvalid: !!error
|
|
112
|
-
}
|
|
116
|
+
}, fg('navx-1368-link-picker-a11y-mandatory-states') ? {
|
|
117
|
+
"aria-describedby": "".concat(restProps["aria-describedby"], " ").concat(fieldProps.id, "-error")
|
|
118
|
+
} : {})), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
113
119
|
testId: testIds.urlError
|
|
114
120
|
}, error)));
|
|
115
121
|
}));
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -9,9 +9,9 @@ type InputFields = 'link' | 'displayText';
|
|
|
9
9
|
* @returns HOC Input field with tracking
|
|
10
10
|
*/
|
|
11
11
|
export declare const withInputFieldTracking: <P extends {
|
|
12
|
-
onBlur?: (
|
|
13
|
-
onChange?: (
|
|
14
|
-
onClear?: Function
|
|
15
|
-
onFocus?: (
|
|
12
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
13
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
onClear?: Function;
|
|
15
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
16
16
|
}, Field extends InputFields>(WrappedComponent: React.ComponentType<P>, field: Field, filterOnChangeEventAttrs?: <OnChangeAttributes extends Partial<LinkPickerAnalyticsContextType>>(event: React.ChangeEvent<HTMLInputElement>, attributes: OnChangeAttributes) => OnChangeAttributes) => React.ComponentType<P>;
|
|
17
17
|
export {};
|
package/dist/types/ui/index.d.ts
CHANGED
package/dist/types/ui/lazy.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export declare const testIds: {
|
|
|
21
21
|
urlError: string;
|
|
22
22
|
clearUrlButton: string;
|
|
23
23
|
};
|
|
24
|
-
export declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, inputRef: inputRefProp, ...restProps }: TextInputProps) => JSX.Element;
|
|
24
|
+
export declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, inputRef: inputRefProp, isRequired, ...restProps }: TextInputProps) => JSX.Element;
|
|
@@ -9,9 +9,9 @@ type InputFields = 'link' | 'displayText';
|
|
|
9
9
|
* @returns HOC Input field with tracking
|
|
10
10
|
*/
|
|
11
11
|
export declare const withInputFieldTracking: <P extends {
|
|
12
|
-
onBlur?: (
|
|
13
|
-
onChange?: (
|
|
14
|
-
onClear?: Function
|
|
15
|
-
onFocus?: (
|
|
12
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
13
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
onClear?: Function;
|
|
15
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
16
16
|
}, Field extends InputFields>(WrappedComponent: React.ComponentType<P>, field: Field, filterOnChangeEventAttrs?: <OnChangeAttributes extends Partial<LinkPickerAnalyticsContextType>>(event: React.ChangeEvent<HTMLInputElement>, attributes: OnChangeAttributes) => OnChangeAttributes) => React.ComponentType<P>;
|
|
17
17
|
export {};
|
|
@@ -21,4 +21,4 @@ export declare const testIds: {
|
|
|
21
21
|
urlError: string;
|
|
22
22
|
clearUrlButton: string;
|
|
23
23
|
};
|
|
24
|
-
export declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, inputRef: inputRefProp, ...restProps }: TextInputProps) => JSX.Element;
|
|
24
|
+
export declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, inputRef: inputRefProp, isRequired, ...restProps }: TextInputProps) => JSX.Element;
|
package/lazy/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-picker",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.4",
|
|
4
4
|
"description": "Standalone link picker",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,23 +39,17 @@
|
|
|
39
39
|
"platform-linking-link-picker-previewable-only": {
|
|
40
40
|
"type": "boolean"
|
|
41
41
|
},
|
|
42
|
-
"icon-object-migration": {
|
|
43
|
-
"type": "boolean"
|
|
44
|
-
},
|
|
45
42
|
"platform-visual-refresh-icons": {
|
|
46
43
|
"type": "boolean"
|
|
47
44
|
},
|
|
48
|
-
"platform_support_live_doc_icons_in_link_picker": {
|
|
49
|
-
"type": "boolean"
|
|
50
|
-
},
|
|
51
|
-
"jsc_inline_editing_field_refactor": {
|
|
52
|
-
"type": "boolean"
|
|
53
|
-
},
|
|
54
45
|
"dst-a11y__replace-anchor-with-link__linking-platfo": {
|
|
55
46
|
"type": "boolean"
|
|
56
47
|
},
|
|
57
48
|
"should-render-to-parent-should-be-true-linking-pla": {
|
|
58
49
|
"type": "boolean"
|
|
50
|
+
},
|
|
51
|
+
"navx-1368-link-picker-a11y-mandatory-states": {
|
|
52
|
+
"type": "boolean"
|
|
59
53
|
}
|
|
60
54
|
},
|
|
61
55
|
"scripts": {
|
|
@@ -64,12 +58,12 @@
|
|
|
64
58
|
"dependencies": {
|
|
65
59
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
66
60
|
"@atlaskit/atlassian-context": "^0.4.0",
|
|
67
|
-
"@atlaskit/button": "^23.
|
|
61
|
+
"@atlaskit/button": "^23.4.0",
|
|
68
62
|
"@atlaskit/css": "^0.12.0",
|
|
69
|
-
"@atlaskit/form": "^12.
|
|
63
|
+
"@atlaskit/form": "^12.1.0",
|
|
70
64
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
71
65
|
"@atlaskit/heading": "^5.2.0",
|
|
72
|
-
"@atlaskit/icon": "^27.
|
|
66
|
+
"@atlaskit/icon": "^27.12.0",
|
|
73
67
|
"@atlaskit/intl-messages-provider": "^2.0.0",
|
|
74
68
|
"@atlaskit/link": "^3.2.0",
|
|
75
69
|
"@atlaskit/link-provider": "^3.4.0",
|
|
@@ -77,7 +71,7 @@
|
|
|
77
71
|
"@atlaskit/onboarding": "^14.3.0",
|
|
78
72
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
79
73
|
"@atlaskit/primitives": "^14.11.0",
|
|
80
|
-
"@atlaskit/smart-card": "^40.
|
|
74
|
+
"@atlaskit/smart-card": "^40.10.0",
|
|
81
75
|
"@atlaskit/spinner": "^19.0.0",
|
|
82
76
|
"@atlaskit/tabs": "^18.1.0",
|
|
83
77
|
"@atlaskit/textfield": "^8.0.0",
|
|
@@ -119,8 +113,7 @@
|
|
|
119
113
|
"node-fetch": "^2.6.7",
|
|
120
114
|
"prettier": "^3.2.5",
|
|
121
115
|
"react-dom": "^18.2.0",
|
|
122
|
-
"sinon": "^2.2.0"
|
|
123
|
-
"typescript": "~5.4.2"
|
|
116
|
+
"sinon": "^2.2.0"
|
|
124
117
|
},
|
|
125
118
|
"techstack": {
|
|
126
119
|
"@atlassian/frontend": {
|