@lofid/web 0.0.0-stage → 1.1.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.
Files changed (65) hide show
  1. package/README.md +104 -2
  2. package/custom-elements.json +12890 -0
  3. package/dist/index.d.ts +3192 -0
  4. package/dist/index.js +20807 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/styles/ag-grid.css +145 -0
  7. package/dist/styles/motion.css +32 -0
  8. package/dist/styles/motion.tokens.json +38 -0
  9. package/dist/styles/typography.css +41 -0
  10. package/dist/styles/typography.json +858 -0
  11. package/dist/styles/vars.css +1225 -0
  12. package/package.json +46 -4
  13. package/readmes/lof-accordion/README.md +140 -0
  14. package/readmes/lof-alert/README.md +142 -0
  15. package/readmes/lof-autocomplete/README.md +209 -0
  16. package/readmes/lof-avatar/README.md +228 -0
  17. package/readmes/lof-badge/README.md +102 -0
  18. package/readmes/lof-breadcrumb/README.md +97 -0
  19. package/readmes/lof-button/README.md +189 -0
  20. package/readmes/lof-calendar/README.md +111 -0
  21. package/readmes/lof-card/README.md +105 -0
  22. package/readmes/lof-cardmedia/README.md +100 -0
  23. package/readmes/lof-carousel/README.md +187 -0
  24. package/readmes/lof-checkbox/README.md +159 -0
  25. package/readmes/lof-chip/README.md +153 -0
  26. package/readmes/lof-container/README.md +107 -0
  27. package/readmes/lof-date-picker/README.md +221 -0
  28. package/readmes/lof-divider/README.md +88 -0
  29. package/readmes/lof-drawer/README.md +188 -0
  30. package/readmes/lof-empty-state/README.md +78 -0
  31. package/readmes/lof-image-input/README.md +75 -0
  32. package/readmes/lof-kbd/README.md +188 -0
  33. package/readmes/lof-layout/README.md +122 -0
  34. package/readmes/lof-link/README.md +67 -0
  35. package/readmes/lof-menu/README.md +187 -0
  36. package/readmes/lof-menubar/README.md +218 -0
  37. package/readmes/lof-nav/README.md +90 -0
  38. package/readmes/lof-otp/README.md +167 -0
  39. package/readmes/lof-page-header/README.md +71 -0
  40. package/readmes/lof-pagination/README.md +141 -0
  41. package/readmes/lof-popover/README.md +220 -0
  42. package/readmes/lof-progress/README.md +88 -0
  43. package/readmes/lof-radio/README.md +142 -0
  44. package/readmes/lof-range-picker/README.md +194 -0
  45. package/readmes/lof-rating/README.md +90 -0
  46. package/readmes/lof-resizable/README.md +220 -0
  47. package/readmes/lof-segmented-button/README.md +158 -0
  48. package/readmes/lof-select/README.md +193 -0
  49. package/readmes/lof-sheet/README.md +170 -0
  50. package/readmes/lof-signature-pad/README.md +161 -0
  51. package/readmes/lof-skeleton/README.md +104 -0
  52. package/readmes/lof-slider/README.md +140 -0
  53. package/readmes/lof-snackbar/README.md +170 -0
  54. package/readmes/lof-split-button/README.md +129 -0
  55. package/readmes/lof-stat/README.md +73 -0
  56. package/readmes/lof-stepper/README.md +171 -0
  57. package/readmes/lof-switch/README.md +122 -0
  58. package/readmes/lof-tab/README.md +188 -0
  59. package/readmes/lof-table/README.md +114 -0
  60. package/readmes/lof-textfield/README.md +206 -0
  61. package/readmes/lof-time-picker/README.md +188 -0
  62. package/readmes/lof-toast/README.md +174 -0
  63. package/readmes/lof-tooltip/README.md +120 -0
  64. package/readmes/lof-tree/README.md +157 -0
  65. package/readmes/lof-upload/README.md +223 -0
@@ -0,0 +1,159 @@
1
+ # lof-checkbox
2
+
3
+ A tri-state checkbox implementing the Figma "Checkbox" sheet: a hidden native `<input type="checkbox">` behind a custom box, with a label, an optional label-prefix icon and optional supporting text. It exposes the sheet's vocabulary verbatim — `size` (small / medium / large / extra-large), `density` (compact / comfortable) and `alignment` (leading / trailing) — plus `state` for error and disabled styling. Use it for independent yes/no choices and for "select all" parents (via `status="indeterminate"`); for a single choice among several options use `lof-radio`, and for an immediate on/off setting use `lof-switch`.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <!-- Basic -->
9
+ <lof-checkbox label="Accept terms"></lof-checkbox>
10
+
11
+ <!-- Supporting text, compact density (default: text on its own line, indented past the box) -->
12
+ <lof-checkbox
13
+ label="Subscribe to newsletter"
14
+ supporting-text="We'll send you weekly updates"
15
+ status="unchecked"
16
+ state="default">
17
+ </lof-checkbox>
18
+
19
+ <!-- Comfortable density: label + supporting text stack beside the box -->
20
+ <lof-checkbox
21
+ density="comfortable"
22
+ label="Notify the account manager"
23
+ supporting-text="Sends an email when the contract is uploaded">
24
+ </lof-checkbox>
25
+
26
+ <!-- Trailing alignment: box at the far edge of the row (settings-row style).
27
+ Trailing always renders comfortable density — compact has no trailing layout. -->
28
+ <lof-checkbox
29
+ alignment="trailing"
30
+ label="Email notifications"
31
+ supporting-text="Weekly summary of job activity">
32
+ </lof-checkbox>
33
+
34
+ <!-- Sizes (medium is the default) -->
35
+ <lof-checkbox size="small" label="Include archived"></lof-checkbox>
36
+ <lof-checkbox size="large" label="I agree to the terms"></lof-checkbox>
37
+
38
+ <!-- Label prefix icon -->
39
+ <lof-checkbox icon="cart" label="Bulk orders only"></lof-checkbox>
40
+
41
+ <!-- Error and disabled states -->
42
+ <lof-checkbox state="error" label="Required consent"></lof-checkbox>
43
+ <lof-checkbox state="disabled" status="checked" label="Locked by admin"></lof-checkbox>
44
+
45
+ <!-- Indeterminate (programmatic-only; a user toggle resolves to checked/unchecked) -->
46
+ <lof-checkbox id="select-all" label="Select all" status="indeterminate"></lof-checkbox>
47
+ <script>
48
+ document.getElementById('select-all').addEventListener('lof-change', (e) => {
49
+ console.log(e.detail.checked, e.detail.value);
50
+ });
51
+ </script>
52
+ ```
53
+
54
+ ### Deprecated aliases
55
+
56
+ ```html
57
+ <!-- supportingtext → supporting-text (since 1.5.0; still works, logs a one-time console notice, removed in 3.0) -->
58
+ <lof-checkbox label="Old spelling" supportingtext="Helper line"></lof-checkbox>
59
+ <lof-checkbox label="Canonical" supporting-text="Helper line"></lof-checkbox>
60
+ ```
61
+
62
+ <!-- readme-gen:start -->
63
+
64
+ <!-- Generated from lof-checkbox.ts — do not edit; run readme-generate.mjs -->
65
+
66
+ ## API
67
+
68
+ ### Attributes / Properties
69
+
70
+ | Property | Attribute | Type | Default | Description |
71
+ | --- | --- | --- | --- | --- |
72
+ | `label` | `label` | `string` | `"Label"` | Label text rendered next to the box. |
73
+ | `icon` | `icon` | `string` | `""` | lof-icon name rendered between the checkbox and the label (label prefix icon); scales with `size`. Unset renders no icon and reserves no space. |
74
+ | `supportingtext` | `supporting-text` | `string` | `""` | Supporting text under or beside the label; where it renders depends on `density`. The `supportingtext` attribute spelling is deprecated (still works; removal targeted for 3.0). |
75
+ | `state` | `state` | `"default" \| "error" \| "disabled"` | `"default"` | Visual and interaction state (Figma State): `"error"` swaps in the danger colours, `"disabled"` blocks input and dims the whole control to 0.4 opacity (colours unchanged, as Figma specifies). |
76
+ | `disabled` | `disabled` | `boolean` | `false` | Disables the checkbox exactly as `state="disabled"` does (`state` stays the documented spelling). Either one disables it, and so does an ancestor `<fieldset disabled>`; none of them changes the others. New in 1.5.0. |
77
+ | `status` | `status` | `"unchecked" \| "checked" \| "indeterminate"` | `"unchecked"` | Check state. `"indeterminate"` is programmatic-only — a user toggle always resolves to checked or unchecked. |
78
+ | `value` | `value` | `string` | `""` | Value reported in the `lof-change` event detail (it is not submitted with a form). |
79
+ | `size` | `size` | `"small" \| "medium" \| "large" \| "extra-large"` | `"medium"` | Control scale (Figma Size), on Figma's four-step ramp of control frames: `"small"` 16px / body-sm, `"medium"` (default) 18px / body-md, `"large"` 20px / body-lg, `"extra-large"` 24px / body-xl. Supporting text sits one body step below the label at every size (body-xs / sm / md / lg, i.e. 10 / 12 / 14 / 16px). The drawn square is inset to 80% of the frame, so the frame is the layout footprint (what the row gap and the compact indent measure from) rather than the visible square. Reflected. |
80
+ | `density` | `density` | `"compact" \| "comfortable"` | `"compact"` | Supporting-text layout (Figma Density). `"compact"` (default) puts the supporting text on its own line under the row, indented past the box; `"comfortable"` stacks label + supporting text beside the box. Reflected. |
81
+ | `alignment` | `alignment` | `"leading" \| "trailing"` | `"leading"` | Box position (Figma Alignment). `"leading"` (default) renders the box before the label; `"trailing"` pushes it to the far edge of the row. Trailing has no compact layout in the spec, so it always renders with comfortable density. Reflected. |
82
+ | `fieldAriaLabel` | `field-aria-label` | `string` | `undefined` | Accessible name for the native checkbox, for when the visible `label` is absent or not a usable name on its own — a checkbox in a table row, or one whose meaning comes from its column header. Normally unnecessary: the input is wrapped in the `<label>` that renders `label`, so the visible text already names it natively. Setting this puts an `aria-label` on the input, which OVERRIDES that wrapping label — so set it only when the visible text is the wrong name, not to repeat it. Left unset the attribute is not emitted at all. An outer `<label>` (wrapping the checkbox, or `for=`) names it only when neither this nor a visible `label` is set. |
83
+
84
+ ### Public fields / accessors
85
+
86
+ | Name | Type | Description |
87
+ | --- | --- | --- |
88
+ | `supportingText` | `string` | camelCase alias of `supportingtext`, matching lof-textfield and lof-select. The declared property is lowercase, so `el.supportingText = "…"`, lit `.supportingText=${…}` and Angular `[supportingText]` used to set an unused expando and render nothing. Reading or writing either name now hits the same reactive property; the attribute stays `supportingtext`. |
89
+ | `checked` | `boolean` | Boolean view of `status`: `true` when `status === "checked"`; setting it writes `"checked"` / `"unchecked"`. |
90
+
91
+ ## Events
92
+
93
+ | Event | Detail | Bubbles / composed | Description |
94
+ | --- | --- | --- | --- |
95
+ | `lof-change` | `{ checked: this.status === "checked", value: this.value, }` | bubbles / composed | Fired after a user toggle. Detail: `{ checked: boolean, value: string }`. |
96
+
97
+ ## Slots
98
+
99
+ | Slot | Description |
100
+ | --- | --- |
101
+ | — | This element has no slots. |
102
+
103
+ ## CSS Parts
104
+
105
+ | Part | Description |
106
+ | --- | --- |
107
+ | `base` | The outer wrapper that carries the `state` / `status` classes |
108
+ | `label` | The visible label text |
109
+ | `helper` | The supporting text (rendered beside the box in comfortable density, under the row in compact) |
110
+
111
+ <!-- readme-gen:end -->
112
+
113
+ ## Accessibility
114
+
115
+ - A visually hidden native `<input type="checkbox">` carries the semantics; the custom box is decorative. The input is wrapped in a `<label>`, so clicking anywhere on the row (label, icon or box — the whole row in trailing alignment) toggles it.
116
+ - An outer `<label>` works too, wrapped around the checkbox (`<label><lof-checkbox label=""></lof-checkbox> Accept terms</label>`) or pointing at it (`<label for="terms">Accept terms</label><lof-checkbox id="terms" label="">`). The element is form-associated, so clicking the label's text toggles it (once, with one `lof-change`); `state="disabled"` ignores it. Set `label=""` so the default "Label" text is not rendered. The input lives in the shadow root, where `aria-labelledby` cannot reach the label, so the label's text is copied into the input's `aria-label`, but only when the checkbox has no visible `label` and no `field-aria-label`: either one wins over an outer label. The copy follows edits to the label's text.
117
+ - `status="indeterminate"` sets the native `indeterminate` flag and `aria-checked="mixed"` on the input, so screen readers announce the mixed state.
118
+ - `state="disabled"` sets the native `disabled` attribute (the input leaves the tab order) and blocks pointer events on the whole element.
119
+ - Focus: `:focus-visible` on the hidden input draws a 2px `--lof-border-focus` outline with a 2px offset around the box.
120
+ - No live-region announcements are made; the native checkbox reports its own state changes.
121
+
122
+ | Key | Action |
123
+ | --- | --- |
124
+ | `Tab` / `Shift+Tab` | Move focus to / from the checkbox |
125
+ | `Space` | Toggle between checked and unchecked (native behaviour; indeterminate resolves to checked) |
126
+
127
+ ## Notes / Edge Cases
128
+
129
+ - User toggling is binary: indeterminate is never entered by interaction. Set `status="indeterminate"` programmatically (e.g. a Select-All parent driven by app state).
130
+ - `checked` is a convenience accessor over `status` (used by the Angular ControlValueAccessor wrapper); reading it is `status === "checked"`, writing it sets `"checked"` / `"unchecked"`.
131
+ - `alignment="trailing"` with `density="compact"` is "Not available" in the Figma sheet: the element renders comfortable density and logs `[lof-checkbox] density="compact" has no trailing layout; rendering comfortable density.` once per change.
132
+ - Comfortable density with no supporting text is visually identical to compact.
133
+ - The host is `display: block`, so a trailing checkbox stretches to its container width; constrain the parent to control row width.
134
+ - `value` is only reported in the `lof-change` detail — the element does not participate in native form submission. It is form-associated (so an outer `<label>` can find it) but sets no form value, so it is still not submitted and form reset does not touch it; it does now appear in `form.elements`.
135
+ - `el.click()` from script now toggles the checkbox, like a native one; it used to do nothing.
136
+ - The hidden native input is absolutely positioned against the `.row` containing block; keep `position: relative` on `.row` (Tab-scroll page-jump fix, shared with lof-radio).
137
+ - Control frames are 16 / 18 / 20 / 24px for small / medium / large / extra-large, matching Figma. The frame is the layout footprint — the row gap and the compact indent measure from it — while the drawn square is inset to 80% of the frame (12.8 / 14.4 / 16 / 19.2px), as Figma draws it. The square, its wall and the check / dash marks paint at the same size wherever the checkbox sits; before, the fractional squares were rounded to 12 or 13, 14 or 15, and 19 or 20px depending on the checkbox's sub-pixel position.
138
+ - The square's 2px border weight is **not** verified against Figma: the control is flattened artwork (a filled vector rather than a frame with a stroke), so the sheet gives the square's outer size but says nothing about its stroke. Carried forward from the previous implementation.
139
+
140
+ ### Layout matrix (mirrors the Figma sheet)
141
+
142
+ | Size | Density | Leading | Trailing |
143
+ | --- | --- | --- | --- |
144
+ | M | Comfortable | yes | yes |
145
+ | M | Compact | yes (default) | renders comfortable |
146
+ | S | Comfortable | yes | yes |
147
+ | S | Compact | yes | renders comfortable |
148
+ | L | Comfortable | yes | yes |
149
+ | L | Compact | yes | renders comfortable |
150
+ | XL | Comfortable | yes | yes |
151
+ | XL | Compact | yes | renders comfortable |
152
+
153
+ ### Recipes (intentionally not component props)
154
+
155
+ - **Selectable list row**: `alignment="trailing"` checkbox inside a padded, hover-highlighted container.
156
+ - **Select All / nested group**: parent checkbox with `status="indeterminate"` wired to children in app state.
157
+ - **Selectable card**: `lof-card` wrapping a checkbox; toggle a selected border on `lof-change`.
158
+
159
+ See the Storybook Checkbox stories for working recipe markup.
@@ -0,0 +1,153 @@
1
+ # lof-chip
2
+
3
+ `<lof-chip>` is the compact chip from the Figma "Chip" component: a short label with tone × variant colouring, an optional leading icon or initials avatar, an optional trailing icon, a remove control and opt-in drag-and-drop. Use it for tags, active filters, selected values in a multi-select and small status labels. Do not use it as a general button (use `lof-button`) or for status counts (use `lof-badge`); for long-lived toggles use `lof-switch` or `lof-checkbox`.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <!-- Basic chip (tone="neutral" variant="fill" size="medium" border="default") -->
9
+ <lof-chip label="Active"></lof-chip>
10
+
11
+ <!-- Tones -->
12
+ <lof-chip label="Info" tone="info"></lof-chip>
13
+ <lof-chip label="Warning" tone="warning"></lof-chip>
14
+ <lof-chip label="Error" tone="destructive"></lof-chip>
15
+ <lof-chip label="Success" tone="success"></lof-chip>
16
+
17
+ <!-- Subtle variant: tinted background, tone-coloured text -->
18
+ <lof-chip label="Subtle" tone="info" variant="subtle"></lof-chip>
19
+
20
+ <!-- Sizes -->
21
+ <lof-chip label="Small" size="small"></lof-chip>
22
+ <lof-chip label="Medium" size="medium"></lof-chip>
23
+ <lof-chip label="Large" size="large"></lof-chip>
24
+
25
+ <!-- Deprecated aliases — these still render, but prefer the canonical spellings above.
26
+ tone="danger" is an alias of tone="destructive" and logs a one-time console notice.
27
+ size="sm" / "md" / "lg" are alternative spellings (NOT deprecated, no notice). -->
28
+ <lof-chip label="Error" tone="danger"></lof-chip>
29
+ <lof-chip label="Small" size="sm"></lof-chip>
30
+
31
+ <!-- Fully rounded corners -->
32
+ <lof-chip label="Rounded" border="rounded"></lof-chip>
33
+
34
+ <!-- Leading / trailing icons (icon dictionary names, rendered via <lof-icon>) -->
35
+ <lof-chip label="Settings" leading-icon="settings"></lof-chip>
36
+ <lof-chip label="Next" trailing-icon="chevron-right"></lof-chip>
37
+
38
+ <!-- Initials avatar (takes precedence over leading-icon) -->
39
+ <lof-chip label="John Doe" avatar="JD"></lof-chip>
40
+
41
+ <!-- Removable chip -->
42
+ <lof-chip id="removableChip" label="Removable" removable></lof-chip>
43
+ <script>
44
+ document.getElementById("removableChip").addEventListener("removed", () => {
45
+ console.log("Chip was removed");
46
+ });
47
+ </script>
48
+
49
+ <!-- Draggable chip: native drag-and-drop plus Left/Right arrow reordering -->
50
+ <lof-chip id="dragChip" label="Reorder me" draggable-chip></lof-chip>
51
+ <script>
52
+ document.getElementById("dragChip").addEventListener("chip-move", (e) => {
53
+ console.log("move", e.detail.direction); // -1 = left, 1 = right
54
+ });
55
+ </script>
56
+ ```
57
+
58
+ <!-- readme-gen:start -->
59
+
60
+ <!-- Generated from lof-chip.ts — do not edit; run readme-generate.mjs -->
61
+
62
+ ## API
63
+
64
+ ### Attributes / Properties
65
+
66
+ | Property | Attribute | Type | Default | Description |
67
+ | --- | --- | --- | --- | --- |
68
+ | `label` | `label` | `string` | `"Label"` | Text shown in the chip; also its accessible name and the drag payload. |
69
+ | `fieldAriaLabel` | `field-aria-label` | `string` | `undefined` | Accessible name for an icon-only or intentionally unlabelled chip; overrides `label` for the chip and its remove button. |
70
+ | `tone` | `tone` | `"neutral" \| "accent" \| "destructive" \| "warning" \| "success" \| "info" \| "danger"` | `"neutral"` | Colour tone (Figma Tone): `neutral`, `destructive`, `warning`, `success` or `info`. Combined with `variant`. `"danger"` is a deprecated alias of `"destructive"`: it keeps working, logs a one-time console notice, and is normalised to `"destructive"` on the property and the reflected attribute. Reflected. |
71
+ | `variant` | `variant` | `"fill" \| "subtle" \| "outline" \| "primary" \| "secondary"` | `"fill"` | Emphasis (Figma Style): `fill` = solid tone background, `subtle` = tinted background with tone-coloured text. Figma's own spellings `primary` and `secondary` are accepted and normalised to `fill` / `subtle`. Reflected. |
72
+ | `size` | `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | `"medium"` | Height scale (Figma Size): `small` 24px / body-sm, `medium` 28px / body-md, `large` 32px / body-lg. Icon size follows (12 / 14 / 16px). `sm` / `md` / `lg` are accepted and normalised to the full words. Reflected. |
73
+ | `border` | `border` | `"default" \| "rounded"` | `"default"` | Corner shape (Figma Border): `default` = 6px radius, `rounded` = fully rounded with 12px horizontal padding. Reflected. |
74
+ | `leadingIcon` | `leading-icon` | `string` | `undefined` | Icon name from the generated icon dictionary (e.g. "settings") — rendered via <lof-icon> before the label. Ignored when `avatar` is set. |
75
+ | `trailingIcon` | `trailing-icon` | `string` | `undefined` | Icon name from the generated icon dictionary, rendered after the label. |
76
+ | `avatar` | `avatar` | `string` | `undefined` | Initials text for the avatar (e.g. "JD"), rendered as a `<lof-avatar type="text">` before the label. Mutually exclusive with leadingIcon (avatar wins). |
77
+ | `removable` | `removable` | `boolean` | `false` | Shows a remove (close) button after the label; clicking it sets `removed` and fires `removed`. |
78
+ | `presentational` | `presentational` | `boolean` | `false` | New in 1.5.0. Makes the chip body plain text: no `button` role, no Tab stop, no Enter / Space / Delete handling and no host click re-dispatch. The remove button (when `removable`) stays a real button. For chips that only display a value inside another control, e.g. lof-select's multi-select chips. Reflected. |
79
+ | `removed` | `removed` | `boolean` | `false` | `true` once the chip has been removed — the host is hidden via `:host([removed])`. Reflected so CSS and Angular can see it; reset to `false` to show the chip again. Reflected. |
80
+ | `draggableChip` | `draggable-chip` | `boolean` | `false` | Opt-in native drag-and-drop: sets `draggable="true"` on the host, shows the Figma "Dragged" state during a real drag gesture, and makes Left/Right arrow keys fire `chip-move`. |
81
+
82
+ ## Events
83
+
84
+ | Event | Detail | Bubbles / composed | Description |
85
+ | --- | --- | --- | --- |
86
+ | `chip-move` | `{ direction: e.key === "ArrowLeft" ? -1 : 1 }` | bubbles / composed | Fired on Left/Right arrow keys when `draggable-chip` is set — the keyboard alternative to drag-and-drop; the container should reorder the chip. Detail: `{ direction: -1 \| 1 }` (-1 = left, 1 = right). |
87
+ | `removed` | — | bubbles / composed | Fired when the chip is removed via its remove button or Delete/Backspace (after `removed` is set to `true`). No detail. |
88
+
89
+ ## Slots
90
+
91
+ | Slot | Description |
92
+ | --- | --- |
93
+ | — | This element has no slots. |
94
+
95
+ ## CSS Parts
96
+
97
+ | Part | Description |
98
+ | --- | --- |
99
+ | `base` | The chip body (`.chip`) that carries size, tone, variant and border styling |
100
+ | `icon` | The leading `<lof-icon>` (rendered only when `leading-icon` is set and no avatar) |
101
+ | `label` | The label text |
102
+ | `remove` | The remove `<button>` (rendered only when `removable`) |
103
+
104
+ ## Tokens / CSS Variables
105
+
106
+ ### Component hooks
107
+
108
+ Set these on the host (or an ancestor) to customise the element without touching design tokens.
109
+
110
+ | Custom property | Default | Description |
111
+ | --- | --- | --- |
112
+ | `--lof-chip-focus-ring` | `var(--lof-border-focus)` | Colour of the keyboard focus outline; default `var(--lof-border-focus)` |
113
+
114
+ <!-- readme-gen:end -->
115
+
116
+ ## 2026-11 admin refresh
117
+
118
+ - Chips are status labels: 20 / 24 / 28px tall (small / medium / large), 4px corners at small and 6px above, 12px Medium text (10px at small).
119
+ - `variant="subtle"` is a light tint with a 1px edge in the same hue; `variant="outline"` (new) is the surface colour with a hairline, the tone tinting only the text.
120
+ - `tone="accent"` (new) uses the blue accent: a solid accent fill, or the accent tint when subtle.
121
+
122
+ ```html
123
+ <lof-chip label="Public" tone="success" variant="subtle" size="small"></lof-chip>
124
+ <lof-chip label="Management" variant="outline"></lof-chip>
125
+ <lof-chip label="New" tone="accent" variant="subtle"></lof-chip>
126
+ ```
127
+
128
+ ## Accessibility
129
+
130
+ - The chip body is a `<span role="button" tabindex="0">` whose `aria-label` is the `label` text. The shadow root uses `delegatesFocus`, so calling `focus()` on the host focuses that inner span.
131
+ - The remove control is a real `<button>` labelled `Remove {label}`; it is a second Tab stop after the chip body.
132
+ - Removing a chip (button or keyboard) calls the shared `announce()` helper with `"{label} removed"`, so screen readers hear the removal even though the chip disappears.
133
+ - Icons and the avatar are decorative; the accessible name comes only from `label`.
134
+
135
+ | Key | Action |
136
+ |-----|--------|
137
+ | `Tab` | Focus the chip body, then the remove button (when `removable`) |
138
+ | `Enter` / `Space` | Re-dispatches a `click` on the host so consumer `click` handlers run |
139
+ | `Delete` / `Backspace` | Removes the chip when `removable` (sets `removed`, fires `removed`) |
140
+ | `ArrowLeft` / `ArrowRight` | Fires `chip-move` with `direction: -1` / `1` when `draggable-chip` is set |
141
+
142
+ Focus is shown as a 2px outline in `--lof-chip-focus-ring` (defaults to `--lof-border-focus`) around the whole chip, plus an inner `--lof-border-focus-inner` ring, only for keyboard focus (`:focus-visible`). The remove button gets its own `currentColor` outline.
143
+
144
+ ## Notes / Edge Cases
145
+
146
+ - `avatar` and `leading-icon` are mutually exclusive: when both are set the avatar wins and a console warning is logged. The avatar is a `lof-avatar type="text"` sized to fill the chip's content box — 16 / 20 / 24px for `sm` / `md` / `lg`, driven through `--lof-avatar-size` rather than the avatar's own `size` presets (the small chip needs 16px, below the 20px `xs` floor).
147
+ - The trailing icon has no CSS part; only the leading icon is exposed as `icon`.
148
+ - The remove `✕` is drawn at the same size as the leading/trailing icons (12 / 14 / 16px) and in the same colour as the label — it carries no opacity dulling, so it keeps the label's contrast ratio on the `subtle` tones.
149
+ - `border="rounded"` also widens the horizontal padding to 12px at every size, per the Figma spec.
150
+ - `removed` is reflected: once `true` the host is `display: none` via `:host([removed])`. Set it back to `false` to show the chip again. Clicking the remove button stops propagation, so chip-level `click` handlers do not fire on removal.
151
+ - `draggable-chip` sets the native `draggable="true"` attribute on the host and puts the label in `dataTransfer` as `text/plain`. During a real drag the host carries a `dragging` attribute that maps to the Figma "Dragged" state; the same look is used for `:active`. The component does not reorder anything itself — the container must handle `drop` / `chip-move`.
152
+ - The remove button has no hover state of its own; the hover/pressed colours belong to the whole chip (per-tone action tokens).
153
+ - The host is `display: inline-flex` with `flex: 0 0 auto`, so chips flow inline and never stretch in a flex row.
@@ -0,0 +1,107 @@
1
+ # lof-container
2
+
3
+ `<lof-container>` is the Figma "Container" surface block: a full-width, rounded wrapper with a `surface` fill (`default` page surface, `elevated` raised surface or `transparent`), a `padding` step and an optional `shadow`, plus default heading and paragraph typography for what you slot into it. Use it to group a section of a page or a settings panel on a consistent surface. It is a static layout primitive — for a bordered content card use `lof-card`, and for anything transient use `lof-modal` or `lof-drawer`.
4
+
5
+ ## Usage
6
+
7
+ ```html
8
+ <!-- Default: page surface, medium padding -->
9
+ <lof-container>
10
+ <h2>Section title</h2>
11
+ <p>Content goes here.</p>
12
+ </lof-container>
13
+
14
+ <!-- Elevated surface with small padding -->
15
+ <lof-container surface="elevated" padding="small">
16
+ <p>Compact section on the raised surface.</p>
17
+ </lof-container>
18
+
19
+ <!-- Large padding with shadow -->
20
+ <lof-container padding="large" shadow>
21
+ <h1>Hero section</h1>
22
+ <p>With shadow elevation.</p>
23
+ </lof-container>
24
+
25
+ <!-- Transparent surface: spacing only, no fill -->
26
+ <lof-container surface="transparent" padding="extra-large">
27
+ <div>Content with no background.</div>
28
+ </lof-container>
29
+
30
+ <!-- Everything combined -->
31
+ <lof-container surface="default" padding="medium" shadow>
32
+ <h3>Card-like container</h3>
33
+ <p>Page surface, medium padding, shadow.</p>
34
+ </lof-container>
35
+ ```
36
+
37
+ ### Deprecated aliases
38
+
39
+ ```html
40
+ <!-- background="white|light|none" is the deprecated 1.4.6 spelling of surface="default|elevated|transparent".
41
+ Still supported; logs once per page:
42
+ [lof-container] "background" is deprecated and will be removed in 3.0 — use "surface" instead. Map: white → "default", light → "elevated", none → "transparent". -->
43
+ <lof-container background="light" padding="small">
44
+ <p>Same as surface="elevated".</p>
45
+ </lof-container>
46
+ ```
47
+
48
+ <!-- readme-gen:start -->
49
+
50
+ <!-- Generated from lof-container.ts — do not edit; run readme-generate.mjs -->
51
+
52
+ ## API
53
+
54
+ ### Attributes / Properties
55
+
56
+ | Property | Attribute | Type | Default | Description |
57
+ | --- | --- | --- | --- | --- |
58
+ | `padding` | `padding` | `"small" \| "medium" \| "large" \| "extra-large" \| "sm" \| "md" \| "lg" \| "xl"` | `"medium"` | Inner padding step: `small` = spacing-xs, `medium` = spacing-md, `large` = spacing-lg. `extra-large` = spacing-2xl is a code-only extension — Figma publishes only the three steps above — and is supported, not deprecated. `sm` / `md` / `lg` / `xl` are alternative spellings and stay supported, normalised to the full words. Reflected. |
59
+ | `shadow` | `shadow` | `boolean` | `false` | Adds the `--lof-shadows-md` elevation shadow (Figma shadow/md) to the surface. |
60
+ | `surface` | `surface` | `"default" \| "elevated" \| "transparent"` | `undefined` | Surface fill: `"default"` (the default: page surface) \| `"elevated"` (raised surface) \| `"transparent"`. Takes precedence over the deprecated `background` prop. Reflected. |
61
+
62
+ #### Deprecated (still supported — removal targeted for 3.0)
63
+
64
+ | Property | Attribute | Type | Use instead |
65
+ | --- | --- | --- | --- |
66
+ | `background` | `background` | `"light" \| "white" \| "none"` | Deprecated since 1.4.7 — use `surface` (white→default, light→elevated, none→transparent). |
67
+
68
+ ### Public fields / accessors
69
+
70
+ | Name | Type | Description |
71
+ | --- | --- | --- |
72
+ | `resolvedSurface` | `ContainerSurface` | Resolved surface: explicit `surface` wins, else mapped `background`, else "default". |
73
+
74
+ ## Events
75
+
76
+ | Event | Detail | Bubbles / composed | Description |
77
+ | --- | --- | --- | --- |
78
+ | — | — | — | This element emits no custom events. |
79
+
80
+ ## Slots
81
+
82
+ | Slot | Description |
83
+ | --- | --- |
84
+ | (default) | Section content; slotted `h1`–`h4` get the headings-sm role and `p` the body-md role |
85
+
86
+ ## CSS Parts
87
+
88
+ | Part | Description |
89
+ | --- | --- |
90
+ | `base` | The padded surface `<div>` (same element as `container`) |
91
+ | `container` | Alias of `base`, kept for existing `::part(container)` selectors |
92
+
93
+ <!-- readme-gen:end -->
94
+
95
+ ## Accessibility
96
+
97
+ - The container sets no ARIA role and is not focusable; it is a generic `display: block` region with no keyboard handling. The accessible structure comes entirely from the slotted content, so use real headings and paragraphs (they also pick up the container typography) and wrap the whole thing in a `<section>` / `<article>` with a heading when it forms a landmark.
98
+ - `surface` and `shadow` are purely visual; nothing about the fill or elevation is conveyed to assistive technology.
99
+
100
+ ## Notes / Edge Cases
101
+
102
+ - Padding steps map to spacing tokens: `small` = `--lof-spacing-xs`, `medium` = `--lof-spacing-md`, `large` = `--lof-spacing-lg`. `extra-large` = `--lof-spacing-2xl` is a code-only extension: Figma's Container publishes only three padding steps, and it is supported rather than deprecated. The short spellings `sm` / `md` / `lg` / `xl` keep working and normalise to the full words.
103
+ - Surface fills: `default` = `--lof-bg-surface`, `elevated` = `--lof-bg-surface-elevated`, `transparent` = no fill. The corner radius (`--lof-border-radius-sm`) is applied regardless of surface, and `shadow` adds `--lof-shadows-md`.
104
+ - `resolvedSurface` tells you which fill is in effect: an explicit `surface` wins, otherwise the deprecated `background` value is mapped (white → default, light → elevated, none → transparent), otherwise `default`.
105
+ - The inner `<div>` keeps the legacy class names `bg-white` / `bg-light` / `bg-none` for the three surfaces so existing test selectors keep matching; `::part(base)` and `::part(container)` both target that same element.
106
+ - Slotted `h1`–`h4` receive the headings-sm role with a bottom margin of `--lof-spacing-lg`; slotted `p` receives the body-md role with zero margin. Wrap other content in your own elements to style it.
107
+ - The host is `display: block; width: 100%` with `box-sizing: border-box`, so it fills its parent; constrain the parent, not the container.