eidotter 0.44.0 → 0.45.1
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 +4 -4
- package/dist/components/DisplayMenu/components/DisplayMenu.d.ts +51 -0
- package/dist/components/DisplayMenu/components/DisplayMenu.js +33 -0
- package/dist/components/DisplayMenu/components/index.d.ts +2 -0
- package/dist/components/DisplayMenu/components/index.js +1 -0
- package/dist/components/DisplayMenu/index.d.ts +2 -0
- package/dist/components/DisplayMenu/index.js +1 -0
- package/dist/components/Header/components/Header.js +5 -2
- package/dist/components/Switch/components/Switch.d.ts +4 -0
- package/dist/components/Switch/components/Switch.js +1 -1
- package/dist/components/registry.js +18 -0
- package/dist/eidotter.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +1481 -1261
- package/dist/index.umd.js +1 -1
- package/llms.txt +3 -3
- package/migrations/0.45.0.md +104 -0
- package/migrations/README.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[](./LICENSE.md)
|
|
16
16
|
[](https://react.dev/)
|
|
17
17
|
|
|
18
|
-
**eiDotter** is a React component library that takes the DOS/CGA terminal aesthetic seriously: authentic 16-color palette, bitmap-accurate typography, phosphor glow physics, keyboard-first interactions.
|
|
18
|
+
**eiDotter** is a React component library that takes the DOS/CGA terminal aesthetic seriously: authentic 16-color palette, bitmap-accurate typography, phosphor glow physics, keyboard-first interactions. 62 components across forms, navigation, windowing, timelines, health displays, and terminal chrome — shipped as ES modules with a prebuilt stylesheet so consumers don't need Tailwind to use it.
|
|
19
19
|
|
|
20
20
|
→ **[Storybook](https://cinimody.github.io/eiDotter/)** · **[CHANGELOG](./CHANGELOG.md)** · **[Accessibility](./ACCESSIBILITY.md)** · **[Issues](https://github.com/CinimoDY/eiDotter/issues)** · **[npm](https://www.npmjs.com/package/eidotter)**
|
|
21
21
|
|
|
@@ -116,9 +116,9 @@ for client apps and `'use client'` files.
|
|
|
116
116
|
|
|
117
117
|
## Upgrading
|
|
118
118
|
|
|
119
|
-
Every minor with breaking or visible changes ships an upgrade guide in the package, at `node_modules/eidotter/migrations/<version>.md` (source: [`migrations/`](./migrations/)). Read every guide between your installed version and the target, oldest first. Start with [0.41.0](./migrations/0.41.0.md), then [0.43.0](./migrations/0.43.0.md)
|
|
119
|
+
Every minor with breaking or visible changes ships an upgrade guide in the package, at `node_modules/eidotter/migrations/<version>.md` (source: [`migrations/`](./migrations/)). Read every guide between your installed version and the target, oldest first. Start with [0.41.0](./migrations/0.41.0.md), then [0.43.0](./migrations/0.43.0.md), [0.44.0](./migrations/0.44.0.md) and [0.45.0](./migrations/0.45.0.md).
|
|
120
120
|
|
|
121
|
-
0.x caret ranges stop at the next minor (`^0.40.2` never resolves to 0.41.0), so bump the range explicitly: `npm install eidotter@^0.
|
|
121
|
+
0.x caret ranges stop at the next minor (`^0.40.2` never resolves to 0.41.0), so bump the range explicitly: `npm install eidotter@^0.45.0`.
|
|
122
122
|
|
|
123
123
|
## Documentation
|
|
124
124
|
|
|
@@ -133,7 +133,7 @@ Every minor with breaking or visible changes ships an upgrade guide in the packa
|
|
|
133
133
|
|
|
134
134
|
## Components
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
62 components across six families — [complete catalog in Storybook](https://cinimody.github.io/eiDotter/). Also exported but not tabled below: Bench, CalendarHeatmap, Connector, CopyButton, ChecklistRow, DisplayMenu, EmptyState, HoldToComplete, LabeledProgress, LedgerRow, PageShell (with PageSection), ProgressRing, SectionHeading, Select, TimelineFeed, TimelinePage and the `Mark` brand component.
|
|
137
137
|
|
|
138
138
|
<details>
|
|
139
139
|
<summary><strong>Windowing & shell</strong> — Terminal, DosDialog, DosWindow, IconButton, Modal, Lightbox, CommandPrompt, CmdPalette, Header, Footer, Nav, Brand</summary>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DisplayMenuItem {
|
|
3
|
+
/** Stable id, used for keys and the hint's id. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Row label, also the switch's accessible name (e.g. `'DOS'`, `'PAPER'`). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Whether the option is on. The consumer owns the state. */
|
|
8
|
+
checked: boolean;
|
|
9
|
+
/** Called with the new value when the switch is toggled. */
|
|
10
|
+
onChange: (checked: boolean) => void;
|
|
11
|
+
/** Disable the row (e.g. PAPER while DOS is off). */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Short muted line under the row, linked as the switch's description. */
|
|
14
|
+
hint?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DisplayMenuProps {
|
|
17
|
+
/** One row per display option: a label and a Switch. */
|
|
18
|
+
items: DisplayMenuItem[];
|
|
19
|
+
/**
|
|
20
|
+
* Trigger label and the panel's accessible name. Default `'Display'`.
|
|
21
|
+
* Below 640px the trigger shows only the icon; the label stays its
|
|
22
|
+
* accessible name.
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* `'responsive'` (default): icon only below 640px, icon + label above.
|
|
27
|
+
* `'icon'`: always icon only. `'label'`: always icon + label.
|
|
28
|
+
*/
|
|
29
|
+
labelDisplay?: 'responsive' | 'icon' | 'label';
|
|
30
|
+
/** Panel placement relative to the trigger. Default `'bottom end'`. */
|
|
31
|
+
placement?: 'bottom end' | 'bottom start' | 'bottom';
|
|
32
|
+
/** Render with the panel open (uncontrolled), e.g. for docs and stories. */
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
/** Extra class on the trigger button. */
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* DisplayMenu: one header control for display options (DMNC-1619).
|
|
39
|
+
*
|
|
40
|
+
* A trigger button (pixel monitor glyph, label, ▾) opens a small panel of
|
|
41
|
+
* rows, each a label and an eidotter `Switch`, for options such as DOS mode
|
|
42
|
+
* or the amber-paper theme. Built for Header's `end` slot so every site has
|
|
43
|
+
* one theme control instead of switches side by side.
|
|
44
|
+
*
|
|
45
|
+
* The panel is a React Aria popover dialog: it portals out of the header (so
|
|
46
|
+
* the end slot's clip never cuts it), opening it focuses the first enabled
|
|
47
|
+
* switch, Escape and a click outside close it and focus returns to the
|
|
48
|
+
* trigger, and Tab moves between the switches.
|
|
49
|
+
* Consumers own the state; DisplayMenu only renders it.
|
|
50
|
+
*/
|
|
51
|
+
export declare const DisplayMenu: React.ForwardRefExoticComponent<DisplayMenuProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import { Button as AriaButton, Dialog as AriaDialog, DialogTrigger as AriaDialogTrigger, Popover as AriaPopover, } from 'react-aria-components';
|
|
5
|
+
import { Monitor } from 'pixelarticons/react/Monitor.js';
|
|
6
|
+
import { ChevronDown } from 'pixelarticons/react/ChevronDown.js';
|
|
7
|
+
import { Switch } from '../../Switch/index.js';
|
|
8
|
+
import { cn } from '../../../utils/cn.js';
|
|
9
|
+
/**
|
|
10
|
+
* DisplayMenu: one header control for display options (DMNC-1619).
|
|
11
|
+
*
|
|
12
|
+
* A trigger button (pixel monitor glyph, label, ▾) opens a small panel of
|
|
13
|
+
* rows, each a label and an eidotter `Switch`, for options such as DOS mode
|
|
14
|
+
* or the amber-paper theme. Built for Header's `end` slot so every site has
|
|
15
|
+
* one theme control instead of switches side by side.
|
|
16
|
+
*
|
|
17
|
+
* The panel is a React Aria popover dialog: it portals out of the header (so
|
|
18
|
+
* the end slot's clip never cuts it), opening it focuses the first enabled
|
|
19
|
+
* switch, Escape and a click outside close it and focus returns to the
|
|
20
|
+
* trigger, and Tab moves between the switches.
|
|
21
|
+
* Consumers own the state; DisplayMenu only renders it.
|
|
22
|
+
*/
|
|
23
|
+
export const DisplayMenu = forwardRef(({ items, label = 'Display', labelDisplay = 'responsive', placement = 'bottom end', defaultOpen, className, }, ref) => {
|
|
24
|
+
const baseId = useId();
|
|
25
|
+
// Opening the panel puts focus on the first switch that can be toggled,
|
|
26
|
+
// so Space works straight away (DMNC-1619 follow-up).
|
|
27
|
+
const firstEnabled = items.findIndex((item) => !item.disabled);
|
|
28
|
+
return (_jsxs(AriaDialogTrigger, { defaultOpen: defaultOpen, children: [_jsxs(AriaButton, { ref: ref, "aria-label": label, className: cn('eidotter-display-menu', `eidotter-display-menu--${labelDisplay}`, className), children: [_jsx(Monitor, { className: "eidotter-display-menu__icon", "aria-hidden": "true", focusable: "false" }), _jsx("span", { className: "eidotter-display-menu__label", "aria-hidden": "true", children: label }), _jsx(ChevronDown, { className: "eidotter-display-menu__chevron", "aria-hidden": "true", focusable: "false" })] }), _jsx(AriaPopover, { placement: placement, offset: 6, className: "eidotter-display-menu__popover", children: _jsx(AriaDialog, { "aria-label": label, className: "eidotter-display-menu__panel", children: _jsx("ul", { className: "eidotter-display-menu__list", children: items.map((item, index) => {
|
|
29
|
+
const hintId = item.hint ? `${baseId}-${item.id}-hint` : undefined;
|
|
30
|
+
return (_jsxs("li", { className: "eidotter-display-menu__row", children: [_jsx(Switch, { label: item.label, checked: item.checked, onChange: item.onChange, disabled: item.disabled, "aria-describedby": hintId, autoFocus: index === firstEnabled, className: "eidotter-display-menu__switch" }), item.hint && (_jsx("span", { id: hintId, className: "eidotter-display-menu__hint", children: item.hint }))] }, item.id));
|
|
31
|
+
}) }) }) })] }));
|
|
32
|
+
});
|
|
33
|
+
DisplayMenu.displayName = 'DisplayMenu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DisplayMenu } from './DisplayMenu.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DisplayMenu } from './components/index.js';
|
|
@@ -26,9 +26,12 @@ export const Header = forwardRef(({ brandName, brandHref = '/', items, activeHre
|
|
|
26
26
|
// contained: true → CSS default width; a non-blank string → that CSS length.
|
|
27
27
|
const containedWidth = typeof contained === 'string' ? contained.trim() : '';
|
|
28
28
|
const isContained = contained === true || containedWidth !== '';
|
|
29
|
-
|
|
29
|
+
// Name before icon in the DOM: the link lays them out row-reverse (icon on
|
|
30
|
+
// the left) and wraps, so on a row too narrow for both it is the icon that
|
|
31
|
+
// moves to the clipped second line and the name stays (CSS, 0.45).
|
|
32
|
+
const brandContent = children || (iconBrand ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "eidotter-header__brand-name uppercase tracking-[0.3em]", children: brandName }), brand === 'mark'
|
|
30
33
|
? _jsx(Mark, { size: 28, label: "", className: "eidotter-header__brand-icon" })
|
|
31
|
-
: _jsx(Logo, { size: 28, glow: true, title: "", className: "eidotter-header__brand-icon" })
|
|
34
|
+
: _jsx(Logo, { size: 28, glow: true, title: "", className: "eidotter-header__brand-icon" })] })) : brandName);
|
|
32
35
|
// `end` is rendered once: DesktopNav is hidden <768px and the MENU trigger
|
|
33
36
|
// ≥768px, so this DOM order gives "nav · end" on desktop and "end · MENU" on
|
|
34
37
|
// mobile. The right-hand group wrapper only exists when `end` is passed, so
|
|
@@ -24,6 +24,10 @@ export interface SwitchProps {
|
|
|
24
24
|
className?: string;
|
|
25
25
|
/** Accessible label */
|
|
26
26
|
'aria-label'?: string;
|
|
27
|
+
/** Id of an element that describes the switch (a hint line) */
|
|
28
|
+
'aria-describedby'?: string;
|
|
29
|
+
/** Focus the switch when it mounts (DisplayMenu focuses its first row) */
|
|
30
|
+
autoFocus?: boolean;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* DOS-styled Switch with phosphor glow toggle effect.
|
|
@@ -7,5 +7,5 @@ import { cn } from '../../../utils/cn.js';
|
|
|
7
7
|
* DOS-styled Switch with phosphor glow toggle effect.
|
|
8
8
|
* Built on React Aria for accessible toggle behavior.
|
|
9
9
|
*/
|
|
10
|
-
export const Switch = forwardRef(({ checked, defaultChecked = false, onChange, onCheckedChange, disabled = false, size = 'md', type = 'default', label, name, value, className, ...props }, ref) => (_jsx(AriaSwitch, { ref: ref, isSelected: checked, defaultSelected: defaultChecked, onChange: onChange ?? onCheckedChange, isDisabled: disabled, name: name, value: value, className: cn('inline-flex items-center gap-2 cursor-pointer outline-none font-dos group', 'eidotter-switch', disabled && 'opacity-50 cursor-not-allowed', className), "data-size": size, "data-type": type, ...props, children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('eidotter-switch__track', isSelected && 'eidotter-switch__track--checked', type === 'slim' && 'eidotter-switch__track--slim', size === 'sm' && 'eidotter-switch__track--sm'), children: _jsx("span", { className: "eidotter-switch__thumb" }) }), label && _jsx("span", { className: "
|
|
10
|
+
export const Switch = forwardRef(({ checked, defaultChecked = false, onChange, onCheckedChange, disabled = false, size = 'md', type = 'default', label, name, value, className, ...props }, ref) => (_jsx(AriaSwitch, { ref: ref, isSelected: checked, defaultSelected: defaultChecked, onChange: onChange ?? onCheckedChange, isDisabled: disabled, name: name, value: value, className: cn('inline-flex items-center gap-2 cursor-pointer outline-none font-dos group', 'eidotter-switch', disabled && 'opacity-50 cursor-not-allowed', className), "data-size": size, "data-type": type, ...props, children: ({ isSelected }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('eidotter-switch__track', isSelected && 'eidotter-switch__track--checked', type === 'slim' && 'eidotter-switch__track--slim', size === 'sm' && 'eidotter-switch__track--sm'), children: _jsx("span", { className: "eidotter-switch__thumb" }) }), label && _jsx("span", { className: "eidotter-switch__label", children: label })] })) })));
|
|
11
11
|
Switch.displayName = 'Switch';
|
|
@@ -454,6 +454,7 @@ export const componentRegistry = {
|
|
|
454
454
|
swiftui: { status: 'planned' },
|
|
455
455
|
},
|
|
456
456
|
changelog: [
|
|
457
|
+
{ version: '0.45.0', type: 'added', description: 'aria-describedby prop (DisplayMenu links row hints with it); label colour is the semantic text-brand role (class eidotter-switch__label), so it re-themes on light and amber-paper (DMNC-1620)' },
|
|
457
458
|
{ version: '0.16.0', type: 'changed', description: 'Migrate to React Aria + Tailwind-first (Wave 1); add size:sm variant' },
|
|
458
459
|
{ version: '0.9.0', type: 'changed', description: 'Replace text-primary with cga-amber' },
|
|
459
460
|
{ version: '0.8.0', type: 'changed', description: 'Design-craft animation polish — toggle glow transition' },
|
|
@@ -694,6 +695,7 @@ export const componentRegistry = {
|
|
|
694
695
|
'brandCollapse:mark': { description: 'Below 480px of header width (container query) only the icon shows; the name stays the accessible name', since: '0.43.0' },
|
|
695
696
|
},
|
|
696
697
|
changelog: [
|
|
698
|
+
{ version: '0.45.0', type: 'changed', description: 'Brand title never wraps or ellipsizes; on a tight row a lockup/mark brand drops its icon first (name first in the DOM, row-reverse wrap onto a clipped second row), then the end slot clips. Phone gaps (below 480px) 8px with an end slot (DMNC-1619)' },
|
|
697
699
|
{ version: '0.43.0', type: 'added', description: '`layout` (inline | stacked), `rule` (false drops the bottom line and its glow), `contained` (true = 1240px column, or a CSS length, with the PageShell gutter, so the brand lines up with a page column) and `brandCollapse` (none | mark) props; all default to the previous rendering' },
|
|
698
700
|
{ version: '0.43.0', type: 'changed', description: 'The brand name wraps instead of ellipsizing: the brand link shrinks first (the end slot clips only after the brand reaches its floor of icon + about 8 tracked characters), words break at spaces, a single over-long word breaks mid-word as a last resort; the icon top-aligns beside a two-line name' },
|
|
699
701
|
{ version: '0.41.3', type: 'changed', description: 'end slot clips the inline axis only (overflow-x: clip) with a 12px inline bleed, so focus rings and phosphor glows of controls in it are no longer cut; overflow: hidden fallback without clip support (DMNC-1611)' },
|
|
@@ -791,6 +793,22 @@ export const componentRegistry = {
|
|
|
791
793
|
{ version: '0.41.0', type: 'added', description: 'Initial IconButton: icon, required label (aria-label), size md/window, variant outline/bare, isDisabled, onPress, excludeFromTabOrder; adopted by Modal, Lightbox, Notification, Alert, Tag and Nav (DMNC-1592)' },
|
|
792
794
|
],
|
|
793
795
|
},
|
|
796
|
+
DisplayMenu: {
|
|
797
|
+
origin: 'eidotter',
|
|
798
|
+
consumers: [],
|
|
799
|
+
since: '0.45.0',
|
|
800
|
+
originNote: 'One header control for display options (DMNC-1619): a trigger (pixel monitor glyph, label, chevron; icon only below 640px) opens a React Aria popover dialog with one row per option, each an eidotter Switch. Replaces switches side by side in Header end slots; consumers own the state.',
|
|
801
|
+
variants: {
|
|
802
|
+
'labelDisplay:responsive': { description: 'Icon only below 640px, icon + label above (default)', since: '0.45.0' },
|
|
803
|
+
'labelDisplay:icon': { description: 'Always icon only (36px square)', since: '0.45.0' },
|
|
804
|
+
'labelDisplay:label': { description: 'Always icon + label + chevron', since: '0.45.0' },
|
|
805
|
+
},
|
|
806
|
+
platforms: { react: { path: 'src/components/DisplayMenu', status: 'canonical' } },
|
|
807
|
+
changelog: [
|
|
808
|
+
{ version: '0.45.1', type: 'changed', description: 'Opening the panel focuses the first enabled switch, so Space toggles it without a Tab' },
|
|
809
|
+
{ version: '0.45.0', type: 'added', description: 'Initial DisplayMenu: items ({ id, label, checked, onChange, disabled, hint }), label, labelDisplay, placement, className; stable classes eidotter-display-menu, __popover, __panel, __row, __switch, __hint (DMNC-1619)' },
|
|
810
|
+
],
|
|
811
|
+
},
|
|
794
812
|
DosWindow: {
|
|
795
813
|
origin: 'eidotter',
|
|
796
814
|
consumers: [],
|