@solid2-aria/components 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 +6 -0
- package/dist/NOTICE.txt +33 -11
- package/dist/browser/collection-dnd.js +37 -40
- package/dist/browser/collection-dnd.js.map +1 -1
- package/dist/browser/color-field.js +12 -6
- package/dist/browser/color-field.js.map +1 -1
- package/dist/browser/drop-zone.js +6 -3
- package/dist/browser/drop-zone.js.map +1 -1
- package/dist/browser/grid-list.d.ts +2 -2
- package/dist/browser/grid-list.js +8 -7
- package/dist/browser/grid-list.js.map +1 -1
- package/dist/browser/list-box.js +31 -37
- package/dist/browser/list-box.js.map +1 -1
- package/dist/browser/menu.js +16 -19
- package/dist/browser/menu.js.map +1 -1
- package/dist/browser/modal.js +28 -31
- package/dist/browser/modal.js.map +1 -1
- package/dist/browser/number-field.js +5 -4
- package/dist/browser/number-field.js.map +1 -1
- package/dist/browser/popover.js +26 -29
- package/dist/browser/popover.js.map +1 -1
- package/dist/browser/shared-element-transition.js +19 -22
- package/dist/browser/shared-element-transition.js.map +1 -1
- package/dist/browser/sheet.d.ts +1 -1
- package/dist/browser/sheet.js +82 -7
- package/dist/browser/sheet.js.map +1 -1
- package/dist/browser/table.d.ts +2 -2
- package/dist/browser/table.js +5 -2
- package/dist/browser/table.js.map +1 -1
- package/dist/browser/tabs.d.ts +1 -1
- package/dist/browser/tabs.js +65 -26
- package/dist/browser/tabs.js.map +1 -1
- package/dist/browser/toast.js +43 -46
- package/dist/browser/toast.js.map +1 -1
- package/dist/browser/token-field.js +0 -1
- package/dist/browser/token-field.js.map +1 -1
- package/dist/browser/tooltip.js +22 -25
- package/dist/browser/tooltip.js.map +1 -1
- package/dist/browser/tree.js +21 -10
- package/dist/browser/tree.js.map +1 -1
- package/dist/server/calendar.js +3 -1
- package/dist/server/calendar.js.map +1 -1
- package/dist/server/checkbox.js +3 -1
- package/dist/server/checkbox.js.map +1 -1
- package/dist/server/collection-dnd.js +8 -36
- package/dist/server/collection-dnd.js.map +1 -1
- package/dist/server/color-field.js +7 -2
- package/dist/server/color-field.js.map +1 -1
- package/dist/server/color-thumb.js +6 -2
- package/dist/server/color-thumb.js.map +1 -1
- package/dist/server/drop-zone.js +12 -5
- package/dist/server/drop-zone.js.map +1 -1
- package/dist/server/grid-list.js +16 -32
- package/dist/server/grid-list.js.map +1 -1
- package/dist/server/hidden-date-input.js +3 -1
- package/dist/server/hidden-date-input.js.map +1 -1
- package/dist/server/list-box.js +25 -69
- package/dist/server/list-box.js.map +1 -1
- package/dist/server/menu.js +10 -31
- package/dist/server/menu.js.map +1 -1
- package/dist/server/modal.js +35 -67
- package/dist/server/modal.js.map +1 -1
- package/dist/server/popover.js +71 -98
- package/dist/server/popover.js.map +1 -1
- package/dist/server/radio-group.js +3 -1
- package/dist/server/radio-group.js.map +1 -1
- package/dist/server/shared-element-transition.js +13 -42
- package/dist/server/shared-element-transition.js.map +1 -1
- package/dist/server/sheet.js +135 -60
- package/dist/server/sheet.js.map +1 -1
- package/dist/server/slider.js +3 -1
- package/dist/server/slider.js.map +1 -1
- package/dist/server/switch.js +3 -1
- package/dist/server/switch.js.map +1 -1
- package/dist/server/table.js +8 -3
- package/dist/server/table.js.map +1 -1
- package/dist/server/tabs.js +180 -169
- package/dist/server/tabs.js.map +1 -1
- package/dist/server/toast.js +68 -101
- package/dist/server/toast.js.map +1 -1
- package/dist/server/token-field.js +2 -2
- package/dist/server/tooltip.js +34 -61
- package/dist/server/tooltip.js.map +1 -1
- package/dist/server/tree.js +156 -130
- package/dist/server/tree.js.map +1 -1
- package/dist/server/virtualizer.js +3 -1
- package/dist/server/virtualizer.js.map +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Styleable, accessible components for Solid 2, ported from Adobe React Aria Components. Components compose the local `@solid2-aria/core` behaviors and `@solid2-aria/stately` state managers.
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add @solid2-aria/components solid-js@next @solidjs/web@next
|
|
9
|
+
```
|
|
10
|
+
|
|
5
11
|
## Use a component
|
|
6
12
|
|
|
7
13
|
Configure your JSX compiler for Solid 2 and set TypeScript's `jsxImportSource` to `@solidjs/web`.
|
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.
|
|
@@ -18,7 +18,7 @@ import { assignRef, createRenderProps, dom } from "./utils.js";
|
|
|
18
18
|
import { DragAndDropContext } from "./drag-and-drop.js";
|
|
19
19
|
import { createComponent, dynamic, getNextElement, memo, mergeProps, ref, runHydrationEvents, spread, template } from "@solidjs/web";
|
|
20
20
|
import { mergeProps as mergeProps$1 } from "@solid2-aria/core/utils/merge-props";
|
|
21
|
-
import {
|
|
21
|
+
import { createMemo, createSignal, merge, untrack, useContext } from "solid-js";
|
|
22
22
|
import { requireValue } from "@solid2-aria/core/utils/require-value";
|
|
23
23
|
import { createVisuallyHidden } from "@solid2-aria/core/visually-hidden/visually-hidden";
|
|
24
24
|
import { ListKeyboardDelegate } from "@solid2-aria/core/selection/list-keyboard-delegate";
|
|
@@ -93,46 +93,43 @@ function CollectionDropIndicator(props) {
|
|
|
93
93
|
}));
|
|
94
94
|
const Tag = dynamic(() => props.table === true ? dom.tr : dom.div);
|
|
95
95
|
const Cell = dynamic(() => props.table === true ? dom.td : dom.div);
|
|
96
|
-
return
|
|
97
|
-
|
|
96
|
+
return memo(() => {
|
|
97
|
+
return memo(() => {
|
|
98
98
|
return !aria.isHidden;
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
99
|
+
})() ? createComponent(Tag, mergeProps(render, {
|
|
100
|
+
role: "row",
|
|
101
|
+
ref: (element) => {
|
|
102
|
+
assignRef(untrack(() => props.ref), element);
|
|
103
|
+
},
|
|
104
|
+
get "data-drop-target"() {
|
|
105
|
+
return aria.isDropTarget || void 0;
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return createComponent(Cell, {
|
|
109
|
+
role: "gridcell",
|
|
110
|
+
get colspan() {
|
|
111
|
+
return props.columnCount;
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return [(() => {
|
|
115
|
+
var _el$ = getNextElement(_tmpl$);
|
|
116
|
+
spread(_el$, [() => {
|
|
117
|
+
return mergeProps$1(merge(() => hidden.visuallyHiddenProps ?? {}), merge(() => aria.dropIndicatorProps ?? {}));
|
|
118
|
+
}, { role: "button" }], false);
|
|
119
|
+
ref(() => {
|
|
120
|
+
return (element) => {
|
|
121
|
+
setButtonRef(element);
|
|
122
|
+
};
|
|
123
|
+
}, _el$);
|
|
124
|
+
runHydrationEvents();
|
|
125
|
+
return _el$;
|
|
126
|
+
})(), memo(() => {
|
|
127
|
+
return render.children;
|
|
128
|
+
})];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
})) : void 0;
|
|
136
133
|
});
|
|
137
134
|
}
|
|
138
135
|
function createCollectionItemDragAndDrop(context, key, dropRef, activateButtonRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-dnd.js","names":["<Preview\n ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}\n >\n {renderDragPreview}\n </Preview>","ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}","<Show when={!aria.isHidden}>\n <Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>\n </Show>","<Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>","role=\"row\"","ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>","role=\"gridcell\"","role=\"button\"","ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}","render.children","_$createComponent","mergeProps","_$mergeProps","_$getNextElement","_$memo"],"sources":["../../src/collection-dnd.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-components/src/GridList.tsx.\n * Modified for Solid Aria: collections, selection, drag and drop, and DOM rendering use Solid 2 ownership and reactive getters; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { DroppableCollectionOptions } from \"@solid2-aria/core/dnd/create-droppable-collection\";\nimport { ListKeyboardDelegate } from \"@solid2-aria/core/selection/list-keyboard-delegate\";\nimport type { HTMLAttributes } from \"@solid2-aria/core/types\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { requireValue } from \"@solid2-aria/core/utils/require-value\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { DraggableCollectionState } from \"@solid2-aria/stately/dnd/create-draggable-collection-state\";\nimport type { DroppableCollectionState } from \"@solid2-aria/stately/dnd/create-droppable-collection-state\";\nimport type { MultipleSelectionManager } from \"@solid2-aria/stately/selection/types\";\nimport type {\n Collection as ICollection,\n Node,\n Key,\n DragPreviewRenderer,\n Orientation,\n KeyboardDelegate,\n DroppableCollectionProps,\n DropTargetDelegate,\n} from \"@solid2-aria/types-shared\";\nimport { dynamic } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n untrack,\n createSignal,\n createMemo,\n useContext,\n Show,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport type { DragAndDropHooks } from \"./create-drag-and-drop\";\nimport { DragAndDropContext } from \"./drag-and-drop\";\nimport type {\n DragAndDropContextValue,\n DropIndicatorProps,\n} from \"./drag-and-drop\";\nimport { assignRef, dom, createRenderProps } from \"./utils\";\n\nexport interface CollectionDragAndDrop<T> {\n readonly collectionProps: HTMLAttributes | undefined;\n dragAndDropHooks: DragAndDropHooks<T> | undefined;\n dragState: DraggableCollectionState | undefined;\n dropState: DroppableCollectionState | undefined;\n readonly preview: JSX.Element;\n}\n\nexport function createCollectionDragAndDrop<T>(options: {\n hooks?: DragAndDropHooks<T>;\n collection: ICollection<Node<T>>;\n selectionManager: MultipleSelectionManager;\n ref: Accessor<HTMLElement | null>;\n keyboardDelegate?: KeyboardDelegate;\n dropTargetCollection?: Iterable<Node<T>>;\n onDropActivate?: DroppableCollectionProps[\"onDropActivate\"];\n onKeyDown?: DroppableCollectionOptions[\"onKeyDown\"];\n dropTargetDelegate?: DropTargetDelegate;\n layout?: \"stack\" | \"grid\";\n orientation?: Orientation;\n direction?: \"ltr\" | \"rtl\";\n}): CollectionDragAndDrop<T> {\n const hooks = untrack(() => options.hooks);\n\n const [previewRef, setPreviewRef] = createSignal<DragPreviewRenderer | null>(\n null,\n { ownedWrite: true }\n );\n\n const dragState = hooks?.createDraggableCollectionState?.({\n get collection() {\n return options.collection;\n },\n preview: hooks.renderDragPreview ? previewRef : undefined,\n get selectionManager() {\n return options.selectionManager;\n },\n });\n\n if (dragState) {\n hooks?.createDraggableCollection?.({}, dragState, options.ref);\n }\n\n const dropState = hooks?.createDroppableCollectionState?.({\n get collection() {\n return options.collection;\n },\n get selectionManager() {\n return options.selectionManager;\n },\n });\n\n const liveCollection: Iterable<Node<T>> = {\n [Symbol.iterator]() {\n return (options.dropTargetCollection ?? options.collection)[\n Symbol.iterator\n ]();\n },\n };\n\n const fallbackKeyboard = createMemo(\n () =>\n new ListKeyboardDelegate(\n options.collection,\n options.selectionManager.disabledKeys,\n options.ref\n )\n );\n\n const result = dropState\n ? hooks?.createDroppableCollection?.(\n {\n dropTargetDelegate:\n options.dropTargetDelegate ??\n hooks.dropTargetDelegate ??\n new hooks.ListDropTargetDelegate(liveCollection, options.ref, {\n direction: options.direction,\n layout: options.layout,\n orientation: options.orientation,\n }),\n get keyboardDelegate() {\n return options.keyboardDelegate ?? fallbackKeyboard();\n },\n onDropActivate: options.onDropActivate,\n onKeyDown: options.onKeyDown,\n },\n dropState,\n options.ref\n )\n : undefined;\n\n const Preview = hooks?.DragPreview;\n const renderDragPreview = hooks?.renderDragPreview;\n\n return {\n get collectionProps() {\n return result?.collectionProps;\n },\n dragAndDropHooks: hooks,\n dragState,\n dropState,\n get preview() {\n return (\n <>\n {Preview && renderDragPreview && (\n <Preview\n ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}\n >\n {renderDragPreview}\n </Preview>\n )}\n </>\n );\n },\n };\n}\n\nexport function CollectionDropIndicator(\n props: DropIndicatorProps & { table?: boolean; columnCount?: number }\n) {\n const context = useContext(DragAndDropContext);\n\n const [buttonRef, setButtonRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = untrack(() =>\n requireValue(\n requireValue(\n context.dragAndDropHooks,\n \"Expected context.dragAndDropHooks\"\n ).createDropIndicator,\n \"Expected context.dragAndDropHooks!.createDropIndicator\"\n )(\n props,\n requireValue(context.dropState, \"Expected context.dropState\"),\n buttonRef\n )\n );\n\n const hidden = createVisuallyHidden();\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-DropIndicator\",\n get values() {\n return { isDropTarget: aria.isDropTarget };\n },\n })\n );\n\n const Tag = dynamic(() => (props.table === true ? dom.tr : dom.div));\n const Cell = dynamic(() => (props.table === true ? dom.td : dom.div));\n\n return (\n <Show when={!aria.isHidden}>\n <Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>\n </Show>\n );\n}\n\nexport function createCollectionItemDragAndDrop(\n context: DragAndDropContextValue,\n key: Key,\n dropRef: Accessor<HTMLElement | null>,\n activateButtonRef?: Accessor<HTMLElement | null>\n) {\n const drag = context.dragState\n ? context.dragAndDropHooks?.createDraggableItem?.(\n { hasDragButton: true, key },\n context.dragState\n )\n : undefined;\n\n const drop = context.dropState\n ? context.dragAndDropHooks?.createDropIndicator?.(\n {\n activateButtonRef,\n target: { dropPosition: \"on\", key, type: \"item\" },\n },\n context.dropState,\n dropRef\n )\n : undefined;\n\n return { drag, drop };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,SAAgB,4BAA+B,SAalB;CAC3B,MAAM,QAAQ,cAAc,QAAQ,KAAK;CAEzC,MAAM,CAAC,YAAY,iBAAiB,aAClC,MACA,EAAE,YAAY,KAAK,CACrB;CAEA,MAAM,YAAY,OAAO,iCAAiC;EACxD,IAAI,aAAa;GACf,OAAO,QAAQ;EACjB;EACA,SAAS,MAAM,oBAAoB,aAAa,KAAA;EAChD,IAAI,mBAAmB;GACrB,OAAO,QAAQ;EACjB;CACF,CAAC;CAED,IAAI,WACF,OAAO,4BAA4B,CAAC,GAAG,WAAW,QAAQ,GAAG;CAG/D,MAAM,YAAY,OAAO,iCAAiC;EACxD,IAAI,aAAa;GACf,OAAO,QAAQ;EACjB;EACA,IAAI,mBAAmB;GACrB,OAAO,QAAQ;EACjB;CACF,CAAC;CAED,MAAM,iBAAoC,EACxC,CAAC,OAAO,YAAY;EAClB,QAAQ,QAAQ,wBAAwB,QAAQ,WAAA,CAC9C,OAAO,SACR,CAAC;CACJ,EACF;CAEA,MAAM,mBAAmB,iBAErB,IAAI,qBACF,QAAQ,YACR,QAAQ,iBAAiB,cACzB,QAAQ,GACV,CACJ;CAEA,MAAM,SAAS,YACX,OAAO,4BACL;EACE,oBACE,QAAQ,sBACR,MAAM,sBACN,IAAI,MAAM,uBAAuB,gBAAgB,QAAQ,KAAK;GAC5D,WAAW,QAAQ;GACnB,QAAQ,QAAQ;GAChB,aAAa,QAAQ;EACvB,CAAC;EACH,IAAI,mBAAmB;GACrB,OAAO,QAAQ,oBAAoB,iBAAiB;EACtD;EACA,gBAAgB,QAAQ;EACxB,WAAW,QAAQ;CACrB,GACA,WACA,QAAQ,GACV,IACA,KAAA;CAEJ,MAAM,UAAU,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AAAO,eAAA,MAAA;QARC,OAAA,MAAA,OAAA;SAAI,OAAAF,aACF,YAAY,OAAO,uBAAuB,CAAC,CAAC,GAC5C,YAAY,KAAK,sBAAsB,CAAC,CAAC,CAC3C;QAAC,GAAA,EACDJ,MAAAA,SAAAA,CAAAA,GAAAA,KAAAA;QACA,UAAA;SAAM,QAAA,YAA4B;UAChC,aAAa,OAAO;SACtB;QAAC,GAFDC,IAEC;QARH,mBASC;QATD,OAAA;OASC,EAAA,CAAA,GACAC,WAAAA;QAAO,OAAA,OAAA;OAAO,CAAA,CAVhB;MAWK;;IACH;;EACD;;AAEV;AAEA,SAAgB,gCACd,SACA,KACA,SACA,mBACA;CAmBA,OAAO;EAAE,MAlBI,QAAQ,YACjB,QAAQ,kBAAkB,sBACxB;GAAE,eAAe;GAAM;EAAI,GAC3B,QAAQ,SACV,IACA,KAAA;EAaW,MAXF,QAAQ,YACjB,QAAQ,kBAAkB,sBACxB;GACE;GACA,QAAQ;IAAE,cAAc;IAAM;IAAK,MAAM;GAAO;EAClD,GACA,QAAQ,WACR,OACF,IACA,KAAA;CAEgB;AACtB"}
|
|
1
|
+
{"version":3,"file":"collection-dnd.js","names":["<Preview\n ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}\n >\n {renderDragPreview}\n </Preview>","ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}","<Show when={!aria.isHidden}>\n <Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>\n </Show>","<Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>","role=\"row\"","ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>","role=\"gridcell\"","role=\"button\"","ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}","render.children","_$createComponent","mergeProps","_$memo","_$mergeProps","_$getNextElement"],"sources":["../../src/collection-dnd.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-components/src/GridList.tsx.\n * Modified for Solid Aria: collections, selection, drag and drop, and DOM rendering use Solid 2 ownership and reactive getters; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { DroppableCollectionOptions } from \"@solid2-aria/core/dnd/create-droppable-collection\";\nimport { ListKeyboardDelegate } from \"@solid2-aria/core/selection/list-keyboard-delegate\";\nimport type { HTMLAttributes } from \"@solid2-aria/core/types\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { requireValue } from \"@solid2-aria/core/utils/require-value\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { DraggableCollectionState } from \"@solid2-aria/stately/dnd/create-draggable-collection-state\";\nimport type { DroppableCollectionState } from \"@solid2-aria/stately/dnd/create-droppable-collection-state\";\nimport type { MultipleSelectionManager } from \"@solid2-aria/stately/selection/types\";\nimport type {\n Collection as ICollection,\n Node,\n Key,\n DragPreviewRenderer,\n Orientation,\n KeyboardDelegate,\n DroppableCollectionProps,\n DropTargetDelegate,\n} from \"@solid2-aria/types-shared\";\nimport { dynamic } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n untrack,\n createSignal,\n createMemo,\n useContext,\n Show,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport type { DragAndDropHooks } from \"./create-drag-and-drop\";\nimport { DragAndDropContext } from \"./drag-and-drop\";\nimport type {\n DragAndDropContextValue,\n DropIndicatorProps,\n} from \"./drag-and-drop\";\nimport { assignRef, dom, createRenderProps } from \"./utils\";\n\nexport interface CollectionDragAndDrop<T> {\n readonly collectionProps: HTMLAttributes | undefined;\n dragAndDropHooks: DragAndDropHooks<T> | undefined;\n dragState: DraggableCollectionState | undefined;\n dropState: DroppableCollectionState | undefined;\n readonly preview: JSX.Element;\n}\n\nexport function createCollectionDragAndDrop<T>(options: {\n hooks?: DragAndDropHooks<T>;\n collection: ICollection<Node<T>>;\n selectionManager: MultipleSelectionManager;\n ref: Accessor<HTMLElement | null>;\n keyboardDelegate?: KeyboardDelegate;\n dropTargetCollection?: Iterable<Node<T>>;\n onDropActivate?: DroppableCollectionProps[\"onDropActivate\"];\n onKeyDown?: DroppableCollectionOptions[\"onKeyDown\"];\n dropTargetDelegate?: DropTargetDelegate;\n layout?: \"stack\" | \"grid\";\n orientation?: Orientation;\n direction?: \"ltr\" | \"rtl\";\n}): CollectionDragAndDrop<T> {\n const hooks = untrack(() => options.hooks);\n\n const [previewRef, setPreviewRef] = createSignal<DragPreviewRenderer | null>(\n null,\n { ownedWrite: true }\n );\n\n const dragState = hooks?.createDraggableCollectionState?.({\n get collection() {\n return options.collection;\n },\n preview: hooks.renderDragPreview ? previewRef : undefined,\n get selectionManager() {\n return options.selectionManager;\n },\n });\n\n if (dragState) {\n hooks?.createDraggableCollection?.({}, dragState, options.ref);\n }\n\n const dropState = hooks?.createDroppableCollectionState?.({\n get collection() {\n return options.collection;\n },\n get selectionManager() {\n return options.selectionManager;\n },\n });\n\n const liveCollection: Iterable<Node<T>> = {\n [Symbol.iterator]() {\n return (options.dropTargetCollection ?? options.collection)[\n Symbol.iterator\n ]();\n },\n };\n\n const fallbackKeyboard = createMemo(\n () =>\n new ListKeyboardDelegate(\n options.collection,\n options.selectionManager.disabledKeys,\n options.ref\n )\n );\n\n const result = dropState\n ? hooks?.createDroppableCollection?.(\n {\n dropTargetDelegate:\n options.dropTargetDelegate ??\n hooks.dropTargetDelegate ??\n new hooks.ListDropTargetDelegate(liveCollection, options.ref, {\n direction: options.direction,\n layout: options.layout,\n orientation: options.orientation,\n }),\n get keyboardDelegate() {\n return options.keyboardDelegate ?? fallbackKeyboard();\n },\n onDropActivate: options.onDropActivate,\n onKeyDown: options.onKeyDown,\n },\n dropState,\n options.ref\n )\n : undefined;\n\n const Preview = hooks?.DragPreview;\n const renderDragPreview = hooks?.renderDragPreview;\n\n return {\n get collectionProps() {\n return result?.collectionProps;\n },\n dragAndDropHooks: hooks,\n dragState,\n dropState,\n get preview() {\n return (\n <>\n {Preview && renderDragPreview && (\n <Preview\n ref={(element: DragPreviewRenderer | null) => {\n setPreviewRef(() => element);\n }}\n >\n {renderDragPreview}\n </Preview>\n )}\n </>\n );\n },\n };\n}\n\nexport function CollectionDropIndicator(\n props: DropIndicatorProps & { table?: boolean; columnCount?: number }\n) {\n const context = useContext(DragAndDropContext);\n\n const [buttonRef, setButtonRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = untrack(() =>\n requireValue(\n requireValue(\n context.dragAndDropHooks,\n \"Expected context.dragAndDropHooks\"\n ).createDropIndicator,\n \"Expected context.dragAndDropHooks!.createDropIndicator\"\n )(\n props,\n requireValue(context.dropState, \"Expected context.dropState\"),\n buttonRef\n )\n );\n\n const hidden = createVisuallyHidden();\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-DropIndicator\",\n get values() {\n return { isDropTarget: aria.isDropTarget };\n },\n })\n );\n\n const Tag = dynamic(() => (props.table === true ? dom.tr : dom.div));\n const Cell = dynamic(() => (props.table === true ? dom.td : dom.div));\n\n return (\n <Show when={!aria.isHidden}>\n <Tag\n {...render}\n role=\"row\"\n ref={(element: HTMLElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-drop-target={aria.isDropTarget || undefined}\n >\n <Cell role=\"gridcell\" colspan={props.columnCount}>\n <div\n {...mergeProps(\n merge(() => hidden.visuallyHiddenProps ?? {}),\n merge(() => aria.dropIndicatorProps ?? {})\n )}\n role=\"button\"\n ref={(element: HTMLDivElement) => {\n setButtonRef(element);\n }}\n />\n {render.children}\n </Cell>\n </Tag>\n </Show>\n );\n}\n\nexport function createCollectionItemDragAndDrop(\n context: DragAndDropContextValue,\n key: Key,\n dropRef: Accessor<HTMLElement | null>,\n activateButtonRef?: Accessor<HTMLElement | null>\n) {\n const drag = context.dragState\n ? context.dragAndDropHooks?.createDraggableItem?.(\n { hasDragButton: true, key },\n context.dragState\n )\n : undefined;\n\n const drop = context.dropState\n ? context.dragAndDropHooks?.createDropIndicator?.(\n {\n activateButtonRef,\n target: { dropPosition: \"on\", key, type: \"item\" },\n },\n context.dropState,\n dropRef\n )\n : undefined;\n\n return { drag, drop };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,SAAgB,4BAA+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C,aAAa,OAAO;QACtB;OAAC,GAFDC,IAEC;OARH,mBASC;OATD,OAAA;MASC,EAAA,CAAA,GACAC,WAAAA;OAAO,OAAA,OAAA;MAAO,CAAA,CAVhB;KAWK;;GACH;EAzBP,CAAA,CAAA,IAAA,KAAA;CA0BM,CAAA;AAEV;AAEA,SAAgB,gCACd,SACA,KACA,SACA,mBACA;CAmBA,OAAO;EAAE,MAlBI,QAAQ,YACjB,QAAQ,kBAAkB,sBACxB;GAAE,eAAe;GAAM;EAAI,GAC3B,QAAQ,SACV,IACA,KAAA;EAaW,MAXF,QAAQ,YACjB,QAAQ,kBAAkB,sBACxB;GACE;GACA,QAAQ;IAAE,cAAc;IAAM;IAAK,MAAM;GAAO;EAClD,GACA,QAAQ,WACR,OACF,IACA,KAAA;CAEgB;AACtB"}
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.
|
|
15
15
|
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
16
|
*/
|
|
17
|
-
import { assignRef, createContextProps, createRenderProps, createSlot, dom, removeDataAttributes } from "./utils.js";
|
|
17
|
+
import { assignRef, createContextProps, createRenderProps, createSlot, createSlottedContext, dom, removeDataAttributes } from "./utils.js";
|
|
18
18
|
import { LabelContext } from "./label.js";
|
|
19
19
|
import { TextContext } from "./text.js";
|
|
20
20
|
import { FieldErrorContext } from "./field-error.js";
|
|
21
|
+
import { FormContext } from "./form.js";
|
|
21
22
|
import { GroupContext } from "./group.js";
|
|
22
23
|
import { InputContext } from "./input.js";
|
|
23
|
-
import { createComponent, effect, getNextElement, memo, mergeProps, setAttribute, setProperty, template } from "@solidjs/web";
|
|
24
|
+
import { createComponent, effect, getNextElement, heldRead, memo, mergeProps, setAttribute, setProperty, template } from "@solidjs/web";
|
|
24
25
|
import { mergeProps as mergeProps$1 } from "@solid2-aria/core/utils/merge-props";
|
|
25
26
|
import { Show, createContext, createSignal, merge, omit, untrack } from "solid-js";
|
|
26
27
|
import { filterDOMProps } from "@solid2-aria/core/utils/filter-dom-props";
|
|
@@ -34,7 +35,11 @@ var _tmpl$ = /* @__PURE__ */ template(`<input type=hidden>`);
|
|
|
34
35
|
const ColorFieldContext = createContext(null);
|
|
35
36
|
const ColorFieldStateContext = createContext(null);
|
|
36
37
|
function ColorField(input) {
|
|
37
|
-
const [
|
|
38
|
+
const [contextProps, , setRef] = createContextProps(input, untrack(() => input.ref), ColorFieldContext);
|
|
39
|
+
const form = createSlottedContext(FormContext);
|
|
40
|
+
const props = mergeProps$1(contextProps, { get validationBehavior() {
|
|
41
|
+
return contextProps.validationBehavior ?? form?.validationBehavior ?? "native";
|
|
42
|
+
} });
|
|
38
43
|
return createComponent(Show, {
|
|
39
44
|
get when() {
|
|
40
45
|
return props.channel;
|
|
@@ -107,12 +112,13 @@ function ColorChannelField(props) {
|
|
|
107
112
|
return {
|
|
108
113
|
e: props.name,
|
|
109
114
|
t: props.form,
|
|
110
|
-
a: Number.isNaN(state.numberValue) ? "" : state.numberValue
|
|
115
|
+
a: Number.isNaN(state.numberValue) ? "" : state.numberValue,
|
|
116
|
+
o: heldRead()
|
|
111
117
|
};
|
|
112
|
-
}, ({ e, t, a }, _p$) => {
|
|
118
|
+
}, ({ e, t, a, o }, _p$) => {
|
|
113
119
|
e !== _p$?.e && setAttribute(_el$, "name", e);
|
|
114
120
|
t !== _p$?.t && setAttribute(_el$, "form", t);
|
|
115
|
-
setProperty(_el$, "value", a);
|
|
121
|
+
(a !== _p$?.a || !o) && setProperty(_el$, "value", a);
|
|
116
122
|
});
|
|
117
123
|
return _el$;
|
|
118
124
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-field.js","names":["<Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>","<HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","<ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />","<ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","<ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","{(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}","form={props.form}","value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}","<ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>","value={state}","<InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>","<LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>","<GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>","value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}","<TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>","value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}","<FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>","value={aria}","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>","dom.div","ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}","typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined","_$createComponent","_$mergeProps","mergeProps","_$memo","_$getNextElement","_$setAttribute"],"sources":["../../src/color-field.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-components/src/ColorField.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createColorChannelField } from \"@solid2-aria/core/color/create-color-channel-field\";\nimport { createColorField } from \"@solid2-aria/core/color/create-color-field\";\nimport type {\n AriaColorFieldProps,\n ColorFieldAria,\n} from \"@solid2-aria/core/color/create-color-field\";\nimport { createLocale } from \"@solid2-aria/core/i18n/i18n-provider\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createColorChannelFieldState } from \"@solid2-aria/stately/color/create-color-channel-field-state\";\nimport { createColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type { ColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type {\n ColorChannel,\n ColorSpace,\n} from \"@solid2-aria/stately/color/types\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n untrack,\n createSignal,\n merge,\n createContext,\n Show,\n omit,\n} from \"solid-js\";\n\nimport { FieldErrorContext } from \"./field-error\";\nimport { GroupContext } from \"./group\";\nimport { InputContext } from \"./input\";\nimport { LabelContext } from \"./label\";\nimport { TextContext } from \"./text\";\nimport {\n dom,\n assignRef,\n createContextProps,\n createRenderProps,\n createSlot,\n removeDataAttributes,\n} from \"./utils\";\nimport type {\n ContextValue,\n RenderProps,\n SlotProps,\n Ref,\n RACValidation,\n} from \"./utils\";\n\nexport interface ColorFieldRenderProps {\n isDisabled: boolean;\n isInvalid: boolean;\n isReadOnly: boolean;\n isRequired: boolean;\n channel: ColorChannel | \"hex\";\n state: ColorFieldState;\n}\n\nexport interface ColorFieldProps\n extends\n Omit<\n AriaColorFieldProps,\n | \"label\"\n | \"placeholder\"\n | \"description\"\n | \"errorMessage\"\n | \"validationState\"\n | \"validationBehavior\"\n >,\n RACValidation,\n RenderProps<ColorFieldRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n channel?: ColorChannel;\n colorSpace?: ColorSpace;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ColorFieldContext =\n createContext<ContextValue<ColorFieldProps, HTMLDivElement>>(null);\n\nexport const ColorFieldStateContext = createContext<ColorFieldState | null>(\n null\n);\n\nexport function ColorField(input: ColorFieldProps): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ColorFieldContext\n );\n\n return (\n <Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>\n );\n}\n\nfunction HexColorField(props: ColorFieldProps): JSX.Element {\n const options = mergeProps(props, {\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n );\n}\n\nfunction ColorChannelField(\n props: ColorFieldProps & { channel: ColorChannel }\n): JSX.Element {\n const locale = createLocale();\n\n const options = mergeProps(props, {\n get locale() {\n return locale.locale;\n },\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorChannelFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorChannelField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <>\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n {(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}\n </>\n );\n}\n\nfunction ColorFieldChildren(input: {\n props: ColorFieldProps;\n state: ColorFieldState;\n aria: ColorFieldAria | ReturnType<typeof createColorChannelField>;\n inputRef: (element: HTMLInputElement) => void;\n registerLabel: ReturnType<typeof createSlot>[0];\n}): JSX.Element {\n const { props } = untrack(() => input);\n const { state } = untrack(() => input);\n const { aria } = untrack(() => input);\n\n const values: ColorFieldRenderProps = {\n get channel() {\n return props.channel ?? \"hex\";\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n get isReadOnly() {\n return props.isReadOnly ?? false;\n },\n get isRequired() {\n return props.isRequired ?? false;\n },\n state,\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-ColorField\", values })\n );\n\n return (\n <ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,MAAa,oBACX,cAA6D,IAAI;AAEnE,MAAa,yBAAyB,cACpC,IACF;AAEA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,CAAC,SAAS,UAAU,mBACxB,OACA,cAAc,MAAM,GAAG,GACvB,iBACF;CAEA,OACEA,gBAAAA,MAAAA;EACE,IAAA,OAAA;GAAM,OAAA,MAAM;EAAO;EACnB,IAAA,WAAA;GACEC,OAAAA,gBAAAA,eAAAA,WACM,OADN,EAEEC,MAAM,YAA4B;IAChC,OAAO,OAAO;GAChB,EACD,CAAA,CAAA;EACH;EATFF,WAWI,YACAG,gBAAAA,mBAAAA,WACM,OADN;GAEED,MAAM,YAA4B;IAChC,OAAO,OAAO;GAChB;GACA,IAAA,UAAA;IAAS,OAAA,QAAQ;GAAC;EACnB,CAAA,CAAA;CAEC,CAAA;AAEV;AAEA,SAAS,cAAc,OAAqC;CAC1D,MAAM,UAAUyB,aAAW,OAAO,EAChC,IAAI,qBAAqB;EACvB,OAAO,MAAM,sBAAsB;CACrC,EACF,CAAC;CAED,MAAM,QAAQ,sBAAsB,OAAO;CAE3C,MAAM,CAAC,UAAU,eAAe,aAAsC,MAAM,EAC1E,YAAY,KACd,CAAC;CAED,MAAM,CAAC,eAAe,SAAS,kBAE1B,MAAM,aAAa,EAAE,UAAU,OAAO,MACtC,MAAM,kBAAkB,EAAE,UAAU,OAAO,CAChD;CAEA,MAAM,OAAO,iBACXA,aAAW,qBA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AAA,gBAAAA,mBAAAA;YAAmBC,OAAO;YAA1B,IAAA,WAAA;aACEC,OAAAA,gBAAAA,IAACC,KAADD,iBACE;cAEK,OAAA,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI;aAEvD,GACI,QANN;cAOEE,MAAM,OAAuB;eAC3B,UACE,cAAc,MAAM,GAAG,GACvB,EACF;cACF;cACA,IAAA,OAAA;eACEC,OAAAA,WAAAA;gBAAO,OAAA,CAAA,EAAA,OAAA,MAAM,SAAS,YAAY,MAAM,KAAK,SAAS;eAE1C,CAAA,CAAC,CAAD,IADR,MAAM,OACN,KAAA;cACN;cACA,IAAA,iBAAA;eAAc,OAAA,MAAM,WAAW;cAAK;cACpC,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAC3D,IAAA,iBAAA;eAAc,OAAA,KAAK,aAAa,KAAA;cAAS;cACzC,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAC3D,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAtB7D,IAAA,WAAA;eAwBG,OAAA,OAAO;cACD;;YACQ;;UACR;;QACD;;MACF;;IACF;;EACQ;;AAE5B"}
|
|
1
|
+
{"version":3,"file":"color-field.js","names":["<Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>","<HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","<ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />","<ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","<ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","{(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}","form={props.form}","value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}","name={props.name}","<ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>","value={state}","<InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>","<LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>","<GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>","value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}","<TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>","value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}","<FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>","value={aria}","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>","dom.div","ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}","typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined","mergeProps","_$createComponent","_$mergeProps","_$memo","_$getNextElement","_$heldRead","_$setAttribute","_$setProperty"],"sources":["../../src/color-field.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-components/src/ColorField.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createColorChannelField } from \"@solid2-aria/core/color/create-color-channel-field\";\nimport { createColorField } from \"@solid2-aria/core/color/create-color-field\";\nimport type {\n AriaColorFieldProps,\n ColorFieldAria,\n} from \"@solid2-aria/core/color/create-color-field\";\nimport { createLocale } from \"@solid2-aria/core/i18n/i18n-provider\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createColorChannelFieldState } from \"@solid2-aria/stately/color/create-color-channel-field-state\";\nimport { createColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type { ColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type {\n ColorChannel,\n ColorSpace,\n} from \"@solid2-aria/stately/color/types\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n untrack,\n createSignal,\n merge,\n createContext,\n Show,\n omit,\n} from \"solid-js\";\n\nimport { FieldErrorContext } from \"./field-error\";\nimport { FormContext } from \"./form\";\nimport { GroupContext } from \"./group\";\nimport { InputContext } from \"./input\";\nimport { LabelContext } from \"./label\";\nimport { TextContext } from \"./text\";\nimport {\n dom,\n assignRef,\n createContextProps,\n createRenderProps,\n createSlot,\n createSlottedContext,\n removeDataAttributes,\n} from \"./utils\";\nimport type {\n ContextValue,\n RenderProps,\n SlotProps,\n Ref,\n RACValidation,\n} from \"./utils\";\n\nexport interface ColorFieldRenderProps {\n isDisabled: boolean;\n isInvalid: boolean;\n isReadOnly: boolean;\n isRequired: boolean;\n channel: ColorChannel | \"hex\";\n state: ColorFieldState;\n}\n\nexport interface ColorFieldProps\n extends\n Omit<\n AriaColorFieldProps,\n | \"label\"\n | \"placeholder\"\n | \"description\"\n | \"errorMessage\"\n | \"validationState\"\n | \"validationBehavior\"\n >,\n RACValidation,\n RenderProps<ColorFieldRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n channel?: ColorChannel;\n colorSpace?: ColorSpace;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ColorFieldContext =\n createContext<ContextValue<ColorFieldProps, HTMLDivElement>>(null);\n\nexport const ColorFieldStateContext = createContext<ColorFieldState | null>(\n null\n);\n\nexport function ColorField(input: ColorFieldProps): JSX.Element {\n const [contextProps, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ColorFieldContext\n );\n\n const form = createSlottedContext(FormContext);\n\n const props = mergeProps(contextProps, {\n get validationBehavior() {\n return (\n contextProps.validationBehavior ?? form?.validationBehavior ?? \"native\"\n );\n },\n });\n\n return (\n <Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>\n );\n}\n\nfunction HexColorField(props: ColorFieldProps): JSX.Element {\n const options = mergeProps(props, {\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n );\n}\n\nfunction ColorChannelField(\n props: ColorFieldProps & { channel: ColorChannel }\n): JSX.Element {\n const locale = createLocale();\n\n const options = mergeProps(props, {\n get locale() {\n return locale.locale;\n },\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorChannelFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorChannelField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <>\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n {(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}\n </>\n );\n}\n\nfunction ColorFieldChildren(input: {\n props: ColorFieldProps;\n state: ColorFieldState;\n aria: ColorFieldAria | ReturnType<typeof createColorChannelField>;\n inputRef: (element: HTMLInputElement) => void;\n registerLabel: ReturnType<typeof createSlot>[0];\n}): JSX.Element {\n const { props } = untrack(() => input);\n const { state } = untrack(() => input);\n const { aria } = untrack(() => input);\n\n const values: ColorFieldRenderProps = {\n get channel() {\n return props.channel ?? \"hex\";\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n get isReadOnly() {\n return props.isReadOnly ?? false;\n },\n get isRequired() {\n return props.isRequired ?? false;\n },\n state,\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-ColorField\", values })\n );\n\n return (\n <ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA,MAAa,oBACX,cAA6D,IAAI;AAEnE,MAAa,yBAAyB,cACpC,IACF;AAEA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,CAAC,gBAAgB,UAAU,mBAC/B,OACA,cAAc,MAAM,GAAG,GACvB,iBACF;CAEA,MAAM,OAAO,qBAAqB,WAAW;CAE7C,MAAM,QAAQ0B,aAAW,cAAc,EACrC,IAAI,qBAAqB;EACvB,OACE,aAAa,sBAAsB,MAAM,sBAAsB;CAEnE,EACF,CAAC;CAED,OACE1B,gBAAAA,MAAAA;EACE,IAAA,OAAA;GAAM,OAAA,MAAM;EAAO;EACnB,IAAA,WAAA;GACEC,OAAAA,gBAAAA,eAAAA,WACM,OADN,EAEEC,MAAM,YAA4B;IAChC,OAAO,OAAO;GAChB,EACD,CAAA,CAAA;EACH;EATFF,WAWI,YACAG,gBAAAA,mBAAAA,WACM,OADN;GAEED,MAAM,YAA4B;IAChC,OAAO,OAAO;GAChB;GACA,IAAA,UAAA;IAAS,OAAA,QAAQ;GAAC;EACnB,CAAA,CAAA;CAEC,CAAA;AAEV;AAEA,SAAS,cAAc,OAAqC;CAC1D,MAAM,UAAUwB,aAAW,OAAO,EAChC,IAAI,qBAAqB;EACvB,OAAO,MAAM,sBAAsB;CACrC,EACF,CAAC;CAED,MAAM,QAAQ,sBAAsB,OAAO;CAE3C,MAAM,CAAC,UAAU,eAAe,aAAsC,MAAM,EAC1E,YAAY,KACd,CAAC;CAED,MAAM,CAAC,eAAe,SAAS,kBAE1B,MAAM,aAAa,EAAE,UAAU,OAAO,MACtC,MAAM,kBAAkB,EAAE,UAAU,OAAO,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AChB,OAAO,KAAK;WACd;WACA,IAAI,eAAe;YACjB,OAAO,KAAK;WACd;UACF,EACF;UAVF,IAAA,WAAA;WAYEC,OAAAA,gBAAAA,mBAAAA;YAAmBC,OAAO;YAA1B,IAAA,WAAA;aACEC,OAAAA,gBAAAA,IAACC,KAADD,iBACE;cAEK,OAAA,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI;aAEvD,GACI,QANN;cAOEE,MAAM,OAAuB;eAC3B,UACE,cAAc,MAAM,GAAG,GACvB,EACF;cACF;cACA,IAAA,OAAA;eACEC,OAAAA,WAAAA;gBAAO,OAAA,CAAA,EAAA,OAAA,MAAM,SAAS,YAAY,MAAM,KAAK,SAAS;eAE1C,CAAA,CAAC,CAAD,IADR,MAAM,OACN,KAAA;cACN;cACA,IAAA,iBAAA;eAAc,OAAA,MAAM,WAAW;cAAK;cACpC,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAC3D,IAAA,iBAAA;eAAc,OAAA,KAAK,aAAa,KAAA;cAAS;cACzC,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAC3D,IAAA,kBAAA;eAAe,OAAA,MAAM,eAAe,OAAO,OAAO,KAAA;cAAS;cAtB7D,IAAA,WAAA;eAwBG,OAAA,OAAO;cACD;;YACQ;;UACR;;QACD;;MACF;;IACF;;EACQ;;AAE5B"}
|
|
@@ -26,12 +26,14 @@ import { createHover } from "@solid2-aria/core/interactions/create-hover";
|
|
|
26
26
|
import { createButton } from "@solid2-aria/core/button/create-button";
|
|
27
27
|
import { createVisuallyHidden } from "@solid2-aria/core/visually-hidden/visually-hidden";
|
|
28
28
|
import { createLocalizedStringFormatter } from "@solid2-aria/core/i18n/create-localized-string-formatter";
|
|
29
|
+
import { getEventTarget, getParentElement, nodeContains } from "@solid2-aria/core/utils/shadowdom/dom-functions";
|
|
29
30
|
import { createClipboard } from "@solid2-aria/core/dnd/create-clipboard";
|
|
30
31
|
import { createDrop } from "@solid2-aria/core/dnd/create-drop";
|
|
31
32
|
import { createSlotId } from "@solid2-aria/core/utils/create-id";
|
|
32
33
|
import { createLabels } from "@solid2-aria/core/utils/create-labels";
|
|
33
34
|
import { focusWithoutScrolling } from "@solid2-aria/core/utils/focus-without-scrolling";
|
|
34
35
|
import { isFocusable } from "@solid2-aria/core/utils/is-focusable";
|
|
36
|
+
import { isElement } from "@solid2-aria/core/utils/type-helpers";
|
|
35
37
|
// src/drop-zone.tsx
|
|
36
38
|
var _tmpl$ = /* @__PURE__ */ template(`<div><button>`);
|
|
37
39
|
const DropZoneContext = createContext(null);
|
|
@@ -120,15 +122,16 @@ function DropZone(input) {
|
|
|
120
122
|
return props.isDisabled ?? void 0;
|
|
121
123
|
},
|
|
122
124
|
onClick: (event) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
const eventTarget = getEventTarget(event);
|
|
126
|
+
let target = isElement(eventTarget) ? eventTarget : null;
|
|
127
|
+
while (target && nodeContains(ref$1(), target)) {
|
|
125
128
|
if (isFocusable(target)) break;
|
|
126
129
|
const focusTarget = buttonRef();
|
|
127
130
|
if (target === ref$1() && focusTarget) {
|
|
128
131
|
focusWithoutScrolling(focusTarget);
|
|
129
132
|
break;
|
|
130
133
|
}
|
|
131
|
-
target = target
|
|
134
|
+
target = getParentElement(target);
|
|
132
135
|
}
|
|
133
136
|
},
|
|
134
137
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop-zone.js","names":["<TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>\n </TextContext>","value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>","dom.div","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}","ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}","render.children","ref","mergeProps","intlMessages","_$createComponent","_$mergeProps","_$getNextElement","_$memo"],"sources":["../../src/drop-zone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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-components/src/DropZone.tsx.\n * Modified for Solid Aria: DOM refs, focus, drag, clipboard and render state use Solid factories; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createButton } from \"@solid2-aria/core/button/create-button\";\nimport { createClipboard } from \"@solid2-aria/core/dnd/create-clipboard\";\nimport { createDrop } from \"@solid2-aria/core/dnd/create-drop\";\nimport type { DropOptions } from \"@solid2-aria/core/dnd/create-drop\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createLocalizedStringFormatter } from \"@solid2-aria/core/i18n/create-localized-string-formatter\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createSlotId } from \"@solid2-aria/core/utils/create-id\";\nimport { createLabels } from \"@solid2-aria/core/utils/create-labels\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { focusWithoutScrolling } from \"@solid2-aria/core/utils/focus-without-scrolling\";\nimport { isFocusable } from \"@solid2-aria/core/utils/is-focusable\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { AriaLabelingProps, HoverEvents } from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, untrack, createSignal, createContext } from \"solid-js\";\n\nimport intlMessages from \"../intl\";\nimport { TextContext } from \"./text\";\nimport { dom, createContextProps, createRenderProps } from \"./utils\";\nimport type { ContextValue, RenderProps, SlotProps, Ref } from \"./utils\";\n\nexport interface DropZoneRenderProps {\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDropTarget: boolean;\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, \"getDropOperationForPoint\" | \"ref\" | \"hasDropButton\">,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const DropZoneContext =\n createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\nexport function DropZone(input: DropZoneProps) {\n const [props, ref, setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n DropZoneContext\n );\n\n const [buttonRef, setButtonRef] = createSignal<HTMLButtonElement | null>(\n null,\n { ownedWrite: true }\n );\n\n const drop = createDrop(\n mergeProps(props, { hasDropButton: true, ref: buttonRef })\n );\n\n const button = createButton(\n mergeProps(\n {\n get children() {\n return props.children;\n },\n },\n drop.dropButtonProps ?? {}\n ),\n buttonRef\n );\n\n const hover = createHover(props);\n const focus = createFocusRing();\n const hidden = createVisuallyHidden();\n const textId = createSlotId();\n\n const formatter = createLocalizedStringFormatter(\n intlMessages,\n \"@solid2-aria/components\"\n );\n\n const labels = createLabels({\n get \"aria-label\"() {\n return props[\"aria-label\"] ?? formatter.format(\"dropzoneLabel\");\n },\n get \"aria-labelledby\"() {\n return (\n [textId(), props[\"aria-labelledby\"]].filter(Boolean).join(\" \") ||\n undefined\n );\n },\n });\n\n const clipboard = createClipboard({\n get isDisabled() {\n return props.isDisabled;\n },\n onPaste: (items) =>\n props.onDrop?.({\n dropOperation: \"copy\",\n items,\n type: \"drop\",\n x: 0,\n y: 0,\n }),\n });\n\n const values = {\n get isDisabled() {\n return props.isDisabled === true;\n },\n get isDropTarget() {\n return drop.isDropTarget;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-DropZone\", values })\n );\n\n return (\n <TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n set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;OAAI,OAAA,OAAO;MAAmB,GAAA,IAAA;MAE/B,OAAA,aAAA;OAAI,OAAAJ,aACF,YAAY,OAAO,eAAe,CAAC,CAAC,GACpC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,YAAY,UAAU,kBAAkB,CAAC,CAAC,GAC1C,MACF;MAAC,GAAA,KAAA;MAED,UAAA;OAAM,QAAA,YAA+B;QACnC,aAAa,OAAO;OACtB;MAAC,GAFDH,KAEC;MAXL,mBAaK;MAbL,OAAA;KAaK,EAAA,CAAA,GACJC,WAAAA;MAAO,OAAA,OAAA;KAAO,CAAA,CAdhB;IAeQ;;EACE;;AAEjB"}
|
|
1
|
+
{"version":3,"file":"drop-zone.js","names":["<TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>\n </TextContext>","value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>","dom.div","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}","ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}","render.children","ref","mergeProps","intlMessages","_$createComponent","_$mergeProps","_$getNextElement","_$memo"],"sources":["../../src/drop-zone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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-components/src/DropZone.tsx.\n * Modified for Solid Aria: DOM refs, focus, drag, clipboard and render state use Solid factories; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createButton } from \"@solid2-aria/core/button/create-button\";\nimport { createClipboard } from \"@solid2-aria/core/dnd/create-clipboard\";\nimport { createDrop } from \"@solid2-aria/core/dnd/create-drop\";\nimport type { DropOptions } from \"@solid2-aria/core/dnd/create-drop\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createLocalizedStringFormatter } from \"@solid2-aria/core/i18n/create-localized-string-formatter\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createSlotId } from \"@solid2-aria/core/utils/create-id\";\nimport { createLabels } from \"@solid2-aria/core/utils/create-labels\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { focusWithoutScrolling } from \"@solid2-aria/core/utils/focus-without-scrolling\";\nimport { isFocusable } from \"@solid2-aria/core/utils/is-focusable\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport {\n getEventTarget,\n getParentElement,\n nodeContains,\n} from \"@solid2-aria/core/utils/shadowdom/dom-functions\";\nimport { isElement } from \"@solid2-aria/core/utils/type-helpers\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { AriaLabelingProps, HoverEvents } from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, untrack, createSignal, createContext } from \"solid-js\";\n\nimport intlMessages from \"../intl\";\nimport { TextContext } from \"./text\";\nimport { dom, createContextProps, createRenderProps } from \"./utils\";\nimport type { ContextValue, RenderProps, SlotProps, Ref } from \"./utils\";\n\nexport interface DropZoneRenderProps {\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDropTarget: boolean;\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, \"getDropOperationForPoint\" | \"ref\" | \"hasDropButton\">,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const DropZoneContext =\n createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\nexport function DropZone(input: DropZoneProps) {\n const [props, ref, setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n DropZoneContext\n );\n\n const [buttonRef, setButtonRef] = createSignal<HTMLButtonElement | null>(\n null,\n { ownedWrite: true }\n );\n\n const drop = createDrop(\n mergeProps(props, { hasDropButton: true, ref: buttonRef })\n );\n\n const button = createButton(\n mergeProps(\n {\n get children() {\n return props.children;\n },\n },\n drop.dropButtonProps ?? {}\n ),\n buttonRef\n );\n\n const hover = createHover(props);\n const focus = createFocusRing();\n const hidden = createVisuallyHidden();\n const textId = createSlotId();\n\n const formatter = createLocalizedStringFormatter(\n intlMessages,\n \"@solid2-aria/components\"\n );\n\n const labels = createLabels({\n get \"aria-label\"() {\n return props[\"aria-label\"] ?? formatter.format(\"dropzoneLabel\");\n },\n get \"aria-labelledby\"() {\n return (\n [textId(), props[\"aria-labelledby\"]].filter(Boolean).join(\" \") ||\n undefined\n );\n },\n });\n\n const clipboard = createClipboard({\n get isDisabled() {\n return props.isDisabled;\n },\n onPaste: (items) =>\n props.onDrop?.({\n dropOperation: \"copy\",\n items,\n type: \"drop\",\n x: 0,\n y: 0,\n }),\n });\n\n const values = {\n get isDisabled() {\n return props.isDisabled === true;\n },\n get isDropTarget() {\n return drop.isDropTarget;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-DropZone\", values })\n );\n\n return (\n <TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>\n </TextContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAa,kBACX,cAA2D,IAAI;AAEjE,SAAgB,SAAS,OAAsB;CAC7C,MAAM,CAAC,OAAOQ,OAAK,UAAU,mBAC3B,OACA,cAAc,MAAM,GAAG,GACvB,eACF;CAEA,MAAM,CAAC,WAA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AO;OACtB;MAAC,GAFDH,KAEC;MAXL,mBAaK;MAbL,OAAA;KAaK,EAAA,CAAA,GACJC,WAAAA;MAAO,OAAA,OAAA;KAAO,CAAA,CAdhB;IAeQ;;EACE;;AAEjB"}
|
|
@@ -22,7 +22,7 @@ import { JSX } from "@solidjs/web";
|
|
|
22
22
|
import { LoadMoreSentinelProps } from "@solid2-aria/core/utils/create-load-more-sentinel";
|
|
23
23
|
import { ListState } from "@solid2-aria/stately/list/create-list-state";
|
|
24
24
|
import { AriaGridListProps } from "@solid2-aria/core/gridlist/create-grid-list";
|
|
25
|
-
import { HoverEvents, Key, LinkDOMProps, Orientation, PressEvents, SelectionBehavior } from "@solid2-aria/types-shared";
|
|
25
|
+
import { FocusEvents, HoverEvents, Key, LinkDOMProps, Orientation, PressEvents, SelectionBehavior } from "@solid2-aria/types-shared";
|
|
26
26
|
import { GlobalDOMAttributes, HTMLAttributes } from "@solid2-aria/types-shared-web";
|
|
27
27
|
export interface GridListRenderProps {
|
|
28
28
|
isEmpty: boolean;
|
|
@@ -48,7 +48,7 @@ export interface GridListItemRenderProps extends ItemRenderProps {
|
|
|
48
48
|
isFocusVisibleWithin: boolean;
|
|
49
49
|
state: ListState<unknown>;
|
|
50
50
|
}
|
|
51
|
-
export interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Omit<GlobalDOMAttributes<HTMLDivElement>, "onClick"> {
|
|
51
|
+
export interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, FocusEvents<HTMLDivElement>, Omit<GlobalDOMAttributes<HTMLDivElement>, "onClick"> {
|
|
52
52
|
class?: ClassOrFunction<GridListItemRenderProps>;
|
|
53
53
|
id?: Key;
|
|
54
54
|
value?: T;
|