@leitware/composables 3.2.0 → 3.3.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 +18 -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 +69 -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` | `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 (360): `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`, `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, 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,69 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../lib/utils'
|
|
4
|
+
|
|
5
|
+
type ImageLayout =
|
|
6
|
+
| { fill?: false; width: number; height: number }
|
|
7
|
+
| { fill: true; width?: never; height?: never }
|
|
8
|
+
|
|
9
|
+
export type ImageProps = Omit<
|
|
10
|
+
React.ComponentPropsWithoutRef<'img'>,
|
|
11
|
+
'src' | 'alt' | 'width' | 'height' | 'children'
|
|
12
|
+
> &
|
|
13
|
+
ImageLayout & {
|
|
14
|
+
/** Image URL. Use srcSet and sizes for responsive sources. */
|
|
15
|
+
src: string
|
|
16
|
+
/** Describe meaningful images; explicitly use an empty string for decoration. */
|
|
17
|
+
alt: string
|
|
18
|
+
/** How the image fits its box. @default 'cover' */
|
|
19
|
+
fit?: 'cover' | 'contain'
|
|
20
|
+
/** CSS object-position, e.g. 'center' or '50% 25%'. */
|
|
21
|
+
position?: React.CSSProperties['objectPosition']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A native image with required alt text and explicit space allocation.
|
|
26
|
+
* Supply intrinsic width/height, or use fill inside a positioned, sized parent.
|
|
27
|
+
* Defaults to lazy loading; use loading="eager" and fetchPriority="high" for a hero.
|
|
28
|
+
* This component does not resize, optimize, or generate image sources.
|
|
29
|
+
*/
|
|
30
|
+
const Image = React.forwardRef<HTMLImageElement, ImageProps>(function Image(
|
|
31
|
+
{
|
|
32
|
+
src,
|
|
33
|
+
alt,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
fill = false,
|
|
37
|
+
fit = 'cover',
|
|
38
|
+
position,
|
|
39
|
+
loading = 'lazy',
|
|
40
|
+
decoding = 'async',
|
|
41
|
+
className,
|
|
42
|
+
style,
|
|
43
|
+
...props
|
|
44
|
+
},
|
|
45
|
+
ref,
|
|
46
|
+
) {
|
|
47
|
+
return (
|
|
48
|
+
<img
|
|
49
|
+
{...props}
|
|
50
|
+
ref={ref}
|
|
51
|
+
data-slot="image"
|
|
52
|
+
src={src}
|
|
53
|
+
alt={alt}
|
|
54
|
+
width={width}
|
|
55
|
+
height={height}
|
|
56
|
+
loading={loading}
|
|
57
|
+
decoding={decoding}
|
|
58
|
+
className={cn(
|
|
59
|
+
'block rounded-lg bg-muted',
|
|
60
|
+
fill ? 'absolute inset-0 size-full' : 'h-auto max-w-full',
|
|
61
|
+
fit === 'cover' ? 'object-cover' : 'object-contain',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
style={{ objectPosition: position, ...style }}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
export { Image }
|