@wellingtonhlc/shared-ui 0.25.2 → 0.25.4

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 CHANGED
@@ -221,6 +221,29 @@ import { Bell, Settings } from 'lucide-react';
221
221
  </AppShell.Actions>
222
222
  ```
223
223
 
224
+ ## TabsUnderlined
225
+
226
+ `TabsUnderlined` renderiza abas sublinhadas com conteudo controlado ou nao controlado.
227
+ As abas ja possuem tamanho minimo padrao e padding horizontal para comportar labels
228
+ medias, como `Configuracoes` e `Fornecedor`, sem ficarem apertadas.
229
+
230
+ Quando houver labels longas, use `tabWidth` e `truncateLabels` para manter abas
231
+ uniformes e aplicar ellipsis no texto que exceder o limite.
232
+
233
+ ```tsx
234
+ import { TabsUnderlined } from '@wellingtonhlc/shared-ui';
235
+
236
+ <TabsUnderlined
237
+ items={items}
238
+ tabWidth="12rem"
239
+ truncateLabels
240
+ />;
241
+ ```
242
+
243
+ Quando a largura puder variar dentro de uma faixa, use `tabMinWidth` e `tabMaxWidth`.
244
+ `truncateLabels` nao altera o comportamento sozinho; defina tambem `tabWidth` ou
245
+ `tabMaxWidth` para que o navegador saiba quando abreviar o texto.
246
+
224
247
  ## ThemePreferencesSelector
225
248
 
226
249
  `ThemePreferencesSelector` centraliza a escolha de cor e aparencia (`system`, `light`, `dark`) usada pelos consumidores.
@@ -8,7 +8,7 @@ export function EmptyState({ title = 'Nada por aqui.', description, icon = _jsx(
8
8
  className: cn('h-10 w-10 text-foreground-muted', icon.props.className),
9
9
  })
10
10
  : icon;
11
- return (_jsx("div", { className: cn('flex min-h-0 w-full items-center justify-center rounded-md border border-dashed bg-surface text-center text-foreground-muted', isCompact ? 'px-4 py-6' : 'h-full flex-1 px-5 py-10', withMargin && 'm-2', className), children: _jsxs("div", { className: cn('mx-auto grid justify-items-center', isCompact ? 'max-w-xs gap-1.5' : 'max-w-sm gap-2'), children: [showIcon && styledIcon ? (_jsx("div", { className: "text-foreground-muted mb-1 flex h-11 w-11 items-center justify-center", children: styledIcon })) : null, _jsx("strong", { className: "text-foreground text-sm font-semibold", children: title }), description ? _jsx("p", { className: "text-foreground-muted text-xs leading-5", children: description }) : null, children ? _jsx("div", { className: cn('mt-2 flex flex-wrap items-center justify-center gap-2', isCompact ? 'text-xs' : 'text-sm'), children: children }) : null] }) }));
11
+ return (_jsx("div", { className: cn('flex min-h-0 w-full items-center justify-center rounded-md border border-dashed border-[color-mix(in_srgb,var(--foreground-muted)_24%,transparent)] bg-surface text-center text-foreground-muted', isCompact ? 'px-4 py-6' : 'h-full flex-1 px-5 py-10', withMargin && 'm-2', className), children: _jsxs("div", { className: cn('mx-auto grid justify-items-center', isCompact ? 'max-w-xs gap-1.5' : 'max-w-sm gap-2'), children: [showIcon && styledIcon ? (_jsx("div", { className: "text-foreground-muted mb-1 flex h-11 w-11 items-center justify-center", children: styledIcon })) : null, _jsx("strong", { className: "text-foreground text-sm font-semibold", children: title }), description ? _jsx("p", { className: "text-foreground-muted text-xs leading-5", children: description }) : null, children ? _jsx("div", { className: cn('mt-2 flex flex-wrap items-center justify-center gap-2', isCompact ? 'text-xs' : 'text-sm'), children: children }) : null] }) }));
12
12
  }
13
13
  function DefaultEmptyIcon() {
14
14
  return (_jsx("svg", { "aria-hidden": "true", className: "h-10 w-10", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: "1.8", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.75 8.75 6.2 5.4A2 2 0 0 1 7.82 4.6h8.36a2 2 0 0 1 1.62.8l2.45 3.35M3.75 8.75v6.9A3.75 3.75 0 0 0 7.5 19.4h9a3.75 3.75 0 0 0 3.75-3.75v-6.9M3.75 8.75h4.92a1.5 1.5 0 0 1 1.34.83l.28.56a1.5 1.5 0 0 0 1.34.83h.74a1.5 1.5 0 0 0 1.34-.83l.28-.56a1.5 1.5 0 0 1 1.34-.83h4.92" }) }));
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  export interface UnderlinedTabItem {
3
3
  id: string;
4
4
  label: string;
@@ -14,6 +14,10 @@ export interface TabsUnderlinedProps {
14
14
  listClassName?: string;
15
15
  triggerClassName?: string;
16
16
  contentClassName?: string;
17
+ tabWidth?: CSSProperties['width'];
18
+ tabMinWidth?: CSSProperties['minWidth'];
19
+ tabMaxWidth?: CSSProperties['maxWidth'];
20
+ truncateLabels?: boolean;
17
21
  }
18
- export declare function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, triggerClassName, value, }: TabsUnderlinedProps): import("react").JSX.Element;
22
+ export declare function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, tabMaxWidth, tabMinWidth, tabWidth, triggerClassName, truncateLabels, value, }: TabsUnderlinedProps): import("react").JSX.Element;
19
23
  //# sourceMappingURL=TabsUnderlined.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TabsUnderlined.d.ts","sourceRoot":"","sources":["../../src/components/TabsUnderlined.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM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AmB,+BA2DrB"}
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import * as Tabs from '@radix-ui/react-tabs';
4
4
  import { cn } from '../utils/cn';
5
- export function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, triggerClassName, value, }) {
5
+ const DEFAULT_TAB_MIN_WIDTH = '8.75rem';
6
+ export function TabsUnderlined({ className, contentClassName, defaultValue, items, listClassName, onValueChange, tabMaxWidth, tabMinWidth, tabWidth, triggerClassName, truncateLabels = false, value, }) {
6
7
  const visibleItems = useMemo(() => items.filter((item) => item.visible ?? true), [items]);
7
8
  const initialValue = defaultValue && visibleItems.some((item) => item.id === defaultValue)
8
9
  ? defaultValue
@@ -13,8 +14,13 @@ export function TabsUnderlined({ className, contentClassName, defaultValue, item
13
14
  setInternalValue(nextValue);
14
15
  onValueChange?.(nextValue);
15
16
  }
16
- return (_jsx("div", { className: cn('border-app-border bg-surface flex h-full flex-col rounded-xl border', className), children: _jsxs(Tabs.Root, { value: resolvedValue, onValueChange: handleValueChange, className: "flex flex-1 flex-col", children: [_jsx(Tabs.List, { className: cn('border-app-border flex gap-1 border-b bg-[color-mix(in_srgb,var(--foreground-muted)_5%,var(--surface))] text-sm', listClassName), children: visibleItems.map((item) => (_jsx(TabTrigger, { value: item.id, className: triggerClassName, children: item.label }, item.id))) }), visibleItems.map((item) => (_jsx(Tabs.Content, { value: item.id, className: cn('flex h-full flex-1 flex-col overflow-hidden', contentClassName), children: item.children }, item.id)))] }) }));
17
+ return (_jsx("div", { className: cn('border-app-border bg-surface flex h-full min-w-0 flex-col overflow-hidden rounded-xl border', className), children: _jsxs(Tabs.Root, { value: resolvedValue, onValueChange: handleValueChange, className: "flex min-w-0 flex-1 flex-col", children: [_jsx(Tabs.List, { className: cn('border-app-border flex min-w-0 overflow-x-auto overflow-y-hidden border-b bg-[color-mix(in_srgb,var(--foreground-muted)_5%,var(--surface))] text-sm', listClassName), children: visibleItems.map((item) => (_jsx(TabTrigger, { value: item.id, className: triggerClassName, maxWidth: tabMaxWidth, minWidth: tabMinWidth, width: tabWidth, truncate: truncateLabels, children: item.label }, item.id))) }), visibleItems.map((item) => (_jsx(Tabs.Content, { value: item.id, className: cn('flex h-full min-w-0 flex-1 flex-col overflow-hidden', contentClassName), children: item.children }, item.id)))] }) }));
17
18
  }
18
- function TabTrigger({ children, className, value, }) {
19
- return (_jsx(Tabs.Trigger, { value: value, className: cn('text-foreground-muted hover:text-foreground focus-visible:ring-brand/50 data-[state=active]:border-app-border data-[state=active]:border-b-surface data-[state=active]:bg-surface data-[state=active]:text-foreground -mb-px inline-flex cursor-pointer items-center border border-t-0 border-transparent bg-[color-mix(in_srgb,var(--foreground-muted)_7%,var(--surface))] px-3 py-2 text-sm font-medium transition-colors first:border-l-0 hover:bg-[color-mix(in_srgb,var(--foreground-muted)_10%,var(--surface))] focus:outline-none focus-visible:ring-2', className), children: children }));
19
+ function TabTrigger({ children, className, value, maxWidth, minWidth, width, truncate, }) {
20
+ const style = {
21
+ maxWidth,
22
+ minWidth: minWidth ?? DEFAULT_TAB_MIN_WIDTH,
23
+ width,
24
+ };
25
+ return (_jsx(Tabs.Trigger, { value: value, style: style, className: cn('text-foreground-muted hover:text-foreground focus-visible:ring-brand/50 data-[state=active]:border-app-border data-[state=active]:border-b-surface data-[state=active]:bg-surface data-[state=active]:text-foreground -mb-px inline-flex shrink-0 cursor-pointer items-center justify-center border border-t-0 border-transparent bg-[color-mix(in_srgb,var(--foreground-muted)_7%,var(--surface))] px-4 py-2 text-sm font-medium transition-colors first:border-l-0 hover:bg-[color-mix(in_srgb,var(--foreground-muted)_10%,var(--surface))] focus:outline-none focus-visible:ring-2', className), children: _jsx("span", { className: cn('min-w-0', truncate && 'overflow-hidden text-ellipsis whitespace-nowrap'), children: children }) }));
20
26
  }
package/dist/styles.css CHANGED
@@ -634,6 +634,7 @@ h2.react-datepicker__current-month {
634
634
  --radius-md: 0.375rem;
635
635
  --radius-lg: 0.5rem;
636
636
  --radius-xl: 0.75rem;
637
+ --radius-2xl: 1rem;
637
638
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
638
639
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
639
640
  --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
@@ -1191,6 +1192,9 @@ h2.react-datepicker__current-month {
1191
1192
  .h-56 {
1192
1193
  height: calc(var(--spacing) * 56);
1193
1194
  }
1195
+ .h-64 {
1196
+ height: calc(var(--spacing) * 64);
1197
+ }
1194
1198
  .h-72 {
1195
1199
  height: calc(var(--spacing) * 72);
1196
1200
  }
@@ -1356,6 +1360,9 @@ h2.react-datepicker__current-month {
1356
1360
  .w-80 {
1357
1361
  width: calc(var(--spacing) * 80);
1358
1362
  }
1363
+ .w-96 {
1364
+ width: calc(var(--spacing) * 96);
1365
+ }
1359
1366
  .w-\[28rem\] {
1360
1367
  width: 28rem;
1361
1368
  }
@@ -1368,6 +1375,9 @@ h2.react-datepicker__current-month {
1368
1375
  .w-\[42rem\] {
1369
1376
  width: 42rem;
1370
1377
  }
1378
+ .w-\[44rem\] {
1379
+ width: 44rem;
1380
+ }
1371
1381
  .w-\[46rem\] {
1372
1382
  width: 46rem;
1373
1383
  }
@@ -1748,6 +1758,9 @@ h2.react-datepicker__current-month {
1748
1758
  .rounded {
1749
1759
  border-radius: 0.25rem;
1750
1760
  }
1761
+ .rounded-2xl {
1762
+ border-radius: var(--radius-2xl);
1763
+ }
1751
1764
  .rounded-\[var\(--radius\)\] {
1752
1765
  border-radius: var(--radius);
1753
1766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wellingtonhlc/shared-ui",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",