@apliteni/apliteni-ui 0.142.1 → 0.142.3

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 (41) hide show
  1. package/README.md +24 -36
  2. package/guidelines/state-set.md +4 -4
  3. package/package.json +3 -3
  4. package/react/dist/index.css +2 -2
  5. package/react/dist/index.js +12 -5
  6. package/src/index.d.ts +13 -96
  7. package/src/index.js +17 -30
  8. package/src/styles/command-palette.css +9 -5
  9. package/src/styles/drawer.css +8 -0
  10. package/src/styles/dropdown.css +30 -8
  11. package/src/styles/feedback.css +1 -1
  12. package/src/styles/filter-bar.css +5 -2
  13. package/src/styles/input.css +14 -15
  14. package/src/styles/layout.css +5 -2
  15. package/src/styles/table.css +28 -2
  16. package/src/styles/topbar.css +8 -6
  17. package/src/components/account-nav.js +0 -37
  18. package/src/components/avatar.js +0 -53
  19. package/src/components/back.js +0 -57
  20. package/src/components/button-busy.js +0 -69
  21. package/src/components/command-palette.js +0 -471
  22. package/src/components/confirm.js +0 -131
  23. package/src/components/drawer.js +0 -169
  24. package/src/components/dropdown.js +0 -1055
  25. package/src/components/feedback.js +0 -171
  26. package/src/components/filter-bar.js +0 -86
  27. package/src/components/footer.js +0 -102
  28. package/src/components/index.js +0 -352
  29. package/src/components/loading.js +0 -127
  30. package/src/components/nav.js +0 -220
  31. package/src/components/overlay.js +0 -263
  32. package/src/components/pagination.js +0 -323
  33. package/src/components/segmented.js +0 -33
  34. package/src/components/shell.js +0 -511
  35. package/src/components/stat.js +0 -82
  36. package/src/components/success.js +0 -131
  37. package/src/components/table-values.js +0 -32
  38. package/src/components/tabs.js +0 -82
  39. package/src/components/toasts.js +0 -118
  40. package/src/components/tooltip.js +0 -347
  41. package/src/components/topbar.js +0 -270
package/README.md CHANGED
@@ -4,14 +4,15 @@
4
4
  [![license: MIT](https://img.shields.io/npm/l/@apliteni/apliteni-ui?color=3b9dff)](./LICENSE)
5
5
  [![live: ui.apli.tech](https://img.shields.io/badge/live-ui.apli.tech-9b5dff)](https://ui.apli.tech)
6
6
 
7
- The Apliteni design system and UI kit provides shared design tokens, components, themes and
8
- UI rules for the strategy deck, the text portal, `/account` and future product surfaces.
7
+ The Apliteni design system and UI kit provides shared design tokens, React components,
8
+ themes and UI rules for the strategy deck, the text portal, `/account` and future product
9
+ surfaces.
9
10
 
10
- One package carries two layers. **HTML + CSS** includes token CSS, component CSS and
11
- HTML-string factories. Use this layer for server-rendered pages that do not use a component
12
- framework. **React components** support surfaces with client-side state, such as tables,
13
- filters, forms and modals. Both layers use the same `.ui-*` classes and tokens, so a page
14
- can use both. Choose React when the surface needs state.
11
+ The kit ships tokens, component CSS and React components together. Server-rendered pages
12
+ that do not use a component framework can still take the CSS, tokens and the inline
13
+ strings, or write the kit's `.ui-*` classes by hand. The helpers the root entry publishes —
14
+ `icon`, `prism`, `sun`, `moon`, `brand`, `esc`, `safeUrl` and the shared logic — serve
15
+ both.
15
16
 
16
17
  Every component is in Storybook at **[ui.apli.tech](https://ui.apli.tech)**.
17
18
 
@@ -27,8 +28,7 @@ npm install @apliteni/apliteni-ui react react-dom
27
28
  Install React and React DOM yourself, using version 18 or newer. The kit does not declare
28
29
  either package as a regular or peer dependency. npm therefore does not install them or warn
29
30
  when they are missing. If they are missing, importing `@apliteni/apliteni-ui/react` fails
30
- at build time or runtime with a module-not-found error. A plain HTML consumer installs only
31
- the kit and is unaffected because React is not added to its dependency tree.
31
+ at build time or runtime with a module-not-found error.
32
32
 
33
33
  The React components are a subpath of this package, not a separate package. You get one
34
34
  install, one version and one version pin.
@@ -36,7 +36,7 @@ install, one version and one version pin.
36
36
  | Import | What it is |
37
37
  | --- | --- |
38
38
  | `@apliteni/apliteni-ui/css` | Tokens and every component stylesheet. Import once at the app root. |
39
- | `@apliteni/apliteni-ui` | The HTML-string factories: `button()`, `card()`, `topbar()`, `appShell()` and the rest. |
39
+ | `@apliteni/apliteni-ui` | The helpers and shared logic: `icon`, `prism`, `sun`, `moon`, `brand`, `esc`, `safeUrl`, motion and the dropdown, chart, pagination and filter helpers. |
40
40
  | `@apliteni/apliteni-ui/react` | The React components, TypeScript types included. |
41
41
  | `@apliteni/apliteni-ui/react/css` | Their shell styles. |
42
42
  | `@apliteni/apliteni-ui/inline` | The same CSS as strings, for a server that inlines it. |
@@ -44,24 +44,16 @@ install, one version and one version pin.
44
44
 
45
45
  ## Use it
46
46
 
47
- ```js
48
- import '@apliteni/apliteni-ui/css';
49
- import { topbar, card, button, wireTopbar } from '@apliteni/apliteni-ui';
50
-
51
- el.innerHTML = topbar({ word: 'Strategy', account: { name, email } })
52
- + card({ title: 'Appearance', body: button({ label: 'Save', variant: 'primary' }) });
53
- wireTopbar(document); // theme toggle, menus, segmented controls, copy buttons
54
- ```
55
-
56
47
  ```tsx
57
48
  import '@apliteni/apliteni-ui/css';
58
49
  import '@apliteni/apliteni-ui/react/css';
59
- import { DataTable, Modal } from '@apliteni/apliteni-ui/react';
50
+ import { AppShell, DataTable, Modal } from '@apliteni/apliteni-ui/react';
51
+ import { icon } from '@apliteni/apliteni-ui';
60
52
  ```
61
53
 
62
- The `appShell()` factory provides the complete product layout: the sticky rail, the page body
63
- and a topbar over it when you ask for one, so no product rebuilds it. The
64
- [component catalog](docs/components.md#component-catalog) lists this factory and every other one.
54
+ The `AppShell` component provides the complete product layout: the rail, the page body and
55
+ a topbar over it when you ask for one, so no product rebuilds it. The
56
+ [component catalog](docs/components.md#component-catalog) lists it and every other component.
65
57
  Account and personal settings belong in a modal over the product rather than on a page of
66
58
  their own — see [Guidelines / Account and settings](guidelines/account-and-settings.md).
67
59
 
@@ -102,14 +94,10 @@ rule. If the host wants to follow the operating system preference, its JavaScrip
102
94
  choose the theme and add the attribute. See
103
95
  [an absent attribute means dark](docs/components.md#an-absent-attribute-means-dark).
104
96
 
105
- You can change the settings at runtime with `applyTheme('light')` and
106
- `applyAccent('phoenix')`. These functions save the choices to `localStorage`. You can also
107
- use `accentPicker()`, which `wireTopbar()` connects.
108
-
109
97
  ## The rules
110
98
 
111
99
  The **Guidelines** explain what a page may contain, which component to choose, which states
112
- it must support, and how to handle colour and wording. Both kit layers follow these rules.
100
+ it must support, and how to handle colour and wording. The kit follows these rules.
113
101
  The guidelines ship as Markdown in the package and are also available as a Storybook
114
102
  section.
115
103
 
@@ -123,7 +111,7 @@ section.
123
111
  | --- | --- |
124
112
  | [foundations.md](docs/foundations.md) | The tokens and the floors: widths, breakpoints, spacing, type, colour, elevation, the focus ring, the tap floor. |
125
113
  | [components.md](docs/components.md) | The package: what to import, theming, the component catalog, and what each component guarantees. |
126
- | [react/README.md](react/README.md) | The React components, their props, and the Storybook on port 6007. |
114
+ | [react/README.md](react/README.md) | The React components and their props. |
127
115
  | [contributing.md](docs/contributing.md) | Working on the kit: the repository's layout, Storybook, the guidelines collection, the site, the changelog and releases. |
128
116
 
129
117
  ## Contribute
@@ -132,7 +120,7 @@ Use Node 20 or newer. Install [jq](https://jqlang.github.io/jq/), then run:
132
120
 
133
121
  ```bash
134
122
  npm ci
135
- npm run storybook # the kit; add -w react for the React workspace
123
+ npm run storybook
136
124
  npm test && npm test -w react && npm run build-storybook && node site/build.mjs
137
125
  ```
138
126
 
@@ -142,14 +130,14 @@ Add a general, composable kit component only when all three conditions are true:
142
130
  names at least two products that use it or have requested it; existing components cannot
143
131
  provide it without copying markup or logic; and it contains no domain-specific data or
144
132
  rules. If any condition is missing, compose the UI from existing components and add a
145
- Storybook showcase. Preserve the vanilla kit's existing look.
133
+ Storybook showcase.
146
134
 
147
135
  To add a component, put its token-based CSS in `src/styles/`. Include that CSS in
148
- `src/index.css` and in both the `styles` map and `cssText` in `src/inline.js`. Put the HTML
149
- factory in `src/components/` and export it from `src/index.js`. Add a playground and state
150
- examples in `stories/components/`. Put React components in `react/src/`; each one needs a
151
- test and a story that use the shared classes and tokens. The
152
- [guidelines](guidelines/overview.md) define the design rules.
136
+ `src/index.css` and in both the `styles` map and `cssText` in `src/inline.js`. Put the
137
+ React component in `react/src/`; each one needs a test and a story that use the shared
138
+ classes and tokens. Shared logic the React components take from the root entry lives in
139
+ `src/logic/` and is exported from `src/index.js`. The [guidelines](guidelines/overview.md)
140
+ define the design rules.
153
141
 
154
142
  Open an issue, create a branch from `main`, and link the issue in your PR. If you change a
155
143
  published file, including this README, bump the version in `package.json` and
@@ -4,15 +4,15 @@
4
4
 
5
5
  <!-- rule: focus-visible -->
6
6
 
7
- **Rule:** Give every focusable control the same `--ring`, and show it only on `:focus-visible`.
7
+ **Rule:** Show one ring when focus is visible, and make a focused field's border transparent.
8
8
 
9
9
  **Why:** One solid band keeps focus consistent while the browser decides when to show it.
10
10
 
11
- **Do:** Apply `--ring`, with `--ring-offset`, to both the button and input on keyboard focus.
11
+ **Do:** Give buttons and fields the same ring, with one clear gap around each control.
12
12
 
13
- **Don't:** Give the input a separate muted outline while the button uses `--ring`.
13
+ **Don't:** Leave a field border visible inside its focus ring.
14
14
 
15
- **Except:** A box whose own edges are a surface's — a scroll region, or a box filling a table cell — takes `--ring-scroll` with `--ring-scroll-offset`. A box that is the outermost surface, such as a panel or card, keeps `--ring`. Text-entry controls may match `:focus-visible` on mouse focus. Both bands are declared once at the root and recomposed nowhere, because an outline leaves its offset unpainted. Adjust width and colour there.
15
+ **Except:** A scroll region or a box that fills a table cell uses `--ring-scroll` with its offset. A panel or card uses `--ring`. A text field can match `:focus-visible` on mouse focus. Both rings are defined once at the root because an outline leaves its offset unpainted. Adjust width and colour there.
16
16
 
17
17
  ## Busy controls
18
18
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.142.1",
3
+ "version": "0.142.3",
4
4
 
5
5
  "workspaces": [
6
6
  "react"
7
7
  ],
8
- "description": "Apliteni shared design system & UI kit — tokens, components and the deck theme, framework-agnostic (HTML + CSS).",
8
+ "description": "Apliteni shared design system & UI kit — tokens, React components and the deck theme.",
9
9
  "type": "module",
10
10
  "license": "MIT",
11
11
  "author": "Apliteni",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@storybook/addon-a11y": "^10.5.5",
71
- "@storybook/html-vite": "^10.5.5",
71
+ "@storybook/react-vite": "^10.6.1",
72
72
  "axe-core": "^4.12.1",
73
73
  "jsdom": "^30.0.1",
74
74
  "storybook": "^10.5.5",
@@ -246,9 +246,9 @@
246
246
  .rx-modal__title {
247
247
  margin: 0;
248
248
  font-family: var(--font-sans);
249
- font-weight: var(--weight-normal);
249
+ font-weight: var(--weight-semibold);
250
250
  font-size: var(--text-base);
251
- color: var(--text);
251
+ color: var(--strong);
252
252
  }
253
253
  .rx-modal__body {
254
254
  padding: var(--space-4);
@@ -3138,7 +3138,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
3138
3138
  }
3139
3139
  }
3140
3140
  const prior = focused.current;
3141
- if (!prior || prior.id === null && filters.length > 0 || filters.some((f) => f.id === prior.id)) return;
3141
+ if (!prior || prior.id === null && filters.some((f) => !filterChipUnset(f))) return;
3142
+ const kept = filters.some((f) => f.id === prior.id);
3143
+ if (kept) {
3144
+ const held = chips.find((c) => c.dataset.filterId === prior.id && !c.disabled);
3145
+ const lost = prior.remove && !held?.querySelector("[data-filter-remove]") && !blocked && held && bar.current && bar.current.ownerDocument.activeElement === bar.current.ownerDocument.body && held.querySelector("[data-dropdown-trigger]");
3146
+ if (lost) lost.focus();
3147
+ return;
3148
+ }
3142
3149
  const next = chips.slice(prior.index).find((chip) => !chip.disabled) || chips.slice(0, prior.index).reverse().find((chip) => !chip.disabled);
3143
3150
  const target = !blocked && next?.querySelector("[data-dropdown-trigger]");
3144
3151
  focused.current = null;
@@ -3165,8 +3172,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
3165
3172
  className: "ui-filter-bar__chip",
3166
3173
  "data-filter-id": filter.id,
3167
3174
  disabled: filter.disabled,
3168
- onFocus: () => {
3169
- focused.current = { id: filter.id, index };
3175
+ onFocus: (event) => {
3176
+ focused.current = { id: filter.id, index, remove: Boolean(event.target.closest("[data-filter-remove]")) };
3170
3177
  },
3171
3178
  children: [
3172
3179
  /* @__PURE__ */ jsx26("legend", { className: "ui-filter-bar__legend", children: filter.label }),
@@ -3184,7 +3191,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
3184
3191
  }
3185
3192
  }
3186
3193
  ),
3187
- /* @__PURE__ */ jsx26(
3194
+ !filterChipUnset(filter) && /* @__PURE__ */ jsx26(
3188
3195
  "button",
3189
3196
  {
3190
3197
  type: "button",
@@ -3224,7 +3231,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
3224
3231
  }
3225
3232
  }
3226
3233
  ) }),
3227
- filters.length > 0 && /* @__PURE__ */ jsx26("span", { "data-filter-clear": "", onFocus: () => {
3234
+ filters.some((filter) => !filterChipUnset(filter)) && /* @__PURE__ */ jsx26("span", { "data-filter-clear": "", onFocus: () => {
3228
3235
  focused.current = { id: null, index: 0 };
3229
3236
  }, children: /* @__PURE__ */ jsx26(Button, { size: "sm", variant: clearVariant, onClick: () => {
3230
3237
  if (!blocked) onClear();
package/src/index.d.ts CHANGED
@@ -1,20 +1,13 @@
1
1
  /** Watch tab content and width without changing the current route. Call the result on removal. */
2
2
  export declare function observeNavFit(nav: HTMLElement): () => void;
3
3
  export declare function esc(value: unknown): string;
4
- /** The URL boundary every factory and React component sends a destination through. */
4
+ /** The URL boundary every component sends a destination through. */
5
5
  export declare function safeUrl(value: unknown, fallback?: string): string;
6
6
  /** Scroll a tab row so its `aria-current` link is inside the viewport. */
7
7
  export declare function revealCurrentNav(nav: HTMLElement): void;
8
8
  /** Scroll a tab row so the link a focus event landed on clears the row's edge. */
9
9
  export declare function revealFocusedNav(nav: HTMLElement, target: EventTarget | null): void;
10
- export declare function field(opts?: Record<string, unknown>): string;
11
- export declare function input(opts?: Record<string, unknown>): string;
12
- export declare function textarea(opts?: Record<string, unknown>): string;
13
- export declare function select(opts?: Record<string, unknown>): string;
14
- export declare function numericValue(opts?: Record<string, unknown>): string;
15
- export declare function deltaValue(opts?: Record<string, unknown>): string;
16
- export declare function filterBar(opts?: Record<string, unknown>): string;
17
- export declare function initFilterBar(host: Element, opts?: Record<string, unknown>): { update: (opts: Record<string, unknown>) => void; destroy: () => void };
10
+
18
11
  export declare function filterChipText(filter?: { label?: string; value?: string }): string;
19
12
  export declare function filterChipName(filter?: { label?: string; value?: string }): string;
20
13
  export declare function filterChipUnset(filter?: { value?: string }): boolean;
@@ -26,27 +19,19 @@ export declare function focusNextStop(host: Element | null | undefined): HTMLEle
26
19
  * whose value is in no row marks nothing rather than leaving a `selected` the caller
27
20
  * set standing. The caller's array and objects are not written to. */
28
21
  export declare function filterChipItems<T>(filter?: { value?: string; items?: T[] }): T[];
22
+
29
23
  export declare function segmentedNextIndex(key: string, index: number, length: number): number | null;
24
+
30
25
  export declare function icon(name: string, className?: string): string;
31
- export declare function snippet(opts?: Record<string, unknown>): string;
32
- export declare function button(opts?: Record<string, unknown>): string;
33
- export declare function badge(label: string, variant?: string): string;
26
+
34
27
  export declare const AVATAR_HUES: 8;
35
28
  /** Which of the eight person hues a key gets: FNV-1a 32 bit over its UTF-8 bytes, modulo 8. */
36
29
  export declare function avatarHue(key: unknown): number;
37
30
  /** The first letter of the first word and of the last word, upper-cased; '' for no name. */
38
31
  export declare function avatarInitials(name: unknown): string;
39
- export declare function avatar(opts?: {
40
- key?: string | number; name?: string | null; initials?: string; src?: string; size?: 24 | 32; empty?: boolean;
41
- }): string;
32
+
42
33
  export declare const calloutIcons: Record<'neutral' | 'info' | 'success' | 'warn' | 'danger', string>;
43
- export declare function callout(opts?: Record<string, unknown>): string;
44
- export declare function card(opts?: Record<string, unknown>): string;
45
- export declare function pagination(opts?: Record<string, unknown>): string;
46
- export declare function drawerSection(opts?: Record<string, unknown>): string;
47
- export declare function drawer(opts?: Record<string, unknown>): string;
48
- export declare function dropdown(opts?: Record<string, unknown>): string;
49
- export declare function wireDropdown(root?: Document | Element): void;
34
+
50
35
  /** The kit's own match, asked rather than re-implemented by <Dropdown>. */
51
36
  export declare function dropdownMatch(label: unknown, query: unknown): boolean;
52
37
  export declare function dropdownFiltering(query: unknown): boolean;
@@ -127,13 +112,12 @@ export declare function dropdownRest(
127
112
  open: boolean,
128
113
  wait?: number,
129
114
  ): () => void;
130
- export declare function backLink(opts?: Record<string, unknown>): string;
131
- export declare function statBand(opts?: Record<string, unknown>): string;
132
- export declare function commandPalette(opts?: Record<string, unknown>): string;
115
+
133
116
  export declare function rankGroups<G>(groups: readonly G[], query: string): G[];
134
117
  export declare function rankCommands<I>(items: readonly I[], query: string): I[];
135
118
  export declare function scoreCommand(item: Record<string, unknown>, query: string): number;
136
119
  export declare function paletteHotkey(platform?: string): string;
120
+
137
121
  export declare const PAGE_SIZES: number[];
138
122
  export declare const DEFAULT_PAGE_SIZE: number;
139
123
  export type NumericValueOptions = { value?: string | number | null; unit?: string; missing?: string };
@@ -159,6 +143,7 @@ export declare function pointTarget(
159
143
  point: { x: number; y: number }, limits: PointTargetLimits,
160
144
  ): ChartTarget;
161
145
  export declare const SCORE: Record<'exact' | 'prefix' | 'wordStart' | 'contains' | 'keyword' | 'description' | 'subsequence', number>;
146
+
162
147
  export declare const iconNames: string[];
163
148
  export declare const iconCategories: { name: string; names: string[] }[];
164
149
  export declare const iconOnlyAllowed: Record<string, string>;
@@ -173,89 +158,21 @@ export declare function illo(name: string): string;
173
158
  export * from './motion.js';
174
159
  export declare const illoNames: string[];
175
160
 
176
- // The custom properties one accent swatch button carries. ACCENTS is declared
177
- // with the topbar wiring that re-exports it.
161
+ /** The custom properties one accent swatch button carries. */
178
162
  export declare function accentSwatchStyle(accent: string): Record<string, string>;
179
163
 
180
- // Vanilla factories accept their existing option bags and return HTML.
181
- export declare function accentPicker(opts?: Record<string, unknown>): string;
182
- export declare function accountMenu(opts?: Record<string, unknown>): string;
183
- export declare function appShell(opts?: Record<string, unknown>): string;
184
- export declare function breadcrumbs(opts?: Record<string, unknown>): string;
185
- export declare function busyRegion(opts?: Record<string, unknown>): string;
186
- export declare function checkbox(opts?: Record<string, unknown>): string;
187
- export declare function confirm(opts?: Record<string, unknown>): string;
188
- export declare function deniedState(opts?: Record<string, unknown>): string;
189
- export declare function emptyState(opts?: Record<string, unknown>): string;
190
- export declare function feedbackWidget(opts?: Record<string, unknown>): string;
191
- export declare function footer(opts?: Record<string, unknown>): string;
192
- export declare function nav(opts?: Record<string, unknown>): string;
193
- export declare function navTabs(opts?: Record<string, unknown>): string;
194
- export declare function rowIdentity(opts?: Record<string, unknown>): string;
195
- export declare function segmented(opts?: Record<string, unknown>): string;
196
- export declare function sidebarNav(opts?: Record<string, unknown>): string;
197
- export declare function skeleton(opts?: Record<string, unknown>): string;
198
- export declare function skeletonTable(opts?: Record<string, unknown>): string;
199
- export declare function success(opts?: Record<string, unknown>): string;
200
- export declare function successPanel(opts?: Record<string, unknown>): string;
201
- export declare function switchToggle(opts?: Record<string, unknown>): string;
202
- export declare function tabs(opts?: Record<string, unknown>): string;
203
- export declare function toast(opts?: Record<string, unknown>): string;
204
- export declare function tooltip(opts?: Record<string, unknown>): string;
205
- export declare function topbar(opts?: Record<string, unknown>): string;
206
- export declare function commandPaletteList(groups?: readonly Record<string, unknown>[], opts?: { uid?: string; from?: number }): string;
207
- export declare function deckTextSwitch(active?: string): string;
208
- export declare function hlShell(raw: string): string;
209
164
  /** Token class from styles/code.css, or null for the text between tokens. */
210
165
  export type CodeTokenClass = 'c' | 'f' | 'k' | 's' | 'u';
211
166
  export type CodeLanguage = 'shell' | 'json' | 'ts';
212
167
  export declare const codeLanguages: readonly CodeLanguage[];
213
168
  export declare function codeTokens(raw: string, lang?: CodeLanguage): { cls: CodeTokenClass | null; text: string }[];
214
169
  export declare function hlCode(raw: string, lang?: CodeLanguage): string;
215
- export declare function pill(label: string, variant?: string): string;
216
- export declare function statusDot(live?: boolean): string;
217
- export declare function successCheck(variant?: 'line' | 'circled'): string;
170
+ export declare function hlShell(raw: string): string;
171
+
218
172
  export declare function themeIcon(theme: string): string;
219
- export declare function themeName(theme: string): string;
220
- export declare function themeToggle(theme?: string): string;
221
- export declare function versionSwitcher(versions?: { label: string; meta?: string; badge?: string }[], activeIdx?: number): string;
222
173
 
223
174
  // A tuple, so React can derive its Accent union from it.
224
175
  export declare const ACCENTS: readonly ['default', 'phoenix', 'ocean', 'emerald'];
225
176
  export declare const ACCOUNT_NAV: { id: string; icon: string; label: string }[];
226
- export declare const RAIL_COOKIE: 'apliteni-ui-rail';
227
- export declare const STAT_TONES: string[];
228
- export declare const STAT_VARIANTS: string[];
229
177
 
230
- export declare function applyAccent(name: string, root?: HTMLElement): void;
231
- export declare function applyTheme(theme: string, root?: HTMLElement): void;
232
- export declare function railCollapsed(cookies?: string): boolean | null;
233
- export declare function closeCommandPalette(root: Element | null): void;
234
- export declare function closeConfirm(root: Element | null): void;
235
- export declare function closeDrawer(root: Element | null): void;
236
- export declare function openCommandPalette(root: Element | null, returnFocusTo?: HTMLElement | null): void;
237
- export declare function openConfirm(root: Element | null, returnFocusTo?: HTMLElement | null): void;
238
- export declare function openDrawer(root: Element | null, returnFocusTo?: HTMLElement | null): void;
239
- export declare function setPaletteResults(root: HTMLElement, groups: readonly Record<string, unknown>[]): void;
240
- export declare function hideTooltip(host: HTMLElement): void;
241
- export declare function showTooltip(host: HTMLElement, mark: Element): void;
242
- export declare function initRowIdentity(root?: Document | Element): void;
243
- export declare function initSegmented(root?: Document | Element): () => void;
244
- export declare function initTabs(root?: Document | Element): void;
245
- export declare function wireCommandPalette(root?: Document | Element): void;
246
- export declare function wireConfirm(root?: Document | Element): void;
247
- export declare function wireDrawer(root?: Document | Element): void;
248
- export declare function wireFeedback(opts?: Record<string, unknown>): void;
249
- export declare function wireNav(root?: Document | Element): void;
250
- export declare function wireShell(root?: Document | Element, opts?: { persist?: boolean }): void;
251
- export declare function wireTooltip(root?: Document | Element): void;
252
- export declare function wireTopbar(root?: Document | Element): void;
253
- export declare function wireSuccess(root: Element, opts?: { onDone?: () => void }): () => void;
254
- export declare function wirePagination(root?: Document | Element | string | null, opts?: { onPage?: (page: number) => void; onPageSize?: (size: number) => void }): () => void;
255
178
  export declare function nearestSection(node: Node | null, root?: Element | null): Element | null;
256
- export declare function dismissToast(element: HTMLElement): void;
257
- export declare function wireToastStack(container: Element | string | null): Element | null;
258
- export declare function pushToast(container: Element | string | null, opts?: Record<string, unknown>): Element | null;
259
- export declare function setBusy(root: Element | string | null, opts?: { busy?: boolean; message?: string; body?: string }): Element | null;
260
- export declare function setButtonBusy(element: HTMLElement, opts?: { busy?: boolean }): void;
261
- export declare function setPagerStatus(root: Element | string | null, text: string): Element | null;
package/src/index.js CHANGED
@@ -1,40 +1,27 @@
1
1
  // apliteni-ui — public entry.
2
2
  // Styles ship separately: `import 'apliteni-ui/css'`.
3
- export * from './components/index.js';
4
- export * from './components/avatar.js';
5
- export * from './components/dropdown.js';
6
- export * from './components/tooltip.js';
7
- export * from './components/tabs.js';
8
- export * from './components/nav.js';
9
- export * from './components/back.js';
10
- export * from './components/drawer.js';
11
- export * from './components/confirm.js';
12
- export * from './components/command-palette.js';
13
- export * from './components/topbar.js';
14
- export * from './components/shell.js';
15
- export * from './components/footer.js';
16
- export * from './components/feedback.js';
17
- export * from './components/toasts.js';
18
- export * from './components/success.js';
19
- export * from './components/loading.js';
20
- export * from './components/pagination.js';
21
- export * from './components/stat.js';
22
3
  export * from './assets/icons.js';
23
4
  export * from './assets/brand.js';
5
+ export * from './assets/illustrations.js';
24
6
  export * from './motion.js';
25
- export { setButtonBusy } from './components/button-busy.js';
7
+ export { esc, safeUrl } from './html.js';
26
8
 
27
- export * from './components/table-values.js';
28
- export * from './components/segmented.js';
29
- export * from './components/filter-bar.js';
30
-
31
- export { dropdownMatch, dropdownFiltering, dropdownAvail } from './logic/dropdown.js';
9
+ export { ACCENTS, accentSwatchStyle } from './logic/accents.js';
10
+ export { ACCOUNT_NAV } from './logic/account-nav.js';
11
+ export { AVATAR_HUES, avatarHue, avatarInitials } from './logic/avatar.js';
12
+ export { calloutIcons } from './logic/callout.js';
13
+ export { CHART_FLOOR, chartScale, bridgeWalk, pointTarget } from './logic/chart.js';
14
+ export { codeLanguages, codeTokens, hlCode, hlShell } from './logic/code.js';
32
15
  export { SCORE, rankGroups, rankCommands, scoreCommand, paletteHotkey } from './logic/command-palette.js';
33
- export { segmentedNextIndex } from './logic/segmented.js';
16
+ export { dropdownMatch, dropdownFiltering, dropdownAvail } from './logic/dropdown.js';
17
+ export {
18
+ DD_MENU_FLOOR, filterPanelRow, filterPanelFit, dropdownHeightFit, dropdownLift,
19
+ dropdownReveal, dropdownRest, dropdownSnap, dropdownViewportFit,
20
+ } from './logic/dropdown-placement.js';
21
+ export { nearestSection } from './logic/feedback.js';
34
22
  export { filterChipText, filterChipName, filterChipUnset, filterChipItems, nextFocusStop, focusNextStop } from './logic/filter-bar.js';
23
+ export { observeNavFit, revealCurrentNav, revealFocusedNav } from './logic/nav.js';
35
24
  export { PAGE_SIZES, DEFAULT_PAGE_SIZE } from './logic/pagination.js';
36
- export { calloutIcons } from './logic/callout.js';
25
+ export { segmentedNextIndex } from './logic/segmented.js';
37
26
  export { formatNumericValue, formatDeltaValue } from './logic/table-values.js';
38
- export { accentSwatchStyle } from './logic/accents.js';
39
- export { observeNavFit, revealCurrentNav, revealFocusedNav } from './logic/nav.js';
40
- export { CHART_FLOOR, chartScale, bridgeWalk, pointTarget } from './logic/chart.js';
27
+ export { themeIcon } from './logic/theme.js';
@@ -124,13 +124,17 @@
124
124
  color: var(--text);
125
125
  background: none;
126
126
  border: 0;
127
- /* The one control in the kit that removes the indicator and puts no
128
- outline: var(--ring) back, against base.css. It is the only tab stop in
129
- the dialog and it holds focus from the frame it opens, so a ring would be
130
- painted the whole time the palette is up and would mark nothing; the panel
131
- already carries one, and the caret says where the typing goes. */
127
+ /* The ring goes on the search row, which is this field's box. */
132
128
  outline: none;
133
129
  }
130
+ /* The shared field ring, drawn inward because the panel clips. The divider goes
131
+ transparent under it, as a field's border does, so focus has one line.
132
+ why: docs/foundations.md#the-focus-ring */
133
+ .ui-cmdk__search:has(.ui-cmdk__input:focus-visible) {
134
+ border-bottom-color: transparent;
135
+ outline: var(--ring-scroll);
136
+ outline-offset: var(--ring-scroll-offset);
137
+ }
134
138
  .ui-cmdk__input::placeholder { /* muted-ink: placeholder — empty command search */ color: var(--muted); }
135
139
 
136
140
  /* -- The list ------------------------------------------------------------- */
@@ -232,6 +232,14 @@
232
232
  padding-block: var(--space-1);
233
233
  overflow-wrap: anywhere;
234
234
  }
235
+ /* A control in the value column has its own border and padding, so its first line sits lower
236
+ than a label's. A row whose value holds a field or a dropdown lines both first lines up on
237
+ their baseline, whatever the control is, and a row of text keeps its place. At 560px and
238
+ below the label stacks over the value and there is nothing to align. A field's own label
239
+ stays for a screen reader only when one field fills the value cell. With two
240
+ fields, each label remains visible to name its control. */
241
+ .ui-drawer__row:has(> dd :is(.ui-input, .ui-textarea, .ui-select, .ui-dropdown)) > :is(dt, dd) { align-self: baseline; }
242
+ .ui-drawer__row > dd:has(> .ui-field:only-child) > .ui-field > .ui-field__label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
235
243
  .ui-drawer__row dt { color: var(--text); }
236
244
  .ui-drawer__row dd { color: var(--text); font-variant-numeric: tabular-nums; }
237
245
  .ui-drawer .ui-drawer__rows + *,
@@ -83,14 +83,20 @@
83
83
  --caret-ink: 1.6px;
84
84
  --caret-off: calc((var(--caret) - var(--caret-ink)) / 2.8284); /* 2√2 — the 45° turn's projection */
85
85
  width: var(--caret); height: var(--caret);
86
- border-right: var(--caret-ink) solid var(--muted);
87
- border-bottom: var(--caret-ink) solid var(--muted);
86
+ /* Two gradient strips, not borders: Chromium rounds a border to whole device pixels,
87
+ so a 1.6px border painted 1.03px of ink, where the select's SVG stroke paints 1.58px. */
88
+ background:
89
+ linear-gradient(var(--muted), var(--muted)) right / var(--caret-ink) 100% no-repeat,
90
+ linear-gradient(var(--muted), var(--muted)) bottom / 100% var(--caret-ink) no-repeat;
88
91
  /* Shift BEFORE rotate, so it lands in page space rather than on the turned axis. */
89
92
  transform: translateY(calc(var(--caret-off) * -1)) rotate(45deg);
90
93
  transition: transform var(--dur-fast) var(--ease);
91
94
  flex: none;
92
95
  }
93
96
  .ui-dropdown.open .ui-dropdown__chevron { transform: translateY(var(--caret-off)) rotate(-135deg); }
97
+ @media (forced-colors: active) {
98
+ .ui-dropdown__chevron { background: none; border-right: var(--caret-ink) solid ButtonText; border-bottom: var(--caret-ink) solid ButtonText; }
99
+ }
94
100
 
95
101
  /* Panel — the popover surface */
96
102
  .ui-dropdown__panel {
@@ -210,6 +216,12 @@
210
216
  at the room the viewport left either way. #489 */
211
217
  .ui-dropdown__panel.is-scroll { --ui-dropdown-cap: var(--ui-dropdown-max); }
212
218
 
219
+ /* On a phone, the panel keeps the page's 16px margin at the shell fold.
220
+ why: docs/components.md#the-dropdown-panel */
221
+ @media (max-width: 720px) {
222
+ .ui-dropdown__panel { --ui-dropdown-edge: var(--space-4); }
223
+ }
224
+
213
225
  /* The wiring adds this where the room is below the floor: even spending the whole
214
226
  edge inset, there is no usable height. The panel keeps its cap — it is never
215
227
  taller than 300px — and scrolls inside it. Its room runs past the fold, so the
@@ -316,12 +328,22 @@
316
328
  color: var(--text);
317
329
  transition: background var(--dur-fast) var(--ease);
318
330
  }
319
- /* Rows keep a reading surface; hover adds an edge. A row that is hovered AND focused
320
- draws the ring and not the hover edge — both are outlines now, and the focus rule
321
- comes later — which is one indicator rather than two.
331
+ /* Hover is a fill and an outline means focus, so a hovered row draws no edge. A row that is
332
+ hovered AND focused draws the ring over the fill.
322
333
  why: docs/foundations.md#elevation */
323
- .ui-dropdown__item:hover { outline: 1px solid var(--control-edge); outline-offset: -1px; background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
324
- .ui-dropdown__item:focus-visible { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ outline: var(--ring); outline-offset: var(--ring-offset); }
334
+ .ui-dropdown__item:hover { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
335
+ /* Light only: the panel is --bg-elevated, which --surface matches exactly there, so the
336
+ hover fill above changed nothing. --surface-3 is the quiet fill the drawer's close mark
337
+ takes on hover, one step under the --surface-2 that .is-active takes below.
338
+ why: docs/foundations.md#elevation */
339
+ :where(:root[data-theme="light"]) .ui-dropdown__item:hover { background: var(--surface-3); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
340
+ @media (forced-colors: active) {
341
+ .ui-dropdown__item:hover { border: 1px solid Highlight; padding: 8px 11px; }
342
+ }
343
+ /* The row draws its ring inward, so a row scrolled flush with the list's edge cannot have it
344
+ clipped and the list scrolls as it did.
345
+ why: docs/foundations.md#the-focus-ring */
346
+ .ui-dropdown__item:focus-visible { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ outline: var(--ring-scroll); outline-offset: var(--ring-scroll-offset); }
325
347
  .ui-dropdown__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
326
348
  .ui-dropdown__label { font-family: var(--font-sans); font-size: calc(var(--text-sm) - 0.5px); color: var(--strong); font-weight: 600; letter-spacing: 0.01em; }
327
349
  .ui-dropdown__desc { font-size: var(--text-xs); color: var(--text); line-height: 1.35; }
@@ -444,7 +466,7 @@
444
466
 
445
467
  .ui-dropdown__search-input::placeholder { /* muted-ink: placeholder — empty search field */ color: var(--muted); }
446
468
  .ui-dropdown__search-input:hover { border-color: var(--field-edge-hover); }
447
- .ui-dropdown__search-input:focus-visible { outline: var(--ring); outline-offset: var(--ring-offset); }
469
+ .ui-dropdown__search-input:focus-visible { border-color: transparent; outline: var(--ring); outline-offset: var(--ring-offset); }
448
470
 
449
471
  /* The rows' own cap, read from the same property the panel reads: the `scroll`
450
472
  option lands on the list when there is a field above it. #489 */
@@ -131,7 +131,7 @@
131
131
 
132
132
  /* Error banner */
133
133
  .ui-fbc__err { margin: 14px 20px 0; background: color-mix(in srgb, var(--pink) 14%, transparent); /* code-bg: inherit — text-only validation message has no nested focus target. */ color: var(--chip-danger-ink); font-size: var(--text-sm); padding: 11px 15px; border-radius: 11px; display: none; }
134
- .ui-fbc__err.show { display: block; }
134
+ .ui-fbc__err.show { display: block; /* motion: still — the React Feedback renders the error already shown; its fade is the is-entering animation beside it. */ }
135
135
  /* A failed send's line fades in; wireFeedback() adds the class as it shows it. */
136
136
  .ui-fbc__err.is-entering { animation: m-fade var(--dur-fast) var(--ease-out) both; }
137
137
 
@@ -11,6 +11,9 @@
11
11
  outside it. It joins the shared recomposition in tokens.css beside .ui-seg,
12
12
  which is also what hands an inline code chip the page from here. */
13
13
  background: var(--surface);
14
+ /* A chip with no value draws no remove mark, so it stops taking its height from the
15
+ mark's line box. The bar names the height; every chip keeps it. */
16
+ min-height: var(--ui-filter-row-h);
14
17
  }
15
18
  .ui-filter-bar__chip .ui-dropdown__trigger { border: 0; background: transparent; padding: var(--space-1) var(--space-2); }
16
19
  /* The chip is the edge the row's other boxes are measured against, so it fades with them:
@@ -123,8 +126,8 @@
123
126
  why: docs/components.md#a-filter-row-holds-its-panels */
124
127
  .ui-filter-bar .ui-dropdown__item.is-selected:hover { background: color-mix(in srgb, var(--glow-purple), var(--accent) 9%); /* code-bg: inherit — a translucent wash moves the ground, not the chip on it. */ }
125
128
 
126
- /* A chip's height — its remove mark's line box, padding and border — named so the control
127
- stands as tall on a line of its own, where there is no chip to stretch to. */
129
+ /* A chip's height — a remove mark's line box, padding and border — named so every chip,
130
+ with or without a mark, and a control on a line of its own stand as tall. */
128
131
  .ui-filter-bar { --ui-filter-row-h: calc(2px + 2 * var(--space-1) + var(--leading-normal) * var(--text-lg)); }
129
132
 
130
133
  /* A chip's neighbour takes the chip's corner, that height and edge, but not its painted fill: