@rc-component/select 1.0.5 → 1.0.6

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/Select.js CHANGED
@@ -40,7 +40,7 @@ import OptionList from "./OptionList";
40
40
  import SelectContext from "./SelectContext";
41
41
  import useCache from "./hooks/useCache";
42
42
  import useFilterOptions from "./hooks/useFilterOptions";
43
- import useId from "./hooks/useId";
43
+ import useId from "@rc-component/util/es/hooks/useId";
44
44
  import useOptions from "./hooks/useOptions";
45
45
  import useRefFunc from "./hooks/useRefFunc";
46
46
  import { hasValue, isComboNoValue, toArray } from "./utils/commonUtil";
package/lib/Select.js CHANGED
@@ -14,7 +14,7 @@ var _OptionList = _interopRequireDefault(require("./OptionList"));
14
14
  var _SelectContext = _interopRequireDefault(require("./SelectContext"));
15
15
  var _useCache = _interopRequireDefault(require("./hooks/useCache"));
16
16
  var _useFilterOptions = _interopRequireDefault(require("./hooks/useFilterOptions"));
17
- var _useId = _interopRequireDefault(require("./hooks/useId"));
17
+ var _useId = _interopRequireDefault(require("@rc-component/util/lib/hooks/useId"));
18
18
  var _useOptions = _interopRequireDefault(require("./hooks/useOptions"));
19
19
  var _useRefFunc = _interopRequireDefault(require("./hooks/useRefFunc"));
20
20
  var _commonUtil = require("./utils/commonUtil");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/select",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "React Select",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -1,5 +0,0 @@
1
- /** Is client side and not jsdom */
2
- export declare const isBrowserClient: boolean;
3
- /** Get unique id for accessibility usage */
4
- export declare function getUUID(): number | string;
5
- export default function useId(id?: string): string;
package/es/hooks/useId.js DELETED
@@ -1,29 +0,0 @@
1
- import * as React from 'react';
2
- import canUseDom from "@rc-component/util/es/Dom/canUseDom";
3
- let uuid = 0;
4
-
5
- /** Is client side and not jsdom */
6
- export const isBrowserClient = process.env.NODE_ENV !== 'test' && canUseDom();
7
-
8
- /** Get unique id for accessibility usage */
9
- export function getUUID() {
10
- let retId;
11
-
12
- // Test never reach
13
- /* istanbul ignore if */
14
- if (isBrowserClient) {
15
- retId = uuid;
16
- uuid += 1;
17
- } else {
18
- retId = 'TEST_OR_SSR';
19
- }
20
- return retId;
21
- }
22
- export default function useId(id) {
23
- // Inner id for accessibility usage. Only work in client side
24
- const [innerId, setInnerId] = React.useState();
25
- React.useEffect(() => {
26
- setInnerId(`rc_select_${getUUID()}`);
27
- }, []);
28
- return id || innerId;
29
- }
@@ -1,5 +0,0 @@
1
- /** Is client side and not jsdom */
2
- export declare const isBrowserClient: boolean;
3
- /** Get unique id for accessibility usage */
4
- export declare function getUUID(): number | string;
5
- export default function useId(id?: string): string;
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useId;
7
- exports.getUUID = getUUID;
8
- exports.isBrowserClient = void 0;
9
- var React = _interopRequireWildcard(require("react"));
10
- var _canUseDom = _interopRequireDefault(require("@rc-component/util/lib/Dom/canUseDom"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- let uuid = 0;
15
-
16
- /** Is client side and not jsdom */
17
- const isBrowserClient = exports.isBrowserClient = process.env.NODE_ENV !== 'test' && (0, _canUseDom.default)();
18
-
19
- /** Get unique id for accessibility usage */
20
- function getUUID() {
21
- let retId;
22
-
23
- // Test never reach
24
- /* istanbul ignore if */
25
- if (isBrowserClient) {
26
- retId = uuid;
27
- uuid += 1;
28
- } else {
29
- retId = 'TEST_OR_SSR';
30
- }
31
- return retId;
32
- }
33
- function useId(id) {
34
- // Inner id for accessibility usage. Only work in client side
35
- const [innerId, setInnerId] = React.useState();
36
- React.useEffect(() => {
37
- setInnerId(`rc_select_${getUUID()}`);
38
- }, []);
39
- return id || innerId;
40
- }