@atlaskit/link-picker 0.8.0 → 0.10.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/ui/link-picker.js +25 -22
  3. package/dist/cjs/ui/{LinkSearchList.js → link-search-list/index.js} +15 -25
  4. package/dist/cjs/ui/link-search-list/styled.js +21 -0
  5. package/dist/cjs/ui/{LinkSearchListItem.js → list-item/index.js} +26 -24
  6. package/dist/cjs/ui/list-item/styled.js +59 -0
  7. package/dist/cjs/ui/styled.js +32 -0
  8. package/dist/cjs/ui/{PanelTextInput.js → text-input/index.js} +14 -17
  9. package/dist/cjs/ui/text-input/styled.js +25 -0
  10. package/dist/cjs/utils.js +1 -14
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/ui/link-picker.js +12 -9
  13. package/dist/es2019/ui/{LinkSearchList.js → link-search-list/index.js} +14 -19
  14. package/dist/es2019/ui/link-search-list/styled.js +13 -0
  15. package/dist/es2019/ui/list-item/index.js +88 -0
  16. package/dist/es2019/ui/list-item/styled.js +65 -0
  17. package/dist/es2019/ui/styled.js +28 -0
  18. package/dist/es2019/ui/{PanelTextInput.js → text-input/index.js} +15 -9
  19. package/dist/es2019/ui/text-input/styled.js +15 -0
  20. package/dist/es2019/utils.js +0 -11
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/ui/link-picker.js +12 -9
  23. package/dist/esm/ui/{LinkSearchList.js → link-search-list/index.js} +14 -13
  24. package/dist/esm/ui/link-search-list/styled.js +8 -0
  25. package/dist/esm/ui/{LinkSearchListItem.js → list-item/index.js} +25 -23
  26. package/dist/esm/ui/list-item/styled.js +37 -0
  27. package/dist/esm/ui/styled.js +16 -0
  28. package/dist/esm/ui/{PanelTextInput.js → text-input/index.js} +15 -9
  29. package/dist/esm/ui/text-input/styled.js +10 -0
  30. package/dist/esm/utils.js +0 -11
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/types.d.ts +2 -2
  33. package/dist/types/ui/{LinkSearchList.d.ts → link-search-list/index.d.ts} +4 -4
  34. package/dist/types/ui/link-search-list/styled.d.ts +3 -0
  35. package/dist/types/ui/{LinkSearchListItem.d.ts → list-item/index.d.ts} +1 -1
  36. package/dist/types/ui/list-item/styled.d.ts +7 -0
  37. package/dist/types/ui/styled.d.ts +4 -0
  38. package/dist/types/ui/{PanelTextInput.d.ts → text-input/index.d.ts} +2 -2
  39. package/dist/types/ui/text-input/styled.d.ts +2 -0
  40. package/dist/types/utils.d.ts +0 -1
  41. package/package.json +6 -5
  42. package/dist/cjs/styles.js +0 -90
  43. package/dist/es2019/styles.js +0 -94
  44. package/dist/es2019/ui/LinkSearchListItem.js +0 -88
  45. package/dist/esm/styles.js +0 -46
  46. package/dist/types/styles.d.ts +0 -18
@@ -1,13 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["name", "label", "autoFocus", "onSubmit", "onRedo", "onUndo", "onChange", "onKeyDown", "onClear", "clearLabel", "error"];
4
- import React, { useCallback, useRef } from 'react';
4
+
5
+ /** @jsx jsx */
6
+ import { useCallback, useRef, Fragment } from 'react';
7
+ import { jsx } from '@emotion/react';
5
8
  import { ErrorMessage, Field } from '@atlaskit/form';
6
9
  import Tooltip from '@atlaskit/tooltip';
7
10
  import Textfield from '@atlaskit/textfield';
8
11
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
9
- import { ClearText, FieldWrapper } from '../styles';
10
- import { isRedoEvent, isUndoEvent } from '../utils';
12
+ import { isRedoEvent, isUndoEvent } from '../../utils';
13
+ import { clearTextButtonStyles, fieldStyles } from './styled';
11
14
 
12
15
  var PanelTextInput = function PanelTextInput(props) {
13
16
  var name = props.name,
@@ -64,27 +67,30 @@ var PanelTextInput = function PanelTextInput(props) {
64
67
  onClear();
65
68
  }
66
69
  }, [onClear]);
67
- var clearText = restProps.value !== '' && /*#__PURE__*/React.createElement(Tooltip, {
70
+ var clearText = restProps.value !== '' && jsx(Tooltip, {
68
71
  content: clearLabel
69
- }, /*#__PURE__*/React.createElement(ClearText, {
72
+ }, jsx("button", {
73
+ css: clearTextButtonStyles,
70
74
  onClick: handleClear,
71
75
  "data-testid": "clear-text"
72
- }, /*#__PURE__*/React.createElement(Selectclear, {
76
+ }, jsx(Selectclear, {
73
77
  size: "medium",
74
78
  label: clearLabel || ''
75
79
  })));
76
- return /*#__PURE__*/React.createElement(FieldWrapper, null, /*#__PURE__*/React.createElement(Field, {
80
+ return jsx("div", {
81
+ css: fieldStyles
82
+ }, jsx(Field, {
77
83
  label: label,
78
84
  name: name
79
85
  }, function (_ref) {
80
86
  var fieldProps = _ref.fieldProps;
81
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Textfield, _extends({}, fieldProps, restProps, {
87
+ return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
82
88
  onKeyDown: handleKeydown,
83
89
  onChange: handleChange,
84
90
  ref: handleRef,
85
91
  elemAfterInput: clearText,
86
92
  isInvalid: !!error
87
- })), error && /*#__PURE__*/React.createElement(ErrorMessage, {
93
+ })), error && jsx(ErrorMessage, {
88
94
  testId: "link-error"
89
95
  }, error));
90
96
  }));
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2;
4
+
5
+ import { token } from '@atlaskit/tokens';
6
+ import { css } from '@emotion/react';
7
+ import { N500 } from '@atlaskit/theme/colors';
8
+ import { gridSize } from '@atlaskit/theme/constants';
9
+ export var clearTextButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), gridSize() / 2, token('color.icon.subtle', N500));
10
+ export var fieldStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n"])), gridSize() * 2);
package/dist/esm/utils.js CHANGED
@@ -1,15 +1,4 @@
1
1
  import { browser } from './browser';
2
- export var relativeFontSizeToBase16 = function relativeFontSizeToBase16(px) {
3
- if (typeof px === 'string') {
4
- px = parseInt(px);
5
- }
6
-
7
- if (isNaN(px)) {
8
- throw new Error("Invalid font size: '".concat(px, "'"));
9
- }
10
-
11
- return "".concat(px / 16, "rem");
12
- };
13
2
  var KeyZCode = 90;
14
3
  var KeyYCode = 89;
15
4
  export var isUndoEvent = function isUndoEvent(e) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -8,14 +8,14 @@ export interface LinkSearchListItemData {
8
8
  name: string;
9
9
  /** URL of the resource being linked to */
10
10
  url: string;
11
- /** Context to display in link result */
12
- container: string;
13
11
  /** Icon to display in link result */
14
12
  icon: string | React.ComponentType<{
15
13
  alt: string;
16
14
  }>;
17
15
  /** Alt text describing the icon */
18
16
  iconAlt: string | MessageDescriptor;
17
+ /** Context to display in link result */
18
+ container?: string;
19
19
  /** Optional last view date to display in link result */
20
20
  lastViewedDate?: Date;
21
21
  /** Optional last updated date to display in link result */
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
2
  import { PureComponent } from 'react';
3
- import { LinkSearchListItemData } from '../types';
4
- export declare const List: import("styled-components").StyledComponentClass<React.ClassAttributes<HTMLUListElement> & React.HTMLAttributes<HTMLUListElement>, any, React.ClassAttributes<HTMLUListElement> & React.HTMLAttributes<HTMLUListElement>>;
3
+ import { jsx } from '@emotion/react';
4
+ import { LinkSearchListItemData } from '../../types';
5
5
  export interface Props {
6
6
  items?: LinkSearchListItemData[];
7
7
  isLoading: boolean;
@@ -16,5 +16,5 @@ export interface Props {
16
16
  id?: string;
17
17
  }
18
18
  export default class LinkSearchList extends PureComponent<Props, {}> {
19
- render(): JSX.Element;
19
+ render(): jsx.JSX.Element;
20
20
  }
@@ -0,0 +1,3 @@
1
+ export declare const listContainerStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const spinnerContainerStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const listStyles: import("@emotion/react").SerializedStyles;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { WrappedComponentProps } from 'react-intl-next';
3
- import { LinkSearchListItemData } from '../types';
3
+ import { LinkSearchListItemData } from '../../types';
4
4
  export interface Props {
5
5
  item: LinkSearchListItemData;
6
6
  selected: boolean;
@@ -0,0 +1,7 @@
1
+ export declare const relativeFontSizeToBase16: (px: number | string) => string;
2
+ export declare const composeListItemStyles: (active?: boolean, selected?: boolean) => import("@emotion/react").SerializedStyles;
3
+ export declare const itemNameStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const listItemNameStyles: import("@emotion/react").SerializedStyles;
5
+ export declare const listItemContextStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const itemIconStyles: import("@emotion/react").SerializedStyles;
7
+ export declare const imgStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,4 @@
1
+ export declare const recentListStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const containerStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const searchIconStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const listTitleStyles: import("@emotion/react").SerializedStyles;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { TextFieldProps } from '@atlaskit/textfield';
3
3
  export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'autoFocus' | 'onSubmit'> {
4
4
  name: string;
@@ -13,5 +13,5 @@ export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'auto
13
13
  clearLabel?: string;
14
14
  error?: string | null;
15
15
  }
16
- declare const PanelTextInput: (props: Props) => JSX.Element;
16
+ declare const PanelTextInput: (props: Props) => jsx.JSX.Element;
17
17
  export default PanelTextInput;
@@ -0,0 +1,2 @@
1
+ export declare const clearTextButtonStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const fieldStyles: import("@emotion/react").SerializedStyles;
@@ -1,4 +1,3 @@
1
1
  import { KeyboardEvent } from 'react';
2
- export declare const relativeFontSizeToBase16: (px: number | string) => string;
3
2
  export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
4
3
  export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -36,14 +36,13 @@
36
36
  "@atlaskit/tooltip": "^17.5.0",
37
37
  "@atlaskit/visually-hidden": "^1.0.0",
38
38
  "@babel/runtime": "^7.0.0",
39
- "@emotion/core": "^10.0.9",
39
+ "@emotion/react": "^11.7.1",
40
40
  "date-fns": "^2.17.0",
41
41
  "linkify-it": "^2.0.3"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "^16.8.0",
45
- "react-intl-next": "npm:react-intl@^5.18.1",
46
- "styled-components": "^3.2.6"
45
+ "react-intl-next": "npm:react-intl@^5.18.1"
47
46
  },
48
47
  "devDependencies": {
49
48
  "@atlaskit/activity-provider": "^2.3.2",
@@ -56,11 +55,13 @@
56
55
  "@atlaskit/visual-regression": "*",
57
56
  "@atlaskit/webdriver-runner": "*",
58
57
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
59
- "@atlassian/link-picker-atlassian-plugin": "^6.0.0",
58
+ "@atlassian/link-picker-atlassian-plugin": "^8.0.0",
60
59
  "@atlassian/search-provider": "^2.3.0",
60
+ "@testing-library/dom": "^7.7.3",
61
61
  "@testing-library/react": "^8.0.1",
62
62
  "enzyme": "^3.10.0",
63
63
  "fetch-mock": "^8.0.0",
64
+ "mockdate": "^3.0.2",
64
65
  "react-dom": "^16.8.0",
65
66
  "sinon": "^2.2.0",
66
67
  "typescript": "4.2.4"
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.recentListStyles = exports.SearchIconWrapper = exports.ListTitleStyles = exports.ListItemWrapper = exports.ListItemName = exports.ListItemContext = exports.ItemNameWrapper = exports.ItemIconWrapper = exports.ImgStyles = exports.FieldWrapper = exports.Container = exports.ClearText = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _tokens = require("@atlaskit/tokens");
15
-
16
- var _core = require("@emotion/core");
17
-
18
- var _colors = require("@atlaskit/theme/colors");
19
-
20
- var _constants = require("@atlaskit/theme/constants");
21
-
22
- var _utils = require("./utils");
23
-
24
- var _theme = require("@atlaskit/theme");
25
-
26
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
27
-
28
- var LINK_PICKER_WIDTH_IN_PX = 342;
29
- var recentListStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n background: ", ";\n"])), LINK_PICKER_WIDTH_IN_PX, (0, _tokens.token)('elevation.surface.overlay', _colors.N0));
30
- exports.recentListStyles = recentListStyles;
31
-
32
- var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding: ", "px;\n width: 100%;\n overflow: hidden;\n line-height: initial;\n box-sizing: border-box;\n"])), (0, _constants.gridSize)() * 2);
33
-
34
- exports.Container = Container;
35
-
36
- var ClearText = _styledComponents.default.button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), (0, _constants.gridSize)() / 2, (0, _tokens.token)('color.icon.subtle', _colors.N500));
37
-
38
- exports.ClearText = ClearText;
39
-
40
- var FieldWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: ", "px;\n"])), (0, _constants.gridSize)() * 2);
41
-
42
- exports.FieldWrapper = FieldWrapper;
43
-
44
- var SearchIconWrapper = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", "px;\n color: ", ";\n cursor: default;\n"])), (0, _constants.gridSize)() / 2, (0, _tokens.token)('color.icon', _colors.N500));
45
-
46
- exports.SearchIconWrapper = SearchIconWrapper;
47
- var ListTitleStyles = (0, _core.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n text-transform: uppercase;\n margin-bottom: ", "px;\n"])), _theme.typography.h100(), (0, _constants.gridSize)() / 2);
48
- exports.ListTitleStyles = ListTitleStyles;
49
-
50
- var ListItemWrapper = _styledComponents.default.li(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n padding: ", "px ", "px;\n margin: 0 -", "px;\n cursor: pointer;\n background-color: ", ";\n box-shadow: inset 2px 0px 0px\n ", ";\n"])), (0, _constants.gridSize)(), (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() * 2, function (props) {
51
- switch (true) {
52
- case props.selected:
53
- return (0, _tokens.token)('color.background.selected', _colors.B50);
54
-
55
- case props.active:
56
- return (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20);
57
-
58
- default:
59
- return 'transparent';
60
- }
61
- }, function (props) {
62
- switch (true) {
63
- case props.active:
64
- case props.selected:
65
- return (0, _tokens.token)('color.border.selected', _colors.B400);
66
-
67
- default:
68
- return 'transparent';
69
- }
70
- });
71
-
72
- exports.ListItemWrapper = ListItemWrapper;
73
-
74
- var ItemNameWrapper = _styledComponents.default.span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n"])));
75
-
76
- exports.ItemNameWrapper = ItemNameWrapper;
77
-
78
- var ListItemName = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 20px;\n"])), (0, _tokens.token)('color.text', _colors.N800));
79
-
80
- exports.ListItemName = ListItemName;
81
-
82
- var ListItemContext = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: ", ";\n line-height: ", "px;\n"])), (0, _tokens.token)('color.text', _colors.N300), (0, _utils.relativeFontSizeToBase16)((0, _theme.fontSizeSmall)()), (0, _theme.fontSize)());
83
-
84
- exports.ListItemContext = ListItemContext;
85
-
86
- var ItemIconWrapper = _styledComponents.default.span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n min-width: ", "px;\n margin-top: 3px;\n margin-right: 12px;\n"])), (0, _constants.gridSize)() * 2);
87
-
88
- exports.ItemIconWrapper = ItemIconWrapper;
89
- var ImgStyles = (0, _core.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n"])), (0, _constants.gridSize)() * 2);
90
- exports.ImgStyles = ImgStyles;
@@ -1,94 +0,0 @@
1
- import styled from 'styled-components';
2
- import { token } from '@atlaskit/tokens';
3
- import { css } from '@emotion/core';
4
- import { N500, N0, B50, N300, N800, N20, B400 } from '@atlaskit/theme/colors';
5
- import { gridSize } from '@atlaskit/theme/constants';
6
- import { relativeFontSizeToBase16 } from './utils'; // AFP-2532 TODO: Fix automatic suppressions below
7
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
8
-
9
- import { fontSizeSmall, fontSize, typography } from '@atlaskit/theme';
10
- const LINK_PICKER_WIDTH_IN_PX = 342;
11
- export const recentListStyles = css`
12
- width: ${LINK_PICKER_WIDTH_IN_PX}px;
13
- background: ${token('elevation.surface.overlay', N0)};
14
- `;
15
- export const Container = styled.div`
16
- padding: ${gridSize() * 2}px;
17
- width: 100%;
18
- overflow: hidden;
19
- line-height: initial;
20
- box-sizing: border-box;
21
- `;
22
- export const ClearText = styled.button`
23
- padding: 0;
24
- margin-right: ${gridSize() / 2}px;
25
- color: ${token('color.icon.subtle', N500)};
26
- background: transparent;
27
- border: none;
28
- cursor: pointer;
29
- `;
30
- export const FieldWrapper = styled.div`
31
- margin-bottom: ${gridSize() * 2}px;
32
- `;
33
- export const SearchIconWrapper = styled.span`
34
- margin-left: ${gridSize() / 2}px;
35
- color: ${token('color.icon', N500)};
36
- cursor: default;
37
- `;
38
- export const ListTitleStyles = css`
39
- ${typography.h100()}
40
- text-transform: uppercase;
41
- margin-bottom: ${gridSize() / 2}px;
42
- `;
43
- export const ListItemWrapper = styled.li`
44
- display: flex;
45
- padding: ${gridSize()}px ${gridSize() * 2}px;
46
- margin: 0 -${gridSize() * 2}px;
47
- cursor: pointer;
48
- background-color: ${props => {
49
- switch (true) {
50
- case props.selected:
51
- return token('color.background.selected', B50);
52
-
53
- case props.active:
54
- return token('color.background.neutral.subtle.hovered', N20);
55
-
56
- default:
57
- return 'transparent';
58
- }
59
- }};
60
- box-shadow: inset 2px 0px 0px
61
- ${props => {
62
- switch (true) {
63
- case props.active:
64
- case props.selected:
65
- return token('color.border.selected', B400);
66
-
67
- default:
68
- return 'transparent';
69
- }
70
- }};
71
- `;
72
- export const ItemNameWrapper = styled.span`
73
- overflow: hidden;
74
- `;
75
- export const ListItemName = styled.div`
76
- color: ${token('color.text', N800)};
77
- overflow: hidden;
78
- text-overflow: ellipsis;
79
- white-space: nowrap;
80
- line-height: 20px;
81
- `;
82
- export const ListItemContext = styled.div`
83
- color: ${token('color.text', N300)};
84
- font-size: ${relativeFontSizeToBase16(fontSizeSmall())};
85
- line-height: ${fontSize()}px;
86
- `;
87
- export const ItemIconWrapper = styled.span`
88
- min-width: ${gridSize() * 2}px;
89
- margin-top: 3px;
90
- margin-right: 12px;
91
- `;
92
- export const ImgStyles = css`
93
- max-width: ${gridSize() * 2}px;
94
- `;
@@ -1,88 +0,0 @@
1
- /** @jsx jsx */
2
- import { Fragment } from 'react';
3
- import { jsx } from '@emotion/core';
4
- import { injectIntl } from 'react-intl-next';
5
- import { transformTimeStamp } from '../transformTimeStamp';
6
- import { ItemNameWrapper, ItemIconWrapper, ListItemContext, ListItemName, ListItemWrapper, ImgStyles } from '../styles';
7
-
8
- const LinkSearchListItem = ({
9
- item,
10
- selected,
11
- active,
12
- id,
13
- role,
14
- intl,
15
- onSelect,
16
- onMouseEnter,
17
- onMouseLeave
18
- }) => {
19
- const handleSelect = () => onSelect(item.objectId);
20
-
21
- const handleMouseEnter = () => onMouseEnter(item.objectId);
22
-
23
- const handleMouseLeave = () => onMouseLeave(item.objectId);
24
-
25
- return jsx(ListItemWrapper, {
26
- role: role,
27
- id: id,
28
- "aria-selected": selected,
29
- "data-testid": "link-search-list-item",
30
- selected: selected,
31
- active: active,
32
- onMouseEnter: handleMouseEnter,
33
- onMouseLeave: handleMouseLeave,
34
- onClick: handleSelect
35
- }, jsx(ListItemIcon, {
36
- item: item,
37
- intl: intl
38
- }), jsx(ItemNameWrapper, null, jsx(ListItemName, null, item.name), jsx(ListItemContext, null, item.container, jsx(ItemTimeStamp, {
39
- date: transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate)
40
- }))));
41
- };
42
-
43
- export default injectIntl(LinkSearchListItem);
44
-
45
- const ItemTimeStamp = props => {
46
- const {
47
- date
48
- } = props;
49
-
50
- if (!date) {
51
- return null;
52
- }
53
-
54
- return jsx(Fragment, null, "\xA0 \u2022", jsx("span", {
55
- className: "link-search-timestamp",
56
- "data-test-id": "link-search-timestamp"
57
- }, "\xA0 ", date.pageAction, " ", date.dateString, " ", date.timeSince || ''));
58
- };
59
-
60
- const ListItemIcon = props => {
61
- const {
62
- item,
63
- intl
64
- } = props;
65
- const {
66
- icon,
67
- iconAlt
68
- } = item;
69
-
70
- if (!icon) {
71
- return null;
72
- }
73
-
74
- const alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
75
-
76
- if (typeof icon !== 'string') {
77
- const Glyph = icon;
78
- return jsx(ItemIconWrapper, null, jsx(Glyph, {
79
- alt: alt
80
- }));
81
- }
82
-
83
- return jsx(ItemIconWrapper, null, jsx("img", {
84
- src: icon,
85
- alt: alt,
86
- css: ImgStyles
87
- }));
88
- };
@@ -1,46 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
4
-
5
- import styled from 'styled-components';
6
- import { token } from '@atlaskit/tokens';
7
- import { css } from '@emotion/core';
8
- import { N500, N0, B50, N300, N800, N20, B400 } from '@atlaskit/theme/colors';
9
- import { gridSize } from '@atlaskit/theme/constants';
10
- import { relativeFontSizeToBase16 } from './utils'; // AFP-2532 TODO: Fix automatic suppressions below
11
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
12
-
13
- import { fontSizeSmall, fontSize, typography } from '@atlaskit/theme';
14
- var LINK_PICKER_WIDTH_IN_PX = 342;
15
- export var recentListStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n background: ", ";\n"])), LINK_PICKER_WIDTH_IN_PX, token('elevation.surface.overlay', N0));
16
- export var Container = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", "px;\n width: 100%;\n overflow: hidden;\n line-height: initial;\n box-sizing: border-box;\n"])), gridSize() * 2);
17
- export var ClearText = styled.button(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), gridSize() / 2, token('color.icon.subtle', N500));
18
- export var FieldWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n"])), gridSize() * 2);
19
- export var SearchIconWrapper = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n color: ", ";\n cursor: default;\n"])), gridSize() / 2, token('color.icon', N500));
20
- export var ListTitleStyles = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n text-transform: uppercase;\n margin-bottom: ", "px;\n"])), typography.h100(), gridSize() / 2);
21
- export var ListItemWrapper = styled.li(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n padding: ", "px ", "px;\n margin: 0 -", "px;\n cursor: pointer;\n background-color: ", ";\n box-shadow: inset 2px 0px 0px\n ", ";\n"])), gridSize(), gridSize() * 2, gridSize() * 2, function (props) {
22
- switch (true) {
23
- case props.selected:
24
- return token('color.background.selected', B50);
25
-
26
- case props.active:
27
- return token('color.background.neutral.subtle.hovered', N20);
28
-
29
- default:
30
- return 'transparent';
31
- }
32
- }, function (props) {
33
- switch (true) {
34
- case props.active:
35
- case props.selected:
36
- return token('color.border.selected', B400);
37
-
38
- default:
39
- return 'transparent';
40
- }
41
- });
42
- export var ItemNameWrapper = styled.span(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
43
- export var ListItemName = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 20px;\n"])), token('color.text', N800));
44
- export var ListItemContext = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n line-height: ", "px;\n"])), token('color.text', N300), relativeFontSizeToBase16(fontSizeSmall()), fontSize());
45
- export var ItemIconWrapper = styled.span(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n min-width: ", "px;\n margin-top: 3px;\n margin-right: 12px;\n"])), gridSize() * 2);
46
- export var ImgStyles = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n max-width: ", "px;\n"])), gridSize() * 2);
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const recentListStyles: import("@emotion/utils").SerializedStyles;
3
- export declare const Container: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
4
- export declare const ClearText: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>>;
5
- export declare const FieldWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
6
- export declare const SearchIconWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
7
- export declare const ListTitleStyles: import("@emotion/utils").SerializedStyles;
8
- interface ListItemProps {
9
- active: boolean;
10
- selected: boolean;
11
- }
12
- export declare const ListItemWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & ListItemProps, any, import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & ListItemProps>;
13
- export declare const ItemNameWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
14
- export declare const ListItemName: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
15
- export declare const ListItemContext: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
16
- export declare const ItemIconWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
17
- export declare const ImgStyles: import("@emotion/utils").SerializedStyles;
18
- export {};