@purpur/library 9.7.5 → 9.8.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 (167) hide show
  1. package/CHANGELOG.json +27 -0
  2. package/CHANGELOG.md +13 -1
  3. package/dist/LICENSE.txt +7 -7
  4. package/dist/{ThemeProvider-DiDBfyFA.mjs → ThemeProvider-BJ25_asg.mjs} +13 -13
  5. package/dist/{ThemeProvider-DiDBfyFA.mjs.map → ThemeProvider-BJ25_asg.mjs.map} +1 -1
  6. package/dist/{ThemeProvider-D7oXcAde.js → ThemeProvider-BJGm3zai.js} +2 -2
  7. package/dist/{ThemeProvider-D7oXcAde.js.map → ThemeProvider-BJGm3zai.js.map} +1 -1
  8. package/dist/{autocomplete-BEGRn-Wh.mjs → autocomplete-A9-Ni60G.mjs} +2 -2
  9. package/dist/{autocomplete-BEGRn-Wh.mjs.map → autocomplete-A9-Ni60G.mjs.map} +1 -1
  10. package/dist/{autocomplete-3kV1btuI.js → autocomplete-Bbth0nDG.js} +2 -2
  11. package/dist/{autocomplete-3kV1btuI.js.map → autocomplete-Bbth0nDG.js.map} +1 -1
  12. package/dist/autocomplete.cjs.js +1 -1
  13. package/dist/autocomplete.es.js +1 -1
  14. package/dist/components/accordion/src/accordion.visual.fixtures.d.ts +13 -0
  15. package/dist/components/accordion/src/accordion.visual.fixtures.d.ts.map +1 -0
  16. package/dist/components/badge/src/badge.visual.fixtures.d.ts +13 -0
  17. package/dist/components/badge/src/badge.visual.fixtures.d.ts.map +1 -0
  18. package/dist/components/footer/src/telia-logo.d.ts.map +1 -1
  19. package/dist/components/hero-banner/src/hero-banner-types.d.ts +48 -0
  20. package/dist/components/hero-banner/src/hero-banner-types.d.ts.map +1 -0
  21. package/dist/components/hero-banner/src/hero-banner.d.ts +5 -48
  22. package/dist/components/hero-banner/src/hero-banner.d.ts.map +1 -1
  23. package/dist/components/hero-banner/src/hero-banner.visual.fixtures.d.ts +1 -1
  24. package/dist/components/hero-banner/src/hero-banner.visual.fixtures.d.ts.map +1 -1
  25. package/dist/components-metadata.js +2 -2
  26. package/dist/{date-field-BKKty89_.js → date-field-CKxEWHG3.js} +2 -2
  27. package/dist/{date-field-BKKty89_.js.map → date-field-CKxEWHG3.js.map} +1 -1
  28. package/dist/{date-field-Cv5CKR1y.mjs → date-field-HEFdHIxk.mjs} +2 -2
  29. package/dist/{date-field-Cv5CKR1y.mjs.map → date-field-HEFdHIxk.mjs.map} +1 -1
  30. package/dist/date-field.cjs.js +1 -1
  31. package/dist/date-field.es.js +1 -1
  32. package/dist/{date-picker-CIizn3Pv.js → date-picker-CDBwkAJI.js} +2 -2
  33. package/dist/{date-picker-CIizn3Pv.js.map → date-picker-CDBwkAJI.js.map} +1 -1
  34. package/dist/{date-picker-DixxW60s.mjs → date-picker-cQewKIMN.mjs} +6 -6
  35. package/dist/{date-picker-DixxW60s.mjs.map → date-picker-cQewKIMN.mjs.map} +1 -1
  36. package/dist/date-picker.cjs.js +1 -1
  37. package/dist/date-picker.es.js +1 -1
  38. package/dist/{date-range-field-D8vLeSwp.js → date-range-field-D7Hn9FGN.js} +2 -2
  39. package/dist/{date-range-field-D8vLeSwp.js.map → date-range-field-D7Hn9FGN.js.map} +1 -1
  40. package/dist/{date-range-field-CFcjprIl.mjs → date-range-field-_WctWD29.mjs} +2 -2
  41. package/dist/{date-range-field-CFcjprIl.mjs.map → date-range-field-_WctWD29.mjs.map} +1 -1
  42. package/dist/date-range-field.cjs.js +1 -1
  43. package/dist/date-range-field.es.js +1 -1
  44. package/dist/{drawer-DyhsP34o.js → drawer-DyLQfvEh.js} +2 -2
  45. package/dist/{drawer-DyhsP34o.js.map → drawer-DyLQfvEh.js.map} +1 -1
  46. package/dist/{drawer-BzkRd9F0.mjs → drawer-cIUx6WSZ.mjs} +3 -3
  47. package/dist/{drawer-BzkRd9F0.mjs.map → drawer-cIUx6WSZ.mjs.map} +1 -1
  48. package/dist/drawer.cjs.js +1 -1
  49. package/dist/drawer.es.js +1 -1
  50. package/dist/{footer-DenAcikt.mjs → footer-BMlXRro2.mjs} +86 -96
  51. package/dist/footer-BMlXRro2.mjs.map +1 -0
  52. package/dist/footer-cet787Iq.js +2 -0
  53. package/dist/footer-cet787Iq.js.map +1 -0
  54. package/dist/footer.cjs.js +1 -1
  55. package/dist/footer.es.js +1 -1
  56. package/dist/{hero-banner-B7xrDfzN.mjs → hero-banner-B08jC0Sf.mjs} +77 -77
  57. package/dist/hero-banner-B08jC0Sf.mjs.map +1 -0
  58. package/dist/hero-banner-D__doaU7.js +2 -0
  59. package/dist/hero-banner-D__doaU7.js.map +1 -0
  60. package/dist/hero-banner.cjs.js +1 -1
  61. package/dist/hero-banner.es.js +1 -1
  62. package/dist/library.cjs.js +1 -1
  63. package/dist/library.es.js +21 -21
  64. package/dist/{modal-DJn9idcw.js → modal-CmPPxJ7Y.js} +2 -2
  65. package/dist/{modal-DJn9idcw.js.map → modal-CmPPxJ7Y.js.map} +1 -1
  66. package/dist/{modal-EIP36327.mjs → modal-Evh8sCBO.mjs} +3 -3
  67. package/dist/{modal-EIP36327.mjs.map → modal-Evh8sCBO.mjs.map} +1 -1
  68. package/dist/modal.cjs.js +1 -1
  69. package/dist/modal.es.js +1 -1
  70. package/dist/{popover-DERrvReO.mjs → popover-BSUdf0Ae.mjs} +3 -3
  71. package/dist/{popover-DERrvReO.mjs.map → popover-BSUdf0Ae.mjs.map} +1 -1
  72. package/dist/{popover-DnGgzfQr.js → popover-XJqF5DHT.js} +2 -2
  73. package/dist/{popover-DnGgzfQr.js.map → popover-XJqF5DHT.js.map} +1 -1
  74. package/dist/popover.cjs.js +1 -1
  75. package/dist/popover.es.js +1 -1
  76. package/dist/{promotion-card-DKc2Cx1h.js → promotion-card-BnXD2mkp.js} +2 -2
  77. package/dist/{promotion-card-DKc2Cx1h.js.map → promotion-card-BnXD2mkp.js.map} +1 -1
  78. package/dist/{promotion-card-BnzIVNQ4.mjs → promotion-card-DOO0VCI8.mjs} +2 -2
  79. package/dist/{promotion-card-BnzIVNQ4.mjs.map → promotion-card-DOO0VCI8.mjs.map} +1 -1
  80. package/dist/promotion-card.cjs.js +1 -1
  81. package/dist/promotion-card.es.js +1 -1
  82. package/dist/purpur.css +1 -1
  83. package/dist/{quantity-selector-CvBvnMeB.mjs → quantity-selector-B4YnfmNb.mjs} +2 -2
  84. package/dist/{quantity-selector-CvBvnMeB.mjs.map → quantity-selector-B4YnfmNb.mjs.map} +1 -1
  85. package/dist/{quantity-selector-CDSfcTb1.js → quantity-selector-CTBoxiPO.js} +2 -2
  86. package/dist/{quantity-selector-CDSfcTb1.js.map → quantity-selector-CTBoxiPO.js.map} +1 -1
  87. package/dist/quantity-selector.cjs.js +1 -1
  88. package/dist/quantity-selector.es.js +1 -1
  89. package/dist/{search-field-DKyNh7pE.mjs → search-field-_h8xn-sj.mjs} +2 -2
  90. package/dist/{search-field-DKyNh7pE.mjs.map → search-field-_h8xn-sj.mjs.map} +1 -1
  91. package/dist/{search-field-2vdDbiT0.js → search-field-vh6uz5KV.js} +2 -2
  92. package/dist/{search-field-2vdDbiT0.js.map → search-field-vh6uz5KV.js.map} +1 -1
  93. package/dist/search-field.cjs.js +1 -1
  94. package/dist/search-field.es.js +1 -1
  95. package/dist/{stepper-e0qicwqd.mjs → stepper-B-nCLs2D.mjs} +2 -2
  96. package/dist/{stepper-e0qicwqd.mjs.map → stepper-B-nCLs2D.mjs.map} +1 -1
  97. package/dist/{stepper-5qMo_shq.js → stepper-CTKlnH0q.js} +2 -2
  98. package/dist/{stepper-5qMo_shq.js.map → stepper-CTKlnH0q.js.map} +1 -1
  99. package/dist/stepper.cjs.js +1 -1
  100. package/dist/stepper.es.js +1 -1
  101. package/dist/{table-i1Gs9e0e.mjs → table-DOPXfD-s.mjs} +6 -6
  102. package/dist/{table-i1Gs9e0e.mjs.map → table-DOPXfD-s.mjs.map} +1 -1
  103. package/dist/{table-BOCcBzSO.js → table-DTQe4nN8.js} +2 -2
  104. package/dist/{table-BOCcBzSO.js.map → table-DTQe4nN8.js.map} +1 -1
  105. package/dist/table.cjs.js +1 -1
  106. package/dist/table.es.js +1 -1
  107. package/dist/{text-area-D0truMT1.js → text-area-9RUldq6W.js} +2 -2
  108. package/dist/{text-area-D0truMT1.js.map → text-area-9RUldq6W.js.map} +1 -1
  109. package/dist/{text-area-IVH-k4MM.mjs → text-area-C58aZEPa.mjs} +3 -3
  110. package/dist/{text-area-IVH-k4MM.mjs.map → text-area-C58aZEPa.mjs.map} +1 -1
  111. package/dist/text-area.cjs.js +1 -1
  112. package/dist/text-area.es.js +1 -1
  113. package/dist/text-field-C2W13n15.js +2 -0
  114. package/dist/{text-field-CYJzQG3h.js.map → text-field-C2W13n15.js.map} +1 -1
  115. package/dist/{text-field-BQfxJobW.mjs → text-field-D8MMa6ij.mjs} +114 -114
  116. package/dist/{text-field-BQfxJobW.mjs.map → text-field-D8MMa6ij.mjs.map} +1 -1
  117. package/dist/text-field.cjs.js +1 -1
  118. package/dist/text-field.es.js +1 -1
  119. package/dist/theme.cjs.js +1 -1
  120. package/dist/theme.es.js +3 -3
  121. package/dist/tokens/color/variables.css +1 -1
  122. package/dist/tokens/color/variables.dark.css +1 -1
  123. package/dist/tokens/color/variables.dark.js +1 -1
  124. package/dist/tokens/color/variables.dark.json +1 -1
  125. package/dist/tokens/color/variables.dark.scss +1 -1
  126. package/dist/tokens/color/variables.js +1 -1
  127. package/dist/tokens/color/variables.json +1 -1
  128. package/dist/tokens/color/variables.scss +1 -1
  129. package/dist/tokens.cjs.js +1 -1
  130. package/dist/tokens.es.js +1 -1
  131. package/dist/{tooltip-CJGmJDFQ.js → tooltip-CDnJKoIA.js} +2 -2
  132. package/dist/{tooltip-CJGmJDFQ.js.map → tooltip-CDnJKoIA.js.map} +1 -1
  133. package/dist/{tooltip-RA-03bKs.mjs → tooltip-pwJMEBBP.mjs} +3 -3
  134. package/dist/{tooltip-RA-03bKs.mjs.map → tooltip-pwJMEBBP.mjs.map} +1 -1
  135. package/dist/tooltip.cjs.js +1 -1
  136. package/dist/tooltip.es.js +1 -1
  137. package/dist/{useColorScheme-B9DWd-LN.mjs → useColorScheme-B7lGBSe4.mjs} +2 -2
  138. package/dist/{useColorScheme-B9DWd-LN.mjs.map → useColorScheme-B7lGBSe4.mjs.map} +1 -1
  139. package/dist/useColorScheme-BHhPgv9q.js +2 -0
  140. package/dist/{useColorScheme-DbTQjxNB.js.map → useColorScheme-BHhPgv9q.js.map} +1 -1
  141. package/dist/useThemePortalContainer-CUcqV327.js +2 -0
  142. package/dist/{useThemePortalContainer-D9BYjEvT.js.map → useThemePortalContainer-CUcqV327.js.map} +1 -1
  143. package/dist/useThemePortalContainer-D13Xx24N.mjs +9 -0
  144. package/dist/{useThemePortalContainer-tFLTaYKN.mjs.map → useThemePortalContainer-D13Xx24N.mjs.map} +1 -1
  145. package/dist/{variables-B5hbV0Uy.mjs → variables-BrsAsWIF.mjs} +2 -2
  146. package/dist/{variables-B5hbV0Uy.mjs.map → variables-BrsAsWIF.mjs.map} +1 -1
  147. package/dist/{variables-DoI78zZc.js → variables-D1vNo1lO.js} +2 -2
  148. package/dist/{variables-DoI78zZc.js.map → variables-D1vNo1lO.js.map} +1 -1
  149. package/package.json +23 -23
  150. package/tokens/color/variables.css +1 -1
  151. package/tokens/color/variables.dark.css +1 -1
  152. package/tokens/color/variables.dark.js +1 -1
  153. package/tokens/color/variables.dark.json +1 -1
  154. package/tokens/color/variables.dark.scss +1 -1
  155. package/tokens/color/variables.js +1 -1
  156. package/tokens/color/variables.json +1 -1
  157. package/tokens/color/variables.scss +1 -1
  158. package/dist/footer-3Y-664-8.js +0 -2
  159. package/dist/footer-3Y-664-8.js.map +0 -1
  160. package/dist/footer-DenAcikt.mjs.map +0 -1
  161. package/dist/hero-banner-B7xrDfzN.mjs.map +0 -1
  162. package/dist/hero-banner-DthITuQ7.js +0 -2
  163. package/dist/hero-banner-DthITuQ7.js.map +0 -1
  164. package/dist/text-field-CYJzQG3h.js +0 -2
  165. package/dist/useColorScheme-DbTQjxNB.js +0 -2
  166. package/dist/useThemePortalContainer-D9BYjEvT.js +0 -2
  167. package/dist/useThemePortalContainer-tFLTaYKN.mjs +0 -9
package/dist/table.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./table-BOCcBzSO.js");exports.Table=e.Table;exports.createColumnHelper=e.createColumnHelper;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./table-DTQe4nN8.js");exports.Table=e.Table;exports.createColumnHelper=e.createColumnHelper;
2
2
  //# sourceMappingURL=table.cjs.js.map
package/dist/table.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { T as r, c as l } from "./table-i1Gs9e0e.mjs";
1
+ import { T as r, c as l } from "./table-DOPXfD-s.mjs";
2
2
  export {
3
3
  r as Table,
4
4
  l as createColumnHelper
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("react/jsx-runtime"),j=require("react"),y=require("./field-error-text-FhQulSV5.js"),O=require("./field-helper-text-DSKO-Tce.js"),R=require("./label-yHK80hhV.js");require("./ThemeProvider-D7oXcAde.js");const T=require("./useColorScheme-DbTQjxNB.js"),A=require("./bind-DeUYJ6m9.js"),s={"purpur-text-area":"_purpur-text-area_1qqf0_1","purpur-text-area__label":"_purpur-text-area__label_1qqf0_8","purpur-text-area__label-text":"_purpur-text-area__label-text_1qqf0_13","purpur-text-area__frame":"_purpur-text-area__frame_1qqf0_16","purpur-text-area__textarea-container":"_purpur-text-area__textarea-container_1qqf0_23","purpur-text-area__textarea-container--disabled":"_purpur-text-area__textarea-container--disabled_1qqf0_33","purpur-text-area__textarea-container--readonly":"_purpur-text-area__textarea-container--readonly_1qqf0_36","purpur-text-area__textarea":"_purpur-text-area__textarea_1qqf0_23","purpur-text-area__textarea--light":"_purpur-text-area__textarea--light_1qqf0_52","purpur-text-area__textarea--dark":"_purpur-text-area__textarea--dark_1qqf0_60","purpur-text-area__textarea--valid":"_purpur-text-area__textarea--valid_1qqf0_91","purpur-text-area__textarea--error":"_purpur-text-area__textarea--error_1qqf0_91"},c={NONE:"none",BOTH:"both",HORIZONTAL:"horizontal",VERTICAL:"vertical"},l=A.c.bind(s),e="purpur-text-area",p=j.forwardRef(({id:i,["data-testid"]:x,className:o,errorText:r,helperText:n,label:d,rows:q=3,cols:b=90,resize:f=c.BOTH,style:h,...a},m)=>{const[$]=T.useColorScheme(),_=N=>x?`${x}-${N}`:void 0,u=n?`${i}-helper-text`:void 0,v=l(`${e}__textarea-container`,{[`${e}__textarea-container--disabled`]:a.disabled,[`${e}__textarea-container--readonly`]:a.readOnly&&!a.disabled});return t.jsxs("div",{className:l(o,e),"data-testid":x,children:[d&&t.jsxs(R.Label,{htmlFor:i,disabled:a.disabled,className:s[`${e}__label`],"data-testid":_("label"),children:[a.required&&t.jsx("span",{"aria-hidden":!0,children:"*"}),d]}),t.jsxs("div",{className:v,children:[t.jsx("textarea",{...a,ref:m,id:i,"data-testid":_("textarea"),"aria-describedby":a["aria-describedby"]||u,"aria-invalid":a["aria-invalid"]||!!r,className:l(`${e}__textarea`,`${e}__textarea--${$}`,{[`${e}__textarea--error`]:!!r}),rows:q,cols:b,style:{resize:f,...h}}),t.jsx("div",{className:s[`${e}__frame`]})]}),u&&t.jsx(O.FieldHelperText,{"data-testid":_("helper-text"),id:u,children:n}),r&&t.jsx(y.FieldErrorText,{"data-testid":_("error-text"),children:r})]})});p.displayName="TextArea";exports.ResizeOption=c;exports.TextArea=p;
2
- //# sourceMappingURL=text-area-D0truMT1.js.map
1
+ "use strict";const t=require("react/jsx-runtime"),j=require("react"),y=require("./field-error-text-FhQulSV5.js"),O=require("./field-helper-text-DSKO-Tce.js"),R=require("./label-yHK80hhV.js");require("./ThemeProvider-BJGm3zai.js");const T=require("./useColorScheme-BHhPgv9q.js"),A=require("./bind-DeUYJ6m9.js"),s={"purpur-text-area":"_purpur-text-area_1qqf0_1","purpur-text-area__label":"_purpur-text-area__label_1qqf0_8","purpur-text-area__label-text":"_purpur-text-area__label-text_1qqf0_13","purpur-text-area__frame":"_purpur-text-area__frame_1qqf0_16","purpur-text-area__textarea-container":"_purpur-text-area__textarea-container_1qqf0_23","purpur-text-area__textarea-container--disabled":"_purpur-text-area__textarea-container--disabled_1qqf0_33","purpur-text-area__textarea-container--readonly":"_purpur-text-area__textarea-container--readonly_1qqf0_36","purpur-text-area__textarea":"_purpur-text-area__textarea_1qqf0_23","purpur-text-area__textarea--light":"_purpur-text-area__textarea--light_1qqf0_52","purpur-text-area__textarea--dark":"_purpur-text-area__textarea--dark_1qqf0_60","purpur-text-area__textarea--valid":"_purpur-text-area__textarea--valid_1qqf0_91","purpur-text-area__textarea--error":"_purpur-text-area__textarea--error_1qqf0_91"},c={NONE:"none",BOTH:"both",HORIZONTAL:"horizontal",VERTICAL:"vertical"},l=A.c.bind(s),e="purpur-text-area",p=j.forwardRef(({id:i,["data-testid"]:x,className:o,errorText:r,helperText:n,label:d,rows:q=3,cols:b=90,resize:f=c.BOTH,style:h,...a},m)=>{const[$]=T.useColorScheme(),_=N=>x?`${x}-${N}`:void 0,u=n?`${i}-helper-text`:void 0,v=l(`${e}__textarea-container`,{[`${e}__textarea-container--disabled`]:a.disabled,[`${e}__textarea-container--readonly`]:a.readOnly&&!a.disabled});return t.jsxs("div",{className:l(o,e),"data-testid":x,children:[d&&t.jsxs(R.Label,{htmlFor:i,disabled:a.disabled,className:s[`${e}__label`],"data-testid":_("label"),children:[a.required&&t.jsx("span",{"aria-hidden":!0,children:"*"}),d]}),t.jsxs("div",{className:v,children:[t.jsx("textarea",{...a,ref:m,id:i,"data-testid":_("textarea"),"aria-describedby":a["aria-describedby"]||u,"aria-invalid":a["aria-invalid"]||!!r,className:l(`${e}__textarea`,`${e}__textarea--${$}`,{[`${e}__textarea--error`]:!!r}),rows:q,cols:b,style:{resize:f,...h}}),t.jsx("div",{className:s[`${e}__frame`]})]}),u&&t.jsx(O.FieldHelperText,{"data-testid":_("helper-text"),id:u,children:n}),r&&t.jsx(y.FieldErrorText,{"data-testid":_("error-text"),children:r})]})});p.displayName="TextArea";exports.ResizeOption=c;exports.TextArea=p;
2
+ //# sourceMappingURL=text-area-9RUldq6W.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-area-D0truMT1.js","sources":["../../../components/text-area/src/text-area.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { Label } from \"@purpur/label\";\nimport { useColorScheme } from \"@purpur/theme\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./text-area.module.scss\";\n\nexport const ResizeOption = {\n NONE: \"none\",\n BOTH: \"both\",\n HORIZONTAL: \"horizontal\",\n VERTICAL: \"vertical\",\n} as const;\n\nexport type ResizeOption = (typeof ResizeOption)[keyof typeof ResizeOption];\n\nexport type TextAreaProps = Omit<BaseProps<\"textarea\">, \"id\"> & {\n id: string;\n /**\n * Use to render error message below the text area. The text area renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the text area's input. Renders below the text area.\n * */\n helperText?: string;\n /**\n * The label of the text area.\n * */\n label?: string;\n /**\n * The height of the text area, measured in number of rows.\n * */\n rows?: number;\n /**\n * The width of the text area, measured in number of cols.\n * */\n cols?: number;\n /**\n * Controls whether the text area can be resized, and in which direction.\n * */\n resize?: ResizeOption;\n};\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-text-area\";\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n id,\n [\"data-testid\"]: dataTestId,\n className,\n errorText,\n helperText,\n label,\n rows = 3,\n cols = 90,\n resize = ResizeOption.BOTH,\n style,\n ...props\n },\n ref\n ) => {\n const [colorScheme] = useColorScheme();\n\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const textAreaContainerClassnames = cx(`${rootClassName}__textarea-container`, {\n [`${rootClassName}__textarea-container--disabled`]: props.disabled,\n [`${rootClassName}__textarea-container--readonly`]: props.readOnly && !props.disabled,\n });\n\n return (\n <div className={cx(className, rootClassName)} data-testid={dataTestId}>\n {label && (\n <Label\n htmlFor={id}\n disabled={props.disabled}\n className={styles[`${rootClassName}__label`]}\n data-testid={getTestId(\"label\")}\n >\n {props.required && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={textAreaContainerClassnames}>\n <textarea\n {...props}\n ref={ref}\n id={id}\n data-testid={getTestId(\"textarea\")}\n aria-describedby={props[\"aria-describedby\"] || helperTextId}\n aria-invalid={props[\"aria-invalid\"] || !!errorText}\n className={cx(\n `${rootClassName}__textarea`,\n `${rootClassName}__textarea--${colorScheme}`,\n {\n [`${rootClassName}__textarea--error`]: !!errorText,\n }\n )}\n rows={rows}\n cols={cols}\n style={{ resize, ...style }}\n />\n <div className={styles[`${rootClassName}__frame`]} />\n </div>\n {helperTextId && (\n <FieldHelperText data-testid={getTestId(\"helper-text\")} id={helperTextId}>\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")}>{errorText}</FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["ResizeOption","cx","c","styles","rootClassName","TextArea","forwardRef","id","dataTestId","className","errorText","helperText","label","rows","cols","resize","style","props","ref","colorScheme","useColorScheme","getTestId","name","helperTextId","textAreaContainerClassnames","jsxs","Label","jsx","FieldHelperText","FieldErrorText"],"mappings":"suCAUaA,EAAe,CAC1B,KAAM,OACN,KAAM,OACN,WAAY,aACZ,SAAU,UACZ,EAgCMC,EAAKC,EAAAA,EAAE,KAAKC,CAAM,EAClBC,EAAgB,mBAETC,EAAWC,EAAAA,WACtB,CACE,CACE,GAAAC,EACA,CAAC,eAAgBC,EACjB,UAAAC,EACA,UAAAC,EACA,WAAAC,EAAA,M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SAAS,CAAA,CAAG,CAAA,EACrD,EACCmB,SACEK,kBAAA,CAAgB,cAAaP,EAAU,aAAa,EAAG,GAAIE,EACzD,SAAAZ,CAAA,CACH,EAEDD,GACCiB,EAAAA,IAACE,EAAAA,eAAA,CAAe,cAAaR,EAAU,YAAY,EAAI,SAAAX,CAAA,CAAU,CAAA,EAErE,CAEJ,CACF,EAEAL,EAAS,YAAc"}
1
+ {"version":3,"file":"text-area-9RUldq6W.js","sources":["../../../components/text-area/src/text-area.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { Label } from \"@purpur/label\";\nimport { useColorScheme } from \"@purpur/theme\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./text-area.module.scss\";\n\nexport const ResizeOption = {\n NONE: \"none\",\n BOTH: \"both\",\n HORIZONTAL: \"horizontal\",\n VERTICAL: \"vertical\",\n} as const;\n\nexport type ResizeOption = (typeof ResizeOption)[keyof typeof ResizeOption];\n\nexport type TextAreaProps = Omit<BaseProps<\"textarea\">, \"id\"> & {\n id: string;\n /**\n * Use to render error message below the text area. The text area renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the text area's input. Renders below the text area.\n * */\n helperText?: string;\n /**\n * The label of the text area.\n * */\n label?: string;\n /**\n * The height of the text area, measured in number of rows.\n * */\n rows?: number;\n /**\n * The width of the text area, measured in number of cols.\n * */\n cols?: number;\n /**\n * Controls whether the text area can be resized, and in which direction.\n * */\n resize?: ResizeOption;\n};\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-text-area\";\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n id,\n [\"data-testid\"]: dataTestId,\n className,\n errorText,\n helperText,\n label,\n rows = 3,\n cols = 90,\n resize = ResizeOption.BOTH,\n style,\n ...props\n },\n ref\n ) => {\n const [colorScheme] = useColorScheme();\n\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const textAreaContainerClassnames = cx(`${rootClassName}__textarea-container`, {\n [`${rootClassName}__textarea-container--disabled`]: props.disabled,\n [`${rootClassName}__textarea-container--readonly`]: props.readOnly && !props.disabled,\n });\n\n return (\n <div className={cx(className, rootClassName)} data-testid={dataTestId}>\n {label && (\n <Label\n htmlFor={id}\n disabled={props.disabled}\n className={styles[`${rootClassName}__label`]}\n data-testid={getTestId(\"label\")}\n >\n {props.required && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={textAreaContainerClassnames}>\n <textarea\n {...props}\n ref={ref}\n id={id}\n data-testid={getTestId(\"textarea\")}\n aria-describedby={props[\"aria-describedby\"] || helperTextId}\n aria-invalid={props[\"aria-invalid\"] || !!errorText}\n className={cx(\n `${rootClassName}__textarea`,\n `${rootClassName}__textarea--${colorScheme}`,\n {\n [`${rootClassName}__textarea--error`]: !!errorText,\n }\n )}\n rows={rows}\n cols={cols}\n style={{ resize, ...style }}\n />\n <div className={styles[`${rootClassName}__frame`]} />\n </div>\n {helperTextId && (\n <FieldHelperText data-testid={getTestId(\"helper-text\")} id={helperTextId}>\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")}>{errorText}</FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["ResizeOption","cx","c","styles","rootClassName","TextArea","forwardRef","id","dataTestId","className","errorText","helperText","label","rows","cols","resize","style","props","ref","colorScheme","useColorScheme","getTestId","name","helperTextId","textAreaContainerClassnames","jsxs","Label","jsx","FieldHelperText","FieldErrorText"],"mappings":"suCAUaA,EAAe,CAC1B,KAAM,OACN,KAAM,OACN,WAAY,aACZ,SAAU,UACZ,EAgCMC,EAAKC,EAAAA,EAAE,KAAKC,CAAM,EAClBC,EAAgB,mBAETC,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ACA,MAAO,CAAE,OAAAC,EAAQ,GAAGC,CAAA,CAAM,CAAA,QAE3B,MAAA,CAAI,UAAWb,EAAO,GAAGC,CAAa,SAAS,CAAA,CAAG,CAAA,EACrD,EACCmB,SACEK,kBAAA,CAAgB,cAAaP,EAAU,aAAa,EAAG,GAAIE,EACzD,SAAAZ,CAAA,CACH,EAEDD,GACCiB,EAAAA,IAACE,EAAAA,eAAA,CAAe,cAAaR,EAAU,YAAY,EAAI,SAAAX,CAAA,CAAU,CAAA,EAErE,CAEJ,CACF,EAEAL,EAAS,YAAc"}
@@ -3,8 +3,8 @@ import { forwardRef as N } from "react";
3
3
  import { F as y } from "./field-error-text-CBSX8dGx.mjs";
4
4
  import { F as O } from "./field-helper-text-C5ee4SFV.mjs";
5
5
  import { L as A } from "./label-7sJe5-pX.mjs";
6
- import "./ThemeProvider-DiDBfyFA.mjs";
7
- import { u as C } from "./useColorScheme-B9DWd-LN.mjs";
6
+ import "./ThemeProvider-BJ25_asg.mjs";
7
+ import { u as C } from "./useColorScheme-B7lGBSe4.mjs";
8
8
  import { c as F } from "./bind-CU-R61T-.mjs";
9
9
  const p = {
10
10
  "purpur-text-area": "_purpur-text-area_1qqf0_1",
@@ -90,4 +90,4 @@ export {
90
90
  R,
91
91
  T
92
92
  };
93
- //# sourceMappingURL=text-area-IVH-k4MM.mjs.map
93
+ //# sourceMappingURL=text-area-C58aZEPa.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-area-IVH-k4MM.mjs","sources":["../../../components/text-area/src/text-area.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { Label } from \"@purpur/label\";\nimport { useColorScheme } from \"@purpur/theme\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./text-area.module.scss\";\n\nexport const ResizeOption = {\n NONE: \"none\",\n BOTH: \"both\",\n HORIZONTAL: \"horizontal\",\n VERTICAL: \"vertical\",\n} as const;\n\nexport type ResizeOption = (typeof ResizeOption)[keyof typeof ResizeOption];\n\nexport type TextAreaProps = Omit<BaseProps<\"textarea\">, \"id\"> & {\n id: string;\n /**\n * Use to render error message below the text area. The text area renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the text area's input. Renders below the text area.\n * */\n helperText?: string;\n /**\n * The label of the text area.\n * */\n label?: string;\n /**\n * The height of the text area, measured in number of rows.\n * */\n rows?: number;\n /**\n * The width of the text area, measured in number of cols.\n * */\n cols?: number;\n /**\n * Controls whether the text area can be resized, and in which direction.\n * */\n resize?: ResizeOption;\n};\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-text-area\";\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n id,\n [\"data-testid\"]: dataTestId,\n className,\n errorText,\n helperText,\n label,\n rows = 3,\n cols = 90,\n resize = ResizeOption.BOTH,\n style,\n ...props\n },\n ref\n ) => {\n const [colorScheme] = useColorScheme();\n\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const textAreaContainerClassnames = cx(`${rootClassName}__textarea-container`, {\n [`${rootClassName}__textarea-container--disabled`]: props.disabled,\n [`${rootClassName}__textarea-container--readonly`]: props.readOnly && !props.disabled,\n });\n\n return (\n <div className={cx(className, rootClassName)} data-testid={dataTestId}>\n {label && (\n <Label\n htmlFor={id}\n disabled={props.disabled}\n className={styles[`${rootClassName}__label`]}\n data-testid={getTestId(\"label\")}\n >\n {props.required && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={textAreaContainerClassnames}>\n <textarea\n {...props}\n ref={ref}\n id={id}\n data-testid={getTestId(\"textarea\")}\n aria-describedby={props[\"aria-describedby\"] || helperTextId}\n aria-invalid={props[\"aria-invalid\"] || !!errorText}\n className={cx(\n `${rootClassName}__textarea`,\n `${rootClassName}__textarea--${colorScheme}`,\n {\n [`${rootClassName}__textarea--error`]: !!errorText,\n }\n )}\n rows={rows}\n cols={cols}\n style={{ resize, ...style }}\n />\n <div className={styles[`${rootClassName}__frame`]} />\n </div>\n {helperTextId && (\n <FieldHelperText data-testid={getTestId(\"helper-text\")} id={helperTextId}>\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")}>{errorText}</FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["ResizeOption","cx","c","styles","rootClassName","TextArea","forwardRef","id","dataTestId","className","errorText","helperText","label","rows","cols","resize","style","props","ref","colorScheme","useColorScheme","getTestId","name","helperTextId","textAreaContainerClassnames","jsxs","Label","jsx","FieldHelperText","FieldErrorText"],"mappings":";;;;;;;;;;;;;;;;;;;;;GAUaA,IAAe;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,UAAU;AACZ,GAgCMC,IAAKC,EAAE,KAAKC,CAAM,GAClBC,IAAgB,oBAETC,IAAWC;AAAA,EACtB,CACE;AAAA,IACE,IAAAC;AAAA,IACA,CAAC,gBAAgBC;AAAA,IACjB,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,MAAAC,IAAO;AAAA,IACP,QAAAC,IAASf,EAAa;AAAA,IACtB,OAAAgB;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,CAACC,CAAW,IAAIC,EAAA,GAEhBC,IAAY,CAACC,MAAkBd,IAAa,GAAGA,CAAU,IAAIc,CAAI,KAAK,QAEtEC,IAAeZ,IAAa,GAAGJ,CAAE,iBAAiB,QAElDiB,IAA8BvB,EAAG,GAAGG,CAAa,wBAAwB;AAAA,MAC7E,CAAC,GAAGA,CAAa,gCAAgC,GAAGa,EAAM;AAAA,MAC1D,CAAC,GAA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DD,KACC,gBAAAiB,EAACE,GAAA,EAAe,eAAaR,EAAU,YAAY,GAAI,UAAAX,EAAA,CAAU;AAAA,IAAA,GAErE;AAAA,EAEJ;AACF;AAEAL,EAAS,cAAc;"}
1
+ {"version":3,"file":"text-area-C58aZEPa.mjs","sources":["../../../components/text-area/src/text-area.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { Label } from \"@purpur/label\";\nimport { useColorScheme } from \"@purpur/theme\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./text-area.module.scss\";\n\nexport const ResizeOption = {\n NONE: \"none\",\n BOTH: \"both\",\n HORIZONTAL: \"horizontal\",\n VERTICAL: \"vertical\",\n} as const;\n\nexport type ResizeOption = (typeof ResizeOption)[keyof typeof ResizeOption];\n\nexport type TextAreaProps = Omit<BaseProps<\"textarea\">, \"id\"> & {\n id: string;\n /**\n * Use to render error message below the text area. The text area renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the text area's input. Renders below the text area.\n * */\n helperText?: string;\n /**\n * The label of the text area.\n * */\n label?: string;\n /**\n * The height of the text area, measured in number of rows.\n * */\n rows?: number;\n /**\n * The width of the text area, measured in number of cols.\n * */\n cols?: number;\n /**\n * Controls whether the text area can be resized, and in which direction.\n * */\n resize?: ResizeOption;\n};\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-text-area\";\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n id,\n [\"data-testid\"]: dataTestId,\n className,\n errorText,\n helperText,\n label,\n rows = 3,\n cols = 90,\n resize = ResizeOption.BOTH,\n style,\n ...props\n },\n ref\n ) => {\n const [colorScheme] = useColorScheme();\n\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n\n const helperTextId = helperText ? `${id}-helper-text` : undefined;\n\n const textAreaContainerClassnames = cx(`${rootClassName}__textarea-container`, {\n [`${rootClassName}__textarea-container--disabled`]: props.disabled,\n [`${rootClassName}__textarea-container--readonly`]: props.readOnly && !props.disabled,\n });\n\n return (\n <div className={cx(className, rootClassName)} data-testid={dataTestId}>\n {label && (\n <Label\n htmlFor={id}\n disabled={props.disabled}\n className={styles[`${rootClassName}__label`]}\n data-testid={getTestId(\"label\")}\n >\n {props.required && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={textAreaContainerClassnames}>\n <textarea\n {...props}\n ref={ref}\n id={id}\n data-testid={getTestId(\"textarea\")}\n aria-describedby={props[\"aria-describedby\"] || helperTextId}\n aria-invalid={props[\"aria-invalid\"] || !!errorText}\n className={cx(\n `${rootClassName}__textarea`,\n `${rootClassName}__textarea--${colorScheme}`,\n {\n [`${rootClassName}__textarea--error`]: !!errorText,\n }\n )}\n rows={rows}\n cols={cols}\n style={{ resize, ...style }}\n />\n <div className={styles[`${rootClassName}__frame`]} />\n </div>\n {helperTextId && (\n <FieldHelperText data-testid={getTestId(\"helper-text\")} id={helperTextId}>\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")}>{errorText}</FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["ResizeOption","cx","c","styles","rootClassName","TextArea","forwardRef","id","dataTestId","className","errorText","helperText","label","rows","cols","resize","style","props","ref","colorScheme","useColorScheme","getTestId","name","helperTextId","textAreaContainerClassnames","jsxs","Label","jsx","FieldHelperText","FieldErrorText"],"mappings":";;;;;;;;;;;;;;;;;;;;;GAUaA,IAAe;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,UAAU;AACZ,GAgCMC,IAAKC,EAAE,KAAKC,CAAM,GAClBC,IAAgB,oBAETC,IAAWC;AAAA,EACtB,CACE;AAAA,IACE,IAAAC;AAAA,IACA,CAAC,gBAAgBC;AA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ACP;AAAA,YACzC,WAAWT;AAAA,cACT,GAAGG,CAAa;AAAA,cAChB,GAAGA,CAAa,eAAee,CAAW;AAAA,cAC1C;AAAA,gBACE,CAAC,GAAGf,CAAa,mBAAmB,GAAG,CAAC,CAACM;AAAA,cAAA;AAAA,YAC3C;AAAA,YAEF,MAAAG;AAAA,YACA,MAAAC;AAAA,YACA,OAAO,EAAE,QAAAC,GAAQ,GAAGC,EAAA;AAAA,UAAM;AAAA,QAAA;AAAA,0BAE3B,OAAA,EAAI,WAAWb,EAAO,GAAGC,CAAa,SAAS,EAAA,CAAG;AAAA,MAAA,GACrD;AAAA,MACCmB,uBACEK,GAAA,EAAgB,eAAaP,EAAU,aAAa,GAAG,IAAIE,GACzD,UAAAZ,EAAA,CACH;AAAA,MAEDD,KACC,gBAAAiB,EAACE,GAAA,EAAe,eAAaR,EAAU,YAAY,GAAI,UAAAX,EAAA,CAAU;AAAA,IAAA,GAErE;AAAA,EAEJ;AACF;AAEAL,EAAS,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-D0truMT1.js");exports.ResizeOption=e.ResizeOption;exports.TextArea=e.TextArea;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-9RUldq6W.js");exports.ResizeOption=e.ResizeOption;exports.TextArea=e.TextArea;
2
2
  //# sourceMappingURL=text-area.cjs.js.map
@@ -1,4 +1,4 @@
1
- import { R as o, T as r } from "./text-area-IVH-k4MM.mjs";
1
+ import { R as o, T as r } from "./text-area-C58aZEPa.mjs";
2
2
  export {
3
3
  o as ResizeOption,
4
4
  r as TextArea
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("react/jsx-runtime"),r=require("react"),X=require("./icon-DNHpBTHs-faYHqTXU.js"),G=require("./bind-DeUYJ6m9.js"),Y=require("./button-DmybVApa.js"),P=require("./field-error-text-FhQulSV5.js"),ee=require("./field-helper-text-DSKO-Tce.js"),te=require("./check-circle-filled.es-5-GXE9l4.js"),ie=require("./close.es-VL3lKi1O.js"),ae=require("./label-yHK80hhV.js"),ne=require("./spinner-tKunS_o-.js"),re={name:"edit-ai",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18.175 22.5c.464-.002.856-.304.978-.755.41-1.533 1.255-2.463 2.655-2.926a1.02 1.02 0 0 0 .015-1.93c-1.437-.508-2.283-1.434-2.664-2.919a1.017 1.017 0 0 0-.974-.766c-.445.02-.865.305-.986.747-.422 1.518-1.267 2.447-2.661 2.923a1.02 1.02 0 0 0-.686.969c0 .436.278.824.686.961 1.4.479 2.243 1.414 2.657 2.946.12.442.523.75.978.75h.002Zm-1.788-4.66a5.334 5.334 0 0 0 1.78-1.867 5.323 5.323 0 0 0 1.792 1.87 5.256 5.256 0 0 0-1.787 1.88 5.326 5.326 0 0 0-1.785-1.883Zm4.668-12.884L18.19 2.091a1.9 1.9 0 0 0-2.687 0l-11.37 11.37a.9.9 0 0 0-.212.335L1.556 20.44a.9.9 0 0 0 1.15 1.15l6.644-2.365a.9.9 0 0 0 .335-.212l11.37-11.37a1.9 1.9 0 0 0 0-2.687ZM3.888 19.26l1.253-3.518 2.264 2.264-3.517 1.254ZM19.781 6.37 9.048 17.104 6.04 14.098l8.16-8.16 1.504 1.503a.9.9 0 1 0 1.273-1.273l-1.504-1.503 1.302-1.3a.1.1 0 0 1 .14 0l2.865 2.864a.1.1 0 0 1 0 .141Z"/></svg>',keywords:["edit-ai"],category:"ai"},J=t=>i.jsx(X.b,{...t,svg:re});J.displayName="IconEditAi";const K={"purpur-text-field-ai":"_purpur-text-field-ai_1n0m8_1","purpur-text-field-ai__label":"_purpur-text-field-ai__label_1n0m8_7","purpur-text-field-ai__label-text":"_purpur-text-field-ai__label-text_1n0m8_12","purpur-text-field-ai__field-row":"_purpur-text-field-ai__field-row_1n0m8_15","purpur-text-field-ai__frame":"_purpur-text-field-ai__frame_1n0m8_19","purpur-text-field-ai__frame--negative":"_purpur-text-field-ai__frame--negative_1n0m8_26","purpur-text-field-ai__input-container":"_purpur-text-field-ai__input-container_1n0m8_29","purpur-text-field-ai__input-container--disabled":"_purpur-text-field-ai__input-container--disabled_1n0m8_40","purpur-text-field-ai__input-container--readonly":"_purpur-text-field-ai__input-container--readonly_1n0m8_43","purpur-text-field-ai__input-container--has-clear-button":"_purpur-text-field-ai__input-container--has-clear-button_1n0m8_46","purpur-text-field-ai__input-container--end-adornment":"_purpur-text-field-ai__input-container--end-adornment_1n0m8_49","purpur-text-field-ai__input":"_purpur-text-field-ai__input_1n0m8_29","purpur-text-field-ai__input-container--start-adornment":"_purpur-text-field-ai__input-container--start-adornment_1n0m8_55","purpur-text-field-ai__input-container--negative":"_purpur-text-field-ai__input-container--negative_1n0m8_61","purpur-text-field-ai__valid-icon":"_purpur-text-field-ai__valid-icon_1n0m8_93","purpur-text-field-ai__valid-icon--negative":"_purpur-text-field-ai__valid-icon--negative_1n0m8_96","purpur-text-field-ai__frame--ai":"_purpur-text-field-ai__frame--ai_1n0m8_102","purpur-text-field-ai__ai-icon":"_purpur-text-field-ai__ai-icon_1n0m8_119","purpur-text-field-ai__input--ai":"_purpur-text-field-ai__input--ai_1n0m8_174","purpur-text-field-ai__input--valid":"_purpur-text-field-ai__input--valid_1n0m8_186","purpur-text-field-ai__input--error":"_purpur-text-field-ai__input--error_1n0m8_186","purpur-text-field-ai__input--negative":"_purpur-text-field-ai__input--negative_1n0m8_234","purpur-text-field-ai__adornment-container":"_purpur-text-field-ai__adornment-container_1n0m8_253","purpur-text-field-ai__ai-icon--negative":"_purpur-text-field-ai__ai-icon--negative_1n0m8_263"},ue={"purpur-text-field-default":"_purpur-text-field-default_2b9ea_1","purpur-text-field-default__label":"_purpur-text-field-default__label_2b9ea_7","purpur-text-field-default__label-text":"_purpur-text-field-default__label-text_2b9ea_12","purpur-text-field-default__field-row":"_purpur-text-field-default__field-row_2b9ea_15","purpur-text-field-default__frame":"_purpur-text-field-default__frame_2b9ea_19","purpur-text-field-default__frame--negative":"_purpur-text-field-default__frame--negative_2b9ea_26","purpur-text-field-default__input-container":"_purpur-text-field-default__input-container_2b9ea_29","purpur-text-field-default__input-container--disabled":"_purpur-text-field-default__input-container--disabled_2b9ea_40","purpur-text-field-default__input-container--readonly":"_purpur-text-field-default__input-container--readonly_2b9ea_43","purpur-text-field-default__input-container--has-clear-button":"_purpur-text-field-default__input-container--has-clear-button_2b9ea_46","purpur-text-field-default__input-container--end-adornment":"_purpur-text-field-default__input-container--end-adornment_2b9ea_49","purpur-text-field-default__input":"_purpur-text-field-default__input_2b9ea_29","purpur-text-field-default__input-container--start-adornment":"_purpur-text-field-default__input-container--start-adornment_2b9ea_55","purpur-text-field-default__input-container--negative":"_purpur-text-field-default__input-container--negative_2b9ea_61","purpur-text-field-default__valid-icon":"_purpur-text-field-default__valid-icon_2b9ea_93","purpur-text-field-default__valid-icon--negative":"_purpur-text-field-default__valid-icon--negative_2b9ea_96","purpur-text-field-default__input--valid":"_purpur-text-field-default__input--valid_2b9ea_125","purpur-text-field-default__input--error":"_purpur-text-field-default__input--error_2b9ea_125","purpur-text-field-default__input--negative":"_purpur-text-field-default__input--negative_2b9ea_143","purpur-text-field-default__adornment-container":"_purpur-text-field-default__adornment-container_2b9ea_159"},le=t=>r.useRef(t),_e="purpur-text-field-default",B=r.forwardRef(({["data-testid"]:t,className:x,clearButtonAriaLabel:s,beforeField:h,afterField:g,endAdornment:y,errorText:c,helperText:$,hideRequiredAsterisk:T=!1,label:C,loading:N=!1,onClear:A,startAdornment:E,valid:M=!1,negative:l=!1,_styles:S,_rootClassName:H,_prependEndAdornments:j,_inputModifiers:O,_frameModifiers:F,_inputContainerRef:w,...a},m)=>{const _=G.c.bind(S??ue),e=H??_e,b=r.useId(),v=a.id??b,n=u=>t?`${t}-${u}`:void 0,Z=M&&!c,f=$?`${v}-helper-text`:void 0,I=[E].filter(u=>!!u),V=(typeof a.value=="number"?a.value!==void 0:a.value?.length)&&!a.disabled&&!a.readOnly&&!N&&A&&s,p=le(null),k=u=>{p.current=u,typeof m=="function"?m(u):m&&(m.current=u)},q=()=>{A?.(),p.current?.focus()},d=[...j??[],N&&i.jsx(ne.Spinner,{disabled:a.disabled,size:"xs","data-testid":n("spinner"),negative:l},"spinner"),V&&i.jsx(Y.Button,{negative:l,variant:"tertiary-purple",onClick:q,iconOnly:!0,"aria-label":s??"","data-testid":n("clear-button"),tabIndex:-1,children:i.jsx(ie.r,{size:"xs"})},"clear-button"),Z&&i.jsx(te.r,{"data-testid":n("valid-icon"),className:_(`${e}__valid-icon`,{[`${e}__valid-icon--negative`]:l})},"valid-icon")].filter(u=>!!u),o=_(`${e}__input-container`,{[`${e}__input-container--start-adornment`]:I.length,[`${e}__input-container--end-adornment`]:d.length||y,[`${e}__input-container--disabled`]:a.disabled,[`${e}__input-container--has-clear-button`]:V,[`${e}__input-container--readonly`]:a.readOnly&&!a.disabled,[`${e}__input-container--negative`]:l});return i.jsxs("div",{className:_(x,e),children:[C&&i.jsxs(ae.Label,{htmlFor:v,className:_(`${e}__label`),"data-testid":n("label"),disabled:a.disabled,negative:l,children:[a.required&&!T&&i.jsx("span",{"aria-hidden":!0,children:"*"}),C]}),i.jsxs("div",{className:_(`${e}__field-row`),children:[!!h&&h,i.jsxs("div",{ref:w,className:o,children:[!!I.length&&i.jsx("div",{"data-testid":n("start-adornments"),className:_(`${e}__adornment-container`),children:I}),i.jsx("input",{...a,id:v,ref:k,"data-testid":n("input"),"aria-describedby":a["aria-describedby"]||f,"aria-invalid":a["aria-invalid"]||!!c,className:_([`${e}__input`,{[`${e}__input--valid`]:Z,[`${e}__input--error`]:!!c,[`${e}__input--negative`]:l,...O??{}}])}),i.jsx("div",{className:_(`${e}__frame`,{[`${e}__frame--negative`]:l,...F??{}})}),(!!d.length||y)&&i.jsxs("div",{"data-testid":n("end-adornments"),className:_(`${e}__adornment-container`),children:[d,y]})]}),!!g&&g]}),f&&i.jsx(ee.FieldHelperText,{"data-testid":n("helper-text"),id:f,negative:l,disabled:a.disabled,children:$}),c&&i.jsx(P.FieldErrorText,{"data-testid":n("error-text"),negative:l,children:c})]})});B.displayName="TextField";const de=G.c.bind(K),R="purpur-text-field-ai",D=1400,se=t=>typeof t=="number"?!Number.isNaN(t):typeof t=="string"||Array.isArray(t)?t.length>0:t!=null,Q=r.forwardRef(({["data-testid"]:t,animatePrepopulatedValue:x=!1,typingAnimationDurationMs:s=D,endAdornment:h,value:g,defaultValue:y,onChange:c,disabled:$,readOnly:T,valid:C=!1,negative:N=!1,...A},E)=>{const M=d=>t?`${t}-${d}`:void 0,l=g!==void 0,[S,H]=r.useState(y),[j,O]=r.useState(!1),[F,w]=r.useState(!1),[a,m]=r.useState(!1),[_,e]=r.useState(null),b=r.useRef(null),v=r.useRef(null),n=l?g:S,f=se(n)&&!j,U=_!==null?_:n??"",V=f&&x&&!a&&!$&&!T,p=r.useCallback(()=>{b.current!==null&&(window.clearInterval(b.current),b.current=null)},[]),k=d=>{p(),e(null),l||H(d.currentTarget.value),O(!0),c?.(d)};r.useEffect(()=>{if(!V||typeof IntersectionObserver>"u")return;const d=v.current;if(!d)return;const o=new IntersectionObserver(u=>{u.some(W=>W.isIntersecting)&&(w(!0),m(!0),o.disconnect())},{threshold:.35});return o.observe(d),()=>o.disconnect()},[V]),r.useEffect(()=>{if(!F||j||typeof n!="string")return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches||n.length===0){w(!1);return}p(),e("");let o=0;const u=Number.isFinite(s)&&s>0?s:D,L=Math.max(20,Math.floor(u/n.length));return b.current=window.setInterval(()=>{o+=1,e(n.slice(0,o)),o>=n.length&&(p(),e(null),w(!1))},L),p},[p,j,F,s,n]),r.useEffect(()=>p,[p]);const q=[];return h===void 0&&f&&q.push(i.jsx(J,{size:"xs","data-testid":M("edit-ai-icon"),className:de(`${R}__ai-icon`,{[`${R}__ai-icon--negative`]:N})},"ai-icon")),i.jsx(B,{ref:E,"data-testid":t,...A,endAdornment:h,value:U,onChange:k,disabled:$,readOnly:T,valid:C,negative:N,_styles:K,_rootClassName:R,_prependEndAdornments:q,_inputModifiers:{[`${R}__input--ai`]:f},_frameModifiers:{[`${R}__frame--ai`]:f},_inputContainerRef:v})});Q.displayName="TextField";const pe=["default","ai"],z=r.forwardRef(({variant:t="default",...x},s)=>t==="ai"?i.jsx(Q,{ref:s,...x}):i.jsx(B,{ref:s,...x}));z.displayName="TextField";const oe=t=>r.isValidElement(t)&&t.type.displayName===z.displayName;exports.TextField=z;exports.isTextField=oe;exports.textFieldVariants=pe;
2
+ //# sourceMappingURL=text-field-C2W13n15.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-field-CYJzQG3h.js","sources":["../../../components/icon/dist/components/edit-ai.es.js","../../../components/text-field/src/utils.ts","../../../components/text-field/src/text-field-base.tsx","../../../components/text-field/src/text-field-ai.tsx","../../../components/text-field/src/text-field.tsx"],"sourcesContent":["import { jsx as i } from \"react/jsx-runtime\";\nimport { I as o } from \"../icon-DNHpBTHs.mjs\";\nconst t = {\n name: \"edit-ai\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.175 22.5c.464-.002.856-.304.978-.755.41-1.533 1.255-2.463 2.655-2.926a1.02 1.02 0 0 0 .015-1.93c-1.437-.508-2.283-1.434-2.664-2.919a1.017 1.017 0 0 0-.974-.766c-.445.02-.865.305-.986.747-.422 1.518-1.267 2.447-2.661 2.923a1.02 1.02 0 0 0-.686.969c0 .436.278.824.686.961 1.4.479 2.243 1.414 2.657 2.946.12.442.523.75.978.75h.002Zm-1.788-4.66a5.334 5.334 0 0 0 1.78-1.867 5.323 5.323 0 0 0 1.792 1.87 5.256 5.256 0 0 0-1.787 1.88 5.326 5.326 0 0 0-1.785-1.883Zm4.668-12.884L18.19 2.091a1.9 1.9 0 0 0-2.687 0l-11.37 11.37a.9.9 0 0 0-.212.335L1.556 20.44a.9.9 0 0 0 1.15 1.15l6.644-2.365a.9.9 0 0 0 .335-.212l11.37-11.37a1.9 1.9 0 0 0 0-2.687ZM3.888 19.26l1.253-3.518 2.264 2.264-3.517 1.254ZM19.781 6.37 9.048 17.104 6.04 14.098l8.16-8.16 1.504 1.503a.9.9 0 1 0 1.273-1.273l-1.504-1.503 1.302-1.3a.1.1 0 0 1 .14 0l2.865 2.864a.1.1 0 0 1 0 .141Z\"/></svg>',\n keywords: [\"edit-ai\"],\n category: \"ai\"\n}, l = (a) => /* @__PURE__ */ i(o, { ...a, svg: t });\nl.displayName = \"IconEditAi\";\nexport {\n l as IconEditAi\n};\n//# sourceMappingURL=edit-ai.es.js.map\n","import { type MutableRefObject, useRef } from \"react\";\n\nexport const useMutableRefObject = <T>(value: T): MutableRefObject<T> => {\n return useRef<T>(value) as MutableRefObject<T>;\n};\n","import React, { forwardRef, type ReactNode, useId } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { IconCheckCircleFilled } from \"@purpur/icon/check-circle-filled\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Label } from \"@purpur/label\";\nimport { Spinner } from \"@purpur/spinner\";\nimport c from \"classnames/bind\";\n\nimport type { TextFieldBaseProps } from \"./text-field\";\nimport defaultStyles from \"./text-field.module.scss\";\nimport { useMutableRefObject } from \"./utils\";\n\nconst defaultRootClassName = \"purpur-text-field-default\";\n\n// Internal overrides for variant composition (not part of the public API)\nexport type TextFieldBaseInternalOverrides = {\n _styles?: Record<string, string>;\n _rootClassName?: string;\n _prependEndAdornments?: ReactNode[];\n _inputModifiers?: Record<string, boolean>;\n _frameModifiers?: Record<string, boolean>;\n _inputContainerRef?: React.Ref<HTMLDivElement>;\n};\n\nexport const TextFieldBase = forwardRef<\n HTMLInputElement,\n TextFieldBaseProps & TextFieldBaseInternalOverrides\n>(\n (\n {\n [\"data-testid\"]: dataTestId,\n className,\n clearButtonAriaLabel,\n beforeField,\n afterField,\n endAdornment,\n errorText,\n helperText,\n hideRequiredAsterisk = false,\n label,\n loading = false,\n onClear,\n startAdornment,\n valid = false,\n negative = false,\n _styles,\n _rootClassName,\n _prependEndAdornments,\n _inputModifiers,\n _frameModifiers,\n _inputContainerRef,\n ...inputProps\n },\n ref\n ) => {\n const cx = c.bind(_styles ?? defaultStyles);\n const rootClassName = _rootClassName ?? defaultRootClassName;\n const randomId = useId();\n const inputId = inputProps.id ?? randomId;\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isValid = valid && !errorText;\n const helperTextId = helperText ? `${inputId}-helper-text` : undefined;\n const startAdornments: ReactNode[] = [startAdornment].filter((adornment) => !!adornment);\n const hasValue =\n typeof inputProps.value === \"number\"\n ? inputProps.value !== undefined\n : inputProps.value?.length;\n const hasClearButton =\n hasValue &&\n !inputProps.disabled &&\n !inputProps.readOnly &&\n !loading &&\n onClear &&\n clearButtonAriaLabel;\n\n const internalRef = useMutableRefObject<HTMLInputElement | null>(null);\n const setRef = (node: HTMLInputElement | null) => {\n internalRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n };\n const handleClear = () => {\n onClear?.();\n internalRef.current?.focus();\n };\n\n const localEndAdornments: ReactNode[] = [\n ...(_prependEndAdornments ?? []),\n loading && (\n <Spinner\n key=\"spinner\"\n disabled={inputProps.disabled}\n size=\"xs\"\n data-testid={getTestId(\"spinner\")}\n negative={negative}\n />\n ),\n hasClearButton && (\n <Button\n negative={negative}\n key=\"clear-button\"\n variant=\"tertiary-purple\"\n onClick={handleClear}\n iconOnly\n aria-label={clearButtonAriaLabel ?? \"\"}\n data-testid={getTestId(\"clear-button\")}\n tabIndex={-1}\n >\n <IconClose size=\"xs\" />\n </Button>\n ),\n isValid && (\n <IconCheckCircleFilled\n key=\"valid-icon\"\n data-testid={getTestId(\"valid-icon\")}\n className={cx(`${rootClassName}__valid-icon`, {\n [`${rootClassName}__valid-icon--negative`]: negative,\n })}\n />\n ),\n ].filter((adornment) => !!adornment);\n\n const inputContainerClassnames = cx(`${rootClassName}__input-container`, {\n [`${rootClassName}__input-container--start-adornment`]: startAdornments.length,\n [`${rootClassName}__input-container--end-adornment`]:\n localEndAdornments.length || endAdornment,\n [`${rootClassName}__input-container--disabled`]: inputProps.disabled,\n [`${rootClassName}__input-container--has-clear-button`]: hasClearButton,\n [`${rootClassName}__input-container--readonly`]: inputProps.readOnly && !inputProps.disabled,\n [`${rootClassName}__input-container--negative`]: negative,\n });\n\n return (\n <div className={cx(className, rootClassName)}>\n {label && (\n <Label\n htmlFor={inputId}\n className={cx(`${rootClassName}__label`)}\n data-testid={getTestId(\"label\")}\n disabled={inputProps.disabled}\n negative={negative}\n >\n {inputProps.required && !hideRequiredAsterisk && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={cx(`${rootClassName}__field-row`)}>\n {!!beforeField && beforeField}\n <div ref={_inputContainerRef} className={inputContainerClassnames}>\n {!!startAdornments.length && (\n <div\n data-testid={getTestId(\"start-adornments\")}\n className={cx(`${rootClassName}__adornment-container`)}\n >\n {startAdornments}\n </div>\n )}\n <input\n {...inputProps}\n id={inputId}\n ref={setRef}\n data-testid={getTestId(\"input\")}\n aria-describedby={inputProps[\"aria-describedby\"] || helperTextId}\n aria-invalid={inputProps[\"aria-invalid\"] || !!errorText}\n className={cx([\n `${rootClassName}__input`,\n {\n [`${rootClassName}__input--valid`]: isValid,\n [`${rootClassName}__input--error`]: !!errorText,\n [`${rootClassName}__input--negative`]: negative,\n ...(_inputModifiers ?? {}),\n },\n ])}\n />\n <div\n className={cx(`${rootClassName}__frame`, {\n [`${rootClassName}__frame--negative`]: negative,\n ...(_frameModifiers ?? {}),\n })}\n />\n {(!!localEndAdornments.length || endAdornment) && (\n <div\n data-testid={getTestId(\"end-adornments\")}\n className={cx(`${rootClassName}__adornment-container`)}\n >\n {localEndAdornments}\n {endAdornment}\n </div>\n )}\n </div>\n {!!afterField && afterField}\n </div>\n {helperTextId && (\n <FieldHelperText\n data-testid={getTestId(\"helper-text\")}\n id={helperTextId}\n negative={negative}\n disabled={inputProps.disabled}\n >\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")} negative={negative}>\n {errorText}\n </FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextFieldBase.displayName = \"TextField\";\n","import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { IconEditAi } from \"@purpur/icon/edit-ai\";\nimport c from \"classnames/bind\";\n\nimport type { TextFieldAiInternalProps } from \"./text-field\";\nimport aiStyles from \"./text-field-ai.module.scss\";\nimport { TextFieldBase } from \"./text-field-base\";\n\nconst cx = c.bind(aiStyles);\nconst rootClassName = \"purpur-text-field-ai\";\nconst defaultTypingAnimationDurationMs = 1400;\n\nconst hasInputValue = (value: unknown) => {\n if (typeof value === \"number\") {\n return !Number.isNaN(value);\n }\n\n if (typeof value === \"string\") {\n return value.length > 0;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return value !== undefined && value !== null;\n};\n\nexport const TextFieldAiInternal = forwardRef<HTMLInputElement, TextFieldAiInternalProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n animatePrepopulatedValue = false,\n typingAnimationDurationMs = defaultTypingAnimationDurationMs,\n endAdornment,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n valid = false,\n negative = false,\n ...baseProps\n },\n ref\n ) => {\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isControlled = controlledValue !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [hasUserEditedValue, setHasUserEditedValue] = useState(false);\n const [shouldAnimatePrepopulatedValue, setShouldAnimatePrepopulatedValue] = useState(false);\n const [hasAnimatedPrepopulatedValue, setHasAnimatedPrepopulatedValue] = useState(false);\n const [animatedTypingValue, setAnimatedTypingValue] = useState<string | null>(null);\n const typingAnimationTimerRef = useRef<number | null>(null);\n const inputContainerRef = useRef<HTMLDivElement | null>(null);\n\n const value = isControlled ? controlledValue : uncontrolledValue;\n const hasValue = hasInputValue(value);\n const isAiPresentationActive = hasValue && !hasUserEditedValue;\n const isTypingAnimationRunning = animatedTypingValue !== null;\n const displayValue = isTypingAnimationRunning ? animatedTypingValue : value ?? \"\";\n const shouldAnimatePrepopulated =\n isAiPresentationActive &&\n animatePrepopulatedValue &&\n !hasAnimatedPrepopulatedValue &&\n !disabled &&\n !readOnly;\n\n const clearTypingAnimation = useCallback(() => {\n if (typingAnimationTimerRef.current !== null) {\n window.clearInterval(typingAnimationTimerRef.current);\n typingAnimationTimerRef.current = null;\n }\n }, []);\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n clearTypingAnimation();\n setAnimatedTypingValue(null);\n\n if (!isControlled) {\n setUncontrolledValue(event.currentTarget.value);\n }\n\n setHasUserEditedValue(true);\n onChange?.(event);\n };\n\n useEffect(() => {\n if (!shouldAnimatePrepopulated || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n const node = inputContainerRef.current;\n\n if (!node) {\n return;\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n const isVisible = entries.some((entry) => entry.isIntersecting);\n\n if (isVisible) {\n setShouldAnimatePrepopulatedValue(true);\n setHasAnimatedPrepopulatedValue(true);\n observer.disconnect();\n }\n },\n { threshold: 0.35 }\n );\n\n observer.observe(node);\n\n return () => observer.disconnect();\n }, [shouldAnimatePrepopulated]);\n\n useEffect(() => {\n if (!shouldAnimatePrepopulatedValue || hasUserEditedValue || typeof value !== \"string\") {\n return;\n }\n\n const shouldReduceMotion = window.matchMedia?.(\"(prefers-reduced-motion: reduce)\")?.matches;\n\n if (shouldReduceMotion || value.length === 0) {\n setShouldAnimatePrepopulatedValue(false);\n return;\n }\n\n clearTypingAnimation();\n setAnimatedTypingValue(\"\");\n\n let index = 0;\n const safeAnimationDuration =\n Number.isFinite(typingAnimationDurationMs) && typingAnimationDurationMs > 0\n ? typingAnimationDurationMs\n : defaultTypingAnimationDurationMs;\n const intervalDuration = Math.max(20, Math.floor(safeAnimationDuration / value.length));\n\n typingAnimationTimerRef.current = window.setInterval(() => {\n index += 1;\n setAnimatedTypingValue(value.slice(0, index));\n\n if (index >= value.length) {\n clearTypingAnimation();\n setAnimatedTypingValue(null);\n setShouldAnimatePrepopulatedValue(false);\n }\n }, intervalDuration);\n\n return clearTypingAnimation;\n }, [\n clearTypingAnimation,\n hasUserEditedValue,\n shouldAnimatePrepopulatedValue,\n typingAnimationDurationMs,\n value,\n ]);\n\n useEffect(() => clearTypingAnimation, [clearTypingAnimation]);\n\n const aiEndAdornments: ReactNode[] = [];\n\n if (endAdornment === undefined && isAiPresentationActive) {\n aiEndAdornments.push(\n <IconEditAi\n key=\"ai-icon\"\n size=\"xs\"\n data-testid={getTestId(\"edit-ai-icon\")}\n className={cx(`${rootClassName}__ai-icon`, {\n [`${rootClassName}__ai-icon--negative`]: negative,\n })}\n />\n );\n }\n\n return (\n <TextFieldBase\n ref={ref}\n data-testid={dataTestId}\n {...baseProps}\n endAdornment={endAdornment}\n value={displayValue}\n onChange={handleInputChange}\n disabled={disabled}\n readOnly={readOnly}\n valid={valid}\n negative={negative}\n _styles={aiStyles}\n _rootClassName={rootClassName}\n _prependEndAdornments={aiEndAdornments}\n _inputModifiers={{ [`${rootClassName}__input--ai`]: isAiPresentationActive }}\n _frameModifiers={{ [`${rootClassName}__frame--ai`]: isAiPresentationActive }}\n _inputContainerRef={inputContainerRef}\n />\n );\n }\n);\n\nTextFieldAiInternal.displayName = \"TextField\";\n","import React, {\n forwardRef,\n type HTMLInputTypeAttribute,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\n\nimport { TextFieldAiInternal } from \"./text-field-ai\";\nimport { TextFieldBase } from \"./text-field-base\";\n\nexport const textFieldVariants = [\"default\", \"ai\"] as const;\nexport type TextFieldVariant = (typeof textFieldVariants)[number];\n\ntype TextFieldCommonProps = {\n /**\n * Use to display e.g. a button before the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n beforeField?: ReactNode;\n /**\n * Use to display e.g. a button after the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n afterField?: ReactNode;\n /**\n * Use to display e.g. an icon at the end inside of the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n endAdornment?: ReactNode;\n /**\n * Use to render error message below the text field. The text field renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the field's input. Renders below the field.\n * */\n helperText?: string;\n /**\n * The label of the text field.\n * */\n label?: string;\n /**\n * Use to render a spinner at the end inside of the text field.\n */\n loading?: boolean;\n /**\n * Hide the asterisk for required fields.\n * This is useful when the field is required but the context already indicates that.\n */\n hideRequiredAsterisk?: boolean;\n /**\n * Use to display e.g. an icon at the start inside of the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n startAdornment?: ReactNode;\n /**\n * Use to set the type of the field.\n */\n type?: Extract<\n HTMLInputTypeAttribute,\n \"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\"\n >;\n /**\n * Use to render text field with valid appearance. A check\n * icon will render at the start inside of the input.\n */\n valid?: boolean;\n negative?: boolean;\n};\n\ntype TextFieldClearProps =\n | {\n /**\n * An accessible label for the clear button.\n * */\n clearButtonAriaLabel: string;\n /**\n * Event handler called when the clear button is clicked.\n * */\n onClear: () => void;\n }\n | {\n /**\n * An accessible label for the clear button.\n * */\n clearButtonAriaLabel?: never;\n /**\n * Event handler called when the clear button is clicked.\n * */\n onClear?: never;\n };\n\ntype TextFieldAiProps = {\n /**\n * Animate prepopulated value once when the field scrolls into view.\n */\n animatePrepopulatedValue?: boolean;\n /**\n * Duration in milliseconds for the prepopulated typing animation.\n */\n typingAnimationDurationMs?: number;\n};\n\nexport type TextFieldBaseProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps;\n\nexport type TextFieldAiInternalProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps &\n TextFieldAiProps;\n\nexport type TextFieldProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps &\n TextFieldAiProps & {\n /**\n * Use to select the text field variant.\n * - `\"default\"` renders a standard text field.\n * - `\"ai\"` renders a text field with AI presentation (gradient border, AI icon, typing animation).\n * @default \"default\"\n */\n variant?: TextFieldVariant;\n };\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n ({ variant = \"default\", ...props }, ref) => {\n if (variant === \"ai\") {\n return <TextFieldAiInternal ref={ref} {...props} />;\n }\n\n return <TextFieldBase ref={ref} {...props} />;\n }\n);\n\nTextField.displayName = \"TextField\";\n\nexport const isTextField = (child?: ReactNode): child is ReactElement<TextFieldProps> =>\n isValidElement<TextFieldProps>(child) &&\n (child.type as any).displayName === TextField.displayName; // eslint-disable-line @typescript-eslint/no-explicit-any\n"],"names":["t","l","a","i","o","useMutableRefObject","value","useRef","defaultRootClassName","TextFieldBase","forwardRef","dataTestId","className","clearButtonAriaLabel","beforeField","afterField","endAdornment","errorText","helperText","hideRequiredAsterisk","label","loading","onClear","startAdornment","valid","negative","_styles","_rootClassName","_prependEndAdornments","_inputModifiers","_frameModifiers","_inputContainerRef","inputProps","ref","cx","c","defaultStyles","rootClassName","randomId","useId","inputId","getTestId","name","isValid","helperTextId","startAdornments","adornment","hasClearButton","internalRef","setRef","node","handleClear","localEndAdornments","jsx","Spinner","Button","IconClose","IconCheckCircleFilled","inputContainerClassnames","jsxs","Label","FieldHelperText","FieldErrorText","aiStyles","defaultTypingAnimationDurationMs","hasInputValue","TextFieldAiInternal","animatePrepopulatedValue","typingAnimationDurationMs","controlledValue","defaultValue","onChange","disabled","readOnly","baseProps","isControlled","uncontrolledValue","setUncontrolledValue","useState","hasUserEditedValue","setHasUserEditedValue","shouldAnimatePrepopulatedValue","setShouldAnimatePrepopulatedValue","hasAnimatedPrepopulatedValue","setHasAnimatedPrepopulatedValue","animatedTypingValue","setAnimatedTypingValue","typingAnimationTimerRef","inputContainerRef","isAiPresentationActive","displayValue","shouldAnimatePrepopulated","clearTypingAnimation","useCallback","handleInputChange","event","useEffect","observer","entries","entry","index","safeAnimationDuration","intervalDuration","aiEndAdornments","IconEditAi","textFieldVariants","TextField","variant","props","isTextField","child","isValidElement"],"mappings":"waAEMA,GAAI,CACR,KAAM,UACN,IAAK,k7BACL,SAAU,CAAC,SAAS,EACpB,SAAU,IACZ,EAAGC,EAAKC,GAAsBC,MAAEC,EAAAA,EAAG,CAAE,GAAGF,EAAG,IAAKF,GAAG,EACnDC,EAAE,YAAc,+oICNHI,GAA0BC,GAC9BC,EAAAA,OAAUD,CAAK,ECWlBE,GAAuB,4BAYhBC,EAAgBC,EAAAA,WAI3B,CACE,CACE,CAAC,eAAgBC,EACjB,UAAAC,EACA,qBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,aAAAC,EACA,UAAAC,EACA,WAAAC,EACA,qBAAAC,EAAuB,GAAA,MACvBC,EACA,QAAAC,EAAU,GACV,QAAAC,EACA,eAAAC,EACA,MAAAC,EAAQ,GACR,SAAAC,EAAW,GACX,QAAAC,EACA,eAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CACH,MAAMC,EAAKC,EAAAA,EAAE,KAAKT,GAAWU,EAAa,EACpCC,EAAgBV,GAAkBnB,GAClC8B,EAAWC,EAAAA,MAAA,EACXC,EAAUR,EAAW,IAAMM,EAC3BG,EAAaC,GAAkB/B,EAAa,GAAGA,CAAU,IAAI+B,CAAI,GAAK,OACtEC,EAAUnB,GAAS,CAACP,EACpB2B,EAAe1B,EAAa,GAAGsB,CAAO,eAAiB,OACvDK,EAA+B,CAACtB,CAAc,EAAE,OAAQuB,GAAc,CAAC,CAACA,CAAS,EAKjFC,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C1L3B,MAAMuC,GAAoB,CAAC,UAAW,IAAI,EAuHpCC,EAAYhG,EAAAA,WACvB,CAAC,CAAE,QAAAiG,EAAU,UAAW,GAAGC,CAAA,EAAS3E,IAC9B0E,IAAY,KACPtD,EAAAA,IAACa,EAAA,CAAoB,IAAAjC,EAAW,GAAG2E,CAAA,CAAO,EAG5CvD,EAAAA,IAAC5C,EAAA,CAAc,IAAAwB,EAAW,GAAG2E,CAAA,CAAO,CAE/C,EAEAF,EAAU,YAAc,YAEjB,MAAMG,GAAeC,GAC1BC,iBAA+BD,CAAK,GACnCA,EAAM,KAAa,cAAgBJ,EAAU"}
1
+ {"version":3,"file":"text-field-C2W13n15.js","sources":["../../../components/icon/dist/components/edit-ai.es.js","../../../components/text-field/src/utils.ts","../../../components/text-field/src/text-field-base.tsx","../../../components/text-field/src/text-field-ai.tsx","../../../components/text-field/src/text-field.tsx"],"sourcesContent":["import { jsx as i } from \"react/jsx-runtime\";\nimport { I as o } from \"../icon-DNHpBTHs.mjs\";\nconst t = {\n name: \"edit-ai\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M18.175 22.5c.464-.002.856-.304.978-.755.41-1.533 1.255-2.463 2.655-2.926a1.02 1.02 0 0 0 .015-1.93c-1.437-.508-2.283-1.434-2.664-2.919a1.017 1.017 0 0 0-.974-.766c-.445.02-.865.305-.986.747-.422 1.518-1.267 2.447-2.661 2.923a1.02 1.02 0 0 0-.686.969c0 .436.278.824.686.961 1.4.479 2.243 1.414 2.657 2.946.12.442.523.75.978.75h.002Zm-1.788-4.66a5.334 5.334 0 0 0 1.78-1.867 5.323 5.323 0 0 0 1.792 1.87 5.256 5.256 0 0 0-1.787 1.88 5.326 5.326 0 0 0-1.785-1.883Zm4.668-12.884L18.19 2.091a1.9 1.9 0 0 0-2.687 0l-11.37 11.37a.9.9 0 0 0-.212.335L1.556 20.44a.9.9 0 0 0 1.15 1.15l6.644-2.365a.9.9 0 0 0 .335-.212l11.37-11.37a1.9 1.9 0 0 0 0-2.687ZM3.888 19.26l1.253-3.518 2.264 2.264-3.517 1.254ZM19.781 6.37 9.048 17.104 6.04 14.098l8.16-8.16 1.504 1.503a.9.9 0 1 0 1.273-1.273l-1.504-1.503 1.302-1.3a.1.1 0 0 1 .14 0l2.865 2.864a.1.1 0 0 1 0 .141Z\"/></svg>',\n keywords: [\"edit-ai\"],\n category: \"ai\"\n}, l = (a) => /* @__PURE__ */ i(o, { ...a, svg: t });\nl.displayName = \"IconEditAi\";\nexport {\n l as IconEditAi\n};\n//# sourceMappingURL=edit-ai.es.js.map\n","import { type MutableRefObject, useRef } from \"react\";\n\nexport const useMutableRefObject = <T>(value: T): MutableRefObject<T> => {\n return useRef<T>(value) as MutableRefObject<T>;\n};\n","import React, { forwardRef, type ReactNode, useId } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { IconCheckCircleFilled } from \"@purpur/icon/check-circle-filled\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Label } from \"@purpur/label\";\nimport { Spinner } from \"@purpur/spinner\";\nimport c from \"classnames/bind\";\n\nimport type { TextFieldBaseProps } from \"./text-field\";\nimport defaultStyles from \"./text-field.module.scss\";\nimport { useMutableRefObject } from \"./utils\";\n\nconst defaultRootClassName = \"purpur-text-field-default\";\n\n// Internal overrides for variant composition (not part of the public API)\nexport type TextFieldBaseInternalOverrides = {\n _styles?: Record<string, string>;\n _rootClassName?: string;\n _prependEndAdornments?: ReactNode[];\n _inputModifiers?: Record<string, boolean>;\n _frameModifiers?: Record<string, boolean>;\n _inputContainerRef?: React.Ref<HTMLDivElement>;\n};\n\nexport const TextFieldBase = forwardRef<\n HTMLInputElement,\n TextFieldBaseProps & TextFieldBaseInternalOverrides\n>(\n (\n {\n [\"data-testid\"]: dataTestId,\n className,\n clearButtonAriaLabel,\n beforeField,\n afterField,\n endAdornment,\n errorText,\n helperText,\n hideRequiredAsterisk = false,\n label,\n loading = false,\n onClear,\n startAdornment,\n valid = false,\n negative = false,\n _styles,\n _rootClassName,\n _prependEndAdornments,\n _inputModifiers,\n _frameModifiers,\n _inputContainerRef,\n ...inputProps\n },\n ref\n ) => {\n const cx = c.bind(_styles ?? defaultStyles);\n const rootClassName = _rootClassName ?? defaultRootClassName;\n const randomId = useId();\n const inputId = inputProps.id ?? randomId;\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isValid = valid && !errorText;\n const helperTextId = helperText ? `${inputId}-helper-text` : undefined;\n const startAdornments: ReactNode[] = [startAdornment].filter((adornment) => !!adornment);\n const hasValue =\n typeof inputProps.value === \"number\"\n ? inputProps.value !== undefined\n : inputProps.value?.length;\n const hasClearButton =\n hasValue &&\n !inputProps.disabled &&\n !inputProps.readOnly &&\n !loading &&\n onClear &&\n clearButtonAriaLabel;\n\n const internalRef = useMutableRefObject<HTMLInputElement | null>(null);\n const setRef = (node: HTMLInputElement | null) => {\n internalRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n };\n const handleClear = () => {\n onClear?.();\n internalRef.current?.focus();\n };\n\n const localEndAdornments: ReactNode[] = [\n ...(_prependEndAdornments ?? []),\n loading && (\n <Spinner\n key=\"spinner\"\n disabled={inputProps.disabled}\n size=\"xs\"\n data-testid={getTestId(\"spinner\")}\n negative={negative}\n />\n ),\n hasClearButton && (\n <Button\n negative={negative}\n key=\"clear-button\"\n variant=\"tertiary-purple\"\n onClick={handleClear}\n iconOnly\n aria-label={clearButtonAriaLabel ?? \"\"}\n data-testid={getTestId(\"clear-button\")}\n tabIndex={-1}\n >\n <IconClose size=\"xs\" />\n </Button>\n ),\n isValid && (\n <IconCheckCircleFilled\n key=\"valid-icon\"\n data-testid={getTestId(\"valid-icon\")}\n className={cx(`${rootClassName}__valid-icon`, {\n [`${rootClassName}__valid-icon--negative`]: negative,\n })}\n />\n ),\n ].filter((adornment) => !!adornment);\n\n const inputContainerClassnames = cx(`${rootClassName}__input-container`, {\n [`${rootClassName}__input-container--start-adornment`]: startAdornments.length,\n [`${rootClassName}__input-container--end-adornment`]:\n localEndAdornments.length || endAdornment,\n [`${rootClassName}__input-container--disabled`]: inputProps.disabled,\n [`${rootClassName}__input-container--has-clear-button`]: hasClearButton,\n [`${rootClassName}__input-container--readonly`]: inputProps.readOnly && !inputProps.disabled,\n [`${rootClassName}__input-container--negative`]: negative,\n });\n\n return (\n <div className={cx(className, rootClassName)}>\n {label && (\n <Label\n htmlFor={inputId}\n className={cx(`${rootClassName}__label`)}\n data-testid={getTestId(\"label\")}\n disabled={inputProps.disabled}\n negative={negative}\n >\n {inputProps.required && !hideRequiredAsterisk && <span aria-hidden>*</span>}\n {label}\n </Label>\n )}\n <div className={cx(`${rootClassName}__field-row`)}>\n {!!beforeField && beforeField}\n <div ref={_inputContainerRef} className={inputContainerClassnames}>\n {!!startAdornments.length && (\n <div\n data-testid={getTestId(\"start-adornments\")}\n className={cx(`${rootClassName}__adornment-container`)}\n >\n {startAdornments}\n </div>\n )}\n <input\n {...inputProps}\n id={inputId}\n ref={setRef}\n data-testid={getTestId(\"input\")}\n aria-describedby={inputProps[\"aria-describedby\"] || helperTextId}\n aria-invalid={inputProps[\"aria-invalid\"] || !!errorText}\n className={cx([\n `${rootClassName}__input`,\n {\n [`${rootClassName}__input--valid`]: isValid,\n [`${rootClassName}__input--error`]: !!errorText,\n [`${rootClassName}__input--negative`]: negative,\n ...(_inputModifiers ?? {}),\n },\n ])}\n />\n <div\n className={cx(`${rootClassName}__frame`, {\n [`${rootClassName}__frame--negative`]: negative,\n ...(_frameModifiers ?? {}),\n })}\n />\n {(!!localEndAdornments.length || endAdornment) && (\n <div\n data-testid={getTestId(\"end-adornments\")}\n className={cx(`${rootClassName}__adornment-container`)}\n >\n {localEndAdornments}\n {endAdornment}\n </div>\n )}\n </div>\n {!!afterField && afterField}\n </div>\n {helperTextId && (\n <FieldHelperText\n data-testid={getTestId(\"helper-text\")}\n id={helperTextId}\n negative={negative}\n disabled={inputProps.disabled}\n >\n {helperText}\n </FieldHelperText>\n )}\n {errorText && (\n <FieldErrorText data-testid={getTestId(\"error-text\")} negative={negative}>\n {errorText}\n </FieldErrorText>\n )}\n </div>\n );\n }\n);\n\nTextFieldBase.displayName = \"TextField\";\n","import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { IconEditAi } from \"@purpur/icon/edit-ai\";\nimport c from \"classnames/bind\";\n\nimport type { TextFieldAiInternalProps } from \"./text-field\";\nimport aiStyles from \"./text-field-ai.module.scss\";\nimport { TextFieldBase } from \"./text-field-base\";\n\nconst cx = c.bind(aiStyles);\nconst rootClassName = \"purpur-text-field-ai\";\nconst defaultTypingAnimationDurationMs = 1400;\n\nconst hasInputValue = (value: unknown) => {\n if (typeof value === \"number\") {\n return !Number.isNaN(value);\n }\n\n if (typeof value === \"string\") {\n return value.length > 0;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return value !== undefined && value !== null;\n};\n\nexport const TextFieldAiInternal = forwardRef<HTMLInputElement, TextFieldAiInternalProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n animatePrepopulatedValue = false,\n typingAnimationDurationMs = defaultTypingAnimationDurationMs,\n endAdornment,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n valid = false,\n negative = false,\n ...baseProps\n },\n ref\n ) => {\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isControlled = controlledValue !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [hasUserEditedValue, setHasUserEditedValue] = useState(false);\n const [shouldAnimatePrepopulatedValue, setShouldAnimatePrepopulatedValue] = useState(false);\n const [hasAnimatedPrepopulatedValue, setHasAnimatedPrepopulatedValue] = useState(false);\n const [animatedTypingValue, setAnimatedTypingValue] = useState<string | null>(null);\n const typingAnimationTimerRef = useRef<number | null>(null);\n const inputContainerRef = useRef<HTMLDivElement | null>(null);\n\n const value = isControlled ? controlledValue : uncontrolledValue;\n const hasValue = hasInputValue(value);\n const isAiPresentationActive = hasValue && !hasUserEditedValue;\n const isTypingAnimationRunning = animatedTypingValue !== null;\n const displayValue = isTypingAnimationRunning ? animatedTypingValue : value ?? \"\";\n const shouldAnimatePrepopulated =\n isAiPresentationActive &&\n animatePrepopulatedValue &&\n !hasAnimatedPrepopulatedValue &&\n !disabled &&\n !readOnly;\n\n const clearTypingAnimation = useCallback(() => {\n if (typingAnimationTimerRef.current !== null) {\n window.clearInterval(typingAnimationTimerRef.current);\n typingAnimationTimerRef.current = null;\n }\n }, []);\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n clearTypingAnimation();\n setAnimatedTypingValue(null);\n\n if (!isControlled) {\n setUncontrolledValue(event.currentTarget.value);\n }\n\n setHasUserEditedValue(true);\n onChange?.(event);\n };\n\n useEffect(() => {\n if (!shouldAnimatePrepopulated || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n const node = inputContainerRef.current;\n\n if (!node) {\n return;\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n const isVisible = entries.some((entry) => entry.isIntersecting);\n\n if (isVisible) {\n setShouldAnimatePrepopulatedValue(true);\n setHasAnimatedPrepopulatedValue(true);\n observer.disconnect();\n }\n },\n { threshold: 0.35 }\n );\n\n observer.observe(node);\n\n return () => observer.disconnect();\n }, [shouldAnimatePrepopulated]);\n\n useEffect(() => {\n if (!shouldAnimatePrepopulatedValue || hasUserEditedValue || typeof value !== \"string\") {\n return;\n }\n\n const shouldReduceMotion = window.matchMedia?.(\"(prefers-reduced-motion: reduce)\")?.matches;\n\n if (shouldReduceMotion || value.length === 0) {\n setShouldAnimatePrepopulatedValue(false);\n return;\n }\n\n clearTypingAnimation();\n setAnimatedTypingValue(\"\");\n\n let index = 0;\n const safeAnimationDuration =\n Number.isFinite(typingAnimationDurationMs) && typingAnimationDurationMs > 0\n ? typingAnimationDurationMs\n : defaultTypingAnimationDurationMs;\n const intervalDuration = Math.max(20, Math.floor(safeAnimationDuration / value.length));\n\n typingAnimationTimerRef.current = window.setInterval(() => {\n index += 1;\n setAnimatedTypingValue(value.slice(0, index));\n\n if (index >= value.length) {\n clearTypingAnimation();\n setAnimatedTypingValue(null);\n setShouldAnimatePrepopulatedValue(false);\n }\n }, intervalDuration);\n\n return clearTypingAnimation;\n }, [\n clearTypingAnimation,\n hasUserEditedValue,\n shouldAnimatePrepopulatedValue,\n typingAnimationDurationMs,\n value,\n ]);\n\n useEffect(() => clearTypingAnimation, [clearTypingAnimation]);\n\n const aiEndAdornments: ReactNode[] = [];\n\n if (endAdornment === undefined && isAiPresentationActive) {\n aiEndAdornments.push(\n <IconEditAi\n key=\"ai-icon\"\n size=\"xs\"\n data-testid={getTestId(\"edit-ai-icon\")}\n className={cx(`${rootClassName}__ai-icon`, {\n [`${rootClassName}__ai-icon--negative`]: negative,\n })}\n />\n );\n }\n\n return (\n <TextFieldBase\n ref={ref}\n data-testid={dataTestId}\n {...baseProps}\n endAdornment={endAdornment}\n value={displayValue}\n onChange={handleInputChange}\n disabled={disabled}\n readOnly={readOnly}\n valid={valid}\n negative={negative}\n _styles={aiStyles}\n _rootClassName={rootClassName}\n _prependEndAdornments={aiEndAdornments}\n _inputModifiers={{ [`${rootClassName}__input--ai`]: isAiPresentationActive }}\n _frameModifiers={{ [`${rootClassName}__frame--ai`]: isAiPresentationActive }}\n _inputContainerRef={inputContainerRef}\n />\n );\n }\n);\n\nTextFieldAiInternal.displayName = \"TextField\";\n","import React, {\n forwardRef,\n type HTMLInputTypeAttribute,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\n\nimport { TextFieldAiInternal } from \"./text-field-ai\";\nimport { TextFieldBase } from \"./text-field-base\";\n\nexport const textFieldVariants = [\"default\", \"ai\"] as const;\nexport type TextFieldVariant = (typeof textFieldVariants)[number];\n\ntype TextFieldCommonProps = {\n /**\n * Use to display e.g. a button before the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n beforeField?: ReactNode;\n /**\n * Use to display e.g. a button after the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n afterField?: ReactNode;\n /**\n * Use to display e.g. an icon at the end inside of the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n endAdornment?: ReactNode;\n /**\n * Use to render error message below the text field. The text field renders with error appearance.\n * */\n errorText?: string;\n /**\n * Use to give context about the field's input. Renders below the field.\n * */\n helperText?: string;\n /**\n * The label of the text field.\n * */\n label?: string;\n /**\n * Use to render a spinner at the end inside of the text field.\n */\n loading?: boolean;\n /**\n * Hide the asterisk for required fields.\n * This is useful when the field is required but the context already indicates that.\n */\n hideRequiredAsterisk?: boolean;\n /**\n * Use to display e.g. an icon at the start inside of the text field.\n *\n * _NOTE: Should ideally only be used by other purpur components!_\n */\n startAdornment?: ReactNode;\n /**\n * Use to set the type of the field.\n */\n type?: Extract<\n HTMLInputTypeAttribute,\n \"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\"\n >;\n /**\n * Use to render text field with valid appearance. A check\n * icon will render at the start inside of the input.\n */\n valid?: boolean;\n negative?: boolean;\n};\n\ntype TextFieldClearProps =\n | {\n /**\n * An accessible label for the clear button.\n * */\n clearButtonAriaLabel: string;\n /**\n * Event handler called when the clear button is clicked.\n * */\n onClear: () => void;\n }\n | {\n /**\n * An accessible label for the clear button.\n * */\n clearButtonAriaLabel?: never;\n /**\n * Event handler called when the clear button is clicked.\n * */\n onClear?: never;\n };\n\ntype TextFieldAiProps = {\n /**\n * Animate prepopulated value once when the field scrolls into view.\n */\n animatePrepopulatedValue?: boolean;\n /**\n * Duration in milliseconds for the prepopulated typing animation.\n */\n typingAnimationDurationMs?: number;\n};\n\nexport type TextFieldBaseProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps;\n\nexport type TextFieldAiInternalProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps &\n TextFieldAiProps;\n\nexport type TextFieldProps = Omit<BaseProps<\"input\">, \"type\"> &\n TextFieldCommonProps &\n TextFieldClearProps &\n TextFieldAiProps & {\n /**\n * Use to select the text field variant.\n * - `\"default\"` renders a standard text field.\n * - `\"ai\"` renders a text field with AI presentation (gradient border, AI icon, typing animation).\n * @default \"default\"\n */\n variant?: TextFieldVariant;\n };\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n ({ variant = \"default\", ...props }, ref) => {\n if (variant === \"ai\") {\n return <TextFieldAiInternal ref={ref} {...props} />;\n }\n\n return <TextFieldBase ref={ref} {...props} />;\n }\n);\n\nTextField.displayName = \"TextField\";\n\nexport const isTextField = (child?: ReactNode): child is ReactElement<TextFieldProps> =>\n isValidElement<TextFieldProps>(child) &&\n (child.type as any).displayName === TextField.displayName; // eslint-disable-line @typescript-eslint/no-explicit-any\n"],"names":["t","l","a","i","o","useMutableRefObject","value","useRef","defaultRootClassName","TextFieldBase","forwardRef","dataTestId","className","clearButtonAriaLabel","beforeField","afterField","endAdornment","errorText","helperText","hideRequiredAsterisk","label","loading","onClear","startAdornment","valid","negative","_styles","_rootClassName","_prependEndAdornments","_inputModifiers","_frameModifiers","_inputContainerRef","inputProps","ref","cx","c","defaultStyles","rootClassName","randomId","useId","inputId","getTestId","name","isValid","helperTextId","startAdornments","adornment","hasClearButton","internalRef","setRef","node","handleClear","localEndAdornments","jsx","Spinner","Button","IconClose","IconCheckCircleFilled","inputContainerClassnames","jsxs","Label","FieldHelperText","FieldErrorText","aiStyles","defaultTypingAnimationDurationMs","hasInputValue","TextFieldAiInternal","animatePrepopulatedValue","typingAnimationDurationMs","controlledValue","defaultValue","onChange","disabled","readOnly","baseProps","isControlled","uncontrolledValue","setUncontrolledValue","useState","hasUserEditedValue","setHasUserEditedValue","shouldAnimatePrepopulatedValue","setShouldAnimatePrepopulatedValue","hasAnimatedPrepopulatedValue","setHasAnimatedPrepopulatedValue","animatedTypingValue","setAnimatedTypingValue","typingAnimationTimerRef","inputContainerRef","isAiPresentationActive","displayValue","shouldAnimatePrepopulated","clearTypingAnimation","useCallback","handleInputChange","event","useEffect","observer","entries","entry","index","safeAnimationDuration","intervalDuration","aiEndAdornments","IconEditAi","textFieldVariants","TextField","variant","props","isTextField","child","isValidElement"],"mappings":"waAEMA,GAAI,CACR,KAAM,UACN,IAAK,k7BACL,SAAU,CAAC,SAAS,EACpB,SAAU,IACZ,EAAGC,EAAKC,GAAsBC,MAAEC,EAAAA,EAAG,CAAE,GAAGF,EAAG,IAAKF,GAAG,EACnDC,EAAE,YAAc,gpICNHI,GAA0BC,GAC9BC,EAAAA,OAAUD,CAAK,ECWlBE,GAAuB,4BAYhBC,EAAgBC,EAAAA,WAI3B,CACE,CACE,CAAC,eAAgBC,EACjB,UAAAC,EACA,qBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,aAAAC,EACA,UAAAC,EACA,WAAAC,EACA,qBAAAC,EAAuB,GAAA,MACvBC,EACA,QAAAC,EAAU,GACV,QAAAC,EACA,eAAAC,EACA,MAAAC,EAAQ,GACR,SAAAC,EAAW,GACX,QAAAC,EACA,eAAAC,EACA,sBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,GAAGC,CAAA,EAELC,IACG,CACH,MAAMC,EAAKC,EAAAA,EAAE,KAAKT,GAAWU,EAAa,EACpCC,EAAgBV,GAAkBnB,GAClC8B,EAAWC,EAAAA,MAAA,EACXC,EAAUR,EAAW,IAAMM,EAC3BG,EAAaC,GAAkB/B,EAAa,GAAGA,CAAU,IAAI+B,CAAI,GAAK,OACtEC,EAAUnB,GAAS,CAACP,EACpB2B,EAAe1B,EAAa,GAAGsB,CAAO,eAAiB,OACvDK,EAA+B,CAACtB,CAAc,EAAE,OAAQuB,GAAc,CAAC,CAACA,CAAS,EAKjFC,GAHJ,OAAOf,EA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