@directo-ui/web 1.2.0 → 1.4.0

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.
@@ -0,0 +1,126 @@
1
+ import { forwardRef as e } from "react";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import * as i from "@radix-ui/react-tabs";
4
+ //#region src/components/Button.tsx
5
+ var a = e(function({ variant: e = "primary", size: t = "md", disabled: i = !1, loading: a = !1, fullWidth: o = !1, leftIcon: s, rightIcon: c, children: l, type: u = "button", className: d = "", ...f }, p) {
6
+ return /* @__PURE__ */ r("button", {
7
+ ...f,
8
+ ref: p,
9
+ type: u,
10
+ disabled: i || a,
11
+ "aria-busy": a || void 0,
12
+ "data-variant": e,
13
+ "data-size": t,
14
+ "data-full-width": o || void 0,
15
+ className: `ds-button ${d}`.trim(),
16
+ children: [
17
+ a ? /* @__PURE__ */ n("span", {
18
+ className: "ds-spinner",
19
+ "data-size": "sm",
20
+ "aria-hidden": "true"
21
+ }) : s && /* @__PURE__ */ n("span", {
22
+ className: "ds-button-icon",
23
+ "aria-hidden": "true",
24
+ children: s
25
+ }),
26
+ l,
27
+ c && !a && /* @__PURE__ */ n("span", {
28
+ className: "ds-button-icon",
29
+ "aria-hidden": "true",
30
+ children: c
31
+ })
32
+ ]
33
+ });
34
+ });
35
+ //#endregion
36
+ //#region src/components/Tabs.tsx
37
+ function o({ defaultValue: e, value: t, onValueChange: r, orientation: a = "horizontal", children: o }) {
38
+ return /* @__PURE__ */ n(i.Root, {
39
+ className: "ds-tabs",
40
+ defaultValue: e,
41
+ value: t,
42
+ onValueChange: r,
43
+ orientation: a,
44
+ children: o
45
+ });
46
+ }
47
+ function s({ variant: e = "default", children: t }) {
48
+ return /* @__PURE__ */ n(i.List, {
49
+ className: "ds-tabs-list",
50
+ "data-variant": e,
51
+ children: t
52
+ });
53
+ }
54
+ function c({ value: e, disabled: t, children: r }) {
55
+ return /* @__PURE__ */ n(i.Trigger, {
56
+ value: e,
57
+ disabled: t,
58
+ className: "ds-tab",
59
+ children: r
60
+ });
61
+ }
62
+ function l({ value: e, children: t }) {
63
+ return /* @__PURE__ */ n(i.Content, {
64
+ value: e,
65
+ className: "ds-tab-panel",
66
+ children: t
67
+ });
68
+ }
69
+ //#endregion
70
+ //#region src/components/FieldLabel.tsx
71
+ function u({ required: e = !1, as: i = "label", children: a, htmlFor: o, form: s, ...c }) {
72
+ let l = /* @__PURE__ */ r(t, { children: [a, e && /* @__PURE__ */ n("span", {
73
+ className: "ds-input-required",
74
+ "aria-hidden": "true",
75
+ children: "*"
76
+ })] });
77
+ return i === "legend" ? /* @__PURE__ */ n("legend", {
78
+ ...c,
79
+ children: l
80
+ }) : /* @__PURE__ */ n("label", {
81
+ ...c,
82
+ htmlFor: o,
83
+ form: s,
84
+ children: l
85
+ });
86
+ }
87
+ //#endregion
88
+ //#region src/components/Chip.tsx
89
+ var d = e(function({ pressed: e, removable: t = !1, size: i = "md", type: a = "button", className: o, children: s, ...c }, l) {
90
+ return /* @__PURE__ */ r("button", {
91
+ ...c,
92
+ ref: l,
93
+ type: a,
94
+ "aria-pressed": e,
95
+ "data-size": i === "md" ? void 0 : i,
96
+ className: ["ds-chip", o].filter(Boolean).join(" "),
97
+ children: [s, t && /* @__PURE__ */ n("span", {
98
+ className: "ds-chip-remove",
99
+ "aria-hidden": "true",
100
+ children: "×"
101
+ })]
102
+ });
103
+ });
104
+ //#endregion
105
+ //#region src/components/ChipGroup.tsx
106
+ function f({ label: e, options: t, value: r, onChange: i, variant: a = "default", size: o = "md", className: s }) {
107
+ return /* @__PURE__ */ n("div", {
108
+ role: "group",
109
+ "aria-label": e,
110
+ className: ["ds-chip-group", s].filter(Boolean).join(" "),
111
+ "data-variant": a,
112
+ children: t.map((e) => /* @__PURE__ */ n(d, {
113
+ size: o,
114
+ pressed: e.value === r,
115
+ disabled: e.disabled,
116
+ onClick: () => {
117
+ e.value !== r && i?.(e.value);
118
+ },
119
+ children: e.label
120
+ }, e.value))
121
+ });
122
+ }
123
+ //#endregion
124
+ export { s as a, a as c, c as i, d as n, l as o, u as r, o as s, f as t };
125
+
126
+ //# sourceMappingURL=ChipGroup-DkJz118c.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipGroup-DkJz118c.js","names":["_Fragment","TabsPrimitive","Button","forwardRef","props","disabled","loading","variant","size","fullWidth","className","leftIcon","children","rightIcon","Tabs","TabList","Tab","TabPanel","FieldLabel","content","Fragment","required","as","Chip","pressed","removable","ChipGroup","label","options","option","value","onChange"],"sources":["../src/components/Button.tsx","../src/components/Tabs.tsx","../src/components/FieldLabel.tsx","../src/components/Chip.tsx","../src/components/ChipGroup.tsx"],"sourcesContent":["import { forwardRef } from 'react';\r\nimport type { ButtonProps } from '../core';\r\n\r\n/** Native button: forms, keyboard, refs and every standard HTML attribute keep working. */\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button({\r\n variant = 'primary', size = 'md', disabled = false, loading = false,\r\n fullWidth = false, leftIcon, rightIcon, children, type = 'button', className = '', ...props\r\n}, ref) {\r\n return (\r\n <button {...props} ref={ref} type={type} disabled={disabled || loading}\r\n aria-busy={loading || undefined} data-variant={variant} data-size={size}\r\n data-full-width={fullWidth || undefined}\r\n className={`ds-button ${className}`.trim()}>\r\n {loading ? <span className=\"ds-spinner\" data-size=\"sm\" aria-hidden=\"true\" />\r\n : leftIcon && <span className=\"ds-button-icon\" aria-hidden=\"true\">{leftIcon}</span>}\r\n {children}\r\n {rightIcon && !loading && <span className=\"ds-button-icon\" aria-hidden=\"true\">{rightIcon}</span>}\r\n </button>\r\n );\r\n});\r\n","import * as TabsPrimitive from '@radix-ui/react-tabs';\r\nimport type { TabsProps, TabListProps, TabProps, TabPanelProps } from '../core';\r\n\r\n/** Accessible tabs (Radix): arrow keys move between tabs, Tab moves into the panel. */\r\nexport function Tabs({ defaultValue, value, onValueChange, orientation = 'horizontal', children }: TabsProps) {\r\n return (\r\n <TabsPrimitive.Root className=\"ds-tabs\" defaultValue={defaultValue} value={value} onValueChange={onValueChange} orientation={orientation}>\r\n {children}\r\n </TabsPrimitive.Root>\r\n );\r\n}\r\nexport function TabList({ variant = 'default', children }: TabListProps) {\r\n return <TabsPrimitive.List className=\"ds-tabs-list\" data-variant={variant}>{children}</TabsPrimitive.List>;\r\n}\r\nexport function Tab({ value, disabled, children }: TabProps) {\r\n return <TabsPrimitive.Trigger value={value} disabled={disabled} className=\"ds-tab\">{children}</TabsPrimitive.Trigger>;\r\n}\r\nexport function TabPanel({ value, children }: TabPanelProps) {\r\n return <TabsPrimitive.Content value={value} className=\"ds-tab-panel\">{children}</TabsPrimitive.Content>;\r\n}\r\n","import type { HTMLAttributes, LabelHTMLAttributes } from 'react';\n\nexport interface FieldLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Adds the red asterisk (hidden from screen readers: the field itself is marked required). */\n required?: boolean;\n /** Use legend inside a fieldset (groups of fields such as DateRangePicker). */\n as?: 'label' | 'legend';\n}\n\n/** Atom: label of every form field (TextField, Textarea, FileUpload, Wari fields…) with the required mark. */\nexport function FieldLabel({ required = false, as = 'label', children, htmlFor, form, ...props }: FieldLabelProps) {\n const content = <>{children}{required && <span className=\"ds-input-required\" aria-hidden=\"true\">*</span>}</>;\n return as === 'legend'\n ? <legend {...(props as unknown as HTMLAttributes<HTMLLegendElement>)}>{content}</legend>\n : <label {...props} htmlFor={htmlFor} form={form}>{content}</label>;\n}\n","import { forwardRef } from 'react';\nimport type { ButtonHTMLAttributes } from 'react';\n\nexport interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Toggle chip (aria-pressed), for example a quick range that is active. */\n pressed?: boolean;\n /** Shows × after the text: the whole chip removes something (give it an aria-label such as \"Quitar filtro: …\"). */\n removable?: boolean;\n size?: 'sm' | 'md';\n}\n\n/** Atom: rounded button used for active filters (FilterBar) and quick options (DateRangePicker presets). */\nexport const Chip = forwardRef<HTMLButtonElement, ChipProps>(function Chip({\n pressed, removable = false, size = 'md', type = 'button', className, children, ...props\n}, ref) {\n return <button {...props} ref={ref} type={type} aria-pressed={pressed} data-size={size === 'md' ? undefined : size}\n className={['ds-chip', className].filter(Boolean).join(' ')}>\n {children}{removable && <span className=\"ds-chip-remove\" aria-hidden=\"true\">×</span>}\n </button>;\n});\n","import { Chip } from './Chip';\n\nexport interface ChipGroupOption { value: string; label: string; disabled?: boolean }\n\nexport interface ChipGroupProps {\n /** Accessible name of the group, for example \"Tipo de mensaje\". */\n label: string;\n options: readonly ChipGroupOption[];\n /** Selected option (single selection). */\n value?: string;\n onChange?: (value: string) => void;\n /** brand: blue outline chips that share the width (Figma \"Todos / Del conductor…\"). */\n variant?: 'default' | 'brand';\n size?: 'sm' | 'md';\n className?: string;\n}\n\n/** Atom group: one option at a time, built with Chip (aria-pressed shows the selected one). */\nexport function ChipGroup({ label, options, value, onChange, variant = 'default', size = 'md', className }: ChipGroupProps) {\n return <div role=\"group\" aria-label={label} className={['ds-chip-group', className].filter(Boolean).join(' ')} data-variant={variant}>\n {options.map(option => <Chip key={option.value} size={size} pressed={option.value === value} disabled={option.disabled}\n onClick={() => { if (option.value !== value) onChange?.(option.value); }}>{option.label}</Chip>)}\n </div>;\n}\n"],"mappings":";;;;AAIA,IAAaE,IAASC,EAA2C,SAAgB,EAC/E,aAAU,WAAW,UAAO,MAAM,cAAW,IAAO,aAAU,IAC9D,eAAY,IAAO,aAAU,cAAW,aAAU,UAAO,UAAU,eAAY,IAAI,GAAGC,KACrF,GAAK;CACN,OACE,kBAAC,UAAD;EAAQ,GAAIA;EAAY;EAAW;EAAM,UAAUC,KAAYC;EAC7D,aAAWA,KAAW,KAAA;EAAW,gBAAcC;EAAS,aAAWC;EACnE,mBAAiBC,KAAa,KAAA;EAC9B,WAAW,aAAaC,IAAY,KAAK;EAH3C,UAAA;GAIGJ,IAAU,kBAAC,QAAD;IAAM,WAAU;IAAa,aAAU;IAAK,eAAY;GAAQ,CAAA,IACvEK,KAAY,kBAAC,QAAD;IAAM,WAAU;IAAiB,eAAY;IAAQ,UAAAA;GAAe,CAAA;GACnFC;GACAC,KAAa,CAACP,KAAW,kBAAC,QAAD;IAAM,WAAU;IAAiB,eAAY;IAAQ,UAAAO;GAAgB,CAAA;EACzF;;AAEZ,CAAC;;;ACfD,SAAgBC,EAAK,EAAE,iBAAc,UAAO,kBAAe,iBAAc,cAAc,eAAuB;CAC5G,OACE,kBAACb,EAAc,MAAf;EAAoB,WAAU;EAAwB;EAAqB;EAAsB;EAA4B;EAC1H;CACiB,CAAA;AAExB;AACA,SAAgBc,EAAQ,EAAE,aAAU,WAAW,eAA0B;CACvE,OAAO,kBAACd,EAAc,MAAf;EAAoB,WAAU;EAAe,gBAAcM;EAAU;CAA6B,CAAA;AAC3G;AACA,SAAgBS,EAAI,EAAE,UAAO,aAAU,eAAsB;CAC3D,OAAO,kBAACf,EAAc,SAAf;EAA8B;EAAiB;EAAU,WAAU;EAAU;CAAgC,CAAA;AACtH;AACA,SAAgBgB,EAAS,EAAE,UAAO,eAA2B;CAC3D,OAAO,kBAAChB,EAAc,SAAf;EAA8B;EAAO,WAAU;EAAgB;CAAgC,CAAA;AACxG;;;ACTA,SAAgBiB,EAAW,EAAE,cAAW,IAAO,QAAK,SAAS,aAAU,YAAS,SAAM,GAAGd,KAA0B;CACjH,IAAMe,IAAU,kBAAAnB,GAAA,EAAA,UAAA,CAAGY,GAAUS,KAAY,kBAAC,QAAD;EAAM,WAAU;EAAoB,eAAY;EAAO,UAAA;CAAO,CAAA,CAAI,EAAA,CAAA;CAC3G,OAAOC,MAAO,WACV,kBAAC,UAAD;EAAQ,GAAKlB;EAAyD,UAAAe;CAAgB,CAAA,IACtF,kBAAC,SAAD;EAAO,GAAIf;EAAgB;EAAe;EAAO,UAAAe;CAAe,CAAA;AACtE;;;ACHA,IAAaI,IAAOpB,EAAyC,SAAc,EACzE,YAAS,eAAY,IAAO,UAAO,MAAM,UAAO,UAAU,cAAW,aAAU,GAAGC,KACjF,GAAK;CACN,OAAO,kBAAC,UAAD;EAAQ,GAAIA;EAAY;EAAW;EAAM,gBAAcoB;EAAS,aAAWhB,MAAS,OAAO,KAAA,IAAYA;EAC5G,WAAW,CAAC,WAAWE,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EADrD,UAAA,CAEJE,GAAUa,KAAa,kBAAC,QAAD;GAAM,WAAU;GAAiB,eAAY;GAAO,UAAA;EAAO,CAAA,CAC7E;;AACV,CAAC;;;ACDD,SAAgBC,EAAU,EAAE,UAAO,YAAS,UAAO,aAAU,aAAU,WAAW,UAAO,MAAM,gBAA6B;CAC1H,OAAO,kBAAC,OAAD;EAAK,MAAK;EAAQ,cAAYC;EAAO,WAAW,CAAC,iBAAiBjB,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAG,gBAAcH;EAC1H,UAAAqB,EAAQ,KAAI,MAAU,kBAACL,GAAD;GAA+B;GAAM,SAASM,EAAO,UAAUC;GAAO,UAAUD,EAAO;GAC5G,eAAe;IAAE,AAAIA,EAAO,UAAUC,KAAOC,IAAWF,EAAO,KAAK;GAAG;GAAI,UAAAA,EAAO;EAAY,GAD9DA,EAAO,KACuD,CAAC;CAC9F,CAAA;AACP"}
@@ -9,8 +9,10 @@ export interface AccordionItemProps {
9
9
  disabled?: boolean;
10
10
  /** Items sharing a name behave exclusively (only one open) in modern browsers. */
11
11
  name?: string;
12
+ /** Called when the item opens or closes (also when another item of the same name closes it). */
13
+ onOpenChange?: (open: boolean) => void;
12
14
  children: ReactNode;
13
15
  }
14
16
  /** Built on native <details>/<summary>: keyboard and screen-reader support without JS. */
15
17
  export declare function Accordion({ variant, children }: AccordionProps): import("react").JSX.Element;
16
- export declare function AccordionItem({ title, defaultOpen, disabled, name, children }: AccordionItemProps): import("react").JSX.Element;
18
+ export declare function AccordionItem({ title, defaultOpen, disabled, name, onOpenChange, children }: AccordionItemProps): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { TextFieldProps } from './TextField.js';
2
+ export interface AutocompleteProps extends Omit<TextFieldProps, 'list' | 'type' | 'onSelect'> {
3
+ options: readonly string[];
4
+ /** The value matches one of the options (picked from the list or typed in full). */
5
+ onSelect?: (option: string) => void;
6
+ /** Typing pause, to load options from your API. Fires after debounceMs and only with minChars or more. */
7
+ onSearch?: (query: string) => void;
8
+ debounceMs?: number;
9
+ minChars?: number;
10
+ /** Shows "Buscando…" while you load options. */
11
+ loading?: boolean;
12
+ loadingText?: string;
13
+ /** When false, leaving the field with a value that is not in the list shows invalidMessage. */
14
+ allowCustomValue?: boolean;
15
+ invalidMessage?: string;
16
+ }
17
+ export declare function Autocomplete({ options, onSelect, onSearch, debounceMs, minChars, loading, loadingText, allowCustomValue, invalidMessage, onChange, onBlur, error, supportingText, ...props }: AutocompleteProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface CellTextProps {
3
+ /** Main line (address, client, date…). */
4
+ children: ReactNode;
5
+ /** Second, smaller line (district, user, time…). */
6
+ secondary?: ReactNode;
7
+ /** accent paints the second line purple, as the night times in Figma. */
8
+ tone?: 'default' | 'accent';
9
+ /** Strikes the main line (cancelled services). */
10
+ strike?: boolean;
11
+ className?: string;
12
+ }
13
+ /** Atom: two-line table cell, each line cut at two lines with an ellipsis. */
14
+ export declare function CellText({ children, secondary, tone, strike, className }: CellTextProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { ButtonHTMLAttributes } from 'react';
2
+ export interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ /** Toggle chip (aria-pressed), for example a quick range that is active. */
4
+ pressed?: boolean;
5
+ /** Shows × after the text: the whole chip removes something (give it an aria-label such as "Quitar filtro: …"). */
6
+ removable?: boolean;
7
+ size?: 'sm' | 'md';
8
+ }
9
+ /** Atom: rounded button used for active filters (FilterBar) and quick options (DateRangePicker presets). */
10
+ export declare const Chip: import("react").ForwardRefExoticComponent<ChipProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,19 @@
1
+ export interface ChipGroupOption {
2
+ value: string;
3
+ label: string;
4
+ disabled?: boolean;
5
+ }
6
+ export interface ChipGroupProps {
7
+ /** Accessible name of the group, for example "Tipo de mensaje". */
8
+ label: string;
9
+ options: readonly ChipGroupOption[];
10
+ /** Selected option (single selection). */
11
+ value?: string;
12
+ onChange?: (value: string) => void;
13
+ /** brand: blue outline chips that share the width (Figma "Todos / Del conductor…"). */
14
+ variant?: 'default' | 'brand';
15
+ size?: 'sm' | 'md';
16
+ className?: string;
17
+ }
18
+ /** Atom group: one option at a time, built with Chip (aria-pressed shows the selected one). */
19
+ export declare function ChipGroup({ label, options, value, onChange, variant, size, className }: ChipGroupProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { ButtonHTMLAttributes } from 'react';
2
+ export interface CloseButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ /** Accessible name, for example "Cerrar alerta". */
4
+ label?: string;
5
+ /** xs 26px (icon 14), sm 28px (16), md 32px (18), lg 40px (20). */
6
+ size?: 'xs' | 'sm' | 'md' | 'lg';
7
+ }
8
+ /** Path of the X icon (Phosphor, 256 viewBox): the same icon in React, Angular and Astro. */
9
+ export declare const closeIconPath = "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z";
10
+ /**
11
+ * Atom: the × button of Alert, Toast, Dialog, BottomSheet and Drawer. Native button, so it works inside
12
+ * Radix `Close asChild` and forwards every attribute and event.
13
+ */
14
+ export declare const CloseButton: import("react").ForwardRefExoticComponent<CloseButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,60 @@
1
+ import type { Key, KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
+ export type DataTableSortDirection = 'ascending' | 'descending';
3
+ export interface DataTableSort {
4
+ id: string;
5
+ direction: DataTableSortDirection;
6
+ }
7
+ export interface DataTableColumn<Row> {
8
+ id: string;
9
+ label: string;
10
+ cell: (row: Row) => ReactNode;
11
+ sortValue?: (row: Row) => string | number;
12
+ /** Text alignment of the column (numbers and amounts read better at the end). */
13
+ align?: 'start' | 'center' | 'end';
14
+ }
15
+ export interface DataTableProps<Row> {
16
+ caption: string;
17
+ columns: readonly DataTableColumn<Row>[];
18
+ rows: readonly Row[];
19
+ rowKey: (row: Row) => Key;
20
+ loading?: boolean;
21
+ loadingMessage?: string;
22
+ emptyMessage?: string;
23
+ pagination?: {
24
+ page: number;
25
+ onPageChange: (page: number) => void;
26
+ } & ({
27
+ pageSize: number;
28
+ totalPages?: never;
29
+ } | {
30
+ totalPages: number;
31
+ pageSize?: never;
32
+ });
33
+ /** Controlled sort. Pass null for no sort. */
34
+ sort?: DataTableSort | null;
35
+ /** Initial sort when the table controls it. */
36
+ defaultSort?: DataTableSort;
37
+ /** Called when a sortable header is pressed. With pageSize pagination the table also goes back to page 1. */
38
+ onSortChange?: (sort: DataTableSort) => void;
39
+ /** Do not reorder the rows locally (the server already sorts them using onSortChange). */
40
+ manualSort?: boolean;
41
+ /** Makes every row clickable (mouse, Enter or Space). Clicks on links, buttons or fields inside the row are ignored. */
42
+ onRowClick?: (row: Row, event: MouseEvent<HTMLTableRowElement> | KeyboardEvent<HTMLTableRowElement>) => void;
43
+ density?: 'comfortable' | 'compact';
44
+ /** soft: light blue header, 60px rows without lines (Wari tables). */
45
+ variant?: 'default' | 'soft';
46
+ /** Rows shown at half opacity, for example cancelled services. */
47
+ rowMuted?: (row: Row) => boolean;
48
+ /** Totals bar under the table, for example [{ label: 'Total resultados', value: 18 }]. */
49
+ summary?: readonly {
50
+ label: string;
51
+ value: ReactNode;
52
+ }[];
53
+ /** Maximum height of the scroll area (the header stays visible). */
54
+ maxHeight?: number | string;
55
+ /** Keeps the header visible while the table scrolls (give the table a max height with CSS). */
56
+ stickyHeader?: boolean;
57
+ id?: string;
58
+ className?: string;
59
+ }
60
+ export declare function DataTable<Row>({ caption, columns, rows, rowKey, loading, loadingMessage, emptyMessage, pagination, sort: sortProp, defaultSort, onSortChange, manualSort, onRowClick, density, stickyHeader, variant, rowMuted, summary, maxHeight, id, className, }: DataTableProps<Row>): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ export interface DateRange {
2
+ start: string;
3
+ end: string;
4
+ }
5
+ export interface DateRangePreset {
6
+ label: string;
7
+ range: DateRange;
8
+ }
9
+ export interface DateRangePickerProps {
10
+ label?: string;
11
+ startLabel?: string;
12
+ endLabel?: string;
13
+ /** Controlled value (YYYY-MM-DD). Leave it out and use defaultValue to let the picker keep its own state. */
14
+ value?: DateRange;
15
+ defaultValue?: DateRange;
16
+ /** Every change of either date. */
17
+ onChange?: (value: DateRange) => void;
18
+ /** Both dates are filled and the end is not before the start: a good moment to search or load a report. */
19
+ onComplete?: (value: DateRange) => void;
20
+ min?: string;
21
+ max?: string;
22
+ startName?: string;
23
+ endName?: string;
24
+ required?: boolean;
25
+ disabled?: boolean;
26
+ /** Your own error message. Without it the picker still warns when the end is before the start. */
27
+ error?: string;
28
+ /** Quick ranges shown as buttons, for example Hoy or Últimos 7 días. */
29
+ presets?: readonly DateRangePreset[];
30
+ id?: string;
31
+ className?: string;
32
+ }
33
+ export declare function DateRangePicker({ label, startLabel, endLabel, value: valueProp, defaultValue, onChange, onComplete, min, max, startName, endName, required, disabled, error, presets, id: idProp, className, }: DateRangePickerProps): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface DrawerProps {
3
+ title: string;
4
+ /** Optional text under the title; screen readers announce it with the title. */
5
+ description?: string;
6
+ /** Controlled state. Leave it out (and use defaultOpen) to let the drawer open and close by itself. */
7
+ open?: boolean;
8
+ defaultOpen?: boolean;
9
+ onOpenChange?: (open: boolean) => void;
10
+ side?: 'start' | 'end';
11
+ /** Width: sm 360px, md 440px, lg 640px (never wider than the screen). */
12
+ size?: 'sm' | 'md' | 'lg';
13
+ trigger?: ReactNode;
14
+ /** Fixed area under the content, for actions such as Guardar or Cancelar. */
15
+ footer?: ReactNode;
16
+ /** Close when the dimmed backdrop is clicked. */
17
+ closeOnBackdrop?: boolean;
18
+ closeOnEscape?: boolean;
19
+ closeLabel?: string;
20
+ className?: string;
21
+ children: ReactNode;
22
+ }
23
+ export declare function Drawer({ title, description, open: openProp, defaultOpen, onOpenChange, side, size, trigger, footer, closeOnBackdrop, closeOnEscape, closeLabel, className, children, }: DrawerProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { LabelHTMLAttributes } from 'react';
2
+ export interface FieldLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
3
+ /** Adds the red asterisk (hidden from screen readers: the field itself is marked required). */
4
+ required?: boolean;
5
+ /** Use legend inside a fieldset (groups of fields such as DateRangePicker). */
6
+ as?: 'label' | 'legend';
7
+ }
8
+ /** Atom: label of every form field (TextField, Textarea, FileUpload, Wari fields…) with the required mark. */
9
+ export declare function FieldLabel({ required, as, children, htmlFor, form, ...props }: FieldLabelProps): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { FileRejection } from '../core/files.js';
2
+ export interface FileUploadProps {
3
+ label: string;
4
+ name?: string;
5
+ accept?: string;
6
+ multiple?: boolean;
7
+ /** Maximum size of each file, in bytes. */
8
+ maxBytes?: number;
9
+ /** Maximum number of files (with multiple). */
10
+ maxFiles?: number;
11
+ required?: boolean;
12
+ disabled?: boolean;
13
+ /** Help text under the label, for example "PDF o imagen, hasta 2 MB". */
14
+ supportingText?: string;
15
+ /** Allows dropping files onto the component. */
16
+ dropzone?: boolean;
17
+ id?: string;
18
+ className?: string;
19
+ /** Every time the list of valid files changes (select, drop or remove). */
20
+ onFilesChange?: (files: readonly File[]) => void;
21
+ /** Files that were left out and why (type, size or count). */
22
+ onReject?: (rejections: readonly FileRejection[]) => void;
23
+ /** A file was removed with its Quitar button. */
24
+ onFileRemove?: (file: File) => void;
25
+ }
26
+ export declare function FileUpload({ label, name, accept, multiple, maxBytes, maxFiles, required, disabled, supportingText, dropzone, id: idProp, className, onFilesChange, onReject, onFileRemove, }: FileUploadProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { FormEvent, ReactNode } from 'react';
2
+ export interface ActiveFilter {
3
+ id: string;
4
+ label: string;
5
+ /** Removes this filter. You can also handle every filter at once with onFilterRemove. */
6
+ onRemove?: () => void;
7
+ }
8
+ export interface FilterBarProps {
9
+ label?: string;
10
+ children: ReactNode;
11
+ activeFilters?: readonly ActiveFilter[];
12
+ /** Called with the id of the removed filter (after its own onRemove). */
13
+ onFilterRemove?: (id: string) => void;
14
+ /** Shows the "Limpiar filtros" button. */
15
+ onClear?: () => void;
16
+ clearLabel?: string;
17
+ /** Number of results; it is announced to screen readers when it changes. */
18
+ resultCount?: number;
19
+ resultLabel?: (count: number) => string;
20
+ /** Renders the bar as a search form: Enter in a field submits it with the values of the named fields. */
21
+ onSubmit?: (data: FormData, event: FormEvent<HTMLFormElement>) => void;
22
+ /** Extra actions at the end of the bar (for example Exportar). */
23
+ actions?: ReactNode;
24
+ id?: string;
25
+ className?: string;
26
+ }
27
+ export declare function FilterBar({ label, children, activeFilters, onFilterRemove, onClear, clearLabel, resultCount, resultLabel, onSubmit, actions, id, className, }: FilterBarProps): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import type { MouseEvent, ReactNode } from 'react';
2
+ export interface SidebarLink {
3
+ label: string;
4
+ href: string;
5
+ icon?: ReactNode;
6
+ /** Small counter or text at the end, for example 3 pending trips. */
7
+ badge?: string | number;
8
+ disabled?: boolean;
9
+ }
10
+ export interface SidebarItem extends SidebarLink {
11
+ children?: readonly SidebarLink[];
12
+ }
13
+ export interface SidebarGroup {
14
+ label: string;
15
+ items: readonly SidebarItem[];
16
+ /** The group title opens and closes the group. */
17
+ collapsible?: boolean;
18
+ /** Initial state of a collapsible group (open by default). */
19
+ defaultOpen?: boolean;
20
+ }
21
+ export interface SidebarProps {
22
+ groups: readonly SidebarGroup[];
23
+ activeHref?: string;
24
+ label?: string;
25
+ /** A link was clicked. Call event.preventDefault() to navigate with your router instead. */
26
+ onNavigate?: (item: SidebarLink, event: MouseEvent<HTMLAnchorElement>) => void;
27
+ header?: ReactNode;
28
+ footer?: ReactNode;
29
+ id?: string;
30
+ className?: string;
31
+ }
32
+ export declare function Sidebar({ groups, activeHref, label, onNavigate, header, footer, id, className }: SidebarProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+ export type TimelineVariant = 'default' | 'info' | 'success' | 'warning' | 'error';
3
+ export interface TimelineItem {
4
+ id: string;
5
+ title: string;
6
+ dateTime?: string;
7
+ dateLabel?: string;
8
+ actor?: string;
9
+ description?: ReactNode;
10
+ /** Color of the dot: info, success, warning or error. */
11
+ variant?: TimelineVariant;
12
+ /** Marks the step that is happening now (aria-current="step"). */
13
+ current?: boolean;
14
+ }
15
+ export interface TimelineProps {
16
+ items: readonly TimelineItem[];
17
+ label?: string;
18
+ /** Text shown when there are no events. */
19
+ emptyMessage?: string;
20
+ density?: 'comfortable' | 'compact';
21
+ id?: string;
22
+ className?: string;
23
+ }
24
+ export declare function Timeline({ items, label, emptyMessage, density, id, className }: TimelineProps): import("react").JSX.Element;
@@ -26,3 +26,31 @@ export { paginationRange } from '../core/pagination.js';
26
26
  export { Divider } from './Divider.js';
27
27
  export { ToastProvider } from './Toast.js';
28
28
  export { useToast } from '../core/toast.js';
29
+ export { DataTable } from './DataTable.js';
30
+ export type { DataTableColumn, DataTableProps, DataTableSort, DataTableSortDirection } from './DataTable.js';
31
+ export { FilterBar } from './FilterBar.js';
32
+ export type { ActiveFilter, FilterBarProps } from './FilterBar.js';
33
+ export { Drawer } from './Drawer.js';
34
+ export type { DrawerProps } from './Drawer.js';
35
+ export { FileUpload } from './FileUpload.js';
36
+ export type { FileUploadProps } from './FileUpload.js';
37
+ export { acceptsFile, formatBytes, selectFiles } from '../core/files.js';
38
+ export type { FileRejection, FileRejectionReason, FileRules } from '../core/files.js';
39
+ export { Timeline } from './Timeline.js';
40
+ export type { TimelineItem, TimelineProps, TimelineVariant } from './Timeline.js';
41
+ export { DateRangePicker } from './DateRangePicker.js';
42
+ export type { DateRange, DateRangePickerProps, DateRangePreset } from './DateRangePicker.js';
43
+ export { Autocomplete } from './Autocomplete.js';
44
+ export type { AutocompleteProps } from './Autocomplete.js';
45
+ export { Sidebar } from './Sidebar.js';
46
+ export type { SidebarGroup, SidebarItem, SidebarLink, SidebarProps } from './Sidebar.js';
47
+ export { CloseButton, closeIconPath } from './CloseButton.js';
48
+ export type { CloseButtonProps } from './CloseButton.js';
49
+ export { Chip } from './Chip.js';
50
+ export type { ChipProps } from './Chip.js';
51
+ export { FieldLabel } from './FieldLabel.js';
52
+ export type { FieldLabelProps } from './FieldLabel.js';
53
+ export { ChipGroup } from './ChipGroup.js';
54
+ export type { ChipGroupOption, ChipGroupProps } from './ChipGroup.js';
55
+ export { CellText } from './CellText.js';
56
+ export type { CellTextProps } from './CellText.js';
@@ -0,0 +1,27 @@
1
+ export type FileRejectionReason = 'type' | 'size' | 'count';
2
+ export interface FileRejection {
3
+ file: File;
4
+ reason: FileRejectionReason;
5
+ message: string;
6
+ }
7
+ export interface FileRules {
8
+ /** Same syntax as the input accept attribute: ".pdf", "image/*", "application/pdf". */
9
+ accept?: string;
10
+ /** Maximum size of each file, in bytes. */
11
+ maxBytes?: number;
12
+ /** Maximum number of files kept at once (only with multiple). */
13
+ maxFiles?: number;
14
+ multiple?: boolean;
15
+ }
16
+ /** 1536 → "1.5 KB". */
17
+ export declare function formatBytes(bytes: number): string;
18
+ /** True when the file matches one of the accept rules (or there are none). */
19
+ export declare function acceptsFile(file: Pick<File, 'name' | 'type'>, accept?: string): boolean;
20
+ /**
21
+ * Adds `incoming` to the `current` selection: with multiple the files are appended (without duplicates),
22
+ * otherwise the first valid file replaces the selection. Returns the kept files and why the others were left out.
23
+ */
24
+ export declare function selectFiles(current: readonly File[], incoming: readonly File[], rules?: FileRules): {
25
+ files: File[];
26
+ rejections: FileRejection[];
27
+ };
@@ -10,7 +10,7 @@ export interface TabsProps {
10
10
  children: React.ReactNode;
11
11
  }
12
12
  export interface TabListProps {
13
- variant?: 'default' | 'pills' | 'underline' | 'enclosed';
13
+ variant?: 'default' | 'pills' | 'underline' | 'enclosed' | 'segmented';
14
14
  children: React.ReactNode;
15
15
  }
16
16
  export interface TabProps {