@hero-design/rn 8.100.0 → 8.100.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.
@@ -1,4 +1,4 @@
1
- (node:3207) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3221) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
@@ -15,9 +15,9 @@ node_modules/d3-selection/src/selection/index.js -> node_modules/d3-selection/sr
15
15
     ~~~~~~~~~~~~~~~~~~~
16
16
  
17
17
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
18
- created lib/index.js, es/index.js in 1m 17.5s
18
+ created lib/index.js, es/index.js in 1m 9.2s
19
19
  
20
20
  /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_AU.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_CA.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/index.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/types.ts → ., ....
21
21
  (!) Generated empty chunks
22
22
  "locales/types" and "locales/types"
23
- created ., . in 22.3s
23
+ created ., . in 20.1s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.100.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3914](https://github.com/Thinkei/hero-design/pull/3914) [`e89cfb49ca75f9b2104e72b630bfb20bfa896e6f`](https://github.com/Thinkei/hero-design/commit/e89cfb49ca75f9b2104e72b630bfb20bfa896e6f) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Select.Multi] Fix crash issue when value is falsy
8
+
3
9
  ## 8.100.0
4
10
 
5
11
  ### Minor Changes
package/es/index.js CHANGED
@@ -24884,7 +24884,10 @@ var Option$2 = function Option(_ref) {
24884
24884
  };
24885
24885
 
24886
24886
  var isOptionSelected = function isOptionSelected(value, option) {
24887
- if (typeof option.value === 'string') {
24887
+ if (!value || !option || option.value === null || option.value === undefined) {
24888
+ return false;
24889
+ }
24890
+ if (_typeof$1(option.value) !== 'object') {
24888
24891
  return value.includes(option.value);
24889
24892
  }
24890
24893
  return value.some(function (v) {
package/lib/index.js CHANGED
@@ -24913,7 +24913,10 @@ var Option$2 = function Option(_ref) {
24913
24913
  };
24914
24914
 
24915
24915
  var isOptionSelected = function isOptionSelected(value, option) {
24916
- if (typeof option.value === 'string') {
24916
+ if (!value || !option || option.value === null || option.value === undefined) {
24917
+ return false;
24918
+ }
24919
+ if (_typeof$1(option.value) !== 'object') {
24917
24920
  return value.includes(option.value);
24918
24921
  }
24919
24922
  return value.some(function (v) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.100.0",
3
+ "version": "8.100.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -28,4 +28,25 @@ describe('isOptionSelected', () => {
28
28
 
29
29
  expect(isOptionSelected(selectedValues, option)).toBe(false);
30
30
  });
31
+
32
+ it('should return false when value is falsy', () => {
33
+ const selectedValues = undefined;
34
+ const option = { value: 'option1', text: 'Option 1' };
35
+
36
+ expect(isOptionSelected(selectedValues, option)).toBe(false);
37
+ });
38
+
39
+ it('should return false when option is falsy', () => {
40
+ const selectedValues = ['option1', 'option2'];
41
+ const option = undefined;
42
+
43
+ expect(isOptionSelected(selectedValues, option)).toBe(false);
44
+ });
45
+
46
+ it('should work with boolean value', () => {
47
+ const selectedValues = [true, false];
48
+ const option = { value: true, text: 'Option 1' };
49
+
50
+ expect(isOptionSelected(selectedValues, option)).toBe(true);
51
+ });
31
52
  });
@@ -2,11 +2,21 @@ import { deepCompareValue } from '../../../utils/helpers';
2
2
  import { OptionType } from '../types';
3
3
 
4
4
  export const isOptionSelected = <V, T extends OptionType<V>>(
5
- value: V[],
6
- option: T
5
+ value?: V[],
6
+ option?: T
7
7
  ): boolean => {
8
- if (typeof option.value === 'string') {
8
+ if (
9
+ !value ||
10
+ !option ||
11
+ option.value === null ||
12
+ option.value === undefined
13
+ ) {
14
+ return false;
15
+ }
16
+
17
+ if (typeof option.value !== 'object') {
9
18
  return value.includes(option.value);
10
19
  }
20
+
11
21
  return value.some((v) => deepCompareValue(v, option.value));
12
22
  };