@hero-design/rn 8.88.0 → 8.89.0-alpha.1
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/es/index.js +413 -44
- package/lib/index.js +414 -44
- package/package.json +3 -2
- package/src/components/Calendar/CalendarRange.tsx +337 -0
- package/src/components/Calendar/CalendarRangeConnector.tsx +68 -0
- package/src/components/Calendar/CalendarRowItem.tsx +14 -3
- package/src/components/Calendar/StyledCalendar.tsx +23 -9
- package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +284 -0
- package/src/components/Calendar/__tests__/CalendarRangeConnector.spec.tsx +73 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRangeConnector.spec.tsx.snap +632 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +45 -20
- package/src/components/Calendar/__tests__/helper.spec.ts +110 -1
- package/src/components/Calendar/helpers.ts +75 -0
- package/src/components/Calendar/index.tsx +19 -15
- package/src/components/RichTextEditor/RichTextEditor.tsx +14 -20
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -4
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -4
- package/src/theme/components/calendar.ts +6 -1
- package/src/theme/global/colors/ehWorkDark.ts +59 -0
- package/src/theme/global/index.ts +2 -0
- package/src/theme/index.ts +2 -0
- package/src/types.ts +2 -0
- package/stats/8.88.0/rn-stats.html +0 -2
- package/types/components/Calendar/CalendarRange.d.ts +23 -0
- package/types/components/Calendar/CalendarRangeConnector.d.ts +11 -0
- package/types/components/Calendar/CalendarRowItem.d.ts +3 -1
- package/types/components/Calendar/StyledCalendar.d.ts +2 -1
- package/types/components/Calendar/helpers.d.ts +15 -0
- package/types/components/Calendar/index.d.ts +4 -2
- package/types/index.d.ts +2 -2
- package/types/theme/components/calendar.d.ts +5 -0
- package/types/theme/global/colors/ehWorkDark.d.ts +49 -0
- package/types/theme/global/index.d.ts +2 -1
- package/types/theme/index.d.ts +2 -2
- package/types/types.d.ts +2 -1
- package/.turbo/turbo-build.log +0 -13
|
@@ -13,9 +13,12 @@ exports[`CalendarRowItem renders correctly 1`] = `
|
|
|
13
13
|
[
|
|
14
14
|
{
|
|
15
15
|
"alignItems": "center",
|
|
16
|
+
"backgroundColor": undefined,
|
|
16
17
|
"flexBasis": "14%",
|
|
17
|
-
"height":
|
|
18
|
+
"height": 120,
|
|
18
19
|
"justifyContent": "center",
|
|
20
|
+
"lineHeight": 0,
|
|
21
|
+
"maxHeight": 56,
|
|
19
22
|
"width": 120,
|
|
20
23
|
},
|
|
21
24
|
undefined,
|
|
@@ -55,14 +58,16 @@ exports[`CalendarRowItem renders correctly 1`] = `
|
|
|
55
58
|
style={
|
|
56
59
|
{
|
|
57
60
|
"alignItems": "center",
|
|
58
|
-
"backgroundColor":
|
|
61
|
+
"backgroundColor": "transparent",
|
|
59
62
|
"borderColor": "#001f23",
|
|
60
63
|
"borderRadius": 999,
|
|
61
64
|
"borderWidth": 0,
|
|
62
|
-
"height":
|
|
65
|
+
"height": "100%",
|
|
63
66
|
"justifyContent": "center",
|
|
67
|
+
"maxHeight": 56,
|
|
68
|
+
"maxWidth": 56,
|
|
64
69
|
"opacity": 1,
|
|
65
|
-
"width":
|
|
70
|
+
"width": "100%",
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
>
|
|
@@ -141,9 +146,12 @@ exports[`CalendarRowItem renders correctly 2`] = `
|
|
|
141
146
|
[
|
|
142
147
|
{
|
|
143
148
|
"alignItems": "center",
|
|
149
|
+
"backgroundColor": undefined,
|
|
144
150
|
"flexBasis": "14%",
|
|
145
|
-
"height":
|
|
151
|
+
"height": 120,
|
|
146
152
|
"justifyContent": "center",
|
|
153
|
+
"lineHeight": 0,
|
|
154
|
+
"maxHeight": 56,
|
|
147
155
|
"width": 120,
|
|
148
156
|
},
|
|
149
157
|
undefined,
|
|
@@ -183,14 +191,16 @@ exports[`CalendarRowItem renders correctly 2`] = `
|
|
|
183
191
|
style={
|
|
184
192
|
{
|
|
185
193
|
"alignItems": "center",
|
|
186
|
-
"backgroundColor":
|
|
194
|
+
"backgroundColor": "transparent",
|
|
187
195
|
"borderColor": "#001f23",
|
|
188
196
|
"borderRadius": 999,
|
|
189
197
|
"borderWidth": 0,
|
|
190
|
-
"height":
|
|
198
|
+
"height": "100%",
|
|
191
199
|
"justifyContent": "center",
|
|
200
|
+
"maxHeight": 56,
|
|
201
|
+
"maxWidth": 56,
|
|
192
202
|
"opacity": 1,
|
|
193
|
-
"width":
|
|
203
|
+
"width": "100%",
|
|
194
204
|
}
|
|
195
205
|
}
|
|
196
206
|
>
|
|
@@ -269,10 +279,13 @@ exports[`CalendarRowItem renders correctly when is current date 1`] = `
|
|
|
269
279
|
[
|
|
270
280
|
{
|
|
271
281
|
"alignItems": "center",
|
|
282
|
+
"backgroundColor": undefined,
|
|
272
283
|
"flexBasis": "14%",
|
|
273
|
-
"height":
|
|
284
|
+
"height": 56,
|
|
274
285
|
"justifyContent": "center",
|
|
275
|
-
"
|
|
286
|
+
"lineHeight": 0,
|
|
287
|
+
"maxHeight": 56,
|
|
288
|
+
"width": 56,
|
|
276
289
|
},
|
|
277
290
|
undefined,
|
|
278
291
|
]
|
|
@@ -314,10 +327,12 @@ exports[`CalendarRowItem renders correctly when is current date 1`] = `
|
|
|
314
327
|
"borderColor": "#001f23",
|
|
315
328
|
"borderRadius": 999,
|
|
316
329
|
"borderWidth": 0,
|
|
317
|
-
"height":
|
|
330
|
+
"height": "100%",
|
|
318
331
|
"justifyContent": "center",
|
|
332
|
+
"maxHeight": 56,
|
|
333
|
+
"maxWidth": 56,
|
|
319
334
|
"opacity": 1,
|
|
320
|
-
"width":
|
|
335
|
+
"width": "100%",
|
|
321
336
|
}
|
|
322
337
|
}
|
|
323
338
|
>
|
|
@@ -396,10 +411,13 @@ exports[`CalendarRowItem renders correctly when selected, and is current date eq
|
|
|
396
411
|
[
|
|
397
412
|
{
|
|
398
413
|
"alignItems": "center",
|
|
414
|
+
"backgroundColor": undefined,
|
|
399
415
|
"flexBasis": "14%",
|
|
400
|
-
"height":
|
|
416
|
+
"height": 56,
|
|
401
417
|
"justifyContent": "center",
|
|
402
|
-
"
|
|
418
|
+
"lineHeight": 0,
|
|
419
|
+
"maxHeight": 56,
|
|
420
|
+
"width": 56,
|
|
403
421
|
},
|
|
404
422
|
undefined,
|
|
405
423
|
]
|
|
@@ -441,10 +459,12 @@ exports[`CalendarRowItem renders correctly when selected, and is current date eq
|
|
|
441
459
|
"borderColor": "#001f23",
|
|
442
460
|
"borderRadius": 999,
|
|
443
461
|
"borderWidth": 0,
|
|
444
|
-
"height":
|
|
462
|
+
"height": "100%",
|
|
445
463
|
"justifyContent": "center",
|
|
464
|
+
"maxHeight": 56,
|
|
465
|
+
"maxWidth": 56,
|
|
446
466
|
"opacity": 1,
|
|
447
|
-
"width":
|
|
467
|
+
"width": "100%",
|
|
448
468
|
}
|
|
449
469
|
}
|
|
450
470
|
>
|
|
@@ -523,10 +543,13 @@ exports[`CalendarRowItem renders correctly when selected, and is current date eq
|
|
|
523
543
|
[
|
|
524
544
|
{
|
|
525
545
|
"alignItems": "center",
|
|
546
|
+
"backgroundColor": undefined,
|
|
526
547
|
"flexBasis": "14%",
|
|
527
|
-
"height":
|
|
548
|
+
"height": 56,
|
|
528
549
|
"justifyContent": "center",
|
|
529
|
-
"
|
|
550
|
+
"lineHeight": 0,
|
|
551
|
+
"maxHeight": 56,
|
|
552
|
+
"width": 56,
|
|
530
553
|
},
|
|
531
554
|
undefined,
|
|
532
555
|
]
|
|
@@ -568,10 +591,12 @@ exports[`CalendarRowItem renders correctly when selected, and is current date eq
|
|
|
568
591
|
"borderColor": "#001f23",
|
|
569
592
|
"borderRadius": 999,
|
|
570
593
|
"borderWidth": 0,
|
|
571
|
-
"height":
|
|
594
|
+
"height": "100%",
|
|
572
595
|
"justifyContent": "center",
|
|
596
|
+
"maxHeight": 56,
|
|
597
|
+
"maxWidth": 56,
|
|
573
598
|
"opacity": 1,
|
|
574
|
-
"width":
|
|
599
|
+
"width": "100%",
|
|
575
600
|
}
|
|
576
601
|
}
|
|
577
602
|
>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getValidDate,
|
|
3
|
+
initArray,
|
|
4
|
+
isDateInRange,
|
|
5
|
+
isEqDate,
|
|
6
|
+
setStartOrEndDate,
|
|
7
|
+
} from '../helpers';
|
|
2
8
|
|
|
3
9
|
describe('initArray', () => {
|
|
4
10
|
it('returns correct value', () => {
|
|
@@ -48,3 +54,106 @@ describe('getValidDate', () => {
|
|
|
48
54
|
}
|
|
49
55
|
);
|
|
50
56
|
});
|
|
57
|
+
|
|
58
|
+
describe('isDateInRange', () => {
|
|
59
|
+
it('returns correct value', () => {
|
|
60
|
+
const range = {
|
|
61
|
+
startDate: new Date('2022-10-09'),
|
|
62
|
+
endDate: new Date('2022-10-15'),
|
|
63
|
+
};
|
|
64
|
+
const dateInRange = new Date('2022-10-10');
|
|
65
|
+
const dateOutRange = new Date('2022-10-16');
|
|
66
|
+
|
|
67
|
+
const actualInRange = isDateInRange({ date: dateInRange, range });
|
|
68
|
+
const actualOutRange = isDateInRange({ date: dateOutRange, range });
|
|
69
|
+
|
|
70
|
+
expect(actualInRange).toEqual(true);
|
|
71
|
+
expect(actualOutRange).toEqual(false);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('setStartOrEndDate', () => {
|
|
76
|
+
// Test case 1: Selecting same date as start or end date
|
|
77
|
+
it('should not change dates when selecting same date as start date', () => {
|
|
78
|
+
const date = new Date('2024-03-15');
|
|
79
|
+
const startDate = new Date('2024-03-15');
|
|
80
|
+
const endDate = new Date('2024-03-20');
|
|
81
|
+
|
|
82
|
+
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
83
|
+
expect(result).toEqual({ startDate, endDate });
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Test case 2: Initial selection (no start date)
|
|
87
|
+
it('should set start date when no dates are selected', () => {
|
|
88
|
+
const date = new Date('2024-03-15');
|
|
89
|
+
|
|
90
|
+
const result = setStartOrEndDate({ date });
|
|
91
|
+
expect(result).toEqual({
|
|
92
|
+
startDate: new Date('2024-03-15'),
|
|
93
|
+
endDate: undefined,
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Test case 3: Setting end date after start date
|
|
98
|
+
it('should set end date when start date exists and selected date is after', () => {
|
|
99
|
+
const date = new Date('2024-03-20');
|
|
100
|
+
const startDate = new Date('2024-03-15');
|
|
101
|
+
|
|
102
|
+
const result = setStartOrEndDate({ date, startDate });
|
|
103
|
+
expect(result).toEqual({
|
|
104
|
+
startDate: new Date('2024-03-15'),
|
|
105
|
+
endDate: new Date('2024-03-20'),
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Test case 4: Setting end date before start date (should reorder)
|
|
110
|
+
it('should reorder dates when end date is selected before start date', () => {
|
|
111
|
+
const date = new Date('2024-03-10');
|
|
112
|
+
const startDate = new Date('2024-03-15');
|
|
113
|
+
|
|
114
|
+
const result = setStartOrEndDate({ date, startDate });
|
|
115
|
+
expect(result).toEqual({
|
|
116
|
+
startDate: new Date('2024-03-10'),
|
|
117
|
+
endDate: new Date('2024-03-15'),
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Test case 5: Clicking within existing range
|
|
122
|
+
it('should start new selection when clicking within existing range', () => {
|
|
123
|
+
const date = new Date('2024-03-17');
|
|
124
|
+
const startDate = new Date('2024-03-15');
|
|
125
|
+
const endDate = new Date('2024-03-20');
|
|
126
|
+
|
|
127
|
+
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
128
|
+
expect(result).toEqual({
|
|
129
|
+
startDate: new Date('2024-03-17'),
|
|
130
|
+
endDate: undefined,
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Test case 6: Extending range before start date
|
|
135
|
+
it('should extend range when clicking before start date', () => {
|
|
136
|
+
const date = new Date('2024-03-10');
|
|
137
|
+
const startDate = new Date('2024-03-15');
|
|
138
|
+
const endDate = new Date('2024-03-20');
|
|
139
|
+
|
|
140
|
+
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
141
|
+
expect(result).toEqual({
|
|
142
|
+
startDate: new Date('2024-03-10'),
|
|
143
|
+
endDate: new Date('2024-03-20'),
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Test case 7: Extending range after end date
|
|
148
|
+
it('should extend range when clicking after end date', () => {
|
|
149
|
+
const date = new Date('2024-03-25');
|
|
150
|
+
const startDate = new Date('2024-03-15');
|
|
151
|
+
const endDate = new Date('2024-03-20');
|
|
152
|
+
|
|
153
|
+
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
154
|
+
expect(result).toEqual({
|
|
155
|
+
startDate: new Date('2024-03-15'),
|
|
156
|
+
endDate: new Date('2024-03-25'),
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
});
|
|
@@ -4,6 +4,23 @@ export const initArray = <T>(length: number, func: (value: number) => T): T[] =>
|
|
|
4
4
|
export const isEqDate = (dateA?: Date, dateB?: Date) =>
|
|
5
5
|
dateA?.toDateString() === dateB?.toDateString();
|
|
6
6
|
|
|
7
|
+
export const isDateInRange = ({
|
|
8
|
+
date,
|
|
9
|
+
range,
|
|
10
|
+
}: {
|
|
11
|
+
date: Date;
|
|
12
|
+
range?: {
|
|
13
|
+
startDate?: Date;
|
|
14
|
+
endDate?: Date;
|
|
15
|
+
};
|
|
16
|
+
}) => {
|
|
17
|
+
if (!range || range.startDate === undefined || range.endDate === undefined) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return date >= range.startDate && date <= range.endDate;
|
|
22
|
+
};
|
|
23
|
+
|
|
7
24
|
export const getValidDate = (
|
|
8
25
|
date: Date,
|
|
9
26
|
minDate?: Date,
|
|
@@ -27,3 +44,61 @@ export const getValidDate = (
|
|
|
27
44
|
|
|
28
45
|
return undefined;
|
|
29
46
|
};
|
|
47
|
+
|
|
48
|
+
export const setStartOrEndDate = ({
|
|
49
|
+
date,
|
|
50
|
+
startDate,
|
|
51
|
+
endDate,
|
|
52
|
+
}: {
|
|
53
|
+
date: Date;
|
|
54
|
+
startDate?: Date;
|
|
55
|
+
endDate?: Date;
|
|
56
|
+
}) => {
|
|
57
|
+
// Prevent selecting same date
|
|
58
|
+
if (isEqDate(date, startDate) || isEqDate(date, endDate)) {
|
|
59
|
+
return {
|
|
60
|
+
startDate,
|
|
61
|
+
endDate,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// No start date yet - set as start
|
|
66
|
+
if (!startDate) {
|
|
67
|
+
return {
|
|
68
|
+
startDate: date,
|
|
69
|
+
endDate: undefined,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Have start but no end - set as end and reorder if needed
|
|
74
|
+
if (!endDate) {
|
|
75
|
+
return date < startDate
|
|
76
|
+
? {
|
|
77
|
+
startDate: date,
|
|
78
|
+
endDate: startDate,
|
|
79
|
+
}
|
|
80
|
+
: {
|
|
81
|
+
startDate,
|
|
82
|
+
endDate: date,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Clicking within range - start new selection
|
|
87
|
+
if (date >= startDate && date <= endDate) {
|
|
88
|
+
return {
|
|
89
|
+
startDate: date,
|
|
90
|
+
endDate: undefined,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Clicking outside range - extend range
|
|
95
|
+
return date < startDate
|
|
96
|
+
? {
|
|
97
|
+
startDate: date,
|
|
98
|
+
endDate,
|
|
99
|
+
}
|
|
100
|
+
: {
|
|
101
|
+
startDate,
|
|
102
|
+
endDate: date,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from '@hero-design/react-native-month-year-picker';
|
|
5
5
|
import format from 'date-fns/fp/format';
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
|
-
import { Platform, TouchableOpacity } from 'react-native';
|
|
7
|
+
import { LayoutChangeEvent, Platform, TouchableOpacity } from 'react-native';
|
|
8
8
|
import { useTheme } from '../../theme';
|
|
9
9
|
import { noop } from '../../utils/functions';
|
|
10
10
|
import Box from '../Box';
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
StyledDisabledCalendarRowItem,
|
|
22
22
|
} from './StyledCalendar';
|
|
23
23
|
import { getValidDate, initArray, isEqDate } from './helpers';
|
|
24
|
+
import CalendarRange from './CalendarRange';
|
|
24
25
|
|
|
25
26
|
const DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
26
27
|
// Sunday first column => 0
|
|
@@ -125,8 +126,13 @@ const Calendar = ({
|
|
|
125
126
|
const [contentHeight, setContentHeight] = useState(0);
|
|
126
127
|
const [contentWidth, setContentWidth] = useState(0);
|
|
127
128
|
const calendarItemWidth = useMemo(
|
|
128
|
-
() =>
|
|
129
|
-
|
|
129
|
+
() =>
|
|
130
|
+
contentWidth > 0
|
|
131
|
+
? Math.floor(
|
|
132
|
+
(contentWidth - theme.__hd__.calendar.space.cellPadding) / 7
|
|
133
|
+
)
|
|
134
|
+
: undefined,
|
|
135
|
+
[contentWidth, theme]
|
|
130
136
|
);
|
|
131
137
|
|
|
132
138
|
const useMonthPicker = onMonthChange !== noop;
|
|
@@ -186,6 +192,12 @@ const Calendar = ({
|
|
|
186
192
|
: !daysOfNextMonth.some((date) => date !== undefined) ||
|
|
187
193
|
maxDate <= lastDateOfMonth;
|
|
188
194
|
|
|
195
|
+
const onLayout = (e: LayoutChangeEvent) => {
|
|
196
|
+
const { width, height } = e.nativeEvent.layout;
|
|
197
|
+
setContentHeight(height);
|
|
198
|
+
setContentWidth(width);
|
|
199
|
+
};
|
|
200
|
+
|
|
189
201
|
return (
|
|
190
202
|
<StyledContainer testID={testID}>
|
|
191
203
|
<StyledCalendarHeader>
|
|
@@ -251,17 +263,7 @@ const Calendar = ({
|
|
|
251
263
|
/>
|
|
252
264
|
</Box>
|
|
253
265
|
) : (
|
|
254
|
-
<Box
|
|
255
|
-
onLayout={
|
|
256
|
-
Platform.OS === 'ios'
|
|
257
|
-
? (e) => {
|
|
258
|
-
const { width, height } = e.nativeEvent.layout;
|
|
259
|
-
setContentHeight(height);
|
|
260
|
-
setContentWidth(width);
|
|
261
|
-
}
|
|
262
|
-
: undefined
|
|
263
|
-
}
|
|
264
|
-
>
|
|
266
|
+
<Box onLayout={onLayout}>
|
|
265
267
|
<StyledCalendarRow>
|
|
266
268
|
{DAYS_OF_WEEK.map((day) => (
|
|
267
269
|
<StyledCalendarRowItem key={day}>
|
|
@@ -353,4 +355,6 @@ const Calendar = ({
|
|
|
353
355
|
);
|
|
354
356
|
};
|
|
355
357
|
|
|
356
|
-
export default Calendar
|
|
358
|
+
export default Object.assign(Calendar, {
|
|
359
|
+
Range: CalendarRange,
|
|
360
|
+
});
|
|
@@ -156,7 +156,6 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
156
156
|
height: number;
|
|
157
157
|
width: number;
|
|
158
158
|
}>({ height: 0, width: 0 });
|
|
159
|
-
const [labelWidth, setLabelWidth] = React.useState<number>(0);
|
|
160
159
|
|
|
161
160
|
const focusAnimation = useRef(new Animated.Value(0)).current;
|
|
162
161
|
|
|
@@ -174,11 +173,6 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
174
173
|
setInputSize((prev) => ({ ...prev, height, width }));
|
|
175
174
|
}, []);
|
|
176
175
|
|
|
177
|
-
const onLabelLayout = useCallback((event: LayoutChangeEvent) => {
|
|
178
|
-
const { width } = event.nativeEvent.layout;
|
|
179
|
-
setLabelWidth(width);
|
|
180
|
-
}, []);
|
|
181
|
-
|
|
182
176
|
useEffect(() => {
|
|
183
177
|
const removeFocusListener = Events.on(
|
|
184
178
|
emitter,
|
|
@@ -373,15 +367,15 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
373
367
|
{
|
|
374
368
|
translateY: focusAnimation.interpolate({
|
|
375
369
|
inputRange: [0, 1],
|
|
376
|
-
outputRange: [inputSize.height / 2,
|
|
370
|
+
outputRange: [inputSize.height / 2, theme.space.xsmall],
|
|
377
371
|
}),
|
|
378
372
|
},
|
|
379
373
|
{
|
|
380
374
|
translateX: focusAnimation.interpolate({
|
|
381
375
|
inputRange: [0, 1],
|
|
382
376
|
outputRange: [
|
|
383
|
-
|
|
384
|
-
-
|
|
377
|
+
theme.space.medium,
|
|
378
|
+
-theme.space.xlarge + theme.space.xsmall,
|
|
385
379
|
],
|
|
386
380
|
}),
|
|
387
381
|
},
|
|
@@ -395,16 +389,6 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
395
389
|
},
|
|
396
390
|
]}
|
|
397
391
|
>
|
|
398
|
-
{required && (
|
|
399
|
-
<StyledAsteriskLabelInsideTextInput
|
|
400
|
-
style={{
|
|
401
|
-
backgroundColor: theme.__hd__.textInput.colors.labelBackground,
|
|
402
|
-
}}
|
|
403
|
-
themeState={state}
|
|
404
|
-
>
|
|
405
|
-
*
|
|
406
|
-
</StyledAsteriskLabelInsideTextInput>
|
|
407
|
-
)}
|
|
408
392
|
{!!label && (
|
|
409
393
|
<StyledLabelInsideTextInput
|
|
410
394
|
style={{
|
|
@@ -412,8 +396,18 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
|
|
|
412
396
|
}}
|
|
413
397
|
testID="input-label"
|
|
414
398
|
themeState={state}
|
|
415
|
-
onLayout={onLabelLayout}
|
|
416
399
|
>
|
|
400
|
+
{required && (
|
|
401
|
+
<StyledAsteriskLabelInsideTextInput
|
|
402
|
+
style={{
|
|
403
|
+
backgroundColor:
|
|
404
|
+
theme.__hd__.textInput.colors.labelBackground,
|
|
405
|
+
}}
|
|
406
|
+
themeState={state}
|
|
407
|
+
>
|
|
408
|
+
*
|
|
409
|
+
</StyledAsteriskLabelInsideTextInput>
|
|
410
|
+
)}
|
|
417
411
|
{label}
|
|
418
412
|
</StyledLabelInsideTextInput>
|
|
419
413
|
)}
|
|
@@ -36,7 +36,7 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
|
|
|
36
36
|
"translateY": 0,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"translateX":
|
|
39
|
+
"translateX": 16,
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"scale": 1,
|
|
@@ -50,7 +50,6 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
|
|
|
50
50
|
>
|
|
51
51
|
<Text
|
|
52
52
|
allowFontScaling={false}
|
|
53
|
-
onLayout={[Function]}
|
|
54
53
|
style={
|
|
55
54
|
[
|
|
56
55
|
{
|
|
@@ -359,7 +358,7 @@ exports[`RichTextEditor should render correctly 1`] = `
|
|
|
359
358
|
"translateY": 0,
|
|
360
359
|
},
|
|
361
360
|
{
|
|
362
|
-
"translateX":
|
|
361
|
+
"translateX": 16,
|
|
363
362
|
},
|
|
364
363
|
{
|
|
365
364
|
"scale": 1,
|
|
@@ -373,7 +372,6 @@ exports[`RichTextEditor should render correctly 1`] = `
|
|
|
373
372
|
>
|
|
374
373
|
<Text
|
|
375
374
|
allowFontScaling={false}
|
|
376
|
-
onLayout={[Function]}
|
|
377
375
|
style={
|
|
378
376
|
[
|
|
379
377
|
{
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import theme, {
|
|
|
10
10
|
jobsSystemPalette,
|
|
11
11
|
walletSystemPalette,
|
|
12
12
|
eBensSystemPalette,
|
|
13
|
+
ehWorkDarkPalette,
|
|
13
14
|
ThemeSwitcher,
|
|
14
15
|
withTheme,
|
|
15
16
|
} from './theme';
|
|
@@ -90,6 +91,7 @@ export {
|
|
|
90
91
|
jobsSystemPalette,
|
|
91
92
|
walletSystemPalette,
|
|
92
93
|
eBensSystemPalette,
|
|
94
|
+
ehWorkDarkPalette,
|
|
93
95
|
Accordion,
|
|
94
96
|
Alert,
|
|
95
97
|
AppCue,
|
|
@@ -319,19 +319,24 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
319
319
|
"border": "#001f23",
|
|
320
320
|
"inverted": "#ffffff",
|
|
321
321
|
"primary": "#401960",
|
|
322
|
+
"rowItem": {
|
|
323
|
+
"highlighted": "#ece8ef",
|
|
324
|
+
"selected": "#401960",
|
|
325
|
+
},
|
|
322
326
|
},
|
|
323
327
|
"radii": {
|
|
324
328
|
"default": 999,
|
|
325
329
|
},
|
|
326
330
|
"sizes": {
|
|
327
|
-
"cellCircleHeight":
|
|
328
|
-
"cellCircleWidth":
|
|
329
|
-
"cellHeight":
|
|
330
|
-
"cellWidth":
|
|
331
|
+
"cellCircleHeight": 52,
|
|
332
|
+
"cellCircleWidth": 52,
|
|
333
|
+
"cellHeight": 56,
|
|
334
|
+
"cellWidth": 56,
|
|
331
335
|
"markHeight": 4,
|
|
332
336
|
"markWidth": 4,
|
|
333
337
|
},
|
|
334
338
|
"space": {
|
|
339
|
+
"cellPadding": 32,
|
|
335
340
|
"headerHorizontalPadding": 12,
|
|
336
341
|
"headerMarginRight": 8,
|
|
337
342
|
"headerVerticalPadding": 16,
|
|
@@ -6,9 +6,13 @@ const getCalendarTheme = (theme: GlobalTheme) => {
|
|
|
6
6
|
border: theme.colors.primaryOutline,
|
|
7
7
|
primary: theme.colors.primary,
|
|
8
8
|
inverted: theme.colors.onDarkGlobalSurface,
|
|
9
|
+
rowItem: {
|
|
10
|
+
selected: theme.colors.primary,
|
|
11
|
+
highlighted: theme.colors.highlightedSurface,
|
|
12
|
+
},
|
|
9
13
|
};
|
|
10
14
|
|
|
11
|
-
const cellSize = theme.sizes.
|
|
15
|
+
const cellSize = theme.sizes.xxxxlarge;
|
|
12
16
|
const markSize = theme.sizes.xsmall;
|
|
13
17
|
|
|
14
18
|
const sizes = {
|
|
@@ -26,6 +30,7 @@ const getCalendarTheme = (theme: GlobalTheme) => {
|
|
|
26
30
|
headerHorizontalPadding: theme.space.smallMedium,
|
|
27
31
|
headerMarginRight: theme.space.small,
|
|
28
32
|
iosPickerMarginVertical: theme.space['5xlarge'],
|
|
33
|
+
cellPadding: theme.space.xlarge,
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
const radii = {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const ehWorkDarkPalette = {
|
|
2
|
+
black: '#000000',
|
|
3
|
+
white: '#ffffff',
|
|
4
|
+
// Surface
|
|
5
|
+
defaultGlobalSurface: '#27272A',
|
|
6
|
+
neutralGlobalSurface: '#121214',
|
|
7
|
+
darkGlobalSurface: '#fcfbff',
|
|
8
|
+
overlayGlobalSurface: '#ffffff',
|
|
9
|
+
// On Surface
|
|
10
|
+
onDefaultGlobalSurface: '#ffffff',
|
|
11
|
+
mutedOnDefaultGlobalSurface: '#a9a9b2',
|
|
12
|
+
inactiveOnDefaultGlobalSurface: '#71717a',
|
|
13
|
+
disabledOnDefaultGlobalSurface: '#52525b',
|
|
14
|
+
onDarkGlobalSurface: '#121214',
|
|
15
|
+
// Outline:
|
|
16
|
+
primaryOutline: '#a9a9b2',
|
|
17
|
+
secondaryOutline: '#3f3f46',
|
|
18
|
+
inactiveOutline: '#71717a',
|
|
19
|
+
disabledOutline: '#52525b',
|
|
20
|
+
// Archived:
|
|
21
|
+
archivedSurface: '#52525b',
|
|
22
|
+
mutedArchived: '#3f3f46',
|
|
23
|
+
archived: '#71717a',
|
|
24
|
+
onArchivedSurface: '#a9a9b2',
|
|
25
|
+
// Error:
|
|
26
|
+
errorSurface: '#7a1d06',
|
|
27
|
+
mutedError: '#9b2508',
|
|
28
|
+
error: '#bd2d09',
|
|
29
|
+
onErrorSurface: '#fecfca',
|
|
30
|
+
// Warning:
|
|
31
|
+
warningSurface: '#963e03',
|
|
32
|
+
mutedWarning: '#c35004',
|
|
33
|
+
warning: '#dc6204',
|
|
34
|
+
onWarningSurface: '#fff0d5',
|
|
35
|
+
// Success:
|
|
36
|
+
successSurface: '#00483e',
|
|
37
|
+
mutedSuccess: '#016256',
|
|
38
|
+
success: '#017d6d',
|
|
39
|
+
onSuccessSurface: '#a7f3e9',
|
|
40
|
+
// Info:
|
|
41
|
+
infoSurface: '#004a61',
|
|
42
|
+
mutedInfo: '#006585',
|
|
43
|
+
info: '#007da3',
|
|
44
|
+
onInfoSurface: '#a0e8ff',
|
|
45
|
+
// Brand:
|
|
46
|
+
primary: '#cdacfe',
|
|
47
|
+
onPrimary: '#fdfbff',
|
|
48
|
+
secondary: '#7622d7',
|
|
49
|
+
onSecondary: '#ffffff',
|
|
50
|
+
defaultSurface: '#fdfbff',
|
|
51
|
+
highlightedSurface: '#460078',
|
|
52
|
+
pressedSurface: '#9a58fc',
|
|
53
|
+
decorativePrimary: '#fdfbff',
|
|
54
|
+
decorativePrimarySurface: '#74409a',
|
|
55
|
+
decorativeSecondary: '#fdfbff',
|
|
56
|
+
decorativeSecondarySurface: '#f0e6ff',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default ehWorkDarkPalette;
|
|
@@ -7,6 +7,7 @@ import workSystemPalette from './colors/work';
|
|
|
7
7
|
import jobsSystemPalette from './colors/jobs';
|
|
8
8
|
import walletSystemPalette from './colors/wallet';
|
|
9
9
|
import eBensSystemPalette from './colors/eBens';
|
|
10
|
+
import ehWorkDarkPalette from './colors/ehWorkDark';
|
|
10
11
|
|
|
11
12
|
import { getFonts, getFontSizes, getLineHeights } from './typography';
|
|
12
13
|
import { getSpace } from './space';
|
|
@@ -56,4 +57,5 @@ export {
|
|
|
56
57
|
jobsSystemPalette,
|
|
57
58
|
walletSystemPalette,
|
|
58
59
|
eBensSystemPalette,
|
|
60
|
+
ehWorkDarkPalette,
|
|
59
61
|
};
|