@cambly/syntax-core 9.1.0 → 9.2.0

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
@@ -978,7 +978,6 @@ var IconButton_module_default = { "iconButton": "_iconButton_4e8qe_1", "sm": "_s
978
978
 
979
979
  // src/IconButton/IconButton.tsx
980
980
  import { jsx as jsx12 } from "react/jsx-runtime";
981
- "use client";
982
981
  var iconSize2 = {
983
982
  ["sm"]: IconButton_module_default.smIcon,
984
983
  ["md"]: IconButton_module_default.mdIcon,
@@ -1501,13 +1500,27 @@ SelectList.Option = SelectOption_default;
1501
1500
 
1502
1501
  // src/TapArea/TapArea.tsx
1503
1502
  var import_classnames13 = __toESM(require_classnames());
1504
- import { forwardRef as forwardRef6 } from "react";
1503
+ import { forwardRef as forwardRef6, useReducer } from "react";
1505
1504
 
1506
1505
  // css-module:./TapArea.module.css#css-module
1507
- var TapArea_module_default = { "tapArea": "_tapArea_1rlyl_1", "fullWidth": "_fullWidth_1rlyl_5", "disabled": "_disabled_1rlyl_9", "enabled": "_enabled_1rlyl_16" };
1506
+ var TapArea_module_default = { "tapArea": "_tapArea_1so6s_1", "fullWidth": "_fullWidth_1so6s_5", "disabled": "_disabled_1so6s_9", "enabled": "_enabled_1so6s_16", "overlay": "_overlay_1so6s_29", "hoveredOrFocussed": "_hoveredOrFocussed_1so6s_38" };
1508
1507
 
1509
1508
  // src/TapArea/TapArea.tsx
1510
- import { jsx as jsx20 } from "react/jsx-runtime";
1509
+ import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1510
+ function reducer(state, action) {
1511
+ switch (action.type) {
1512
+ case "BLUR":
1513
+ return __spreadProps(__spreadValues({}, state), { focussed: false });
1514
+ case "FOCUS":
1515
+ return __spreadProps(__spreadValues({}, state), { focussed: true });
1516
+ case "MOUSE_ENTER":
1517
+ return __spreadProps(__spreadValues({}, state), { hovered: true });
1518
+ case "MOUSE_LEAVE":
1519
+ return __spreadProps(__spreadValues({}, state), { hovered: false });
1520
+ default:
1521
+ return state;
1522
+ }
1523
+ }
1511
1524
  var TapArea = forwardRef6(
1512
1525
  ({
1513
1526
  children,
@@ -1521,6 +1534,10 @@ var TapArea = forwardRef6(
1521
1534
  }, ref) => {
1522
1535
  const isHydrated = useIsHydrated();
1523
1536
  const disabled = !isHydrated || disabledProp;
1537
+ const [{ hovered, focussed }, dispatch] = useReducer(reducer, {
1538
+ hovered: false,
1539
+ focussed: false
1540
+ });
1524
1541
  const handleClick = (event) => !disabled ? onClick(event) : void 0;
1525
1542
  const handleKeyDown = (event) => {
1526
1543
  if (disabled)
@@ -1530,7 +1547,8 @@ var TapArea = forwardRef6(
1530
1547
  onClick(event);
1531
1548
  }
1532
1549
  };
1533
- return /* @__PURE__ */ jsx20(
1550
+ const isHoveredOrFocussed = !disabled && (hovered || focussed);
1551
+ return /* @__PURE__ */ jsxs9(
1534
1552
  "div",
1535
1553
  {
1536
1554
  "aria-disabled": disabled,
@@ -1539,15 +1557,30 @@ var TapArea = forwardRef6(
1539
1557
  TapArea_module_default.tapArea,
1540
1558
  TapArea_module_default[`${disabled ? "disabled" : "enabled"}`],
1541
1559
  fullWidth && TapArea_module_default.fullWidth,
1542
- rounding !== "none" && rounding_module_default[`rounding${rounding}`]
1560
+ isHoveredOrFocussed && TapArea_module_default.hoveredOrFocussed
1543
1561
  ),
1544
1562
  "data-testid": dataTestId,
1545
1563
  onClick: handleClick,
1546
1564
  onKeyDown: handleKeyDown,
1565
+ onMouseEnter: () => dispatch({ type: "MOUSE_ENTER" }),
1566
+ onMouseLeave: () => dispatch({ type: "MOUSE_LEAVE" }),
1567
+ onFocus: () => dispatch({ type: "FOCUS" }),
1568
+ onBlur: () => dispatch({ type: "BLUR" }),
1547
1569
  ref,
1548
1570
  role: "button",
1549
1571
  tabIndex: disabled ? void 0 : tabIndex,
1550
- children
1572
+ children: [
1573
+ !disabled && (hovered || focussed) && /* @__PURE__ */ jsx20(
1574
+ "div",
1575
+ {
1576
+ className: (0, import_classnames13.default)(
1577
+ TapArea_module_default.overlay,
1578
+ rounding !== "none" && rounding_module_default[`rounding${rounding}`]
1579
+ )
1580
+ }
1581
+ ),
1582
+ children
1583
+ ]
1551
1584
  }
1552
1585
  );
1553
1586
  }
@@ -1565,7 +1598,7 @@ import {
1565
1598
  var TextField_module_default = { "textfield": "_textfield_cltsv_1", "label": "_label_cltsv_21", "sm": "_sm_cltsv_25", "md": "_md_cltsv_30", "lg": "_lg_cltsv_35", "inputError": "_inputError_cltsv_40" };
1566
1599
 
1567
1600
  // src/TextField/TextField.tsx
1568
- import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
1601
+ import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
1569
1602
  function TextField({
1570
1603
  autoComplete,
1571
1604
  "data-testid": dataTestId,
@@ -1584,7 +1617,7 @@ function TextField({
1584
1617
  const disabled = !isHydrated || disabledProp;
1585
1618
  const reactId = useId2();
1586
1619
  const inputId = id != null ? id : reactId;
1587
- return /* @__PURE__ */ jsxs9(
1620
+ return /* @__PURE__ */ jsxs10(
1588
1621
  Box_default,
1589
1622
  {
1590
1623
  display: "flex",