@companix/uikit 0.0.76 → 0.0.77

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 (47) hide show
  1. package/dist/__helpers/createScope.d.ts +13 -0
  2. package/dist/bundle.es.js +2 -0
  3. package/dist/bundle.es12.js +4 -4
  4. package/dist/bundle.es13.js +3 -3
  5. package/dist/bundle.es14.js +2 -2
  6. package/dist/bundle.es16.js +1 -1
  7. package/dist/bundle.es2.js +1 -1
  8. package/dist/bundle.es21.js +1 -1
  9. package/dist/bundle.es22.js +1 -1
  10. package/dist/bundle.es23.js +1 -1
  11. package/dist/bundle.es24.js +1 -1
  12. package/dist/bundle.es25.js +1 -1
  13. package/dist/bundle.es27.js +1 -1
  14. package/dist/bundle.es28.js +4 -4
  15. package/dist/bundle.es29.js +2 -2
  16. package/dist/bundle.es32.js +2 -2
  17. package/dist/bundle.es36.js +1 -1
  18. package/dist/bundle.es40.js +1 -1
  19. package/dist/bundle.es41.js +1 -1
  20. package/dist/bundle.es42.js +1 -1
  21. package/dist/bundle.es45.js +19 -24
  22. package/dist/bundle.es46.js +25 -23
  23. package/dist/bundle.es47.js +22 -23
  24. package/dist/bundle.es48.js +24 -88
  25. package/dist/bundle.es49.js +88 -18
  26. package/dist/bundle.es50.js +17 -92
  27. package/dist/bundle.es51.js +92 -73
  28. package/dist/bundle.es52.js +73 -23
  29. package/dist/bundle.es53.js +20 -35
  30. package/dist/bundle.es54.js +39 -5
  31. package/dist/bundle.es55.js +5 -14
  32. package/dist/bundle.es56.js +13 -13
  33. package/dist/bundle.es57.js +13 -69
  34. package/dist/bundle.es58.js +68 -66
  35. package/dist/bundle.es59.js +67 -10
  36. package/dist/bundle.es60.js +10 -42
  37. package/dist/bundle.es61.js +42 -14
  38. package/dist/bundle.es62.js +15 -32
  39. package/dist/bundle.es63.js +23 -61
  40. package/dist/bundle.es64.js +70 -75
  41. package/dist/bundle.es65.js +13 -48
  42. package/dist/bundle.es66.js +74 -13
  43. package/dist/bundle.es67.js +48 -13
  44. package/dist/bundle.es68.js +16 -0
  45. package/dist/bundle.es9.js +1 -1
  46. package/dist/index.d.ts +1 -0
  47. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ interface ProviderChildren<T> {
2
+ children: React.ReactNode;
3
+ initialValue?: T;
4
+ }
5
+ type Scope<T> = [T, React.Dispatch<React.SetStateAction<T>>];
6
+ type ScopeProvider<T> = (props: ProviderChildren<T>) => JSX.Element;
7
+ type Setter<T> = (value: React.SetStateAction<T>) => void;
8
+ export declare const createScope: <T>(defaultValue: T) => [ScopeProvider<T>, () => Scope<T>, Setter<T>];
9
+ export declare const createStaticScope: <T>(defaultValue: T) => [(props: {
10
+ children: React.ReactNode;
11
+ value: T;
12
+ }) => JSX.Element, () => T];
13
+ export {};
package/dist/bundle.es.js CHANGED
@@ -41,6 +41,7 @@ import { createToaster as yo } from "./bundle.es41.js";
41
41
  import { Toast as Go } from "./bundle.es42.js";
42
42
  import { DialogShell as Oo, createDialogsRegistry as Fo } from "./bundle.es43.js";
43
43
  import { createPopoversRegistry as No } from "./bundle.es44.js";
44
+ import { createScope as qo } from "./bundle.es45.js";
44
45
  export {
45
46
  Q as AlertDialog,
46
47
  e as Avatar,
@@ -85,6 +86,7 @@ export {
85
86
  Ro as createAlertAgent,
86
87
  Fo as createDialogsRegistry,
87
88
  No as createPopoversRegistry,
89
+ qo as createScope,
88
90
  yo as createToaster,
89
91
  bo as useBooleanState,
90
92
  Ao as useLocalStorage,
@@ -1,10 +1,10 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { useRef as L, useMemo as j, useImperativeHandle as k } from "react";
3
3
  import { Popover as q } from "./bundle.es10.js";
4
- import { useFroozeClosing as w } from "./bundle.es47.js";
5
- import { SelectInput as H } from "./bundle.es48.js";
6
- import { useScrollListController as M } from "./bundle.es49.js";
7
- import { OptionsPopover as N } from "./bundle.es50.js";
4
+ import { useFroozeClosing as w } from "./bundle.es48.js";
5
+ import { SelectInput as H } from "./bundle.es49.js";
6
+ import { useScrollListController as M } from "./bundle.es50.js";
7
+ import { OptionsPopover as N } from "./bundle.es51.js";
8
8
  import { mergeRefs as W } from "react-merge-refs";
9
9
  const Z = (t) => {
10
10
  const {
@@ -3,12 +3,12 @@ import { mergeRefs as T } from "react-merge-refs";
3
3
  import { useState as M, useRef as h, useMemo as j } from "react";
4
4
  import { matchPattern as q } from "@companix/utils-js";
5
5
  import { faXmark as V, faChevronDown as $ } from "@companix/icons-solid";
6
- import { useFroozeClosing as B } from "./bundle.es47.js";
6
+ import { useFroozeClosing as B } from "./bundle.es48.js";
7
7
  import { Popover as L } from "./bundle.es10.js";
8
8
  import { Icon as g } from "./bundle.es33.js";
9
9
  import { attr as l, getActiveElementByAnotherElement as X, contains as G } from "@companix/utils-browser";
10
- import { OptionsPopover as H } from "./bundle.es50.js";
11
- import { arrays as v } from "./bundle.es51.js";
10
+ import { OptionsPopover as H } from "./bundle.es51.js";
11
+ import { arrays as v } from "./bundle.es52.js";
12
12
  const ne = (r) => {
13
13
  const {
14
14
  closeAfterSelect: C,
@@ -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.es52.js";
5
- import { InputContainer as I } from "./bundle.es53.js";
4
+ import { InputElement as x } from "./bundle.es53.js";
5
+ import { InputContainer as I } from "./bundle.es54.js";
6
6
  import g from "classnames";
7
7
  const N = b(
8
8
  ({
@@ -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.es53.js";
5
+ import { InputContainer as F } from "./bundle.es54.js";
6
6
  import { NumericFormat as V } from "react-number-format";
7
7
  const D = j(
8
8
  ({
@@ -1,6 +1,6 @@
1
1
  import { jsxs as I, jsx as a } from "react/jsx-runtime";
2
2
  import { box as g } from "@companix/utils-browser";
3
- import { getInitialsFontSize as h } from "./bundle.es45.js";
3
+ import { getInitialsFontSize as h } from "./bundle.es46.js";
4
4
  const k = 24, y = ({
5
5
  alt: n,
6
6
  crossOrigin: i,
@@ -3,7 +3,7 @@ import d from "classnames";
3
3
  import * as e from "@radix-ui/react-dialog";
4
4
  import { VisuallyHidden as i } from "@radix-ui/react-visually-hidden";
5
5
  import { customCSS as p } from "@companix/utils-browser";
6
- import { RemoveListener as f } from "./bundle.es54.js";
6
+ import { RemoveListener as f } from "./bundle.es55.js";
7
7
  const h = ({
8
8
  open: t,
9
9
  onClosed: l,
@@ -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.es54.js";
5
+ import { RemoveListener as v } from "./bundle.es55.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.es4.js";
4
- import { RemoveListener as N } from "./bundle.es54.js";
4
+ import { RemoveListener as N } from "./bundle.es55.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.es4.js";
3
- import { useLoading as p } from "./bundle.es55.js";
3
+ import { useLoading as p } from "./bundle.es56.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 a, jsxs as d } from "react/jsx-runtime";
2
- import { useTabSlider as b, makeTabId as l } from "./bundle.es46.js";
2
+ import { useTabSlider as b, makeTabId as l } from "./bundle.es47.js";
3
3
  import * as n from "@radix-ui/react-tabs";
4
4
  import { useRef as m, useId as f, createContext as T, useContext as c } from "react";
5
5
  const o = T({ baseId: "", containerRef: {} }), u = ({ children: s, value: e, onChange: r }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es56.js";
2
+ import { useResizeTextarea as x } from "./bundle.es57.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";
@@ -2,11 +2,11 @@ import { jsx as u } from "react/jsx-runtime";
2
2
  import { Popover as T } from "./bundle.es10.js";
3
3
  import { Input as w } from "./bundle.es14.js";
4
4
  import { useState as A, useRef as j } from "react";
5
- import { Calendar as E } from "./bundle.es57.js";
6
- import { useDayDisableCheker as N } from "./bundle.es58.js";
5
+ import { Calendar as E } from "./bundle.es58.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es59.js";
7
7
  import { getNum as h, formatTime as v } from "@companix/utils-js";
8
- import { removeDigits as O } from "./bundle.es51.js";
9
- import { SelectRightElements as Y } from "./bundle.es59.js";
8
+ import { removeDigits as O } from "./bundle.es52.js";
9
+ import { SelectRightElements as Y } from "./bundle.es60.js";
10
10
  const i = {
11
11
  char: "-",
12
12
  toString: (e) => {
@@ -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.es12.js";
4
- import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es51.js";
5
- import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es60.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es52.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es61.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 b, useMemo as I, useState as E, useCallback as A } from "react";
3
3
  import { getNum as S } from "@companix/utils-js";
4
- import { getTimesOptions as W, getTimeValue as q, removeDigits as w, convertTimeToOption as y } from "./bundle.es51.js";
5
- import { SelectRightElements as z } from "./bundle.es59.js";
4
+ import { getTimesOptions as W, getTimeValue as q, removeDigits as w, convertTimeToOption as y } from "./bundle.es52.js";
5
+ import { SelectRightElements as z } from "./bundle.es60.js";
6
6
  import { Select as F } from "./bundle.es12.js";
7
7
  import { Input as G } from "./bundle.es14.js";
8
8
  const o = {
@@ -1,6 +1,6 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
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.es61.js";
3
+ import { getColorScheme as v, updateDOM as m } from "./bundle.es62.js";
4
4
  const i = f({
5
5
  setColorScheme: () => {
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { hash as m } from "@companix/utils-js";
3
3
  import { useRef as n, useMemo as s } from "react";
4
- import { Viewport as p } from "./bundle.es62.js";
4
+ import { Viewport as p } from "./bundle.es63.js";
5
5
  const a = (t = {}) => {
6
6
  const e = {
7
7
  emit: (r) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { hash as r } from "@companix/utils-js";
3
- import { Viewport as a } from "./bundle.es63.js";
3
+ import { Viewport as a } from "./bundle.es64.js";
4
4
  import { useRef as c, useMemo as h } from "react";
5
5
  const m = (i = {}) => {
6
6
  const o = {
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-toast";
3
3
  import { attr as T } from "@companix/utils-browser";
4
4
  import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
5
- import { RemoveListener as I } from "./bundle.es54.js";
5
+ import { RemoveListener as I } from "./bundle.es55.js";
6
6
  const m = (o) => {
7
7
  const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
8
8
  appearance: C = "neutral",
@@ -1,27 +1,22 @@
1
- const _ = (e) => {
2
- if (e <= 16)
3
- return 5;
4
- if (e <= 24)
5
- return 8;
6
- if (e <= 32)
7
- return 10;
8
- if (e <= 36)
9
- return 13;
10
- if (e <= 44)
11
- return 14;
12
- if (e <= 48)
13
- return 17;
14
- if (e < 56)
15
- return 18;
16
- if (e <= 64)
17
- return 21;
18
- if (e <= 88)
19
- return 26;
20
- if (e <= 96)
21
- return 30;
22
- const n = Math.ceil(e * 0.3125), E = n % 2;
23
- return n + E;
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createContext as a, useState as l, useMemo as v, useContext as p } from "react";
3
+ const S = (o) => {
4
+ const r = a({
5
+ value: o,
6
+ setValue: () => {
7
+ }
8
+ }), s = { setValue: () => {
9
+ } };
10
+ return [({ initialValue: e, children: t }) => {
11
+ const [c, u] = l(e ?? o);
12
+ return v(() => {
13
+ s.setValue = u;
14
+ }, []), /* @__PURE__ */ n(r.Provider, { value: { value: c, setValue: u }, children: t });
15
+ }, () => {
16
+ const { value: e, setValue: t } = p(r);
17
+ return [e, t];
18
+ }, (e) => s.setValue(e)];
24
19
  };
25
20
  export {
26
- _ as getInitialsFontSize
21
+ S as createScope
27
22
  };
@@ -1,25 +1,27 @@
1
- import { useState as u, useEffect as d } from "react";
2
- const v = ({ baseId: r, value: e, containerRef: o }) => {
3
- const [l, n] = u({});
4
- return d(() => {
5
- const t = { observer: null };
6
- if (o.current) {
7
- const c = `#${h(r, e)}`, s = o.current.querySelector(c);
8
- s != null ? (t.observer = new ResizeObserver(() => {
9
- const { clientHeight: i, clientWidth: a, offsetLeft: f, offsetTop: b } = s;
10
- n({
11
- width: a,
12
- height: i,
13
- transform: `translateX(${Math.floor(f)}px) translateY(${Math.floor(b)}px)`
14
- });
15
- }), t.observer.observe(s)) : n({ display: "none" });
16
- }
17
- return () => {
18
- t.observer && t.observer.disconnect();
19
- };
20
- }, [e]), l;
21
- }, h = (r, e) => `uikit-tab-${r}-trigger-${e}`;
1
+ const _ = (e) => {
2
+ if (e <= 16)
3
+ return 5;
4
+ if (e <= 24)
5
+ return 8;
6
+ if (e <= 32)
7
+ return 10;
8
+ if (e <= 36)
9
+ return 13;
10
+ if (e <= 44)
11
+ return 14;
12
+ if (e <= 48)
13
+ return 17;
14
+ if (e < 56)
15
+ return 18;
16
+ if (e <= 64)
17
+ return 21;
18
+ if (e <= 88)
19
+ return 26;
20
+ if (e <= 96)
21
+ return 30;
22
+ const n = Math.ceil(e * 0.3125), E = n % 2;
23
+ return n + E;
24
+ };
22
25
  export {
23
- h as makeTabId,
24
- v as useTabSlider
26
+ _ as getInitialsFontSize
25
27
  };
@@ -1,26 +1,25 @@
1
- import { useRef as s, useCallback as c } from "react";
2
- const p = () => {
3
- const t = s(null), r = s({ cb: null }), i = c(() => {
4
- if (t.current && t.current.parentElement) {
5
- const e = t.current.parentElement, u = e.style.getPropertyValue("--radix-popper-anchor-width"), n = e.style.getPropertyValue("transform"), o = new MutationObserver(() => {
6
- e.style.transform !== n && e.style.setProperty("transform", n);
7
- });
8
- o.observe(e, {
9
- attributes: !0,
10
- attributeFilter: ["style"]
11
- }), r.current.cb = () => {
12
- o.disconnect();
13
- }, t.current.style.setProperty("--radix-popover-trigger-width", u);
1
+ import { useState as u, useEffect as d } from "react";
2
+ const v = ({ baseId: r, value: e, containerRef: o }) => {
3
+ const [l, n] = u({});
4
+ return d(() => {
5
+ const t = { observer: null };
6
+ if (o.current) {
7
+ const c = `#${h(r, e)}`, s = o.current.querySelector(c);
8
+ s != null ? (t.observer = new ResizeObserver(() => {
9
+ const { clientHeight: i, clientWidth: a, offsetLeft: f, offsetTop: b } = s;
10
+ n({
11
+ width: a,
12
+ height: i,
13
+ transform: `translateX(${Math.floor(f)}px) translateY(${Math.floor(b)}px)`
14
+ });
15
+ }), t.observer.observe(s)) : n({ display: "none" });
14
16
  }
15
- }, []), l = c(() => {
16
- r.current.cb && (r.current.cb(), r.current.cb = null);
17
- }, []);
18
- return {
19
- popoverRef: t,
20
- handleAnimationEnd: l,
21
- froozePopoverPosition: i
22
- };
23
- };
17
+ return () => {
18
+ t.observer && t.observer.disconnect();
19
+ };
20
+ }, [e]), l;
21
+ }, h = (r, e) => `uikit-tab-${r}-trigger-${e}`;
24
22
  export {
25
- p as useFroozeClosing
23
+ h as makeTabId,
24
+ v as useTabSlider
26
25
  };
@@ -1,90 +1,26 @@
1
- import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
- import w from "classnames";
3
- import { attr as s } from "@companix/utils-browser";
4
- import { forwardRef as y, useRef as D, useCallback as S } from "react";
5
- import { VisuallyHidden as T } from "@radix-ui/react-visually-hidden";
6
- import { mergeRefs as j } from "react-merge-refs";
7
- import { SelectRightElements as z } from "./bundle.es59.js";
8
- const W = y(
9
- ({
10
- required: a,
11
- size: i,
12
- fill: u,
13
- leftElement: l,
14
- className: d,
15
- value: c,
16
- clearButton: m,
17
- placeholder: p,
18
- clearButtonIcon: f,
19
- disabled: r,
20
- onClear: h,
21
- inputRef: C,
22
- onClick: I,
23
- ...N
24
- }, k) => {
25
- const e = D(null), v = S(
26
- (t) => {
27
- if (!e.current || !document)
28
- return;
29
- t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
30
- },
31
- [e]
32
- ), F = (t) => {
33
- document && document.activeElement === e.current && t.preventDefault();
34
- }, g = (t) => {
35
- r || v(t);
36
- }, R = (t) => {
37
- F(t);
38
- }, x = (t) => {
39
- e.current && e.current.focus(), h?.(t);
40
- };
41
- return /* @__PURE__ */ o(
42
- "div",
43
- {
44
- ref: k,
45
- className: w("form select", d),
46
- "data-size": i ?? "md",
47
- "data-fill": s(u),
48
- "data-required": s(a),
49
- "data-disabled": s(r),
50
- onMouseDown: R,
51
- onClick: g,
52
- ...N,
53
- children: [
54
- /* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
55
- l && /* @__PURE__ */ n("div", { className: "select-element", children: l }),
56
- /* @__PURE__ */ n("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
57
- !c && /* @__PURE__ */ n("span", { className: "select-placeholder", children: p }),
58
- c
59
- ] }) }),
60
- /* @__PURE__ */ n("div", { className: "select-element", children: /* @__PURE__ */ n(
61
- z,
62
- {
63
- clearButton: m,
64
- value: !!c,
65
- clearButtonIcon: f,
66
- onClear: x
67
- }
68
- ) })
69
- ] }),
70
- /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
71
- "input",
72
- {
73
- ref: j([C, e]),
74
- autoComplete: "off",
75
- autoCapitalize: "none",
76
- autoCorrect: "off",
77
- spellCheck: "false",
78
- "aria-autocomplete": "none",
79
- onClick: I,
80
- readOnly: !0
81
- }
82
- ) })
83
- ]
84
- }
85
- );
86
- }
87
- );
1
+ import { useRef as s, useCallback as c } from "react";
2
+ const p = () => {
3
+ const t = s(null), r = s({ cb: null }), i = c(() => {
4
+ if (t.current && t.current.parentElement) {
5
+ const e = t.current.parentElement, u = e.style.getPropertyValue("--radix-popper-anchor-width"), n = e.style.getPropertyValue("transform"), o = new MutationObserver(() => {
6
+ e.style.transform !== n && e.style.setProperty("transform", n);
7
+ });
8
+ o.observe(e, {
9
+ attributes: !0,
10
+ attributeFilter: ["style"]
11
+ }), r.current.cb = () => {
12
+ o.disconnect();
13
+ }, t.current.style.setProperty("--radix-popover-trigger-width", u);
14
+ }
15
+ }, []), l = c(() => {
16
+ r.current.cb && (r.current.cb(), r.current.cb = null);
17
+ }, []);
18
+ return {
19
+ popoverRef: t,
20
+ handleAnimationEnd: l,
21
+ froozePopoverPosition: i
22
+ };
23
+ };
88
24
  export {
89
- W as SelectInput
25
+ p as useFroozeClosing
90
26
  };
@@ -1,20 +1,90 @@
1
- import { useRef as u, useCallback as T } from "react";
2
- const g = () => {
3
- const l = u(null), t = u(null);
4
- return { scrollToElement: T(
5
- (r, f) => {
6
- const o = l.current, s = t.current;
7
- if (!o || !s || r < 0 || r > s.children.length)
8
- return;
9
- const c = s.children[r];
10
- if (!c)
11
- return;
12
- const n = o.offsetHeight, i = o.scrollTop, e = c.offsetTop, p = c.offsetHeight;
13
- f === "center" ? o.scrollTop = e - n / 2 + p / 2 : f === "top" ? o.scrollTop = e : e + p > n + i ? o.scrollTop = e - n + p : e < i && (o.scrollTop = e);
14
- },
15
- [t, l]
16
- ), scrollBoxRef: l, optionsWrapperRef: t };
17
- };
1
+ import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
+ import w from "classnames";
3
+ import { attr as s } from "@companix/utils-browser";
4
+ import { forwardRef as y, useRef as D, useCallback as S } from "react";
5
+ import { VisuallyHidden as T } from "@radix-ui/react-visually-hidden";
6
+ import { mergeRefs as j } from "react-merge-refs";
7
+ import { SelectRightElements as z } from "./bundle.es60.js";
8
+ const W = y(
9
+ ({
10
+ required: a,
11
+ size: i,
12
+ fill: u,
13
+ leftElement: l,
14
+ className: d,
15
+ value: c,
16
+ clearButton: m,
17
+ placeholder: p,
18
+ clearButtonIcon: f,
19
+ disabled: r,
20
+ onClear: h,
21
+ inputRef: C,
22
+ onClick: I,
23
+ ...N
24
+ }, k) => {
25
+ const e = D(null), v = S(
26
+ (t) => {
27
+ if (!e.current || !document)
28
+ return;
29
+ t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
30
+ },
31
+ [e]
32
+ ), F = (t) => {
33
+ document && document.activeElement === e.current && t.preventDefault();
34
+ }, g = (t) => {
35
+ r || v(t);
36
+ }, R = (t) => {
37
+ F(t);
38
+ }, x = (t) => {
39
+ e.current && e.current.focus(), h?.(t);
40
+ };
41
+ return /* @__PURE__ */ o(
42
+ "div",
43
+ {
44
+ ref: k,
45
+ className: w("form select", d),
46
+ "data-size": i ?? "md",
47
+ "data-fill": s(u),
48
+ "data-required": s(a),
49
+ "data-disabled": s(r),
50
+ onMouseDown: R,
51
+ onClick: g,
52
+ ...N,
53
+ children: [
54
+ /* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
55
+ l && /* @__PURE__ */ n("div", { className: "select-element", children: l }),
56
+ /* @__PURE__ */ n("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
57
+ !c && /* @__PURE__ */ n("span", { className: "select-placeholder", children: p }),
58
+ c
59
+ ] }) }),
60
+ /* @__PURE__ */ n("div", { className: "select-element", children: /* @__PURE__ */ n(
61
+ z,
62
+ {
63
+ clearButton: m,
64
+ value: !!c,
65
+ clearButtonIcon: f,
66
+ onClear: x
67
+ }
68
+ ) })
69
+ ] }),
70
+ /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
71
+ "input",
72
+ {
73
+ ref: j([C, e]),
74
+ autoComplete: "off",
75
+ autoCapitalize: "none",
76
+ autoCorrect: "off",
77
+ spellCheck: "false",
78
+ "aria-autocomplete": "none",
79
+ onClick: I,
80
+ readOnly: !0
81
+ }
82
+ ) })
83
+ ]
84
+ }
85
+ );
86
+ }
87
+ );
18
88
  export {
19
- g as useScrollListController
89
+ W as SelectInput
20
90
  };