@oxide/design-system 3.2.0--canary.151.18510677674.0 → 4.0.0--canary.151.18511380774.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.
@@ -1,51 +1,17 @@
1
+ import {
2
+ titleCase
3
+ } from "../../../chunk-7VKKHVZC.js";
4
+ import {
5
+ DirectionRightIcon_default,
6
+ Link16Icon_default
7
+ } from "../../../chunk-BTKC2KJ2.js";
8
+
1
9
  // components/src/asciidoc/index.tsx
2
10
  import asciidoctor2 from "@asciidoctor/core";
3
11
  import { Content as Content4 } from "@oxide/react-asciidoc";
4
12
 
5
13
  // components/src/asciidoc/Admonition.tsx
6
14
  import { Content, parse, Title } from "@oxide/react-asciidoc";
7
-
8
- // components/src/utils.ts
9
- import cn from "classnames";
10
- import { createElement } from "react";
11
- var titleCase = (text) => {
12
- return text.replace(
13
- /\w\S*/g,
14
- (text2) => text2.charAt(0).toUpperCase() + text2.substring(1).toLowerCase()
15
- );
16
- };
17
- var make = (tag) => (
18
- // only one argument here means string interpolations are not allowed
19
- (strings) => {
20
- const Comp = ({ className, children, ...rest }) => createElement(tag, { className: cn(strings[0], className), ...rest }, children);
21
- Comp.displayName = `classed.${tag}`;
22
- return Comp;
23
- }
24
- );
25
- var classed = {
26
- button: make("button"),
27
- div: make("div"),
28
- h1: make("h1"),
29
- h2: make("h2"),
30
- h3: make("h3"),
31
- h4: make("h4"),
32
- hr: make("hr"),
33
- header: make("header"),
34
- input: make("input"),
35
- label: make("label"),
36
- li: make("li"),
37
- main: make("main"),
38
- ol: make("ol"),
39
- p: make("p"),
40
- span: make("span"),
41
- table: make("table"),
42
- tbody: make("tbody"),
43
- td: make("td"),
44
- th: make("th"),
45
- tr: make("tr")
46
- };
47
-
48
- // components/src/asciidoc/Admonition.tsx
49
15
  import { jsx, jsxs } from "react/jsx-runtime";
50
16
  var Admonition = ({ node }) => {
51
17
  const attrs2 = node.attributes;
@@ -110,150 +76,33 @@ var Warning12 = ({ className }) => /* @__PURE__ */ jsx(
110
76
  );
111
77
  var Admonition_default = Admonition;
112
78
 
113
- // icons/react/Link16Icon.tsx
114
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
115
- var Link16Icon = ({ title, titleId, ...props }) => /* @__PURE__ */ jsxs2(
116
- "svg",
117
- {
118
- xmlns: "http://www.w3.org/2000/svg",
119
- width: 16,
120
- height: 16,
121
- viewBox: "0 0 16 16",
122
- role: "img",
123
- "aria-labelledby": titleId,
124
- ...props,
125
- children: [
126
- title ? /* @__PURE__ */ jsx2("title", { id: titleId, children: title }) : null,
127
- /* @__PURE__ */ jsxs2("g", { fill: "currentColor", children: [
128
- /* @__PURE__ */ jsx2("path", { d: "m6.586 12.243 1.59-1.591a.75.75 0 0 1 1.061 0l.354.353a.75.75 0 0 1 0 1.06L8 13.658A4 4 0 0 1 2.343 8l1.591-1.591a.75.75 0 0 1 1.06 0l.354.354a.75.75 0 0 1 0 1.06l-1.59 1.591a2 2 0 1 0 2.828 2.829M12.066 9.591a.75.75 0 0 1-1.06 0l-.354-.354a.75.75 0 0 1 0-1.06l1.59-1.591a2 2 0 1 0-2.828-2.829l-1.59 1.591a.75.75 0 0 1-1.061 0l-.354-.353a.75.75 0 0 1 0-1.06L8 2.342A4 4 0 0 1 13.657 8z" }),
129
- /* @__PURE__ */ jsx2("path", { d: "M9.945 5.702a.75.75 0 0 0-1.061 0L5.702 8.884a.75.75 0 0 0 0 1.06l.353.354a.75.75 0 0 0 1.061 0l3.182-3.182a.75.75 0 0 0 0-1.06z" })
130
- ] })
131
- ]
132
- }
133
- );
134
- var Link16Icon_default = Link16Icon;
135
-
136
- // icons/react/Checkmark12Icon.tsx
137
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
138
- var Checkmark12Icon = ({
139
- title,
140
- titleId,
141
- ...props
142
- }) => /* @__PURE__ */ jsxs3(
143
- "svg",
144
- {
145
- xmlns: "http://www.w3.org/2000/svg",
146
- width: 12,
147
- height: 12,
148
- viewBox: "0 0 12 12",
149
- role: "img",
150
- "aria-labelledby": titleId,
151
- ...props,
152
- children: [
153
- title ? /* @__PURE__ */ jsx3("title", { id: titleId, children: title }) : null,
154
- /* @__PURE__ */ jsx3(
155
- "path",
156
- {
157
- fill: "currentColor",
158
- fillRule: "evenodd",
159
- d: "M10.492 2.651c.28.242.31.665.067.944L5.448 9.463a.667.667 0 0 1-.974.035L1.475 6.516a.667.667 0 0 1 0-.946l.237-.235a.667.667 0 0 1 .94 0l2.24 2.226L9.3 2.501a.667.667 0 0 1 .938-.068z",
160
- clipRule: "evenodd"
161
- }
162
- )
163
- ]
164
- }
165
- );
166
- var Checkmark12Icon_default = Checkmark12Icon;
167
-
168
- // icons/react/DirectionRightIcon.tsx
169
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
170
- var DirectionRightIcon = ({
171
- title,
172
- titleId,
173
- ...props
174
- }) => /* @__PURE__ */ jsxs4(
175
- "svg",
176
- {
177
- xmlns: "http://www.w3.org/2000/svg",
178
- width: 12,
179
- height: 12,
180
- viewBox: "0 0 12 12",
181
- role: "img",
182
- "aria-labelledby": titleId,
183
- ...props,
184
- children: [
185
- title ? /* @__PURE__ */ jsx4("title", { id: titleId, children: title }) : null,
186
- /* @__PURE__ */ jsx4(
187
- "path",
188
- {
189
- fill: "currentColor",
190
- d: "M8.807 6.597a.667.667 0 0 0 0-1.194l-5.842-2.92A.667.667 0 0 0 2 3.079v5.842c0 .496.522.818.965.596z"
191
- }
192
- )
193
- ]
194
- }
195
- );
196
- var DirectionRightIcon_default = DirectionRightIcon;
197
-
198
- // icons/react/SelectArrows6Icon.tsx
199
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
200
- var SelectArrows6Icon = ({
201
- title,
202
- titleId,
203
- ...props
204
- }) => /* @__PURE__ */ jsxs5(
205
- "svg",
206
- {
207
- xmlns: "http://www.w3.org/2000/svg",
208
- width: 6,
209
- height: 14,
210
- viewBox: "0 0 6 14",
211
- role: "img",
212
- "aria-labelledby": titleId,
213
- ...props,
214
- children: [
215
- title ? /* @__PURE__ */ jsx5("title", { id: titleId, children: title }) : null,
216
- /* @__PURE__ */ jsx5(
217
- "path",
218
- {
219
- fill: "currentColor",
220
- fillRule: "evenodd",
221
- d: "M3.322.536a.375.375 0 0 0-.644 0L.341 4.432C.19 4.682.37 5 .662 5h4.676a.375.375 0 0 0 .321-.568zm-.644 12.928a.375.375 0 0 0 .644 0l2.337-3.896A.375.375 0 0 0 5.338 9H.662a.375.375 0 0 0-.321.568z",
222
- clipRule: "evenodd"
223
- }
224
- )
225
- ]
226
- }
227
- );
228
- var SelectArrows6Icon_default = SelectArrows6Icon;
229
-
230
79
  // components/src/asciidoc/Section.tsx
231
80
  import { Content as Content2, parse as parse2 } from "@oxide/react-asciidoc";
232
- import cn2 from "classnames";
233
- import { createElement as createElement2 } from "react";
234
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
81
+ import cn from "classnames";
82
+ import { createElement } from "react";
83
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
235
84
  var stripAnchors = (str) => str.replace(/<a[^>]*>(.*?)<\/a>/gi, "$1");
236
85
  var Section = ({ node }) => {
237
86
  const level = node.level;
238
87
  let title = "";
239
88
  let sectNum = node.num;
240
89
  sectNum = sectNum && sectNum[0] === "." ? "" : sectNum;
241
- title = /* @__PURE__ */ jsxs6(Fragment, { children: [
242
- /* @__PURE__ */ jsx6("span", { className: "anchor", id: node.id || "", "aria-hidden": "true" }),
243
- /* @__PURE__ */ jsxs6("a", { className: "link group", href: `#${node.id}`, children: [
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: [
244
93
  parse2(stripAnchors(node.title)),
245
- /* @__PURE__ */ jsx6(Link16Icon_default, { className: "text-accent-secondary ml-2 hidden group-hover:inline-block" })
94
+ /* @__PURE__ */ jsx2(Link16Icon_default, { className: "text-accent-secondary ml-2 hidden group-hover:inline-block" })
246
95
  ] })
247
96
  ] });
248
97
  if (level === 0) {
249
- return /* @__PURE__ */ jsxs6(Fragment, { children: [
250
- /* @__PURE__ */ jsx6("h1", { className: cn2("sect0", node.role), "data-sectnum": sectNum, children: title }),
251
- /* @__PURE__ */ jsx6(Content2, { blocks: node.blocks })
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 })
252
101
  ] });
253
102
  } else {
254
- return /* @__PURE__ */ jsxs6("div", { className: cn2(`sect${level}`, node.role), children: [
255
- createElement2(`h${level + 1}`, { "data-sectnum": sectNum }, title),
256
- /* @__PURE__ */ jsx6("div", { className: "sectionbody", children: /* @__PURE__ */ jsx6(Content2, { blocks: node.blocks }) })
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 }) })
257
106
  ] });
258
107
  }
259
108
  };
@@ -261,16 +110,16 @@ var Section_default = Section;
261
110
 
262
111
  // components/src/asciidoc/Table.tsx
263
112
  import { Table as InnerTable } from "@oxide/react-asciidoc";
264
- import { jsx as jsx7 } from "react/jsx-runtime";
265
- var Table = ({ node }) => /* @__PURE__ */ jsx7("div", { className: "table-wrapper", children: /* @__PURE__ */ jsx7(InnerTable, { node }) });
113
+ import { jsx as jsx3 } from "react/jsx-runtime";
114
+ var Table = ({ node }) => /* @__PURE__ */ jsx3("div", { className: "table-wrapper", children: /* @__PURE__ */ jsx3(InnerTable, { node }) });
266
115
  var Table_default = Table;
267
116
 
268
117
  // components/src/asciidoc/TableOfContents.tsx
269
118
  import { parse as parse3 } from "@oxide/react-asciidoc";
270
119
  import * as Accordion from "@radix-ui/react-accordion";
271
- import cn3 from "classnames";
120
+ import cn2 from "classnames";
272
121
  import { Fragment as Fragment2, useCallback, useEffect, useMemo, useRef, useState } from "react";
273
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
122
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
274
123
  function useIntersectionObserver(elements, callback, options) {
275
124
  const [observer, setObserver] = useState(null);
276
125
  useEffect(() => {
@@ -399,7 +248,7 @@ function useActiveSectionTracking(initialSections, onSectionChange, debug = fals
399
248
  return "0px";
400
249
  }
401
250
  });
402
- debugNode = /* @__PURE__ */ jsx8(
251
+ debugNode = /* @__PURE__ */ jsx4(
403
252
  "div",
404
253
  {
405
254
  style: {
@@ -427,17 +276,17 @@ var DesktopOutline = ({
427
276
  className
428
277
  }) => {
429
278
  const renderToc = (sections) => {
430
- return sections.map((item) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
431
- /* @__PURE__ */ jsx8(
279
+ return sections.map((item) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
280
+ /* @__PURE__ */ jsx4(
432
281
  "li",
433
282
  {
434
283
  "data-level": item.level,
435
- className: cn3("text-sans-sm mb-0 list-none", item.level > 2 && "hidden"),
436
- children: /* @__PURE__ */ jsx8(
284
+ className: cn2("text-sans-sm mb-0 list-none", item.level > 2 && "hidden"),
285
+ children: /* @__PURE__ */ jsx4(
437
286
  "a",
438
287
  {
439
288
  href: `#${item.id}`,
440
- className: cn3(
289
+ className: cn2(
441
290
  "block border-l py-[4px] pr-4",
442
291
  activeItem === item.id ? "active text-accent-secondary border-accent-secondary hover:text-accent" : "text-tertiary border-secondary hover:text-secondary"
443
292
  ),
@@ -453,7 +302,7 @@ var DesktopOutline = ({
453
302
  ] }, item.id));
454
303
  };
455
304
  if (toc && toc.length > 0) {
456
- return /* @__PURE__ */ jsx8("ul", { className: cn3("toc w-(--toc-width)", className), children: renderToc(toc) });
305
+ return /* @__PURE__ */ jsx4("ul", { className: cn2("toc w-(--toc-width)", className), children: renderToc(toc) });
457
306
  }
458
307
  return null;
459
308
  };
@@ -464,18 +313,18 @@ var SmallScreenOutline = ({
464
313
  }) => {
465
314
  const [value, setValue] = useState("");
466
315
  const renderToc = (sections) => {
467
- return sections.map((item) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
468
- /* @__PURE__ */ jsx8(
316
+ return sections.map((item) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
317
+ /* @__PURE__ */ jsx4(
469
318
  "li",
470
319
  {
471
320
  "data-level": item.level,
472
- className: cn3("text-sans-sm list-none", item.level > 2 && "hidden"),
473
- children: /* @__PURE__ */ jsx8(
321
+ className: cn2("text-sans-sm list-none", item.level > 2 && "hidden"),
322
+ children: /* @__PURE__ */ jsx4(
474
323
  "a",
475
324
  {
476
325
  href: `#${item.id}`,
477
326
  onClick: () => setValue(""),
478
- className: cn3(
327
+ className: cn2(
479
328
  "block border-l py-[4px]",
480
329
  activeItem === item.id ? "active text-accent-secondary border-accent-secondary hover:text-accent" : "text-tertiary border-secondary hover:text-secondary"
481
330
  ),
@@ -491,24 +340,24 @@ var SmallScreenOutline = ({
491
340
  ] }, item.id));
492
341
  };
493
342
  if (toc && toc.length > 0) {
494
- return /* @__PURE__ */ jsx8(
343
+ return /* @__PURE__ */ jsx4(
495
344
  Accordion.Root,
496
345
  {
497
346
  type: "single",
498
- className: cn3(
347
+ className: cn2(
499
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",
500
349
  className
501
350
  ),
502
351
  collapsible: true,
503
352
  value,
504
353
  onValueChange: setValue,
505
- children: /* @__PURE__ */ jsxs7(Accordion.Item, { value: "toc", children: [
506
- /* @__PURE__ */ jsx8(Accordion.Header, { children: /* @__PURE__ */ jsxs7(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: [
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: [
507
356
  "Table of Contents",
508
357
  " ",
509
- /* @__PURE__ */ jsx8(DirectionRightIcon_default, { className: "text-tertiary transition-all" })
358
+ /* @__PURE__ */ jsx4(DirectionRightIcon_default, { className: "text-tertiary transition-all" })
510
359
  ] }) }),
511
- /* @__PURE__ */ jsx8(Accordion.Content, { className: "animated-accordion hydrated border-secondary px-(--container-px) max-h-[60vh] w-full overflow-y-scroll border-t", children: /* @__PURE__ */ jsx8("div", { className: "py-4", children: renderToc(toc) }) })
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) }) })
512
361
  ] })
513
362
  }
514
363
  );
@@ -2096,8 +1945,8 @@ var handleDocument = async (document) => {
2096
1945
  };
2097
1946
 
2098
1947
  // components/src/asciidoc/index.tsx
2099
- import { jsx as jsx9 } from "react/jsx-runtime";
2100
- var MinimalDocument = ({ document }) => /* @__PURE__ */ jsx9("div", { id: "content", className: "asciidoc-body w-full", children: /* @__PURE__ */ jsx9(Content4, { blocks: document.blocks }) });
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 }) });
2101
1950
  var AsciiDocBlocks = {
2102
1951
  Admonition: Admonition_default,
2103
1952
  Table: Table_default,
@@ -2172,368 +2021,18 @@ var InlineConverter = class {
2172
2021
  return this.baseConverter.convert(node, transform);
2173
2022
  }
2174
2023
  };
2175
-
2176
- // components/src/ui/badge/Badge.tsx
2177
- import cn4 from "classnames";
2178
- import { jsx as jsx10 } from "react/jsx-runtime";
2179
- var badgeColors = {
2180
- default: {
2181
- default: "bg-accent-secondary text-accent ring-accent/15",
2182
- destructive: "bg-destructive-secondary text-destructive ring-destructive/15",
2183
- notice: "bg-notice-secondary text-notice ring-notice/15",
2184
- blue: "bg-blue-200 text-blue-800 ring-blue-800/15",
2185
- purple: "bg-purple-200 text-purple-800 ring-purple-800/15",
2186
- neutral: "bg-secondary text-default ring-neutral-700/15"
2187
- },
2188
- solid: {
2189
- default: "bg-accent text-inverse",
2190
- destructive: "bg-destructive text-inverse",
2191
- notice: "bg-notice text-inverse",
2192
- neutral: "bg-inverse-tertiary text-inverse",
2193
- purple: "bg-purple-700 text-inverse",
2194
- blue: "bg-info text-inverse"
2195
- }
2196
- };
2197
- var Badge = ({
2198
- className,
2199
- children,
2200
- color = "default",
2201
- variant = "default"
2202
- }) => {
2203
- return /* @__PURE__ */ jsx10(
2204
- "span",
2205
- {
2206
- className: cn4(
2207
- "ox-badge ring ring-inset",
2208
- `variant-${variant}`,
2209
- "text-mono-sm inline-flex h-4 items-center whitespace-nowrap rounded-sm px-[3px] py-[1px] uppercase",
2210
- badgeColors[variant][color],
2211
- className
2212
- ),
2213
- children: /* @__PURE__ */ jsx10("span", { children })
2214
- }
2215
- );
2216
- };
2217
-
2218
- // components/src/ui/button/Button.tsx
2219
- import cn5 from "classnames";
2220
- import { forwardRef } from "react";
2221
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
2222
- var buttonSizes = ["sm", "icon", "base"];
2223
- var variants = ["primary", "secondary", "ghost", "danger"];
2224
- var sizeStyle = {
2225
- sm: "h-8 px-3 text-mono-sm svg:w-4",
2226
- // meant for buttons that only contain a single icon
2227
- icon: "h-8 w-8 text-mono-sm svg:w-4",
2228
- base: "h-10 px-4 text-mono-sm svg:w-5"
2229
- };
2230
- var buttonStyle = ({
2231
- size: size2 = "base",
2232
- variant = "primary"
2233
- } = {}) => {
2234
- return cn5(
2235
- "ox-button inline-flex items-center justify-center rounded align-top elevation-1 disabled:cursor-not-allowed",
2236
- `btn-${variant}`,
2237
- sizeStyle[size2],
2238
- variant === "danger" ? "focus:outline-destructive-secondary" : "focus:outline-accent-secondary"
2239
- );
2240
- };
2241
- var noop = (e) => {
2242
- e.stopPropagation();
2243
- e.preventDefault();
2244
- };
2245
- var Button = forwardRef(
2246
- ({
2247
- type = "button",
2248
- children,
2249
- size: size2,
2250
- variant,
2251
- className,
2252
- loading,
2253
- innerClassName,
2254
- disabled,
2255
- onClick,
2256
- // needs to be a spread because we sometimes get passed arbitrary <button>
2257
- // props by the parent
2258
- ...rest
2259
- }, ref) => {
2260
- const isDisabled = disabled || loading;
2261
- return /* @__PURE__ */ jsxs8(
2262
- "button",
2263
- {
2264
- className: cn5(buttonStyle({ size: size2, variant }), className, {
2265
- "visually-disabled": isDisabled
2266
- }),
2267
- ref,
2268
- type,
2269
- onMouseDown: isDisabled ? noop : void 0,
2270
- onClick: isDisabled ? noop : onClick,
2271
- "aria-disabled": isDisabled,
2272
- ...rest,
2273
- children: [
2274
- loading && /* @__PURE__ */ jsx11(Spinner, { className: "absolute", variant }),
2275
- /* @__PURE__ */ jsx11("span", { className: cn5("flex items-center", innerClassName, { invisible: loading }), children })
2276
- ]
2277
- }
2278
- );
2279
- }
2280
- );
2281
-
2282
- // components/src/ui/spinner/Spinner.tsx
2283
- import cn6 from "classnames";
2284
- import { useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
2285
- import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2286
- var spinnerSizes = ["base", "lg"];
2287
- var spinnerVariants = ["primary", "secondary", "ghost", "danger"];
2288
- var Spinner = ({
2289
- className,
2290
- size: size2 = "base",
2291
- variant = "primary"
2292
- }) => {
2293
- const frameSize = size2 === "lg" ? 36 : 12;
2294
- const center = size2 === "lg" ? 18 : 6;
2295
- const radius = size2 === "lg" ? 16 : 5;
2296
- const strokeWidth = size2 === "lg" ? 3 : 2;
2297
- return /* @__PURE__ */ jsxs9(
2298
- "svg",
2299
- {
2300
- width: frameSize,
2301
- height: frameSize,
2302
- viewBox: `0 0 ${frameSize + " " + frameSize}`,
2303
- fill: "none",
2304
- xmlns: "http://www.w3.org/2000/svg",
2305
- "aria-labelledby": "Spinner",
2306
- className: cn6("spinner", `spinner-${variant}`, `spinner-${size2}`, className),
2307
- children: [
2308
- /* @__PURE__ */ jsx12(
2309
- "circle",
2310
- {
2311
- fill: "none",
2312
- className: "bg",
2313
- strokeWidth,
2314
- strokeLinecap: "round",
2315
- cx: center,
2316
- cy: center,
2317
- r: radius,
2318
- strokeOpacity: 0.2
2319
- }
2320
- ),
2321
- /* @__PURE__ */ jsx12(
2322
- "circle",
2323
- {
2324
- className: "path",
2325
- fill: "none",
2326
- stroke: "currentColor",
2327
- strokeWidth,
2328
- strokeLinecap: "round",
2329
- cx: center,
2330
- cy: center,
2331
- r: radius
2332
- }
2333
- )
2334
- ]
2335
- }
2336
- );
2337
- };
2338
- var SpinnerLoader = ({ isLoading, children = null, minTime = 500 }) => {
2339
- const [isVisible, setIsVisible] = useState2(isLoading);
2340
- const hideTimeout = useRef2(null);
2341
- const loadingStartTime = useRef2(0);
2342
- useEffect3(() => {
2343
- if (isLoading) {
2344
- setIsVisible(true);
2345
- loadingStartTime.current = Date.now();
2346
- } else {
2347
- if (hideTimeout.current) clearTimeout(hideTimeout.current);
2348
- const elapsedTime = Date.now() - loadingStartTime.current;
2349
- const remainingTime = Math.max(0, minTime - elapsedTime);
2350
- if (remainingTime === 0) {
2351
- setIsVisible(false);
2352
- } else {
2353
- hideTimeout.current = setTimeout(() => setIsVisible(false), remainingTime);
2354
- }
2355
- }
2356
- return () => {
2357
- if (hideTimeout.current) clearTimeout(hideTimeout.current);
2358
- };
2359
- }, [isLoading, minTime]);
2360
- return isVisible ? /* @__PURE__ */ jsx12(Spinner, {}) : /* @__PURE__ */ jsx12(Fragment3, { children });
2361
- };
2362
-
2363
- // components/src/ui/tabs/Tabs.tsx
2364
- import { Content as Content5, List, Root as Root2, Trigger as Trigger2 } from "@radix-ui/react-tabs";
2365
- import cn7 from "classnames";
2366
- import { jsx as jsx13 } from "react/jsx-runtime";
2367
- var Tabs = {
2368
- Root: ({ className, ...props }) => /* @__PURE__ */ jsx13(Root2, { ...props, className: cn7("ox-tabs", className) }),
2369
- Trigger: ({ children, className, ...props }) => /* @__PURE__ */ jsx13(Trigger2, { ...props, className: cn7("ox-tab", className), children: /* @__PURE__ */ jsx13("div", { children }) }),
2370
- List: ({ className, ...props }) => /* @__PURE__ */ jsx13(List, { ...props, className: cn7("ox-tabs-list", className) }),
2371
- Content: ({ className, ...props }) => /* @__PURE__ */ jsx13(Content5, { ...props, className: cn7("ox-tabs-panel", className) })
2372
- };
2373
-
2374
- // components/src/ui/checkbox/Checkbox.tsx
2375
- import cn8 from "classnames";
2376
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
2377
- var Check = () => /* @__PURE__ */ jsx14(Checkmark12Icon_default, { className: "text-accent pointer-events-none absolute left-0.5 top-0.5 h-3 w-3 fill-current" });
2378
- var Indeterminate = classed.div`absolute w-2 h-0.5 left-1 top-[7px] bg-accent pointer-events-none`;
2379
- var inputStyle = `
2380
- appearance-none border border-default bg-default h-4 w-4 rounded-sm absolute left-0 outline-none
2381
- disabled:cursor-not-allowed
2382
- hover:border-hover hover:cursor-pointer
2383
- checked:bg-accent-secondary checked:border-accent-secondary checked:hover:border-accent
2384
- indeterminate:bg-accent-secondary indeterminate:border-accent hover:indeterminate:bg-accent-secondary-hover
2385
- `;
2386
- var Checkbox = ({
2387
- indeterminate,
2388
- children,
2389
- className,
2390
- ...inputProps
2391
- }) => /* @__PURE__ */ jsxs10("label", { className: "inline-flex items-center", children: [
2392
- /* @__PURE__ */ jsxs10("span", { className: "relative h-4 w-4", children: [
2393
- /* @__PURE__ */ jsx14(
2394
- "input",
2395
- {
2396
- className: cn8(inputStyle, className),
2397
- type: "checkbox",
2398
- ref: (el) => {
2399
- if (el) el.indeterminate = !!indeterminate;
2400
- },
2401
- ...inputProps
2402
- }
2403
- ),
2404
- inputProps.checked && !indeterminate && /* @__PURE__ */ jsx14(Check, {}),
2405
- indeterminate && /* @__PURE__ */ jsx14(Indeterminate, {})
2406
- ] }),
2407
- children && /* @__PURE__ */ jsx14("span", { className: "text-sans-md text-secondary ml-2.5", children })
2408
- ] });
2409
-
2410
- // components/src/ui/listbox/Listbox.tsx
2411
- import { flip, FloatingPortal, offset, size, useFloating } from "@floating-ui/react";
2412
- import { Listbox as Select } from "@headlessui/react";
2413
- import cn9 from "classnames";
2414
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2415
- var Listbox = ({
2416
- name,
2417
- selected,
2418
- items,
2419
- placeholder = "Select an option",
2420
- className,
2421
- onChange,
2422
- hasError = false,
2423
- disabled,
2424
- isLoading = false,
2425
- ...props
2426
- }) => {
2427
- const { refs, floatingStyles } = useFloating({
2428
- middleware: [
2429
- offset(12),
2430
- flip(),
2431
- size({
2432
- apply({ rects, elements }) {
2433
- Object.assign(elements.floating.style, {
2434
- width: `${rects.reference.width}px`
2435
- });
2436
- }
2437
- })
2438
- ]
2439
- });
2440
- const selectedItem = selected && items.find((i) => i.value === selected);
2441
- const noItems = !isLoading && items.length === 0;
2442
- const isDisabled = disabled || noItems;
2443
- return /* @__PURE__ */ jsx15("div", { className: cn9("relative", className), children: /* @__PURE__ */ jsx15(
2444
- Select,
2445
- {
2446
- value: selected,
2447
- onChange: (val) => val !== null && onChange(val),
2448
- disabled: isDisabled || isLoading,
2449
- children: ({ open }) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
2450
- /* @__PURE__ */ jsxs11(
2451
- Select.Button,
2452
- {
2453
- name,
2454
- ref: refs.setReference,
2455
- className: cn9(
2456
- `text-sans-md flex h-10 w-full items-center justify-between rounded border`,
2457
- hasError ? "focus-error border-error-secondary hover:border-error" : "border-default hover:border-hover",
2458
- open && "ring-accent-secondary ring-2",
2459
- open && hasError && "ring-error-secondary",
2460
- isDisabled ? "text-disabled bg-disabled !border-default cursor-not-allowed" : "bg-default",
2461
- isDisabled && hasError && "!border-error-secondary"
2462
- ),
2463
- ...props,
2464
- children: [
2465
- /* @__PURE__ */ jsx15("div", { className: "w-full px-3 text-left", children: selectedItem ? (
2466
- // labelString is one line, which is what we need when label is a ReactNode
2467
- selectedItem.labelString || selectedItem.label
2468
- ) : /* @__PURE__ */ jsx15("span", { className: "text-quaternary", children: noItems ? "No items" : placeholder }) }),
2469
- !isDisabled && /* @__PURE__ */ jsx15(SpinnerLoader, { isLoading }),
2470
- /* @__PURE__ */ jsx15(
2471
- "div",
2472
- {
2473
- className: "border-secondary ml-3 flex h-[calc(100%-12px)] items-center border-l px-3",
2474
- "aria-hidden": true,
2475
- children: /* @__PURE__ */ jsx15(SelectArrows6Icon_default, { className: "text-tertiary h-[14px] w-2" })
2476
- }
2477
- )
2478
- ]
2479
- }
2480
- ),
2481
- /* @__PURE__ */ jsx15(FloatingPortal, { children: /* @__PURE__ */ jsx15(
2482
- Select.Options,
2483
- {
2484
- ref: refs.setFloating,
2485
- style: floatingStyles,
2486
- className: "ox-menu pointer-events-auto z-50 overflow-y-auto !outline-none",
2487
- children: items.map((item) => /* @__PURE__ */ jsx15(
2488
- Select.Option,
2489
- {
2490
- value: item.value,
2491
- className: "border-secondary relative border-b last:border-0",
2492
- children: ({ active, selected: selected2 }) => /* @__PURE__ */ jsx15(
2493
- "div",
2494
- {
2495
- className: cn9(
2496
- "ox-menu-item text-secondary",
2497
- selected2 && "is-selected",
2498
- active && "is-highlighted"
2499
- ),
2500
- children: item.label
2501
- }
2502
- )
2503
- },
2504
- item.value
2505
- ))
2506
- }
2507
- ) })
2508
- ] })
2509
- }
2510
- ) });
2511
- };
2512
2024
  export {
2513
2025
  AsciiDocBlocks,
2514
- Badge,
2515
- Button,
2516
- Checkbox,
2517
2026
  DesktopOutline,
2518
2027
  InlineConverter,
2519
- Listbox,
2520
2028
  SmallScreenOutline,
2521
- Spinner,
2522
- SpinnerLoader,
2523
- Tabs,
2524
2029
  attrs,
2525
- badgeColors,
2526
- buttonSizes,
2527
- buttonStyle,
2528
2030
  handleDocument,
2529
2031
  highlight,
2530
2032
  loadAsciidoctor,
2531
2033
  renderWithBreaks,
2532
- spinnerSizes,
2533
- spinnerVariants,
2534
2034
  useActiveSectionTracking,
2535
2035
  useDelegatedReactRouterLinks,
2536
- useIntersectionObserver,
2537
- variants
2036
+ useIntersectionObserver
2538
2037
  };
2539
2038
  //# sourceMappingURL=index.js.map