@jetbrains/ring-ui 5.0.47 → 5.0.49
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/button-ng/button-ng.examples.js +1 -2
- package/components/global/theme.js +3 -1
- package/dist/_helpers/theme.js +5 -1
- package/package.json +2 -2
- package/components/theme-ng/theme-ng.js +0 -40
- package/components/theme-ng/theme-ng.test.js +0 -36
- package/dist/theme-ng/theme-ng.js +0 -36
|
@@ -6,7 +6,6 @@ import pencilIcon from '@jetbrains/icons/pencil';
|
|
|
6
6
|
import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
|
|
7
7
|
|
|
8
8
|
import IconNG from '../icon-ng/icon-ng';
|
|
9
|
-
import ThemeNG from '../theme-ng/theme-ng';
|
|
10
9
|
import CheckboxNG from '../checkbox-ng/checkbox-ng';
|
|
11
10
|
import Theme from '../global/theme';
|
|
12
11
|
import styles from '../global/variables_dark.css';
|
|
@@ -21,7 +20,7 @@ export default {
|
|
|
21
20
|
|
|
22
21
|
export const basic = () => {
|
|
23
22
|
angular.
|
|
24
|
-
module(APP_NAME, [IconNG,
|
|
23
|
+
module(APP_NAME, [IconNG, CheckboxNG, ButtonNG]).
|
|
25
24
|
controller('testCtrl', function controller($scope) {
|
|
26
25
|
$scope.pencil = pencilIcon;
|
|
27
26
|
$scope.Theme = Theme;
|
|
@@ -26,9 +26,11 @@ export function applyTheme(theme, container) {
|
|
|
26
26
|
if (theme === Theme.DARK) {
|
|
27
27
|
container.classList.remove(defaultStyles.light);
|
|
28
28
|
container.classList.add(styles.dark);
|
|
29
|
+
container.classList.add('ring-ui-theme-dark');
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
container.classList.remove(styles.dark);
|
|
33
|
+
container.classList.remove('ring-ui-theme-dark');
|
|
32
34
|
container.classList.add(defaultStyles.light);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -45,7 +47,7 @@ export const ThemeProvider = forwardRef(function ThemeProvider({ theme = Theme.A
|
|
|
45
47
|
? (<PopupTarget id={id}>
|
|
46
48
|
{target => (<>
|
|
47
49
|
{children}
|
|
48
|
-
{createPortal(target
|
|
50
|
+
{createPortal(<div className={themeClasses}>{target}</div>, parentTarget && getPopupContainer(parentTarget) || document.body)}
|
|
49
51
|
</>)}
|
|
50
52
|
</PopupTarget>)
|
|
51
53
|
: children}
|
package/dist/_helpers/theme.js
CHANGED
|
@@ -30,8 +30,10 @@ function applyTheme(theme, container) {
|
|
|
30
30
|
if (theme === Theme.DARK) {
|
|
31
31
|
container.classList.remove(modules_6381a4b3.light);
|
|
32
32
|
container.classList.add(modules_59717246.dark);
|
|
33
|
+
container.classList.add('ring-ui-theme-dark');
|
|
33
34
|
} else {
|
|
34
35
|
container.classList.remove(modules_59717246.dark);
|
|
36
|
+
container.classList.remove('ring-ui-theme-dark');
|
|
35
37
|
container.classList.add(modules_6381a4b3.light);
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -56,7 +58,9 @@ const ThemeProvider = /*#__PURE__*/forwardRef(function ThemeProvider(_ref, ref)
|
|
|
56
58
|
className: classNames(className, themeClasses)
|
|
57
59
|
}, restProps), passToPopups ? /*#__PURE__*/React.createElement(PopupTarget, {
|
|
58
60
|
id: id
|
|
59
|
-
}, target => /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/createPortal(
|
|
61
|
+
}, target => /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: themeClasses
|
|
63
|
+
}, target), parentTarget && getPopupContainer(parentTarget) || document.body))) : children);
|
|
60
64
|
});
|
|
61
65
|
var Theme$1 = Theme;
|
|
62
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.49",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -259,5 +259,5 @@
|
|
|
259
259
|
"node": ">=14.0",
|
|
260
260
|
"npm": ">=6.0.0"
|
|
261
261
|
},
|
|
262
|
-
"gitHead": "
|
|
262
|
+
"gitHead": "393f795d7a6fcfadcbf4dbc6d64131c3ff35cf33"
|
|
263
263
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import angular from 'angular';
|
|
2
|
-
|
|
3
|
-
import RingAngularComponent from '../global/ring-angular-component';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const angularModule = angular.module('Ring.theme', []);
|
|
7
|
-
|
|
8
|
-
class RingThemeComponent extends RingAngularComponent {
|
|
9
|
-
static $inject = ['$scope', '$element'];
|
|
10
|
-
|
|
11
|
-
static bindings = {
|
|
12
|
-
theme: '<'
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
constructor(...args) {
|
|
16
|
-
super(...args);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
on = this.$inject.$scope.$on.bind(this.$inject.$scope);
|
|
20
|
-
|
|
21
|
-
$onInit() {
|
|
22
|
-
const {$element} = this.$inject;
|
|
23
|
-
$element[0].setAttribute('data-test', 'ring-theme');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
$onChanges(changes) {
|
|
27
|
-
if (changes.theme && changes.theme.currentValue) {
|
|
28
|
-
const {$scope} = this.$inject;
|
|
29
|
-
$scope.$emit('change', {
|
|
30
|
-
prevTheme: typeof changes.theme.previousValue === 'string' && changes.theme.previousValue,
|
|
31
|
-
currentTheme: changes.theme.currentValue
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
angularModule.component('rgTheme', RingThemeComponent);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export default angularModule.name;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*global inject*/
|
|
2
|
-
import 'angular';
|
|
3
|
-
import 'angular-mocks';
|
|
4
|
-
|
|
5
|
-
import Theme from './theme-ng';
|
|
6
|
-
|
|
7
|
-
describe('Theme', () => {
|
|
8
|
-
beforeEach(window.module(Theme));
|
|
9
|
-
|
|
10
|
-
let $scope;
|
|
11
|
-
let $compile;
|
|
12
|
-
let element;
|
|
13
|
-
let ctrl;
|
|
14
|
-
|
|
15
|
-
beforeEach(inject(($rootScope, _$compile_, $componentController) => {
|
|
16
|
-
$scope = $rootScope.$new();
|
|
17
|
-
$compile = _$compile_;
|
|
18
|
-
|
|
19
|
-
ctrl = $componentController('rgTheme', {
|
|
20
|
-
$element: {0: {}}
|
|
21
|
-
});
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
it('should render a component', () => {
|
|
25
|
-
$scope.theme = 'foo';
|
|
26
|
-
element = $compile('<rg-theme theme="theme"></rg-theme>')($scope)[0];
|
|
27
|
-
$scope.$digest();
|
|
28
|
-
|
|
29
|
-
element.getAttribute('data-test').should.be.equal('ring-theme');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should have a method to subscribe on change a theme', () => {
|
|
33
|
-
ctrl.on.should.exist;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import angular from 'angular';
|
|
3
|
-
import RingAngularComponent from '../global/ring-angular-component.js';
|
|
4
|
-
|
|
5
|
-
const angularModule = angular.module('Ring.theme', []);
|
|
6
|
-
class RingThemeComponent extends RingAngularComponent {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
_defineProperty(this, "on", this.$inject.$scope.$on.bind(this.$inject.$scope));
|
|
10
|
-
}
|
|
11
|
-
$onInit() {
|
|
12
|
-
const {
|
|
13
|
-
$element
|
|
14
|
-
} = this.$inject;
|
|
15
|
-
$element[0].setAttribute('data-test', 'ring-theme');
|
|
16
|
-
}
|
|
17
|
-
$onChanges(changes) {
|
|
18
|
-
if (changes.theme && changes.theme.currentValue) {
|
|
19
|
-
const {
|
|
20
|
-
$scope
|
|
21
|
-
} = this.$inject;
|
|
22
|
-
$scope.$emit('change', {
|
|
23
|
-
prevTheme: typeof changes.theme.previousValue === 'string' && changes.theme.previousValue,
|
|
24
|
-
currentTheme: changes.theme.currentValue
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
_defineProperty(RingThemeComponent, "$inject", ['$scope', '$element']);
|
|
30
|
-
_defineProperty(RingThemeComponent, "bindings", {
|
|
31
|
-
theme: '<'
|
|
32
|
-
});
|
|
33
|
-
angularModule.component('rgTheme', RingThemeComponent);
|
|
34
|
-
var themeNg = angularModule.name;
|
|
35
|
-
|
|
36
|
-
export { themeNg as default };
|