@maestro-js/components 1.0.0-alpha.19 → 1.0.0-alpha.2

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 (56) hide show
  1. package/commands/add.ts +1 -16
  2. package/dist/components.json +1 -1
  3. package/dist/index.js +1 -14
  4. package/package.json +5 -5
  5. package/registry.json +790 -598
  6. package/scripts/build.ts +4 -11
  7. package/src/components/alert-dialog.tsx +3 -3
  8. package/src/components/avatar.tsx +1 -1
  9. package/src/components/button-link.tsx +0 -3
  10. package/src/components/button.tsx +0 -4
  11. package/src/components/checkbox.tsx +7 -7
  12. package/src/components/chip.tsx +7 -7
  13. package/src/components/container.tsx +3 -3
  14. package/src/components/dialog.tsx +7 -21
  15. package/src/components/disclosure.tsx +1 -1
  16. package/src/components/drawer.tsx +5 -19
  17. package/src/components/form.tsx +5 -27
  18. package/src/components/helpers/form-field.tsx +8 -7
  19. package/src/components/helpers/get-button-classes.ts +23 -23
  20. package/src/components/helpers/headless-button.tsx +1 -1
  21. package/src/components/inline-alert.tsx +3 -3
  22. package/src/components/labeled-value.tsx +2 -2
  23. package/src/components/menu.tsx +26 -60
  24. package/src/components/month-day-input.tsx +1 -2
  25. package/src/components/multiselect.tsx +70 -74
  26. package/src/components/radio.tsx +8 -8
  27. package/src/components/select.tsx +8 -9
  28. package/src/components/stepper.tsx +6 -6
  29. package/src/components/switch.tsx +7 -7
  30. package/src/components/tabs.tsx +1 -1
  31. package/src/components/tag-field.tsx +3 -3
  32. package/src/components/text-area.tsx +1 -1
  33. package/src/components/text-field.tsx +1 -4
  34. package/src/components/toast.tsx +6 -6
  35. package/src/components/toggle-button-group.tsx +2 -2
  36. package/src/utils/icons.d.ts +1 -2
  37. package/src/utils/use-tab-indicator.ts +9 -9
  38. package/src/components/date-range.tsx +0 -138
  39. package/src/components/optional-link.tsx +0 -15
  40. package/src/components/table/headless-templated-row-table.ts +0 -550
  41. package/src/components/table/index.tsx +0 -41
  42. package/src/components/table/server-table.ts +0 -143
  43. package/src/components/table/table-actions.tsx +0 -76
  44. package/src/components/table/table-container.tsx +0 -173
  45. package/src/components/table/table-container.type-test.ts +0 -155
  46. package/src/components/table/table-filters/date-range-filter.tsx +0 -227
  47. package/src/components/table/table-filters/select-filter.tsx +0 -211
  48. package/src/components/table/table-filters/sort.tsx +0 -85
  49. package/src/components/table/table-primitives.tsx +0 -226
  50. package/src/components/table/table-toolbar.tsx +0 -300
  51. package/src/components/table/table-types.ts +0 -61
  52. package/src/components/table/use-client-table.ts +0 -157
  53. package/src/components/table/use-client-table.type-test.ts +0 -217
  54. package/src/components/table/use-server-table.ts +0 -192
  55. package/src/components/table/use-server-table.type-test.ts +0 -174
  56. package/src/utils/use-query-state.ts +0 -626
@@ -1,174 +0,0 @@
1
- import { useServerTable } from './use-server-table'
2
- import type { ServerTable } from './server-table'
3
- import type { TableLocalization } from './table-types'
4
- import type { Iso } from 'iso-fns'
5
-
6
- // =============================================================================
7
- // Helpers
8
- // =============================================================================
9
-
10
- type Expect<T extends true> = T
11
- type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false
12
-
13
- // =============================================================================
14
- // Setup
15
- // =============================================================================
16
-
17
- type Row = {
18
- id: string
19
- status: 'active' | 'inactive'
20
- name: string
21
- createdAt: string
22
- }
23
-
24
- // =============================================================================
25
- // Filter and sort config inference
26
- // =============================================================================
27
-
28
- function testFilterAndSortInference() {
29
- const serverTable = null as unknown as ServerTable.ServerTable<Row, { status: 'active' | 'inactive' }, { newest: true; oldest: true }>
30
-
31
- const table = useServerTable(serverTable, { getRowId: (row) => row.id })
32
-
33
- // getFilterConfig() keys match the provided filter names
34
- type _FilterKeys = Expect<Equal<keyof ReturnType<typeof table.getFilterConfig>, 'status'>>
35
-
36
- // getSortConfig() keys match the provided sort names
37
- type _SortKeys = Expect<Equal<keyof ReturnType<typeof table.getSortConfig>, 'newest' | 'oldest'>>
38
-
39
- // state.sort is the union of sort keys | null
40
- type _SortState = Expect<Equal<typeof table.state.sort, 'newest' | 'oldest' | null>>
41
-
42
- // state.filters keys match filter names
43
- type _FilterStateKeys = Expect<Equal<keyof typeof table.state.filters, 'status'>>
44
- }
45
-
46
- // =============================================================================
47
- // Localization compatibility — select filter
48
- // =============================================================================
49
-
50
- function testLocalizationWithSelectFilter() {
51
- const serverTable = null as unknown as ServerTable.ServerTable<Row, { status: 'active' | 'inactive' }, { newest: true; oldest: true }>
52
-
53
- const table = useServerTable(serverTable, { getRowId: (row) => row.id })
54
-
55
- type Loc = TableLocalization<
56
- ReturnType<typeof table.getFilterConfig>,
57
- ReturnType<typeof table.getSortConfig>
58
- >
59
-
60
- type _LocFilterKeys = Expect<Equal<keyof Loc['filters'], 'status'>>
61
- type _LocSortKeys = Expect<Equal<keyof Loc['sorts'], 'newest' | 'oldest'>>
62
-
63
- // Valid localization with typed option values
64
- const _loc: Loc = {
65
- filters: {
66
- status: {
67
- label: 'Status',
68
- options: [
69
- { label: 'Active', value: 'active' },
70
- { label: 'Inactive', value: 'inactive' }
71
- ]
72
- }
73
- },
74
- sorts: {
75
- newest: { label: 'Newest' },
76
- oldest: { label: 'Oldest' }
77
- }
78
- }
79
- }
80
-
81
- // =============================================================================
82
- // Localization compatibility — date range filter
83
- // =============================================================================
84
-
85
- function testLocalizationWithDateRangeFilter() {
86
- type RowWithDate = {
87
- id: string
88
- dateRange: { startDate: Iso.Date; endDate: Iso.Date }
89
- }
90
-
91
- const serverTable = null as unknown as ServerTable.ServerTable<
92
- RowWithDate,
93
- { dateRange: { startDate: Iso.Date; endDate: Iso.Date } },
94
- {}
95
- >
96
-
97
- const table = useServerTable(serverTable, { getRowId: (row) => row.id })
98
-
99
- type Loc = TableLocalization<
100
- ReturnType<typeof table.getFilterConfig>,
101
- ReturnType<typeof table.getSortConfig>
102
- >
103
-
104
- // Valid: date-range filter accepts DateRangeTableFilter form
105
- const _loc: Loc = {
106
- filters: {
107
- dateRange: { label: 'Date Range', type: 'date-range' }
108
- },
109
- sorts: {}
110
- }
111
-
112
- // Invalid: date-range filter rejects select-style options
113
- const _badLoc: Loc = {
114
- filters: {
115
- dateRange: {
116
- label: 'Date Range',
117
- type: 'date-range',
118
- // @ts-expect-error — select-style options array is not valid for date-range
119
- options: [{ label: 'X', value: 'x' }]
120
- }
121
- },
122
- sorts: {}
123
- }
124
- }
125
-
126
- // =============================================================================
127
- // Negative: wrong localization option value
128
- // =============================================================================
129
-
130
- declare function checkLocalization(l: TableLocalization<{ status: 'active' | 'inactive' }, {}>): void
131
-
132
- function testWrongLocalizationOptionValue() {
133
- checkLocalization({
134
- filters: {
135
- status: {
136
- label: 'Status',
137
- // @ts-expect-error — 'unknown' is not assignable to 'active' | 'inactive'
138
- options: [{ label: 'Unknown', value: 'unknown' }]
139
- }
140
- },
141
- sorts: {}
142
- })
143
- }
144
-
145
- // =============================================================================
146
- // No filters/sorts → empty localization
147
- // =============================================================================
148
-
149
- function testNoFiltersOrSorts() {
150
- const serverTable = null as unknown as ServerTable.ServerTable<Row, {}, {}>
151
-
152
- const table = useServerTable(serverTable, { getRowId: (row) => row.id })
153
-
154
- type Loc = TableLocalization<
155
- ReturnType<typeof table.getFilterConfig>,
156
- ReturnType<typeof table.getSortConfig>
157
- >
158
-
159
- type _EmptyFilters = Expect<Equal<Loc['filters'], {}>>
160
- type _EmptySorts = Expect<Equal<Loc['sorts'], {}>>
161
- }
162
-
163
- // =============================================================================
164
- // State shape — search and pagination
165
- // =============================================================================
166
-
167
- function testStateShape() {
168
- const serverTable = null as unknown as ServerTable.ServerTable<Row, { status: 'active' | 'inactive' }, { newest: true }>
169
-
170
- const table = useServerTable(serverTable, { getRowId: (row) => row.id })
171
-
172
- type _Search = Expect<Equal<typeof table.state.search, string>>
173
- type _Pagination = Expect<Equal<typeof table.state.pagination, { limit: number; skip: number }>>
174
- }