@joniguerini/lume 0.0.0-stage → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +62 -2
- package/base.css +165 -0
- package/bin/lumeui.mjs +163 -0
- package/components/alert.css +156 -0
- package/components/banner.css +98 -0
- package/components/button.css +291 -0
- package/components/calendar.css +532 -0
- package/components/carousel.css +175 -0
- package/components/chart.css +813 -0
- package/components/chat.css +670 -0
- package/components/checkbox.css +212 -0
- package/components/chip.css +224 -0
- package/components/code.css +36 -0
- package/components/color-picker.css +192 -0
- package/components/command.css +148 -0
- package/components/content.css +211 -0
- package/components/editor.css +174 -0
- package/components/feedback.css +320 -0
- package/components/filters.css +103 -0
- package/components/form.css +455 -0
- package/components/image-viewer.css +237 -0
- package/components/layers.css +138 -0
- package/components/link.css +87 -0
- package/components/loading.css +260 -0
- package/components/menu.css +180 -0
- package/components/modal.css +209 -0
- package/components/navigation.css +507 -0
- package/components/notifications.css +186 -0
- package/components/number-field.css +52 -0
- package/components/otp.css +119 -0
- package/components/panel.css +208 -0
- package/components/picker.css +207 -0
- package/components/rating.css +143 -0
- package/components/resizable.css +173 -0
- package/components/scrollbar.css +110 -0
- package/components/select.css +477 -0
- package/components/shell.css +837 -0
- package/components/slider.css +189 -0
- package/components/sortable.css +287 -0
- package/components/surfaces.css +182 -0
- package/components/switch.css +115 -0
- package/components/table.css +228 -0
- package/components/tabs.css +190 -0
- package/components/tags.css +83 -0
- package/components/toast.css +164 -0
- package/components/toolbar.css +80 -0
- package/components/upload.css +181 -0
- package/ds.css +48 -0
- package/fonts/Geist-LICENSE.txt +92 -0
- package/fonts/Geist-Variable.woff2 +0 -0
- package/fonts/GeistSerif-Regular.woff2 +0 -0
- package/fonts/JetBrainsMono-LICENSE.txt +93 -0
- package/fonts/JetBrainsMono-Variable.woff2 +0 -0
- package/fonts.css +29 -0
- package/icons/icons.d.ts +5 -0
- package/icons/icons.js +266 -0
- package/js/back-to-top.d.ts +2 -0
- package/js/back-to-top.js +62 -0
- package/js/banner.js +87 -0
- package/js/calendar.d.ts +3 -0
- package/js/calendar.js +472 -0
- package/js/carousel.d.ts +2 -0
- package/js/carousel.js +258 -0
- package/js/charts/bar.js +361 -0
- package/js/charts/core.js +604 -0
- package/js/charts/donut.js +206 -0
- package/js/charts/figures.js +97 -0
- package/js/charts/heatmap.js +410 -0
- package/js/charts/line.js +268 -0
- package/js/charts/scatter.js +211 -0
- package/js/charts.d.ts +12 -0
- package/js/charts.js +27 -0
- package/js/code-block.d.ts +3 -0
- package/js/code-block.js +32 -0
- package/js/color-picker.d.ts +4 -0
- package/js/color-picker.js +448 -0
- package/js/command-palette.js +233 -0
- package/js/composer.js +573 -0
- package/js/context-menu.d.ts +2 -0
- package/js/context-menu.js +154 -0
- package/js/date-picker.d.ts +2 -0
- package/js/date-picker.js +430 -0
- package/js/drawer.js +48 -0
- package/js/editor.d.ts +5 -0
- package/js/editor.js +615 -0
- package/js/field-support.js +77 -0
- package/js/file-upload.d.ts +2 -0
- package/js/file-upload.js +230 -0
- package/js/filters.js +266 -0
- package/js/form.d.ts +2 -0
- package/js/form.js +409 -0
- package/js/i18n.d.ts +14 -0
- package/js/i18n.js +83 -0
- package/js/image-viewer.d.ts +4 -0
- package/js/image-viewer.js +275 -0
- package/js/menu.d.ts +4 -0
- package/js/menu.js +237 -0
- package/js/messages.js +908 -0
- package/js/modal.d.ts +7 -0
- package/js/modal.js +183 -0
- package/js/notifications.d.ts +4 -0
- package/js/notifications.js +204 -0
- package/js/number-field.d.ts +2 -0
- package/js/number-field.js +175 -0
- package/js/otp-field.d.ts +2 -0
- package/js/otp-field.js +107 -0
- package/js/pagination.d.ts +3 -0
- package/js/pagination.js +143 -0
- package/js/popover.d.ts +2 -0
- package/js/popover.js +155 -0
- package/js/progress-ring.js +48 -0
- package/js/rating.d.ts +3 -0
- package/js/rating.js +130 -0
- package/js/resizable.d.ts +2 -0
- package/js/resizable.js +311 -0
- package/js/scrollbar.d.ts +2 -0
- package/js/scrollbar.js +273 -0
- package/js/segmented.js +60 -0
- package/js/select.d.ts +3 -0
- package/js/select.js +784 -0
- package/js/shell.d.ts +6 -0
- package/js/shell.js +373 -0
- package/js/slider.d.ts +2 -0
- package/js/slider.js +89 -0
- package/js/sortable.d.ts +5 -0
- package/js/sortable.js +463 -0
- package/js/stepper.d.ts +2 -0
- package/js/stepper.js +72 -0
- package/js/tabs.js +99 -0
- package/js/tag-field.d.ts +2 -0
- package/js/tag-field.js +177 -0
- package/js/theme.d.ts +9 -0
- package/js/theme.js +114 -0
- package/js/time-picker.d.ts +2 -0
- package/js/time-picker.js +279 -0
- package/js/toast.d.ts +17 -0
- package/js/toast.js +171 -0
- package/js/toolbar.d.ts +2 -0
- package/js/toolbar.js +107 -0
- package/js/tooltip.d.ts +2 -0
- package/js/tooltip.js +208 -0
- package/js/tree.d.ts +2 -0
- package/js/tree.js +168 -0
- package/lume.css +11574 -0
- package/lume.d.ts +104 -0
- package/lume.js +67 -0
- package/package.json +66 -4
- package/react/Alert.d.ts +24 -0
- package/react/Alert.js +21 -0
- package/react/AppShell.d.ts +67 -0
- package/react/AppShell.js +94 -0
- package/react/Avatar.d.ts +39 -0
- package/react/Avatar.js +40 -0
- package/react/Badge.d.ts +17 -0
- package/react/Badge.js +10 -0
- package/react/Button.d.ts +32 -0
- package/react/Button.js +17 -0
- package/react/Calendar.d.ts +48 -0
- package/react/Calendar.js +67 -0
- package/react/Carousel.d.ts +30 -0
- package/react/Carousel.js +38 -0
- package/react/Charts.d.ts +186 -0
- package/react/Charts.js +58 -0
- package/react/Chip.d.ts +34 -0
- package/react/Chip.js +26 -0
- package/react/Choice.d.ts +72 -0
- package/react/Choice.js +51 -0
- package/react/ColorPicker.d.ts +43 -0
- package/react/ColorPicker.js +73 -0
- package/react/Content.d.ts +58 -0
- package/react/Content.js +42 -0
- package/react/Controls.d.ts +97 -0
- package/react/Controls.js +118 -0
- package/react/Editor.d.ts +28 -0
- package/react/Editor.js +57 -0
- package/react/Field.d.ts +90 -0
- package/react/Field.js +65 -0
- package/react/Form.d.ts +36 -0
- package/react/Form.js +45 -0
- package/react/Icon.d.ts +13 -0
- package/react/Icon.js +8 -0
- package/react/IconButton.d.ts +19 -0
- package/react/IconButton.js +12 -0
- package/react/ImageViewer.d.ts +20 -0
- package/react/ImageViewer.js +22 -0
- package/react/InlineAction.d.ts +15 -0
- package/react/InlineAction.js +12 -0
- package/react/Layers.d.ts +118 -0
- package/react/Layers.js +115 -0
- package/react/Link.d.ts +32 -0
- package/react/Link.js +26 -0
- package/react/Loading.d.ts +67 -0
- package/react/Loading.js +49 -0
- package/react/Navigation.d.ts +181 -0
- package/react/Navigation.js +197 -0
- package/react/Notices.d.ts +43 -0
- package/react/Notices.js +89 -0
- package/react/Panel.d.ts +57 -0
- package/react/Panel.js +33 -0
- package/react/Pickers.d.ts +83 -0
- package/react/Pickers.js +70 -0
- package/react/Rating.d.ts +39 -0
- package/react/Rating.js +41 -0
- package/react/Resizable.d.ts +44 -0
- package/react/Resizable.js +30 -0
- package/react/Select.d.ts +53 -0
- package/react/Select.js +79 -0
- package/react/Sortable.d.ts +52 -0
- package/react/Sortable.js +113 -0
- package/react/Table.d.ts +60 -0
- package/react/Table.js +34 -0
- package/react/Toolbar.d.ts +45 -0
- package/react/Toolbar.js +45 -0
- package/react/cx.d.ts +2 -0
- package/react/cx.js +5 -0
- package/react/icon-names.d.ts +1 -0
- package/react/icon-names.js +2 -0
- package/react/index.d.ts +42 -0
- package/react/index.js +52 -0
- package/react/useController.d.ts +8 -0
- package/react/useController.js +16 -0
- package/react/useLocale.d.ts +5 -0
- package/react/useLocale.js +15 -0
- package/tokens.css +739 -0
- package/tokens.js +4911 -0
package/react/Table.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type SortDirection = 'ascending' | 'descending';
|
|
3
|
+
export interface TableColumn<Row> {
|
|
4
|
+
key: string;
|
|
5
|
+
/** O título da coluna. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Número: à direita, com algarismos tabulares. */
|
|
8
|
+
num?: boolean;
|
|
9
|
+
/** Texto mais forte, para a coluna que nomeia a linha. */
|
|
10
|
+
strong?: boolean;
|
|
11
|
+
/** Mostra o botão de ordenar no cabeçalho. */
|
|
12
|
+
sortable?: boolean;
|
|
13
|
+
/** Como desenhar a célula. Padrão: row[key]. */
|
|
14
|
+
render?: (row: Row) => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface TableProps<Row> {
|
|
17
|
+
columns: TableColumn<Row>[];
|
|
18
|
+
rows: Row[];
|
|
19
|
+
/** A chave única de cada linha. */
|
|
20
|
+
rowKey: (row: Row) => string;
|
|
21
|
+
/** Nomeia a tabela para leitores de tela. */
|
|
22
|
+
caption: ReactNode;
|
|
23
|
+
/** Descrição curta ao lado da legenda. */
|
|
24
|
+
description?: ReactNode;
|
|
25
|
+
/** Esconde a legenda da tela (continua para leitores de tela). */
|
|
26
|
+
hideCaption?: boolean;
|
|
27
|
+
/** Ordenação atual. A ordem das linhas é sua: ordene rows antes de passar. */
|
|
28
|
+
sort?: {
|
|
29
|
+
key: string;
|
|
30
|
+
direction: SortDirection;
|
|
31
|
+
} | null;
|
|
32
|
+
onSortChange?: (sort: {
|
|
33
|
+
key: string;
|
|
34
|
+
direction: SortDirection;
|
|
35
|
+
}) => void;
|
|
36
|
+
/** Linhas marcadas (as chaves). Com onSelectionChange, aparece a coluna de checkbox. */
|
|
37
|
+
selected?: string[];
|
|
38
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
39
|
+
/** Nome de cada linha para o checkbox ("Selecionar Botão"). Padrão: a primeira coluna. */
|
|
40
|
+
rowLabel?: (row: Row) => string;
|
|
41
|
+
/** Linhas de 40 px. */
|
|
42
|
+
compact?: boolean;
|
|
43
|
+
/** Destaca a linha sob o mouse. */
|
|
44
|
+
hover?: boolean;
|
|
45
|
+
/** Altura máxima com cabeçalho fixo ("420px"). */
|
|
46
|
+
maxHeight?: string;
|
|
47
|
+
/** Linhas apagadas enquanto carrega. */
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/** O que mostrar quando não há linhas. */
|
|
50
|
+
empty?: {
|
|
51
|
+
title: ReactNode;
|
|
52
|
+
text?: ReactNode;
|
|
53
|
+
};
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Tabela nativa (<table>): números alinhados, cabeçalho que ordena e seleção com checkbox.
|
|
58
|
+
* https://lumeui.dev/#/componentes/tabela
|
|
59
|
+
*/
|
|
60
|
+
export declare function Table<Row>({ columns, rows, rowKey, caption, description, hideCaption, sort, onSortChange, selected, onSelectionChange, rowLabel, compact, hover, maxHeight, loading, empty, className, }: TableProps<Row>): import("react").JSX.Element;
|
package/react/Table.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { msg } from '../js/i18n.js';
|
|
5
|
+
import { Icon } from './Icon.js';
|
|
6
|
+
import { useLocale } from './useLocale.js';
|
|
7
|
+
import { cx } from './cx.js';
|
|
8
|
+
/**
|
|
9
|
+
* Tabela nativa (<table>): números alinhados, cabeçalho que ordena e seleção com checkbox.
|
|
10
|
+
* https://lumeui.dev/#/componentes/tabela
|
|
11
|
+
*/
|
|
12
|
+
export function Table({ columns, rows, rowKey, caption, description, hideCaption, sort, onSortChange, selected = [], onSelectionChange, rowLabel, compact, hover, maxHeight, loading, empty, className, }) {
|
|
13
|
+
useLocale();
|
|
14
|
+
const all = useRef(null);
|
|
15
|
+
const selectable = Boolean(onSelectionChange);
|
|
16
|
+
const keys = rows.map(rowKey);
|
|
17
|
+
const marked = keys.filter((k) => selected.includes(k)).length;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (all.current)
|
|
20
|
+
all.current.indeterminate = marked > 0 && marked < keys.length;
|
|
21
|
+
}, [marked, keys.length]);
|
|
22
|
+
const span = columns.length + (selectable ? 1 : 0);
|
|
23
|
+
const nameOf = (row) => rowLabel?.(row) ?? String(row[columns[0].key] ?? '');
|
|
24
|
+
const cell = (row, col) => (col.render ? col.render(row) : row[col.key]);
|
|
25
|
+
const sortIcon = (dir) => _jsx(Icon, { name: dir === 'ascending' ? 'chevron-up' : dir === 'descending' ? 'chevron-down' : 'chevrons-up-down', size: 14 });
|
|
26
|
+
return (_jsx("div", { className: cx('ds-table-wrap', maxHeight && 'ds-table-wrap--scroll', className), style: maxHeight ? { maxHeight } : undefined, role: maxHeight ? 'region' : undefined, "aria-label": maxHeight && typeof caption === 'string' ? caption : undefined, tabIndex: maxHeight ? 0 : undefined, children: _jsxs("table", { className: cx('ds-table', compact && 'ds-table--compact', hover && 'ds-table--hover'), "aria-busy": loading || undefined, children: [_jsxs("caption", { className: hideCaption ? 'ds-visually-hidden' : undefined, children: [caption, description && _jsxs("span", { className: "ds-table__caption-desc", children: [" ", description] })] }), _jsx("thead", { children: _jsxs("tr", { children: [selectable && (_jsx("th", { scope: "col", className: "ds-table__check", children: _jsx("input", { ref: all, type: "checkbox", "aria-label": msg('table.selectAll'), checked: keys.length > 0 && marked === keys.length, onChange: (e) => onSelectionChange(e.target.checked ? [...new Set([...selected, ...keys])] : selected.filter((k) => !keys.includes(k))) }) })), columns.map((col) => {
|
|
27
|
+
const dir = sort?.key === col.key ? sort.direction : undefined;
|
|
28
|
+
return (_jsx("th", { scope: "col", className: col.num ? 'ds-table__num' : undefined, "aria-sort": dir, children: col.sortable && onSortChange ? (_jsxs("button", { type: "button", className: "ds-table__sort", onClick: () => onSortChange({ key: col.key, direction: dir === 'ascending' ? 'descending' : 'ascending' }), children: [col.label, sortIcon(dir)] })) : (col.label) }, col.key));
|
|
29
|
+
})] }) }), _jsx("tbody", { children: loading ? (Array.from({ length: Math.max(3, Math.min(rows.length, 6)) }, (_, i) => (_jsxs("tr", { children: [selectable && _jsx("td", { className: "ds-table__check" }), columns.map((col) => (_jsx("td", { className: col.num ? 'ds-table__num' : undefined, children: _jsx("span", { className: "ds-skeleton ds-skeleton--text ds-table__skeleton", style: { ['--w']: col.num ? '40%' : '70%' } }) }, col.key)))] }, i)))) : rows.length === 0 && empty ? (_jsx("tr", { className: "ds-table__empty", children: _jsx("td", { colSpan: span, children: _jsxs("span", { className: "ds-table__empty-inner", children: [_jsx(Icon, { name: "inbox", size: 24 }), _jsx("span", { className: "ds-table__empty-title", children: empty.title }), empty.text && _jsx("span", { children: empty.text })] }) }) })) : (rows.map((row) => {
|
|
30
|
+
const key = rowKey(row);
|
|
31
|
+
const on = selected.includes(key);
|
|
32
|
+
return (_jsxs("tr", { "data-selected": on ? '' : undefined, children: [selectable && (_jsx("td", { className: "ds-table__check", children: _jsx("input", { type: "checkbox", "aria-label": msg('table.selectRow', nameOf(row)), checked: on, onChange: (e) => onSelectionChange(e.target.checked ? [...selected, key] : selected.filter((k) => k !== key)) }) })), columns.map((col) => (_jsx("td", { className: cx(col.num && 'ds-table__num', col.strong && 'ds-table__strong') || undefined, children: cell(row, col) }, col.key)))] }, key));
|
|
33
|
+
})) })] }) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IconName } from './Icon.js';
|
|
3
|
+
export interface ToolbarProps {
|
|
4
|
+
/** Nome da barra para o leitor de tela (“Formatação”). */
|
|
5
|
+
label: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
|
+
/** Sem contorno nem fundo, para quando a barra já está dentro de uma superfície. */
|
|
9
|
+
plain?: boolean;
|
|
10
|
+
/** Botão com pressed trocou: o value dele e o novo estado. Guarde no estado e passe de volta em pressed. */
|
|
11
|
+
onToggle?: (value: string, pressed: boolean) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Botões de ícone agrupados: um Tab só para a barra, setas entre os botões.
|
|
16
|
+
* <Toolbar label="Formatação" onToggle={(value, on) => …}>
|
|
17
|
+
* <ToolbarGroup>
|
|
18
|
+
* <ToolbarButton icon="bold" label="Negrito" value="bold" pressed={bold} />
|
|
19
|
+
* </ToolbarGroup>
|
|
20
|
+
* <ToolbarSeparator />
|
|
21
|
+
* <ToolbarGroup exclusive>…</ToolbarGroup>
|
|
22
|
+
* </Toolbar>
|
|
23
|
+
* https://lumeui.dev/#/componentes/barra-de-ferramentas
|
|
24
|
+
*/
|
|
25
|
+
export declare function Toolbar({ label, children, orientation, plain, onToggle, className }: ToolbarProps): import("react").JSX.Element;
|
|
26
|
+
/** Grupo de botões; exclusive: só um apertado por vez (como o alinhamento). */
|
|
27
|
+
export declare function ToolbarGroup({ children, exclusive }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
exclusive?: boolean;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
export declare function ToolbarSeparator(): import("react").JSX.Element;
|
|
32
|
+
export interface ToolbarButtonProps {
|
|
33
|
+
icon: IconName;
|
|
34
|
+
/** Nome da ação (“Negrito”): vira o aria-label e a dica. */
|
|
35
|
+
label: string;
|
|
36
|
+
/** O que o onToggle da barra recebe. */
|
|
37
|
+
value?: string;
|
|
38
|
+
/** Com pressed (true ou false), o botão liga e desliga; sem, é uma ação. */
|
|
39
|
+
pressed?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Dica com o nome. Padrão: sim. */
|
|
42
|
+
tooltip?: boolean;
|
|
43
|
+
onClick?: () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare function ToolbarButton({ icon, label, value, pressed, disabled, tooltip, onClick }: ToolbarButtonProps): import("react").JSX.Element;
|
package/react/Toolbar.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { createToolbar } from '../js/toolbar.js';
|
|
5
|
+
import { Icon } from './Icon.js';
|
|
6
|
+
import { useLatest, defined } from './useController.js';
|
|
7
|
+
import { cx } from './cx.js';
|
|
8
|
+
/**
|
|
9
|
+
* Botões de ícone agrupados: um Tab só para a barra, setas entre os botões.
|
|
10
|
+
* <Toolbar label="Formatação" onToggle={(value, on) => …}>
|
|
11
|
+
* <ToolbarGroup>
|
|
12
|
+
* <ToolbarButton icon="bold" label="Negrito" value="bold" pressed={bold} />
|
|
13
|
+
* </ToolbarGroup>
|
|
14
|
+
* <ToolbarSeparator />
|
|
15
|
+
* <ToolbarGroup exclusive>…</ToolbarGroup>
|
|
16
|
+
* </Toolbar>
|
|
17
|
+
* https://lumeui.dev/#/componentes/barra-de-ferramentas
|
|
18
|
+
*/
|
|
19
|
+
export function Toolbar({ label, children, orientation = 'horizontal', plain, onToggle, className }) {
|
|
20
|
+
const root = useRef(null);
|
|
21
|
+
const toggle = useLatest(onToggle);
|
|
22
|
+
const api = useRef(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const t = createToolbar(root.current, defined({ orientation, onToggle: (button, pressed) => toggle.current?.(button.dataset.value ?? '', pressed) }));
|
|
25
|
+
api.current = t;
|
|
26
|
+
return () => {
|
|
27
|
+
t.destroy();
|
|
28
|
+
api.current = null;
|
|
29
|
+
};
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
}, [orientation]);
|
|
32
|
+
// botões novos ou desativados mudam quem fica com o Tab
|
|
33
|
+
useEffect(() => api.current?.refresh());
|
|
34
|
+
return (_jsx("div", { ref: root, className: cx('ds-toolbar', plain && 'ds-toolbar--plain', className), "aria-label": label, "aria-orientation": orientation === 'vertical' ? 'vertical' : undefined, children: children }));
|
|
35
|
+
}
|
|
36
|
+
/** Grupo de botões; exclusive: só um apertado por vez (como o alinhamento). */
|
|
37
|
+
export function ToolbarGroup({ children, exclusive }) {
|
|
38
|
+
return (_jsx("div", { className: "ds-toolbar__group", "data-exclusive": exclusive ? '' : undefined, children: children }));
|
|
39
|
+
}
|
|
40
|
+
export function ToolbarSeparator() {
|
|
41
|
+
return _jsx("div", { className: "ds-toolbar__separator" });
|
|
42
|
+
}
|
|
43
|
+
export function ToolbarButton({ icon, label, value, pressed, disabled, tooltip = true, onClick }) {
|
|
44
|
+
return (_jsx("button", { type: "button", className: "ds-icon-btn", "aria-label": label, "aria-pressed": pressed === undefined ? undefined : pressed, "data-ds-tooltip": tooltip ? label : undefined, "data-value": value, disabled: disabled, onClick: onClick, children: _jsx(Icon, { name: icon, size: 20 }) }));
|
|
45
|
+
}
|
package/react/cx.d.ts
ADDED
package/react/cx.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IconName = 'home' | 'menu' | 'panel-left' | 'panel-top' | 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right' | 'chevrons-up-down' | 'arrow-right' | 'arrow-left' | 'arrow-up' | 'arrow-up-right' | 'arrow-down' | 'external-link' | 'corner-down-left' | 'log-out' | 'compass' | 'zoom-in' | 'zoom-out' | 'maximize' | 'search' | 'search-x' | 'send' | 'paperclip' | 'stop-circle' | 'thumbs-up' | 'thumbs-down' | 'at-sign' | 'plus' | 'minus' | 'x' | 'check' | 'pencil' | 'copy' | 'trash' | 'download' | 'upload' | 'link' | 'filter' | 'refresh' | 'more-horizontal' | 'more-vertical' | 'grip-vertical' | 'zap' | 'play' | 'pause' | 'megaphone' | 'slash' | 'mic' | 'video' | 'info' | 'alert-circle' | 'alert-triangle' | 'check-circle' | 'x-circle' | 'help-circle' | 'bell' | 'loader' | 'clock' | 'history' | 'shield' | 'lock' | 'wifi-off' | 'star' | 'heart' | 'flag' | 'settings' | 'sliders' | 'sun' | 'moon' | 'cabin' | 'mountain' | 'monitor' | 'scrollbar' | 'eye' | 'eye-off' | 'keyboard' | 'command' | 'app-shell' | 'layout' | 'button' | 'input' | 'check-square' | 'radio' | 'toggle' | 'tag' | 'card' | 'dialog' | 'tabs' | 'carousel' | 'resizable' | 'kanban' | 'tooltip' | 'table' | 'list' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'align-left' | 'align-center' | 'align-right' | 'list-ordered' | 'heading' | 'quote' | 'undo' | 'redo' | 'divider' | 'progress-ring' | 'banner' | 'toolbar' | 'message-square' | 'stack' | 'calendar' | 'file-text' | 'folder' | 'inbox' | 'image' | 'package' | 'book-open' | 'code' | 'terminal' | 'git-branch' | 'git-pull-request' | 'mail' | 'globe' | 'target' | 'hash' | 'dashboard' | 'bar-chart' | 'line-chart' | 'area-chart' | 'donut' | 'heatmap' | 'scatter' | 'gauge' | 'trending-up' | 'trending-down' | 'palette' | 'droplet' | 'type' | 'shapes' | 'grid' | 'layers' | 'component' | 'spacing' | 'radius' | 'elevation' | 'motion' | 'accessibility' | 'user' | 'user-circle' | 'users';
|
package/react/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lume para React: componentes .tsx que você copia para o projeto, por cima do CSS e do JavaScript do Lume.
|
|
3
|
+
* Esta pasta fica dentro da pasta do Lume (lume/react/), ao lado de lume.css e lume.js.
|
|
4
|
+
* https://lumeui.dev/#/recursos/react
|
|
5
|
+
*/
|
|
6
|
+
export { cx } from './cx.js';
|
|
7
|
+
export { useLocale } from './useLocale.js';
|
|
8
|
+
export { Icon, type IconName, type IconProps } from './Icon.js';
|
|
9
|
+
export { Button, ButtonLink, type ButtonProps, type ButtonLinkProps, type ButtonVariant, type ButtonSize } from './Button.js';
|
|
10
|
+
export { IconButton, type IconButtonProps } from './IconButton.js';
|
|
11
|
+
export { InlineAction, type InlineActionProps } from './InlineAction.js';
|
|
12
|
+
export { Link, Divider, type LinkProps, type DividerProps } from './Link.js';
|
|
13
|
+
export { Chip, RemovableChip, ChipGroup, type ChipProps, type RemovableChipProps, type ChipGroupProps } from './Chip.js';
|
|
14
|
+
export { Badge, type BadgeProps, type Tone } from './Badge.js';
|
|
15
|
+
export { Alert, type AlertProps, type AlertTone } from './Alert.js';
|
|
16
|
+
export { Banner, NotificationCenter, type BannerProps, type BannerTone, type NotificationCenterProps, type NotificationItem } from './Notices.js';
|
|
17
|
+
export { ImageGallery, openImageViewer, type ImageGalleryProps, type GalleryImage, type ViewerImage } from './ImageViewer.js';
|
|
18
|
+
export { SortableList, Kanban, type SortableListProps, type SortableItem, type KanbanProps, type KanbanColumn } from './Sortable.js';
|
|
19
|
+
export { RichTextEditor, type RichTextEditorProps, type EditorTool } from './Editor.js';
|
|
20
|
+
export { Progress, ProgressRing, Spinner, Skeleton, type ProgressProps, type ProgressRingProps, type SpinnerProps, type SkeletonProps } from './Loading.js';
|
|
21
|
+
export { Card, CardLink, Panel, PanelSpacer, PanelMeta, Section, type CardProps, type CardLinkProps, type PanelProps, type SectionProps } from './Panel.js';
|
|
22
|
+
export { Avatar, AvatarGroup, avatarTone, initials, type AvatarProps, type AvatarGroupProps, type AvatarTone, type AvatarStatus, type AvatarSize } from './Avatar.js';
|
|
23
|
+
export { Kbd, DescriptionList, Timeline, Breadcrumb, type KbdProps, type DescriptionListProps, type TimelineProps, type TimelineItem, type BreadcrumbProps, type BreadcrumbItem, } from './Content.js';
|
|
24
|
+
export { Field, Input, Textarea, TextField, FieldAction, useField, type FieldProps, type InputProps, type TextareaProps, type TextFieldProps, type FieldActionProps, type FieldSize } from './Field.js';
|
|
25
|
+
export { Select, type SelectProps, type SelectOption, type SelectGroup } from './Select.js';
|
|
26
|
+
export { Checkbox, Radio, Switch, ChoiceGroup, RadioGroup, CheckboxGroup, type CheckboxProps, type RadioProps, type SwitchProps, type ChoiceGroupProps, type RadioGroupProps, type CheckboxGroupProps, type ChoiceOption, } from './Choice.js';
|
|
27
|
+
export { DatePicker, TimePicker, NumberField, TagField, type DatePickerProps, type DateRange, type TimePickerProps, type NumberFieldProps, type TagFieldProps, } from './Pickers.js';
|
|
28
|
+
export { ColorPicker, ColorField, type ColorPickerProps, type ColorFieldProps, type ColorSwatch } from './ColorPicker.js';
|
|
29
|
+
export { Slider, FileUpload, OtpField, type SliderProps, type FileUploadProps, type FileUploadHandle, type OtpFieldProps } from './Controls.js';
|
|
30
|
+
export { Form, type FormProps, type FormHandle, type FormError, type FormData } from './Form.js';
|
|
31
|
+
export { Menu, Tabs, SegmentedControl, Pagination, Stepper, Accordion, Tree, BackToTop, useScrollbars, type MenuProps, type MenuOption, type TabsProps, type TabItem, type SegmentedControlProps, type SegmentedOption, type PaginationProps, type StepperProps, type AccordionProps, type AccordionItem, type TreeProps, type TreeItem, type BackToTopProps, } from './Navigation.js';
|
|
32
|
+
export { Modal, Drawer, Popover, ContextMenu, Tooltip, useTooltips, useDisclosure, type ModalProps, type DrawerProps, type DialogAction, type PopoverProps, type ContextMenuProps, type TooltipProps, } from './Layers.js';
|
|
33
|
+
/** Toast: funções, não componentes. toast('Link copiado', { tone: 'success' }). https://lumeui.dev/#/componentes/toast */
|
|
34
|
+
export { toast, copyText, clearToasts, setToastPosition, getToastPosition, type ToastOptions, type ToastPosition } from '../js/toast.js';
|
|
35
|
+
export { Table, type TableProps, type TableColumn, type SortDirection } from './Table.js';
|
|
36
|
+
export { Carousel, type CarouselProps } from './Carousel.js';
|
|
37
|
+
export { ResizablePanels, ResizablePanel, type ResizablePanelsProps, type ResizablePanelProps } from './Resizable.js';
|
|
38
|
+
export { Rating, RatingDisplay, type RatingProps, type RatingDisplayProps } from './Rating.js';
|
|
39
|
+
export { Toolbar, ToolbarGroup, ToolbarSeparator, ToolbarButton, type ToolbarProps, type ToolbarButtonProps } from './Toolbar.js';
|
|
40
|
+
export { Calendar, CodeBlock, type CalendarProps, type CalendarEvent, type CalendarView, type CodeBlockProps } from './Calendar.js';
|
|
41
|
+
export { BarChart, LineChart, DonutChart, Heatmap, CalendarHeatmap, ScatterChart, StatTile, Sparkline, Meter, type BarChartProps, type LineChartProps, type DonutChartProps, type HeatmapProps, type CalendarHeatmapProps, type ScatterChartProps, type StatTileProps, type SparklineProps, type MeterProps, type Series, type ChartBase, } from './Charts.js';
|
|
42
|
+
export { AppShell, ThemeToggle, useTheme, type AppShellProps, type NavGroup, type NavItem, type ThemeToggleProps } from './AppShell.js';
|
package/react/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Lume para React: componentes .tsx que você copia para o projeto, por cima do CSS e do JavaScript do Lume.
|
|
4
|
+
* Esta pasta fica dentro da pasta do Lume (lume/react/), ao lado de lume.css e lume.js.
|
|
5
|
+
* https://lumeui.dev/#/recursos/react
|
|
6
|
+
*/
|
|
7
|
+
export { cx } from './cx.js';
|
|
8
|
+
export { useLocale } from './useLocale.js';
|
|
9
|
+
export { Icon } from './Icon.js';
|
|
10
|
+
// Ações
|
|
11
|
+
export { Button, ButtonLink } from './Button.js';
|
|
12
|
+
export { IconButton } from './IconButton.js';
|
|
13
|
+
export { InlineAction } from './InlineAction.js';
|
|
14
|
+
export { Link, Divider } from './Link.js';
|
|
15
|
+
export { Chip, RemovableChip, ChipGroup } from './Chip.js';
|
|
16
|
+
// Feedback e carregamento
|
|
17
|
+
export { Badge } from './Badge.js';
|
|
18
|
+
export { Alert } from './Alert.js';
|
|
19
|
+
export { Banner, NotificationCenter } from './Notices.js';
|
|
20
|
+
export { ImageGallery, openImageViewer } from './ImageViewer.js';
|
|
21
|
+
export { SortableList, Kanban } from './Sortable.js';
|
|
22
|
+
export { RichTextEditor } from './Editor.js';
|
|
23
|
+
export { Progress, ProgressRing, Spinner, Skeleton } from './Loading.js';
|
|
24
|
+
// Conteúdo
|
|
25
|
+
export { Card, CardLink, Panel, PanelSpacer, PanelMeta, Section } from './Panel.js';
|
|
26
|
+
export { Avatar, AvatarGroup, avatarTone, initials } from './Avatar.js';
|
|
27
|
+
export { Kbd, DescriptionList, Timeline, Breadcrumb, } from './Content.js';
|
|
28
|
+
// Formulários
|
|
29
|
+
export { Field, Input, Textarea, TextField, FieldAction, useField } from './Field.js';
|
|
30
|
+
export { Select } from './Select.js';
|
|
31
|
+
export { Checkbox, Radio, Switch, ChoiceGroup, RadioGroup, CheckboxGroup, } from './Choice.js';
|
|
32
|
+
export { DatePicker, TimePicker, NumberField, TagField, } from './Pickers.js';
|
|
33
|
+
export { ColorPicker, ColorField } from './ColorPicker.js';
|
|
34
|
+
export { Slider, FileUpload, OtpField } from './Controls.js';
|
|
35
|
+
export { Form } from './Form.js';
|
|
36
|
+
// Navegação
|
|
37
|
+
export { Menu, Tabs, SegmentedControl, Pagination, Stepper, Accordion, Tree, BackToTop, useScrollbars, } from './Navigation.js';
|
|
38
|
+
// Camadas
|
|
39
|
+
export { Modal, Drawer, Popover, ContextMenu, Tooltip, useTooltips, useDisclosure, } from './Layers.js';
|
|
40
|
+
/** Toast: funções, não componentes. toast('Link copiado', { tone: 'success' }). https://lumeui.dev/#/componentes/toast */
|
|
41
|
+
export { toast, copyText, clearToasts, setToastPosition, getToastPosition } from '../js/toast.js';
|
|
42
|
+
// Conteúdo e dados
|
|
43
|
+
export { Table } from './Table.js';
|
|
44
|
+
export { Carousel } from './Carousel.js';
|
|
45
|
+
export { ResizablePanels, ResizablePanel } from './Resizable.js';
|
|
46
|
+
export { Rating, RatingDisplay } from './Rating.js';
|
|
47
|
+
export { Toolbar, ToolbarGroup, ToolbarSeparator, ToolbarButton } from './Toolbar.js';
|
|
48
|
+
export { Calendar, CodeBlock } from './Calendar.js';
|
|
49
|
+
// Gráficos
|
|
50
|
+
export { BarChart, LineChart, DonutChart, Heatmap, CalendarHeatmap, ScatterChart, StatTile, Sparkline, Meter, } from './Charts.js';
|
|
51
|
+
// App shell e tema
|
|
52
|
+
export { AppShell, ThemeToggle, useTheme } from './AppShell.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Guarda sempre a versão mais nova de um valor (callbacks), sem refazer efeitos quando ele muda. */
|
|
2
|
+
export declare function useLatest<T>(value: T): import("react").RefObject<T>;
|
|
3
|
+
/** Compara listas e objetos simples pelo conteúdo, para usar como dependência de efeito. */
|
|
4
|
+
export declare const stableKey: (value: unknown) => string;
|
|
5
|
+
/** Tira as chaves undefined: os módulos do Lume usam { padrão, ...opções }, e um undefined apagaria o padrão. */
|
|
6
|
+
export declare const defined: <T extends object>(options: T) => T;
|
|
7
|
+
/** useId sem os caracteres especiais do React («r1», :r1:), para o id servir em seletores CSS e em getElementById. */
|
|
8
|
+
export declare function useSafeId(prefix?: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useId, useRef } from 'react';
|
|
3
|
+
/** Guarda sempre a versão mais nova de um valor (callbacks), sem refazer efeitos quando ele muda. */
|
|
4
|
+
export function useLatest(value) {
|
|
5
|
+
const ref = useRef(value);
|
|
6
|
+
ref.current = value;
|
|
7
|
+
return ref;
|
|
8
|
+
}
|
|
9
|
+
/** Compara listas e objetos simples pelo conteúdo, para usar como dependência de efeito. */
|
|
10
|
+
export const stableKey = (value) => JSON.stringify(value, (_k, v) => (v instanceof Date ? v.toISOString() : v));
|
|
11
|
+
/** Tira as chaves undefined: os módulos do Lume usam { padrão, ...opções }, e um undefined apagaria o padrão. */
|
|
12
|
+
export const defined = (options) => Object.fromEntries(Object.entries(options).filter(([, v]) => v !== undefined));
|
|
13
|
+
/** useId sem os caracteres especiais do React («r1», :r1:), para o id servir em seletores CSS e em getElementById. */
|
|
14
|
+
export function useSafeId(prefix = 'ds') {
|
|
15
|
+
return `${prefix}-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O idioma atual do Lume ('pt-BR', 'en' ou 'es'). O componente que usa redesenha quando o idioma muda
|
|
3
|
+
* (setLocale, do lume.js). Os componentes daqui já usam: os textos deles (Fechar, Carregando) acompanham sozinhos.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useLocale(): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from 'react';
|
|
3
|
+
import { locale } from '../js/i18n.js';
|
|
4
|
+
function subscribe(onChange) {
|
|
5
|
+
const root = document.documentElement;
|
|
6
|
+
root.addEventListener('ds:localechange', onChange);
|
|
7
|
+
return () => root.removeEventListener('ds:localechange', onChange);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* O idioma atual do Lume ('pt-BR', 'en' ou 'es'). O componente que usa redesenha quando o idioma muda
|
|
11
|
+
* (setLocale, do lume.js). Os componentes daqui já usam: os textos deles (Fechar, Carregando) acompanham sozinhos.
|
|
12
|
+
*/
|
|
13
|
+
export function useLocale() {
|
|
14
|
+
return useSyncExternalStore(subscribe, locale, () => 'pt-BR');
|
|
15
|
+
}
|