@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/server/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["ref={props.ref}","setPanelRef={(element: HTMLDivElement) => {\n setPanelRef(element);\n }}","tabsRef={setRef}","ref={input.tabsRef}","<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>","dom.div","<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\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>","<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 }}","<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>","<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>","_$applyRef","_$mergeProps"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgYU,O,SAAC,CAAO;;;;;;;;;;;;;EAdV,O,SAAe,CAAK,cAAc,KAAA;;;;;;;EAClC,O,SAAe,CAAK,cAAc,KAAA;;;;;;;EAClC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,SAAc,CAAK,aAAa,KAAA;;;;;;;EAChC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAoB,CAAM,kBAAkB,KAAA;;;;;;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,CAAA;AACpD;AAEA,SAAS,aAAgB,OAGT;CACd,MAAM,UAAU,qBAAqB,WAAW;CAEhD,MAAM,CAAC,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAGD,MAAM,OADW,WAAW,yBACf,CAAA,CAAS;CAEtB,MAAM,OAAO,cACX,WACE,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,kBACb,WACE,YAAY,MAAM,SAAS,CAAC,CAAC,GAC7B;EACE,UAAU,KAAA;EACV,cAAc;EACd;CACF,CACF,CACF;CAEA,OAAA,IACGL,IAADM,mBACE;EAAI,OAAA,WACF,KAAK,eAAe,MAAM,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI,GACxD,YAAY,KAAK,gBAAgB,CAAC,CAAC,GACnC,MACF;CAAC,GALH,IAAA,MAiBoB,QAAA,MAEA,OAbb,EACF,YAA4B;EAC3B,OAAO,OAAO;CAChB,IACC,YAA4B;EAC3B,UACE,cAAc,MAAM,MAAM,GAAG,GAC7B,OACF;CACF,CACF,CAIO,CAAA,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["tabsRef={setRef}","ref={input.tabsRef}","<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>","dom.div","<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>","<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>","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>","<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 }}","<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>","<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>","_$applyRef","_$mergeProps","_$memo"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkYU,O,SAAC,CAAO;;;;;;;;;;;;;EAdV,O,SAAe,CAAK,cAAc,KAAA;;;;;;;EAClC,O,SAAe,CAAK,cAAc,KAAA;;;;;;;EA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AAI,CAAC,OAEH,OAAA,WAAuB,KAAQ;CAGjC,OAAA,aAAO;EAAqB;EAAc;CAAQ,CAAA;AACpD;AAEA,SAAS,aAAgB,OAGT;CACd,MAAM,UAAU,qBAAqB,WAAW;CAEhD,MAAM,CAAC,KAAK,UAAU,aAAoC,MAAM,EAC9D,YAAY,KACd,CAAC;CAGD,MAAM,OADW,WAAW,yBACf,CAAA,CAAS;CAEtB,MAAM,OAAO,cACX,WACE,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,kBACb,WACE,YAAY,MAAM,SAAS,CAAC,CAAC,GAC7B;EACE,UAAU,KAAA;EACV,cAAc;EACd;CACF,CACF,CACF;CAEA,OAAA,IACGP,IAADQ,mBACE;EAAI,OAAA,WACF,KAAK,eAAe,MAAM,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,IAAI,GACxD,YAAY,KAAK,gBAAgB,CAAC,CAAC,GACnC,MACF;CAAC,GALH,IAAA,MAiBoB,QAAA,MAEA,OAbb,EACF,YAA4B;EAC3B,OAAO,OAAO;CAChB,IACC,YAA4B;EAC3B,UACE,cAAc,MAAM,MAAM,GAAG,GAC7B,OACF;CACF,CACF,CAIO,CAAA,CAAA;AAEb"}
|
package/dist/server/toast.js
CHANGED
|
@@ -19,7 +19,7 @@ import { ButtonContext } from "./button.js";
|
|
|
19
19
|
import { HeadingContext } from "./heading.js";
|
|
20
20
|
import { TextContext } from "./text.js";
|
|
21
21
|
import { mergeProps } from "@solid2-aria/core/utils/merge-props";
|
|
22
|
-
import { For,
|
|
22
|
+
import { For, createContext, createSignal, merge, untrack, useContext } from "solid-js";
|
|
23
23
|
import { Portal, isServer, memo, mergeProps as mergeProps$1 } from "@solidjs/web";
|
|
24
24
|
import { filterDOMProps } from "@solid2-aria/core/utils/filter-dom-props";
|
|
25
25
|
import { createFocusRing } from "@solid2-aria/core/focus/create-focus-ring";
|
|
@@ -166,73 +166,36 @@ function _P$4(_p14, _p15, _p16, _p17, _p18, _p19, _p20, _p21, _p22) {
|
|
|
166
166
|
_P$4.prototype = Object.prototype;
|
|
167
167
|
var _d$9 = {
|
|
168
168
|
get() {
|
|
169
|
-
return this[_m$].visibleToasts
|
|
170
|
-
},
|
|
171
|
-
enumerable: true,
|
|
172
|
-
configurable: true
|
|
173
|
-
};
|
|
174
|
-
var _d$10 = {
|
|
175
|
-
get() {
|
|
176
|
-
const portal = this[_m$2];
|
|
177
|
-
const props = this[_m$3];
|
|
178
|
-
const aria = this[_m$4];
|
|
179
|
-
const focus = this[_m$5];
|
|
180
|
-
const hover = this[_m$6];
|
|
181
|
-
const render = this[_m$7];
|
|
182
|
-
const values = this[_m$8];
|
|
183
|
-
const state = this[_m$];
|
|
184
|
-
const setRef = this[_m$9];
|
|
185
|
-
return Portal(new _P$4(portal, props, aria, focus, hover, render, values, state, setRef));
|
|
169
|
+
return this[_m$].visibleToasts;
|
|
186
170
|
},
|
|
187
171
|
enumerable: true,
|
|
188
172
|
configurable: true
|
|
189
173
|
};
|
|
190
|
-
function _P$5(_p23, _p24
|
|
174
|
+
function _P$5(_p23, _p24) {
|
|
191
175
|
this[_m$] = _p23;
|
|
192
|
-
this
|
|
193
|
-
this
|
|
194
|
-
this[_m$4] = _p26;
|
|
195
|
-
this[_m$5] = _p27;
|
|
196
|
-
this[_m$6] = _p28;
|
|
197
|
-
this[_m$7] = _p29;
|
|
198
|
-
this[_m$8] = _p30;
|
|
199
|
-
this[_m$9] = _p31;
|
|
200
|
-
Object.defineProperty(this, "when", _d$9);
|
|
201
|
-
Object.defineProperty(this, "children", _d$10);
|
|
176
|
+
Object.defineProperty(this, "each", _d$9);
|
|
177
|
+
this.children = _p24;
|
|
202
178
|
}
|
|
203
179
|
_P$5.prototype = Object.prototype;
|
|
204
|
-
var _d$
|
|
205
|
-
get() {
|
|
206
|
-
return this[_m$].visibleToasts;
|
|
207
|
-
},
|
|
208
|
-
enumerable: true,
|
|
209
|
-
configurable: true
|
|
210
|
-
};
|
|
211
|
-
function _P$6(_p32, _p33) {
|
|
212
|
-
this[_m$] = _p32;
|
|
213
|
-
Object.defineProperty(this, "each", _d$11);
|
|
214
|
-
this.children = _p33;
|
|
215
|
-
}
|
|
216
|
-
_P$6.prototype = Object.prototype;
|
|
217
|
-
var _d$12 = {
|
|
180
|
+
var _d$10 = {
|
|
218
181
|
get() {
|
|
219
182
|
return this[_m$].class ?? "solid2-aria-ToastList";
|
|
220
183
|
},
|
|
221
184
|
enumerable: true,
|
|
222
185
|
configurable: true
|
|
223
186
|
};
|
|
224
|
-
var _d$
|
|
187
|
+
var _d$11 = {
|
|
225
188
|
get() {
|
|
226
189
|
return this[_m$].style;
|
|
227
190
|
},
|
|
228
191
|
enumerable: true,
|
|
229
192
|
configurable: true
|
|
230
193
|
};
|
|
231
|
-
var _d$
|
|
194
|
+
var _d$12 = {
|
|
232
195
|
get() {
|
|
233
196
|
const state = this[_m$2];
|
|
234
197
|
const props = this[_m$];
|
|
235
|
-
return For(new _P$
|
|
198
|
+
return For(new _P$5(state, (toast) => {
|
|
236
199
|
const typedToast = toast;
|
|
237
200
|
return props.children({ toast: typedToast });
|
|
238
201
|
}));
|
|
@@ -240,33 +203,33 @@ var _d$14 = {
|
|
|
240
203
|
enumerable: true,
|
|
241
204
|
configurable: true
|
|
242
205
|
};
|
|
243
|
-
function _P$
|
|
244
|
-
this[_m$] =
|
|
245
|
-
this[_m$2] =
|
|
246
|
-
Object.defineProperty(this, "class", _d$
|
|
247
|
-
Object.defineProperty(this, "style", _d$
|
|
248
|
-
this.ref =
|
|
249
|
-
Object.defineProperty(this, "children", _d$
|
|
206
|
+
function _P$6(_p25, _p26, _p27) {
|
|
207
|
+
this[_m$] = _p25;
|
|
208
|
+
this[_m$2] = _p26;
|
|
209
|
+
Object.defineProperty(this, "class", _d$10);
|
|
210
|
+
Object.defineProperty(this, "style", _d$11);
|
|
211
|
+
this.ref = _p27;
|
|
212
|
+
Object.defineProperty(this, "children", _d$12);
|
|
250
213
|
}
|
|
251
|
-
_P$
|
|
252
|
-
var _d$
|
|
214
|
+
_P$6.prototype = Object.prototype;
|
|
215
|
+
var _d$13 = {
|
|
253
216
|
get() {
|
|
254
217
|
return this[_m$].children;
|
|
255
218
|
},
|
|
256
219
|
enumerable: true,
|
|
257
220
|
configurable: true
|
|
258
221
|
};
|
|
259
|
-
function _P$
|
|
260
|
-
this[_m$] =
|
|
261
|
-
this.value =
|
|
262
|
-
Object.defineProperty(this, "children", _d$
|
|
222
|
+
function _P$7(_p28, _p29) {
|
|
223
|
+
this[_m$] = _p28;
|
|
224
|
+
this.value = _p29;
|
|
225
|
+
Object.defineProperty(this, "children", _d$13);
|
|
263
226
|
}
|
|
264
|
-
_P$
|
|
265
|
-
var _d$
|
|
227
|
+
_P$7.prototype = Object.prototype;
|
|
228
|
+
var _d$14 = {
|
|
266
229
|
get() {
|
|
267
230
|
const render = this[_m$];
|
|
268
231
|
const aria = this[_m$2];
|
|
269
|
-
return ButtonContext(new _P$
|
|
232
|
+
return ButtonContext(new _P$7(render, { slots: {
|
|
270
233
|
[DEFAULT_SLOT]: {},
|
|
271
234
|
get close() {
|
|
272
235
|
return aria.closeButtonProps;
|
|
@@ -276,18 +239,18 @@ var _d$16 = {
|
|
|
276
239
|
enumerable: true,
|
|
277
240
|
configurable: true
|
|
278
241
|
};
|
|
279
|
-
function _P$
|
|
280
|
-
this[_m$] =
|
|
281
|
-
this[_m$2] =
|
|
282
|
-
this.value =
|
|
283
|
-
Object.defineProperty(this, "children", _d$
|
|
242
|
+
function _P$8(_p30, _p31, _p32) {
|
|
243
|
+
this[_m$] = _p30;
|
|
244
|
+
this[_m$2] = _p31;
|
|
245
|
+
this.value = _p32;
|
|
246
|
+
Object.defineProperty(this, "children", _d$14);
|
|
284
247
|
}
|
|
285
|
-
_P$
|
|
286
|
-
var _d$
|
|
248
|
+
_P$8.prototype = Object.prototype;
|
|
249
|
+
var _d$15 = {
|
|
287
250
|
get() {
|
|
288
251
|
const render = this[_m$];
|
|
289
252
|
const aria = this[_m$2];
|
|
290
|
-
return TextContext(new _P$
|
|
253
|
+
return TextContext(new _P$8(render, aria, { slots: {
|
|
291
254
|
[DEFAULT_SLOT]: {},
|
|
292
255
|
get description() {
|
|
293
256
|
return aria.descriptionProps;
|
|
@@ -297,25 +260,25 @@ var _d$17 = {
|
|
|
297
260
|
enumerable: true,
|
|
298
261
|
configurable: true
|
|
299
262
|
};
|
|
300
|
-
function _P$
|
|
301
|
-
this[_m$] =
|
|
302
|
-
this[_m$2] =
|
|
303
|
-
this.value =
|
|
304
|
-
Object.defineProperty(this, "children", _d$
|
|
263
|
+
function _P$9(_p33, _p34, _p35) {
|
|
264
|
+
this[_m$] = _p33;
|
|
265
|
+
this[_m$2] = _p34;
|
|
266
|
+
this.value = _p35;
|
|
267
|
+
Object.defineProperty(this, "children", _d$15);
|
|
305
268
|
}
|
|
306
|
-
_P$
|
|
307
|
-
var _d$
|
|
269
|
+
_P$9.prototype = Object.prototype;
|
|
270
|
+
var _d$16 = {
|
|
308
271
|
get() {
|
|
309
272
|
return this[_m$].contentProps;
|
|
310
273
|
},
|
|
311
274
|
enumerable: true,
|
|
312
275
|
configurable: true
|
|
313
276
|
};
|
|
314
|
-
var _d$
|
|
277
|
+
var _d$17 = {
|
|
315
278
|
get() {
|
|
316
279
|
const render = this[_m$2];
|
|
317
280
|
const aria = this[_m$];
|
|
318
|
-
return HeadingContext(new _P$
|
|
281
|
+
return HeadingContext(new _P$9(render, aria, { slots: {
|
|
319
282
|
[DEFAULT_SLOT]: {},
|
|
320
283
|
get title() {
|
|
321
284
|
return aria.titleProps;
|
|
@@ -325,46 +288,46 @@ var _d$19 = {
|
|
|
325
288
|
enumerable: true,
|
|
326
289
|
configurable: true
|
|
327
290
|
};
|
|
328
|
-
function _P$
|
|
329
|
-
this[_m$] =
|
|
330
|
-
this[_m$2] =
|
|
331
|
-
Object.defineProperty(this, "value", _d$
|
|
332
|
-
Object.defineProperty(this, "children", _d$
|
|
291
|
+
function _P$10(_p36, _p37) {
|
|
292
|
+
this[_m$] = _p36;
|
|
293
|
+
this[_m$2] = _p37;
|
|
294
|
+
Object.defineProperty(this, "value", _d$16);
|
|
295
|
+
Object.defineProperty(this, "children", _d$17);
|
|
333
296
|
}
|
|
334
|
-
_P$
|
|
335
|
-
var _d$
|
|
297
|
+
_P$10.prototype = Object.prototype;
|
|
298
|
+
var _d$18 = {
|
|
336
299
|
get() {
|
|
337
300
|
return this[_m$].isFocused || void 0;
|
|
338
301
|
},
|
|
339
302
|
enumerable: true,
|
|
340
303
|
configurable: true
|
|
341
304
|
};
|
|
342
|
-
var _d$
|
|
305
|
+
var _d$19 = {
|
|
343
306
|
get() {
|
|
344
307
|
return this[_m$].isFocusVisible || void 0;
|
|
345
308
|
},
|
|
346
309
|
enumerable: true,
|
|
347
310
|
configurable: true
|
|
348
311
|
};
|
|
349
|
-
var _d$
|
|
312
|
+
var _d$20 = {
|
|
350
313
|
get() {
|
|
351
314
|
const aria = this[_m$2];
|
|
352
315
|
const render = this[_m$3];
|
|
353
|
-
return ToastContentContext(new _P$
|
|
316
|
+
return ToastContentContext(new _P$10(aria, render));
|
|
354
317
|
},
|
|
355
318
|
enumerable: true,
|
|
356
319
|
configurable: true
|
|
357
320
|
};
|
|
358
|
-
function _P$
|
|
359
|
-
this[_m$] =
|
|
360
|
-
this[_m$2] =
|
|
361
|
-
this[_m$3] =
|
|
362
|
-
this.ref =
|
|
363
|
-
Object.defineProperty(this, "data-focused", _d$
|
|
364
|
-
Object.defineProperty(this, "data-focus-visible", _d$
|
|
365
|
-
Object.defineProperty(this, "children", _d$
|
|
321
|
+
function _P$11(_p38, _p39, _p40, _p41) {
|
|
322
|
+
this[_m$] = _p38;
|
|
323
|
+
this[_m$2] = _p39;
|
|
324
|
+
this[_m$3] = _p40;
|
|
325
|
+
this.ref = _p41;
|
|
326
|
+
Object.defineProperty(this, "data-focused", _d$18);
|
|
327
|
+
Object.defineProperty(this, "data-focus-visible", _d$19);
|
|
328
|
+
Object.defineProperty(this, "children", _d$20);
|
|
366
329
|
}
|
|
367
|
-
_P$
|
|
330
|
+
_P$11.prototype = Object.prototype;
|
|
368
331
|
const UNSTABLE_ToastStateContext = createContext(null);
|
|
369
332
|
const ToastContentContext = createContext(null);
|
|
370
333
|
function UNSTABLE_ToastRegion(props) {
|
|
@@ -394,12 +357,16 @@ function UNSTABLE_ToastRegion(props) {
|
|
|
394
357
|
values
|
|
395
358
|
}));
|
|
396
359
|
if (isServer) return null;
|
|
397
|
-
return
|
|
360
|
+
return memo(() => {
|
|
361
|
+
return memo(() => {
|
|
362
|
+
return state.visibleToasts.length > 0;
|
|
363
|
+
})() ? Portal(new _P$4(portal, props, aria, focus, hover, render, values, state, setRef)) : void 0;
|
|
364
|
+
});
|
|
398
365
|
}
|
|
399
366
|
function UNSTABLE_ToastList(props) {
|
|
400
367
|
const state = useContext(UNSTABLE_ToastStateContext);
|
|
401
368
|
if (!state) throw new Error("ToastList requires ToastRegion");
|
|
402
|
-
return dom.ol(new _P$
|
|
369
|
+
return dom.ol(new _P$6(props, state, (element) => {
|
|
403
370
|
assignRef(untrack(() => props.ref), element);
|
|
404
371
|
}));
|
|
405
372
|
}
|
|
@@ -426,7 +393,7 @@ function UNSTABLE_Toast(props) {
|
|
|
426
393
|
}));
|
|
427
394
|
return dom.div(mergeProps$1(() => {
|
|
428
395
|
return mergeProps(filterDOMProps(props, { global: true }), merge(() => aria.toastProps ?? {}), merge(() => focus.focusProps ?? {}), render);
|
|
429
|
-
}, new _P$
|
|
396
|
+
}, new _P$11(values, aria, render, [(element) => {
|
|
430
397
|
setRef(element);
|
|
431
398
|
}, (element) => {
|
|
432
399
|
assignRef(untrack(() => props.ref), element);
|
package/dist/server/toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["dom.div","<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.ol","<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>","<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 }}","_$memo","_$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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkLmB,O,SAAM,CAAM;;;;;;;;;;;;;EALnB,O,SAAc,CAAO,aAAa,KAAA;;;;;;;EAClC,O,SAAc,CAAO,aAAa,KAAA;;;;;;;EAClC,O,SAAoB,CAAO,kBAAkB,KAAA;;;;;;;;;EAE7C,OAAAM,WAAA;GAAC,OAAA,OAAO,MAAM,aAAa;EAU1B,CAAA,CAAC,CAAD,IAAA,IATC,IAAA,IAAW,QACP,UACA,OAAO,MAAM,aAAa,aACtB,MAAM,SAAS,EAAE,MAAM,CAAC,IACxB,IAEH,CAAA,IAEL,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;EAhCV,OAAA,IAACN,IAADC,mBACE;GAAI,OAAA,WACF,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GACtC,YAAY,KAAK,eAAe,CAAC,CAAC,GAClC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,MACF;EAAC,GAPH,IAAA,KAmBgB,QAIN,OACK,OAhBR,EACF,YAA4B;GAC3B,OAAO,OAAO;EAChB,IACC,YAA4B;GAC3B,UACE,cAAc,MAAM,GAAG,GACvB,OACF;EACF,CACF,CAgBO,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;EApCL,O,SAAO,CAAO,eAAe,KAAK,SAAS;;;;;;;;;;;;;;;EACjD,OAAA,2BAAA,IAAA,KAGqB,OACH,MACA,OACA,OACZ,QAaY,QAKD,OAdT,QAX2B,KAoCP,CAAA;;;;;;;;;;;;;;;;;;;;;EAtC1B,O,SAAM,CAAM,cAAc,SAAS;;;;;;;;;;;;;;;;EACvC,OAAA,OAAA,IAAA,KAAe,QAIQ,OACH,MACA,OACA,OACZ,QAaY,QAKD,OA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AADG,mBACE;EAAI,OAAA,WACF,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GACtC,YAAY,KAAK,cAAc,CAAC,CAAC,GACjC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,MACF;CAAC,GANH,IAAA,MAkBgB,QAGc,MA+BnB,QA7CJ,EACF,YAA4B;EAC3B,OAAO,OAAO;CAChB,IACC,YAA4B;EAC3B,UACE,cAAc,MAAM,GAAG,GACvB,OACF;CACF,CACF,CAwCO,CAAA,CAAA;AAEb;AAEA,SAAgB,sBAAsB,OAAuC;CAC3E,MAAM,CAAC,SAAS,UAAU,mBACxB,OACA,cAAc,MAAM,GAAG,GACvB,mBACF;CAEA,MAAM,SAAS,kBACb,WAAW,OAAO;EAChB,cAAc;EACd,QAAQ,KAAA;CACV,CAAC,CACH;CAEA,OAAA,IACGH,IAADI,mBACE;EAAI,OAAA,WAAW,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,MAAM;CAAC,GADjE,EAEEC,MAAM,YAA4B;EAChC,OAAO,OAAO;CAChB,EACD,CAAA,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["dom.div","<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>","<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>","dom.ol","<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>","<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 }}","_$memo","_$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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ANH,IAAA,MAkBgB,QAGc,MA+BnB,QA7CJ,EACF,YAA4B;EAC3B,OAAO,OAAO;CAChB,IACC,YAA4B;EAC3B,UACE,cAAc,MAAM,GAAG,GACvB,OACF;CACF,CACF,CAwCO,CAAA,CAAA;AAEb;AAEA,SAAgB,sBAAsB,OAAuC;CAC3E,MAAM,CAAC,SAAS,UAAU,mBACxB,OACA,cAAc,MAAM,GAAG,GACvB,mBACF;CAEA,MAAM,SAAS,kBACb,WAAW,OAAO;EAChB,cAAc;EACd,QAAQ,KAAA;CACV,CAAC,CACH;CAEA,OAAA,IACGJ,IAADK,mBACE;EAAI,OAAA,WAAW,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GAAG,MAAM;CAAC,GADjE,EAEEC,MAAM,YAA4B;EAChC,OAAO,OAAO;CAChB,EACD,CAAA,CAAA;AAEL"}
|
|
@@ -33,8 +33,8 @@ import { createTokenFieldState } from "@solid2-aria/stately/tokenfield/create-to
|
|
|
33
33
|
// src/token-field.tsx
|
|
34
34
|
var _tmpl$ = [
|
|
35
35
|
"<span",
|
|
36
|
-
" data-react-aria-token
|
|
37
|
-
"
|
|
36
|
+
" data-react-aria-token>​<!--$-->",
|
|
37
|
+
"<!--/-->​</span>"
|
|
38
38
|
];
|
|
39
39
|
var _tmpl$2 = ["<br", ">"];
|
|
40
40
|
var _m$ = Symbol();
|