@openlex/react 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/components/ComparisonTable.d.ts +9 -0
- package/dist/components/ComparisonTable.d.ts.map +1 -0
- package/dist/components/ComparisonTable.js +53 -0
- package/dist/components/ComparisonTable.js.map +1 -0
- package/dist/components/CourtHierarchy.d.ts +8 -0
- package/dist/components/CourtHierarchy.d.ts.map +1 -0
- package/dist/components/CourtHierarchy.js +29 -0
- package/dist/components/CourtHierarchy.js.map +1 -0
- package/dist/components/JurisdictionPicker.d.ts +9 -0
- package/dist/components/JurisdictionPicker.d.ts.map +1 -0
- package/dist/components/JurisdictionPicker.js +30 -0
- package/dist/components/JurisdictionPicker.js.map +1 -0
- package/dist/components/StatuteCard.d.ts +9 -0
- package/dist/components/StatuteCard.d.ts.map +1 -0
- package/dist/components/StatuteCard.js +8 -0
- package/dist/components/StatuteCard.js.map +1 -0
- package/dist/hooks/useCompare.d.ts +5 -0
- package/dist/hooks/useCompare.d.ts.map +1 -0
- package/dist/hooks/useCompare.js +16 -0
- package/dist/hooks/useCompare.js.map +1 -0
- package/dist/hooks/useCourts.d.ts +14 -0
- package/dist/hooks/useCourts.d.ts.map +1 -0
- package/dist/hooks/useCourts.js +10 -0
- package/dist/hooks/useCourts.js.map +1 -0
- package/dist/hooks/useFetch.d.ts +4 -0
- package/dist/hooks/useFetch.d.ts.map +1 -0
- package/dist/hooks/useFetch.js +47 -0
- package/dist/hooks/useFetch.js.map +1 -0
- package/dist/hooks/useOpenLex.d.ts +16 -0
- package/dist/hooks/useOpenLex.d.ts.map +1 -0
- package/dist/hooks/useOpenLex.js +18 -0
- package/dist/hooks/useOpenLex.js.map +1 -0
- package/dist/hooks/usePreemption.d.ts +13 -0
- package/dist/hooks/usePreemption.d.ts.map +1 -0
- package/dist/hooks/usePreemption.js +11 -0
- package/dist/hooks/usePreemption.js.map +1 -0
- package/dist/hooks/useSearch.d.ts +10 -0
- package/dist/hooks/useSearch.d.ts.map +1 -0
- package/dist/hooks/useSearch.js +50 -0
- package/dist/hooks/useSearch.js.map +1 -0
- package/dist/hooks/useStatutes.d.ts +5 -0
- package/dist/hooks/useStatutes.d.ts.map +1 -0
- package/dist/hooks/useStatutes.js +17 -0
- package/dist/hooks/useStatutes.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ahmed Allem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @openlex/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React hooks and components for the OpenLex jurisdiction mapping engine.
|
|
4
|
+
|
|
5
|
+
Part of [OpenLex](https://github.com/kingofmit/openlex) — open-source jurisdiction mapping engine for U.S. law.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @openlex/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { useJurisdiction, JurisdictionPicker } from "@openlex/react";
|
|
17
|
+
|
|
18
|
+
const { jurisdiction, setJurisdiction } = useJurisdiction();
|
|
19
|
+
return <JurisdictionPicker value={jurisdiction} onChange={setJurisdiction} />;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComparisonMatrix } from "@openlex/core";
|
|
2
|
+
export interface ComparisonTableProps {
|
|
3
|
+
matrix: ComparisonMatrix;
|
|
4
|
+
className?: string;
|
|
5
|
+
sortable?: boolean;
|
|
6
|
+
highlightOutliers?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ComparisonTable({ matrix, className, sortable, highlightOutliers, }: ComparisonTableProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ComparisonTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComparisonTable.d.ts","sourceRoot":"","sources":["../../src/components/ComparisonTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,SAAS,EACT,QAAe,EACf,iBAAyB,GAC1B,EAAE,oBAAoB,+BAkFtB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComparisonTable = ComparisonTable;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function ComparisonTable({ matrix, className, sortable = true, highlightOutliers = false, }) {
|
|
7
|
+
const [sortKey, setSortKey] = (0, react_1.useState)(null);
|
|
8
|
+
const [sortAsc, setSortAsc] = (0, react_1.useState)(true);
|
|
9
|
+
const outlierSet = new Set(highlightOutliers ? matrix.summary.outliers.map((o) => o.split(":")[0]) : []);
|
|
10
|
+
const handleSort = (key) => {
|
|
11
|
+
if (!sortable)
|
|
12
|
+
return;
|
|
13
|
+
if (sortKey === key) {
|
|
14
|
+
setSortAsc(!sortAsc);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
setSortKey(key);
|
|
18
|
+
setSortAsc(true);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const sortedRows = [...matrix.rows].sort((a, b) => {
|
|
22
|
+
if (!sortKey)
|
|
23
|
+
return 0;
|
|
24
|
+
const av = a.values[sortKey];
|
|
25
|
+
const bv = b.values[sortKey];
|
|
26
|
+
if (av === null || av === undefined)
|
|
27
|
+
return 1;
|
|
28
|
+
if (bv === null || bv === undefined)
|
|
29
|
+
return -1;
|
|
30
|
+
const cmp = typeof av === "number" && typeof bv === "number"
|
|
31
|
+
? av - bv
|
|
32
|
+
: String(av).localeCompare(String(bv));
|
|
33
|
+
return sortAsc ? cmp : -cmp;
|
|
34
|
+
});
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [(0, jsx_runtime_1.jsx)("h2", { children: matrix.topicName }), (0, jsx_runtime_1.jsxs)("p", { children: [matrix.rows.length, " jurisdictions compared"] }), (0, jsx_runtime_1.jsxs)("table", { children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsxs)("th", { onClick: () => handleSort("_state"), style: sortable ? { cursor: "pointer" } : undefined, children: ["State ", sortKey === "_state" ? (sortAsc ? "▲" : "▼") : ""] }), matrix.columns.map((col) => ((0, jsx_runtime_1.jsxs)("th", { onClick: () => handleSort(col.key), style: sortable ? { cursor: "pointer" } : undefined, title: col.description, children: [col.label, " ", sortKey === col.key ? (sortAsc ? "▲" : "▼") : ""] }, col.key)))] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: sortedRows.map((row) => ((0, jsx_runtime_1.jsxs)("tr", { style: outlierSet.has(row.jurisdictionName) ? { fontWeight: "bold" } : undefined, children: [(0, jsx_runtime_1.jsx)("td", { children: row.jurisdictionName }), matrix.columns.map((col) => {
|
|
36
|
+
const val = row.values[col.key];
|
|
37
|
+
let display;
|
|
38
|
+
if (val === null || val === undefined) {
|
|
39
|
+
display = "—";
|
|
40
|
+
}
|
|
41
|
+
else if (typeof val === "boolean") {
|
|
42
|
+
display = val ? "Yes" : "No";
|
|
43
|
+
}
|
|
44
|
+
else if (col.type === "currency" && typeof val === "number") {
|
|
45
|
+
display = `$${val.toLocaleString()}`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
display = String(val);
|
|
49
|
+
}
|
|
50
|
+
return (0, jsx_runtime_1.jsx)("td", { children: display }, col.key);
|
|
51
|
+
})] }, row.jurisdictionId))) })] })] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ComparisonTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComparisonTable.js","sourceRoot":"","sources":["../../src/components/ComparisonTable.tsx"],"names":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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Court } from "@openlex/core";
|
|
2
|
+
export interface CourtHierarchyProps {
|
|
3
|
+
courts: Court[];
|
|
4
|
+
stateName?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function CourtHierarchy({ courts, stateName, className }: CourtHierarchyProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=CourtHierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CourtHierarchy.d.ts","sourceRoot":"","sources":["../../src/components/CourtHierarchy.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,mBAAmB,+BAuCnF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourtHierarchy = CourtHierarchy;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const LEVEL_ORDER = {
|
|
6
|
+
supreme: 0,
|
|
7
|
+
appellate: 1,
|
|
8
|
+
trial: 2,
|
|
9
|
+
specialized: 3,
|
|
10
|
+
magistrate: 4,
|
|
11
|
+
};
|
|
12
|
+
const LEVEL_LABELS = {
|
|
13
|
+
supreme: "Highest Court",
|
|
14
|
+
appellate: "Appellate Courts",
|
|
15
|
+
trial: "Trial Courts",
|
|
16
|
+
specialized: "Specialized Courts",
|
|
17
|
+
magistrate: "Magistrate Courts",
|
|
18
|
+
};
|
|
19
|
+
function CourtHierarchy({ courts, stateName, className }) {
|
|
20
|
+
const grouped = new Map();
|
|
21
|
+
for (const court of courts) {
|
|
22
|
+
const list = grouped.get(court.level) ?? [];
|
|
23
|
+
list.push(court);
|
|
24
|
+
grouped.set(court.level, list);
|
|
25
|
+
}
|
|
26
|
+
const levels = [...grouped.entries()].sort(([a], [b]) => (LEVEL_ORDER[a] ?? 99) - (LEVEL_ORDER[b] ?? 99));
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [stateName && (0, jsx_runtime_1.jsxs)("h2", { children: [stateName, " Court System"] }), levels.map(([level, levelCourts]) => ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { children: LEVEL_LABELS[level] ?? level }), (0, jsx_runtime_1.jsx)("ul", { children: levelCourts.map((court) => ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)("strong", { children: court.name }), court.abbreviation && ` (${court.abbreviation})`, court.circuit && ` — Circuit ${court.circuit}`, court.url && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" ", (0, jsx_runtime_1.jsx)("a", { href: court.url, target: "_blank", rel: "noopener noreferrer", children: "Website" })] }))] }, court.id))) })] }, level)))] }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=CourtHierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CourtHierarchy.js","sourceRoot":"","sources":["../../src/components/CourtHierarchy.tsx"],"names":[],"mappings":";;AAwBA,wCAuCC;;AAvDD,MAAM,WAAW,GAA2B;IAC1C,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;CACd,CAAC;AAEF,MAAM,YAAY,GAA2B;IAC3C,OAAO,EAAE,eAAe;IACxB,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,oBAAoB;IACjC,UAAU,EAAE,m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AE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,wBAEzD,IACH,CACJ,KAXM,KAAK,CAAC,EAAE,CAYZ,CACN,CAAC,GACC,KAlBG,KAAK,CAmBT,CACP,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface JurisdictionPickerProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (stateId: string) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
includeEmpty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function JurisdictionPicker({ value, onChange, placeholder, className, includeEmpty, }: JurisdictionPickerProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=JurisdictionPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JurisdictionPicker.d.ts","sourceRoot":"","sources":["../../src/components/JurisdictionPicker.tsx"],"names":[],"mappings":"AAsBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,WAAiC,EACjC,SAAS,EACT,YAAmB,GACpB,EAAE,uBAAuB,+BAezB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JurisdictionPicker = JurisdictionPicker;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const STATES = [
|
|
6
|
+
{ id: "al", name: "Alabama" }, { id: "ak", name: "Alaska" }, { id: "az", name: "Arizona" },
|
|
7
|
+
{ id: "ar", name: "Arkansas" }, { id: "ca", name: "California" }, { id: "co", name: "Colorado" },
|
|
8
|
+
{ id: "ct", name: "Connecticut" }, { id: "de", name: "Delaware" }, { id: "fl", name: "Florida" },
|
|
9
|
+
{ id: "ga", name: "Georgia" }, { id: "hi", name: "Hawaii" }, { id: "id", name: "Idaho" },
|
|
10
|
+
{ id: "il", name: "Illinois" }, { id: "in", name: "Indiana" }, { id: "ia", name: "Iowa" },
|
|
11
|
+
{ id: "ks", name: "Kansas" }, { id: "ky", name: "Kentucky" }, { id: "la", name: "Louisiana" },
|
|
12
|
+
{ id: "me", name: "Maine" }, { id: "md", name: "Maryland" }, { id: "ma", name: "Massachusetts" },
|
|
13
|
+
{ id: "mi", name: "Michigan" }, { id: "mn", name: "Minnesota" }, { id: "ms", name: "Mississippi" },
|
|
14
|
+
{ id: "mo", name: "Missouri" }, { id: "mt", name: "Montana" }, { id: "ne", name: "Nebraska" },
|
|
15
|
+
{ id: "nv", name: "Nevada" }, { id: "nh", name: "New Hampshire" }, { id: "nj", name: "New Jersey" },
|
|
16
|
+
{ id: "nm", name: "New Mexico" }, { id: "ny", name: "New York" }, { id: "nc", name: "North Carolina" },
|
|
17
|
+
{ id: "nd", name: "North Dakota" }, { id: "oh", name: "Ohio" }, { id: "ok", name: "Oklahoma" },
|
|
18
|
+
{ id: "or", name: "Oregon" }, { id: "pa", name: "Pennsylvania" }, { id: "ri", name: "Rhode Island" },
|
|
19
|
+
{ id: "sc", name: "South Carolina" }, { id: "sd", name: "South Dakota" }, { id: "tn", name: "Tennessee" },
|
|
20
|
+
{ id: "tx", name: "Texas" }, { id: "ut", name: "Utah" }, { id: "vt", name: "Vermont" },
|
|
21
|
+
{ id: "va", name: "Virginia" }, { id: "wa", name: "Washington" }, { id: "wv", name: "West Virginia" },
|
|
22
|
+
{ id: "wi", name: "Wisconsin" }, { id: "wy", name: "Wyoming" }, { id: "dc", name: "District of Columbia" },
|
|
23
|
+
];
|
|
24
|
+
function JurisdictionPicker({ value, onChange, placeholder = "Select a state...", className, includeEmpty = true, }) {
|
|
25
|
+
const handleChange = (e) => {
|
|
26
|
+
onChange(e.target.value);
|
|
27
|
+
};
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("select", { value: value, onChange: handleChange, className: className, children: [includeEmpty && (0, jsx_runtime_1.jsx)("option", { value: "", children: placeholder }), STATES.map((s) => ((0, jsx_runtime_1.jsx)("option", { value: s.id, children: s.name }, s.id)))] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=JurisdictionPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JurisdictionPicker.js","sourceRoot":"","sources":["../../src/components/JurisdictionPicker.tsx"],"names":[],"mappings":";;AA8BA,gDAqBC;;AAjDD,MAAM,MAAM,GAAwC;IAClD,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1F,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;IAChG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;IAChG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAA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,SAAS,EACT,YAAY,GAAG,IAAI,GACK;IACxB,MAAM,YAAY,GAAG,CAAC,CAAiC,EAAE,EAAE;QACzD,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,OAAO,CACL,oCAAQ,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,aAC/D,YAAY,IAAI,mCAAQ,KAAK,EAAC,EAAE,YAAE,WAAW,GAAU,EACvD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACjB,mCAAmB,KAAK,EAAE,CAAC,CAAC,EAAE,YAC3B,CAAC,CAAC,IAAI,IADI,CAAC,CAAC,EAAE,CAER,CACV,CAAC,IACK,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StatuteEntry } from "@openlex/core";
|
|
2
|
+
export interface StatuteCardProps {
|
|
3
|
+
statute: StatuteEntry;
|
|
4
|
+
className?: string;
|
|
5
|
+
showProvisions?: boolean;
|
|
6
|
+
showMonetary?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function StatuteCard({ statute, className, showProvisions, showMonetary, }: StatuteCardProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=StatuteCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatuteCard.d.ts","sourceRoot":"","sources":["../../src/components/StatuteCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,SAAS,EACT,cAAqB,EACrB,YAAmB,GACpB,EAAE,gBAAgB,+BAoElB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatuteCard = StatuteCard;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function StatuteCard({ statute, className, showProvisions = true, showMonetary = true, }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [(0, jsx_runtime_1.jsx)("h3", { children: statute.title }), (0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)("strong", { children: statute.fullCitation }) }), statute.url && ((0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsx)("a", { href: statute.url, target: "_blank", rel: "noopener noreferrer", children: "Official Source" }) })), showProvisions && statute.keyProvisions.length > 0 && ((0, jsx_runtime_1.jsx)("ul", { children: statute.keyProvisions.map((p, i) => ((0, jsx_runtime_1.jsx)("li", { children: p }, i))) })), statute.penalties && ((0, jsx_runtime_1.jsxs)("p", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Penalties:" }), " ", statute.penalties] })), statute.exceptions && ((0, jsx_runtime_1.jsxs)("p", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Exceptions:" }), " ", statute.exceptions] })), showMonetary && statute.monetaryValues.length > 0 && ((0, jsx_runtime_1.jsxs)("table", { children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "Type" }), (0, jsx_runtime_1.jsx)("th", { children: "Amount" }), (0, jsx_runtime_1.jsx)("th", { children: "Description" })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: statute.monetaryValues.map((mv, i) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: mv.type }), (0, jsx_runtime_1.jsxs)("td", { children: [mv.unit.startsWith("usd") ? "$" : "", mv.amount, mv.unit === "usd-per-hour" ? "/hr" : ""] }), (0, jsx_runtime_1.jsx)("td", { children: mv.description })] }, i))) })] })), statute.effectiveDate && ((0, jsx_runtime_1.jsx)("p", { children: (0, jsx_runtime_1.jsxs)("small", { children: ["Effective: ", statute.effectiveDate] }) }))] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=StatuteCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatuteCard.js","sourceRoot":"","sources":["../../src/components/StatuteCard.tsx"],"names":[],"mappings":";;AASA,kCAyEC;;AAzED,SAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,SAAS,EACT,cAAc,GAAG,IAAI,EACrB,YAAY,GAAG,IAAI,GACF;IACjB,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,aACvB,yCAAK,OAAO,CAAC,KAAK,GAAM,EACxB,wCACE,6CAAS,OAAO,CAAC,YAAY,GAAU,GACrC,EAEH,OAAO,CAAC,GAAG,IAAI,CACd,wCACE,8BAAG,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,gCAE3D,GACF,CACL,EAEA,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CACrD,yCACG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,yCAAa,CAAC,IAAL,CAAC,CAAU,CACrB,CAAC,GACC,CACN,EAEA,OAAO,CAAC,SAAS,IAAI,CACpB,0CACE,4DAA2B,OAAE,OAAO,CAAC,SAAS,IAC5C,CACL,EAEA,OAAO,CAAC,UAAU,IAAI,CACrB,0CACE,6DAA4B,OAAE,OAAO,CAAC,UAAU,IAC9C,CACL,EAEA,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CACpD,8CACE,4CACE,2CACE,kDAAa,EACb,oDAAe,EACf,yDAAoB,IACjB,GACC,EACR,4CACG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CACrC,2CACE,yCAAK,EAAE,CAAC,IAAI,GAAM,EAClB,2CACG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EACpC,EAAE,CAAC,MAAM,EACT,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IACrC,EACL,yCAAK,EAAE,CAAC,WAAW,GAAM,KAPlB,CAAC,CAQL,CACN,CAAC,GACI,IACF,CACT,EAEA,OAAO,CAAC,aAAa,IAAI,CACxB,wCACE,6DAAmB,OAAO,CAAC,aAAa,IAAS,GAC/C,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComparisonMatrix } from "@openlex/core";
|
|
2
|
+
import { UseQueryResult } from "./useOpenLex";
|
|
3
|
+
/** Fetch a 50-state comparison matrix for a topic */
|
|
4
|
+
export declare function useCompare(topic: string, states?: string[]): UseQueryResult<ComparisonMatrix>;
|
|
5
|
+
//# sourceMappingURL=useCompare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompare.d.ts","sourceRoot":"","sources":["../../src/hooks/useCompare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAO9C,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAW7F"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCompare = useCompare;
|
|
4
|
+
const useFetch_1 = require("./useFetch");
|
|
5
|
+
/** Fetch a 50-state comparison matrix for a topic */
|
|
6
|
+
function useCompare(topic, states) {
|
|
7
|
+
const statesParam = states?.length ? `&states=${states.join(",")}` : "";
|
|
8
|
+
const path = `/compare?topic=${encodeURIComponent(topic)}${statesParam}`;
|
|
9
|
+
const result = (0, useFetch_1.useFetch)(path, !!topic);
|
|
10
|
+
return {
|
|
11
|
+
data: result.data?.matrix ?? null,
|
|
12
|
+
loading: result.loading,
|
|
13
|
+
error: result.error,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=useCompare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompare.js","sourceRoot":"","sources":["../../src/hooks/useCompare.ts"],"names":[],"mappings":";;AASA,gCAWC;AAlBD,yCAAsC;AAMtC,qDAAqD;AACrD,SAAgB,UAAU,CAAC,KAAa,EAAE,MAAiB;IACzD,MAAM,WAAW,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,IAAI,GAAG,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,GAAG,WAAW,EAAE,CAAC;IAEzE,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAkB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAExD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Court } from "@openlex/core";
|
|
2
|
+
import { UseQueryResult } from "./useOpenLex";
|
|
3
|
+
interface CourtsResponse {
|
|
4
|
+
state: string;
|
|
5
|
+
stateName: string;
|
|
6
|
+
hasIntermediateAppellate: boolean;
|
|
7
|
+
judicialDistricts: number | null;
|
|
8
|
+
notes: string[];
|
|
9
|
+
courts: Court[];
|
|
10
|
+
}
|
|
11
|
+
/** Fetch court hierarchy for a state */
|
|
12
|
+
export declare function useCourts(state: string): UseQueryResult<CourtsResponse>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useCourts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCourts.d.ts","sourceRoot":"","sources":["../../src/hooks/useCourts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoB,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,EAAE,OAAO,CAAC;IAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,wCAAwC;AACxC,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,cAAc,CAAC,CAGvE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCourts = useCourts;
|
|
4
|
+
const useFetch_1 = require("./useFetch");
|
|
5
|
+
/** Fetch court hierarchy for a state */
|
|
6
|
+
function useCourts(state) {
|
|
7
|
+
const path = `/courts/${encodeURIComponent(state)}`;
|
|
8
|
+
return (0, useFetch_1.useFetch)(path, !!state);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=useCourts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCourts.js","sourceRoot":"","sources":["../../src/hooks/useCourts.ts"],"names":[],"mappings":";;AAcA,8BAGC;AAfD,yCAAsC;AAWtC,wCAAwC;AACxC,SAAgB,SAAS,CAAC,KAAa;IACrC,MAAM,IAAI,GAAG,WAAW,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;IACpD,OAAO,IAAA,mBAAQ,EAAiB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetch.d.ts","sourceRoot":"","sources":["../../src/hooks/useFetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,qDAAqD;AACrD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,cAAc,CAAC,CAAC,CAAC,CA4C3E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFetch = useFetch;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenLex_1 = require("./useOpenLex");
|
|
6
|
+
/** Internal fetch hook — shared by all data hooks */
|
|
7
|
+
function useFetch(path, enabled = true) {
|
|
8
|
+
const { baseUrl } = (0, useOpenLex_1.useOpenLexConfig)();
|
|
9
|
+
const [data, setData] = (0, react_1.useState)(null);
|
|
10
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
11
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (!enabled || !path) {
|
|
14
|
+
setData(null);
|
|
15
|
+
setLoading(false);
|
|
16
|
+
setError(null);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
setLoading(true);
|
|
21
|
+
setError(null);
|
|
22
|
+
const url = `${baseUrl.replace(/\/$/, "")}${path}`;
|
|
23
|
+
fetch(url)
|
|
24
|
+
.then((res) => {
|
|
25
|
+
if (!res.ok)
|
|
26
|
+
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
27
|
+
return res.json();
|
|
28
|
+
})
|
|
29
|
+
.then((json) => {
|
|
30
|
+
if (!cancelled) {
|
|
31
|
+
setData(json);
|
|
32
|
+
setLoading(false);
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
.catch((err) => {
|
|
36
|
+
if (!cancelled) {
|
|
37
|
+
setError(err instanceof Error ? err.message : "Unknown error");
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return () => {
|
|
42
|
+
cancelled = true;
|
|
43
|
+
};
|
|
44
|
+
}, [baseUrl, path, enabled]);
|
|
45
|
+
return { data, loading, error };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=useFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetch.js","sourceRoot":"","sources":["../../src/hooks/useFetch.ts"],"names":[],"mappings":";;AAIA,4BA4CC;AAhDD,iCAA4C;AAC5C,6CAAgE;AAEhE,qDAAqD;AACrD,SAAgB,QAAQ,CAAI,IAAY,EAAE,OAAO,GAAG,IAAI;IACtD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAgB,GAAE,CAAC;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAW,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,E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AO,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface OpenLexConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function OpenLexProvider({ baseUrl, children, }: {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function useOpenLexConfig(): OpenLexConfig;
|
|
10
|
+
/** Generic query result shape for all hooks */
|
|
11
|
+
export interface UseQueryResult<T> {
|
|
12
|
+
data: T | null;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: string | null;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=useOpenLex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenLex.d.ts","sourceRoot":"","sources":["../../src/hooks/useOpenLex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAMA;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD;AAED,+CAA+C;AAC/C,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenLexProvider = OpenLexProvider;
|
|
4
|
+
exports.useOpenLexConfig = useOpenLexConfig;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const OpenLexContext = (0, react_1.createContext)(null);
|
|
8
|
+
function OpenLexProvider({ baseUrl, children, }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(OpenLexContext.Provider, { value: { baseUrl }, children: children }));
|
|
10
|
+
}
|
|
11
|
+
function useOpenLexConfig() {
|
|
12
|
+
const ctx = (0, react_1.useContext)(OpenLexContext);
|
|
13
|
+
if (!ctx) {
|
|
14
|
+
throw new Error("useOpenLexConfig must be used within an <OpenLexProvider>");
|
|
15
|
+
}
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useOpenLex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenLex.js","sourceRoot":"","sources":["../../src/hooks/useOpenLex.tsx"],"names":[],"mappings":";;AAQA,0CAYC;AAED,4CAMC;;AA5BD,iCAA6D;AAM7D,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAuB,IAAI,CAAC,CAAC;AAEjE,SAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,QAAQ,GAIT;IACC,OAAO,CACL,uBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,YACxC,QAAQ,GACe,CAC3B,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB;IAC9B,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PreemptionRule } from "@openlex/core";
|
|
2
|
+
import { UseQueryResult } from "./useOpenLex";
|
|
3
|
+
interface PreemptionResponse {
|
|
4
|
+
topic: string;
|
|
5
|
+
state: string | null;
|
|
6
|
+
count: number;
|
|
7
|
+
summary?: string;
|
|
8
|
+
rules: PreemptionRule[];
|
|
9
|
+
}
|
|
10
|
+
/** Fetch preemption rules for a topic and optional state */
|
|
11
|
+
export declare function usePreemption(topic: string, state?: string): UseQueryResult<PreemptionResponse>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=usePreemption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreemption.d.ts","sourceRoot":"","sources":["../../src/hooks/usePreemption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAI/F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePreemption = usePreemption;
|
|
4
|
+
const useFetch_1 = require("./useFetch");
|
|
5
|
+
/** Fetch preemption rules for a topic and optional state */
|
|
6
|
+
function usePreemption(topic, state) {
|
|
7
|
+
const stateParam = state ? `?state=${encodeURIComponent(state)}` : "";
|
|
8
|
+
const path = `/preemption/${encodeURIComponent(topic)}${stateParam}`;
|
|
9
|
+
return (0, useFetch_1.useFetch)(path, !!topic);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=usePreemption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreemption.js","sourceRoot":"","sources":["../../src/hooks/usePreemption.ts"],"names":[],"mappings":";;AAaA,sCAIC;AAfD,yCAAsC;AAUtC,4DAA4D;AAC5D,SAAgB,aAAa,CAAC,KAAa,EAAE,KAAc;IACzD,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,IAAI,GAAG,eAAe,kBAAkB,CAAC,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC;IACrE,OAAO,IAAA,mBAAQ,EAAqB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryResult } from "./useOpenLex";
|
|
2
|
+
export interface SearchResult {
|
|
3
|
+
id: string;
|
|
4
|
+
score: number;
|
|
5
|
+
text: string;
|
|
6
|
+
metadata: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
/** Debounced full-text search across statutes and regulations */
|
|
9
|
+
export declare function useSearch(query: string, debounceMs?: number): UseQueryResult<SearchResult[]>;
|
|
10
|
+
//# sourceMappingURL=useSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearch.d.ts","sourceRoot":"","sources":["../../src/hooks/useSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoB,MAAM,cAAc,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAQD,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,SAAM,GAAG,cAAc,CAAC,YAAY,EAAE,CAAC,CA8CzF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearch = useSearch;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenLex_1 = require("./useOpenLex");
|
|
6
|
+
/** Debounced full-text search across statutes and regulations */
|
|
7
|
+
function useSearch(query, debounceMs = 300) {
|
|
8
|
+
const { baseUrl } = (0, useOpenLex_1.useOpenLexConfig)();
|
|
9
|
+
const [data, setData] = (0, react_1.useState)(null);
|
|
10
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
11
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (!query || query.length < 2) {
|
|
14
|
+
setData(null);
|
|
15
|
+
setLoading(false);
|
|
16
|
+
setError(null);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
const timer = setTimeout(() => {
|
|
21
|
+
setLoading(true);
|
|
22
|
+
setError(null);
|
|
23
|
+
const url = `${baseUrl.replace(/\/$/, "")}/search?q=${encodeURIComponent(query)}`;
|
|
24
|
+
fetch(url)
|
|
25
|
+
.then((res) => {
|
|
26
|
+
if (!res.ok)
|
|
27
|
+
throw new Error(`HTTP ${res.status}`);
|
|
28
|
+
return res.json();
|
|
29
|
+
})
|
|
30
|
+
.then((json) => {
|
|
31
|
+
if (!cancelled) {
|
|
32
|
+
setData(json.results);
|
|
33
|
+
setLoading(false);
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
if (!cancelled) {
|
|
38
|
+
setError(err instanceof Error ? err.message : "Unknown error");
|
|
39
|
+
setLoading(false);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}, debounceMs);
|
|
43
|
+
return () => {
|
|
44
|
+
cancelled = true;
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
};
|
|
47
|
+
}, [baseUrl, query, debounceMs]);
|
|
48
|
+
return { data, loading, error };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearch.js","sourceRoot":"","sources":["../../src/hooks/useSearch.ts"],"names":[],"mappings":";;AAiBA,8BA8CC;AA/DD,iCAA4C;AAC5C,6CAAgE;AAehE,iEAAiE;AACjE,SAAgB,SAAS,CAAC,KAAa,EAAE,UAAU,GAAG,GAAG;IACvD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAgB,GAAE,CAAC;IACvC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAwB,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;YACd,UAAU,CAAC,KAAK,CAAC,CAAC;YAClB,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEf,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAClF,KAAK,CAAC,GAAG,CAAC;iBACP,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,IAAI,CAAC,GAAG,CAAC,EAAE;oBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;gBACnD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;YACpB,CAAC,CAAC;iBACD,IAAI,CAAC,CAAC,IAAoB,EAAE,EAAE;gBAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACtB,UAAU,CAAC,KAAK,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,QAAQ,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;oBAC/D,UAAU,CAAC,KAAK,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,EAAE,UAAU,CAAC,CAAC;QAEf,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StatuteEntry } from "@openlex/core";
|
|
2
|
+
import { UseQueryResult } from "./useOpenLex";
|
|
3
|
+
/** Fetch statutes for a topic and optional state */
|
|
4
|
+
export declare function useStatutes(topic: string, state?: string): UseQueryResult<StatuteEntry[]>;
|
|
5
|
+
//# sourceMappingURL=useStatutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStatutes.d.ts","sourceRoot":"","sources":["../../src/hooks/useStatutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAS9C,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,YAAY,EAAE,CAAC,CAYzF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStatutes = useStatutes;
|
|
4
|
+
const useFetch_1 = require("./useFetch");
|
|
5
|
+
/** Fetch statutes for a topic and optional state */
|
|
6
|
+
function useStatutes(topic, state) {
|
|
7
|
+
const path = state
|
|
8
|
+
? `/statutes/${encodeURIComponent(state)}/${encodeURIComponent(topic)}`
|
|
9
|
+
: `/statutes/${encodeURIComponent(topic)}`;
|
|
10
|
+
const result = (0, useFetch_1.useFetch)(path, !!topic);
|
|
11
|
+
return {
|
|
12
|
+
data: result.data?.statutes ?? null,
|
|
13
|
+
loading: result.loading,
|
|
14
|
+
error: result.error,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useStatutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStatutes.js","sourceRoot":"","sources":["../../src/hooks/useStatutes.ts"],"names":[],"mappings":";;AAWA,kCAYC;AArBD,yCAAsC;AAQtC,oDAAoD;AACpD,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAc;IACvD,MAAM,IAAI,GAAG,KAAK;QAChB,CAAC,CAAC,aAAa,kBAAkB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE;QACvE,CAAC,CAAC,aAAa,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;IAE7C,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAmB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,IAAI,IAAI;QACnC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { OpenLexProvider } from "./hooks/useOpenLex";
|
|
2
|
+
export type { OpenLexConfig, UseQueryResult } from "./hooks/useOpenLex";
|
|
3
|
+
export { useStatutes } from "./hooks/useStatutes";
|
|
4
|
+
export { useCompare } from "./hooks/useCompare";
|
|
5
|
+
export { useCourts } from "./hooks/useCourts";
|
|
6
|
+
export { useSearch } from "./hooks/useSearch";
|
|
7
|
+
export type { SearchResult } from "./hooks/useSearch";
|
|
8
|
+
export { usePreemption } from "./hooks/usePreemption";
|
|
9
|
+
export { JurisdictionPicker } from "./components/JurisdictionPicker";
|
|
10
|
+
export type { JurisdictionPickerProps } from "./components/JurisdictionPicker";
|
|
11
|
+
export { StatuteCard } from "./components/StatuteCard";
|
|
12
|
+
export type { StatuteCardProps } from "./components/StatuteCard";
|
|
13
|
+
export { ComparisonTable } from "./components/ComparisonTable";
|
|
14
|
+
export type { ComparisonTableProps } from "./components/ComparisonTable";
|
|
15
|
+
export { CourtHierarchy } from "./components/CourtHierarchy";
|
|
16
|
+
export type { CourtHierarchyProps } from "./components/CourtHierarchy";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourtHierarchy = exports.ComparisonTable = exports.StatuteCard = exports.JurisdictionPicker = exports.usePreemption = exports.useSearch = exports.useCourts = exports.useCompare = exports.useStatutes = exports.OpenLexProvider = void 0;
|
|
4
|
+
// Provider
|
|
5
|
+
var useOpenLex_1 = require("./hooks/useOpenLex");
|
|
6
|
+
Object.defineProperty(exports, "OpenLexProvider", { enumerable: true, get: function () { return useOpenLex_1.OpenLexProvider; } });
|
|
7
|
+
// Hooks
|
|
8
|
+
var useStatutes_1 = require("./hooks/useStatutes");
|
|
9
|
+
Object.defineProperty(exports, "useStatutes", { enumerable: true, get: function () { return useStatutes_1.useStatutes; } });
|
|
10
|
+
var useCompare_1 = require("./hooks/useCompare");
|
|
11
|
+
Object.defineProperty(exports, "useCompare", { enumerable: true, get: function () { return useCompare_1.useCompare; } });
|
|
12
|
+
var useCourts_1 = require("./hooks/useCourts");
|
|
13
|
+
Object.defineProperty(exports, "useCourts", { enumerable: true, get: function () { return useCourts_1.useCourts; } });
|
|
14
|
+
var useSearch_1 = require("./hooks/useSearch");
|
|
15
|
+
Object.defineProperty(exports, "useSearch", { enumerable: true, get: function () { return useSearch_1.useSearch; } });
|
|
16
|
+
var usePreemption_1 = require("./hooks/usePreemption");
|
|
17
|
+
Object.defineProperty(exports, "usePreemption", { enumerable: true, get: function () { return usePreemption_1.usePreemption; } });
|
|
18
|
+
// Components
|
|
19
|
+
var JurisdictionPicker_1 = require("./components/JurisdictionPicker");
|
|
20
|
+
Object.defineProperty(exports, "JurisdictionPicker", { enumerable: true, get: function () { return JurisdictionPicker_1.JurisdictionPicker; } });
|
|
21
|
+
var StatuteCard_1 = require("./components/StatuteCard");
|
|
22
|
+
Object.defineProperty(exports, "StatuteCard", { enumerable: true, get: function () { return StatuteCard_1.StatuteCard; } });
|
|
23
|
+
var ComparisonTable_1 = require("./components/ComparisonTable");
|
|
24
|
+
Object.defineProperty(exports, "ComparisonTable", { enumerable: true, get: function () { return ComparisonTable_1.ComparisonTable; } });
|
|
25
|
+
var CourtHierarchy_1 = require("./components/CourtHierarchy");
|
|
26
|
+
Object.defineProperty(exports, "CourtHierarchy", { enumerable: true, get: function () { return CourtHierarchy_1.CourtHierarchy; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,WAAW;AACX,iDAAqD;AAA5C,6GAAA,eAAe,OAAA;AAGxB,QAAQ;AACR,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AACnB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAClB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,aAAa;AACb,sEAAqE;AAA5D,wHAAA,kBAAkB,OAAA;AAE3B,wDAAuD;AAA9C,0GAAA,WAAW,OAAA;AAEpB,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AAExB,8DAA6D;AAApD,gHAAA,cAAc,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openlex/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React hooks and components for the OpenLex jurisdiction mapping engine.",
|
|
5
|
+
"author": "Ahmed Allem",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/kingofmit/openlex.git",
|
|
10
|
+
"directory": "packages/react"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/kingofmit/openlex",
|
|
13
|
+
"bugs": "https://github.com/kingofmit/openlex/issues",
|
|
14
|
+
"keywords": ["legal", "law", "statutes", "jurisdiction", "united-states", "openlex", "react", "hooks", "components", "ui"],
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"dev": "tsc --watch",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"lint": "tsc --noEmit",
|
|
31
|
+
"prepublishOnly": "pnpm run build"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@openlex/core": "workspace:*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.8.0",
|
|
41
|
+
"@types/react": "^19.0.0",
|
|
42
|
+
"react": "^19.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|