@wellingtonhlc/shared-ui 0.25.3 → 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 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, 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
+ 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 shrink-0 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
@@ -1192,6 +1192,9 @@ h2.react-datepicker__current-month {
1192
1192
  .h-56 {
1193
1193
  height: calc(var(--spacing) * 56);
1194
1194
  }
1195
+ .h-64 {
1196
+ height: calc(var(--spacing) * 64);
1197
+ }
1195
1198
  .h-72 {
1196
1199
  height: calc(var(--spacing) * 72);
1197
1200
  }
@@ -1372,6 +1375,9 @@ h2.react-datepicker__current-month {
1372
1375
  .w-\[42rem\] {
1373
1376
  width: 42rem;
1374
1377
  }
1378
+ .w-\[44rem\] {
1379
+ width: 44rem;
1380
+ }
1375
1381
  .w-\[46rem\] {
1376
1382
  width: 46rem;
1377
1383
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wellingtonhlc/shared-ui",
3
- "version": "0.25.3",
3
+ "version": "0.25.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",