File tree Expand file tree Collapse file tree 20 files changed +233
-48
lines changed Expand file tree Collapse file tree 20 files changed +233
-48
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const object: Widgets['object'] = (options) => {
15
15
${ options . label ? html `< legend > ${ options . label } </ legend > ` : nothing }
16
16
<!-- -->
17
17
${ options . helpText
18
- ? html `< p class ="object__description "> ${ options . helpText } </ p > `
18
+ ? html `< p class ="widget- object__description "> ${ options . helpText } </ p > `
19
19
: nothing }
20
20
<!-- -->
21
21
${ options . children }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type { MdOutlinedTextField } from '@material/web/textfield/outlined-text-
8
8
9
9
export const text : Widgets [ 'text' ] = ( options ) => html `
10
10
< md-outlined-text-field
11
- .type =${ 'text' }
11
+ .type =${ options . inputType }
12
12
.supportingText =${ options . helpText }
13
13
.id=${ options . id }
14
14
.label=${ options . label }
Original file line number Diff line number Diff line change 31
31
font-size : var (--sl-font-size-2x-large );
32
32
font-weight : 200 ;
33
33
}
34
+
35
+ sl-card ::part (body ) {
36
+ // background-color: slcolo;
37
+ }
38
+ // --sl-panel-background-color: var(--sl-color-neutral-50);
34
39
}
35
40
36
41
& .level-1 {
37
42
legend {
38
43
font-size : var (--sl-font-size-x-large );
39
44
font-weight : var (--sl-font-weight-light );
40
45
}
46
+
47
+ sl-card ::part (header ) {
48
+ // background-color: var(--sl-color-neutral-50);
49
+ }
50
+ // --sl-panel-background-color: var(--sl-color-neutral-50);
41
51
}
42
52
43
53
& .level-2 {
44
54
legend {
45
55
font-size : var (--sl-font-size-large );
46
56
font-weight : var (--sl-font-weight-light );
47
57
}
58
+
59
+ sl-card ::part (header ) {
60
+ // background-color: var(--sl-color-neutral-100);
61
+ }
62
+
63
+ // --sl-panel-background-color: var(--sl-color-neutral-100);
48
64
}
49
65
50
66
& .level-3 {
51
67
legend {
52
68
font-size : var (--sl-font-size-medium );
53
69
font-weight : var (--sl-font-weight-bold );
54
70
}
71
+
72
+ sl-card ::part (header ) {
73
+ // background-color: var(--sl-color-neutral-200);
74
+ }
75
+ // --sl-panel-background-color: var(--sl-color-neutral-200);
55
76
}
56
77
}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export const array: Widgets['array'] = (options) => {
50
50
< nav >
51
51
< sl-tooltip content ="Delete ">
52
52
< sl-button size ="small " @click =${ controls . delete . click } >
53
- < sl-icon name ="trash3 " label ="Settings "> </ sl-icon >
53
+ < sl-icon name ="x-lg " label ="Settings "> </ sl-icon >
54
54
</ sl-button >
55
55
</ sl-tooltip >
56
56
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export const checkbox: Widgets['checkbox'] = (options) => html`
10
10
< div class ="theme-shoelace widget-checkbox ">
11
11
< sl-checkbox
12
12
type ="text "
13
- value = ${ ifDefined ( options . value ) }
13
+ .checked =" ${ options . value } "
14
14
.name =${ options . id }
15
15
.id =${ options . id }
16
16
.required=${ options . required ?? true }
Original file line number Diff line number Diff line change @@ -3,35 +3,25 @@ import { ifDefined } from 'lit/directives/if-defined.js';
3
3
4
4
import type { Widgets } from '@jsfe/types' ;
5
5
6
- import '@shoelace-style/shoelace/dist/components/input/input.js' ;
6
+ import '@shoelace-style/shoelace/dist/components/select/select.js' ;
7
+ import '@shoelace-style/shoelace/dist/components/option/option.js' ;
7
8
import type { SlSelect } from '@shoelace-style/shoelace' ;
8
9
10
+ // .label=${options.label}
11
+ // .helpText=${options.helpText}
9
12
export const select : Widgets [ 'select' ] = ( options ) => html `
10
13
< sl-select
11
14
value =${ ifDefined ( options . value ) }
12
- .label =${ options . label }
13
- .helpText=${ options . helpText }
14
15
.required =${ options . required }
15
16
@sl-change=${ ( event : Event ) => {
16
17
let newValue : string | null | number | string [ ] = (
17
18
event . target as SlSelect
18
19
) . value ;
19
20
if ( Array . isArray ( newValue ) ) return ;
20
-
21
21
if ( options . type === 'number' || options . type === 'integer' ) {
22
22
newValue = Number ( newValue ) ;
23
23
}
24
- // if (options.type?.includes('null') && !newValue) {
25
- // newValue = null;
26
- // }
27
-
28
24
options . valueChangedCallback ?.( newValue ) ;
29
-
30
- // handleChange(path, newValue, [
31
- // ...schemaPath,
32
- // 'enum',
33
- // schema.enum?.indexOf(newValue),
34
- // ]);
35
25
} }
36
26
> ${ options . enum ?. map (
37
27
( enumValue ) =>
Original file line number Diff line number Diff line change 1
1
// keep-sorted start
2
- @import ' ./widgets/callout.scss' ;
2
+ // @import './widgets/callout.scss';
3
+ // @import './widgets/_all.scss';
4
+ @import ' ./widgets/object.scss' ;
3
5
@import ' ./widgets/submit.scss' ;
4
6
// keep-sorted end
Original file line number Diff line number Diff line change
1
+ import { html } from 'lit' ;
2
+ // import { ifDefined } from 'lit/directives/if-defined.js';
3
+
4
+ import { field } from './_field.js' ;
5
+
6
+ import type { Widgets } from '@jsfe/types' ;
7
+
8
+ export const date : Widgets [ 'date' ] = ( options ) => html `
9
+ ${ field (
10
+ options ,
11
+ html `< input
12
+ type =${ options . type }
13
+ value =${ options . value ? String ( options . value ) : '' }
14
+ .name=${ options . id }
15
+ .id=${ options . id }
16
+ .required=${ options . required ?? false }
17
+ @input=${ ( event : InputEvent ) => {
18
+ const { valueAsDate : newValue } = event . target as HTMLInputElement ;
19
+ options . valueChangedCallback ?.( newValue ?? undefined ) ;
20
+ } }
21
+ /> ` ,
22
+ ) }
23
+ ` ;
Original file line number Diff line number Diff line change 4
4
export { callout , flag } from './callout.js' ;
5
5
export { checkbox } from './checkbox.js' ;
6
6
export { colorPicker } from './color-picker.js' ;
7
- export { enumeration } from './enumeration.js' ;
7
+
8
8
export { number } from './number.js' ;
9
9
export { object } from './object.js' ;
10
10
export { range } from './range.js' ;
11
+ export { select } from './select.js' ;
12
+ export { selectMultiple } from './select-multiple.js' ;
13
+ export { date } from './date.js' ;
14
+ export { radioGroup } from './radio-group.js' ;
15
+ export { radioGroupBoolean } from './radio-group-boolean.js' ;
11
16
export { submit } from './submit.js' ;
12
17
export { text } from './text.js' ;
13
18
export { textarea } from './textarea.js' ;
Original file line number Diff line number Diff line change 1
- .theme-material.widget-object {
2
- position : relative ;
3
- display : flex ;
4
- flex-direction : column ;
5
- gap : 1em 0 ;
6
- padding : 2em 1em ;
7
- margin : 0 ;
8
- font-weight : 300 ;
9
- border : none ;
10
- border-bottom : 1px solid var (--md-sys-color-inverse-on-surface );
11
- border-radius : 1rem ;
12
- transition-timing-function : ease-in-out ;
13
- transition-duration : 250ms ;
14
-
15
- legend {
1
+ .theme-system.widget-object {
2
+ select ,
3
+ input :not ([type = ' radio' ], [type = ' checkbox' ]),
4
+ textarea {
16
5
width : 100% ;
17
- font-size : 1.5em ;
18
- border-bottom : 1px solid var (--md-sys-color-inverse-on-surface );
19
- }
20
-
21
- .widget-object__description {
22
- margin : 0 0 1rem 0 ;
23
- opacity : calc (3 / 4 );
24
6
}
25
7
}
You can’t perform that action at this time.
0 commit comments