@tailor-platform/app-shell 0.21.1 → 0.23.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/app-shell.css +1 -1
- package/dist/app-shell.js +1004 -477
- package/dist/index.d.ts +197 -0
- package/package.json +1 -3
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,40 @@ 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
|
+
* Supported column count options
|
|
263
|
+
*/
|
|
264
|
+
declare type ColumnCount = 1 | 2 | 3;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Props for individual Layout.Column component
|
|
268
|
+
*/
|
|
269
|
+
declare interface ColumnProps {
|
|
270
|
+
/** Additional CSS classes */
|
|
271
|
+
className?: string;
|
|
272
|
+
/** Child content */
|
|
273
|
+
children?: ReactNode;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Column layout options for the card
|
|
278
|
+
*/
|
|
279
|
+
declare type Columns = 3 | 4;
|
|
280
|
+
|
|
244
281
|
/**
|
|
245
282
|
* CommandPalette component that uses navigation items with access control.
|
|
246
283
|
* Renders a searchable command palette UI triggered by Cmd+K / Ctrl+K.
|
|
@@ -285,6 +322,11 @@ declare type CommonProps = {
|
|
|
285
322
|
accessControl?: AccessControl;
|
|
286
323
|
};
|
|
287
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Date format options
|
|
327
|
+
*/
|
|
328
|
+
declare type DateFormat = "short" | "medium" | "long" | "relative";
|
|
329
|
+
|
|
288
330
|
export declare const DefaultSidebar: (props: DefaultSidebarProps) => JSX.Element;
|
|
289
331
|
|
|
290
332
|
declare type DefaultSidebarProps = {
|
|
@@ -481,10 +523,55 @@ declare type DefineResourceProps = CommonProps & ReactResourceProps & {
|
|
|
481
523
|
errorBoundary?: ErrorBoundaryComponent;
|
|
482
524
|
};
|
|
483
525
|
|
|
526
|
+
/**
|
|
527
|
+
* DescriptionCard - ERP document display component
|
|
528
|
+
*
|
|
529
|
+
* Renders structured key-value information with automatic layout.
|
|
530
|
+
* Use { type: "divider" } in the fields array to add dividers between sections.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```tsx
|
|
534
|
+
* <DescriptionCard
|
|
535
|
+
* data={order}
|
|
536
|
+
* title="Order Summary"
|
|
537
|
+
* fields={[
|
|
538
|
+
* { key: "status", label: "Status", type: "badge", meta: { badgeVariantMap: { CONFIRMED: "success" } } },
|
|
539
|
+
* { key: "orderNumber", label: "Order #", meta: { copyable: true } },
|
|
540
|
+
* { type: "divider" },
|
|
541
|
+
* { key: "total", label: "Total", type: "money" },
|
|
542
|
+
* ]}
|
|
543
|
+
* />
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
export declare function DescriptionCard({ data, title, fields, columns, className, headerAction, }: DescriptionCardProps): JSX.Element;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Props for the DescriptionCard component
|
|
550
|
+
*/
|
|
551
|
+
export declare interface DescriptionCardProps {
|
|
552
|
+
/** Raw backend data object */
|
|
553
|
+
data: Record<string, unknown>;
|
|
554
|
+
/** Card title */
|
|
555
|
+
title: string;
|
|
556
|
+
/** Ordered list of field definitions (use { type: "divider" } for dividers) */
|
|
557
|
+
fields: FieldConfig[];
|
|
558
|
+
/** Number of columns on desktop (3 or 4) */
|
|
559
|
+
columns?: Columns;
|
|
560
|
+
/** Additional CSS classes */
|
|
561
|
+
className?: string;
|
|
562
|
+
/** Header action slot (e.g., edit button) */
|
|
563
|
+
headerAction?: React.ReactNode;
|
|
564
|
+
}
|
|
565
|
+
|
|
484
566
|
declare type DynamicLocales<Def extends Record<string, LabelValue>> = {
|
|
485
567
|
[locale: string]: Partial<LabelDefinition<Def>> | undefined;
|
|
486
568
|
};
|
|
487
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Behavior when a field value is empty/null/undefined
|
|
572
|
+
*/
|
|
573
|
+
declare type EmptyBehavior = "dash" | "hide";
|
|
574
|
+
|
|
488
575
|
/**
|
|
489
576
|
* Error boundary element type for route error handling.
|
|
490
577
|
*
|
|
@@ -508,6 +595,65 @@ declare type DynamicLocales<Def extends Record<string, LabelValue>> = {
|
|
|
508
595
|
*/
|
|
509
596
|
export declare type ErrorBoundaryComponent = ReactNode;
|
|
510
597
|
|
|
598
|
+
/**
|
|
599
|
+
* A field configuration - either a divider or a field definition
|
|
600
|
+
*/
|
|
601
|
+
declare type FieldConfig = FieldDivider | FieldDefinition;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Field definition - renders a key-value pair
|
|
605
|
+
*/
|
|
606
|
+
declare interface FieldDefinition {
|
|
607
|
+
/** Field type determines rendering (defaults to "text") */
|
|
608
|
+
type?: FieldType;
|
|
609
|
+
/** Path to the value in the data object (supports dot notation) */
|
|
610
|
+
key: string;
|
|
611
|
+
/** Display label for the field */
|
|
612
|
+
label: string;
|
|
613
|
+
/** Type-specific metadata */
|
|
614
|
+
meta?: FieldMeta;
|
|
615
|
+
/** Behavior when value is empty (defaults to "dash") */
|
|
616
|
+
emptyBehavior?: EmptyBehavior;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Divider - creates a horizontal line between sections
|
|
621
|
+
*/
|
|
622
|
+
declare interface FieldDivider {
|
|
623
|
+
type: "divider";
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Metadata for field-specific rendering options
|
|
628
|
+
*/
|
|
629
|
+
declare interface FieldMeta {
|
|
630
|
+
/** Show copy button for this field */
|
|
631
|
+
copyable?: boolean;
|
|
632
|
+
/** Map field values to badge variants */
|
|
633
|
+
badgeVariantMap?: Record<string, BadgeVariantType>;
|
|
634
|
+
/** Key path to currency code in data object (for money fields) */
|
|
635
|
+
currencyKey?: string;
|
|
636
|
+
/** Key path to href in data object (for link fields) */
|
|
637
|
+
hrefKey?: string;
|
|
638
|
+
/** Whether the link opens in a new tab */
|
|
639
|
+
external?: boolean;
|
|
640
|
+
/** Date format style */
|
|
641
|
+
dateFormat?: DateFormat;
|
|
642
|
+
/** Key path to reference document ID */
|
|
643
|
+
referenceIdKey?: string;
|
|
644
|
+
/** Base URL pattern for reference links (use {id} as placeholder) */
|
|
645
|
+
referenceUrlPattern?: string;
|
|
646
|
+
/** Tooltip text */
|
|
647
|
+
tooltip?: string;
|
|
648
|
+
/** Truncate text after this many lines (shows tooltip with full text) */
|
|
649
|
+
truncateLines?: number;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Supported field types for DescriptionCard
|
|
654
|
+
*/
|
|
655
|
+
declare type FieldType = "text" | "badge" | "money" | "date" | "link" | "address" | "reference";
|
|
656
|
+
|
|
511
657
|
export declare type I18nLabels<Def extends Record<string, LabelValue> = Record<string, LabelValue>, L extends string = never> = {
|
|
512
658
|
en: Def;
|
|
513
659
|
} & {
|
|
@@ -527,6 +673,57 @@ declare type LabelDefinition<Def extends Record<string, LabelValue>> = {
|
|
|
527
673
|
*/
|
|
528
674
|
declare type LabelValue = string | ((props: any) => string);
|
|
529
675
|
|
|
676
|
+
/**
|
|
677
|
+
* Layout - Responsive column layout component
|
|
678
|
+
*
|
|
679
|
+
* Automatically handles responsive behavior for 1, 2, or 3 column layouts.
|
|
680
|
+
* Uses flexbox with viewport breakpoints for simple, CSS-only responsive behavior.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```tsx
|
|
684
|
+
* // Basic layout
|
|
685
|
+
* <Layout columns={2}>
|
|
686
|
+
* <Layout.Column>Main content</Layout.Column>
|
|
687
|
+
* <Layout.Column>Side panel</Layout.Column>
|
|
688
|
+
* </Layout>
|
|
689
|
+
*
|
|
690
|
+
* // With header and actions
|
|
691
|
+
* <Layout columns={2} title="Page Title" actions={[<Button key="save">Save</Button>]}>
|
|
692
|
+
* <Layout.Column>...</Layout.Column>
|
|
693
|
+
* <Layout.Column>...</Layout.Column>
|
|
694
|
+
* </Layout>
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
export declare function Layout({ columns, className, gap, title, actions, children, }: LayoutProps): JSX.Element;
|
|
698
|
+
|
|
699
|
+
export declare namespace Layout {
|
|
700
|
+
var Column: React_2.ForwardRefExoticComponent<ColumnProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Props for the Layout component
|
|
705
|
+
*/
|
|
706
|
+
export declare interface LayoutProps {
|
|
707
|
+
/**
|
|
708
|
+
* Number of columns (1, 2, or 3).
|
|
709
|
+
*
|
|
710
|
+
* **Required.** Must match the exact number of `Layout.Column` children.
|
|
711
|
+
* The component will throw an error in development if there's a mismatch.
|
|
712
|
+
*/
|
|
713
|
+
columns: ColumnCount;
|
|
714
|
+
/** Additional CSS classes */
|
|
715
|
+
className?: string;
|
|
716
|
+
/** Gap between columns (default: 4 = 16px) */
|
|
717
|
+
gap?: number;
|
|
718
|
+
/** Header title - displayed at the top of the layout */
|
|
719
|
+
title?: string;
|
|
720
|
+
/** Header actions - array of action components (e.g., buttons) displayed on the right side of the header.
|
|
721
|
+
* Layout and spacing are handled automatically. */
|
|
722
|
+
actions?: ReactNode[];
|
|
723
|
+
/** Child elements - must be exactly `columns` number of Layout.Column components */
|
|
724
|
+
children: ReactNode;
|
|
725
|
+
}
|
|
726
|
+
|
|
530
727
|
export { Link }
|
|
531
728
|
|
|
532
729
|
declare type LoaderHandler = (args: LoaderFunctionArgs) => Promise<unknown> | unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/app-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./styles": "./dist/app-shell.css",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"react-dom": ">= 19"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@badgateway/oauth2-client": "^3.3.0",
|
|
22
21
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
23
22
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
24
23
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
"@radix-ui/react-label": "^2.1.8",
|
|
27
26
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
28
27
|
"@radix-ui/react-popover": "^1.1.15",
|
|
29
|
-
"@radix-ui/react-select": "^2.1.6",
|
|
30
28
|
"@radix-ui/react-separator": "^1.1.8",
|
|
31
29
|
"@radix-ui/react-slot": "^1.2.4",
|
|
32
30
|
"@radix-ui/react-tooltip": "^1.2.8",
|