Skip to content

Commit

Permalink
couple more bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobMayer committed Sep 7, 2023
1 parent e7b256b commit 021e41b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jsx-in-ttpg",
"license": "UNLICENSE",
"version": "1.3.6",
"version": "1.3.7",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --no-splitting",
"clean": "rm -rf ./dist",
Expand Down
14 changes: 4 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ const checkboxElement = (attrs: JSX.IntrinsicElements["checkbox"], children?: st
if (attrs.onChangeActual) {
element.onCheckStateChanged.add(attrs.onChangeActual);
}
if (children) {
if (children && children.length > 0) {
element.setText(children?.join(""));
}
element.setIsChecked(!!attrs.checked);
Expand Down Expand Up @@ -669,9 +669,7 @@ const selectElement = (attrs: JSX.IntrinsicElements["select"]) => {
const element = new SelectionBox();
doTextlike(element, attrs);
element.setOptions(attrs.options);
if (attrs.value) {
element.setSelectedOption(attrs.value);
}
element.setSelectedOption(attrs.value ?? attrs.options[0] ?? "");
if (attrs.onChange) {
element.onSelectionChanged.add((s, p, i, v) => {
if (p !== undefined) {
Expand All @@ -698,12 +696,8 @@ const sliderElement = (attrs: JSX.IntrinsicElements["slider"]) => {
if (attrs.onChangeActual) {
element.onValueChanged.add(attrs.onChangeActual);
}
if (attrs.min !== undefined) {
element.setMinValue(attrs.min);
}
if (attrs.max !== undefined) {
element.setMaxValue(attrs.max);
}
element.setMinValue(attrs.min ?? 0);
element.setMaxValue(attrs.max ?? 1);
if (attrs.step !== undefined) {
element.setStepSize(attrs.step);
}
Expand Down

0 comments on commit 021e41b

Please sign in to comment.