@bsuite/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.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @bsuite/ui
2
+
3
+ Shared UI primitives for the BSuite apps (D2C Neon Electric + Corporate brands).
4
+
5
+ Ships as an npm package because Vercel deploys each BSuite app from its own
6
+ GitHub repo — the parent monorepo's `packages/` directory does NOT exist in
7
+ the Vercel build context. Consumers install from npm with a pinned semver.
8
+
9
+ ## Components
10
+
11
+ ### `DotPattern`
12
+
13
+ Full-viewport dot-pattern background. SVG `<pattern>` tiling — ~1 DOM node
14
+ (vs ~1,800 motion.circle nodes on a typical viewport).
15
+
16
+ ```tsx
17
+ import { DotPattern } from '@bsuite/ui'
18
+
19
+ <div className="relative">
20
+ <DotPattern
21
+ width={28}
22
+ height={28}
23
+ cr={1.5}
24
+ className="opacity-[0.35] [color:var(--accent-primary)]"
25
+ />
26
+ {/* page content */}
27
+ </div>
28
+ ```
29
+
30
+ Colour control via Tailwind `text-*` utilities or inline `[color:var(...)]`
31
+ (dots use `fill="currentColor"`).
32
+
33
+ ## Utils
34
+
35
+ ### `cn(...classes)`
36
+
37
+ shadcn-style className merger — `clsx` + `tailwind-merge`. Available for
38
+ consumers that want to compose `@bsuite/ui` components with local overrides
39
+ without pulling shadcn again.
40
+
41
+ ## Releases
42
+
43
+ 1. Edit source under `src/`.
44
+ 2. `pnpm -C packages/ui test` — all cases must pass.
45
+ 3. `pnpm -C packages/ui build` — emits `dist/`.
46
+ 4. Bump version in `package.json` (semver).
47
+ 5. `npm publish --access public` from `packages/ui/`.
48
+ 6. Update consumer `package.json` to the new version, regenerate lockfile
49
+ **outside** the bsuite tree (see root `CLAUDE.md` rule 7), commit the
50
+ lockfile + a consumer-side bump PR.
51
+
52
+ **NEVER** use `workspace:*` or `file:../packages/ui` for this package in a
53
+ consumer — Vercel builds can't resolve those.
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ /**
3
+ * DotPattern Component Props
4
+ *
5
+ * @param width Horizontal spacing between dots (default 16)
6
+ * @param height Vertical spacing between dots (default 16)
7
+ * @param x X-offset of the entire pattern (default 0)
8
+ * @param y Y-offset of the entire pattern (default 0)
9
+ * @param cx X-offset of individual dots within a tile (default 1)
10
+ * @param cy Y-offset of individual dots within a tile (default 1)
11
+ * @param cr Radius of each dot (default 1)
12
+ * @param glow When true, the whole pattern receives an `animate-dot-glow`
13
+ * class. Consumer app is responsible for defining that
14
+ * @keyframes rule in its CSS (kept out of this package so
15
+ * apps can theme the glow to their brand).
16
+ * @param className Additional classes merged via `tailwind-merge` so
17
+ * consumers can override the default `text-neutral-400/80`
18
+ * colour (dots use `fill="currentColor"` so overriding
19
+ * `text-*` is the supported way to set colour).
20
+ */
21
+ export interface DotPatternProps extends React.SVGProps<SVGSVGElement> {
22
+ width?: number;
23
+ height?: number;
24
+ x?: number;
25
+ y?: number;
26
+ cx?: number;
27
+ cy?: number;
28
+ cr?: number;
29
+ className?: string;
30
+ glow?: boolean;
31
+ }
32
+ /**
33
+ * Full-viewport dot pattern background.
34
+ *
35
+ * Implementation note: uses a single SVG `<pattern>` for browser-native
36
+ * tiling (~1 DOM node) rather than one `<motion.circle>` per dot
37
+ * (~1,800 nodes on a typical viewport). This is a ~100× difference in
38
+ * layout/paint cost on first render — measurable on lower-end Android
39
+ * devices and during theme transitions.
40
+ *
41
+ * Promoted from `crm7/src/components/magicui/dot-pattern.tsx` to this
42
+ * shared package so all four D2C apps (BSU, CRM7, R80.3, Throughput)
43
+ * render an identical background without copy-paste drift. The Braden
44
+ * corporate app deliberately does NOT use this — its brand is photo-
45
+ * forward, not a tech-grid aesthetic.
46
+ */
47
+ export declare function DotPattern({ width, height, x, y, cx, cy, cr, className, glow, ...props }: DotPatternProps): import("react/jsx-runtime").JSX.Element;
48
+ //# sourceMappingURL=dot-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-pattern.d.ts","sourceRoot":"","sources":["../src/dot-pattern.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAA;AAGpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAU,EACV,MAAW,EACX,CAAK,EACL,CAAK,EACL,EAAM,EACN,EAAM,EACN,EAAM,EACN,SAAS,EACT,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,2CA4BjB"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { cn } from './utils.js';
4
+ /**
5
+ * Full-viewport dot pattern background.
6
+ *
7
+ * Implementation note: uses a single SVG `<pattern>` for browser-native
8
+ * tiling (~1 DOM node) rather than one `<motion.circle>` per dot
9
+ * (~1,800 nodes on a typical viewport). This is a ~100× difference in
10
+ * layout/paint cost on first render — measurable on lower-end Android
11
+ * devices and during theme transitions.
12
+ *
13
+ * Promoted from `crm7/src/components/magicui/dot-pattern.tsx` to this
14
+ * shared package so all four D2C apps (BSU, CRM7, R80.3, Throughput)
15
+ * render an identical background without copy-paste drift. The Braden
16
+ * corporate app deliberately does NOT use this — its brand is photo-
17
+ * forward, not a tech-grid aesthetic.
18
+ */
19
+ export function DotPattern({ width = 16, height = 16, x = 0, y = 0, cx = 1, cy = 1, cr = 1, className, glow = false, ...props }) {
20
+ const id = useId();
21
+ return (_jsxs("svg", { "aria-hidden": "true", className: cn('pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80', glow && 'animate-dot-glow', className), ...props, children: [_jsx("defs", { children: _jsx("pattern", { id: `${id}-pattern`, x: x, y: y, width: width, height: height, patternUnits: "userSpaceOnUse", children: _jsx("circle", { cx: cx, cy: cy, r: cr, fill: "currentColor" }) }) }), _jsx("rect", { width: "100%", height: "100%", fill: `url(#${id}-pattern)` })] }));
22
+ }
@@ -0,0 +1,3 @@
1
+ export { DotPattern, type DotPatternProps } from './dot-pattern.js';
2
+ export { cn } from './utils.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { DotPattern } from './dot-pattern.js';
2
+ export { cn } from './utils.js';
@@ -0,0 +1,10 @@
1
+ import { type ClassValue } from 'clsx';
2
+ /**
3
+ * Merge Tailwind classNames, resolving conflicts (later wins).
4
+ *
5
+ * Behaviour-equivalent to the shadcn/ui `cn()` helper every BSuite app
6
+ * already uses locally — centralising it here so every `@bsuite/ui`
7
+ * component can share one implementation without consumers wiring it up.
8
+ */
9
+ export declare function cn(...inputs: ClassValue[]): string;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C;;;;;;GAMG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
package/dist/utils.js ADDED
@@ -0,0 +1,12 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ /**
4
+ * Merge Tailwind classNames, resolving conflicts (later wins).
5
+ *
6
+ * Behaviour-equivalent to the shadcn/ui `cn()` helper every BSuite app
7
+ * already uses locally — centralising it here so every `@bsuite/ui`
8
+ * component can share one implementation without consumers wiring it up.
9
+ */
10
+ export function cn(...inputs) {
11
+ return twMerge(clsx(inputs));
12
+ }
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@bsuite/ui",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "UNLICENSED",
6
+ "description": "Shared UI primitives for the BSuite apps (D2C Neon Electric + Corporate brands).",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/GaryOcean428/bsuite.git",
10
+ "directory": "packages/ui"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "types": "./dist/index.d.ts"
21
+ },
22
+ "./dot-pattern": {
23
+ "import": "./dist/dot-pattern.js",
24
+ "types": "./dist/dot-pattern.d.ts"
25
+ },
26
+ "./utils": {
27
+ "import": "./dist/utils.js",
28
+ "types": "./dist/utils.d.ts"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "build": "tsc -p tsconfig.build.json",
33
+ "typecheck": "tsc --noEmit",
34
+ "test": "vitest run"
35
+ },
36
+ "dependencies": {
37
+ "clsx": "^2.1.1",
38
+ "tailwind-merge": "^2.5.5"
39
+ },
40
+ "peerDependencies": {
41
+ "react": "^18.3.0 || ^19.0.0",
42
+ "react-dom": "^18.3.0 || ^19.0.0"
43
+ },
44
+ "devDependencies": {
45
+ "@testing-library/jest-dom": "^6.9.1",
46
+ "@testing-library/react": "^16.3.2",
47
+ "@types/react": "^18.3.28",
48
+ "@types/react-dom": "^18.3.6",
49
+ "@vitejs/plugin-react": "^5.2.0",
50
+ "jsdom": "^28.1.0",
51
+ "react": "^18.3.1",
52
+ "react-dom": "^18.3.1",
53
+ "typescript": "~5.7.3",
54
+ "vitest": "^3.2.4"
55
+ }
56
+ }