@ruby-native/react 0.6.0
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/index.js +59 -0
- package/package.json +21 -0
package/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createElement } from "react"
|
|
2
|
+
|
|
3
|
+
import("@inertiajs/react").then(m => { window.__inertiaRouter = m.router }).catch(() => {})
|
|
4
|
+
|
|
5
|
+
export function NativeTabs({ enabled = true }) {
|
|
6
|
+
if (!enabled) return null
|
|
7
|
+
return createElement("div", { "data-native-tabs": true, hidden: true })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function NativePush() {
|
|
11
|
+
return createElement("div", { "data-native-push": true, hidden: true })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function NativeForm() {
|
|
15
|
+
return createElement("div", { "data-native-form": true, hidden: true })
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function NativeNavbar({ title, children }) {
|
|
19
|
+
return createElement("div", { "data-native-navbar": title, hidden: true }, children)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function NativeButton({ position = "trailing", icon, title, href, click, selected, children }) {
|
|
23
|
+
const props = { "data-native-button": true }
|
|
24
|
+
if (icon) props["data-native-icon"] = icon
|
|
25
|
+
if (title) props["data-native-title"] = title
|
|
26
|
+
if (href) props["data-native-href"] = href
|
|
27
|
+
if (click) props["data-native-click"] = click
|
|
28
|
+
if (position) props["data-native-position"] = position
|
|
29
|
+
if (selected) props["data-native-selected"] = ""
|
|
30
|
+
return createElement("div", props, children)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function NativeMenuItem({ title, href, click, icon, selected }) {
|
|
34
|
+
const props = { "data-native-menu-item": true }
|
|
35
|
+
if (title) props["data-native-title"] = title
|
|
36
|
+
if (href) props["data-native-href"] = href
|
|
37
|
+
if (click) props["data-native-click"] = click
|
|
38
|
+
if (icon) props["data-native-icon"] = icon
|
|
39
|
+
if (selected) props["data-native-selected"] = ""
|
|
40
|
+
return createElement("div", props)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function NativeOverscroll({ top, bottom }) {
|
|
44
|
+
return createElement("div", {
|
|
45
|
+
"data-native-overscroll-top": top,
|
|
46
|
+
"data-native-overscroll-bottom": bottom || top,
|
|
47
|
+
hidden: true
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function NativeSubmitButton({ title = "Save", click = "[type='submit']" }) {
|
|
52
|
+
return createElement("div", {
|
|
53
|
+
"data-native-submit-button": true,
|
|
54
|
+
"data-native-title": title,
|
|
55
|
+
"data-native-click": click,
|
|
56
|
+
hidden: true
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ruby-native/react",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "React components for Ruby Native",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": ["index.js"],
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": ">=18",
|
|
9
|
+
"@inertiajs/react": ">=2"
|
|
10
|
+
},
|
|
11
|
+
"peerDependenciesMeta": {
|
|
12
|
+
"@inertiajs/react": { "optional": true }
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/ruby-native/gem.git",
|
|
17
|
+
"directory": "packages/react"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://rubynative.com",
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|