@jetbrains/ring-ui 7.0.123 → 7.0.124

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.
@@ -1,6 +1,6 @@
1
1
  @import '../global/variables.css';
2
2
 
3
- @value button, active as buttonActive, flat from '../button/button.css';
3
+ @value button as buttonClass, active as buttonActive, flat from '../button/button.css';
4
4
 
5
5
  :root,
6
6
  :host {
@@ -37,7 +37,7 @@
37
37
  --ring-button-group-button-border-color: var(--ring-border-disabled-color);
38
38
  }
39
39
 
40
- .buttonGroup .button {
40
+ .buttonGroup .buttonClass {
41
41
  position: relative;
42
42
 
43
43
  transition: none;
@@ -47,7 +47,7 @@
47
47
  0 -1px var(--ring-button-group-button-border-color) inset;
48
48
  }
49
49
 
50
- .buttonGroup .button[disabled] {
50
+ .buttonGroup .buttonClass[disabled] {
51
51
  /* stylelint-disable selector-max-specificity */
52
52
  &::before,
53
53
  &::after {
@@ -75,8 +75,8 @@
75
75
  /* stylelint-enable */
76
76
  }
77
77
 
78
- .buttonGroup > .button:first-child,
79
- .buttonGroup > :first-child .button {
78
+ .buttonGroup > .buttonClass:first-child,
79
+ .buttonGroup > :first-child .buttonClass {
80
80
  box-shadow:
81
81
  0 1px var(--ring-button-group-button-border-color) inset,
82
82
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -88,8 +88,8 @@
88
88
  }
89
89
  }
90
90
 
91
- .buttonGroup > .button:last-child,
92
- .buttonGroup > :last-child .button {
91
+ .buttonGroup > .buttonClass:last-child,
92
+ .buttonGroup > :last-child .buttonClass {
93
93
  box-shadow:
94
94
  0 1px var(--ring-button-group-button-border-color) inset,
95
95
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -101,8 +101,8 @@
101
101
  }
102
102
  }
103
103
 
104
- .buttonGroup > .button:only-child,
105
- .buttonGroup > :only-child .button {
104
+ .buttonGroup > .buttonClass:only-child,
105
+ .buttonGroup > :only-child .buttonClass {
106
106
  box-shadow:
107
107
  0 1px var(--ring-button-group-button-border-color) inset,
108
108
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -116,15 +116,15 @@
116
116
  }
117
117
 
118
118
  /* stylelint-disable selector-max-specificity */
119
- .buttonGroup .button.button:hover:not(:disabled),
120
- .buttonGroup .button.button:active:not(:disabled) {
119
+ .buttonGroup .buttonClass.buttonClass:hover:not(:disabled),
120
+ .buttonGroup .buttonClass.buttonClass:active:not(:disabled) {
121
121
  --ring-button-border-radius-left: var(--ring-border-radius);
122
122
  --ring-button-border-radius-right: var(--ring-border-radius);
123
123
 
124
124
  box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
125
125
  }
126
126
 
127
- .buttonGroup .button.button:focus-visible {
127
+ .buttonGroup .buttonClass.buttonClass:focus-visible {
128
128
  --ring-button-border-radius-left: var(--ring-border-radius);
129
129
  --ring-button-border-radius-right: var(--ring-border-radius);
130
130
 
@@ -133,14 +133,14 @@
133
133
  0 0 0 1px var(--ring-border-hover-color);
134
134
  }
135
135
 
136
- .buttonGroup .button.button.buttonActive {
136
+ .buttonGroup .buttonClass.buttonClass.buttonActive {
137
137
  --ring-button-border-radius-left: var(--ring-border-radius);
138
138
  --ring-button-border-radius-right: var(--ring-border-radius);
139
139
 
140
140
  box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
141
141
  }
142
142
 
143
- .buttonGroup .button:focus-visible.buttonActive {
143
+ .buttonGroup .buttonClass:focus-visible.buttonActive {
144
144
  --ring-button-border-radius-left: var(--ring-border-radius);
145
145
  --ring-button-border-radius-right: var(--ring-border-radius);
146
146
 
@@ -149,7 +149,7 @@
149
149
  0 0 0 1px var(--ring-border-hover-color);
150
150
  }
151
151
 
152
- .buttonGroup .button.buttonActive[disabled] {
152
+ .buttonGroup .buttonClass.buttonActive[disabled] {
153
153
  box-shadow: var(--ring-button-shadow) var(--ring-border-hover-color);
154
154
  }
155
155
  /* stylelint-enable */
@@ -159,17 +159,17 @@
159
159
  composes: buttonGroup from '../button-toolbar/button-toolbar.css';
160
160
  }
161
161
 
162
- .common button {
162
+ .common button:not(:where(.buttonClass)) {
163
163
  border-radius: 0;
164
164
  }
165
165
 
166
- .common .button {
166
+ .common .buttonClass {
167
167
  --ring-button-border-radius-left: 0;
168
168
  --ring-button-border-radius-right: 0;
169
169
  }
170
170
 
171
171
  .split button,
172
- .split .button {
172
+ .split .buttonClass {
173
173
  margin: 0 0 0 -1px;
174
174
  }
175
175
 
@@ -192,8 +192,8 @@
192
192
  border-bottom-left-radius: var(--ring-border-radius);
193
193
  }
194
194
 
195
- .common > .button:first-child,
196
- .common > :first-child .button {
195
+ .common > .buttonClass:first-child,
196
+ .common > :first-child .buttonClass {
197
197
  --ring-button-border-radius-left: var(--ring-border-radius);
198
198
 
199
199
  margin: 0;
@@ -204,8 +204,8 @@
204
204
  border-bottom-right-radius: var(--ring-border-radius);
205
205
  }
206
206
 
207
- .common > .button:last-child,
208
- .common > :last-child .button {
207
+ .common > .buttonClass:last-child,
208
+ .common > :last-child .buttonClass {
209
209
  --ring-button-border-radius-right: var(--ring-border-radius);
210
210
  }
211
211
 
@@ -218,7 +218,7 @@
218
218
  }
219
219
 
220
220
  .common {
221
- & .button {
221
+ & .buttonClass {
222
222
  position: relative;
223
223
  z-index: var(--ring-button-group-default-z-index);
224
224
 
@@ -1,6 +1,6 @@
1
1
  @import '../global/variables.css';
2
2
 
3
- @value button from '../button/button.css';
3
+ @value button as buttonClass from '../button/button.css';
4
4
 
5
5
  .buttonToolbar {
6
6
  display: inline-block;
@@ -13,7 +13,7 @@
13
13
 
14
14
  .buttonToolbar > button,
15
15
  .buttonToolbar > :global(.ring-button-group),
16
- .buttonToolbar > .button,
16
+ .buttonToolbar > .buttonClass,
17
17
  .buttonToolbar > .buttonGroup,
18
18
  .buttonToolbar > .split,
19
19
  .buttonToolbar > .buttonToolbar {
@@ -1,5 +1,6 @@
1
1
  import { Component } from 'react';
2
2
  import { renderToStaticMarkup } from 'react-dom/server';
3
+ import { getTrustedHTML } from '../global/configuration';
3
4
  /**
4
5
  * @name ContentEditable
5
6
  */
@@ -23,7 +24,7 @@ class ContentEditableBase extends Component {
23
24
  return (<div {...props} ref={inputRef}
24
25
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
25
26
  // @ts-ignore
26
- disabled={disabled} role='textbox' tabIndex={disabled ? undefined : tabIndex} contentEditable={!this.props.disabled} dangerouslySetInnerHTML={{ __html }}/>);
27
+ disabled={disabled} role='textbox' tabIndex={disabled ? undefined : tabIndex} contentEditable={!this.props.disabled} dangerouslySetInnerHTML={{ __html: getTrustedHTML(__html) }}/>);
27
28
  }
28
29
  }
29
30
  const ContentEditable = ({ children, ...props }) => (<ContentEditableBase {...props} __html={renderToStaticMarkup(children)}/>);
@@ -3,9 +3,14 @@ export declare enum ControlsHeight {
3
3
  M = "M",
4
4
  L = "L"
5
5
  }
6
+ export interface RingUITrustedTypePolicy {
7
+ createHTML(html: string): TrustedHTML;
8
+ }
6
9
  export interface RingUIConfiguration {
7
10
  controlsHeight?: ControlsHeight;
8
11
  popupsCssPositioning?: boolean;
12
+ trustedTypePolicy?: RingUITrustedTypePolicy | null;
9
13
  }
10
14
  export declare function configure(config: RingUIConfiguration): void;
11
15
  export declare function getConfiguration(): Required<RingUIConfiguration>;
16
+ export declare function getTrustedHTML(html: string): string | TrustedHTML;
@@ -7,6 +7,7 @@ export var ControlsHeight;
7
7
  const globalConfiguration = {
8
8
  controlsHeight: ControlsHeight.M,
9
9
  popupsCssPositioning: true,
10
+ trustedTypePolicy: null,
10
11
  };
11
12
  export function configure(config) {
12
13
  if (config.controlsHeight !== undefined) {
@@ -15,7 +16,13 @@ export function configure(config) {
15
16
  if (config.popupsCssPositioning !== undefined) {
16
17
  globalConfiguration.popupsCssPositioning = config.popupsCssPositioning;
17
18
  }
19
+ if (config.trustedTypePolicy !== undefined) {
20
+ globalConfiguration.trustedTypePolicy = config.trustedTypePolicy;
21
+ }
18
22
  }
19
23
  export function getConfiguration() {
20
24
  return { ...globalConfiguration };
21
25
  }
26
+ export function getTrustedHTML(html) {
27
+ return globalConfiguration.trustedTypePolicy?.createHTML(html) ?? html;
28
+ }
@@ -1,6 +1,7 @@
1
1
  // Inspired by https://github.com/sairion/svg-inline-react
2
2
  import { memo } from 'react';
3
3
  import classNames from 'classnames';
4
+ import { getTrustedHTML } from '../global/configuration';
4
5
  import memoize from '../global/memoize';
5
6
  import styles from './icon.css';
6
7
  function convertReactSVGDOMProperty(str) {
@@ -27,7 +28,7 @@ function extractSVGProps(svgNode) {
27
28
  }
28
29
  const getSVGFromSource = memoize((src) => {
29
30
  const svgContainer = document.createElement('div');
30
- svgContainer.innerHTML = src;
31
+ svgContainer.innerHTML = getTrustedHTML(src);
31
32
  const svg = svgContainer.firstElementChild;
32
33
  if (svg.remove) {
33
34
  svg.remove();
@@ -51,7 +52,7 @@ function IconSVG({ src, className, ...rest }) {
51
52
  }, className);
52
53
  const { props, html } = getSVGFromSource(src);
53
54
  return (<svg {...props} {...rest} className={glyphClasses} dangerouslySetInnerHTML={{
54
- __html: html,
55
+ __html: getTrustedHTML(html),
55
56
  }}/>);
56
57
  }
57
58
  export default memo(IconSVG);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.123",
3
+ "version": "7.0.124",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -59,7 +59,7 @@
59
59
  "prelint-ci": "echo \"##teamcity[importData type='jslint' path='eslint-report.xml']\"",
60
60
  "lint-ci": "eslint --format jslint-xml . > eslint-report.xml && npm run stylelint-ci",
61
61
  "lint:js": "eslint",
62
- "postbuild": "cpy './**/*.d.ts' ../dist --parents --cwd=components/",
62
+ "postbuild": "cpy './**/*.d.ts' ../dist --parents --cwd=components/ && node scripts/check-built-css.mjs",
63
63
  "_postinstall": "husky && npm run postinstall:gitconfig",
64
64
  "postinstall:gitconfig": "git config blame.ignoreRevsFile .git-blame-ignore-revs",
65
65
  "postpublish": "pinst --enable",
@@ -82,7 +82,7 @@
82
82
  "storybook-debug": "node --inspect-brk node_modules/@storybook/react/bin -p 9999",
83
83
  "stylelint": "stylelint --ignore-path .stylelintignore '**/*.css'",
84
84
  "stylelint-ci": "stylelint --ignore-path .stylelintignore --custom-formatter 'scripts/jslint-xml.js' '**/*.css' | xmlappend eslint-report.xml",
85
- "test": "vitest src",
85
+ "test": "vitest src && npm test --workspace @jetbrains/rollup-css-plugin",
86
86
  "type-check": "(npm run type-check:create-d-ts && npm run type-check:main && npm run type-check:build) ; npm run type-check:cleanup-d-ts",
87
87
  "type-check:create-d-ts": "npx tcm src && npx tcm .storybook",
88
88
  "type-check:main": "tsc --noEmit -p tsconfig.json",
@@ -106,26 +106,26 @@
106
106
  "@eslint/compat": "^2.1.0",
107
107
  "@eslint/eslintrc": "^3.3.6",
108
108
  "@eslint/js": "^10.0.1",
109
- "@figma/code-connect": "^1.4.9",
109
+ "@figma/code-connect": "^1.5.2",
110
110
  "@jetbrains/eslint-config": "^6.0.5",
111
111
  "@jetbrains/logos": "3.0.0-canary.734b213.0",
112
112
  "@jetbrains/rollup-css-plugin": "./packages/rollup-css-plugin",
113
113
  "@jetbrains/stylelint-config": "^4.0.2",
114
114
  "@jetbrains/typescript-plugin-css-modules": "^5.3.1",
115
- "@primer/octicons": "^19.31.0",
115
+ "@primer/octicons": "^19.33.0",
116
116
  "@rollup/plugin-babel": "^7.1.0",
117
117
  "@rollup/plugin-json": "^6.1.0",
118
118
  "@rollup/plugin-node-resolve": "^16.0.3",
119
119
  "@rollup/plugin-replace": "^6.0.3",
120
- "@storybook/addon-a11y": "10.5.4",
121
- "@storybook/addon-docs": "^10.5.4",
122
- "@storybook/addon-themes": "^10.5.4",
120
+ "@storybook/addon-a11y": "10.5.7",
121
+ "@storybook/addon-docs": "^10.5.7",
122
+ "@storybook/addon-themes": "^10.5.7",
123
123
  "@storybook/csf": "^0.1.13",
124
- "@storybook/react-webpack5": "10.5.4",
124
+ "@storybook/react-webpack5": "10.5.7",
125
125
  "@storybook/test-runner": "^0.24.4",
126
126
  "@testing-library/dom": "^10.4.1",
127
127
  "@testing-library/react": "^16.3.2",
128
- "@testing-library/user-event": "^14.6.1",
128
+ "@testing-library/user-event": "^14.6.3",
129
129
  "@types/chai-as-promised": "^8.0.2",
130
130
  "@types/chai-dom": "1.11.3",
131
131
  "@types/markdown-it": "^14.1.2",
@@ -134,13 +134,13 @@
134
134
  "@types/webpack-env": "^1.18.8",
135
135
  "@vitejs/plugin-react": "^6.0.4",
136
136
  "@vitest/eslint-plugin": "^1.6.24",
137
- "acorn": "^8.17.0",
137
+ "acorn": "^8.18.0",
138
138
  "babel-plugin-require-context-hook": "^1.0.0",
139
139
  "caniuse-lite": "^1.0.30001799",
140
140
  "chai-as-promised": "^8.0.2",
141
141
  "chai-dom": "^1.12.1",
142
142
  "cheerio": "^1.2.0",
143
- "core-js": "^3.49.0",
143
+ "core-js": "^3.50.0",
144
144
  "cpy-cli": "^7.0.0",
145
145
  "dotenv-cli": "^11.0.0",
146
146
  "eslint": "^9.39.5",
@@ -154,11 +154,11 @@
154
154
  "eslint-plugin-prettier": "^5.5.6",
155
155
  "eslint-plugin-react": "^7.37.5",
156
156
  "eslint-plugin-react-hooks": "^7.1.1",
157
- "eslint-plugin-storybook": "^10.5.4",
157
+ "eslint-plugin-storybook": "^10.5.7",
158
158
  "eslint-plugin-unicorn": "^72.0.0",
159
159
  "events": "^3.3.0",
160
160
  "glob": "^13.0.6",
161
- "globals": "^17.7.0",
161
+ "globals": "^17.9.0",
162
162
  "html-webpack-plugin": "^5.6.8",
163
163
  "http-server": "^14.1.1",
164
164
  "husky": "^9.1.7",
@@ -167,7 +167,7 @@
167
167
  "jest-environment-jsdom": "^30.4.1",
168
168
  "jest-teamcity": "^1.12.0",
169
169
  "lint-staged": "^17.2.0",
170
- "markdown-it": "^14.3.0",
170
+ "markdown-it": "^15.0.0",
171
171
  "merge-options": "^3.0.4",
172
172
  "pinst": "^3.0.0",
173
173
  "prettier": "^3.9.6",
@@ -176,10 +176,10 @@
176
176
  "react-dom": "^19.2.8",
177
177
  "regenerator-runtime": "^0.14.1",
178
178
  "rimraf": "^6.1.3",
179
- "rollup": "^4.62.2",
179
+ "rollup": "^4.62.4",
180
180
  "rollup-plugin-clear": "^2.0.7",
181
181
  "storage-mock": "^2.1.0",
182
- "storybook": "10.5.4",
182
+ "storybook": "10.5.7",
183
183
  "stylelint": "^17.14.1",
184
184
  "stylelint-config-sass-guidelines": "^13.0.0",
185
185
  "svg-inline-loader": "^0.8.2",
@@ -188,11 +188,11 @@
188
188
  "typed-css-modules": "^0.9.1",
189
189
  "typescript": "~6.0.3",
190
190
  "typescript-eslint": "^8.65.0",
191
- "vite": "^8.1.5",
191
+ "vite": "^8.2.1",
192
192
  "vitest": "^4.1.10",
193
193
  "vitest-teamcity-reporter": "^0.6.1",
194
- "webpack": "^5.109.0",
195
- "webpack-cli": "^7.2.1",
194
+ "webpack": "^5.109.2",
195
+ "webpack-cli": "^7.2.2",
196
196
  "xmlappend": "^1.0.4"
197
197
  },
198
198
  "peerDependencies": {
@@ -227,7 +227,7 @@
227
227
  "babel-loader": "10.1.1",
228
228
  "babel-plugin-react-compiler": "^1.0.0",
229
229
  "babel-plugin-transform-define": "^2.1.4",
230
- "browserslist": "^4.28.7",
230
+ "browserslist": "^4.28.8",
231
231
  "change-case": "^5.4.4",
232
232
  "classnames": "^2.5.1",
233
233
  "combokeys": "^3.0.1",
@@ -242,7 +242,7 @@
242
242
  "highlight.js": "^10.7.2",
243
243
  "just-debounce-it": "^3.2.0",
244
244
  "memoize-one": "^6.0.0",
245
- "postcss": "^8.5.23",
245
+ "postcss": "^8.5.26",
246
246
  "postcss-calc": "^10.1.1",
247
247
  "postcss-font-family-system-ui": "^5.0.0",
248
248
  "postcss-loader": "^8.2.1",