@axzydev/axzy_ui_system 1.2.7 → 1.2.9

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 (186) hide show
  1. package/README.md +105 -53
  2. package/dist/index.cjs +576 -398
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.css +1 -1
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.d.cts +1463 -86
  7. package/dist/index.d.ts +1463 -86
  8. package/dist/index.js +597 -417
  9. package/dist/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/App.tsx +26 -54
  12. package/src/components/alert/alert.doc.mdx +48 -0
  13. package/src/components/alert/alert.props.ts +7 -0
  14. package/src/components/alert/alert.tsx +8 -0
  15. package/src/components/avatar/avatar.doc.mdx +48 -0
  16. package/src/components/avatar/avatar.props.ts +8 -0
  17. package/src/components/avatar/avatar.tsx +25 -5
  18. package/src/components/badget/badget.doc.mdx +46 -0
  19. package/src/components/badget/badget.props.ts +6 -0
  20. package/src/components/badget/badget.tsx +11 -0
  21. package/src/components/breadcrumbs/breadcrumbs.doc.mdx +57 -0
  22. package/src/components/breadcrumbs/breadcrumbs.props.ts +6 -0
  23. package/src/components/breadcrumbs/breadcrumbs.tsx +12 -0
  24. package/src/components/button/button.doc.mdx +59 -0
  25. package/src/components/button/button.props.ts +12 -0
  26. package/src/components/button/button.tsx +11 -0
  27. package/src/components/calendar/calendar.doc.mdx +75 -0
  28. package/src/components/calendar/calendar.props.ts +27 -7
  29. package/src/components/calendar/calendar.tsx +13 -0
  30. package/src/components/card/card.doc.mdx +54 -0
  31. package/src/components/card/card.props.ts +11 -0
  32. package/src/components/card/card.tsx +13 -0
  33. package/src/components/checkbox/checkbox.doc.mdx +54 -0
  34. package/src/components/checkbox/checkbox.props.ts +7 -0
  35. package/src/components/checkbox/checkbox.tsx +9 -0
  36. package/src/components/confirm-dialog/confirm-dialog.doc.mdx +60 -0
  37. package/src/components/confirm-dialog/confirm-dialog.props.ts +9 -0
  38. package/src/components/confirm-dialog/confirm-dialog.tsx +19 -0
  39. package/src/components/data-table/ITDataTable.doc.mdx +59 -0
  40. package/src/components/data-table/dataTable.props.ts +15 -0
  41. package/src/components/data-table/dataTable.tsx +178 -73
  42. package/src/components/date-picker/date-picker.doc.mdx +65 -0
  43. package/src/components/date-picker/date-picker.props.ts +17 -0
  44. package/src/components/date-picker/datePicker.tsx +31 -1
  45. package/src/components/dialog/dialog.doc.mdx +54 -0
  46. package/src/components/dialog/dialog.props.ts +7 -0
  47. package/src/components/dialog/dialog.tsx +26 -0
  48. package/src/components/divider/divider.doc.mdx +42 -0
  49. package/src/components/divider/divider.props.ts +5 -0
  50. package/src/components/divider/divider.tsx +16 -0
  51. package/src/components/drawer/drawer.doc.mdx +59 -0
  52. package/src/components/drawer/drawer.props.ts +9 -0
  53. package/src/components/drawer/drawer.tsx +20 -0
  54. package/src/components/dropfile/dropfile.doc.mdx +59 -0
  55. package/src/components/dropfile/dropfile.props.ts +41 -0
  56. package/src/components/dropfile/dropfile.tsx +21 -33
  57. package/src/components/empty-state/empty-state.doc.mdx +50 -0
  58. package/src/components/empty-state/empty-state.props.ts +5 -0
  59. package/src/components/empty-state/empty-state.tsx +16 -0
  60. package/src/components/flex/flex.doc.mdx +59 -0
  61. package/src/components/flex/flex.props.ts +13 -0
  62. package/src/components/flex/flex.tsx +15 -0
  63. package/src/components/form-builder/fieldRenderer.tsx +52 -2
  64. package/src/components/form-builder/formBuilder.doc.mdx +124 -0
  65. package/src/components/form-builder/formBuilder.props.ts +12 -2
  66. package/src/components/form-builder/formBuilder.tsx +31 -0
  67. package/src/components/form-header/form-header.doc.mdx +38 -0
  68. package/src/components/form-header/form-header.props.ts +3 -0
  69. package/src/components/form-header/form-header.stories.tsx +53 -0
  70. package/src/components/form-header/form-header.tsx +11 -0
  71. package/src/components/grid/grid.doc.mdx +54 -0
  72. package/src/components/grid/grid.props.ts +13 -0
  73. package/src/components/grid/grid.tsx +19 -0
  74. package/src/components/image/image.doc.mdx +44 -0
  75. package/src/components/image/image.props.ts +5 -0
  76. package/src/components/image/image.stories.tsx +49 -0
  77. package/src/components/image/image.tsx +19 -0
  78. package/src/components/input/input.doc.mdx +70 -0
  79. package/src/components/input/input.props.ts +34 -2
  80. package/src/components/input/input.tsx +29 -0
  81. package/src/components/layout/layout.doc.mdx +51 -0
  82. package/src/components/layout/layout.props.ts +5 -0
  83. package/src/components/layout/layout.tsx +29 -2
  84. package/src/components/loader/loader.doc.mdx +43 -0
  85. package/src/components/loader/loader.props.ts +4 -0
  86. package/src/components/loader/loader.tsx +17 -0
  87. package/src/components/navbar/navbar.doc.mdx +77 -0
  88. package/src/components/navbar/navbar.props.ts +37 -1
  89. package/src/components/navbar/navbar.stories.tsx +84 -0
  90. package/src/components/navbar/navbar.tsx +27 -0
  91. package/src/components/page/page.doc.mdx +80 -0
  92. package/src/components/page/page.props.ts +21 -0
  93. package/src/components/page/page.tsx +18 -0
  94. package/src/components/page-header/page-header.doc.mdx +54 -0
  95. package/src/components/page-header/page-header.props.ts +9 -0
  96. package/src/components/page-header/page-header.tsx +15 -0
  97. package/src/components/pagination/pagination.doc.mdx +62 -0
  98. package/src/components/pagination/pagination.props.ts +11 -32
  99. package/src/components/pagination/pagination.tsx +17 -0
  100. package/src/components/popover/popover.doc.mdx +53 -0
  101. package/src/components/popover/popover.props.ts +8 -0
  102. package/src/components/popover/popover.tsx +13 -0
  103. package/src/components/progress/progress.doc.mdx +48 -0
  104. package/src/components/progress/progress.props.ts +8 -0
  105. package/src/components/progress/progress.tsx +9 -0
  106. package/src/components/radio/radio.doc.mdx +62 -0
  107. package/src/components/radio/radio.props.ts +11 -0
  108. package/src/components/radio/radio.tsx +18 -0
  109. package/src/components/search-select/search-select.doc.mdx +72 -0
  110. package/src/components/search-select/search-select.props.ts +23 -18
  111. package/src/components/search-select/search-select.tsx +27 -2
  112. package/src/components/searchTable/searchTable.doc.mdx +79 -0
  113. package/src/components/searchTable/searchTable.props.ts +42 -3
  114. package/src/components/searchTable/searchTable.stories.tsx +74 -0
  115. package/src/components/searchTable/searchTable.tsx +23 -0
  116. package/src/components/segmented-control/segmented-control.doc.mdx +60 -0
  117. package/src/components/segmented-control/segmented-control.props.ts +12 -0
  118. package/src/components/segmented-control/segmented-control.tsx +15 -0
  119. package/src/components/select/select.doc.mdx +75 -0
  120. package/src/components/select/select.props.ts +22 -0
  121. package/src/components/select/select.tsx +2 -5
  122. package/src/components/sidebar/sidebar.doc.mdx +86 -0
  123. package/src/components/sidebar/sidebar.props.ts +22 -0
  124. package/src/components/sidebar/sidebar.tsx +22 -0
  125. package/src/components/skeleton/skeleton.doc.mdx +43 -0
  126. package/src/components/skeleton/skeleton.props.ts +8 -0
  127. package/src/components/skeleton/skeleton.tsx +10 -0
  128. package/src/components/slide/slide.doc.mdx +46 -0
  129. package/src/components/slide/slide.props.ts +11 -24
  130. package/src/components/slide/slide.tsx +10 -1
  131. package/src/components/slider/slider.doc.mdx +49 -0
  132. package/src/components/slider/slider.props.ts +9 -0
  133. package/src/components/slider/slider.tsx +15 -0
  134. package/src/components/stack/stack.doc.mdx +126 -0
  135. package/src/components/stack/stack.props.ts +18 -0
  136. package/src/components/stack/stack.stories.tsx +221 -16
  137. package/src/components/stack/stack.tsx +21 -0
  138. package/src/components/stat-card/stat-card.doc.mdx +48 -0
  139. package/src/components/stat-card/stat-card.props.ts +9 -0
  140. package/src/components/stat-card/stat-card.tsx +10 -0
  141. package/src/components/stepper/stepper.doc.mdx +54 -0
  142. package/src/components/stepper/stepper.props.ts +11 -1
  143. package/src/components/stepper/stepper.tsx +15 -0
  144. package/src/components/table/table.doc.mdx +58 -0
  145. package/src/components/table/table.props.ts +17 -0
  146. package/src/components/table/table.tsx +199 -84
  147. package/src/components/tabs/tabs.doc.mdx +52 -0
  148. package/src/components/tabs/tabs.props.ts +11 -0
  149. package/src/components/tabs/tabs.tsx +14 -0
  150. package/src/components/text/text.doc.mdx +41 -0
  151. package/src/components/text/text.props.ts +5 -0
  152. package/src/components/text/text.stories.tsx +67 -0
  153. package/src/components/text/text.tsx +10 -0
  154. package/src/components/textarea/textarea.doc.mdx +64 -0
  155. package/src/components/textarea/textarea.props.ts +11 -0
  156. package/src/components/textarea/textarea.tsx +16 -0
  157. package/src/components/theme-provider/themeProvider.doc.mdx +75 -0
  158. package/src/components/theme-provider/themeProvider.props.ts +3 -0
  159. package/src/components/theme-provider/themeProvider.stories.tsx +59 -0
  160. package/src/components/theme-provider/themeProvider.tsx +14 -0
  161. package/src/components/time-picker/timePicker.doc.mdx +68 -0
  162. package/src/components/time-picker/timePicker.props.ts +14 -0
  163. package/src/components/time-picker/timePicker.tsx +22 -1
  164. package/src/components/toast/toast.doc.mdx +50 -0
  165. package/src/components/toast/toast.props.ts +5 -0
  166. package/src/components/toast/toast.tsx +21 -0
  167. package/src/components/tooltip/tooltip.doc.mdx +47 -0
  168. package/src/components/tooltip/tooltip.props.ts +6 -0
  169. package/src/components/tooltip/tooltip.tsx +19 -0
  170. package/src/components/topbar/topbar.doc.mdx +69 -0
  171. package/src/components/topbar/topbar.props.ts +15 -0
  172. package/src/components/topbar/topbar.tsx +38 -0
  173. package/src/components/triple-filter/tripleFilter.doc.mdx +62 -0
  174. package/src/components/triple-filter/tripleFilter.props.ts +7 -0
  175. package/src/components/triple-filter/tripleFilter.tsx +32 -0
  176. package/src/index.css +2 -0
  177. package/src/showcases/DataShowcases.tsx +529 -45
  178. package/src/showcases/FormShowcases.tsx +399 -29
  179. package/src/showcases/GettingStartedShowcase.tsx +207 -0
  180. package/src/showcases/HomeShowcase.tsx +252 -272
  181. package/src/showcases/LayoutPrimitivesShowcases.tsx +1224 -248
  182. package/src/showcases/PageShowcases.tsx +688 -391
  183. package/src/showcases/ShowcaseLayout.tsx +237 -73
  184. package/src/showcases/StructureShowcases.tsx +846 -73
  185. package/src/types/table.types.ts +1 -1
  186. package/src/utils/styles.ts +2 -1
@@ -0,0 +1,72 @@
1
+ import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
2
+ import * as Stories from './search-select.stories';
3
+
4
+ <Meta of={Stories} />
5
+
6
+ # ITSearchSelect
7
+
8
+ Searchable dropdown select with support for local client-side filtering and remote API search. Includes validation error display, label support, and customizable field mapping.
9
+
10
+ ## Props
11
+
12
+ | Prop | Type | Default | Description |
13
+ |------|------|---------|-------------|
14
+ | `name` | `string` | — | Name attribute for form integrations. |
15
+ | `label` | `string` | — | Label displayed above the select input. |
16
+ | `placeholder` | `string` | — | Placeholder text shown when no value is selected. |
17
+ | `value` | `string \| number` | — | Currently selected value (controlled). |
18
+ | `options` | `ITSearchSelectOption[]` | — | Array of options for static or remote data. `{ label, value, ...custom }`. |
19
+ | `valueField` | `string` | `"value"` | Field used as the option value. |
20
+ | `labelField` | `string` | `"label"` | Field used as the option display label. |
21
+ | `onChange` | `(value: string \| number, option?: ITSearchSelectOption) => void` | — | Callback fired when selection changes. |
22
+ | `onBlur` | `(e: FocusEvent<any>) => void` | — | Callback fired when input loses focus. |
23
+ | `disabled` | `boolean` | `false` | Whether the component is disabled. |
24
+ | `className` | `string` | — | Additional CSS classes for the container. |
25
+ | `touched` | `boolean` | — | Whether the field has been touched (for form validation). |
26
+ | `required` | `boolean` | `false` | Whether the field is required. Shows a red asterisk. |
27
+ | `error` | `string \| boolean` | — | Error message or boolean indicating an error state. |
28
+ | `readOnly` | `boolean` | `false` | Whether the field is read-only. |
29
+ | `onSearch` | `(query: string) => void` | — | Callback for server-side search. Receives the search query string. |
30
+ | `isLoading` | `boolean` | `false` | Whether options are being loaded from an external API. |
31
+ | `noResultsMessage` | `string` | `"No se encontraron resultados"` | Message displayed when no results match the search. |
32
+
33
+ ## Usage
34
+
35
+ ```tsx
36
+ import { ITSearchSelect } from '@axzydev/axzy_ui_system';
37
+
38
+ <ITSearchSelect
39
+ name="user"
40
+ label="Select User"
41
+ placeholder="Search user..."
42
+ options={users}
43
+ value={selected}
44
+ onChange={(val) => setSelected(val)}
45
+ />
46
+
47
+ <ITSearchSelect
48
+ name="remote"
49
+ label="API Search"
50
+ placeholder="Type to search..."
51
+ options={remoteOptions}
52
+ isLoading={loading}
53
+ onSearch={(query) => fetchResults(query)}
54
+ value={selected}
55
+ onChange={(val) => setSelected(val)}
56
+ />
57
+ ```
58
+
59
+ ## Notes
60
+
61
+ - **Static mode**: provide an `options` array and the component filters client-side as the user types.
62
+ - **Remote mode**: provide an `onSearch` callback and manage `options`/`isLoading` externally for API-driven searches.
63
+ - `valueField` and `labelField` allow custom option object structures beyond `{ value, label }`.
64
+ - Validation states: `error` string displays inline, `touched` gates error visibility, `required` adds a red asterisk.
65
+ - `readOnly` mode renders the selected value as non-interactive text.
66
+ - Supports `className` for style overrides and width control.
67
+
68
+ ## Stories
69
+
70
+ <Primary />
71
+ <Controls />
72
+ <Stories />
@@ -1,46 +1,51 @@
1
1
  import { FocusEvent } from "react";
2
2
 
3
+ /** Represents an option in the search-select dropdown. */
3
4
  export interface ITSearchSelectOption {
5
+ /** Display label for the option. */
4
6
  label: string;
7
+ /** Value associated with the option. */
5
8
  value: string | number;
9
+ /** Additional custom fields can be attached. */
6
10
  [key: string]: any;
7
11
  }
8
12
 
13
+ /** Props for the ITSearchSelect component. */
9
14
  export interface ITSearchSelectProps {
10
- /** Nombre del campo para integraciones con formularios */
15
+ /** Name attribute for form integrations. */
11
16
  name?: string;
12
- /** Etiqueta que se muestra arriba del select */
17
+ /** Label displayed above the select input. */
13
18
  label?: string;
14
- /** Texto que se muestra cuando no hay nada seleccionado */
19
+ /** Placeholder text shown when no value is selected. */
15
20
  placeholder?: string;
16
- /** Valor seleccionado */
21
+ /** Currently selected value. */
17
22
  value?: string | number;
18
- /** Arreglo de opciones (Modo 1: Lista estática) */
23
+ /** Array of options for static mode (Mode 1: local client-side filtering). */
19
24
  options?: ITSearchSelectOption[];
20
- /** Campo que se usará como valor (por defecto "value") */
25
+ /** Field used as the option value. Default: "value". */
21
26
  valueField?: string;
22
- /** Campo que se usará como etiqueta (por defecto "label") */
27
+ /** Field used as the option display label. Default: "label". */
23
28
  labelField?: string;
24
- /** Callback cuando cambia el valor */
29
+ /** Callback fired when the selected value changes. Receives the value and the full option object. */
25
30
  onChange?: (value: string | number, option?: ITSearchSelectOption) => void;
26
- /** Callback cuando pierde el foco */
31
+ /** Callback fired when the input loses focus. */
27
32
  onBlur?: (e: FocusEvent<any>) => void;
28
- /** Indica si el componente está deshabilitado */
33
+ /** Whether the component is disabled. */
29
34
  disabled?: boolean;
30
- /** Clase CSS adicional para el contenedor */
35
+ /** Additional CSS classes for the container. */
31
36
  className?: string;
32
- /** Indica si el campo ha sido tocado (para validaciones) */
37
+ /** Whether the field has been touched (for form validation). */
33
38
  touched?: boolean;
34
- /** Indica si el campo es requerido */
39
+ /** Whether the field is required. Shows a red asterisk on the label. */
35
40
  required?: boolean;
36
- /** Mensaje de error */
41
+ /** Error message or boolean indicating an error state. */
37
42
  error?: string | boolean;
38
- /** Indica si el campo es de solo lectura */
43
+ /** Whether the field is read-only. */
39
44
  readOnly?: boolean;
40
- /** Callback para búsqueda en servidor (Modo 2: Conexión con API) */
45
+ /** Callback for server-side search (Mode 2: API connection). Receives the search query string. */
41
46
  onSearch?: (query: string) => void;
42
- /** Indica si se está cargando información desde la API */
47
+ /** Whether options are being loaded from an external API. */
43
48
  isLoading?: boolean;
44
- /** Mensaje cuando no hay resultados */
49
+ /** Message displayed when no results are found. Default: "No se encontraron resultados". */
45
50
  noResultsMessage?: string;
46
51
  }
@@ -6,8 +6,33 @@ import { theme } from "@/theme/theme";
6
6
  import ITText from "@/components/text/text";
7
7
 
8
8
  /**
9
- * ITSearchSelect - Un componente de selección con buscador integrado.
10
- * Soporta filtrado local y búsqueda remota via API.
9
+ * Searchable dropdown select with local client-side filtering and server-side search via API.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * // Static options (Mode 1)
14
+ * <ITSearchSelect
15
+ * label="Country"
16
+ * placeholder="Select a country"
17
+ * options={[
18
+ * { value: 'us', label: 'United States' },
19
+ * { value: 'mx', label: 'Mexico' },
20
+ * ]}
21
+ * value={selectedCountry}
22
+ * onChange={(value) => setSelectedCountry(value)}
23
+ * />
24
+ *
25
+ * // API search (Mode 2)
26
+ * <ITSearchSelect
27
+ * label="User"
28
+ * placeholder="Search users..."
29
+ * onSearch={(query) => searchUsers(query)}
30
+ * options={apiResults}
31
+ * isLoading={isSearching}
32
+ * value={selectedUser}
33
+ * onChange={(value) => setSelectedUser(value)}
34
+ * />
35
+ * ```
11
36
  */
12
37
  export default function ITSearchSelect({
13
38
  name,
@@ -0,0 +1,79 @@
1
+ import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
2
+ import * as Stories from './searchTable.stories';
3
+
4
+ <Meta of={Stories} />
5
+
6
+ # ITSearchTable
7
+
8
+ Server-side data table with global search across all fields, column-level filtering, sortable columns, inline row editing, and integrated pagination. Supports six column types and optional Yup validation schema.
9
+
10
+ ## Props
11
+
12
+ | Prop | Type | Default | Description |
13
+ |------|------|---------|-------------|
14
+ | `columns` | `SearchColumn<T>[]` | — | Column definitions with key, label, type, filter, sortable, editable, and custom render options. |
15
+ | `data` | `T[]` | — | Array of row data objects (server-side paginated). |
16
+ | `title` | `string` | — | Title displayed in the table header bar. |
17
+ | `searchInputPlaceholder` | `string` | — | Placeholder text for the global search input. |
18
+ | `variant` | `"default" \| "striped" \| "bordered"` | — | Table visual variant. |
19
+ | `size` | `"sm" \| "md" \| "lg"` | — | Table row size. |
20
+ | `containerClassName` | `string` | — | Additional CSS class for the outer container wrapper. |
21
+ | `className` | `string` | — | Additional CSS class applied to the `<table>` element. |
22
+ | `itemsPerPageOptions` | `number[]` | — | Available page-size options for the pagination dropdown. |
23
+ | `defaultItemsPerPage` | `number` | — | Initial/default number of rows per page. |
24
+ | `validationSchema` | `yup.ObjectSchema` | — | Yup validation schema for inline row editing. |
25
+ | `pageIndex` | `number` | — | Current page index (0-based, server-side). |
26
+ | `totalCount` | `number` | — | Total number of rows across all pages. |
27
+ | `totalPages` | `number` | — | Total number of available pages. |
28
+ | `hasPreviousPage` | `boolean` | — | Whether there is a previous page available. |
29
+ | `hasNextPage` | `boolean` | — | Whether there is a next page available. |
30
+ | `onPageChange` | `(page: number) => void` | — | Callback when the user navigates to a different page. |
31
+ | `onItemsPerPageChange` | `(itemsPerPage: number) => void` | — | Callback when the user changes the page size. |
32
+ | `onSortChange` | `(sortConfig: { key: string, direction: "asc" \| "desc" }) => void` | — | Callback when a column header sort is triggered. |
33
+ | `onFilterChange` | `(filters: Record<string, string \| boolean \| number>) => void` | — | Callback when global search or column filter changes. |
34
+
35
+ ## Usage
36
+
37
+ ```tsx
38
+ import { ITSearchTable } from '@axzydev/axzy_ui_system';
39
+ import type { SearchColumn } from '@axzydev/axzy_ui_system';
40
+
41
+ const columns: SearchColumn<MyRow>[] = [
42
+ { key: 'id', label: 'ID', type: 'number', sortable: true },
43
+ { key: 'name', label: 'Name', type: 'string', sortable: true, filter: true, editable: true },
44
+ { key: 'email', label: 'Email', type: 'string', sortable: true },
45
+ { key: 'status', label: 'Status', type: 'catalog', filter: 'catalog', sortable: true },
46
+ ];
47
+
48
+ <ITSearchTable
49
+ columns={columns}
50
+ data={rows}
51
+ title="Users"
52
+ searchInputPlaceholder="Search users..."
53
+ pageIndex={0}
54
+ totalCount={100}
55
+ totalPages={10}
56
+ hasPreviousPage={false}
57
+ hasNextPage={true}
58
+ onPageChange={handlePageChange}
59
+ onSortChange={handleSort}
60
+ onFilterChange={handleFilter}
61
+ />
62
+ ```
63
+
64
+ ## Notes
65
+
66
+ - **Column types**: `string`, `number`, `boolean`, `date`, `actions`, and `catalog` provide specialized filtering and rendering.
67
+ - **Global search**: built-in search input filters across all filterable columns via `onFilterChange`.
68
+ - **Column filtering**: `filter: true` enables text filtering; `filter: 'catalog'` renders a dropdown with `catalogOptions`.
69
+ - **Sorting**: `sortable: true` on a column triggers `onSortChange` with `{ key, direction }`.
70
+ - **Inline editing**: `editable: true` with `inputType` enables cell-level editing with optional `validation` and Yup `validationSchema` support.
71
+ - **Pagination**: fully server-driven via `pageIndex`, `totalPages`, `hasPreviousPage`, `hasNextPage`, and callbacks.
72
+ - **Rendering**: `currencyMX` formats numbers as MXN; `render` provides a custom cell render function; `actions` renders custom action buttons with edit helpers.
73
+ - Variants `striped` and `bordered` provide alternative visual styles.
74
+
75
+ ## Stories
76
+
77
+ <Primary />
78
+ <Controls />
79
+ <Stories />
@@ -1,56 +1,95 @@
1
1
  import { TableSize, TableVariants } from "@/types/table.types";
2
2
  import * as yup from "yup";
3
3
 
4
+ /** Allowed column data types: "string" | "date" | "number" | "boolean" | "actions" | "catalog" */
4
5
  export type ColumnType = "string" | "date" | "number" | "boolean" | "actions" | "catalog";
5
6
 
7
+ /** Minimal catalog option with id and display name. */
6
8
  export interface CatalogOption {
9
+ /** Unique identifier, can be string or number. */
7
10
  id: string | number;
11
+ /** Display name for the catalog option. */
8
12
  name: string;
9
13
  }
10
14
 
15
+ /** Definition of a single searchable, sortable, editable table column. */
11
16
  export interface SearchColumn<T = any> {
17
+ /** Unique key used for data access and sorting/filtering. */
12
18
  key: string;
19
+ /** Column header label displayed to the user. */
13
20
  label: string;
21
+ /** Data type of the column: "string" | "number" | "boolean" | "date" | "actions" | "catalog". */
14
22
  type: "string" | "number" | "boolean" | "date" | "actions" | "catalog";
23
+ /** Enables filtering on this column. Can be boolean or "catalog" for catalog-based filters. */
15
24
  filter?: boolean | 'catalog';
25
+ /** Whether the column is sortable by clicking its header. */
16
26
  sortable?: boolean;
27
+ /** Whether inline editing is allowed on this column. */
17
28
  editable?: boolean;
29
+ /** Inline edit input type: "text" | "number" | "select" | "checkbox" | "date". */
18
30
  inputType?: "text" | "number" | "select" | "checkbox" | "date";
19
- // OK: text number
20
- // PENDING: select checkbox date
31
+ /** Predefined select options when inputType is "select". */
21
32
  options?: { value: string | number; label: string }[];
33
+ /** Custom inline-edit validation. Return error string or undefined if valid. */
22
34
  validation?: (value: any, row?:any) => string | undefined;
35
+ /** Additional CSS class on the column cells. */
23
36
  className?: string;
37
+ /** Formats numeric values as Mexican pesos (MXN). */
24
38
  currencyMX?: boolean;
39
+ /** Configuration for catalog-type columns: data array and optional key/label field names. */
25
40
  catalogOptions?: {
26
41
  data: Array<{ id: string | number; name: string }> | any[];
27
42
  key?: string;
28
43
  label?: string;
29
44
  };
45
+ /** Custom render function for the cell. Receives the full row object. */
30
46
  render?: (row: T) => React.ReactNode;
47
+ /** Custom action buttons rendered in the cell. Receives row and helper with onEdit. */
31
48
  actions?: (row: T, helpers: { onEdit: (row: T) => void }) => React.ReactNode;
49
+ /** Custom save/cancel action buttons in edit mode. Receives row and helpers. */
32
50
  saveActions?: (row: T, helpers: { onSave: (row: T) => void, onCancel: () => void, hasErrors: any}) => React.ReactNode;
33
51
  }
34
52
 
53
+ /** Props for the ITSearchTable server-side data table component. */
35
54
  export interface ITSearchTableProps<T> {
55
+ /** Column definitions: key, label, type, filter, sortable, editable, etc. */
36
56
  columns: SearchColumn<T>[];
57
+ /** Additional CSS class for the outer container wrapper. */
37
58
  containerClassName?: string;
59
+ /** Placeholder text for the global search input field. */
38
60
  searchInputPlaceholder?: string;
61
+ /** Array of row data objects (server-side paginated). */
39
62
  data: T[];
63
+ /** Table visual variant: "default" | "striped" | "bordered". */
40
64
  variant?: TableVariants;
65
+ /** Additional CSS class applied to the `<table>` element. */
41
66
  className?: string;
67
+ /** Table row size: "sm" | "md" | "lg". */
42
68
  size?: TableSize;
69
+ /** Available page-size options (e.g. [10, 20, 50, 100]). */
43
70
  itemsPerPageOptions?: Array<number>;
71
+ /** Initial/default number of rows per page. */
44
72
  defaultItemsPerPage?: number;
73
+ /** Yup validation schema for inline editing. */
45
74
  validationSchema?: yup.ObjectSchema<any>
75
+ /** Title displayed in the table header bar (teal background). */
46
76
  title?: string;
77
+ /** Current page index (0-based, server-side). */
47
78
  pageIndex: number;
79
+ /** Total number of rows across all pages (server-side). */
48
80
  totalCount: number;
81
+ /** Total number of available pages. */
49
82
  totalPages: number;
83
+ /** Whether there is a previous page available. */
50
84
  hasPreviousPage: boolean;
85
+ /** Whether there is a next page available. */
51
86
  hasNextPage: boolean;
87
+ /** Callback when the user navigates to a different page. Receives the new page index. */
52
88
  onPageChange?: (page: number) => void;
89
+ /** Callback when the user changes the page-size. Receives the new items-per-page value. */
53
90
  onItemsPerPageChange?: (itemsPerPage: number) => void;
54
- onSortChange?: (sortConfig: { key: string, direction: "asc" | "desc" }) => void; // Se actualizó para incluir `key`
91
+ /** Callback when sorting changes. Receives { key, direction: "asc" | "desc" }. */
92
+ onSortChange?: (sortConfig: { key: string, direction: "asc" | "desc" }) => void;
93
+ /** Callback when global search/filter text changes. Receives a key-value filters record. */
55
94
  onFilterChange?: (filters: Record<string, string | boolean | number>) => void;
56
95
  }
@@ -0,0 +1,74 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import ITSearchTable from './searchTable';
3
+ import { SearchColumn } from './searchTable.props';
4
+
5
+ interface SampleRow {
6
+ id: number;
7
+ name: string;
8
+ email: string;
9
+ status: string;
10
+ }
11
+
12
+ const sampleColumns: SearchColumn<SampleRow>[] = [
13
+ { key: 'id', label: 'ID', type: 'number', sortable: true },
14
+ { key: 'name', label: 'Name', type: 'string', sortable: true, filter: true },
15
+ { key: 'email', label: 'Email', type: 'string', sortable: true },
16
+ { key: 'status', label: 'Status', type: 'catalog', filter: 'catalog', sortable: true },
17
+ ];
18
+
19
+ const sampleData: SampleRow[] = [
20
+ { id: 1, name: 'Alice', email: 'alice@example.com', status: 'Active' },
21
+ { id: 2, name: 'Bob', email: 'bob@example.com', status: 'Inactive' },
22
+ { id: 3, name: 'Charlie', email: 'charlie@example.com', status: 'Active' },
23
+ ];
24
+
25
+ const meta = {
26
+ title: 'Components/Data Display/ITSearchTable',
27
+ component: ITSearchTable,
28
+ parameters: { layout: 'padded' },
29
+ tags: ['autodocs'],
30
+ argTypes: {
31
+ columns: { control: false, description: 'Column definitions' },
32
+ data: { control: false, description: 'Row data array' },
33
+ title: { control: 'text', description: 'Table header title' },
34
+ searchInputPlaceholder: { control: 'text', description: 'Placeholder for the search input' },
35
+ variant: { control: 'select', options: ['default', 'striped', 'bordered'], description: 'Visual variant' },
36
+ size: { control: 'select', options: ['sm', 'md', 'lg'], description: 'Row size' },
37
+ pageIndex: { control: 'number', description: 'Current page index (0-based)' },
38
+ totalCount: { control: 'number', description: 'Total number of rows across all pages' },
39
+ totalPages: { control: 'number', description: 'Total number of pages' },
40
+ hasPreviousPage: { control: 'boolean', description: 'Whether there is a previous page' },
41
+ hasNextPage: { control: 'boolean', description: 'Whether there is a next page' },
42
+ },
43
+ } satisfies Meta<typeof ITSearchTable>;
44
+
45
+ export default meta;
46
+ type Story = StoryObj<typeof meta>;
47
+
48
+ export const Default: Story = {
49
+ args: {
50
+ columns: sampleColumns,
51
+ data: sampleData,
52
+ title: 'Users',
53
+ searchInputPlaceholder: 'Search users...',
54
+ pageIndex: 0,
55
+ totalCount: 3,
56
+ totalPages: 1,
57
+ hasPreviousPage: false,
58
+ hasNextPage: false,
59
+ } as any,
60
+ };
61
+
62
+ export const EmptyState: Story = {
63
+ args: {
64
+ columns: sampleColumns,
65
+ data: [],
66
+ title: 'Users',
67
+ searchInputPlaceholder: 'Search users...',
68
+ pageIndex: 0,
69
+ totalCount: 0,
70
+ totalPages: 0,
71
+ hasPreviousPage: false,
72
+ hasNextPage: false,
73
+ } as any,
74
+ };
@@ -25,6 +25,29 @@ interface CustomITSearchTableProps<T> extends ITSearchTableProps<T> {
25
25
  };
26
26
  }
27
27
 
28
+ /**
29
+ * Server-side data table with global search, column sorting, inline editing, and pagination.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <ITSearchTable
34
+ * columns={[
35
+ * { key: "name", label: "Name", type: "string", sortable: true, editable: true },
36
+ * { key: "status", label: "Status", type: "string", filter: true },
37
+ * ]}
38
+ * data={rows}
39
+ * title="Users"
40
+ * pageIndex={0}
41
+ * totalCount={100}
42
+ * totalPages={10}
43
+ * hasPreviousPage={false}
44
+ * hasNextPage={true}
45
+ * onPageChange={(p) => fetchPage(p)}
46
+ * onSortChange={(s) => sortData(s)}
47
+ * onFilterChange={(f) => filterData(f)}
48
+ * />
49
+ * ```
50
+ */
28
51
  export default function ITSearchTable<T extends Record<string, unknown>>({
29
52
  columns,
30
53
  data,
@@ -0,0 +1,60 @@
1
+ import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
2
+ import * as Stories from './segmented-control.stories';
3
+
4
+ <Meta of={Stories} />
5
+
6
+ # ITSegmentedControl
7
+
8
+ iOS-style segmented toggle for mutually exclusive options with optional icons. Supports two sizes and a disabled state. Ideal for filter and view switching.
9
+
10
+ ## Props
11
+
12
+ | Prop | Type | Default | Description |
13
+ |------|------|---------|-------------|
14
+ | `options` | `ISegmentedOption[]` | — | Array of mutually exclusive options: `{ value: string, label: string, icon?: ReactNode }`. |
15
+ | `value` | `string` | — | Currently selected value (controlled). |
16
+ | `onChange` | `(value: string) => void` | — | Callback fired when the user selects a different option. |
17
+ | `size` | `"sm" \| "md"` | `"md"` | Control size. |
18
+ | `className` | `string` | — | Additional CSS classes on the container. |
19
+ | `disabled` | `boolean` | `false` | Whether the entire control is disabled. |
20
+
21
+ ## Usage
22
+
23
+ ```tsx
24
+ import { ITSegmentedControl } from '@axzydev/axzy_ui_system';
25
+
26
+ <ITSegmentedControl
27
+ options={[
28
+ { value: "day", label: "Day" },
29
+ { value: "week", label: "Week" },
30
+ { value: "month", label: "Month" },
31
+ ]}
32
+ value={selected}
33
+ onChange={setSelected}
34
+ />
35
+
36
+ <ITSegmentedControl
37
+ size="sm"
38
+ options={[
39
+ { value: "list", label: "List", icon: <FaList /> },
40
+ { value: "grid", label: "Grid", icon: <FaTh /> },
41
+ ]}
42
+ value={view}
43
+ onChange={setView}
44
+ />
45
+ ```
46
+
47
+ ## Notes
48
+
49
+ - Only one option can be selected at a time — mutually exclusive by design.
50
+ - Each option may include an optional `icon` rendered alongside the label.
51
+ - Two sizes available: `sm` (compact) and `md` (default).
52
+ - `disabled` applies to all segments simultaneously.
53
+ - Commonly used for view toggling (list/grid), date range selection (day/week/month), and filter switching.
54
+ - Fully controlled component: `value` and `onChange` are required.
55
+
56
+ ## Stories
57
+
58
+ <Primary />
59
+ <Controls />
60
+ <Stories />
@@ -1,18 +1,30 @@
1
1
  import { ReactNode } from "react";
2
2
 
3
+ /** Available sizes for the segmented control: "sm" | "md". */
3
4
  export type SegmentedControlSize = "sm" | "md";
4
5
 
6
+ /** A single option within the segmented control. */
5
7
  export interface ISegmentedOption {
8
+ /** Unique value for the option. */
6
9
  value: string;
10
+ /** Display label for the option. */
7
11
  label: string;
12
+ /** Optional icon rendered alongside the label. */
8
13
  icon?: ReactNode;
9
14
  }
10
15
 
16
+ /** Props for the ITSegmentedControl component. */
11
17
  export interface ITSegmentedControlProps {
18
+ /** Array of mutually exclusive options: { label, value, icon? }. */
12
19
  options: ISegmentedOption[];
20
+ /** Currently selected value (controlled). */
13
21
  value: string;
22
+ /** Callback fired when the user selects a different option. Receives the new value. */
14
23
  onChange: (value: string) => void;
24
+ /** Control size: "sm" | "md". Default: "md". */
15
25
  size?: SegmentedControlSize;
26
+ /** Additional CSS classes on the container. */
16
27
  className?: string;
28
+ /** Whether the entire control is disabled. */
17
29
  disabled?: boolean;
18
30
  }
@@ -7,6 +7,21 @@ const sizeMap = {
7
7
  md: { button: "px-3 py-2 text-xs", container: "p-1" },
8
8
  };
9
9
 
10
+ /**
11
+ * iOS-style segmented toggle for switching between mutually exclusive options.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <ITSegmentedControl
16
+ * options={[
17
+ * { value: "day", label: "Day" },
18
+ * { value: "week", label: "Week", icon: <FaCalendar /> },
19
+ * ]}
20
+ * value={view}
21
+ * onChange={setView}
22
+ * />
23
+ * ```
24
+ */
10
25
  export default function ITSegmentedControl({
11
26
  options,
12
27
  value,
@@ -0,0 +1,75 @@
1
+ import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
2
+ import * as Stories from './select.stories';
3
+
4
+ <Meta of={Stories} />
5
+
6
+ # ITSelect
7
+
8
+ Native-like dropdown select with validation error display, label support, and read-only mode. Styled consistently with ITInput for seamless form integration.
9
+
10
+ ## Props
11
+
12
+ | Prop | Type | Default | Description |
13
+ |------|------|---------|-------------|
14
+ | `name` | `string` | — | Name attribute for the underlying `<select>` element. |
15
+ | `options` | `OptionType[]` | — | Array of option objects with value/label key-value pairs. `{ [key: string]: string }`. |
16
+ | `valueField` | `string` | `"value"` | Key in each option object used as the option value. |
17
+ | `labelField` | `string` | `"label"` | Key in each option object used as the display label. |
18
+ | `label` | `string` | — | Label text rendered above the select. |
19
+ | `placeholder` | `string` | — | Placeholder text for the default empty option. |
20
+ | `value` | `string` | — | Currently selected value (controlled). |
21
+ | `onChange` | `(event: ChangeEvent<HTMLSelectElement>) => void` | — | Callback fired on selection change. |
22
+ | `onBlur` | `(event: FocusEvent<HTMLSelectElement>) => void` | — | Callback fired on blur. |
23
+ | `variant` | `ColorsTypes` | — | Theme color variant for the select border and focus ring. |
24
+ | `size` | `SizesTypes` | — | Control size: `"sm"`, `"md"`, or `"lg"`. |
25
+ | `disabled` | `boolean` | `false` | Whether the select is disabled. |
26
+ | `className` | `string` | — | Additional CSS classes on the `<select>` element. |
27
+ | `touched` | `boolean` | — | Marks the field as touched (for validation error display). |
28
+ | `error` | `string \| boolean` | — | Error message string, or `true` for a default required error message. |
29
+ | `required` | `boolean` | `false` | Whether the field is required. Shows a red asterisk on the label. |
30
+ | `autoFocus` | `boolean` | `false` | Autofocus the select on mount. |
31
+ | `readOnly` | `boolean` | `false` | Read-only mode: shows the current value as a single disabled option. |
32
+
33
+ ## Usage
34
+
35
+ ```tsx
36
+ import { ITSelect } from '@axzydev/axzy_ui_system';
37
+
38
+ <ITSelect
39
+ name="country"
40
+ label="Country"
41
+ placeholder="Select a country"
42
+ options={[
43
+ { value: "mx", label: "Mexico" },
44
+ { value: "us", label: "United States" },
45
+ ]}
46
+ value={selected}
47
+ onChange={(e) => setSelected(e.target.value)}
48
+ />
49
+
50
+ <ITSelect
51
+ name="status"
52
+ label="Status"
53
+ options={statusOptions}
54
+ value={status}
55
+ onChange={(e) => setStatus(e.target.value)}
56
+ required
57
+ error={touched && !status ? "This field is required" : undefined}
58
+ />
59
+ ```
60
+
61
+ ## Notes
62
+
63
+ - Custom `valueField` and `labelField` support option objects with arbitrary key names.
64
+ - Error state: provides a red border and inline error message when `touched` is true and `error` is set.
65
+ - `required` adds a red asterisk on the label and shows a default required error if no custom error is given.
66
+ - `readOnly` renders the selected value as a single non-interactive option.
67
+ - Arrow-down icon rendered via `FaAngleDown` from react-icons.
68
+ - Styles inherited from the theme's `input` configuration for visual consistency with ITInput.
69
+ - The `variant` prop maps to theme color tokens for border and focus ring colors.
70
+
71
+ ## Stories
72
+
73
+ <Primary />
74
+ <Controls />
75
+ <Stories />