@cambly/syntax-core 9.1.1 → 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.css +17 -9
- package/dist/index.css.map +1 -1
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1500,13 +1500,27 @@ SelectList.Option = SelectOption_default;
|
|
|
1500
1500
|
|
|
1501
1501
|
// src/TapArea/TapArea.tsx
|
|
1502
1502
|
var import_classnames13 = __toESM(require_classnames());
|
|
1503
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
1503
|
+
import { forwardRef as forwardRef6, useReducer } from "react";
|
|
1504
1504
|
|
|
1505
1505
|
// css-module:./TapArea.module.css#css-module
|
|
1506
|
-
var TapArea_module_default = { "tapArea": "
|
|
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" };
|
|
1507
1507
|
|
|
1508
1508
|
// src/TapArea/TapArea.tsx
|
|
1509
|
-
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
|
+
}
|
|
1510
1524
|
var TapArea = forwardRef6(
|
|
1511
1525
|
({
|
|
1512
1526
|
children,
|
|
@@ -1520,6 +1534,10 @@ var TapArea = forwardRef6(
|
|
|
1520
1534
|
}, ref) => {
|
|
1521
1535
|
const isHydrated = useIsHydrated();
|
|
1522
1536
|
const disabled = !isHydrated || disabledProp;
|
|
1537
|
+
const [{ hovered, focussed }, dispatch] = useReducer(reducer, {
|
|
1538
|
+
hovered: false,
|
|
1539
|
+
focussed: false
|
|
1540
|
+
});
|
|
1523
1541
|
const handleClick = (event) => !disabled ? onClick(event) : void 0;
|
|
1524
1542
|
const handleKeyDown = (event) => {
|
|
1525
1543
|
if (disabled)
|
|
@@ -1529,7 +1547,8 @@ var TapArea = forwardRef6(
|
|
|
1529
1547
|
onClick(event);
|
|
1530
1548
|
}
|
|
1531
1549
|
};
|
|
1532
|
-
|
|
1550
|
+
const isHoveredOrFocussed = !disabled && (hovered || focussed);
|
|
1551
|
+
return /* @__PURE__ */ jsxs9(
|
|
1533
1552
|
"div",
|
|
1534
1553
|
{
|
|
1535
1554
|
"aria-disabled": disabled,
|
|
@@ -1538,15 +1557,30 @@ var TapArea = forwardRef6(
|
|
|
1538
1557
|
TapArea_module_default.tapArea,
|
|
1539
1558
|
TapArea_module_default[`${disabled ? "disabled" : "enabled"}`],
|
|
1540
1559
|
fullWidth && TapArea_module_default.fullWidth,
|
|
1541
|
-
|
|
1560
|
+
isHoveredOrFocussed && TapArea_module_default.hoveredOrFocussed
|
|
1542
1561
|
),
|
|
1543
1562
|
"data-testid": dataTestId,
|
|
1544
1563
|
onClick: handleClick,
|
|
1545
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" }),
|
|
1546
1569
|
ref,
|
|
1547
1570
|
role: "button",
|
|
1548
1571
|
tabIndex: disabled ? void 0 : tabIndex,
|
|
1549
|
-
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
|
+
]
|
|
1550
1584
|
}
|
|
1551
1585
|
);
|
|
1552
1586
|
}
|
|
@@ -1564,7 +1598,7 @@ import {
|
|
|
1564
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" };
|
|
1565
1599
|
|
|
1566
1600
|
// src/TextField/TextField.tsx
|
|
1567
|
-
import { jsx as jsx21, jsxs as
|
|
1601
|
+
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1568
1602
|
function TextField({
|
|
1569
1603
|
autoComplete,
|
|
1570
1604
|
"data-testid": dataTestId,
|
|
@@ -1583,7 +1617,7 @@ function TextField({
|
|
|
1583
1617
|
const disabled = !isHydrated || disabledProp;
|
|
1584
1618
|
const reactId = useId2();
|
|
1585
1619
|
const inputId = id != null ? id : reactId;
|
|
1586
|
-
return /* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ jsxs10(
|
|
1587
1621
|
Box_default,
|
|
1588
1622
|
{
|
|
1589
1623
|
display: "flex",
|