@rfdtech/components 1.1.0 → 1.5.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.
Files changed (170) hide show
  1. package/README.md +192 -447
  2. package/dist/components/app-switcher/AppSwitcher.d.ts +1 -2
  3. package/dist/components/app-switcher/AppSwitcher.d.ts.map +1 -1
  4. package/dist/components/app-switcher/AppSwitcherItem.d.ts.map +1 -1
  5. package/dist/components/app-switcher/hooks/useAppSwitcher.d.ts.map +1 -1
  6. package/dist/components/app-switcher/index.d.ts +1 -5
  7. package/dist/components/app-switcher/index.d.ts.map +1 -1
  8. package/dist/components/bulk-import-modal/BulkImportModal.d.ts +1 -2
  9. package/dist/components/bulk-import-modal/BulkImportModal.d.ts.map +1 -1
  10. package/dist/components/bulk-import-modal/hooks/useBulkImportFlow.d.ts.map +1 -1
  11. package/dist/components/bulk-import-modal/internal/FieldMappingSelect.d.ts +14 -0
  12. package/dist/components/bulk-import-modal/internal/FieldMappingSelect.d.ts.map +1 -0
  13. package/dist/components/bulk-import-modal/steps/MatchColumnsStep.d.ts.map +1 -1
  14. package/dist/components/bulk-import-modal/steps/SelectHeaderRowStep.d.ts.map +1 -1
  15. package/dist/components/bulk-import-modal/steps/ValidateDataStep.d.ts +2 -1
  16. package/dist/components/bulk-import-modal/steps/ValidateDataStep.d.ts.map +1 -1
  17. package/dist/components/button/Button.d.ts +4 -0
  18. package/dist/components/button/Button.d.ts.map +1 -0
  19. package/dist/components/button/Button.test.d.ts +2 -0
  20. package/dist/components/button/Button.test.d.ts.map +1 -0
  21. package/dist/components/button/Spinner.d.ts +8 -0
  22. package/dist/components/button/Spinner.d.ts.map +1 -0
  23. package/dist/components/button/index.d.ts +3 -0
  24. package/dist/components/button/index.d.ts.map +1 -0
  25. package/dist/components/checkbox/Checkbox.d.ts +4 -0
  26. package/dist/components/checkbox/Checkbox.d.ts.map +1 -0
  27. package/dist/components/checkbox/Checkbox.test.d.ts +2 -0
  28. package/dist/components/checkbox/Checkbox.test.d.ts.map +1 -0
  29. package/dist/components/checkbox/index.d.ts +3 -0
  30. package/dist/components/checkbox/index.d.ts.map +1 -0
  31. package/dist/components/dropdown/Dropdown.d.ts +1 -2
  32. package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
  33. package/dist/components/dropdown/index.d.ts +1 -3
  34. package/dist/components/dropdown/index.d.ts.map +1 -1
  35. package/dist/components/popover/Popover.d.ts +10 -0
  36. package/dist/components/popover/Popover.d.ts.map +1 -0
  37. package/dist/components/popover/Popover.test.d.ts +2 -0
  38. package/dist/components/popover/Popover.test.d.ts.map +1 -0
  39. package/dist/components/popover/index.d.ts +3 -0
  40. package/dist/components/popover/index.d.ts.map +1 -0
  41. package/dist/components/radio-group/Radio.d.ts +3 -0
  42. package/dist/components/radio-group/Radio.d.ts.map +1 -0
  43. package/dist/components/radio-group/RadioGroup.d.ts +4 -0
  44. package/dist/components/radio-group/RadioGroup.d.ts.map +1 -0
  45. package/dist/components/radio-group/RadioGroup.test.d.ts +2 -0
  46. package/dist/components/radio-group/RadioGroup.test.d.ts.map +1 -0
  47. package/dist/components/radio-group/RadioGroupContext.d.ts +12 -0
  48. package/dist/components/radio-group/RadioGroupContext.d.ts.map +1 -0
  49. package/dist/components/radio-group/index.d.ts +4 -0
  50. package/dist/components/radio-group/index.d.ts.map +1 -0
  51. package/dist/components/tabs/Tabs.d.ts +7 -0
  52. package/dist/components/tabs/Tabs.d.ts.map +1 -0
  53. package/dist/components/tabs/Tabs.test.d.ts +2 -0
  54. package/dist/components/tabs/Tabs.test.d.ts.map +1 -0
  55. package/dist/components/tabs/TabsContext.d.ts +12 -0
  56. package/dist/components/tabs/TabsContext.d.ts.map +1 -0
  57. package/dist/components/tabs/hooks/useTabsLineIndicator.d.ts +8 -0
  58. package/dist/components/tabs/hooks/useTabsLineIndicator.d.ts.map +1 -0
  59. package/dist/components/tabs/index.d.ts +3 -0
  60. package/dist/components/tabs/index.d.ts.map +1 -0
  61. package/dist/components/theme/ThemeContext.d.ts +3 -0
  62. package/dist/components/theme/ThemeContext.d.ts.map +1 -0
  63. package/dist/components/theme/ThemeProvider.d.ts +3 -0
  64. package/dist/components/theme/ThemeProvider.d.ts.map +1 -0
  65. package/dist/components/theme/ThemeProvider.test.d.ts +2 -0
  66. package/dist/components/theme/ThemeProvider.test.d.ts.map +1 -0
  67. package/dist/components/theme/index.d.ts +4 -0
  68. package/dist/components/theme/index.d.ts.map +1 -0
  69. package/dist/components/theme/resolveTheme.d.ts +3 -0
  70. package/dist/components/theme/resolveTheme.d.ts.map +1 -0
  71. package/dist/components/theme/useTheme.d.ts +3 -0
  72. package/dist/components/theme/useTheme.d.ts.map +1 -0
  73. package/dist/index.cjs +81 -31
  74. package/dist/index.css +1 -1
  75. package/dist/index.d.ts +7 -3
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +6321 -6670
  78. package/dist/types/app-switcher.d.ts +7 -46
  79. package/dist/types/app-switcher.d.ts.map +1 -1
  80. package/dist/types/bulk-import-modal.d.ts +1 -0
  81. package/dist/types/bulk-import-modal.d.ts.map +1 -1
  82. package/dist/types/button.d.ts +17 -0
  83. package/dist/types/button.d.ts.map +1 -0
  84. package/dist/types/checkbox.d.ts +23 -0
  85. package/dist/types/checkbox.d.ts.map +1 -0
  86. package/dist/types/dropdown.d.ts +9 -76
  87. package/dist/types/dropdown.d.ts.map +1 -1
  88. package/dist/types/popover.d.ts +8 -0
  89. package/dist/types/popover.d.ts.map +1 -0
  90. package/dist/types/radio-group.d.ts +37 -0
  91. package/dist/types/radio-group.d.ts.map +1 -0
  92. package/dist/types/tabs.d.ts +35 -0
  93. package/dist/types/tabs.d.ts.map +1 -0
  94. package/dist/types/theme.d.ts +18 -0
  95. package/dist/types/theme.d.ts.map +1 -0
  96. package/dist/utils/cn.d.ts +2 -0
  97. package/dist/utils/cn.d.ts.map +1 -0
  98. package/package.json +13 -3
  99. package/dist/components/app-switcher/api/fetchMeApps.d.ts +0 -6
  100. package/dist/components/app-switcher/api/fetchMeApps.d.ts.map +0 -1
  101. package/dist/components/app-switcher/api/fetchMeApps.test.d.ts +0 -2
  102. package/dist/components/app-switcher/api/fetchMeApps.test.d.ts.map +0 -1
  103. package/dist/components/app-switcher/api/mapMeAppToAppItem.d.ts +0 -4
  104. package/dist/components/app-switcher/api/mapMeAppToAppItem.d.ts.map +0 -1
  105. package/dist/components/app-switcher/api/mapMeAppToAppItem.test.d.ts +0 -2
  106. package/dist/components/app-switcher/api/mapMeAppToAppItem.test.d.ts.map +0 -1
  107. package/dist/components/app-switcher/api/meAppsClient.d.ts +0 -3
  108. package/dist/components/app-switcher/api/meAppsClient.d.ts.map +0 -1
  109. package/dist/components/app-switcher/api/meAppsClient.test.d.ts +0 -2
  110. package/dist/components/app-switcher/api/meAppsClient.test.d.ts.map +0 -1
  111. package/dist/components/app-switcher/hooks/useMeApps.d.ts +0 -3
  112. package/dist/components/app-switcher/hooks/useMeApps.d.ts.map +0 -1
  113. package/dist/components/app-switcher/hooks/useMeApps.test.d.ts +0 -2
  114. package/dist/components/app-switcher/hooks/useMeApps.test.d.ts.map +0 -1
  115. package/dist/components/data-table/DataTable.d.ts +0 -5
  116. package/dist/components/data-table/DataTable.d.ts.map +0 -1
  117. package/dist/components/data-table/DataTable.test.d.ts +0 -2
  118. package/dist/components/data-table/DataTable.test.d.ts.map +0 -1
  119. package/dist/components/data-table/hooks/useDataTable.d.ts +0 -3
  120. package/dist/components/data-table/hooks/useDataTable.d.ts.map +0 -1
  121. package/dist/components/data-table/index.d.ts +0 -3
  122. package/dist/components/data-table/index.d.ts.map +0 -1
  123. package/dist/components/data-table/utils/dataTableClient.d.ts +0 -4
  124. package/dist/components/data-table/utils/dataTableClient.d.ts.map +0 -1
  125. package/dist/components/data-table/utils/dataTableClient.test.d.ts +0 -2
  126. package/dist/components/data-table/utils/dataTableClient.test.d.ts.map +0 -1
  127. package/dist/components/dropdown/Combobox.d.ts +0 -5
  128. package/dist/components/dropdown/Combobox.d.ts.map +0 -1
  129. package/dist/components/dropdown/Combobox.test.d.ts +0 -2
  130. package/dist/components/dropdown/Combobox.test.d.ts.map +0 -1
  131. package/dist/components/dropdown/DropdownMenu.d.ts +0 -5
  132. package/dist/components/dropdown/DropdownMenu.d.ts.map +0 -1
  133. package/dist/components/dropdown/DropdownMenu.test.d.ts +0 -2
  134. package/dist/components/dropdown/DropdownMenu.test.d.ts.map +0 -1
  135. package/dist/components/dropdown/hooks/useComboboxSearch.d.ts +0 -3
  136. package/dist/components/dropdown/hooks/useComboboxSearch.d.ts.map +0 -1
  137. package/dist/components/dropdown/hooks/useDropdown.d.ts +0 -4
  138. package/dist/components/dropdown/hooks/useDropdown.d.ts.map +0 -1
  139. package/dist/components/dropdown/hooks/useDropdownPosition.d.ts +0 -4
  140. package/dist/components/dropdown/hooks/useDropdownPosition.d.ts.map +0 -1
  141. package/dist/components/input-mask/InputMask.d.ts +0 -5
  142. package/dist/components/input-mask/InputMask.d.ts.map +0 -1
  143. package/dist/components/input-mask/InputMask.test.d.ts +0 -2
  144. package/dist/components/input-mask/InputMask.test.d.ts.map +0 -1
  145. package/dist/components/input-mask/hooks/useInputMask.d.ts +0 -18
  146. package/dist/components/input-mask/hooks/useInputMask.d.ts.map +0 -1
  147. package/dist/components/input-mask/index.d.ts +0 -5
  148. package/dist/components/input-mask/index.d.ts.map +0 -1
  149. package/dist/components/input-mask/presets.d.ts +0 -8
  150. package/dist/components/input-mask/presets.d.ts.map +0 -1
  151. package/dist/components/input-mask/utils/maskUtils.d.ts +0 -13
  152. package/dist/components/input-mask/utils/maskUtils.d.ts.map +0 -1
  153. package/dist/components/pagination/Pagination.d.ts +0 -5
  154. package/dist/components/pagination/Pagination.d.ts.map +0 -1
  155. package/dist/components/pagination/Pagination.test.d.ts +0 -2
  156. package/dist/components/pagination/Pagination.test.d.ts.map +0 -1
  157. package/dist/components/pagination/index.d.ts +0 -4
  158. package/dist/components/pagination/index.d.ts.map +0 -1
  159. package/dist/components/pagination/utils.d.ts +0 -6
  160. package/dist/components/pagination/utils.d.ts.map +0 -1
  161. package/dist/components/pagination/utils.test.d.ts +0 -2
  162. package/dist/components/pagination/utils.test.d.ts.map +0 -1
  163. package/dist/test/fixtures.d.ts +0 -4
  164. package/dist/test/fixtures.d.ts.map +0 -1
  165. package/dist/types/data-table.d.ts +0 -41
  166. package/dist/types/data-table.d.ts.map +0 -1
  167. package/dist/types/input-mask.d.ts +0 -17
  168. package/dist/types/input-mask.d.ts.map +0 -1
  169. package/dist/types/pagination.d.ts +0 -14
  170. package/dist/types/pagination.d.ts.map +0 -1
package/README.md CHANGED
@@ -20,10 +20,21 @@ After upgrading the package, clear Vite's dependency cache if styles look stale:
20
20
 
21
21
  ## Shared theming
22
22
 
23
- All components share design tokens defined in [`src/styles/theme.css`](src/styles/theme.css). Tokens are applied on `:root` when a component is imported.
23
+ Wrap your app in `ThemeProvider` for light, dark, and system themes. Design tokens live in [`src/styles/theme.css`](src/styles/theme.css) and apply to `.gsl-theme`, `document.documentElement`, and all components (including portaled modals and popovers).
24
24
 
25
- | Token | Default | Use |
26
- |-------|---------|-----|
25
+ ```tsx
26
+ import { ThemeProvider } from "@rfdtech/components";
27
+ import "@rfdtech/components/style.css";
28
+
29
+ <ThemeProvider defaultTheme="system">
30
+ <App />
31
+ </ThemeProvider>
32
+ ```
33
+
34
+ Use `useTheme()` to read or change the active theme at runtime. See the [Theme](/docs/theme) docs page for token reference and controlled mode.
35
+
36
+ | Token | Light default | Use |
37
+ |-------|---------------|-----|
27
38
  | `--gsl-primary` | `#dc2626` | Buttons, focus rings, accents |
28
39
  | `--gsl-primary-light` | `#fef2f2` | Selected rows, hover fills |
29
40
  | `--gsl-bg` | `#ffffff` | Surfaces |
@@ -35,7 +46,7 @@ All components share design tokens defined in [`src/styles/theme.css`](src/style
35
46
  | `--gsl-success` | `#16a34a` | Success states |
36
47
  | `--gsl-warning` | `#eab308` | Warnings |
37
48
 
38
- Override on a component root or any ancestor:
49
+ You can still override tokens on any ancestor without `ThemeProvider`:
39
50
 
40
51
  ```css
41
52
  .my-app {
@@ -49,467 +60,37 @@ Override on a component root or any ancestor:
49
60
  ## Install
50
61
 
51
62
  ```bash
52
- npm install @rfdtech/components react react-dom
63
+ npm install @rfdtech/components
53
64
  ```
54
65
 
55
- ## AppSwitcher
66
+ Requires React 18+. npm 7+ auto-installs `react` and `react-dom` as peer dependencies. Radix UI and other runtime packages are included as dependencies of `@rfdtech/components`.
56
67
 
57
- Google Apps–style 9-dot launcher for switching between GSL systems. Drop it into your header to let users jump between products.
58
68
 
59
- ### Usage
69
+ ## AppSwitcher
70
+
71
+ Google Apps–style 9-dot launcher for switching between GSL systems. Drop it into your header to let users jump between products. Pass `apps` directly from your own data layer; use `loading` while data is being fetched.
60
72
 
61
- **Remote fetch** loads systems from `GET {baseUrl}/v1/me/apps` with a bearer token:
73
+ See the [AppSwitcher](/docs/app-switcher) docs page for props and exported types.
62
74
 
63
75
  ```tsx
64
- import { AppSwitcher } from "@rfdtech/components";
76
+ import { AppSwitcher, type AppItem } from "@rfdtech/components";
65
77
 
66
- function Header({ baseUrl, accessToken }: { baseUrl: string; accessToken: string }) {
78
+ function Header({ apps, loading }: { apps: AppItem[]; loading: boolean }) {
67
79
  return (
68
80
  <AppSwitcher
69
- baseUrl={baseUrl}
70
- accessToken={accessToken}
81
+ apps={apps}
82
+ loading={loading}
71
83
  title="System directory"
72
- onAppSelect={(app) => console.log(app.name, app.metadata)}
73
- />
74
- );
75
- }
76
- ```
77
-
78
- Expected API response:
79
-
80
- ```json
81
- {
82
- "success": true,
83
- "message": "Available systems retrieved.",
84
- "data": {
85
- "apps": [
86
- {
87
- "system_id": "gov-portal",
88
- "system_name": "Governance Portal",
89
- "system_code": "GOV-123456",
90
- "frontend_url": "http://178.105.154.224:3001",
91
- "role": "registrar",
92
- "permissions": ["cases:review"]
93
- }
94
- ]
95
- },
96
- "meta": { "count": 1 }
97
- }
98
- ```
99
-
100
- **Static apps** — pass a list directly instead of fetching:
101
-
102
- ```tsx
103
- const apps = [
104
- {
105
- id: "mail",
106
- name: "Mail",
107
- icon: "https://example.com/mail.png",
108
- href: "https://mail.example.com",
109
- },
110
- ];
111
-
112
- <AppSwitcher apps={apps} title="System directory" />
113
- ```
114
-
115
- ### Props
116
-
117
- | Prop | Type | Default | Description |
118
- |------|------|---------|-------------|
119
- | `apps` | `AppItem[]` | — | Static apps to show in the grid |
120
- | `baseUrl` | `string` | required* | API base URL, e.g. `https://api.example.com` |
121
- | `accessToken` | `string` | required* | Bearer access token |
122
- | `columns` | `number` | `3` | Number of grid columns |
123
- | `open` | `boolean` | — | Controlled open state |
124
- | `onOpenChange` | `(open: boolean) => void` | — | Open state callback |
125
- | `onAppSelect` | `(app: AppItem) => void` | — | Called when an app is selected |
126
- | `triggerLabel` | `string` | `"Open app switcher"` | Accessible label for trigger |
127
- | `trigger` | `ReactNode` | 9-dot icon | Custom trigger element |
128
- | `title` | `string` | — | Panel header title |
129
- | `footer` | `ReactNode` | — | Footer content below the grid |
130
- | `placement` | `"bottom-end" \| "bottom-start" \| "bottom"` | `"bottom-end"` | Panel position |
131
- | `closeOnSelect` | `boolean` | `true` | Close panel after selection |
132
- | `className` | `string` | — | Root CSS class |
133
- | `style` | `CSSProperties` | — | Root inline styles |
134
-
135
- \* Required when `apps` is not provided.
136
-
137
- ### Types
138
-
139
- All types are exported from `@rfdtech/components`.
140
-
141
- ```ts
142
- interface AppItem {
143
- id: string;
144
- name: string;
145
- icon: ReactNode | string;
146
- href?: string;
147
- onClick?: (app: AppItem) => void;
148
- disabled?: boolean;
149
- badge?: string;
150
- metadata?: MeApp;
151
- }
152
-
153
- interface MeApp {
154
- system_id: string;
155
- system_name: string;
156
- system_code: string;
157
- frontend_url: string;
158
- role: string;
159
- permissions: string[];
160
- }
161
-
162
- interface MeAppsResponse {
163
- success: boolean;
164
- message: string;
165
- data: { apps: MeApp[] };
166
- meta: { count: number };
167
- }
168
- ```
169
-
170
- Also exported: `AppSwitcherProps`, `UseMeAppsOptions`, `UseMeAppsReturn`, `UseAppSwitcherOptions`, `UseAppSwitcherReturn`.
171
-
172
- ### Hooks
173
-
174
- **`useMeApps`** — fetch and map systems from `/v1/me/apps`:
175
-
176
- ```tsx
177
- import { useMeApps } from "@rfdtech/components";
178
-
179
- const { apps, loading, error, refetch } = useMeApps({
180
- baseUrl: "https://api.example.com",
181
- accessToken: "<token>",
182
- });
183
- ```
184
-
185
- **`useAppSwitcher`** — headless open/close state for custom UI:
186
-
187
- ```tsx
188
- import { useAppSwitcher } from "@rfdtech/components";
189
-
190
- const { open, toggle, close, triggerRef, panelRef } = useAppSwitcher();
191
- ```
192
-
193
- ### Utilities
194
-
195
- ```tsx
196
- import {
197
- buildMeAppsUrl,
198
- createMeAppsRequestInit,
199
- fetchMeApps,
200
- mapMeAppToAppItem,
201
- mapMeAppsToAppItems,
202
- MeAppsFetchError,
203
- } from "@rfdtech/components";
204
-
205
- const url = buildMeAppsUrl("https://api.example.com");
206
- const init = createMeAppsRequestInit("<token>");
207
- const response = await fetchMeApps(url, init);
208
- const apps = mapMeAppsToAppItems(response.data.apps);
209
- ```
210
-
211
- | Export | Description |
212
- |--------|-------------|
213
- | `buildMeAppsUrl(baseUrl)` | Builds `{baseUrl}/v1/me/apps`, or `/v1/me/apps` when `baseUrl` is empty |
214
- | `createMeAppsRequestInit(accessToken)` | Returns fetch options with `Authorization: Bearer ...` |
215
- | `fetchMeApps(url, init?)` | Fetches and validates the API response; throws `MeAppsFetchError` on failure |
216
- | `mapMeAppToAppItem(app)` | Maps one `MeApp` to an `AppItem` |
217
- | `mapMeAppsToAppItems(apps)` | Maps an array of `MeApp` values to `AppItem[]` |
218
- | `MeAppsFetchError` | Error thrown when the HTTP request fails or `success` is `false` |
219
-
220
- ### Subcomponents
221
-
222
- Also exported for custom layouts:
223
-
224
- - `AppSwitcherItem` — single app grid cell
225
- - `GridIcon` — default 9-dot trigger icon
226
- - `SystemAppIcon` — initials avatar for API-fetched apps
227
-
228
- ### Theming
229
-
230
- Override shared tokens on `.gsl-app-switcher` (see [Shared theming](#shared-theming)). `--gsl-focus` aliases to `--gsl-primary`.
231
-
232
- ```css
233
- .my-switcher {
234
- --gsl-primary: #dc2626;
235
- --gsl-hover: #f1f3f4;
236
- --gsl-columns: 4;
237
- }
238
- ```
239
-
240
- ### CORS
241
-
242
- When fetching from a remote `baseUrl` in the browser, the API must allow the host application's origin. Configure CORS on your backend or proxy `/v1` through your dev server during local development.
243
-
244
- ## Dropdown
245
-
246
- Single-value select with a combobox trigger and portaled listbox. Use for forms and filters where the user picks one option from a list.
247
-
248
- ### Usage
249
-
250
- ```tsx
251
- import { Dropdown } from "@rfdtech/components";
252
-
253
- function DepartmentFilter() {
254
- const [department, setDepartment] = useState<string | null>(null);
255
-
256
- return (
257
- <Dropdown
258
- ariaLabel="Department"
259
- value={department}
260
- onChange={setDepartment}
261
- placeholder="Choose department..."
262
- clearable
263
- options={[
264
- { value: "finance", label: "Finance" },
265
- { value: "hr", label: "Human Resources" },
266
- ]}
84
+ onAppSelect={(app) => console.log(app.name)}
267
85
  />
268
86
  );
269
87
  }
270
88
  ```
271
89
 
272
- ### Props
90
+ Props: `apps`, `loading`, `loadingLabel`, `columns`, `open`, `onOpenChange`, `onAppSelect`, `triggerLabel`, `trigger`, `title`, `footer`, `placement`, `closeOnSelect`, `className`, `style`. Exported types: `AppSwitcherProps`, `AppItem`, `UseAppSwitcherOptions`, `UseAppSwitcherReturn`.
273
91
 
274
- | Prop | Type | Default | Description |
275
- |------|------|---------|-------------|
276
- | `ariaLabel` | `string` | required | Accessible label for the combobox |
277
- | `value` | `string \| null` | required | Selected option value |
278
- | `onChange` | `(value: string \| null) => void` | required | Called when selection changes |
279
- | `options` | `DropdownOption[]` | required | `{ value, label, disabled? }` items |
280
- | `placeholder` | `string` | `"Select..."` | Text shown when no value is selected |
281
- | `clearable` | `boolean` | `false` | Show placeholder as a clear option |
282
- | `disabled` | `boolean` | `false` | Disable the trigger |
283
- | `open` | `boolean` | — | Controlled open state |
284
- | `onOpenChange` | `(open: boolean) => void` | — | Open state callback |
285
- | `className` | `string` | — | Root CSS class |
286
- | `style` | `CSSProperties` | — | Root inline styles |
92
+ Also exported: `AppSwitcherItem`, `GridIcon`, `SystemAppIcon`, `useAppSwitcher`.
287
93
 
288
- ## Combobox
289
-
290
- Text-input combobox with debounced async search. Use when options are loaded from an API based on what the user types.
291
-
292
- ### Usage
293
-
294
- ```tsx
295
- import { Combobox } from "@rfdtech/components";
296
- import type { DropdownOption } from "@rfdtech/components";
297
-
298
- const loadUsers = (query: string): Promise<DropdownOption[]> =>
299
- fetch(`/api/users?q=${encodeURIComponent(query)}`).then((r) => r.json());
300
-
301
- function UserPicker() {
302
- const [userId, setUserId] = useState<string | null>(null);
303
-
304
- return (
305
- <Combobox
306
- ariaLabel="User"
307
- value={userId}
308
- onChange={setUserId}
309
- loadOptions={loadUsers}
310
- placeholder="Search users..."
311
- clearable
312
- getOptionLabel={(id) => cachedUsers.get(id)}
313
- />
314
- );
315
- }
316
- ```
317
-
318
- The component caches the selected option label internally. Pass `getOptionLabel` when the value may be set before options are loaded (e.g. editing an existing record).
319
-
320
- ### Props
321
-
322
- | Prop | Type | Default | Description |
323
- |------|------|---------|-------------|
324
- | `ariaLabel` | `string` | required | Accessible label for the combobox input |
325
- | `value` | `string \| null` | required | Selected option value |
326
- | `onChange` | `(value: string \| null) => void` | required | Called when selection changes |
327
- | `loadOptions` | `(query: string) => Promise<DropdownOption[]>` | required | Async search function |
328
- | `placeholder` | `string` | `"Search..."` | Input placeholder |
329
- | `debounceMs` | `number` | `300` | Debounce delay before calling `loadOptions` |
330
- | `minSearchLength` | `number` | `0` | Minimum query length before searching |
331
- | `getOptionLabel` | `(value: string) => string \| undefined` | — | Resolve label for a value not in current results |
332
- | `noResultsText` | `string` | `"No results"` | Text when search returns no options |
333
- | `loadingText` | `string` | `"Loading..."` | Accessible label for the loading spinner |
334
- | `clearable` | `boolean` | `false` | Show a clear button when a value is selected |
335
- | `disabled` | `boolean` | `false` | Disable the input |
336
- | `open` | `boolean` | — | Controlled open state |
337
- | `onOpenChange` | `(open: boolean) => void` | — | Open state callback |
338
- | `className` | `string` | — | Root CSS class |
339
- | `style` | `CSSProperties` | — | Root inline styles |
340
-
341
- ## InputMask
342
-
343
- Pattern-based masked text input for phone numbers, dates, and other formatted fields.
344
-
345
- ### Mask syntax
346
-
347
- | Token | Accepts |
348
- |-------|---------|
349
- | `#` | Digit (`0-9`) |
350
- | `A` | Letter (`a-z`, `A-Z`) |
351
- | `*` | Alphanumeric |
352
- | Other characters | Literals inserted automatically |
353
-
354
- ### Usage
355
-
356
- ```tsx
357
- import { INPUT_MASK_PRESETS, InputMask } from "@rfdtech/components";
358
-
359
- function ContactForm() {
360
- const [phone, setPhone] = useState("");
361
- const [rawPhone, setRawPhone] = useState("");
362
-
363
- return (
364
- <InputMask
365
- ariaLabel="Phone number"
366
- mask={INPUT_MASK_PRESETS.phoneGh}
367
- value={phone}
368
- onChange={setPhone}
369
- onValueChange={setRawPhone}
370
- placeholder="0XX XXX XXXX"
371
- inputMode="tel"
372
- />
373
- );
374
- }
375
- ```
376
-
377
- `onChange` receives the masked display value (e.g. `024 123 4567`). `onValueChange` receives only the slot characters (e.g. `0241234567`).
378
-
379
- ### Presets
380
-
381
- `INPUT_MASK_PRESETS` includes `phoneGh`, `phoneIntlGh`, `date`, and `time`. Pass any custom pattern string to `mask`.
382
-
383
- ### Props
384
-
385
- | Prop | Type | Default | Description |
386
- |------|------|---------|-------------|
387
- | `mask` | `string` | required | Pattern string (`#`, `A`, `*`, literals) |
388
- | `ariaLabel` | `string` | required | Accessible label for the input |
389
- | `value` | `string` | — | Masked display value (controlled) |
390
- | `defaultValue` | `string` | `""` | Initial value (uncontrolled) |
391
- | `onChange` | `(masked: string) => void` | — | Called with masked display value |
392
- | `onValueChange` | `(unmasked: string) => void` | — | Called with raw slot characters |
393
- | `placeholder` | `string` | — | Placeholder text |
394
- | `disabled` | `boolean` | `false` | Disable the input |
395
- | `id` | `string` | — | Input `id` attribute |
396
- | `name` | `string` | — | Input `name` attribute |
397
- | `inputMode` | `string` | `"text"` | Mobile keyboard hint |
398
- | `className` | `string` | — | Root CSS class |
399
- | `style` | `CSSProperties` | — | Root inline styles |
400
-
401
- ## DataTable
402
-
403
- Read-focused data table with column sorting and pagination. Pass `data` for client-side sorting and pagination; use `loading` when data is fetched by the parent.
404
-
405
- `DataTable` composes the standalone [`Pagination`](#pagination) component for its footer.
406
-
407
- ### Usage
408
-
409
- ```tsx
410
- import { DataTable } from "@rfdtech/components";
411
-
412
- const columns = [
413
- { key: "name", label: "Name", sortable: true },
414
- { key: "department", label: "Department", sortable: true },
415
- ];
416
-
417
- const { data, loading } = useStaff();
418
-
419
- <DataTable
420
- columns={columns}
421
- data={data}
422
- loading={loading}
423
- emptyText="No staff found."
424
- pageSize={10}
425
- onRowClick={(row) => console.log(row.name)}
426
- />
427
- ```
428
-
429
- Sorting and pagination run in the browser against the `data` array you provide.
430
-
431
- ### Props
432
-
433
- | Prop | Type | Default | Description |
434
- |------|------|---------|-------------|
435
- | `columns` | `DataTableColumn[]` | required | Column definitions |
436
- | `data` | `T[]` | required | Rows to display |
437
- | `loading` | `boolean` | `false` | Show loading spinner and disable controls |
438
- | `getRowId` | `(row, index) => string \| number` | index | Stable row key |
439
- | `pageSize` | `number` | `10` | Initial rows per page |
440
- | `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Page size choices |
441
- | `emptyText` | `string` | `"No results found."` | Empty state message |
442
- | `loadingLabel` | `string` | `"Loading data"` | Accessible label for loading spinner |
443
- | `onRowClick` | `(row: T) => void` | — | Row click handler |
444
- | `className` | `string` | — | Root CSS class |
445
- | `style` | `CSSProperties` | — | Root inline styles |
446
-
447
- ## Pagination
448
-
449
- Standalone pagination footer with result summary, rows-per-page dropdown, and previous/next controls. Used by `DataTable` but can be composed independently.
450
-
451
- ### Usage
452
-
453
- ```tsx
454
- import { Pagination } from "@rfdtech/components";
455
-
456
- <Pagination
457
- page={page}
458
- pageSize={pageSize}
459
- total={total}
460
- onPageChange={setPage}
461
- onPageSizeChange={setPageSize}
462
- />
463
- ```
464
-
465
- ### Props
466
-
467
- | Prop | Type | Default | Description |
468
- |------|------|---------|-------------|
469
- | `page` | `number` | required | Current page (1-based) |
470
- | `pageSize` | `number` | required | Rows per page |
471
- | `total` | `number` | required | Total row count |
472
- | `pageSizeOptions` | `number[]` | `[10, 25, 50]` | Page size choices |
473
- | `loading` | `boolean` | `false` | Disable controls while loading |
474
- | `emptySummaryText` | `string` | `"Showing 0 results"` | Summary when `total` is 0 |
475
- | `onPageChange` | `(page: number) => void` | required | Page change callback |
476
- | `onPageSizeChange` | `(pageSize: number) => void` | required | Page size change callback |
477
- | `className` | `string` | — | Root CSS class |
478
- | `style` | `CSSProperties` | — | Root inline styles |
479
-
480
- ## DropdownMenu
481
-
482
- Action menu triggered by a custom button. Use for row actions, overflow menus, and navigation shortcuts.
483
-
484
- ### Usage
485
-
486
- ```tsx
487
- import { DropdownMenu } from "@rfdtech/components";
488
-
489
- <DropdownMenu
490
- ariaLabel="Row actions"
491
- trigger={<span>⋮</span>}
492
- items={[
493
- { id: "edit", label: "Edit", onSelect: () => console.log("edit") },
494
- { id: "docs", label: "Docs", href: "https://example.com/docs" },
495
- { id: "delete", label: "Delete", onSelect: () => {}, destructive: true },
496
- ]}
497
- />
498
- ```
499
-
500
- ### Props
501
-
502
- | Prop | Type | Default | Description |
503
- |------|------|---------|-------------|
504
- | `trigger` | `ReactNode \| (state) => ReactNode` | required | Button content or render prop |
505
- | `items` | `DropdownMenuItem[]` | required | Menu entries |
506
- | `ariaLabel` | `string` | required | Accessible label for trigger and menu |
507
- | `placement` | `"bottom-start" \| "bottom-end" \| "bottom"` | `"bottom-end"` | Panel position |
508
- | `closeOnSelect` | `boolean` | `true` | Close after an item is chosen |
509
- | `open` | `boolean` | — | Controlled open state |
510
- | `onOpenChange` | `(open: boolean) => void` | — | Open state callback |
511
- | `className` | `string` | — | Root CSS class |
512
- | `style` | `CSSProperties` | — | Root inline styles |
513
94
 
514
95
  ## BulkImportModal
515
96
 
@@ -659,6 +240,170 @@ To change the gutter size, override `--gsl-bulk-import-gutter` on `.gsl-bulk-imp
659
240
  }
660
241
  ```
661
242
 
243
+
244
+ ## Button
245
+
246
+ Shared button with primary, secondary, outline, and ghost variants, plus loading and disabled states. See the [Button](/docs/button) docs page for props and exported types.
247
+
248
+ ```tsx
249
+ import { Button } from "@rfdtech/components";
250
+
251
+ <Button variant="primary" onClick={() => save()}>
252
+ Save
253
+ </Button>
254
+
255
+ <Button loading loadingLabel="Saving">
256
+ Save
257
+ </Button>
258
+
259
+ <Button disabled>Unavailable</Button>
260
+
261
+ <Button
262
+ variant="outline"
263
+ classNames={{ root: "min-w-32", label: "font-semibold" }}
264
+ >
265
+ Custom
266
+ </Button>
267
+ ```
268
+
269
+ Props: `variant`, `size`, `loading`, `loadingLabel`, `classNames`, and standard `button` attributes. Exported types: `ButtonProps`, `ButtonClassNames`, `ButtonVariant`, `ButtonSize`.
270
+
271
+
272
+ ## Checkbox
273
+
274
+ Accessible checkbox with optional label and part-level `classNames`. See the [Checkbox](/docs/checkbox) docs page for props and exported types.
275
+
276
+ ```tsx
277
+ import { Checkbox } from "@rfdtech/components";
278
+
279
+ <Checkbox
280
+ label="Accept terms and conditions"
281
+ checked={accepted}
282
+ onCheckedChange={setAccepted}
283
+ />
284
+
285
+ <Checkbox
286
+ aria-label="Select row"
287
+ checked={selected}
288
+ onCheckedChange={setSelected}
289
+ />
290
+ ```
291
+
292
+ Props: `checked`, `defaultChecked`, `onCheckedChange`, `label`, `disabled`, `required`, `name`, `value`, `id`, `aria-label`, `classNames`, `className`. Exported types: `CheckboxProps`, `CheckboxClassNames`.
293
+
294
+
295
+ ## RadioGroup
296
+
297
+ Single-choice radio group with optional labels and descriptions on each `Radio` item. Use `variant="card"` for bordered choice cards. See the [RadioGroup](/docs/radio-group) docs page for props and exported types.
298
+
299
+ ```tsx
300
+ import { Radio, RadioGroup } from "@rfdtech/components";
301
+
302
+ <RadioGroup variant="card" value={plan} onValueChange={setPlan}>
303
+ <Radio
304
+ value="starter"
305
+ label="Starter"
306
+ description="For individuals getting started."
307
+ />
308
+ <Radio
309
+ value="team"
310
+ label="Team"
311
+ description="Collaborate with up to 10 members."
312
+ />
313
+ </RadioGroup>
314
+ ```
315
+
316
+ Props: `RadioGroup` — `value`, `defaultValue`, `onValueChange`, `name`, `disabled`, `required`, `orientation`, `variant`, `classNames`, `className`, `children`. `Radio` — `value`, `label`, `description`, `disabled`, `id`, `aria-label`, `classNames`, `className`. Exported types: `RadioGroupProps`, `RadioProps`, `RadioGroupClassNames`, `RadioClassNames`, `RadioGroupVariant`.
317
+
318
+
319
+ ## Dropdown
320
+
321
+ Select-style dropdown for choosing one option from a list. See the [Dropdown](/docs/dropdown) docs page for props and exported types.
322
+
323
+ ```tsx
324
+ import { Dropdown } from "@rfdtech/components";
325
+
326
+ <Dropdown
327
+ aria-label="Field"
328
+ value={value}
329
+ onValueChange={setValue}
330
+ options={[
331
+ { value: "email", label: "Email" },
332
+ { value: "name", label: "Full name" },
333
+ ]}
334
+ placeholder="Select..."
335
+ clearable
336
+ />
337
+ ```
338
+
339
+ Props: `value`, `onValueChange`, `options`, `placeholder`, `clearable`, `disabled`, `aria-label`, `classNames`, `className`. Exported types: `DropdownProps`, `DropdownOption`, `DropdownClassNames`.
340
+
341
+
342
+ ## Popover
343
+
344
+ Compound popover primitives for floating panels. See the [Popover](/docs/popover) docs page for props and exported types.
345
+
346
+ ```tsx
347
+ import {
348
+ Button,
349
+ Popover,
350
+ PopoverClose,
351
+ PopoverContent,
352
+ PopoverTrigger,
353
+ } from "@rfdtech/components";
354
+
355
+ <Popover>
356
+ <PopoverTrigger asChild>
357
+ <Button variant="secondary">Actions</Button>
358
+ </PopoverTrigger>
359
+ <PopoverContent
360
+ side="bottom"
361
+ align="end"
362
+ sideOffset={4}
363
+ className="gsl-popover--menu"
364
+ >
365
+ <div className="gsl-popover__menu" role="menu">
366
+ <PopoverClose asChild>
367
+ <button type="button" className="gsl-popover__menu-item" role="menuitem">
368
+ Edit
369
+ </button>
370
+ </PopoverClose>
371
+ <PopoverClose asChild>
372
+ <button
373
+ type="button"
374
+ className="gsl-popover__menu-item gsl-popover__menu-item--destructive"
375
+ role="menuitem"
376
+ >
377
+ Delete
378
+ </button>
379
+ </PopoverClose>
380
+ </div>
381
+ </PopoverContent>
382
+ </Popover>
383
+ ```
384
+
385
+ Exports: `Popover`, `PopoverTrigger`, `PopoverContent`, `PopoverPortal`, `PopoverAnchor`, `PopoverClose`. Exported types: `PopoverContentProps`, `PopoverContentClassNames`.
386
+
387
+
388
+ ## Tabs
389
+
390
+ Compound tabs primitives for switching between related panels. See the [Tabs](/docs/tabs) docs page for props and exported types.
391
+
392
+ ```tsx
393
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rfdtech/components";
394
+
395
+ <Tabs defaultValue="account" variant="line">
396
+ <TabsList>
397
+ <TabsTrigger value="account">Account</TabsTrigger>
398
+ <TabsTrigger value="security">Security</TabsTrigger>
399
+ </TabsList>
400
+ <TabsContent value="account">Account settings</TabsContent>
401
+ <TabsContent value="security">Security settings</TabsContent>
402
+ </Tabs>
403
+ ```
404
+
405
+ Exports: `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`. Props: `Tabs` — `value`, `defaultValue`, `onValueChange`, `orientation`, `activationMode`, `variant`, `classNames`, `className`, `children`. `TabsTrigger` — `value`, `disabled`, `classNames`, `className`. Exported types: `TabsProps`, `TabsListProps`, `TabsTriggerProps`, `TabsContentProps`, `TabsVariant`, `TabsClassNames`, `TabsListClassNames`, `TabsTriggerClassNames`, `TabsContentClassNames`.
406
+
662
407
  ## Development
663
408
 
664
409
  ```bash
@@ -1,5 +1,4 @@
1
1
  import type { AppSwitcherProps } from "../../types/app-switcher";
2
- import "../../styles/theme.css";
3
2
  import "./styles/app-switcher.css";
4
- export declare function AppSwitcher({ apps: appsProp, baseUrl, accessToken, open: controlledOpen, onOpenChange, onAppSelect, columns, triggerLabel, trigger, title, footer, className, style, placement, closeOnSelect, }: AppSwitcherProps): import("react").JSX.Element;
3
+ export declare function AppSwitcher({ apps, loading, loadingLabel, open: controlledOpen, onOpenChange, onAppSelect, columns, triggerLabel, trigger, title, footer, className, style, placement, closeOnSelect, }: AppSwitcherProps): import("react").JSX.Element;
5
4
  //# sourceMappingURL=AppSwitcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcher.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,wBAAwB,CAAC;AAChC,OAAO,2BAA2B,CAAC;AAEnC,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EACP,WAAW,EACX,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,WAAW,EACX,OAAW,EACX,YAAkC,EAClC,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,SAAwB,EACxB,aAAoB,GACrB,EAAE,gBAAgB,+BA6GlB"}
1
+ {"version":3,"file":"AppSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/app-switcher/AppSwitcher.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,2BAA2B,CAAC;AAcnC,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,OAAe,EACf,YAAmC,EACnC,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,WAAW,EACX,OAAW,EACX,YAAkC,EAClC,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,SAAwB,EACxB,aAAoB,GACrB,EAAE,gBAAgB,+BAoGlB"}