@stainless-api/docs-ui 0.1.0-beta.55 → 0.1.0-beta.57

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 (114) hide show
  1. package/dist/{breadcrumbs-DbMfWbzf.d.ts → breadcrumbs-BFCcsaL5.d.ts} +2 -2
  2. package/dist/{breadcrumbs-DgN-xdoA.js → breadcrumbs-CCViAnPI.js} +2 -2
  3. package/dist/breadcrumbs-DTHE6aca.d.ts +25 -0
  4. package/dist/{component-CjLDkCLe.js → component-2IFa97aV.js} +2 -2
  5. package/dist/{component-generics-jEHMmsET.d.ts → component-generics-CXfH4VNh.d.ts} +2 -2
  6. package/dist/component-generics-Dbwqv7EL.d.ts +30 -0
  7. package/dist/components/MaskedInput.d.ts +3 -3
  8. package/dist/components/MaskedInput.js +1 -1
  9. package/dist/components/breadcrumbs.d.ts +1 -1
  10. package/dist/components/breadcrumbs.js +2 -2
  11. package/dist/components/icons.d.ts +11 -11
  12. package/dist/components/index.d.ts +10 -10
  13. package/dist/components/index.js +10 -10
  14. package/dist/components/method.d.ts +2 -2
  15. package/dist/components/method.js +3 -3
  16. package/dist/components/overview.d.ts +1 -1
  17. package/dist/components/overview.js +3 -3
  18. package/dist/components/primitives.d.ts +1 -1
  19. package/dist/components/primitives.js +1 -1
  20. package/dist/components/properties.d.ts +1 -1
  21. package/dist/components/properties.js +1 -1
  22. package/dist/components/sdk.d.ts +1 -1
  23. package/dist/components/sdk.js +1 -1
  24. package/dist/components/sidebar.d.ts +1 -1
  25. package/dist/components/sidebar.js +1 -3
  26. package/dist/components/snippets.d.ts +2 -2
  27. package/dist/components/snippets.js +1 -1
  28. package/dist/{components-oq97SH1A.js → components-B6opXKh2.js} +8 -11
  29. package/dist/contexts/component-generics.d.ts +1 -1
  30. package/dist/contexts/component-types.d.ts +10 -10
  31. package/dist/contexts/component.d.ts +13 -13
  32. package/dist/contexts/component.js +18 -18
  33. package/dist/contexts/docs.d.ts +1 -1
  34. package/dist/contexts/index.d.ts +14 -14
  35. package/dist/contexts/markdown.d.ts +1 -1
  36. package/dist/contexts/navigation.d.ts +1 -1
  37. package/dist/contexts/use-components.d.ts +9 -9
  38. package/dist/{csharp-E3FbT47c.js → csharp-Cs2V5Q49.js} +1 -1
  39. package/dist/{docs-B8ujUobE.d.ts → docs-AUJrRqst.d.ts} +2 -2
  40. package/dist/docs-BQbH-a6R.d.ts +47 -0
  41. package/dist/{go-DNSFGJle.js → go-jtKybF5f.js} +1 -1
  42. package/dist/{http-DXRdcllM.js → http-ByTnZCdl.js} +3 -3
  43. package/dist/{index-DJSj_TkD.d.ts → index-Bk5AWxiZ.d.ts} +30 -30
  44. package/dist/index-CBfCrZxK.d.ts +15 -0
  45. package/dist/index-CxTvYsqI.d.ts +15 -0
  46. package/dist/index-DUvl24AZ.d.ts +274 -0
  47. package/dist/index.d.ts +15 -15
  48. package/dist/index.js +18 -18
  49. package/dist/{java-X1yS0K52.js → java-CSfLt_jp.js} +1 -1
  50. package/dist/languages/csharp.d.ts +10 -10
  51. package/dist/languages/csharp.js +1 -1
  52. package/dist/languages/go.d.ts +10 -10
  53. package/dist/languages/go.js +1 -1
  54. package/dist/languages/http.d.ts +10 -10
  55. package/dist/languages/http.js +10 -10
  56. package/dist/languages/index.d.ts +10 -10
  57. package/dist/languages/index.js +17 -17
  58. package/dist/languages/java.d.ts +10 -10
  59. package/dist/languages/java.js +1 -1
  60. package/dist/languages/python.d.ts +10 -10
  61. package/dist/languages/python.js +1 -1
  62. package/dist/languages/ruby.d.ts +10 -10
  63. package/dist/languages/ruby.js +1 -1
  64. package/dist/languages/typescript.d.ts +10 -10
  65. package/dist/languages/typescript.js +1 -1
  66. package/dist/{languages-Ir9QQoCT.js → languages-X8bJZjuW.js} +7 -7
  67. package/dist/markdown/index.d.ts +1 -1
  68. package/dist/markdown/index.js +18 -18
  69. package/dist/markdown/printer.d.ts +1 -1
  70. package/dist/markdown/printer.js +19 -19
  71. package/dist/markdown/utils.d.ts +2 -2
  72. package/dist/{markdown-BeBRJqrt.d.ts → markdown-CqEZJJrZ.d.ts} +2 -2
  73. package/dist/markdown-V_bNKjle.d.ts +22 -0
  74. package/dist/{method-nEcioXL5.js → method-BPsNdtwS.js} +10 -35
  75. package/dist/method-CD_dwBsB.d.ts +59 -0
  76. package/dist/method-CkGKALRi.d.ts +59 -0
  77. package/dist/{navigation-ULXC5uFs.d.ts → navigation-BlOvTCTX.d.ts} +2 -2
  78. package/dist/navigation-CXQA2RZo.d.ts +29 -0
  79. package/dist/{overview-BQk6WvtS.js → overview-BslKVsRE.js} +3 -3
  80. package/dist/{overview-5f2psBcl.d.ts → overview-CVTaIlP6.d.ts} +6 -6
  81. package/dist/overview-DFrenwhf.d.ts +39 -0
  82. package/dist/{primitives-1WQd5NT-.js → primitives-CCj2Pn-o.js} +25 -33
  83. package/dist/primitives-Da9sUCQo.d.ts +104 -0
  84. package/dist/primitives-DiDzLHoK.d.ts +104 -0
  85. package/dist/{properties-Clv76Ne3.d.ts → properties-CEjSSMRr.d.ts} +5 -5
  86. package/dist/properties-CXDSYNGL.d.ts +54 -0
  87. package/dist/{properties-BTdEzx5f.js → properties-DhttBLpf.js} +1 -1
  88. package/dist/{python-DqdvqQ9I.js → python-BU7eaJMy.js} +1 -1
  89. package/dist/routing.d.ts +1 -1
  90. package/dist/{ruby-CHeld1ey.js → ruby-LiJ6VW-R.js} +1 -1
  91. package/dist/{sdk-DT9NI4cv.d.ts → sdk-CL6r5JlK.d.ts} +13 -13
  92. package/dist/{sdk-DEoUlY8I.js → sdk-CbNqFzOI.js} +2 -2
  93. package/dist/sdk-CenwRRXT.d.ts +118 -0
  94. package/dist/{sidebar-M9RnjNtV.d.ts → sidebar-BDwx6h14.d.ts} +5 -5
  95. package/dist/sidebar-CcX4PdH0.d.ts +36 -0
  96. package/dist/{sidebar-D_cK7JN_.js → sidebar-ZNWRDHyv.js} +7 -3
  97. package/dist/{snippets-BiXJx1BL.js → snippets-CO4kIovz.js} +6 -5
  98. package/dist/{snippets-swUWTk4z.d.ts → snippets-DePfv2T6.d.ts} +8 -8
  99. package/dist/snippets-ykHHsG1B.d.ts +51 -0
  100. package/dist/spec.d.ts +3 -3
  101. package/dist/{style-cJZFOvnF.js → style-Vk87Pfuy.js} +0 -2
  102. package/dist/style.d.ts +0 -2
  103. package/dist/style.js +1 -1
  104. package/dist/styles/main.css +1 -26
  105. package/dist/styles/primitives.css +5 -4
  106. package/dist/styles/resets.css +1 -1
  107. package/dist/styles/search.css +32 -30
  108. package/dist/styles/sidebar.css +0 -4
  109. package/dist/styles.css +190 -66
  110. package/dist/{typescript-C--P_L-R.js → typescript-C8J1uyak.js} +1 -1
  111. package/package.json +2 -2
  112. package/dist/index-DhAIZ735.d.ts +0 -15
  113. package/dist/method-cLcsCc31.d.ts +0 -71
  114. package/dist/primitives-BBa2vKex.d.ts +0 -97
@@ -1,39 +1,12 @@
1
1
  import { t as useComponents } from "./use-components-DBx5LZk0.js";
2
- import { t as style_default } from "./style-cJZFOvnF.js";
3
- import { i as PropertyToggle } from "./properties-BTdEzx5f.js";
4
- import * as React$1 from "react";
2
+ import { t as style_default } from "./style-Vk87Pfuy.js";
3
+ import { i as PropertyToggle } from "./properties-DhttBLpf.js";
4
+ import "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
- import { ArrowDownLeft, ArrowUpRight, X } from "lucide-react";
7
6
  import clsx from "clsx";
7
+ import { Badge, getHttpMethod } from "@stainless-api/ui-primitives";
8
8
 
9
9
  //#region src/components/method.tsx
10
- const HttpMethods = [
11
- "get",
12
- "head",
13
- "put",
14
- "delete",
15
- "post",
16
- "patch"
17
- ];
18
- const HttpMethodIcons = {
19
- get: ArrowDownLeft,
20
- put: ArrowUpRight,
21
- post: ArrowUpRight,
22
- patch: ArrowUpRight,
23
- delete: X
24
- };
25
- function MethodIconBadge({ httpMethod, showName }) {
26
- if (!httpMethod || !HttpMethods.includes(httpMethod)) return null;
27
- return /* @__PURE__ */ jsxs("span", {
28
- className: clsx(style_default.MethodRouteHttpMethod, style_default.MethodRouteHttpMethodIconOnly),
29
- "data-method": httpMethod,
30
- children: [HttpMethodIcons[httpMethod] && React$1.createElement(HttpMethodIcons[httpMethod], {
31
- size: 14,
32
- strokeWidth: 3,
33
- className: style_default.Icon
34
- }), showName && httpMethod]
35
- });
36
- }
37
10
  function MethodHeader({ title, badges, signature, children, level }) {
38
11
  const Heading = level ?? "h5";
39
12
  return /* @__PURE__ */ jsxs("div", {
@@ -53,11 +26,13 @@ function MethodHeader({ title, badges, signature, children, level }) {
53
26
  });
54
27
  }
55
28
  function MethodRoute({ httpMethod, endpoint, iconOnly }) {
29
+ const httpMethodTyped = getHttpMethod(httpMethod);
56
30
  return /* @__PURE__ */ jsxs("div", {
57
31
  className: style_default.MethodRoute,
58
- children: [/* @__PURE__ */ jsx(MethodIconBadge, {
59
- httpMethod,
60
- showName: !iconOnly
32
+ children: [httpMethodTyped && /* @__PURE__ */ jsx(Badge.HTTP, {
33
+ method: httpMethodTyped,
34
+ iconOnly,
35
+ size: "sm"
61
36
  }), endpoint && /* @__PURE__ */ jsx("span", {
62
37
  className: style_default.MethodRouteEndpoint,
63
38
  children: endpoint
@@ -112,4 +87,4 @@ function Method({ id, header, children, className, ...props }) {
112
87
  }
113
88
 
114
89
  //#endregion
115
- export { MethodHeader as a, MethodRoute as c, MethodDescription as i, HttpMethods as n, MethodIconBadge as o, Method as r, MethodInfo as s, HttpMethodIcons as t };
90
+ export { MethodRoute as a, MethodInfo as i, MethodDescription as n, MethodHeader as r, Method as t };
@@ -0,0 +1,59 @@
1
+ import * as React$1 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime46 from "react/jsx-runtime";
4
+
5
+ //#region src/components/method.d.ts
6
+ type MethodHeaderProps = {
7
+ title: ReactNode;
8
+ level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
9
+ signature?: ReactNode;
10
+ badges?: ReactNode;
11
+ children?: ReactNode;
12
+ };
13
+ declare function MethodHeader({
14
+ title,
15
+ badges,
16
+ signature,
17
+ children,
18
+ level
19
+ }: MethodHeaderProps): react_jsx_runtime46.JSX.Element;
20
+ type MethodRouteProps = {
21
+ httpMethod?: string;
22
+ endpoint?: string | ReactNode;
23
+ iconOnly?: boolean;
24
+ };
25
+ declare function MethodRoute({
26
+ httpMethod,
27
+ endpoint,
28
+ iconOnly
29
+ }: MethodRouteProps): react_jsx_runtime46.JSX.Element;
30
+ type MethodDescriptionProps = {
31
+ description?: string;
32
+ };
33
+ declare function MethodDescription({
34
+ description
35
+ }: MethodDescriptionProps): react_jsx_runtime46.JSX.Element | undefined;
36
+ type MethodInfoProps = {
37
+ children?: ReactNode;
38
+ parameters?: ReactNode;
39
+ returns?: ReactNode;
40
+ };
41
+ declare function MethodInfo({
42
+ children,
43
+ parameters,
44
+ returns
45
+ }: MethodInfoProps): react_jsx_runtime46.JSX.Element;
46
+ type MethodProps = {
47
+ id?: string;
48
+ header?: ReactNode;
49
+ children?: ReactNode;
50
+ } & React$1.HTMLProps<HTMLDivElement>;
51
+ declare function Method({
52
+ id,
53
+ header,
54
+ children,
55
+ className,
56
+ ...props
57
+ }: MethodProps): react_jsx_runtime46.JSX.Element;
58
+ //#endregion
59
+ export { MethodHeaderProps as a, MethodProps as c, MethodHeader as i, MethodRoute as l, MethodDescription as n, MethodInfo as o, MethodDescriptionProps as r, MethodInfoProps as s, Method as t, MethodRouteProps as u };
@@ -0,0 +1,59 @@
1
+ import * as React$1 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime50 from "react/jsx-runtime";
4
+
5
+ //#region src/components/method.d.ts
6
+ type MethodHeaderProps = {
7
+ title: ReactNode;
8
+ level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
9
+ signature?: ReactNode;
10
+ badges?: ReactNode;
11
+ children?: ReactNode;
12
+ };
13
+ declare function MethodHeader({
14
+ title,
15
+ badges,
16
+ signature,
17
+ children,
18
+ level
19
+ }: MethodHeaderProps): react_jsx_runtime50.JSX.Element;
20
+ type MethodRouteProps = {
21
+ httpMethod?: string;
22
+ endpoint?: string | ReactNode;
23
+ iconOnly?: boolean;
24
+ };
25
+ declare function MethodRoute({
26
+ httpMethod,
27
+ endpoint,
28
+ iconOnly
29
+ }: MethodRouteProps): react_jsx_runtime50.JSX.Element;
30
+ type MethodDescriptionProps = {
31
+ description?: string;
32
+ };
33
+ declare function MethodDescription({
34
+ description
35
+ }: MethodDescriptionProps): react_jsx_runtime50.JSX.Element | undefined;
36
+ type MethodInfoProps = {
37
+ children?: ReactNode;
38
+ parameters?: ReactNode;
39
+ returns?: ReactNode;
40
+ };
41
+ declare function MethodInfo({
42
+ children,
43
+ parameters,
44
+ returns
45
+ }: MethodInfoProps): react_jsx_runtime50.JSX.Element;
46
+ type MethodProps = {
47
+ id?: string;
48
+ header?: ReactNode;
49
+ children?: ReactNode;
50
+ } & React$1.HTMLProps<HTMLDivElement>;
51
+ declare function Method({
52
+ id,
53
+ header,
54
+ children,
55
+ className,
56
+ ...props
57
+ }: MethodProps): react_jsx_runtime50.JSX.Element;
58
+ //#endregion
59
+ export { MethodHeaderProps as a, MethodProps as c, MethodHeader as i, MethodRoute as l, MethodDescription as n, MethodInfo as o, MethodDescriptionProps as r, MethodInfoProps as s, Method as t, MethodRouteProps as u };
@@ -1,6 +1,6 @@
1
1
  import { t as DocsLanguage } from "./routing-CUnVDpU-.js";
2
2
  import * as React$1 from "react";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime33 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/contexts/navigation.d.ts
6
6
  type NavigationHandler = (ev: React$1.MouseEvent | null, opts: {
@@ -24,6 +24,6 @@ declare function NavigationProvider({
24
24
  selectedPath,
25
25
  onNavigate,
26
26
  children
27
- }: NavigationProviderProps): react_jsx_runtime0.JSX.Element;
27
+ }: NavigationProviderProps): react_jsx_runtime33.JSX.Element;
28
28
  //#endregion
29
29
  export { useNavigation as a, NavigationProviderProps as i, NavigationHandler as n, NavigationProvider as r, NavigationContextType as t };
@@ -0,0 +1,29 @@
1
+ import { t as DocsLanguage } from "./routing-CUnVDpU-.js";
2
+ import * as React$1 from "react";
3
+ import * as react_jsx_runtime89 from "react/jsx-runtime";
4
+
5
+ //#region src/contexts/navigation.d.ts
6
+ type NavigationHandler = (ev: React$1.MouseEvent | null, opts: {
7
+ href: string;
8
+ language: DocsLanguage;
9
+ stainlessPath: string;
10
+ scroll: boolean;
11
+ }) => void;
12
+ type NavigationContextType = {
13
+ basePath?: string;
14
+ selectedPath?: string;
15
+ navigationPath?: string[];
16
+ onNavigate?: NavigationHandler;
17
+ };
18
+ declare function useNavigation(): NavigationContextType;
19
+ type NavigationProviderProps = NavigationContextType & {
20
+ children: React$1.ReactNode;
21
+ };
22
+ declare function NavigationProvider({
23
+ basePath,
24
+ selectedPath,
25
+ onNavigate,
26
+ children
27
+ }: NavigationProviderProps): react_jsx_runtime89.JSX.Element;
28
+ //#endregion
29
+ export { useNavigation as a, NavigationProviderProps as i, NavigationHandler as n, NavigationProvider as r, NavigationContextType as t };
@@ -1,10 +1,10 @@
1
1
  import { a as useLanguage, l as useSpec, r as useDeclaration } from "./docs-CXqi26jB.js";
2
2
  import { n as useLanguageComponents } from "./contexts-CLpvBI91.js";
3
3
  import { t as useComponents } from "./use-components-DBx5LZk0.js";
4
- import { t as style_default } from "./style-cJZFOvnF.js";
5
- import { i as PropertyToggle } from "./properties-BTdEzx5f.js";
4
+ import { t as style_default } from "./style-Vk87Pfuy.js";
5
+ import { i as PropertyToggle } from "./properties-DhttBLpf.js";
6
6
  import { f as parseStainlessPath } from "./routing-Dl0FprK1.js";
7
- import { s as Markdown } from "./primitives-1WQd5NT-.js";
7
+ import { s as Markdown } from "./primitives-CCj2Pn-o.js";
8
8
  import { n as getResourceFromSpec, t as flatResources } from "./utils-C12Fme2N.js";
9
9
  import * as React$1 from "react";
10
10
  import { createElement } from "react";
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime18 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime55 from "react/jsx-runtime";
2
2
  import * as SDKJSON from "@stainless/sdk-json";
3
3
 
4
4
  //#region src/components/overview.d.ts
@@ -9,31 +9,31 @@ type SDKResourceProps = {
9
9
  declare function SDKResourceHeader({
10
10
  resource,
11
11
  parents
12
- }: SDKResourceProps): react_jsx_runtime18.JSX.Element | null;
12
+ }: SDKResourceProps): react_jsx_runtime55.JSX.Element | null;
13
13
  type SDKMethodSummaryProps = {
14
14
  method: SDKJSON.Method;
15
15
  };
16
16
  declare function SDKMethodSummary({
17
17
  method
18
- }: SDKMethodSummaryProps): react_jsx_runtime18.JSX.Element;
18
+ }: SDKMethodSummaryProps): react_jsx_runtime55.JSX.Element;
19
19
  declare function SDKResource({
20
20
  resource,
21
21
  parents,
22
22
  showModels
23
23
  }: SDKResourceProps & {
24
24
  showModels?: boolean;
25
- }): react_jsx_runtime18.JSX.Element;
25
+ }): react_jsx_runtime55.JSX.Element;
26
26
  type SDKOverviewProps = {
27
27
  resource: SDKJSON.Resource;
28
28
  };
29
29
  declare function SDKOverview({
30
30
  resource
31
- }: SDKOverviewProps): react_jsx_runtime18.JSX.Element;
31
+ }: SDKOverviewProps): react_jsx_runtime55.JSX.Element;
32
32
  type SDKRootProps = {
33
33
  stainlessPath: string;
34
34
  };
35
35
  declare function SDKRoot({
36
36
  stainlessPath
37
- }: SDKRootProps): react_jsx_runtime18.JSX.Element | null;
37
+ }: SDKRootProps): react_jsx_runtime55.JSX.Element | null;
38
38
  //#endregion
39
39
  export { SDKResource as a, SDKRoot as c, SDKOverviewProps as i, SDKRootProps as l, SDKMethodSummaryProps as n, SDKResourceHeader as o, SDKOverview as r, SDKResourceProps as s, SDKMethodSummary as t };
@@ -0,0 +1,39 @@
1
+ import * as react_jsx_runtime51 from "react/jsx-runtime";
2
+ import * as SDKJSON from "@stainless/sdk-json";
3
+
4
+ //#region src/components/overview.d.ts
5
+ type SDKResourceProps = {
6
+ resource: SDKJSON.Resource;
7
+ parents?: SDKJSON.Resource[];
8
+ };
9
+ declare function SDKResourceHeader({
10
+ resource,
11
+ parents
12
+ }: SDKResourceProps): react_jsx_runtime51.JSX.Element | null;
13
+ type SDKMethodSummaryProps = {
14
+ method: SDKJSON.Method;
15
+ };
16
+ declare function SDKMethodSummary({
17
+ method
18
+ }: SDKMethodSummaryProps): react_jsx_runtime51.JSX.Element;
19
+ declare function SDKResource({
20
+ resource,
21
+ parents,
22
+ showModels
23
+ }: SDKResourceProps & {
24
+ showModels?: boolean;
25
+ }): react_jsx_runtime51.JSX.Element;
26
+ type SDKOverviewProps = {
27
+ resource: SDKJSON.Resource;
28
+ };
29
+ declare function SDKOverview({
30
+ resource
31
+ }: SDKOverviewProps): react_jsx_runtime51.JSX.Element;
32
+ type SDKRootProps = {
33
+ stainlessPath: string;
34
+ };
35
+ declare function SDKRoot({
36
+ stainlessPath
37
+ }: SDKRootProps): react_jsx_runtime51.JSX.Element | null;
38
+ //#endregion
39
+ export { SDKResource as a, SDKRoot as c, SDKOverviewProps as i, SDKRootProps as l, SDKMethodSummaryProps as n, SDKResourceHeader as o, SDKOverview as r, SDKResourceProps as s, SDKMethodSummary as t };
@@ -1,13 +1,12 @@
1
1
  import { a as useLanguage, s as useSettings } from "./docs-CXqi26jB.js";
2
2
  import { n as useNavigation } from "./navigation-C5TN0SgC.js";
3
3
  import { a as useRenderMarkdown } from "./markdown-CxdeWgjV.js";
4
- import { t as style_default } from "./style-cJZFOvnF.js";
4
+ import { t as style_default } from "./style-Vk87Pfuy.js";
5
5
  import { o as generateRoute } from "./routing-Dl0FprK1.js";
6
- import * as React$1 from "react";
7
- import { Fragment, useState } from "react";
6
+ import { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { MinusIcon, PlusIcon } from "lucide-react";
10
8
  import clsx from "clsx";
9
+ import { MinusIcon, PlusIcon } from "lucide-react";
11
10
 
12
11
  //#region src/components/primitives.tsx
13
12
  function Join({ items, limit, children }) {
@@ -24,7 +23,7 @@ function Expander({ id, open, summary, virtual, muted, children }) {
24
23
  muted,
25
24
  id,
26
25
  children
27
- });
26
+ }, open ? "open" : "closed");
28
27
  return /* @__PURE__ */ jsxs("details", {
29
28
  className: style_default.Expander,
30
29
  open,
@@ -55,10 +54,7 @@ function Expander({ id, open, summary, virtual, muted, children }) {
55
54
  });
56
55
  }
57
56
  function VirtualExpander({ id, open: isOpen, muted, summary, children }) {
58
- const [open, setOpen] = useState(isOpen);
59
- React$1.useEffect(() => {
60
- if (isOpen) setOpen(true);
61
- }, [isOpen]);
57
+ const [open, setOpen] = useState(isOpen ?? false);
62
58
  return /* @__PURE__ */ jsxs("div", {
63
59
  className: style_default.Expander,
64
60
  "data-open": open,
@@ -101,9 +97,9 @@ function Badge({ id, children }) {
101
97
  children: children ?? id
102
98
  });
103
99
  }
104
- const TooltipNestingContext = React$1.createContext(false);
100
+ const TooltipNestingContext = createContext(false);
105
101
  function Tooltip({ content, children }) {
106
- if (React$1.useContext(TooltipNestingContext)) return children;
102
+ if (useContext(TooltipNestingContext)) return children;
107
103
  return /* @__PURE__ */ jsxs("span", {
108
104
  className: style_default.Tooltip,
109
105
  children: [/* @__PURE__ */ jsx("span", {
@@ -121,7 +117,7 @@ function Tooltip({ content, children }) {
121
117
  function Link({ stainlessPath, scroll = true, children, ...props }) {
122
118
  const { basePath, onNavigate } = useNavigation();
123
119
  const language = useLanguage();
124
- const href = React$1.useMemo(() => {
120
+ const href = useMemo(() => {
125
121
  if (props.href) return props.href;
126
122
  if (stainlessPath && basePath) return generateRoute(basePath, language, stainlessPath);
127
123
  }, [
@@ -130,7 +126,7 @@ function Link({ stainlessPath, scroll = true, children, ...props }) {
130
126
  stainlessPath,
131
127
  props.href
132
128
  ]);
133
- const handleClick = React$1.useCallback((e) => {
129
+ const handleClick = useCallback((e) => {
134
130
  if (props.onClick) props.onClick(e);
135
131
  if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
136
132
  if (href) onNavigate?.(e, {
@@ -155,7 +151,7 @@ function Link({ stainlessPath, scroll = true, children, ...props }) {
155
151
  children
156
152
  });
157
153
  }
158
- const Input = React$1.forwardRef(function Input$1({ left, right, ...props }, ref) {
154
+ function Input({ left, right, ref, ...props }) {
159
155
  return /* @__PURE__ */ jsxs("div", {
160
156
  className: clsx(style_default.Input, props.disabled && style_default.InputDisabled),
161
157
  children: [
@@ -168,8 +164,8 @@ const Input = React$1.forwardRef(function Input$1({ left, right, ...props }, ref
168
164
  right
169
165
  ]
170
166
  });
171
- });
172
- const ToggleButton = React$1.forwardRef(function ToggleButton$1({ children, selected, ...props }, ref) {
167
+ }
168
+ function ToggleButton({ children, selected, ref, ...props }) {
173
169
  return /* @__PURE__ */ jsx("button", {
174
170
  ...props,
175
171
  ref,
@@ -177,17 +173,13 @@ const ToggleButton = React$1.forwardRef(function ToggleButton$1({ children, sele
177
173
  "data-stldocs-toggle-selected": selected,
178
174
  children
179
175
  });
180
- });
176
+ }
181
177
  function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
182
- const [selectedIndex, setSelectedIndex] = React$1.useState(0);
183
- const [keyboardIndex, setKeyboardIndex] = React$1.useState(0);
184
- const listRef = React$1.useRef(null);
185
- const itemRef = React$1.useRef(null);
186
- React$1.useEffect(() => {
187
- setSelectedIndex(0);
188
- setKeyboardIndex(0);
189
- }, [items]);
190
- const handleSelect = React$1.useCallback(() => {
178
+ const [selectedIndex, setSelectedIndex] = useState(0);
179
+ const [keyboardIndex, setKeyboardIndex] = useState(0);
180
+ const listRef = useRef(null);
181
+ const itemRef = useRef(null);
182
+ const handleSelect = useCallback(() => {
191
183
  const item = items[selectedIndex];
192
184
  if (item) onSelectListItem?.(item);
193
185
  }, [
@@ -195,8 +187,9 @@ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
195
187
  selectedIndex,
196
188
  onSelectListItem
197
189
  ]);
198
- React$1.useEffect(() => {
199
- function handleKeyPress(ev) {
190
+ useEffect(() => {
191
+ const ac = new AbortController();
192
+ document.addEventListener("keydown", (ev) => {
200
193
  switch (ev.key) {
201
194
  case "ArrowUp": {
202
195
  ev.preventDefault();
@@ -217,15 +210,14 @@ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
217
210
  handleSelect();
218
211
  break;
219
212
  }
220
- }
221
- addEventListener("keydown", handleKeyPress);
222
- return () => removeEventListener("keydown", handleKeyPress);
213
+ }, { signal: ac.signal });
214
+ return () => ac.abort();
223
215
  }, [
224
216
  items,
225
217
  selectedIndex,
226
218
  handleSelect
227
219
  ]);
228
- React$1.useEffect(() => {
220
+ useEffect(() => {
229
221
  if (!keyboardIndex || !itemRef.current || !listRef.current) {
230
222
  listRef?.current?.scroll(0, 0);
231
223
  return;
@@ -248,7 +240,7 @@ function ListView({ items, itemDelegate, onSelectListItem, ...rest }) {
248
240
  className: style_default.ListViewItem,
249
241
  "data-stldocs-listview-selected": index === selectedIndex,
250
242
  onClick: handleSelect,
251
- onMouseMove: () => setSelectedIndex(index),
243
+ onMouseEnter: () => setSelectedIndex(index),
252
244
  children: itemDelegate(item, index === selectedIndex)
253
245
  }, index))
254
246
  });
@@ -0,0 +1,104 @@
1
+ import * as react0 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime56 from "react/jsx-runtime";
4
+
5
+ //#region src/components/primitives.d.ts
6
+ type JoinProps = {
7
+ items: ReactNode[];
8
+ limit?: number;
9
+ children: ReactNode;
10
+ };
11
+ declare function Join({
12
+ items,
13
+ limit,
14
+ children
15
+ }: JoinProps): react_jsx_runtime56.JSX.Element[];
16
+ type ExpanderProps = {
17
+ id?: string;
18
+ open?: boolean;
19
+ summary: ReactNode;
20
+ virtual?: boolean;
21
+ muted?: boolean;
22
+ children?: ReactNode;
23
+ };
24
+ declare function Expander({
25
+ id,
26
+ open,
27
+ summary,
28
+ virtual,
29
+ muted,
30
+ children
31
+ }: ExpanderProps): react_jsx_runtime56.JSX.Element;
32
+ declare function VirtualExpander({
33
+ id,
34
+ open: isOpen,
35
+ muted,
36
+ summary,
37
+ children
38
+ }: Omit<ExpanderProps, 'virtual'>): react_jsx_runtime56.JSX.Element;
39
+ declare function Markdown({
40
+ content
41
+ }: {
42
+ content: string;
43
+ }): "" | react_jsx_runtime56.JSX.Element | undefined;
44
+ type BadgeProps = {
45
+ id: string;
46
+ children?: ReactNode;
47
+ };
48
+ declare function Badge({
49
+ id,
50
+ children
51
+ }: BadgeProps): react_jsx_runtime56.JSX.Element;
52
+ type TooltipProps = {
53
+ content: ReactNode;
54
+ children: ReactNode;
55
+ };
56
+ declare function Tooltip({
57
+ content,
58
+ children
59
+ }: TooltipProps): string | number | bigint | boolean | react_jsx_runtime56.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
60
+ type LinkProps = {
61
+ stainlessPath: string;
62
+ scroll?: boolean;
63
+ children?: ReactNode;
64
+ } & React.HTMLProps<HTMLAnchorElement>;
65
+ declare function Link({
66
+ stainlessPath,
67
+ scroll,
68
+ children,
69
+ ...props
70
+ }: LinkProps): string | number | bigint | boolean | react_jsx_runtime56.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
71
+ type InputProps = {
72
+ left?: ReactNode;
73
+ right?: ReactNode;
74
+ ref?: React.Ref<HTMLInputElement>;
75
+ } & React.InputHTMLAttributes<HTMLInputElement>;
76
+ declare function Input({
77
+ left,
78
+ right,
79
+ ref,
80
+ ...props
81
+ }: InputProps): react_jsx_runtime56.JSX.Element;
82
+ type ToggleButtonProps = {
83
+ children?: ReactNode;
84
+ selected?: boolean;
85
+ } & React.ComponentProps<'button'>;
86
+ declare function ToggleButton({
87
+ children,
88
+ selected,
89
+ ref,
90
+ ...props
91
+ }: ToggleButtonProps): react_jsx_runtime56.JSX.Element;
92
+ type ListViewProps<TItem> = {
93
+ items: Array<TItem>;
94
+ itemDelegate: (item: TItem, selected: boolean) => React.ReactNode;
95
+ onSelectListItem?: (item: TItem) => void;
96
+ } & React.HTMLAttributes<HTMLDivElement>;
97
+ declare function ListView<TItem>({
98
+ items,
99
+ itemDelegate,
100
+ onSelectListItem,
101
+ ...rest
102
+ }: ListViewProps<TItem>): react_jsx_runtime56.JSX.Element;
103
+ //#endregion
104
+ export { Join as a, ListViewProps as c, ToggleButtonProps as d, Tooltip as f, InputProps as i, Markdown as l, Expander as n, Link as o, VirtualExpander as p, Input as r, ListView as s, Badge as t, ToggleButton as u };
@@ -0,0 +1,104 @@
1
+ import * as react0 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime60 from "react/jsx-runtime";
4
+
5
+ //#region src/components/primitives.d.ts
6
+ type JoinProps = {
7
+ items: ReactNode[];
8
+ limit?: number;
9
+ children: ReactNode;
10
+ };
11
+ declare function Join({
12
+ items,
13
+ limit,
14
+ children
15
+ }: JoinProps): react_jsx_runtime60.JSX.Element[];
16
+ type ExpanderProps = {
17
+ id?: string;
18
+ open?: boolean;
19
+ summary: ReactNode;
20
+ virtual?: boolean;
21
+ muted?: boolean;
22
+ children?: ReactNode;
23
+ };
24
+ declare function Expander({
25
+ id,
26
+ open,
27
+ summary,
28
+ virtual,
29
+ muted,
30
+ children
31
+ }: ExpanderProps): react_jsx_runtime60.JSX.Element;
32
+ declare function VirtualExpander({
33
+ id,
34
+ open: isOpen,
35
+ muted,
36
+ summary,
37
+ children
38
+ }: Omit<ExpanderProps, 'virtual'>): react_jsx_runtime60.JSX.Element;
39
+ declare function Markdown({
40
+ content
41
+ }: {
42
+ content: string;
43
+ }): "" | react_jsx_runtime60.JSX.Element | undefined;
44
+ type BadgeProps = {
45
+ id: string;
46
+ children?: ReactNode;
47
+ };
48
+ declare function Badge({
49
+ id,
50
+ children
51
+ }: BadgeProps): react_jsx_runtime60.JSX.Element;
52
+ type TooltipProps = {
53
+ content: ReactNode;
54
+ children: ReactNode;
55
+ };
56
+ declare function Tooltip({
57
+ content,
58
+ children
59
+ }: TooltipProps): string | number | bigint | boolean | react_jsx_runtime60.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
60
+ type LinkProps = {
61
+ stainlessPath: string;
62
+ scroll?: boolean;
63
+ children?: ReactNode;
64
+ } & React.HTMLProps<HTMLAnchorElement>;
65
+ declare function Link({
66
+ stainlessPath,
67
+ scroll,
68
+ children,
69
+ ...props
70
+ }: LinkProps): string | number | bigint | boolean | react_jsx_runtime60.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
71
+ type InputProps = {
72
+ left?: ReactNode;
73
+ right?: ReactNode;
74
+ ref?: React.Ref<HTMLInputElement>;
75
+ } & React.InputHTMLAttributes<HTMLInputElement>;
76
+ declare function Input({
77
+ left,
78
+ right,
79
+ ref,
80
+ ...props
81
+ }: InputProps): react_jsx_runtime60.JSX.Element;
82
+ type ToggleButtonProps = {
83
+ children?: ReactNode;
84
+ selected?: boolean;
85
+ } & React.ComponentProps<'button'>;
86
+ declare function ToggleButton({
87
+ children,
88
+ selected,
89
+ ref,
90
+ ...props
91
+ }: ToggleButtonProps): react_jsx_runtime60.JSX.Element;
92
+ type ListViewProps<TItem> = {
93
+ items: Array<TItem>;
94
+ itemDelegate: (item: TItem, selected: boolean) => React.ReactNode;
95
+ onSelectListItem?: (item: TItem) => void;
96
+ } & React.HTMLAttributes<HTMLDivElement>;
97
+ declare function ListView<TItem>({
98
+ items,
99
+ itemDelegate,
100
+ onSelectListItem,
101
+ ...rest
102
+ }: ListViewProps<TItem>): react_jsx_runtime60.JSX.Element;
103
+ //#endregion
104
+ export { Join as a, ListViewProps as c, ToggleButtonProps as d, Tooltip as f, InputProps as i, Markdown as l, Expander as n, Link as o, VirtualExpander as p, Input as r, ListView as s, Badge as t, ToggleButton as u };