@oxide/design-system 3.2.0--canary.151.18510115780.0 → 3.2.0--canary.151.18510956047.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/chunk-7VKKHVZC.js +45 -0
- package/dist/chunk-7VKKHVZC.js.map +1 -0
- package/dist/components/src/{index.d.ts → asciidoc/index.d.ts} +0 -4
- package/dist/{chunk-XPHTG73Y.js → components/src/asciidoc/index.js} +78 -472
- package/dist/components/src/asciidoc/index.js.map +1 -0
- package/dist/components/src/ui/index.js +343 -15
- package/dist/components/src/ui/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-XPHTG73Y.js.map +0 -1
- package/dist/components/src/index.js +0 -56
- package/dist/components/src/index.js.map +0 -1
|
@@ -1,322 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
titleCase
|
|
3
|
+
} from "../../../chunk-7VKKHVZC.js";
|
|
4
|
+
import {
|
|
3
5
|
DirectionRightIcon_default,
|
|
4
|
-
Link16Icon_default
|
|
5
|
-
|
|
6
|
-
} from "./chunk-BTKC2KJ2.js";
|
|
7
|
-
|
|
8
|
-
// components/src/ui/badge/Badge.tsx
|
|
9
|
-
import cn from "classnames";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
var badgeColors = {
|
|
12
|
-
default: {
|
|
13
|
-
default: "bg-accent-secondary text-accent ring-accent/15",
|
|
14
|
-
destructive: "bg-destructive-secondary text-destructive ring-destructive/15",
|
|
15
|
-
notice: "bg-notice-secondary text-notice ring-notice/15",
|
|
16
|
-
blue: "bg-blue-200 text-blue-800 ring-blue-800/15",
|
|
17
|
-
purple: "bg-purple-200 text-purple-800 ring-purple-800/15",
|
|
18
|
-
neutral: "bg-secondary text-default ring-neutral-700/15"
|
|
19
|
-
},
|
|
20
|
-
solid: {
|
|
21
|
-
default: "bg-accent text-inverse",
|
|
22
|
-
destructive: "bg-destructive text-inverse",
|
|
23
|
-
notice: "bg-notice text-inverse",
|
|
24
|
-
neutral: "bg-inverse-tertiary text-inverse",
|
|
25
|
-
purple: "bg-purple-700 text-inverse",
|
|
26
|
-
blue: "bg-info text-inverse"
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var Badge = ({
|
|
30
|
-
className,
|
|
31
|
-
children,
|
|
32
|
-
color = "default",
|
|
33
|
-
variant = "default"
|
|
34
|
-
}) => {
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
-
"span",
|
|
37
|
-
{
|
|
38
|
-
className: cn(
|
|
39
|
-
"ox-badge ring ring-inset",
|
|
40
|
-
`variant-${variant}`,
|
|
41
|
-
"text-mono-sm inline-flex h-4 items-center whitespace-nowrap rounded-sm px-[3px] py-[1px] uppercase",
|
|
42
|
-
badgeColors[variant][color],
|
|
43
|
-
className
|
|
44
|
-
),
|
|
45
|
-
children: /* @__PURE__ */ jsx("span", { children })
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// components/src/ui/button/Button.tsx
|
|
51
|
-
import cn2 from "classnames";
|
|
52
|
-
import { forwardRef } from "react";
|
|
53
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
54
|
-
var buttonSizes = ["sm", "icon", "base"];
|
|
55
|
-
var variants = ["primary", "secondary", "ghost", "danger"];
|
|
56
|
-
var sizeStyle = {
|
|
57
|
-
sm: "h-8 px-3 text-mono-sm svg:w-4",
|
|
58
|
-
// meant for buttons that only contain a single icon
|
|
59
|
-
icon: "h-8 w-8 text-mono-sm svg:w-4",
|
|
60
|
-
base: "h-10 px-4 text-mono-sm svg:w-5"
|
|
61
|
-
};
|
|
62
|
-
var buttonStyle = ({
|
|
63
|
-
size: size2 = "base",
|
|
64
|
-
variant = "primary"
|
|
65
|
-
} = {}) => {
|
|
66
|
-
return cn2(
|
|
67
|
-
"ox-button inline-flex items-center justify-center rounded align-top elevation-1 disabled:cursor-not-allowed",
|
|
68
|
-
`btn-${variant}`,
|
|
69
|
-
sizeStyle[size2],
|
|
70
|
-
variant === "danger" ? "focus:outline-destructive-secondary" : "focus:outline-accent-secondary"
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
var noop = (e) => {
|
|
74
|
-
e.stopPropagation();
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
};
|
|
77
|
-
var Button = forwardRef(
|
|
78
|
-
({
|
|
79
|
-
type = "button",
|
|
80
|
-
children,
|
|
81
|
-
size: size2,
|
|
82
|
-
variant,
|
|
83
|
-
className,
|
|
84
|
-
loading,
|
|
85
|
-
innerClassName,
|
|
86
|
-
disabled,
|
|
87
|
-
onClick,
|
|
88
|
-
// needs to be a spread because we sometimes get passed arbitrary <button>
|
|
89
|
-
// props by the parent
|
|
90
|
-
...rest
|
|
91
|
-
}, ref) => {
|
|
92
|
-
const isDisabled = disabled || loading;
|
|
93
|
-
return /* @__PURE__ */ jsxs(
|
|
94
|
-
"button",
|
|
95
|
-
{
|
|
96
|
-
className: cn2(buttonStyle({ size: size2, variant }), className, {
|
|
97
|
-
"visually-disabled": isDisabled
|
|
98
|
-
}),
|
|
99
|
-
ref,
|
|
100
|
-
type,
|
|
101
|
-
onMouseDown: isDisabled ? noop : void 0,
|
|
102
|
-
onClick: isDisabled ? noop : onClick,
|
|
103
|
-
"aria-disabled": isDisabled,
|
|
104
|
-
...rest,
|
|
105
|
-
children: [
|
|
106
|
-
loading && /* @__PURE__ */ jsx2(Spinner, { className: "absolute", variant }),
|
|
107
|
-
/* @__PURE__ */ jsx2("span", { className: cn2("flex items-center", innerClassName, { invisible: loading }), children })
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
// components/src/ui/spinner/Spinner.tsx
|
|
115
|
-
import cn3 from "classnames";
|
|
116
|
-
import { useEffect, useRef, useState } from "react";
|
|
117
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
118
|
-
var spinnerSizes = ["base", "lg"];
|
|
119
|
-
var spinnerVariants = ["primary", "secondary", "ghost", "danger"];
|
|
120
|
-
var Spinner = ({
|
|
121
|
-
className,
|
|
122
|
-
size: size2 = "base",
|
|
123
|
-
variant = "primary"
|
|
124
|
-
}) => {
|
|
125
|
-
const frameSize = size2 === "lg" ? 36 : 12;
|
|
126
|
-
const center = size2 === "lg" ? 18 : 6;
|
|
127
|
-
const radius = size2 === "lg" ? 16 : 5;
|
|
128
|
-
const strokeWidth = size2 === "lg" ? 3 : 2;
|
|
129
|
-
return /* @__PURE__ */ jsxs2(
|
|
130
|
-
"svg",
|
|
131
|
-
{
|
|
132
|
-
width: frameSize,
|
|
133
|
-
height: frameSize,
|
|
134
|
-
viewBox: `0 0 ${frameSize + " " + frameSize}`,
|
|
135
|
-
fill: "none",
|
|
136
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
137
|
-
"aria-labelledby": "Spinner",
|
|
138
|
-
className: cn3("spinner", `spinner-${variant}`, `spinner-${size2}`, className),
|
|
139
|
-
children: [
|
|
140
|
-
/* @__PURE__ */ jsx3(
|
|
141
|
-
"circle",
|
|
142
|
-
{
|
|
143
|
-
fill: "none",
|
|
144
|
-
className: "bg",
|
|
145
|
-
strokeWidth,
|
|
146
|
-
strokeLinecap: "round",
|
|
147
|
-
cx: center,
|
|
148
|
-
cy: center,
|
|
149
|
-
r: radius,
|
|
150
|
-
strokeOpacity: 0.2
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
/* @__PURE__ */ jsx3(
|
|
154
|
-
"circle",
|
|
155
|
-
{
|
|
156
|
-
className: "path",
|
|
157
|
-
fill: "none",
|
|
158
|
-
stroke: "currentColor",
|
|
159
|
-
strokeWidth,
|
|
160
|
-
strokeLinecap: "round",
|
|
161
|
-
cx: center,
|
|
162
|
-
cy: center,
|
|
163
|
-
r: radius
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
};
|
|
170
|
-
var SpinnerLoader = ({ isLoading, children = null, minTime = 500 }) => {
|
|
171
|
-
const [isVisible, setIsVisible] = useState(isLoading);
|
|
172
|
-
const hideTimeout = useRef(null);
|
|
173
|
-
const loadingStartTime = useRef(0);
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
if (isLoading) {
|
|
176
|
-
setIsVisible(true);
|
|
177
|
-
loadingStartTime.current = Date.now();
|
|
178
|
-
} else {
|
|
179
|
-
if (hideTimeout.current) clearTimeout(hideTimeout.current);
|
|
180
|
-
const elapsedTime = Date.now() - loadingStartTime.current;
|
|
181
|
-
const remainingTime = Math.max(0, minTime - elapsedTime);
|
|
182
|
-
if (remainingTime === 0) {
|
|
183
|
-
setIsVisible(false);
|
|
184
|
-
} else {
|
|
185
|
-
hideTimeout.current = setTimeout(() => setIsVisible(false), remainingTime);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return () => {
|
|
189
|
-
if (hideTimeout.current) clearTimeout(hideTimeout.current);
|
|
190
|
-
};
|
|
191
|
-
}, [isLoading, minTime]);
|
|
192
|
-
return isVisible ? /* @__PURE__ */ jsx3(Spinner, {}) : /* @__PURE__ */ jsx3(Fragment, { children });
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// components/src/ui/tabs/Tabs.tsx
|
|
196
|
-
import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
197
|
-
import cn4 from "classnames";
|
|
198
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
199
|
-
var Tabs = {
|
|
200
|
-
Root: ({ className, ...props }) => /* @__PURE__ */ jsx4(Root, { ...props, className: cn4("ox-tabs", className) }),
|
|
201
|
-
Trigger: ({ children, className, ...props }) => /* @__PURE__ */ jsx4(Trigger, { ...props, className: cn4("ox-tab", className), children: /* @__PURE__ */ jsx4("div", { children }) }),
|
|
202
|
-
List: ({ className, ...props }) => /* @__PURE__ */ jsx4(List, { ...props, className: cn4("ox-tabs-list", className) }),
|
|
203
|
-
Content: ({ className, ...props }) => /* @__PURE__ */ jsx4(Content, { ...props, className: cn4("ox-tabs-panel", className) })
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// components/src/ui/checkbox/Checkbox.tsx
|
|
207
|
-
import cn6 from "classnames";
|
|
208
|
-
|
|
209
|
-
// components/src/utils.ts
|
|
210
|
-
import cn5 from "classnames";
|
|
211
|
-
import { createElement } from "react";
|
|
212
|
-
var titleCase = (text) => {
|
|
213
|
-
return text.replace(
|
|
214
|
-
/\w\S*/g,
|
|
215
|
-
(text2) => text2.charAt(0).toUpperCase() + text2.substring(1).toLowerCase()
|
|
216
|
-
);
|
|
217
|
-
};
|
|
218
|
-
var make = (tag) => (
|
|
219
|
-
// only one argument here means string interpolations are not allowed
|
|
220
|
-
(strings) => {
|
|
221
|
-
const Comp = ({ className, children, ...rest }) => createElement(tag, { className: cn5(strings[0], className), ...rest }, children);
|
|
222
|
-
Comp.displayName = `classed.${tag}`;
|
|
223
|
-
return Comp;
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
var classed = {
|
|
227
|
-
button: make("button"),
|
|
228
|
-
div: make("div"),
|
|
229
|
-
h1: make("h1"),
|
|
230
|
-
h2: make("h2"),
|
|
231
|
-
h3: make("h3"),
|
|
232
|
-
h4: make("h4"),
|
|
233
|
-
hr: make("hr"),
|
|
234
|
-
header: make("header"),
|
|
235
|
-
input: make("input"),
|
|
236
|
-
label: make("label"),
|
|
237
|
-
li: make("li"),
|
|
238
|
-
main: make("main"),
|
|
239
|
-
ol: make("ol"),
|
|
240
|
-
p: make("p"),
|
|
241
|
-
span: make("span"),
|
|
242
|
-
table: make("table"),
|
|
243
|
-
tbody: make("tbody"),
|
|
244
|
-
td: make("td"),
|
|
245
|
-
th: make("th"),
|
|
246
|
-
tr: make("tr")
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// components/src/ui/checkbox/Checkbox.tsx
|
|
250
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
251
|
-
var Check = () => /* @__PURE__ */ jsx5(Checkmark12Icon_default, { className: "text-accent pointer-events-none absolute left-0.5 top-0.5 h-3 w-3 fill-current" });
|
|
252
|
-
var Indeterminate = classed.div`absolute w-2 h-0.5 left-1 top-[7px] bg-accent pointer-events-none`;
|
|
253
|
-
var inputStyle = `
|
|
254
|
-
appearance-none border border-default bg-default h-4 w-4 rounded-sm absolute left-0 outline-none
|
|
255
|
-
disabled:cursor-not-allowed
|
|
256
|
-
hover:border-hover hover:cursor-pointer
|
|
257
|
-
checked:bg-accent-secondary checked:border-accent-secondary checked:hover:border-accent
|
|
258
|
-
indeterminate:bg-accent-secondary indeterminate:border-accent hover:indeterminate:bg-accent-secondary-hover
|
|
259
|
-
`;
|
|
260
|
-
var Checkbox = ({
|
|
261
|
-
indeterminate,
|
|
262
|
-
children,
|
|
263
|
-
className,
|
|
264
|
-
...inputProps
|
|
265
|
-
}) => /* @__PURE__ */ jsxs3("label", { className: "inline-flex items-center", children: [
|
|
266
|
-
/* @__PURE__ */ jsxs3("span", { className: "relative h-4 w-4", children: [
|
|
267
|
-
/* @__PURE__ */ jsx5(
|
|
268
|
-
"input",
|
|
269
|
-
{
|
|
270
|
-
className: cn6(inputStyle, className),
|
|
271
|
-
type: "checkbox",
|
|
272
|
-
ref: (el) => {
|
|
273
|
-
if (el) el.indeterminate = !!indeterminate;
|
|
274
|
-
},
|
|
275
|
-
...inputProps
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
inputProps.checked && !indeterminate && /* @__PURE__ */ jsx5(Check, {}),
|
|
279
|
-
indeterminate && /* @__PURE__ */ jsx5(Indeterminate, {})
|
|
280
|
-
] }),
|
|
281
|
-
children && /* @__PURE__ */ jsx5("span", { className: "text-sans-md text-secondary ml-2.5", children })
|
|
282
|
-
] });
|
|
283
|
-
|
|
284
|
-
// components/src/ui/listbox/Listbox.tsx
|
|
285
|
-
import { flip, FloatingPortal, offset, size, useFloating } from "@floating-ui/react";
|
|
286
|
-
import { Listbox as Select } from "@headlessui/react";
|
|
287
|
-
import cn9 from "classnames";
|
|
6
|
+
Link16Icon_default
|
|
7
|
+
} from "../../../chunk-BTKC2KJ2.js";
|
|
288
8
|
|
|
289
9
|
// components/src/asciidoc/index.tsx
|
|
290
10
|
import asciidoctor2 from "@asciidoctor/core";
|
|
291
|
-
import { Content as
|
|
11
|
+
import { Content as Content4 } from "@oxide/react-asciidoc";
|
|
292
12
|
|
|
293
13
|
// components/src/asciidoc/Admonition.tsx
|
|
294
|
-
import { Content
|
|
295
|
-
import { jsx
|
|
14
|
+
import { Content, parse, Title } from "@oxide/react-asciidoc";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
296
16
|
var Admonition = ({ node }) => {
|
|
297
17
|
const attrs2 = node.attributes;
|
|
298
18
|
let icon;
|
|
299
19
|
if (attrs2.name === "caution") {
|
|
300
|
-
icon = /* @__PURE__ */
|
|
20
|
+
icon = /* @__PURE__ */ jsx(Error12, {});
|
|
301
21
|
} else if (attrs2.name === "warning") {
|
|
302
|
-
icon = /* @__PURE__ */
|
|
22
|
+
icon = /* @__PURE__ */ jsx(Warning12, {});
|
|
303
23
|
} else {
|
|
304
|
-
icon = /* @__PURE__ */
|
|
24
|
+
icon = /* @__PURE__ */ jsx(Error12, { className: "rotate-180" });
|
|
305
25
|
}
|
|
306
|
-
return /* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", { className: `admonitionblock ${attrs2.name}`, children: [
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "admonition-icon", children: icon }),
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "admonition-content content", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Title, { text: node.title }),
|
|
30
|
+
/* @__PURE__ */ jsx("div", { children: titleCase(attrs2.name.toString()) }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Title, { text: node.title }),
|
|
313
33
|
node.content && parse(node.content),
|
|
314
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ jsx(Content, { blocks: node.blocks })
|
|
315
35
|
] })
|
|
316
36
|
] })
|
|
317
37
|
] });
|
|
318
38
|
};
|
|
319
|
-
var Error12 = ({ className }) => /* @__PURE__ */
|
|
39
|
+
var Error12 = ({ className }) => /* @__PURE__ */ jsx(
|
|
320
40
|
"svg",
|
|
321
41
|
{
|
|
322
42
|
width: "12",
|
|
@@ -324,7 +44,7 @@ var Error12 = ({ className }) => /* @__PURE__ */ jsx6(
|
|
|
324
44
|
viewBox: "0 0 12 12",
|
|
325
45
|
xmlns: "http://www.w3.org/2000/svg",
|
|
326
46
|
className,
|
|
327
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ jsx(
|
|
328
48
|
"path",
|
|
329
49
|
{
|
|
330
50
|
fillRule: "evenodd",
|
|
@@ -335,7 +55,7 @@ var Error12 = ({ className }) => /* @__PURE__ */ jsx6(
|
|
|
335
55
|
)
|
|
336
56
|
}
|
|
337
57
|
);
|
|
338
|
-
var Warning12 = ({ className }) => /* @__PURE__ */
|
|
58
|
+
var Warning12 = ({ className }) => /* @__PURE__ */ jsx(
|
|
339
59
|
"svg",
|
|
340
60
|
{
|
|
341
61
|
width: "12",
|
|
@@ -343,7 +63,7 @@ var Warning12 = ({ className }) => /* @__PURE__ */ jsx6(
|
|
|
343
63
|
viewBox: "0 0 12 12",
|
|
344
64
|
xmlns: "http://www.w3.org/2000/svg",
|
|
345
65
|
className,
|
|
346
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ jsx(
|
|
347
67
|
"path",
|
|
348
68
|
{
|
|
349
69
|
fillRule: "evenodd",
|
|
@@ -357,32 +77,32 @@ var Warning12 = ({ className }) => /* @__PURE__ */ jsx6(
|
|
|
357
77
|
var Admonition_default = Admonition;
|
|
358
78
|
|
|
359
79
|
// components/src/asciidoc/Section.tsx
|
|
360
|
-
import { Content as
|
|
361
|
-
import
|
|
362
|
-
import { createElement
|
|
363
|
-
import { Fragment
|
|
80
|
+
import { Content as Content2, parse as parse2 } from "@oxide/react-asciidoc";
|
|
81
|
+
import cn from "classnames";
|
|
82
|
+
import { createElement } from "react";
|
|
83
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
364
84
|
var stripAnchors = (str) => str.replace(/<a[^>]*>(.*?)<\/a>/gi, "$1");
|
|
365
85
|
var Section = ({ node }) => {
|
|
366
86
|
const level = node.level;
|
|
367
87
|
let title = "";
|
|
368
88
|
let sectNum = node.num;
|
|
369
89
|
sectNum = sectNum && sectNum[0] === "." ? "" : sectNum;
|
|
370
|
-
title = /* @__PURE__ */
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
90
|
+
title = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx2("span", { className: "anchor", id: node.id || "", "aria-hidden": "true" }),
|
|
92
|
+
/* @__PURE__ */ jsxs2("a", { className: "link group", href: `#${node.id}`, children: [
|
|
373
93
|
parse2(stripAnchors(node.title)),
|
|
374
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ jsx2(Link16Icon_default, { className: "text-accent-secondary ml-2 hidden group-hover:inline-block" })
|
|
375
95
|
] })
|
|
376
96
|
] });
|
|
377
97
|
if (level === 0) {
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
99
|
+
/* @__PURE__ */ jsx2("h1", { className: cn("sect0", node.role), "data-sectnum": sectNum, children: title }),
|
|
100
|
+
/* @__PURE__ */ jsx2(Content2, { blocks: node.blocks })
|
|
381
101
|
] });
|
|
382
102
|
} else {
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
|
|
385
|
-
/* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn(`sect${level}`, node.role), children: [
|
|
104
|
+
createElement(`h${level + 1}`, { "data-sectnum": sectNum }, title),
|
|
105
|
+
/* @__PURE__ */ jsx2("div", { className: "sectionbody", children: /* @__PURE__ */ jsx2(Content2, { blocks: node.blocks }) })
|
|
386
106
|
] });
|
|
387
107
|
}
|
|
388
108
|
};
|
|
@@ -390,26 +110,26 @@ var Section_default = Section;
|
|
|
390
110
|
|
|
391
111
|
// components/src/asciidoc/Table.tsx
|
|
392
112
|
import { Table as InnerTable } from "@oxide/react-asciidoc";
|
|
393
|
-
import { jsx as
|
|
394
|
-
var Table = ({ node }) => /* @__PURE__ */
|
|
113
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
114
|
+
var Table = ({ node }) => /* @__PURE__ */ jsx3("div", { className: "table-wrapper", children: /* @__PURE__ */ jsx3(InnerTable, { node }) });
|
|
395
115
|
var Table_default = Table;
|
|
396
116
|
|
|
397
117
|
// components/src/asciidoc/TableOfContents.tsx
|
|
398
118
|
import { parse as parse3 } from "@oxide/react-asciidoc";
|
|
399
119
|
import * as Accordion from "@radix-ui/react-accordion";
|
|
400
|
-
import
|
|
401
|
-
import { Fragment as
|
|
402
|
-
import { jsx as
|
|
120
|
+
import cn2 from "classnames";
|
|
121
|
+
import { Fragment as Fragment2, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
122
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
403
123
|
function useIntersectionObserver(elements, callback, options) {
|
|
404
|
-
const [observer, setObserver] =
|
|
405
|
-
|
|
124
|
+
const [observer, setObserver] = useState(null);
|
|
125
|
+
useEffect(() => {
|
|
406
126
|
const observer2 = new IntersectionObserver(callback, options);
|
|
407
127
|
setObserver(observer2);
|
|
408
128
|
return () => {
|
|
409
129
|
observer2.disconnect();
|
|
410
130
|
};
|
|
411
131
|
}, [callback, options]);
|
|
412
|
-
|
|
132
|
+
useEffect(() => {
|
|
413
133
|
if (observer) {
|
|
414
134
|
for (const element of elements) {
|
|
415
135
|
observer.observe(element);
|
|
@@ -475,10 +195,10 @@ function maxIndex(nums) {
|
|
|
475
195
|
}, void 0);
|
|
476
196
|
}
|
|
477
197
|
function useActiveSectionTracking(initialSections, onSectionChange, debug = false) {
|
|
478
|
-
const [sectionWrappers, setSectionWrappers] =
|
|
198
|
+
const [sectionWrappers, setSectionWrappers] = useState(
|
|
479
199
|
buildSectionTree(initialSections)
|
|
480
200
|
);
|
|
481
|
-
const sectionMeasurements =
|
|
201
|
+
const sectionMeasurements = useRef([]);
|
|
482
202
|
const setSections = useCallback(
|
|
483
203
|
(sections) => {
|
|
484
204
|
setSectionWrappers(buildSectionTree(sections));
|
|
@@ -528,7 +248,7 @@ function useActiveSectionTracking(initialSections, onSectionChange, debug = fals
|
|
|
528
248
|
return "0px";
|
|
529
249
|
}
|
|
530
250
|
});
|
|
531
|
-
debugNode = /* @__PURE__ */
|
|
251
|
+
debugNode = /* @__PURE__ */ jsx4(
|
|
532
252
|
"div",
|
|
533
253
|
{
|
|
534
254
|
style: {
|
|
@@ -556,17 +276,17 @@ var DesktopOutline = ({
|
|
|
556
276
|
className
|
|
557
277
|
}) => {
|
|
558
278
|
const renderToc = (sections) => {
|
|
559
|
-
return sections.map((item) => /* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
279
|
+
return sections.map((item) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
280
|
+
/* @__PURE__ */ jsx4(
|
|
561
281
|
"li",
|
|
562
282
|
{
|
|
563
283
|
"data-level": item.level,
|
|
564
|
-
className:
|
|
565
|
-
children: /* @__PURE__ */
|
|
284
|
+
className: cn2("text-sans-sm mb-0 list-none", item.level > 2 && "hidden"),
|
|
285
|
+
children: /* @__PURE__ */ jsx4(
|
|
566
286
|
"a",
|
|
567
287
|
{
|
|
568
288
|
href: `#${item.id}`,
|
|
569
|
-
className:
|
|
289
|
+
className: cn2(
|
|
570
290
|
"block border-l py-[4px] pr-4",
|
|
571
291
|
activeItem === item.id ? "active text-accent-secondary border-accent-secondary hover:text-accent" : "text-tertiary border-secondary hover:text-secondary"
|
|
572
292
|
),
|
|
@@ -582,7 +302,7 @@ var DesktopOutline = ({
|
|
|
582
302
|
] }, item.id));
|
|
583
303
|
};
|
|
584
304
|
if (toc && toc.length > 0) {
|
|
585
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ jsx4("ul", { className: cn2("toc w-(--toc-width)", className), children: renderToc(toc) });
|
|
586
306
|
}
|
|
587
307
|
return null;
|
|
588
308
|
};
|
|
@@ -591,20 +311,20 @@ var SmallScreenOutline = ({
|
|
|
591
311
|
activeItem,
|
|
592
312
|
className
|
|
593
313
|
}) => {
|
|
594
|
-
const [value, setValue] =
|
|
314
|
+
const [value, setValue] = useState("");
|
|
595
315
|
const renderToc = (sections) => {
|
|
596
|
-
return sections.map((item) => /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
316
|
+
return sections.map((item) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
317
|
+
/* @__PURE__ */ jsx4(
|
|
598
318
|
"li",
|
|
599
319
|
{
|
|
600
320
|
"data-level": item.level,
|
|
601
|
-
className:
|
|
602
|
-
children: /* @__PURE__ */
|
|
321
|
+
className: cn2("text-sans-sm list-none", item.level > 2 && "hidden"),
|
|
322
|
+
children: /* @__PURE__ */ jsx4(
|
|
603
323
|
"a",
|
|
604
324
|
{
|
|
605
325
|
href: `#${item.id}`,
|
|
606
326
|
onClick: () => setValue(""),
|
|
607
|
-
className:
|
|
327
|
+
className: cn2(
|
|
608
328
|
"block border-l py-[4px]",
|
|
609
329
|
activeItem === item.id ? "active text-accent-secondary border-accent-secondary hover:text-accent" : "text-tertiary border-secondary hover:text-secondary"
|
|
610
330
|
),
|
|
@@ -620,24 +340,24 @@ var SmallScreenOutline = ({
|
|
|
620
340
|
] }, item.id));
|
|
621
341
|
};
|
|
622
342
|
if (toc && toc.length > 0) {
|
|
623
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ jsx4(
|
|
624
344
|
Accordion.Root,
|
|
625
345
|
{
|
|
626
346
|
type: "single",
|
|
627
|
-
className:
|
|
347
|
+
className: cn2(
|
|
628
348
|
"toc bg-default border-secondary sticky top-[calc(var(--header-height)-1px)] z-10 -mt-px mb-10 block w-full border-b border-t print:hidden",
|
|
629
349
|
className
|
|
630
350
|
),
|
|
631
351
|
collapsible: true,
|
|
632
352
|
value,
|
|
633
353
|
onValueChange: setValue,
|
|
634
|
-
children: /* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
354
|
+
children: /* @__PURE__ */ jsxs3(Accordion.Item, { value: "toc", children: [
|
|
355
|
+
/* @__PURE__ */ jsx4(Accordion.Header, { children: /* @__PURE__ */ jsxs3(Accordion.Trigger, { className: "text-sans-md text-default hover:bg-hover px-(--container-px) flex h-12 w-full items-center justify-between [&>svg]:data-[state=open]:rotate-90", children: [
|
|
636
356
|
"Table of Contents",
|
|
637
357
|
" ",
|
|
638
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ jsx4(DirectionRightIcon_default, { className: "text-tertiary transition-all" })
|
|
639
359
|
] }) }),
|
|
640
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ jsx4(Accordion.Content, { className: "animated-accordion hydrated border-secondary px-(--container-px) max-h-[60vh] w-full overflow-y-scroll border-t", children: /* @__PURE__ */ jsx4("div", { className: "py-4", children: renderToc(toc) }) })
|
|
641
361
|
] })
|
|
642
362
|
}
|
|
643
363
|
);
|
|
@@ -646,9 +366,9 @@ var SmallScreenOutline = ({
|
|
|
646
366
|
};
|
|
647
367
|
|
|
648
368
|
// components/src/asciidoc/use-delegated-links.ts
|
|
649
|
-
import { useEffect as
|
|
369
|
+
import { useEffect as useEffect2 } from "react";
|
|
650
370
|
function useDelegatedReactRouterLinks(navigate, nodeRef, key) {
|
|
651
|
-
|
|
371
|
+
useEffect2(() => {
|
|
652
372
|
const node = nodeRef.current;
|
|
653
373
|
const handler = (event) => {
|
|
654
374
|
if (!nodeRef.current) return;
|
|
@@ -2225,8 +1945,8 @@ var handleDocument = async (document) => {
|
|
|
2225
1945
|
};
|
|
2226
1946
|
|
|
2227
1947
|
// components/src/asciidoc/index.tsx
|
|
2228
|
-
import { jsx as
|
|
2229
|
-
var MinimalDocument = ({ document }) => /* @__PURE__ */
|
|
1948
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1949
|
+
var MinimalDocument = ({ document }) => /* @__PURE__ */ jsx5("div", { id: "content", className: "asciidoc-body w-full", children: /* @__PURE__ */ jsx5(Content4, { blocks: document.blocks }) });
|
|
2230
1950
|
var AsciiDocBlocks = {
|
|
2231
1951
|
Admonition: Admonition_default,
|
|
2232
1952
|
Table: Table_default,
|
|
@@ -2301,132 +2021,18 @@ var InlineConverter = class {
|
|
|
2301
2021
|
return this.baseConverter.convert(node, transform);
|
|
2302
2022
|
}
|
|
2303
2023
|
};
|
|
2304
|
-
|
|
2305
|
-
// components/src/ui/listbox/Listbox.tsx
|
|
2306
|
-
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2307
|
-
var Listbox = ({
|
|
2308
|
-
name,
|
|
2309
|
-
selected,
|
|
2310
|
-
items,
|
|
2311
|
-
placeholder = "Select an option",
|
|
2312
|
-
className,
|
|
2313
|
-
onChange,
|
|
2314
|
-
hasError = false,
|
|
2315
|
-
disabled,
|
|
2316
|
-
isLoading = false,
|
|
2317
|
-
...props
|
|
2318
|
-
}) => {
|
|
2319
|
-
const { refs, floatingStyles } = useFloating({
|
|
2320
|
-
middleware: [
|
|
2321
|
-
offset(12),
|
|
2322
|
-
flip(),
|
|
2323
|
-
size({
|
|
2324
|
-
apply({ rects, elements }) {
|
|
2325
|
-
Object.assign(elements.floating.style, {
|
|
2326
|
-
width: `${rects.reference.width}px`
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
})
|
|
2330
|
-
]
|
|
2331
|
-
});
|
|
2332
|
-
const selectedItem = selected && items.find((i) => i.value === selected);
|
|
2333
|
-
const noItems = !isLoading && items.length === 0;
|
|
2334
|
-
const isDisabled = disabled || noItems;
|
|
2335
|
-
return /* @__PURE__ */ jsx11("div", { className: cn9("relative", className), children: /* @__PURE__ */ jsx11(
|
|
2336
|
-
Select,
|
|
2337
|
-
{
|
|
2338
|
-
value: selected,
|
|
2339
|
-
onChange: (val) => val !== null && onChange(val),
|
|
2340
|
-
disabled: isDisabled || isLoading,
|
|
2341
|
-
children: ({ open }) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2342
|
-
/* @__PURE__ */ jsxs7(
|
|
2343
|
-
Select.Button,
|
|
2344
|
-
{
|
|
2345
|
-
name,
|
|
2346
|
-
ref: refs.setReference,
|
|
2347
|
-
className: cn9(
|
|
2348
|
-
`text-sans-md flex h-10 w-full items-center justify-between rounded border`,
|
|
2349
|
-
hasError ? "focus-error border-error-secondary hover:border-error" : "border-default hover:border-hover",
|
|
2350
|
-
open && "ring-accent-secondary ring-2",
|
|
2351
|
-
open && hasError && "ring-error-secondary",
|
|
2352
|
-
isDisabled ? "text-disabled bg-disabled !border-default cursor-not-allowed" : "bg-default",
|
|
2353
|
-
isDisabled && hasError && "!border-error-secondary"
|
|
2354
|
-
),
|
|
2355
|
-
...props,
|
|
2356
|
-
children: [
|
|
2357
|
-
/* @__PURE__ */ jsx11("div", { className: "w-full px-3 text-left", children: selectedItem ? (
|
|
2358
|
-
// labelString is one line, which is what we need when label is a ReactNode
|
|
2359
|
-
selectedItem.labelString || selectedItem.label
|
|
2360
|
-
) : /* @__PURE__ */ jsx11("span", { className: "text-quaternary", children: noItems ? "No items" : placeholder }) }),
|
|
2361
|
-
!isDisabled && /* @__PURE__ */ jsx11(SpinnerLoader, { isLoading }),
|
|
2362
|
-
/* @__PURE__ */ jsx11(
|
|
2363
|
-
"div",
|
|
2364
|
-
{
|
|
2365
|
-
className: "border-secondary ml-3 flex h-[calc(100%-12px)] items-center border-l px-3",
|
|
2366
|
-
"aria-hidden": true,
|
|
2367
|
-
children: /* @__PURE__ */ jsx11(SelectArrows6Icon_default, { className: "text-tertiary h-[14px] w-2" })
|
|
2368
|
-
}
|
|
2369
|
-
)
|
|
2370
|
-
]
|
|
2371
|
-
}
|
|
2372
|
-
),
|
|
2373
|
-
/* @__PURE__ */ jsx11(FloatingPortal, { children: /* @__PURE__ */ jsx11(
|
|
2374
|
-
Select.Options,
|
|
2375
|
-
{
|
|
2376
|
-
ref: refs.setFloating,
|
|
2377
|
-
style: floatingStyles,
|
|
2378
|
-
className: "ox-menu pointer-events-auto z-50 overflow-y-auto !outline-none",
|
|
2379
|
-
children: items.map((item) => /* @__PURE__ */ jsx11(
|
|
2380
|
-
Select.Option,
|
|
2381
|
-
{
|
|
2382
|
-
value: item.value,
|
|
2383
|
-
className: "border-secondary relative border-b last:border-0",
|
|
2384
|
-
children: ({ active, selected: selected2 }) => /* @__PURE__ */ jsx11(
|
|
2385
|
-
"div",
|
|
2386
|
-
{
|
|
2387
|
-
className: cn9(
|
|
2388
|
-
"ox-menu-item text-secondary",
|
|
2389
|
-
selected2 && "is-selected",
|
|
2390
|
-
active && "is-highlighted"
|
|
2391
|
-
),
|
|
2392
|
-
children: item.label
|
|
2393
|
-
}
|
|
2394
|
-
)
|
|
2395
|
-
},
|
|
2396
|
-
item.value
|
|
2397
|
-
))
|
|
2398
|
-
}
|
|
2399
|
-
) })
|
|
2400
|
-
] })
|
|
2401
|
-
}
|
|
2402
|
-
) });
|
|
2403
|
-
};
|
|
2404
|
-
|
|
2405
2024
|
export {
|
|
2406
|
-
|
|
2407
|
-
useActiveSectionTracking,
|
|
2025
|
+
AsciiDocBlocks,
|
|
2408
2026
|
DesktopOutline,
|
|
2027
|
+
InlineConverter,
|
|
2409
2028
|
SmallScreenOutline,
|
|
2410
|
-
useDelegatedReactRouterLinks,
|
|
2411
|
-
highlight,
|
|
2412
2029
|
attrs,
|
|
2413
|
-
loadAsciidoctor,
|
|
2414
2030
|
handleDocument,
|
|
2415
|
-
|
|
2031
|
+
highlight,
|
|
2032
|
+
loadAsciidoctor,
|
|
2416
2033
|
renderWithBreaks,
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
buttonSizes,
|
|
2421
|
-
variants,
|
|
2422
|
-
buttonStyle,
|
|
2423
|
-
Button,
|
|
2424
|
-
spinnerSizes,
|
|
2425
|
-
spinnerVariants,
|
|
2426
|
-
Spinner,
|
|
2427
|
-
SpinnerLoader,
|
|
2428
|
-
Tabs,
|
|
2429
|
-
Checkbox,
|
|
2430
|
-
Listbox
|
|
2034
|
+
useActiveSectionTracking,
|
|
2035
|
+
useDelegatedReactRouterLinks,
|
|
2036
|
+
useIntersectionObserver
|
|
2431
2037
|
};
|
|
2432
|
-
//# sourceMappingURL=
|
|
2038
|
+
//# sourceMappingURL=index.js.map
|