@cambly/syntax-core 9.1.1 → 9.3.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
@@ -951,6 +951,7 @@ var Heading = ({
951
951
  children,
952
952
  color = "gray900",
953
953
  "data-testid": dataTestId,
954
+ lineClamp,
954
955
  size = 500
955
956
  }) => {
956
957
  const weight = [700, 800].includes(size) ? "heavy" : "bold";
@@ -961,6 +962,7 @@ var Heading = ({
961
962
  as,
962
963
  color,
963
964
  "data-testid": dataTestId,
965
+ lineClamp,
964
966
  size,
965
967
  weight,
966
968
  children
@@ -1500,13 +1502,27 @@ SelectList.Option = SelectOption_default;
1500
1502
 
1501
1503
  // src/TapArea/TapArea.tsx
1502
1504
  var import_classnames13 = __toESM(require_classnames());
1503
- import { forwardRef as forwardRef6 } from "react";
1505
+ import { forwardRef as forwardRef6, useReducer } from "react";
1504
1506
 
1505
1507
  // css-module:./TapArea.module.css#css-module
1506
- var TapArea_module_default = { "tapArea": "_tapArea_1rlyl_1", "fullWidth": "_fullWidth_1rlyl_5", "disabled": "_disabled_1rlyl_9", "enabled": "_enabled_1rlyl_16" };
1508
+ 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" };
1507
1509
 
1508
1510
  // src/TapArea/TapArea.tsx
1509
- import { jsx as jsx20 } from "react/jsx-runtime";
1511
+ import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1512
+ function reducer(state, action) {
1513
+ switch (action.type) {
1514
+ case "BLUR":
1515
+ return __spreadProps(__spreadValues({}, state), { focussed: false });
1516
+ case "FOCUS":
1517
+ return __spreadProps(__spreadValues({}, state), { focussed: true });
1518
+ case "MOUSE_ENTER":
1519
+ return __spreadProps(__spreadValues({}, state), { hovered: true });
1520
+ case "MOUSE_LEAVE":
1521
+ return __spreadProps(__spreadValues({}, state), { hovered: false });
1522
+ default:
1523
+ return state;
1524
+ }
1525
+ }
1510
1526
  var TapArea = forwardRef6(
1511
1527
  ({
1512
1528
  children,
@@ -1520,6 +1536,10 @@ var TapArea = forwardRef6(
1520
1536
  }, ref) => {
1521
1537
  const isHydrated = useIsHydrated();
1522
1538
  const disabled = !isHydrated || disabledProp;
1539
+ const [{ hovered, focussed }, dispatch] = useReducer(reducer, {
1540
+ hovered: false,
1541
+ focussed: false
1542
+ });
1523
1543
  const handleClick = (event) => !disabled ? onClick(event) : void 0;
1524
1544
  const handleKeyDown = (event) => {
1525
1545
  if (disabled)
@@ -1529,7 +1549,8 @@ var TapArea = forwardRef6(
1529
1549
  onClick(event);
1530
1550
  }
1531
1551
  };
1532
- return /* @__PURE__ */ jsx20(
1552
+ const isHoveredOrFocussed = !disabled && (hovered || focussed);
1553
+ return /* @__PURE__ */ jsxs9(
1533
1554
  "div",
1534
1555
  {
1535
1556
  "aria-disabled": disabled,
@@ -1538,15 +1559,30 @@ var TapArea = forwardRef6(
1538
1559
  TapArea_module_default.tapArea,
1539
1560
  TapArea_module_default[`${disabled ? "disabled" : "enabled"}`],
1540
1561
  fullWidth && TapArea_module_default.fullWidth,
1541
- rounding !== "none" && rounding_module_default[`rounding${rounding}`]
1562
+ isHoveredOrFocussed && TapArea_module_default.hoveredOrFocussed
1542
1563
  ),
1543
1564
  "data-testid": dataTestId,
1544
1565
  onClick: handleClick,
1545
1566
  onKeyDown: handleKeyDown,
1567
+ onMouseEnter: () => dispatch({ type: "MOUSE_ENTER" }),
1568
+ onMouseLeave: () => dispatch({ type: "MOUSE_LEAVE" }),
1569
+ onFocus: () => dispatch({ type: "FOCUS" }),
1570
+ onBlur: () => dispatch({ type: "BLUR" }),
1546
1571
  ref,
1547
1572
  role: "button",
1548
1573
  tabIndex: disabled ? void 0 : tabIndex,
1549
- children
1574
+ children: [
1575
+ !disabled && (hovered || focussed) && /* @__PURE__ */ jsx20(
1576
+ "div",
1577
+ {
1578
+ className: (0, import_classnames13.default)(
1579
+ TapArea_module_default.overlay,
1580
+ rounding !== "none" && rounding_module_default[`rounding${rounding}`]
1581
+ )
1582
+ }
1583
+ ),
1584
+ children
1585
+ ]
1550
1586
  }
1551
1587
  );
1552
1588
  }
@@ -1564,7 +1600,7 @@ import {
1564
1600
  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" };
1565
1601
 
1566
1602
  // src/TextField/TextField.tsx
1567
- import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
1603
+ import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
1568
1604
  function TextField({
1569
1605
  autoComplete,
1570
1606
  "data-testid": dataTestId,
@@ -1583,7 +1619,7 @@ function TextField({
1583
1619
  const disabled = !isHydrated || disabledProp;
1584
1620
  const reactId = useId2();
1585
1621
  const inputId = id != null ? id : reactId;
1586
- return /* @__PURE__ */ jsxs9(
1622
+ return /* @__PURE__ */ jsxs10(
1587
1623
  Box_default,
1588
1624
  {
1589
1625
  display: "flex",