@caspeco/casper-ui-library 4.1.1 → 5.0.0
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/components/paginator/paginator.composition.d.ts.map +1 -1
- package/dist/components/paginator/paginator.d.ts +14 -21
- package/dist/components/paginator/paginator.d.ts.map +1 -1
- package/dist/components/paginator/paginator.js +34 -45
- package/dist/components/paginator/translations.d.ts +8 -33
- package/dist/components/paginator/translations.d.ts.map +1 -1
- package/dist/components/paginator/translations.js +7 -11
- package/dist/components/table/table-context.d.ts.map +1 -1
- package/dist/components/table/table-context.js +46 -42
- package/package.json +1 -1
- package/dist/components/table/use-controllable-state.d.ts +0 -28
- package/dist/components/table/use-controllable-state.d.ts.map +0 -1
- package/dist/components/table/use-controllable-state.js +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.composition.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,+
|
|
1
|
+
{"version":3,"file":"paginator.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.composition.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,+CAgB1B,CAAC"}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
canPreviousPage: boolean;
|
|
15
|
-
/** Boolean to disable button to go to the next page */
|
|
16
|
-
canNextPage: boolean;
|
|
17
|
-
/** Function to update the page size of the table */
|
|
18
|
-
setPageSize: (pageSize: number) => void;
|
|
19
|
-
/** Function to update the page index of the table */
|
|
20
|
-
setPageIndex: (pageIndex: number) => void;
|
|
1
|
+
import { ThemeStyleProps } from '../../theme/index.js';
|
|
2
|
+
import { Locale } from './translations.js';
|
|
3
|
+
export type PaginatorProps = ThemeStyleProps & {
|
|
4
|
+
/** Which locale to use for translations */
|
|
5
|
+
locale: Locale;
|
|
6
|
+
/** The size of each page */
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
/** The total number of items */
|
|
9
|
+
itemCount: number;
|
|
10
|
+
/** The current page index (turns component controlled) */
|
|
11
|
+
pageIndex?: number;
|
|
12
|
+
/** Invoked when the page index changes */
|
|
13
|
+
onPageChange?: (newPageIndex: number) => void;
|
|
21
14
|
};
|
|
22
|
-
export declare function Paginator({
|
|
15
|
+
export declare function Paginator({ locale, pageSize, itemCount, pageIndex: _pageIndex, onPageChange, ...rest }: PaginatorProps): import("react/jsx-runtime").JSX.Element;
|
|
23
16
|
//# sourceMappingURL=paginator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paginator.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG;IAC9C,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IAEf,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAElB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,SAAS,CAAC,EACzB,MAAM,EACN,QAAa,EACb,SAAS,EACT,SAAS,EAAE,UAAU,EACrB,YAAY,EACZ,GAAG,IAAI,EACP,EAAE,cAAc,2CA6ChB"}
|
|
@@ -1,58 +1,47 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useStyleConfig as b, Box as
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableState as C, useStyleConfig as b, Box as s } from "@chakra-ui/react";
|
|
3
3
|
import { translations as k } from "./translations.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
canPreviousPage: d,
|
|
14
|
-
canNextPage: f,
|
|
15
|
-
setPageSize: g,
|
|
16
|
-
setPageIndex: a
|
|
4
|
+
import { IconButton as c } from "../icon-button/icon-button.js";
|
|
5
|
+
import { Icons as l } from "../icon/types.js";
|
|
6
|
+
function N({
|
|
7
|
+
locale: g,
|
|
8
|
+
pageSize: n = 10,
|
|
9
|
+
itemCount: o,
|
|
10
|
+
pageIndex: m,
|
|
11
|
+
onPageChange: d,
|
|
12
|
+
...P
|
|
17
13
|
}) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const [a, r] = C({
|
|
15
|
+
value: m,
|
|
16
|
+
defaultValue: 0,
|
|
17
|
+
onChange: d
|
|
18
|
+
}), x = b("Paginator"), t = k[g], u = a > 0, f = n > 0 && a < Math.ceil(o / n) - 1, h = a * n + 1, p = Math.max(Math.min(n * (a + 1), o), 1), I = () => {
|
|
19
|
+
r(a - 1);
|
|
20
|
+
}, v = () => {
|
|
21
|
+
r(a + 1);
|
|
22
22
|
};
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value: u,
|
|
29
|
-
onChange: (r) => {
|
|
30
|
-
g(Number(r.target.value));
|
|
31
|
-
},
|
|
32
|
-
children: m.map((r) => /* @__PURE__ */ o("option", { value: r, children: r }, r))
|
|
33
|
-
}
|
|
34
|
-
) }),
|
|
35
|
-
/* @__PURE__ */ o(i, { children: n.currentPage(t, h) }),
|
|
36
|
-
/* @__PURE__ */ e(i, { children: [
|
|
37
|
-
/* @__PURE__ */ o(
|
|
38
|
-
l,
|
|
23
|
+
return /* @__PURE__ */ i(s, { __css: x, ...P, children: [
|
|
24
|
+
/* @__PURE__ */ e(s, { children: t.currentPage(h, p, o) }),
|
|
25
|
+
/* @__PURE__ */ i(s, { children: [
|
|
26
|
+
/* @__PURE__ */ e(
|
|
27
|
+
c,
|
|
39
28
|
{
|
|
40
|
-
icon:
|
|
29
|
+
icon: l.Back,
|
|
41
30
|
size: "md",
|
|
42
31
|
variant: "ghost",
|
|
43
|
-
"aria-label":
|
|
44
|
-
onClick:
|
|
45
|
-
isDisabled: !
|
|
32
|
+
"aria-label": t.previousPage,
|
|
33
|
+
onClick: I,
|
|
34
|
+
isDisabled: !u
|
|
46
35
|
}
|
|
47
36
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
c,
|
|
50
39
|
{
|
|
51
|
-
icon:
|
|
40
|
+
icon: l.Forward,
|
|
52
41
|
size: "md",
|
|
53
42
|
variant: "ghost",
|
|
54
|
-
"aria-label":
|
|
55
|
-
onClick:
|
|
43
|
+
"aria-label": t.nextPage,
|
|
44
|
+
onClick: v,
|
|
56
45
|
isDisabled: !f
|
|
57
46
|
}
|
|
58
47
|
)
|
|
@@ -60,5 +49,5 @@ function _({
|
|
|
60
49
|
] });
|
|
61
50
|
}
|
|
62
51
|
export {
|
|
63
|
-
|
|
52
|
+
N as Paginator
|
|
64
53
|
};
|
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"en-US": {
|
|
10
|
-
pageSize: string;
|
|
11
|
-
currentPage: (pageIndex: number, pageCount: number) => string;
|
|
12
|
-
previousPage: string;
|
|
13
|
-
nextPage: string;
|
|
14
|
-
};
|
|
15
|
-
"en-GB": {
|
|
16
|
-
pageSize: string;
|
|
17
|
-
currentPage: (pageIndex: number, pageCount: number) => string;
|
|
18
|
-
previousPage: string;
|
|
19
|
-
nextPage: string;
|
|
20
|
-
};
|
|
21
|
-
"nb-NO": {
|
|
22
|
-
pageSize: string;
|
|
23
|
-
currentPage: (pageIndex: number, pageCount: number) => string;
|
|
24
|
-
previousPage: string;
|
|
25
|
-
nextPage: string;
|
|
26
|
-
};
|
|
27
|
-
"da-DK": {
|
|
28
|
-
pageSize: string;
|
|
29
|
-
currentPage: (pageIndex: number, pageCount: number) => string;
|
|
30
|
-
previousPage: string;
|
|
31
|
-
nextPage: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
1
|
+
export type Locale = "en-US" | "nb-NO" | "da-DK" | "sv-SE" | "en-GB";
|
|
2
|
+
interface TranslationObject {
|
|
3
|
+
currentPage: (start: number, end: number, itemCount: number) => string;
|
|
4
|
+
previousPage: string;
|
|
5
|
+
nextPage: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const translations: Record<Locale, TranslationObject>;
|
|
8
|
+
export {};
|
|
34
9
|
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAErE,UAAU,iBAAiB;IAC1B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAQD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAkB1D,CAAC"}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
currentPage: (e, a) => `Page ${e + 1} of ${a}`,
|
|
1
|
+
const s = {
|
|
2
|
+
currentPage: (e, a, r) => `${e}-${a} of ${r}`,
|
|
4
3
|
previousPage: "Previous page",
|
|
5
4
|
nextPage: "Next page"
|
|
6
5
|
}, g = {
|
|
7
6
|
"sv-SE": {
|
|
8
|
-
|
|
9
|
-
currentPage: (e, a) => `Sida ${e + 1} av ${a}`,
|
|
7
|
+
currentPage: (e, a, r) => `${e}-${a} av ${r}`,
|
|
10
8
|
previousPage: "Föregående sida",
|
|
11
9
|
nextPage: "Nästa sida"
|
|
12
10
|
},
|
|
13
|
-
"en-US":
|
|
14
|
-
"en-GB":
|
|
11
|
+
"en-US": s,
|
|
12
|
+
"en-GB": s,
|
|
15
13
|
"nb-NO": {
|
|
16
|
-
|
|
17
|
-
currentPage: (e, a) => `Side ${e + 1} av ${a}`,
|
|
14
|
+
currentPage: (e, a, r) => `${e}-${a} av ${r}`,
|
|
18
15
|
previousPage: "Forrige side",
|
|
19
16
|
nextPage: "Neste side"
|
|
20
17
|
},
|
|
21
18
|
"da-DK": {
|
|
22
|
-
|
|
23
|
-
currentPage: (e, a) => `Side ${e + 1} af ${a}`,
|
|
19
|
+
currentPage: (e, a, r) => `${e}-${a} af ${r}`,
|
|
24
20
|
previousPage: "Forrige side",
|
|
25
21
|
nextPage: "Næste side"
|
|
26
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-context.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-context.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-context.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import { jsx as z } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableState as u } from "@chakra-ui/react";
|
|
2
3
|
import { useReactTable as A } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
3
4
|
import { useState as i, useEffect as B, useCallback as w, createContext as D } from "react";
|
|
4
|
-
import { useControllableState as S } from "./use-controllable-state.js";
|
|
5
5
|
import { getFilteredRowModel as G, getSortedRowModel as H, getExpandedRowModel as J, getCoreRowModel as K } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
6
6
|
const L = D(null), Y = ({
|
|
7
7
|
data: s,
|
|
8
8
|
columns: C,
|
|
9
|
-
children:
|
|
10
|
-
expandedState:
|
|
11
|
-
localeString:
|
|
12
|
-
initialExpandedState:
|
|
13
|
-
initialBreakingContentState:
|
|
9
|
+
children: S,
|
|
10
|
+
expandedState: R,
|
|
11
|
+
localeString: m,
|
|
12
|
+
initialExpandedState: a = {},
|
|
13
|
+
initialBreakingContentState: r = {},
|
|
14
14
|
initialColumnVisibilityState: p = {},
|
|
15
15
|
columnVisibilityState: x,
|
|
16
16
|
onColumnVisibilityChange: M,
|
|
17
|
-
onExpandedChange:
|
|
18
|
-
onBreakingContentChange:
|
|
19
|
-
onFilterColumn:
|
|
20
|
-
id:
|
|
21
|
-
customRowIndication:
|
|
17
|
+
onExpandedChange: d,
|
|
18
|
+
onBreakingContentChange: h,
|
|
19
|
+
onFilterColumn: y,
|
|
20
|
+
id: v,
|
|
21
|
+
customRowIndication: n
|
|
22
22
|
}) => {
|
|
23
|
-
const [t,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
), [
|
|
28
|
-
|
|
23
|
+
const [t, c] = u({
|
|
24
|
+
value: R,
|
|
25
|
+
onChange: d,
|
|
26
|
+
defaultValue: a
|
|
27
|
+
}), [l, E] = u({
|
|
28
|
+
value: x,
|
|
29
|
+
onChange: M,
|
|
30
|
+
defaultValue: p
|
|
31
|
+
}), [b, V] = i([]), [T, k] = i(
|
|
32
|
+
r || {}
|
|
29
33
|
), [f, g] = i({});
|
|
30
34
|
B(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
35
|
+
n && g(n);
|
|
36
|
+
}, [n]);
|
|
37
|
+
const F = w(
|
|
34
38
|
(e) => {
|
|
35
39
|
let o;
|
|
36
|
-
typeof e == "function" ? o = e(
|
|
40
|
+
typeof e == "function" ? o = e(l) : o = e, E(o);
|
|
37
41
|
},
|
|
38
|
-
[
|
|
39
|
-
),
|
|
42
|
+
[l]
|
|
43
|
+
), P = w(
|
|
40
44
|
(e) => {
|
|
41
45
|
let o;
|
|
42
|
-
typeof e == "function" ? o = e(t) : o = e,
|
|
46
|
+
typeof e == "function" ? o = e(t) : o = e, c(o);
|
|
43
47
|
},
|
|
44
48
|
[t]
|
|
45
49
|
), j = A({
|
|
@@ -49,39 +53,39 @@ const L = D(null), Y = ({
|
|
|
49
53
|
getExpandedRowModel: J(),
|
|
50
54
|
getSortedRowModel: H(),
|
|
51
55
|
getFilteredRowModel: G(),
|
|
52
|
-
onColumnVisibilityChange:
|
|
53
|
-
onExpandedChange:
|
|
56
|
+
onColumnVisibilityChange: F,
|
|
57
|
+
onExpandedChange: P,
|
|
54
58
|
getSubRows: (e) => e.subRows,
|
|
55
59
|
enableSubRowSelection: !0,
|
|
56
60
|
enableMultiRowSelection: !1,
|
|
57
61
|
enableRowSelection: !0,
|
|
58
62
|
state: {
|
|
59
|
-
sorting:
|
|
60
|
-
columnVisibility:
|
|
63
|
+
sorting: b,
|
|
64
|
+
columnVisibility: l,
|
|
61
65
|
expanded: t,
|
|
62
66
|
rowSelection: f
|
|
63
67
|
}
|
|
64
68
|
}), q = {
|
|
65
69
|
data: s,
|
|
66
70
|
table: j,
|
|
67
|
-
initialExpandedState:
|
|
68
|
-
initialBreakingContentState:
|
|
69
|
-
localeString:
|
|
70
|
-
onExpandedChange:
|
|
71
|
+
initialExpandedState: a,
|
|
72
|
+
initialBreakingContentState: r,
|
|
73
|
+
localeString: m,
|
|
74
|
+
onExpandedChange: d,
|
|
71
75
|
expanded: t,
|
|
72
|
-
sorting:
|
|
73
|
-
setSorting:
|
|
74
|
-
setExpanded:
|
|
75
|
-
breakingContentState:
|
|
76
|
-
setBreakingContentState:
|
|
77
|
-
onBreakingContentChange:
|
|
78
|
-
onFilterColumn:
|
|
79
|
-
id:
|
|
76
|
+
sorting: b,
|
|
77
|
+
setSorting: V,
|
|
78
|
+
setExpanded: c,
|
|
79
|
+
breakingContentState: T,
|
|
80
|
+
setBreakingContentState: k,
|
|
81
|
+
onBreakingContentChange: h,
|
|
82
|
+
onFilterColumn: y,
|
|
83
|
+
id: v,
|
|
80
84
|
setRowSelection: g,
|
|
81
85
|
rowSelection: f,
|
|
82
|
-
columnVisibility:
|
|
86
|
+
columnVisibility: l
|
|
83
87
|
};
|
|
84
|
-
return /* @__PURE__ */ z(L.Provider, { value: q, children:
|
|
88
|
+
return /* @__PURE__ */ z(L.Provider, { value: q, children: S });
|
|
85
89
|
};
|
|
86
90
|
export {
|
|
87
91
|
L as TableContext,
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A custom React hook for managing state that can be either controlled by a parent component or managed internally.
|
|
3
|
-
*
|
|
4
|
-
* @param value - The controlled value provided by the parent component. If `undefined`, the hook operates in uncontrolled mode and manages the state internally.
|
|
5
|
-
* @param changeHandler - Optional callback invoked when the state changes. Useful for notifying the parent component of state changes in controlled mode.
|
|
6
|
-
* @param initialValue - The initial state value when operating in uncontrolled mode.
|
|
7
|
-
*
|
|
8
|
-
* @returns A tuple containing:
|
|
9
|
-
* - The current state value (`T`).
|
|
10
|
-
* - A function to update the state (`setValue`).
|
|
11
|
-
* In controlled mode, calling `setValue` invokes `changeHandler` without updating internal state.
|
|
12
|
-
* In uncontrolled mode, `setValue` updates the internal state.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* // Uncontrolled component usage:
|
|
16
|
-
* const [value, setValue] = useControllableState(undefined, props.onChange, 'default');
|
|
17
|
-
* setValue('new value');
|
|
18
|
-
* // props.onChange('new value') is called
|
|
19
|
-
* console.log(value) // 'new value'
|
|
20
|
-
*
|
|
21
|
-
* // Controlled component usage:
|
|
22
|
-
* const [value, setValue] = useControllableState(props.value, props.onChange, 'default');
|
|
23
|
-
* setValue('new value');
|
|
24
|
-
* // props.onChange('new value') is called
|
|
25
|
-
* console.log(value) // 'default'
|
|
26
|
-
*/
|
|
27
|
-
export declare function useControllableState<T>(value: T extends Function ? never : T | undefined, changeHandler: ((newValue: T) => void) | undefined, initialValue: T): [T, React.Dispatch<React.SetStateAction<T>>];
|
|
28
|
-
//# sourceMappingURL=use-controllable-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-controllable-state.d.ts","sourceRoot":"","sources":["../../../lib/components/table/use-controllable-state.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAErC,KAAK,EAAE,CAAC,SAAS,QAAQ,GAAG,KAAK,GAAG,CAAC,GAAG,SAAS,EACjD,aAAa,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EAClD,YAAY,EAAE,CAAC,GACb,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAgB9C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useState as s } from "react";
|
|
2
|
-
function a(o, e, n) {
|
|
3
|
-
const [r, l] = s(n);
|
|
4
|
-
return [o !== void 0 ? o : r, (t) => {
|
|
5
|
-
if (typeof t == "function")
|
|
6
|
-
throw new Error("Function as argument is not supported.");
|
|
7
|
-
l(t), e?.(t);
|
|
8
|
-
}];
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
a as useControllableState
|
|
12
|
-
};
|