@cambly/syntax-core 9.0.1 → 9.1.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 +27 -20
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +65 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
};
|
|
@@ -801,7 +812,7 @@ function useFocusVisible() {
|
|
|
801
812
|
}
|
|
802
813
|
|
|
803
814
|
// css-module:./Checkbox.module.css#css-module
|
|
804
|
-
var Checkbox_module_default = { "mainContainer": "
|
|
815
|
+
var Checkbox_module_default = { "mainContainer": "_mainContainer_an7al_1", "inputOverlay": "_inputOverlay_an7al_9", "checkbox": "_checkbox_an7al_17", "disabled": "_disabled_an7al_25", "cursorDisabled": "_cursorDisabled_an7al_29", "cursorEnabled": "_cursorEnabled_an7al_33", "uncheckedBox": "_uncheckedBox_an7al_37", "uncheckedBorder": "_uncheckedBorder_an7al_41", "uncheckedErrorBorder": "_uncheckedErrorBorder_an7al_45", "checkedBox": "_checkedBox_an7al_49", "checkedNonError": "_checkedNonError_an7al_53", "checkedError": "_checkedError_an7al_57", "sm": "_sm_an7al_61", "md": "_md_an7al_67" };
|
|
805
816
|
|
|
806
817
|
// css-module:../Focus.module.css#css-module
|
|
807
818
|
var Focus_module_default = { "accessibilityOutlineFocus": "_accessibilityOutlineFocus_1h8bq_1" };
|
|
@@ -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,19 +1001,20 @@ 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" };
|
|
991
1008
|
|
|
992
1009
|
// src/IconButton/IconButton.tsx
|
|
993
1010
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1011
|
+
"use client";
|
|
994
1012
|
var iconSize2 = {
|
|
995
1013
|
["sm"]: IconButton_module_default.smIcon,
|
|
996
1014
|
["md"]: IconButton_module_default.mdIcon,
|
|
997
1015
|
["lg"]: IconButton_module_default.lgIcon
|
|
998
1016
|
};
|
|
999
|
-
var IconButton = (0,
|
|
1017
|
+
var IconButton = (0, import_react7.forwardRef)(
|
|
1000
1018
|
({
|
|
1001
1019
|
accessibilityLabel,
|
|
1002
1020
|
color = "primary",
|
|
@@ -1007,6 +1025,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
1007
1025
|
tooltip,
|
|
1008
1026
|
onClick
|
|
1009
1027
|
}, ref) => {
|
|
1028
|
+
const isHydrated = useIsHydrated();
|
|
1010
1029
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1011
1030
|
"button",
|
|
1012
1031
|
{
|
|
@@ -1014,7 +1033,7 @@ var IconButton = (0, import_react6.forwardRef)(
|
|
|
1014
1033
|
"data-testid": dataTestId,
|
|
1015
1034
|
type: "button",
|
|
1016
1035
|
title: tooltip,
|
|
1017
|
-
disabled,
|
|
1036
|
+
disabled: !isHydrated || disabled,
|
|
1018
1037
|
onClick,
|
|
1019
1038
|
className: (0, import_classnames8.default)(
|
|
1020
1039
|
IconButton_module_default.iconButton,
|
|
@@ -1036,7 +1055,7 @@ IconButton.displayName = "IconButton";
|
|
|
1036
1055
|
var IconButton_default = IconButton;
|
|
1037
1056
|
|
|
1038
1057
|
// src/LinkButton/LinkButton.tsx
|
|
1039
|
-
var
|
|
1058
|
+
var import_react8 = require("react");
|
|
1040
1059
|
var import_classnames9 = __toESM(require_classnames());
|
|
1041
1060
|
|
|
1042
1061
|
// css-module:../Button/Button.module.css#css-module
|
|
@@ -1047,7 +1066,7 @@ var LinkButton_module_default = { "linkButton": "_linkButton_1qjrb_1", "fitConte
|
|
|
1047
1066
|
|
|
1048
1067
|
// src/LinkButton/LinkButton.tsx
|
|
1049
1068
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1050
|
-
var LinkButton = (0,
|
|
1069
|
+
var LinkButton = (0, import_react8.forwardRef)(
|
|
1051
1070
|
({
|
|
1052
1071
|
text,
|
|
1053
1072
|
href,
|
|
@@ -1112,7 +1131,7 @@ var LinkButton_default = LinkButton;
|
|
|
1112
1131
|
var import_classnames10 = __toESM(require_classnames());
|
|
1113
1132
|
|
|
1114
1133
|
// src/Modal/FocusTrap.tsx
|
|
1115
|
-
var
|
|
1134
|
+
var import_react9 = require("react");
|
|
1116
1135
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1117
1136
|
function queryFocusableAll(el) {
|
|
1118
1137
|
const selector = [
|
|
@@ -1142,9 +1161,9 @@ var focusElement = (el) => {
|
|
|
1142
1161
|
function FocusTrap({
|
|
1143
1162
|
children
|
|
1144
1163
|
}) {
|
|
1145
|
-
const elRef = (0,
|
|
1146
|
-
const previouslyFocusedElRef = (0,
|
|
1147
|
-
(0,
|
|
1164
|
+
const elRef = (0, import_react9.useRef)(null);
|
|
1165
|
+
const previouslyFocusedElRef = (0, import_react9.useRef)(null);
|
|
1166
|
+
(0, import_react9.useEffect)(() => {
|
|
1148
1167
|
const { current: element } = elRef;
|
|
1149
1168
|
const focusFirstChild = () => {
|
|
1150
1169
|
const withinIframe = window !== window.parent;
|
|
@@ -1178,9 +1197,9 @@ function FocusTrap({
|
|
|
1178
1197
|
}
|
|
1179
1198
|
|
|
1180
1199
|
// src/Modal/StopScroll.tsx
|
|
1181
|
-
var
|
|
1200
|
+
var import_react10 = require("react");
|
|
1182
1201
|
function StopScroll(props) {
|
|
1183
|
-
(0,
|
|
1202
|
+
(0, import_react10.useEffect)(() => {
|
|
1184
1203
|
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
1185
1204
|
document.body.style.overflow = "hidden";
|
|
1186
1205
|
return () => {
|
|
@@ -1301,7 +1320,7 @@ function Modal({
|
|
|
1301
1320
|
Modal.displayName = "Modal";
|
|
1302
1321
|
|
|
1303
1322
|
// src/RadioButton/RadioButton.tsx
|
|
1304
|
-
var
|
|
1323
|
+
var import_react11 = require("react");
|
|
1305
1324
|
var import_classnames11 = __toESM(require_classnames());
|
|
1306
1325
|
|
|
1307
1326
|
// css-module:./RadioButton.module.css#css-module
|
|
@@ -1312,7 +1331,7 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
|
1312
1331
|
var RadioButton = ({
|
|
1313
1332
|
checked = false,
|
|
1314
1333
|
"data-testid": dataTestId,
|
|
1315
|
-
disabled = false,
|
|
1334
|
+
disabled: disabledProp = false,
|
|
1316
1335
|
error = false,
|
|
1317
1336
|
id,
|
|
1318
1337
|
label,
|
|
@@ -1321,7 +1340,9 @@ var RadioButton = ({
|
|
|
1321
1340
|
size = "md",
|
|
1322
1341
|
value
|
|
1323
1342
|
}) => {
|
|
1324
|
-
const
|
|
1343
|
+
const isHydrated = useIsHydrated();
|
|
1344
|
+
const disabled = !isHydrated || disabledProp;
|
|
1345
|
+
const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
|
|
1325
1346
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1326
1347
|
const sharedStyles = (0, import_classnames11.default)(RadioButton_module_default.background, RadioButton_module_default[size], {
|
|
1327
1348
|
[RadioButton_module_default.errorBorderColor]: error,
|
|
@@ -1392,7 +1413,7 @@ var RadioButton = ({
|
|
|
1392
1413
|
var RadioButton_default = RadioButton;
|
|
1393
1414
|
|
|
1394
1415
|
// src/SelectList/SelectList.tsx
|
|
1395
|
-
var
|
|
1416
|
+
var import_react12 = require("react");
|
|
1396
1417
|
var import_classnames12 = __toESM(require_classnames());
|
|
1397
1418
|
|
|
1398
1419
|
// ../syntax-design-tokens/dist/js/index.js
|
|
@@ -1422,7 +1443,7 @@ var iconSize3 = {
|
|
|
1422
1443
|
function SelectList({
|
|
1423
1444
|
children,
|
|
1424
1445
|
"data-testid": dataTestId,
|
|
1425
|
-
disabled = false,
|
|
1446
|
+
disabled: disabledProp = false,
|
|
1426
1447
|
errorText,
|
|
1427
1448
|
helperText,
|
|
1428
1449
|
id,
|
|
@@ -1433,10 +1454,12 @@ function SelectList({
|
|
|
1433
1454
|
selectedValue = "",
|
|
1434
1455
|
size = "md"
|
|
1435
1456
|
}) {
|
|
1436
|
-
const reactId = (0,
|
|
1457
|
+
const reactId = (0, import_react12.useId)();
|
|
1458
|
+
const isHydrated = useIsHydrated();
|
|
1459
|
+
const disabled = !isHydrated || disabledProp;
|
|
1437
1460
|
const selectId = id != null ? id : reactId;
|
|
1438
1461
|
const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
|
|
1439
|
-
const [isFocused, setIsFocused] = (0,
|
|
1462
|
+
const [isFocused, setIsFocused] = (0, import_react12.useState)(false);
|
|
1440
1463
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1441
1464
|
"div",
|
|
1442
1465
|
{
|
|
@@ -1504,7 +1527,7 @@ function SelectList({
|
|
|
1504
1527
|
SelectList.Option = SelectOption_default;
|
|
1505
1528
|
|
|
1506
1529
|
// src/TapArea/TapArea.tsx
|
|
1507
|
-
var
|
|
1530
|
+
var import_react13 = require("react");
|
|
1508
1531
|
var import_classnames13 = __toESM(require_classnames());
|
|
1509
1532
|
|
|
1510
1533
|
// css-module:./TapArea.module.css#css-module
|
|
@@ -1512,17 +1535,19 @@ var TapArea_module_default = { "tapArea": "_tapArea_1rlyl_1", "fullWidth": "_ful
|
|
|
1512
1535
|
|
|
1513
1536
|
// src/TapArea/TapArea.tsx
|
|
1514
1537
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1515
|
-
var TapArea = (0,
|
|
1538
|
+
var TapArea = (0, import_react13.forwardRef)(
|
|
1516
1539
|
({
|
|
1517
1540
|
children,
|
|
1518
1541
|
accessibilityLabel,
|
|
1519
1542
|
"data-testid": dataTestId,
|
|
1520
|
-
disabled = false,
|
|
1543
|
+
disabled: disabledProp = false,
|
|
1521
1544
|
fullWidth = true,
|
|
1522
1545
|
onClick,
|
|
1523
1546
|
rounding = "none",
|
|
1524
1547
|
tabIndex = 0
|
|
1525
1548
|
}, ref) => {
|
|
1549
|
+
const isHydrated = useIsHydrated();
|
|
1550
|
+
const disabled = !isHydrated || disabledProp;
|
|
1526
1551
|
const handleClick = (event) => !disabled ? onClick(event) : void 0;
|
|
1527
1552
|
const handleKeyDown = (event) => {
|
|
1528
1553
|
if (disabled)
|
|
@@ -1558,7 +1583,7 @@ TapArea.displayName = "TapArea";
|
|
|
1558
1583
|
var TapArea_default = TapArea;
|
|
1559
1584
|
|
|
1560
1585
|
// src/TextField/TextField.tsx
|
|
1561
|
-
var
|
|
1586
|
+
var import_react14 = require("react");
|
|
1562
1587
|
var import_classnames14 = __toESM(require_classnames());
|
|
1563
1588
|
|
|
1564
1589
|
// css-module:./TextField.module.css#css-module
|
|
@@ -1569,7 +1594,7 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
1569
1594
|
function TextField({
|
|
1570
1595
|
autoComplete,
|
|
1571
1596
|
"data-testid": dataTestId,
|
|
1572
|
-
disabled = false,
|
|
1597
|
+
disabled: disabledProp = false,
|
|
1573
1598
|
errorText = "",
|
|
1574
1599
|
helperText = "",
|
|
1575
1600
|
id,
|
|
@@ -1580,7 +1605,9 @@ function TextField({
|
|
|
1580
1605
|
type = "text",
|
|
1581
1606
|
value = ""
|
|
1582
1607
|
}) {
|
|
1583
|
-
const
|
|
1608
|
+
const isHydrated = useIsHydrated();
|
|
1609
|
+
const disabled = !isHydrated || disabledProp;
|
|
1610
|
+
const reactId = (0, import_react14.useId)();
|
|
1584
1611
|
const inputId = id != null ? id : reactId;
|
|
1585
1612
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1586
1613
|
Box_default,
|