@salesforce/webapp-template-feature-react-chart-experimental 1.13.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/LICENSE.txt +82 -0
- package/README.md +74 -0
- package/dist/.a4drules/build-validation.md +81 -0
- package/dist/.a4drules/code-quality.md +150 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +211 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/dist/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/dist/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/dist/.a4drules/graphql.md +98 -0
- package/dist/.a4drules/images.md +13 -0
- package/dist/.a4drules/react.md +361 -0
- package/dist/.a4drules/react_image_processing.md +45 -0
- package/dist/.a4drules/skills/install-feature/SKILL.md +58 -0
- package/dist/.a4drules/typescript.md +224 -0
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +158 -0
- package/dist/README.md +18 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/.prettierignore +9 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/.prettierrc +11 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/eslint.config.js +113 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/feature-react-chart.webapplication-meta.xml +7 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/index.html +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/package-lock.json +8691 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/package.json +50 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/api/graphql-operations-types.ts +127 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/app.tsx +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/appLayout.tsx +9 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/icons/book.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/icons/copy.svg +4 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/icons/rocket.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/icons/star.svg +3 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/images/codey-1.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/images/codey-2.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/images/codey-3.png +0 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/assets/images/vibe-codey.svg +194 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/AnalyticsChart.tsx +111 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ChartContainer.tsx +25 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/alert.tsx +65 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/button.tsx +56 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/card.tsx +77 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/field.tsx +111 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/index.ts +71 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/input.tsx +19 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/label.tsx +19 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/pagination.tsx +99 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/select.tsx +151 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/skeleton.tsx +7 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/spinner.tsx +21 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/table.tsx +114 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/tabs.tsx +115 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/index.ts +14 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/lib/utils.ts +6 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/About.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/ChartPage.tsx +51 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/Home.tsx +12 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/NotFound.tsx +18 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/routes.tsx +34 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/styles/global.css +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/src/types/chart.ts +22 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/tsconfig.json +36 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/tsconfig.node.json +13 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/vite-env.d.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/vite.config.ts +70 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/vitest-env.d.ts +2 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/vitest.config.ts +11 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/vitest.setup.ts +1 -0
- package/dist/force-app/main/default/webapplications/feature-react-chart/webapplication.json +7 -0
- package/dist/jest.config.js +6 -0
- package/dist/package.json +37 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +40 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/components/AnalyticsChart.tsx +111 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/components/ChartContainer.tsx +25 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/index.ts +14 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/pages/ChartPage.tsx +51 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/routes.tsx +17 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/src/types/chart.ts +22 -0
- package/src/force-app/main/default/webapplications/feature-react-chart/vite.config.ts +70 -0
package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/select.tsx
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const Select = SelectPrimitive.Root;
|
|
8
|
+
|
|
9
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
10
|
+
|
|
11
|
+
const SelectValue = SelectPrimitive.Value;
|
|
12
|
+
|
|
13
|
+
const SelectTrigger = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
+
>(({ className, children, ...props }, ref) => (
|
|
17
|
+
<SelectPrimitive.Trigger
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<SelectPrimitive.Icon asChild>
|
|
27
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
+
</SelectPrimitive.Icon>
|
|
29
|
+
</SelectPrimitive.Trigger>
|
|
30
|
+
));
|
|
31
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
+
|
|
33
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<SelectPrimitive.ScrollUpButton
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn("flex cursor-default items-center justify-center py-1 bg-white", className)}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<ChevronUp className="h-4 w-4" />
|
|
43
|
+
</SelectPrimitive.ScrollUpButton>
|
|
44
|
+
));
|
|
45
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
46
|
+
|
|
47
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
48
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
50
|
+
>(({ className, ...props }, ref) => (
|
|
51
|
+
<SelectPrimitive.ScrollDownButton
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={cn("flex cursor-default items-center justify-center py-1 bg-white", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<ChevronDown className="h-4 w-4" />
|
|
57
|
+
</SelectPrimitive.ScrollDownButton>
|
|
58
|
+
));
|
|
59
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
60
|
+
|
|
61
|
+
const SelectContent = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
64
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
65
|
+
<SelectPrimitive.Portal>
|
|
66
|
+
<SelectPrimitive.Content
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn(
|
|
69
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-white text-gray-900 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
70
|
+
position === "popper" &&
|
|
71
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
position={position}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<SelectScrollUpButton />
|
|
78
|
+
<SelectPrimitive.Viewport
|
|
79
|
+
className={cn(
|
|
80
|
+
"p-1 bg-white",
|
|
81
|
+
position === "popper" &&
|
|
82
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
</SelectPrimitive.Viewport>
|
|
87
|
+
<SelectScrollDownButton />
|
|
88
|
+
</SelectPrimitive.Content>
|
|
89
|
+
</SelectPrimitive.Portal>
|
|
90
|
+
));
|
|
91
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
92
|
+
|
|
93
|
+
const SelectLabel = React.forwardRef<
|
|
94
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
95
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
96
|
+
>(({ className, ...props }, ref) => (
|
|
97
|
+
<SelectPrimitive.Label
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
));
|
|
103
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
104
|
+
|
|
105
|
+
const SelectItem = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
108
|
+
>(({ className, children, ...props }, ref) => (
|
|
109
|
+
<SelectPrimitive.Item
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cn(
|
|
112
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
113
|
+
className,
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
>
|
|
117
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
118
|
+
<SelectPrimitive.ItemIndicator>
|
|
119
|
+
<Check className="h-4 w-4" />
|
|
120
|
+
</SelectPrimitive.ItemIndicator>
|
|
121
|
+
</span>
|
|
122
|
+
|
|
123
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
124
|
+
</SelectPrimitive.Item>
|
|
125
|
+
));
|
|
126
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
127
|
+
|
|
128
|
+
const SelectSeparator = React.forwardRef<
|
|
129
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
130
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
131
|
+
>(({ className, ...props }, ref) => (
|
|
132
|
+
<SelectPrimitive.Separator
|
|
133
|
+
ref={ref}
|
|
134
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
));
|
|
138
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
Select,
|
|
142
|
+
SelectGroup,
|
|
143
|
+
SelectValue,
|
|
144
|
+
SelectTrigger,
|
|
145
|
+
SelectContent,
|
|
146
|
+
SelectLabel,
|
|
147
|
+
SelectItem,
|
|
148
|
+
SelectSeparator,
|
|
149
|
+
SelectScrollUpButton,
|
|
150
|
+
SelectScrollDownButton,
|
|
151
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LoaderIcon } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
|
6
|
+
return (
|
|
7
|
+
<LoaderIcon
|
|
8
|
+
role="status"
|
|
9
|
+
aria-label="Loading"
|
|
10
|
+
className={cn(
|
|
11
|
+
"size-4 animate-spin",
|
|
12
|
+
// A11y: Respect user's motion preferences
|
|
13
|
+
"motion-reduce:animate-none",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Spinner };
|
package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/table.tsx
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shadcn-style Table components
|
|
6
|
+
* These components follow shadcn/ui patterns for consistent styling
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
|
|
10
|
+
({ className, ...props }, ref) => (
|
|
11
|
+
<div className="relative w-full overflow-auto">
|
|
12
|
+
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
Table.displayName = "Table";
|
|
17
|
+
|
|
18
|
+
const TableHeader = React.forwardRef<
|
|
19
|
+
HTMLTableSectionElement,
|
|
20
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<thead
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn(
|
|
25
|
+
// 1. Existing border style
|
|
26
|
+
"[&_tr]:border-b",
|
|
27
|
+
|
|
28
|
+
// 2. Make headers sticky
|
|
29
|
+
// We apply this to the 'th' children using the [&_th] selector
|
|
30
|
+
// This is often more robust across browsers than applying sticky to the <thead> itself
|
|
31
|
+
"[&_th]:sticky [&_th]:top-0 [&_th]:z-10",
|
|
32
|
+
// 3. CRITICAL: Add background color
|
|
33
|
+
// Without this, content scrolls "under" the transparent text
|
|
34
|
+
"[&_th]:bg-background",
|
|
35
|
+
|
|
36
|
+
// 4. Optional: Add a subtle shadow for better visual separation when scrolling
|
|
37
|
+
"[&_th]:shadow-[0_1px_0_0_theme(colors.border)]",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
));
|
|
43
|
+
TableHeader.displayName = "TableHeader";
|
|
44
|
+
|
|
45
|
+
const TableBody = React.forwardRef<
|
|
46
|
+
HTMLTableSectionElement,
|
|
47
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
48
|
+
>(({ className, ...props }, ref) => (
|
|
49
|
+
<tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
|
|
50
|
+
));
|
|
51
|
+
TableBody.displayName = "TableBody";
|
|
52
|
+
|
|
53
|
+
const TableFooter = React.forwardRef<
|
|
54
|
+
HTMLTableSectionElement,
|
|
55
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
56
|
+
>(({ className, ...props }, ref) => (
|
|
57
|
+
<tfoot
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
));
|
|
63
|
+
TableFooter.displayName = "TableFooter";
|
|
64
|
+
|
|
65
|
+
const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
|
|
66
|
+
({ className, ...props }, ref) => (
|
|
67
|
+
<tr
|
|
68
|
+
ref={ref}
|
|
69
|
+
className={cn(
|
|
70
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
TableRow.displayName = "TableRow";
|
|
78
|
+
|
|
79
|
+
const TableHead = React.forwardRef<
|
|
80
|
+
HTMLTableCellElement,
|
|
81
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
82
|
+
>(({ className, ...props }, ref) => (
|
|
83
|
+
<th
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn(
|
|
86
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
87
|
+
className,
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
));
|
|
92
|
+
TableHead.displayName = "TableHead";
|
|
93
|
+
|
|
94
|
+
const TableCell = React.forwardRef<
|
|
95
|
+
HTMLTableCellElement,
|
|
96
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
97
|
+
>(({ className, ...props }, ref) => (
|
|
98
|
+
<td
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
));
|
|
104
|
+
TableCell.displayName = "TableCell";
|
|
105
|
+
|
|
106
|
+
const TableCaption = React.forwardRef<
|
|
107
|
+
HTMLTableCaptionElement,
|
|
108
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
109
|
+
>(({ className, ...props }, ref) => (
|
|
110
|
+
<caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
|
|
111
|
+
));
|
|
112
|
+
TableCaption.displayName = "TableCaption";
|
|
113
|
+
|
|
114
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
package/dist/force-app/main/default/webapplications/feature-react-chart/src/components/ui/tabs.tsx
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
|
|
4
|
+
interface TabsContextValue {
|
|
5
|
+
value: string;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const TabsContext = React.createContext<TabsContextValue | undefined>(undefined);
|
|
10
|
+
|
|
11
|
+
interface TabsProps extends React.ComponentProps<"div"> {
|
|
12
|
+
value?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
onValueChange?: (value: string) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Tabs({ value, defaultValue, onValueChange, className, children, ...props }: TabsProps) {
|
|
18
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue || "");
|
|
19
|
+
const controlled = value !== undefined;
|
|
20
|
+
const currentValue = controlled ? value : internalValue;
|
|
21
|
+
|
|
22
|
+
const handleValueChange = React.useCallback(
|
|
23
|
+
(newValue: string) => {
|
|
24
|
+
if (!controlled) {
|
|
25
|
+
setInternalValue(newValue);
|
|
26
|
+
}
|
|
27
|
+
onValueChange?.(newValue);
|
|
28
|
+
},
|
|
29
|
+
[controlled, onValueChange],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<TabsContext.Provider value={{ value: currentValue, onValueChange: handleValueChange }}>
|
|
34
|
+
<div data-slot="tabs" className={cn("w-full", className)} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
</TabsContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function useTabsContext() {
|
|
42
|
+
const context = React.useContext(TabsContext);
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error("Tabs components must be used within a Tabs component");
|
|
45
|
+
}
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function TabsList({ className, ...props }: React.ComponentProps<"div">) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot="tabs-list"
|
|
53
|
+
className={cn(
|
|
54
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface TabsTriggerProps extends React.ComponentProps<"button"> {
|
|
63
|
+
value: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function TabsTrigger({ className, value, ...props }: TabsTriggerProps) {
|
|
67
|
+
const { value: selectedValue, onValueChange } = useTabsContext();
|
|
68
|
+
const isSelected = selectedValue === value;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<button
|
|
72
|
+
data-slot="tabs-trigger"
|
|
73
|
+
data-selected={isSelected}
|
|
74
|
+
type="button"
|
|
75
|
+
role="tab"
|
|
76
|
+
aria-selected={isSelected}
|
|
77
|
+
className={cn(
|
|
78
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
79
|
+
isSelected
|
|
80
|
+
? "bg-background text-foreground shadow-sm"
|
|
81
|
+
: "text-muted-foreground hover:bg-background/50",
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
onClick={() => onValueChange(value)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface TabsContentProps extends React.ComponentProps<"div"> {
|
|
91
|
+
value: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function TabsContent({ className, value, children, ...props }: TabsContentProps) {
|
|
95
|
+
const { value: selectedValue } = useTabsContext();
|
|
96
|
+
if (selectedValue !== value) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div
|
|
102
|
+
data-slot="tabs-content"
|
|
103
|
+
role="tabpanel"
|
|
104
|
+
className={cn(
|
|
105
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* feature-react-chart – Analytics chart components
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { AnalyticsChart } from "./components/AnalyticsChart";
|
|
6
|
+
export { ChartContainer } from "./components/ChartContainer";
|
|
7
|
+
export type {
|
|
8
|
+
AnalyticsChartProps,
|
|
9
|
+
ChartDataType,
|
|
10
|
+
ChartTheme,
|
|
11
|
+
TimeSeriesDataPoint,
|
|
12
|
+
CategoricalDataPoint,
|
|
13
|
+
ChartDataPoint,
|
|
14
|
+
} from "./types/chart";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function About() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
4
|
+
<div className="text-center">
|
|
5
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">About</h1>
|
|
6
|
+
<p className="text-lg text-gray-600">This is the about page.</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default About;
|
package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/ChartPage.tsx
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChartContainer } from "../components/ChartContainer";
|
|
2
|
+
import { AnalyticsChart } from "../components/AnalyticsChart";
|
|
3
|
+
import type { TimeSeriesDataPoint, CategoricalDataPoint } from "../types/chart";
|
|
4
|
+
|
|
5
|
+
const sampleTimeSeries: TimeSeriesDataPoint[] = [
|
|
6
|
+
{ x: "Jan", y: 42 },
|
|
7
|
+
{ x: "Feb", y: 38 },
|
|
8
|
+
{ x: "Mar", y: 55 },
|
|
9
|
+
{ x: "Apr", y: 61 },
|
|
10
|
+
{ x: "May", y: 58 },
|
|
11
|
+
{ x: "Jun", y: 72 },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const sampleCategorical: CategoricalDataPoint[] = [
|
|
15
|
+
{ name: "Product A", value: 120 },
|
|
16
|
+
{ name: "Product B", value: 85 },
|
|
17
|
+
{ name: "Product C", value: 95 },
|
|
18
|
+
{ name: "Product D", value: 64 },
|
|
19
|
+
{ name: "Product E", value: 110 },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export default function ChartPage() {
|
|
23
|
+
return (
|
|
24
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
25
|
+
<div className="mb-8">
|
|
26
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-2">Analytics</h1>
|
|
27
|
+
<p className="text-lg text-gray-600">Sample time-series and categorical charts.</p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div className="space-y-8">
|
|
31
|
+
<ChartContainer className="max-w-3xl">
|
|
32
|
+
<AnalyticsChart
|
|
33
|
+
chartType="time-series"
|
|
34
|
+
data={sampleTimeSeries}
|
|
35
|
+
theme="green"
|
|
36
|
+
title="Monthly trend"
|
|
37
|
+
/>
|
|
38
|
+
</ChartContainer>
|
|
39
|
+
|
|
40
|
+
<ChartContainer className="max-w-3xl">
|
|
41
|
+
<AnalyticsChart
|
|
42
|
+
chartType="categorical"
|
|
43
|
+
data={sampleCategorical}
|
|
44
|
+
theme="neutral"
|
|
45
|
+
title="By category"
|
|
46
|
+
/>
|
|
47
|
+
</ChartContainer>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function Home() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
4
|
+
<div className="text-center">
|
|
5
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Home</h1>
|
|
6
|
+
<p className="text-lg text-gray-600 mb-8">
|
|
7
|
+
Welcome to your React application.
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
package/dist/force-app/main/default/webapplications/feature-react-chart/src/pages/NotFound.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Link } from 'react-router';
|
|
2
|
+
|
|
3
|
+
export default function NotFound() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
|
6
|
+
<div className="text-center">
|
|
7
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">404</h1>
|
|
8
|
+
<p className="text-lg text-gray-600 mb-8">Page not found</p>
|
|
9
|
+
<Link
|
|
10
|
+
to="/"
|
|
11
|
+
className="inline-block px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
|
|
12
|
+
>
|
|
13
|
+
Go to Home
|
|
14
|
+
</Link>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RouteObject } from 'react-router';
|
|
2
|
+
import AppLayout from './appLayout';
|
|
3
|
+
import Home from '@/pages/Home';
|
|
4
|
+
import About from './pages/About';
|
|
5
|
+
import NotFound from './pages/NotFound';
|
|
6
|
+
import ChartPage from "./pages/ChartPage";
|
|
7
|
+
|
|
8
|
+
export const routes: RouteObject[] = [
|
|
9
|
+
{
|
|
10
|
+
path: "/",
|
|
11
|
+
element: <AppLayout />,
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
index: true,
|
|
15
|
+
element: <Home />,
|
|
16
|
+
handle: { showInNavigation: true, label: 'Home' }
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: 'about',
|
|
20
|
+
element: <About />,
|
|
21
|
+
handle: { showInNavigation: true, label: 'About' }
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: '*',
|
|
25
|
+
element: <NotFound />
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: "chart",
|
|
29
|
+
element: <ChartPage />,
|
|
30
|
+
handle: { showInNavigation: true, label: "Chart" }
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ChartDataType = "time-series" | "categorical";
|
|
2
|
+
export type ChartTheme = "red" | "green" | "neutral";
|
|
3
|
+
|
|
4
|
+
export interface TimeSeriesDataPoint {
|
|
5
|
+
x: string;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CategoricalDataPoint {
|
|
10
|
+
name: string;
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ChartDataPoint = TimeSeriesDataPoint | CategoricalDataPoint;
|
|
15
|
+
|
|
16
|
+
export interface AnalyticsChartProps {
|
|
17
|
+
chartType: ChartDataType;
|
|
18
|
+
data: ChartDataPoint[];
|
|
19
|
+
theme?: ChartTheme;
|
|
20
|
+
title?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
|
|
23
|
+
/* Path mapping */
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": ["./src/*"],
|
|
27
|
+
"@api/*": ["./src/api/*"],
|
|
28
|
+
"@components/*": ["./src/components/*"],
|
|
29
|
+
"@utils/*": ["./src/utils/*"],
|
|
30
|
+
"@styles/*": ["./src/styles/*"],
|
|
31
|
+
"@assets/*": ["./src/assets/*"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"include": ["src", "vite-env.d.ts", "vitest-env.d.ts"],
|
|
35
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"outDir": "./build"
|
|
11
|
+
},
|
|
12
|
+
"include": ["vite.config.ts"]
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|