@adea-ai/ui 0.85.0 → 0.88.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 +17 -1
- package/dist/NOTICE +34 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +6 -3
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +69 -7
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts +9 -11
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +48 -33
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/conversation/message-composer.js +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +95 -15
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/layout/app-shell/index.d.ts +1 -0
- package/dist/components/layout/app-shell/index.d.ts.map +1 -1
- package/dist/components/layout/app-shell/index.js +2 -1
- package/dist/components/layout/app-shell/skip-link.d.ts +11 -0
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -0
- package/dist/components/layout/app-shell/skip-link.js +44 -0
- package/dist/components/layout/app-shell/skip-link.js.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts +12 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.js +283 -0
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -0
- package/dist/components/layout/floating-preview/index.d.ts +3 -0
- package/dist/components/layout/floating-preview/index.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/index.js +3 -0
- package/dist/components/layout/floating-preview/model.d.ts +74 -0
- package/dist/components/layout/floating-preview/model.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/model.js +146 -0
- package/dist/components/layout/floating-preview/model.js.map +1 -0
- package/dist/components/layout/sidebar-nav/index.d.ts +1 -1
- package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +18 -2
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +42 -11
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/theme/index.d.ts +1 -0
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +2 -1
- package/dist/components/theme/theme-mode-toggle.d.ts +10 -0
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -0
- package/dist/components/theme/theme-mode-toggle.js +82 -0
- package/dist/components/theme/theme-mode-toggle.js.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +2 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +24 -3
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +41 -4
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/index.d.ts +1 -0
- package/dist/components/ui/combobox/index.d.ts.map +1 -1
- package/dist/components/ui/combobox/index.js +2 -1
- package/dist/components/ui/combobox/value-combobox.d.ts +19 -0
- package/dist/components/ui/combobox/value-combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox/value-combobox.js +42 -0
- package/dist/components/ui/combobox/value-combobox.js.map +1 -0
- package/dist/components/ui/empty/empty-state.d.ts +15 -0
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty/empty-state.js +96 -0
- package/dist/components/ui/empty/empty-state.js.map +1 -0
- package/dist/components/ui/empty/index.d.ts +1 -0
- package/dist/components/ui/empty/index.d.ts.map +1 -1
- package/dist/components/ui/empty/index.js +2 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts +4 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +37 -13
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts +36 -13
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +146 -24
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/index.d.ts +3 -1
- package/dist/components/ui/field/index.d.ts.map +1 -1
- package/dist/components/ui/field/index.js +3 -2
- package/dist/components/ui/field/number-field.d.ts +19 -0
- package/dist/components/ui/field/number-field.d.ts.map +1 -0
- package/dist/components/ui/field/number-field.js +76 -0
- package/dist/components/ui/field/number-field.js.map +1 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/input/index.d.ts.map +1 -1
- package/dist/components/ui/input/index.js +2 -1
- package/dist/components/ui/input/input-control.d.ts +11 -0
- package/dist/components/ui/input/input-control.d.ts.map +1 -0
- package/dist/components/ui/input/input-control.js +24 -0
- package/dist/components/ui/input/input-control.js.map +1 -0
- package/dist/components/ui/input/input.d.ts.map +1 -1
- package/dist/components/ui/input/input.js +56 -28
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/index.d.ts +1 -0
- package/dist/components/ui/input-group/index.d.ts.map +1 -1
- package/dist/components/ui/input-group/index.js +2 -1
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group/input-group.js +42 -5
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.d.ts +11 -0
- package/dist/components/ui/input-group/secret-input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group/secret-input-group.js +67 -0
- package/dist/components/ui/input-group/secret-input-group.js.map +1 -0
- package/dist/components/ui/native-select/native-select.d.ts.map +1 -1
- package/dist/components/ui/native-select/native-select.js +39 -4
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +30 -18
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +41 -4
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts +2 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +24 -3
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/index.d.ts +2 -0
- package/dist/components/ui/text-link/index.d.ts.map +1 -0
- package/dist/components/ui/text-link/index.js +2 -0
- package/dist/components/ui/text-link/text-link.d.ts +9 -0
- package/dist/components/ui/text-link/text-link.d.ts.map +1 -0
- package/dist/components/ui/text-link/text-link.js +30 -0
- package/dist/components/ui/text-link/text-link.js.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea/textarea.js +41 -4
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -7
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/clipboard.js +35 -0
- package/dist/lib/clipboard.js.map +1 -0
- package/dist/lib/download.d.ts +3 -0
- package/dist/lib/download.d.ts.map +1 -0
- package/dist/lib/download.js +31 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/form-field.d.ts +37 -0
- package/dist/lib/form-field.d.ts.map +1 -0
- package/dist/lib/form-field.js +47 -0
- package/dist/lib/form-field.js.map +1 -0
- package/dist/r/app-shell.json +5 -0
- package/dist/r/combobox.json +5 -0
- package/dist/r/empty.json +10 -1
- package/dist/r/field.json +7 -0
- package/dist/r/floating-preview.json +30 -0
- package/dist/r/input-group.json +6 -0
- package/dist/r/input.json +5 -0
- package/dist/r/lib.json +15 -0
- package/dist/r/list-row.json +1 -0
- package/dist/r/registry.json +112 -1
- package/dist/r/src/components/composites/action-button/action-button.tsx +5 -1
- package/dist/r/src/components/composites/list-row/list-row.tsx +81 -8
- package/dist/r/src/components/composites/settings/settings.tsx +67 -37
- package/dist/r/src/components/conversation/scroll-follow.ts +109 -15
- package/dist/r/src/components/layout/app-shell/index.ts +1 -0
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/dist/r/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/dist/r/src/components/layout/floating-preview/index.ts +2 -0
- package/dist/r/src/components/layout/floating-preview/model.ts +285 -0
- package/dist/r/src/components/layout/sidebar-nav/index.ts +2 -0
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
- package/dist/r/src/components/theme/index.ts +1 -0
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/dist/r/src/components/ui/combobox/combobox.tsx +24 -1
- package/dist/r/src/components/ui/combobox/index.ts +1 -0
- package/dist/r/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/dist/r/src/components/ui/empty/empty-state.tsx +71 -0
- package/dist/r/src/components/ui/empty/index.ts +1 -0
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/dist/r/src/components/ui/field/field.tsx +102 -5
- package/dist/r/src/components/ui/field/index.ts +5 -0
- package/dist/r/src/components/ui/field/number-field.tsx +71 -0
- package/dist/r/src/components/ui/input/index.ts +1 -0
- package/dist/r/src/components/ui/input/input-control.tsx +38 -0
- package/dist/r/src/components/ui/input/input.tsx +32 -20
- package/dist/r/src/components/ui/input-group/index.ts +1 -0
- package/dist/r/src/components/ui/input-group/input-group.tsx +25 -2
- package/dist/r/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/dist/r/src/components/ui/native-select/native-select.tsx +27 -1
- package/dist/r/src/components/ui/progress/progress.tsx +12 -8
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/dist/r/src/components/ui/switch/switch.tsx +20 -3
- package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
- package/dist/r/src/components/ui/text-link/index.ts +2 -0
- package/dist/r/src/components/ui/text-link/text-link.tsx +28 -0
- package/dist/r/src/components/ui/textarea/textarea.tsx +24 -1
- package/dist/r/src/lib/clipboard.ts +41 -0
- package/dist/r/src/lib/download.ts +29 -0
- package/dist/r/src/lib/form-field.ts +93 -0
- package/dist/r/text-link.json +22 -0
- package/dist/r/theming.json +6 -0
- package/package.json +1 -1
- package/registry.json +112 -1
- package/src/components/composites/action-button/action-button.tsx +5 -1
- package/src/components/composites/list-row/list-row.tsx +81 -8
- package/src/components/composites/settings/settings.tsx +67 -37
- package/src/components/conversation/scroll-follow.ts +109 -15
- package/src/components/layout/app-shell/index.ts +1 -0
- package/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/src/components/layout/floating-preview/index.ts +2 -0
- package/src/components/layout/floating-preview/model.ts +285 -0
- package/src/components/layout/sidebar-nav/index.ts +2 -0
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
- package/src/components/theme/index.ts +1 -0
- package/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/src/components/ui/combobox/combobox.tsx +24 -1
- package/src/components/ui/combobox/index.ts +1 -0
- package/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/src/components/ui/empty/empty-state.tsx +71 -0
- package/src/components/ui/empty/index.ts +1 -0
- package/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/src/components/ui/field/field.tsx +102 -5
- package/src/components/ui/field/index.ts +5 -0
- package/src/components/ui/field/number-field.tsx +71 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/input/input-control.tsx +38 -0
- package/src/components/ui/input/input.tsx +32 -20
- package/src/components/ui/input-group/index.ts +1 -0
- package/src/components/ui/input-group/input-group.tsx +25 -2
- package/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/src/components/ui/native-select/native-select.tsx +27 -1
- package/src/components/ui/progress/progress.tsx +12 -8
- package/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/src/components/ui/switch/switch.tsx +20 -3
- package/src/components/ui/tabs/tabs.tsx +1 -1
- package/src/components/ui/text-link/index.ts +2 -0
- package/src/components/ui/text-link/text-link.tsx +28 -0
- package/src/components/ui/textarea/textarea.tsx +24 -1
- package/src/index.ts +3 -0
- package/src/lib/clipboard.ts +41 -0
- package/src/lib/download.ts +29 -0
- package/src/lib/form-field.ts +93 -0
|
@@ -5,6 +5,15 @@ import type { ComponentProps, JSX, ValidComponent } from 'solid-js'
|
|
|
5
5
|
import { Show, createSignal, splitProps } from 'solid-js'
|
|
6
6
|
import { cn } from '../../../lib/utils'
|
|
7
7
|
|
|
8
|
+
function invokeEventHandler(handler: unknown, event: Event) {
|
|
9
|
+
if (Array.isArray(handler)) {
|
|
10
|
+
const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]
|
|
11
|
+
callback(data, event)
|
|
12
|
+
} else if (typeof handler === 'function') {
|
|
13
|
+
;(handler as (event: Event) => void)(event)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* SidebarNav.
|
|
10
19
|
*
|
|
@@ -96,36 +105,69 @@ export function SidebarNavFooter(props: ComponentProps<'div'>) {
|
|
|
96
105
|
)
|
|
97
106
|
}
|
|
98
107
|
|
|
108
|
+
/** Props forwarded to a collapsible section's disclosure button. */
|
|
109
|
+
export type SidebarNavSectionTriggerProps = Omit<
|
|
110
|
+
ComponentProps<'button'>,
|
|
111
|
+
'type' | 'aria-expanded' | 'onClick' | 'onKeyDown' | 'children' | 'class' | 'style'
|
|
112
|
+
> & {
|
|
113
|
+
/** Called for Alt+ArrowUp/Down; the host owns ordering and row identity. */
|
|
114
|
+
onReorder?: (direction: 'up' | 'down') => void
|
|
115
|
+
/** Runs before the section toggle and may cancel it with `preventDefault()`. */
|
|
116
|
+
onClick?: ComponentProps<'button'>['onClick']
|
|
117
|
+
/** Runs before shared Alt+Arrow handling and may cancel it with `preventDefault()`. */
|
|
118
|
+
onKeyDown?: ComponentProps<'button'>['onKeyDown']
|
|
119
|
+
}
|
|
120
|
+
|
|
99
121
|
/**
|
|
100
122
|
* A titled, collapsible group. Collapsible because a list of projects
|
|
101
123
|
* inevitably outgrows the column, and the user needs to put the ones they are
|
|
102
124
|
* not using away *without* them disappearing into a menu.
|
|
103
125
|
*/
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
export type SidebarNavSectionProps = ComponentProps<'div'> & {
|
|
127
|
+
label: string
|
|
128
|
+
/** Render a disclosure control instead of a plain heading. */
|
|
129
|
+
collapsible?: boolean
|
|
130
|
+
defaultOpen?: boolean
|
|
131
|
+
/** Controlled disclosure state. When supplied, the host owns changes. */
|
|
132
|
+
open?: boolean
|
|
133
|
+
/** Called for user-initiated disclosure changes. */
|
|
134
|
+
onOpenChange?: (open: boolean) => void
|
|
135
|
+
/** Native props and reorder callbacks for the disclosure control. */
|
|
136
|
+
triggerProps?: SidebarNavSectionTriggerProps
|
|
137
|
+
/** Count shown beside the label. */
|
|
138
|
+
count?: number
|
|
139
|
+
/** A control at the trailing edge of the heading row. */
|
|
140
|
+
action?: JSX.Element
|
|
141
|
+
/** Semantic heading element for a host's section hierarchy. */
|
|
142
|
+
headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function SidebarNavSection(props: SidebarNavSectionProps) {
|
|
118
146
|
const [local, rest] = splitProps(props, [
|
|
119
147
|
'class',
|
|
120
148
|
'label',
|
|
121
149
|
'collapsible',
|
|
122
150
|
'defaultOpen',
|
|
151
|
+
'open',
|
|
152
|
+
'onOpenChange',
|
|
153
|
+
'triggerProps',
|
|
123
154
|
'count',
|
|
124
155
|
'action',
|
|
125
156
|
'headingAs',
|
|
126
157
|
'children',
|
|
127
158
|
])
|
|
128
|
-
const [
|
|
159
|
+
const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? true)
|
|
160
|
+
const open = () => local.open ?? uncontrolledOpen()
|
|
161
|
+
const setOpen = (next: boolean) => {
|
|
162
|
+
if (local.open === undefined) setUncontrolledOpen(next)
|
|
163
|
+
local.onOpenChange?.(next)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const [trigger, triggerRest] = splitProps(local.triggerProps ?? {}, [
|
|
167
|
+
'onClick',
|
|
168
|
+
'onKeyDown',
|
|
169
|
+
'onReorder',
|
|
170
|
+
])
|
|
129
171
|
|
|
130
172
|
const heading = (
|
|
131
173
|
<>
|
|
@@ -154,9 +196,22 @@ export function SidebarNavSection(
|
|
|
154
196
|
>
|
|
155
197
|
<Show when={local.collapsible} fallback={heading}>
|
|
156
198
|
<button
|
|
199
|
+
{...(triggerRest as ComponentProps<'button'>)}
|
|
157
200
|
type="button"
|
|
158
201
|
aria-expanded={open()}
|
|
159
|
-
onClick={() =>
|
|
202
|
+
onClick={(event) => {
|
|
203
|
+
invokeEventHandler(trigger.onClick, event)
|
|
204
|
+
if (event.defaultPrevented) return
|
|
205
|
+
setOpen(!open())
|
|
206
|
+
}}
|
|
207
|
+
onKeyDown={(event) => {
|
|
208
|
+
invokeEventHandler(trigger.onKeyDown, event)
|
|
209
|
+
if (event.defaultPrevented || !event.altKey) return
|
|
210
|
+
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return
|
|
211
|
+
event.preventDefault()
|
|
212
|
+
event.stopPropagation()
|
|
213
|
+
trigger.onReorder?.(event.key === 'ArrowUp' ? 'up' : 'down')
|
|
214
|
+
}}
|
|
160
215
|
class="flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase outline-none transition-colors ease-out hover:text-sidebar-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle"
|
|
161
216
|
>
|
|
162
217
|
{heading}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Monitor, Moon, Sun } from 'lucide-solid'
|
|
2
|
+
import type { ComponentProps } from 'solid-js'
|
|
3
|
+
import { For, splitProps } from 'solid-js'
|
|
4
|
+
import { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group/toggle-group'
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'
|
|
6
|
+
|
|
7
|
+
const APPEARANCES = [
|
|
8
|
+
{ value: 'light', label: 'Light', icon: Sun },
|
|
9
|
+
{ value: 'dark', label: 'Dark', icon: Moon },
|
|
10
|
+
{ value: 'system', label: 'System', icon: Monitor },
|
|
11
|
+
] as const
|
|
12
|
+
|
|
13
|
+
/** Controlled appearance selection for hosts that own their preference storage. */
|
|
14
|
+
export type ThemeModeToggleProps = Omit<
|
|
15
|
+
ComponentProps<typeof ToggleGroup>,
|
|
16
|
+
'children' | 'value' | 'onChange' | 'multiple'
|
|
17
|
+
> & {
|
|
18
|
+
mode: 'light' | 'dark' | 'system'
|
|
19
|
+
onModeChange: (mode: 'light' | 'dark' | 'system') => void
|
|
20
|
+
withLabels?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function ThemeModeToggle(props: ThemeModeToggleProps) {
|
|
24
|
+
const [local, rest] = splitProps(props, ['mode', 'onModeChange', 'withLabels'])
|
|
25
|
+
return (
|
|
26
|
+
<ToggleGroup
|
|
27
|
+
{...rest}
|
|
28
|
+
attached
|
|
29
|
+
multiple={false}
|
|
30
|
+
value={local.mode}
|
|
31
|
+
onChange={(value: string | null) => {
|
|
32
|
+
const option = APPEARANCES.find((candidate) => candidate.value === value)
|
|
33
|
+
if (option) local.onModeChange(option.value)
|
|
34
|
+
}}
|
|
35
|
+
aria-label={rest['aria-label'] ?? 'Appearance'}
|
|
36
|
+
>
|
|
37
|
+
<For each={APPEARANCES}>
|
|
38
|
+
{(appearance) => (
|
|
39
|
+
<Tooltip>
|
|
40
|
+
<TooltipTrigger
|
|
41
|
+
as={ToggleGroupItem}
|
|
42
|
+
value={appearance.value}
|
|
43
|
+
variant="outline"
|
|
44
|
+
size={local.withLabels ? 'sm' : 'icon-sm'}
|
|
45
|
+
aria-label={appearance.label}
|
|
46
|
+
>
|
|
47
|
+
<appearance.icon aria-hidden="true" />
|
|
48
|
+
{local.withLabels ? <span>{appearance.label}</span> : null}
|
|
49
|
+
</TooltipTrigger>
|
|
50
|
+
<TooltipContent>Use {appearance.label.toLowerCase()} appearance</TooltipContent>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
)}
|
|
53
|
+
</For>
|
|
54
|
+
</ToggleGroup>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox'
|
|
|
2
2
|
import { Check, Minus } from 'lucide-solid'
|
|
3
3
|
import type { ComponentProps, JSX } from 'solid-js'
|
|
4
4
|
import { splitProps } from 'solid-js'
|
|
5
|
+
import { useFormFieldControl } from '../../../lib/form-field'
|
|
5
6
|
import { cn } from '../../../lib/utils'
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -18,6 +19,8 @@ import { cn } from '../../../lib/utils'
|
|
|
18
19
|
* the ring lives on the control and reads the input's focus state.
|
|
19
20
|
*/
|
|
20
21
|
export type CheckboxProps = Omit<ComponentProps<typeof KobalteCheckbox>, 'children'> & {
|
|
22
|
+
/** ID for the hidden native checkbox input; useful with an external label. */
|
|
23
|
+
inputId?: string
|
|
21
24
|
controlClass?: string
|
|
22
25
|
labelClass?: string
|
|
23
26
|
descriptionClass?: string
|
|
@@ -44,12 +47,24 @@ export function Checkbox(props: CheckboxProps) {
|
|
|
44
47
|
'aria-labelledby',
|
|
45
48
|
'aria-describedby',
|
|
46
49
|
'aria-invalid',
|
|
50
|
+
'aria-errormessage',
|
|
47
51
|
'aria-busy',
|
|
52
|
+
'id',
|
|
53
|
+
'inputId',
|
|
48
54
|
'title',
|
|
49
55
|
])
|
|
56
|
+
const field = useFormFieldControl('control', {
|
|
57
|
+
id: local.inputId ?? local.id,
|
|
58
|
+
'aria-label': local['aria-label'],
|
|
59
|
+
'aria-labelledby': local['aria-labelledby'],
|
|
60
|
+
'aria-describedby': local['aria-describedby'],
|
|
61
|
+
'aria-invalid': local['aria-invalid'],
|
|
62
|
+
'aria-errormessage': local['aria-errormessage'],
|
|
63
|
+
})
|
|
50
64
|
|
|
51
65
|
return (
|
|
52
66
|
<KobalteCheckbox
|
|
67
|
+
id={field ? undefined : local.id}
|
|
53
68
|
title={local.title}
|
|
54
69
|
class={cn('group/checkbox flex items-start gap-2.5', local.class)}
|
|
55
70
|
{...rest}
|
|
@@ -60,10 +75,12 @@ export function Checkbox(props: CheckboxProps) {
|
|
|
60
75
|
* box would announce its state with no subject.
|
|
61
76
|
*/}
|
|
62
77
|
<KobalteCheckbox.Input
|
|
78
|
+
id={field?.id ?? local.inputId}
|
|
63
79
|
aria-label={local['aria-label']}
|
|
64
|
-
aria-labelledby={local['aria-labelledby']}
|
|
65
|
-
aria-describedby={local['aria-describedby']}
|
|
66
|
-
aria-invalid={local['aria-invalid']}
|
|
80
|
+
aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}
|
|
81
|
+
aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}
|
|
82
|
+
aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}
|
|
83
|
+
aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}
|
|
67
84
|
aria-busy={local['aria-busy']}
|
|
68
85
|
title={local.title}
|
|
69
86
|
/>
|
|
@@ -3,6 +3,7 @@ import { Check, ChevronDown, X } from 'lucide-solid'
|
|
|
3
3
|
import type { ComponentProps } from 'solid-js'
|
|
4
4
|
import { Show, splitProps } from 'solid-js'
|
|
5
5
|
import { menuContentPadding, menuItem, popoverArrow } from '../../../lib/overlay'
|
|
6
|
+
import { useFormFieldControl } from '../../../lib/form-field'
|
|
6
7
|
import { cn } from '../../../lib/utils'
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -43,10 +44,32 @@ export function ComboboxControl(props: ComponentProps<typeof KobalteCombobox.Con
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export function ComboboxInput(props: ComponentProps<typeof KobalteCombobox.Input>) {
|
|
46
|
-
const [local, rest] = splitProps(props, [
|
|
47
|
+
const [local, rest] = splitProps(props, [
|
|
48
|
+
'class',
|
|
49
|
+
'id',
|
|
50
|
+
'aria-label',
|
|
51
|
+
'aria-labelledby',
|
|
52
|
+
'aria-describedby',
|
|
53
|
+
'aria-invalid',
|
|
54
|
+
'aria-errormessage',
|
|
55
|
+
])
|
|
56
|
+
const field = useFormFieldControl('control', {
|
|
57
|
+
id: local.id,
|
|
58
|
+
'aria-label': local['aria-label'],
|
|
59
|
+
'aria-labelledby': local['aria-labelledby'],
|
|
60
|
+
'aria-describedby': local['aria-describedby'],
|
|
61
|
+
'aria-invalid': local['aria-invalid'],
|
|
62
|
+
'aria-errormessage': local['aria-errormessage'],
|
|
63
|
+
})
|
|
47
64
|
|
|
48
65
|
return (
|
|
49
66
|
<KobalteCombobox.Input
|
|
67
|
+
id={field?.id ?? local.id}
|
|
68
|
+
aria-label={local['aria-label']}
|
|
69
|
+
aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}
|
|
70
|
+
aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}
|
|
71
|
+
aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}
|
|
72
|
+
aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}
|
|
50
73
|
class={cn(
|
|
51
74
|
'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',
|
|
52
75
|
'disabled:cursor-not-allowed',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { splitProps, type ComponentProps, type JSX } from 'solid-js'
|
|
2
|
+
import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from './combobox'
|
|
3
|
+
|
|
4
|
+
export type ValueComboboxChoice =
|
|
5
|
+
| { value: string; label: string | number; textValue?: string }
|
|
6
|
+
| { value: string; label: JSX.Element; textValue: string }
|
|
7
|
+
|
|
8
|
+
export type ValueComboboxProps = Omit<ComponentProps<typeof ComboboxInput>, 'value'> & {
|
|
9
|
+
value: string
|
|
10
|
+
choices: ValueComboboxChoice[]
|
|
11
|
+
onValueChange: (value: string) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A single-choice combobox for a controlled string value and labelled choices. */
|
|
15
|
+
export function ValueCombobox(props: ValueComboboxProps) {
|
|
16
|
+
const [local, rest] = splitProps(props, ['value', 'choices', 'onValueChange'])
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Combobox
|
|
20
|
+
options={local.choices}
|
|
21
|
+
optionValue="value"
|
|
22
|
+
optionTextValue={(choice) => choice.textValue ?? textFromLabel(choice.label)}
|
|
23
|
+
optionLabel={(choice) => choice.textValue ?? textFromLabel(choice.label)}
|
|
24
|
+
value={local.choices.find((choice) => String(choice.value) === local.value) ?? null}
|
|
25
|
+
onChange={(option) => option && local.onValueChange(String(option.value))}
|
|
26
|
+
itemComponent={(itemProps) => (
|
|
27
|
+
<ComboboxItem item={itemProps.item}>{itemProps.item.rawValue.label}</ComboboxItem>
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
<ComboboxInput {...rest} />
|
|
31
|
+
<ComboboxContent />
|
|
32
|
+
</Combobox>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function textFromLabel(label: JSX.Element) {
|
|
37
|
+
return typeof label === 'string' || typeof label === 'number' ? String(label) : ''
|
|
38
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Search } from 'lucide-solid'
|
|
2
|
+
import type { ComponentProps, JSX } from 'solid-js'
|
|
3
|
+
import { Show, splitProps } from 'solid-js'
|
|
4
|
+
import { ActionButton } from '../../composites/action-button'
|
|
5
|
+
import { Spinner } from '../spinner'
|
|
6
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './empty'
|
|
7
|
+
|
|
8
|
+
export type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> & {
|
|
9
|
+
title: string
|
|
10
|
+
detail: string
|
|
11
|
+
busy?: boolean
|
|
12
|
+
icon?: JSX.Element
|
|
13
|
+
announceAs?: 'alert' | 'status'
|
|
14
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
|
|
15
|
+
action?: () => void
|
|
16
|
+
actionLabel?: string
|
|
17
|
+
actionTooltip?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A semantic empty, loading, or error state built from the shared empty parts. */
|
|
21
|
+
export function EmptyState(props: EmptyStateProps) {
|
|
22
|
+
const [local, rest] = splitProps(props, [
|
|
23
|
+
'title',
|
|
24
|
+
'detail',
|
|
25
|
+
'busy',
|
|
26
|
+
'icon',
|
|
27
|
+
'announceAs',
|
|
28
|
+
'headingLevel',
|
|
29
|
+
'action',
|
|
30
|
+
'actionLabel',
|
|
31
|
+
'actionTooltip',
|
|
32
|
+
'class',
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Empty
|
|
37
|
+
{...rest}
|
|
38
|
+
class={local.class}
|
|
39
|
+
role={local.announceAs}
|
|
40
|
+
aria-live={local.announceAs === 'status' ? 'polite' : undefined}
|
|
41
|
+
aria-busy={local.busy || undefined}
|
|
42
|
+
>
|
|
43
|
+
<EmptyHeader>
|
|
44
|
+
<Show when={local.busy || local.icon}>
|
|
45
|
+
<EmptyMedia variant="icon">
|
|
46
|
+
{local.busy ? (
|
|
47
|
+
<Spinner label={false} aria-hidden="true" />
|
|
48
|
+
) : (
|
|
49
|
+
(local.icon ?? <Search aria-hidden="true" />)
|
|
50
|
+
)}
|
|
51
|
+
</EmptyMedia>
|
|
52
|
+
</Show>
|
|
53
|
+
<EmptyTitle role="heading" aria-level={local.headingLevel ?? 1}>
|
|
54
|
+
{local.title}
|
|
55
|
+
</EmptyTitle>
|
|
56
|
+
<EmptyDescription>{local.detail}</EmptyDescription>
|
|
57
|
+
</EmptyHeader>
|
|
58
|
+
<Show when={local.action}>
|
|
59
|
+
<EmptyContent>
|
|
60
|
+
<ActionButton
|
|
61
|
+
tooltip={local.actionTooltip ?? local.actionLabel ?? 'Try again'}
|
|
62
|
+
aria-label={local.actionLabel ?? 'Try again'}
|
|
63
|
+
onClick={local.action}
|
|
64
|
+
>
|
|
65
|
+
{local.actionLabel ?? 'Try again'}
|
|
66
|
+
</ActionButton>
|
|
67
|
+
</EmptyContent>
|
|
68
|
+
</Show>
|
|
69
|
+
</Empty>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createSignal,
|
|
3
|
+
Show,
|
|
4
|
+
splitProps,
|
|
5
|
+
type Component,
|
|
6
|
+
type ComponentProps,
|
|
7
|
+
type JSX,
|
|
8
|
+
} from 'solid-js'
|
|
2
9
|
import { Dynamic } from 'solid-js/web'
|
|
3
10
|
import { cva, type VariantProps } from '../../../lib/variants'
|
|
4
11
|
import { cn } from '../../../lib/utils'
|
|
@@ -16,7 +23,8 @@ import { cn } from '../../../lib/utils'
|
|
|
16
23
|
*
|
|
17
24
|
* 1. **A glyph is always present.** A brand with no logo gets a monogram, not an
|
|
18
25
|
* empty box. `fallback` takes the name and returns the glyph, so a caller can
|
|
19
|
-
* choose initials, a domain letter, or a kind icon.
|
|
26
|
+
* choose initials, a domain letter, or a kind icon. When `src` is supplied,
|
|
27
|
+
* its contained image overlays that glyph and failure reveals the glyph below.
|
|
20
28
|
* 2. **The tile owns its own contrast.** `tone` tints the background while
|
|
21
29
|
* monogram text keeps the body foreground; vector glyphs retain the status
|
|
22
30
|
* colour. A caller never picks a colour pair or ships a glyph that disappears.
|
|
@@ -67,6 +75,8 @@ export type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> &
|
|
|
67
75
|
EntityIconVariantProps & {
|
|
68
76
|
/** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */
|
|
69
77
|
name: string
|
|
78
|
+
/** Optional image URL. The image is decorative; `name` remains the accessible label. */
|
|
79
|
+
src?: string
|
|
70
80
|
/**
|
|
71
81
|
* A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element
|
|
72
82
|
* (`icon={<Wrench />}`). Both are accepted because both are what a caller
|
|
@@ -108,9 +118,27 @@ function Glyph(props: { glyph: Glyph }) {
|
|
|
108
118
|
)
|
|
109
119
|
}
|
|
110
120
|
|
|
121
|
+
function EntityIconImage(props: { src: string }) {
|
|
122
|
+
const [failed, setFailed] = createSignal(false)
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<Show when={!failed()}>
|
|
126
|
+
<img
|
|
127
|
+
data-slot="entity-icon-image"
|
|
128
|
+
src={props.src}
|
|
129
|
+
alt=""
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
class="pointer-events-none absolute inset-0 size-full object-contain"
|
|
132
|
+
onError={() => setFailed(true)}
|
|
133
|
+
/>
|
|
134
|
+
</Show>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
111
138
|
export function EntityIcon(props: EntityIconProps) {
|
|
112
139
|
const [local, rest] = splitProps(props, [
|
|
113
140
|
'name',
|
|
141
|
+
'src',
|
|
114
142
|
'icon',
|
|
115
143
|
'fallback',
|
|
116
144
|
'badge',
|
|
@@ -146,6 +174,9 @@ export function EntityIcon(props: EntityIconProps) {
|
|
|
146
174
|
>
|
|
147
175
|
{(value) => <Glyph glyph={value()} />}
|
|
148
176
|
</Show>
|
|
177
|
+
<Show when={local.src} keyed>
|
|
178
|
+
{(src) => <EntityIconImage src={src} />}
|
|
179
|
+
</Show>
|
|
149
180
|
<Show when={local.badge}>
|
|
150
181
|
<span class="absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4">{local.badge}</span>
|
|
151
182
|
</Show>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TextField as KobalteTextField } from '@kobalte/core/text-field'
|
|
2
|
-
import type { ComponentProps } from 'solid-js'
|
|
3
|
-
import { Show, splitProps } from 'solid-js'
|
|
2
|
+
import type { ComponentProps, JSX } from 'solid-js'
|
|
3
|
+
import { createUniqueId, Show, splitProps } from 'solid-js'
|
|
4
|
+
import { Label } from '../label/label'
|
|
5
|
+
import { createFormFieldContext, FormFieldContext } from '../../../lib/form-field'
|
|
4
6
|
import { cn } from '../../../lib/utils'
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -9,21 +11,110 @@ import { cn } from '../../../lib/utils'
|
|
|
9
11
|
* The wrapper that makes a form control describable and validatable: a label,
|
|
10
12
|
* a description, an error message, and the ARIA relationships between them.
|
|
11
13
|
*
|
|
14
|
+
* This Kobalte TextField composition is for its own `FieldLabel`, `FieldInput`
|
|
15
|
+
* and `FieldTextArea` parts. Use `FormField` to wire the standalone shared
|
|
16
|
+
* controls, including checkboxes, switches and comboboxes.
|
|
17
|
+
*
|
|
12
18
|
* It is built on Kobalte's TextField specifically so `aria-describedby`,
|
|
13
19
|
* `aria-invalid` and `aria-errormessage` are wired by construction. Those three
|
|
14
20
|
* attributes are the difference between "this field is required and empty" and
|
|
15
21
|
* a red border that only a sighted user can perceive — and they are also the
|
|
16
22
|
* first thing a hand-rolled form drops.
|
|
17
23
|
*
|
|
18
|
-
* `Field` owns the description and the error slot, so
|
|
19
|
-
*
|
|
20
|
-
* Compose it with any control: `Field` wraps, `Label`/`Input`/`Select` fill it.
|
|
24
|
+
* `Field` owns the description and the error slot, so its controls line up and
|
|
25
|
+
* its messages land in the same place regardless of which TextField part is used.
|
|
21
26
|
*/
|
|
22
27
|
export function Field(props: ComponentProps<typeof KobalteTextField>) {
|
|
23
28
|
const [local, rest] = splitProps(props, ['class'])
|
|
24
29
|
return <KobalteTextField class={cn('flex flex-col gap-1.5', local.class)} {...rest} />
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
export type FormFieldProps = Omit<ComponentProps<'div'>, 'children' | 'ref'> & {
|
|
33
|
+
label: string
|
|
34
|
+
hint?: string
|
|
35
|
+
error?: string
|
|
36
|
+
controlId?: string
|
|
37
|
+
group?: boolean
|
|
38
|
+
children: JSX.Element
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* FormField.
|
|
43
|
+
*
|
|
44
|
+
* A shared label, help and validation wrapper for any one shared control. Its
|
|
45
|
+
* context is consumed by Input, Textarea, NativeSelect, Checkbox, Switch,
|
|
46
|
+
* RadioGroup and ComboboxInput, so the actual focusable element receives the
|
|
47
|
+
* generated ID and description relationships. Set `group` when the label names
|
|
48
|
+
* a set of controls; the wrapper then uses fieldset and legend semantics.
|
|
49
|
+
*/
|
|
50
|
+
export function FormField(props: FormFieldProps) {
|
|
51
|
+
const [local, rest] = splitProps(props, [
|
|
52
|
+
'class',
|
|
53
|
+
'label',
|
|
54
|
+
'hint',
|
|
55
|
+
'error',
|
|
56
|
+
'controlId',
|
|
57
|
+
'group',
|
|
58
|
+
'children',
|
|
59
|
+
])
|
|
60
|
+
const fieldId = createUniqueId()
|
|
61
|
+
const labelId = `${fieldId}-label`
|
|
62
|
+
const descriptionId = `${fieldId}-description`
|
|
63
|
+
const errorId = `${fieldId}-error`
|
|
64
|
+
const field = createFormFieldContext({
|
|
65
|
+
controlId: local.controlId,
|
|
66
|
+
defaultControlId: fieldId,
|
|
67
|
+
labelId,
|
|
68
|
+
descriptionId,
|
|
69
|
+
errorId,
|
|
70
|
+
hint: () => local.hint,
|
|
71
|
+
error: () => local.error,
|
|
72
|
+
group: () => local.group ?? false,
|
|
73
|
+
})
|
|
74
|
+
const help = () => (
|
|
75
|
+
<>
|
|
76
|
+
<Show when={local.hint}>
|
|
77
|
+
<p id={descriptionId} class="text-muted-foreground text-sm">
|
|
78
|
+
{local.hint}
|
|
79
|
+
</p>
|
|
80
|
+
</Show>
|
|
81
|
+
<Show when={local.error}>
|
|
82
|
+
<p id={errorId} role="alert" class="text-foreground text-sm">
|
|
83
|
+
{local.error}
|
|
84
|
+
</p>
|
|
85
|
+
</Show>
|
|
86
|
+
</>
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<FormFieldContext.Provider value={field}>
|
|
91
|
+
<div class={cn('flex flex-col gap-1.5', local.class)} {...rest}>
|
|
92
|
+
{local.group ? (
|
|
93
|
+
<FieldSet
|
|
94
|
+
class="flex flex-col gap-1.5"
|
|
95
|
+
aria-describedby={field.describedBy()}
|
|
96
|
+
aria-invalid={field.invalid() || undefined}
|
|
97
|
+
>
|
|
98
|
+
<FieldLegend id={labelId} variant="label">
|
|
99
|
+
{local.label}
|
|
100
|
+
</FieldLegend>
|
|
101
|
+
{local.children}
|
|
102
|
+
{help()}
|
|
103
|
+
</FieldSet>
|
|
104
|
+
) : (
|
|
105
|
+
<>
|
|
106
|
+
<Label id={labelId} for={field.controlId()}>
|
|
107
|
+
{local.label}
|
|
108
|
+
</Label>
|
|
109
|
+
{local.children}
|
|
110
|
+
{help()}
|
|
111
|
+
</>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
</FormFieldContext.Provider>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
27
118
|
export function FieldLabel(props: ComponentProps<typeof KobalteTextField.Label>) {
|
|
28
119
|
const [local, rest] = splitProps(props, ['class'])
|
|
29
120
|
return (
|
|
@@ -96,6 +187,12 @@ export function FieldSet(props: ComponentProps<'fieldset'>) {
|
|
|
96
187
|
return <fieldset class={cn('flex flex-col gap-4', local.class)} {...rest} />
|
|
97
188
|
}
|
|
98
189
|
|
|
190
|
+
/** A visual stack for related controls that does not imply fieldset semantics. */
|
|
191
|
+
export function FieldGroup(props: ComponentProps<'div'>) {
|
|
192
|
+
const [local, rest] = splitProps(props, ['class'])
|
|
193
|
+
return <div data-slot="field-group" class={cn('flex flex-col gap-4', local.class)} {...rest} />
|
|
194
|
+
}
|
|
195
|
+
|
|
99
196
|
export function FieldLegend(props: ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {
|
|
100
197
|
const [local, rest] = splitProps(props, ['class', 'variant'])
|
|
101
198
|
return (
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
2
|
Field,
|
|
3
|
+
FormField,
|
|
3
4
|
FieldDescription,
|
|
4
5
|
FieldError,
|
|
6
|
+
FieldGroup,
|
|
5
7
|
FieldInput,
|
|
6
8
|
FieldLabel,
|
|
7
9
|
FieldLegend,
|
|
8
10
|
FieldSeparator,
|
|
9
11
|
FieldSet,
|
|
10
12
|
FieldTextArea,
|
|
13
|
+
type FormFieldProps,
|
|
11
14
|
} from './field'
|
|
15
|
+
export { NumberField } from './number-field'
|
|
16
|
+
export type { NumberFieldProps } from './number-field'
|