@companix/uikit 0.0.3 → 0.0.5

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 (165) hide show
  1. package/dist/Button/Button.scss +128 -0
  2. package/dist/ButtonGroup/ButtonGroup.scss +18 -0
  3. package/dist/Checkbox/Checkbox.scss +115 -0
  4. package/dist/DateInput/DateInput.scss +11 -0
  5. package/dist/DatePicker/Calendar.scss +125 -0
  6. package/dist/DatePicker/DatePicker.scss +0 -0
  7. package/dist/Dialog/Dialog.scss +25 -0
  8. package/dist/Dialog/Popup.scss +55 -0
  9. package/dist/DialogAlert/Alert.scss +52 -0
  10. package/dist/Drawer/Drawer.scss +112 -0
  11. package/dist/Form/Form.scss +70 -0
  12. package/dist/Form/Input.scss +24 -0
  13. package/dist/Icon/icon.scss +18 -0
  14. package/dist/OptionItem/Option.scss +89 -0
  15. package/dist/Popover/Popover.scss +80 -0
  16. package/dist/Radio/Radio.scss +148 -0
  17. package/dist/Scrollable/Scrollable.scss +50 -0
  18. package/dist/Select/Select.scss +80 -0
  19. package/dist/SelectTags/SelectTags.scss +66 -0
  20. package/dist/Spinner/Spinner.scss +14 -0
  21. package/dist/Stepper/StepperInput.scss +35 -0
  22. package/dist/Switch/Switch.scss +102 -0
  23. package/dist/Tabs/Tabs.scss +58 -0
  24. package/dist/TextArea/TextArea.scss +34 -0
  25. package/dist/Toaster/Toaster.scss +151 -0
  26. package/dist/Tooltip/Tooltip.scss +28 -0
  27. package/dist/bundle.es.js +56 -59
  28. package/dist/bundle.es10.js +35 -84
  29. package/dist/bundle.es11.js +30 -72
  30. package/dist/bundle.es12.js +14 -34
  31. package/dist/bundle.es13.js +7 -30
  32. package/dist/bundle.es14.js +33 -16
  33. package/dist/bundle.es15.js +24 -8
  34. package/dist/bundle.es16.js +15 -27
  35. package/dist/bundle.es17.js +22 -25
  36. package/dist/bundle.es18.js +13 -21
  37. package/dist/bundle.es19.js +38 -22
  38. package/dist/bundle.es2.js +45 -0
  39. package/dist/bundle.es20.js +16 -13
  40. package/dist/bundle.es21.js +34 -39
  41. package/dist/bundle.es22.js +20 -15
  42. package/dist/bundle.es23.js +38 -32
  43. package/dist/bundle.es24.js +110 -20
  44. package/dist/bundle.es25.js +106 -34
  45. package/dist/bundle.es26.js +34 -110
  46. package/dist/bundle.es27.js +11 -113
  47. package/dist/bundle.es28.js +23 -34
  48. package/dist/bundle.es29.js +35 -10
  49. package/dist/bundle.es3.js +10 -42
  50. package/dist/bundle.es30.js +20 -21
  51. package/dist/bundle.es31.js +81 -36
  52. package/dist/bundle.es32.js +20 -0
  53. package/dist/bundle.es33.js +16 -0
  54. package/dist/bundle.es34.js +24 -0
  55. package/dist/bundle.es35.js +5 -41
  56. package/dist/bundle.es36.js +18 -437
  57. package/dist/bundle.es37.js +14 -22
  58. package/dist/bundle.es38.js +68 -22
  59. package/dist/bundle.es39.js +68 -81
  60. package/dist/bundle.es4.js +85 -12
  61. package/dist/bundle.es40.js +31 -17
  62. package/dist/bundle.es41.js +67 -13
  63. package/dist/{bundle.es53.js → bundle.es42.js} +1 -1
  64. package/dist/bundle.es43.js +31 -5
  65. package/dist/bundle.es44.js +74 -20
  66. package/dist/bundle.es45.js +47 -12
  67. package/dist/bundle.es5.js +82 -83
  68. package/dist/bundle.es6.js +74 -81
  69. package/dist/bundle.es7.js +26 -78
  70. package/dist/bundle.es8.js +80 -22
  71. package/dist/bundle.es9.js +71 -43
  72. package/dist/css-properties.scss +120 -0
  73. package/dist/{types/index.d.ts → index.d.ts} +0 -1
  74. package/dist/index.scss +25 -0
  75. package/dist/mixins.scss +100 -0
  76. package/dist/theme.scss +101 -0
  77. package/package.json +3 -3
  78. package/dist/bundle.es46.js +0 -72
  79. package/dist/bundle.es47.js +0 -70
  80. package/dist/bundle.es48.js +0 -34
  81. package/dist/bundle.es49.js +0 -70
  82. package/dist/bundle.es50.js +0 -33
  83. package/dist/bundle.es51.js +0 -78
  84. package/dist/bundle.es52.js +0 -51
  85. package/dist/bundle.es54.js +0 -40
  86. package/dist/bundle.es55.js +0 -36
  87. package/dist/bundle.es56.js +0 -9
  88. package/dist/bundle.es57.js +0 -9
  89. package/dist/bundle.es58.js +0 -7
  90. package/dist/bundle.es59.js +0 -9
  91. package/dist/bundle.es60.js +0 -8
  92. package/dist/bundle.es61.js +0 -19
  93. package/dist/bundle.es62.js +0 -15
  94. package/dist/bundle.es63.js +0 -22
  95. package/dist/bundle.es64.js +0 -45
  96. package/dist/bundle.es65.js +0 -28
  97. package/dist/bundle.es66.js +0 -34
  98. package/dist/bundle.es67.js +0 -6
  99. package/dist/bundle.es68.js +0 -12
  100. package/dist/bundle.es69.js +0 -47
  101. package/dist/bundle.es70.js +0 -11
  102. package/dist/bundle.es71.js +0 -18
  103. package/dist/bundle.es72.js +0 -32
  104. package/dist/bundle.es73.js +0 -35
  105. package/dist/bundle.es74.js +0 -6
  106. package/dist/bundle.es75.js +0 -7
  107. package/dist/bundle.es76.js +0 -7
  108. package/dist/bundle.es77.js +0 -11
  109. package/dist/bundle.es78.js +0 -17
  110. package/dist/bundle.es79.js +0 -7
  111. package/dist/bundle.es80.js +0 -17
  112. package/dist/bundle.es81.js +0 -25
  113. package/dist/uikit.css +0 -1
  114. /package/dist/{types/Button → Button}/index.d.ts +0 -0
  115. /package/dist/{types/ButtonGroup → ButtonGroup}/index.d.ts +0 -0
  116. /package/dist/{types/Checkbox → Checkbox}/index.d.ts +0 -0
  117. /package/dist/{types/Countdown → Countdown}/index.d.ts +0 -0
  118. /package/dist/{types/DateInput → DateInput}/index.d.ts +0 -0
  119. /package/dist/{types/DatePicker → DatePicker}/Calendar.d.ts +0 -0
  120. /package/dist/{types/DatePicker → DatePicker}/CalendarHeader.d.ts +0 -0
  121. /package/dist/{types/DatePicker → DatePicker}/index.d.ts +0 -0
  122. /package/dist/{types/Dialog → Dialog}/index.d.ts +0 -0
  123. /package/dist/{types/DialogAlert → DialogAlert}/Alert.d.ts +0 -0
  124. /package/dist/{types/DialogAlert → DialogAlert}/Viewport.d.ts +0 -0
  125. /package/dist/{types/DialogAlert → DialogAlert}/index.d.ts +0 -0
  126. /package/dist/{types/Drawer → Drawer}/index.d.ts +0 -0
  127. /package/dist/{types/File → File}/index.d.ts +0 -0
  128. /package/dist/{types/Form → Form}/index.d.ts +0 -0
  129. /package/dist/{types/Icon → Icon}/index.d.ts +0 -0
  130. /package/dist/{types/LoadButton → LoadButton}/index.d.ts +0 -0
  131. /package/dist/{types/NumberInput → NumberInput}/index.d.ts +0 -0
  132. /package/dist/{types/OptionItem → OptionItem}/OptionItem.d.ts +0 -0
  133. /package/dist/{types/OptionItem → OptionItem}/OptionsList.d.ts +0 -0
  134. /package/dist/{types/Popover → Popover}/index.d.ts +0 -0
  135. /package/dist/{types/Radio → Radio}/index.d.ts +0 -0
  136. /package/dist/{types/Scrollable → Scrollable}/ImitateScroll.d.ts +0 -0
  137. /package/dist/{types/Scrollable → Scrollable}/index.d.ts +0 -0
  138. /package/dist/{types/Select → Select}/SelectInput.d.ts +0 -0
  139. /package/dist/{types/Select → Select}/index.d.ts +0 -0
  140. /package/dist/{types/SelectTags → SelectTags}/index.d.ts +0 -0
  141. /package/dist/{types/Spinner → Spinner}/index.d.ts +0 -0
  142. /package/dist/{types/Stepper → Stepper}/index.d.ts +0 -0
  143. /package/dist/{types/Switch → Switch}/index.d.ts +0 -0
  144. /package/dist/{types/Tabs → Tabs}/index.d.ts +0 -0
  145. /package/dist/{types/TextArea → TextArea}/index.d.ts +0 -0
  146. /package/dist/{types/Toaster → Toaster}/RemoveListener.d.ts +0 -0
  147. /package/dist/{types/Toaster → Toaster}/Toast.d.ts +0 -0
  148. /package/dist/{types/Toaster → Toaster}/Viewport.d.ts +0 -0
  149. /package/dist/{types/Toaster → Toaster}/index.d.ts +0 -0
  150. /package/dist/{types/Tooltip → Tooltip}/index.d.ts +0 -0
  151. /package/dist/{types/__hooks → __hooks}/use-frooze-closing.d.ts +0 -0
  152. /package/dist/{types/__hooks → __hooks}/use-loading.d.ts +0 -0
  153. /package/dist/{types/__hooks → __hooks}/use-local-storage.d.ts +0 -0
  154. /package/dist/{types/__hooks → __hooks}/use-popover-position.d.ts +0 -0
  155. /package/dist/{types/__hooks → __hooks}/use-previos.d.ts +0 -0
  156. /package/dist/{types/__hooks → __hooks}/use-resize.d.ts +0 -0
  157. /package/dist/{types/__hooks → __hooks}/use-scrollbox.d.ts +0 -0
  158. /package/dist/{types/__hooks → __hooks}/use-stepper-input.d.ts +0 -0
  159. /package/dist/{types/__hooks → __hooks}/use-update.d.ts +0 -0
  160. /package/dist/{types/__hooks → __hooks}/useCalendar.d.ts +0 -0
  161. /package/dist/{types/__hooks → __hooks}/useCalendarOptions-copy.d.ts +0 -0
  162. /package/dist/{types/__hooks → __hooks}/useCalendarOptions.d.ts +0 -0
  163. /package/dist/{types/__libs → __libs}/calendar.d.ts +0 -0
  164. /package/dist/{types/__utils → __utils}/utils.d.ts +0 -0
  165. /package/dist/{types/types.d.ts → types.d.ts} +0 -0
@@ -1,88 +1,87 @@
1
- import { jsx as v } from "react/jsx-runtime";
2
- /* empty css */
3
- import I from "classnames";
4
- import { forwardRef as S } from "react";
5
- import { varToStyle as r, px as i } from "@companix/utils-browser";
6
- const E = S((t, c) => {
7
- let {
8
- interactionKind: m = "static",
9
- thumbPos: g = "center",
10
- thumbPadding: l = 4,
11
- heightAuto: s,
12
- scrollX: h,
13
- className: p,
14
- scrollY: n,
15
- onWheel: b,
16
- maxHeight: d,
17
- onScroll: f,
18
- thumbColor: u,
19
- children: w
20
- } = t;
21
- const x = (() => {
22
- if (t.implementation === "edge") {
23
- l = 0;
24
- const { padding: o, scrollbarWidth: e } = t;
25
- return {
26
- ...r({ "--scrollbar-width": i(e) }),
27
- padding: `0px ${o - e}px 0px ${o}px`
28
- };
1
+ import { jsxs as x, jsx as c } from "react/jsx-runtime";
2
+ import L from "classnames";
3
+ import { useRef as d, useMemo as f, useCallback as n, useEffect as T, useLayoutEffect as H } from "react";
4
+ import { getContainers as p, pc as h, px as v } from "@companix/utils-browser";
5
+ const C = ({
6
+ children: b,
7
+ thumbClassName: y,
8
+ scrollableClassName: g,
9
+ thumbMargin: R = 0,
10
+ trackWidth: w = 20
11
+ }) => {
12
+ const l = d(null), t = d(null), r = f(() => ({ positons: { top: 0, y: 0 }, scrollRatio: 0 }), []), i = f(() => ({
13
+ start() {
14
+ document.addEventListener("mousemove", a), document.addEventListener("mouseup", m);
15
+ },
16
+ clear() {
17
+ document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", m);
29
18
  }
30
- if (t.implementation === "outer") {
31
- const { shadowPadding: o = 0, noneCorrect: e, scrollbarWidth: a } = t;
32
- return window.IS_MOBILE ? {
33
- padding: o,
34
- margin: -o
35
- } : {
36
- ...r({ "--scrollbar-width": i(a) }),
37
- padding: o,
38
- margin: -o,
39
- marginRight: e ? void 0 : `calc(-${a}px - ${o}px)`,
40
- marginBottom: 0
41
- };
19
+ }), []);
20
+ T(() => {
21
+ const o = new ResizeObserver(u);
22
+ return t.current && p(t.current, (e) => {
23
+ o.observe(e);
24
+ }), () => {
25
+ t.current && p(t.current, (e) => {
26
+ o.unobserve(e);
27
+ });
28
+ };
29
+ }, []), H(() => {
30
+ u();
31
+ }, []);
32
+ const u = n(() => {
33
+ const { current: o } = t, { current: e } = l;
34
+ if (e && o) {
35
+ const s = o.clientHeight / o.scrollHeight;
36
+ e.style.height = h(s * 100), e.style.display = s === 1 ? "none" : "block", r.scrollRatio = s;
42
37
  }
43
- if (t.implementation === "inner") {
44
- const { padding: o } = t;
45
- return window.IS_MOBILE ? {
46
- [n ? "paddingLeft" : "paddingTop"]: o,
47
- [n ? "paddingRight" : "paddingBottom"]: o
48
- } : {
49
- [n ? "paddingLeft" : "paddingTop"]: o,
50
- ...r({ "--scrollbar-width": i(o) })
51
- };
38
+ }, []), a = n(({ clientY: o }) => {
39
+ const { current: e } = t;
40
+ if (e) {
41
+ const s = o - r.positons.y;
42
+ e.scrollTop = r.positons.top + s / r.scrollRatio;
52
43
  }
53
- return {};
54
- })();
55
- return /* @__PURE__ */ v(
56
- "div",
57
- {
58
- ref: c,
59
- onWheel: b,
60
- onScroll: f,
61
- onMouseDown: (o) => {
62
- o.preventDefault();
63
- },
64
- style: {
65
- ...x,
66
- ...t.style,
67
- maxHeight: d ? i(d) : void 0,
68
- ...r({ "--thumb-padding": i(l) }),
69
- ...r({ "--thumb-color": u ?? "#c1c2c8bd" })
70
- },
71
- className: I(
72
- !window.IS_MOBILE && "scrollable",
73
- p,
74
- s ? "" : "h-full",
75
- {
76
- "overflow-y-scroll": n,
77
- "overflow-x-scroll": h,
78
- "scrollable-hover-interaction": m === "hover",
79
- "scrollable-border-position": g === "border"
80
- }
81
- ),
82
- children: w
83
- }
84
- );
85
- });
44
+ }, []), m = n(() => {
45
+ i.clear();
46
+ }, []), E = n(({ clientY: o }) => {
47
+ const { current: e } = t;
48
+ e && (r.positons = {
49
+ top: e.scrollTop,
50
+ y: o
51
+ }), i.start();
52
+ }, []), M = () => {
53
+ requestAnimationFrame(() => {
54
+ const { current: o } = t, { current: e } = l;
55
+ e && o && (e.style.top = h(o.scrollTop * 100 / o.scrollHeight));
56
+ });
57
+ };
58
+ return /* @__PURE__ */ x("div", { className: "relative h-full overflow-hidden", children: [
59
+ /* @__PURE__ */ c(
60
+ "div",
61
+ {
62
+ className: L("hidden-scroll h-full overflow-y-scroll", g),
63
+ onScroll: M,
64
+ ref: t,
65
+ children: b
66
+ }
67
+ ),
68
+ /* @__PURE__ */ c(
69
+ "div",
70
+ {
71
+ className: "absolute right-0 top-0 box-border h-full",
72
+ style: { width: v(w), padding: v(R) },
73
+ children: /* @__PURE__ */ c(
74
+ "div",
75
+ {
76
+ onMouseDown: E,
77
+ className: `${y} relative w-full rounded-full`,
78
+ ref: l
79
+ }
80
+ )
81
+ }
82
+ )
83
+ ] });
84
+ };
86
85
  export {
87
- E as Scrollable
86
+ C as ImitateScroll
88
87
  };
@@ -1,87 +1,80 @@
1
- import { jsxs as x, jsx as c } from "react/jsx-runtime";
2
- import L from "classnames";
3
- import { useRef as d, useMemo as f, useCallback as n, useEffect as T, useLayoutEffect as H } from "react";
4
- import { getContainers as p, pc as h, px as v } from "@companix/utils-browser";
5
- const C = ({
6
- children: b,
7
- thumbClassName: y,
8
- scrollableClassName: g,
9
- thumbMargin: R = 0,
10
- trackWidth: w = 20
11
- }) => {
12
- const l = d(null), t = d(null), r = f(() => ({ positons: { top: 0, y: 0 }, scrollRatio: 0 }), []), i = f(() => ({
13
- start() {
14
- document.addEventListener("mousemove", a), document.addEventListener("mouseup", m);
15
- },
16
- clear() {
17
- document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", m);
18
- }
19
- }), []);
20
- T(() => {
21
- const o = new ResizeObserver(u);
22
- return t.current && p(t.current, (e) => {
23
- o.observe(e);
24
- }), () => {
25
- t.current && p(t.current, (e) => {
26
- o.unobserve(e);
27
- });
28
- };
29
- }, []), H(() => {
30
- u();
31
- }, []);
32
- const u = n(() => {
33
- const { current: o } = t, { current: e } = l;
34
- if (e && o) {
35
- const s = o.clientHeight / o.scrollHeight;
36
- e.style.height = h(s * 100), e.style.display = s === 1 ? "none" : "block", r.scrollRatio = s;
37
- }
38
- }, []), a = n(({ clientY: o }) => {
39
- const { current: e } = t;
40
- if (e) {
41
- const s = o - r.positons.y;
42
- e.scrollTop = r.positons.top + s / r.scrollRatio;
43
- }
44
- }, []), m = n(() => {
45
- i.clear();
46
- }, []), E = n(({ clientY: o }) => {
47
- const { current: e } = t;
48
- e && (r.positons = {
49
- top: e.scrollTop,
50
- y: o
51
- }), i.start();
52
- }, []), M = () => {
53
- requestAnimationFrame(() => {
54
- const { current: o } = t, { current: e } = l;
55
- e && o && (e.style.top = h(o.scrollTop * 100 / o.scrollHeight));
56
- });
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import * as o from "@radix-ui/react-popover";
3
+ import { attr as y } from "@companix/utils-browser";
4
+ import B from "classnames";
5
+ import { forwardRef as M, useRef as j } from "react";
6
+ const D = M((a, i) => {
7
+ const {
8
+ children: n,
9
+ sideOffset: s,
10
+ matchTarget: l,
11
+ onAnimationEnd: c,
12
+ onAnimationStart: m,
13
+ onOpenAutoFocus: d,
14
+ onCloseAutoFocus: f,
15
+ triggerRef: p,
16
+ triggerProps: h,
17
+ open: g,
18
+ content: u,
19
+ onOpenChange: v,
20
+ align: C,
21
+ disabled: w,
22
+ minimal: x,
23
+ className: L,
24
+ fitMaxHeight: N = !0,
25
+ side: O,
26
+ showArrows: A
27
+ } = a, e = j(null), P = () => {
28
+ e.current && e.current.click();
29
+ }, b = (R) => {
30
+ w && R.preventDefault();
57
31
  };
58
- return /* @__PURE__ */ x("div", { className: "relative h-full overflow-hidden", children: [
59
- /* @__PURE__ */ c(
60
- "div",
32
+ return /* @__PURE__ */ t(o.Root, { open: g, onOpenChange: v, children: [
33
+ /* @__PURE__ */ r(o.Trigger, { ref: p, ...h, onClick: b, asChild: !0, children: n }),
34
+ /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ t(
35
+ o.Content,
61
36
  {
62
- className: L("hidden-scroll h-full overflow-y-scroll", g),
63
- onScroll: M,
64
- ref: t,
65
- children: b
37
+ ref: i,
38
+ className: B("popover", L),
39
+ side: O,
40
+ align: C,
41
+ "data-appearance": x ? "minimal" : "default",
42
+ "data-match-target": l,
43
+ sideOffset: s ?? 6,
44
+ avoidCollisions: !0,
45
+ arrowPadding: 10,
46
+ onAnimationStart: m,
47
+ onAnimationEnd: c,
48
+ onOpenAutoFocus: d,
49
+ onCloseAutoFocus: f,
50
+ children: [
51
+ /* @__PURE__ */ r(o.Close, { ref: e, style: { display: "none" } }),
52
+ A && /* @__PURE__ */ r(o.Arrow, { width: 30, height: 11, asChild: !0, children: /* @__PURE__ */ r("div", { className: "popover-arrow", children: /* @__PURE__ */ t("svg", { className: "popover-arrow-icon", viewBox: "0 0 30 11", width: 30, height: 11, children: [
53
+ /* @__PURE__ */ r(
54
+ "path",
55
+ {
56
+ className: "popover-arrow-border",
57
+ d: "M 18.112 -2.704 C 19.127 -3.64 19.999 -5.626 19.999 -7.001 L 19.999 18.999 C 19.999 17.621 19.131 15.642 18.111 14.702 L 10.927 8.084 C 9.69 6.944 9.694 5.05 10.927 3.914 L 18.112 -2.704 Z",
58
+ style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
59
+ transform: "matrix(0, -1, 1, 0, 0.000001, 0)"
60
+ }
61
+ ),
62
+ /* @__PURE__ */ r(
63
+ "path",
64
+ {
65
+ className: "popover-arrow-fill",
66
+ d: "M 17.789 -2.965 C 19.009 -4.09 19.999 -6.341 19.999 -7.995 L 19.999 -10.001 L 19.999 19.999 L 19.999 17.994 C 19.999 16.34 19.016 14.094 17.789 12.964 L 10.606 6.348 C 9.796 5.602 9.804 4.388 10.606 3.648 L 17.789 -2.966 L 17.789 -2.965 Z",
67
+ style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
68
+ transform: "matrix(0, -1, 1, 0, 0, 0)"
69
+ }
70
+ )
71
+ ] }) }) }),
72
+ /* @__PURE__ */ r("div", { className: "popover-content", "data-fit-max-height": y(N), children: u({ close: P }) })
73
+ ]
66
74
  }
67
- ),
68
- /* @__PURE__ */ c(
69
- "div",
70
- {
71
- className: "absolute right-0 top-0 box-border h-full",
72
- style: { width: v(w), padding: v(R) },
73
- children: /* @__PURE__ */ c(
74
- "div",
75
- {
76
- onMouseDown: E,
77
- className: `${y} relative w-full rounded-full`,
78
- ref: l
79
- }
80
- )
81
- }
82
- )
75
+ ) })
83
76
  ] });
84
- };
77
+ });
85
78
  export {
86
- C as ImitateScroll
79
+ D as Popover
87
80
  };
@@ -1,80 +1,28 @@
1
- import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
- import * as o from "@radix-ui/react-popover";
3
- import { attr as y } from "@companix/utils-browser";
4
- import B from "classnames";
5
- import { forwardRef as M, useRef as j } from "react";
6
- const D = M((a, i) => {
7
- const {
8
- children: n,
9
- sideOffset: s,
10
- matchTarget: l,
11
- onAnimationEnd: c,
12
- onAnimationStart: m,
13
- onOpenAutoFocus: d,
14
- onCloseAutoFocus: f,
15
- triggerRef: p,
16
- triggerProps: h,
17
- open: g,
18
- content: u,
19
- onOpenChange: v,
20
- align: C,
21
- disabled: w,
22
- minimal: x,
23
- className: L,
24
- fitMaxHeight: N = !0,
25
- side: O,
26
- showArrows: A
27
- } = a, e = j(null), P = () => {
28
- e.current && e.current.click();
29
- }, b = (R) => {
30
- w && R.preventDefault();
31
- };
32
- return /* @__PURE__ */ t(o.Root, { open: g, onOpenChange: v, children: [
33
- /* @__PURE__ */ r(o.Trigger, { ref: p, ...h, onClick: b, asChild: !0, children: n }),
34
- /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ t(
35
- o.Content,
36
- {
37
- ref: i,
38
- className: B("popover", L),
39
- side: O,
40
- align: C,
41
- "data-appearance": x ? "minimal" : "default",
42
- "data-match-target": l,
43
- sideOffset: s ?? 6,
44
- avoidCollisions: !0,
45
- arrowPadding: 10,
46
- onAnimationStart: m,
47
- onAnimationEnd: c,
48
- onOpenAutoFocus: d,
49
- onCloseAutoFocus: f,
50
- children: [
51
- /* @__PURE__ */ r(o.Close, { ref: e, style: { display: "none" } }),
52
- A && /* @__PURE__ */ r(o.Arrow, { width: 30, height: 11, asChild: !0, children: /* @__PURE__ */ r("div", { className: "popover-arrow", children: /* @__PURE__ */ t("svg", { className: "popover-arrow-icon", viewBox: "0 0 30 11", width: 30, height: 11, children: [
53
- /* @__PURE__ */ r(
54
- "path",
55
- {
56
- className: "popover-arrow-border",
57
- d: "M 18.112 -2.704 C 19.127 -3.64 19.999 -5.626 19.999 -7.001 L 19.999 18.999 C 19.999 17.621 19.131 15.642 18.111 14.702 L 10.927 8.084 C 9.69 6.944 9.694 5.05 10.927 3.914 L 18.112 -2.704 Z",
58
- style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
59
- transform: "matrix(0, -1, 1, 0, 0.000001, 0)"
60
- }
61
- ),
62
- /* @__PURE__ */ r(
63
- "path",
64
- {
65
- className: "popover-arrow-fill",
66
- d: "M 17.789 -2.965 C 19.009 -4.09 19.999 -6.341 19.999 -7.995 L 19.999 -10.001 L 19.999 19.999 L 19.999 17.994 C 19.999 16.34 19.016 14.094 17.789 12.964 L 10.606 6.348 C 9.796 5.602 9.804 4.388 10.606 3.648 L 17.789 -2.966 L 17.789 -2.965 Z",
67
- style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
68
- transform: "matrix(0, -1, 1, 0, 0, 0)"
69
- }
70
- )
71
- ] }) }) }),
72
- /* @__PURE__ */ r("div", { className: "popover-content", "data-fit-max-height": y(N), children: u({ close: P }) })
73
- ]
74
- }
75
- ) })
76
- ] });
77
- });
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useState as p } from "react";
3
+ import { Popover as m } from "./bundle.es6.js";
4
+ const f = ({ children: e, content: t, side: r }) => {
5
+ const [s, o] = p(!1);
6
+ return /* @__PURE__ */ n(
7
+ m,
8
+ {
9
+ showArrows: !0,
10
+ className: "tooltip",
11
+ open: s,
12
+ side: r,
13
+ content: () => t,
14
+ triggerProps: {
15
+ onMouseEnter: () => {
16
+ o(!0);
17
+ },
18
+ onMouseLeave: () => {
19
+ o(!1);
20
+ }
21
+ },
22
+ children: e
23
+ }
24
+ );
25
+ };
78
26
  export {
79
- D as Popover
27
+ f as Tooltip
80
28
  };
@@ -1,29 +1,87 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { useState as n } from "react";
3
- /* empty css */
4
- import { Popover as m } from "./bundle.es7.js";
5
- const l = ({ children: e, content: t, side: r }) => {
6
- const [s, o] = n(!1);
7
- return /* @__PURE__ */ p(
8
- m,
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useMemo as E, useEffect as I } from "react";
3
+ import { OptionsList as b } from "./bundle.es12.js";
4
+ import { OptionItem as B } from "./bundle.es10.js";
5
+ import { Popover as F } from "./bundle.es6.js";
6
+ import { useFroozeClosing as z } from "./bundle.es30.js";
7
+ import { SelectInput as D } from "./bundle.es31.js";
8
+ import { useScrollListController as L } from "./bundle.es32.js";
9
+ const y = (c) => {
10
+ const {
11
+ options: e,
12
+ onChange: i,
13
+ minimalOptions: a,
14
+ clearButton: m,
15
+ clearButtonIcon: u,
16
+ matchTarget: f = "width",
17
+ value: l,
18
+ children: n,
19
+ disabled: s,
20
+ ...d
21
+ } = c, p = E(() => {
22
+ const o = e.findIndex((t) => t.value === l);
23
+ return {
24
+ index: o,
25
+ option: e[o]
26
+ };
27
+ }, [e, l]), v = p.option?.value ?? null, { popoverRef: h, froozePopoverPosition: x, handleAnimationEnd: O } = z(), { scrollToElement: C, optionsWrapperRef: g, scrollBoxRef: P } = L(), R = (o, t) => {
28
+ x(), i(o), t();
29
+ }, S = (o) => {
30
+ o.stopPropagation(), i(null);
31
+ }, A = () => {
32
+ p.index !== -1 && C(p.index, !0);
33
+ };
34
+ return /* @__PURE__ */ r(
35
+ F,
9
36
  {
10
- showArrows: !0,
11
- className: "tooltip",
12
- open: s,
13
- side: r,
14
- content: () => t,
15
- triggerProps: {
16
- onMouseEnter: () => {
17
- o(!0);
18
- },
19
- onMouseLeave: () => {
20
- o(!1);
37
+ minimal: !0,
38
+ ref: h,
39
+ sideOffset: 0,
40
+ matchTarget: f,
41
+ onAnimationEnd: O,
42
+ onOpenAutoFocus: (o) => o.preventDefault(),
43
+ onCloseAutoFocus: (o) => o.preventDefault(),
44
+ disabled: s,
45
+ content: ({ close: o }) => /* @__PURE__ */ r(
46
+ T,
47
+ {
48
+ options: e,
49
+ active: v,
50
+ scrollboxRef: P,
51
+ optionsWrapperRef: g,
52
+ minimalOptions: a,
53
+ onOpened: A,
54
+ onSelect: (t) => R(t, o)
21
55
  }
22
- },
23
- children: e
56
+ ),
57
+ children: n ?? /* @__PURE__ */ r(
58
+ D,
59
+ {
60
+ ...d,
61
+ disabled: s,
62
+ value: p.option?.title ?? "",
63
+ onClear: S,
64
+ clearButton: m,
65
+ clearButtonIcon: u
66
+ }
67
+ )
24
68
  }
25
69
  );
70
+ }, T = (c) => {
71
+ const { active: e, onOpened: i, scrollboxRef: a, optionsWrapperRef: m, options: u, onSelect: f, minimalOptions: l } = c;
72
+ return I(() => {
73
+ i?.();
74
+ }, []), /* @__PURE__ */ r(b, { scrollboxRef: a, optionsWrapperRef: m, maxHeight: 300, children: u.map((n, s) => /* @__PURE__ */ r(
75
+ B,
76
+ {
77
+ active: e === n.value,
78
+ onClick: () => f?.(n.value),
79
+ minimal: l,
80
+ ...n
81
+ },
82
+ `option-item-${n.value}-${s}`
83
+ )) });
26
84
  };
27
85
  export {
28
- l as Tooltip
86
+ y as Select
29
87
  };