@proyecto-viviana/solidaria-components 0.7.0-rc.2 → 0.7.0-rc.4

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.
Files changed (171) hide show
  1. package/dist/ActionBar.js.map +1 -1
  2. package/dist/ActionBar.jsx.map +1 -1
  3. package/dist/ActionGroup.js.map +1 -1
  4. package/dist/ActionGroup.jsx.map +1 -1
  5. package/dist/Alert.js.map +1 -1
  6. package/dist/Alert.jsx.map +1 -1
  7. package/dist/Autocomplete.js.map +1 -1
  8. package/dist/Breadcrumbs.js.map +1 -1
  9. package/dist/Breadcrumbs.jsx.map +1 -1
  10. package/dist/Button.js.map +1 -1
  11. package/dist/Button.jsx.map +1 -1
  12. package/dist/Calendar.js.map +1 -1
  13. package/dist/Calendar.jsx.map +1 -1
  14. package/dist/Checkbox.js.map +1 -1
  15. package/dist/Checkbox.jsx.map +1 -1
  16. package/dist/Collection.d.ts +5 -0
  17. package/dist/Collection.d.ts.map +1 -1
  18. package/dist/Collection.js +6 -1
  19. package/dist/Collection.js.map +1 -1
  20. package/dist/Collection.jsx +6 -1
  21. package/dist/Collection.jsx.map +1 -1
  22. package/dist/ColorArea.js.map +1 -1
  23. package/dist/ColorArea.jsx.map +1 -1
  24. package/dist/ColorEditor.js.map +1 -1
  25. package/dist/ColorField.js.map +1 -1
  26. package/dist/ColorField.jsx.map +1 -1
  27. package/dist/ColorPicker.js.map +1 -1
  28. package/dist/ColorSlider.js.map +1 -1
  29. package/dist/ColorSlider.jsx.map +1 -1
  30. package/dist/ColorSwatch.js.map +1 -1
  31. package/dist/ColorSwatch.jsx.map +1 -1
  32. package/dist/ColorSwatchPicker.js.map +1 -1
  33. package/dist/ColorSwatchPicker.jsx.map +1 -1
  34. package/dist/ColorThumb.js +1 -14
  35. package/dist/ColorThumb.jsx +1 -14
  36. package/dist/ColorWheel.js.map +1 -1
  37. package/dist/ColorWheel.jsx.map +1 -1
  38. package/dist/ComboBox.d.ts +2 -0
  39. package/dist/ComboBox.d.ts.map +1 -1
  40. package/dist/ComboBox.js +289 -205
  41. package/dist/ComboBox.js.map +1 -1
  42. package/dist/ComboBox.jsx +90 -51
  43. package/dist/ComboBox.jsx.map +1 -1
  44. package/dist/ContextualHelpTrigger.js.map +1 -1
  45. package/dist/ContextualHelpTrigger.jsx.map +1 -1
  46. package/dist/DateField.js +1 -2
  47. package/dist/DateField.jsx +1 -2
  48. package/dist/DateField2.js.map +1 -1
  49. package/dist/DateField2.jsx.map +1 -1
  50. package/dist/DatePicker2.js.map +1 -1
  51. package/dist/DatePicker2.jsx.map +1 -1
  52. package/dist/Dialog.js.map +1 -1
  53. package/dist/Dialog.jsx.map +1 -1
  54. package/dist/Disclosure.js.map +1 -1
  55. package/dist/Disclosure.jsx.map +1 -1
  56. package/dist/DragAndDrop.js.map +1 -1
  57. package/dist/DragAndDrop.jsx.map +1 -1
  58. package/dist/DropZone.js.map +1 -1
  59. package/dist/DropZone.jsx.map +1 -1
  60. package/dist/ElementTag.js.map +1 -1
  61. package/dist/ElementTag.jsx.map +1 -1
  62. package/dist/FieldError.js.map +1 -1
  63. package/dist/FieldError.jsx.map +1 -1
  64. package/dist/FileTrigger.js.map +1 -1
  65. package/dist/FileTrigger.jsx.map +1 -1
  66. package/dist/Focusable.js.map +1 -1
  67. package/dist/Form.js.map +1 -1
  68. package/dist/Form.jsx.map +1 -1
  69. package/dist/GridList.js.map +1 -1
  70. package/dist/GridList.jsx.map +1 -1
  71. package/dist/Heading.js.map +1 -1
  72. package/dist/Heading.jsx.map +1 -1
  73. package/dist/Icon.js.map +1 -1
  74. package/dist/Icon.jsx.map +1 -1
  75. package/dist/Keyboard.js.map +1 -1
  76. package/dist/Keyboard.jsx.map +1 -1
  77. package/dist/Label.js.map +1 -1
  78. package/dist/Label.jsx.map +1 -1
  79. package/dist/Landmark.js.map +1 -1
  80. package/dist/Landmark.jsx.map +1 -1
  81. package/dist/Link.js.map +1 -1
  82. package/dist/Link.jsx.map +1 -1
  83. package/dist/ListBox.d.ts.map +1 -1
  84. package/dist/ListBox.js +38 -1
  85. package/dist/ListBox.js.map +1 -1
  86. package/dist/ListBox.jsx +28 -1
  87. package/dist/ListBox.jsx.map +1 -1
  88. package/dist/Menu.js.map +1 -1
  89. package/dist/Menu.jsx.map +1 -1
  90. package/dist/Meter.js.map +1 -1
  91. package/dist/Meter.jsx.map +1 -1
  92. package/dist/Modal.js.map +1 -1
  93. package/dist/Modal.jsx.map +1 -1
  94. package/dist/NumberField.js.map +1 -1
  95. package/dist/NumberField.jsx.map +1 -1
  96. package/dist/Popover.js.map +1 -1
  97. package/dist/Popover.jsx.map +1 -1
  98. package/dist/Pressable.js.map +1 -1
  99. package/dist/PreviewTrigger.js.map +1 -1
  100. package/dist/PreviewTrigger.jsx.map +1 -1
  101. package/dist/ProgressBar.js.map +1 -1
  102. package/dist/ProgressBar.jsx.map +1 -1
  103. package/dist/RadioGroup.js.map +1 -1
  104. package/dist/RadioGroup.jsx.map +1 -1
  105. package/dist/RangeCalendar.js.map +1 -1
  106. package/dist/RangeCalendar.jsx.map +1 -1
  107. package/dist/RouterProvider.js +1 -14
  108. package/dist/RouterProvider.jsx +1 -14
  109. package/dist/SearchField.js.map +1 -1
  110. package/dist/SearchField.jsx.map +1 -1
  111. package/dist/Select.js.map +1 -1
  112. package/dist/Select.jsx.map +1 -1
  113. package/dist/SelectionIndicator.js.map +1 -1
  114. package/dist/SelectionIndicator.jsx.map +1 -1
  115. package/dist/Separator.js.map +1 -1
  116. package/dist/Separator.jsx.map +1 -1
  117. package/dist/SharedElementTransition.js.map +1 -1
  118. package/dist/SharedElementTransition.jsx.map +1 -1
  119. package/dist/Slider.js.map +1 -1
  120. package/dist/Slider.jsx.map +1 -1
  121. package/dist/StepList.js.map +1 -1
  122. package/dist/StepList.jsx.map +1 -1
  123. package/dist/Switch.js.map +1 -1
  124. package/dist/Switch.jsx.map +1 -1
  125. package/dist/Table.js.map +1 -1
  126. package/dist/Table.jsx.map +1 -1
  127. package/dist/Tabs.js.map +1 -1
  128. package/dist/Tabs.jsx.map +1 -1
  129. package/dist/TagGroup.js.map +1 -1
  130. package/dist/TagGroup.jsx.map +1 -1
  131. package/dist/Text.js.map +1 -1
  132. package/dist/Text.jsx.map +1 -1
  133. package/dist/TextField.js.map +1 -1
  134. package/dist/TextField.jsx.map +1 -1
  135. package/dist/TimeField.js.map +1 -1
  136. package/dist/TimeField.jsx.map +1 -1
  137. package/dist/Toast.js.map +1 -1
  138. package/dist/Toast.jsx.map +1 -1
  139. package/dist/ToggleButton.js.map +1 -1
  140. package/dist/ToggleButton.jsx.map +1 -1
  141. package/dist/ToggleButtonGroup.js.map +1 -1
  142. package/dist/ToggleButtonGroup.jsx.map +1 -1
  143. package/dist/TokenField.js.map +1 -1
  144. package/dist/TokenField.jsx.map +1 -1
  145. package/dist/Toolbar.js.map +1 -1
  146. package/dist/Toolbar.jsx.map +1 -1
  147. package/dist/Tooltip.js.map +1 -1
  148. package/dist/Tooltip.jsx.map +1 -1
  149. package/dist/Tree.d.ts +4 -0
  150. package/dist/Tree.d.ts.map +1 -1
  151. package/dist/Tree.js +135 -49
  152. package/dist/Tree.js.map +1 -1
  153. package/dist/Tree.jsx +65 -43
  154. package/dist/Tree.jsx.map +1 -1
  155. package/dist/Virtualizer.js +1 -2
  156. package/dist/Virtualizer.jsx +1 -2
  157. package/dist/Virtualizer2.js.map +1 -1
  158. package/dist/Virtualizer2.jsx.map +1 -1
  159. package/dist/VisuallyHidden.js.map +1 -1
  160. package/dist/VisuallyHidden.jsx.map +1 -1
  161. package/dist/staticSelectCollection.js +1 -2
  162. package/dist/staticSelectCollection.jsx +1 -2
  163. package/dist/useDragAndDrop.js +1 -2
  164. package/dist/useDragAndDrop.jsx +1 -2
  165. package/dist/utils.js.map +1 -1
  166. package/dist/utils.jsx.map +1 -1
  167. package/package.json +3 -3
  168. package/src/Collection.tsx +6 -0
  169. package/src/ComboBox.tsx +279 -182
  170. package/src/ListBox.tsx +39 -0
  171. package/src/Tree.tsx +93 -42
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.jsx","names":["assignRef"],"sources":["../src/Breadcrumbs.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Breadcrumbs.tsx\n\n/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n createContext,\n createMemo,\n createSignal,\n createUniqueId,\n useContext,\n For,\n Show,\n type Accessor,\n} from \"solid-js\";\nimport { isServer, renderToString, type JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport { handleLinkClick, useRouter } from \"./RouterProvider\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n attrTrue,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction omitOnClick(raw: Record<string, unknown>): Record<string, unknown> {\n const rest: Record<string, unknown> = {};\n for (const key of Object.keys(raw)) {\n if (key === \"onClick\") continue;\n const desc = Object.getOwnPropertyDescriptor(raw, key);\n if (desc) {\n Object.defineProperty(rest, key, desc);\n }\n }\n return rest;\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const breadcrumbsId = createUniqueId();\n let serverStaticCount = 0;\n if (isServer && !hasCollectionItems()) {\n let probeIndex = 0;\n renderToString(() => (\n <BreadcrumbsContext\n value={{\n isDisabled,\n registerStaticItem: () => probeIndex++,\n staticItemCount: () => 0,\n resetStaticItems: () => {\n probeIndex = 0;\n },\n setStaticItemCount: () => {},\n }}\n >\n {local.children as JSX.Element}\n </BreadcrumbsContext>\n ));\n serverStaticCount = probeIndex;\n }\n let clientInitialCount = 0;\n if (!isServer && !hasCollectionItems() && typeof document !== \"undefined\") {\n const el = document.querySelector(`[data-rsp-breadcrumbs-id=\"${breadcrumbsId}\"]`);\n if (el) {\n const countAttr = el.getAttribute(\"data-rsp-breadcrumbs-count\");\n if (countAttr) {\n clientInitialCount = parseInt(countAttr, 10) || 0;\n }\n }\n }\n const [clientStaticCount, setClientStaticCount] = createSignal(clientInitialCount, {\n ownedWrite: true,\n });\n const staticItemCount = () => (isServer ? serverStaticCount : clientStaticCount());\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n if (!isServer) {\n setClientStaticCount(0);\n }\n };\n const setStaticItemCount = (count: number) => {\n if (isServer) {\n serverStaticCount = count;\n } else {\n setClientStaticCount(count);\n }\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n data-rsp-breadcrumbs-id={!hasCollectionItems() ? breadcrumbsId : undefined}\n data-rsp-breadcrumbs-count={serverStaticCount > 0 ? serverStaticCount : undefined}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext>\n );\n}\n\nfunction walkStaticChildren(children: unknown): unknown[] {\n const result: unknown[] = [];\n function walk(node: unknown): void {\n if (node == null || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n for (const item of node) {\n walk(item);\n }\n return;\n }\n if (typeof node === \"function\" && (node as Function).length === 0) {\n walk((node as () => unknown)());\n return;\n }\n result.push(node);\n }\n walk(children);\n return result;\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = walkStaticChildren(props.children);\n if (!isServer) {\n context?.setStaticItemCount?.(array.length);\n }\n return array;\n });\n\n const indices = createMemo(() => Array.from({ length: childArray().length }, (_, i) => i));\n\n return (\n <For each={indices()}>\n {(index) => (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n {childArray()[index] as JSX.Element}\n </li>\n )}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const router = useRouter();\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n // createLink does not call handleLinkClick.\n const onItemClick = (event: MouseEvent) => {\n const click = (mergedItemProps() as { onClick?: (event: MouseEvent) => void }).onClick;\n click?.(event);\n handleLinkClick(event, router, ariaProps.href, ariaProps.routerOptions);\n };\n const itemDomProps = createMemo(() =>\n mergeProps(omitOnClick(mergedItemProps() as Record<string, unknown>), {\n onClick: onItemClick,\n }),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...itemDomProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={attrTrue(isDisabled() || isCurrent())}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={dataAttr(isCurrent())}\n data-disabled={dataAttr(isDisabled())}\n data-pressed={dataAttr(isPressed())}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-hovered={dataAttr(isHovered())}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,YAAY,KAAuD;CAC1E,MAAM,OAAgC,CAAC;CACvC,KAAK,MAAM,OAAO,OAAO,KAAK,GAAG,GAAG;EAClC,IAAI,QAAQ,WAAW;EACvB,MAAM,OAAO,OAAO,yBAAyB,KAAK,GAAG;EACrD,IAAI,MACF,OAAO,eAAe,MAAM,KAAK,IAAI;CAEzC;CACA,OAAO;AACT;AAgEA,MAAa,qBAAqB,cAA8C,IAAI;AAOpF,MAAa,wBAAwB,cAAiD,IAAI;AAE1F,SAAS,eAAe,MAAe,OAAgC;CACrE,MAAM,YAAY;CAClB,OAAO,UAAU,OAAO,UAAU,MAAM;AAC1C;;;;AAKA,SAAgB,YAAe,OAAyC;CACtE,MA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AAc,UAAU,IAAK,UAAU,mBAAmB,SAAU,KAAA,GACpE,eAAe,SAAS,WAAW,KAAK,UAAU,CAAC,GACnD,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,GACnB,cAAc,SAAS,UAAU,CAAC,GAClC,eAAe,SAAS,WAAW,CAAC,GACpC,cAAc,SAAS,UAAU,CAAC,GAClC,cAAc,SAAS,UAAU,CAAC,GAClC,oBAAoB,SAAS,eAAe,CAAC,GAC7C,cAAc,SAAS,UAAU,CAAC,GACnC;OACE,YAAY,eAAe,EAAE;IAChC,EAAE;AAEN;AAEA,YAAY,OAAO"}
1
+ {"version":3,"file":"Breadcrumbs.jsx","names":["assignRef"],"sources":["../src/Breadcrumbs.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Breadcrumbs.tsx\n\n/**\n * Breadcrumbs component for solidaria-components\n *\n * A pre-wired headless breadcrumbs component that combines aria hooks.\n * Port of react-aria-components Breadcrumbs.\n */\n\nimport {\n createContext,\n createMemo,\n createSignal,\n createUniqueId,\n useContext,\n For,\n Show,\n type Accessor,\n} from \"solid-js\";\nimport { isServer, renderToString, type JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport { handleLinkClick, useRouter } from \"./RouterProvider\";\nimport {\n createBreadcrumbs,\n createBreadcrumbItem,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaBreadcrumbsProps,\n type AriaBreadcrumbItemProps,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n attrTrue,\n} from \"./utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction omitOnClick(raw: Record<string, unknown>): Record<string, unknown> {\n const rest: Record<string, unknown> = {};\n for (const key of Object.keys(raw)) {\n if (key === \"onClick\") continue;\n const desc = Object.getOwnPropertyDescriptor(raw, key);\n if (desc) {\n Object.defineProperty(rest, key, desc);\n }\n }\n return rest;\n}\n\nexport interface BreadcrumbsRenderProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled: boolean;\n}\n\nexport interface BreadcrumbsProps<T> extends Omit<AriaBreadcrumbsProps, \"isDisabled\">, SlotProps {\n /** The items to render in the breadcrumbs. */\n items?: T[];\n /** Function to get the key from an item. */\n getKey?: (item: T) => string | number;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n /** Handler called when a breadcrumb item is activated. */\n onAction?: (key: string | number) => void;\n /** The children of the component, or a render function for collection items. */\n children?: JSX.Element | ((item: T) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbsRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbsRenderProps>;\n /** Ref for the navigation element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport interface BreadcrumbItemRenderProps {\n /** Whether this is the current/last item. */\n isCurrent: boolean;\n /** Whether the item is disabled. */\n isDisabled: boolean;\n /** Whether the item is pressed. */\n isPressed: boolean;\n /** Whether the item is focused. */\n isFocused: boolean;\n /** Whether the item has visible focus ring. */\n isFocusVisible: boolean;\n /** Whether the item is hovered. */\n isHovered: boolean;\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbItemProps, \"isDisabled\">, SlotProps {\n /** The children of the breadcrumb item. */\n children?: RenderChildren<BreadcrumbItemRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<BreadcrumbItemRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<BreadcrumbItemRenderProps>;\n /** Whether this item is disabled. */\n isDisabled?: boolean;\n /** Ref for the breadcrumb item element. */\n ref?: RefLike<HTMLElement>;\n}\n\ninterface BreadcrumbsContextValue {\n isDisabled: Accessor<boolean>;\n onAction?: (key: string | number) => void;\n registerStaticItem?: () => number;\n staticItemCount?: Accessor<number>;\n resetStaticItems?: () => void;\n setStaticItemCount?: (count: number) => void;\n}\n\nexport const BreadcrumbsContext = createContext<BreadcrumbsContextValue | null>(null);\n\ninterface BreadcrumbItemContextValue {\n itemKey: string | number | null;\n isLast: Accessor<boolean>;\n}\n\nexport const BreadcrumbItemContext = createContext<BreadcrumbItemContextValue | null>(null);\n\nfunction defaultItemKey(item: unknown, index: number): string | number {\n const maybeItem = item as { key?: string | number; id?: string | number };\n return maybeItem.key ?? maybeItem.id ?? index;\n}\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user's location within an application.\n */\nexport function Breadcrumbs<T>(props: BreadcrumbsProps<T>): JSX.Element {\n const [local, ariaProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"items\", \"getKey\", \"isDisabled\", \"onAction\", \"ref\"],\n [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-details\"],\n );\n\n const isDisabled = () => local.isDisabled ?? false;\n const items = () => local.items ?? [];\n const hasCollectionItems = () => local.items !== undefined;\n const getItemKey = (item: T, index: number): string | number =>\n local.getKey?.(item) ?? defaultItemKey(item, index);\n const breadcrumbsId = createUniqueId();\n let serverStaticCount = 0;\n if (isServer && !hasCollectionItems()) {\n let probeIndex = 0;\n renderToString(() => (\n <BreadcrumbsContext\n value={{\n isDisabled,\n registerStaticItem: () => probeIndex++,\n staticItemCount: () => 0,\n resetStaticItems: () => {\n probeIndex = 0;\n },\n setStaticItemCount: () => {},\n }}\n >\n {local.children as JSX.Element}\n </BreadcrumbsContext>\n ));\n serverStaticCount = probeIndex;\n }\n let clientInitialCount = 0;\n if (!isServer && !hasCollectionItems() && typeof document !== \"undefined\") {\n const el = document.querySelector(`[data-rsp-breadcrumbs-id=\"${breadcrumbsId}\"]`);\n if (el) {\n const countAttr = el.getAttribute(\"data-rsp-breadcrumbs-count\");\n if (countAttr) {\n clientInitialCount = parseInt(countAttr, 10) || 0;\n }\n }\n }\n const [clientStaticCount, setClientStaticCount] = createSignal(clientInitialCount, {\n ownedWrite: true,\n });\n const staticItemCount = () => (isServer ? serverStaticCount : clientStaticCount());\n let nextStaticIndex = 0;\n const resetStaticItems = () => {\n nextStaticIndex = 0;\n if (!isServer) {\n setClientStaticCount(0);\n }\n };\n const setStaticItemCount = (count: number) => {\n if (isServer) {\n serverStaticCount = count;\n } else {\n setClientStaticCount(count);\n }\n };\n const registerStaticItem = () => {\n const index = nextStaticIndex;\n nextStaticIndex += 1;\n return index;\n };\n\n const { navProps } = createBreadcrumbs({\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const renderValues = createMemo<BreadcrumbsRenderProps>(() => ({\n isDisabled: isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Breadcrumbs\",\n },\n renderValues,\n );\n\n const domProps = createMemo(() =>\n filterDOMProps(rest as Record<string, unknown>, { global: true }),\n );\n return (\n <BreadcrumbsContext\n value={{\n isDisabled,\n onAction: local.onAction,\n registerStaticItem,\n staticItemCount,\n resetStaticItems,\n setStaticItemCount,\n }}\n >\n {/*\n Faithful to react-aria-components Breadcrumbs: the accessible name (navProps'\n aria-label) sits directly on the <ol> (role=\"list\"), with NO wrapping <nav>\n landmark (react-spectrum/packages/react-aria-components/src/Breadcrumbs.tsx\n renders `<dom.ol {...mergeProps(DOMProps, navProps)} style={props.style}>`).\n The <ol> carries ONLY the consumer's class/style — no hard-coded inline\n layout reset. An inline reset would beat the styled layer's class (inline\n wins over class), which is exactly what broke S2 parity: the solid-spectrum\n `wrapperStyles` class supplies display:flex / list-style:none / padding:0 /\n marginStart and deliberately leaves align-items at its `normal` default, so\n a hard-coded inline `align-items:center` + `margin:0` clobbered the\n wrapper's margin and diverged from S2 (whose <ol> has neither).\n */}\n <ol\n {...navProps}\n {...domProps()}\n data-rsp-breadcrumbs-id={!hasCollectionItems() ? breadcrumbsId : undefined}\n data-rsp-breadcrumbs-count={serverStaticCount > 0 ? serverStaticCount : undefined}\n ref={(element) => assignRef(local.ref, element)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(isDisabled())}\n >\n <Show\n when={hasCollectionItems()}\n fallback={<StaticBreadcrumbItems>{local.children as JSX.Element}</StaticBreadcrumbItems>}\n >\n <For each={items()}>\n {(item, index) => {\n const itemKey = getItemKey(item, index());\n const isLast = () => index() === items().length - 1;\n const renderItem = local.children as ((item: T) => JSX.Element) | undefined;\n\n return (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n <BreadcrumbItemContext value={{ itemKey, isLast }}>\n {renderItem?.(item)}\n </BreadcrumbItemContext>\n </li>\n );\n }}\n </For>\n </Show>\n </ol>\n </BreadcrumbsContext>\n );\n}\n\nfunction walkStaticChildren(children: unknown): unknown[] {\n const result: unknown[] = [];\n function walk(node: unknown): void {\n if (node == null || typeof node === \"boolean\") {\n return;\n }\n if (Array.isArray(node)) {\n for (const item of node) {\n walk(item);\n }\n return;\n }\n if (typeof node === \"function\" && (node as Function).length === 0) {\n walk((node as () => unknown)());\n return;\n }\n result.push(node);\n }\n walk(children);\n return result;\n}\n\nfunction StaticBreadcrumbItems(props: { children?: JSX.Element }): JSX.Element {\n const context = useContext(BreadcrumbsContext);\n const childArray = createMemo(() => {\n context?.resetStaticItems?.();\n const array = walkStaticChildren(props.children);\n if (!isServer) {\n context?.setStaticItemCount?.(array.length);\n }\n return array;\n });\n\n const indices = createMemo(() => Array.from({ length: childArray().length }, (_, i) => i));\n\n return (\n <For each={indices()}>\n {(index) => (\n <li style={{ display: \"flex\", \"align-items\": \"center\" }}>\n {childArray()[index] as JSX.Element}\n </li>\n )}\n </For>\n );\n}\n\n/**\n * A BreadcrumbItem represents an individual breadcrumb in the navigation trail.\n */\nexport function BreadcrumbItem(props: BreadcrumbItemProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"isDisabled\", \"ref\"]);\n\n const context = useContext(BreadcrumbsContext);\n const itemContext = useContext(BreadcrumbItemContext);\n const router = useRouter();\n const staticIndex = itemContext ? null : context?.registerStaticItem?.();\n const isDisabled = () => local.isDisabled ?? context?.isDisabled() ?? false;\n const isCurrent = () =>\n ariaProps.isCurrent ??\n itemContext?.isLast() ??\n (staticIndex !== null &&\n staticIndex !== undefined &&\n context?.staticItemCount !== undefined &&\n staticIndex === context.staticItemCount() - 1);\n const itemKey = () => itemContext?.itemKey ?? ariaProps.id ?? null;\n\n // Mirror react-aria-components' Link: render an <a> only when there is an\n // href on an enabled, non-current item; otherwise fall back to a <span\n // role=\"link\"> (via createLink). A styled layer may force the element type\n // (S2 renders the current item as a plain <div>), which takes precedence.\n const elementType = () =>\n ariaProps.elementType ?? (ariaProps.href && !isDisabled() && !isCurrent() ? \"a\" : \"span\");\n // The current breadcrumb is the current page and is non-interactive: S2\n // renders it as a plain element with no link role. createLink only omits\n // role=\"link\" for an <a>, so treat the current item as an \"a\" purely for the\n // role decision while still rendering the resolved element type above.\n const linkElementType = () => (isCurrent() ? \"a\" : elementType());\n\n const handlePress = (e: PressEvent) => {\n ariaProps.onPress?.(e);\n const key = itemKey();\n if (key !== null && !isCurrent() && !isDisabled()) {\n context?.onAction?.(key);\n }\n };\n\n const itemAria = createBreadcrumbItem({\n get id() {\n return ariaProps.id;\n },\n get isCurrent() {\n return isCurrent();\n },\n get isDisabled() {\n return isDisabled();\n },\n get href() {\n return ariaProps.href;\n },\n get target() {\n return ariaProps.target;\n },\n get rel() {\n return ariaProps.rel;\n },\n get elementType() {\n return linkElementType();\n },\n get onPress() {\n return handlePress;\n },\n get onPressStart() {\n return ariaProps.onPressStart;\n },\n get onPressEnd() {\n return ariaProps.onPressEnd;\n },\n get onClick() {\n return ariaProps.onClick;\n },\n get onFocus() {\n return ariaProps.onFocus;\n },\n get onBlur() {\n return ariaProps.onBlur;\n },\n get onFocusChange() {\n return ariaProps.onFocusChange;\n },\n get onKeyDown() {\n return ariaProps.onKeyDown;\n },\n get onKeyUp() {\n return ariaProps.onKeyUp;\n },\n get autoFocus() {\n return ariaProps.autoFocus;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get \"aria-current\"() {\n return ariaProps[\"aria-current\"];\n },\n });\n\n const isPressed = itemAria.isPressed;\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n // Read itemAria.itemProps fresh inside the memo (do NOT destructure it above):\n // the reactive getter re-runs createBreadcrumbItem → createLink each time this\n // memo re-evaluates, so role/tabIndex track elementType once isCurrent settles.\n const mergedItemProps = createMemo(() =>\n mergeProps(\n itemAria.itemProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n ),\n );\n // createLink does not call handleLinkClick.\n const onItemClick = (event: MouseEvent) => {\n const click = (mergedItemProps() as { onClick?: (event: MouseEvent) => void }).onClick;\n click?.(event);\n handleLinkClick(event, router, ariaProps.href, ariaProps.routerOptions);\n };\n const itemDomProps = createMemo(() =>\n mergeProps(omitOnClick(mergedItemProps() as Record<string, unknown>), {\n onClick: onItemClick,\n }),\n );\n\n const renderValues = createMemo<BreadcrumbItemRenderProps>(() => ({\n isCurrent: isCurrent(),\n isDisabled: isDisabled(),\n isPressed: isPressed(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isHovered: isHovered(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-BreadcrumbItem\",\n },\n renderValues,\n );\n\n const mergedStyle = () => {\n const userStyle = renderProps.style();\n const baseStyle = { display: \"inline-flex\", \"align-items\": \"center\" };\n return userStyle ? { ...baseStyle, ...userStyle } : baseStyle;\n };\n\n return (\n <ElementTag\n tag={elementType()}\n {...itemDomProps()}\n ref={(element: HTMLElement) => assignRef(local.ref, element)}\n aria-current={isCurrent() ? (ariaProps[\"aria-current\"] ?? \"page\") : undefined}\n aria-disabled={attrTrue(isDisabled() || isCurrent())}\n class={renderProps.class()}\n style={mergedStyle()}\n data-current={dataAttr(isCurrent())}\n data-disabled={dataAttr(isDisabled())}\n data-pressed={dataAttr(isPressed())}\n data-focused={dataAttr(isFocused())}\n data-focus-visible={dataAttr(isFocusVisible())}\n data-hovered={dataAttr(isHovered())}\n >\n {renderProps.renderChildren()}\n </ElementTag>\n );\n}\n\nBreadcrumbs.Item = BreadcrumbItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,YAAY,KAAuD;CAC1E,MAAM,OAAgC,CAAC;CACvC,KAAK,MAAM,OAAO,OAAO,KAAK,GAAG,GAAG;E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f;EACA,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA,kBAAkB;CACpB,GACA,YACF;CAEA,MAAM,oBAAoB;EACxB,MAAM,YAAY,YAAY,MAAM;EACpC,MAAM,YAAY;GAAE,SAAS;GAAe,eAAe;EAAS;EACpE,OAAO,YAAY;GAAE,GAAG;GAAW,GAAG;EAAU,IAAI;CACtD;CAEA,OACE,CAAC,WACC,KAAK,YAAY,GACjB,IAAI,aAAa,CAAC,EAClB,MAAM,YAAyBA,YAAU,MAAM,KAAK,OAAO,GAC3D,cAAc,UAAU,IAAK,UAAU,mBAAmB,SAAU,KAAA,GACpE,eAAe,SAAS,WAAW,KAAK,UAAU,CAAC,GACnD,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,GACnB,cAAc,SAAS,UAAU,CAAC,GAClC,eAAe,SAAS,WAAW,CAAC,GACpC,cAAc,SAAS,UAAU,CAAC,GAClC,cAAc,SAAS,UAAU,CAAC,GAClC,oBAAoB,SAAS,eAAe,CAAC,GAC7C,cAAc,SAAS,UAAU,CAAC,GACnC;OACE,YAAY,eAAe,EAAE;IAChC,EAAE;AAEN;AAEA,YAAY,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["<ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>","value={{ id: progressId }}","{customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}","ref={handleRef}","{buttonContent()}"],"sources":["../src/Button.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Button.tsx\n\n/**\n * Button component for solidaria-components\n *\n * A pre-wired headless button that combines state + aria hooks.\n * Port of react-aria-components/src/Button.tsx\n */\n\nimport {\n createContext,\n createEffect,\n createMemo,\n onCleanup,\n createSignal,\n untrack,\n useContext,\n} from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n announce,\n createButton,\n createFocusRing,\n createHover,\n createId,\n mergeProps,\n type AriaButtonProps,\n type HoverEvent,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n coerceDomBoolean,\n} from \"./utils\";\nimport { DialogTriggerContext, PopoverTriggerContext } from \"./contexts\";\nimport { FileTriggerContext } from \"./fileTriggerContext\";\nimport { ProgressBarContext } from \"./ProgressBar\";\nimport { joinSlotClass, useSlotValue } from \"./slots\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\n// Events preserved when `isPending` is true (for tooltips and other overlays),\n// mirroring RAC Button's `PRESERVED_EVENT_PATTERN`. Every other `on*` handler\n// is stripped so a pending-but-focusable button cannot be activated.\nconst pendingPreservedEventPattern =\n /Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction createLiveButtonRenderProps(values: () => ButtonRenderProps): ButtonRenderProps {\n return {\n get isHovered() {\n return values().isHovered;\n },\n get isPressed() {\n return values().isPressed;\n },\n get isFocused() {\n return values().isFocused;\n },\n get isFocusVisible() {\n return values().isFocusVisible;\n },\n get isDisabled() {\n return values().isDisabled;\n },\n get isPending() {\n return values().isPending;\n },\n };\n}\n\nfunction createLiveCustomRootProps(\n getProps: () => JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n getChildren: () => JSX.Element,\n ref: (el: HTMLButtonElement) => void,\n): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const props = {} as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n // Snapshot keys once. Reading getProps() in the component body is\n // STRICT_READ_UNTRACKED; getters re-read live values on later access.\n const keys = new Set([...Object.keys(untrack(getProps)), \"children\", \"ref\"]);\n\n for (const key of keys) {\n Object.defineProperty(props, key, {\n enumerable: true,\n configurable: true,\n get() {\n if (key === \"children\") {\n return getChildren();\n }\n if (key === \"ref\") {\n return ref;\n }\n return (getProps() as Record<string, unknown>)[key];\n },\n });\n }\n\n return props;\n}\n\nconst buttonAriaOverrideProps = [\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"aria-details\",\n \"aria-haspopup\",\n \"aria-expanded\",\n \"aria-controls\",\n \"aria-pressed\",\n \"aria-current\",\n \"aria-disabled\",\n] as const;\n\nfunction createForwardedAriaButtonProps(\n source: AriaButtonProps,\n overrides: AriaButtonProps,\n): AriaButtonProps {\n const result = {} as AriaButtonProps;\n\n // Enumerating an omit/merge proxy can read reactive leaves (descriptor\n // value snapshots). Snapshot keys once, untracked; getters re-read live.\n const sourceKeys = untrack(() => Object.keys(source as Record<string, unknown>));\n for (const key of sourceKeys) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get() {\n return (source as Record<string, unknown>)[key];\n },\n });\n }\n\n for (const key in overrides) {\n const descriptor = Object.getOwnPropertyDescriptor(overrides, key);\n if (!descriptor) continue;\n Object.defineProperty(result, key, { ...descriptor, enumerable: true, configurable: true });\n }\n\n return result;\n}\n\nexport interface ButtonRenderProps {\n /** Whether the button is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the button is currently in a pressed state. */\n isPressed: boolean;\n /** Whether the button is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the button is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the button is disabled. */\n isDisabled: boolean;\n /** Whether the button is currently in a pending state. */\n isPending: boolean;\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<ButtonRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<ButtonRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<ButtonRenderProps>;\n /** Custom renderer for the outer button element. */\n render?: (\n props: JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n renderProps: ButtonRenderProps,\n ) => JSX.Element;\n /** Ref for the underlying button element. */\n ref?: RefLike<HTMLButtonElement>;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Keeps pending buttons focusable by using aria-disabled without a native disabled attribute. */\n isPendingFocusable?: boolean;\n /** Handler called when hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when hover state changes. */\n onHoverChange?: (isHovered: boolean) => void;\n}\n\nexport interface ButtonContextValue extends ButtonProps {\n slots?: Record<string, ButtonProps>;\n}\n\nexport const ButtonContext = createContext<ButtonContextValue | null>(null);\n\n/**\n * A button allows a user to perform an action.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <Button onPress={() => alert('Pressed!')}>\n * {({ isPressed, isHovered }) => (\n * <span class={isPressed ? 'bg-blue-700' : isHovered ? 'bg-blue-600' : 'bg-blue-500'}>\n * Click me\n * </span>\n * )}\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const fileTrigger = useContext(FileTriggerContext);\n const contextProps = useContext(ButtonContext);\n const contextSlotProps = untrack(\n () => contextProps?.slots?.[typeof props.slot === \"string\" ? props.slot : \"default\"],\n );\n const contextBaseProps = createMemo<ButtonProps>(() => {\n if (!contextProps) return {};\n const { slots: _slots, ...rest } = contextProps;\n return rest;\n });\n const mergedProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as ButtonProps;\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"ref\",\n \"slot\",\n \"isPending\",\n \"isPendingFocusable\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onHoverChange\",\n ]);\n const slotValue = useSlotValue(() => (typeof local.slot === \"string\" ? local.slot : undefined), {\n named: true,\n });\n\n // Check if inside a DialogTrigger or PopoverTrigger - if so, toggle on press\n // NOTE: Context is captured at component creation time. For Buttons inside a Modal,\n // the Modal provides OverlayTriggerStateContext, but due to SolidJS's eager JSX evaluation,\n // components inside Modal children are created before the Modal's Show renders.\n // So we can't reliably use context here to determine if we're inside a Modal.\n const dialogTriggerContext = useContext(DialogTriggerContext);\n const popoverTriggerContext = useContext(PopoverTriggerContext);\n\n // Helper to resolve isDisabled (handles both boolean and Accessor<boolean>)\n const menuTriggerProps = () =>\n isPopoverTrigger() && popoverTriggerContext?.trigger === \"MenuTrigger\"\n ? popoverTriggerContext.triggerProps\n : undefined;\n\n const resolveDisabled = (): boolean => {\n const disabled = ariaProps.isDisabled;\n if (typeof disabled === \"function\" ? disabled() : !!disabled) {\n return true;\n }\n const triggerProps = menuTriggerProps();\n return Boolean(triggerProps?.[\"aria-disabled\"] || triggerProps?.isDisabled);\n };\n\n // Owned at setup. Solid compiles a compound `isPending={a() && b()}` prop into\n // a getter that calls `memo()` on every read, so reading it lazily from a native\n // press or hover handler creates that computation with no owner: it warns and is\n // never disposed. A memo pins the read to this component's owner.\n const resolvePending = createMemo((): boolean =>\n fileTrigger\n ? !!(props.isPending ?? contextSlotProps?.isPending ?? contextProps?.isPending)\n : !!local.isPending,\n );\n const isPendingFocusable = () => local.isPendingFocusable !== false;\n\n const [resolvedButtonEl, setResolvedButtonEl] = createSignal<HTMLButtonElement | null>(null, {\n ownedWrite: true,\n });\n const buttonId = createId(\n untrack(() => (ariaProps as Record<string, unknown>).id as string | undefined),\n );\n const progressId = createId();\n\n // Explicit trigger ownership: a button toggles overlays only when it is the\n // registered trigger element for the surrounding trigger context.\n const isDialogTrigger = () =>\n !!dialogTriggerContext &&\n !!resolvedButtonEl() &&\n dialogTriggerContext.triggerRef() === resolvedButtonEl();\n const isPopoverTrigger = () =>\n !!popoverTriggerContext &&\n !!resolvedButtonEl() &&\n popoverTriggerContext.triggerRef() === resolvedButtonEl();\n\n const handlePress = (e: PressEvent) => {\n if (resolvePending()) {\n return;\n }\n if (fileTrigger) {\n // Read original callbacks at activation time. mergeProps event chains\n // capture snapshots; calling that chain too would double delivery.\n contextProps?.onPress?.(e);\n contextSlotProps?.onPress?.(e);\n fileTrigger.open();\n props.onPress?.(e);\n } else if (typeof ariaProps.onPress === \"function\") {\n ariaProps.onPress(e);\n }\n // Toggle only when this exact button is the registered trigger element.\n if (isDialogTrigger() && local.slot !== \"close\") {\n dialogTriggerContext!.state.toggle();\n } else if (isPopoverTrigger() && local.slot !== \"close\") {\n const triggerOnPress = popoverTriggerContext!.triggerProps?.onPress as\n | ((event: PressEvent) => void)\n | undefined;\n if (typeof triggerOnPress === \"function\") {\n triggerOnPress(e);\n } else if (popoverTriggerContext!.trigger !== \"MenuTrigger\") {\n popoverTriggerContext!.state.toggle();\n }\n }\n };\n\n const buttonAria = createButton(\n createForwardedAriaButtonProps(ariaProps, {\n onPress: handlePress,\n get onPressStart() {\n if (resolvePending()) return undefined;\n return (event: PressEvent) => {\n const triggerStart = popoverTriggerContext?.triggerProps?.onPressStart as\n | ((event: PressEvent) => void)\n | undefined;\n triggerStart?.(event);\n ariaProps.onPressStart?.(event);\n };\n },\n get onPressEnd() {\n return resolvePending() ? undefined : ariaProps.onPressEnd;\n },\n get onPressUp() {\n return resolvePending() ? undefined : ariaProps.onPressUp;\n },\n get onPressChange() {\n return resolvePending() ? undefined : ariaProps.onPressChange;\n },\n get onClick() {\n return resolvePending() ? undefined : ariaProps.onClick;\n },\n get preventFocusOnPress() {\n return (menuTriggerProps()?.preventFocusOnPress ?? ariaProps.preventFocusOnPress) as\n | boolean\n | undefined;\n },\n // Mirror React Aria's RAC `Button`: `useButton` is called with the base\n // `isDisabled` WITHOUT `isPending`, so a pending-focusable button stays a\n // non-disabled native `<button>` — keeping `useFocusable`'s always-on\n // `tabindex={0}` (the Safari focus workaround) and no native `disabled`\n // attribute. The pending \"disabled\" semantics are layered ON TOP:\n // `aria-disabled=\"true\"` below and `disablePendingInteractions` stripping\n // the press handlers post-hoc (RAC's `useDisableInteractions`). Folding\n // `isPending` in here instead would make the focusable hook drop\n // `tabIndex`, diverging from upstream's pending button (D4).\n get isDisabled() {\n return resolveDisabled();\n },\n }),\n );\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return resolveDisabled() || resolvePending();\n },\n get onHoverStart() {\n return local.onHoverStart;\n },\n get onHoverEnd() {\n return local.onHoverEnd;\n },\n get onHoverChange() {\n return local.onHoverChange;\n },\n });\n\n const renderValues = createMemo<ButtonRenderProps>(() => ({\n isHovered: isHovered(),\n isPressed: buttonAria.isPressed() && !resolvePending(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isDisabled: resolveDisabled(),\n isPending: resolvePending(),\n }));\n\n const renderProps = useRenderProps(\n {\n // Use merged children so ButtonContext can supply slot/default content.\n get children() {\n return local.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Button\",\n },\n renderValues,\n );\n const slotClass = () => joinSlotClass(renderProps.class(), slotValue().class);\n\n // Remove onClick from DOM props - it's already handled by createPress\n // This matches React Aria Components behavior (Button.tsx line 144: delete DOMProps.onClick)\n const domProps = () => {\n const filtered = filterDOMProps(ariaProps, { global: true }) as Record<string, unknown>;\n // onClick is handled by createPress, not passed directly to DOM\n delete filtered.onClick;\n // Read data-* now so `{...rootProps()}` re-applies when a trigger attr changes.\n for (const key in ariaProps) {\n if (key.startsWith(\"data-\")) {\n filtered[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return filtered;\n };\n\n const buttonPropsRef = untrack(() => (buttonAria.buttonProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const focusPropsRef = untrack(() => (focusProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const hoverPropsRef = untrack(() => (hoverProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n\n const cleanButtonProps = () => {\n const { ref: _ref1, ...rest } = buttonAria.buttonProps as Record<string, unknown>;\n return rest;\n };\n const cleanFocusProps = () => {\n const { ref: _ref2, ...rest } = focusProps as Record<string, unknown>;\n return rest;\n };\n const cleanHoverProps = () => {\n const { ref: _ref3, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n const ariaLabelledBy = createMemo(() => {\n const labelledBy = cleanButtonProps()[\"aria-labelledby\"] as string | undefined;\n if (!resolvePending()) {\n return labelledBy;\n }\n\n if (labelledBy) {\n return `${labelledBy} ${progressId}`;\n }\n\n if (cleanButtonProps()[\"aria-label\"]) {\n return `${buttonId} ${progressId}`;\n }\n\n return labelledBy;\n });\n\n let releaseFileTrigger: (() => void) | undefined;\n onCleanup(() => releaseFileTrigger?.());\n const handleRef = (el: HTMLButtonElement) => {\n releaseFileTrigger?.();\n setResolvedButtonEl(el);\n releaseFileTrigger = fileTrigger?.register(el);\n assignRef(local.ref, el);\n\n buttonPropsRef?.(el);\n focusPropsRef?.(el);\n hoverPropsRef?.(el);\n\n // Register trigger ownership for surrounding trigger contexts.\n // Close buttons live inside the overlay and must not steal trigger identity.\n if (dialogTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n dialogTriggerContext.setTriggerRef(el);\n }\n if (popoverTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n popoverTriggerContext.setTriggerRef(el);\n }\n };\n const buttonType = () =>\n (buttonAria.buttonProps as Record<string, unknown>).type === \"submit\" && resolvePending()\n ? \"button\"\n : ((buttonAria.buttonProps as Record<string, unknown>).type as\n | \"button\"\n | \"submit\"\n | \"reset\"\n | undefined);\n const triggerAriaProps = () => {\n const dialogTriggerProps = dialogTriggerContext?.triggerProps;\n if (dialogTriggerProps && isDialogTrigger()) {\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (dialogTriggerProps[name] != null) {\n next[name] = dialogTriggerProps[name];\n }\n }\n return next;\n }\n\n const triggerProps = popoverTriggerContext?.triggerProps;\n if (!triggerProps || !isPopoverTrigger()) {\n return {};\n }\n\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (triggerProps[name] != null) {\n next[name] = triggerProps[name];\n }\n }\n return next;\n };\n const triggerDomProps = () => {\n const triggerProps = menuTriggerProps();\n if (!triggerProps) {\n return {};\n }\n\n const {\n onPress: _onPress,\n onPressStart: _onPressStart,\n preventFocusOnPress: _preventFocusOnPress,\n \"aria-haspopup\": _ariaHasPopup,\n \"aria-expanded\": _ariaExpanded,\n \"aria-controls\": _ariaControls,\n \"aria-disabled\": _ariaDisabled,\n id: _id,\n ref: _ref,\n onKeyDown: _onKeyDown,\n ...rest\n } = triggerProps;\n return rest;\n };\n const directAriaProps = () => {\n const next: Record<string, unknown> = {};\n for (const name of buttonAriaOverrideProps) {\n next[name] = coerceDomBoolean(name, (ariaProps as Record<string, unknown>)[name]);\n }\n return next;\n };\n const disablePendingInteractions = (props: Record<string, unknown>) => {\n if (!resolvePending()) {\n return props;\n }\n\n const next = { ...props };\n for (const key of Object.keys(next)) {\n // Mirror RAC's `useDisableInteractions`: when pending, strip every event\n // handler except the ones overlays/tooltips still need — focus/blur,\n // hover, and pointer/mouse enter-leave-over-out. Press handlers\n // (click/pointerdown/keydown/…) are removed so the focusable button\n // cannot be activated while pending.\n if (key.startsWith(\"on\") && !pendingPreservedEventPattern.test(key)) {\n next[key] = undefined;\n }\n }\n next.href = undefined;\n next.target = undefined;\n return next;\n };\n const dataState = (value: boolean) => (value ? \"true\" : undefined);\n const buttonChildren = () => renderProps.renderChildren();\n const buttonContent = () => (\n <ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>\n );\n let wasPending = false;\n let pendingAnnounceReady = false;\n createEffect(\n () => {\n const pending = resolvePending();\n const focused = isFocused();\n const labelledBy = ariaLabelledBy() || buttonId;\n return { pending, focused, labelledBy };\n },\n ({ pending, focused, labelledBy }) => {\n if (!pendingAnnounceReady) {\n wasPending = pending;\n pendingAnnounceReady = true;\n return;\n }\n const message = { \"aria-labelledby\": labelledBy };\n if (!wasPending && focused && pending) {\n announce(message, \"assertive\");\n } else if (wasPending && focused && !pending) {\n announce(message, \"assertive\");\n }\n wasPending = pending;\n },\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...triggerDomProps(),\n ...disablePendingInteractions(cleanButtonProps()),\n ...directAriaProps(),\n ...triggerAriaProps(),\n ...cleanFocusProps(),\n ...cleanHoverProps(),\n // RAC pending strips usePress keydown. Keep this wrapper so MenuTrigger\n // still peels onto the host; skip createPress while pending so Enter/Space\n // are not preventDefault'd and the native trusted click can fire.\n onKeyDown: (event: KeyboardEvent) => {\n (menuTriggerProps()?.onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n if (!resolvePending()) {\n (cleanButtonProps().onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n }\n },\n type: buttonType(),\n id:\n ((ariaProps as { id?: string }).id as string | undefined) ||\n (menuTriggerProps()?.id as string | undefined) ||\n (dialogTriggerContext && local.slot !== \"close\"\n ? dialogTriggerContext.triggerId\n : undefined) ||\n (popoverTriggerContext && local.slot !== \"close\"\n ? popoverTriggerContext.triggerId\n : undefined) ||\n buttonId,\n class: slotClass(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-rsp-slot\": slotValue()[\"data-rsp-slot\"],\n // Pending opts out of native focus only when explicitly requested. Keep\n // base disability authoritative without changing useFocusable's policy.\n disabled: resolvePending() && !isPendingFocusable() ? true : cleanButtonProps().disabled,\n \"aria-labelledby\": ariaLabelledBy(),\n \"aria-disabled\": resolvePending()\n ? \"true\"\n : (cleanButtonProps()[\"aria-disabled\"] ?? ariaProps[\"aria-disabled\"]),\n \"data-pressed\": dataState(buttonAria.isPressed() && !resolvePending()),\n \"data-hovered\": dataState(isHovered()),\n \"data-focused\": dataState(isFocused()),\n \"data-focus-visible\": dataState(isFocusVisible()),\n \"data-disabled\": dataState(resolveDisabled()),\n \"data-pending\": dataState(resolvePending()),\n }) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n const customRenderValues = createLiveButtonRenderProps(renderValues);\n const customRender = createMemo(() => local.render);\n\n return (\n <>\n {customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,+BACJ;AAIF,SAAS,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,4BAA4B,QAAoD;CACvF,OAAO;EACL,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,iBAAiB;GACnB,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,aAAa;GACf,OAAO,OAA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GACV,CAAA,CAAA;GAFR,mBAEQ;GAFR,OAAA;EAEQ,EAAA,CAAA;CACT,CAAA;AAGP"}
1
+ {"version":3,"file":"Button.js","names":["<ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>","value={{ id: progressId }}","{customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}","ref={handleRef}","{buttonContent()}","assignRef","mergeProps","_$createComponent","_$memo","_$getNextElement","_$scope"],"sources":["../src/Button.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Button.tsx\n\n/**\n * Button component for solidaria-components\n *\n * A pre-wired headless button that combines state + aria hooks.\n * Port of react-aria-components/src/Button.tsx\n */\n\nimport {\n createContext,\n createEffect,\n createMemo,\n onCleanup,\n createSignal,\n untrack,\n useContext,\n} from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n announce,\n createButton,\n createFocusRing,\n createHover,\n createId,\n mergeProps,\n type AriaButtonProps,\n type HoverEvent,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n coerceDomBoolean,\n} from \"./utils\";\nimport { DialogTriggerContext, PopoverTriggerContext } from \"./contexts\";\nimport { FileTriggerContext } from \"./fileTriggerContext\";\nimport { ProgressBarContext } from \"./ProgressBar\";\nimport { joinSlotClass, useSlotValue } from \"./slots\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\n// Events preserved when `isPending` is true (for tooltips and other overlays),\n// mirroring RAC Button's `PRESERVED_EVENT_PATTERN`. Every other `on*` handler\n// is stripped so a pending-but-focusable button cannot be activated.\nconst pendingPreservedEventPattern =\n /Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction createLiveButtonRenderProps(values: () => ButtonRenderProps): ButtonRenderProps {\n return {\n get isHovered() {\n return values().isHovered;\n },\n get isPressed() {\n return values().isPressed;\n },\n get isFocused() {\n return values().isFocused;\n },\n get isFocusVisible() {\n return values().isFocusVisible;\n },\n get isDisabled() {\n return values().isDisabled;\n },\n get isPending() {\n return values().isPending;\n },\n };\n}\n\nfunction createLiveCustomRootProps(\n getProps: () => JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n getChildren: () => JSX.Element,\n ref: (el: HTMLButtonElement) => void,\n): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const props = {} as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n // Snapshot keys once. Reading getProps() in the component body is\n // STRICT_READ_UNTRACKED; getters re-read live values on later access.\n const keys = new Set([...Object.keys(untrack(getProps)), \"children\", \"ref\"]);\n\n for (const key of keys) {\n Object.defineProperty(props, key, {\n enumerable: true,\n configurable: true,\n get() {\n if (key === \"children\") {\n return getChildren();\n }\n if (key === \"ref\") {\n return ref;\n }\n return (getProps() as Record<string, unknown>)[key];\n },\n });\n }\n\n return props;\n}\n\nconst buttonAriaOverrideProps = [\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"aria-details\",\n \"aria-haspopup\",\n \"aria-expanded\",\n \"aria-controls\",\n \"aria-pressed\",\n \"aria-current\",\n \"aria-disabled\",\n] as const;\n\nfunction createForwardedAriaButtonProps(\n source: AriaButtonProps,\n overrides: AriaButtonProps,\n): AriaButtonProps {\n const result = {} as AriaButtonProps;\n\n // Enumerating an omit/merge proxy can read reactive leaves (descriptor\n // value snapshots). Snapshot keys once, untracked; getters re-read live.\n const sourceKeys = untrack(() => Object.keys(source as Record<string, unknown>));\n for (const key of sourceKeys) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get() {\n return (source as Record<string, unknown>)[key];\n },\n });\n }\n\n for (const key in overrides) {\n const descriptor = Object.getOwnPropertyDescriptor(overrides, key);\n if (!descriptor) continue;\n Object.defineProperty(result, key, { ...descriptor, enumerable: true, configurable: true });\n }\n\n return result;\n}\n\nexport interface ButtonRenderProps {\n /** Whether the button is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the button is currently in a pressed state. */\n isPressed: boolean;\n /** Whether the button is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the button is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the button is disabled. */\n isDisabled: boolean;\n /** Whether the button is currently in a pending state. */\n isPending: boolean;\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<ButtonRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<ButtonRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<ButtonRenderProps>;\n /** Custom renderer for the outer button element. */\n render?: (\n props: JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n renderProps: ButtonRenderProps,\n ) => JSX.Element;\n /** Ref for the underlying button element. */\n ref?: RefLike<HTMLButtonElement>;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Keeps pending buttons focusable by using aria-disabled without a native disabled attribute. */\n isPendingFocusable?: boolean;\n /** Handler called when hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when hover state changes. */\n onHoverChange?: (isHovered: boolean) => void;\n}\n\nexport interface ButtonContextValue extends ButtonProps {\n slots?: Record<string, ButtonProps>;\n}\n\nexport const ButtonContext = createContext<ButtonContextValue | null>(null);\n\n/**\n * A button allows a user to perform an action.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <Button onPress={() => alert('Pressed!')}>\n * {({ isPressed, isHovered }) => (\n * <span class={isPressed ? 'bg-blue-700' : isHovered ? 'bg-blue-600' : 'bg-blue-500'}>\n * Click me\n * </span>\n * )}\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const fileTrigger = useContext(FileTriggerContext);\n const contextProps = useContext(ButtonContext);\n const contextSlotProps = untrack(\n () => contextProps?.slots?.[typeof props.slot === \"string\" ? props.slot : \"default\"],\n );\n const contextBaseProps = createMemo<ButtonProps>(() => {\n if (!contextProps) return {};\n const { slots: _slots, ...rest } = contextProps;\n return rest;\n });\n const mergedProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as ButtonProps;\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"ref\",\n \"slot\",\n \"isPending\",\n \"isPendingFocusable\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onHoverChange\",\n ]);\n const slotValue = useSlotValue(() => (typeof local.slot === \"string\" ? local.slot : undefined), {\n named: true,\n });\n\n // Check if inside a DialogTrigger or PopoverTrigger - if so, toggle on press\n // NOTE: Context is captured at component creation time. For Buttons inside a Modal,\n // the Modal provides OverlayTriggerStateContext, but due to SolidJS's eager JSX evaluation,\n // components inside Modal children are created before the Modal's Show renders.\n // So we can't reliably use context here to determine if we're inside a Modal.\n const dialogTriggerContext = useContext(DialogTriggerContext);\n const popoverTriggerContext = useContext(PopoverTriggerContext);\n\n // Helper to resolve isDisabled (handles both boolean and Accessor<boolean>)\n const menuTriggerProps = () =>\n isPopoverTrigger() && popoverTriggerContext?.trigger === \"MenuTrigger\"\n ? popoverTriggerContext.triggerProps\n : undefined;\n\n const resolveDisabled = (): boolean => {\n const disabled = ariaProps.isDisabled;\n if (typeof disabled === \"function\" ? disabled() : !!disabled) {\n return true;\n }\n const triggerProps = menuTriggerProps();\n return Boolean(triggerProps?.[\"aria-disabled\"] || triggerProps?.isDisabled);\n };\n\n // Owned at setup. Solid compiles a compound `isPending={a() && b()}` prop into\n // a getter that calls `memo()` on every read, so reading it lazily from a native\n // press or hover handler creates that computation with no owner: it warns and is\n // never disposed. A memo pins the read to this component's owner.\n const resolvePending = createMemo((): boolean =>\n fileTrigger\n ? !!(props.isPending ?? contextSlotProps?.isPending ?? contextProps?.isPending)\n : !!local.isPending,\n );\n const isPendingFocusable = () => local.isPendingFocusable !== false;\n\n const [resolvedButtonEl, setResolvedButtonEl] = createSignal<HTMLButtonElement | null>(null, {\n ownedWrite: true,\n });\n const buttonId = createId(\n untrack(() => (ariaProps as Record<string, unknown>).id as string | undefined),\n );\n const progressId = createId();\n\n // Explicit trigger ownership: a button toggles overlays only when it is the\n // registered trigger element for the surrounding trigger context.\n const isDialogTrigger = () =>\n !!dialogTriggerContext &&\n !!resolvedButtonEl() &&\n dialogTriggerContext.triggerRef() === resolvedButtonEl();\n const isPopoverTrigger = () =>\n !!popoverTriggerContext &&\n !!resolvedButtonEl() &&\n popoverTriggerContext.triggerRef() === resolvedButtonEl();\n\n const handlePress = (e: PressEvent) => {\n if (resolvePending()) {\n return;\n }\n if (fileTrigger) {\n // Read original callbacks at activation time. mergeProps event chains\n // capture snapshots; calling that chain too would double delivery.\n contextProps?.onPress?.(e);\n contextSlotProps?.onPress?.(e);\n fileTrigger.open();\n props.onPress?.(e);\n } else if (typeof ariaProps.onPress === \"function\") {\n ariaProps.onPress(e);\n }\n // Toggle only when this exact button is the registered trigger element.\n if (isDialogTrigger() && local.slot !== \"close\") {\n dialogTriggerContext!.state.toggle();\n } else if (isPopoverTrigger() && local.slot !== \"close\") {\n const triggerOnPress = popoverTriggerContext!.triggerProps?.onPress as\n | ((event: PressEvent) => void)\n | undefined;\n if (typeof triggerOnPress === \"function\") {\n triggerOnPress(e);\n } else if (popoverTriggerContext!.trigger !== \"MenuTrigger\") {\n popoverTriggerContext!.state.toggle();\n }\n }\n };\n\n const buttonAria = createButton(\n createForwardedAriaButtonProps(ariaProps, {\n onPress: handlePress,\n get onPressStart() {\n if (resolvePending()) return undefined;\n return (event: PressEvent) => {\n const triggerStart = popoverTriggerContext?.triggerProps?.onPressStart as\n | ((event: PressEvent) => void)\n | undefined;\n triggerStart?.(event);\n ariaProps.onPressStart?.(event);\n };\n },\n get onPressEnd() {\n return resolvePending() ? undefined : ariaProps.onPressEnd;\n },\n get onPressUp() {\n return resolvePending() ? undefined : ariaProps.onPressUp;\n },\n get onPressChange() {\n return resolvePending() ? undefined : ariaProps.onPressChange;\n },\n get onClick() {\n return resolvePending() ? undefined : ariaProps.onClick;\n },\n get preventFocusOnPress() {\n return (menuTriggerProps()?.preventFocusOnPress ?? ariaProps.preventFocusOnPress) as\n | boolean\n | undefined;\n },\n // Mirror React Aria's RAC `Button`: `useButton` is called with the base\n // `isDisabled` WITHOUT `isPending`, so a pending-focusable button stays a\n // non-disabled native `<button>` — keeping `useFocusable`'s always-on\n // `tabindex={0}` (the Safari focus workaround) and no native `disabled`\n // attribute. The pending \"disabled\" semantics are layered ON TOP:\n // `aria-disabled=\"true\"` below and `disablePendingInteractions` stripping\n // the press handlers post-hoc (RAC's `useDisableInteractions`). Folding\n // `isPending` in here instead would make the focusable hook drop\n // `tabIndex`, diverging from upstream's pending button (D4).\n get isDisabled() {\n return resolveDisabled();\n },\n }),\n );\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return resolveDisabled() || resolvePending();\n },\n get onHoverStart() {\n return local.onHoverStart;\n },\n get onHoverEnd() {\n return local.onHoverEnd;\n },\n get onHoverChange() {\n return local.onHoverChange;\n },\n });\n\n const renderValues = createMemo<ButtonRenderProps>(() => ({\n isHovered: isHovered(),\n isPressed: buttonAria.isPressed() && !resolvePending(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isDisabled: resolveDisabled(),\n isPending: resolvePending(),\n }));\n\n const renderProps = useRenderProps(\n {\n // Use merged children so ButtonContext can supply slot/default content.\n get children() {\n return local.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Button\",\n },\n renderValues,\n );\n const slotClass = () => joinSlotClass(renderProps.class(), slotValue().class);\n\n // Remove onClick from DOM props - it's already handled by createPress\n // This matches React Aria Components behavior (Button.tsx line 144: delete DOMProps.onClick)\n const domProps = () => {\n const filtered = filterDOMProps(ariaProps, { global: true }) as Record<string, unknown>;\n // onClick is handled by createPress, not passed directly to DOM\n delete filtered.onClick;\n // Read data-* now so `{...rootProps()}` re-applies when a trigger attr changes.\n for (const key in ariaProps) {\n if (key.startsWith(\"data-\")) {\n filtered[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return filtered;\n };\n\n const buttonPropsRef = untrack(() => (buttonAria.buttonProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const focusPropsRef = untrack(() => (focusProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const hoverPropsRef = untrack(() => (hoverProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n\n const cleanButtonProps = () => {\n const { ref: _ref1, ...rest } = buttonAria.buttonProps as Record<string, unknown>;\n return rest;\n };\n const cleanFocusProps = () => {\n const { ref: _ref2, ...rest } = focusProps as Record<string, unknown>;\n return rest;\n };\n const cleanHoverProps = () => {\n const { ref: _ref3, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n const ariaLabelledBy = createMemo(() => {\n const labelledBy = cleanButtonProps()[\"aria-labelledby\"] as string | undefined;\n if (!resolvePending()) {\n return labelledBy;\n }\n\n if (labelledBy) {\n return `${labelledBy} ${progressId}`;\n }\n\n if (cleanButtonProps()[\"aria-label\"]) {\n return `${buttonId} ${progressId}`;\n }\n\n return labelledBy;\n });\n\n let releaseFileTrigger: (() => void) | undefined;\n onCleanup(() => releaseFileTrigger?.());\n const handleRef = (el: HTMLButtonElement) => {\n releaseFileTrigger?.();\n setResolvedButtonEl(el);\n releaseFileTrigger = fileTrigger?.register(el);\n assignRef(local.ref, el);\n\n buttonPropsRef?.(el);\n focusPropsRef?.(el);\n hoverPropsRef?.(el);\n\n // Register trigger ownership for surrounding trigger contexts.\n // Close buttons live inside the overlay and must not steal trigger identity.\n if (dialogTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n dialogTriggerContext.setTriggerRef(el);\n }\n if (popoverTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n popoverTriggerContext.setTriggerRef(el);\n }\n };\n const buttonType = () =>\n (buttonAria.buttonProps as Record<string, unknown>).type === \"submit\" && resolvePending()\n ? \"button\"\n : ((buttonAria.buttonProps as Record<string, unknown>).type as\n | \"button\"\n | \"submit\"\n | \"reset\"\n | undefined);\n const triggerAriaProps = () => {\n const dialogTriggerProps = dialogTriggerContext?.triggerProps;\n if (dialogTriggerProps && isDialogTrigger()) {\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (dialogTriggerProps[name] != null) {\n next[name] = dialogTriggerProps[name];\n }\n }\n return next;\n }\n\n const triggerProps = popoverTriggerContext?.triggerProps;\n if (!triggerProps || !isPopoverTrigger()) {\n return {};\n }\n\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (triggerProps[name] != null) {\n next[name] = triggerProps[name];\n }\n }\n return next;\n };\n const triggerDomProps = () => {\n const triggerProps = menuTriggerProps();\n if (!triggerProps) {\n return {};\n }\n\n const {\n onPress: _onPress,\n onPressStart: _onPressStart,\n preventFocusOnPress: _preventFocusOnPress,\n \"aria-haspopup\": _ariaHasPopup,\n \"aria-expanded\": _ariaExpanded,\n \"aria-controls\": _ariaControls,\n \"aria-disabled\": _ariaDisabled,\n id: _id,\n ref: _ref,\n onKeyDown: _onKeyDown,\n ...rest\n } = triggerProps;\n return rest;\n };\n const directAriaProps = () => {\n const next: Record<string, unknown> = {};\n for (const name of buttonAriaOverrideProps) {\n next[name] = coerceDomBoolean(name, (ariaProps as Record<string, unknown>)[name]);\n }\n return next;\n };\n const disablePendingInteractions = (props: Record<string, unknown>) => {\n if (!resolvePending()) {\n return props;\n }\n\n const next = { ...props };\n for (const key of Object.keys(next)) {\n // Mirror RAC's `useDisableInteractions`: when pending, strip every event\n // handler except the ones overlays/tooltips still need — focus/blur,\n // hover, and pointer/mouse enter-leave-over-out. Press handlers\n // (click/pointerdown/keydown/…) are removed so the focusable button\n // cannot be activated while pending.\n if (key.startsWith(\"on\") && !pendingPreservedEventPattern.test(key)) {\n next[key] = undefined;\n }\n }\n next.href = undefined;\n next.target = undefined;\n return next;\n };\n const dataState = (value: boolean) => (value ? \"true\" : undefined);\n const buttonChildren = () => renderProps.renderChildren();\n const buttonContent = () => (\n <ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>\n );\n let wasPending = false;\n let pendingAnnounceReady = false;\n createEffect(\n () => {\n const pending = resolvePending();\n const focused = isFocused();\n const labelledBy = ariaLabelledBy() || buttonId;\n return { pending, focused, labelledBy };\n },\n ({ pending, focused, labelledBy }) => {\n if (!pendingAnnounceReady) {\n wasPending = pending;\n pendingAnnounceReady = true;\n return;\n }\n const message = { \"aria-labelledby\": labelledBy };\n if (!wasPending && focused && pending) {\n announce(message, \"assertive\");\n } else if (wasPending && focused && !pending) {\n announce(message, \"assertive\");\n }\n wasPending = pending;\n },\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...triggerDomProps(),\n ...disablePendingInteractions(cleanButtonProps()),\n ...directAriaProps(),\n ...triggerAriaProps(),\n ...cleanFocusProps(),\n ...cleanHoverProps(),\n // RAC pending strips usePress keydown. Keep this wrapper so MenuTrigger\n // still peels onto the host; skip createPress while pending so Enter/Space\n // are not preventDefault'd and the native trusted click can fire.\n onKeyDown: (event: KeyboardEvent) => {\n (menuTriggerProps()?.onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n if (!resolvePending()) {\n (cleanButtonProps().onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n }\n },\n type: buttonType(),\n id:\n ((ariaProps as { id?: string }).id as string | undefined) ||\n (menuTriggerProps()?.id as string | undefined) ||\n (dialogTriggerContext && local.slot !== \"close\"\n ? dialogTriggerContext.triggerId\n : undefined) ||\n (popoverTriggerContext && local.slot !== \"close\"\n ? popoverTriggerContext.triggerId\n : undefined) ||\n buttonId,\n class: slotClass(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-rsp-slot\": slotValue()[\"data-rsp-slot\"],\n // Pending opts out of native focus only when explicitly requested. Keep\n // base disability authoritative without changing useFocusable's policy.\n disabled: resolvePending() && !isPendingFocusable() ? true : cleanButtonProps().disabled,\n \"aria-labelledby\": ariaLabelledBy(),\n \"aria-disabled\": resolvePending()\n ? \"true\"\n : (cleanButtonProps()[\"aria-disabled\"] ?? ariaProps[\"aria-disabled\"]),\n \"data-pressed\": dataState(buttonAria.isPressed() && !resolvePending()),\n \"data-hovered\": dataState(isHovered()),\n \"data-focused\": dataState(isFocused()),\n \"data-focus-visible\": dataState(isFocusVisible()),\n \"data-disabled\": dataState(resolveDisabled()),\n \"data-pending\": dataState(resolvePending()),\n }) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n const customRenderValues = createLiveButtonRenderProps(renderValues);\n const customRender = createMemo(() => local.render);\n\n return (\n <>\n {customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,+BACJ;AAIF,SAASK,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,4BAA4B,QAAoD;CACvF,OAAO;EACL,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,iBAAiB;GACnB,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,aAAa;GACf,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;CACF;AACF;AAEA,SAAS,0BACP,UACA,aACA,KAC6C;CAC7C,MAAM,QAAQ,CAAC;CAGf,MAAM,uBAAO,IAAI,IAAI;EAAC,GAAG,OAAO,KAAK,QAAQ,QAAQ,CAAC;EAAG;EAAY;CAAK,CAAC;CAE3E,KAAK,MAAM,OAAO,MAChB,OAAO,eAAe,OAAO,KAAK;EAChC,YAAY;EACZ,cAAc;EACd,MAAM;GACJ,IAAI,QAAQ,YACV,OAAO,YAAY;GAErB,IAAI,QAAQ,OACV,OAAO;GAET,OAAQ,SAAS,CAAA,CAA8B;EACjD;CACF,CAAC;CAGH,OAAO;AACT;AAEA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,+BACP,QACA,WACiB;CACjB,MAAM,SAAS,CAAC;CAIhB,MAAM,aAAa,cAAc,OAAO,KAAK,MAAiC,CAAC;CAC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gB,UAAU,UAAU,CAAC;EACrC,sBAAsB,UAAU,eAAe,CAAC;EAChD,iBAAiB,UAAU,gBAAgB,CAAC;EAC5C,gBAAgB,UAAU,eAAe,CAAC;CAC5C;CACF,MAAM,qBAAqB,4BAA4B,YAAY;CACnE,MAAM,eAAe,iBAAiB,MAAM,MAAM;CAElD,OAEIC,WAAAA;;GAAC,OAAA,CAAA,CAAA,aAAa;EASb,CAAA,CAAC,CAAD,IARC,aAAa,CAAC,CACZ,0BAA0B,WAAW,eAAe,SAAS,GAC7D,kBACF,WAEA;GAEQ,IAAA,OAAAO,eAAA,MAAA;GAFA,UAAA;IAAK,OAAA;GAAS,GAAdN,IAAc;GAAM,OAAA,MAAA,CAAA,WAAA;IAAa,IAAA,UAAA;KAAO,OAAA,UAAU;IAAC;IAAE,IAAA,QAAA;KAAO,OAAA,YAAY,MAAM;IAAC;;GAAvF,OAAA,MACEC,YAAAA;IAAC,OAAA,cAAe;GACV,CAAA,CAAA;GAFR,mBAEQ;GAFR,OAAA;EAEQ,EAAA,CAAA;CACT,CAAA;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.jsx","names":["assignRef"],"sources":["../src/Button.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Button.tsx\n\n/**\n * Button component for solidaria-components\n *\n * A pre-wired headless button that combines state + aria hooks.\n * Port of react-aria-components/src/Button.tsx\n */\n\nimport {\n createContext,\n createEffect,\n createMemo,\n onCleanup,\n createSignal,\n untrack,\n useContext,\n} from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n announce,\n createButton,\n createFocusRing,\n createHover,\n createId,\n mergeProps,\n type AriaButtonProps,\n type HoverEvent,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n coerceDomBoolean,\n} from \"./utils\";\nimport { DialogTriggerContext, PopoverTriggerContext } from \"./contexts\";\nimport { FileTriggerContext } from \"./fileTriggerContext\";\nimport { ProgressBarContext } from \"./ProgressBar\";\nimport { joinSlotClass, useSlotValue } from \"./slots\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\n// Events preserved when `isPending` is true (for tooltips and other overlays),\n// mirroring RAC Button's `PRESERVED_EVENT_PATTERN`. Every other `on*` handler\n// is stripped so a pending-but-focusable button cannot be activated.\nconst pendingPreservedEventPattern =\n /Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction createLiveButtonRenderProps(values: () => ButtonRenderProps): ButtonRenderProps {\n return {\n get isHovered() {\n return values().isHovered;\n },\n get isPressed() {\n return values().isPressed;\n },\n get isFocused() {\n return values().isFocused;\n },\n get isFocusVisible() {\n return values().isFocusVisible;\n },\n get isDisabled() {\n return values().isDisabled;\n },\n get isPending() {\n return values().isPending;\n },\n };\n}\n\nfunction createLiveCustomRootProps(\n getProps: () => JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n getChildren: () => JSX.Element,\n ref: (el: HTMLButtonElement) => void,\n): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const props = {} as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n // Snapshot keys once. Reading getProps() in the component body is\n // STRICT_READ_UNTRACKED; getters re-read live values on later access.\n const keys = new Set([...Object.keys(untrack(getProps)), \"children\", \"ref\"]);\n\n for (const key of keys) {\n Object.defineProperty(props, key, {\n enumerable: true,\n configurable: true,\n get() {\n if (key === \"children\") {\n return getChildren();\n }\n if (key === \"ref\") {\n return ref;\n }\n return (getProps() as Record<string, unknown>)[key];\n },\n });\n }\n\n return props;\n}\n\nconst buttonAriaOverrideProps = [\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"aria-details\",\n \"aria-haspopup\",\n \"aria-expanded\",\n \"aria-controls\",\n \"aria-pressed\",\n \"aria-current\",\n \"aria-disabled\",\n] as const;\n\nfunction createForwardedAriaButtonProps(\n source: AriaButtonProps,\n overrides: AriaButtonProps,\n): AriaButtonProps {\n const result = {} as AriaButtonProps;\n\n // Enumerating an omit/merge proxy can read reactive leaves (descriptor\n // value snapshots). Snapshot keys once, untracked; getters re-read live.\n const sourceKeys = untrack(() => Object.keys(source as Record<string, unknown>));\n for (const key of sourceKeys) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get() {\n return (source as Record<string, unknown>)[key];\n },\n });\n }\n\n for (const key in overrides) {\n const descriptor = Object.getOwnPropertyDescriptor(overrides, key);\n if (!descriptor) continue;\n Object.defineProperty(result, key, { ...descriptor, enumerable: true, configurable: true });\n }\n\n return result;\n}\n\nexport interface ButtonRenderProps {\n /** Whether the button is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the button is currently in a pressed state. */\n isPressed: boolean;\n /** Whether the button is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the button is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the button is disabled. */\n isDisabled: boolean;\n /** Whether the button is currently in a pending state. */\n isPending: boolean;\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<ButtonRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<ButtonRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<ButtonRenderProps>;\n /** Custom renderer for the outer button element. */\n render?: (\n props: JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n renderProps: ButtonRenderProps,\n ) => JSX.Element;\n /** Ref for the underlying button element. */\n ref?: RefLike<HTMLButtonElement>;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Keeps pending buttons focusable by using aria-disabled without a native disabled attribute. */\n isPendingFocusable?: boolean;\n /** Handler called when hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when hover state changes. */\n onHoverChange?: (isHovered: boolean) => void;\n}\n\nexport interface ButtonContextValue extends ButtonProps {\n slots?: Record<string, ButtonProps>;\n}\n\nexport const ButtonContext = createContext<ButtonContextValue | null>(null);\n\n/**\n * A button allows a user to perform an action.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <Button onPress={() => alert('Pressed!')}>\n * {({ isPressed, isHovered }) => (\n * <span class={isPressed ? 'bg-blue-700' : isHovered ? 'bg-blue-600' : 'bg-blue-500'}>\n * Click me\n * </span>\n * )}\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const fileTrigger = useContext(FileTriggerContext);\n const contextProps = useContext(ButtonContext);\n const contextSlotProps = untrack(\n () => contextProps?.slots?.[typeof props.slot === \"string\" ? props.slot : \"default\"],\n );\n const contextBaseProps = createMemo<ButtonProps>(() => {\n if (!contextProps) return {};\n const { slots: _slots, ...rest } = contextProps;\n return rest;\n });\n const mergedProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as ButtonProps;\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"ref\",\n \"slot\",\n \"isPending\",\n \"isPendingFocusable\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onHoverChange\",\n ]);\n const slotValue = useSlotValue(() => (typeof local.slot === \"string\" ? local.slot : undefined), {\n named: true,\n });\n\n // Check if inside a DialogTrigger or PopoverTrigger - if so, toggle on press\n // NOTE: Context is captured at component creation time. For Buttons inside a Modal,\n // the Modal provides OverlayTriggerStateContext, but due to SolidJS's eager JSX evaluation,\n // components inside Modal children are created before the Modal's Show renders.\n // So we can't reliably use context here to determine if we're inside a Modal.\n const dialogTriggerContext = useContext(DialogTriggerContext);\n const popoverTriggerContext = useContext(PopoverTriggerContext);\n\n // Helper to resolve isDisabled (handles both boolean and Accessor<boolean>)\n const menuTriggerProps = () =>\n isPopoverTrigger() && popoverTriggerContext?.trigger === \"MenuTrigger\"\n ? popoverTriggerContext.triggerProps\n : undefined;\n\n const resolveDisabled = (): boolean => {\n const disabled = ariaProps.isDisabled;\n if (typeof disabled === \"function\" ? disabled() : !!disabled) {\n return true;\n }\n const triggerProps = menuTriggerProps();\n return Boolean(triggerProps?.[\"aria-disabled\"] || triggerProps?.isDisabled);\n };\n\n // Owned at setup. Solid compiles a compound `isPending={a() && b()}` prop into\n // a getter that calls `memo()` on every read, so reading it lazily from a native\n // press or hover handler creates that computation with no owner: it warns and is\n // never disposed. A memo pins the read to this component's owner.\n const resolvePending = createMemo((): boolean =>\n fileTrigger\n ? !!(props.isPending ?? contextSlotProps?.isPending ?? contextProps?.isPending)\n : !!local.isPending,\n );\n const isPendingFocusable = () => local.isPendingFocusable !== false;\n\n const [resolvedButtonEl, setResolvedButtonEl] = createSignal<HTMLButtonElement | null>(null, {\n ownedWrite: true,\n });\n const buttonId = createId(\n untrack(() => (ariaProps as Record<string, unknown>).id as string | undefined),\n );\n const progressId = createId();\n\n // Explicit trigger ownership: a button toggles overlays only when it is the\n // registered trigger element for the surrounding trigger context.\n const isDialogTrigger = () =>\n !!dialogTriggerContext &&\n !!resolvedButtonEl() &&\n dialogTriggerContext.triggerRef() === resolvedButtonEl();\n const isPopoverTrigger = () =>\n !!popoverTriggerContext &&\n !!resolvedButtonEl() &&\n popoverTriggerContext.triggerRef() === resolvedButtonEl();\n\n const handlePress = (e: PressEvent) => {\n if (resolvePending()) {\n return;\n }\n if (fileTrigger) {\n // Read original callbacks at activation time. mergeProps event chains\n // capture snapshots; calling that chain too would double delivery.\n contextProps?.onPress?.(e);\n contextSlotProps?.onPress?.(e);\n fileTrigger.open();\n props.onPress?.(e);\n } else if (typeof ariaProps.onPress === \"function\") {\n ariaProps.onPress(e);\n }\n // Toggle only when this exact button is the registered trigger element.\n if (isDialogTrigger() && local.slot !== \"close\") {\n dialogTriggerContext!.state.toggle();\n } else if (isPopoverTrigger() && local.slot !== \"close\") {\n const triggerOnPress = popoverTriggerContext!.triggerProps?.onPress as\n | ((event: PressEvent) => void)\n | undefined;\n if (typeof triggerOnPress === \"function\") {\n triggerOnPress(e);\n } else if (popoverTriggerContext!.trigger !== \"MenuTrigger\") {\n popoverTriggerContext!.state.toggle();\n }\n }\n };\n\n const buttonAria = createButton(\n createForwardedAriaButtonProps(ariaProps, {\n onPress: handlePress,\n get onPressStart() {\n if (resolvePending()) return undefined;\n return (event: PressEvent) => {\n const triggerStart = popoverTriggerContext?.triggerProps?.onPressStart as\n | ((event: PressEvent) => void)\n | undefined;\n triggerStart?.(event);\n ariaProps.onPressStart?.(event);\n };\n },\n get onPressEnd() {\n return resolvePending() ? undefined : ariaProps.onPressEnd;\n },\n get onPressUp() {\n return resolvePending() ? undefined : ariaProps.onPressUp;\n },\n get onPressChange() {\n return resolvePending() ? undefined : ariaProps.onPressChange;\n },\n get onClick() {\n return resolvePending() ? undefined : ariaProps.onClick;\n },\n get preventFocusOnPress() {\n return (menuTriggerProps()?.preventFocusOnPress ?? ariaProps.preventFocusOnPress) as\n | boolean\n | undefined;\n },\n // Mirror React Aria's RAC `Button`: `useButton` is called with the base\n // `isDisabled` WITHOUT `isPending`, so a pending-focusable button stays a\n // non-disabled native `<button>` — keeping `useFocusable`'s always-on\n // `tabindex={0}` (the Safari focus workaround) and no native `disabled`\n // attribute. The pending \"disabled\" semantics are layered ON TOP:\n // `aria-disabled=\"true\"` below and `disablePendingInteractions` stripping\n // the press handlers post-hoc (RAC's `useDisableInteractions`). Folding\n // `isPending` in here instead would make the focusable hook drop\n // `tabIndex`, diverging from upstream's pending button (D4).\n get isDisabled() {\n return resolveDisabled();\n },\n }),\n );\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return resolveDisabled() || resolvePending();\n },\n get onHoverStart() {\n return local.onHoverStart;\n },\n get onHoverEnd() {\n return local.onHoverEnd;\n },\n get onHoverChange() {\n return local.onHoverChange;\n },\n });\n\n const renderValues = createMemo<ButtonRenderProps>(() => ({\n isHovered: isHovered(),\n isPressed: buttonAria.isPressed() && !resolvePending(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isDisabled: resolveDisabled(),\n isPending: resolvePending(),\n }));\n\n const renderProps = useRenderProps(\n {\n // Use merged children so ButtonContext can supply slot/default content.\n get children() {\n return local.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Button\",\n },\n renderValues,\n );\n const slotClass = () => joinSlotClass(renderProps.class(), slotValue().class);\n\n // Remove onClick from DOM props - it's already handled by createPress\n // This matches React Aria Components behavior (Button.tsx line 144: delete DOMProps.onClick)\n const domProps = () => {\n const filtered = filterDOMProps(ariaProps, { global: true }) as Record<string, unknown>;\n // onClick is handled by createPress, not passed directly to DOM\n delete filtered.onClick;\n // Read data-* now so `{...rootProps()}` re-applies when a trigger attr changes.\n for (const key in ariaProps) {\n if (key.startsWith(\"data-\")) {\n filtered[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return filtered;\n };\n\n const buttonPropsRef = untrack(() => (buttonAria.buttonProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const focusPropsRef = untrack(() => (focusProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const hoverPropsRef = untrack(() => (hoverProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n\n const cleanButtonProps = () => {\n const { ref: _ref1, ...rest } = buttonAria.buttonProps as Record<string, unknown>;\n return rest;\n };\n const cleanFocusProps = () => {\n const { ref: _ref2, ...rest } = focusProps as Record<string, unknown>;\n return rest;\n };\n const cleanHoverProps = () => {\n const { ref: _ref3, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n const ariaLabelledBy = createMemo(() => {\n const labelledBy = cleanButtonProps()[\"aria-labelledby\"] as string | undefined;\n if (!resolvePending()) {\n return labelledBy;\n }\n\n if (labelledBy) {\n return `${labelledBy} ${progressId}`;\n }\n\n if (cleanButtonProps()[\"aria-label\"]) {\n return `${buttonId} ${progressId}`;\n }\n\n return labelledBy;\n });\n\n let releaseFileTrigger: (() => void) | undefined;\n onCleanup(() => releaseFileTrigger?.());\n const handleRef = (el: HTMLButtonElement) => {\n releaseFileTrigger?.();\n setResolvedButtonEl(el);\n releaseFileTrigger = fileTrigger?.register(el);\n assignRef(local.ref, el);\n\n buttonPropsRef?.(el);\n focusPropsRef?.(el);\n hoverPropsRef?.(el);\n\n // Register trigger ownership for surrounding trigger contexts.\n // Close buttons live inside the overlay and must not steal trigger identity.\n if (dialogTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n dialogTriggerContext.setTriggerRef(el);\n }\n if (popoverTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n popoverTriggerContext.setTriggerRef(el);\n }\n };\n const buttonType = () =>\n (buttonAria.buttonProps as Record<string, unknown>).type === \"submit\" && resolvePending()\n ? \"button\"\n : ((buttonAria.buttonProps as Record<string, unknown>).type as\n | \"button\"\n | \"submit\"\n | \"reset\"\n | undefined);\n const triggerAriaProps = () => {\n const dialogTriggerProps = dialogTriggerContext?.triggerProps;\n if (dialogTriggerProps && isDialogTrigger()) {\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (dialogTriggerProps[name] != null) {\n next[name] = dialogTriggerProps[name];\n }\n }\n return next;\n }\n\n const triggerProps = popoverTriggerContext?.triggerProps;\n if (!triggerProps || !isPopoverTrigger()) {\n return {};\n }\n\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (triggerProps[name] != null) {\n next[name] = triggerProps[name];\n }\n }\n return next;\n };\n const triggerDomProps = () => {\n const triggerProps = menuTriggerProps();\n if (!triggerProps) {\n return {};\n }\n\n const {\n onPress: _onPress,\n onPressStart: _onPressStart,\n preventFocusOnPress: _preventFocusOnPress,\n \"aria-haspopup\": _ariaHasPopup,\n \"aria-expanded\": _ariaExpanded,\n \"aria-controls\": _ariaControls,\n \"aria-disabled\": _ariaDisabled,\n id: _id,\n ref: _ref,\n onKeyDown: _onKeyDown,\n ...rest\n } = triggerProps;\n return rest;\n };\n const directAriaProps = () => {\n const next: Record<string, unknown> = {};\n for (const name of buttonAriaOverrideProps) {\n next[name] = coerceDomBoolean(name, (ariaProps as Record<string, unknown>)[name]);\n }\n return next;\n };\n const disablePendingInteractions = (props: Record<string, unknown>) => {\n if (!resolvePending()) {\n return props;\n }\n\n const next = { ...props };\n for (const key of Object.keys(next)) {\n // Mirror RAC's `useDisableInteractions`: when pending, strip every event\n // handler except the ones overlays/tooltips still need — focus/blur,\n // hover, and pointer/mouse enter-leave-over-out. Press handlers\n // (click/pointerdown/keydown/…) are removed so the focusable button\n // cannot be activated while pending.\n if (key.startsWith(\"on\") && !pendingPreservedEventPattern.test(key)) {\n next[key] = undefined;\n }\n }\n next.href = undefined;\n next.target = undefined;\n return next;\n };\n const dataState = (value: boolean) => (value ? \"true\" : undefined);\n const buttonChildren = () => renderProps.renderChildren();\n const buttonContent = () => (\n <ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>\n );\n let wasPending = false;\n let pendingAnnounceReady = false;\n createEffect(\n () => {\n const pending = resolvePending();\n const focused = isFocused();\n const labelledBy = ariaLabelledBy() || buttonId;\n return { pending, focused, labelledBy };\n },\n ({ pending, focused, labelledBy }) => {\n if (!pendingAnnounceReady) {\n wasPending = pending;\n pendingAnnounceReady = true;\n return;\n }\n const message = { \"aria-labelledby\": labelledBy };\n if (!wasPending && focused && pending) {\n announce(message, \"assertive\");\n } else if (wasPending && focused && !pending) {\n announce(message, \"assertive\");\n }\n wasPending = pending;\n },\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...triggerDomProps(),\n ...disablePendingInteractions(cleanButtonProps()),\n ...directAriaProps(),\n ...triggerAriaProps(),\n ...cleanFocusProps(),\n ...cleanHoverProps(),\n // RAC pending strips usePress keydown. Keep this wrapper so MenuTrigger\n // still peels onto the host; skip createPress while pending so Enter/Space\n // are not preventDefault'd and the native trusted click can fire.\n onKeyDown: (event: KeyboardEvent) => {\n (menuTriggerProps()?.onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n if (!resolvePending()) {\n (cleanButtonProps().onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n }\n },\n type: buttonType(),\n id:\n ((ariaProps as { id?: string }).id as string | undefined) ||\n (menuTriggerProps()?.id as string | undefined) ||\n (dialogTriggerContext && local.slot !== \"close\"\n ? dialogTriggerContext.triggerId\n : undefined) ||\n (popoverTriggerContext && local.slot !== \"close\"\n ? popoverTriggerContext.triggerId\n : undefined) ||\n buttonId,\n class: slotClass(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-rsp-slot\": slotValue()[\"data-rsp-slot\"],\n // Pending opts out of native focus only when explicitly requested. Keep\n // base disability authoritative without changing useFocusable's policy.\n disabled: resolvePending() && !isPendingFocusable() ? true : cleanButtonProps().disabled,\n \"aria-labelledby\": ariaLabelledBy(),\n \"aria-disabled\": resolvePending()\n ? \"true\"\n : (cleanButtonProps()[\"aria-disabled\"] ?? ariaProps[\"aria-disabled\"]),\n \"data-pressed\": dataState(buttonAria.isPressed() && !resolvePending()),\n \"data-hovered\": dataState(isHovered()),\n \"data-focused\": dataState(isFocused()),\n \"data-focus-visible\": dataState(isFocusVisible()),\n \"data-disabled\": dataState(resolveDisabled()),\n \"data-pending\": dataState(resolvePending()),\n }) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n const customRenderValues = createLiveButtonRenderProps(renderValues);\n const customRender = createMemo(() => local.render);\n\n return (\n <>\n {customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,+BACJ;AAIF,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,4BAA4B,QAAoD;CACvF,OAAO;EACL,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,iBAAiB;GACnB,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,aAAa;GACf,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;CACF;AACF;AAEA,SAAS,0BACP,UACA,aACA,KAC6C;CAC7C,MAAM,QAAQ,CAAC;CAGf,MAAM,uBAAO,IAAI,IAAI;EAAC,GAAG,OAAO,KAAK,QAAQ,QAAQ,CAAC;EAAG;EAAY;CAAK,CAAC;CAE3E,KAAK,MAAM,OAAO,MAChB,OAAO,eAAe,OAAO,KAAK;EAChC,YAAY;EACZ,c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M;EACZ,iBAAiB,UAAU,CAAC,CAAC;EAG7B,UAAU,eAAe,KAAK,CAAC,mBAAmB,IAAI,OAAO,iBAAiB,CAAC,CAAC;EAChF,mBAAmB,eAAe;EAClC,iBAAiB,eAAe,IAC5B,SACC,iBAAiB,CAAC,CAAC,oBAAoB,UAAU;EACtD,gBAAgB,UAAU,WAAW,UAAU,KAAK,CAAC,eAAe,CAAC;EACrE,gBAAgB,UAAU,UAAU,CAAC;EACrC,gBAAgB,UAAU,UAAU,CAAC;EACrC,sBAAsB,UAAU,eAAe,CAAC;EAChD,iBAAiB,UAAU,gBAAgB,CAAC;EAC5C,gBAAgB,UAAU,eAAe,CAAC;CAC5C;CACF,MAAM,qBAAqB,4BAA4B,YAAY;CACnE,MAAM,eAAe,iBAAiB,MAAM,MAAM;CAElD,OACE,EAAE;OACC,aAAa,IACZ,aAAa,CAAC,CACZ,0BAA0B,WAAW,eAAe,SAAS,GAC7D,kBACF,IAEA,CAAC,OAAO,KAAK,eAAe,UAAU,GAAG,OAAO,UAAU,GAAG,OAAO,YAAY,MAAM,GAAG;WACtF,cAAc,EAAE;QACnB,EAAE,QACF;IACJ;AAEJ"}
1
+ {"version":3,"file":"Button.jsx","names":["assignRef"],"sources":["../src/Button.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// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Button.tsx\n\n/**\n * Button component for solidaria-components\n *\n * A pre-wired headless button that combines state + aria hooks.\n * Port of react-aria-components/src/Button.tsx\n */\n\nimport {\n createContext,\n createEffect,\n createMemo,\n onCleanup,\n createSignal,\n untrack,\n useContext,\n} from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n announce,\n createButton,\n createFocusRing,\n createHover,\n createId,\n mergeProps,\n type AriaButtonProps,\n type HoverEvent,\n type PressEvent,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n coerceDomBoolean,\n} from \"./utils\";\nimport { DialogTriggerContext, PopoverTriggerContext } from \"./contexts\";\nimport { FileTriggerContext } from \"./fileTriggerContext\";\nimport { ProgressBarContext } from \"./ProgressBar\";\nimport { joinSlotClass, useSlotValue } from \"./slots\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\n// Events preserved when `isPending` is true (for tooltips and other overlays),\n// mirroring RAC Button's `PRESERVED_EVENT_PATTERN`. Every other `on*` handler\n// is stripped so a pending-but-focusable button cannot be activated.\nconst pendingPreservedEventPattern =\n /Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nfunction createLiveButtonRenderProps(values: () => ButtonRenderProps): ButtonRenderProps {\n return {\n get isHovered() {\n return values().isHovered;\n },\n get isPressed() {\n return values().isPressed;\n },\n get isFocused() {\n return values().isFocused;\n },\n get isFocusVisible() {\n return values().isFocusVisible;\n },\n get isDisabled() {\n return values().isDisabled;\n },\n get isPending() {\n return values().isPending;\n },\n };\n}\n\nfunction createLiveCustomRootProps(\n getProps: () => JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n getChildren: () => JSX.Element,\n ref: (el: HTMLButtonElement) => void,\n): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const props = {} as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n // Snapshot keys once. Reading getProps() in the component body is\n // STRICT_READ_UNTRACKED; getters re-read live values on later access.\n const keys = new Set([...Object.keys(untrack(getProps)), \"children\", \"ref\"]);\n\n for (const key of keys) {\n Object.defineProperty(props, key, {\n enumerable: true,\n configurable: true,\n get() {\n if (key === \"children\") {\n return getChildren();\n }\n if (key === \"ref\") {\n return ref;\n }\n return (getProps() as Record<string, unknown>)[key];\n },\n });\n }\n\n return props;\n}\n\nconst buttonAriaOverrideProps = [\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"aria-details\",\n \"aria-haspopup\",\n \"aria-expanded\",\n \"aria-controls\",\n \"aria-pressed\",\n \"aria-current\",\n \"aria-disabled\",\n] as const;\n\nfunction createForwardedAriaButtonProps(\n source: AriaButtonProps,\n overrides: AriaButtonProps,\n): AriaButtonProps {\n const result = {} as AriaButtonProps;\n\n // Enumerating an omit/merge proxy can read reactive leaves (descriptor\n // value snapshots). Snapshot keys once, untracked; getters re-read live.\n const sourceKeys = untrack(() => Object.keys(source as Record<string, unknown>));\n for (const key of sourceKeys) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get() {\n return (source as Record<string, unknown>)[key];\n },\n });\n }\n\n for (const key in overrides) {\n const descriptor = Object.getOwnPropertyDescriptor(overrides, key);\n if (!descriptor) continue;\n Object.defineProperty(result, key, { ...descriptor, enumerable: true, configurable: true });\n }\n\n return result;\n}\n\nexport interface ButtonRenderProps {\n /** Whether the button is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the button is currently in a pressed state. */\n isPressed: boolean;\n /** Whether the button is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the button is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the button is disabled. */\n isDisabled: boolean;\n /** Whether the button is currently in a pending state. */\n isPending: boolean;\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<ButtonRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<ButtonRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<ButtonRenderProps>;\n /** Custom renderer for the outer button element. */\n render?: (\n props: JSX.ButtonHTMLAttributes<HTMLButtonElement>,\n renderProps: ButtonRenderProps,\n ) => JSX.Element;\n /** Ref for the underlying button element. */\n ref?: RefLike<HTMLButtonElement>;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Keeps pending buttons focusable by using aria-disabled without a native disabled attribute. */\n isPendingFocusable?: boolean;\n /** Handler called when hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when hover state changes. */\n onHoverChange?: (isHovered: boolean) => void;\n}\n\nexport interface ButtonContextValue extends ButtonProps {\n slots?: Record<string, ButtonProps>;\n}\n\nexport const ButtonContext = createContext<ButtonContextValue | null>(null);\n\n/**\n * A button allows a user to perform an action.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <Button onPress={() => alert('Pressed!')}>\n * {({ isPressed, isHovered }) => (\n * <span class={isPressed ? 'bg-blue-700' : isHovered ? 'bg-blue-600' : 'bg-blue-500'}>\n * Click me\n * </span>\n * )}\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const fileTrigger = useContext(FileTriggerContext);\n const contextProps = useContext(ButtonContext);\n const contextSlotProps = untrack(\n () => contextProps?.slots?.[typeof props.slot === \"string\" ? props.slot : \"default\"],\n );\n const contextBaseProps = createMemo<ButtonProps>(() => {\n if (!contextProps) return {};\n const { slots: _slots, ...rest } = contextProps;\n return rest;\n });\n const mergedProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as ButtonProps;\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"ref\",\n \"slot\",\n \"isPending\",\n \"isPendingFocusable\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onHoverChange\",\n ]);\n const slotValue = useSlotValue(() => (typeof local.slot === \"string\" ? local.slot : undefined), {\n named: true,\n });\n\n // Check if inside a DialogTrigger or PopoverTrigger - if so, toggle on press\n // NOTE: Context is captured at component creation time. For Buttons inside a Modal,\n // the Modal provides OverlayTriggerStateContext, but due to SolidJS's eager JSX evaluation,\n // components inside Modal children are created before the Modal's Show renders.\n // So we can't reliably use context here to determine if we're inside a Modal.\n const dialogTriggerContext = useContext(DialogTriggerContext);\n const popoverTriggerContext = useContext(PopoverTriggerContext);\n\n // Helper to resolve isDisabled (handles both boolean and Accessor<boolean>)\n const menuTriggerProps = () =>\n isPopoverTrigger() && popoverTriggerContext?.trigger === \"MenuTrigger\"\n ? popoverTriggerContext.triggerProps\n : undefined;\n\n const resolveDisabled = (): boolean => {\n const disabled = ariaProps.isDisabled;\n if (typeof disabled === \"function\" ? disabled() : !!disabled) {\n return true;\n }\n const triggerProps = menuTriggerProps();\n return Boolean(triggerProps?.[\"aria-disabled\"] || triggerProps?.isDisabled);\n };\n\n // Owned at setup. Solid compiles a compound `isPending={a() && b()}` prop into\n // a getter that calls `memo()` on every read, so reading it lazily from a native\n // press or hover handler creates that computation with no owner: it warns and is\n // never disposed. A memo pins the read to this component's owner.\n const resolvePending = createMemo((): boolean =>\n fileTrigger\n ? !!(props.isPending ?? contextSlotProps?.isPending ?? contextProps?.isPending)\n : !!local.isPending,\n );\n const isPendingFocusable = () => local.isPendingFocusable !== false;\n\n const [resolvedButtonEl, setResolvedButtonEl] = createSignal<HTMLButtonElement | null>(null, {\n ownedWrite: true,\n });\n const buttonId = createId(\n untrack(() => (ariaProps as Record<string, unknown>).id as string | undefined),\n );\n const progressId = createId();\n\n // Explicit trigger ownership: a button toggles overlays only when it is the\n // registered trigger element for the surrounding trigger context.\n const isDialogTrigger = () =>\n !!dialogTriggerContext &&\n !!resolvedButtonEl() &&\n dialogTriggerContext.triggerRef() === resolvedButtonEl();\n const isPopoverTrigger = () =>\n !!popoverTriggerContext &&\n !!resolvedButtonEl() &&\n popoverTriggerContext.triggerRef() === resolvedButtonEl();\n\n const handlePress = (e: PressEvent) => {\n if (resolvePending()) {\n return;\n }\n if (fileTrigger) {\n // Read original callbacks at activation time. mergeProps event chains\n // capture snapshots; calling that chain too would double delivery.\n contextProps?.onPress?.(e);\n contextSlotProps?.onPress?.(e);\n fileTrigger.open();\n props.onPress?.(e);\n } else if (typeof ariaProps.onPress === \"function\") {\n ariaProps.onPress(e);\n }\n // Toggle only when this exact button is the registered trigger element.\n if (isDialogTrigger() && local.slot !== \"close\") {\n dialogTriggerContext!.state.toggle();\n } else if (isPopoverTrigger() && local.slot !== \"close\") {\n const triggerOnPress = popoverTriggerContext!.triggerProps?.onPress as\n | ((event: PressEvent) => void)\n | undefined;\n if (typeof triggerOnPress === \"function\") {\n triggerOnPress(e);\n } else if (popoverTriggerContext!.trigger !== \"MenuTrigger\") {\n popoverTriggerContext!.state.toggle();\n }\n }\n };\n\n const buttonAria = createButton(\n createForwardedAriaButtonProps(ariaProps, {\n onPress: handlePress,\n get onPressStart() {\n if (resolvePending()) return undefined;\n return (event: PressEvent) => {\n const triggerStart = popoverTriggerContext?.triggerProps?.onPressStart as\n | ((event: PressEvent) => void)\n | undefined;\n triggerStart?.(event);\n ariaProps.onPressStart?.(event);\n };\n },\n get onPressEnd() {\n return resolvePending() ? undefined : ariaProps.onPressEnd;\n },\n get onPressUp() {\n return resolvePending() ? undefined : ariaProps.onPressUp;\n },\n get onPressChange() {\n return resolvePending() ? undefined : ariaProps.onPressChange;\n },\n get onClick() {\n return resolvePending() ? undefined : ariaProps.onClick;\n },\n get preventFocusOnPress() {\n return (menuTriggerProps()?.preventFocusOnPress ?? ariaProps.preventFocusOnPress) as\n | boolean\n | undefined;\n },\n // Mirror React Aria's RAC `Button`: `useButton` is called with the base\n // `isDisabled` WITHOUT `isPending`, so a pending-focusable button stays a\n // non-disabled native `<button>` — keeping `useFocusable`'s always-on\n // `tabindex={0}` (the Safari focus workaround) and no native `disabled`\n // attribute. The pending \"disabled\" semantics are layered ON TOP:\n // `aria-disabled=\"true\"` below and `disablePendingInteractions` stripping\n // the press handlers post-hoc (RAC's `useDisableInteractions`). Folding\n // `isPending` in here instead would make the focusable hook drop\n // `tabIndex`, diverging from upstream's pending button (D4).\n get isDisabled() {\n return resolveDisabled();\n },\n }),\n );\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return resolveDisabled() || resolvePending();\n },\n get onHoverStart() {\n return local.onHoverStart;\n },\n get onHoverEnd() {\n return local.onHoverEnd;\n },\n get onHoverChange() {\n return local.onHoverChange;\n },\n });\n\n const renderValues = createMemo<ButtonRenderProps>(() => ({\n isHovered: isHovered(),\n isPressed: buttonAria.isPressed() && !resolvePending(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isDisabled: resolveDisabled(),\n isPending: resolvePending(),\n }));\n\n const renderProps = useRenderProps(\n {\n // Use merged children so ButtonContext can supply slot/default content.\n get children() {\n return local.children;\n },\n get class() {\n return local.class;\n },\n get style() {\n return local.style;\n },\n defaultClassName: \"solidaria-Button\",\n },\n renderValues,\n );\n const slotClass = () => joinSlotClass(renderProps.class(), slotValue().class);\n\n // Remove onClick from DOM props - it's already handled by createPress\n // This matches React Aria Components behavior (Button.tsx line 144: delete DOMProps.onClick)\n const domProps = () => {\n const filtered = filterDOMProps(ariaProps, { global: true }) as Record<string, unknown>;\n // onClick is handled by createPress, not passed directly to DOM\n delete filtered.onClick;\n // Read data-* now so `{...rootProps()}` re-applies when a trigger attr changes.\n for (const key in ariaProps) {\n if (key.startsWith(\"data-\")) {\n filtered[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return filtered;\n };\n\n const buttonPropsRef = untrack(() => (buttonAria.buttonProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const focusPropsRef = untrack(() => (focusProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n const hoverPropsRef = untrack(() => (hoverProps as Record<string, unknown>).ref) as\n | ((el: HTMLElement) => void)\n | undefined;\n\n const cleanButtonProps = () => {\n const { ref: _ref1, ...rest } = buttonAria.buttonProps as Record<string, unknown>;\n return rest;\n };\n const cleanFocusProps = () => {\n const { ref: _ref2, ...rest } = focusProps as Record<string, unknown>;\n return rest;\n };\n const cleanHoverProps = () => {\n const { ref: _ref3, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n const ariaLabelledBy = createMemo(() => {\n const labelledBy = cleanButtonProps()[\"aria-labelledby\"] as string | undefined;\n if (!resolvePending()) {\n return labelledBy;\n }\n\n if (labelledBy) {\n return `${labelledBy} ${progressId}`;\n }\n\n if (cleanButtonProps()[\"aria-label\"]) {\n return `${buttonId} ${progressId}`;\n }\n\n return labelledBy;\n });\n\n let releaseFileTrigger: (() => void) | undefined;\n onCleanup(() => releaseFileTrigger?.());\n const handleRef = (el: HTMLButtonElement) => {\n releaseFileTrigger?.();\n setResolvedButtonEl(el);\n releaseFileTrigger = fileTrigger?.register(el);\n assignRef(local.ref, el);\n\n buttonPropsRef?.(el);\n focusPropsRef?.(el);\n hoverPropsRef?.(el);\n\n // Register trigger ownership for surrounding trigger contexts.\n // Close buttons live inside the overlay and must not steal trigger identity.\n if (dialogTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n dialogTriggerContext.setTriggerRef(el);\n }\n if (popoverTriggerContext?.setTriggerRef && local.slot !== \"close\") {\n popoverTriggerContext.setTriggerRef(el);\n }\n };\n const buttonType = () =>\n (buttonAria.buttonProps as Record<string, unknown>).type === \"submit\" && resolvePending()\n ? \"button\"\n : ((buttonAria.buttonProps as Record<string, unknown>).type as\n | \"button\"\n | \"submit\"\n | \"reset\"\n | undefined);\n const triggerAriaProps = () => {\n const dialogTriggerProps = dialogTriggerContext?.triggerProps;\n if (dialogTriggerProps && isDialogTrigger()) {\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (dialogTriggerProps[name] != null) {\n next[name] = dialogTriggerProps[name];\n }\n }\n return next;\n }\n\n const triggerProps = popoverTriggerContext?.triggerProps;\n if (!triggerProps || !isPopoverTrigger()) {\n return {};\n }\n\n const next: Record<string, unknown> = {};\n for (const name of [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\"]) {\n if (triggerProps[name] != null) {\n next[name] = triggerProps[name];\n }\n }\n return next;\n };\n const triggerDomProps = () => {\n const triggerProps = menuTriggerProps();\n if (!triggerProps) {\n return {};\n }\n\n const {\n onPress: _onPress,\n onPressStart: _onPressStart,\n preventFocusOnPress: _preventFocusOnPress,\n \"aria-haspopup\": _ariaHasPopup,\n \"aria-expanded\": _ariaExpanded,\n \"aria-controls\": _ariaControls,\n \"aria-disabled\": _ariaDisabled,\n id: _id,\n ref: _ref,\n onKeyDown: _onKeyDown,\n ...rest\n } = triggerProps;\n return rest;\n };\n const directAriaProps = () => {\n const next: Record<string, unknown> = {};\n for (const name of buttonAriaOverrideProps) {\n next[name] = coerceDomBoolean(name, (ariaProps as Record<string, unknown>)[name]);\n }\n return next;\n };\n const disablePendingInteractions = (props: Record<string, unknown>) => {\n if (!resolvePending()) {\n return props;\n }\n\n const next = { ...props };\n for (const key of Object.keys(next)) {\n // Mirror RAC's `useDisableInteractions`: when pending, strip every event\n // handler except the ones overlays/tooltips still need — focus/blur,\n // hover, and pointer/mouse enter-leave-over-out. Press handlers\n // (click/pointerdown/keydown/…) are removed so the focusable button\n // cannot be activated while pending.\n if (key.startsWith(\"on\") && !pendingPreservedEventPattern.test(key)) {\n next[key] = undefined;\n }\n }\n next.href = undefined;\n next.target = undefined;\n return next;\n };\n const dataState = (value: boolean) => (value ? \"true\" : undefined);\n const buttonChildren = () => renderProps.renderChildren();\n const buttonContent = () => (\n <ProgressBarContext value={{ id: progressId }}>{buttonChildren()}</ProgressBarContext>\n );\n let wasPending = false;\n let pendingAnnounceReady = false;\n createEffect(\n () => {\n const pending = resolvePending();\n const focused = isFocused();\n const labelledBy = ariaLabelledBy() || buttonId;\n return { pending, focused, labelledBy };\n },\n ({ pending, focused, labelledBy }) => {\n if (!pendingAnnounceReady) {\n wasPending = pending;\n pendingAnnounceReady = true;\n return;\n }\n const message = { \"aria-labelledby\": labelledBy };\n if (!wasPending && focused && pending) {\n announce(message, \"assertive\");\n } else if (wasPending && focused && !pending) {\n announce(message, \"assertive\");\n }\n wasPending = pending;\n },\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...triggerDomProps(),\n ...disablePendingInteractions(cleanButtonProps()),\n ...directAriaProps(),\n ...triggerAriaProps(),\n ...cleanFocusProps(),\n ...cleanHoverProps(),\n // RAC pending strips usePress keydown. Keep this wrapper so MenuTrigger\n // still peels onto the host; skip createPress while pending so Enter/Space\n // are not preventDefault'd and the native trusted click can fire.\n onKeyDown: (event: KeyboardEvent) => {\n (menuTriggerProps()?.onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n if (!resolvePending()) {\n (cleanButtonProps().onKeyDown as ((event: KeyboardEvent) => void) | undefined)?.(event);\n }\n },\n type: buttonType(),\n id:\n ((ariaProps as { id?: string }).id as string | undefined) ||\n (menuTriggerProps()?.id as string | undefined) ||\n (dialogTriggerContext && local.slot !== \"close\"\n ? dialogTriggerContext.triggerId\n : undefined) ||\n (popoverTriggerContext && local.slot !== \"close\"\n ? popoverTriggerContext.triggerId\n : undefined) ||\n buttonId,\n class: slotClass(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-rsp-slot\": slotValue()[\"data-rsp-slot\"],\n // Pending opts out of native focus only when explicitly requested. Keep\n // base disability authoritative without changing useFocusable's policy.\n disabled: resolvePending() && !isPendingFocusable() ? true : cleanButtonProps().disabled,\n \"aria-labelledby\": ariaLabelledBy(),\n \"aria-disabled\": resolvePending()\n ? \"true\"\n : (cleanButtonProps()[\"aria-disabled\"] ?? ariaProps[\"aria-disabled\"]),\n \"data-pressed\": dataState(buttonAria.isPressed() && !resolvePending()),\n \"data-hovered\": dataState(isHovered()),\n \"data-focused\": dataState(isFocused()),\n \"data-focus-visible\": dataState(isFocusVisible()),\n \"data-disabled\": dataState(resolveDisabled()),\n \"data-pending\": dataState(resolvePending()),\n }) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n const customRenderValues = createLiveButtonRenderProps(renderValues);\n const customRender = createMemo(() => local.render);\n\n return (\n <>\n {customRender() ? (\n customRender()!(\n createLiveCustomRootProps(rootProps, buttonContent, handleRef),\n customRenderValues,\n )\n ) : (\n <button ref={handleRef} {...rootProps()} class={slotClass()} style={renderProps.style()}>\n {buttonContent()}\n </button>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,+BACJ;AAIF,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAEA,SAAS,4BAA4B,QAAoD;CACvF,OAAO;EACL,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,iBAAiB;GACnB,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,aAAa;GACf,OAAO,OAAO,CAAC,CAAC;EAClB;EACA,IAAI,YAAY;GACd,OAAO,OAAO,CAAC,CAAC;EAClB;CACF;AACF;AAEA,SAAS,0BACP,UACA,aACA,KAC6C;CAC7C,MAAM,QAAQ,CAAC;CAGf,MAAM,uBAAO,IAAI,IAAI;EAAC,GAAG,OAAO,KAAK,QAAQ,QAAQ,CAAC;EAAG;EAAY;CAAK,CAAC;CAE3E,KAAK,MAAM,OAAO,MAChB,OA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