-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
490 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
import { FC } from 'react' | ||
import { Box } from '@fower/react' | ||
import { NodeProps } from 'fomir' | ||
import { SelectNode } from '../fomir-uikit-node' | ||
import { Select as BoneSelect } from 'uikit' | ||
import { | ||
Select as BoneSelect, | ||
SelectContent, | ||
SelectIcon, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from 'uikit' | ||
import { FormField } from '../FormField' | ||
|
||
export const Select: FC<NodeProps<SelectNode>> = (props) => { | ||
const { value, componentProps, options = [], display, wrapper } = props.node | ||
|
||
return ( | ||
<FormField node={props.node} hidden={!display}> | ||
<BoneSelect {...componentProps} value={value} onChange={props.handler.handleChange} /> | ||
<BoneSelect {...componentProps} value={value} onChange={props.handler.handleChange}> | ||
<SelectTrigger | ||
flex-1 | ||
textSM | ||
w-100p | ||
h-32 | ||
border | ||
borderNeutral200--T30 | ||
borderNeutral700--dark | ||
> | ||
<SelectValue flexShrink-0 placeholder=""></SelectValue> | ||
<SelectIcon></SelectIcon> | ||
</SelectTrigger> | ||
<SelectContent w-200 maxH-240 useTriggerWidth={true} overflowAuto> | ||
{options.map((item) => ( | ||
<SelectItem key={item.value + item.value.toString()} value={item.value} toBetween> | ||
<Box flex-1>{item.label}</Box> | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</BoneSelect> | ||
</FormField> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
*.log | ||
|
||
.penx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": false, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Mix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "mix", | ||
"title": "Mix Demo", | ||
"description": "This is a mix demo.", | ||
"icon": { | ||
"name": "mdi--react", | ||
"className": "bg-gradient-to-r from-violet-500 to-fuchsia-500" | ||
}, | ||
"commands": [ | ||
{ | ||
"name": "markdown", | ||
"title": "Markdown App", | ||
"icon": { | ||
"name": "lucide--pilcrow", | ||
"className": "bg-gradient-to-r from-rose-500 to-purple-500" | ||
}, | ||
"mode": "preset-ui" | ||
}, | ||
{ | ||
"name": "list", | ||
"title": "List App", | ||
"icon": { | ||
"name": "lucide--list", | ||
"className": "bg-gradient-to-r from-blue-500 to-green-500" | ||
}, | ||
"mode": "preset-ui" | ||
}, | ||
{ | ||
"name": "form", | ||
"title": "Form App", | ||
"icon": { | ||
"name": "lucide--pencil", | ||
"className": "bg-gradient-to-r from-yellow-500 to-red-500" | ||
}, | ||
"mode": "preset-ui" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "extension-mix", | ||
"private": true, | ||
"scripts": { | ||
"dev": "penx dev", | ||
"release": "penx release" | ||
}, | ||
"devDependencies": { | ||
"@penxio/preset-ui": "workspace:*", | ||
"@penxio/react": "workspace:*", | ||
"@penxio/api": "workspace:*", | ||
"penx-cli": "workspace:*", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { FormApp } from '@penxio/preset-ui' | ||
|
||
export function main() { | ||
const app = new FormApp({ | ||
fields: [ | ||
{ label: 'First Name', name: 'firstName', component: 'Input' }, | ||
{ label: 'Description', name: 'description', component: 'Textarea' }, | ||
{ label: 'Open', name: 'isOpen', component: 'Switch', value: true }, | ||
{ | ||
label: 'Color', | ||
name: 'color', | ||
component: 'Select', | ||
options: [ | ||
{ label: 'Red', value: 'red' }, | ||
{ label: 'Green', value: 'green' }, | ||
{ label: 'Blue', value: 'blur' }, | ||
], | ||
value: 'red', | ||
}, | ||
], | ||
actions: [ | ||
{ | ||
type: 'SubmitForm', | ||
onSubmit: async (values) => { | ||
console.log('======values:', values) | ||
}, | ||
}, | ||
], | ||
}).run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { IListItem, ListApp } from '@penxio/preset-ui' | ||
|
||
export async function main() { | ||
const app = new ListApp({ | ||
items: [], | ||
}).run() | ||
|
||
const items: IListItem[] = Array(10) | ||
.fill('') | ||
.map((_, index) => ({ | ||
icon: index + 1, | ||
title: 100 + index.toString(), | ||
actions: [{ type: 'CopyToClipboard', content: index.toString() }], | ||
})) | ||
|
||
setTimeout(() => { | ||
app.setState({ | ||
items, | ||
}) | ||
}, 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { MarkdownApp } from '@penxio/preset-ui' | ||
|
||
export async function main() { | ||
new MarkdownApp({ content: '# Hello world' }).run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { notification } from '@penxio/api' | ||
|
||
export async function main() { | ||
const granted = await notification.isPermissionGranted() | ||
console.log('=======granted:', granted) | ||
if (granted) { | ||
notification.sendNotification('Hello from Penx') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"module": "esnext", | ||
"strict": true, | ||
"lib": ["ESNext", "DOM"], | ||
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"skipLibCheck": true, | ||
"noUnusedLocals": true, | ||
"noImplicitAny": true, | ||
"jsx": "react-jsx", | ||
"allowJs": true, | ||
"noEmit": true, | ||
"outDir": "dist", | ||
"resolveJsonModule": true | ||
} | ||
} |
Oops, something went wrong.