@wrdagency/blockout 0.0.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/dist/2NBKRL7C-DnAMmXv4.js +81 -0
- package/dist/CaretDown.es-eySGHzTJ.js +32 -0
- package/dist/CaretUp.es-Cy8czlHG.js +32 -0
- package/dist/P7GR5CS5-BryEvRCz.js +621 -0
- package/dist/SSRBase.es-BUXS72ra.js +33 -0
- package/dist/T7VMP3TM--1s529fr.js +3544 -0
- package/dist/UQQRIHDV-Bfi_RJby.js +1046 -0
- package/dist/VIIRIBF3-XWA2y8Hu.js +21 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/index.css +1 -0
- package/dist/assets/index10.css +1 -0
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index2.css +1 -0
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/assets/index5.css +1 -0
- package/dist/assets/index6.css +1 -0
- package/dist/assets/index7.css +1 -0
- package/dist/assets/index8.css +1 -0
- package/dist/assets/index9.css +1 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.js +28 -0
- package/dist/components/button-group/index.d.ts +6 -0
- package/dist/components/button-group/index.js +6 -0
- package/dist/components/controls/base-control/index.d.ts +3 -0
- package/dist/components/controls/base-control/index.js +26 -0
- package/dist/components/controls/base-control/props.d.ts +23 -0
- package/dist/components/controls/base-control/props.js +21 -0
- package/dist/components/controls/index.d.ts +6 -0
- package/dist/components/controls/index.js +14 -0
- package/dist/components/controls/number-control/index.d.ts +6 -0
- package/dist/components/controls/number-control/index.js +52 -0
- package/dist/components/controls/select-control/index.d.ts +9 -0
- package/dist/components/controls/select-control/index.js +591 -0
- package/dist/components/controls/select-control/options.d.ts +11 -0
- package/dist/components/controls/select-control/options.js +12 -0
- package/dist/components/controls/text-control/index.d.ts +6 -0
- package/dist/components/controls/text-control/index.js +12 -0
- package/dist/components/controls/textarea-control/index.d.ts +6 -0
- package/dist/components/controls/textarea-control/index.js +18 -0
- package/dist/components/controls/toggle-control/index.d.ts +8 -0
- package/dist/components/controls/toggle-control/index.js +46 -0
- package/dist/components/data-table/column.d.ts +4 -0
- package/dist/components/data-table/column.js +874 -0
- package/dist/components/data-table/context.d.ts +7 -0
- package/dist/components/data-table/context.js +36 -0
- package/dist/components/data-table/example.d.ts +1 -0
- package/dist/components/data-table/example.js +5 -0
- package/dist/components/data-table/footer.d.ts +2 -0
- package/dist/components/data-table/footer.js +23 -0
- package/dist/components/data-table/header.d.ts +7 -0
- package/dist/components/data-table/header.js +408 -0
- package/dist/components/data-table/index.d.ts +10 -0
- package/dist/components/data-table/index.js +86 -0
- package/dist/components/data-table/types.d.ts +75 -0
- package/dist/components/data-table/types.js +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +23 -0
- package/dist/components/menu/icon.d.ts +4 -0
- package/dist/components/menu/icon.js +6 -0
- package/dist/components/menu/index.d.ts +8 -0
- package/dist/components/menu/index.js +131 -0
- package/dist/components/menu/item.d.ts +7 -0
- package/dist/components/menu/item.js +8 -0
- package/dist/components/menu/items/action.d.ts +7 -0
- package/dist/components/menu/items/action.js +23 -0
- package/dist/components/menu/items/spacer.d.ts +2 -0
- package/dist/components/menu/items/spacer.js +46 -0
- package/dist/components/menu/items/submenu.d.ts +7 -0
- package/dist/components/menu/items/submenu.js +7 -0
- package/dist/components/menu/items/toggle.d.ts +7 -0
- package/dist/components/menu/items/toggle.js +109 -0
- package/dist/components/menu/types.d.ts +28 -0
- package/dist/components/menu/types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/item-CPVd5mKo.js +758 -0
- package/dist/primitives/draggable/index.d.ts +17 -0
- package/dist/primitives/draggable/index.js +52 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/resizable/index.d.ts +7 -0
- package/dist/primitives/resizable/index.js +76 -0
- package/dist/types/component.d.ts +4 -0
- package/dist/types/component.js +1 -0
- package/dist/types/math.d.ts +10 -0
- package/dist/types/math.js +1 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +6 -0
- package/dist/utils/noop.d.ts +1 -0
- package/dist/utils/noop.js +5 -0
- package/package.json +61 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector2D } from '../../types/math';
|
|
2
|
+
import { FC, HTMLAttributes } from 'react';
|
|
3
|
+
export type DragContext = {
|
|
4
|
+
isDragging: boolean;
|
|
5
|
+
start: Vector2D;
|
|
6
|
+
current: Vector2D;
|
|
7
|
+
delta: Vector2D;
|
|
8
|
+
};
|
|
9
|
+
interface DraggableProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
axis?: "x" | "y" | "both";
|
|
11
|
+
transform?: boolean;
|
|
12
|
+
onGrab?: (context: DragContext) => void;
|
|
13
|
+
onMove?: (context: DragContext) => void;
|
|
14
|
+
onRelease?: (context: DragContext) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const Draggable: FC<DraggableProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { cn as b } from "../../utils/css.js";
|
|
3
|
+
import { noop as c } from "../../utils/noop.js";
|
|
4
|
+
import { useState as y, useRef as S, useEffect as p } from "react";
|
|
5
|
+
const C = ({
|
|
6
|
+
className: v,
|
|
7
|
+
onGrab: w = c,
|
|
8
|
+
onMove: E = c,
|
|
9
|
+
onRelease: L = c,
|
|
10
|
+
transform: D = !0,
|
|
11
|
+
axis: d = "both",
|
|
12
|
+
...h
|
|
13
|
+
}) => {
|
|
14
|
+
const [r, m] = y(!1), [o, f] = y({ x: -1, y: -1 }), t = S(null), s = (e) => {
|
|
15
|
+
let n = e.clientX, l = e.clientY, g = n - o.x, x = l - o.y;
|
|
16
|
+
return d === "x" ? (x = 0, l = o.y) : d === "y" && (g = 0, n = o.x), {
|
|
17
|
+
isDragging: r,
|
|
18
|
+
start: o,
|
|
19
|
+
current: { x: n, y: l },
|
|
20
|
+
delta: { x: g, y: x }
|
|
21
|
+
};
|
|
22
|
+
}, u = (e) => {
|
|
23
|
+
m(!0), f({ x: e.clientX, y: e.clientY }), w(s(e));
|
|
24
|
+
}, i = (e) => {
|
|
25
|
+
if (!r)
|
|
26
|
+
return;
|
|
27
|
+
const n = s(e);
|
|
28
|
+
D && (t.current.style.transform = `translate(${n.delta.x}px, ${n.delta.y}px)`), E(n);
|
|
29
|
+
}, a = (e) => {
|
|
30
|
+
r && (m(!1), L(s(e)), f({ x: -1, y: -1 }), t.current.style.transform = "");
|
|
31
|
+
};
|
|
32
|
+
return p(() => {
|
|
33
|
+
document.documentElement.style.userSelect = r ? "none" : "";
|
|
34
|
+
}, [r]), p(() => {
|
|
35
|
+
if (t.current)
|
|
36
|
+
return t.current.addEventListener("mousedown", u), window.addEventListener("mousemove", i), window.addEventListener("mouseup", a), () => {
|
|
37
|
+
var e;
|
|
38
|
+
(e = t.current) == null || e.removeEventListener("mousedown", u), window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a);
|
|
39
|
+
};
|
|
40
|
+
}, [t, u, i, a]), /* @__PURE__ */ M(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: b("primitive-draggable", v),
|
|
44
|
+
ref: t,
|
|
45
|
+
"data-dragging": r,
|
|
46
|
+
...h
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
C as Draggable
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Draggable } from './draggable';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PolymorphicProps } from '../../types/component';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
interface ResizableProps {
|
|
4
|
+
axis?: "x" | "y" | "both";
|
|
5
|
+
}
|
|
6
|
+
export declare const Resizable: <As extends ElementType = "div">({ as, axis, className, children, ...restProps }: PolymorphicProps<As, ResizableProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as v, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { cn as g } from "../../utils/css.js";
|
|
3
|
+
import { useRef as _, useState as z, useEffect as R } from "react";
|
|
4
|
+
import { Draggable as d } from "../draggable/index.js";
|
|
5
|
+
import '../../assets/index.css';const j = ({
|
|
6
|
+
as: c,
|
|
7
|
+
axis: t = "both",
|
|
8
|
+
className: m,
|
|
9
|
+
children: f,
|
|
10
|
+
...b
|
|
11
|
+
}) => {
|
|
12
|
+
const u = c || "div", i = _(null), [r, n] = z({
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0,
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 0
|
|
17
|
+
}), a = () => {
|
|
18
|
+
const e = i.current.getBoundingClientRect();
|
|
19
|
+
n({
|
|
20
|
+
x: e.x,
|
|
21
|
+
y: e.y,
|
|
22
|
+
width: e.width,
|
|
23
|
+
height: e.height
|
|
24
|
+
});
|
|
25
|
+
}, o = (e) => {
|
|
26
|
+
a();
|
|
27
|
+
}, s = (e) => {
|
|
28
|
+
t !== "y" && (i.current.style.width = `${r.width + e.delta.x}px`), t !== "x" && (i.current.style.height = `${r.height + e.delta.y}px`);
|
|
29
|
+
}, l = (e) => {
|
|
30
|
+
n(({ x: p, y: x, ...y }) => ({
|
|
31
|
+
x: p + e.delta.x,
|
|
32
|
+
y: x + e.delta.y,
|
|
33
|
+
...y
|
|
34
|
+
})), a();
|
|
35
|
+
};
|
|
36
|
+
return R(() => {
|
|
37
|
+
a();
|
|
38
|
+
}, []), /* @__PURE__ */ v(
|
|
39
|
+
u,
|
|
40
|
+
{
|
|
41
|
+
className: g("primitive-resizable", m),
|
|
42
|
+
ref: i,
|
|
43
|
+
...b,
|
|
44
|
+
children: [
|
|
45
|
+
t !== "y" && /* @__PURE__ */ h(
|
|
46
|
+
d,
|
|
47
|
+
{
|
|
48
|
+
className: "primitive-resizable__handle primitive-resizable__handle--x",
|
|
49
|
+
"aria-orientation": "horizontal",
|
|
50
|
+
axis: "x",
|
|
51
|
+
transform: !1,
|
|
52
|
+
onGrab: o,
|
|
53
|
+
onMove: s,
|
|
54
|
+
onRelease: l
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
t !== "x" && /* @__PURE__ */ h(
|
|
58
|
+
d,
|
|
59
|
+
{
|
|
60
|
+
className: "primitive-resizable__handle primitive-resizable__handle--y",
|
|
61
|
+
"aria-orientation": "vertical",
|
|
62
|
+
axis: "y",
|
|
63
|
+
transform: !1,
|
|
64
|
+
onGrab: o,
|
|
65
|
+
onMove: s,
|
|
66
|
+
onRelease: l
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
f
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
j as Resizable
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cn(...classes: (string | boolean | number | undefined | null)[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const noop: () => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wrdagency/blockout",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A React component library created by WRD.agency",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/main.js",
|
|
7
|
+
"types": "dist/main.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "WRD",
|
|
16
|
+
"url": "https://wrd.agency"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"react",
|
|
21
|
+
"components"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "npm run dev",
|
|
25
|
+
"dev": "vite",
|
|
26
|
+
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
27
|
+
"lint": "eslint .",
|
|
28
|
+
"preview": "vite preview",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^19.1.0",
|
|
33
|
+
"react-dom": "^19.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@eslint/js": "^9.25.0",
|
|
37
|
+
"@types/node": "^22.15.18",
|
|
38
|
+
"@types/object-hash": "^3.0.6",
|
|
39
|
+
"@types/react": "^19.1.2",
|
|
40
|
+
"@types/react-dom": "^19.1.2",
|
|
41
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
42
|
+
"eslint": "^9.25.0",
|
|
43
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
45
|
+
"glob": "^11.0.2",
|
|
46
|
+
"globals": "^16.0.0",
|
|
47
|
+
"react": "^19.1.0",
|
|
48
|
+
"react-dom": "^19.1.0",
|
|
49
|
+
"typescript": "~5.8.3",
|
|
50
|
+
"typescript-eslint": "^8.30.1",
|
|
51
|
+
"vite": "^6.3.5",
|
|
52
|
+
"vite-plugin-dts": "^4.5.4",
|
|
53
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
54
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@ariakit/react": "^0.4.17",
|
|
58
|
+
"@phosphor-icons/react": "^2.1.8",
|
|
59
|
+
"object-hash": "^3.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/readme.md
ADDED