@leitware/composables 3.2.0 → 3.4.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/README.md +20 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/rules/composables.md +1 -0
- package/skills/use-composables/references/public-api.md +2 -2
- package/src/index.ts +2 -0
- package/src/opinionated/image.tsx +92 -0
package/package.json
CHANGED
package/rules/composables.md
CHANGED
|
@@ -187,6 +187,7 @@ Use this catalog to choose public exports. The `Source module` column is for mai
|
|
|
187
187
|
| `direction` | `./opinionated/direction` | `@leitware/composables` | `DirectionProvider`, `useDirection` | `DirectionProviderProps`, `TextDirection` | Public export not listed in the README component catalog. |
|
|
188
188
|
| `field` | `./opinionated/field` | `@leitware/composables` | `Field`, `FieldContent`, `FieldDescription`, `FieldError`, `FieldGroup`, `FieldLabel`, `FieldLegend`, `FieldSeparator`, `FieldSet`, `FieldTitle` | - | Public export not listed in the README component catalog. |
|
|
189
189
|
| `grid-overlay` | `./opinionated/grid-overlay` | `@leitware/composables` | `GridOverlay` | `GridOverlayProps` | Public export not listed in the README component catalog. |
|
|
190
|
+
| `image` | `./opinionated/image` | `@leitware/composables` | `Image`, `imageVariants` | `ImageProps` | Public export not listed in the README component catalog. |
|
|
190
191
|
| `input-group` | `./opinionated/input-group` | `@leitware/composables` | `InputGroup`, `InputGroupAddon`, `InputGroupButton`, `InputGroupInput`, `InputGroupTextarea` | - | Public export not listed in the README component catalog. |
|
|
191
192
|
| `input` | `./opinionated/input` | `@leitware/composables` | `Input` | - | Public export not listed in the README component catalog. |
|
|
192
193
|
| `label` | `./opinionated/label` | `@leitware/composables` | `Label` | - | Public export not listed in the README component catalog. |
|
|
@@ -6,8 +6,8 @@ This is the exact installed-package entrypoint and export-name contract. Import
|
|
|
6
6
|
|
|
7
7
|
## `@leitware/composables`
|
|
8
8
|
|
|
9
|
-
- Values (
|
|
10
|
-
- Types (
|
|
9
|
+
- Values (361): `ACCEPT_PRESETS`, `Accordion`, `AccordionContent`, `AccordionItem`, `AccordionTrigger`, `Alert`, `AlertAction`, `AlertDescription`, `AlertDialog`, `AlertDialogAction`, `AlertDialogCancel`, `AlertDialogContent`, `AlertDialogDescription`, `AlertDialogFooter`, `AlertDialogHeader`, `AlertDialogMedia`, `AlertDialogOverlay`, `AlertDialogPortal`, `AlertDialogTitle`, `AlertDialogTrigger`, `AlertTitle`, `AspectRatio`, `Avatar`, `AvatarFallback`, `AvatarImage`, `avatarVariants`, `Badge`, `BentoCell`, `BentoGrid`, `BentoLeader`, `BentoQuad`, `BentoSplit`, `BentoTriple`, `Breadcrumb`, `BreadcrumbEllipsis`, `BreadcrumbItem`, `BreadcrumbLink`, `BreadcrumbList`, `BreadcrumbPage`, `BreadcrumbSeparator`, `Bubble`, `BubbleContent`, `BubbleGroup`, `BubbleReactions`, `bubbleReactionsVariants`, `bubbleVariants`, `Button`, `Calendar`, `CalendarDayButton`, `Card`, `CardAction`, `CardContent`, `CardDescription`, `CardFooter`, `CardHeader`, `CardTitle`, `Carousel`, `CarouselContent`, `CarouselItem`, `CarouselNext`, `CarouselPrevious`, `CellGrid`, `CellRow`, `Checkbox`, `ClipboardText`, `cn`, `CodeBlock`, `Collapsible`, `CollapsibleContent`, `CollapsibleTrigger`, `Combobox`, `ComboboxChip`, `ComboboxChips`, `ComboboxChipsInput`, `ComboboxCollection`, `ComboboxContent`, `ComboboxEmpty`, `ComboboxGroup`, `ComboboxInput`, `ComboboxItem`, `ComboboxLabel`, `ComboboxList`, `ComboboxSeparator`, `ComboboxTrigger`, `ComboboxValue`, `Command`, `CommandDialog`, `CommandEmpty`, `CommandGroup`, `CommandInput`, `CommandItem`, `CommandList`, `CommandSeparator`, `CommandShortcut`, `Container`, `containerVariants`, `DataGrid`, `DataLabel`, `DataRow`, `DataValue`, `DEFAULT_ACCEPT`, `DEFAULT_MAX_SIZE`, `Dialog`, `DialogClose`, `DialogContent`, `DialogDescription`, `DialogFooter`, `DialogHeader`, `DialogOverlay`, `DialogPortal`, `DialogTitle`, `DialogTrigger`, `DirectionProvider`, `DISABLED_OPACITY`, `Divider`, `dividerVariants`, `DropdownMenu`, `DropdownMenuCheckboxItem`, `DropdownMenuContent`, `DropdownMenuGroup`, `DropdownMenuItem`, `DropdownMenuLabel`, `DropdownMenuPortal`, `DropdownMenuRadioGroup`, `DropdownMenuRadioItem`, `DropdownMenuSeparator`, `DropdownMenuShortcut`, `DropdownMenuSub`, `DropdownMenuSubContent`, `DropdownMenuSubTrigger`, `DropdownMenuTrigger`, `Dropzone`, `DropZone`, `DropZoneArea`, `DropzoneContent`, `DropZoneContent`, `DropZoneFile`, `DropZoneFileList`, `DropzoneInput`, `DropZoneInput`, `DropzoneLabel`, `Empty`, `EmptyContent`, `EmptyDescription`, `EmptyHeader`, `EmptyMedia`, `EmptyTableState`, `EmptyTitle`, `Field`, `FieldContent`, `FieldDescription`, `FieldError`, `FieldGroup`, `FieldLabel`, `FieldLegend`, `FieldSeparator`, `FieldSet`, `FieldTitle`, `FlexSpacer`, `Flow`, `FlowAnchor`, `FlowList`, `FlowNode`, `FlowParallel`, `FlowRoot`, `FOCUS_RING`, `FOCUS_RING_DESTRUCTIVE`, `formatFileSize`, `formatNumericValue`, `FormCalendarPopover`, `FormCheckbox`, `FormCombobox`, `FormDateOfBirth`, `FormDropZone`, `FormInput`, `FormInputGroup`, `FormMultiCombobox`, `FormMultiDropZone`, `FormRadioGroup`, `FormSelect`, `FormSlider`, `FormSwitch`, `FormTextarea`, `getAcceptDescription`, `getRejectionMessage`, `Grid`, `GridOverlay`, `gridVariants`, `HoverCard`, `HoverCardContent`, `HoverCardTrigger`, `Icon`, `iconVariants`, `Image`, `imageVariants`, `Input`, `InputGroup`, `InputGroupAddon`, `InputGroupButton`, `InputGroupInput`, `InputGroupTextarea`, `Item`, `ItemActions`, `ItemContent`, `ItemDescription`, `ItemFooter`, `ItemGroup`, `ItemHeader`, `ItemMedia`, `ItemSeparator`, `ItemTitle`, `Kbd`, `KbdGroup`, `Label`, `LayerCard`, `LayerCardPrimary`, `LayerCardRoot`, `LayerCardSecondary`, `leftPad`, `List`, `ListArrowItem`, `ListBulletItem`, `Marker`, `MarkerContent`, `MarkerIcon`, `markerVariants`, `Message`, `MessageAvatar`, `MessageContent`, `MessageFooter`, `MessageGroup`, `MessageHeader`, `NativeSelect`, `NativeSelectOptGroup`, `NativeSelectOption`, `NewspaperCell`, `NewspaperGrid`, `newspaperGridVariants`, `Pagination`, `PaginationContent`, `PaginationEllipsis`, `PaginationItem`, `PaginationLink`, `PaginationNext`, `PaginationPrevious`, `parseNumericValue`, `Popover`, `PopoverContent`, `PopoverDescription`, `PopoverHeader`, `PopoverTitle`, `PopoverTrigger`, `Progress`, `ProgressIndicator`, `ProgressLabel`, `ProgressTrack`, `ProgressValue`, `RadioGroup`, `RadioGroupItem`, `ResizableHandle`, `ResizablePanel`, `ResizablePanelGroup`, `sanitizeNumericInput`, `ScrollArea`, `ScrollBar`, `Section`, `sectionVariants`, `Select`, `SelectContent`, `SelectGroup`, `SelectItem`, `SelectLabel`, `SelectRoot`, `SelectScrollDownButton`, `SelectScrollUpButton`, `SelectSeparator`, `SelectTrigger`, `SelectValue`, `Separator`, `Sheet`, `SheetClose`, `SheetContent`, `SheetDescription`, `SheetFooter`, `SheetHeader`, `SheetTitle`, `SheetTrigger`, `Sidebar`, `SidebarContent`, `SidebarFooter`, `SidebarGroup`, `SidebarGroupAction`, `SidebarGroupContent`, `SidebarGroupLabel`, `SidebarHeader`, `SidebarInput`, `SidebarInset`, `SidebarMenu`, `SidebarMenuAction`, `SidebarMenuBadge`, `SidebarMenuButton`, `SidebarMenuItem`, `SidebarMenuSub`, `SidebarMenuSubButton`, `SidebarMenuSubItem`, `SidebarProvider`, `SidebarRail`, `SidebarSeparator`, `SidebarTrigger`, `Skeleton`, `SkeletonAvatar`, `SkeletonButton`, `SkeletonCard`, `SkeletonInput`, `SkeletonTableRow`, `SkeletonText`, `Slider`, `Spacer`, `spacerVariants`, `Spinner`, `spinnerVariants`, `Stack`, `stackVariants`, `StatCell`, `Switch`, `Table`, `TableBody`, `TableCaption`, `TableCell`, `TableFooter`, `TableHead`, `TableHeader`, `TableOfContents`, `TableOfContentsGroup`, `TableOfContentsItem`, `TableOfContentsList`, `TableOfContentsRoot`, `TableOfContentsTitle`, `TableRow`, `Tabs`, `TabsContent`, `Textarea`, `ThemeInjector`, `Toaster`, `Toggle`, `ToggleGroup`, `ToggleGroupItem`, `TokenConfigPanel`, `Tooltip`, `TooltipContent`, `TooltipTrigger`, `Typography`, `typographyVariants`, `useComboboxAnchor`, `useDirection`, `useDropZoneContext`, `useIsMobile`, `useNumericInput`, `useSidebar`, `useTableOfContentsActiveId`, `WindowFrame`
|
|
10
|
+
- Types (117): `Accept`, `AccordionItemData`, `AccordionProps`, `AccordionVariant`, `AlertDialogProps`, `AlertProps`, `AlertType`, `AlertVariant`, `AvatarProps`, `BadgeProps`, `BreadcrumbItemData`, `BreadcrumbProps`, `BubbleProps`, `ButtonProps`, `CardProps`, `CarouselProps`, `ClipboardTextProps`, `ClipboardTextSize`, `ClipboardTextStatus`, `CodeBlockProps`, `CollapsibleProps`, `ComboboxOption`, `ComboboxProps`, `ContainerProps`, `DataGridProps`, `DataLabelProps`, `DataRowProps`, `DataValueProps`, `DateOfBirthValue`, `DialogProps`, `DirectionProviderProps`, `DividerProps`, `DropdownMenuItemData`, `DropdownMenuProps`, `DropZoneFileProps`, `DropZoneProps`, `EmptyProps`, `EmptyTableStateProps`, `FileRejection`, `FlowAlign`, `FlowAnchorProps`, `FlowBranch`, `FlowItem`, `FlowNodeProps`, `FlowOrientation`, `FlowProps`, `FlowRootProps`, `FlowStep`, `FormCalendarPopoverProps`, `FormCheckboxProps`, `FormComboboxOption`, `FormComboboxProps`, `FormDateOfBirthProps`, `FormDropZoneProps`, `FormInputGroupInputProps`, `FormInputGroupProps`, `FormInputProps`, `FormMultiComboboxOption`, `FormMultiComboboxProps`, `FormMultiDropZoneProps`, `FormRadioGroupOption`, `FormRadioGroupProps`, `FormSelectOption`, `FormSelectProps`, `FormSliderProps`, `FormSwitchProps`, `FormTextareaProps`, `GridOverlayProps`, `GridProps`, `HoverCardProps`, `ImageProps`, `ItemProps`, `ItemVariants`, `KbdGroupProps`, `KbdProps`, `LayerCardProps`, `LayerCardRootProps`, `LayerCardSectionProps`, `ListItemData`, `ListProps`, `ListVariant`, `MarkerProps`, `NativeSelectOptionData`, `NativeSelectProps`, `NewspaperCellProps`, `NewspaperGridProps`, `NumericInputOptions`, `NumericMode`, `PaginationProps`, `PopoverProps`, `ProgressProps`, `ScrollAreaProps`, `SectionProps`, `SelectOption`, `SelectProps`, `SheetProps`, `SkeletonProps`, `SpacerProps`, `StackProps`, `TabItem`, `TableOfContentsGroupProps`, `TableOfContentsItemData`, `TableOfContentsItemProps`, `TableOfContentsProps`, `TableOfContentsTrackingOptions`, `TabsProps`, `TabsVariant`, `TextDirection`, `ToggleGroupOption`, `ToggleGroupProps`, `ToggleProps`, `TooltipProps`, `TypographyProps`, `TypographyVariant`, `UseNumericInputOptions`, `UseNumericInputReturn`, `WindowFrameProps`
|
|
11
11
|
|
|
12
12
|
## `@leitware/composables/ai`
|
|
13
13
|
|
package/src/index.ts
CHANGED
|
@@ -58,6 +58,8 @@ export {
|
|
|
58
58
|
|
|
59
59
|
export { AspectRatio } from './opinionated/aspect-ratio'
|
|
60
60
|
|
|
61
|
+
export { Image, imageVariants, type ImageProps } from './opinionated/image'
|
|
62
|
+
|
|
61
63
|
export { Avatar, AvatarFallback, AvatarImage, type AvatarProps } from './opinionated/avatar'
|
|
62
64
|
|
|
63
65
|
export { Badge, type BadgeProps } from './opinionated/badge'
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../lib/utils'
|
|
5
|
+
|
|
6
|
+
const imageVariants = cva('block', {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: 'rounded-lg bg-muted',
|
|
10
|
+
outline: 'rounded-lg border border-stroke bg-muted',
|
|
11
|
+
plain: 'rounded-none bg-transparent',
|
|
12
|
+
},
|
|
13
|
+
fit: {
|
|
14
|
+
cover: 'object-cover',
|
|
15
|
+
contain: 'object-contain',
|
|
16
|
+
},
|
|
17
|
+
fill: {
|
|
18
|
+
true: 'absolute inset-0 size-full',
|
|
19
|
+
false: 'h-auto max-w-full',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
fit: 'cover',
|
|
25
|
+
fill: false,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
type ImageLayout =
|
|
30
|
+
| { fill?: false; width: number; height: number }
|
|
31
|
+
| { fill: true; width?: never; height?: never }
|
|
32
|
+
|
|
33
|
+
export type ImageProps = Omit<
|
|
34
|
+
React.ComponentPropsWithoutRef<'img'>,
|
|
35
|
+
'src' | 'alt' | 'width' | 'height' | 'children'
|
|
36
|
+
> &
|
|
37
|
+
ImageLayout & {
|
|
38
|
+
/** Image URL. Use srcSet and sizes for responsive sources. */
|
|
39
|
+
src: string
|
|
40
|
+
/** Describe meaningful images; explicitly use an empty string for decoration. */
|
|
41
|
+
alt: string
|
|
42
|
+
/** How the image fits its box. @default 'cover' */
|
|
43
|
+
fit?: NonNullable<VariantProps<typeof imageVariants>['fit']>
|
|
44
|
+
/** Presentation style. Use plain for backgrounds or edge-to-edge media. @default 'default' */
|
|
45
|
+
variant?: NonNullable<VariantProps<typeof imageVariants>['variant']>
|
|
46
|
+
/** CSS object-position, e.g. 'center' or '50% 25%'. */
|
|
47
|
+
position?: React.CSSProperties['objectPosition']
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A native image with required alt text and explicit space allocation.
|
|
52
|
+
* Supply intrinsic width/height, or use fill inside a positioned, sized parent.
|
|
53
|
+
* Defaults to lazy loading; use loading="eager" and fetchPriority="high" for a hero.
|
|
54
|
+
* This component does not resize, optimize, or generate image sources.
|
|
55
|
+
*/
|
|
56
|
+
const Image = React.forwardRef<HTMLImageElement, ImageProps>(function Image(
|
|
57
|
+
{
|
|
58
|
+
src,
|
|
59
|
+
alt,
|
|
60
|
+
width,
|
|
61
|
+
height,
|
|
62
|
+
fill = false,
|
|
63
|
+
fit = 'cover',
|
|
64
|
+
variant = 'default',
|
|
65
|
+
position,
|
|
66
|
+
loading = 'lazy',
|
|
67
|
+
decoding = 'async',
|
|
68
|
+
className,
|
|
69
|
+
style,
|
|
70
|
+
...props
|
|
71
|
+
},
|
|
72
|
+
ref,
|
|
73
|
+
) {
|
|
74
|
+
return (
|
|
75
|
+
<img
|
|
76
|
+
{...props}
|
|
77
|
+
ref={ref}
|
|
78
|
+
data-slot="image"
|
|
79
|
+
data-variant={variant}
|
|
80
|
+
src={src}
|
|
81
|
+
alt={alt}
|
|
82
|
+
width={width}
|
|
83
|
+
height={height}
|
|
84
|
+
loading={loading}
|
|
85
|
+
decoding={decoding}
|
|
86
|
+
className={cn(imageVariants({ variant, fit, fill }), className)}
|
|
87
|
+
style={{ objectPosition: position, ...style }}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
export { Image, imageVariants }
|