@hero-design/rn-work-uikit 1.5.0 → 1.6.0
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/CHANGELOG.md +13 -0
- package/lib/index.js +141 -66
- package/package.json +2 -2
- package/src/components/DatePicker/__tests__/__snapshots__/index.spec.tsx.snap +33 -0
- package/src/components/FormGroup/__tests__/index.spec.tsx +62 -49
- package/src/components/RichTextEditor/RichTextEditor.tsx +15 -24
- package/src/components/RichTextEditor/StyledRichTextEditor.tsx +9 -3
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +81 -0
- package/src/components/RichTextEditor/index.tsx +2 -4
- package/src/components/RichTextEditor/types.ts +12 -1
- package/stats/1.6.0/rn-work-uikit-stats.html +4844 -0
- package/testUtils/setup.tsx +19 -1
- package/src/components/RichTextEditor/__mocks__/hero-editor.js +0 -3
- package/stats/1.5.0/rn-work-uikit-stats.html +0 -4844
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4080](https://github.com/Thinkei/hero-design/pull/4080) [`920325f82fa122dee579f6b5c86fbea1f5207416`](https://github.com/Thinkei/hero-design/commit/920325f82fa122dee579f6b5c86fbea1f5207416) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [FormGroup] Support DatePicker and TimePicker components
|
|
8
|
+
|
|
9
|
+
- [#4082](https://github.com/Thinkei/hero-design/pull/4082) [`c42078b416b885383f6faf51180f302f74181268`](https://github.com/Thinkei/hero-design/commit/c42078b416b885383f6faf51180f302f74181268) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [FormGroup][richtexteditor] Support group style for RichTextEditor
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`920325f82fa122dee579f6b5c86fbea1f5207416`](https://github.com/Thinkei/hero-design/commit/920325f82fa122dee579f6b5c86fbea1f5207416)]:
|
|
14
|
+
- @hero-design/rn@8.103.7
|
|
15
|
+
|
|
3
16
|
## 1.5.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/lib/index.js
CHANGED
|
@@ -10208,18 +10208,18 @@ var StyledSectionList = index$b(reactNative.SectionList)(function (_ref4) {
|
|
|
10208
10208
|
paddingHorizontal: theme.__hd__.select.space.optionListHorizontalPadding
|
|
10209
10209
|
};
|
|
10210
10210
|
});
|
|
10211
|
-
var getZIndexByState$
|
|
10211
|
+
var getZIndexByState$3 = function getZIndexByState(_ref5) {
|
|
10212
10212
|
var themeHasError = _ref5.themeHasError;
|
|
10213
10213
|
if (themeHasError) {
|
|
10214
10214
|
return 1;
|
|
10215
10215
|
}
|
|
10216
10216
|
return 0;
|
|
10217
10217
|
};
|
|
10218
|
-
var StyledTouchableOpacity = index$b(reactNative.TouchableOpacity)(function (_ref6) {
|
|
10218
|
+
var StyledTouchableOpacity$2 = index$b(reactNative.TouchableOpacity)(function (_ref6) {
|
|
10219
10219
|
var themeGroupStyleEnabled = _ref6.themeGroupStyleEnabled,
|
|
10220
10220
|
themeHasError = _ref6.themeHasError;
|
|
10221
10221
|
return _objectSpread2({}, themeGroupStyleEnabled && {
|
|
10222
|
-
zIndex: getZIndexByState$
|
|
10222
|
+
zIndex: getZIndexByState$3({
|
|
10223
10223
|
themeHasError: themeHasError
|
|
10224
10224
|
})
|
|
10225
10225
|
});
|
|
@@ -10806,7 +10806,7 @@ function MultiSelect$1(_ref) {
|
|
|
10806
10806
|
}, [open, value]);
|
|
10807
10807
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
10808
10808
|
pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
|
|
10809
|
-
}, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
|
|
10809
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$2, {
|
|
10810
10810
|
onPress: onPress,
|
|
10811
10811
|
themeGroupStyleEnabled: groupStyleEnabled,
|
|
10812
10812
|
themeHasError: !!error,
|
|
@@ -11017,7 +11017,7 @@ var SingleSelect$1 = function SingleSelect(_ref) {
|
|
|
11017
11017
|
}, []);
|
|
11018
11018
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
11019
11019
|
pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
|
|
11020
|
-
}, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
|
|
11020
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$2, {
|
|
11021
11021
|
onPress: onPress,
|
|
11022
11022
|
themeGroupStyleEnabled: groupStyleEnabled,
|
|
11023
11023
|
themeHasError: !!error,
|
|
@@ -13442,6 +13442,30 @@ var useFormatDate = function useFormatDate(_ref) {
|
|
|
13442
13442
|
};
|
|
13443
13443
|
};
|
|
13444
13444
|
|
|
13445
|
+
var StyledPickerWrapper$1 = index$b(reactNative.View)(function (_ref) {
|
|
13446
|
+
var theme = _ref.theme;
|
|
13447
|
+
return {
|
|
13448
|
+
height: theme.__hd__.datePicker.sizes.height,
|
|
13449
|
+
alignItems: 'center'
|
|
13450
|
+
};
|
|
13451
|
+
});
|
|
13452
|
+
var getZIndexByState$2 = function getZIndexByState(_ref2) {
|
|
13453
|
+
var themeHasError = _ref2.themeHasError;
|
|
13454
|
+
if (themeHasError) {
|
|
13455
|
+
return 1;
|
|
13456
|
+
}
|
|
13457
|
+
return 0;
|
|
13458
|
+
};
|
|
13459
|
+
var StyledTouchableOpacity$1 = index$b(reactNative.TouchableOpacity)(function (_ref3) {
|
|
13460
|
+
var themeGroupStyleEnabled = _ref3.themeGroupStyleEnabled,
|
|
13461
|
+
themeHasError = _ref3.themeHasError;
|
|
13462
|
+
return _objectSpread2({}, themeGroupStyleEnabled && {
|
|
13463
|
+
zIndex: getZIndexByState$2({
|
|
13464
|
+
themeHasError: themeHasError
|
|
13465
|
+
})
|
|
13466
|
+
});
|
|
13467
|
+
});
|
|
13468
|
+
|
|
13445
13469
|
var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
13446
13470
|
var value = _ref.value,
|
|
13447
13471
|
minDate = _ref.minDate,
|
|
@@ -13461,7 +13485,10 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
|
13461
13485
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
13462
13486
|
renderSelectedValue = _ref.renderSelectedValue,
|
|
13463
13487
|
locale = _ref.locale,
|
|
13464
|
-
TextInputComponent = _ref.TextInputComponent
|
|
13488
|
+
TextInputComponent = _ref.TextInputComponent,
|
|
13489
|
+
inputProps = _ref.inputProps,
|
|
13490
|
+
_ref$groupStyleEnable = _ref.groupStyleEnabled,
|
|
13491
|
+
groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
|
|
13465
13492
|
var _useState = React.useState(false),
|
|
13466
13493
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13467
13494
|
open = _useState2[0],
|
|
@@ -13480,15 +13507,19 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
|
13480
13507
|
value: value
|
|
13481
13508
|
});
|
|
13482
13509
|
var InputComponent = TextInputComponent || TextInput$2;
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13510
|
+
var onPress = React.useCallback(function () {
|
|
13511
|
+
setOpen(true);
|
|
13512
|
+
}, []);
|
|
13513
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$1, {
|
|
13514
|
+
onPress: onPress,
|
|
13515
|
+
disabled: disabled,
|
|
13516
|
+
themeGroupStyleEnabled: groupStyleEnabled,
|
|
13517
|
+
themeHasError: !!error,
|
|
13518
|
+
testID: "date-picker-android-touchable-opacity"
|
|
13488
13519
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
13489
13520
|
pointerEvents: "none",
|
|
13490
13521
|
testID: "datePickerInputAndroid"
|
|
13491
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
|
|
13522
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
|
|
13492
13523
|
label: label,
|
|
13493
13524
|
value: displayValue,
|
|
13494
13525
|
suffix: "calendar-dates-outlined",
|
|
@@ -13505,7 +13536,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
|
|
|
13505
13536
|
formattedDateString: displayValue
|
|
13506
13537
|
}, props);
|
|
13507
13538
|
} : undefined
|
|
13508
|
-
})), /*#__PURE__*/React__namespace.default.createElement(AndroidDatePickerDialog, {
|
|
13539
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(AndroidDatePickerDialog, {
|
|
13509
13540
|
open: open,
|
|
13510
13541
|
onClose: function onClose() {
|
|
13511
13542
|
return setOpen(false);
|
|
@@ -14295,7 +14326,10 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14295
14326
|
supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient,
|
|
14296
14327
|
renderSelectedValue = _ref2.renderSelectedValue,
|
|
14297
14328
|
locale = _ref2.locale,
|
|
14298
|
-
TextInputComponent = _ref2.TextInputComponent
|
|
14329
|
+
TextInputComponent = _ref2.TextInputComponent,
|
|
14330
|
+
inputProps = _ref2.inputProps,
|
|
14331
|
+
_ref2$groupStyleEnabl = _ref2.groupStyleEnabled,
|
|
14332
|
+
groupStyleEnabled = _ref2$groupStyleEnabl === void 0 ? false : _ref2$groupStyleEnabl;
|
|
14299
14333
|
var _useState5 = React.useState(false),
|
|
14300
14334
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
14301
14335
|
open = _useState6[0],
|
|
@@ -14322,15 +14356,19 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14322
14356
|
value: value
|
|
14323
14357
|
});
|
|
14324
14358
|
var InputComponent = TextInputComponent || TextInput$2;
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14359
|
+
var onPress = React.useCallback(function () {
|
|
14360
|
+
setOpen(true);
|
|
14361
|
+
}, []);
|
|
14362
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$1, {
|
|
14363
|
+
onPress: onPress,
|
|
14364
|
+
disabled: disabled,
|
|
14365
|
+
themeGroupStyleEnabled: groupStyleEnabled,
|
|
14366
|
+
themeHasError: !!error,
|
|
14367
|
+
testID: "date-picker-calendar-touchable-opacity"
|
|
14330
14368
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
14331
14369
|
pointerEvents: "none",
|
|
14332
14370
|
testID: "datePickerCalendar"
|
|
14333
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
|
|
14371
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
|
|
14334
14372
|
label: label,
|
|
14335
14373
|
value: displayValue,
|
|
14336
14374
|
suffix: "calendar-dates-outlined",
|
|
@@ -14347,7 +14385,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14347
14385
|
formattedDateString: displayValue
|
|
14348
14386
|
}, props);
|
|
14349
14387
|
} : undefined
|
|
14350
|
-
})), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
14388
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
14351
14389
|
open: open,
|
|
14352
14390
|
onRequestClose: function onRequestClose() {
|
|
14353
14391
|
return setOpen(false);
|
|
@@ -14377,14 +14415,6 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
14377
14415
|
}))));
|
|
14378
14416
|
};
|
|
14379
14417
|
|
|
14380
|
-
var StyledPickerWrapper$1 = index$b(reactNative.View)(function (_ref) {
|
|
14381
|
-
var theme = _ref.theme;
|
|
14382
|
-
return {
|
|
14383
|
-
height: theme.__hd__.datePicker.sizes.height,
|
|
14384
|
-
alignItems: 'center'
|
|
14385
|
-
};
|
|
14386
|
-
});
|
|
14387
|
-
|
|
14388
14418
|
var IOSDatePickerDialog = function IOSDatePickerDialog(_ref) {
|
|
14389
14419
|
var label = _ref.label,
|
|
14390
14420
|
open = _ref.open,
|
|
@@ -14478,7 +14508,10 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
14478
14508
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
14479
14509
|
locale = _ref.locale,
|
|
14480
14510
|
renderSelectedValue = _ref.renderSelectedValue,
|
|
14481
|
-
TextInputComponent = _ref.TextInputComponent
|
|
14511
|
+
TextInputComponent = _ref.TextInputComponent,
|
|
14512
|
+
inputProps = _ref.inputProps,
|
|
14513
|
+
_ref$groupStyleEnable = _ref.groupStyleEnabled,
|
|
14514
|
+
groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
|
|
14482
14515
|
var _useState = React.useState(false),
|
|
14483
14516
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14484
14517
|
open = _useState2[0],
|
|
@@ -14499,15 +14532,19 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
14499
14532
|
value: value
|
|
14500
14533
|
});
|
|
14501
14534
|
var InputComponent = TextInputComponent || TextInput$2;
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14535
|
+
var onPress = React.useCallback(function () {
|
|
14536
|
+
setOpen(true);
|
|
14537
|
+
}, []);
|
|
14538
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$1, {
|
|
14539
|
+
onPress: onPress,
|
|
14540
|
+
disabled: disabled,
|
|
14541
|
+
themeGroupStyleEnabled: groupStyleEnabled,
|
|
14542
|
+
themeHasError: !!error,
|
|
14543
|
+
testID: "date-picker-ios-touchable-opacity"
|
|
14507
14544
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
14508
14545
|
pointerEvents: "none",
|
|
14509
14546
|
testID: "datePickerInputIOS"
|
|
14510
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
|
|
14547
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
|
|
14511
14548
|
label: label,
|
|
14512
14549
|
value: displayValue,
|
|
14513
14550
|
suffix: "calendar-dates-outlined",
|
|
@@ -14524,7 +14561,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
14524
14561
|
formattedDateString: displayValue
|
|
14525
14562
|
}, props);
|
|
14526
14563
|
} : undefined
|
|
14527
|
-
})), /*#__PURE__*/React__namespace.default.createElement(IOSDatePickerDialog, {
|
|
14564
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(IOSDatePickerDialog, {
|
|
14528
14565
|
value: value,
|
|
14529
14566
|
onChange: onChange,
|
|
14530
14567
|
open: open,
|
|
@@ -14578,6 +14615,30 @@ var InternalDatePicker$1 = Object.assign(InternalDatePicker, {
|
|
|
14578
14615
|
Dialog: Dialog
|
|
14579
14616
|
});
|
|
14580
14617
|
|
|
14618
|
+
var StyledPickerWrapper = index$b(reactNative.View)(function (_ref) {
|
|
14619
|
+
var theme = _ref.theme;
|
|
14620
|
+
return {
|
|
14621
|
+
height: theme.__hd__.timePicker.sizes.height,
|
|
14622
|
+
alignItems: 'center'
|
|
14623
|
+
};
|
|
14624
|
+
});
|
|
14625
|
+
var getZIndexByState$1 = function getZIndexByState(_ref2) {
|
|
14626
|
+
var themeHasError = _ref2.themeHasError;
|
|
14627
|
+
if (themeHasError) {
|
|
14628
|
+
return 1;
|
|
14629
|
+
}
|
|
14630
|
+
return 0;
|
|
14631
|
+
};
|
|
14632
|
+
var StyledTouchableOpacity = index$b(reactNative.TouchableOpacity)(function (_ref3) {
|
|
14633
|
+
var themeGroupStyleEnabled = _ref3.themeGroupStyleEnabled,
|
|
14634
|
+
themeHasError = _ref3.themeHasError;
|
|
14635
|
+
return _objectSpread2({}, themeGroupStyleEnabled && {
|
|
14636
|
+
zIndex: getZIndexByState$1({
|
|
14637
|
+
themeHasError: themeHasError
|
|
14638
|
+
})
|
|
14639
|
+
});
|
|
14640
|
+
});
|
|
14641
|
+
|
|
14581
14642
|
var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
14582
14643
|
var value = _ref.value,
|
|
14583
14644
|
label = _ref.label,
|
|
@@ -14594,7 +14655,10 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
14594
14655
|
testID = _ref.testID,
|
|
14595
14656
|
_ref$showSuffix = _ref.showSuffix,
|
|
14596
14657
|
showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix,
|
|
14597
|
-
TextInputComponent = _ref.TextInputComponent
|
|
14658
|
+
TextInputComponent = _ref.TextInputComponent,
|
|
14659
|
+
inputProps = _ref.inputProps,
|
|
14660
|
+
_ref$groupStyleEnable = _ref.groupStyleEnabled,
|
|
14661
|
+
groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
|
|
14598
14662
|
var _useState = React.useState(false),
|
|
14599
14663
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14600
14664
|
open = _useState2[0],
|
|
@@ -14603,15 +14667,19 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
14603
14667
|
var displayValue = value ? formatTime(displayFormat, value) : '';
|
|
14604
14668
|
var pickerInitValue = value || new Date();
|
|
14605
14669
|
var InputComponent = TextInputComponent || TextInput$2;
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14670
|
+
var onPress = React.useCallback(function () {
|
|
14671
|
+
setOpen(true);
|
|
14672
|
+
}, []);
|
|
14673
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
|
|
14674
|
+
onPress: onPress,
|
|
14675
|
+
disabled: disabled,
|
|
14676
|
+
themeGroupStyleEnabled: groupStyleEnabled,
|
|
14677
|
+
themeHasError: !!error,
|
|
14678
|
+
testID: "time-picker-android-touchable-opacity"
|
|
14611
14679
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
14612
14680
|
pointerEvents: "none",
|
|
14613
14681
|
testID: "timePickerInputAndroid"
|
|
14614
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
|
|
14682
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
|
|
14615
14683
|
label: label,
|
|
14616
14684
|
value: displayValue,
|
|
14617
14685
|
suffix: showSuffix ? 'clock-3' : undefined,
|
|
@@ -14622,7 +14690,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
14622
14690
|
helpText: helpText,
|
|
14623
14691
|
style: style,
|
|
14624
14692
|
testID: testID
|
|
14625
|
-
})), open ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
|
|
14693
|
+
}))), open ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
|
|
14626
14694
|
testID: "timePickerAndroid",
|
|
14627
14695
|
mode: "time",
|
|
14628
14696
|
value: pickerInitValue,
|
|
@@ -14637,14 +14705,6 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
|
|
|
14637
14705
|
}) : null);
|
|
14638
14706
|
};
|
|
14639
14707
|
|
|
14640
|
-
var StyledPickerWrapper = index$b(reactNative.View)(function (_ref) {
|
|
14641
|
-
var theme = _ref.theme;
|
|
14642
|
-
return {
|
|
14643
|
-
height: theme.__hd__.timePicker.sizes.height,
|
|
14644
|
-
alignItems: 'center'
|
|
14645
|
-
};
|
|
14646
|
-
});
|
|
14647
|
-
|
|
14648
14708
|
var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
14649
14709
|
var value = _ref.value,
|
|
14650
14710
|
label = _ref.label,
|
|
@@ -14664,7 +14724,10 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
14664
14724
|
showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix,
|
|
14665
14725
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
14666
14726
|
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
|
|
14667
|
-
TextInputComponent = _ref.TextInputComponent
|
|
14727
|
+
TextInputComponent = _ref.TextInputComponent,
|
|
14728
|
+
inputProps = _ref.inputProps,
|
|
14729
|
+
_ref$groupStyleEnable = _ref.groupStyleEnabled,
|
|
14730
|
+
groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
|
|
14668
14731
|
var _useState = React.useState(value || new Date()),
|
|
14669
14732
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14670
14733
|
selectingDate = _useState2[0],
|
|
@@ -14680,15 +14743,19 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
14680
14743
|
React.useEffect(function () {
|
|
14681
14744
|
setSelectingDate(value || new Date());
|
|
14682
14745
|
}, [value]);
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14746
|
+
var onPress = React.useCallback(function () {
|
|
14747
|
+
setOpen(true);
|
|
14748
|
+
}, []);
|
|
14749
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
|
|
14750
|
+
onPress: onPress,
|
|
14751
|
+
disabled: disabled,
|
|
14752
|
+
themeGroupStyleEnabled: groupStyleEnabled,
|
|
14753
|
+
themeHasError: !!error,
|
|
14754
|
+
testID: "time-picker-ios-touchable-opacity"
|
|
14688
14755
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
14689
14756
|
pointerEvents: "none",
|
|
14690
14757
|
testID: "timePickerInputIOS"
|
|
14691
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
|
|
14758
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
|
|
14692
14759
|
label: label,
|
|
14693
14760
|
value: displayValue,
|
|
14694
14761
|
suffix: showSuffix ? 'clock-3' : undefined,
|
|
@@ -14699,7 +14766,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
14699
14766
|
helpText: helpText,
|
|
14700
14767
|
testID: testID,
|
|
14701
14768
|
style: style
|
|
14702
|
-
})), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
14769
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
14703
14770
|
open: open,
|
|
14704
14771
|
onRequestClose: function onRequestClose() {
|
|
14705
14772
|
return setOpen(false);
|
|
@@ -66685,10 +66752,11 @@ var postMessage = function postMessage(element, message) {
|
|
|
66685
66752
|
};
|
|
66686
66753
|
|
|
66687
66754
|
var StyledWrapper = index$b(reactNative.View)(function (_ref) {
|
|
66688
|
-
var theme = _ref.theme
|
|
66689
|
-
|
|
66755
|
+
var theme = _ref.theme,
|
|
66756
|
+
groupStyleEnabled = _ref.groupStyleEnabled;
|
|
66757
|
+
return _objectSpread2({}, groupStyleEnabled ? {} : {
|
|
66690
66758
|
marginBottom: theme.__hd__.richTextEditor.space.wrapperMarginBottom
|
|
66691
|
-
};
|
|
66759
|
+
});
|
|
66692
66760
|
});
|
|
66693
66761
|
var StyledWebView = index$b(reactNativeWebview.WebView)(function (_ref2) {
|
|
66694
66762
|
var theme = _ref2.theme;
|
|
@@ -66900,17 +66968,22 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
66900
66968
|
error = _ref$error === void 0 ? '' : _ref$error,
|
|
66901
66969
|
_ref$style = _ref.style,
|
|
66902
66970
|
style = _ref$style === void 0 ? {} : _ref$style,
|
|
66971
|
+
textStyle = _ref.textStyle,
|
|
66903
66972
|
label = _ref.label,
|
|
66904
66973
|
helpText = _ref.helpText,
|
|
66905
66974
|
required = _ref.required,
|
|
66906
66975
|
testID = _ref.testID,
|
|
66907
66976
|
forwardedRef = _ref.forwardedRef,
|
|
66908
66977
|
_ref$value = _ref.value,
|
|
66909
|
-
value = _ref$value === void 0 ? defaultValue : _ref$value
|
|
66978
|
+
value = _ref$value === void 0 ? defaultValue : _ref$value,
|
|
66979
|
+
_ref$groupStyleEnable = _ref.groupStyleEnabled,
|
|
66980
|
+
groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
|
|
66910
66981
|
var plain = React.useMemo(function () {
|
|
66911
66982
|
return libExports.plainSerializer(value);
|
|
66912
66983
|
}, [value]);
|
|
66913
|
-
return /*#__PURE__*/React__namespace.default.createElement(StyledWrapper,
|
|
66984
|
+
return /*#__PURE__*/React__namespace.default.createElement(StyledWrapper, {
|
|
66985
|
+
groupStyleEnabled: groupStyleEnabled
|
|
66986
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InternalTextInput, {
|
|
66914
66987
|
autoFocus: autoFocus,
|
|
66915
66988
|
error: error,
|
|
66916
66989
|
label: label,
|
|
@@ -66919,7 +66992,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
66919
66992
|
placeholder: placeholder,
|
|
66920
66993
|
value: plain,
|
|
66921
66994
|
style: style,
|
|
66995
|
+
textStyle: textStyle,
|
|
66922
66996
|
helpText: helpText,
|
|
66997
|
+
groupStyleEnabled: groupStyleEnabled,
|
|
66923
66998
|
renderInputValue: function renderInputValue(inputProps, ref) {
|
|
66924
66999
|
return /*#__PURE__*/React__namespace.default.createElement(RichTextEditorInput, _extends$1({}, inputProps, {
|
|
66925
67000
|
ref: ref,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@emotion/native": "^11.9.3",
|
|
24
24
|
"@emotion/primitives-core": "11.0.0",
|
|
25
25
|
"@emotion/react": "^11.9.3",
|
|
26
|
-
"@hero-design/rn": "^8.103.
|
|
26
|
+
"@hero-design/rn": "^8.103.7",
|
|
27
27
|
"hero-editor": "^1.15.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -4,6 +4,17 @@ exports[`DatePicker renders correctly (snapshot) 1`] = `
|
|
|
4
4
|
<TouchableOpacity
|
|
5
5
|
disabled={false}
|
|
6
6
|
onPress={[Function]}
|
|
7
|
+
style={
|
|
8
|
+
[
|
|
9
|
+
[
|
|
10
|
+
{},
|
|
11
|
+
],
|
|
12
|
+
undefined,
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
testID="date-picker-ios-touchable-opacity"
|
|
16
|
+
themeGroupStyleEnabled={false}
|
|
17
|
+
themeHasError={false}
|
|
7
18
|
>
|
|
8
19
|
<View
|
|
9
20
|
pointerEvents="none"
|
|
@@ -643,6 +654,17 @@ exports[`Dialog renders DatePickerAndroid when OS is android 1`] = `
|
|
|
643
654
|
<TouchableOpacity
|
|
644
655
|
disabled={false}
|
|
645
656
|
onPress={[Function]}
|
|
657
|
+
style={
|
|
658
|
+
[
|
|
659
|
+
[
|
|
660
|
+
{},
|
|
661
|
+
],
|
|
662
|
+
undefined,
|
|
663
|
+
]
|
|
664
|
+
}
|
|
665
|
+
testID="date-picker-android-touchable-opacity"
|
|
666
|
+
themeGroupStyleEnabled={false}
|
|
667
|
+
themeHasError={false}
|
|
646
668
|
>
|
|
647
669
|
<View
|
|
648
670
|
pointerEvents="none"
|
|
@@ -966,6 +988,17 @@ exports[`Dialog renders DatePickerIOS when OS is iOS 1`] = `
|
|
|
966
988
|
<TouchableOpacity
|
|
967
989
|
disabled={false}
|
|
968
990
|
onPress={[Function]}
|
|
991
|
+
style={
|
|
992
|
+
[
|
|
993
|
+
[
|
|
994
|
+
{},
|
|
995
|
+
],
|
|
996
|
+
undefined,
|
|
997
|
+
]
|
|
998
|
+
}
|
|
999
|
+
testID="date-picker-ios-touchable-opacity"
|
|
1000
|
+
themeGroupStyleEnabled={false}
|
|
1001
|
+
themeHasError={false}
|
|
969
1002
|
>
|
|
970
1003
|
<View
|
|
971
1004
|
pointerEvents="none"
|
|
@@ -3,6 +3,9 @@ import { within } from '@testing-library/react-native';
|
|
|
3
3
|
import theme from '../../../theme';
|
|
4
4
|
import TextInput from '../../TextInput';
|
|
5
5
|
import Select from '../../Select';
|
|
6
|
+
import DatePicker from '../../DatePicker';
|
|
7
|
+
import TimePicker from '../../TimePicker';
|
|
8
|
+
import RichTextEditor from '../../RichTextEditor';
|
|
6
9
|
import FormGroup from '..';
|
|
7
10
|
import renderWithTheme from '../../../../testUtils/renderWithTheme';
|
|
8
11
|
import { noop } from '../../../utils/functions';
|
|
@@ -179,30 +182,63 @@ describe('FormGroup', () => {
|
|
|
179
182
|
expect(borderKeys).toHaveLength(0);
|
|
180
183
|
});
|
|
181
184
|
|
|
182
|
-
it('renders
|
|
185
|
+
it('renders all component types (TextInput, Select, Select.Multi, DatePicker, TimePicker, RichTextEditor) with correct styles', () => {
|
|
183
186
|
const { getByTestId } = renderWithTheme(
|
|
184
187
|
<FormGroup>
|
|
185
188
|
<TextInput
|
|
186
|
-
label="
|
|
187
|
-
value="
|
|
188
|
-
testID="
|
|
189
|
+
label="Text Input"
|
|
190
|
+
value="Text Input"
|
|
191
|
+
testID="mixed-text-input"
|
|
192
|
+
/>
|
|
193
|
+
<DatePicker
|
|
194
|
+
label="Date Picker"
|
|
195
|
+
value={new Date('1995-12-17T00:00:00.000Z')}
|
|
196
|
+
testID="mixed-date-picker"
|
|
197
|
+
onChange={noop}
|
|
198
|
+
confirmLabel="Confirm"
|
|
199
|
+
/>
|
|
200
|
+
<TimePicker
|
|
201
|
+
label="Time Picker"
|
|
202
|
+
value={new Date('December 17, 1995 03:24:00')}
|
|
203
|
+
testID="mixed-time-picker"
|
|
204
|
+
onChange={noop}
|
|
205
|
+
confirmLabel="Confirm"
|
|
206
|
+
/>
|
|
207
|
+
<RichTextEditor
|
|
208
|
+
label="Rich Text Editor"
|
|
209
|
+
value={[{ type: 'paragraph', children: [{ text: 'Content' }] }]}
|
|
210
|
+
onChange={noop}
|
|
211
|
+
name="mixed-rich-text-editor"
|
|
212
|
+
testID="mixed-rich-text-editor"
|
|
189
213
|
/>
|
|
190
214
|
<Select
|
|
191
|
-
label="
|
|
215
|
+
label="Single Select"
|
|
192
216
|
value="option1"
|
|
193
|
-
testID="
|
|
217
|
+
testID="mixed-select"
|
|
218
|
+
onConfirm={noop}
|
|
219
|
+
options={[
|
|
220
|
+
{ text: 'Option 1', value: 'option1' },
|
|
221
|
+
{ text: 'Option 2', value: 'option2' },
|
|
222
|
+
]}
|
|
223
|
+
/>
|
|
224
|
+
<Select.Multi
|
|
225
|
+
label="Multi Select"
|
|
226
|
+
value={['option1', 'option2']}
|
|
227
|
+
testID="mixed-select-multi"
|
|
194
228
|
onConfirm={noop}
|
|
229
|
+
footerLabel="Confirm"
|
|
195
230
|
options={[
|
|
196
231
|
{ text: 'Option 1', value: 'option1' },
|
|
197
232
|
{ text: 'Option 2', value: 'option2' },
|
|
233
|
+
{ text: 'Option 3', value: 'option3' },
|
|
198
234
|
]}
|
|
199
235
|
/>
|
|
200
236
|
</FormGroup>
|
|
201
237
|
);
|
|
202
238
|
|
|
203
|
-
//
|
|
239
|
+
// TextInput should have top border radius removed (first component)
|
|
204
240
|
expect(
|
|
205
|
-
within(getByTestId('
|
|
241
|
+
within(getByTestId('mixed-text-input'))
|
|
206
242
|
.getByTestId('text-input-border')
|
|
207
243
|
.props.style.flat()
|
|
208
244
|
).toEqual(
|
|
@@ -214,64 +250,41 @@ describe('FormGroup', () => {
|
|
|
214
250
|
])
|
|
215
251
|
);
|
|
216
252
|
|
|
217
|
-
//
|
|
253
|
+
// DatePicker should have no border radius (middle component)
|
|
218
254
|
expect(
|
|
219
|
-
within(getByTestId('
|
|
255
|
+
within(getByTestId('mixed-date-picker'))
|
|
220
256
|
.getByTestId('text-input-border')
|
|
221
257
|
.props.style.flat()
|
|
222
258
|
).toEqual(
|
|
223
259
|
expect.arrayContaining([
|
|
224
260
|
expect.objectContaining({
|
|
225
|
-
|
|
226
|
-
borderTopRightRadius: 0,
|
|
261
|
+
borderRadius: 0,
|
|
227
262
|
}),
|
|
228
263
|
])
|
|
229
264
|
);
|
|
230
|
-
});
|
|
231
265
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
testID="mixed-select"
|
|
244
|
-
onConfirm={noop}
|
|
245
|
-
options={[
|
|
246
|
-
{ text: 'Option 1', value: 'option1' },
|
|
247
|
-
{ text: 'Option 2', value: 'option2' },
|
|
248
|
-
]}
|
|
249
|
-
/>
|
|
250
|
-
<Select.Multi
|
|
251
|
-
label="Multi Select"
|
|
252
|
-
value={['option1', 'option2']}
|
|
253
|
-
testID="mixed-select-multi"
|
|
254
|
-
onConfirm={noop}
|
|
255
|
-
footerLabel="Confirm"
|
|
256
|
-
options={[
|
|
257
|
-
{ text: 'Option 1', value: 'option1' },
|
|
258
|
-
{ text: 'Option 2', value: 'option2' },
|
|
259
|
-
{ text: 'Option 3', value: 'option3' },
|
|
260
|
-
]}
|
|
261
|
-
/>
|
|
262
|
-
</FormGroup>
|
|
266
|
+
// TimePicker should have no border radius (middle component)
|
|
267
|
+
expect(
|
|
268
|
+
within(getByTestId('mixed-time-picker'))
|
|
269
|
+
.getByTestId('text-input-border')
|
|
270
|
+
.props.style.flat()
|
|
271
|
+
).toEqual(
|
|
272
|
+
expect.arrayContaining([
|
|
273
|
+
expect.objectContaining({
|
|
274
|
+
borderRadius: 0,
|
|
275
|
+
}),
|
|
276
|
+
])
|
|
263
277
|
);
|
|
264
278
|
|
|
265
|
-
//
|
|
279
|
+
// RichTextEditor should have no border radius (middle component)
|
|
266
280
|
expect(
|
|
267
|
-
within(getByTestId('mixed-text-
|
|
281
|
+
within(getByTestId('mixed-rich-text-editor'))
|
|
268
282
|
.getByTestId('text-input-border')
|
|
269
283
|
.props.style.flat()
|
|
270
284
|
).toEqual(
|
|
271
285
|
expect.arrayContaining([
|
|
272
286
|
expect.objectContaining({
|
|
273
|
-
|
|
274
|
-
borderBottomRightRadius: 0,
|
|
287
|
+
borderRadius: 0,
|
|
275
288
|
}),
|
|
276
289
|
])
|
|
277
290
|
);
|
|
@@ -289,7 +302,7 @@ describe('FormGroup', () => {
|
|
|
289
302
|
])
|
|
290
303
|
);
|
|
291
304
|
|
|
292
|
-
// Select.Multi should have bottom border radius removed
|
|
305
|
+
// Select.Multi should have bottom border radius removed (last component)
|
|
293
306
|
expect(
|
|
294
307
|
within(getByTestId('mixed-select-multi'))
|
|
295
308
|
.getByTestId('text-input-border')
|