gigaboard 1.5.0 → 1.5.1

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.cjs CHANGED
@@ -347,9 +347,12 @@ function BoardEditor({
347
347
  getSquareAriaLabel,
348
348
  focusedSquare: propFocusedSquare,
349
349
  onSquareFocus,
350
+ id,
350
351
  onClear,
351
352
  onSetStartingPosition,
352
- onToggleSideToMove
353
+ onToggleSideToMove,
354
+ onFocus,
355
+ onBlur
353
356
  }) {
354
357
  const containerRef = react.useRef(null);
355
358
  const liveRegionRef = react.useRef(null);
@@ -635,6 +638,7 @@ function BoardEditor({
635
638
  "div",
636
639
  {
637
640
  ref: containerRef,
641
+ id,
638
642
  role: "application",
639
643
  tabIndex: 0,
640
644
  "aria-label": ariaLabel,
@@ -645,8 +649,14 @@ function BoardEditor({
645
649
  setHasKeyboardFocus(true);
646
650
  announceSquare(focusedSquare);
647
651
  }
652
+ onFocus?.(e);
653
+ },
654
+ onBlur: (e) => {
655
+ if (e.target === e.currentTarget) {
656
+ setHasKeyboardFocus(false);
657
+ }
658
+ onBlur?.(e);
648
659
  },
649
- onBlur: () => setHasKeyboardFocus(false),
650
660
  onPointerDown: handlePointerDown,
651
661
  onPointerMove: handlePointerMove,
652
662
  onPointerUp: handlePointerUp,
@@ -728,6 +738,39 @@ function BoardEditor({
728
738
  })
729
739
  }
730
740
  ),
741
+ hasKeyboardFocus && /* @__PURE__ */ jsxRuntime.jsx(
742
+ "div",
743
+ {
744
+ "aria-hidden": "true",
745
+ style: {
746
+ position: "absolute",
747
+ inset: 0,
748
+ display: "grid",
749
+ gridTemplateColumns: "repeat(8, 1fr)",
750
+ gridTemplateRows: "repeat(8, 1fr)",
751
+ pointerEvents: "none",
752
+ zIndex: 10
753
+ },
754
+ children: (() => {
755
+ const { col, row } = gridCoord(focusedSquare, orientation);
756
+ return /* @__PURE__ */ jsxRuntime.jsx(
757
+ "div",
758
+ {
759
+ "data-gb-editor-focus-square": algebraicOf2(focusedSquare),
760
+ style: {
761
+ gridColumnStart: col,
762
+ gridRowStart: row,
763
+ outline: "3px solid var(--gb-editor-sq-focus, #f59e0b)",
764
+ outlineOffset: "-3px",
765
+ boxShadow: "inset 0 0 0 1.5px rgba(0, 0, 0, 0.75), 0 0 8px rgba(245, 158, 11, 0.7)",
766
+ borderRadius: "2px",
767
+ pointerEvents: "none"
768
+ }
769
+ }
770
+ );
771
+ })()
772
+ }
773
+ ),
731
774
  dragging && containerRef.current ? /* @__PURE__ */ jsxRuntime.jsx(
732
775
  "div",
733
776
  {