@jetbrains/ring-ui-built 7.0.30 → 7.0.32

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.
@@ -47,6 +47,13 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  }
48
48
  return t;
49
49
  }
50
+ function _taggedTemplateLiteral(e, t) {
51
+ return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
52
+ raw: {
53
+ value: Object.freeze(t)
54
+ }
55
+ }));
56
+ }
50
57
  function _toPrimitive(t, r) {
51
58
  if ("object" != typeof t || !t) return t;
52
59
  var e = t[Symbol.toPrimitive];
@@ -62,4 +69,4 @@ function _toPropertyKey(t) {
62
69
  return "symbol" == typeof i ? i : i + "";
63
70
  }
64
71
 
65
- export { _defineProperty as _, _objectWithoutProperties as a, _objectSpread2 as b, _toPropertyKey as c };
72
+ export { _defineProperty as _, _objectWithoutProperties as a, _objectSpread2 as b, _taggedTemplateLiteral as c, _toPropertyKey as d };
@@ -30,4 +30,4 @@ function AvatarInfo(_ref) {
30
30
  });
31
31
  }
32
32
 
33
- export { AvatarInfo as A, styles as s };
33
+ export { AvatarInfo as A, fontSizes as f, styles as s };
@@ -46,9 +46,8 @@ class UserCard extends PureComponent {
46
46
  const translations = this.props.translations;
47
47
  const classes = classNames(className, {});
48
48
  const userActiveStatusClasses = classNames(styles.userActiveStatus, user.online ? styles.online : '');
49
- return jsx("div", _objectSpread2(_objectSpread2({
50
- className: classes
51
- }, restProps), {}, {
49
+ return jsx("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
50
+ className: classes,
52
51
  children: jsxs("div", {
53
52
  className: styles.userInformationContainer,
54
53
  children: [jsxs("div", {
@@ -68,6 +67,7 @@ class UserCard extends PureComponent {
68
67
  children: [user.href && jsx(Link, {
69
68
  href: user.href,
70
69
  className: styles.userName,
70
+ "data-test": "user-card-link",
71
71
  children: user.name
72
72
  }), !user.href && jsx("span", {
73
73
  className: styles.userName,
@@ -4,5 +4,6 @@ interface InfoAvatarProps {
4
4
  size: Size;
5
5
  children?: ReactNode;
6
6
  }
7
+ export declare const fontSizes: Record<Size, number>;
7
8
  export default function AvatarInfo({ size, children }: InfoAvatarProps): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -1,4 +1,4 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'classnames';
3
- export { A as default } from '../_helpers/avatar-info.js';
3
+ export { A as default, f as fontSizes } from '../_helpers/avatar-info.js';
4
4
  import './avatar-size.js';
@@ -1,45 +1,41 @@
1
- import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import { jsx } from 'react/jsx-runtime';
3
- import figma from '@figma/code-connect';
4
- import Avatar from './avatar.js';
5
- import { Size } from './avatar-size.js';
6
- import 'core-js/modules/es.string.includes.js';
7
- import 'core-js/modules/web.dom-collections.iterator.js';
8
- import 'react';
9
- import 'classnames';
10
- import 'util-deprecate';
11
- import '../global/url.js';
12
- import 'core-js/modules/es.regexp.exec.js';
13
- import 'core-js/modules/es.string.match.js';
14
- import 'core-js/modules/es.string.replace.js';
15
- import '../global/dom.js';
16
- import 'core-js/modules/es.object.assign.js';
17
- import 'core-js/modules/es.string.split.js';
18
- import '../global/memoize.js';
19
- import 'core-js/modules/es.weak-map.js';
20
- import '../_helpers/avatar-info.js';
21
- import './fallback-avatar.js';
22
- import '../global/get-uid.js';
23
- import 'core-js/modules/es.regexp.to-string.js';
1
+ import { c as _taggedTemplateLiteral } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.parse-int.js';
24
3
 
25
- figma.connect(Avatar, 'https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?m=auto&node-id=5990-522&t=v8bItK8qotmnbysK-1', {
26
- props: {
27
- round: figma.boolean('Round'),
28
- size: figma.enum('Size', {
29
- '20 px': Size.Size20,
30
- '24 px': Size.Size24,
31
- '28 px': Size.Size28,
32
- '32 px': Size.Size32,
33
- '40px': Size.Size40,
34
- '56px': Size.Size56
35
- }),
36
- username: figma.enum('Content', {
37
- name: 'Samuel Morse'
38
- }),
39
- url: figma.enum('Content', {
40
- 'color/image': 'avatar.png'
41
- })
42
- },
43
- example: props => jsx(Avatar, _objectSpread2({}, props)),
44
- imports: ['import Avatar, {Size} from "@jetbrains/ring-ui/components/avatar/avatar"']
45
- });
4
+ var _templateObject;
5
+ // url=https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?node-id=5990-522
6
+ const figma = require('figma');
7
+ const instance = figma.selectedInstance;
8
+ const round = instance.getBoolean('Round');
9
+ const size = parseInt(instance.getString('Size'), 10);
10
+ const content = instance.getString('Content');
11
+ const props = [];
12
+ const DEFAULT_SIZE = 20;
13
+ const isDefaultSize = size === DEFAULT_SIZE;
14
+ const imports = ["import Avatar".concat(isDefaultSize ? '' : ', {Size}', " from '@jetbrains/ring-ui/components/avatar/avatar'")];
15
+ if (!isDefaultSize) {
16
+ props.push("size={Size.Size".concat(size, "}"));
17
+ }
18
+ switch (content) {
19
+ case 'color/image':
20
+ props.push('url="avatar.png"');
21
+ break;
22
+ case 'name':
23
+ props.push('username="Samuel Morse"');
24
+ break;
25
+ case 'label':
26
+ props.push('info="5"');
27
+ break;
28
+ case 'icon':
29
+ imports.push("import Icon from '@jetbrains/ring-ui/components/icon/icon'", "import warningIcon from '@jetbrains/icons/warning.svg'");
30
+ props.push('info={<Icon glyph={warningIcon} />}');
31
+ break;
32
+ }
33
+ if (round) {
34
+ props.push('round');
35
+ }
36
+ var avatar_figma = {
37
+ id: 'avatar',
38
+ example: figma.code(_templateObject || (_templateObject = _taggedTemplateLiteral(["", "\n\n<Avatar ", "/>"])), imports.join('\n'), props.map(prop => "".concat(prop, " ")).join(''))
39
+ };
40
+
41
+ export { avatar_figma as default };
@@ -4,7 +4,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { useState, Children } from 'react';
5
5
  import classNames from 'classnames';
6
6
  import DropdownMenu from '../dropdown-menu/dropdown-menu.js';
7
- import '../avatar/avatar.js';
7
+ import Avatar from '../avatar/avatar.js';
8
+ import { f as fontSizes } from '../_helpers/avatar-info.js';
8
9
  import { Size } from '../avatar/avatar-size.js';
9
10
  import 'core-js/modules/es.object.assign.js';
10
11
  import '../list/list.js';
@@ -50,7 +51,6 @@ import '../_helpers/list.js';
50
51
  import '../list/consts.js';
51
52
  import '../list/list__classes.js';
52
53
  import '../global/url.js';
53
- import '../_helpers/avatar-info.js';
54
54
  import '../avatar/fallback-avatar.js';
55
55
  import '../list/list__custom.js';
56
56
  import '../global/get-event-key.js';
@@ -75,7 +75,7 @@ import 'core-js/modules/es.array.sort.js';
75
75
  import '../popup/popup.consts.js';
76
76
  import '../popup/popup.target.js';
77
77
 
78
- var styles = {"avatarStack":"avatarStack_rui_9a0c","extraText":"extraText_rui_9a0c resetButton_rui_8bff","item":"item_rui_9a0c","size20":"size20_rui_9a0c","size24":"size24_rui_9a0c","size28":"size28_rui_9a0c","size32":"size32_rui_9a0c","size40":"size40_rui_9a0c","size56":"size56_rui_9a0c","hovered":"hovered_rui_9a0c","extra":"extra_rui_9a0c item_rui_9a0c"};
78
+ var styles = {"avatarStack":"avatarStack_rui_9a0c","extraText":"extraText_rui_9a0c","item":"item_rui_9a0c","size20":"size20_rui_9a0c","size24":"size24_rui_9a0c","size28":"size28_rui_9a0c","size32":"size32_rui_9a0c","size40":"size40_rui_9a0c","size56":"size56_rui_9a0c","hovered":"hovered_rui_9a0c","extra":"extra_rui_9a0c item_rui_9a0c","extraButton":"extraButton_rui_9a0c resetButton_rui_8bff"};
79
79
 
80
80
  const _excluded = ["children", "className", "size", "extraItems", "dropdownMenuProps"];
81
81
  function AvatarStack(_ref) {
@@ -108,12 +108,19 @@ function AvatarStack(_ref) {
108
108
  style: {
109
109
  width: size,
110
110
  height: size,
111
- '--ring-avatar-stack-index': Children.count(children)
111
+ '--ring-avatar-stack-index': Children.count(children),
112
+ fontSize: fontSizes[size]
112
113
  },
113
114
  anchor: jsx("button", {
114
115
  type: "button",
115
- className: styles.extraText,
116
- children: "+".concat(extraItems.length)
116
+ className: styles.extraButton,
117
+ children: jsx(Avatar, {
118
+ size: size,
119
+ info: jsx("span", {
120
+ className: styles.extraText,
121
+ children: "+".concat(extraItems.length)
122
+ })
123
+ })
117
124
  }),
118
125
  data: extraItems,
119
126
  menuProps: _objectSpread2({
@@ -1,108 +1,78 @@
1
- import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import { jsx } from 'react/jsx-runtime';
3
- import figma from '@figma/code-connect';
4
- import addIcon from '@jetbrains/icons/add';
5
- import add12pxIcon from '@jetbrains/icons/add-12px';
6
- import downloadIcon from '@jetbrains/icons/download';
7
- import download12pxIcon from '@jetbrains/icons/download-12px';
8
- import { ControlsHeight } from '../global/controls-height.js';
9
- import { Button } from './button.js';
10
- import 'react';
11
- import 'core-js/modules/web.dom-collections.iterator.js';
12
- import 'classnames';
13
- import '@jetbrains/icons/chevron-down';
14
- import '@jetbrains/icons/chevron-12px-down';
15
- import 'util-deprecate';
16
- import '../icon/icon.js';
17
- import '../icon/icon__constants.js';
18
- import '../_helpers/icon__svg.js';
19
- import 'core-js/modules/es.regexp.exec.js';
20
- import 'core-js/modules/es.string.replace.js';
21
- import 'core-js/modules/es.string.starts-with.js';
22
- import '../global/memoize.js';
23
- import 'core-js/modules/es.weak-map.js';
24
- import '../link/clickableLink.js';
25
- import '../_helpers/button__classes.js';
1
+ import { c as _taggedTemplateLiteral } from '../_helpers/_rollupPluginBabelHelpers.js';
26
2
 
27
- const _excluded = ["children"];
28
- figma.connect(Button, 'https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?node-id=9954%3A528', {
29
- props: {
30
- height: figma.enum('Size', {
31
- S: ControlsHeight.S,
32
- M: ControlsHeight.M,
33
- L: ControlsHeight.L
34
- }),
35
- children: figma.enum('Type', {
36
- Label: 'Button',
37
- 'L-Icon-Label': 'Button',
38
- 'R-Icon-Label': 'Button'
39
- }),
40
- icon: figma.enum('Type', {
41
- 'L-Icon-Label': figma.enum('Size', {
42
- S: figma.enum('Variant', {
43
- Main: download12pxIcon,
44
- Green: download12pxIcon,
45
- 'Red solid': download12pxIcon,
46
- Gray: download12pxIcon,
47
- Outlined: download12pxIcon,
48
- 'Red outlined': download12pxIcon,
49
- Ghost: download12pxIcon,
50
- Text: downloadIcon
51
- }),
52
- M: downloadIcon,
53
- L: downloadIcon
54
- }),
55
- Icon: figma.enum('Size', {
56
- S: figma.enum('Variant', {
57
- Main: add12pxIcon,
58
- Green: add12pxIcon,
59
- 'Red solid': add12pxIcon,
60
- Gray: add12pxIcon,
61
- Outlined: add12pxIcon,
62
- 'Red outlined': add12pxIcon,
63
- Ghost: add12pxIcon,
64
- Text: addIcon
65
- }),
66
- M: addIcon,
67
- L: addIcon
68
- })
69
- }),
70
- dropdown: figma.enum('Type', {
71
- 'R-Icon-Label': true
72
- }),
73
- disabled: figma.enum('State', {
74
- Disabled: true
75
- }),
76
- primary: figma.enum('Variant', {
77
- Main: true
78
- }),
79
- success: figma.enum('Variant', {
80
- Green: true
81
- }),
82
- error: figma.enum('Variant', {
83
- 'Red solid': true
84
- }),
85
- secondary: figma.enum('Variant', {
86
- Gray: true
87
- }),
88
- danger: figma.enum('Variant', {
89
- 'Red outlined': true
90
- }),
91
- ghost: figma.enum('Variant', {
92
- Ghost: true
93
- }),
94
- inline: figma.enum('Variant', {
95
- Text: true
96
- })
97
- },
98
- example: _ref => {
99
- let {
100
- children
101
- } = _ref,
102
- restProps = _objectWithoutProperties(_ref, _excluded);
103
- return jsx(Button, _objectSpread2(_objectSpread2({}, restProps), {}, {
104
- children: children
105
- }));
106
- },
107
- imports: ['import Button from "@jetbrains/ring-ui/components/button/button"', 'import {ControlsHeight} from "@jetbrains/ring-ui/components/global/controls-height"', 'import addIcon from "@jetbrains/icons/add"', 'import add12pxIcon from "@jetbrains/icons/add-12px"', 'import downloadIcon from "@jetbrains/icons/download"', 'import download12pxIcon from "@jetbrains/icons/download-12px"']
108
- });
3
+ var _templateObject;
4
+ const figma = require('figma');
5
+ const instance = figma.selectedInstance;
6
+ const size = instance.getString('Size');
7
+ const type = instance.getString('Type');
8
+ const state = instance.getString('State');
9
+ const variant = instance.getString('Variant');
10
+ const imports = ["import Button from '@jetbrains/ring-ui/components/button/button'"];
11
+ const props = [];
12
+ const DEFAULT_SIZE = 'M';
13
+ const isDefaultSize = size === DEFAULT_SIZE;
14
+ if (!isDefaultSize) {
15
+ imports.push("import {ControlsHeight} from '@jetbrains/ring-ui/components/global/controls-height'");
16
+ props.push("height={ControlsHeight.".concat(size, "}"));
17
+ }
18
+ switch (variant) {
19
+ case 'Red outlined':
20
+ props.push('danger');
21
+ break;
22
+ case 'Main':
23
+ props.push('primary');
24
+ break;
25
+ case 'Green':
26
+ props.push('success');
27
+ break;
28
+ case 'Red solid':
29
+ props.push('error');
30
+ break;
31
+ case 'Gray':
32
+ props.push('secondary');
33
+ break;
34
+ case 'Ghost':
35
+ props.push('ghost');
36
+ break;
37
+ case 'Text':
38
+ props.push('inline');
39
+ break;
40
+ }
41
+ let children = 'Button';
42
+ const use12pxIcon = size === 'S' && variant !== 'Text';
43
+ let useButtonGroup = false;
44
+ switch (type) {
45
+ case 'R-Icon-Label':
46
+ props.push('dropdown');
47
+ break;
48
+ case 'L-Icon-Label':
49
+ imports.push("import downloadIcon from '@jetbrains/icons/download".concat(use12pxIcon ? '-12px' : '', "'"));
50
+ props.push('icon={downloadIcon}');
51
+ break;
52
+ case 'Icon':
53
+ children = null;
54
+ imports.push("import addIcon from '@jetbrains/icons/add".concat(use12pxIcon ? '-12px' : '', "'"));
55
+ props.push('icon={addIcon}');
56
+ break;
57
+ case 'Split':
58
+ imports.push("import ButtonGroup from '@jetbrains/ring-ui/components/button-group/button-group'");
59
+ imports.push("import chevronDownIcon from '@jetbrains/icons/chevron-down".concat(use12pxIcon ? '-12px' : '', "'"));
60
+ useButtonGroup = true;
61
+ break;
62
+ }
63
+ switch (state) {
64
+ case 'Disabled':
65
+ props.push('disabled');
66
+ break;
67
+ }
68
+ const joinedProps = props.map(prop => "".concat(prop, " ")).join('');
69
+ // prettier-ignore
70
+ const button = children ? "<Button ".concat(joinedProps, ">\n ").concat(children, "\n</Button>") : "<Button ".concat(joinedProps, "/>");
71
+ var button_figma = {
72
+ id: 'button',
73
+ example: figma.code(_templateObject || (_templateObject = _taggedTemplateLiteral(["", "\n\n", ""])), imports.join('\n'),
74
+ // prettier-ignore
75
+ useButtonGroup ? "<ButtonGroup>\n ".concat(button, "\n <Button ").concat(joinedProps, " icon={chevronDownIcon} />\n</ButtonGroup>") : button)
76
+ };
77
+
78
+ export { button_figma as default };
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty, b as _objectSpread2, a as _objectWithoutProperties, c as _toPropertyKey } from '../_helpers/_rollupPluginBabelHelpers.js';
1
+ import { _ as _defineProperty, b as _objectSpread2, a as _objectWithoutProperties, d as _toPropertyKey } from '../_helpers/_rollupPluginBabelHelpers.js';
2
2
  import 'core-js/modules/es.object.assign.js';
3
3
  import 'core-js/modules/es.regexp.exec.js';
4
4
  import 'core-js/modules/es.string.replace.js';