@companix/uikit 0.0.31 → 0.0.33

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.
Files changed (66) hide show
  1. package/dist/DatePicker/index.d.ts +1 -1
  2. package/dist/Popover/index.d.ts +1 -0
  3. package/dist/ThemeProvider/script.d.ts +1 -0
  4. package/dist/__hooks/useCalendar.d.ts +1 -1
  5. package/dist/__libs/calendar.d.ts +1 -1
  6. package/dist/bundle.es.js +30 -27
  7. package/dist/bundle.es10.js +2 -2
  8. package/dist/bundle.es11.js +1 -1
  9. package/dist/bundle.es12.js +1 -1
  10. package/dist/bundle.es14.js +1 -1
  11. package/dist/bundle.es17.js +7 -6
  12. package/dist/bundle.es18.js +1 -1
  13. package/dist/bundle.es19.js +1 -1
  14. package/dist/bundle.es20.js +1 -1
  15. package/dist/bundle.es23.js +1 -1
  16. package/dist/bundle.es24.js +3 -3
  17. package/dist/bundle.es25.js +27 -26
  18. package/dist/bundle.es26.js +2 -2
  19. package/dist/bundle.es29.js +2 -2
  20. package/dist/bundle.es32.js +13 -17
  21. package/dist/bundle.es33.js +21 -10
  22. package/dist/bundle.es34.js +10 -24
  23. package/dist/bundle.es35.js +17 -31
  24. package/dist/bundle.es36.js +36 -48
  25. package/dist/bundle.es37.js +49 -41
  26. package/dist/bundle.es38.js +42 -8
  27. package/dist/bundle.es39.js +8 -23
  28. package/dist/bundle.es40.js +24 -87
  29. package/dist/bundle.es41.js +87 -18
  30. package/dist/bundle.es42.js +16 -18
  31. package/dist/bundle.es43.js +20 -24
  32. package/dist/bundle.es44.js +20 -35
  33. package/dist/bundle.es45.js +39 -3
  34. package/dist/bundle.es46.js +3 -5
  35. package/dist/bundle.es47.js +5 -14
  36. package/dist/bundle.es48.js +13 -13
  37. package/dist/bundle.es49.js +14 -3
  38. package/dist/bundle.es50.js +3 -3
  39. package/dist/bundle.es51.js +3 -70
  40. package/dist/bundle.es52.js +68 -66
  41. package/dist/bundle.es53.js +67 -69
  42. package/dist/bundle.es54.js +69 -11
  43. package/dist/bundle.es55.js +11 -42
  44. package/dist/bundle.es56.js +42 -14
  45. package/dist/bundle.es57.js +11 -20
  46. package/dist/bundle.es59.js +1 -1
  47. package/dist/bundle.es62.js +13 -75
  48. package/dist/bundle.es63.js +20 -49
  49. package/dist/bundle.es64.js +2 -14
  50. package/dist/bundle.es65.js +18 -17
  51. package/dist/bundle.es66.js +2 -2
  52. package/dist/bundle.es67.js +17 -18
  53. package/dist/bundle.es68.js +76 -2
  54. package/dist/bundle.es69.js +49 -20
  55. package/dist/bundle.es7.js +19 -17
  56. package/dist/bundle.es71.js +14 -3
  57. package/dist/bundle.es72.js +1 -1
  58. package/dist/bundle.es73.js +3 -14
  59. package/dist/bundle.es9.js +4 -4
  60. package/dist/index.d.ts +2 -1
  61. package/dist/index.scss +1 -2
  62. package/package.json +1 -1
  63. package/dist/DatePicker/DatePicker.scss +0 -0
  64. /package/dist/{DatePicker → Calendar}/Calendar.d.ts +0 -0
  65. /package/dist/{DatePicker → Calendar}/Calendar.scss +0 -0
  66. /package/dist/{DatePicker → Calendar}/CalendarHeader.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { InputProps } from '../Input/Input';
2
- import { CalendarProps } from './Calendar';
2
+ import { CalendarProps } from '../Calendar/Calendar';
3
3
  export interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<InputProps, 'value' | 'onChange' | 'rightElement'> {
4
4
  onChange?: (value: Date | null) => void;
5
5
  clearButton?: boolean;
@@ -22,5 +22,6 @@ export interface PopoverProps {
22
22
  className?: string;
23
23
  fitMaxHeight?: boolean;
24
24
  disabled?: boolean;
25
+ zIndex?: number;
25
26
  }
26
27
  export declare const Popover: import('react').ForwardRefExoticComponent<PopoverProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -4,4 +4,5 @@ interface ColorSchemeScriptProps {
4
4
  defaultColorScheme: ColorSchemeExtendedType;
5
5
  }
6
6
  export declare const ColorSchemeScript: import('react').MemoExoticComponent<({ storageKey, defaultColorScheme }: ColorSchemeScriptProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export declare const colorSchemeScript: (storageKey: string, defaultColorScheme: "light" | "dark") => void;
7
8
  export {};
@@ -1,4 +1,4 @@
1
- import { CalendarProps } from '../DatePicker/Calendar';
1
+ import { CalendarProps } from '../Calendar/Calendar';
2
2
  export interface UseCalendarDependencies extends Pick<CalendarProps, 'minDateTime' | 'maxDateTime' | 'shouldDisableDate' | 'disableFuture' | 'disablePast'> {
3
3
  disablePast?: boolean;
4
4
  disableFuture?: boolean;
@@ -1,4 +1,4 @@
1
- import { CalendarProps } from '../DatePicker/Calendar';
1
+ import { CalendarProps } from '../Calendar/Calendar';
2
2
  export declare function isSameDate(d1: Date, d2: Date): boolean;
3
3
  export declare const MONDAY = 1;
4
4
  export declare function startOfWeek(date: Date, { weekStartsOn }: {
package/dist/bundle.es.js CHANGED
@@ -3,17 +3,17 @@ import { ButtonGroup as p } from "./bundle.es3.js";
3
3
  import { Spinner as x } from "./bundle.es4.js";
4
4
  import { Scrollable as a } from "./bundle.es5.js";
5
5
  import { ImitateScroll as l } from "./bundle.es6.js";
6
- import { Popover as c } from "./bundle.es7.js";
6
+ import { Popover as n } from "./bundle.es7.js";
7
7
  import { Tooltip as u } from "./bundle.es8.js";
8
- import { Select as T } from "./bundle.es9.js";
9
- import { Input as D } from "./bundle.es10.js";
10
- import { OptionItem as P } from "./bundle.es11.js";
11
- import { NumberInput as h } from "./bundle.es12.js";
8
+ import { Select as g } from "./bundle.es9.js";
9
+ import { Input as h } from "./bundle.es10.js";
10
+ import { OptionItem as I } from "./bundle.es11.js";
11
+ import { NumberInput as d } from "./bundle.es12.js";
12
12
  import { OptionsList as v } from "./bundle.es13.js";
13
13
  import { Checkbox as B } from "./bundle.es14.js";
14
14
  import { Switch as k } from "./bundle.es15.js";
15
- import { Radio as y, RadioGroup as G } from "./bundle.es16.js";
16
- import { Drawer as O } from "./bundle.es17.js";
15
+ import { Radio as y, RadioGroup as C } from "./bundle.es16.js";
16
+ import { Drawer as L } from "./bundle.es17.js";
17
17
  import { Dialog as F } from "./bundle.es18.js";
18
18
  import { AlertDialog as j } from "./bundle.es19.js";
19
19
  import { LoadingButton as z } from "./bundle.es20.js";
@@ -29,38 +29,40 @@ import { TimePicker as to } from "./bundle.es29.js";
29
29
  import { Icon as mo } from "./bundle.es30.js";
30
30
  import { ProgressBar as fo } from "./bundle.es31.js";
31
31
  import { ThemeProvider as io, useTheme as lo } from "./bundle.es32.js";
32
- import { useLocalStorage as co } from "./bundle.es33.js";
33
- import { createAlertAgent as uo } from "./bundle.es34.js";
34
- import { createToaster as To } from "./bundle.es35.js";
35
- import { Toast as Do } from "./bundle.es36.js";
36
- import { DialogShell as Po, createDialogsRegistry as ho } from "./bundle.es37.js";
37
- import { createPopoversRegistry as vo } from "./bundle.es38.js";
32
+ import { ColorSchemeScript as no, colorSchemeScript as so } from "./bundle.es33.js";
33
+ import { useLocalStorage as So } from "./bundle.es34.js";
34
+ import { createAlertAgent as To } from "./bundle.es35.js";
35
+ import { createToaster as Do } from "./bundle.es36.js";
36
+ import { Toast as Po } from "./bundle.es37.js";
37
+ import { DialogShell as vo, createDialogsRegistry as Ao } from "./bundle.es38.js";
38
+ import { createPopoversRegistry as Ro } from "./bundle.es39.js";
38
39
  export {
39
40
  j as AlertDialog,
40
41
  e as Button,
41
42
  p as ButtonGroup,
42
43
  B as Checkbox,
44
+ no as ColorSchemeScript,
43
45
  K as Countdown,
44
46
  Z as DateInput,
45
47
  X as DatePicker,
46
48
  F as Dialog,
47
- Po as DialogShell,
48
- O as Drawer,
49
+ vo as DialogShell,
50
+ L as Drawer,
49
51
  $ as FileOverlay,
50
52
  ro as FormGroup,
51
53
  mo as Icon,
52
54
  l as ImitateScroll,
53
- D as Input,
55
+ h as Input,
54
56
  z as LoadingButton,
55
- h as NumberInput,
56
- P as OptionItem,
57
+ d as NumberInput,
58
+ I as OptionItem,
57
59
  v as OptionsList,
58
- c as Popover,
60
+ n as Popover,
59
61
  fo as ProgressBar,
60
62
  y as Radio,
61
- G as RadioGroup,
63
+ C as RadioGroup,
62
64
  a as Scrollable,
63
- T as Select,
65
+ g as Select,
64
66
  V as SelectTags,
65
67
  x as Spinner,
66
68
  k as Switch,
@@ -68,12 +70,13 @@ export {
68
70
  Q as TextArea,
69
71
  io as ThemeProvider,
70
72
  to as TimePicker,
71
- Do as Toast,
73
+ Po as Toast,
72
74
  u as Tooltip,
73
- uo as createAlertAgent,
74
- ho as createDialogsRegistry,
75
- vo as createPopoversRegistry,
76
- To as createToaster,
77
- co as useLocalStorage,
75
+ so as colorSchemeScript,
76
+ To as createAlertAgent,
77
+ Ao as createDialogsRegistry,
78
+ Ro as createPopoversRegistry,
79
+ Do as createToaster,
80
+ So as useLocalStorage,
78
81
  lo as useTheme
79
82
  };
@@ -1,8 +1,8 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as b, useRef as R } from "react";
3
3
  import { mergeRefs as c } from "react-merge-refs";
4
- import { InputElement as x } from "./bundle.es43.js";
5
- import { InputContainer as I } from "./bundle.es44.js";
4
+ import { InputElement as x } from "./bundle.es44.js";
5
+ import { InputContainer as I } from "./bundle.es45.js";
6
6
  import g from "classnames";
7
7
  const N = b(
8
8
  ({
@@ -3,7 +3,7 @@ import N from "classnames";
3
3
  import { Icon as v } from "./bundle.es30.js";
4
4
  import { attr as t } from "@companix/utils-browser";
5
5
  import { forwardRef as k } from "react";
6
- import { f as x } from "./bundle.es45.js";
6
+ import { f as x } from "./bundle.es46.js";
7
7
  const E = k(
8
8
  ({ title: s, icon: c, active: e, label: n, disabled: a, minimal: r, onClick: d, className: l, ...m }, p) => {
9
9
  const f = (h) => {
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
2
2
  import C from "classnames";
3
3
  import { forwardRef as j, useRef as w } from "react";
4
4
  import { mergeRefs as y } from "react-merge-refs";
5
- import { InputContainer as F } from "./bundle.es44.js";
5
+ import { InputContainer as F } from "./bundle.es45.js";
6
6
  import { NumericFormat as V } from "react-number-format";
7
7
  const D = j(
8
8
  ({
@@ -1,7 +1,7 @@
1
1
  import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-checkbox";
3
3
  import { Icon as h } from "./bundle.es30.js";
4
- import { f as l } from "./bundle.es45.js";
4
+ import { f as l } from "./bundle.es46.js";
5
5
  import { useId as n } from "react";
6
6
  import { attr as c } from "@companix/utils-browser";
7
7
  const N = ({ checked: a, required: s, disabled: r, onCheckedChange: m, size: x, label: e }) => {
@@ -1,18 +1,19 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
2
  import d from "classnames";
3
3
  import * as r from "@radix-ui/react-dialog";
4
- import { VisuallyHidden as n } from "@radix-ui/react-visually-hidden";
4
+ import { VisuallyHidden as i } from "@radix-ui/react-visually-hidden";
5
5
  import { varToStyle as c } from "@companix/utils-browser";
6
- const p = ({ open: i, onOpenChange: t, children: a, size: l, direction: s, className: m }) => /* @__PURE__ */ e(r.Root, { open: i, onOpenChange: t, children: /* @__PURE__ */ o(r.Portal, { children: [
6
+ const p = ({ open: t, onOpenChange: l, children: a, size: s, direction: m, className: n }) => /* @__PURE__ */ e(r.Root, { open: t, onOpenChange: l, children: /* @__PURE__ */ o(r.Portal, { children: [
7
7
  /* @__PURE__ */ e(r.Overlay, { className: "drawer-overlay" }),
8
8
  /* @__PURE__ */ o(
9
9
  r.Content,
10
10
  {
11
- style: c({ "--drawer-size": l ?? "50%" }),
12
- className: d("drawer", m),
13
- "data-direction": s,
11
+ style: c({ "--drawer-size": s ?? "50%" }),
12
+ className: d("drawer", n),
13
+ "data-direction": m,
14
14
  children: [
15
- /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(r.Title, {}) }),
15
+ /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Title, {}) }),
16
+ /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Description, {}) }),
16
17
  a
17
18
  ]
18
19
  }
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
2
  import f from "classnames";
3
3
  import * as o from "@radix-ui/react-dialog";
4
4
  import { VisuallyHidden as a } from "@radix-ui/react-visually-hidden";
5
- import { RemoveListener as v } from "./bundle.es46.js";
5
+ import { RemoveListener as v } from "./bundle.es47.js";
6
6
  const g = (l) => {
7
7
  const { size: n = "s", open: r, onOpenChange: s, children: c, onClosed: t, disableEsc: p, className: d } = l, m = (h) => {
8
8
  p && h.preventDefault();
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import * as r from "@radix-ui/react-alert-dialog";
3
3
  import { Button as c } from "./bundle.es2.js";
4
- import { RemoveListener as N } from "./bundle.es46.js";
4
+ import { RemoveListener as N } from "./bundle.es47.js";
5
5
  import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
6
  const C = ({
7
7
  open: d,
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { Button as m } from "./bundle.es2.js";
3
- import { useLoading as p } from "./bundle.es47.js";
3
+ import { useLoading as p } from "./bundle.es48.js";
4
4
  const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
5
5
  const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
6
6
  return /* @__PURE__ */ e(
@@ -1,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es48.js";
2
+ import { useResizeTextarea as x } from "./bundle.es49.js";
3
3
  import { attr as e, callMultiple as u } from "@companix/utils-browser";
4
4
  import { useEffect as z } from "react";
5
5
  import { mergeRefs as R } from "react-merge-refs";
@@ -1,12 +1,12 @@
1
1
  import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
- import { useFroozeClosing as M } from "./bundle.es39.js";
2
+ import { useFroozeClosing as M } from "./bundle.es40.js";
3
3
  import { Popover as j } from "./bundle.es7.js";
4
4
  import { OptionItem as q } from "./bundle.es11.js";
5
5
  import { OptionsList as V } from "./bundle.es13.js";
6
6
  import { Icon as d } from "./bundle.es30.js";
7
7
  import { useState as B, useRef as h, useMemo as g } from "react";
8
- import { f as H } from "./bundle.es49.js";
9
- import { f as Q } from "./bundle.es50.js";
8
+ import { f as H } from "./bundle.es50.js";
9
+ import { f as Q } from "./bundle.es51.js";
10
10
  import { attr as x, getActiveElementByAnotherElement as G, contains as J } from "@companix/utils-browser";
11
11
  import { mergeRefs as K } from "react-merge-refs";
12
12
  const se = (C) => {
@@ -1,12 +1,12 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
- import { Popover as x } from "./bundle.es7.js";
3
- import { Input as A } from "./bundle.es10.js";
4
- import { useState as M, useRef as j } from "react";
5
- import { Calendar as E } from "./bundle.es51.js";
6
- import { useDayDisableCheker as N } from "./bundle.es52.js";
7
- import { getNum as f, formatTime as v } from "@companix/utils-js";
8
- import { removeDigits as O } from "./bundle.es53.js";
9
- import { SelectRightElements as Y } from "./bundle.es54.js";
2
+ import { Popover as T } from "./bundle.es7.js";
3
+ import { Input as w } from "./bundle.es10.js";
4
+ import { useState as A, useRef as j } from "react";
5
+ import { Calendar as E } from "./bundle.es52.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es53.js";
7
+ import { getNum as h, formatTime as v } from "@companix/utils-js";
8
+ import { removeDigits as O } from "./bundle.es54.js";
9
+ import { SelectRightElements as Y } from "./bundle.es55.js";
10
10
  const i = {
11
11
  char: "-",
12
12
  toString: (e) => {
@@ -19,7 +19,7 @@ const i = {
19
19
  toValue: (e) => {
20
20
  const n = e.split(i.char);
21
21
  if (n.length === 3) {
22
- const [r, l, a] = [f(n[0]), f(n[1]), f(n[2])];
22
+ const [r, l, a] = [h(n[0]), h(n[1]), h(n[2])];
23
23
  if (r && l && a) {
24
24
  const o = new Date(a, l - 1, r);
25
25
  if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === l - 1)
@@ -40,36 +40,36 @@ const i = {
40
40
  disablePickers: I,
41
41
  showNeighboringMonth: P,
42
42
  onChange: c,
43
- shouldDisableDate: d,
43
+ shouldDisableDate: g,
44
44
  viewDate: S,
45
- disablePast: g,
45
+ disablePast: d,
46
46
  disableFuture: D,
47
47
  minDateTime: C,
48
48
  maxDateTime: b,
49
49
  // input props
50
50
  ...V
51
- } = e, [m, s] = M(() => i.toString(o ?? null)), p = j(null), k = N({
51
+ } = e, [m, s] = A(() => i.toString(o ?? null)), p = j(null), k = N({
52
52
  disableFuture: D,
53
- disablePast: g,
54
- shouldDisableDate: d,
53
+ disablePast: d,
54
+ shouldDisableDate: g,
55
55
  minDateTime: C,
56
56
  maxDateTime: b
57
57
  }), B = (t) => {
58
58
  a || p.current && p.current.getAttribute("data-state") === "open" && t.preventDefault();
59
59
  }, F = (t) => {
60
60
  t.stopPropagation(), s(""), c?.(null);
61
- }, R = (t) => {
61
+ }, x = (t) => {
62
62
  s(t);
63
- const h = i.toValue(t);
64
- h && !k(h) && c?.(h);
65
- }, T = () => {
63
+ const f = i.toValue(t);
64
+ f && !k(f) && c?.(f);
65
+ }, M = () => {
66
66
  const t = i.toValue(m);
67
67
  (!t || k(t)) && s(i.toString(o ?? null));
68
- }, w = (t) => {
68
+ }, R = (t) => {
69
69
  c?.(t), s(i.toString(t));
70
70
  };
71
71
  return /* @__PURE__ */ u(
72
- x,
72
+ T,
73
73
  {
74
74
  minimal: !0,
75
75
  ref: p,
@@ -77,31 +77,32 @@ const i = {
77
77
  onOpenAutoFocus: (t) => t.preventDefault(),
78
78
  onCloseAutoFocus: (t) => t.preventDefault(),
79
79
  disabled: a,
80
+ fitMaxHeight: !1,
80
81
  content: () => /* @__PURE__ */ u(
81
82
  E,
82
83
  {
83
84
  value: o,
84
- disablePast: g,
85
+ disablePast: d,
85
86
  disableFuture: D,
86
87
  enableTime: y,
87
88
  disablePickers: I,
88
89
  showNeighboringMonth: P,
89
- onChange: w,
90
- shouldDisableDate: d,
90
+ onChange: R,
91
+ shouldDisableDate: g,
91
92
  viewDate: S,
92
93
  minDateTime: C,
93
94
  maxDateTime: b
94
95
  }
95
96
  ),
96
97
  children: /* @__PURE__ */ u(
97
- A,
98
+ w,
98
99
  {
99
100
  ...V,
100
101
  value: m,
101
102
  disabled: a,
102
103
  onClick: B,
103
- onValueChange: R,
104
- onBlur: T,
104
+ onValueChange: x,
105
+ onBlur: M,
105
106
  mask: "99-99-9999",
106
107
  rightElement: /* @__PURE__ */ u(
107
108
  Y,
@@ -1,8 +1,8 @@
1
1
  import { jsxs as D, jsx as h } from "react/jsx-runtime";
2
2
  import { useMemo as M, useEffect as C } from "react";
3
3
  import { Select as c } from "./bundle.es9.js";
4
- import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es53.js";
5
- import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es55.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es54.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es56.js";
6
6
  const B = ({
7
7
  min: o = j,
8
8
  max: e = N,
@@ -1,8 +1,8 @@
1
1
  import { jsx as g } from "react/jsx-runtime";
2
2
  import { useRef as _, useMemo as b, useState as P, useEffect as j } from "react";
3
3
  import { getNum as v } from "@companix/utils-js";
4
- import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es53.js";
5
- import { SelectRightElements as w } from "./bundle.es54.js";
4
+ import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es54.js";
5
+ import { SelectRightElements as w } from "./bundle.es55.js";
6
6
  import { Select as y } from "./bundle.es9.js";
7
7
  import { Input as z } from "./bundle.es10.js";
8
8
  const r = {
@@ -1,20 +1,19 @@
1
- import { jsxs as h, jsx as u } from "react/jsx-runtime";
2
- import { useState as f, useEffect as c, createContext as S, useContext as w } from "react";
3
- import { getColorScheme as v, updateDOM as i } from "./bundle.es56.js";
4
- import { ColorSchemeScript as C } from "./bundle.es57.js";
5
- const a = S({
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as c, createContext as f, useContext as w } from "react";
3
+ import { getColorScheme as v, updateDOM as m } from "./bundle.es57.js";
4
+ const i = f({
6
5
  setColorScheme: () => {
7
6
  }
8
- }), E = () => w(a), L = (d) => {
9
- const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, m] = f(() => v(n, o)), s = (e) => {
10
- m(e), localStorage.setItem(n, e);
7
+ }), y = () => w(i), p = (d) => {
8
+ const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, a] = h(() => v(n, o)), s = (e) => {
9
+ a(e), localStorage.setItem(n, e);
11
10
  };
12
11
  return c(() => {
13
12
  const e = window ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
14
13
  if (!e)
15
14
  return;
16
15
  const t = () => {
17
- r === "system" && i("system");
16
+ r === "system" && m("system");
18
17
  };
19
18
  return e.addEventListener?.("change", t), t(), () => {
20
19
  e.removeEventListener?.("change", t);
@@ -23,19 +22,16 @@ const a = S({
23
22
  if (!window)
24
23
  return;
25
24
  const e = (t) => {
26
- t.key === n && (t.newValue ? m(t.newValue) : s(o));
25
+ t.key === n && (t.newValue ? a(t.newValue) : s(o));
27
26
  };
28
27
  return window.addEventListener("storage", e), () => {
29
28
  window.removeEventListener("storage", e);
30
29
  };
31
30
  }, [s, o]), c(() => {
32
- i(r);
33
- }, [r]), /* @__PURE__ */ h(a.Provider, { value: { colorScheme: r, setColorScheme: s }, children: [
34
- /* @__PURE__ */ u(C, { storageKey: n, defaultColorScheme: o }),
35
- l
36
- ] });
31
+ m(r);
32
+ }, [r]), /* @__PURE__ */ u(i.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
37
33
  };
38
34
  export {
39
- L as ThemeProvider,
40
- E as useTheme
35
+ p as ThemeProvider,
36
+ y as useTheme
41
37
  };
@@ -1,13 +1,24 @@
1
- import { useState as s, useEffect as c } from "react";
2
- const l = (e, a) => {
3
- const [t, o] = s(() => {
4
- const r = localStorage.getItem(e);
5
- return r ? JSON.parse(r) : a;
6
- });
7
- return c(() => {
8
- localStorage.setItem(e, JSON.stringify(t));
9
- }, [t]), [t, o];
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { memo as n } from "react";
3
+ const i = n(({ storageKey: t, defaultColorScheme: o }) => /* @__PURE__ */ l(
4
+ "script",
5
+ {
6
+ suppressHydrationWarning: !0,
7
+ dangerouslySetInnerHTML: {
8
+ __html: `(${a.toString()})("${t}", "${o}")`
9
+ }
10
+ }
11
+ )), a = (t, o) => {
12
+ const [r, c] = ["theme-light", "theme-dark"];
13
+ try {
14
+ let e = localStorage.getItem(t) || o;
15
+ e === "system" && (e = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
16
+ const s = e === "dark" ? c : r;
17
+ document.documentElement.classList.remove(r, c), document.documentElement.classList.add(s), document.documentElement.style.colorScheme = e;
18
+ } catch {
19
+ }
10
20
  };
11
21
  export {
12
- l as useLocalStorage
22
+ i as ColorSchemeScript,
23
+ a as colorSchemeScript
13
24
  };
@@ -1,27 +1,13 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { hash as m } from "@companix/utils-js";
3
- import { useRef as n, useMemo as s } from "react";
4
- import { Viewport as u } from "./bundle.es58.js";
5
- const h = (t = {}) => {
6
- const e = {
7
- emit: (r) => {
8
- console.error("uninitialized", r);
9
- }
10
- };
11
- return {
12
- show: (r) => {
13
- e.emit({ ...r, id: m() });
14
- },
15
- Viewport: () => {
16
- const r = n(null);
17
- return s(() => {
18
- e.emit = (o) => {
19
- r.current && r.current.showAlert(o);
20
- };
21
- }, []), /* @__PURE__ */ i(u, { ref: r, ...t });
22
- }
23
- };
1
+ import { useState as s, useEffect as c } from "react";
2
+ const l = (e, a) => {
3
+ const [t, o] = s(() => {
4
+ const r = localStorage.getItem(e);
5
+ return r ? JSON.parse(r) : a;
6
+ });
7
+ return c(() => {
8
+ localStorage.setItem(e, JSON.stringify(t));
9
+ }, [t]), [t, o];
24
10
  };
25
11
  export {
26
- h as createAlertAgent
12
+ l as useLocalStorage
27
13
  };
@@ -1,41 +1,27 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { hash as r } from "@companix/utils-js";
3
- import { Viewport as a } from "./bundle.es59.js";
4
- import { useRef as c, useMemo as h } from "react";
5
- const m = (i = {}) => {
6
- const o = {
7
- showToast: (e) => {
8
- console.error("uninitialized", e);
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { hash as m } from "@companix/utils-js";
3
+ import { useRef as n, useMemo as s } from "react";
4
+ import { Viewport as u } from "./bundle.es58.js";
5
+ const h = (t = {}) => {
6
+ const e = {
7
+ emit: (r) => {
8
+ console.error("uninitialized", r);
9
9
  }
10
10
  };
11
11
  return {
12
- api: {
13
- show: (e) => {
14
- const n = e.id ?? r();
15
- return o.showToast({ ...e, id: n }), n;
16
- }
12
+ show: (r) => {
13
+ e.emit({ ...r, id: m() });
17
14
  },
18
- Viewport: (e = {}) => {
19
- const n = c(null);
20
- return h(() => {
21
- o.showToast = (s) => {
22
- n.current && n.current.showToast(s);
15
+ Viewport: () => {
16
+ const r = n(null);
17
+ return s(() => {
18
+ e.emit = (o) => {
19
+ r.current && r.current.showAlert(o);
23
20
  };
24
- }, []), /* @__PURE__ */ t(
25
- a,
26
- {
27
- ref: n,
28
- align: e.align ?? i.align,
29
- closeIcon: e.closeIcon ?? i.closeIcon,
30
- duration: e.duration ?? i.duration,
31
- gap: e.gap ?? i.gap,
32
- side: e.side ?? i.side,
33
- swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
34
- }
35
- );
21
+ }, []), /* @__PURE__ */ i(u, { ref: r, ...t });
36
22
  }
37
23
  };
38
24
  };
39
25
  export {
40
- m as createToaster
26
+ h as createAlertAgent
41
27
  };