@lofid/web 1.0.0 → 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.
- package/README.md +19 -0
- package/custom-elements.json +4853 -3129
- package/dist/index.d.ts +424 -16
- package/dist/index.js +4069 -1972
- package/dist/index.js.map +1 -1
- package/dist/styles/motion.css +1 -1
- package/dist/styles/typography.css +41 -0
- package/dist/styles/typography.json +858 -0
- package/dist/styles/vars.css +660 -305
- package/package.json +4 -2
- package/readmes/lof-avatar/README.md +1 -1
- package/readmes/lof-button/README.md +22 -23
- package/readmes/lof-calendar/README.md +1 -1
- package/readmes/lof-card/README.md +41 -11
- package/readmes/lof-chip/README.md +15 -3
- package/readmes/lof-date-picker/README.md +1 -1
- package/readmes/lof-empty-state/README.md +78 -0
- package/readmes/lof-image-input/README.md +75 -0
- package/readmes/lof-kbd/README.md +3 -3
- package/readmes/lof-layout/README.md +122 -122
- package/readmes/lof-link/README.md +67 -0
- package/readmes/lof-nav/README.md +90 -0
- package/readmes/lof-page-header/README.md +71 -0
- package/readmes/lof-progress/README.md +2 -2
- package/readmes/lof-radio/README.md +2 -2
- package/readmes/lof-rating/README.md +90 -0
- package/readmes/lof-segmented-button/README.md +2 -2
- package/readmes/lof-select/README.md +2 -2
- package/readmes/lof-split-button/README.md +2 -2
- package/readmes/lof-stat/README.md +73 -0
- package/readmes/lof-stepper/README.md +1 -1
- package/readmes/lof-switch/README.md +2 -2
- package/readmes/lof-tab/README.md +8 -4
- package/readmes/lof-table/README.md +114 -0
- package/readmes/lof-textfield/README.md +3 -3
- package/readmes/lof-time-picker/README.md +1 -1
- package/readmes/lof-tooltip/README.md +2 -2
- package/readmes/lof-upload/README.md +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A button with a main action and a menu of related actions, also called a combo button. It is one pill in two segments with a 1px divider between them: the main action on the left, and a chevron on the right that opens a `lof-menu` of `items`, anchored below and end-aligned. Use it when one action is the usual choice and a few close variants should stay one click away, such as "New order" with "Duplicate" and "Save as template". Use `lof-button` for a single action, and a `lof-popover` with a `lof-menu` when no action is the default.
|
|
6
6
|
|
|
7
|
-
Each segment is a native `<button>` drawn with lof-button's own styles for the chosen `variant`, `tone` and `size`. The heights (
|
|
7
|
+
Each segment is a native `<button>` drawn with lof-button's own styles for the chosen `variant`, `tone` and `size`. The heights (28 / 34 / 40px), padding, type, hover, pressed, focus ring and disabled look are therefore lof-button's. The outer corners keep the pill radius and the seam between the segments is square. While the menu is open, the chevron keeps its pressed look and its arrow turns up.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
@@ -67,7 +67,7 @@ The divider is its own 1px column, so the pill is the main action, plus 1px, plu
|
|
|
67
67
|
| `size` | `size` | `"small" \| "medium" \| "large"` | `"medium"` | Height of the pill and size of its text and icons, as lof-button's `size`: `small` = 32px, `medium` = 40px (default), `large` = 48px. The menu rows take the same size. Reflected. |
|
|
68
68
|
| `disabled` | `disabled` | `boolean` | `false` | Dims both segments to lof-button's disabled look (the divider keeps its colour), removes them from the Tab order and keeps the menu closed. Reflected. |
|
|
69
69
|
| `loading` | `loading` | `boolean` | `false` | The main action shows only lof-button's spinner, at its minimum width; its text stays its accessible name (visually hidden) and it is `aria-busy`. Its clicks are blocked and the chevron is disabled, so nothing else starts mid-request; an open menu closes. Reflected. |
|
|
70
|
-
| `iconOnly` | `icon-only` | `boolean` | `false` | The main action is a square of the button's height (
|
|
70
|
+
| `iconOnly` | `icon-only` | `boolean` | `false` | The main action is a square of the button's height (28 / 34 / 40), as lof-button's `icon-only`: give it a single icon (`icon`, or a slotted `lof-icon`) and set `aria-label`. Reflected. |
|
|
71
71
|
| `ariaLabel` | `aria-label` | `string \| null` | `null` | Accessible name of the main action, forwarded to its native `<button>`. Required with `icon-only`, where the main action has no visible text (a console warning names split buttons without one). |
|
|
72
72
|
| `menuLabel` | `menu-label` | `string` | `"More options"` | Accessible name of the chevron button (attribute `menu-label`); it has no visible text. |
|
|
73
73
|
| `icon` | `icon` | `string` | `""` | `lof-icon` name drawn before the main action's text (16 / 18 / 20px by size). |
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# lof-stat
|
|
2
|
+
|
|
3
|
+
`<lof-stat>` is a KPI tile: an optional icon (the `icon` slot), the figure, what it counts and an optional trend chip ("+2.7%") that is green going up and red going down. `appearance="card"` (default) draws the hairline card surface; `plain` sits inside another card, as the headline figure of a panel. Format the number yourself ("9.3k", "$295.7k"). New in the 2026-11 admin refresh, after admin dashboard KPI rows.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:16px">
|
|
9
|
+
<lof-stat value="9.3k" label="Amazing mates"><lof-icon slot="icon" name="person"></lof-icon></lof-stat>
|
|
10
|
+
<lof-stat value="24k" label="Lesson views" change="+12%"><lof-icon slot="icon" name="visibility"></lof-icon></lof-stat>
|
|
11
|
+
<lof-stat value="608" label="New subscribers" change="-0.7%"><lof-icon slot="icon" name="email"></lof-icon></lof-stat>
|
|
12
|
+
<lof-stat value="2.5k" label="Stream audience" change="0%" trend="neutral"></lof-stat>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<!-- Headline figure inside a card -->
|
|
16
|
+
<lof-card heading="Highlights">
|
|
17
|
+
<lof-stat appearance="plain" size="large" value="$295.7k" label="All time sales" change="+2.7%" change-label="up 2.7% from last month"></lof-stat>
|
|
18
|
+
</lof-card>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
<!-- readme-gen:start -->
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### Attributes / Properties
|
|
26
|
+
|
|
27
|
+
| Property | Attribute | Type | Default | Description |
|
|
28
|
+
| --- | --- | --- | --- | --- |
|
|
29
|
+
| `value` | `value` | `string` | `""` | The figure, already formatted ("9.3k", "$295.7k"). |
|
|
30
|
+
| `label` | `label` | `string` | `""` | What the figure counts ("Amazing mates"). |
|
|
31
|
+
| `change` | `change` | `string` | `""` | Trend text ("+2.7%"); renders the trend chip. |
|
|
32
|
+
| `trend` | `trend` | `"up" \| "down" \| "neutral"` | `—` | Direction of the change. Default: from the sign of `change` (`+` up, `-` down, otherwise neutral). |
|
|
33
|
+
| `changeLabel` | `change-label` | `string` | `""` | Spoken direction words, e.g. "up 2.7% from last month". Default: "increase" / "decrease". |
|
|
34
|
+
| `size` | `size` | `"medium" \| "large"` | `"medium"` | |
|
|
35
|
+
| `appearance` | `appearance` | `"card" \| "plain"` | `"card"` | |
|
|
36
|
+
|
|
37
|
+
## Events
|
|
38
|
+
|
|
39
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
40
|
+
| --- | --- | --- | --- |
|
|
41
|
+
| — | — | — | This element emits no custom events. |
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `icon` | A lof-icon (drawn on a 36px muted tile), a logo or an image. |
|
|
48
|
+
| (default) | Extra content under the label. |
|
|
49
|
+
| `value` | Rich figure content after `value`. |
|
|
50
|
+
| `footer` | A sparkline, a progress bar or a link. |
|
|
51
|
+
|
|
52
|
+
## CSS Parts
|
|
53
|
+
|
|
54
|
+
| Part | Description |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `base` | The tile |
|
|
57
|
+
| `icon` | The icon tile |
|
|
58
|
+
| `value` | The figure |
|
|
59
|
+
| `trend` | The trend chip |
|
|
60
|
+
| `label` | The label |
|
|
61
|
+
| `footer` | The footer region |
|
|
62
|
+
|
|
63
|
+
<!-- readme-gen:end -->
|
|
64
|
+
|
|
65
|
+
## Accessibility
|
|
66
|
+
|
|
67
|
+
- The figure and label are plain text in reading order. The trend chip starts with a visually hidden direction word ("increase:", "decrease:"), so colour and the arrow are not the only cue; set `change-label` for a fuller phrase.
|
|
68
|
+
- The tile is not interactive. Wrap it in a link, or put a lof-link in the footer, to make it go somewhere.
|
|
69
|
+
|
|
70
|
+
## Notes / Edge Cases
|
|
71
|
+
|
|
72
|
+
- Figures use tabular numerals so a row of tiles lines up.
|
|
73
|
+
- `size="large"` uses the display heading size for headline totals.
|
|
@@ -164,7 +164,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
164
164
|
- `label-placement` is the canonical layout switch (Figma `Typel`). When it is unset the deprecated `textalign` prop decides: `below` renders like `inverted` (indicator above the label), `right` renders like `centered` (label beside the indicator). `top` differs from `centered` only in aligning the label to the top of the indicator. Figma marks Top + Horizontal as an unsupported combination.
|
|
165
165
|
- Statuses map to the Figma `.Artwork` states: `done` = inverse fill with a check mark (or the number when `type="number"`, nothing when `type="dot"`), `progress` = neutral fill with a strong 1px border, `disabled` = the same drawn at 40% opacity. Connectors are `border-strong` after a `done` / `progress` step and `border-default` otherwise.
|
|
166
166
|
- `type="icon"` shows the check mark on every step regardless of status; `type="dot"` shrinks the indicator to 8px and fills it for `done` and `progress`.
|
|
167
|
-
- Two axes spell one value "dot" and they are independent: `type="dot"` is the INDICATOR (
|
|
167
|
+
- Two axes spell one value "dot" and they are independent: `type="dot"` is the INDICATOR (a 10px disc replacing the number), `connector="dot"` is the LINE between steps. `connector="dot"` draws a 1px rule dashed 2px on / 2px off, matching Figma `.Line Types` `Type=Dot` (`strokeWeight=1`, `strokeDashes=[2,2]`). It is a repeating gradient rather than a dashed border because no engine lets you state a 2/2 dash period. The dash takes the connector's own state colour, so it goes `border-strong` after a `done` / `progress` step like the solid line does.
|
|
168
168
|
- Connector length doubles as the gap between steps and depends on `size` and `orientation`: large = `--lof-stepper-connector-length-lg` (86px) in both orientations; small horizontal = `--lof-stepper-connector-length-md` (60px); small vertical = `--lof-stepper-connector-length-sm` (42px). Note the `md` / `sm` suffixes refer to those defaults, not to a size value.
|
|
169
169
|
- Labels never wrap (`white-space: nowrap`); keep titles short or widen the connector hooks.
|
|
170
170
|
- `steps` is compared by reference: mutate-in-place changes are not picked up — assign a new array.
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
| Property | Attribute | Type | Default | Description |
|
|
45
45
|
| --- | --- | --- | --- | --- |
|
|
46
46
|
| `checked` | `checked` | `boolean` | `false` | Whether the switch is on. Set it to control the state programmatically; user toggles update it and fire `lof-change`. |
|
|
47
|
-
| `type` | `type` | `"line" \| "pill"` | `"
|
|
47
|
+
| `type` | `type` | `"line" \| "pill"` | `"pill"` | Shape. `"pill"` (default since the 2026-11 refresh) is a filled track with the knob inside it: 26×18 / 30×20 / 34×22 with a 10 / 12 / 14px knob, the accent when on. `"line"` is the earlier 44×20 control with a thin rail and the knob riding on it, accent knob when on. Pressing squashes the knob; only `line` also shows a pressed disc behind it. Reflected. |
|
|
48
48
|
| `disabled` | `disabled` | `boolean` | `false` | Disables interaction and swaps in the dulled rail / handle fills (for both types, checked or not) and the disabled label colour; the handle shadow is removed. An ancestor `<fieldset disabled>` disables it the same way, without changing this property. |
|
|
49
49
|
| `value` | `value` | `string` | `""` | Arbitrary string echoed in the `lof-change` event detail — useful when one handler serves several switches. |
|
|
50
50
|
| `fieldAriaLabel` | `field-aria-label` | `string` | `undefined` | Accessible name for the native input when the switch has no visible text. Prefer `label`, slotted text or an outer `<label>` (wrapping the switch, or `for=`), which are visible and clickable. |
|
|
@@ -110,7 +110,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
110
110
|
## Notes / Edge Cases
|
|
111
111
|
|
|
112
112
|
- `lof-change` fires for user toggles only; setting `checked` from JavaScript updates the visuals but emits nothing.
|
|
113
|
-
- Geometry
|
|
113
|
+
- Geometry: the default `pill` switch is 26×18 / 30×20 / 34×22 (small / medium / large) with a 10 / 12 / 14px knob inset 4px; on, the track takes the accent (`--lof-accent`) and the knob travels the track width minus its height. `type="line"` keeps the earlier geometry: 44×20 control, 40×10 rail, 20px knob (36×16 and 52×24 at small and large). Changing `--lof-switch-track-width` widens the control without moving the "on" position.
|
|
114
114
|
- The label type follows the size: body-sm / body-md / body-lg (12 / 14 / 16px) for small / medium / large.
|
|
115
115
|
- **`size` does not respond to viewport width.** It follows Figma's Size axis, and choosing a size per breakpoint is the application's decision — set it from your own media queries or container queries. A control that resized itself at some width would be behaviour a design system cannot document, and the breakpoint that matters belongs to the layout around the switch, not to the switch.
|
|
116
116
|
- A `label` (or slotted content) becomes the switch's accessible name and is clickable, because the root element is the `<label>` that owns the input. Use `field-aria-label` instead when there is no visible text; when both are set, `label` wins.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
});
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
|
-
<!-- Sizes: small (
|
|
25
|
+
<!-- Sizes: small (34px), medium (40px), large (48px) -->
|
|
26
26
|
<lof-tab size="small">
|
|
27
27
|
<lof-tab-item slot="items" label="Overview"></lof-tab-item>
|
|
28
28
|
<lof-tab-item slot="items" label="Details"></lof-tab-item>
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
| --- | --- | --- | --- | --- |
|
|
82
82
|
| `tabs` | `tabs` | `TabItem[]` | `[]` | Tab definitions as `{ label, badge?, badgeDot?, disabled? }` objects — normally set as a property (as an attribute it must be a JSON string). Assign a new array to update; mutating in place does not re-render. Ignored when `<lof-tab-item>` children are slotted into `items`. |
|
|
83
83
|
| `activeIndex` | `active-index` | `number` | `0` | Zero-based index of the selected tab. Set it to switch tabs programmatically (no event is fired for programmatic changes). Reflected (as `activeindex` in 1.x). The `activeindex` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
84
|
-
| `size` | `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | `"md"` | Tab size — styled via :host([size]) rules. Explicit item heights
|
|
84
|
+
| `size` | `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | `"md"` | Tab size — styled via :host([size]) rules. Explicit item heights 34 / 40 / 48px (audit 34); `small\|medium\|large` alias `sm\|md\|lg`. Reflected. |
|
|
85
85
|
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | New in 1.5.0. Tab list layout: `horizontal` (default, a row above the panel) or `vertical` (a column beside the panel as wide as its longest label, tabs 24px apart along a rule on the list's inline-start edge, the active bar on that edge, labels that wrap rather than truncate; Up / Down move between tabs). There is no built-in breakpoint: switch to horizontal on small screens in your app. Reflected. |
|
|
86
86
|
| `iconPlacement` | `icon-placement` | `"start" \| "top"` | `"start"` | New in 1.5.0. Icon position in every tab: `start` (default, before the label) or `top` (stacked above the label, with the badge beside the label). Stacked tabs are 76 / 64 / 52px tall at large / medium / small. Works in both orientations. Reflected. |
|
|
87
87
|
|
|
@@ -116,7 +116,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
116
116
|
|
|
117
117
|
| Custom property | Default | Description |
|
|
118
118
|
| --- | --- | --- |
|
|
119
|
-
| `--lof-tab-active-color` | `var(--tab-active-color)` |
|
|
119
|
+
| `--lof-tab-active-color` | `var(--tab-active-color)` | Indicator colour of the active tab; default `var(--lof-border-strong)` (set it to `var(--lof-bg-brand)` for the pre-2026-11 brand line) |
|
|
120
120
|
| `--lof-tab-hover-color` | `var(--tab-hover-color)` | Background of an inactive tab on hover; default `transparent` (the design darkens the label instead). Set it to bring a hover fill back. |
|
|
121
121
|
| `--lof-tab-list-width` | `max-content` | Width of the tab list when `orientation="vertical"`; default `max-content` |
|
|
122
122
|
| `--lof-tab-text-default` | `var(--tab-text-default)` | Label colour of the active tab; default `var(--lof-text-default)` |
|
|
@@ -157,6 +157,10 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
157
157
|
|
|
158
158
|
<!-- readme-gen:end -->
|
|
159
159
|
|
|
160
|
+
## Look
|
|
161
|
+
|
|
162
|
+
- 2026-11 refresh: the active tab is accent text over a full-width 2px accent underline; hover turns a tab's text accent. Horizontal tabs have no side padding and sit 24px apart (`--lof-tab-gap`); vertical tabs keep an 80px minimum and 16px side padding.
|
|
163
|
+
|
|
160
164
|
## Accessibility
|
|
161
165
|
|
|
162
166
|
- The strip is `role="tablist"`; every tab is `role="tab"` with `aria-selected`, `aria-disabled` and `aria-controls` pointing at the shared `role="tabpanel"`, which in turn is `aria-labelledby` the active tab and is focusable (`tabindex="0"`).
|
|
@@ -180,5 +184,5 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
180
184
|
- `lof-tab-change` fires for user selection only; setting `activeIndex` programmatically updates the strip silently.
|
|
181
185
|
- Slotted `<lof-tab-item>` elements take precedence over the `tabs` array. Their `value` is not read by `<lof-tab>` — look it up from the item at `event.detail` when you need an identifier. The `items` slot itself is hidden.
|
|
182
186
|
- `badge-dot` wins over `badge`; a `badge` of `0` renders no badge. Badges use the danger tone on enabled tabs and a neutral inverse tone on disabled tabs.
|
|
183
|
-
- `size` accepts `small` / `medium` / `large` (item heights
|
|
187
|
+
- `size` accepts `small` / `medium` / `large` (item heights 34 / 40 / 48px with body-sm / md / lg type); the short forms `sm` / `md` / `lg` are aliases (see Deprecated aliases).
|
|
184
188
|
- Legacy hook aliases still honoured: `--tab-active-color`, `--tab-underline-height`, `--tab-text-default`, `--tab-text-hover`, `--tab-text-disabled` and `--tab-hover-color` are read as fallbacks of the `--lof-tab-*` hooks.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# lof-table
|
|
2
|
+
|
|
3
|
+
`<lof-table>` is the data table of an admin screen: header row with sortable columns, row selection with a select-all box, two-line cells (a value and a muted line under it), custom cell content, client-side paging with a "Show N per page" footer and a page range, plus loading and empty states. By default (`appearance="card"`) it draws the 12px hairline surface of a card, with an optional header (`heading` and the `toolbar` slot for search or actions); `appearance="plain"` drops the surface so it can sit inside a flush `lof-card`. With `server-side` the app owns sorting and paging: the table shows `rows` as given and reports `lof-sort` and `lof-page-change`. New in the 2026-11 admin refresh.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<lof-table id="teams" heading="Teams" selectable page-size="5" grid>
|
|
9
|
+
<lof-textfield slot="toolbar" size="small" prefix-icon="search" placeholder="Search teams" field-aria-label="Search teams"></lof-textfield>
|
|
10
|
+
</lof-table>
|
|
11
|
+
<script>
|
|
12
|
+
const t = document.getElementById('teams');
|
|
13
|
+
t.columns = [
|
|
14
|
+
{ key: 'team', label: 'Team', sortable: true, subKey: 'desc', width: '40%' },
|
|
15
|
+
{ key: 'rating', label: 'Rating', sortable: true,
|
|
16
|
+
render: (row) => Object.assign(document.createElement('lof-rating'), { value: row.rating, readonly: true }) },
|
|
17
|
+
{ key: 'modified', label: 'Last modified', sortable: true },
|
|
18
|
+
{ key: 'members', label: 'Members', align: 'end' },
|
|
19
|
+
];
|
|
20
|
+
t.rows = [
|
|
21
|
+
{ id: 1, team: 'Product Management', desc: 'Product development & lifecycle', rating: 5, modified: '21 Oct, 2024', members: 14 },
|
|
22
|
+
{ id: 2, team: 'Marketing Team', desc: 'Campaigns & market analysis', rating: 3.5, modified: '15 Oct, 2024', members: 6 },
|
|
23
|
+
{ id: 3, team: 'HR Department', desc: 'Talent acquisition, employee welfare', rating: 5, modified: '10 Oct, 2024', members: 9 },
|
|
24
|
+
{ id: 4, team: 'Sales Division', desc: 'Customer relations, sales strategy', rating: 4, modified: '05 Oct, 2024', members: 2 },
|
|
25
|
+
{ id: 5, team: 'Development Team', desc: 'Software development', rating: 4.5, modified: '01 Oct, 2024', members: 21 },
|
|
26
|
+
{ id: 6, team: 'Design', desc: 'Product and brand design', rating: 4.5, modified: '20 Sep, 2024', members: 7 },
|
|
27
|
+
];
|
|
28
|
+
t.addEventListener('lof-selection-change', (e) => console.log(e.detail.selected));
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<!-- Inside a card, edge to edge, server-side -->
|
|
32
|
+
<lof-card heading="Orders" flush>
|
|
33
|
+
<lof-table id="orders" appearance="plain" server-side page-size="10" total-items="240"></lof-table>
|
|
34
|
+
</lof-card>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<!-- readme-gen:start -->
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### Attributes / Properties
|
|
42
|
+
|
|
43
|
+
| Property | Attribute | Type | Default | Description |
|
|
44
|
+
| --- | --- | --- | --- | --- |
|
|
45
|
+
| `columns` | `columns` | `TableColumn[]` | `[]` | Column definitions: `{ key, label, sortable?, align?, width?, subKey?, render?(row, column), compare?(a, b) }`. `render` may return a string, a DOM node or a Lit template. |
|
|
46
|
+
| `rows` | `rows` | `TableRow[]` | `[]` | Row objects. Each column shows `row[column.key]` (and `row[column.subKey]` under it). |
|
|
47
|
+
| `rowKey` | `row-key` | `string` | `"id"` | Row field that identifies a row (for selection). |
|
|
48
|
+
| `selectable` | `selectable` | `boolean` | `false` | Adds a checkbox column and a select-all box. |
|
|
49
|
+
| `selected` | `selected` | `string[]` | `[]` | Keys (`row[row-key]` as strings) of the selected rows. |
|
|
50
|
+
| `sortKey` | `sort-key` | `string` | `""` | Key of the sorted column (`""` = unsorted). Header clicks cycle ascending → descending → unsorted. |
|
|
51
|
+
| `sortDirection` | `sort-direction` | `"asc" \| "desc" \| ""` | `""` | |
|
|
52
|
+
| `pageSize` | `page-size` | `number` | `0` | Rows per page. `0` shows every row and hides the footer. |
|
|
53
|
+
| `page` | `page` | `number` | `1` | |
|
|
54
|
+
| `pageSizeOptions` | `page-size-options` | `number[]` | `[5, 10, 20, 50]` | |
|
|
55
|
+
| `serverSide` | `server-side` | `boolean` | `false` | The app sorts and pages: `rows` are shown as given, `total-items` drives the footer. |
|
|
56
|
+
| `totalItems` | `total-items` | `number` | `0` | |
|
|
57
|
+
| `appearance` | `appearance` | `"card" \| "plain"` | `"card"` | card (default) \| plain. |
|
|
58
|
+
| `grid` | `grid` | `boolean` | `false` | Column dividers as well as row dividers. |
|
|
59
|
+
| `density` | `density` | `"comfortable" \| "compact"` | `"comfortable"` | comfortable (default) \| compact. |
|
|
60
|
+
| `stickyHeader` | `sticky-header` | `boolean` | `false` | |
|
|
61
|
+
| `loading` | `loading` | `boolean` | `false` | |
|
|
62
|
+
| `heading` | `heading` | `string` | `""` | Card header title. |
|
|
63
|
+
| `emptyText` | `empty-text` | `string` | `"No results"` | Text when there are no rows (the `empty` slot replaces it). |
|
|
64
|
+
| `fieldAriaLabel` | `field-aria-label` | `string` | `""` | Accessible name of the table (default: `heading`). |
|
|
65
|
+
| `pageSizeLabel` | `page-size-label` | `string` | `"Show"` | Footer label before the page-size select. |
|
|
66
|
+
| `pageSizeSuffix` | `page-size-suffix` | `string` | `"per page"` | Footer label after the page-size select. |
|
|
67
|
+
| `rangeTemplate` | `range-template` | `string` | `"{start}-{end} of {total}"` | Footer range text; {start}, {end} and {total} are replaced. |
|
|
68
|
+
|
|
69
|
+
## Events
|
|
70
|
+
|
|
71
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| `lof-page-change` | `CustomEvent<TablePageDetail>` | yes / yes | The page or page size changed. `detail: { page, pageSize }`. |
|
|
74
|
+
| `lof-selection-change` | `CustomEvent<TableSelectionDetail>` | yes / yes | A row or the select-all box changed. `detail.selected` is the new key list. |
|
|
75
|
+
| `lof-sort` | `CustomEvent<TableSortDetail>` | yes / yes | A sortable header was activated. `detail: { key, direction }`. Cancelable: `preventDefault()` keeps the current sort (sort on the server, then set `sort-key` / `sort-direction`). |
|
|
76
|
+
|
|
77
|
+
## Slots
|
|
78
|
+
|
|
79
|
+
| Slot | Description |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `toolbar` | Search, filters or actions on the right of the header row. |
|
|
82
|
+
| `empty` | Content for a table with no rows (default: `empty-text`). |
|
|
83
|
+
|
|
84
|
+
## CSS Parts
|
|
85
|
+
|
|
86
|
+
| Part | Description |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| `page-size` | The page-size `<select>` |
|
|
89
|
+
| `cell` | Each body `<td>` |
|
|
90
|
+
| `base` | The surface |
|
|
91
|
+
| `head` | Header row (title and toolbar) |
|
|
92
|
+
| `title` | Header title |
|
|
93
|
+
| `scroll` | Scrolling wrapper around the table |
|
|
94
|
+
| `table` | The `<table>` |
|
|
95
|
+
| `header-row` | Header `<tr>` |
|
|
96
|
+
| `header-cell` | Each header `<th>` |
|
|
97
|
+
| `row` | Each body `<tr>` |
|
|
98
|
+
| `footer` | The page-size and pager row |
|
|
99
|
+
|
|
100
|
+
<!-- readme-gen:end -->
|
|
101
|
+
|
|
102
|
+
## Accessibility
|
|
103
|
+
|
|
104
|
+
- A native `<table>` with `scope="col"` headers, named by `field-aria-label` or `heading`. Sortable headers are buttons and carry `aria-sort` (ascending, descending or none).
|
|
105
|
+
- Selection boxes are native checkboxes named "Select row <first column>"; the header box is named "Select all rows on this page" and shows mixed when some are selected. Selected rows carry `aria-selected`.
|
|
106
|
+
- The footer is a `nav` named Pagination; the range text is a polite live region, and the current page button has `aria-current="page"`.
|
|
107
|
+
- While `loading` the table is `aria-busy` and shows skeleton rows.
|
|
108
|
+
|
|
109
|
+
## Notes / Edge Cases
|
|
110
|
+
|
|
111
|
+
- Client-side sorting compares numbers numerically, dates by time, and everything else with a locale-aware, numeric collator ("Item 2" before "Item 10"). Give a column `compare` for anything else.
|
|
112
|
+
- Select-all toggles the rows on the current page only; selections on other pages are kept.
|
|
113
|
+
- `grid` adds column dividers (the bordered admin table look); `density="compact"` trims the row padding to 8px.
|
|
114
|
+
- `sticky-header` keeps the header visible inside a height-constrained table (set a height on the `scroll` part).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# lof-textfield
|
|
2
2
|
|
|
3
|
-
`<lof-textfield>` is the single-line and multi-line text input from the Figma "Text Field" component: a labelled control with three chromes (`default` outlined, `underline`, `legend` notched outline), three heights (
|
|
3
|
+
`<lof-textfield>` is the single-line and multi-line text input from the Figma "Text Field" component: a labelled control with three chromes (`default` outlined, `underline`, `legend` notched outline), three heights (28 / 34 / 40px), prefix and suffix blocks (icon, short text or slotted content), error / helper text and full-width or inline layout. Use it for free-text entry — names, emails, passwords, numbers, notes (`multiline`). For picking from a fixed list use `lof-select`; for type-ahead against a list use `lof-autocomplete`; for dates and times use the picker components, which reuse this field's chrome.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -170,7 +170,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
170
170
|
|
|
171
171
|
| Custom property | Default | Description |
|
|
172
172
|
| --- | --- | --- |
|
|
173
|
-
| `--lof-field-label-reserve` | `calc(var(--lof-body-
|
|
173
|
+
| `--lof-field-label-reserve` | `calc(var(--lof-body-field-label-line-height) + var(--lof-spacing-2xs))` | Height held for the label row whenever no label renders above the control — `labelStyle="none"`, and `labelStyle="floating"` where the label sits inside the control — so the control still lines up with labelled siblings in a form row. Defaults to that size's label line-height plus the wrapper gap (24px at `small`, 26px at `medium` and `large`). Set to `0` to collapse the row entirely (toolbars, table cells). |
|
|
174
174
|
| `--lof-textfield-surface` | `var(--lof-bg-neutral)` | Colour of the strip the floating label lays over the control's top border and focus ring so the label appears to sit in a notch. It overshoots the band by 2px on the page side, so it must match the surface the field sits on; defaults to the control's own fill (`--lof-bg-neutral`). Set it on a tinted or elevated surface, otherwise the strip shows as a light dash across the border. |
|
|
175
175
|
|
|
176
176
|
<!-- readme-gen:end -->
|
|
@@ -202,5 +202,5 @@ Focus behaviour: `focus()` on the host focuses the inner input / textarea (the h
|
|
|
202
202
|
- `variant="legend"` + `label-style="none"` drops the `<legend>` entirely so the top border runs continuous; a `fill` prefix is squared off in this variant because it cannot reach the notched top border.
|
|
203
203
|
- `--lof-field-label-reserve` (see Component hooks) keeps a `label-style="none"` field bottom-aligned with labelled siblings; set it to `0` in toolbars or table cells.
|
|
204
204
|
- Inside the prefix block the order is slotted content → icon → text (nearest the input); in the suffix block it is text → icon → slotted content. Clicking a non-interactive part of either block focuses the input.
|
|
205
|
-
- The control height (
|
|
205
|
+
- The control height (28 / 34 / 40px) is explicit so the field lines up with `lof-select` and the date / time / range picker triggers; the textarea keeps the padding model and grows with `rows`.
|
|
206
206
|
- In Figma, the `error` state's border has no focus ring; that matches the code (`box-shadow: none` in error).
|
|
@@ -32,7 +32,7 @@ Time selection field implementing the Figma "Time Picker" component (Lofid DS V1
|
|
|
32
32
|
<lof-time-picker value="09:30" disabled></lof-time-picker>
|
|
33
33
|
<lof-time-picker value="09:30" readonly></lof-time-picker>
|
|
34
34
|
|
|
35
|
-
<!-- Sizes (field
|
|
35
|
+
<!-- Sizes (field 28 / 34 / 40px, panel 220 / 250 / 280px) and layout -->
|
|
36
36
|
<lof-time-picker size="small"></lof-time-picker>
|
|
37
37
|
<lof-time-picker size="medium"></lof-time-picker>
|
|
38
38
|
<lof-time-picker size="large"></lof-time-picker>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# lof-tooltip
|
|
2
2
|
|
|
3
|
-
Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger element and fades in a short inverse-coloured text bubble above, below, left or right of it, in the Figma `single-line` or `multi-line` **Type**, optionally with a pointing tail. Use it for brief supplementary hints on icon buttons and truncated labels. Do not put critical or interactive content in it — it is not reachable on touch, cannot be focused, and disappears on hover-out.
|
|
3
|
+
Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger element and fades in a short inverse-coloured text bubble (body-sm medium, sliding 4px toward its side) above, below, left or right of it — after a 200ms hover delay, or immediately on keyboard focus — in the Figma `single-line` or `multi-line` **Type**, optionally with a pointing tail. Use it for brief supplementary hints on icon buttons and truncated labels. Do not put critical or interactive content in it — it is not reachable on touch, cannot be focused, and disappears on hover-out.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -60,7 +60,7 @@ Hover/focus tooltip implementing the Figma "Tooltip" component: wraps a trigger
|
|
|
60
60
|
| Property | Attribute | Type | Default | Description |
|
|
61
61
|
| --- | --- | --- | --- | --- |
|
|
62
62
|
| `text` | `text` | `string` | `""` | Plain-text content of the bubble. Empty text still renders an (empty) bubble on hover, so always set it. |
|
|
63
|
-
| `position` | `position` | `"above" \| "below" \| "left" \| "right"` | `"above"` | Side of the trigger the bubble appears on, centred and 6px away (
|
|
63
|
+
| `position` | `position` | `"above" \| "below" \| "left" \| "right"` | `"above"` | Side of the trigger the bubble appears on, centred and 6px away (9px when `show-tail` is set, so the tail clears the trigger; override with `--lof-tooltip-offset`): `above`, `below`, `left` or `right`. No collision detection — pick a side with room in the viewport. |
|
|
64
64
|
| `showTail` | `show-tail` | `boolean` | `false` | Renders the triangular tail (`indicator` part) on the bubble's edge facing the trigger. |
|
|
65
65
|
| `type` | `type` | `"single-line" \| "multi-line"` | `"single-line"` | Figma "Type": `single-line` keeps the text on one line and sizes to content; `multi-line` wraps inside a 200px max-width bubble. Reflected. |
|
|
66
66
|
| `tone` | `tone` | `"inverse" \| "neutral"` | `"inverse"` | Bubble appearance: `inverse` (default) is the original inverse-surface bubble, unchanged; `neutral` is a light surface — `--lof-bg-neutral` with `--lof-text-default` and a 1px `--lof-border-default`, tail included. Figma has no such variant; this is a deliberate addition. Reflected. |
|
|
@@ -219,5 +219,5 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
219
219
|
- **Cancel** aborts the `AbortSignal` handed to `uploader` and returns in-flight rows to `ready`; it keeps the list. `reset()` aborts and clears everything.
|
|
220
220
|
- **`lof-state` is de-duplicated** — it only fires when the derived snapshot (`phase`, counts, `canUpload`, `primaryLabel`) changes, so progress ticks do not spam `<lof-upload-actions>`; it also fires once right after connecting.
|
|
221
221
|
- **Pairing.** `<lof-upload-actions>` resolves its target by `for` (an id in the same DOM root), else the first `<lof-upload>` in its parent element, else the first in its root. It listens for `lof-state` on its root node, so both elements must share the same document or shadow root — slotting the actions into `<lof-modal>`'s footer is fine because slotting does not change the root.
|
|
222
|
-
- **Figma deviations.** The Browse button (not the whole dropzone) is the focusable control; the drag-over frame (solid
|
|
222
|
+
- **Figma deviations.** The Browse button (not the whole dropzone) is the focusable control; the drag-over frame (solid 2px green border + 8% brand tint) and the disabled state (60% opacity) have no Figma frame; three colours were moved to the correct token layer for contrast. Details in `UPLOAD-DESIGN-CHANGES.md`.
|
|
223
223
|
- The Browse hover background reads `--lof-upload-browse-hover-bg` and falls back to `--lof-action-neutral-outline-hover`, then `--lof-bg-surface-elevated`.
|