@bpfdev/oly-ui 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,371 @@
1
+ # @bpfdev/oly-ui
2
+
3
+ > **npm:** [@bpfdev/oly-ui](https://www.npmjs.com/package/@bpfdev/oly-ui) · **private** (requires membership of the `@bpfdev/oly-ui` npm org)
4
+
5
+ A production-ready React component library built on top of [MUI](https://mui.com/), designed for data-heavy dashboards and enterprise UIs. Ships with full TypeScript types, tree-shakeable ESM + CJS bundles, and an optional Tailwind CSS preset.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @bpfdev/oly-ui
13
+ ```
14
+
15
+ ### Peer dependencies
16
+
17
+ The following packages must be installed in your project:
18
+
19
+ ```bash
20
+ npm install react react-dom \
21
+ @mui/material @mui/icons-material @mui/x-data-grid @mui/utils \
22
+ @emotion/react @emotion/styled \
23
+ @iconify/react
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Quick start
29
+
30
+ Wrap your application (or Storybook preview) with `FalconThemeProvider` to apply the Falcon design tokens:
31
+
32
+ ```tsx
33
+ import { FalconThemeProvider } from '@bpfdev/oly-ui';
34
+
35
+ function App() {
36
+ return (
37
+ <FalconThemeProvider
38
+ settings={{
39
+ mode: 'light',
40
+ direction: 'ltr',
41
+ appBarBlur: true,
42
+ navCollapsed: false,
43
+ }}
44
+ >
45
+ {/* your app */}
46
+ </FalconThemeProvider>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Components
54
+
55
+ ### FalconButton
56
+
57
+ A MUI `Button` wrapper with a built-in loading state.
58
+
59
+ ```tsx
60
+ import { FalconButton } from '@bpfdev/oly-ui';
61
+
62
+ <FalconButton variant="contained" loading={isSubmitting} onClick={handleSave}>
63
+ Save
64
+ </FalconButton>;
65
+ ```
66
+
67
+ | Prop | Type | Default | Description |
68
+ | ----------- | ------------------------------------- | ------------- | --------------------------------------- |
69
+ | `variant` | `'contained' \| 'outlined' \| 'text'` | `'contained'` | MUI button variant |
70
+ | `size` | `'small' \| 'medium' \| 'large'` | `'large'` | Button size |
71
+ | `loading` | `boolean` | `false` | Shows a spinner and disables the button |
72
+ | `disabled` | `boolean` | — | Disables the button |
73
+ | `fullWidth` | `boolean` | `true` | Stretches to container width |
74
+ | `type` | `'submit' \| 'button' \| 'reset'` | `'submit'` | HTML button type |
75
+
76
+ ---
77
+
78
+ ### FalconMultiSelect
79
+
80
+ A controlled multi-select autocomplete with apply/clear actions.
81
+
82
+ ```tsx
83
+ import { FalconMultiSelect } from '@bpfdev/oly-ui';
84
+ import type { FalconMultiSelectOption } from '@bpfdev/oly-ui';
85
+
86
+ const regions: FalconMultiSelectOption[] = [
87
+ { id: 1, name: 'North' },
88
+ { id: 2, name: 'South' },
89
+ { id: 3, name: 'East' },
90
+ ];
91
+
92
+ function Example() {
93
+ const [selected, setSelected] = React.useState<FalconMultiSelectOption[]>([]);
94
+
95
+ return (
96
+ <FalconMultiSelect
97
+ label="Region"
98
+ list={regions}
99
+ data={selected}
100
+ setData={setSelected}
101
+ />
102
+ );
103
+ }
104
+ ```
105
+
106
+ | Prop | Type | Description |
107
+ | --------- | -------------------------------------------- | --------------------------------------- |
108
+ | `label` | `string` | Placeholder / trigger label |
109
+ | `list` | `FalconMultiSelectOption[]` | All available options |
110
+ | `data` | `FalconMultiSelectOption[]` | Currently selected options (controlled) |
111
+ | `setData` | `(value: FalconMultiSelectOption[]) => void` | Called when Apply or Clear is clicked |
112
+
113
+ ---
114
+
115
+ ### FalconSelect
116
+
117
+ A single-value select built on MUI `TextField`.
118
+
119
+ ```tsx
120
+ import { FalconSelect } from '@bpfdev/oly-ui';
121
+
122
+ <FalconSelect
123
+ label="Status"
124
+ value={status}
125
+ onChange={setStatus}
126
+ options={['Active', 'Inactive', 'Pending']}
127
+ clearable
128
+ />;
129
+ ```
130
+
131
+ | Prop | Type | Default | Description |
132
+ | ----------- | ---------------------------------- | ------- | --------------------------- |
133
+ | `label` | `string` | — | Field label |
134
+ | `value` | `string` | — | Selected value (controlled) |
135
+ | `onChange` | `(value: string) => void` | — | Change callback |
136
+ | `options` | `string[] \| FalconSelectOption[]` | — | Options list |
137
+ | `disabled` | `boolean` | `false` | Disables the field |
138
+ | `clearable` | `boolean` | `false` | Adds a clear button |
139
+
140
+ ---
141
+
142
+ ### FalconPagination
143
+
144
+ A combined page-number + page-size selector.
145
+
146
+ ```tsx
147
+ import { FalconPagination } from '@bpfdev/oly-ui';
148
+
149
+ <FalconPagination
150
+ pageNo={page}
151
+ setPageNo={setPage}
152
+ perPage={rowsPerPage}
153
+ setPerPage={setRowsPerPage}
154
+ totalItems={totalCount}
155
+ perPageOptions={[10, 25, 50]}
156
+ />;
157
+ ```
158
+
159
+ | Prop | Type | Default | Description |
160
+ | ---------------- | --------------------- | -------------- | ----------------------------- |
161
+ | `pageNo` | `number` | — | Current page (1-based) |
162
+ | `setPageNo` | `(n: number) => void` | — | Page change callback |
163
+ | `perPage` | `number` | — | Rows per page |
164
+ | `setPerPage` | `(n: number) => void` | — | Rows-per-page change callback |
165
+ | `totalItems` | `number` | — | Total record count |
166
+ | `perPageOptions` | `number[]` | `[10, 25, 50]` | Dropdown options |
167
+
168
+ ---
169
+
170
+ ### FalconTable
171
+
172
+ A thin wrapper around MUI X DataGrid with sensible defaults.
173
+
174
+ ```tsx
175
+ import { FalconTable } from '@bpfdev/oly-ui';
176
+ import type { GridColDef } from '@mui/x-data-grid';
177
+
178
+ const columns: GridColDef[] = [
179
+ { field: 'id', headerName: 'ID', width: 90 },
180
+ { field: 'name', headerName: 'Name', flex: 1 },
181
+ ];
182
+
183
+ <FalconTable
184
+ rows={data}
185
+ columns={columns}
186
+ getRowId={row => row.id}
187
+ pageSizeOptions={[10, 25]}
188
+ initialState={{ pagination: { paginationModel: { pageSize: 10 } } }}
189
+ />;
190
+ ```
191
+
192
+ | Prop | Type | Description |
193
+ | ----------------- | ------------------------------ | -------------------------- |
194
+ | `rows` | `T[]` | Row data array |
195
+ | `columns` | `GridColDef[]` | Column definitions |
196
+ | `getRowId` | `(row: T) => string \| number` | Row identity function |
197
+ | `pageSizeOptions` | `number[]` | Page size options |
198
+ | `initialState` | `object` | MUI DataGrid initial state |
199
+
200
+ ---
201
+
202
+ ### FalconGrayButton
203
+
204
+ A secondary action button styled with a gray palette.
205
+
206
+ ```tsx
207
+ import { FalconGrayButton } from '@bpfdev/oly-ui';
208
+
209
+ <FalconGrayButton onClick={handleCancel}>Cancel</FalconGrayButton>;
210
+ ```
211
+
212
+ ---
213
+
214
+ ### ButtonWithIcon
215
+
216
+ A button that places an icon alongside a label.
217
+
218
+ ```tsx
219
+ import { ButtonWithIcon } from '@bpfdev/oly-ui';
220
+
221
+ <ButtonWithIcon icon={<AddIcon />} label="Add Item" onClick={handleAdd} />;
222
+ ```
223
+
224
+ ---
225
+
226
+ ### FalconSingleSwitch
227
+
228
+ A labeled toggle switch.
229
+
230
+ ```tsx
231
+ import { FalconSingleSwitch } from '@bpfdev/oly-ui';
232
+
233
+ <FalconSingleSwitch
234
+ label="Enable notifications"
235
+ checked={enabled}
236
+ onChange={setEnabled}
237
+ />;
238
+ ```
239
+
240
+ ---
241
+
242
+ ### FalconDIstrictFilter
243
+
244
+ A district-level filter selector.
245
+
246
+ ```tsx
247
+ import { FalconDIstrictFilter } from '@bpfdev/oly-ui';
248
+ import type { FalconDIstrictFilterOption } from '@bpfdev/oly-ui';
249
+
250
+ const districts: FalconDIstrictFilterOption[] = [
251
+ { id: 1, name: 'Downtown' },
252
+ { id: 2, name: 'Uptown' },
253
+ ];
254
+
255
+ <FalconDIstrictFilter list={districts} data={selected} setData={setSelected} />;
256
+ ```
257
+
258
+ ---
259
+
260
+ ### FalconTicketFilter / FalconTicketColumsFilter
261
+
262
+ Ticket management filters for status, priority, and column visibility toggles.
263
+
264
+ ```tsx
265
+ import { FalconTicketFilter, FalconTicketColumsFilter } from '@bpfdev/oly-ui';
266
+ ```
267
+
268
+ ---
269
+
270
+ ### AdvancedFiltersDialog
271
+
272
+ A modal dialog for composing multi-criteria filter rules.
273
+
274
+ ```tsx
275
+ import { AdvancedFiltersDialog } from '@bpfdev/oly-ui';
276
+ ```
277
+
278
+ ---
279
+
280
+ ### HeatMapChartLegend
281
+
282
+ A color-scale legend for heat map charts.
283
+
284
+ ```tsx
285
+ import { HeatMapChartLegend } from '@bpfdev/oly-ui';
286
+ import type { HeatMapLegendItem } from '@bpfdev/oly-ui';
287
+
288
+ const items: HeatMapLegendItem[] = [
289
+ { color: '#f7f7f7', label: 'Low' },
290
+ { color: '#EE8B3A', label: 'High' },
291
+ ];
292
+
293
+ <HeatMapChartLegend items={items} />;
294
+ ```
295
+
296
+ ---
297
+
298
+ ### ProgressBarNumber
299
+
300
+ A numeric value displayed alongside a progress bar.
301
+
302
+ ```tsx
303
+ import { ProgressBarNumber } from '@bpfdev/oly-ui';
304
+
305
+ <ProgressBarNumber value={72} max={100} label="Completion" />;
306
+ ```
307
+
308
+ ---
309
+
310
+ ### AddCommentInput
311
+
312
+ A text input designed for threaded comment submissions.
313
+
314
+ ```tsx
315
+ import { AddCommentInput } from '@bpfdev/oly-ui';
316
+
317
+ <AddCommentInput onSubmit={text => postComment(text)} />;
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Tailwind CSS preset
323
+
324
+ If you use Tailwind, extend your config with the Falcon color tokens:
325
+
326
+ ```js
327
+ // tailwind.config.js
328
+ module.exports = {
329
+ presets: [require('@bpfdev/oly-ui/tailwind.preset')],
330
+ // ...
331
+ };
332
+ ```
333
+
334
+ This exposes Falcon's primary palette as `falcon-*` utility classes (e.g. `bg-falcon-500`).
335
+
336
+ > **Note:** The preset reads from the built `dist/` folder — run `npm run build` in the package before using the preset in a fresh clone.
337
+
338
+ ---
339
+
340
+ ## FalconThemeProvider settings
341
+
342
+ | Prop | Type | Default | Description |
343
+ | -------------- | ------------------- | --------- | ---------------------------- |
344
+ | `mode` | `'light' \| 'dark'` | `'light'` | Color scheme |
345
+ | `direction` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction |
346
+ | `appBarBlur` | `boolean` | `true` | Frosted-glass app bar effect |
347
+ | `navCollapsed` | `boolean` | `false` | Collapsed sidebar state |
348
+
349
+ ---
350
+
351
+ ## Development
352
+
353
+ ```bash
354
+ # build once
355
+ npm run build
356
+
357
+ # watch mode
358
+ npm run dev
359
+
360
+ # run tests
361
+ npm run test
362
+
363
+ # type-check without emitting
364
+ npm run typecheck
365
+ ```
366
+
367
+ ---
368
+
369
+ ## License
370
+
371
+ MIT © @bpfdev/oly-ui
@@ -0,0 +1,195 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ButtonProps, PaletteMode, Direction } from '@mui/material';
3
+ import { ReactNode, ReactElement } from 'react';
4
+ import { GridColDef } from '@mui/x-data-grid';
5
+
6
+ interface AddCommentInputProps {
7
+ value: string;
8
+ setValue: (s: string) => void;
9
+ handleAddComment: () => void;
10
+ placeholder?: string;
11
+ buttonLabel?: string;
12
+ }
13
+
14
+ declare const AddCommentInput: ({ value, setValue, handleAddComment, placeholder, buttonLabel, }: AddCommentInputProps) => react_jsx_runtime.JSX.Element;
15
+
16
+ interface FalconMultiSelectOption {
17
+ id: number;
18
+ name: string;
19
+ }
20
+ interface FalconMultiSelectProps {
21
+ label: string;
22
+ /** Currently selected items (controlled) */
23
+ data: FalconMultiSelectOption[];
24
+ /** Callback when selection is applied or cleared */
25
+ setData: (value: FalconMultiSelectOption[]) => void;
26
+ /** Full list of options to choose from */
27
+ list: FalconMultiSelectOption[];
28
+ }
29
+
30
+ declare const FalconMultiSelect: ({ label, data, setData, list }: FalconMultiSelectProps) => react_jsx_runtime.JSX.Element;
31
+
32
+ interface AdvancedFiltersDialogProps {
33
+ open: boolean;
34
+ onClose: () => void;
35
+ locationOptions?: FalconMultiSelectOption[];
36
+ businessAreaOptions?: FalconMultiSelectOption[];
37
+ selectedLocations?: FalconMultiSelectOption[];
38
+ selectedBusinessAreas?: FalconMultiSelectOption[];
39
+ onLocationsChange?: (value: FalconMultiSelectOption[]) => void;
40
+ onBusinessAreasChange?: (value: FalconMultiSelectOption[]) => void;
41
+ onApply?: () => void;
42
+ onCancel?: () => void;
43
+ }
44
+
45
+ declare const AdvancedFiltersDialog: ({ open, onClose, locationOptions, businessAreaOptions, selectedLocations, selectedBusinessAreas, onLocationsChange, onBusinessAreasChange, onApply, onCancel, }: AdvancedFiltersDialogProps) => react_jsx_runtime.JSX.Element;
46
+
47
+ interface ButtonWithIconProps extends ButtonProps {
48
+ children: ReactNode;
49
+ icon?: ReactElement;
50
+ }
51
+
52
+ declare const ButtonWithIcon: ({ size, variant, children, icon, ...props }: ButtonWithIconProps) => react_jsx_runtime.JSX.Element;
53
+
54
+ interface FalconButtonProps extends ButtonProps {
55
+ loading?: boolean;
56
+ iconPlacement?: 'start' | 'end';
57
+ }
58
+
59
+ declare const FalconButton: ({ loading, disabled, children, size, variant, type, fullWidth, className, ...props }: FalconButtonProps) => react_jsx_runtime.JSX.Element;
60
+
61
+ interface FalconDIstrictFilterOption {
62
+ id: string | number;
63
+ label: string;
64
+ }
65
+ interface FalconDIstrictFilterProps {
66
+ label?: string;
67
+ options?: FalconDIstrictFilterOption[];
68
+ value?: FalconDIstrictFilterOption[];
69
+ onChange?: (value: FalconDIstrictFilterOption[]) => void;
70
+ }
71
+
72
+ /** District filter — full implementation can be migrated from apps/docs. */
73
+ declare const FalconDIstrictFilter: ({ label, options, value, onChange, }: FalconDIstrictFilterProps) => react_jsx_runtime.JSX.Element;
74
+
75
+ interface FalconGrayButtonProps {
76
+ text: string;
77
+ Icon?: ReactNode;
78
+ onClick?: () => void;
79
+ }
80
+
81
+ declare const FalconGrayButton: ({ text, Icon, onClick, }: FalconGrayButtonProps) => react_jsx_runtime.JSX.Element;
82
+
83
+ interface FalconPaginationProps {
84
+ pageNo: number;
85
+ setPageNo: (n: number) => void;
86
+ perPage: number;
87
+ setPerPage: (n: number) => void;
88
+ totalItems: number;
89
+ perPageOptions?: number[];
90
+ }
91
+
92
+ declare const FalconPagination: ({ pageNo, setPageNo, perPage, setPerPage, totalItems, perPageOptions, }: FalconPaginationProps) => react_jsx_runtime.JSX.Element;
93
+
94
+ interface FalconSelectOption {
95
+ value: string;
96
+ label: string;
97
+ }
98
+ interface FalconSelectProps {
99
+ label: string;
100
+ value: string;
101
+ onChange: (value: string) => void;
102
+ options: string[] | FalconSelectOption[];
103
+ disabled?: boolean;
104
+ clearable?: boolean;
105
+ }
106
+
107
+ declare const FalconSelect: ({ label, value, onChange, options, disabled, clearable, }: FalconSelectProps) => react_jsx_runtime.JSX.Element;
108
+
109
+ interface FalconSingleSwitchProps {
110
+ color?: 'success' | 'warning' | 'error' | 'info' | 'primary' | 'secondary' | 'default';
111
+ setStatus?: (status: boolean) => void;
112
+ value?: boolean;
113
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
114
+ }
115
+
116
+ declare const FalconSingleSwitch: ({ color, setStatus, value, onChange, }: FalconSingleSwitchProps) => react_jsx_runtime.JSX.Element;
117
+
118
+ interface FalconTableProps<T = Record<string, unknown>> {
119
+ rows: T[];
120
+ getRowId: (row: T) => string | number;
121
+ columns: GridColDef[];
122
+ pageSizeOptions?: number[];
123
+ initialState?: {
124
+ pagination?: {
125
+ paginationModel: {
126
+ pageSize: number;
127
+ };
128
+ };
129
+ };
130
+ }
131
+
132
+ declare const FalconTable: <T extends Record<string, unknown>>({ rows, getRowId, columns, pageSizeOptions, }: FalconTableProps<T>) => react_jsx_runtime.JSX.Element;
133
+
134
+ interface FalconTicketColumsFilterProps {
135
+ columns?: {
136
+ id: string;
137
+ label: string;
138
+ }[];
139
+ selected?: string[];
140
+ onSelectionChange?: (selected: string[]) => void;
141
+ }
142
+
143
+ /** Column filter UI — full implementation can be migrated from apps/docs. */
144
+ declare const FalconTicketColumsFilter: ({ columns, selected, onSelectionChange, }: FalconTicketColumsFilterProps) => react_jsx_runtime.JSX.Element;
145
+
146
+ interface FalconTicketFilterProps {
147
+ children: ReactNode;
148
+ label?: string;
149
+ open?: boolean;
150
+ onOpenChange?: (open: boolean) => void;
151
+ }
152
+
153
+ declare const FalconTicketFilter: ({ children, label, open: controlledOpen, onOpenChange, }: FalconTicketFilterProps) => react_jsx_runtime.JSX.Element;
154
+
155
+ interface HeatMapLegendItem {
156
+ label: string;
157
+ color: string;
158
+ }
159
+ interface HeatMapChartLegendProps {
160
+ title: string;
161
+ items: HeatMapLegendItem[];
162
+ gradientId: string;
163
+ gradientStops: {
164
+ offset: string;
165
+ color: string;
166
+ }[];
167
+ }
168
+
169
+ declare const HeatMapChartLegend: ({ title, items, gradientId, gradientStops, }: HeatMapChartLegendProps) => react_jsx_runtime.JSX.Element;
170
+
171
+ interface ProgressBarNumberProps {
172
+ number: number;
173
+ progress: 0 | 50 | 100;
174
+ numColor: string;
175
+ }
176
+
177
+ declare const ProgressBarNumber: ({ number, progress, numColor, }: ProgressBarNumberProps) => react_jsx_runtime.JSX.Element;
178
+
179
+ type Settings = {
180
+ mode: PaletteMode;
181
+ direction: Direction;
182
+ navHidden?: boolean;
183
+ appBarBlur: boolean;
184
+ navCollapsed: boolean;
185
+ layout?: 'vertical' | 'horizontal';
186
+ lastLayout?: 'vertical' | 'horizontal';
187
+ };
188
+
189
+ interface Props {
190
+ settings: Settings;
191
+ children: ReactNode;
192
+ }
193
+ declare const ThemeComponent: (props: Props) => react_jsx_runtime.JSX.Element;
194
+
195
+ export { AddCommentInput, type AddCommentInputProps, AdvancedFiltersDialog, type AdvancedFiltersDialogProps, ButtonWithIcon, type ButtonWithIconProps, FalconButton, type FalconButtonProps, FalconDIstrictFilter, type FalconDIstrictFilterOption, type FalconDIstrictFilterProps, FalconGrayButton, type FalconGrayButtonProps, FalconMultiSelect, type FalconMultiSelectOption, type FalconMultiSelectProps, FalconPagination, type FalconPaginationProps, FalconSelect, type FalconSelectOption, type FalconSelectProps, FalconSingleSwitch, type FalconSingleSwitchProps, FalconTable, type FalconTableProps, ThemeComponent as FalconThemeProvider, FalconTicketColumsFilter, type FalconTicketColumsFilterProps, FalconTicketFilter, type FalconTicketFilterProps, HeatMapChartLegend, type HeatMapChartLegendProps, type HeatMapLegendItem, ProgressBarNumber, type ProgressBarNumberProps };