@schandlergarcia/sf-web-components 1.2.6 → 1.2.7
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/package.json +2 -1
- package/scripts/postinstall.mjs +69 -93
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Account.cls +196 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/AccountHistory.cls +25 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Asset.cls +138 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Attachment.cls +35 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Case.cls +111 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Contact.cls +167 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Contract.cls +96 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Domain.cls +29 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Lead.cls +128 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Note.cls +32 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Opportunity.cls +113 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Order.cls +127 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Pricebook2.cls +47 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/PricebookEntry.cls +47 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Product2.cls +91 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/RecordType.cls +35 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Report.cls +47 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/Task.cls +79 -0
- package/src/components/library/.sfdx/tools/sobjects/standardObjects/User.cls +2318 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Account.json +2952 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/AccountHistory.json +875 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Asset.json +1699 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Attachment.json +362 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Case.json +1371 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Contact.json +2309 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Contract.json +1304 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Domain.json +293 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Lead.json +1977 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Note.json +303 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Opportunity.json +1470 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Order.json +1646 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Pricebook2.json +482 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/PricebookEntry.json +433 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Product2.json +1039 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/RecordType.json +2576 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Report.json +486 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/Task.json +4296 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/standardObjects/User.json +30415 -0
- package/src/components/library/.sfdx/tools/soqlMetadata/typeNames.json +78 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Account.d.ts +264 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/AccountHistory.d.ts +44 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Asset.d.ts +240 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Attachment.d.ts +76 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Case.d.ts +172 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Contact.d.ts +264 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Contract.d.ts +188 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Domain.d.ts +52 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Lead.d.ts +252 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Note.d.ts +64 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Opportunity.d.ts +200 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Order.d.ts +260 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Pricebook2.d.ts +64 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/PricebookEntry.d.ts +76 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Product2.d.ts +96 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/RecordType.d.ts +64 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Report.d.ts +80 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/Task.d.ts +184 -0
- package/src/components/library/.sfdx/typings/lwc/sobjects/User.d.ts +752 -0
- package/src/components/library/cards/ActionList.jsx +38 -0
- package/src/components/library/cards/ActivityCard.jsx +56 -0
- package/src/components/library/cards/BaseCard.jsx +109 -0
- package/src/components/library/cards/CalloutCard.jsx +37 -0
- package/src/components/library/cards/ChartCard.jsx +105 -0
- package/src/components/library/cards/FeedPanel.jsx +39 -0
- package/src/components/library/cards/ListCard.jsx +193 -0
- package/src/components/library/cards/MetricCard.jsx +109 -0
- package/src/components/library/cards/MetricsStrip.jsx +78 -0
- package/src/components/library/cards/SectionCard.jsx +83 -0
- package/src/components/library/cards/SemanticMetricCard.jsx +52 -0
- package/src/components/library/cards/SemanticMetricCardWithLoading.jsx +23 -0
- package/src/components/library/cards/SemanticTableCard.jsx +48 -0
- package/src/components/library/cards/SemanticTableCardWithLoading.jsx +22 -0
- package/src/components/library/cards/StatusCard.jsx +220 -0
- package/src/components/library/cards/TableCard.jsx +337 -0
- package/src/components/library/cards/WidgetCard.jsx +90 -0
- package/src/components/library/charts/D3Chart.jsx +109 -0
- package/src/components/library/charts/D3ChartTemplates.jsx +126 -0
- package/src/components/library/charts/GeoMap.jsx +293 -0
- package/src/components/library/chat/ChatBar.jsx +256 -0
- package/src/components/library/chat/ChatInput.jsx +89 -0
- package/src/components/library/chat/ChatMessage.jsx +178 -0
- package/src/components/library/chat/ChatMessageList.jsx +73 -0
- package/src/components/library/chat/ChatPanel.jsx +97 -0
- package/src/components/library/chat/ChatSuggestions.jsx +28 -0
- package/src/components/library/chat/ChatToolCall.jsx +100 -0
- package/src/components/library/chat/ChatTypingIndicator.jsx +23 -0
- package/src/components/library/chat/ChatWelcome.jsx +43 -0
- package/src/components/library/chat/index.jsx +10 -0
- package/src/components/library/chat/useChatState.jsx +130 -0
- package/src/components/library/data/DataModeProvider.jsx +67 -0
- package/src/components/library/data/DataModeToggle.jsx +36 -0
- package/src/components/library/data/chartDataProvider.jsx +61 -0
- package/src/components/library/data/filterUtils.jsx +141 -0
- package/src/components/library/data/useDataSource.jsx +33 -0
- package/src/components/library/data/usePageFilters.jsx +99 -0
- package/src/components/library/filters/FilterBar.jsx +95 -0
- package/src/components/library/filters/SearchFilter.jsx +36 -0
- package/src/components/library/filters/SelectFilter.jsx +55 -0
- package/src/components/library/filters/ToggleFilter.jsx +52 -0
- package/src/components/library/filters/index.jsx +4 -0
- package/src/components/library/forms/FormField.jsx +291 -0
- package/src/components/library/forms/FormModal.jsx +201 -0
- package/src/components/library/forms/FormRenderer.jsx +46 -0
- package/src/components/library/forms/FormSection.jsx +69 -0
- package/src/components/library/forms/index.jsx +5 -0
- package/src/components/library/forms/useFormState.jsx +165 -0
- package/src/components/library/heroui/Accordion.jsx +26 -0
- package/src/components/library/heroui/Alert.jsx +8 -0
- package/src/components/library/heroui/Badge.jsx +8 -0
- package/src/components/library/heroui/Breadcrumbs.jsx +22 -0
- package/src/components/library/heroui/Button.jsx +58 -0
- package/src/components/library/heroui/Card.jsx +8 -0
- package/src/components/library/heroui/Collapsible.jsx +42 -0
- package/src/components/library/heroui/DatePicker.jsx +34 -0
- package/src/components/library/heroui/Dialog.jsx +37 -0
- package/src/components/library/heroui/Drawer.jsx +32 -0
- package/src/components/library/heroui/Dropdown.jsx +28 -0
- package/src/components/library/heroui/Field.jsx +51 -0
- package/src/components/library/heroui/Input.jsx +6 -0
- package/src/components/library/heroui/Kbd.jsx +8 -0
- package/src/components/library/heroui/Meter.jsx +8 -0
- package/src/components/library/heroui/Modal.jsx +32 -0
- package/src/components/library/heroui/Pagination.jsx +8 -0
- package/src/components/library/heroui/Popover.jsx +64 -0
- package/src/components/library/heroui/ProgressBar.jsx +8 -0
- package/src/components/library/heroui/ProgressCircle.jsx +8 -0
- package/src/components/library/heroui/ScrollShadow.jsx +8 -0
- package/src/components/library/heroui/Select.jsx +37 -0
- package/src/components/library/heroui/Separator.jsx +8 -0
- package/src/components/library/heroui/Skeleton.jsx +8 -0
- package/src/components/library/heroui/Tabs.jsx +26 -0
- package/src/components/library/heroui/Toast.jsx +25 -0
- package/src/components/library/heroui/Toggle.jsx +14 -0
- package/src/components/library/heroui/Tooltip.jsx +21 -0
- package/src/components/library/index.jsx +149 -0
- package/src/components/library/layout/PageContainer.jsx +11 -0
- package/src/components/library/skeletons/CardSkeleton.jsx +30 -0
- package/src/components/library/theme/AppThemeProvider.jsx +67 -0
- package/src/components/library/theme/tokens.jsx +72 -0
- package/src/components/library/ui/Alert.jsx +80 -0
- package/src/components/library/ui/Avatar.jsx +44 -0
- package/src/components/library/ui/BreadcrumbExtras.tsx +119 -0
- package/src/components/library/ui/Card.jsx +117 -0
- package/src/components/library/ui/Checkbox.jsx +17 -0
- package/src/components/library/ui/Chip.jsx +38 -0
- package/src/components/library/ui/Collapsible.tsx +31 -0
- package/src/components/library/ui/Container.jsx +56 -0
- package/src/components/library/ui/DatePicker.tsx +34 -0
- package/src/components/library/ui/Dialog.tsx +141 -0
- package/src/components/library/ui/EmptyState.jsx +46 -0
- package/src/components/library/ui/Field.tsx +82 -0
- package/src/components/library/ui/FieldGroup.jsx +17 -0
- package/src/components/library/ui/Label.jsx +22 -0
- package/src/components/library/ui/PaginationExtras.tsx +143 -0
- package/src/components/library/ui/Popover.tsx +39 -0
- package/src/components/library/ui/Select.tsx +113 -0
- package/src/components/library/ui/Spinner.jsx +64 -0
- package/src/components/library/ui/Text.jsx +46 -0
- package/src/components/library/ui/UIButton.jsx +61 -0
- package/src/components/library/ui/UIInput.jsx +21 -0
- package/src/components/workspace/ComponentRegistry.jsx +297 -0
- package/src/templates/pages/Home.tsx.template +5 -5
- package/src/templates/pages/NotFound.tsx.template +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export default function Label({ children, htmlFor, required, className = "", ...rest }) {
|
|
4
|
+
// If no htmlFor provided, render as div for compatibility
|
|
5
|
+
const Tag = htmlFor ? 'label' : 'div';
|
|
6
|
+
const props = htmlFor ? { htmlFor, ...rest } : rest;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Tag
|
|
10
|
+
{...props}
|
|
11
|
+
className={[
|
|
12
|
+
"text-sm font-medium text-slate-700 dark:text-slate-200",
|
|
13
|
+
className
|
|
14
|
+
]
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.join(" ")}
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
{required && <span className="ml-0.5 text-red-500">*</span>}
|
|
20
|
+
</Tag>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
// Shadcn-style Pagination subcomponents
|
|
4
|
+
|
|
5
|
+
function PaginationContent({ className, children, ...props }: React.ComponentProps<"ul">) {
|
|
6
|
+
return (
|
|
7
|
+
<ul
|
|
8
|
+
className={[
|
|
9
|
+
"flex flex-row items-center gap-1",
|
|
10
|
+
className
|
|
11
|
+
].filter(Boolean).join(" ")}
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
</ul>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PaginationItem({ className, children, ...props }: React.ComponentProps<"li">) {
|
|
20
|
+
return (
|
|
21
|
+
<li
|
|
22
|
+
className={className}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</li>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function PaginationLink({
|
|
31
|
+
className,
|
|
32
|
+
isActive,
|
|
33
|
+
size = "default",
|
|
34
|
+
href,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<"a"> & {
|
|
37
|
+
isActive?: boolean;
|
|
38
|
+
size?: "default" | "sm" | "lg";
|
|
39
|
+
}) {
|
|
40
|
+
const sizeClasses: Record<"default" | "sm" | "lg", string> = {
|
|
41
|
+
default: "h-9 min-w-9 px-4 py-2",
|
|
42
|
+
sm: "h-8 min-w-8 px-3 py-1.5 text-sm",
|
|
43
|
+
lg: "h-11 min-w-11 px-8 py-3"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<a
|
|
48
|
+
href={href}
|
|
49
|
+
aria-current={isActive ? "page" : undefined}
|
|
50
|
+
className={[
|
|
51
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
|
|
52
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500",
|
|
53
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
54
|
+
isActive
|
|
55
|
+
? "bg-slate-900 text-white dark:bg-slate-50 dark:text-slate-900"
|
|
56
|
+
: "hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
57
|
+
sizeClasses[size],
|
|
58
|
+
className
|
|
59
|
+
].filter(Boolean).join(" ")}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function PaginationPrevious({
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof PaginationLink>) {
|
|
69
|
+
return (
|
|
70
|
+
<PaginationLink
|
|
71
|
+
aria-label="Go to previous page"
|
|
72
|
+
size="default"
|
|
73
|
+
className={[
|
|
74
|
+
"gap-1 pl-2.5",
|
|
75
|
+
className
|
|
76
|
+
].filter(Boolean).join(" ")}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
|
|
80
|
+
<path
|
|
81
|
+
d="M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z"
|
|
82
|
+
fill="currentColor"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
<span>Previous</span>
|
|
86
|
+
</PaginationLink>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function PaginationNext({
|
|
91
|
+
className,
|
|
92
|
+
...props
|
|
93
|
+
}: React.ComponentProps<typeof PaginationLink>) {
|
|
94
|
+
return (
|
|
95
|
+
<PaginationLink
|
|
96
|
+
aria-label="Go to next page"
|
|
97
|
+
size="default"
|
|
98
|
+
className={[
|
|
99
|
+
"gap-1 pr-2.5",
|
|
100
|
+
className
|
|
101
|
+
].filter(Boolean).join(" ")}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
<span>Next</span>
|
|
105
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
|
|
106
|
+
<path
|
|
107
|
+
d="M6.1584 3.13514C6.35985 2.94628 6.67627 2.95648 6.86513 3.15794L10.6151 7.15794C10.7954 7.35027 10.7954 7.64955 10.6151 7.84188L6.86513 11.8419C6.67627 12.0433 6.35985 12.0535 6.1584 11.8647C5.95694 11.6758 5.94673 11.3594 6.13559 11.1579L9.565 7.49991L6.13559 3.84188C5.94673 3.64042 5.95694 3.32401 6.1584 3.13514Z"
|
|
108
|
+
fill="currentColor"
|
|
109
|
+
/>
|
|
110
|
+
</svg>
|
|
111
|
+
</PaginationLink>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function PaginationEllipsis({ className, ...props }: React.ComponentProps<"span">) {
|
|
116
|
+
return (
|
|
117
|
+
<span
|
|
118
|
+
aria-hidden
|
|
119
|
+
className={[
|
|
120
|
+
"flex h-9 w-9 items-center justify-center",
|
|
121
|
+
className
|
|
122
|
+
].filter(Boolean).join(" ")}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
|
|
126
|
+
<path
|
|
127
|
+
d="M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z"
|
|
128
|
+
fill="currentColor"
|
|
129
|
+
/>
|
|
130
|
+
</svg>
|
|
131
|
+
<span className="sr-only">More pages</span>
|
|
132
|
+
</span>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export {
|
|
137
|
+
PaginationContent,
|
|
138
|
+
PaginationItem,
|
|
139
|
+
PaginationLink,
|
|
140
|
+
PaginationPrevious,
|
|
141
|
+
PaginationNext,
|
|
142
|
+
PaginationEllipsis,
|
|
143
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
5
|
+
return <PopoverPrimitive.Root {...props} />;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
9
|
+
return <PopoverPrimitive.Trigger {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function PopoverContent({
|
|
13
|
+
className,
|
|
14
|
+
align = "center",
|
|
15
|
+
sideOffset = 4,
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
18
|
+
return (
|
|
19
|
+
<PopoverPrimitive.Portal>
|
|
20
|
+
<PopoverPrimitive.Content
|
|
21
|
+
align={align}
|
|
22
|
+
sideOffset={sideOffset}
|
|
23
|
+
className={[
|
|
24
|
+
"z-50 w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md outline-none",
|
|
25
|
+
"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",
|
|
26
|
+
"dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50",
|
|
27
|
+
className
|
|
28
|
+
].filter(Boolean).join(" ")}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</PopoverPrimitive.Portal>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
Popover,
|
|
37
|
+
PopoverTrigger,
|
|
38
|
+
PopoverContent,
|
|
39
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
5
|
+
return <SelectPrimitive.Root {...props} />;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function SelectTrigger({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger>) {
|
|
13
|
+
return (
|
|
14
|
+
<SelectPrimitive.Trigger
|
|
15
|
+
className={[
|
|
16
|
+
"flex h-10 w-full items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2",
|
|
17
|
+
"text-sm text-slate-900 placeholder:text-slate-400",
|
|
18
|
+
"focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2",
|
|
19
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
20
|
+
"dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 dark:focus:ring-offset-slate-950",
|
|
21
|
+
className
|
|
22
|
+
].filter(Boolean).join(" ")}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<SelectPrimitive.Icon asChild>
|
|
27
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
|
|
28
|
+
<path
|
|
29
|
+
d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.26618 11.9026 7.38064 11.95 7.49999 11.95C7.61933 11.95 7.73379 11.9026 7.81819 11.8182L10.0682 9.56819Z"
|
|
30
|
+
fill="currentColor"
|
|
31
|
+
/>
|
|
32
|
+
</svg>
|
|
33
|
+
</SelectPrimitive.Icon>
|
|
34
|
+
</SelectPrimitive.Trigger>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
39
|
+
return <SelectPrimitive.Value {...props} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function SelectContent({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
position = "popper",
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
48
|
+
return (
|
|
49
|
+
<SelectPrimitive.Portal>
|
|
50
|
+
<SelectPrimitive.Content
|
|
51
|
+
className={[
|
|
52
|
+
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white text-slate-900 shadow-md",
|
|
53
|
+
"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",
|
|
54
|
+
"dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50",
|
|
55
|
+
position === "popper" &&
|
|
56
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
57
|
+
className
|
|
58
|
+
].filter(Boolean).join(" ")}
|
|
59
|
+
position={position}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<SelectPrimitive.Viewport
|
|
63
|
+
className={[
|
|
64
|
+
"p-1",
|
|
65
|
+
position === "popper" &&
|
|
66
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
67
|
+
].filter(Boolean).join(" ")}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</SelectPrimitive.Viewport>
|
|
71
|
+
</SelectPrimitive.Content>
|
|
72
|
+
</SelectPrimitive.Portal>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function SelectItem({
|
|
77
|
+
className,
|
|
78
|
+
children,
|
|
79
|
+
...props
|
|
80
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
81
|
+
return (
|
|
82
|
+
<SelectPrimitive.Item
|
|
83
|
+
className={[
|
|
84
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
85
|
+
"focus:bg-slate-100 focus:text-slate-900",
|
|
86
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
87
|
+
"dark:focus:bg-slate-800 dark:focus:text-slate-50",
|
|
88
|
+
className
|
|
89
|
+
].filter(Boolean).join(" ")}
|
|
90
|
+
{...props}
|
|
91
|
+
>
|
|
92
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
93
|
+
<SelectPrimitive.ItemIndicator>
|
|
94
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
|
|
95
|
+
<path
|
|
96
|
+
d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z"
|
|
97
|
+
fill="currentColor"
|
|
98
|
+
/>
|
|
99
|
+
</svg>
|
|
100
|
+
</SelectPrimitive.ItemIndicator>
|
|
101
|
+
</span>
|
|
102
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
103
|
+
</SelectPrimitive.Item>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
Select,
|
|
109
|
+
SelectTrigger,
|
|
110
|
+
SelectValue,
|
|
111
|
+
SelectContent,
|
|
112
|
+
SelectItem,
|
|
113
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const SIZE_CLASSES = {
|
|
4
|
+
xs: "h-3 w-3",
|
|
5
|
+
sm: "h-4 w-4",
|
|
6
|
+
md: "h-5 w-5",
|
|
7
|
+
lg: "h-6 w-6",
|
|
8
|
+
xl: "h-8 w-8",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const TONE_CLASSES = {
|
|
12
|
+
brand: "text-brand-500",
|
|
13
|
+
white: "text-white",
|
|
14
|
+
muted: "text-slate-400 dark:text-slate-500",
|
|
15
|
+
current: "text-current",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Animated spinner.
|
|
20
|
+
*
|
|
21
|
+
* @param {"xs"|"sm"|"md"|"lg"|"xl"} size
|
|
22
|
+
* @param {"brand"|"white"|"muted"|"current"} tone
|
|
23
|
+
* @param {string} label — screen-reader label
|
|
24
|
+
*/
|
|
25
|
+
export default function Spinner({
|
|
26
|
+
size = "md",
|
|
27
|
+
tone = "brand",
|
|
28
|
+
label = "Loading",
|
|
29
|
+
className = "",
|
|
30
|
+
...rest
|
|
31
|
+
}) {
|
|
32
|
+
return (
|
|
33
|
+
<svg
|
|
34
|
+
{...rest}
|
|
35
|
+
className={[
|
|
36
|
+
"animate-spin",
|
|
37
|
+
SIZE_CLASSES[size] ?? SIZE_CLASSES.md,
|
|
38
|
+
TONE_CLASSES[tone] ?? TONE_CLASSES.brand,
|
|
39
|
+
className,
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ")}
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
fill="none"
|
|
45
|
+
viewBox="0 0 24 24"
|
|
46
|
+
role="status"
|
|
47
|
+
aria-label={label}
|
|
48
|
+
>
|
|
49
|
+
<circle
|
|
50
|
+
className="opacity-25"
|
|
51
|
+
cx="12"
|
|
52
|
+
cy="12"
|
|
53
|
+
r="10"
|
|
54
|
+
stroke="currentColor"
|
|
55
|
+
strokeWidth="4"
|
|
56
|
+
/>
|
|
57
|
+
<path
|
|
58
|
+
className="opacity-75"
|
|
59
|
+
fill="currentColor"
|
|
60
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
61
|
+
/>
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const SIZE_CLASSES = {
|
|
4
|
+
xs: "text-xs",
|
|
5
|
+
sm: "text-sm",
|
|
6
|
+
md: "text-base",
|
|
7
|
+
lg: "text-lg",
|
|
8
|
+
xl: "text-xl",
|
|
9
|
+
xxl: "text-2xl"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const WEIGHT_CLASSES = {
|
|
13
|
+
regular: "font-normal",
|
|
14
|
+
medium: "font-medium",
|
|
15
|
+
bold: "font-semibold"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default function UIText({
|
|
19
|
+
as: Comp = "span",
|
|
20
|
+
size = "md",
|
|
21
|
+
weight = "regular",
|
|
22
|
+
muted = false,
|
|
23
|
+
style,
|
|
24
|
+
className = "",
|
|
25
|
+
children,
|
|
26
|
+
...rest
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<Comp
|
|
30
|
+
style={style}
|
|
31
|
+
className={[
|
|
32
|
+
SIZE_CLASSES[size] ?? SIZE_CLASSES.md,
|
|
33
|
+
WEIGHT_CLASSES[weight] ?? WEIGHT_CLASSES.regular,
|
|
34
|
+
muted ? "text-slate-600 dark:text-slate-300" : "text-slate-900 dark:text-slate-50",
|
|
35
|
+
className
|
|
36
|
+
]
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join(" ")}
|
|
39
|
+
{...rest}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</Comp>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const VARIANT_CLASSES = {
|
|
4
|
+
primary:
|
|
5
|
+
"bg-brand-600 text-white hover:bg-brand-500 dark:bg-brand-500 dark:hover:bg-brand-400 border-transparent",
|
|
6
|
+
secondary:
|
|
7
|
+
"bg-slate-900 text-white hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-900 dark:hover:bg-slate-200 border-transparent",
|
|
8
|
+
destructive:
|
|
9
|
+
"bg-red-600 text-white hover:bg-red-500 dark:bg-red-500 dark:hover:bg-red-400 border-transparent",
|
|
10
|
+
outline:
|
|
11
|
+
"bg-transparent text-slate-900 hover:bg-slate-50 dark:text-slate-50 dark:hover:bg-slate-900 border-slate-200 dark:border-slate-800",
|
|
12
|
+
ghost:
|
|
13
|
+
"bg-transparent text-slate-900 hover:bg-slate-100 dark:text-slate-50 dark:hover:bg-slate-900 border-transparent"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const SIZE_CLASSES = {
|
|
17
|
+
sm: "h-8 px-3 text-sm",
|
|
18
|
+
md: "h-10 px-4 text-sm",
|
|
19
|
+
lg: "h-12 px-5 text-base",
|
|
20
|
+
icon: "h-10 w-10 p-0"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default function UIButton({
|
|
24
|
+
variant = "primary",
|
|
25
|
+
size = "md",
|
|
26
|
+
fullWidth = false,
|
|
27
|
+
disabled = false,
|
|
28
|
+
onClick = () => {},
|
|
29
|
+
children,
|
|
30
|
+
style = undefined,
|
|
31
|
+
className = "",
|
|
32
|
+
...rest
|
|
33
|
+
}) {
|
|
34
|
+
const variantClass = VARIANT_CLASSES[variant] ?? VARIANT_CLASSES.primary;
|
|
35
|
+
const sizeClass = SIZE_CLASSES[size] ?? SIZE_CLASSES.md;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
onClick={onClick}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
style={style}
|
|
43
|
+
className={[
|
|
44
|
+
"inline-flex items-center justify-center gap-2 rounded-lg border font-medium shadow-sm transition",
|
|
45
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950",
|
|
46
|
+
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
47
|
+
variantClass,
|
|
48
|
+
sizeClass,
|
|
49
|
+
fullWidth ? "w-full" : "",
|
|
50
|
+
className
|
|
51
|
+
]
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(" ")}
|
|
54
|
+
{...rest}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</button>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export default function UIInput({ style = undefined, className = "", ...rest }) {
|
|
4
|
+
return (
|
|
5
|
+
<input
|
|
6
|
+
style={style}
|
|
7
|
+
className={[
|
|
8
|
+
"h-10 w-full rounded-lg border border-slate-200 bg-white px-3 text-sm text-slate-900 shadow-sm",
|
|
9
|
+
"placeholder:text-slate-400",
|
|
10
|
+
"focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2 dark:focus:ring-offset-slate-950",
|
|
11
|
+
"dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 dark:placeholder:text-slate-500",
|
|
12
|
+
className
|
|
13
|
+
]
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join(" ")}
|
|
16
|
+
{...rest}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|