@idds/react 1.5.12 → 1.5.14

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.es.js CHANGED
@@ -10479,62 +10479,17 @@ function Toggle({
10479
10479
  const checked = isControlled ? controlledChecked : internalChecked;
10480
10480
  const handleChange = useCallback(
10481
10481
  (event) => {
10482
- console.log("handleChange called", {
10483
- disabled,
10484
- checked: event.target.checked,
10485
- isControlled
10486
- });
10487
10482
  if (disabled) return;
10488
10483
  const newChecked = event.target.checked;
10489
10484
  if (!isControlled) {
10490
10485
  setInternalChecked(newChecked);
10491
10486
  }
10492
10487
  if (onChange) {
10493
- console.log("Calling onChange from handleChange with", newChecked);
10494
10488
  onChange(newChecked);
10495
10489
  }
10496
10490
  },
10497
10491
  [disabled, onChange, isControlled]
10498
10492
  );
10499
- const handleKeyDown = useCallback(
10500
- (event) => {
10501
- if (disabled) return;
10502
- if (event.key === "Enter" || event.key === " ") {
10503
- event.preventDefault();
10504
- const newChecked = !checked;
10505
- if (!isControlled) {
10506
- setInternalChecked(newChecked);
10507
- }
10508
- if (onChange) {
10509
- onChange(newChecked);
10510
- }
10511
- }
10512
- },
10513
- [disabled, checked, onChange, isControlled]
10514
- );
10515
- const handleClick = useCallback(
10516
- (event) => {
10517
- console.log("handleClick called", { disabled, checked, isControlled });
10518
- if (disabled) return;
10519
- if (event.target.tagName === "INPUT") {
10520
- return;
10521
- }
10522
- event.preventDefault();
10523
- event.stopPropagation();
10524
- const newChecked = !checked;
10525
- console.log("Toggle changing from", checked, "to", newChecked);
10526
- if (!isControlled) {
10527
- setInternalChecked(newChecked);
10528
- }
10529
- if (onChange) {
10530
- console.log("Calling onChange with", newChecked);
10531
- onChange(newChecked);
10532
- } else {
10533
- console.log("onChange is not provided");
10534
- }
10535
- },
10536
- [disabled, checked, onChange, isControlled]
10537
- );
10538
10493
  const toggleClasses = clsx(
10539
10494
  "ina-toggle",
10540
10495
  `ina-toggle--size-${size}`,
@@ -10561,46 +10516,32 @@ function Toggle({
10561
10516
  }
10562
10517
  );
10563
10518
  const trackStyle = checked && color && !disabled ? { backgroundColor: color, borderColor: color } : {};
10564
- return /* @__PURE__ */ jsxs(
10565
- "div",
10566
- {
10567
- className: toggleClasses,
10568
- onClick: handleClick,
10569
- role: "switch",
10570
- "aria-checked": checked,
10571
- "aria-label": ariaLabel,
10572
- "aria-describedby": ariaDescribedBy,
10573
- children: [
10574
- /* @__PURE__ */ jsx(
10575
- "input",
10576
- {
10577
- ...rest,
10578
- type: "checkbox",
10579
- id,
10580
- name,
10581
- value,
10582
- checked,
10583
- disabled,
10584
- onChange: handleChange,
10585
- onKeyDown: handleKeyDown,
10586
- "aria-label": ariaLabel,
10587
- "aria-describedby": ariaDescribedBy,
10588
- className: "ina-toggle__input",
10589
- tabIndex: -1,
10590
- readOnly: true
10591
- }
10592
- ),
10593
- /* @__PURE__ */ jsx(
10594
- "div",
10595
- {
10596
- className: trackClasses,
10597
- style: { pointerEvents: "none", ...trackStyle },
10598
- children: /* @__PURE__ */ jsx("div", { className: thumbClasses })
10599
- }
10600
- )
10601
- ]
10602
- }
10603
- );
10519
+ return /* @__PURE__ */ jsxs("div", { className: toggleClasses, children: [
10520
+ /* @__PURE__ */ jsx(
10521
+ "input",
10522
+ {
10523
+ ...rest,
10524
+ type: "checkbox",
10525
+ id,
10526
+ name,
10527
+ value,
10528
+ checked,
10529
+ disabled,
10530
+ onChange: handleChange,
10531
+ "aria-label": ariaLabel,
10532
+ "aria-describedby": ariaDescribedBy,
10533
+ className: "ina-toggle__input"
10534
+ }
10535
+ ),
10536
+ /* @__PURE__ */ jsx(
10537
+ "div",
10538
+ {
10539
+ className: trackClasses,
10540
+ style: { pointerEvents: "none", ...trackStyle },
10541
+ children: /* @__PURE__ */ jsx("div", { className: thumbClasses })
10542
+ }
10543
+ )
10544
+ ] });
10604
10545
  }
10605
10546
  function TabHorizontal({
10606
10547
  items,