@joniguerini/lume 0.0.0-stage → 1.9.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/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/lume.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Gerado por scripts/build-react.mjs a partir de ds/lume.js. Não edite.
|
|
2
|
+
// Tipos de lume.js para projetos em TypeScript. A documentação de cada item está em https://lumeui.dev/#/recursos/api.
|
|
3
|
+
export declare const icon: (name: string, options?: { size?: number; strokeWidth?: number; label?: string; className?: string }) => string;
|
|
4
|
+
export declare const icons: Record<string, { name: string; category: string; keywords: string[]; body: string }>;
|
|
5
|
+
export declare const iconList: Array<{ name: string; category: string; keywords: string[]; body: string }>;
|
|
6
|
+
export declare const createBackToTop: any;
|
|
7
|
+
export declare const createCalendar: any;
|
|
8
|
+
export declare const createCarousel: any;
|
|
9
|
+
export declare const createResizable: any;
|
|
10
|
+
export declare const createRating: any;
|
|
11
|
+
export declare const ratingHtml: any;
|
|
12
|
+
export declare const progressRingHtml: any;
|
|
13
|
+
export declare const setProgressRing: any;
|
|
14
|
+
export declare const createBanner: any;
|
|
15
|
+
export declare const createNotificationCenter: any;
|
|
16
|
+
export declare const relativeTime: any;
|
|
17
|
+
export declare const openImageViewer: any;
|
|
18
|
+
export declare const mountImageViewer: any;
|
|
19
|
+
export declare const createSortable: any;
|
|
20
|
+
export declare const createKanban: any;
|
|
21
|
+
export declare const createEditor: any;
|
|
22
|
+
export declare const sanitizeHtml: any;
|
|
23
|
+
export declare const createToolbar: any;
|
|
24
|
+
export declare const createBarChart: any;
|
|
25
|
+
export declare const createLineChart: any;
|
|
26
|
+
export declare const createDonutChart: any;
|
|
27
|
+
export declare const createHeatmap: any;
|
|
28
|
+
export declare const createCalendarHeatmap: any;
|
|
29
|
+
export declare const createScatterChart: any;
|
|
30
|
+
export declare const sparklineHtml: any;
|
|
31
|
+
export declare const statTileHtml: any;
|
|
32
|
+
export declare const meterHtml: any;
|
|
33
|
+
export declare const chartFormatter: any;
|
|
34
|
+
export declare const codeBlockHtml: any;
|
|
35
|
+
export declare const mountCodeBlocks: any;
|
|
36
|
+
export declare const createColorPicker: any;
|
|
37
|
+
export declare const createColorField: any;
|
|
38
|
+
export declare const parseHex: any;
|
|
39
|
+
export declare const createCommandPalette: any;
|
|
40
|
+
export declare const createComposer: any;
|
|
41
|
+
export declare const composerHtml: any;
|
|
42
|
+
export declare const messageHtml: any;
|
|
43
|
+
export declare const attachmentHtml: any;
|
|
44
|
+
export declare const typingHtml: any;
|
|
45
|
+
export declare const streamText: any;
|
|
46
|
+
export declare const createContextMenu: any;
|
|
47
|
+
export declare const createDatePicker: any;
|
|
48
|
+
export declare const createDrawer: any;
|
|
49
|
+
export declare const openDrawer: any;
|
|
50
|
+
export declare const createFileUpload: any;
|
|
51
|
+
export declare const createFilters: any;
|
|
52
|
+
export declare const filtersToQuery: any;
|
|
53
|
+
export declare const filtersFromQuery: any;
|
|
54
|
+
export declare const createForm: any;
|
|
55
|
+
export declare const locale: any;
|
|
56
|
+
export declare const setLocale: any;
|
|
57
|
+
export declare const initLocale: any;
|
|
58
|
+
export declare const getLocalePreference: any;
|
|
59
|
+
export declare const tr: any;
|
|
60
|
+
export declare const msg: any;
|
|
61
|
+
export declare const numberFormat: any;
|
|
62
|
+
export declare const dateFormat: any;
|
|
63
|
+
export declare const formatNumber: any;
|
|
64
|
+
export declare const LOCALES: any;
|
|
65
|
+
export declare const LOCALE_NAMES: any;
|
|
66
|
+
export declare const createMenu: any;
|
|
67
|
+
export declare const createModal: any;
|
|
68
|
+
export declare const openModal: any;
|
|
69
|
+
export declare const confirmModal: any;
|
|
70
|
+
export declare const modalHtml: any;
|
|
71
|
+
export declare const createNumberField: any;
|
|
72
|
+
export declare const createOtpField: any;
|
|
73
|
+
export declare const createPagination: any;
|
|
74
|
+
export declare const createPopover: any;
|
|
75
|
+
export declare const initScrollbars: any;
|
|
76
|
+
export declare const createSegmented: any;
|
|
77
|
+
export declare const createSelect: any;
|
|
78
|
+
export declare const mountSelects: any;
|
|
79
|
+
export declare const createShell: any;
|
|
80
|
+
export declare const renderSidebarNav: any;
|
|
81
|
+
export declare const renderNavbarNav: any;
|
|
82
|
+
export declare const setActiveNavItem: any;
|
|
83
|
+
export declare const LAYOUTS: any;
|
|
84
|
+
export declare const createSlider: any;
|
|
85
|
+
export declare const createStepper: any;
|
|
86
|
+
export declare const mountTabs: any;
|
|
87
|
+
export declare const selectTab: any;
|
|
88
|
+
export declare const createTagField: any;
|
|
89
|
+
export declare const initTheme: any;
|
|
90
|
+
export declare const setTheme: any;
|
|
91
|
+
export declare const toggleTheme: any;
|
|
92
|
+
export declare const resolvedTheme: any;
|
|
93
|
+
export declare const getThemePreference: any;
|
|
94
|
+
export declare const mountThemeControls: any;
|
|
95
|
+
export declare const THEMES: any;
|
|
96
|
+
export declare const createTimePicker: any;
|
|
97
|
+
export declare const toast: any;
|
|
98
|
+
export declare const clearToasts: any;
|
|
99
|
+
export declare const copyText: any;
|
|
100
|
+
export declare const getToastPosition: any;
|
|
101
|
+
export declare const setToastPosition: any;
|
|
102
|
+
export declare const TOAST_POSITIONS: any;
|
|
103
|
+
export declare const initTooltips: any;
|
|
104
|
+
export declare const createTree: any;
|
package/lume.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lume Design System: a API pública, num lugar só.
|
|
3
|
+
*
|
|
4
|
+
* import { createModal, toast, initTheme } from 'https://lumeui.dev/ds/lume.js';
|
|
5
|
+
*
|
|
6
|
+
* Tudo o que está aqui é público e documentado em Recursos › API. O que não está é interno e pode mudar sem aviso.
|
|
7
|
+
* Os módulos de ds/js/ continuam podendo ser importados um a um, para carregar só o necessário.
|
|
8
|
+
*
|
|
9
|
+
* Convenção dos nomes:
|
|
10
|
+
* create… liga um componente a um elemento (ou cria o elemento) e devolve um controle com destroy()
|
|
11
|
+
* mount… liga todos os componentes de um tipo numa área e devolve a função que desliga
|
|
12
|
+
* init… comportamento global da página, chamado uma vez
|
|
13
|
+
* open…, confirm…, toast ação imediata
|
|
14
|
+
* …Html devolve a marcação como texto, sem ligar nada
|
|
15
|
+
* get… / set… estado; constantes em maiúsculas
|
|
16
|
+
*/
|
|
17
|
+
import './icons/icons.js';
|
|
18
|
+
|
|
19
|
+
export { icon, icons, iconList } from './icons/icons.js';
|
|
20
|
+
export { createBackToTop } from './js/back-to-top.js';
|
|
21
|
+
export { createCalendar } from './js/calendar.js';
|
|
22
|
+
export { createCarousel } from './js/carousel.js';
|
|
23
|
+
export { createResizable } from './js/resizable.js';
|
|
24
|
+
export { createRating, ratingHtml } from './js/rating.js';
|
|
25
|
+
export { progressRingHtml, setProgressRing } from './js/progress-ring.js';
|
|
26
|
+
export { createBanner } from './js/banner.js';
|
|
27
|
+
export { createNotificationCenter, relativeTime } from './js/notifications.js';
|
|
28
|
+
export { openImageViewer, mountImageViewer } from './js/image-viewer.js';
|
|
29
|
+
export { createSortable, createKanban } from './js/sortable.js';
|
|
30
|
+
export { createEditor, sanitizeHtml } from './js/editor.js';
|
|
31
|
+
export { createToolbar } from './js/toolbar.js';
|
|
32
|
+
export {
|
|
33
|
+
createBarChart, createLineChart, createDonutChart, createHeatmap, createCalendarHeatmap, createScatterChart,
|
|
34
|
+
sparklineHtml, statTileHtml, meterHtml, chartFormatter,
|
|
35
|
+
} from './js/charts.js';
|
|
36
|
+
export { codeBlockHtml, mountCodeBlocks } from './js/code-block.js';
|
|
37
|
+
export { createColorPicker, createColorField, parseHex } from './js/color-picker.js';
|
|
38
|
+
export { createCommandPalette } from './js/command-palette.js';
|
|
39
|
+
export { createComposer, composerHtml, messageHtml, attachmentHtml, typingHtml, streamText } from './js/composer.js';
|
|
40
|
+
export { createContextMenu } from './js/context-menu.js';
|
|
41
|
+
export { createDatePicker } from './js/date-picker.js';
|
|
42
|
+
export { createDrawer, openDrawer } from './js/drawer.js';
|
|
43
|
+
export { createFileUpload } from './js/file-upload.js';
|
|
44
|
+
export { createFilters, filtersToQuery, filtersFromQuery } from './js/filters.js';
|
|
45
|
+
export { createForm } from './js/form.js';
|
|
46
|
+
export {
|
|
47
|
+
locale, setLocale, initLocale, getLocalePreference, tr, msg, numberFormat, dateFormat, formatNumber, LOCALES, LOCALE_NAMES,
|
|
48
|
+
} from './js/i18n.js';
|
|
49
|
+
export { createMenu } from './js/menu.js';
|
|
50
|
+
export { createModal, openModal, confirmModal, modalHtml } from './js/modal.js';
|
|
51
|
+
export { createNumberField } from './js/number-field.js';
|
|
52
|
+
export { createOtpField } from './js/otp-field.js';
|
|
53
|
+
export { createPagination } from './js/pagination.js';
|
|
54
|
+
export { createPopover } from './js/popover.js';
|
|
55
|
+
export { initScrollbars } from './js/scrollbar.js';
|
|
56
|
+
export { createSegmented } from './js/segmented.js';
|
|
57
|
+
export { createSelect, mountSelects } from './js/select.js';
|
|
58
|
+
export { createShell, renderSidebarNav, renderNavbarNav, setActiveNavItem, LAYOUTS } from './js/shell.js';
|
|
59
|
+
export { createSlider } from './js/slider.js';
|
|
60
|
+
export { createStepper } from './js/stepper.js';
|
|
61
|
+
export { mountTabs, selectTab } from './js/tabs.js';
|
|
62
|
+
export { createTagField } from './js/tag-field.js';
|
|
63
|
+
export { initTheme, setTheme, toggleTheme, resolvedTheme, getThemePreference, mountThemeControls, THEMES } from './js/theme.js';
|
|
64
|
+
export { createTimePicker } from './js/time-picker.js';
|
|
65
|
+
export { toast, clearToasts, copyText, getToastPosition, setToastPosition, TOAST_POSITIONS } from './js/toast.js';
|
|
66
|
+
export { initTooltips } from './js/tooltip.js';
|
|
67
|
+
export { createTree } from './js/tree.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joniguerini/lume",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.9.0",
|
|
4
|
+
"description": "Lume Design System: tokens, 154 icons, 60 components, charts and screen patterns in native HTML, CSS and JavaScript, with no dependencies. React components included.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lume.js",
|
|
7
|
+
"types": "./lume.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lume.d.ts",
|
|
11
|
+
"default": "./lume.js"
|
|
12
|
+
},
|
|
13
|
+
"./lume.css": "./lume.css",
|
|
14
|
+
"./ds.css": "./ds.css",
|
|
15
|
+
"./tokens.css": "./tokens.css",
|
|
16
|
+
"./tokens.js": "./tokens.js",
|
|
17
|
+
"./icons": "./icons/icons.js",
|
|
18
|
+
"./react": {
|
|
19
|
+
"types": "./react/index.d.ts",
|
|
20
|
+
"default": "./react/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./js/*": "./js/*",
|
|
23
|
+
"./components/*": "./components/*",
|
|
24
|
+
"./fonts/*": "./fonts/*",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"lume": "bin/lumeui.mjs"
|
|
29
|
+
},
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"*.css",
|
|
32
|
+
"./icons/icons.js",
|
|
33
|
+
"./lume.js"
|
|
34
|
+
],
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": ">=18",
|
|
37
|
+
"react-dom": ">=18"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"react": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"react-dom": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://lumeui.dev",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/JoniGuerini/lume-design-system.git"
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"author": "Jonathan Navarro",
|
|
54
|
+
"keywords": [
|
|
55
|
+
"design-system",
|
|
56
|
+
"ui",
|
|
57
|
+
"components",
|
|
58
|
+
"css",
|
|
59
|
+
"tokens",
|
|
60
|
+
"icons",
|
|
61
|
+
"react",
|
|
62
|
+
"no-dependencies",
|
|
63
|
+
"lume"
|
|
64
|
+
],
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=18"
|
|
67
|
+
}
|
|
68
|
+
}
|
package/react/Alert.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type IconName } from './Icon.js';
|
|
3
|
+
export type AlertTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
4
|
+
export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
|
+
/** Padrão: info. Cada tom já traz o ícone dele. */
|
|
6
|
+
tone?: AlertTone;
|
|
7
|
+
/** A frase principal. */
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
/** O detalhe, quando precisa. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** Botões do próximo passo ("Tentar de novo"). */
|
|
12
|
+
actions?: ReactNode;
|
|
13
|
+
/** Uma linha só, para painéis e barras. */
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
/** Troca o ícone do tom. */
|
|
16
|
+
icon?: IconName;
|
|
17
|
+
/** Mostra o × e chama esta função. Você decide o que some. */
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Aviso dentro da página. Depois de uma ação urgente, passe role="alert"; o resto, role="status".
|
|
22
|
+
* https://lumeui.dev/#/componentes/alerta
|
|
23
|
+
*/
|
|
24
|
+
export declare function Alert({ tone, title, children, actions, compact, icon, onClose, className, ...rest }: AlertProps): import("react").JSX.Element;
|
package/react/Alert.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Icon } from './Icon.js';
|
|
4
|
+
import { msg } from '../js/i18n.js';
|
|
5
|
+
import { useLocale } from './useLocale.js';
|
|
6
|
+
import { cx } from './cx.js';
|
|
7
|
+
const TONE_ICON = {
|
|
8
|
+
neutral: 'info',
|
|
9
|
+
info: 'info',
|
|
10
|
+
success: 'check-circle',
|
|
11
|
+
warning: 'alert-triangle',
|
|
12
|
+
danger: 'alert-circle',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Aviso dentro da página. Depois de uma ação urgente, passe role="alert"; o resto, role="status".
|
|
16
|
+
* https://lumeui.dev/#/componentes/alerta
|
|
17
|
+
*/
|
|
18
|
+
export function Alert({ tone = 'info', title, children, actions, compact, icon, onClose, className, ...rest }) {
|
|
19
|
+
useLocale();
|
|
20
|
+
return (_jsxs("div", { className: cx('ds-alert', tone !== 'neutral' && `ds-alert--${tone}`, compact && 'ds-alert--compact', className), ...rest, children: [_jsx("span", { className: "ds-alert__icon", children: _jsx(Icon, { name: icon ?? TONE_ICON[tone], size: 18 }) }), _jsxs("div", { className: "ds-alert__body", children: [_jsx("p", { className: "ds-alert__title", children: title }), children && _jsx("p", { className: "ds-alert__text", children: children }), actions && _jsx("div", { className: "ds-alert__actions", children: actions })] }), onClose && (_jsx("button", { type: "button", className: "ds-icon-btn ds-icon-btn--sm ds-icon-btn--muted ds-alert__close", "aria-label": msg('common.close'), onClick: onClose, children: _jsx(Icon, { name: "x", size: 16 }) }))] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type IconName } from './Icon.js';
|
|
3
|
+
export interface NavItem {
|
|
4
|
+
label: string;
|
|
5
|
+
icon: IconName;
|
|
6
|
+
href: string;
|
|
7
|
+
/** Pontinho de novidade. */
|
|
8
|
+
dot?: boolean;
|
|
9
|
+
/** Rótulo pequeno que abre uma seção dentro do grupo (repita em cada item da seção). */
|
|
10
|
+
section?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface NavGroup {
|
|
13
|
+
id: string;
|
|
14
|
+
/** Sem rótulo: a navegação principal, no topo. Com rótulo: um grupo que recolhe. */
|
|
15
|
+
label?: string;
|
|
16
|
+
items: NavItem[];
|
|
17
|
+
}
|
|
18
|
+
export interface AppShellProps {
|
|
19
|
+
/** O nome do produto, ao lado da marca. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** A marca (um <img> ou um ícone), 24 px. */
|
|
22
|
+
logo?: ReactNode;
|
|
23
|
+
/** Para onde a marca leva. Padrão: "/". */
|
|
24
|
+
homeHref?: string;
|
|
25
|
+
/** A navegação da sidebar. */
|
|
26
|
+
nav: NavGroup[];
|
|
27
|
+
/** O endereço da página atual: o item ganha aria-current e o grupo dele abre. */
|
|
28
|
+
activeHref?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Chamado ao clicar num item da navegação ou na marca, para o seu roteador:
|
|
31
|
+
* (href, event) => { event.preventDefault(); navigate(href); }. Sem ele, os links navegam normalmente.
|
|
32
|
+
*/
|
|
33
|
+
onNavigate?: (href: string, event: MouseEvent) => void;
|
|
34
|
+
/** Botão de busca no topo da sidebar (abre a sua paleta de comandos). */
|
|
35
|
+
onSearch?: () => void;
|
|
36
|
+
searchLabel?: string;
|
|
37
|
+
/** Pé da sidebar: conta, versão ou workspace. */
|
|
38
|
+
sidebarFooter?: ReactNode;
|
|
39
|
+
/** A trilha da página, à esquerda da topbar (um Breadcrumb). */
|
|
40
|
+
breadcrumb?: ReactNode;
|
|
41
|
+
/** O que fica à direita da topbar. O botão de tema já vem no fim. */
|
|
42
|
+
actions?: ReactNode;
|
|
43
|
+
/** Mostra o botão de tema na topbar. Padrão: sim. */
|
|
44
|
+
themeToggle?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Onde fica a navegação no desktop: na lateral ("sidebar", o padrão) ou no topo ("navbar").
|
|
47
|
+
* No celular, os dois viram a mesma gaveta. https://lumeui.dev/#/componentes/navbar
|
|
48
|
+
*/
|
|
49
|
+
layout?: 'sidebar' | 'navbar';
|
|
50
|
+
/** Guarda a sidebar recolhida e os grupos no navegador. Padrão: sim. */
|
|
51
|
+
persist?: boolean;
|
|
52
|
+
/** O conteúdo da página. */
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A moldura do app: sidebar que recolhe (gaveta no celular), topbar que aparece ao rolar e o painel principal.
|
|
58
|
+
* https://lumeui.dev/#/padroes/app-shell
|
|
59
|
+
*/
|
|
60
|
+
export declare function AppShell({ name, logo, homeHref, nav, activeHref, onNavigate, onSearch, searchLabel, sidebarFooter, breadcrumb, actions, themeToggle, layout, persist, children, className, }: AppShellProps): import("react").JSX.Element;
|
|
61
|
+
export interface ThemeToggleProps {
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
/** O tema em uso ('light' ou 'dark'); redesenha quando ele muda. */
|
|
65
|
+
export declare function useTheme(): 'light' | 'dark';
|
|
66
|
+
/** O botão redondo de claro e escuro; a escolha fica salva. Chame initTheme() (lume.js) na entrada do app. */
|
|
67
|
+
export declare function ThemeToggle({ className }: ThemeToggleProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useSyncExternalStore } from 'react';
|
|
4
|
+
import { createShell, renderSidebarNav, renderNavbarNav, setActiveNavItem } from '../js/shell.js';
|
|
5
|
+
import { resolvedTheme, toggleTheme } from '../js/theme.js';
|
|
6
|
+
import { initTooltips } from '../js/tooltip.js';
|
|
7
|
+
import { msg } from '../js/i18n.js';
|
|
8
|
+
import { Icon } from './Icon.js';
|
|
9
|
+
import { useLocale } from './useLocale.js';
|
|
10
|
+
import { stableKey } from './useController.js';
|
|
11
|
+
import { cx } from './cx.js';
|
|
12
|
+
/**
|
|
13
|
+
* A moldura do app: sidebar que recolhe (gaveta no celular), topbar que aparece ao rolar e o painel principal.
|
|
14
|
+
* https://lumeui.dev/#/padroes/app-shell
|
|
15
|
+
*/
|
|
16
|
+
export function AppShell({ name, logo, homeHref = '/', nav, activeHref, onNavigate, onSearch, searchLabel, sidebarFooter, breadcrumb, actions, themeToggle = true, layout = 'sidebar', persist = true, children, className, }) {
|
|
17
|
+
useLocale();
|
|
18
|
+
const root = useRef(null);
|
|
19
|
+
const navEl = useRef(null);
|
|
20
|
+
const navbarEl = useRef(null);
|
|
21
|
+
const navbar = useRef(null);
|
|
22
|
+
const shell = useRef(null);
|
|
23
|
+
const navigate = useRef(onNavigate);
|
|
24
|
+
navigate.current = onNavigate;
|
|
25
|
+
const navKey = stableKey(nav);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
initTooltips();
|
|
28
|
+
const c = createShell(root.current, { persist, layout });
|
|
29
|
+
shell.current = c;
|
|
30
|
+
return () => {
|
|
31
|
+
c.destroy();
|
|
32
|
+
shell.current = null;
|
|
33
|
+
};
|
|
34
|
+
}, [persist]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
renderSidebarNav(navEl.current, nav);
|
|
37
|
+
if (activeHref)
|
|
38
|
+
setActiveNavItem(navEl.current, activeHref);
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, [navKey]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (activeHref)
|
|
43
|
+
setActiveNavItem(navEl.current, activeHref);
|
|
44
|
+
if (activeHref)
|
|
45
|
+
navbar.current?.setActive(activeHref);
|
|
46
|
+
}, [activeHref]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
shell.current?.setLayout(layout);
|
|
49
|
+
if (layout !== 'navbar')
|
|
50
|
+
return;
|
|
51
|
+
// escolher no menu de um grupo não tem clique num link: o roteador recebe um evento só com preventDefault
|
|
52
|
+
const go = (href) => {
|
|
53
|
+
if (navigate.current)
|
|
54
|
+
navigate.current(href, { preventDefault() { } });
|
|
55
|
+
else
|
|
56
|
+
location.assign(href);
|
|
57
|
+
};
|
|
58
|
+
const n = renderNavbarNav(navbarEl.current, nav, { go });
|
|
59
|
+
navbar.current = n;
|
|
60
|
+
if (activeHref)
|
|
61
|
+
n.setActive(activeHref);
|
|
62
|
+
return () => {
|
|
63
|
+
n.destroy();
|
|
64
|
+
navbar.current = null;
|
|
65
|
+
};
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
}, [layout, navKey]);
|
|
68
|
+
const onNavClick = (event) => {
|
|
69
|
+
const link = event.target.closest('a.ds-nav-item, a.ds-navbar__item, a.ds-brand');
|
|
70
|
+
if (!link || !onNavigate || event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0)
|
|
71
|
+
return;
|
|
72
|
+
onNavigate(link.getAttribute('href') ?? '', event);
|
|
73
|
+
shell.current?.closeMobile();
|
|
74
|
+
};
|
|
75
|
+
const brand = (_jsxs("a", { className: "ds-brand", href: homeHref, "aria-label": msg('shell.goHome', name), children: [logo && _jsx("span", { className: "ds-brand__mark", "aria-hidden": "true", children: logo }), name] }));
|
|
76
|
+
const search = onSearch && (_jsx("div", { className: "ds-sidebar__search", children: _jsxs("button", { type: "button", className: "ds-field ds-sidebar-search", onClick: onSearch, "data-ds-tooltip": searchLabel ?? msg('common.search'), "data-ds-tooltip-placement": "right", children: [_jsx(Icon, { name: "search", size: 20 }), _jsx("span", { className: "ds-field__placeholder", children: searchLabel ?? msg('common.search') })] }) }));
|
|
77
|
+
return (_jsxs("div", { ref: root, className: cx('ds-shell', className), onClick: onNavClick, children: [_jsx("button", { type: "button", className: "ds-shell__edge", "data-shell-toggle": true, "aria-controls": "ds-shell-sidebar", "data-ds-tooltip-placement": "right", children: _jsx(Icon, { name: "chevron-left", size: 16 }) }), layout === 'navbar' && (_jsxs("div", { className: "ds-navbar", children: [brand, _jsx("nav", { ref: navbarEl, className: "ds-navbar__nav", "aria-label": msg('shell.mainNav') }), onSearch && (_jsxs("button", { type: "button", className: "ds-field ds-sidebar-search ds-navbar__search", onClick: onSearch, children: [_jsx(Icon, { name: "search", size: 20 }), _jsx("span", { className: "ds-field__placeholder", children: searchLabel ?? msg('common.search') })] }))] })), _jsxs("aside", { className: "ds-sidebar", id: "ds-shell-sidebar", "aria-label": msg('shell.sidebar'), children: [_jsxs("div", { className: "ds-sidebar__header", children: [brand, _jsxs("button", { type: "button", className: "ds-icon-btn ds-icon-btn--outline ds-icon-btn--lg ds-sidebar__toggle", "data-shell-toggle": true, "aria-controls": "ds-shell-sidebar", "data-ds-tooltip-placement": "right", children: [logo && _jsx("span", { className: "ds-sidebar__toggle-mark", "aria-hidden": "true", children: logo }), _jsx(Icon, { name: "panel-left", className: "ds-sidebar__toggle-collapse" }), _jsx(Icon, { name: "x", className: "ds-sidebar__toggle-close" })] })] }), search, _jsx("nav", { ref: navEl, className: "ds-sidebar__nav", "aria-label": msg('shell.mainNav') }), sidebarFooter && _jsx("div", { className: "ds-sidebar__footer", children: sidebarFooter })] }), _jsx("div", { className: "ds-shell__scrim", "data-shell-scrim": true }), _jsx("div", { className: "ds-main", children: _jsxs("div", { className: "ds-main__scroll", children: [_jsxs("header", { className: "ds-topbar", children: [_jsx("button", { type: "button", className: "ds-icon-btn ds-icon-btn--outline ds-topbar__menu", "data-shell-toggle": true, "aria-controls": "ds-shell-sidebar", children: _jsx(Icon, { name: "menu" }) }), breadcrumb, _jsx("div", { className: "ds-topbar__spacer" }), onSearch && (_jsx("button", { type: "button", className: "ds-icon-btn ds-topbar__search", onClick: onSearch, "aria-label": searchLabel ?? msg('common.search'), children: _jsx(Icon, { name: "search" }) })), actions, themeToggle && _jsx(ThemeToggle, {})] }), _jsx("main", { className: "ds-main__content", tabIndex: -1, children: children })] }) })] }));
|
|
78
|
+
}
|
|
79
|
+
function subscribeTheme(onChange) {
|
|
80
|
+
const html = document.documentElement;
|
|
81
|
+
html.addEventListener('ds:themechange', onChange);
|
|
82
|
+
return () => html.removeEventListener('ds:themechange', onChange);
|
|
83
|
+
}
|
|
84
|
+
/** O tema em uso ('light' ou 'dark'); redesenha quando ele muda. */
|
|
85
|
+
export function useTheme() {
|
|
86
|
+
return useSyncExternalStore(subscribeTheme, () => resolvedTheme(), () => 'light');
|
|
87
|
+
}
|
|
88
|
+
/** O botão redondo de claro e escuro; a escolha fica salva. Chame initTheme() (lume.js) na entrada do app. */
|
|
89
|
+
export function ThemeToggle({ className }) {
|
|
90
|
+
useLocale();
|
|
91
|
+
const dark = useTheme() === 'dark';
|
|
92
|
+
const label = msg('theme.toggle');
|
|
93
|
+
return (_jsxs("button", { type: "button", className: cx('ds-theme-toggle', className), "aria-pressed": dark, "aria-label": label, "data-ds-tooltip": label, "data-ds-tooltip-placement": "bottom", onClick: toggleTheme, children: [_jsx(Icon, { name: "sun", size: 18, className: "ds-theme-toggle__sun" }), _jsx(Icon, { name: "moon", size: 18, className: "ds-theme-toggle__moon" })] }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type AvatarTone = 'sand' | 'clay' | 'ochre' | 'slate' | 'green' | 'teal' | 'blue' | 'violet' | 'pink';
|
|
3
|
+
export type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';
|
|
4
|
+
export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
/** Tom estável por pessoa: o mesmo nome cai sempre no mesmo tom, igual ao site. */
|
|
6
|
+
export declare function avatarTone(name: string): AvatarTone;
|
|
7
|
+
/** Primeira letra do primeiro e do último nome. */
|
|
8
|
+
export declare function initials(name: string): string;
|
|
9
|
+
export interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
10
|
+
/** O nome da pessoa: dá as iniciais, o tom e o rótulo para leitores de tela. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Foto. Se falhar, as iniciais aparecem. */
|
|
13
|
+
src?: string;
|
|
14
|
+
/** Padrão: md (40 px). */
|
|
15
|
+
size?: AvatarSize;
|
|
16
|
+
/** Padrão: o tom derivado do nome. */
|
|
17
|
+
tone?: AvatarTone;
|
|
18
|
+
/** Bolinha de status no canto. Entra também no rótulo ("Marina, online"). */
|
|
19
|
+
status?: AvatarStatus;
|
|
20
|
+
/** Cantos quadrados, para empresas e projetos. */
|
|
21
|
+
square?: boolean;
|
|
22
|
+
/** Ao lado do nome escrito: esconde do leitor de tela, para não ler duas vezes. */
|
|
23
|
+
decorative?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Representa uma pessoa ou conta: foto quando existe, iniciais num tom estável quando não, ícone sem nome.
|
|
27
|
+
* https://lumeui.dev/#/componentes/avatar
|
|
28
|
+
*/
|
|
29
|
+
export declare function Avatar({ name, src, size, tone, status, square, decorative, className, ...rest }: AvatarProps): import("react").JSX.Element;
|
|
30
|
+
export interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
/** Os avatares. Passe todos: o grupo mostra até max e resume o resto em "+N". */
|
|
32
|
+
children: ReactNode[];
|
|
33
|
+
/** Quantos mostrar antes do "+N". Padrão: 4. */
|
|
34
|
+
max?: number;
|
|
35
|
+
/** Tamanho do "+N"; use o mesmo dos avatares. Padrão: md. */
|
|
36
|
+
size?: AvatarSize;
|
|
37
|
+
}
|
|
38
|
+
/** Pessoas de um grupo, sobrepostas. */
|
|
39
|
+
export declare function AvatarGroup({ children, max, size, className, ...rest }: AvatarGroupProps): import("react").JSX.Element;
|
package/react/Avatar.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Icon } from './Icon.js';
|
|
5
|
+
import { msg } from '../js/i18n.js';
|
|
6
|
+
import { useLocale } from './useLocale.js';
|
|
7
|
+
import { cx } from './cx.js';
|
|
8
|
+
const TONES = ['sand', 'clay', 'ochre', 'slate', 'green', 'teal', 'blue', 'violet', 'pink'];
|
|
9
|
+
const ICON_PX = { xs: 12, sm: 16, md: 20, lg: 24, xl: 32 };
|
|
10
|
+
/** Tom estável por pessoa: o mesmo nome cai sempre no mesmo tom, igual ao site. */
|
|
11
|
+
export function avatarTone(name) {
|
|
12
|
+
let h = 0;
|
|
13
|
+
for (const ch of name.normalize('NFD'))
|
|
14
|
+
h = (h * 31 + (ch.codePointAt(0) ?? 0)) >>> 0;
|
|
15
|
+
return TONES[h % TONES.length];
|
|
16
|
+
}
|
|
17
|
+
/** Primeira letra do primeiro e do último nome. */
|
|
18
|
+
export function initials(name) {
|
|
19
|
+
const words = name.trim().split(/\s+/).filter(Boolean);
|
|
20
|
+
if (!words.length)
|
|
21
|
+
return '?';
|
|
22
|
+
return (words[0][0] + (words.length > 1 ? words[words.length - 1][0] : '')).toLocaleUpperCase();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Representa uma pessoa ou conta: foto quando existe, iniciais num tom estável quando não, ícone sem nome.
|
|
26
|
+
* https://lumeui.dev/#/componentes/avatar
|
|
27
|
+
*/
|
|
28
|
+
export function Avatar({ name, src, size = 'md', tone, status, square, decorative, className, ...rest }) {
|
|
29
|
+
useLocale();
|
|
30
|
+
const [failed, setFailed] = useState(null);
|
|
31
|
+
const label = name ? (status ? `${name}, ${msg(`avatar.${status}`)}` : name) : undefined;
|
|
32
|
+
return (_jsxs("span", { className: cx('ds-avatar', size !== 'md' && `ds-avatar--${size}`, name && `ds-avatar--${tone ?? avatarTone(name)}`, square && 'ds-avatar--square', className), ...(decorative || !label ? { 'aria-hidden': true } : { role: 'img', 'aria-label': label }), ...rest, children: [name ? _jsx("span", { "aria-hidden": "true", children: initials(name) }) : _jsx(Icon, { name: "user", size: ICON_PX[size] }), src && failed !== src && _jsx("img", { src: src, alt: "", onError: () => setFailed(src) }), status && _jsx("span", { className: `ds-avatar__status ds-avatar__status--${status}`, "aria-hidden": "true" })] }));
|
|
33
|
+
}
|
|
34
|
+
/** Pessoas de um grupo, sobrepostas. */
|
|
35
|
+
export function AvatarGroup({ children, max = 4, size = 'md', className, ...rest }) {
|
|
36
|
+
useLocale();
|
|
37
|
+
const shown = children.slice(0, max);
|
|
38
|
+
const more = children.length - shown.length;
|
|
39
|
+
return (_jsxs("div", { role: "group", "aria-label": msg('avatar.group', children.length), className: cx('ds-avatar-group', className), ...rest, children: [shown, more > 0 && (_jsxs("span", { className: cx('ds-avatar', 'ds-avatar--more', size !== 'md' && `ds-avatar--${size}`), role: "img", "aria-label": msg('avatar.more', more), children: ["+", more] }))] }));
|
|
40
|
+
}
|
package/react/Badge.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export type Tone = 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** Padrão: neutral. A cor nunca vem sozinha: o texto diz o mesmo. */
|
|
5
|
+
tone?: Tone;
|
|
6
|
+
/** Padrão: md (24 px). */
|
|
7
|
+
size?: 'sm' | 'md';
|
|
8
|
+
/** Ponto antes do texto, para status. */
|
|
9
|
+
dot?: boolean;
|
|
10
|
+
/** Contador: número curto, redondo ("3", "99+"). */
|
|
11
|
+
count?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Rótulo curto de status ou contagem. Não é clicável.
|
|
15
|
+
* https://lumeui.dev/#/componentes/badge
|
|
16
|
+
*/
|
|
17
|
+
export declare function Badge({ tone, size, dot, count, className, children, ...rest }: BadgeProps): import("react").JSX.Element;
|
package/react/Badge.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from './cx.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rótulo curto de status ou contagem. Não é clicável.
|
|
6
|
+
* https://lumeui.dev/#/componentes/badge
|
|
7
|
+
*/
|
|
8
|
+
export function Badge({ tone = 'neutral', size = 'md', dot, count, className, children, ...rest }) {
|
|
9
|
+
return (_jsxs("span", { className: cx('ds-badge', tone !== 'neutral' && `ds-badge--${tone}`, size === 'sm' && 'ds-badge--sm', count && 'ds-badge--count', className), ...rest, children: [dot && !count && _jsx("span", { className: "ds-badge__dot" }), children] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { type IconName } from './Icon.js';
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'subtle' | 'danger';
|
|
4
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface ButtonLook {
|
|
6
|
+
/** O peso da ação. Uma só primária por tela. Padrão: secondary. */
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
/** Padrão: md (40 px). sm para barras densas; lg para chamadas e toque. */
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
/** Ícone antes do rótulo. */
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
/** Ícone depois do rótulo: só para "avançar". */
|
|
13
|
+
iconEnd?: IconName;
|
|
14
|
+
/** Cantos de pílula. */
|
|
15
|
+
pill?: boolean;
|
|
16
|
+
/** Ocupa a largura toda. */
|
|
17
|
+
block?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ButtonProps extends ButtonLook, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
20
|
+
/** Ocupado: mostra o spinner no lugar do ícone e marca aria-busy. Troque o rótulo ("Salvando"). */
|
|
21
|
+
busy?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Dispara uma ação. Rótulo começa com verbo: "Salvar alterações", não "OK".
|
|
25
|
+
* https://lumeui.dev/#/componentes/botao
|
|
26
|
+
*/
|
|
27
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
export interface ButtonLinkProps extends ButtonLook, AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
29
|
+
}
|
|
30
|
+
/** O mesmo visual do Botão, para navegar: vira um link (<a>), com o teclado e o leitor de tela de um link. */
|
|
31
|
+
export declare const ButtonLink: import("react").ForwardRefExoticComponent<ButtonLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
32
|
+
export {};
|
package/react/Button.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Icon } from './Icon.js';
|
|
5
|
+
import { cx } from './cx.js';
|
|
6
|
+
const classes = ({ variant = 'secondary', size = 'md', pill, block }, className) => cx('ds-btn', `ds-btn--${variant}`, size !== 'md' && `ds-btn--${size}`, pill && 'ds-btn--pill', block && 'ds-btn--block', className);
|
|
7
|
+
/**
|
|
8
|
+
* Dispara uma ação. Rótulo começa com verbo: "Salvar alterações", não "OK".
|
|
9
|
+
* https://lumeui.dev/#/componentes/botao
|
|
10
|
+
*/
|
|
11
|
+
export const Button = forwardRef(function Button({ variant, size, icon, iconEnd, pill, block, busy, className, type = 'button', children, ...rest }, ref) {
|
|
12
|
+
return (_jsxs("button", { ref: ref, type: type, "aria-busy": busy || undefined, className: classes({ variant, size, pill, block }, className), ...rest, children: [busy ? _jsx("span", { className: "ds-spinner ds-spinner--sm", "aria-hidden": "true" }) : icon && _jsx(Icon, { name: icon }), children, iconEnd && _jsx(Icon, { name: iconEnd })] }));
|
|
13
|
+
});
|
|
14
|
+
/** O mesmo visual do Botão, para navegar: vira um link (<a>), com o teclado e o leitor de tela de um link. */
|
|
15
|
+
export const ButtonLink = forwardRef(function ButtonLink({ variant, size, icon, iconEnd, pill, block, className, children, ...rest }, ref) {
|
|
16
|
+
return (_jsxs("a", { ref: ref, className: classes({ variant, size, pill, block }, className), ...rest, children: [icon && _jsx(Icon, { name: icon }), children, iconEnd && _jsx(Icon, { name: iconEnd })] }));
|
|
17
|
+
});
|