@caspeco/casper-ui-library 4.1.1 → 5.0.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 +1 @@
1
- {"version":3,"file":"paginator.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.composition.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,+CAyB1B,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 { Locales } from './translations.js';
2
- export type PaginatorProps = {
3
- /** String to determine translations for the paginator */
4
- localeString: Locales;
5
- /** Array of options to pick a page size out of. Default is [10, 25, 50, 100] */
6
- pageSizeOptions?: number[];
7
- /** Number to display current page size */
8
- pageSize: number;
9
- /** Number to display current page index */
10
- pageIndex: number;
11
- /** Number to display current number of pages */
12
- pageCount: number;
13
- /** Boolean to disable button to go to the previous page */
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({ localeString, pageSizeOptions, pageSize, pageIndex, pageCount, canPreviousPage, canNextPage, setPageSize, setPageIndex, }: PaginatorProps): import("react/jsx-runtime").JSX.Element;
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":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG;IAC5B,yDAAyD;IACzD,YAAY,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,eAAe,EAAE,OAAO,CAAC;IACzB,uDAAuD;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,qDAAqD;IACrD,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,wBAAgB,SAAS,CAAC,EACzB,YAAY,EACZ,eAAmC,EACnC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,eAAe,EACf,WAAW,EACX,WAAW,EACX,YAAY,GACZ,EAAE,cAAc,2CAiDhB"}
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 e, jsx as o } from "react/jsx-runtime";
2
- import { useStyleConfig as b, Box as i } from "@chakra-ui/react";
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 { Select as p } from "../select/select.js";
5
- import { IconButton as l } from "../icon-button/icon-button.js";
6
- import { Icons as s } from "../icon/types.js";
7
- function _({
8
- localeString: c,
9
- pageSizeOptions: m = [10, 25, 50, 100],
10
- pageSize: u,
11
- pageIndex: t,
12
- pageCount: h,
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 v = b("Paginator"), n = k[c], C = () => {
19
- a(t - 1);
20
- }, P = () => {
21
- a(t + 1);
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__ */ e(i, { __css: v, children: [
24
- /* @__PURE__ */ o(i, { children: n.pageSize }),
25
- /* @__PURE__ */ o(i, { children: /* @__PURE__ */ o(
26
- p,
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: s.Back,
29
+ icon: l.Back,
41
30
  size: "md",
42
31
  variant: "ghost",
43
- "aria-label": n.previousPage,
44
- onClick: C,
45
- isDisabled: !d
32
+ "aria-label": t.previousPage,
33
+ onClick: I,
34
+ isDisabled: !u
46
35
  }
47
36
  ),
48
- /* @__PURE__ */ o(
49
- l,
37
+ /* @__PURE__ */ e(
38
+ c,
50
39
  {
51
- icon: s.Forward,
40
+ icon: l.Forward,
52
41
  size: "md",
53
42
  variant: "ghost",
54
- "aria-label": n.nextPage,
55
- onClick: P,
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
- _ as Paginator
52
+ N as Paginator
64
53
  };
@@ -1,34 +1,9 @@
1
- export type Locales = "en-US" | "nb-NO" | "da-DK" | "sv-SE" | "en-GB";
2
- export declare const translations: {
3
- "sv-SE": {
4
- pageSize: string;
5
- currentPage: (pageIndex: number, pageCount: number) => string;
6
- previousPage: string;
7
- nextPage: string;
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,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAStE,eAAO,MAAM,YAAY;;;iCAGE,MAAM,aAAa,MAAM;;;;;;iCAR1B,MAAM,aAAa,MAAM;;;;;;iCAAzB,MAAM,aAAa,MAAM;;;;;;iCAgBxB,MAAM,aAAa,MAAM;;;;;;iCAMzB,MAAM,aAAa,MAAM;;;;CAInD,CAAC"}
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 i = {
2
- pageSize: "Rows per page",
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
- pageSize: "Antal per sida",
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": i,
14
- "en-GB": i,
11
+ "en-US": s,
12
+ "en-GB": s,
15
13
  "nb-NO": {
16
- pageSize: "Antall per side",
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
- pageSize: "Antal per side",
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":"AAAA,OAAO,EACN,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,aAAa,EAKlB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,KAAK,EAGV,KAAK,eAAe,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAiB,KAAK,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AC,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACvG,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAClD,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,gBAAgB,EAAE,eAAe,CAAC;CAClC;AAED,eAAO,MAAM,YAAY,4DAAyD,CAAC;AAEnF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,iRAgBtD,sBAAsB,CAAC,CAAC,CAAC,4CAmG3B,CAAC"}
@@ -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: R,
10
- expandedState: m,
11
- localeString: u,
12
- initialExpandedState: r = {},
13
- initialBreakingContentState: d = {},
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: c,
18
- onBreakingContentChange: y,
19
- onFilterColumn: h,
20
- id: E,
21
- customRowIndication: l
17
+ onExpandedChange: d,
18
+ onBreakingContentChange: h,
19
+ onFilterColumn: y,
20
+ id: v,
21
+ customRowIndication: n
22
22
  }) => {
23
- const [t, b] = S(m, c, r), [n, v] = S(
24
- x,
25
- M,
26
- p
27
- ), [a, T] = i([]), [k, F] = i(
28
- d || {}
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
- l && g(l);
32
- }, [l]);
33
- const P = w(
35
+ n && g(n);
36
+ }, [n]);
37
+ const F = w(
34
38
  (e) => {
35
39
  let o;
36
- typeof e == "function" ? o = e(n) : o = e, v(o);
40
+ typeof e == "function" ? o = e(l) : o = e, E(o);
37
41
  },
38
- [n]
39
- ), V = w(
42
+ [l]
43
+ ), P = w(
40
44
  (e) => {
41
45
  let o;
42
- typeof e == "function" ? o = e(t) : o = e, b(o);
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: P,
53
- onExpandedChange: V,
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: a,
60
- columnVisibility: n,
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: r,
68
- initialBreakingContentState: d,
69
- localeString: u,
70
- onExpandedChange: c,
71
+ initialExpandedState: a,
72
+ initialBreakingContentState: r,
73
+ localeString: m,
74
+ onExpandedChange: d,
71
75
  expanded: t,
72
- sorting: a,
73
- setSorting: T,
74
- setExpanded: b,
75
- breakingContentState: k,
76
- setBreakingContentState: F,
77
- onBreakingContentChange: y,
78
- onFilterColumn: h,
79
- id: E,
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: n
86
+ columnVisibility: l
83
87
  };
84
- return /* @__PURE__ */ z(L.Provider, { value: q, children: R });
88
+ return /* @__PURE__ */ z(L.Provider, { value: q, children: S });
85
89
  };
86
90
  export {
87
91
  L as TableContext,
@@ -1 +1 @@
1
- {"version":3,"file":"theme-casper-ui.d.ts","sourceRoot":"","sources":["../../../lib/theme/theme-config/theme-casper-ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA8LtF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC"}
1
+ {"version":3,"file":"theme-casper-ui.d.ts","sourceRoot":"","sources":["../../../lib/theme/theme-config/theme-casper-ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAmXtF;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC"}
@@ -1,4 +1,4 @@
1
- const r = {
1
+ const n = {
2
2
  primary: "#1F8696",
3
3
  primaryDark: "#2497A8",
4
4
  primaryHover: "#1B757E",
@@ -143,56 +143,236 @@ const r = {
143
143
  neutralContainerDark: "#5C5C5C",
144
144
  onNeutralContainer: "#000000",
145
145
  onNeutralContainerDark: "#F6F9FF"
146
- }, n = {
146
+ }, r = {
147
147
  header: "'Inter', sans-serif",
148
148
  subheader: "'Inter', sans-serif",
149
149
  body: "'Inter', sans-serif"
150
- }, a = `
151
- /* latin */
152
- @font-face {
153
- font-family: 'Inter';
154
- font-style: normal;
155
- font-weight: 400;
156
- font-display: swap;
157
- src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2) format('woff2');
158
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
159
- }
160
-
161
- /* latin */
162
- @font-face {
163
- font-family: 'Inter';
164
- font-style: normal;
165
- font-weight: 500;
166
- font-display: swap;
167
- src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2) format('woff2');
168
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
169
- }
170
-
171
- /* latin */
172
- @font-face {
173
- font-family: 'Inter';
174
- font-style: normal;
175
- font-weight: 700;
176
- font-display: swap;
177
- src: url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2) format('woff2');
178
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
179
- }
150
+ }, t = `
151
+ /* cyrillic-ext */
152
+ @font-face {
153
+ font-family: 'Inter';
154
+ font-style: normal;
155
+ font-weight: 400;
156
+ font-display: swap;
157
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
158
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
159
+ }
180
160
 
181
- body,html {
182
- font-family: 'Inter', sans-serif;
183
- font-weight: 400;
184
- }
161
+ /* cyrillic */
162
+ @font-face {
163
+ font-family: 'Inter';
164
+ font-style: normal;
165
+ font-weight: 400;
166
+ font-display: swap;
167
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
168
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
169
+ }
170
+
171
+ /* greek-ext */
172
+ @font-face {
173
+ font-family: 'Inter';
174
+ font-style: normal;
175
+ font-weight: 400;
176
+ font-display: swap;
177
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
178
+ unicode-range: U+1F00-1FFF;
179
+ }
180
+
181
+ /* greek */
182
+ @font-face {
183
+ font-family: 'Inter';
184
+ font-style: normal;
185
+ font-weight: 400;
186
+ font-display: swap;
187
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
188
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
189
+ }
190
+
191
+ /* vietnamese */
192
+ @font-face {
193
+ font-family: 'Inter';
194
+ font-style: normal;
195
+ font-weight: 400;
196
+ font-display: swap;
197
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
198
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
199
+ }
200
+
201
+ /* latin-ext */
202
+ @font-face {
203
+ font-family: 'Inter';
204
+ font-style: normal;
205
+ font-weight: 400;
206
+ font-display: swap;
207
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
208
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
209
+ }
210
+
211
+ /* latin */
212
+ @font-face {
213
+ font-family: 'Inter';
214
+ font-style: normal;
215
+ font-weight: 400;
216
+ font-display: swap;
217
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
218
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
219
+ }
220
+
221
+ /* cyrillic-ext */
222
+ @font-face {
223
+ font-family: 'Inter';
224
+ font-style: normal;
225
+ font-weight: 500;
226
+ font-display: swap;
227
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
228
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
229
+ }
230
+
231
+ /* cyrillic */
232
+ @font-face {
233
+ font-family: 'Inter';
234
+ font-style: normal;
235
+ font-weight: 500;
236
+ font-display: swap;
237
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
238
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
239
+ }
240
+
241
+ /* greek-ext */
242
+ @font-face {
243
+ font-family: 'Inter';
244
+ font-style: normal;
245
+ font-weight: 500;
246
+ font-display: swap;
247
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
248
+ unicode-range: U+1F00-1FFF;
249
+ }
250
+
251
+ /* greek */
252
+ @font-face {
253
+ font-family: 'Inter';
254
+ font-style: normal;
255
+ font-weight: 500;
256
+ font-display: swap;
257
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
258
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
259
+ }
260
+
261
+ /* vietnamese */
262
+ @font-face {
263
+ font-family: 'Inter';
264
+ font-style: normal;
265
+ font-weight: 500;
266
+ font-display: swap;
267
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
268
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
269
+ }
270
+
271
+ /* latin-ext */
272
+ @font-face {
273
+ font-family: 'Inter';
274
+ font-style: normal;
275
+ font-weight: 500;
276
+ font-display: swap;
277
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
278
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
279
+ }
280
+
281
+ /* latin */
282
+ @font-face {
283
+ font-family: 'Inter';
284
+ font-style: normal;
285
+ font-weight: 500;
286
+ font-display: swap;
287
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
288
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
289
+ }
290
+
291
+ /* cyrillic-ext */
292
+ @font-face {
293
+ font-family: 'Inter';
294
+ font-style: normal;
295
+ font-weight: 700;
296
+ font-display: swap;
297
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
298
+ unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
299
+ }
300
+
301
+ /* cyrillic */
302
+ @font-face {
303
+ font-family: 'Inter';
304
+ font-style: normal;
305
+ font-weight: 700;
306
+ font-display: swap;
307
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
308
+ unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
309
+ }
310
+
311
+ /* greek-ext */
312
+ @font-face {
313
+ font-family: 'Inter';
314
+ font-style: normal;
315
+ font-weight: 700;
316
+ font-display: swap;
317
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
318
+ unicode-range: U+1F00-1FFF;
319
+ }
320
+
321
+ /* greek */
322
+ @font-face {
323
+ font-family: 'Inter';
324
+ font-style: normal;
325
+ font-weight: 700;
326
+ font-display: swap;
327
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
328
+ unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
329
+ }
330
+
331
+ /* vietnamese */
332
+ @font-face {
333
+ font-family: 'Inter';
334
+ font-style: normal;
335
+ font-weight: 700;
336
+ font-display: swap;
337
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
338
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
339
+ }
340
+
341
+ /* latin-ext */
342
+ @font-face {
343
+ font-family: 'Inter';
344
+ font-style: normal;
345
+ font-weight: 700;
346
+ font-display: swap;
347
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
348
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
349
+ }
350
+
351
+ /* latin */
352
+ @font-face {
353
+ font-family: 'Inter';
354
+ font-style: normal;
355
+ font-weight: 700;
356
+ font-display: swap;
357
+ src: url(https://fonts.gstatic.com/s/inter/v19/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
358
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
359
+ }
360
+
361
+ body,html {
362
+ font-family: 'Inter', sans-serif;
363
+ font-weight: 400;
364
+ }
185
365
  `, o = {
186
366
  body: {
187
- backgroundColor: r.background,
188
- color: r.onBackground
367
+ backgroundColor: n.background,
368
+ color: n.onBackground
189
369
  }
190
- }, e = {
191
- colors: r,
192
- fonts: n,
193
- fontStyleSheet: a,
370
+ }, a = {
371
+ colors: n,
372
+ fonts: r,
373
+ fontStyleSheet: t,
194
374
  globalStyles: o
195
375
  };
196
376
  export {
197
- e as casperUITheme
377
+ a as casperUITheme
198
378
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "4.1.1",
3
+ "version": "5.0.1",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -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
- };