@anti049/lunar-ui-react 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,73 @@
1
- # Temporary Holding Version
1
+ # React + TypeScript + Vite
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname
39
+ }
40
+ // other options...
41
+ }
42
+ }
43
+ ]);
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://npmx.dev/package/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://npmx.dev/package/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x';
51
+ import reactDom from 'eslint-plugin-react-dom';
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname
68
+ }
69
+ // other options...
70
+ }
71
+ }
72
+ ]);
73
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var clsx = require('clsx');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ // src/lib/components/Button.tsx
9
+ var cn = (...inputs) => tailwindMerge.twMerge(clsx.clsx(inputs));
10
+ var Button = react.forwardRef(function Button2({ variant = "filled", size = "md", className, ...rest }, ref) {
11
+ return /* @__PURE__ */ jsxRuntime.jsx(
12
+ "button",
13
+ {
14
+ ref,
15
+ className: cn("button", `button-${variant}`, `button-${size}`, className),
16
+ ...rest
17
+ }
18
+ );
19
+ });
20
+ function useRipple() {
21
+ const ref = react.useRef(null);
22
+ const onPointerDown = react.useCallback((event) => {
23
+ const node = ref.current;
24
+ if (!node) return;
25
+ const rect = node.getBoundingClientRect();
26
+ const circle = document.createElement("span");
27
+ const diameter = Math.max(rect.width, rect.height);
28
+ circle.style.width = circle.style.height = `${diameter}px`;
29
+ circle.style.left = `${event.clientX - rect.left - diameter / 2}px`;
30
+ circle.style.top = `${event.clientY - rect.top - diameter / 2}px`;
31
+ circle.className = "project-ripple";
32
+ circle.addEventListener("animationend", () => circle.remove());
33
+ node.append(circle);
34
+ }, []);
35
+ return { ref, onPointerDown };
36
+ }
37
+
38
+ exports.Button = Button;
39
+ exports.cn = cn;
40
+ exports.useRipple = useRipple;
41
+ //# sourceMappingURL=index.cjs.map
42
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/utils/cn.ts","../src/lib/components/Button.tsx","../src/lib/hooks/useRipple.ts"],"names":["twMerge","clsx","forwardRef","Button","jsx","useRef","useCallback"],"mappings":";;;;;;;;AAGO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiCA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC;ACQpE,IAAM,MAAA,GAASC,gBAAA,CAA2C,SAASC,OAAAA,CACzE,EAAE,OAAA,GAAU,QAAA,EAAU,IAAA,GAAO,IAAA,EAAM,SAAA,EAAW,GAAG,IAAA,IACjD,GAAA,EACC;AACD,EAAA,uBACCC,cAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,SAAA,EAAW,GAAG,QAAA,EAAU,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA;AAAA,MACvE,GAAG;AAAA;AAAA,GACL;AAEF,CAAC;ACVM,SAAS,SAAA,GAAY;AAC3B,EAAA,MAAM,GAAA,GAAMC,aAA2B,IAAI,CAAA;AAE3C,EAAA,MAAM,aAAA,GAAgBC,iBAAA,CAAY,CAAC,KAAA,KAAqC;AACvE,IAAA,MAAM,OAAO,GAAA,CAAI,OAAA;AACjB,IAAA,IAAI,CAAC,IAAA,EAAM;AAEX,IAAA,MAAM,IAAA,GAAO,KAAK,qBAAA,EAAsB;AACxC,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAG5C,IAAA,MAAM,WAAW,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,KAAK,MAAM,CAAA;AACjD,IAAA,MAAA,CAAO,MAAM,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,MAAA,GAAS,GAAG,QAAQ,CAAA,EAAA,CAAA;AACtD,IAAA,MAAA,CAAO,KAAA,CAAM,OAAO,CAAA,EAAG,KAAA,CAAM,UAAU,IAAA,CAAK,IAAA,GAAO,WAAW,CAAC,CAAA,EAAA,CAAA;AAC/D,IAAA,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,EAAG,KAAA,CAAM,UAAU,IAAA,CAAK,GAAA,GAAM,WAAW,CAAC,CAAA,EAAA,CAAA;AAG7D,IAAA,MAAA,CAAO,SAAA,GAAY,gBAAA;AAGnB,IAAA,MAAA,CAAO,gBAAA,CAAiB,cAAA,EAAgB,MAAM,MAAA,CAAO,QAAQ,CAAA;AAC7D,IAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,EACnB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,KAAK,aAAA,EAAc;AAC7B","file":"index.cjs","sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cn } from '../utils/cn.js';\n\nexport type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'text';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n\tvariant?: ButtonVariant;\n\tsize?: ButtonSize;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n\t{ variant = 'filled', size = 'md', className, ...rest },\n\tref\n) {\n\treturn (\n\t\t<button\n\t\t\tref={ref}\n\t\t\tclassName={cn('button', `button-${variant}`, `button-${size}`, className)}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n","import { useCallback, useRef, type PointerEvent } from 'react';\n\n/*\n\tReturns a ref to attach and an onPointerDown handler:\n\n\t const { ref, onPointerDown } = useRipple();\n\t <button ref={ref} onPointerDown={onPointerDown}>…</button>\n\n\tThe class name below is created by JAVASCRIPT at runtime, so Tailwind's\n\tscanner can never see it — which is why the plugin routes that rule through\n\taddBase rather than addUtilities. See guide 0, decision 3.\n*/\nexport function useRipple() {\n\tconst ref = useRef<HTMLElement | null>(null);\n\n\tconst onPointerDown = useCallback((event: PointerEvent<HTMLElement>) => {\n\t\tconst node = ref.current;\n\t\tif (!node) return;\n\n\t\tconst rect = node.getBoundingClientRect();\n\t\tconst circle = document.createElement('span');\n\n\t\t// Diameter large enough to cover the element from any origin point.\n\t\tconst diameter = Math.max(rect.width, rect.height);\n\t\tcircle.style.width = circle.style.height = `${diameter}px`;\n\t\tcircle.style.left = `${event.clientX - rect.left - diameter / 2}px`;\n\t\tcircle.style.top = `${event.clientY - rect.top - diameter / 2}px`;\n\n\t\t// The one and only place this string exists.\n\t\tcircle.className = 'project-ripple';\n\n\t\t// Self-removing, so nothing has to be cleaned up on unmount.\n\t\tcircle.addEventListener('animationend', () => circle.remove());\n\t\tnode.append(circle);\n\t}, []);\n\n\treturn { ref, onPointerDown };\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import * as react from 'react';
2
+ import { ButtonHTMLAttributes, PointerEvent } from 'react';
3
+ import { ClassValue } from 'clsx';
4
+
5
+ type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'text';
6
+ type ButtonSize = 'sm' | 'md' | 'lg';
7
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
+ variant?: ButtonVariant;
9
+ size?: ButtonSize;
10
+ }
11
+ declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
12
+
13
+ declare function useRipple(): {
14
+ ref: react.RefObject<HTMLElement | null>;
15
+ onPointerDown: (event: PointerEvent<HTMLElement>) => void;
16
+ };
17
+
18
+ declare const cn: (...inputs: ClassValue[]) => string;
19
+
20
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, cn, useRipple };
@@ -0,0 +1,20 @@
1
+ import * as react from 'react';
2
+ import { ButtonHTMLAttributes, PointerEvent } from 'react';
3
+ import { ClassValue } from 'clsx';
4
+
5
+ type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'text';
6
+ type ButtonSize = 'sm' | 'md' | 'lg';
7
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
+ variant?: ButtonVariant;
9
+ size?: ButtonSize;
10
+ }
11
+ declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
12
+
13
+ declare function useRipple(): {
14
+ ref: react.RefObject<HTMLElement | null>;
15
+ onPointerDown: (event: PointerEvent<HTMLElement>) => void;
16
+ };
17
+
18
+ declare const cn: (...inputs: ClassValue[]) => string;
19
+
20
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, cn, useRipple };
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import { forwardRef, useRef, useCallback } from 'react';
2
+ import { clsx } from 'clsx';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ // src/lib/components/Button.tsx
7
+ var cn = (...inputs) => twMerge(clsx(inputs));
8
+ var Button = forwardRef(function Button2({ variant = "filled", size = "md", className, ...rest }, ref) {
9
+ return /* @__PURE__ */ jsx(
10
+ "button",
11
+ {
12
+ ref,
13
+ className: cn("button", `button-${variant}`, `button-${size}`, className),
14
+ ...rest
15
+ }
16
+ );
17
+ });
18
+ function useRipple() {
19
+ const ref = useRef(null);
20
+ const onPointerDown = useCallback((event) => {
21
+ const node = ref.current;
22
+ if (!node) return;
23
+ const rect = node.getBoundingClientRect();
24
+ const circle = document.createElement("span");
25
+ const diameter = Math.max(rect.width, rect.height);
26
+ circle.style.width = circle.style.height = `${diameter}px`;
27
+ circle.style.left = `${event.clientX - rect.left - diameter / 2}px`;
28
+ circle.style.top = `${event.clientY - rect.top - diameter / 2}px`;
29
+ circle.className = "project-ripple";
30
+ circle.addEventListener("animationend", () => circle.remove());
31
+ node.append(circle);
32
+ }, []);
33
+ return { ref, onPointerDown };
34
+ }
35
+
36
+ export { Button, cn, useRipple };
37
+ //# sourceMappingURL=index.js.map
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/utils/cn.ts","../src/lib/components/Button.tsx","../src/lib/hooks/useRipple.ts"],"names":["Button"],"mappings":";;;;;;AAGO,IAAM,KAAK,CAAA,GAAI,MAAA,KAAiC,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC;ACQpE,IAAM,MAAA,GAAS,UAAA,CAA2C,SAASA,OAAAA,CACzE,EAAE,OAAA,GAAU,QAAA,EAAU,IAAA,GAAO,IAAA,EAAM,SAAA,EAAW,GAAG,IAAA,IACjD,GAAA,EACC;AACD,EAAA,uBACC,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,SAAA,EAAW,GAAG,QAAA,EAAU,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA;AAAA,MACvE,GAAG;AAAA;AAAA,GACL;AAEF,CAAC;ACVM,SAAS,SAAA,GAAY;AAC3B,EAAA,MAAM,GAAA,GAAM,OAA2B,IAAI,CAAA;AAE3C,EAAA,MAAM,aAAA,GAAgB,WAAA,CAAY,CAAC,KAAA,KAAqC;AACvE,IAAA,MAAM,OAAO,GAAA,CAAI,OAAA;AACjB,IAAA,IAAI,CAAC,IAAA,EAAM;AAEX,IAAA,MAAM,IAAA,GAAO,KAAK,qBAAA,EAAsB;AACxC,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AAG5C,IAAA,MAAM,WAAW,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,KAAK,MAAM,CAAA;AACjD,IAAA,MAAA,CAAO,MAAM,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,MAAA,GAAS,GAAG,QAAQ,CAAA,EAAA,CAAA;AACtD,IAAA,MAAA,CAAO,KAAA,CAAM,OAAO,CAAA,EAAG,KAAA,CAAM,UAAU,IAAA,CAAK,IAAA,GAAO,WAAW,CAAC,CAAA,EAAA,CAAA;AAC/D,IAAA,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,EAAG,KAAA,CAAM,UAAU,IAAA,CAAK,GAAA,GAAM,WAAW,CAAC,CAAA,EAAA,CAAA;AAG7D,IAAA,MAAA,CAAO,SAAA,GAAY,gBAAA;AAGnB,IAAA,MAAA,CAAO,gBAAA,CAAiB,cAAA,EAAgB,MAAM,MAAA,CAAO,QAAQ,CAAA;AAC7D,IAAA,IAAA,CAAK,OAAO,MAAM,CAAA;AAAA,EACnB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,KAAK,aAAA,EAAc;AAC7B","file":"index.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n","import { forwardRef, type ButtonHTMLAttributes } from 'react';\nimport { cn } from '../utils/cn.js';\n\nexport type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'text';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n\tvariant?: ButtonVariant;\n\tsize?: ButtonSize;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n\t{ variant = 'filled', size = 'md', className, ...rest },\n\tref\n) {\n\treturn (\n\t\t<button\n\t\t\tref={ref}\n\t\t\tclassName={cn('button', `button-${variant}`, `button-${size}`, className)}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n","import { useCallback, useRef, type PointerEvent } from 'react';\n\n/*\n\tReturns a ref to attach and an onPointerDown handler:\n\n\t const { ref, onPointerDown } = useRipple();\n\t <button ref={ref} onPointerDown={onPointerDown}>…</button>\n\n\tThe class name below is created by JAVASCRIPT at runtime, so Tailwind's\n\tscanner can never see it — which is why the plugin routes that rule through\n\taddBase rather than addUtilities. See guide 0, decision 3.\n*/\nexport function useRipple() {\n\tconst ref = useRef<HTMLElement | null>(null);\n\n\tconst onPointerDown = useCallback((event: PointerEvent<HTMLElement>) => {\n\t\tconst node = ref.current;\n\t\tif (!node) return;\n\n\t\tconst rect = node.getBoundingClientRect();\n\t\tconst circle = document.createElement('span');\n\n\t\t// Diameter large enough to cover the element from any origin point.\n\t\tconst diameter = Math.max(rect.width, rect.height);\n\t\tcircle.style.width = circle.style.height = `${diameter}px`;\n\t\tcircle.style.left = `${event.clientX - rect.left - diameter / 2}px`;\n\t\tcircle.style.top = `${event.clientY - rect.top - diameter / 2}px`;\n\n\t\t// The one and only place this string exists.\n\t\tcircle.className = 'project-ripple';\n\n\t\t// Self-removing, so nothing has to be cleaned up on unmount.\n\t\tcircle.addEventListener('animationend', () => circle.remove());\n\t\tnode.append(circle);\n\t}, []);\n\n\treturn { ref, onPointerDown };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /*
2
+ Registers this package's components with the consumer's Tailwind scan.
3
+ Without this import their build never looks inside node_modules and the
4
+ components render unstyled.
5
+ */
6
+ @source '../**/*.{ts,tsx}';
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
- "name": "@anti049/lunar-ui-react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@anti049/lunar-ui-react",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "React components for the test design system.",
7
+ "keywords": [
8
+ "react",
9
+ "tailwindcss",
10
+ "ui",
11
+ "components",
12
+ "design-system"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Anti049/lunar-ui-monorepo.git",
17
+ "directory": "packages/react"
18
+ },
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsup && node -e \"require('node:fs').copyFileSync('src/lib/styles.css','dist/styles.css')\" && publint",
22
+ "check": "tsc --noEmit"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "main": "./dist/index.cjs",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js",
34
+ "require": "./dist/index.cjs"
35
+ },
36
+ "./styles.css": "./dist/styles.css",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "sideEffects": [
40
+ "**/*.css"
41
+ ],
42
+ "peerDependencies": {
43
+ "@anti049/lunar-ui": "^0.1.1",
44
+ "react": "^18 || ^19",
45
+ "react-dom": "^18 || ^19"
46
+ },
47
+ "dependencies": {
48
+ "clsx": "^2.1.1",
49
+ "tailwind-merge": "^3.7.0"
50
+ },
51
+ "devDependencies": {
52
+ "@anti049/lunar-ui": "workspace:*",
53
+ "@tailwindcss/vite": "^4.3.3",
54
+ "@types/react": "^19.3.0",
55
+ "@types/react-dom": "^19.3.0",
56
+ "@vitejs/plugin-react": "^6.1.1",
57
+ "publint": "^0.3.24",
58
+ "react": "^19.3.0",
59
+ "react-dom": "^19.3.0",
60
+ "tailwindcss": "^4.3.3",
61
+ "tsup": "^8.5.1",
62
+ "typescript": "~6.0.3",
63
+ "vite": "^8.3.0"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public",
67
+ "provenance": true
68
+ }
69
+ }