@aspprev/versi-ds 0.4.2 → 0.4.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
@@ -90,10 +90,15 @@ import {
90
90
 
91
91
  - `OtpCodeInput` suporta `onComplete`, colagem de código, máscara, erro e controle por `value`/`values`.
92
92
  - `QRCode` suporta `description`, `ariaLabel`, `loading`, `error`, `size` e nível de correção.
93
+ - `PageHeading` e `PageTabsHeader` mantêm o bloco do título flexível em tablet/desktop, truncam títulos longos com reticências e preservam o texto completo no atributo `title` quando o título é texto simples. O retorno (`back`) e as ações continuam disponíveis.
94
+ - `Input` e `InputStandalone` aceitam `formatter={(value) => string}` para máscaras definidas pelo consumidor, sem props de domínio; as máscaras nomeadas existentes permanecem compatíveis.
95
+ - `validateFiles` retorna `code`, nome, extensão, tamanho e limite da rejeição e aceita mensagens por código; `FileViewer` também aceita `Promise<FileViewerSource>` como source.
93
96
  - Upload e `FileViewer` são controlados pelo consumidor; transporte, autenticação, persistência e download não fazem parte do pacote.
94
97
  - `DatePicker` aceita `selectionMode="year"` e mantém `selectionMode="day"` como padrão.
95
98
  - `DomainStatusBadge` aceita `statusMap` para vocabulário específico do produto.
96
99
  - `Table` preserva os modos `fit`, `adaptive` e `scroll`; filtros e paginação respondem ao espaço do container.
100
+ - `InputPhone`/`PhoneInput` e `SelectCountry` aceitam `showFlags`; o padrão é `true` e `showFlags={false}` remove a bandeira sem reservar espaço.
101
+ - Os controles de formulário ocupam a largura disponível do container; `className="w-full"` pode ser usado em grids, flex containers e colunas responsivas.
97
102
 
98
103
  Consulte [`docs/API-NOVOS-COMPONENTES.md`](docs/API-NOVOS-COMPONENTES.md) e o Storybook para exemplos completos, estados de erro/carregamento e contratos de acessibilidade.
99
104
 
@@ -223,3 +228,10 @@ Ao criar ou alterar um componente:
223
228
  6. execute `npm run prepack` antes de gerar o pacote.
224
229
 
225
230
  Detalhes de contratos, governança e segurança ficam na pasta `docs/`. A documentação de uso visual deve permanecer principalmente no Storybook.
231
+ ### Contratos adicionados no lote seguinte
232
+
233
+ - `Input` e `InputStandalone` preservam a posição do cursor ao aplicar um `formatter` genérico; máscaras de domínio continuam sendo definidas pelo consumidor.
234
+ - `InputSlider` usa `suffix` como prop canônica e mantém `sufix` apenas como alias de migração. `Avatar` aceita `xl` além dos tamanhos existentes.
235
+ - `validateFiles` também rejeita arquivos vazios ou inválidos, com mensagens customizáveis; `FileViewer` aceita um slot `actions`.
236
+ - `TimeSeriesChart` e `InteractiveDonutChart` expõem estados genéricos de carregamento, erro e ausência de dados.
237
+ - `BoletoBarCode` aceita `width`, `height`, `quietZone` e estado de erro; o payload de boleto continua sendo responsabilidade do consumidor.
package/dist/charts.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { ReactNode } from 'react';
2
3
  import { Props as Props$1 } from 'react-apexcharts';
3
4
 
4
5
  type Props = Props$1;
@@ -8,6 +9,10 @@ type InteractiveDonutOptions = NonNullable<Props["options"]>;
8
9
  type InteractiveDonutProps = Omit<Props, "options" | "series" | "type"> & {
9
10
  options?: InteractiveDonutOptions;
10
11
  series: number[];
12
+ loading?: boolean;
13
+ loadingMessage?: ReactNode;
14
+ error?: ReactNode;
15
+ emptyMessage?: ReactNode;
11
16
  colors?: string[];
12
17
  mutedColors?: string[];
13
18
  valueFormatter?: (value: number) => string;
@@ -17,18 +22,22 @@ type InteractiveDonutProps = Omit<Props, "options" | "series" | "type"> & {
17
22
  responsiveHeight?: boolean;
18
23
  highContrastOverride?: boolean;
19
24
  };
20
- declare function InteractiveDonutChart({ options, series, colors, mutedColors, valueFormatter, ariaLabel, className, chartClassName, responsiveHeight, highContrastOverride, ...rest }: InteractiveDonutProps): React.JSX.Element;
25
+ declare function InteractiveDonutChart({ options, series, loading, loadingMessage, error, emptyMessage, colors, mutedColors, valueFormatter, ariaLabel, className, chartClassName, responsiveHeight, highContrastOverride, ...rest }: InteractiveDonutProps): React.JSX.Element;
21
26
 
22
27
  type TimeSeriesChartOptions = NonNullable<Props["options"]>;
23
28
  type TimeSeriesChartProps = Omit<Props, "options"> & {
24
29
  options: TimeSeriesChartOptions;
25
30
  ariaLabel: string;
31
+ loading?: boolean;
32
+ loadingMessage?: ReactNode;
33
+ error?: ReactNode;
34
+ emptyMessage?: ReactNode;
26
35
  className?: string;
27
36
  chartClassName?: string;
28
37
  responsiveHeight?: boolean;
29
38
  highContrastOverride?: boolean;
30
39
  };
31
- declare function TimeSeriesChart({ options, ariaLabel, className, chartClassName, responsiveHeight, highContrastOverride, ...chartProps }: TimeSeriesChartProps): React.JSX.Element;
40
+ declare function TimeSeriesChart({ options, ariaLabel, loading, loadingMessage, error, emptyMessage, className, chartClassName, responsiveHeight, highContrastOverride, ...chartProps }: TimeSeriesChartProps): React.JSX.Element;
32
41
 
33
42
  type TimeRangeSelectorProps<T extends string | number> = {
34
43
  options: readonly T[];
package/dist/charts.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  normalizeTimeSeriesTooltipColor,
13
13
  resolveInteractiveDonutColors,
14
14
  resolveRelativeDonutSelection
15
- } from "./chunk-5MRS4PDD.js";
15
+ } from "./chunk-HKCVDOGK.js";
16
16
  export {
17
17
  InteractiveDonutChart,
18
18
  LazyApexChart,
@@ -88,6 +88,23 @@ var FieldFrame_default = FieldFrame;
88
88
 
89
89
  // src/components/input/Input.tsx
90
90
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
91
+ function getFormattedCaretPosition(rawValue, formattedValue, selectionStart, formatter, sanitize) {
92
+ if (selectionStart === null) return null;
93
+ if (selectionStart >= rawValue.length) return formattedValue.length;
94
+ const formattedSuffix = sanitize(formatter(rawValue.slice(selectionStart)));
95
+ return Math.max(
96
+ 0,
97
+ Math.min(formattedValue.length, formattedValue.length - formattedSuffix.length)
98
+ );
99
+ }
100
+ function restoreCaretPosition(inputRef, position) {
101
+ if (position === null || typeof window === "undefined") return;
102
+ window.requestAnimationFrame(() => {
103
+ const input = inputRef.current;
104
+ if (!input || document.activeElement !== input) return;
105
+ input.setSelectionRange(position, position);
106
+ });
107
+ }
91
108
  var BaseInput = React.forwardRef((props, ref) => /* @__PURE__ */ jsx2(
92
109
  "input",
93
110
  {
@@ -150,6 +167,7 @@ var Input = ({
150
167
  prefix,
151
168
  suffix,
152
169
  mask,
170
+ formatter,
153
171
  disabled,
154
172
  error,
155
173
  disallowSpaces,
@@ -248,6 +266,44 @@ var Input = ({
248
266
  };
249
267
  const renderMaskedInput = (inputType) => {
250
268
  const autoCompleteValue = rest.autoComplete;
269
+ if (formatter) {
270
+ const currentValue = String(safeValue(field.value));
271
+ return /* @__PURE__ */ jsx2(
272
+ "input",
273
+ {
274
+ ...rest,
275
+ ...accessibilityProps,
276
+ name,
277
+ ref: inputRef,
278
+ type: inputType === "date" ? "text" : inputType,
279
+ value: currentValue,
280
+ onChange: (event) => {
281
+ const rawValue = event.target.value;
282
+ const formattedValue = sanitizeValue(formatter(rawValue));
283
+ const caretPosition = getFormattedCaretPosition(
284
+ rawValue,
285
+ formattedValue,
286
+ event.target.selectionStart,
287
+ formatter,
288
+ sanitizeValue
289
+ );
290
+ helpers.setValue(formattedValue);
291
+ restoreCaretPosition(inputRef, caretPosition);
292
+ rest.onChange?.({
293
+ ...event,
294
+ target: { ...event.target, value: formattedValue },
295
+ currentTarget: { ...event.currentTarget, value: formattedValue }
296
+ });
297
+ },
298
+ onBlur: field.onBlur,
299
+ onPaste: handlePasteFormik,
300
+ placeholder,
301
+ className: classNames2(FIELD_INPUT_CLASS, className),
302
+ autoComplete: autoCompleteValue,
303
+ disabled
304
+ }
305
+ );
306
+ }
251
307
  if (mask === "currency") {
252
308
  const rawCurrencyValue = typeof field.value === "string" || typeof field.value === "number" ? field.value : "";
253
309
  return /* @__PURE__ */ jsx2(
@@ -531,6 +587,7 @@ var InputStandalone = (props) => {
531
587
  prefix,
532
588
  suffix,
533
589
  mask,
590
+ formatter,
534
591
  disabled,
535
592
  error,
536
593
  errorText,
@@ -615,6 +672,41 @@ var InputStandalone = (props) => {
615
672
  };
616
673
  const renderMaskedInput = (inputType) => {
617
674
  const autoCompleteValue = rest.autoComplete;
675
+ if (formatter) {
676
+ const currentValue = String(safeValue(rest.value));
677
+ return /* @__PURE__ */ jsx2(
678
+ "input",
679
+ {
680
+ ...rest,
681
+ ...accessibilityProps,
682
+ ref: inputRef,
683
+ type: inputType === "date" ? "text" : inputType,
684
+ value: currentValue,
685
+ onChange: (event) => {
686
+ const rawValue = event.target.value;
687
+ const formattedValue = sanitizeValue(formatter(rawValue));
688
+ const caretPosition = getFormattedCaretPosition(
689
+ rawValue,
690
+ formattedValue,
691
+ event.target.selectionStart,
692
+ formatter,
693
+ sanitizeValue
694
+ );
695
+ restoreCaretPosition(inputRef, caretPosition);
696
+ rest.onChange?.({
697
+ ...event,
698
+ target: { ...event.target, value: formattedValue },
699
+ currentTarget: { ...event.currentTarget, value: formattedValue }
700
+ });
701
+ },
702
+ onPaste: handlePasteStandalone,
703
+ placeholder: rest.placeholder,
704
+ className: classNames2(FIELD_INPUT_CLASS, className),
705
+ autoComplete: autoCompleteValue,
706
+ disabled
707
+ }
708
+ );
709
+ }
618
710
  if (mask === "currency") {
619
711
  const rawCurrencyValue = typeof rest.value === "string" || typeof rest.value === "number" ? rest.value : "";
620
712
  return /* @__PURE__ */ jsx2(
@@ -1780,7 +1872,8 @@ function buildPhonePayload(phoneValue) {
1780
1872
  function parsePhonePayload(rawValue, countries = PHONE_COUNTRY_OPTIONS) {
1781
1873
  return parseStoredPhoneValue(rawValue, countries);
1782
1874
  }
1783
- function renderFlag(option) {
1875
+ function renderFlag(option, showFlags) {
1876
+ if (!showFlags) return null;
1784
1877
  return /* @__PURE__ */ jsx6(
1785
1878
  CountryFlag,
1786
1879
  {
@@ -1798,7 +1891,8 @@ function InputPhone({
1798
1891
  countries,
1799
1892
  countryList,
1800
1893
  disabled,
1801
- className
1894
+ className,
1895
+ showFlags = true
1802
1896
  }) {
1803
1897
  const availableCountries = useMemo(
1804
1898
  () => filterCountryOptions(
@@ -1950,14 +2044,14 @@ function InputPhone({
1950
2044
  "div",
1951
2045
  {
1952
2046
  ref: wrapperRef,
1953
- className: "field-control-slot relative mt-4xs mb-[4px]",
2047
+ className: "field-control-slot relative mt-4xs mb-[4px] flex w-full min-w-0",
1954
2048
  children: [
1955
2049
  /* @__PURE__ */ jsxs5(
1956
2050
  "div",
1957
2051
  {
1958
2052
  "data-has-value": phoneDigits.length > 0,
1959
2053
  className: classNames5(
1960
- "field-keyboard-focus-ring flex min-h-control-md items-center overflow-hidden rounded-sm border border-field-border-default bg-field-surface text-field-icon transition-colors focus-within:border-field-border-active focus-within:text-field-content data-[has-value=true]:text-field-content",
2054
+ "field-keyboard-focus-ring flex w-full min-w-0 min-h-control-md items-center overflow-hidden rounded-sm border border-field-border-default bg-field-surface text-field-icon transition-colors focus-within:border-field-border-active focus-within:text-field-content data-[has-value=true]:text-field-content",
1961
2055
  {
1962
2056
  [FIELD_ERROR_CLASS]: hasError,
1963
2057
  [FIELD_DISABLED_CLASS]: disabled
@@ -1991,7 +2085,7 @@ function InputPhone({
1991
2085
  }
1992
2086
  ),
1993
2087
  children: [
1994
- renderFlag(selectedCountry),
2088
+ renderFlag(selectedCountry, showFlags),
1995
2089
  /* @__PURE__ */ jsx6("span", { className: "text-sm", children: selectedCountry?.idd.display || `+${value.ddi}` }),
1996
2090
  open ? /* @__PURE__ */ jsx6(
1997
2091
  MdOutlineKeyboardArrowUp2,
@@ -2128,7 +2222,7 @@ function InputPhone({
2128
2222
  },
2129
2223
  className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-surface-muted focus-visible:bg-surface-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus-ring",
2130
2224
  children: [
2131
- renderFlag(country),
2225
+ renderFlag(country, showFlags),
2132
2226
  /* @__PURE__ */ jsx6("span", { className: "min-w-0 flex-1 truncate text-field-content", children: country.label }),
2133
2227
  /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-content-muted", children: country.idd.display })
2134
2228
  ]
@@ -2927,7 +3021,15 @@ import {
2927
3021
  import { MdClose, MdKeyboardArrowDown } from "react-icons/md";
2928
3022
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2929
3023
  function SelectMultiView(props) {
2930
- const { options, error, label, checkedList = [], onClear, disabled } = props;
3024
+ const {
3025
+ options,
3026
+ error,
3027
+ label,
3028
+ checkedList = [],
3029
+ onClear,
3030
+ disabled,
3031
+ className
3032
+ } = props;
2931
3033
  const [isOpened, setIsOpened] = useState6(false);
2932
3034
  const containerRef = useRef6(null);
2933
3035
  const triggerRef = useRef6(null);
@@ -3007,7 +3109,7 @@ function SelectMultiView(props) {
3007
3109
  FieldFrame_default,
3008
3110
  {
3009
3111
  ref: containerRef,
3010
- className: "multi-select-container",
3112
+ className: cs("multi-select-container", className),
3011
3113
  label,
3012
3114
  labelFor: triggerId,
3013
3115
  labelId: label ? labelId : void 0,
@@ -3018,7 +3120,7 @@ function SelectMultiView(props) {
3018
3120
  "div",
3019
3121
  {
3020
3122
  "aria-invalid": Boolean(error) || void 0,
3021
- className: "relative mb-[4px] mt-4xs",
3123
+ className: "relative mb-[4px] mt-4xs w-full min-w-0",
3022
3124
  children: [
3023
3125
  /* @__PURE__ */ jsxs7(
3024
3126
  "button",
@@ -3173,7 +3275,8 @@ var SelectMulti_default = SelectMulti;
3173
3275
 
3174
3276
  // src/components/selectCountry/SelectCountry.tsx
3175
3277
  import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3176
- function renderFlag2(option) {
3278
+ function renderFlag2(option, showFlags) {
3279
+ if (!showFlags) return null;
3177
3280
  return /* @__PURE__ */ jsx10(
3178
3281
  "span",
3179
3282
  {
@@ -3190,12 +3293,12 @@ function renderFlag2(option) {
3190
3293
  }
3191
3294
  );
3192
3295
  }
3193
- function renderCountryContent(option, placeholder) {
3296
+ function renderCountryContent(option, placeholder, showFlags = true) {
3194
3297
  if (!option) {
3195
3298
  return /* @__PURE__ */ jsx10("span", { className: "block w-full truncate overflow-hidden text-content-muted", children: placeholder });
3196
3299
  }
3197
3300
  return /* @__PURE__ */ jsxs8("span", { className: "flex w-full min-w-0 items-center gap-2", children: [
3198
- renderFlag2(option),
3301
+ renderFlag2(option, showFlags),
3199
3302
  /* @__PURE__ */ jsx10("span", { className: "block truncate overflow-hidden", children: option.label })
3200
3303
  ] });
3201
3304
  }
@@ -3208,6 +3311,7 @@ function SelectCountry({
3208
3311
  defaultValue,
3209
3312
  onChange,
3210
3313
  className,
3314
+ showFlags = true,
3211
3315
  ...props
3212
3316
  }) {
3213
3317
  const availableOptions = filterCountryOptions(
@@ -3225,8 +3329,12 @@ function SelectCountry({
3225
3329
  searchable,
3226
3330
  searchPlaceholder,
3227
3331
  noOptionsText,
3228
- renderOption: (option) => renderCountryContent(option),
3229
- renderValue: (option, placeholder) => renderCountryContent(option, placeholder)
3332
+ renderOption: (option) => renderCountryContent(option, void 0, showFlags),
3333
+ renderValue: (option, placeholder) => renderCountryContent(
3334
+ option,
3335
+ placeholder,
3336
+ showFlags
3337
+ )
3230
3338
  }
3231
3339
  );
3232
3340
  }
@@ -3568,7 +3676,7 @@ var OtpCodeInput = forwardRef2(
3568
3676
  "aria-labelledby": label ? `${groupId}-label` : void 0,
3569
3677
  "aria-describedby": describedBy,
3570
3678
  "aria-invalid": hasError || void 0,
3571
- className: "mt-1 flex flex-wrap gap-2",
3679
+ className: "mt-1 flex w-full min-w-0 flex-wrap gap-2",
3572
3680
  children: Array.from({ length: safeLength }, (_, index) => /* @__PURE__ */ createElement(
3573
3681
  "input",
3574
3682
  {
@@ -3637,4 +3745,4 @@ export {
3637
3745
  RadioCardGroup,
3638
3746
  OtpCodeInput_default
3639
3747
  };
3640
- //# sourceMappingURL=chunk-6NVJWI5B.js.map
3748
+ //# sourceMappingURL=chunk-CLXCB6LY.js.map