zag-ripple 0.0.6 → 0.0.8
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/package.json +1 -1
- package/src/machine.ripple +6 -5
- package/src/normalize-props.ripple +2 -10
- package/src/portal.ripple +10 -3
package/package.json
CHANGED
package/src/machine.ripple
CHANGED
|
@@ -39,7 +39,7 @@ export function useMachine(
|
|
|
39
39
|
machine,
|
|
40
40
|
_userProps,
|
|
41
41
|
) {
|
|
42
|
-
let [id, ids, getRootNode,rest
|
|
42
|
+
let [id, ids, getRootNode, rest]= trackSplit(access(_userProps), ['id', 'ids', 'getRootNode'])
|
|
43
43
|
let scope = track(() => {
|
|
44
44
|
return createScope({ id: @id, ids: @ids, getRootNode: @getRootNode })
|
|
45
45
|
})
|
|
@@ -47,11 +47,12 @@ export function useMachine(
|
|
|
47
47
|
if (machine.debug) console.log(...args)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
let props = track(() =>
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
let props = track(() => {
|
|
51
|
+
const p = { ...@rest, id: @id, ids: @ids, getRootNode: @getRootNode }
|
|
52
|
+
return machine.props?.({ props: compact(p), scope: @scope }) ?? p
|
|
53
|
+
})
|
|
53
54
|
|
|
54
|
-
const prop = useProp(() =>
|
|
55
|
+
const prop = useProp(() => @props)
|
|
55
56
|
|
|
56
57
|
const context = machine.context?.({
|
|
57
58
|
prop,
|
|
@@ -9,16 +9,8 @@ const propMap: Record<string, string> = {
|
|
|
9
9
|
defaultValue: "value",
|
|
10
10
|
htmlFor: "for",
|
|
11
11
|
onChange: "onInput",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// onBlur: "onFocusOut",
|
|
15
|
-
// TODO remove when ripple fix is merged
|
|
16
|
-
onFocus: "onFocusin",
|
|
17
|
-
onBlur: "onFocusout",
|
|
18
|
-
onKeyDown: "onKeydown",
|
|
19
|
-
onPointerDown: "onPointerdown",
|
|
20
|
-
onPointerMove: "onPointermove",
|
|
21
|
-
onPointerLeave: "onPointerleave",
|
|
12
|
+
onFocus: "onFocusIn",
|
|
13
|
+
onBlur: "onFocusOut",
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
export function toStyleString(style: Record<string, number | string>) {
|
package/src/portal.ripple
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Portal as RipplePortal } from 'ripple';
|
|
2
2
|
|
|
3
|
-
export component Portal({ disabled, getRootNode, container,
|
|
4
|
-
|
|
3
|
+
export component Portal({ disabled, getRootNode, container, children }:any) {
|
|
4
|
+
const isServer = typeof window === "undefined"
|
|
5
|
+
|
|
6
|
+
if(isServer || disabled){
|
|
7
|
+
<children />
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
5
10
|
const doc = getRootNode?.()?.ownerDocument ?? document
|
|
6
11
|
const target = container ?? doc.body
|
|
7
|
-
<RipplePortal {
|
|
12
|
+
<RipplePortal {target}>
|
|
13
|
+
<children />
|
|
14
|
+
</RipplePortal>
|
|
8
15
|
}
|
|
9
16
|
}
|