bonsaif-ui 0.1.20 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +112 -20
  3. package/dist/bonsaif-ui.js +4250 -2887
  4. package/dist/bonsaif-ui.umd.cjs +1 -1
  5. package/dist/components/BonsaifButton/BonsaifButton.stories.d.ts +22 -0
  6. package/dist/components/BonsaifButton/BonsaifButton.stories.d.ts.map +1 -0
  7. package/dist/components/composition/DynamicDetailTabs.stories.d.ts +11 -0
  8. package/dist/components/composition/DynamicDetailTabs.stories.d.ts.map +1 -0
  9. package/dist/components/layout/AuthShell.stories.d.ts +12 -0
  10. package/dist/components/layout/AuthShell.stories.d.ts.map +1 -0
  11. package/dist/components/layout/GlobalScrollbars.stories.d.ts +9 -0
  12. package/dist/components/layout/GlobalScrollbars.stories.d.ts.map +1 -0
  13. package/dist/components/layout/LayoutShells.stories.d.ts +16 -0
  14. package/dist/components/layout/LayoutShells.stories.d.ts.map +1 -0
  15. package/dist/components/layout/PageHeader.d.ts.map +1 -1
  16. package/dist/components/layout/PageHeader.stories.d.ts +12 -0
  17. package/dist/components/layout/PageHeader.stories.d.ts.map +1 -0
  18. package/dist/components/layout/PageSearchInput.d.ts.map +1 -1
  19. package/dist/components/layout/PageSearchInput.stories.d.ts +9 -0
  20. package/dist/components/layout/PageSearchInput.stories.d.ts.map +1 -0
  21. package/dist/components/layout/PrimeAuthRouteShell.stories.d.ts +12 -0
  22. package/dist/components/layout/PrimeAuthRouteShell.stories.d.ts.map +1 -0
  23. package/dist/components/messaging/PrimeSuiteChatFrame.stories.d.ts +14 -0
  24. package/dist/components/messaging/PrimeSuiteChatFrame.stories.d.ts.map +1 -0
  25. package/dist/components/microservices/MicroserviceFrame.stories.d.ts +14 -0
  26. package/dist/components/microservices/MicroserviceFrame.stories.d.ts.map +1 -0
  27. package/dist/components/notifications/PrimeAuthToaster.stories.d.ts +11 -0
  28. package/dist/components/notifications/PrimeAuthToaster.stories.d.ts.map +1 -0
  29. package/dist/components/ui/ActionUtilities.stories.d.ts +13 -0
  30. package/dist/components/ui/ActionUtilities.stories.d.ts.map +1 -0
  31. package/dist/components/ui/Alert.stories.d.ts +23 -0
  32. package/dist/components/ui/Alert.stories.d.ts.map +1 -0
  33. package/dist/components/ui/Button.d.ts.map +1 -1
  34. package/dist/components/ui/Button.stories.d.ts +36 -0
  35. package/dist/components/ui/Button.stories.d.ts.map +1 -0
  36. package/dist/components/ui/CalendarPicker.stories.d.ts +9 -0
  37. package/dist/components/ui/CalendarPicker.stories.d.ts.map +1 -0
  38. package/dist/components/ui/Checkbox.d.ts +3 -1
  39. package/dist/components/ui/Checkbox.d.ts.map +1 -1
  40. package/dist/components/ui/Checkbox.stories.d.ts +10 -0
  41. package/dist/components/ui/Checkbox.stories.d.ts.map +1 -0
  42. package/dist/components/ui/CodeBlock.stories.d.ts +11 -0
  43. package/dist/components/ui/CodeBlock.stories.d.ts.map +1 -0
  44. package/dist/components/ui/CompactFilterSelect.stories.d.ts +11 -0
  45. package/dist/components/ui/CompactFilterSelect.stories.d.ts.map +1 -0
  46. package/dist/components/ui/CompactSearchInput.stories.d.ts +11 -0
  47. package/dist/components/ui/CompactSearchInput.stories.d.ts.map +1 -0
  48. package/dist/components/ui/ConfirmDialog.stories.d.ts +9 -0
  49. package/dist/components/ui/ConfirmDialog.stories.d.ts.map +1 -0
  50. package/dist/components/ui/CopyButton.stories.d.ts +11 -0
  51. package/dist/components/ui/CopyButton.stories.d.ts.map +1 -0
  52. package/dist/components/ui/CopyLinkButton.stories.d.ts +11 -0
  53. package/dist/components/ui/CopyLinkButton.stories.d.ts.map +1 -0
  54. package/dist/components/ui/DataDisplay.stories.d.ts +11 -0
  55. package/dist/components/ui/DataDisplay.stories.d.ts.map +1 -0
  56. package/dist/components/ui/DataTable.d.ts +2 -0
  57. package/dist/components/ui/DataTable.d.ts.map +1 -1
  58. package/dist/components/ui/DataTable.stories.d.ts +9 -0
  59. package/dist/components/ui/DataTable.stories.d.ts.map +1 -0
  60. package/dist/components/ui/DateRangePicker.stories.d.ts +9 -0
  61. package/dist/components/ui/DateRangePicker.stories.d.ts.map +1 -0
  62. package/dist/components/ui/Drawer.d.ts.map +1 -1
  63. package/dist/components/ui/Drawer.stories.d.ts +9 -0
  64. package/dist/components/ui/Drawer.stories.d.ts.map +1 -0
  65. package/dist/components/ui/DropdownMenu.d.ts.map +1 -1
  66. package/dist/components/ui/DropdownMenu.stories.d.ts +9 -0
  67. package/dist/components/ui/DropdownMenu.stories.d.ts.map +1 -0
  68. package/dist/components/ui/EmailField.stories.d.ts +11 -0
  69. package/dist/components/ui/EmailField.stories.d.ts.map +1 -0
  70. package/dist/components/ui/EmptyState.stories.d.ts +22 -0
  71. package/dist/components/ui/EmptyState.stories.d.ts.map +1 -0
  72. package/dist/components/ui/Feedback.stories.d.ts +18 -0
  73. package/dist/components/ui/Feedback.stories.d.ts.map +1 -0
  74. package/dist/components/ui/FeedbackComponents.stories.d.ts +11 -0
  75. package/dist/components/ui/FeedbackComponents.stories.d.ts.map +1 -0
  76. package/dist/components/ui/FileUpload.d.ts +29 -0
  77. package/dist/components/ui/FileUpload.d.ts.map +1 -0
  78. package/dist/components/ui/FileUpload.stories.d.ts +57 -0
  79. package/dist/components/ui/FileUpload.stories.d.ts.map +1 -0
  80. package/dist/components/ui/FormField.stories.d.ts +16 -0
  81. package/dist/components/ui/FormField.stories.d.ts.map +1 -0
  82. package/dist/components/ui/FormFields.stories.d.ts +30 -0
  83. package/dist/components/ui/FormFields.stories.d.ts.map +1 -0
  84. package/dist/components/ui/InputField.stories.d.ts +26 -0
  85. package/dist/components/ui/InputField.stories.d.ts.map +1 -0
  86. package/dist/components/ui/LoadingState.d.ts.map +1 -1
  87. package/dist/components/ui/LoadingState.stories.d.ts +10 -0
  88. package/dist/components/ui/LoadingState.stories.d.ts.map +1 -0
  89. package/dist/components/ui/Modal.d.ts.map +1 -1
  90. package/dist/components/ui/Modal.stories.d.ts +9 -0
  91. package/dist/components/ui/Modal.stories.d.ts.map +1 -0
  92. package/dist/components/ui/MouseTooltip.d.ts +7 -1
  93. package/dist/components/ui/MouseTooltip.d.ts.map +1 -1
  94. package/dist/components/ui/MouseTooltip.stories.d.ts +9 -0
  95. package/dist/components/ui/MouseTooltip.stories.d.ts.map +1 -0
  96. package/dist/components/ui/MultiSelect.d.ts +3 -2
  97. package/dist/components/ui/MultiSelect.d.ts.map +1 -1
  98. package/dist/components/ui/MultiSelect.stories.d.ts +11 -0
  99. package/dist/components/ui/MultiSelect.stories.d.ts.map +1 -0
  100. package/dist/components/ui/Navigation.stories.d.ts +12 -0
  101. package/dist/components/ui/Navigation.stories.d.ts.map +1 -0
  102. package/dist/components/ui/NumberField.stories.d.ts +11 -0
  103. package/dist/components/ui/NumberField.stories.d.ts.map +1 -0
  104. package/dist/components/ui/Overlays.stories.d.ts +11 -0
  105. package/dist/components/ui/Overlays.stories.d.ts.map +1 -0
  106. package/dist/components/ui/Pagination.stories.d.ts +9 -0
  107. package/dist/components/ui/Pagination.stories.d.ts.map +1 -0
  108. package/dist/components/ui/PhoneField.stories.d.ts +11 -0
  109. package/dist/components/ui/PhoneField.stories.d.ts.map +1 -0
  110. package/dist/components/ui/RadioGroup.stories.d.ts +11 -0
  111. package/dist/components/ui/RadioGroup.stories.d.ts.map +1 -0
  112. package/dist/components/ui/RichTextEditor.d.ts +8 -0
  113. package/dist/components/ui/RichTextEditor.d.ts.map +1 -0
  114. package/dist/components/ui/RichTextEditor.stories.d.ts +19 -0
  115. package/dist/components/ui/RichTextEditor.stories.d.ts.map +1 -0
  116. package/dist/components/ui/SearchableSelect.stories.d.ts +11 -0
  117. package/dist/components/ui/SearchableSelect.stories.d.ts.map +1 -0
  118. package/dist/components/ui/SectionPanel.stories.d.ts +9 -0
  119. package/dist/components/ui/SectionPanel.stories.d.ts.map +1 -0
  120. package/dist/components/ui/StatusBadge.stories.d.ts +27 -0
  121. package/dist/components/ui/StatusBadge.stories.d.ts.map +1 -0
  122. package/dist/components/ui/StatusSelect.d.ts +29 -0
  123. package/dist/components/ui/StatusSelect.d.ts.map +1 -0
  124. package/dist/components/ui/StatusSelect.stories.d.ts +9 -0
  125. package/dist/components/ui/StatusSelect.stories.d.ts.map +1 -0
  126. package/dist/components/ui/StepWizard.stories.d.ts +9 -0
  127. package/dist/components/ui/StepWizard.stories.d.ts.map +1 -0
  128. package/dist/components/ui/Tabs.stories.d.ts +9 -0
  129. package/dist/components/ui/Tabs.stories.d.ts.map +1 -0
  130. package/dist/components/ui/TextInput.stories.d.ts +15 -0
  131. package/dist/components/ui/TextInput.stories.d.ts.map +1 -0
  132. package/dist/components/ui/Textarea.stories.d.ts +17 -0
  133. package/dist/components/ui/Textarea.stories.d.ts.map +1 -0
  134. package/dist/components/ui/TextareaField.stories.d.ts +20 -0
  135. package/dist/components/ui/TextareaField.stories.d.ts.map +1 -0
  136. package/dist/components/ui/Toggle.stories.d.ts +31 -0
  137. package/dist/components/ui/Toggle.stories.d.ts.map +1 -0
  138. package/dist/components/ui/index.d.ts +6 -0
  139. package/dist/components/ui/index.d.ts.map +1 -1
  140. package/dist/components/users/UserAvatar.stories.d.ts +12 -0
  141. package/dist/components/users/UserAvatar.stories.d.ts.map +1 -0
  142. package/dist/index.d.ts +1 -0
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/lib/validationVisibility.d.ts +12 -0
  145. package/dist/lib/validationVisibility.d.ts.map +1 -0
  146. package/dist/styles.css +1 -1
  147. package/package.json +9 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.22 - 2026-05-06
4
+
5
+ - Replace `StatusSelect` native select behavior with a fully custom Bonsaif dropdown menu for consistent inline status changes.
6
+
7
+ ## 0.1.21 - 2026-05-06
8
+
9
+ - Add `StatusSelect`, a compact pill-style select for changing statuses inline while preserving badge-like visual styling.
10
+
3
11
  ## 0.1.18 - 2026-05-06
4
12
 
5
13
  - Render `DataTable` rows with CSS Grid instead of native table layout so column widths, resize handles, sticky columns, and future customization are controlled by the component.
package/README.md CHANGED
@@ -1,25 +1,66 @@
1
1
  # bonsaif-ui
2
2
 
3
- Reusable React components for Bonsaif applications.
3
+ Reusable React components for Bonsaif applications. The package focuses on internal product screens: dense forms, admin tables, status feedback, drawers, page headers, and service composition patterns.
4
4
 
5
- ## Package
5
+ ## Start Here
6
+
7
+ Install the package, import the stylesheet once in the app shell, and then import only the components needed by each screen.
6
8
 
7
9
  ```bash
8
10
  npm install bonsaif-ui
9
11
  ```
10
12
 
11
- ## Usage
12
-
13
13
  ```tsx
14
- import { Button, DataTable, PageHeader } from "bonsaif-ui";
14
+ import { Button, FileUpload, PageHeader } from "bonsaif-ui";
15
15
  import "bonsaif-ui/styles.css";
16
16
 
17
17
  export function Example() {
18
- return <Button>Save</Button>;
18
+ return (
19
+ <>
20
+ <PageHeader title="Documentos" currentPath="/admin/documents" />
21
+ <FileUpload
22
+ label="Adjuntos"
23
+ multiple
24
+ onFilesChange={(files) => console.log(files)}
25
+ />
26
+ <Button>Guardar</Button>
27
+ </>
28
+ );
19
29
  }
20
30
  ```
21
31
 
22
- ## Components
32
+ For Next.js consumers using a local package or monorepo setup, add `transpilePackages: ["bonsaif-ui"]` in `next.config.ts`.
33
+
34
+ ## Choose A Component
35
+
36
+ | Need | Start with | Why |
37
+ | --- | --- | --- |
38
+ | Build an admin page header | `PageHeader` | Breadcrumbs, metadata, page actions, and compact action buttons. |
39
+ | Capture form data | `InputField`, `EmailField`, `PhoneField`, `NumberField`, `FileUpload` | Shared labels, helpers, errors, focus states, and validation surfaces. |
40
+ | Search or filter a list | `SearchableSelect`, `CompactFilterSelect`, `CompactSearchInput` | Compact controls that work inside toolbars and table headers. |
41
+ | Show tabular records | `DataTable`, `Pagination` | Sorting, selection, loading, empty state, column width behavior, and paging. |
42
+ | Confirm or edit in context | `Drawer`, `Modal`, `ConfirmDialog` | Overlays with consistent chrome and guardrails for unsaved changes. |
43
+ | Explain status | `Alert`, `StatusBadge`, `StatusSelect`, `EmptyState`, `LoadingState` | Clear operational feedback for data states and workflows. |
44
+ | Compose related modules | `DynamicDetailTabs` | Parent-detail layout with lazy loaded child modules. |
45
+
46
+ ## Documentation Playground
47
+
48
+ Use Storybook for component documentation and the playground for full-screen integration examples.
49
+
50
+ ```bash
51
+ npm run storybook
52
+ npm run storybook:build
53
+ ```
54
+
55
+ Storybook is the main documentation surface for individual components. It includes autodocs, controls, accessibility checks, and isolated states such as `disabled`, `error`, `loading`, single-file upload, and multi-file upload.
56
+
57
+ Run the playground when you need to see spacing, page headers, navigation, copy buttons, dark mode, and integrated behavior in one app-like screen.
58
+
59
+ ```bash
60
+ npm run playground
61
+ ```
62
+
63
+ ## Component Map
23
64
 
24
65
  The package includes reusable components migrated from `prime-auth` and new shared primitives for Bonsaif apps.
25
66
 
@@ -33,15 +74,60 @@ The package includes reusable components migrated from `prime-auth` and new shar
33
74
  ### Forms
34
75
 
35
76
  - `InputField`, `EmailField`, `PhoneField`, `NumberField`, `TextInput`, `Textarea`: inputs with Bonsaif styling and inline validation for email and phone values.
77
+ - `FileUpload`: drag-and-drop or click-to-browse file selection with single-file and multi-file modes.
36
78
  - `SearchableSelect`, `CompactFilterSelect`, `CompactSearchInput`: select and filter controls.
37
79
  - `CalendarPicker`, `DateRangePicker`: single-date and range selection.
38
80
  - `Checkbox`, `RadioGroup`, `Toggle`: boolean and option controls.
39
81
  - `FormField`: label, helper, error, and required wrapper for custom controls.
40
82
 
83
+ ### File Uploads
84
+
85
+ Use `FileUpload` when a form needs attachments, CSV imports, evidence files, or any file selector that should support both drag-and-drop and regular browsing.
86
+
87
+ ```tsx
88
+ import { useState } from "react";
89
+ import { FileUpload } from "bonsaif-ui";
90
+
91
+ export function AttachmentField() {
92
+ const [files, setFiles] = useState<File[]>([]);
93
+
94
+ return (
95
+ <FileUpload
96
+ label="Adjuntos"
97
+ multiple
98
+ appendFiles
99
+ maxFiles={4}
100
+ accept=".pdf,.png,.jpg,.jpeg,.csv"
101
+ value={files}
102
+ onFilesChange={setFiles}
103
+ helperText="PDF, imagenes o CSV. Maximo 4 archivos."
104
+ onRejectedFiles={(rejectedFiles) => {
105
+ console.warn("Archivos rechazados", rejectedFiles);
106
+ }}
107
+ />
108
+ );
109
+ }
110
+ ```
111
+
112
+ Useful props:
113
+
114
+ | Prop | Description |
115
+ | --- | --- |
116
+ | `multiple` | Allows selecting or dropping more than one file. |
117
+ | `accept` | Native accept filter plus drag-and-drop filtering for MIME types and extensions. |
118
+ | `maxFiles` | Limits the accepted file list. |
119
+ | `appendFiles` | Adds new files to the current selection instead of replacing it. |
120
+ | `value` / `defaultValue` | Controlled or uncontrolled selected files. |
121
+ | `onFilesChange` | Receives the accepted `File[]`. |
122
+ | `onRejectedFiles` | Receives files blocked by `accept`. |
123
+ | `showFileList` | Shows or hides the selected file list. |
124
+
41
125
  #### Form Validation
42
126
 
43
127
  Use `validateForm` with reusable validators to validate complete forms before saving. Validators run in order and return the first error per field. Add `noValidate` to the form to avoid native browser validation, then pass each error to the field with `errorDisplay="tooltip"` when the message should appear in the compact validation tooltip.
44
128
 
129
+ Use `useValidationVisibility` when a form should validate immediately for save-button state but should not show red errors until the user touches a field or attempts to submit. Call `submit()` before blocking an invalid save, `touchField(field)` from `onChange`/`onBlur`, and `reset()` when opening a new draft.
130
+
45
131
  ```tsx
46
132
  import { useMemo, useState, type FormEvent } from "react";
47
133
  import {
@@ -54,6 +140,7 @@ import {
54
140
  phoneFormat,
55
141
  required,
56
142
  validateForm,
143
+ useValidationVisibility,
57
144
  type ValidationSchema,
58
145
  } from "bonsaif-ui";
59
146
 
@@ -93,12 +180,15 @@ function AccountFormExample() {
93
180
  [form],
94
181
  );
95
182
  const errors = validationResult.errors;
183
+ const validationVisibility = useValidationVisibility(errors);
96
184
 
97
185
  function submitForm(event: FormEvent<HTMLFormElement>) {
98
186
  event.preventDefault();
187
+ validationVisibility.submit();
99
188
  if (!validationResult.valid) return;
100
189
 
101
190
  saveAccount(form);
191
+ validationVisibility.reset();
102
192
  }
103
193
 
104
194
  return (
@@ -106,9 +196,17 @@ function AccountFormExample() {
106
196
  <EmailField
107
197
  label="Correo"
108
198
  value={form.contactEmail}
109
- error={errors.contactEmail}
199
+ error={validationVisibility.getFieldError("contactEmail")}
110
200
  validate={false}
111
201
  errorDisplay="tooltip"
202
+ onChange={(event) => {
203
+ validationVisibility.touchField("contactEmail");
204
+ setForm((current) => ({
205
+ ...current,
206
+ contactEmail: event.currentTarget.value,
207
+ }));
208
+ }}
209
+ onBlur={() => validationVisibility.touchField("contactEmail")}
112
210
  />
113
211
  <PhoneField
114
212
  label="Telefono"
@@ -118,13 +216,15 @@ function AccountFormExample() {
118
216
  }
119
217
  allowedCountryCodes={["+1", "+34", "+52", "+57", "+58"]}
120
218
  value={form.contactPhone}
121
- onChange={(event) =>
219
+ onChange={(event) => {
220
+ validationVisibility.touchField("contactPhone");
122
221
  setForm((current) => ({
123
222
  ...current,
124
223
  contactPhone: event.currentTarget.value,
125
- }))
126
- }
127
- error={errors.contactPhone}
224
+ }));
225
+ }}
226
+ onBlur={() => validationVisibility.touchField("contactPhone")}
227
+ error={validationVisibility.getFieldError("contactPhone")}
128
228
  validate={false}
129
229
  errorDisplay="tooltip"
130
230
  />
@@ -237,14 +337,6 @@ How it works:
237
337
 
238
338
  App-coupled components were adapted to receive routing, session, and navigation data through props so the library does not import private `prime-auth` modules.
239
339
 
240
- ## Playground Documentation
241
-
242
- Run the playground to browse the components by category. Each code example includes a copy action powered by `CopyButton`.
243
-
244
- ```bash
245
- npm run playground
246
- ```
247
-
248
340
  ## UI Primitives
249
341
 
250
342
  Small primitives cover common product UI patterns while keeping the same Bonsaif visual tokens.