@24i/bigscreen-sdk 1.0.4-alpha.2097 → 1.0.4-alpha.2106
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/package.json +5 -5
- package/packages/developer-tools/src/EnvironmentSelection/EnvironmentList.tsx +7 -12
- package/packages/developer-tools/src/EnvironmentSelection/EnvironmentListItem.tsx +27 -14
- package/packages/developer-tools/src/EnvironmentSelection/sizes.1080.ts +3 -7
- package/packages/developer-tools/src/EnvironmentSelection/sizes.ts +3 -7
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.scss +24 -4
- package/packages/developer-tools/src/EnvironmentSelection/styles/_sizes.1080.scss +1 -1
- package/packages/developer-tools/src/EnvironmentSelection/styles/_sizes.scss +2 -2
- package/packages/driver-base/src/loadObject.ts +1 -1
- package/packages/focus/src/Layout/Base.tsx +0 -1
- package/packages/focus/src/Layout/Horizontal.ts +3 -13
- package/packages/focus/src/Layout/Matrix.tsx +24 -3
- package/packages/focus/src/Layout/__test__/isRtl.spec.ts +23 -0
- package/packages/focus/src/Layout/isRtl.ts +12 -0
- package/packages/focus/src/Layout/types.ts +1 -0
- package/packages/input/src/handleOverflow.ts +6 -3
- package/packages/jsx/src/forwardRef.ts +2 -2
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.tsx +7 -0
- package/packages/keyboard/src/DefaultKeyboard/Keyboard.tsx +1 -0
- package/packages/keyboard/src/KeyboardBase.tsx +1 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.tsx +11 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +9 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/NumericKeyboard.tsx +3 -0
- package/packages/mouse-navigation/src/ArrowNavigation/index.tsx +1 -1
- package/packages/types-bigscreen-jsx/index.d.ts +1 -1
- package/packages/utils/src/textUtils.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.4-alpha.
|
|
3
|
+
"version": "1.0.4-alpha.2106",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/jest": "^28.1.6",
|
|
58
58
|
"@types/minimist": "^1.2.2",
|
|
59
59
|
"@types/node": "^18.6.3",
|
|
60
|
-
"@types/react": "^18.0.
|
|
60
|
+
"@types/react": "^18.0.18",
|
|
61
61
|
"babel-jest": "^28.1.2",
|
|
62
62
|
"chalk": "^4.1.2",
|
|
63
63
|
"coveralls": "^3.1.0",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"jest-environment-jsdom": "^28.1.2",
|
|
72
72
|
"minimist": "^1.2.6",
|
|
73
73
|
"patch-package": "^6.2.1",
|
|
74
|
-
"sass": "^1.54.
|
|
74
|
+
"sass": "^1.54.8",
|
|
75
75
|
"sass-true": "^6.1.0",
|
|
76
|
-
"ts-jest": "^28.0.
|
|
76
|
+
"ts-jest": "^28.0.8",
|
|
77
77
|
"ts-node": "^10.8.2",
|
|
78
78
|
"tsconfig-paths-jest": "0.0.1",
|
|
79
|
-
"typescript": "^4.
|
|
79
|
+
"typescript": "^4.8.2"
|
|
80
80
|
},
|
|
81
81
|
"exports": {
|
|
82
82
|
"./adobe-heartbeat": "./packages/adobe-heartbeat/src/index.ts",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Component, createRef, Reference } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { stopEvent } from '@24i/bigscreen-sdk/utils';
|
|
3
3
|
import { BasicList } from '@24i/bigscreen-sdk/list/Basic';
|
|
4
|
-
import { device } from '@24i/bigscreen-sdk/device';
|
|
5
4
|
import { BACK } from '@24i/bigscreen-sdk/device/keymap';
|
|
6
5
|
import { reloadApp } from '../utils/reload';
|
|
7
6
|
import { EnvironmentListItem } from './EnvironmentListItem';
|
|
@@ -25,14 +24,12 @@ export class EnvironmentList extends Component<Props> {
|
|
|
25
24
|
getPaddingTop() {
|
|
26
25
|
const { data } = this.props;
|
|
27
26
|
const {
|
|
28
|
-
|
|
27
|
+
paddingCountThreshold, height, scrollStep, defaultPaddingTop,
|
|
29
28
|
} = sizes;
|
|
30
|
-
if (data.length
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
return defaultPaddingTop;
|
|
29
|
+
if (data.length > paddingCountThreshold) return defaultPaddingTop;
|
|
30
|
+
return Math.round(
|
|
31
|
+
(height - scrollStep * data.length) / 2,
|
|
32
|
+
);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
onKeyDown = (event: KeyboardEvent) => {
|
|
@@ -40,8 +37,6 @@ export class EnvironmentList extends Component<Props> {
|
|
|
40
37
|
stopEvent(event);
|
|
41
38
|
const { onClose } = this.props;
|
|
42
39
|
onClose();
|
|
43
|
-
} else if (device.isDirectionalArrow(event)) {
|
|
44
|
-
stopEvent(event); // No leaking out. Might result in something focusing below the modal
|
|
45
40
|
}
|
|
46
41
|
};
|
|
47
42
|
|
|
@@ -57,7 +52,7 @@ export class EnvironmentList extends Component<Props> {
|
|
|
57
52
|
|
|
58
53
|
render() {
|
|
59
54
|
const { data, leadingEllipses } = this.props;
|
|
60
|
-
const { visibleItems,
|
|
55
|
+
const { visibleItems, scrollStep } = sizes;
|
|
61
56
|
return (
|
|
62
57
|
<div
|
|
63
58
|
ref={this.div}
|
|
@@ -86,7 +81,7 @@ export class EnvironmentList extends Component<Props> {
|
|
|
86
81
|
);
|
|
87
82
|
}}
|
|
88
83
|
visibleItems={visibleItems}
|
|
89
|
-
firstScrollStep={
|
|
84
|
+
firstScrollStep={scrollStep}
|
|
90
85
|
scrollStep={scrollStep}
|
|
91
86
|
/>
|
|
92
87
|
</div>
|
|
@@ -3,8 +3,12 @@ import { getDisplayToggler } from '@24i/bigscreen-sdk/utils/displayToggler';
|
|
|
3
3
|
import { Item } from '@24i/bigscreen-sdk/list/interface';
|
|
4
4
|
import { Interactable } from '@24i/bigscreen-sdk/interactable';
|
|
5
5
|
import { trimWithLeadingEllipsis } from '@24i/bigscreen-sdk/utils/textUtils';
|
|
6
|
+
import { addClass } from '@24i/bigscreen-sdk/utils/addClass';
|
|
7
|
+
import { removeClass } from '@24i/bigscreen-sdk/utils/removeClass';
|
|
6
8
|
import { ItemData } from './types';
|
|
7
9
|
|
|
10
|
+
const ACTIVE_CLASS = 'active';
|
|
11
|
+
|
|
8
12
|
type Props = {
|
|
9
13
|
onPress: (environment: string) => void,
|
|
10
14
|
leadingEllipses?: boolean;
|
|
@@ -13,7 +17,7 @@ type Props = {
|
|
|
13
17
|
export class EnvironmentListItem extends Component<Props> implements Item<ItemData> {
|
|
14
18
|
itemRef = createRef<HTMLDivElement>();
|
|
15
19
|
|
|
16
|
-
labelRef = createRef<
|
|
20
|
+
labelRef = createRef<HTMLDivElement>();
|
|
17
21
|
|
|
18
22
|
value: string;
|
|
19
23
|
|
|
@@ -53,11 +57,16 @@ export class EnvironmentListItem extends Component<Props> implements Item<ItemDa
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
updateData({ label, value }: ItemData) {
|
|
60
|
+
updateData({ label, value, active }: ItemData) {
|
|
57
61
|
if (value !== this.value) {
|
|
58
62
|
this.value = value;
|
|
59
63
|
setText(this.labelRef, label);
|
|
60
64
|
this.trimRows();
|
|
65
|
+
if (active) {
|
|
66
|
+
addClass(this.itemRef, ACTIVE_CLASS);
|
|
67
|
+
} else {
|
|
68
|
+
removeClass(this.itemRef, ACTIVE_CLASS);
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
|
|
@@ -66,27 +75,31 @@ export class EnvironmentListItem extends Component<Props> implements Item<ItemDa
|
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
render() {
|
|
69
|
-
const { active, label, leadingEllipses
|
|
78
|
+
const { active, label, leadingEllipses } = this.props;
|
|
79
|
+
const itemEllipsesClass = `${
|
|
80
|
+
leadingEllipses ? 'leading-ellipses-list-item' : 'normal-ellipses-list-item'
|
|
81
|
+
}`;
|
|
82
|
+
const activeClass = `${active ? ACTIVE_CLASS : ''}`;
|
|
70
83
|
return (
|
|
71
84
|
<Interactable
|
|
72
85
|
ref={this.itemRef}
|
|
73
|
-
className={`environment-list-item
|
|
86
|
+
className={`environment-list-item ${itemEllipsesClass} ${activeClass}`}
|
|
74
87
|
onPress={this.onPress}
|
|
75
88
|
>
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
className=
|
|
89
|
+
{active && (
|
|
90
|
+
<div
|
|
91
|
+
className={
|
|
92
|
+
`checkmark ${leadingEllipses ? 'leading-ellipses-checkmark' : ''}`
|
|
93
|
+
}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
<div
|
|
97
|
+
className="label"
|
|
85
98
|
ref={this.labelRef}
|
|
86
99
|
dir="auto"
|
|
87
100
|
>
|
|
88
101
|
{label}
|
|
89
|
-
</
|
|
102
|
+
</div>
|
|
90
103
|
</Interactable>
|
|
91
104
|
);
|
|
92
105
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export const height = 1080;
|
|
2
|
-
export const defaultPaddingTop =
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
export const listItemMargin = 16;
|
|
6
|
-
|
|
7
|
-
export const visibleItems = 11;
|
|
8
|
-
export const firstScrollStep = 112;
|
|
2
|
+
export const defaultPaddingTop = 92;
|
|
3
|
+
export const paddingCountThreshold = 8;
|
|
4
|
+
export const visibleItems = 10;
|
|
9
5
|
export const scrollStep = 112;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export const height = 720;
|
|
2
|
-
export const defaultPaddingTop =
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
export const listItemMargin = 11;
|
|
6
|
-
|
|
7
|
-
export const visibleItems = 11;
|
|
8
|
-
export const firstScrollStep = 75;
|
|
2
|
+
export const defaultPaddingTop = 61;
|
|
3
|
+
export const paddingCountThreshold = 8;
|
|
4
|
+
export const visibleItems = 10;
|
|
9
5
|
export const scrollStep = 75;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import '@24i/bigscreen-sdk/sass-utils/ellipsis';
|
|
2
|
+
|
|
1
3
|
@mixin mask-svg-icon($icon-url) {
|
|
2
4
|
-webkit-mask-image: url($icon-url);
|
|
3
5
|
-webkit-mask-size: $checkmark-size;
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
padding-right: $environment-config-name-padding-right;
|
|
42
44
|
line-height: $environment-config-name-height;
|
|
43
45
|
height: $environment-config-name-height;
|
|
46
|
+
white-space: nowrap;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -83,6 +86,7 @@
|
|
|
83
86
|
background-color: #fff;
|
|
84
87
|
height: $checkmark-size;
|
|
85
88
|
width: $checkmark-size;
|
|
89
|
+
visibility: hidden;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
.leading-ellipses-checkmark {
|
|
@@ -95,10 +99,6 @@
|
|
|
95
99
|
font-size: $label-font-size;
|
|
96
100
|
font-weight: 400;
|
|
97
101
|
color: #8f8f8f;
|
|
98
|
-
|
|
99
|
-
&.active {
|
|
100
|
-
color: #fff;
|
|
101
|
-
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
&:focus {
|
|
@@ -108,10 +108,30 @@
|
|
|
108
108
|
color: #fff;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
&.active {
|
|
113
|
+
.checkmark {
|
|
114
|
+
visibility: visible;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.label {
|
|
118
|
+
color: #fff;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&.display-none {
|
|
123
|
+
visibility: hidden;
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
|
|
113
127
|
.leading-ellipses-list-item {
|
|
114
128
|
height: auto;
|
|
115
129
|
}
|
|
130
|
+
|
|
131
|
+
.normal-ellipses-list-item {
|
|
132
|
+
.label {
|
|
133
|
+
@include ellipsis;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
116
136
|
}
|
|
117
137
|
}
|
|
@@ -14,7 +14,7 @@ $environment-list-width: 479px;
|
|
|
14
14
|
|
|
15
15
|
$environment-list-item-border-radius: 40px;
|
|
16
16
|
$environment-list-item-padding: 16px 34px;
|
|
17
|
-
$environment-list-item-margin: 16px 71px;
|
|
17
|
+
$environment-list-item-margin: 16px 0 16px 71px;
|
|
18
18
|
$environment-list-item-line-height: 48px;
|
|
19
19
|
$environment-list-item-height: 80px;
|
|
20
20
|
|
|
@@ -14,9 +14,9 @@ $environment-list-width: 319px;
|
|
|
14
14
|
|
|
15
15
|
$environment-list-item-border-radius: 27px;
|
|
16
16
|
$environment-list-item-padding: 11px 23px;
|
|
17
|
-
$environment-list-item-margin: 11px 47px;
|
|
17
|
+
$environment-list-item-margin: 11px 0 11px 47px;
|
|
18
18
|
$environment-list-item-line-height: 32px;
|
|
19
|
-
$environment-list-item-height:
|
|
19
|
+
$environment-list-item-height: 54px;
|
|
20
20
|
|
|
21
21
|
$checkmark-top: 13px;
|
|
22
22
|
$checkmark-left: -48px;
|
|
@@ -19,7 +19,7 @@ export const loadObject = <T extends HTMLObjectElement>(
|
|
|
19
19
|
object.type = type;
|
|
20
20
|
forEach(Object.entries(attributes), ([name, value]) => {
|
|
21
21
|
if (name === 'style') {
|
|
22
|
-
object.style.cssText = value;
|
|
22
|
+
object.style.cssText = value as string;
|
|
23
23
|
} else {
|
|
24
24
|
// @ts-ignore - skipping readonly check
|
|
25
25
|
object[name] = value;
|
|
@@ -9,7 +9,6 @@ export type Props = SharedProps & {
|
|
|
9
9
|
focusableChildren: Array<Reference>,
|
|
10
10
|
onFocusChanged?: (focused: Reference, index: number) => any,
|
|
11
11
|
onBeforeFocusChange?: (focused: Reference, index: number) => any,
|
|
12
|
-
dir?: 'auto' | 'ltr' | 'rtl',
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export interface ILayout {
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { LEFT, RIGHT } from '@24i/bigscreen-sdk/device/keymap';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const isHorizontalRtl = (dir: Props['dir']) => {
|
|
6
|
-
switch (dir) {
|
|
7
|
-
case 'rtl': return true;
|
|
8
|
-
case 'ltr': return false;
|
|
9
|
-
case 'auto':
|
|
10
|
-
default:
|
|
11
|
-
return isRtl();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
2
|
+
import { getLayoutBase, ILayout } from './Base';
|
|
3
|
+
import { isRtl } from './isRtl';
|
|
14
4
|
|
|
15
5
|
const onKeyDown = (e: KeyboardEvent, layout: ILayout) => {
|
|
16
|
-
if (!
|
|
6
|
+
if (!isRtl(layout.props.dir)) {
|
|
17
7
|
if (LEFT.is(e)) layout.backward(e);
|
|
18
8
|
if (RIGHT.is(e)) layout.forward(e);
|
|
19
9
|
} else {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Component, Reference, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { device } from '@24i/bigscreen-sdk/device';
|
|
3
|
+
import { LEFT, RIGHT } from '@24i/bigscreen-sdk/device/keymap';
|
|
3
4
|
import { noop } from '@24i/bigscreen-sdk/utils/noop';
|
|
4
5
|
import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
|
|
5
6
|
import { IFocusable } from '../IFocusable';
|
|
7
|
+
import { isRtl } from './isRtl';
|
|
6
8
|
import { Errors, hasValidDomRef } from './constants';
|
|
7
9
|
import { SharedProps } from './types';
|
|
8
10
|
|
|
@@ -34,7 +36,8 @@ export class Matrix extends Component<Props> implements IFocusable {
|
|
|
34
36
|
onFocusChanged: noop,
|
|
35
37
|
onBeforeFocusChange: noop,
|
|
36
38
|
circular: CircularDirection.NONE,
|
|
37
|
-
|
|
39
|
+
dir: 'auto',
|
|
40
|
+
} as const;
|
|
38
41
|
|
|
39
42
|
declare props: DeclareProps<Props, typeof Matrix.defaultProps>;
|
|
40
43
|
|
|
@@ -56,9 +59,9 @@ export class Matrix extends Component<Props> implements IFocusable {
|
|
|
56
59
|
|
|
57
60
|
onKeyDown = (e: KeyboardEvent) => {
|
|
58
61
|
let newIndex: Index2D | null = null;
|
|
59
|
-
if (
|
|
62
|
+
if (this.isDirectionLeft(e)) {
|
|
60
63
|
newIndex = this.moveHorizontaly('left');
|
|
61
|
-
} else if (
|
|
64
|
+
} else if (this.isDirectionRight(e)) {
|
|
62
65
|
newIndex = this.moveHorizontaly('right');
|
|
63
66
|
} else if (device.isDirectionUp(e)) {
|
|
64
67
|
newIndex = this.moveVerticaly('up');
|
|
@@ -109,6 +112,24 @@ export class Matrix extends Component<Props> implements IFocusable {
|
|
|
109
112
|
return false;
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
isDirectionLeft(event: KeyboardEvent) {
|
|
116
|
+
const { dir } = this.props;
|
|
117
|
+
const rtl = isRtl(dir);
|
|
118
|
+
return (
|
|
119
|
+
(!rtl && LEFT.is(event))
|
|
120
|
+
|| (rtl && RIGHT.is(event))
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
isDirectionRight(event: KeyboardEvent) {
|
|
125
|
+
const { dir } = this.props;
|
|
126
|
+
const rtl = isRtl(dir);
|
|
127
|
+
return (
|
|
128
|
+
(!rtl && RIGHT.is(event))
|
|
129
|
+
|| (rtl && LEFT.is(event))
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
112
133
|
moveForwards = (isCircular: boolean) => (x: number, length: number) => {
|
|
113
134
|
if (x === length - 1) {
|
|
114
135
|
return isCircular ? 0 : length - 1;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as i18n from '@24i/bigscreen-sdk/i18n';
|
|
2
|
+
import { isRtl } from '../isRtl';
|
|
3
|
+
import { SharedProps } from '../types';
|
|
4
|
+
|
|
5
|
+
describe('isRtl', () => {
|
|
6
|
+
const mockIsRtl = jest.spyOn(i18n, 'isRtl');
|
|
7
|
+
|
|
8
|
+
it.each([
|
|
9
|
+
{ focusDir: 'ltr', langDir: 'ltr', expectedIsRtl: false },
|
|
10
|
+
{ focusDir: 'rtl', langDir: 'ltr', expectedIsRtl: true },
|
|
11
|
+
{ focusDir: 'auto', langDir: 'ltr', expectedIsRtl: false },
|
|
12
|
+
{ focusDir: undefined, langDir: 'ltr', expectedIsRtl: false },
|
|
13
|
+
{ focusDir: 'ltr', langDir: 'rtl', expectedIsRtl: false },
|
|
14
|
+
{ focusDir: 'rtl', langDir: 'rtl', expectedIsRtl: true },
|
|
15
|
+
{ focusDir: 'auto', langDir: 'rtl', expectedIsRtl: true },
|
|
16
|
+
{ focusDir: undefined, langDir: 'rtl', expectedIsRtl: true },
|
|
17
|
+
])('should for $focusDir focus and $langDir language return $expectedIsRtl', ({
|
|
18
|
+
focusDir, langDir, expectedIsRtl,
|
|
19
|
+
}) => {
|
|
20
|
+
mockIsRtl.mockReturnValue(langDir === 'rtl');
|
|
21
|
+
expect(isRtl(focusDir as SharedProps['dir'])).toBe(expectedIsRtl);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isRtl as isLangRtl } from '@24i/bigscreen-sdk/i18n';
|
|
2
|
+
import { SharedProps } from './types';
|
|
3
|
+
|
|
4
|
+
export const isRtl = (dir: SharedProps['dir']) => {
|
|
5
|
+
switch (dir) {
|
|
6
|
+
case 'rtl': return true;
|
|
7
|
+
case 'ltr': return false;
|
|
8
|
+
case 'auto':
|
|
9
|
+
default:
|
|
10
|
+
return isLangRtl();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isRtl } from '@24i/bigscreen-sdk/i18n';
|
|
2
|
+
|
|
1
3
|
export const handleOverflow = (
|
|
2
4
|
wrap: HTMLDivElement | null,
|
|
3
5
|
caretElement: HTMLDivElement | null,
|
|
@@ -7,10 +9,11 @@ export const handleOverflow = (
|
|
|
7
9
|
const wrapWidth = wrap.getBoundingClientRect().width;
|
|
8
10
|
const caretWidth = caretElement.getBoundingClientRect().width;
|
|
9
11
|
const preCaretWidth = textPreCaret.getBoundingClientRect().width + caretWidth;
|
|
12
|
+
const margin = isRtl() ? 'marginRight' : 'marginLeft';
|
|
10
13
|
if (preCaretWidth >= wrapWidth) {
|
|
11
14
|
const offset = wrapWidth - preCaretWidth;
|
|
12
|
-
textPreCaret.style
|
|
13
|
-
} else if (textPreCaret.style
|
|
14
|
-
textPreCaret.style
|
|
15
|
+
textPreCaret.style[margin] = `${offset}px`;
|
|
16
|
+
} else if (textPreCaret.style[margin] !== '0px') {
|
|
17
|
+
textPreCaret.style[margin] = '0px';
|
|
15
18
|
}
|
|
16
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ForwardedRefComponent, FunctionComponentWithRef } from './types';
|
|
1
|
+
import { ForwardedRefComponent, FunctionComponentWithRef, Props } from './types';
|
|
2
2
|
|
|
3
|
-
export const forwardRef = <T>(
|
|
3
|
+
export const forwardRef = <T extends Props>(
|
|
4
4
|
reffedComponent: FunctionComponentWithRef<T>,
|
|
5
5
|
): ForwardedRefComponent<T> => {
|
|
6
6
|
(reffedComponent as ForwardedRefComponent<T>).isForwardedRef = true;
|
|
@@ -71,6 +71,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
71
71
|
ref={this.matrix}
|
|
72
72
|
domRef={this.keyboardWrapper}
|
|
73
73
|
matrix={this.focusMatrices.normal}
|
|
74
|
+
dir="ltr"
|
|
74
75
|
>
|
|
75
76
|
<div className={`${KEYBOARD_ROW} row-numbers`}>
|
|
76
77
|
{map(NORMAL[0], this.generateKey)}
|
|
@@ -96,6 +97,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
96
97
|
ref={this.keyRefs.special}
|
|
97
98
|
className="key key-special"
|
|
98
99
|
onPress={this.onSpecial}
|
|
100
|
+
dir="auto"
|
|
99
101
|
>
|
|
100
102
|
{texts.toSpecialLayout}
|
|
101
103
|
</Interactable>
|
|
@@ -103,6 +105,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
103
105
|
ref={this.keyRefs.shift}
|
|
104
106
|
className="key key-shift"
|
|
105
107
|
onPress={() => this.onShift()}
|
|
108
|
+
dir="auto"
|
|
106
109
|
>
|
|
107
110
|
{texts.shift}
|
|
108
111
|
</Interactable>
|
|
@@ -131,6 +134,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
131
134
|
ref={this.keyRefs.done}
|
|
132
135
|
className="key key-done"
|
|
133
136
|
onPress={() => this.onDone()}
|
|
137
|
+
dir="auto"
|
|
134
138
|
>
|
|
135
139
|
{texts.done}
|
|
136
140
|
</Interactable>
|
|
@@ -158,6 +162,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
158
162
|
ref={this.matrix}
|
|
159
163
|
domRef={this.keyboardWrapper}
|
|
160
164
|
matrix={this.focusMatrices.special}
|
|
165
|
+
dir="ltr"
|
|
161
166
|
>
|
|
162
167
|
<div className={`${KEYBOARD_ROW} row-numbers`}>
|
|
163
168
|
{map(SPECIAL[0], this.generateKey)}
|
|
@@ -186,6 +191,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
186
191
|
ref={this.keyRefs.special}
|
|
187
192
|
className="key key-special"
|
|
188
193
|
onPress={this.onQWERTY}
|
|
194
|
+
dir="auto"
|
|
189
195
|
>
|
|
190
196
|
{texts.toNormalLayout}
|
|
191
197
|
</Interactable>
|
|
@@ -215,6 +221,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
215
221
|
ref={this.keyRefs.done}
|
|
216
222
|
className="key key-done"
|
|
217
223
|
onPress={() => this.onDone()}
|
|
224
|
+
dir="auto"
|
|
218
225
|
>
|
|
219
226
|
{texts.done}
|
|
220
227
|
</Interactable>
|
|
@@ -80,12 +80,14 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
80
80
|
ref={this.matrix}
|
|
81
81
|
domRef={this.keyboardWrapper}
|
|
82
82
|
matrix={this.focusMatrices.normal}
|
|
83
|
+
dir="ltr"
|
|
83
84
|
>
|
|
84
85
|
<div className={`${KEYBOARD_ROW} row-numbers`}>
|
|
85
86
|
<Interactable
|
|
86
87
|
ref={this.keyRefs.special}
|
|
87
88
|
className="key key-special"
|
|
88
89
|
onPress={this.onSpecial}
|
|
90
|
+
dir="auto"
|
|
89
91
|
>
|
|
90
92
|
{texts.toSpecialLayout}
|
|
91
93
|
</Interactable>
|
|
@@ -101,6 +103,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
101
103
|
ref={this.keyRefs.clear}
|
|
102
104
|
className="key key-clear"
|
|
103
105
|
onPress={() => this.onClear()}
|
|
106
|
+
dir="auto"
|
|
104
107
|
>
|
|
105
108
|
{texts.clear}
|
|
106
109
|
</Interactable>
|
|
@@ -115,6 +118,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
115
118
|
ref={this.keyRefs.done}
|
|
116
119
|
className="key key-done"
|
|
117
120
|
onPress={() => this.onDone()}
|
|
121
|
+
dir="auto"
|
|
118
122
|
>
|
|
119
123
|
{texts.done}
|
|
120
124
|
</Interactable>
|
|
@@ -142,6 +146,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
142
146
|
ref={this.keyRefs.shift}
|
|
143
147
|
className="key key-shift"
|
|
144
148
|
onPress={() => this.onShift()}
|
|
149
|
+
dir="auto"
|
|
145
150
|
>
|
|
146
151
|
{texts.shift}
|
|
147
152
|
</Interactable>
|
|
@@ -156,6 +161,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
156
161
|
ref={this.keyRefs.cancel}
|
|
157
162
|
className="key key-cancel"
|
|
158
163
|
onPress={() => this.onCancel()}
|
|
164
|
+
dir="auto"
|
|
159
165
|
>
|
|
160
166
|
{texts.cancel}
|
|
161
167
|
</Interactable>
|
|
@@ -183,12 +189,14 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
183
189
|
ref={this.matrix}
|
|
184
190
|
domRef={this.keyboardWrapper}
|
|
185
191
|
matrix={this.focusMatrices.special}
|
|
192
|
+
dir="ltr"
|
|
186
193
|
>
|
|
187
194
|
<div className={`${KEYBOARD_ROW} row-numbers`}>
|
|
188
195
|
<Interactable
|
|
189
196
|
ref={this.keyRefs.special}
|
|
190
197
|
className="key key-special"
|
|
191
198
|
onPress={this.onQWERTY}
|
|
199
|
+
dir="auto"
|
|
192
200
|
>
|
|
193
201
|
{texts.toNormalLayout}
|
|
194
202
|
</Interactable>
|
|
@@ -204,6 +212,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
204
212
|
ref={this.keyRefs.clear}
|
|
205
213
|
className="key key-clear"
|
|
206
214
|
onPress={() => this.onClear()}
|
|
215
|
+
dir="auto"
|
|
207
216
|
>
|
|
208
217
|
{texts.clear}
|
|
209
218
|
</Interactable>
|
|
@@ -218,6 +227,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
218
227
|
ref={this.keyRefs.done}
|
|
219
228
|
className="key key-done"
|
|
220
229
|
onPress={() => this.onDone()}
|
|
230
|
+
dir="auto"
|
|
221
231
|
>
|
|
222
232
|
{texts.done}
|
|
223
233
|
</Interactable>
|
|
@@ -254,6 +264,7 @@ export class Keyboard extends QwertyKeyboardBase {
|
|
|
254
264
|
ref={this.keyRefs.cancel}
|
|
255
265
|
className="key key-cancel"
|
|
256
266
|
onPress={() => this.onCancel()}
|
|
267
|
+
dir="auto"
|
|
257
268
|
>
|
|
258
269
|
{texts.cancel}
|
|
259
270
|
</Interactable>
|
|
@@ -113,6 +113,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
113
113
|
domRef={this.keyboardWrapper}
|
|
114
114
|
matrix={this.focusMatrices.normal}
|
|
115
115
|
circular={circular}
|
|
116
|
+
dir="ltr"
|
|
116
117
|
>
|
|
117
118
|
{this.renderKeyboard([
|
|
118
119
|
<>
|
|
@@ -148,6 +149,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
148
149
|
onPress={() => {
|
|
149
150
|
this.onKey(' ');
|
|
150
151
|
}}
|
|
152
|
+
dir="auto"
|
|
151
153
|
>
|
|
152
154
|
<div className="key-background">
|
|
153
155
|
{texts.space}
|
|
@@ -161,6 +163,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
161
163
|
this.keyRefs.domain.current!.firstChild!.textContent!,
|
|
162
164
|
);
|
|
163
165
|
}}
|
|
166
|
+
dir="auto"
|
|
164
167
|
>
|
|
165
168
|
<div className="key-background">
|
|
166
169
|
{texts.domain}
|
|
@@ -183,6 +186,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
183
186
|
domRef={this.keyboardWrapper}
|
|
184
187
|
matrix={this.focusMatrices.special}
|
|
185
188
|
circular={circular}
|
|
189
|
+
dir="ltr"
|
|
186
190
|
>
|
|
187
191
|
{this.renderKeyboard([
|
|
188
192
|
<>
|
|
@@ -213,6 +217,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
213
217
|
onPress={() => {
|
|
214
218
|
this.onKey(' ');
|
|
215
219
|
}}
|
|
220
|
+
dir="auto"
|
|
216
221
|
>
|
|
217
222
|
<div className="key-background">
|
|
218
223
|
{texts.space}
|
|
@@ -254,6 +259,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
254
259
|
`key key-wide key-abc ${isNormalLayout ? 'active' : ''}`
|
|
255
260
|
}
|
|
256
261
|
onPress={this.onAbc}
|
|
262
|
+
dir="auto"
|
|
257
263
|
>
|
|
258
264
|
<div className="key-background">
|
|
259
265
|
{texts.toNormalLayout}
|
|
@@ -269,6 +275,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
269
275
|
}`
|
|
270
276
|
}
|
|
271
277
|
onPress={this.onSpecial}
|
|
278
|
+
dir="auto"
|
|
272
279
|
>
|
|
273
280
|
<div className="key-background">
|
|
274
281
|
{texts.toSpecialLayout}
|
|
@@ -305,6 +312,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
305
312
|
ref={this.keyRefs.clear}
|
|
306
313
|
className="key key-wide key-clear"
|
|
307
314
|
onPress={() => this.onClear()}
|
|
315
|
+
dir="auto"
|
|
308
316
|
>
|
|
309
317
|
<div className="key-background">
|
|
310
318
|
{texts.clear}
|
|
@@ -343,6 +351,7 @@ export class Keyboard extends KeyboardBase<Layouts, Props> {
|
|
|
343
351
|
ref={this.keyRefs.continue}
|
|
344
352
|
className="key key-wide key-continue"
|
|
345
353
|
onPress={() => this.onDone()}
|
|
354
|
+
dir="auto"
|
|
346
355
|
>
|
|
347
356
|
<div className="key-background">
|
|
348
357
|
{texts.continue}
|
|
@@ -76,6 +76,7 @@ export class NumericKeyboard extends KeyboardBase<Layouts, Props> {
|
|
|
76
76
|
domRef={this.keyboardWrapper}
|
|
77
77
|
matrix={this.focusMatrices.normal}
|
|
78
78
|
circular={circular}
|
|
79
|
+
dir="ltr"
|
|
79
80
|
>
|
|
80
81
|
<div className="numeric-keyboard-wrapper">
|
|
81
82
|
<div className="keys-container key-layout">
|
|
@@ -117,6 +118,7 @@ export class NumericKeyboard extends KeyboardBase<Layouts, Props> {
|
|
|
117
118
|
ref={this.keyRefs.clear}
|
|
118
119
|
className="key key-wide key-clear"
|
|
119
120
|
onPress={() => this.onClear()}
|
|
121
|
+
dir="auto"
|
|
120
122
|
>
|
|
121
123
|
{texts.clear}
|
|
122
124
|
</Interactable>
|
|
@@ -134,6 +136,7 @@ export class NumericKeyboard extends KeyboardBase<Layouts, Props> {
|
|
|
134
136
|
ref={this.keyRefs.continue}
|
|
135
137
|
className="key key-wide key-continue"
|
|
136
138
|
onPress={() => this.onDone()}
|
|
139
|
+
dir="auto"
|
|
137
140
|
>
|
|
138
141
|
<div className="key-background">
|
|
139
142
|
{texts.continue}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ArrowNavigation } from './ArrowNavigation';
|
|
1
|
+
export { ArrowNavigation, ArrowType } from './ArrowNavigation';
|
|
@@ -98,7 +98,7 @@ declare namespace React {
|
|
|
98
98
|
* - React stateless functional components that forward a `ref` will give you the `ElementRef` of the forwarded
|
|
99
99
|
* to component.
|
|
100
100
|
*
|
|
101
|
-
* `C` must be the type _of_ a React component so you need to use typeof as in React.ElementRef<typeof MyComponent
|
|
101
|
+
* `C` must be the type _of_ a React component so you need to use typeof as in `React.ElementRef<typeof MyComponent>`.
|
|
102
102
|
*
|
|
103
103
|
* @todo In Flow, this works a little different with forwarded refs and the `AbstractComponent` that
|
|
104
104
|
* `React.forwardRef()` returns.
|
|
@@ -6,7 +6,7 @@ export const trimWithLeadingEllipsis = (row: HTMLSpanElement) => {
|
|
|
6
6
|
const lineHeightString = window.getComputedStyle(row, null).getPropertyValue('line-height');
|
|
7
7
|
const lineHeight = parseInt(lineHeightString, 10);
|
|
8
8
|
let numberOfLines = row.offsetHeight / lineHeight;
|
|
9
|
-
if (numberOfLines
|
|
9
|
+
if (numberOfLines >= 2) {
|
|
10
10
|
const originalTextContent = row.textContent;
|
|
11
11
|
row.textContent = ELLIPSIS;
|
|
12
12
|
let stringBuffer = '';
|
|
@@ -17,9 +17,9 @@ export const trimWithLeadingEllipsis = (row: HTMLSpanElement) => {
|
|
|
17
17
|
row.textContent = `${ELLIPSIS}${stringBuffer}`;
|
|
18
18
|
currentPosition -= 1;
|
|
19
19
|
numberOfLines = Math.floor(row.offsetHeight / lineHeight);
|
|
20
|
-
} while (numberOfLines
|
|
20
|
+
} while (numberOfLines < 2 && currentPosition >= 0);
|
|
21
21
|
row.textContent = `${ELLIPSIS}${stringBuffer.substring(1)}`;
|
|
22
22
|
}
|
|
23
|
-
row.style.visibility = '
|
|
23
|
+
row.style.visibility = '';
|
|
24
24
|
}
|
|
25
25
|
};
|