@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.js
CHANGED
|
@@ -486,7 +486,7 @@ var Badge = ({
|
|
|
486
486
|
var Badge_default = Badge;
|
|
487
487
|
|
|
488
488
|
// src/Button/Button.tsx
|
|
489
|
-
var
|
|
489
|
+
var import_react3 = require("react");
|
|
490
490
|
var import_classnames4 = __toESM(require_classnames());
|
|
491
491
|
|
|
492
492
|
// css-module:./colors.module.css#css-module
|
|
@@ -575,9 +575,19 @@ var loadingIconSize_default = loadingIconSize;
|
|
|
575
575
|
// css-module:./Button.module.css#css-module
|
|
576
576
|
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" };
|
|
577
577
|
|
|
578
|
+
// src/useIsHydrated.tsx
|
|
579
|
+
var import_react2 = require("react");
|
|
580
|
+
function useIsHydrated() {
|
|
581
|
+
const [isHydrated, setIsHydrated] = (0, import_react2.useState)(false);
|
|
582
|
+
(0, import_react2.useEffect)(() => {
|
|
583
|
+
setIsHydrated(true);
|
|
584
|
+
}, []);
|
|
585
|
+
return isHydrated;
|
|
586
|
+
}
|
|
587
|
+
|
|
578
588
|
// src/Button/Button.tsx
|
|
579
589
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
580
|
-
var Button = (0,
|
|
590
|
+
var Button = (0, import_react3.forwardRef)(
|
|
581
591
|
({
|
|
582
592
|
"data-testid": dataTestId,
|
|
583
593
|
text,
|
|
@@ -594,6 +604,7 @@ var Button = (0, import_react2.forwardRef)(
|
|
|
594
604
|
tooltip,
|
|
595
605
|
type = "button"
|
|
596
606
|
}, ref) => {
|
|
607
|
+
const isHydrated = useIsHydrated();
|
|
597
608
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
598
609
|
"button",
|
|
599
610
|
{
|
|
@@ -602,7 +613,7 @@ var Button = (0, import_react2.forwardRef)(
|
|
|
602
613
|
"aria-label": accessibilityLabel,
|
|
603
614
|
type,
|
|
604
615
|
title: tooltip,
|
|
605
|
-
disabled: disabled || loading,
|
|
616
|
+
disabled: !isHydrated || disabled || loading,
|
|
606
617
|
onClick,
|
|
607
618
|
className: (0, import_classnames4.default)(
|
|
608
619
|
Button_module_default2.button,
|
|
@@ -707,11 +718,11 @@ function Card({
|
|
|
707
718
|
}
|
|
708
719
|
|
|
709
720
|
// src/Checkbox/Checkbox.tsx
|
|
710
|
-
var
|
|
721
|
+
var import_react5 = require("react");
|
|
711
722
|
var import_classnames6 = __toESM(require_classnames());
|
|
712
723
|
|
|
713
724
|
// src/useFocusVisible.tsx
|
|
714
|
-
var
|
|
725
|
+
var import_react4 = require("react");
|
|
715
726
|
var hasSetupGlobalListeners = false;
|
|
716
727
|
var currentModality = null;
|
|
717
728
|
var changeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -787,8 +798,8 @@ function setupGlobalFocusEvents() {
|
|
|
787
798
|
}
|
|
788
799
|
function useFocusVisible() {
|
|
789
800
|
setupGlobalFocusEvents();
|
|
790
|
-
const [isFocusVisibleState, setFocusVisible] = (0,
|
|
791
|
-
(0,
|
|
801
|
+
const [isFocusVisibleState, setFocusVisible] = (0, import_react4.useState)(isFocusVisible());
|
|
802
|
+
(0, import_react4.useEffect)(() => {
|
|
792
803
|
const handler = () => {
|
|
793
804
|
setFocusVisible(isFocusVisible());
|
|
794
805
|
};
|
|
@@ -819,13 +830,15 @@ var iconWidth = {
|
|
|
819
830
|
var Checkbox = ({
|
|
820
831
|
checked = false,
|
|
821
832
|
"data-testid": dataTestId,
|
|
822
|
-
disabled = false,
|
|
833
|
+
disabled: disabledProp = false,
|
|
823
834
|
size = "md",
|
|
824
835
|
label,
|
|
825
836
|
error = false,
|
|
826
837
|
onChange
|
|
827
838
|
}) => {
|
|
828
|
-
const
|
|
839
|
+
const isHydrated = useIsHydrated();
|
|
840
|
+
const disabled = !isHydrated || disabledProp;
|
|
841
|
+
const [isFocused, setIsFocused] = (0, import_react5.useState)(false);
|
|
829
842
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
830
843
|
const checkboxStyling = (0, import_classnames6.default)(Checkbox_module_default.checkbox, Checkbox_module_default[size]);
|
|
831
844
|
const uncheckedStyling = (0, import_classnames6.default)(checkboxStyling, Checkbox_module_default.uncheckedBox, {
|
|
@@ -892,15 +905,15 @@ var Checkbox = ({
|
|
|
892
905
|
var Checkbox_default = Checkbox;
|
|
893
906
|
|
|
894
907
|
// src/Chip/Chip.tsx
|
|
895
|
-
var
|
|
908
|
+
var import_react6 = require("react");
|
|
896
909
|
var import_classnames7 = __toESM(require_classnames());
|
|
897
910
|
|
|
898
911
|
// css-module:./Chip.module.css#css-module
|
|
899
|
-
var Chip_module_default = { "chip": "
|
|
912
|
+
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" };
|
|
900
913
|
|
|
901
914
|
// src/Chip/Chip.tsx
|
|
902
915
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
903
|
-
var Chip = (0,
|
|
916
|
+
var Chip = (0, import_react6.forwardRef)(
|
|
904
917
|
({
|
|
905
918
|
selected = false,
|
|
906
919
|
"data-testid": dataTestId,
|
|
@@ -909,8 +922,11 @@ var Chip = (0, import_react5.forwardRef)(
|
|
|
909
922
|
onChange,
|
|
910
923
|
icon: Icon
|
|
911
924
|
}, ref) => {
|
|
925
|
+
const isHydrated = useIsHydrated();
|
|
926
|
+
const disabled = !isHydrated;
|
|
912
927
|
const chipStyles = (0, import_classnames7.default)(Chip_module_default.chip, Chip_module_default[size], {
|
|
913
|
-
[Chip_module_default.selectedChip]: selected
|
|
928
|
+
[Chip_module_default.selectedChip]: selected,
|
|
929
|
+
[Chip_module_default.disabled]: disabled
|
|
914
930
|
});
|
|
915
931
|
const iconStyles = (0, import_classnames7.default)(Chip_module_default.icon, {
|
|
916
932
|
[Chip_module_default.selectedIcon]: selected
|
|
@@ -923,6 +939,7 @@ var Chip = (0, import_react5.forwardRef)(
|
|
|
923
939
|
"button",
|
|
924
940
|
{
|
|
925
941
|
className: chipStyles,
|
|
942
|
+
disabled,
|
|
926
943
|
"data-testid": dataTestId,
|
|
927
944
|
ref,
|
|
928
945
|
type: "button",
|
|
@@ -984,7 +1001,7 @@ var Heading_default = Heading;
|
|
|
984
1001
|
|
|
985
1002
|
// src/IconButton/IconButton.tsx
|
|
986
1003
|
var import_classnames8 = __toESM(require_classnames());
|
|
987
|
-
var
|
|
1004
|
+
var import_react7 = require("react");
|
|
988
1005
|
|
|
989
1006
|
// css-module:./IconButton.module.css#css-module
|
|
990
1007
|
var IconButton_module_default = { "iconButton": "_iconButton_4e8qe_1", "sm": "_sm_4e8qe_46", "md": "_md_4e8qe_51", "lg": "_lg_4e8qe_56", "smIcon": "_smIcon_4e8qe_61", "mdIcon": "_mdIcon_4e8qe_68", "lgIcon": "_lgIcon_4e8qe_75", "secondaryBorder": "_secondaryBorder_4e8qe_82", "secondaryDestructiveBorder": "_secondaryDestructiveBorder_4e8qe_86" };
|
|
@@ -996,7 +1013,7 @@ var iconSize2 = {
|
|
|
996
1013
|
["md"]: IconButton_module_default.mdIcon,
|
|
997
1014
|
["lg"]: IconButton_module_default.lgIcon
|
|
998
1015
|
};
|
|
999
|
-
var IconButton = (0,
|
|
1016
|
+
var IconButton = (0, import_react7.forwardRef)(
|
|
1000
1017
|
({
|
|
1001
1018
|
accessibilityLabel,
|
|
1002
1019
|
color = "primary",
|
|
@@ -1007,6 +1024,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
1007
1024
|
tooltip,
|
|
1008
1025
|
onClick
|
|
1009
1026
|
}, ref) => {
|
|
1027
|
+
const isHydrated = useIsHydrated();
|
|
1010
1028
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1011
1029
|
"button",
|
|
1012
1030
|
{
|
|
@@ -1014,7 +1032,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
1014
1032
|
"data-testid": dataTestId,
|
|
1015
1033
|
type: "button",
|
|
1016
1034
|
title: tooltip,
|
|
1017
|
-
disabled,
|
|
1035
|
+
disabled: !isHydrated || disabled,
|
|
1018
1036
|
onClick,
|
|
1019
1037
|
className: (0, import_classnames8.default)(
|
|
1020
1038
|
IconButton_module_default.iconButton,
|
|
@@ -1036,7 +1054,7 @@ IconButton.displayName = "IconButton";
|
|
|
1036
1054
|
var IconButton_default = IconButton;
|
|
1037
1055
|
|
|
1038
1056
|
// src/LinkButton/LinkButton.tsx
|
|
1039
|
-
var
|
|
1057
|
+
var import_react8 = require("react");
|
|
1040
1058
|
var import_classnames9 = __toESM(require_classnames());
|
|
1041
1059
|
|
|
1042
1060
|
// css-module:../Button/Button.module.css#css-module
|
|
@@ -1047,7 +1065,7 @@ var LinkButton_module_default = { "linkButton": "_linkButton_1qjrb_1", "fitConte
|
|
|
1047
1065
|
|
|
1048
1066
|
// src/LinkButton/LinkButton.tsx
|
|
1049
1067
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1050
|
-
var LinkButton = (0,
|
|
1068
|
+
var LinkButton = (0, import_react8.forwardRef)(
|
|
1051
1069
|
({
|
|
1052
1070
|
text,
|
|
1053
1071
|
href,
|
|
@@ -1112,7 +1130,7 @@ var LinkButton_default = LinkButton;
|
|
|
1112
1130
|
var import_classnames10 = __toESM(require_classnames());
|
|
1113
1131
|
|
|
1114
1132
|
// src/Modal/FocusTrap.tsx
|
|
1115
|
-
var
|
|
1133
|
+
var import_react9 = require("react");
|
|
1116
1134
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1117
1135
|
function queryFocusableAll(el) {
|
|
1118
1136
|
const selector = [
|
|
@@ -1142,9 +1160,9 @@ var focusElement = (el) => {
|
|
|
1142
1160
|
function FocusTrap({
|
|
1143
1161
|
children
|
|
1144
1162
|
}) {
|
|
1145
|
-
const elRef = (0,
|
|
1146
|
-
const previouslyFocusedElRef = (0,
|
|
1147
|
-
(0,
|
|
1163
|
+
const elRef = (0, import_react9.useRef)(null);
|
|
1164
|
+
const previouslyFocusedElRef = (0, import_react9.useRef)(null);
|
|
1165
|
+
(0, import_react9.useEffect)(() => {
|
|
1148
1166
|
const { current: element } = elRef;
|
|
1149
1167
|
const focusFirstChild = () => {
|
|
1150
1168
|
const withinIframe = window !== window.parent;
|
|
@@ -1178,9 +1196,9 @@ function FocusTrap({
|
|
|
1178
1196
|
}
|
|
1179
1197
|
|
|
1180
1198
|
// src/Modal/StopScroll.tsx
|
|
1181
|
-
var
|
|
1199
|
+
var import_react10 = require("react");
|
|
1182
1200
|
function StopScroll(props) {
|
|
1183
|
-
(0,
|
|
1201
|
+
(0, import_react10.useEffect)(() => {
|
|
1184
1202
|
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
1185
1203
|
document.body.style.overflow = "hidden";
|
|
1186
1204
|
return () => {
|
|
@@ -1301,7 +1319,7 @@ function Modal({
|
|
|
1301
1319
|
Modal.displayName = "Modal";
|
|
1302
1320
|
|
|
1303
1321
|
// src/RadioButton/RadioButton.tsx
|
|
1304
|
-
var
|
|
1322
|
+
var import_react11 = require("react");
|
|
1305
1323
|
var import_classnames11 = __toESM(require_classnames());
|
|
1306
1324
|
|
|
1307
1325
|
// css-module:./RadioButton.module.css#css-module
|
|
@@ -1312,7 +1330,7 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
|
1312
1330
|
var RadioButton = ({
|
|
1313
1331
|
checked = false,
|
|
1314
1332
|
"data-testid": dataTestId,
|
|
1315
|
-
disabled = false,
|
|
1333
|
+
disabled: disabledProp = false,
|
|
1316
1334
|
error = false,
|
|
1317
1335
|
id,
|
|
1318
1336
|
label,
|
|
@@ -1321,7 +1339,9 @@ var RadioButton = ({
|
|
|
1321
1339
|
size = "md",
|
|
1322
1340
|
value
|
|
1323
1341
|
}) => {
|
|
1324
|
-
const
|
|
1342
|
+
const isHydrated = useIsHydrated();
|
|
1343
|
+
const disabled = !isHydrated || disabledProp;
|
|
1344
|
+
const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
|
|
1325
1345
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1326
1346
|
const sharedStyles = (0, import_classnames11.default)(RadioButton_module_default.background, RadioButton_module_default[size], {
|
|
1327
1347
|
[RadioButton_module_default.errorBorderColor]: error,
|
|
@@ -1392,7 +1412,7 @@ var RadioButton = ({
|
|
|
1392
1412
|
var RadioButton_default = RadioButton;
|
|
1393
1413
|
|
|
1394
1414
|
// src/SelectList/SelectList.tsx
|
|
1395
|
-
var
|
|
1415
|
+
var import_react12 = require("react");
|
|
1396
1416
|
var import_classnames12 = __toESM(require_classnames());
|
|
1397
1417
|
|
|
1398
1418
|
// ../syntax-design-tokens/dist/js/index.js
|
|
@@ -1422,7 +1442,7 @@ var iconSize3 = {
|
|
|
1422
1442
|
function SelectList({
|
|
1423
1443
|
children,
|
|
1424
1444
|
"data-testid": dataTestId,
|
|
1425
|
-
disabled = false,
|
|
1445
|
+
disabled: disabledProp = false,
|
|
1426
1446
|
errorText,
|
|
1427
1447
|
helperText,
|
|
1428
1448
|
id,
|
|
@@ -1433,10 +1453,12 @@ function SelectList({
|
|
|
1433
1453
|
selectedValue = "",
|
|
1434
1454
|
size = "md"
|
|
1435
1455
|
}) {
|
|
1436
|
-
const reactId = (0,
|
|
1456
|
+
const reactId = (0, import_react12.useId)();
|
|
1457
|
+
const isHydrated = useIsHydrated();
|
|
1458
|
+
const disabled = !isHydrated || disabledProp;
|
|
1437
1459
|
const selectId = id != null ? id : reactId;
|
|
1438
1460
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1439
|
-
const [isFocused, setIsFocused] = (0,
|
|
1461
|
+
const [isFocused, setIsFocused] = (0, import_react12.useState)(false);
|
|
1440
1462
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1441
1463
|
"div",
|
|
1442
1464
|
{
|
|
@@ -1504,7 +1526,7 @@ function SelectList({
|
|
|
1504
1526
|
SelectList.Option = SelectOption_default;
|
|
1505
1527
|
|
|
1506
1528
|
// src/TapArea/TapArea.tsx
|
|
1507
|
-
var
|
|
1529
|
+
var import_react13 = require("react");
|
|
1508
1530
|
var import_classnames13 = __toESM(require_classnames());
|
|
1509
1531
|
|
|
1510
1532
|
// css-module:./TapArea.module.css#css-module
|
|
@@ -1512,17 +1534,19 @@ var TapArea_module_default = { "tapArea": "_tapArea_1rlyl_1", "fullWidth": "_ful
|
|
|
1512
1534
|
|
|
1513
1535
|
// src/TapArea/TapArea.tsx
|
|
1514
1536
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1515
|
-
var TapArea = (0,
|
|
1537
|
+
var TapArea = (0, import_react13.forwardRef)(
|
|
1516
1538
|
({
|
|
1517
1539
|
children,
|
|
1518
1540
|
accessibilityLabel,
|
|
1519
1541
|
"data-testid": dataTestId,
|
|
1520
|
-
disabled = false,
|
|
1542
|
+
disabled: disabledProp = false,
|
|
1521
1543
|
fullWidth = true,
|
|
1522
1544
|
onClick,
|
|
1523
1545
|
rounding = "none",
|
|
1524
1546
|
tabIndex = 0
|
|
1525
1547
|
}, ref) => {
|
|
1548
|
+
const isHydrated = useIsHydrated();
|
|
1549
|
+
const disabled = !isHydrated || disabledProp;
|
|
1526
1550
|
const handleClick = (event) => !disabled ? onClick(event) : void 0;
|
|
1527
1551
|
const handleKeyDown = (event) => {
|
|
1528
1552
|
if (disabled)
|
|
@@ -1558,7 +1582,7 @@ TapArea.displayName = "TapArea";
|
|
|
1558
1582
|
var TapArea_default = TapArea;
|
|
1559
1583
|
|
|
1560
1584
|
// src/TextField/TextField.tsx
|
|
1561
|
-
var
|
|
1585
|
+
var import_react14 = require("react");
|
|
1562
1586
|
var import_classnames14 = __toESM(require_classnames());
|
|
1563
1587
|
|
|
1564
1588
|
// css-module:./TextField.module.css#css-module
|
|
@@ -1569,7 +1593,7 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
1569
1593
|
function TextField({
|
|
1570
1594
|
autoComplete,
|
|
1571
1595
|
"data-testid": dataTestId,
|
|
1572
|
-
disabled = false,
|
|
1596
|
+
disabled: disabledProp = false,
|
|
1573
1597
|
errorText = "",
|
|
1574
1598
|
helperText = "",
|
|
1575
1599
|
id,
|
|
@@ -1580,7 +1604,9 @@ function TextField({
|
|
|
1580
1604
|
type = "text",
|
|
1581
1605
|
value = ""
|
|
1582
1606
|
}) {
|
|
1583
|
-
const
|
|
1607
|
+
const isHydrated = useIsHydrated();
|
|
1608
|
+
const disabled = !isHydrated || disabledProp;
|
|
1609
|
+
const reactId = (0, import_react14.useId)();
|
|
1584
1610
|
const inputId = id != null ? id : reactId;
|
|
1585
1611
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1586
1612
|
Box_default,
|