@joniguerini/lume 1.9.2 → 1.11.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.
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Campo de busca — a lupa, o × para limpar quando há texto, Esc que limpa e, se quiser, uma tecla que
3
+ * leva o foco ao campo de qualquer lugar da página (a tecla aparece no campo enquanto ele está vazio).
4
+ *
5
+ * <div class="ds-field ds-search">
6
+ * <ds-icon name="search" size="18"></ds-icon>
7
+ * <input class="ds-field__input" id="busca" type="search" aria-label="Buscar clientes" placeholder="Buscar">
8
+ * </div>
9
+ *
10
+ * const busca = createSearchField(document.querySelector('#busca'), {
11
+ * shortcut: '/', // opcional: uma tecla sem modificador
12
+ * onChange: (value) => …, // a cada letra e ao limpar
13
+ * });
14
+ * busca.value; busca.setValue('ana'); busca.clear(); busca.focus(); busca.destroy();
15
+ *
16
+ * A tecla não dispara enquanto a pessoa digita em outro campo. Esc limpa só quando há texto; com o campo
17
+ * vazio, o Esc segue adiante (fecha o painel em volta, por exemplo).
18
+ */
19
+ import { icon } from '../icons/icons.js';
20
+ import { msg } from './i18n.js';
21
+
22
+ const typing = (target) =>
23
+ target instanceof HTMLElement && (target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName));
24
+
25
+ export function createSearchField(input, { shortcut, onChange } = {}) {
26
+ const field = input.closest('.ds-field');
27
+ field?.classList.add('ds-search');
28
+
29
+ const clearBtn = document.createElement('button');
30
+ clearBtn.type = 'button';
31
+ clearBtn.className = 'ds-icon-btn ds-icon-btn--sm ds-icon-btn--muted ds-field__action';
32
+ clearBtn.innerHTML = icon('x', { size: 16 });
33
+ input.after(clearBtn);
34
+
35
+ let kbd = null;
36
+ if (shortcut) {
37
+ kbd = document.createElement('kbd');
38
+ kbd.className = 'ds-kbd ds-search__kbd';
39
+ kbd.textContent = shortcut;
40
+ kbd.setAttribute('aria-hidden', 'true');
41
+ clearBtn.after(kbd);
42
+ input.setAttribute('aria-keyshortcuts', shortcut);
43
+ }
44
+
45
+ function sync() {
46
+ const empty = !input.value;
47
+ clearBtn.hidden = empty || input.disabled;
48
+ if (kbd) kbd.hidden = !empty;
49
+ clearBtn.setAttribute('aria-label', msg('search.clear'));
50
+ }
51
+
52
+ function emit() {
53
+ sync();
54
+ onChange?.(input.value);
55
+ }
56
+
57
+ // limpar avisa como se a pessoa tivesse apagado: o evento input chega a quem escuta o campo (e ao onChange)
58
+ function clear() {
59
+ if (!input.value) return;
60
+ input.value = '';
61
+ input.dispatchEvent(new Event('input', { bubbles: true }));
62
+ }
63
+
64
+ const onInput = () => emit();
65
+ const onKey = (event) => {
66
+ if (event.key === 'Escape' && input.value) {
67
+ event.preventDefault();
68
+ event.stopPropagation();
69
+ clear();
70
+ }
71
+ };
72
+ const onClear = () => {
73
+ clear();
74
+ input.focus();
75
+ };
76
+ const onDocKey = (event) => {
77
+ if (event.key !== shortcut || event.metaKey || event.ctrlKey || event.altKey || event.defaultPrevented || typing(event.target)) return;
78
+ if (input.disabled || !input.isConnected || input.getClientRects().length === 0) return;
79
+ event.preventDefault();
80
+ input.focus();
81
+ input.select();
82
+ };
83
+ const onLocale = () => sync();
84
+
85
+ input.addEventListener('input', onInput);
86
+ input.addEventListener('keydown', onKey);
87
+ clearBtn.addEventListener('click', onClear);
88
+ if (shortcut) document.addEventListener('keydown', onDocKey);
89
+ document.documentElement.addEventListener('ds:localechange', onLocale);
90
+ sync();
91
+
92
+ return {
93
+ el: input,
94
+ get value() {
95
+ return input.value;
96
+ },
97
+ setValue(next) {
98
+ input.value = next ?? '';
99
+ sync();
100
+ },
101
+ clear,
102
+ focus: () => input.focus(),
103
+ destroy() {
104
+ input.removeEventListener('input', onInput);
105
+ input.removeEventListener('keydown', onKey);
106
+ clearBtn.removeEventListener('click', onClear);
107
+ document.removeEventListener('keydown', onDocKey);
108
+ document.documentElement.removeEventListener('ds:localechange', onLocale);
109
+ input.removeAttribute('aria-keyshortcuts');
110
+ clearBtn.remove();
111
+ kbd?.remove();
112
+ field?.classList.remove('ds-search');
113
+ },
114
+ };
115
+ }
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, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
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, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
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
- <span class="ds-toast__message">${escape(message)}</span>
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' } = {}) => `ds-toast${tone !== 'neutral' ? ` ds-toast--${tone}` : ''}`;
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.9.2 · MIT · https://lumeui.dev */
1
+ /* Lume Design System 1.11.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.
@@ -1344,6 +1344,55 @@ ds-icon {
1344
1344
  width: 100%;
1345
1345
  }
1346
1346
 
1347
+ /*
1348
+ * Botão dividido — a ação principal e, colada nela, a seta que abre as alternativas (createMenu).
1349
+ * <div class="ds-split-button">
1350
+ * <button type="button" class="ds-btn ds-btn--primary">Novo atendimento</button>
1351
+ * <button type="button" class="ds-btn ds-btn--primary ds-split-button__menu" aria-label="Mais opções"><ds-icon name="chevron-down"></ds-icon></button>
1352
+ * </div>
1353
+ * Os dois botões levam a mesma variante e o mesmo tamanho. Um fio na cor do fundo separa os dois.
1354
+ */
1355
+ .ds-split-button {
1356
+ display: inline-flex;
1357
+ isolation: isolate;
1358
+ }
1359
+
1360
+ .ds-split-button > .ds-btn:first-child {
1361
+ border-start-end-radius: 0;
1362
+ border-end-end-radius: 0;
1363
+ }
1364
+
1365
+ .ds-split-button > .ds-split-button__menu {
1366
+ width: var(--_h);
1367
+ padding-inline: 0;
1368
+ margin-inline-start: -1px;
1369
+ border-start-start-radius: 0;
1370
+ border-end-start-radius: 0;
1371
+ }
1372
+
1373
+ /* nas variantes com fundo, o fio entre os dois é a cor da superfície; nas de contorno, o próprio contorno */
1374
+ .ds-split-button > .ds-split-button__menu:is(.ds-btn--primary, .ds-btn--danger, .ds-btn--subtle) {
1375
+ margin-inline-start: 1px;
1376
+ }
1377
+
1378
+ .ds-split-button > .ds-btn:is(:hover, :focus-visible, [data-state="hover"], [data-state="focus"]) {
1379
+ z-index: 1;
1380
+ }
1381
+
1382
+ .ds-split-button > .ds-split-button__menu .ds-icon {
1383
+ transition: transform var(--ds-duration-base) var(--ds-easing-emphasized);
1384
+ }
1385
+
1386
+ .ds-split-button > .ds-split-button__menu[aria-expanded="true"] .ds-icon {
1387
+ transform: rotate(180deg);
1388
+ }
1389
+
1390
+ @media (prefers-reduced-motion: reduce) {
1391
+ .ds-split-button > .ds-split-button__menu .ds-icon {
1392
+ transition: none;
1393
+ }
1394
+ }
1395
+
1347
1396
  /* ───────── Botão de ícone ───────── */
1348
1397
 
1349
1398
  .ds-icon-btn {
@@ -1951,6 +2000,8 @@ ds-icon {
1951
2000
 
1952
2001
  .ds-segmented__item {
1953
2002
  display: inline-grid;
2003
+ grid-auto-flow: column;
2004
+ gap: var(--ds-space-075);
1954
2005
  place-items: center;
1955
2006
  min-width: 28px;
1956
2007
  height: var(--ds-size-control-xs);
@@ -1964,6 +2015,31 @@ ds-icon {
1964
2015
  box-shadow var(--ds-duration-base) var(--ds-easing-standard);
1965
2016
  }
1966
2017
 
2018
+ /* Tamanhos pela altura total (trilho + item): sm 32 · md 36 (padrão) · lg 40, que alinha com campos e botões médios */
2019
+ .ds-segmented--sm .ds-segmented__item {
2020
+ min-width: 24px;
2021
+ height: calc(var(--ds-size-control-sm) - 8px);
2022
+ padding-inline: var(--ds-space-075);
2023
+ font: var(--ds-text-label-sm);
2024
+ }
2025
+
2026
+ .ds-segmented--lg .ds-segmented__item {
2027
+ min-width: 32px;
2028
+ height: calc(var(--ds-size-control-md) - 8px);
2029
+ padding-inline: var(--ds-space-150);
2030
+ }
2031
+
2032
+ /* Largura toda: as opções dividem o espaço por igual */
2033
+ .ds-segmented--fill {
2034
+ display: flex;
2035
+ width: 100%;
2036
+ }
2037
+
2038
+ .ds-segmented--fill .ds-segmented__item {
2039
+ flex: 1;
2040
+ min-width: 0;
2041
+ }
2042
+
1967
2043
  .ds-segmented__item:hover,
1968
2044
  .ds-segmented__item[data-state="hover"] {
1969
2045
  color: var(--ds-color-fg-default);
@@ -2149,6 +2225,71 @@ ds-icon {
2149
2225
  margin-inline-start: calc(-1 * var(--ds-space-150) + 2px);
2150
2226
  }
2151
2227
 
2228
+ /* símbolo depois do valor (moeda em espanhol: "12,50 €") */
2229
+ .ds-field__input + .ds-field__affix {
2230
+ margin-inline-start: calc(-1 * var(--ds-space-150) + 2px);
2231
+ }
2232
+
2233
+ /*
2234
+ * Campo de dinheiro (ds/js/currency-field.js): o valor alinha à direita, como numa coluna de valores,
2235
+ * e os algarismos têm a mesma largura.
2236
+ */
2237
+ .ds-currency .ds-field__input {
2238
+ font-variant-numeric: tabular-nums;
2239
+ }
2240
+
2241
+ /*
2242
+ * Campo de busca (ds/js/search-field.js): a lupa, o × quando há texto e a tecla de atalho quando está vazio.
2243
+ * O × nativo do type="search" sai: o do Lume tem nome e o mesmo desenho dos outros campos.
2244
+ */
2245
+ .ds-search .ds-field__input::-webkit-search-cancel-button,
2246
+ .ds-search .ds-field__input::-webkit-search-decoration {
2247
+ appearance: none;
2248
+ }
2249
+
2250
+ .ds-search__kbd {
2251
+ flex: none;
2252
+ margin-inline-end: calc(-1 * var(--ds-space-050));
2253
+ }
2254
+
2255
+ /*
2256
+ * Grupo de campos — um rótulo, uma dica e um erro para vários controles ("Quando": data e dois horários).
2257
+ * <div class="ds-form-field ds-field-group" role="group" aria-labelledby="quando-label" aria-describedby="quando-hint">
2258
+ * <span class="ds-form-field__label" id="quando-label">Quando</span>
2259
+ * <div class="ds-field-group__controls">…controles, cada um com o próprio aria-label…</div>
2260
+ * <div class="ds-form-field__footer"><p class="ds-form-field__hint" id="quando-hint">Dica</p></div>
2261
+ * </div>
2262
+ */
2263
+ .ds-field-group__controls {
2264
+ display: flex;
2265
+ flex-wrap: wrap;
2266
+ align-items: center;
2267
+ gap: var(--ds-space-100);
2268
+ min-width: 0;
2269
+ }
2270
+
2271
+ /* o primeiro controle ocupa o dobro dos outros (a data e os horários); todos quebram a linha quando falta espaço.
2272
+ Sem min-width: 0, o input largo por natureza empurraria os vizinhos para a linha de baixo. */
2273
+ .ds-field-group__controls > * {
2274
+ flex: 1 1 120px;
2275
+ min-width: 0;
2276
+ }
2277
+
2278
+ .ds-field-group__controls > :first-child {
2279
+ flex: 2 1 160px;
2280
+ }
2281
+
2282
+ /* com --even, todos dividem a linha por igual (nome e sobrenome) */
2283
+ .ds-field-group--even .ds-field-group__controls > * {
2284
+ flex: 1 1 0;
2285
+ }
2286
+
2287
+ .ds-field-group__controls > .ds-field-group__sep {
2288
+ flex: none;
2289
+ color: var(--ds-color-fg-subtle);
2290
+ font: var(--ds-text-body-sm);
2291
+ }
2292
+
2152
2293
  @media (max-width: 639.98px) {
2153
2294
  .ds-form__row,
2154
2295
  .ds-form__row--3 {
@@ -6182,6 +6323,19 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
6182
6323
  background: var(--ds-color-border-subtle);
6183
6324
  }
6184
6325
 
6326
+ /* meta: texto curto à direita (uma contagem); com a marca do modo radio, fica antes dela */
6327
+ .ds-menu__meta {
6328
+ margin-inline-start: auto;
6329
+ padding-inline-start: var(--ds-space-200);
6330
+ color: var(--ds-color-fg-subtle);
6331
+ font: var(--ds-text-caption);
6332
+ font-variant-numeric: tabular-nums;
6333
+ }
6334
+
6335
+ .ds-menu__meta + .ds-menu__check {
6336
+ margin-inline-start: var(--ds-space-100);
6337
+ }
6338
+
6185
6339
  .ds-menu__shortcut {
6186
6340
  margin-inline-start: auto;
6187
6341
  padding-inline-start: var(--ds-space-200);
@@ -6222,6 +6376,7 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
6222
6376
  * Toast — aviso curto e passageiro (ds/js/toast.js)
6223
6377
  * tons: --success --warning --danger --info (neutro é o padrão)
6224
6378
  * partes: __icon, __message, __action (opcional), __close (quando dura até fechar)
6379
+ * com descrição (--stacked): __message guarda __title e __description, em duas linhas
6225
6380
  * regiões: .ds-toast-region--{top|bottom}-{start|center|end}, uma por posição
6226
6381
  * recuos ajustáveis: --ds-toast-offset-top (abaixo da topbar), --ds-toast-offset-bottom, --ds-toast-offset-inline
6227
6382
  */
@@ -6325,6 +6480,41 @@ button.ds-stepper__content[data-state="hover"] .ds-stepper__label {
6325
6480
  white-space: nowrap;
6326
6481
  }
6327
6482
 
6483
+ /* Título e descrição: duas linhas, o ícone e os botões alinham com o título */
6484
+ .ds-toast--stacked {
6485
+ align-items: flex-start;
6486
+ min-width: min(280px, 100%);
6487
+ padding-block: var(--ds-space-150);
6488
+ }
6489
+
6490
+ .ds-toast--stacked .ds-toast__message {
6491
+ display: grid;
6492
+ gap: 2px;
6493
+ white-space: normal;
6494
+ }
6495
+
6496
+ .ds-toast__title {
6497
+ overflow: hidden;
6498
+ text-overflow: ellipsis;
6499
+ white-space: nowrap;
6500
+ }
6501
+
6502
+ .ds-toast__description {
6503
+ font: var(--ds-text-body-sm);
6504
+ letter-spacing: var(--ds-text-body-sm-tracking);
6505
+ opacity: 0.72;
6506
+ overflow-wrap: anywhere;
6507
+ }
6508
+
6509
+ /* a primeira linha tem 20 px: ícone, ação e fechar descem para o meio dela */
6510
+ .ds-toast--stacked .ds-toast__icon {
6511
+ min-height: 20px;
6512
+ }
6513
+
6514
+ .ds-toast--stacked :is(.ds-toast__action, .ds-toast__close) {
6515
+ margin-block: -4px;
6516
+ }
6517
+
6328
6518
  .ds-toast code {
6329
6519
  font: var(--ds-text-code-sm);
6330
6520
  }
@@ -9391,12 +9581,19 @@ button.ds-calendar__col-head[data-state="hover"] {
9391
9581
  to { transform: rotate(1turn); }
9392
9582
  }
9393
9583
 
9394
- /* Botão ocupado: <button class="ds-btn" aria-busy="true"><span class="ds-spinner ds-spinner--sm"></span>Salvando</button> */
9584
+ /*
9585
+ * Botão ocupado: <button class="ds-btn" aria-busy="true" aria-disabled="true"><span class="ds-spinner ds-spinner--sm"></span>Salvando</button>
9586
+ * Fica indisponível (sem segundo clique) mas não esmaece: o spinner já diz que está trabalhando.
9587
+ */
9395
9588
  .ds-btn[aria-busy="true"] {
9396
9589
  cursor: progress;
9397
9590
  pointer-events: none;
9398
9591
  }
9399
9592
 
9593
+ .ds-btn[aria-busy="true"][aria-disabled="true"] {
9594
+ opacity: 1;
9595
+ }
9596
+
9400
9597
  /*
9401
9598
  * Skeleton — a forma do conteúdo antes de ele chegar: formas lisas que pulsam devagar, sem brilho.
9402
9599
  * <div aria-busy="true" aria-label="Carregando"><div class="ds-skeleton ds-skeleton--text" style="--w:60%"></div></div>
@@ -10683,6 +10880,19 @@ button.ds-calendar__col-head[data-state="hover"] {
10683
10880
  transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
10684
10881
  }
10685
10882
 
10883
+ /* contagem à direita do rótulo: número apagado, sem pílula (o rótulo continua mandando) */
10884
+ .ds-nav-item__count {
10885
+ flex: none;
10886
+ color: var(--ds-color-fg-subtle);
10887
+ font: var(--ds-text-caption);
10888
+ font-variant-numeric: tabular-nums;
10889
+ transition: opacity var(--ds-duration-base) var(--ds-easing-standard);
10890
+ }
10891
+
10892
+ .ds-nav-item[aria-current="page"] .ds-nav-item__count {
10893
+ color: var(--ds-color-fg-muted);
10894
+ }
10895
+
10686
10896
  .ds-nav-item > .ds-dot {
10687
10897
  margin-inline-end: 4px;
10688
10898
  transition: translate var(--_dur) var(--_ease);
@@ -11013,6 +11223,12 @@ button.ds-account {
11013
11223
  color: var(--ds-color-fg-default);
11014
11224
  }
11015
11225
 
11226
+ .ds-navbar__count {
11227
+ color: var(--ds-color-fg-subtle);
11228
+ font: var(--ds-text-caption);
11229
+ font-variant-numeric: tabular-nums;
11230
+ }
11231
+
11016
11232
  .ds-navbar__item > .ds-dot {
11017
11233
  margin-inline-start: 2px;
11018
11234
  }
@@ -11170,6 +11386,7 @@ button.ds-account {
11170
11386
  .ds-sidebar-search .ds-field__placeholder,
11171
11387
  .ds-sidebar-search__kbd,
11172
11388
  .ds-nav-item__label,
11389
+ .ds-nav-item__count,
11173
11390
  .ds-nav-group__label,
11174
11391
  .ds-nav-group__toggle,
11175
11392
  .ds-account__text,
@@ -11200,6 +11417,11 @@ button.ds-account {
11200
11417
  visibility: visible;
11201
11418
  }
11202
11419
 
11420
+ /* recolhida: a contagem sai do fluxo, para o ícone não sair do lugar */
11421
+ .ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item__count {
11422
+ position: absolute;
11423
+ }
11424
+
11203
11425
  .ds-shell[data-sidebar="collapsed"] > .ds-sidebar .ds-nav-item > .ds-dot {
11204
11426
  position: absolute;
11205
11427
  top: 9px;
package/lume.d.ts CHANGED
@@ -69,6 +69,9 @@ export declare const openModal: any;
69
69
  export declare const confirmModal: any;
70
70
  export declare const modalHtml: any;
71
71
  export declare const createNumberField: any;
72
+ export declare const createCurrencyField: any;
73
+ export declare const createPasswordField: any;
74
+ export declare const createSearchField: any;
72
75
  export declare const createOtpField: any;
73
76
  export declare const createPagination: any;
74
77
  export declare const createPopover: any;
package/lume.js CHANGED
@@ -49,6 +49,9 @@ export {
49
49
  export { createMenu } from './js/menu.js';
50
50
  export { createModal, openModal, confirmModal, modalHtml } from './js/modal.js';
51
51
  export { createNumberField } from './js/number-field.js';
52
+ export { createCurrencyField } from './js/currency-field.js';
53
+ export { createPasswordField } from './js/password-field.js';
54
+ export { createSearchField } from './js/search-field.js';
52
55
  export { createOtpField } from './js/otp-field.js';
53
56
  export { createPagination } from './js/pagination.js';
54
57
  export { createPopover } from './js/popover.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joniguerini/lume",
3
- "version": "1.9.2",
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.",
3
+ "version": "1.11.0",
4
+ "description": "Lume Design System: tokens, 154 icons, 66 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",
7
7
  "types": "./lume.d.ts",
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. Depois de uma ação urgente, passe role="alert"; o resto, role="status".
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. Depois de uma ação urgente, passe role="alert"; o resto, role="status".
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
  }
@@ -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
@@ -1,5 +1,6 @@
1
1
  import { type AnchorHTMLAttributes, type ButtonHTMLAttributes } from 'react';
2
2
  import { type IconName } from './Icon.js';
3
+ import { type MenuOption } from './Navigation.js';
3
4
  export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'subtle' | 'danger';
4
5
  export type ButtonSize = 'sm' | 'md' | 'lg';
5
6
  interface ButtonLook {
@@ -17,7 +18,10 @@ interface ButtonLook {
17
18
  block?: boolean;
18
19
  }
19
20
  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
+ /**
22
+ * Ocupado: mostra o spinner no lugar do ícone, marca aria-busy e fica indisponível (aria-disabled),
23
+ * sem perder o foco: o clique e o envio do formulário não disparam de novo. Troque o rótulo ("Salvando").
24
+ */
21
25
  busy?: boolean;
22
26
  }
23
27
  /**
@@ -29,4 +33,29 @@ export interface ButtonLinkProps extends ButtonLook, AnchorHTMLAttributes<HTMLAn
29
33
  }
30
34
  /** O mesmo visual do Botão, para navegar: vira um link (<a>), com o teclado e o leitor de tela de um link. */
31
35
  export declare const ButtonLink: import("react").ForwardRefExoticComponent<ButtonLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
36
+ export interface SplitButtonProps {
37
+ /** O rótulo da ação principal, com verbo ("Novo atendimento"). */
38
+ label: string;
39
+ icon?: IconName;
40
+ /** A ação principal. */
41
+ onClick: () => void;
42
+ /** As alternativas, no menu da seta (modo ação: separador e tone: 'danger' valem). */
43
+ options: MenuOption[];
44
+ /** Chamado com o value da alternativa escolhida. */
45
+ onSelect: (value: string) => void;
46
+ /** Nome da seta e do menu para o leitor de tela. Padrão: "Mais opções". */
47
+ menuLabel?: string;
48
+ /** Padrão: primary. Ghost não entra: sem contorno, as duas metades não se leem como uma peça. */
49
+ variant?: Exclude<ButtonVariant, 'ghost'>;
50
+ size?: ButtonSize;
51
+ disabled?: boolean;
52
+ /** A ação principal está em andamento: o spinner entra nela e a seta fica indisponível. */
53
+ busy?: boolean;
54
+ className?: string;
55
+ }
56
+ /**
57
+ * A ação principal e, colada nela, a seta com as alternativas ("Novo atendimento ▾").
58
+ * https://lumeui.dev/#/componentes/botao-dividido
59
+ */
60
+ export declare function SplitButton({ label, icon, onClick, options, onSelect, menuLabel, variant, size, disabled, busy, className, }: SplitButtonProps): import("react").JSX.Element;
32
61
  export {};