@lostgradient/cinder 0.25.0 → 0.26.0
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 +233 -0
- package/components.json +13 -6
- package/dist/components/accordion-item/accordion-item.css +0 -10
- package/dist/components/action-row/action-row.css +0 -9
- package/dist/components/alert/alert.css +0 -1
- package/dist/components/alert-dialog/index.js +2 -2
- package/dist/components/approval-card/index.js +2 -2
- package/dist/components/area-chart/index.js +2 -2
- package/dist/components/autocomplete/index.js +2 -2
- package/dist/components/avatar-group/avatar-group.css +0 -2
- package/dist/components/avatar-group/index.js +2 -2
- package/dist/components/backdrop/index.js +2 -2
- package/dist/components/bar-chart/index.js +2 -2
- package/dist/components/button/button.css +4 -4
- package/dist/components/button/button.variables.js +2 -2
- package/dist/components/card/card.css +0 -2
- package/dist/components/carousel/carousel.css +0 -5
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/code-block/code-block.css +0 -5
- 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/data-table.css +0 -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/feed-event/feed-event.css +0 -2
- package/dist/components/file-upload/file-upload.css +0 -5
- 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/kanban-board/kanban-board.css +0 -10
- package/dist/components/key-value-editor/index.css +1 -1
- package/dist/components/line-chart/index.js +2 -2
- package/dist/components/marquee/marquee.css +0 -2
- package/dist/components/matrix-chart/index.js +2 -2
- package/dist/components/menu-bar/index.js +3 -3
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.css +0 -26
- 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/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/radio-group/index.js +2 -2
- 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/selectable-row/selectable-row.css +0 -6
- package/dist/components/selection-popover/index.js +2 -2
- package/dist/components/share-card/index.js +2 -2
- package/dist/components/side-navigation/side-navigation.css +0 -1
- package/dist/components/sidebar/index.js +2 -2
- package/dist/components/speed-dial/index.js +2 -2
- package/dist/components/statistic/statistic.css +0 -8
- package/dist/components/statistic-group/index.js +2 -2
- package/dist/components/statistic-group/statistic-group.css +116 -69
- package/dist/components/status-dot/status-dot.css +0 -3
- package/dist/components/table/index.js +2 -2
- package/dist/components/table-of-contents/table-of-contents.css +0 -4
- 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/toggle/toggle.variables.js +2 -2
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/transfer-list/index.js +2 -2
- package/dist/components/tree/tree.css +0 -3
- 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 -2
- 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/accordion-item/accordion-item.css +0 -10
- package/src/components/action-row/action-row.css +0 -9
- package/src/components/alert/alert.css +0 -1
- package/src/components/avatar-group/avatar-group.css +0 -2
- package/src/components/button/button.css +4 -4
- package/src/components/button/button.variables.json +31 -1
- package/src/components/button/button.variables.ts +31 -1
- package/src/components/card/card.css +0 -2
- package/src/components/carousel/carousel.css +0 -5
- package/src/components/code-block/code-block.css +0 -5
- 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/data-table/data-table.css +0 -2
- package/src/components/dropdown/dropdown.svelte +73 -18
- package/src/components/dropdown-menu/dropdown-menu.svelte +63 -7
- package/src/components/feed-event/feed-event.css +0 -2
- package/src/components/file-upload/file-upload.css +0 -5
- package/src/components/find-bar/find-bar.css +9 -1
- package/src/components/input/input.css +95 -6
- package/src/components/input/input.svelte +44 -81
- package/src/components/kanban-board/kanban-board.css +0 -10
- package/src/components/marquee/marquee.css +0 -2
- package/src/components/menu-bar/menu-bar.svelte +12 -1
- package/src/components/modal/modal.css +0 -26
- package/src/components/multi-select/multi-select.svelte +7 -0
- package/src/components/navigation-bar/navigation-bar.svelte +82 -6
- package/src/components/selectable-row/selectable-row.css +0 -6
- package/src/components/selection-popover/selection-popover.svelte +24 -10
- package/src/components/share-card/share-card.svelte +24 -44
- package/src/components/side-navigation/side-navigation.css +0 -1
- package/src/components/speed-dial/speed-dial.svelte +23 -5
- package/src/components/statistic/statistic.css +0 -8
- package/src/components/statistic-group/statistic-group.css +116 -69
- package/src/components/statistic-group/statistic-group.examples.json +6 -0
- package/src/components/statistic-group/statistic-group.svelte +13 -1
- package/src/components/status-dot/status-dot.css +0 -3
- package/src/components/table-of-contents/table-of-contents.css +0 -4
- package/src/components/time-field/time-field.css +9 -8
- package/src/components/toast-region/toast-region.svelte +9 -0
- package/src/components/toggle/toggle.variables.json +1 -1
- package/src/components/toggle/toggle.variables.ts +4 -1
- package/src/components/tree/tree.css +0 -3
- 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 -2
- 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 +57 -22
- package/src/tokens/cinder.resolver.json +8 -0
- package/src/tokens/index.json +1 -1
- package/src/tokens/registry.generated.json +30 -4
- package/src/tokens/registry.generated.ts +32 -4
- package/src/tokens/resolved/dark-reduced-motion.json +47 -17
- package/src/tokens/resolved/dark.json +47 -17
- package/src/tokens/resolved/light-reduced-motion.json +48 -18
- package/src/tokens/resolved/light.json +48 -18
- package/src/tokens/sets/components.tokens.json +1 -1
- 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
|
@@ -3,12 +3,12 @@ export {};
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import { onDestroy } from 'svelte';
|
|
7
|
-
import { captureFocus, pushEscapeHandler } from '../../_internal/overlay.ts';
|
|
6
|
+
import { onDestroy, tick } from 'svelte';
|
|
8
7
|
import { classNames } from '../../utilities/class-names.ts';
|
|
9
|
-
import {
|
|
8
|
+
import { useReducedMotion } from '../../utilities/use-reduced-motion.svelte.ts';
|
|
10
9
|
import { setCommandListContext } from '../_internal/command-list-context.ts';
|
|
11
10
|
import { createCommandListState } from '../_internal/create-command-list-state.svelte.ts';
|
|
11
|
+
import { createSlidingDialogState } from '../_internal/create-sliding-dialog-state.svelte.ts';
|
|
12
12
|
let { open = $bindable(false), placeholder = 'Search…', label = 'Command palette', query = $bindable(''), onClose, triggerRef = null, items, empty, footer, class: className, } = $props();
|
|
13
13
|
// ── IDs ──────────────────────────────────────────────────────────────────
|
|
14
14
|
const baseId = $props.id();
|
|
@@ -16,95 +16,78 @@ const listboxId = `${baseId}-listbox`;
|
|
|
16
16
|
const inputId = `${baseId}-input`;
|
|
17
17
|
// ── DOM refs ─────────────────────────────────────────────────────────────
|
|
18
18
|
let dialogElement = $state();
|
|
19
|
+
let panelElement = $state();
|
|
19
20
|
let inputElement = $state();
|
|
20
|
-
|
|
21
|
-
// `mounted` is false during SSR. The dialog is rendered only when mounted
|
|
22
|
-
// (client) or when already open (SSR open=true). Matching modal.svelte.
|
|
23
|
-
let mounted = $state(false);
|
|
24
|
-
$effect(() => {
|
|
25
|
-
mounted = true;
|
|
26
|
-
});
|
|
27
|
-
// ── Focus capture ─────────────────────────────────────────────────────────
|
|
28
|
-
let capturedFocus = null;
|
|
21
|
+
const reducedMotion = useReducedMotion();
|
|
29
22
|
const commandList = createCommandListState(listboxId);
|
|
30
23
|
$effect(() => {
|
|
31
24
|
// Track query so this re-runs on every query change.
|
|
32
25
|
void query;
|
|
33
26
|
commandList.refreshRegistrationsReady();
|
|
34
27
|
});
|
|
35
|
-
// ──
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (isClosing)
|
|
58
|
-
return;
|
|
59
|
-
if (!open && !dialogElement?.open)
|
|
60
|
-
return;
|
|
61
|
-
isClosing = true;
|
|
62
|
-
open = false;
|
|
63
|
-
releaseEscape?.();
|
|
64
|
-
releaseEscape = null;
|
|
65
|
-
if (dialogElement?.open)
|
|
66
|
-
dialogElement.close();
|
|
67
|
-
returnFocus();
|
|
68
|
-
onClose?.();
|
|
69
|
-
isClosing = false;
|
|
70
|
-
}
|
|
71
|
-
// ── Open/close lifecycle ──────────────────────────────────────────────────
|
|
72
|
-
$effect(() => {
|
|
73
|
-
if (!dialogElement)
|
|
74
|
-
return;
|
|
75
|
-
if (open && !dialogElement.open) {
|
|
28
|
+
// ── Sliding-dialog lifecycle ────────────────────────────────────────────
|
|
29
|
+
// Adopts SlidingDialogState (the same mechanism Modal and Drawer use)
|
|
30
|
+
// rather than hand-rolling an exit lifecycle. Per OVERLAY-POLICY.md,
|
|
31
|
+
// "Transition lifecycle" > "The contract": the component renders
|
|
32
|
+
// data-cinder-closing on its animated panel for the full duration of the
|
|
33
|
+
// exit transition, and the shared waitForTransitionCompletion helper (used
|
|
34
|
+
// internally by SlidingDialogState) — not a fixed timeout — decides when
|
|
35
|
+
// the panel actually unmounts and the native dialog closes. This also
|
|
36
|
+
// gives the palette the counted lockBodyScroll() acquisition/release and
|
|
37
|
+
// the hydrated-gated SSR pattern it previously lacked (both tracked as
|
|
38
|
+
// OVERLAY-POLICY.md deviations under CIN-426, alongside this lifecycle
|
|
39
|
+
// gap itself).
|
|
40
|
+
const dialogState = createSlidingDialogState({
|
|
41
|
+
getOpen: () => open,
|
|
42
|
+
setOpen: (nextOpen) => {
|
|
43
|
+
open = nextOpen;
|
|
44
|
+
},
|
|
45
|
+
getDialogElement: () => dialogElement,
|
|
46
|
+
getPanelElement: () => panelElement,
|
|
47
|
+
getReducedMotion: () => reducedMotion.current,
|
|
48
|
+
getTriggerRef: () => triggerRef,
|
|
49
|
+
onOpen: () => {
|
|
76
50
|
query = '';
|
|
77
51
|
commandList.resetActiveItem();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
52
|
+
// Deferred: the panel subtree (and the inputElement binding) has not
|
|
53
|
+
// flushed yet in the same effect that first sets renderPanel — mirrors
|
|
54
|
+
// focusDialogBodyUnlessAutofocused's own tick() deferral for
|
|
55
|
+
// Modal/Drawer in create-sliding-dialog-state.svelte.ts.
|
|
56
|
+
void tick().then(() => {
|
|
57
|
+
if (!open)
|
|
58
|
+
return;
|
|
59
|
+
inputElement?.focus();
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
onClosed: () => onClose?.(),
|
|
63
|
+
});
|
|
64
|
+
$effect(() => {
|
|
65
|
+
dialogState.markHydrated();
|
|
66
|
+
});
|
|
67
|
+
$effect(() => {
|
|
68
|
+
dialogState.syncOpenState();
|
|
88
69
|
});
|
|
89
|
-
// Release escape handler on component destroy to prevent leaks.
|
|
90
70
|
onDestroy(() => {
|
|
91
|
-
|
|
92
|
-
releaseEscape = null;
|
|
71
|
+
dialogState.destroy();
|
|
93
72
|
});
|
|
94
73
|
// ── Dialog event handlers ─────────────────────────────────────────────────
|
|
95
|
-
//
|
|
96
|
-
//
|
|
74
|
+
// Matches modal.svelte's oncancel wiring: the native <dialog> fires
|
|
75
|
+
// `cancel` before `close` when Escape is pressed. Prevent the browser's
|
|
76
|
+
// own dialog-closing behavior so the sole close path is
|
|
77
|
+
// dialogState.requestClose() → the exit transition → the real `close`
|
|
78
|
+
// event → dialogState.handleClose().
|
|
97
79
|
function handleCancel(event) {
|
|
98
|
-
|
|
80
|
+
dialogState.handleNativeCancel(event);
|
|
99
81
|
}
|
|
100
|
-
// The `close` event fires when the dialog actually closes (any
|
|
82
|
+
// The `close` event fires when the native dialog actually closes (any
|
|
83
|
+
// path) — SlidingDialogState.handleClose() is the single place that
|
|
84
|
+
// releases the scroll lock and escape-stack registration, restores focus,
|
|
85
|
+
// and reports completion via onClosed.
|
|
101
86
|
function handleClose() {
|
|
102
|
-
|
|
87
|
+
dialogState.handleClose();
|
|
103
88
|
}
|
|
104
89
|
function handleBackdropClick(event) {
|
|
105
|
-
|
|
106
|
-
closePalette();
|
|
107
|
-
}
|
|
90
|
+
dialogState.handleBackdropClick(event);
|
|
108
91
|
}
|
|
109
92
|
// ── Keyboard routing ──────────────────────────────────────────────────────
|
|
110
93
|
function handleKeydown(event) {
|
|
@@ -123,10 +106,12 @@ $effect(() => {
|
|
|
123
106
|
});
|
|
124
107
|
// ── Context ───────────────────────────────────────────────────────────────
|
|
125
108
|
setCommandListContext(commandList.createContext());
|
|
126
|
-
const showEmpty = $derived(
|
|
109
|
+
const showEmpty = $derived(dialogState.hydrated &&
|
|
110
|
+
commandList.registrationsReady &&
|
|
111
|
+
commandList.registrations.length === 0);
|
|
127
112
|
</script>
|
|
128
113
|
|
|
129
|
-
{#if
|
|
114
|
+
{#if dialogState.hydrated}
|
|
130
115
|
<dialog
|
|
131
116
|
bind:this={dialogElement}
|
|
132
117
|
class="cinder-command-palette"
|
|
@@ -136,8 +121,13 @@ const showEmpty = $derived(mounted && commandList.registrationsReady && commandL
|
|
|
136
121
|
onclose={handleClose}
|
|
137
122
|
onclick={handleBackdropClick}
|
|
138
123
|
>
|
|
139
|
-
{#if
|
|
140
|
-
<div
|
|
124
|
+
{#if dialogState.renderPanel}
|
|
125
|
+
<div
|
|
126
|
+
bind:this={panelElement}
|
|
127
|
+
class={classNames('cinder-command-palette__panel', className)}
|
|
128
|
+
data-cinder-closing={dialogState.isClosing ? '' : undefined}
|
|
129
|
+
inert={dialogState.isClosing}
|
|
130
|
+
>
|
|
141
131
|
<div class="cinder-command-palette__search">
|
|
142
132
|
<svg
|
|
143
133
|
class="cinder-command-palette__search-icon"
|
|
@@ -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;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
2
|
@layer cinder.components {
|
|
3
3
|
.cinder-file-upload {
|
|
4
|
-
--cinder-file-upload-border-color: var(--cinder-border);
|
|
5
|
-
--cinder-file-upload-background: var(--cinder-surface);
|
|
6
|
-
--cinder-file-upload-progress-background: var(--cinder-surface-inset);
|
|
7
|
-
--cinder-file-upload-progress-fill: var(--cinder-accent-solid);
|
|
8
|
-
|
|
9
4
|
display: grid;
|
|
10
5
|
gap: var(--cinder-space-3);
|
|
11
6
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
|