@wrnrlr/prelude 0.2.18 → 0.2.19
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/.github/workflows/ci.yml +1 -1
- package/deno.jsonc +1 -1
- package/example/style.css +1 -3
- package/example/widget.html +24 -3
- package/package.json +1 -1
- package/src/form.js +1 -1
- package/example/vite.config.js +0 -17
package/.github/workflows/ci.yml
CHANGED
package/deno.jsonc
CHANGED
package/example/style.css
CHANGED
package/example/widget.html
CHANGED
@@ -95,12 +95,12 @@ import { h, signal, memo, render, Select } from "../src/mod.ts"
|
|
95
95
|
function SelectCar() {
|
96
96
|
const cars = { 'Audi': ['A1','A6'], 'BMW': ['B5', 'BX'] }
|
97
97
|
const companies = Object.keys(cars)
|
98
|
-
const company = signal()
|
98
|
+
const company = signal('Audi')
|
99
99
|
const model = signal('')
|
100
100
|
const models = memo(() => cars[company()] || null)
|
101
101
|
return [
|
102
|
-
'', h(Select, {options:companies, value:()=>company}),
|
103
|
-
'', h(Select, {options:models, value:()=>model})
|
102
|
+
h('label', ['Brand', h(Select, {options:companies, value:()=>company})]),
|
103
|
+
h('label', ['Model', h(Select, {options:models, value:()=>model})])
|
104
104
|
]
|
105
105
|
}
|
106
106
|
|
@@ -109,4 +109,25 @@ render(SelectCar, document.getElementById('select_car'))
|
|
109
109
|
|
110
110
|
<style>
|
111
111
|
|
112
|
+
label {
|
113
|
+
display: inline flex;
|
114
|
+
flex-direction: row;
|
115
|
+
}
|
116
|
+
|
117
|
+
.select {
|
118
|
+
display: block;
|
119
|
+
position: relative;
|
120
|
+
& > button {
|
121
|
+
background-color: var(--neutral-200);
|
122
|
+
}
|
123
|
+
& > .options {
|
124
|
+
cursor: pointer;
|
125
|
+
position: absolute;
|
126
|
+
border: 1px solid black;
|
127
|
+
z-index: 10;
|
128
|
+
white-space: nowrap;
|
129
|
+
> * {}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
112
133
|
</style>
|
package/package.json
CHANGED
package/src/form.js
CHANGED
@@ -57,7 +57,7 @@ export function Select(props) {
|
|
57
57
|
h('button', {onClick:e=>show(s=>!s)}, h(Show, {when:()=>props.value, fallback}, ()=>props.value() || nbsp)),
|
58
58
|
h(Show, {when: show}, h('.options', {style:'position:absolute'}, h(List, {each:()=>selected().options},
|
59
59
|
(option) => h('.option', {
|
60
|
-
onClick: (
|
60
|
+
onClick: (e) => { e.preventDefault(); props.value(option()); show(false) },
|
61
61
|
style: 'cursor: pointer'
|
62
62
|
}, option)
|
63
63
|
)))
|
package/example/vite.config.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { defineConfig } from 'vite'
|
2
|
-
import path from 'node:path'
|
3
|
-
|
4
|
-
export default defineConfig({
|
5
|
-
root: path.resolve(__dirname),
|
6
|
-
plugins: [],
|
7
|
-
resolve: {
|
8
|
-
alias: {
|
9
|
-
'@src': path.resolve(__dirname, '../src')
|
10
|
-
},
|
11
|
-
},
|
12
|
-
server: {
|
13
|
-
fs: {
|
14
|
-
allow: ['..'] // Allow Vite to access parent directories
|
15
|
-
}
|
16
|
-
}
|
17
|
-
})
|