@cambly/syntax-core 5.0.0 → 5.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.d.ts CHANGED
@@ -372,6 +372,10 @@ declare const Color: readonly ["primary", "secondary", "tertiary", "branded", "d
372
372
  declare const Size: readonly ["sm", "md", "lg"];
373
373
 
374
374
  type ButtonType = {
375
+ /**
376
+ * Test id for the button
377
+ */
378
+ "data-testid"?: string;
375
379
  /**
376
380
  * The text to be displayed inside the button
377
381
  */
@@ -533,6 +537,10 @@ type IconButtonType = {
533
537
  * @defaultValue "primary"
534
538
  */
535
539
  color?: (typeof Color)[number];
540
+ /**
541
+ * Test id for the button
542
+ */
543
+ "data-testid"?: string;
536
544
  /**
537
545
  * The size of the button
538
546
  *
@@ -576,13 +584,17 @@ declare const IconButton: React__default.ForwardRefExoticComponent<IconButtonTyp
576
584
  /**
577
585
  * Checkbox is a clickable element that will show if an option has been selected or not
578
586
  */
579
- declare const Checkbox: ({ checked, disabled, size, label, error, onChange, }: {
587
+ declare const Checkbox: ({ checked, "data-testid": dataTestId, disabled, size, label, error, onChange, }: {
580
588
  /**
581
589
  * Whether or not the box has been clicked
582
590
  *
583
591
  * @defaultValue false
584
592
  */
585
593
  checked: boolean;
594
+ /**
595
+ * Test id for the checkbox
596
+ */
597
+ "data-testid"?: string | undefined;
586
598
  /**
587
599
  * The callback to be called when the checkbox value changes
588
600
  */
@@ -627,13 +639,17 @@ declare const MiniActionCard: ({ children, }: {
627
639
  /**
628
640
  * RadioButton is a radio button with accompanying text
629
641
  */
630
- declare const RadioButton: ({ checked, disabled, error, label, name, onChange, size, value, }: {
642
+ declare const RadioButton: ({ checked, "data-testid": dataTestId, disabled, error, label, name, onChange, size, value, }: {
631
643
  /**
632
644
  * Whether or not the radio button is checked
633
645
  *
634
646
  * @defaultValue false
635
647
  */
636
648
  checked?: boolean | undefined;
649
+ /**
650
+ * Test id for the radio button
651
+ */
652
+ "data-testid"?: string | undefined;
637
653
  /**
638
654
  * Whether or not the radio button is disabled
639
655
  *
@@ -674,11 +690,15 @@ declare const RadioButton: ({ checked, disabled, error, label, name, onChange, s
674
690
  }) => ReactElement;
675
691
 
676
692
  declare const SelectList: {
677
- ({ children, disabled, errorText, helperText, label, onChange, placeholderText, selectedValue, size, }: {
693
+ ({ children, "data-testid": dataTestId, disabled, errorText, helperText, label, onChange, placeholderText, selectedValue, size, }: {
678
694
  /**
679
695
  * One or more SelectList.Option components.
680
696
  */
681
697
  children: ReactNode;
698
+ /**
699
+ * Test id for the select element
700
+ */
701
+ "data-testid"?: string | undefined;
682
702
  /**
683
703
  * true if the select dropdown is disabled
684
704
  * @defaultValue false
@@ -720,7 +740,8 @@ declare const SelectList: {
720
740
  */
721
741
  size?: "sm" | "md" | "lg" | undefined;
722
742
  }): ReactElement;
723
- Option: ({ value, label, disabled, }: {
743
+ Option: ({ "data-testid": dataTestId, value, label, disabled, }: {
744
+ "data-testid"?: string | undefined;
724
745
  value: string;
725
746
  label: string;
726
747
  disabled?: boolean | undefined;
package/dist/index.js CHANGED
@@ -516,6 +516,7 @@ var iconSize = {
516
516
  };
517
517
  var Button = (0, import_react2.forwardRef)(
518
518
  ({
519
+ "data-testid": dataTestId,
519
520
  text,
520
521
  loadingText,
521
522
  color = "primary",
@@ -532,6 +533,7 @@ var Button = (0, import_react2.forwardRef)(
532
533
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
533
534
  "button",
534
535
  {
536
+ "data-testid": dataTestId,
535
537
  ref,
536
538
  "aria-label": accessibilityLabel,
537
539
  type: "button",
@@ -655,6 +657,7 @@ var IconButton = (0, import_react3.forwardRef)(
655
657
  ({
656
658
  accessibilityLabel,
657
659
  color = "primary",
660
+ "data-testid": dataTestId,
658
661
  disabled = false,
659
662
  icon: Icon,
660
663
  size = "md",
@@ -665,6 +668,7 @@ var IconButton = (0, import_react3.forwardRef)(
665
668
  "button",
666
669
  {
667
670
  "aria-label": accessibilityLabel,
671
+ "data-testid": dataTestId,
668
672
  type: "button",
669
673
  title: tooltip,
670
674
  disabled,
@@ -796,6 +800,7 @@ var iconWidth = {
796
800
  };
797
801
  var Checkbox = ({
798
802
  checked = false,
803
+ "data-testid": dataTestId,
799
804
  disabled = false,
800
805
  size = "md",
801
806
  label,
@@ -820,6 +825,7 @@ var Checkbox = ({
820
825
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
821
826
  "input",
822
827
  {
828
+ "data-testid": dataTestId,
823
829
  type: "checkbox",
824
830
  className: (0, import_classnames7.default)(Checkbox_module_default.inputOverlay, Checkbox_module_default[size]),
825
831
  checked,
@@ -874,6 +880,7 @@ var RadioButton_module_default = { "radioBaseContainer": "_radioBaseContainer_ne
874
880
  var import_jsx_runtime13 = require("react/jsx-runtime");
875
881
  var RadioButton = ({
876
882
  checked = false,
883
+ "data-testid": dataTestId,
877
884
  disabled = false,
878
885
  error = false,
879
886
  label,
@@ -900,6 +907,7 @@ var RadioButton = ({
900
907
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
901
908
  "input",
902
909
  {
910
+ "data-testid": dataTestId,
903
911
  type: "radio",
904
912
  name,
905
913
  className: (0, import_classnames8.default)(RadioButton_module_default.radioStyleOverride, {
@@ -955,18 +963,11 @@ var SelectList_module_default = { "selectContainer": "_selectContainer_1e7f9_1",
955
963
  // src/SelectList/SelectOption.tsx
956
964
  var import_jsx_runtime14 = require("react/jsx-runtime");
957
965
  var SelectOption = ({
966
+ "data-testid": dataTestId,
958
967
  value,
959
968
  label,
960
969
  disabled = false
961
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
962
- "option",
963
- {
964
- "data-testid": `syntax-select-${value}`,
965
- value,
966
- disabled,
967
- children: label
968
- }
969
- );
970
+ }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { "data-testid": dataTestId, value, disabled, children: label });
970
971
  var SelectOption_default = SelectOption;
971
972
 
972
973
  // src/SelectList/SelectList.tsx
@@ -978,6 +979,7 @@ var iconSize3 = {
978
979
  };
979
980
  var SelectList = ({
980
981
  children,
982
+ "data-testid": dataTestId,
981
983
  disabled = false,
982
984
  errorText,
983
985
  helperText,
@@ -1003,7 +1005,7 @@ var SelectList = ({
1003
1005
  "select",
1004
1006
  {
1005
1007
  id,
1006
- "data-testid": "syntax-select",
1008
+ "data-testid": dataTestId,
1007
1009
  disabled,
1008
1010
  className: (0, import_classnames9.default)(SelectList_module_default.selectBox, SelectList_module_default[size], {
1009
1011
  [SelectList_module_default.unselected]: !selectedValue && !errorText,