@hamster-note/components 0.2.1-beta.3 → 0.4.0-beta.0

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 (100) hide show
  1. package/README.md +341 -73
  2. package/dist/Icon-BuZRZcjv.js +1143 -0
  3. package/dist/button-mmBNcoG1.js +45 -0
  4. package/dist/button.js +1 -1
  5. package/dist/components/button/Button.d.ts +5 -3
  6. package/dist/components/dialog/Dialog.d.ts +3 -1
  7. package/dist/components/drawer/Drawer.d.ts +3 -1
  8. package/dist/components/icon/icon-names.d.ts +1 -15
  9. package/dist/components/menu/Menu.d.ts +11 -19
  10. package/dist/components/menu/Menu.placement.test.d.ts +1 -0
  11. package/dist/components/menu/MenuSubmenu.d.ts +13 -0
  12. package/dist/components/menu/MenuSurface.d.ts +12 -0
  13. package/dist/components/menu/menu-tree-context.d.ts +9 -0
  14. package/dist/components/popover/use-anchor-position.d.ts +16 -1
  15. package/dist/components/popover/use-anchor-position.test.d.ts +1 -0
  16. package/dist/components/theme/theme-context.d.ts +10 -0
  17. package/dist/components/theme/theme.d.ts +1 -87
  18. package/dist/{confirm-3eBmopl8.js → confirm-DKgVMWkR.js} +4 -5
  19. package/dist/confirm.js +1 -1
  20. package/dist/dialog-DI_yumUn.js +102 -0
  21. package/dist/dialog.js +1 -1
  22. package/dist/drawer-Cpe3Yf3K.js +120 -0
  23. package/dist/drawer.js +1 -1
  24. package/dist/hamster-note-components.css +1 -1
  25. package/dist/icon-u7jiIYal.js +5 -0
  26. package/dist/icon.js +2 -1
  27. package/dist/index.js +10 -9
  28. package/dist/menu-B4WwCQyw.js +179 -0
  29. package/dist/menu.js +1 -1
  30. package/dist/{popover-baLHE3lf.js → popover-D00SlGpL.js} +1 -1
  31. package/dist/popover.js +1 -1
  32. package/dist/shared/icon-names.d.ts +15 -0
  33. package/dist/shared/icons.d.ts +1216 -0
  34. package/dist/shared/theme.d.ts +87 -0
  35. package/dist/shared/tokens.d.ts +67 -0
  36. package/dist/test/fields-and-cards.test.d.ts +1 -0
  37. package/dist/test/imperative-apis.test.d.ts +1 -0
  38. package/dist/test/modals.test.d.ts +1 -0
  39. package/dist/test/primitives.test.d.ts +1 -0
  40. package/dist/test/setup.d.ts +0 -0
  41. package/dist/test/shared-data.test.d.ts +1 -0
  42. package/dist/test/theme-and-popover.test.d.ts +1 -0
  43. package/dist/{theme-C0p_hpKk.js → theme-DNK-xd31.js} +30 -22
  44. package/dist/theme-context-CdWvVVP8.js +8 -0
  45. package/dist/theme.js +1 -1
  46. package/dist/use-anchor-position-D3QBcIet.js +166 -0
  47. package/dist-native/badge.d.ts +10 -0
  48. package/dist-native/badge.js +7 -0
  49. package/dist-native/button.d.ts +16 -0
  50. package/dist-native/button.js +7 -0
  51. package/dist-native/chunk-6RD26X3W.js +78 -0
  52. package/dist-native/chunk-6SR5ZHDD.js +13 -0
  53. package/dist-native/chunk-6VYUVVCP.js +27 -0
  54. package/dist-native/chunk-7LN4VNRB.js +124 -0
  55. package/dist-native/chunk-CF76TWL4.js +85 -0
  56. package/dist-native/chunk-ENTYQ6M4.js +256 -0
  57. package/dist-native/chunk-GSG6CXIE.js +1688 -0
  58. package/dist-native/chunk-JHT74YG3.js +186 -0
  59. package/dist-native/chunk-KPDK62A5.js +106 -0
  60. package/dist-native/chunk-PLFX4RVR.js +134 -0
  61. package/dist-native/chunk-QUGLAOXA.js +49 -0
  62. package/dist-native/chunk-S2EUKEYI.js +35 -0
  63. package/dist-native/chunk-VTE5RPMO.js +38 -0
  64. package/dist-native/chunk-YJ4H3ZBQ.js +145 -0
  65. package/dist-native/chunk-ZTQATW6Y.js +127 -0
  66. package/dist-native/confirm.d.ts +24 -0
  67. package/dist-native/confirm.js +14 -0
  68. package/dist-native/dialog.d.ts +8 -0
  69. package/dist-native/dialog.js +10 -0
  70. package/dist-native/drawer.d.ts +13 -0
  71. package/dist-native/drawer.js +10 -0
  72. package/dist-native/focus-C0k0lLui.d.ts +9 -0
  73. package/dist-native/icon.d.ts +28 -0
  74. package/dist-native/icon.js +9 -0
  75. package/dist-native/index.d.ts +20 -0
  76. package/dist-native/index.js +84 -0
  77. package/dist-native/kbd.d.ts +9 -0
  78. package/dist-native/kbd.js +7 -0
  79. package/dist-native/loading.d.ts +19 -0
  80. package/dist-native/loading.js +11 -0
  81. package/dist-native/menu.d.ts +31 -0
  82. package/dist-native/menu.js +17 -0
  83. package/dist-native/modal-panel-BOpp1oRC.d.ts +23 -0
  84. package/dist-native/note-card.d.ts +13 -0
  85. package/dist-native/note-card.js +7 -0
  86. package/dist-native/popover.d.ts +34 -0
  87. package/dist-native/popover.js +8 -0
  88. package/dist-native/position-CkPoZ5AD.d.ts +3 -0
  89. package/dist-native/text-field.d.ts +13 -0
  90. package/dist-native/text-field.js +7 -0
  91. package/dist-native/theme.d.ts +120 -0
  92. package/dist-native/theme.js +16 -0
  93. package/dist-native/tokens-DHoNd-yT.d.ts +41 -0
  94. package/package.json +151 -6
  95. package/dist/button-DRz0VTkf.js +0 -18
  96. package/dist/dialog-B4xS5zlK.js +0 -53
  97. package/dist/drawer-DoeuGAHD.js +0 -60
  98. package/dist/icon-DNZLJUqH.js +0 -517
  99. package/dist/menu-Dj-Dje_l.js +0 -153
  100. package/dist/use-anchor-position-DWle8yoL.js +0 -87
@@ -1,87 +0,0 @@
1
- import { useLayoutEffect as e, useRef as t, useState as n } from "react";
2
- //#region src/components/popover/use-anchor-position.ts
3
- var r = {
4
- position: "fixed",
5
- top: 0,
6
- left: 0,
7
- visibility: "hidden"
8
- }, i = {
9
- top: "bottom",
10
- bottom: "top",
11
- left: "right",
12
- right: "left"
13
- };
14
- function a(e) {
15
- let [t, n] = e.split("-");
16
- return {
17
- side: t,
18
- align: n
19
- };
20
- }
21
- function o(e, t, n, r, o, s, c) {
22
- let l = window.innerWidth, u = window.innerHeight, { side: d, align: f } = a(r), p = (r) => {
23
- switch (r) {
24
- case "bottom": return e.bottom + o + n > u - c;
25
- case "top": return e.top - o - n < c;
26
- case "right": return e.right + o + t > l - c;
27
- case "left": return e.left - o - t < c;
28
- }
29
- }, m = d;
30
- if (p(d)) {
31
- let e = i[d];
32
- p(e) || (m = e);
33
- }
34
- let h = 0, g = 0;
35
- switch (m) {
36
- case "bottom":
37
- h = e.bottom + o;
38
- break;
39
- case "top":
40
- h = e.top - o - n;
41
- break;
42
- case "right":
43
- g = e.right + o;
44
- break;
45
- case "left":
46
- g = e.left - o - t;
47
- break;
48
- }
49
- return m === "top" || m === "bottom" ? (g = f === "start" ? e.left : e.right - t, g += s) : (h = f === "start" ? e.top : e.bottom - n, h += s), g = Math.min(Math.max(g, c), Math.max(c, l - t - c)), h = Math.min(Math.max(h, c), Math.max(c, u - n - c)), {
50
- left: g,
51
- top: h
52
- };
53
- }
54
- function s({ anchor: i, placement: a = "bottom-start", offset: s = 6, crossOffset: c = 0, viewportMargin: l = 8 }) {
55
- let u = t(null), [d, f] = n(r);
56
- return e(() => {
57
- if (i === null) return;
58
- let e = () => {
59
- let e = u.current;
60
- if (e === null) return;
61
- let { left: t, top: n } = o(i.getBoundingClientRect(), e.offsetWidth, e.offsetHeight, a, s, c, l);
62
- f({
63
- position: "fixed",
64
- left: t,
65
- top: n
66
- });
67
- };
68
- e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0);
69
- let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
70
- e();
71
- });
72
- return t?.observe(i), u.current !== null && t?.observe(u.current), () => {
73
- window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0), t?.disconnect();
74
- };
75
- }, [
76
- i,
77
- a,
78
- s,
79
- c,
80
- l
81
- ]), {
82
- floatingRef: u,
83
- style: d
84
- };
85
- }
86
- //#endregion
87
- export { s as t };