eidotter 0.45.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/dist/components/DisplayMenu/components/DisplayMenu.d.ts +3 -2
- package/dist/components/DisplayMenu/components/DisplayMenu.js +8 -4
- package/dist/components/Switch/components/Switch.d.ts +2 -0
- package/dist/components/registry.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +11 -6
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -43,8 +43,9 @@ export interface DisplayMenuProps {
|
|
|
43
43
|
* one theme control instead of switches side by side.
|
|
44
44
|
*
|
|
45
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),
|
|
47
|
-
* and
|
|
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.
|
|
48
49
|
* Consumers own the state; DisplayMenu only renders it.
|
|
49
50
|
*/
|
|
50
51
|
export declare const DisplayMenu: React.ForwardRefExoticComponent<DisplayMenuProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -15,15 +15,19 @@ import { cn } from '../../../utils/cn.js';
|
|
|
15
15
|
* one theme control instead of switches side by side.
|
|
16
16
|
*
|
|
17
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),
|
|
19
|
-
* and
|
|
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.
|
|
20
21
|
* Consumers own the state; DisplayMenu only renders it.
|
|
21
22
|
*/
|
|
22
23
|
export const DisplayMenu = forwardRef(({ items, label = 'Display', labelDisplay = 'responsive', placement = 'bottom end', defaultOpen, className, }, ref) => {
|
|
23
24
|
const baseId = useId();
|
|
24
|
-
|
|
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) => {
|
|
25
29
|
const hintId = item.hint ? `${baseId}-${item.id}-hint` : undefined;
|
|
26
|
-
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, className: "eidotter-display-menu__switch" }), item.hint && (_jsx("span", { id: hintId, className: "eidotter-display-menu__hint", children: item.hint }))] }, item.id));
|
|
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));
|
|
27
31
|
}) }) }) })] }));
|
|
28
32
|
});
|
|
29
33
|
DisplayMenu.displayName = 'DisplayMenu';
|
|
@@ -26,6 +26,8 @@ export interface SwitchProps {
|
|
|
26
26
|
'aria-label'?: string;
|
|
27
27
|
/** Id of an element that describes the switch (a hint line) */
|
|
28
28
|
'aria-describedby'?: string;
|
|
29
|
+
/** Focus the switch when it mounts (DisplayMenu focuses its first row) */
|
|
30
|
+
autoFocus?: boolean;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* DOS-styled Switch with phosphor glow toggle effect.
|
|
@@ -805,6 +805,7 @@ export const componentRegistry = {
|
|
|
805
805
|
},
|
|
806
806
|
platforms: { react: { path: 'src/components/DisplayMenu', status: 'canonical' } },
|
|
807
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' },
|
|
808
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)' },
|
|
809
810
|
],
|
|
810
811
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -138,4 +138,4 @@ export type { SafeHrefOptions } from './utils';
|
|
|
138
138
|
export { ZOOM_LEVELS } from './components/TimelineContainer';
|
|
139
139
|
export { componentRegistry, projects, getComponentMeta, getComponentsByOrigin, getComponentsByConsumer, getVariantsUsedBy, getVariantConsumerMap, } from './components/registry';
|
|
140
140
|
export type { ComponentMeta, ProjectId, ProjectInfo, VariantMeta, PlatformId, PlatformMeta, ChangelogEntry, } from './components/registry';
|
|
141
|
-
export declare const version = "0.45.
|
|
141
|
+
export declare const version = "0.45.1";
|
package/dist/index.es.js
CHANGED
|
@@ -15333,7 +15333,7 @@ var Zv = (e) => i("svg", Object.assign({
|
|
|
15333
15333
|
fill: "currentColor",
|
|
15334
15334
|
xmlns: "http://www.w3.org/2000/svg"
|
|
15335
15335
|
}, e), i("path", { d: "M4 2h16v2H4zm0 14h16v2H4zM2 4h2v12H2zm18 0h2v12h-2zm-9 14h2v2h-2zm-3 2h8v2H8z" })), Qv = a(({ items: e, label: t = "Display", labelDisplay: n = "responsive", placement: r = "bottom end", defaultOpen: i, className: a }, o) => {
|
|
15336
|
-
let s = u();
|
|
15336
|
+
let s = u(), c = e.findIndex((e) => !e.disabled);
|
|
15337
15337
|
return /* @__PURE__ */ C(md, {
|
|
15338
15338
|
defaultOpen: i,
|
|
15339
15339
|
children: [/* @__PURE__ */ C(Wi, {
|
|
@@ -15366,8 +15366,8 @@ var Zv = (e) => i("svg", Object.assign({
|
|
|
15366
15366
|
className: "eidotter-display-menu__panel",
|
|
15367
15367
|
children: /* @__PURE__ */ S("ul", {
|
|
15368
15368
|
className: "eidotter-display-menu__list",
|
|
15369
|
-
children: e.map((e) => {
|
|
15370
|
-
let
|
|
15369
|
+
children: e.map((e, t) => {
|
|
15370
|
+
let n = e.hint ? `${s}-${e.id}-hint` : void 0;
|
|
15371
15371
|
return /* @__PURE__ */ C("li", {
|
|
15372
15372
|
className: "eidotter-display-menu__row",
|
|
15373
15373
|
children: [/* @__PURE__ */ S(g_, {
|
|
@@ -15375,10 +15375,11 @@ var Zv = (e) => i("svg", Object.assign({
|
|
|
15375
15375
|
checked: e.checked,
|
|
15376
15376
|
onChange: e.onChange,
|
|
15377
15377
|
disabled: e.disabled,
|
|
15378
|
-
"aria-describedby":
|
|
15378
|
+
"aria-describedby": n,
|
|
15379
|
+
autoFocus: t === c,
|
|
15379
15380
|
className: "eidotter-display-menu__switch"
|
|
15380
15381
|
}), e.hint && /* @__PURE__ */ S("span", {
|
|
15381
|
-
id:
|
|
15382
|
+
id: n,
|
|
15382
15383
|
className: "eidotter-display-menu__hint",
|
|
15383
15384
|
children: e.hint
|
|
15384
15385
|
})]
|
|
@@ -19568,6 +19569,10 @@ var Rb = ({ title: e, date: t, intro: n, home: r, embedded: i = !1, children: a,
|
|
|
19568
19569
|
status: "canonical"
|
|
19569
19570
|
} },
|
|
19570
19571
|
changelog: [{
|
|
19572
|
+
version: "0.45.1",
|
|
19573
|
+
type: "changed",
|
|
19574
|
+
description: "Opening the panel focuses the first enabled switch, so Space toggles it without a Tab"
|
|
19575
|
+
}, {
|
|
19571
19576
|
version: "0.45.0",
|
|
19572
19577
|
type: "added",
|
|
19573
19578
|
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)"
|
|
@@ -20375,5 +20380,5 @@ function ax(e) {
|
|
|
20375
20380
|
return n;
|
|
20376
20381
|
}
|
|
20377
20382
|
// src/index.ts
|
|
20378
|
-
var ox = "0.45.
|
|
20383
|
+
var ox = "0.45.1";
|
|
20379
20384
|
export { Lb as AIText, uh as AccordionFill, Vb as AddressBlock, ch as Alert, h_ as Badge, qv as Bench, ib as BrandLockup, x_ as Breadcrumb, ph as Button, n_ as CalendarHeatmap, gh as Card, Ky as ChatContainer, Wy as ChatHistory, Gy as ChatInput, Uy as ChatMessage, _h as Checkbox, by as ChecklistRow, Ib as CmdPalette, vh as CommandPrompt, Eb as Connector, xy as CopyButton, qb as DatenschutzController, Zb as DatenschutzEncryption, Xb as DatenschutzFonts, Jb as DatenschutzHosting, Yb as DatenschutzPostHog, Qb as DatenschutzRights, qg as DecayStrip, zy as DesktopNav, Qv as DisplayMenu, pv as DosDialog, Mb as DosFigure, mh as DosWindow, fg as EmptyState, dy as FilterBar, Jy as Footer, tg as Gauge, pb as Header, o_ as HoldToComplete, eh as Icon, th as IconButton, Hb as ImpressumAddress, Ub as ImpressumContact, Gb as ImpressumLiabilityContent, Kb as ImpressumLiabilityLinks, Wb as ImpressumResponsible, my as InlineExpand, jb as InlineLink, c_ as Input, Iy as LabeledProgress, Fy as LedgerRow, Rb as LegalPage, mv as Lightbox, nb as Logo, lb as Mark, ug as Meter, mg as MeterGroup, By as MobileNav, $v as Modal, Vy as Nav, Ob as Notification, Xv as PageSection, Yv as PageShell, Eh as Progress, Oh as ProgressRing, Tg as RangeBar, E_ as RetroEffects, lh as Section, vy as SectionHeading, Py as Select, gy as Separator, jg as SeriesBars, Fh as Skeleton, ly as Stat, g_ as Switch, f_ as Tabs, Dv as Tag, kv as TagGroup, l_ as Terminal, Ly as TextScramble, Pv as TimelineContainer, Rv as TimelineFeed, j_ as TimelineNode, Wv as TimelinePage, Ig as VitalsStrip, rb as Wordmark, M_ as ZOOM_LEVELS, ex as componentRegistry, qy as defaultLegalLinks, tx as getComponentMeta, rx as getComponentsByConsumer, nx as getComponentsByOrigin, ax as getVariantConsumerMap, ix as getVariantsUsedBy, y_ as isSafeHref, fy as isSafeUrl, $b as projects, iy as useTextScramble, ox as version };
|