@openpkg-ts/ui 0.5.0 → 0.5.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/dist/docskit/index.d.ts +10 -10
- package/dist/docskit/index.js +19 -46
- package/package.json +1 -1
package/dist/docskit/index.d.ts
CHANGED
|
@@ -288,8 +288,9 @@ interface NestedParameterContainerProps {
|
|
|
288
288
|
className?: string;
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
|
-
* Bordered container for nested child parameters (
|
|
292
|
-
* Connects to NestedParameterToggle above
|
|
291
|
+
* Bordered container for nested child parameters (Scalar/Clerk-style).
|
|
292
|
+
* Connects to NestedParameterToggle above — shares the same border,
|
|
293
|
+
* so this has no top border and only bottom-rounded corners.
|
|
293
294
|
*/
|
|
294
295
|
declare function NestedParameterContainer({ children, level, className }: NestedParameterContainerProps): ReactNode10;
|
|
295
296
|
import { ReactNode as ReactNode11 } from "react";
|
|
@@ -298,16 +299,15 @@ interface NestedParameterToggleProps {
|
|
|
298
299
|
expanded: boolean;
|
|
299
300
|
/** Toggle callback */
|
|
300
301
|
onToggle: () => void;
|
|
301
|
-
/** Optional child count to display */
|
|
302
|
-
count?: number;
|
|
303
302
|
/** Custom className */
|
|
304
303
|
className?: string;
|
|
305
304
|
}
|
|
306
305
|
/**
|
|
307
|
-
* "Show/Hide
|
|
308
|
-
*
|
|
306
|
+
* "Show/Hide Child Attributes" toggle button (Scalar/Clerk-style).
|
|
307
|
+
* When collapsed: standalone rounded pill.
|
|
308
|
+
* When expanded: top of a unified bordered container (rounded-t, no bottom border).
|
|
309
309
|
*/
|
|
310
|
-
declare function NestedParameterToggle({ expanded, onToggle,
|
|
310
|
+
declare function NestedParameterToggle({ expanded, onToggle, className }: NestedParameterToggleProps): ReactNode11;
|
|
311
311
|
import { ReactNode as ReactNode12 } from "react";
|
|
312
312
|
interface APIParameterSchema {
|
|
313
313
|
/** Type name */
|
|
@@ -346,10 +346,10 @@ interface APIParameterItemProps {
|
|
|
346
346
|
className?: string;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
|
-
* Single parameter row
|
|
350
|
-
* Displays name, type,
|
|
349
|
+
* Single parameter row (Scalar/Clerk-style).
|
|
350
|
+
* Displays name, type, required badge (orange text), description, and optional nested content.
|
|
351
351
|
*/
|
|
352
|
-
declare function APIParameterItem({ name, parentPath, type, required, optional,
|
|
352
|
+
declare function APIParameterItem({ name, parentPath, type, required, optional, description, children, anchorId, className }: APIParameterItemProps): ReactNode12;
|
|
353
353
|
import * as React8 from "react";
|
|
354
354
|
interface ParameterListProps {
|
|
355
355
|
/** Title above the list (e.g., "Body parameters") */
|
package/dist/docskit/index.js
CHANGED
|
@@ -1814,7 +1814,6 @@ import { formatSchema } from "@openpkg-ts/sdk/browser";
|
|
|
1814
1814
|
import { useState as useState10 } from "react";
|
|
1815
1815
|
|
|
1816
1816
|
// src/docskit/api/parameter-item.tsx
|
|
1817
|
-
import { Link } from "lucide-react";
|
|
1818
1817
|
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1819
1818
|
|
|
1820
1819
|
function APIParameterItem({
|
|
@@ -1823,35 +1822,18 @@ function APIParameterItem({
|
|
|
1823
1822
|
type,
|
|
1824
1823
|
required,
|
|
1825
1824
|
optional,
|
|
1826
|
-
expandable: expandable2,
|
|
1827
1825
|
description,
|
|
1828
1826
|
children,
|
|
1829
1827
|
anchorId,
|
|
1830
|
-
showAnchor = false,
|
|
1831
1828
|
className
|
|
1832
1829
|
}) {
|
|
1833
|
-
const handleAnchorClick = () => {
|
|
1834
|
-
if (anchorId && typeof window !== "undefined") {
|
|
1835
|
-
window.location.hash = anchorId;
|
|
1836
|
-
navigator.clipboard?.writeText(window.location.href);
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
1830
|
return /* @__PURE__ */ jsxs19("div", {
|
|
1840
1831
|
id: anchorId,
|
|
1841
1832
|
className: cn("openpkg-param", "py-5 border-b border-[var(--openpkg-border-subtle)]", "last:border-b-0", className),
|
|
1842
1833
|
children: [
|
|
1843
1834
|
/* @__PURE__ */ jsxs19("div", {
|
|
1844
|
-
className: "openpkg-param-header flex items-
|
|
1835
|
+
className: "openpkg-param-header flex items-baseline gap-2 mb-1 flex-wrap",
|
|
1845
1836
|
children: [
|
|
1846
|
-
showAnchor && /* @__PURE__ */ jsx36("button", {
|
|
1847
|
-
type: "button",
|
|
1848
|
-
onClick: handleAnchorClick,
|
|
1849
|
-
className: cn("openpkg-anchor-link", "flex items-center justify-center w-4 h-4", "opacity-0 group-hover:opacity-100 hover:opacity-100", "text-[var(--openpkg-text-muted)]", "hover:text-[var(--openpkg-accent-blue)]", "cursor-pointer transition-opacity"),
|
|
1850
|
-
"aria-label": "Copy link",
|
|
1851
|
-
children: /* @__PURE__ */ jsx36(Link, {
|
|
1852
|
-
size: 14
|
|
1853
|
-
})
|
|
1854
|
-
}),
|
|
1855
1837
|
/* @__PURE__ */ jsxs19("span", {
|
|
1856
1838
|
className: "openpkg-param-name font-mono text-sm font-semibold",
|
|
1857
1839
|
children: [
|
|
@@ -1865,21 +1847,17 @@ function APIParameterItem({
|
|
|
1865
1847
|
})
|
|
1866
1848
|
]
|
|
1867
1849
|
}),
|
|
1868
|
-
required && /* @__PURE__ */ jsx36("span", {
|
|
1869
|
-
className: cn("openpkg-param-badge", "text-[11px] font-medium uppercase tracking-wide", "px-2 py-0.5 rounded", "bg-[var(--openpkg-bg-badge)]", "text-[var(--openpkg-text-muted)]"),
|
|
1870
|
-
children: "Required"
|
|
1871
|
-
}),
|
|
1872
|
-
optional && /* @__PURE__ */ jsx36("span", {
|
|
1873
|
-
className: cn("openpkg-param-badge", "text-[11px] font-medium uppercase tracking-wide", "px-2 py-0.5 rounded", "bg-[var(--openpkg-bg-badge)]", "text-[var(--openpkg-text-muted)]"),
|
|
1874
|
-
children: "Optional"
|
|
1875
|
-
}),
|
|
1876
|
-
expandable2 && /* @__PURE__ */ jsx36("span", {
|
|
1877
|
-
className: cn("openpkg-badge-expandable", "text-[10px] font-medium", "px-2 py-0.5 rounded", "text-[var(--openpkg-accent-purple)]", "bg-[color-mix(in_srgb,var(--openpkg-accent-purple)_12%,transparent)]"),
|
|
1878
|
-
children: "Expandable"
|
|
1879
|
-
}),
|
|
1880
1850
|
/* @__PURE__ */ jsx36("span", {
|
|
1881
1851
|
className: "openpkg-param-type text-[13px] text-[var(--openpkg-text-muted)]",
|
|
1882
1852
|
children: type
|
|
1853
|
+
}),
|
|
1854
|
+
required && /* @__PURE__ */ jsx36("span", {
|
|
1855
|
+
className: "openpkg-param-badge text-[13px] font-medium text-[var(--openpkg-accent-orange,#d4a553)]",
|
|
1856
|
+
children: "required"
|
|
1857
|
+
}),
|
|
1858
|
+
optional && /* @__PURE__ */ jsx36("span", {
|
|
1859
|
+
className: "openpkg-param-badge text-[13px] text-[var(--openpkg-text-muted)]",
|
|
1860
|
+
children: "optional"
|
|
1883
1861
|
})
|
|
1884
1862
|
]
|
|
1885
1863
|
}),
|
|
@@ -1901,37 +1879,34 @@ function NestedParameterContainer({
|
|
|
1901
1879
|
className
|
|
1902
1880
|
}) {
|
|
1903
1881
|
return /* @__PURE__ */ jsx37("div", {
|
|
1904
|
-
className: cn("openpkg-nested-container", "border border-t-0
|
|
1882
|
+
className: cn("openpkg-nested-container", "border border-t-0 border-[var(--openpkg-border-medium)]", "rounded-b-lg", "px-5", "[&>.openpkg-expandable-param]:py-4", "[&>.openpkg-expandable-param]:border-b", "[&>.openpkg-expandable-param]:border-[var(--openpkg-border-subtle)]", "[&>.openpkg-expandable-param:last-child]:border-b-0", "[&>.openpkg-expandable-param:last-child]:pb-4", "[&>.openpkg-expandable-param_.openpkg-param]:py-0", "[&>.openpkg-expandable-param_.openpkg-param]:border-b-0", className),
|
|
1905
1883
|
"data-level": level,
|
|
1906
1884
|
children
|
|
1907
1885
|
});
|
|
1908
1886
|
}
|
|
1909
1887
|
|
|
1910
1888
|
// src/docskit/api/nested-parameter-toggle.tsx
|
|
1911
|
-
import { Plus } from "lucide-react";
|
|
1912
1889
|
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1913
1890
|
|
|
1914
1891
|
function NestedParameterToggle({
|
|
1915
1892
|
expanded,
|
|
1916
1893
|
onToggle,
|
|
1917
|
-
count,
|
|
1918
1894
|
className
|
|
1919
1895
|
}) {
|
|
1920
1896
|
return /* @__PURE__ */ jsxs20("button", {
|
|
1921
1897
|
type: "button",
|
|
1922
1898
|
onClick: onToggle,
|
|
1923
|
-
className: cn("openpkg-nested-toggle", "
|
|
1899
|
+
className: cn("openpkg-nested-toggle", "flex items-center gap-2 w-full", "font-sans text-[13px] font-medium", "text-[var(--openpkg-text-secondary)]", "bg-transparent", "border border-[var(--openpkg-border-medium)]", "px-4 py-3", "cursor-pointer", "transition-all duration-150", "hover:text-[var(--openpkg-text-primary)]", expanded ? "rounded-t-lg rounded-b-none border-b-[var(--openpkg-border-subtle)]" : "rounded-lg", className),
|
|
1924
1900
|
"aria-expanded": expanded,
|
|
1925
1901
|
children: [
|
|
1926
|
-
/* @__PURE__ */ jsx38(
|
|
1927
|
-
|
|
1928
|
-
|
|
1902
|
+
/* @__PURE__ */ jsx38("span", {
|
|
1903
|
+
className: "text-[13px]",
|
|
1904
|
+
children: expanded ? "×" : "+"
|
|
1929
1905
|
}),
|
|
1930
1906
|
/* @__PURE__ */ jsxs20("span", {
|
|
1931
1907
|
children: [
|
|
1932
1908
|
expanded ? "Hide" : "Show",
|
|
1933
|
-
"
|
|
1934
|
-
count !== undefined && ` (${count})`
|
|
1909
|
+
" Child Attributes"
|
|
1935
1910
|
]
|
|
1936
1911
|
})
|
|
1937
1912
|
]
|
|
@@ -1939,7 +1914,7 @@ function NestedParameterToggle({
|
|
|
1939
1914
|
}
|
|
1940
1915
|
|
|
1941
1916
|
// src/docskit/api/expandable-parameter.tsx
|
|
1942
|
-
import { jsx as jsx39, jsxs as jsxs21
|
|
1917
|
+
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1943
1918
|
|
|
1944
1919
|
function ExpandableParameter({
|
|
1945
1920
|
parameter,
|
|
@@ -1971,20 +1946,18 @@ function ExpandableParameter({
|
|
|
1971
1946
|
parentPath,
|
|
1972
1947
|
type: hasChildren ? "object" : type,
|
|
1973
1948
|
required: isRequired,
|
|
1974
|
-
expandable: hasChildren,
|
|
1975
1949
|
description: parameter.description,
|
|
1976
1950
|
anchorId: parentPath ? `${parentPath}${parameter.name}` : parameter.name,
|
|
1977
|
-
showAnchor: level > 0,
|
|
1978
1951
|
children: [
|
|
1979
1952
|
enumValues.length > 0 && !nestedParams.length && /* @__PURE__ */ jsx39(EnumValuesSection, {
|
|
1980
1953
|
values: enumValues
|
|
1981
1954
|
}),
|
|
1982
|
-
nestedParams.length > 0 && /* @__PURE__ */ jsxs21(
|
|
1955
|
+
nestedParams.length > 0 && /* @__PURE__ */ jsxs21("div", {
|
|
1956
|
+
className: "mt-3 mb-1",
|
|
1983
1957
|
children: [
|
|
1984
1958
|
/* @__PURE__ */ jsx39(NestedParameterToggle, {
|
|
1985
1959
|
expanded,
|
|
1986
|
-
onToggle: handleToggle
|
|
1987
|
-
count: nestedParams.length
|
|
1960
|
+
onToggle: handleToggle
|
|
1988
1961
|
}),
|
|
1989
1962
|
expanded && /* @__PURE__ */ jsx39(NestedParameterContainer, {
|
|
1990
1963
|
level,
|