@cambly/syntax-core 9.0.2 → 9.1.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.css +10 -6
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +63 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -545,6 +545,16 @@ var loadingIconSize_default = loadingIconSize;
|
|
|
545
545
|
// css-module:./Button.module.css#css-module
|
|
546
546
|
var Button_module_default2 = { "button": "_button_1iunh_1", "buttonGap": "_buttonGap_1iunh_9", "fullWidth": "_fullWidth_1iunh_50", "sm": "_sm_1iunh_54", "md": "_md_1iunh_61", "lg": "_lg_1iunh_68", "icon": "_icon_1iunh_75", "smIcon": "_smIcon_1iunh_79", "mdIcon": "_mdIcon_1iunh_86", "lgIcon": "_lgIcon_1iunh_93", "secondaryBorder": "_secondaryBorder_1iunh_100", "secondaryDestructiveBorder": "_secondaryDestructiveBorder_1iunh_104", "loading": "_loading_1iunh_118", "syntaxButtonLoadingRotate": "_syntaxButtonLoadingRotate_1iunh_1", "loadingCircle": "_loadingCircle_1iunh_122" };
|
|
547
547
|
|
|
548
|
+
// src/useIsHydrated.tsx
|
|
549
|
+
import { useEffect, useState } from "react";
|
|
550
|
+
function useIsHydrated() {
|
|
551
|
+
const [isHydrated, setIsHydrated] = useState(false);
|
|
552
|
+
useEffect(() => {
|
|
553
|
+
setIsHydrated(true);
|
|
554
|
+
}, []);
|
|
555
|
+
return isHydrated;
|
|
556
|
+
}
|
|
557
|
+
|
|
548
558
|
// src/Button/Button.tsx
|
|
549
559
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
550
560
|
var Button = forwardRef2(
|
|
@@ -564,6 +574,7 @@ var Button = forwardRef2(
|
|
|
564
574
|
tooltip,
|
|
565
575
|
type = "button"
|
|
566
576
|
}, ref) => {
|
|
577
|
+
const isHydrated = useIsHydrated();
|
|
567
578
|
return /* @__PURE__ */ jsxs2(
|
|
568
579
|
"button",
|
|
569
580
|
{
|
|
@@ -572,7 +583,7 @@ var Button = forwardRef2(
|
|
|
572
583
|
"aria-label": accessibilityLabel,
|
|
573
584
|
type,
|
|
574
585
|
title: tooltip,
|
|
575
|
-
disabled: disabled || loading,
|
|
586
|
+
disabled: !isHydrated || disabled || loading,
|
|
576
587
|
onClick,
|
|
577
588
|
className: (0, import_classnames4.default)(
|
|
578
589
|
Button_module_default2.button,
|
|
@@ -678,10 +689,10 @@ function Card({
|
|
|
678
689
|
|
|
679
690
|
// src/Checkbox/Checkbox.tsx
|
|
680
691
|
var import_classnames6 = __toESM(require_classnames());
|
|
681
|
-
import { useState as
|
|
692
|
+
import { useState as useState3 } from "react";
|
|
682
693
|
|
|
683
694
|
// src/useFocusVisible.tsx
|
|
684
|
-
import { useState, useEffect } from "react";
|
|
695
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
685
696
|
var hasSetupGlobalListeners = false;
|
|
686
697
|
var currentModality = null;
|
|
687
698
|
var changeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -757,8 +768,8 @@ function setupGlobalFocusEvents() {
|
|
|
757
768
|
}
|
|
758
769
|
function useFocusVisible() {
|
|
759
770
|
setupGlobalFocusEvents();
|
|
760
|
-
const [isFocusVisibleState, setFocusVisible] =
|
|
761
|
-
|
|
771
|
+
const [isFocusVisibleState, setFocusVisible] = useState2(isFocusVisible());
|
|
772
|
+
useEffect2(() => {
|
|
762
773
|
const handler = () => {
|
|
763
774
|
setFocusVisible(isFocusVisible());
|
|
764
775
|
};
|
|
@@ -789,13 +800,15 @@ var iconWidth = {
|
|
|
789
800
|
var Checkbox = ({
|
|
790
801
|
checked = false,
|
|
791
802
|
"data-testid": dataTestId,
|
|
792
|
-
disabled = false,
|
|
803
|
+
disabled: disabledProp = false,
|
|
793
804
|
size = "md",
|
|
794
805
|
label,
|
|
795
806
|
error = false,
|
|
796
807
|
onChange
|
|
797
808
|
}) => {
|
|
798
|
-
const
|
|
809
|
+
const isHydrated = useIsHydrated();
|
|
810
|
+
const disabled = !isHydrated || disabledProp;
|
|
811
|
+
const [isFocused, setIsFocused] = useState3(false);
|
|
799
812
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
800
813
|
const checkboxStyling = (0, import_classnames6.default)(Checkbox_module_default.checkbox, Checkbox_module_default[size]);
|
|
801
814
|
const uncheckedStyling = (0, import_classnames6.default)(checkboxStyling, Checkbox_module_default.uncheckedBox, {
|
|
@@ -866,7 +879,7 @@ var import_classnames7 = __toESM(require_classnames());
|
|
|
866
879
|
import { forwardRef as forwardRef3 } from "react";
|
|
867
880
|
|
|
868
881
|
// css-module:./Chip.module.css#css-module
|
|
869
|
-
var Chip_module_default = { "chip": "
|
|
882
|
+
var Chip_module_default = { "chip": "_chip_nvvgx_1", "disabled": "_disabled_nvvgx_12", "selectedChip": "_selectedChip_nvvgx_17", "icon": "_icon_nvvgx_22", "selectedIcon": "_selectedIcon_nvvgx_30", "sm": "_sm_nvvgx_34", "lg": "_lg_nvvgx_40" };
|
|
870
883
|
|
|
871
884
|
// src/Chip/Chip.tsx
|
|
872
885
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -879,8 +892,11 @@ var Chip = forwardRef3(
|
|
|
879
892
|
onChange,
|
|
880
893
|
icon: Icon
|
|
881
894
|
}, ref) => {
|
|
895
|
+
const isHydrated = useIsHydrated();
|
|
896
|
+
const disabled = !isHydrated;
|
|
882
897
|
const chipStyles = (0, import_classnames7.default)(Chip_module_default.chip, Chip_module_default[size], {
|
|
883
|
-
[Chip_module_default.selectedChip]: selected
|
|
898
|
+
[Chip_module_default.selectedChip]: selected,
|
|
899
|
+
[Chip_module_default.disabled]: disabled
|
|
884
900
|
});
|
|
885
901
|
const iconStyles = (0, import_classnames7.default)(Chip_module_default.icon, {
|
|
886
902
|
[Chip_module_default.selectedIcon]: selected
|
|
@@ -893,6 +909,7 @@ var Chip = forwardRef3(
|
|
|
893
909
|
"button",
|
|
894
910
|
{
|
|
895
911
|
className: chipStyles,
|
|
912
|
+
disabled,
|
|
896
913
|
"data-testid": dataTestId,
|
|
897
914
|
ref,
|
|
898
915
|
type: "button",
|
|
@@ -977,6 +994,7 @@ var IconButton = forwardRef4(
|
|
|
977
994
|
tooltip,
|
|
978
995
|
onClick
|
|
979
996
|
}, ref) => {
|
|
997
|
+
const isHydrated = useIsHydrated();
|
|
980
998
|
return /* @__PURE__ */ jsx12(
|
|
981
999
|
"button",
|
|
982
1000
|
{
|
|
@@ -984,7 +1002,7 @@ var IconButton = forwardRef4(
|
|
|
984
1002
|
"data-testid": dataTestId,
|
|
985
1003
|
type: "button",
|
|
986
1004
|
title: tooltip,
|
|
987
|
-
disabled,
|
|
1005
|
+
disabled: !isHydrated || disabled,
|
|
988
1006
|
onClick,
|
|
989
1007
|
className: (0, import_classnames8.default)(
|
|
990
1008
|
IconButton_module_default.iconButton,
|
|
@@ -1082,7 +1100,7 @@ var LinkButton_default = LinkButton;
|
|
|
1082
1100
|
var import_classnames10 = __toESM(require_classnames());
|
|
1083
1101
|
|
|
1084
1102
|
// src/Modal/FocusTrap.tsx
|
|
1085
|
-
import { useEffect as
|
|
1103
|
+
import { useEffect as useEffect3, useRef } from "react";
|
|
1086
1104
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1087
1105
|
function queryFocusableAll(el) {
|
|
1088
1106
|
const selector = [
|
|
@@ -1114,7 +1132,7 @@ function FocusTrap({
|
|
|
1114
1132
|
}) {
|
|
1115
1133
|
const elRef = useRef(null);
|
|
1116
1134
|
const previouslyFocusedElRef = useRef(null);
|
|
1117
|
-
|
|
1135
|
+
useEffect3(() => {
|
|
1118
1136
|
const { current: element } = elRef;
|
|
1119
1137
|
const focusFirstChild = () => {
|
|
1120
1138
|
const withinIframe = window !== window.parent;
|
|
@@ -1148,9 +1166,9 @@ function FocusTrap({
|
|
|
1148
1166
|
}
|
|
1149
1167
|
|
|
1150
1168
|
// src/Modal/StopScroll.tsx
|
|
1151
|
-
import { useEffect as
|
|
1169
|
+
import { useEffect as useEffect4 } from "react";
|
|
1152
1170
|
function StopScroll(props) {
|
|
1153
|
-
|
|
1171
|
+
useEffect4(() => {
|
|
1154
1172
|
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
1155
1173
|
document.body.style.overflow = "hidden";
|
|
1156
1174
|
return () => {
|
|
@@ -1272,7 +1290,7 @@ Modal.displayName = "Modal";
|
|
|
1272
1290
|
|
|
1273
1291
|
// src/RadioButton/RadioButton.tsx
|
|
1274
1292
|
var import_classnames11 = __toESM(require_classnames());
|
|
1275
|
-
import { useState as
|
|
1293
|
+
import { useState as useState4 } from "react";
|
|
1276
1294
|
|
|
1277
1295
|
// css-module:./RadioButton.module.css#css-module
|
|
1278
1296
|
var RadioButton_module_default = { "radioBaseContainer": "_radioBaseContainer_6h2zg_1", "disabled": "_disabled_6h2zg_9", "cursorDisabled": "_cursorDisabled_6h2zg_13", "cursorEnabled": "_cursorEnabled_6h2zg_17", "smBase": "_smBase_6h2zg_21", "mdBase": "_mdBase_6h2zg_25", "radioStyleOverride": "_radioStyleOverride_6h2zg_29", "smOverride": "_smOverride_6h2zg_34", "mdOverride": "_mdOverride_6h2zg_39", "background": "_background_6h2zg_44", "sm": "_sm_6h2zg_21", "md": "_md_6h2zg_25", "neutralBorder": "_neutralBorder_6h2zg_61", "smCheckedBorder": "_smCheckedBorder_6h2zg_65", "mdCheckedBorder": "_mdCheckedBorder_6h2zg_69", "errorBorderColor": "_errorBorderColor_6h2zg_73", "borderColor": "_borderColor_6h2zg_77" };
|
|
@@ -1282,7 +1300,7 @@ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
|
1282
1300
|
var RadioButton = ({
|
|
1283
1301
|
checked = false,
|
|
1284
1302
|
"data-testid": dataTestId,
|
|
1285
|
-
disabled = false,
|
|
1303
|
+
disabled: disabledProp = false,
|
|
1286
1304
|
error = false,
|
|
1287
1305
|
id,
|
|
1288
1306
|
label,
|
|
@@ -1291,7 +1309,9 @@ var RadioButton = ({
|
|
|
1291
1309
|
size = "md",
|
|
1292
1310
|
value
|
|
1293
1311
|
}) => {
|
|
1294
|
-
const
|
|
1312
|
+
const isHydrated = useIsHydrated();
|
|
1313
|
+
const disabled = !isHydrated || disabledProp;
|
|
1314
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
1295
1315
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1296
1316
|
const sharedStyles = (0, import_classnames11.default)(RadioButton_module_default.background, RadioButton_module_default[size], {
|
|
1297
1317
|
[RadioButton_module_default.errorBorderColor]: error,
|
|
@@ -1365,7 +1385,7 @@ var RadioButton_default = RadioButton;
|
|
|
1365
1385
|
var import_classnames12 = __toESM(require_classnames());
|
|
1366
1386
|
import {
|
|
1367
1387
|
useId,
|
|
1368
|
-
useState as
|
|
1388
|
+
useState as useState5
|
|
1369
1389
|
} from "react";
|
|
1370
1390
|
|
|
1371
1391
|
// ../syntax-design-tokens/dist/js/index.js
|
|
@@ -1395,7 +1415,7 @@ var iconSize3 = {
|
|
|
1395
1415
|
function SelectList({
|
|
1396
1416
|
children,
|
|
1397
1417
|
"data-testid": dataTestId,
|
|
1398
|
-
disabled = false,
|
|
1418
|
+
disabled: disabledProp = false,
|
|
1399
1419
|
errorText,
|
|
1400
1420
|
helperText,
|
|
1401
1421
|
id,
|
|
@@ -1407,9 +1427,11 @@ function SelectList({
|
|
|
1407
1427
|
size = "md"
|
|
1408
1428
|
}) {
|
|
1409
1429
|
const reactId = useId();
|
|
1430
|
+
const isHydrated = useIsHydrated();
|
|
1431
|
+
const disabled = !isHydrated || disabledProp;
|
|
1410
1432
|
const selectId = id != null ? id : reactId;
|
|
1411
1433
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1412
|
-
const [isFocused, setIsFocused] =
|
|
1434
|
+
const [isFocused, setIsFocused] = useState5(false);
|
|
1413
1435
|
return /* @__PURE__ */ jsxs8(
|
|
1414
1436
|
"div",
|
|
1415
1437
|
{
|
|
@@ -1490,12 +1512,14 @@ var TapArea = forwardRef6(
|
|
|
1490
1512
|
children,
|
|
1491
1513
|
accessibilityLabel,
|
|
1492
1514
|
"data-testid": dataTestId,
|
|
1493
|
-
disabled = false,
|
|
1515
|
+
disabled: disabledProp = false,
|
|
1494
1516
|
fullWidth = true,
|
|
1495
1517
|
onClick,
|
|
1496
1518
|
rounding = "none",
|
|
1497
1519
|
tabIndex = 0
|
|
1498
1520
|
}, ref) => {
|
|
1521
|
+
const isHydrated = useIsHydrated();
|
|
1522
|
+
const disabled = !isHydrated || disabledProp;
|
|
1499
1523
|
const handleClick = (event) => !disabled ? onClick(event) : void 0;
|
|
1500
1524
|
const handleKeyDown = (event) => {
|
|
1501
1525
|
if (disabled)
|
|
@@ -1544,7 +1568,7 @@ import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
|
1544
1568
|
function TextField({
|
|
1545
1569
|
autoComplete,
|
|
1546
1570
|
"data-testid": dataTestId,
|
|
1547
|
-
disabled = false,
|
|
1571
|
+
disabled: disabledProp = false,
|
|
1548
1572
|
errorText = "",
|
|
1549
1573
|
helperText = "",
|
|
1550
1574
|
id,
|
|
@@ -1555,6 +1579,8 @@ function TextField({
|
|
|
1555
1579
|
type = "text",
|
|
1556
1580
|
value = ""
|
|
1557
1581
|
}) {
|
|
1582
|
+
const isHydrated = useIsHydrated();
|
|
1583
|
+
const disabled = !isHydrated || disabledProp;
|
|
1558
1584
|
const reactId = useId2();
|
|
1559
1585
|
const inputId = id != null ? id : reactId;
|
|
1560
1586
|
return /* @__PURE__ */ jsxs9(
|