@vygruppen/spor-react 12.24.9 → 12.24.11

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
@@ -108,10 +108,17 @@ var AccordionItemTrigger = forwardRef(function AccordionItemTrigger2(props, ref)
108
108
  ] }) });
109
109
  });
110
110
  var AccordionItemContent = forwardRef(function AccordionItemContent2(props, ref) {
111
- const { children } = props;
111
+ const { children, "aria-labelledby": ariaLabelledBy, ...otherProps } = props;
112
112
  const recipe = useSlotRecipe({ key: "accordion" });
113
113
  const styles = recipe();
114
- return /* @__PURE__ */ jsx(Accordion$1.ItemContent, { css: styles.itemContent, children: /* @__PURE__ */ jsx(Accordion$1.ItemBody, { ...props, ref, children }) });
114
+ return /* @__PURE__ */ jsx(
115
+ Accordion$1.ItemContent,
116
+ {
117
+ css: styles.itemContent,
118
+ "aria-labelledby": ariaLabelledBy,
119
+ children: /* @__PURE__ */ jsx(Accordion$1.ItemBody, { ...otherProps, ref, children })
120
+ }
121
+ );
115
122
  });
116
123
  Accordion.displayName = "Accordion";
117
124
  var AccordionItem = Accordion$1.Item;
@@ -1504,9 +1511,19 @@ PressableCard.displayName = "PressableCard";
1504
1511
  var RadioCard = forwardRef(
1505
1512
  (props, ref) => {
1506
1513
  const { inputProps, children } = props;
1514
+ const uniqueId = useId();
1515
+ const itemControlId = `radio-card-item-control-${uniqueId}`;
1516
+ const inputHasAriaLabel = (inputProps == null ? void 0 : inputProps["aria-labelledby"]) || (inputProps == null ? void 0 : inputProps["aria-label"]);
1507
1517
  return /* @__PURE__ */ jsxs(RadioCard$1.Item, { ...props, children: [
1508
- /* @__PURE__ */ jsx(RadioCard$1.ItemHiddenInput, { ref, ...inputProps }),
1509
- /* @__PURE__ */ jsx(RadioCard$1.ItemControl, { children })
1518
+ /* @__PURE__ */ jsx(
1519
+ RadioCard$1.ItemHiddenInput,
1520
+ {
1521
+ "aria-labelledby": inputHasAriaLabel ? inputProps == null ? void 0 : inputProps["aria-labelledby"] : itemControlId,
1522
+ ref,
1523
+ ...inputProps
1524
+ }
1525
+ ),
1526
+ /* @__PURE__ */ jsx(RadioCard$1.ItemControl, { id: itemControlId, "aria-hidden": true, children })
1510
1527
  ] });
1511
1528
  }
1512
1529
  );
@@ -3331,7 +3348,7 @@ var Autocomplete = ({
3331
3348
  );
3332
3349
  const combobox = useCombobox({
3333
3350
  collection,
3334
- openOnClick,
3351
+ openOnClick: filteredChildren.length > 0 ? openOnClick : false,
3335
3352
  onInputValueChange: (event) => {
3336
3353
  if (!filteredExternally) {
3337
3354
  filter(event.inputValue);
@@ -3364,16 +3381,16 @@ var Autocomplete = ({
3364
3381
  required,
3365
3382
  onFocus: (event) => {
3366
3383
  onFocus == null ? void 0 : onFocus(event);
3367
- if (openOnFocus)
3384
+ if (openOnFocus && filteredChildren.length > 0)
3368
3385
  combobox.setOpen(true);
3369
3386
  }
3370
3387
  }
3371
3388
  ) }),
3372
- /* @__PURE__ */ jsx(Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsx(Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts14.clearValue), children: /* @__PURE__ */ jsx(CloseButton, { size: "xs" }) }) })
3389
+ /* @__PURE__ */ jsx(Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsx(Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts14.clearValue), children: /* @__PURE__ */ jsx(CloseButton, { size: "xs", tabIndex: 0 }) }) })
3373
3390
  ] }),
3374
3391
  /* @__PURE__ */ jsx(Combobox.Positioner, { children: /* @__PURE__ */ jsxs(Combobox.Content, { children: [
3375
- /* @__PURE__ */ jsx(Combobox.Empty, { children: !loading && (emptyLabel ?? t(texts14.noItemsFound)) }),
3376
- loading ? /* @__PURE__ */ jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : /* @__PURE__ */ jsx(Fragment, { children: filteredChildren })
3392
+ !loading && /* @__PURE__ */ jsx(Combobox.Empty, { children: emptyLabel ?? t(texts14.noItemsFound) }),
3393
+ loading ? /* @__PURE__ */ jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : filteredChildren
3377
3394
  ] }) })
3378
3395
  ] });
3379
3396
  };