@selectwin/kit 0.1.186 → 0.1.188

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
@@ -1,29 +1,45 @@
1
- # @selectwin/kit
2
-
3
- Design system da Selectwin — primitivos React, charts SVG (sem dependência de biblioteca de
4
- gráficos) e tokens CSS, theme-aware (light/dark).
5
-
6
- Uso interno da Selectwin. Publicado no npm para facilitar a distribuição entre os apps da casa;
7
- não há suporte, documentação pública nem garantia de estabilidade de API para terceiros.
8
-
9
- ## Uso
10
-
11
- ```bash
12
- npm i @selectwin/kit
13
- ```
14
-
15
- ```tsx
16
- import '@selectwin/kit/styles.css'; // tokens + estilos (uma vez, no root)
17
- import { SelectButton, SelectSection } from '@selectwin/kit';
18
- ```
19
-
20
- Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
21
- **react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
22
-
23
- ## Build
24
-
25
- ```bash
26
- npm run build # → dist/index.js (ESM) + dist/style.css + dist/index.d.ts
27
- ```
28
-
29
- `npm publish` roda `prepublishOnly` (= build) e publica só `dist/` (sem sourcemaps).
1
+ # @selectwin/kit
2
+
3
+ Design system da Selectwin — primitivos React, charts SVG (sem dependência de biblioteca de
4
+ gráficos) e tokens CSS, theme-aware (light/dark).
5
+
6
+ Uso interno da Selectwin. Publicado no npm para facilitar a distribuição entre os apps da casa;
7
+ não há suporte, documentação pública nem garantia de estabilidade de API para terceiros.
8
+
9
+ ## Uso
10
+
11
+ ```bash
12
+ npm i @selectwin/kit
13
+ ```
14
+
15
+ ```tsx
16
+ import '@selectwin/kit/styles.css'; // tokens + estilos (uma vez, no root)
17
+ import { SelectButton, SelectSection } from '@selectwin/kit';
18
+ ```
19
+
20
+ Idioma (0.1.187): os textos próprios do kit ("Página anterior", "Mais filtros", "Fechar"…) e os números que ele
21
+ formata saem em português. Para inglês, envolva o app no `SelectLocaleProvider`:
22
+
23
+ ```tsx
24
+ import { SelectLocaleProvider } from '@selectwin/kit';
25
+
26
+ <SelectLocaleProvider locale="en">{app}</SelectLocaleProvider>; // 'pt-BR' | 'en'
27
+ ```
28
+
29
+ A prop de texto do componente (`confirmLabel`, `noun`…) sempre ganha do dicionário.
30
+
31
+ Tom corporativo (0.1.188): cantos mais retos, botão e segmentado em pílula (`--select-radius-button`), rótulos de KPI
32
+ e cabeçalho de tabela em caixa-alta espaçada. Nos gráficos, cor é situação: verde `--select-chart-paid` = pago, dourado
33
+ `--select-chart-pending` (+ `-edge`) = pendente, `--select-chart-compare` = o período anterior, e os cinzas
34
+ `--select-chart-ramp-1..4` para categoria. O app que quer o visual antigo sobrescreve esses tokens.
35
+
36
+ Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
37
+ **react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
38
+
39
+ ## Build
40
+
41
+ ```bash
42
+ npm run build # → dist/index.js (ESM) + dist/style.css + dist/index.d.ts
43
+ ```
44
+
45
+ `npm publish` roda `prepublishOnly` (= build) e publica só `dist/` (sem sourcemaps).
@@ -1,5 +1,5 @@
1
1
  import { SelectAction } from './SelectActionList';
2
- export declare function SelectActionMenu({ items, label, disabled, }: {
2
+ export declare function SelectActionMenu({ items, label: labelProp, disabled, }: {
3
3
  items: SelectAction[];
4
4
  label?: string;
5
5
  disabled?: boolean;
@@ -42,7 +42,7 @@ export interface SelectAssistantProps {
42
42
  inputLabel?: string;
43
43
  className?: string;
44
44
  }
45
- export declare function SelectAssistant({ open, onOpenChange, icon, title, subtitle, launcherLabel, badge, children, scrollKey, suggestions, onSuggestion, onSend, placeholder, disabled, typing, headerAction, anchor, closeLabel, sendLabel, inputLabel, className, }: SelectAssistantProps): import("react").JSX.Element;
45
+ export declare function SelectAssistant({ open, onOpenChange, icon, title, subtitle, launcherLabel, badge, children, scrollKey, suggestions, onSuggestion, onSend, placeholder, disabled, typing, headerAction, anchor, closeLabel: closeLabelProp, sendLabel: sendLabelProp, inputLabel: inputLabelProp, className, }: SelectAssistantProps): import("react").JSX.Element;
46
46
  export interface SelectChatMessageProps {
47
47
  /** Quem fala: o assistente (à esquerda) ou a pessoa (à direita). */
48
48
  from: 'assistant' | 'user';
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function SelectBackLink({ children, onClick, href, }: {
2
+ export declare function SelectBackLink({ children: childrenProp, onClick, href, }: {
3
3
  children?: ReactNode;
4
4
  onClick?: () => void;
5
5
  href?: string;
@@ -27,7 +27,16 @@ type SelectColumnChartOwnProps = {
27
27
  /** Custom hover card for slot `index`; return null for no card there. Default: the slot's
28
28
  * label as title and one row per series. */
29
29
  tooltip?: (index: number) => SelectColumnTooltip | null;
30
+ /** O período anterior: uma barra clara ao lado de cada barra ("Semana anterior"). Entra na escala e no tooltip. */
31
+ compare?: {
32
+ name: string;
33
+ data: number[];
34
+ };
35
+ /** A média tracejada — da soma de cada ponto (empilhado) ou da 1ª série (agrupado) —, com "Média R$ 32,5 mil". */
36
+ average?: boolean | {
37
+ label?: string;
38
+ };
30
39
  };
31
40
  export type SelectColumnChartProps = SelectColumnChartOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectColumnChartOwnProps>;
32
- export declare function SelectColumnChart({ series, labels, height, format, stacked, marker, tooltip, className, ...rest }: SelectColumnChartProps): import("react").JSX.Element;
41
+ export declare function SelectColumnChart({ series, labels, height, format, stacked, marker, tooltip, compare, average, className, ...rest }: SelectColumnChartProps): import("react").JSX.Element;
33
42
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function SelectConfirmModal({ open, onClose, onConfirm, title, children, confirmLabel, cancelLabel, destructive, loading, theme, }: {
2
+ export declare function SelectConfirmModal({ open, onClose, onConfirm, title, children, confirmLabel: confirmLabelProp, cancelLabel: cancelLabelProp, destructive, loading, theme, }: {
3
3
  open: boolean;
4
4
  onClose: () => void;
5
5
  onConfirm: () => void;
@@ -18,7 +18,7 @@ export interface SelectDatePickerProps {
18
18
  onCancel?: () => void;
19
19
  /** CSS custom property name to drive the accent (default --select-accent). */
20
20
  accentVar?: string;
21
- /** Calendar/labels language + date order (default 'en-US'). */
21
+ /** Calendar/labels language + date order. Default: the `SelectLocaleProvider` locale when there is one, else 'en-US'. */
22
22
  locale?: SelectDateLocale;
23
23
  /** Show the From/To time pills (default true). Off for daily ranges. */
24
24
  showTime?: boolean;
@@ -2,7 +2,7 @@ import { ReactNode, ComponentPropsWithoutRef } from 'react';
2
2
  export interface SelectFilterDef {
3
3
  key: string;
4
4
  label: string;
5
- type: 'text' | 'select' | 'date';
5
+ type: 'text' | 'select' | 'multiselect' | 'date';
6
6
  placeholder?: string;
7
7
  options?: {
8
8
  label: string;
@@ -22,6 +22,12 @@ export interface SelectFilterDef {
22
22
  */
23
23
  error?: string;
24
24
  }
25
+ /** Os valores de uma faceta `multiselect` (`"email,sms"` → `["email", "sms"]`); vazio → `[]`. */
26
+ export declare function splitFilterValues(value: string | undefined): string[];
27
+ /** O inverso: a lista vira o valor da faceta, na ordem das opções quando elas são dadas. */
28
+ export declare function joinFilterValues(values: readonly string[], options?: ReadonlyArray<{
29
+ value: string;
30
+ }>): string;
25
31
  type SelectFilterBarOwnProps = {
26
32
  filters: SelectFilterDef[];
27
33
  values: Record<string, string>;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function SelectFormModal({ open, onClose, onSubmit, title, subtitle, children, submitLabel, cancelLabel, submitting, submitDisabled, submitVariant, error, size, theme, }: {
2
+ export declare function SelectFormModal({ open, onClose, onSubmit, title, subtitle, children, submitLabel: submitLabelProp, cancelLabel: cancelLabelProp, submitting, submitDisabled, submitVariant, error, size, theme, }: {
3
3
  open: boolean;
4
4
  onClose: () => void;
5
5
  onSubmit: () => void;
@@ -0,0 +1,7 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ type SelectKpiBandOwnProps = {
3
+ children: ReactNode;
4
+ };
5
+ export type SelectKpiBandProps = SelectKpiBandOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectKpiBandOwnProps>;
6
+ export declare const SelectKpiBand: import('react').ForwardRefExoticComponent<SelectKpiBandOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & import('react').RefAttributes<HTMLDivElement>>;
7
+ export {};
@@ -0,0 +1,92 @@
1
+ import { ReactNode } from 'react';
2
+ export type SelectLocaleCode = 'pt-BR' | 'en';
3
+ export interface SelectKitMessages {
4
+ common: {
5
+ close: string;
6
+ cancel: string;
7
+ confirm: string;
8
+ save: string;
9
+ copy: string;
10
+ copied: string;
11
+ open: string;
12
+ back: string;
13
+ actions: string;
14
+ moreInfo: string;
15
+ search: string;
16
+ searchPlaceholder: string;
17
+ selectPlaceholder: string;
18
+ loading: string;
19
+ nothingFound: string;
20
+ noResults: string;
21
+ remove: (what: string) => string;
22
+ showPassword: string;
23
+ hidePassword: string;
24
+ notifications: string;
25
+ needsAttention: string;
26
+ };
27
+ pagination: {
28
+ label: string;
29
+ previous: string;
30
+ next: string;
31
+ page: (n: string) => string;
32
+ pageOf: (n: string, count: string) => string;
33
+ range: (start: string, end: string, total: string, noun: string) => string;
34
+ count: (total: string, noun: string) => string;
35
+ noun: string;
36
+ perPage: (n: string) => string;
37
+ };
38
+ filterBar: {
39
+ moreFilters: string;
40
+ clear: string;
41
+ clearAll: string;
42
+ clearSearch: string;
43
+ searchOption: string;
44
+ removeFilter: (label: string) => string;
45
+ };
46
+ dataTable: {
47
+ columns: string;
48
+ resetWidths: string;
49
+ };
50
+ dns: {
51
+ label: string;
52
+ type: string;
53
+ name: string;
54
+ value: string;
55
+ };
56
+ copyable: {
57
+ copyCode: string;
58
+ copyId: string;
59
+ };
60
+ assistant: {
61
+ send: string;
62
+ input: string;
63
+ typing: string;
64
+ };
65
+ chipInput: {
66
+ limit: (max: string) => string;
67
+ };
68
+ factStrip: Record<'done' | 'todo' | 'wait' | 'critical', string>;
69
+ setupGuide: Record<'done' | 'todo' | 'next' | 'skipped' | 'waiting', string> & {
70
+ progressLabel: string;
71
+ progress: (done: string, total: string) => string;
72
+ };
73
+ sideNav: {
74
+ pending: (hint: string) => string;
75
+ };
76
+ }
77
+ /** Os dicionários do kit, para quem quer conferir ou montar um texto do mesmo jeito. */
78
+ export declare const selectKitMessages: Readonly<Record<SelectLocaleCode, SelectKitMessages>>;
79
+ export declare function SelectLocaleProvider({ locale, children }: {
80
+ locale: SelectLocaleCode;
81
+ children: ReactNode;
82
+ }): import("react").JSX.Element;
83
+ /** A língua em vigor (sem provider, português). */
84
+ export declare function useSelectLocale(): SelectLocaleCode;
85
+ /** A língua do provider, ou `null` sem provider — para o componente que tem padrão próprio (o `SelectDatePicker`). */
86
+ export declare function useSelectLocaleIfSet(): SelectLocaleCode | null;
87
+ /** O dicionário da língua em vigor. */
88
+ export declare function useSelectMessages(): SelectKitMessages;
89
+ /** A etiqueta BCP 47 do `Intl` para a língua do kit. */
90
+ export declare function selectIntlLocale(locale: SelectLocaleCode): string;
91
+ /** Um inteiro como a língua escreve ("2.127" / "2,127"). */
92
+ export declare function formatSelectNumber(n: number, locale?: SelectLocaleCode): string;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function SelectModal({ open, onClose, eyebrow, title, subtitle, badge, children, footer, aside, size, showClose, noise, dividedHeader, backdrop, theme, placement, headerAction, flush, }: {
2
+ export declare function SelectModal({ open, onClose, eyebrow, title, subtitle, badge, children, footer, aside, size, showClose, noise, dividedHeader, backdrop, theme, placement, headerAction, flush, dismissible, }: {
3
3
  open: boolean;
4
4
  onClose: () => void;
5
5
  /** Uma linha de contexto acima do título ("Passo a passo · ponto 1 de 5"). */
@@ -34,4 +34,9 @@ export declare function SelectModal({ open, onClose, eyebrow, title, subtitle, b
34
34
  * `SelectFactStrip` já vem com o dela.
35
35
  */
36
36
  flush?: boolean;
37
+ /**
38
+ * 0.1.187: `false` = só os botões do próprio diálogo fecham — o Esc e o clique fora não fazem nada, e o ✕ some
39
+ * (o segredo que aparece uma vez: quem lê confirma que guardou).
40
+ */
41
+ dismissible?: boolean;
37
42
  }): import('react').ReactPortal | null;
@@ -10,6 +10,10 @@ export interface SelectPageAction {
10
10
  type SelectPageOwnProps = {
11
11
  title?: ReactNode;
12
12
  subtitle?: ReactNode;
13
+ /** Acima do título, em caixa-alta espaçada ("Produção · Segunda, 02 de novembro") — 0.1.188, o tom corporativo. */
14
+ eyebrow?: ReactNode;
15
+ /** Um filete separa o cabeçalho do conteúdo (as telas de painel, como o Início). */
16
+ divided?: boolean;
13
17
  primaryAction?: SelectPageAction;
14
18
  secondaryActions?: SelectPageAction[];
15
19
  /** Custom node in the header action area (e.g. an "Ações" overflow menu on detail
@@ -17,7 +17,7 @@ export interface SelectPaginationProps {
17
17
  onNext?: () => void;
18
18
  /** Jump directly to a 1-based page. Required for numbered buttons. */
19
19
  onPage?: (page: number) => void;
20
- /** Noun for the count label, e.g. "produtos". Defaults to "resultados". */
20
+ /** Noun for the count label, e.g. "produtos". Defaults to "resultados" ("results" in English, `SelectLocaleProvider`). */
21
21
  noun?: string;
22
22
  }
23
23
  export declare const SelectPagination: import('react').ForwardRefExoticComponent<SelectPaginationProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, keyof SelectPaginationProps> & import('react').RefAttributes<HTMLElement>>;
@@ -6,7 +6,7 @@ export interface SelectRowAction {
6
6
  destructive?: boolean;
7
7
  disabled?: boolean;
8
8
  }
9
- export declare function SelectRowActions({ actions, label }: {
9
+ export declare function SelectRowActions({ actions, label: labelProp }: {
10
10
  actions: SelectRowAction[];
11
11
  label?: string;
12
12
  }): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function SelectSearchMenu({ search, onSearchChange, searchPlaceholder, status, footer, width, autoFocus, selectFirstOnEnter, listMaxHeight, children, }: {
2
+ export declare function SelectSearchMenu({ search, onSearchChange, searchPlaceholder: searchPlaceholderProp, status, footer, width, autoFocus, selectFirstOnEnter, listMaxHeight, children, }: {
3
3
  search: string;
4
4
  onSearchChange: (value: string) => void;
5
5
  searchPlaceholder?: string;
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SelectPlacement } from './positioning';
3
- export declare function SelectTooltip({ content, children, placement, delay, openOnClick, }: {
3
+ export declare function SelectTooltip({ content, children, placement, delay, openOnClick, disabled, }: {
4
4
  content: ReactNode;
5
5
  children: ReactNode;
6
6
  placement?: SelectPlacement;
@@ -9,4 +9,7 @@ export declare function SelectTooltip({ content, children, placement, delay, ope
9
9
  * touch, where hover never happens. While pinned the tip accepts the pointer, so the
10
10
  * text can be selected. */
11
11
  openOnClick?: boolean;
12
+ /** Não abre (0.1.188): o gatilho já mostra o mesmo conteúdo noutro lugar (ex.: o painel de páginas do trilho aberto
13
+ * ao lado do ícone). O embrulho continua no lugar, então o gatilho não remonta nem perde o foco. */
14
+ disabled?: boolean;
12
15
  }): import("react").JSX.Element;
@@ -76,6 +76,9 @@ export interface SelectChartSeries {
76
76
  * gradient — the second encoding for "not happened yet" (scheduled, projected), so the
77
77
  * difference never rides on color alone. */
78
78
  pattern?: 'hatch';
79
+ /** SelectColumnChart: o contorno da barra — para a cor clara que sozinha não chega a 3:1 no fundo (o dourado do
80
+ * pendente usa `var(--select-chart-pending-edge)`). */
81
+ edge?: string;
79
82
  /** SelectLineChart: linha tracejada e mais clara, sem área — a COMPARAÇÃO (o período anterior),
80
83
  * que fica atrás da série principal sem disputar com ela. Pode ser mais curta que `labels`. */
81
84
  dashed?: boolean;
package/dist/icons.d.ts CHANGED
@@ -202,6 +202,8 @@ export declare function GiftIcon(): import("react").JSX.Element;
202
202
  export declare function HeadsetIcon(): import("react").JSX.Element;
203
203
  /** WhatsApp no traço da casa (não a marca colorida) — o canal da mensagem, o selo de atendimento. */
204
204
  export declare function WhatsAppIcon(): import("react").JSX.Element;
205
+ /** SMS (Iconsax message-text, 0.1.187) — o canal SMS, ao lado do `MailIcon` e do `WhatsAppIcon` (o selo do canal). */
206
+ export declare function SmsIcon(): import("react").JSX.Element;
205
207
  /** Imagem (Iconsax gallery) — o bloco de imagem de um e-mail, a foto de um produto. */
206
208
  export declare function ImageIcon(): import("react").JSX.Element;
207
209
  /** Alça de arrastar (6 pontos) — a de toda lista e grade que se reordena. Preenchido: pontos não têm traço. */
package/dist/index.d.ts CHANGED
@@ -123,7 +123,9 @@ export { SelectOfferPrice } from './SelectOfferPrice';
123
123
  export { SelectRatingQuote } from './SelectRatingQuote';
124
124
  export { SelectMarkStack } from './SelectMarkStack';
125
125
  export { SelectPagination } from './SelectPagination';
126
- export { SelectFilterBar } from './SelectFilterBar';
126
+ export { SelectFilterBar, splitFilterValues, joinFilterValues } from './SelectFilterBar';
127
+ export { SelectLocaleProvider, useSelectLocale, useSelectMessages, selectKitMessages, selectIntlLocale, formatSelectNumber, } from './SelectLocale';
128
+ export type { SelectLocaleCode, SelectKitMessages } from './SelectLocale';
127
129
  export { SelectTagSelect } from './SelectTagSelect';
128
130
  export { SelectSurface } from './SelectSurface';
129
131
  export { SelectToastProvider, useSelectToast } from './SelectToast';
@@ -132,6 +134,8 @@ export { SelectMoney, SelectSensitiveValue, SelectMetricDelta, SelectHideMoneyTo
132
134
  export { SelectBalanceCard } from './SelectBalanceCard';
133
135
  export { SelectFeeBreakdown } from './SelectFeeBreakdown';
134
136
  export { SelectKpiCard } from './SelectKpiCard';
137
+ export { SelectKpiBand } from './SelectKpiBand';
138
+ export type { SelectKpiBandProps } from './SelectKpiBand';
135
139
  export { SelectInsight, SelectInsightList, SelectInsightRow, formatInsightImpact } from './SelectInsight';
136
140
  export { SelectAssistant, SelectChatMessage, SelectChatTurn, SelectChatTyping } from './SelectAssistant';
137
141
  export { SelectNumberedList, SelectNumberedItem } from './SelectNumberedList';