@sia-ui/react-web 0.6.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @sia-ui/react-web
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Adaptateur TanStack Router, mises à jour en `PATCH`, et `secretChanges`.
8
+ - **`useDataTableQuery({ router })`** — adaptateur TanStack Router livré et
9
+ testé (`createTanStackRouterStorage`). La recette de la documentation mettait
10
+ `page=2` entre guillemets (`page=%222%22`) et la page retombait à 1 ; les
11
+ nombres passent désormais comme nombres, sans perte pour les filtres.
12
+ - **Un tableau n'écrit plus que ses propres clés** (`mergeTableQuery` dans
13
+ `@sia-ui/headless`) : deux tableaux préfixés sur une page, ou un onglet dans
14
+ l'URL, ne s'effacent plus l'un l'autre — avec l'URL du navigateur comme avec
15
+ un routeur.
16
+ - **`createQueryResource(service, { updateMethod: "PATCH" })`** — pour une API
17
+ qui n'accepte que des mises à jour partielles.
18
+ - **`secretChanges(entries, storedKeys)`** — ce qu'il faut envoyer après une
19
+ saisie dans `SecretFields` : `{ set, remove, missing }`.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @sia-ui/react@0.7.0
25
+ - @sia-ui/tokens@0.7.0
26
+ - @sia-ui/utils@0.7.0
27
+ - @sia-ui/headless@0.7.0
28
+
3
29
  ## 0.6.0
4
30
 
5
31
  ### Minor Changes
package/README.md CHANGED
@@ -70,6 +70,32 @@ 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.0
74
+
75
+ ### Minor Changes
76
+
77
+ - Adaptateur TanStack Router, mises à jour en `PATCH`, et `secretChanges`.
78
+ - **`useDataTableQuery({ router })`** — adaptateur TanStack Router livré et
79
+ testé (`createTanStackRouterStorage`). La recette de la documentation mettait
80
+ `page=2` entre guillemets (`page=%222%22`) et la page retombait à 1 ; les
81
+ nombres passent désormais comme nombres, sans perte pour les filtres.
82
+ - **Un tableau n'écrit plus que ses propres clés** (`mergeTableQuery` dans
83
+ `@sia-ui/headless`) : deux tableaux préfixés sur une page, ou un onglet dans
84
+ l'URL, ne s'effacent plus l'un l'autre — avec l'URL du navigateur comme avec
85
+ un routeur.
86
+ - **`createQueryResource(service, { updateMethod: "PATCH" })`** — pour une API
87
+ qui n'accepte que des mises à jour partielles.
88
+ - **`secretChanges(entries, storedKeys)`** — ce qu'il faut envoyer après une
89
+ saisie dans `SecretFields` : `{ set, remove, missing }`.
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies
94
+ - @sia-ui/react@0.7.0
95
+ - @sia-ui/tokens@0.7.0
96
+ - @sia-ui/utils@0.7.0
97
+ - @sia-ui/headless@0.7.0
98
+
73
99
  ## 0.6.0
74
100
 
75
101
  ### 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 } : {},
@@ -7029,6 +7058,24 @@ function SecretFields({
7029
7058
  ] })
7030
7059
  ] });
7031
7060
  }
7061
+ function secretChanges(entries, storedKeys = []) {
7062
+ const enregistres = new Set(storedKeys);
7063
+ const presents = /* @__PURE__ */ new Set();
7064
+ const set = {};
7065
+ const missing = [];
7066
+ for (const { key, value } of entries) {
7067
+ const nom = key.trim();
7068
+ if (!nom) continue;
7069
+ presents.add(nom);
7070
+ if (value !== "") set[nom] = value;
7071
+ else if (!enregistres.has(nom) && !missing.includes(nom)) missing.push(nom);
7072
+ }
7073
+ return {
7074
+ set,
7075
+ remove: storedKeys.filter((nom) => !presents.has(nom)),
7076
+ missing: missing.filter((nom) => !(nom in set))
7077
+ };
7078
+ }
7032
7079
  function Statistic({ value, label, format = "number", locale = "fr-FR", currency = "XAF", precision, prefix, suffix, trend, className }) {
7033
7080
  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
7081
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("sia-statistic", className), children: [
@@ -7854,6 +7901,7 @@ exports.YearPicker = YearPicker;
7854
7901
  exports.activityColumns = activityColumns;
7855
7902
  exports.clearSecretValues = clearSecretValues;
7856
7903
  exports.confirmUnsavedNavigation = confirmUnsavedNavigation;
7904
+ exports.createTanStackRouterStorage = createTanStackRouterStorage;
7857
7905
  exports.createUrlTableStorage = createUrlTableStorage;
7858
7906
  exports.defineResource = defineResource;
7859
7907
  exports.formFieldNames = formFieldNames;
@@ -7869,6 +7917,7 @@ exports.resourcePermissions = resourcePermissions;
7869
7917
  exports.resourceRowKey = resourceRowKey;
7870
7918
  exports.resourceSearchKeys = resourceSearchKeys;
7871
7919
  exports.resourceValidator = resourceValidator;
7920
+ exports.secretChanges = secretChanges;
7872
7921
  exports.tintForName = tintForName;
7873
7922
  exports.toneOf = toneOf;
7874
7923
  exports.useDataTableQuery = useDataTableQuery;
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 } : {},
@@ -7009,6 +7038,24 @@ function SecretFields({
7009
7038
  ] })
7010
7039
  ] });
7011
7040
  }
7041
+ function secretChanges(entries, storedKeys = []) {
7042
+ const enregistres = new Set(storedKeys);
7043
+ const presents = /* @__PURE__ */ new Set();
7044
+ const set = {};
7045
+ const missing = [];
7046
+ for (const { key, value } of entries) {
7047
+ const nom = key.trim();
7048
+ if (!nom) continue;
7049
+ presents.add(nom);
7050
+ if (value !== "") set[nom] = value;
7051
+ else if (!enregistres.has(nom) && !missing.includes(nom)) missing.push(nom);
7052
+ }
7053
+ return {
7054
+ set,
7055
+ remove: storedKeys.filter((nom) => !presents.has(nom)),
7056
+ missing: missing.filter((nom) => !(nom in set))
7057
+ };
7058
+ }
7012
7059
  function Statistic({ value, label, format = "number", locale = "fr-FR", currency = "XAF", precision, prefix, suffix, trend, className }) {
7013
7060
  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
7061
  return /* @__PURE__ */ jsxs("div", { className: cn("sia-statistic", className), children: [
@@ -7656,4 +7703,4 @@ function YearPicker({ value, defaultValue = (/* @__PURE__ */ new Date()).getFull
7656
7703
  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
7704
  }
7658
7705
 
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 };
7706
+ 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.0",
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/headless": "0.7.0",
49
+ "@sia-ui/react": "0.7.0",
50
+ "@sia-ui/tokens": "0.7.0",
51
+ "@sia-ui/utils": "0.7.0"
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.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "node scripts/build-theme.mjs --check && tsup",