@bbl-digital/snorre 2.2.71 → 2.2.72
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/dist/bundle.js
CHANGED
@@ -30419,9 +30419,18 @@
|
|
30419
30419
|
onChange
|
30420
30420
|
}) => {
|
30421
30421
|
const [active, setActive] = React.useState(init || 0);
|
30422
|
+
const [initialized, setInitialized] = React.useState(false);
|
30423
|
+
const handleChange = React.useCallback(() => {
|
30424
|
+
if (!initialized) {
|
30425
|
+
setInitialized(true);
|
30426
|
+
return;
|
30427
|
+
}
|
30428
|
+
|
30429
|
+
onChange(active); // eslint-disable-next-line react-hooks/exhaustive-deps
|
30430
|
+
}, [active]);
|
30422
30431
|
React.useEffect(() => {
|
30423
|
-
|
30424
|
-
}, [
|
30432
|
+
handleChange();
|
30433
|
+
}, [handleChange]);
|
30425
30434
|
return /*#__PURE__*/jsxRuntime.jsx(TabContext.Provider, {
|
30426
30435
|
value: {
|
30427
30436
|
active,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react'; // Props for the Provider.
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react'; // Props for the Provider.
|
2
2
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
4
|
export const TabContext = /*#__PURE__*/React.createContext({
|
@@ -11,9 +11,18 @@ export const TabContextProvider = ({
|
|
11
11
|
onChange
|
12
12
|
}) => {
|
13
13
|
const [active, setActive] = useState(init || 0);
|
14
|
+
const [initialized, setInitialized] = useState(false);
|
15
|
+
const handleChange = useCallback(() => {
|
16
|
+
if (!initialized) {
|
17
|
+
setInitialized(true);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
|
21
|
+
onChange(active); // eslint-disable-next-line react-hooks/exhaustive-deps
|
22
|
+
}, [active]);
|
14
23
|
useEffect(() => {
|
15
|
-
|
16
|
-
}, [
|
24
|
+
handleChange();
|
25
|
+
}, [handleChange]);
|
17
26
|
return /*#__PURE__*/_jsx(TabContext.Provider, {
|
18
27
|
value: {
|
19
28
|
active,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../../src/packages/core/TabNav/TabContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../../src/packages/core/TabNav/TabContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,EAAE,EACF,cAAc,EAIf,MAAM,OAAO,CAAA;AAGd,UAAU,MAAM;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAA;CAC3C;AAGD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,UAAU,iCAGrB,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,MAAM,CA0BzC,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react'; // Props for the Provider.
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react'; // Props for the Provider.
|
2
2
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
4
|
export const TabContext = /*#__PURE__*/React.createContext({
|
@@ -11,9 +11,18 @@ export const TabContextProvider = ({
|
|
11
11
|
onChange
|
12
12
|
}) => {
|
13
13
|
const [active, setActive] = useState(init || 0);
|
14
|
+
const [initialized, setInitialized] = useState(false);
|
15
|
+
const handleChange = useCallback(() => {
|
16
|
+
if (!initialized) {
|
17
|
+
setInitialized(true);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
|
21
|
+
onChange(active); // eslint-disable-next-line react-hooks/exhaustive-deps
|
22
|
+
}, [active]);
|
14
23
|
useEffect(() => {
|
15
|
-
|
16
|
-
}, [
|
24
|
+
handleChange();
|
25
|
+
}, [handleChange]);
|
17
26
|
return /*#__PURE__*/_jsx(TabContext.Provider, {
|
18
27
|
value: {
|
19
28
|
active,
|