@dreamlake/dockit 0.2.15 → 0.2.17
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,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { Chip } from "./Chip.js";
|
|
4
|
+
import { Table } from "./Table.js";
|
|
4
5
|
const STATUS_COLOR = {
|
|
5
6
|
pass: "oklch(62% .15 145)",
|
|
6
7
|
fail: "oklch(58% .19 25)",
|
|
@@ -153,13 +154,13 @@ function StatusTable({ kind = "suites" }) {
|
|
|
153
154
|
]
|
|
154
155
|
}
|
|
155
156
|
),
|
|
156
|
-
/* @__PURE__ */ jsxs(
|
|
157
|
+
/* @__PURE__ */ jsxs(Table, { children: [
|
|
157
158
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
158
|
-
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Status" }),
|
|
159
|
-
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: kind === "suites" ? "Suite" : "Example" }),
|
|
160
|
-
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: kind === "suites" ? "Command" : "Description" }),
|
|
161
|
-
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, textAlign: "right", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Tests" }),
|
|
162
|
-
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, textAlign: "right", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Time" })
|
|
159
|
+
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, borderBottom: 0, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Status" }),
|
|
160
|
+
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, borderBottom: 0, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: kind === "suites" ? "Suite" : "Example" }),
|
|
161
|
+
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, borderBottom: 0, textAlign: "left", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: kind === "suites" ? "Command" : "Description" }),
|
|
162
|
+
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, borderBottom: 0, textAlign: "right", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Tests" }),
|
|
163
|
+
/* @__PURE__ */ jsx("th", { style: { ...cellStyle, ...monoStyle, borderBottom: 0, textAlign: "right", textTransform: "uppercase", letterSpacing: "0.12em", fontSize: 10 }, children: "Time" })
|
|
163
164
|
] }) }),
|
|
164
165
|
/* @__PURE__ */ jsx("tbody", { children: kind === "suites" ? items.map((s) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
165
166
|
/* @__PURE__ */ jsx("td", { style: cellStyle, children: /* @__PURE__ */ jsx(StatusBadge, { status: s.status }) }),
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useId } from "react";
|
|
3
|
+
function Table({
|
|
4
|
+
children,
|
|
5
|
+
className,
|
|
6
|
+
style,
|
|
7
|
+
id,
|
|
8
|
+
...rest
|
|
9
|
+
}) {
|
|
10
|
+
const [wrap, setWrap] = useState(true);
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const tableId = id ?? generatedId;
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { className: "doc-table", "data-wrap": wrap ? "on" : "off", children: [
|
|
14
|
+
/* @__PURE__ */ jsx("div", { className: "doc-table-toolbar", children: /* @__PURE__ */ jsx(
|
|
15
|
+
"button",
|
|
16
|
+
{
|
|
17
|
+
type: "button",
|
|
18
|
+
className: "doc-table-wrap",
|
|
19
|
+
"aria-label": "Wrap table text",
|
|
20
|
+
"aria-pressed": wrap,
|
|
21
|
+
"aria-controls": tableId,
|
|
22
|
+
title: wrap ? "Turn off text wrapping" : "Wrap table text",
|
|
23
|
+
onClick: () => setWrap((value) => !value),
|
|
24
|
+
children: /* @__PURE__ */ jsx(
|
|
25
|
+
"svg",
|
|
26
|
+
{
|
|
27
|
+
width: "12",
|
|
28
|
+
height: "12",
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
strokeWidth: "1.5",
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
children: /* @__PURE__ */ jsx("path", { d: "M3 6h18M3 12h14a3 3 0 0 1 0 6h-4m3-3-3 3 3 3M3 18h4" })
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: "doc-table-scroll",
|
|
45
|
+
role: "region",
|
|
46
|
+
"aria-label": "Scrollable table",
|
|
47
|
+
tabIndex: 0,
|
|
48
|
+
children: /* @__PURE__ */ jsx("table", { ...rest, id: tableId, className, style, children })
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
Table
|
|
55
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Table } from './Table';
|
|
2
3
|
import { Callout } from './Callout';
|
|
3
4
|
import { Chip } from './Chip';
|
|
4
5
|
import { Preview } from './Preview';
|
|
@@ -18,7 +19,7 @@ export declare const mdxComponents: {
|
|
|
18
19
|
li: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref">>;
|
|
19
20
|
a: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">>;
|
|
20
21
|
blockquote: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>, "ref">>;
|
|
21
|
-
table:
|
|
22
|
+
table: typeof Table;
|
|
22
23
|
th: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">>;
|
|
23
24
|
td: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">>;
|
|
24
25
|
code: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, "ref">>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, createContext, useState } from "react";
|
|
3
3
|
import { CodeBlock } from "./CodeBlock.js";
|
|
4
|
+
import { Table } from "./Table.js";
|
|
4
5
|
import { Callout } from "./Callout.js";
|
|
5
6
|
import { Chip } from "./Chip.js";
|
|
6
7
|
import { Preview } from "./Preview.js";
|
|
@@ -270,19 +271,17 @@ const A = ({ children, style, ...rest }) => /* @__PURE__ */ jsx(
|
|
|
270
271
|
children
|
|
271
272
|
}
|
|
272
273
|
);
|
|
273
|
-
const Table = ({ children, style, ...rest }) => /* @__PURE__ */ jsx("table", { ...rest, style: { width: "100%", borderCollapse: "collapse", fontSize: 13, margin: "0 0 14px", ...style }, children });
|
|
274
274
|
const Th = ({ children, style, ...rest }) => /* @__PURE__ */ jsx(
|
|
275
275
|
"th",
|
|
276
276
|
{
|
|
277
277
|
...rest,
|
|
278
|
-
className: "text-doc-template-muted uppercase
|
|
278
|
+
className: "text-doc-template-muted uppercase",
|
|
279
279
|
style: {
|
|
280
280
|
fontFamily: "var(--font-doc-template-mono)",
|
|
281
281
|
fontSize: 10,
|
|
282
282
|
letterSpacing: "0.12em",
|
|
283
283
|
textAlign: "left",
|
|
284
284
|
fontWeight: 600,
|
|
285
|
-
background: "color-mix(in srgb, var(--color-doc-template-ink) 2%, transparent)",
|
|
286
285
|
padding: "9px 10px",
|
|
287
286
|
...style
|
|
288
287
|
},
|
package/dist/styles.css
CHANGED
|
@@ -109,6 +109,45 @@
|
|
|
109
109
|
overflow-x: auto;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
.doc-table { position: relative; min-width: 0; max-width: 100%; margin: 0 0 14px; }
|
|
113
|
+
.doc-table-toolbar { position: absolute; top: 7px; right: 7px; z-index: 1; }
|
|
114
|
+
.doc-table-wrap {
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 20px;
|
|
119
|
+
height: 20px;
|
|
120
|
+
padding: 4px;
|
|
121
|
+
border: 0;
|
|
122
|
+
border-radius: var(--radius-doc-template-sm);
|
|
123
|
+
background: transparent;
|
|
124
|
+
color: var(--color-doc-template-muted);
|
|
125
|
+
font-family: var(--font-doc-template-mono);
|
|
126
|
+
font-size: 10px;
|
|
127
|
+
opacity: 0.65;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
130
|
+
.doc-table-wrap[aria-pressed='true'] {
|
|
131
|
+
opacity: 0.9;
|
|
132
|
+
}
|
|
133
|
+
.doc-table-wrap:hover { opacity: 1; }
|
|
134
|
+
.doc-table-wrap:focus-visible, .doc-table-scroll:focus-visible {
|
|
135
|
+
outline: 2px solid var(--color-doc-template-muted);
|
|
136
|
+
outline-offset: 2px;
|
|
137
|
+
}
|
|
138
|
+
.doc-table-scroll { overflow-x: auto; border-radius: var(--radius-doc-template-sm); }
|
|
139
|
+
.doc-table-scroll > table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
|
|
140
|
+
.doc-table-scroll > table > thead > tr > th {
|
|
141
|
+
border: 2px solid transparent;
|
|
142
|
+
border-radius: var(--radius-doc-template-sm);
|
|
143
|
+
background: var(--color-doc-template-chip);
|
|
144
|
+
background-clip: padding-box;
|
|
145
|
+
}
|
|
146
|
+
/* Reserve room under the overlay, including headers with inline cell padding. */
|
|
147
|
+
.doc-table-scroll > table > thead > tr > th:last-child { padding-right: 36px !important; }
|
|
148
|
+
.doc-table[data-wrap='on'] > .doc-table-scroll > table { white-space: normal; overflow-wrap: anywhere; }
|
|
149
|
+
.doc-table[data-wrap='off'] > .doc-table-scroll > table { white-space: nowrap; overflow-wrap: normal; }
|
|
150
|
+
|
|
112
151
|
/* Pagefind excerpt highlights — matches the inline highlight style
|
|
113
152
|
used by the SearchPalette's custom `highlight()` function. */
|
|
114
153
|
.pagefind-excerpt mark {
|
package/package.json
CHANGED