@leitware/composables 0.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/LICENSE +21 -0
- package/README.md +387 -0
- package/dist/presets/brutalist.css +298 -0
- package/dist/presets/default.css +298 -0
- package/dist/presets/signal-pop.css +369 -0
- package/dist/styles.css +2 -0
- package/package.json +216 -0
- package/rules/composables.md +244 -0
- package/src/_internal/accordion.tsx +93 -0
- package/src/_internal/ai-elements/attachments.tsx +385 -0
- package/src/_internal/ai-elements/chain-of-thought.tsx +197 -0
- package/src/_internal/ai-elements/code-block.tsx +516 -0
- package/src/_internal/ai-elements/confirmation.tsx +150 -0
- package/src/_internal/ai-elements/conversation.tsx +148 -0
- package/src/_internal/ai-elements/inline-citation.tsx +248 -0
- package/src/_internal/ai-elements/message.tsx +292 -0
- package/src/_internal/ai-elements/plan.tsx +126 -0
- package/src/_internal/ai-elements/prompt-input.tsx +1285 -0
- package/src/_internal/ai-elements/reasoning.tsx +208 -0
- package/src/_internal/ai-elements/shimmer.tsx +72 -0
- package/src/_internal/ai-elements/sources.tsx +53 -0
- package/src/_internal/ai-elements/suggestion.tsx +48 -0
- package/src/_internal/ai-elements/task.tsx +64 -0
- package/src/_internal/ai-elements/tool.tsx +156 -0
- package/src/_internal/alert-dialog.tsx +159 -0
- package/src/_internal/alert.tsx +88 -0
- package/src/_internal/aspect-ratio.tsx +23 -0
- package/src/_internal/avatar.tsx +58 -0
- package/src/_internal/badge.tsx +60 -0
- package/src/_internal/breadcrumb.tsx +104 -0
- package/src/_internal/bubble.tsx +125 -0
- package/src/_internal/button-group.tsx +78 -0
- package/src/_internal/button.tsx +62 -0
- package/src/_internal/calendar.tsx +179 -0
- package/src/_internal/card.tsx +83 -0
- package/src/_internal/carousel.tsx +215 -0
- package/src/_internal/checkbox.tsx +26 -0
- package/src/_internal/code-block.tsx +53 -0
- package/src/_internal/collapsible.tsx +15 -0
- package/src/_internal/combobox.tsx +264 -0
- package/src/_internal/command.tsx +155 -0
- package/src/_internal/container.tsx +35 -0
- package/src/_internal/dialog.tsx +132 -0
- package/src/_internal/direction.tsx +12 -0
- package/src/_internal/divider.tsx +162 -0
- package/src/_internal/dropdown-menu.tsx +247 -0
- package/src/_internal/dropzone.tsx +481 -0
- package/src/_internal/empty.tsx +94 -0
- package/src/_internal/field.tsx +221 -0
- package/src/_internal/grid-overlay.tsx +48 -0
- package/src/_internal/grid.tsx +109 -0
- package/src/_internal/hover-card.tsx +47 -0
- package/src/_internal/icon.tsx +45 -0
- package/src/_internal/input-group.tsx +146 -0
- package/src/_internal/input.tsx +24 -0
- package/src/_internal/item.tsx +187 -0
- package/src/_internal/kbd.tsx +28 -0
- package/src/_internal/label.tsx +18 -0
- package/src/_internal/layout-bento.tsx +386 -0
- package/src/_internal/layout.tsx +174 -0
- package/src/_internal/marker.tsx +66 -0
- package/src/_internal/message.tsx +85 -0
- package/src/_internal/native-select.tsx +50 -0
- package/src/_internal/pagination.tsx +108 -0
- package/src/_internal/popover.tsx +83 -0
- package/src/_internal/progress.tsx +59 -0
- package/src/_internal/radio-group.tsx +36 -0
- package/src/_internal/resizable.tsx +44 -0
- package/src/_internal/scroll-area.tsx +48 -0
- package/src/_internal/select.tsx +187 -0
- package/src/_internal/separator.tsx +19 -0
- package/src/_internal/sheet.tsx +122 -0
- package/src/_internal/sidebar.tsx +687 -0
- package/src/_internal/skeleton.tsx +13 -0
- package/src/_internal/slider.tsx +60 -0
- package/src/_internal/sonner.tsx +51 -0
- package/src/_internal/spacer.tsx +42 -0
- package/src/_internal/spinner.tsx +16 -0
- package/src/_internal/stack.tsx +78 -0
- package/src/_internal/switch.tsx +31 -0
- package/src/_internal/table.tsx +84 -0
- package/src/_internal/tabs.tsx +74 -0
- package/src/_internal/textarea.tsx +19 -0
- package/src/_internal/toggle-group.tsx +99 -0
- package/src/_internal/toggle.tsx +42 -0
- package/src/_internal/tooltip.tsx +55 -0
- package/src/_internal/typography.tsx +129 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-numeric-input.ts +119 -0
- package/src/index.ts +443 -0
- package/src/lib/numeric-input.ts +88 -0
- package/src/lib/utils.ts +39 -0
- package/src/opinionated/accordion.tsx +92 -0
- package/src/opinionated/ai/attachments.tsx +27 -0
- package/src/opinionated/ai/chain-of-thought.tsx +16 -0
- package/src/opinionated/ai/code-block.tsx +22 -0
- package/src/opinionated/ai/confirmation.tsx +16 -0
- package/src/opinionated/ai/conversation.tsx +13 -0
- package/src/opinionated/ai/index.ts +15 -0
- package/src/opinionated/ai/inline-citation.tsx +30 -0
- package/src/opinionated/ai/message.tsx +26 -0
- package/src/opinionated/ai/plan.tsx +18 -0
- package/src/opinionated/ai/prompt-input.tsx +29 -0
- package/src/opinionated/ai/reasoning.tsx +9 -0
- package/src/opinionated/ai/shimmer.tsx +4 -0
- package/src/opinionated/ai/sources.tsx +10 -0
- package/src/opinionated/ai/suggestion.tsx +6 -0
- package/src/opinionated/ai/task.tsx +12 -0
- package/src/opinionated/ai/tool.tsx +14 -0
- package/src/opinionated/alert-dialog.tsx +143 -0
- package/src/opinionated/alert.tsx +99 -0
- package/src/opinionated/aspect-ratio.tsx +12 -0
- package/src/opinionated/avatar.tsx +59 -0
- package/src/opinionated/badge.tsx +33 -0
- package/src/opinionated/breadcrumb.tsx +99 -0
- package/src/opinionated/bubble.tsx +9 -0
- package/src/opinionated/button.tsx +59 -0
- package/src/opinionated/calendar.tsx +20 -0
- package/src/opinionated/card.tsx +83 -0
- package/src/opinionated/carousel.tsx +99 -0
- package/src/opinionated/checkbox.tsx +11 -0
- package/src/opinionated/code-block.tsx +12 -0
- package/src/opinionated/collapsible.tsx +123 -0
- package/src/opinionated/combobox.tsx +123 -0
- package/src/opinionated/container.tsx +12 -0
- package/src/opinionated/dialog.tsx +124 -0
- package/src/opinionated/direction.tsx +6 -0
- package/src/opinionated/divider.tsx +13 -0
- package/src/opinionated/dropdown-menu.tsx +131 -0
- package/src/opinionated/dropzone.tsx +39 -0
- package/src/opinionated/empty.tsx +191 -0
- package/src/opinionated/field.tsx +26 -0
- package/src/opinionated/form-calendar-popover.tsx +138 -0
- package/src/opinionated/form-checkbox.tsx +107 -0
- package/src/opinionated/form-combobox.tsx +181 -0
- package/src/opinionated/form-date-of-birth.tsx +193 -0
- package/src/opinionated/form-dropzone.tsx +126 -0
- package/src/opinionated/form-input-group.tsx +184 -0
- package/src/opinionated/form-input.tsx +118 -0
- package/src/opinionated/form-multi-combobox.tsx +213 -0
- package/src/opinionated/form-multi-dropzone.tsx +141 -0
- package/src/opinionated/form-radiogroup.tsx +116 -0
- package/src/opinionated/form-select.tsx +176 -0
- package/src/opinionated/form-slider.tsx +100 -0
- package/src/opinionated/form-switch.tsx +117 -0
- package/src/opinionated/form-textarea.tsx +79 -0
- package/src/opinionated/grid-overlay.tsx +11 -0
- package/src/opinionated/grid.tsx +14 -0
- package/src/opinionated/hover-card.tsx +59 -0
- package/src/opinionated/icon.tsx +14 -0
- package/src/opinionated/input-group.tsx +20 -0
- package/src/opinionated/input.tsx +11 -0
- package/src/opinionated/item.tsx +182 -0
- package/src/opinionated/kbd.tsx +16 -0
- package/src/opinionated/label.tsx +11 -0
- package/src/opinionated/layout-bento.tsx +29 -0
- package/src/opinionated/layout.tsx +26 -0
- package/src/opinionated/list.tsx +94 -0
- package/src/opinionated/marker.tsx +7 -0
- package/src/opinionated/message.tsx +8 -0
- package/src/opinionated/native-select.tsx +51 -0
- package/src/opinionated/pagination.tsx +204 -0
- package/src/opinionated/popover.tsx +68 -0
- package/src/opinionated/progress.tsx +48 -0
- package/src/opinionated/radio-group.tsx +13 -0
- package/src/opinionated/resizable.tsx +2 -0
- package/src/opinionated/scroll-area.tsx +82 -0
- package/src/opinionated/select.tsx +101 -0
- package/src/opinionated/separator.tsx +11 -0
- package/src/opinionated/sheet.tsx +120 -0
- package/src/opinionated/sidebar.tsx +68 -0
- package/src/opinionated/skeleton.tsx +246 -0
- package/src/opinionated/slider.tsx +11 -0
- package/src/opinionated/sonner.tsx +15 -0
- package/src/opinionated/spacer.tsx +11 -0
- package/src/opinionated/stack.tsx +18 -0
- package/src/opinionated/switch.tsx +11 -0
- package/src/opinionated/table.tsx +11 -0
- package/src/opinionated/tabs.tsx +68 -0
- package/src/opinionated/textarea.tsx +11 -0
- package/src/opinionated/theme-injector.tsx +31 -0
- package/src/opinionated/toggle-group.tsx +63 -0
- package/src/opinionated/toggle.tsx +75 -0
- package/src/opinionated/token-config-panel/color-editor.tsx +85 -0
- package/src/opinionated/token-config-panel/helpers.ts +31 -0
- package/src/opinionated/token-config-panel/index.tsx +398 -0
- package/src/opinionated/token-config-panel/json-import-export.tsx +89 -0
- package/src/opinionated/token-config-panel/preset-manager.ts +31 -0
- package/src/opinionated/token-config-panel/presets-data.ts +23 -0
- package/src/opinionated/token-config-panel/spacing-editor.tsx +325 -0
- package/src/opinionated/token-config-panel/types.ts +39 -0
- package/src/opinionated/token-config-panel/typography-editor.tsx +145 -0
- package/src/opinionated/tooltip.tsx +62 -0
- package/src/opinionated/typography.tsx +7 -0
- package/src/scripts/lint-no-arbitrary.ts +155 -0
- package/src/styles/composable.css +68 -0
- package/src/styles/presets/brutalist.css +298 -0
- package/src/styles/presets/default.css +298 -0
- package/src/styles/presets/signal-pop.css +369 -0
- package/src/styles/presets-data/brutalist.ts +325 -0
- package/src/styles/presets-data/default.ts +315 -0
- package/src/styles/presets-data/index.ts +45 -0
- package/src/styles/presets-data/signal-pop.ts +393 -0
- package/src/styles/tokens/base.css +71 -0
- package/src/styles/tokens/components.css +150 -0
- package/src/styles/tokens/palette.css +795 -0
- package/src/styles/tokens/registry.ts +324 -0
- package/src/styles/tokens/semantic.css +266 -0
- package/src/styles/tokens/tailwind-theme.css +247 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Primitives
|
|
3
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
* Rigid, snap-to-grid composable layout building blocks for structured UIs.
|
|
5
|
+
* Enforces the spacing and border system.
|
|
6
|
+
*
|
|
7
|
+
* BORDERS NEVER STACK RULES:
|
|
8
|
+
* • Stack/Row gaps use margin (not padding) — items never double-border.
|
|
9
|
+
* • NewspaperGrid: container holds border-t + border-l.
|
|
10
|
+
* NewspaperCell adds border-b + border-r → each edge drawn exactly once.
|
|
11
|
+
* • Use `border-[length:var(--border-width)]` throughout, never hardcoded 1px.
|
|
12
|
+
*
|
|
13
|
+
* SPACING:
|
|
14
|
+
* All padding/gap values pull from semantic tokens.
|
|
15
|
+
* Macro layout values come from --space-layout-sm/md/lg (derived from base --spacing).
|
|
16
|
+
* Fine-grained spacing uses Tailwind's spacing scale (based on --spacing base token).
|
|
17
|
+
*
|
|
18
|
+
* Semantic tokens (set in your CSS or a preset):
|
|
19
|
+
*
|
|
20
|
+
* --space-layout-sm Section macro spacing small (default: calc(var(--spacing) * 6))
|
|
21
|
+
* --space-layout-md Section macro spacing medium (default: calc(var(--spacing) * 12))
|
|
22
|
+
* --space-layout-lg Section macro spacing large (default: calc(var(--spacing) * 24))
|
|
23
|
+
* --border-width Border thickness token (default: var(--border-width-base))
|
|
24
|
+
*
|
|
25
|
+
* All components use `data-slot` for structural targeting and CVA for variants.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import * as React from 'react'
|
|
29
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
30
|
+
|
|
31
|
+
import { cn } from '../lib/utils'
|
|
32
|
+
|
|
33
|
+
// ─── SECTION ──────────────────────────────────────────────────────────────────
|
|
34
|
+
//
|
|
35
|
+
// Page-level section wrapper with macro spacing tokens.
|
|
36
|
+
// Spacing drives py (vertical padding) — sm=spacing*6, md=spacing*12, lg=spacing*24.
|
|
37
|
+
|
|
38
|
+
const sectionVariants = cva('w-full', {
|
|
39
|
+
variants: {
|
|
40
|
+
spacing: {
|
|
41
|
+
sm: 'py-[var(--space-layout-sm,calc(var(--spacing)*6))]',
|
|
42
|
+
md: 'py-[var(--space-layout-md,calc(var(--spacing)*12))]',
|
|
43
|
+
lg: 'py-[var(--space-layout-lg,calc(var(--spacing)*24))]',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
spacing: 'md',
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
type SectionProps = React.ComponentProps<'section'> & VariantProps<typeof sectionVariants>
|
|
52
|
+
|
|
53
|
+
function Section({ className, spacing, ...props }: SectionProps) {
|
|
54
|
+
return (
|
|
55
|
+
<section
|
|
56
|
+
data-slot="section"
|
|
57
|
+
className={cn(sectionVariants({ spacing }), className)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ─── SPACER ───────────────────────────────────────────────────────────────────
|
|
64
|
+
//
|
|
65
|
+
// Flex-grow spacer for pushing content apart inside flex containers.
|
|
66
|
+
// aria-hidden: decorative — not meaningful to assistive tech.
|
|
67
|
+
|
|
68
|
+
function FlexSpacer({ className, ...props }: React.ComponentProps<'div'>) {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
data-slot="flex-spacer"
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
className={cn('flex-1', className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ─── NEWSPAPER GRID ───────────────────────────────────────────────────────────
|
|
80
|
+
//
|
|
81
|
+
// Composable CSS grid using the newspaper-border pattern.
|
|
82
|
+
// (Named NewspaperGrid to distinguish from layout-bento's BentoGrid, which uses
|
|
83
|
+
// gap-as-border rather than this edge-sharing approach.)
|
|
84
|
+
//
|
|
85
|
+
// Border rule — "each edge drawn exactly once":
|
|
86
|
+
// Container: border-t + border-l (outer frame — top and left)
|
|
87
|
+
// NewspaperCell: border-b + border-r (completes each cell — bottom and right)
|
|
88
|
+
//
|
|
89
|
+
// Result: every grid line is a single border, never doubled.
|
|
90
|
+
// Use `border-[length:var(--border-width)]` throughout — never hardcoded px.
|
|
91
|
+
|
|
92
|
+
const newspaperGridVariants = cva(
|
|
93
|
+
[
|
|
94
|
+
'grid',
|
|
95
|
+
// Container provides the top + left edge of the newspaper grid
|
|
96
|
+
'border-t-[length:var(--border-width,var(--border-width-base,0.0625rem))]',
|
|
97
|
+
'border-l-[length:var(--border-width,var(--border-width-base,0.0625rem))]',
|
|
98
|
+
'border-foreground',
|
|
99
|
+
].join(' '),
|
|
100
|
+
{
|
|
101
|
+
variants: {
|
|
102
|
+
cols: {
|
|
103
|
+
1: 'grid-cols-1',
|
|
104
|
+
2: 'grid-cols-2',
|
|
105
|
+
3: 'grid-cols-3',
|
|
106
|
+
4: 'grid-cols-4',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
defaultVariants: {
|
|
110
|
+
cols: 3,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
type NewspaperGridProps = React.ComponentProps<'div'> & VariantProps<typeof newspaperGridVariants>
|
|
116
|
+
|
|
117
|
+
function NewspaperGrid({ className, cols, ...props }: NewspaperGridProps) {
|
|
118
|
+
return (
|
|
119
|
+
<div
|
|
120
|
+
data-slot="newspaper-grid"
|
|
121
|
+
className={cn(newspaperGridVariants({ cols }), className)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ─── NEWSPAPER CELL ───────────────────────────────────────────────────────────
|
|
128
|
+
//
|
|
129
|
+
// A single cell within NewspaperGrid. Provides the bottom + right border edges
|
|
130
|
+
// (newspaper rule — completes the grid line each container started).
|
|
131
|
+
//
|
|
132
|
+
// span — column span (1–4)
|
|
133
|
+
// rowSpan — row span (1–3)
|
|
134
|
+
|
|
135
|
+
const COL_SPANS: Record<1 | 2 | 3 | 4, string> = {
|
|
136
|
+
1: 'col-span-1',
|
|
137
|
+
2: 'col-span-2',
|
|
138
|
+
3: 'col-span-3',
|
|
139
|
+
4: 'col-span-4',
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const ROW_SPANS: Record<1 | 2 | 3, string> = {
|
|
143
|
+
1: 'row-span-1',
|
|
144
|
+
2: 'row-span-2',
|
|
145
|
+
3: 'row-span-3',
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Cell border classes — bottom + right complete the newspaper grid rule
|
|
149
|
+
const CELL_BORDERS = [
|
|
150
|
+
'border-b-[length:var(--border-width,var(--border-width-base,0.0625rem))]',
|
|
151
|
+
'border-r-[length:var(--border-width,var(--border-width-base,0.0625rem))]',
|
|
152
|
+
'border-foreground',
|
|
153
|
+
].join(' ')
|
|
154
|
+
|
|
155
|
+
interface NewspaperCellProps extends React.ComponentProps<'div'> {
|
|
156
|
+
/** Number of columns to span (1–4) */
|
|
157
|
+
span?: 1 | 2 | 3 | 4
|
|
158
|
+
/** Number of rows to span (1–3) */
|
|
159
|
+
rowSpan?: 1 | 2 | 3
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function NewspaperCell({ className, span = 1, rowSpan = 1, ...props }: NewspaperCellProps) {
|
|
163
|
+
return (
|
|
164
|
+
<div
|
|
165
|
+
data-slot="newspaper-cell"
|
|
166
|
+
className={cn(COL_SPANS[span], ROW_SPANS[rowSpan], CELL_BORDERS, 'p-4', className)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { Section, sectionVariants, FlexSpacer, NewspaperGrid, newspaperGridVariants, NewspaperCell }
|
|
173
|
+
|
|
174
|
+
export type { SectionProps, NewspaperGridProps, NewspaperCellProps }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
import type * as React from 'react'
|
|
3
|
+
import { Slot } from 'radix-ui'
|
|
4
|
+
|
|
5
|
+
import { cn } from '../lib/utils'
|
|
6
|
+
|
|
7
|
+
const markerVariants = cva(
|
|
8
|
+
'text-muted-foreground group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-xs/relaxed [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_svg:not([class*=size-])]:size-4',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: '',
|
|
13
|
+
separator:
|
|
14
|
+
'before:bg-stroke after:bg-stroke before:mr-1 before:h-px before:min-w-0 before:flex-1 after:ml-1 after:h-px after:min-w-0 after:flex-1',
|
|
15
|
+
border: 'border-b border-stroke pb-2',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export interface MarkerProps
|
|
25
|
+
extends React.ComponentProps<'div'>, VariantProps<typeof markerVariants> {
|
|
26
|
+
asChild?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function Marker({ className, variant = 'default', asChild = false, ...props }: MarkerProps) {
|
|
30
|
+
const Comp = asChild ? Slot.Root : 'div'
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Comp
|
|
34
|
+
data-slot="marker"
|
|
35
|
+
data-variant={variant}
|
|
36
|
+
className={cn(markerVariants({ variant, className }))}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function MarkerIcon({ className, ...props }: React.ComponentProps<'span'>) {
|
|
43
|
+
return (
|
|
44
|
+
<span
|
|
45
|
+
data-slot="marker-icon"
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
className={cn('size-4 shrink-0 [&_svg:not([class*=size-])]:size-4', className)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function MarkerContent({ className, ...props }: React.ComponentProps<'span'>) {
|
|
54
|
+
return (
|
|
55
|
+
<span
|
|
56
|
+
data-slot="marker-content"
|
|
57
|
+
className={cn(
|
|
58
|
+
'min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Marker, MarkerContent, MarkerIcon, markerVariants }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../lib/utils'
|
|
4
|
+
|
|
5
|
+
function MessageGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="message-group"
|
|
9
|
+
className={cn('flex min-w-0 flex-col gap-2', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function Message({
|
|
16
|
+
className,
|
|
17
|
+
align = 'start',
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<'div'> & { align?: 'start' | 'end' }) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
data-slot="message"
|
|
23
|
+
data-align={align}
|
|
24
|
+
className={cn(
|
|
25
|
+
'group/message relative flex w-full min-w-0 gap-2 text-xs/relaxed data-[align=end]:flex-row-reverse',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function MessageAvatar({ className, ...props }: React.ComponentProps<'div'>) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-slot="message-avatar"
|
|
37
|
+
className={cn(
|
|
38
|
+
'bg-muted flex size-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full group-has-data-[slot=message-footer]/message:-translate-y-8',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function MessageContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
data-slot="message-content"
|
|
50
|
+
className={cn(
|
|
51
|
+
'flex w-full min-w-0 flex-col gap-2 wrap-break-word group-data-[align=end]/message:items-end',
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MessageHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot="message-header"
|
|
63
|
+
className={cn(
|
|
64
|
+
'text-muted-foreground flex max-w-full min-w-0 items-center px-3 text-2xs font-medium group-has-data-[variant=ghost]/message:px-0',
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function MessageFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="message-footer"
|
|
76
|
+
className={cn(
|
|
77
|
+
'text-muted-foreground flex max-w-full min-w-0 items-center px-3 text-2xs font-medium group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end',
|
|
78
|
+
className,
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader }
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type * as React from 'react'
|
|
2
|
+
import { ChevronDownIcon } from 'lucide-react'
|
|
3
|
+
|
|
4
|
+
import { cn, FOCUS_RING } from '../lib/utils'
|
|
5
|
+
|
|
6
|
+
export type NativeSelectSize = 'sm' | 'default'
|
|
7
|
+
|
|
8
|
+
export interface NativeSelectProps extends Omit<React.ComponentProps<'select'>, 'size'> {
|
|
9
|
+
size?: NativeSelectSize
|
|
10
|
+
wrapperClassName?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function NativeSelect({
|
|
14
|
+
className,
|
|
15
|
+
wrapperClassName,
|
|
16
|
+
size = 'default',
|
|
17
|
+
...props
|
|
18
|
+
}: NativeSelectProps) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="native-select-wrapper"
|
|
22
|
+
className={cn('relative w-full has-disabled:opacity-disabled', wrapperClassName)}
|
|
23
|
+
>
|
|
24
|
+
<select
|
|
25
|
+
data-slot="native-select"
|
|
26
|
+
data-size={size}
|
|
27
|
+
className={cn(
|
|
28
|
+
`${FOCUS_RING} border-field bg-page h-(--input-height) w-full appearance-none rounded-(--input-radius) border px-3 py-2 pr-9 text-xs/relaxed shadow-xs outline-none motion-colors disabled:pointer-events-none disabled:cursor-not-allowed data-[size=sm]:h-8 data-[size=sm]:py-1`,
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
<ChevronDownIcon
|
|
34
|
+
data-slot="native-select-icon"
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
className="text-muted-foreground pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 opacity-70"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function NativeSelectOption({ className, ...props }: React.ComponentProps<'option'>) {
|
|
43
|
+
return <option data-slot="native-select-option" className={className} {...props} />
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>) {
|
|
47
|
+
return <optgroup data-slot="native-select-optgroup" className={className} {...props} />
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react'
|
|
2
|
+
import type * as React from 'react'
|
|
3
|
+
import { Button } from './button'
|
|
4
|
+
import { cn } from '../lib/utils'
|
|
5
|
+
|
|
6
|
+
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
7
|
+
return (
|
|
8
|
+
<nav
|
|
9
|
+
aria-label="pagination"
|
|
10
|
+
data-slot="pagination"
|
|
11
|
+
className={cn('mx-auto flex w-full justify-center', className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function PaginationContent({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
18
|
+
return (
|
|
19
|
+
<ul
|
|
20
|
+
data-slot="pagination-content"
|
|
21
|
+
className={cn('gap-0.5 flex items-center', className)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
|
|
28
|
+
return <li data-slot="pagination-item" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type PaginationLinkProps = {
|
|
32
|
+
isActive?: boolean
|
|
33
|
+
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
|
|
34
|
+
React.ComponentProps<'a'>
|
|
35
|
+
|
|
36
|
+
function PaginationLink({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) {
|
|
37
|
+
return (
|
|
38
|
+
<Button
|
|
39
|
+
variant={isActive ? 'outline' : 'ghost'}
|
|
40
|
+
size={size}
|
|
41
|
+
className={cn(className)}
|
|
42
|
+
nativeButton={false}
|
|
43
|
+
render={
|
|
44
|
+
<a
|
|
45
|
+
aria-current={isActive ? 'page' : undefined}
|
|
46
|
+
data-slot="pagination-link"
|
|
47
|
+
data-active={isActive}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
56
|
+
return (
|
|
57
|
+
<PaginationLink
|
|
58
|
+
aria-label="Go to previous page"
|
|
59
|
+
size="default"
|
|
60
|
+
className={cn('pl-2!', className)}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<ChevronLeftIcon data-icon="inline-start" />
|
|
64
|
+
<span className="hidden sm:block">Previous</span>
|
|
65
|
+
</PaginationLink>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
70
|
+
return (
|
|
71
|
+
<PaginationLink
|
|
72
|
+
aria-label="Go to next page"
|
|
73
|
+
size="default"
|
|
74
|
+
className={cn('pr-2!', className)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<span className="hidden sm:block">Next</span>
|
|
78
|
+
<ChevronRightIcon data-icon="inline-end" />
|
|
79
|
+
</PaginationLink>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
|
|
84
|
+
return (
|
|
85
|
+
<span
|
|
86
|
+
aria-hidden
|
|
87
|
+
data-slot="pagination-ellipsis"
|
|
88
|
+
className={cn(
|
|
89
|
+
"size-7 items-center justify-center [&_svg:not([class*='size-'])]:size-3.5 flex items-center justify-center",
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
>
|
|
94
|
+
<MoreHorizontalIcon />
|
|
95
|
+
<span className="sr-only">More pages</span>
|
|
96
|
+
</span>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
Pagination,
|
|
102
|
+
PaginationContent,
|
|
103
|
+
PaginationEllipsis,
|
|
104
|
+
PaginationItem,
|
|
105
|
+
PaginationLink,
|
|
106
|
+
PaginationNext,
|
|
107
|
+
PaginationPrevious,
|
|
108
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Popover as PopoverPrimitive } from '@base-ui/react/popover'
|
|
2
|
+
import type * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { cn } from '../lib/utils'
|
|
5
|
+
|
|
6
|
+
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
|
|
7
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function PopoverTrigger({
|
|
11
|
+
render,
|
|
12
|
+
...props
|
|
13
|
+
}: PopoverPrimitive.Trigger.Props & {
|
|
14
|
+
render?: React.ReactElement
|
|
15
|
+
}) {
|
|
16
|
+
if (render) {
|
|
17
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" render={render} {...props} />
|
|
18
|
+
}
|
|
19
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function PopoverContent({
|
|
23
|
+
className,
|
|
24
|
+
align = 'center',
|
|
25
|
+
alignOffset = 0,
|
|
26
|
+
side = 'bottom',
|
|
27
|
+
sideOffset = 4,
|
|
28
|
+
...props
|
|
29
|
+
}: PopoverPrimitive.Popup.Props &
|
|
30
|
+
Pick<PopoverPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
31
|
+
return (
|
|
32
|
+
<PopoverPrimitive.Portal>
|
|
33
|
+
<PopoverPrimitive.Positioner
|
|
34
|
+
align={align}
|
|
35
|
+
alignOffset={alignOffset}
|
|
36
|
+
side={side}
|
|
37
|
+
sideOffset={sideOffset}
|
|
38
|
+
className="isolate z-popover"
|
|
39
|
+
>
|
|
40
|
+
<PopoverPrimitive.Popup
|
|
41
|
+
data-slot="popover-content"
|
|
42
|
+
className={cn(
|
|
43
|
+
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-4 rounded-lg p-2.5 text-xs shadow-md ring-[length:var(--border-width)] duration-fast z-popover w-72 origin-(--transform-origin) outline-hidden',
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
</PopoverPrimitive.Positioner>
|
|
49
|
+
</PopoverPrimitive.Portal>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
data-slot="popover-header"
|
|
57
|
+
className={cn('flex flex-col gap-1 text-xs', className)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
|
|
64
|
+
return (
|
|
65
|
+
<PopoverPrimitive.Title
|
|
66
|
+
data-slot="popover-title"
|
|
67
|
+
className={cn('text-sm font-medium', className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {
|
|
74
|
+
return (
|
|
75
|
+
<PopoverPrimitive.Description
|
|
76
|
+
data-slot="popover-description"
|
|
77
|
+
className={cn('text-muted-foreground', className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Progress as ProgressPrimitive } from '@base-ui/react/progress'
|
|
2
|
+
|
|
3
|
+
import { cn } from '../lib/utils'
|
|
4
|
+
|
|
5
|
+
function Progress({ className, value, ...props }: ProgressPrimitive.Root.Props) {
|
|
6
|
+
return (
|
|
7
|
+
<ProgressPrimitive.Root
|
|
8
|
+
data-slot="progress"
|
|
9
|
+
value={value}
|
|
10
|
+
className={cn('flex flex-col gap-1', className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
|
|
17
|
+
return (
|
|
18
|
+
<ProgressPrimitive.Track
|
|
19
|
+
data-slot="progress-track"
|
|
20
|
+
className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ProgressIndicator({ className, ...props }: ProgressPrimitive.Indicator.Props) {
|
|
27
|
+
return (
|
|
28
|
+
<ProgressPrimitive.Indicator
|
|
29
|
+
data-slot="progress-indicator"
|
|
30
|
+
className={cn(
|
|
31
|
+
'h-full rounded-full bg-primary transition-[width] duration-normal ease-out',
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
|
|
40
|
+
return (
|
|
41
|
+
<ProgressPrimitive.Label
|
|
42
|
+
data-slot="progress-label"
|
|
43
|
+
className={cn('text-xs font-medium', className)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
|
|
50
|
+
return (
|
|
51
|
+
<ProgressPrimitive.Value
|
|
52
|
+
data-slot="progress-value"
|
|
53
|
+
className={cn('text-xs text-muted-foreground tabular-nums', className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Radio as RadioPrimitive } from '@base-ui/react/radio'
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group'
|
|
3
|
+
import { cn, FOCUS_RING } from '../lib/utils'
|
|
4
|
+
|
|
5
|
+
function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {
|
|
6
|
+
return (
|
|
7
|
+
<RadioGroupPrimitive
|
|
8
|
+
data-slot="radio-group"
|
|
9
|
+
className={cn('grid gap-3 w-full', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {
|
|
16
|
+
return (
|
|
17
|
+
<RadioPrimitive.Root
|
|
18
|
+
data-slot="radio-group-item"
|
|
19
|
+
className={cn(
|
|
20
|
+
FOCUS_RING,
|
|
21
|
+
'border-field dark:bg-field/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary hover:border-foreground/50 flex size-4 rounded-[var(--radius)] transition-shadow group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-disabled',
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
<RadioPrimitive.Indicator
|
|
27
|
+
data-slot="radio-group-indicator"
|
|
28
|
+
className="flex size-4 items-center justify-center"
|
|
29
|
+
>
|
|
30
|
+
<div className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-[var(--radius)] bg-current group-aria-invalid/radio-group-item:bg-danger" />
|
|
31
|
+
</RadioPrimitive.Indicator>
|
|
32
|
+
</RadioPrimitive.Root>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { RadioGroup, RadioGroupItem }
|