@cambly/syntax-core 4.8.1 → 4.8.2

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.js CHANGED
@@ -401,6 +401,9 @@ function foregroundColor(color) {
401
401
  }
402
402
  }
403
403
 
404
+ // src/Button/Button.tsx
405
+ var import_react2 = require("react");
406
+
404
407
  // css-module:./Button.module.css#css-module
405
408
  var Button_module_default = { "button": "_button_13egy_1", "buttonGap": "_buttonGap_13egy_9", "fullWidth": "_fullWidth_13egy_50", "sm": "_sm_13egy_54", "md": "_md_13egy_61", "lg": "_lg_13egy_68", "icon": "_icon_13egy_75", "smIcon": "_smIcon_13egy_79", "mdIcon": "_mdIcon_13egy_86", "lgIcon": "_lgIcon_13egy_93", "textContainer": "_textContainer_13egy_100", "secondaryBorder": "_secondaryBorder_13egy_105", "secondaryDestructiveBorder": "_secondaryDestructiveBorder_13egy_109", "loading": "_loading_13egy_123", "syntaxButtonLoadingRotate": "_syntaxButtonLoadingRotate_13egy_1", "loadingCircle": "_loadingCircle_13egy_127", "buttonText": "_buttonText_13egy_135", "buttonTextSmall": "_buttonTextSmall_13egy_142", "buttonTextMedium": "_buttonTextMedium_13egy_146", "buttonTextLarge": "_buttonTextLarge_13egy_150" };
406
409
 
@@ -422,68 +425,72 @@ var iconSize = {
422
425
  ["md"]: Button_module_default.mdIcon,
423
426
  ["lg"]: Button_module_default.lgIcon
424
427
  };
425
- var Button = ({
426
- text,
427
- loadingText,
428
- color = "primary",
429
- size = "md",
430
- accessibilityLabel,
431
- disabled = false,
432
- loading = false,
433
- fullWidth = false,
434
- startIcon: StartIcon,
435
- endIcon: EndIcon,
436
- onClick,
437
- tooltip
438
- }) => {
439
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
440
- "button",
441
- {
442
- "aria-label": accessibilityLabel,
443
- type: "button",
444
- title: tooltip,
445
- disabled: disabled || loading,
446
- onClick,
447
- className: (0, import_classnames3.default)(
448
- Button_module_default.button,
449
- foregroundColor(color),
450
- backgroundColor(color),
451
- Button_module_default[size],
452
- {
453
- [Button_module_default.fullWidth]: fullWidth,
454
- [Button_module_default.buttonGap]: size === "lg" || size === "md",
455
- [Button_module_default.secondaryBorder]: color === "secondary",
456
- [Button_module_default.secondaryDestructiveBorder]: color === "destructive-secondary"
457
- }
458
- ),
459
- children: [
460
- !loading && StartIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StartIcon, { className: (0, import_classnames3.default)(Button_module_default.icon, iconSize[size]) }),
461
- (loading && loadingText || !loading && text) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Button_module_default.textContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_classnames3.default)(Button_module_default.buttonText, textVariant[size]), children: loading ? loadingText : text }) }),
462
- !loading && EndIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(EndIcon, { className: (0, import_classnames3.default)(Button_module_default.icon, iconSize[size]) }),
463
- loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
464
- "svg",
428
+ var Button = (0, import_react2.forwardRef)(
429
+ ({
430
+ text,
431
+ loadingText,
432
+ color = "primary",
433
+ size = "md",
434
+ accessibilityLabel,
435
+ disabled = false,
436
+ loading = false,
437
+ fullWidth = false,
438
+ startIcon: StartIcon,
439
+ endIcon: EndIcon,
440
+ onClick,
441
+ tooltip
442
+ }, ref) => {
443
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
444
+ "button",
445
+ {
446
+ ref,
447
+ "aria-label": accessibilityLabel,
448
+ type: "button",
449
+ title: tooltip,
450
+ disabled: disabled || loading,
451
+ onClick,
452
+ className: (0, import_classnames3.default)(
453
+ Button_module_default.button,
454
+ foregroundColor(color),
455
+ backgroundColor(color),
456
+ Button_module_default[size],
465
457
  {
466
- className: (0, import_classnames3.default)(Button_module_default.loading, foregroundColor(color)),
467
- viewBox: "22 22 44 44",
468
- width: loadingIconSize[size],
469
- height: loadingIconSize[size],
470
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
471
- "circle",
472
- {
473
- className: Button_module_default.loadingCircle,
474
- cx: "44",
475
- cy: "44",
476
- r: "20.2",
477
- fill: "none",
478
- strokeWidth: "3.6"
479
- }
480
- )
458
+ [Button_module_default.fullWidth]: fullWidth,
459
+ [Button_module_default.buttonGap]: size === "lg" || size === "md",
460
+ [Button_module_default.secondaryBorder]: color === "secondary",
461
+ [Button_module_default.secondaryDestructiveBorder]: color === "destructive-secondary"
481
462
  }
482
- )
483
- ]
484
- }
485
- );
486
- };
463
+ ),
464
+ children: [
465
+ !loading && StartIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StartIcon, { className: (0, import_classnames3.default)(Button_module_default.icon, iconSize[size]) }),
466
+ (loading && loadingText || !loading && text) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Button_module_default.textContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_classnames3.default)(Button_module_default.buttonText, textVariant[size]), children: loading ? loadingText : text }) }),
467
+ !loading && EndIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(EndIcon, { className: (0, import_classnames3.default)(Button_module_default.icon, iconSize[size]) }),
468
+ loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
469
+ "svg",
470
+ {
471
+ className: (0, import_classnames3.default)(Button_module_default.loading, foregroundColor(color)),
472
+ viewBox: "22 22 44 44",
473
+ width: loadingIconSize[size],
474
+ height: loadingIconSize[size],
475
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
476
+ "circle",
477
+ {
478
+ className: Button_module_default.loadingCircle,
479
+ cx: "44",
480
+ cy: "44",
481
+ r: "20.2",
482
+ fill: "none",
483
+ strokeWidth: "3.6"
484
+ }
485
+ )
486
+ }
487
+ )
488
+ ]
489
+ }
490
+ );
491
+ }
492
+ );
493
+ Button.displayName = "Button";
487
494
  var Button_default = Button;
488
495
 
489
496
  // css-module:./ButtonGroup.module.css#css-module
@@ -605,6 +612,7 @@ var Heading_default = Heading;
605
612
 
606
613
  // src/IconButton/IconButton.tsx
607
614
  var import_classnames6 = __toESM(require_classnames());
615
+ var import_react3 = require("react");
608
616
 
609
617
  // css-module:./IconButton.module.css#css-module
610
618
  var IconButton_module_default = { "iconButton": "_iconButton_dzhn0_1", "sm": "_sm_dzhn0_46", "md": "_md_dzhn0_51", "lg": "_lg_dzhn0_56", "smIcon": "_smIcon_dzhn0_61", "mdIcon": "_mdIcon_dzhn0_68", "lgIcon": "_lgIcon_dzhn0_75" };
@@ -616,41 +624,45 @@ var iconSize2 = {
616
624
  ["md"]: IconButton_module_default.mdIcon,
617
625
  ["lg"]: IconButton_module_default.lgIcon
618
626
  };
619
- var IconButton = ({
620
- accessibilityLabel,
621
- color = "primary",
622
- disabled = false,
623
- icon: Icon,
624
- size = "md",
625
- tooltip,
626
- onClick
627
- }) => {
628
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
629
- "button",
630
- {
631
- "aria-label": accessibilityLabel,
632
- type: "button",
633
- title: tooltip,
634
- disabled,
635
- onClick,
636
- className: (0, import_classnames6.default)(
637
- IconButton_module_default.iconButton,
638
- foregroundColor(color),
639
- backgroundColor(color),
640
- IconButton_module_default[size]
641
- ),
642
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: iconSize2[size] })
643
- }
644
- );
645
- };
627
+ var IconButton = (0, import_react3.forwardRef)(
628
+ ({
629
+ accessibilityLabel,
630
+ color = "primary",
631
+ disabled = false,
632
+ icon: Icon,
633
+ size = "md",
634
+ tooltip,
635
+ onClick
636
+ }, ref) => {
637
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
638
+ "button",
639
+ {
640
+ "aria-label": accessibilityLabel,
641
+ type: "button",
642
+ title: tooltip,
643
+ disabled,
644
+ onClick,
645
+ className: (0, import_classnames6.default)(
646
+ IconButton_module_default.iconButton,
647
+ foregroundColor(color),
648
+ backgroundColor(color),
649
+ IconButton_module_default[size]
650
+ ),
651
+ ref,
652
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { className: iconSize2[size] })
653
+ }
654
+ );
655
+ }
656
+ );
657
+ IconButton.displayName = "IconButton";
646
658
  var IconButton_default = IconButton;
647
659
 
648
660
  // src/Checkbox/Checkbox.tsx
649
- var import_react3 = require("react");
661
+ var import_react5 = require("react");
650
662
  var import_classnames7 = __toESM(require_classnames());
651
663
 
652
664
  // src/useFocusVisible.tsx
653
- var import_react2 = require("react");
665
+ var import_react4 = require("react");
654
666
  var hasSetupGlobalListeners = false;
655
667
  var currentModality = null;
656
668
  var changeHandlers = /* @__PURE__ */ new Set();
@@ -726,8 +738,8 @@ function setupGlobalFocusEvents() {
726
738
  }
727
739
  function useFocusVisible() {
728
740
  setupGlobalFocusEvents();
729
- const [isFocusVisibleState, setFocusVisible] = (0, import_react2.useState)(isFocusVisible());
730
- (0, import_react2.useEffect)(() => {
741
+ const [isFocusVisibleState, setFocusVisible] = (0, import_react4.useState)(isFocusVisible());
742
+ (0, import_react4.useEffect)(() => {
731
743
  const handler = () => {
732
744
  setFocusVisible(isFocusVisible());
733
745
  };
@@ -763,7 +775,7 @@ var Checkbox = ({
763
775
  error = false,
764
776
  onChange
765
777
  }) => {
766
- const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
778
+ const [isFocused, setIsFocused] = (0, import_react5.useState)(false);
767
779
  const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
768
780
  const checkboxStyling = (0, import_classnames7.default)(Checkbox_module_default.checkbox, Checkbox_module_default[size]);
769
781
  const uncheckedStyling = (0, import_classnames7.default)(checkboxStyling, Checkbox_module_default.uncheckedBox, {
@@ -825,11 +837,11 @@ var MiniActionCard = ({
825
837
  var MiniActionCard_default = MiniActionCard;
826
838
 
827
839
  // src/RadioButton/RadioButton.tsx
828
- var import_react4 = require("react");
840
+ var import_react6 = require("react");
829
841
  var import_classnames8 = __toESM(require_classnames());
830
842
 
831
843
  // css-module:./RadioButton.module.css#css-module
832
- var RadioButton_module_default = { "radioBaseContainer": "_radioBaseContainer_144ms_1", "smBase": "_smBase_144ms_8", "mdBase": "_mdBase_144ms_13", "radioStyleOverride": "_radioStyleOverride_144ms_18", "smOverride": "_smOverride_144ms_23", "mdOverride": "_mdOverride_144ms_28", "background": "_background_144ms_33", "sm": "_sm_144ms_8", "md": "_md_144ms_13", "neutralBorder": "_neutralBorder_144ms_50", "smCheckedBorder": "_smCheckedBorder_144ms_54", "mdCheckedBorder": "_mdCheckedBorder_144ms_58", "errorBorderColor": "_errorBorderColor_144ms_62", "borderColor": "_borderColor_144ms_66" };
844
+ var RadioButton_module_default = { "radioBaseContainer": "_radioBaseContainer_ne98c_1", "smBase": "_smBase_ne98c_9", "mdBase": "_mdBase_ne98c_14", "radioStyleOverride": "_radioStyleOverride_ne98c_19", "smOverride": "_smOverride_ne98c_24", "mdOverride": "_mdOverride_ne98c_29", "background": "_background_ne98c_34", "sm": "_sm_ne98c_9", "md": "_md_ne98c_14", "neutralBorder": "_neutralBorder_ne98c_51", "smCheckedBorder": "_smCheckedBorder_ne98c_55", "mdCheckedBorder": "_mdCheckedBorder_ne98c_59", "errorBorderColor": "_errorBorderColor_ne98c_63", "borderColor": "_borderColor_ne98c_67" };
833
845
 
834
846
  // src/RadioButton/RadioButton.tsx
835
847
  var import_jsx_runtime12 = require("react/jsx-runtime");
@@ -843,7 +855,7 @@ var RadioButton = ({
843
855
  size = "md",
844
856
  value
845
857
  }) => {
846
- const [isFocused, setIsFocused] = (0, import_react4.useState)(false);
858
+ const [isFocused, setIsFocused] = (0, import_react6.useState)(false);
847
859
  const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
848
860
  const sharedStyles = (0, import_classnames8.default)(RadioButton_module_default.background, RadioButton_module_default[size], {
849
861
  [RadioButton_module_default.errorBorderColor]: error,
@@ -903,7 +915,7 @@ var RadioButton = ({
903
915
  var RadioButton_default = RadioButton;
904
916
 
905
917
  // src/SelectList/SelectList.tsx
906
- var import_react5 = require("react");
918
+ var import_react7 = require("react");
907
919
  var import_classnames9 = __toESM(require_classnames());
908
920
 
909
921
  // ../syntax-design-tokens/dist/js/index.js
@@ -948,9 +960,9 @@ var SelectList = ({
948
960
  selectedValue = "",
949
961
  size = "md"
950
962
  }) => {
951
- const id = (0, import_react5.useId)();
963
+ const id = (0, import_react7.useId)();
952
964
  const { isFocusVisible: isFocusVisible2 } = useFocusVisible();
953
- const [isFocused, setIsFocused] = (0, import_react5.useState)(false);
965
+ const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
954
966
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
955
967
  "div",
956
968
  {