@haruhimemoe/ui 0.1.0

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +561 -0
  4. package/dist/components/actions/CopyButton.d.ts +33 -0
  5. package/dist/components/actions/CopyButton.js +40 -0
  6. package/dist/components/actions/JsonLd.d.ts +20 -0
  7. package/dist/components/actions/JsonLd.js +17 -0
  8. package/dist/components/actions/Pagination.d.ts +33 -0
  9. package/dist/components/actions/Pagination.js +27 -0
  10. package/dist/components/actions/PaginationStatus.d.ts +19 -0
  11. package/dist/components/actions/PaginationStatus.js +44 -0
  12. package/dist/components/basics/Button.d.ts +20 -0
  13. package/dist/components/basics/Button.js +10 -0
  14. package/dist/components/basics/ButtonLink.d.ts +23 -0
  15. package/dist/components/basics/ButtonLink.js +26 -0
  16. package/dist/components/basics/Card.d.ts +19 -0
  17. package/dist/components/basics/Card.js +20 -0
  18. package/dist/components/basics/Notice.d.ts +30 -0
  19. package/dist/components/basics/Notice.js +22 -0
  20. package/dist/components/basics/PageHeader.d.ts +25 -0
  21. package/dist/components/basics/PageHeader.js +10 -0
  22. package/dist/components/basics/Prose.d.ts +18 -0
  23. package/dist/components/basics/Prose.js +11 -0
  24. package/dist/components/basics/buttonStyles.d.ts +23 -0
  25. package/dist/components/basics/buttonStyles.js +28 -0
  26. package/dist/components/filters/Chip.d.ts +25 -0
  27. package/dist/components/filters/Chip.js +29 -0
  28. package/dist/components/filters/ChipGroup.d.ts +39 -0
  29. package/dist/components/filters/ChipGroup.js +44 -0
  30. package/dist/components/filters/FilterPanel.d.ts +36 -0
  31. package/dist/components/filters/FilterPanel.js +45 -0
  32. package/dist/components/filters/FilterRow.d.ts +22 -0
  33. package/dist/components/filters/FilterRow.js +22 -0
  34. package/dist/components/filters/RangeSlider.d.ts +62 -0
  35. package/dist/components/filters/RangeSlider.js +161 -0
  36. package/dist/components/forms/Checkbox.d.ts +20 -0
  37. package/dist/components/forms/Checkbox.js +13 -0
  38. package/dist/components/forms/FieldFrame.d.ts +66 -0
  39. package/dist/components/forms/FieldFrame.js +44 -0
  40. package/dist/components/forms/Select.d.ts +19 -0
  41. package/dist/components/forms/Select.js +12 -0
  42. package/dist/components/forms/TextInput.d.ts +19 -0
  43. package/dist/components/forms/TextInput.js +12 -0
  44. package/dist/components/forms/Textarea.d.ts +19 -0
  45. package/dist/components/forms/Textarea.js +13 -0
  46. package/dist/components/forms/fieldStyles.d.ts +17 -0
  47. package/dist/components/forms/fieldStyles.js +19 -0
  48. package/dist/components/icons/GitHubIcon.d.ts +18 -0
  49. package/dist/components/icons/GitHubIcon.js +10 -0
  50. package/dist/components/icons/HaruhimeWordmark.d.ts +23 -0
  51. package/dist/components/icons/HaruhimeWordmark.js +16 -0
  52. package/dist/components/icons/HaruhimeWordmarkLink.d.ts +21 -0
  53. package/dist/components/icons/HaruhimeWordmarkLink.js +12 -0
  54. package/dist/components/shell/AutoLink.d.ts +19 -0
  55. package/dist/components/shell/AutoLink.js +23 -0
  56. package/dist/components/shell/NavLinks.d.ts +24 -0
  57. package/dist/components/shell/NavLinks.js +40 -0
  58. package/dist/components/shell/PageShell.d.ts +29 -0
  59. package/dist/components/shell/PageShell.js +11 -0
  60. package/dist/components/shell/SiteFooter.d.ts +40 -0
  61. package/dist/components/shell/SiteFooter.js +21 -0
  62. package/dist/components/shell/SiteHeader.d.ts +32 -0
  63. package/dist/components/shell/SiteHeader.js +16 -0
  64. package/dist/components/shell/links.d.ts +25 -0
  65. package/dist/components/shell/links.js +32 -0
  66. package/dist/index.d.ts +38 -0
  67. package/dist/index.js +41 -0
  68. package/dist/theme.css +54 -0
  69. package/dist/utils/cx.d.ts +18 -0
  70. package/dist/utils/cx.js +17 -0
  71. package/dist/utils/href.d.ts +15 -0
  72. package/dist/utils/href.js +17 -0
  73. package/package.json +90 -0
package/dist/theme.css ADDED
@@ -0,0 +1,54 @@
1
+ /*
2
+ * @file src/theme.css
3
+ * @desc The haruhime.moe theme for Tailwind 4: the hue-driven HSL palette the sites share
4
+ * (b = backgrounds, c = content, h = highlight), Nunito as the sans font, a visible focus
5
+ * ring, and an @source line so Tailwind generates the classes these components use.
6
+ *
7
+ * Use it from the app's global stylesheet, after Tailwind:
8
+ *
9
+ * @import "tailwindcss";
10
+ * @import "@haruhimemoe/ui/theme.css";
11
+ *
12
+ * Set --hue on :root to recolor everything (default 333, pink). Some hues need --h2-l
13
+ * (h2 lightness, default 45%) or --h1-l (h1 lightness, default 70%) moved to keep text at
14
+ * 4.5:1; the README lists values. Load Nunito with next/font as the --font-nunito variable;
15
+ * without it the sans stack falls back to the system font.
16
+ * @author David @dvhsh (https://dvh.sh)
17
+ * @created Wed Sep 23, 2026
18
+ * @modified Wed Sep 23, 2026
19
+ */
20
+
21
+ /* This file ships as dist/theme.css, so './' is the package's compiled components. */
22
+ @source "./";
23
+
24
+ :root {
25
+ --hue: 333;
26
+ color-scheme: dark;
27
+ }
28
+
29
+ @theme inline {
30
+ --color-b1: hsl(var(--hue) 10% 40%);
31
+ --color-b2: hsl(var(--hue) 10% 30%);
32
+ --color-b3: hsl(var(--hue) 10% 25%);
33
+ --color-b4: hsl(var(--hue) 10% 20%);
34
+ --color-b5: hsl(var(--hue) 10% 15%);
35
+ --color-b6: hsl(var(--hue) 10% 10%);
36
+
37
+ --color-c1: hsl(var(--hue) 40% 100%);
38
+ --color-c2: hsl(var(--hue) 40% 90%);
39
+ --color-c3: hsl(var(--hue) 40% 80%);
40
+ --color-c4: hsl(var(--hue) 40% 70%);
41
+
42
+ --color-h1: hsl(var(--hue) 100% var(--h1-l, 70%));
43
+ --color-h2: hsl(var(--hue) 50% var(--h2-l, 45%));
44
+
45
+ --font-sans: var(--font-nunito), ui-sans-serif, system-ui, sans-serif;
46
+ }
47
+
48
+ @layer base {
49
+ :focus-visible {
50
+ outline: 2px solid var(--color-h1);
51
+ outline-offset: 2px;
52
+ border-radius: 4px;
53
+ }
54
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file src/utils/cx.ts
3
+ * @desc Class-name merger: drops falsy values and resolves Tailwind conflicts with tailwind-merge,
4
+ * so a later class (the caller's) replaces an earlier one that sets the same property. Same
5
+ * behavior as the sites' `cn` helper.
6
+ * @author David @dvhsh (https://dvh.sh)
7
+ * @created Wed Sep 23, 2026
8
+ * @modified Wed Sep 23, 2026
9
+ */
10
+ /** A class name, or a falsy value to skip (handy for `cond && "class"`). */
11
+ export type ClassValue = string | false | null | undefined | 0;
12
+ /**
13
+ * @function cx
14
+ * @param classes {ClassValue[]} class strings; falsy values are skipped
15
+ * @returns {string} the classes in order, space-separated, with Tailwind conflicts resolved in
16
+ * favor of the later class (`cx("w-full", "w-auto")` is `"w-auto"`)
17
+ */
18
+ export declare const cx: (...classes: ClassValue[]) => string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file src/utils/cx.ts
3
+ * @desc Class-name merger: drops falsy values and resolves Tailwind conflicts with tailwind-merge,
4
+ * so a later class (the caller's) replaces an earlier one that sets the same property. Same
5
+ * behavior as the sites' `cn` helper.
6
+ * @author David @dvhsh (https://dvh.sh)
7
+ * @created Wed Sep 23, 2026
8
+ * @modified Wed Sep 23, 2026
9
+ */
10
+ import { twMerge } from "tailwind-merge";
11
+ /**
12
+ * @function cx
13
+ * @param classes {ClassValue[]} class strings; falsy values are skipped
14
+ * @returns {string} the classes in order, space-separated, with Tailwind conflicts resolved in
15
+ * favor of the later class (`cx("w-full", "w-auto")` is `"w-auto"`)
16
+ */
17
+ export const cx = (...classes) => twMerge(...classes);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file src/utils/href.ts
3
+ * @desc Tells hrefs that leave the app (a URL scheme or a protocol-relative //host) from paths
4
+ * inside it, so links can pick a plain <a> or next/link.
5
+ * @author David @dvhsh (https://dvh.sh)
6
+ * @created Wed Sep 23, 2026
7
+ * @modified Wed Sep 23, 2026
8
+ */
9
+ /**
10
+ * @function isExternalHref
11
+ * @param href {string} a link target
12
+ * @returns {boolean} true when the href has a scheme or starts with `//`, so it leaves the app
13
+ * and should be a plain `<a>` instead of `next/link`
14
+ */
15
+ export declare const isExternalHref: (href: string) => boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file src/utils/href.ts
3
+ * @desc Tells hrefs that leave the app (a URL scheme or a protocol-relative //host) from paths
4
+ * inside it, so links can pick a plain <a> or next/link.
5
+ * @author David @dvhsh (https://dvh.sh)
6
+ * @created Wed Sep 23, 2026
7
+ * @modified Wed Sep 23, 2026
8
+ */
9
+ // A URL scheme ("https:", "mailto:") or a protocol-relative "//host".
10
+ const EXTERNAL = /^(?:[a-z][a-z\d+.-]*:|\/\/)/i;
11
+ /**
12
+ * @function isExternalHref
13
+ * @param href {string} a link target
14
+ * @returns {boolean} true when the href has a scheme or starts with `//`, so it leaves the app
15
+ * and should be a plain `<a>` instead of `next/link`
16
+ */
17
+ export const isExternalHref = (href) => EXTERNAL.test(href);
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@haruhimemoe/ui",
3
+ "version": "0.1.0",
4
+ "description": "React components for the haruhime.moe osu! tools on Next.js: the osu!-web-style palette as a Tailwind theme, buttons, cards, form fields, filter controls and the site header and footer.",
5
+ "keywords": [
6
+ "osu",
7
+ "osu!",
8
+ "react",
9
+ "nextjs",
10
+ "tailwindcss",
11
+ "components",
12
+ "ui",
13
+ "haruhime"
14
+ ],
15
+ "homepage": "https://github.com/haruhimemoe/ui#readme",
16
+ "bugs": "https://github.com/haruhimemoe/ui/issues",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/haruhimemoe/ui.git"
20
+ },
21
+ "license": "MIT",
22
+ "author": "David (https://dvh.sh)",
23
+ "type": "module",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./theme.css": "./dist/theme.css",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "types": "./dist/index.d.ts",
33
+ "files": [
34
+ "dist",
35
+ "CHANGELOG.md"
36
+ ],
37
+ "sideEffects": [
38
+ "**/*.css"
39
+ ],
40
+ "engines": {
41
+ "node": ">=22.12"
42
+ },
43
+ "packageManager": "bun@1.4.2",
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "provenance": true
47
+ },
48
+ "scripts": {
49
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
50
+ "build": "bun run clean && tsc -p tsconfig.build.json && node -e \"require('node:fs').copyFileSync('src/theme.css','dist/theme.css')\"",
51
+ "check": "biome check .",
52
+ "check:fix": "biome check --write .",
53
+ "typecheck": "tsc --noEmit",
54
+ "test": "vitest run",
55
+ "test:coverage": "vitest run --coverage",
56
+ "test:watch": "vitest",
57
+ "check:consumer": "node scripts/check-consumer.mjs",
58
+ "prepublishOnly": "bun run check && bun run typecheck && bun run test && bun run build"
59
+ },
60
+ "dependencies": {
61
+ "tailwind-merge": "3.7.0"
62
+ },
63
+ "peerDependencies": {
64
+ "next": ">=16.0.0 <17",
65
+ "react": ">=19.0.0",
66
+ "react-dom": ">=19.0.0",
67
+ "tailwindcss": ">=4.1.0 <5"
68
+ },
69
+ "devDependencies": {
70
+ "@biomejs/biome": "2.5.14",
71
+ "@tailwindcss/postcss": "4.3.3",
72
+ "@testing-library/dom": "10.4.2",
73
+ "@testing-library/jest-dom": "7.0.1",
74
+ "@testing-library/react": "16.3.3",
75
+ "@testing-library/user-event": "14.6.7",
76
+ "@types/node": "26.6.2",
77
+ "@types/react": "19.3.0",
78
+ "@types/react-dom": "19.3.0",
79
+ "@vitejs/plugin-react": "6.1.1",
80
+ "@vitest/coverage-v8": "5.0.1",
81
+ "axe-core": "4.13.0",
82
+ "jsdom": "30.1.1",
83
+ "next": "16.3.6",
84
+ "react": "19.3.0",
85
+ "react-dom": "19.3.0",
86
+ "tailwindcss": "4.3.3",
87
+ "typescript": "7.0.2",
88
+ "vitest": "5.0.1"
89
+ }
90
+ }