@jetbrains/ring-ui-built 7.0.74 → 7.0.76
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/components/_helpers/sidebar.js +4 -0
- package/components/banner/banner.js +136 -36
- package/components/content-layout/content-layout.d.ts +1 -0
- package/components/content-layout/sidebar.d.ts +4 -0
- package/components/date-picker/consts.d.ts +1 -1
- package/components/date-picker/date-popup.js +5 -9
- package/components/grid/grid.d.ts +1 -0
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/popup/popup.d.ts +3 -1
- package/components/popup/popup.js +10 -3
- package/components/style.css +1 -1
- package/components/tabs/collapsible-tab.js +66 -28
- package/components/upload/upload.js +155 -50
- package/package.json +3 -3
- package/components/avatar/avatar.figma.js +0 -39
- package/components/avatar-stack/avatar-stack.figma.js +0 -38
- package/components/breadcrumbs/breadcrumbs.figma.js +0 -21
- package/components/button/button.figma.js +0 -82
- package/components/checkbox/checkbox-group.figma.js +0 -34
- package/components/checkbox/checkbox.figma.js +0 -36
- package/components/error-bubble/error-bubble.figma.js +0 -14
- package/components/input/input.figma.js +0 -63
|
@@ -1,22 +1,31 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import { s as styles, T as TabLink } from '../_helpers/tab-link.js';
|
|
4
5
|
import { CustomItem } from './custom-item.js';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import 'react-compiler-runtime';
|
|
7
7
|
import '../link/link.js';
|
|
8
8
|
import '../global/data-tests.js';
|
|
9
9
|
import '../link/clickable-link.js';
|
|
10
10
|
import '../_helpers/link.js';
|
|
11
11
|
|
|
12
|
-
const TabTitle = /*#__PURE__*/React.memo(function TabTitle({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const TabTitle = /*#__PURE__*/React.memo(function TabTitle(t0) {
|
|
13
|
+
const $ = c(18);
|
|
14
|
+
if ($[0] !== "bc923b30ae31abf97ca3494d9773d25ec50a98e0a9dced298aaa6afe7b737db1") {
|
|
15
|
+
for (let $i = 0; $i < 18; $i += 1) {
|
|
16
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
17
|
+
}
|
|
18
|
+
$[0] = "bc923b30ae31abf97ca3494d9773d25ec50a98e0a9dced298aaa6afe7b737db1";
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
selected,
|
|
22
|
+
child,
|
|
23
|
+
handleSelect,
|
|
24
|
+
collapsed: t1,
|
|
25
|
+
tabIndex
|
|
26
|
+
} = t0;
|
|
27
|
+
const collapsed = t1 === undefined ? false : t1;
|
|
28
|
+
if (child === null || typeof child !== "object" || child.type === CustomItem) {
|
|
20
29
|
return child;
|
|
21
30
|
}
|
|
22
31
|
const {
|
|
@@ -29,25 +38,54 @@ const TabTitle = /*#__PURE__*/React.memo(function TabTitle({
|
|
|
29
38
|
collapsedClassName,
|
|
30
39
|
collapsedActiveClassName
|
|
31
40
|
} = child.props;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
41
|
+
const t2 = selected && activeClassName;
|
|
42
|
+
const t3 = collapsed && collapsedClassName;
|
|
43
|
+
const t4 = collapsed && selected && collapsedActiveClassName;
|
|
44
|
+
let t5;
|
|
45
|
+
if ($[1] !== className || $[2] !== collapsed || $[3] !== selected || $[4] !== t2 || $[5] !== t3 || $[6] !== t4) {
|
|
46
|
+
t5 = classNames(styles.title, className, t2, t3, t4, {
|
|
47
|
+
[styles.selected]: selected,
|
|
48
|
+
[styles.collapsed]: collapsed
|
|
49
|
+
});
|
|
50
|
+
$[1] = className;
|
|
51
|
+
$[2] = collapsed;
|
|
52
|
+
$[3] = selected;
|
|
53
|
+
$[4] = t2;
|
|
54
|
+
$[5] = t3;
|
|
55
|
+
$[6] = t4;
|
|
56
|
+
$[7] = t5;
|
|
57
|
+
} else {
|
|
58
|
+
t5 = $[7];
|
|
59
|
+
}
|
|
60
|
+
const titleClasses = t5;
|
|
61
|
+
let t6;
|
|
62
|
+
if ($[8] !== collapsed || $[9] !== disabled || $[10] !== handleSelect || $[11] !== href || $[12] !== selected || $[13] !== tabIndex || $[14] !== title || $[15] !== titleClasses || $[16] !== titleProps) {
|
|
63
|
+
t6 = /*#__PURE__*/jsx(TabLink, {
|
|
64
|
+
title: title,
|
|
65
|
+
isSelected: selected,
|
|
66
|
+
active: true,
|
|
67
|
+
href: href,
|
|
68
|
+
className: titleClasses,
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
onPlainLeftClick: handleSelect,
|
|
71
|
+
tabIndex: tabIndex,
|
|
72
|
+
collapsed: collapsed,
|
|
73
|
+
...titleProps
|
|
74
|
+
});
|
|
75
|
+
$[8] = collapsed;
|
|
76
|
+
$[9] = disabled;
|
|
77
|
+
$[10] = handleSelect;
|
|
78
|
+
$[11] = href;
|
|
79
|
+
$[12] = selected;
|
|
80
|
+
$[13] = tabIndex;
|
|
81
|
+
$[14] = title;
|
|
82
|
+
$[15] = titleClasses;
|
|
83
|
+
$[16] = titleProps;
|
|
84
|
+
$[17] = t6;
|
|
85
|
+
} else {
|
|
86
|
+
t6 = $[17];
|
|
87
|
+
}
|
|
88
|
+
return t6;
|
|
51
89
|
});
|
|
52
90
|
const getTabTitles = ({
|
|
53
91
|
items,
|
|
@@ -1,65 +1,133 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
2
|
+
import { forwardRef, useRef, useState, useImperativeHandle } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import attachmentIcon from '@jetbrains/icons/attachment';
|
|
4
5
|
import Icon from '../icon/icon.js';
|
|
5
|
-
import {
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
7
|
import 'util-deprecate';
|
|
7
8
|
import '../icon/icon.constants.js';
|
|
8
9
|
import '../_helpers/icon-svg.js';
|
|
9
|
-
import 'react-compiler-runtime';
|
|
10
10
|
import '../global/memoize.js';
|
|
11
11
|
|
|
12
12
|
var styles = {"upload":"ring-upload-upload","success":"ring-upload-success","error":"ring-upload-error","dragOver":"ring-upload-dragOver","disabled":"ring-upload-disabled","invisibleFileInput":"ring-upload-invisibleFileInput","attachmentIcon":"ring-upload-attachmentIcon"};
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const defaultRenderIcon = () => /*#__PURE__*/jsx(Icon, {
|
|
15
|
+
className: styles.attachmentIcon,
|
|
16
|
+
glyph: attachmentIcon
|
|
17
|
+
});
|
|
18
|
+
const Upload = /*#__PURE__*/forwardRef(function Upload(t0, ref) {
|
|
19
|
+
const $ = c(29);
|
|
20
|
+
if ($[0] !== "b44ca829acf458bb91f6267f4edce4951b7cb256ead04a749a52544abeecb440") {
|
|
21
|
+
for (let $i = 0; $i < 29; $i += 1) {
|
|
22
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
23
|
+
}
|
|
24
|
+
$[0] = "b44ca829acf458bb91f6267f4edce4951b7cb256ead04a749a52544abeecb440";
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
children,
|
|
28
|
+
className,
|
|
29
|
+
onFilesSelected,
|
|
30
|
+
onFilesRejected,
|
|
31
|
+
validate: t1,
|
|
32
|
+
variant: t2,
|
|
33
|
+
multiple,
|
|
34
|
+
renderIcon: t3,
|
|
35
|
+
accept,
|
|
36
|
+
disabled
|
|
37
|
+
} = t0;
|
|
38
|
+
const validate = t1 === undefined ? _temp : t1;
|
|
39
|
+
const variant = t2 === undefined ? "empty" : t2;
|
|
40
|
+
const renderIcon = t3 === undefined ? defaultRenderIcon : t3;
|
|
29
41
|
const fileInputRef = useRef(null);
|
|
30
42
|
const [dragOver, setDragOver] = useState(false);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
let t4;
|
|
44
|
+
let t5;
|
|
45
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t4 = () => ({
|
|
47
|
+
openFilePicker: () => fileInputRef.current?.click()
|
|
48
|
+
});
|
|
49
|
+
t5 = [];
|
|
50
|
+
$[1] = t4;
|
|
51
|
+
$[2] = t5;
|
|
52
|
+
} else {
|
|
53
|
+
t4 = $[1];
|
|
54
|
+
t5 = $[2];
|
|
55
|
+
}
|
|
56
|
+
useImperativeHandle(ref, t4, t5);
|
|
57
|
+
let t6;
|
|
58
|
+
if ($[3] !== onFilesRejected || $[4] !== onFilesSelected || $[5] !== validate) {
|
|
59
|
+
t6 = files => {
|
|
60
|
+
if (!files.length) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const rejected = files.filter(file => !validate(file));
|
|
64
|
+
if (rejected.length > 0) {
|
|
65
|
+
onFilesRejected?.(files);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
onFilesSelected(files);
|
|
69
|
+
};
|
|
70
|
+
$[3] = onFilesRejected;
|
|
71
|
+
$[4] = onFilesSelected;
|
|
72
|
+
$[5] = validate;
|
|
73
|
+
$[6] = t6;
|
|
74
|
+
} else {
|
|
75
|
+
t6 = $[6];
|
|
76
|
+
}
|
|
77
|
+
const handleSelectedFiles = t6;
|
|
78
|
+
let t7;
|
|
79
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
+
t7 = () => setDragOver(true);
|
|
81
|
+
$[7] = t7;
|
|
82
|
+
} else {
|
|
83
|
+
t7 = $[7];
|
|
84
|
+
}
|
|
85
|
+
const onDragEnter = t7;
|
|
86
|
+
const onDragOver = _temp2;
|
|
87
|
+
let t8;
|
|
88
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
89
|
+
t8 = () => setDragOver(false);
|
|
90
|
+
$[8] = t8;
|
|
91
|
+
} else {
|
|
92
|
+
t8 = $[8];
|
|
93
|
+
}
|
|
94
|
+
const onDragLeave = t8;
|
|
95
|
+
let t9;
|
|
96
|
+
if ($[9] !== handleSelectedFiles) {
|
|
97
|
+
t9 = () => {
|
|
98
|
+
setDragOver(false);
|
|
99
|
+
if (fileInputRef.current?.files) {
|
|
100
|
+
handleSelectedFiles(Array.from(fileInputRef.current.files));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
$[9] = handleSelectedFiles;
|
|
104
|
+
$[10] = t9;
|
|
105
|
+
} else {
|
|
106
|
+
t9 = $[10];
|
|
107
|
+
}
|
|
108
|
+
const onInputChange = t9;
|
|
109
|
+
const t10 = variant === "success";
|
|
110
|
+
const t11 = variant === "error";
|
|
111
|
+
let t12;
|
|
112
|
+
if ($[11] !== className || $[12] !== disabled || $[13] !== dragOver || $[14] !== t10 || $[15] !== t11) {
|
|
113
|
+
t12 = classNames(className, styles.upload, {
|
|
56
114
|
[styles.disabled]: disabled,
|
|
57
115
|
[styles.dragOver]: dragOver,
|
|
58
|
-
[styles.success]:
|
|
59
|
-
[styles.error]:
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
116
|
+
[styles.success]: t10,
|
|
117
|
+
[styles.error]: t11
|
|
118
|
+
});
|
|
119
|
+
$[11] = className;
|
|
120
|
+
$[12] = disabled;
|
|
121
|
+
$[13] = dragOver;
|
|
122
|
+
$[14] = t10;
|
|
123
|
+
$[15] = t11;
|
|
124
|
+
$[16] = t12;
|
|
125
|
+
} else {
|
|
126
|
+
t12 = $[16];
|
|
127
|
+
}
|
|
128
|
+
let t13;
|
|
129
|
+
if ($[17] !== accept || $[18] !== disabled || $[19] !== multiple || $[20] !== onInputChange) {
|
|
130
|
+
t13 = /*#__PURE__*/jsx("input", {
|
|
63
131
|
onDragEnter: onDragEnter,
|
|
64
132
|
onDragOver: onDragOver,
|
|
65
133
|
onDragLeave: onDragLeave,
|
|
@@ -73,8 +141,45 @@ const Upload = /*#__PURE__*/forwardRef(function Upload({
|
|
|
73
141
|
autoComplete: "off",
|
|
74
142
|
"aria-label": "file-picker",
|
|
75
143
|
className: styles.invisibleFileInput
|
|
76
|
-
})
|
|
77
|
-
|
|
144
|
+
});
|
|
145
|
+
$[17] = accept;
|
|
146
|
+
$[18] = disabled;
|
|
147
|
+
$[19] = multiple;
|
|
148
|
+
$[20] = onInputChange;
|
|
149
|
+
$[21] = t13;
|
|
150
|
+
} else {
|
|
151
|
+
t13 = $[21];
|
|
152
|
+
}
|
|
153
|
+
let t14;
|
|
154
|
+
if ($[22] !== renderIcon) {
|
|
155
|
+
t14 = renderIcon();
|
|
156
|
+
$[22] = renderIcon;
|
|
157
|
+
$[23] = t14;
|
|
158
|
+
} else {
|
|
159
|
+
t14 = $[23];
|
|
160
|
+
}
|
|
161
|
+
let t15;
|
|
162
|
+
if ($[24] !== children || $[25] !== t12 || $[26] !== t13 || $[27] !== t14) {
|
|
163
|
+
t15 = /*#__PURE__*/jsxs("div", {
|
|
164
|
+
className: t12,
|
|
165
|
+
"data-test": "ring-upload",
|
|
166
|
+
children: [t13, t14, children]
|
|
167
|
+
});
|
|
168
|
+
$[24] = children;
|
|
169
|
+
$[25] = t12;
|
|
170
|
+
$[26] = t13;
|
|
171
|
+
$[27] = t14;
|
|
172
|
+
$[28] = t15;
|
|
173
|
+
} else {
|
|
174
|
+
t15 = $[28];
|
|
175
|
+
}
|
|
176
|
+
return t15;
|
|
78
177
|
});
|
|
178
|
+
function _temp() {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
function _temp2(e) {
|
|
182
|
+
return e.preventDefault();
|
|
183
|
+
}
|
|
79
184
|
|
|
80
185
|
export { Upload, Upload as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui-built",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.76",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "JetBrains"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"postpublish": "pinst --enable",
|
|
61
61
|
"postrelease-ci": "git push --follow-tags",
|
|
62
62
|
"prea11y-audit": "playwright install",
|
|
63
|
-
"prebuild": "rimraf components && tsc --project tsconfig-build.json && cpy './**/*' '!**/*.stories.*' '!**/*.ts' '!**/*.tsx' '!**/test-helpers/mocks/**' ../components --parents --cwd=src/",
|
|
63
|
+
"prebuild": "rimraf components && tsc --project tsconfig-build.json && cpy './**/*' '!**/*.stories.*' '!**/*.figma.*' '!**/*.ts' '!**/*.tsx' '!**/test-helpers/mocks/**' ../components --parents --cwd=src/",
|
|
64
64
|
"prepare": "webpack -c .storybook/custom-header/webpack.config.js",
|
|
65
65
|
"prepublishOnly": "pinst --disable",
|
|
66
66
|
"prerelease-built-ci": "node scripts/prepare-built-package.js",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"dequal": "^2.0.3",
|
|
111
111
|
"element-resize-detector": "^1.2.4",
|
|
112
112
|
"fastdom": "^1.0.12",
|
|
113
|
-
"focus-trap": "^7.6.
|
|
113
|
+
"focus-trap": "^7.6.6",
|
|
114
114
|
"highlight.js": "^10.7.2",
|
|
115
115
|
"just-debounce-it": "^3.2.0",
|
|
116
116
|
"memoize-one": "^6.0.0",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const round = instance.getBoolean('Round');
|
|
5
|
-
const size = parseInt(instance.getString('Size'), 10);
|
|
6
|
-
const content = instance.getString('Content');
|
|
7
|
-
const props = [];
|
|
8
|
-
const DEFAULT_SIZE = 20;
|
|
9
|
-
const isDefaultSize = size === DEFAULT_SIZE;
|
|
10
|
-
const imports = [`import Avatar${isDefaultSize ? '' : ', {Size}'} from '@jetbrains/ring-ui/components/avatar/avatar'`];
|
|
11
|
-
if (!isDefaultSize) {
|
|
12
|
-
props.push(`size={Size.Size${size}}`);
|
|
13
|
-
}
|
|
14
|
-
switch (content) {
|
|
15
|
-
case 'color/image':
|
|
16
|
-
props.push('url="avatar.png"');
|
|
17
|
-
break;
|
|
18
|
-
case 'name':
|
|
19
|
-
props.push('username="Samuel Morse"');
|
|
20
|
-
break;
|
|
21
|
-
case 'label':
|
|
22
|
-
props.push(`info="${instance.findText('Content').textContent}"`);
|
|
23
|
-
break;
|
|
24
|
-
case 'icon':
|
|
25
|
-
imports.push("import Icon from '@jetbrains/ring-ui/components/icon/icon'", "import warningIcon from '@jetbrains/icons/warning.svg'");
|
|
26
|
-
props.push('info={<Icon glyph={warningIcon} />}');
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
if (round) {
|
|
30
|
-
props.push('round');
|
|
31
|
-
}
|
|
32
|
-
var avatar_figma = {
|
|
33
|
-
id: 'avatar',
|
|
34
|
-
example: figma.code`${imports.join('\n')}
|
|
35
|
-
|
|
36
|
-
<Avatar ${props.map(prop => `${prop} `).join('')}/>`
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { avatar_figma as default };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
var _sizeString$match;
|
|
4
|
-
const instance = figma.selectedInstance;
|
|
5
|
-
const sizeString = instance.getString('Size');
|
|
6
|
-
const [sizeSubstring] = (_sizeString$match = sizeString.match(/\d+/)) !== null && _sizeString$match !== void 0 ? _sizeString$match : [];
|
|
7
|
-
const size = parseInt(sizeSubstring, 10);
|
|
8
|
-
const children = instance.findConnectedInstances(() => true);
|
|
9
|
-
const imports = ["import AvatarStack from '@jetbrains/ring-ui/components/avatar-stack/avatar-stack'"];
|
|
10
|
-
const props = [];
|
|
11
|
-
const DEFAULT_SIZE = 20;
|
|
12
|
-
const isDefaultSize = size === DEFAULT_SIZE;
|
|
13
|
-
if (!isDefaultSize) {
|
|
14
|
-
props.push(`size={Size.Size${size}}`);
|
|
15
|
-
}
|
|
16
|
-
const renderedChildren = children.map(child => {
|
|
17
|
-
const {
|
|
18
|
-
example
|
|
19
|
-
} = child.executeTemplate();
|
|
20
|
-
const [childImports, code] = example[0].code.split('\n\n');
|
|
21
|
-
return {
|
|
22
|
-
imports: childImports,
|
|
23
|
-
code
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
var avatarStack_figma = {
|
|
27
|
-
id: 'avatar-stack',
|
|
28
|
-
example: figma.code`${imports.join('\n')}
|
|
29
|
-
${renderedChildren[0].imports}
|
|
30
|
-
|
|
31
|
-
<AvatarStack ${props.map(prop => `${prop} `).join('')}>
|
|
32
|
-
${renderedChildren.map(({
|
|
33
|
-
code
|
|
34
|
-
}) => code).join('\n ')}
|
|
35
|
-
</AvatarStack>`
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { avatarStack_figma as default };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const imports = ["import Breadcrumbs from '@jetbrains/ring-ui/components/breadcrumbs/breadcrumbs'", "import Link from '@jetbrains/ring-ui/components/link/link'"];
|
|
5
|
-
const children = instance.findLayers(() => true).map(layer => layer.textContent).filter(text => text !== '/');
|
|
6
|
-
var breadcrumbs_figma = {
|
|
7
|
-
id: 'breadcrumbs',
|
|
8
|
-
example: figma.code`${imports.join('\n')}
|
|
9
|
-
|
|
10
|
-
<Breadcrumbs>
|
|
11
|
-
${children.map((text, index) => {
|
|
12
|
-
const props = [`href="/page${index + 1}"`];
|
|
13
|
-
if (index === children.length - 1) {
|
|
14
|
-
props.push('active');
|
|
15
|
-
}
|
|
16
|
-
return `<Link ${props.map(prop => `${prop} `).join('')}>${text}</Link>`;
|
|
17
|
-
}).join('\n ')}
|
|
18
|
-
</Breadcrumbs>`
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { breadcrumbs_figma as default };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const size = instance.getString('Size');
|
|
5
|
-
const type = instance.getString('Type');
|
|
6
|
-
const state = instance.getString('State');
|
|
7
|
-
const variant = instance.getString('Variant');
|
|
8
|
-
const imports = ["import Button from '@jetbrains/ring-ui/components/button/button'"];
|
|
9
|
-
const props = [];
|
|
10
|
-
const DEFAULT_SIZE = 'M';
|
|
11
|
-
const isDefaultSize = size === DEFAULT_SIZE;
|
|
12
|
-
if (!isDefaultSize) {
|
|
13
|
-
imports.push("import {ControlsHeight} from '@jetbrains/ring-ui/components/global/controls-height'");
|
|
14
|
-
props.push(`height={ControlsHeight.${size}}`);
|
|
15
|
-
}
|
|
16
|
-
switch (variant) {
|
|
17
|
-
case 'Red outlined':
|
|
18
|
-
props.push('danger');
|
|
19
|
-
break;
|
|
20
|
-
case 'Main':
|
|
21
|
-
props.push('primary');
|
|
22
|
-
break;
|
|
23
|
-
case 'Green':
|
|
24
|
-
props.push('success');
|
|
25
|
-
break;
|
|
26
|
-
case 'Red solid':
|
|
27
|
-
props.push('error');
|
|
28
|
-
break;
|
|
29
|
-
case 'Gray':
|
|
30
|
-
props.push('secondary');
|
|
31
|
-
break;
|
|
32
|
-
case 'Ghost':
|
|
33
|
-
props.push('ghost');
|
|
34
|
-
break;
|
|
35
|
-
case 'Text':
|
|
36
|
-
props.push('inline');
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
const children = instance.findLayers(() => true)[0].findText('Button').textContent;
|
|
40
|
-
const use12pxIcon = size === 'S' && variant !== 'Text';
|
|
41
|
-
let useButtonGroup = false;
|
|
42
|
-
switch (type) {
|
|
43
|
-
case 'R-Icon-Label':
|
|
44
|
-
props.push('dropdown');
|
|
45
|
-
break;
|
|
46
|
-
case 'L-Icon-Label':
|
|
47
|
-
imports.push(`import downloadIcon from '@jetbrains/icons/download${use12pxIcon ? '-12px' : ''}'`);
|
|
48
|
-
props.push('icon={downloadIcon}');
|
|
49
|
-
break;
|
|
50
|
-
case 'Icon':
|
|
51
|
-
imports.push(`import addIcon from '@jetbrains/icons/add${use12pxIcon ? '-12px' : ''}'`);
|
|
52
|
-
props.push('icon={addIcon}');
|
|
53
|
-
break;
|
|
54
|
-
case 'Split':
|
|
55
|
-
imports.push("import ButtonGroup from '@jetbrains/ring-ui/components/button-group/button-group'");
|
|
56
|
-
imports.push(`import chevronDownIcon from '@jetbrains/icons/chevron-down${use12pxIcon ? '-12px' : ''}'`);
|
|
57
|
-
useButtonGroup = true;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
switch (state) {
|
|
61
|
-
case 'Disabled':
|
|
62
|
-
props.push('disabled');
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
const joinedProps = props.map(prop => `${prop} `).join('');
|
|
66
|
-
// prettier-ignore
|
|
67
|
-
const button = children ? `<Button ${joinedProps}>
|
|
68
|
-
${children}
|
|
69
|
-
</Button>` : `<Button ${joinedProps}/>`;
|
|
70
|
-
var button_figma = {
|
|
71
|
-
id: 'button',
|
|
72
|
-
example: figma.code`${imports.join('\n')}
|
|
73
|
-
|
|
74
|
-
${
|
|
75
|
-
// prettier-ignore
|
|
76
|
-
useButtonGroup ? `<ButtonGroup>
|
|
77
|
-
${button}
|
|
78
|
-
<Button ${joinedProps} icon={chevronDownIcon} />
|
|
79
|
-
</ButtonGroup>` : button}`
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export { button_figma as default };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const labelType = instance.getString('Label');
|
|
5
|
-
const children = instance.findConnectedInstances(() => true);
|
|
6
|
-
const label = instance.findText('Group description').textContent;
|
|
7
|
-
const isFormLabel = labelType === 'form';
|
|
8
|
-
const imports = [`import ControlLabel${isFormLabel ? ', {LabelType}' : ''} from '@jetbrains/ring-ui/components/control-label/control-label'`];
|
|
9
|
-
const labelProps = [];
|
|
10
|
-
if (isFormLabel) {
|
|
11
|
-
labelProps.push('type={LabelType.FORM}');
|
|
12
|
-
}
|
|
13
|
-
const renderedChildren = children.map(child => {
|
|
14
|
-
const {
|
|
15
|
-
example
|
|
16
|
-
} = child.executeTemplate();
|
|
17
|
-
const [childImports, code] = example[0].code.split('\n\n');
|
|
18
|
-
return {
|
|
19
|
-
imports: childImports,
|
|
20
|
-
code
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
var checkboxGroup_figma = {
|
|
24
|
-
id: 'checkbox-group',
|
|
25
|
-
example: figma.code`${imports.join('\n')}
|
|
26
|
-
${renderedChildren[0].imports}
|
|
27
|
-
|
|
28
|
-
<ControlLabel ${labelProps.map(prop => `${prop} `).join('')}>${label}</ControlLabel>
|
|
29
|
-
${renderedChildren.map(({
|
|
30
|
-
code
|
|
31
|
-
}) => code).join('\n<br />\n')}`
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { checkboxGroup_figma as default };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const selected = instance.getString('Selected');
|
|
5
|
-
const hasLabel = instance.getBoolean('Label');
|
|
6
|
-
const label = instance.findText('Label').textContent;
|
|
7
|
-
const hasHelpText = instance.getBoolean('Help Text');
|
|
8
|
-
const helpText = instance.findText('Description').textContent;
|
|
9
|
-
const state = instance.getString('State');
|
|
10
|
-
const imports = ["import Checkbox from '@jetbrains/ring-ui/components/checkbox/checkbox'"];
|
|
11
|
-
const props = [];
|
|
12
|
-
switch (selected) {
|
|
13
|
-
case 'selected':
|
|
14
|
-
props.push('defaultChecked');
|
|
15
|
-
break;
|
|
16
|
-
case 'intermediate':
|
|
17
|
-
props.push('indeterminate', 'defaultChecked');
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
if (hasLabel) {
|
|
21
|
-
props.push(`label="${label}"`);
|
|
22
|
-
}
|
|
23
|
-
if (hasHelpText) {
|
|
24
|
-
props.push(`help="${helpText}"`);
|
|
25
|
-
}
|
|
26
|
-
if (state === 'Disabled') {
|
|
27
|
-
props.push('disabled');
|
|
28
|
-
}
|
|
29
|
-
var checkbox_figma = {
|
|
30
|
-
id: 'checkbox',
|
|
31
|
-
example: figma.code`${imports.join('\n')}
|
|
32
|
-
|
|
33
|
-
<Checkbox ${props.map(prop => `${prop} `).join('')}/>`
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { checkbox_figma as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import figma from '@figma/code-connect';
|
|
2
|
-
|
|
3
|
-
const instance = figma.selectedInstance;
|
|
4
|
-
const error = instance.findLayers(() => true)[0].textContent;
|
|
5
|
-
const imports = ["import ErrorBubble from '@jetbrains/ring-ui/components/error-bubble/error-bubble'"];
|
|
6
|
-
const props = [`error={\`${error}\``];
|
|
7
|
-
var errorBubble_figma = {
|
|
8
|
-
id: 'error-bubble',
|
|
9
|
-
example: figma.code`${imports.join('\n')}
|
|
10
|
-
|
|
11
|
-
<ErrorBubble ${props.map(prop => `${prop} `).join('')}/>`
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { errorBubble_figma as default };
|