@dreamlake/dockit 0.2.16 → 0.2.18
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/components/Table.js +21 -20
- package/dist/styles.css +44 -16
- package/package.json +1 -1
package/dist/components/Table.js
CHANGED
|
@@ -10,23 +10,24 @@ function Table({
|
|
|
10
10
|
const [wrap, setWrap] = useState(true);
|
|
11
11
|
const generatedId = useId();
|
|
12
12
|
const tableId = id ?? generatedId;
|
|
13
|
+
const actionLabel = wrap ? "Unwrap" : "Wrap";
|
|
13
14
|
return /* @__PURE__ */ jsxs("div", { className: "doc-table", "data-wrap": wrap ? "on" : "off", children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
15
|
+
/* @__PURE__ */ jsxs("div", { className: "doc-table-toolbar", children: [
|
|
16
|
+
/* @__PURE__ */ jsx(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
type: "button",
|
|
20
|
+
className: "doc-table-wrap",
|
|
21
|
+
"aria-label": "Wrap table text",
|
|
22
|
+
"aria-pressed": wrap,
|
|
23
|
+
"aria-controls": tableId,
|
|
24
|
+
"aria-describedby": `${generatedId}-wrap-hint`,
|
|
25
|
+
onClick: () => setWrap((value) => !value),
|
|
26
|
+
children: /* @__PURE__ */ jsx(
|
|
26
27
|
"svg",
|
|
27
28
|
{
|
|
28
|
-
width: "
|
|
29
|
-
height: "
|
|
29
|
+
width: "12",
|
|
30
|
+
height: "12",
|
|
30
31
|
viewBox: "0 0 24 24",
|
|
31
32
|
fill: "none",
|
|
32
33
|
stroke: "currentColor",
|
|
@@ -34,13 +35,13 @@ function Table({
|
|
|
34
35
|
strokeLinecap: "round",
|
|
35
36
|
strokeLinejoin: "round",
|
|
36
37
|
"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
|
+
children: /* @__PURE__ */ jsx("path", { d: wrap ? "M3 6h18M3 12h14a3 3 0 0 1 0 6h-4m3-3-3 3 3 3M3 18h4" : "M3 6h18M3 12h18M3 18h18" })
|
|
38
39
|
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "doc-table-wrap-hint", id: `${generatedId}-wrap-hint`, role: "tooltip", children: actionLabel })
|
|
44
|
+
] }),
|
|
44
45
|
/* @__PURE__ */ jsx(
|
|
45
46
|
"div",
|
|
46
47
|
{
|
package/dist/styles.css
CHANGED
|
@@ -109,41 +109,69 @@
|
|
|
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 {
|
|
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
114
|
.doc-table-wrap {
|
|
115
115
|
display: inline-flex;
|
|
116
116
|
align-items: center;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 20px;
|
|
119
|
+
height: 20px;
|
|
120
|
+
padding: 4px;
|
|
121
|
+
border: 0;
|
|
121
122
|
border-radius: var(--radius-doc-template-sm);
|
|
122
123
|
background: transparent;
|
|
123
124
|
color: var(--color-doc-template-muted);
|
|
124
125
|
font-family: var(--font-doc-template-mono);
|
|
125
126
|
font-size: 10px;
|
|
127
|
+
opacity: 0.65;
|
|
128
|
+
transition: color 120ms ease, opacity 120ms ease;
|
|
126
129
|
cursor: pointer;
|
|
127
130
|
}
|
|
128
131
|
.doc-table-wrap[aria-pressed='true'] {
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
opacity: 0.9;
|
|
133
|
+
}
|
|
134
|
+
.doc-table-wrap:hover, .doc-table-wrap:focus-visible {
|
|
135
|
+
color: var(--color-doc-template-ink);
|
|
136
|
+
opacity: 1;
|
|
137
|
+
outline: none;
|
|
138
|
+
}
|
|
139
|
+
.doc-table-wrap-hint {
|
|
140
|
+
position: absolute;
|
|
141
|
+
right: 26px;
|
|
142
|
+
top: 0;
|
|
143
|
+
padding: 3px 6px;
|
|
144
|
+
border-radius: var(--radius-doc-template-sm);
|
|
145
|
+
background: var(--color-doc-template-code);
|
|
146
|
+
color: var(--color-doc-template-ink);
|
|
147
|
+
font-family: var(--font-doc-template-mono);
|
|
148
|
+
font-size: 10px;
|
|
149
|
+
line-height: 14px;
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
opacity: 0;
|
|
152
|
+
visibility: hidden;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
transition: opacity 120ms ease, visibility 120ms ease;
|
|
155
|
+
}
|
|
156
|
+
.doc-table-wrap:hover + .doc-table-wrap-hint,
|
|
157
|
+
.doc-table-wrap:focus-visible + .doc-table-wrap-hint {
|
|
158
|
+
opacity: 1;
|
|
159
|
+
visibility: visible;
|
|
131
160
|
}
|
|
132
|
-
.doc-table-
|
|
133
|
-
|
|
134
|
-
outline: 2px solid var(--color-doc-template-accent);
|
|
161
|
+
.doc-table-scroll:focus-visible {
|
|
162
|
+
outline: 2px solid var(--color-doc-template-muted);
|
|
135
163
|
outline-offset: 2px;
|
|
136
164
|
}
|
|
137
165
|
.doc-table-scroll { overflow-x: auto; border-radius: var(--radius-doc-template-sm); }
|
|
138
166
|
.doc-table-scroll > table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
|
|
139
167
|
.doc-table-scroll > table > thead > tr > th {
|
|
140
|
-
border
|
|
168
|
+
border: 2px solid transparent;
|
|
169
|
+
border-radius: var(--radius-doc-template-sm);
|
|
141
170
|
background: var(--color-doc-template-chip);
|
|
171
|
+
background-clip: padding-box;
|
|
142
172
|
}
|
|
143
|
-
|
|
144
|
-
.doc-table-scroll > table > thead > tr
|
|
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); }
|
|
173
|
+
/* Reserve room under the overlay, including headers with inline cell padding. */
|
|
174
|
+
.doc-table-scroll > table > thead > tr > th:last-child { padding-right: 36px !important; }
|
|
147
175
|
.doc-table[data-wrap='on'] > .doc-table-scroll > table { white-space: normal; overflow-wrap: anywhere; }
|
|
148
176
|
.doc-table[data-wrap='off'] > .doc-table-scroll > table { white-space: nowrap; overflow-wrap: normal; }
|
|
149
177
|
|
package/package.json
CHANGED