@bzync/rui 0.0.3
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/LICENSE +15 -0
- package/README.md +115 -0
- package/dist/autocomplete-CaysJRpk.cjs +1 -0
- package/dist/autocomplete-CfbfpcO4.js +453 -0
- package/dist/calendar-Bnld4G59.cjs +1 -0
- package/dist/calendar-CdICOROs.js +573 -0
- package/dist/charts-CxEy2c3M.js +1248 -0
- package/dist/charts-UDqS1BH1.cjs +1 -0
- package/dist/cn-BdjraxxU.cjs +1 -0
- package/dist/cn-DpgY2leY.js +1736 -0
- package/dist/component-styles-Ce56hn9T.js +16 -0
- package/dist/component-styles-TkZ7v6Ef.cjs +1 -0
- package/dist/components/accordion.cjs +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +122 -0
- package/dist/components/alert.cjs +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +165 -0
- package/dist/components/auth-backdrop.cjs +1 -0
- package/dist/components/auth-backdrop.d.ts +7 -0
- package/dist/components/auth-backdrop.js +10 -0
- package/dist/components/autocomplete/dropdown.d.ts +21 -0
- package/dist/components/autocomplete/icons.d.ts +8 -0
- package/dist/components/autocomplete/multi-trigger.d.ts +25 -0
- package/dist/components/autocomplete/single-trigger.d.ts +21 -0
- package/dist/components/autocomplete/types.d.ts +34 -0
- package/dist/components/autocomplete.cjs +1 -0
- package/dist/components/autocomplete.d.ts +5 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/avatar.cjs +1 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +56 -0
- package/dist/components/badge.cjs +1 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/billing-interval-toggle.cjs +1 -0
- package/dist/components/billing-interval-toggle.d.ts +18 -0
- package/dist/components/billing-interval-toggle.js +39 -0
- package/dist/components/breadcrumb.cjs +1 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.cjs +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +90 -0
- package/dist/components/calendar/month-view.d.ts +17 -0
- package/dist/components/calendar/types.d.ts +54 -0
- package/dist/components/calendar/week-view.d.ts +17 -0
- package/dist/components/calendar.cjs +1 -0
- package/dist/components/calendar.d.ts +3 -0
- package/dist/components/calendar.js +3 -0
- package/dist/components/callout.cjs +1 -0
- package/dist/components/callout.d.ts +9 -0
- package/dist/components/callout.js +131 -0
- package/dist/components/card.cjs +1 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +59 -0
- package/dist/components/charts/bar-chart.d.ts +16 -0
- package/dist/components/charts/donut-chart.d.ts +10 -0
- package/dist/components/charts/funnel-chart.d.ts +8 -0
- package/dist/components/charts/gantt-chart.d.ts +15 -0
- package/dist/components/charts/heatmap-chart.d.ts +10 -0
- package/dist/components/charts/index.d.ts +11 -0
- package/dist/components/charts/line-chart.d.ts +16 -0
- package/dist/components/charts/multi-line-chart.d.ts +18 -0
- package/dist/components/charts/radar-chart.d.ts +13 -0
- package/dist/components/charts/scatter-chart.d.ts +24 -0
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts/waterfall-chart.d.ts +14 -0
- package/dist/components/charts.cjs +1 -0
- package/dist/components/charts.d.ts +2 -0
- package/dist/components/charts.js +2 -0
- package/dist/components/checkbox.cjs +1 -0
- package/dist/components/checkbox.d.ts +9 -0
- package/dist/components/checkbox.js +135 -0
- package/dist/components/code.cjs +7 -0
- package/dist/components/code.d.ts +23 -0
- package/dist/components/code.js +276 -0
- package/dist/components/command.cjs +1 -0
- package/dist/components/command.d.ts +29 -0
- package/dist/components/command.js +208 -0
- package/dist/components/confirm-dialog.cjs +1 -0
- package/dist/components/confirm-dialog.d.ts +14 -0
- package/dist/components/confirm-dialog.js +69 -0
- package/dist/components/copy-button.cjs +1 -0
- package/dist/components/copy-button.d.ts +8 -0
- package/dist/components/copy-button.js +87 -0
- package/dist/components/datatable/pagination-footer.d.ts +10 -0
- package/dist/components/datatable/rows-dropdown.d.ts +5 -0
- package/dist/components/datatable/skeleton-row.d.ts +3 -0
- package/dist/components/datatable/sort-icon.d.ts +4 -0
- package/dist/components/datatable/types.d.ts +30 -0
- package/dist/components/datatable.cjs +1 -0
- package/dist/components/datatable.d.ts +9 -0
- package/dist/components/datatable.js +3 -0
- package/dist/components/datepicker.cjs +1 -0
- package/dist/components/datepicker.d.ts +14 -0
- package/dist/components/datepicker.js +267 -0
- package/dist/components/drawer.cjs +1 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/drawer.js +3 -0
- package/dist/components/dropdown-menu.cjs +1 -0
- package/dist/components/dropdown-menu.d.ts +26 -0
- package/dist/components/dropdown-menu.js +122 -0
- package/dist/components/empty-state.cjs +1 -0
- package/dist/components/empty-state.d.ts +10 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/error-state.cjs +1 -0
- package/dist/components/error-state.d.ts +10 -0
- package/dist/components/error-state.js +80 -0
- package/dist/components/file-upload.cjs +1 -0
- package/dist/components/file-upload.d.ts +10 -0
- package/dist/components/file-upload.js +173 -0
- package/dist/components/form-field.cjs +1 -0
- package/dist/components/form-field.d.ts +10 -0
- package/dist/components/form-field.js +36 -0
- package/dist/components/info-button.cjs +1 -0
- package/dist/components/info-button.d.ts +4 -0
- package/dist/components/info-button.js +32 -0
- package/dist/components/input.cjs +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +117 -0
- package/dist/components/kbd.cjs +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +16 -0
- package/dist/components/label.cjs +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +31 -0
- package/dist/components/layout.cjs +1 -0
- package/dist/components/layout.d.ts +51 -0
- package/dist/components/layout.js +117 -0
- package/dist/components/link.cjs +1 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +48 -0
- package/dist/components/list.cjs +1 -0
- package/dist/components/list.d.ts +13 -0
- package/dist/components/list.js +46 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.ts +31 -0
- package/dist/components/modal.js +219 -0
- package/dist/components/navigation.cjs +1 -0
- package/dist/components/navigation.d.ts +42 -0
- package/dist/components/navigation.js +127 -0
- package/dist/components/number-input.cjs +1 -0
- package/dist/components/number-input.d.ts +16 -0
- package/dist/components/number-input.js +142 -0
- package/dist/components/otp-input.cjs +1 -0
- package/dist/components/otp-input.d.ts +13 -0
- package/dist/components/otp-input.js +71 -0
- package/dist/components/pagination.cjs +1 -0
- package/dist/components/pagination.d.ts +8 -0
- package/dist/components/pagination.js +77 -0
- package/dist/components/popover.cjs +1 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +115 -0
- package/dist/components/progressbar.cjs +1 -0
- package/dist/components/progressbar.d.ts +15 -0
- package/dist/components/progressbar.js +108 -0
- package/dist/components/radio.cjs +1 -0
- package/dist/components/radio.d.ts +22 -0
- package/dist/components/radio.js +96 -0
- package/dist/components/richtext.cjs +1 -0
- package/dist/components/richtext.d.ts +10 -0
- package/dist/components/richtext.js +370 -0
- package/dist/components/select/option-list.d.ts +16 -0
- package/dist/components/select/select-multi.d.ts +2 -0
- package/dist/components/select/select-single.d.ts +2 -0
- package/dist/components/select/types.d.ts +54 -0
- package/dist/components/select/utils.d.ts +10 -0
- package/dist/components/select.cjs +1 -0
- package/dist/components/select.d.ts +3 -0
- package/dist/components/select.js +2 -0
- package/dist/components/seo.cjs +1 -0
- package/dist/components/seo.d.ts +45 -0
- package/dist/components/seo.js +64 -0
- package/dist/components/separator.cjs +1 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/skeleton.cjs +1 -0
- package/dist/components/skeleton.d.ts +37 -0
- package/dist/components/skeleton.js +146 -0
- package/dist/components/slider.cjs +1 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +72 -0
- package/dist/components/snackbar.cjs +1 -0
- package/dist/components/snackbar.d.ts +35 -0
- package/dist/components/snackbar.js +220 -0
- package/dist/components/spinner.cjs +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.js +31 -0
- package/dist/components/stat.cjs +1 -0
- package/dist/components/stat.d.ts +18 -0
- package/dist/components/stat.js +90 -0
- package/dist/components/status-dot.cjs +1 -0
- package/dist/components/status-dot.d.ts +10 -0
- package/dist/components/status-dot.js +29 -0
- package/dist/components/stepper.cjs +1 -0
- package/dist/components/stepper.d.ts +11 -0
- package/dist/components/stepper.js +67 -0
- package/dist/components/switch.cjs +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.cjs +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +54 -0
- package/dist/components/tabs.cjs +1 -0
- package/dist/components/tabs.d.ts +22 -0
- package/dist/components/tabs.js +120 -0
- package/dist/components/tag.cjs +1 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/terminal/fs.d.ts +10 -0
- package/dist/components/terminal/shell-commands-sim.d.ts +5 -0
- package/dist/components/terminal/shell-commands.d.ts +16 -0
- package/dist/components/terminal/shell-run.d.ts +11 -0
- package/dist/components/terminal/terminal-block.d.ts +13 -0
- package/dist/components/terminal/terminal-emulator.d.ts +10 -0
- package/dist/components/terminal/types.d.ts +35 -0
- package/dist/components/terminal.cjs +1 -0
- package/dist/components/terminal.d.ts +2 -0
- package/dist/components/terminal.js +2 -0
- package/dist/components/textarea.cjs +1 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/theme-provider.cjs +1 -0
- package/dist/components/theme-provider.d.ts +89 -0
- package/dist/components/theme-provider.js +93 -0
- package/dist/components/theme-toggle.cjs +1 -0
- package/dist/components/theme-toggle.d.ts +9 -0
- package/dist/components/theme-toggle.js +4 -0
- package/dist/components/timeline.cjs +1 -0
- package/dist/components/timeline.d.ts +14 -0
- package/dist/components/timeline.js +54 -0
- package/dist/components/tooltip.cjs +1 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +84 -0
- package/dist/components/tree.cjs +1 -0
- package/dist/components/tree.d.ts +16 -0
- package/dist/components/tree.js +92 -0
- package/dist/createLucideIcon-DDY8HuQR.js +42 -0
- package/dist/createLucideIcon-b_X_3fj-.cjs +1 -0
- package/dist/datatable-BB3v__r5.cjs +1 -0
- package/dist/datatable-DlBhUhuO.js +316 -0
- package/dist/drawer-Cbuh6qdL.cjs +1 -0
- package/dist/drawer-CqkVZT9Y.js +189 -0
- package/dist/focus-Dk1YWVPN.js +42 -0
- package/dist/focus-DmG6Ge7X.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +215 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/component-styles.d.ts +10 -0
- package/dist/select-Ch5fp1GT.js +461 -0
- package/dist/select-q0YCMhBP.cjs +1 -0
- package/dist/styles.css +3 -0
- package/dist/terminal-BOR2cFi1.js +1060 -0
- package/dist/terminal-CpraMs50.cjs +77 -0
- package/dist/theme-toggle-CnoiorKV.js +71 -0
- package/dist/theme-toggle-Dp1-24zH.cjs +1 -0
- package/dist/use-event-callback-DGkfO_uu.js +10 -0
- package/dist/use-event-callback-Du9_9eAi.cjs +1 -0
- package/dist/utils-CQ8pvCtk.js +72 -0
- package/dist/utils-DOFJTw8o.cjs +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { o as t } from "../component-styles-Ce56hn9T.js";
|
|
4
|
+
import { motion as n } from "framer-motion";
|
|
5
|
+
import { createContext as r, useContext as i, useId as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/radio.tsx
|
|
8
|
+
var c = r(null);
|
|
9
|
+
function l() {
|
|
10
|
+
let e = i(c);
|
|
11
|
+
if (!e) throw Error("Radio must be inside <RadioGroup>");
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
function u({ name: n, value: r, onChange: i, disabled: l, label: u, hint: d, error: f, orientation: p = "vertical", className: m, children: h }) {
|
|
15
|
+
let g = a(), _ = n ?? g, v = `${_}-label`, y = `${_}-message`;
|
|
16
|
+
return /* @__PURE__ */ s("div", {
|
|
17
|
+
className: e(t, m),
|
|
18
|
+
children: [
|
|
19
|
+
u && /* @__PURE__ */ o("p", {
|
|
20
|
+
id: v,
|
|
21
|
+
className: "text-sm font-medium leading-5 text-foreground",
|
|
22
|
+
children: u
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ o(c.Provider, {
|
|
25
|
+
value: {
|
|
26
|
+
name: _,
|
|
27
|
+
value: r,
|
|
28
|
+
onChange: i,
|
|
29
|
+
disabled: l
|
|
30
|
+
},
|
|
31
|
+
children: /* @__PURE__ */ o("div", {
|
|
32
|
+
role: "radiogroup",
|
|
33
|
+
"aria-labelledby": u ? v : void 0,
|
|
34
|
+
"aria-invalid": f ? !0 : void 0,
|
|
35
|
+
"aria-describedby": f || d ? y : void 0,
|
|
36
|
+
className: e("flex gap-2", p === "vertical" ? "flex-col" : "flex-row flex-wrap"),
|
|
37
|
+
children: h
|
|
38
|
+
})
|
|
39
|
+
}),
|
|
40
|
+
f && /* @__PURE__ */ o("p", {
|
|
41
|
+
id: y,
|
|
42
|
+
"aria-live": "polite",
|
|
43
|
+
className: "text-xs leading-5 text-destructive",
|
|
44
|
+
children: f
|
|
45
|
+
}),
|
|
46
|
+
d && !f && /* @__PURE__ */ o("p", {
|
|
47
|
+
id: y,
|
|
48
|
+
className: "text-xs leading-5 text-muted-foreground",
|
|
49
|
+
children: d
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function d({ value: t, label: r, description: i, disabled: c, className: u }) {
|
|
55
|
+
let { name: d, value: f, onChange: p, disabled: m } = l(), h = a(), g = f === t, _ = c ?? m;
|
|
56
|
+
return /* @__PURE__ */ s("label", {
|
|
57
|
+
htmlFor: h,
|
|
58
|
+
className: e("flex items-start gap-2.5 cursor-pointer", _ && "cursor-not-allowed opacity-50", u),
|
|
59
|
+
children: [/* @__PURE__ */ s("div", {
|
|
60
|
+
className: "relative mt-0.5 shrink-0 w-4 h-4",
|
|
61
|
+
children: [/* @__PURE__ */ o("input", {
|
|
62
|
+
type: "radio",
|
|
63
|
+
id: h,
|
|
64
|
+
name: d,
|
|
65
|
+
value: t,
|
|
66
|
+
checked: g,
|
|
67
|
+
disabled: _,
|
|
68
|
+
onChange: () => p(t),
|
|
69
|
+
className: "peer absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
70
|
+
}), /* @__PURE__ */ o("div", {
|
|
71
|
+
className: e("w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors duration-[120ms] peer-focus-visible:ring-2 peer-focus-visible:ring-focus-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-bg", g ? "bg-primary border-primary" : "bg-transparent border-black/25 dark:border-white/25"),
|
|
72
|
+
children: g && /* @__PURE__ */ o(n.span, {
|
|
73
|
+
initial: { scale: 0 },
|
|
74
|
+
animate: { scale: 1 },
|
|
75
|
+
transition: {
|
|
76
|
+
type: "spring",
|
|
77
|
+
stiffness: 600,
|
|
78
|
+
damping: 30
|
|
79
|
+
},
|
|
80
|
+
className: "w-1.5 h-1.5 rounded-full bg-white"
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
}), (r || i) && /* @__PURE__ */ s("div", {
|
|
84
|
+
className: "min-w-0",
|
|
85
|
+
children: [r && /* @__PURE__ */ o("p", {
|
|
86
|
+
className: "text-sm font-medium text-foreground leading-snug",
|
|
87
|
+
children: r
|
|
88
|
+
}), i && /* @__PURE__ */ o("p", {
|
|
89
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
90
|
+
children: i
|
|
91
|
+
})]
|
|
92
|
+
})]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { d as Radio, u as RadioGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("react"),n=require("react/jsx-runtime");function r({onClick:t,title:r,active:i,children:a}){return(0,n.jsx)(`button`,{type:`button`,title:r,onMouseDown:e=>{e.preventDefault(),t()},className:e.t(`h-7 w-7 flex items-center justify-center rounded-md text-sm transition-colors`,i?`bg-black/10 dark:bg-white/15 text-gray-900 dark:text-white`:`text-slate-500 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white hover:bg-black/6 dark:hover:bg-white/8`),children:a})}function i(){return(0,n.jsx)(`div`,{className:`w-px h-5 bg-black/10 dark:bg-white/10 mx-0.5`})}function a(e){if(typeof document>`u`)return e;let t=document.createElement(`template`);t.innerHTML=e,t.content.querySelectorAll(`script, style, iframe, object, embed, link, meta`).forEach(e=>e.remove());let n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT);for(;n.nextNode();){let e=n.currentNode;for(let t of Array.from(e.attributes)){let n=t.name.toLowerCase(),r=t.value.trim().toLowerCase();(n.startsWith(`on`)||r.startsWith(`javascript:`))&&e.removeAttribute(t.name)}}let r=t.innerHTML;return r=r.replace(/\son\w+\s*=\s*(['"])[^'"]*\1/gi,``),r}function o(e,t){return t?typeof t==`function`?t(e):a(e):e}function s({value:a=``,onChange:s,placeholder:c=`Start typing…`,className:l,minHeight:u=160,sanitize:d=!1}){let f=(0,t.useRef)(null),p=(0,t.useRef)(a);(0,t.useEffect)(()=>{let e=o(a,d);f.current&&f.current.innerHTML!==e&&(f.current.innerHTML=e,p.current=e)},[a,d]);let m=(0,t.useCallback)(()=>{let e=f.current?.innerHTML??``,t=d?o(e,d):e;t!==p.current&&(p.current=t,s?.(t))},[s,d]);function h(e,t){try{document.execCommand(e,!1,t)}catch{}f.current?.focus(),m()}function g(e){try{return document.queryCommandState(e)}catch{return!1}}return(0,n.jsxs)(`div`,{className:e.t(`rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-white dark:bg-navy-900 focus-within:ring-1 focus-within:ring-blue-500/40 focus-within:border-accent-500/30 transition-all`,l),children:[(0,n.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 px-2 py-2 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/2 dark:bg-white/2`,children:[(0,n.jsx)(r,{title:`Bold (⌘B)`,onClick:()=>h(`bold`),active:g(`bold`),children:(0,n.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`})})}),(0,n.jsx)(r,{title:`Italic (⌘I)`,onClick:()=>h(`italic`),active:g(`italic`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`19`,y1:`4`,x2:`10`,y2:`4`}),(0,n.jsx)(`line`,{x1:`14`,y1:`20`,x2:`5`,y2:`20`}),(0,n.jsx)(`line`,{x1:`15`,y1:`4`,x2:`9`,y2:`20`})]})}),(0,n.jsx)(r,{title:`Underline (⌘U)`,onClick:()=>h(`underline`),active:g(`underline`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`}),(0,n.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`})]})}),(0,n.jsx)(r,{title:`Strikethrough`,onClick:()=>h(`strikeThrough`),active:g(`strikeThrough`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4M14 12a4 4 0 0 1 0 8H6`}),(0,n.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`})]})}),(0,n.jsx)(i,{}),(0,n.jsx)(r,{title:`Heading 1`,onClick:()=>h(`formatBlock`,`<h1>`),children:(0,n.jsx)(`span`,{className:`text-[11px] font-bold`,children:`H1`})}),(0,n.jsx)(r,{title:`Heading 2`,onClick:()=>h(`formatBlock`,`<h2>`),children:(0,n.jsx)(`span`,{className:`text-[11px] font-bold`,children:`H2`})}),(0,n.jsx)(r,{title:`Paragraph`,onClick:()=>h(`formatBlock`,`<p>`),children:(0,n.jsx)(`span`,{className:`text-[11px] font-medium`,children:`P`})}),(0,n.jsx)(i,{}),(0,n.jsx)(r,{title:`Bullet list`,onClick:()=>h(`insertUnorderedList`),active:g(`insertUnorderedList`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`9`,y1:`6`,x2:`20`,y2:`6`}),(0,n.jsx)(`line`,{x1:`9`,y1:`12`,x2:`20`,y2:`12`}),(0,n.jsx)(`line`,{x1:`9`,y1:`18`,x2:`20`,y2:`18`}),(0,n.jsx)(`circle`,{cx:`4`,cy:`6`,r:`1.5`,fill:`currentColor`,stroke:`none`}),(0,n.jsx)(`circle`,{cx:`4`,cy:`12`,r:`1.5`,fill:`currentColor`,stroke:`none`}),(0,n.jsx)(`circle`,{cx:`4`,cy:`18`,r:`1.5`,fill:`currentColor`,stroke:`none`})]})}),(0,n.jsx)(r,{title:`Ordered list`,onClick:()=>h(`insertOrderedList`),active:g(`insertOrderedList`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`10`,y1:`6`,x2:`21`,y2:`6`}),(0,n.jsx)(`line`,{x1:`10`,y1:`12`,x2:`21`,y2:`12`}),(0,n.jsx)(`line`,{x1:`10`,y1:`18`,x2:`21`,y2:`18`}),(0,n.jsx)(`path`,{d:`M4 6h1v4`}),(0,n.jsx)(`path`,{d:`M4 10h2`}),(0,n.jsx)(`path`,{d:`M6 18H4c0-1 2-2 2-3s-1-1.5-2-1`})]})}),(0,n.jsx)(r,{title:`Blockquote`,onClick:()=>h(`formatBlock`,`<blockquote>`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z`}),(0,n.jsx)(`path`,{d:`M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z`})]})}),(0,n.jsx)(i,{}),(0,n.jsx)(r,{title:`Undo (⌘Z)`,onClick:()=>h(`undo`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M3 7v6h6`}),(0,n.jsx)(`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`})]})}),(0,n.jsx)(r,{title:`Redo (⌘⇧Z)`,onClick:()=>h(`redo`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M21 7v6h-6`}),(0,n.jsx)(`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`})]})}),(0,n.jsx)(r,{title:`Clear formatting`,onClick:()=>h(`removeFormat`),children:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M4 7V4h16v3`}),(0,n.jsx)(`path`,{d:`M5 20h6`}),(0,n.jsx)(`path`,{d:`M13 4 8 20`}),(0,n.jsx)(`line`,{x1:`3`,y1:`3`,x2:`21`,y2:`21`})]})})]}),(0,n.jsxs)(`div`,{className:`relative`,children:[(0,n.jsx)(`div`,{ref:f,contentEditable:!0,suppressContentEditableWarning:!0,onInput:m,onBlur:m,style:{minHeight:u},className:e.t(`px-4 py-3 text-sm text-slate-800 dark:text-slate-200 focus:outline-none`,`prose prose-sm max-w-none`,`[&_h1]:text-xl [&_h1]:font-bold [&_h1]:mb-2 [&_h1]:text-gray-900 dark:[&_h1]:text-white`,`[&_h2]:text-lg [&_h2]:font-semibold [&_h2]:mb-1.5 [&_h2]:text-gray-900 dark:[&_h2]:text-white`,`[&_p]:mb-2 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:mb-2`,`[&_blockquote]:border-l-2 [&_blockquote]:border-accent-400 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_blockquote]:italic`)}),!a&&(0,n.jsx)(`div`,{className:`pointer-events-none absolute top-3 left-4 text-sm text-slate-400 dark:text-slate-600 select-none`,"aria-hidden":!0,children:c})]})]})}exports.RichTextEditor=s;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RichTextEditorProps {
|
|
2
|
+
value?: string;
|
|
3
|
+
onChange?: (html: string) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
minHeight?: number;
|
|
7
|
+
/** Sanitize HTML before rendering to prevent XSS when value comes from untrusted sources. Pass a custom function to override. */
|
|
8
|
+
sanitize?: boolean | ((html: string) => string);
|
|
9
|
+
}
|
|
10
|
+
export declare function RichTextEditor({ value, onChange, placeholder, className, minHeight, sanitize, }: RichTextEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { useCallback as t, useEffect as n, useRef as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/richtext.tsx
|
|
6
|
+
function o({ onClick: t, title: n, active: r, children: a }) {
|
|
7
|
+
return /* @__PURE__ */ i("button", {
|
|
8
|
+
type: "button",
|
|
9
|
+
title: n,
|
|
10
|
+
onMouseDown: (e) => {
|
|
11
|
+
e.preventDefault(), t();
|
|
12
|
+
},
|
|
13
|
+
className: e("h-7 w-7 flex items-center justify-center rounded-md text-sm transition-colors", r ? "bg-black/10 dark:bg-white/15 text-gray-900 dark:text-white" : "text-slate-500 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white hover:bg-black/6 dark:hover:bg-white/8"),
|
|
14
|
+
children: a
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function s() {
|
|
18
|
+
return /* @__PURE__ */ i("div", { className: "w-px h-5 bg-black/10 dark:bg-white/10 mx-0.5" });
|
|
19
|
+
}
|
|
20
|
+
function c(e) {
|
|
21
|
+
if (typeof document > "u") return e;
|
|
22
|
+
let t = document.createElement("template");
|
|
23
|
+
t.innerHTML = e, t.content.querySelectorAll("script, style, iframe, object, embed, link, meta").forEach((e) => e.remove());
|
|
24
|
+
let n = document.createTreeWalker(t.content, NodeFilter.SHOW_ELEMENT);
|
|
25
|
+
for (; n.nextNode();) {
|
|
26
|
+
let e = n.currentNode;
|
|
27
|
+
for (let t of Array.from(e.attributes)) {
|
|
28
|
+
let n = t.name.toLowerCase(), r = t.value.trim().toLowerCase();
|
|
29
|
+
(n.startsWith("on") || r.startsWith("javascript:")) && e.removeAttribute(t.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
let r = t.innerHTML;
|
|
33
|
+
return r = r.replace(/\son\w+\s*=\s*(['"])[^'"]*\1/gi, ""), r;
|
|
34
|
+
}
|
|
35
|
+
function l(e, t) {
|
|
36
|
+
return t ? typeof t == "function" ? t(e) : c(e) : e;
|
|
37
|
+
}
|
|
38
|
+
function u({ value: c = "", onChange: u, placeholder: d = "Start typing…", className: f, minHeight: p = 160, sanitize: m = !1 }) {
|
|
39
|
+
let h = r(null), g = r(c);
|
|
40
|
+
n(() => {
|
|
41
|
+
let e = l(c, m);
|
|
42
|
+
h.current && h.current.innerHTML !== e && (h.current.innerHTML = e, g.current = e);
|
|
43
|
+
}, [c, m]);
|
|
44
|
+
let _ = t(() => {
|
|
45
|
+
let e = h.current?.innerHTML ?? "", t = m ? l(e, m) : e;
|
|
46
|
+
t !== g.current && (g.current = t, u?.(t));
|
|
47
|
+
}, [u, m]);
|
|
48
|
+
function v(e, t) {
|
|
49
|
+
try {
|
|
50
|
+
document.execCommand(e, !1, t);
|
|
51
|
+
} catch {}
|
|
52
|
+
h.current?.focus(), _();
|
|
53
|
+
}
|
|
54
|
+
function y(e) {
|
|
55
|
+
try {
|
|
56
|
+
return document.queryCommandState(e);
|
|
57
|
+
} catch {
|
|
58
|
+
return !1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ a("div", {
|
|
62
|
+
className: e("rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-white dark:bg-navy-900 focus-within:ring-1 focus-within:ring-blue-500/40 focus-within:border-accent-500/30 transition-all", f),
|
|
63
|
+
children: [/* @__PURE__ */ a("div", {
|
|
64
|
+
className: "flex flex-wrap items-center gap-0.5 px-2 py-2 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/2 dark:bg-white/2",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ i(o, {
|
|
67
|
+
title: "Bold (⌘B)",
|
|
68
|
+
onClick: () => v("bold"),
|
|
69
|
+
active: y("bold"),
|
|
70
|
+
children: /* @__PURE__ */ i("svg", {
|
|
71
|
+
width: "13",
|
|
72
|
+
height: "13",
|
|
73
|
+
viewBox: "0 0 24 24",
|
|
74
|
+
fill: "none",
|
|
75
|
+
stroke: "currentColor",
|
|
76
|
+
strokeWidth: "2.5",
|
|
77
|
+
strokeLinecap: "round",
|
|
78
|
+
strokeLinejoin: "round",
|
|
79
|
+
children: /* @__PURE__ */ i("path", { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" })
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ i(o, {
|
|
83
|
+
title: "Italic (⌘I)",
|
|
84
|
+
onClick: () => v("italic"),
|
|
85
|
+
active: y("italic"),
|
|
86
|
+
children: /* @__PURE__ */ a("svg", {
|
|
87
|
+
width: "13",
|
|
88
|
+
height: "13",
|
|
89
|
+
viewBox: "0 0 24 24",
|
|
90
|
+
fill: "none",
|
|
91
|
+
stroke: "currentColor",
|
|
92
|
+
strokeWidth: "2.5",
|
|
93
|
+
strokeLinecap: "round",
|
|
94
|
+
strokeLinejoin: "round",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ i("line", {
|
|
97
|
+
x1: "19",
|
|
98
|
+
y1: "4",
|
|
99
|
+
x2: "10",
|
|
100
|
+
y2: "4"
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ i("line", {
|
|
103
|
+
x1: "14",
|
|
104
|
+
y1: "20",
|
|
105
|
+
x2: "5",
|
|
106
|
+
y2: "20"
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ i("line", {
|
|
109
|
+
x1: "15",
|
|
110
|
+
y1: "4",
|
|
111
|
+
x2: "9",
|
|
112
|
+
y2: "20"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ i(o, {
|
|
118
|
+
title: "Underline (⌘U)",
|
|
119
|
+
onClick: () => v("underline"),
|
|
120
|
+
active: y("underline"),
|
|
121
|
+
children: /* @__PURE__ */ a("svg", {
|
|
122
|
+
width: "13",
|
|
123
|
+
height: "13",
|
|
124
|
+
viewBox: "0 0 24 24",
|
|
125
|
+
fill: "none",
|
|
126
|
+
stroke: "currentColor",
|
|
127
|
+
strokeWidth: "2.5",
|
|
128
|
+
strokeLinecap: "round",
|
|
129
|
+
strokeLinejoin: "round",
|
|
130
|
+
children: [/* @__PURE__ */ i("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ i("line", {
|
|
131
|
+
x1: "4",
|
|
132
|
+
y1: "20",
|
|
133
|
+
x2: "20",
|
|
134
|
+
y2: "20"
|
|
135
|
+
})]
|
|
136
|
+
})
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ i(o, {
|
|
139
|
+
title: "Strikethrough",
|
|
140
|
+
onClick: () => v("strikeThrough"),
|
|
141
|
+
active: y("strikeThrough"),
|
|
142
|
+
children: /* @__PURE__ */ a("svg", {
|
|
143
|
+
width: "13",
|
|
144
|
+
height: "13",
|
|
145
|
+
viewBox: "0 0 24 24",
|
|
146
|
+
fill: "none",
|
|
147
|
+
stroke: "currentColor",
|
|
148
|
+
strokeWidth: "2",
|
|
149
|
+
strokeLinecap: "round",
|
|
150
|
+
strokeLinejoin: "round",
|
|
151
|
+
children: [/* @__PURE__ */ i("path", { d: "M16 4H9a3 3 0 0 0-2.83 4M14 12a4 4 0 0 1 0 8H6" }), /* @__PURE__ */ i("line", {
|
|
152
|
+
x1: "4",
|
|
153
|
+
y1: "12",
|
|
154
|
+
x2: "20",
|
|
155
|
+
y2: "12"
|
|
156
|
+
})]
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ i(s, {}),
|
|
160
|
+
/* @__PURE__ */ i(o, {
|
|
161
|
+
title: "Heading 1",
|
|
162
|
+
onClick: () => v("formatBlock", "<h1>"),
|
|
163
|
+
children: /* @__PURE__ */ i("span", {
|
|
164
|
+
className: "text-[11px] font-bold",
|
|
165
|
+
children: "H1"
|
|
166
|
+
})
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ i(o, {
|
|
169
|
+
title: "Heading 2",
|
|
170
|
+
onClick: () => v("formatBlock", "<h2>"),
|
|
171
|
+
children: /* @__PURE__ */ i("span", {
|
|
172
|
+
className: "text-[11px] font-bold",
|
|
173
|
+
children: "H2"
|
|
174
|
+
})
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ i(o, {
|
|
177
|
+
title: "Paragraph",
|
|
178
|
+
onClick: () => v("formatBlock", "<p>"),
|
|
179
|
+
children: /* @__PURE__ */ i("span", {
|
|
180
|
+
className: "text-[11px] font-medium",
|
|
181
|
+
children: "P"
|
|
182
|
+
})
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ i(s, {}),
|
|
185
|
+
/* @__PURE__ */ i(o, {
|
|
186
|
+
title: "Bullet list",
|
|
187
|
+
onClick: () => v("insertUnorderedList"),
|
|
188
|
+
active: y("insertUnorderedList"),
|
|
189
|
+
children: /* @__PURE__ */ a("svg", {
|
|
190
|
+
width: "13",
|
|
191
|
+
height: "13",
|
|
192
|
+
viewBox: "0 0 24 24",
|
|
193
|
+
fill: "none",
|
|
194
|
+
stroke: "currentColor",
|
|
195
|
+
strokeWidth: "2",
|
|
196
|
+
strokeLinecap: "round",
|
|
197
|
+
strokeLinejoin: "round",
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ i("line", {
|
|
200
|
+
x1: "9",
|
|
201
|
+
y1: "6",
|
|
202
|
+
x2: "20",
|
|
203
|
+
y2: "6"
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ i("line", {
|
|
206
|
+
x1: "9",
|
|
207
|
+
y1: "12",
|
|
208
|
+
x2: "20",
|
|
209
|
+
y2: "12"
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ i("line", {
|
|
212
|
+
x1: "9",
|
|
213
|
+
y1: "18",
|
|
214
|
+
x2: "20",
|
|
215
|
+
y2: "18"
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ i("circle", {
|
|
218
|
+
cx: "4",
|
|
219
|
+
cy: "6",
|
|
220
|
+
r: "1.5",
|
|
221
|
+
fill: "currentColor",
|
|
222
|
+
stroke: "none"
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ i("circle", {
|
|
225
|
+
cx: "4",
|
|
226
|
+
cy: "12",
|
|
227
|
+
r: "1.5",
|
|
228
|
+
fill: "currentColor",
|
|
229
|
+
stroke: "none"
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ i("circle", {
|
|
232
|
+
cx: "4",
|
|
233
|
+
cy: "18",
|
|
234
|
+
r: "1.5",
|
|
235
|
+
fill: "currentColor",
|
|
236
|
+
stroke: "none"
|
|
237
|
+
})
|
|
238
|
+
]
|
|
239
|
+
})
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ i(o, {
|
|
242
|
+
title: "Ordered list",
|
|
243
|
+
onClick: () => v("insertOrderedList"),
|
|
244
|
+
active: y("insertOrderedList"),
|
|
245
|
+
children: /* @__PURE__ */ a("svg", {
|
|
246
|
+
width: "13",
|
|
247
|
+
height: "13",
|
|
248
|
+
viewBox: "0 0 24 24",
|
|
249
|
+
fill: "none",
|
|
250
|
+
stroke: "currentColor",
|
|
251
|
+
strokeWidth: "2",
|
|
252
|
+
strokeLinecap: "round",
|
|
253
|
+
strokeLinejoin: "round",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ i("line", {
|
|
256
|
+
x1: "10",
|
|
257
|
+
y1: "6",
|
|
258
|
+
x2: "21",
|
|
259
|
+
y2: "6"
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ i("line", {
|
|
262
|
+
x1: "10",
|
|
263
|
+
y1: "12",
|
|
264
|
+
x2: "21",
|
|
265
|
+
y2: "12"
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ i("line", {
|
|
268
|
+
x1: "10",
|
|
269
|
+
y1: "18",
|
|
270
|
+
x2: "21",
|
|
271
|
+
y2: "18"
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ i("path", { d: "M4 6h1v4" }),
|
|
274
|
+
/* @__PURE__ */ i("path", { d: "M4 10h2" }),
|
|
275
|
+
/* @__PURE__ */ i("path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" })
|
|
276
|
+
]
|
|
277
|
+
})
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ i(o, {
|
|
280
|
+
title: "Blockquote",
|
|
281
|
+
onClick: () => v("formatBlock", "<blockquote>"),
|
|
282
|
+
children: /* @__PURE__ */ a("svg", {
|
|
283
|
+
width: "13",
|
|
284
|
+
height: "13",
|
|
285
|
+
viewBox: "0 0 24 24",
|
|
286
|
+
fill: "none",
|
|
287
|
+
stroke: "currentColor",
|
|
288
|
+
strokeWidth: "2",
|
|
289
|
+
strokeLinecap: "round",
|
|
290
|
+
strokeLinejoin: "round",
|
|
291
|
+
children: [/* @__PURE__ */ i("path", { d: "M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" }), /* @__PURE__ */ i("path", { d: "M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" })]
|
|
292
|
+
})
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ i(s, {}),
|
|
295
|
+
/* @__PURE__ */ i(o, {
|
|
296
|
+
title: "Undo (⌘Z)",
|
|
297
|
+
onClick: () => v("undo"),
|
|
298
|
+
children: /* @__PURE__ */ a("svg", {
|
|
299
|
+
width: "13",
|
|
300
|
+
height: "13",
|
|
301
|
+
viewBox: "0 0 24 24",
|
|
302
|
+
fill: "none",
|
|
303
|
+
stroke: "currentColor",
|
|
304
|
+
strokeWidth: "2",
|
|
305
|
+
strokeLinecap: "round",
|
|
306
|
+
strokeLinejoin: "round",
|
|
307
|
+
children: [/* @__PURE__ */ i("path", { d: "M3 7v6h6" }), /* @__PURE__ */ i("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })]
|
|
308
|
+
})
|
|
309
|
+
}),
|
|
310
|
+
/* @__PURE__ */ i(o, {
|
|
311
|
+
title: "Redo (⌘⇧Z)",
|
|
312
|
+
onClick: () => v("redo"),
|
|
313
|
+
children: /* @__PURE__ */ a("svg", {
|
|
314
|
+
width: "13",
|
|
315
|
+
height: "13",
|
|
316
|
+
viewBox: "0 0 24 24",
|
|
317
|
+
fill: "none",
|
|
318
|
+
stroke: "currentColor",
|
|
319
|
+
strokeWidth: "2",
|
|
320
|
+
strokeLinecap: "round",
|
|
321
|
+
strokeLinejoin: "round",
|
|
322
|
+
children: [/* @__PURE__ */ i("path", { d: "M21 7v6h-6" }), /* @__PURE__ */ i("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })]
|
|
323
|
+
})
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ i(o, {
|
|
326
|
+
title: "Clear formatting",
|
|
327
|
+
onClick: () => v("removeFormat"),
|
|
328
|
+
children: /* @__PURE__ */ a("svg", {
|
|
329
|
+
width: "13",
|
|
330
|
+
height: "13",
|
|
331
|
+
viewBox: "0 0 24 24",
|
|
332
|
+
fill: "none",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
strokeWidth: "2",
|
|
335
|
+
strokeLinecap: "round",
|
|
336
|
+
strokeLinejoin: "round",
|
|
337
|
+
children: [
|
|
338
|
+
/* @__PURE__ */ i("path", { d: "M4 7V4h16v3" }),
|
|
339
|
+
/* @__PURE__ */ i("path", { d: "M5 20h6" }),
|
|
340
|
+
/* @__PURE__ */ i("path", { d: "M13 4 8 20" }),
|
|
341
|
+
/* @__PURE__ */ i("line", {
|
|
342
|
+
x1: "3",
|
|
343
|
+
y1: "3",
|
|
344
|
+
x2: "21",
|
|
345
|
+
y2: "21"
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
})
|
|
349
|
+
})
|
|
350
|
+
]
|
|
351
|
+
}), /* @__PURE__ */ a("div", {
|
|
352
|
+
className: "relative",
|
|
353
|
+
children: [/* @__PURE__ */ i("div", {
|
|
354
|
+
ref: h,
|
|
355
|
+
contentEditable: !0,
|
|
356
|
+
suppressContentEditableWarning: !0,
|
|
357
|
+
onInput: _,
|
|
358
|
+
onBlur: _,
|
|
359
|
+
style: { minHeight: p },
|
|
360
|
+
className: e("px-4 py-3 text-sm text-slate-800 dark:text-slate-200 focus:outline-none", "prose prose-sm max-w-none", "[&_h1]:text-xl [&_h1]:font-bold [&_h1]:mb-2 [&_h1]:text-gray-900 dark:[&_h1]:text-white", "[&_h2]:text-lg [&_h2]:font-semibold [&_h2]:mb-1.5 [&_h2]:text-gray-900 dark:[&_h2]:text-white", "[&_p]:mb-2 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:mb-2", "[&_blockquote]:border-l-2 [&_blockquote]:border-accent-400 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_blockquote]:italic")
|
|
361
|
+
}), !c && /* @__PURE__ */ i("div", {
|
|
362
|
+
className: "pointer-events-none absolute top-3 left-4 text-sm text-slate-400 dark:text-slate-600 select-none",
|
|
363
|
+
"aria-hidden": !0,
|
|
364
|
+
children: d
|
|
365
|
+
})]
|
|
366
|
+
})]
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
export { u as RichTextEditor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FlatOption, MenuPos, SelectItem, SelectOption, SelectOptionColor } from './types';
|
|
2
|
+
export declare function OptionList({ listId, listRef, open, pos, options, flat, activeIdx, setActiveIdx, isSelected, onSelect, colorDot, multiselectable, className, }: {
|
|
3
|
+
listId: string;
|
|
4
|
+
listRef: React.RefObject<HTMLUListElement | null>;
|
|
5
|
+
open: boolean;
|
|
6
|
+
pos: MenuPos | null;
|
|
7
|
+
options: SelectItem[];
|
|
8
|
+
flat: FlatOption[];
|
|
9
|
+
activeIdx: number;
|
|
10
|
+
setActiveIdx: (i: number) => void;
|
|
11
|
+
isSelected: (value: string) => boolean;
|
|
12
|
+
onSelect: (opt: SelectOption) => void;
|
|
13
|
+
colorDot: Record<SelectOptionColor, string>;
|
|
14
|
+
multiselectable?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SelectOptionColor = "default" | "success" | "warning" | "error" | "info";
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
color?: SelectOptionColor;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectOptionGroup {
|
|
12
|
+
group: string;
|
|
13
|
+
options: SelectOption[];
|
|
14
|
+
}
|
|
15
|
+
export type SelectItem = SelectOption | SelectOptionGroup;
|
|
16
|
+
export interface SelectPropsBase {
|
|
17
|
+
options: SelectItem[];
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
hint?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
clearable?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
wrapperClassName?: string;
|
|
27
|
+
triggerClassName?: string;
|
|
28
|
+
listClassName?: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
unstyled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface SelectPropsSingle extends SelectPropsBase {
|
|
33
|
+
multiple?: false;
|
|
34
|
+
value?: string;
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
onChange?: (value: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface SelectPropsMulti extends SelectPropsBase {
|
|
39
|
+
multiple: true;
|
|
40
|
+
value?: string[];
|
|
41
|
+
defaultValue?: string[];
|
|
42
|
+
onChange?: (value: string[]) => void;
|
|
43
|
+
}
|
|
44
|
+
export type SelectProps = SelectPropsSingle | SelectPropsMulti;
|
|
45
|
+
export interface FlatOption extends SelectOption {
|
|
46
|
+
flatIdx: number;
|
|
47
|
+
}
|
|
48
|
+
export interface MenuPos {
|
|
49
|
+
top: number;
|
|
50
|
+
left: number;
|
|
51
|
+
width: number;
|
|
52
|
+
maxHeight: number;
|
|
53
|
+
placement: "top" | "bottom";
|
|
54
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { FlatOption, MenuPos, SelectItem, SelectOptionColor, SelectOptionGroup } from './types';
|
|
3
|
+
export declare function isGroup(item: SelectItem): item is SelectOptionGroup;
|
|
4
|
+
export declare const colorDot: Record<SelectOptionColor, string>;
|
|
5
|
+
export declare function flatten(items: SelectItem[]): FlatOption[];
|
|
6
|
+
export declare function useMenuPosition(open: boolean, anchorRef: RefObject<HTMLElement | null>): MenuPos | null;
|
|
7
|
+
export declare const XIcon: () => import("react").JSX.Element;
|
|
8
|
+
export declare const ChevronIcon: ({ open }: {
|
|
9
|
+
open: boolean;
|
|
10
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../select-q0YCMhBP.cjs");exports.Select=e.t;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SelectProps } from './select/types';
|
|
2
|
+
export type { SelectOptionColor, SelectOption, SelectOptionGroup, SelectItem, SelectPropsBase, SelectPropsSingle, SelectPropsMulti, SelectProps, } from './select/types';
|
|
3
|
+
export declare const Select: import('react').ForwardRefExoticComponent<SelectProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("react/jsx-runtime");function n({alt:n,loading:r=`lazy`,decoding:i=`async`,className:a,width:o,height:s,style:c,...l}){return(!n||n.trim()===``)&&console.warn(`[rtui SeoImage] alt text is required for SEO and accessibility. Provide a descriptive alt.`),(0,t.jsx)(`img`,{alt:n,loading:r,decoding:i,width:o,height:s,className:e.t(o&&s?`h-auto`:void 0,a),style:o&&s?{aspectRatio:`${o}/${s}`,...c}:c,...l})}function r({data:e,id:n}){let r=Array.isArray(e)?e:[e];return(0,t.jsx)(t.Fragment,{children:r.map((e,i)=>(0,t.jsx)(`script`,{id:n&&r.length===1?n:void 0,type:`application/ld+json`,dangerouslySetInnerHTML:{__html:JSON.stringify(e).replace(/</g,`\\u003c`)}},n?`${n}-${i}`:i))})}function i({items:e,id:n=`breadcrumb-jsonld`}){let i={"@context":`https://schema.org`,"@type":`BreadcrumbList`,itemListElement:e.map((e,t)=>({"@type":`ListItem`,position:t+1,name:e.name,...e.item?{item:e.item}:{}}))};return(0,t.jsx)(r,{data:i,id:n})}function a({headline:e,description:n,url:i,image:a,authorName:o,datePublished:s,dateModified:c,id:l=`article-jsonld`}){let u={"@context":`https://schema.org`,"@type":`Article`,headline:e,...n?{description:n}:{},...i?{url:i}:{},...a?{image:a}:{},...o?{author:{"@type":`Person`,name:o}}:{},...s?{datePublished:s}:{},...c?{dateModified:c}:{}};return(0,t.jsx)(r,{data:u,id:l})}exports.ArticleJsonLd=a,exports.BreadcrumbJsonLd=i,exports.SeoImage=n,exports.StructuredData=r;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface SeoImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
2
|
+
src: string;
|
|
3
|
+
alt: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* SEO-safe image that enforces alt text and mitigates CLS/LCP penalties.
|
|
9
|
+
* Uses native <img> intentionally — library never assumes next/image availability.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SeoImage({ alt, loading, decoding, className, width, height, style, ...props }: SeoImageProps): import("react").JSX.Element;
|
|
12
|
+
export interface StructuredDataProps {
|
|
13
|
+
data: Record<string, unknown> | Record<string, unknown>[];
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Emits application/ld+json. Use for Organization, Article, Product, FAQPage, etc.
|
|
18
|
+
* Sanitizes via JSON.stringify — never use dangerouslySetInnerHTML with raw strings.
|
|
19
|
+
*/
|
|
20
|
+
export declare function StructuredData({ data, id }: StructuredDataProps): import("react").JSX.Element;
|
|
21
|
+
export interface BreadcrumbJsonLdItem {
|
|
22
|
+
name: string;
|
|
23
|
+
item?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface BreadcrumbJsonLdProps {
|
|
26
|
+
items: BreadcrumbJsonLdItem[];
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Breadcrumb JSON-LD — pair with <Breadcrumb> for dual SEO signal (visible nav + structured data).
|
|
31
|
+
* @example
|
|
32
|
+
* <BreadcrumbJsonLd items={[{name:"Home", item:"https://example.com"}, {name:"Docs"}]} />
|
|
33
|
+
*/
|
|
34
|
+
export declare function BreadcrumbJsonLd({ items, id }: BreadcrumbJsonLdProps): import("react").JSX.Element;
|
|
35
|
+
export interface ArticleJsonLdProps {
|
|
36
|
+
headline: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
image?: string;
|
|
40
|
+
authorName?: string;
|
|
41
|
+
datePublished?: string;
|
|
42
|
+
dateModified?: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function ArticleJsonLd({ headline, description, url, image, authorName, datePublished, dateModified, id, }: ArticleJsonLdProps): import("react").JSX.Element;
|