@norges-domstoler/dds-components 0.0.0-dev-20240904124610 → 0.0.0-dev-20240904130256

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.js CHANGED
@@ -10407,15 +10407,26 @@ var itemStateCn = {
10407
10407
  var getVisuallyHiddenText = (active, completed, index) => `${index + 1}, ${active ? "" : "Trinn, "}${completed ? "Ferdig, " : "Ikke ferdig, "}`;
10408
10408
  var ProgressTrackerItem = (props) => {
10409
10409
  const {
10410
+ id,
10411
+ className,
10412
+ htmlProps,
10410
10413
  index = 0,
10411
10414
  completed = false,
10412
10415
  disabled = false,
10416
+ onClick,
10413
10417
  icon,
10414
- children
10418
+ children,
10419
+ ...rest
10415
10420
  } = props;
10416
10421
  const { activeStep, handleStepChange } = useProgressTrackerContext();
10417
10422
  const active = activeStep === index;
10418
10423
  const itemState = toItemState(active, completed, disabled);
10424
+ const handleClick = () => {
10425
+ if (!disabled) {
10426
+ onClick && onClick(index);
10427
+ handleStepChange && handleStepChange(index);
10428
+ }
10429
+ };
10419
10430
  const stepNumberContent = (0, import_react107.useMemo)(() => {
10420
10431
  if (completed) {
10421
10432
  return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Icon, { icon: CheckIcon, iconSize: "small" });
@@ -10456,12 +10467,28 @@ var ProgressTrackerItem = (props) => {
10456
10467
  return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("li", { "aria-current": active ? "step" : void 0, className: ProgressTracker_default.item, children: handleStepChange ? /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
10457
10468
  "button",
10458
10469
  {
10459
- onClick: !disabled && handleStepChange ? () => handleStepChange(index) : void 0,
10470
+ ...getBaseHTMLProps(
10471
+ id,
10472
+ cn(className, ProgressTracker_default["item-button"], focusable),
10473
+ htmlProps,
10474
+ rest
10475
+ ),
10476
+ onClick: () => handleClick(),
10460
10477
  disabled,
10461
- className: cn(ProgressTracker_default["item-button"], focusable),
10462
10478
  children: stepContent
10463
10479
  }
10464
- ) : /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: cn(ProgressTracker_default["item-button"], ProgressTracker_default["item-div"]), children: stepContent }) });
10480
+ ) : /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
10481
+ "div",
10482
+ {
10483
+ ...getBaseHTMLProps(
10484
+ id,
10485
+ cn(className, cn(ProgressTracker_default["item-button"], ProgressTracker_default["item-div"])),
10486
+ htmlProps,
10487
+ rest
10488
+ ),
10489
+ children: stepContent
10490
+ }
10491
+ ) });
10465
10492
  };
10466
10493
  ProgressTrackerItem.displayName = "ProgressTracker.Item";
10467
10494