@leitware/composables 3.0.0 → 3.1.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/dist/styles.css +1 -1
- package/package.json +11 -10
- package/rules/composables.md +15 -13
- package/skills/use-composables/references/public-api.md +2 -2
- package/src/_internal/ai-elements/reasoning.tsx +2 -0
- package/src/index.ts +23 -0
- package/src/opinionated/command.tsx +23 -0
- package/src/opinionated/data-grid.tsx +125 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitware/composables",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"dist",
|
|
14
14
|
"rules",
|
|
15
15
|
"skills",
|
|
16
|
-
"src"
|
|
16
|
+
"src",
|
|
17
|
+
"!src/**/*.stories.tsx",
|
|
18
|
+
"!src/_storybook"
|
|
17
19
|
],
|
|
18
20
|
"exports": {
|
|
19
21
|
".": "./src/index.ts",
|
|
@@ -45,6 +47,7 @@
|
|
|
45
47
|
"@base-ui/react": "^1.6.0",
|
|
46
48
|
"class-variance-authority": "^0.7.1",
|
|
47
49
|
"clsx": "^2.1.1",
|
|
50
|
+
"cmdk": "^1.1.1",
|
|
48
51
|
"embla-carousel-react": "^8.6.0",
|
|
49
52
|
"lucide-react": "^1.23.0",
|
|
50
53
|
"radix-ui": "^1.0.0",
|
|
@@ -78,7 +81,6 @@
|
|
|
78
81
|
"use-stick-to-bottom": "^1.0.0",
|
|
79
82
|
"nanoid": "^5.0.0",
|
|
80
83
|
"@radix-ui/react-use-controllable-state": "^1.0.0",
|
|
81
|
-
"cmdk": "^1.0.0",
|
|
82
84
|
"motion": "^12.0.0"
|
|
83
85
|
},
|
|
84
86
|
"peerDependenciesMeta": {
|
|
@@ -142,9 +144,6 @@
|
|
|
142
144
|
"@radix-ui/react-use-controllable-state": {
|
|
143
145
|
"optional": true
|
|
144
146
|
},
|
|
145
|
-
"cmdk": {
|
|
146
|
-
"optional": true
|
|
147
|
-
},
|
|
148
147
|
"motion": {
|
|
149
148
|
"optional": true
|
|
150
149
|
}
|
|
@@ -161,6 +160,10 @@
|
|
|
161
160
|
"@fontsource/ibm-plex-mono": "^5.2.7",
|
|
162
161
|
"@fontsource/ibm-plex-sans": "^5.2.8",
|
|
163
162
|
"@radix-ui/react-use-controllable-state": "^1.2.3",
|
|
163
|
+
"@storybook/addon-a11y": "^10.6.2",
|
|
164
|
+
"@storybook/addon-docs": "^10.6.2",
|
|
165
|
+
"@storybook/addon-links": "^10.6.2",
|
|
166
|
+
"@storybook/react-vite": "^10.6.2",
|
|
164
167
|
"@streamdown/cjk": "^1.0.3",
|
|
165
168
|
"@streamdown/code": "^1.1.1",
|
|
166
169
|
"@streamdown/math": "^1.0.2",
|
|
@@ -172,7 +175,6 @@
|
|
|
172
175
|
"@types/react-dom": "^19.2.3",
|
|
173
176
|
"@vitejs/plugin-react": "^6.0.3",
|
|
174
177
|
"ai": "^7.0.14",
|
|
175
|
-
"cmdk": "^1.1.1",
|
|
176
178
|
"motion": "^12.42.2",
|
|
177
179
|
"nanoid": "^5.1.16",
|
|
178
180
|
"oxfmt": "^0.57.0",
|
|
@@ -181,14 +183,13 @@
|
|
|
181
183
|
"react-dom": "^19.2.7",
|
|
182
184
|
"shadcn": "^4.13.0",
|
|
183
185
|
"shiki": "^4.3.0",
|
|
186
|
+
"storybook": "^10.6.2",
|
|
184
187
|
"streamdown": "^2.5.0",
|
|
185
188
|
"tailwindcss": "^4.3.2",
|
|
186
189
|
"tw-animate-css": "^1.4.0",
|
|
187
190
|
"typescript": "^6.0.3",
|
|
188
191
|
"use-stick-to-bottom": "^1.1.6",
|
|
189
192
|
"vite": "^8.1.3",
|
|
190
|
-
"wrangler": "^4.107.0"
|
|
191
|
-
"storybook": "^10.6.1",
|
|
192
|
-
"@storybook/react-vite": "^10.6.1"
|
|
193
|
+
"wrangler": "^4.107.0"
|
|
193
194
|
}
|
|
194
195
|
}
|
package/rules/composables.md
CHANGED
|
@@ -179,19 +179,21 @@ Use this catalog to choose public exports. The `Source module` column is for mai
|
|
|
179
179
|
|
|
180
180
|
### Other Public Exports
|
|
181
181
|
|
|
182
|
-
| Module | Source module | Import from | Public values | Public types
|
|
183
|
-
| --------------------------------- | ----------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
184
|
-
| `aspect-ratio` | `./opinionated/aspect-ratio` | `@leitware/composables` | `AspectRatio` | -
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
182
|
+
| Module | Source module | Import from | Public values | Public types | Description |
|
|
183
|
+
| --------------------------------- | ----------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
184
|
+
| `aspect-ratio` | `./opinionated/aspect-ratio` | `@leitware/composables` | `AspectRatio` | - | Public export not listed in the README component catalog. |
|
|
185
|
+
| `command` | `./opinionated/command` | `@leitware/composables` | `Command`, `CommandDialog`, `CommandEmpty`, `CommandGroup`, `CommandInput`, `CommandItem`, `CommandList`, `CommandSeparator`, `CommandShortcut` | - | Public export not listed in the README component catalog. |
|
|
186
|
+
| `data-grid` | `./opinionated/data-grid` | `@leitware/composables` | `DataGrid`, `DataLabel`, `DataRow`, `DataValue` | `DataGridProps`, `DataLabelProps`, `DataRowProps`, `DataValueProps` | Public export not listed in the README component catalog. |
|
|
187
|
+
| `direction` | `./opinionated/direction` | `@leitware/composables` | `DirectionProvider`, `useDirection` | `DirectionProviderProps`, `TextDirection` | Public export not listed in the README component catalog. |
|
|
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
|
+
| `grid-overlay` | `./opinionated/grid-overlay` | `@leitware/composables` | `GridOverlay` | `GridOverlayProps` | Public export not listed in the README component catalog. |
|
|
190
|
+
| `input-group` | `./opinionated/input-group` | `@leitware/composables` | `InputGroup`, `InputGroupAddon`, `InputGroupButton`, `InputGroupInput`, `InputGroupTextarea` | - | Public export not listed in the README component catalog. |
|
|
191
|
+
| `input` | `./opinionated/input` | `@leitware/composables` | `Input` | - | Public export not listed in the README component catalog. |
|
|
192
|
+
| `label` | `./opinionated/label` | `@leitware/composables` | `Label` | - | Public export not listed in the README component catalog. |
|
|
193
|
+
| `spinner` | `./opinionated/spinner` | `@leitware/composables` | `Spinner`, `spinnerVariants` | - | Public export not listed in the README component catalog. |
|
|
194
|
+
| `textarea` | `./opinionated/textarea` | `@leitware/composables` | `Textarea` | - | Public export not listed in the README component catalog. |
|
|
195
|
+
| `use-table-of-contents-active-id` | `./hooks/use-table-of-contents-active-id` | `@leitware/composables` | `useTableOfContentsActiveId` | `TableOfContentsTrackingOptions` | Public export not listed in the README component catalog. |
|
|
196
|
+
| `window-frame` | `./opinionated/window-frame` | `@leitware/composables` | `WindowFrame` | `WindowFrameProps` | Public export not listed in the README component catalog. |
|
|
195
197
|
|
|
196
198
|
## AI Entrypoint Catalog
|
|
197
199
|
|
|
@@ -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 (359): `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`, `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 (116): `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`, `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
|
@@ -135,6 +135,18 @@ export {
|
|
|
135
135
|
type ComboboxProps,
|
|
136
136
|
} from './opinionated/combobox'
|
|
137
137
|
|
|
138
|
+
export {
|
|
139
|
+
Command,
|
|
140
|
+
CommandDialog,
|
|
141
|
+
CommandEmpty,
|
|
142
|
+
CommandGroup,
|
|
143
|
+
CommandInput,
|
|
144
|
+
CommandItem,
|
|
145
|
+
CommandList,
|
|
146
|
+
CommandSeparator,
|
|
147
|
+
CommandShortcut,
|
|
148
|
+
} from './opinionated/command'
|
|
149
|
+
|
|
138
150
|
export { Container, type ContainerProps } from './opinionated/container'
|
|
139
151
|
|
|
140
152
|
export {
|
|
@@ -149,6 +161,17 @@ export {
|
|
|
149
161
|
type DialogProps,
|
|
150
162
|
} from './opinionated/dialog'
|
|
151
163
|
|
|
164
|
+
export {
|
|
165
|
+
DataGrid,
|
|
166
|
+
DataLabel,
|
|
167
|
+
DataRow,
|
|
168
|
+
DataValue,
|
|
169
|
+
type DataGridProps,
|
|
170
|
+
type DataLabelProps,
|
|
171
|
+
type DataRowProps,
|
|
172
|
+
type DataValueProps,
|
|
173
|
+
} from './opinionated/data-grid'
|
|
174
|
+
|
|
152
175
|
export { Divider, type DividerProps } from './opinionated/divider'
|
|
153
176
|
|
|
154
177
|
export {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Command,
|
|
3
|
+
CommandDialog,
|
|
4
|
+
CommandEmpty,
|
|
5
|
+
CommandGroup,
|
|
6
|
+
CommandInput,
|
|
7
|
+
CommandItem,
|
|
8
|
+
CommandList,
|
|
9
|
+
CommandSeparator,
|
|
10
|
+
CommandShortcut,
|
|
11
|
+
} from '../_internal/command'
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
Command,
|
|
15
|
+
CommandDialog,
|
|
16
|
+
CommandEmpty,
|
|
17
|
+
CommandGroup,
|
|
18
|
+
CommandInput,
|
|
19
|
+
CommandItem,
|
|
20
|
+
CommandList,
|
|
21
|
+
CommandSeparator,
|
|
22
|
+
CommandShortcut,
|
|
23
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type * as React from 'react'
|
|
2
|
+
import { Typography } from './typography'
|
|
3
|
+
import { cn } from '../lib/utils'
|
|
4
|
+
|
|
5
|
+
export interface DataGridProps extends React.ComponentProps<'dl'> {
|
|
6
|
+
/**
|
|
7
|
+
* Children data rows
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Container for data rows. Displays rows in a vertical stack.
|
|
14
|
+
* Uses semantic HTML (`<dl>`) for better accessibility.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <DataGrid>
|
|
19
|
+
* <DataRow>
|
|
20
|
+
* <DataLabel>Name</DataLabel>
|
|
21
|
+
* <DataValue>John Doe</DataValue>
|
|
22
|
+
* </DataRow>
|
|
23
|
+
* </DataGrid>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function DataGrid({ children, className, ...props }: DataGridProps) {
|
|
27
|
+
return (
|
|
28
|
+
<dl className={cn('flex flex-col gap-1.5', className)} {...props}>
|
|
29
|
+
{children}
|
|
30
|
+
</dl>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface DataRowProps extends React.ComponentProps<'div'> {
|
|
35
|
+
/**
|
|
36
|
+
* Children should be DataLabel and DataValue components
|
|
37
|
+
*/
|
|
38
|
+
children: React.ReactNode
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A single row containing a label and value pair.
|
|
43
|
+
* Displays in a responsive layout: stacked on mobile, 2-column grid on desktop.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <DataRow>
|
|
48
|
+
* <DataLabel>Email</DataLabel>
|
|
49
|
+
* <DataValue>user@example.com</DataValue>
|
|
50
|
+
* </DataRow>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export function DataRow({ children, className, ...props }: DataRowProps) {
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
className={cn(
|
|
57
|
+
'flex flex-col gap-1 md:grid md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:gap-2 items-start min-w-0',
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface DataLabelProps extends React.ComponentProps<'dt'> {
|
|
68
|
+
/**
|
|
69
|
+
* Label text
|
|
70
|
+
*/
|
|
71
|
+
children: React.ReactNode
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Label component for data rows. Displays muted text.
|
|
76
|
+
* Uses semantic HTML (`<dt>`) for better accessibility.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <DataLabel>Email address</DataLabel>
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function DataLabel({ children, className, ...props }: DataLabelProps) {
|
|
84
|
+
return (
|
|
85
|
+
<dt className={cn('break-words min-w-0', className)} {...props}>
|
|
86
|
+
<Typography variant="body-100" className="font-normal text-muted-foreground">
|
|
87
|
+
{children}
|
|
88
|
+
</Typography>
|
|
89
|
+
</dt>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DataValueProps extends React.ComponentProps<'dd'> {
|
|
94
|
+
/**
|
|
95
|
+
* Value content. Can contain multiple children for complex values.
|
|
96
|
+
* Renders empty string if children are null or undefined.
|
|
97
|
+
*/
|
|
98
|
+
children: React.ReactNode
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Value component for data rows. Displays small text and supports multiple children.
|
|
103
|
+
* Uses semantic HTML (`<dd>`) for better accessibility.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* // Simple value
|
|
108
|
+
* <DataValue>John Doe</DataValue>
|
|
109
|
+
*
|
|
110
|
+
* // Complex value with multiple children
|
|
111
|
+
* <DataValue>
|
|
112
|
+
* <span>£1,000</span>
|
|
113
|
+
* <span className="text-muted">(Calculated)</span>
|
|
114
|
+
* </DataValue>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function DataValue({ children, className, ...props }: DataValueProps) {
|
|
118
|
+
return (
|
|
119
|
+
<dd className={cn('break-words min-w-0', className)} {...props}>
|
|
120
|
+
<Typography variant="body-100" className="font-normal">
|
|
121
|
+
{children}
|
|
122
|
+
</Typography>
|
|
123
|
+
</dd>
|
|
124
|
+
)
|
|
125
|
+
}
|