@pattern-stack/frontend-patterns 0.2.0-alpha.1 → 0.2.0-alpha.4

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 (57) hide show
  1. package/dist/atoms/components/core/Badge/Badge.d.ts +1 -1
  2. package/dist/atoms/components/data/DataTable/DataTable.d.ts +2 -2
  3. package/dist/atoms/components/data/DataTable/DataTable.d.ts.map +1 -1
  4. package/dist/atoms/components/data/DataTable/DataTable.types.d.ts +29 -4
  5. package/dist/atoms/components/data/DataTable/DataTable.types.d.ts.map +1 -1
  6. package/dist/atoms/components/data/DataTable/index.d.ts +1 -0
  7. package/dist/atoms/components/data/DataTable/index.d.ts.map +1 -1
  8. package/dist/atoms/components/data/index.d.ts +1 -1
  9. package/dist/atoms/components/data/index.d.ts.map +1 -1
  10. package/dist/atoms/hooks/index.d.ts +3 -0
  11. package/dist/atoms/hooks/index.d.ts.map +1 -1
  12. package/dist/atoms/hooks/useEntityData.d.ts +36 -0
  13. package/dist/atoms/hooks/useEntityData.d.ts.map +1 -0
  14. package/dist/atoms/hooks/useFieldMetadata.d.ts +18 -0
  15. package/dist/atoms/hooks/useFieldMetadata.d.ts.map +1 -0
  16. package/dist/atoms/hooks/useResponsiveTable.d.ts +103 -0
  17. package/dist/atoms/hooks/useResponsiveTable.d.ts.map +1 -0
  18. package/dist/atoms/primitives/sheet.d.ts +23 -0
  19. package/dist/atoms/primitives/sheet.d.ts.map +1 -0
  20. package/dist/atoms/services/auth-service.d.ts.map +1 -1
  21. package/dist/atoms/types/auth.d.ts +51 -0
  22. package/dist/atoms/types/auth.d.ts.map +1 -1
  23. package/dist/atoms/types/index.d.ts +1 -0
  24. package/dist/atoms/types/index.d.ts.map +1 -1
  25. package/dist/atoms/types/ui-config.d.ts +35 -11
  26. package/dist/atoms/types/ui-config.d.ts.map +1 -1
  27. package/dist/atoms/types/ui-metadata.d.ts +103 -0
  28. package/dist/atoms/types/ui-metadata.d.ts.map +1 -0
  29. package/dist/atoms/utils/field-detection.d.ts +2 -2
  30. package/dist/atoms/utils/field-detection.d.ts.map +1 -1
  31. package/dist/atoms/utils/ui-mapping.d.ts +9 -3
  32. package/dist/atoms/utils/ui-mapping.d.ts.map +1 -1
  33. package/dist/features/auth/hooks/useAuth.d.ts.map +1 -1
  34. package/dist/frontend-patterns.css +1 -4554
  35. package/dist/index.d.ts +5 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.es.js +4329 -16086
  38. package/dist/index.es.js.map +1 -1
  39. package/dist/index.js +4329 -16085
  40. package/dist/index.js.map +1 -1
  41. package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts +37 -0
  42. package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts.map +1 -0
  43. package/dist/molecules/layout/ListToolbar/index.d.ts +2 -0
  44. package/dist/molecules/layout/ListToolbar/index.d.ts.map +1 -0
  45. package/dist/molecules/layout/PageTitle/PageTitle.d.ts +17 -0
  46. package/dist/molecules/layout/PageTitle/PageTitle.d.ts.map +1 -0
  47. package/dist/molecules/layout/PageTitle/index.d.ts +2 -0
  48. package/dist/molecules/layout/PageTitle/index.d.ts.map +1 -0
  49. package/dist/molecules/layout/index.d.ts +2 -0
  50. package/dist/molecules/layout/index.d.ts.map +1 -1
  51. package/dist/templates/ListPageTemplate.d.ts +21 -0
  52. package/dist/templates/ListPageTemplate.d.ts.map +1 -0
  53. package/dist/templates/admin/AdminCRUDTemplate.d.ts.map +1 -1
  54. package/dist/templates/factory.d.ts.map +1 -1
  55. package/dist/templates/index.d.ts +1 -0
  56. package/dist/templates/index.d.ts.map +1 -1
  57. package/package.json +4 -3
@@ -0,0 +1,103 @@
1
+ /**
2
+ * UI Metadata Types
3
+ *
4
+ * This file contains UI metadata types that mirror the backend OpenAPI specification.
5
+ * These types enable dynamic UI rendering based on field metadata from the API.
6
+ *
7
+ * @mirror backend: pattern_stack/atoms/metadata/schemas.py
8
+ */
9
+ import type { UIType } from "./ui-config";
10
+ /**
11
+ * Business importance levels for field prioritization.
12
+ *
13
+ * Controls field visibility and display priority in responsive layouts.
14
+ * Uses semantic naming (primary/secondary/tertiary) with backward compatible
15
+ * severity levels (critical/high/medium/low/minimal).
16
+ *
17
+ * @mirror backend: pattern_stack/atoms/metadata/schemas.py::SemanticImportance
18
+ *
19
+ * Semantic levels:
20
+ * - primary: Most important, always show
21
+ * - secondary: Supporting information
22
+ * - tertiary: Optional/metadata field (default)
23
+ *
24
+ * Backward compatible severity levels (mapped to semantic):
25
+ * - critical, high -> equivalent to primary
26
+ * - medium -> equivalent to secondary
27
+ * - low, minimal -> equivalent to tertiary
28
+ */
29
+ export type UIImportance = "primary" | "secondary" | "tertiary" | "critical" | "high" | "medium" | "low" | "minimal";
30
+ /**
31
+ * Column/field metadata for dynamic UI rendering.
32
+ *
33
+ * Provides comprehensive metadata about a data field including its type,
34
+ * importance, display properties, and validation rules. Used by DataTable,
35
+ * forms, and other data-driven components to render fields appropriately.
36
+ *
37
+ * @mirror backend: pattern_stack/atoms/metadata/schemas.py::ColumnMetadata
38
+ */
39
+ export interface ColumnMetadata {
40
+ /** Field name/key in the data object */
41
+ field: string;
42
+ /** Human-readable label for display */
43
+ label: string;
44
+ /** Semantic UI type for rendering */
45
+ type: UIType;
46
+ /** Business importance level for prioritization */
47
+ importance: UIImportance;
48
+ /** Logical grouping for field organization */
49
+ group?: string;
50
+ /** Whether the field supports sorting */
51
+ sortable?: boolean;
52
+ /** Whether the field supports filtering */
53
+ filterable?: boolean;
54
+ /** Type-specific formatting options */
55
+ format?: Record<string, unknown>;
56
+ /** Help text describing the field */
57
+ description?: string;
58
+ /** Placeholder text for input fields */
59
+ placeholder?: string;
60
+ /** Whether the field is visible by default */
61
+ visible?: boolean;
62
+ /** Whether the field is required in forms */
63
+ required?: boolean;
64
+ /** Whether the field is computed/read-only */
65
+ computed?: boolean;
66
+ }
67
+ /**
68
+ * API response for column metadata.
69
+ *
70
+ * Returned by metadata endpoints to provide UI rendering information
71
+ * for a specific entity and view type.
72
+ */
73
+ export interface ColumnMetadataResponse {
74
+ /** Array of column metadata definitions */
75
+ columns: ColumnMetadata[];
76
+ /** Entity type these columns belong to */
77
+ entity: string;
78
+ /** View context (list/detail/form) */
79
+ view: "list" | "detail" | "form";
80
+ /** Metadata schema version */
81
+ version: string;
82
+ }
83
+ /**
84
+ * Field group metadata for form sections.
85
+ *
86
+ * Organizes related fields into collapsible sections within forms.
87
+ * Groups provide visual organization and progressive disclosure of form fields.
88
+ */
89
+ export interface FieldGroupMetadata {
90
+ /** Unique group identifier */
91
+ name: string;
92
+ /** Human-readable group label */
93
+ label: string;
94
+ /** Help text describing the group */
95
+ description?: string;
96
+ /** Display order relative to other groups */
97
+ order?: number;
98
+ /** Whether the group can be collapsed */
99
+ collapsible?: boolean;
100
+ /** Whether the group starts collapsed */
101
+ collapsed_default?: boolean;
102
+ }
103
+ //# sourceMappingURL=ui-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-metadata.d.ts","sourceRoot":"","sources":["../../../src/atoms/types/ui-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,MAAM,GACN,QAAQ,GACR,KAAK,GACL,SAAS,CAAC;AAEd;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IAEd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IAEd,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IAEb,mDAAmD;IACnD,UAAU,EAAE,YAAY,CAAC;IAEzB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,OAAO,EAAE,cAAc,EAAE,CAAC;IAE1B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEjC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IAEd,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
@@ -3,11 +3,11 @@
3
3
  *
4
4
  * Automatically detects field types based on name, pattern, and value
5
5
  */
6
- import type { UIFieldType, UIConfig } from "../types/ui-config";
6
+ import type { UIType, UIConfig } from "../types/ui-config";
7
7
  /**
8
8
  * Get field type for a given field name and optional value
9
9
  */
10
- export declare function getFieldType(fieldName: string, value?: unknown, explicitUI?: UIConfig): UIFieldType;
10
+ export declare function getFieldType(fieldName: string, value?: unknown, explicitUI?: UIConfig): UIType;
11
11
  /**
12
12
  * Analyze an array of data to build automatic UI configuration
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"field-detection.d.ts","sourceRoot":"","sources":["../../../src/atoms/utils/field-detection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAuNhE;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,OAAO,EACf,UAAU,CAAC,EAAE,QAAQ,GACpB,WAAW,CA8Bb;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GACvB,QAAQ,CAAC,CAAC,CAAC,CAqBb"}
1
+ {"version":3,"file":"field-detection.d.ts","sourceRoot":"","sources":["../../../src/atoms/utils/field-detection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAuN3D;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,OAAO,EACf,UAAU,CAAC,EAAE,QAAQ,GACpB,MAAM,CA8BR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GACvB,QAAQ,CAAC,CAAC,CAAC,CAqBb"}
@@ -4,10 +4,15 @@
4
4
  * Maps field types to their corresponding UI components
5
5
  */
6
6
  import React from "react";
7
- import type { UIFieldType } from "../types/ui-config";
7
+ import type { UIType, FieldFormat } from "../types/ui-config";
8
8
  import type { FieldRendererRegistry } from "../types/ui-config";
9
- export type { FieldRendererRegistry };
9
+ export type { FieldRendererRegistry, FieldFormat };
10
10
  import type { Breakpoint } from "../config/responsive";
11
+ /**
12
+ * Normalize a type string to canonical UIType.
13
+ * @deprecated Types should match exactly. No normalization needed.
14
+ */
15
+ export declare function normalizeFieldType(type: string): UIType;
11
16
  /**
12
17
  * Default field renderers for each UI type
13
18
  */
@@ -15,5 +20,6 @@ export declare const defaultFieldRenderers: FieldRendererRegistry;
15
20
  /**
16
21
  * Render a field value using the appropriate component
17
22
  */
18
- export declare function renderField(value: unknown, fieldName: string, fieldType: UIFieldType, breakpoint: Breakpoint, item?: Record<string, unknown>, customRenderers?: Partial<FieldRendererRegistry>): React.ReactNode;
23
+ export declare function renderField(value: unknown, fieldName: string, fieldType: string, // Accept string, not just UIFieldType
24
+ breakpoint: Breakpoint, item?: Record<string, unknown>, customRenderers?: Partial<FieldRendererRegistry>, format?: FieldFormat): React.ReactNode;
19
25
  //# sourceMappingURL=ui-mapping.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-mapping.d.ts","sourceRoot":"","sources":["../../../src/atoms/utils/ui-mapping.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,YAAY,EAAE,qBAAqB,EAAE,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAsFvD;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBA0LnC,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,WAAW,EACtB,UAAU,EAAE,UAAU,EACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,eAAe,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAC/C,KAAK,CAAC,SAAS,CAWjB"}
1
+ {"version":3,"file":"ui-mapping.d.ts","sourceRoot":"","sources":["../../../src/atoms/utils/ui-mapping.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQvD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAsJD;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBAoOnC,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EAAE,sCAAsC;AACzD,UAAU,EAAE,UAAU,EACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,eAAe,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAChD,MAAM,CAAC,EAAE,WAAW,GACnB,KAAK,CAAC,SAAS,CAYjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../src/features/auth/hooks/useAuth.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EAGT,MAAM,sBAAsB,CAAC;AAG9B,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,EAC1D,QAAQ,EACR,MAAM,GACP,EAAE,iBAAiB,2CAqLnB"}
1
+ {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../src/features/auth/hooks/useAuth.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EAGT,MAAM,sBAAsB,CAAC;AAG9B,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,EAC1D,QAAQ,EACR,MAAM,GACP,EAAE,iBAAiB,2CAqLnB"}