@cambly/syntax-core 5.0.0 → 5.2.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, id, 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
  *
@@ -646,6 +662,10 @@ declare const RadioButton: ({ checked, disabled, error, label, name, onChange, s
646
662
  * @defaultValue false
647
663
  */
648
664
  error?: boolean | undefined;
665
+ /**
666
+ * Id for the the radio button
667
+ */
668
+ id?: string | undefined;
649
669
  /**
650
670
  * Value to show end user
651
671
  */
@@ -674,11 +694,15 @@ declare const RadioButton: ({ checked, disabled, error, label, name, onChange, s
674
694
  }) => ReactElement;
675
695
 
676
696
  declare const SelectList: {
677
- ({ children, disabled, errorText, helperText, label, onChange, placeholderText, selectedValue, size, }: {
697
+ ({ children, "data-testid": dataTestId, disabled, errorText, helperText, label, onChange, placeholderText, selectedValue, size, }: {
678
698
  /**
679
699
  * One or more SelectList.Option components.
680
700
  */
681
701
  children: ReactNode;
702
+ /**
703
+ * Test id for the select element
704
+ */
705
+ "data-testid"?: string | undefined;
682
706
  /**
683
707
  * true if the select dropdown is disabled
684
708
  * @defaultValue false
@@ -720,7 +744,8 @@ declare const SelectList: {
720
744
  */
721
745
  size?: "sm" | "md" | "lg" | undefined;
722
746
  }): ReactElement;
723
- Option: ({ value, label, disabled, }: {
747
+ Option: ({ "data-testid": dataTestId, value, label, disabled, }: {
748
+ "data-testid"?: string | undefined;
724
749
  value: string;
725
750
  label: string;
726
751
  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,8 +880,10 @@ 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,
886
+ id,
879
887
  label,
880
888
  name,
881
889
  onChange,
@@ -900,7 +908,9 @@ var RadioButton = ({
900
908
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
901
909
  "input",
902
910
  {
911
+ "data-testid": dataTestId,
903
912
  type: "radio",
913
+ id,
904
914
  name,
905
915
  className: (0, import_classnames8.default)(RadioButton_module_default.radioStyleOverride, {
906
916
  [RadioButton_module_default.smOverride]: size === "sm",
@@ -927,7 +937,7 @@ var RadioButton = ({
927
937
  })
928
938
  }
929
939
  ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: (0, import_classnames8.default)(sharedStyles, RadioButton_module_default.neutralBorder) }),
930
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
940
+ label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
931
941
  Typography_default,
932
942
  {
933
943
  size: size === "md" ? 200 : 100,
@@ -955,18 +965,11 @@ var SelectList_module_default = { "selectContainer": "_selectContainer_1e7f9_1",
955
965
  // src/SelectList/SelectOption.tsx
956
966
  var import_jsx_runtime14 = require("react/jsx-runtime");
957
967
  var SelectOption = ({
968
+ "data-testid": dataTestId,
958
969
  value,
959
970
  label,
960
971
  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
- );
972
+ }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { "data-testid": dataTestId, value, disabled, children: label });
970
973
  var SelectOption_default = SelectOption;
971
974
 
972
975
  // src/SelectList/SelectList.tsx
@@ -978,6 +981,7 @@ var iconSize3 = {
978
981
  };
979
982
  var SelectList = ({
980
983
  children,
984
+ "data-testid": dataTestId,
981
985
  disabled = false,
982
986
  errorText,
983
987
  helperText,
@@ -1003,7 +1007,7 @@ var SelectList = ({
1003
1007
  "select",
1004
1008
  {
1005
1009
  id,
1006
- "data-testid": "syntax-select",
1010
+ "data-testid": dataTestId,
1007
1011
  disabled,
1008
1012
  className: (0, import_classnames9.default)(SelectList_module_default.selectBox, SelectList_module_default[size], {
1009
1013
  [SelectList_module_default.unselected]: !selectedValue && !errorText,