@companix/uikit 0.0.32 → 0.0.34

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 (92) hide show
  1. package/dist/Avatar/Avatar.scss +64 -0
  2. package/dist/Avatar/helpers.d.ts +10 -0
  3. package/dist/Avatar/index.d.ts +8 -0
  4. package/dist/Avatar/types.d.ts +2 -0
  5. package/dist/Icon/index.d.ts +2 -3
  6. package/dist/Segments/Segments.scss +57 -0
  7. package/dist/Segments/index.d.ts +11 -0
  8. package/dist/ThemeProvider/script.d.ts +1 -0
  9. package/dist/bundle.es.js +86 -77
  10. package/dist/bundle.es10.js +78 -39
  11. package/dist/bundle.es11.js +26 -36
  12. package/dist/bundle.es12.js +75 -56
  13. package/dist/bundle.es13.js +39 -19
  14. package/dist/bundle.es14.js +36 -33
  15. package/dist/bundle.es15.js +54 -23
  16. package/dist/bundle.es16.js +21 -45
  17. package/dist/bundle.es17.js +29 -19
  18. package/dist/bundle.es18.js +21 -25
  19. package/dist/bundle.es19.js +45 -38
  20. package/dist/bundle.es2.js +42 -45
  21. package/dist/bundle.es20.js +21 -14
  22. package/dist/bundle.es21.js +28 -33
  23. package/dist/bundle.es22.js +38 -21
  24. package/dist/bundle.es23.js +12 -38
  25. package/dist/bundle.es24.js +32 -114
  26. package/dist/bundle.es25.js +20 -120
  27. package/dist/bundle.es26.js +40 -72
  28. package/dist/bundle.es27.js +115 -32
  29. package/dist/bundle.es28.js +120 -11
  30. package/dist/bundle.es29.js +71 -83
  31. package/dist/bundle.es3.js +2 -8
  32. package/dist/bundle.es30.js +31 -20
  33. package/dist/bundle.es31.js +11 -6
  34. package/dist/bundle.es32.js +83 -36
  35. package/dist/bundle.es33.js +22 -11
  36. package/dist/bundle.es34.js +6 -24
  37. package/dist/bundle.es35.js +33 -37
  38. package/dist/bundle.es36.js +20 -49
  39. package/dist/bundle.es37.js +10 -42
  40. package/dist/bundle.es38.js +24 -8
  41. package/dist/bundle.es39.js +35 -20
  42. package/dist/bundle.es4.js +44 -10
  43. package/dist/bundle.es40.js +51 -87
  44. package/dist/bundle.es41.js +42 -17
  45. package/dist/bundle.es42.js +8 -19
  46. package/dist/bundle.es43.js +25 -24
  47. package/dist/bundle.es44.js +24 -39
  48. package/dist/bundle.es45.js +87 -3
  49. package/dist/bundle.es46.js +18 -5
  50. package/dist/bundle.es47.js +19 -13
  51. package/dist/bundle.es48.js +24 -14
  52. package/dist/bundle.es49.js +39 -3
  53. package/dist/bundle.es5.js +8 -85
  54. package/dist/bundle.es50.js +3 -3
  55. package/dist/bundle.es51.js +5 -70
  56. package/dist/bundle.es52.js +13 -67
  57. package/dist/bundle.es53.js +13 -69
  58. package/dist/bundle.es54.js +3 -12
  59. package/dist/bundle.es55.js +3 -43
  60. package/dist/bundle.es56.js +69 -14
  61. package/dist/bundle.es57.js +67 -23
  62. package/dist/bundle.es58.js +69 -31
  63. package/dist/bundle.es59.js +12 -70
  64. package/dist/bundle.es6.js +11 -85
  65. package/dist/bundle.es60.js +41 -12
  66. package/dist/bundle.es61.js +15 -20
  67. package/dist/bundle.es62.js +32 -2
  68. package/dist/bundle.es63.js +69 -19
  69. package/dist/bundle.es64.js +76 -2
  70. package/dist/bundle.es65.js +49 -21
  71. package/dist/bundle.es66.js +14 -2
  72. package/dist/bundle.es67.js +9 -9
  73. package/dist/bundle.es68.js +2 -76
  74. package/dist/bundle.es69.js +20 -49
  75. package/dist/bundle.es7.js +84 -79
  76. package/dist/bundle.es70.js +2 -2
  77. package/dist/bundle.es71.js +21 -14
  78. package/dist/bundle.es72.js +2 -3
  79. package/dist/bundle.es73.js +20 -3
  80. package/dist/bundle.es74.js +3 -20
  81. package/dist/bundle.es75.js +3 -2
  82. package/dist/bundle.es76.js +14 -20
  83. package/dist/bundle.es77.js +2 -2
  84. package/dist/bundle.es78.js +22 -0
  85. package/dist/bundle.es79.js +4 -0
  86. package/dist/bundle.es8.js +83 -24
  87. package/dist/bundle.es80.js +22 -0
  88. package/dist/bundle.es81.js +4 -0
  89. package/dist/bundle.es9.js +20 -73
  90. package/dist/index.d.ts +7 -0
  91. package/dist/index.scss +2 -0
  92. package/package.json +1 -1
@@ -1,28 +1,87 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { useState as p } from "react";
3
- import { Popover as m } from "./bundle.es7.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
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);
23
18
  }
24
- );
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
+ });
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
+ ] });
25
84
  };
26
85
  export {
27
- f as Tooltip
86
+ C as ImitateScroll
28
87
  };
@@ -0,0 +1,22 @@
1
+ import { __exports as i } from "./bundle.es81.js";
2
+ var c;
3
+ function o() {
4
+ return c ? i : (c = 1, (function(e) {
5
+ Object.defineProperty(e, "__esModule", { value: !0 });
6
+ var n = "fas", r = "chevron-left", f = 320, v = 512, a = [9001], t = "f053", h = "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z";
7
+ e.definition = {
8
+ prefix: n,
9
+ iconName: r,
10
+ icon: [
11
+ f,
12
+ v,
13
+ a,
14
+ t,
15
+ h
16
+ ]
17
+ }, e.faChevronLeft = e.definition, e.prefix = n, e.iconName = r, e.width = f, e.height = v, e.ligatures = a, e.unicode = t, e.svgPathData = h, e.aliases = a;
18
+ })(i), i);
19
+ }
20
+ export {
21
+ o as __require
22
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -1,77 +1,24 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useMemo as F, useImperativeHandle as I } from "react";
3
- import { Popover as T } from "./bundle.es7.js";
4
- import { useFroozeClosing as b } from "./bundle.es39.js";
5
- import { SelectInput as z } from "./bundle.es40.js";
6
- import { useScrollListController as B } from "./bundle.es41.js";
7
- import { SelectOptions as D } from "./bundle.es42.js";
8
- import { mergeRefs as j } from "react-merge-refs";
9
- const G = (a) => {
10
- const {
11
- options: n,
12
- onChange: i,
13
- value: r,
14
- minimalOptions: m,
15
- matchTarget: f = "width",
16
- children: u,
17
- disabled: p,
18
- scrollRef: d,
19
- popoverRef: v,
20
- clearButton: s,
21
- ...h
22
- } = a, t = F(() => {
23
- const o = r === null ? -1 : n.findIndex((e) => e.value === r);
24
- return {
25
- index: o,
26
- option: n[o]
27
- };
28
- }, [n, r]), x = t.option?.value ?? null, { popoverRef: R, froozePopoverPosition: C, handleAnimationEnd: g } = b(), { scrollToElement: c, optionsWrapperRef: O, scrollBoxRef: P } = B();
29
- I(d, () => ({
30
- scrollTo: (o) => c(o, "top")
31
- }));
32
- const S = (o, e) => {
33
- C(), i(o), e();
34
- }, A = (o) => {
35
- o.stopPropagation(), s && i(null);
36
- }, E = () => {
37
- t.index !== -1 && c(t.index, "center");
1
+ import { jsx as s, jsxs as l } from "react/jsx-runtime";
2
+ import { attr as d } from "@companix/utils-browser";
3
+ const u = ({ value: t, onChange: i, options: r }) => {
4
+ const n = r.findIndex((e) => e.value === t), a = {
5
+ "--uikit--current-index": String(n),
6
+ "--uikit--options": String(r.length)
38
7
  };
39
- return /* @__PURE__ */ l(
40
- T,
41
- {
42
- minimal: !0,
43
- ref: j([R, v]),
44
- sideOffset: 0,
45
- matchTarget: f,
46
- onAnimationEnd: g,
47
- onOpenAutoFocus: (o) => o.preventDefault(),
48
- onCloseAutoFocus: (o) => o.preventDefault(),
49
- disabled: p,
50
- content: ({ close: o }) => /* @__PURE__ */ l(
51
- D,
52
- {
53
- options: n,
54
- active: x,
55
- scrollboxRef: P,
56
- optionsWrapperRef: O,
57
- minimalOptions: m,
58
- onOpened: E,
59
- onSelect: (e) => S(e, o)
60
- }
61
- ),
62
- children: u ?? /* @__PURE__ */ l(
63
- z,
64
- {
65
- ...h,
66
- disabled: p,
67
- clearButton: s,
68
- value: t.option?.title ?? "",
69
- onClear: A
70
- }
71
- )
72
- }
73
- );
8
+ return /* @__PURE__ */ s("div", { className: "segments-container", children: /* @__PURE__ */ l("div", { role: "radiogroup", className: "segments", children: [
9
+ n > -1 && /* @__PURE__ */ s("div", { "aria-hidden": !0, className: "segments-slider", style: a }),
10
+ r.map((e) => /* @__PURE__ */ s(
11
+ "div",
12
+ {
13
+ onClick: () => i(e.value),
14
+ className: "segments-option",
15
+ "data-active": d(e.value === t),
16
+ children: e.label
17
+ },
18
+ `segment-${e.value}`
19
+ ))
20
+ ] }) });
74
21
  };
75
22
  export {
76
- G as Select
23
+ u as Segments
77
24
  };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export { Avatar } from './Avatar';
2
+ export type { AvatarProps } from './Avatar';
3
+ export type { AvatarSize } from './Avatar/types';
4
+ export { avatarSizes } from './Avatar/types';
1
5
  export { Button } from './Button';
2
6
  export type { ButtonProps, Appearance, Mode, Size } from './Button';
3
7
  export { ButtonGroup } from './ButtonGroup';
@@ -7,6 +11,8 @@ export type { SpinnerProps } from './Spinner';
7
11
  export { Scrollable } from './Scrollable';
8
12
  export { ImitateScroll } from './Scrollable/ImitateScroll';
9
13
  export type { ImitateScrollProps } from './Scrollable/ImitateScroll';
14
+ export { Segments } from './Segments';
15
+ export type { SegmentsProps } from './Segments';
10
16
  export { Popover } from './Popover';
11
17
  export type { PopoverProps } from './Popover';
12
18
  export { Tooltip } from './Tooltip';
@@ -58,6 +64,7 @@ export type { IconProps } from './Icon';
58
64
  export { ProgressBar } from './Progress';
59
65
  export type { ProgressBarProps } from './Progress';
60
66
  export { ThemeProvider, useTheme } from './ThemeProvider';
67
+ export { ColorSchemeScript, colorSchemeScript } from './ThemeProvider/script';
61
68
  export { useLocalStorage } from './__hooks/use-local-storage';
62
69
  export { createAlertAgent } from './DialogAlert';
63
70
  export { createToaster } from './Toaster';
package/dist/index.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use './Avatar/Avatar.scss';
1
2
  @use './Button/Button.scss';
2
3
  @use './Icon/icon.scss';
3
4
  @use './Popover/Popover.scss';
@@ -21,6 +22,7 @@
21
22
  @use './Switch/Switch.scss';
22
23
  @use './Spinner/Spinner.scss';
23
24
  @use './ButtonGroup/ButtonGroup.scss';
25
+ @use './Segments/Segments.scss';
24
26
  @use './Scrollable/Scrollable.scss';
25
27
  @use './FormGroup/FormGroup.scss';
26
28
  @use './Progress/Progress.scss';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "module": "./dist/bundle.es.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",