@pickaxeproject/react 3.20.2 → 3.20.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("@nem035/gpt-3-encoder"),i=require("../../../Core/Textarea.js"),l=require("../../../../common/cn.js");exports.default=({field:c,update:u})=>{const{styles:d,colors:p,isRtl:x}=s.usePickaxeContext(),{setError:h}=o.useResponseContext(),[g,m]=t.useState(!1),j=r.useStyleFontSize(),b=n.useStyleInput();return e.jsxs("div",Object.assign({className:"group relative flex flex-col gap-y-1",dir:x?"rtl":"ltr"},{children:[e.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[e.jsx("p",Object.assign({className:l.default(j.b3,"font-semibold opacity-70")},{children:c.main})),c.isRequired&&e.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:p.accent}},{children:"*"}))]})),e.jsx(i.default,{className:l.default(j.i1,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",c.maxLength<10&&"max-w-[400px]","block"===d.formFieldStyle&&"shadow hover:shadow-none"),style:b,placeholder:c.placeholder,rows:1,value:c.input,tabIndex:c.order,onChange:e=>{h("");const t=a.encode(e).length;u(Object.assign(Object.assign({},c),{input:e,length:t}))},onFocus:()=>m(!0),onBlur:()=>m(!1),onPaste:e=>{if(e.clipboardData.getData("text").length<1e3)return;const t=e.target;setTimeout((()=>{const e=t.getBoundingClientRect().bottom+window.scrollY;window.scrollTo({top:e,behavior:"smooth"})}),100)}})]})),e.jsx("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e.jsxs("p",Object.assign({className:l.default(j.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",c.length>c.maxLength&&"text-c-red opacity-100",g&&"opacity-100")},{children:[c.length,"/",c.maxLength]}))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as n}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as a}from"../../../../hooks/studio/useStyleFontSize.js";import{encode as i}from"@nem035/gpt-3-encoder";import l from"../../../Core/Textarea.js";import c from"../../../../common/cn.js";const m=({field:m,update:p})=>{const{styles:d,colors:h,isRtl:g}=s(),{setError:u}=r(),[b,x]=t(!1),f=a(),j=n();return e("div",Object.assign({className:"group relative flex flex-col gap-y-1",dir:g?"rtl":"ltr"},{children:[e("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:c(f.b3,"font-semibold opacity-70")},{children:m.main})),m.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:h.accent}},{children:"*"}))]})),o(l,{className:c(f.i1,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",m.maxLength<10&&"max-w-[400px]","block"===d.formFieldStyle&&"shadow hover:shadow-none"),style:j,placeholder:m.placeholder,rows:1,value:m.input,tabIndex:m.order,onChange:e=>{u("");const o=i(e).length;p(Object.assign(Object.assign({},m),{input:e,length:o}))},onFocus:()=>x(!0),onBlur:()=>x(!1),onPaste:e=>{if(e.clipboardData.getData("text").length<1e3)return;const o=e.target;setTimeout((()=>{const e=o.getBoundingClientRect().bottom+window.scrollY;window.scrollTo({top:e,behavior:"smooth"})}),100)}})]})),o("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e("p",Object.assign({className:c(f.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",m.length>m.maxLength&&"text-c-red opacity-100",b&&"opacity-100")},{children:[m.length,"/",m.maxLength]}))}))]}))};export{m as default};
|