@gomusdev/web-components 1.53.0 → 1.54.0

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.
@@ -34023,13 +34023,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34023
34023
  const binding_group = [];
34024
34024
  const _tsd = getTicketSelectionDetails($$props.$$host);
34025
34025
  const details = new Details$1(_tsd);
34026
+ const dispatchTimeslotSelect = (target, selected) => {
34027
+ if (!target || !("dispatchEvent" in target)) return;
34028
+ target.dispatchEvent(new CustomEvent("go-timeslot-select", { detail: { selected }, bubbles: true, composed: true }));
34029
+ };
34026
34030
  const change = (e) => {
34027
- e.target.dispatchEvent(new CustomEvent("go-timeslot-select", {
34028
- detail: { selected: details.tsd.selectedTimeslot },
34029
- bubbles: true,
34030
- composed: true
34031
- }));
34031
+ dispatchTimeslotSelect(e.target, details.tsd?.selectedTimeslot);
34032
34032
  };
34033
+ user_effect(() => {
34034
+ const tsd = details.tsd;
34035
+ if (!tsd) return;
34036
+ const slots = details.timeslots;
34037
+ if (slots.length !== 1) return;
34038
+ const only = slots[0];
34039
+ if (!only.available) return;
34040
+ if (tsd.selectedTimeslot === only.startAt) return;
34041
+ tsd.selectedTimeslot = only.startAt;
34042
+ dispatchTimeslotSelect($$props.$$host, only.startAt);
34043
+ });
34033
34044
  var $$exports = { details };
34034
34045
  var fragment = comment();
34035
34046
  var node = first_child(fragment);
@@ -34037,6 +34048,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34037
34048
  var consequent = ($$anchor2) => {
34038
34049
  var ul = root_1$1();
34039
34050
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
34051
+ const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
34052
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
34040
34053
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
34041
34054
  var li = root_2$1();
34042
34055
  var label = child(li);
@@ -34050,13 +34063,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34050
34063
  template_effect(() => {
34051
34064
  set_class(li, 1, clsx({
34052
34065
  "go-timeslot": true,
34053
- "is-sold-out": timeslot.capacity === 0,
34054
- "is-disabled": !timeslot.available,
34066
+ "is-sold-out": get$2(soldOut),
34067
+ "is-disabled": get$2(disabled),
34055
34068
  "is-selected": get$2(selected)
34056
34069
  }));
34057
34070
  set_text(text2, `${timeslot.timeFormatted ?? ""} `);
34058
- input.disabled = timeslot.capacity == 0;
34059
- set_attribute(input, "aria-disabled", timeslot.capacity == 0);
34071
+ input.disabled = get$2(disabled);
34072
+ set_attribute(input, "aria-disabled", get$2(disabled));
34060
34073
  if (input_value !== (input_value = timeslot.startAt)) {
34061
34074
  input.value = (input.__value = timeslot.startAt) ?? "";
34062
34075
  }
@@ -34023,13 +34023,24 @@ function Timeslots($$anchor, $$props) {
34023
34023
  const binding_group = [];
34024
34024
  const _tsd = getTicketSelectionDetails($$props.$$host);
34025
34025
  const details = new Details$1(_tsd);
34026
+ const dispatchTimeslotSelect = (target, selected) => {
34027
+ if (!target || !("dispatchEvent" in target)) return;
34028
+ target.dispatchEvent(new CustomEvent("go-timeslot-select", { detail: { selected }, bubbles: true, composed: true }));
34029
+ };
34026
34030
  const change = (e) => {
34027
- e.target.dispatchEvent(new CustomEvent("go-timeslot-select", {
34028
- detail: { selected: details.tsd.selectedTimeslot },
34029
- bubbles: true,
34030
- composed: true
34031
- }));
34031
+ dispatchTimeslotSelect(e.target, details.tsd?.selectedTimeslot);
34032
34032
  };
34033
+ user_effect(() => {
34034
+ const tsd = details.tsd;
34035
+ if (!tsd) return;
34036
+ const slots = details.timeslots;
34037
+ if (slots.length !== 1) return;
34038
+ const only = slots[0];
34039
+ if (!only.available) return;
34040
+ if (tsd.selectedTimeslot === only.startAt) return;
34041
+ tsd.selectedTimeslot = only.startAt;
34042
+ dispatchTimeslotSelect($$props.$$host, only.startAt);
34043
+ });
34033
34044
  var $$exports = { details };
34034
34045
  var fragment = comment();
34035
34046
  var node = first_child(fragment);
@@ -34037,6 +34048,8 @@ function Timeslots($$anchor, $$props) {
34037
34048
  var consequent = ($$anchor2) => {
34038
34049
  var ul = root_1$1();
34039
34050
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
34051
+ const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
34052
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
34040
34053
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
34041
34054
  var li = root_2$1();
34042
34055
  var label = child(li);
@@ -34050,13 +34063,13 @@ function Timeslots($$anchor, $$props) {
34050
34063
  template_effect(() => {
34051
34064
  set_class(li, 1, clsx({
34052
34065
  "go-timeslot": true,
34053
- "is-sold-out": timeslot.capacity === 0,
34054
- "is-disabled": !timeslot.available,
34066
+ "is-sold-out": get$2(soldOut),
34067
+ "is-disabled": get$2(disabled),
34055
34068
  "is-selected": get$2(selected)
34056
34069
  }));
34057
34070
  set_text(text2, `${timeslot.timeFormatted ?? ""} `);
34058
- input.disabled = timeslot.capacity == 0;
34059
- set_attribute(input, "aria-disabled", timeslot.capacity == 0);
34071
+ input.disabled = get$2(disabled);
34072
+ set_attribute(input, "aria-disabled", get$2(disabled));
34060
34073
  if (input_value !== (input_value = timeslot.startAt)) {
34061
34074
  input.value = (input.__value = timeslot.startAt) ?? "";
34062
34075
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.53.0",
7
+ "version": "1.54.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",