@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/dist/browser/tabs.js
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/*
|
|
13
13
|
* Derived from Adobe React Spectrum: packages/react-aria-components/src/Tabs.tsx.
|
|
14
|
-
* Modified for Solid Aria: adapted collection ownership, contexts, accessibility primitives, and reactive properties for Solid 2; uses Solid class props.
|
|
14
|
+
* Modified for Solid Aria: adapted collection ownership, contexts, accessibility primitives, and reactive properties for Solid 2; defers panel size measurement and scopes size variables for nested tabs; 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
17
|
import { assignRef, createContextProps, createRenderProps, createSlottedContext, dom } from "./utils.js";
|
|
18
18
|
import { CollectionRendererContext, DefaultCollectionRenderer } from "./collection.js";
|
|
19
19
|
import { SelectionIndicatorContext } from "./selection-indicator.js";
|
|
20
|
-
import { applyRef, createComponent, dynamic, mergeProps } from "@solidjs/web";
|
|
20
|
+
import { applyRef, createComponent, dynamic, memo, mergeProps } from "@solidjs/web";
|
|
21
21
|
import { mergeProps as mergeProps$1 } from "@solid2-aria/core/utils/merge-props";
|
|
22
|
-
import {
|
|
22
|
+
import { createContext, createEffect, createSignal, merge, omit, untrack, useContext } from "solid-js";
|
|
23
23
|
import { BaseCollection, ItemNode } from "@solid2-aria/core/collections/base-collection";
|
|
24
24
|
import { Collection, CollectionBuilder, createLeafComponent } from "@solid2-aria/core/collections/collection-builder";
|
|
25
25
|
import { filterDOMProps } from "@solid2-aria/core/utils/filter-dom-props";
|
|
@@ -31,6 +31,7 @@ import { createEnterAnimation, createExitAnimation } from "@solid2-aria/core/uti
|
|
|
31
31
|
import { createTab } from "@solid2-aria/core/tabs/create-tab";
|
|
32
32
|
import { createTabList } from "@solid2-aria/core/tabs/create-tab-list";
|
|
33
33
|
import { createTabPanel } from "@solid2-aria/core/tabs/create-tab-panel";
|
|
34
|
+
import { finishAnimations } from "@solid2-aria/core/utils/finish-animations";
|
|
34
35
|
import { createTabListState } from "@solid2-aria/stately/tabs/create-tab-list-state";
|
|
35
36
|
// src/tabs.tsx
|
|
36
37
|
const TabsContext = createContext(null);
|
|
@@ -110,16 +111,53 @@ const TabCollection = createLeafComponent(ItemNode, (props, forwardedRef, node)
|
|
|
110
111
|
});
|
|
111
112
|
function TabPanels(props) {
|
|
112
113
|
if (createIsHidden()) return null;
|
|
114
|
+
const state = useContext(TabListStateContext);
|
|
115
|
+
const [ref, setRef] = createSignal(null, { ownedWrite: true });
|
|
116
|
+
let selectedKey = untrack(() => state?.selectedKey);
|
|
117
|
+
let hasTransition;
|
|
118
|
+
createEffect(() => {
|
|
119
|
+
const element = ref();
|
|
120
|
+
return {
|
|
121
|
+
element,
|
|
122
|
+
key: state?.selectedKey,
|
|
123
|
+
previousSize: hasTransition === true && element ? element.getBoundingClientRect() : null
|
|
124
|
+
};
|
|
125
|
+
}, ({ element, key, previousSize }) => {
|
|
126
|
+
if (!element) return;
|
|
127
|
+
hasTransition ??= /width|height|block-size|inline-size|all/u.test(getComputedStyle(element).transition);
|
|
128
|
+
let frame;
|
|
129
|
+
if (hasTransition && selectedKey !== null && selectedKey !== void 0 && key !== selectedKey) frame = requestAnimationFrame(() => {
|
|
130
|
+
element.style.setProperty("--tab-panel-width", "auto");
|
|
131
|
+
element.style.setProperty("--tab-panel-height", "auto");
|
|
132
|
+
const { width, height } = element.getBoundingClientRect();
|
|
133
|
+
if (previousSize && (previousSize.width !== width || previousSize.height !== height)) {
|
|
134
|
+
element.style.setProperty("--tab-panel-width", `${previousSize.width}px`);
|
|
135
|
+
element.style.setProperty("--tab-panel-height", `${previousSize.height}px`);
|
|
136
|
+
getComputedStyle(element).height;
|
|
137
|
+
element.style.setProperty("--tab-panel-width", `${width}px`);
|
|
138
|
+
element.style.setProperty("--tab-panel-height", `${height}px`);
|
|
139
|
+
finishAnimations(element.getAnimations(), () => {
|
|
140
|
+
element.style.setProperty("--tab-panel-width", "auto");
|
|
141
|
+
element.style.setProperty("--tab-panel-height", "auto");
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
selectedKey = key;
|
|
146
|
+
return () => {
|
|
147
|
+
if (frame !== void 0) cancelAnimationFrame(frame);
|
|
148
|
+
};
|
|
149
|
+
}, { ssrSource: "client" });
|
|
113
150
|
return createComponent(dom.div, mergeProps(() => {
|
|
114
151
|
return omit(filterDOMProps(props, {
|
|
115
152
|
global: true,
|
|
116
153
|
labelable: true
|
|
117
154
|
}), "id");
|
|
118
155
|
}, {
|
|
119
|
-
ref(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
156
|
+
ref: [(element) => {
|
|
157
|
+
setRef(element);
|
|
158
|
+
}, (element) => {
|
|
159
|
+
assignRef(untrack(() => props.ref), element);
|
|
160
|
+
}],
|
|
123
161
|
get render() {
|
|
124
162
|
return props.render;
|
|
125
163
|
},
|
|
@@ -127,7 +165,11 @@ function TabPanels(props) {
|
|
|
127
165
|
return props.class ?? "solid2-aria-TabPanels";
|
|
128
166
|
},
|
|
129
167
|
get style() {
|
|
130
|
-
return
|
|
168
|
+
return {
|
|
169
|
+
"--tab-panel-height": "auto",
|
|
170
|
+
"--tab-panel-width": "auto",
|
|
171
|
+
...props.style
|
|
172
|
+
};
|
|
131
173
|
},
|
|
132
174
|
get children() {
|
|
133
175
|
return createComponent(Collection, props);
|
|
@@ -141,22 +183,19 @@ function TabPanel(props) {
|
|
|
141
183
|
const [panelRef, setPanelRef] = createSignal(null, { ownedWrite: true });
|
|
142
184
|
const initiallySelected = untrack(() => state.selectedKey === props.id);
|
|
143
185
|
const exiting = createExitAnimation(panelRef, () => state.selectedKey === props.id);
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
return (state.selectedKey === props.id || props.shouldForceMount) ?? exiting();
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
exiting
|
|
158
|
-
});
|
|
159
|
-
}
|
|
186
|
+
return memo(() => {
|
|
187
|
+
return memo(() => {
|
|
188
|
+
return !!((state.selectedKey === props.id || props.shouldForceMount) ?? exiting());
|
|
189
|
+
})() ? createComponent(TabPanelInner, {
|
|
190
|
+
props,
|
|
191
|
+
state,
|
|
192
|
+
panelRef,
|
|
193
|
+
setPanelRef: (element) => {
|
|
194
|
+
setPanelRef(element);
|
|
195
|
+
},
|
|
196
|
+
initiallySelected,
|
|
197
|
+
exiting
|
|
198
|
+
}) : void 0;
|
|
160
199
|
});
|
|
161
200
|
}
|
|
162
201
|
function TabPanelInner(input) {
|
|
@@ -289,8 +328,8 @@ function TabsInner(input) {
|
|
|
289
328
|
return mergeProps$1(filterDOMProps(input.props, { global: true }), merge(() => focus.focusProps ?? {}), render);
|
|
290
329
|
}, {
|
|
291
330
|
ref(r$) {
|
|
292
|
-
var _ref$
|
|
293
|
-
typeof _ref$
|
|
331
|
+
var _ref$ = input.tabsRef;
|
|
332
|
+
typeof _ref$ === "function" || Array.isArray(_ref$) ? applyRef(_ref$, r$) : input.tabsRef = r$;
|
|
294
333
|
},
|
|
295
334
|
get slot() {
|
|
296
335
|
return input.props.slot ?? void 0;
|
package/dist/browser/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["<Element\n {...mergeProps(\n omit(filterDOMProps(props, { global: true }), \"id\", \"onClick\"),\n merge(() => aria.tabProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}\n data-selected={aria.isSelected || undefined}\n data-disabled={aria.isDisabled || undefined}\n data-hovered={hover.isHovered || undefined}\n data-pressed={aria.isPressed || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>\n </Element>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}","<SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>","value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true, labelable: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n ref={props.ref}\n render={props.render}\n class={props.class ?? \"solid2-aria-TabPanels\"}\n style={props.style}\n >\n <Collection {...props} />\n </dom.div>","dom.div","ref={props.ref}","<Collection {...props} />","<Show\n when={\n (state.selectedKey === props.id || props.shouldForceMount) ?? exiting()\n }\n >\n <TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />\n </Show>","<TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />","setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}","<dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabPanelProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n inert={!selected() || input.props.inert}\n data-entering={values.isEntering || undefined}\n data-exiting={values.isExiting || undefined}\n data-inert={!selected() || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}","<TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>","value={null}","<TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>","<CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>","value={DefaultCollectionRenderer}","<TabCollection\n {...props}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n />","ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<TabListStateContext value={null}>\n <CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>\n </TabListStateContext>","<CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>","createCollection={() => new BaseCollection<object>()}","<TabsInner props={props} collection={collection} tabsRef={setRef} />","tabsRef={setRef}","<dom.div\n {...mergeProps(\n filterDOMProps(input.props, { global: true }),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={input.tabsRef}\n slot={input.props.slot ?? undefined}\n data-orientation={values.orientation}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={state.isDisabled || undefined}\n >\n <TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>\n </dom.div>","ref={input.tabsRef}","<TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>","value={tabProps}","<TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>","value={state}","<TabListInner props={props} state={state} />","<dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabListProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n data-orientation={values.orientation}\n >\n <Root collection={input.state.collection} />\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}","<Root collection={input.state.collection} />","mergeProps","_$createComponent","_$mergeProps","_$applyRef"],"sources":["../../src/tabs.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/Tabs.tsx.\n * Modified for Solid Aria: adapted collection ownership, contexts, accessibility primitives, and reactive properties for Solid 2; 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 {\n ItemNode,\n BaseCollection,\n} from \"@solid2-aria/core/collections/base-collection\";\nimport {\n Collection,\n CollectionBuilder,\n createLeafComponent,\n} from \"@solid2-aria/core/collections/collection-builder\";\nimport { createIsHidden } from \"@solid2-aria/core/collections/hidden\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createTab } from \"@solid2-aria/core/tabs/create-tab\";\nimport { createTabList } from \"@solid2-aria/core/tabs/create-tab-list\";\nimport type { AriaTabListProps } from \"@solid2-aria/core/tabs/create-tab-list\";\nimport { createTabPanel } from \"@solid2-aria/core/tabs/create-tab-panel\";\nimport type { AriaTabPanelProps } from \"@solid2-aria/core/tabs/create-tab-panel\";\nimport {\n createEnterAnimation,\n createExitAnimation,\n} from \"@solid2-aria/core/utils/animation\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { isTruthy } from \"@solid2-aria/core/utils/truthy\";\nimport { createTabListState } from \"@solid2-aria/stately/tabs/create-tab-list-state\";\nimport type { TabListState } from \"@solid2-aria/stately/tabs/create-tab-list-state\";\nimport type {\n AriaLabelingProps,\n FocusEvents,\n HoverEvents,\n Key,\n LinkDOMProps,\n PressEvents,\n Orientation,\n Node,\n} from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { dynamic } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n createSignal,\n createContext,\n useContext,\n omit,\n Show,\n untrack,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport {\n CollectionRendererContext,\n DefaultCollectionRenderer,\n} from \"./collection\";\nimport type { CollectionProps } from \"./collection\";\nimport { SelectionIndicatorContext } from \"./selection-indicator\";\nimport {\n dom,\n createContextProps,\n createRenderProps,\n createSlottedContext,\n assignRef,\n} from \"./utils\";\nimport type {\n Ref,\n ClassOrFunction,\n DOMRenderProps,\n PossibleLinkDOMRenderProps,\n RenderProps,\n SlotProps,\n StyleProps,\n StyleRenderProps,\n ContextValue,\n} from \"./utils\";\n\nexport const TabsContext =\n createContext<ContextValue<TabsProps, HTMLDivElement>>(null);\n\nexport const TabListStateContext = createContext<TabListState<unknown> | null>(\n null\n);\n\nexport interface TabsProps\n // oxlint-disable-next-line typescript/no-explicit-any -- Collection contexts erase item types; each typed factory restores its owner's item contract.\n extends\n Omit<AriaTabListProps<unknown>, \"items\" | \"children\">,\n RenderProps<TabsRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Tabs'\n */\n class?: ClassOrFunction<TabsRenderProps>;\n}\n\nexport interface TabsRenderProps {\n /**\n * The orientation of the tabs.\n *\n * @selector [data-orientation=\"horizontal | vertical\"]\n */\n orientation: Orientation;\n}\n\nexport interface TabListProps<T>\n extends\n StyleRenderProps<TabListRenderProps>,\n AriaLabelingProps,\n Omit<CollectionProps<T>, \"disabledKeys\">,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-TabList'\n */\n class?: ClassOrFunction<TabListRenderProps>;\n}\n\nexport interface TabListRenderProps {\n /**\n * The orientation of the tab list.\n *\n * @selector [data-orientation=\"horizontal | vertical\"]\n */\n orientation: Orientation;\n /**\n * State of the tab list.\n */\n state: TabListState<unknown>;\n}\n\nexport interface TabProps\n extends\n Omit<RenderProps<TabRenderProps>, \"render\">,\n PossibleLinkDOMRenderProps<\"div\", TabRenderProps>,\n AriaLabelingProps,\n LinkDOMProps,\n HoverEvents,\n FocusEvents,\n PressEvents,\n Omit<GlobalDOMAttributes<HTMLDivElement>, \"onClick\"> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Tab'\n */\n class?: ClassOrFunction<TabRenderProps>;\n /** The unique id of the tab. */\n id?: Key;\n /** Whether the tab is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface TabRenderProps {\n /**\n * Whether the tab is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the tab is currently in a pressed state.\n *\n * @selector [data-pressed]\n */\n isPressed: boolean;\n /**\n * Whether the tab is currently selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the tab is currently focused.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the tab is currently keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the tab is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n}\n\nexport interface TabPanelProps\n extends\n AriaTabPanelProps,\n RenderProps<TabPanelRenderProps>,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-TabPanel'\n */\n class?: ClassOrFunction<TabPanelRenderProps>;\n /**\n * Whether to mount the tab panel in the DOM even when it is not currently selected. Inactive tab\n * panels are inert and cannot be interacted with. They must be styled appropriately so this is\n * clear to the user visually.\n *\n * @default false\n */\n shouldForceMount?: boolean;\n}\n\nexport interface TabPanelRenderProps {\n /**\n * Whether the tab panel is currently focused.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the tab panel is currently keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the tab panel is currently non-interactive. This occurs when the\n * `shouldForceMount` prop is true, and the corresponding tab is not selected.\n *\n * @selector [data-inert]\n */\n isInert: boolean;\n /**\n * Whether the tab panel is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the tab panel is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the tab list.\n */\n state: TabListState<unknown>;\n}\n\nexport interface TabPanelsProps<T>\n extends\n Omit<CollectionProps<T>, \"disabledKeys\">,\n StyleProps,\n DOMRenderProps<\"div\", undefined>,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element.\n *\n * @default 'react-aria-TabPanels'\n */\n class?: JSX.ClassValue;\n}\n\nconst TabCollection = createLeafComponent(\n ItemNode,\n (\n props: TabProps,\n forwardedRef: Ref<HTMLDivElement>,\n node: Node<unknown>\n ): JSX.Element => {\n const state = useContext(TabListStateContext);\n\n if (!state) {\n throw new Error(\"Tab must be rendered in Tabs.\");\n }\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createTab(\n mergeProps(props, {\n get key() {\n return node.key;\n },\n }),\n state,\n ref\n );\n\n const focus = createFocusRing();\n\n const hover = createHover(\n mergeProps(props, {\n get isDisabled() {\n return aria.isDisabled;\n },\n })\n );\n\n const values: TabRenderProps = {\n get isDisabled() {\n return aria.isDisabled;\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 get isPressed() {\n return aria.isPressed;\n },\n get isSelected() {\n return aria.isSelected;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-Tab\", values })\n );\n\n const Element = dynamic(() => (isTruthy(props.href) ? dom.a : dom.div));\n\n return (\n <Element\n {...mergeProps(\n omit(filterDOMProps(props, { global: true }), \"id\", \"onClick\"),\n merge(() => aria.tabProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}\n data-selected={aria.isSelected || undefined}\n data-disabled={aria.isDisabled || undefined}\n data-hovered={hover.isHovered || undefined}\n data-pressed={aria.isPressed || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>\n </Element>\n );\n }\n);\n\nexport function TabPanels<T>(\n props: TabPanelsProps<T> & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n if (createIsHidden()) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n return (\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true, labelable: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n ref={props.ref}\n render={props.render}\n class={props.class ?? \"solid2-aria-TabPanels\"}\n style={props.style}\n >\n <Collection {...props} />\n </dom.div>\n );\n}\n\nexport function TabPanel(\n props: TabPanelProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n if (createIsHidden()) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n const state = useContext(TabListStateContext);\n\n if (!state) {\n throw new Error(\"TabPanel must be rendered in Tabs.\");\n }\n\n const [panelRef, setPanelRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const initiallySelected = untrack(() => state.selectedKey === props.id);\n\n const exiting = createExitAnimation(\n panelRef,\n () => state.selectedKey === props.id\n );\n\n return (\n <Show\n when={\n (state.selectedKey === props.id || props.shouldForceMount) ?? exiting()\n }\n >\n <TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />\n </Show>\n );\n}\n\nfunction TabPanelInner(input: {\n props: TabPanelProps & { ref?: Ref<HTMLDivElement> };\n state: TabListState<unknown>;\n panelRef: Accessor<HTMLDivElement | null>;\n setPanelRef: (element: HTMLDivElement) => void;\n initiallySelected: boolean;\n exiting: () => boolean;\n}): JSX.Element {\n const ref = untrack(() => input.panelRef);\n\n const aria = createTabPanel(\n untrack(() => input.props),\n untrack(() => input.state),\n ref\n );\n\n const focus = createFocusRing();\n const selected = () => input.state.selectedKey === input.props.id;\n const entering = createEnterAnimation(ref);\n\n const values: TabPanelRenderProps = {\n get isEntering() {\n return !input.initiallySelected && entering();\n },\n get isExiting() {\n return input.exiting();\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isInert() {\n return !selected();\n },\n get state() {\n return input.state;\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n { defaultClass: \"solid2-aria-TabPanel\", values }\n )\n );\n\n return (\n <dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabPanelProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n inert={!selected() || input.props.inert}\n data-entering={values.isEntering || undefined}\n data-exiting={values.isExiting || undefined}\n data-inert={!selected() || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>\n </dom.div>\n );\n}\n\nexport function Tab(\n props: TabProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n return (\n <TabCollection\n {...props}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n />\n );\n}\n\nexport function Tabs(\n input: TabsProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n TabsContext\n );\n\n const values: TabsRenderProps = {\n get orientation() {\n return props.orientation ?? \"horizontal\";\n },\n };\n\n const content = () => {\n const child = props.children;\n\n return typeof child === \"function\"\n ? child({ ...values, defaultChildren: undefined })\n : child;\n };\n\n return (\n <TabListStateContext value={null}>\n <CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>\n </TabListStateContext>\n );\n}\n\nfunction TabsInner(input: {\n props: TabsProps;\n collection: BaseCollection<object>;\n tabsRef: (element: HTMLDivElement) => void;\n}): JSX.Element {\n const state = createTabListState(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n children: undefined,\n get collection() {\n return input.collection;\n },\n }\n )\n );\n\n const focus = createFocusRing({ within: true });\n\n const values: TabsRenderProps = {\n get orientation() {\n return input.props.orientation ?? \"horizontal\";\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n { defaultClass: \"solid2-aria-Tabs\", values }\n )\n );\n\n const tabProps = merge(() => input.props);\n\n return (\n <dom.div\n {...mergeProps(\n filterDOMProps(input.props, { global: true }),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={input.tabsRef}\n slot={input.props.slot ?? undefined}\n data-orientation={values.orientation}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={state.isDisabled || undefined}\n >\n <TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>\n </dom.div>\n );\n}\n\nexport function TabList<T>(\n props: TabListProps<T> & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n const state = useContext(TabListStateContext);\n\n if (!state) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return <Collection {...props} />;\n }\n\n return <TabListInner props={props} state={state} />;\n}\n\nfunction TabListInner<T>(input: {\n props: TabListProps<T> & { ref?: Ref<HTMLDivElement> };\n state: TabListState<unknown>;\n}): JSX.Element {\n const context = createSlottedContext(TabsContext);\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const renderer = useContext(CollectionRendererContext);\n const Root = renderer.CollectionRoot;\n\n const aria = createTabList(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n get keyboardActivation() {\n return context?.keyboardActivation;\n },\n get orientation() {\n return context?.orientation;\n },\n }\n ),\n untrack(() => input.state),\n ref\n );\n\n const values: TabListRenderProps = {\n get orientation() {\n return context?.orientation ?? \"horizontal\";\n },\n get state() {\n return input.state;\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n children: undefined,\n defaultClass: \"solid2-aria-TabList\",\n values,\n }\n )\n );\n\n return (\n <dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabListProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n data-orientation={values.orientation}\n >\n <Root collection={input.state.collection} />\n </dom.div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAa,cACX,cAAuD,IAAI;AAE7D,MAAa,sBAAsB,cACjC,IACF;AAgMA,MAAM,gBAAgB,oBACpB,WAEE,OACA,cACA,SACgB;CAChB,MAAM,QAAQ,WAAW,mBAAmB;CAE5C,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,+BAA+B;CAGjD,MAAM,CAAC,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAED,MAAM,OAAO,UACXmC,aAAW,OAAO,EAChB,IAAI,MAAM;EACR,OAAO,KAAK;CACd,EACF,CAAC,GACD,OACA,GACF;CAEA,MAAM,QAAQ,gBAAgB;CAE9B,MAAM,QAAQ,YACZA,aAAW,OAAO,EAChB,IAAI,aAAa;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C,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAGD,MAAM,OADW,WAAW,yBACf,CAAA,CAAS;CAEtB,MAAM,OAAO,cACXI,aACE,YAAY,MAAM,SAAS,CAAC,CAAC,GAC7B;EACE,IAAI,qBAAqB;GACvB,OAAO,SAAS;EAClB;EACA,IAAI,cAAc;GAChB,OAAO,SAAS;EAClB;CACF,CACF,GACA,cAAc,MAAM,KAAK,GACzB,GACF;CAEA,MAAM,SAA6B;EACjC,IAAI,cAAc;GAChB,OAAO,SAAS,eAAe;EACjC;EACA,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;CACF;CAEA,MAAM,SAAS,kBACbA,aACE,YAAY,MAAM,SAAS,CAAC,CAAC,GAC7B;EACE,UAAU,KAAA;EACV,cAAc;EACd;CACF,CACF,CACF;CAEA,OACEH,gBAAAA,IAAC3B,KAAD2B,iBACE;EAAI,OAAAG,aACF,KAAK,eAAe,MAAM,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI,GACxD,YAAY,KAAK,gBAAgB,CAAC,CAAC,GACnC,MACF;CAAC,GALH;EAMEF,KAAK,EACF,YAA4B;GAC3B,OAAO,OAAO;EAChB,IACC,YAA4B;GAC3B,UACE,cAAc,MAAM,MAAM,GAAG,GAC7B,OACF;EACF,CACF;EACA,IAAA,qBAAA;GAAkB,OAAA,OAAO;EAAW;EAjBtC,IAAA,WAAA;GAmBEC,OAAAA,gBAAAA,MAAAA,EAAM,IAAA,aAAA;IAAY,OAAA,MAAM,MAAM;GAAU,EAAG,CAAA;EACpC;;AAEb"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["<Element\n {...mergeProps(\n omit(filterDOMProps(props, { global: true }), \"id\", \"onClick\"),\n merge(() => aria.tabProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}\n data-selected={aria.isSelected || undefined}\n data-disabled={aria.isDisabled || undefined}\n data-hovered={hover.isHovered || undefined}\n data-pressed={aria.isPressed || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>\n </Element>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}","<SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>","value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true, labelable: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n render={props.render}\n class={props.class ?? \"solid2-aria-TabPanels\"}\n style={{\n \"--tab-panel-height\": \"auto\",\n \"--tab-panel-width\": \"auto\",\n ...props.style,\n }}\n >\n <Collection {...props} />\n </dom.div>","dom.div","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}","<Collection {...props} />","<Show\n when={\n (state.selectedKey === props.id || props.shouldForceMount) ?? exiting()\n }\n >\n <TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />\n </Show>","<TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />","setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}","<dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabPanelProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n inert={!selected() || input.props.inert}\n data-entering={values.isEntering || undefined}\n data-exiting={values.isExiting || undefined}\n data-inert={!selected() || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}","<TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>","value={null}","<TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>","<CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>","value={DefaultCollectionRenderer}","<TabCollection\n {...props}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n />","ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<TabListStateContext value={null}>\n <CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>\n </TabListStateContext>","<CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>","createCollection={() => new BaseCollection<object>()}","<TabsInner props={props} collection={collection} tabsRef={setRef} />","tabsRef={setRef}","<dom.div\n {...mergeProps(\n filterDOMProps(input.props, { global: true }),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={input.tabsRef}\n slot={input.props.slot ?? undefined}\n data-orientation={values.orientation}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={state.isDisabled || undefined}\n >\n <TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>\n </dom.div>","ref={input.tabsRef}","<TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>","value={tabProps}","<TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>","value={state}","<TabListInner props={props} state={state} />","<dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabListProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n data-orientation={values.orientation}\n >\n <Root collection={input.state.collection} />\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}","<Root collection={input.state.collection} />","mergeProps","_$createComponent","_$mergeProps","_$memo","_$applyRef"],"sources":["../../src/tabs.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/Tabs.tsx.\n * Modified for Solid Aria: adapted collection ownership, contexts, accessibility primitives, and reactive properties for Solid 2; defers panel size measurement and scopes size variables for nested tabs; 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 {\n ItemNode,\n BaseCollection,\n} from \"@solid2-aria/core/collections/base-collection\";\nimport {\n Collection,\n CollectionBuilder,\n createLeafComponent,\n} from \"@solid2-aria/core/collections/collection-builder\";\nimport { createIsHidden } from \"@solid2-aria/core/collections/hidden\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createTab } from \"@solid2-aria/core/tabs/create-tab\";\nimport { createTabList } from \"@solid2-aria/core/tabs/create-tab-list\";\nimport type { AriaTabListProps } from \"@solid2-aria/core/tabs/create-tab-list\";\nimport { createTabPanel } from \"@solid2-aria/core/tabs/create-tab-panel\";\nimport type { AriaTabPanelProps } from \"@solid2-aria/core/tabs/create-tab-panel\";\nimport {\n createEnterAnimation,\n createExitAnimation,\n} from \"@solid2-aria/core/utils/animation\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { finishAnimations } from \"@solid2-aria/core/utils/finish-animations\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { isTruthy } from \"@solid2-aria/core/utils/truthy\";\nimport { createTabListState } from \"@solid2-aria/stately/tabs/create-tab-list-state\";\nimport type { TabListState } from \"@solid2-aria/stately/tabs/create-tab-list-state\";\nimport type {\n AriaLabelingProps,\n FocusEvents,\n HoverEvents,\n Key,\n LinkDOMProps,\n PressEvents,\n Orientation,\n Node,\n} from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { dynamic } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n createSignal,\n createContext,\n createEffect,\n useContext,\n omit,\n Show,\n untrack,\n} from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport {\n CollectionRendererContext,\n DefaultCollectionRenderer,\n} from \"./collection\";\nimport type { CollectionProps } from \"./collection\";\nimport { SelectionIndicatorContext } from \"./selection-indicator\";\nimport {\n dom,\n createContextProps,\n createRenderProps,\n createSlottedContext,\n assignRef,\n} from \"./utils\";\nimport type {\n Ref,\n ClassOrFunction,\n DOMRenderProps,\n PossibleLinkDOMRenderProps,\n RenderProps,\n SlotProps,\n StyleProps,\n StyleRenderProps,\n ContextValue,\n} from \"./utils\";\n\nexport const TabsContext =\n createContext<ContextValue<TabsProps, HTMLDivElement>>(null);\n\nexport const TabListStateContext = createContext<TabListState<unknown> | null>(\n null\n);\n\nexport interface TabsProps\n // oxlint-disable-next-line typescript/no-explicit-any -- Collection contexts erase item types; each typed factory restores its owner's item contract.\n extends\n Omit<AriaTabListProps<unknown>, \"items\" | \"children\">,\n RenderProps<TabsRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Tabs'\n */\n class?: ClassOrFunction<TabsRenderProps>;\n}\n\nexport interface TabsRenderProps {\n /**\n * The orientation of the tabs.\n *\n * @selector [data-orientation=\"horizontal | vertical\"]\n */\n orientation: Orientation;\n}\n\nexport interface TabListProps<T>\n extends\n StyleRenderProps<TabListRenderProps>,\n AriaLabelingProps,\n Omit<CollectionProps<T>, \"disabledKeys\">,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-TabList'\n */\n class?: ClassOrFunction<TabListRenderProps>;\n}\n\nexport interface TabListRenderProps {\n /**\n * The orientation of the tab list.\n *\n * @selector [data-orientation=\"horizontal | vertical\"]\n */\n orientation: Orientation;\n /**\n * State of the tab list.\n */\n state: TabListState<unknown>;\n}\n\nexport interface TabProps\n extends\n Omit<RenderProps<TabRenderProps>, \"render\">,\n PossibleLinkDOMRenderProps<\"div\", TabRenderProps>,\n AriaLabelingProps,\n LinkDOMProps,\n HoverEvents,\n FocusEvents,\n PressEvents,\n Omit<GlobalDOMAttributes<HTMLDivElement>, \"onClick\"> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Tab'\n */\n class?: ClassOrFunction<TabRenderProps>;\n /** The unique id of the tab. */\n id?: Key;\n /** Whether the tab is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface TabRenderProps {\n /**\n * Whether the tab is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the tab is currently in a pressed state.\n *\n * @selector [data-pressed]\n */\n isPressed: boolean;\n /**\n * Whether the tab is currently selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the tab is currently focused.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the tab is currently keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the tab is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n}\n\nexport interface TabPanelProps\n extends\n AriaTabPanelProps,\n RenderProps<TabPanelRenderProps>,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-TabPanel'\n */\n class?: ClassOrFunction<TabPanelRenderProps>;\n /**\n * Whether to mount the tab panel in the DOM even when it is not currently selected. Inactive tab\n * panels are inert and cannot be interacted with. They must be styled appropriately so this is\n * clear to the user visually.\n *\n * @default false\n */\n shouldForceMount?: boolean;\n}\n\nexport interface TabPanelRenderProps {\n /**\n * Whether the tab panel is currently focused.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the tab panel is currently keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the tab panel is currently non-interactive. This occurs when the\n * `shouldForceMount` prop is true, and the corresponding tab is not selected.\n *\n * @selector [data-inert]\n */\n isInert: boolean;\n /**\n * Whether the tab panel is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the tab panel is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the tab list.\n */\n state: TabListState<unknown>;\n}\n\nexport interface TabPanelsProps<T>\n extends\n Omit<CollectionProps<T>, \"disabledKeys\">,\n StyleProps,\n DOMRenderProps<\"div\", undefined>,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) for the\n * element.\n *\n * @default 'react-aria-TabPanels'\n */\n class?: JSX.ClassValue;\n}\n\nconst TabCollection = createLeafComponent(\n ItemNode,\n (\n props: TabProps,\n forwardedRef: Ref<HTMLDivElement>,\n node: Node<unknown>\n ): JSX.Element => {\n const state = useContext(TabListStateContext);\n\n if (!state) {\n throw new Error(\"Tab must be rendered in Tabs.\");\n }\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createTab(\n mergeProps(props, {\n get key() {\n return node.key;\n },\n }),\n state,\n ref\n );\n\n const focus = createFocusRing();\n\n const hover = createHover(\n mergeProps(props, {\n get isDisabled() {\n return aria.isDisabled;\n },\n })\n );\n\n const values: TabRenderProps = {\n get isDisabled() {\n return aria.isDisabled;\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 get isPressed() {\n return aria.isPressed;\n },\n get isSelected() {\n return aria.isSelected;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-Tab\", values })\n );\n\n const Element = dynamic(() => (isTruthy(props.href) ? dom.a : dom.div));\n\n return (\n <Element\n {...mergeProps(\n omit(filterDOMProps(props, { global: true }), \"id\", \"onClick\"),\n merge(() => aria.tabProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(forwardedRef, element);\n },\n ]}\n data-selected={aria.isSelected || undefined}\n data-disabled={aria.isDisabled || undefined}\n data-hovered={hover.isHovered || undefined}\n data-pressed={aria.isPressed || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <SelectionIndicatorContext\n value={{\n get isSelected() {\n return aria.isSelected;\n },\n }}\n >\n {render.children}\n </SelectionIndicatorContext>\n </Element>\n );\n }\n);\n\nexport function TabPanels<T>(\n props: TabPanelsProps<T> & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n if (createIsHidden()) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n const state = useContext(TabListStateContext);\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n let selectedKey = untrack(() => state?.selectedKey);\n let hasTransition: boolean | undefined;\n\n createEffect(\n () => {\n const element = ref();\n const key = state?.selectedKey;\n\n return {\n element,\n key,\n previousSize:\n hasTransition === true && element\n ? element.getBoundingClientRect()\n : null,\n };\n },\n ({ element, key, previousSize }): undefined | (() => void) => {\n if (!element) {\n return undefined;\n }\n\n hasTransition ??= /width|height|block-size|inline-size|all/u.test(\n getComputedStyle(element).transition\n );\n let frame: number | undefined;\n\n if (\n hasTransition &&\n selectedKey !== null &&\n selectedKey !== undefined &&\n key !== selectedKey\n ) {\n frame = requestAnimationFrame(() => {\n element.style.setProperty(\"--tab-panel-width\", \"auto\");\n element.style.setProperty(\"--tab-panel-height\", \"auto\");\n const { width, height } = element.getBoundingClientRect();\n\n if (\n previousSize &&\n (previousSize.width !== width || previousSize.height !== height)\n ) {\n element.style.setProperty(\n \"--tab-panel-width\",\n `${previousSize.width}px`\n );\n element.style.setProperty(\n \"--tab-panel-height\",\n `${previousSize.height}px`\n );\n // Commit the starting size before setting the transition target.\n void getComputedStyle(element).height;\n element.style.setProperty(\"--tab-panel-width\", `${width}px`);\n element.style.setProperty(\"--tab-panel-height\", `${height}px`);\n void finishAnimations(element.getAnimations(), () => {\n element.style.setProperty(\"--tab-panel-width\", \"auto\");\n element.style.setProperty(\"--tab-panel-height\", \"auto\");\n });\n }\n });\n }\n\n selectedKey = key;\n\n return () => {\n if (frame !== undefined) {\n cancelAnimationFrame(frame);\n }\n };\n },\n { ssrSource: \"client\" }\n );\n\n return (\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true, labelable: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n render={props.render}\n class={props.class ?? \"solid2-aria-TabPanels\"}\n style={{\n \"--tab-panel-height\": \"auto\",\n \"--tab-panel-width\": \"auto\",\n ...props.style,\n }}\n >\n <Collection {...props} />\n </dom.div>\n );\n}\n\nexport function TabPanel(\n props: TabPanelProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n if (createIsHidden()) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n const state = useContext(TabListStateContext);\n\n if (!state) {\n throw new Error(\"TabPanel must be rendered in Tabs.\");\n }\n\n const [panelRef, setPanelRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const initiallySelected = untrack(() => state.selectedKey === props.id);\n\n const exiting = createExitAnimation(\n panelRef,\n () => state.selectedKey === props.id\n );\n\n return (\n <Show\n when={\n (state.selectedKey === props.id || props.shouldForceMount) ?? exiting()\n }\n >\n <TabPanelInner\n props={props}\n state={state}\n panelRef={panelRef}\n setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}\n initiallySelected={initiallySelected}\n exiting={exiting}\n />\n </Show>\n );\n}\n\nfunction TabPanelInner(input: {\n props: TabPanelProps & { ref?: Ref<HTMLDivElement> };\n state: TabListState<unknown>;\n panelRef: Accessor<HTMLDivElement | null>;\n setPanelRef: (element: HTMLDivElement) => void;\n initiallySelected: boolean;\n exiting: () => boolean;\n}): JSX.Element {\n const ref = untrack(() => input.panelRef);\n\n const aria = createTabPanel(\n untrack(() => input.props),\n untrack(() => input.state),\n ref\n );\n\n const focus = createFocusRing();\n const selected = () => input.state.selectedKey === input.props.id;\n const entering = createEnterAnimation(ref);\n\n const values: TabPanelRenderProps = {\n get isEntering() {\n return !input.initiallySelected && entering();\n },\n get isExiting() {\n return input.exiting();\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isInert() {\n return !selected();\n },\n get state() {\n return input.state;\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n { defaultClass: \"solid2-aria-TabPanel\", values }\n )\n );\n\n return (\n <dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabPanelProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n input.setPanelRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n inert={!selected() || input.props.inert}\n data-entering={values.isEntering || undefined}\n data-exiting={values.isExiting || undefined}\n data-inert={!selected() || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n >\n <TabsContext value={null}>\n <TabListStateContext value={null}>\n <CollectionRendererContext value={DefaultCollectionRenderer}>\n {render.children}\n </CollectionRendererContext>\n </TabListStateContext>\n </TabsContext>\n </dom.div>\n );\n}\n\nexport function Tab(\n props: TabProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n return (\n <TabCollection\n {...props}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n />\n );\n}\n\nexport function Tabs(\n input: TabsProps & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n TabsContext\n );\n\n const values: TabsRenderProps = {\n get orientation() {\n return props.orientation ?? \"horizontal\";\n },\n };\n\n const content = () => {\n const child = props.children;\n\n return typeof child === \"function\"\n ? child({ ...values, defaultChildren: undefined })\n : child;\n };\n\n return (\n <TabListStateContext value={null}>\n <CollectionBuilder\n createCollection={() => new BaseCollection<object>()}\n content={content()}\n >\n {(collection) => (\n <TabsInner props={props} collection={collection} tabsRef={setRef} />\n )}\n </CollectionBuilder>\n </TabListStateContext>\n );\n}\n\nfunction TabsInner(input: {\n props: TabsProps;\n collection: BaseCollection<object>;\n tabsRef: (element: HTMLDivElement) => void;\n}): JSX.Element {\n const state = createTabListState(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n children: undefined,\n get collection() {\n return input.collection;\n },\n }\n )\n );\n\n const focus = createFocusRing({ within: true });\n\n const values: TabsRenderProps = {\n get orientation() {\n return input.props.orientation ?? \"horizontal\";\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n { defaultClass: \"solid2-aria-Tabs\", values }\n )\n );\n\n const tabProps = merge(() => input.props);\n\n return (\n <dom.div\n {...mergeProps(\n filterDOMProps(input.props, { global: true }),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={input.tabsRef}\n slot={input.props.slot ?? undefined}\n data-orientation={values.orientation}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={state.isDisabled || undefined}\n >\n <TabsContext value={tabProps}>\n <TabListStateContext value={state}>\n {render.children}\n </TabListStateContext>\n </TabsContext>\n </dom.div>\n );\n}\n\nexport function TabList<T>(\n props: TabListProps<T> & { ref?: Ref<HTMLDivElement> }\n): JSX.Element {\n const state = useContext(TabListStateContext);\n\n if (!state) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return <Collection {...props} />;\n }\n\n return <TabListInner props={props} state={state} />;\n}\n\nfunction TabListInner<T>(input: {\n props: TabListProps<T> & { ref?: Ref<HTMLDivElement> };\n state: TabListState<unknown>;\n}): JSX.Element {\n const context = createSlottedContext(TabsContext);\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const renderer = useContext(CollectionRendererContext);\n const Root = renderer.CollectionRoot;\n\n const aria = createTabList(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n get keyboardActivation() {\n return context?.keyboardActivation;\n },\n get orientation() {\n return context?.orientation;\n },\n }\n ),\n untrack(() => input.state),\n ref\n );\n\n const values: TabListRenderProps = {\n get orientation() {\n return context?.orientation ?? \"horizontal\";\n },\n get state() {\n return input.state;\n },\n };\n\n const render = createRenderProps(\n mergeProps(\n merge(() => input.props ?? {}),\n {\n children: undefined,\n defaultClass: \"solid2-aria-TabList\",\n values,\n }\n )\n );\n\n return (\n <dom.div\n {...mergeProps(\n omit(filterDOMProps(input.props, { global: true }), \"id\"),\n merge(() => aria.tabListProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => input.props.ref),\n element\n );\n },\n ]}\n data-orientation={values.orientation}\n >\n <Root collection={input.state.collection} />\n </dom.div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,MAAa,cACX,cAAuD,IAAI;AAE7D,MAAa,sBAAsB,cACjC,IACF;AAgMA,MAAM,gBAAgB,oBACpB,WAEE,OACA,cACA,SACgB;CAChB,MAAM,QAAQ,WAAW,mBAAmB;CAE5C,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,+BAA+B;CAGjD,MAAM,CAAC,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAED,MAAM,OAAO,UACXmC,aAAW,OAAO,EAChB,IAAI,MAAM;EACR,OAAO,KAAK;CACd,EACF,CAAC,GACD,OACA,GACF;CAEA,MAAM,QAAQ,gBAAgB;CAE9B,MAAM,QAAQ,YACZA,aAAW,OAAO,EAChB,IAAI,aAAa;EACf,OAAO,KAAK;CACd,EACF,CAAC,CACH;CAuBA,MAAM,SAAS,kBACbA,aAAW,OAAO;EAAE,cAAc;EAAmB,QAAA;GArBrD,IAAI,aAAa;IACf,OAAO,KAAK;GACd;GACA,IAAI,iBAAiB;IACnB,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,KAAK;GACd;GACA,IAAI,aAAa;IACf,OAAO,KAAK;GACd;EAIqD;CAAO,CAAC,CAC/D;CAEA,MAAM,UAAU,cAAe,SAAS,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,GAAI;CAEtE,OACEnC,gBAAAA,SAAAA,iBACE;EAAI,OAAAmC,aACF,KAAK,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,MAAM,SAAS,GAC7D,YAAY,KAAK,YAAY,CAAC,CAAC,GAC/B,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,YAAY,MAAM,cAAc,CAAC,CA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H;EAMEF,KAAK,EACF,YAA4B;GAC3B,OAAO,OAAO;EAChB,IACC,YAA4B;GAC3B,UACE,cAAc,MAAM,MAAM,GAAG,GAC7B,OACF;EACF,CACF;EACA,IAAA,qBAAA;GAAkB,OAAA,OAAO;EAAW;EAjBtC,IAAA,WAAA;GAmBEC,OAAAA,gBAAAA,MAAAA,EAAM,IAAA,aAAA;IAAY,OAAA,MAAM,MAAM;GAAU,EAAG,CAAA;EACpC;;AAEb"}
|
package/dist/browser/toast.js
CHANGED
|
@@ -20,7 +20,7 @@ import { HeadingContext } from "./heading.js";
|
|
|
20
20
|
import { TextContext } from "./text.js";
|
|
21
21
|
import { Portal, createComponent, isServer, memo, mergeProps } from "@solidjs/web";
|
|
22
22
|
import { mergeProps as mergeProps$1 } from "@solid2-aria/core/utils/merge-props";
|
|
23
|
-
import { For,
|
|
23
|
+
import { For, createContext, createSignal, merge, untrack, useContext } from "solid-js";
|
|
24
24
|
import { filterDOMProps } from "@solid2-aria/core/utils/filter-dom-props";
|
|
25
25
|
import { createFocusRing } from "@solid2-aria/core/focus/create-focus-ring";
|
|
26
26
|
import { createHover } from "@solid2-aria/core/interactions/create-hover";
|
|
@@ -58,52 +58,49 @@ function UNSTABLE_ToastRegion(props) {
|
|
|
58
58
|
values
|
|
59
59
|
}));
|
|
60
60
|
if (isServer) return null;
|
|
61
|
-
return
|
|
62
|
-
|
|
61
|
+
return memo(() => {
|
|
62
|
+
return memo(() => {
|
|
63
63
|
return state.visibleToasts.length > 0;
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
64
|
+
})() ? createComponent(Portal, {
|
|
65
|
+
get mount() {
|
|
66
|
+
return portal.getContainer?.() ?? document.body;
|
|
67
|
+
},
|
|
68
|
+
get children() {
|
|
69
|
+
return createComponent(UNSTABLE_ToastStateContext, {
|
|
70
|
+
value: state,
|
|
71
|
+
get children() {
|
|
72
|
+
return createComponent(dom.div, mergeProps(() => {
|
|
73
|
+
return mergeProps$1(filterDOMProps(props, { global: true }), merge(() => aria.regionProps ?? {}), merge(() => focus.focusProps ?? {}), merge(() => hover.hoverProps ?? {}), render);
|
|
74
|
+
}, {
|
|
75
|
+
ref: [(element) => {
|
|
76
|
+
setRef(element);
|
|
77
|
+
}, (element) => {
|
|
78
|
+
assignRef(untrack(() => props.ref), element);
|
|
79
|
+
}],
|
|
80
|
+
get "data-hovered"() {
|
|
81
|
+
return values.isHovered || void 0;
|
|
82
|
+
},
|
|
83
|
+
get "data-focused"() {
|
|
84
|
+
return values.isFocused || void 0;
|
|
85
|
+
},
|
|
86
|
+
get "data-focus-visible"() {
|
|
87
|
+
return values.isFocusVisible || void 0;
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return memo(() => {
|
|
91
|
+
return typeof props.children === "function";
|
|
92
|
+
})() ? createComponent(For, {
|
|
93
|
+
get each() {
|
|
94
|
+
return state.visibleToasts;
|
|
95
|
+
},
|
|
96
|
+
children: (toast) => typeof props.children === "function" ? props.children({ toast }) : null
|
|
97
|
+
}) : props.children;
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}) : void 0;
|
|
107
104
|
});
|
|
108
105
|
}
|
|
109
106
|
function UNSTABLE_ToastList(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["<Show when={state.visibleToasts.length > 0}>\n <Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>\n </Show>","<Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>","<UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>","value={state}","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>","dom.div","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}","{typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}","<For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>","<dom.ol\n class={props.class ?? \"solid2-aria-ToastList\"}\n style={props.style}\n ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n >\n <For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>\n </dom.ol>","dom.ol","ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.toastProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n <ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}","<ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>","<HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}","<TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}","<ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}","<dom.div\n {...mergeProps(filterDOMProps(props, { global: true }), render)}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","mergeProps","_$createComponent","_$mergeProps","_$memo"],"sources":["../../src/toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 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/Toast.tsx.\n * Modified for Solid Aria: adapted components, contexts, refs, and reactive properties for Solid 2; 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 { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createUNSAFE_PortalContext } from \"@solid2-aria/core/overlays/portal-provider\";\nimport { createToast } from \"@solid2-aria/core/toast/create-toast\";\nimport { createToastRegion } from \"@solid2-aria/core/toast/create-toast-region\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createToastQueue } from \"@solid2-aria/stately/toast/create-toast-state\";\nimport type {\n ToastQueue,\n ToastState,\n QueuedToast,\n ToastOptions,\n} from \"@solid2-aria/stately/toast/create-toast-state\";\nimport { Portal, isServer } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n untrack,\n createSignal,\n createContext,\n For,\n Show,\n useContext,\n} from \"solid-js\";\n\nimport { ButtonContext } from \"./button\";\nimport { HeadingContext } from \"./heading\";\nimport { TextContext } from \"./text\";\nimport {\n assignRef,\n dom,\n DEFAULT_SLOT,\n createContextProps,\n createRenderProps,\n} from \"./utils\";\nimport type { ContextValue, Ref, RenderProps } from \"./utils\";\n\nexport interface ToastRegionRenderProps<T> {\n visibleToasts: QueuedToast<T>[];\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n}\n\nexport interface ToastRegionProps<T> extends Omit<\n RenderProps<ToastRegionRenderProps<T>>,\n \"children\"\n> {\n queue: ToastQueue<T>;\n children?: JSX.Element | ((props: { toast: QueuedToast<T> }) => JSX.Element);\n ref?: Ref<HTMLDivElement>;\n \"aria-label\"?: string;\n}\n\nexport interface ToastListProps<T> {\n children: (props: { toast: QueuedToast<T> }) => JSX.Element;\n ref?: Ref<HTMLOListElement>;\n class?: JSX.ClassValue;\n style?: JSX.CSSProperties;\n}\n\nexport interface ToastRenderProps<T> {\n toast: QueuedToast<T>;\n isFocused: boolean;\n isFocusVisible: boolean;\n}\n\nexport interface ToastProps<T> extends RenderProps<ToastRenderProps<T>> {\n toast: QueuedToast<T>;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface ToastContentProps extends RenderProps<undefined> {\n ref?: Ref<HTMLDivElement>;\n}\n\ntype AnyToastState = Omit<ToastState<unknown>, \"add\"> & {\n add: {\n // oxlint-disable-next-line typescript/method-signature-style, anti-slop/no-unknown-parameters -- Toast content is generic; the queue and render callback retain its actual type.\n bivarianceHack(content: unknown, options?: ToastOptions): string;\n }[\"bivarianceHack\"];\n};\n\nexport const UNSTABLE_ToastStateContext = createContext<AnyToastState | null>(\n null\n);\n\nexport const ToastContentContext =\n createContext<ContextValue<ToastContentProps, HTMLDivElement>>(null);\n\nexport function UNSTABLE_ToastRegion<T>(\n props: ToastRegionProps<T>\n): JSX.Element {\n const state = createToastQueue(untrack(() => props.queue));\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createToastRegion(props, state, ref);\n const focus = createFocusRing({ within: true });\n const hover = createHover({});\n const portal = createUNSAFE_PortalContext();\n\n const values: ToastRegionRenderProps<T> = {\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 get visibleToasts() {\n return state.visibleToasts;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, {\n children: undefined,\n defaultClass: \"solid2-aria-ToastRegion\",\n values,\n })\n );\n\n if (isServer) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n return (\n <Show when={state.visibleToasts.length > 0}>\n <Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>\n </Show>\n );\n}\n\nexport function UNSTABLE_ToastList<T>(props: ToastListProps<T>): JSX.Element {\n const state = useContext(UNSTABLE_ToastStateContext);\n\n if (!state) {\n throw new Error(\"ToastList requires ToastRegion\");\n }\n\n return (\n <dom.ol\n class={props.class ?? \"solid2-aria-ToastList\"}\n style={props.style}\n ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n >\n <For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>\n </dom.ol>\n );\n}\n\nexport function UNSTABLE_Toast<T>(props: ToastProps<T>): JSX.Element {\n const state = useContext(UNSTABLE_ToastStateContext);\n\n if (!state) {\n throw new Error(\"Toast requires ToastRegion\");\n }\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createToast(props, state, ref);\n const focus = createFocusRing({ within: true });\n\n const values: ToastRenderProps<T> = {\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get toast() {\n return props.toast;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-Toast\", values })\n );\n\n return (\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.toastProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n <ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>\n </dom.div>\n );\n}\n\nexport function UNSTABLE_ToastContent(input: ToastContentProps): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ToastContentContext\n );\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-ToastContent\",\n values: undefined,\n })\n );\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, { global: true }), render)}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n );\n}\n"],"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AQ;YACV,OAAO,KAAK;WACd;UACF,EACF;UARF,IAAA,WAAA;WAUG,OAAA,OAAO;UACK;;QACJ;;MACC;;IACG;;EACd;;AAEb;AAEA,SAAgB,sBAAsB,OAAuC;CAC3E,MAAM,CAAC,SAAS,UAAU,mBACxB,OACA,cAAc,MAAM,GAAG,GACvB,mBACF;CAEA,MAAM,SAAS,kBACbG,aAAW,OAAO;EAChB,cAAc;EACd,QAAQ,KAAA;CACV,CAAC,CACH;CAEA,OACEF,gBAAAA,IAACjB,KAADiB,iBACE;EAAI,OAAAE,aAAW,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,MAAM;CAAC,GADjE,EAEED,MAAM,YAA4B;EAChC,OAAO,OAAO;CAChB,EACD,CAAA,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["<Show when={state.visibleToasts.length > 0}>\n <Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>\n </Show>","<Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>","<UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>","value={state}","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>","dom.div","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}","{typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}","<For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>","<dom.ol\n class={props.class ?? \"solid2-aria-ToastList\"}\n style={props.style}\n ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n >\n <For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>\n </dom.ol>","dom.ol","ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}","<For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.toastProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n <ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>\n </dom.div>","ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}","<ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>","<HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}","<TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}","<ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>","value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}","<dom.div\n {...mergeProps(filterDOMProps(props, { global: true }), render)}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","mergeProps","_$memo","_$createComponent","_$mergeProps"],"sources":["../../src/toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 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/Toast.tsx.\n * Modified for Solid Aria: adapted components, contexts, refs, and reactive properties for Solid 2; 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 { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createUNSAFE_PortalContext } from \"@solid2-aria/core/overlays/portal-provider\";\nimport { createToast } from \"@solid2-aria/core/toast/create-toast\";\nimport { createToastRegion } from \"@solid2-aria/core/toast/create-toast-region\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createToastQueue } from \"@solid2-aria/stately/toast/create-toast-state\";\nimport type {\n ToastQueue,\n ToastState,\n QueuedToast,\n ToastOptions,\n} from \"@solid2-aria/stately/toast/create-toast-state\";\nimport { Portal, isServer } from \"@solidjs/web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n merge,\n untrack,\n createSignal,\n createContext,\n For,\n Show,\n useContext,\n} from \"solid-js\";\n\nimport { ButtonContext } from \"./button\";\nimport { HeadingContext } from \"./heading\";\nimport { TextContext } from \"./text\";\nimport {\n assignRef,\n dom,\n DEFAULT_SLOT,\n createContextProps,\n createRenderProps,\n} from \"./utils\";\nimport type { ContextValue, Ref, RenderProps } from \"./utils\";\n\nexport interface ToastRegionRenderProps<T> {\n visibleToasts: QueuedToast<T>[];\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n}\n\nexport interface ToastRegionProps<T> extends Omit<\n RenderProps<ToastRegionRenderProps<T>>,\n \"children\"\n> {\n queue: ToastQueue<T>;\n children?: JSX.Element | ((props: { toast: QueuedToast<T> }) => JSX.Element);\n ref?: Ref<HTMLDivElement>;\n \"aria-label\"?: string;\n}\n\nexport interface ToastListProps<T> {\n children: (props: { toast: QueuedToast<T> }) => JSX.Element;\n ref?: Ref<HTMLOListElement>;\n class?: JSX.ClassValue;\n style?: JSX.CSSProperties;\n}\n\nexport interface ToastRenderProps<T> {\n toast: QueuedToast<T>;\n isFocused: boolean;\n isFocusVisible: boolean;\n}\n\nexport interface ToastProps<T> extends RenderProps<ToastRenderProps<T>> {\n toast: QueuedToast<T>;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface ToastContentProps extends RenderProps<undefined> {\n ref?: Ref<HTMLDivElement>;\n}\n\ntype AnyToastState = Omit<ToastState<unknown>, \"add\"> & {\n add: {\n // oxlint-disable-next-line typescript/method-signature-style, anti-slop/no-unknown-parameters -- Toast content is generic; the queue and render callback retain its actual type.\n bivarianceHack(content: unknown, options?: ToastOptions): string;\n }[\"bivarianceHack\"];\n};\n\nexport const UNSTABLE_ToastStateContext = createContext<AnyToastState | null>(\n null\n);\n\nexport const ToastContentContext =\n createContext<ContextValue<ToastContentProps, HTMLDivElement>>(null);\n\nexport function UNSTABLE_ToastRegion<T>(\n props: ToastRegionProps<T>\n): JSX.Element {\n const state = createToastQueue(untrack(() => props.queue));\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createToastRegion(props, state, ref);\n const focus = createFocusRing({ within: true });\n const hover = createHover({});\n const portal = createUNSAFE_PortalContext();\n\n const values: ToastRegionRenderProps<T> = {\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 get visibleToasts() {\n return state.visibleToasts;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, {\n children: undefined,\n defaultClass: \"solid2-aria-ToastRegion\",\n values,\n })\n );\n\n if (isServer) {\n // oxlint-disable-next-line solid/components-return-once -- Static collection traversal and context registration are fixed when the owner is created.\n return null;\n }\n\n return (\n <Show when={state.visibleToasts.length > 0}>\n <Portal mount={portal.getContainer?.() ?? document.body}>\n <UNSTABLE_ToastStateContext value={state}>\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.regionProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => hover.hoverProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-hovered={values.isHovered || undefined}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n {typeof props.children === \"function\" ? (\n <For each={state.visibleToasts}>\n {(toast) =>\n typeof props.children === \"function\"\n ? props.children({ toast })\n : null\n }\n </For>\n ) : (\n props.children\n )}\n </dom.div>\n </UNSTABLE_ToastStateContext>\n </Portal>\n </Show>\n );\n}\n\nexport function UNSTABLE_ToastList<T>(props: ToastListProps<T>): JSX.Element {\n const state = useContext(UNSTABLE_ToastStateContext);\n\n if (!state) {\n throw new Error(\"ToastList requires ToastRegion\");\n }\n\n return (\n <dom.ol\n class={props.class ?? \"solid2-aria-ToastList\"}\n style={props.style}\n ref={(element: HTMLOListElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n >\n <For each={state.visibleToasts}>\n {(toast) => {\n // SAFETY: This region renders the same T values enqueued by its owning toast queue.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- The shared region context erases its generic content type.\n const typedToast = toast as QueuedToast<T>;\n\n return props.children({ toast: typedToast });\n }}\n </For>\n </dom.ol>\n );\n}\n\nexport function UNSTABLE_Toast<T>(props: ToastProps<T>): JSX.Element {\n const state = useContext(UNSTABLE_ToastStateContext);\n\n if (!state) {\n throw new Error(\"Toast requires ToastRegion\");\n }\n\n const [ref, setRef] = createSignal<HTMLDivElement | null>(null, {\n ownedWrite: true,\n });\n\n const aria = createToast(props, state, ref);\n const focus = createFocusRing({ within: true });\n\n const values: ToastRenderProps<T> = {\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get toast() {\n return props.toast;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-Toast\", values })\n );\n\n return (\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n merge(() => aria.toastProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n render\n )}\n ref={[\n (element: HTMLDivElement) => {\n setRef(element);\n },\n (element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n },\n ]}\n data-focused={values.isFocused || undefined}\n data-focus-visible={values.isFocusVisible || undefined}\n >\n <ToastContentContext value={aria.contentProps}>\n <HeadingContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get title() {\n return aria.titleProps;\n },\n },\n }}\n >\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get description() {\n return aria.descriptionProps;\n },\n },\n }}\n >\n <ButtonContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n get close() {\n return aria.closeButtonProps;\n },\n },\n }}\n >\n {render.children}\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </ToastContentContext>\n </dom.div>\n );\n}\n\nexport function UNSTABLE_ToastContent(input: ToastContentProps): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ToastContentContext\n );\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-ToastContent\",\n values: undefined,\n })\n );\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, { global: true }), render)}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,MAAa,6BAA6B,cACxC,IACF;AAEA,MAAa,sBACX,cAA+D,IAAI;AAErE,SAAgB,qBACd,OACa;CACb,MAAM,QAAQ,iBAAiB,cAAc,MAAM,KAAK,CAAC;CAEzD,MAAM,CAAC,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAED,MAAM,OAAO,kBAAkB,OAAO,OAAO,GAAG;CAChD,MAAM,QAAQ,gBAAgB,EAAE,QAAQ,KAAK,CAAC;CAC9C,MAAM,QAAQ,YAAY,CAAC,CAAC;CAC5B,MAAM,SAAS,2BAA2B;CAE1C,MAAM,SAAoC;EACxC,IAAI,iBAAiB;GACnB,OAAO,MAAM;EACf;EACA,IAAI,YAAY;GACd,OAAO,MAAM;EACf;EACA,IAAI,YAAY;GACd,OAAO,MAAM;EACf;EACA,IAAI,gBAAgB;GAClB,OAAO,MAAM;EACf;CACF;CAEA,MAAM,SAAS,kBACbwB,aAAW,OAAO;EAChB,UAAU,KAAA;EACV,cAAc;EACd;CACF,CAAC,CACH;CAEA,IAAI,UAEF,OAAO;CAGT,OACExB,WAAAA;;GAAY,OAAA,MAAM,cAAc,SAAS;EAwCnC,CAAA,CAAC,CAAD,IAvCJC,gBAAAA,QAAAA;GAAQ,IAAA,QA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KAAO,OAAA,KAAK;IAAY;IAA7C,IAAA,WAAA;KACEC,OAAAA,gBAAAA,gBAAAA;MACEC,OAAO,EACL,OAAO;QACJ,eAAe,CAAC;OACjB,IAAI,QAAQ;QACV,OAAO,KAAK;OACd;MACF,EACF;MARF,IAAA,WAAA;OAUEC,OAAAA,gBAAAA,aAAAA;QACEC,OAAO,EACL,OAAO;UACJ,eAAe,CAAC;SACjB,IAAI,cAAc;UAChB,OAAO,KAAK;SACd;QACF,EACF;QARF,IAAA,WAAA;SAUEC,OAAAA,gBAAAA,eAAAA;UACEC,OAAO,EACL,OAAO;YACJ,eAAe,CAAC;WACjB,IAAI,QAAQ;YACV,OAAO,KAAK;WACd;UACF,EACF;UARF,IAAA,WAAA;WAUG,OAAA,OAAO;UACK;;QACJ;;MACC;;IACG;;EACd;;AAEb;AAEA,SAAgB,sBAAsB,OAAuC;CAC3E,MAAM,CAAC,SAAS,UAAU,mBACxB,OACA,cAAc,MAAM,GAAG,GACvB,mBACF;CAEA,MAAM,SAAS,kBACbG,aAAW,OAAO;EAChB,cAAc;EACd,QAAQ,KAAA;CACV,CAAC,CACH;CAEA,OACEF,gBAAAA,IAACjB,KAADiB,iBACE;EAAI,OAAAE,aAAW,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,MAAM;CAAC,GADjE,EAEED,MAAM,YAA4B;EAChC,OAAO,OAAO;CAChB,EACD,CAAA,CAAA;AAEL"}
|
|
@@ -194,7 +194,6 @@ function TokenInput(props) {
|
|
|
194
194
|
var _el$ = getNextElement(_tmpl$);
|
|
195
195
|
var _el$3 = _el$.firstChild.nextSibling;
|
|
196
196
|
var [_el$4, _el$5] = getNextMarker(_el$3.nextSibling);
|
|
197
|
-
_el$4.nextSibling;
|
|
198
197
|
insert(_el$, scope(() => {
|
|
199
198
|
return props.children(segment);
|
|
200
199
|
}), _el$4, _el$5);
|