@lostgradient/cinder 0.25.1 → 0.26.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/CHANGELOG.md +237 -0
- package/components.json +13 -6
- package/dist/components/alert-dialog/index.js +2 -2
- package/dist/components/approval-card/index.js +2 -2
- package/dist/components/area-chart/area-chart.css +23 -0
- package/dist/components/area-chart/index.js +2 -2
- package/dist/components/autocomplete/index.js +2 -2
- package/dist/components/avatar-group/index.js +2 -2
- package/dist/components/backdrop/index.js +2 -2
- package/dist/components/bar-chart/bar-chart.css +23 -0
- package/dist/components/bar-chart/index.js +2 -2
- package/dist/components/button/button.css +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/code-block/index.js +2 -2
- package/dist/components/color-field/index.js +2 -2
- package/dist/components/combobox/index.js +2 -2
- package/dist/components/command-menu/index.js +2 -2
- package/dist/components/command-palette/command-palette.css +50 -46
- package/dist/components/command-palette/index.js +2 -2
- package/dist/components/confirm-dialog/index.js +2 -2
- package/dist/components/context-menu/index.js +2 -2
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-range-field/index.js +2 -2
- package/dist/components/drawer/index.js +2 -2
- package/dist/components/dropdown/index.js +2 -2
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/find-bar/find-bar.css +9 -1
- package/dist/components/focus-trap/index.js +2 -2
- package/dist/components/form-field/index.js +2 -2
- package/dist/components/guidance-region/index.css +1 -1
- package/dist/components/hover-card/index.js +2 -2
- package/dist/components/inline-confirm/index.js +2 -2
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.css +95 -6
- package/dist/components/invocation-rule-builder/index.js +2 -2
- package/dist/components/json-editor/index.js +2 -2
- package/dist/components/json-schema-editor/index.js +4 -4
- package/dist/components/key-value-editor/index.css +1 -1
- package/dist/components/line-chart/index.js +2 -2
- package/dist/components/line-chart/line-chart.css +23 -0
- package/dist/components/matrix-chart/index.js +2 -2
- package/dist/components/mega-menu/mega-menu.css +7 -1
- package/dist/components/menu-bar/index.js +3 -3
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal-region/index.css +1 -1
- package/dist/components/multi-select/index.js +2 -2
- package/dist/components/navigation-bar/index.js +2 -2
- package/dist/components/parameter-field/index.js +2 -2
- package/dist/components/parameter-field/parameter-field.css +7 -1
- package/dist/components/permission-matrix/index.js +2 -2
- package/dist/components/policy-lock/index.js +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/popover.css +86 -0
- package/dist/components/radio-group/index.js +2 -2
- package/dist/components/resizable-panels/resizable-panels.css +10 -7
- package/dist/components/schedule-builder/index.js +2 -2
- package/dist/components/schema-form/index.js +2 -2
- package/dist/components/scroll-area/index.js +2 -2
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/select.css +12 -2
- package/dist/components/selection-popover/index.js +2 -2
- package/dist/components/share-card/index.js +2 -2
- package/dist/components/sidebar/index.js +2 -2
- package/dist/components/slider/slider.css +7 -1
- package/dist/components/sortable-list/sortable-list.css +11 -7
- package/dist/components/speed-dial/index.js +2 -2
- package/dist/components/statistic-group/index.js +2 -2
- package/dist/components/statistic-group/statistic-group.css +116 -66
- package/dist/components/table/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/time-field/index.js +2 -2
- package/dist/components/time-field/time-field.css +9 -8
- package/dist/components/toast-region/index.js +2 -2
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/transfer-list/index.js +2 -2
- package/dist/components/virtual-list/_internal/adaptive-overscan.d.ts +87 -0
- package/dist/components/virtual-list/_internal/edge-proximity.d.ts +75 -0
- package/dist/components/virtual-list/_internal/frame-scheduler.d.ts +76 -0
- package/dist/components/virtual-list/_internal/geometry.d.ts +170 -0
- package/dist/components/virtual-list/_internal/list-semantics.d.ts +93 -0
- package/dist/components/virtual-list/_internal/measurement-window.d.ts +125 -0
- package/dist/components/virtual-list/_internal/reverse-order.d.ts +87 -0
- package/dist/components/virtual-list/_internal/scroll-restoration.d.ts +98 -0
- package/dist/components/virtual-list/_internal/sticky-items.d.ts +48 -0
- package/dist/components/virtual-list/_internal/virtual-list-measurement-store.svelte.d.ts +69 -0
- package/dist/components/virtual-list/index.d.ts +1 -1
- package/dist/components/virtual-list/index.js +2 -2
- package/dist/components/virtual-list/virtual-list.css +153 -0
- package/dist/components/virtual-list/virtual-list.schema.js +69 -6
- package/dist/components/virtual-list/virtual-list.svelte.d.ts +11 -8
- package/dist/components/virtual-list/virtual-list.types.d.ts +177 -4
- package/dist/index.browser.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -18
- package/dist/server/components/alert-dialog/index.js +1 -1
- package/dist/server/components/approval-card/index.js +1 -1
- package/dist/server/components/area-chart/index.js +1 -1
- package/dist/server/components/autocomplete/index.js +1 -1
- package/dist/server/components/avatar-group/index.js +1 -1
- package/dist/server/components/backdrop/index.js +1 -1
- package/dist/server/components/bar-chart/index.js +1 -1
- package/dist/server/components/checkbox/index.js +1 -1
- package/dist/server/components/code-block/index.js +1 -1
- package/dist/server/components/color-field/index.js +1 -1
- package/dist/server/components/combobox/index.js +1 -1
- package/dist/server/components/command-menu/index.js +1 -1
- package/dist/server/components/command-palette/index.js +2 -2
- package/dist/server/components/confirm-dialog/index.js +1 -1
- package/dist/server/components/context-menu/index.js +1 -1
- package/dist/server/components/data-table/index.js +1 -1
- package/dist/server/components/date-picker/index.js +1 -1
- package/dist/server/components/date-range-field/index.js +1 -1
- package/dist/server/components/drawer/index.js +1 -1
- package/dist/server/components/dropdown/index.js +1 -1
- package/dist/server/components/dropdown-menu/index.js +2 -2
- package/dist/server/components/focus-trap/index.js +1 -1
- package/dist/server/components/form-field/index.js +1 -1
- package/dist/server/components/hover-card/index.js +1 -1
- package/dist/server/components/inline-confirm/index.js +1 -1
- package/dist/server/components/input/index.js +1 -1
- package/dist/server/components/invocation-rule-builder/index.js +1 -1
- package/dist/server/components/json-editor/index.js +1 -1
- package/dist/server/components/json-schema-editor/index.js +1 -1
- package/dist/server/components/line-chart/index.js +1 -1
- package/dist/server/components/matrix-chart/index.js +1 -1
- package/dist/server/components/menu-bar/index.js +2 -2
- package/dist/server/components/modal/index.js +1 -1
- package/dist/server/components/multi-select/index.js +1 -1
- package/dist/server/components/navigation-bar/index.js +2 -2
- package/dist/server/components/parameter-field/index.js +1 -1
- package/dist/server/components/permission-matrix/index.js +1 -1
- package/dist/server/components/policy-lock/index.js +1 -1
- package/dist/server/components/popover/index.js +1 -1
- package/dist/server/components/radio-group/index.js +1 -1
- package/dist/server/components/schedule-builder/index.js +1 -1
- package/dist/server/components/schema-form/index.js +1 -1
- package/dist/server/components/scroll-area/index.js +1 -1
- package/dist/server/components/select/index.js +1 -1
- package/dist/server/components/selection-popover/index.js +1 -1
- package/dist/server/components/share-card/index.js +1 -1
- package/dist/server/components/sidebar/index.js +1 -1
- package/dist/server/components/speed-dial/index.js +2 -2
- package/dist/server/components/statistic-group/index.js +1 -1
- package/dist/server/components/table/index.js +1 -1
- package/dist/server/components/textarea/index.js +1 -1
- package/dist/server/components/time-field/index.js +1 -1
- package/dist/server/components/toast-region/index.js +1 -1
- package/dist/server/components/tooltip/index.js +1 -1
- package/dist/server/components/transfer-list/index.js +1 -1
- package/dist/server/components/virtual-list/index.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/{index.server-skq0f5sr.js → index.server-0jw25w9w.js} +1 -1
- package/dist/server/index.server-0kk20wvp.js +4 -0
- package/dist/server/{index.server-fzsqdajc.js → index.server-2awq6q9m.js} +1 -1
- package/dist/server/{index.server-e4hmhaeh.js → index.server-3xwvw6w2.js} +3 -3
- package/dist/server/{index.server-95h7xy01.js → index.server-428dh2t9.js} +2 -2
- package/dist/server/{index.server-jd88r74m.js → index.server-5dq66aja.js} +2 -2
- package/dist/server/{index.server-dvwfhf77.js → index.server-5s94r0kk.js} +2 -2
- package/dist/server/{index.server-qv6z5ta3.js → index.server-80qgcjnm.js} +1 -1
- package/dist/server/{index.server-7k2732ky.js → index.server-81abtrsw.js} +1 -1
- package/dist/server/{index.server-csmqnx5w.js → index.server-83q1gv2c.js} +1 -1
- package/dist/server/{index.server-qw8k9rjg.js → index.server-8fyav10d.js} +1 -1
- package/dist/server/{index.server-4dgjj4k1.js → index.server-8h5caecr.js} +2 -2
- package/dist/server/{index.server-emyqytmm.js → index.server-90n8sd9e.js} +1 -1
- package/dist/server/{index.server-0xrdyzvh.js → index.server-99penx1m.js} +1 -1
- package/dist/server/{index.server-p94j3jah.js → index.server-9g9d15z1.js} +1 -1
- package/dist/server/{index.server-xp9hkc81.js → index.server-9kbdx511.js} +1 -1
- package/dist/server/index.server-a2yhk45s.js +3 -0
- package/dist/server/{index.server-g8d2m2tk.js → index.server-acq55gjs.js} +1 -1
- package/dist/server/{index.server-ewze54tv.js → index.server-afjftjmr.js} +1 -1
- package/dist/server/{index.server-ejyye4gv.js → index.server-bfed6a8a.js} +1 -1
- package/dist/server/{index.server-z5ng08q2.js → index.server-c1746s0z.js} +1 -1
- package/dist/server/{index.server-gt1tfc1w.js → index.server-dmeztywe.js} +1 -1
- package/dist/server/{index.server-kzsppq0n.js → index.server-dyj3jdx9.js} +1 -1
- package/dist/server/index.server-dz92zvx6.js +4 -0
- package/dist/server/{index.server-3md8kdcr.js → index.server-e6682k08.js} +1 -1
- package/dist/server/{index.server-t1pshh65.js → index.server-ewkv461x.js} +1 -1
- package/dist/server/{index.server-zfgwhtmp.js → index.server-fa449wd3.js} +1 -1
- package/dist/server/{index.server-1kgwayct.js → index.server-fhfypmgw.js} +1 -1
- package/dist/server/{index.server-s4z8hsby.js → index.server-ge4adxs2.js} +1 -1
- package/dist/server/{index.server-68xyfsg3.js → index.server-gggkq22y.js} +2 -2
- package/dist/server/{index.server-acgwdamx.js → index.server-j52rbk57.js} +1 -1
- package/dist/server/{index.server-z0nwftx6.js → index.server-jm89hxfb.js} +1 -1
- package/dist/server/{index.server-xa98r8p2.js → index.server-jw0v64se.js} +1 -1
- package/dist/server/index.server-m321p69g.js +3 -0
- package/dist/server/{index.server-xyervw3d.js → index.server-m7q2tc41.js} +1 -1
- package/dist/server/{index.server-tnrxy86j.js → index.server-mak7dmj2.js} +1 -1
- package/dist/server/{index.server-n5g5h5k1.js → index.server-mw5r2524.js} +1 -1
- package/dist/server/{index.server-caf7s6m7.js → index.server-nwq1cg55.js} +1 -1
- package/dist/server/{index.server-3wdvs0wr.js → index.server-p423fy4q.js} +2 -2
- package/dist/server/{index.server-ks7fvwxt.js → index.server-prk5syj2.js} +1 -1
- package/dist/server/{index.server-6w9fp018.js → index.server-q4hytsq3.js} +1 -1
- package/dist/server/{index.server-5w2qw8fm.js → index.server-q597a1ck.js} +1 -1
- package/dist/server/{index.server-fz1pkvda.js → index.server-qgne9v2w.js} +1 -1
- package/dist/server/{index.server-1f2app32.js → index.server-rvdavf92.js} +1 -1
- package/dist/server/index.server-rwq20a22.js +3 -0
- package/dist/server/{index.server-0rvmnrw2.js → index.server-s9tjs45r.js} +1 -1
- package/dist/server/{index.server-cm2prec7.js → index.server-sqgxyfsw.js} +1 -1
- package/dist/server/{index.server-v6777tgn.js → index.server-t761nwvb.js} +1 -1
- package/dist/server/index.server-tbds8nwq.js +4 -0
- package/dist/server/index.server-tyhta5n3.js +3 -0
- package/dist/server/{index.server-yw7rah51.js → index.server-v5dxham4.js} +1 -1
- package/dist/server/index.server-va98cpyf.js +3 -0
- package/dist/server/index.server-vq1k69xt.js +3 -0
- package/dist/server/{index.server-egd355s6.js → index.server-wnf9btp7.js} +2 -2
- package/dist/server/{index.server-sjcbaztf.js → index.server-y3zgdtbv.js} +1 -1
- package/dist/server/{index.server-4tjtgzf9.js → index.server-y6vtbmyj.js} +1 -1
- package/dist/server/{index.server-2p2mjzzb.js → index.server-zff2qp1v.js} +1 -1
- package/dist/server/tokens/registry.generated.js +2 -2
- package/dist/tokens/registry.generated.js +2 -2
- package/package.json +2 -2
- package/src/_internal/form-field-frame.svelte +5 -0
- package/src/_internal/overlay.ts +14 -1
- package/src/components/_internal/create-command-list-state.svelte.ts +4 -0
- package/src/components/area-chart/area-chart.css +23 -0
- package/src/components/bar-chart/bar-chart.css +23 -0
- package/src/components/button/button.css +1 -1
- package/src/components/command-menu/command-menu.svelte +63 -7
- package/src/components/command-palette/command-palette.css +50 -46
- package/src/components/command-palette/command-palette.svelte +68 -78
- package/src/components/dropdown/dropdown.svelte +73 -18
- package/src/components/dropdown-menu/dropdown-menu.svelte +63 -7
- package/src/components/find-bar/find-bar.css +9 -1
- package/src/components/hover-card/hover-card.examples.json +11 -4
- package/src/components/input/input.css +95 -6
- package/src/components/input/input.svelte +44 -81
- package/src/components/line-chart/line-chart.css +23 -0
- package/src/components/mega-menu/mega-menu.css +7 -1
- package/src/components/menu-bar/menu-bar.svelte +12 -1
- package/src/components/multi-select/multi-select.svelte +7 -0
- package/src/components/navigation-bar/navigation-bar.svelte +82 -6
- package/src/components/parameter-field/parameter-field.css +7 -1
- package/src/components/popover/popover.css +86 -0
- package/src/components/resizable-panels/resizable-panels.css +10 -7
- package/src/components/select/select.css +12 -2
- package/src/components/selection-popover/selection-popover.svelte +24 -10
- package/src/components/share-card/share-card.svelte +24 -44
- package/src/components/slider/slider.css +7 -1
- package/src/components/sortable-list/sortable-list.css +11 -7
- package/src/components/speed-dial/speed-dial.svelte +23 -5
- package/src/components/statistic-group/statistic-group.css +116 -66
- package/src/components/statistic-group/statistic-group.examples.json +6 -0
- package/src/components/statistic-group/statistic-group.svelte +13 -1
- package/src/components/time-field/time-field.css +9 -8
- package/src/components/toast-region/toast-region.svelte +9 -0
- package/src/components/virtual-list/_internal/adaptive-overscan.ts +248 -0
- package/src/components/virtual-list/_internal/edge-proximity.ts +130 -0
- package/src/components/virtual-list/_internal/frame-scheduler.ts +136 -0
- package/src/components/virtual-list/_internal/geometry.ts +236 -0
- package/src/components/virtual-list/_internal/list-semantics.ts +151 -0
- package/src/components/virtual-list/_internal/measurement-window.ts +300 -0
- package/src/components/virtual-list/_internal/reverse-order.ts +146 -0
- package/src/components/virtual-list/_internal/scroll-restoration.ts +209 -0
- package/src/components/virtual-list/_internal/sticky-items.ts +111 -0
- package/src/components/virtual-list/_internal/virtual-list-measurement-store.svelte.ts +145 -0
- package/src/components/virtual-list/index.ts +7 -1
- package/src/components/virtual-list/virtual-list.css +153 -0
- package/src/components/virtual-list/virtual-list.examples.json +42 -0
- package/src/components/virtual-list/virtual-list.schema.json +53 -3
- package/src/components/virtual-list/virtual-list.schema.ts +64 -3
- package/src/components/virtual-list/virtual-list.svelte +1527 -36
- package/src/components/virtual-list/virtual-list.types.ts +181 -4
- package/src/index.ts +3 -0
- package/src/styles/tokens-base.css +29 -21
- package/src/tokens/cinder.resolver.json +8 -0
- package/src/tokens/index.json +1 -1
- package/src/tokens/registry.generated.json +29 -3
- package/src/tokens/registry.generated.ts +31 -3
- package/src/tokens/resolved/dark-reduced-motion.json +46 -16
- package/src/tokens/resolved/dark.json +46 -16
- package/src/tokens/resolved/light-reduced-motion.json +47 -17
- package/src/tokens/resolved/light.json +47 -17
- package/src/tokens/sets/semantic.tokens.json +120 -30
- package/src/tokens/themes/dark.tokens.json +115 -19
- package/src/tokens/themes/light.tokens.json +51 -3
- package/dist/server/index.server-191cnacw.js +0 -3
- package/dist/server/index.server-25dqx151.js +0 -3
- package/dist/server/index.server-77jyqvbv.js +0 -4
- package/dist/server/index.server-bgjrzr70.js +0 -3
- package/dist/server/index.server-khsp90vh.js +0 -3
- package/dist/server/index.server-ryk2pgbe.js +0 -4
- package/dist/server/index.server-tajr81bm.js +0 -3
- package/dist/server/index.server-vjzcrw3d.js +0 -4
- package/dist/server/index.server-zg3fx1n1.js +0 -3
|
@@ -5,6 +5,7 @@ export {};
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { onDestroy } from 'svelte';
|
|
7
7
|
import { createAnchoredOverlayExitState } from '../../_internal/anchored-overlay-exit.svelte.ts';
|
|
8
|
+
import { pushEscapeHandler } from '../../_internal/overlay.ts';
|
|
8
9
|
import { createClickOutside } from '../../utilities/attachments.ts';
|
|
9
10
|
import { classNames } from '../../utilities/class-names.ts';
|
|
10
11
|
import { useReducedMotion } from '../../utilities/use-reduced-motion.svelte.ts';
|
|
@@ -103,24 +104,79 @@ $effect(() => {
|
|
|
103
104
|
CSS.supports('position-anchor: --x') &&
|
|
104
105
|
CSS.supports('top: anchor(bottom)');
|
|
105
106
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
107
|
+
// Escape ownership (CIN-428).
|
|
108
|
+
//
|
|
109
|
+
// Compound / modern branch (`compoundOpen`): covered transitively — the
|
|
110
|
+
// inner DropdownMenu registers its own escape-stack handler unconditionally
|
|
111
|
+
// on `context.isOpen`, which here reads `compoundOpen`, so it fires
|
|
112
|
+
// regardless of where focus sits (including on the trigger). No fallback
|
|
113
|
+
// handling is needed here anymore.
|
|
114
|
+
//
|
|
115
|
+
// Legacy `usesLegacySnippetApi` branch has two sub-branches sharing the
|
|
116
|
+
// `open` prop, each registering directly below: the non-popover
|
|
117
|
+
// `exitState.renderPanel` fallback gets a straightforward registration
|
|
118
|
+
// that dismisses; the native `supportsPopover` branch registers WITHOUT
|
|
119
|
+
// calling `preventDefault()` so the browser's own `popover="auto"`
|
|
120
|
+
// light-dismiss keeps working, and its `ontoggle` handler keeps `open` in
|
|
121
|
+
// sync once the browser actually closes it.
|
|
122
|
+
// Same element the aria-expanded effect above resolves: the legacy
|
|
123
|
+
// snippet API has no bound trigger reference (unlike `compoundTriggerElement`),
|
|
124
|
+
// so the first focusable descendant of the consumer-supplied `trigger`
|
|
125
|
+
// snippet's wrapper is the closest thing to one.
|
|
126
|
+
function resolveLegacyTriggerElement() {
|
|
127
|
+
return (triggerWrapper?.querySelector('button, a, [tabindex]:not([tabindex="-1"]), input, select') ?? null);
|
|
128
|
+
}
|
|
129
|
+
function dismissLegacyFallbackMenu(event) {
|
|
130
|
+
event?.preventDefault();
|
|
131
|
+
event?.stopPropagation();
|
|
132
|
+
open = false;
|
|
133
|
+
// Matches the compound fallback's `dismissMenu()` (dropdown-menu.svelte):
|
|
134
|
+
// this branch fully owns the close (no native light-dismiss to defer
|
|
135
|
+
// to), so restore focus to the trigger unconditionally, the same as
|
|
136
|
+
// dropdown.a11y.md's Escape-returns-focus-to-trigger contract requires —
|
|
137
|
+
// otherwise, when focus had tabbed outside the open menu before Escape,
|
|
138
|
+
// it's left on whatever was outside instead.
|
|
139
|
+
resolveLegacyTriggerElement()?.focus();
|
|
123
140
|
}
|
|
141
|
+
$effect(() => {
|
|
142
|
+
if (!usesLegacySnippetApi || supportsPopover || !open)
|
|
143
|
+
return;
|
|
144
|
+
const releaseEscape = pushEscapeHandler(dismissLegacyFallbackMenu);
|
|
145
|
+
return releaseEscape;
|
|
146
|
+
});
|
|
147
|
+
// NOTE: `supportsPopover` is almost certainly `false` under happy-dom (no
|
|
148
|
+
// `showPopover`/CSS Anchor Positioning support in the test DOM — see the
|
|
149
|
+
// NOTE atop dropdown.test.ts), so this sub-branch cannot be meaningfully
|
|
150
|
+
// unit-tested in this repo's suite today. Registering here still matters
|
|
151
|
+
// in a real browser: without an entry on the stack while this popover is
|
|
152
|
+
// open, a LOWER escape-stack overlay would incorrectly react to the same
|
|
153
|
+
// Escape keystroke (our LIFO stack only ever invokes the top-most
|
|
154
|
+
// handler). The callback never calls `preventDefault()` — the browser's
|
|
155
|
+
// native close-request path for the top-layer popover is left completely
|
|
156
|
+
// alone — but it DOES call `stopPropagation()`: the two are independent
|
|
157
|
+
// (propagation only controls whether the event keeps reaching other
|
|
158
|
+
// listeners in its path; only `preventDefault()` cancels the browser's own
|
|
159
|
+
// default action), so this keeps a focused descendant's own keydown
|
|
160
|
+
// listener, or a page-level Escape handler, from also reacting to the same
|
|
161
|
+
// keystroke while this top-most overlay is supposed to own it.
|
|
162
|
+
$effect(() => {
|
|
163
|
+
if (!usesLegacySnippetApi || !supportsPopover || !open)
|
|
164
|
+
return;
|
|
165
|
+
const releaseEscape = pushEscapeHandler((event) => {
|
|
166
|
+
event?.stopPropagation();
|
|
167
|
+
// Native focus restoration only returns focus to the invoker if focus
|
|
168
|
+
// was still *inside* the popover at the moment it closes; if focus had
|
|
169
|
+
// already moved outside before Escape, native restoration doesn't
|
|
170
|
+
// apply, leaving focus on the unrelated element instead of the
|
|
171
|
+
// trigger — contrary to dropdown.a11y.md:14's Escape contract. Restore
|
|
172
|
+
// it ourselves in that case only, the same conditional restoration the
|
|
173
|
+
// compound branch's (dropdown-menu.svelte) native-popover handler uses.
|
|
174
|
+
if (menuElement && !menuElement.contains(document.activeElement)) {
|
|
175
|
+
resolveLegacyTriggerElement()?.focus();
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
return releaseEscape;
|
|
179
|
+
});
|
|
124
180
|
const dismissOnOutsideClick = $derived(createClickOutside({
|
|
125
181
|
handler: () => {
|
|
126
182
|
open = false;
|
|
@@ -180,7 +236,6 @@ onDestroy(() => {
|
|
|
180
236
|
{id}
|
|
181
237
|
class={classNames('cinder-dropdown', customClassName)}
|
|
182
238
|
data-cinder-placement={placement}
|
|
183
|
-
onkeydown={handleKeydown}
|
|
184
239
|
{@attach dismissOnOutsideClick}
|
|
185
240
|
{...rest}
|
|
186
241
|
>
|
|
@@ -6,6 +6,7 @@ export {};
|
|
|
6
6
|
import { tick } from 'svelte';
|
|
7
7
|
import { createAnchoredOverlay } from '../../_internal/anchored-overlay.svelte.ts';
|
|
8
8
|
import { getLocaleContext } from '../../_internal/locale-context.ts';
|
|
9
|
+
import { pushEscapeHandler } from '../../_internal/overlay.ts';
|
|
9
10
|
import { observeTextDirection, resolveTextDirection } from '../../_internal/text-direction.ts';
|
|
10
11
|
import { classNames } from '../../utilities/class-names.ts';
|
|
11
12
|
import { findTypeaheadMatch, isTypeaheadKey, TypeaheadBuffer, } from '../../utilities/typeahead.ts';
|
|
@@ -107,17 +108,72 @@ function focusMenuItem(index) {
|
|
|
107
108
|
const item = items.at(resolvedIndex);
|
|
108
109
|
item?.focus();
|
|
109
110
|
}
|
|
111
|
+
// Escape ownership (CIN-428). The local, target-scoped Escape branch is
|
|
112
|
+
// deleted — the escape-stack registration below is the single Escape
|
|
113
|
+
// dispatch path, and it fires whenever this menu is open regardless of
|
|
114
|
+
// where focus sits. The `target.closest('[role="menu"]')` scoping in
|
|
115
|
+
// handleKeydown below still applies to ArrowDown/Up/Home/End/typeahead —
|
|
116
|
+
// Escape no longer needs it, since the shared stack itself arbitrates
|
|
117
|
+
// between nested/sibling overlays via LIFO ordering (MenuBar's staged
|
|
118
|
+
// submenu-then-menubar close falls out of this naturally: each open
|
|
119
|
+
// DropdownMenu instance — submenu, then top-level — registers separately,
|
|
120
|
+
// so the submenu's registration sits above the top-level's on the stack).
|
|
121
|
+
//
|
|
122
|
+
// Split by `context.supportsPopover`, mirroring dropdown.svelte's own
|
|
123
|
+
// legacy native-popover branch: the fallback (non-popover) path dismisses
|
|
124
|
+
// directly. The native-popover path must NOT call `preventDefault()` —
|
|
125
|
+
// doing so would cancel the browser's own Escape close-request for the
|
|
126
|
+
// top-layer `popover="auto"` element, leaving it visually open (and
|
|
127
|
+
// `ontoggle` never firing to sync `context.isOpen` back to false) even
|
|
128
|
+
// though this handler had already called `setOpen(false)`. Registering a
|
|
129
|
+
// no-op still matters: without an entry here, a lower escape-stack overlay
|
|
130
|
+
// would incorrectly react to the same keystroke, since the stack only
|
|
131
|
+
// invokes the top-most handler. The browser's native light-dismiss closes
|
|
132
|
+
// the popover on its own, and `handleToggle`'s `ontoggle` listener keeps
|
|
133
|
+
// `context.isOpen` in sync once it does.
|
|
134
|
+
function dismissMenu(event) {
|
|
135
|
+
event?.preventDefault();
|
|
136
|
+
event?.stopPropagation();
|
|
137
|
+
setOpen(false);
|
|
138
|
+
context.focusTrigger();
|
|
139
|
+
}
|
|
140
|
+
$effect(() => {
|
|
141
|
+
if (context.supportsPopover || !context.isOpen)
|
|
142
|
+
return;
|
|
143
|
+
const releaseEscape = pushEscapeHandler(dismissMenu);
|
|
144
|
+
return releaseEscape;
|
|
145
|
+
});
|
|
146
|
+
$effect(() => {
|
|
147
|
+
if (!context.supportsPopover || !context.isOpen)
|
|
148
|
+
return;
|
|
149
|
+
const releaseEscape = pushEscapeHandler((event) => {
|
|
150
|
+
// Still must not preventDefault (see above) — the browser's own
|
|
151
|
+
// Escape close-request is what actually hides the popover. It DOES
|
|
152
|
+
// still call stopPropagation(): the two are independent (propagation
|
|
153
|
+
// only controls whether the event keeps reaching other listeners in
|
|
154
|
+
// its path; only preventDefault() cancels the browser's own default
|
|
155
|
+
// action), so stopping propagation here is safe and is what keeps a
|
|
156
|
+
// focused descendant's own keydown listener, or a page-level Escape
|
|
157
|
+
// handler, from also reacting to the same keystroke while the
|
|
158
|
+
// top-most overlay's stack registration is supposed to own it.
|
|
159
|
+
event?.stopPropagation();
|
|
160
|
+
// Native focus restoration only returns focus to the invoker if focus
|
|
161
|
+
// was still *inside* the popover at the moment it closes; if focus had
|
|
162
|
+
// already moved outside (e.g. the user tabbed out while the menu was
|
|
163
|
+
// open), native restoration doesn't apply and focus would otherwise
|
|
164
|
+
// be left on whatever was outside — breaking dropdown.a11y.md's
|
|
165
|
+
// Escape-returns-focus-to-trigger contract. Restore it ourselves in
|
|
166
|
+
// that case only; when focus is still inside, leave it to native.
|
|
167
|
+
if (menuElement && !menuElement.contains(document.activeElement)) {
|
|
168
|
+
context.focusTrigger();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return releaseEscape;
|
|
172
|
+
});
|
|
110
173
|
function handleKeydown(event) {
|
|
111
174
|
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
112
175
|
if (target?.closest('[role="menu"]') !== menuElement)
|
|
113
176
|
return;
|
|
114
|
-
if (event.key === 'Escape') {
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
event.stopPropagation();
|
|
117
|
-
setOpen(false);
|
|
118
|
-
context.focusTrigger();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
177
|
const itemsArray = getOwnedMenuItems();
|
|
122
178
|
if (!itemsArray.length)
|
|
123
179
|
return;
|
|
@@ -14,7 +14,15 @@
|
|
|
14
14
|
border-block-end: 1px solid var(--cinder-border-muted);
|
|
15
15
|
background: var(--cinder-surface-raised);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/* Direct child, not a descendant selector: FindBar's own FormField renders
|
|
18
|
+
`.cinder-form-field` as a direct child of `.cinder-find-bar`, but since
|
|
19
|
+
CIN-511 the Input inside it *also* renders its own nested
|
|
20
|
+
`.cinder-form-field` (Input always frames itself when it has field
|
|
21
|
+
context now, with label/description/error simply absent). A descendant
|
|
22
|
+
selector would match that inner frame too, applying `flex`/
|
|
23
|
+
`min-inline-size` to it a second time inside the outer frame's own flex
|
|
24
|
+
column and distorting the row's layout. */
|
|
25
|
+
.cinder-find-bar > .cinder-form-field {
|
|
18
26
|
flex: 1 1 12rem;
|
|
19
27
|
min-inline-size: min(12rem, 100%);
|
|
20
28
|
}
|
|
@@ -3,29 +3,36 @@
|
|
|
3
3
|
"component": "hover-card",
|
|
4
4
|
"import": "@lostgradient/cinder/hover-card",
|
|
5
5
|
"examples": [
|
|
6
|
+
{
|
|
7
|
+
"id": "arrow-surface-probe",
|
|
8
|
+
"title": "Arrow indicator",
|
|
9
|
+
"description": "Opens with its pointer arrow visible, pointing back at the trigger that opened it.",
|
|
10
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder/hover-card';\n\n let open = $state(false);\n</script>\n\n<div style=\"display: flex; gap: 0.5rem; align-items: center; padding-block-start: 4rem;\">\n <Button onclick={() => (open = true)}>Show arrow probe</Button>\n <Button onclick={() => (open = false)}>Hide arrow probe</Button>\n\n <HoverCard bind:open arrowVisible>\n {#snippet trigger()}\n <Button variant=\"ghost\">Arrow probe</Button>\n {/snippet}\n\n <strong>Arrow probe</strong>\n <p>Fixed-open panel with its arrow visible for pixel sampling.</p>\n </HoverCard>\n</div>\n"
|
|
11
|
+
},
|
|
6
12
|
{
|
|
7
13
|
"id": "basic",
|
|
8
14
|
"title": "Basic hover card",
|
|
9
15
|
"description": "A rich non-interactive preview that opens on hover or focus.",
|
|
10
|
-
"
|
|
16
|
+
"featured": true,
|
|
17
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder/hover-card';\n</script>\n\n<HoverCard>\n {#snippet trigger()}\n <Button variant=\"ghost\">Ada Lovelace</Button>\n {/snippet}\n\n <strong>Ada Lovelace</strong>\n <p>Mathematician, writer, and early computing collaborator.</p>\n</HoverCard>\n"
|
|
11
18
|
},
|
|
12
19
|
{
|
|
13
20
|
"id": "controlled",
|
|
14
21
|
"title": "Controlled visibility",
|
|
15
22
|
"description": "The open state can be bound and driven externally, letting another control show or hide the card without waiting on hover or focus delays.",
|
|
16
|
-
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder';\n\n let open = $state(false);\n</script>\n\n<div style=\"display: flex; gap: 0.5rem; align-items: center;\">\n <Button onclick={() => (open = true)}>Show</Button>\n <Button onclick={() => (open = false)}>Hide</Button>\n\n <HoverCard bind:open>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-14</Button>\n {/snippet}\n\n <strong>CIN-14</strong>\n <p>Track down the intermittent double-submit on the settings form.</p>\n </HoverCard>\n</div>\n"
|
|
23
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder/hover-card';\n\n let open = $state(false);\n</script>\n\n<div style=\"display: flex; gap: 0.5rem; align-items: center;\">\n <Button onclick={() => (open = true)}>Show</Button>\n <Button onclick={() => (open = false)}>Hide</Button>\n\n <HoverCard bind:open>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-14</Button>\n {/snippet}\n\n <strong>CIN-14</strong>\n <p>Track down the intermittent double-submit on the settings form.</p>\n </HoverCard>\n</div>\n"
|
|
17
24
|
},
|
|
18
25
|
{
|
|
19
26
|
"id": "delays",
|
|
20
27
|
"title": "Custom hover delays",
|
|
21
28
|
"description": "Hover cards can tune open and close delay for denser interfaces.",
|
|
22
|
-
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder';\n</script>\n\n<HoverCard openDelay={100} closeDelay={300}>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-42</Button>\n {/snippet}\n\n <strong>CIN-42</strong>\n <p>Investigate overlay stacking behavior in nested surfaces.</p>\n</HoverCard>\n"
|
|
29
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder/hover-card';\n</script>\n\n<HoverCard openDelay={100} closeDelay={300}>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-42</Button>\n {/snippet}\n\n <strong>CIN-42</strong>\n <p>Investigate overlay stacking behavior in nested surfaces.</p>\n</HoverCard>\n"
|
|
23
30
|
},
|
|
24
31
|
{
|
|
25
32
|
"id": "instant-reopen",
|
|
26
33
|
"title": "Instant reopen",
|
|
27
34
|
"description": "A zero open delay reopens the card immediately on re-entry, useful for adjacent triggers meant to feel like one continuous surface.",
|
|
28
|
-
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder';\n</script>\n\n<HoverCard openDelay={0}>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-99</Button>\n {/snippet}\n\n <strong>CIN-99</strong>\n <p>Reproduce the flaky drag handle in the tree view's reorder mode.</p>\n</HoverCard>\n"
|
|
35
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { HoverCard } from '@lostgradient/cinder/hover-card';\n</script>\n\n<HoverCard openDelay={0}>\n {#snippet trigger()}\n <Button variant=\"ghost\">CIN-99</Button>\n {/snippet}\n\n <strong>CIN-99</strong>\n <p>Reproduce the flaky drag handle in the tree view's reorder mode.</p>\n</HoverCard>\n"
|
|
29
36
|
}
|
|
30
37
|
]
|
|
31
38
|
}
|
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
* INPUT
|
|
7
7
|
* ======================================== */
|
|
8
8
|
|
|
9
|
+
/* One recipe for the invalid border's hover step, shared by the three
|
|
10
|
+
* surfaces that can paint that edge: the bare input, the host wrapper that
|
|
11
|
+
* takes ownership when an addon appears, and the group. Deriving it three
|
|
12
|
+
* times over is what pushed this file past its raw-color allowance, and a
|
|
13
|
+
* single declaration keeps the three in step by construction — they are the
|
|
14
|
+
* same edge, and a divergence between them would be a bug rather than a
|
|
15
|
+
* choice.
|
|
16
|
+
*/
|
|
17
|
+
.cinder-input,
|
|
18
|
+
.cinder-input-host,
|
|
19
|
+
.cinder-input-group {
|
|
20
|
+
--_cinder-input-invalid-border-hover: oklch(
|
|
21
|
+
from var(--cinder-status-danger-solid) calc(l - 0.06) c h
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/* ----------------------------------------
|
|
10
26
|
* Field wrapper
|
|
11
27
|
* ---------------------------------------- */
|
|
@@ -168,7 +184,7 @@
|
|
|
168
184
|
|
|
169
185
|
@media (hover: hover) {
|
|
170
186
|
.cinder-input[aria-invalid='true']:hover:not(:disabled) {
|
|
171
|
-
border-color:
|
|
187
|
+
border-color: var(--_cinder-input-invalid-border-hover);
|
|
172
188
|
}
|
|
173
189
|
}
|
|
174
190
|
|
|
@@ -190,6 +206,64 @@
|
|
|
190
206
|
margin: 0;
|
|
191
207
|
}
|
|
192
208
|
|
|
209
|
+
/* ----------------------------------------
|
|
210
|
+
* Input host (no addons)
|
|
211
|
+
* ---------------------------------------- */
|
|
212
|
+
|
|
213
|
+
/* The control wrapper is always rendered so the native <input> keeps one
|
|
214
|
+
position in the tree when an addon appears or disappears (see
|
|
215
|
+
input.svelte). Without addons the wrapper is `.cinder-input-host` instead of
|
|
216
|
+
`.cinder-input-group`, and `display: contents` removes its box: the input
|
|
217
|
+
takes part in the parent's layout exactly as a bare element did, so a
|
|
218
|
+
flex-row parent still sizes the input itself rather than a shrink-wrapped
|
|
219
|
+
div around it. The host still carries `data-cinder-full-width` so ancestors
|
|
220
|
+
that detect a full-width control by direct child (access-gate.css) keep
|
|
221
|
+
matching. */
|
|
222
|
+
.cinder-input-host {
|
|
223
|
+
display: contents;
|
|
224
|
+
/* The host and the group are the SAME element: when an addon appears the
|
|
225
|
+
class swaps, and `.cinder-input-group`'s border-color transition runs
|
|
226
|
+
from whatever the host computed. Pin the host's resting border colours
|
|
227
|
+
to the group's so the appearing border does not fade in from
|
|
228
|
+
`currentcolor` (the initial value). A boxless element paints nothing,
|
|
229
|
+
so these are inert until the swap. Same source order as the group's
|
|
230
|
+
state rules, so disabled wins over invalid here too. */
|
|
231
|
+
border-color: var(--cinder-border);
|
|
232
|
+
}
|
|
233
|
+
/* The host is hovered whenever the input inside it is (`:hover` matches an
|
|
234
|
+
ancestor of the hovered element even when that ancestor has no box), so
|
|
235
|
+
the hover colours are mirrored too — with the same precedence as the
|
|
236
|
+
group's rules below: invalid beats resting, hover beats both, disabled
|
|
237
|
+
beats everything. Sticky-hover suppression on touch, as for the group. */
|
|
238
|
+
@media (hover: hover) {
|
|
239
|
+
.cinder-input-host:hover:not([data-disabled]) {
|
|
240
|
+
border-color: var(--cinder-border-strong);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
.cinder-input-host[data-invalid] {
|
|
244
|
+
--_cinder-input-ring: var(--cinder-status-danger-solid);
|
|
245
|
+
border-color: var(--cinder-status-danger-solid);
|
|
246
|
+
}
|
|
247
|
+
@media (hover: hover) {
|
|
248
|
+
.cinder-input-host[data-invalid]:hover:not([data-disabled]) {
|
|
249
|
+
border-color: var(--_cinder-input-invalid-border-hover);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
.cinder-input-host[data-disabled] {
|
|
253
|
+
border-color: var(--cinder-border-muted);
|
|
254
|
+
}
|
|
255
|
+
/* Ring ownership moves from the input to the wrapper when an addon appears.
|
|
256
|
+
The host is boxless and paints nothing, but its computed box-shadow is
|
|
257
|
+
what the group's box-shadow transition would start from, so pin it to the
|
|
258
|
+
group's ring while the input inside is focused — the same token math as
|
|
259
|
+
`.cinder-input-group:focus-within` below. */
|
|
260
|
+
.cinder-input-host:focus-within {
|
|
261
|
+
box-shadow:
|
|
262
|
+
0 0 0 var(--cinder-ring-offset) var(--cinder-ring-offset-color),
|
|
263
|
+
0 0 0 calc(var(--cinder-ring-offset) + var(--cinder-ring-width))
|
|
264
|
+
var(--_cinder-input-ring, var(--cinder-ring-color));
|
|
265
|
+
}
|
|
266
|
+
|
|
193
267
|
/* ----------------------------------------
|
|
194
268
|
* Input group (leading / trailing addons)
|
|
195
269
|
* ---------------------------------------- */
|
|
@@ -207,14 +281,29 @@
|
|
|
207
281
|
box-shadow var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
208
282
|
}
|
|
209
283
|
|
|
210
|
-
/* Inner input: strip its own chrome, inherit the group's
|
|
284
|
+
/* Inner input: strip its own chrome, inherit the group's. `border-style`
|
|
285
|
+
rather than the `border` shorthand: the shorthand would reset the input's
|
|
286
|
+
computed border-color to `currentcolor`, and because the input is the
|
|
287
|
+
same element before and after an addon is removed, its own border-color
|
|
288
|
+
transition would then run from the text colour when its border comes
|
|
289
|
+
back. Leaving the colour alone keeps it equal on both sides of the swap,
|
|
290
|
+
for the invalid and disabled states too. */
|
|
211
291
|
.cinder-input-group > .cinder-input {
|
|
212
|
-
border: none;
|
|
292
|
+
border-style: none;
|
|
213
293
|
border-radius: 0;
|
|
214
294
|
background: transparent;
|
|
215
295
|
flex: 1 1 auto;
|
|
216
296
|
min-width: 0;
|
|
217
297
|
padding-inline: var(--cinder-space-3);
|
|
298
|
+
/* The input keeps its own focus ring VALUE inside the group and the clip
|
|
299
|
+
hides it, rather than setting `box-shadow: none`: the input is the same
|
|
300
|
+
element before and after an addon is removed, and a value change would
|
|
301
|
+
run its box-shadow transition — the ring fading in while the group's
|
|
302
|
+
ring vanished. With the value unchanged and only the clip toggling
|
|
303
|
+
(not a transitioned property), ring ownership moves between the input
|
|
304
|
+
and the wrapper without any animation. The clip is the border box, so
|
|
305
|
+
nothing the input paints itself is affected. */
|
|
306
|
+
clip-path: inset(0);
|
|
218
307
|
}
|
|
219
308
|
|
|
220
309
|
/* When an addon is present on a given side, the input trims its padding on
|
|
@@ -231,9 +320,9 @@
|
|
|
231
320
|
}
|
|
232
321
|
|
|
233
322
|
.cinder-input-group > .cinder-input:focus-visible {
|
|
234
|
-
box-shadow: none;
|
|
235
323
|
/* cinder-focus-ring-owner: parent — the .cinder-input-group wrapper paints
|
|
236
|
-
the ring for the whole grouped control
|
|
324
|
+
the ring for the whole grouped control; the input's own ring is clipped
|
|
325
|
+
away above, not zeroed, so the swap does not animate it. */
|
|
237
326
|
outline: none;
|
|
238
327
|
}
|
|
239
328
|
|
|
@@ -267,7 +356,7 @@
|
|
|
267
356
|
}
|
|
268
357
|
@media (hover: hover) {
|
|
269
358
|
.cinder-input-group--invalid:hover:not(.cinder-input-group--disabled) {
|
|
270
|
-
border-color:
|
|
359
|
+
border-color: var(--_cinder-input-invalid-border-hover);
|
|
271
360
|
}
|
|
272
361
|
}
|
|
273
362
|
|
|
@@ -38,6 +38,14 @@ const hasTrailing = $derived(!!trailing || isNativeDateInput);
|
|
|
38
38
|
const hasGroupWrapper = $derived(!!leading || hasTrailing);
|
|
39
39
|
const isInvalid = $derived(resolvedAriaInvalid === 'true');
|
|
40
40
|
const groupModifiers = $derived(classNames(leading && 'cinder-input-group--leading', hasTrailing && 'cinder-input-group--trailing', rendersNativeDateIcon && 'cinder-input-group--native-date', resolvedDisabled && 'cinder-input-group--disabled', isInvalid && 'cinder-input-group--invalid'));
|
|
41
|
+
// One class string for the control wrapper in both of its states. The
|
|
42
|
+
// wrapper itself is always rendered — via `controlClass` on FormFieldFrame's
|
|
43
|
+
// own `.cinder-form-field__control` div (see the `{#if context}` block
|
|
44
|
+
// below), so the two states differ only by class, never by a wrapper
|
|
45
|
+
// switching in or out.
|
|
46
|
+
const hostClass = $derived(hasGroupWrapper
|
|
47
|
+
? classNames('cinder-input-group', groupClassName, groupModifiers)
|
|
48
|
+
: 'cinder-input-host');
|
|
41
49
|
let inputNode = $state();
|
|
42
50
|
let resetSyncTimeout;
|
|
43
51
|
function syncValueAfterFormReset() {
|
|
@@ -112,51 +120,6 @@ function handleInput(event) {
|
|
|
112
120
|
/>
|
|
113
121
|
{/snippet}
|
|
114
122
|
|
|
115
|
-
{#snippet control()}
|
|
116
|
-
{#if hasGroupWrapper}
|
|
117
|
-
<div
|
|
118
|
-
class={classNames('cinder-input-group', groupClassName, groupModifiers)}
|
|
119
|
-
data-leading={leading ? '' : undefined}
|
|
120
|
-
data-trailing={hasTrailing ? '' : undefined}
|
|
121
|
-
data-native-date={rendersNativeDateIcon ? '' : undefined}
|
|
122
|
-
data-disabled={resolvedDisabled ? '' : undefined}
|
|
123
|
-
data-invalid={isInvalid ? '' : undefined}
|
|
124
|
-
data-cinder-full-width
|
|
125
|
-
>
|
|
126
|
-
{#if leading}
|
|
127
|
-
<span
|
|
128
|
-
class={classNames(
|
|
129
|
-
'cinder-input-group__leading',
|
|
130
|
-
!leadingInteractive && 'cinder-_truncate',
|
|
131
|
-
)}
|
|
132
|
-
aria-hidden={leadingInteractive ? undefined : 'true'}>{@render leading()}</span
|
|
133
|
-
>
|
|
134
|
-
{/if}
|
|
135
|
-
|
|
136
|
-
{@render inputElement()}
|
|
137
|
-
|
|
138
|
-
{#if trailing}
|
|
139
|
-
<span
|
|
140
|
-
class={classNames(
|
|
141
|
-
'cinder-input-group__trailing',
|
|
142
|
-
!trailingInteractive && 'cinder-_truncate',
|
|
143
|
-
)}
|
|
144
|
-
aria-hidden={trailingInteractive ? undefined : 'true'}>{@render trailing()}</span
|
|
145
|
-
>
|
|
146
|
-
{:else if rendersNativeDateIcon}
|
|
147
|
-
<span
|
|
148
|
-
class="cinder-input-group__trailing cinder-input-group__date-icon cinder-_truncate"
|
|
149
|
-
aria-hidden="true"
|
|
150
|
-
>
|
|
151
|
-
{@render calendarIcon()}
|
|
152
|
-
</span>
|
|
153
|
-
{/if}
|
|
154
|
-
</div>
|
|
155
|
-
{:else}
|
|
156
|
-
{@render inputElement()}
|
|
157
|
-
{/if}
|
|
158
|
-
{/snippet}
|
|
159
|
-
|
|
160
123
|
{#snippet leadingAdornment()}
|
|
161
124
|
{#if leading}
|
|
162
125
|
<span
|
|
@@ -180,37 +143,39 @@ function handleInput(event) {
|
|
|
180
143
|
{/snippet}
|
|
181
144
|
|
|
182
145
|
{#if context}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
|
|
146
|
+
<!-- Always render the nested frame here, even when label/description/error
|
|
147
|
+
are all unset — collapsing what used to be a second `{#if}` arm switch
|
|
148
|
+
between this frame and rendering the control snippet bare. Switching
|
|
149
|
+
arms as those props became truthy destroyed and recreated the native
|
|
150
|
+
<input> (same failure mode CIN-500 fixed one level up, for the
|
|
151
|
+
leading/trailing wrapper). label/description/error are simply
|
|
152
|
+
absent/undefined on the frame when unset, so there is exactly one code
|
|
153
|
+
path for the context-truthy case. See CIN-511. -->
|
|
154
|
+
<FormFieldFrame
|
|
155
|
+
{id}
|
|
156
|
+
label={context.labelId ? undefined : label}
|
|
157
|
+
{labelVisible}
|
|
158
|
+
{description}
|
|
159
|
+
{error}
|
|
160
|
+
required={resolvedRequired}
|
|
161
|
+
disabled={resolvedDisabled}
|
|
162
|
+
class="cinder-input-field"
|
|
163
|
+
data-cinder-variant={variant}
|
|
164
|
+
fullWidth
|
|
165
|
+
descriptionClass="cinder-input-field__description"
|
|
166
|
+
errorClass="cinder-input-field__error"
|
|
167
|
+
descriptionId={field.ownDescriptionId}
|
|
168
|
+
errorId={field.ownErrorId}
|
|
169
|
+
control={inputElement}
|
|
170
|
+
controlClass={hostClass}
|
|
171
|
+
controlLeading={!!leading}
|
|
172
|
+
controlTrailing={hasTrailing}
|
|
173
|
+
controlNativeDate={rendersNativeDateIcon}
|
|
174
|
+
controlDisabled={resolvedDisabled}
|
|
175
|
+
controlInvalid={isInvalid}
|
|
176
|
+
before={leadingAdornment}
|
|
177
|
+
after={trailingAdornment}
|
|
178
|
+
/>
|
|
214
179
|
{:else}
|
|
215
180
|
<FormFieldFrame
|
|
216
181
|
{id}
|
|
@@ -226,15 +191,13 @@ function handleInput(event) {
|
|
|
226
191
|
descriptionClass="cinder-input-field__description"
|
|
227
192
|
errorClass="cinder-input-field__error"
|
|
228
193
|
control={inputElement}
|
|
229
|
-
controlClass={
|
|
230
|
-
? classNames('cinder-input-group', groupClassName, groupModifiers)
|
|
231
|
-
: undefined}
|
|
194
|
+
controlClass={hostClass}
|
|
232
195
|
controlLeading={!!leading}
|
|
233
196
|
controlTrailing={hasTrailing}
|
|
234
197
|
controlNativeDate={rendersNativeDateIcon}
|
|
235
198
|
controlDisabled={resolvedDisabled}
|
|
236
199
|
controlInvalid={isInvalid}
|
|
237
|
-
before={
|
|
238
|
-
after={
|
|
200
|
+
before={leadingAdornment}
|
|
201
|
+
after={trailingAdornment}
|
|
239
202
|
/>
|
|
240
203
|
{/if}
|
|
@@ -36,7 +36,30 @@
|
|
|
36
36
|
padding: var(--cinder-space-1) var(--cinder-space-2);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/*
|
|
40
|
+
* CIN-603: a toggled-off series is still an ENABLED control (the user
|
|
41
|
+
* presses it to bring the series back), so its `border.control` boundary
|
|
42
|
+
* stays subject to WCAG 1.4.11's 3:1 floor. The previous `opacity: 0.55`
|
|
43
|
+
* lived on the button itself, which multiplied the border's alpha along
|
|
44
|
+
* with everything else (~26% effective, well under the floor). Scoping the
|
|
45
|
+
* dimming to the swatch dot instead leaves the border at `border.control`'s
|
|
46
|
+
* full, undiluted alpha.
|
|
47
|
+
*
|
|
48
|
+
* The label's color sources `--_cinder-chart-muted` (the same chart-local
|
|
49
|
+
* token every other "muted" chart element in this file already uses), not
|
|
50
|
+
* the global `--cinder-text-muted` token -- a consumer-supplied
|
|
51
|
+
* `theme.muted` has to keep reaching this label, or it stops matching the
|
|
52
|
+
* rest of a custom chart theme. Its own default is `currentColor`
|
|
53
|
+
* (`chart-model-utilities`'s `theme?.muted ?? 'currentColor'`), so with no
|
|
54
|
+
* consumer theme the label reads at full, undimmed contrast -- the
|
|
55
|
+
* swatch's own `opacity: 0.55` below is what still marks the series as
|
|
56
|
+
* toggled off.
|
|
57
|
+
*/
|
|
39
58
|
.cinder-line-chart__legend button[aria-pressed='false'] {
|
|
59
|
+
color: var(--_cinder-chart-muted, currentColor);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.cinder-line-chart__legend button[aria-pressed='false'] span {
|
|
40
63
|
opacity: 0.55;
|
|
41
64
|
}
|
|
42
65
|
|
|
@@ -44,10 +44,16 @@
|
|
|
44
44
|
box-shadow: 0 0 0 var(--cinder-ring-width) var(--cinder-ring-color);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/*
|
|
48
|
+
* CIN-603: this track is a persistent state indicator (it shows which item
|
|
49
|
+
* the active-indicator animation is tracking), so it moved from
|
|
50
|
+
* `border.muted` (a 1.4:1 decorative-hairline tier) to `border.control`
|
|
51
|
+
* (the 3:1 functional tier).
|
|
52
|
+
*/
|
|
47
53
|
.cinder-mega-menu__indicator-track {
|
|
48
54
|
position: relative;
|
|
49
55
|
height: 2px;
|
|
50
|
-
background: var(--cinder-border
|
|
56
|
+
background: var(--cinder-border);
|
|
51
57
|
border-radius: var(--cinder-radius-full);
|
|
52
58
|
overflow: hidden;
|
|
53
59
|
}
|
|
@@ -419,7 +419,18 @@ function handleTriggerKeydown(event, index) {
|
|
|
419
419
|
// Only consume Escape when a menu or submenu is actually open. On a closed
|
|
420
420
|
// menubar item, swallowing Escape (preventDefault + a no-op closeAll) would
|
|
421
421
|
// block an enclosing overlay or page-level Escape handler from ever running.
|
|
422
|
-
|
|
422
|
+
//
|
|
423
|
+
// `defaultPrevented` guard (CIN-428 hazard): DropdownMenu's own
|
|
424
|
+
// escape-stack registration runs at the window capture phase, before this
|
|
425
|
+
// bubble-phase trigger listener ever sees the key. In the normal case it
|
|
426
|
+
// already preventDefault()s + stopPropagation()s, so this branch never
|
|
427
|
+
// even runs for that keystroke — this guard is defense-in-depth for any
|
|
428
|
+
// path where the event still reaches here with defaultPrevented already
|
|
429
|
+
// true, so this doesn't run a redundant/conflicting closeAll() on top of
|
|
430
|
+
// whatever the stack handler already did.
|
|
431
|
+
if (event.key === 'Escape' &&
|
|
432
|
+
!event.defaultPrevented &&
|
|
433
|
+
(openMenuIndex !== null || openSubmenuKey !== null)) {
|
|
423
434
|
event.preventDefault();
|
|
424
435
|
closeAll();
|
|
425
436
|
return;
|