zag-ripple 0.0.4 → 0.0.5
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 +7 -1
- package/src/index.d.ts +15 -0
- package/src/index.ripple +1 -0
- package/src/machine.ripple +0 -1
- package/src/normalize-props.ripple +8 -2
- package/src/portal.ripple +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zag-ripple",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "RippleJS Adapter for Zag JS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"main": "src/index.ripple",
|
|
19
19
|
"types": "src/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./src/index.ripple",
|
|
23
|
+
"types": "./src/index.d.ts"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
20
26
|
"repository": "https://github.com/anubra266/zag-ripple/tree/main/packages/zag-ripple",
|
|
21
27
|
"sideEffects": false,
|
|
22
28
|
"publishConfig": {
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Machine, Scope } from "@zag-js/core";
|
|
2
|
+
import { Component } from "ripple";
|
|
2
3
|
|
|
3
4
|
export { mergeProps } from "@zag-js/core";
|
|
4
5
|
|
|
@@ -46,3 +47,17 @@ export declare function useMachine<
|
|
|
46
47
|
machine: Machine<TContext>,
|
|
47
48
|
options?: MachineOptions | (() => MachineOptions)
|
|
48
49
|
): MachineApi<TContext, TState>;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export interface PortalProps {
|
|
55
|
+
disabled?: boolean | undefined
|
|
56
|
+
container?: HTMLElement | undefined
|
|
57
|
+
getRootNode?: (() => ShadowRoot | Document | Node) | undefined
|
|
58
|
+
children: Component
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export declare const Portal: Component<PortalProps>;
|
|
62
|
+
// export declare function Portal(props: PortalProps): Component;
|
|
63
|
+
|
package/src/index.ripple
CHANGED
package/src/machine.ripple
CHANGED
|
@@ -8,9 +8,15 @@ const propMap: Record<string, string> = {
|
|
|
8
8
|
defaultChecked: "checked",
|
|
9
9
|
defaultValue: "value",
|
|
10
10
|
htmlFor: "for",
|
|
11
|
-
onBlur: "onFocusOut",
|
|
12
11
|
onChange: "onInput",
|
|
13
|
-
|
|
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",
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
export function toStyleString(style: Record<string, number | string>) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Portal as RipplePortal } from 'ripple';
|
|
2
|
+
|
|
3
|
+
export component Portal({ disabled, getRootNode, container, ...rest }:any) {
|
|
4
|
+
if(!disabled) {
|
|
5
|
+
const doc = getRootNode?.()?.ownerDocument ?? document
|
|
6
|
+
const target = container ?? doc.body
|
|
7
|
+
<RipplePortal {...rest} {target} />
|
|
8
|
+
}
|
|
9
|
+
}
|