@atlaskit/link-create 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/controllers/callback-context/index.js +18 -0
  3. package/dist/cjs/controllers/callback-context/main.js +32 -0
  4. package/dist/cjs/index.js +9 -2
  5. package/dist/cjs/ui/group-selection/index.js +22 -0
  6. package/dist/cjs/ui/{link-create → group-selection}/types.js +0 -0
  7. package/dist/cjs/ui/index.js +13 -0
  8. package/dist/cjs/ui/main.js +38 -0
  9. package/dist/cjs/ui/types.js +5 -0
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/controllers/callback-context/index.js +1 -0
  12. package/dist/es2019/controllers/callback-context/main.js +19 -0
  13. package/dist/es2019/index.js +2 -1
  14. package/dist/es2019/ui/group-selection/index.js +16 -0
  15. package/dist/es2019/ui/{link-create → group-selection}/types.js +0 -0
  16. package/dist/es2019/ui/index.js +1 -0
  17. package/dist/es2019/ui/main.js +27 -0
  18. package/dist/{esm/ui/link-create → es2019/ui}/types.js +0 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/controllers/callback-context/index.js +1 -0
  21. package/dist/esm/controllers/callback-context/main.js +22 -0
  22. package/dist/esm/index.js +2 -1
  23. package/dist/esm/ui/group-selection/index.js +15 -0
  24. package/dist/esm/ui/group-selection/types.js +1 -0
  25. package/dist/esm/ui/index.js +1 -0
  26. package/dist/esm/ui/main.js +28 -0
  27. package/dist/esm/ui/types.js +1 -0
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/controllers/callback-context/index.d.ts +1 -0
  30. package/dist/types/controllers/callback-context/main.d.ts +18 -0
  31. package/dist/types/index.d.ts +2 -1
  32. package/dist/types/ui/group-selection/index.d.ts +4 -0
  33. package/dist/types/ui/group-selection/types.d.ts +25 -0
  34. package/dist/types/ui/index.d.ts +1 -0
  35. package/dist/types/ui/main.d.ts +4 -0
  36. package/dist/types/ui/types.d.ts +61 -0
  37. package/package.json +3 -3
  38. package/report.api.md +42 -4
  39. package/tmp/api-report-tmp.d.ts +36 -3
  40. package/dist/cjs/ui/link-create/index.js +0 -41
  41. package/dist/es2019/ui/link-create/index.js +0 -35
  42. package/dist/esm/ui/link-create/index.js +0 -34
  43. package/dist/types/ui/link-create/index.d.ts +0 -4
  44. package/dist/types/ui/link-create/types.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1 +1,7 @@
1
1
  # @atlaskit/link-create
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d7724023d26`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7724023d26) - Initial version of Create component
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "LinkCreateCallbackProvider", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _main.LinkCreateCallbackProvider;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useLinkCreateCallback", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _main.useLinkCreateCallback;
16
+ }
17
+ });
18
+ var _main = require("./main");
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useLinkCreateCallback = exports.LinkCreateCallbackProvider = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
+ var LinkCreateCallbackContext = /*#__PURE__*/_react.default.createContext({});
12
+ var LinkCreateCallbackProvider = function LinkCreateCallbackProvider(_ref) {
13
+ var children = _ref.children,
14
+ onCreate = _ref.onCreate,
15
+ onFailure = _ref.onFailure,
16
+ onCancel = _ref.onCancel;
17
+ var value = (0, _react.useMemo)(function () {
18
+ return {
19
+ onCreate: onCreate,
20
+ onFailure: onFailure,
21
+ onCancel: onCancel
22
+ };
23
+ }, [onCreate, onFailure, onCancel]);
24
+ return /*#__PURE__*/_react.default.createElement(LinkCreateCallbackContext.Provider, {
25
+ value: value
26
+ }, children);
27
+ };
28
+ exports.LinkCreateCallbackProvider = LinkCreateCallbackProvider;
29
+ var useLinkCreateCallback = function useLinkCreateCallback() {
30
+ return (0, _react.useContext)(LinkCreateCallbackContext);
31
+ };
32
+ exports.useLinkCreateCallback = useLinkCreateCallback;
package/dist/cjs/index.js CHANGED
@@ -7,7 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  Object.defineProperty(exports, "default", {
8
8
  enumerable: true,
9
9
  get: function get() {
10
- return _linkCreate.default;
10
+ return _index.default;
11
11
  }
12
12
  });
13
- var _linkCreate = _interopRequireDefault(require("./ui/link-create"));
13
+ Object.defineProperty(exports, "useLinkCreateCallback", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _index2.useLinkCreateCallback;
17
+ }
18
+ });
19
+ var _index = _interopRequireDefault(require("./ui/index"));
20
+ var _index2 = require("./controllers/callback-context/index");
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = GroupSelect;
7
+ var _react = require("@emotion/react");
8
+ /** @jsx jsx */
9
+
10
+ var containerStyles = (0, _react.css)({
11
+ padding: '8px',
12
+ border: '1px solid',
13
+ borderRadius: '4px'
14
+ });
15
+ function GroupSelect(_ref) {
16
+ var testId = _ref.testId,
17
+ groups = _ref.groups;
18
+ return (0, _react.jsx)("div", {
19
+ css: [containerStyles],
20
+ "data-testid": testId
21
+ }, "Not build yet");
22
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _main.default;
11
+ }
12
+ });
13
+ var _main = _interopRequireDefault(require("./main"));
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = LinkCreate;
8
+ var _react = require("@emotion/react");
9
+ var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
10
+ var _callbackContext = require("../controllers/callback-context");
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ /** @jsx jsx */
14
+
15
+ function LinkCreate(_ref) {
16
+ var plugins = _ref.plugins,
17
+ testId = _ref.testId,
18
+ groupKey = _ref.groupKey,
19
+ entityKey = _ref.entityKey,
20
+ onCreate = _ref.onCreate,
21
+ onFailure = _ref.onFailure,
22
+ onCancel = _ref.onCancel,
23
+ active = _ref.active;
24
+ var chosenOne = plugins.find(function (plugin) {
25
+ return plugin.key === entityKey;
26
+ });
27
+ if (!chosenOne) {
28
+ throw new Error('Make sure you specified a valid entityKey');
29
+ }
30
+ return (0, _react.jsx)(_modalDialog.ModalTransition, null, !!active && (0, _react.jsx)(_modalDialog.default, {
31
+ onClose: onCancel,
32
+ testId: testId
33
+ }, (0, _react.jsx)(_modalDialog.ModalBody, null, (0, _react.jsx)(_callbackContext.LinkCreateCallbackProvider, {
34
+ onCreate: onCreate,
35
+ onFailure: onFailure,
36
+ onCancel: onCancel
37
+ }, chosenOne.form))));
38
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './main';
@@ -0,0 +1,19 @@
1
+ import React, { useContext, useMemo } from 'react';
2
+ const LinkCreateCallbackContext = /*#__PURE__*/React.createContext({});
3
+ const LinkCreateCallbackProvider = ({
4
+ children,
5
+ onCreate,
6
+ onFailure,
7
+ onCancel
8
+ }) => {
9
+ const value = useMemo(() => ({
10
+ onCreate,
11
+ onFailure,
12
+ onCancel
13
+ }), [onCreate, onFailure, onCancel]);
14
+ return /*#__PURE__*/React.createElement(LinkCreateCallbackContext.Provider, {
15
+ value: value
16
+ }, children);
17
+ };
18
+ const useLinkCreateCallback = () => useContext(LinkCreateCallbackContext);
19
+ export { LinkCreateCallbackProvider, useLinkCreateCallback };
@@ -1 +1,2 @@
1
- export { default } from './ui/link-create';
1
+ export { default } from './ui/index';
2
+ export { useLinkCreateCallback } from './controllers/callback-context/index';
@@ -0,0 +1,16 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
+ const containerStyles = css({
4
+ padding: '8px',
5
+ border: '1px solid',
6
+ borderRadius: '4px'
7
+ });
8
+ export default function GroupSelect({
9
+ testId,
10
+ groups
11
+ }) {
12
+ return jsx("div", {
13
+ css: [containerStyles],
14
+ "data-testid": testId
15
+ }, "Not build yet");
16
+ }
@@ -0,0 +1 @@
1
+ export { default } from './main';
@@ -0,0 +1,27 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
4
+ import { LinkCreateCallbackProvider } from '../controllers/callback-context';
5
+ export default function LinkCreate({
6
+ plugins,
7
+ testId,
8
+ groupKey,
9
+ entityKey,
10
+ onCreate,
11
+ onFailure,
12
+ onCancel,
13
+ active
14
+ }) {
15
+ const chosenOne = plugins.find(plugin => plugin.key === entityKey);
16
+ if (!chosenOne) {
17
+ throw new Error('Make sure you specified a valid entityKey');
18
+ }
19
+ return jsx(ModalTransition, null, !!active && jsx(Modal, {
20
+ onClose: onCancel,
21
+ testId: testId
22
+ }, jsx(ModalBody, null, jsx(LinkCreateCallbackProvider, {
23
+ onCreate: onCreate,
24
+ onFailure: onFailure,
25
+ onCancel: onCancel
26
+ }, chosenOne.form))));
27
+ }
File without changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './main';
@@ -0,0 +1,22 @@
1
+ import React, { useContext, useMemo } from 'react';
2
+ var LinkCreateCallbackContext = /*#__PURE__*/React.createContext({});
3
+ var LinkCreateCallbackProvider = function LinkCreateCallbackProvider(_ref) {
4
+ var children = _ref.children,
5
+ onCreate = _ref.onCreate,
6
+ onFailure = _ref.onFailure,
7
+ onCancel = _ref.onCancel;
8
+ var value = useMemo(function () {
9
+ return {
10
+ onCreate: onCreate,
11
+ onFailure: onFailure,
12
+ onCancel: onCancel
13
+ };
14
+ }, [onCreate, onFailure, onCancel]);
15
+ return /*#__PURE__*/React.createElement(LinkCreateCallbackContext.Provider, {
16
+ value: value
17
+ }, children);
18
+ };
19
+ var useLinkCreateCallback = function useLinkCreateCallback() {
20
+ return useContext(LinkCreateCallbackContext);
21
+ };
22
+ export { LinkCreateCallbackProvider, useLinkCreateCallback };
package/dist/esm/index.js CHANGED
@@ -1 +1,2 @@
1
- export { default } from './ui/link-create';
1
+ export { default } from './ui/index';
2
+ export { useLinkCreateCallback } from './controllers/callback-context/index';
@@ -0,0 +1,15 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/react';
3
+ var containerStyles = css({
4
+ padding: '8px',
5
+ border: '1px solid',
6
+ borderRadius: '4px'
7
+ });
8
+ export default function GroupSelect(_ref) {
9
+ var testId = _ref.testId,
10
+ groups = _ref.groups;
11
+ return jsx("div", {
12
+ css: [containerStyles],
13
+ "data-testid": testId
14
+ }, "Not build yet");
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './main';
@@ -0,0 +1,28 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
4
+ import { LinkCreateCallbackProvider } from '../controllers/callback-context';
5
+ export default function LinkCreate(_ref) {
6
+ var plugins = _ref.plugins,
7
+ testId = _ref.testId,
8
+ groupKey = _ref.groupKey,
9
+ entityKey = _ref.entityKey,
10
+ onCreate = _ref.onCreate,
11
+ onFailure = _ref.onFailure,
12
+ onCancel = _ref.onCancel,
13
+ active = _ref.active;
14
+ var chosenOne = plugins.find(function (plugin) {
15
+ return plugin.key === entityKey;
16
+ });
17
+ if (!chosenOne) {
18
+ throw new Error('Make sure you specified a valid entityKey');
19
+ }
20
+ return jsx(ModalTransition, null, !!active && jsx(Modal, {
21
+ onClose: onCancel,
22
+ testId: testId
23
+ }, jsx(ModalBody, null, jsx(LinkCreateCallbackProvider, {
24
+ onCreate: onCreate,
25
+ onFailure: onFailure,
26
+ onCancel: onCancel
27
+ }, chosenOne.form))));
28
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export { LinkCreateCallbackProvider, useLinkCreateCallback } from './main';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ interface LinkCreateCallbackProviderProps {
3
+ /**
4
+ * This callback for when the resource has been successfully created.
5
+ */
6
+ onCreate?: (url: string) => void;
7
+ /**
8
+ * This callback for any errors
9
+ */
10
+ onFailure?: (error: unknown) => void;
11
+ /**
12
+ * This callback for when the form was manually discarded by user
13
+ */
14
+ onCancel?: () => void;
15
+ }
16
+ declare const LinkCreateCallbackProvider: React.FC<LinkCreateCallbackProviderProps>;
17
+ declare const useLinkCreateCallback: () => LinkCreateCallbackProviderProps;
18
+ export { LinkCreateCallbackProvider, useLinkCreateCallback };
@@ -1 +1,2 @@
1
- export { default } from './ui/link-create';
1
+ export { default } from './ui/index';
2
+ export { useLinkCreateCallback } from './controllers/callback-context/index';
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { GroupSelectProps } from './types';
4
+ export default function GroupSelect({ testId, groups }: GroupSelectProps): jsx.JSX.Element;
@@ -0,0 +1,25 @@
1
+ export interface Group {
2
+ /**
3
+ * A label to display for the Group
4
+ */
5
+ label: string;
6
+ /**
7
+ * An icon to display for the Group
8
+ */
9
+ icon: string;
10
+ /**
11
+ * A unique key for the Group
12
+ */
13
+ key: string;
14
+ }
15
+ export interface GroupSelectProps {
16
+ /**
17
+ * A `testId` prop is provided for specified elements, which is a unique
18
+ * string that appears as a data attribute `data-testid` in the rendered code,
19
+ * serving as a hook for automated tests */
20
+ testId?: string;
21
+ /**
22
+ * Available groups to display
23
+ */
24
+ groups: Group[];
25
+ }
@@ -0,0 +1 @@
1
+ export { default } from './main';
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { LinkCreateProps } from './types';
4
+ export default function LinkCreate({ plugins, testId, groupKey, entityKey, onCreate, onFailure, onCancel, active, }: LinkCreateProps): jsx.JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { ReactNode } from 'react';
2
+ import { Group } from './group-selection/types';
3
+ export interface LinkCreatePlugin {
4
+ /**
5
+ * The Group that this plugin entity belongs to
6
+ */
7
+ group: Group;
8
+ /**
9
+ * A label to display for the plugin entity
10
+ */
11
+ label: string;
12
+ /**
13
+ * An icon to display for the plugin entity
14
+ */
15
+ icon: string;
16
+ /**
17
+ * A unique key for the plugin entity
18
+ */
19
+ key: string;
20
+ /**
21
+ * A renderer function to render the form
22
+ */
23
+ form: ReactNode;
24
+ }
25
+ export interface LinkCreateProps {
26
+ /**
27
+ * A `testId` prop is provided for specified elements, which is a unique
28
+ * string that appears as a data attribute `data-testid` in the rendered code,
29
+ * serving as a hook for automated tests */
30
+ testId?: string;
31
+ plugins: LinkCreatePlugin[];
32
+ /**
33
+ * The initial group key for create. If this is provided, it will jump
34
+ * directly to the entity selection screen
35
+ */
36
+ groupKey?: string;
37
+ /**
38
+ * The initial entity name for create. If this is provided, it will jump
39
+ * directly to the entity creation form.
40
+ * Note: it will be non-optional for now and can move to optional when we have
41
+ * the meta creation flow built.
42
+ */
43
+ entityKey: string;
44
+ /**
45
+ * This callback for when the resource has been successfully created.
46
+ */
47
+ onCreate?: (url: string) => void;
48
+ /**
49
+ * This callback for any errors
50
+ */
51
+ onFailure?: (error: unknown) => void;
52
+ /**
53
+ * This callback for when the form was manually discarded by user
54
+ */
55
+ onCancel?: () => void;
56
+ /**
57
+ * This value controls whether the Create Modal should be active or hidden
58
+ * Default: false
59
+ */
60
+ active?: boolean;
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -26,8 +26,7 @@
26
26
  ".": "./src/index.ts"
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/theme": "^12.2.0",
30
- "@atlaskit/tokens": "^1.1.0",
29
+ "@atlaskit/modal-dialog": "^12.4.4",
31
30
  "@babel/runtime": "^7.0.0",
32
31
  "@emotion/react": "^11.7.1"
33
32
  },
@@ -35,6 +34,7 @@
35
34
  "react": "^16.8.0"
36
35
  },
37
36
  "devDependencies": {
37
+ "@atlaskit/button": "^16.5.0",
38
38
  "@atlaskit/docs": "*",
39
39
  "@atlaskit/ssr": "*",
40
40
  "@atlaskit/visual-regression": "*",
package/report.api.md CHANGED
@@ -16,22 +16,60 @@
16
16
 
17
17
  ```ts
18
18
  import { jsx } from '@emotion/react';
19
+ import { ReactNode } from 'react';
20
+
21
+ // @public (undocumented)
22
+ interface Group {
23
+ icon: string;
24
+ key: string;
25
+ label: string;
26
+ }
19
27
 
20
28
  // @public (undocumented)
21
29
  function LinkCreate({
22
- isSelected,
30
+ plugins,
23
31
  testId,
24
- width,
32
+ groupKey,
33
+ entityKey,
34
+ onCreate,
35
+ onFailure,
36
+ onCancel,
37
+ active,
25
38
  }: LinkCreateProps): jsx.JSX.Element;
26
39
  export default LinkCreate;
27
40
 
41
+ // @public (undocumented)
42
+ interface LinkCreateCallbackProviderProps {
43
+ onCancel?: () => void;
44
+ onCreate?: (url: string) => void;
45
+ onFailure?: (error: unknown) => void;
46
+ }
47
+
48
+ // @public (undocumented)
49
+ interface LinkCreatePlugin {
50
+ form: ReactNode;
51
+ group: Group;
52
+ icon: string;
53
+ key: string;
54
+ label: string;
55
+ }
56
+
28
57
  // @public (undocumented)
29
58
  interface LinkCreateProps {
30
- isSelected?: boolean;
59
+ active?: boolean;
60
+ entityKey: string;
61
+ groupKey?: string;
62
+ onCancel?: () => void;
63
+ onCreate?: (url: string) => void;
64
+ onFailure?: (error: unknown) => void;
65
+ // (undocumented)
66
+ plugins: LinkCreatePlugin[];
31
67
  testId?: string;
32
- width?: number;
33
68
  }
34
69
 
70
+ // @public (undocumented)
71
+ export const useLinkCreateCallback: () => LinkCreateCallbackProviderProps;
72
+
35
73
  // (No @packageDocumentation comment for this package)
36
74
  ```
37
75
 
@@ -5,18 +5,51 @@
5
5
  ```ts
6
6
 
7
7
  import { jsx } from '@emotion/react';
8
+ import { ReactNode } from 'react';
8
9
 
9
10
  // @public (undocumented)
10
- function LinkCreate({ isSelected, testId, width, }: LinkCreateProps): jsx.JSX.Element;
11
+ interface Group {
12
+ icon: string;
13
+ key: string;
14
+ label: string;
15
+ }
16
+
17
+ // @public (undocumented)
18
+ function LinkCreate({ plugins, testId, groupKey, entityKey, onCreate, onFailure, onCancel, active, }: LinkCreateProps): jsx.JSX.Element;
11
19
  export default LinkCreate;
12
20
 
21
+ // @public (undocumented)
22
+ interface LinkCreateCallbackProviderProps {
23
+ onCancel?: () => void;
24
+ onCreate?: (url: string) => void;
25
+ onFailure?: (error: unknown) => void;
26
+ }
27
+
28
+ // @public (undocumented)
29
+ interface LinkCreatePlugin {
30
+ form: ReactNode;
31
+ group: Group;
32
+ icon: string;
33
+ key: string;
34
+ label: string;
35
+ }
36
+
13
37
  // @public (undocumented)
14
38
  interface LinkCreateProps {
15
- isSelected?: boolean;
39
+ active?: boolean;
40
+ entityKey: string;
41
+ groupKey?: string;
42
+ onCancel?: () => void;
43
+ onCreate?: (url: string) => void;
44
+ onFailure?: (error: unknown) => void;
45
+ // (undocumented)
46
+ plugins: LinkCreatePlugin[];
16
47
  testId?: string;
17
- width?: number;
18
48
  }
19
49
 
50
+ // @public (undocumented)
51
+ export const useLinkCreateCallback: () => LinkCreateCallbackProviderProps;
52
+
20
53
  // (No @packageDocumentation comment for this package)
21
54
 
22
55
  ```
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = LinkCreate;
7
- var _react = require("@emotion/react");
8
- var _colors = require("@atlaskit/theme/colors");
9
- /** @jsx jsx */
10
-
11
- var containerStyles = (0, _react.css)({
12
- padding: '8px',
13
- border: '1px solid',
14
- borderRadius: '4px'
15
- });
16
- var unselectedStyles = (0, _react.css)({
17
- borderColor: "var(--ds-border, ".concat(_colors.N50, ")"),
18
- ':hover': {
19
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N20, ")")
20
- }
21
- });
22
- var selectedStyles = (0, _react.css)({
23
- backgroundColor: "var(--ds-background-selected, ".concat(_colors.B50, ")"),
24
- borderColor: "var(--ds-border-selected, ".concat(_colors.B400, ")"),
25
- color: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
26
- ':hover': {
27
- backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.B75, ")")
28
- }
29
- });
30
- function LinkCreate(_ref) {
31
- var isSelected = _ref.isSelected,
32
- testId = _ref.testId,
33
- width = _ref.width;
34
- return (0, _react.jsx)("div", {
35
- style: {
36
- width: width
37
- },
38
- css: [containerStyles, isSelected ? selectedStyles : unselectedStyles],
39
- "data-testid": testId
40
- }, "Hello world");
41
- }
@@ -1,35 +0,0 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/react';
3
- import { B400, B50, B75, N20, N50 } from '@atlaskit/theme/colors';
4
- const containerStyles = css({
5
- padding: '8px',
6
- border: '1px solid',
7
- borderRadius: '4px'
8
- });
9
- const unselectedStyles = css({
10
- borderColor: `var(--ds-border, ${N50})`,
11
- ':hover': {
12
- backgroundColor: `var(--ds-background-neutral-hovered, ${N20})`
13
- }
14
- });
15
- const selectedStyles = css({
16
- backgroundColor: `var(--ds-background-selected, ${B50})`,
17
- borderColor: `var(--ds-border-selected, ${B400})`,
18
- color: `var(--ds-text-selected, ${B400})`,
19
- ':hover': {
20
- backgroundColor: `var(--ds-background-selected-hovered, ${B75})`
21
- }
22
- });
23
- export default function LinkCreate({
24
- isSelected,
25
- testId,
26
- width
27
- }) {
28
- return jsx("div", {
29
- style: {
30
- width
31
- },
32
- css: [containerStyles, isSelected ? selectedStyles : unselectedStyles],
33
- "data-testid": testId
34
- }, "Hello world");
35
- }
@@ -1,34 +0,0 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/react';
3
- import { B400, B50, B75, N20, N50 } from '@atlaskit/theme/colors';
4
- var containerStyles = css({
5
- padding: '8px',
6
- border: '1px solid',
7
- borderRadius: '4px'
8
- });
9
- var unselectedStyles = css({
10
- borderColor: "var(--ds-border, ".concat(N50, ")"),
11
- ':hover': {
12
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(N20, ")")
13
- }
14
- });
15
- var selectedStyles = css({
16
- backgroundColor: "var(--ds-background-selected, ".concat(B50, ")"),
17
- borderColor: "var(--ds-border-selected, ".concat(B400, ")"),
18
- color: "var(--ds-text-selected, ".concat(B400, ")"),
19
- ':hover': {
20
- backgroundColor: "var(--ds-background-selected-hovered, ".concat(B75, ")")
21
- }
22
- });
23
- export default function LinkCreate(_ref) {
24
- var isSelected = _ref.isSelected,
25
- testId = _ref.testId,
26
- width = _ref.width;
27
- return jsx("div", {
28
- style: {
29
- width: width
30
- },
31
- css: [containerStyles, isSelected ? selectedStyles : unselectedStyles],
32
- "data-testid": testId
33
- }, "Hello world");
34
- }
@@ -1,4 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { LinkCreateProps } from './types';
4
- export default function LinkCreate({ isSelected, testId, width, }: LinkCreateProps): jsx.JSX.Element;
@@ -1,15 +0,0 @@
1
- export interface LinkCreateProps {
2
- /**
3
- * When `true` LinkCreate will appear selected.
4
- */
5
- isSelected?: boolean;
6
- /**
7
- * A `testId` prop is provided for specified elements, which is a unique
8
- * string that appears as a data attribute `data-testid` in the rendered code,
9
- * serving as a hook for automated tests */
10
- testId?: string;
11
- /**
12
- * Width of LinkCreate.
13
- */
14
- width?: number;
15
- }