@companix/uikit 0.0.39 → 0.0.40

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 (42) hide show
  1. package/dist/Segments/Segments.scss +14 -14
  2. package/dist/__hooks/use-tab-slider.d.ts +7 -0
  3. package/dist/bundle.es12.js +4 -4
  4. package/dist/bundle.es13.js +2 -2
  5. package/dist/bundle.es15.js +1 -1
  6. package/dist/bundle.es21.js +1 -1
  7. package/dist/bundle.es22.js +1 -1
  8. package/dist/bundle.es23.js +1 -1
  9. package/dist/bundle.es24.js +17 -32
  10. package/dist/bundle.es26.js +1 -1
  11. package/dist/bundle.es27.js +1 -1
  12. package/dist/bundle.es28.js +4 -4
  13. package/dist/bundle.es29.js +2 -2
  14. package/dist/bundle.es32.js +2 -2
  15. package/dist/bundle.es35.js +1 -1
  16. package/dist/bundle.es38.js +1 -1
  17. package/dist/bundle.es39.js +1 -1
  18. package/dist/bundle.es40.js +1 -1
  19. package/dist/bundle.es44.js +22 -23
  20. package/dist/bundle.es45.js +24 -87
  21. package/dist/bundle.es46.js +87 -18
  22. package/dist/bundle.es47.js +16 -18
  23. package/dist/bundle.es48.js +20 -24
  24. package/dist/bundle.es49.js +20 -35
  25. package/dist/bundle.es50.js +39 -5
  26. package/dist/bundle.es51.js +5 -14
  27. package/dist/bundle.es52.js +13 -13
  28. package/dist/bundle.es53.js +13 -69
  29. package/dist/bundle.es54.js +68 -66
  30. package/dist/bundle.es55.js +67 -69
  31. package/dist/bundle.es56.js +69 -10
  32. package/dist/bundle.es57.js +10 -42
  33. package/dist/bundle.es58.js +42 -14
  34. package/dist/bundle.es59.js +15 -32
  35. package/dist/bundle.es60.js +23 -61
  36. package/dist/bundle.es61.js +69 -13
  37. package/dist/bundle.es62.js +13 -74
  38. package/dist/bundle.es63.js +71 -45
  39. package/dist/bundle.es64.js +48 -13
  40. package/dist/bundle.es65.js +16 -0
  41. package/dist/bundle.es9.js +16 -13
  42. package/package.json +2 -2
@@ -3,13 +3,13 @@
3
3
  .segments {
4
4
  position: relative;
5
5
  display: flex;
6
- width: 100%;
7
6
  height: 100%;
8
7
  border-radius: inherit;
9
8
  transition: all 100ms ease-out;
10
9
 
10
+ @include mixins.use-styles(segment-control);
11
+
11
12
  &-container {
12
- width: 100%;
13
13
  box-sizing: border-box;
14
14
 
15
15
  @include mixins.use-styles(segment-control, container);
@@ -20,11 +20,7 @@
20
20
  top: 0;
21
21
  bottom: 0;
22
22
  left: 0;
23
- width: calc(100% / var(--uikit--options));
24
23
  border-radius: inherit;
25
- transform: translateX(calc(var(--uikit--current-index) * 100%));
26
- transform-origin: 0 0;
27
- transition: transform 150ms;
28
24
 
29
25
  @include mixins.use-styles(segment-control, slider);
30
26
  }
@@ -33,9 +29,7 @@
33
29
  position: relative;
34
30
  box-sizing: border-box;
35
31
  display: flex;
36
- flex: 1;
37
32
  align-items: center;
38
- justify-content: center;
39
33
  height: 100%;
40
34
  cursor: pointer;
41
35
  user-select: none;
@@ -44,14 +38,20 @@
44
38
  border-radius: inherit;
45
39
  transition: color 100ms ease-out;
46
40
 
47
- &:not([data-active]):hover {
48
- @include mixins.use-styles(segment-control, option, hover);
49
- }
41
+ @include mixins.use-styles(segment-control, option);
50
42
 
51
- &:not([data-active]):active {
52
- @include mixins.use-styles(segment-control, option, active);
43
+ &:not([data-selected]) {
44
+ &:hover {
45
+ @include mixins.use-styles(segment-control, option, hover);
46
+ }
47
+
48
+ &:active {
49
+ @include mixins.use-styles(segment-control, option, active);
50
+ }
53
51
  }
54
52
 
55
- @include mixins.use-styles(segment-control, option);
53
+ &[data-selected] {
54
+ @include mixins.use-styles(segment-control, option, selected);
55
+ }
56
56
  }
57
57
  }
@@ -0,0 +1,7 @@
1
+ export interface SliderOptions {
2
+ baseId: string;
3
+ value: string | number;
4
+ containerRef: React.RefObject<HTMLDivElement>;
5
+ }
6
+ export declare const useTabSlider: ({ baseId, value, containerRef }: SliderOptions) => import('react').CSSProperties;
7
+ export declare const makeTabId: (baseId: string, value: string | number) => string;
@@ -1,10 +1,10 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { useMemo as F, useImperativeHandle as I } from "react";
3
3
  import { Popover as T } from "./bundle.es10.js";
4
- import { useFroozeClosing as b } from "./bundle.es44.js";
5
- import { SelectInput as z } from "./bundle.es45.js";
6
- import { useScrollListController as B } from "./bundle.es46.js";
7
- import { SelectOptions as D } from "./bundle.es47.js";
4
+ import { useFroozeClosing as b } from "./bundle.es45.js";
5
+ import { SelectInput as z } from "./bundle.es46.js";
6
+ import { useScrollListController as B } from "./bundle.es47.js";
7
+ import { SelectOptions as D } from "./bundle.es48.js";
8
8
  import { mergeRefs as j } from "react-merge-refs";
9
9
  const G = (a) => {
10
10
  const {
@@ -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.es48.js";
5
- import { InputContainer as I } from "./bundle.es49.js";
4
+ import { InputElement as x } from "./bundle.es49.js";
5
+ import { InputContainer as I } from "./bundle.es50.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.es49.js";
5
+ import { InputContainer as F } from "./bundle.es50.js";
6
6
  import { NumericFormat as V } from "react-number-format";
7
7
  const D = j(
8
8
  ({
@@ -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.es50.js";
5
+ import { RemoveListener as v } from "./bundle.es51.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.es50.js";
4
+ import { RemoveListener as N } from "./bundle.es51.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.es51.js";
3
+ import { useLoading as p } from "./bundle.es52.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,36 +1,21 @@
1
- import { jsx as n, jsxs as T } from "react/jsx-runtime";
2
- import * as c from "@radix-ui/react-tabs";
3
- import { useRef as g, useId as p, createContext as v, useState as I, useContext as d, useEffect as R } from "react";
4
- const l = v({ baseId: "", listRef: {} }), b = (t, e) => `radix-${t}-trigger-${e}`, y = ({ children: t, value: e, onChange: s }) => {
5
- const r = g(null), o = p();
6
- return /* @__PURE__ */ n(c.Root, { value: e, onValueChange: s, children: /* @__PURE__ */ n(l.Provider, { value: { baseId: o, listRef: r }, children: /* @__PURE__ */ T(c.List, { className: "tabs", ref: r, children: [
7
- /* @__PURE__ */ n($, { value: e }),
8
- t
1
+ import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
+ import { useTabSlider as b, makeTabId as l } from "./bundle.es44.js";
3
+ import * as n from "@radix-ui/react-tabs";
4
+ import { useRef as m, useId as f, createContext as T, useContext as c } from "react";
5
+ const o = T({ baseId: "", containerRef: {} }), u = ({ children: s, value: e, onChange: r }) => {
6
+ const t = m(null), i = f().replaceAll(":", "");
7
+ return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: r, children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ d(n.List, { className: "tabs", ref: t, children: [
8
+ /* @__PURE__ */ a(x, { value: e }),
9
+ s
9
10
  ] }) }) });
10
- }, $ = ({ value: t }) => {
11
- const [e, s] = I({}), { baseId: r, listRef: o } = d(l);
12
- return R(() => {
13
- const a = { observer: null };
14
- if (o.current) {
15
- const f = `.tab[id="${b(r, t)}"]`, i = o.current.querySelector(f);
16
- i != null ? (a.observer = new ResizeObserver(() => {
17
- const { clientHeight: u, clientWidth: m, offsetLeft: h, offsetTop: x } = i;
18
- s({
19
- height: u,
20
- transform: `translateX(${Math.floor(h)}px) translateY(${Math.floor(x)}px)`,
21
- width: m
22
- });
23
- }), a.observer.observe(i)) : s({ display: "none" });
24
- }
25
- return () => {
26
- a.observer && a.observer.disconnect();
27
- };
28
- }, [t]), /* @__PURE__ */ n("div", { className: "tab-indicator-container", style: e, children: /* @__PURE__ */ n("div", { className: "tab-indicator" }) });
29
- }, C = ({ children: t, value: e, ...s }) => {
30
- const { baseId: r } = d(l), o = b(r, e);
31
- return /* @__PURE__ */ n(c.Trigger, { ...s, id: o, className: "tab", value: e, children: t });
11
+ }, x = ({ value: s }) => {
12
+ const { baseId: e, containerRef: r } = c(o), t = b({ baseId: e, value: s, containerRef: r });
13
+ return /* @__PURE__ */ a("div", { className: "tab-indicator-container", style: t, children: /* @__PURE__ */ a("div", { className: "tab-indicator" }) });
14
+ }, I = ({ children: s, value: e, ...r }) => {
15
+ const { baseId: t } = c(o);
16
+ return /* @__PURE__ */ a(n.Trigger, { ...r, id: l(t, e), className: "tab", value: e, children: s });
32
17
  };
33
- y.Tab = C;
18
+ u.Tab = I;
34
19
  export {
35
- y as Tabs
20
+ u as Tabs
36
21
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es52.js";
2
+ import { useResizeTextarea as x } from "./bundle.es53.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,5 +1,5 @@
1
1
  import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
- import { useFroozeClosing as M } from "./bundle.es44.js";
2
+ import { useFroozeClosing as M } from "./bundle.es45.js";
3
3
  import { Popover as j } from "./bundle.es10.js";
4
4
  import { OptionItem as q } from "./bundle.es14.js";
5
5
  import { OptionsList as V } from "./bundle.es16.js";
@@ -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.es13.js";
4
4
  import { useState as A, useRef as j } from "react";
5
- import { Calendar as E } from "./bundle.es53.js";
6
- import { useDayDisableCheker as N } from "./bundle.es54.js";
5
+ import { Calendar as E } from "./bundle.es54.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es55.js";
7
7
  import { getNum as h, formatTime as v } from "@companix/utils-js";
8
- import { removeDigits as O } from "./bundle.es55.js";
9
- import { SelectRightElements as Y } from "./bundle.es56.js";
8
+ import { removeDigits as O } from "./bundle.es56.js";
9
+ import { SelectRightElements as Y } from "./bundle.es57.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.es55.js";
5
- import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es57.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es56.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es58.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.es55.js";
5
- import { SelectRightElements as w } from "./bundle.es56.js";
4
+ import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es56.js";
5
+ import { SelectRightElements as w } from "./bundle.es57.js";
6
6
  import { Select as y } from "./bundle.es12.js";
7
7
  import { Input as z } from "./bundle.es13.js";
8
8
  const r = {
@@ -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.es58.js";
3
+ import { getColorScheme as v, updateDOM as m } from "./bundle.es59.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.es59.js";
4
+ import { Viewport as p } from "./bundle.es60.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.es60.js";
3
+ import { Viewport as a } from "./bundle.es61.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.es50.js";
5
+ import { RemoveListener as I } from "./bundle.es51.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,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,89 +1,26 @@
1
- import { jsxs as o, jsx as c } from "react/jsx-runtime";
2
- import A from "classnames";
3
- import { attr as l } from "@companix/utils-browser";
4
- import { forwardRef as y, useRef as S, useCallback as T } from "react";
5
- import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
6
- import { mergeRefs as w } from "react-merge-refs";
7
- import { SelectRightElements as z } from "./bundle.es56.js";
8
- const V = y(
9
- ({
10
- required: a,
11
- size: u,
12
- fill: d,
13
- leftElement: s,
14
- className: m,
15
- value: n,
16
- clearButton: f,
17
- placeholder: p,
18
- clearButtonIcon: h,
19
- disabled: r,
20
- onClear: C,
21
- inputRef: I,
22
- ...i
23
- }, k) => {
24
- const e = S(null), N = T(
25
- (t) => {
26
- if (!e.current || !document)
27
- return;
28
- t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
29
- },
30
- [e]
31
- ), v = (t) => {
32
- document && document.activeElement === e.current && t.preventDefault();
33
- }, F = (t) => {
34
- r || N(t);
35
- }, g = (t) => {
36
- v(t);
37
- }, R = (t) => {
38
- e.current && e.current.focus(), C?.(t);
39
- };
40
- return /* @__PURE__ */ o(
41
- "div",
42
- {
43
- ref: k,
44
- className: A("form select", m),
45
- "data-size": u ?? "md",
46
- "data-fill": l(d),
47
- "data-required": l(a),
48
- "data-disabled": l(r),
49
- onMouseDown: g,
50
- ...i,
51
- onClick: F,
52
- children: [
53
- /* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
54
- s && /* @__PURE__ */ c("div", { className: "select-element", children: s }),
55
- /* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
56
- !n && /* @__PURE__ */ c("span", { className: "select-placeholder", children: p }),
57
- n
58
- ] }) }),
59
- /* @__PURE__ */ c("div", { className: "select-element", children: /* @__PURE__ */ c(
60
- z,
61
- {
62
- clearButton: f,
63
- value: !!n,
64
- clearButtonIcon: h,
65
- onClear: R
66
- }
67
- ) })
68
- ] }),
69
- /* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
70
- "input",
71
- {
72
- ref: w([I, e]),
73
- autoComplete: "off",
74
- autoCapitalize: "none",
75
- autoCorrect: "off",
76
- spellCheck: "false",
77
- "aria-autocomplete": "none",
78
- onClick: i.onClick,
79
- readOnly: !0
80
- }
81
- ) })
82
- ]
83
- }
84
- );
85
- }
86
- );
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
+ };
87
24
  export {
88
- V as SelectInput
25
+ p as useFroozeClosing
89
26
  };
@@ -1,20 +1,89 @@
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 c } from "react/jsx-runtime";
2
+ import A from "classnames";
3
+ import { attr as l } from "@companix/utils-browser";
4
+ import { forwardRef as y, useRef as S, useCallback as T } from "react";
5
+ import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
6
+ import { mergeRefs as w } from "react-merge-refs";
7
+ import { SelectRightElements as z } from "./bundle.es57.js";
8
+ const V = y(
9
+ ({
10
+ required: a,
11
+ size: u,
12
+ fill: d,
13
+ leftElement: s,
14
+ className: m,
15
+ value: n,
16
+ clearButton: f,
17
+ placeholder: p,
18
+ clearButtonIcon: h,
19
+ disabled: r,
20
+ onClear: C,
21
+ inputRef: I,
22
+ ...i
23
+ }, k) => {
24
+ const e = S(null), N = T(
25
+ (t) => {
26
+ if (!e.current || !document)
27
+ return;
28
+ t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
29
+ },
30
+ [e]
31
+ ), v = (t) => {
32
+ document && document.activeElement === e.current && t.preventDefault();
33
+ }, F = (t) => {
34
+ r || N(t);
35
+ }, g = (t) => {
36
+ v(t);
37
+ }, R = (t) => {
38
+ e.current && e.current.focus(), C?.(t);
39
+ };
40
+ return /* @__PURE__ */ o(
41
+ "div",
42
+ {
43
+ ref: k,
44
+ className: A("form select", m),
45
+ "data-size": u ?? "md",
46
+ "data-fill": l(d),
47
+ "data-required": l(a),
48
+ "data-disabled": l(r),
49
+ onMouseDown: g,
50
+ ...i,
51
+ onClick: F,
52
+ children: [
53
+ /* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
54
+ s && /* @__PURE__ */ c("div", { className: "select-element", children: s }),
55
+ /* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
56
+ !n && /* @__PURE__ */ c("span", { className: "select-placeholder", children: p }),
57
+ n
58
+ ] }) }),
59
+ /* @__PURE__ */ c("div", { className: "select-element", children: /* @__PURE__ */ c(
60
+ z,
61
+ {
62
+ clearButton: f,
63
+ value: !!n,
64
+ clearButtonIcon: h,
65
+ onClear: R
66
+ }
67
+ ) })
68
+ ] }),
69
+ /* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
70
+ "input",
71
+ {
72
+ ref: w([I, e]),
73
+ autoComplete: "off",
74
+ autoCapitalize: "none",
75
+ autoCorrect: "off",
76
+ spellCheck: "false",
77
+ "aria-autocomplete": "none",
78
+ onClick: i.onClick,
79
+ readOnly: !0
80
+ }
81
+ ) })
82
+ ]
83
+ }
84
+ );
85
+ }
86
+ );
18
87
  export {
19
- g as useScrollListController
88
+ V as SelectInput
20
89
  };
@@ -1,22 +1,20 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useEffect as a } from "react";
3
- import { OptionItem as f } from "./bundle.es14.js";
4
- import { OptionsList as O } from "./bundle.es16.js";
5
- const h = (t) => {
6
- const { active: i, onOpened: m, scrollboxRef: n, optionsWrapperRef: r, options: p, onSelect: s, minimalOptions: c } = t;
7
- return a(() => {
8
- m?.();
9
- }, []), /* @__PURE__ */ o(O, { scrollboxRef: n, optionsWrapperRef: r, maxHeight: 300, children: p.map((e, l) => /* @__PURE__ */ o(
10
- f,
11
- {
12
- active: i === e.value,
13
- onClick: () => s?.(e.value),
14
- minimal: c,
15
- ...e
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);
16
14
  },
17
- `select-option-${l}`
18
- )) });
15
+ [t, l]
16
+ ), scrollBoxRef: l, optionsWrapperRef: t };
19
17
  };
20
18
  export {
21
- h as SelectOptions
19
+ g as useScrollListController
22
20
  };