@helpwave/hightide 0.10.1 → 0.10.2

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.mjs CHANGED
@@ -10060,9 +10060,11 @@ var SelectButton = forwardRef3(
10060
10060
  return () => unregister();
10061
10061
  }, [registerTrigger]);
10062
10062
  const disabled = !!disabledOverride || !!context.disabled;
10063
+ const readOnly = !!context.readOnly;
10063
10064
  const invalid = context.invalid;
10064
10065
  const hasValue = context.selectedId !== null;
10065
- const selectedOption = context.idToOptionMap[context.selectedId] ?? null;
10066
+ const hasInteractions = !readOnly && !disabled;
10067
+ const selectedOption = context.selectedId ? context.idToOptionMap[context.selectedId] ?? null : null;
10066
10068
  return /* @__PURE__ */ jsxs9(
10067
10069
  "div",
10068
10070
  {
@@ -10070,12 +10072,13 @@ var SelectButton = forwardRef3(
10070
10072
  ref: innerRef,
10071
10073
  id: context.config.ids.trigger,
10072
10074
  onClick: (event) => {
10075
+ if (!hasInteractions) return;
10073
10076
  props.onClick?.(event);
10074
10077
  context.toggleIsOpen();
10075
10078
  },
10076
10079
  onKeyDown: (event) => {
10077
10080
  props.onKeyDown?.(event);
10078
- if (disabled) return;
10081
+ if (!hasInteractions) return;
10079
10082
  switch (event.key) {
10080
10083
  case "Enter":
10081
10084
  case " ":
@@ -10098,16 +10101,18 @@ var SelectButton = forwardRef3(
10098
10101
  "data-name": props["data-name"] ?? "select-button",
10099
10102
  "data-value": hasValue ? "" : void 0,
10100
10103
  "data-disabled": disabled ? "" : void 0,
10104
+ "data-readonly": readOnly ? "" : void 0,
10101
10105
  "data-invalid": invalid ? "" : void 0,
10102
10106
  tabIndex: disabled ? -1 : 0,
10103
10107
  role: "button",
10104
10108
  "aria-invalid": invalid,
10105
10109
  "aria-disabled": disabled,
10110
+ "aria-readonly": readOnly,
10106
10111
  "aria-haspopup": "dialog",
10107
10112
  "aria-expanded": context.isOpen,
10108
10113
  "aria-controls": context.isOpen ? context.config.ids.content : void 0,
10109
10114
  children: [
10110
- /* @__PURE__ */ jsx17(SelectOptionDisplayContext.Provider, { value: "trigger", children: hasValue ? selectedDisplay?.(selectedOption) ?? selectedOption.display : placeholder ?? translation("clickToSelect") }),
10115
+ /* @__PURE__ */ jsx17(SelectOptionDisplayContext.Provider, { value: "trigger", children: hasValue ? selectedDisplay?.(selectedOption) ?? selectedOption?.display : placeholder ?? translation("clickToSelect") }),
10111
10116
  !hideExpansionIcon && /* @__PURE__ */ jsx17(ExpansionIcon, { isExpanded: context.isOpen })
10112
10117
  ]
10113
10118
  }
@@ -18606,8 +18611,10 @@ var MultiSelectButton = forwardRef21(function MultiSelectButton2({
18606
18611
  return () => unregister();
18607
18612
  }, [registerTrigger]);
18608
18613
  const disabled = !!disabledOverride || !!context.disabled;
18614
+ const readOnly = !!context.readOnly;
18609
18615
  const invalid = context.invalid;
18610
18616
  const hasValue = context.value.length > 0;
18617
+ const hasInteractions = !readOnly && !disabled;
18611
18618
  const selectedOptions = context.selectedIds.map((id2) => context.idToOptionMap[id2]).filter(Boolean);
18612
18619
  return /* @__PURE__ */ jsxs45(
18613
18620
  "div",
@@ -18616,12 +18623,13 @@ var MultiSelectButton = forwardRef21(function MultiSelectButton2({
18616
18623
  ref: innerRef,
18617
18624
  id: context.config.ids.trigger,
18618
18625
  onClick: (event) => {
18626
+ if (!hasInteractions) return;
18619
18627
  props.onClick?.(event);
18620
18628
  context.toggleIsOpen();
18621
18629
  },
18622
18630
  onKeyDown: (event) => {
18623
18631
  props.onKeyDown?.(event);
18624
- if (disabled) return;
18632
+ if (!hasInteractions) return;
18625
18633
  switch (event.key) {
18626
18634
  case "Enter":
18627
18635
  case " ":
@@ -18644,11 +18652,13 @@ var MultiSelectButton = forwardRef21(function MultiSelectButton2({
18644
18652
  "data-name": props["data-name"] ?? "multi-select-button",
18645
18653
  "data-value": hasValue ? "" : void 0,
18646
18654
  "data-disabled": disabled ? "" : void 0,
18655
+ "data-readonly": readOnly ? "" : void 0,
18647
18656
  "data-invalid": invalid ? "" : void 0,
18648
18657
  tabIndex: disabled ? -1 : 0,
18649
18658
  role: "button",
18650
18659
  "aria-invalid": invalid,
18651
18660
  "aria-disabled": disabled,
18661
+ "aria-readonly": readOnly,
18652
18662
  "aria-haspopup": "dialog",
18653
18663
  "aria-expanded": context.isOpen,
18654
18664
  "aria-controls": context.isOpen ? context.config.ids.content : void 0,
@@ -20927,7 +20937,9 @@ var MultiSelectChipDisplayButton = forwardRef29(function MultiSelectChipDisplayB
20927
20937
  return () => unregister();
20928
20938
  }, [registerTrigger]);
20929
20939
  const disabled = !!props?.disabled || !!context.disabled;
20940
+ const readOnly = !!context.readOnly;
20930
20941
  const invalid = context.invalid;
20942
+ const hasInteractions = !readOnly && !disabled;
20931
20943
  const selectedOptions = context.selectedIds.map((oid) => context.idToOptionMap[oid]).filter(Boolean);
20932
20944
  return /* @__PURE__ */ jsxs61(
20933
20945
  "div",
@@ -20937,14 +20949,17 @@ var MultiSelectChipDisplayButton = forwardRef29(function MultiSelectChipDisplayB
20937
20949
  onClick: (event) => {
20938
20950
  props.onClick?.(event);
20939
20951
  if (event.defaultPrevented) return;
20952
+ if (!hasInteractions) return;
20940
20953
  context.toggleIsOpen();
20941
20954
  },
20942
20955
  "data-name": props["data-name"] ?? "multi-select-chip-display-button",
20943
20956
  "data-value": context.value.length > 0 ? "" : void 0,
20944
20957
  "data-disabled": disabled ? "" : void 0,
20958
+ "data-readonly": readOnly ? "" : void 0,
20945
20959
  "data-invalid": invalid ? "" : void 0,
20946
20960
  "aria-invalid": invalid,
20947
20961
  "aria-disabled": disabled,
20962
+ "aria-readonly": readOnly,
20948
20963
  children: [
20949
20964
  selectedOptions.map((opt) => /* @__PURE__ */ jsxs61("div", { "data-name": "multi-select-chip-display-chip", children: [
20950
20965
  opt.display,
@@ -20952,6 +20967,7 @@ var MultiSelectChipDisplayButton = forwardRef29(function MultiSelectChipDisplayB
20952
20967
  IconButton,
20953
20968
  {
20954
20969
  tooltip: translation("remove"),
20970
+ disabled: !hasInteractions,
20955
20971
  onClick: (e) => {
20956
20972
  context.toggleSelection(opt.id, false);
20957
20973
  e.preventDefault();
@@ -20968,11 +20984,14 @@ var MultiSelectChipDisplayButton = forwardRef29(function MultiSelectChipDisplayB
20968
20984
  IconButton,
20969
20985
  {
20970
20986
  id: context.config.ids.trigger,
20987
+ disabled: !hasInteractions,
20971
20988
  onClick: (event) => {
20972
20989
  event.stopPropagation();
20990
+ if (!hasInteractions) return;
20973
20991
  context.toggleIsOpen();
20974
20992
  },
20975
20993
  onKeyDown: (event) => {
20994
+ if (!hasInteractions) return;
20976
20995
  switch (event.key) {
20977
20996
  case "ArrowDown":
20978
20997
  context.setIsOpen(true, "first");