bonsaif-ui 0.1.156 → 0.1.158

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,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.155 - 2026-09-29
3
+ ## 0.1.157 - 2026-10-01
4
+
5
+ - `SpotlightTour`: recorrido por spotlight para onboarding, ayuda o una guía interna. Incluye `useSpotlightTour`, ejemplo en la documentación y un prompt para pedirle a la IA que lo monte en una vista.
6
+
7
+ ## 0.1.156 - 2026-09-29
4
8
 
5
9
  - `DataTable`: el menú Filtrar / columnas se ancla al **header de la columna** (alineado a la izquierda), no al icono. Evita que el popover se corra hacia la izquierda cuando el menú es más ancho que el botón.
6
10
  - `DataTable`: al marcar **Seleccionar todo**, elegir **cualquier opción** del checklist, o al refrescar filas, el menú **ya no salta a la esquina**; reancla al header vivo e ignora rects inválidos tras el re-render (aplica a cualquier tabla con `DataTable`).
@@ -9,6 +13,10 @@
9
13
  - `DataTable`: el checklist del filtro ya no muestra **duplicados** con el mismo texto (p. ej. nombre cacheado + `userId` con el mismo label); prefiere el id estable.
10
14
  - `DataTable`: persiste el catálogo acumulado del checklist (`filterOptionValues` / labels) junto con los filtros. Al recargar con un filtro activo (p. ej. solo Alain) siguen visibles el resto de opciones para poder sumarlas.
11
15
 
16
+ ## 0.1.155 - 2026-09-29
17
+
18
+ - Misma línea de mejoras de filtros/menú; publicada como **0.1.156**.
19
+
12
20
  ## 0.1.154 - 2026-09-29
13
21
 
14
22
  - `DataTable`: el primer clic en un valor del filtro de columna **incluye solo ese valor** (las demás opciones del checklist siguen visibles gracias a la caché de 0.1.153). Desmarcar y volver a marcar vuelve a filtrar.
package/README.md CHANGED
@@ -41,6 +41,7 @@ For Next.js consumers using a local package or monorepo setup, add `transpilePac
41
41
  | Show tabular records | `DataTable`, `Pagination` | Sorting, selection, loading, empty state, column width behavior, and paging. |
42
42
  | Confirm or edit in context | `Drawer`, `Modal`, `ConfirmDialog` | Overlays with consistent chrome and guardrails for unsaved changes. |
43
43
  | Preview images fullscreen | `ImageLightbox`, `ImageLightboxHost` | Free zoom (may pixelate), pan, counter, and multi-slide navigation. |
44
+ | Walk someone through a screen | `SpotlightTour` | Spotlight overlay that highlights existing elements one step at a time. |
44
45
  | Explain status | `Alert`, `StatusBadge`, `StatusSelect`, `EmptyState`, `LoadingState` | Clear operational feedback for data states and workflows. |
45
46
  | Compose related modules | `DynamicDetailTabs` | Parent-detail layout with lazy loaded child modules. |
46
47
 
@@ -256,6 +257,7 @@ function AccountFormExample() {
256
257
  - `CopyButton`, `CopyLinkButton`: clipboard utilities.
257
258
  - `Modal`, `Drawer`, `ConfirmDialog`: overlays and confirmations.
258
259
  - `ImageLightbox`, `ImageLightboxHost`: fullscreen image viewer with theme tokens, free zoom (may pixelate), pan, optional `loop` / `showThumbnails`, and open/close FLIP animation from the clicked image (`originRect`).
260
+ - `SpotlightTour`: spotlight walkthrough for onboarding, help, or an internal guide. It highlights elements already on the page.
259
261
  - `MouseTooltip`: lightweight hover tooltip.
260
262
 
261
263
  #### Image lightbox
@@ -277,6 +279,64 @@ import { ImageLightbox, ImageLightboxHost } from "bonsaif-ui";
277
279
  </ImageLightboxHost>
278
280
  ```
279
281
 
282
+ #### Spotlight tour
283
+
284
+ Use `SpotlightTour` to explain a screen in place: onboarding, contextual help, or a development guide. Mark each region with `data-tour` and point a step at that selector. `StepWizard` remains the component for a multi-step form.
285
+
286
+ `useSpotlightTour(storageKey)` opens the tour on the first visit. Pass the same `storageKey` to `SpotlightTour`. Closing it (skip, done, Escape, or a click outside) stores `"done"` in `localStorage`. A manual button can open it again.
287
+
288
+ If a step highlights something inside a drawer or modal, open that overlay in `onStepChange` and close it when the step changes away. The tour remeasures the target.
289
+
290
+ ```tsx
291
+ import { Button, SpotlightTour, useSpotlightTour, type SpotlightTourStep } from "bonsaif-ui";
292
+
293
+ const steps: SpotlightTourStep[] = [
294
+ {
295
+ id: "search",
296
+ title: "Search a record",
297
+ target: '[data-tour="search"]',
298
+ placement: "bottom",
299
+ body: <p>Filter the list without leaving the page.</p>,
300
+ },
301
+ ];
302
+
303
+ export function ClientsTour() {
304
+ const tour = useSpotlightTour("my-app:clients:tour:v1");
305
+
306
+ return (
307
+ <>
308
+ <div data-tour="search">{/* existing search */}</div>
309
+ <Button aria-label="Show guide" onClick={tour.openTour}>
310
+ Guide
311
+ </Button>
312
+ <SpotlightTour
313
+ steps={steps}
314
+ open={tour.open}
315
+ onOpenChange={tour.setOpen}
316
+ storageKey="my-app:clients:tour:v1"
317
+ label="Clients"
318
+ />
319
+ </>
320
+ );
321
+ }
322
+ ```
323
+
324
+ Prompt to ask an AI to add the tour to a view:
325
+
326
+ ```text
327
+ Agrega un recorrido guiado con SpotlightTour de bonsaif-ui en esta vista. No construyas un overlay propio ni uses otra librería de tours.
328
+
329
+ 1. Importa SpotlightTour, useSpotlightTour y el tipo SpotlightTourStep desde "bonsaif-ui". El botón que abre el recorrido también es Button de bonsaif-ui.
330
+ 2. Marca cada zona a explicar con data-tour="un-id" en el elemento real de la vista (buscador, tabla, acción, drawer, etc.). El selector del paso es target: '[data-tour="un-id"]'.
331
+ 3. Define un arreglo SpotlightTourStep. Cada paso lleva id, title, body (ReactNode), target y placement ("top" | "bottom" | "left" | "right" | "auto"). caption es opcional: una ruta de archivo o una nota corta.
332
+ 4. Abre el recorrido con estado controlado. useSpotlightTour("app:vista:tour:v1") lo abre solo la primera vez. Pasa el mismo storageKey a SpotlightTour. Al cerrar (Saltar, Listo, Escape o clic fuera) guarda "done" en localStorage. Un botón manual, con aria-label, debe poder abrirlo otra vez con openTour().
333
+ 5. Si un paso señala algo que está dentro de un drawer o modal, ábrelo en onStepChange cuando step.id coincida y ciérralo al salir de ese paso. El tour vuelve a medir el target.
334
+ 6. El texto de los pasos va en un arreglo junto a la vista, no en SQL, servicios ni API routes. label es el nombre del recorrido (por ejemplo "Clientes" o "Guía de desarrollo"), no dejes el default si la pantalla ya tiene un nombre claro.
335
+ 7. No inventes un componente equivalente. Reutiliza SpotlightTour.
336
+ ```
337
+
338
+ The same prompt is on the `SpotlightTour` page of `npm run docs`, with a copy button.
339
+
280
340
  #### Drawer Unsaved Changes Guard
281
341
 
282
342
  Use `hasUnsavedChanges` when a drawer edits data and must not close silently. When the prop is `true`, the drawer intercepts its own close controls: backdrop click, Escape, the X button, and the default Cancel button. It shows a confirmation modal and only calls `onClose` after the user confirms that unsaved data can be discarded.