@cognitap/radiant 0.0.12 → 0.0.13
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.
- package/CHANGELOG.md +5 -1
- package/dist/library/Combobox.d.ts +88 -0
- package/dist/library/Combobox.d.ts.map +1 -0
- package/dist/library/Combobox.js +365 -0
- package/dist/library/Combobox.js.map +1 -0
- package/dist/library/Select.js +1 -1
- package/dist/library/Select.js.map +1 -1
- package/dist/library/cn.d.ts.map +1 -1
- package/dist/library/cn.js +18 -1
- package/dist/library/cn.js.map +1 -1
- package/dist/library/comboboxStyles.d.ts +6 -0
- package/dist/library/comboboxStyles.d.ts.map +1 -0
- package/dist/library/comboboxStyles.js +38 -0
- package/dist/library/comboboxStyles.js.map +1 -0
- package/dist/library/index.d.ts +2 -0
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +1 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/motion/popup.js +5 -5
- package/dist/library/motion/popup.js.map +1 -1
- package/dist/library/react/useComboboxPopup.d.ts +4 -0
- package/dist/library/react/useComboboxPopup.d.ts.map +1 -0
- package/dist/library/react/useComboboxPopup.js +118 -0
- package/dist/library/react/useComboboxPopup.js.map +1 -0
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/components.d.ts +25 -0
- package/dist/library/themes/components.d.ts.map +1 -1
- package/dist/library/themes/components.js +25 -0
- package/dist/library/themes/components.js.map +1 -1
- package/docs/architecture.md +23 -17
- package/package.json +1 -1
- package/src/Combobox.tsx +752 -0
- package/src/Select.tsx +1 -1
- package/src/cn.ts +18 -1
- package/src/comboboxStyles.ts +41 -0
- package/src/index.ts +22 -0
- package/src/motion/popup.ts +5 -5
- package/src/react/useComboboxPopup.ts +130 -0
- package/src/themes/components.ts +25 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
3
|
+
import { positionSelect } from '../internal/select.js';
|
|
4
|
+
/** Local top-layer popup: preserve theme/modal ancestry and place before its first paint. */
|
|
5
|
+
export function useComboboxPopup(nodeRef, input, open, dismiss, sideOffset, collisionPadding) {
|
|
6
|
+
const latest = useRef(dismiss);
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
latest.current = dismiss;
|
|
9
|
+
});
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
const node = nodeRef.current;
|
|
12
|
+
if (!node || !input)
|
|
13
|
+
return;
|
|
14
|
+
if (!open) {
|
|
15
|
+
if (node.matches(':popover-open'))
|
|
16
|
+
node.hidePopover();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const doc = input.ownerDocument;
|
|
20
|
+
const win = doc.defaultView;
|
|
21
|
+
const seedWidth = () => {
|
|
22
|
+
const available = (win.visualViewport?.width ?? win.innerWidth) - 2 * Math.max(0, collisionPadding);
|
|
23
|
+
node.style.setProperty('--_rad-combobox-width', `${Math.min(input.getBoundingClientRect().width, Math.max(0, available))}px`);
|
|
24
|
+
};
|
|
25
|
+
seedWidth();
|
|
26
|
+
node.showPopover();
|
|
27
|
+
const place = () => {
|
|
28
|
+
if (!node.isConnected || !node.matches(':popover-open'))
|
|
29
|
+
return;
|
|
30
|
+
seedWidth();
|
|
31
|
+
const viewport = win.visualViewport;
|
|
32
|
+
const css = win.getComputedStyle(node);
|
|
33
|
+
const anchor = input.getBoundingClientRect();
|
|
34
|
+
const padding = Math.max(0, collisionPadding);
|
|
35
|
+
const list = node.querySelector('[data-slot="combobox-listbox"]');
|
|
36
|
+
const status = node.querySelector('[data-slot="combobox-status"]');
|
|
37
|
+
const naturalHeight = (list?.scrollHeight ?? node.scrollHeight) +
|
|
38
|
+
(status?.offsetHeight ?? 0) +
|
|
39
|
+
parseFloat(css.paddingTop) +
|
|
40
|
+
parseFloat(css.paddingBottom) +
|
|
41
|
+
parseFloat(css.borderTopWidth) +
|
|
42
|
+
parseFloat(css.borderBottomWidth);
|
|
43
|
+
const above = anchor.top - (viewport?.offsetTop ?? 0) - padding - sideOffset;
|
|
44
|
+
const below = (viewport?.offsetTop ?? 0) +
|
|
45
|
+
(viewport?.height ?? win.innerHeight) -
|
|
46
|
+
anchor.bottom -
|
|
47
|
+
padding -
|
|
48
|
+
sideOffset;
|
|
49
|
+
const next = positionSelect({
|
|
50
|
+
trigger: anchor,
|
|
51
|
+
width: node.getBoundingClientRect().width,
|
|
52
|
+
height: Math.min(naturalHeight, Math.max(0, above, below)),
|
|
53
|
+
selectedOffset: 0,
|
|
54
|
+
viewport: {
|
|
55
|
+
top: viewport?.offsetTop ?? 0,
|
|
56
|
+
left: viewport?.offsetLeft ?? 0,
|
|
57
|
+
width: viewport?.width ?? win.innerWidth,
|
|
58
|
+
height: viewport?.height ?? win.innerHeight
|
|
59
|
+
},
|
|
60
|
+
padding: Math.max(0, collisionPadding),
|
|
61
|
+
offset: sideOffset,
|
|
62
|
+
aligned: false,
|
|
63
|
+
rtl: win.getComputedStyle(input).direction === 'rtl'
|
|
64
|
+
});
|
|
65
|
+
for (const [key, value] of Object.entries({
|
|
66
|
+
top: next.top,
|
|
67
|
+
left: next.left,
|
|
68
|
+
width: next.width,
|
|
69
|
+
'max-height': next.maxHeight
|
|
70
|
+
})) {
|
|
71
|
+
const property = `--_rad-combobox-${key}`;
|
|
72
|
+
if (node.style.getPropertyValue(property) !== `${value}px`)
|
|
73
|
+
node.style.setProperty(property, `${value}px`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
place();
|
|
77
|
+
let frame = 0;
|
|
78
|
+
const schedule = () => {
|
|
79
|
+
if (!frame)
|
|
80
|
+
frame = win.requestAnimationFrame(() => {
|
|
81
|
+
frame = 0;
|
|
82
|
+
place();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const outside = (event) => {
|
|
86
|
+
const target = event.target;
|
|
87
|
+
if (target instanceof win.Node &&
|
|
88
|
+
!node.contains(target) &&
|
|
89
|
+
!input.parentElement?.contains(target))
|
|
90
|
+
latest.current();
|
|
91
|
+
};
|
|
92
|
+
const observer = new win.ResizeObserver(schedule);
|
|
93
|
+
const mutations = new win.MutationObserver(schedule);
|
|
94
|
+
observer.observe(input);
|
|
95
|
+
observer.observe(node);
|
|
96
|
+
mutations.observe(node, { childList: true, subtree: true, characterData: true });
|
|
97
|
+
doc.addEventListener('pointerdown', outside, true);
|
|
98
|
+
doc.addEventListener('focusin', outside);
|
|
99
|
+
doc.addEventListener('scroll', schedule, true);
|
|
100
|
+
win.addEventListener('resize', schedule);
|
|
101
|
+
win.visualViewport?.addEventListener('resize', schedule);
|
|
102
|
+
win.visualViewport?.addEventListener('scroll', schedule);
|
|
103
|
+
return () => {
|
|
104
|
+
observer.disconnect();
|
|
105
|
+
mutations.disconnect();
|
|
106
|
+
win.cancelAnimationFrame(frame);
|
|
107
|
+
doc.removeEventListener('pointerdown', outside, true);
|
|
108
|
+
doc.removeEventListener('focusin', outside);
|
|
109
|
+
doc.removeEventListener('scroll', schedule, true);
|
|
110
|
+
win.removeEventListener('resize', schedule);
|
|
111
|
+
win.visualViewport?.removeEventListener('resize', schedule);
|
|
112
|
+
win.visualViewport?.removeEventListener('scroll', schedule);
|
|
113
|
+
if (node.matches(':popover-open'))
|
|
114
|
+
node.hidePopover();
|
|
115
|
+
};
|
|
116
|
+
}, [nodeRef, input, open, sideOffset, collisionPadding]);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=useComboboxPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComboboxPopup.js","sourceRoot":"","sources":["../../../src/react/useComboboxPopup.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,6FAA6F;AAC7F,MAAM,UAAU,gBAAgB,CAC9B,OAAyC,EACzC,KAA8B,EAC9B,IAAa,EACb,OAA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AAC,UAAU,EAAE,CAAA;YACtB,GAAG,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAA;YAC/B,GAAG,CAAC,mBAAmB,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;YACrD,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAC3C,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;YACjD,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3C,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;gBAAE,IAAI,CAAC,WAAW,EAAE,CAAA;QACvD,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["'use client'\n\nimport { useLayoutEffect, useRef, type RefObject } from 'react'\nimport { positionSelect } from '../internal/select.js'\n\n/** Local top-layer popup: preserve theme/modal ancestry and place before its first paint. */\nexport function useComboboxPopup(\n nodeRef: RefObject<HTMLDivElement | null>,\n input: HTMLInputElement | null,\n open: boolean,\n dismiss: () => void,\n sideOffset: number,\n collisionPadding: number\n) {\n const latest = useRef(dismiss)\n useLayoutEffect(() => {\n latest.current = dismiss\n })\n useLayoutEffect(() => {\n const node = nodeRef.current\n if (!node || !input) return\n if (!open) {\n if (node.matches(':popover-open')) node.hidePopover()\n return\n }\n const doc = input.ownerDocument\n const win = doc.defaultView!\n const seedWidth = () => {\n const available =\n (win.visualViewport?.width ?? win.innerWidth) - 2 * Math.max(0, collisionPadding)\n node.style.setProperty(\n '--_rad-combobox-width',\n `${Math.min(input.getBoundingClientRect().width, Math.max(0, available))}px`\n )\n }\n seedWidth()\n node.showPopover()\n const place = () => {\n if (!node.isConnected || !node.matches(':popover-open')) return\n seedWidth()\n const viewport = win.visualViewport\n const css = win.getComputedStyle(node)\n const anchor = input.getBoundingClientRect()\n const padding = Math.max(0, collisionPadding)\n const list = node.querySelector<HTMLElement>('[data-slot=\"combobox-listbox\"]')\n const status = node.querySelector<HTMLElement>('[data-slot=\"combobox-status\"]')\n const naturalHeight =\n (list?.scrollHeight ?? node.scrollHeight) +\n (status?.offsetHeight ?? 0) +\n parseFloat(css.paddingTop) +\n parseFloat(css.paddingBottom) +\n parseFloat(css.borderTopWidth) +\n parseFloat(css.borderBottomWidth)\n const above = anchor.top - (viewport?.offsetTop ?? 0) - padding - sideOffset\n const below =\n (viewport?.offsetTop ?? 0) +\n (viewport?.height ?? win.innerHeight) -\n anchor.bottom -\n padding -\n sideOffset\n const next = positionSelect({\n trigger: anchor,\n width: node.getBoundingClientRect().width,\n height: Math.min(naturalHeight, Math.max(0, above, below)),\n selectedOffset: 0,\n viewport: {\n top: viewport?.offsetTop ?? 0,\n left: viewport?.offsetLeft ?? 0,\n width: viewport?.width ?? win.innerWidth,\n height: viewport?.height ?? win.innerHeight\n },\n padding: Math.max(0, collisionPadding),\n offset: sideOffset,\n aligned: false,\n rtl: win.getComputedStyle(input).direction === 'rtl'\n })\n for (const [key, value] of Object.entries({\n top: next.top,\n left: next.left,\n width: next.width,\n 'max-height': next.maxHeight\n })) {\n const property = `--_rad-combobox-${key}`\n if (node.style.getPropertyValue(property) !== `${value}px`)\n node.style.setProperty(property, `${value}px`)\n }\n }\n place()\n let frame = 0\n const schedule = () => {\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0\n place()\n })\n }\n const outside = (event: PointerEvent | FocusEvent) => {\n const target = event.target\n if (\n target instanceof win.Node &&\n !node.contains(target) &&\n !input.parentElement?.contains(target)\n )\n latest.current()\n }\n const observer = new win.ResizeObserver(schedule)\n const mutations = new win.MutationObserver(schedule)\n observer.observe(input)\n observer.observe(node)\n mutations.observe(node, { childList: true, subtree: true, characterData: true })\n doc.addEventListener('pointerdown', outside, true)\n doc.addEventListener('focusin', outside)\n doc.addEventListener('scroll', schedule, true)\n win.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('scroll', schedule)\n return () => {\n observer.disconnect()\n mutations.disconnect()\n win.cancelAnimationFrame(frame)\n doc.removeEventListener('pointerdown', outside, true)\n doc.removeEventListener('focusin', outside)\n doc.removeEventListener('scroll', schedule, true)\n win.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('scroll', schedule)\n if (node.matches(':popover-open')) node.hidePopover()\n }\n }, [nodeRef, input, open, sideOffset, collisionPadding])\n}\n"]}
|