neatkit 0.4.2 → 0.6.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/Alert-DQ5CCE0N.js +29 -0
- package/dist/Alert-LJDkNUqH.cjs +1 -0
- package/dist/Alert.cjs +1 -0
- package/dist/Alert.js +4 -0
- package/dist/Avatar.cjs +1 -0
- package/dist/Avatar.js +55 -0
- package/dist/Badge.cjs +1 -0
- package/dist/Badge.js +25 -0
- package/dist/Button-BAsLfA0D.js +99 -0
- package/dist/Button-D7JUO6Fs.cjs +1 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.js +5 -0
- package/dist/Card-CPq6dsut.js +34 -0
- package/dist/Card-CQ-8_1tO.cjs +1 -0
- package/dist/Card.cjs +1 -0
- package/dist/Card.js +4 -0
- package/dist/Checkbox-BvXM9VyY.js +68 -0
- package/dist/Checkbox-VQifZrZZ.cjs +1 -0
- package/dist/Checkbox.cjs +1 -0
- package/dist/Checkbox.js +5 -0
- package/dist/CheckboxGroup.cjs +1 -0
- package/dist/CheckboxGroup.js +144 -0
- package/dist/Code-BP2ZCmUf.js +7446 -0
- package/dist/Code-eispVOW3.cjs +6 -0
- package/dist/Code.cjs +1 -0
- package/dist/Code.js +5 -0
- package/dist/Content.cjs +1 -0
- package/dist/Content.js +144 -0
- package/dist/Divider-BE15WVDI.js +42 -0
- package/dist/Divider-CJYbFcSX.cjs +1 -0
- package/dist/Divider.cjs +1 -0
- package/dist/Divider.js +4 -0
- package/dist/Field.cjs +1 -0
- package/dist/Field.js +115 -0
- package/dist/Icon-D8IZceys.cjs +1 -0
- package/dist/Icon-uQmpr5P2.js +1139 -0
- package/dist/Icon.cjs +1 -0
- package/dist/Icon.js +37 -0
- package/dist/Input.cjs +1 -0
- package/dist/Input.js +146 -0
- package/dist/Markdown.cjs +31 -0
- package/dist/Markdown.js +18411 -0
- package/dist/Modal.cjs +1 -0
- package/dist/Modal.js +171 -0
- package/dist/PinInput.cjs +1 -0
- package/dist/PinInput.js +248 -0
- package/dist/Popover.cjs +1 -0
- package/dist/Popover.js +238 -0
- package/dist/Radio.cjs +1 -0
- package/dist/Radio.js +65 -0
- package/dist/RadioGroup.cjs +1 -0
- package/dist/RadioGroup.js +51 -0
- package/dist/RadioGroupContext-BX9KnDek.cjs +1 -0
- package/dist/RadioGroupContext-DbKM4zPZ.js +5 -0
- package/dist/Select.cjs +1 -0
- package/dist/Select.js +473 -0
- package/dist/Skeleton.cjs +1 -0
- package/dist/Skeleton.js +27 -0
- package/dist/Spinner-BXgw60UC.cjs +1 -0
- package/dist/Spinner-CVYvk6YK.js +25 -0
- package/dist/Spinner.cjs +1 -0
- package/dist/Spinner.js +4 -0
- package/dist/Surface-BttJYSDt.cjs +1 -0
- package/dist/Surface-vEFsZC12.js +17 -0
- package/dist/Switch.cjs +1 -0
- package/dist/Switch.js +39 -0
- package/dist/Table-83unQQOi.cjs +1 -0
- package/dist/Table-Cw8u-pEW.js +403 -0
- package/dist/Table.cjs +1 -0
- package/dist/Table.js +5 -0
- package/dist/Text-DWYlIcPj.cjs +1 -0
- package/dist/Text-rN6iDo0V.js +24 -0
- package/dist/Text.cjs +1 -0
- package/dist/Text.js +4 -0
- package/dist/TextArea.cjs +1 -0
- package/dist/TextArea.js +43 -0
- package/dist/Tooltip-BB82wNOE.cjs +1 -0
- package/dist/Tooltip-CqWK_GRD.js +236 -0
- package/dist/Tooltip.cjs +1 -0
- package/dist/Tooltip.js +6 -0
- package/dist/aria-DHnOMyYp.js +10 -0
- package/dist/aria-DKxpE8cA.cjs +1 -0
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/CheckboxGroup/index.d.ts +1 -1
- package/dist/components/Code/Code.d.ts +47 -0
- package/dist/components/Code/index.d.ts +2 -0
- package/dist/components/Code/utils/highlight.d.ts +17 -0
- package/dist/components/Content/Content.d.ts +3 -3
- package/dist/components/Content/index.d.ts +2 -2
- package/dist/components/Divider/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Markdown/Markdown.d.ts +66 -0
- package/dist/components/Markdown/index.d.ts +3 -0
- package/dist/components/Markdown/utils/language.d.ts +9 -0
- package/dist/components/Markdown/utils/renderers.d.ts +15 -0
- package/dist/components/Markdown/utils/security.d.ts +66 -0
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/PinInput/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +7 -11
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/field-control-NfLwcPj6.cjs +1 -0
- package/dist/field-control-XAn_FKks.js +16 -0
- package/dist/focus-restoration-70WcQRr5.cjs +1 -0
- package/dist/focus-restoration-BvNZzrQA.js +16 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -26
- package/dist/index.js +6 -4409
- package/dist/reference-C2guRuR0.cjs +1 -0
- package/dist/reference-CXMr27nM.js +12 -0
- package/dist/style.css +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/units-BmjPCccF.js +90 -0
- package/dist/units-PzuiQNnw.cjs +1 -0
- package/dist/useFloatingPosition-CxzhAvy8.js +73 -0
- package/dist/useFloatingPosition-D1FqYy0l.cjs +1 -0
- package/dist/useFocusTrap--cgjy78G.cjs +1 -0
- package/dist/useFocusTrap-Da4nEash.js +134 -0
- package/dist/usePresence-DSPt6aKi.js +210 -0
- package/dist/usePresence-qe92UTvK.cjs +1 -0
- package/package.json +155 -2
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C, jsxs as q, Fragment as he } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as X, createContext as ye, forwardRef as be, Fragment as Fe, useId as Le, useContext as ve, useRef as u, useState as z, useCallback as f, useEffect as G, cloneElement as J } from "react";
|
|
4
|
+
import { g as Me, a as K } from "./reference-CXMr27nM.js";
|
|
5
|
+
import { a as Oe, b as _e, c as xe, P as Ne } from "./usePresence-DSPt6aKi.js";
|
|
6
|
+
import { u as Pe } from "./useFloatingPosition-CxzhAvy8.js";
|
|
7
|
+
import { i as We } from "./focus-restoration-BvNZzrQA.js";
|
|
8
|
+
import { S as ke } from "./Surface-vEFsZC12.js";
|
|
9
|
+
const Ve = 500, Z = ye(null);
|
|
10
|
+
function Ge(r) {
|
|
11
|
+
const { children: a, delay: s = Ve } = r, l = X(() => ({
|
|
12
|
+
delay: s
|
|
13
|
+
}), [s]);
|
|
14
|
+
return /* @__PURE__ */ C(Z.Provider, { value: l, children: a });
|
|
15
|
+
}
|
|
16
|
+
const ee = 500, Q = 100;
|
|
17
|
+
function Ae(r, a, s, l) {
|
|
18
|
+
a.current = r, K(s, r), K(l, r);
|
|
19
|
+
}
|
|
20
|
+
function je(r) {
|
|
21
|
+
return Number.isFinite(r) ? Math.max(0, r) : ee;
|
|
22
|
+
}
|
|
23
|
+
function ze(r, a) {
|
|
24
|
+
const s = (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? [];
|
|
25
|
+
return s.includes(a) || s.push(a), s.join(" ");
|
|
26
|
+
}
|
|
27
|
+
const Je = be(function(a, s) {
|
|
28
|
+
const {
|
|
29
|
+
children: l,
|
|
30
|
+
className: ne,
|
|
31
|
+
content: p,
|
|
32
|
+
contentClassName: te,
|
|
33
|
+
contentStyle: S,
|
|
34
|
+
delay: re,
|
|
35
|
+
disabled: w = !1,
|
|
36
|
+
onOpenChange: F,
|
|
37
|
+
placement: B = "top",
|
|
38
|
+
portalContainer: L,
|
|
39
|
+
style: oe
|
|
40
|
+
} = a;
|
|
41
|
+
if (p == null || typeof p == "boolean" || typeof p == "string" && !p.trim())
|
|
42
|
+
throw new Error("Tooltip content must not be empty");
|
|
43
|
+
if (l.type === Fe)
|
|
44
|
+
throw new Error("Tooltip requires a single non-Fragment trigger");
|
|
45
|
+
const Y = `${Le()}-tooltip`, N = ve(Z), t = l.props, $ = Me(l), D = u(null), P = u(null), H = u(w), W = u(!1), v = u(null), M = u(null), O = u(null), _ = u(!1), E = u(!1), g = u(!1), d = u(!1), [I, se] = z(null), [ce, ie] = z(null), [x, ue] = z(!1);
|
|
46
|
+
H.current = w;
|
|
47
|
+
const k = je(
|
|
48
|
+
re ?? (N == null ? void 0 : N.delay) ?? ee
|
|
49
|
+
), R = Oe(x), V = (L == null ? void 0 : L.ownerDocument) ?? (I == null ? void 0 : I.ownerDocument) ?? (typeof document > "u" ? null : document), A = _e(R.present, V), m = Pe(
|
|
50
|
+
R.present,
|
|
51
|
+
B,
|
|
52
|
+
I,
|
|
53
|
+
ce
|
|
54
|
+
), le = X(
|
|
55
|
+
() => [D, P],
|
|
56
|
+
[]
|
|
57
|
+
), ae = ze(
|
|
58
|
+
t["aria-describedby"],
|
|
59
|
+
Y
|
|
60
|
+
), fe = x && R.present ? ae : t["aria-describedby"], U = f(
|
|
61
|
+
(e) => {
|
|
62
|
+
Ae(
|
|
63
|
+
e,
|
|
64
|
+
D,
|
|
65
|
+
$,
|
|
66
|
+
s
|
|
67
|
+
), se(e);
|
|
68
|
+
},
|
|
69
|
+
[s, $]
|
|
70
|
+
), de = f(
|
|
71
|
+
(e) => {
|
|
72
|
+
P.current = e, e || (d.current = !1), ie(e);
|
|
73
|
+
},
|
|
74
|
+
[]
|
|
75
|
+
), c = f(() => {
|
|
76
|
+
const e = v.current;
|
|
77
|
+
e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
|
|
78
|
+
}, []), i = f(() => {
|
|
79
|
+
const e = M.current;
|
|
80
|
+
e && e.ownerWindow.clearTimeout(e.timerId), M.current = null;
|
|
81
|
+
}, []), h = f(() => {
|
|
82
|
+
const e = O.current;
|
|
83
|
+
e && e.ownerWindow.clearTimeout(e.timerId), O.current = null;
|
|
84
|
+
}, []), o = f((e) => {
|
|
85
|
+
W.current !== e && (e || (d.current = !1), W.current = e, ue(e), F == null || F(e));
|
|
86
|
+
}, [F]), j = f((e) => {
|
|
87
|
+
var y, b;
|
|
88
|
+
if (i(), E.current || g.current || d.current)
|
|
89
|
+
return;
|
|
90
|
+
if (e === 0) {
|
|
91
|
+
o(!1);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const n = ((y = D.current) == null ? void 0 : y.ownerDocument.defaultView) ?? ((b = P.current) == null ? void 0 : b.ownerDocument.defaultView);
|
|
95
|
+
if (!n) {
|
|
96
|
+
o(!1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const T = n.setTimeout(() => {
|
|
100
|
+
M.current = null, !E.current && !g.current && !d.current && o(!1);
|
|
101
|
+
}, e);
|
|
102
|
+
M.current = {
|
|
103
|
+
ownerWindow: n,
|
|
104
|
+
timerId: T
|
|
105
|
+
};
|
|
106
|
+
}, [i, o]), me = f(() => {
|
|
107
|
+
var T;
|
|
108
|
+
if (c(), i(), k === 0) {
|
|
109
|
+
o(!0);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const e = (T = D.current) == null ? void 0 : T.ownerDocument.defaultView;
|
|
113
|
+
if (!e) return;
|
|
114
|
+
const n = e.setTimeout(() => {
|
|
115
|
+
v.current = null, H.current || o(!0);
|
|
116
|
+
}, k);
|
|
117
|
+
v.current = { ownerWindow: e, timerId: n };
|
|
118
|
+
}, [i, c, k, o]);
|
|
119
|
+
function pe(e) {
|
|
120
|
+
var n;
|
|
121
|
+
if ((n = t.onFocus) == null || n.call(t, e), E.current = !0, i(), _.current || We(e.currentTarget)) {
|
|
122
|
+
c();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
c(), o(!0);
|
|
126
|
+
}
|
|
127
|
+
function Te(e) {
|
|
128
|
+
var n;
|
|
129
|
+
(n = t.onBlur) == null || n.call(t, e), !e.currentTarget.contains(e.relatedTarget) && (E.current = !1, c(), j(0));
|
|
130
|
+
}
|
|
131
|
+
function we(e) {
|
|
132
|
+
var n;
|
|
133
|
+
(n = t.onMouseEnter) == null || n.call(t, e), g.current = !0, me();
|
|
134
|
+
}
|
|
135
|
+
function De(e) {
|
|
136
|
+
var n;
|
|
137
|
+
(n = t.onMouseLeave) == null || n.call(t, e), g.current = !1, c(), j(Q);
|
|
138
|
+
}
|
|
139
|
+
function Ee() {
|
|
140
|
+
d.current = !0, i();
|
|
141
|
+
}
|
|
142
|
+
function ge() {
|
|
143
|
+
d.current = !1, j(Q);
|
|
144
|
+
}
|
|
145
|
+
function Ie(e) {
|
|
146
|
+
var y, b;
|
|
147
|
+
(y = t.onPointerDown) == null || y.call(t, e), c(), i(), o(!1);
|
|
148
|
+
const n = (b = D.current) == null ? void 0 : b.ownerDocument.defaultView;
|
|
149
|
+
if (!n) return;
|
|
150
|
+
_.current = !0, h();
|
|
151
|
+
const T = n.setTimeout(() => {
|
|
152
|
+
_.current = !1, O.current = null;
|
|
153
|
+
}, 0);
|
|
154
|
+
O.current = { ownerWindow: n, timerId: T };
|
|
155
|
+
}
|
|
156
|
+
if (xe({
|
|
157
|
+
active: x,
|
|
158
|
+
boundaries: le,
|
|
159
|
+
dismissOnPointerDownOutside: !0,
|
|
160
|
+
layerId: A.id,
|
|
161
|
+
onEscapeDismiss: () => o(!1),
|
|
162
|
+
onPointerDownOutsideDismiss: () => o(!1),
|
|
163
|
+
ownerDocument: V
|
|
164
|
+
}), G(() => {
|
|
165
|
+
w && (c(), i(), h(), _.current = !1, E.current = !1, g.current = !1, d.current = !1, W.current && o(!1));
|
|
166
|
+
}, [
|
|
167
|
+
i,
|
|
168
|
+
c,
|
|
169
|
+
h,
|
|
170
|
+
w,
|
|
171
|
+
o
|
|
172
|
+
]), G(() => () => {
|
|
173
|
+
c(), i(), h();
|
|
174
|
+
}, [i, c, h]), w)
|
|
175
|
+
return J(
|
|
176
|
+
l,
|
|
177
|
+
{ ref: U }
|
|
178
|
+
);
|
|
179
|
+
const Re = J(
|
|
180
|
+
l,
|
|
181
|
+
{
|
|
182
|
+
"aria-describedby": fe,
|
|
183
|
+
className: [t.className, "nk-tooltip__trigger", ne].filter(Boolean).join(" "),
|
|
184
|
+
onBlur: Te,
|
|
185
|
+
onFocus: pe,
|
|
186
|
+
onMouseEnter: we,
|
|
187
|
+
onMouseLeave: De,
|
|
188
|
+
onPointerDown: Ie,
|
|
189
|
+
ref: U,
|
|
190
|
+
style: { ...t.style, ...oe }
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
return /* @__PURE__ */ q(he, { children: [
|
|
194
|
+
Re,
|
|
195
|
+
R.present && V ? /* @__PURE__ */ C(
|
|
196
|
+
Ne,
|
|
197
|
+
{
|
|
198
|
+
container: L,
|
|
199
|
+
inheritFrom: I,
|
|
200
|
+
children: /* @__PURE__ */ q(
|
|
201
|
+
ke,
|
|
202
|
+
{
|
|
203
|
+
ref: de,
|
|
204
|
+
"aria-hidden": x ? void 0 : !0,
|
|
205
|
+
className: ["nk-tooltip", te].filter(Boolean).join(" "),
|
|
206
|
+
"data-placement": (m == null ? void 0 : m.placement) ?? B,
|
|
207
|
+
"data-state": R.state === "closing" ? "closing" : "open",
|
|
208
|
+
id: Y,
|
|
209
|
+
onMouseEnter: Ee,
|
|
210
|
+
onMouseLeave: ge,
|
|
211
|
+
role: "tooltip",
|
|
212
|
+
style: m ? {
|
|
213
|
+
...S,
|
|
214
|
+
"--nk-tooltip-arrow-offset": `${m.arrowOffset}px`,
|
|
215
|
+
left: m.left,
|
|
216
|
+
top: m.top,
|
|
217
|
+
zIndex: A.zIndex
|
|
218
|
+
} : {
|
|
219
|
+
...S,
|
|
220
|
+
visibility: "hidden",
|
|
221
|
+
zIndex: A.zIndex
|
|
222
|
+
},
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ C("span", { "aria-hidden": "true", className: "nk-tooltip__arrow" }),
|
|
225
|
+
p
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
) : null
|
|
231
|
+
] });
|
|
232
|
+
});
|
|
233
|
+
export {
|
|
234
|
+
Ge as T,
|
|
235
|
+
Je as a
|
|
236
|
+
};
|
package/dist/Tooltip.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-BB82wNOE.cjs");exports.TooltipProvider=e.TooltipProvider;exports.default=e.Tooltip;
|
package/dist/Tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(e){return e!==void 0&&e!==!1&&e!=="false"}function r(e,t){return e?!0:t}exports.hasInvalidState=n;exports.resolveAriaInvalid=r;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Alert";
|
|
2
2
|
export type { AlertProps, AlertTone } from "./Alert";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Avatar";
|
|
2
2
|
export type { AvatarProps } from "./Avatar";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Badge";
|
|
2
2
|
export type { BadgeProps, BadgeTone, BadgeVariant } from "./Badge";
|
|
@@ -19,8 +19,8 @@ type ButtonOwnProps = {
|
|
|
19
19
|
variant?: ButtonVariant;
|
|
20
20
|
/** The semantic intent applied to the Button. */
|
|
21
21
|
tone?: ButtonTone;
|
|
22
|
-
/** The outline shape applied to the Button. */
|
|
23
|
-
shape
|
|
22
|
+
/** The outline shape applied to the Button. Defaults to capsule. */
|
|
23
|
+
shape?: ButtonShape;
|
|
24
24
|
/** Whether the Button fills its containing block. */
|
|
25
25
|
fullWidth?: boolean;
|
|
26
26
|
/** Whether the Button displays a loading indicator and blocks interaction. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Button";
|
|
2
2
|
export type { ButtonIconAlignment, ButtonProps, ButtonShape, ButtonTextAlignment, ButtonTone, ButtonVariant, } from "./Button";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Card";
|
|
2
2
|
export type { CardHeader, CardProps, CardSpacing, } from "./Card";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Checkbox";
|
|
2
2
|
export type { CheckboxProps } from "./Checkbox";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./CheckboxGroup";
|
|
2
2
|
export type { CheckboxGroupOrientation, CheckboxGroupProps, } from "./CheckboxGroup";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import "./styles/code.css";
|
|
3
|
+
/** A syntax-highlighting language supported by Code. */
|
|
4
|
+
export type CodeLanguage = "C" | "C++" | "CSS" | "Go" | "HTML" | "JSON" | "JavaScript" | "Markdown" | "Python" | "Ruby" | "Rust" | "SQL" | "Shell" | "TypeScript" | "YAML";
|
|
5
|
+
/** Properties owned by Code rather than its native container. */
|
|
6
|
+
type CodeOwnProps = {
|
|
7
|
+
/** Native properties applied to the rendered code element. */
|
|
8
|
+
codeProps?: Omit<HTMLAttributes<HTMLElement>, "children" | "dangerouslySetInnerHTML">;
|
|
9
|
+
/** The plain source string displayed by the component. */
|
|
10
|
+
code: string;
|
|
11
|
+
/** The additional class name applied to the horizontal scroll container. */
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
/** The language label and optional syntax grammar applied to the source. */
|
|
14
|
+
language?: CodeLanguage;
|
|
15
|
+
/**
|
|
16
|
+
* The maximum line count rendered with individual wrappers and numbers.
|
|
17
|
+
* Larger source remains complete as one plain text node. Set to null only
|
|
18
|
+
* for trusted source whose line count is constrained elsewhere.
|
|
19
|
+
*/
|
|
20
|
+
maxLineCount?: number | null;
|
|
21
|
+
/**
|
|
22
|
+
* The maximum UTF-16 source length processed by syntax highlighting. Set to
|
|
23
|
+
* null only for trusted source whose size is constrained elsewhere.
|
|
24
|
+
*/
|
|
25
|
+
maxHighlightLength?: number | null;
|
|
26
|
+
/** Native properties applied to the rendered preformatted element. */
|
|
27
|
+
preProps?: Omit<HTMLAttributes<HTMLPreElement>, "children" | "dangerouslySetInnerHTML">;
|
|
28
|
+
/** The optional source title displayed in the Card header. */
|
|
29
|
+
title?: string;
|
|
30
|
+
};
|
|
31
|
+
/** A type representing properties for the Code component. */
|
|
32
|
+
export type CodeProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "dangerouslySetInnerHTML" | "title"> & CodeOwnProps;
|
|
33
|
+
/**
|
|
34
|
+
* Renders highlighted, line-numbered source inside a Card.
|
|
35
|
+
*
|
|
36
|
+
* The horizontal scroll region becomes keyboard-focusable only when its
|
|
37
|
+
* content overflows, while line numbers remain hidden from assistive
|
|
38
|
+
* technology and text selection. Syntax highlighting and individual line
|
|
39
|
+
* wrappers are bounded while oversized source remains complete as plain text.
|
|
40
|
+
*
|
|
41
|
+
* @param props - The source, presentation, and native container properties.
|
|
42
|
+
* @param forwardedReference - The reference assigned to the outer Card.
|
|
43
|
+
*
|
|
44
|
+
* @returns The rendered source-code surface.
|
|
45
|
+
*/
|
|
46
|
+
declare const Code: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "children" | "dangerouslySetInnerHTML"> & CodeOwnProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
export default Code;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CodeLanguage } from "../Code";
|
|
2
|
+
/** A highlighted text fragment rendered within one source line. */
|
|
3
|
+
export type CodeHighlightSegment = {
|
|
4
|
+
/** The syntax classes describing the highlighted fragment. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** The source text represented by the fragment. */
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Highlights source code and groups its syntax fragments by line.
|
|
11
|
+
*
|
|
12
|
+
* @param code - The normalized source code to highlight.
|
|
13
|
+
* @param language - The language grammar used to parse the source.
|
|
14
|
+
*
|
|
15
|
+
* @returns Highlighted lines, or null when parsing cannot complete.
|
|
16
|
+
*/
|
|
17
|
+
export declare function highlightCode(code: string, language: CodeLanguage): CodeHighlightSegment[][] | null;
|
|
@@ -5,7 +5,7 @@ export type ContentTheme = "light" | "dark";
|
|
|
5
5
|
/** A type representing Content's visual background modes. */
|
|
6
6
|
export type ContentMode = "grid" | "none";
|
|
7
7
|
/** A type representing Content's minimum-height behavior. */
|
|
8
|
-
export type
|
|
8
|
+
export type ContentMinHeight = "auto" | "available" | "viewport";
|
|
9
9
|
/** A type representing Content's vertical spacing behavior. */
|
|
10
10
|
export type ContentSpacing = "standard" | "none";
|
|
11
11
|
/** A type representing CSS custom properties accepted by Content styles. */
|
|
@@ -24,8 +24,8 @@ type ContentOwnProps = {
|
|
|
24
24
|
accent?: string;
|
|
25
25
|
/** The visual background treatment applied to Content. */
|
|
26
26
|
mode?: ContentMode;
|
|
27
|
-
/** The minimum
|
|
28
|
-
|
|
27
|
+
/** The minimum height applied to Content. */
|
|
28
|
+
minHeight?: ContentMinHeight;
|
|
29
29
|
/** The vertical spacing applied within Content. */
|
|
30
30
|
spacing?: ContentSpacing;
|
|
31
31
|
/** Whether Content applies its responsive cell-aligned inner width. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export type {
|
|
1
|
+
export { default } from "./Content";
|
|
2
|
+
export type { ContentMinHeight, ContentMode, ContentProps, ContentSpacing, ContentTheme, } from "./Content";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Divider";
|
|
2
2
|
export type { DividerOrientation, DividerProps } from "./Divider";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Field";
|
|
2
2
|
export type { FieldOrientation, FieldProps } from "./Field";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Input";
|
|
2
2
|
export type { InputProps, InputType } from "./Input";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import type { PluggableList } from "unified";
|
|
3
|
+
import { type MarkdownImageSourceAllowlist } from "./utils/security";
|
|
4
|
+
import "./styles/markdown.css";
|
|
5
|
+
/** Properties owned by Markdown rather than its native container. */
|
|
6
|
+
type MarkdownOwnProps = {
|
|
7
|
+
/** Image sources permitted to initiate requests. The default blocks all. */
|
|
8
|
+
allowedImageSources?: MarkdownImageSourceAllowlist;
|
|
9
|
+
/**
|
|
10
|
+
* A stable public prefix applied after Markdown's fixed `md-` security
|
|
11
|
+
* namespace. IDs remain document-global: multiple Markdown components and
|
|
12
|
+
* their footnotes can collide, and duplicate fragments use native first-match
|
|
13
|
+
* behavior. Use distinct values for multiple navigable documents.
|
|
14
|
+
*/
|
|
15
|
+
anchorPrefix?: string;
|
|
16
|
+
/** The untrusted Markdown source to parse and render. */
|
|
17
|
+
content: string;
|
|
18
|
+
/** Trusted absolute base used to resolve pattern-allowed relative images. */
|
|
19
|
+
imageBaseUrl?: string;
|
|
20
|
+
/** Trusted rehype plugins run before the mandatory security transforms. */
|
|
21
|
+
rehypePlugins?: PluggableList;
|
|
22
|
+
/** Trusted remark plugins run after the built-in GFM extension. */
|
|
23
|
+
remarkPlugins?: PluggableList;
|
|
24
|
+
/**
|
|
25
|
+
* The maximum UTF-16 source length parsed synchronously. Set to null only
|
|
26
|
+
* for trusted content whose size is constrained elsewhere.
|
|
27
|
+
*/
|
|
28
|
+
maxContentLength?: number | null;
|
|
29
|
+
/**
|
|
30
|
+
* The maximum source length syntax-highlighted within each code block. Set
|
|
31
|
+
* to null only for trusted source whose size is constrained elsewhere.
|
|
32
|
+
*/
|
|
33
|
+
maxCodeHighlightLength?: number | null;
|
|
34
|
+
/**
|
|
35
|
+
* The maximum code-block line count rendered with wrappers and numbers.
|
|
36
|
+
* Larger blocks remain complete as one plain text node. Set to null only
|
|
37
|
+
* for trusted source whose line count is constrained elsewhere.
|
|
38
|
+
*/
|
|
39
|
+
maxCodeLineCount?: number | null;
|
|
40
|
+
/**
|
|
41
|
+
* The pixel offset reserved above smoothly scrolled anchors. Set to null to
|
|
42
|
+
* use immediate in-document navigation without a reserved offset.
|
|
43
|
+
*/
|
|
44
|
+
scrollOffset?: number | null;
|
|
45
|
+
};
|
|
46
|
+
/** A type representing properties for the Markdown component. */
|
|
47
|
+
export type MarkdownProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "dangerouslySetInnerHTML"> & MarkdownOwnProps;
|
|
48
|
+
/**
|
|
49
|
+
* Renders untrusted CommonMark and GFM content through Neatkit components.
|
|
50
|
+
*
|
|
51
|
+
* Embedded HTML is parsed through a fixed allowlist, unsafe URL protocols are
|
|
52
|
+
* removed, generated IDs use a fixed `md-` clobber-protection namespace, and
|
|
53
|
+
* all images are blocked unless explicitly enabled. IDs are document-global;
|
|
54
|
+
* consumers must provide distinct `anchorPrefix` values when rendering
|
|
55
|
+
* multiple independently navigable documents. Parsing and code rendering are
|
|
56
|
+
* bounded by default. Consumer plugins run before the fixed security
|
|
57
|
+
* transforms; renderer overrides and Markdown-to-HTML conversion options stay
|
|
58
|
+
* private because they can invalidate these guarantees.
|
|
59
|
+
*
|
|
60
|
+
* @param props - The Markdown source, security options, and native properties.
|
|
61
|
+
* @param forwardedReference - The reference assigned to the outer container.
|
|
62
|
+
*
|
|
63
|
+
* @returns The safely rendered Markdown content.
|
|
64
|
+
*/
|
|
65
|
+
declare const Markdown: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "dangerouslySetInnerHTML"> & MarkdownOwnProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export default Markdown;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CodeLanguage } from "../../Code/Code";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a fenced-code identifier to a supported syntax grammar.
|
|
4
|
+
*
|
|
5
|
+
* @param className - The language class generated from the Markdown fence.
|
|
6
|
+
*
|
|
7
|
+
* @returns The supported language, or undefined for an unknown identifier.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveCodeLanguage(className?: string): CodeLanguage | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MouseEventHandler } from "react";
|
|
2
|
+
import type { Components } from "react-markdown";
|
|
3
|
+
import { type MarkdownImageSourceAllowlist } from "./security";
|
|
4
|
+
/**
|
|
5
|
+
* Creates the constrained element renderers used by Markdown.
|
|
6
|
+
*
|
|
7
|
+
* @param allowedImageSources - The consumer-owned image source allowlist.
|
|
8
|
+
* @param imageBaseUrl - The trusted base used to resolve relative sources.
|
|
9
|
+
* @param maxCodeHighlightLength - Maximum highlighted code-block length.
|
|
10
|
+
* @param maxCodeLineCount - Maximum individually rendered code-block lines.
|
|
11
|
+
* @param onAnchorClick - The handler for scoped in-document navigation.
|
|
12
|
+
*
|
|
13
|
+
* @returns Renderers composed from semantic Neatkit components.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMarkdownComponents(allowedImageSources: MarkdownImageSourceAllowlist | undefined, imageBaseUrl: string | undefined, maxCodeHighlightLength: number | null | undefined, maxCodeLineCount: number | null | undefined, onAnchorClick: MouseEventHandler<HTMLAnchorElement>): Components;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Root } from "hast";
|
|
2
|
+
import { type Options as SanitizeSchema } from "rehype-sanitize";
|
|
3
|
+
/** Options used to prefix public Markdown identifiers. */
|
|
4
|
+
type MarkdownIdentifierOptions = {
|
|
5
|
+
/** The fixed security prefix applied by the final sanitizer. */
|
|
6
|
+
clobberPrefix: string;
|
|
7
|
+
/** The stable consumer-provided prefix prepended to every identifier. */
|
|
8
|
+
prefix: string;
|
|
9
|
+
};
|
|
10
|
+
/** The namespace preventing Markdown IDs from clobbering host globals. */
|
|
11
|
+
export declare const MARKDOWN_CLOBBER_PREFIX = "md-";
|
|
12
|
+
/** Sources a Markdown document may load as images. */
|
|
13
|
+
export type MarkdownImageSourceAllowlist = "*" | RegExp | readonly RegExp[];
|
|
14
|
+
/** The elements produced by the supported CommonMark and GFM syntax. */
|
|
15
|
+
export declare const ALLOWED_MARKDOWN_ELEMENTS: readonly ["a", "blockquote", "br", "code", "del", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "picture", "pre", "section", "source", "strong", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
|
|
16
|
+
/** The final sanitizer schema applied after all Markdown transformations. */
|
|
17
|
+
export declare const MARKDOWN_SANITIZE_SCHEMA: SanitizeSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves an image source through the consumer's explicit allowlist.
|
|
20
|
+
*
|
|
21
|
+
* Pattern policies inspect and return a normalized absolute URL. Relative and
|
|
22
|
+
* protocol-relative sources therefore require an explicit trusted base URL.
|
|
23
|
+
* The wildcard retains authored URLs after applying the protocol constraints.
|
|
24
|
+
*
|
|
25
|
+
* @param source - The safe source returned by React Markdown.
|
|
26
|
+
* @param allowedSources - The consumer-owned source allowlist.
|
|
27
|
+
* @param baseUrl - The trusted base used to resolve non-absolute sources.
|
|
28
|
+
*
|
|
29
|
+
* @returns The safe URL to render, or undefined when the source is blocked.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveAllowedImageSource(source: string, allowedSources: MarkdownImageSourceAllowlist | undefined, baseUrl?: string): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Filters one responsive image source list through the image URL policy.
|
|
34
|
+
*
|
|
35
|
+
* A malformed candidate invalidates the complete list instead of allowing the
|
|
36
|
+
* browser to select an unverified fallback.
|
|
37
|
+
*
|
|
38
|
+
* @param sourceSet - The comma-separated image candidates to validate.
|
|
39
|
+
* @param allowedSources - The consumer-owned source allowlist.
|
|
40
|
+
* @param baseUrl - The trusted base used to resolve non-absolute sources.
|
|
41
|
+
*
|
|
42
|
+
* @returns The safe normalized list, or undefined when a candidate is unsafe.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sanitizeImageSourceSet(sourceSet: string | undefined, allowedSources: MarkdownImageSourceAllowlist | undefined, baseUrl?: string): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Removes authored inputs while retaining inert GFM task-list controls.
|
|
47
|
+
*
|
|
48
|
+
* Rehype Raw preserves source positions on authored HTML elements, whereas
|
|
49
|
+
* Remark GFM creates its disabled task-list inputs without source positions.
|
|
50
|
+
*
|
|
51
|
+
* @returns A rehype transformer that prevents authored form controls.
|
|
52
|
+
*/
|
|
53
|
+
export declare function rehypeRemoveAuthoredInputs(): (tree: Root) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Prefixes IDs and their internal references before final sanitization.
|
|
56
|
+
*
|
|
57
|
+
* The public prefix is applied to declarations and references here. The final
|
|
58
|
+
* sanitizer adds the fixed clobber prefix to declarations and ARIA references,
|
|
59
|
+
* so local fragment links account for that prefix in advance.
|
|
60
|
+
*
|
|
61
|
+
* @param options - The fixed security prefix and public document prefix.
|
|
62
|
+
*
|
|
63
|
+
* @returns A rehype transformer that keeps declarations and references aligned.
|
|
64
|
+
*/
|
|
65
|
+
export declare function rehypePrefixMarkdownIdentifiers(options: MarkdownIdentifierOptions): (tree: Root) => void;
|
|
66
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Modal";
|
|
2
2
|
export type { ModalCloseReason, ModalProps } from "./Modal";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./PinInput";
|
|
2
2
|
export type { PinInputMode, PinInputProps } from "./PinInput";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Popover";
|
|
2
2
|
export type { PopoverOpenChangeReason, PopoverPlacement, PopoverProps, } from "./Popover";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Radio";
|
|
2
2
|
export type { RadioProps } from "./Radio";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./RadioGroup";
|
|
2
2
|
export type { RadioGroupOrientation, RadioGroupProps, } from "./RadioGroup";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Select";
|
|
2
2
|
export type { CustomSelectProps, NativeSelectProps, SelectDisplayOverride, SelectOption, SelectProps, } from "./Select";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Skeleton";
|
|
2
2
|
export type { SkeletonProps, SkeletonShape } from "./Skeleton";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Spinner";
|
|
2
2
|
export type { SpinnerProps } from "./Spinner";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./Switch";
|
|
2
2
|
export type { SwitchProps } from "./Switch";
|