@hero-design/rn-work-uikit 1.7.3 → 1.7.5-alpha.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 +18 -0
- package/lib/index.js +111 -36
- package/package.json +2 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +6 -6
- package/stats/1.7.3/rn-work-uikit-stats.html +0 -4844
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
+
## 1.7.5-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4123](https://github.com/Thinkei/hero-design/pull/4123) [`ecc5905dec81783858f57595a0af4306ff3b0b89`](https://github.com/Thinkei/hero-design/commit/ecc5905dec81783858f57595a0af4306ff3b0b89) Thanks [@truongnguyen-eh](https://github.com/truongnguyen-eh)! - [ANG-3740] Resolve conflict between alpha and master-react-18
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`e92d1dab57316441e7b5054debe823328e1a1083`](https://github.com/Thinkei/hero-design/commit/e92d1dab57316441e7b5054debe823328e1a1083), [`ecc5905dec81783858f57595a0af4306ff3b0b89`](https://github.com/Thinkei/hero-design/commit/ecc5905dec81783858f57595a0af4306ff3b0b89)]:
|
|
10
|
+
- @hero-design/rn@8.108.3-alpha.0
|
|
11
|
+
|
|
12
|
+
## 1.7.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#4216](https://github.com/Thinkei/hero-design/pull/4216) [`498d2b6f8d3eb3090e54346cb7f54a248256f848`](https://github.com/Thinkei/hero-design/commit/498d2b6f8d3eb3090e54346cb7f54a248256f848) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Slider] Update colors to match design
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`498d2b6f8d3eb3090e54346cb7f54a248256f848`](https://github.com/Thinkei/hero-design/commit/498d2b6f8d3eb3090e54346cb7f54a248256f848)]:
|
|
19
|
+
- @hero-design/rn@8.108.2
|
|
20
|
+
|
|
3
21
|
## 1.7.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/lib/index.js
CHANGED
|
@@ -673,16 +673,85 @@ function omit(keys, obj) {
|
|
|
673
673
|
return result;
|
|
674
674
|
}
|
|
675
675
|
function hexToRgba(hex, a) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
676
|
+
// Validate inputs
|
|
677
|
+
if (typeof hex !== 'string' || typeof a !== 'number') {
|
|
678
|
+
throw new Error('hexToRgba: hex must be a string and alpha must be a number');
|
|
679
|
+
}
|
|
680
|
+
if (a < 0 || a > 1) {
|
|
681
|
+
throw new Error('hexToRgba: alpha must be between 0 and 1');
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// Remove # if present and validate hex format
|
|
685
|
+
var cleanHex = hex.replace(/^#/, '');
|
|
686
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanHex)) {
|
|
687
|
+
throw new Error('hexToRgba: hex must be a valid 3 or 6 character hex color');
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// Handle 3-character hex codes (e.g., #fff -> #ffffff)
|
|
691
|
+
var normalizedHex = cleanHex.length === 3 ? cleanHex.split('').map(function (_char) {
|
|
692
|
+
return _char + _char;
|
|
693
|
+
}).join('') : cleanHex;
|
|
694
|
+
|
|
695
|
+
// Parse hex values
|
|
696
|
+
var r = parseInt(normalizedHex.substring(0, 2), 16);
|
|
697
|
+
var g = parseInt(normalizedHex.substring(2, 4), 16);
|
|
698
|
+
var b = parseInt(normalizedHex.substring(4, 6), 16);
|
|
684
699
|
return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
|
|
685
700
|
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Dim a hex color by blending it with a surface color
|
|
704
|
+
* @param hex - The hex color to dim (3 or 6 characters, with or without #)
|
|
705
|
+
* @param surface - The surface color to blend with.
|
|
706
|
+
* @param amount - The amount of dimming (0 = original color, 1 = fully surface color)
|
|
707
|
+
* @returns The dimmed hex color
|
|
708
|
+
*/
|
|
709
|
+
var DEFAULT_DIM_AMOUNT = 0.6;
|
|
710
|
+
function dimHex(hex, surface) {
|
|
711
|
+
var amount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_DIM_AMOUNT;
|
|
712
|
+
// Validate inputs
|
|
713
|
+
if (typeof hex !== 'string' || typeof surface !== 'string' || typeof amount !== 'number') {
|
|
714
|
+
throw new Error('dimHex: hex and surface must be strings and amount must be a number');
|
|
715
|
+
}
|
|
716
|
+
if (amount < 0 || amount > 1) {
|
|
717
|
+
throw new Error('dimHex: amount must be between 0 and 1');
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// Remove # if present and validate hex format
|
|
721
|
+
var cleanHex = hex.replace(/^#/, '');
|
|
722
|
+
var cleanSurface = surface.replace(/^#/, '');
|
|
723
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanHex)) {
|
|
724
|
+
throw new Error('dimHex: hex must be a valid 3 or 6 character hex color');
|
|
725
|
+
}
|
|
726
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanSurface)) {
|
|
727
|
+
throw new Error('dimHex: surface must be a valid 3 or 6 character hex color');
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Handle 3-character hex codes (e.g., #fff -> #ffffff)
|
|
731
|
+
var normalizedHex = cleanHex.length === 3 ? cleanHex.split('').map(function (_char2) {
|
|
732
|
+
return _char2 + _char2;
|
|
733
|
+
}).join('') : cleanHex;
|
|
734
|
+
var normalizedSurface = cleanSurface.length === 3 ? cleanSurface.split('').map(function (_char3) {
|
|
735
|
+
return _char3 + _char3;
|
|
736
|
+
}).join('') : cleanSurface;
|
|
737
|
+
|
|
738
|
+
// Parse hex values
|
|
739
|
+
var r = parseInt(normalizedHex.substring(0, 2), 16);
|
|
740
|
+
var g = parseInt(normalizedHex.substring(2, 4), 16);
|
|
741
|
+
var b = parseInt(normalizedHex.substring(4, 6), 16);
|
|
742
|
+
var sr = parseInt(normalizedSurface.substring(0, 2), 16);
|
|
743
|
+
var sg = parseInt(normalizedSurface.substring(2, 4), 16);
|
|
744
|
+
var sb = parseInt(normalizedSurface.substring(4, 6), 16);
|
|
745
|
+
|
|
746
|
+
// Linear interpolation between colors
|
|
747
|
+
var lerp = function lerp(c, s) {
|
|
748
|
+
return Math.round(c * (1 - amount) + s * amount);
|
|
749
|
+
};
|
|
750
|
+
var rr = lerp(r, sr).toString(16).padStart(2, '0');
|
|
751
|
+
var gg = lerp(g, sg).toString(16).padStart(2, '0');
|
|
752
|
+
var bb = lerp(b, sb).toString(16).padStart(2, '0');
|
|
753
|
+
return "#".concat(rr).concat(gg).concat(bb);
|
|
754
|
+
}
|
|
686
755
|
var _deepCompareValue = function deepCompareValue(a, b) {
|
|
687
756
|
// Handle strict equality first (handles primitives, null, undefined)
|
|
688
757
|
if (a === b) return true;
|
|
@@ -750,8 +819,8 @@ var useKeyboard = function useKeyboard() {
|
|
|
750
819
|
};
|
|
751
820
|
};
|
|
752
821
|
var transformKebabCaseToCamelCase = function transformKebabCaseToCamelCase(string) {
|
|
753
|
-
return string.replace(/-([a-z0-9])/g, function (_,
|
|
754
|
-
return /[a-z]/.test(
|
|
822
|
+
return string.replace(/-([a-z0-9])/g, function (_, _char4) {
|
|
823
|
+
return /[a-z]/.test(_char4) ? _char4.toUpperCase() : _char4;
|
|
755
824
|
});
|
|
756
825
|
};
|
|
757
826
|
|
|
@@ -6945,14 +7014,21 @@ var getSkeletonTheme = function getSkeletonTheme(theme) {
|
|
|
6945
7014
|
};
|
|
6946
7015
|
};
|
|
6947
7016
|
|
|
7017
|
+
var DISABLED_UNSELECTED_TRACK_OPACITY = 0.1;
|
|
7018
|
+
var DISABLED_SELECTED_TRACK_OPACITY = 1;
|
|
7019
|
+
var UNSELECTED_TRACK_OPACITY = 0.1;
|
|
7020
|
+
|
|
6948
7021
|
var getSliderTheme = function getSliderTheme(theme) {
|
|
6949
7022
|
var colors = {
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
7023
|
+
// Unselected track colors
|
|
7024
|
+
unselectedTrack: hexToRgba(theme.colors.overlayGlobalSurface, UNSELECTED_TRACK_OPACITY),
|
|
7025
|
+
disabledUnselectedTrack: dimHex(theme.colors.overlayGlobalSurface, theme.colors.defaultGlobalSurface),
|
|
7026
|
+
// Selected track colors
|
|
7027
|
+
selectedTrack: theme.colors.primary,
|
|
7028
|
+
disabledSelectedTrack: dimHex(theme.colors.primary, theme.colors.defaultGlobalSurface),
|
|
7029
|
+
// Thumb/marker colors
|
|
7030
|
+
thumb: theme.colors.primary,
|
|
7031
|
+
disabledThumb: dimHex(theme.colors.primary, theme.colors.defaultGlobalSurface)
|
|
6956
7032
|
};
|
|
6957
7033
|
var shadows = {
|
|
6958
7034
|
marker: theme.shadows["default"]
|
|
@@ -24897,7 +24973,6 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24897
24973
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
24898
24974
|
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
24899
24975
|
useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
|
|
24900
|
-
var theme = useTheme();
|
|
24901
24976
|
var fabRef = React.useRef(null);
|
|
24902
24977
|
var animatedValue = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
|
|
24903
24978
|
React__namespace.default.useImperativeHandle(ref, function () {
|
|
@@ -24976,13 +25051,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24976
25051
|
index: active ? index : items.length - index,
|
|
24977
25052
|
active: active
|
|
24978
25053
|
}));
|
|
24979
|
-
}))), active && /*#__PURE__*/React__namespace.default.createElement(StyledFAB$1
|
|
24980
|
-
// This FAB is moved up a bit compared to the original FAB,
|
|
24981
|
-
// set marginBottom to negative value to compensate for it
|
|
24982
|
-
, {
|
|
24983
|
-
style: {
|
|
24984
|
-
marginBottom: -theme.space.xxsmall
|
|
24985
|
-
},
|
|
25054
|
+
}))), active && /*#__PURE__*/React__namespace.default.createElement(StyledFAB$1, {
|
|
24986
25055
|
key: "fab-in-portal",
|
|
24987
25056
|
testID: "fab-in-portal",
|
|
24988
25057
|
icon: fabIcon,
|
|
@@ -26348,6 +26417,10 @@ var Slider$2 = function Slider(_ref) {
|
|
|
26348
26417
|
style = _ref.style,
|
|
26349
26418
|
testID = _ref.testID;
|
|
26350
26419
|
var theme = useTheme();
|
|
26420
|
+
var _theme$__hd__$slider$ = theme.__hd__.slider.colors,
|
|
26421
|
+
selectedTrack = _theme$__hd__$slider$.selectedTrack,
|
|
26422
|
+
thumb = _theme$__hd__$slider$.thumb,
|
|
26423
|
+
unselectedTrack = _theme$__hd__$slider$.unselectedTrack;
|
|
26351
26424
|
return /*#__PURE__*/React__namespace.default.createElement(RnSlider__default.default, {
|
|
26352
26425
|
minimumValue: minimumValue,
|
|
26353
26426
|
maximumValue: maximumValue,
|
|
@@ -26357,9 +26430,9 @@ var Slider$2 = function Slider(_ref) {
|
|
|
26357
26430
|
onSlidingStart: onSlidingStart,
|
|
26358
26431
|
onSlidingComplete: onSlidingComplete,
|
|
26359
26432
|
disabled: disabled,
|
|
26360
|
-
minimumTrackTintColor:
|
|
26361
|
-
thumbTintColor:
|
|
26362
|
-
maximumTrackTintColor:
|
|
26433
|
+
minimumTrackTintColor: selectedTrack,
|
|
26434
|
+
thumbTintColor: thumb,
|
|
26435
|
+
maximumTrackTintColor: unselectedTrack,
|
|
26363
26436
|
style: style,
|
|
26364
26437
|
testID: testID
|
|
26365
26438
|
});
|
|
@@ -26372,7 +26445,7 @@ var StyledMarker = index$c(reactNative.View)(function (_ref) {
|
|
|
26372
26445
|
height: theme.__hd__.slider.sizes.markerHeight,
|
|
26373
26446
|
width: theme.__hd__.slider.sizes.markerWidth,
|
|
26374
26447
|
borderRadius: theme.__hd__.slider.radii.marker,
|
|
26375
|
-
backgroundColor: themeDisabled ? theme.__hd__.slider.colors.
|
|
26448
|
+
backgroundColor: themeDisabled ? theme.__hd__.slider.colors.disabledThumb : theme.__hd__.slider.colors.thumb
|
|
26376
26449
|
}, theme.__hd__.slider.shadows.marker);
|
|
26377
26450
|
});
|
|
26378
26451
|
|
|
@@ -26412,29 +26485,31 @@ var Slider$1 = function Slider(_ref) {
|
|
|
26412
26485
|
return [(_value$start = value === null || value === void 0 ? void 0 : value.start) !== null && _value$start !== void 0 ? _value$start : minimumValue, (_value$end = value === null || value === void 0 ? void 0 : value.end) !== null && _value$end !== void 0 ? _value$end : maximumValue];
|
|
26413
26486
|
}, [value === null || value === void 0 ? void 0 : value.start, value === null || value === void 0 ? void 0 : value.end, minimumValue, maximumValue]);
|
|
26414
26487
|
var _theme$__hd__$slider$ = theme.__hd__.slider.colors,
|
|
26415
|
-
|
|
26416
|
-
|
|
26417
|
-
|
|
26418
|
-
|
|
26488
|
+
unselectedTrack = _theme$__hd__$slider$.unselectedTrack,
|
|
26489
|
+
disabledUnselectedTrack = _theme$__hd__$slider$.disabledUnselectedTrack,
|
|
26490
|
+
selectedTrack = _theme$__hd__$slider$.selectedTrack,
|
|
26491
|
+
disabledSelectedTrack = _theme$__hd__$slider$.disabledSelectedTrack;
|
|
26419
26492
|
var trackHeight = theme.__hd__.slider.sizes.trackHeight;
|
|
26420
26493
|
|
|
26421
26494
|
// Define styles for disabled and enabled states
|
|
26422
26495
|
var disabledStyles = {
|
|
26423
26496
|
track: {
|
|
26424
|
-
|
|
26497
|
+
opacity: DISABLED_UNSELECTED_TRACK_OPACITY,
|
|
26498
|
+
backgroundColor: disabledUnselectedTrack,
|
|
26425
26499
|
height: trackHeight
|
|
26426
26500
|
},
|
|
26427
26501
|
selected: {
|
|
26428
|
-
|
|
26502
|
+
opacity: DISABLED_SELECTED_TRACK_OPACITY,
|
|
26503
|
+
backgroundColor: disabledSelectedTrack
|
|
26429
26504
|
}
|
|
26430
26505
|
};
|
|
26431
26506
|
var enabledStyles = {
|
|
26432
26507
|
track: {
|
|
26433
|
-
backgroundColor:
|
|
26508
|
+
backgroundColor: unselectedTrack,
|
|
26434
26509
|
height: trackHeight
|
|
26435
26510
|
},
|
|
26436
26511
|
selected: {
|
|
26437
|
-
backgroundColor:
|
|
26512
|
+
backgroundColor: selectedTrack
|
|
26438
26513
|
}
|
|
26439
26514
|
};
|
|
26440
26515
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5-alpha.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.108.0",
|
|
26
|
+
"@hero-design/rn": "^8.108.3-alpha.0",
|
|
27
27
|
"hero-editor": "^1.16.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -1281,12 +1281,12 @@ exports[`theme returns correct theme object 1`] = `
|
|
|
1281
1281
|
},
|
|
1282
1282
|
"slider": {
|
|
1283
1283
|
"colors": {
|
|
1284
|
-
"
|
|
1285
|
-
"
|
|
1286
|
-
"
|
|
1287
|
-
"
|
|
1288
|
-
"
|
|
1289
|
-
"
|
|
1284
|
+
"disabledSelectedTrack": "#b3a3bf",
|
|
1285
|
+
"disabledThumb": "#b3a3bf",
|
|
1286
|
+
"disabledUnselectedTrack": "#999999",
|
|
1287
|
+
"selectedTrack": "#401960",
|
|
1288
|
+
"thumb": "#401960",
|
|
1289
|
+
"unselectedTrack": "rgba(0,0,0,0.1)",
|
|
1290
1290
|
},
|
|
1291
1291
|
"radii": {
|
|
1292
1292
|
"marker": 999,
|