@vervstack/chures 0.0.1

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/chures.js ADDED
@@ -0,0 +1,216 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._TelegramSignInButtonContainer_1pw4t_1{--tg-blue: #2AABEE;--tg-blue-2: #229ED9;display:inline-flex;align-items:center;justify-content:center;gap:.625rem;width:100%;padding:1rem 1.375rem;background:linear-gradient(180deg,var(--tg-blue) 0%,var(--tg-blue-2) 100%);border:0;border-radius:.875rem;color:#fff;font-family:Comfortaa,sans-serif;font-weight:600;font-size:1rem;letter-spacing:-.005em;cursor:pointer;box-shadow:inset 0 .0625rem #ffffff26,0 .75rem 2rem -.75rem #2aabee8c;transition:transform .14s ease,box-shadow .2s ease,filter .16s ease}._TelegramSignInButtonContainer_1pw4t_1:hover{transform:translateY(-.0625rem);box-shadow:inset 0 .0625rem #ffffff2e,0 1.125rem 2.375rem -.75rem #2aabeea6;filter:brightness(1.05)}._TelegramSignInButtonContainer_1pw4t_1:active{transform:translateY(0);filter:brightness(.97)}._TelegramSignInButtonContainer_1pw4t_1:focus-visible{outline:.125rem solid rgba(255,255,255,.8);outline-offset:.125rem}._TelegramSignInButtonContainer_1pw4t_1:disabled{opacity:.6;cursor:not-allowed}._FullSize_1pw4t_49{height:100%}._Icon_1pw4t_53{flex-shrink:0}._ToastContainer_1g7il_1{position:fixed;right:1.5rem;top:1.5rem;width:clamp(25vw,24.5rem,95vw);display:flex;flex-direction:column;gap:1rem;z-index:9999}._Toast_1g7il_1{min-height:4rem;border:var(--ta-accent, #229ED9) 1px solid;border-radius:1rem;padding:1rem;box-sizing:border-box;position:relative;background:#000;display:flex;flex-direction:column}._Toast_1g7il_1>div:first-child{font-weight:700;font-size:var(--ta-font-sm, .875rem);color:var(--ta-fg, #ffffff)}._Toast_1g7il_1._error_1g7il_33{border-color:var(--ta-error, #ef4444)}._Toast_1g7il_1._error_1g7il_33>div:first-child{color:var(--ta-error, #ef4444)}._Toast_1g7il_1._warn_1g7il_41{border-color:var(--ta-warn, #f59e0b)}._Toast_1g7il_1._warn_1g7il_41>div:first-child{color:var(--ta-warn, #f59e0b)}._Toast_1g7il_1._info_1g7il_49{border-color:var(--ta-accent, #229ED9)}._Toast_1g7il_1 ._Description_1g7il_53{color:var(--ta-fg-muted, #9ca3af);font-size:var(--ta-font-xs, .75rem);margin-top:.125rem}._Toast_1g7il_1 ._DismissButton_1g7il_59{position:absolute;width:1rem;height:1rem;display:flex;justify-content:center;align-items:center;top:0;right:1%;cursor:pointer;font-size:1.5rem;color:var(--ta-fg-muted, #9ca3af)}._slideIn_1g7il_79{animation:_slideIn_1g7il_79 .2s ease forwards}._slideOut_1g7il_83{animation:_slideOut_1g7il_83 .2s ease forwards}@keyframes _slideIn_1g7il_79{0%{opacity:0;transform:translate(2rem)}to{opacity:1;transform:translate(0)}}@keyframes _slideOut_1g7il_83{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(2rem)}}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ import { jsxs as w, jsx as a, Fragment as S } from "react/jsx-runtime";
3
+ import { useRef as C, useState as _, useEffect as y } from "react";
4
+ import { AnimatePresence as x, motion as B } from "framer-motion";
5
+ import { create as L } from "zustand";
6
+ const R = "https://oauth.telegram.org/js/telegram-login.js?3";
7
+ function E(n) {
8
+ const { botId: o, redirectUri: e, requestAccess: r = "write" } = n, s = C(n.onSuccess);
9
+ s.current = n.onSuccess;
10
+ const [t, i] = _(!1), [c, l] = _(!1);
11
+ y(function() {
12
+ if (!o) return;
13
+ const u = e ?? window.location.origin;
14
+ l(!0), i(!1);
15
+ const d = document.createElement("script");
16
+ return d.src = R, d.async = !0, d.onload = function() {
17
+ const g = window.Telegram;
18
+ g && (g.Login.init(
19
+ { client_id: o, redirect_uri: u },
20
+ function(I) {
21
+ s.current(I);
22
+ }
23
+ ), i(!0)), l(!1);
24
+ }, d.onerror = function() {
25
+ l(!1);
26
+ }, document.head.appendChild(d), function() {
27
+ document.head.contains(d) && document.head.removeChild(d), i(!1), l(!1);
28
+ };
29
+ }, [o, e]);
30
+ function m() {
31
+ const u = window.Telegram;
32
+ if (!t || !u) return;
33
+ const d = e ?? window.location.origin;
34
+ u.Login.auth(
35
+ { client_id: o, redirect_uri: d, request_access: r },
36
+ function(g) {
37
+ s.current(g);
38
+ }
39
+ );
40
+ }
41
+ return { login: m, isReady: t, isLoading: c };
42
+ }
43
+ const b = "_TelegramSignInButtonContainer_1pw4t_1", j = "_FullSize_1pw4t_49", D = "_Icon_1pw4t_53", h = {
44
+ TelegramSignInButtonContainer: b,
45
+ FullSize: j,
46
+ Icon: D
47
+ }, O = {
48
+ en: "Continue with Telegram",
49
+ ru: "Войти через Telegram"
50
+ };
51
+ function N() {
52
+ return /* @__PURE__ */ a(
53
+ "svg",
54
+ {
55
+ viewBox: "0 0 24 24",
56
+ width: "20",
57
+ height: "20",
58
+ fill: "currentColor",
59
+ "aria-hidden": "true",
60
+ className: h.Icon,
61
+ children: /* @__PURE__ */ a("path", { d: "M22 3.5L2.5 11l5 1.7L18 6 9.7 14l-.4 5.5 3.4-3.2 5.5 4c.9.5 1.5.2 1.7-.8L22 4.3c.2-.7-.2-1.1-.9-.8z" })
62
+ }
63
+ );
64
+ }
65
+ function A({
66
+ onClick: n,
67
+ disabled: o,
68
+ lang: e = "en",
69
+ title: r,
70
+ label: s,
71
+ fullSize: t,
72
+ className: i
73
+ }) {
74
+ y(function() {
75
+ const m = "comfortaa-font";
76
+ if (document.getElementById(m)) return;
77
+ const u = document.createElement("link");
78
+ u.id = m, u.rel = "stylesheet", u.href = "https://fonts.googleapis.com/css2?family=Comfortaa:wght@600&display=swap", document.head.appendChild(u);
79
+ }, []);
80
+ const c = s ?? r ?? O[e], l = [h.TelegramSignInButtonContainer, t && h.FullSize, i].filter(Boolean).join(" ");
81
+ return /* @__PURE__ */ w("button", { type: "button", className: l, onClick: n, disabled: o, children: [
82
+ /* @__PURE__ */ a(N, {}),
83
+ c
84
+ ] });
85
+ }
86
+ function tt({
87
+ botId: n,
88
+ onSuccess: o,
89
+ lang: e,
90
+ title: r,
91
+ redirectUri: s,
92
+ requestAccess: t,
93
+ children: i,
94
+ className: c
95
+ }) {
96
+ const { login: l, isReady: m } = E({ botId: n, onSuccess: o, redirectUri: s, requestAccess: t });
97
+ return i ? /* @__PURE__ */ a(S, { children: i({ login: l, isReady: m }) }) : /* @__PURE__ */ a(
98
+ A,
99
+ {
100
+ onClick: l,
101
+ disabled: !m,
102
+ lang: e,
103
+ title: r,
104
+ className: c
105
+ }
106
+ );
107
+ }
108
+ function F(n) {
109
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
110
+ }
111
+ var p = { exports: {} };
112
+ var T;
113
+ function z() {
114
+ return T || (T = 1, (function(n) {
115
+ (function() {
116
+ var o = {}.hasOwnProperty;
117
+ function e() {
118
+ for (var t = "", i = 0; i < arguments.length; i++) {
119
+ var c = arguments[i];
120
+ c && (t = s(t, r(c)));
121
+ }
122
+ return t;
123
+ }
124
+ function r(t) {
125
+ if (typeof t == "string" || typeof t == "number")
126
+ return t;
127
+ if (typeof t != "object")
128
+ return "";
129
+ if (Array.isArray(t))
130
+ return e.apply(null, t);
131
+ if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
132
+ return t.toString();
133
+ var i = "";
134
+ for (var c in t)
135
+ o.call(t, c) && t[c] && (i = s(i, c));
136
+ return i;
137
+ }
138
+ function s(t, i) {
139
+ return i ? t ? t + " " + i : t + i : t;
140
+ }
141
+ n.exports ? (e.default = e, n.exports = e) : window.classNames = e;
142
+ })();
143
+ })(p)), p.exports;
144
+ }
145
+ var q = z();
146
+ const P = /* @__PURE__ */ F(q), v = L((n, o) => ({
147
+ toasts: [],
148
+ bake: (e) => {
149
+ if (o().toasts.find((s) => s.title === e.title)) {
150
+ console.error(`Toast with title "${e.title}" already exists`);
151
+ return;
152
+ }
153
+ n((s) => ({ toasts: [...s.toasts, e] })), setTimeout(() => {
154
+ o().dismiss(e.title);
155
+ }, 5e3);
156
+ },
157
+ dismiss: (e) => {
158
+ n((r) => ({
159
+ toasts: r.toasts.filter((s) => s.title !== e)
160
+ }));
161
+ }
162
+ })), k = "_ToastContainer_1g7il_1", M = "_Toast_1g7il_1", U = "_error_1g7il_33", $ = "_warn_1g7il_41", G = "_info_1g7il_49", V = "_Description_1g7il_53", W = "_DismissButton_1g7il_59", H = "_slideIn_1g7il_79", J = "_slideOut_1g7il_83", f = {
163
+ ToastContainer: k,
164
+ Toast: M,
165
+ error: U,
166
+ warn: $,
167
+ info: G,
168
+ Description: V,
169
+ DismissButton: W,
170
+ slideIn: H,
171
+ slideOut: J
172
+ };
173
+ function nt() {
174
+ const { toasts: n } = v();
175
+ return /* @__PURE__ */ a("div", { className: f.ToastContainer, children: /* @__PURE__ */ a(x, { children: n.map((o, e) => /* @__PURE__ */ a(
176
+ B.div,
177
+ {
178
+ layout: !0,
179
+ initial: { opacity: 0, x: 100, y: 50 },
180
+ animate: { opacity: 1, x: 0, y: 0 },
181
+ exit: { opacity: 0, y: -50 },
182
+ transition: { type: "spring", stiffness: 300, damping: 20 },
183
+ children: /* @__PURE__ */ a(K, { ...o })
184
+ },
185
+ e
186
+ )) }) });
187
+ }
188
+ function K({ title: n, description: o, isDismissable: e }) {
189
+ const [r, s] = _(!1), t = v();
190
+ return y(() => () => {
191
+ s(!0);
192
+ }, []), /* @__PURE__ */ w(
193
+ "div",
194
+ {
195
+ className: P(f.Toast, {
196
+ [f.error]: n === "Error",
197
+ [f.warn]: n === "Warn",
198
+ [f.info]: n == null || n === "Info",
199
+ [f.slideIn]: !r,
200
+ [f.slideOut]: r
201
+ }),
202
+ children: [
203
+ /* @__PURE__ */ a("div", { children: n }),
204
+ /* @__PURE__ */ a("div", { className: f.Description, children: o }),
205
+ e && /* @__PURE__ */ a("div", { className: f.DismissButton, onClick: () => t.dismiss(n), children: "×" })
206
+ ]
207
+ }
208
+ );
209
+ }
210
+ export {
211
+ tt as TelegramAuth,
212
+ A as TelegramSignInButton,
213
+ nt as Toaster,
214
+ E as useTelegramLogin,
215
+ v as useToaster
216
+ };
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._TelegramSignInButtonContainer_1pw4t_1{--tg-blue: #2AABEE;--tg-blue-2: #229ED9;display:inline-flex;align-items:center;justify-content:center;gap:.625rem;width:100%;padding:1rem 1.375rem;background:linear-gradient(180deg,var(--tg-blue) 0%,var(--tg-blue-2) 100%);border:0;border-radius:.875rem;color:#fff;font-family:Comfortaa,sans-serif;font-weight:600;font-size:1rem;letter-spacing:-.005em;cursor:pointer;box-shadow:inset 0 .0625rem #ffffff26,0 .75rem 2rem -.75rem #2aabee8c;transition:transform .14s ease,box-shadow .2s ease,filter .16s ease}._TelegramSignInButtonContainer_1pw4t_1:hover{transform:translateY(-.0625rem);box-shadow:inset 0 .0625rem #ffffff2e,0 1.125rem 2.375rem -.75rem #2aabeea6;filter:brightness(1.05)}._TelegramSignInButtonContainer_1pw4t_1:active{transform:translateY(0);filter:brightness(.97)}._TelegramSignInButtonContainer_1pw4t_1:focus-visible{outline:.125rem solid rgba(255,255,255,.8);outline-offset:.125rem}._TelegramSignInButtonContainer_1pw4t_1:disabled{opacity:.6;cursor:not-allowed}._FullSize_1pw4t_49{height:100%}._Icon_1pw4t_53{flex-shrink:0}._ToastContainer_1g7il_1{position:fixed;right:1.5rem;top:1.5rem;width:clamp(25vw,24.5rem,95vw);display:flex;flex-direction:column;gap:1rem;z-index:9999}._Toast_1g7il_1{min-height:4rem;border:var(--ta-accent, #229ED9) 1px solid;border-radius:1rem;padding:1rem;box-sizing:border-box;position:relative;background:#000;display:flex;flex-direction:column}._Toast_1g7il_1>div:first-child{font-weight:700;font-size:var(--ta-font-sm, .875rem);color:var(--ta-fg, #ffffff)}._Toast_1g7il_1._error_1g7il_33{border-color:var(--ta-error, #ef4444)}._Toast_1g7il_1._error_1g7il_33>div:first-child{color:var(--ta-error, #ef4444)}._Toast_1g7il_1._warn_1g7il_41{border-color:var(--ta-warn, #f59e0b)}._Toast_1g7il_1._warn_1g7il_41>div:first-child{color:var(--ta-warn, #f59e0b)}._Toast_1g7il_1._info_1g7il_49{border-color:var(--ta-accent, #229ED9)}._Toast_1g7il_1 ._Description_1g7il_53{color:var(--ta-fg-muted, #9ca3af);font-size:var(--ta-font-xs, .75rem);margin-top:.125rem}._Toast_1g7il_1 ._DismissButton_1g7il_59{position:absolute;width:1rem;height:1rem;display:flex;justify-content:center;align-items:center;top:0;right:1%;cursor:pointer;font-size:1.5rem;color:var(--ta-fg-muted, #9ca3af)}._slideIn_1g7il_79{animation:_slideIn_1g7il_79 .2s ease forwards}._slideOut_1g7il_83{animation:_slideOut_1g7il_83 .2s ease forwards}@keyframes _slideIn_1g7il_79{0%{opacity:0;transform:translate(2rem)}to{opacity:1;transform:translate(0)}}@keyframes _slideOut_1g7il_83{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(2rem)}}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ (function(a,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("framer-motion"),require("zustand")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","framer-motion","zustand"],i):(a=typeof globalThis<"u"?globalThis:a||self,i(a.Chures={},a.ReactJSXRuntime,a.React,a.FramerMotion,a.Zustand))})(this,(function(a,i,g,S,v){"use strict";const B="https://oauth.telegram.org/js/telegram-login.js?3";function I(t){const{botId:r,redirectUri:n,requestAccess:c="write"}=t,o=g.useRef(t.onSuccess);o.current=t.onSuccess;const[e,s]=g.useState(!1),[u,d]=g.useState(!1);g.useEffect(function(){if(!r)return;const f=n??window.location.origin;d(!0),s(!1);const m=document.createElement("script");return m.src=B,m.async=!0,m.onload=function(){const _=window.Telegram;_&&(_.Login.init({client_id:r,redirect_uri:f},function(A){o.current(A)}),s(!0)),d(!1)},m.onerror=function(){d(!1)},document.head.appendChild(m),function(){document.head.contains(m)&&document.head.removeChild(m),s(!1),d(!1)}},[r,n]);function p(){const f=window.Telegram;if(!e||!f)return;const m=n??window.location.origin;f.Login.auth({client_id:r,redirect_uri:m,request_access:c},function(_){o.current(_)})}return{login:p,isReady:e,isLoading:u}}const h={TelegramSignInButtonContainer:"_TelegramSignInButtonContainer_1pw4t_1",FullSize:"_FullSize_1pw4t_49",Icon:"_Icon_1pw4t_53"},L={en:"Continue with Telegram",ru:"Войти через Telegram"};function E(){return i.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",className:h.Icon,children:i.jsx("path",{d:"M22 3.5L2.5 11l5 1.7L18 6 9.7 14l-.4 5.5 3.4-3.2 5.5 4c.9.5 1.5.2 1.7-.8L22 4.3c.2-.7-.2-1.1-.9-.8z"})})}function w({onClick:t,disabled:r,lang:n="en",title:c,label:o,fullSize:e,className:s}){g.useEffect(function(){const p="comfortaa-font";if(document.getElementById(p))return;const f=document.createElement("link");f.id=p,f.rel="stylesheet",f.href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@600&display=swap",document.head.appendChild(f)},[]);const u=o??c??L[n],d=[h.TelegramSignInButtonContainer,e&&h.FullSize,s].filter(Boolean).join(" ");return i.jsxs("button",{type:"button",className:d,onClick:t,disabled:r,children:[i.jsx(E,{}),u]})}function j({botId:t,onSuccess:r,lang:n,title:c,redirectUri:o,requestAccess:e,children:s,className:u}){const{login:d,isReady:p}=I({botId:t,onSuccess:r,redirectUri:o,requestAccess:e});return s?i.jsx(i.Fragment,{children:s({login:d,isReady:p})}):i.jsx(w,{onClick:d,disabled:!p,lang:n,title:c,className:u})}function x(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var T={exports:{}};var C;function D(){return C||(C=1,(function(t){(function(){var r={}.hasOwnProperty;function n(){for(var e="",s=0;s<arguments.length;s++){var u=arguments[s];u&&(e=o(e,c(u)))}return e}function c(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e!="object")return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var s="";for(var u in e)r.call(e,u)&&e[u]&&(s=o(s,u));return s}function o(e,s){return s?e?e+" "+s:e+s:e}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(T)),T.exports}var O=D();const b=x(O),y=v.create((t,r)=>({toasts:[],bake:n=>{if(r().toasts.find(o=>o.title===n.title)){console.error(`Toast with title "${n.title}" already exists`);return}t(o=>({toasts:[...o.toasts,n]})),setTimeout(()=>{r().dismiss(n.title)},5e3)},dismiss:n=>{t(c=>({toasts:c.toasts.filter(o=>o.title!==n)}))}})),l={ToastContainer:"_ToastContainer_1g7il_1",Toast:"_Toast_1g7il_1",error:"_error_1g7il_33",warn:"_warn_1g7il_41",info:"_info_1g7il_49",Description:"_Description_1g7il_53",DismissButton:"_DismissButton_1g7il_59",slideIn:"_slideIn_1g7il_79",slideOut:"_slideOut_1g7il_83"};function q(){const{toasts:t}=y();return i.jsx("div",{className:l.ToastContainer,children:i.jsx(S.AnimatePresence,{children:t.map((r,n)=>i.jsx(S.motion.div,{layout:!0,initial:{opacity:0,x:100,y:50},animate:{opacity:1,x:0,y:0},exit:{opacity:0,y:-50},transition:{type:"spring",stiffness:300,damping:20},children:i.jsx(z,{...r})},n))})})}function z({title:t,description:r,isDismissable:n}){const[c,o]=g.useState(!1),e=y();return g.useEffect(()=>()=>{o(!0)},[]),i.jsxs("div",{className:b(l.Toast,{[l.error]:t==="Error",[l.warn]:t==="Warn",[l.info]:t==null||t==="Info",[l.slideIn]:!c,[l.slideOut]:c}),children:[i.jsx("div",{children:t}),i.jsx("div",{className:l.Description,children:r}),n&&i.jsx("div",{className:l.DismissButton,onClick:()=>e.dismiss(t),children:"×"})]})}a.TelegramAuth=j,a.TelegramSignInButton=w,a.Toaster=q,a.useTelegramLogin=I,a.useToaster=y,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { TelegramAuthData } from '../types';
3
+ export type TelegramAuthProps = {
4
+ botId: string;
5
+ onSuccess: (data: TelegramAuthData) => void;
6
+ lang?: "en" | "ru";
7
+ title?: string;
8
+ redirectUri?: string;
9
+ requestAccess?: string;
10
+ children?: (props: {
11
+ login: () => void;
12
+ isReady: boolean;
13
+ }) => ReactNode;
14
+ className?: string;
15
+ };
16
+ export declare function TelegramAuth({ botId, onSuccess, lang, title, redirectUri, requestAccess, children, className, }: TelegramAuthProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ export interface TelegramSignInButtonProps {
2
+ onClick: () => void;
3
+ disabled?: boolean;
4
+ lang?: "en" | "ru";
5
+ title?: string;
6
+ label?: string;
7
+ fullSize?: boolean;
8
+ className?: string;
9
+ }
10
+ export declare function TelegramSignInButton({ onClick, disabled, lang, title, label, fullSize, className, }: TelegramSignInButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Toaster(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ export interface Toast {
2
+ title: string;
3
+ description: string;
4
+ level?: 'Error' | 'Warn' | 'Info';
5
+ isDismissable?: boolean;
6
+ }
7
+ export interface ToasterStore {
8
+ toasts: Toast[];
9
+ bake: (t: Toast) => void;
10
+ dismiss: (title: string) => void;
11
+ }
12
+ export declare const useToaster: import('zustand').UseBoundStore<import('zustand').StoreApi<ToasterStore>>;
@@ -0,0 +1,13 @@
1
+ import { TelegramAuthData } from '../types';
2
+ export type UseTelegramLoginOptions = {
3
+ botId: string;
4
+ onSuccess: (data: TelegramAuthData) => void;
5
+ redirectUri?: string;
6
+ requestAccess?: string;
7
+ };
8
+ export type UseTelegramLoginReturn = {
9
+ login: () => void;
10
+ isReady: boolean;
11
+ isLoading: boolean;
12
+ };
13
+ export declare function useTelegramLogin(options: UseTelegramLoginOptions): UseTelegramLoginReturn;
@@ -0,0 +1,10 @@
1
+ export { TelegramAuth } from './components/TelegramAuth';
2
+ export { default as Toaster } from './components/notifications/Toaster';
3
+ export { useToaster } from './hooks/toaster/useToaster';
4
+ export type { Toast, ToasterStore } from './hooks/toaster/useToaster';
5
+ export { TelegramSignInButton } from './components/TelegramSignInButton';
6
+ export { useTelegramLogin } from './hooks/useTelegramLogin';
7
+ export type { TelegramAuthProps } from './components/TelegramAuth';
8
+ export type { TelegramSignInButtonProps } from './components/TelegramSignInButton';
9
+ export type { UseTelegramLoginOptions, UseTelegramLoginReturn } from './hooks/useTelegramLogin';
10
+ export type { TelegramAuthData, TelegramLoginWindow } from './types';
@@ -0,0 +1,18 @@
1
+ export type TelegramAuthData = {
2
+ id_token: string;
3
+ };
4
+ export type TelegramLoginWindow = Window & {
5
+ Telegram?: {
6
+ Login: {
7
+ init: (options: {
8
+ client_id: string;
9
+ redirect_uri?: string;
10
+ }, callback: (data: TelegramAuthData) => void) => void;
11
+ auth: (options: {
12
+ client_id: string;
13
+ redirect_uri?: string;
14
+ request_access: string;
15
+ }, callback: (data: TelegramAuthData) => void) => void;
16
+ };
17
+ };
18
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@vervstack/chures",
3
+ "version": "0.0.1",
4
+ "description": "React UI component library — Telegram auth, toasts, and more",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/vervstack/telegram-auth"
9
+ },
10
+ "homepage": "https://github.com/vervstack/telegram-auth#readme",
11
+ "keywords": [
12
+ "telegram",
13
+ "react",
14
+ "oauth",
15
+ "login",
16
+ "widget",
17
+ "ui",
18
+ "components",
19
+ "toaster"
20
+ ],
21
+ "type": "module",
22
+ "main": "./dist/chures.umd.cjs",
23
+ "module": "./dist/chures.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/chures.js",
29
+ "require": "./dist/chures.umd.cjs"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "scripts": {
36
+ "build": "vite build",
37
+ "dev": "vite build --watch",
38
+ "demo": "vite",
39
+ "build:demo": "vite build --config vite.config.demo.ts",
40
+ "type-check": "tsc --noEmit",
41
+ "patch": "npm version patch && npm publish --access public"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^18.0.0 || ^19.0.0",
45
+ "react-dom": "^18.0.0 || ^19.0.0",
46
+ "zustand": "^5.0.0",
47
+ "framer-motion": "^12.0.0"
48
+ },
49
+ "devDependencies": {
50
+ "@types/classnames": "^2.3.4",
51
+ "@types/react": "^19.0.0",
52
+ "@types/react-dom": "^19.0.0",
53
+ "@vitejs/plugin-react": "^4.5.2",
54
+ "framer-motion": "^12.40.0",
55
+ "typescript": "~5.8.3",
56
+ "vite": "^7.3.1",
57
+ "vite-plugin-css-injected-by-js": "^3.5.2",
58
+ "vite-plugin-dts": "^4.0.0",
59
+ "zustand": "^5.0.14"
60
+ },
61
+ "dependencies": {
62
+ "classnames": "^2.5.1"
63
+ }
64
+ }