@tailor-platform/app-shell 0.21.0 → 0.22.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.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import { AuthState } from '@tailor-platform/auth-browser-client';
2
+ import { ClassProp } from 'class-variance-authority/types';
2
3
  import { DocumentNode } from 'graphql';
3
4
  import { JSX } from 'react/jsx-runtime';
4
5
  import { Link } from 'react-router';
5
6
  import { LoaderFunctionArgs } from 'react-router';
6
7
  import { Params } from 'react-router';
8
+ import * as React_2 from 'react';
7
9
  import { ReactNode } from 'react';
8
10
  import { useLocation } from 'react-router';
9
11
  import { useNavigate } from 'react-router';
10
12
  import { useParams } from 'react-router';
11
13
  import { useRouteError } from 'react-router';
12
14
  import { useSearchParams } from 'react-router';
15
+ import { VariantProps } from 'class-variance-authority';
13
16
 
14
17
  /**
15
18
  * Context provided to access control functions
@@ -241,6 +244,25 @@ declare type AuthProviderProps = {
241
244
  export declare interface AuthRegister {
242
245
  }
243
246
 
247
+ export declare function Badge({ className, variant, children, ...props }: BadgeProps): JSX.Element;
248
+
249
+ export declare interface BadgeProps extends React_2.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
250
+ }
251
+
252
+ export declare const badgeVariants: (props?: ({
253
+ variant?: "default" | "error" | "success" | "warning" | "neutral" | "outline-success" | "outline-warning" | "outline-error" | "outline-info" | "outline-neutral" | null | undefined;
254
+ } & ClassProp) | undefined) => string;
255
+
256
+ /**
257
+ * Badge variant mapping for automatic status coloring
258
+ */
259
+ declare type BadgeVariantType = "default" | "success" | "warning" | "error" | "neutral" | "outline-success" | "outline-warning" | "outline-error" | "outline-info" | "outline-neutral";
260
+
261
+ /**
262
+ * Column layout options for the card
263
+ */
264
+ declare type Columns = 3 | 4;
265
+
244
266
  /**
245
267
  * CommandPalette component that uses navigation items with access control.
246
268
  * Renders a searchable command palette UI triggered by Cmd+K / Ctrl+K.
@@ -285,6 +307,11 @@ declare type CommonProps = {
285
307
  accessControl?: AccessControl;
286
308
  };
287
309
 
310
+ /**
311
+ * Date format options
312
+ */
313
+ declare type DateFormat = "short" | "medium" | "long" | "relative";
314
+
288
315
  export declare const DefaultSidebar: (props: DefaultSidebarProps) => JSX.Element;
289
316
 
290
317
  declare type DefaultSidebarProps = {
@@ -481,10 +508,55 @@ declare type DefineResourceProps = CommonProps & ReactResourceProps & {
481
508
  errorBoundary?: ErrorBoundaryComponent;
482
509
  };
483
510
 
511
+ /**
512
+ * DescriptionCard - ERP document display component
513
+ *
514
+ * Renders structured key-value information with automatic layout.
515
+ * Use { type: "divider" } in the fields array to add dividers between sections.
516
+ *
517
+ * @example
518
+ * ```tsx
519
+ * <DescriptionCard
520
+ * data={order}
521
+ * title="Order Summary"
522
+ * fields={[
523
+ * { key: "status", label: "Status", type: "badge", meta: { badgeVariantMap: { CONFIRMED: "success" } } },
524
+ * { key: "orderNumber", label: "Order #", meta: { copyable: true } },
525
+ * { type: "divider" },
526
+ * { key: "total", label: "Total", type: "money" },
527
+ * ]}
528
+ * />
529
+ * ```
530
+ */
531
+ export declare function DescriptionCard({ data, title, fields, columns, className, headerAction, }: DescriptionCardProps): JSX.Element;
532
+
533
+ /**
534
+ * Props for the DescriptionCard component
535
+ */
536
+ export declare interface DescriptionCardProps {
537
+ /** Raw backend data object */
538
+ data: Record<string, unknown>;
539
+ /** Card title */
540
+ title: string;
541
+ /** Ordered list of field definitions (use { type: "divider" } for dividers) */
542
+ fields: FieldConfig[];
543
+ /** Number of columns on desktop (3 or 4) */
544
+ columns?: Columns;
545
+ /** Additional CSS classes */
546
+ className?: string;
547
+ /** Header action slot (e.g., edit button) */
548
+ headerAction?: React.ReactNode;
549
+ }
550
+
484
551
  declare type DynamicLocales<Def extends Record<string, LabelValue>> = {
485
552
  [locale: string]: Partial<LabelDefinition<Def>> | undefined;
486
553
  };
487
554
 
555
+ /**
556
+ * Behavior when a field value is empty/null/undefined
557
+ */
558
+ declare type EmptyBehavior = "dash" | "hide";
559
+
488
560
  /**
489
561
  * Error boundary element type for route error handling.
490
562
  *
@@ -508,6 +580,65 @@ declare type DynamicLocales<Def extends Record<string, LabelValue>> = {
508
580
  */
509
581
  export declare type ErrorBoundaryComponent = ReactNode;
510
582
 
583
+ /**
584
+ * A field configuration - either a divider or a field definition
585
+ */
586
+ declare type FieldConfig = FieldDivider | FieldDefinition;
587
+
588
+ /**
589
+ * Field definition - renders a key-value pair
590
+ */
591
+ declare interface FieldDefinition {
592
+ /** Field type determines rendering (defaults to "text") */
593
+ type?: FieldType;
594
+ /** Path to the value in the data object (supports dot notation) */
595
+ key: string;
596
+ /** Display label for the field */
597
+ label: string;
598
+ /** Type-specific metadata */
599
+ meta?: FieldMeta;
600
+ /** Behavior when value is empty (defaults to "dash") */
601
+ emptyBehavior?: EmptyBehavior;
602
+ }
603
+
604
+ /**
605
+ * Divider - creates a horizontal line between sections
606
+ */
607
+ declare interface FieldDivider {
608
+ type: "divider";
609
+ }
610
+
611
+ /**
612
+ * Metadata for field-specific rendering options
613
+ */
614
+ declare interface FieldMeta {
615
+ /** Show copy button for this field */
616
+ copyable?: boolean;
617
+ /** Map field values to badge variants */
618
+ badgeVariantMap?: Record<string, BadgeVariantType>;
619
+ /** Key path to currency code in data object (for money fields) */
620
+ currencyKey?: string;
621
+ /** Key path to href in data object (for link fields) */
622
+ hrefKey?: string;
623
+ /** Whether the link opens in a new tab */
624
+ external?: boolean;
625
+ /** Date format style */
626
+ dateFormat?: DateFormat;
627
+ /** Key path to reference document ID */
628
+ referenceIdKey?: string;
629
+ /** Base URL pattern for reference links (use {id} as placeholder) */
630
+ referenceUrlPattern?: string;
631
+ /** Tooltip text */
632
+ tooltip?: string;
633
+ /** Truncate text after this many lines (shows tooltip with full text) */
634
+ truncateLines?: number;
635
+ }
636
+
637
+ /**
638
+ * Supported field types for DescriptionCard
639
+ */
640
+ declare type FieldType = "text" | "badge" | "money" | "date" | "link" | "address" | "reference";
641
+
511
642
  export declare type I18nLabels<Def extends Record<string, LabelValue> = Record<string, LabelValue>, L extends string = never> = {
512
643
  en: Def;
513
644
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/app-shell",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./styles": "./dist/app-shell.css",
@@ -24,7 +24,7 @@
24
24
  "@radix-ui/react-dialog": "^1.1.15",
25
25
  "@radix-ui/react-dropdown-menu": "^2.1.16",
26
26
  "@radix-ui/react-label": "^2.1.8",
27
- "@radix-ui/react-navigation-menu": "^1.2.5",
27
+ "@radix-ui/react-navigation-menu": "^1.2.14",
28
28
  "@radix-ui/react-popover": "^1.1.15",
29
29
  "@radix-ui/react-select": "^2.1.6",
30
30
  "@radix-ui/react-separator": "^1.1.8",
@@ -64,7 +64,7 @@
64
64
  "vite": "^7.3.0",
65
65
  "vite-plugin-dts": "^4.5.0",
66
66
  "vite-plugin-externalize-deps": "^0.10.0",
67
- "vite-tsconfig-paths": "^5.1.4",
67
+ "vite-tsconfig-paths": "^6.0.4",
68
68
  "vitest": "^4.0.16"
69
69
  },
70
70
  "scripts": {