@dinachi/cli 1.1.0 → 1.4.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/CHANGELOG.md +81 -0
- package/README.md +1 -0
- package/dist/index.js +698 -314
- package/package.json +5 -1
- package/templates/agent/agent.tsx +35 -18
- package/templates/alert/alert.tsx +345 -0
- package/templates/alert/index.ts +16 -0
- package/templates/ask-bar/ask-bar.tsx +1061 -0
- package/templates/ask-bar/index.ts +1 -0
- package/templates/autocomplete/autocomplete.tsx +0 -1
- package/templates/breadcrumb/breadcrumb.tsx +606 -0
- package/templates/breadcrumb/index.ts +9 -0
- package/templates/calendar/calendar.tsx +1155 -0
- package/templates/calendar/index.ts +15 -0
- package/templates/combobox/combobox.tsx +0 -1
- package/templates/command-items/command-items.tsx +69 -0
- package/templates/command-items/index.ts +1 -0
- package/templates/command-palette/command-palette.tsx +954 -0
- package/templates/command-palette/index.ts +1 -0
- package/templates/comparison-table/comparison-table.tsx +540 -0
- package/templates/comparison-table/index.ts +15 -0
- package/templates/data-table/data-table.tsx +2077 -0
- package/templates/data-table/index.ts +14 -0
- package/templates/date-picker/date-picker.tsx +527 -0
- package/templates/date-picker/index.ts +2 -0
- package/templates/date-range-picker/date-range-picker.tsx +504 -0
- package/templates/date-range-picker/index.ts +2 -0
- package/templates/detail-list/detail-list.tsx +419 -0
- package/templates/detail-list/index.ts +12 -0
- package/templates/heat-table/heat-table.tsx +613 -0
- package/templates/heat-table/index.ts +9 -0
- package/templates/menu/menu.tsx +8 -3
- package/templates/month-picker/index.ts +1 -0
- package/templates/month-picker/month-picker.tsx +351 -0
- package/templates/omnibar/index.ts +1 -0
- package/templates/omnibar/omnibar.tsx +1009 -0
- package/templates/pagination/index.ts +8 -0
- package/templates/pagination/pagination.tsx +389 -0
- package/templates/table/index.ts +13 -0
- package/templates/table/table.tsx +265 -0
- package/templates/time-slots/index.ts +1 -0
- package/templates/time-slots/time-slots.tsx +589 -0
- package/templates/week-strip/index.ts +1 -0
- package/templates/week-strip/week-strip.tsx +329 -0
- package/templates/year-view/index.ts +1 -0
- package/templates/year-view/year-view.tsx +362 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Check, Copy, Pencil } from "lucide-react"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
import { changeAsAgent, useAgentControl, useAgentState, useHasAgent } from "@/components/ui/agent"
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
|
|
9
|
+
export type DetailListLayout = "side" | "stacked"
|
|
10
|
+
|
|
11
|
+
export interface DetailListChangeDetails {
|
|
12
|
+
reason: string
|
|
13
|
+
event: Event | undefined
|
|
14
|
+
isCanceled: boolean
|
|
15
|
+
cancel(): void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** What `renderEditor` gets: the draft, ways to change and save it, and props for the field. */
|
|
19
|
+
export interface DetailListEditorProps {
|
|
20
|
+
/** The draft, which starts as the saved value. */
|
|
21
|
+
value: string
|
|
22
|
+
setValue: (value: string) => void
|
|
23
|
+
/** Validates and saves the draft, or `value` when given, as the Save button does. */
|
|
24
|
+
save: (value?: string) => void
|
|
25
|
+
/** Closes the editor and drops the draft. */
|
|
26
|
+
cancel: () => void
|
|
27
|
+
/** Enter saves and Escape cancels, for a field that wants the list's keys. */
|
|
28
|
+
onKeyDown: (event: React.KeyboardEvent) => void
|
|
29
|
+
/** Spread on the field: focus, the row's name and the error. */
|
|
30
|
+
fieldProps: {
|
|
31
|
+
autoFocus: true
|
|
32
|
+
"aria-labelledby": string
|
|
33
|
+
"aria-invalid": true | undefined
|
|
34
|
+
"aria-describedby": string | undefined
|
|
35
|
+
"data-agent-part": "" | undefined
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const LayoutContext = React.createContext<DetailListLayout>("side")
|
|
40
|
+
|
|
41
|
+
interface ItemContextValue {
|
|
42
|
+
termId: string
|
|
43
|
+
value: string
|
|
44
|
+
editing: boolean
|
|
45
|
+
setEditing: (editing: boolean) => void
|
|
46
|
+
save: (value: string, event?: Event) => string | undefined
|
|
47
|
+
copyable: boolean
|
|
48
|
+
editable: boolean
|
|
49
|
+
multiline: boolean
|
|
50
|
+
renderEditor?: (editor: DetailListEditorProps) => React.ReactNode
|
|
51
|
+
disabled: boolean
|
|
52
|
+
hasAgent: boolean
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ItemContext = React.createContext<ItemContextValue | null>(null)
|
|
56
|
+
|
|
57
|
+
export interface DetailListProps extends React.HTMLAttributes<HTMLDListElement> {
|
|
58
|
+
/** Labels beside values, or above them. Below 768px labels always sit above. */
|
|
59
|
+
layout?: DetailListLayout
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A list of labelled values, as a native `dl`. */
|
|
63
|
+
const DetailList = React.forwardRef<HTMLDListElement, DetailListProps>(
|
|
64
|
+
({ layout = "side", className, ...props }, ref) => (
|
|
65
|
+
<LayoutContext.Provider value={layout}>
|
|
66
|
+
<dl ref={ref} data-slot="detail-list" data-layout={layout} className={cn("m-0", className)} {...props} />
|
|
67
|
+
</LayoutContext.Provider>
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
DetailList.displayName = "DetailList"
|
|
71
|
+
|
|
72
|
+
export interface DetailListItemProps
|
|
73
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
|
|
74
|
+
/** The row's text, which copy copies and edit changes. Controlled. */
|
|
75
|
+
value?: string
|
|
76
|
+
defaultValue?: string
|
|
77
|
+
/** Runs on every saved edit, a person's or an agent's. `details.cancel()` refuses it. */
|
|
78
|
+
onValueChange?: (value: string, details: DetailListChangeDetails) => void
|
|
79
|
+
/** Returns a message to refuse a value, shown under the field or sent back to the agent. */
|
|
80
|
+
validate?: (value: string) => string | undefined
|
|
81
|
+
/** Adds a button that copies the value. */
|
|
82
|
+
copyable?: boolean
|
|
83
|
+
/** Adds a button that edits the value in place. */
|
|
84
|
+
editable?: boolean
|
|
85
|
+
/** Edits in a textarea, saved with Cmd or Ctrl and Enter. */
|
|
86
|
+
multiline?: boolean
|
|
87
|
+
/** Edits in your own field, such as a Select, in place of the text field. Save, Cancel and `validate` still apply. */
|
|
88
|
+
renderEditor?: (editor: DetailListEditorProps) => React.ReactNode
|
|
89
|
+
/** Trims spaces from both ends of a value before it is validated and saved, a person's or an agent's. */
|
|
90
|
+
trim?: boolean
|
|
91
|
+
/** Blocks editing, by people and agents. Copy still works. */
|
|
92
|
+
disabled?: boolean
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** One row: a term and its details. Holds the value, and the copy and edit state. */
|
|
96
|
+
const DetailListItem = React.forwardRef<HTMLDivElement, DetailListItemProps>(
|
|
97
|
+
(
|
|
98
|
+
{
|
|
99
|
+
value: valueProp,
|
|
100
|
+
defaultValue = "",
|
|
101
|
+
onValueChange,
|
|
102
|
+
validate,
|
|
103
|
+
copyable = false,
|
|
104
|
+
editable = false,
|
|
105
|
+
multiline = false,
|
|
106
|
+
renderEditor,
|
|
107
|
+
trim = false,
|
|
108
|
+
disabled = false,
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
},
|
|
112
|
+
ref
|
|
113
|
+
) => {
|
|
114
|
+
const layout = React.useContext(LayoutContext)
|
|
115
|
+
const termId = React.useId()
|
|
116
|
+
const [value, change] = useAgentState<string, DetailListChangeDetails>(valueProp, defaultValue, onValueChange)
|
|
117
|
+
const [editing, setEditing] = React.useState(false)
|
|
118
|
+
const row = React.useRef<HTMLDivElement | null>(null)
|
|
119
|
+
const hasAgent = useHasAgent()
|
|
120
|
+
|
|
121
|
+
const setRef = (el: HTMLDivElement | null) => {
|
|
122
|
+
row.current = el
|
|
123
|
+
if (typeof ref === "function") ref(el)
|
|
124
|
+
else if (ref) ref.current = el
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Two frames tinted, then the tint fades over 250ms, so the whole flash stays under 300ms.
|
|
128
|
+
const flash = () => {
|
|
129
|
+
const el = row.current
|
|
130
|
+
if (!el) return
|
|
131
|
+
el.setAttribute("data-saved", "")
|
|
132
|
+
requestAnimationFrame(() => requestAnimationFrame(() => el.removeAttribute("data-saved")))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Returns a message when the value is refused, so the caller decides how to show it.
|
|
136
|
+
const commit = (raw: string, apply: (next: string) => string | undefined) => {
|
|
137
|
+
const next = trim ? raw.trim() : raw
|
|
138
|
+
const invalid = validate?.(next)
|
|
139
|
+
if (invalid) return invalid
|
|
140
|
+
if (next === value) return
|
|
141
|
+
const refused = apply(next)
|
|
142
|
+
if (refused) return refused
|
|
143
|
+
flash()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const save = (next: string, event?: Event) =>
|
|
147
|
+
commit(next, (v) => {
|
|
148
|
+
const details: DetailListChangeDetails = {
|
|
149
|
+
reason: "none",
|
|
150
|
+
event,
|
|
151
|
+
isCanceled: false,
|
|
152
|
+
cancel: () => void (details.isCanceled = true),
|
|
153
|
+
}
|
|
154
|
+
change(v, details)
|
|
155
|
+
return details.isCanceled ? "The app refused the change." : undefined
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const agentSet = (next: string) =>
|
|
159
|
+
editing ? "A person is editing this row." : commit(next, (v) => changeAsAgent(change, v))
|
|
160
|
+
|
|
161
|
+
useAgentControl(() =>
|
|
162
|
+
editable
|
|
163
|
+
? {
|
|
164
|
+
kind: multiline ? "textarea" : "input",
|
|
165
|
+
element: row.current,
|
|
166
|
+
label: row.current?.ownerDocument.getElementById(termId)?.textContent?.trim(),
|
|
167
|
+
value,
|
|
168
|
+
disabled,
|
|
169
|
+
actions: {
|
|
170
|
+
setValue: (next: string) => agentSet(String(next ?? "")),
|
|
171
|
+
clear: () => agentSet(""),
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
: null
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<ItemContext.Provider
|
|
179
|
+
value={{ termId, value, editing, setEditing, save, copyable, editable, multiline, renderEditor, disabled, hasAgent }}
|
|
180
|
+
>
|
|
181
|
+
<div
|
|
182
|
+
ref={setRef}
|
|
183
|
+
data-slot="detail-list-item"
|
|
184
|
+
className={cn(
|
|
185
|
+
"group/item grid min-h-12 items-start gap-x-3 gap-y-0.5 border-t py-3.5 md:py-3",
|
|
186
|
+
layout === "side" && "md:grid-cols-[150px_minmax(0,1fr)]",
|
|
187
|
+
"transition-[background-color] [transition-duration:250ms] ease-out motion-reduce:transition-none",
|
|
188
|
+
"data-[saved]:bg-[color:color-mix(in_oklab,var(--success)_18%,transparent)] data-[saved]:duration-0",
|
|
189
|
+
"motion-reduce:data-[saved]:bg-transparent",
|
|
190
|
+
className
|
|
191
|
+
)}
|
|
192
|
+
{...props}
|
|
193
|
+
/>
|
|
194
|
+
</ItemContext.Provider>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
DetailListItem.displayName = "DetailListItem"
|
|
199
|
+
|
|
200
|
+
/** The label, as a `dt`. */
|
|
201
|
+
const DetailListTerm = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>(
|
|
202
|
+
({ className, ...props }, ref) => {
|
|
203
|
+
const item = React.useContext(ItemContext)
|
|
204
|
+
return (
|
|
205
|
+
<dt
|
|
206
|
+
ref={ref}
|
|
207
|
+
id={item?.termId}
|
|
208
|
+
data-slot="detail-list-term"
|
|
209
|
+
className={cn("pt-0.5 text-sm text-muted-foreground md:text-[13px]", className)}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
DetailListTerm.displayName = "DetailListTerm"
|
|
216
|
+
|
|
217
|
+
export interface DetailListDetailsProps extends Omit<React.HTMLAttributes<HTMLElement>, "children"> {
|
|
218
|
+
/** What the row shows. Defaults to the item's value; a function gets the value to show it your way. */
|
|
219
|
+
children?: React.ReactNode | ((value: string) => React.ReactNode)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const iconButton =
|
|
223
|
+
"inline-grid size-11 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40 md:size-[30px]"
|
|
224
|
+
|
|
225
|
+
/** The value, as a `dd`, with the row's copy and edit buttons and its editor. */
|
|
226
|
+
const DetailListDetails = React.forwardRef<HTMLElement, DetailListDetailsProps>(
|
|
227
|
+
({ className, children, ...props }, ref) => {
|
|
228
|
+
const item = React.useContext(ItemContext)
|
|
229
|
+
const [copied, setCopied] = React.useState<"done" | "failed" | null>(null)
|
|
230
|
+
const editButton = React.useRef<HTMLButtonElement | null>(null)
|
|
231
|
+
const refocus = React.useRef(false)
|
|
232
|
+
const editing = !!item?.editing
|
|
233
|
+
|
|
234
|
+
React.useEffect(() => {
|
|
235
|
+
if (editing || !refocus.current) return
|
|
236
|
+
refocus.current = false
|
|
237
|
+
editButton.current?.focus()
|
|
238
|
+
}, [editing])
|
|
239
|
+
|
|
240
|
+
React.useEffect(() => {
|
|
241
|
+
if (!copied) return
|
|
242
|
+
const t = setTimeout(() => setCopied(null), 1400)
|
|
243
|
+
return () => clearTimeout(t)
|
|
244
|
+
}, [copied])
|
|
245
|
+
|
|
246
|
+
const shown = typeof children === "function" ? children(item?.value ?? "") : (children ?? item?.value)
|
|
247
|
+
const labelledBy = (id: string) => (item ? `${id} ${item.termId}` : undefined)
|
|
248
|
+
const copyId = React.useId()
|
|
249
|
+
const editId = React.useId()
|
|
250
|
+
|
|
251
|
+
const close = () => {
|
|
252
|
+
refocus.current = true
|
|
253
|
+
item?.setEditing(false)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<dd
|
|
258
|
+
ref={ref}
|
|
259
|
+
data-slot="detail-list-details"
|
|
260
|
+
className={cn("m-0 flex min-w-0 items-start gap-2 text-base leading-[1.45] md:text-sm", className)}
|
|
261
|
+
{...props}
|
|
262
|
+
>
|
|
263
|
+
{item && editing ? (
|
|
264
|
+
<Editor item={item} onClose={close} />
|
|
265
|
+
) : (
|
|
266
|
+
<div className="min-w-0 flex-1 whitespace-pre-line break-words pt-px">{shown}</div>
|
|
267
|
+
)}
|
|
268
|
+
{item && (item.copyable || item.editable) && (
|
|
269
|
+
<div
|
|
270
|
+
className={cn(
|
|
271
|
+
"-my-2.5 -me-2.5 flex shrink-0 gap-0.5 md:-my-[5px] md:-me-1.5",
|
|
272
|
+
"transition-opacity duration-100 motion-reduce:transition-none",
|
|
273
|
+
"md:opacity-0 md:group-hover/item:opacity-100 md:group-focus-within/item:opacity-100",
|
|
274
|
+
editing && "max-md:hidden md:invisible"
|
|
275
|
+
)}
|
|
276
|
+
>
|
|
277
|
+
{item.copyable && (
|
|
278
|
+
<button
|
|
279
|
+
type="button"
|
|
280
|
+
className={iconButton}
|
|
281
|
+
aria-labelledby={labelledBy(copyId)}
|
|
282
|
+
onClick={() => {
|
|
283
|
+
// No clipboard outside a secure context, and a denied write rejects.
|
|
284
|
+
const write = navigator.clipboard?.writeText(item.value)
|
|
285
|
+
if (!write) return setCopied("failed")
|
|
286
|
+
write.then(
|
|
287
|
+
() => setCopied("done"),
|
|
288
|
+
() => setCopied("failed")
|
|
289
|
+
)
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
<span id={copyId} className="sr-only">
|
|
293
|
+
Copy
|
|
294
|
+
</span>
|
|
295
|
+
{copied === "done" ? <Check className="size-[15px] text-foreground" aria-hidden /> : <Copy className="size-[15px]" aria-hidden />}
|
|
296
|
+
</button>
|
|
297
|
+
)}
|
|
298
|
+
{item.editable && (
|
|
299
|
+
<button
|
|
300
|
+
ref={editButton}
|
|
301
|
+
type="button"
|
|
302
|
+
className={iconButton}
|
|
303
|
+
aria-labelledby={labelledBy(editId)}
|
|
304
|
+
disabled={item.disabled}
|
|
305
|
+
data-agent-part={item.hasAgent ? "" : undefined}
|
|
306
|
+
onClick={() => item.setEditing(true)}
|
|
307
|
+
>
|
|
308
|
+
<span id={editId} className="sr-only">
|
|
309
|
+
Edit
|
|
310
|
+
</span>
|
|
311
|
+
<Pencil className="size-[15px]" aria-hidden />
|
|
312
|
+
</button>
|
|
313
|
+
)}
|
|
314
|
+
<span className="sr-only" aria-live="polite">
|
|
315
|
+
{copied === "done" ? "Copied" : copied === "failed" ? "Could not copy" : ""}
|
|
316
|
+
</span>
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
</dd>
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
DetailListDetails.displayName = "DetailListDetails"
|
|
324
|
+
|
|
325
|
+
const fieldClass =
|
|
326
|
+
"w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 text-base outline-none transition-[box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-[color:color-mix(in_oklab,var(--ring)_50%,transparent)] aria-[invalid=true]:border-destructive md:text-sm"
|
|
327
|
+
|
|
328
|
+
function Editor({ item, onClose }: { item: ItemContextValue; onClose: () => void }) {
|
|
329
|
+
const [draft, setDraft] = React.useState(item.value)
|
|
330
|
+
const [error, setError] = React.useState<string>()
|
|
331
|
+
const errorId = React.useId()
|
|
332
|
+
|
|
333
|
+
const save = (event?: Event, next = draft) => {
|
|
334
|
+
const refused = item.save(next, event)
|
|
335
|
+
if (refused) setError(refused)
|
|
336
|
+
else onClose()
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const onKeyDown = (event: React.KeyboardEvent) => {
|
|
340
|
+
if (event.key === "Escape") {
|
|
341
|
+
event.preventDefault()
|
|
342
|
+
event.stopPropagation()
|
|
343
|
+
onClose()
|
|
344
|
+
} else if (
|
|
345
|
+
event.key === "Enter" &&
|
|
346
|
+
// Enter also confirms a word in an input method, which is not a save.
|
|
347
|
+
!event.nativeEvent.isComposing &&
|
|
348
|
+
(!item.multiline || event.metaKey || event.ctrlKey)
|
|
349
|
+
) {
|
|
350
|
+
event.preventDefault()
|
|
351
|
+
save(event.nativeEvent)
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// The editor only mounts on a click, so reading the platform here cannot mismatch the server.
|
|
356
|
+
const mod = /Mac|iPhone|iPad/.test(navigator.userAgent) ? "⌘" : "Ctrl"
|
|
357
|
+
|
|
358
|
+
const change = (next: string) => {
|
|
359
|
+
setDraft(next)
|
|
360
|
+
setError(undefined)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const fieldProps: DetailListEditorProps["fieldProps"] = {
|
|
364
|
+
autoFocus: true,
|
|
365
|
+
"aria-labelledby": item.termId,
|
|
366
|
+
"aria-invalid": error ? true : undefined,
|
|
367
|
+
"aria-describedby": error ? errorId : undefined,
|
|
368
|
+
"data-agent-part": item.hasAgent ? "" : undefined,
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const field = {
|
|
372
|
+
...fieldProps,
|
|
373
|
+
value: draft,
|
|
374
|
+
onKeyDown,
|
|
375
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => change(e.target.value),
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<div className="grid min-w-0 flex-1 gap-2">
|
|
380
|
+
{item.renderEditor ? (
|
|
381
|
+
item.renderEditor({
|
|
382
|
+
value: draft,
|
|
383
|
+
setValue: change,
|
|
384
|
+
save: (next) => {
|
|
385
|
+
if (next !== undefined) setDraft(next)
|
|
386
|
+
save(undefined, next ?? draft)
|
|
387
|
+
},
|
|
388
|
+
cancel: onClose,
|
|
389
|
+
onKeyDown,
|
|
390
|
+
fieldProps,
|
|
391
|
+
})
|
|
392
|
+
) : item.multiline ? (
|
|
393
|
+
<textarea {...field} rows={Math.max(2, draft.split("\n").length)} className={cn(fieldClass, "resize-none py-[7px] leading-[1.45]")} />
|
|
394
|
+
) : (
|
|
395
|
+
<input {...field} className={cn(fieldClass, "h-11 md:h-[34px]")} />
|
|
396
|
+
)}
|
|
397
|
+
{error && (
|
|
398
|
+
<p id={errorId} role="alert" className="text-[13px] text-destructive">
|
|
399
|
+
{error}
|
|
400
|
+
</p>
|
|
401
|
+
)}
|
|
402
|
+
<div className="flex items-center gap-1.5">
|
|
403
|
+
<Button size="sm" className="h-11 md:h-8" onClick={(e) => save(e.nativeEvent)}>
|
|
404
|
+
Save
|
|
405
|
+
</Button>
|
|
406
|
+
<Button size="sm" variant="ghost" className="h-11 md:h-8" onClick={onClose}>
|
|
407
|
+
Cancel
|
|
408
|
+
</Button>
|
|
409
|
+
{!item.renderEditor && (
|
|
410
|
+
<span className="ms-auto text-[11.5px] text-muted-foreground max-md:hidden">
|
|
411
|
+
{item.multiline ? `${mod} Enter` : "Enter"} to save · Esc to cancel
|
|
412
|
+
</span>
|
|
413
|
+
)}
|
|
414
|
+
</div>
|
|
415
|
+
</div>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export { DetailList, DetailListItem, DetailListTerm, DetailListDetails }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export {
|
|
2
|
+
DetailList,
|
|
3
|
+
DetailListItem,
|
|
4
|
+
DetailListTerm,
|
|
5
|
+
DetailListDetails,
|
|
6
|
+
type DetailListProps,
|
|
7
|
+
type DetailListItemProps,
|
|
8
|
+
type DetailListDetailsProps,
|
|
9
|
+
type DetailListLayout,
|
|
10
|
+
type DetailListChangeDetails,
|
|
11
|
+
type DetailListEditorProps,
|
|
12
|
+
} from "./detail-list"
|