@loccal/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +38 -3
- package/dist/components/ui/accordion.d.ts +6 -0
- package/dist/components/ui/accordion.js +17 -0
- package/dist/components/ui/ai-panel.d.ts +47 -0
- package/dist/components/ui/ai-panel.js +74 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert-dialog.js +42 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.js +27 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +23 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/badge.js +36 -0
- package/dist/components/ui/breadcrumb.d.ts +10 -0
- package/dist/components/ui/breadcrumb.js +36 -0
- package/dist/components/ui/button-group.d.ts +10 -0
- package/dist/components/ui/button-group.js +36 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/button.js +34 -0
- package/dist/components/ui/calendar.d.ts +10 -0
- package/dist/components/ui/calendar.js +76 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +24 -0
- package/dist/components/ui/chart.d.ts +44 -0
- package/dist/components/ui/chart.js +132 -0
- package/dist/components/ui/checkbox.d.ts +3 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +13 -0
- package/dist/components/ui/command-block.d.ts +28 -0
- package/dist/components/ui/command-block.js +58 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.js +35 -0
- package/dist/components/ui/connection-status.d.ts +29 -0
- package/dist/components/ui/connection-status.js +26 -0
- package/dist/components/ui/context-menu.d.ts +29 -0
- package/dist/components/ui/context-menu.js +51 -0
- package/dist/components/ui/data-table.d.ts +49 -0
- package/dist/components/ui/data-table.js +100 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.js +37 -0
- package/dist/components/ui/drawer.d.ts +16 -0
- package/dist/components/ui/drawer.js +75 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/dropzone.d.ts +11 -0
- package/dist/components/ui/dropzone.js +39 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +33 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +68 -0
- package/dist/components/ui/file-tree.d.ts +42 -0
- package/dist/components/ui/file-tree.js +85 -0
- package/dist/components/ui/hash-chain.d.ts +43 -0
- package/dist/components/ui/hash-chain.js +34 -0
- package/dist/components/ui/history-palette.d.ts +37 -0
- package/dist/components/ui/history-palette.js +44 -0
- package/dist/components/ui/hover-card.d.ts +5 -0
- package/dist/components/ui/hover-card.js +14 -0
- package/dist/components/ui/icon-base.d.ts +15 -0
- package/dist/components/ui/icon-base.js +18 -0
- package/dist/components/ui/icon.d.ts +15 -0
- package/dist/components/ui/icon.js +32 -0
- package/dist/components/ui/icons-compat.d.ts +32 -0
- package/dist/components/ui/icons-compat.js +34 -0
- package/dist/components/ui/icons.d.ts +1048 -0
- package/dist/components/ui/icons.js +264 -0
- package/dist/components/ui/input-group.d.ts +18 -0
- package/dist/components/ui/input-group.js +57 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +9 -0
- package/dist/components/ui/label.d.ts +3 -0
- package/dist/components/ui/label.js +7 -0
- package/dist/components/ui/locale-switch.d.ts +9 -0
- package/dist/components/ui/locale-switch.js +31 -0
- package/dist/components/ui/log-panel.d.ts +28 -0
- package/dist/components/ui/log-panel.js +59 -0
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/menubar.js +56 -0
- package/dist/components/ui/metric-grid.d.ts +20 -0
- package/dist/components/ui/metric-grid.js +14 -0
- package/dist/components/ui/model-list.d.ts +33 -0
- package/dist/components/ui/model-list.js +69 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.js +31 -0
- package/dist/components/ui/number-field.d.ts +29 -0
- package/dist/components/ui/number-field.js +65 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +26 -0
- package/dist/components/ui/pane-tree.d.ts +18 -0
- package/dist/components/ui/pane-tree.js +65 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +23 -0
- package/dist/components/ui/progress.d.ts +7 -0
- package/dist/components/ui/progress.js +20 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +12 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +14 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +34 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/settings-layout.d.ts +31 -0
- package/dist/components/ui/settings-layout.js +45 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +37 -0
- package/dist/components/ui/shell-picker.d.ts +18 -0
- package/dist/components/ui/shell-picker.js +17 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/slider.d.ts +3 -0
- package/dist/components/ui/slider.js +12 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +25 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +7 -0
- package/dist/components/ui/split-button.d.ts +21 -0
- package/dist/components/ui/split-button.js +14 -0
- package/dist/components/ui/stat.d.ts +10 -0
- package/dist/components/ui/stat.js +8 -0
- package/dist/components/ui/status-bar.d.ts +13 -0
- package/dist/components/ui/status-bar.js +15 -0
- package/dist/components/ui/stepper.d.ts +13 -0
- package/dist/components/ui/stepper.js +11 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/tabs.d.ts +10 -0
- package/dist/components/ui/tabs.js +29 -0
- package/dist/components/ui/terminal-tabs.d.ts +31 -0
- package/dist/components/ui/terminal-tabs.js +109 -0
- package/dist/components/ui/terminal-view.d.ts +51 -0
- package/dist/components/ui/terminal-view.js +189 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +6 -0
- package/dist/components/ui/timeline.d.ts +9 -0
- package/dist/components/ui/timeline.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +11 -0
- package/dist/components/ui/toggle-group.js +24 -0
- package/dist/components/ui/toggle.d.ts +8 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/components/ui/tooltip.js +17 -0
- package/dist/components/ui/tree-view.d.ts +20 -0
- package/dist/components/ui/tree-view.js +41 -0
- package/dist/components/ui/window-frame.d.ts +35 -0
- package/dist/components/ui/window-frame.js +49 -0
- package/dist/lib/ai-markdown.d.ts +13 -0
- package/dist/lib/ai-markdown.js +46 -0
- package/dist/lib/command-risk.d.ts +6 -0
- package/dist/lib/command-risk.js +42 -0
- package/dist/lib/file-kind.d.ts +10 -0
- package/dist/lib/file-kind.js +63 -0
- package/dist/lib/format.d.ts +9 -0
- package/dist/lib/format.js +30 -0
- package/dist/lib/i18n-core.d.ts +20 -0
- package/dist/lib/i18n-core.js +36 -0
- package/dist/lib/i18n.d.ts +15 -0
- package/dist/lib/i18n.js +68 -0
- package/dist/lib/icon-data.d.ts +276 -0
- package/dist/lib/icon-data.js +307 -0
- package/dist/lib/icon-shapes.d.ts +14 -0
- package/dist/lib/icon-shapes.js +47 -0
- package/dist/lib/log-filter.d.ts +23 -0
- package/dist/lib/log-filter.js +44 -0
- package/dist/lib/number-field.d.ts +11 -0
- package/dist/lib/number-field.js +30 -0
- package/dist/lib/pane-tree.d.ts +39 -0
- package/dist/lib/pane-tree.js +92 -0
- package/dist/lib/platform.d.ts +10 -0
- package/dist/lib/platform.js +24 -0
- package/dist/lib/shell-meta.d.ts +7 -0
- package/dist/lib/shell-meta.js +70 -0
- package/dist/lib/tab-order.d.ts +6 -0
- package/dist/lib/tab-order.js +24 -0
- package/dist/lib/table-sort.d.ts +16 -0
- package/dist/lib/table-sort.js +66 -0
- package/dist/lib/terminal-themes.d.ts +30 -0
- package/dist/lib/terminal-themes.js +90 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist-cdn/loccal-ui.css +971 -0
- package/dist-cdn/loccal-ui.min.js +1 -0
- package/dist-wc/base.d.ts +31 -0
- package/dist-wc/base.js +104 -0
- package/dist-wc/button.d.ts +12 -0
- package/dist-wc/button.js +47 -0
- package/dist-wc/calendar.d.ts +16 -0
- package/dist-wc/calendar.js +106 -0
- package/dist-wc/choice.d.ts +17 -0
- package/dist-wc/choice.js +76 -0
- package/dist-wc/command.d.ts +32 -0
- package/dist-wc/command.js +181 -0
- package/dist-wc/data-table.d.ts +22 -0
- package/dist-wc/data-table.js +128 -0
- package/dist-wc/dialog.d.ts +29 -0
- package/dist-wc/dialog.js +94 -0
- package/dist-wc/disclosure.d.ts +17 -0
- package/dist-wc/disclosure.js +91 -0
- package/dist-wc/fields2.d.ts +38 -0
- package/dist-wc/fields2.js +133 -0
- package/dist-wc/file-tree.d.ts +19 -0
- package/dist-wc/file-tree.js +97 -0
- package/dist-wc/floating.d.ts +32 -0
- package/dist-wc/floating.js +91 -0
- package/dist-wc/index.d.ts +23 -0
- package/dist-wc/index.js +24 -0
- package/dist-wc/input-otp.d.ts +14 -0
- package/dist-wc/input-otp.js +82 -0
- package/dist-wc/navigation-menu.d.ts +14 -0
- package/dist-wc/navigation-menu.js +75 -0
- package/dist-wc/number-field.d.ts +13 -0
- package/dist-wc/number-field.js +67 -0
- package/dist-wc/resizable.d.ts +14 -0
- package/dist-wc/resizable.js +57 -0
- package/dist-wc/select.d.ts +17 -0
- package/dist-wc/select.js +80 -0
- package/dist-wc/static.d.ts +1 -0
- package/dist-wc/static.js +175 -0
- package/dist-wc/status-bar.d.ts +11 -0
- package/dist-wc/status-bar.js +54 -0
- package/dist-wc/styles.css +971 -0
- package/dist-wc/tabs.d.ts +16 -0
- package/dist-wc/tabs.js +62 -0
- package/dist-wc/terminal-tabs.d.ts +16 -0
- package/dist-wc/terminal-tabs.js +79 -0
- package/dist-wc/toaster.d.ts +16 -0
- package/dist-wc/toaster.js +68 -0
- package/dist-wc/toggle.d.ts +30 -0
- package/dist-wc/toggle.js +101 -0
- package/dist-wc/tree.d.ts +17 -0
- package/dist-wc/tree.js +72 -0
- package/docs/ARQUITETURA-VANILLA.md +54 -0
- package/docs/VERSIONING.md +88 -0
- package/package.json +1058 -6
- package/styles.css +426 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Gerado por changesets a cada release. Entradas prefixadas pelo nome do componente.
|
|
4
|
+
|
|
5
|
+
## 0.2.0
|
|
6
|
+
|
|
7
|
+
### Minor
|
|
8
|
+
|
|
9
|
+
- icons: biblioteca de icones propria (262 icones, 14 categorias), `LoccalIcon`, `loccalIcon(nome, tamanho)` e nomes alternativos em `icons-compat`
|
|
10
|
+
- split-button: componente novo
|
|
11
|
+
- number-field: componente novo
|
|
12
|
+
- data-table: componente novo
|
|
13
|
+
- log-panel: componente novo
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marcelo Matzembacher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @loccal/ui
|
|
2
|
+
|
|
3
|
+
Componentes React (Tailwind 4) e camada vanilla (custom elements) do Loccal UI, versionados e publicados como pacote.
|
|
4
|
+
|
|
5
|
+
## Instalacao
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @loccal/ui --save-exact
|
|
9
|
+
pnpm add @loccal/ui --save-exact
|
|
10
|
+
yarn add @loccal/ui --exact
|
|
11
|
+
bun add @loccal/ui --save-exact
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Instale tambem os peers: `react`, `react-dom`, `@base-ui/react`, `tailwindcss` (v4) e `tw-animate-css`. Componentes especificos pedem peers opcionais (por exemplo `cmdk` para `command`, `@xterm/xterm` para `terminal-view`, `recharts` para `chart`).
|
|
15
|
+
|
|
16
|
+
## Uso
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
// ponto de entrada CSS do app (Tailwind 4):
|
|
20
|
+
import "@loccal/ui/styles.css"
|
|
21
|
+
|
|
22
|
+
import { Button } from "@loccal/ui/button"
|
|
23
|
+
import { cn } from "@loccal/ui/lib/utils"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Cada componente e um subpath (`@loccal/ui/<componente>`); nao existe import pela raiz. Sem `moduleResolution` `bundler` ou `node16`, o TypeScript nao resolve `exports`.
|
|
27
|
+
|
|
28
|
+
## Sem React (camada vanilla)
|
|
29
|
+
|
|
30
|
+
Button, dialog, select, tabs, terminal-tabs e status-bar tambem existem como custom elements em `@loccal/ui/wc` (Light DOM, CSS puro em `@loccal/ui/wc/styles.css`, bundle `@loccal/ui/cdn`), com adaptadores para Vue, Svelte e Angular. A matriz de suporte por componente e framework fica no site de documentacao, em `/docs/frameworks/matrix`.
|
|
31
|
+
|
|
32
|
+
## Versao e estabilidade
|
|
33
|
+
|
|
34
|
+
Semver rigoroso; mudanca incompativel so em major; teste de contrato da API publica. Veja [docs/VERSIONING.md](docs/VERSIONING.md).
|
|
35
|
+
|
|
36
|
+
## Licenca
|
|
37
|
+
|
|
38
|
+
MIT.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
2
|
+
declare function Accordion({ className, ...props }: AccordionPrimitive.Root.Props): import("react").JSX.Element;
|
|
3
|
+
declare function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props): import("react").JSX.Element;
|
|
4
|
+
declare function AccordionTrigger({ className, children, ...props }: AccordionPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
5
|
+
declare function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props): import("react").JSX.Element;
|
|
6
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { ChevronDownIcon, ChevronUpIcon } from "./icons.js";
|
|
5
|
+
function Accordion({ className, ...props }) {
|
|
6
|
+
return (_jsx(AccordionPrimitive.Root, { "data-slot": "accordion", className: cn("flex w-full flex-col", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
function AccordionItem({ className, ...props }) {
|
|
9
|
+
return (_jsx(AccordionPrimitive.Item, { "data-slot": "accordion-item", className: cn("not-last:border-b", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
12
|
+
return (_jsx(AccordionPrimitive.Header, { className: "flex", children: _jsxs(AccordionPrimitive.Trigger, { "data-slot": "accordion-trigger", className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground", className), ...props, children: [children, _jsx(ChevronDownIcon, { "data-slot": "accordion-trigger-icon", className: "pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden" }), _jsx(ChevronUpIcon, { "data-slot": "accordion-trigger-icon", className: "pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline" })] }) }));
|
|
13
|
+
}
|
|
14
|
+
function AccordionContent({ className, children, ...props }) {
|
|
15
|
+
return (_jsx(AccordionPrimitive.Panel, { "data-slot": "accordion-content", className: "overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up", ...props, children: _jsx("div", { className: cn("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className), children: children }) }));
|
|
16
|
+
}
|
|
17
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type AiMessage = {
|
|
3
|
+
id: string;
|
|
4
|
+
role: "user" | "assistant";
|
|
5
|
+
content: string;
|
|
6
|
+
/** Mensagem de erro associada (ex.: servico indisponivel durante a resposta). */
|
|
7
|
+
error?: string;
|
|
8
|
+
};
|
|
9
|
+
/** disabled: recurso desligado nas configuracoes. offline: servico inacessivel. no-model: sem modelo habilitado. */
|
|
10
|
+
type AiPanelStatus = "disabled" | "offline" | "no-model" | "ready";
|
|
11
|
+
type AiPanelLabels = {
|
|
12
|
+
title: string;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
send: string;
|
|
15
|
+
stop: string;
|
|
16
|
+
clear: string;
|
|
17
|
+
model: string;
|
|
18
|
+
disabledTitle: string;
|
|
19
|
+
disabledText: string;
|
|
20
|
+
offlineTitle: string;
|
|
21
|
+
offlineText: string;
|
|
22
|
+
noModelTitle: string;
|
|
23
|
+
noModelText: string;
|
|
24
|
+
openSettings: string;
|
|
25
|
+
retry: string;
|
|
26
|
+
emptyHint: string;
|
|
27
|
+
};
|
|
28
|
+
type AiPanelProps = {
|
|
29
|
+
status: AiPanelStatus;
|
|
30
|
+
messages: AiMessage[];
|
|
31
|
+
streaming?: boolean;
|
|
32
|
+
models?: string[];
|
|
33
|
+
model?: string;
|
|
34
|
+
onModelChange?: (model: string) => void;
|
|
35
|
+
onSend: (prompt: string) => void;
|
|
36
|
+
onAbort?: () => void;
|
|
37
|
+
onClear?: () => void;
|
|
38
|
+
onInsertCommand?: (command: string) => void;
|
|
39
|
+
onRunCommand?: (command: string) => void;
|
|
40
|
+
onOpenSettings?: () => void;
|
|
41
|
+
onRetry?: () => void;
|
|
42
|
+
labels?: Partial<AiPanelLabels>;
|
|
43
|
+
className?: string;
|
|
44
|
+
};
|
|
45
|
+
declare function AiPanel({ status, messages, streaming, models, model, onModelChange, onSend, onAbort, onClear, onInsertCommand, onRunCommand, onOpenSettings, onRetry, labels, className, }: AiPanelProps): React.JSX.Element;
|
|
46
|
+
export { AiPanel };
|
|
47
|
+
export type { AiMessage, AiPanelProps, AiPanelStatus };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { BotIcon, EraserIcon, SendIcon, SettingsIcon, SquareIcon } from "./icons.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { CommandBlock } from "./command-block.js";
|
|
8
|
+
import { ConnectionStatus } from "./connection-status.js";
|
|
9
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
10
|
+
import { Spinner } from "./spinner.js";
|
|
11
|
+
import { Textarea } from "./textarea.js";
|
|
12
|
+
import { isShellLang, parseAiMarkdown } from "../../lib/ai-markdown.js";
|
|
13
|
+
const DEFAULT_LABELS = {
|
|
14
|
+
title: "Assistente de shell",
|
|
15
|
+
placeholder: "Descreva o que deseja fazer no terminal…",
|
|
16
|
+
send: "Enviar",
|
|
17
|
+
stop: "Parar",
|
|
18
|
+
clear: "Limpar conversa",
|
|
19
|
+
model: "Modelo",
|
|
20
|
+
disabledTitle: "IA local desativada",
|
|
21
|
+
disabledText: "Ative o Ollama nas configurações para gerar comandos com um modelo local.",
|
|
22
|
+
offlineTitle: "Servidor indisponível",
|
|
23
|
+
offlineText: "Não foi possível falar com o servidor de IA. Verifique se ele está em execução.",
|
|
24
|
+
noModelTitle: "Nenhum modelo habilitado",
|
|
25
|
+
noModelText: "Escolha ao menos um modelo instalado nas configurações.",
|
|
26
|
+
openSettings: "Abrir configurações",
|
|
27
|
+
retry: "Tentar novamente",
|
|
28
|
+
emptyHint: "Os comandos sugeridos aparecem em blocos. Nada é executado sem o seu clique.",
|
|
29
|
+
};
|
|
30
|
+
function AssistantContent({ content, onInsert, onRun, }) {
|
|
31
|
+
const segments = React.useMemo(() => parseAiMarkdown(content), [content]);
|
|
32
|
+
return (_jsx("div", { className: "flex flex-col gap-2", children: segments.map((seg, i) => {
|
|
33
|
+
if (seg.kind === "text") {
|
|
34
|
+
return (_jsx("p", { className: "text-sm leading-relaxed whitespace-pre-wrap", children: seg.text }, i));
|
|
35
|
+
}
|
|
36
|
+
const isShell = !seg.open && isShellLang(seg.lang);
|
|
37
|
+
if (isShell) {
|
|
38
|
+
return _jsx(CommandBlock, { command: seg.code, onInsert: onInsert, onRun: onRun }, i);
|
|
39
|
+
}
|
|
40
|
+
return (_jsx("pre", { className: "overflow-x-auto rounded-lg bg-muted/50 px-3 py-2 font-mono text-xs whitespace-pre-wrap", children: _jsx("code", { children: seg.code }) }, i));
|
|
41
|
+
}) }));
|
|
42
|
+
}
|
|
43
|
+
function AiPanel({ status, messages, streaming = false, models = [], model, onModelChange, onSend, onAbort, onClear, onInsertCommand, onRunCommand, onOpenSettings, onRetry, labels, className, }) {
|
|
44
|
+
const l = { ...DEFAULT_LABELS, ...labels };
|
|
45
|
+
const [draft, setDraft] = React.useState("");
|
|
46
|
+
const endRef = React.useRef(null);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
endRef.current?.scrollIntoView({ block: "end" });
|
|
49
|
+
}, [messages, streaming]);
|
|
50
|
+
const send = () => {
|
|
51
|
+
const text = draft.trim();
|
|
52
|
+
if (!text || streaming || status !== "ready")
|
|
53
|
+
return;
|
|
54
|
+
onSend(text);
|
|
55
|
+
setDraft("");
|
|
56
|
+
};
|
|
57
|
+
const blocked = status !== "ready";
|
|
58
|
+
const modelItems = models.map((m) => ({ value: m, label: m }));
|
|
59
|
+
return (_jsxs("section", { "data-slot": "ai-panel", "data-status": status, "aria-label": l.title, onKeyDown: (e) => {
|
|
60
|
+
if (e.key === "Escape" && streaming) {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
onAbort?.();
|
|
63
|
+
}
|
|
64
|
+
}, className: cn("flex size-full min-h-0 flex-col bg-card", className), children: [_jsxs("header", { className: "flex h-9 shrink-0 items-center gap-2 border-b px-2.5", children: [_jsx(BotIcon, { className: "size-4 text-brand" }), _jsx("h2", { className: "min-w-0 flex-1 truncate text-xs font-semibold", children: l.title }), status === "ready" && modelItems.length > 0 ? (_jsxs(Select, { items: modelItems, value: model, onValueChange: (v) => typeof v === "string" && onModelChange?.(v), children: [_jsx(SelectTrigger, { size: "sm", "aria-label": l.model, className: "max-w-40 font-mono text-xs", children: _jsx(SelectValue, { placeholder: l.model }) }), _jsx(SelectContent, { children: modelItems.map((m) => (_jsx(SelectItem, { value: m.value, children: _jsx("span", { className: "font-mono text-xs", children: m.label }) }, m.value))) })] })) : null, onClear && messages.length > 0 ? (_jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": l.clear, title: l.clear, onClick: onClear, children: _jsx(EraserIcon, {}) })) : null] }), status === "disabled" || status === "no-model" ? (_jsx(StateBlock, { title: status === "disabled" ? l.disabledTitle : l.noModelTitle, text: status === "disabled" ? l.disabledText : l.noModelText, action: onOpenSettings ? { label: l.openSettings, onClick: onOpenSettings, icon: _jsx(SettingsIcon, {}) } : undefined })) : status === "offline" ? (_jsx(StateBlock, { title: l.offlineTitle, text: l.offlineText, action: onRetry ? { label: l.retry, onClick: onRetry } : undefined, extra: _jsx(ConnectionStatus, { state: "offline", className: "justify-center" }) })) : (_jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-3 py-3", children: [messages.length === 0 ? (_jsx("p", { className: "py-8 text-center text-xs text-muted-foreground", children: l.emptyHint })) : (_jsxs("ul", { className: "flex flex-col gap-3", children: [messages.map((m) => (_jsx("li", { "data-role": m.role, className: cn("flex", m.role === "user" ? "justify-end" : "justify-start"), children: _jsxs("div", { className: cn("max-w-full min-w-0 rounded-lg px-3 py-2", m.role === "user" ? "bg-brand/12 text-sm whitespace-pre-wrap" : "w-full"), children: [m.role === "user" ? (m.content) : (_jsx(AssistantContent, { content: m.content, onInsert: onInsertCommand, onRun: onRunCommand })), m.error ? _jsx("p", { className: "mt-1 text-xs text-destructive", children: m.error }) : null] }) }, m.id))), streaming ? (_jsx("li", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: _jsx(Spinner, { className: "size-3" }) })) : null] })), _jsx("div", { ref: endRef })] })), _jsx("footer", { className: "shrink-0 border-t p-2", children: _jsxs("div", { className: "flex items-end gap-1.5", children: [_jsx(Textarea, { value: draft, disabled: blocked, onChange: (e) => setDraft(e.target.value), onKeyDown: (e) => {
|
|
65
|
+
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
send();
|
|
68
|
+
}
|
|
69
|
+
}, placeholder: l.placeholder, "aria-label": l.placeholder, rows: 2, className: "max-h-32 min-h-9 flex-1 resize-none text-sm" }), streaming ? (_jsx(Button, { type: "button", size: "icon", variant: "outline", "aria-label": l.stop, title: `${l.stop} (Esc)`, onClick: onAbort, children: _jsx(SquareIcon, {}) })) : (_jsx(Button, { type: "button", size: "icon", "aria-label": l.send, title: l.send, disabled: blocked || !draft.trim(), onClick: send, children: _jsx(SendIcon, {}) }))] }) })] }));
|
|
70
|
+
}
|
|
71
|
+
function StateBlock({ title, text, action, extra, }) {
|
|
72
|
+
return (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center", children: [_jsx("h3", { className: "text-sm font-medium", children: title }), _jsx("p", { className: "max-w-64 text-xs text-muted-foreground", children: text }), extra, action ? (_jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: action.onClick, children: [action.icon, action.label] })) : null] }));
|
|
73
|
+
}
|
|
74
|
+
export { AiPanel };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
declare function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props): React.JSX.Element;
|
|
7
|
+
declare function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props): React.JSX.Element;
|
|
8
|
+
declare function AlertDialogContent({ className, size, ...props }: AlertDialogPrimitive.Popup.Props & {
|
|
9
|
+
size?: "default" | "sm";
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
|
|
15
|
+
declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): React.JSX.Element;
|
|
16
|
+
declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
17
|
+
declare function AlertDialogCancel({ className, variant, size, ...props }: AlertDialogPrimitive.Close.Props & Pick<React.ComponentProps<typeof Button>, "variant" | "size">): React.JSX.Element;
|
|
18
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
function AlertDialog({ ...props }) {
|
|
7
|
+
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
function AlertDialogTrigger({ ...props }) {
|
|
10
|
+
return (_jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props }));
|
|
11
|
+
}
|
|
12
|
+
function AlertDialogPortal({ ...props }) {
|
|
13
|
+
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props }));
|
|
14
|
+
}
|
|
15
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
16
|
+
return (_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function AlertDialogContent({ className, size = "default", ...props }) {
|
|
19
|
+
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", "data-size": size, className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props })] }));
|
|
20
|
+
}
|
|
21
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "alert-dialog-footer", className: cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "alert-dialog-media", className: cn("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function AlertDialogAction({ className, ...props }) {
|
|
37
|
+
return (_jsx(Button, { "data-slot": "alert-dialog-action", className: cn(className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function AlertDialogCancel({ className, variant = "outline", size = "default", ...props }) {
|
|
40
|
+
return (_jsx(AlertDialogPrimitive.Close, { "data-slot": "alert-dialog-cancel", className: cn(className), render: _jsx(Button, { variant: variant, size: size }), ...props }));
|
|
41
|
+
}
|
|
42
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const alertVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): React.JSX.Element;
|
|
7
|
+
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function AlertAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "bg-card text-card-foreground",
|
|
8
|
+
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
variant: "default",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
function Alert({ className, variant, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function AlertTitle({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "alert-title", className: cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function AlertDescription({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "alert-description", className: cn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function AlertAction({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "alert-action", className: cn("absolute top-2 right-2", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
3
|
+
declare function Avatar({ className, size, ...props }: AvatarPrimitive.Root.Props & {
|
|
4
|
+
size?: "default" | "sm" | "lg";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props): React.JSX.Element;
|
|
7
|
+
declare function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props): React.JSX.Element;
|
|
8
|
+
declare function AvatarBadge({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
9
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
6
|
+
return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", "data-size": size, className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
function AvatarImage({ className, ...props }) {
|
|
9
|
+
return (_jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn("aspect-square size-full rounded-full object-cover", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function AvatarFallback({ className, ...props }) {
|
|
12
|
+
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function AvatarBadge({ className, ...props }) {
|
|
15
|
+
return (_jsx("span", { "data-slot": "avatar-badge", className: cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className), ...props }));
|
|
16
|
+
}
|
|
17
|
+
function AvatarGroup({ className, ...props }) {
|
|
18
|
+
return (_jsx("div", { "data-slot": "avatar-group", className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "avatar-group-count", className: cn("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "brand" | "success" | "warning" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
9
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
10
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
11
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
12
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
13
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
+
brand: "bg-brand/12 text-brand [a]:hover:bg-brand/20",
|
|
15
|
+
success: "bg-success/12 text-success [a]:hover:bg-success/20",
|
|
16
|
+
warning: "bg-warning/14 text-warning [a]:hover:bg-warning/20",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
function Badge({ className, variant = "default", render, ...props }) {
|
|
24
|
+
return useRender({
|
|
25
|
+
defaultTagName: "span",
|
|
26
|
+
props: mergeProps({
|
|
27
|
+
className: cn(badgeVariants({ variant }), className),
|
|
28
|
+
}, props),
|
|
29
|
+
render,
|
|
30
|
+
state: {
|
|
31
|
+
slot: "badge",
|
|
32
|
+
variant,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
declare function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
4
|
+
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">): React.JSX.Element;
|
|
5
|
+
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
6
|
+
declare function BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<"a">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
8
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
9
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
10
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "./icons.js";
|
|
6
|
+
function Breadcrumb({ className, ...props }) {
|
|
7
|
+
return (_jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", className: cn(className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function BreadcrumbList({ className, ...props }) {
|
|
10
|
+
return (_jsx("ol", { "data-slot": "breadcrumb-list", className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
13
|
+
return (_jsx("li", { "data-slot": "breadcrumb-item", className: cn("inline-flex items-center gap-1", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function BreadcrumbLink({ className, render, ...props }) {
|
|
16
|
+
return useRender({
|
|
17
|
+
defaultTagName: "a",
|
|
18
|
+
props: mergeProps({
|
|
19
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
20
|
+
}, props),
|
|
21
|
+
render,
|
|
22
|
+
state: {
|
|
23
|
+
slot: "breadcrumb-link",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
28
|
+
return (_jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn("font-normal text-foreground", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
31
|
+
return (_jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:size-3.5", className), ...props, children: children ?? (_jsx(ChevronRightIcon, {})) }));
|
|
32
|
+
}
|
|
33
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
34
|
+
return (_jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn("flex size-5 items-center justify-center [&>svg]:size-4", className), ...props, children: [_jsx(MoreHorizontalIcon, {}), _jsx("span", { className: "sr-only", children: "More" })] }));
|
|
35
|
+
}
|
|
36
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Separator } from "./separator.js";
|
|
4
|
+
declare const buttonGroupVariants: (props?: ({
|
|
5
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
8
|
+
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
9
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react").JSX.Element;
|
|
10
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
8
|
+
variants: {
|
|
9
|
+
orientation: {
|
|
10
|
+
horizontal: "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
11
|
+
vertical: "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
orientation: "horizontal",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
19
|
+
return (_jsx("div", { role: "group", "data-slot": "button-group", "data-orientation": orientation, className: cn(buttonGroupVariants({ orientation }), className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function ButtonGroupText({ className, render, ...props }) {
|
|
22
|
+
return useRender({
|
|
23
|
+
defaultTagName: "div",
|
|
24
|
+
props: mergeProps({
|
|
25
|
+
className: cn("flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
26
|
+
}, props),
|
|
27
|
+
render,
|
|
28
|
+
state: {
|
|
29
|
+
slot: "button-group-text",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
34
|
+
return (_jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation, className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
5
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
8
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-primary text-primary-foreground shadow-[inset_0_1px_0_0_oklch(1_0_0/0.14),0_1px_2px_0_oklch(0_0_0/0.2)] hover:bg-primary/88",
|
|
9
|
+
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
11
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
12
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
13
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
17
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
18
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
19
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
20
|
+
icon: "size-8",
|
|
21
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
22
|
+
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
23
|
+
"icon-lg": "size-9",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "default",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
function Button({ className, variant = "default", size = "default", ...props }) {
|
|
32
|
+
return (_jsx(ButtonPrimitive, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
33
|
+
}
|
|
34
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DayPicker, type DayButton, type Locale } from "react-day-picker";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
5
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
8
|
+
locale?: Partial<Locale>;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Calendar, CalendarDayButton };
|