@plenustech/design-system 0.1.1 → 0.2.1

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.
Files changed (54) hide show
  1. package/README.md +19 -3
  2. package/dist/design-system.css +1 -1
  3. package/dist/plenus-design-system.cjs +2 -1
  4. package/dist/plenus-design-system.cjs.map +1 -1
  5. package/dist/plenus-design-system.es.js +4064 -3530
  6. package/dist/plenus-design-system.es.js.map +1 -1
  7. package/dist/reset.css +9 -8
  8. package/dist/types/components/charts/ChartArea/ChartArea.d.ts +1 -1
  9. package/dist/types/components/charts/ChartBar/ChartBar.d.ts +1 -0
  10. package/dist/types/components/charts/ChartLine/ChartLine.d.ts +1 -1
  11. package/dist/types/components/charts/ChartRadial/ChartRadial.d.ts +1 -0
  12. package/dist/types/components/charts/ChartScatter/ChartScatter.d.ts +4 -4
  13. package/dist/types/components/charts/core/centerText.d.ts +4 -3
  14. package/dist/types/components/charts/core/index.d.ts +1 -1
  15. package/dist/types/components/charts/core/measureText.d.ts +8 -0
  16. package/dist/types/components/charts/core/slices.d.ts +0 -8
  17. package/dist/types/components/charts/palette/index.d.ts +1 -1
  18. package/dist/types/components/charts/palette/seriesColor.d.ts +5 -0
  19. package/dist/types/components/charts/scales/index.d.ts +2 -2
  20. package/dist/types/components/charts/scales/scales.d.ts +8 -12
  21. package/dist/types/components/data-display/Card/Card.d.ts +1 -1
  22. package/dist/types/components/data-display/List/useListing.d.ts +1 -0
  23. package/dist/types/components/data-display/Table/Table.d.ts +6 -3
  24. package/dist/types/components/feedback/Progress/Progress.d.ts +2 -2
  25. package/dist/types/components/forms/Checkbox/Checkbox.d.ts +4 -3
  26. package/dist/types/components/forms/ComboBox/ComboBox.d.ts +17 -8
  27. package/dist/types/components/forms/ComboBox/index.d.ts +1 -1
  28. package/dist/types/components/forms/DatePicker/DatePicker.d.ts +15 -9
  29. package/dist/types/components/forms/DatePicker/iso.d.ts +7 -0
  30. package/dist/types/components/forms/DateTimePicker/DateTimePicker.d.ts +16 -12
  31. package/dist/types/components/forms/Field/FormValue.d.ts +13 -0
  32. package/dist/types/components/forms/InputNumber/InputNumber.d.ts +1 -1
  33. package/dist/types/components/forms/RadioGroup/RadioGroup.d.ts +2 -1
  34. package/dist/types/components/forms/Select/Select.d.ts +4 -4
  35. package/dist/types/components/forms/Switch/Switch.d.ts +1 -1
  36. package/dist/types/components/forms/TimePicker/TimePicker.d.ts +14 -8
  37. package/dist/types/components/forms/TimePicker/TimeSlots.d.ts +4 -9
  38. package/dist/types/components/icons/icons.d.ts +2 -0
  39. package/dist/types/components/icons/index.d.ts +1 -1
  40. package/dist/types/components/navigation/Pagination/Pagination.d.ts +7 -1
  41. package/dist/types/components/overlays/Dialog/Dialog.d.ts +6 -2
  42. package/dist/types/components/overlays/Dialog/index.d.ts +1 -1
  43. package/dist/types/components/overlays/Menu/Menu.d.ts +7 -1
  44. package/dist/types/components/overlays/Popover/Popover.d.ts +3 -4
  45. package/dist/types/hooks/useDecimalInput.d.ts +19 -0
  46. package/dist/types/hooks/useMergedRefs.d.ts +6 -0
  47. package/dist/types/hooks/useSelection/useSelection.d.ts +1 -0
  48. package/dist/types/index.d.ts +3 -3
  49. package/dist/types/utils/formatters/formatarEntradaDecimal.d.ts +5 -0
  50. package/dist/types/utils/formatters/formatarEntradaHora.d.ts +7 -0
  51. package/dist/types/utils/formatters/index.d.ts +2 -1
  52. package/dist/types/utils/formatters/mascararPartes.d.ts +5 -0
  53. package/package.json +3 -2
  54. package/dist/types/utils/mergeRefs.d.ts +0 -7
@@ -1,5 +1,7 @@
1
1
  import { type ComponentPropsWithRef } from 'react';
2
2
  export interface PaginationProps extends ComponentPropsWithRef<'nav'> {
3
+ /** Suspende a troca de pagina, como enquanto a pagina pedida carrega. Os botoes continuam focaveis. */
4
+ disabled?: boolean;
3
5
  label?: string;
4
6
  onPageChange: (page: number) => void;
5
7
  page: number;
@@ -7,5 +9,9 @@ export interface PaginationProps extends ComponentPropsWithRef<'nav'> {
7
9
  /** Quantidade de paginas mostradas de cada lado da atual. */
8
10
  siblings?: number;
9
11
  }
10
- export declare function Pagination({ className, label, onPageChange, page, pageCount, siblings, ...props }: PaginationProps): import("react").JSX.Element | null;
12
+ export declare function Pagination({ className, disabled, label, onPageChange, page, pageCount, siblings, ...props }: PaginationProps): import("react").JSX.Element | null;
13
+ /**
14
+ * Primeira e ultima pagina sempre visiveis; null representa a reticencia. A faixa tem sempre as mesmas vagas: perto
15
+ * da ponta a janela encosta nela em vez de encolher, e reticencia nunca esconde uma pagina so.
16
+ */
11
17
  export declare function montarFaixa(atual: number, total: number, vizinhos: number): (number | null)[];
@@ -1,12 +1,16 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
2
  export type DialogSize = 'sm' | 'md' | 'lg';
3
- export interface DialogProps {
3
+ export type DialogRole = 'dialog' | 'alertdialog';
4
+ /** As propriedades nativas vao ao elemento do dialogo; o `className` soma ao do sistema. */
5
+ export interface DialogProps extends Omit<ComponentPropsWithRef<'div'>, 'children' | 'role' | 'title'> {
4
6
  children?: ReactNode;
5
7
  description?: string;
6
8
  dismissable?: boolean;
7
9
  footer?: ReactNode;
8
10
  onClose: () => void;
9
11
  open: boolean;
12
+ /** `alertdialog` para a confirmacao que interrompe e exige resposta, como a de uma acao destrutiva. */
13
+ role?: DialogRole;
10
14
  size?: DialogSize;
11
15
  title: string;
12
16
  }
@@ -1,2 +1,2 @@
1
1
  export { Dialog } from './Dialog.js';
2
- export type { DialogProps, DialogSize } from './Dialog.js';
2
+ export type { DialogProps, DialogRole, DialogSize } from './Dialog.js';
@@ -7,7 +7,13 @@ export interface MenuItem {
7
7
  }
8
8
  export interface MenuProps {
9
9
  children: ReactElement<Record<string, unknown>>;
10
+ /** Abertura inicial no modo nao controlado. */
11
+ defaultOpen?: boolean;
10
12
  items: readonly MenuItem[];
11
13
  label: string;
14
+ /** Avisa cada abertura e fechamento pedidos pelo gatilho, pelo teclado, pela opcao ou pelo clique fora. */
15
+ onOpenChange?: (open: boolean) => void;
16
+ /** Controla a abertura; sem ele, o menu guarda o proprio estado. */
17
+ open?: boolean;
12
18
  }
13
- export declare function Menu({ children, items, label }: MenuProps): import("react").JSX.Element;
19
+ export declare function Menu({ children, defaultOpen, items, label, onOpenChange, open: controlledOpen }: MenuProps): import("react").JSX.Element;
@@ -1,8 +1,7 @@
1
- import { type ReactNode, type RefObject } from 'react';
1
+ import { type ComponentPropsWithRef, type ReactNode, type RefObject } from 'react';
2
2
  export type PopoverPlacement = 'top' | 'top start' | 'top end' | 'bottom' | 'bottom start' | 'bottom end' | 'left' | 'right';
3
- export interface PopoverProps {
4
- 'aria-label'?: string;
5
- 'aria-labelledby'?: string;
3
+ /** As propriedades nativas vao ao elemento do painel; o `className` soma ao do sistema. */
4
+ export interface PopoverProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
6
5
  children: ReactNode;
7
6
  offset?: number;
8
7
  onClose: () => void;
@@ -0,0 +1,19 @@
1
+ import { type ChangeEvent } from 'react';
2
+ interface DecimalInputOptions {
3
+ decimalScale: number;
4
+ defaultValue: string | number;
5
+ onValueChange?: (value: string) => void;
6
+ value?: string | number;
7
+ }
8
+ /**
9
+ * Estado dos campos decimais: o valor, controlado ou nao, e o texto que a
10
+ * pessoa esta digitando, que pode ainda guardar um ponto sem papel decidido.
11
+ */
12
+ export declare function useDecimalInput({ decimalScale, defaultValue, onValueChange, value }: DecimalInputOptions): {
13
+ ref: import("react").RefObject<HTMLInputElement | null>;
14
+ value: string;
15
+ text: string;
16
+ handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
17
+ endEditing: () => void;
18
+ };
19
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type Ref } from 'react';
2
+ /**
3
+ * Junta o ref interno ao que veio de fora numa funcao estavel, que devolve a limpeza do React 19.
4
+ * Nova a cada render, ela desligava e religava o elemento em todo render.
5
+ */
6
+ export declare function useMergedRefs<T>(...refs: readonly (Ref<T> | undefined)[]): (node: T | null) => () => void;
@@ -17,6 +17,7 @@ export interface UseSelectionResult extends SelectionState {
17
17
  focusLast: (extend?: boolean) => void;
18
18
  focusNext: (extend?: boolean) => void;
19
19
  focusPrevious: (extend?: boolean) => void;
20
+ reset: () => void;
20
21
  search: (character: string) => void;
21
22
  select: (key: string) => void;
22
23
  selectRange: (key: string) => void;
@@ -1,4 +1,4 @@
1
- export { IconArrowDown, IconArrowUp, IconCalendar, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconClock, IconClose, IconMinusCircle, IconPlusCircle, } from './components/icons/index.js';
1
+ export { IconArrowDown, IconArrowUp, IconCalendar, IconChevronDown, IconChevronExpand, IconChevronLeft, IconChevronRight, IconChevronUp, IconClock, IconClose, IconMinusCircle, IconPlusCircle, IconQuestionCircle, } from './components/icons/index.js';
2
2
  export type { IconProps } from './components/icons/index.js';
3
3
  export { Button } from './components/actions/Button/index.js';
4
4
  export type { ButtonProps, ButtonSize, ButtonVariant } from './components/actions/Button/index.js';
@@ -41,13 +41,13 @@ export type { AccordionProps, AccordionItem, AccordionIconPosition } from './com
41
41
  export { Select } from './components/forms/Select/index.js';
42
42
  export type { SelectProps, SelectOption, SelectSize } from './components/forms/Select/index.js';
43
43
  export { ComboBox } from './components/forms/ComboBox/index.js';
44
- export type { ComboBoxProps, ComboBoxOption, ComboBoxSize } from './components/forms/ComboBox/index.js';
44
+ export type { ComboBoxMultipleProps, ComboBoxOption, ComboBoxProps, ComboBoxSingleProps, ComboBoxSize, } from './components/forms/ComboBox/index.js';
45
45
  export { Menu } from './components/overlays/Menu/index.js';
46
46
  export type { MenuProps, MenuItem } from './components/overlays/Menu/index.js';
47
47
  export { Tooltip } from './components/overlays/Tooltip/index.js';
48
48
  export type { TooltipProps, TooltipPlacement } from './components/overlays/Tooltip/index.js';
49
49
  export { Dialog } from './components/overlays/Dialog/index.js';
50
- export type { DialogProps, DialogSize } from './components/overlays/Dialog/index.js';
50
+ export type { DialogProps, DialogRole, DialogSize } from './components/overlays/Dialog/index.js';
51
51
  export { Badge } from './components/data-display/Badge/index.js';
52
52
  export type { BadgeProps, BadgeTone } from './components/data-display/Badge/index.js';
53
53
  export { Avatar } from './components/data-display/Avatar/index.js';
@@ -1 +1,6 @@
1
1
  export declare function formatarEntradaDecimal(valor: string | number, casasDecimais?: number): string;
2
+ /**
3
+ * O texto do campo enquanto se digita: o ponto que ainda pode virar milhar na proxima tecla fica como foi digitado, e
4
+ * o valor o le como decimal ate la. Decidido na hora, `1.234` virava `1,23`.
5
+ */
6
+ export declare function formatarEdicaoDecimal(texto: string, casasDecimais?: number): string;
@@ -0,0 +1,7 @@
1
+ import { CalendarDateTime, Time } from '@internationalized/date';
2
+ /** Aplica a mascara hora:minuto conforme o usuario digita. */
3
+ export declare function formatarEntradaHora(valor: string): string;
4
+ export declare function lerEntradaHora(valor: string): Time | undefined;
5
+ /** Aplica a mascara dia/mes/ano hora:minuto conforme o usuario digita. */
6
+ export declare function formatarEntradaDataHora(valor: string): string;
7
+ export declare function lerEntradaDataHora(valor: string): CalendarDateTime | undefined;
@@ -1,7 +1,8 @@
1
- export { formatarEntradaDecimal } from './formatarEntradaDecimal.js';
1
+ export { formatarEdicaoDecimal, formatarEntradaDecimal } from './formatarEntradaDecimal.js';
2
2
  export { formatarEntradaMonetaria } from './formatarEntradaMonetaria.js';
3
3
  export { formatarData, formatarHora } from './formatarData.js';
4
4
  export type { OpcoesDeData, OpcoesDeHora } from './formatarData.js';
5
5
  export { formatarMoeda, formatarNumero, formatarPercentual } from './formatarNumero.js';
6
6
  export type { OpcoesDeMoeda, OpcoesDeNumero, OpcoesDePercentual } from './formatarNumero.js';
7
7
  export { formatarEntradaData, lerEntradaData } from './formatarEntradaData.js';
8
+ export { formatarEntradaDataHora, formatarEntradaHora, lerEntradaDataHora, lerEntradaHora } from './formatarEntradaHora.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Mascara de partes com limite de digitos, como dia/mes/ano. O separador digitado fecha a parte antes
3
+ * de encher, e ninguem empurra digito para a vizinha; sem ele, o excesso passa para a parte seguinte.
4
+ */
5
+ export declare function mascararPartes(valor: string, limites: readonly number[], separadores: readonly string[]): string;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@plenustech/design-system",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Design System centralizado para os produtos web da Plenustech.",
5
+ "license": "UNLICENSED",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
@@ -42,7 +43,7 @@
42
43
  "check:pacote": "node scripts/check-pacote.mjs",
43
44
  "check:contraste": "node scripts/check-contraste.mjs",
44
45
  "prepare": "npm run build:pacote",
45
- "build:showcase": "vite build --config showcase/vite.config.ts",
46
+ "build:showcase": "npm run build:pacote && vite build --config showcase/vite.config.ts",
46
47
  "test": "vitest run",
47
48
  "test:watch": "vitest",
48
49
  "test:coverage": "vitest run --coverage",
@@ -1,7 +0,0 @@
1
- import type { Ref } from 'react';
2
- /**
3
- * Junta o ref interno do componente ao que veio de fora. Sem isto, um dos dois
4
- * se perde: o interno, porque `{...props}` o sobrescreve, ou o de fora, porque
5
- * o componente aplica o seu depois.
6
- */
7
- export declare function mergeRefs<T>(...refs: readonly (Ref<T> | undefined)[]): (node: T | null) => void;