@agentero/design-system 0.27.1 → 0.28.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/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/merge-props.d.ts +42 -0
- package/lib/merge-props.js +24 -0
- package/mcp/manifests/components.html +796 -71
- package/mcp/manifests/components.json +500 -9
- package/package.json +10 -1
- package/src/alert/alert.js +28 -28
- package/src/avatar/avatar.js +22 -22
- package/src/avatar-group/avatar-group.js +6 -6
- package/src/button/button.js +7 -7
- package/src/data-table/data-table.js +36 -36
- package/src/field/context.d.ts +62 -0
- package/src/field/context.js +6 -0
- package/src/field/field.d.ts +214 -0
- package/src/field/field.js +129 -0
- package/src/field/icons.d.ts +9 -0
- package/src/field/icons.js +14 -0
- package/src/field/index.d.ts +30 -0
- package/src/field/index.js +13 -0
- package/src/field-text/field-text.d.ts +28 -0
- package/src/field-text/field-text.js +26 -0
- package/src/field-text/index.d.ts +2 -0
- package/src/field-text/index.js +2 -0
- package/src/input/context.d.ts +17 -0
- package/src/input/context.js +10 -0
- package/src/input/index.d.ts +1 -0
- package/src/input/index.js +3 -2
- package/src/input/input.d.ts +7 -7
- package/src/input/input.js +16 -11
- package/src/label/context.d.ts +13 -0
- package/src/label/context.js +7 -0
- package/src/label/index.d.ts +1 -0
- package/src/label/index.js +3 -2
- package/src/label/label.d.ts +6 -1
- package/src/label/label.js +19 -17
- package/src/modal/modal.js +23 -23
- package/src/progress/progress.js +9 -9
- package/src/switch/switch.js +7 -7
- package/src/table/table.js +28 -28
- package/src/tabs/tabs.js +26 -26
- package/src/tag/tag.js +7 -7
|
@@ -588,13 +588,13 @@
|
|
|
588
588
|
<header>
|
|
589
589
|
<div class="wrap">
|
|
590
590
|
<h1>Manifest Debugger</h1>
|
|
591
|
-
<div class="summary"><a class="filter-pill all" data-k="all" href="#filter-all">All</a><span class="filter-pill ok" aria-disabled="true">
|
|
591
|
+
<div class="summary"><a class="filter-pill all" data-k="all" href="#filter-all">All</a><span class="filter-pill ok" aria-disabled="true">29 components ok</span><span class="filter-pill ok" aria-disabled="true">238 stories ok</span></div>
|
|
592
592
|
</div>
|
|
593
593
|
</header>
|
|
594
594
|
<main>
|
|
595
595
|
<div class="wrap">
|
|
596
596
|
<div class="note ok" style="margin-bottom: 16px;">
|
|
597
|
-
Using <code>react-component-meta</code>. Generation took <strong>4.
|
|
597
|
+
Using <code>react-component-meta</code>. Generation took <strong>4.1s</strong>.
|
|
598
598
|
</div>
|
|
599
599
|
<h2 class="section-title">Components</h2>
|
|
600
600
|
<div class="grid" role="list">
|
|
@@ -4487,6 +4487,708 @@ actions outright unless the user needs to see them and understand why.</div>
|
|
|
4487
4487
|
</div>
|
|
4488
4488
|
|
|
4489
4489
|
|
|
4490
|
+
</div>
|
|
4491
|
+
</article>
|
|
4492
|
+
<article
|
|
4493
|
+
class="card
|
|
4494
|
+
no-error
|
|
4495
|
+
no-info
|
|
4496
|
+
no-story-error
|
|
4497
|
+
no-doc-error"
|
|
4498
|
+
role="listitem"
|
|
4499
|
+
aria-label="Field.Root">
|
|
4500
|
+
<div class="head">
|
|
4501
|
+
<div class="title">
|
|
4502
|
+
<h2><span class="status-dot dot-ok"></span> Field.Root</h2>
|
|
4503
|
+
<div class="badges">
|
|
4504
|
+
<label for="c-11-components-field-props" class="badge ok as-toggle">6 prop types</label>
|
|
4505
|
+
|
|
4506
|
+
<label for="c-11-components-field-stories" class="badge ok as-toggle">15 stories</label>
|
|
4507
|
+
|
|
4508
|
+
|
|
4509
|
+
</div>
|
|
4510
|
+
</div>
|
|
4511
|
+
<div class="meta" title="./src/field/field.stories.tsx">components-field · ./src/field/field.stories.tsx</div>
|
|
4512
|
+
<div>Wraps a label, control, description and error into one field</div>
|
|
4513
|
+
<div class="hint">Field lays out a single form field — label, control, helper text and error —
|
|
4514
|
+
and wires the accessibility relationships between them. `Field.Root`
|
|
4515
|
+
generates the ids and shares them through context: `Label` reads
|
|
4516
|
+
`LabelContext`, `Field.Description` and `Field.Error` read `FieldContext`,
|
|
4517
|
+
and a `Field<X>` such as `FieldText` provides the control's context. Nobody
|
|
4518
|
+
passes an `id` by hand.
|
|
4519
|
+
|
|
4520
|
+
Presentational and form-library agnostic: pass `invalid` and the error
|
|
4521
|
+
messages from whatever validates the form. Spacing between fields belongs to
|
|
4522
|
+
`Field.Group`, never to a margin on the field itself.
|
|
4523
|
+
|
|
4524
|
+
`Field.Description` and `Field.Error` register themselves with the root, so
|
|
4525
|
+
the control's `aria-describedby` lists exactly the messages on screen and is
|
|
4526
|
+
absent when there is none.</div>
|
|
4527
|
+
<div class="kv"><span class="chip">summary: Wraps a label, control, description and error into one field</span><span class="chip">example: <Field.Root invalid={!!error} required>
|
|
4528
|
+
<Field.Label>Email</Field.Label>
|
|
4529
|
+
<Input type="email" />
|
|
4530
|
+
<Field.Description>We only use this for policy documents.</Field.Description>
|
|
4531
|
+
<Field.Error errors={[error]} />
|
|
4532
|
+
</Field.Root></span></div>
|
|
4533
|
+
</div>
|
|
4534
|
+
|
|
4535
|
+
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
4536
|
+
|
|
4537
|
+
|
|
4538
|
+
<input id="c-11-components-field-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
4539
|
+
|
|
4540
|
+
|
|
4541
|
+
<input id="c-11-components-field-props" class="tg tg-props" type="checkbox" hidden />
|
|
4542
|
+
|
|
4543
|
+
<div class="panels">
|
|
4544
|
+
|
|
4545
|
+
|
|
4546
|
+
|
|
4547
|
+
<div class="panel panel-props">
|
|
4548
|
+
<div class="note ok">
|
|
4549
|
+
<div class="row">
|
|
4550
|
+
<span class="ex-name">Prop types <small>(react-component-meta)</small></span>
|
|
4551
|
+
<span class="badge ok">6 prop types</span>
|
|
4552
|
+
</div>
|
|
4553
|
+
<pre><code>Component: src/field/index.ts::Field</code></pre>
|
|
4554
|
+
<pre><code>Props:</code></pre>
|
|
4555
|
+
<pre><code>/**
|
|
4556
|
+
* `id` for the control. Generated when omitted. Set it here, not on the
|
|
4557
|
+
* control, so the label and the messages keep pointing at the right element.
|
|
4558
|
+
*/
|
|
4559
|
+
controlId?: string
|
|
4560
|
+
|
|
4561
|
+
/**
|
|
4562
|
+
* Disables the control through its context and sets `data-disabled` on the root.
|
|
4563
|
+
*/
|
|
4564
|
+
disabled?: boolean = false
|
|
4565
|
+
|
|
4566
|
+
/**
|
|
4567
|
+
* Marks the field as failing validation: sets `data-invalid` on the root and
|
|
4568
|
+
* `aria-invalid` on the control through its context, which drives the
|
|
4569
|
+
* control's destructive border. The label keeps its color by design.
|
|
4570
|
+
*/
|
|
4571
|
+
invalid?: boolean = false
|
|
4572
|
+
|
|
4573
|
+
/**
|
|
4574
|
+
* Layout of the field. `vertical` (default) stacks label, control and
|
|
4575
|
+
* messages. `horizontal` is one row at every width: the first child fills it
|
|
4576
|
+
* and the rest keep their natural width, aligned to the right, so the
|
|
4577
|
+
* controls of stacked fields line up. `responsive` stacks below `28rem` and
|
|
4578
|
+
* behaves like `horizontal` from there, measured on the field itself, so it
|
|
4579
|
+
* needs no particular wrapper. In both, `Field.Content` groups a control with
|
|
4580
|
+
* its messages, or a label with its description.
|
|
4581
|
+
*/
|
|
4582
|
+
orientation?: "horizontal" | "vertical" | "responsive" = 'vertical'
|
|
4583
|
+
|
|
4584
|
+
/**
|
|
4585
|
+
* Makes the control read-only through its context (focusable and copyable,
|
|
4586
|
+
* not editable, still submitted) and sets `data-readonly` on the root.
|
|
4587
|
+
*/
|
|
4588
|
+
readOnly?: boolean = false
|
|
4589
|
+
|
|
4590
|
+
/**
|
|
4591
|
+
* Single source of truth for a required field: the `Label` shows its
|
|
4592
|
+
* asterisk and the control receives `required`, both through context.
|
|
4593
|
+
*/
|
|
4594
|
+
required?: boolean = false</code></pre>
|
|
4595
|
+
</div>
|
|
4596
|
+
</div>
|
|
4597
|
+
|
|
4598
|
+
<div class="panel panel-stories">
|
|
4599
|
+
|
|
4600
|
+
|
|
4601
|
+
|
|
4602
|
+
<div class="note ok">
|
|
4603
|
+
<div class="row">
|
|
4604
|
+
<span class="ex-name">Imports</span>
|
|
4605
|
+
</div>
|
|
4606
|
+
<pre><code>import { Field, FieldContext, Label } from "@agentero/design-system";</code></pre>
|
|
4607
|
+
</div>
|
|
4608
|
+
|
|
4609
|
+
|
|
4610
|
+
<div class="note ok">
|
|
4611
|
+
<div class="row">
|
|
4612
|
+
<span class="ex-name">Default</span>
|
|
4613
|
+
<span class="badge ok">story ok</span>
|
|
4614
|
+
</div>
|
|
4615
|
+
<div>Default vertical field with label, control and description</div>
|
|
4616
|
+
<div class="hint">A vertical field with a label, a control and helper text. The label points
|
|
4617
|
+
at the control and the description is referenced by it — neither needed an
|
|
4618
|
+
explicit `id`.</div>
|
|
4619
|
+
<pre><code>const Default = () => <Field.Root
|
|
4620
|
+
orientation="vertical"
|
|
4621
|
+
invalid={false}
|
|
4622
|
+
disabled={false}
|
|
4623
|
+
readOnly={false}
|
|
4624
|
+
required={false}>
|
|
4625
|
+
<Label>Email</Label>
|
|
4626
|
+
<DemoInput placeholder="you@example.com" />
|
|
4627
|
+
<Field.Description>We only use this to send policy documents.</Field.Description>
|
|
4628
|
+
</Field.Root>;</code></pre>
|
|
4629
|
+
</div>
|
|
4630
|
+
<div class="note ok">
|
|
4631
|
+
<div class="row">
|
|
4632
|
+
<span class="ex-name">Required</span>
|
|
4633
|
+
<span class="badge ok">story ok</span>
|
|
4634
|
+
</div>
|
|
4635
|
+
<div>Required field driven from the root alone</div>
|
|
4636
|
+
<div class="hint">`required` on the root is the single source of truth: the label shows its
|
|
4637
|
+
asterisk and the control receives `required`, both through context.</div>
|
|
4638
|
+
<pre><code>const Required = () => <Field.Root
|
|
4639
|
+
orientation="vertical"
|
|
4640
|
+
invalid={false}
|
|
4641
|
+
disabled={false}
|
|
4642
|
+
readOnly={false}
|
|
4643
|
+
required>
|
|
4644
|
+
<Label>Full name</Label>
|
|
4645
|
+
<DemoInput placeholder="Jane Doe" />
|
|
4646
|
+
</Field.Root>;</code></pre>
|
|
4647
|
+
</div>
|
|
4648
|
+
<div class="note ok">
|
|
4649
|
+
<div class="row">
|
|
4650
|
+
<span class="ex-name">Optional</span>
|
|
4651
|
+
<span class="badge ok">story ok</span>
|
|
4652
|
+
</div>
|
|
4653
|
+
<div>Optional field with the muted label suffix</div>
|
|
4654
|
+
<div class="hint">`optional` on the label appends the muted suffix; the control stays
|
|
4655
|
+
non-required.</div>
|
|
4656
|
+
<pre><code>const Optional = () => <Field.Root
|
|
4657
|
+
orientation="vertical"
|
|
4658
|
+
invalid={false}
|
|
4659
|
+
disabled={false}
|
|
4660
|
+
readOnly={false}
|
|
4661
|
+
required={false}>
|
|
4662
|
+
<Label optional>Phone number</Label>
|
|
4663
|
+
<DemoInput type="tel" placeholder="+1 (555) 000-0000" />
|
|
4664
|
+
</Field.Root>;</code></pre>
|
|
4665
|
+
</div>
|
|
4666
|
+
<div class="note ok">
|
|
4667
|
+
<div class="row">
|
|
4668
|
+
<span class="ex-name">With Tooltip</span>
|
|
4669
|
+
<span class="badge ok">story ok</span>
|
|
4670
|
+
</div>
|
|
4671
|
+
<div>Label with a tooltip trigger beside it</div>
|
|
4672
|
+
<div class="hint">`Field.Label` puts an info button beside the caption. It is a sibling of the
|
|
4673
|
+
`<label>`, so it keeps its own accessible name, clicking it does not focus
|
|
4674
|
+
the control, and the control's name stays clean. It opens on focus too.</div>
|
|
4675
|
+
<pre><code>const WithTooltip = () => <Field.Root
|
|
4676
|
+
orientation="vertical"
|
|
4677
|
+
invalid={false}
|
|
4678
|
+
disabled={false}
|
|
4679
|
+
readOnly={false}
|
|
4680
|
+
required>
|
|
4681
|
+
<Field.Label tooltip="Issued by the IRS to identify your business.">Tax ID</Field.Label>
|
|
4682
|
+
<DemoInput placeholder="XX-XXXXXXX" />
|
|
4683
|
+
</Field.Root>;</code></pre>
|
|
4684
|
+
</div>
|
|
4685
|
+
<div class="note ok">
|
|
4686
|
+
<div class="row">
|
|
4687
|
+
<span class="ex-name">Invalid</span>
|
|
4688
|
+
<span class="badge ok">story ok</span>
|
|
4689
|
+
</div>
|
|
4690
|
+
<div>Invalid field with a single error message</div>
|
|
4691
|
+
<div class="hint">`invalid` on the root sets `data-invalid` for styling and `aria-invalid` on
|
|
4692
|
+
the control, which drives its destructive border; the label keeps its color
|
|
4693
|
+
by design. `Field.Error` takes the error objects as they come from a form
|
|
4694
|
+
library.</div>
|
|
4695
|
+
<pre><code>const Invalid = () => <Field.Root
|
|
4696
|
+
orientation="vertical"
|
|
4697
|
+
invalid
|
|
4698
|
+
disabled={false}
|
|
4699
|
+
readOnly={false}
|
|
4700
|
+
required={false}>
|
|
4701
|
+
<Label>Email</Label>
|
|
4702
|
+
<DemoInput type="email" defaultValue="not-an-email" />
|
|
4703
|
+
<Field.Error errors={[{ message: 'Enter a valid email address.' }]} />
|
|
4704
|
+
</Field.Root>;</code></pre>
|
|
4705
|
+
</div>
|
|
4706
|
+
<div class="note ok">
|
|
4707
|
+
<div class="row">
|
|
4708
|
+
<span class="ex-name">Multiple Errors</span>
|
|
4709
|
+
<span class="badge ok">story ok</span>
|
|
4710
|
+
</div>
|
|
4711
|
+
<div>Several errors rendered as a de-duplicated list</div>
|
|
4712
|
+
<div class="hint">Several errors render as a list, de-duplicated by message.</div>
|
|
4713
|
+
<pre><code>const MultipleErrors = () => <Field.Root
|
|
4714
|
+
orientation="vertical"
|
|
4715
|
+
invalid
|
|
4716
|
+
disabled={false}
|
|
4717
|
+
readOnly={false}
|
|
4718
|
+
required={false}>
|
|
4719
|
+
<Label>Password</Label>
|
|
4720
|
+
<DemoInput type="password" defaultValue="abc" />
|
|
4721
|
+
<Field.Error
|
|
4722
|
+
errors={[
|
|
4723
|
+
{ message: 'Use at least 8 characters.' },
|
|
4724
|
+
{ message: 'Include a number.' },
|
|
4725
|
+
{ message: 'Use at least 8 characters.' }
|
|
4726
|
+
]} />
|
|
4727
|
+
</Field.Root>;</code></pre>
|
|
4728
|
+
</div>
|
|
4729
|
+
<div class="note ok">
|
|
4730
|
+
<div class="row">
|
|
4731
|
+
<span class="ex-name">No Error</span>
|
|
4732
|
+
<span class="badge ok">story ok</span>
|
|
4733
|
+
</div>
|
|
4734
|
+
<div>Error stays mounted and renders nothing while valid</div>
|
|
4735
|
+
<div class="hint">`Field.Error` renders nothing without a message, so it can stay mounted and
|
|
4736
|
+
receive `undefined` entries while the field is valid. With no description
|
|
4737
|
+
either, the control carries no `aria-describedby` at all.</div>
|
|
4738
|
+
<pre><code>const NoError = () => <Field.Root
|
|
4739
|
+
orientation="vertical"
|
|
4740
|
+
invalid={false}
|
|
4741
|
+
disabled={false}
|
|
4742
|
+
readOnly={false}
|
|
4743
|
+
required={false}>
|
|
4744
|
+
<Label>Email</Label>
|
|
4745
|
+
<DemoInput type="email" />
|
|
4746
|
+
<Field.Error errors={[undefined]} />
|
|
4747
|
+
</Field.Root>;</code></pre>
|
|
4748
|
+
</div>
|
|
4749
|
+
<div class="note ok">
|
|
4750
|
+
<div class="row">
|
|
4751
|
+
<span class="ex-name">Disabled</span>
|
|
4752
|
+
<span class="badge ok">story ok</span>
|
|
4753
|
+
</div>
|
|
4754
|
+
<div>Disabled field driven from the root</div>
|
|
4755
|
+
<div class="hint">`disabled` on the root disables the control through context and sets
|
|
4756
|
+
`data-disabled` for styling.</div>
|
|
4757
|
+
<pre><code>const Disabled = () => <Field.Root
|
|
4758
|
+
orientation="vertical"
|
|
4759
|
+
invalid={false}
|
|
4760
|
+
disabled
|
|
4761
|
+
readOnly={false}
|
|
4762
|
+
required={false}>
|
|
4763
|
+
<Label>Agency</Label>
|
|
4764
|
+
<DemoInput defaultValue="Acme Insurance" />
|
|
4765
|
+
<Field.Description>Managed by your administrator.</Field.Description>
|
|
4766
|
+
</Field.Root>;</code></pre>
|
|
4767
|
+
</div>
|
|
4768
|
+
<div class="note ok">
|
|
4769
|
+
<div class="row">
|
|
4770
|
+
<span class="ex-name">Read Only</span>
|
|
4771
|
+
<span class="badge ok">story ok</span>
|
|
4772
|
+
</div>
|
|
4773
|
+
<div>Read-only field driven from the root</div>
|
|
4774
|
+
<div class="hint">`readOnly` on the root makes the control read-only through context and sets
|
|
4775
|
+
`data-readonly` for styling. Unlike `disabled`, the value stays focusable,
|
|
4776
|
+
copyable and submitted.</div>
|
|
4777
|
+
<pre><code>const ReadOnly = () => <Field.Root
|
|
4778
|
+
orientation="vertical"
|
|
4779
|
+
invalid={false}
|
|
4780
|
+
disabled={false}
|
|
4781
|
+
readOnly
|
|
4782
|
+
required={false}>
|
|
4783
|
+
<Label>Policy number</Label>
|
|
4784
|
+
<DemoInput defaultValue="POL-2049-118" />
|
|
4785
|
+
<Field.Description>Assigned by the carrier; contact support to change it.</Field.Description>
|
|
4786
|
+
</Field.Root>;</code></pre>
|
|
4787
|
+
</div>
|
|
4788
|
+
<div class="note ok">
|
|
4789
|
+
<div class="row">
|
|
4790
|
+
<span class="ex-name">Horizontal</span>
|
|
4791
|
+
<span class="badge ok">story ok</span>
|
|
4792
|
+
</div>
|
|
4793
|
+
<div>Horizontal field, one row at every width, controls right-aligned</div>
|
|
4794
|
+
<div class="hint">`horizontal` is one row at every width. The first child fills the row and
|
|
4795
|
+
everything after it keeps its natural width, aligned to the right edge, so
|
|
4796
|
+
the controls of stacked fields line up whatever their labels measure. Wrap a
|
|
4797
|
+
label with its description, or a control with its messages, in
|
|
4798
|
+
`Field.Content`. A control sets its own width: `Input` is `w-full`, so it
|
|
4799
|
+
gets one here.</div>
|
|
4800
|
+
<pre><code>const Horizontal = () => (
|
|
4801
|
+
<Field.Group className="w-[40rem]">
|
|
4802
|
+
<Field.Root orientation="horizontal" data-testid="short">
|
|
4803
|
+
<Label>Full name</Label>
|
|
4804
|
+
<DemoInput defaultValue="Rafa Moro" className="w-72" />
|
|
4805
|
+
</Field.Root>
|
|
4806
|
+
|
|
4807
|
+
<Field.Root orientation="horizontal" data-testid="long">
|
|
4808
|
+
<Label>Title</Label>
|
|
4809
|
+
<Field.Content className="w-72">
|
|
4810
|
+
<DemoInput placeholder="Software engineer" />
|
|
4811
|
+
<Field.Description>Shown on your public profile.</Field.Description>
|
|
4812
|
+
</Field.Content>
|
|
4813
|
+
</Field.Root>
|
|
4814
|
+
|
|
4815
|
+
<Field.Root orientation="horizontal" data-testid="switch">
|
|
4816
|
+
<Field.Content>
|
|
4817
|
+
<Label>Auto-renew</Label>
|
|
4818
|
+
<Field.Description>Renews the policy automatically before it expires.</Field.Description>
|
|
4819
|
+
</Field.Content>
|
|
4820
|
+
<DemoInput type="checkbox" className="size-5" />
|
|
4821
|
+
</Field.Root>
|
|
4822
|
+
|
|
4823
|
+
<div className="w-[20rem]" data-testid="narrow">
|
|
4824
|
+
<Field.Root orientation="horizontal">
|
|
4825
|
+
<Label>Email</Label>
|
|
4826
|
+
<DemoInput type="email" placeholder="you@example.com" className="w-40" />
|
|
4827
|
+
</Field.Root>
|
|
4828
|
+
</div>
|
|
4829
|
+
</Field.Group>
|
|
4830
|
+
);</code></pre>
|
|
4831
|
+
</div>
|
|
4832
|
+
<div class="note ok">
|
|
4833
|
+
<div class="row">
|
|
4834
|
+
<span class="ex-name">Responsive</span>
|
|
4835
|
+
<span class="badge ok">story ok</span>
|
|
4836
|
+
</div>
|
|
4837
|
+
<div>Responsive field that stacks when narrow</div>
|
|
4838
|
+
<div class="hint">`responsive` stacks the parts below `28rem` and behaves like `horizontal`
|
|
4839
|
+
from there: first child fills, the rest keep their width on the right. It
|
|
4840
|
+
measures the field itself, so it needs no particular wrapper. A width that
|
|
4841
|
+
should only apply once horizontal goes behind `@md/field:`.</div>
|
|
4842
|
+
<pre><code>const Responsive = () => (
|
|
4843
|
+
<div className="flex flex-col gap-8">
|
|
4844
|
+
<div className="w-full max-w-[40rem]" data-testid="wide">
|
|
4845
|
+
<Field.Root orientation="responsive">
|
|
4846
|
+
<Label>Email</Label>
|
|
4847
|
+
<Field.Content className="@md/field:w-72">
|
|
4848
|
+
<DemoInput type="email" placeholder="you@example.com" />
|
|
4849
|
+
<Field.Description>
|
|
4850
|
+
We only use this to send policy documents, and never to contact you about anything
|
|
4851
|
+
else.
|
|
4852
|
+
</Field.Description>
|
|
4853
|
+
</Field.Content>
|
|
4854
|
+
</Field.Root>
|
|
4855
|
+
</div>
|
|
4856
|
+
|
|
4857
|
+
<div className="w-full max-w-[20rem]" data-testid="narrow">
|
|
4858
|
+
<Field.Root orientation="responsive">
|
|
4859
|
+
<Label>Email</Label>
|
|
4860
|
+
<Field.Content>
|
|
4861
|
+
<DemoInput type="email" placeholder="you@example.com" />
|
|
4862
|
+
<Field.Description>We only use this to send policy documents.</Field.Description>
|
|
4863
|
+
</Field.Content>
|
|
4864
|
+
</Field.Root>
|
|
4865
|
+
</div>
|
|
4866
|
+
</div>
|
|
4867
|
+
);</code></pre>
|
|
4868
|
+
</div>
|
|
4869
|
+
<div class="note ok">
|
|
4870
|
+
<div class="row">
|
|
4871
|
+
<span class="ex-name">Group</span>
|
|
4872
|
+
<span class="badge ok">story ok</span>
|
|
4873
|
+
</div>
|
|
4874
|
+
<div>Several fields stacked in a group</div>
|
|
4875
|
+
<div class="hint">`Field.Group` stacks fields and owns the space between them. Each field gets
|
|
4876
|
+
its own ids, so several on one page never collide.</div>
|
|
4877
|
+
<pre><code>const Group = () => (
|
|
4878
|
+
<Field.Group>
|
|
4879
|
+
<Field.Root required>
|
|
4880
|
+
<Label>Full name</Label>
|
|
4881
|
+
<DemoInput placeholder="Jane Doe" />
|
|
4882
|
+
</Field.Root>
|
|
4883
|
+
|
|
4884
|
+
<Field.Root required invalid>
|
|
4885
|
+
<Label>Email</Label>
|
|
4886
|
+
<DemoInput type="email" defaultValue="not-an-email" />
|
|
4887
|
+
<Field.Error>Enter a valid email address.</Field.Error>
|
|
4888
|
+
</Field.Root>
|
|
4889
|
+
|
|
4890
|
+
<Field.Root>
|
|
4891
|
+
<Label optional>Phone number</Label>
|
|
4892
|
+
<DemoInput type="tel" placeholder="+1 (555) 000-0000" />
|
|
4893
|
+
</Field.Root>
|
|
4894
|
+
</Field.Group>
|
|
4895
|
+
);</code></pre>
|
|
4896
|
+
</div>
|
|
4897
|
+
<div class="note ok">
|
|
4898
|
+
<div class="row">
|
|
4899
|
+
<span class="ex-name">Standalone Outside Field</span>
|
|
4900
|
+
<span class="badge ok">story ok</span>
|
|
4901
|
+
</div>
|
|
4902
|
+
<div>Label and Field.Error used without a Field.Root</div>
|
|
4903
|
+
<div class="hint">Outside a `Field.Root` every part reads a `null` context and works on its own
|
|
4904
|
+
props alone: `Label` needs its `htmlFor`, `Field.Error` its own `id`.</div>
|
|
4905
|
+
<pre><code>const StandaloneOutsideField = () => (
|
|
4906
|
+
<div className="flex flex-col gap-2">
|
|
4907
|
+
<Label htmlFor="standalone-email">Email</Label>
|
|
4908
|
+
<DemoInput id="standalone-email" type="email" aria-describedby="standalone-error" />
|
|
4909
|
+
<Field.Error id="standalone-error">Something went wrong.</Field.Error>
|
|
4910
|
+
</div>
|
|
4911
|
+
);</code></pre>
|
|
4912
|
+
</div>
|
|
4913
|
+
<div class="note ok">
|
|
4914
|
+
<div class="row">
|
|
4915
|
+
<span class="ex-name">Own Props Win</span>
|
|
4916
|
+
<span class="badge ok">story ok</span>
|
|
4917
|
+
</div>
|
|
4918
|
+
<div>Explicit props on a part win over the field's context</div>
|
|
4919
|
+
<div class="hint">A context is a default, never an override: an explicit `htmlFor` or `id` on a
|
|
4920
|
+
part wins over what `Field.Root` provides.</div>
|
|
4921
|
+
<pre><code>const OwnPropsWin = () => (
|
|
4922
|
+
<Field.Root>
|
|
4923
|
+
<Label htmlFor="own-input">Email</Label>
|
|
4924
|
+
<input id="own-input" type="email" className={inputRecipe()} />
|
|
4925
|
+
<Field.Description id="own-description">Points wherever you say.</Field.Description>
|
|
4926
|
+
</Field.Root>
|
|
4927
|
+
);</code></pre>
|
|
4928
|
+
</div>
|
|
4929
|
+
<div class="note ok">
|
|
4930
|
+
<div class="row">
|
|
4931
|
+
<span class="ex-name">Errors From Context</span>
|
|
4932
|
+
<span class="badge ok">story ok</span>
|
|
4933
|
+
</div>
|
|
4934
|
+
<div>Errors supplied to a bare Field.Error through context</div>
|
|
4935
|
+
<div class="hint">`FieldContext` is an extension point: re-provided under the root with the
|
|
4936
|
+
errors, a bare `<Field.Error />` renders them — here with `useState` and no
|
|
4937
|
+
form library. `InputContext` extends the same way with `value`, `onChange`,
|
|
4938
|
+
`onBlur` and `name`; see `FieldText`.</div>
|
|
4939
|
+
<pre><code>const ErrorsFromContext = () => <FieldWithSuppliedErrors />;</code></pre>
|
|
4940
|
+
</div>
|
|
4941
|
+
</div>
|
|
4942
|
+
|
|
4943
|
+
|
|
4944
|
+
</div>
|
|
4945
|
+
</article>
|
|
4946
|
+
<article
|
|
4947
|
+
class="card
|
|
4948
|
+
no-error
|
|
4949
|
+
no-info
|
|
4950
|
+
no-story-error
|
|
4951
|
+
no-doc-error"
|
|
4952
|
+
role="listitem"
|
|
4953
|
+
aria-label="FieldText">
|
|
4954
|
+
<div class="head">
|
|
4955
|
+
<div class="title">
|
|
4956
|
+
<h2><span class="status-dot dot-ok"></span> FieldText</h2>
|
|
4957
|
+
<div class="badges">
|
|
4958
|
+
<label for="c-12-components-fieldtext-props" class="badge ok as-toggle">6 prop types</label>
|
|
4959
|
+
|
|
4960
|
+
<label for="c-12-components-fieldtext-stories" class="badge ok as-toggle">7 stories</label>
|
|
4961
|
+
|
|
4962
|
+
|
|
4963
|
+
</div>
|
|
4964
|
+
</div>
|
|
4965
|
+
<div class="meta" title="./src/field-text/field-text.stories.tsx">components-fieldtext · ./src/field-text/field-text.stories.tsx</div>
|
|
4966
|
+
<div>Field for a single-line text control, wiring the Input inside it</div>
|
|
4967
|
+
<div class="hint">FieldText is a `Field.Root` for a single-line text control. It provides
|
|
4968
|
+
`InputContext`, so the `Input` inside associates itself with the label and
|
|
4969
|
+
the messages and takes `invalid`, `required`, `disabled` and `readOnly` from
|
|
4970
|
+
the field — no `id`, `htmlFor`, `aria-describedby` or `aria-invalid` written
|
|
4971
|
+
by hand.
|
|
4972
|
+
|
|
4973
|
+
It knows nothing about form libraries, and its contexts compose: a provider
|
|
4974
|
+
nested inside it can extend `InputContext` with `value`, `onChange`, `onBlur`
|
|
4975
|
+
and `name`, and `FieldContext` with the errors, as the last story shows.</div>
|
|
4976
|
+
<div class="kv"><span class="chip">summary: Field for a single-line text control, wiring the Input inside it</span><span class="chip">example: <FieldText invalid={!!error} required>
|
|
4977
|
+
<Label>Email</Label>
|
|
4978
|
+
<Input type="email" />
|
|
4979
|
+
<Field.Description>We only use this for policy documents.</Field.Description>
|
|
4980
|
+
<Field.Error errors={[error]} />
|
|
4981
|
+
</FieldText></span></div>
|
|
4982
|
+
</div>
|
|
4983
|
+
|
|
4984
|
+
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
4985
|
+
|
|
4986
|
+
|
|
4987
|
+
<input id="c-12-components-fieldtext-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
4988
|
+
|
|
4989
|
+
|
|
4990
|
+
<input id="c-12-components-fieldtext-props" class="tg tg-props" type="checkbox" hidden />
|
|
4991
|
+
|
|
4992
|
+
<div class="panels">
|
|
4993
|
+
|
|
4994
|
+
|
|
4995
|
+
|
|
4996
|
+
<div class="panel panel-props">
|
|
4997
|
+
<div class="note ok">
|
|
4998
|
+
<div class="row">
|
|
4999
|
+
<span class="ex-name">Prop types <small>(react-component-meta)</small></span>
|
|
5000
|
+
<span class="badge ok">6 prop types</span>
|
|
5001
|
+
</div>
|
|
5002
|
+
<pre><code>Component: src/field-text/index.ts::FieldText</code></pre>
|
|
5003
|
+
<pre><code>Props:</code></pre>
|
|
5004
|
+
<pre><code>/**
|
|
5005
|
+
* `id` for the control. Generated when omitted. Set it here, not on the
|
|
5006
|
+
* control, so the label and the messages keep pointing at the right element.
|
|
5007
|
+
*/
|
|
5008
|
+
controlId?: string
|
|
5009
|
+
|
|
5010
|
+
/**
|
|
5011
|
+
* Disables the control through its context and sets `data-disabled` on the root.
|
|
5012
|
+
*/
|
|
5013
|
+
disabled?: boolean
|
|
5014
|
+
|
|
5015
|
+
/**
|
|
5016
|
+
* Marks the field as failing validation: sets `data-invalid` on the root and
|
|
5017
|
+
* `aria-invalid` on the control through its context, which drives the
|
|
5018
|
+
* control's destructive border. The label keeps its color by design.
|
|
5019
|
+
*/
|
|
5020
|
+
invalid?: boolean
|
|
5021
|
+
|
|
5022
|
+
/**
|
|
5023
|
+
* Layout of the field. `vertical` (default) stacks label, control and
|
|
5024
|
+
* messages. `horizontal` is one row at every width: the first child fills it
|
|
5025
|
+
* and the rest keep their natural width, aligned to the right, so the
|
|
5026
|
+
* controls of stacked fields line up. `responsive` stacks below `28rem` and
|
|
5027
|
+
* behaves like `horizontal` from there, measured on the field itself, so it
|
|
5028
|
+
* needs no particular wrapper. In both, `Field.Content` groups a control with
|
|
5029
|
+
* its messages, or a label with its description.
|
|
5030
|
+
*/
|
|
5031
|
+
orientation?: "horizontal" | "vertical" | "responsive"
|
|
5032
|
+
|
|
5033
|
+
/**
|
|
5034
|
+
* Makes the control read-only through its context (focusable and copyable,
|
|
5035
|
+
* not editable, still submitted) and sets `data-readonly` on the root.
|
|
5036
|
+
*/
|
|
5037
|
+
readOnly?: boolean
|
|
5038
|
+
|
|
5039
|
+
/**
|
|
5040
|
+
* Single source of truth for a required field: the `Label` shows its
|
|
5041
|
+
* asterisk and the control receives `required`, both through context.
|
|
5042
|
+
*/
|
|
5043
|
+
required?: boolean</code></pre>
|
|
5044
|
+
</div>
|
|
5045
|
+
</div>
|
|
5046
|
+
|
|
5047
|
+
<div class="panel panel-stories">
|
|
5048
|
+
|
|
5049
|
+
|
|
5050
|
+
|
|
5051
|
+
<div class="note ok">
|
|
5052
|
+
<div class="row">
|
|
5053
|
+
<span class="ex-name">Imports</span>
|
|
5054
|
+
</div>
|
|
5055
|
+
<pre><code>import { Field, FieldContext, FieldText, Input, InputContext, Label } from "@agentero/design-system";</code></pre>
|
|
5056
|
+
</div>
|
|
5057
|
+
|
|
5058
|
+
|
|
5059
|
+
<div class="note ok">
|
|
5060
|
+
<div class="row">
|
|
5061
|
+
<span class="ex-name">Default</span>
|
|
5062
|
+
<span class="badge ok">story ok</span>
|
|
5063
|
+
</div>
|
|
5064
|
+
<div>Label, Input and description wired with no ids</div>
|
|
5065
|
+
<div class="hint">The composition consumers write: a label, the design system's `Input` and
|
|
5066
|
+
helper text. The label points at the input and the input is described by the
|
|
5067
|
+
text, all through context.</div>
|
|
5068
|
+
<pre><code>const Default = () => <FieldText
|
|
5069
|
+
orientation="vertical"
|
|
5070
|
+
invalid={false}
|
|
5071
|
+
disabled={false}
|
|
5072
|
+
readOnly={false}
|
|
5073
|
+
required={false}>
|
|
5074
|
+
<Label>Email</Label>
|
|
5075
|
+
<Input type="email" placeholder="you@example.com" />
|
|
5076
|
+
<Field.Description>We only use this to send policy documents.</Field.Description>
|
|
5077
|
+
</FieldText>;</code></pre>
|
|
5078
|
+
</div>
|
|
5079
|
+
<div class="note ok">
|
|
5080
|
+
<div class="row">
|
|
5081
|
+
<span class="ex-name">Required</span>
|
|
5082
|
+
<span class="badge ok">story ok</span>
|
|
5083
|
+
</div>
|
|
5084
|
+
<div>Required field driven from the root alone</div>
|
|
5085
|
+
<div class="hint">`required` on the field reaches both the label's asterisk and the input's
|
|
5086
|
+
`required` attribute.</div>
|
|
5087
|
+
<pre><code>const Required = () => <FieldText
|
|
5088
|
+
orientation="vertical"
|
|
5089
|
+
invalid={false}
|
|
5090
|
+
disabled={false}
|
|
5091
|
+
readOnly={false}
|
|
5092
|
+
required>
|
|
5093
|
+
<Label>Full name</Label>
|
|
5094
|
+
<Input placeholder="Jane Doe" />
|
|
5095
|
+
</FieldText>;</code></pre>
|
|
5096
|
+
</div>
|
|
5097
|
+
<div class="note ok">
|
|
5098
|
+
<div class="row">
|
|
5099
|
+
<span class="ex-name">Invalid</span>
|
|
5100
|
+
<span class="badge ok">story ok</span>
|
|
5101
|
+
</div>
|
|
5102
|
+
<div>Invalid field with the Input styled by aria-invalid</div>
|
|
5103
|
+
<div class="hint">`invalid` on the field sets `aria-invalid` on the input, which drives its
|
|
5104
|
+
destructive border, and the error is announced with the input.</div>
|
|
5105
|
+
<pre><code>const Invalid = () => <FieldText
|
|
5106
|
+
orientation="vertical"
|
|
5107
|
+
invalid
|
|
5108
|
+
disabled={false}
|
|
5109
|
+
readOnly={false}
|
|
5110
|
+
required={false}>
|
|
5111
|
+
<Label>Email</Label>
|
|
5112
|
+
<Input type="email" defaultValue="not-an-email" />
|
|
5113
|
+
<Field.Error errors={[{ message: 'Enter a valid email address.' }]} />
|
|
5114
|
+
</FieldText>;</code></pre>
|
|
5115
|
+
</div>
|
|
5116
|
+
<div class="note ok">
|
|
5117
|
+
<div class="row">
|
|
5118
|
+
<span class="ex-name">Disabled</span>
|
|
5119
|
+
<span class="badge ok">story ok</span>
|
|
5120
|
+
</div>
|
|
5121
|
+
<div>Disabled field driven from the root</div>
|
|
5122
|
+
<div class="hint">`disabled` on the field disables the input through context.</div>
|
|
5123
|
+
<pre><code>const Disabled = () => <FieldText
|
|
5124
|
+
orientation="vertical"
|
|
5125
|
+
invalid={false}
|
|
5126
|
+
disabled
|
|
5127
|
+
readOnly={false}
|
|
5128
|
+
required={false}>
|
|
5129
|
+
<Label>Agency</Label>
|
|
5130
|
+
<Input defaultValue="Acme Insurance" />
|
|
5131
|
+
</FieldText>;</code></pre>
|
|
5132
|
+
</div>
|
|
5133
|
+
<div class="note ok">
|
|
5134
|
+
<div class="row">
|
|
5135
|
+
<span class="ex-name">Read Only</span>
|
|
5136
|
+
<span class="badge ok">story ok</span>
|
|
5137
|
+
</div>
|
|
5138
|
+
<div>Read-only field driven from the root</div>
|
|
5139
|
+
<div class="hint">`readOnly` on the field reaches the input through context. The value stays
|
|
5140
|
+
focusable, copyable and submitted, and the input looks like any other.</div>
|
|
5141
|
+
<pre><code>const ReadOnly = () => <FieldText
|
|
5142
|
+
orientation="vertical"
|
|
5143
|
+
invalid={false}
|
|
5144
|
+
disabled={false}
|
|
5145
|
+
readOnly
|
|
5146
|
+
required={false}>
|
|
5147
|
+
<Label>Policy number</Label>
|
|
5148
|
+
<Input defaultValue="POL-2049-118" />
|
|
5149
|
+
<Field.Description>Assigned by the carrier; contact support to change it.</Field.Description>
|
|
5150
|
+
</FieldText>;</code></pre>
|
|
5151
|
+
</div>
|
|
5152
|
+
<div class="note ok">
|
|
5153
|
+
<div class="row">
|
|
5154
|
+
<span class="ex-name">Own Props Win</span>
|
|
5155
|
+
<span class="badge ok">story ok</span>
|
|
5156
|
+
</div>
|
|
5157
|
+
<div>Input's own props merge with, and win over, the field's context</div>
|
|
5158
|
+
<div class="hint">The context is a default, never an override: an extra `aria-describedby` is
|
|
5159
|
+
concatenated with the field's ids, `className` is merged and `size` passes
|
|
5160
|
+
through untouched.</div>
|
|
5161
|
+
<pre><code>const OwnPropsWin = () => <div className="flex flex-col gap-2">
|
|
5162
|
+
<FieldText
|
|
5163
|
+
orientation="vertical"
|
|
5164
|
+
invalid={false}
|
|
5165
|
+
disabled={false}
|
|
5166
|
+
readOnly={false}
|
|
5167
|
+
required={false}>
|
|
5168
|
+
<Label>Website</Label>
|
|
5169
|
+
<Input type="url" size="lg" className="max-w-xs" aria-describedby="website-hint" />
|
|
5170
|
+
<Field.Description>Include the protocol.</Field.Description>
|
|
5171
|
+
</FieldText>
|
|
5172
|
+
<p id="website-hint" className="text-sm">Shown on your public profile.
|
|
5173
|
+
</p>
|
|
5174
|
+
</div>;</code></pre>
|
|
5175
|
+
</div>
|
|
5176
|
+
<div class="note ok">
|
|
5177
|
+
<div class="row">
|
|
5178
|
+
<span class="ex-name">Controlled From Context</span>
|
|
5179
|
+
<span class="badge ok">story ok</span>
|
|
5180
|
+
</div>
|
|
5181
|
+
<div>Input controlled and errors supplied from outside the field</div>
|
|
5182
|
+
<div class="hint">The contexts are an extension point: a provider nested in the field adds
|
|
5183
|
+
`name`, `value`, `onChange` and `onBlur` to `InputContext`, so a bare
|
|
5184
|
+
`<Input />` becomes controlled, and the errors to `FieldContext`, so a bare
|
|
5185
|
+
`<Field.Error />` renders them — here with `useState` and no form library.
|
|
5186
|
+
The input's own `onChange` still runs, chained after the provider's.</div>
|
|
5187
|
+
<pre><code>const ControlledFromContext = () => <ControlledField />;</code></pre>
|
|
5188
|
+
</div>
|
|
5189
|
+
</div>
|
|
5190
|
+
|
|
5191
|
+
|
|
4490
5192
|
</div>
|
|
4491
5193
|
</article>
|
|
4492
5194
|
<article
|
|
@@ -4501,9 +5203,9 @@ actions outright unless the user needs to see them and understand why.</div>
|
|
|
4501
5203
|
<div class="title">
|
|
4502
5204
|
<h2><span class="status-dot dot-ok"></span> HoverCard.Root</h2>
|
|
4503
5205
|
<div class="badges">
|
|
4504
|
-
<label for="c-
|
|
5206
|
+
<label for="c-13-components-hovercard-props" class="badge ok as-toggle">6 prop types</label>
|
|
4505
5207
|
|
|
4506
|
-
<label for="c-
|
|
5208
|
+
<label for="c-13-components-hovercard-stories" class="badge ok as-toggle">7 stories</label>
|
|
4507
5209
|
|
|
4508
5210
|
|
|
4509
5211
|
</div>
|
|
@@ -4535,10 +5237,10 @@ import { HoverCard } from '@agentero/design-system/hover-card';
|
|
|
4535
5237
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
4536
5238
|
|
|
4537
5239
|
|
|
4538
|
-
<input id="c-
|
|
5240
|
+
<input id="c-13-components-hovercard-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
4539
5241
|
|
|
4540
5242
|
|
|
4541
|
-
<input id="c-
|
|
5243
|
+
<input id="c-13-components-hovercard-props" class="tg tg-props" type="checkbox" hidden />
|
|
4542
5244
|
|
|
4543
5245
|
<div class="panels">
|
|
4544
5246
|
|
|
@@ -4785,23 +5487,24 @@ trigger-dense UIs where an instant preview reads as more responsive.</div>
|
|
|
4785
5487
|
<div class="title">
|
|
4786
5488
|
<h2><span class="status-dot dot-ok"></span> Input</h2>
|
|
4787
5489
|
<div class="badges">
|
|
4788
|
-
<label for="c-
|
|
5490
|
+
<label for="c-14-components-input-props" class="badge ok as-toggle">7 prop types</label>
|
|
4789
5491
|
|
|
4790
|
-
<label for="c-
|
|
5492
|
+
<label for="c-14-components-input-stories" class="badge ok as-toggle">9 stories</label>
|
|
4791
5493
|
|
|
4792
5494
|
|
|
4793
5495
|
</div>
|
|
4794
5496
|
</div>
|
|
4795
5497
|
<div class="meta" title="./src/input/input.stories.tsx">components-input · ./src/input/input.stories.tsx</div>
|
|
4796
|
-
<div>Base single-line text control
|
|
4797
|
-
<div class="hint">Input is the base single-line text control.
|
|
4798
|
-
|
|
4799
|
-
|
|
5498
|
+
<div>Base single-line text control that takes its wiring from InputContext</div>
|
|
5499
|
+
<div class="hint">Input is the base single-line text control. When a container such as
|
|
5500
|
+
`FieldText` provides `InputContext`, it picks up `id`, `aria-invalid` and
|
|
5501
|
+
`aria-describedby` on its own; standalone, as here, they are plain props set
|
|
5502
|
+
by hand.
|
|
4800
5503
|
|
|
4801
5504
|
There is no `status` prop. Mark the control `aria-invalid` and the
|
|
4802
5505
|
destructive border follows, so the styling can never disagree with what
|
|
4803
5506
|
assistive technology announces.</div>
|
|
4804
|
-
<div class="kv"><span class="chip">summary: Base single-line text control
|
|
5507
|
+
<div class="kv"><span class="chip">summary: Base single-line text control that takes its wiring from InputContext</span><span class="chip">example: <Label htmlFor="email">Email</Label>
|
|
4805
5508
|
<Input id="email" type="email" placeholder="you@example.com" /></span><span class="chip">example: <Input id="email" aria-invalid aria-describedby="email-error" />
|
|
4806
5509
|
<span id="email-error">Enter a valid email address.</span></span></div>
|
|
4807
5510
|
</div>
|
|
@@ -4809,10 +5512,10 @@ assistive technology announces.</div>
|
|
|
4809
5512
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
4810
5513
|
|
|
4811
5514
|
|
|
4812
|
-
<input id="c-
|
|
5515
|
+
<input id="c-14-components-input-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
4813
5516
|
|
|
4814
5517
|
|
|
4815
|
-
<input id="c-
|
|
5518
|
+
<input id="c-14-components-input-props" class="tg tg-props" type="checkbox" hidden />
|
|
4816
5519
|
|
|
4817
5520
|
<div class="panels">
|
|
4818
5521
|
|
|
@@ -5024,9 +5727,9 @@ they cannot change.</div>
|
|
|
5024
5727
|
<div class="title">
|
|
5025
5728
|
<h2><span class="status-dot dot-ok"></span> Label</h2>
|
|
5026
5729
|
<div class="badges">
|
|
5027
|
-
<label for="c-
|
|
5730
|
+
<label for="c-15-components-label-props" class="badge ok as-toggle">3 prop types</label>
|
|
5028
5731
|
|
|
5029
|
-
<label for="c-
|
|
5732
|
+
<label for="c-15-components-label-stories" class="badge ok as-toggle">5 stories</label>
|
|
5030
5733
|
|
|
5031
5734
|
|
|
5032
5735
|
</div>
|
|
@@ -5046,10 +5749,10 @@ still has to carry `required` / `aria-required`.</div>
|
|
|
5046
5749
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
5047
5750
|
|
|
5048
5751
|
|
|
5049
|
-
<input id="c-
|
|
5752
|
+
<input id="c-15-components-label-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
5050
5753
|
|
|
5051
5754
|
|
|
5052
|
-
<input id="c-
|
|
5755
|
+
<input id="c-15-components-label-props" class="tg tg-props" type="checkbox" hidden />
|
|
5053
5756
|
|
|
5054
5757
|
<div class="panels">
|
|
5055
5758
|
|
|
@@ -5085,7 +5788,7 @@ required?: boolean = false</code></pre>
|
|
|
5085
5788
|
<div class="row">
|
|
5086
5789
|
<span class="ex-name">Imports</span>
|
|
5087
5790
|
</div>
|
|
5088
|
-
<pre><code>import { Label } from "@agentero/design-system";</code></pre>
|
|
5791
|
+
<pre><code>import { Field, Label } from "@agentero/design-system";</code></pre>
|
|
5089
5792
|
</div>
|
|
5090
5793
|
|
|
5091
5794
|
|
|
@@ -5098,7 +5801,7 @@ required?: boolean = false</code></pre>
|
|
|
5098
5801
|
<div class="hint">A plain caption, associated with its control through `htmlFor`.</div>
|
|
5099
5802
|
<pre><code>const Default = () => <>
|
|
5100
5803
|
<Label htmlFor="email">Email</Label>
|
|
5101
|
-
<input id="email" placeholder="you@example.com" />
|
|
5804
|
+
<input id="email" placeholder="you@example.com" className={inputRecipe()} />
|
|
5102
5805
|
</>;</code></pre>
|
|
5103
5806
|
</div>
|
|
5104
5807
|
<div class="note ok">
|
|
@@ -5130,6 +5833,28 @@ required?: boolean = false</code></pre>
|
|
|
5130
5833
|
dropped, so a mistake never takes the page down.</div>
|
|
5131
5834
|
<pre><code>const RequiredWinsOverOptional = () => <Label optional required>Agency name</Label>;</code></pre>
|
|
5132
5835
|
</div>
|
|
5836
|
+
<div class="note ok">
|
|
5837
|
+
<div class="row">
|
|
5838
|
+
<span class="ex-name">Inside Field</span>
|
|
5839
|
+
<span class="badge ok">story ok</span>
|
|
5840
|
+
</div>
|
|
5841
|
+
<div>Inside a Field the label associates itself; explicit htmlFor wins</div>
|
|
5842
|
+
<div class="hint">Inside a `Field.Root` the label reads `LabelContext` and points at the
|
|
5843
|
+
field's control with no `htmlFor`. An explicit `htmlFor` still wins.</div>
|
|
5844
|
+
<pre><code>const InsideField = () => (
|
|
5845
|
+
<div className="flex flex-col gap-6">
|
|
5846
|
+
<Field.Root>
|
|
5847
|
+
<Label>Email</Label>
|
|
5848
|
+
<FieldInput />
|
|
5849
|
+
</Field.Root>
|
|
5850
|
+
|
|
5851
|
+
<Field.Root>
|
|
5852
|
+
<Label htmlFor="explicit-control">Phone</Label>
|
|
5853
|
+
<input id="explicit-control" className={inputRecipe()} />
|
|
5854
|
+
</Field.Root>
|
|
5855
|
+
</div>
|
|
5856
|
+
);</code></pre>
|
|
5857
|
+
</div>
|
|
5133
5858
|
</div>
|
|
5134
5859
|
|
|
5135
5860
|
|
|
@@ -5147,9 +5872,9 @@ dropped, so a mistake never takes the page down.</div>
|
|
|
5147
5872
|
<div class="title">
|
|
5148
5873
|
<h2><span class="status-dot dot-ok"></span> Loading</h2>
|
|
5149
5874
|
<div class="badges">
|
|
5150
|
-
<label for="c-
|
|
5875
|
+
<label for="c-16-components-loading-props" class="badge ok as-toggle">1 prop type</label>
|
|
5151
5876
|
|
|
5152
|
-
<label for="c-
|
|
5877
|
+
<label for="c-16-components-loading-stories" class="badge ok as-toggle">7 stories</label>
|
|
5153
5878
|
|
|
5154
5879
|
|
|
5155
5880
|
</div>
|
|
@@ -5166,10 +5891,10 @@ parent font size via `em`-based size variants (`sm`, `md`, `lg`).</div>
|
|
|
5166
5891
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
5167
5892
|
|
|
5168
5893
|
|
|
5169
|
-
<input id="c-
|
|
5894
|
+
<input id="c-16-components-loading-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
5170
5895
|
|
|
5171
5896
|
|
|
5172
|
-
<input id="c-
|
|
5897
|
+
<input id="c-16-components-loading-props" class="tg tg-props" type="checkbox" hidden />
|
|
5173
5898
|
|
|
5174
5899
|
<div class="panels">
|
|
5175
5900
|
|
|
@@ -5320,9 +6045,9 @@ against the dark background.</div>
|
|
|
5320
6045
|
<div class="title">
|
|
5321
6046
|
<h2><span class="status-dot dot-ok"></span> Modal.Root</h2>
|
|
5322
6047
|
<div class="badges">
|
|
5323
|
-
<label for="c-
|
|
6048
|
+
<label for="c-17-components-modal-props" class="badge ok as-toggle">5 prop types</label>
|
|
5324
6049
|
|
|
5325
|
-
<label for="c-
|
|
6050
|
+
<label for="c-17-components-modal-stories" class="badge ok as-toggle">6 stories</label>
|
|
5326
6051
|
|
|
5327
6052
|
|
|
5328
6053
|
</div>
|
|
@@ -5368,10 +6093,10 @@ import { Modal } from '@agentero/design-system/modal';
|
|
|
5368
6093
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
5369
6094
|
|
|
5370
6095
|
|
|
5371
|
-
<input id="c-
|
|
6096
|
+
<input id="c-17-components-modal-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
5372
6097
|
|
|
5373
6098
|
|
|
5374
|
-
<input id="c-
|
|
6099
|
+
<input id="c-17-components-modal-props" class="tg tg-props" type="checkbox" hidden />
|
|
5375
6100
|
|
|
5376
6101
|
<div class="panels">
|
|
5377
6102
|
|
|
@@ -5568,9 +6293,9 @@ announced as an `alertdialog`. Only the footer actions close it.</div>
|
|
|
5568
6293
|
<div class="title">
|
|
5569
6294
|
<h2><span class="status-dot dot-ok"></span> Pagination</h2>
|
|
5570
6295
|
<div class="badges">
|
|
5571
|
-
<label for="c-
|
|
6296
|
+
<label for="c-18-components-pagination-props" class="badge ok as-toggle">5 prop types</label>
|
|
5572
6297
|
|
|
5573
|
-
<label for="c-
|
|
6298
|
+
<label for="c-18-components-pagination-stories" class="badge ok as-toggle">7 stories</label>
|
|
5574
6299
|
|
|
5575
6300
|
|
|
5576
6301
|
</div>
|
|
@@ -5600,10 +6325,10 @@ const [page, setPage] = useState(1);
|
|
|
5600
6325
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
5601
6326
|
|
|
5602
6327
|
|
|
5603
|
-
<input id="c-
|
|
6328
|
+
<input id="c-18-components-pagination-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
5604
6329
|
|
|
5605
6330
|
|
|
5606
|
-
<input id="c-
|
|
6331
|
+
<input id="c-18-components-pagination-props" class="tg tg-props" type="checkbox" hidden />
|
|
5607
6332
|
|
|
5608
6333
|
<div class="panels">
|
|
5609
6334
|
|
|
@@ -5758,9 +6483,9 @@ entries summary follow along.</div>
|
|
|
5758
6483
|
<div class="title">
|
|
5759
6484
|
<h2><span class="status-dot dot-ok"></span> Popover.Root</h2>
|
|
5760
6485
|
<div class="badges">
|
|
5761
|
-
<label for="c-
|
|
6486
|
+
<label for="c-19-components-popover-props" class="badge ok as-toggle">5 prop types</label>
|
|
5762
6487
|
|
|
5763
|
-
<label for="c-
|
|
6488
|
+
<label for="c-19-components-popover-stories" class="badge ok as-toggle">5 stories</label>
|
|
5764
6489
|
|
|
5765
6490
|
|
|
5766
6491
|
</div>
|
|
@@ -5789,10 +6514,10 @@ import { Popover } from '@agentero/design-system/popover';
|
|
|
5789
6514
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
5790
6515
|
|
|
5791
6516
|
|
|
5792
|
-
<input id="c-
|
|
6517
|
+
<input id="c-19-components-popover-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
5793
6518
|
|
|
5794
6519
|
|
|
5795
|
-
<input id="c-
|
|
6520
|
+
<input id="c-19-components-popover-props" class="tg tg-props" type="checkbox" hidden />
|
|
5796
6521
|
|
|
5797
6522
|
<div class="panels">
|
|
5798
6523
|
|
|
@@ -5991,9 +6716,9 @@ focus returning to its trigger once the modal closes.</div>
|
|
|
5991
6716
|
<div class="title">
|
|
5992
6717
|
<h2><span class="status-dot dot-ok"></span> Progress</h2>
|
|
5993
6718
|
<div class="badges">
|
|
5994
|
-
<label for="c-
|
|
6719
|
+
<label for="c-20-components-progress-props" class="badge ok as-toggle">4 prop types</label>
|
|
5995
6720
|
|
|
5996
|
-
<label for="c-
|
|
6721
|
+
<label for="c-20-components-progress-stories" class="badge ok as-toggle">4 stories</label>
|
|
5997
6722
|
|
|
5998
6723
|
|
|
5999
6724
|
</div>
|
|
@@ -6012,10 +6737,10 @@ with `currentColor`, so recolor it with a plain text class — e.g.
|
|
|
6012
6737
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6013
6738
|
|
|
6014
6739
|
|
|
6015
|
-
<input id="c-
|
|
6740
|
+
<input id="c-20-components-progress-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6016
6741
|
|
|
6017
6742
|
|
|
6018
|
-
<input id="c-
|
|
6743
|
+
<input id="c-20-components-progress-props" class="tg tg-props" type="checkbox" hidden />
|
|
6019
6744
|
|
|
6020
6745
|
<div class="panels">
|
|
6021
6746
|
|
|
@@ -6134,7 +6859,7 @@ percentage: number</code></pre>
|
|
|
6134
6859
|
<div class="badges">
|
|
6135
6860
|
|
|
6136
6861
|
|
|
6137
|
-
<label for="c-
|
|
6862
|
+
<label for="c-21-components-skeleton-stories" class="badge ok as-toggle">4 stories</label>
|
|
6138
6863
|
|
|
6139
6864
|
|
|
6140
6865
|
</div>
|
|
@@ -6151,7 +6876,7 @@ shape it with Tailwind classes to mirror the content it stands in for.</div>
|
|
|
6151
6876
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6152
6877
|
|
|
6153
6878
|
|
|
6154
|
-
<input id="c-
|
|
6879
|
+
<input id="c-21-components-skeleton-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6155
6880
|
|
|
6156
6881
|
|
|
6157
6882
|
|
|
@@ -6247,9 +6972,9 @@ shape it with Tailwind classes to mirror the content it stands in for.</div>
|
|
|
6247
6972
|
<div class="title">
|
|
6248
6973
|
<h2><span class="status-dot dot-ok"></span> Switch</h2>
|
|
6249
6974
|
<div class="badges">
|
|
6250
|
-
<label for="c-
|
|
6975
|
+
<label for="c-22-components-switch-props" class="badge ok as-toggle">8 prop types</label>
|
|
6251
6976
|
|
|
6252
|
-
<label for="c-
|
|
6977
|
+
<label for="c-22-components-switch-stories" class="badge ok as-toggle">7 stories</label>
|
|
6253
6978
|
|
|
6254
6979
|
|
|
6255
6980
|
</div>
|
|
@@ -6265,10 +6990,10 @@ a Checkbox for a single boolean that applies instantly, and pair it with a
|
|
|
6265
6990
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6266
6991
|
|
|
6267
6992
|
|
|
6268
|
-
<input id="c-
|
|
6993
|
+
<input id="c-22-components-switch-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6269
6994
|
|
|
6270
6995
|
|
|
6271
|
-
<input id="c-
|
|
6996
|
+
<input id="c-22-components-switch-props" class="tg tg-props" type="checkbox" hidden />
|
|
6272
6997
|
|
|
6273
6998
|
<div class="panels">
|
|
6274
6999
|
|
|
@@ -6449,9 +7174,9 @@ size?: "sm" | "md"</code></pre>
|
|
|
6449
7174
|
<div class="title">
|
|
6450
7175
|
<h2><span class="status-dot dot-ok"></span> Table.Root</h2>
|
|
6451
7176
|
<div class="badges">
|
|
6452
|
-
<label for="c-
|
|
7177
|
+
<label for="c-23-components-table-props" class="badge ok as-toggle">6 prop types</label>
|
|
6453
7178
|
|
|
6454
|
-
<label for="c-
|
|
7179
|
+
<label for="c-23-components-table-stories" class="badge ok as-toggle">9 stories</label>
|
|
6455
7180
|
|
|
6456
7181
|
|
|
6457
7182
|
</div>
|
|
@@ -6482,10 +7207,10 @@ import { Table } from '@agentero/design-system/table';
|
|
|
6482
7207
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6483
7208
|
|
|
6484
7209
|
|
|
6485
|
-
<input id="c-
|
|
7210
|
+
<input id="c-23-components-table-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6486
7211
|
|
|
6487
7212
|
|
|
6488
|
-
<input id="c-
|
|
7213
|
+
<input id="c-23-components-table-props" class="tg tg-props" type="checkbox" hidden />
|
|
6489
7214
|
|
|
6490
7215
|
<div class="panels">
|
|
6491
7216
|
|
|
@@ -6680,9 +7405,9 @@ import { Fragment } from "react";</code></pre>
|
|
|
6680
7405
|
<div class="title">
|
|
6681
7406
|
<h2><span class="status-dot dot-ok"></span> Tabs.Root</h2>
|
|
6682
7407
|
<div class="badges">
|
|
6683
|
-
<label for="c-
|
|
7408
|
+
<label for="c-24-components-tabs-props" class="badge ok as-toggle">9 prop types</label>
|
|
6684
7409
|
|
|
6685
|
-
<label for="c-
|
|
7410
|
+
<label for="c-24-components-tabs-stories" class="badge ok as-toggle">8 stories</label>
|
|
6686
7411
|
|
|
6687
7412
|
|
|
6688
7413
|
</div>
|
|
@@ -6713,10 +7438,10 @@ import { Tabs } from '@agentero/design-system/tabs';
|
|
|
6713
7438
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6714
7439
|
|
|
6715
7440
|
|
|
6716
|
-
<input id="c-
|
|
7441
|
+
<input id="c-24-components-tabs-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6717
7442
|
|
|
6718
7443
|
|
|
6719
|
-
<input id="c-
|
|
7444
|
+
<input id="c-24-components-tabs-props" class="tg tg-props" type="checkbox" hidden />
|
|
6720
7445
|
|
|
6721
7446
|
<div class="panels">
|
|
6722
7447
|
|
|
@@ -6937,9 +7662,9 @@ tablist role is announced.</div>
|
|
|
6937
7662
|
<div class="title">
|
|
6938
7663
|
<h2><span class="status-dot dot-ok"></span> Tag</h2>
|
|
6939
7664
|
<div class="badges">
|
|
6940
|
-
<label for="c-
|
|
7665
|
+
<label for="c-25-components-tag-props" class="badge ok as-toggle">8 prop types</label>
|
|
6941
7666
|
|
|
6942
|
-
<label for="c-
|
|
7667
|
+
<label for="c-25-components-tag-stories" class="badge ok as-toggle">12 stories</label>
|
|
6943
7668
|
|
|
6944
7669
|
|
|
6945
7670
|
</div>
|
|
@@ -6958,10 +7683,10 @@ it an interactive link or button, which adds the pointer cursor and hover fill.<
|
|
|
6958
7683
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
6959
7684
|
|
|
6960
7685
|
|
|
6961
|
-
<input id="c-
|
|
7686
|
+
<input id="c-25-components-tag-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
6962
7687
|
|
|
6963
7688
|
|
|
6964
|
-
<input id="c-
|
|
7689
|
+
<input id="c-25-components-tag-props" class="tg tg-props" type="checkbox" hidden />
|
|
6965
7690
|
|
|
6966
7691
|
<div class="panels">
|
|
6967
7692
|
|
|
@@ -7386,9 +8111,9 @@ leading + trailing icons, and icon-only.</div>
|
|
|
7386
8111
|
<div class="title">
|
|
7387
8112
|
<h2><span class="status-dot dot-ok"></span> Toast</h2>
|
|
7388
8113
|
<div class="badges">
|
|
7389
|
-
<label for="c-
|
|
8114
|
+
<label for="c-26-components-toast-props" class="badge ok as-toggle">11 prop types</label>
|
|
7390
8115
|
|
|
7391
|
-
<label for="c-
|
|
8116
|
+
<label for="c-26-components-toast-stories" class="badge ok as-toggle">11 stories</label>
|
|
7392
8117
|
|
|
7393
8118
|
|
|
7394
8119
|
</div>
|
|
@@ -7407,10 +8132,10 @@ common feedback patterns.</div>
|
|
|
7407
8132
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
7408
8133
|
|
|
7409
8134
|
|
|
7410
|
-
<input id="c-
|
|
8135
|
+
<input id="c-26-components-toast-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
7411
8136
|
|
|
7412
8137
|
|
|
7413
|
-
<input id="c-
|
|
8138
|
+
<input id="c-26-components-toast-props" class="tg tg-props" type="checkbox" hidden />
|
|
7414
8139
|
|
|
7415
8140
|
<div class="panels">
|
|
7416
8141
|
|
|
@@ -7839,9 +8564,9 @@ action (e.g., a sync icon for a sync-in-progress toast).</div>
|
|
|
7839
8564
|
<div class="title">
|
|
7840
8565
|
<h2><span class="status-dot dot-ok"></span> Tooltip</h2>
|
|
7841
8566
|
<div class="badges">
|
|
7842
|
-
<label for="c-
|
|
8567
|
+
<label for="c-27-components-tooltip-props" class="badge ok as-toggle">12 prop types</label>
|
|
7843
8568
|
|
|
7844
|
-
<label for="c-
|
|
8569
|
+
<label for="c-27-components-tooltip-stories" class="badge ok as-toggle">5 stories</label>
|
|
7845
8570
|
|
|
7846
8571
|
|
|
7847
8572
|
</div>
|
|
@@ -7860,10 +8585,10 @@ on hover or focus.</div>
|
|
|
7860
8585
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
7861
8586
|
|
|
7862
8587
|
|
|
7863
|
-
<input id="c-
|
|
8588
|
+
<input id="c-27-components-tooltip-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
7864
8589
|
|
|
7865
8590
|
|
|
7866
|
-
<input id="c-
|
|
8591
|
+
<input id="c-27-components-tooltip-props" class="tg tg-props" type="checkbox" hidden />
|
|
7867
8592
|
|
|
7868
8593
|
<div class="panels">
|
|
7869
8594
|
|
|
@@ -8035,9 +8760,9 @@ sideOffset?: number = 4</code></pre>
|
|
|
8035
8760
|
<div class="title">
|
|
8036
8761
|
<h2><span class="status-dot dot-ok"></span> ValidationList</h2>
|
|
8037
8762
|
<div class="badges">
|
|
8038
|
-
<label for="c-
|
|
8763
|
+
<label for="c-28-components-validationlist-props" class="badge ok as-toggle">2 prop types</label>
|
|
8039
8764
|
|
|
8040
|
-
<label for="c-
|
|
8765
|
+
<label for="c-28-components-validationlist-stories" class="badge ok as-toggle">4 stories</label>
|
|
8041
8766
|
|
|
8042
8767
|
|
|
8043
8768
|
</div>
|
|
@@ -8058,10 +8783,10 @@ your form validation; it does not own the input or block submission.</div>
|
|
|
8058
8783
|
<!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
|
|
8059
8784
|
|
|
8060
8785
|
|
|
8061
|
-
<input id="c-
|
|
8786
|
+
<input id="c-28-components-validationlist-stories" class="tg tg-stories" type="checkbox" hidden />
|
|
8062
8787
|
|
|
8063
8788
|
|
|
8064
|
-
<input id="c-
|
|
8789
|
+
<input id="c-28-components-validationlist-props" class="tg tg-props" type="checkbox" hidden />
|
|
8065
8790
|
|
|
8066
8791
|
<div class="panels">
|
|
8067
8792
|
|