Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,43 +1,23 @@
import { t as i18nT } from "i18next";
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
// src/components/multi-select.tsx
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { CheckIcon, XCircle, ChevronDown, XIcon, WandSparkles, CaretSortIcon } from "~/components/ui/icons/vendor";
import { CheckIcon, CaretSortIcon } from "~/components/ui/icons/vendor";
import { cn } from "~/lib/utils";
import { Separator } from "~/components/ui/separator";
import { Button } from "~/components/ui/button";
import { Badge } from "~/components/ui/badge";
import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover";
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "~/components/ui/command";
import { Checkbox } from "./checkbox";
import { useTranslation } from "react-i18next";
import GearIcon from "./icons/GearIcon";
import { useLocaleFormatters } from "~/locale/format";
/**
* Variants for the multi-select component to handle different styles.
* Uses class-variance-authority (cva) to define different styles based on "variant" prop.
*/
const multiSelectVariants = cva("m-1 transition ease-in-out delay-150 hover:-translate-y-1 duration-300", {
variants: {
variant: {
default: "border-foreground/10 text-foreground bg-card hover:bg-card/80",
secondary: "border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
inverted: "inverted",
},
},
defaultVariants: {
variant: "default",
},
});
/**
* Props for MultiSelect component
*/
interface MultiSelectProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof multiSelectVariants> {
interface MultiSelectProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: "default" | "secondary" | "destructive" | "inverted";
/**
* An array of option objects to be displayed in the multi-select component.
* Each option object has a label, value, and an optional icon.
@@ -114,14 +94,14 @@ export const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>
size = "default",
options,
onValueChange,
variant,
variant: _variant,
value,
defaultValue = [],
placeholder = i18nT("components.multiSelect.select"),
animation = 0,
animation: _animation = 0,
maxCount = 3,
modalPopover = true,
asChild = false,
asChild: _asChild = false,
className,
onSettingsClick,
renderComponents = false,
@@ -137,7 +117,6 @@ export const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>
const formatters = useLocaleFormatters();
const [selectedValues, setSelectedValues] = React.useState<string[]>(value || defaultValue);
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
const [isAnimating, setIsAnimating] = React.useState(false);
const selectedValueSet = React.useMemo(() => new Set(selectedValues), [selectedValues]);
const optionByValue = React.useMemo(() => new Map(options.map((option) => [option.value, option])), [options]);
const selectedSummaryText = React.useMemo(
@@ -183,12 +162,6 @@ export const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>
setIsPopoverOpen((prev) => !prev);
};
const clearExtraOptions = () => {
const newSelectedValues = selectedValues.slice(0, maxCount);
setSelectedValues(newSelectedValues);
onValueChange(newSelectedValues);
};
const toggleAll = () => {
if (selectedValues.length === options.length) {
setSelectedValues([]);
@@ -215,69 +188,6 @@ export const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>
className
)}
>
{/* {selectedValues.length > 0 ? (
<div className="flex w-full items-center justify-between">
<div className="flex flex-wrap items-center">
{selectedValues.slice(0, maxCount).map((value) => {
const option = options.find((o) => o.value === value);
const IconComponent = option?.icon;
return (
<Badge
key={value}
className={cn(isAnimating ? "animate-bounce" : "", multiSelectVariants({ variant }))}
style={{ animationDuration: `${animation}s` }}
>
{IconComponent && <IconComponent className="mr-2 h-4 w-4" />}
{option?.label}
<XCircle
className="ml-2 h-4 w-4 cursor-pointer"
onClick={(event) => {
event.stopPropagation();
toggleOption(value);
}}
/>
</Badge>
);
})}
{selectedValues.length > maxCount && (
<Badge
className={cn(
"text-foreground border-foreground/1 bg-transparent hover:bg-transparent",
isAnimating ? "animate-bounce" : "",
multiSelectVariants({ variant })
)}
style={{ animationDuration: `${animation}s` }}
>
{`+ ${selectedValues.length - maxCount} more`}
<XCircle
className="ml-2 h-4 w-4 cursor-pointer"
onClick={(event) => {
event.stopPropagation();
clearExtraOptions();
}}
/>
</Badge>
)}
</div>
<div className="flex items-center justify-between">
<XIcon
className="text-muted-foreground mx-2 h-4 cursor-pointer"
onClick={(event) => {
event.stopPropagation();
handleClear();
}}
/>
<Separator orientation="vertical" className="flex h-full min-h-6" />
<ChevronDown className="text-muted-foreground mx-2 h-4 cursor-pointer" />
</div>
</div>
) : (
<div className="mx-auto flex w-full items-center justify-between">
<span className="text-muted-foreground mx-3 text-sm">{placeholder}</span>
<ChevronDown className="text-muted-foreground mx-2 h-4 cursor-pointer" />
</div>
)} */}
<div className="flex w-full items-center justify-between truncate">
<div className={cn("flex items-center gap-2 truncate", selectedValues.length === 0 && "text-text-neutral-tertiary")}>
{props.icon}
@@ -341,7 +251,9 @@ export const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>
className={cn(
// Subframe MultiSelect.Item checkbox: h-4 w-4, rounded-sm, border-2.
"border-brand-brand-surface-solid-default mr-2 flex h-4 w-4 items-center justify-center rounded-sm border-2",
selectedValues.length === options.length ? "bg-brand-brand-surface-solid-default text-text-neutral-on-solid" : "opacity-50 [&_svg]:invisible"
selectedValues.length === options.length
? "bg-brand-brand-surface-solid-default text-text-neutral-on-solid"
: "opacity-50 [&_svg]:invisible"
)}
>
<CheckIcon className="h-4 w-4" />