@jetbrains/ring-ui-built 7.0.31 → 7.0.33

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 };
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import classNames from 'classnames';
3
3
  import { Size } from '../avatar/avatar-size.js';
4
4
 
5
- var styles = {"avatar":"avatar_rui_a03e","avatarShadow":"avatarShadow_rui_a03e","avatarInfo":"avatarInfo_rui_a03e","subavatar":"subavatar_rui_a03e","empty":"empty_rui_a03e"};
5
+ var styles = {"avatar":"avatar_rui_a03e","round":"round_rui_a03e","avatarShadow":"avatarShadow_rui_a03e","avatarInfo":"avatarInfo_rui_a03e","subavatar":"subavatar_rui_a03e","empty":"empty_rui_a03e"};
6
6
 
7
7
  const fontSizes = {
8
8
  [Size.Size16]: 9,
@@ -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 };
@@ -15,7 +15,7 @@ import ControlHelp from '../control-help/control-help.js';
15
15
 
16
16
  var inputStyles = {"outerContainer":"outerContainer_rui_e356","borderless":"borderless_rui_e356","container":"container_rui_e356","input":"input_rui_e356","error":"error_rui_e356","withIcon":"withIcon_rui_e356","clearable":"clearable_rui_e356","icon":"icon_rui_e356","clear":"clear_rui_e356","empty":"empty_rui_e356","errorText":"errorText_rui_e356","helpText":"helpText_rui_e356","sizeS":"sizeS_rui_e356","sizeM":"sizeM_rui_e356","sizeL":"sizeL_rui_e356","sizeFULL":"sizeFULL_rui_e356","heightS":"heightS_rui_e356","heightM":"heightM_rui_e356","heightL":"heightL_rui_e356"};
17
17
 
18
- const _excluded = ["size", "multiline", "borderless", "label", "labelType", "error", "help", "className", "inputClassName", "children", "value", "onClear", "disabled", "inputRef", "onChange", "enableShortcuts", "id", "placeholder", "icon", "translations", "height", "afterInput"];
18
+ const _excluded = ["size", "multiline", "borderless", "label", "labelType", "error", "help", "className", "inputClassName", "children", "value", "onClear", "disabled", "inputRef", "onChange", "enableShortcuts", "id", "placeholder", "icon", "translations", "height", "beforeInput", "afterInput"];
19
19
  function noop() {}
20
20
  /**
21
21
  * @name Input
@@ -119,6 +119,7 @@ class Input extends PureComponent {
119
119
  icon,
120
120
  translations,
121
121
  height = this.context,
122
+ beforeInput,
122
123
  afterInput
123
124
  } = _this$props4,
124
125
  restProps = _objectWithoutProperties(_this$props4, _excluded);
@@ -165,7 +166,7 @@ class Input extends PureComponent {
165
166
  children: [icon && jsx(Icon, {
166
167
  glyph: icon,
167
168
  className: inputStyles.icon
168
- }), multiline ? jsx("textarea", _objectSpread2(_objectSpread2({
169
+ }), beforeInput, multiline ? jsx("textarea", _objectSpread2(_objectSpread2({
169
170
  onChange: this.handleTextareaChange,
170
171
  rows: 1
171
172
  }, commonProps), restProps)) : jsx("input", _objectSpread2(_objectSpread2({
@@ -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 };
@@ -8,7 +8,7 @@ import deprecate from 'util-deprecate';
8
8
  import { isDataURI, parseQueryString, encodeURL } from '../global/url.js';
9
9
  import { getPixelRatio } from '../global/dom.js';
10
10
  import memoize from '../global/memoize.js';
11
- import { A as AvatarInfo, s as styles } from '../_helpers/avatar-info.js';
11
+ import { s as styles, A as AvatarInfo } from '../_helpers/avatar-info.js';
12
12
  import FallbackAvatar from './fallback-avatar.js';
13
13
  import { Size } from './avatar-size.js';
14
14
  import 'core-js/modules/es.regexp.exec.js';
@@ -59,9 +59,7 @@ class Avatar extends PureComponent {
59
59
  }
60
60
  const sizeString = "".concat(size, "px");
61
61
  const subavatarSizeString = "".concat(subavatarSize, "px");
62
- const borderRadius = size <= Size.Size18 ? 'var(--ring-border-radius-small)' : 'var(--ring-border-radius)';
63
62
  const styleObj = _objectSpread2({
64
- borderRadius: round ? '50%' : borderRadius,
65
63
  height: sizeString,
66
64
  width: sizeString
67
65
  }, style);
@@ -70,10 +68,13 @@ class Avatar extends PureComponent {
70
68
  height: subavatarSizeString,
71
69
  width: subavatarSizeString
72
70
  }, style);
71
+ const classes = classNames(styles.avatar, this.props.className, {
72
+ [styles.round]: round
73
+ });
73
74
  if (!url || this.state.errorUrl === url) {
74
75
  return jsxs("span", _objectSpread2(_objectSpread2({}, restProps), {}, {
75
76
  "data-test": "avatar",
76
- className: classNames(styles.avatar, this.props.className, {
77
+ className: classNames(classes, {
77
78
  [styles.empty]: username == null && info == null
78
79
  }),
79
80
  style: styleObj,
@@ -108,7 +109,7 @@ class Avatar extends PureComponent {
108
109
  children: [jsx("img", _objectSpread2(_objectSpread2({}, restProps), {}, {
109
110
  onError: this.handleError,
110
111
  onLoad: this.handleSuccess,
111
- className: classNames(styles.avatar, styles.avatarShadow, this.props.className),
112
+ className: classNames(classes, styles.avatarShadow),
112
113
  style: styleObj,
113
114
  src: src,
114
115
  alt: "User avatar"
@@ -127,7 +128,7 @@ class Avatar extends PureComponent {
127
128
  "data-test": "avatar",
128
129
  onError: this.handleError,
129
130
  onLoad: this.handleSuccess,
130
- className: classNames(styles.avatar, styles.avatarShadow, this.props.className),
131
+ className: classNames(classes, styles.avatarShadow),
131
132
  style: styleObj,
132
133
  src: src,
133
134
  alt: "User avatar"
@@ -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) {
@@ -93,6 +93,9 @@ function AvatarStack(_ref) {
93
93
  [styles.hovered]: dropdownOpen
94
94
  })
95
95
  }, restProps), {}, {
96
+ style: _objectSpread2({
97
+ height: size
98
+ }, restProps.style),
96
99
  children: [Children.map(children, (child, index) => jsx("div", {
97
100
  className: styles.item,
98
101
  style: {
@@ -108,12 +111,19 @@ function AvatarStack(_ref) {
108
111
  style: {
109
112
  width: size,
110
113
  height: size,
111
- '--ring-avatar-stack-index': Children.count(children)
114
+ '--ring-avatar-stack-index': Children.count(children),
115
+ fontSize: fontSizes[size]
112
116
  },
113
117
  anchor: jsx("button", {
114
118
  type: "button",
115
- className: styles.extraText,
116
- children: "+".concat(extraItems.length)
119
+ className: styles.extraButton,
120
+ children: jsx(Avatar, {
121
+ size: size,
122
+ info: jsx("span", {
123
+ className: styles.extraText,
124
+ children: "+".concat(extraItems.length)
125
+ })
126
+ })
117
127
  }),
118
128
  data: extraItems,
119
129
  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 };
@@ -29,6 +29,7 @@ export interface InputBaseProps {
29
29
  onClear?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | null | undefined;
30
30
  icon?: string | ComponentType | null | undefined;
31
31
  height?: ControlsHeight | undefined;
32
+ beforeInput?: ReactNode;
32
33
  afterInput?: ReactNode;
33
34
  translations?: InputTranslations | null | undefined;
34
35
  }
@@ -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';