@nestio/pam 2.0.7 → 2.0.8
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.
|
@@ -13,7 +13,17 @@ const basicOptions = [
|
|
|
13
13
|
{ value: 3, label: 'Three', optionSet: 'First' },
|
|
14
14
|
{ value: 4, label: 'Four', disabled: true, optionSet: 'Second' },
|
|
15
15
|
{ value: 5, label: 'Five', optionSet: 'Second' },
|
|
16
|
-
{ value: 6, label: 'Six', optionSet: 'Second' }
|
|
16
|
+
{ value: 6, label: 'Six', optionSet: 'Second' },
|
|
17
|
+
{ value: 7, label: 'Seven', optionSet: 'Second' },
|
|
18
|
+
{ value: 8, label: 'Eight', optionSet: 'Second' },
|
|
19
|
+
{ value: 9, label: 'Nine', optionSet: 'Second' },
|
|
20
|
+
{ value: 10, label: 'Ten', optionSet: 'Second' },
|
|
21
|
+
{ value: 11, label: 'Eleven', optionSet: 'Second' },
|
|
22
|
+
{ value: 12, label: 'Twelve', optionSet: 'Second' },
|
|
23
|
+
{ value: 13, label: 'Thirteen', optionSet: 'Second' },
|
|
24
|
+
{ value: 14, label: 'Fourteen', optionSet: 'Second' },
|
|
25
|
+
{ value: 15, label: 'Fifteen', optionSet: 'Second' },
|
|
26
|
+
{ value: 16, label: 'Sixteen', optionSet: 'Second' },
|
|
17
27
|
];
|
|
18
28
|
|
|
19
29
|
const customOptions = [
|
|
@@ -112,7 +122,7 @@ export default function SelectPage () {
|
|
|
112
122
|
<ExamplePanel title="Basic Select">
|
|
113
123
|
<SingleSelect
|
|
114
124
|
options={basicOptions}
|
|
115
|
-
value={
|
|
125
|
+
value={13}
|
|
116
126
|
ariaLabel="Basic select label"
|
|
117
127
|
/>
|
|
118
128
|
</ExamplePanel>
|
|
@@ -181,6 +181,13 @@ var OptionListSet = function (_Component) {
|
|
|
181
181
|
renderedOptions
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
+
}, {
|
|
185
|
+
key: 'componentDidMount',
|
|
186
|
+
value: function componentDidMount() {
|
|
187
|
+
if (this.props.reference && this.props.reference.current && this.props.reference.current.querySelector('[aria-selected=true]')) {
|
|
188
|
+
this.props.reference.current.querySelector('[aria-selected=true]').scrollIntoView({ block: 'nearest' });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
184
191
|
}, {
|
|
185
192
|
key: 'render',
|
|
186
193
|
value: function render() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestio/pam",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Nestio UI modules",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"homepage": "https://github.com/Nestio/pam#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"classnames": "^2.2.5",
|
|
34
|
-
"lodash": "^4.
|
|
35
|
-
"moment": "^2.
|
|
34
|
+
"lodash": "^4.17.21",
|
|
35
|
+
"moment": "^2.29.4",
|
|
36
36
|
"prop-types": "^15.5.10",
|
|
37
37
|
"react-datepicker": "1.1.0",
|
|
38
38
|
"react-input-autosize": "2.2.1",
|
|
@@ -45,8 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"babel-cli": "^6.11.4",
|
|
48
|
-
"react": "^16.2.0",
|
|
49
|
-
"react-dom": "^16.2.0",
|
|
50
48
|
"babel-core": "^6.10.4",
|
|
51
49
|
"babel-eslint": "^6.1.0",
|
|
52
50
|
"babel-loader": "^6.2.4",
|
|
@@ -61,10 +59,12 @@
|
|
|
61
59
|
"eslint-plugin-react": "^5.2.2",
|
|
62
60
|
"file-loader": "^0.11.2",
|
|
63
61
|
"identity-obj-proxy": "^3.0.0",
|
|
64
|
-
"jest": "20.0.4",
|
|
65
|
-
"node-sass": "4.
|
|
62
|
+
"jest": "^20.0.4",
|
|
63
|
+
"node-sass": "^4.14.1",
|
|
66
64
|
"null-loader": "^0.1.1",
|
|
67
65
|
"raf": "^3.4.0",
|
|
66
|
+
"react": "^16.2.0",
|
|
67
|
+
"react-dom": "^16.2.0",
|
|
68
68
|
"react-router-dom": "^4.1.2",
|
|
69
69
|
"sass-loader": "^7.0.1",
|
|
70
70
|
"sinon": "^1.17.4",
|
|
@@ -114,6 +114,12 @@ export default class OptionListSet extends Component {
|
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
componentDidMount() {
|
|
118
|
+
if (this.props.reference && this.props.reference.current && this.props.reference.current.querySelector('[aria-selected=true]')) {
|
|
119
|
+
this.props.reference.current.querySelector('[aria-selected=true]').scrollIntoView({ block: 'nearest' });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
render(){
|
|
118
124
|
if (this.props.isBelowMinLength) {
|
|
119
125
|
return this.renderMinLengthComponent();
|
|
@@ -29,6 +29,8 @@ beforeEach(function(){
|
|
|
29
29
|
getCollapsibleState: () => null,
|
|
30
30
|
toggleCollapsedValue: jest.fn()
|
|
31
31
|
};
|
|
32
|
+
|
|
33
|
+
Element.prototype.scrollIntoView = jest.fn();
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
describe('single option set', function(){
|
|
@@ -150,6 +152,7 @@ describe('keyboard functions', function() {
|
|
|
150
152
|
});
|
|
151
153
|
|
|
152
154
|
describe('move scrollbar position', function() {
|
|
155
|
+
const mockScrollIntoView = jest.fn();
|
|
153
156
|
|
|
154
157
|
const mockReference = {
|
|
155
158
|
current: {
|
|
@@ -159,12 +162,13 @@ describe('move scrollbar position', function() {
|
|
|
159
162
|
return {
|
|
160
163
|
nextSibling: {
|
|
161
164
|
offsetTop: 100,
|
|
162
|
-
offsetHeight: 50
|
|
165
|
+
offsetHeight: 50,
|
|
163
166
|
},
|
|
164
167
|
previousSibling: {
|
|
165
168
|
offsetTop: 0,
|
|
166
|
-
offsetHeight: 50
|
|
167
|
-
}
|
|
169
|
+
offsetHeight: 50,
|
|
170
|
+
},
|
|
171
|
+
scrollIntoView: mockScrollIntoView,
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
174
|
}
|
|
@@ -191,6 +195,15 @@ describe('move scrollbar position', function() {
|
|
|
191
195
|
expect(mockReference.current.scrollTop).toEqual(0);
|
|
192
196
|
});
|
|
193
197
|
|
|
198
|
+
it('should focus the active element on mount', function () {
|
|
199
|
+
jest.resetAllMocks();
|
|
200
|
+
|
|
201
|
+
defaultProps.reference = mockReference;
|
|
202
|
+
shallow(<OptionListSet {...defaultProps} />);
|
|
203
|
+
|
|
204
|
+
expect(mockScrollIntoView).toHaveBeenCalledTimes(1);
|
|
205
|
+
expect(mockScrollIntoView).toHaveBeenCalledWith({ block: 'nearest' });
|
|
206
|
+
});
|
|
194
207
|
});
|
|
195
208
|
|
|
196
209
|
|