@t-apps/ui 0.1.2 → 0.1.4
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/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.css
CHANGED
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/style.css"],"sourcesContent":[":root {\r\n --fg: #0B1220;\r\n\r\n --bg-1: #FFFFFF;\r\n --bg-2: #EEF3FF;\r\n --bg-3: #D9E4FF;\r\n\r\n --component-bg: #F5F8FF;\r\n --component-fg: var(--fg);\r\n --component-bg-hover: #EAF0FF;\r\n\r\n --accent: #2D6BFF;\r\n --accent-hover: #1E4FD6;\r\n\r\n --muted: #5B6B86;\r\n\r\n --border: #D7E1F5;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n :root {\r\n --fg: #EAF0FF;\r\n\r\n --bg-1: #070D1A;\r\n --bg-2: #0C1528;\r\n --bg-3: #121F3A;\r\n\r\n --component-bg: #0F1B33;\r\n --component-fg: var(--fg);\r\n --component-bg-hover: #16264A;\r\n\r\n --accent: #4A8CFF;\r\n --accent-hover: #6AA3FF;\r\n\r\n --muted: #93A4C7;\r\n\r\n --border: #1F2E4D;\r\n }\r\n}\r\n\r\nbody { \r\n background: var(--bg-1); \r\n color: var(--fg); \r\n font-family: Arial, Helvetica, sans-serif; \r\n} \r\n\r\n.t-component { \r\n display: block; \r\n width: fit-content; \r\n background-color: var(--component-bg); \r\n color: var(--component-fg); \r\n padding: 4px 10px; \r\n border: var(--border) 2px solid; \r\n border-radius: 4px; \r\n outline: none; \r\n} \r\n\r\n.t-button { \r\n user-select: none; \r\n cursor: pointer; \r\n} \r\n\r\n.t-button:hover { \r\n background-color: var(--component-bg-hover); \r\n} \r\n\r\n.t-button:active { \r\n background-color: var(--component-bg); \r\n}\r\n\r\n.t-navbar {\r\n display: flex;\r\n position: relative;\r\n width: 100%;\r\n height: 60px;\r\n background-color: var(--bg-2);\r\n align-items: center;\r\n padding: 4px;\r\n box-sizing: border-box;\r\n gap: 4px;\r\n}\r\n\r\n.t-center {\r\n position: absolute;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.t-end {\r\n margin-left: auto;\r\n}"],"mappings":";AAAA;AACE,QAAM;AAEN,UAAQ;AACR,UAAQ;AACR,UAAQ;AAER,kBAAgB;AAChB,kBAAgB,IAAI;AACpB,wBAAsB;AAEtB,YAAU;AACV,kBAAgB;AAEhB,WAAS;AAET,YAAU;AACZ;AAEA,QAAO,sBAAuB;AAC5B;AACE,UAAM;AAEN,YAAQ;AACR,YAAQ;AACR,YAAQ;AAER,oBAAgB;AAChB,oBAAgB,IAAI;AACpB,0BAAsB;AAEtB,cAAU;AACV,oBAAgB;AAEhB,aAAS;AAET,cAAU;AACZ;AACF;AAEA;AACE,cAAY,IAAI;AAChB,SAAO,IAAI;AACX;AAAA,IAAa,KAAK;AAAA,IAAE,SAAS;AAAA,IAAE;AACjC;AAEA,CAAC;AACC,WAAS;AACT,SAAO;AACP,oBAAkB,IAAI;AACtB,SAAO,IAAI;AACX,WAAS,IAAI;AACb,UAAQ,IAAI,UAAU,IAAI;AAC1B,iBAAe;AACf,WAAS;AACX;AAEA,CAAC;AACC,eAAa;AACb,UAAQ;AACV;AAEA,CALC,QAKQ;AACP,oBAAkB,IAAI;AACxB;AAEA,
|
|
1
|
+
{"version":3,"sources":["../src/style.css"],"sourcesContent":[":root {\r\n --fg: #0B1220;\r\n\r\n --bg-1: #FFFFFF;\r\n --bg-2: #EEF3FF;\r\n --bg-3: #D9E4FF;\r\n\r\n --component-bg: #F5F8FF;\r\n --component-fg: var(--fg);\r\n --component-bg-hover: #EAF0FF;\r\n\r\n --accent: #2D6BFF;\r\n --accent-hover: #1E4FD6;\r\n\r\n --muted: #5B6B86;\r\n\r\n --border: #D7E1F5;\r\n}\r\n\r\n@media (prefers-color-scheme: dark) {\r\n :root {\r\n --fg: #EAF0FF;\r\n\r\n --bg-1: #070D1A;\r\n --bg-2: #0C1528;\r\n --bg-3: #121F3A;\r\n\r\n --component-bg: #0F1B33;\r\n --component-fg: var(--fg);\r\n --component-bg-hover: #16264A;\r\n\r\n --accent: #4A8CFF;\r\n --accent-hover: #6AA3FF;\r\n\r\n --muted: #93A4C7;\r\n\r\n --border: #1F2E4D;\r\n }\r\n}\r\n\r\nbody { \r\n background: var(--bg-1); \r\n color: var(--fg); \r\n font-family: Arial, Helvetica, sans-serif; \r\n} \r\n\r\n.t-component { \r\n display: block; \r\n width: fit-content; \r\n background-color: var(--component-bg); \r\n color: var(--component-fg); \r\n padding: 4px 10px; \r\n border: var(--border) 2px solid; \r\n border-radius: 4px; \r\n outline: none; \r\n} \r\n\r\n.t-button { \r\n user-select: none; \r\n cursor: pointer; \r\n}\r\n\r\n.t-button:disabled {\r\n opacity: 50%;\r\n pointer-events: none;\r\n}\r\n\r\n.t-button:hover { \r\n background-color: var(--component-bg-hover); \r\n} \r\n\r\n.t-button:active { \r\n background-color: var(--component-bg); \r\n}\r\n\r\n.t-navbar {\r\n display: flex;\r\n position: relative;\r\n width: 100%;\r\n height: 60px;\r\n background-color: var(--bg-2);\r\n align-items: center;\r\n padding: 4px;\r\n box-sizing: border-box;\r\n gap: 4px;\r\n}\r\n\r\n.t-center {\r\n position: absolute;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.t-end {\r\n margin-left: auto;\r\n}"],"mappings":";AAAA;AACE,QAAM;AAEN,UAAQ;AACR,UAAQ;AACR,UAAQ;AAER,kBAAgB;AAChB,kBAAgB,IAAI;AACpB,wBAAsB;AAEtB,YAAU;AACV,kBAAgB;AAEhB,WAAS;AAET,YAAU;AACZ;AAEA,QAAO,sBAAuB;AAC5B;AACE,UAAM;AAEN,YAAQ;AACR,YAAQ;AACR,YAAQ;AAER,oBAAgB;AAChB,oBAAgB,IAAI;AACpB,0BAAsB;AAEtB,cAAU;AACV,oBAAgB;AAEhB,aAAS;AAET,cAAU;AACZ;AACF;AAEA;AACE,cAAY,IAAI;AAChB,SAAO,IAAI;AACX;AAAA,IAAa,KAAK;AAAA,IAAE,SAAS;AAAA,IAAE;AACjC;AAEA,CAAC;AACC,WAAS;AACT,SAAO;AACP,oBAAkB,IAAI;AACtB,SAAO,IAAI;AACX,WAAS,IAAI;AACb,UAAQ,IAAI,UAAU,IAAI;AAC1B,iBAAe;AACf,WAAS;AACX;AAEA,CAAC;AACC,eAAa;AACb,UAAQ;AACV;AAEA,CALC,QAKQ;AACP,WAAS;AACT,kBAAgB;AAClB;AAEA,CAVC,QAUQ;AACP,oBAAkB,IAAI;AACxB;AAEA,CAdC,QAcQ;AACP,oBAAkB,IAAI;AACxB;AAEA,CAAC;AACC,WAAS;AACT,YAAU;AACV,SAAO;AACP,UAAQ;AACR,oBAAkB,IAAI;AACtB,eAAa;AACb,WAAS;AACT,cAAY;AACZ,OAAK;AACP;AAEA,CAAC;AACC,YAAU;AACV,QAAM;AACN,aAAW,WAAW;AACxB;AAEA,CAAC;AACC,eAAa;AACf;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
|
|
3
|
-
type ButtonProps =
|
|
4
|
+
type ButtonProps = React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
5
|
href?: never;
|
|
5
6
|
as?: "button";
|
|
6
7
|
};
|
|
7
|
-
type LinkProps =
|
|
8
|
+
type LinkProps = React__default.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
8
9
|
href: string;
|
|
9
10
|
as: "a";
|
|
10
11
|
};
|
|
11
|
-
type Props$
|
|
12
|
-
declare function TButton({ children, className, ...props }: Props$
|
|
12
|
+
type Props$3 = ButtonProps | LinkProps;
|
|
13
|
+
declare function TButton({ children, className, ...props }: Props$3): React__default.JSX.Element;
|
|
13
14
|
|
|
14
|
-
type Props$
|
|
15
|
-
declare function TInput({ className, ...props }: Props$
|
|
15
|
+
type Props$2 = React__default.InputHTMLAttributes<HTMLInputElement>;
|
|
16
|
+
declare function TInput({ className, ...props }: Props$2): React__default.JSX.Element;
|
|
16
17
|
|
|
17
|
-
type Props =
|
|
18
|
-
declare function TNavbar({ children, className, ...props }: Props):
|
|
18
|
+
type Props$1 = React__default.HTMLAttributes<HTMLDivElement>;
|
|
19
|
+
declare function TNavbar({ children, className, ...props }: Props$1): React__default.JSX.Element;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
type Props = React.HTMLAttributes<HTMLElement>;
|
|
22
|
+
declare function TCode({ children, className, ...props }: Props): React$1.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { TButton, TCode, TInput, TNavbar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
|
|
3
|
-
type ButtonProps =
|
|
4
|
+
type ButtonProps = React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
5
|
href?: never;
|
|
5
6
|
as?: "button";
|
|
6
7
|
};
|
|
7
|
-
type LinkProps =
|
|
8
|
+
type LinkProps = React__default.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
8
9
|
href: string;
|
|
9
10
|
as: "a";
|
|
10
11
|
};
|
|
11
|
-
type Props$
|
|
12
|
-
declare function TButton({ children, className, ...props }: Props$
|
|
12
|
+
type Props$3 = ButtonProps | LinkProps;
|
|
13
|
+
declare function TButton({ children, className, ...props }: Props$3): React__default.JSX.Element;
|
|
13
14
|
|
|
14
|
-
type Props$
|
|
15
|
-
declare function TInput({ className, ...props }: Props$
|
|
15
|
+
type Props$2 = React__default.InputHTMLAttributes<HTMLInputElement>;
|
|
16
|
+
declare function TInput({ className, ...props }: Props$2): React__default.JSX.Element;
|
|
16
17
|
|
|
17
|
-
type Props =
|
|
18
|
-
declare function TNavbar({ children, className, ...props }: Props):
|
|
18
|
+
type Props$1 = React__default.HTMLAttributes<HTMLDivElement>;
|
|
19
|
+
declare function TNavbar({ children, className, ...props }: Props$1): React__default.JSX.Element;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
type Props = React.HTMLAttributes<HTMLElement>;
|
|
22
|
+
declare function TCode({ children, className, ...props }: Props): React$1.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { TButton, TCode, TInput, TNavbar };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
TButton: () => TButton,
|
|
24
|
+
TCode: () => TCode,
|
|
24
25
|
TInput: () => TInput,
|
|
25
26
|
TNavbar: () => TNavbar
|
|
26
27
|
});
|
|
@@ -59,9 +60,40 @@ function TNavbar({ children, className, ...props }) {
|
|
|
59
60
|
}
|
|
60
61
|
);
|
|
61
62
|
}
|
|
63
|
+
|
|
64
|
+
// src/components/TCode.tsx
|
|
65
|
+
var import_react = require("react");
|
|
66
|
+
var import_lucide_react = require("lucide-react");
|
|
67
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
68
|
+
function TCode({ children, className, ...props }) {
|
|
69
|
+
const codeRef = (0, import_react.useRef)(null);
|
|
70
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
71
|
+
async function copy() {
|
|
72
|
+
const text = codeRef.current?.textContent;
|
|
73
|
+
if (!text) return;
|
|
74
|
+
await navigator.clipboard.writeText(text);
|
|
75
|
+
setCopied(true);
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
setCopied(false);
|
|
78
|
+
}, 1e3);
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
81
|
+
"code",
|
|
82
|
+
{
|
|
83
|
+
ref: codeRef,
|
|
84
|
+
...props,
|
|
85
|
+
className: `t-component t-code ${className ?? ""}`,
|
|
86
|
+
children: [
|
|
87
|
+
children,
|
|
88
|
+
copied ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Check, { className: "t-copy" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Clipboard, { className: "t-copy", onClick: copy })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
62
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
94
|
0 && (module.exports = {
|
|
64
95
|
TButton,
|
|
96
|
+
TCode,
|
|
65
97
|
TInput,
|
|
66
98
|
TNavbar
|
|
67
99
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/TButton.tsx","../src/components/TInput.tsx","../src/components/TNavbar.tsx"],"sourcesContent":["export { default as TButton } from \"./components/TButton\";\r\nexport { default as TInput } from \"./components/TInput\";\r\nexport { default as TNavbar } from \"./components/TNavbar\";\r\n\r\nimport \"./style.css\";","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n href?: never;\r\n as?: \"button\";\r\n};\r\n\r\ntype LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\r\n href: string;\r\n as: \"a\";\r\n};\r\n\r\ntype Props = ButtonProps | LinkProps;\r\n\r\nexport default function TButton({ children, className, ...props }: Props) {\r\n if (props.as === \"a\") {\r\n return (\r\n <a {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </a>\r\n );\r\n }\r\n\r\n return (\r\n <button {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </button>\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.InputHTMLAttributes<HTMLInputElement>;\r\n\r\nexport default function TInput({ className, ...props}: Props) {\r\n return (\r\n <input\r\n {...props}\r\n className={`t-component t-input ${className ?? \"\"}`}\r\n />\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLDivElement>\r\n\r\nexport default function TNavbar({ children, className, ...props }: Props) {\r\n return (\r\n <div\r\n {...props}\r\n className={`t-navbar ${className ?? \"\"}`}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBU;AAHK,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,MAAI,MAAM,OAAO,KAAK;AAClB,WACI,4CAAC,OAAG,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAC3D,UACL;AAAA,EAER;AAEA,SACI,4CAAC,YAAQ,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAChE,UACL;AAEN;;;ACtBI,IAAAA,sBAAA;AAFW,SAAR,OAAwB,EAAE,WAAW,GAAG,MAAK,GAAU;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,uBAAuB,aAAa,EAAE;AAAA;AAAA,EACnD;AAEJ;;;ACLI,IAAAC,sBAAA;AAFW,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,YAAY,aAAa,EAAE;AAAA,MAErC;AAAA;AAAA,EACH;AAEJ;","names":["import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/TButton.tsx","../src/components/TInput.tsx","../src/components/TNavbar.tsx","../src/components/TCode.tsx"],"sourcesContent":["export { default as TButton } from \"./components/TButton\";\r\nexport { default as TInput } from \"./components/TInput\";\r\nexport { default as TNavbar } from \"./components/TNavbar\";\r\nexport { default as TCode } from \"./components/TCode\";\r\n\r\nimport \"./style.css\";","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n href?: never;\r\n as?: \"button\";\r\n};\r\n\r\ntype LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\r\n href: string;\r\n as: \"a\";\r\n};\r\n\r\ntype Props = ButtonProps | LinkProps;\r\n\r\nexport default function TButton({ children, className, ...props }: Props) {\r\n if (props.as === \"a\") {\r\n return (\r\n <a {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </a>\r\n );\r\n }\r\n\r\n return (\r\n <button {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </button>\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.InputHTMLAttributes<HTMLInputElement>;\r\n\r\nexport default function TInput({ className, ...props}: Props) {\r\n return (\r\n <input\r\n {...props}\r\n className={`t-component t-input ${className ?? \"\"}`}\r\n />\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLDivElement>\r\n\r\nexport default function TNavbar({ children, className, ...props }: Props) {\r\n return (\r\n <div\r\n {...props}\r\n className={`t-navbar ${className ?? \"\"}`}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}","\"use client\";\r\n\r\nimport { useRef, useState } from \"react\";\r\nimport { Clipboard, Check } from \"lucide-react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLElement>;\r\n\r\nexport default function TCode({ children, className, ...props }: Props) {\r\n const codeRef = useRef<HTMLElement>(null);\r\n const [copied, setCopied] = useState(false);\r\n\r\n async function copy() {\r\n const text = codeRef.current?.textContent;\r\n\r\n if (!text) return;\r\n\r\n await navigator.clipboard.writeText(text);\r\n\r\n setCopied(true);\r\n\r\n setTimeout(() => {\r\n setCopied(false);\r\n }, 1000);\r\n }\r\n\r\n return (\r\n <code\r\n ref={codeRef}\r\n {...props}\r\n className={`t-component t-code ${className ?? \"\"}`}\r\n >\r\n {children}\r\n\r\n {copied ? (\r\n <Check className=\"t-copy\" />\r\n ) : (\r\n <Clipboard className=\"t-copy\" onClick={copy} />\r\n )}\r\n </code>\r\n );\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBU;AAHK,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,MAAI,MAAM,OAAO,KAAK;AAClB,WACI,4CAAC,OAAG,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAC3D,UACL;AAAA,EAER;AAEA,SACI,4CAAC,YAAQ,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAChE,UACL;AAEN;;;ACtBI,IAAAA,sBAAA;AAFW,SAAR,OAAwB,EAAE,WAAW,GAAG,MAAK,GAAU;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,uBAAuB,aAAa,EAAE;AAAA;AAAA,EACnD;AAEJ;;;ACLI,IAAAC,sBAAA;AAFW,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,YAAY,aAAa,EAAE;AAAA,MAErC;AAAA;AAAA,EACH;AAEJ;;;ACbA,mBAAiC;AACjC,0BAAiC;AAuBzB,IAAAC,sBAAA;AAnBO,SAAR,MAAuB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACpE,QAAM,cAAU,qBAAoB,IAAI;AACxC,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAE1C,iBAAe,OAAO;AAClB,UAAM,OAAO,QAAQ,SAAS;AAE9B,QAAI,CAAC,KAAM;AAEX,UAAM,UAAU,UAAU,UAAU,IAAI;AAExC,cAAU,IAAI;AAEd,eAAW,MAAM;AACb,gBAAU,KAAK;AAAA,IACnB,GAAG,GAAI;AAAA,EACX;AAEA,SACI;AAAA,IAAC;AAAA;AAAA,MACG,KAAK;AAAA,MACJ,GAAG;AAAA,MACJ,WAAW,sBAAsB,aAAa,EAAE;AAAA,MAE/C;AAAA;AAAA,QAEA,SACG,6CAAC,6BAAM,WAAU,UAAS,IAE1B,6CAAC,iCAAU,WAAU,UAAS,SAAS,MAAM;AAAA;AAAA;AAAA,EAErD;AAER;","names":["import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|
package/dist/index.mjs
CHANGED
|
@@ -31,8 +31,39 @@ function TNavbar({ children, className, ...props }) {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
// src/components/TCode.tsx
|
|
36
|
+
import { useRef, useState } from "react";
|
|
37
|
+
import { Clipboard, Check } from "lucide-react";
|
|
38
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
39
|
+
function TCode({ children, className, ...props }) {
|
|
40
|
+
const codeRef = useRef(null);
|
|
41
|
+
const [copied, setCopied] = useState(false);
|
|
42
|
+
async function copy() {
|
|
43
|
+
const text = codeRef.current?.textContent;
|
|
44
|
+
if (!text) return;
|
|
45
|
+
await navigator.clipboard.writeText(text);
|
|
46
|
+
setCopied(true);
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
setCopied(false);
|
|
49
|
+
}, 1e3);
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
"code",
|
|
53
|
+
{
|
|
54
|
+
ref: codeRef,
|
|
55
|
+
...props,
|
|
56
|
+
className: `t-component t-code ${className ?? ""}`,
|
|
57
|
+
children: [
|
|
58
|
+
children,
|
|
59
|
+
copied ? /* @__PURE__ */ jsx4(Check, { className: "t-copy" }) : /* @__PURE__ */ jsx4(Clipboard, { className: "t-copy", onClick: copy })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
34
64
|
export {
|
|
35
65
|
TButton,
|
|
66
|
+
TCode,
|
|
36
67
|
TInput,
|
|
37
68
|
TNavbar
|
|
38
69
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TButton.tsx","../src/components/TInput.tsx","../src/components/TNavbar.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n href?: never;\r\n as?: \"button\";\r\n};\r\n\r\ntype LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\r\n href: string;\r\n as: \"a\";\r\n};\r\n\r\ntype Props = ButtonProps | LinkProps;\r\n\r\nexport default function TButton({ children, className, ...props }: Props) {\r\n if (props.as === \"a\") {\r\n return (\r\n <a {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </a>\r\n );\r\n }\r\n\r\n return (\r\n <button {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </button>\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.InputHTMLAttributes<HTMLInputElement>;\r\n\r\nexport default function TInput({ className, ...props}: Props) {\r\n return (\r\n <input\r\n {...props}\r\n className={`t-component t-input ${className ?? \"\"}`}\r\n />\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLDivElement>\r\n\r\nexport default function TNavbar({ children, className, ...props }: Props) {\r\n return (\r\n <div\r\n {...props}\r\n className={`t-navbar ${className ?? \"\"}`}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}"],"mappings":";AAmBU;AAHK,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,MAAI,MAAM,OAAO,KAAK;AAClB,WACI,oBAAC,OAAG,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAC3D,UACL;AAAA,EAER;AAEA,SACI,oBAAC,YAAQ,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAChE,UACL;AAEN;;;ACtBI,gBAAAA,YAAA;AAFW,SAAR,OAAwB,EAAE,WAAW,GAAG,MAAK,GAAU;AAC5D,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,uBAAuB,aAAa,EAAE;AAAA;AAAA,EACnD;AAEJ;;;ACLI,gBAAAC,YAAA;AAFW,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,YAAY,aAAa,EAAE;AAAA,MAErC;AAAA;AAAA,EACH;AAEJ;","names":["jsx","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/TButton.tsx","../src/components/TInput.tsx","../src/components/TNavbar.tsx","../src/components/TCode.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\r\n href?: never;\r\n as?: \"button\";\r\n};\r\n\r\ntype LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\r\n href: string;\r\n as: \"a\";\r\n};\r\n\r\ntype Props = ButtonProps | LinkProps;\r\n\r\nexport default function TButton({ children, className, ...props }: Props) {\r\n if (props.as === \"a\") {\r\n return (\r\n <a {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </a>\r\n );\r\n }\r\n\r\n return (\r\n <button {...props} className={`t-component t-button ${className ?? \"\"}`}>\r\n {children}\r\n </button>\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.InputHTMLAttributes<HTMLInputElement>;\r\n\r\nexport default function TInput({ className, ...props}: Props) {\r\n return (\r\n <input\r\n {...props}\r\n className={`t-component t-input ${className ?? \"\"}`}\r\n />\r\n );\r\n}","\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLDivElement>\r\n\r\nexport default function TNavbar({ children, className, ...props }: Props) {\r\n return (\r\n <div\r\n {...props}\r\n className={`t-navbar ${className ?? \"\"}`}\r\n >\r\n {children}\r\n </div>\r\n );\r\n}","\"use client\";\r\n\r\nimport { useRef, useState } from \"react\";\r\nimport { Clipboard, Check } from \"lucide-react\";\r\n\r\ntype Props = React.HTMLAttributes<HTMLElement>;\r\n\r\nexport default function TCode({ children, className, ...props }: Props) {\r\n const codeRef = useRef<HTMLElement>(null);\r\n const [copied, setCopied] = useState(false);\r\n\r\n async function copy() {\r\n const text = codeRef.current?.textContent;\r\n\r\n if (!text) return;\r\n\r\n await navigator.clipboard.writeText(text);\r\n\r\n setCopied(true);\r\n\r\n setTimeout(() => {\r\n setCopied(false);\r\n }, 1000);\r\n }\r\n\r\n return (\r\n <code\r\n ref={codeRef}\r\n {...props}\r\n className={`t-component t-code ${className ?? \"\"}`}\r\n >\r\n {children}\r\n\r\n {copied ? (\r\n <Check className=\"t-copy\" />\r\n ) : (\r\n <Clipboard className=\"t-copy\" onClick={copy} />\r\n )}\r\n </code>\r\n );\r\n}"],"mappings":";AAmBU;AAHK,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,MAAI,MAAM,OAAO,KAAK;AAClB,WACI,oBAAC,OAAG,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAC3D,UACL;AAAA,EAER;AAEA,SACI,oBAAC,YAAQ,GAAG,OAAO,WAAW,wBAAwB,aAAa,EAAE,IAChE,UACL;AAEN;;;ACtBI,gBAAAA,YAAA;AAFW,SAAR,OAAwB,EAAE,WAAW,GAAG,MAAK,GAAU;AAC5D,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,uBAAuB,aAAa,EAAE;AAAA;AAAA,EACnD;AAEJ;;;ACLI,gBAAAC,YAAA;AAFW,SAAR,QAAyB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACxE,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,YAAY,aAAa,EAAE;AAAA,MAErC;AAAA;AAAA,EACH;AAEJ;;;ACbA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,WAAW,aAAa;AAuBzB,SAQQ,OAAAC,MARR;AAnBO,SAAR,MAAuB,EAAE,UAAU,WAAW,GAAG,MAAM,GAAU;AACpE,QAAM,UAAU,OAAoB,IAAI;AACxC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,iBAAe,OAAO;AAClB,UAAM,OAAO,QAAQ,SAAS;AAE9B,QAAI,CAAC,KAAM;AAEX,UAAM,UAAU,UAAU,UAAU,IAAI;AAExC,cAAU,IAAI;AAEd,eAAW,MAAM;AACb,gBAAU,KAAK;AAAA,IACnB,GAAG,GAAI;AAAA,EACX;AAEA,SACI;AAAA,IAAC;AAAA;AAAA,MACG,KAAK;AAAA,MACJ,GAAG;AAAA,MACJ,WAAW,sBAAsB,aAAa,EAAE;AAAA,MAE/C;AAAA;AAAA,QAEA,SACG,gBAAAA,KAAC,SAAM,WAAU,UAAS,IAE1B,gBAAAA,KAAC,aAAU,WAAU,UAAS,SAAS,MAAM;AAAA;AAAA;AAAA,EAErD;AAER;","names":["jsx","jsx","jsx"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t-apps/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "^18 || ^19",
|
|
24
|
-
"react-dom": "^18 || ^19"
|
|
24
|
+
"react-dom": "^18 || ^19",
|
|
25
|
+
"lucide-react": "^1.0.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/react": "^19.2.17",
|