feat: add InlineEdit, ConfirmDialog, MultiSelect to Inventory demos
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
BarChart,
|
BarChart,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
CommandPalette,
|
CommandPalette,
|
||||||
|
ConfirmDialog,
|
||||||
DataTable,
|
DataTable,
|
||||||
DetailPanel,
|
DetailPanel,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
@@ -17,6 +18,7 @@ import {
|
|||||||
LineChart,
|
LineChart,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Modal,
|
Modal,
|
||||||
|
MultiSelect,
|
||||||
Popover,
|
Popover,
|
||||||
ProcessorTimeline,
|
ProcessorTimeline,
|
||||||
ShortcutsBar,
|
ShortcutsBar,
|
||||||
@@ -208,6 +210,13 @@ export function CompositesSection() {
|
|||||||
]
|
]
|
||||||
const [activeFilters, setActiveFilters] = useState([{ label: 'Live', value: 'live' }])
|
const [activeFilters, setActiveFilters] = useState([{ label: 'Live', value: 'live' }])
|
||||||
|
|
||||||
|
// ConfirmDialog
|
||||||
|
const [confirmOpen, setConfirmOpen] = useState(false)
|
||||||
|
const [confirmDone, setConfirmDone] = useState(false)
|
||||||
|
|
||||||
|
// MultiSelect
|
||||||
|
const [multiValue, setMultiValue] = useState<string[]>(['admin'])
|
||||||
|
|
||||||
// 15. Modal
|
// 15. Modal
|
||||||
const [modalOpen, setModalOpen] = useState(false)
|
const [modalOpen, setModalOpen] = useState(false)
|
||||||
|
|
||||||
@@ -294,6 +303,21 @@ export function CompositesSection() {
|
|||||||
/>
|
/>
|
||||||
</DemoCard>
|
</DemoCard>
|
||||||
|
|
||||||
|
{/* 2b. ConfirmDialog */}
|
||||||
|
<DemoCard id="confirm-dialog" title="ConfirmDialog" description="Type-to-confirm destructive action dialog. Built on Modal.">
|
||||||
|
<Button size="sm" variant="danger" onClick={() => { setConfirmOpen(true); setConfirmDone(false) }}>
|
||||||
|
Delete project
|
||||||
|
</Button>
|
||||||
|
{confirmDone && <span style={{ color: 'var(--success)', fontSize: 12, marginLeft: 8 }}>Deleted!</span>}
|
||||||
|
<ConfirmDialog
|
||||||
|
open={confirmOpen}
|
||||||
|
onClose={() => setConfirmOpen(false)}
|
||||||
|
onConfirm={() => { setConfirmOpen(false); setConfirmDone(true) }}
|
||||||
|
message={'Delete project "my-project"? This cannot be undone.'}
|
||||||
|
confirmText="my-project"
|
||||||
|
/>
|
||||||
|
</DemoCard>
|
||||||
|
|
||||||
{/* 3. AreaChart */}
|
{/* 3. AreaChart */}
|
||||||
<DemoCard
|
<DemoCard
|
||||||
id="areachart"
|
id="areachart"
|
||||||
@@ -511,6 +535,27 @@ export function CompositesSection() {
|
|||||||
</Modal>
|
</Modal>
|
||||||
</DemoCard>
|
</DemoCard>
|
||||||
|
|
||||||
|
{/* 15b. MultiSelect */}
|
||||||
|
<DemoCard id="multi-select" title="MultiSelect" description="Dropdown with searchable checkbox list and Apply action.">
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, maxWidth: 260 }}>
|
||||||
|
<MultiSelect
|
||||||
|
options={[
|
||||||
|
{ value: 'admin', label: 'ADMIN' },
|
||||||
|
{ value: 'editor', label: 'EDITOR' },
|
||||||
|
{ value: 'viewer', label: 'VIEWER' },
|
||||||
|
{ value: 'operator', label: 'OPERATOR' },
|
||||||
|
{ value: 'auditor', label: 'AUDITOR' },
|
||||||
|
]}
|
||||||
|
value={multiValue}
|
||||||
|
onChange={setMultiValue}
|
||||||
|
placeholder="Add roles..."
|
||||||
|
/>
|
||||||
|
<span style={{ fontSize: 11, color: 'var(--text-muted)' }}>
|
||||||
|
Selected: {multiValue.join(', ') || 'none'}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</DemoCard>
|
||||||
|
|
||||||
{/* 16. Popover */}
|
{/* 16. Popover */}
|
||||||
<DemoCard
|
<DemoCard
|
||||||
id="popover"
|
id="popover"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
FilterPill,
|
FilterPill,
|
||||||
FormField,
|
FormField,
|
||||||
InfoCallout,
|
InfoCallout,
|
||||||
|
InlineEdit,
|
||||||
Input,
|
Input,
|
||||||
KeyboardHint,
|
KeyboardHint,
|
||||||
Label,
|
Label,
|
||||||
@@ -95,6 +96,9 @@ export function PrimitivesSection() {
|
|||||||
end: new Date('2026-03-18T23:59'),
|
end: new Date('2026-03-18T23:59'),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// InlineEdit state
|
||||||
|
const [inlineValue, setInlineValue] = useState('Alice Johnson')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="primitives" className={styles.section}>
|
<section id="primitives" className={styles.section}>
|
||||||
<h2 className={styles.sectionTitle}>Primitives</h2>
|
<h2 className={styles.sectionTitle}>Primitives</h2>
|
||||||
@@ -328,6 +332,15 @@ export function PrimitivesSection() {
|
|||||||
<Input icon="🔍" placeholder="With icon" />
|
<Input icon="🔍" placeholder="With icon" />
|
||||||
</DemoCard>
|
</DemoCard>
|
||||||
|
|
||||||
|
{/* 15b. InlineEdit */}
|
||||||
|
<DemoCard id="inline-edit" title="InlineEdit" description="Click-to-edit text field. Enter saves, Escape/blur cancels.">
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||||
|
<InlineEdit value={inlineValue} onSave={setInlineValue} />
|
||||||
|
<InlineEdit value="" onSave={() => {}} placeholder="Click to add name..." />
|
||||||
|
<InlineEdit value="Read only" onSave={() => {}} disabled />
|
||||||
|
</div>
|
||||||
|
</DemoCard>
|
||||||
|
|
||||||
{/* 16. KeyboardHint */}
|
{/* 16. KeyboardHint */}
|
||||||
<DemoCard
|
<DemoCard
|
||||||
id="keyboardhint"
|
id="keyboardhint"
|
||||||
|
|||||||
Reference in New Issue
Block a user