@joniguerini/lume 1.9.2 → 1.10.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/README.md +2 -2
- package/components/form.css +27 -0
- package/components/loading.css +8 -1
- package/components/menu.css +13 -0
- package/components/shell.css +25 -0
- package/components/toast.css +36 -0
- package/js/menu.js +8 -3
- package/js/shell.js +7 -3
- package/js/toast.d.ts +3 -1
- package/js/toast.js +7 -3
- package/lume.css +110 -2
- package/package.json +1 -1
- package/react/Alert.d.ts +3 -2
- package/react/Alert.js +4 -3
- package/react/AppShell.d.ts +2 -0
- package/react/Button.d.ts +4 -1
- package/react/Button.js +9 -2
- package/react/Charts.d.ts +4 -0
- package/react/Navigation.d.ts +13 -3
- package/react/Navigation.js +6 -6
package/README.md
CHANGED
|
@@ -45,9 +45,9 @@ The files become yours: edit them as you like.
|
|
|
45
45
|
## Or load it from the web
|
|
46
46
|
|
|
47
47
|
```html
|
|
48
|
-
<link rel="stylesheet" href="https://lumeui.dev/v/1.
|
|
48
|
+
<link rel="stylesheet" href="https://lumeui.dev/v/1.10/lume.css">
|
|
49
49
|
<script type="module">
|
|
50
|
-
import { initTheme } from 'https://lumeui.dev/v/1.
|
|
50
|
+
import { initTheme } from 'https://lumeui.dev/v/1.10/lume.js';
|
|
51
51
|
initTheme();
|
|
52
52
|
</script>
|
|
53
53
|
```
|
package/components/form.css
CHANGED
|
@@ -232,6 +232,8 @@
|
|
|
232
232
|
|
|
233
233
|
.ds-segmented__item {
|
|
234
234
|
display: inline-grid;
|
|
235
|
+
grid-auto-flow: column;
|
|
236
|
+
gap: var(--ds-space-075);
|
|
235
237
|
place-items: center;
|
|
236
238
|
min-width: 28px;
|
|
237
239
|
height: var(--ds-size-control-xs);
|
|
@@ -245,6 +247,31 @@
|
|
|
245
247
|
box-shadow var(--ds-duration-base) var(--ds-easing-standard);
|
|
246
248
|
}
|
|
247
249
|
|
|
250
|
+
/* Tamanhos pela altura total (trilho + item): sm 32 · md 36 (padrão) · lg 40, que alinha com campos e botões médios */
|
|
251
|
+
.ds-segmented--sm .ds-segmented__item {
|
|
252
|
+
min-width: 24px;
|
|
253
|
+
height: calc(var(--ds-size-control-sm) - 8px);
|
|
254
|
+
padding-inline: var(--ds-space-075);
|
|
255
|
+
font: var(--ds-text-label-sm);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.ds-segmented--lg .ds-segmented__item {
|
|
259
|
+
min-width: 32px;
|
|
260
|
+
height: calc(var(--ds-size-control-md) - 8px);
|
|
261
|
+
padding-inline: var(--ds-space-150);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Largura toda: as opções dividem o espaço por igual */
|
|
265
|
+
.ds-segmented--fill {
|
|
266
|
+
display: flex;
|
|
267
|
+
width: 100%;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.ds-segmented--fill .ds-segmented__item {
|
|
271
|
+
flex: 1;
|
|
272
|
+
min-width: 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
248
275
|
.ds-segmented__item:hover,
|
|
249
276
|
.ds-segmented__item[data-state="hover"] {
|
|
250
277
|
color: var(--ds-color-fg-default);
|
package/components/loading.css
CHANGED
|
@@ -190,12 +190,19 @@
|
|
|
190
190
|
to { transform: rotate(1turn); }
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
/*
|
|
193
|
+
/*
|
|
194
|
+
* Botão ocupado: <button class="ds-btn" aria-busy="true" aria-disabled="true"><span class="ds-spinner ds-spinner--sm"></span>Salvando</button>
|
|
195
|
+
* Fica indisponível (sem segundo clique) mas não esmaece: o spinner já diz que está trabalhando.
|
|
196
|
+
*/
|
|
194
197
|
.ds-btn[aria-busy="true"] {
|
|
195
198
|
cursor: progress;
|
|
196
199
|
pointer-events: none;
|
|
197
200
|
}
|
|
198
201
|
|
|
202
|
+
.ds-btn[aria-busy="true"][aria-disabled="true"] {
|
|
203
|
+
opacity: 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
199
206
|
/*
|
|
200
207
|
* Skeleton — a forma do conteúdo antes de ele chegar: formas lisas que pulsam devagar, sem brilho.
|
|
201
208
|
* <div aria-busy="true" aria-label="Carregando"><div class="ds-skeleton ds-skeleton--text" style="--w:60%"></div></div>
|
package/components/menu.css
CHANGED
|
@@ -142,6 +142,19 @@
|
|
|
142
142
|
background: var(--ds-color-border-subtle);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/* meta: texto curto à direita (uma contagem); com a marca do modo radio, fica antes dela */
|
|
146
|
+
.ds-menu__meta {
|
|
147
|
+
margin-inline-start: auto;
|
|
148
|
+
padding-inline-start: var(--ds-space-200);
|
|
149
|
+
color: var(--ds-color-fg-subtle);
|
|
150
|
+
font: var(--ds-text-caption);
|
|
151
|
+
font-variant-numeric: tabular-nums;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ds-menu__meta + .ds-menu__check {
|
|
155
|
+
margin-inline-start: var(--ds-space-100);
|
|
156
|
+
}
|
|
157
|
+
|
|
145
158
|
.ds-menu__shortcut {
|
|
146
159
|
margin-inline-start: auto;
|
|
147
160
|
padding-inline-start: var(--ds-space-200);
|
package/components/shell.css
CHANGED
|
@@ -202,6 +202,19 @@
|
|
|
202
202
|
transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
/* contagem à direita do rótulo: número apagado, sem pílula (o rótulo continua mandando) */
|
|
206
|
+
.ds-nav-item__count {
|
|
207
|
+
flex: none;
|
|
208
|
+
color: var(--ds-color-fg-subtle);
|
|
209
|
+
font: var(--ds-text-caption);
|
|
210
|
+
font-variant-numeric: tabular-nums;
|
|
211
|
+
transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.ds-nav-item[aria-current="page"] .ds-nav-item__count {
|
|
215
|
+
color: var(--ds-color-fg-muted);
|
|
216
|
+
}
|
|
217
|
+
|
|
205
218
|
.ds-nav-item > .ds-dot {
|
|
206
219
|
margin-inline-end: 4px;
|
|
207
220
|
transition: translate var(--_dur) var(--_ease);
|
|
@@ -532,6 +545,12 @@ button.ds-account {
|
|
|
532
545
|
color: var(--ds-color-fg-default);
|
|
533
546
|
}
|
|
534
547
|
|
|
548
|
+
.ds-navbar__count {
|
|
549
|
+
color: var(--ds-color-fg-subtle);
|
|
550
|
+
font: var(--ds-text-caption);
|
|
551
|
+
font-variant-numeric: tabular-nums;
|
|
552
|
+
}
|
|
553
|
+
|
|
535
554
|
.ds-navbar__item > .ds-dot {
|
|
536
555
|
margin-inline-start: 2px;
|
|
537
556
|
}
|
|
@@ -689,6 +708,7 @@ button.ds-account {
|
|
|
689
708
|
.ds-sidebar-search .ds-field__placeholder,
|
|
690
709
|
.ds-sidebar-search__kbd,
|
|
691
710
|
.ds-nav-item__label,
|
|
711
|
+
.ds-nav-item__count,
|
|
692
712
|
.ds-nav-group__label,
|
|
693
713
|
.ds-nav-group__toggle,
|
|
694
714
|
.ds-account__text,
|
|
@@ -719,6 +739,11 @@ button.ds-account {
|
|
|
719
739
|
visibility: visible;
|
|
720
740
|
}
|
|
721
741
|
|
|
742
|
+
/* recolhida: a contagem sai do fluxo, para o ícone não sair do lugar */
|
|
743
|
+
.ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item__count {
|
|
744
|
+
position: absolute;
|
|
745
|
+
}
|
|
746
|
+
|
|
722
747
|
.ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item > .ds-dot {
|
|
723
748
|
position: absolute;
|
|
724
749
|
top: 9px;
|
package/components/toast.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Toast — aviso curto e passageiro (ds/js/toast.js)
|
|
3
3
|
* tons: --success --warning --danger --info (neutro é o padrão)
|
|
4
4
|
* partes: __icon, __message, __action (opcional), __close (quando dura até fechar)
|
|
5
|
+
* com descrição (--stacked): __message guarda __title e __description, em duas linhas
|
|
5
6
|
* regiões: .ds-toast-region--{top|bottom}-{start|center|end}, uma por posição
|
|
6
7
|
* recuos ajustáveis: --ds-toast-offset-top (abaixo da topbar), --ds-toast-offset-bottom, --ds-toast-offset-inline
|
|
7
8
|
*/
|
|
@@ -105,6 +106,41 @@
|
|
|
105
106
|
white-space: nowrap;
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
/* Título e descrição: duas linhas, o ícone e os botões alinham com o título */
|
|
110
|
+
.ds-toast--stacked {
|
|
111
|
+
align-items: flex-start;
|
|
112
|
+
min-width: min(280px, 100%);
|
|
113
|
+
padding-block: var(--ds-space-150);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ds-toast--stacked .ds-toast__message {
|
|
117
|
+
display: grid;
|
|
118
|
+
gap: 2px;
|
|
119
|
+
white-space: normal;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ds-toast__title {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ds-toast__description {
|
|
129
|
+
font: var(--ds-text-body-sm);
|
|
130
|
+
letter-spacing: var(--ds-text-body-sm-tracking);
|
|
131
|
+
opacity: 0.72;
|
|
132
|
+
overflow-wrap: anywhere;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* a primeira linha tem 20 px: ícone, ação e fechar descem para o meio dela */
|
|
136
|
+
.ds-toast--stacked .ds-toast__icon {
|
|
137
|
+
min-height: 20px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ds-toast--stacked :is(.ds-toast__action, .ds-toast__close) {
|
|
141
|
+
margin-block: -4px;
|
|
142
|
+
}
|
|
143
|
+
|
|
108
144
|
.ds-toast code {
|
|
109
145
|
font: var(--ds-text-code-sm);
|
|
110
146
|
}
|
package/js/menu.js
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
* });
|
|
22
22
|
*
|
|
23
23
|
* Itens especiais: { type: 'separator' }, { type: 'group', label } e { …, disabled: true }.
|
|
24
|
+
* meta: texto curto à direita do item, como uma contagem ({ value, label, meta: '37' }).
|
|
25
|
+
*
|
|
26
|
+
* label vira o título pequeno no topo e o nome do menu. Com hideLabel: true, o título some e o nome
|
|
27
|
+
* fica só para o leitor de tela (menus de ações de uma linha, que não precisam de título visível).
|
|
24
28
|
*
|
|
25
29
|
* Colunas — listas longas viram uma grade em vez de rolar: maxRows é o máximo de itens por coluna;
|
|
26
30
|
* passando disso, os itens seguem para a coluna do lado, equilibrados (16 itens com maxRows 5 → 4 × 4).
|
|
@@ -64,11 +68,12 @@ export function menuContent({ label, options = [], value, mode = 'radio', rows =
|
|
|
64
68
|
: o.shortcut
|
|
65
69
|
? `<span class="ds-menu__shortcut">${escape(o.shortcut)}</span>`
|
|
66
70
|
: '';
|
|
71
|
+
const meta = o.meta !== undefined && o.meta !== null && o.meta !== '' ? `<span class="ds-menu__meta">${escape(o.meta)}</span>` : '';
|
|
67
72
|
const cls = `ds-menu__item${o.tone === 'danger' ? ' ds-menu__item--danger' : ''}`;
|
|
68
73
|
const state = radio ? ` aria-checked="${o.value === value}"` : '';
|
|
69
74
|
const disabled = o.disabled ? ' aria-disabled="true"' : '';
|
|
70
75
|
return `<button type="button" class="${cls}" role="${radio ? 'menuitemradio' : 'menuitem'}" tabindex="-1"${state}${disabled} data-value="${escape(o.value)}">
|
|
71
|
-
${lead}<span class="ds-menu__text">${escape(o.label)}</span>${trail}
|
|
76
|
+
${lead}<span class="ds-menu__text">${escape(o.label)}</span>${meta}${trail}
|
|
72
77
|
</button>`;
|
|
73
78
|
})
|
|
74
79
|
.join('');
|
|
@@ -90,7 +95,7 @@ export function menuContent({ label, options = [], value, mode = 'radio', rows =
|
|
|
90
95
|
);
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
export function createMenu(trigger, { label, options = [], value, onChange, mode = 'radio', maxRows = 0, sectionColumns = false } = {}) {
|
|
98
|
+
export function createMenu(trigger, { label, hideLabel = false, options = [], value, onChange, mode = 'radio', maxRows = 0, sectionColumns = false } = {}) {
|
|
94
99
|
const id = `ds-menu-${++uid}`;
|
|
95
100
|
const menu = document.createElement('div');
|
|
96
101
|
menu.className = 'ds-menu';
|
|
@@ -110,7 +115,7 @@ export function createMenu(trigger, { label, options = [], value, onChange, mode
|
|
|
110
115
|
const items = () => [...menu.querySelectorAll('.ds-menu__item:not([aria-disabled="true"])')];
|
|
111
116
|
|
|
112
117
|
function render() {
|
|
113
|
-
menu.innerHTML = menuContent({ label, options, value: current, mode, rows, sectionColumns });
|
|
118
|
+
menu.innerHTML = menuContent({ label: hideLabel ? undefined : label, options, value: current, mode, rows, sectionColumns });
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
function position() {
|
package/js/shell.js
CHANGED
|
@@ -202,17 +202,21 @@ export function createShell(root, { persist = true, initial, layout } = {}) {
|
|
|
202
202
|
|
|
203
203
|
const escape = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
|
204
204
|
|
|
205
|
+
const hasCount = (item) => item.count !== undefined && item.count !== null && item.count !== '';
|
|
206
|
+
|
|
205
207
|
function navItem(item, large) {
|
|
206
208
|
return `<li><a class="ds-nav-item${large ? ' ds-nav-item--lg' : ''}" href="${escape(item.href)}" data-ds-tooltip="${escape(item.label)}" data-ds-tooltip-placement="right">
|
|
207
209
|
${icon(item.icon, { size: 20 })}
|
|
208
210
|
<span class="ds-nav-item__label">${escape(item.label)}</span>
|
|
211
|
+
${hasCount(item) ? `<span class="ds-nav-item__count">${escape(item.count)}</span>` : ''}
|
|
209
212
|
${item.dot ? `<span class="ds-dot" aria-label="${escape(msg('shell.new'))}"></span>` : ''}
|
|
210
213
|
</a></li>`;
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
/**
|
|
214
217
|
* Renderiza a navegação.
|
|
215
|
-
* groups: [{ id, label?, items: [{ label, icon, href, dot?, section? }] }] — o grupo sem label vira a navegação principal.
|
|
218
|
+
* groups: [{ id, label?, items: [{ label, icon, href, count?, dot?, section? }] }] — o grupo sem label vira a navegação principal.
|
|
219
|
+
* count: contagem à direita do rótulo ("Clientes 37"); na sidebar recolhida ela some.
|
|
216
220
|
* section: rótulo pequeno que abre uma seção dentro do grupo (repita em cada item da seção).
|
|
217
221
|
*/
|
|
218
222
|
export function renderSidebarNav(container, groups) {
|
|
@@ -278,7 +282,7 @@ export function renderNavbarNav(container, groups, { createMenu = createMenuDefa
|
|
|
278
282
|
? `<button type="button" class="ds-navbar__item" data-navbar-group="${escape(group.id)}"><span>${escape(group.label)}</span><span class="ds-navbar__chevron" aria-hidden="true">${icon('chevron-down', { size: 16 })}</span></button>`
|
|
279
283
|
: group.items
|
|
280
284
|
.filter((i) => i.href !== '#/')
|
|
281
|
-
.map((i) => `<a class="ds-navbar__item" href="${escape(i.href)}"><span>${escape(i.label)}</span>${i.dot ? `<span class="ds-dot" aria-label="${escape(msg('shell.new'))}"></span>` : ''}</a>`)
|
|
285
|
+
.map((i) => `<a class="ds-navbar__item" href="${escape(i.href)}"><span>${escape(i.label)}</span>${hasCount(i) ? `<span class="ds-navbar__count">${escape(i.count)}</span>` : ''}${i.dot ? `<span class="ds-dot" aria-label="${escape(msg('shell.new'))}"></span>` : ''}</a>`)
|
|
282
286
|
.join(''),
|
|
283
287
|
)
|
|
284
288
|
.join('');
|
|
@@ -295,7 +299,7 @@ export function renderNavbarNav(container, groups, { createMenu = createMenuDefa
|
|
|
295
299
|
menu: createMenu(button, {
|
|
296
300
|
label: group.label,
|
|
297
301
|
// com seções, cada uma vira uma coluna; sem elas, grupos longos abrem em grade (nos dois casos, sem rolagem)
|
|
298
|
-
options: group.items.flatMap((i, n) => [...(i.section && i.section !== group.items[n - 1]?.section ? [{ type: 'group', label: i.section }] : []), { value: i.href, label: i.label, icon: i.icon }]),
|
|
302
|
+
options: group.items.flatMap((i, n) => [...(i.section && i.section !== group.items[n - 1]?.section ? [{ type: 'group', label: i.section }] : []), { value: i.href, label: i.label, icon: i.icon, meta: i.count }]),
|
|
299
303
|
...(group.items.some((i) => i.section) ? { sectionColumns: true } : { maxRows: 5 }),
|
|
300
304
|
value: null,
|
|
301
305
|
onChange: go,
|
package/js/toast.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Gerado por scripts/build-react.mjs. Não edite.
|
|
2
2
|
export type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
3
3
|
export interface ToastOptions {
|
|
4
|
+
/** Uma segunda linha, mais apagada, embaixo da mensagem (que vira o título). */
|
|
5
|
+
description?: string;
|
|
4
6
|
icon?: string;
|
|
5
7
|
tone?: 'neutral' | 'success' | 'warning' | 'danger' | 'info';
|
|
6
8
|
action?: { label: string; onClick: () => void };
|
|
@@ -14,4 +16,4 @@ export declare function copyText(text: string, label?: string, options?: { echo?
|
|
|
14
16
|
export declare function getToastPosition(): ToastPosition;
|
|
15
17
|
export declare function setToastPosition(position: ToastPosition): ToastPosition;
|
|
16
18
|
export declare function toastContent(message: string, options?: ToastOptions & { dismissible?: boolean }): string;
|
|
17
|
-
export declare function toastClasses(options?: { tone?: string }): string;
|
|
19
|
+
export declare function toastClasses(options?: { tone?: string; description?: string }): string;
|
package/js/toast.js
CHANGED
|
@@ -65,16 +65,20 @@ function ensureRegion(position) {
|
|
|
65
65
|
const escape = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
|
66
66
|
|
|
67
67
|
/** HTML interno do toast — usado pela API e pelas prévias estáticas da documentação. */
|
|
68
|
-
export function toastContent(message, { icon: name, tone = 'neutral', action, dismissible = false } = {}) {
|
|
68
|
+
export function toastContent(message, { icon: name, tone = 'neutral', action, dismissible = false, description } = {}) {
|
|
69
69
|
const toned = tone !== 'neutral';
|
|
70
70
|
const glyph = name ?? TONE_ICONS[tone] ?? 'check';
|
|
71
|
+
const text = description
|
|
72
|
+
? `<span class="ds-toast__message"><span class="ds-toast__title">${escape(message)}</span><span class="ds-toast__description">${escape(description)}</span></span>`
|
|
73
|
+
: `<span class="ds-toast__message">${escape(message)}</span>`;
|
|
71
74
|
return `<span class="ds-toast__icon">${icon(glyph, { size: toned ? 14 : 18 })}</span>
|
|
72
|
-
|
|
75
|
+
${text}
|
|
73
76
|
${action ? `<button type="button" class="ds-toast__action" data-toast-action>${escape(action.label)}</button>` : ''}
|
|
74
77
|
${dismissible ? `<button type="button" class="ds-toast__close" data-toast-close aria-label="${msg('toast.close')}">${icon('x', { size: 16 })}</button>` : ''}`;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
export const toastClasses = ({ tone = 'neutral' } = {}) =>
|
|
80
|
+
export const toastClasses = ({ tone = 'neutral', description } = {}) =>
|
|
81
|
+
`ds-toast${tone !== 'neutral' ? ` ds-toast--${tone}` : ''}${description ? ' ds-toast--stacked' : ''}`;
|
|
78
82
|
|
|
79
83
|
export function toast(message, options = {}) {
|
|
80
84
|
const { action, duration } = options;
|
package/lume.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Lume Design System 1.
|
|
1
|
+
/* Lume Design System 1.10.0 · MIT · https://lumeui.dev */
|
|
2
2
|
/* Lume Design System — ponto de entrada CSS */
|
|
3
3
|
/*
|
|
4
4
|
* Fontes do Lume, servidas daqui (sem Google Fonts nem CDN): a mesma letra em qualquer aparelho e rede.
|
|
@@ -1951,6 +1951,8 @@ ds-icon {
|
|
|
1951
1951
|
|
|
1952
1952
|
.ds-segmented__item {
|
|
1953
1953
|
display: inline-grid;
|
|
1954
|
+
grid-auto-flow: column;
|
|
1955
|
+
gap: var(--ds-space-075);
|
|
1954
1956
|
place-items: center;
|
|
1955
1957
|
min-width: 28px;
|
|
1956
1958
|
height: var(--ds-size-control-xs);
|
|
@@ -1964,6 +1966,31 @@ ds-icon {
|
|
|
1964
1966
|
box-shadow var(--ds-duration-base) var(--ds-easing-standard);
|
|
1965
1967
|
}
|
|
1966
1968
|
|
|
1969
|
+
/* Tamanhos pela altura total (trilho + item): sm 32 · md 36 (padrão) · lg 40, que alinha com campos e botões médios */
|
|
1970
|
+
.ds-segmented--sm .ds-segmented__item {
|
|
1971
|
+
min-width: 24px;
|
|
1972
|
+
height: calc(var(--ds-size-control-sm) - 8px);
|
|
1973
|
+
padding-inline: var(--ds-space-075);
|
|
1974
|
+
font: var(--ds-text-label-sm);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
.ds-segmented--lg .ds-segmented__item {
|
|
1978
|
+
min-width: 32px;
|
|
1979
|
+
height: calc(var(--ds-size-control-md) - 8px);
|
|
1980
|
+
padding-inline: var(--ds-space-150);
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/* Largura toda: as opções dividem o espaço por igual */
|
|
1984
|
+
.ds-segmented--fill {
|
|
1985
|
+
display: flex;
|
|
1986
|
+
width: 100%;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
.ds-segmented--fill .ds-segmented__item {
|
|
1990
|
+
flex: 1;
|
|
1991
|
+
min-width: 0;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1967
1994
|
.ds-segmented__item:hover,
|
|
1968
1995
|
.ds-segmented__item[data-state="hover"] {
|
|
1969
1996
|
color: var(--ds-color-fg-default);
|
|
@@ -6182,6 +6209,19 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
|
|
|
6182
6209
|
background: var(--ds-color-border-subtle);
|
|
6183
6210
|
}
|
|
6184
6211
|
|
|
6212
|
+
/* meta: texto curto à direita (uma contagem); com a marca do modo radio, fica antes dela */
|
|
6213
|
+
.ds-menu__meta {
|
|
6214
|
+
margin-inline-start: auto;
|
|
6215
|
+
padding-inline-start: var(--ds-space-200);
|
|
6216
|
+
color: var(--ds-color-fg-subtle);
|
|
6217
|
+
font: var(--ds-text-caption);
|
|
6218
|
+
font-variant-numeric: tabular-nums;
|
|
6219
|
+
}
|
|
6220
|
+
|
|
6221
|
+
.ds-menu__meta + .ds-menu__check {
|
|
6222
|
+
margin-inline-start: var(--ds-space-100);
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6185
6225
|
.ds-menu__shortcut {
|
|
6186
6226
|
margin-inline-start: auto;
|
|
6187
6227
|
padding-inline-start: var(--ds-space-200);
|
|
@@ -6222,6 +6262,7 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
|
|
|
6222
6262
|
* Toast — aviso curto e passageiro (ds/js/toast.js)
|
|
6223
6263
|
* tons: --success --warning --danger --info (neutro é o padrão)
|
|
6224
6264
|
* partes: __icon, __message, __action (opcional), __close (quando dura até fechar)
|
|
6265
|
+
* com descrição (--stacked): __message guarda __title e __description, em duas linhas
|
|
6225
6266
|
* regiões: .ds-toast-region--{top|bottom}-{start|center|end}, uma por posição
|
|
6226
6267
|
* recuos ajustáveis: --ds-toast-offset-top (abaixo da topbar), --ds-toast-offset-bottom, --ds-toast-offset-inline
|
|
6227
6268
|
*/
|
|
@@ -6325,6 +6366,41 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
|
|
|
6325
6366
|
white-space: nowrap;
|
|
6326
6367
|
}
|
|
6327
6368
|
|
|
6369
|
+
/* Título e descrição: duas linhas, o ícone e os botões alinham com o título */
|
|
6370
|
+
.ds-toast--stacked {
|
|
6371
|
+
align-items: flex-start;
|
|
6372
|
+
min-width: min(280px, 100%);
|
|
6373
|
+
padding-block: var(--ds-space-150);
|
|
6374
|
+
}
|
|
6375
|
+
|
|
6376
|
+
.ds-toast--stacked .ds-toast__message {
|
|
6377
|
+
display: grid;
|
|
6378
|
+
gap: 2px;
|
|
6379
|
+
white-space: normal;
|
|
6380
|
+
}
|
|
6381
|
+
|
|
6382
|
+
.ds-toast__title {
|
|
6383
|
+
overflow: hidden;
|
|
6384
|
+
text-overflow: ellipsis;
|
|
6385
|
+
white-space: nowrap;
|
|
6386
|
+
}
|
|
6387
|
+
|
|
6388
|
+
.ds-toast__description {
|
|
6389
|
+
font: var(--ds-text-body-sm);
|
|
6390
|
+
letter-spacing: var(--ds-text-body-sm-tracking);
|
|
6391
|
+
opacity: 0.72;
|
|
6392
|
+
overflow-wrap: anywhere;
|
|
6393
|
+
}
|
|
6394
|
+
|
|
6395
|
+
/* a primeira linha tem 20 px: ícone, ação e fechar descem para o meio dela */
|
|
6396
|
+
.ds-toast--stacked .ds-toast__icon {
|
|
6397
|
+
min-height: 20px;
|
|
6398
|
+
}
|
|
6399
|
+
|
|
6400
|
+
.ds-toast--stacked :is(.ds-toast__action, .ds-toast__close) {
|
|
6401
|
+
margin-block: -4px;
|
|
6402
|
+
}
|
|
6403
|
+
|
|
6328
6404
|
.ds-toast code {
|
|
6329
6405
|
font: var(--ds-text-code-sm);
|
|
6330
6406
|
}
|
|
@@ -9391,12 +9467,19 @@ button.ds-calendar__col-head[data-state="hover"] {
|
|
|
9391
9467
|
to { transform: rotate(1turn); }
|
|
9392
9468
|
}
|
|
9393
9469
|
|
|
9394
|
-
/*
|
|
9470
|
+
/*
|
|
9471
|
+
* Botão ocupado: <button class="ds-btn" aria-busy="true" aria-disabled="true"><span class="ds-spinner ds-spinner--sm"></span>Salvando</button>
|
|
9472
|
+
* Fica indisponível (sem segundo clique) mas não esmaece: o spinner já diz que está trabalhando.
|
|
9473
|
+
*/
|
|
9395
9474
|
.ds-btn[aria-busy="true"] {
|
|
9396
9475
|
cursor: progress;
|
|
9397
9476
|
pointer-events: none;
|
|
9398
9477
|
}
|
|
9399
9478
|
|
|
9479
|
+
.ds-btn[aria-busy="true"][aria-disabled="true"] {
|
|
9480
|
+
opacity: 1;
|
|
9481
|
+
}
|
|
9482
|
+
|
|
9400
9483
|
/*
|
|
9401
9484
|
* Skeleton — a forma do conteúdo antes de ele chegar: formas lisas que pulsam devagar, sem brilho.
|
|
9402
9485
|
* <div aria-busy="true" aria-label="Carregando"><div class="ds-skeleton ds-skeleton--text" style="--w:60%"></div></div>
|
|
@@ -10683,6 +10766,19 @@ button.ds-calendar__col-head[data-state="hover"] {
|
|
|
10683
10766
|
transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
|
|
10684
10767
|
}
|
|
10685
10768
|
|
|
10769
|
+
/* contagem à direita do rótulo: número apagado, sem pílula (o rótulo continua mandando) */
|
|
10770
|
+
.ds-nav-item__count {
|
|
10771
|
+
flex: none;
|
|
10772
|
+
color: var(--ds-color-fg-subtle);
|
|
10773
|
+
font: var(--ds-text-caption);
|
|
10774
|
+
font-variant-numeric: tabular-nums;
|
|
10775
|
+
transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
|
|
10776
|
+
}
|
|
10777
|
+
|
|
10778
|
+
.ds-nav-item[aria-current="page"] .ds-nav-item__count {
|
|
10779
|
+
color: var(--ds-color-fg-muted);
|
|
10780
|
+
}
|
|
10781
|
+
|
|
10686
10782
|
.ds-nav-item > .ds-dot {
|
|
10687
10783
|
margin-inline-end: 4px;
|
|
10688
10784
|
transition: translate var(--_dur) var(--_ease);
|
|
@@ -11013,6 +11109,12 @@ button.ds-account {
|
|
|
11013
11109
|
color: var(--ds-color-fg-default);
|
|
11014
11110
|
}
|
|
11015
11111
|
|
|
11112
|
+
.ds-navbar__count {
|
|
11113
|
+
color: var(--ds-color-fg-subtle);
|
|
11114
|
+
font: var(--ds-text-caption);
|
|
11115
|
+
font-variant-numeric: tabular-nums;
|
|
11116
|
+
}
|
|
11117
|
+
|
|
11016
11118
|
.ds-navbar__item > .ds-dot {
|
|
11017
11119
|
margin-inline-start: 2px;
|
|
11018
11120
|
}
|
|
@@ -11170,6 +11272,7 @@ button.ds-account {
|
|
|
11170
11272
|
.ds-sidebar-search .ds-field__placeholder,
|
|
11171
11273
|
.ds-sidebar-search__kbd,
|
|
11172
11274
|
.ds-nav-item__label,
|
|
11275
|
+
.ds-nav-item__count,
|
|
11173
11276
|
.ds-nav-group__label,
|
|
11174
11277
|
.ds-nav-group__toggle,
|
|
11175
11278
|
.ds-account__text,
|
|
@@ -11200,6 +11303,11 @@ button.ds-account {
|
|
|
11200
11303
|
visibility: visible;
|
|
11201
11304
|
}
|
|
11202
11305
|
|
|
11306
|
+
/* recolhida: a contagem sai do fluxo, para o ícone não sair do lugar */
|
|
11307
|
+
.ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item__count {
|
|
11308
|
+
position: absolute;
|
|
11309
|
+
}
|
|
11310
|
+
|
|
11203
11311
|
.ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item > .ds-dot {
|
|
11204
11312
|
position: absolute;
|
|
11205
11313
|
top: 9px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joniguerini/lume",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"main": "./lume.js",
|
package/react/Alert.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
18
18
|
onClose?: () => void;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Aviso dentro da página.
|
|
21
|
+
* Aviso dentro da página. O role vem do tom: danger é role="alert" (lido na hora); os outros, role="status"
|
|
22
|
+
* (lidos sem interromper). Passe role para trocar, ou role="none" num aviso fixo que não deve ser anunciado.
|
|
22
23
|
* https://lumeui.dev/#/componentes/alerta
|
|
23
24
|
*/
|
|
24
|
-
export declare function Alert({ tone, title, children, actions, compact, icon, onClose, className, ...rest }: AlertProps): import("react").JSX.Element;
|
|
25
|
+
export declare function Alert({ tone, title, children, actions, compact, icon, onClose, className, role, ...rest }: AlertProps): import("react").JSX.Element;
|
package/react/Alert.js
CHANGED
|
@@ -12,10 +12,11 @@ const TONE_ICON = {
|
|
|
12
12
|
danger: 'alert-circle',
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Aviso dentro da página.
|
|
15
|
+
* Aviso dentro da página. O role vem do tom: danger é role="alert" (lido na hora); os outros, role="status"
|
|
16
|
+
* (lidos sem interromper). Passe role para trocar, ou role="none" num aviso fixo que não deve ser anunciado.
|
|
16
17
|
* https://lumeui.dev/#/componentes/alerta
|
|
17
18
|
*/
|
|
18
|
-
export function Alert({ tone = 'info', title, children, actions, compact, icon, onClose, className, ...rest }) {
|
|
19
|
+
export function Alert({ tone = 'info', title, children, actions, compact, icon, onClose, className, role, ...rest }) {
|
|
19
20
|
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
|
+
return (_jsxs("div", { className: cx('ds-alert', tone !== 'neutral' && `ds-alert--${tone}`, compact && 'ds-alert--compact', className), role: role ?? (tone === 'danger' ? 'alert' : 'status'), ...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
22
|
}
|
package/react/AppShell.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface NavItem {
|
|
|
4
4
|
label: string;
|
|
5
5
|
icon: IconName;
|
|
6
6
|
href: string;
|
|
7
|
+
/** Contagem à direita do rótulo ("Clientes 37"). Na navbar, entra também nos menus dos grupos. */
|
|
8
|
+
count?: number | string;
|
|
7
9
|
/** Pontinho de novidade. */
|
|
8
10
|
dot?: boolean;
|
|
9
11
|
/** Rótulo pequeno que abre uma seção dentro do grupo (repita em cada item da seção). */
|
package/react/Button.d.ts
CHANGED
|
@@ -17,7 +17,10 @@ interface ButtonLook {
|
|
|
17
17
|
block?: boolean;
|
|
18
18
|
}
|
|
19
19
|
export interface ButtonProps extends ButtonLook, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Ocupado: mostra o spinner no lugar do ícone, marca aria-busy e fica indisponível (aria-disabled),
|
|
22
|
+
* sem perder o foco: o clique e o envio do formulário não disparam de novo. Troque o rótulo ("Salvando").
|
|
23
|
+
*/
|
|
21
24
|
busy?: boolean;
|
|
22
25
|
}
|
|
23
26
|
/**
|
package/react/Button.js
CHANGED
|
@@ -8,8 +8,15 @@ const classes = ({ variant = 'secondary', size = 'md', pill, block }, className)
|
|
|
8
8
|
* Dispara uma ação. Rótulo começa com verbo: "Salvar alterações", não "OK".
|
|
9
9
|
* https://lumeui.dev/#/componentes/botao
|
|
10
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,
|
|
11
|
+
export const Button = forwardRef(function Button({ variant, size, icon, iconEnd, pill, block, busy, className, type = 'button', children, onClick, ...rest }, ref) {
|
|
12
|
+
return (_jsxs("button", { ref: ref, type: type, className: classes({ variant, size, pill, block }, className), ...rest, "aria-busy": busy || undefined, "aria-disabled": busy || rest['aria-disabled'] || undefined, onClick: (event) => {
|
|
13
|
+
// ocupado: nada de segundo envio (o Enter num campo também chega aqui como clique no botão de envio)
|
|
14
|
+
if (busy) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
onClick?.(event);
|
|
19
|
+
}, 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
20
|
});
|
|
14
21
|
/** O mesmo visual do Botão, para navegar: vira um link (<a>), com o teclado e o leitor de tela de um link. */
|
|
15
22
|
export const ButtonLink = forwardRef(function ButtonLink({ variant, size, icon, iconEnd, pill, block, className, children, ...rest }, ref) {
|
package/react/Charts.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface BarChartProps extends ChartBase {
|
|
|
37
37
|
diverging?: boolean;
|
|
38
38
|
/** Categorias em sequência (funil) numa rampa de um tom. */
|
|
39
39
|
ordinal?: boolean;
|
|
40
|
+
/** O título da dica de cada categoria, quando o eixo usa uma forma curta ("Jan" no eixo, "Janeiro de 2026" na dica). */
|
|
41
|
+
tooltipLabels?: string[];
|
|
40
42
|
}
|
|
41
43
|
/** Colunas e barras. https://lumeui.dev/#/graficos/barras */
|
|
42
44
|
export declare const BarChart: (props: BarChartProps) => import("react").JSX.Element;
|
|
@@ -55,6 +57,8 @@ export interface LineChartProps extends ChartBase {
|
|
|
55
57
|
label?: string;
|
|
56
58
|
};
|
|
57
59
|
zero?: boolean;
|
|
60
|
+
/** O título da dica de cada categoria, quando o eixo usa uma forma curta. */
|
|
61
|
+
tooltipLabels?: string[];
|
|
58
62
|
}
|
|
59
63
|
/** Linhas e áreas. Um eixo só. https://lumeui.dev/#/graficos/linhas */
|
|
60
64
|
export declare const LineChart: (props: LineChartProps) => import("react").JSX.Element;
|
package/react/Navigation.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export type MenuOption = {
|
|
|
6
6
|
icon?: IconName;
|
|
7
7
|
swatch?: string;
|
|
8
8
|
shortcut?: string;
|
|
9
|
+
/** Texto curto à direita, como uma contagem. */
|
|
10
|
+
meta?: string | number;
|
|
9
11
|
tone?: 'danger';
|
|
10
12
|
disabled?: boolean;
|
|
11
13
|
} | {
|
|
@@ -23,8 +25,10 @@ export interface MenuProps {
|
|
|
23
25
|
/** O valor escolhido, no modo radio. */
|
|
24
26
|
value?: string;
|
|
25
27
|
onChange: (value: string) => void;
|
|
26
|
-
/** Título pequeno no topo da lista. */
|
|
28
|
+
/** Título pequeno no topo da lista e nome do menu. */
|
|
27
29
|
label?: string;
|
|
30
|
+
/** Esconde o título: label fica só para o leitor de tela (menus de ações de uma linha). */
|
|
31
|
+
hideLabel?: boolean;
|
|
28
32
|
/** Lista longa vira grade: no máximo N itens por coluna. */
|
|
29
33
|
maxRows?: number;
|
|
30
34
|
/** Cada grupo abre uma coluna. */
|
|
@@ -37,11 +41,13 @@ export interface MenuProps {
|
|
|
37
41
|
* <Menu triggerRef={ref} options={…} value={ordem} onChange={setOrdem} />
|
|
38
42
|
* https://lumeui.dev/#/componentes/menu
|
|
39
43
|
*/
|
|
40
|
-
export declare function Menu({ triggerRef, options, mode, value, onChange, label, maxRows, sectionColumns }: MenuProps): null;
|
|
44
|
+
export declare function Menu({ triggerRef, options, mode, value, onChange, label, hideLabel, maxRows, sectionColumns }: MenuProps): null;
|
|
41
45
|
export interface TabItem {
|
|
42
46
|
id: string;
|
|
43
47
|
label: ReactNode;
|
|
44
48
|
icon?: IconName;
|
|
49
|
+
/** Contagem ao lado do rótulo ("Prontuário 8"). */
|
|
50
|
+
count?: number | string;
|
|
45
51
|
disabled?: boolean;
|
|
46
52
|
/** O conteúdo do painel. */
|
|
47
53
|
content: ReactNode;
|
|
@@ -76,13 +82,17 @@ export interface SegmentedControlProps {
|
|
|
76
82
|
onChange: (value: string) => void;
|
|
77
83
|
/** Nome do grupo para leitores de tela ("Visão"). */
|
|
78
84
|
label: string;
|
|
85
|
+
/** sm (32 px) para barras densas; md (36 px, padrão); lg (40 px) alinha com campos e botões médios. */
|
|
86
|
+
size?: 'sm' | 'md' | 'lg';
|
|
87
|
+
/** Ocupa a largura toda, com as opções dividindo o espaço por igual (como fill nas Abas). */
|
|
88
|
+
fill?: boolean;
|
|
79
89
|
className?: string;
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
82
92
|
* Poucas opções lado a lado, uma escolhida, com efeito na hora. As setas trocam a opção.
|
|
83
93
|
* https://lumeui.dev/#/componentes/controle-segmentado
|
|
84
94
|
*/
|
|
85
|
-
export declare function SegmentedControl({ options, value, onChange, label, className }: SegmentedControlProps): import("react").JSX.Element;
|
|
95
|
+
export declare function SegmentedControl({ options, value, onChange, label, size, fill, className }: SegmentedControlProps): import("react").JSX.Element;
|
|
86
96
|
export interface PaginationProps {
|
|
87
97
|
/** Total de itens. */
|
|
88
98
|
total: number;
|
package/react/Navigation.js
CHANGED
|
@@ -17,20 +17,20 @@ import { cx } from './cx.js';
|
|
|
17
17
|
* <Menu triggerRef={ref} options={…} value={ordem} onChange={setOrdem} />
|
|
18
18
|
* https://lumeui.dev/#/componentes/menu
|
|
19
19
|
*/
|
|
20
|
-
export function Menu({ triggerRef, options, mode, value, onChange, label, maxRows, sectionColumns }) {
|
|
20
|
+
export function Menu({ triggerRef, options, mode, value, onChange, label, hideLabel, maxRows, sectionColumns }) {
|
|
21
21
|
const change = useLatest(onChange);
|
|
22
22
|
const api = useRef(null);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
if (!triggerRef.current)
|
|
25
25
|
return;
|
|
26
|
-
const c = createMenu(triggerRef.current, defined({ options, mode, value, label, maxRows, sectionColumns, onChange: (v) => change.current(v) }));
|
|
26
|
+
const c = createMenu(triggerRef.current, defined({ options, mode, value, label, hideLabel, maxRows, sectionColumns, onChange: (v) => change.current(v) }));
|
|
27
27
|
api.current = c;
|
|
28
28
|
return () => {
|
|
29
29
|
c.destroy();
|
|
30
30
|
api.current = null;
|
|
31
31
|
};
|
|
32
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
-
}, [triggerRef, stableKey(options), mode, label, maxRows, sectionColumns]);
|
|
33
|
+
}, [triggerRef, stableKey(options), mode, label, hideLabel, maxRows, sectionColumns]);
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
if (api.current && value !== undefined && api.current.value !== value)
|
|
36
36
|
api.current.setValue(value);
|
|
@@ -55,13 +55,13 @@ export function Tabs({ items, value, onChange, label, look = 'underline', size =
|
|
|
55
55
|
onChange(tab.id);
|
|
56
56
|
list.current?.querySelector(`#${id}-tab-${tab.id}`)?.focus();
|
|
57
57
|
};
|
|
58
|
-
return (_jsxs("div", { className: cx('ds-tabs', look === 'segmented' && 'ds-tabs--segmented', size === 'sm' && 'ds-tabs--sm', fill && 'ds-tabs--fill', className), children: [_jsx("div", { ref: list, className: "ds-tabs__list", role: "tablist", "aria-label": label, onKeyDown: onKey, children: items.map((t) => (_jsxs("button", { type: "button", className: "ds-tabs__tab", role: "tab", id: `${id}-tab-${t.id}`, "aria-controls": `${id}-panel-${t.id}`, "aria-selected": t.id === value, tabIndex: t.id === value ? 0 : -1, disabled: t.disabled, onClick: () => onChange(t.id), children: [t.icon && _jsx(Icon, { name: t.icon, size: 16 }), t.label] }, t.id))) }), items.map((t) => (_jsx("div", { className: "ds-tabs__panel", role: "tabpanel", id: `${id}-panel-${t.id}`, "aria-labelledby": `${id}-tab-${t.id}`, tabIndex: 0, hidden: t.id !== value, children: t.id === value && t.content }, t.id)))] }));
|
|
58
|
+
return (_jsxs("div", { className: cx('ds-tabs', look === 'segmented' && 'ds-tabs--segmented', size === 'sm' && 'ds-tabs--sm', fill && 'ds-tabs--fill', className), children: [_jsx("div", { ref: list, className: "ds-tabs__list", role: "tablist", "aria-label": label, onKeyDown: onKey, children: items.map((t) => (_jsxs("button", { type: "button", className: "ds-tabs__tab", role: "tab", id: `${id}-tab-${t.id}`, "aria-controls": `${id}-panel-${t.id}`, "aria-selected": t.id === value, tabIndex: t.id === value ? 0 : -1, disabled: t.disabled, onClick: () => onChange(t.id), children: [t.icon && _jsx(Icon, { name: t.icon, size: 16 }), t.label, t.count !== undefined && t.count !== null && _jsx("span", { className: "ds-tabs__count", children: t.count })] }, t.id))) }), items.map((t) => (_jsx("div", { className: "ds-tabs__panel", role: "tabpanel", id: `${id}-panel-${t.id}`, "aria-labelledby": `${id}-tab-${t.id}`, tabIndex: 0, hidden: t.id !== value, children: t.id === value && t.content }, t.id)))] }));
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Poucas opções lado a lado, uma escolhida, com efeito na hora. As setas trocam a opção.
|
|
62
62
|
* https://lumeui.dev/#/componentes/controle-segmentado
|
|
63
63
|
*/
|
|
64
|
-
export function SegmentedControl({ options, value, onChange, label, className }) {
|
|
64
|
+
export function SegmentedControl({ options, value, onChange, label, size = 'md', fill, className }) {
|
|
65
65
|
const root = useRef(null);
|
|
66
66
|
const onKey = (event) => {
|
|
67
67
|
const delta = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key];
|
|
@@ -74,7 +74,7 @@ export function SegmentedControl({ options, value, onChange, label, className })
|
|
|
74
74
|
onChange(next.value);
|
|
75
75
|
root.current?.querySelector(`[data-value="${CSS.escape(next.value)}"]`)?.focus();
|
|
76
76
|
};
|
|
77
|
-
return (_jsx("div", { ref: root, className: cx('ds-segmented', className), role: "radiogroup", "aria-label": label, onKeyDown: onKey, children: options.map((o) => (_jsxs("button", { type: "button", className: "ds-segmented__item", role: "radio", "data-value": o.value, "aria-checked": o.value === value, tabIndex: o.value === value ? 0 : -1, disabled: o.disabled, onClick: () => onChange(o.value), children: [o.icon && _jsx(Icon, { name: o.icon, size: 16 }), o.label] }, o.value))) }));
|
|
77
|
+
return (_jsx("div", { ref: root, className: cx('ds-segmented', size !== 'md' && `ds-segmented--${size}`, fill && 'ds-segmented--fill', className), role: "radiogroup", "aria-label": label, onKeyDown: onKey, children: options.map((o) => (_jsxs("button", { type: "button", className: "ds-segmented__item", role: "radio", "data-value": o.value, "aria-checked": o.value === value, tabIndex: o.value === value ? 0 : -1, disabled: o.disabled, onClick: () => onChange(o.value), children: [o.icon && _jsx(Icon, { name: o.icon, size: 16 }), o.label] }, o.value))) }));
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Páginas de uma lista, com total e itens por página. Em telas estreitas, vira "3 de 25".
|