docthub-core-components 2.99.2 → 3.1.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 (88) hide show
  1. package/dist/components/overrides/ui/auto-complete.js +466 -0
  2. package/dist/components/overrides/ui/autocomplete-checkbox.js +480 -0
  3. package/dist/components/overrides/ui/chips/doct-chip.js +157 -0
  4. package/dist/components/overrides/ui/circular-progress.js +32 -0
  5. package/dist/components/overrides/ui/composed/address-form-section.js +67 -0
  6. package/dist/components/overrides/ui/composed/contact-form-section.js +56 -0
  7. package/dist/components/overrides/ui/composed/search-filter-section.js +132 -0
  8. package/dist/components/overrides/ui/composed/user-registration-section.js +77 -0
  9. package/dist/components/overrides/ui/currencyInput/currency-input.js +69 -0
  10. package/dist/components/overrides/ui/doct-animation-loader.js +13 -0
  11. package/dist/components/overrides/ui/expandable-card.js +115 -0
  12. package/dist/components/overrides/ui/footer/doct-footer.js +35 -0
  13. package/dist/components/overrides/ui/footer/footer-desktop.js +92 -0
  14. package/dist/components/overrides/ui/footer/footer-mobile.js +123 -0
  15. package/dist/components/overrides/ui/footer/footer-routes.js +87 -0
  16. package/dist/components/overrides/ui/footer/footer-shared.js +137 -0
  17. package/dist/components/overrides/ui/footer/presets.js +269 -0
  18. package/dist/components/overrides/ui/inputs/labeled-input.js +92 -0
  19. package/dist/components/overrides/ui/inputs/otp-input.js +101 -0
  20. package/dist/components/overrides/ui/inputs/password-input.js +77 -0
  21. package/dist/components/overrides/ui/inputs/phone-input.js +336 -0
  22. package/dist/components/overrides/ui/navigation-menu/doct-navigation-menu.js +22 -0
  23. package/dist/components/overrides/ui/navigation-menu/individual-nav-routes.js +46 -0
  24. package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu-desktop.js +109 -0
  25. package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu-mobile.js +231 -0
  26. package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu.js +44 -0
  27. package/dist/components/overrides/ui/navigation-menu/nav-env.js +64 -0
  28. package/dist/components/overrides/ui/navigation-menu/navigation-menu-adapter.js +55 -0
  29. package/dist/components/overrides/ui/navigation-menu/navigation-menu-internal.js +36 -0
  30. package/dist/components/overrides/ui/navigation-menu/organization-nav-routes.js +34 -0
  31. package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu-desktop.js +109 -0
  32. package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu-mobile.js +231 -0
  33. package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu.js +44 -0
  34. package/dist/components/overrides/ui/navigation-menu/presets.js +238 -0
  35. package/dist/components/overrides/ui/navigation-menu/types.js +6 -0
  36. package/dist/components/overrides/ui/pickers/date-picker-field.js +361 -0
  37. package/dist/components/overrides/ui/pickers/date-range-picker-field.js +288 -0
  38. package/dist/components/overrides/ui/pickers/day-picker-bounds.js +38 -0
  39. package/dist/components/overrides/ui/pickers/select-field.js +158 -0
  40. package/dist/components/overrides/ui/search/auto-complete.js +64 -0
  41. package/dist/components/overrides/ui/search/search-input.js +65 -0
  42. package/dist/components/overrides/ui/showcase/component-section.js +45 -0
  43. package/dist/components/ui/alert.js +94 -0
  44. package/dist/components/ui/avatar.js +69 -0
  45. package/dist/components/ui/badge.js +37 -0
  46. package/dist/components/ui/breadcrumb.js +117 -0
  47. package/dist/components/ui/button.js +223 -0
  48. package/dist/components/ui/calendar.js +100 -0
  49. package/dist/components/ui/checkbox.js +57 -0
  50. package/dist/components/ui/collapsible.js +25 -0
  51. package/dist/components/ui/command.js +132 -0
  52. package/dist/components/ui/dialog.js +230 -0
  53. package/dist/components/ui/drawer.js +119 -0
  54. package/dist/components/ui/dropdown-menu.js +216 -0
  55. package/dist/components/ui/input.js +48 -0
  56. package/dist/components/ui/label.js +22 -0
  57. package/dist/components/ui/popover.js +181 -0
  58. package/dist/components/ui/progress.js +91 -0
  59. package/dist/components/ui/radio-group.js +49 -0
  60. package/dist/components/ui/select.js +169 -0
  61. package/dist/components/ui/skeleton.js +91 -0
  62. package/dist/components/ui/spinner.js +32 -0
  63. package/dist/components/ui/tabs.js +68 -0
  64. package/dist/components/ui/textarea.js +73 -0
  65. package/dist/components/ui/timeline.js +177 -0
  66. package/dist/components/ui/toast.js +82 -0
  67. package/dist/components/ui/tooltip.js +91 -0
  68. package/dist/components/ui/typography.js +213 -0
  69. package/dist/hooks/use-exclusive-dropdown.js +53 -0
  70. package/dist/hooks/use-mobile.js +19 -0
  71. package/dist/hooks/useAutocompleteCheckbox.js +204 -0
  72. package/dist/index.esm.js +7173 -7126
  73. package/dist/index.js +187 -0
  74. package/dist/lib/dropdown-manager.js +17 -0
  75. package/dist/lib/get-floating-dropdown-position.js +32 -0
  76. package/dist/lib/get-scroll-parents.js +20 -0
  77. package/dist/lib/slot.js +40 -0
  78. package/dist/lib/utils.js +9 -0
  79. package/dist/src/components/ui/alert.d.ts +1 -1
  80. package/dist/src/components/ui/button.d.ts +1 -1
  81. package/dist/src/components/ui/command.d.ts +3 -3
  82. package/dist/src/components/ui/timeline.d.ts +1 -1
  83. package/dist/src/index.d.ts +15 -15
  84. package/dist/src/lib/get-floating-dropdown-position.d.ts +9 -1
  85. package/dist/src/lib/get-scroll-parents.d.ts +6 -0
  86. package/dist/style.css +1 -1
  87. package/dist/util/getInputClasses.js +19 -0
  88. package/package.json +131 -132
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { c as D } from "react-compiler-runtime";
3
+ import { useState as b, useEffect as d } from "react";
4
+ import { openDropdown as p, releaseDropdown as u } from "../lib/dropdown-manager.js";
5
+ function x() {
6
+ const e = D(9), [f, _] = b(0);
7
+ let n;
8
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (n = () => {
9
+ _(C);
10
+ }, e[0] = n) : n = e[0];
11
+ const t = n;
12
+ let r, c;
13
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (r = () => () => {
14
+ u(t);
15
+ }, c = [t], e[1] = r, e[2] = c) : (r = e[1], c = e[2]), d(r, c);
16
+ let l;
17
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (l = () => {
18
+ p(t);
19
+ }, e[3] = l) : l = e[3];
20
+ const y = l;
21
+ let s;
22
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (s = (o) => {
23
+ o ? p(t) : u(t);
24
+ }, e[4] = s) : s = e[4];
25
+ const h = s;
26
+ let i;
27
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (i = (o) => {
28
+ (o.key === "Enter" || o.key === " " || o.key === "ArrowDown" || o.key === "ArrowUp") && p(t);
29
+ }, e[5] = i) : i = e[5];
30
+ const w = i;
31
+ let a;
32
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (a = {
33
+ style: {
34
+ display: "contents"
35
+ },
36
+ onPointerDownCapture: y,
37
+ onFocusCapture: y,
38
+ onKeyDownCapture: w
39
+ }, e[6] = a) : a = e[6];
40
+ const S = a;
41
+ let m;
42
+ return e[7] !== f ? (m = {
43
+ instanceKey: f,
44
+ containerProps: S,
45
+ onOpenChange: h
46
+ }, e[7] = f, e[8] = m) : m = e[8], m;
47
+ }
48
+ function C(e) {
49
+ return e + 1;
50
+ }
51
+ export {
52
+ x as useExclusiveDropdown
53
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { c } from "react-compiler-runtime";
3
+ import * as r from "react";
4
+ const n = 1024;
5
+ function h() {
6
+ const e = c(2), [a, o] = r.useState(void 0);
7
+ let t, i;
8
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = () => {
9
+ if (globalThis.window === void 0)
10
+ return;
11
+ const s = globalThis.window.matchMedia(`(max-width: ${n - 1}px)`), l = () => {
12
+ o(globalThis.window.innerWidth < n);
13
+ };
14
+ return s.addEventListener("change", l), o(globalThis.window.innerWidth < n), () => s.removeEventListener("change", l);
15
+ }, i = [], e[0] = t, e[1] = i) : (t = e[0], i = e[1]), r.useEffect(t, i), !!a;
16
+ }
17
+ export {
18
+ h as useIsMobile
19
+ };
@@ -0,0 +1,204 @@
1
+ "use client";
2
+ import { useState as A, useRef as O, useMemo as U, useCallback as a, useEffect as V } from "react";
3
+ import { getFloatingDropdownPosition as C } from "../lib/get-floating-dropdown-position.js";
4
+ import { getScrollParentClipRects as ee, getScrollParents as te } from "../lib/get-scroll-parents.js";
5
+ const re = (r, u) => u && typeof r == "object" && r !== null ? r[u.text] : typeof r == "string" ? r : (r == null ? void 0 : r.label) || "", se = (r, u) => u && typeof r == "object" && r !== null ? r[u.value] : typeof r == "string" ? r : (r == null ? void 0 : r.value) || r, ce = (r, u, o, s) => o(r, s) === o(u, s), K = (r) => {
6
+ if (r == null) return "";
7
+ try {
8
+ return String(r).toLowerCase().replace(/[^a-z0-9]/g, "");
9
+ } catch {
10
+ return "";
11
+ }
12
+ }, oe = (r, u, o, s) => {
13
+ if (!u) return r;
14
+ const w = K(u);
15
+ return r.filter((P) => {
16
+ const R = o(P, s);
17
+ return K(R).includes(w);
18
+ });
19
+ };
20
+ function ue({
21
+ // Core props
22
+ options: r = [],
23
+ value: u = [],
24
+ onChange: o,
25
+ onInputChange: s,
26
+ // Behavior props
27
+ disabled: w = !1,
28
+ disableCloseOnSelect: P = !0,
29
+ freeSolo: R,
30
+ // Advanced props
31
+ fields: p,
32
+ getOptionLabel: z = (c) => re(c, p),
33
+ getOptionValue: q = (c) => se(c, p),
34
+ isOptionEqualToValue: G,
35
+ filterOptions: g
36
+ }) {
37
+ const [c, d] = A(!1), [i, b] = A(""), [x, S] = A(-1), [, k] = A(!1), [M, J] = A({
38
+ top: 0,
39
+ left: 0,
40
+ width: 0,
41
+ maxHeight: 0,
42
+ placement: "bottom"
43
+ }), T = O(null), j = O(null), L = O(null), H = O(null), B = O(!1), y = U(() => G || ((e, t) => ce(e, t, q, p)), [G, q, p]), N = a((e) => {
44
+ try {
45
+ return z(e);
46
+ } catch {
47
+ return String(e);
48
+ }
49
+ }, [z]), E = U(() => u ?? [], [u]), v = r ?? [], D = U(() => {
50
+ const e = v;
51
+ if (g)
52
+ return g(e, {
53
+ inputValue: i
54
+ });
55
+ const t = oe(e, i, z, p);
56
+ if (R && i && i.trim() !== "")
57
+ if (v.length === 0 || v.every((l) => typeof l == "string")) {
58
+ if (!t.some((n) => N(n).toLowerCase() === i.toLowerCase()))
59
+ return [...t, i];
60
+ } else
61
+ process.env.NODE_ENV !== "production" && console.warn("[useAutocompleteCheckbox] freeSolo is only supported for string types. For object types, consider using a different approach or constraining your generic to string.");
62
+ return t;
63
+ }, [v, i, g, z, p, R, N]), Q = a((e) => E.some((t) => y(e, t)), [E, y]), m = a(() => {
64
+ const e = H.current || L.current;
65
+ if (e) {
66
+ const t = ee(e);
67
+ J(C({
68
+ anchorRect: e.getBoundingClientRect(),
69
+ placement: "auto",
70
+ strategy: "fixed",
71
+ clipRects: t
72
+ }));
73
+ }
74
+ }, []), W = a((e) => {
75
+ const t = e.target.value;
76
+ k(!0), b(t), s == null || s(e, t), !c && t && d(!0);
77
+ }, [c, s]), F = a((e) => {
78
+ if (w) return;
79
+ const t = E, f = t.some((n) => y(e, n));
80
+ let l;
81
+ f ? l = t.filter((n) => !y(e, n)) : l = [...t, e], o == null || o(null, l), k(!1), P || d(!1), setTimeout(() => {
82
+ var n;
83
+ (n = T.current) == null || n.focus();
84
+ }, 0), S(-1);
85
+ }, [w, E, y, o, P]), X = a((e) => {
86
+ if (w) return;
87
+ const t = E.filter((f) => !y(e, f));
88
+ o == null || o(null, t);
89
+ }, [w, E, y, o]), Y = a((e) => {
90
+ e.stopPropagation(), b(""), k(!1), s == null || s({
91
+ target: {
92
+ value: ""
93
+ }
94
+ }, ""), setTimeout(() => {
95
+ T.current && (T.current.value = "", T.current.focus());
96
+ }, 0), d(!1);
97
+ }, [s]), Z = a(() => {
98
+ w || (o == null || o(null, []), b(""));
99
+ }, [w, o]), $ = a((e) => {
100
+ if (!c && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
101
+ d(!0);
102
+ return;
103
+ }
104
+ if (c)
105
+ switch (e.key) {
106
+ case "ArrowDown":
107
+ e.preventDefault(), S((t) => t < D.length - 1 ? t + 1 : 0);
108
+ break;
109
+ case "ArrowUp":
110
+ e.preventDefault(), S((t) => t > 0 ? t - 1 : D.length - 1);
111
+ break;
112
+ case "Enter":
113
+ e.preventDefault(), x >= 0 && D[x] ? F(D[x]) : R && i && (v.length === 0 || v.every((f) => typeof f == "string") ? F(i) : process.env.NODE_ENV !== "production" && console.warn("[useAutocompleteCheckbox] freeSolo Enter key is only supported for string types. For object types, consider using a different approach or constraining your generic to string."));
114
+ break;
115
+ case "Escape":
116
+ d(!1), S(-1);
117
+ break;
118
+ case "Tab":
119
+ d(!1);
120
+ break;
121
+ }
122
+ }, [c, D, x, F, R, i, v]), _ = a(() => {
123
+ c || i === "" && (s == null || s({
124
+ target: {
125
+ value: ""
126
+ }
127
+ }, "")), d(!c);
128
+ }, [c, i, s]), h = a(() => {
129
+ m(), d(!0), k(!1);
130
+ }, [m]);
131
+ return V(() => {
132
+ B.current && !c && (b(""), k(!1), s == null || s({
133
+ target: {
134
+ value: ""
135
+ }
136
+ }, "")), B.current = c;
137
+ }, [c, s]), V(() => {
138
+ if (!(c || i !== "")) return;
139
+ const t = (f) => {
140
+ const l = f.target, n = L.current ? !L.current.contains(l) : !0, I = j.current ? !j.current.contains(l) : !0;
141
+ n && I && (d(!1), b(""), k(!1), s == null || s({
142
+ target: {
143
+ value: ""
144
+ }
145
+ }, ""));
146
+ };
147
+ return typeof window < "u" && document.addEventListener("pointerdown", t, !0), () => {
148
+ typeof window < "u" && document.removeEventListener("pointerdown", t, !0);
149
+ };
150
+ }, [c, i, s]), V(() => {
151
+ c && (m(), requestAnimationFrame(() => {
152
+ m();
153
+ }));
154
+ }, [c, m]), V(() => {
155
+ if (!c || typeof window > "u") return;
156
+ const e = () => {
157
+ m();
158
+ }, t = H.current ?? L.current, f = te(t), l = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
159
+ m();
160
+ });
161
+ return l == null || l.observe(t ?? document.body), f.forEach((n) => {
162
+ n.addEventListener("scroll", e, {
163
+ passive: !0
164
+ });
165
+ }), window.addEventListener("resize", e), () => {
166
+ l == null || l.disconnect(), f.forEach((n) => {
167
+ n.removeEventListener("scroll", e);
168
+ }), window.removeEventListener("resize", e);
169
+ };
170
+ }, [c, m]), {
171
+ // State
172
+ open: c,
173
+ inputValue: i,
174
+ highlightedIndex: x,
175
+ filteredOptions: D,
176
+ selectedOptions: E,
177
+ dropdownPosition: M,
178
+ // Refs
179
+ inputRef: T,
180
+ listRef: j,
181
+ containerRef: L,
182
+ triggerRef: H,
183
+ // Actions
184
+ setOpen: d,
185
+ setInputValue: b,
186
+ setHighlightedIndex: S,
187
+ handleInputChange: W,
188
+ handleOptionSelect: F,
189
+ handleTagRemove: X,
190
+ handleClear: Y,
191
+ handleClearAll: Z,
192
+ handleKeyDown: $,
193
+ handleToggle: _,
194
+ handleFocus: h,
195
+ updateDropdownPosition: m,
196
+ // Utilities
197
+ isOptionSelected: Q,
198
+ getOptionLabelSafe: N,
199
+ memoizedIsOptionEqualToValue: y
200
+ };
201
+ }
202
+ export {
203
+ ue as useAutocompleteCheckbox
204
+ };