@refraction-ui/astro 0.15.2 → 0.16.1

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.
@@ -0,0 +1,66 @@
1
+ ---
2
+ import {
3
+ composerFieldClass,
4
+ composerPrimaryActionVariants,
5
+ composerSurfaceVariants,
6
+ } from '../composer/index.ts'
7
+ import { cn } from '../shared/index.ts'
8
+
9
+ interface Props extends astroHTML.JSX.HTMLAttributes {
10
+ /** Placeholder shown in the (read-only) message area. */
11
+ placeholder?: string
12
+ /** Accessible name of the composer landmark. */
13
+ label?: string
14
+ /** Accessible name of the (disabled) send button. */
15
+ sendLabel?: string
16
+ /** Render the surface in its disabled treatment. */
17
+ disabled?: boolean
18
+ }
19
+
20
+ const {
21
+ placeholder = 'Send a message…',
22
+ label = 'Message composer',
23
+ sendLabel = 'Send',
24
+ disabled = false,
25
+ class: className,
26
+ ...rest
27
+ } = Astro.props
28
+
29
+ const hasContent = Astro.slots.has('default')
30
+ ---
31
+
32
+ {/* Static SSR composer shell: the interactive composer needs a client
33
+ runtime, so on Astro this renders the pill read-only — placeholder or
34
+ slotted content plus a disabled send button. */}
35
+ <div role="form" aria-label={label} class={cn('relative', className)} {...rest}>
36
+ <div class={composerSurfaceVariants({ disabled: disabled ? 'true' : 'false' })}>
37
+ <div class={cn(composerFieldClass, 'min-h-[3rem] whitespace-pre-wrap break-words')}>
38
+ {hasContent ? <slot /> : <span class="text-muted-foreground">{placeholder}</span>}
39
+ </div>
40
+ <div class="flex items-center px-2 pb-2">
41
+ <div class="flex-1" />
42
+ <button
43
+ type="button"
44
+ aria-label={sendLabel}
45
+ disabled
46
+ class={composerPrimaryActionVariants({ enabled: 'false' })}
47
+ >
48
+ <svg
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ viewBox="0 0 24 24"
51
+ width="16"
52
+ height="16"
53
+ fill="none"
54
+ stroke="currentColor"
55
+ stroke-width="2"
56
+ stroke-linecap="round"
57
+ stroke-linejoin="round"
58
+ aria-hidden="true"
59
+ >
60
+ <path d="M12 19V5" />
61
+ <path d="m5 12 7-7 7 7" />
62
+ </svg>
63
+ </button>
64
+ </div>
65
+ </div>
66
+ </div>
@@ -0,0 +1 @@
1
+ export {}