@pattern-stack/frontend-patterns 0.2.0-alpha.0 → 0.2.0-alpha.11
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/dist/atoms/components/core/Badge/Badge.d.ts +1 -1
- package/dist/atoms/components/data/DataTable/ColumnFilterDropdown.d.ts +32 -0
- package/dist/atoms/components/data/DataTable/ColumnFilterDropdown.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/ColumnVisibilityToggle.d.ts +32 -0
- package/dist/atoms/components/data/DataTable/ColumnVisibilityToggle.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/DataTable.d.ts +5 -2
- package/dist/atoms/components/data/DataTable/DataTable.d.ts.map +1 -1
- package/dist/atoms/components/data/DataTable/DataTable.expansion.d.ts +91 -0
- package/dist/atoms/components/data/DataTable/DataTable.expansion.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/DataTable.filters.d.ts +271 -0
- package/dist/atoms/components/data/DataTable/DataTable.filters.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/DataTable.types.d.ts +155 -5
- package/dist/atoms/components/data/DataTable/DataTable.types.d.ts.map +1 -1
- package/dist/atoms/components/data/DataTable/ExpandButton.d.ts +37 -0
- package/dist/atoms/components/data/DataTable/ExpandButton.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/FilterPill.d.ts +25 -0
- package/dist/atoms/components/data/DataTable/FilterPill.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/QuickFilterBar.d.ts +35 -0
- package/dist/atoms/components/data/DataTable/QuickFilterBar.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/BooleanFilterEditor.d.ts +10 -0
- package/dist/atoms/components/data/DataTable/filters/BooleanFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/DateFilterEditor.d.ts +11 -0
- package/dist/atoms/components/data/DataTable/filters/DateFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/MultiSelectFilterEditor.d.ts +10 -0
- package/dist/atoms/components/data/DataTable/filters/MultiSelectFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/NumberFilterEditor.d.ts +10 -0
- package/dist/atoms/components/data/DataTable/filters/NumberFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/SelectFilterEditor.d.ts +10 -0
- package/dist/atoms/components/data/DataTable/filters/SelectFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/TextFilterEditor.d.ts +10 -0
- package/dist/atoms/components/data/DataTable/filters/TextFilterEditor.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/filters/index.d.ts +14 -0
- package/dist/atoms/components/data/DataTable/filters/index.d.ts.map +1 -0
- package/dist/atoms/components/data/DataTable/index.d.ts +9 -0
- package/dist/atoms/components/data/DataTable/index.d.ts.map +1 -1
- package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/atoms/components/data/index.d.ts +3 -2
- package/dist/atoms/components/data/index.d.ts.map +1 -1
- package/dist/atoms/composed/ConnectionStatus/ConnectionStatus.d.ts +16 -0
- package/dist/atoms/composed/ConnectionStatus/ConnectionStatus.d.ts.map +1 -0
- package/dist/atoms/composed/ConnectionStatus/index.d.ts +3 -0
- package/dist/atoms/composed/ConnectionStatus/index.d.ts.map +1 -0
- package/dist/atoms/hooks/index.d.ts +9 -0
- package/dist/atoms/hooks/index.d.ts.map +1 -1
- package/dist/atoms/hooks/useAdaptiveTable.d.ts +49 -0
- package/dist/atoms/hooks/useAdaptiveTable.d.ts.map +1 -0
- package/dist/atoms/hooks/useApi.d.ts +1 -1
- package/dist/atoms/hooks/useApi.d.ts.map +1 -1
- package/dist/atoms/hooks/useColumnVisibility.d.ts +75 -0
- package/dist/atoms/hooks/useColumnVisibility.d.ts.map +1 -0
- package/dist/atoms/hooks/useEntityData.d.ts +36 -0
- package/dist/atoms/hooks/useEntityData.d.ts.map +1 -0
- package/dist/atoms/hooks/useEntityDetail.d.ts +43 -0
- package/dist/atoms/hooks/useEntityDetail.d.ts.map +1 -0
- package/dist/atoms/hooks/useExpandedRows.d.ts +66 -0
- package/dist/atoms/hooks/useExpandedRows.d.ts.map +1 -0
- package/dist/atoms/hooks/useFieldMetadata.d.ts +18 -0
- package/dist/atoms/hooks/useFieldMetadata.d.ts.map +1 -0
- package/dist/atoms/hooks/useOnlineStatus.d.ts +16 -0
- package/dist/atoms/hooks/useOnlineStatus.d.ts.map +1 -0
- package/dist/atoms/hooks/useResponsiveTable.d.ts +123 -0
- package/dist/atoms/hooks/useResponsiveTable.d.ts.map +1 -0
- package/dist/atoms/hooks/useTableFilters.d.ts +92 -0
- package/dist/atoms/hooks/useTableFilters.d.ts.map +1 -0
- package/dist/atoms/index.d.ts +1 -0
- package/dist/atoms/index.d.ts.map +1 -1
- package/dist/atoms/primitives/sheet.d.ts +23 -0
- package/dist/atoms/primitives/sheet.d.ts.map +1 -0
- package/dist/atoms/primitives/table.d.ts.map +1 -1
- package/dist/atoms/services/api/client.d.ts +12 -2
- package/dist/atoms/services/api/client.d.ts.map +1 -1
- package/dist/atoms/services/auth-service.d.ts +15 -0
- package/dist/atoms/services/auth-service.d.ts.map +1 -1
- package/dist/atoms/services/index.d.ts +2 -2
- package/dist/atoms/services/index.d.ts.map +1 -1
- package/dist/atoms/shared/config/table-config.d.ts +79 -0
- package/dist/atoms/shared/config/table-config.d.ts.map +1 -0
- package/dist/atoms/shared/index.d.ts +1 -0
- package/dist/atoms/shared/index.d.ts.map +1 -1
- package/dist/atoms/types/auth.d.ts +95 -2
- package/dist/atoms/types/auth.d.ts.map +1 -1
- package/dist/atoms/types/index.d.ts +1 -0
- package/dist/atoms/types/index.d.ts.map +1 -1
- package/dist/atoms/types/navigation.d.ts +1 -1
- package/dist/atoms/types/navigation.d.ts.map +1 -1
- package/dist/atoms/types/ui-config.d.ts +46 -11
- package/dist/atoms/types/ui-config.d.ts.map +1 -1
- package/dist/atoms/types/ui-metadata.d.ts +103 -0
- package/dist/atoms/types/ui-metadata.d.ts.map +1 -0
- package/dist/atoms/utils/entity-card-mapping.d.ts +105 -0
- package/dist/atoms/utils/entity-card-mapping.d.ts.map +1 -0
- package/dist/atoms/utils/field-detection.d.ts +2 -2
- package/dist/atoms/utils/field-detection.d.ts.map +1 -1
- package/dist/atoms/utils/icon-map.d.ts +48 -0
- package/dist/atoms/utils/icon-map.d.ts.map +1 -1
- package/dist/atoms/utils/index.d.ts +2 -0
- package/dist/atoms/utils/index.d.ts.map +1 -1
- package/dist/atoms/utils/ui-mapping.d.ts +9 -3
- package/dist/atoms/utils/ui-mapping.d.ts.map +1 -1
- package/dist/features/auth/components/ProtectedRoute.d.ts +3 -1
- package/dist/features/auth/components/ProtectedRoute.d.ts.map +1 -1
- package/dist/features/auth/hooks/useAuth.d.ts.map +1 -1
- package/dist/features/auth/providers/NoAuthProvider.d.ts +17 -0
- package/dist/features/auth/providers/NoAuthProvider.d.ts.map +1 -0
- package/dist/features/auth/providers/index.d.ts +1 -0
- package/dist/features/auth/providers/index.d.ts.map +1 -1
- package/dist/frontend-patterns.css +1 -4554
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +8793 -18275
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +8790 -18271
- package/dist/index.js.map +1 -1
- package/dist/molecules/layout/AppHeader/AppHeader.d.ts.map +1 -1
- package/dist/molecules/layout/BulkSelectionBar.d.ts +14 -2
- package/dist/molecules/layout/BulkSelectionBar.d.ts.map +1 -1
- package/dist/molecules/layout/FieldGrid/FieldGrid.d.ts +61 -0
- package/dist/molecules/layout/FieldGrid/FieldGrid.d.ts.map +1 -0
- package/dist/molecules/layout/FieldGrid/index.d.ts +2 -0
- package/dist/molecules/layout/FieldGrid/index.d.ts.map +1 -0
- package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts +37 -0
- package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts.map +1 -0
- package/dist/molecules/layout/ListToolbar/index.d.ts +2 -0
- package/dist/molecules/layout/ListToolbar/index.d.ts.map +1 -0
- package/dist/molecules/layout/PageTitle/PageTitle.d.ts +17 -0
- package/dist/molecules/layout/PageTitle/PageTitle.d.ts.map +1 -0
- package/dist/molecules/layout/PageTitle/index.d.ts +2 -0
- package/dist/molecules/layout/PageTitle/index.d.ts.map +1 -0
- package/dist/molecules/layout/index.d.ts +3 -0
- package/dist/molecules/layout/index.d.ts.map +1 -1
- package/dist/molecules/layout/navigation-context.d.ts.map +1 -1
- package/dist/sync/EntityStoreProvider.d.ts +35 -0
- package/dist/sync/EntityStoreProvider.d.ts.map +1 -0
- package/dist/sync/createEntityHooks.d.ts +29 -0
- package/dist/sync/createEntityHooks.d.ts.map +1 -0
- package/dist/sync/createStore.d.ts +65 -0
- package/dist/sync/createStore.d.ts.map +1 -0
- package/dist/sync/index.d.ts +6 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/types.d.ts +383 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/templates/ListPageTemplate.d.ts +21 -0
- package/dist/templates/ListPageTemplate.d.ts.map +1 -0
- package/dist/templates/admin/AdminCRUDTemplate.d.ts.map +1 -1
- package/dist/templates/factory.d.ts +11 -0
- package/dist/templates/factory.d.ts.map +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/package.json +11 -7
- package/cli/commands/generate-hooks.ts +0 -316
- package/cli/commands/init.ts +0 -33
- package/cli/commands/scaffold.ts +0 -224
- package/cli/index.ts +0 -122
- package/cli/src/codegen/openapi/client-generator.js +0 -659
- package/cli/src/codegen/openapi/hook-generator.js +0 -725
- package/cli/src/codegen/openapi/parser.js +0 -274
- package/cli/src/codegen/openapi/type-generator.js +0 -329
- package/dist/codegen/openapi/bulk-types.d.ts +0 -142
- package/dist/codegen/openapi/bulk-types.d.ts.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useExpandedRows
|
|
3
|
+
*
|
|
4
|
+
* State management hook for expandable table rows.
|
|
5
|
+
* Tracks which row IDs are expanded and provides toggle/set helpers.
|
|
6
|
+
*/
|
|
7
|
+
export interface UseExpandedRowsOptions {
|
|
8
|
+
/** Initially expanded row IDs */
|
|
9
|
+
defaultExpanded?: string[];
|
|
10
|
+
/** Allow multiple rows to be expanded simultaneously */
|
|
11
|
+
allowMultiple?: boolean;
|
|
12
|
+
/** Callback when expansion state changes */
|
|
13
|
+
onExpandChange?: (expandedIds: Set<string>) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface UseExpandedRowsReturn {
|
|
16
|
+
/** Set of currently expanded row IDs */
|
|
17
|
+
expandedIds: Set<string>;
|
|
18
|
+
/** Check if a specific row is expanded */
|
|
19
|
+
isExpanded: (id: string) => boolean;
|
|
20
|
+
/** Toggle expansion state of a row */
|
|
21
|
+
toggleExpand: (id: string) => void;
|
|
22
|
+
/** Expand a specific row */
|
|
23
|
+
expand: (id: string) => void;
|
|
24
|
+
/** Collapse a specific row */
|
|
25
|
+
collapse: (id: string) => void;
|
|
26
|
+
/** Expand all provided IDs */
|
|
27
|
+
expandAll: (ids: string[]) => void;
|
|
28
|
+
/** Collapse all rows */
|
|
29
|
+
collapseAll: () => void;
|
|
30
|
+
/** Set expanded IDs directly */
|
|
31
|
+
setExpandedIds: (ids: Set<string>) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Hook for managing expandable row state.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Single expansion (accordion-style)
|
|
39
|
+
* const { expandedIds, toggleExpand, isExpanded } = useExpandedRows()
|
|
40
|
+
*
|
|
41
|
+
* // Multiple expansion allowed
|
|
42
|
+
* const { expandedIds, toggleExpand } = useExpandedRows({
|
|
43
|
+
* allowMultiple: true,
|
|
44
|
+
* defaultExpanded: ['row-1'],
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* // With change callback
|
|
48
|
+
* const { expandedIds, toggleExpand } = useExpandedRows({
|
|
49
|
+
* onExpandChange: (ids) => console.log('Expanded:', ids),
|
|
50
|
+
* })
|
|
51
|
+
*
|
|
52
|
+
* // Usage with DataTable
|
|
53
|
+
* <DataTable
|
|
54
|
+
* data={items}
|
|
55
|
+
* columns={columns}
|
|
56
|
+
* expansion={{
|
|
57
|
+
* expandedIds,
|
|
58
|
+
* onChange: setExpandedIds,
|
|
59
|
+
* renderContent: (row) => <DetailPanel item={row} />,
|
|
60
|
+
* }}
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function useExpandedRows(options?: UseExpandedRowsOptions): UseExpandedRowsReturn;
|
|
65
|
+
export default useExpandedRows;
|
|
66
|
+
//# sourceMappingURL=useExpandedRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExpandedRows.d.ts","sourceRoot":"","sources":["../../../src/atoms/hooks/useExpandedRows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,wDAAwD;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,0CAA0C;IAC1C,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,sCAAsC;IACtC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,4BAA4B;IAC5B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,8BAA8B;IAC9B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,8BAA8B;IAC9B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,wBAAwB;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,gCAAgC;IAChC,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,GAAE,sBAA2B,GACnC,qBAAqB,CA2FvB;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ColumnMetadataResponse } from "../types/ui-metadata";
|
|
2
|
+
interface UseFieldMetadataOptions {
|
|
3
|
+
entity: string;
|
|
4
|
+
view?: "list" | "detail" | "form";
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetch field metadata from backend for dynamic UI rendering.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { data, isLoading } = useFieldMetadata({ entity: "accounts" });
|
|
13
|
+
* // data.columns contains ColumnMetadata[]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function useFieldMetadata({ entity, view, enabled, }: UseFieldMetadataOptions): import("@tanstack/react-query").UseQueryResult<ColumnMetadataResponse, Error>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useFieldMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldMetadata.d.ts","sourceRoot":"","sources":["../../../src/atoms/hooks/useFieldMetadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,IAAa,EACb,OAAc,GACf,EAAE,uBAAuB,iFAazB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface OnlineStatus {
|
|
2
|
+
/** Whether the browser reports being online */
|
|
3
|
+
isOnline: boolean;
|
|
4
|
+
/** Whether we've confirmed backend connectivity (last successful request) */
|
|
5
|
+
isBackendReachable: boolean;
|
|
6
|
+
/** Timestamp of last successful backend request */
|
|
7
|
+
lastBackendContact: number | null;
|
|
8
|
+
/** Manually check backend connectivity */
|
|
9
|
+
checkBackend: () => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Hook to track online/offline status.
|
|
13
|
+
* Combines browser's navigator.onLine with actual backend reachability.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useOnlineStatus(healthEndpoint?: string): OnlineStatus;
|
|
16
|
+
//# sourceMappingURL=useOnlineStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnlineStatus.d.ts","sourceRoot":"","sources":["../../../src/atoms/hooks/useOnlineStatus.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mDAAmD;IACnD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,0CAA0C;IAC1C,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAiErE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ColumnMetadata } from "../types/ui-metadata";
|
|
2
|
+
export type TableViewMode = "full" | "compact" | "cards";
|
|
3
|
+
export interface UseResponsiveTableOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Column metadata - when provided, enables smart width-based switching
|
|
6
|
+
* Uses UIType to calculate expected column widths
|
|
7
|
+
*/
|
|
8
|
+
columns?: ColumnMetadata[];
|
|
9
|
+
/**
|
|
10
|
+
* Initial view mode
|
|
11
|
+
* @default "full"
|
|
12
|
+
*/
|
|
13
|
+
initialView?: TableViewMode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to enable automatic view switching based on overflow
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
autoSwitch?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Minimum width (px) below which to always show cards
|
|
21
|
+
* This is a fallback for very narrow containers
|
|
22
|
+
* @default 400
|
|
23
|
+
*/
|
|
24
|
+
minWidthForCompact?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Debounce delay (ms) for resize/overflow checks
|
|
27
|
+
* @default 100
|
|
28
|
+
*/
|
|
29
|
+
debounceMs?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Callback when view mode changes
|
|
32
|
+
*/
|
|
33
|
+
onViewChange?: (view: TableViewMode) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface UseResponsiveTableResult {
|
|
36
|
+
/**
|
|
37
|
+
* Current view mode (full, compact, or cards)
|
|
38
|
+
*/
|
|
39
|
+
viewMode: TableViewMode;
|
|
40
|
+
/**
|
|
41
|
+
* Manually set the view mode (disables auto-switching)
|
|
42
|
+
*/
|
|
43
|
+
setViewMode: (mode: TableViewMode) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Re-enable auto-switching after manual override
|
|
46
|
+
*/
|
|
47
|
+
enableAutoSwitch: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether auto-switching is currently enabled
|
|
50
|
+
*/
|
|
51
|
+
isAutoSwitching: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Ref to attach to the container for width-based calculations
|
|
54
|
+
* Only need one ref when using columns-based calculation
|
|
55
|
+
*/
|
|
56
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Use containerRef instead. Kept for backward compatibility.
|
|
59
|
+
*/
|
|
60
|
+
fullTableRef: React.RefObject<HTMLDivElement | null>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use containerRef instead. Kept for backward compatibility.
|
|
63
|
+
*/
|
|
64
|
+
compactTableRef: React.RefObject<HTMLDivElement | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Derived compact columns (filtered by importance, with compact labels)
|
|
67
|
+
* Only available when columns option is provided
|
|
68
|
+
*/
|
|
69
|
+
compactColumns: ColumnMetadata[] | null;
|
|
70
|
+
/**
|
|
71
|
+
* Calculated widths for debugging and custom logic
|
|
72
|
+
*/
|
|
73
|
+
calculatedWidths: {
|
|
74
|
+
full: number;
|
|
75
|
+
compact: number;
|
|
76
|
+
container: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Current overflow state for debugging
|
|
80
|
+
*/
|
|
81
|
+
overflowState: {
|
|
82
|
+
fullOverflows: boolean;
|
|
83
|
+
compactOverflows: boolean;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Hook for responsive table view switching.
|
|
88
|
+
*
|
|
89
|
+
* Two modes of operation:
|
|
90
|
+
* 1. Column-based (recommended): Pass `columns` option with ColumnMetadata[].
|
|
91
|
+
* Uses UIType to calculate expected widths and switch modes without DOM measurement.
|
|
92
|
+
* 2. Legacy DOM-based: No columns provided. Requires refs on both table containers
|
|
93
|
+
* and measures actual overflow. Less efficient but works without metadata.
|
|
94
|
+
*
|
|
95
|
+
* View hierarchy: full → compact → cards
|
|
96
|
+
*
|
|
97
|
+
* @example Column-based (recommended)
|
|
98
|
+
* ```tsx
|
|
99
|
+
* const { viewMode, compactColumns, containerRef } = useResponsiveTable({
|
|
100
|
+
* columns: orderColumns, // ColumnMetadata[]
|
|
101
|
+
* });
|
|
102
|
+
*
|
|
103
|
+
* return (
|
|
104
|
+
* <div ref={containerRef}>
|
|
105
|
+
* {viewMode === 'cards' ? (
|
|
106
|
+
* <CardList data={orders} />
|
|
107
|
+
* ) : (
|
|
108
|
+
* <DataTable
|
|
109
|
+
* data={orders}
|
|
110
|
+
* columns={viewMode === 'compact' ? compactColumns : orderColumns}
|
|
111
|
+
* />
|
|
112
|
+
* )}
|
|
113
|
+
* </div>
|
|
114
|
+
* );
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare function useResponsiveTable(options?: UseResponsiveTableOptions): UseResponsiveTableResult;
|
|
118
|
+
/**
|
|
119
|
+
* Simplified hook that just reports if a container has overflow
|
|
120
|
+
* Useful for custom overflow detection logic
|
|
121
|
+
*/
|
|
122
|
+
export declare function useOverflowDetection(ref: React.RefObject<HTMLElement>): boolean;
|
|
123
|
+
//# sourceMappingURL=useResponsiveTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsiveTable.d.ts","sourceRoot":"","sources":["../../../src/atoms/hooks/useResponsiveTable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQ3D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B;;;OAGG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAE5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,UAAU,CAAC,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DataTable with support for:
|
|
5
|
+
* - Per-column filters
|
|
6
|
+
* - Quick filters (faceted)
|
|
7
|
+
* - Client-side filtering
|
|
8
|
+
* - Server-side filtering (callback mode)
|
|
9
|
+
* - Controlled and uncontrolled usage
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Client-side filtering (uncontrolled)
|
|
13
|
+
* const { filteredData, setColumnFilter, clearAllFilters } = useTableFilters({
|
|
14
|
+
* data: transactions,
|
|
15
|
+
* columns: transactionColumns,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Server-side filtering (controlled)
|
|
20
|
+
* const { filterState, setColumnFilter } = useTableFilters({
|
|
21
|
+
* data: transactions,
|
|
22
|
+
* columns: transactionColumns,
|
|
23
|
+
* serverSide: true,
|
|
24
|
+
* onFiltersChange: (filters) => refetch({ filters }),
|
|
25
|
+
* });
|
|
26
|
+
*/
|
|
27
|
+
import type { FilterState, ColumnFilter, QuickFilterValue, ColumnFilterConfig } from "../components/data/DataTable/DataTable.filters";
|
|
28
|
+
/**
|
|
29
|
+
* Column definition with optional filter config.
|
|
30
|
+
* Matches the Column type from DataTable but with filter support.
|
|
31
|
+
*/
|
|
32
|
+
export interface FilterableColumn<T> {
|
|
33
|
+
key: string;
|
|
34
|
+
header: string | React.ReactNode;
|
|
35
|
+
/** Filter configuration - true for auto-detect, object for explicit config, false to disable */
|
|
36
|
+
filter?: boolean | ColumnFilterConfig;
|
|
37
|
+
/** Whether column is filterable via global search */
|
|
38
|
+
filterable?: boolean;
|
|
39
|
+
/** Field type for auto-detecting filter type */
|
|
40
|
+
type?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface UseTableFiltersOptions<T> {
|
|
43
|
+
/** Data to filter (for client-side filtering) */
|
|
44
|
+
data: T[];
|
|
45
|
+
/** Column definitions with filter configs */
|
|
46
|
+
columns: FilterableColumn<T>[];
|
|
47
|
+
/** Initial filter state */
|
|
48
|
+
initialFilters?: FilterState;
|
|
49
|
+
/** Controlled filter state */
|
|
50
|
+
filterState?: FilterState;
|
|
51
|
+
/** Server-side mode - don't filter locally, just manage state */
|
|
52
|
+
serverSide?: boolean;
|
|
53
|
+
/** Callback when filters change */
|
|
54
|
+
onFiltersChange?: (filters: FilterState) => void;
|
|
55
|
+
/** Debounce delay for filter changes (ms) */
|
|
56
|
+
debounceMs?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface UseTableFiltersReturn<T> {
|
|
59
|
+
/** Current filter state */
|
|
60
|
+
filterState: FilterState;
|
|
61
|
+
/** Filtered data (client-side only, empty array if serverSide=true) */
|
|
62
|
+
filteredData: T[];
|
|
63
|
+
/** Set a column filter */
|
|
64
|
+
setColumnFilter: (columnKey: string, filter: ColumnFilter | null) => void;
|
|
65
|
+
/** Set multiple column filters at once */
|
|
66
|
+
setColumnFilters: (filters: Record<string, ColumnFilter>) => void;
|
|
67
|
+
/** Clear a specific column filter */
|
|
68
|
+
clearColumnFilter: (columnKey: string) => void;
|
|
69
|
+
/** Clear all column filters */
|
|
70
|
+
clearAllColumnFilters: () => void;
|
|
71
|
+
/** Add a quick filter */
|
|
72
|
+
addQuickFilter: (filter: QuickFilterValue) => void;
|
|
73
|
+
/** Remove a quick filter by ID */
|
|
74
|
+
removeQuickFilter: (filterId: string) => void;
|
|
75
|
+
/** Clear all quick filters */
|
|
76
|
+
clearAllQuickFilters: () => void;
|
|
77
|
+
/** Clear all filters (column and quick) */
|
|
78
|
+
clearAllFilters: () => void;
|
|
79
|
+
/** Check if any filters are active */
|
|
80
|
+
hasActiveFilters: boolean;
|
|
81
|
+
/** Active filter count */
|
|
82
|
+
activeFilterCount: number;
|
|
83
|
+
/** Get filter for a specific column */
|
|
84
|
+
getColumnFilter: (columnKey: string) => ColumnFilter | undefined;
|
|
85
|
+
/** Get filter config for a column */
|
|
86
|
+
getFilterConfig: (columnKey: string) => ColumnFilterConfig | undefined;
|
|
87
|
+
/** Check if a column has filter support */
|
|
88
|
+
isFilterable: (columnKey: string) => boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare function useTableFilters<T extends Record<string, unknown>>(options: UseTableFiltersOptions<T>): UseTableFiltersReturn<T>;
|
|
91
|
+
import * as React from "react";
|
|
92
|
+
//# sourceMappingURL=useTableFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableFilters.d.ts","sourceRoot":"","sources":["../../../src/atoms/hooks/useTableFilters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAInB,MAAM,gDAAgD,CAAC;AAWxD;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,gGAAgG;IAChG,MAAM,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;IACtC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,iDAAiD;IACjD,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,6CAA6C;IAC7C,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,2BAA2B;IAC3B,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IAC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GD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC"}
|
package/dist/atoms/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/atoms/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/atoms/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAKnC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare const Sheet: React.FC<SheetPrimitive.DialogProps>;
|
|
4
|
+
declare const SheetTrigger: React.ForwardRefExoticComponent<SheetPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
7
|
+
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content> {
|
|
9
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
10
|
+
}
|
|
11
|
+
declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const SheetHeader: {
|
|
13
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
declare const SheetFooter: {
|
|
17
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
declare const SheetTitle: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
21
|
+
declare const SheetDescription: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
23
|
+
//# sourceMappingURL=sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/atoms/primitives/sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AAIzD,QAAA,MAAM,KAAK,sCAAsB,CAAC;AAClC,QAAA,MAAM,YAAY,6GAAyB,CAAC;AAC5C,QAAA,MAAM,UAAU,2GAAuB,CAAC;AACxC,QAAA,MAAM,WAAW,4CAAwB,CAAC;AAE1C,QAAA,MAAM,YAAY,6JAYhB,CAAC;AAUH,UAAU,iBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC;IACrE,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CAC5C;AAED,QAAA,MAAM,YAAY,0FAsBhB,CAAC;AAGH,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAC;AAGF,QAAA,MAAM,WAAW;8BAGd,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAQtC,CAAC;AAGF,QAAA,MAAM,UAAU,mKASd,CAAC;AAGH,QAAA,MAAM,gBAAgB,6KASpB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/atoms/primitives/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,QAAA,MAAM,KAAK,iHAWT,CAAC;AAGH,QAAA,MAAM,WAAW,+HAKf,CAAC;AAGH,QAAA,MAAM,SAAS,+HASb,CAAC;AAGH,QAAA,MAAM,WAAW,+HAYf,CAAC;AAGH,QAAA,MAAM,QAAQ,uHAYZ,CAAC;AAGH,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/atoms/primitives/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,QAAA,MAAM,KAAK,iHAWT,CAAC;AAGH,QAAA,MAAM,WAAW,+HAKf,CAAC;AAGH,QAAA,MAAM,SAAS,+HASb,CAAC;AAGH,QAAA,MAAM,WAAW,+HAYf,CAAC;AAGH,QAAA,MAAM,QAAQ,uHAYZ,CAAC;AAGH,QAAA,MAAM,SAAS,2HAcb,CAAC;AAGH,QAAA,MAAM,SAAS,2HAcb,CAAC;AAGH,QAAA,MAAM,YAAY,+HAShB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC"}
|
|
@@ -12,9 +12,14 @@ interface AuthService {
|
|
|
12
12
|
shouldRefreshToken(): boolean;
|
|
13
13
|
refreshToken(): Promise<void>;
|
|
14
14
|
clearAuth(): void;
|
|
15
|
+
onAuthError?: (error: {
|
|
16
|
+
status: number;
|
|
17
|
+
message?: string;
|
|
18
|
+
}) => boolean | void;
|
|
15
19
|
}
|
|
16
|
-
export declare function setGlobalAuthService(authService: AuthService): void;
|
|
17
|
-
declare
|
|
20
|
+
export declare function setGlobalAuthService(authService: AuthService | null): void;
|
|
21
|
+
export declare function getGlobalAuthService(): AuthService | null;
|
|
22
|
+
export declare class ApiClient {
|
|
18
23
|
private instance;
|
|
19
24
|
constructor(config?: ApiClientConfig);
|
|
20
25
|
private setupInterceptors;
|
|
@@ -24,6 +29,11 @@ declare class ApiClient {
|
|
|
24
29
|
patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
25
30
|
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
26
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a new API client instance with the given configuration.
|
|
34
|
+
* For library use, always pass baseURL explicitly rather than relying on env vars.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createApiClient(config?: ApiClientConfig): ApiClient;
|
|
27
37
|
export declare const apiClient: ApiClient;
|
|
28
38
|
export default apiClient;
|
|
29
39
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/atoms/services/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,KAAK,kBAAkB,EAExB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/atoms/services/api/client.ts"],"names":[],"mappings":"AAAA,OAA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C,CAAC;IASP,KAAK,CAAC,CAAC,EACX,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IASP,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;CAItE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,SAAS,CAEvE;AAID,eAAO,MAAM,SAAS,WAAkB,CAAC;AACzC,eAAe,SAAS,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { AuthConfig, BaseUser, LoginCredentials, TokenData } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical token key used across Pattern Stack.
|
|
4
|
+
* Exported for use by sync-patterns and generated code.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AUTH_TOKEN_KEY = "auth_token";
|
|
2
7
|
export declare class AuthService<T extends BaseUser = BaseUser> {
|
|
3
8
|
private config;
|
|
9
|
+
private apiClient;
|
|
4
10
|
private refreshPromise;
|
|
11
|
+
private endpoints;
|
|
5
12
|
constructor(config: AuthConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Get the auth mode
|
|
15
|
+
*/
|
|
16
|
+
get mode(): import("../types").AuthMode;
|
|
6
17
|
private getStorageKey;
|
|
7
18
|
private setItem;
|
|
8
19
|
private getItem;
|
|
@@ -20,5 +31,9 @@ export declare class AuthService<T extends BaseUser = BaseUser> {
|
|
|
20
31
|
shouldRefreshToken(): boolean;
|
|
21
32
|
getCurrentUser(): Promise<T | null>;
|
|
22
33
|
logout(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the configured onAuthError handler
|
|
36
|
+
*/
|
|
37
|
+
get onAuthError(): import("../types").AuthErrorHandler;
|
|
23
38
|
}
|
|
24
39
|
//# sourceMappingURL=auth-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-service.d.ts","sourceRoot":"","sources":["../../../src/atoms/services/auth-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,
|
|
1
|
+
{"version":3,"file":"auth-service.d.ts","sourceRoot":"","sources":["../../../src/atoms/services/auth-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACV,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,cAAc,eAAe,CAAC;AAgC3C,qBAAa,WAAW,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IACpD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,SAAS,CAAgB;gBAErB,MAAM,EAAE,UAAU;IAmB9B;;OAEG;IACH,IAAI,IAAI,gCAEP;IAED,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,UAAU;IAclB,YAAY,IAAI,SAAS,GAAG,IAAI;IAchC,OAAO,CAAC,YAAY;IAUpB,aAAa,IAAI,CAAC,GAAG,IAAI;IAYzB,OAAO,CAAC,aAAa;IAIrB,SAAS,IAAI,IAAI;IAOX,KAAK,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC;IAiDhD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBrB,mBAAmB;IAiDjC,OAAO,CAAC,oBAAoB;IAc5B,cAAc,IAAI,OAAO;IAOzB,kBAAkB,IAAI,OAAO;IAQvB,cAAc,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAWnC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAe7B;;OAEG;IACH,IAAI,WAAW,wCAEd;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { apiClient, setGlobalAuthService } from "./api/client";
|
|
2
|
-
export { AuthService } from "./auth-service";
|
|
1
|
+
export { apiClient, setGlobalAuthService, getGlobalAuthService } from "./api/client";
|
|
2
|
+
export { AuthService, AUTH_TOKEN_KEY } from "./auth-service";
|
|
3
3
|
export * from "./health";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7D,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Configuration
|
|
3
|
+
*
|
|
4
|
+
* Centralized sizing and formatting configuration for data tables.
|
|
5
|
+
* Maps UIType to column widths and defines compact mode behavior.
|
|
6
|
+
*
|
|
7
|
+
* Used by useResponsiveTable hook and DataTable component to calculate
|
|
8
|
+
* when to switch between full → compact → cards views.
|
|
9
|
+
*/
|
|
10
|
+
import type { UIType } from "../../types/ui-config";
|
|
11
|
+
/**
|
|
12
|
+
* Default column widths (px) by UIType
|
|
13
|
+
* These are baseline widths - components may adjust based on content/format
|
|
14
|
+
*/
|
|
15
|
+
export declare const COLUMN_WIDTHS: Record<UIType, number>;
|
|
16
|
+
/**
|
|
17
|
+
* Compact column widths - for dense table views
|
|
18
|
+
* Only types that differ from full width are listed
|
|
19
|
+
*/
|
|
20
|
+
export declare const COMPACT_COLUMN_WIDTHS: Partial<Record<UIType, number>>;
|
|
21
|
+
/**
|
|
22
|
+
* Compact formatter identifiers by UIType
|
|
23
|
+
* Maps to formatting functions in field renderers
|
|
24
|
+
*/
|
|
25
|
+
export declare const COMPACT_FORMATTERS: Partial<Record<UIType, string>>;
|
|
26
|
+
/**
|
|
27
|
+
* Compact label transformations
|
|
28
|
+
* Shorter header labels for compact mode
|
|
29
|
+
*/
|
|
30
|
+
export declare const COMPACT_LABELS: Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* Table responsive breakpoints
|
|
33
|
+
*/
|
|
34
|
+
export declare const TABLE_BREAKPOINTS: {
|
|
35
|
+
/** Below this width (px), always use cards */
|
|
36
|
+
readonly minForTable: 400;
|
|
37
|
+
/** Buffer (px) to add when calculating if columns fit */
|
|
38
|
+
readonly widthBuffer: 50;
|
|
39
|
+
/** Minimum columns to show in compact mode */
|
|
40
|
+
readonly minCompactColumns: 3;
|
|
41
|
+
/** Maximum columns in compact mode */
|
|
42
|
+
readonly maxCompactColumns: 6;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Importance-based column visibility
|
|
46
|
+
* Which importance levels to include in each mode
|
|
47
|
+
* Supports both semantic (primary/secondary/tertiary) and legacy (critical/high/medium/low/minimal) values
|
|
48
|
+
*/
|
|
49
|
+
export declare const IMPORTANCE_VISIBILITY: {
|
|
50
|
+
readonly full: readonly ["primary", "secondary", "tertiary", "critical", "high", "medium", "low", "minimal"];
|
|
51
|
+
readonly compact: readonly ["primary", "secondary", "critical", "high", "medium"];
|
|
52
|
+
readonly cards: readonly ["primary", "critical", "high"];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Get width for a column based on type and mode
|
|
56
|
+
*/
|
|
57
|
+
export declare function getColumnWidth(type: UIType, mode?: "full" | "compact"): number;
|
|
58
|
+
/**
|
|
59
|
+
* Calculate total table width from column types
|
|
60
|
+
*/
|
|
61
|
+
export declare function calculateTableWidth(columns: Array<{
|
|
62
|
+
type: UIType;
|
|
63
|
+
}>, mode?: "full" | "compact"): number;
|
|
64
|
+
/**
|
|
65
|
+
* Get compact label for a field name
|
|
66
|
+
*/
|
|
67
|
+
export declare function getCompactLabel(fieldName: string, originalLabel: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Get formatter for compact mode
|
|
70
|
+
*/
|
|
71
|
+
export declare function getCompactFormatter(type: UIType): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Determine table mode based on container width and columns
|
|
74
|
+
*/
|
|
75
|
+
export declare function determineTableMode(containerWidth: number, columns: Array<{
|
|
76
|
+
type: UIType;
|
|
77
|
+
importance?: string;
|
|
78
|
+
}>): "full" | "compact" | "cards";
|
|
79
|
+
//# sourceMappingURL=table-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-config.d.ts","sourceRoot":"","sources":["../../../../src/atoms/shared/config/table-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkCvC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQrD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsBxC,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,8CAA8C;;IAE9C,yDAAyD;;IAEzD,8CAA8C;;IAE9C,sCAAsC;;CAE9B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAMX;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,GAAG,SAAkB,GAChC,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAChC,IAAI,GAAE,MAAM,GAAG,SAAkB,GAChC,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAGhF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,MAAM,GAAG,SAAS,GAAG,OAAO,CA2B9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/shared/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/shared/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
|