@targoninc/jess-components 0.0.28 → 0.0.30
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/dist/index.js +0 -8
- package/dist/src/Components.d.ts +3 -3
- package/dist/src/Types.d.ts +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -913,14 +913,6 @@ function select(config) {
|
|
|
913
913
|
const options = config.options ?? signal([]);
|
|
914
914
|
const value$ = config.value ?? signal(null);
|
|
915
915
|
const selectId = v4_default();
|
|
916
|
-
function setSelected(value) {
|
|
917
|
-
const opts = document.querySelectorAll(`select[id="${selectId}"] option`);
|
|
918
|
-
opts.forEach((opt) => {
|
|
919
|
-
opt.selected = opt.value === value;
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
value$.subscribe(setSelected);
|
|
923
|
-
setSelected(value$.value);
|
|
924
916
|
return create("div").applyGenericConfig(config).classes("jessc-select", "flex-v", "relative").children(when(config.label, create("label").classes("jess").text(config.label).build()), signalMap(options, create("select").classes("jessc-select-inner").id(selectId).onchange((e) => {
|
|
925
917
|
value$.value = e.target.value;
|
|
926
918
|
config.onchange && config.onchange(e.target.value);
|
package/dist/src/Components.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare function container(config: ContainerConfig): AnyElement;
|
|
|
11
11
|
export declare function text(config: TextConfig): AnyElement;
|
|
12
12
|
export declare function heading(config: HeadingConfig): AnyElement;
|
|
13
13
|
export declare function icon(config: IconConfig): Signal<AnyElement>;
|
|
14
|
-
export declare function select(config: SelectConfig): AnyElement;
|
|
15
|
-
export declare function searchableSelect(config: SearchableSelectConfig): AnyElement;
|
|
16
|
-
export declare function searchSelectOption(config: SelectOptionConfig): any;
|
|
14
|
+
export declare function select<T = any>(config: SelectConfig<T>): AnyElement;
|
|
15
|
+
export declare function searchableSelect<T = any>(config: SearchableSelectConfig<T>): AnyElement;
|
|
16
|
+
export declare function searchSelectOption<T = any>(config: SelectOptionConfig<T>): any;
|
|
17
17
|
export declare function checkbox(config: BooleanConfig): AnyElement;
|
|
18
18
|
export declare function toggle(config: BooleanConfig): AnyElement;
|
package/dist/src/Types.d.ts
CHANGED
|
@@ -57,24 +57,24 @@ export interface IconConfig extends BaseComponentConfig {
|
|
|
57
57
|
isUrl?: TypeOrSignal<boolean>;
|
|
58
58
|
onclick?: Function;
|
|
59
59
|
}
|
|
60
|
-
export interface SelectOption extends BaseComponentConfig {
|
|
60
|
+
export interface SelectOption<T> extends BaseComponentConfig {
|
|
61
61
|
image?: string;
|
|
62
62
|
imageIsUrl?: boolean;
|
|
63
63
|
name: any;
|
|
64
|
-
id: any;
|
|
64
|
+
id: any | T;
|
|
65
65
|
}
|
|
66
|
-
export interface SelectOptionConfig extends BaseComponentConfig {
|
|
67
|
-
option: SelectOption
|
|
66
|
+
export interface SelectOptionConfig<T> extends BaseComponentConfig {
|
|
67
|
+
option: SelectOption<T>;
|
|
68
68
|
value: Signal<any>;
|
|
69
69
|
search: Signal<string>;
|
|
70
70
|
optionsVisible: Signal<boolean>;
|
|
71
71
|
selectedId: Signal<any>;
|
|
72
72
|
}
|
|
73
73
|
export interface SearchableSelectConfig<T = string> extends ChangeableConfig<T> {
|
|
74
|
-
options: Signal<SelectOption[]>;
|
|
74
|
+
options: Signal<SelectOption<T>[]>;
|
|
75
75
|
value: Signal<T>;
|
|
76
76
|
}
|
|
77
|
-
export type SelectConfig = SearchableSelectConfig
|
|
77
|
+
export type SelectConfig<T> = SearchableSelectConfig<T>;
|
|
78
78
|
export interface HeadingConfig extends BaseComponentConfig {
|
|
79
79
|
level?: IntRange<1, 6>;
|
|
80
80
|
text: StringOrSignal;
|