@solid2-aria/core 0.0.1 → 0.1.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/README.md +14 -0
- package/dist/NOTICE.txt +33 -11
- package/dist/browser/actiongroup/create-action-group.js +2 -1
- package/dist/browser/actiongroup/create-action-group.js.map +1 -1
- package/dist/browser/combobox/create-combo-box.js +2 -2
- package/dist/browser/combobox/create-combo-box.js.map +1 -1
- package/dist/browser/dnd/drag-preview.js +7 -8
- package/dist/browser/dnd/drag-preview.js.map +1 -1
- package/dist/browser/focus/focus-scope.js +2 -2
- package/dist/browser/focus/focus-scope.js.map +1 -1
- package/dist/browser/focus/virtual-focus.d.ts +1 -0
- package/dist/browser/focus/virtual-focus.js +20 -5
- package/dist/browser/focus/virtual-focus.js.map +1 -1
- package/dist/browser/grid/create-grid-cell.js +4 -4
- package/dist/browser/grid/create-grid-cell.js.map +1 -1
- package/dist/browser/gridlist/create-grid-list-item.js +3 -3
- package/dist/browser/gridlist/create-grid-list-item.js.map +1 -1
- package/dist/browser/interactions/create-hover.js +6 -3
- package/dist/browser/interactions/create-hover.js.map +1 -1
- package/dist/browser/interactions/create-press.js +5 -4
- package/dist/browser/interactions/create-press.js.map +1 -1
- package/dist/browser/interactions/utils.js +4 -3
- package/dist/browser/interactions/utils.js.map +1 -1
- package/dist/browser/landmark/create-landmark.js +2 -2
- package/dist/browser/landmark/create-landmark.js.map +1 -1
- package/dist/browser/overlays/aria-hide-outside.js +5 -3
- package/dist/browser/overlays/aria-hide-outside.js.map +1 -1
- package/dist/browser/overlays/calculate-position.js +3 -3
- package/dist/browser/overlays/calculate-position.js.map +1 -1
- package/dist/browser/overlays/create-modal.js +15 -18
- package/dist/browser/overlays/create-modal.js.map +1 -1
- package/dist/browser/overlays/create-prevent-scroll.js +3 -3
- package/dist/browser/overlays/create-prevent-scroll.js.map +1 -1
- package/dist/browser/overlays/overlay.js +7 -8
- package/dist/browser/overlays/overlay.js.map +1 -1
- package/dist/browser/select/create-select.js +1 -1
- package/dist/browser/select/create-select.js.map +1 -1
- package/dist/browser/select/hidden-select.js +61 -64
- package/dist/browser/select/hidden-select.js.map +1 -1
- package/dist/browser/selection/create-selectable-item.js +2 -2
- package/dist/browser/selection/create-selectable-item.js.map +1 -1
- package/dist/browser/selection/create-type-select.js +11 -3
- package/dist/browser/selection/create-type-select.js.map +1 -1
- package/dist/browser/selection/list-keyboard-delegate.js +1 -1
- package/dist/browser/selection/list-keyboard-delegate.js.map +1 -1
- package/dist/browser/tokenfield/create-token-field.js +3 -3
- package/dist/browser/tokenfield/create-token-field.js.map +1 -1
- package/dist/browser/tokenfield/create-token.js +2 -1
- package/dist/browser/tokenfield/create-token.js.map +1 -1
- package/dist/browser/toolbar/create-toolbar.js +2 -2
- package/dist/browser/toolbar/create-toolbar.js.map +1 -1
- package/dist/browser/utils/dom-helpers.d.ts +2 -15
- package/dist/browser/utils/dom-helpers.js +1 -28
- package/dist/browser/utils/dom-helpers.js.map +1 -1
- package/dist/browser/utils/dom-value.js +2 -1
- package/dist/browser/utils/dom-value.js.map +1 -1
- package/dist/browser/utils/get-scroll-parent.js +3 -2
- package/dist/browser/utils/get-scroll-parent.js.map +1 -1
- package/dist/browser/utils/get-scroll-parents.js +2 -1
- package/dist/browser/utils/get-scroll-parents.js.map +1 -1
- package/dist/browser/utils/is-element-visible.js +3 -1
- package/dist/browser/utils/is-element-visible.js.map +1 -1
- package/dist/browser/utils/is-focusable.js +2 -1
- package/dist/browser/utils/is-focusable.js.map +1 -1
- package/dist/browser/utils/shadowdom/dom-functions.d.ts +8 -0
- package/dist/browser/utils/shadowdom/dom-functions.js +26 -7
- package/dist/browser/utils/shadowdom/dom-functions.js.map +1 -1
- package/dist/browser/utils/shadowdom/shadow-tree-walker.js +1 -1
- package/dist/browser/utils/shadowdom/shadow-tree-walker.js.map +1 -1
- package/dist/browser/utils/type-helpers.d.ts +42 -0
- package/dist/browser/utils/type-helpers.js +55 -0
- package/dist/browser/utils/type-helpers.js.map +1 -0
- package/dist/server/actiongroup/create-action-group.js +2 -1
- package/dist/server/actiongroup/create-action-group.js.map +1 -1
- package/dist/server/combobox/create-combo-box.js +2 -2
- package/dist/server/combobox/create-combo-box.js.map +1 -1
- package/dist/server/dnd/drag-preview.js +9 -12
- package/dist/server/dnd/drag-preview.js.map +1 -1
- package/dist/server/focus/focus-scope.js +2 -2
- package/dist/server/focus/focus-scope.js.map +1 -1
- package/dist/server/focus/virtual-focus.js +20 -5
- package/dist/server/focus/virtual-focus.js.map +1 -1
- package/dist/server/grid/create-grid-cell.js +4 -4
- package/dist/server/grid/create-grid-cell.js.map +1 -1
- package/dist/server/gridlist/create-grid-list-item.js +3 -3
- package/dist/server/gridlist/create-grid-list-item.js.map +1 -1
- package/dist/server/interactions/create-hover.js +6 -3
- package/dist/server/interactions/create-hover.js.map +1 -1
- package/dist/server/interactions/create-press.js +5 -4
- package/dist/server/interactions/create-press.js.map +1 -1
- package/dist/server/interactions/utils.js +4 -3
- package/dist/server/interactions/utils.js.map +1 -1
- package/dist/server/landmark/create-landmark.js +2 -2
- package/dist/server/landmark/create-landmark.js.map +1 -1
- package/dist/server/overlays/aria-hide-outside.js +5 -3
- package/dist/server/overlays/aria-hide-outside.js.map +1 -1
- package/dist/server/overlays/calculate-position.js +3 -3
- package/dist/server/overlays/calculate-position.js.map +1 -1
- package/dist/server/overlays/create-modal.js +7 -27
- package/dist/server/overlays/create-modal.js.map +1 -1
- package/dist/server/overlays/create-prevent-scroll.js +3 -3
- package/dist/server/overlays/create-prevent-scroll.js.map +1 -1
- package/dist/server/overlays/overlay.js +8 -18
- package/dist/server/overlays/overlay.js.map +1 -1
- package/dist/server/select/create-select.js +1 -1
- package/dist/server/select/create-select.js.map +1 -1
- package/dist/server/select/hidden-select.js +85 -138
- package/dist/server/select/hidden-select.js.map +1 -1
- package/dist/server/selection/create-selectable-item.js +2 -2
- package/dist/server/selection/create-selectable-item.js.map +1 -1
- package/dist/server/selection/create-type-select.js +11 -3
- package/dist/server/selection/create-type-select.js.map +1 -1
- package/dist/server/selection/list-keyboard-delegate.js +1 -1
- package/dist/server/selection/list-keyboard-delegate.js.map +1 -1
- package/dist/server/tokenfield/create-token-field.js +3 -3
- package/dist/server/tokenfield/create-token-field.js.map +1 -1
- package/dist/server/tokenfield/create-token.js +2 -1
- package/dist/server/tokenfield/create-token.js.map +1 -1
- package/dist/server/toolbar/create-toolbar.js +2 -2
- package/dist/server/toolbar/create-toolbar.js.map +1 -1
- package/dist/server/utils/dom-helpers.js +1 -28
- package/dist/server/utils/dom-helpers.js.map +1 -1
- package/dist/server/utils/dom-value.js +2 -1
- package/dist/server/utils/dom-value.js.map +1 -1
- package/dist/server/utils/get-scroll-parent.js +3 -2
- package/dist/server/utils/get-scroll-parent.js.map +1 -1
- package/dist/server/utils/get-scroll-parents.js +2 -1
- package/dist/server/utils/get-scroll-parents.js.map +1 -1
- package/dist/server/utils/is-element-visible.js +3 -1
- package/dist/server/utils/is-element-visible.js.map +1 -1
- package/dist/server/utils/is-focusable.js +2 -1
- package/dist/server/utils/is-focusable.js.map +1 -1
- package/dist/server/utils/shadowdom/dom-functions.js +26 -7
- package/dist/server/utils/shadowdom/dom-functions.js.map +1 -1
- package/dist/server/utils/shadowdom/shadow-tree-walker.js +1 -1
- package/dist/server/utils/shadowdom/shadow-tree-walker.js.map +1 -1
- package/dist/server/utils/type-helpers.js +55 -0
- package/dist/server/utils/type-helpers.js.map +1 -0
- package/dist/server/virtualizer/scroll-view.js +3 -1
- package/dist/server/virtualizer/scroll-view.js.map +1 -1
- package/package.json +16 -10
package/README.md
CHANGED
|
@@ -2,8 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Solid 2 accessibility primitives ported from Adobe React Spectrum's `packages/react-aria/src`. The upstream reference revision and attribution are recorded in [NOTICE.txt](./dist/NOTICE.txt).
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add @solid2-aria/core solid-js@next @solidjs/web@next
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createButton } from "@solid2-aria/core";
|
|
15
|
+
```
|
|
16
|
+
|
|
5
17
|
Factories use the `create` prefix, such as `createButton` and `createPress`. Source paths use kebab case, such as `button/create-button`. Pass reactive objects to factories and read their returned properties inside JSX or a computation. Create factories within an owned Solid scope so effects and event listeners are disposed with their owner. DOM arguments are native Solid accessors, such as `createButton(props, button)`, where `button` reads an element signal. Assign elements with JSX callback refs. Internal state uses native signals and two-phase effects.
|
|
6
18
|
|
|
19
|
+
## Development
|
|
20
|
+
|
|
7
21
|
Run these commands from this package:
|
|
8
22
|
|
|
9
23
|
```sh
|
package/dist/NOTICE.txt
CHANGED
|
@@ -30,7 +30,7 @@ and dark CSS between Solid previews and exported configuration. Copyright (c)
|
|
|
30
30
|
This repository contains code and translations derived from Adobe React Spectrum.
|
|
31
31
|
|
|
32
32
|
Upstream: https://github.com/adobe/react-spectrum
|
|
33
|
-
Reference revision:
|
|
33
|
+
Reference revision: 6dec77beccf0545a04318e6a01b8eb9cbe2dccc6
|
|
34
34
|
License: Apache License, Version 2.0 (LICENSES/Apache-2.0.txt).
|
|
35
35
|
Original copyright and attribution notices are retained in the source files.
|
|
36
36
|
The upstream NOTICE.txt is reproduced in LICENSES/react-spectrum-NOTICE.txt.
|
|
@@ -44,6 +44,12 @@ type declarations, Solid 2
|
|
|
44
44
|
reactivity, state APIs, module organization, imports, and formatting.
|
|
45
45
|
These notices apply to the derived files identified by their source headers.
|
|
46
46
|
|
|
47
|
+
The upstream update from 261344335e54265b2d02dc57a43b911a718de707 adds
|
|
48
|
+
packages/@react-types/shared/src/layout.d.ts and
|
|
49
|
+
packages/react-aria/src/utils/typeHelpers.ts. Their Solid counterparts retain
|
|
50
|
+
Copyright 2026 Adobe and their Apache-2.0 notices. The update adapts shadow DOM
|
|
51
|
+
traversal, interaction fixes, scroll anchoring, and component behavior to Solid 2.
|
|
52
|
+
|
|
47
53
|
The type packages packages/@solid2-aria/types-shared, packages/@solid2-aria/types-shared-web,
|
|
48
54
|
and packages/solid2-aria-types distribute the original Apache-2.0 license and
|
|
49
55
|
upstream NOTICE.txt verbatim in their LICENSES directories, with package-specific
|
|
@@ -345,6 +351,13 @@ The downloadable public/typeset.css retains the rules and original
|
|
|
345
351
|
shadcn/typeset notice from apps/v4/app/(app)/(typeset)/typeset.css, with a source
|
|
346
352
|
and modification header added. These files retain the shadcn/ui MIT license.
|
|
347
353
|
|
|
354
|
+
The Typeset customizer and src/components/tools/typeset-docs.tsx also adapt
|
|
355
|
+
apps/v4/app/(app)/(typeset)/components/{customizer,font-picker,option-picker,
|
|
356
|
+
main-menu,docs-panel,get-code-drawer}.tsx at the same revision. Solid 2 menus
|
|
357
|
+
provide transient previews, configuration locks, keyboard shortcuts, and a
|
|
358
|
+
responsive Vaul code drawer. Copyright (c) 2023 shadcn and the existing
|
|
359
|
+
shadcn/ui MIT license are retained.
|
|
360
|
+
|
|
348
361
|
The JSON task and dashboard fixtures in
|
|
349
362
|
apps/shadcn-solid2-aria/src/components/showcase/{tasks,dashboard}.json are copied
|
|
350
363
|
from apps/v4/app/(app)/examples/tasks/data/tasks.json and
|
|
@@ -439,10 +452,16 @@ independently authored.
|
|
|
439
452
|
The installable registry serves the existing shadcn-derived Solid component
|
|
440
453
|
sources with Nova classes and omits inline license headers from installed code.
|
|
441
454
|
Repository sources retain their copyright years, upstream paths, and modification
|
|
442
|
-
notices.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
apps/
|
|
455
|
+
notices. Registry installation does not create separate license or notice files.
|
|
456
|
+
The original shadcn MIT license remains in the repository's
|
|
457
|
+
apps/shadcn-solid2-aria/LICENSES/shadcn-ui-MIT.txt. The registry snapshot in
|
|
458
|
+
apps/shadcn-solid2-aria/src/registry/theme.json copies ARIA_STYLE.css from
|
|
459
|
+
apps/v4/registry/bases/aria/registry.ts and neutral.cssVars from
|
|
460
|
+
apps/v4/registry/themes.ts at the shadcn/ui revision above. Their keys, values,
|
|
461
|
+
and declaration order are unchanged. The downloadable public/theme.css is
|
|
462
|
+
rendered from this data using the shadcn CLI CSS transforms. It retains the
|
|
463
|
+
original Copyright (c) 2023 shadcn and MIT attribution. Shared variants,
|
|
464
|
+
animations, and utilities use the unmodified shadcn/tailwind.css import.
|
|
446
465
|
Registry HTTP handlers and dependency discovery are independently authored.
|
|
447
466
|
|
|
448
467
|
Drawer composition in the existing shadcn-derived wrappers preserves the
|
|
@@ -471,9 +490,10 @@ LICENSES/inter-OFL.txt and public/licenses/inter-OFL.txt.
|
|
|
471
490
|
|
|
472
491
|
The Solid tool menu and Create welcome dialog additionally adapt
|
|
473
492
|
apps/v4/app/(app)/{(create),(typeset)}/components/main-menu.tsx and
|
|
474
|
-
apps/v4/app/(app)/(create)/components/welcome-dialog.tsx
|
|
475
|
-
|
|
476
|
-
attribution, replacing React state and dialogs
|
|
493
|
+
apps/v4/app/(app)/(create)/components/welcome-dialog.tsx. The site logo and
|
|
494
|
+
favicon use an independently authored S mark. The derived components retain
|
|
495
|
+
Copyright (c) 2023 shadcn and MIT attribution, replacing React state and dialogs
|
|
496
|
+
with Solid 2 and Solid2 Aria.
|
|
477
497
|
|
|
478
498
|
The dashboard SVG node data in src/components/showcase/dashboard-icons.tsx in
|
|
479
499
|
apps/shadcn-solid2-aria derives from @tabler/icons-react 3.34.1, dist/esm/icons,
|
|
@@ -599,9 +619,11 @@ content/docs/{installation,dark-mode}/*.mdx adapts shadcn/ui at revision
|
|
|
599
619
|
481d523374745e77d0cf9c53a4115ab5dd7c8481. Upstream sources are
|
|
600
620
|
apps/v4/content/docs/installation/{index,vite,tanstack-router,tanstack}.mdx
|
|
601
621
|
and apps/v4/content/docs/dark-mode/{index,vite,tanstack-start}.mdx.
|
|
602
|
-
The overview cards, framework SVG paths,
|
|
603
|
-
|
|
604
|
-
|
|
622
|
+
The overview cards, framework SVG paths, numbered steps, and sun/moon
|
|
623
|
+
mode-toggle layout retain the upstream structure. Framework installation
|
|
624
|
+
walkthroughs add official CLI scaffolding, Solid 2 migration, package imports,
|
|
625
|
+
Vite aliases, separate theme setup, and component installation.
|
|
626
|
+
Commands use the local Solid component registry;
|
|
605
627
|
framework entries, providers, lifecycle, icons, and menus use Solid 2 APIs.
|
|
606
628
|
The linked-card component in src/components/docs/linked-card.tsx and the
|
|
607
629
|
responsive documentation steps also adapt apps/v4/mdx-components.tsx.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
16
|
*/
|
|
17
17
|
import { getTruthyValue } from "../utils/truthy.js";
|
|
18
|
+
import { getParentElement } from "../utils/shadowdom/dom-functions.js";
|
|
18
19
|
import { createKeyboard } from "../interactions/create-keyboard.js";
|
|
19
20
|
import { createLocale } from "../i18n/i18n-provider.js";
|
|
20
21
|
import { ariaValue } from "../utils/aria-value.js";
|
|
@@ -31,7 +32,7 @@ function createActionGroup(props, state, ref) {
|
|
|
31
32
|
const [isInToolbar, setInToolbar] = createSignal(false, { ownedWrite: true });
|
|
32
33
|
createEffect(() => ({ element: ref() }), ({ element }) => {
|
|
33
34
|
const refElement = element;
|
|
34
|
-
setInToolbar(!!(refElement && refElement
|
|
35
|
+
setInToolbar(!!(refElement && getParentElement(refElement)?.closest("[role=\"toolbar\"]")));
|
|
35
36
|
}, { ssrSource: "client" });
|
|
36
37
|
const isDisabled = createMemo(() => getTruthyValue(props.isDisabled) ?? ![...state.collection.getKeys()].some((key) => !state.disabledKeys.has(key)));
|
|
37
38
|
const _result0 = createLocale();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-action-group.js","names":[],"sources":["../../../src/actiongroup/create-action-group.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-aria/src/actiongroup/useActionGroup.ts.\n * Modified for Solid Aria: adapted hooks, reactive getters, DOM types, and imports for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { ListState } from \"@solid2-aria/stately/list/create-list-state\";\nimport type {\n AriaLabelingProps,\n DOMProps,\n FocusableElement,\n ItemElement,\n ItemRenderer,\n Key,\n MultipleSelection,\n Orientation,\n} from \"@solid2-aria/types-shared\";\nimport type { DOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, omit, createMemo, createSignal, createEffect } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport { createFocusManager } from \"../focus/focus-scope\";\nimport { createLocale } from \"../i18n/i18n-provider\";\nimport { createKeyboard } from \"../interactions/create-keyboard\";\nimport { ariaValue } from \"../utils/aria-value\";\nimport { filterDOMProps } from \"../utils/filter-dom-props\";\nimport { getTruthyValue } from \"../utils/truthy\";\n\nconst BUTTON_GROUP_ROLES = {\n multiple: \"toolbar\",\n none: \"toolbar\",\n single: \"radiogroup\",\n} as const;\n\n// Not extending CollectionBase to avoid async loading props\nexport interface ActionGroupProps<T> extends MultipleSelection {\n /**\n * The axis the ActionGroup should align with.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * An list of `Item` elements or a function. If the latter, a list of items must be provided using\n * the `items` prop.\n */\n children: ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;\n /** A list of items to display as children. Must be used with a function as the sole child. */\n items?: Iterable<T>;\n /** A list of keys to disable. */\n disabledKeys?: Iterable<Key>;\n /**\n * Whether the ActionGroup is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean;\n /**\n * Invoked when an action is taken on a child. Especially useful when `selectionMode` is none.\n * The sole argument `key` is the key for the item.\n */\n onAction?: (key: Key) => void;\n}\n\nexport interface AriaActionGroupProps<T>\n extends ActionGroupProps<T>, DOMProps, AriaLabelingProps {}\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes;\n}\n\nexport function createActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n ref: Accessor<FocusableElement | null>\n): ActionGroupAria {\n const [isInToolbar, setInToolbar] = createSignal(false, { ownedWrite: true });\n createEffect(\n () => ({ element: ref() }),\n ({ element }) => {\n const refElement = element;\n setInToolbar(\n !!(refElement
|
|
1
|
+
{"version":3,"file":"create-action-group.js","names":[],"sources":["../../../src/actiongroup/create-action-group.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-aria/src/actiongroup/useActionGroup.ts.\n * Modified for Solid Aria: adapted hooks, reactive getters, DOM types, and imports for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { ListState } from \"@solid2-aria/stately/list/create-list-state\";\nimport type {\n AriaLabelingProps,\n DOMProps,\n FocusableElement,\n ItemElement,\n ItemRenderer,\n Key,\n MultipleSelection,\n Orientation,\n} from \"@solid2-aria/types-shared\";\nimport type { DOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, omit, createMemo, createSignal, createEffect } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport { createFocusManager } from \"../focus/focus-scope\";\nimport { createLocale } from \"../i18n/i18n-provider\";\nimport { createKeyboard } from \"../interactions/create-keyboard\";\nimport { ariaValue } from \"../utils/aria-value\";\nimport { filterDOMProps } from \"../utils/filter-dom-props\";\nimport { getParentElement } from \"../utils/shadowdom/dom-functions\";\nimport { getTruthyValue } from \"../utils/truthy\";\n\nconst BUTTON_GROUP_ROLES = {\n multiple: \"toolbar\",\n none: \"toolbar\",\n single: \"radiogroup\",\n} as const;\n\n// Not extending CollectionBase to avoid async loading props\nexport interface ActionGroupProps<T> extends MultipleSelection {\n /**\n * The axis the ActionGroup should align with.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * An list of `Item` elements or a function. If the latter, a list of items must be provided using\n * the `items` prop.\n */\n children: ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;\n /** A list of items to display as children. Must be used with a function as the sole child. */\n items?: Iterable<T>;\n /** A list of keys to disable. */\n disabledKeys?: Iterable<Key>;\n /**\n * Whether the ActionGroup is disabled.\n * Shows that a selection exists, but is not available in that circumstance.\n */\n isDisabled?: boolean;\n /**\n * Invoked when an action is taken on a child. Especially useful when `selectionMode` is none.\n * The sole argument `key` is the key for the item.\n */\n onAction?: (key: Key) => void;\n}\n\nexport interface AriaActionGroupProps<T>\n extends ActionGroupProps<T>, DOMProps, AriaLabelingProps {}\n\nexport interface ActionGroupAria {\n actionGroupProps: DOMAttributes;\n}\n\nexport function createActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n ref: Accessor<FocusableElement | null>\n): ActionGroupAria {\n const [isInToolbar, setInToolbar] = createSignal(false, { ownedWrite: true });\n createEffect(\n () => ({ element: ref() }),\n ({ element }) => {\n const refElement = element;\n setInToolbar(\n !!(\n refElement &&\n getParentElement(refElement)?.closest('[role=\"toolbar\"]')\n )\n );\n },\n { ssrSource: \"client\" }\n );\n\n const isDisabled = createMemo(\n () =>\n getTruthyValue(props.isDisabled) ??\n ![...state.collection.getKeys()].some(\n (key) => !state.disabledKeys.has(key)\n )\n );\n\n const _result0 = createLocale();\n\n const focusManager = createFocusManager(ref);\n // ArrowLeft/ArrowRight follow the locale's text direction regardless of orientation, so\n // ArrowLeft always moves to the next item in RTL. ArrowUp/ArrowDown are never flipped.\n const flipDirection = createMemo(() => _result0.direction === \"rtl\");\n\n const _result1 = createKeyboard({\n get allowRepeats(): true {\n return true;\n },\n get shortcuts() {\n return {\n ArrowDown: () => {\n focusManager.focusNext({ wrap: true });\n },\n ArrowLeft: () => {\n if (flipDirection()) {\n focusManager.focusNext({ wrap: true });\n } else {\n focusManager.focusPrevious({ wrap: true });\n }\n },\n ArrowRight: () => {\n if (flipDirection()) {\n focusManager.focusPrevious({ wrap: true });\n } else {\n focusManager.focusNext({ wrap: true });\n }\n },\n ArrowUp: () => {\n focusManager.focusPrevious({ wrap: true });\n },\n };\n },\n });\n\n const role = createMemo(() => {\n const value = BUTTON_GROUP_ROLES[state.selectionManager.selectionMode];\n\n return isInToolbar() && value === \"toolbar\" ? (\"group\" as const) : value;\n });\n\n return {\n get actionGroupProps() {\n return merge(\n filterDOMProps(props, { labelable: true }),\n omit(_result1.keyboardProps, \"role\"),\n {\n get \"aria-disabled\"() {\n return ariaValue(isDisabled());\n },\n get \"aria-orientation\"() {\n return role() === \"toolbar\"\n ? (props.orientation ?? \"horizontal\")\n : undefined;\n },\n get role() {\n return role();\n },\n }\n );\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM;CACN,QAAQ;AACV;AAsCA,SAAgB,kBACd,OACA,OACA,KACiB;CACjB,MAAM,CAAC,aAAa,gBAAgB,aAAa,OAAO,EAAE,YAAY,KAAK,CAAC;CAC5E,oBACS,EAAE,SAAS,IAAI,EAAE,KACvB,EAAE,cAAc;EACf,MAAM,aAAa;EACnB,aACE,CAAC,EACC,cACA,iBAAiB,UAAU,CAAC,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ACF,EACF;AACF"}
|
|
@@ -27,7 +27,7 @@ import { isAppleDevice } from "../utils/platform.js";
|
|
|
27
27
|
import { createKeyboard } from "../interactions/create-keyboard.js";
|
|
28
28
|
import { createRouter } from "../utils/open-link.js";
|
|
29
29
|
import { setInteractionModality } from "../interactions/create-focus-visible.js";
|
|
30
|
-
import { dispatchVirtualFocus } from "../focus/virtual-focus.js";
|
|
30
|
+
import { dispatchVirtualFocus, getOriginalRelatedTarget } from "../focus/virtual-focus.js";
|
|
31
31
|
import { createLocalizedStringFormatter } from "../i18n/create-localized-string-formatter.js";
|
|
32
32
|
import { ariaValue } from "../utils/aria-value.js";
|
|
33
33
|
import { createEvent } from "../utils/create-event.js";
|
|
@@ -181,7 +181,7 @@ function createComboBox(props, state) {
|
|
|
181
181
|
});
|
|
182
182
|
const onBlur = (e) => {
|
|
183
183
|
const blurFromButton = nodeContains(buttonRef(), elementOrNull(e.relatedTarget));
|
|
184
|
-
const blurIntoPopover = nodeContains(props.popoverRef(), e
|
|
184
|
+
const blurIntoPopover = nodeContains(props.popoverRef(), getOriginalRelatedTarget(e));
|
|
185
185
|
if (blurFromButton || blurIntoPopover) return;
|
|
186
186
|
if (props.onBlur) props.onBlur(e);
|
|
187
187
|
state.setFocused(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-combo-box.js","names":["intlMessages"],"sources":["../../../src/combobox/create-combo-box.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-aria/src/combobox/useComboBox.ts.\n * Modified for Solid Aria: adapted hooks, reactive getters, DOM types, and imports for Solid 2; compute localized announcements in tracking scopes before publishing them from effects.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { getChildNodes } from \"@solid2-aria/stately/collections/get-child-nodes\";\nimport { getItemCount } from \"@solid2-aria/stately/collections/get-item-count\";\nimport type {\n ComboBoxProps,\n ComboBoxState,\n} from \"@solid2-aria/stately/combobox/create-combo-box-state\";\nimport { privateValidationStateProp } from \"@solid2-aria/stately/form/create-form-validation-state\";\nimport type { SelectionMode } from \"@solid2-aria/stately/select/create-select-state\";\nimport type {\n KeyboardEvent,\n AriaLabelingProps,\n DOMProps,\n InputDOMProps,\n KeyboardDelegate,\n LayoutDelegate,\n PressEvent,\n ValidationResult,\n} from \"@solid2-aria/types-shared\";\nimport type { DOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, omit, createEffect, createMemo, untrack } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport intlMessages from \"../../intl/combobox/index\";\nimport type { AriaButtonProps } from \"../button/create-button\";\nimport { dispatchVirtualFocus } from \"../focus/virtual-focus\";\nimport { createLocalizedStringFormatter } from \"../i18n/create-localized-string-formatter\";\nimport { setInteractionModality } from \"../interactions/create-focus-visible\";\nimport { createKeyboard } from \"../interactions/create-keyboard\";\nimport type { FieldAria } from \"../label/create-field\";\nimport type { AriaListBoxOptions } from \"../listbox/create-list-box\";\nimport { getItemId, listData } from \"../listbox/utils\";\nimport { announce } from \"../live-announcer/live-announcer\";\nimport { createMenuTrigger } from \"../menu/create-menu-trigger\";\nimport { ariaHideOutside } from \"../overlays/aria-hide-outside\";\nimport { createSelectableCollection } from \"../selection/create-selectable-collection\";\nimport { ListKeyboardDelegate } from \"../selection/list-keyboard-delegate\";\nimport { createTextField } from \"../textfield/create-text-field\";\nimport type {\n ElementType,\n FocusEvent,\n InputHTMLAttributes,\n TouchEvent,\n} from \"../types\";\nimport { ariaValue } from \"../utils/aria-value\";\nimport { chain } from \"../utils/chain\";\nimport { createEvent } from \"../utils/create-event\";\nimport { createFormReset } from \"../utils/create-form-reset\";\nimport { createSlotId } from \"../utils/create-id\";\nimport { createLabels } from \"../utils/create-labels\";\nimport { getOwnerDocument } from \"../utils/dom-helpers\";\nimport { elementOrNull } from \"../utils/dom-value\";\nimport { getCollectionNodeProps } from \"../utils/get-collection-node-props\";\nimport { isPresent } from \"../utils/is-present\";\nimport { getLegacyOption } from \"../utils/legacy-option\";\nimport { mergeProps } from \"../utils/merge-props\";\nimport { createRouter } from \"../utils/open-link\";\nimport { isAppleDevice } from \"../utils/platform\";\nimport { requireValue } from \"../utils/require-value\";\nimport {\n getActiveElement,\n getEventTarget,\n nodeContains,\n} from \"../utils/shadowdom/dom-functions\";\nimport { getTruthyValue, isTruthy, whenTruthy } from \"../utils/truthy\";\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = \"single\">\n extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface AriaComboBoxOptions<\n T,\n M extends SelectionMode = \"single\",\n> extends Omit<AriaComboBoxProps<T, M>, \"children\"> {\n /** The ref for the input element. */\n inputRef: Accessor<HTMLInputElement | null>;\n /** The ref for the list box popover. */\n popoverRef: Accessor<Element | null>;\n /** The ref for the list box. */\n listBoxRef: Accessor<HTMLElement | null>;\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: Accessor<Element | null>;\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n *\n * @default 'label'\n */\n labelElementType?: ElementType;\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate;\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: FieldAria[\"labelProps\"];\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes;\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>;\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps;\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes;\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component. A combo box\n * combines a text input with a listbox, allowing users to filter a list of options to items\n * matching a query.\n *\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function createComboBox<T, M extends SelectionMode = \"single\">(\n props: AriaComboBoxOptions<T, M>,\n state: ComboBoxState<T, M>\n): ComboBoxAria<T> {\n const buttonRef = props.buttonRef ?? (() => null);\n\n const stringFormatter = createLocalizedStringFormatter(\n intlMessages,\n \"@react-aria/combobox\"\n );\n\n const _result0 = createMenuTrigger<T>(\n {\n get isDisabled() {\n return getTruthyValue(props.isDisabled) ?? props.isReadOnly;\n },\n get type(): \"listbox\" {\n return \"listbox\";\n },\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {\n get id() {\n return _result0.menuProps.id;\n },\n });\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n const _result1 = state;\n const _result2 = untrack(() => state.selectionManager);\n\n const delegate = createMemo(\n () =>\n getTruthyValue(props.keyboardDelegate) ??\n new ListKeyboardDelegate({\n collection: _result1.collection,\n disabledKeys: _result2.disabledKeys,\n layoutDelegate: props.layoutDelegate,\n ref: props.listBoxRef,\n })\n );\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n const _result3 = createSelectableCollection({\n get disallowEmptySelection(): true {\n return true;\n },\n get disallowTypeAhead(): true {\n return true;\n },\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n get isVirtualized(): true {\n return true;\n },\n get keyboardDelegate() {\n return delegate();\n },\n get ref() {\n return props.inputRef;\n },\n get selectionManager() {\n return state.selectionManager;\n },\n get shouldFocusWrap() {\n return props.shouldFocusWrap;\n },\n });\n\n const router = createRouter();\n\n // for textfield specific operations\n const _result4 = createKeyboard({\n get shortcuts() {\n return {\n Enter: (e: KeyboardEvent) => {\n const propslistBoxRefElement = props.listBoxRef();\n // Prevent default form submission if menu is open since we may be selecting a option\n const shouldPreventDefault = state.isOpen;\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (\n state.isOpen &&\n propslistBoxRefElement &&\n state.selectionManager.focusedKey !== null &&\n state.selectionManager.focusedKey !== undefined\n ) {\n const collectionItem = state.collection.getItem(\n state.selectionManager.focusedKey\n );\n\n const collectionItemBehavior =\n getCollectionNodeProps(collectionItem);\n\n if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.href)\n ) {\n const item = propslistBoxRefElement.querySelector(\n `[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`\n );\n\n if (item instanceof HTMLAnchorElement) {\n router.open(\n item,\n e,\n collectionItemBehavior.href,\n collectionItemBehavior.routerOptions\n );\n }\n\n state.close();\n\n return { shouldPreventDefault };\n } else if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.onAction)\n ) {\n collectionItemBehavior.onAction();\n state.close();\n\n return { shouldPreventDefault };\n }\n }\n\n state.commit();\n\n return { shouldPreventDefault };\n },\n Escape: () => {\n let shouldContinuePropagation = false;\n\n if (\n !state.selectionManager.isEmpty ||\n state.inputValue === \"\" ||\n isTruthy(props.allowsCustomValue)\n ) {\n shouldContinuePropagation = true;\n }\n\n state.revert();\n\n return { shouldContinuePropagation };\n },\n Tab: () => {\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (\n state.isOpen &&\n props.listBoxRef() &&\n state.selectionManager.focusedKey !== null &&\n state.selectionManager.focusedKey !== undefined\n ) {\n const collectionItem = state.collection.getItem(\n state.selectionManager.focusedKey\n );\n\n const collectionItemBehavior =\n getCollectionNodeProps(collectionItem);\n\n if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.href)\n ) {\n state.close();\n\n return { shouldPreventDefault: false };\n } else if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.onAction)\n ) {\n collectionItemBehavior.onAction();\n state.close();\n\n return {\n shouldContinuePropagation: true,\n shouldPreventDefault: false,\n };\n }\n }\n\n if (state.isOpen) {\n state.commit();\n }\n\n return {\n shouldContinuePropagation: true,\n shouldPreventDefault: false,\n };\n },\n };\n },\n });\n\n const _result5 = createKeyboard({\n get allowRepeats(): true {\n return true;\n },\n get shortcuts() {\n return {\n ArrowDown: () => {\n state.open(\"first\", \"manual\");\n\n return { shouldPreventDefault: false };\n },\n ArrowLeft: () => {\n state.selectionManager.setFocusedKey(null);\n\n return { shouldPreventDefault: false };\n },\n ArrowRight: () => {\n state.selectionManager.setFocusedKey(null);\n\n return { shouldPreventDefault: false };\n },\n ArrowUp: () => {\n state.open(\"last\", \"manual\");\n\n return { shouldPreventDefault: false };\n },\n };\n },\n });\n\n const onBlur = (e: FocusEvent<HTMLInputElement>) => {\n const blurFromButton = nodeContains(\n buttonRef(),\n elementOrNull(e.relatedTarget)\n );\n\n const blurIntoPopover = nodeContains(\n props.popoverRef(),\n e.relatedTarget instanceof Node ? e.relatedTarget : null\n );\n\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n const onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n const valueId = createSlotId(() => [\n state.selectionManager.selectedKeys,\n state.selectionManager.selectionMode,\n ]);\n\n const _result6 = createMemo(() => state.displayValidation);\n\n const _result7 = createTextField(\n merge(omit(props, \"validate\", \"value\", \"defaultValue\", \"onChange\"), {\n get \"aria-describedby\"() {\n return ariaValue(\n ariaValue(\n [valueId(), props[\"aria-describedby\"]].filter(Boolean).join(\" \") ||\n undefined\n )\n );\n },\n get autocomplete(): \"off\" {\n return \"off\";\n },\n get defaultValue() {\n return state.defaultInputValue;\n },\n // In multi-select mode, only set required if the selection is empty.\n get isRequired() {\n return props.selectionMode === \"multiple\"\n ? whenTruthy(props.isRequired, () => state.selectionManager.isEmpty)\n : props.isRequired;\n },\n get onBlur() {\n return onBlur;\n },\n get onChange() {\n return state.setInputValue;\n },\n get onFocus() {\n return onFocus;\n },\n get onKeyDown() {\n return isTruthy(props.isReadOnly)\n ? props.onKeyDown\n : chain(\n state.isOpen && _result3.collectionProps.onKeyDown,\n _result4.keyboardProps.onKeyDown,\n _result5.keyboardProps.onKeyDown,\n props.onKeyDown\n );\n },\n get [privateValidationStateProp]() {\n return state;\n },\n validate: undefined,\n get value() {\n return state.inputValue;\n },\n }),\n props.inputRef\n );\n\n createFormReset(\n () => props.inputRef(),\n () => state.defaultValue,\n state.setValue\n );\n\n // Press handlers for the ComboBox button\n const onPress = (e: PressEvent) => {\n if (e.pointerType === \"touch\") {\n // Focus the input field in case it isn't focused yet\n props.inputRef()?.focus();\n state.toggle(null, \"manual\");\n }\n };\n\n const onPressStart = (e: PressEvent) => {\n if (e.pointerType !== \"touch\") {\n props.inputRef()?.focus();\n state.toggle(\n e.pointerType === \"keyboard\" || e.pointerType === \"virtual\"\n ? \"first\"\n : null,\n \"manual\"\n );\n }\n };\n\n const triggerLabelProps = createLabels({\n get \"aria-label\"() {\n return ariaValue(ariaValue(stringFormatter.format(\"buttonLabel\")));\n },\n get \"aria-labelledby\"() {\n return ariaValue(\n ariaValue(\n getTruthyValue(props[\"aria-labelledby\"]) ?? _result7.labelProps.id\n )\n );\n },\n get id() {\n const { id } = _result0.menuTriggerProps;\n\n return typeof id === \"string\" ? id : undefined;\n },\n });\n\n const listBoxProps = createLabels({\n get \"aria-label\"() {\n return ariaValue(ariaValue(stringFormatter.format(\"listboxLabel\")));\n },\n get \"aria-labelledby\"() {\n return ariaValue(\n ariaValue(\n getTruthyValue(props[\"aria-labelledby\"]) ?? _result7.labelProps.id\n )\n );\n },\n get id() {\n return _result0.menuProps.id;\n },\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = 0;\n\n const onTouchEnd = (e: TouchEvent) => {\n if (isTruthy(props.isDisabled) || isTruthy(props.isReadOnly)) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime < 500) {\n e.preventDefault();\n props.inputRef()?.focus();\n\n return;\n }\n\n const rect = getEventTarget(e).getBoundingClientRect();\n const [touch] = e.changedTouches;\n\n if (!touch) {\n return;\n }\n\n const centerX = Math.ceil(rect.left + 0.5 * rect.width);\n const centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n props.inputRef()?.focus();\n state.toggle(null, \"manual\");\n lastEventTime = e.timeStamp;\n }\n };\n\n // VoiceOver announces per-item details natively, so only announce when entering a\n // new section, where it is silent.\n const focusedItem = createMemo(() =>\n isPresent(state.selectionManager.focusedKey) && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined\n );\n\n const sectionKey = createMemo(() => focusedItem()?.parentKey ?? null);\n\n const itemKey = createMemo(() => state.selectionManager.focusedKey ?? null);\n\n let lastSection = untrack(sectionKey);\n let lastItem = untrack(itemKey);\n createEffect(\n () => {\n const currentItem = focusedItem();\n const currentItemKey = itemKey();\n const currentSectionKey = sectionKey();\n let announcement: string | undefined;\n\n if (\n isAppleDevice() &&\n currentItem &&\n currentItemKey !== null &&\n currentItemKey !== lastItem\n ) {\n const { collection } = state;\n\n const section =\n currentSectionKey === null\n ? null\n : collection.getItem(currentSectionKey);\n\n if (section && currentSectionKey !== lastSection) {\n announcement = stringFormatter.format(\"focusAnnouncement\", {\n groupCount: [...getChildNodes(section, collection)].length,\n groupTitle:\n getTruthyValue(\n getTruthyValue(section[\"aria-label\"]) ??\n (typeof section.rendered === \"string\" ? section.rendered : \"\")\n ) ?? \"\",\n isGroupChange: true,\n isSelected: state.selectionManager.isSelected(currentItemKey),\n optionText:\n getTruthyValue(\n getTruthyValue(currentItem[\"aria-label\"]) ??\n currentItem.textValue\n ) ?? \"\",\n });\n }\n }\n\n return { announcement, currentItemKey, currentSectionKey };\n },\n ({ announcement, currentItemKey, currentSectionKey }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSection = currentSectionKey;\n lastItem = currentItemKey;\n },\n { ssrSource: \"client\" }\n );\n // Announce the number of available suggestions when it changes.\n const optionCount = createMemo(() => getItemCount(state.collection));\n let lastSize = untrack(optionCount);\n let lastOpen = untrack(() => state.isOpen);\n createEffect(\n () => {\n const { isOpen } = state;\n const observedOptionCount = optionCount();\n\n // Other screen readers read the focused item's position automatically.\n const didOpenWithoutFocusedItem =\n isOpen !== lastOpen &&\n (!isPresent(state.selectionManager.focusedKey) || isAppleDevice());\n\n const announcement =\n isOpen &&\n (didOpenWithoutFocusedItem || observedOptionCount !== lastSize)\n ? stringFormatter.format(\"countAnnouncement\", {\n optionCount: observedOptionCount,\n })\n : undefined;\n\n return { announcement, isOpen, observedOptionCount };\n },\n ({ announcement, isOpen, observedOptionCount }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSize = observedOptionCount;\n lastOpen = isOpen;\n },\n { ssrSource: \"client\" }\n );\n // VoiceOver needs an explicit selection announcement.\n // Follow-up: do we need to do this for multi-select?\n let lastSelectedKey = untrack(() => getLegacyOption(state, \"selectedKey\"));\n createEffect(\n () => {\n const selectedItem = getLegacyOption(state, \"selectedItem\");\n const selectedKey = getLegacyOption(state, \"selectedKey\");\n\n const announcement =\n isAppleDevice() &&\n state.isFocused &&\n selectedItem &&\n selectedKey !== lastSelectedKey\n ? stringFormatter.format(\"selectedAnnouncement\", {\n optionText:\n getTruthyValue(\n getTruthyValue(selectedItem[\"aria-label\"]) ??\n selectedItem.textValue\n ) ?? \"\",\n })\n : undefined;\n\n return { announcement, selectedKey };\n },\n ({ announcement, selectedKey }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSelectedKey = selectedKey;\n },\n { ssrSource: \"client\" }\n );\n createEffect(\n () => ({\n inputElement: props.inputRef(),\n isOpen: state.isOpen,\n popoverElement: props.popoverRef(),\n }),\n ({ popoverElement, inputElement, isOpen }): undefined | (() => void) => {\n if (isOpen) {\n return ariaHideOutside(\n [inputElement, popoverElement].filter((element) => isPresent(element))\n );\n }\n\n return undefined;\n },\n { ssrSource: \"client\" }\n );\n createEffect(\n () => ({ focusedItem: focusedItem(), inputElement: props.inputRef() }),\n ({ focusedItem: currentFocusedItem, inputElement }) => {\n const propsinputRefElement = inputElement;\n\n // Re-show focus ring when there is no virtually focused item.\n if (\n !currentFocusedItem &&\n propsinputRefElement &&\n getActiveElement(getOwnerDocument(propsinputRefElement)) ===\n propsinputRefElement\n ) {\n dispatchVirtualFocus(propsinputRefElement, null);\n }\n },\n { defer: true, ssrSource: \"client\" }\n );\n createEvent(props.listBoxRef, \"react-aria-item-action\", () => {\n if (state.isOpen) {\n state.close();\n }\n });\n\n return {\n get buttonProps() {\n const trigger = _result0.menuTriggerProps;\n\n return merge(triggerLabelProps, {\n get \"aria-controls\"() {\n const { id } = _result0.menuProps;\n\n return state.isOpen && typeof id === \"string\" ? id : undefined;\n },\n get \"aria-expanded\"() {\n return state.isOpen;\n },\n get \"aria-haspopup\"() {\n return \"listbox\" as const;\n },\n excludeFromTabOrder: true,\n get isDisabled() {\n return getTruthyValue(props.isDisabled) ?? props.isReadOnly;\n },\n onKeyDown: (event: KeyboardEvent) => trigger.onKeyDown?.(event),\n onKeyUp: (event: KeyboardEvent) => trigger.onKeyUp?.(event),\n onPress,\n onPressStart,\n preventFocusOnPress: true,\n });\n },\n get descriptionProps() {\n return _result7.descriptionProps;\n },\n get errorMessageProps() {\n return _result7.errorMessageProps;\n },\n get inputProps() {\n return mergeProps(_result7.inputProps, {\n \"aria-activedescendant\": ariaValue(\n focusedItem()\n ? getItemId(\n state,\n requireValue(focusedItem(), \"Expected focusedItem()\").key\n )\n : undefined\n ),\n // Follow-up: readd proper logic for completionMode = complete (aria-autocomplete: both)\n \"aria-autocomplete\": ariaValue(\"list\"),\n \"aria-controls\": ariaValue(\n state.isOpen ? _result0.menuProps.id : undefined\n ),\n \"aria-expanded\": ariaValue(_result0.menuTriggerProps[\"aria-expanded\"]),\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autocorrect: \"off\",\n onTouchEnd,\n role: \"combobox\",\n // This disable's the macOS Safari spell check auto corrections.\n spellcheck: \"false\",\n });\n },\n get isInvalid() {\n return _result6().isInvalid;\n },\n get labelProps() {\n return merge(\n {\n get for() {\n const value =\n \"for\" in _result7.labelProps\n ? _result7.labelProps.for\n : undefined;\n\n return typeof value === \"string\" ? value : undefined;\n },\n get id() {\n const { id } = _result7.labelProps;\n\n return typeof id === \"string\" ? id : undefined;\n },\n },\n {\n // Focus the input in case the label is not a native <label> element.\n get onClick() {\n return (\"for\" in _result7.labelProps &&\n isTruthy(_result7.labelProps.for)) ||\n isTruthy(props.isDisabled)\n ? undefined\n : () => {\n props.inputRef()?.focus();\n setInteractionModality(\"keyboard\");\n };\n },\n }\n );\n },\n get listBoxProps() {\n return mergeProps(_result0.menuProps, listBoxProps, {\n UNSTABLE_itemBehavior: \"action\" as const,\n autoFocus: getTruthyValue(state.focusStrategy) ?? true,\n linkBehavior: \"selection\" as const,\n onAction: undefined,\n shouldFocusOnHover: true,\n shouldSelectOnPressUp: true,\n shouldUseVirtualFocus: true,\n });\n },\n get validationDetails() {\n return _result6().validationDetails;\n },\n get validationErrors() {\n return _result6().validationErrors;\n },\n get valueProps() {\n return {\n get id() {\n return valueId();\n },\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IA,SAAgB,eACd,OACA,OACiB;CACjB,MAAM,YAAY,MAAM,oBAAoB;CAE5C,MAAM,kBAAkB,+BACtBA,kBACA,sBACF;CAEA,MAAM,WAAW,kBACf;EACE,IAAI,aAAa;GACf,OAAO,eAAe,MAAM,UAAU,KAAK,MAAM;EACnD;EACA,IAAI,OAAkB;GACpB,OAAO;EACT;CACF,GACA,OACA,SACF;CAGA,SAAS,IAAI,OAAO,EAClB,IAAI,KAAK;EACP,OAAO,SAAS,UAAU;CAC5B,EACF,CAAC;CAGD,MAAM,WAAW;CACjB,MAAM,WAAW,cAAc,MAAM,gBAAgB;CAErD,MAAM,WAAW,iBAEb,eAAe,MAAM,gBAAgB,KACrC,IAAI,qBAAqB;EACvB,YAAY,SAAS;EACrB,cAAc,SAAS;EACvB,gBAAgB,MAAM;EACtB,KAAK,MAAM;CACb,CAAC,CACL;CAGA,MAAM,WAAW,2BAA2B;EAC1C,IAAI,yBAA+B;GACjC,OAAO;EACT;EACA,IAAI,oBAA0B;GAC5B,OAAO;EACT;EAEA,IAAI,gBAAsB;GACxB,OAAO;EACT;EACA,IAAI,mBAAmB;GACrB,OAAO,SAAS;EAClB;EACA,IAAI,MAAM;GACR,OAAO,MAAM;EACf;EACA,IAAI,mBAAmB;GACrB,OAAO,MAAM;EACf;EACA,IAAI,kBAAkB;GACpB,OAAO,MAAM;EACf;CACF,CAAC;CAED,MAAM,SAAS,aAAa;CAG5B,MAAM,WAAW,eAAe,EAC9B,IAAI,YAAY;EACd,OAAO;GACL,QAAQ,MAAqB;IAC3B,MAAM,yBAAyB,MAAM,WAAW;IAEhD,MAAM,uBAAuB,MAAM;IAGnC,IACE,MAAM,UACN,0BACA,MAAM,iBAAiB,eAAe,QACtC,MAAM,iBAAiB,eAAe,KAAA,GACtC;KACA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AU;IACnC;GACN,EACF,CACF;EACF;EACA,IAAI,eAAe;GACjB,OAAO,WAAW,SAAS,WAAW,cAAc;IAClD,uBAAuB;IACvB,WAAW,eAAe,MAAM,aAAa,KAAK;IAClD,cAAc;IACd,UAAU,KAAA;IACV,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;GACzB,CAAC;EACH;EACA,IAAI,oBAAoB;GACtB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,mBAAmB;GACrB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,aAAa;GACf,OAAO,EACL,IAAI,KAAK;IACP,OAAO,QAAQ;GACjB,EACF;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"create-combo-box.js","names":["intlMessages"],"sources":["../../../src/combobox/create-combo-box.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-aria/src/combobox/useComboBox.ts.\n * Modified for Solid Aria: adapted hooks, reactive getters, DOM types, and imports for Solid 2; compute localized announcements in tracking scopes before publishing them from effects.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { getChildNodes } from \"@solid2-aria/stately/collections/get-child-nodes\";\nimport { getItemCount } from \"@solid2-aria/stately/collections/get-item-count\";\nimport type {\n ComboBoxProps,\n ComboBoxState,\n} from \"@solid2-aria/stately/combobox/create-combo-box-state\";\nimport { privateValidationStateProp } from \"@solid2-aria/stately/form/create-form-validation-state\";\nimport type { SelectionMode } from \"@solid2-aria/stately/select/create-select-state\";\nimport type {\n KeyboardEvent,\n AriaLabelingProps,\n DOMProps,\n InputDOMProps,\n KeyboardDelegate,\n LayoutDelegate,\n PressEvent,\n ValidationResult,\n} from \"@solid2-aria/types-shared\";\nimport type { DOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, omit, createEffect, createMemo, untrack } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport intlMessages from \"../../intl/combobox/index\";\nimport type { AriaButtonProps } from \"../button/create-button\";\nimport {\n dispatchVirtualFocus,\n getOriginalRelatedTarget,\n} from \"../focus/virtual-focus\";\nimport { createLocalizedStringFormatter } from \"../i18n/create-localized-string-formatter\";\nimport { setInteractionModality } from \"../interactions/create-focus-visible\";\nimport { createKeyboard } from \"../interactions/create-keyboard\";\nimport type { FieldAria } from \"../label/create-field\";\nimport type { AriaListBoxOptions } from \"../listbox/create-list-box\";\nimport { getItemId, listData } from \"../listbox/utils\";\nimport { announce } from \"../live-announcer/live-announcer\";\nimport { createMenuTrigger } from \"../menu/create-menu-trigger\";\nimport { ariaHideOutside } from \"../overlays/aria-hide-outside\";\nimport { createSelectableCollection } from \"../selection/create-selectable-collection\";\nimport { ListKeyboardDelegate } from \"../selection/list-keyboard-delegate\";\nimport { createTextField } from \"../textfield/create-text-field\";\nimport type {\n ElementType,\n FocusEvent,\n InputHTMLAttributes,\n TouchEvent,\n} from \"../types\";\nimport { ariaValue } from \"../utils/aria-value\";\nimport { chain } from \"../utils/chain\";\nimport { createEvent } from \"../utils/create-event\";\nimport { createFormReset } from \"../utils/create-form-reset\";\nimport { createSlotId } from \"../utils/create-id\";\nimport { createLabels } from \"../utils/create-labels\";\nimport { getOwnerDocument } from \"../utils/dom-helpers\";\nimport { elementOrNull } from \"../utils/dom-value\";\nimport { getCollectionNodeProps } from \"../utils/get-collection-node-props\";\nimport { isPresent } from \"../utils/is-present\";\nimport { getLegacyOption } from \"../utils/legacy-option\";\nimport { mergeProps } from \"../utils/merge-props\";\nimport { createRouter } from \"../utils/open-link\";\nimport { isAppleDevice } from \"../utils/platform\";\nimport { requireValue } from \"../utils/require-value\";\nimport {\n getActiveElement,\n getEventTarget,\n nodeContains,\n} from \"../utils/shadowdom/dom-functions\";\nimport { getTruthyValue, isTruthy, whenTruthy } from \"../utils/truthy\";\n\nexport interface AriaComboBoxProps<T, M extends SelectionMode = \"single\">\n extends ComboBoxProps<T, M>, DOMProps, InputDOMProps, AriaLabelingProps {\n /** Whether keyboard navigation is circular. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface AriaComboBoxOptions<\n T,\n M extends SelectionMode = \"single\",\n> extends Omit<AriaComboBoxProps<T, M>, \"children\"> {\n /** The ref for the input element. */\n inputRef: Accessor<HTMLInputElement | null>;\n /** The ref for the list box popover. */\n popoverRef: Accessor<Element | null>;\n /** The ref for the list box. */\n listBoxRef: Accessor<HTMLElement | null>;\n /** The ref for the optional list box popup trigger button. */\n buttonRef?: Accessor<Element | null>;\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n *\n * @default 'label'\n */\n labelElementType?: ElementType;\n /** An optional keyboard delegate implementation, to override the default. */\n keyboardDelegate?: KeyboardDelegate;\n /**\n * A delegate object that provides layout information for items in the collection.\n * By default this uses the DOM, but this can be overridden to implement things like\n * virtualized scrolling.\n */\n layoutDelegate?: LayoutDelegate;\n}\n\nexport interface ComboBoxAria<T> extends ValidationResult {\n /** Props for the label element. */\n labelProps: FieldAria[\"labelProps\"];\n /** Props for the combo box input element. */\n inputProps: InputHTMLAttributes;\n /** Props for the list box, to be passed to `useListBox`. */\n listBoxProps: AriaListBoxOptions<T>;\n /** Props for the optional trigger button, to be passed to `useButton`. */\n buttonProps: AriaButtonProps;\n /** Props for the element representing the selected value. */\n valueProps: DOMAttributes;\n /** Props for the combo box description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the combo box error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combo box component. A combo box\n * combines a text input with a listbox, allowing users to filter a list of options to items\n * matching a query.\n *\n * @param props - Props for the combo box.\n * @param state - State for the select, as returned by `useComboBoxState`.\n */\nexport function createComboBox<T, M extends SelectionMode = \"single\">(\n props: AriaComboBoxOptions<T, M>,\n state: ComboBoxState<T, M>\n): ComboBoxAria<T> {\n const buttonRef = props.buttonRef ?? (() => null);\n\n const stringFormatter = createLocalizedStringFormatter(\n intlMessages,\n \"@react-aria/combobox\"\n );\n\n const _result0 = createMenuTrigger<T>(\n {\n get isDisabled() {\n return getTruthyValue(props.isDisabled) ?? props.isReadOnly;\n },\n get type(): \"listbox\" {\n return \"listbox\";\n },\n },\n state,\n buttonRef\n );\n\n // Set listbox id so it can be used when calling getItemId later\n listData.set(state, {\n get id() {\n return _result0.menuProps.id;\n },\n });\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n const _result1 = state;\n const _result2 = untrack(() => state.selectionManager);\n\n const delegate = createMemo(\n () =>\n getTruthyValue(props.keyboardDelegate) ??\n new ListKeyboardDelegate({\n collection: _result1.collection,\n disabledKeys: _result2.disabledKeys,\n layoutDelegate: props.layoutDelegate,\n ref: props.listBoxRef,\n })\n );\n\n // Use useSelectableCollection to get the keyboard handlers to apply to the textfield\n const _result3 = createSelectableCollection({\n get disallowEmptySelection(): true {\n return true;\n },\n get disallowTypeAhead(): true {\n return true;\n },\n // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component\n get isVirtualized(): true {\n return true;\n },\n get keyboardDelegate() {\n return delegate();\n },\n get ref() {\n return props.inputRef;\n },\n get selectionManager() {\n return state.selectionManager;\n },\n get shouldFocusWrap() {\n return props.shouldFocusWrap;\n },\n });\n\n const router = createRouter();\n\n // for textfield specific operations\n const _result4 = createKeyboard({\n get shortcuts() {\n return {\n Enter: (e: KeyboardEvent) => {\n const propslistBoxRefElement = props.listBoxRef();\n // Prevent default form submission if menu is open since we may be selecting a option\n const shouldPreventDefault = state.isOpen;\n\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (\n state.isOpen &&\n propslistBoxRefElement &&\n state.selectionManager.focusedKey !== null &&\n state.selectionManager.focusedKey !== undefined\n ) {\n const collectionItem = state.collection.getItem(\n state.selectionManager.focusedKey\n );\n\n const collectionItemBehavior =\n getCollectionNodeProps(collectionItem);\n\n if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.href)\n ) {\n const item = propslistBoxRefElement.querySelector(\n `[data-key=\"${CSS.escape(state.selectionManager.focusedKey.toString())}\"]`\n );\n\n if (item instanceof HTMLAnchorElement) {\n router.open(\n item,\n e,\n collectionItemBehavior.href,\n collectionItemBehavior.routerOptions\n );\n }\n\n state.close();\n\n return { shouldPreventDefault };\n } else if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.onAction)\n ) {\n collectionItemBehavior.onAction();\n state.close();\n\n return { shouldPreventDefault };\n }\n }\n\n state.commit();\n\n return { shouldPreventDefault };\n },\n Escape: () => {\n let shouldContinuePropagation = false;\n\n if (\n !state.selectionManager.isEmpty ||\n state.inputValue === \"\" ||\n isTruthy(props.allowsCustomValue)\n ) {\n shouldContinuePropagation = true;\n }\n\n state.revert();\n\n return { shouldContinuePropagation };\n },\n Tab: () => {\n // If the focused item is a link, trigger opening it. Items that are links are not selectable.\n if (\n state.isOpen &&\n props.listBoxRef() &&\n state.selectionManager.focusedKey !== null &&\n state.selectionManager.focusedKey !== undefined\n ) {\n const collectionItem = state.collection.getItem(\n state.selectionManager.focusedKey\n );\n\n const collectionItemBehavior =\n getCollectionNodeProps(collectionItem);\n\n if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.href)\n ) {\n state.close();\n\n return { shouldPreventDefault: false };\n } else if (\n collectionItem !== null &&\n isTruthy(collectionItemBehavior.onAction)\n ) {\n collectionItemBehavior.onAction();\n state.close();\n\n return {\n shouldContinuePropagation: true,\n shouldPreventDefault: false,\n };\n }\n }\n\n if (state.isOpen) {\n state.commit();\n }\n\n return {\n shouldContinuePropagation: true,\n shouldPreventDefault: false,\n };\n },\n };\n },\n });\n\n const _result5 = createKeyboard({\n get allowRepeats(): true {\n return true;\n },\n get shortcuts() {\n return {\n ArrowDown: () => {\n state.open(\"first\", \"manual\");\n\n return { shouldPreventDefault: false };\n },\n ArrowLeft: () => {\n state.selectionManager.setFocusedKey(null);\n\n return { shouldPreventDefault: false };\n },\n ArrowRight: () => {\n state.selectionManager.setFocusedKey(null);\n\n return { shouldPreventDefault: false };\n },\n ArrowUp: () => {\n state.open(\"last\", \"manual\");\n\n return { shouldPreventDefault: false };\n },\n };\n },\n });\n\n const onBlur = (e: FocusEvent<HTMLInputElement>) => {\n const blurFromButton = nodeContains(\n buttonRef(),\n elementOrNull(e.relatedTarget)\n );\n\n const blurIntoPopover = nodeContains(\n props.popoverRef(),\n getOriginalRelatedTarget(e)\n );\n\n // Ignore blur if focused moved to the button(if exists) or into the popover.\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n if (props.onBlur) {\n props.onBlur(e);\n }\n\n state.setFocused(false);\n };\n\n const onFocus = (e: FocusEvent<HTMLInputElement>) => {\n if (state.isFocused) {\n return;\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n\n state.setFocused(true);\n };\n\n const valueId = createSlotId(() => [\n state.selectionManager.selectedKeys,\n state.selectionManager.selectionMode,\n ]);\n\n const _result6 = createMemo(() => state.displayValidation);\n\n const _result7 = createTextField(\n merge(omit(props, \"validate\", \"value\", \"defaultValue\", \"onChange\"), {\n get \"aria-describedby\"() {\n return ariaValue(\n ariaValue(\n [valueId(), props[\"aria-describedby\"]].filter(Boolean).join(\" \") ||\n undefined\n )\n );\n },\n get autocomplete(): \"off\" {\n return \"off\";\n },\n get defaultValue() {\n return state.defaultInputValue;\n },\n // In multi-select mode, only set required if the selection is empty.\n get isRequired() {\n return props.selectionMode === \"multiple\"\n ? whenTruthy(props.isRequired, () => state.selectionManager.isEmpty)\n : props.isRequired;\n },\n get onBlur() {\n return onBlur;\n },\n get onChange() {\n return state.setInputValue;\n },\n get onFocus() {\n return onFocus;\n },\n get onKeyDown() {\n return isTruthy(props.isReadOnly)\n ? props.onKeyDown\n : chain(\n state.isOpen && _result3.collectionProps.onKeyDown,\n _result4.keyboardProps.onKeyDown,\n _result5.keyboardProps.onKeyDown,\n props.onKeyDown\n );\n },\n get [privateValidationStateProp]() {\n return state;\n },\n validate: undefined,\n get value() {\n return state.inputValue;\n },\n }),\n props.inputRef\n );\n\n createFormReset(\n () => props.inputRef(),\n () => state.defaultValue,\n state.setValue\n );\n\n // Press handlers for the ComboBox button\n const onPress = (e: PressEvent) => {\n if (e.pointerType === \"touch\") {\n // Focus the input field in case it isn't focused yet\n props.inputRef()?.focus();\n state.toggle(null, \"manual\");\n }\n };\n\n const onPressStart = (e: PressEvent) => {\n if (e.pointerType !== \"touch\") {\n props.inputRef()?.focus();\n state.toggle(\n e.pointerType === \"keyboard\" || e.pointerType === \"virtual\"\n ? \"first\"\n : null,\n \"manual\"\n );\n }\n };\n\n const triggerLabelProps = createLabels({\n get \"aria-label\"() {\n return ariaValue(ariaValue(stringFormatter.format(\"buttonLabel\")));\n },\n get \"aria-labelledby\"() {\n return ariaValue(\n ariaValue(\n getTruthyValue(props[\"aria-labelledby\"]) ?? _result7.labelProps.id\n )\n );\n },\n get id() {\n const { id } = _result0.menuTriggerProps;\n\n return typeof id === \"string\" ? id : undefined;\n },\n });\n\n const listBoxProps = createLabels({\n get \"aria-label\"() {\n return ariaValue(ariaValue(stringFormatter.format(\"listboxLabel\")));\n },\n get \"aria-labelledby\"() {\n return ariaValue(\n ariaValue(\n getTruthyValue(props[\"aria-labelledby\"]) ?? _result7.labelProps.id\n )\n );\n },\n get id() {\n return _result0.menuProps.id;\n },\n });\n\n // If a touch happens on direct center of ComboBox input, might be virtual click from iPad so open ComboBox menu\n let lastEventTime = 0;\n\n const onTouchEnd = (e: TouchEvent) => {\n if (isTruthy(props.isDisabled) || isTruthy(props.isReadOnly)) {\n return;\n }\n\n // Sometimes VoiceOver on iOS fires two touchend events in quick succession. Ignore the second one.\n if (e.timeStamp - lastEventTime < 500) {\n e.preventDefault();\n props.inputRef()?.focus();\n\n return;\n }\n\n const rect = getEventTarget(e).getBoundingClientRect();\n const [touch] = e.changedTouches;\n\n if (!touch) {\n return;\n }\n\n const centerX = Math.ceil(rect.left + 0.5 * rect.width);\n const centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n props.inputRef()?.focus();\n state.toggle(null, \"manual\");\n lastEventTime = e.timeStamp;\n }\n };\n\n // VoiceOver announces per-item details natively, so only announce when entering a\n // new section, where it is silent.\n const focusedItem = createMemo(() =>\n isPresent(state.selectionManager.focusedKey) && state.isOpen\n ? state.collection.getItem(state.selectionManager.focusedKey)\n : undefined\n );\n\n const sectionKey = createMemo(() => focusedItem()?.parentKey ?? null);\n\n const itemKey = createMemo(() => state.selectionManager.focusedKey ?? null);\n\n let lastSection = untrack(sectionKey);\n let lastItem = untrack(itemKey);\n createEffect(\n () => {\n const currentItem = focusedItem();\n const currentItemKey = itemKey();\n const currentSectionKey = sectionKey();\n let announcement: string | undefined;\n\n if (\n isAppleDevice() &&\n currentItem &&\n currentItemKey !== null &&\n currentItemKey !== lastItem\n ) {\n const { collection } = state;\n\n const section =\n currentSectionKey === null\n ? null\n : collection.getItem(currentSectionKey);\n\n if (section && currentSectionKey !== lastSection) {\n announcement = stringFormatter.format(\"focusAnnouncement\", {\n groupCount: [...getChildNodes(section, collection)].length,\n groupTitle:\n getTruthyValue(\n getTruthyValue(section[\"aria-label\"]) ??\n (typeof section.rendered === \"string\" ? section.rendered : \"\")\n ) ?? \"\",\n isGroupChange: true,\n isSelected: state.selectionManager.isSelected(currentItemKey),\n optionText:\n getTruthyValue(\n getTruthyValue(currentItem[\"aria-label\"]) ??\n currentItem.textValue\n ) ?? \"\",\n });\n }\n }\n\n return { announcement, currentItemKey, currentSectionKey };\n },\n ({ announcement, currentItemKey, currentSectionKey }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSection = currentSectionKey;\n lastItem = currentItemKey;\n },\n { ssrSource: \"client\" }\n );\n // Announce the number of available suggestions when it changes.\n const optionCount = createMemo(() => getItemCount(state.collection));\n let lastSize = untrack(optionCount);\n let lastOpen = untrack(() => state.isOpen);\n createEffect(\n () => {\n const { isOpen } = state;\n const observedOptionCount = optionCount();\n\n // Other screen readers read the focused item's position automatically.\n const didOpenWithoutFocusedItem =\n isOpen !== lastOpen &&\n (!isPresent(state.selectionManager.focusedKey) || isAppleDevice());\n\n const announcement =\n isOpen &&\n (didOpenWithoutFocusedItem || observedOptionCount !== lastSize)\n ? stringFormatter.format(\"countAnnouncement\", {\n optionCount: observedOptionCount,\n })\n : undefined;\n\n return { announcement, isOpen, observedOptionCount };\n },\n ({ announcement, isOpen, observedOptionCount }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSize = observedOptionCount;\n lastOpen = isOpen;\n },\n { ssrSource: \"client\" }\n );\n // VoiceOver needs an explicit selection announcement.\n // Follow-up: do we need to do this for multi-select?\n let lastSelectedKey = untrack(() => getLegacyOption(state, \"selectedKey\"));\n createEffect(\n () => {\n const selectedItem = getLegacyOption(state, \"selectedItem\");\n const selectedKey = getLegacyOption(state, \"selectedKey\");\n\n const announcement =\n isAppleDevice() &&\n state.isFocused &&\n selectedItem &&\n selectedKey !== lastSelectedKey\n ? stringFormatter.format(\"selectedAnnouncement\", {\n optionText:\n getTruthyValue(\n getTruthyValue(selectedItem[\"aria-label\"]) ??\n selectedItem.textValue\n ) ?? \"\",\n })\n : undefined;\n\n return { announcement, selectedKey };\n },\n ({ announcement, selectedKey }) => {\n if (announcement !== undefined && announcement !== \"\") {\n announce(announcement);\n }\n\n lastSelectedKey = selectedKey;\n },\n { ssrSource: \"client\" }\n );\n createEffect(\n () => ({\n inputElement: props.inputRef(),\n isOpen: state.isOpen,\n popoverElement: props.popoverRef(),\n }),\n ({ popoverElement, inputElement, isOpen }): undefined | (() => void) => {\n if (isOpen) {\n return ariaHideOutside(\n [inputElement, popoverElement].filter((element) => isPresent(element))\n );\n }\n\n return undefined;\n },\n { ssrSource: \"client\" }\n );\n createEffect(\n () => ({ focusedItem: focusedItem(), inputElement: props.inputRef() }),\n ({ focusedItem: currentFocusedItem, inputElement }) => {\n const propsinputRefElement = inputElement;\n\n // Re-show focus ring when there is no virtually focused item.\n if (\n !currentFocusedItem &&\n propsinputRefElement &&\n getActiveElement(getOwnerDocument(propsinputRefElement)) ===\n propsinputRefElement\n ) {\n dispatchVirtualFocus(propsinputRefElement, null);\n }\n },\n { defer: true, ssrSource: \"client\" }\n );\n createEvent(props.listBoxRef, \"react-aria-item-action\", () => {\n if (state.isOpen) {\n state.close();\n }\n });\n\n return {\n get buttonProps() {\n const trigger = _result0.menuTriggerProps;\n\n return merge(triggerLabelProps, {\n get \"aria-controls\"() {\n const { id } = _result0.menuProps;\n\n return state.isOpen && typeof id === \"string\" ? id : undefined;\n },\n get \"aria-expanded\"() {\n return state.isOpen;\n },\n get \"aria-haspopup\"() {\n return \"listbox\" as const;\n },\n excludeFromTabOrder: true,\n get isDisabled() {\n return getTruthyValue(props.isDisabled) ?? props.isReadOnly;\n },\n onKeyDown: (event: KeyboardEvent) => trigger.onKeyDown?.(event),\n onKeyUp: (event: KeyboardEvent) => trigger.onKeyUp?.(event),\n onPress,\n onPressStart,\n preventFocusOnPress: true,\n });\n },\n get descriptionProps() {\n return _result7.descriptionProps;\n },\n get errorMessageProps() {\n return _result7.errorMessageProps;\n },\n get inputProps() {\n return mergeProps(_result7.inputProps, {\n \"aria-activedescendant\": ariaValue(\n focusedItem()\n ? getItemId(\n state,\n requireValue(focusedItem(), \"Expected focusedItem()\").key\n )\n : undefined\n ),\n // Follow-up: readd proper logic for completionMode = complete (aria-autocomplete: both)\n \"aria-autocomplete\": ariaValue(\"list\"),\n \"aria-controls\": ariaValue(\n state.isOpen ? _result0.menuProps.id : undefined\n ),\n \"aria-expanded\": ariaValue(_result0.menuTriggerProps[\"aria-expanded\"]),\n // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.\n autocorrect: \"off\",\n onTouchEnd,\n role: \"combobox\",\n // This disable's the macOS Safari spell check auto corrections.\n spellcheck: \"false\",\n });\n },\n get isInvalid() {\n return _result6().isInvalid;\n },\n get labelProps() {\n return merge(\n {\n get for() {\n const value =\n \"for\" in _result7.labelProps\n ? _result7.labelProps.for\n : undefined;\n\n return typeof value === \"string\" ? value : undefined;\n },\n get id() {\n const { id } = _result7.labelProps;\n\n return typeof id === \"string\" ? id : undefined;\n },\n },\n {\n // Focus the input in case the label is not a native <label> element.\n get onClick() {\n return (\"for\" in _result7.labelProps &&\n isTruthy(_result7.labelProps.for)) ||\n isTruthy(props.isDisabled)\n ? undefined\n : () => {\n props.inputRef()?.focus();\n setInteractionModality(\"keyboard\");\n };\n },\n }\n );\n },\n get listBoxProps() {\n return mergeProps(_result0.menuProps, listBoxProps, {\n UNSTABLE_itemBehavior: \"action\" as const,\n autoFocus: getTruthyValue(state.focusStrategy) ?? true,\n linkBehavior: \"selection\" as const,\n onAction: undefined,\n shouldFocusOnHover: true,\n shouldSelectOnPressUp: true,\n shouldUseVirtualFocus: true,\n });\n },\n get validationDetails() {\n return _result6().validationDetails;\n },\n get validationErrors() {\n return _result6().validationErrors;\n },\n get valueProps() {\n return {\n get id() {\n return valueId();\n },\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJA,SAAgB,eACd,OACA,OACiB;CACjB,MAAM,YAAY,MAAM,oBAAoB;CAE5C,MAAM,kBAAkB,+BACtBA,kBACA,sBACF;CAEA,MAAM,WAAW,kBACf;EACE,IAAI,aAAa;GACf,OAAO,eAAe,MAAM,UAAU,KAAK,MAAM;EACnD;EACA,IAAI,OAAkB;GACpB,OAAO;EACT;CACF,GACA,OACA,SACF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AAQ;GACjB,EACF;EACF;CACF;AACF"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
16
|
*/
|
|
17
17
|
import { isTruthy } from "../utils/truthy.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { getNextElement, insert, memo, ref, scope, template } from "@solidjs/web";
|
|
19
|
+
import { createSignal, flush, onSettled } from "solid-js";
|
|
20
20
|
// src/dnd/drag-preview.tsx
|
|
21
21
|
var _tmpl$ = /* @__PURE__ */ template(`<div style=left:-100000px;position:fixed;top:0;z-index:-100>`);
|
|
22
22
|
function DragPreview(props) {
|
|
@@ -40,11 +40,10 @@ function DragPreview(props) {
|
|
|
40
40
|
if (typeof props.ref === "function") props.ref(null);
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
return isTruthy(preview());
|
|
46
|
-
}
|
|
47
|
-
get children() {
|
|
43
|
+
return memo(() => {
|
|
44
|
+
return memo(() => {
|
|
45
|
+
return !!isTruthy(preview());
|
|
46
|
+
})() ? (() => {
|
|
48
47
|
var _el$ = getNextElement(_tmpl$);
|
|
49
48
|
ref(() => {
|
|
50
49
|
return (node) => {
|
|
@@ -55,7 +54,7 @@ function DragPreview(props) {
|
|
|
55
54
|
return preview();
|
|
56
55
|
}));
|
|
57
56
|
return _el$;
|
|
58
|
-
}
|
|
57
|
+
})() : void 0;
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
export { DragPreview };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-preview.js","names":["<Show when={isTruthy(preview())}>\n <div\n style={{\n left: \"-100000px\",\n position: \"fixed\",\n top: 0,\n \"z-index\": -100,\n }}\n ref={(node) => {\n element = node;\n }}\n >\n {preview()}\n </div>\n </Show>","ref={(node) => {\n element = node;\n }}","{preview()}","
|
|
1
|
+
{"version":3,"file":"drag-preview.js","names":["<Show when={isTruthy(preview())}>\n <div\n style={{\n left: \"-100000px\",\n position: \"fixed\",\n top: 0,\n \"z-index\": -100,\n }}\n ref={(node) => {\n element = node;\n }}\n >\n {preview()}\n </div>\n </Show>","ref={(node) => {\n element = node;\n }}","{preview()}","_$memo","_$getNextElement","_$scope"],"sources":["../../../src/dnd/drag-preview.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-aria/src/dnd/DragPreview.tsx.\n * Modified for Solid Aria: adapted components, imports, and reactive lifecycle for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { DragItem, DragPreviewRenderer } from \"@solid2-aria/types-shared\";\nimport { createSignal, flush, onSettled, Show } from \"solid-js\";\nimport type { Element as SolidElement } from \"solid-js\";\n\nimport { isTruthy } from \"../utils/truthy\";\n\nexport interface DragPreviewProps {\n children: (\n items: DragItem[]\n ) => SolidElement | { element: SolidElement; x: number; y: number };\n ref?: (renderer: DragPreviewRenderer | null) => void;\n}\n\nexport function DragPreview(props: DragPreviewProps): SolidElement {\n const [preview, setPreview] = createSignal<SolidElement>(null);\n let element: HTMLDivElement | undefined;\n let frame: number | undefined;\n\n const renderPreview: DragPreviewRenderer = (items, handle1) => {\n const result = props.children(items);\n\n const offset =\n isTruthy(result) && typeof result === \"object\" && \"element\" in result\n ? result\n : null;\n\n setPreview(() => (offset ? offset.element : result));\n flush();\n handle1(element ?? null, offset?.x, offset?.y);\n frame = requestAnimationFrame(() => {\n setPreview(null);\n });\n };\n\n onSettled(() => {\n if (typeof props.ref === \"function\") {\n props.ref(renderPreview);\n }\n\n return () => {\n if (frame !== undefined) {\n cancelAnimationFrame(frame);\n }\n\n if (typeof props.ref === \"function\") {\n props.ref(null);\n }\n };\n });\n\n return (\n <Show when={isTruthy(preview())}>\n <div\n style={{\n left: \"-100000px\",\n position: \"fixed\",\n top: 0,\n \"z-index\": -100,\n }}\n ref={(node) => {\n element = node;\n }}\n >\n {preview()}\n </div>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,YAAY,OAAuC;CACjE,MAAM,CAAC,SAAS,cAAc,aAA2B,IAAI;CAC7D,IAAI;CACJ,IAAI;CAEJ,MAAM,iBAAsC,OAAO,YAAY;EAC7D,MAAM,SAAS,MAAM,SAAS,KAAK;EAEnC,MAAM,SACJ,SAAS,MAAM,KAAK,OAAO,WAAW,YAAY,aAAa,SAC3D,SACA;EAEN,iBAAkB,SAAS,OAAO,UAAU,MAAO;EACnD,MAAM;EACN,QAAQ,WAAW,MAAM,QAAQ,GAAG,QAAQ,CAAC;EAC7C,QAAQ,4BAA4B;GAClC,WAAW,IAAI;EACjB,CAAC;CACH;CAEA,gBAAgB;EACd,IAAI,OAAO,MAAM,QAAQ,YACvB,MAAM,IAAI,aAAa;EAGzB,aAAa;GACX,IAAI,UAAU,KAAA,GACZ,qBAAqB,KAAK;GAG5B,IAAI,OAAO,MAAM,QAAQ,YACvB,MAAM,IAAI,IAAI;EAElB;CACF,CAAC;CAED,OACEA,WAAAA;;GAAY,OAAA,CAAA,CAAA,SAAS,QAAQ,CAAC;EAcxB,CAAA,CAAC,CAAD,WAbJ;GAYK,IAAA,OAAAI,eAAA,MAAA;GALH,UAAA;IAAM,QAAA,SAAS;KACb,UAAU;IACZ;GAAC,GAFDH,IAEC;GATH,OAAA,MAWEC,YAAAA;IAAC,OAAA,QAAS;GACP,CAAA,CAAA;GAZL,OAAA;EAYK,EAAA,CAAA,IAbP,KAAA;CAcM,CAAA;AAEV"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { getTruthyValue, isTruthy, whenTruthy } from "../utils/truthy.js";
|
|
18
18
|
import { isPresent } from "../utils/is-present.js";
|
|
19
19
|
import { getOwnerDocument, getOwnerWindow } from "../utils/dom-helpers.js";
|
|
20
|
-
import { getActiveElement, getEventTarget, nodeContains } from "../utils/shadowdom/dom-functions.js";
|
|
20
|
+
import { getActiveElement, getEventTarget, getParentElement, nodeContains } from "../utils/shadowdom/dom-functions.js";
|
|
21
21
|
import { focusableElementOrNull, requireElement, requireFocusableElement, requireHTMLInputElement } from "../utils/dom-value.js";
|
|
22
22
|
import { isFocusable, isTabbable } from "../utils/is-focusable.js";
|
|
23
23
|
import { requireValue } from "../utils/require-value.js";
|
|
@@ -269,7 +269,7 @@ function createFocusManagerForScope(scopeRef) {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
function getScopeRoot(scope) {
|
|
272
|
-
return requireValue(
|
|
272
|
+
return requireValue(getParentElement(scope[0]), "Expected scope[0]!.parentElement");
|
|
273
273
|
}
|
|
274
274
|
function shouldContainFocus(scopeRef) {
|
|
275
275
|
let scope = focusScopeTree.getTreeNode(activeScope);
|