@tangible/ui 0.2.32 → 0.2.34
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/components/Modal/Modal.js +6 -4
- package/components/Sidebar/Sidebar.js +14 -2
- package/components/Sidebar/types.d.ts +17 -0
- package/components/StepIndicator/StepIndicator.js +13 -28
- package/components/StepIndicator/label.d.ts +13 -0
- package/components/StepIndicator/label.js +29 -0
- package/components/StepIndicator/types.d.ts +13 -0
- package/components/StepIndicator/types.js +1 -0
- package/components/StepList/StepList.js +38 -11
- package/components/StepList/index.d.ts +2 -1
- package/components/StepList/index.js +1 -0
- package/components/StepList/types.d.ts +33 -1
- package/components/StepList/types.js +11 -1
- package/components/index.d.ts +4 -4
- package/components/index.js +2 -2
- package/figma-tokens.json +1 -1
- package/icons/cred.svg +14 -0
- package/icons/icons.svg +10 -10
- package/icons/lms.svg +46 -0
- package/icons/membersync.svg +24 -0
- package/icons/player.svg +26 -0
- package/icons/reaction.svg +38 -0
- package/icons/sprite-registry.d.ts +2 -0
- package/icons/sprite-registry.js +268 -0
- package/icons/sprite-version.d.ts +6 -0
- package/icons/sprite-version.js +1 -0
- package/icons/sprite.d.ts +53 -0
- package/icons/sprite.js +196 -0
- package/icons/sprite.php +85 -0
- package/icons/system.svg +120 -0
- package/package.json +9 -1
- package/skills/building-with-tui/SKILL.md +54 -5
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +53 -7
- package/styles/all.expanded.unlayered.css +53 -7
- package/styles/all.unlayered.css +1 -1
- package/styles/components/step-indicator.scss +74 -11
- package/styles/components/step-list.scss +27 -1
- package/tui-manifest.json +23 -3
- package/utils/focus-trap.d.ts +1 -1
- package/utils/focus-trap.js +1 -1
- package/utils/sprite-icon.d.ts +15 -0
- package/utils/sprite-icon.js +66 -0
- package/utils/tabbable.d.ts +16 -0
- package/utils/tabbable.js +32 -3
- package/vanilla/modal.min.js +1 -1
|
@@ -82,8 +82,8 @@ their full `--tui-<component>-*` API — the only shipped listing, since consume
|
|
|
82
82
|
|
|
83
83
|
- **Nearly every `*Labels` type** (the i18n prop): `ButtonLabels`, `FieldLabels`,
|
|
84
84
|
`ComboboxLabels`, `MultiSelectLabels`, `RatingLabels`, `DataTableLabels`, `AvatarLabels`,
|
|
85
|
-
`
|
|
86
|
-
|
|
85
|
+
`CalendarLabels`, … (exceptions: `PagerLabels`, plus `StepIndicatorLabels` and `StepListLabels`
|
|
86
|
+
with their defaults.)
|
|
87
87
|
- **Most union / variant aliases**: `AccordionVariant`, `ContentIndicatorSize`,
|
|
88
88
|
`ComboboxFilterMode`, `IconButton`'s `Shape`/`Variant`, `NoticeHandle`, `ProgressSegment`,
|
|
89
89
|
`OptionValue`, `TooltipTheme`, … (`SidebarFooterProps` was on this list until 0.2.18, which
|
|
@@ -190,13 +190,61 @@ plugins: [new webpack.NormalModuleReplacementPlugin(/icons\/registry\.js$/, path
|
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
TUI's own icons (chevrons, close, check, …) are imported directly from 0.2.30, so
|
|
193
|
-
they never need listing.
|
|
193
|
+
they never need listing. To find the names your code passes, search for every `<set>/<name>` string
|
|
194
|
+
literal, single- or double-quoted, not just `icon=`: Button takes `leftIconName`/`rightIconName`, and names also arrive
|
|
195
|
+
through `icon` fields in data (NavMenu items, Tabs, StepList), e.g.
|
|
196
|
+
`rg -o "['\"](system|lms|cred|reaction|player|membersync)/[a-z0-9-]+" src | sort -u`. A name you use but forget to list renders an empty `<span data-tui-icon-missing="…">` and a
|
|
194
197
|
dev-mode warning. Or skip names altogether: every icon prop also takes the component itself,
|
|
195
198
|
`<IconButton icon={Trash} label="Delete" />`, which never touches the registry.
|
|
196
199
|
Import each icon from the set that owns its file: the `lms/info`, `lms/help-circle-fill` and
|
|
197
200
|
`lms/question-mark` aliases live in `system`. The alias is verified on Vite production builds; the
|
|
198
201
|
webpack line is the equivalent, untested.
|
|
199
202
|
|
|
203
|
+
**Or deliver icons as a sprite (opt-in through 0.2.x; it becomes the default at 1.0).** Alias the
|
|
204
|
+
registry to `@tangible/ui/icons/sprite-registry.js` instead, the same way. Every name then renders
|
|
205
|
+
`<svg><use href="#tui-system-check"/></svg>`, and the icon shapes leave your JavaScript. The page has
|
|
206
|
+
to contain the symbols, one set at a time (`system` is 10 kB gzipped; the others 2–5 kB each).
|
|
207
|
+
|
|
208
|
+
In WordPress, print them with the page: no fetch, no flash of empty icons. `node_modules` doesn't
|
|
209
|
+
ship in a plugin zip, so copy `sprite.php` and the `<set>.svg` files from
|
|
210
|
+
`node_modules/@tangible/ui/icons/` into your build output first:
|
|
211
|
+
|
|
212
|
+
```php
|
|
213
|
+
require_once __DIR__ . '/assets/tui-icons/sprite.php';
|
|
214
|
+
add_action('admin_footer', fn () => tangible_ui_print_icon_sprite(['system']));
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Elsewhere, insert them from JavaScript before rendering icons. Don't `await` it: icons fill in when
|
|
218
|
+
their set lands, and it never rejects (it resolves with `{ loaded, failed }`), so a CDN blip can't
|
|
219
|
+
stop the app from rendering:
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
import { injectIconSprite } from '@tangible/ui/icons/sprite';
|
|
223
|
+
// Vite: pass the files as ?url imports, since the dev server can't serve them from a pre-bundled dep
|
|
224
|
+
import systemUrl from '@tangible/ui/icons/system.svg?url';
|
|
225
|
+
void injectIconSprite({ sets: ['system'], spriteUrl: () => systemUrl });
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
- Sets already in the page are skipped, so calling it from every entry point is safe. Without
|
|
229
|
+
`spriteUrl` it loads the file next to the module, which `vite build` emits as an asset; that
|
|
230
|
+
default fails in Vite's dev server, and webpack and esbuild are untested, so pass `spriteUrl`.
|
|
231
|
+
- It fetches the file rather than referencing it, so it works from a CDN and from a single-file
|
|
232
|
+
bundle's `data:` URL, where a plain `<use href="system.svg#…">` doesn't (`<use>` takes only
|
|
233
|
+
same-origin files, and Chrome blocks `data:` URLs there). Only SVG shapes are kept from the
|
|
234
|
+
response, but serve the files yourself or from a host you trust.
|
|
235
|
+
- An iframe is its own document: for the WordPress block editor canvas, call it with
|
|
236
|
+
`document: iframe.contentDocument`. A sprite printed in `admin_footer` doesn't reach the canvas.
|
|
237
|
+
- Several plugins can bundle different TUI versions. Both paths use the newest copy's symbols, so a
|
|
238
|
+
newer plugin's icons aren't missing from an older plugin's sprite.
|
|
239
|
+
- Add `<link rel="preload" href="…/system.svg" as="fetch" crossorigin>` to start the fetch with the
|
|
240
|
+
HTML.
|
|
241
|
+
- A name whose symbol isn't in the page renders empty. Under Vite in development its `<svg>` gets
|
|
242
|
+
`data-tui-icon-missing="<name>"` and the console says which set to load (the check reads
|
|
243
|
+
`import.meta.env.DEV`, so it doesn't run under webpack or esbuild).
|
|
244
|
+
- The alias matches TUI's own `…/icons/registry.js` imports. Code that imports the bare
|
|
245
|
+
`@tangible/ui/icons` specifier itself needs that specifier aliased too.
|
|
246
|
+
- Icon components you pass directly (`icon={Trash}`) and TUI's own icons stay inline in either mode.
|
|
247
|
+
|
|
200
248
|
**6. A standalone app that owns the whole page can add the app base sheet.** For Vite/React apps,
|
|
201
249
|
not plugin frontends:
|
|
202
250
|
|
|
@@ -313,7 +361,8 @@ Oct 24 2026.
|
|
|
313
361
|
| SearchSelect | `search`, `clearSearch`, `noResults` |
|
|
314
362
|
| SecretInput | `reveal`, `hide`, `shown`, `hidden`, `valueSet`, `valueSetDescription`, `locked` |
|
|
315
363
|
| Sidebar.Toggle | `collapse`, `expand` |
|
|
316
|
-
| StepIndicator | `notStarted`, `inProgress`, `complete`, `locked`, `status`, `statusWithValue` |
|
|
364
|
+
| StepIndicator | `notStarted`, `inProgress`, `complete`, `locked`, `status`, `statusWithValue`, `withAttention` |
|
|
365
|
+
| StepList | the same minus `statusWithValue`, plus `current` (status-only lists); `status` defaults to the bare word, since the row's label names the step |
|
|
317
366
|
|
|
318
367
|
Some keys are functions (counts, page status, value texts); the type says which.
|
|
319
368
|
|
|
@@ -561,7 +610,7 @@ synthesise a second toggle. For a second control that toggles the same item (an
|
|
|
561
610
|
## Component names, and what isn't there
|
|
562
611
|
|
|
563
612
|
46 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
|
|
564
|
-
**Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer
|
|
613
|
+
**Table → `DataTable`**, **Pagination → `Pager`**, **Drawer / side sheet / off-canvas panel → `Sidebar`** (`<Sidebar drawer open onClose position="left">`: a modal dialog with a focus trap, Escape and backdrop dismissal; `initialFocusSelector` or `data-autofocus` picks where focus lands on open; don't dock a `Modal` to an edge), **Nav menu / sidebar links / top nav bar → `NavMenu`** (inside `Sidebar.Nav` or your `<nav>`; `asChild` for router links, `current` for `aria-current`; `orientation="horizontal"` for a bar whose items open flyouts, `flyoutTrigger="hover"` to also open on mouse hover; `suffix` for a row badge/count — a `Chip`, with visually hidden context for bare numbers, never interactive; row states restyle via `--tui-nav-menu-item-*`, per level via `--tui-nav-menu-{sub,bar,flyout}-item-*` — set `bar-item-*` for a dark header so flyout rows keep the panel's colours; don't hand-roll menus with `role="menu"`),
|
|
565
614
|
**Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
|
|
566
615
|
**ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
|
|
567
616
|
`aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
|