@cambly/syntax-core 2.2.0 → 2.3.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.mjs CHANGED
@@ -60,7 +60,7 @@ var require_classnames = __commonJS({
60
60
  "use strict";
61
61
  var hasOwn = {}.hasOwnProperty;
62
62
  var nativeCodeString = "[native code]";
63
- function classNames8() {
63
+ function classNames9() {
64
64
  var classes = [];
65
65
  for (var i = 0; i < arguments.length; i++) {
66
66
  var arg = arguments[i];
@@ -71,7 +71,7 @@ var require_classnames = __commonJS({
71
71
  classes.push(arg);
72
72
  } else if (Array.isArray(arg)) {
73
73
  if (arg.length) {
74
- var inner = classNames8.apply(null, arg);
74
+ var inner = classNames9.apply(null, arg);
75
75
  if (inner) {
76
76
  classes.push(inner);
77
77
  }
@@ -91,14 +91,14 @@ var require_classnames = __commonJS({
91
91
  return classes.join(" ");
92
92
  }
93
93
  if (typeof module !== "undefined" && module.exports) {
94
- classNames8.default = classNames8;
95
- module.exports = classNames8;
94
+ classNames9.default = classNames9;
95
+ module.exports = classNames9;
96
96
  } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
97
97
  define("classnames", [], function() {
98
- return classNames8;
98
+ return classNames9;
99
99
  });
100
100
  } else {
101
- window.classNames = classNames8;
101
+ window.classNames = classNames9;
102
102
  }
103
103
  })();
104
104
  }
@@ -813,6 +813,119 @@ var RadioButton = ({
813
813
  );
814
814
  };
815
815
  var RadioButton_default = RadioButton;
816
+
817
+ // src/SelectList/SelectList.tsx
818
+ var import_classnames9 = __toESM(require_classnames());
819
+ import { useId } from "react";
820
+ import {
821
+ ColorBaseDestructive700,
822
+ ColorBaseGray800
823
+ } from "@cambly/syntax-design-tokens/dist/js/index.js";
824
+
825
+ // css-module:./SelectList.module.css#css-module
826
+ var SelectList_module_default = { "selectContainer": "_selectContainer_1y5p4_1", "opacityOverlay": "_opacityOverlay_1y5p4_7", "outerTextContainer": "_outerTextContainer_1y5p4_11", "selectWrapper": "_selectWrapper_1y5p4_16", "selectBox": "_selectBox_1y5p4_21", "unselected": "_unselected_1y5p4_40", "selected": "_selected_1y5p4_44", "arrowIcon": "_arrowIcon_1y5p4_48", "sm": "_sm_1y5p4_62", "md": "_md_1y5p4_67", "lg": "_lg_1y5p4_72", "selectError": "_selectError_1y5p4_77" };
827
+
828
+ // src/SelectList/SelectOption.tsx
829
+ import { jsx as jsx13 } from "react/jsx-runtime";
830
+ var SelectOption = ({
831
+ value,
832
+ label,
833
+ disabled = false
834
+ }) => /* @__PURE__ */ jsx13(
835
+ "option",
836
+ {
837
+ "data-testid": `syntax-select-${value}`,
838
+ value,
839
+ disabled,
840
+ children: label
841
+ }
842
+ );
843
+ var SelectOption_default = SelectOption;
844
+
845
+ // src/SelectList/SelectList.tsx
846
+ import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
847
+ var iconSize3 = {
848
+ sm: 20,
849
+ md: 24,
850
+ lg: 24
851
+ };
852
+ var SelectList = ({
853
+ children,
854
+ disabled = false,
855
+ errorText,
856
+ helperText,
857
+ label,
858
+ onChange,
859
+ placeholderText,
860
+ selectedValue = "",
861
+ size = "md"
862
+ }) => {
863
+ const id = useId();
864
+ return /* @__PURE__ */ jsxs4(
865
+ "div",
866
+ {
867
+ className: (0, import_classnames9.default)(SelectList_module_default.selectContainer, {
868
+ [SelectList_module_default.opacityOverlay]: disabled
869
+ }),
870
+ children: [
871
+ /* @__PURE__ */ jsx14("label", { htmlFor: id, className: SelectList_module_default.outerTextContainer, children: /* @__PURE__ */ jsx14(
872
+ Typography_default,
873
+ {
874
+ size: 100,
875
+ color: errorText ? "destructive-primary" : "gray700",
876
+ children: label
877
+ }
878
+ ) }),
879
+ /* @__PURE__ */ jsxs4("div", { className: SelectList_module_default.selectWrapper, children: [
880
+ /* @__PURE__ */ jsxs4(
881
+ "select",
882
+ {
883
+ id,
884
+ "data-testid": "syntax-select",
885
+ disabled,
886
+ className: (0, import_classnames9.default)(SelectList_module_default.selectBox, SelectList_module_default[size], {
887
+ [SelectList_module_default.unselected]: !selectedValue && !errorText,
888
+ [SelectList_module_default.selected]: selectedValue && !errorText,
889
+ [SelectList_module_default.selectError]: errorText
890
+ }),
891
+ onChange,
892
+ children: [
893
+ placeholderText && /* @__PURE__ */ jsx14("option", { disabled: true, value: "", children: placeholderText }),
894
+ children
895
+ ]
896
+ }
897
+ ),
898
+ /* @__PURE__ */ jsx14("div", { className: SelectList_module_default.arrowIcon, children: /* @__PURE__ */ jsx14(
899
+ "svg",
900
+ {
901
+ focusable: "false",
902
+ "aria-hidden": "true",
903
+ viewBox: "0 0 24 24",
904
+ width: iconSize3[size],
905
+ children: /* @__PURE__ */ jsx14(
906
+ "path",
907
+ {
908
+ fill: errorText ? ColorBaseDestructive700 : ColorBaseGray800,
909
+ d: "M15.88 9.29 12 13.17 8.12 9.29a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0z"
910
+ }
911
+ )
912
+ }
913
+ ) })
914
+ ] }),
915
+ /* @__PURE__ */ jsx14("div", { className: SelectList_module_default.outerTextContainer, children: /* @__PURE__ */ jsx14(
916
+ Typography_default,
917
+ {
918
+ size: 100,
919
+ color: errorText ? "destructive-primary" : "gray700",
920
+ children: errorText != null ? errorText : helperText
921
+ }
922
+ ) })
923
+ ]
924
+ }
925
+ );
926
+ };
927
+ var SelectList_default = SelectList;
928
+ SelectList.Option = SelectOption_default;
816
929
  export {
817
930
  Avatar_default as Avatar,
818
931
  Box,
@@ -825,6 +938,7 @@ export {
825
938
  IconButton_default as IconButton,
826
939
  MiniActionCard_default as MiniActionCard,
827
940
  RadioButton_default as RadioButton,
941
+ SelectList_default as SelectList,
828
942
  Typography_default as Typography
829
943
  };
830
944
  /*! Bundled license information: