@bzync/rui 0.0.4 → 0.0.8
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/README.md +10 -0
- package/dist/autocomplete-D6z5B-WU.cjs +1 -0
- package/dist/{autocomplete-BgKbj6M4.js → autocomplete-bgySuP8X.js} +149 -142
- package/dist/calendar-CQumLNgS.cjs +1 -0
- package/dist/{calendar-j2_zvum1.js → calendar-nkYCMEy3.js} +9 -9
- package/dist/charts-Cot5lCgC.cjs +1 -0
- package/dist/{charts-CxEy2c3M.js → charts-Dscl6UC3.js} +122 -145
- package/dist/cn-B6R3HKzx.cjs +1 -0
- package/dist/{cn-DpgY2leY.js → cn-BJyZJP-y.js} +389 -389
- package/dist/{component-styles-Bgy44fc8.js → component-styles-C2CbHEEA.js} +2 -2
- package/dist/component-styles-DY4wigiq.cjs +1 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.cjs +1 -1
- package/dist/components/alert.js +3 -3
- package/dist/components/aspect-ratio.cjs +1 -0
- package/dist/components/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio.js +20 -0
- package/dist/components/auth-backdrop.cjs +1 -1
- package/dist/components/auth-backdrop.d.ts +4 -1
- package/dist/components/auth-backdrop.js +12 -8
- package/dist/components/autocomplete/dropdown.d.ts +4 -1
- package/dist/components/autocomplete/multi-trigger.d.ts +3 -1
- package/dist/components/autocomplete/single-trigger.d.ts +3 -1
- package/dist/components/autocomplete/types.d.ts +15 -0
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.cjs +1 -0
- package/dist/components/avatar-group.d.ts +14 -0
- package/dist/components/avatar-group.js +35 -0
- package/dist/components/avatar.cjs +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/billing-interval-toggle.cjs +1 -1
- package/dist/components/billing-interval-toggle.d.ts +4 -6
- package/dist/components/billing-interval-toggle.js +26 -19
- package/dist/components/blockquote.cjs +1 -0
- package/dist/components/blockquote.d.ts +10 -0
- package/dist/components/blockquote.js +32 -0
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/button-group.cjs +1 -0
- package/dist/components/button-group.d.ts +7 -0
- package/dist/components/button-group.js +26 -0
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +79 -36
- package/dist/components/calendar.cjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.js +14 -14
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts.cjs +1 -1
- package/dist/components/charts.js +1 -1
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.js +3 -3
- package/dist/components/code.cjs +3 -3
- package/dist/components/code.d.ts +4 -4
- package/dist/components/code.js +62 -60
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.d.ts +8 -1
- package/dist/components/command.js +84 -83
- package/dist/components/confirm-dialog.cjs +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -1
- package/dist/components/confirm-dialog.js +37 -31
- package/dist/components/copy-button.cjs +1 -1
- package/dist/components/copy-button.js +5 -4
- package/dist/components/currency.cjs +1 -0
- package/dist/components/currency.d.ts +18 -0
- package/dist/components/currency.js +62 -0
- package/dist/components/datatable/types.d.ts +4 -0
- package/dist/components/datatable.cjs +1 -1
- package/dist/components/datatable.d.ts +1 -5
- package/dist/components/datatable.js +1 -1
- package/dist/components/datepicker.cjs +1 -1
- package/dist/components/datepicker.d.ts +3 -3
- package/dist/components/datepicker.js +234 -105
- package/dist/components/description-list.cjs +1 -0
- package/dist/components/description-list.d.ts +14 -0
- package/dist/components/description-list.js +38 -0
- package/dist/components/divider.cjs +1 -0
- package/dist/components/divider.d.ts +12 -0
- package/dist/components/divider.js +45 -0
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.d.ts +6 -1
- package/dist/components/drawer.js +128 -2
- package/dist/components/dropdown-menu-panel.cjs +1 -0
- package/dist/components/dropdown-menu-panel.d.ts +24 -0
- package/dist/components/dropdown-menu-panel.js +84 -0
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -1
- package/dist/components/dropdown-menu.js +38 -93
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.ts +5 -1
- package/dist/components/empty-state.js +9 -9
- package/dist/components/error-state.cjs +1 -1
- package/dist/components/error-state.js +2 -2
- package/dist/components/file-upload.cjs +1 -1
- package/dist/components/file-upload.js +4 -4
- package/dist/components/form-field.cjs +1 -1
- package/dist/components/form-field.d.ts +9 -0
- package/dist/components/form-field.js +49 -14
- package/dist/components/info-button.cjs +1 -1
- package/dist/components/info-button.d.ts +5 -3
- package/dist/components/info-button.js +33 -29
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.cjs +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.cjs +1 -1
- package/dist/components/label.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link.cjs +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.ts +8 -1
- package/dist/components/modal.js +74 -120
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.js +2 -2
- package/dist/components/number-input.cjs +1 -1
- package/dist/components/number-input.js +3 -3
- package/dist/components/otp-input.cjs +1 -1
- package/dist/components/otp-input.js +2 -2
- package/dist/components/overlay.cjs +1 -0
- package/dist/components/overlay.d.ts +52 -0
- package/dist/components/overlay.js +87 -0
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.ts +2 -1
- package/dist/components/popover.js +41 -40
- package/dist/components/progressbar.cjs +1 -1
- package/dist/components/progressbar.js +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +3 -3
- package/dist/components/rating.cjs +1 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +75 -0
- package/dist/components/richtext.cjs +1 -1
- package/dist/components/richtext.js +2 -2
- package/dist/components/scroll-area.cjs +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/select/option-list.d.ts +3 -1
- package/dist/components/select/types.d.ts +4 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/seo.cjs +1 -1
- package/dist/components/seo.js +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.d.ts +14 -1
- package/dist/components/skeleton.js +56 -4
- package/dist/components/slider.cjs +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slot.cjs +1 -0
- package/dist/components/slot.d.ts +12 -0
- package/dist/components/slot.js +16 -0
- package/dist/components/snackbar-viewport.cjs +1 -0
- package/dist/components/snackbar-viewport.d.ts +27 -0
- package/dist/components/snackbar-viewport.js +181 -0
- package/dist/components/snackbar.cjs +1 -1
- package/dist/components/snackbar.d.ts +5 -1
- package/dist/components/snackbar.js +36 -200
- package/dist/components/spinner.cjs +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/stat.cjs +1 -1
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.cjs +1 -1
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +5 -5
- package/dist/components/switch.cjs +1 -1
- package/dist/components/switch.js +37 -43
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.d.ts +6 -4
- package/dist/components/tabs.js +51 -81
- package/dist/components/tag.cjs +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/terminal.cjs +1 -1
- package/dist/components/terminal.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/theme-provider.cjs +1 -1
- package/dist/components/theme-provider.js +1 -1
- package/dist/components/theme-toggle.cjs +1 -1
- package/dist/components/theme-toggle.js +27 -3
- package/dist/components/time-picker.cjs +1 -0
- package/dist/components/time-picker.d.ts +31 -0
- package/dist/components/time-picker.js +394 -0
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle.cjs +1 -0
- package/dist/components/toggle.d.ts +42 -0
- package/dist/components/toggle.js +116 -0
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.d.ts +2 -1
- package/dist/components/tooltip.js +37 -36
- package/dist/components/tree.cjs +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/typography.cjs +1 -0
- package/dist/components/typography.d.ts +50 -0
- package/dist/components/typography.js +202 -0
- package/dist/components/visually-hidden.cjs +1 -0
- package/dist/components/visually-hidden.d.ts +16 -0
- package/dist/components/visually-hidden.js +13 -0
- package/dist/{datatable-yBN4M3UV.js → datatable-BJoZMrKI.js} +6 -6
- package/dist/datatable-t0U7t_xh.cjs +1 -0
- package/dist/icons-Dfetr1L2.cjs +1 -0
- package/dist/icons-Dk7VZ4Ph.js +51 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +125 -86
- package/dist/lib/cn.d.ts +13 -1
- package/dist/lib/component-styles.d.ts +14 -2
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/motion.d.ts +58 -0
- package/dist/motion-B2shivEB.cjs +1 -0
- package/dist/motion-gnRzFS5f.js +62 -0
- package/dist/select-ByjnuEcE.cjs +1 -0
- package/dist/{select-ClWrcj3R.js → select-CiMzLhUK.js} +128 -122
- package/dist/styles.css +1 -1
- package/dist/{terminal-CpraMs50.cjs → terminal-1U0ftG3i.cjs} +2 -2
- package/dist/{terminal-BOR2cFi1.js → terminal-VXdxVoAv.js} +4 -4
- package/dist/use-focus-trap-CPLT49gN.cjs +1 -0
- package/dist/use-focus-trap-CS6BXJAB.js +77 -0
- package/dist/{utils-CQ8pvCtk.js → utils-DEw5mQrH.js} +1 -1
- package/dist/{utils-DOFJTw8o.cjs → utils-MnnCTelh.cjs} +1 -1
- package/package.json +56 -9
- package/dist/autocomplete-Bk4pRQ2R.cjs +0 -1
- package/dist/calendar-CUXpVrVE.cjs +0 -1
- package/dist/charts-UDqS1BH1.cjs +0 -1
- package/dist/cn-BdjraxxU.cjs +0 -1
- package/dist/component-styles-DOUctc8_.cjs +0 -1
- package/dist/createLucideIcon-DDY8HuQR.js +0 -42
- package/dist/createLucideIcon-b_X_3fj-.cjs +0 -1
- package/dist/datatable-rzDgQ3r6.cjs +0 -1
- package/dist/drawer-CTeBsYrO.cjs +0 -1
- package/dist/drawer-ixuzyLVS.js +0 -189
- package/dist/select-BFwx--uK.cjs +0 -1
- package/dist/theme-toggle-Bb0BYo51.js +0 -71
- package/dist/theme-toggle-Cld8tktJ.cjs +0 -1
package/dist/components/code.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { forwardRef as t, useRef as n, useState as r } from "react";
|
|
4
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/code.tsx
|
|
6
|
-
var
|
|
6
|
+
var s = {
|
|
7
7
|
js: /* @__PURE__ */ "const.let.var.function.return.if.else.for.while.class.import.export.default.from.async.await.new.typeof.instanceof.true.false.null.undefined.throw.try.catch.finally.switch.case.break.continue.extends.super.this.of.in.delete.void".split("."),
|
|
8
8
|
python: /* @__PURE__ */ "def.return.if.else.elif.for.while.class.import.from.as.with.try.except.finally.raise.pass.break.continue.and.or.not.in.is.True.False.None.lambda.yield.global.nonlocal.del.print.async.await".split("."),
|
|
9
9
|
bash: [
|
|
@@ -30,9 +30,9 @@ var o = {
|
|
|
30
30
|
],
|
|
31
31
|
sql: /* @__PURE__ */ "SELECT.FROM.WHERE.AND.OR.NOT.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.DROP.ALTER.INDEX.JOIN.INNER.LEFT.RIGHT.ON.GROUP.BY.ORDER.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MAX.MIN.NULL.IS.IN.LIKE.BETWEEN.EXISTS".split(".")
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
let n = new Set(
|
|
33
|
+
s.ts = s.js, s.tsx = s.js, s.jsx = s.js, s.json = [];
|
|
34
|
+
function c(e, t) {
|
|
35
|
+
let n = new Set(s[t.toLowerCase()] ?? s.js), r = [], i = 0;
|
|
36
36
|
for (; i < e.length;) {
|
|
37
37
|
if (t === "bash" && e[i] === "#" || e.slice(i, i + 2) === "//" && t !== "bash") {
|
|
38
38
|
let t = e.indexOf("\n", i), n = t === -1 ? e.slice(i) : e.slice(i, t);
|
|
@@ -110,7 +110,7 @@ function s(e, t) {
|
|
|
110
110
|
}
|
|
111
111
|
return r;
|
|
112
112
|
}
|
|
113
|
-
var
|
|
113
|
+
var l = {
|
|
114
114
|
keyword: "text-violet-500 dark:text-violet-400",
|
|
115
115
|
string: "text-emerald-600 dark:text-emerald-400",
|
|
116
116
|
comment: "text-slate-400 dark:text-slate-500 italic",
|
|
@@ -119,8 +119,8 @@ var c = {
|
|
|
119
119
|
builtin: "text-sky-500 dark:text-sky-400",
|
|
120
120
|
plain: "text-slate-800 dark:text-slate-200"
|
|
121
121
|
};
|
|
122
|
-
function
|
|
123
|
-
let [f, p] =
|
|
122
|
+
function u({ code: t, language: n = "js", filename: s, showLineNumbers: u = !1, className: d }) {
|
|
123
|
+
let [f, p] = r(!1), m = t.replace(/^\n/, "").replace(/\n$/, ""), h = m.split("\n");
|
|
124
124
|
async function g() {
|
|
125
125
|
let e = !1;
|
|
126
126
|
try {
|
|
@@ -132,27 +132,28 @@ function l({ code: t, language: o = "js", filename: l, showLineNumbers: u = !1,
|
|
|
132
132
|
}
|
|
133
133
|
e && (p(!0), window.setTimeout(() => p(!1), 1500));
|
|
134
134
|
}
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
className: e("group relative rounded-xl overflow-hidden border border-
|
|
137
|
-
children: [/* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ o("div", {
|
|
136
|
+
className: e("group relative rounded-[var(--radius-xl)] overflow-hidden border border-border bg-surface-muted dark:bg-navy-900", d),
|
|
137
|
+
children: [/* @__PURE__ */ o("div", {
|
|
138
138
|
className: "flex items-center justify-between px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ a("div", {
|
|
140
140
|
className: "flex items-center gap-2",
|
|
141
|
-
children:
|
|
141
|
+
children: s && /* @__PURE__ */ a("span", {
|
|
142
142
|
className: "text-xs font-mono text-slate-500 dark:text-slate-400",
|
|
143
|
-
children:
|
|
143
|
+
children: s
|
|
144
144
|
})
|
|
145
|
-
}), /* @__PURE__ */
|
|
145
|
+
}), /* @__PURE__ */ o("div", {
|
|
146
146
|
className: "flex items-center gap-2",
|
|
147
|
-
children: [!
|
|
147
|
+
children: [!s && /* @__PURE__ */ a("span", {
|
|
148
148
|
className: "text-xs font-mono text-slate-400 dark:text-slate-500 uppercase",
|
|
149
|
-
children:
|
|
150
|
-
}), /* @__PURE__ */
|
|
149
|
+
children: n
|
|
150
|
+
}), /* @__PURE__ */ a("button", {
|
|
151
151
|
type: "button",
|
|
152
152
|
onClick: g,
|
|
153
153
|
"aria-label": f ? "Copied code" : "Copy code",
|
|
154
|
-
className: "h-6 px-2 flex items-center gap-1 rounded text-xs text-slate-500 dark:text-slate-400 hover:text-
|
|
155
|
-
children: f ? /* @__PURE__ */
|
|
154
|
+
className: "h-6 shrink-0 px-2 flex items-center gap-1 whitespace-nowrap rounded text-xs text-slate-500 dark:text-slate-400 hover:text-foreground hover:bg-black/6 dark:hover:bg-white/8 transition-colors",
|
|
155
|
+
children: f ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("svg", {
|
|
156
|
+
className: "shrink-0",
|
|
156
157
|
width: "11",
|
|
157
158
|
height: "11",
|
|
158
159
|
viewBox: "0 0 24 24",
|
|
@@ -161,8 +162,9 @@ function l({ code: t, language: o = "js", filename: l, showLineNumbers: u = !1,
|
|
|
161
162
|
strokeWidth: "2.5",
|
|
162
163
|
strokeLinecap: "round",
|
|
163
164
|
strokeLinejoin: "round",
|
|
164
|
-
children: /* @__PURE__ */
|
|
165
|
-
}), "Copied"] }) : /* @__PURE__ */
|
|
165
|
+
children: /* @__PURE__ */ a("path", { d: "M20 6 9 17l-5-5" })
|
|
166
|
+
}), "Copied"] }) : /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("svg", {
|
|
167
|
+
className: "shrink-0",
|
|
166
168
|
width: "11",
|
|
167
169
|
height: "11",
|
|
168
170
|
viewBox: "0 0 24 24",
|
|
@@ -171,30 +173,30 @@ function l({ code: t, language: o = "js", filename: l, showLineNumbers: u = !1,
|
|
|
171
173
|
strokeWidth: "2",
|
|
172
174
|
strokeLinecap: "round",
|
|
173
175
|
strokeLinejoin: "round",
|
|
174
|
-
children: [/* @__PURE__ */
|
|
176
|
+
children: [/* @__PURE__ */ a("rect", {
|
|
175
177
|
width: "14",
|
|
176
178
|
height: "14",
|
|
177
179
|
x: "8",
|
|
178
180
|
y: "8",
|
|
179
181
|
rx: "2",
|
|
180
182
|
ry: "2"
|
|
181
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ a("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]
|
|
182
184
|
}), "Copy"] })
|
|
183
185
|
})]
|
|
184
186
|
})]
|
|
185
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ a("div", {
|
|
186
188
|
className: "overflow-x-auto",
|
|
187
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ a("table", {
|
|
188
190
|
className: "w-full border-collapse text-sm font-mono leading-6",
|
|
189
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ a("tbody", { children: h.map((e, t) => /* @__PURE__ */ o("tr", {
|
|
190
192
|
className: "hover:bg-black/3 dark:hover:bg-white/3",
|
|
191
|
-
children: [u && /* @__PURE__ */
|
|
193
|
+
children: [u && /* @__PURE__ */ a("td", {
|
|
192
194
|
className: "select-none w-10 pr-4 pl-4 text-right text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6",
|
|
193
195
|
children: t + 1
|
|
194
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ a("td", {
|
|
195
197
|
className: "px-4 py-0 whitespace-pre",
|
|
196
|
-
children:
|
|
197
|
-
className:
|
|
198
|
+
children: c(e, n).map((e, t) => /* @__PURE__ */ a("span", {
|
|
199
|
+
className: l[e.type],
|
|
198
200
|
children: e.value
|
|
199
201
|
}, t))
|
|
200
202
|
})]
|
|
@@ -203,29 +205,29 @@ function l({ code: t, language: o = "js", filename: l, showLineNumbers: u = !1,
|
|
|
203
205
|
})]
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
function
|
|
213
|
-
let f =
|
|
208
|
+
var d = t(({ className: t, ...n }, r) => /* @__PURE__ */ a("code", {
|
|
209
|
+
ref: r,
|
|
210
|
+
className: e("break-words rounded-md border border-border bg-surface-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground", t),
|
|
211
|
+
...n
|
|
212
|
+
}));
|
|
213
|
+
d.displayName = "InlineCode";
|
|
214
|
+
function f({ value: t, onChange: r, language: i = "js", placeholder: s = "// Start typing…", minRows: c = 6, maxRows: l = 24, readOnly: u = !1, className: d }) {
|
|
215
|
+
let f = n(null), p = Math.min(l, Math.max(c, t.split("\n").length));
|
|
214
216
|
function m(e) {
|
|
215
|
-
let
|
|
217
|
+
let n = e.currentTarget, { selectionStart: i, selectionEnd: a } = n;
|
|
216
218
|
if (e.key === "Tab") {
|
|
217
219
|
e.preventDefault();
|
|
218
|
-
let o =
|
|
220
|
+
let o = t.slice(0, i) + " " + t.slice(a);
|
|
219
221
|
r?.(o), requestAnimationFrame(() => {
|
|
220
|
-
|
|
222
|
+
n.selectionStart = n.selectionEnd = i + 2;
|
|
221
223
|
});
|
|
222
224
|
}
|
|
223
225
|
if (e.key === "Enter") {
|
|
224
|
-
let o =
|
|
226
|
+
let o = t.lastIndexOf("\n", i - 1) + 1, s = t.slice(o).match(/^(\s*)/)?.[1] ?? "";
|
|
225
227
|
e.preventDefault();
|
|
226
|
-
let c =
|
|
228
|
+
let c = t.slice(0, i) + "\n" + s + t.slice(a);
|
|
227
229
|
r?.(c), requestAnimationFrame(() => {
|
|
228
|
-
|
|
230
|
+
n.selectionStart = n.selectionEnd = i + 1 + s.length;
|
|
229
231
|
});
|
|
230
232
|
}
|
|
231
233
|
let o = {
|
|
@@ -238,29 +240,29 @@ function d({ value: n, onChange: r, language: o = "js", placeholder: s = "// Sta
|
|
|
238
240
|
};
|
|
239
241
|
if (o[e.key] && i === a) {
|
|
240
242
|
e.preventDefault();
|
|
241
|
-
let s =
|
|
243
|
+
let s = t.slice(0, i) + e.key + o[e.key] + t.slice(a);
|
|
242
244
|
r?.(s), requestAnimationFrame(() => {
|
|
243
|
-
|
|
245
|
+
n.selectionStart = n.selectionEnd = i + 1;
|
|
244
246
|
});
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
className: e("relative rounded-xl overflow-hidden border border-
|
|
249
|
-
children: [/* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ o("div", {
|
|
250
|
+
className: e("relative rounded-[var(--radius-xl)] overflow-hidden border border-border bg-surface-muted dark:bg-navy-900", d),
|
|
251
|
+
children: [/* @__PURE__ */ a("div", {
|
|
250
252
|
className: "flex items-center gap-1.5 px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3",
|
|
251
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ a("span", {
|
|
252
254
|
className: "text-xs font-mono text-slate-400 dark:text-slate-500 uppercase",
|
|
253
|
-
children:
|
|
255
|
+
children: i
|
|
254
256
|
})
|
|
255
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ o("div", {
|
|
256
258
|
className: "relative flex",
|
|
257
|
-
children: [/* @__PURE__ */
|
|
259
|
+
children: [/* @__PURE__ */ a("div", {
|
|
258
260
|
className: "select-none shrink-0 py-3 px-3 text-right text-sm font-mono leading-6 text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6 bg-black/2 dark:bg-black/20",
|
|
259
261
|
"aria-hidden": !0,
|
|
260
|
-
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */
|
|
261
|
-
}), /* @__PURE__ */
|
|
262
|
+
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ a("div", { children: t + 1 }, t))
|
|
263
|
+
}), /* @__PURE__ */ a("textarea", {
|
|
262
264
|
ref: f,
|
|
263
|
-
value:
|
|
265
|
+
value: t,
|
|
264
266
|
onChange: (e) => r?.(e.target.value),
|
|
265
267
|
onKeyDown: m,
|
|
266
268
|
readOnly: u,
|
|
@@ -273,4 +275,4 @@ function d({ value: n, onChange: r, language: o = "js", placeholder: s = "// Sta
|
|
|
273
275
|
});
|
|
274
276
|
}
|
|
275
277
|
//#endregion
|
|
276
|
-
export {
|
|
278
|
+
export { u as CodeBlock, f as CodeEditor, d as InlineCode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs");require("../component-styles-DY4wigiq.cjs");const t=require("../focus-DmG6Ge7X.cjs"),n=require("../motion-B2shivEB.cjs");let r=require("framer-motion"),i=require("react"),a=require("react/jsx-runtime");var o=(0,i.createContext)(null);function s(){let e=(0,i.useContext)(o);if(!e)throw Error(`useCommand must be inside <CommandProvider>`);return e}function c({children:e,shortcut:t=`k`}){let[n,r]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===t&&(e.preventDefault(),r(e=>!e))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),(0,a.jsx)(o.Provider,{value:{open:n,setOpen:r},children:e})}function l({items:o,placeholder:c=`Search commands…`,emptyText:l=`No results found.`,ariaLabel:u=`Command palette`,className:d,overlayClassName:f,searchClassName:p,inputClassName:m,listClassName:h,itemClassName:g,emptyClassName:_}){let{open:v,setOpen:y}=s(),[b,x]=(0,i.useState)(``),[S,C]=(0,i.useState)(0),w=(0,i.useRef)(null),T=(0,i.useRef)(null),E=(0,i.useRef)(null),D=(0,i.useId)();(0,i.useEffect)(()=>{if(!v)return;let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.body.style.overflow,r=window.setTimeout(()=>w.current?.focus(),0),i=e=>{if(e.key===`Escape`){e.preventDefault(),y(!1);return}if(e.key!==`Tab`||!E.current)return;let n=t.t(E.current);if(n.length===0){e.preventDefault(),E.current.focus();return}let r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus())};return x(``),C(0),document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,i),()=>{window.clearTimeout(r),document.body.style.overflow=n,document.removeEventListener(`keydown`,i),e?.focus()}},[v,y]);let O=(0,i.useMemo)(()=>{if(!b)return o;let e=b.toLowerCase();return o.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.keywords?.some(t=>t.toLowerCase().includes(e)))},[b,o]),k=(0,i.useMemo)(()=>{let e=new Map;for(let t of O){let n=t.group??``;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[O]),A=(0,i.useMemo)(()=>Array.from(k.values()).flat(),[k]);function j(e){e.key===`ArrowDown`?(e.preventDefault(),C(e=>Math.min(e+1,Math.max(A.length-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),C(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),A[S]?.onSelect(),y(!1)):e.key===`Escape`&&y(!1)}(0,i.useEffect)(()=>{T.current&&T.current.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[S]);let M=0;return(0,a.jsx)(r.AnimatePresence,{children:v&&(0,a.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-start justify-center pt-[15vh] p-4`,children:[(0,a.jsx)(r.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:n.n.fade,className:e.t(`absolute inset-0 bg-overlay`,f),onClick:()=>y(!1),"aria-hidden":`true`}),(0,a.jsxs)(r.motion.div,{ref:E,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":u,initial:{opacity:0,scale:.96,y:-8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:-8},transition:{type:`spring`,stiffness:400,damping:30},className:e.t(`relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay`,d),children:[(0,a.jsxs)(`div`,{className:e.t(`flex items-center gap-3 border-b border-border px-4`,p),children:[(0,a.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-slate-400 shrink-0`,children:[(0,a.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,a.jsx)(`path`,{d:`m21 21-4.35-4.35`})]}),(0,a.jsx)(`input`,{ref:w,type:`search`,role:`combobox`,"aria-label":u,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":D,"aria-activedescendant":A[S]?`${D}-option-${S}`:void 0,value:b,onChange:e=>{x(e.target.value),C(0)},onKeyDown:j,placeholder:c,className:e.t(`min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground`,m)}),(0,a.jsx)(`kbd`,{className:`shrink-0 rounded-[var(--radius-sm)] border border-border-strong bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:`ESC`})]}),(0,a.jsx)(`div`,{id:D,ref:T,role:`listbox`,"aria-label":`Commands`,className:e.t(`max-h-80 overflow-y-auto py-1.5`,h),children:O.length===0?(0,a.jsx)(`p`,{className:e.t(`py-10 text-center text-sm text-muted-foreground`,_),children:l}):Array.from(k.entries()).map(([t,n])=>(0,a.jsxs)(`div`,{role:`group`,"aria-label":t||void 0,children:[t&&(0,a.jsx)(`p`,{className:`px-4 py-1 text-[10px] font-semibold text-slate-500 uppercase tracking-widest`,children:t}),n.map(t=>{let n=M++,r=n===S;return(0,a.jsxs)(`button`,{id:`${D}-option-${n}`,type:`button`,role:`option`,"aria-selected":r,"data-active":r,onClick:()=>{t.onSelect(),y(!1)},onMouseEnter:()=>C(n),className:e.t(`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors`,`focus-ring`,r?`bg-surface-muted`:`hover:bg-surface-muted/70`,g),children:[t.icon&&(0,a.jsx)(`span`,{className:`shrink-0 text-slate-500 dark:text-slate-400 w-5 flex items-center justify-center`,children:t.icon}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsx)(`p`,{className:`truncate text-sm text-foreground`,children:t.label}),t.description&&(0,a.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:t.description})]}),t.shortcut&&(0,a.jsx)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:t.shortcut.map((e,t)=>(0,a.jsx)(`kbd`,{className:`rounded-[var(--radius-sm)] border border-border bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:e},t))})]},t.id)})]},t))})]})]})})}exports.CommandPalette=l,exports.CommandProvider=c,exports.useCommand=s;
|
|
@@ -24,6 +24,13 @@ export interface CommandPaletteProps {
|
|
|
24
24
|
placeholder?: string;
|
|
25
25
|
emptyText?: string;
|
|
26
26
|
ariaLabel?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
overlayClassName?: string;
|
|
29
|
+
searchClassName?: string;
|
|
30
|
+
inputClassName?: string;
|
|
31
|
+
listClassName?: string;
|
|
32
|
+
itemClassName?: string;
|
|
33
|
+
emptyClassName?: string;
|
|
27
34
|
}
|
|
28
|
-
export declare function CommandPalette({ items, placeholder, emptyText, ariaLabel, }: CommandPaletteProps): import("react").JSX.Element;
|
|
35
|
+
export declare function CommandPalette({ items, placeholder, emptyText, ariaLabel, className, overlayClassName, searchClassName, inputClassName, listClassName, itemClassName, emptyClassName, }: CommandPaletteProps): import("react").JSX.Element;
|
|
29
36
|
export {};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
3
|
-
import "../component-styles-
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import "../component-styles-C2CbHEEA.js";
|
|
4
4
|
import { t } from "../focus-Dk1YWVPN.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { n } from "../motion-gnRzFS5f.js";
|
|
6
|
+
import { AnimatePresence as r, motion as i } from "framer-motion";
|
|
7
|
+
import { createContext as a, useContext as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/command.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let e =
|
|
10
|
+
var m = a(null);
|
|
11
|
+
function h() {
|
|
12
|
+
let e = o(m);
|
|
12
13
|
if (!e) throw Error("useCommand must be inside <CommandProvider>");
|
|
13
14
|
return e;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
let [n, r] =
|
|
17
|
-
return
|
|
16
|
+
function g({ children: e, shortcut: t = "k" }) {
|
|
17
|
+
let [n, r] = d(!1);
|
|
18
|
+
return s(() => {
|
|
18
19
|
function e(e) {
|
|
19
20
|
(e.metaKey || e.ctrlKey) && e.key === t && (e.preventDefault(), r((e) => !e));
|
|
20
21
|
}
|
|
21
22
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
22
|
-
}, [t]), /* @__PURE__ */
|
|
23
|
+
}, [t]), /* @__PURE__ */ f(m.Provider, {
|
|
23
24
|
value: {
|
|
24
25
|
open: n,
|
|
25
26
|
setOpen: r
|
|
@@ -27,63 +28,63 @@ function h({ children: e, shortcut: t = "k" }) {
|
|
|
27
28
|
children: e
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let { open:
|
|
32
|
-
|
|
33
|
-
if (!
|
|
34
|
-
let e = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = document.body.style.overflow, r = window.setTimeout(() =>
|
|
31
|
+
function _({ items: a, placeholder: o = "Search commands…", emptyText: m = "No results found.", ariaLabel: g = "Command palette", className: _, overlayClassName: v, searchClassName: y, inputClassName: b, listClassName: x, itemClassName: S, emptyClassName: C }) {
|
|
32
|
+
let { open: w, setOpen: T } = h(), [E, D] = d(""), [O, k] = d(0), A = u(null), j = u(null), M = u(null), N = c();
|
|
33
|
+
s(() => {
|
|
34
|
+
if (!w) return;
|
|
35
|
+
let e = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = document.body.style.overflow, r = window.setTimeout(() => A.current?.focus(), 0), i = (e) => {
|
|
35
36
|
if (e.key === "Escape") {
|
|
36
|
-
e.preventDefault(),
|
|
37
|
+
e.preventDefault(), T(!1);
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
if (e.key !== "Tab" || !
|
|
40
|
-
let n = t(
|
|
40
|
+
if (e.key !== "Tab" || !M.current) return;
|
|
41
|
+
let n = t(M.current);
|
|
41
42
|
if (n.length === 0) {
|
|
42
|
-
e.preventDefault(),
|
|
43
|
+
e.preventDefault(), M.current.focus();
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
let r = n[0], i = n[n.length - 1];
|
|
46
47
|
e.shiftKey && document.activeElement === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && document.activeElement === i && (e.preventDefault(), r.focus());
|
|
47
48
|
};
|
|
48
|
-
return
|
|
49
|
+
return D(""), k(0), document.body.style.overflow = "hidden", document.addEventListener("keydown", i), () => {
|
|
49
50
|
window.clearTimeout(r), document.body.style.overflow = n, document.removeEventListener("keydown", i), e?.focus();
|
|
50
51
|
};
|
|
51
|
-
}, [
|
|
52
|
-
let
|
|
53
|
-
if (!
|
|
54
|
-
let e =
|
|
55
|
-
return
|
|
56
|
-
}, [
|
|
52
|
+
}, [w, T]);
|
|
53
|
+
let P = l(() => {
|
|
54
|
+
if (!E) return a;
|
|
55
|
+
let e = E.toLowerCase();
|
|
56
|
+
return a.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.keywords?.some((t) => t.toLowerCase().includes(e)));
|
|
57
|
+
}, [E, a]), F = l(() => {
|
|
57
58
|
let e = /* @__PURE__ */ new Map();
|
|
58
|
-
for (let t of
|
|
59
|
+
for (let t of P) {
|
|
59
60
|
let n = t.group ?? "";
|
|
60
61
|
e.has(n) || e.set(n, []), e.get(n).push(t);
|
|
61
62
|
}
|
|
62
63
|
return e;
|
|
63
|
-
}, [
|
|
64
|
-
function
|
|
65
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
64
|
+
}, [P]), I = l(() => Array.from(F.values()).flat(), [F]);
|
|
65
|
+
function L(e) {
|
|
66
|
+
e.key === "ArrowDown" ? (e.preventDefault(), k((e) => Math.min(e + 1, Math.max(I.length - 1, 0)))) : e.key === "ArrowUp" ? (e.preventDefault(), k((e) => Math.max(e - 1, 0))) : e.key === "Enter" ? (e.preventDefault(), I[O]?.onSelect(), T(!1)) : e.key === "Escape" && T(!1);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
let
|
|
71
|
-
return /* @__PURE__ */
|
|
68
|
+
s(() => {
|
|
69
|
+
j.current && j.current.querySelector("[data-active=\"true\"]")?.scrollIntoView({ block: "nearest" });
|
|
70
|
+
}, [O]);
|
|
71
|
+
let R = 0;
|
|
72
|
+
return /* @__PURE__ */ f(r, { children: w && /* @__PURE__ */ p("div", {
|
|
72
73
|
className: "fixed inset-0 z-[200] flex items-start justify-center pt-[15vh] p-4",
|
|
73
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ f(i.div, {
|
|
74
75
|
initial: { opacity: 0 },
|
|
75
76
|
animate: { opacity: 1 },
|
|
76
77
|
exit: { opacity: 0 },
|
|
77
|
-
transition:
|
|
78
|
-
className: "absolute inset-0 bg-overlay",
|
|
79
|
-
onClick: () =>
|
|
78
|
+
transition: n.fade,
|
|
79
|
+
className: e("absolute inset-0 bg-overlay", v),
|
|
80
|
+
onClick: () => T(!1),
|
|
80
81
|
"aria-hidden": "true"
|
|
81
|
-
}), /* @__PURE__ */
|
|
82
|
-
ref:
|
|
82
|
+
}), /* @__PURE__ */ p(i.div, {
|
|
83
|
+
ref: M,
|
|
83
84
|
tabIndex: -1,
|
|
84
85
|
role: "dialog",
|
|
85
86
|
"aria-modal": "true",
|
|
86
|
-
"aria-label":
|
|
87
|
+
"aria-label": g,
|
|
87
88
|
initial: {
|
|
88
89
|
opacity: 0,
|
|
89
90
|
scale: .96,
|
|
@@ -104,11 +105,11 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
104
105
|
stiffness: 400,
|
|
105
106
|
damping: 30
|
|
106
107
|
},
|
|
107
|
-
className: "relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
-
className: "flex items-center gap-3 border-b border-border px-4",
|
|
108
|
+
className: e("relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay", _),
|
|
109
|
+
children: [/* @__PURE__ */ p("div", {
|
|
110
|
+
className: e("flex items-center gap-3 border-b border-border px-4", y),
|
|
110
111
|
children: [
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ p("svg", {
|
|
112
113
|
width: "16",
|
|
113
114
|
height: "16",
|
|
114
115
|
viewBox: "0 0 24 24",
|
|
@@ -118,80 +119,80 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
118
119
|
strokeLinecap: "round",
|
|
119
120
|
strokeLinejoin: "round",
|
|
120
121
|
className: "text-slate-400 shrink-0",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
122
123
|
cx: "11",
|
|
123
124
|
cy: "11",
|
|
124
125
|
r: "8"
|
|
125
|
-
}), /* @__PURE__ */
|
|
126
|
+
}), /* @__PURE__ */ f("path", { d: "m21 21-4.35-4.35" })]
|
|
126
127
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
ref:
|
|
128
|
+
/* @__PURE__ */ f("input", {
|
|
129
|
+
ref: A,
|
|
129
130
|
type: "search",
|
|
130
131
|
role: "combobox",
|
|
131
|
-
"aria-label":
|
|
132
|
+
"aria-label": g,
|
|
132
133
|
"aria-autocomplete": "list",
|
|
133
134
|
"aria-expanded": "true",
|
|
134
|
-
"aria-controls":
|
|
135
|
-
"aria-activedescendant": O
|
|
136
|
-
value:
|
|
135
|
+
"aria-controls": N,
|
|
136
|
+
"aria-activedescendant": I[O] ? `${N}-option-${O}` : void 0,
|
|
137
|
+
value: E,
|
|
137
138
|
onChange: (e) => {
|
|
138
|
-
|
|
139
|
+
D(e.target.value), k(0);
|
|
139
140
|
},
|
|
140
|
-
onKeyDown:
|
|
141
|
-
placeholder:
|
|
142
|
-
className: "min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground"
|
|
141
|
+
onKeyDown: L,
|
|
142
|
+
placeholder: o,
|
|
143
|
+
className: e("min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground", b)
|
|
143
144
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ f("kbd", {
|
|
145
146
|
className: "shrink-0 rounded-[var(--radius-sm)] border border-border-strong bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
|
|
146
147
|
children: "ESC"
|
|
147
148
|
})
|
|
148
149
|
]
|
|
149
|
-
}), /* @__PURE__ */
|
|
150
|
-
id:
|
|
151
|
-
ref:
|
|
150
|
+
}), /* @__PURE__ */ f("div", {
|
|
151
|
+
id: N,
|
|
152
|
+
ref: j,
|
|
152
153
|
role: "listbox",
|
|
153
154
|
"aria-label": "Commands",
|
|
154
|
-
className: "max-h-80 overflow-y-auto py-1.5",
|
|
155
|
-
children:
|
|
156
|
-
className: "py-10 text-center text-sm text-muted-foreground",
|
|
157
|
-
children:
|
|
158
|
-
}) : Array.from(
|
|
155
|
+
className: e("max-h-80 overflow-y-auto py-1.5", x),
|
|
156
|
+
children: P.length === 0 ? /* @__PURE__ */ f("p", {
|
|
157
|
+
className: e("py-10 text-center text-sm text-muted-foreground", C),
|
|
158
|
+
children: m
|
|
159
|
+
}) : Array.from(F.entries()).map(([t, n]) => /* @__PURE__ */ p("div", {
|
|
159
160
|
role: "group",
|
|
160
161
|
"aria-label": t || void 0,
|
|
161
|
-
children: [t && /* @__PURE__ */
|
|
162
|
+
children: [t && /* @__PURE__ */ f("p", {
|
|
162
163
|
className: "px-4 py-1 text-[10px] font-semibold text-slate-500 uppercase tracking-widest",
|
|
163
164
|
children: t
|
|
164
165
|
}), n.map((t) => {
|
|
165
|
-
let n =
|
|
166
|
-
return /* @__PURE__ */
|
|
167
|
-
id: `${
|
|
166
|
+
let n = R++, r = n === O;
|
|
167
|
+
return /* @__PURE__ */ p("button", {
|
|
168
|
+
id: `${N}-option-${n}`,
|
|
168
169
|
type: "button",
|
|
169
170
|
role: "option",
|
|
170
171
|
"aria-selected": r,
|
|
171
172
|
"data-active": r,
|
|
172
173
|
onClick: () => {
|
|
173
|
-
t.onSelect(),
|
|
174
|
+
t.onSelect(), T(!1);
|
|
174
175
|
},
|
|
175
|
-
onMouseEnter: () =>
|
|
176
|
-
className: e("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors", "focus-
|
|
176
|
+
onMouseEnter: () => k(n),
|
|
177
|
+
className: e("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors", "focus-ring", r ? "bg-surface-muted" : "hover:bg-surface-muted/70", S),
|
|
177
178
|
children: [
|
|
178
|
-
t.icon && /* @__PURE__ */
|
|
179
|
+
t.icon && /* @__PURE__ */ f("span", {
|
|
179
180
|
className: "shrink-0 text-slate-500 dark:text-slate-400 w-5 flex items-center justify-center",
|
|
180
181
|
children: t.icon
|
|
181
182
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ p("div", {
|
|
183
184
|
className: "flex-1 min-w-0",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ f("p", {
|
|
185
186
|
className: "truncate text-sm text-foreground",
|
|
186
187
|
children: t.label
|
|
187
|
-
}), t.description && /* @__PURE__ */
|
|
188
|
+
}), t.description && /* @__PURE__ */ f("p", {
|
|
188
189
|
className: "truncate text-xs text-muted-foreground",
|
|
189
190
|
children: t.description
|
|
190
191
|
})]
|
|
191
192
|
}),
|
|
192
|
-
t.shortcut && /* @__PURE__ */
|
|
193
|
+
t.shortcut && /* @__PURE__ */ f("div", {
|
|
193
194
|
className: "flex items-center gap-0.5 shrink-0",
|
|
194
|
-
children: t.shortcut.map((e, t) => /* @__PURE__ */
|
|
195
|
+
children: t.shortcut.map((e, t) => /* @__PURE__ */ f("kbd", {
|
|
195
196
|
className: "rounded-[var(--radius-sm)] border border-border bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
|
|
196
197
|
children: e
|
|
197
198
|
}, t))
|
|
@@ -205,4 +206,4 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
205
206
|
}) });
|
|
206
207
|
}
|
|
207
208
|
//#endregion
|
|
208
|
-
export {
|
|
209
|
+
export { _ as CommandPalette, g as CommandProvider, h as useCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./button.cjs"),
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs"),t=require("./button.cjs"),n=require("./modal.cjs");let r=require("react/jsx-runtime");function i({open:i,onClose:a,onConfirm:o,title:s=`Are you sure?`,description:c,confirmLabel:l=`Confirm`,cancelLabel:u=`Cancel`,destructive:d=!1,loading:f=!1,icon:p,className:m,overlayClassName:h,panelClassName:g,contentClassName:_,actionsClassName:v,cancelButtonClassName:y,confirmButtonClassName:b}){return(0,r.jsxs)(n.Modal,{open:i,onClose:a,size:`sm`,title:s,description:typeof c==`string`?c:void 0,icon:p??(d?(0,r.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-red-600 dark:text-red-400`,children:[(0,r.jsx)(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`}),(0,r.jsx)(`path`,{d:`M12 9v4`}),(0,r.jsx)(`path`,{d:`M12 17h.01`})]}):(0,r.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-info`,children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,r.jsx)(`path`,{d:`M12 16v-4`}),(0,r.jsx)(`path`,{d:`M12 8h.01`})]})),className:m,overlayClassName:h,panelClassName:g,children:[typeof c!=`string`&&c&&(0,r.jsx)(`div`,{className:e.t(`text-sm leading-relaxed text-slate-600 dark:text-slate-400`,_),children:c}),(0,r.jsxs)(`div`,{className:e.t(`flex flex-wrap justify-end gap-2.5 pt-2`,v),children:[(0,r.jsx)(t.Button,{variant:`ghost`,onClick:a,disabled:f,className:y,children:u}),(0,r.jsx)(t.Button,{variant:d?`destructive`:`primary`,onClick:o,loading:f,autoFocus:!0,className:b,children:l})]})]})}exports.ConfirmDialog=i;
|
|
@@ -10,5 +10,12 @@ export interface ConfirmDialogProps {
|
|
|
10
10
|
destructive?: boolean;
|
|
11
11
|
loading?: boolean;
|
|
12
12
|
icon?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
overlayClassName?: string;
|
|
15
|
+
panelClassName?: string;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
actionsClassName?: string;
|
|
18
|
+
cancelButtonClassName?: string;
|
|
19
|
+
confirmButtonClassName?: string;
|
|
13
20
|
}
|
|
14
|
-
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, destructive, loading, icon, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
21
|
+
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, destructive, loading, icon, className, overlayClassName, panelClassName, contentClassName, actionsClassName, cancelButtonClassName, confirmButtonClassName, }: ConfirmDialogProps): import("react").JSX.Element;
|