@atlaskit/link-create 2.5.3 → 2.7.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/common/constants.js +1 -1
  3. package/dist/cjs/common/ui/icon/index.js +33 -0
  4. package/dist/cjs/index.js +25 -0
  5. package/dist/cjs/ui/create-form/select/index.js +6 -0
  6. package/dist/cjs/ui/create-form/select/main.js +71 -4
  7. package/dist/cjs/ui/create-form/select/messages.js +14 -0
  8. package/dist/cjs/ui/index.js +10 -4
  9. package/dist/es2019/common/constants.js +1 -1
  10. package/dist/es2019/common/ui/icon/index.js +24 -0
  11. package/dist/es2019/index.js +4 -6
  12. package/dist/es2019/ui/create-form/select/index.js +1 -1
  13. package/dist/es2019/ui/create-form/select/main.js +58 -2
  14. package/dist/es2019/ui/create-form/select/messages.js +8 -0
  15. package/dist/es2019/ui/index.js +4 -4
  16. package/dist/esm/common/constants.js +1 -1
  17. package/dist/esm/common/ui/icon/index.js +26 -0
  18. package/dist/esm/index.js +4 -6
  19. package/dist/esm/ui/create-form/select/index.js +1 -1
  20. package/dist/esm/ui/create-form/select/main.js +67 -3
  21. package/dist/esm/ui/create-form/select/messages.js +8 -0
  22. package/dist/esm/ui/index.js +4 -4
  23. package/dist/types/common/ui/icon/index.d.ts +8 -0
  24. package/dist/types/index.d.ts +4 -3
  25. package/dist/types/ui/create-form/select/index.d.ts +2 -1
  26. package/dist/types/ui/create-form/select/main.d.ts +11 -2
  27. package/dist/types/ui/create-form/select/messages.d.ts +7 -0
  28. package/dist/types/ui/create-form/select/types.d.ts +9 -0
  29. package/dist/types/ui/index.d.ts +6 -5
  30. package/dist/types/ui/inline-create/index.d.ts +2 -2
  31. package/dist/types-ts4.5/common/ui/icon/index.d.ts +8 -0
  32. package/dist/types-ts4.5/index.d.ts +4 -3
  33. package/dist/types-ts4.5/ui/create-form/select/index.d.ts +2 -1
  34. package/dist/types-ts4.5/ui/create-form/select/main.d.ts +11 -2
  35. package/dist/types-ts4.5/ui/create-form/select/messages.d.ts +7 -0
  36. package/dist/types-ts4.5/ui/create-form/select/types.d.ts +9 -0
  37. package/dist/types-ts4.5/ui/index.d.ts +6 -5
  38. package/dist/types-ts4.5/ui/inline-create/index.d.ts +2 -2
  39. package/package.json +4 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#112648](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112648)
8
+ [`3cd8fd44d0d08`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3cd8fd44d0d08) -
9
+ Export new InlineCreate component alongside related docs
10
+
11
+ ## 2.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#114849](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114849)
16
+ [`3ddb026a666ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3ddb026a666ce) -
17
+ [ux] Added a site picker to the goal form. And moved the SiteSelect from link-create-confluence to
18
+ link-create so that theres no circular dependency between link-create-goal and
19
+ link-create-confluence. Also, added sites as a prop to pass in to goal picker
20
+
21
+ "breaking" change which is that the peer dependency in (link-create-goal & link-create-confluence)
22
+ must also be bumped/checked is in range
23
+
3
24
  ## 2.5.3
4
25
 
5
26
  ### Patch Changes
@@ -13,7 +13,7 @@ var CREATE_FORM_MIN_HEIGHT_IN_PX = exports.CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
13
13
  var LINK_CREATE_FORM_POST_CREATE_FIELD = exports.LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
14
14
  var PACKAGE_DATA = exports.PACKAGE_DATA = {
15
15
  packageName: "@atlaskit/link-create" || '',
16
- packageVersion: "2.5.3" || '',
16
+ packageVersion: "2.7.0" || '',
17
17
  component: COMPONENT_NAME,
18
18
  componentName: COMPONENT_NAME
19
19
  };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.UrlIcon = exports.PageIcon = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
10
+ var _ = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/document/16"));
11
+ var _colors = require("@atlaskit/theme/colors");
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
+
14
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
15
+ var UrlIcon = exports.UrlIcon = _styled.default.div(function (props) {
16
+ var _props$url;
17
+ return {
18
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
19
+ backgroundImage: "url(".concat((_props$url = props.url) !== null && _props$url !== void 0 ? _props$url : '', ")"),
20
+ backgroundColor: "var(--ds-skeleton, ".concat(_colors.N20A, ")"),
21
+ backgroundSize: 'contain',
22
+ backgroundRepeat: 'no-repeat',
23
+ height: "var(--ds-space-200, 16px)",
24
+ width: "var(--ds-space-200, 16px)",
25
+ borderRadius: "var(--ds-border-radius, 3px)",
26
+ flexShrink: 0
27
+ };
28
+ });
29
+ var PageIcon = exports.PageIcon = function PageIcon() {
30
+ return /*#__PURE__*/_react.default.createElement(_.default, {
31
+ label: "Page"
32
+ });
33
+ };
package/dist/cjs/index.js CHANGED
@@ -34,6 +34,12 @@ Object.defineProperty(exports, "FormSpy", {
34
34
  return _index.FormSpy;
35
35
  }
36
36
  });
37
+ Object.defineProperty(exports, "InlineCreate", {
38
+ enumerable: true,
39
+ get: function get() {
40
+ return _index.InlineCreate;
41
+ }
42
+ });
37
43
  Object.defineProperty(exports, "LinkCreateCallbackProvider", {
38
44
  enumerable: true,
39
45
  get: function get() {
@@ -46,18 +52,36 @@ Object.defineProperty(exports, "LinkCreateExitWarningProvider", {
46
52
  return _exitWarningModalContext.ExitWarningModalProvider;
47
53
  }
48
54
  });
55
+ Object.defineProperty(exports, "PageIcon", {
56
+ enumerable: true,
57
+ get: function get() {
58
+ return _icon.PageIcon;
59
+ }
60
+ });
49
61
  Object.defineProperty(exports, "Select", {
50
62
  enumerable: true,
51
63
  get: function get() {
52
64
  return _index.Select;
53
65
  }
54
66
  });
67
+ Object.defineProperty(exports, "SiteSelect", {
68
+ enumerable: true,
69
+ get: function get() {
70
+ return _index.SiteSelect;
71
+ }
72
+ });
55
73
  Object.defineProperty(exports, "TextField", {
56
74
  enumerable: true,
57
75
  get: function get() {
58
76
  return _index.TextField;
59
77
  }
60
78
  });
79
+ Object.defineProperty(exports, "UrlIcon", {
80
+ enumerable: true,
81
+ get: function get() {
82
+ return _icon.UrlIcon;
83
+ }
84
+ });
61
85
  Object.defineProperty(exports, "UserPicker", {
62
86
  enumerable: true,
63
87
  get: function get() {
@@ -86,5 +110,6 @@ var _index = _interopRequireWildcard(require("./ui/index"));
86
110
  var _callbackContext = require("./controllers/callback-context");
87
111
  var _exitWarningModalContext = require("./controllers/exit-warning-modal-context");
88
112
  var _finalForm = require("final-form");
113
+ var _icon = require("./common/ui/icon");
89
114
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
90
115
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -9,4 +9,10 @@ Object.defineProperty(exports, "Select", {
9
9
  return _main.Select;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "SiteSelect", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _main.SiteSelect;
16
+ }
17
+ });
12
18
  var _main = require("./main");
@@ -1,21 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.Select = Select;
8
- exports.TEST_ID = void 0;
9
+ exports.TEST_ID = exports.SiteSelect = exports.SitePickerSingleValue = exports.SitePickerOption = void 0;
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
13
  var _react = require("@emotion/react");
12
- var _select = _interopRequireDefault(require("@atlaskit/select"));
14
+ var _reactIntlNext = require("react-intl-next");
15
+ var _primitives = require("@atlaskit/primitives");
16
+ var _select = _interopRequireWildcard(require("@atlaskit/select"));
17
+ var _constants = require("@atlaskit/theme/constants");
18
+ var _icon = require("../../../common/ui/icon");
13
19
  var _createField = require("../../../controllers/create-field");
20
+ var _messages = require("./messages");
14
21
  var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
15
- _excluded2 = ["fieldId"];
22
+ _excluded2 = ["fieldId"],
23
+ _excluded3 = ["children"],
24
+ _excluded4 = ["children"];
16
25
  /** @jsx jsx */
17
26
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
28
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
29
+ 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; }
30
+ 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) { (0, _defineProperty2.default)(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; }
18
31
  var TEST_ID = exports.TEST_ID = 'link-create-select';
32
+
19
33
  /**
20
34
  * A select component utilising the Atlaskit Select and CreateField.
21
35
  * Validation is handled by the form on form submission. Any
@@ -47,4 +61,57 @@ function Select(_ref) {
47
61
  inputId: fieldId
48
62
  }, fieldProps, restProps));
49
63
  });
50
- }
64
+ }
65
+ var SiteSelect = exports.SiteSelect = function SiteSelect(_ref3) {
66
+ var options = _ref3.options,
67
+ name = _ref3.name,
68
+ testId = _ref3.testId;
69
+ var intl = (0, _reactIntlNext.useIntl)();
70
+ var siteTestId = testId ? testId : 'link-create-site-picker';
71
+ return (0, _react.jsx)(Select, {
72
+ isRequired: true,
73
+ isSearchable: true,
74
+ name: name !== null && name !== void 0 ? name : 'site',
75
+ options: options,
76
+ label: intl.formatMessage(_messages.messages.siteLabel),
77
+ components: {
78
+ Option: SitePickerOption,
79
+ SingleValue: SitePickerSingleValue
80
+ },
81
+ testId: siteTestId,
82
+ styles: {
83
+ menuPortal: function menuPortal(base) {
84
+ return _objectSpread(_objectSpread({}, base), {}, {
85
+ zIndex: _constants.layers.modal()
86
+ });
87
+ },
88
+ option: function option(base) {
89
+ return _objectSpread(_objectSpread({}, base), {}, {
90
+ display: 'flex',
91
+ alignItems: 'center',
92
+ cursor: 'pointer'
93
+ });
94
+ }
95
+ }
96
+ });
97
+ };
98
+ var SitePickerOption = exports.SitePickerOption = function SitePickerOption(_ref4) {
99
+ var children = _ref4.children,
100
+ props = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
101
+ return (0, _react.jsx)(_select.components.Option, props, (0, _react.jsx)(_primitives.Inline, {
102
+ space: "space.100",
103
+ alignBlock: "center"
104
+ }, (0, _react.jsx)(_icon.UrlIcon, {
105
+ url: props.data.value.avatarUrl
106
+ }), children));
107
+ };
108
+ var SitePickerSingleValue = exports.SitePickerSingleValue = function SitePickerSingleValue(_ref5) {
109
+ var children = _ref5.children,
110
+ props = (0, _objectWithoutProperties2.default)(_ref5, _excluded4);
111
+ return (0, _react.jsx)(_select.components.SingleValue, props, (0, _react.jsx)(_primitives.Inline, {
112
+ space: "space.100",
113
+ alignBlock: "center"
114
+ }, (0, _react.jsx)(_icon.UrlIcon, {
115
+ url: props.data.value.avatarUrl
116
+ }), children));
117
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.messages = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
+ siteLabel: {
10
+ id: 'linkCreate.CreateConfluencePage.form.site.label',
11
+ defaultMessage: 'Site',
12
+ description: 'Label for the Site dropdown list'
13
+ }
14
+ });
@@ -40,6 +40,12 @@ Object.defineProperty(exports, "Select", {
40
40
  return _select.Select;
41
41
  }
42
42
  });
43
+ Object.defineProperty(exports, "SiteSelect", {
44
+ enumerable: true,
45
+ get: function get() {
46
+ return _select.SiteSelect;
47
+ }
48
+ });
43
49
  Object.defineProperty(exports, "TextField", {
44
50
  enumerable: true,
45
51
  get: function get() {
@@ -58,12 +64,12 @@ Object.defineProperty(exports, "default", {
58
64
  return _modalCreate.default;
59
65
  }
60
66
  });
61
- var _modalCreate = _interopRequireDefault(require("./modal-create"));
62
67
  var _inlineCreate = _interopRequireDefault(require("./inline-create"));
68
+ var _modalCreate = _interopRequireDefault(require("./modal-create"));
63
69
  var _textfield = require("./create-form/textfield");
64
- var _main = require("./create-form/main");
65
- var _formLoader = require("./create-form/form-loader");
66
- var _select = require("./create-form/select");
67
70
  var _asyncSelect = require("./create-form/async-select");
71
+ var _formLoader = require("./create-form/form-loader");
68
72
  var _formSpy = require("./create-form/form-spy");
73
+ var _main = require("./create-form/main");
74
+ var _select = require("./create-form/select");
69
75
  var _userPicker = require("./create-form/user-picker");
@@ -7,7 +7,7 @@ export const CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
7
7
  export const LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
8
8
  export const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/link-create" || '',
10
- packageVersion: "2.5.3" || '',
10
+ packageVersion: "2.7.0" || '',
11
11
  component: COMPONENT_NAME,
12
12
  componentName: COMPONENT_NAME
13
13
  };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
+ import styled from '@emotion/styled';
5
+ import Document16Icon from '@atlaskit/icon-file-type/glyph/document/16';
6
+ import { N20A } from '@atlaskit/theme/colors';
7
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
8
+ export const UrlIcon = styled.div(props => {
9
+ var _props$url;
10
+ return {
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
12
+ backgroundImage: `url(${(_props$url = props.url) !== null && _props$url !== void 0 ? _props$url : ''})`,
13
+ backgroundColor: `var(--ds-skeleton, ${N20A})`,
14
+ backgroundSize: 'contain',
15
+ backgroundRepeat: 'no-repeat',
16
+ height: "var(--ds-space-200, 16px)",
17
+ width: "var(--ds-space-200, 16px)",
18
+ borderRadius: "var(--ds-border-radius, 3px)",
19
+ flexShrink: 0
20
+ };
21
+ });
22
+ export const PageIcon = () => /*#__PURE__*/React.createElement(Document16Icon, {
23
+ label: "Page"
24
+ });
@@ -1,7 +1,5 @@
1
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy,
2
- // todo: EDM-10077 - export this once inline-create is tested/ready
3
- //InlineCreate,
4
- UserPicker } from './ui/index';
5
- export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
1
+ export { AsyncSelect, CreateForm, CreateFormLoader, FormSpy, Select, SiteSelect, TextField, InlineCreate, UserPicker, default } from './ui/index';
2
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './controllers/callback-context';
6
3
  export { ExitWarningModalProvider as LinkCreateExitWarningProvider, useWithExitWarning } from './controllers/exit-warning-modal-context';
7
- export { FORM_ERROR } from 'final-form';
4
+ export { FORM_ERROR } from 'final-form';
5
+ export { PageIcon, UrlIcon } from './common/ui/icon';
@@ -1 +1 @@
1
- export { Select } from './main';
1
+ export { Select, SiteSelect } from './main';
@@ -3,9 +3,15 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
 
4
4
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
5
  import { jsx } from '@emotion/react';
6
- import AkSelect from '@atlaskit/select';
6
+ import { useIntl } from 'react-intl-next';
7
+ import { Inline } from '@atlaskit/primitives';
8
+ import AkSelect, { components } from '@atlaskit/select';
9
+ import { layers } from '@atlaskit/theme/constants';
10
+ import { UrlIcon } from '../../../common/ui/icon';
7
11
  import { CreateField } from '../../../controllers/create-field';
12
+ import { messages } from './messages';
8
13
  export const TEST_ID = 'link-create-select';
14
+
9
15
  /**
10
16
  * A select component utilising the Atlaskit Select and CreateField.
11
17
  * Validation is handled by the form on form submission. Any
@@ -38,4 +44,54 @@ export function Select({
38
44
  inputId: fieldId
39
45
  }, fieldProps, restProps));
40
46
  });
41
- }
47
+ }
48
+ export const SiteSelect = ({
49
+ options,
50
+ name,
51
+ testId
52
+ }) => {
53
+ const intl = useIntl();
54
+ const siteTestId = testId ? testId : 'link-create-site-picker';
55
+ return jsx(Select, {
56
+ isRequired: true,
57
+ isSearchable: true,
58
+ name: name !== null && name !== void 0 ? name : 'site',
59
+ options: options,
60
+ label: intl.formatMessage(messages.siteLabel),
61
+ components: {
62
+ Option: SitePickerOption,
63
+ SingleValue: SitePickerSingleValue
64
+ },
65
+ testId: siteTestId,
66
+ styles: {
67
+ menuPortal: base => ({
68
+ ...base,
69
+ zIndex: layers.modal()
70
+ }),
71
+ option: base => ({
72
+ ...base,
73
+ display: 'flex',
74
+ alignItems: 'center',
75
+ cursor: 'pointer'
76
+ })
77
+ }
78
+ });
79
+ };
80
+ export const SitePickerOption = ({
81
+ children,
82
+ ...props
83
+ }) => jsx(components.Option, props, jsx(Inline, {
84
+ space: "space.100",
85
+ alignBlock: "center"
86
+ }, jsx(UrlIcon, {
87
+ url: props.data.value.avatarUrl
88
+ }), children));
89
+ export const SitePickerSingleValue = ({
90
+ children,
91
+ ...props
92
+ }) => jsx(components.SingleValue, props, jsx(Inline, {
93
+ space: "space.100",
94
+ alignBlock: "center"
95
+ }, jsx(UrlIcon, {
96
+ url: props.data.value.avatarUrl
97
+ }), children));
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const messages = defineMessages({
3
+ siteLabel: {
4
+ id: 'linkCreate.CreateConfluencePage.form.site.label',
5
+ defaultMessage: 'Site',
6
+ description: 'Label for the Site dropdown list'
7
+ }
8
+ });
@@ -1,9 +1,9 @@
1
- export { default } from './modal-create';
2
1
  export { default as InlineCreate } from './inline-create';
2
+ export { default } from './modal-create';
3
3
  export { TextField } from './create-form/textfield';
4
- export { CreateForm } from './create-form/main';
5
- export { CreateFormLoader } from './create-form/form-loader';
6
- export { Select } from './create-form/select';
7
4
  export { AsyncSelect } from './create-form/async-select';
5
+ export { CreateFormLoader } from './create-form/form-loader';
8
6
  export { FormSpy } from './create-form/form-spy';
7
+ export { CreateForm } from './create-form/main';
8
+ export { Select, SiteSelect } from './create-form/select';
9
9
  export { UserPicker } from './create-form/user-picker';
@@ -7,7 +7,7 @@ export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
7
7
  export var LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
8
8
  export var PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/link-create" || '',
10
- packageVersion: "2.5.3" || '',
10
+ packageVersion: "2.7.0" || '',
11
11
  component: COMPONENT_NAME,
12
12
  componentName: COMPONENT_NAME
13
13
  };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
+ import styled from '@emotion/styled';
5
+ import Document16Icon from '@atlaskit/icon-file-type/glyph/document/16';
6
+ import { N20A } from '@atlaskit/theme/colors';
7
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
8
+ export var UrlIcon = styled.div(function (props) {
9
+ var _props$url;
10
+ return {
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
12
+ backgroundImage: "url(".concat((_props$url = props.url) !== null && _props$url !== void 0 ? _props$url : '', ")"),
13
+ backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")"),
14
+ backgroundSize: 'contain',
15
+ backgroundRepeat: 'no-repeat',
16
+ height: "var(--ds-space-200, 16px)",
17
+ width: "var(--ds-space-200, 16px)",
18
+ borderRadius: "var(--ds-border-radius, 3px)",
19
+ flexShrink: 0
20
+ };
21
+ });
22
+ export var PageIcon = function PageIcon() {
23
+ return /*#__PURE__*/React.createElement(Document16Icon, {
24
+ label: "Page"
25
+ });
26
+ };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,5 @@
1
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy,
2
- // todo: EDM-10077 - export this once inline-create is tested/ready
3
- //InlineCreate,
4
- UserPicker } from './ui/index';
5
- export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
1
+ export { AsyncSelect, CreateForm, CreateFormLoader, FormSpy, Select, SiteSelect, TextField, InlineCreate, UserPicker, default } from './ui/index';
2
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './controllers/callback-context';
6
3
  export { ExitWarningModalProvider as LinkCreateExitWarningProvider, useWithExitWarning } from './controllers/exit-warning-modal-context';
7
- export { FORM_ERROR } from 'final-form';
4
+ export { FORM_ERROR } from 'final-form';
5
+ export { PageIcon, UrlIcon } from './common/ui/icon';
@@ -1 +1 @@
1
- export { Select } from './main';
1
+ export { Select, SiteSelect } from './main';
@@ -1,14 +1,25 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
4
- _excluded2 = ["fieldId"];
5
+ _excluded2 = ["fieldId"],
6
+ _excluded3 = ["children"],
7
+ _excluded4 = ["children"];
8
+ 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; }
9
+ 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
10
  /** @jsx jsx */
6
11
 
7
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
13
  import { jsx } from '@emotion/react';
9
- import AkSelect from '@atlaskit/select';
14
+ import { useIntl } from 'react-intl-next';
15
+ import { Inline } from '@atlaskit/primitives';
16
+ import AkSelect, { components } from '@atlaskit/select';
17
+ import { layers } from '@atlaskit/theme/constants';
18
+ import { UrlIcon } from '../../../common/ui/icon';
10
19
  import { CreateField } from '../../../controllers/create-field';
20
+ import { messages } from './messages';
11
21
  export var TEST_ID = 'link-create-select';
22
+
12
23
  /**
13
24
  * A select component utilising the Atlaskit Select and CreateField.
14
25
  * Validation is handled by the form on form submission. Any
@@ -40,4 +51,57 @@ export function Select(_ref) {
40
51
  inputId: fieldId
41
52
  }, fieldProps, restProps));
42
53
  });
43
- }
54
+ }
55
+ export var SiteSelect = function SiteSelect(_ref3) {
56
+ var options = _ref3.options,
57
+ name = _ref3.name,
58
+ testId = _ref3.testId;
59
+ var intl = useIntl();
60
+ var siteTestId = testId ? testId : 'link-create-site-picker';
61
+ return jsx(Select, {
62
+ isRequired: true,
63
+ isSearchable: true,
64
+ name: name !== null && name !== void 0 ? name : 'site',
65
+ options: options,
66
+ label: intl.formatMessage(messages.siteLabel),
67
+ components: {
68
+ Option: SitePickerOption,
69
+ SingleValue: SitePickerSingleValue
70
+ },
71
+ testId: siteTestId,
72
+ styles: {
73
+ menuPortal: function menuPortal(base) {
74
+ return _objectSpread(_objectSpread({}, base), {}, {
75
+ zIndex: layers.modal()
76
+ });
77
+ },
78
+ option: function option(base) {
79
+ return _objectSpread(_objectSpread({}, base), {}, {
80
+ display: 'flex',
81
+ alignItems: 'center',
82
+ cursor: 'pointer'
83
+ });
84
+ }
85
+ }
86
+ });
87
+ };
88
+ export var SitePickerOption = function SitePickerOption(_ref4) {
89
+ var children = _ref4.children,
90
+ props = _objectWithoutProperties(_ref4, _excluded3);
91
+ return jsx(components.Option, props, jsx(Inline, {
92
+ space: "space.100",
93
+ alignBlock: "center"
94
+ }, jsx(UrlIcon, {
95
+ url: props.data.value.avatarUrl
96
+ }), children));
97
+ };
98
+ export var SitePickerSingleValue = function SitePickerSingleValue(_ref5) {
99
+ var children = _ref5.children,
100
+ props = _objectWithoutProperties(_ref5, _excluded4);
101
+ return jsx(components.SingleValue, props, jsx(Inline, {
102
+ space: "space.100",
103
+ alignBlock: "center"
104
+ }, jsx(UrlIcon, {
105
+ url: props.data.value.avatarUrl
106
+ }), children));
107
+ };
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ siteLabel: {
4
+ id: 'linkCreate.CreateConfluencePage.form.site.label',
5
+ defaultMessage: 'Site',
6
+ description: 'Label for the Site dropdown list'
7
+ }
8
+ });
@@ -1,9 +1,9 @@
1
- export { default } from './modal-create';
2
1
  export { default as InlineCreate } from './inline-create';
2
+ export { default } from './modal-create';
3
3
  export { TextField } from './create-form/textfield';
4
- export { CreateForm } from './create-form/main';
5
- export { CreateFormLoader } from './create-form/form-loader';
6
- export { Select } from './create-form/select';
7
4
  export { AsyncSelect } from './create-form/async-select';
5
+ export { CreateFormLoader } from './create-form/form-loader';
8
6
  export { FormSpy } from './create-form/form-spy';
7
+ export { CreateForm } from './create-form/main';
8
+ export { Select, SiteSelect } from './create-form/select';
9
9
  export { UserPicker } from './create-form/user-picker';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare const UrlIcon: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: React.ElementType<any> | undefined;
5
+ } & {
6
+ url?: string | undefined;
7
+ }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
+ export declare const PageIcon: () => JSX.Element;
@@ -1,7 +1,8 @@
1
+ export type { CreatePayload, EditViewProps, LinkCreatePlugin, LinkCreateProps, LinkCreateWithModalProps, } from './common/types';
1
2
  export type { CreateFormProps } from './ui/index';
2
- export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, UserPicker, } from './ui/index';
4
- export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
3
+ export { AsyncSelect, CreateForm, CreateFormLoader, FormSpy, Select, SiteSelect, TextField, InlineCreate, UserPicker, default, type SitePickerOptionType, } from './ui/index';
4
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './controllers/callback-context';
5
5
  export { ExitWarningModalProvider as LinkCreateExitWarningProvider, useWithExitWarning, } from './controllers/exit-warning-modal-context';
6
6
  export type { Validator, ValidatorMap } from './common/types';
7
7
  export { FORM_ERROR } from 'final-form';
8
+ export { PageIcon, UrlIcon } from './common/ui/icon';
@@ -1 +1,2 @@
1
- export { Select } from './main';
1
+ export { Select, SiteSelect } from './main';
2
+ export { type SitePickerOptionType } from './types';
@@ -1,7 +1,8 @@
1
1
  /** @jsx jsx */
2
+ import { type PropsWithChildren } from 'react';
2
3
  import { jsx } from '@emotion/react';
3
- import { type OptionType } from '@atlaskit/select';
4
- import { type SelectProps } from './types';
4
+ import { type OptionProps, type OptionType, type SingleValueProps } from '@atlaskit/select';
5
+ import { type SelectProps, type SitePickerOptionType } from './types';
5
6
  export declare const TEST_ID = "link-create-select";
6
7
  /**
7
8
  * A select component utilising the Atlaskit Select and CreateField.
@@ -10,3 +11,11 @@ export declare const TEST_ID = "link-create-select";
10
11
  * have a key matching the `name` of this field are shown below the field.
11
12
  */
12
13
  export declare function Select<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: SelectProps<T>): jsx.JSX.Element;
14
+ export type SiteSelectProps = {
15
+ testId: string;
16
+ options?: SitePickerOptionType[];
17
+ name?: string;
18
+ };
19
+ export declare const SiteSelect: ({ options, name, testId }: SiteSelectProps) => jsx.JSX.Element;
20
+ export declare const SitePickerOption: ({ children, ...props }: PropsWithChildren<OptionProps<SitePickerOptionType, false>>) => JSX.Element;
21
+ export declare const SitePickerSingleValue: ({ children, ...props }: PropsWithChildren<SingleValueProps<SitePickerOptionType, false>>) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ siteLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -16,3 +16,12 @@ export type SelectProps<T = OptionType> = AKSelectProps<T> & {
16
16
  /** Validators for this field */
17
17
  validators?: Validator[];
18
18
  };
19
+ export type SitePickerOptionValue = {
20
+ avatarUrl?: string;
21
+ cloudId: string;
22
+ url: string;
23
+ };
24
+ export type SitePickerOptionType = {
25
+ label: string;
26
+ value: SitePickerOptionValue;
27
+ };
@@ -1,10 +1,11 @@
1
- export { default } from './modal-create';
2
1
  export { default as InlineCreate } from './inline-create';
2
+ export { default } from './modal-create';
3
3
  export { TextField } from './create-form/textfield';
4
- export { CreateForm } from './create-form/main';
5
- export { CreateFormLoader } from './create-form/form-loader';
6
- export type { CreateFormProps } from './create-form/main';
7
- export { Select } from './create-form/select';
8
4
  export { AsyncSelect } from './create-form/async-select';
5
+ export { CreateFormLoader } from './create-form/form-loader';
9
6
  export { FormSpy } from './create-form/form-spy';
7
+ export { CreateForm } from './create-form/main';
8
+ export type { CreateFormProps } from './create-form/main';
9
+ export { Select, SiteSelect } from './create-form/select';
10
+ export type { SitePickerOptionType } from './create-form/select';
10
11
  export { UserPicker } from './create-form/user-picker';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
- import type { LinkCreateWithModalProps } from '../../common/types';
4
- declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
3
+ import type { LinkCreateProps } from '../../common/types';
4
+ declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateProps) => jsx.JSX.Element>;
5
5
  export default ComposedLinkCreate;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare const UrlIcon: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: React.ElementType<any> | undefined;
5
+ } & {
6
+ url?: string | undefined;
7
+ }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
+ export declare const PageIcon: () => JSX.Element;
@@ -1,7 +1,8 @@
1
+ export type { CreatePayload, EditViewProps, LinkCreatePlugin, LinkCreateProps, LinkCreateWithModalProps, } from './common/types';
1
2
  export type { CreateFormProps } from './ui/index';
2
- export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, UserPicker, } from './ui/index';
4
- export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
3
+ export { AsyncSelect, CreateForm, CreateFormLoader, FormSpy, Select, SiteSelect, TextField, InlineCreate, UserPicker, default, type SitePickerOptionType, } from './ui/index';
4
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './controllers/callback-context';
5
5
  export { ExitWarningModalProvider as LinkCreateExitWarningProvider, useWithExitWarning, } from './controllers/exit-warning-modal-context';
6
6
  export type { Validator, ValidatorMap } from './common/types';
7
7
  export { FORM_ERROR } from 'final-form';
8
+ export { PageIcon, UrlIcon } from './common/ui/icon';
@@ -1 +1,2 @@
1
- export { Select } from './main';
1
+ export { Select, SiteSelect } from './main';
2
+ export { type SitePickerOptionType } from './types';
@@ -1,7 +1,8 @@
1
1
  /** @jsx jsx */
2
+ import { type PropsWithChildren } from 'react';
2
3
  import { jsx } from '@emotion/react';
3
- import { type OptionType } from '@atlaskit/select';
4
- import { type SelectProps } from './types';
4
+ import { type OptionProps, type OptionType, type SingleValueProps } from '@atlaskit/select';
5
+ import { type SelectProps, type SitePickerOptionType } from './types';
5
6
  export declare const TEST_ID = "link-create-select";
6
7
  /**
7
8
  * A select component utilising the Atlaskit Select and CreateField.
@@ -10,3 +11,11 @@ export declare const TEST_ID = "link-create-select";
10
11
  * have a key matching the `name` of this field are shown below the field.
11
12
  */
12
13
  export declare function Select<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: SelectProps<T>): jsx.JSX.Element;
14
+ export type SiteSelectProps = {
15
+ testId: string;
16
+ options?: SitePickerOptionType[];
17
+ name?: string;
18
+ };
19
+ export declare const SiteSelect: ({ options, name, testId }: SiteSelectProps) => jsx.JSX.Element;
20
+ export declare const SitePickerOption: ({ children, ...props }: PropsWithChildren<OptionProps<SitePickerOptionType, false>>) => JSX.Element;
21
+ export declare const SitePickerSingleValue: ({ children, ...props }: PropsWithChildren<SingleValueProps<SitePickerOptionType, false>>) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ siteLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -16,3 +16,12 @@ export type SelectProps<T = OptionType> = AKSelectProps<T> & {
16
16
  /** Validators for this field */
17
17
  validators?: Validator[];
18
18
  };
19
+ export type SitePickerOptionValue = {
20
+ avatarUrl?: string;
21
+ cloudId: string;
22
+ url: string;
23
+ };
24
+ export type SitePickerOptionType = {
25
+ label: string;
26
+ value: SitePickerOptionValue;
27
+ };
@@ -1,10 +1,11 @@
1
- export { default } from './modal-create';
2
1
  export { default as InlineCreate } from './inline-create';
2
+ export { default } from './modal-create';
3
3
  export { TextField } from './create-form/textfield';
4
- export { CreateForm } from './create-form/main';
5
- export { CreateFormLoader } from './create-form/form-loader';
6
- export type { CreateFormProps } from './create-form/main';
7
- export { Select } from './create-form/select';
8
4
  export { AsyncSelect } from './create-form/async-select';
5
+ export { CreateFormLoader } from './create-form/form-loader';
9
6
  export { FormSpy } from './create-form/form-spy';
7
+ export { CreateForm } from './create-form/main';
8
+ export type { CreateFormProps } from './create-form/main';
9
+ export { Select, SiteSelect } from './create-form/select';
10
+ export type { SitePickerOptionType } from './create-form/select';
10
11
  export { UserPicker } from './create-form/user-picker';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { jsx } from '@emotion/react';
3
- import type { LinkCreateWithModalProps } from '../../common/types';
4
- declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
3
+ import type { LinkCreateProps } from '../../common/types';
4
+ declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateProps) => jsx.JSX.Element>;
5
5
  export default ComposedLinkCreate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "2.5.3",
3
+ "version": "2.7.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,6 +43,7 @@
43
43
  "@atlaskit/empty-state": "^7.9.0",
44
44
  "@atlaskit/form": "^10.4.0",
45
45
  "@atlaskit/icon": "^22.5.0",
46
+ "@atlaskit/icon-file-type": "^6.4.0",
46
47
  "@atlaskit/intl-messages-provider": "^1.0.2",
47
48
  "@atlaskit/linking-common": "^5.7.0",
48
49
  "@atlaskit/modal-dialog": "^12.14.0",
@@ -51,9 +52,11 @@
51
52
  "@atlaskit/smart-user-picker": "^6.9.0",
52
53
  "@atlaskit/spinner": "^16.2.0",
53
54
  "@atlaskit/textfield": "^6.4.0",
55
+ "@atlaskit/theme": "^12.10.0",
54
56
  "@atlaskit/tokens": "^1.53.0",
55
57
  "@babel/runtime": "^7.0.0",
56
58
  "@emotion/react": "^11.7.1",
59
+ "@emotion/styled": "^11.0.0",
57
60
  "debounce-promise": "^3.1.2",
58
61
  "final-form": "^4.20.3",
59
62
  "react-final-form": "^6.5.3"