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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zag-ripple",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "RippleJS Adapter for Zag JS",
5
5
  "keywords": [
6
6
  "js",
@@ -39,7 +39,7 @@ export function useMachine(
39
39
  machine,
40
40
  _userProps,
41
41
  ) {
42
- let [id, ids, getRootNode,rest ]= trackSplit(access(_userProps), ['id', 'ids', 'getRootNode'])
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
- machine.props?.({ props: compact(access(@rest)), scope: @scope }) ?? access(@rest)
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(() => ({...@props, id: @id, ids: @ids, getRootNode: @getRootNode }))
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
- // TODO
13
- // onFocus: "onFocusIn",
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, ...rest }:any) {
4
- if(!disabled) {
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 {...rest} {target} />
12
+ <RipplePortal {target}>
13
+ <children />
14
+ </RipplePortal>
8
15
  }
9
16
  }