@cambly/syntax-core 19.3.0 → 20.0.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.
Files changed (62) hide show
  1. package/dist/Avatar/Avatar.d.ts +1 -1
  2. package/dist/ButtonGroup/ButtonGroup.d.ts +1 -1
  3. package/dist/Checkbox/Checkbox.d.ts +1 -1
  4. package/dist/Heading/Heading.d.ts +1 -1
  5. package/dist/RadioButton/RadioButton.d.ts +1 -1
  6. package/dist/RichSelect/RichSelectBox.d.ts +1 -1
  7. package/dist/RichSelect/RichSelectList.cjs +3 -3
  8. package/dist/RichSelect/RichSelectList.css +28 -16
  9. package/dist/RichSelect/RichSelectList.css.map +1 -1
  10. package/dist/RichSelect/RichSelectList.d.ts +1 -1
  11. package/dist/RichSelect/RichSelectList.js +2 -2
  12. package/dist/RichSelect/RichSelectRadioButton.d.ts +1 -1
  13. package/dist/SelectList/SelectList.cjs +3 -3
  14. package/dist/SelectList/SelectList.css +28 -16
  15. package/dist/SelectList/SelectList.css.map +1 -1
  16. package/dist/SelectList/SelectList.d.ts +7 -6
  17. package/dist/SelectList/SelectList.js +2 -2
  18. package/dist/TapArea/TapArea.d.ts +1 -1
  19. package/dist/TextArea/TextArea.cjs +2 -2
  20. package/dist/TextArea/TextArea.css +20 -13
  21. package/dist/TextArea/TextArea.css.map +1 -1
  22. package/dist/TextArea/TextArea.d.ts +6 -0
  23. package/dist/TextArea/TextArea.js +1 -1
  24. package/dist/TextField/TextField.cjs +3 -2
  25. package/dist/TextField/TextField.css +26 -13
  26. package/dist/TextField/TextField.css.map +1 -1
  27. package/dist/TextField/TextField.d.ts +6 -2
  28. package/dist/TextField/TextField.js +2 -1
  29. package/dist/Typography/Typography.d.ts +1 -1
  30. package/dist/__chunks/{JJN6542U.cjs → 6MV5I6RV.cjs} +16 -24
  31. package/dist/__chunks/6MV5I6RV.cjs.map +1 -0
  32. package/dist/__chunks/{D4FWWDPJ.cjs → CQWIABDZ.cjs} +1 -1
  33. package/dist/__chunks/{D4FWWDPJ.cjs.map → CQWIABDZ.cjs.map} +1 -1
  34. package/dist/__chunks/{MZK5G2SD.js → D5RAT3YV.js} +9 -5
  35. package/dist/__chunks/D5RAT3YV.js.map +1 -0
  36. package/dist/__chunks/{J4VE4V7R.js → DG5BGE3F.js} +13 -21
  37. package/dist/__chunks/DG5BGE3F.js.map +1 -0
  38. package/dist/__chunks/{Z6EWS3QI.cjs → IUX3GQRD.cjs} +9 -5
  39. package/dist/__chunks/IUX3GQRD.cjs.map +1 -0
  40. package/dist/__chunks/{IFOYULRK.js → JWSI5EOR.js} +1 -1
  41. package/dist/__chunks/{IFOYULRK.js.map → JWSI5EOR.js.map} +1 -1
  42. package/dist/__chunks/{R3XTMI64.cjs → KSBBGTKF.cjs} +52 -23
  43. package/dist/__chunks/KSBBGTKF.cjs.map +1 -0
  44. package/dist/__chunks/LHQQKL6Q.js +121 -0
  45. package/dist/__chunks/LHQQKL6Q.js.map +1 -0
  46. package/dist/__chunks/{WNNJJJGM.cjs → PAC42QWP.cjs} +6 -6
  47. package/dist/__chunks/PAC42QWP.cjs.map +1 -0
  48. package/dist/__chunks/{ED4O4LSA.js → VXPUQYXA.js} +3 -3
  49. package/dist/__chunks/{ED4O4LSA.js.map → VXPUQYXA.js.map} +1 -1
  50. package/dist/index.cjs +9 -9
  51. package/dist/index.css +48 -29
  52. package/dist/index.css.map +1 -1
  53. package/dist/index.js +8 -8
  54. package/package.json +1 -1
  55. package/dist/__chunks/BUVOUV7Z.js +0 -92
  56. package/dist/__chunks/BUVOUV7Z.js.map +0 -1
  57. package/dist/__chunks/J4VE4V7R.js.map +0 -1
  58. package/dist/__chunks/JJN6542U.cjs.map +0 -1
  59. package/dist/__chunks/MZK5G2SD.js.map +0 -1
  60. package/dist/__chunks/R3XTMI64.cjs.map +0 -1
  61. package/dist/__chunks/WNNJJJGM.cjs.map +0 -1
  62. package/dist/__chunks/Z6EWS3QI.cjs.map +0 -1
@@ -16,7 +16,7 @@ import { useId, forwardRef } from "react";
16
16
  var TextArea_module_default = { "textarea": "_textarea_1sb0v_1", "resizenone": "_resizenone_1sb0v_6", "resizehorizontal": "_resizehorizontal_1sb0v_10", "resizevertical": "_resizevertical_1sb0v_14", "resizeboth": "_resizeboth_1sb0v_18" };
17
17
 
18
18
  // css-module:../TextField/TextField.module.css#css-module
19
- var TextField_module_default = { "textfield": "_textfield_f2wi6_1", "transparent": "_transparent_f2wi6_13", "label": "_label_f2wi6_28", "md": "_md_f2wi6_32", "height": "_height_f2wi6_36", "inputError": "_inputError_f2wi6_40", "transparentInputError": "_transparentInputError_f2wi6_49", "transparenInputError": "_transparenInputError_f2wi6_54" };
19
+ var TextField_module_default = { "textfield": "_textfield_17wxq_1", "transparent": "_transparent_17wxq_20", "label": "_label_17wxq_36", "md": "_md_17wxq_40", "height": "_height_17wxq_44", "inputError": "_inputError_17wxq_48", "transparentInputError": "_transparentInputError_17wxq_57", "transparenInputError": "_transparenInputError_17wxq_62" };
20
20
 
21
21
  // src/TextArea/TextArea.tsx
22
22
  import classNames from "classnames";
@@ -33,6 +33,7 @@ var TextArea = forwardRef(
33
33
  placeholder = "",
34
34
  rows = 3,
35
35
  value = "",
36
+ on,
36
37
  onChange,
37
38
  resize = "none"
38
39
  }, forwardedRef) {
@@ -40,6 +41,8 @@ var TextArea = forwardRef(
40
41
  const disabled = !isHydrated || disabledProp;
41
42
  const reactId = useId();
42
43
  const inputId = id != null ? id : reactId;
44
+ const textColor = on === "darkBackground" ? "white" : "gray900";
45
+ const errorTextColor = on !== "darkBackground" ? "destructive-lightBackground" : "destructive-darkBackground";
43
46
  return /* @__PURE__ */ jsxs(
44
47
  Box_default,
45
48
  {
@@ -54,7 +57,7 @@ var TextArea = forwardRef(
54
57
  },
55
58
  position: "relative",
56
59
  children: [
57
- label && /* @__PURE__ */ jsx("label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: "gray700", children: label }) }) }),
60
+ label && /* @__PURE__ */ jsx("label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: textColor, children: label }) }) }),
58
61
  /* @__PURE__ */ jsx(Typography_default, { size: 100, children: /* @__PURE__ */ jsx(
59
62
  "textarea",
60
63
  {
@@ -64,8 +67,9 @@ var TextArea = forwardRef(
64
67
  TextField_module_default.textfield,
65
68
  TextArea_module_default.textarea,
66
69
  TextArea_module_default[`resize${resize}`],
70
+ errorText && (on === "darkBackground" ? TextField_module_default.transparentInputError : TextField_module_default.inputError),
67
71
  {
68
- [TextField_module_default.inputError]: errorText
72
+ [TextField_module_default.transparent]: on === "darkBackground"
69
73
  }
70
74
  ),
71
75
  id: inputId,
@@ -81,7 +85,7 @@ var TextArea = forwardRef(
81
85
  Typography_default,
82
86
  {
83
87
  size: 100,
84
- color: errorText ? "destructive-darkBackground" : "gray700",
88
+ color: errorText ? errorTextColor : textColor,
85
89
  children: errorText || helperText
86
90
  }
87
91
  ) })
@@ -95,4 +99,4 @@ var TextArea_default = TextArea;
95
99
  export {
96
100
  TextArea_default
97
101
  };
98
- //# sourceMappingURL=MZK5G2SD.js.map
102
+ //# sourceMappingURL=D5RAT3YV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TextArea/TextArea.tsx","css-module:./TextArea.module.css#css-module","css-module:../TextField/TextField.module.css#css-module"],"sourcesContent":["import Box from \"../Box/Box\";\nimport Typography from \"../Typography/Typography\";\nimport React, { type ReactElement, useId, forwardRef } from \"react\";\nimport styles from \"./TextArea.module.css\";\nimport textFieldStyles from \"../TextField/TextField.module.css\";\nimport classNames from \"classnames\";\nimport useIsHydrated from \"../useIsHydrated\";\n\ntype TextAreaProps = {\n /**\n * A data-testid to make querying for the TextArea easier.\n */\n \"data-testid\"?: string;\n /**\n * If true, the TextArea will be disabled.\n */\n disabled?: boolean;\n /**\n * Text shown below TextArea if there is an input error.\n */\n errorText?: string;\n /**\n * Informative helper text shown below TextArea\n */\n helperText?: string;\n /**\n * TextField id, if not provided, a unique id will be generated\n */\n id?: string;\n /**\n * TextArea visible label\n */\n label: string;\n /**\n * Maximum number of characters allowed in the TextArea\n */\n maxLength?: number;\n /**\n * Indicate whether the component renders on a light or dark background. Changes the color of the input field and text\n *\n * @defaulValue `lightBackground`\n */\n on?: \"lightBackground\" | \"darkBackground\";\n /**\n * Callback fired when the value is changed.\n */\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * Placeholder text to display when TextArea is empty\n */\n placeholder?: string;\n /**\n * Sets which part resizes when the user drags the resize handle.\n * * `none`: TextArea can not be resized\n * * `horizontal`: TextArea can only be resized horizontally\n * * `vertical`: TextArea can only be resized vertically\n * * `both`: TextArea can be resized horizontally and vertically\n *\n * @defaultvalue `none`\n */\n resize?: \"none\" | \"horizontal\" | \"vertical\" | \"both\";\n /**\n * Number of rows to display\n */\n rows?: number;\n /**\n * Value of the TextArea\n */\n value: string;\n};\n\n/**\n * [TextArea](https://cambly-syntax.vercel.app/?path=/docs/components-textarea--docs) allows users to enter multiple lines of text.\n */\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n errorText = \"\",\n helperText = \"\",\n id,\n label,\n maxLength = 1024,\n placeholder = \"\",\n rows = 3,\n value = \"\",\n on,\n onChange,\n resize = \"none\",\n }: TextAreaProps,\n forwardedRef,\n ): ReactElement {\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const reactId = useId();\n const inputId = id ?? reactId;\n const textColor = on === \"darkBackground\" ? \"white\" : \"gray900\";\n const errorTextColor =\n on !== \"darkBackground\"\n ? \"destructive-lightBackground\"\n : \"destructive-darkBackground\";\n\n return (\n <Box\n display=\"flex\"\n direction=\"column\"\n gap={2}\n width=\"100%\"\n dangerouslySetInlineStyle={{\n __style: {\n opacity: disabled ? 0.5 : 1,\n },\n }}\n position=\"relative\"\n >\n {label && (\n <label className={textFieldStyles.label} htmlFor={inputId}>\n <Box paddingX={1}>\n <Typography size={100} color={textColor}>\n {label}\n </Typography>\n </Box>\n </label>\n )}\n <Typography size={100}>\n <textarea\n data-testid={dataTestId}\n ref={forwardedRef}\n className={classNames(\n textFieldStyles.textfield,\n styles.textarea,\n styles[`resize${resize}`],\n errorText &&\n (on === \"darkBackground\"\n ? textFieldStyles.transparentInputError\n : textFieldStyles.inputError),\n {\n [textFieldStyles.transparent]: on === \"darkBackground\",\n },\n )}\n id={inputId}\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={onChange}\n rows={rows}\n value={value}\n disabled={disabled}\n />\n </Typography>\n {(helperText || errorText) && (\n <Box paddingX={1}>\n <Typography\n size={100}\n color={errorText ? errorTextColor : textColor}\n >\n {errorText || helperText}\n </Typography>\n </Box>\n )}\n </Box>\n );\n },\n);\n\nexport default TextArea;\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextArea/TextArea.module.css\"; export default {\"textarea\":\"_textarea_1sb0v_1\",\"resizenone\":\"_resizenone_1sb0v_6\",\"resizehorizontal\":\"_resizehorizontal_1sb0v_10\",\"resizevertical\":\"_resizevertical_1sb0v_14\",\"resizeboth\":\"_resizeboth_1sb0v_18\"}","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextField/TextField.module.css\"; export default {\"textfield\":\"_textfield_17wxq_1\",\"transparent\":\"_transparent_17wxq_20\",\"label\":\"_label_17wxq_36\",\"md\":\"_md_17wxq_40\",\"height\":\"_height_17wxq_44\",\"inputError\":\"_inputError_17wxq_48\",\"transparentInputError\":\"_transparentInputError_17wxq_57\",\"transparenInputError\":\"_transparenInputError_17wxq_62\"}"],"mappings":";;;;;;;;;;;;AAEA,SAAmC,OAAO,kBAAkB;;;ACFoC,IAAO,0BAAQ,EAAC,YAAW,qBAAoB,cAAa,uBAAsB,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ACxB,cACG,OAAO,mBACJ,yBAAgB,wBAChB,yBAAgB;AAAA,gBACtB;AAAA,kBACE,CAAC,yBAAgB,WAAW,GAAG,OAAO;AAAA,gBACxC;AAAA,cACF;AAAA,cACA,IAAI;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF,GACF;AAAA,WACE,cAAc,cACd,oBAAC,eAAI,UAAU,GACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,OAAO,YAAY,iBAAiB;AAAA,cAEnC,uBAAa;AAAA;AAAA,UAChB,GACF;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,IAAO,mBAAQ;","names":["TextArea"]}
@@ -6,7 +6,7 @@ import {
6
6
  ColorBaseDestructive700,
7
7
  ColorBaseGray700,
8
8
  ColorCambioWhite100
9
- } from "./IFOYULRK.js";
9
+ } from "./JWSI5EOR.js";
10
10
  import {
11
11
  Focus_module_default
12
12
  } from "./KKADUD65.js";
@@ -31,7 +31,7 @@ import {
31
31
  import classNames from "classnames";
32
32
 
33
33
  // css-module:./SelectList.module.css#css-module
34
- var SelectList_module_default = { "selectContainer": "_selectContainer_1g9ap_1", "opacityOverlay": "_opacityOverlay_1g9ap_7", "selectWrapper": "_selectWrapper_1g9ap_11", "selectBox": "_selectBox_1g9ap_16", "selectBoxCambio": "_selectBoxCambio_1g9ap_30", "selectMouseFocusStyling": "_selectMouseFocusStyling_1g9ap_38", "unselected": "_unselected_1g9ap_43", "selected": "_selected_1g9ap_47", "arrowIcon": "_arrowIcon_1g9ap_51", "selectErrorCambio": "_selectErrorCambio_1g9ap_65", "selectColorwhite": "_selectColorwhite_1g9ap_71", "selectColorclear": "_selectColorclear_1g9ap_77" };
34
+ var SelectList_module_default = { "selectContainer": "_selectContainer_13v7l_1", "opacityOverlay": "_opacityOverlay_13v7l_7", "selectWrapper": "_selectWrapper_13v7l_11", "selectBox": "_selectBox_13v7l_16", "selectBoxCambio": "_selectBoxCambio_13v7l_30", "selectMouseFocusStyling": "_selectMouseFocusStyling_13v7l_38", "unselected": "_unselected_13v7l_43", "selected": "_selected_13v7l_47", "transparent": "_transparent_13v7l_51", "arrowIcon": "_arrowIcon_13v7l_63", "selectErrorCambio": "_selectErrorCambio_13v7l_77", "selectColorwhite": "_selectColorwhite_13v7l_83", "transparentInputError": "_transparentInputError_13v7l_89", "transparenInputError": "_transparenInputError_13v7l_94" };
35
35
 
36
36
  // src/SelectList/SelectList.tsx
37
37
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -43,11 +43,11 @@ function SelectList({
43
43
  helperText,
44
44
  id,
45
45
  label,
46
+ on,
46
47
  onChange,
47
48
  onClick,
48
49
  placeholderText,
49
- selectedValue = "",
50
- color = "white"
50
+ selectedValue = ""
51
51
  }) {
52
52
  const reactId = useId();
53
53
  const isHydrated = useIsHydrated();
@@ -55,6 +55,8 @@ function SelectList({
55
55
  const selectId = id != null ? id : reactId;
56
56
  const { isFocusVisible } = useFocusVisible();
57
57
  const [isFocused, setIsFocused] = useState(false);
58
+ const textColor = on === "darkBackground" ? "white" : "gray900";
59
+ const errorTextColor = on !== "darkBackground" ? "destructive-lightBackground" : "destructive-darkBackground";
58
60
  const handleKeyDown = (event) => {
59
61
  if (disabled || onClick == null)
60
62
  return;
@@ -62,15 +64,11 @@ function SelectList({
62
64
  onClick(event);
63
65
  }
64
66
  };
65
- const textColor = {
66
- white: "gray700",
67
- clear: "white"
68
- };
69
67
  const getArrowIconColor = () => {
70
68
  if (errorText) {
71
69
  return ColorBaseDestructive700;
72
70
  } else {
73
- if (color === "clear") {
71
+ if (on === "darkBackground") {
74
72
  return ColorCambioWhite100;
75
73
  } else {
76
74
  return ColorBaseGray700;
@@ -84,7 +82,7 @@ function SelectList({
84
82
  [SelectList_module_default.opacityOverlay]: disabled
85
83
  }),
86
84
  children: [
87
- label && /* @__PURE__ */ jsx("label", { htmlFor: selectId, children: /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: textColor[color], children: label }) }) }),
85
+ label && /* @__PURE__ */ jsx("label", { htmlFor: selectId, children: /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: textColor, children: label }) }) }),
88
86
  /* @__PURE__ */ jsxs("div", { className: SelectList_module_default.selectWrapper, children: [
89
87
  /* @__PURE__ */ jsxs(
90
88
  "select",
@@ -95,12 +93,13 @@ function SelectList({
95
93
  className: classNames(SelectList_module_default.selectBox, SelectList_module_default.selectBoxCambio, {
96
94
  [SelectList_module_default.unselected]: !selectedValue && !errorText,
97
95
  [SelectList_module_default.selected]: selectedValue && !errorText,
98
- [SelectList_module_default.selectErrorCambio]: errorText,
96
+ [SelectList_module_default.selectErrorCambio]: errorText && on === "lightBackground",
97
+ [SelectList_module_default.transparentInputError]: errorText && on === "darkBackground",
99
98
  [Focus_module_default.accessibilityOutlineFocus]: isFocused && isFocusVisible,
100
99
  // for focus keyboard
101
100
  [SelectList_module_default.selectMouseFocusStyling]: isFocused && !isFocusVisible,
102
101
  // for focus mouse
103
- [SelectList_module_default[`selectColor${color}`]]: color
102
+ [SelectList_module_default.transparent]: on === "darkBackground"
104
103
  }),
105
104
  onChange,
106
105
  onClick,
@@ -131,14 +130,7 @@ function SelectList({
131
130
  }
132
131
  ) })
133
132
  ] }),
134
- (helperText || errorText) && /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(
135
- Typography_default,
136
- {
137
- size: 100,
138
- color: errorText ? "destructive-primary" : textColor[color],
139
- children: errorText ? errorText : helperText
140
- }
141
- ) })
133
+ (helperText || errorText) && /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: errorText ? errorTextColor : textColor, children: errorText ? errorText : helperText }) })
142
134
  ]
143
135
  }
144
136
  );
@@ -148,4 +140,4 @@ SelectList.Option = SelectOption_default;
148
140
  export {
149
141
  SelectList
150
142
  };
151
- //# sourceMappingURL=J4VE4V7R.js.map
143
+ //# sourceMappingURL=DG5BGE3F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/SelectList/SelectList.tsx","css-module:./SelectList.module.css#css-module"],"sourcesContent":["import React, {\n type ReactElement,\n type ReactNode,\n useId,\n useState,\n} from \"react\";\nimport Box from \"../Box/Box\";\nimport classNames from \"classnames\";\nimport {\n ColorBaseDestructive700,\n ColorBaseGray700,\n ColorCambioWhite100,\n} from \"@cambly/syntax-design-tokens\";\nimport Typography from \"../Typography/Typography\";\nimport styles from \"./SelectList.module.css\";\nimport focusStyles from \"../Focus.module.css\";\nimport SelectOption from \"./SelectOption\";\nimport useFocusVisible from \"../useFocusVisible\";\nimport useIsHydrated from \"../useIsHydrated\";\n\n/**\n * [SelectList](https://cambly-syntax.vercel.app/?path=/docs/components-selectlist--docs) is a dropdown menu that allows users to select one option from a list.\n */\nexport default function SelectList({\n children,\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n errorText,\n helperText,\n id,\n label,\n on,\n onChange,\n onClick,\n placeholderText,\n selectedValue = \"\",\n}: {\n /**\n * One or more SelectList.Option components.\n */\n children: ReactNode;\n /**\n * Test id for the select element\n */\n \"data-testid\"?: string;\n /**\n * true if the select dropdown is disabled\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Indicate whether the component renders on a light or dark background. Changes the color of the text\n *\n * @defaulValue `lightBackground`\n */\n on?: \"lightBackground\" | \"darkBackground\";\n /**\n * Callback to be called when select is clicked\n */\n onClick?: (event: React.SyntheticEvent<HTMLSelectElement>) => void;\n /**\n * Text shown below select box if there is an input error.\n */\n errorText?: string;\n /**\n * Text shown below select box\n */\n helperText?: string;\n /**\n * Id of the select element\n */\n id?: string;\n /**\n * Text shown above select box\n */\n label: string;\n /**\n * The callback to be called when an option is selected\n */\n onChange: React.ChangeEventHandler<HTMLSelectElement>;\n /**\n * Text showing in select box if no option has been chosen.\n * We should always have a placeholder unless there is a default option selected\n */\n placeholderText?: string;\n /**\n * Value of the currently selected option\n */\n selectedValue?: string;\n}): ReactElement {\n const reactId = useId();\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const selectId = id ?? reactId;\n const { isFocusVisible } = useFocusVisible();\n const [isFocused, setIsFocused] = useState(false);\n const textColor = on === \"darkBackground\" ? \"white\" : \"gray900\";\n const errorTextColor =\n on !== \"darkBackground\"\n ? \"destructive-lightBackground\"\n : \"destructive-darkBackground\";\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLSelectElement> = (\n event,\n ) => {\n if (disabled || onClick == null) return;\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"Space\") {\n onClick(event);\n }\n };\n\n const getArrowIconColor = () => {\n if (errorText) {\n return ColorBaseDestructive700;\n } else {\n if (on === \"darkBackground\") {\n return ColorCambioWhite100;\n } else {\n return ColorBaseGray700;\n }\n }\n };\n\n return (\n <div\n className={classNames(styles.selectContainer, {\n [styles.opacityOverlay]: disabled,\n })}\n >\n {label && (\n <label htmlFor={selectId}>\n <Box paddingX={1}>\n <Typography size={100} color={textColor}>\n {label}\n </Typography>\n </Box>\n </label>\n )}\n <div className={styles.selectWrapper}>\n <select\n id={selectId}\n data-testid={dataTestId}\n disabled={disabled}\n className={classNames(styles.selectBox, styles.selectBoxCambio, {\n [styles.unselected]: !selectedValue && !errorText,\n [styles.selected]: selectedValue && !errorText,\n [styles.selectErrorCambio]: errorText && on === \"lightBackground\",\n [styles.transparentInputError]:\n errorText && on === \"darkBackground\",\n [focusStyles.accessibilityOutlineFocus]:\n isFocused && isFocusVisible, // for focus keyboard\n [styles.selectMouseFocusStyling]: isFocused && !isFocusVisible, // for focus mouse\n [styles.transparent]: on === \"darkBackground\",\n })}\n onChange={onChange}\n onClick={onClick}\n onKeyDown={handleKeyDown}\n value={\n placeholderText && !selectedValue ? placeholderText : selectedValue\n }\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n >\n {placeholderText && (\n <option disabled value={placeholderText}>\n {placeholderText}\n </option>\n )}\n {children}\n </select>\n <div className={styles.arrowIcon}>\n <svg\n focusable=\"false\"\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n width={24}\n >\n <path\n fill={getArrowIconColor()}\n 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\"\n />\n </svg>\n </div>\n </div>\n {(helperText || errorText) && (\n <Box paddingX={1}>\n <Typography size={100} color={errorText ? errorTextColor : textColor}>\n {errorText ? errorText : helperText}\n </Typography>\n </Box>\n )}\n </div>\n );\n}\n\nSelectList.Option = SelectOption;\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/SelectList/SelectList.module.css\"; export default {\"selectContainer\":\"_selectContainer_13v7l_1\",\"opacityOverlay\":\"_opacityOverlay_13v7l_7\",\"selectWrapper\":\"_selectWrapper_13v7l_11\",\"selectBox\":\"_selectBox_13v7l_16\",\"selectBoxCambio\":\"_selectBoxCambio_13v7l_30\",\"selectMouseFocusStyling\":\"_selectMouseFocusStyling_13v7l_38\",\"unselected\":\"_unselected_13v7l_43\",\"selected\":\"_selected_13v7l_47\",\"transparent\":\"_transparent_13v7l_51\",\"arrowIcon\":\"_arrowIcon_13v7l_63\",\"selectErrorCambio\":\"_selectErrorCambio_13v7l_77\",\"selectColorwhite\":\"_selectColorwhite_13v7l_83\",\"transparentInputError\":\"_transparentInputError_13v7l_89\",\"transparenInputError\":\"_transparenInputError_13v7l_94\"}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAEP,OAAO,gBAAgB;;;ACP6E,IAAO,4BAAQ,EAAC,mBAAkB,4BAA2B,kBAAiB,2BAA0B,iBAAgB,2BAA0B,a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AA;AAAA;AAAA,EAEJ;AAEJ;AAEA,WAAW,SAAS;","names":[]}
@@ -16,7 +16,7 @@ var _react = require('react');
16
16
  var TextArea_module_default = { "textarea": "_textarea_1sb0v_1", "resizenone": "_resizenone_1sb0v_6", "resizehorizontal": "_resizehorizontal_1sb0v_10", "resizevertical": "_resizevertical_1sb0v_14", "resizeboth": "_resizeboth_1sb0v_18" };
17
17
 
18
18
  // css-module:../TextField/TextField.module.css#css-module
19
- var TextField_module_default = { "textfield": "_textfield_f2wi6_1", "transparent": "_transparent_f2wi6_13", "label": "_label_f2wi6_28", "md": "_md_f2wi6_32", "height": "_height_f2wi6_36", "inputError": "_inputError_f2wi6_40", "transparentInputError": "_transparentInputError_f2wi6_49", "transparenInputError": "_transparenInputError_f2wi6_54" };
19
+ var TextField_module_default = { "textfield": "_textfield_17wxq_1", "transparent": "_transparent_17wxq_20", "label": "_label_17wxq_36", "md": "_md_17wxq_40", "height": "_height_17wxq_44", "inputError": "_inputError_17wxq_48", "transparentInputError": "_transparentInputError_17wxq_57", "transparenInputError": "_transparenInputError_17wxq_62" };
20
20
 
21
21
  // src/TextArea/TextArea.tsx
22
22
  var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
@@ -33,6 +33,7 @@ var TextArea = _react.forwardRef.call(void 0,
33
33
  placeholder = "",
34
34
  rows = 3,
35
35
  value = "",
36
+ on,
36
37
  onChange,
37
38
  resize = "none"
38
39
  }, forwardedRef) {
@@ -40,6 +41,8 @@ var TextArea = _react.forwardRef.call(void 0,
40
41
  const disabled = !isHydrated || disabledProp;
41
42
  const reactId = _react.useId.call(void 0, );
42
43
  const inputId = id != null ? id : reactId;
44
+ const textColor = on === "darkBackground" ? "white" : "gray900";
45
+ const errorTextColor = on !== "darkBackground" ? "destructive-lightBackground" : "destructive-darkBackground";
43
46
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
44
47
  _QODNNCT2cjs.Box_default,
45
48
  {
@@ -54,7 +57,7 @@ var TextArea = _react.forwardRef.call(void 0,
54
57
  },
55
58
  position: "relative",
56
59
  children: [
57
- label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _QODNNCT2cjs.Box_default, { paddingX: 1, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RVU3UEZIcjs.Typography_default, { size: 100, color: "gray700", children: label }) }) }),
60
+ label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _QODNNCT2cjs.Box_default, { paddingX: 1, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RVU3UEZIcjs.Typography_default, { size: 100, color: textColor, children: label }) }) }),
58
61
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RVU3UEZIcjs.Typography_default, { size: 100, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
59
62
  "textarea",
60
63
  {
@@ -64,8 +67,9 @@ var TextArea = _react.forwardRef.call(void 0,
64
67
  TextField_module_default.textfield,
65
68
  TextArea_module_default.textarea,
66
69
  TextArea_module_default[`resize${resize}`],
70
+ errorText && (on === "darkBackground" ? TextField_module_default.transparentInputError : TextField_module_default.inputError),
67
71
  {
68
- [TextField_module_default.inputError]: errorText
72
+ [TextField_module_default.transparent]: on === "darkBackground"
69
73
  }
70
74
  ),
71
75
  id: inputId,
@@ -81,7 +85,7 @@ var TextArea = _react.forwardRef.call(void 0,
81
85
  _RVU3UEZIcjs.Typography_default,
82
86
  {
83
87
  size: 100,
84
- color: errorText ? "destructive-darkBackground" : "gray700",
88
+ color: errorText ? errorTextColor : textColor,
85
89
  children: errorText || helperText
86
90
  }
87
91
  ) })
@@ -95,4 +99,4 @@ var TextArea_default = TextArea;
95
99
 
96
100
 
97
101
  exports.TextArea_default = TextArea_default;
98
- //# sourceMappingURL=Z6EWS3QI.cjs.map
102
+ //# sourceMappingURL=IUX3GQRD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TextArea/TextArea.tsx","css-module:./TextArea.module.css#css-module","css-module:../TextField/TextField.module.css#css-module"],"names":["TextArea"],"mappings":";;;;;;;;;;;;AAEA,SAAmC,OAAO,kBAAkB;;;ACFoC,IAAO,0BAAQ,EAAC,YAAW,qBAAoB,cAAa,uBAAsB,oBAAmB,8BAA6B,kBAAiB,4BAA2B,cAAa,uBAAsB;;;ACA/M,IAAO,2BAAQ,EAAC,aAAY,sBAAqB,eAAc,yBAAwB,SAAQ,mBAAkB,MAAK,gBAAe,UAAS,oBAAmB,cAAa,wBAAuB,yBAAwB,mCAAkC,wBAAuB,iCAAgC;;;AFKxZ,OAAO,gBAAgB;AAmGjB,SAeQ,KAfR;AA9BN,IAAM,WAAW;AAAA,EACf,SAASA,UACP;AAAA,IACE,eAAe;AAAA,IACf,UAAU,eAAe;AAAA,IACzB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACX,GACA,cACc;AACd,UAAM,aAAa,cAAc;AACjC,UAAM,WAAW,CAAC,cAAc;AAChC,UAAM,UAAU,MAAM;AACtB,UAAM,UAAU,kBAAM;AACtB,UAAM,YAAY,OAAO,mBAAmB,UAAU;AACtD,UAAM,iBACJ,OAAO,mBACH,gCACA;AAEN,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,KAAK;AAAA,QACL,OAAM;AAAA,QACN,2BAA2B;AAAA,UACzB,SAAS;AAAA,YACP,SAAS,WAAW,MAAM;AAAA,UAC5B;AAAA,QACF;AAAA,QACA,UAAS;AAAA,QAER;AAAA,mBACC,oBAAC,WAAM,WAAW,yBAAgB,OAAO,SAAS,SAChD,8BAAC,eAAI,UAAU,GACb,8BAAC,sBAAW,MAAM,KAAK,OAAO,WAC3B,iBACH,GACF,GACF;AAAA,UAEF,oBAAC,sBAAW,MAAM,KAChB;AAAA,YAAC;AAAA;AAAA,cACC,eAAa;AAAA,cACb,KAAK;AAAA,cACL,WAAW;AAAA,gBACT,yBAAgB;AAAA,gBAChB,wBAAO;AAAA,gBACP,wBAAO,SAAS,QAAQ;AAAA,gBACxB,cACG,OAAO,mBACJ,yBAAgB,wBAChB,yBAAgB;AAAA,gBACtB;AAAA,kBACE,CAAC,yBAAgB,WAAW,GAAG,OAAO;AAAA,gBACxC;AAAA,cACF;AAAA,cACA,IAAI;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF,GACF;AAAA,WACE,cAAc,cACd,oBAAC,eAAI,UAAU,GACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,OAAO,YAAY,iBAAiB;AAAA,cAEnC,uBAAa;AAAA;AAAA,UAChB,GACF;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,IAAO,mBAAQ","sourcesContent":["import Box from \"../Box/Box\";\nimport Typography from \"../Typography/Typography\";\nimport React, { type ReactElement, useId, forwardRef } from \"react\";\nimport styles from \"./TextArea.module.css\";\nimport textFieldStyles from \"../TextField/TextField.module.css\";\nimport classNames from \"classnames\";\nimport useIsHydrated from \"../useIsHydrated\";\n\ntype TextAreaProps = {\n /**\n * A data-testid to make querying for the TextArea easier.\n */\n \"data-testid\"?: string;\n /**\n * If true, the TextArea will be disabled.\n */\n disabled?: boolean;\n /**\n * Text shown below TextArea if there is an input error.\n */\n errorText?: string;\n /**\n * Informative helper text shown below TextArea\n */\n helperText?: string;\n /**\n * TextField id, if not provided, a unique id will be generated\n */\n id?: string;\n /**\n * TextArea visible label\n */\n label: string;\n /**\n * Maximum number of characters allowed in the TextArea\n */\n maxLength?: number;\n /**\n * Indicate whether the component renders on a light or dark background. Changes the color of the input field and text\n *\n * @defaulValue `lightBackground`\n */\n on?: \"lightBackground\" | \"darkBackground\";\n /**\n * Callback fired when the value is changed.\n */\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * Placeholder text to display when TextArea is empty\n */\n placeholder?: string;\n /**\n * Sets which part resizes when the user drags the resize handle.\n * * `none`: TextArea can not be resized\n * * `horizontal`: TextArea can only be resized horizontally\n * * `vertical`: TextArea can only be resized vertically\n * * `both`: TextArea can be resized horizontally and vertically\n *\n * @defaultvalue `none`\n */\n resize?: \"none\" | \"horizontal\" | \"vertical\" | \"both\";\n /**\n * Number of rows to display\n */\n rows?: number;\n /**\n * Value of the TextArea\n */\n value: string;\n};\n\n/**\n * [TextArea](https://cambly-syntax.vercel.app/?path=/docs/components-textarea--docs) allows users to enter multiple lines of text.\n */\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(\n {\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n errorText = \"\",\n helperText = \"\",\n id,\n label,\n maxLength = 1024,\n placeholder = \"\",\n rows = 3,\n value = \"\",\n on,\n onChange,\n resize = \"none\",\n }: TextAreaProps,\n forwardedRef,\n ): ReactElement {\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const reactId = useId();\n const inputId = id ?? reactId;\n const textColor = on === \"darkBackground\" ? \"white\" : \"gray900\";\n const errorTextColor =\n on !== \"darkBackground\"\n ? \"destructive-lightBackground\"\n : \"destructive-darkBackground\";\n\n return (\n <Box\n display=\"flex\"\n direction=\"column\"\n gap={2}\n width=\"100%\"\n dangerouslySetInlineStyle={{\n __style: {\n opacity: disabled ? 0.5 : 1,\n },\n }}\n position=\"relative\"\n >\n {label && (\n <label className={textFieldStyles.label} htmlFor={inputId}>\n <Box paddingX={1}>\n <Typography size={100} color={textColor}>\n {label}\n </Typography>\n </Box>\n </label>\n )}\n <Typography size={100}>\n <textarea\n data-testid={dataTestId}\n ref={forwardedRef}\n className={classNames(\n textFieldStyles.textfield,\n styles.textarea,\n styles[`resize${resize}`],\n errorText &&\n (on === \"darkBackground\"\n ? textFieldStyles.transparentInputError\n : textFieldStyles.inputError),\n {\n [textFieldStyles.transparent]: on === \"darkBackground\",\n },\n )}\n id={inputId}\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={onChange}\n rows={rows}\n value={value}\n disabled={disabled}\n />\n </Typography>\n {(helperText || errorText) && (\n <Box paddingX={1}>\n <Typography\n size={100}\n color={errorText ? errorTextColor : textColor}\n >\n {errorText || helperText}\n </Typography>\n </Box>\n )}\n </Box>\n );\n },\n);\n\nexport default TextArea;\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextArea/TextArea.module.css\"; export default {\"textarea\":\"_textarea_1sb0v_1\",\"resizenone\":\"_resizenone_1sb0v_6\",\"resizehorizontal\":\"_resizehorizontal_1sb0v_10\",\"resizevertical\":\"_resizevertical_1sb0v_14\",\"resizeboth\":\"_resizeboth_1sb0v_18\"}","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextField/TextField.module.css\"; export default {\"textfield\":\"_textfield_17wxq_1\",\"transparent\":\"_transparent_17wxq_20\",\"label\":\"_label_17wxq_36\",\"md\":\"_md_17wxq_40\",\"height\":\"_height_17wxq_44\",\"inputError\":\"_inputError_17wxq_48\",\"transparentInputError\":\"_transparentInputError_17wxq_57\",\"transparenInputError\":\"_transparenInputError_17wxq_62\"}"]}
@@ -10,4 +10,4 @@ export {
10
10
  ColorBaseGray700,
11
11
  ColorCambioWhite100
12
12
  };
13
- //# sourceMappingURL=IFOYULRK.js.map
13
+ //# sourceMappingURL=JWSI5EOR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../syntax-design-tokens/dist/js/index.js"],"sourcesContent":["/**\n * Do not edit directly\n * Generated on Thu, 22 Aug 2024 18:55:36 GMT\n */\n\nexport const ColorBaseBlack = \"#000000\";\nexport const ColorBaseDestructive100 = \"#fef3f5\";\nexport const ColorBaseDestructive200 = \"#fad6de\";\nexport const ColorBaseDestructive300 = \"#f2a2b2\";\nexport const ColorBaseDestructive700 = \"#d32a4b\";\nexport const ColorBaseDestructive800 = \"#81162c\";\nexport const ColorBaseDestructive900 = \"#55101d\";\nexport const ColorBaseGray10 = \"#cbcbcb\"; // Used as the default color for dividers and inner strokes\nexport const ColorBaseGray30 = \"#000000\"; // For IconButton background when on top of an image\nexport const ColorBaseGray60 = \"#000000\"; // Used for icon background in classroom video grid\nexport const ColorBaseGray80 = \"#000000\"; // Used as the background for modals\nexport const ColorBaseGray100 = \"#f7f7f7\";\nexport const ColorBaseGray200 = \"#f0f0f0\"; // Used for light mode backgrounds when showing card content on top\nexport const ColorBaseGray300 = \"#d0d0d0\"; // Used for component outlines, eg: select and textfield\nexport const ColorBaseGray700 = \"#767676\"; // For secondary text in light mode\nexport const ColorBaseGray800 = \"#353535\";\nexport const ColorBaseGray900 = \"#191919\"; // Default text color, Classroom background\nexport const ColorBaseOrange100 = \"#fdf2f0\";\nexport const ColorBaseOrange200 = \"#f6cdc4\";\nexport const ColorBaseOrange300 = \"#ec9987\";\nexport const ColorBaseOrange700 = \"#c34124\";\nexport const ColorBaseOrange800 = \"#732818\";\nexport const ColorBaseOrange900 = \"#4d1a10\";\nexport const ColorBasePrimary100 = \"#eff6fa\";\nexport const ColorBasePrimary200 = \"#c1dbe7\";\nexport const ColorBasePrimary300 = \"#84b7d0\";\nexport const ColorBasePrimary700 = \"#236482\";\nexport const ColorBasePrimary800 = \"#274858\";\nexport const ColorBasePrimary900 = \"#1b303b\";\nexport const ColorBaseSuccess100 = \"#eff7f1\";\nexport const ColorBaseSuccess200 = \"#bddcc6\";\nexport const ColorBaseSuccess300 = \"#81ba92\";\nexport const ColorBaseSuccess700 = \"#397b4d\";\nexport const ColorBaseSuccess800 = \"#2d4936\";\nexport const ColorBaseSuccess900 = \"#1e3124\";\nexport const ColorBasePurple100 = \"#f9f5fa\";\nexport const ColorBasePurple200 = \"#e8dceb\";\nexport const ColorBasePurple300 = \"#cdb4d3\";\nexport const ColorBasePurple700 = \"#8b5f95\";\nexport const ColorBasePurple800 = \"#523b58\";\nexport const ColorBasePurple900 = \"#37273b\";\nexport const ColorBaseYellow100 = \"#fdf5d9\";\nexport const ColorBaseYellow200 = \"#fbe8a3\";\nexport const ColorBaseYellow300 = \"#f8d663\";\nexport const ColorBaseYellow700 = \"#ffc929\";\nexport const ColorBaseYellow800 = \"#765f1c\";\nexport const ColorBaseYellow900 = \"#3b3009\";\nexport const ColorBaseWhite = \"#ffffff\";\nexport const ColorCambioBlack = \"#050500\";\nexport const ColorCambioWhite40 = \"#ffffff\";\nexport const ColorCambioWhite70 = \"#ffffff\";\nexport const ColorCambioWhite100 = \"#ffffff\";\nexport const ColorCambioGray100 = \"#faf4eb\";\nexport const ColorCambioGray200 = \"#e4dbd3\";\nexport const ColorCambioGray270 = \"#e4dbd3\";\nexport const ColorCambioGray300 = \"#beb4ab\";\nexport const ColorCambioGray370 = \"#beb4ab\";\nexport const ColorCambioGray700 = \"#5e5952\";\nexport const ColorCambioGray800 = \"#363432\";\nexport const ColorCambioGray870 = \"#5e5952\";\nexport const ColorCambioGray900 = \"#262625\";\nexport const ColorCambioDestructive100 = \"#ffdeda\";\nexport const ColorCambioDestructive300 = \"#ff8071\";\nexport const ColorCambioDestructive370 = \"#ff8071\";\nexport const ColorCambioDestructive700 = \"#c93f32\";\nexport const ColorCambioDestructive770 = \"#c93f32\";\nexport const ColorCambioDestructive900 = \"#6d0002\";\nexport const ColorCambioSuccess100 = \"#daf2c8\";\nexport const ColorCambioSuccess300 = \"#84ce64\";\nexport const ColorCambioSuccess370 = \"#84ce64\";\nexport const ColorCambioSuccess700 = \"#3c7f20\";\nexport const ColorCambioSuccess770 = \"#3c7f20\";\nexport const ColorCambioSuccess900 = \"#103e00\";\nexport const ColorCambioRed = \"#f56e56\";\nexport const ColorCambioOrange = \"#ff8f57\";\nexport const ColorCambioTan = \"#ffb47d\";\nexport const ColorCambioCream = \"#fffad1\";\nexport const ColorCambioPurple = \"#6840a8\";\nexport const ColorCambioLilac = \"#b59ef0\";\nexport const ColorCambioThistle = \"#d69ca4\";\nexport const ColorCambioPink = \"#ffccea\";\nexport const ColorCambioNavy = \"#191142\";\nexport const ColorCambioTeal = \"#44a6cf\";\nexport const ColorCambioSlate = \"#7c9fc6\";\nexport const ColorCambioSky = \"#b1e8fc\";\nexport const ColorCambioYellow700 = \"#ffe733\";\nexport const ColorCambioTransparentFull = \"#000000\";\nexport const Elevation400 = \"0px 16px 32px 0px #00000040\";\nexport const SyntaxFontSansSerif = \"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\";\nexport const ShadowInteractive = \"0px 3px 16px 0px rgba(144, 134, 130, 0.05), 0px 2px 30px 0px rgba(144, 134, 130, 0.02)\";\n"],"mappings":";;;AASO,IAAM,0BAA0B;AAUhC,IAAM,mBAAmB;AAqCzB,IAAM,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../../../syntax-design-tokens/dist/js/index.js"],"sourcesContent":["/**\n * Do not edit directly\n * Generated on Thu, 29 Aug 2024 16:33:27 GMT\n */\n\nexport const ColorBaseBlack = \"#000000\";\nexport const ColorBaseDestructive100 = \"#fef3f5\";\nexport const ColorBaseDestructive200 = \"#fad6de\";\nexport const ColorBaseDestructive300 = \"#f2a2b2\";\nexport const ColorBaseDestructive700 = \"#d32a4b\";\nexport const ColorBaseDestructive800 = \"#81162c\";\nexport const ColorBaseDestructive900 = \"#55101d\";\nexport const ColorBaseGray10 = \"#cbcbcb\"; // Used as the default color for dividers and inner strokes\nexport const ColorBaseGray30 = \"#000000\"; // For IconButton background when on top of an image\nexport const ColorBaseGray60 = \"#000000\"; // Used for icon background in classroom video grid\nexport const ColorBaseGray80 = \"#000000\"; // Used as the background for modals\nexport const ColorBaseGray100 = \"#f7f7f7\";\nexport const ColorBaseGray200 = \"#f0f0f0\"; // Used for light mode backgrounds when showing card content on top\nexport const ColorBaseGray300 = \"#d0d0d0\"; // Used for component outlines, eg: select and textfield\nexport const ColorBaseGray700 = \"#767676\"; // For secondary text in light mode\nexport const ColorBaseGray800 = \"#353535\";\nexport const ColorBaseGray900 = \"#191919\"; // Default text color, Classroom background\nexport const ColorBaseOrange100 = \"#fdf2f0\";\nexport const ColorBaseOrange200 = \"#f6cdc4\";\nexport const ColorBaseOrange300 = \"#ec9987\";\nexport const ColorBaseOrange700 = \"#c34124\";\nexport const ColorBaseOrange800 = \"#732818\";\nexport const ColorBaseOrange900 = \"#4d1a10\";\nexport const ColorBasePrimary100 = \"#eff6fa\";\nexport const ColorBasePrimary200 = \"#c1dbe7\";\nexport const ColorBasePrimary300 = \"#84b7d0\";\nexport const ColorBasePrimary700 = \"#236482\";\nexport const ColorBasePrimary800 = \"#274858\";\nexport const ColorBasePrimary900 = \"#1b303b\";\nexport const ColorBaseSuccess100 = \"#eff7f1\";\nexport const ColorBaseSuccess200 = \"#bddcc6\";\nexport const ColorBaseSuccess300 = \"#81ba92\";\nexport const ColorBaseSuccess700 = \"#397b4d\";\nexport const ColorBaseSuccess800 = \"#2d4936\";\nexport const ColorBaseSuccess900 = \"#1e3124\";\nexport const ColorBasePurple100 = \"#f9f5fa\";\nexport const ColorBasePurple200 = \"#e8dceb\";\nexport const ColorBasePurple300 = \"#cdb4d3\";\nexport const ColorBasePurple700 = \"#8b5f95\";\nexport const ColorBasePurple800 = \"#523b58\";\nexport const ColorBasePurple900 = \"#37273b\";\nexport const ColorBaseYellow100 = \"#fdf5d9\";\nexport const ColorBaseYellow200 = \"#fbe8a3\";\nexport const ColorBaseYellow300 = \"#f8d663\";\nexport const ColorBaseYellow700 = \"#ffc929\";\nexport const ColorBaseYellow800 = \"#765f1c\";\nexport const ColorBaseYellow900 = \"#3b3009\";\nexport const ColorBaseWhite = \"#ffffff\";\nexport const ColorCambioBlack = \"#050500\";\nexport const ColorCambioWhite40 = \"#ffffff\";\nexport const ColorCambioWhite70 = \"#ffffff\";\nexport const ColorCambioWhite100 = \"#ffffff\";\nexport const ColorCambioGray100 = \"#faf4eb\";\nexport const ColorCambioGray200 = \"#e4dbd3\";\nexport const ColorCambioGray270 = \"#e4dbd3\";\nexport const ColorCambioGray300 = \"#beb4ab\";\nexport const ColorCambioGray370 = \"#beb4ab\";\nexport const ColorCambioGray700 = \"#5e5952\";\nexport const ColorCambioGray800 = \"#363432\";\nexport const ColorCambioGray870 = \"#5e5952\";\nexport const ColorCambioGray900 = \"#262625\";\nexport const ColorCambioDestructive100 = \"#ffdeda\";\nexport const ColorCambioDestructive300 = \"#ff8071\";\nexport const ColorCambioDestructive370 = \"#ff8071\";\nexport const ColorCambioDestructive700 = \"#c93f32\";\nexport const ColorCambioDestructive770 = \"#c93f32\";\nexport const ColorCambioDestructive900 = \"#6d0002\";\nexport const ColorCambioSuccess100 = \"#daf2c8\";\nexport const ColorCambioSuccess300 = \"#84ce64\";\nexport const ColorCambioSuccess370 = \"#84ce64\";\nexport const ColorCambioSuccess700 = \"#3c7f20\";\nexport const ColorCambioSuccess770 = \"#3c7f20\";\nexport const ColorCambioSuccess900 = \"#103e00\";\nexport const ColorCambioRed = \"#f56e56\";\nexport const ColorCambioOrange = \"#ff8f57\";\nexport const ColorCambioTan = \"#ffb47d\";\nexport const ColorCambioCream = \"#fffad1\";\nexport const ColorCambioPurple = \"#6840a8\";\nexport const ColorCambioLilac = \"#b59ef0\";\nexport const ColorCambioThistle = \"#d69ca4\";\nexport const ColorCambioPink = \"#ffccea\";\nexport const ColorCambioNavy = \"#191142\";\nexport const ColorCambioTeal = \"#44a6cf\";\nexport const ColorCambioSlate = \"#7c9fc6\";\nexport const ColorCambioSky = \"#b1e8fc\";\nexport const ColorCambioYellow700 = \"#ffe733\";\nexport const ColorCambioTransparentFull = \"#000000\";\nexport const Elevation400 = \"0px 16px 32px 0px #00000040\";\nexport const SyntaxFontSansSerif = \"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif\";\nexport const ShadowInteractive = \"0px 3px 16px 0px rgba(144, 134, 130, 0.05), 0px 2px 30px 0px rgba(144, 134, 130, 0.02)\";\n"],"mappings":";;;AASO,IAAM,0BAA0B;AAUhC,IAAM,mBAAmB;AAqCzB,IAAM,sBAAsB;","names":[]}
@@ -1,6 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }"use client"
2
2
 
3
3
 
4
+ var _SJSSW5MPcjs = require('./SJSSW5MP.cjs');
5
+
6
+
4
7
  var _QODNNCT2cjs = require('./QODNNCT2.cjs');
5
8
 
6
9
 
@@ -16,7 +19,7 @@ var _react = require('react');
16
19
  var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
17
20
 
18
21
  // css-module:./TextField.module.css#css-module
19
- var TextField_module_default = { "textfield": "_textfield_f2wi6_1", "transparent": "_transparent_f2wi6_13", "label": "_label_f2wi6_28", "md": "_md_f2wi6_32", "height": "_height_f2wi6_36", "inputError": "_inputError_f2wi6_40", "transparentInputError": "_transparentInputError_f2wi6_49", "transparenInputError": "_transparenInputError_f2wi6_54" };
22
+ var TextField_module_default = { "textfield": "_textfield_17wxq_1", "transparent": "_transparent_17wxq_20", "label": "_label_17wxq_36", "md": "_md_17wxq_40", "height": "_height_17wxq_44", "inputError": "_inputError_17wxq_48", "transparentInputError": "_transparentInputError_17wxq_57", "transparenInputError": "_transparenInputError_17wxq_62" };
20
23
 
21
24
  // src/TextField/TextField.tsx
22
25
  var _jsxruntime = require('react/jsx-runtime');
@@ -25,6 +28,7 @@ function TextField({
25
28
  "data-testid": dataTestId,
26
29
  disabled: disabledProp = false,
27
30
  on = "lightBackground",
31
+ endBadge,
28
32
  errorText = "",
29
33
  helperText = "",
30
34
  id,
@@ -56,28 +60,53 @@ function TextField({
56
60
  },
57
61
  children: [
58
62
  label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _QODNNCT2cjs.Box_default, { paddingX: 1, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RVU3UEZIcjs.Typography_default, { size: 100, color: textColor, children: label }) }) }),
59
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
60
- "input",
63
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
64
+ _QODNNCT2cjs.Box_default,
61
65
  {
62
- autoComplete,
63
- className: _classnames2.default.call(void 0,
64
- TextField_module_default.textfield,
65
- TextField_module_default.md,
66
- TextField_module_default.height,
67
- errorText && (on === "darkBackground" ? TextField_module_default.transparentInputError : TextField_module_default.inputError),
68
- {
69
- [TextField_module_default.transparent]: on === "darkBackground"
70
- }
71
- ),
72
- "data-testid": dataTestId,
73
- disabled,
74
- id: inputId,
75
- maxLength,
76
- type,
77
- onChange,
78
- placeholder,
79
- value,
80
- step
66
+ display: "flex",
67
+ position: "relative",
68
+ justifyContent: endBadge ? "end" : "start",
69
+ children: [
70
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
71
+ "input",
72
+ {
73
+ autoComplete,
74
+ className: _classnames2.default.call(void 0,
75
+ TextField_module_default.textfield,
76
+ TextField_module_default.md,
77
+ TextField_module_default.height,
78
+ errorText && (on === "darkBackground" ? TextField_module_default.transparentInputError : TextField_module_default.inputError),
79
+ {
80
+ [TextField_module_default.transparent]: on === "darkBackground"
81
+ }
82
+ ),
83
+ "data-testid": dataTestId,
84
+ disabled,
85
+ id: inputId,
86
+ maxLength,
87
+ type,
88
+ onChange,
89
+ placeholder,
90
+ value,
91
+ step
92
+ }
93
+ ),
94
+ endBadge && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
95
+ _QODNNCT2cjs.Box_default,
96
+ {
97
+ position: "absolute",
98
+ dangerouslySetInlineStyle: { __style: { top: "25%" } },
99
+ marginEnd: 4,
100
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
101
+ _SJSSW5MPcjs.Badge_default,
102
+ {
103
+ text: endBadge,
104
+ color: on === "lightBackground" ? "gray370" : "gray870"
105
+ }
106
+ )
107
+ }
108
+ )
109
+ ]
81
110
  }
82
111
  ),
83
112
  (helperText || errorText) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _QODNNCT2cjs.Box_default, { paddingX: 1, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RVU3UEZIcjs.Typography_default, { size: 100, color: errorText ? errorTextColor : textColor, children: errorText || helperText }) })
@@ -89,4 +118,4 @@ function TextField({
89
118
 
90
119
 
91
120
  exports.TextField = TextField;
92
- //# sourceMappingURL=R3XTMI64.cjs.map
121
+ //# sourceMappingURL=KSBBGTKF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TextField/TextField.tsx","css-module:./TextField.module.css#css-module"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,OACK;AACP,OAAO,gBAAgB;;;ACL2E,IAAO,2BAAQ,EAAC,aAAY,sBAAqB,eAAc,yBAAwB,SAAQ,mBAAkB,MAAK,gBAAe,UAAS,oBAAmB,cAAa,wBAAuB,yBAAwB,mCAAkC,wBAAuB,iCAAgC;;;AD6H5Y,cAMN,YANM;AA9GG,SAAR,UAA2B;AAAA,EAChC;AAAA,EACA,eAAe;AAAA,EACf,UAAU,eAAe;AAAA,EACzB,KAAK;AAAA,EACL;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AACF,GAqEiB;AACf,QAAM,aAAa,cAAc;AACjC,QAAM,WAAW,CAAC,cAAc;AAChC,QAAM,UAAU,MAAM;AACtB,QAAM,UAAU,kBAAM;AACtB,QAAM,YAAY,OAAO,mBAAmB,UAAU;AACtD,QAAM,iBACJ,OAAO,mBACH,gCACA;AACN,SACE;AAAA,IAAC;AAA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sourcesContent":["import React, {\n type ReactElement,\n type HTMLInputTypeAttribute,\n useId,\n} from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./TextField.module.css\";\nimport Box from \"../Box/Box\";\nimport Typography from \"../Typography/Typography\";\nimport useIsHydrated from \"../useIsHydrated\";\nimport Badge from \"../Badge/Badge\";\n\n/**\n * [TextField](https://cambly-syntax.vercel.app/?path=/docs/components-textfield--docs) is a component that allows users to enter text.\n */\nexport default function TextField({\n autoComplete,\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n on = \"lightBackground\",\n endBadge,\n errorText = \"\",\n helperText = \"\",\n id,\n label,\n maxLength,\n onChange,\n placeholder = \"\",\n type = \"text\",\n value = \"\",\n step,\n}: {\n /**\n * The autocomplete attribute specifies whether or not an input field should have autocomplete enabled.\n *\n * Feel free to add new values from the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) as needed\n */\n autoComplete?: \"current-password\" | \"new-password\" | \"off\" | \"on\" | \"email\";\n /**\n * A data-testid to make querying for the TextField easier.\n */\n \"data-testid\"?: string;\n /**\n * If true, the TextField will be disabled.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Indicate whether the component renders on a light or dark background. Changes the color of the input field, text and badge\n *\n * @defaulValue `lightBackground`\n */\n on?: \"lightBackground\" | \"darkBackground\";\n /**\n * Text for endBadge shown at the end of the input field.\n */\n endBadge?: string;\n /**\n * Text shown below TextField if there is an input error.\n */\n errorText?: string;\n /**\n * Informative helper text shown below TextField\n */\n helperText?: string;\n /**\n * TextField id, if not provided, a unique id will be generated\n */\n id?: string;\n /**\n * TextField visible label\n */\n label: string;\n /**\n * Maximum length of the TextField\n */\n maxLength?: number;\n /**\n * The callback to be called the input changes\n */\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n /**\n * Optional TextField placeholder text\n */\n placeholder?: string;\n /**\n * Input type of the TextField\n *\n * See [full list of input types](https://developer.mozilla.org/en-US/docs/Learn/Forms/HTML5_input_types)\n */\n type?: HTMLInputTypeAttribute;\n /**\n * Value of the TextField\n */\n value: string;\n /**\n * Specified legal number intervals for an input field. Specifically for time or number. If for time, specify in milliseconds. Must be a positive value.\n */\n step?: number;\n}): ReactElement {\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const reactId = useId();\n const inputId = id ?? reactId;\n const textColor = on === \"darkBackground\" ? \"white\" : \"gray900\";\n const errorTextColor =\n on !== \"darkBackground\"\n ? \"destructive-lightBackground\"\n : \"destructive-darkBackground\";\n return (\n <Box\n display=\"flex\"\n direction=\"column\"\n gap={2}\n width=\"100%\"\n dangerouslySetInlineStyle={{\n __style: {\n opacity: disabled ? 0.5 : 1,\n },\n }}\n >\n {label && (\n <label className={styles.label} htmlFor={inputId}>\n <Box paddingX={1}>\n <Typography size={100} color={textColor}>\n {label}\n </Typography>\n </Box>\n </label>\n )}\n <Box\n display=\"flex\"\n position=\"relative\"\n justifyContent={endBadge ? \"end\" : \"start\"}\n >\n <input\n autoComplete={autoComplete}\n className={classNames(\n styles.textfield,\n styles.md,\n styles.height,\n errorText &&\n (on === \"darkBackground\"\n ? styles.transparentInputError\n : styles.inputError),\n {\n [styles.transparent]: on === \"darkBackground\",\n },\n )}\n data-testid={dataTestId}\n disabled={disabled}\n id={inputId}\n maxLength={maxLength}\n type={type}\n onChange={onChange}\n placeholder={placeholder}\n value={value}\n step={step}\n />\n {endBadge && (\n <Box\n position=\"absolute\"\n dangerouslySetInlineStyle={{ __style: { top: \"25%\" } }}\n marginEnd={4}\n >\n <Badge\n text={endBadge}\n color={on === \"lightBackground\" ? \"gray370\" : \"gray870\"}\n />\n </Box>\n )}\n </Box>\n {(helperText || errorText) && (\n <Box paddingX={1}>\n <Typography size={100} color={errorText ? errorTextColor : textColor}>\n {errorText || helperText}\n </Typography>\n </Box>\n )}\n </Box>\n );\n}\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextField/TextField.module.css\"; export default {\"textfield\":\"_textfield_17wxq_1\",\"transparent\":\"_transparent_17wxq_20\",\"label\":\"_label_17wxq_36\",\"md\":\"_md_17wxq_40\",\"height\":\"_height_17wxq_44\",\"inputError\":\"_inputError_17wxq_48\",\"transparentInputError\":\"_transparentInputError_17wxq_57\",\"transparenInputError\":\"_transparenInputError_17wxq_62\"}"]}
@@ -0,0 +1,121 @@
1
+ "use client"
2
+ import {
3
+ Badge_default
4
+ } from "./DAIZZROA.js";
5
+ import {
6
+ Box_default
7
+ } from "./IB6JZQF3.js";
8
+ import {
9
+ Typography_default
10
+ } from "./RJQ2LSPP.js";
11
+ import {
12
+ useIsHydrated
13
+ } from "./JB65NEXK.js";
14
+
15
+ // src/TextField/TextField.tsx
16
+ import {
17
+ useId
18
+ } from "react";
19
+ import classNames from "classnames";
20
+
21
+ // css-module:./TextField.module.css#css-module
22
+ var TextField_module_default = { "textfield": "_textfield_17wxq_1", "transparent": "_transparent_17wxq_20", "label": "_label_17wxq_36", "md": "_md_17wxq_40", "height": "_height_17wxq_44", "inputError": "_inputError_17wxq_48", "transparentInputError": "_transparentInputError_17wxq_57", "transparenInputError": "_transparenInputError_17wxq_62" };
23
+
24
+ // src/TextField/TextField.tsx
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ function TextField({
27
+ autoComplete,
28
+ "data-testid": dataTestId,
29
+ disabled: disabledProp = false,
30
+ on = "lightBackground",
31
+ endBadge,
32
+ errorText = "",
33
+ helperText = "",
34
+ id,
35
+ label,
36
+ maxLength,
37
+ onChange,
38
+ placeholder = "",
39
+ type = "text",
40
+ value = "",
41
+ step
42
+ }) {
43
+ const isHydrated = useIsHydrated();
44
+ const disabled = !isHydrated || disabledProp;
45
+ const reactId = useId();
46
+ const inputId = id != null ? id : reactId;
47
+ const textColor = on === "darkBackground" ? "white" : "gray900";
48
+ const errorTextColor = on !== "darkBackground" ? "destructive-lightBackground" : "destructive-darkBackground";
49
+ return /* @__PURE__ */ jsxs(
50
+ Box_default,
51
+ {
52
+ display: "flex",
53
+ direction: "column",
54
+ gap: 2,
55
+ width: "100%",
56
+ dangerouslySetInlineStyle: {
57
+ __style: {
58
+ opacity: disabled ? 0.5 : 1
59
+ }
60
+ },
61
+ children: [
62
+ label && /* @__PURE__ */ jsx("label", { className: TextField_module_default.label, htmlFor: inputId, children: /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: textColor, children: label }) }) }),
63
+ /* @__PURE__ */ jsxs(
64
+ Box_default,
65
+ {
66
+ display: "flex",
67
+ position: "relative",
68
+ justifyContent: endBadge ? "end" : "start",
69
+ children: [
70
+ /* @__PURE__ */ jsx(
71
+ "input",
72
+ {
73
+ autoComplete,
74
+ className: classNames(
75
+ TextField_module_default.textfield,
76
+ TextField_module_default.md,
77
+ TextField_module_default.height,
78
+ errorText && (on === "darkBackground" ? TextField_module_default.transparentInputError : TextField_module_default.inputError),
79
+ {
80
+ [TextField_module_default.transparent]: on === "darkBackground"
81
+ }
82
+ ),
83
+ "data-testid": dataTestId,
84
+ disabled,
85
+ id: inputId,
86
+ maxLength,
87
+ type,
88
+ onChange,
89
+ placeholder,
90
+ value,
91
+ step
92
+ }
93
+ ),
94
+ endBadge && /* @__PURE__ */ jsx(
95
+ Box_default,
96
+ {
97
+ position: "absolute",
98
+ dangerouslySetInlineStyle: { __style: { top: "25%" } },
99
+ marginEnd: 4,
100
+ children: /* @__PURE__ */ jsx(
101
+ Badge_default,
102
+ {
103
+ text: endBadge,
104
+ color: on === "lightBackground" ? "gray370" : "gray870"
105
+ }
106
+ )
107
+ }
108
+ )
109
+ ]
110
+ }
111
+ ),
112
+ (helperText || errorText) && /* @__PURE__ */ jsx(Box_default, { paddingX: 1, children: /* @__PURE__ */ jsx(Typography_default, { size: 100, color: errorText ? errorTextColor : textColor, children: errorText || helperText }) })
113
+ ]
114
+ }
115
+ );
116
+ }
117
+
118
+ export {
119
+ TextField
120
+ };
121
+ //# sourceMappingURL=LHQQKL6Q.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TextField/TextField.tsx","css-module:./TextField.module.css#css-module"],"sourcesContent":["import React, {\n type ReactElement,\n type HTMLInputTypeAttribute,\n useId,\n} from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./TextField.module.css\";\nimport Box from \"../Box/Box\";\nimport Typography from \"../Typography/Typography\";\nimport useIsHydrated from \"../useIsHydrated\";\nimport Badge from \"../Badge/Badge\";\n\n/**\n * [TextField](https://cambly-syntax.vercel.app/?path=/docs/components-textfield--docs) is a component that allows users to enter text.\n */\nexport default function TextField({\n autoComplete,\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n on = \"lightBackground\",\n endBadge,\n errorText = \"\",\n helperText = \"\",\n id,\n label,\n maxLength,\n onChange,\n placeholder = \"\",\n type = \"text\",\n value = \"\",\n step,\n}: {\n /**\n * The autocomplete attribute specifies whether or not an input field should have autocomplete enabled.\n *\n * Feel free to add new values from the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) as needed\n */\n autoComplete?: \"current-password\" | \"new-password\" | \"off\" | \"on\" | \"email\";\n /**\n * A data-testid to make querying for the TextField easier.\n */\n \"data-testid\"?: string;\n /**\n * If true, the TextField will be disabled.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Indicate whether the component renders on a light or dark background. Changes the color of the input field, text and badge\n *\n * @defaulValue `lightBackground`\n */\n on?: \"lightBackground\" | \"darkBackground\";\n /**\n * Text for endBadge shown at the end of the input field.\n */\n endBadge?: string;\n /**\n * Text shown below TextField if there is an input error.\n */\n errorText?: string;\n /**\n * Informative helper text shown below TextField\n */\n helperText?: string;\n /**\n * TextField id, if not provided, a unique id will be generated\n */\n id?: string;\n /**\n * TextField visible label\n */\n label: string;\n /**\n * Maximum length of the TextField\n */\n maxLength?: number;\n /**\n * The callback to be called the input changes\n */\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n /**\n * Optional TextField placeholder text\n */\n placeholder?: string;\n /**\n * Input type of the TextField\n *\n * See [full list of input types](https://developer.mozilla.org/en-US/docs/Learn/Forms/HTML5_input_types)\n */\n type?: HTMLInputTypeAttribute;\n /**\n * Value of the TextField\n */\n value: string;\n /**\n * Specified legal number intervals for an input field. Specifically for time or number. If for time, specify in milliseconds. Must be a positive value.\n */\n step?: number;\n}): ReactElement {\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const reactId = useId();\n const inputId = id ?? reactId;\n const textColor = on === \"darkBackground\" ? \"white\" : \"gray900\";\n const errorTextColor =\n on !== \"darkBackground\"\n ? \"destructive-lightBackground\"\n : \"destructive-darkBackground\";\n return (\n <Box\n display=\"flex\"\n direction=\"column\"\n gap={2}\n width=\"100%\"\n dangerouslySetInlineStyle={{\n __style: {\n opacity: disabled ? 0.5 : 1,\n },\n }}\n >\n {label && (\n <label className={styles.label} htmlFor={inputId}>\n <Box paddingX={1}>\n <Typography size={100} color={textColor}>\n {label}\n </Typography>\n </Box>\n </label>\n )}\n <Box\n display=\"flex\"\n position=\"relative\"\n justifyContent={endBadge ? \"end\" : \"start\"}\n >\n <input\n autoComplete={autoComplete}\n className={classNames(\n styles.textfield,\n styles.md,\n styles.height,\n errorText &&\n (on === \"darkBackground\"\n ? styles.transparentInputError\n : styles.inputError),\n {\n [styles.transparent]: on === \"darkBackground\",\n },\n )}\n data-testid={dataTestId}\n disabled={disabled}\n id={inputId}\n maxLength={maxLength}\n type={type}\n onChange={onChange}\n placeholder={placeholder}\n value={value}\n step={step}\n />\n {endBadge && (\n <Box\n position=\"absolute\"\n dangerouslySetInlineStyle={{ __style: { top: \"25%\" } }}\n marginEnd={4}\n >\n <Badge\n text={endBadge}\n color={on === \"lightBackground\" ? \"gray370\" : \"gray870\"}\n />\n </Box>\n )}\n </Box>\n {(helperText || errorText) && (\n <Box paddingX={1}>\n <Typography size={100} color={errorText ? errorTextColor : textColor}>\n {errorText || helperText}\n </Typography>\n </Box>\n )}\n </Box>\n );\n}\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/TextField/TextField.module.css\"; export default {\"textfield\":\"_textfield_17wxq_1\",\"transparent\":\"_transparent_17wxq_20\",\"label\":\"_label_17wxq_36\",\"md\":\"_md_17wxq_40\",\"height\":\"_height_17wxq_44\",\"inputError\":\"_inputError_17wxq_48\",\"transparentInputError\":\"_transparentInputError_17wxq_57\",\"transparenInputError\":\"_transparenInputError_17wxq_62\"}"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,OACK;AACP,OAAO,gBAAgB;;;ACL2E,IAAO,2BAAQ,EAAC,aAAY,sBAAqB,eAAc,yBAAwB,SAAQ,mBAAkB,MAAK,gBAAe,UAAS,oBAAmB,cAAa,wBAAuB,yBAAwB,mCAAkC,wBAAuB,iCAAgC;;;AD6H5Y,cAMN,YANM;AA9GG,SAAR,UAA2B;AAAA,EAChC;AAAA,EACA,eAAe;AAAA,EACf,UAAU,eAAe;AAAA,EACzB,KAAK;AAAA,EACL;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AACF,GAqEiB;AACf,QAAM,aAAa,cAAc;AACjC,QAAM,WAAW,CAAC,cAAc;AAChC,QAAM,UAAU,MAAM;AACtB,QAAM,UAAU,kBAAM;AACtB,QAAM,YAAY,OAAO,mBAAmB,UAAU;AACtD,QAAM,iBACJ,OAAO,mBACH,gCACA;AACN,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,KAAK;AAAA,MACL,OAAM;AAAA,MACN,2BAA2B;AAAA,QACzB,SAAS;AAAA,UACP,SAAS,WAAW,MAAM;AAAA,QAC5B;AAAA,MACF;AAAA,MAEC;AAAA,iBACC,oBAAC,WAAM,WAAW,yBAAO,OAAO,SAAS,SACvC,8BAAC,eAAI,UAAU,GACb,8BAAC,sBAAW,MAAM,KAAK,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