@polastack/design-system 0.1.17 → 0.1.18
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 +60 -1
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -806,4 +806,63 @@ declare const chartColors: {
|
|
|
806
806
|
type ChartCategoricalColors = typeof chartColors.categorical;
|
|
807
807
|
type ChartSemanticColors = typeof chartColors.semantic;
|
|
808
808
|
|
|
809
|
-
|
|
809
|
+
/** Categorical palette — 8 curated dataviz colors */
|
|
810
|
+
declare function getChartColors(): readonly string[];
|
|
811
|
+
/** Subtle fill palette — 1:1 paired with categorical */
|
|
812
|
+
declare function getChartSubtleColors(dark?: boolean): readonly string[];
|
|
813
|
+
/** Theme object for Recharts axes, grid, and tooltip styling */
|
|
814
|
+
declare function getChartTheme(): {
|
|
815
|
+
gridColor: string;
|
|
816
|
+
axisColor: string;
|
|
817
|
+
textColor: string;
|
|
818
|
+
tooltipBg: string;
|
|
819
|
+
tooltipBorder: string;
|
|
820
|
+
fontSize: number;
|
|
821
|
+
fontFamily: string;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* ChartTooltip — Styled tooltip content for Recharts.
|
|
826
|
+
*
|
|
827
|
+
* Usage with Recharts:
|
|
828
|
+
* ```tsx
|
|
829
|
+
* <RechartsTooltip content={<ChartTooltip />} />
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
interface ChartTooltipProps {
|
|
833
|
+
active?: boolean;
|
|
834
|
+
payload?: Array<{
|
|
835
|
+
name: string;
|
|
836
|
+
value: number;
|
|
837
|
+
color: string;
|
|
838
|
+
dataKey: string;
|
|
839
|
+
}>;
|
|
840
|
+
label?: string;
|
|
841
|
+
/** Custom value formatter (e.g. currency, percentage) */
|
|
842
|
+
formatter?: (value: number, name: string) => string;
|
|
843
|
+
/** Custom label formatter */
|
|
844
|
+
labelFormatter?: (label: string) => string;
|
|
845
|
+
className?: string;
|
|
846
|
+
}
|
|
847
|
+
declare const ChartTooltip: React.FC<ChartTooltipProps>;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* ChartLegend — Styled legend content for Recharts.
|
|
851
|
+
*
|
|
852
|
+
* Usage with Recharts:
|
|
853
|
+
* ```tsx
|
|
854
|
+
* <RechartsLegend content={<ChartLegend />} />
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
interface ChartLegendProps {
|
|
858
|
+
payload?: Array<{
|
|
859
|
+
value: string;
|
|
860
|
+
color: string;
|
|
861
|
+
type?: string;
|
|
862
|
+
dataKey?: string;
|
|
863
|
+
}>;
|
|
864
|
+
className?: string;
|
|
865
|
+
}
|
|
866
|
+
declare const ChartLegend: React.FC<ChartLegendProps>;
|
|
867
|
+
|
|
868
|
+
export { ActiveFilters, type ActiveFiltersProps, AppShell, AppShellContent, AppShellFooter, AppShellHeader, type AppShellProps, AppShellSidebar, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarStatus, type AvatarStatusProps, type AvatarStatusType, BREAKPOINTS, Badge, type BadgeProps, BottomNavigation, BottomNavigationItem, type BottomNavigationItemProps, type BottomNavigationProps, type Breakpoint, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartCategoricalColors, ChartContainer, type ChartContainerProps, ChartLegend, type ChartLegendProps, type ChartSemanticColors, ChartTooltip, type ChartTooltipProps, Checkbox, type CheckboxProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, CommandPaletteEmpty, CommandPaletteGroup, type CommandPaletteGroupProps, CommandPaletteItem, type CommandPaletteItemProps, type CommandPaletteProps, CommandPaletteSeparator, CommandPaletteShortcut, DataTable, DataTableColumnHeader, DataTablePagination, type DataTableProps, DataTableToolbar, DatePicker, type DatePickerProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, type DisplayMode, Drawer, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerProps, DrawerProvider, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicFormField, type DynamicFormFieldProps, EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, type EmptyStateProps, EmptyStateTitle, type FieldOption, type FieldType, FilterBar, FilterBarActions, FilterBarGroup, FilterChip, type FilterChipProps, FormActions, type FormActionsProps, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, type FormFieldProps, FormLabel, type FormLabelProps, FormLayout, type FormLayoutProps, FormMessage, type FormMessageProps, FormSection, type FormSectionProps, Input, type InputProps, InstallPrompt, type InstallPromptProps, Label, type LabelProps, NumberInput, type NumberInputProps, OfflineIndicator, type OfflineIndicatorProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrintDivider, type PrintDividerProps, PrintDocument, type PrintDocumentProps, PrintField, PrintFieldGroup, type PrintFieldGroupProps, type PrintFieldProps, PrintFooter, type PrintFooterProps, PrintHeader, type PrintHeaderProps, PrintTable, PrintTableBody, type PrintTableBodyProps, PrintTableCell, type PrintTableCellProps, PrintTableFooter, type PrintTableFooterProps, PrintTableHead, type PrintTableHeadProps, PrintTableHeader, type PrintTableHeaderProps, type PrintTableProps, PrintTableRow, type PrintTableRowProps, PullToRefresh, type PullToRefreshProps, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, type ResolvedTheme, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Spinner, type SpinnerProps, StatCard, type StatCardProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsListProps, TabsTrigger, Textarea, type TextareaProps, type Theme, ThemeProvider, type ThemeProviderProps, Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseThemeOptions, type UseThemeReturn, avatarVariants, badgeVariants, buttonVariants, chartColors, cn, createContext, formLayoutVariants, getChartColors, getChartSubtleColors, getChartTheme, getFieldComponent, inputVariants, printDocumentVariants, printFieldGroupVariants, spinnerVariants, switchVariants, textareaVariants, toast, toastVariants, useAppShell, useBreakpoint, useDisplayMode, useFormField, useInstallPrompt, useOnlineStatus, useTheme$1 as useTheme, useTheme as useThemeContext, useToast, useViewportHeight };
|
package/dist/index.js
CHANGED
|
@@ -4041,6 +4041,88 @@ var chartColors = {
|
|
|
4041
4041
|
// neutral-400
|
|
4042
4042
|
}
|
|
4043
4043
|
};
|
|
4044
|
+
|
|
4045
|
+
// src/components/chart/chart-theme.ts
|
|
4046
|
+
var cssVar = (variable, fallback) => {
|
|
4047
|
+
if (typeof window === "undefined") return fallback;
|
|
4048
|
+
return getComputedStyle(document.documentElement).getPropertyValue(variable).trim() || fallback;
|
|
4049
|
+
};
|
|
4050
|
+
function getChartColors() {
|
|
4051
|
+
return chartColors.categorical;
|
|
4052
|
+
}
|
|
4053
|
+
function getChartSubtleColors(dark = false) {
|
|
4054
|
+
return dark ? chartColors.subtleDark : chartColors.subtle;
|
|
4055
|
+
}
|
|
4056
|
+
function getChartTheme() {
|
|
4057
|
+
return {
|
|
4058
|
+
gridColor: cssVar("--color-neutral-200", chartColors.grid.light),
|
|
4059
|
+
axisColor: cssVar("--color-neutral-400", "#a1a1aa"),
|
|
4060
|
+
textColor: cssVar("--color-neutral-500", chartColors.text.light),
|
|
4061
|
+
tooltipBg: cssVar("--color-surface-raised", "#ffffff"),
|
|
4062
|
+
tooltipBorder: cssVar("--color-border", "#e4e4e7"),
|
|
4063
|
+
fontSize: 12,
|
|
4064
|
+
fontFamily: 'Inter, "Noto Sans JP", sans-serif'
|
|
4065
|
+
};
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4068
|
+
// src/components/chart/chart-tooltip.tsx
|
|
4069
|
+
import { jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4070
|
+
var ChartTooltip = ({
|
|
4071
|
+
active,
|
|
4072
|
+
payload,
|
|
4073
|
+
label,
|
|
4074
|
+
formatter,
|
|
4075
|
+
labelFormatter,
|
|
4076
|
+
className
|
|
4077
|
+
}) => {
|
|
4078
|
+
if (!active || !payload?.length) return null;
|
|
4079
|
+
const displayLabel = labelFormatter ? labelFormatter(String(label)) : label;
|
|
4080
|
+
return /* @__PURE__ */ jsxs29(
|
|
4081
|
+
"div",
|
|
4082
|
+
{
|
|
4083
|
+
className: cn(
|
|
4084
|
+
"rounded-lg border border-[var(--color-border)] bg-[var(--color-surface-raised)] px-3 py-2 shadow-md",
|
|
4085
|
+
"text-xs",
|
|
4086
|
+
className
|
|
4087
|
+
),
|
|
4088
|
+
children: [
|
|
4089
|
+
displayLabel && /* @__PURE__ */ jsx50("p", { className: "font-medium text-[var(--color-on-surface)] mb-1", children: displayLabel }),
|
|
4090
|
+
/* @__PURE__ */ jsx50("div", { className: "flex flex-col gap-0.5", children: payload.map((entry, i) => /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
4091
|
+
/* @__PURE__ */ jsx50(
|
|
4092
|
+
"span",
|
|
4093
|
+
{
|
|
4094
|
+
className: "inline-block h-2.5 w-2.5 shrink-0 rounded-full",
|
|
4095
|
+
style: { backgroundColor: entry.color }
|
|
4096
|
+
}
|
|
4097
|
+
),
|
|
4098
|
+
/* @__PURE__ */ jsx50("span", { className: "text-[var(--color-on-surface-muted)]", children: entry.name }),
|
|
4099
|
+
/* @__PURE__ */ jsx50("span", { className: "ml-auto font-medium tabular-nums text-[var(--color-on-surface)]", children: formatter ? formatter(entry.value, entry.name) : entry.value.toLocaleString() })
|
|
4100
|
+
] }, i)) })
|
|
4101
|
+
]
|
|
4102
|
+
}
|
|
4103
|
+
);
|
|
4104
|
+
};
|
|
4105
|
+
ChartTooltip.displayName = "ChartTooltip";
|
|
4106
|
+
|
|
4107
|
+
// src/components/chart/chart-legend.tsx
|
|
4108
|
+
import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4109
|
+
var ChartLegend = ({
|
|
4110
|
+
payload,
|
|
4111
|
+
className
|
|
4112
|
+
}) => {
|
|
4113
|
+
if (!payload?.length) return null;
|
|
4114
|
+
return /* @__PURE__ */ jsx51("div", { className: cn("flex flex-wrap items-center justify-center gap-x-4 gap-y-1 pt-3", className), children: payload.map((entry, i) => /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-1.5 text-xs text-[var(--color-on-surface-muted)]", children: [
|
|
4115
|
+
/* @__PURE__ */ jsx51(
|
|
4116
|
+
"span",
|
|
4117
|
+
{
|
|
4118
|
+
className: "inline-block h-2.5 w-2.5 shrink-0 rounded-full",
|
|
4119
|
+
style: { backgroundColor: entry.color }
|
|
4120
|
+
}
|
|
4121
|
+
),
|
|
4122
|
+
/* @__PURE__ */ jsx51("span", { children: entry.value })
|
|
4123
|
+
] }, i)) });
|
|
4124
|
+
};
|
|
4125
|
+
ChartLegend.displayName = "ChartLegend";
|
|
4044
4126
|
export {
|
|
4045
4127
|
ActiveFilters,
|
|
4046
4128
|
AppShell,
|
|
@@ -4065,6 +4147,8 @@ export {
|
|
|
4065
4147
|
CardHeader,
|
|
4066
4148
|
CardTitle,
|
|
4067
4149
|
ChartContainer,
|
|
4150
|
+
ChartLegend,
|
|
4151
|
+
ChartTooltip,
|
|
4068
4152
|
Checkbox,
|
|
4069
4153
|
Combobox,
|
|
4070
4154
|
CommandPalette,
|
|
@@ -4200,6 +4284,9 @@ export {
|
|
|
4200
4284
|
cn,
|
|
4201
4285
|
createContext2 as createContext,
|
|
4202
4286
|
formLayoutVariants,
|
|
4287
|
+
getChartColors,
|
|
4288
|
+
getChartSubtleColors,
|
|
4289
|
+
getChartTheme,
|
|
4203
4290
|
getFieldComponent,
|
|
4204
4291
|
inputVariants,
|
|
4205
4292
|
printDocumentVariants,
|