@sia-ui/react-web 0.6.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @sia-ui/react-web
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `Select` : la liste des options défile de nouveau.
8
+
9
+ Le panneau était une grille ; la liste y gardait la hauteur de tout son
10
+ contenu, débordait au lieu de défiler, et l'overlay la coupait. Au-delà d'une
11
+ dizaine d'options, les dernières étaient inatteignables — y compris dans
12
+ `PhoneInput`, la taille de page de `Pagination` et les filtres
13
+ d'`ActivityLog`. L'option active suit aussi le clavier, et le défilement de la
14
+ liste ne se propage plus à la page.
15
+
16
+ - Updated dependencies
17
+ - @sia-ui/headless@0.7.1
18
+ - @sia-ui/react@0.7.1
19
+ - @sia-ui/tokens@0.7.1
20
+ - @sia-ui/utils@0.7.1
21
+
22
+ ## 0.7.0
23
+
24
+ ### Minor Changes
25
+
26
+ - Adaptateur TanStack Router, mises à jour en `PATCH`, et `secretChanges`.
27
+ - **`useDataTableQuery({ router })`** — adaptateur TanStack Router livré et
28
+ testé (`createTanStackRouterStorage`). La recette de la documentation mettait
29
+ `page=2` entre guillemets (`page=%222%22`) et la page retombait à 1 ; les
30
+ nombres passent désormais comme nombres, sans perte pour les filtres.
31
+ - **Un tableau n'écrit plus que ses propres clés** (`mergeTableQuery` dans
32
+ `@sia-ui/headless`) : deux tableaux préfixés sur une page, ou un onglet dans
33
+ l'URL, ne s'effacent plus l'un l'autre — avec l'URL du navigateur comme avec
34
+ un routeur.
35
+ - **`createQueryResource(service, { updateMethod: "PATCH" })`** — pour une API
36
+ qui n'accepte que des mises à jour partielles.
37
+ - **`secretChanges(entries, storedKeys)`** — ce qu'il faut envoyer après une
38
+ saisie dans `SecretFields` : `{ set, remove, missing }`.
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies
43
+ - @sia-ui/react@0.7.0
44
+ - @sia-ui/tokens@0.7.0
45
+ - @sia-ui/utils@0.7.0
46
+ - @sia-ui/headless@0.7.0
47
+
3
48
  ## 0.6.0
4
49
 
5
50
  ### Minor Changes
package/README.md CHANGED
@@ -70,6 +70,51 @@ Le contenu ci-dessous reprend intégralement `CHANGELOG.md` pour rester visible
70
70
  <!-- sia:changelog:start -->
71
71
  # @sia-ui/react-web
72
72
 
73
+ ## 0.7.1
74
+
75
+ ### Patch Changes
76
+
77
+ - `Select` : la liste des options défile de nouveau.
78
+
79
+ Le panneau était une grille ; la liste y gardait la hauteur de tout son
80
+ contenu, débordait au lieu de défiler, et l'overlay la coupait. Au-delà d'une
81
+ dizaine d'options, les dernières étaient inatteignables — y compris dans
82
+ `PhoneInput`, la taille de page de `Pagination` et les filtres
83
+ d'`ActivityLog`. L'option active suit aussi le clavier, et le défilement de la
84
+ liste ne se propage plus à la page.
85
+
86
+ - Updated dependencies
87
+ - @sia-ui/headless@0.7.1
88
+ - @sia-ui/react@0.7.1
89
+ - @sia-ui/tokens@0.7.1
90
+ - @sia-ui/utils@0.7.1
91
+
92
+ ## 0.7.0
93
+
94
+ ### Minor Changes
95
+
96
+ - Adaptateur TanStack Router, mises à jour en `PATCH`, et `secretChanges`.
97
+ - **`useDataTableQuery({ router })`** — adaptateur TanStack Router livré et
98
+ testé (`createTanStackRouterStorage`). La recette de la documentation mettait
99
+ `page=2` entre guillemets (`page=%222%22`) et la page retombait à 1 ; les
100
+ nombres passent désormais comme nombres, sans perte pour les filtres.
101
+ - **Un tableau n'écrit plus que ses propres clés** (`mergeTableQuery` dans
102
+ `@sia-ui/headless`) : deux tableaux préfixés sur une page, ou un onglet dans
103
+ l'URL, ne s'effacent plus l'un l'autre — avec l'URL du navigateur comme avec
104
+ un routeur.
105
+ - **`createQueryResource(service, { updateMethod: "PATCH" })`** — pour une API
106
+ qui n'accepte que des mises à jour partielles.
107
+ - **`secretChanges(entries, storedKeys)`** — ce qu'il faut envoyer après une
108
+ saisie dans `SecretFields` : `{ set, remove, missing }`.
109
+
110
+ ### Patch Changes
111
+
112
+ - Updated dependencies
113
+ - @sia-ui/react@0.7.0
114
+ - @sia-ui/tokens@0.7.0
115
+ - @sia-ui/utils@0.7.0
116
+ - @sia-ui/headless@0.7.0
117
+
73
118
  ## 0.6.0
74
119
 
75
120
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1268,6 +1268,34 @@ function createUrlTableStorage(mode = "replace") {
1268
1268
  }
1269
1269
  };
1270
1270
  }
1271
+ function nombreCanonique(valeur) {
1272
+ const nombre = Number(valeur);
1273
+ return valeur !== "" && Number.isFinite(nombre) && String(nombre) === valeur ? nombre : valeur;
1274
+ }
1275
+ function createTanStackRouterStorage(router, mode = "replace") {
1276
+ return {
1277
+ read: () => {
1278
+ const params = new URLSearchParams();
1279
+ for (const [cle, valeur] of Object.entries(router.state.location.search)) {
1280
+ if (valeur === void 0 || valeur === null) continue;
1281
+ for (const v of Array.isArray(valeur) ? valeur : [valeur]) {
1282
+ params.append(cle, typeof v === "object" ? JSON.stringify(v) : String(v));
1283
+ }
1284
+ }
1285
+ return params.toString();
1286
+ },
1287
+ write: (value) => {
1288
+ const search = {};
1289
+ for (const [cle, brut] of new URLSearchParams(value)) {
1290
+ const valeur = nombreCanonique(brut);
1291
+ const deja = search[cle];
1292
+ search[cle] = deja === void 0 ? valeur : [...Array.isArray(deja) ? deja : [deja], valeur];
1293
+ }
1294
+ router.navigate({ to: ".", search, replace: mode === "replace" });
1295
+ },
1296
+ subscribe: (listener) => router.subscribe("onResolved", listener)
1297
+ };
1298
+ }
1271
1299
  function useDataTableQuery(options = {}) {
1272
1300
  const {
1273
1301
  defaultState,
@@ -1275,11 +1303,12 @@ function useDataTableQuery(options = {}) {
1275
1303
  history = "replace",
1276
1304
  prefix,
1277
1305
  storage: fourni,
1306
+ router,
1278
1307
  serverParams
1279
1308
  } = options;
1280
1309
  const storage = React.useMemo(
1281
- () => fourni ?? (syncUrl ? createUrlTableStorage(history) : void 0),
1282
- [fourni, history, syncUrl]
1310
+ () => fourni ?? (router ? createTanStackRouterStorage(router, history) : syncUrl ? createUrlTableStorage(history) : void 0),
1311
+ [fourni, history, router, syncUrl]
1283
1312
  );
1284
1313
  return headless.useTableQuery({
1285
1314
  ...defaultState ? { defaultState } : {},
@@ -1835,6 +1864,10 @@ var Select = React.forwardRef(function Select2({
1835
1864
  setActiveIndex(selected >= 0 ? selected : visibleOptions.findIndex((option) => !option.disabled));
1836
1865
  if (searchable || fetcher) window.setTimeout(() => searchRef.current?.focus(), 0);
1837
1866
  }, [currentValue, fetcher, open, searchable, visibleOptions]);
1867
+ React.useEffect(() => {
1868
+ if (!open || activeIndex < 0) return;
1869
+ document.getElementById(`${listboxId}-${activeIndex}`)?.scrollIntoView?.({ block: "nearest" });
1870
+ }, [activeIndex, listboxId, open]);
1838
1871
  const setTriggerRef = (node) => {
1839
1872
  triggerRef.current = node;
1840
1873
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -7029,6 +7062,24 @@ function SecretFields({
7029
7062
  ] })
7030
7063
  ] });
7031
7064
  }
7065
+ function secretChanges(entries, storedKeys = []) {
7066
+ const enregistres = new Set(storedKeys);
7067
+ const presents = /* @__PURE__ */ new Set();
7068
+ const set = {};
7069
+ const missing = [];
7070
+ for (const { key, value } of entries) {
7071
+ const nom = key.trim();
7072
+ if (!nom) continue;
7073
+ presents.add(nom);
7074
+ if (value !== "") set[nom] = value;
7075
+ else if (!enregistres.has(nom) && !missing.includes(nom)) missing.push(nom);
7076
+ }
7077
+ return {
7078
+ set,
7079
+ remove: storedKeys.filter((nom) => !presents.has(nom)),
7080
+ missing: missing.filter((nom) => !(nom in set))
7081
+ };
7082
+ }
7032
7083
  function Statistic({ value, label, format = "number", locale = "fr-FR", currency = "XAF", precision, prefix, suffix, trend, className }) {
7033
7084
  const formatted = format === "currency" ? utils.formatCurrency(value, { locale, currency, ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} }) : new Intl.NumberFormat(locale, format === "percent" ? { style: "percent", ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} } : { ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} }).format(value);
7034
7085
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("sia-statistic", className), children: [
@@ -7854,6 +7905,7 @@ exports.YearPicker = YearPicker;
7854
7905
  exports.activityColumns = activityColumns;
7855
7906
  exports.clearSecretValues = clearSecretValues;
7856
7907
  exports.confirmUnsavedNavigation = confirmUnsavedNavigation;
7908
+ exports.createTanStackRouterStorage = createTanStackRouterStorage;
7857
7909
  exports.createUrlTableStorage = createUrlTableStorage;
7858
7910
  exports.defineResource = defineResource;
7859
7911
  exports.formFieldNames = formFieldNames;
@@ -7869,6 +7921,7 @@ exports.resourcePermissions = resourcePermissions;
7869
7921
  exports.resourceRowKey = resourceRowKey;
7870
7922
  exports.resourceSearchKeys = resourceSearchKeys;
7871
7923
  exports.resourceValidator = resourceValidator;
7924
+ exports.secretChanges = secretChanges;
7872
7925
  exports.tintForName = tintForName;
7873
7926
  exports.toneOf = toneOf;
7874
7927
  exports.useDataTableQuery = useDataTableQuery;
package/dist/index.css CHANGED
@@ -2380,11 +2380,13 @@
2380
2380
  box-shadow: 0 14px 36px rgb(15 23 42 / .16);
2381
2381
  }
2382
2382
  .sia-select__panel {
2383
- display: grid;
2383
+ display: flex;
2384
+ flex-direction: column;
2384
2385
  min-width: 12rem;
2385
2386
  max-height: min(22rem, calc(100vh - 1rem));
2386
2387
  }
2387
2388
  .sia-select__search-wrap {
2389
+ flex: none;
2388
2390
  display: flex;
2389
2391
  align-items: center;
2390
2392
  gap: .5rem;
@@ -2403,7 +2405,10 @@
2403
2405
  font: inherit;
2404
2406
  }
2405
2407
  .sia-select__options {
2408
+ flex: 1 1 auto;
2409
+ min-height: 0;
2406
2410
  overflow-y: auto;
2411
+ overscroll-behavior: contain;
2407
2412
  padding: .35rem;
2408
2413
  }
2409
2414
  .sia-select__option {
package/dist/index.d.cts CHANGED
@@ -2346,6 +2346,41 @@ declare function CrudPage<T>({ resource, title, description, eyebrow, headingLev
2346
2346
  * d'où l'on vient.
2347
2347
  */
2348
2348
  declare function createUrlTableStorage(mode?: "replace" | "push"): TableQueryStorage;
2349
+ /**
2350
+ * Ce que l'adaptateur demande d'un routeur : la forme du `router` de
2351
+ * TanStack Router, sans en dépendre. Méthodes écrites en syntaxe de méthode :
2352
+ * leurs paramètres se comparent alors de façon bivariante, et le routeur typé
2353
+ * de l'application s'y passe sans transtypage.
2354
+ */
2355
+ interface TanStackRouterLike {
2356
+ state: {
2357
+ location: {
2358
+ search: object;
2359
+ };
2360
+ };
2361
+ navigate(options: {
2362
+ to: string;
2363
+ search: Record<string, unknown>;
2364
+ replace: boolean;
2365
+ }): unknown;
2366
+ subscribe(event: "onResolved", listener: () => void): () => void;
2367
+ }
2368
+ /**
2369
+ * L'état du tableau dans les paramètres de TanStack Router.
2370
+ *
2371
+ * Deux pièges de la recette qu'on écrivait à la main :
2372
+ *
2373
+ * - TanStack Router sérialise les paramètres en JSON. Une chaîne qui a l'air
2374
+ * d'un nombre y est mise entre guillemets — `page=2` devenait
2375
+ * `page=%222%22`. L'adaptateur passe donc de vrais nombres ; les autres
2376
+ * valeurs restent des chaînes, que le routeur relit à l'identique.
2377
+ * - La lecture part de l'objet déjà décodé par le routeur, jamais de la chaîne
2378
+ * brute, qui porte ces guillemets.
2379
+ *
2380
+ * Les paramètres étrangers au tableau sont gardés par `useTableQuery`, qui
2381
+ * n'écrit que ses propres clés.
2382
+ */
2383
+ declare function createTanStackRouterStorage(router: TanStackRouterLike, mode?: "replace" | "push"): TableQueryStorage;
2349
2384
  interface UseDataTableQueryOptions {
2350
2385
  defaultState?: Partial<TableQueryState>;
2351
2386
  /** `false` garde l'état en mémoire — utile dans une modale. */
@@ -2363,6 +2398,11 @@ interface UseDataTableQueryOptions {
2363
2398
  * remplace celui de l'URL, et `syncUrl` / `history` sont ignorés.
2364
2399
  */
2365
2400
  storage?: TableQueryStorage;
2401
+ /**
2402
+ * Le routeur TanStack Router de l'application. Raccourci de
2403
+ * `storage: createTanStackRouterStorage(router)` ; `history` s'applique.
2404
+ */
2405
+ router?: TanStackRouterLike;
2366
2406
  /** Les noms des paramètres serveur — `limit`, `sort` + `order`… */
2367
2407
  serverParams?: TableParamsMapping;
2368
2408
  }
@@ -3296,6 +3336,34 @@ declare function clearSecretValues(entries: SecretEntry[]): SecretEntry[];
3296
3336
  * affiché dans un formulaire ouvert.
3297
3337
  */
3298
3338
  declare function SecretFields({ value, defaultValue, onValueChange, storedKeys, templates, keyPattern, keyPatternMessage, keyLabel, valueLabel, addLabel, disabled, className, }: SecretFieldsProps): react_jsx_runtime.JSX.Element;
3339
+ /** Ce qu'il faut envoyer au serveur après une saisie dans `SecretFields`. */
3340
+ interface SecretChanges {
3341
+ /** À créer ou à remplacer (rotation) : nom → nouvelle valeur. */
3342
+ set: Record<string, string>;
3343
+ /** Noms enregistrés retirés de la liste : à supprimer. */
3344
+ remove: string[];
3345
+ /**
3346
+ * Noms nouveaux restés sans valeur. Rien à envoyer pour eux — mais les
3347
+ * ignorer sans le dire perdrait une saisie : à signaler avant l'envoi.
3348
+ */
3349
+ missing: string[];
3350
+ }
3351
+ /**
3352
+ * Ce qui change, calculé une fois pour tous les projets.
3353
+ *
3354
+ * Un nom enregistré laissé vide est inchangé ; saisi, il est remplacé. Un nom
3355
+ * enregistré absent de la liste est à supprimer — y compris quand il a été
3356
+ * renommé : l'ancien part, le nouveau arrive avec sa valeur. Les lignes sans
3357
+ * nom sont ignorées ; un nom en double garde sa dernière valeur saisie.
3358
+ *
3359
+ * ```ts
3360
+ * const { set, remove, missing } = secretChanges(secrets, enregistres);
3361
+ * if (missing.length) return; // à compléter
3362
+ * await api.patch(`/projets/${id}/secrets`, { body: { set, remove } });
3363
+ * setSecrets(clearSecretValues(secrets));
3364
+ * ```
3365
+ */
3366
+ declare function secretChanges(entries: SecretEntry[], storedKeys?: string[]): SecretChanges;
3299
3367
 
3300
3368
  interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
3301
3369
  width?: CSSProperties["width"];
@@ -3707,4 +3775,4 @@ interface YearPickerProps {
3707
3775
  */
3708
3776
  declare function YearPicker({ value, defaultValue, min, max, onValueChange, className }: YearPickerProps): react_jsx_runtime.JSX.Element;
3709
3777
 
3710
- export { Accordion, type AccordionItem, type AccordionProps, type ActivityEntry, ActivityIcon, ActivityLog, type ActivityLogFilter, type ActivityLogProps, Alert, AlertCircleIcon, type AlertProps, AmountDisplay, type AmountDisplayProps, AppShell, AppShellBrand, type AppShellBrandProps, type AppShellCollapsible, type AppShellContentWidth, type AppShellMobileNav, type AppShellProps, AppShellRailItem, type AppShellRailItemProps, ArrowRightIcon, AspectRatio, type AspectRatioProps, AsyncState, type AsyncStateProps, type AuditEvent, AuditMeta, type AuditMetaProps, AuthLayout, type AuthLayoutProps, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, type AvatarTint, type AvatarVariant, Badge, type BadgeProps, BottomTabs, type BottomTabsProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarDay, type CalendarEvent, CalendarIcon, type CalendarMode, type CalendarProps, type CalendarRangeValue, Can, type CanProps, Card, CardBody, CardFooter, CardHeader, Chart, type ChartProps, type ChartSeries, CheckIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColumnCardRole, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, Container, ContextMenu, type ContextMenuProps, Countdown, type CountdownProps, type CrudActionOptions, type CrudCreateOptions, type CrudDialogOptions, type CrudDialogState, CrudDialogs, CrudPage, type CrudPageProps, CurrencyInput, type CurrencyInputProps, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeValue, DateTimePicker, type DateTimePickerProps, type DateTimeValue, type DescriptionItem, Descriptions, type DescriptionsProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, type DrawerComponent, DrawerFooter, DrawerHeader, type DrawerPosition, type DrawerProps, type DrawerRef, type DrawerSize, DrawerTitle, DropdownMenu, type DropdownMenuProps, DurationDisplay, type DurationDisplayProps, EmptyState, type EmptyStateProps, EntityMeta, type EntityMetaProps, ErrorState, type ErrorStateProps, EventCalendar, type EventCalendarProps, EyeIcon, EyeOffIcon, Field, type FieldBindingLike, type FieldProps, type FieldStatus, type FieldType, type FieldValue, FileUpload, type FileUploadProps, FiltersBar, type FiltersBarProps, FolderIcon, Form, type FormEntry, Field as FormField, type FormFieldConfig, type FormFieldGroup, type FieldProps as FormFieldProps, type FormProps, type FormShape, Heading, type HeadingProps, HomeIcon, HoverCard, type HoverCardProps, type IDrawerProps, type ILabelProps, type ITooltipProps, type ITooltipVariant, IconButton, type IconButtonProps, ImageUpload, type ImageUploadProps, InfoIcon, InlineCode, Input, InputNumber, type InputNumberProps, type InputProps, JsonEditor, type JsonEditorProps, KeyIcon, KpiGrid, type KpiGridProps, Label, type LabelProps, LockIcon, LogOutIcon, MarkdownEditor, type MarkdownEditorProps, type MenuEntry, type MenuItem, type MenuLabel, MenuList, type MenuListProps, type MenuSeparator, MiniCalendar, MinusIcon, Modal, type ModalProps, MonthPicker, type MonthPickerProps, MoreHorizontalIcon, MultiSelect, type MultiSelectProps, OtpInput, type OtpInputProps, Overlay, type OverlayPlacement, type OverlayProps, PageHeader, type PageHeaderProps, type PageSizeContext, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, type PasswordStrength, PencilIcon, PermissionGate, type PermissionGateProps, type PhoneCountry, PhoneInput, type PhoneInputProps, PlusIcon, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, Radio, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ReferenceOption, ReferenceSelect, type ReferenceSelectProps, RelativeTime, type RelativeTimeProps, RequireSession, type RequireSessionProps, ResizablePanel, type ResizablePanelProps, type ResourceDefinition, type ResourceField, type ResourceFormMode, RichTextEditor, type RichTextEditorProps, type RowAction, ScrollArea, type ScrollAreaProps, SearchIcon, SearchInput, type SearchInputProps, type SecretEntry, SecretFields, type SecretFieldsProps, Select, type SelectOption, type SelectProps, ServerIcon, SettingsIcon, Sidebar, type SidebarEntry, type SidebarItem, type SidebarProps, type SidebarRenderLink, type SidebarSection, type SidebarState, Skeleton, type SkeletonProps, Slider, type SliderProps, type SliderRangeValue, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, StarIcon, StatCard, type StatCardProps, Statistic, type StatisticProps, StatusBadge, type StatusBadgeProps, type StepItem, type StepStatus, Steps, type StepsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, TagsInput, type TagsInputProps, Text, type TextProps, Textarea, type TextareaProps, type TimeParts, TimePicker, type TimePickerProps, TimeRangePicker, type TimeRangePickerProps, type TimeRangeValue, Timeline, type TimelineItem, type TimelineProps, Timer, type TimerProps, ToastProvider, type ToastProviderProps, Toaster, type ToasterProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, type TooltipVariant, Tour, type TourProps, type TourStep, Transfer, type TransferItem, type TransferProps, TrashIcon, Tree, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, UnsavedChangesGuard, type UnsavedChangesGuardProps, UploadIcon, type UseDataTableQueryOptions, UserIcon, UsersIcon, WeekPicker, type WeekPickerProps, XIcon, YearPicker, type YearPickerProps, activityColumns, clearSecretValues, confirmUnsavedNavigation, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, tintForName, toneOf, useDataTableQuery, useToast };
3778
+ export { Accordion, type AccordionItem, type AccordionProps, type ActivityEntry, ActivityIcon, ActivityLog, type ActivityLogFilter, type ActivityLogProps, Alert, AlertCircleIcon, type AlertProps, AmountDisplay, type AmountDisplayProps, AppShell, AppShellBrand, type AppShellBrandProps, type AppShellCollapsible, type AppShellContentWidth, type AppShellMobileNav, type AppShellProps, AppShellRailItem, type AppShellRailItemProps, ArrowRightIcon, AspectRatio, type AspectRatioProps, AsyncState, type AsyncStateProps, type AuditEvent, AuditMeta, type AuditMetaProps, AuthLayout, type AuthLayoutProps, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, type AvatarTint, type AvatarVariant, Badge, type BadgeProps, BottomTabs, type BottomTabsProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarDay, type CalendarEvent, CalendarIcon, type CalendarMode, type CalendarProps, type CalendarRangeValue, Can, type CanProps, Card, CardBody, CardFooter, CardHeader, Chart, type ChartProps, type ChartSeries, CheckIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColumnCardRole, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, Container, ContextMenu, type ContextMenuProps, Countdown, type CountdownProps, type CrudActionOptions, type CrudCreateOptions, type CrudDialogOptions, type CrudDialogState, CrudDialogs, CrudPage, type CrudPageProps, CurrencyInput, type CurrencyInputProps, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeValue, DateTimePicker, type DateTimePickerProps, type DateTimeValue, type DescriptionItem, Descriptions, type DescriptionsProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, type DrawerComponent, DrawerFooter, DrawerHeader, type DrawerPosition, type DrawerProps, type DrawerRef, type DrawerSize, DrawerTitle, DropdownMenu, type DropdownMenuProps, DurationDisplay, type DurationDisplayProps, EmptyState, type EmptyStateProps, EntityMeta, type EntityMetaProps, ErrorState, type ErrorStateProps, EventCalendar, type EventCalendarProps, EyeIcon, EyeOffIcon, Field, type FieldBindingLike, type FieldProps, type FieldStatus, type FieldType, type FieldValue, FileUpload, type FileUploadProps, FiltersBar, type FiltersBarProps, FolderIcon, Form, type FormEntry, Field as FormField, type FormFieldConfig, type FormFieldGroup, type FieldProps as FormFieldProps, type FormProps, type FormShape, Heading, type HeadingProps, HomeIcon, HoverCard, type HoverCardProps, type IDrawerProps, type ILabelProps, type ITooltipProps, type ITooltipVariant, IconButton, type IconButtonProps, ImageUpload, type ImageUploadProps, InfoIcon, InlineCode, Input, InputNumber, type InputNumberProps, type InputProps, JsonEditor, type JsonEditorProps, KeyIcon, KpiGrid, type KpiGridProps, Label, type LabelProps, LockIcon, LogOutIcon, MarkdownEditor, type MarkdownEditorProps, type MenuEntry, type MenuItem, type MenuLabel, MenuList, type MenuListProps, type MenuSeparator, MiniCalendar, MinusIcon, Modal, type ModalProps, MonthPicker, type MonthPickerProps, MoreHorizontalIcon, MultiSelect, type MultiSelectProps, OtpInput, type OtpInputProps, Overlay, type OverlayPlacement, type OverlayProps, PageHeader, type PageHeaderProps, type PageSizeContext, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, type PasswordStrength, PencilIcon, PermissionGate, type PermissionGateProps, type PhoneCountry, PhoneInput, type PhoneInputProps, PlusIcon, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, Radio, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ReferenceOption, ReferenceSelect, type ReferenceSelectProps, RelativeTime, type RelativeTimeProps, RequireSession, type RequireSessionProps, ResizablePanel, type ResizablePanelProps, type ResourceDefinition, type ResourceField, type ResourceFormMode, RichTextEditor, type RichTextEditorProps, type RowAction, ScrollArea, type ScrollAreaProps, SearchIcon, SearchInput, type SearchInputProps, type SecretChanges, type SecretEntry, SecretFields, type SecretFieldsProps, Select, type SelectOption, type SelectProps, ServerIcon, SettingsIcon, Sidebar, type SidebarEntry, type SidebarItem, type SidebarProps, type SidebarRenderLink, type SidebarSection, type SidebarState, Skeleton, type SkeletonProps, Slider, type SliderProps, type SliderRangeValue, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, StarIcon, StatCard, type StatCardProps, Statistic, type StatisticProps, StatusBadge, type StatusBadgeProps, type StepItem, type StepStatus, Steps, type StepsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, TagsInput, type TagsInputProps, type TanStackRouterLike, Text, type TextProps, Textarea, type TextareaProps, type TimeParts, TimePicker, type TimePickerProps, TimeRangePicker, type TimeRangePickerProps, type TimeRangeValue, Timeline, type TimelineItem, type TimelineProps, Timer, type TimerProps, ToastProvider, type ToastProviderProps, Toaster, type ToasterProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, type TooltipVariant, Tour, type TourProps, type TourStep, Transfer, type TransferItem, type TransferProps, TrashIcon, Tree, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, UnsavedChangesGuard, type UnsavedChangesGuardProps, UploadIcon, type UseDataTableQueryOptions, UserIcon, UsersIcon, WeekPicker, type WeekPickerProps, XIcon, YearPicker, type YearPickerProps, activityColumns, clearSecretValues, confirmUnsavedNavigation, createTanStackRouterStorage, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, secretChanges, tintForName, toneOf, useDataTableQuery, useToast };
package/dist/index.d.ts CHANGED
@@ -2346,6 +2346,41 @@ declare function CrudPage<T>({ resource, title, description, eyebrow, headingLev
2346
2346
  * d'où l'on vient.
2347
2347
  */
2348
2348
  declare function createUrlTableStorage(mode?: "replace" | "push"): TableQueryStorage;
2349
+ /**
2350
+ * Ce que l'adaptateur demande d'un routeur : la forme du `router` de
2351
+ * TanStack Router, sans en dépendre. Méthodes écrites en syntaxe de méthode :
2352
+ * leurs paramètres se comparent alors de façon bivariante, et le routeur typé
2353
+ * de l'application s'y passe sans transtypage.
2354
+ */
2355
+ interface TanStackRouterLike {
2356
+ state: {
2357
+ location: {
2358
+ search: object;
2359
+ };
2360
+ };
2361
+ navigate(options: {
2362
+ to: string;
2363
+ search: Record<string, unknown>;
2364
+ replace: boolean;
2365
+ }): unknown;
2366
+ subscribe(event: "onResolved", listener: () => void): () => void;
2367
+ }
2368
+ /**
2369
+ * L'état du tableau dans les paramètres de TanStack Router.
2370
+ *
2371
+ * Deux pièges de la recette qu'on écrivait à la main :
2372
+ *
2373
+ * - TanStack Router sérialise les paramètres en JSON. Une chaîne qui a l'air
2374
+ * d'un nombre y est mise entre guillemets — `page=2` devenait
2375
+ * `page=%222%22`. L'adaptateur passe donc de vrais nombres ; les autres
2376
+ * valeurs restent des chaînes, que le routeur relit à l'identique.
2377
+ * - La lecture part de l'objet déjà décodé par le routeur, jamais de la chaîne
2378
+ * brute, qui porte ces guillemets.
2379
+ *
2380
+ * Les paramètres étrangers au tableau sont gardés par `useTableQuery`, qui
2381
+ * n'écrit que ses propres clés.
2382
+ */
2383
+ declare function createTanStackRouterStorage(router: TanStackRouterLike, mode?: "replace" | "push"): TableQueryStorage;
2349
2384
  interface UseDataTableQueryOptions {
2350
2385
  defaultState?: Partial<TableQueryState>;
2351
2386
  /** `false` garde l'état en mémoire — utile dans une modale. */
@@ -2363,6 +2398,11 @@ interface UseDataTableQueryOptions {
2363
2398
  * remplace celui de l'URL, et `syncUrl` / `history` sont ignorés.
2364
2399
  */
2365
2400
  storage?: TableQueryStorage;
2401
+ /**
2402
+ * Le routeur TanStack Router de l'application. Raccourci de
2403
+ * `storage: createTanStackRouterStorage(router)` ; `history` s'applique.
2404
+ */
2405
+ router?: TanStackRouterLike;
2366
2406
  /** Les noms des paramètres serveur — `limit`, `sort` + `order`… */
2367
2407
  serverParams?: TableParamsMapping;
2368
2408
  }
@@ -3296,6 +3336,34 @@ declare function clearSecretValues(entries: SecretEntry[]): SecretEntry[];
3296
3336
  * affiché dans un formulaire ouvert.
3297
3337
  */
3298
3338
  declare function SecretFields({ value, defaultValue, onValueChange, storedKeys, templates, keyPattern, keyPatternMessage, keyLabel, valueLabel, addLabel, disabled, className, }: SecretFieldsProps): react_jsx_runtime.JSX.Element;
3339
+ /** Ce qu'il faut envoyer au serveur après une saisie dans `SecretFields`. */
3340
+ interface SecretChanges {
3341
+ /** À créer ou à remplacer (rotation) : nom → nouvelle valeur. */
3342
+ set: Record<string, string>;
3343
+ /** Noms enregistrés retirés de la liste : à supprimer. */
3344
+ remove: string[];
3345
+ /**
3346
+ * Noms nouveaux restés sans valeur. Rien à envoyer pour eux — mais les
3347
+ * ignorer sans le dire perdrait une saisie : à signaler avant l'envoi.
3348
+ */
3349
+ missing: string[];
3350
+ }
3351
+ /**
3352
+ * Ce qui change, calculé une fois pour tous les projets.
3353
+ *
3354
+ * Un nom enregistré laissé vide est inchangé ; saisi, il est remplacé. Un nom
3355
+ * enregistré absent de la liste est à supprimer — y compris quand il a été
3356
+ * renommé : l'ancien part, le nouveau arrive avec sa valeur. Les lignes sans
3357
+ * nom sont ignorées ; un nom en double garde sa dernière valeur saisie.
3358
+ *
3359
+ * ```ts
3360
+ * const { set, remove, missing } = secretChanges(secrets, enregistres);
3361
+ * if (missing.length) return; // à compléter
3362
+ * await api.patch(`/projets/${id}/secrets`, { body: { set, remove } });
3363
+ * setSecrets(clearSecretValues(secrets));
3364
+ * ```
3365
+ */
3366
+ declare function secretChanges(entries: SecretEntry[], storedKeys?: string[]): SecretChanges;
3299
3367
 
3300
3368
  interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
3301
3369
  width?: CSSProperties["width"];
@@ -3707,4 +3775,4 @@ interface YearPickerProps {
3707
3775
  */
3708
3776
  declare function YearPicker({ value, defaultValue, min, max, onValueChange, className }: YearPickerProps): react_jsx_runtime.JSX.Element;
3709
3777
 
3710
- export { Accordion, type AccordionItem, type AccordionProps, type ActivityEntry, ActivityIcon, ActivityLog, type ActivityLogFilter, type ActivityLogProps, Alert, AlertCircleIcon, type AlertProps, AmountDisplay, type AmountDisplayProps, AppShell, AppShellBrand, type AppShellBrandProps, type AppShellCollapsible, type AppShellContentWidth, type AppShellMobileNav, type AppShellProps, AppShellRailItem, type AppShellRailItemProps, ArrowRightIcon, AspectRatio, type AspectRatioProps, AsyncState, type AsyncStateProps, type AuditEvent, AuditMeta, type AuditMetaProps, AuthLayout, type AuthLayoutProps, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, type AvatarTint, type AvatarVariant, Badge, type BadgeProps, BottomTabs, type BottomTabsProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarDay, type CalendarEvent, CalendarIcon, type CalendarMode, type CalendarProps, type CalendarRangeValue, Can, type CanProps, Card, CardBody, CardFooter, CardHeader, Chart, type ChartProps, type ChartSeries, CheckIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColumnCardRole, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, Container, ContextMenu, type ContextMenuProps, Countdown, type CountdownProps, type CrudActionOptions, type CrudCreateOptions, type CrudDialogOptions, type CrudDialogState, CrudDialogs, CrudPage, type CrudPageProps, CurrencyInput, type CurrencyInputProps, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeValue, DateTimePicker, type DateTimePickerProps, type DateTimeValue, type DescriptionItem, Descriptions, type DescriptionsProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, type DrawerComponent, DrawerFooter, DrawerHeader, type DrawerPosition, type DrawerProps, type DrawerRef, type DrawerSize, DrawerTitle, DropdownMenu, type DropdownMenuProps, DurationDisplay, type DurationDisplayProps, EmptyState, type EmptyStateProps, EntityMeta, type EntityMetaProps, ErrorState, type ErrorStateProps, EventCalendar, type EventCalendarProps, EyeIcon, EyeOffIcon, Field, type FieldBindingLike, type FieldProps, type FieldStatus, type FieldType, type FieldValue, FileUpload, type FileUploadProps, FiltersBar, type FiltersBarProps, FolderIcon, Form, type FormEntry, Field as FormField, type FormFieldConfig, type FormFieldGroup, type FieldProps as FormFieldProps, type FormProps, type FormShape, Heading, type HeadingProps, HomeIcon, HoverCard, type HoverCardProps, type IDrawerProps, type ILabelProps, type ITooltipProps, type ITooltipVariant, IconButton, type IconButtonProps, ImageUpload, type ImageUploadProps, InfoIcon, InlineCode, Input, InputNumber, type InputNumberProps, type InputProps, JsonEditor, type JsonEditorProps, KeyIcon, KpiGrid, type KpiGridProps, Label, type LabelProps, LockIcon, LogOutIcon, MarkdownEditor, type MarkdownEditorProps, type MenuEntry, type MenuItem, type MenuLabel, MenuList, type MenuListProps, type MenuSeparator, MiniCalendar, MinusIcon, Modal, type ModalProps, MonthPicker, type MonthPickerProps, MoreHorizontalIcon, MultiSelect, type MultiSelectProps, OtpInput, type OtpInputProps, Overlay, type OverlayPlacement, type OverlayProps, PageHeader, type PageHeaderProps, type PageSizeContext, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, type PasswordStrength, PencilIcon, PermissionGate, type PermissionGateProps, type PhoneCountry, PhoneInput, type PhoneInputProps, PlusIcon, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, Radio, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ReferenceOption, ReferenceSelect, type ReferenceSelectProps, RelativeTime, type RelativeTimeProps, RequireSession, type RequireSessionProps, ResizablePanel, type ResizablePanelProps, type ResourceDefinition, type ResourceField, type ResourceFormMode, RichTextEditor, type RichTextEditorProps, type RowAction, ScrollArea, type ScrollAreaProps, SearchIcon, SearchInput, type SearchInputProps, type SecretEntry, SecretFields, type SecretFieldsProps, Select, type SelectOption, type SelectProps, ServerIcon, SettingsIcon, Sidebar, type SidebarEntry, type SidebarItem, type SidebarProps, type SidebarRenderLink, type SidebarSection, type SidebarState, Skeleton, type SkeletonProps, Slider, type SliderProps, type SliderRangeValue, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, StarIcon, StatCard, type StatCardProps, Statistic, type StatisticProps, StatusBadge, type StatusBadgeProps, type StepItem, type StepStatus, Steps, type StepsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, TagsInput, type TagsInputProps, Text, type TextProps, Textarea, type TextareaProps, type TimeParts, TimePicker, type TimePickerProps, TimeRangePicker, type TimeRangePickerProps, type TimeRangeValue, Timeline, type TimelineItem, type TimelineProps, Timer, type TimerProps, ToastProvider, type ToastProviderProps, Toaster, type ToasterProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, type TooltipVariant, Tour, type TourProps, type TourStep, Transfer, type TransferItem, type TransferProps, TrashIcon, Tree, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, UnsavedChangesGuard, type UnsavedChangesGuardProps, UploadIcon, type UseDataTableQueryOptions, UserIcon, UsersIcon, WeekPicker, type WeekPickerProps, XIcon, YearPicker, type YearPickerProps, activityColumns, clearSecretValues, confirmUnsavedNavigation, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, tintForName, toneOf, useDataTableQuery, useToast };
3778
+ export { Accordion, type AccordionItem, type AccordionProps, type ActivityEntry, ActivityIcon, ActivityLog, type ActivityLogFilter, type ActivityLogProps, Alert, AlertCircleIcon, type AlertProps, AmountDisplay, type AmountDisplayProps, AppShell, AppShellBrand, type AppShellBrandProps, type AppShellCollapsible, type AppShellContentWidth, type AppShellMobileNav, type AppShellProps, AppShellRailItem, type AppShellRailItemProps, ArrowRightIcon, AspectRatio, type AspectRatioProps, AsyncState, type AsyncStateProps, type AuditEvent, AuditMeta, type AuditMetaProps, AuthLayout, type AuthLayoutProps, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, type AvatarTint, type AvatarVariant, Badge, type BadgeProps, BottomTabs, type BottomTabsProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarDay, type CalendarEvent, CalendarIcon, type CalendarMode, type CalendarProps, type CalendarRangeValue, Can, type CanProps, Card, CardBody, CardFooter, CardHeader, Chart, type ChartProps, type ChartSeries, CheckIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColumnCardRole, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, Container, ContextMenu, type ContextMenuProps, Countdown, type CountdownProps, type CrudActionOptions, type CrudCreateOptions, type CrudDialogOptions, type CrudDialogState, CrudDialogs, CrudPage, type CrudPageProps, CurrencyInput, type CurrencyInputProps, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DateRangeValue, DateTimePicker, type DateTimePickerProps, type DateTimeValue, type DescriptionItem, Descriptions, type DescriptionsProps, Divider, type DividerProps, Drawer, DrawerBody, DrawerClose, type DrawerComponent, DrawerFooter, DrawerHeader, type DrawerPosition, type DrawerProps, type DrawerRef, type DrawerSize, DrawerTitle, DropdownMenu, type DropdownMenuProps, DurationDisplay, type DurationDisplayProps, EmptyState, type EmptyStateProps, EntityMeta, type EntityMetaProps, ErrorState, type ErrorStateProps, EventCalendar, type EventCalendarProps, EyeIcon, EyeOffIcon, Field, type FieldBindingLike, type FieldProps, type FieldStatus, type FieldType, type FieldValue, FileUpload, type FileUploadProps, FiltersBar, type FiltersBarProps, FolderIcon, Form, type FormEntry, Field as FormField, type FormFieldConfig, type FormFieldGroup, type FieldProps as FormFieldProps, type FormProps, type FormShape, Heading, type HeadingProps, HomeIcon, HoverCard, type HoverCardProps, type IDrawerProps, type ILabelProps, type ITooltipProps, type ITooltipVariant, IconButton, type IconButtonProps, ImageUpload, type ImageUploadProps, InfoIcon, InlineCode, Input, InputNumber, type InputNumberProps, type InputProps, JsonEditor, type JsonEditorProps, KeyIcon, KpiGrid, type KpiGridProps, Label, type LabelProps, LockIcon, LogOutIcon, MarkdownEditor, type MarkdownEditorProps, type MenuEntry, type MenuItem, type MenuLabel, MenuList, type MenuListProps, type MenuSeparator, MiniCalendar, MinusIcon, Modal, type ModalProps, MonthPicker, type MonthPickerProps, MoreHorizontalIcon, MultiSelect, type MultiSelectProps, OtpInput, type OtpInputProps, Overlay, type OverlayPlacement, type OverlayProps, PageHeader, type PageHeaderProps, type PageSizeContext, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, type PasswordStrength, PencilIcon, PermissionGate, type PermissionGateProps, type PhoneCountry, PhoneInput, type PhoneInputProps, PlusIcon, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, Radio, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type ReferenceOption, ReferenceSelect, type ReferenceSelectProps, RelativeTime, type RelativeTimeProps, RequireSession, type RequireSessionProps, ResizablePanel, type ResizablePanelProps, type ResourceDefinition, type ResourceField, type ResourceFormMode, RichTextEditor, type RichTextEditorProps, type RowAction, ScrollArea, type ScrollAreaProps, SearchIcon, SearchInput, type SearchInputProps, type SecretChanges, type SecretEntry, SecretFields, type SecretFieldsProps, Select, type SelectOption, type SelectProps, ServerIcon, SettingsIcon, Sidebar, type SidebarEntry, type SidebarItem, type SidebarProps, type SidebarRenderLink, type SidebarSection, type SidebarState, Skeleton, type SkeletonProps, Slider, type SliderProps, type SliderRangeValue, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, StarIcon, StatCard, type StatCardProps, Statistic, type StatisticProps, StatusBadge, type StatusBadgeProps, type StepItem, type StepStatus, Steps, type StepsProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, TagsInput, type TagsInputProps, type TanStackRouterLike, Text, type TextProps, Textarea, type TextareaProps, type TimeParts, TimePicker, type TimePickerProps, TimeRangePicker, type TimeRangePickerProps, type TimeRangeValue, Timeline, type TimelineItem, type TimelineProps, Timer, type TimerProps, ToastProvider, type ToastProviderProps, Toaster, type ToasterProps, Toggle, ToggleGroup, type ToggleGroupOption, type ToggleGroupProps, type ToggleProps, Tooltip, type TooltipProps, type TooltipVariant, Tour, type TourProps, type TourStep, Transfer, type TransferItem, type TransferProps, TrashIcon, Tree, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, UnsavedChangesGuard, type UnsavedChangesGuardProps, UploadIcon, type UseDataTableQueryOptions, UserIcon, UsersIcon, WeekPicker, type WeekPickerProps, XIcon, YearPicker, type YearPickerProps, activityColumns, clearSecretValues, confirmUnsavedNavigation, createTanStackRouterStorage, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, secretChanges, tintForName, toneOf, useDataTableQuery, useToast };
package/dist/index.js CHANGED
@@ -1248,6 +1248,34 @@ function createUrlTableStorage(mode = "replace") {
1248
1248
  }
1249
1249
  };
1250
1250
  }
1251
+ function nombreCanonique(valeur) {
1252
+ const nombre = Number(valeur);
1253
+ return valeur !== "" && Number.isFinite(nombre) && String(nombre) === valeur ? nombre : valeur;
1254
+ }
1255
+ function createTanStackRouterStorage(router, mode = "replace") {
1256
+ return {
1257
+ read: () => {
1258
+ const params = new URLSearchParams();
1259
+ for (const [cle, valeur] of Object.entries(router.state.location.search)) {
1260
+ if (valeur === void 0 || valeur === null) continue;
1261
+ for (const v of Array.isArray(valeur) ? valeur : [valeur]) {
1262
+ params.append(cle, typeof v === "object" ? JSON.stringify(v) : String(v));
1263
+ }
1264
+ }
1265
+ return params.toString();
1266
+ },
1267
+ write: (value) => {
1268
+ const search = {};
1269
+ for (const [cle, brut] of new URLSearchParams(value)) {
1270
+ const valeur = nombreCanonique(brut);
1271
+ const deja = search[cle];
1272
+ search[cle] = deja === void 0 ? valeur : [...Array.isArray(deja) ? deja : [deja], valeur];
1273
+ }
1274
+ router.navigate({ to: ".", search, replace: mode === "replace" });
1275
+ },
1276
+ subscribe: (listener) => router.subscribe("onResolved", listener)
1277
+ };
1278
+ }
1251
1279
  function useDataTableQuery(options = {}) {
1252
1280
  const {
1253
1281
  defaultState,
@@ -1255,11 +1283,12 @@ function useDataTableQuery(options = {}) {
1255
1283
  history = "replace",
1256
1284
  prefix,
1257
1285
  storage: fourni,
1286
+ router,
1258
1287
  serverParams
1259
1288
  } = options;
1260
1289
  const storage = useMemo(
1261
- () => fourni ?? (syncUrl ? createUrlTableStorage(history) : void 0),
1262
- [fourni, history, syncUrl]
1290
+ () => fourni ?? (router ? createTanStackRouterStorage(router, history) : syncUrl ? createUrlTableStorage(history) : void 0),
1291
+ [fourni, history, router, syncUrl]
1263
1292
  );
1264
1293
  return useTableQuery({
1265
1294
  ...defaultState ? { defaultState } : {},
@@ -1815,6 +1844,10 @@ var Select = forwardRef(function Select2({
1815
1844
  setActiveIndex(selected >= 0 ? selected : visibleOptions.findIndex((option) => !option.disabled));
1816
1845
  if (searchable || fetcher) window.setTimeout(() => searchRef.current?.focus(), 0);
1817
1846
  }, [currentValue, fetcher, open, searchable, visibleOptions]);
1847
+ useEffect(() => {
1848
+ if (!open || activeIndex < 0) return;
1849
+ document.getElementById(`${listboxId}-${activeIndex}`)?.scrollIntoView?.({ block: "nearest" });
1850
+ }, [activeIndex, listboxId, open]);
1818
1851
  const setTriggerRef = (node) => {
1819
1852
  triggerRef.current = node;
1820
1853
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -7009,6 +7042,24 @@ function SecretFields({
7009
7042
  ] })
7010
7043
  ] });
7011
7044
  }
7045
+ function secretChanges(entries, storedKeys = []) {
7046
+ const enregistres = new Set(storedKeys);
7047
+ const presents = /* @__PURE__ */ new Set();
7048
+ const set = {};
7049
+ const missing = [];
7050
+ for (const { key, value } of entries) {
7051
+ const nom = key.trim();
7052
+ if (!nom) continue;
7053
+ presents.add(nom);
7054
+ if (value !== "") set[nom] = value;
7055
+ else if (!enregistres.has(nom) && !missing.includes(nom)) missing.push(nom);
7056
+ }
7057
+ return {
7058
+ set,
7059
+ remove: storedKeys.filter((nom) => !presents.has(nom)),
7060
+ missing: missing.filter((nom) => !(nom in set))
7061
+ };
7062
+ }
7012
7063
  function Statistic({ value, label, format = "number", locale = "fr-FR", currency = "XAF", precision, prefix, suffix, trend, className }) {
7013
7064
  const formatted = format === "currency" ? formatCurrency(value, { locale, currency, ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} }) : new Intl.NumberFormat(locale, format === "percent" ? { style: "percent", ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} } : { ...precision !== void 0 ? { minimumFractionDigits: precision, maximumFractionDigits: precision } : {} }).format(value);
7014
7065
  return /* @__PURE__ */ jsxs("div", { className: cn("sia-statistic", className), children: [
@@ -7656,4 +7707,4 @@ function YearPicker({ value, defaultValue = (/* @__PURE__ */ new Date()).getFull
7656
7707
  return /* @__PURE__ */ jsx("select", { className: cn("sia-year-picker", className), value, defaultValue: value === void 0 ? defaultValue : void 0, onChange: (event) => onValueChange?.(Number(event.target.value)), children: years.map((year) => /* @__PURE__ */ jsx("option", { value: year, children: year }, year)) });
7657
7708
  }
7658
7709
 
7659
- export { Accordion, ActivityIcon, ActivityLog, Alert, AlertCircleIcon, AmountDisplay, AppShell, AppShellBrand, AppShellRailItem, ArrowRightIcon, AspectRatio, AsyncState, AuditMeta, AuthLayout, Autocomplete, Avatar, AvatarGroup, Badge, BottomTabs, Breadcrumb, Button, Calendar, CalendarIcon, Can, Card, CardBody, CardFooter, CardHeader, Chart, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, ColorPicker, CommandPalette, ConfirmDialog, Container, ContextMenu, Countdown, CrudDialogs, CrudPage, CurrencyInput, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, DatePicker, DateRangeFilter, DateRangePicker, DateTimePicker, Descriptions, Divider, Drawer, DrawerBody, DrawerClose, DrawerFooter, DrawerHeader, DrawerTitle, DropdownMenu, DurationDisplay, EmptyState, EntityMeta, ErrorState, EventCalendar, EyeIcon, EyeOffIcon, Field, FileUpload, FiltersBar, FolderIcon, Form, Field as FormField, Heading, HomeIcon, HoverCard, IconButton, ImageUpload, InfoIcon, InlineCode, Input, InputNumber, JsonEditor, KeyIcon, KpiGrid, Label, LockIcon, LogOutIcon, MarkdownEditor, MenuList, MiniCalendar, MinusIcon, Modal, MonthPicker, MoreHorizontalIcon, MultiSelect, OtpInput, Overlay, PageHeader, Pagination, PasswordInput, PencilIcon, PermissionGate, PhoneInput, PlusIcon, Popover, Progress, QRCode, Radio, RadioButton, RadioGroup, Rating, ReferenceSelect, RelativeTime, RequireSession, ResizablePanel, RichTextEditor, ScrollArea, SearchIcon, SearchInput, SecretFields, Select, ServerIcon, SettingsIcon, Sidebar, Skeleton, Slider, Sparkline, Spinner, Stack, StarIcon, StatCard, Statistic, StatusBadge, Steps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, Text, Textarea, TimePicker, TimeRangePicker, Timeline, Timer, ToastProvider, Toaster, Toggle, ToggleGroup, Tooltip, Tour, Transfer, TrashIcon, Tree, TreeSelect, UnsavedChangesGuard, UploadIcon, UserIcon, UsersIcon, WeekPicker, XIcon, YearPicker, activityColumns, clearSecretValues, confirmUnsavedNavigation, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, tintForName, toneOf, useDataTableQuery, useToast };
7710
+ export { Accordion, ActivityIcon, ActivityLog, Alert, AlertCircleIcon, AmountDisplay, AppShell, AppShellBrand, AppShellRailItem, ArrowRightIcon, AspectRatio, AsyncState, AuditMeta, AuthLayout, Autocomplete, Avatar, AvatarGroup, Badge, BottomTabs, Breadcrumb, Button, Calendar, CalendarIcon, Can, Card, CardBody, CardFooter, CardHeader, Chart, CheckIcon, Checkbox, CheckboxGroup, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ClockIcon, Collapse, ColorPicker, CommandPalette, ConfirmDialog, Container, ContextMenu, Countdown, CrudDialogs, CrudPage, CurrencyInput, DEFAULT_COUNTRIES, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, DatePicker, DateRangeFilter, DateRangePicker, DateTimePicker, Descriptions, Divider, Drawer, DrawerBody, DrawerClose, DrawerFooter, DrawerHeader, DrawerTitle, DropdownMenu, DurationDisplay, EmptyState, EntityMeta, ErrorState, EventCalendar, EyeIcon, EyeOffIcon, Field, FileUpload, FiltersBar, FolderIcon, Form, Field as FormField, Heading, HomeIcon, HoverCard, IconButton, ImageUpload, InfoIcon, InlineCode, Input, InputNumber, JsonEditor, KeyIcon, KpiGrid, Label, LockIcon, LogOutIcon, MarkdownEditor, MenuList, MiniCalendar, MinusIcon, Modal, MonthPicker, MoreHorizontalIcon, MultiSelect, OtpInput, Overlay, PageHeader, Pagination, PasswordInput, PencilIcon, PermissionGate, PhoneInput, PlusIcon, Popover, Progress, QRCode, Radio, RadioButton, RadioGroup, Rating, ReferenceSelect, RelativeTime, RequireSession, ResizablePanel, RichTextEditor, ScrollArea, SearchIcon, SearchInput, SecretFields, Select, ServerIcon, SettingsIcon, Sidebar, Skeleton, Slider, Sparkline, Spinner, Stack, StarIcon, StatCard, Statistic, StatusBadge, Steps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, Text, Textarea, TimePicker, TimeRangePicker, Timeline, Timer, ToastProvider, Toaster, Toggle, ToggleGroup, Tooltip, Tour, Transfer, TrashIcon, Tree, TreeSelect, UnsavedChangesGuard, UploadIcon, UserIcon, UsersIcon, WeekPicker, XIcon, YearPicker, activityColumns, clearSecretValues, confirmUnsavedNavigation, createTanStackRouterStorage, createUrlTableStorage, defineResource, formFieldNames, formatDuration, formatTimeValue, initialsOf, parseTimeValue, resourceColumns, resourceDefaults, resourceDetailColumns, resourceFormFields, resourcePermissions, resourceRowKey, resourceSearchKeys, resourceValidator, secretChanges, tintForName, toneOf, useDataTableQuery, useToast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia-ui/react-web",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "DOM implementation of the SIA UI component contracts.",
5
5
  "keywords": [
6
6
  "sia-ui",
@@ -45,10 +45,10 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@sia-ui/headless": "0.6.0",
49
- "@sia-ui/react": "0.6.0",
50
- "@sia-ui/tokens": "0.6.0",
51
- "@sia-ui/utils": "0.6.0"
48
+ "@sia-ui/tokens": "0.7.1",
49
+ "@sia-ui/utils": "0.7.1",
50
+ "@sia-ui/react": "0.7.1",
51
+ "@sia-ui/headless": "0.7.1"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": ">=18.2.0",
@@ -67,7 +67,7 @@
67
67
  "tsup": "^8.5.1",
68
68
  "typescript": "^5.9.3",
69
69
  "vitest": "^4.0.16",
70
- "@sia-ui/api": "0.6.0"
70
+ "@sia-ui/api": "0.7.1"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "node scripts/build-theme.mjs --check && tsup",