|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.useIdFallback = exports.useId = void 0;
|
|---|
| 7 | var React = _interopRequireWildcard(require("react"));
|
|---|
| 8 | var _DataUtils = require("./DataUtils");
|
|---|
| 9 | var _ref;
|
|---|
| 10 | function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|---|
| 11 | /**
|
|---|
| 12 | * Fallback for React.useId() for versions prior to React 18.
|
|---|
| 13 | * Generates a unique ID using a simple counter and a prefix.
|
|---|
| 14 | *
|
|---|
| 15 | * @returns A unique ID that remains consistent across renders.
|
|---|
| 16 | */
|
|---|
| 17 | var useIdFallback = () => {
|
|---|
| 18 | var [id] = React.useState(() => (0, _DataUtils.uniqueId)('uid-'));
|
|---|
| 19 | return id;
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | /*
|
|---|
| 23 | * This weird syntax is used to avoid a build-time error in React 17 and earlier when building with Webpack.
|
|---|
| 24 | * See https://github.com/webpack/webpack/issues/14814
|
|---|
| 25 | */
|
|---|
| 26 | exports.useIdFallback = useIdFallback;
|
|---|
| 27 | var useId = exports.useId = (_ref = React['useId'.toString()]) !== null && _ref !== void 0 ? _ref : useIdFallback; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.