@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
package/src/Select.tsx
CHANGED
|
@@ -606,7 +606,7 @@ export function SelectContent({
|
|
|
606
606
|
controlMetrics({ controlSize: select.controlSize }),
|
|
607
607
|
motionActive &&
|
|
608
608
|
!motionOff &&
|
|
609
|
-
'opacity-[var(--_rad-
|
|
609
|
+
'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100',
|
|
610
610
|
className
|
|
611
611
|
)}
|
|
612
612
|
data-slot="select-content"
|
package/src/cn.ts
CHANGED
|
@@ -11,12 +11,14 @@ export const cn: CnFunction = createCn({
|
|
|
11
11
|
classGroups: {
|
|
12
12
|
'font-family': [
|
|
13
13
|
...roleClasses('font', 'family'),
|
|
14
|
+
'font-(--rad-combobox-font-family)',
|
|
14
15
|
'font-(--rad-select-font-family)',
|
|
15
16
|
'font-(--rad-textarea-font-family)',
|
|
16
17
|
'font-(--rad-tabs-font-family)'
|
|
17
18
|
],
|
|
18
19
|
'font-weight': [
|
|
19
20
|
...roleClasses('font', 'weight'),
|
|
21
|
+
'font-(--rad-combobox-font-weight)',
|
|
20
22
|
'font-(--rad-select-font-weight)',
|
|
21
23
|
'font-(--rad-textarea-font-weight)',
|
|
22
24
|
'font-(--rad-tabs-font-weight)'
|
|
@@ -24,12 +26,14 @@ export const cn: CnFunction = createCn({
|
|
|
24
26
|
'font-size': [
|
|
25
27
|
...roleClasses('text', 'size'),
|
|
26
28
|
...roleClasses('text', 'fluid-size'),
|
|
29
|
+
'text-(--rad-combobox-font-size)',
|
|
27
30
|
'text-(--rad-select-font-size)',
|
|
28
31
|
'text-(--rad-textarea-font-size)',
|
|
29
32
|
'text-(--rad-switch-label-size)',
|
|
30
33
|
'text-(--rad-tabs-font-size)'
|
|
31
34
|
],
|
|
32
35
|
h: [
|
|
36
|
+
'h-(--rad-combobox-height)',
|
|
33
37
|
'h-(--rad-select-height)',
|
|
34
38
|
'h-(--rad-switch-height)',
|
|
35
39
|
'h-(--rad-slider-height)',
|
|
@@ -41,21 +45,26 @@ export const cn: CnFunction = createCn({
|
|
|
41
45
|
'min-h': ['min-h-(--rad-textarea-min-height)', 'min-h-(--rad-tabs-trigger-height)'],
|
|
42
46
|
py: ['py-(--rad-textarea-padding-block)'],
|
|
43
47
|
px: [
|
|
48
|
+
'px-(--rad-combobox-padding)',
|
|
44
49
|
'px-(--rad-select-padding)',
|
|
45
50
|
'px-(--rad-textarea-padding)',
|
|
46
51
|
'px-(--rad-tabs-trigger-padding)'
|
|
47
52
|
],
|
|
48
53
|
p: [
|
|
54
|
+
'p-(--rad-combobox-content-padding)',
|
|
49
55
|
'p-(--rad-select-content-padding)',
|
|
50
56
|
'p-(--rad-tabs-list-padding)',
|
|
51
57
|
'p-(--rad-tabs-content-padding)'
|
|
52
58
|
],
|
|
53
59
|
rounded: [
|
|
60
|
+
'rounded-(--rad-combobox-radius)',
|
|
54
61
|
'rounded-(--rad-select-radius)',
|
|
55
62
|
'rounded-(--rad-textarea-radius)',
|
|
56
63
|
'rounded-(--rad-switch-radius)',
|
|
57
64
|
'rounded-(--rad-switch-thumb-radius)',
|
|
65
|
+
'rounded-(--rad-combobox-content-radius)',
|
|
58
66
|
'rounded-(--rad-select-content-radius)',
|
|
67
|
+
'rounded-(--rad-combobox-item-radius)',
|
|
59
68
|
'rounded-(--rad-select-item-radius)',
|
|
60
69
|
'rounded-(--rad-slider-track-radius)',
|
|
61
70
|
'rounded-(--rad-slider-thumb-radius)',
|
|
@@ -64,6 +73,7 @@ export const cn: CnFunction = createCn({
|
|
|
64
73
|
'rounded-(--rad-tabs-content-radius)'
|
|
65
74
|
],
|
|
66
75
|
'border-w': [
|
|
76
|
+
'border-(--rad-combobox-border-width)',
|
|
67
77
|
'border-(--rad-select-border-width)',
|
|
68
78
|
'border-(--rad-textarea-border-width)',
|
|
69
79
|
'border-(--rad-switch-border-width)',
|
|
@@ -71,17 +81,21 @@ export const cn: CnFunction = createCn({
|
|
|
71
81
|
'border-(--rad-tabs-trigger-border-width)'
|
|
72
82
|
],
|
|
73
83
|
'border-style': [
|
|
84
|
+
'border-(--rad-combobox-border-style)',
|
|
74
85
|
'border-(--rad-select-border-style)',
|
|
75
86
|
'border-(--rad-textarea-border-style)',
|
|
76
87
|
'border-(--rad-switch-border-style)'
|
|
77
88
|
],
|
|
78
89
|
shadow: [
|
|
90
|
+
'shadow-(--rad-combobox-shadow)',
|
|
79
91
|
'shadow-(--rad-select-shadow)',
|
|
92
|
+
'shadow-(--rad-combobox-content-shadow)',
|
|
80
93
|
'shadow-(--rad-select-content-shadow)',
|
|
81
94
|
'shadow-(--rad-textarea-shadow)',
|
|
82
95
|
'shadow-(--rad-slider-thumb-shadow)'
|
|
83
96
|
],
|
|
84
97
|
'corner-shape': [
|
|
98
|
+
'[corner-shape:var(--rad-combobox-corner-shape)]',
|
|
85
99
|
'[corner-shape:var(--rad-select-corner-shape)]',
|
|
86
100
|
'[corner-shape:var(--rad-textarea-corner-shape)]',
|
|
87
101
|
'[corner-shape:var(--rad-switch-corner-shape)]',
|
|
@@ -107,7 +121,10 @@ export const cn: CnFunction = createCn({
|
|
|
107
121
|
'outline-(--rad-tabs-focus-style)'
|
|
108
122
|
],
|
|
109
123
|
opacity: ['opacity-(--rad-tabs-disabled-opacity)'],
|
|
110
|
-
'backdrop-filter': [
|
|
124
|
+
'backdrop-filter': [
|
|
125
|
+
'[backdrop-filter:var(--rad-combobox-content-backdrop-filter)]',
|
|
126
|
+
'[backdrop-filter:var(--rad-select-content-backdrop-filter)]'
|
|
127
|
+
],
|
|
111
128
|
leading: roleClasses('leading', 'line-height'),
|
|
112
129
|
tracking: roleClasses('tracking', 'letter-spacing'),
|
|
113
130
|
'max-inline-size': roleClasses('max-inline', 'measure'),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { controlBorderClass } from './controlStyles.js'
|
|
2
|
+
|
|
3
|
+
export const comboboxInputClass = [
|
|
4
|
+
controlBorderClass,
|
|
5
|
+
'box-border w-full min-w-0 text-start pe-12',
|
|
6
|
+
'h-[var(--rad-combobox-height,var(--_rad-control-height))] px-[var(--rad-combobox-padding,var(--_rad-control-padding))]',
|
|
7
|
+
'font-[family-name:var(--rad-combobox-font-family,var(--rad-typography-roles-ui-body-family,system-ui,sans-serif))] text-[length:var(--rad-combobox-font-size,var(--_rad-control-font-size))] font-[number:var(--rad-combobox-font-weight,var(--rad-typography-roles-ui-body-weight,400))] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)]',
|
|
8
|
+
'[color:var(--rad-combobox-color,var(--rad-color-foreground,oklch(0.21_0.006_286)))] bg-[var(--rad-combobox-background,var(--rad-color-surface,white))]',
|
|
9
|
+
'[border-width:var(--rad-combobox-border-width,var(--rad-control-border-width,1px))] [border-style:var(--rad-combobox-border-style,var(--rad-control-border-style,solid))] [border-color:var(--rad-combobox-border-color,var(--_rad-control-border))]',
|
|
10
|
+
'rounded-[var(--rad-combobox-radius,var(--rad-control-radius,0.5rem))] [corner-shape:var(--rad-combobox-corner-shape,var(--rad-control-corner-shape,round))] [box-shadow:var(--rad-combobox-shadow,none)]',
|
|
11
|
+
'focus-visible:outline-solid focus-visible:[outline-color:var(--rad-combobox-focus-color,var(--rad-color-focus))] focus-visible:[outline-width:var(--rad-focus-width,2px)] focus-visible:[outline-offset:var(--rad-focus-offset,2px)]',
|
|
12
|
+
'data-invalid:[border-color:var(--rad-color-invalid)] placeholder:[color:var(--rad-combobox-placeholder,var(--rad-color-placeholder))] disabled:cursor-not-allowed disabled:bg-[var(--rad-color-disabled-background)]',
|
|
13
|
+
'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText] forced-colors:disabled:text-[GrayText]'
|
|
14
|
+
].join(' ')
|
|
15
|
+
|
|
16
|
+
export const comboboxContentClass = [
|
|
17
|
+
'fixed right-auto bottom-auto m-0 box-border min-w-0 overflow-hidden overscroll-contain',
|
|
18
|
+
'left-[var(--_rad-combobox-left,0px)] top-[var(--_rad-combobox-top,0px)] w-[var(--_rad-combobox-width,auto)] max-h-[var(--_rad-combobox-max-height,calc(100dvh-1rem))]',
|
|
19
|
+
'p-[var(--rad-combobox-content-padding,0.25rem)] rounded-[var(--rad-combobox-content-radius,var(--rad-surface-radius,0.75rem))]',
|
|
20
|
+
'[border-width:var(--rad-combobox-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-combobox-border-style,var(--rad-surface-border-style,solid))] [border-color:var(--rad-combobox-border-color,var(--rad-color-border))]',
|
|
21
|
+
'bg-[var(--rad-combobox-content-background,var(--rad-color-surface,white))] [color:var(--rad-combobox-color,var(--rad-color-foreground))] [box-shadow:var(--rad-combobox-content-shadow,var(--rad-surface-overlay-shadow,0_8px_32px_#0003))]',
|
|
22
|
+
'[backdrop-filter:var(--rad-combobox-content-backdrop-filter,none)]',
|
|
23
|
+
'font-[family-name:var(--rad-combobox-font-family,var(--rad-typography-roles-ui-body-family,system-ui,sans-serif))] text-[length:var(--rad-combobox-font-size,var(--_rad-control-font-size))] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)] font-[number:var(--rad-combobox-font-weight,var(--rad-typography-roles-ui-body-weight,400))]',
|
|
24
|
+
'outline-none forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]'
|
|
25
|
+
].join(' ')
|
|
26
|
+
|
|
27
|
+
export const comboboxItemClass = [
|
|
28
|
+
'relative flex min-w-0 cursor-default select-none items-center gap-2 break-words rounded-[var(--rad-combobox-item-radius,var(--rad-control-radius,0.5rem))]',
|
|
29
|
+
'min-h-[var(--_rad-control-height,2.5rem)] px-[var(--_rad-control-padding,1rem)] py-2 outline-none',
|
|
30
|
+
'data-highlighted:[background:var(--rad-combobox-item-background,var(--rad-color-accent))] data-highlighted:[color:var(--rad-combobox-item-color,var(--rad-color-accent-foreground))]',
|
|
31
|
+
'data-disabled:opacity-[var(--rad-state-disabled-opacity,0.5)] data-disabled:cursor-not-allowed',
|
|
32
|
+
'forced-colors:data-highlighted:bg-[Highlight] forced-colors:data-highlighted:text-[HighlightText] forced-colors:data-disabled:text-[GrayText] forced-colors:data-disabled:opacity-100'
|
|
33
|
+
].join(' ')
|
|
34
|
+
|
|
35
|
+
/** An input adornment keeps Button semantics without inheriting action presentation. */
|
|
36
|
+
export const comboboxActionClass = [
|
|
37
|
+
'inline-flex shrink-0 items-center justify-center border-0 bg-transparent p-0 [font:inherit]',
|
|
38
|
+
'[color:var(--rad-combobox-color,var(--rad-color-foreground))] shadow-none cursor-pointer',
|
|
39
|
+
'focus-visible:outline-solid focus-visible:[outline-color:var(--rad-combobox-focus-color,var(--rad-color-focus))] focus-visible:[outline-width:var(--rad-focus-width,2px)] focus-visible:[outline-offset:var(--rad-focus-offset,2px)]',
|
|
40
|
+
'disabled:cursor-not-allowed forced-colors:text-[CanvasText] forced-colors:disabled:text-[GrayText]'
|
|
41
|
+
].join(' ')
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Combobox,
|
|
3
|
+
ComboboxInput,
|
|
4
|
+
ComboboxTrigger,
|
|
5
|
+
ComboboxClear,
|
|
6
|
+
ComboboxPortal,
|
|
7
|
+
ComboboxContent,
|
|
8
|
+
ComboboxItem,
|
|
9
|
+
ComboboxStatus,
|
|
10
|
+
useCombobox
|
|
11
|
+
} from './Combobox.js'
|
|
12
|
+
export type {
|
|
13
|
+
ComboboxProps,
|
|
14
|
+
ComboboxOption,
|
|
15
|
+
ComboboxState,
|
|
16
|
+
ComboboxInputProps,
|
|
17
|
+
ComboboxTriggerProps,
|
|
18
|
+
ComboboxClearProps,
|
|
19
|
+
ComboboxContentProps,
|
|
20
|
+
ComboboxItemProps,
|
|
21
|
+
ComboboxStatusProps
|
|
22
|
+
} from './Combobox.js'
|
|
1
23
|
export { Button } from './Button.js'
|
|
2
24
|
export { Link } from './Link.js'
|
|
3
25
|
export type { LinkProps, LinkRenderProps, LinkVariant } from './Link.js'
|
package/src/motion/popup.ts
CHANGED
|
@@ -12,11 +12,11 @@ export function bindPopupMotion(node: HTMLElement, initial: MotionProfile): Moti
|
|
|
12
12
|
...resolveMotion(profile, 'dialog', query.matches),
|
|
13
13
|
reducedValue: 0
|
|
14
14
|
})
|
|
15
|
-
const previous = node.style.getPropertyValue('--_rad-
|
|
15
|
+
const previous = node.style.getPropertyValue('--_rad-popup-enter')
|
|
16
16
|
let owned = previous
|
|
17
17
|
const render = (value: number) => {
|
|
18
18
|
owned = String(Math.max(0, Math.min(1, value)))
|
|
19
|
-
node.style.setProperty('--_rad-
|
|
19
|
+
node.style.setProperty('--_rad-popup-enter', owned)
|
|
20
20
|
}
|
|
21
21
|
const off = spring.subscribe(render)
|
|
22
22
|
render(spring.get())
|
|
@@ -46,9 +46,9 @@ export function bindPopupMotion(node: HTMLElement, initial: MotionProfile): Moti
|
|
|
46
46
|
query.removeEventListener('change', sync)
|
|
47
47
|
off()
|
|
48
48
|
spring.destroy()
|
|
49
|
-
if (node.style.getPropertyValue('--_rad-
|
|
50
|
-
if (previous) node.style.setProperty('--_rad-
|
|
51
|
-
else node.style.removeProperty('--_rad-
|
|
49
|
+
if (node.style.getPropertyValue('--_rad-popup-enter') === owned) {
|
|
50
|
+
if (previous) node.style.setProperty('--_rad-popup-enter', previous)
|
|
51
|
+
else node.style.removeProperty('--_rad-popup-enter')
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef, type RefObject } from 'react'
|
|
4
|
+
import { positionSelect } from '../internal/select.js'
|
|
5
|
+
|
|
6
|
+
/** Local top-layer popup: preserve theme/modal ancestry and place before its first paint. */
|
|
7
|
+
export function useComboboxPopup(
|
|
8
|
+
nodeRef: RefObject<HTMLDivElement | null>,
|
|
9
|
+
input: HTMLInputElement | null,
|
|
10
|
+
open: boolean,
|
|
11
|
+
dismiss: () => void,
|
|
12
|
+
sideOffset: number,
|
|
13
|
+
collisionPadding: number
|
|
14
|
+
) {
|
|
15
|
+
const latest = useRef(dismiss)
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
latest.current = dismiss
|
|
18
|
+
})
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
const node = nodeRef.current
|
|
21
|
+
if (!node || !input) return
|
|
22
|
+
if (!open) {
|
|
23
|
+
if (node.matches(':popover-open')) node.hidePopover()
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
const doc = input.ownerDocument
|
|
27
|
+
const win = doc.defaultView!
|
|
28
|
+
const seedWidth = () => {
|
|
29
|
+
const available =
|
|
30
|
+
(win.visualViewport?.width ?? win.innerWidth) - 2 * Math.max(0, collisionPadding)
|
|
31
|
+
node.style.setProperty(
|
|
32
|
+
'--_rad-combobox-width',
|
|
33
|
+
`${Math.min(input.getBoundingClientRect().width, Math.max(0, available))}px`
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
seedWidth()
|
|
37
|
+
node.showPopover()
|
|
38
|
+
const place = () => {
|
|
39
|
+
if (!node.isConnected || !node.matches(':popover-open')) return
|
|
40
|
+
seedWidth()
|
|
41
|
+
const viewport = win.visualViewport
|
|
42
|
+
const css = win.getComputedStyle(node)
|
|
43
|
+
const anchor = input.getBoundingClientRect()
|
|
44
|
+
const padding = Math.max(0, collisionPadding)
|
|
45
|
+
const list = node.querySelector<HTMLElement>('[data-slot="combobox-listbox"]')
|
|
46
|
+
const status = node.querySelector<HTMLElement>('[data-slot="combobox-status"]')
|
|
47
|
+
const naturalHeight =
|
|
48
|
+
(list?.scrollHeight ?? node.scrollHeight) +
|
|
49
|
+
(status?.offsetHeight ?? 0) +
|
|
50
|
+
parseFloat(css.paddingTop) +
|
|
51
|
+
parseFloat(css.paddingBottom) +
|
|
52
|
+
parseFloat(css.borderTopWidth) +
|
|
53
|
+
parseFloat(css.borderBottomWidth)
|
|
54
|
+
const above = anchor.top - (viewport?.offsetTop ?? 0) - padding - sideOffset
|
|
55
|
+
const below =
|
|
56
|
+
(viewport?.offsetTop ?? 0) +
|
|
57
|
+
(viewport?.height ?? win.innerHeight) -
|
|
58
|
+
anchor.bottom -
|
|
59
|
+
padding -
|
|
60
|
+
sideOffset
|
|
61
|
+
const next = positionSelect({
|
|
62
|
+
trigger: anchor,
|
|
63
|
+
width: node.getBoundingClientRect().width,
|
|
64
|
+
height: Math.min(naturalHeight, Math.max(0, above, below)),
|
|
65
|
+
selectedOffset: 0,
|
|
66
|
+
viewport: {
|
|
67
|
+
top: viewport?.offsetTop ?? 0,
|
|
68
|
+
left: viewport?.offsetLeft ?? 0,
|
|
69
|
+
width: viewport?.width ?? win.innerWidth,
|
|
70
|
+
height: viewport?.height ?? win.innerHeight
|
|
71
|
+
},
|
|
72
|
+
padding: Math.max(0, collisionPadding),
|
|
73
|
+
offset: sideOffset,
|
|
74
|
+
aligned: false,
|
|
75
|
+
rtl: win.getComputedStyle(input).direction === 'rtl'
|
|
76
|
+
})
|
|
77
|
+
for (const [key, value] of Object.entries({
|
|
78
|
+
top: next.top,
|
|
79
|
+
left: next.left,
|
|
80
|
+
width: next.width,
|
|
81
|
+
'max-height': next.maxHeight
|
|
82
|
+
})) {
|
|
83
|
+
const property = `--_rad-combobox-${key}`
|
|
84
|
+
if (node.style.getPropertyValue(property) !== `${value}px`)
|
|
85
|
+
node.style.setProperty(property, `${value}px`)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
place()
|
|
89
|
+
let frame = 0
|
|
90
|
+
const schedule = () => {
|
|
91
|
+
if (!frame)
|
|
92
|
+
frame = win.requestAnimationFrame(() => {
|
|
93
|
+
frame = 0
|
|
94
|
+
place()
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
const outside = (event: PointerEvent | FocusEvent) => {
|
|
98
|
+
const target = event.target
|
|
99
|
+
if (
|
|
100
|
+
target instanceof win.Node &&
|
|
101
|
+
!node.contains(target) &&
|
|
102
|
+
!input.parentElement?.contains(target)
|
|
103
|
+
)
|
|
104
|
+
latest.current()
|
|
105
|
+
}
|
|
106
|
+
const observer = new win.ResizeObserver(schedule)
|
|
107
|
+
const mutations = new win.MutationObserver(schedule)
|
|
108
|
+
observer.observe(input)
|
|
109
|
+
observer.observe(node)
|
|
110
|
+
mutations.observe(node, { childList: true, subtree: true, characterData: true })
|
|
111
|
+
doc.addEventListener('pointerdown', outside, true)
|
|
112
|
+
doc.addEventListener('focusin', outside)
|
|
113
|
+
doc.addEventListener('scroll', schedule, true)
|
|
114
|
+
win.addEventListener('resize', schedule)
|
|
115
|
+
win.visualViewport?.addEventListener('resize', schedule)
|
|
116
|
+
win.visualViewport?.addEventListener('scroll', schedule)
|
|
117
|
+
return () => {
|
|
118
|
+
observer.disconnect()
|
|
119
|
+
mutations.disconnect()
|
|
120
|
+
win.cancelAnimationFrame(frame)
|
|
121
|
+
doc.removeEventListener('pointerdown', outside, true)
|
|
122
|
+
doc.removeEventListener('focusin', outside)
|
|
123
|
+
doc.removeEventListener('scroll', schedule, true)
|
|
124
|
+
win.removeEventListener('resize', schedule)
|
|
125
|
+
win.visualViewport?.removeEventListener('resize', schedule)
|
|
126
|
+
win.visualViewport?.removeEventListener('scroll', schedule)
|
|
127
|
+
if (node.matches(':popover-open')) node.hidePopover()
|
|
128
|
+
}
|
|
129
|
+
}, [nodeRef, input, open, sideOffset, collisionPadding])
|
|
130
|
+
}
|
package/src/themes/components.ts
CHANGED
|
@@ -169,6 +169,31 @@ export const componentRegistry = {
|
|
|
169
169
|
contentColor: 'css',
|
|
170
170
|
contentBackground: 'css'
|
|
171
171
|
},
|
|
172
|
+
combobox: {
|
|
173
|
+
placeholder: 'css',
|
|
174
|
+
height: 'css',
|
|
175
|
+
padding: 'css',
|
|
176
|
+
fontFamily: 'css',
|
|
177
|
+
fontSize: 'css',
|
|
178
|
+
fontWeight: 'weight',
|
|
179
|
+
color: 'css',
|
|
180
|
+
background: 'css',
|
|
181
|
+
borderWidth: 'css',
|
|
182
|
+
borderStyle: 'css',
|
|
183
|
+
borderColor: 'css',
|
|
184
|
+
radius: 'css',
|
|
185
|
+
cornerShape: 'css',
|
|
186
|
+
shadow: 'css',
|
|
187
|
+
focusColor: 'css',
|
|
188
|
+
contentPadding: 'css',
|
|
189
|
+
contentRadius: 'css',
|
|
190
|
+
contentBackground: 'css',
|
|
191
|
+
contentBackdropFilter: 'css',
|
|
192
|
+
contentShadow: 'css',
|
|
193
|
+
itemRadius: 'css',
|
|
194
|
+
itemBackground: 'css',
|
|
195
|
+
itemColor: 'css'
|
|
196
|
+
},
|
|
172
197
|
select: {
|
|
173
198
|
height: 'css',
|
|
174
199
|
padding: 'css',
|