@atlaskit/smart-card 25.7.3 → 25.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/constants.js +13 -7
- package/dist/cjs/extractors/flexible/index.js +1 -0
- package/dist/cjs/extractors/flexible/utils.js +14 -2
- package/dist/cjs/state/actions/index.js +27 -11
- package/dist/cjs/state/hooks/use-resolve/index.js +21 -12
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +47 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/cjs/view/CardWithUrl/component.js +12 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +6 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +7 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +6 -4
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +5 -0
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -4
- package/dist/cjs/view/HoverCard/styled.js +1 -1
- package/dist/cjs/view/HoverCard/utils.js +1 -1
- package/dist/es2019/constants.js +10 -5
- package/dist/es2019/extractors/flexible/index.js +2 -1
- package/dist/es2019/extractors/flexible/utils.js +12 -0
- package/dist/es2019/state/actions/index.js +32 -12
- package/dist/es2019/state/hooks/use-resolve/index.js +21 -12
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +35 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/es2019/view/CardWithUrl/component.js +8 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +6 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +8 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +5 -4
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +10 -3
- package/dist/es2019/view/HoverCard/styled.js +1 -1
- package/dist/es2019/view/HoverCard/utils.js +1 -1
- package/dist/esm/constants.js +10 -5
- package/dist/esm/extractors/flexible/index.js +2 -1
- package/dist/esm/extractors/flexible/utils.js +11 -0
- package/dist/esm/state/actions/index.js +27 -11
- package/dist/esm/state/hooks/use-resolve/index.js +21 -12
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +36 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/esm/view/CardWithUrl/component.js +10 -2
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +7 -5
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +8 -3
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +7 -5
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -4
- package/dist/esm/view/HoverCard/styled.js +1 -1
- package/dist/esm/view/HoverCard/utils.js +1 -1
- package/dist/types/constants.d.ts +6 -2
- package/dist/types/extractors/flexible/utils.d.ts +2 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +10 -0
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +9 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +6 -0
- package/package.json +3 -2
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +8 -1
|
@@ -2,6 +2,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
+
import { unstable_batchedUpdates } from 'react-dom';
|
|
5
6
|
import { addMetadataToExperience } from '../../analytics';
|
|
6
7
|
import { getStatus } from '../../helpers';
|
|
7
8
|
import { ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_RESOLVED, ACTION_UPDATE_METADATA_STATUS, APIError, cardAction } from '@atlaskit/linking-common';
|
|
@@ -99,18 +100,26 @@ var useResolve = function useResolve() {
|
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Using unstable_batchedUpdates because this store update happens async and trigers a rerender
|
|
105
|
+
* more info:
|
|
106
|
+
* https://github.com/facebook/react/blob/v18.2.0/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L113
|
|
107
|
+
* https://react-redux.js.org/api/batch
|
|
108
|
+
*/
|
|
109
|
+
unstable_batchedUpdates(function () {
|
|
110
|
+
//if a link resolves normally, metadata will also always be resolved
|
|
111
|
+
setMetadataStatus(resourceUrl, 'resolved');
|
|
112
|
+
// Dispatch Analytics and resolved card action - including unauthorized states.
|
|
113
|
+
if (isReloading) {
|
|
114
|
+
dispatch(cardAction(ACTION_RELOADING, {
|
|
115
|
+
url: resourceUrl
|
|
116
|
+
}, response));
|
|
117
|
+
} else {
|
|
118
|
+
dispatch(cardAction(ACTION_RESOLVED, {
|
|
119
|
+
url: resourceUrl
|
|
120
|
+
}, response, undefined, undefined, isMetadataRequest));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
114
123
|
}, [dispatch, handleResolvedLinkError, hasAuthFlowSupported, setMetadataStatus]);
|
|
115
124
|
return useCallback( /*#__PURE__*/function () {
|
|
116
125
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
+
import { getResolvedAttributes, getUrlAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
7
|
+
import { isFlexibleUiCard } from '../flexible';
|
|
8
|
+
import { CardDisplay } from '../../constants';
|
|
9
|
+
import { useSmartCardState as useSmartLinkState } from '../../state/store';
|
|
10
|
+
export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref) {
|
|
11
|
+
var children = _ref.children,
|
|
12
|
+
url = _ref.url,
|
|
13
|
+
appearance = _ref.appearance,
|
|
14
|
+
id = _ref.id;
|
|
15
|
+
var _useSmartLinkState = useSmartLinkState(url),
|
|
16
|
+
details = _useSmartLinkState.details,
|
|
17
|
+
status = _useSmartLinkState.status;
|
|
18
|
+
var resolvedAttributes = getResolvedAttributes({
|
|
19
|
+
url: url
|
|
20
|
+
}, details, status);
|
|
21
|
+
var _getUrlAttributes = getUrlAttributes(url),
|
|
22
|
+
urlHash = _getUrlAttributes.urlHash;
|
|
23
|
+
var isFlexibleUi = useMemo(function () {
|
|
24
|
+
return isFlexibleUiCard(children);
|
|
25
|
+
}, [children]);
|
|
26
|
+
var display = isFlexibleUi ? CardDisplay.Flexible : appearance;
|
|
27
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
28
|
+
data: {
|
|
29
|
+
attributes: _objectSpread(_objectSpread({}, resolvedAttributes), {}, {
|
|
30
|
+
urlHash: urlHash,
|
|
31
|
+
display: display,
|
|
32
|
+
id: id
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -79,7 +79,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
79
79
|
}, {
|
|
80
80
|
name: ElementName.State
|
|
81
81
|
}],
|
|
82
|
-
hideRetry: true
|
|
82
|
+
hideRetry: true,
|
|
83
|
+
subtitle: [{
|
|
84
|
+
name: ElementName.Location
|
|
85
|
+
}]
|
|
83
86
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
84
87
|
primary: metadata,
|
|
85
88
|
maxLines: 1
|
|
@@ -12,7 +12,8 @@ import { isFlexibleUiCard } from '../../utils/flexible';
|
|
|
12
12
|
import FlexibleCard from '../FlexibleCard';
|
|
13
13
|
import { CardDisplay } from '../../constants';
|
|
14
14
|
import { fireLinkClickedEvent } from '../../utils/analytics/click';
|
|
15
|
-
|
|
15
|
+
import { SmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
16
|
+
function Component(_ref) {
|
|
16
17
|
var id = _ref.id,
|
|
17
18
|
url = _ref.url,
|
|
18
19
|
isSelected = _ref.isSelected,
|
|
@@ -257,4 +258,11 @@ export function CardWithUrlContent(_ref) {
|
|
|
257
258
|
onIframeFocus: onIframeFocus
|
|
258
259
|
});
|
|
259
260
|
}
|
|
260
|
-
}
|
|
261
|
+
}
|
|
262
|
+
export var CardWithUrlContent = function CardWithUrlContent(props) {
|
|
263
|
+
return /*#__PURE__*/React.createElement(SmartLinkAnalyticsContext, {
|
|
264
|
+
url: props.url,
|
|
265
|
+
appearance: props.appearance,
|
|
266
|
+
id: props.id
|
|
267
|
+
}, /*#__PURE__*/React.createElement(Component, props));
|
|
268
|
+
};
|
|
@@ -3,7 +3,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
7
7
|
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
8
8
|
import { getMaxLineHeight, getTruncateStyles } from '../../utils';
|
|
9
9
|
var getAlignmentStyles = function getAlignmentStyles(align) {
|
|
@@ -26,8 +26,8 @@ var getHorizontalDirectionStyles = function getHorizontalDirectionStyles(size, a
|
|
|
26
26
|
var lineHeight = getMaxLineHeight(size);
|
|
27
27
|
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: block;\n vertical-align: middle;\n ", "\n\n > span, > div {\n vertical-align: middle;\n\n &[data-smart-element-date-time],\n &[data-smart-element-text] {\n // Show all/wrapped/truncated\n display: inline;\n }\n }\n\n ", "\n "])), getTruncateStyles(1, lineHeight + 'rem'), getGapStyles(size, align));
|
|
28
28
|
};
|
|
29
|
-
export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
|
|
30
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '');
|
|
29
|
+
export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width, position) {
|
|
30
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '', position === SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -49,9 +49,11 @@ var ElementGroup = function ElementGroup(_ref) {
|
|
|
49
49
|
_ref$testId = _ref.testId,
|
|
50
50
|
testId = _ref$testId === void 0 ? 'smart-element-group' : _ref$testId,
|
|
51
51
|
_ref$width = _ref.width,
|
|
52
|
-
width = _ref$width === void 0 ? SmartLinkWidth.FitToContent : _ref$width
|
|
52
|
+
width = _ref$width === void 0 ? SmartLinkWidth.FitToContent : _ref$width,
|
|
53
|
+
_ref$position = _ref.position,
|
|
54
|
+
position = _ref$position === void 0 ? SmartLinkPosition.Center : _ref$position;
|
|
53
55
|
return jsx("div", {
|
|
54
|
-
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
56
|
+
css: [getElementGroupStyles(direction, size, align, width, position), overrideCss],
|
|
55
57
|
"data-smart-element-group": true,
|
|
56
58
|
"data-testid": testId
|
|
57
59
|
}, renderChildren(children, size));
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _templateObject;
|
|
3
5
|
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "title"];
|
|
4
6
|
import React from 'react';
|
|
7
|
+
import { css } from '@emotion/react';
|
|
5
8
|
import { LinkIcon } from '../../../elements';
|
|
6
9
|
import Block from '../../block';
|
|
7
10
|
import ElementGroup from '../../element-group';
|
|
8
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
11
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
|
|
9
12
|
import { renderElementItems } from '../../utils';
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -32,12 +35,14 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
32
35
|
position: position
|
|
33
36
|
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
37
|
direction: SmartLinkDirection.Vertical,
|
|
35
|
-
width: SmartLinkWidth.Flexible
|
|
38
|
+
width: SmartLinkWidth.Flexible,
|
|
39
|
+
overrideCss: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0.25rem;\n "])))
|
|
36
40
|
}, title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
37
41
|
direction: SmartLinkDirection.Horizontal
|
|
38
42
|
}, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
39
43
|
direction: SmartLinkDirection.Horizontal,
|
|
40
|
-
align: SmartLinkAlignment.Right
|
|
44
|
+
align: SmartLinkAlignment.Right,
|
|
45
|
+
position: SmartLinkPosition.Top
|
|
41
46
|
}, metadataElements), actionGroup);
|
|
42
47
|
};
|
|
43
48
|
export default TitleBlockResolvedView;
|
|
@@ -15,7 +15,7 @@ import ElementGroup from './element-group';
|
|
|
15
15
|
|
|
16
16
|
// Determine whether the element can be display as inline/block.
|
|
17
17
|
|
|
18
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.
|
|
18
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Location, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _ElementDisplaySchema);
|
|
19
19
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
20
20
|
switch (direction) {
|
|
21
21
|
case SmartLinkDirection.Vertical:
|
|
@@ -52,6 +52,12 @@ export var LatestCommit = createElement(ElementName.LatestCommit);
|
|
|
52
52
|
* @see Icon
|
|
53
53
|
*/
|
|
54
54
|
export var LinkIcon = createElement(ElementName.LinkIcon);
|
|
55
|
+
/**
|
|
56
|
+
* Creates a Location Link element.
|
|
57
|
+
* This represents the location or container of the resource.
|
|
58
|
+
* @see Link
|
|
59
|
+
*/
|
|
60
|
+
export var Location = createElement(ElementName.Location);
|
|
55
61
|
/**
|
|
56
62
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
57
63
|
* @see Text
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import { SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
7
|
+
import { SmartLinkInternalTheme, SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
8
8
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles, hasWhiteSpace } from '../../utils';
|
|
9
9
|
import { tokens } from '../../../../../utils/token';
|
|
10
10
|
import useMouseDownEvent from '../../../../../state/analytics/useMouseDownEvent';
|
|
@@ -14,17 +14,19 @@ var MINIMUM_MAX_LINES = 1;
|
|
|
14
14
|
var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n"])));
|
|
15
15
|
var getThemeStyles = function getThemeStyles(theme) {
|
|
16
16
|
switch (theme) {
|
|
17
|
+
case SmartLinkInternalTheme.Grey:
|
|
18
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n font-size: 12px;\n "])), "var(--ds-text-subtlest, #626F86)", "var(--ds-text-subtlest, #626F86)");
|
|
17
19
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
18
20
|
case SmartLinkTheme.Black:
|
|
19
|
-
return css(
|
|
21
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), tokens.blackLink, tokens.blackLinkPressed, tokens.blackLink);
|
|
20
22
|
case SmartLinkTheme.Link:
|
|
21
23
|
default:
|
|
22
|
-
return css(
|
|
24
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), tokens.blueLink, tokens.blueLinkPressed, tokens.blueLink);
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
27
|
var getAnchorStyles = function getAnchorStyles(size, theme, maxLines, hasSpace) {
|
|
26
28
|
var sizeStyles = getLinkSizeStyles(size);
|
|
27
|
-
return css(
|
|
29
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n ", "\n ", "\n // Theme should be last to be spread because it contains override values\n ", "\n "])), sizeStyles, getTruncateStyles(maxLines, getLinkLineHeight(size), hasSpace ? 'break-word' : 'break-all'), getThemeStyles(theme));
|
|
28
30
|
};
|
|
29
31
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
30
32
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
@@ -5,7 +5,7 @@ var _templateObject, _elementMappings;
|
|
|
5
5
|
import React, { useContext } from 'react';
|
|
6
6
|
import { FormattedDate } from 'react-intl-next';
|
|
7
7
|
import { css } from '@emotion/react';
|
|
8
|
-
import { ElementName, IconType } from '../../../../constants';
|
|
8
|
+
import { ElementName, IconType, SmartLinkInternalTheme } from '../../../../constants';
|
|
9
9
|
import Icon from './icon';
|
|
10
10
|
import Link from './link';
|
|
11
11
|
import Lozenge from './lozenge';
|
|
@@ -101,6 +101,11 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
101
101
|
component: Text
|
|
102
102
|
}), _defineProperty(_elementMappings, ElementName.Title, {
|
|
103
103
|
component: Link
|
|
104
|
+
}), _defineProperty(_elementMappings, ElementName.Location, {
|
|
105
|
+
component: Link,
|
|
106
|
+
props: {
|
|
107
|
+
theme: SmartLinkInternalTheme.Grey
|
|
108
|
+
}
|
|
104
109
|
}), _elementMappings);
|
|
105
110
|
var getContextKey = function getContextKey(name) {
|
|
106
111
|
// Attempt to predict context prop name in advance to reduce the amount of
|
|
@@ -10,9 +10,11 @@ import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
|
10
10
|
import HoverCardContent from '../components/HoverCardContent';
|
|
11
11
|
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
12
12
|
import { CardDisplay } from '../../../constants';
|
|
13
|
+
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
13
14
|
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
14
15
|
var children = _ref.children,
|
|
15
16
|
url = _ref.url,
|
|
17
|
+
id = _ref.id,
|
|
16
18
|
analyticsHandler = _ref.analyticsHandler,
|
|
17
19
|
analytics = _ref.analytics,
|
|
18
20
|
_ref$canOpen = _ref.canOpen,
|
|
@@ -122,7 +124,11 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
122
124
|
}, [closeOnChildClick, hideCard]);
|
|
123
125
|
var content = useCallback(function (_ref2) {
|
|
124
126
|
var update = _ref2.update;
|
|
125
|
-
return jsx(
|
|
127
|
+
return jsx(SmartLinkAnalyticsContext, {
|
|
128
|
+
url: url,
|
|
129
|
+
appearance: CardDisplay.HoverCardPreview,
|
|
130
|
+
id: id
|
|
131
|
+
}, jsx(HoverCardContent, {
|
|
126
132
|
onMouseEnter: initShowCard,
|
|
127
133
|
onMouseLeave: initHideCard,
|
|
128
134
|
analytics: analytics,
|
|
@@ -132,9 +138,10 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
132
138
|
onResolve: update,
|
|
133
139
|
renderers: renderers,
|
|
134
140
|
showServerActions: showServerActions,
|
|
135
|
-
url: url
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
url: url,
|
|
142
|
+
id: id
|
|
143
|
+
}));
|
|
144
|
+
}, [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
|
|
138
145
|
var trigger = useCallback(function (triggerProps) {
|
|
139
146
|
return jsx("span", {
|
|
140
147
|
ref: parentSpan
|
|
@@ -22,7 +22,7 @@ var blockGap = '0.5rem';
|
|
|
22
22
|
var elementGap = '0.5rem';
|
|
23
23
|
export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
24
24
|
export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), CARD_WIDTH_REM, loadingPlaceholderClassName);
|
|
25
|
-
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n
|
|
25
|
+
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n"])), blockGap, separatorCss, elementGap);
|
|
26
26
|
export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
27
27
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
28
28
|
};
|
|
@@ -49,7 +49,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
49
49
|
metadata: {
|
|
50
50
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
51
51
|
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
52
|
-
subtitle: []
|
|
52
|
+
subtitle: [ElementName.Location]
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
case 'watermelon-object-provider':
|
|
@@ -55,6 +55,9 @@ export declare enum SmartLinkTheme {
|
|
|
55
55
|
Black = "black",
|
|
56
56
|
Link = "link"
|
|
57
57
|
}
|
|
58
|
+
export declare enum SmartLinkInternalTheme {
|
|
59
|
+
Grey = "grey"
|
|
60
|
+
}
|
|
58
61
|
/**
|
|
59
62
|
* Determines whether the container size will fit to the content
|
|
60
63
|
* or expand to the available width or the parent component.
|
|
@@ -89,7 +92,9 @@ export declare enum ElementName {
|
|
|
89
92
|
CreatedBy = "CreatedBy",
|
|
90
93
|
CreatedOn = "CreatedOn",
|
|
91
94
|
DueOn = "DueOn",
|
|
95
|
+
LatestCommit = "LatestCommit",
|
|
92
96
|
LinkIcon = "LinkIcon",
|
|
97
|
+
Location = "Location",
|
|
93
98
|
ModifiedBy = "ModifiedBy",
|
|
94
99
|
ModifiedOn = "ModifiedOn",
|
|
95
100
|
OwnedBy = "OwnedBy",
|
|
@@ -105,8 +110,7 @@ export declare enum ElementName {
|
|
|
105
110
|
TargetBranch = "TargetBranch",
|
|
106
111
|
Title = "Title",
|
|
107
112
|
ViewCount = "ViewCount",
|
|
108
|
-
VoteCount = "VoteCount"
|
|
109
|
-
LatestCommit = "LatestCommit"
|
|
113
|
+
VoteCount = "VoteCount"
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* Flexible UI action (button)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { LinkLocation } from '../../state/flexible-ui-context/types';
|
|
2
3
|
export declare const extractCommentCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
3
4
|
export declare const extractDueOn: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
4
5
|
export declare const extractViewCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
@@ -13,3 +14,4 @@ export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => num
|
|
|
13
14
|
export declare const extractAttachmentCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
14
15
|
export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
|
|
15
16
|
export declare const extractChecklistProgress: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
17
|
+
export declare const extractLocation: (data: JsonLd.Data.BaseData) => LinkLocation | undefined;
|
|
@@ -182,12 +182,22 @@ export declare type FlexibleUiDataContext = {
|
|
|
182
182
|
* @see Title
|
|
183
183
|
*/
|
|
184
184
|
url?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Contains the name and url of the location that the resource is located in.
|
|
187
|
+
* @type LinkLocation
|
|
188
|
+
* @see Location
|
|
189
|
+
*/
|
|
190
|
+
location?: LinkLocation;
|
|
185
191
|
};
|
|
186
192
|
export declare type Icon = {
|
|
187
193
|
icon?: IconType;
|
|
188
194
|
label?: string;
|
|
189
195
|
url?: string;
|
|
190
196
|
};
|
|
197
|
+
export declare type LinkLocation = {
|
|
198
|
+
text: string;
|
|
199
|
+
url: string;
|
|
200
|
+
};
|
|
191
201
|
export declare type Media = {
|
|
192
202
|
type: MediaType;
|
|
193
203
|
url: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CardInnerAppearance } from '../../view/Card/types';
|
|
3
|
+
declare type SmartLinkAnalyticsContextProps = {
|
|
4
|
+
url: string;
|
|
5
|
+
appearance: CardInnerAppearance;
|
|
6
|
+
id: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const SmartLinkAnalyticsContext: FC<SmartLinkAnalyticsContextProps>;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CardWithUrlContentProps } from './types';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const CardWithUrlContent: (props: CardWithUrlContentProps) => JSX.Element;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SerializedStyles } from '@emotion/react';
|
|
4
4
|
import { ElementGroupProps } from './types';
|
|
5
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
-
export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth) => SerializedStyles;
|
|
5
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
+
export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth, position: SmartLinkPosition) => SerializedStyles;
|
|
7
7
|
/**
|
|
8
8
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
9
9
|
* preferences.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/react';
|
|
2
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
2
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
3
3
|
export declare type ElementGroupProps = {
|
|
4
4
|
align?: SmartLinkAlignment;
|
|
5
5
|
direction?: SmartLinkDirection;
|
|
@@ -7,4 +7,5 @@ export declare type ElementGroupProps = {
|
|
|
7
7
|
size?: SmartLinkSize;
|
|
8
8
|
width?: SmartLinkWidth;
|
|
9
9
|
testId?: string;
|
|
10
|
+
position?: SmartLinkPosition;
|
|
10
11
|
};
|
|
@@ -168,7 +168,7 @@ export declare type OnActionMenuOpenChangeOptions = {
|
|
|
168
168
|
/**
|
|
169
169
|
* A type that contains all the possible combinations of elements with their corresponding props.
|
|
170
170
|
*/
|
|
171
|
-
export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
171
|
+
export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
172
172
|
/**
|
|
173
173
|
* Represents the props available for an AttachmentCount element.
|
|
174
174
|
* @see AttachmentCount
|
|
@@ -250,6 +250,12 @@ export declare type LatestCommit = {
|
|
|
250
250
|
export declare type LinkIcon = {
|
|
251
251
|
name: ElementName.LinkIcon;
|
|
252
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Represents the props for the Location element.
|
|
255
|
+
*/
|
|
256
|
+
export declare type Location = {
|
|
257
|
+
name: ElementName.Location;
|
|
258
|
+
};
|
|
253
259
|
/**
|
|
254
260
|
* Represents the props available for an ModifiedBy element.
|
|
255
261
|
* @see ModifiedBy
|
|
@@ -56,6 +56,12 @@ export declare const LatestCommit: import("react").FC<BadgeProps>;
|
|
|
56
56
|
* @see Icon
|
|
57
57
|
*/
|
|
58
58
|
export declare const LinkIcon: import("react").FC<IconProps>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a Location Link element.
|
|
61
|
+
* This represents the location or container of the resource.
|
|
62
|
+
* @see Link
|
|
63
|
+
*/
|
|
64
|
+
export declare const Location: import("react").FC<LinkProps>;
|
|
59
65
|
/**
|
|
60
66
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
61
67
|
* @see Text
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.9.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
+
"@atlaskit/link-analytics": "^7.0.5",
|
|
36
37
|
"@atlaskit/link-client-extension": "^0.5.0",
|
|
37
38
|
"@atlaskit/linking-common": "^2.6.0",
|
|
38
39
|
"@atlaskit/linking-types": "^1.3.0",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"@atlaskit/css-reset": "^6.4.0",
|
|
73
74
|
"@atlaskit/docs": "*",
|
|
74
75
|
"@atlaskit/field-base": "^15.1.0",
|
|
75
|
-
"@atlaskit/form": "^8.
|
|
76
|
+
"@atlaskit/form": "^8.10.0",
|
|
76
77
|
"@atlaskit/inline-message": "^11.4.0",
|
|
77
78
|
"@atlaskit/link-test-helpers": "^2.2.0",
|
|
78
79
|
"@atlaskit/lozenge": "^11.3.0",
|
package/report.api.md
CHANGED
|
@@ -440,6 +440,7 @@ type ElementItemProps =
|
|
|
440
440
|
| DueOn
|
|
441
441
|
| LatestCommit
|
|
442
442
|
| LinkIcon
|
|
443
|
+
| Location_2
|
|
443
444
|
| ModifiedBy
|
|
444
445
|
| ModifiedOn
|
|
445
446
|
| OwnedBy
|
|
@@ -480,6 +481,8 @@ export enum ElementName {
|
|
|
480
481
|
// (undocumented)
|
|
481
482
|
LinkIcon = 'LinkIcon',
|
|
482
483
|
// (undocumented)
|
|
484
|
+
Location = 'Location',
|
|
485
|
+
// (undocumented)
|
|
483
486
|
ModifiedBy = 'ModifiedBy',
|
|
484
487
|
// (undocumented)
|
|
485
488
|
ModifiedOn = 'ModifiedOn',
|
|
@@ -611,6 +614,11 @@ type LinkIcon = {
|
|
|
611
614
|
// @public (undocumented)
|
|
612
615
|
export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
|
|
613
616
|
|
|
617
|
+
// @public
|
|
618
|
+
type Location_2 = {
|
|
619
|
+
name: ElementName.Location;
|
|
620
|
+
};
|
|
621
|
+
|
|
614
622
|
// @public (undocumented)
|
|
615
623
|
export enum MediaPlacement {
|
|
616
624
|
// (undocumented)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -333,7 +333,7 @@ export type ElementItem = {
|
|
|
333
333
|
} & ElementItemProps;
|
|
334
334
|
|
|
335
335
|
// @public
|
|
336
|
-
type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
336
|
+
type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location_2 | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
337
337
|
|
|
338
338
|
// @public
|
|
339
339
|
export enum ElementName {
|
|
@@ -358,6 +358,8 @@ export enum ElementName {
|
|
|
358
358
|
// (undocumented)
|
|
359
359
|
LinkIcon = "LinkIcon",
|
|
360
360
|
// (undocumented)
|
|
361
|
+
Location = "Location",
|
|
362
|
+
// (undocumented)
|
|
361
363
|
ModifiedBy = "ModifiedBy",
|
|
362
364
|
// (undocumented)
|
|
363
365
|
ModifiedOn = "ModifiedOn",
|
|
@@ -479,6 +481,11 @@ type LinkIcon = {
|
|
|
479
481
|
// @public (undocumented)
|
|
480
482
|
export const loadingPlaceholderClassName = "smart-link-loading-placeholder";
|
|
481
483
|
|
|
484
|
+
// @public
|
|
485
|
+
type Location_2 = {
|
|
486
|
+
name: ElementName.Location;
|
|
487
|
+
};
|
|
488
|
+
|
|
482
489
|
// @public (undocumented)
|
|
483
490
|
export enum MediaPlacement {
|
|
484
491
|
// (undocumented)
|