@hero-design/rn 8.108.0 → 8.108.2

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/lib/index.js CHANGED
@@ -6710,14 +6710,174 @@ var getSkeletonTheme = function getSkeletonTheme(theme) {
6710
6710
  };
6711
6711
  };
6712
6712
 
6713
+ var DISABLED_UNSELECTED_TRACK_OPACITY = 0.1;
6714
+ var DISABLED_SELECTED_TRACK_OPACITY = 1;
6715
+ var UNSELECTED_TRACK_OPACITY = 0.1;
6716
+
6717
+ var isIOS = reactNative.Platform.OS === 'ios';
6718
+ var isAndroid = reactNative.Platform.OS === 'android';
6719
+ function pick(keys, obj) {
6720
+ return keys.filter(function (key) {
6721
+ return key in obj;
6722
+ }).reduce(function (result, cur) {
6723
+ return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
6724
+ }, {});
6725
+ }
6726
+ function omit(keys, obj) {
6727
+ var result = obj;
6728
+ keys.forEach(function (key) {
6729
+ delete result[key];
6730
+ });
6731
+ return result;
6732
+ }
6733
+ function hexToRgba(hex, a) {
6734
+ // Validate inputs
6735
+ if (typeof hex !== 'string' || typeof a !== 'number') {
6736
+ throw new Error('hexToRgba: hex must be a string and alpha must be a number');
6737
+ }
6738
+ if (a < 0 || a > 1) {
6739
+ throw new Error('hexToRgba: alpha must be between 0 and 1');
6740
+ }
6741
+ // Remove # if present and validate hex format
6742
+ var cleanHex = hex.replace(/^#/, '');
6743
+ if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanHex)) {
6744
+ throw new Error('hexToRgba: hex must be a valid 3 or 6 character hex color');
6745
+ }
6746
+ // Handle 3-character hex codes (e.g., #fff -> #ffffff)
6747
+ var normalizedHex = cleanHex.length === 3 ? cleanHex.split('').map(function (_char) {
6748
+ return _char + _char;
6749
+ }).join('') : cleanHex;
6750
+ // Parse hex values
6751
+ var r = parseInt(normalizedHex.substring(0, 2), 16);
6752
+ var g = parseInt(normalizedHex.substring(2, 4), 16);
6753
+ var b = parseInt(normalizedHex.substring(4, 6), 16);
6754
+ return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
6755
+ }
6756
+ /**
6757
+ * Dim a hex color by blending it with a surface color
6758
+ * @param hex - The hex color to dim (3 or 6 characters, with or without #)
6759
+ * @param surface - The surface color to blend with.
6760
+ * @param amount - The amount of dimming (0 = original color, 1 = fully surface color)
6761
+ * @returns The dimmed hex color
6762
+ */
6763
+ var DEFAULT_DIM_AMOUNT = 0.6;
6764
+ function dimHex(hex, surface) {
6765
+ var amount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_DIM_AMOUNT;
6766
+ // Validate inputs
6767
+ if (typeof hex !== 'string' || typeof surface !== 'string' || typeof amount !== 'number') {
6768
+ throw new Error('dimHex: hex and surface must be strings and amount must be a number');
6769
+ }
6770
+ if (amount < 0 || amount > 1) {
6771
+ throw new Error('dimHex: amount must be between 0 and 1');
6772
+ }
6773
+ // Remove # if present and validate hex format
6774
+ var cleanHex = hex.replace(/^#/, '');
6775
+ var cleanSurface = surface.replace(/^#/, '');
6776
+ if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanHex)) {
6777
+ throw new Error('dimHex: hex must be a valid 3 or 6 character hex color');
6778
+ }
6779
+ if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanSurface)) {
6780
+ throw new Error('dimHex: surface must be a valid 3 or 6 character hex color');
6781
+ }
6782
+ // Handle 3-character hex codes (e.g., #fff -> #ffffff)
6783
+ var normalizedHex = cleanHex.length === 3 ? cleanHex.split('').map(function (_char2) {
6784
+ return _char2 + _char2;
6785
+ }).join('') : cleanHex;
6786
+ var normalizedSurface = cleanSurface.length === 3 ? cleanSurface.split('').map(function (_char3) {
6787
+ return _char3 + _char3;
6788
+ }).join('') : cleanSurface;
6789
+ // Parse hex values
6790
+ var r = parseInt(normalizedHex.substring(0, 2), 16);
6791
+ var g = parseInt(normalizedHex.substring(2, 4), 16);
6792
+ var b = parseInt(normalizedHex.substring(4, 6), 16);
6793
+ var sr = parseInt(normalizedSurface.substring(0, 2), 16);
6794
+ var sg = parseInt(normalizedSurface.substring(2, 4), 16);
6795
+ var sb = parseInt(normalizedSurface.substring(4, 6), 16);
6796
+ // Linear interpolation between colors
6797
+ var lerp = function lerp(c, s) {
6798
+ return Math.round(c * (1 - amount) + s * amount);
6799
+ };
6800
+ var rr = lerp(r, sr).toString(16).padStart(2, '0');
6801
+ var gg = lerp(g, sg).toString(16).padStart(2, '0');
6802
+ var bb = lerp(b, sb).toString(16).padStart(2, '0');
6803
+ return "#".concat(rr).concat(gg).concat(bb);
6804
+ }
6805
+ var _deepCompareValue = function deepCompareValue(a, b) {
6806
+ // Handle strict equality first (handles primitives, null, undefined)
6807
+ if (a === b) return true;
6808
+ // Special handling for NaN (NaN !== NaN in JS)
6809
+ if (typeof a === 'number' && typeof b === 'number' && Number.isNaN(a) && Number.isNaN(b)) {
6810
+ return false;
6811
+ }
6812
+ // If either is null or undefined (but they are not strictly equal), return false
6813
+ if (a == null || b == null) return false;
6814
+ // If types don't match, they can't be equal
6815
+ if (_typeof$1(a) !== _typeof$1(b)) return false;
6816
+ // Handle array comparison
6817
+ if (Array.isArray(a) && Array.isArray(b)) {
6818
+ if (a.length !== b.length) return false;
6819
+ return a.every(function (val, index) {
6820
+ return _deepCompareValue(val, b[index]);
6821
+ });
6822
+ }
6823
+ // If one is array and the other isn't, return false
6824
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
6825
+ // Handle object comparison
6826
+ if (_typeof$1(a) === 'object' && _typeof$1(b) === 'object') {
6827
+ var keysA = Object.keys(a);
6828
+ var keysB = Object.keys(b);
6829
+ if (keysA.length !== keysB.length) return false;
6830
+ return keysA.every(function (key) {
6831
+ return keysB.includes(key) && _deepCompareValue(a[key], b[key]);
6832
+ });
6833
+ }
6834
+ // If none of the above conditions matched, they're not equal
6835
+ return false;
6836
+ };
6837
+ var useKeyboard = function useKeyboard() {
6838
+ var _useState = React.useState(false),
6839
+ _useState2 = _slicedToArray(_useState, 2),
6840
+ isKeyboardVisible = _useState2[0],
6841
+ setKeyboardVisible = _useState2[1];
6842
+ var _useState3 = React.useState(0),
6843
+ _useState4 = _slicedToArray(_useState3, 2),
6844
+ keyboardHeight = _useState4[0],
6845
+ setKeyboardHeight = _useState4[1];
6846
+ React.useEffect(function () {
6847
+ var keyboardWillShowListener = reactNative.Keyboard.addListener('keyboardWillShow', function (e) {
6848
+ setKeyboardVisible(true);
6849
+ setKeyboardHeight(e.endCoordinates.height);
6850
+ });
6851
+ var keyboardWillHideListener = reactNative.Keyboard.addListener('keyboardWillHide', function () {
6852
+ setKeyboardVisible(false);
6853
+ });
6854
+ return function () {
6855
+ keyboardWillShowListener.remove();
6856
+ keyboardWillHideListener.remove();
6857
+ };
6858
+ }, []);
6859
+ return {
6860
+ isKeyboardVisible: isKeyboardVisible,
6861
+ keyboardHeight: keyboardHeight
6862
+ };
6863
+ };
6864
+ var transformKebabCaseToCamelCase = function transformKebabCaseToCamelCase(string) {
6865
+ return string.replace(/-([a-z0-9])/g, function (_, _char4) {
6866
+ return /[a-z]/.test(_char4) ? _char4.toUpperCase() : _char4;
6867
+ });
6868
+ };
6869
+
6713
6870
  var getSliderTheme = function getSliderTheme(theme) {
6714
6871
  var colors = {
6715
- minimumTrackTint: theme.colors.primary,
6716
- thumbTint: theme.colors.primary,
6717
- maximumTrackTint: theme.colors.highlightedSurface,
6718
- trackBackground: theme.colors.highlightedSurface,
6719
- disabledThumbTint: theme.colors.disabledOnDefaultGlobalSurface,
6720
- disabledTrackBackground: theme.colors.neutralGlobalSurface
6872
+ // Unselected track colors
6873
+ unselectedTrack: hexToRgba(theme.colors.overlayGlobalSurface, UNSELECTED_TRACK_OPACITY),
6874
+ disabledUnselectedTrack: dimHex(theme.colors.overlayGlobalSurface, theme.colors.defaultGlobalSurface),
6875
+ // Selected track colors
6876
+ selectedTrack: theme.colors.primary,
6877
+ disabledSelectedTrack: dimHex(theme.colors.primary, theme.colors.defaultGlobalSurface),
6878
+ // Thumb/marker colors
6879
+ thumb: theme.colors.primary,
6880
+ disabledThumb: dimHex(theme.colors.primary, theme.colors.defaultGlobalSurface)
6721
6881
  };
6722
6882
  var shadows = {
6723
6883
  marker: theme.shadows["default"]
@@ -9442,98 +9602,6 @@ var Avatar = function Avatar(_ref) {
9442
9602
  }));
9443
9603
  };
9444
9604
 
9445
- var isIOS = reactNative.Platform.OS === 'ios';
9446
- var isAndroid = reactNative.Platform.OS === 'android';
9447
- function pick(keys, obj) {
9448
- return keys.filter(function (key) {
9449
- return key in obj;
9450
- }).reduce(function (result, cur) {
9451
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
9452
- }, {});
9453
- }
9454
- function omit(keys, obj) {
9455
- var result = obj;
9456
- keys.forEach(function (key) {
9457
- delete result[key];
9458
- });
9459
- return result;
9460
- }
9461
- function hexToRgba(hex, a) {
9462
- var arrBuff = new ArrayBuffer(4);
9463
- var vw = new DataView(arrBuff);
9464
- vw.setUint32(0, parseInt(hex, 16), false);
9465
- var arrByte = new Uint8Array(arrBuff);
9466
- var _arrByte = _slicedToArray(arrByte, 3),
9467
- r = _arrByte[0],
9468
- g = _arrByte[1],
9469
- b = _arrByte[2];
9470
- return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
9471
- }
9472
- var _deepCompareValue = function deepCompareValue(a, b) {
9473
- // Handle strict equality first (handles primitives, null, undefined)
9474
- if (a === b) return true;
9475
- // Special handling for NaN (NaN !== NaN in JS)
9476
- if (typeof a === 'number' && typeof b === 'number' && Number.isNaN(a) && Number.isNaN(b)) {
9477
- return false;
9478
- }
9479
- // If either is null or undefined (but they are not strictly equal), return false
9480
- if (a == null || b == null) return false;
9481
- // If types don't match, they can't be equal
9482
- if (_typeof$1(a) !== _typeof$1(b)) return false;
9483
- // Handle array comparison
9484
- if (Array.isArray(a) && Array.isArray(b)) {
9485
- if (a.length !== b.length) return false;
9486
- return a.every(function (val, index) {
9487
- return _deepCompareValue(val, b[index]);
9488
- });
9489
- }
9490
- // If one is array and the other isn't, return false
9491
- if (Array.isArray(a) !== Array.isArray(b)) return false;
9492
- // Handle object comparison
9493
- if (_typeof$1(a) === 'object' && _typeof$1(b) === 'object') {
9494
- var keysA = Object.keys(a);
9495
- var keysB = Object.keys(b);
9496
- if (keysA.length !== keysB.length) return false;
9497
- return keysA.every(function (key) {
9498
- return keysB.includes(key) && _deepCompareValue(a[key], b[key]);
9499
- });
9500
- }
9501
- // If none of the above conditions matched, they're not equal
9502
- return false;
9503
- };
9504
- var useKeyboard = function useKeyboard() {
9505
- var _useState = React.useState(false),
9506
- _useState2 = _slicedToArray(_useState, 2),
9507
- isKeyboardVisible = _useState2[0],
9508
- setKeyboardVisible = _useState2[1];
9509
- var _useState3 = React.useState(0),
9510
- _useState4 = _slicedToArray(_useState3, 2),
9511
- keyboardHeight = _useState4[0],
9512
- setKeyboardHeight = _useState4[1];
9513
- React.useEffect(function () {
9514
- var keyboardWillShowListener = reactNative.Keyboard.addListener('keyboardWillShow', function (e) {
9515
- setKeyboardVisible(true);
9516
- setKeyboardHeight(e.endCoordinates.height);
9517
- });
9518
- var keyboardWillHideListener = reactNative.Keyboard.addListener('keyboardWillHide', function () {
9519
- setKeyboardVisible(false);
9520
- });
9521
- return function () {
9522
- keyboardWillShowListener.remove();
9523
- keyboardWillHideListener.remove();
9524
- };
9525
- }, []);
9526
- return {
9527
- isKeyboardVisible: isKeyboardVisible,
9528
- keyboardHeight: keyboardHeight
9529
- };
9530
- };
9531
- var transformKebabCaseToCamelCase = function transformKebabCaseToCamelCase(string) {
9532
- return string.replace(/-([a-z0-9])/g, function (_, _char) {
9533
- return /[a-z]/.test(_char) ? _char.toUpperCase() : _char;
9534
- });
9535
- };
9536
-
9537
9605
  var colors = {
9538
9606
  backgroundColor: {
9539
9607
  property: 'backgroundColor',
@@ -23864,7 +23932,6 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
23864
23932
  _ref$supportedOrienta = _ref.supportedOrientations,
23865
23933
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
23866
23934
  useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
23867
- var theme = useTheme();
23868
23935
  var fabRef = React.useRef(null);
23869
23936
  var animatedValue = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
23870
23937
  React__namespace.default.useImperativeHandle(ref, function () {
@@ -23943,13 +24010,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
23943
24010
  index: active ? index : items.length - index,
23944
24011
  active: active
23945
24012
  }));
23946
- }))), active && /*#__PURE__*/React__namespace.default.createElement(StyledFAB$1
23947
- // This FAB is moved up a bit compared to the original FAB,
23948
- // set marginBottom to negative value to compensate for it
23949
- , {
23950
- style: {
23951
- marginBottom: -theme.space.xxsmall
23952
- },
24013
+ }))), active && /*#__PURE__*/React__namespace.default.createElement(StyledFAB$1, {
23953
24014
  key: "fab-in-portal",
23954
24015
  testID: "fab-in-portal",
23955
24016
  icon: fabIcon,
@@ -25312,6 +25373,10 @@ var Slider$2 = function Slider(_ref) {
25312
25373
  style = _ref.style,
25313
25374
  testID = _ref.testID;
25314
25375
  var theme = useTheme();
25376
+ var _theme$__hd__$slider$ = theme.__hd__.slider.colors,
25377
+ selectedTrack = _theme$__hd__$slider$.selectedTrack,
25378
+ thumb = _theme$__hd__$slider$.thumb,
25379
+ unselectedTrack = _theme$__hd__$slider$.unselectedTrack;
25315
25380
  return /*#__PURE__*/React__namespace.default.createElement(RnSlider__default.default, {
25316
25381
  minimumValue: minimumValue,
25317
25382
  maximumValue: maximumValue,
@@ -25321,9 +25386,9 @@ var Slider$2 = function Slider(_ref) {
25321
25386
  onSlidingStart: onSlidingStart,
25322
25387
  onSlidingComplete: onSlidingComplete,
25323
25388
  disabled: disabled,
25324
- minimumTrackTintColor: theme.__hd__.slider.colors.minimumTrackTint,
25325
- thumbTintColor: theme.__hd__.slider.colors.thumbTint,
25326
- maximumTrackTintColor: theme.__hd__.slider.colors.maximumTrackTint,
25389
+ minimumTrackTintColor: selectedTrack,
25390
+ thumbTintColor: thumb,
25391
+ maximumTrackTintColor: unselectedTrack,
25327
25392
  style: style,
25328
25393
  testID: testID
25329
25394
  });
@@ -25336,7 +25401,7 @@ var StyledMarker = index$c(reactNative.View)(function (_ref) {
25336
25401
  height: theme.__hd__.slider.sizes.markerHeight,
25337
25402
  width: theme.__hd__.slider.sizes.markerWidth,
25338
25403
  borderRadius: theme.__hd__.slider.radii.marker,
25339
- backgroundColor: themeDisabled ? theme.__hd__.slider.colors.disabledThumbTint : theme.__hd__.slider.colors.thumbTint
25404
+ backgroundColor: themeDisabled ? theme.__hd__.slider.colors.disabledThumb : theme.__hd__.slider.colors.thumb
25340
25405
  }, theme.__hd__.slider.shadows.marker);
25341
25406
  });
25342
25407
 
@@ -25376,28 +25441,30 @@ var Slider$1 = function Slider(_ref) {
25376
25441
  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];
25377
25442
  }, [value === null || value === void 0 ? void 0 : value.start, value === null || value === void 0 ? void 0 : value.end, minimumValue, maximumValue]);
25378
25443
  var _theme$__hd__$slider$ = theme.__hd__.slider.colors,
25379
- trackBackground = _theme$__hd__$slider$.trackBackground,
25380
- disabledTrackBackground = _theme$__hd__$slider$.disabledTrackBackground,
25381
- thumbTint = _theme$__hd__$slider$.thumbTint,
25382
- disabledThumbTint = _theme$__hd__$slider$.disabledThumbTint;
25444
+ unselectedTrack = _theme$__hd__$slider$.unselectedTrack,
25445
+ disabledUnselectedTrack = _theme$__hd__$slider$.disabledUnselectedTrack,
25446
+ selectedTrack = _theme$__hd__$slider$.selectedTrack,
25447
+ disabledSelectedTrack = _theme$__hd__$slider$.disabledSelectedTrack;
25383
25448
  var trackHeight = theme.__hd__.slider.sizes.trackHeight;
25384
25449
  // Define styles for disabled and enabled states
25385
25450
  var disabledStyles = {
25386
25451
  track: {
25387
- backgroundColor: disabledTrackBackground,
25452
+ opacity: DISABLED_UNSELECTED_TRACK_OPACITY,
25453
+ backgroundColor: disabledUnselectedTrack,
25388
25454
  height: trackHeight
25389
25455
  },
25390
25456
  selected: {
25391
- backgroundColor: disabledThumbTint
25457
+ opacity: DISABLED_SELECTED_TRACK_OPACITY,
25458
+ backgroundColor: disabledSelectedTrack
25392
25459
  }
25393
25460
  };
25394
25461
  var enabledStyles = {
25395
25462
  track: {
25396
- backgroundColor: trackBackground,
25463
+ backgroundColor: unselectedTrack,
25397
25464
  height: trackHeight
25398
25465
  },
25399
25466
  selected: {
25400
- backgroundColor: thumbTint
25467
+ backgroundColor: selectedTrack
25401
25468
  }
25402
25469
  };
25403
25470
  // Use styles based on the `disabled` state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.108.0",
3
+ "version": "8.108.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1080,7 +1080,6 @@ exports[`ActionGroup has active true 1`] = `
1080
1080
  "flexDirection": "row",
1081
1081
  "height": 64,
1082
1082
  "justifyContent": "center",
1083
- "marginBottom": -2,
1084
1083
  "marginRight": 24,
1085
1084
  "marginTop": 24,
1086
1085
  "opacity": 1,
@@ -1,7 +1,11 @@
1
1
  import React, { forwardRef, useRef } from 'react';
2
2
  import type { StyleProp, ViewStyle } from 'react-native';
3
- import { Animated, Platform, Modal } from 'react-native';
3
+ import { Animated, Modal, Platform } from 'react-native';
4
+ import { useDeprecation } from '../../../utils/hooks';
5
+ import Box from '../../Box';
4
6
  import type { IconName } from '../../Icon';
7
+ import Portal from '../../Portal';
8
+ import type { FABHandles } from '../FAB';
5
9
  import type { ActionItemProps } from './ActionItem';
6
10
  import ActionItem from './ActionItem';
7
11
  import {
@@ -12,11 +16,6 @@ import {
12
16
  StyledContainerInModal,
13
17
  StyledFAB,
14
18
  } from './StyledActionGroup';
15
- import Portal from '../../Portal';
16
- import Box from '../../Box';
17
- import type { FABHandles } from '../FAB';
18
- import { useDeprecation } from '../../../utils/hooks';
19
- import { useTheme } from '../../../theme';
20
19
 
21
20
  export type ActionGroupHandles = {
22
21
  showFAB: () => void;
@@ -96,7 +95,6 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
96
95
  headerTitle !== undefined
97
96
  );
98
97
 
99
- const theme = useTheme();
100
98
  const fabRef = useRef<FABHandles>(null);
101
99
  const animatedValue = useRef<Animated.Value>(
102
100
  new Animated.Value(active ? 1 : 0)
@@ -185,11 +183,6 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
185
183
 
186
184
  {active && (
187
185
  <StyledFAB
188
- // This FAB is moved up a bit compared to the original FAB,
189
- // set marginBottom to negative value to compensate for it
190
- style={{
191
- marginBottom: -theme.space.xxsmall,
192
- }}
193
186
  key="fab-in-portal"
194
187
  testID="fab-in-portal"
195
188
  icon={fabIcon}
@@ -33,7 +33,7 @@ exports[`MapPin.Focussed renders icon correctly 1`] = `
33
33
  [
34
34
  {
35
35
  "fontSize": 42,
36
- "textShadowColor": "rgba(0,0,0,0.28)",
36
+ "textShadowColor": "rgba(0,31,35,0.28)",
37
37
  "textShadowOffset": {
38
38
  "height": 4,
39
39
  "width": 0,
@@ -5,6 +5,10 @@ import type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';
5
5
  import { View } from 'react-native';
6
6
  import { useTheme } from '../../theme';
7
7
  import { StyledMarker } from './StyledRangeSlider';
8
+ import {
9
+ DISABLED_UNSELECTED_TRACK_OPACITY,
10
+ DISABLED_SELECTED_TRACK_OPACITY,
11
+ } from './constants';
8
12
 
9
13
  export type SliderRangeValue = {
10
14
  start: number;
@@ -92,10 +96,10 @@ const Slider = ({
92
96
  }, [value?.start, value?.end, minimumValue, maximumValue]);
93
97
 
94
98
  const {
95
- trackBackground,
96
- disabledTrackBackground,
97
- thumbTint,
98
- disabledThumbTint,
99
+ unselectedTrack,
100
+ disabledUnselectedTrack,
101
+ selectedTrack,
102
+ disabledSelectedTrack,
99
103
  } = theme.__hd__.slider.colors;
100
104
 
101
105
  const { trackHeight } = theme.__hd__.slider.sizes;
@@ -103,21 +107,23 @@ const Slider = ({
103
107
  // Define styles for disabled and enabled states
104
108
  const disabledStyles = {
105
109
  track: {
106
- backgroundColor: disabledTrackBackground,
110
+ opacity: DISABLED_UNSELECTED_TRACK_OPACITY,
111
+ backgroundColor: disabledUnselectedTrack,
107
112
  height: trackHeight,
108
113
  },
109
114
  selected: {
110
- backgroundColor: disabledThumbTint,
115
+ opacity: DISABLED_SELECTED_TRACK_OPACITY,
116
+ backgroundColor: disabledSelectedTrack,
111
117
  },
112
118
  };
113
119
 
114
120
  const enabledStyles = {
115
121
  track: {
116
- backgroundColor: trackBackground,
122
+ backgroundColor: unselectedTrack,
117
123
  height: trackHeight,
118
124
  },
119
125
  selected: {
120
- backgroundColor: thumbTint,
126
+ backgroundColor: selectedTrack,
121
127
  },
122
128
  };
123
129
 
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import RnSlider from '@react-native-community/slider';
2
+ import React from 'react';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import { useTheme } from '../../theme';
5
5
 
@@ -67,6 +67,8 @@ const Slider = ({
67
67
  }: SingleSliderProps) => {
68
68
  const theme = useTheme();
69
69
 
70
+ const { selectedTrack, thumb, unselectedTrack } = theme.__hd__.slider.colors;
71
+
70
72
  return (
71
73
  <RnSlider
72
74
  minimumValue={minimumValue}
@@ -77,9 +79,9 @@ const Slider = ({
77
79
  onSlidingStart={onSlidingStart}
78
80
  onSlidingComplete={onSlidingComplete}
79
81
  disabled={disabled}
80
- minimumTrackTintColor={theme.__hd__.slider.colors.minimumTrackTint}
81
- thumbTintColor={theme.__hd__.slider.colors.thumbTint}
82
- maximumTrackTintColor={theme.__hd__.slider.colors.maximumTrackTint}
82
+ minimumTrackTintColor={selectedTrack}
83
+ thumbTintColor={thumb}
84
+ maximumTrackTintColor={unselectedTrack}
83
85
  style={style}
84
86
  testID={testID}
85
87
  />
@@ -7,8 +7,8 @@ const StyledMarker = styled(View)<{ themeDisabled: boolean }>(
7
7
  width: theme.__hd__.slider.sizes.markerWidth,
8
8
  borderRadius: theme.__hd__.slider.radii.marker,
9
9
  backgroundColor: themeDisabled
10
- ? theme.__hd__.slider.colors.disabledThumbTint
11
- : theme.__hd__.slider.colors.thumbTint,
10
+ ? theme.__hd__.slider.colors.disabledThumb
11
+ : theme.__hd__.slider.colors.thumb,
12
12
  ...theme.__hd__.slider.shadows.marker,
13
13
  })
14
14
  );
@@ -29,7 +29,9 @@ describe('Slider.Range', () => {
29
29
  '#401960'
30
30
  );
31
31
 
32
- expect(nativeComponent.props['trackStyle'].backgroundColor).toBe('#ece8ef');
32
+ expect(nativeComponent.props['trackStyle'].backgroundColor).toBe(
33
+ 'rgba(0,0,0,0.1)'
34
+ );
33
35
 
34
36
  // verify prop
35
37
  expect(nativeComponent).toHaveProp('sliderLength', 100);
@@ -63,10 +65,10 @@ describe('Slider.Range', () => {
63
65
  const nativeComponent = getByTestId('native-multi-slider');
64
66
 
65
67
  expect(nativeComponent.props['selectedStyle'].backgroundColor).toBe(
66
- '#bfc1c5'
68
+ '#b3a3bf'
67
69
  );
68
70
 
69
- expect(nativeComponent.props['trackStyle'].backgroundColor).toBe('#f6f6f7');
71
+ expect(nativeComponent.props['trackStyle'].backgroundColor).toBe('#999999');
70
72
  });
71
73
 
72
74
  it('trigger options', () => {
@@ -101,7 +103,7 @@ describe('StyledMarker', () => {
101
103
  it.each`
102
104
  themeDisabled | expectedBackgroundColor
103
105
  ${false} | ${'#401960'}
104
- ${true} | ${'#bfc1c5'}
106
+ ${true} | ${'#b3a3bf'}
105
107
  `(
106
108
  'renders correctly when disabled is $themeDisabled',
107
109
  ({ themeDisabled, expectedBackgroundColor }) => {
@@ -36,7 +36,7 @@ exports[`Slider.Range renders correctly by default 1`] = `
36
36
  testID="native-multi-slider"
37
37
  trackStyle={
38
38
  {
39
- "backgroundColor": "#ece8ef",
39
+ "backgroundColor": "rgba(0,0,0,0.1)",
40
40
  "height": 4,
41
41
  }
42
42
  }
@@ -100,7 +100,8 @@ exports[`Slider.Range renders correctly when disabled is $disabled 1`] = `
100
100
  onValuesChangeStart={[Function]}
101
101
  selectedStyle={
102
102
  {
103
- "backgroundColor": "#bfc1c5",
103
+ "backgroundColor": "#b3a3bf",
104
+ "opacity": 1,
104
105
  }
105
106
  }
106
107
  sliderLength={0}
@@ -108,8 +109,9 @@ exports[`Slider.Range renders correctly when disabled is $disabled 1`] = `
108
109
  testID="native-multi-slider"
109
110
  trackStyle={
110
111
  {
111
- "backgroundColor": "#f6f6f7",
112
+ "backgroundColor": "#999999",
112
113
  "height": 4,
114
+ "opacity": 0.1,
113
115
  }
114
116
  }
115
117
  values={
@@ -209,7 +211,7 @@ exports[`StyledMarker renders correctly when disabled is true 1`] = `
209
211
  style={
210
212
  [
211
213
  {
212
- "backgroundColor": "#bfc1c5",
214
+ "backgroundColor": "#b3a3bf",
213
215
  "borderRadius": 999,
214
216
  "elevation": 6,
215
217
  "height": 24,
@@ -10,7 +10,7 @@ exports[`Slider renders correctly by default 1`] = `
10
10
  >
11
11
  <Slider
12
12
  disabled={false}
13
- maximumTrackTintColor="#ece8ef"
13
+ maximumTrackTintColor="rgba(0,0,0,0.1)"
14
14
  maximumValue={1}
15
15
  minimumTrackTintColor="#401960"
16
16
  minimumValue={0}
@@ -51,7 +51,7 @@ exports[`Slider renders correctly when disabled 1`] = `
51
51
  >
52
52
  <Slider
53
53
  disabled={true}
54
- maximumTrackTintColor="#ece8ef"
54
+ maximumTrackTintColor="rgba(0,0,0,0.1)"
55
55
  maximumValue={1}
56
56
  minimumTrackTintColor="#401960"
57
57
  minimumValue={0}
@@ -92,7 +92,7 @@ exports[`Slider renders correctly with props 1`] = `
92
92
  >
93
93
  <Slider
94
94
  disabled={false}
95
- maximumTrackTintColor="#ece8ef"
95
+ maximumTrackTintColor="rgba(0,0,0,0.1)"
96
96
  maximumValue={2}
97
97
  minimumTrackTintColor="#401960"
98
98
  minimumValue={-1}
@@ -0,0 +1,3 @@
1
+ export const DISABLED_UNSELECTED_TRACK_OPACITY = 0.1;
2
+ export const DISABLED_SELECTED_TRACK_OPACITY = 1;
3
+ export const UNSELECTED_TRACK_OPACITY = 0.1;
@@ -1281,12 +1281,12 @@ exports[`theme returns correct theme object 1`] = `
1281
1281
  },
1282
1282
  "slider": {
1283
1283
  "colors": {
1284
- "disabledThumbTint": "#bfc1c5",
1285
- "disabledTrackBackground": "#f6f6f7",
1286
- "maximumTrackTint": "#ece8ef",
1287
- "minimumTrackTint": "#401960",
1288
- "thumbTint": "#401960",
1289
- "trackBackground": "#ece8ef",
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,