@kelet-ai/feedback-ui 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{src/components → components}/ui/button.d.ts +1 -1
- package/dist/{src/contexts → contexts}/kelet.d.ts +1 -1
- package/dist/feedback-ui.es.js +2 -2
- package/dist/feedback-ui.umd.js +5 -5
- package/dist/index.d.ts +5 -1
- package/package.json +5 -3
- package/dist/dist/feedback-ui.es.d.ts +0 -56
- package/dist/dist/feedback-ui.umd.d.ts +0 -1
- package/dist/src/README.stories.d.ts +0 -5
- package/dist/src/components/vote-feedback.stories.d.ts +0 -10
- package/dist/src/hooks/feedback-state/use-feedback-state.stories.d.ts +0 -20
- package/dist/src/hooks/feedback-state/use-feedback-state.test.d.ts +0 -1
- package/dist/src/index.d.ts +0 -5
- package/dist/src/ui/shadcn/index.d.ts +0 -2
- package/dist/src/ui/shadcn/vote-feedback.d.ts +0 -13
- package/dist/src/ui/shadcn/vote-feedback.stories.d.ts +0 -11
- package/dist/tailwind.config.d.ts +0 -8
- package/dist/vite.config.d.ts +0 -2
- package/dist/vitest.config.d.ts +0 -2
- /package/dist/{src/components → components}/index.d.ts +0 -0
- /package/dist/{src/components → components}/ui/popover.d.ts +0 -0
- /package/dist/{src/components → components}/ui/textarea.d.ts +0 -0
- /package/dist/{src/components → components}/vote-feedback.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/feedback-state/diff-utils.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/feedback-state/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/feedback-state/types.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/feedback-state/use-feedback-state.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/utils.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "default" | "
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
package/dist/feedback-ui.es.js
CHANGED
|
@@ -315,11 +315,11 @@ const se = ke(null), Fe = "https://api.kelet.ai/", ft = () => {
|
|
|
315
315
|
const r = ae(se);
|
|
316
316
|
return r ? r.feedback : async () => {
|
|
317
317
|
};
|
|
318
|
-
}, dt = ({
|
|
318
|
+
}, dt = ({ apiKey: r, project: e, children: n }) => {
|
|
319
319
|
const t = ae(se), i = r || t?.api_key;
|
|
320
320
|
if (!i)
|
|
321
321
|
throw new Error(
|
|
322
|
-
"
|
|
322
|
+
"apiKey is required either directly or from a parent KeletProvider"
|
|
323
323
|
);
|
|
324
324
|
const f = {
|
|
325
325
|
api_key: i,
|
package/dist/feedback-ui.umd.js
CHANGED
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var le;function Te(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){function r(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===o?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case
|
|
17
|
+
*/var le;function Te(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){function r(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===o?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case g:return"Fragment";case D:return"Profiler";case A:return"StrictMode";case P:return"Suspense";case L:return"SuspenseList";case l:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case m:return"Portal";case w:return(a.displayName||"Context")+".Provider";case h:return(a._context.displayName||"Context")+".Consumer";case R:var C=a.render;return a=a.displayName,a||(a=C.displayName||C.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case N:return C=a.displayName||null,C!==null?C:r(a.type)||"Memo";case i:C=a._payload,a=a._init;try{return r(a(C))}catch{}}return null}function e(a){return""+a}function n(a){try{e(a);var C=!1}catch{C=!0}if(C){C=console;var _=C.error,j=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return _.call(C,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",j),e(a)}}function t(a){if(a===g)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===i)return"<...>";try{var C=r(a);return C?"<"+C+">":"<...>"}catch{return"<...>"}}function s(){var a=p.A;return a===null?null:a.getOwner()}function u(){return Error("react-stack-top-frame")}function f(a){if(v.call(a,"key")){var C=Object.getOwnPropertyDescriptor(a,"key").get;if(C&&C.isReactWarning)return!1}return a.key!==void 0}function c(a,C){function _(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",C))}_.isReactWarning=!0,Object.defineProperty(a,"key",{get:_,configurable:!0})}function d(){var a=r(this.type);return F[a]||(F[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function y(a,C,_,j,z,W,G,J){return _=W.ref,a={$$typeof:k,type:a,key:C,props:W,_owner:z},(_!==void 0?_:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:d}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function b(a,C,_,j,z,W,G,J){var I=C.children;if(I!==void 0)if(j)if(S(I)){for(j=0;j<I.length;j++)E(I[j]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(I);if(v.call(C,"key")){I=r(a);var U=Object.keys(C).filter(function(Qe){return Qe!=="key"});j=0<U.length?"{key: someKey, "+U.join(": ..., ")+": ...}":"{key: someKey}",re[I+j]||(U=0<U.length?"{"+U.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,j,I,U,I),re[I+j]=!0)}if(I=null,_!==void 0&&(n(_),I=""+_),f(C)&&(n(C.key),I=""+C.key),"key"in C){_={};for(var ie in C)ie!=="key"&&(_[ie]=C[ie])}else _=C;return I&&c(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),y(a,I,W,z,s(),_,G,J)}function E(a){typeof a=="object"&&a!==null&&a.$$typeof===g&&a._store&&(a._store.validated=1)}var O=x,g=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),w=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),l=Symbol.for("react.activity"),o=Symbol.for("react.client.reference"),p=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,v=Object.prototype.hasOwnProperty,S=Array.isArray,T=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(a){return a()}};var K,F={},V=O.react_stack_bottom_frame.bind(O,u)(),B=T(t(u)),re={};Z.Fragment=k,Z.jsx=function(a,C,_,j,z){var W=1e4>p.recentlyCreatedOwnerStacks++;return b(a,C,_,!1,j,z,W?Error("react-stack-top-frame"):V,W?T(t(a)):B)},Z.jsxs=function(a,C,_,j,z){var W=1e4>p.recentlyCreatedOwnerStacks++;return b(a,C,_,!0,j,z,W?Error("react-stack-top-frame"):V,W?T(t(a)):B)}}()),Z}var ue;function Ce(){return ue||(ue=1,process.env.NODE_ENV==="production"?ee.exports=xe():ee.exports=Te()),ee.exports}var M=Ce();const Q=x.createContext(null),Re="https://api.kelet.ai/",Oe=()=>{const r=x.useContext(Q);if(!r)throw new Error("useKelet must be used within a KeletProvider");return r},oe=()=>{const r=x.useContext(Q);return r?r.feedback:async()=>{}},Se=({api_key:r,project:e,children:n})=>{const t=x.useContext(Q),s=r||t?.api_key;if(!s)throw new Error("api_key is required either directly or from a parent KeletProvider");const f={api_key:s,project:e,feedback:async c=>{const d=`${Re}/projects/${e}/feedback`,y={tx_id:c.identifier,source:c.source||"EXPLICIT",vote:c.vote,explanation:c.explanation,correction:c.correction,selection:c.selection},b=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(y)});if(!b.ok)throw new Error(`Failed to submit feedback: ${b.statusText}`)}};return M.jsx(Q.Provider,{value:f,children:n})},q=(r,e)=>{const n={...e};for(const t in e){const s=r[t],u=e[t];/^on[A-Z]/.test(t)?s&&u?n[t]=(...c)=>{u(...c),s(...c)}:s&&(n[t]=s):t==="style"?n[t]={...s,...u}:t==="className"?n[t]=[s,u].filter(Boolean).join(" "):n[t]=u!==void 0?u:s}return{...r,...n}},ce=x.createContext(null),$=()=>{const r=x.useContext(ce);if(!r)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return r},Ae={Root:({children:r,onFeedback:e,defaultText:n="",identifier:t,extra_metadata:s,trigger_name:u})=>{const[f,c]=x.useState(!1),[d,y]=x.useState(n),[b,E]=x.useState(!1),[O,g]=x.useState(null),m=x.useRef(null),k=x.useRef(null),A=x.useId(),D=x.useId(),h=oe(),w=e||h,R=x.useCallback(async()=>{g("upvote");const o={identifier:t,vote:"upvote",...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(o)}finally{E(!1)}},[w,t,s,u]),P=x.useCallback(async()=>{if(g("downvote"),w){const o={identifier:t,vote:"downvote",...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(o)}finally{E(!1)}}c(!0),setTimeout(()=>{m.current?.focus();const o=document.createElement("div");o.setAttribute("aria-live","polite"),o.setAttribute("aria-atomic","true"),o.className="sr-only",o.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(o),setTimeout(()=>document.body.removeChild(o),1e3)},0)},[w,t,s,u]),L=x.useCallback(o=>{y(o.target.value)},[]),N=x.useCallback(async()=>{const o=d.trim().length>0;if(o){const p={identifier:t,vote:"downvote",explanation:d,...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(p)}finally{E(!1)}}if(c(!1),y(n),k.current?.focus(),o){const p=document.createElement("div");p.setAttribute("aria-live","polite"),p.className="sr-only",p.textContent="Feedback submitted successfully.",document.body.appendChild(p),setTimeout(()=>document.body.removeChild(p),1e3)}},[w,d,n,t,s,u]),i=x.useCallback(o=>{if(o.key==="Escape")c(!1),y(n),k.current?.focus();else if((o.metaKey||o.ctrlKey)&&o.key==="Enter")o.preventDefault(),N().then(p=>{});else if(o.key==="Tab"&&f){const p=document.getElementById(A);if(p){const v=p.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),S=v[0],T=v[v.length-1];o.shiftKey&&document.activeElement===S?(o.preventDefault(),T?.focus()):!o.shiftKey&&document.activeElement===T&&(o.preventDefault(),S?.focus())}}},[N,f,A,n]),l={onFeedback:w,showPopover:f,setShowPopover:c,feedbackText:d,setFeedbackText:y,isSubmitting:b,setIsSubmitting:E,vote:O,handleUpvote:R,handleDownvote:P,handleTextareaChange:L,handleSubmit:N,handleKeyDown:i,textareaRef:m,triggerRef:k,popoverId:A,triggerId:D,identifier:t,extra_metadata:s,trigger_name:u};return M.jsx(ce.Provider,{value:l,children:r})},UpvoteButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleUpvote:s,isSubmitting:u,vote:f}=$(),c=x.useCallback(b=>{s(),n?.(b)},[s,n]),d={...t,onClick:c,disabled:u||t.disabled,"aria-label":t["aria-label"]||"Upvote feedback",type:"button"},y=f==="upvote";if(r){const b=typeof e=="function"?e({isSelected:y}):e;if(x.isValidElement(b))return x.cloneElement(b,q(d,b.props))}return M.jsx("button",{...d,children:typeof e=="function"?e({isSelected:y}):e})},DownvoteButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleDownvote:s,showPopover:u,isSubmitting:f,popoverId:c,triggerId:d,triggerRef:y,vote:b}=$(),E=x.useCallback(m=>{s(),n?.(m)},[s,n]),O={...t,ref:y,onClick:E,disabled:f||t.disabled,"aria-label":t["aria-label"]||"Downvote feedback","aria-expanded":u,"aria-controls":c,id:d,type:"button"},g=b==="downvote";if(r){const m=typeof e=="function"?e({isSelected:g}):e;if(x.isValidElement(m))return x.cloneElement(m,q(O,m.props));if(m)return m}return M.jsx("button",{...O,children:typeof e=="function"?e({isSelected:g}):e})},Popover:({asChild:r,children:e,...n})=>{const{showPopover:t,handleKeyDown:s,popoverId:u,triggerId:f}=$();if(!t)return null;const c={...n,role:"dialog","aria-labelledby":f,"aria-modal":!0,"aria-describedby":`${u}-description`,id:u,onKeyDown:s,tabIndex:-1};return r&&x.isValidElement(e)?M.jsxs(M.Fragment,{children:[x.cloneElement(e,q(c,e.props)),M.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):M.jsxs("div",{...c,children:[M.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:r,value:e,onChange:n,...t})=>{const{feedbackText:s,handleTextareaChange:u,textareaRef:f,handleKeyDown:c,popoverId:d}=$(),y={...t,ref:f,value:e!==void 0?e:s,onChange:n||u,onKeyDown:c,placeholder:t.placeholder||"What did we miss?","aria-label":t["aria-label"]||"Additional feedback","aria-describedby":`${d}-help`,rows:t.rows||3};return r&&x.isValidElement(t.children)?x.cloneElement(t.children,q(y,t.children.props)):M.jsx("textarea",{...y})},SubmitButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleSubmit:s,isSubmitting:u,feedbackText:f}=$(),c=x.useCallback(E=>{s(),n?.(E)},[s,n]),d=f.trim().length>0,y=d?"Submit feedback":"Close without feedback",b={...t,onClick:c,disabled:u||t.disabled,type:"button","aria-label":t["aria-label"]||y,"aria-describedby":d?void 0:"submit-help"};return r&&x.isValidElement(e)?M.jsxs(M.Fragment,{children:[x.cloneElement(e,q(b,e.props)),!d&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):M.jsxs("button",{...b,children:[e,!d&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var te={exports:{}},De=te.exports,fe;function _e(){return fe||(fe=1,function(r,e){(function(n,t){var s=t(n);r.exports=s})(De,function(n){var t=["N","E","A","D"];function s(i,l){i.super_=l,i.prototype=Object.create(l.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function u(i,l){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),l&&l.length&&Object.defineProperty(this,"path",{value:l,enumerable:!0})}function f(i,l,o){f.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0}),Object.defineProperty(this,"rhs",{value:o,enumerable:!0})}s(f,u);function c(i,l){c.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:l,enumerable:!0})}s(c,u);function d(i,l){d.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0})}s(d,u);function y(i,l,o){y.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:l,enumerable:!0}),Object.defineProperty(this,"item",{value:o,enumerable:!0})}s(y,u);function b(i,l,o){var p=i.slice(l+1||i.length);return i.length=l<0?i.length+l:l,i.push.apply(i,p),i}function E(i){var l=typeof i;return l!=="object"?l:i===Math?"math":i===null?"null":Array.isArray(i)?"array":Object.prototype.toString.call(i)==="[object Date]"?"date":typeof i.toString=="function"&&/^\/.*\//.test(i.toString())?"regexp":"object"}function O(i){var l=0;if(i.length===0)return l;for(var o=0;o<i.length;o++){var p=i.charCodeAt(o);l=(l<<5)-l+p,l=l&l}return l}function g(i){var l=0,o=E(i);if(o==="array"){i.forEach(function(K){l+=g(K)});var p="[type: array, hash: "+l+"]";return l+O(p)}if(o==="object"){for(var v in i)if(i.hasOwnProperty(v)){var S="[ type: object, key: "+v+", value hash: "+g(i[v])+"]";l+=O(S)}return l}var T="[ type: "+o+" ; value: "+i+"]";return l+O(T)}function m(i,l,o,p,v,S,T,K){o=o||[],v=v||[],T=T||[];var F=v.slice(0);if(typeof S<"u"&&S!==null){if(p){if(typeof p=="function"&&p(F,S))return;if(typeof p=="object"){if(p.prefilter&&p.prefilter(F,S))return;if(p.normalize){var V=p.normalize(F,S,i,l);V&&(i=V[0],l=V[1])}}}F.push(S)}E(i)==="regexp"&&E(l)==="regexp"&&(i=i.toString(),l=l.toString());var B=typeof i,re=typeof l,a,C,_,j,z=B!=="undefined"||T&&T.length>0&&T[T.length-1].lhs&&Object.getOwnPropertyDescriptor(T[T.length-1].lhs,S),W=re!=="undefined"||T&&T.length>0&&T[T.length-1].rhs&&Object.getOwnPropertyDescriptor(T[T.length-1].rhs,S);if(!z&&W)o.push(new c(F,l));else if(!W&&z)o.push(new d(F,i));else if(E(i)!==E(l))o.push(new f(F,i,l));else if(E(i)==="date"&&i-l!==0)o.push(new f(F,i,l));else if(B==="object"&&i!==null&&l!==null){for(a=T.length-1;a>-1;--a)if(T[a].lhs===i){j=!0;break}if(j)i!==l&&o.push(new f(F,i,l));else{if(T.push({lhs:i,rhs:l}),Array.isArray(i)){for(K&&(i.sort(function(I,U){return g(I)-g(U)}),l.sort(function(I,U){return g(I)-g(U)})),a=l.length-1,C=i.length-1;a>C;)o.push(new y(F,a,new c(void 0,l[a--])));for(;C>a;)o.push(new y(F,C,new d(void 0,i[C--])));for(;a>=0;--a)m(i[a],l[a],o,p,F,a,T,K)}else{var G=Object.keys(i),J=Object.keys(l);for(a=0;a<G.length;++a)_=G[a],j=J.indexOf(_),j>=0?(m(i[_],l[_],o,p,F,_,T,K),J[j]=null):m(i[_],void 0,o,p,F,_,T,K);for(a=0;a<J.length;++a)_=J[a],_&&m(void 0,l[_],o,p,F,_,T,K)}T.length=T.length-1}}else i!==l&&(B==="number"&&isNaN(i)&&isNaN(l)||o.push(new f(F,i,l)))}function k(i,l,o,p,v){var S=[];if(m(i,l,S,p,null,null,null,v),o)for(var T=0;T<S.length;++T)o(S[T]);return S}function A(i,l,o,p,v,S,T){return m(i,l,o,p,v,S,T,!0)}function D(i,l,o,p){var v=p?function(T){T&&p.push(T)}:void 0,S=k(i,l,v,o);return p||(S.length?S:void 0)}function h(i,l,o,p){var v=p?function(T){T&&p.push(T)}:void 0,S=k(i,l,v,o,!0);return p||(S.length?S:void 0)}function w(i,l,o){if(o.path&&o.path.length){var p=i[l],v,S=o.path.length-1;for(v=0;v<S;v++)p=p[o.path[v]];switch(o.kind){case"A":w(p[o.path[v]],o.index,o.item);break;case"D":delete p[o.path[v]];break;case"E":case"N":p[o.path[v]]=o.rhs;break}}else switch(o.kind){case"A":w(i[l],o.index,o.item);break;case"D":i=b(i,l);break;case"E":case"N":i[l]=o.rhs;break}return i}function R(i,l,o){if(typeof o>"u"&&l&&~t.indexOf(l.kind)&&(o=l),i&&o&&o.kind){for(var p=i,v=-1,S=o.path?o.path.length-1:0;++v<S;)typeof p[o.path[v]]>"u"&&(p[o.path[v]]=typeof o.path[v+1]<"u"&&typeof o.path[v+1]=="number"?[]:{}),p=p[o.path[v]];switch(o.kind){case"A":o.path&&typeof p[o.path[v]]>"u"&&(p[o.path[v]]=[]),w(o.path?p[o.path[v]]:p,o.index,o.item);break;case"D":delete p[o.path[v]];break;case"E":case"N":p[o.path[v]]=o.rhs;break}}}function P(i,l,o){if(o.path&&o.path.length){var p=i[l],v,S=o.path.length-1;for(v=0;v<S;v++)p=p[o.path[v]];switch(o.kind){case"A":P(p[o.path[v]],o.index,o.item);break;case"D":p[o.path[v]]=o.lhs;break;case"E":p[o.path[v]]=o.lhs;break;case"N":delete p[o.path[v]];break}}else switch(o.kind){case"A":P(i[l],o.index,o.item);break;case"D":i[l]=o.lhs;break;case"E":i[l]=o.lhs;break;case"N":i=b(i,l);break}return i}function L(i,l,o){if(i&&l&&o&&o.kind){var p=i,v,S;for(S=o.path.length-1,v=0;v<S;v++)typeof p[o.path[v]]>"u"&&(p[o.path[v]]={}),p=p[o.path[v]];switch(o.kind){case"A":P(p[o.path[v]],o.index,o.item);break;case"D":p[o.path[v]]=o.lhs;break;case"E":p[o.path[v]]=o.lhs;break;case"N":delete p[o.path[v]];break}}}function N(i,l,o){if(i&&l){var p=function(v){(!o||o(i,l,v))&&R(i,l,v)};k(i,l,p)}}return Object.defineProperties(D,{diff:{value:D,enumerable:!0},orderIndependentDiff:{value:h,enumerable:!0},observableDiff:{value:k,enumerable:!0},orderIndependentObservableDiff:{value:A,enumerable:!0},orderIndepHash:{value:g,enumerable:!0},applyDiff:{value:N,enumerable:!0},applyChange:{value:R,enumerable:!0},revertChange:{value:L,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),D.DeepDiff=D,n&&(n.DeepDiff=D),D})}(te)),te.exports}var de=_e(),ne={exports:{}};const H=new Uint32Array(65536),je=(r,e)=>{const n=r.length,t=e.length,s=1<<n-1;let u=-1,f=0,c=n,d=n;for(;d--;)H[r.charCodeAt(d)]|=1<<d;for(d=0;d<t;d++){let y=H[e.charCodeAt(d)];const b=y|f;y|=(y&u)+u^u,f|=~(y|u),u&=y,f&s&&c++,u&s&&c--,f=f<<1|1,u=u<<1|~(b|f),f&=b}for(d=n;d--;)H[r.charCodeAt(d)]=0;return c},Ne=(r,e)=>{const n=e.length,t=r.length,s=[],u=[],f=Math.ceil(n/32),c=Math.ceil(t/32);for(let m=0;m<f;m++)u[m]=-1,s[m]=0;let d=0;for(;d<c-1;d++){let m=0,k=-1;const A=d*32,D=Math.min(32,t)+A;for(let h=A;h<D;h++)H[r.charCodeAt(h)]|=1<<h;for(let h=0;h<n;h++){const w=H[e.charCodeAt(h)],R=u[h/32|0]>>>h&1,P=s[h/32|0]>>>h&1,L=w|m,N=((w|P)&k)+k^k|w|P;let i=m|~(N|k),l=k&N;i>>>31^R&&(u[h/32|0]^=1<<h),l>>>31^P&&(s[h/32|0]^=1<<h),i=i<<1|R,l=l<<1|P,k=l|~(L|i),m=i&L}for(let h=A;h<D;h++)H[r.charCodeAt(h)]=0}let y=0,b=-1;const E=d*32,O=Math.min(32,t-E)+E;for(let m=E;m<O;m++)H[r.charCodeAt(m)]|=1<<m;let g=t;for(let m=0;m<n;m++){const k=H[e.charCodeAt(m)],A=u[m/32|0]>>>m&1,D=s[m/32|0]>>>m&1,h=k|y,w=((k|D)&b)+b^b|k|D;let R=y|~(w|b),P=b&w;g+=R>>>t-1&1,g-=P>>>t-1&1,R>>>31^A&&(u[m/32|0]^=1<<m),P>>>31^D&&(s[m/32|0]^=1<<m),R=R<<1|A,P=P<<1|D,b=P|~(h|R),y=R&h}for(let m=E;m<O;m++)H[r.charCodeAt(m)]=0;return g},pe=(r,e)=>{if(r.length<e.length){const n=e;e=r,r=n}return e.length===0?r.length:r.length<=32?je(r,e):Ne(r,e)},Ie=Pe(Object.freeze(Object.defineProperty({__proto__:null,closest:(r,e)=>{let n=1/0,t=0;for(let s=0;s<e.length;s++){const u=pe(r,e[s]);u<n&&(n=u,t=s)}return e[t]},distance:pe},Symbol.toStringTag,{value:"Module"})));var he;function Fe(){return he||(he=1,function(r,e){(function(){var n;try{n=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var t=Ie,s=[],u=[],f={get:function(c,d,y){var b=y&&n&&y.useCollator;if(b){var E=c.length,O=d.length;if(E===0)return O;if(O===0)return E;var g,m,k,A,D;for(k=0;k<O;++k)s[k]=k,u[k]=d.charCodeAt(k);s[O]=O;var h;for(k=0;k<E;++k){for(m=k+1,A=0;A<O;++A)g=m,h=n.compare(c.charAt(k),String.fromCharCode(u[A]))===0,m=s[A]+(h?0:1),D=g+1,m>D&&(m=D),D=s[A+1]+1,m>D&&(m=D),s[A]=g;s[A]=m}return m}return t.distance(c,d)}};r!==null&&r.exports===e?r.exports=f:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=f:typeof window<"u"&&window!==null&&(window.Levenshtein=f)})()}(ne,ne.exports)),ne.exports}var Le=Fe();const Me=Ee(Le);class We{diff(e,n,t={}){let s;typeof t=="function"?(s=t,t={}):"callback"in t&&(s=t.callback);const u=this.castInput(e,t),f=this.castInput(n,t),c=this.removeEmpty(this.tokenize(u,t)),d=this.removeEmpty(this.tokenize(f,t));return this.diffWithOptionsObj(c,d,t,s)}diffWithOptionsObj(e,n,t,s){var u;const f=h=>{if(h=this.postProcess(h,t),s){setTimeout(function(){s(h)},0);return}else return h},c=n.length,d=e.length;let y=1,b=c+d;t.maxEditLength!=null&&(b=Math.min(b,t.maxEditLength));const E=(u=t.timeout)!==null&&u!==void 0?u:1/0,O=Date.now()+E,g=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(g[0],n,e,0,t);if(g[0].oldPos+1>=d&&m+1>=c)return f(this.buildValues(g[0].lastComponent,n,e));let k=-1/0,A=1/0;const D=()=>{for(let h=Math.max(k,-y);h<=Math.min(A,y);h+=2){let w;const R=g[h-1],P=g[h+1];R&&(g[h-1]=void 0);let L=!1;if(P){const i=P.oldPos-h;L=P&&0<=i&&i<c}const N=R&&R.oldPos+1<d;if(!L&&!N){g[h]=void 0;continue}if(!N||L&&R.oldPos<P.oldPos?w=this.addToPath(P,!0,!1,0,t):w=this.addToPath(R,!1,!0,1,t),m=this.extractCommon(w,n,e,h,t),w.oldPos+1>=d&&m+1>=c)return f(this.buildValues(w.lastComponent,n,e))||!0;g[h]=w,w.oldPos+1>=d&&(A=Math.min(A,h-1)),m+1>=c&&(k=Math.max(k,h+1))}y++};if(s)(function h(){setTimeout(function(){if(y>b||Date.now()>O)return s(void 0);D()||h()},0)})();else for(;y<=b&&Date.now()<=O;){const h=D();if(h)return h}}addToPath(e,n,t,s,u){const f=e.lastComponent;return f&&!u.oneChangePerToken&&f.added===n&&f.removed===t?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:n,removed:t,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:t,previousComponent:f}}}extractCommon(e,n,t,s,u){const f=n.length,c=t.length;let d=e.oldPos,y=d-s,b=0;for(;y+1<f&&d+1<c&&this.equals(t[d+1],n[y+1],u);)y++,d++,b++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return b&&!u.oneChangePerToken&&(e.lastComponent={count:b,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=d,y}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){const s=[];let u;for(;e;)s.push(e),u=e.previousComponent,delete e.previousComponent,e=u;s.reverse();const f=s.length;let c=0,d=0,y=0;for(;c<f;c++){const b=s[c];if(b.removed)b.value=this.join(t.slice(y,y+b.count)),y+=b.count;else{if(!b.added&&this.useLongestToken){let E=n.slice(d,d+b.count);E=E.map(function(O,g){const m=t[y+g];return m.length>O.length?m:O}),b.value=this.join(E)}else b.value=this.join(n.slice(d,d+b.count));d+=b.count,b.added||(y+=b.count)}}return s}}class Ye extends We{constructor(){super(...arguments),this.tokenize=Ke}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
|
|
22
|
+
<%s key={someKey} {...props} />`,j,I,U,I),re[I+j]=!0)}if(I=null,_!==void 0&&(n(_),I=""+_),f(C)&&(n(C.key),I=""+C.key),"key"in C){_={};for(var ie in C)ie!=="key"&&(_[ie]=C[ie])}else _=C;return I&&c(_,typeof a=="function"?a.displayName||a.name||"Unknown":a),y(a,I,W,z,s(),_,G,J)}function E(a){typeof a=="object"&&a!==null&&a.$$typeof===k&&a._store&&(a._store.validated=1)}var O=x,k=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),w=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),l=Symbol.for("react.activity"),o=Symbol.for("react.client.reference"),p=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,v=Object.prototype.hasOwnProperty,S=Array.isArray,T=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(a){return a()}};var K,F={},V=O.react_stack_bottom_frame.bind(O,u)(),B=T(t(u)),re={};Z.Fragment=g,Z.jsx=function(a,C,_,j,z){var W=1e4>p.recentlyCreatedOwnerStacks++;return b(a,C,_,!1,j,z,W?Error("react-stack-top-frame"):V,W?T(t(a)):B)},Z.jsxs=function(a,C,_,j,z){var W=1e4>p.recentlyCreatedOwnerStacks++;return b(a,C,_,!0,j,z,W?Error("react-stack-top-frame"):V,W?T(t(a)):B)}}()),Z}var ue;function Ce(){return ue||(ue=1,process.env.NODE_ENV==="production"?ee.exports=xe():ee.exports=Te()),ee.exports}var M=Ce();const Q=x.createContext(null),Re="https://api.kelet.ai/",Oe=()=>{const r=x.useContext(Q);if(!r)throw new Error("useKelet must be used within a KeletProvider");return r},oe=()=>{const r=x.useContext(Q);return r?r.feedback:async()=>{}},Se=({apiKey:r,project:e,children:n})=>{const t=x.useContext(Q),s=r||t?.api_key;if(!s)throw new Error("apiKey is required either directly or from a parent KeletProvider");const f={api_key:s,project:e,feedback:async c=>{const d=`${Re}/projects/${e}/feedback`,y={tx_id:c.identifier,source:c.source||"EXPLICIT",vote:c.vote,explanation:c.explanation,correction:c.correction,selection:c.selection},b=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(y)});if(!b.ok)throw new Error(`Failed to submit feedback: ${b.statusText}`)}};return M.jsx(Q.Provider,{value:f,children:n})},q=(r,e)=>{const n={...e};for(const t in e){const s=r[t],u=e[t];/^on[A-Z]/.test(t)?s&&u?n[t]=(...c)=>{u(...c),s(...c)}:s&&(n[t]=s):t==="style"?n[t]={...s,...u}:t==="className"?n[t]=[s,u].filter(Boolean).join(" "):n[t]=u!==void 0?u:s}return{...r,...n}},ce=x.createContext(null),$=()=>{const r=x.useContext(ce);if(!r)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return r},Ae={Root:({children:r,onFeedback:e,defaultText:n="",identifier:t,extra_metadata:s,trigger_name:u})=>{const[f,c]=x.useState(!1),[d,y]=x.useState(n),[b,E]=x.useState(!1),[O,k]=x.useState(null),m=x.useRef(null),g=x.useRef(null),A=x.useId(),D=x.useId(),h=oe(),w=e||h,R=x.useCallback(async()=>{k("upvote");const o={identifier:t,vote:"upvote",...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(o)}finally{E(!1)}},[w,t,s,u]),P=x.useCallback(async()=>{if(k("downvote"),w){const o={identifier:t,vote:"downvote",...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(o)}finally{E(!1)}}c(!0),setTimeout(()=>{m.current?.focus();const o=document.createElement("div");o.setAttribute("aria-live","polite"),o.setAttribute("aria-atomic","true"),o.className="sr-only",o.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(o),setTimeout(()=>document.body.removeChild(o),1e3)},0)},[w,t,s,u]),L=x.useCallback(o=>{y(o.target.value)},[]),N=x.useCallback(async()=>{const o=d.trim().length>0;if(o){const p={identifier:t,vote:"downvote",explanation:d,...s&&{extra_metadata:s},...u&&{trigger_name:u}};try{E(!0),await w(p)}finally{E(!1)}}if(c(!1),y(n),g.current?.focus(),o){const p=document.createElement("div");p.setAttribute("aria-live","polite"),p.className="sr-only",p.textContent="Feedback submitted successfully.",document.body.appendChild(p),setTimeout(()=>document.body.removeChild(p),1e3)}},[w,d,n,t,s,u]),i=x.useCallback(o=>{if(o.key==="Escape")c(!1),y(n),g.current?.focus();else if((o.metaKey||o.ctrlKey)&&o.key==="Enter")o.preventDefault(),N().then(p=>{});else if(o.key==="Tab"&&f){const p=document.getElementById(A);if(p){const v=p.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),S=v[0],T=v[v.length-1];o.shiftKey&&document.activeElement===S?(o.preventDefault(),T?.focus()):!o.shiftKey&&document.activeElement===T&&(o.preventDefault(),S?.focus())}}},[N,f,A,n]),l={onFeedback:w,showPopover:f,setShowPopover:c,feedbackText:d,setFeedbackText:y,isSubmitting:b,setIsSubmitting:E,vote:O,handleUpvote:R,handleDownvote:P,handleTextareaChange:L,handleSubmit:N,handleKeyDown:i,textareaRef:m,triggerRef:g,popoverId:A,triggerId:D,identifier:t,extra_metadata:s,trigger_name:u};return M.jsx(ce.Provider,{value:l,children:r})},UpvoteButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleUpvote:s,isSubmitting:u,vote:f}=$(),c=x.useCallback(b=>{s(),n?.(b)},[s,n]),d={...t,onClick:c,disabled:u||t.disabled,"aria-label":t["aria-label"]||"Upvote feedback",type:"button"},y=f==="upvote";if(r){const b=typeof e=="function"?e({isSelected:y}):e;if(x.isValidElement(b))return x.cloneElement(b,q(d,b.props))}return M.jsx("button",{...d,children:typeof e=="function"?e({isSelected:y}):e})},DownvoteButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleDownvote:s,showPopover:u,isSubmitting:f,popoverId:c,triggerId:d,triggerRef:y,vote:b}=$(),E=x.useCallback(m=>{s(),n?.(m)},[s,n]),O={...t,ref:y,onClick:E,disabled:f||t.disabled,"aria-label":t["aria-label"]||"Downvote feedback","aria-expanded":u,"aria-controls":c,id:d,type:"button"},k=b==="downvote";if(r){const m=typeof e=="function"?e({isSelected:k}):e;if(x.isValidElement(m))return x.cloneElement(m,q(O,m.props));if(m)return m}return M.jsx("button",{...O,children:typeof e=="function"?e({isSelected:k}):e})},Popover:({asChild:r,children:e,...n})=>{const{showPopover:t,handleKeyDown:s,popoverId:u,triggerId:f}=$();if(!t)return null;const c={...n,role:"dialog","aria-labelledby":f,"aria-modal":!0,"aria-describedby":`${u}-description`,id:u,onKeyDown:s,tabIndex:-1};return r&&x.isValidElement(e)?M.jsxs(M.Fragment,{children:[x.cloneElement(e,q(c,e.props)),M.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):M.jsxs("div",{...c,children:[M.jsx("div",{id:`${u}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),e]})},Textarea:({asChild:r,value:e,onChange:n,...t})=>{const{feedbackText:s,handleTextareaChange:u,textareaRef:f,handleKeyDown:c,popoverId:d}=$(),y={...t,ref:f,value:e!==void 0?e:s,onChange:n||u,onKeyDown:c,placeholder:t.placeholder||"What did we miss?","aria-label":t["aria-label"]||"Additional feedback","aria-describedby":`${d}-help`,rows:t.rows||3};return r&&x.isValidElement(t.children)?x.cloneElement(t.children,q(y,t.children.props)):M.jsx("textarea",{...y})},SubmitButton:({asChild:r,children:e,onClick:n,...t})=>{const{handleSubmit:s,isSubmitting:u,feedbackText:f}=$(),c=x.useCallback(E=>{s(),n?.(E)},[s,n]),d=f.trim().length>0,y=d?"Submit feedback":"Close without feedback",b={...t,onClick:c,disabled:u||t.disabled,type:"button","aria-label":t["aria-label"]||y,"aria-describedby":d?void 0:"submit-help"};return r&&x.isValidElement(e)?M.jsxs(M.Fragment,{children:[x.cloneElement(e,q(b,e.props)),!d&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):M.jsxs("button",{...b,children:[e,!d&&M.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};var te={exports:{}},De=te.exports,fe;function _e(){return fe||(fe=1,function(r,e){(function(n,t){var s=t(n);r.exports=s})(De,function(n){var t=["N","E","A","D"];function s(i,l){i.super_=l,i.prototype=Object.create(l.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})}function u(i,l){Object.defineProperty(this,"kind",{value:i,enumerable:!0}),l&&l.length&&Object.defineProperty(this,"path",{value:l,enumerable:!0})}function f(i,l,o){f.super_.call(this,"E",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0}),Object.defineProperty(this,"rhs",{value:o,enumerable:!0})}s(f,u);function c(i,l){c.super_.call(this,"N",i),Object.defineProperty(this,"rhs",{value:l,enumerable:!0})}s(c,u);function d(i,l){d.super_.call(this,"D",i),Object.defineProperty(this,"lhs",{value:l,enumerable:!0})}s(d,u);function y(i,l,o){y.super_.call(this,"A",i),Object.defineProperty(this,"index",{value:l,enumerable:!0}),Object.defineProperty(this,"item",{value:o,enumerable:!0})}s(y,u);function b(i,l,o){var p=i.slice(l+1||i.length);return i.length=l<0?i.length+l:l,i.push.apply(i,p),i}function E(i){var l=typeof i;return l!=="object"?l:i===Math?"math":i===null?"null":Array.isArray(i)?"array":Object.prototype.toString.call(i)==="[object Date]"?"date":typeof i.toString=="function"&&/^\/.*\//.test(i.toString())?"regexp":"object"}function O(i){var l=0;if(i.length===0)return l;for(var o=0;o<i.length;o++){var p=i.charCodeAt(o);l=(l<<5)-l+p,l=l&l}return l}function k(i){var l=0,o=E(i);if(o==="array"){i.forEach(function(K){l+=k(K)});var p="[type: array, hash: "+l+"]";return l+O(p)}if(o==="object"){for(var v in i)if(i.hasOwnProperty(v)){var S="[ type: object, key: "+v+", value hash: "+k(i[v])+"]";l+=O(S)}return l}var T="[ type: "+o+" ; value: "+i+"]";return l+O(T)}function m(i,l,o,p,v,S,T,K){o=o||[],v=v||[],T=T||[];var F=v.slice(0);if(typeof S<"u"&&S!==null){if(p){if(typeof p=="function"&&p(F,S))return;if(typeof p=="object"){if(p.prefilter&&p.prefilter(F,S))return;if(p.normalize){var V=p.normalize(F,S,i,l);V&&(i=V[0],l=V[1])}}}F.push(S)}E(i)==="regexp"&&E(l)==="regexp"&&(i=i.toString(),l=l.toString());var B=typeof i,re=typeof l,a,C,_,j,z=B!=="undefined"||T&&T.length>0&&T[T.length-1].lhs&&Object.getOwnPropertyDescriptor(T[T.length-1].lhs,S),W=re!=="undefined"||T&&T.length>0&&T[T.length-1].rhs&&Object.getOwnPropertyDescriptor(T[T.length-1].rhs,S);if(!z&&W)o.push(new c(F,l));else if(!W&&z)o.push(new d(F,i));else if(E(i)!==E(l))o.push(new f(F,i,l));else if(E(i)==="date"&&i-l!==0)o.push(new f(F,i,l));else if(B==="object"&&i!==null&&l!==null){for(a=T.length-1;a>-1;--a)if(T[a].lhs===i){j=!0;break}if(j)i!==l&&o.push(new f(F,i,l));else{if(T.push({lhs:i,rhs:l}),Array.isArray(i)){for(K&&(i.sort(function(I,U){return k(I)-k(U)}),l.sort(function(I,U){return k(I)-k(U)})),a=l.length-1,C=i.length-1;a>C;)o.push(new y(F,a,new c(void 0,l[a--])));for(;C>a;)o.push(new y(F,C,new d(void 0,i[C--])));for(;a>=0;--a)m(i[a],l[a],o,p,F,a,T,K)}else{var G=Object.keys(i),J=Object.keys(l);for(a=0;a<G.length;++a)_=G[a],j=J.indexOf(_),j>=0?(m(i[_],l[_],o,p,F,_,T,K),J[j]=null):m(i[_],void 0,o,p,F,_,T,K);for(a=0;a<J.length;++a)_=J[a],_&&m(void 0,l[_],o,p,F,_,T,K)}T.length=T.length-1}}else i!==l&&(B==="number"&&isNaN(i)&&isNaN(l)||o.push(new f(F,i,l)))}function g(i,l,o,p,v){var S=[];if(m(i,l,S,p,null,null,null,v),o)for(var T=0;T<S.length;++T)o(S[T]);return S}function A(i,l,o,p,v,S,T){return m(i,l,o,p,v,S,T,!0)}function D(i,l,o,p){var v=p?function(T){T&&p.push(T)}:void 0,S=g(i,l,v,o);return p||(S.length?S:void 0)}function h(i,l,o,p){var v=p?function(T){T&&p.push(T)}:void 0,S=g(i,l,v,o,!0);return p||(S.length?S:void 0)}function w(i,l,o){if(o.path&&o.path.length){var p=i[l],v,S=o.path.length-1;for(v=0;v<S;v++)p=p[o.path[v]];switch(o.kind){case"A":w(p[o.path[v]],o.index,o.item);break;case"D":delete p[o.path[v]];break;case"E":case"N":p[o.path[v]]=o.rhs;break}}else switch(o.kind){case"A":w(i[l],o.index,o.item);break;case"D":i=b(i,l);break;case"E":case"N":i[l]=o.rhs;break}return i}function R(i,l,o){if(typeof o>"u"&&l&&~t.indexOf(l.kind)&&(o=l),i&&o&&o.kind){for(var p=i,v=-1,S=o.path?o.path.length-1:0;++v<S;)typeof p[o.path[v]]>"u"&&(p[o.path[v]]=typeof o.path[v+1]<"u"&&typeof o.path[v+1]=="number"?[]:{}),p=p[o.path[v]];switch(o.kind){case"A":o.path&&typeof p[o.path[v]]>"u"&&(p[o.path[v]]=[]),w(o.path?p[o.path[v]]:p,o.index,o.item);break;case"D":delete p[o.path[v]];break;case"E":case"N":p[o.path[v]]=o.rhs;break}}}function P(i,l,o){if(o.path&&o.path.length){var p=i[l],v,S=o.path.length-1;for(v=0;v<S;v++)p=p[o.path[v]];switch(o.kind){case"A":P(p[o.path[v]],o.index,o.item);break;case"D":p[o.path[v]]=o.lhs;break;case"E":p[o.path[v]]=o.lhs;break;case"N":delete p[o.path[v]];break}}else switch(o.kind){case"A":P(i[l],o.index,o.item);break;case"D":i[l]=o.lhs;break;case"E":i[l]=o.lhs;break;case"N":i=b(i,l);break}return i}function L(i,l,o){if(i&&l&&o&&o.kind){var p=i,v,S;for(S=o.path.length-1,v=0;v<S;v++)typeof p[o.path[v]]>"u"&&(p[o.path[v]]={}),p=p[o.path[v]];switch(o.kind){case"A":P(p[o.path[v]],o.index,o.item);break;case"D":p[o.path[v]]=o.lhs;break;case"E":p[o.path[v]]=o.lhs;break;case"N":delete p[o.path[v]];break}}}function N(i,l,o){if(i&&l){var p=function(v){(!o||o(i,l,v))&&R(i,l,v)};g(i,l,p)}}return Object.defineProperties(D,{diff:{value:D,enumerable:!0},orderIndependentDiff:{value:h,enumerable:!0},observableDiff:{value:g,enumerable:!0},orderIndependentObservableDiff:{value:A,enumerable:!0},orderIndepHash:{value:k,enumerable:!0},applyDiff:{value:N,enumerable:!0},applyChange:{value:R,enumerable:!0},revertChange:{value:L,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),D.DeepDiff=D,n&&(n.DeepDiff=D),D})}(te)),te.exports}var de=_e(),ne={exports:{}};const H=new Uint32Array(65536),je=(r,e)=>{const n=r.length,t=e.length,s=1<<n-1;let u=-1,f=0,c=n,d=n;for(;d--;)H[r.charCodeAt(d)]|=1<<d;for(d=0;d<t;d++){let y=H[e.charCodeAt(d)];const b=y|f;y|=(y&u)+u^u,f|=~(y|u),u&=y,f&s&&c++,u&s&&c--,f=f<<1|1,u=u<<1|~(b|f),f&=b}for(d=n;d--;)H[r.charCodeAt(d)]=0;return c},Ne=(r,e)=>{const n=e.length,t=r.length,s=[],u=[],f=Math.ceil(n/32),c=Math.ceil(t/32);for(let m=0;m<f;m++)u[m]=-1,s[m]=0;let d=0;for(;d<c-1;d++){let m=0,g=-1;const A=d*32,D=Math.min(32,t)+A;for(let h=A;h<D;h++)H[r.charCodeAt(h)]|=1<<h;for(let h=0;h<n;h++){const w=H[e.charCodeAt(h)],R=u[h/32|0]>>>h&1,P=s[h/32|0]>>>h&1,L=w|m,N=((w|P)&g)+g^g|w|P;let i=m|~(N|g),l=g&N;i>>>31^R&&(u[h/32|0]^=1<<h),l>>>31^P&&(s[h/32|0]^=1<<h),i=i<<1|R,l=l<<1|P,g=l|~(L|i),m=i&L}for(let h=A;h<D;h++)H[r.charCodeAt(h)]=0}let y=0,b=-1;const E=d*32,O=Math.min(32,t-E)+E;for(let m=E;m<O;m++)H[r.charCodeAt(m)]|=1<<m;let k=t;for(let m=0;m<n;m++){const g=H[e.charCodeAt(m)],A=u[m/32|0]>>>m&1,D=s[m/32|0]>>>m&1,h=g|y,w=((g|D)&b)+b^b|g|D;let R=y|~(w|b),P=b&w;k+=R>>>t-1&1,k-=P>>>t-1&1,R>>>31^A&&(u[m/32|0]^=1<<m),P>>>31^D&&(s[m/32|0]^=1<<m),R=R<<1|A,P=P<<1|D,b=P|~(h|R),y=R&h}for(let m=E;m<O;m++)H[r.charCodeAt(m)]=0;return k},pe=(r,e)=>{if(r.length<e.length){const n=e;e=r,r=n}return e.length===0?r.length:r.length<=32?je(r,e):Ne(r,e)},Ie=Pe(Object.freeze(Object.defineProperty({__proto__:null,closest:(r,e)=>{let n=1/0,t=0;for(let s=0;s<e.length;s++){const u=pe(r,e[s]);u<n&&(n=u,t=s)}return e[t]},distance:pe},Symbol.toStringTag,{value:"Module"})));var he;function Fe(){return he||(he=1,function(r,e){(function(){var n;try{n=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var t=Ie,s=[],u=[],f={get:function(c,d,y){var b=y&&n&&y.useCollator;if(b){var E=c.length,O=d.length;if(E===0)return O;if(O===0)return E;var k,m,g,A,D;for(g=0;g<O;++g)s[g]=g,u[g]=d.charCodeAt(g);s[O]=O;var h;for(g=0;g<E;++g){for(m=g+1,A=0;A<O;++A)k=m,h=n.compare(c.charAt(g),String.fromCharCode(u[A]))===0,m=s[A]+(h?0:1),D=k+1,m>D&&(m=D),D=s[A+1]+1,m>D&&(m=D),s[A]=k;s[A]=m}return m}return t.distance(c,d)}};r!==null&&r.exports===e?r.exports=f:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=f:typeof window<"u"&&window!==null&&(window.Levenshtein=f)})()}(ne,ne.exports)),ne.exports}var Le=Fe();const Me=Ee(Le);class We{diff(e,n,t={}){let s;typeof t=="function"?(s=t,t={}):"callback"in t&&(s=t.callback);const u=this.castInput(e,t),f=this.castInput(n,t),c=this.removeEmpty(this.tokenize(u,t)),d=this.removeEmpty(this.tokenize(f,t));return this.diffWithOptionsObj(c,d,t,s)}diffWithOptionsObj(e,n,t,s){var u;const f=h=>{if(h=this.postProcess(h,t),s){setTimeout(function(){s(h)},0);return}else return h},c=n.length,d=e.length;let y=1,b=c+d;t.maxEditLength!=null&&(b=Math.min(b,t.maxEditLength));const E=(u=t.timeout)!==null&&u!==void 0?u:1/0,O=Date.now()+E,k=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(k[0],n,e,0,t);if(k[0].oldPos+1>=d&&m+1>=c)return f(this.buildValues(k[0].lastComponent,n,e));let g=-1/0,A=1/0;const D=()=>{for(let h=Math.max(g,-y);h<=Math.min(A,y);h+=2){let w;const R=k[h-1],P=k[h+1];R&&(k[h-1]=void 0);let L=!1;if(P){const i=P.oldPos-h;L=P&&0<=i&&i<c}const N=R&&R.oldPos+1<d;if(!L&&!N){k[h]=void 0;continue}if(!N||L&&R.oldPos<P.oldPos?w=this.addToPath(P,!0,!1,0,t):w=this.addToPath(R,!1,!0,1,t),m=this.extractCommon(w,n,e,h,t),w.oldPos+1>=d&&m+1>=c)return f(this.buildValues(w.lastComponent,n,e))||!0;k[h]=w,w.oldPos+1>=d&&(A=Math.min(A,h-1)),m+1>=c&&(g=Math.max(g,h+1))}y++};if(s)(function h(){setTimeout(function(){if(y>b||Date.now()>O)return s(void 0);D()||h()},0)})();else for(;y<=b&&Date.now()<=O;){const h=D();if(h)return h}}addToPath(e,n,t,s,u){const f=e.lastComponent;return f&&!u.oneChangePerToken&&f.added===n&&f.removed===t?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:n,removed:t,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:t,previousComponent:f}}}extractCommon(e,n,t,s,u){const f=n.length,c=t.length;let d=e.oldPos,y=d-s,b=0;for(;y+1<f&&d+1<c&&this.equals(t[d+1],n[y+1],u);)y++,d++,b++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return b&&!u.oneChangePerToken&&(e.lastComponent={count:b,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=d,y}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){const s=[];let u;for(;e;)s.push(e),u=e.previousComponent,delete e.previousComponent,e=u;s.reverse();const f=s.length;let c=0,d=0,y=0;for(;c<f;c++){const b=s[c];if(b.removed)b.value=this.join(t.slice(y,y+b.count)),y+=b.count;else{if(!b.added&&this.useLongestToken){let E=n.slice(d,d+b.count);E=E.map(function(O,k){const m=t[y+k];return m.length>O.length?m:O}),b.value=this.join(E)}else b.value=this.join(n.slice(d,d+b.count));d+=b.count,b.added||(y+=b.count)}}return s}}class Ye extends We{constructor(){super(...arguments),this.tokenize=Ke}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
|
|
23
23
|
`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
|
|
24
24
|
`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
|
|
25
25
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
26
26
|
`)&&(n=n.slice(0,-1))),super.equals(e,n,t)}}const ze=new Ye;function me(r,e,n){return ze.diff(r,e,n)}function Ke(r,e){e.stripTrailingCr&&(r=r.replace(/\r\n/g,`
|
|
27
|
-
`));const n=[],t=r.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let s=0;s<t.length;s++){const u=t[s];s%2&&!e.newlineIsToken?n[n.length-1]+=u:n.push(u)}return n}function be(r,e,n,t,s,u,f){let c;f?typeof f=="function"?c={callback:f}:c=f:c={},typeof c.context>"u"&&(c.context=4);const d=c.context;if(c.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(c.callback){const{callback:b}=c;me(n,t,Object.assign(Object.assign({},c),{callback:E=>{const O=y(E);b(O)}}))}else return y(me(n,t,c));function y(b){if(!b)return;b.push({value:"",lines:[]});function E(h){return h.map(function(w){return" "+w})}const O=[];let
|
|
27
|
+
`));const n=[],t=r.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let s=0;s<t.length;s++){const u=t[s];s%2&&!e.newlineIsToken?n[n.length-1]+=u:n.push(u)}return n}function be(r,e,n,t,s,u,f){let c;f?typeof f=="function"?c={callback:f}:c=f:c={},typeof c.context>"u"&&(c.context=4);const d=c.context;if(c.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(c.callback){const{callback:b}=c;me(n,t,Object.assign(Object.assign({},c),{callback:E=>{const O=y(E);b(O)}}))}else return y(me(n,t,c));function y(b){if(!b)return;b.push({value:"",lines:[]});function E(h){return h.map(function(w){return" "+w})}const O=[];let k=0,m=0,g=[],A=1,D=1;for(let h=0;h<b.length;h++){const w=b[h],R=w.lines||He(w.value);if(w.lines=R,w.added||w.removed){if(!k){const P=b[h-1];k=A,m=D,P&&(g=d>0?E(P.lines.slice(-d)):[],k-=g.length,m-=g.length)}for(const P of R)g.push((w.added?"+":"-")+P);w.added?D+=R.length:A+=R.length}else{if(k)if(R.length<=d*2&&h<b.length-2)for(const P of E(R))g.push(P);else{const P=Math.min(R.length,d);for(const N of E(R.slice(0,P)))g.push(N);const L={oldStart:k,oldLines:A-k+P,newStart:m,newLines:D-m+P,lines:g};O.push(L),k=0,m=0,g=[]}A+=R.length,D+=R.length}}for(const h of O)for(let w=0;w<h.lines.length;w++)h.lines[w].endsWith(`
|
|
28
28
|
`)?h.lines[w]=h.lines[w].slice(0,-1):(h.lines.splice(w+1,0,"\"),w++);return{oldFileName:r,newFileName:e,oldHeader:s,newHeader:u,hunks:O}}}function se(r){if(Array.isArray(r))return r.map(se).join(`
|
|
29
29
|
`);const e=[];r.oldFileName==r.newFileName&&e.push("Index: "+r.oldFileName),e.push("==================================================================="),e.push("--- "+r.oldFileName+(typeof r.oldHeader>"u"?"":" "+r.oldHeader)),e.push("+++ "+r.newFileName+(typeof r.newHeader>"u"?"":" "+r.newHeader));for(let n=0;n<r.hunks.length;n++){const t=r.hunks[n];t.oldLines===0&&(t.oldStart-=1),t.newLines===0&&(t.newStart-=1),e.push("@@ -"+t.oldStart+","+t.oldLines+" +"+t.newStart+","+t.newLines+" @@");for(const s of t.lines)e.push(s)}return e.join(`
|
|
30
30
|
`)+`
|
|
31
31
|
`}function Ue(r,e,n,t,s,u,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){const{callback:c}=f;be(r,e,n,t,s,u,Object.assign(Object.assign({},f),{callback:d=>{c(d?se(d):void 0)}}))}else{const c=be(r,e,n,t,s,u,f);return c?se(c):void 0}}function He(r){const e=r.endsWith(`
|
|
32
32
|
`),n=r.split(`
|
|
33
33
|
`).map(t=>t+`
|
|
34
|
-
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function Je(r,e,n="git",t=3){switch(n){case"git":return ve(r,e,t);case"object":return Ve(r,e);case"json":return Be(r,e);default:return ve(r,e,t)}}function ve(r,e,n=3){const t=
|
|
34
|
+
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function Je(r,e,n="git",t=3){switch(n){case"git":return ve(r,e,t);case"object":return Ve(r,e);case"json":return Be(r,e);default:return ve(r,e,t)}}function ve(r,e,n=3){const t=ke(r),s=ke(e);return Ue("","",t,s,"","",{context:n}).split(`
|
|
35
35
|
`).slice(2).join(`
|
|
36
|
-
`)}function Ve(r,e){const n=de.diff(r,e)||[];return JSON.stringify(n,null,2)}function Be(r,e){return JSON.stringify({before:r,after:e},null,2)}function Ge(r,e){return typeof r=="string"&&typeof e=="string"?ye(r,e):typeof r=="number"&&typeof e=="number"?we(r,e):Xe(r,e)}function ye(r,e){if(r===e)return 0;if(r.length===0||e.length===0)return 1;const n=Me.get(r,e),t=Math.max(r.length,e.length);return n/t}function we(r,e){if(r===e)return 0;if(r===0)return 1;const n=Math.abs(e-r),t=Math.max(Math.abs(r),Math.abs(e));return Math.min(n/t,1)}function Xe(r,e){if(r===e)return 0;const n=de.diff(r,e)||[];if(n.length===0)return 0;const t=
|
|
36
|
+
`)}function Ve(r,e){const n=de.diff(r,e)||[];return JSON.stringify(n,null,2)}function Be(r,e){return JSON.stringify({before:r,after:e},null,2)}function Ge(r,e){return typeof r=="string"&&typeof e=="string"?ye(r,e):typeof r=="number"&&typeof e=="number"?we(r,e):Xe(r,e)}function ye(r,e){if(r===e)return 0;if(r.length===0||e.length===0)return 1;const n=Me.get(r,e),t=Math.max(r.length,e.length);return n/t}function we(r,e){if(r===e)return 0;if(r===0)return 1;const n=Math.abs(e-r),t=Math.max(Math.abs(r),Math.abs(e));return Math.min(n/t,1)}function Xe(r,e){if(r===e)return 0;const n=de.diff(r,e)||[];if(n.length===0)return 0;const t=ge(r),s=ge(e),u=Math.max(t,s);if(u===0)return 0;let f=0;for(const c of n)switch(c.kind){case"N":f+=1;break;case"D":f+=1;break;case"E":if(typeof c.lhs=="string"&&typeof c.rhs=="string"){const d=ye(c.lhs,c.rhs);f+=d}else if(typeof c.lhs=="number"&&typeof c.rhs=="number"){const d=we(c.lhs,c.rhs);f+=d}else f+=1;break;case"A":f+=.5;break}return Math.min(f/u,1)}function ge(r){if(r==null)return 0;if(typeof r!="object")return 1;if(Array.isArray(r))return r.length;let e=0;for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e+=1);return e}function ke(r){try{return JSON.stringify(r,(e,n)=>typeof n=="function"?"[Function]":n===void 0?"[undefined]":n===1/0?"[Infinity]":Number.isNaN(n)?"[NaN]":n,2)}catch{return String(r)}}function Ze(r,e,n){const[t,s]=x.useState(r),u=x.useRef(r),f=x.useRef(r),c=x.useRef(!0),d=x.useRef(null),y=x.useRef(void 0),b=oe(),E=n?.onFeedback||b,O=n?.debounceMs??1500,k=n?.diffType??"git",m=n?.compareWith,g=n?.default_trigger_name??"auto_state_change",A=x.useCallback((h,w,R)=>{const P=Ge(h,w),L=Je(h,w,k);let N;n?.vote?typeof n.vote=="function"?N=n.vote(h,w,P):N=n.vote:N=P>.5?"downvote":"upvote";const i=typeof e=="function"?e(w):e;E({identifier:i,vote:N,explanation:`State change with diff percentage: ${(P*100).toFixed(1)}%`,correction:L,source:"IMPLICIT",extra_metadata:n?.metadata,trigger_name:R})},[n,e,k,E]),D=(h,w)=>{const R=w||g;if(d.current&&y.current&&y.current!==R){clearTimeout(d.current);const P=f.current;A(P,t,y.current),d.current=null}y.current=R,s(P=>typeof h=="function"?h(P):h)};return x.useEffect(()=>{if(c.current){c.current=!1,u.current=t,f.current=t;return}const h=u.current;return(m?m(h,t):JSON.stringify(h)===JSON.stringify(t))||(d.current||(f.current=h),d.current&&clearTimeout(d.current),u.current=t,d.current=setTimeout(()=>{const R=f.current,P=t;A(R,P,y.current||g),f.current=P,d.current=null},O)),()=>{d.current&&clearTimeout(d.current)}},[t,e,n,r,E,k,O,m,g,A]),[t,D]}Y.KeletContext=Q,Y.KeletProvider=Se,Y.VoteFeedback=Ae,Y.useDefaultFeedbackHandler=oe,Y.useFeedbackState=Ze,Y.useKelet=Oe,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { VoteFeedback } from './components';
|
|
2
|
+
export type { FeedbackData, VoteFeedbackRootProps, UpvoteButtonProps, DownvoteButtonProps, PopoverProps, TextareaProps, SubmitButtonProps, } from './types';
|
|
3
|
+
export { KeletProvider, KeletContext, useKelet, useDefaultFeedbackHandler, } from './contexts/kelet';
|
|
4
|
+
export { useFeedbackState } from './hooks/feedback-state';
|
|
5
|
+
export type { FeedbackStateOptions, DiffType } from './hooks/feedback-state';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelet-ai/feedback-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/kelet-ai/feedback-ui.git"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"license": "APACHE-2.0",
|
|
78
78
|
"scripts": {
|
|
79
79
|
"dev": "NODE_NO_WARNINGS=1 storybook dev -p 6006",
|
|
80
|
-
"build": "vite build",
|
|
80
|
+
"build": "tsc -b && vite build",
|
|
81
81
|
"build-storybook": "storybook build",
|
|
82
82
|
"test": "vitest",
|
|
83
83
|
"test:unit": "vitest --project=unit",
|
|
@@ -90,7 +90,9 @@
|
|
|
90
90
|
"preview": "vite preview",
|
|
91
91
|
"prepublishOnly": "bun run build",
|
|
92
92
|
"storybook": "NODE_NO_WARNINGS=1 storybook dev -p 6006",
|
|
93
|
-
"registry:build": "bun shadcn build"
|
|
93
|
+
"registry:build": "bun shadcn build",
|
|
94
|
+
"typecheck": "tsc -b",
|
|
95
|
+
"verify-build": "bun test ./.github/build-verification.test.ts"
|
|
94
96
|
},
|
|
95
97
|
"type": "module",
|
|
96
98
|
"types": "./dist/index.d.ts",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { default as Ae } from 'react';
|
|
2
|
-
declare const se: Ae.Context<null>;
|
|
3
|
-
declare function dt({ api_key: r, project: e, children: n }: {
|
|
4
|
-
api_key: any;
|
|
5
|
-
project: any;
|
|
6
|
-
children: any;
|
|
7
|
-
}): any;
|
|
8
|
-
declare namespace pt {
|
|
9
|
-
export { Le as Root };
|
|
10
|
-
export { Me as UpvoteButton };
|
|
11
|
-
export { $e as DownvoteButton };
|
|
12
|
-
export { qe as Popover };
|
|
13
|
-
export { We as Textarea };
|
|
14
|
-
export { Ye as SubmitButton };
|
|
15
|
-
}
|
|
16
|
-
declare function Pe(): any;
|
|
17
|
-
declare function ht(r: any, e: any, n: any): any[];
|
|
18
|
-
declare function ft(): never;
|
|
19
|
-
declare function Le({ children: r, onFeedback: e, defaultText: n, identifier: t, extra_metadata: i, trigger_name: u }: {
|
|
20
|
-
children: any;
|
|
21
|
-
onFeedback: any;
|
|
22
|
-
defaultText?: string | undefined;
|
|
23
|
-
identifier: any;
|
|
24
|
-
extra_metadata: any;
|
|
25
|
-
trigger_name: any;
|
|
26
|
-
}): any;
|
|
27
|
-
declare function Me({ asChild: r, children: e, onClick: n, ...t }: {
|
|
28
|
-
[x: string]: any;
|
|
29
|
-
asChild: any;
|
|
30
|
-
children: any;
|
|
31
|
-
onClick: any;
|
|
32
|
-
}): any;
|
|
33
|
-
declare function $e({ asChild: r, children: e, onClick: n, ...t }: {
|
|
34
|
-
[x: string]: any;
|
|
35
|
-
asChild: any;
|
|
36
|
-
children: any;
|
|
37
|
-
onClick: any;
|
|
38
|
-
}): any;
|
|
39
|
-
declare function qe({ asChild: r, children: e, ...n }: {
|
|
40
|
-
[x: string]: any;
|
|
41
|
-
asChild: any;
|
|
42
|
-
children: any;
|
|
43
|
-
}): any;
|
|
44
|
-
declare function We({ asChild: r, value: e, onChange: n, ...t }: {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
asChild: any;
|
|
47
|
-
value: any;
|
|
48
|
-
onChange: any;
|
|
49
|
-
}): any;
|
|
50
|
-
declare function Ye({ asChild: r, children: e, onClick: n, ...t }: {
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
asChild: any;
|
|
53
|
-
children: any;
|
|
54
|
-
onClick: any;
|
|
55
|
-
}): any;
|
|
56
|
-
export { se as KeletContext, dt as KeletProvider, pt as VoteFeedback, Pe as useDefaultFeedbackHandler, ht as useFeedbackState, ft as useKelet };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { VoteFeedback } from './vote-feedback';
|
|
3
|
-
declare const meta: Meta<typeof VoteFeedback.Root>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const HeadlessBasic: Story;
|
|
7
|
-
export declare const HeadlessCustomStyling: Story;
|
|
8
|
-
export declare const HeadlessMinimal: Story;
|
|
9
|
-
export declare const AsChildPattern: Story;
|
|
10
|
-
export declare const CompleteWorkflow: Story;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
interface FeedbackStateTestProps {
|
|
4
|
-
initialState: any;
|
|
5
|
-
identifier: string | ((state: any) => string);
|
|
6
|
-
options?: any;
|
|
7
|
-
onFeedback?: (data: any) => void;
|
|
8
|
-
}
|
|
9
|
-
declare const FeedbackStateTest: React.FC<FeedbackStateTestProps>;
|
|
10
|
-
declare const meta: Meta<typeof FeedbackStateTest>;
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
export declare const PrimitiveState: Story;
|
|
14
|
-
export declare const ObjectState: Story;
|
|
15
|
-
export declare const ArrayState: Story;
|
|
16
|
-
export declare const StringState: Story;
|
|
17
|
-
export declare const CustomValue: Story;
|
|
18
|
-
export declare const RapidChanges: Story;
|
|
19
|
-
export declare const CustomVoteLogic: Story;
|
|
20
|
-
export declare const StaticVoteConfiguration: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { VoteFeedback } from './components';
|
|
2
|
-
export type { FeedbackData, VoteFeedbackRootProps, UpvoteButtonProps, DownvoteButtonProps, PopoverProps, TextareaProps, SubmitButtonProps, } from './types';
|
|
3
|
-
export { KeletProvider, KeletContext, useKelet, useDefaultFeedbackHandler, } from './contexts/kelet';
|
|
4
|
-
export { useFeedbackState } from './hooks/feedback-state';
|
|
5
|
-
export type { FeedbackStateOptions, DiffType } from './hooks/feedback-state';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { VoteFeedbackRootProps } from '../../types';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
interface ShadcnVoteFeedbackProps extends VoteFeedbackRootProps {
|
|
4
|
-
variant?: 'default' | 'outline' | 'ghost' | 'secondary';
|
|
5
|
-
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
6
|
-
title?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
declare const ShadcnVoteFeedback: React.ForwardRefExoticComponent<ShadcnVoteFeedbackProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
export { ShadcnVoteFeedback };
|
|
13
|
-
export type { ShadcnVoteFeedbackProps };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { ShadcnVoteFeedback } from './vote-feedback';
|
|
3
|
-
declare const meta: Meta<typeof ShadcnVoteFeedback>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const Default: Story;
|
|
7
|
-
export declare const Ghost: Story;
|
|
8
|
-
export declare const Secondary: Story;
|
|
9
|
-
export declare const DefaultFilled: Story;
|
|
10
|
-
export declare const CustomContent: Story;
|
|
11
|
-
export declare const InlineUsage: Story;
|
package/dist/vite.config.d.ts
DELETED
package/dist/vitest.config.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|