@dreamlake/dockit 0.2.15 → 0.2.16

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("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
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,3 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ /** Shared table chrome for Markdown and data-driven tables. */
3
+ export declare function Table({ children, className, style, id, ...rest }: ComponentPropsWithoutRef<"table">): import("react").JSX.Element;
@@ -0,0 +1,58 @@
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__ */ jsxs(
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: [
25
+ /* @__PURE__ */ jsx(
26
+ "svg",
27
+ {
28
+ width: "14",
29
+ height: "14",
30
+ viewBox: "0 0 24 24",
31
+ fill: "none",
32
+ stroke: "currentColor",
33
+ strokeWidth: "1.5",
34
+ strokeLinecap: "round",
35
+ strokeLinejoin: "round",
36
+ "aria-hidden": "true",
37
+ children: /* @__PURE__ */ jsx("path", { d: "M3 6h18M3 12h14a3 3 0 0 1 0 6h-4m3-3-3 3 3 3M3 18h4" })
38
+ }
39
+ ),
40
+ "Wrap"
41
+ ]
42
+ }
43
+ ) }),
44
+ /* @__PURE__ */ jsx(
45
+ "div",
46
+ {
47
+ className: "doc-table-scroll",
48
+ role: "region",
49
+ "aria-label": "Scrollable table",
50
+ tabIndex: 0,
51
+ children: /* @__PURE__ */ jsx("table", { ...rest, id: tableId, className, style, children })
52
+ }
53
+ )
54
+ ] });
55
+ }
56
+ export {
57
+ Table
58
+ };
@@ -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: import('react').FC<Omit<import('react').DetailedHTMLProps<import('react').TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">>;
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 border-b border-doc-template-faint",
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,44 @@
109
109
  overflow-x: auto;
110
110
  }
111
111
 
112
+ .doc-table { min-width: 0; max-width: 100%; margin: 0 0 14px; }
113
+ .doc-table-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
114
+ .doc-table-wrap {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ gap: 5px;
118
+ height: 24px;
119
+ padding: 2px 8px;
120
+ border: 1px solid var(--color-doc-template-faint);
121
+ border-radius: var(--radius-doc-template-sm);
122
+ background: transparent;
123
+ color: var(--color-doc-template-muted);
124
+ font-family: var(--font-doc-template-mono);
125
+ font-size: 10px;
126
+ cursor: pointer;
127
+ }
128
+ .doc-table-wrap[aria-pressed='true'] {
129
+ color: var(--color-doc-template-accent);
130
+ background: var(--color-doc-template-accent-soft);
131
+ }
132
+ .doc-table-wrap:hover { border-color: var(--color-doc-template-muted); }
133
+ .doc-table-wrap:focus-visible, .doc-table-scroll:focus-visible {
134
+ outline: 2px solid var(--color-doc-template-accent);
135
+ outline-offset: 2px;
136
+ }
137
+ .doc-table-scroll { overflow-x: auto; border-radius: var(--radius-doc-template-sm); }
138
+ .doc-table-scroll > table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
139
+ .doc-table-scroll > table > thead > tr > th {
140
+ border-bottom: 0;
141
+ background: var(--color-doc-template-chip);
142
+ }
143
+ .doc-table-scroll > table > thead > tr:first-child > th:first-child { border-top-left-radius: var(--radius-doc-template-sm); }
144
+ .doc-table-scroll > table > thead > tr:first-child > th:last-child { border-top-right-radius: var(--radius-doc-template-sm); }
145
+ .doc-table-scroll > table > thead > tr:last-child > th:first-child { border-bottom-left-radius: var(--radius-doc-template-sm); }
146
+ .doc-table-scroll > table > thead > tr:last-child > th:last-child { border-bottom-right-radius: var(--radius-doc-template-sm); }
147
+ .doc-table[data-wrap='on'] > .doc-table-scroll > table { white-space: normal; overflow-wrap: anywhere; }
148
+ .doc-table[data-wrap='off'] > .doc-table-scroll > table { white-space: nowrap; overflow-wrap: normal; }
149
+
112
150
  /* Pagefind excerpt highlights — matches the inline highlight style
113
151
  used by the SearchPalette's custom `highlight()` function. */
114
152
  .pagefind-excerpt mark {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dockit",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "The DreamLake documentation shell — Vike + React + Tailwind v4 + MDX docs framework with sidebar, TOC, search, and theming",
5
5
  "license": "MIT",
6
6
  "type": "module",