@targoninc/jess-components 0.0.27 → 0.0.29

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -913,16 +913,12 @@ 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) => opt.selected = opt.value === value);
919
- }
920
- value$.subscribe(setSelected);
921
- setSelected(value$.value);
922
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) => {
923
917
  value$.value = e.target.value;
924
918
  config.onchange && config.onchange(e.target.value);
925
- }), (option) => create("option").value(option.id).text(option.name).build())).build();
919
+ }), (option) => {
920
+ return create("option").value(option.id).text(option.name).selected(compute((v) => v === option.id, value$)).build();
921
+ })).build();
926
922
  }
927
923
  function searchableSelect(config) {
928
924
  const options = config.options ?? signal([]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@targoninc/jess-components",
3
3
  "type": "module",
4
- "version": "0.0.27",
4
+ "version": "0.0.29",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [