@react-spectrum/s2 3.0.0-nightly-326f48154-241216 → 3.0.0-nightly-adae13c78-241218

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 (184) hide show
  1. package/dist/ActionButton.cjs +58 -80
  2. package/dist/ActionButton.cjs.map +1 -1
  3. package/dist/ActionButton.css +76 -96
  4. package/dist/ActionButton.css.map +1 -1
  5. package/dist/ActionButton.mjs +58 -80
  6. package/dist/ActionButton.mjs.map +1 -1
  7. package/dist/ActionButtonGroup.cjs.map +1 -1
  8. package/dist/ActionButtonGroup.css.map +1 -1
  9. package/dist/ActionButtonGroup.mjs.map +1 -1
  10. package/dist/Badge.cjs +66 -66
  11. package/dist/Badge.css +43 -43
  12. package/dist/Badge.mjs +66 -66
  13. package/dist/Breadcrumbs.cjs +6 -6
  14. package/dist/Breadcrumbs.css +4 -4
  15. package/dist/Breadcrumbs.mjs +6 -6
  16. package/dist/Button.cjs +89 -134
  17. package/dist/Button.cjs.map +1 -1
  18. package/dist/Button.css +102 -134
  19. package/dist/Button.css.map +1 -1
  20. package/dist/Button.mjs +89 -134
  21. package/dist/Button.mjs.map +1 -1
  22. package/dist/Card.cjs +4 -4
  23. package/dist/Card.css +3 -3
  24. package/dist/Card.mjs +4 -4
  25. package/dist/CardView.cjs +1 -1
  26. package/dist/CardView.css +1 -1
  27. package/dist/CardView.mjs +1 -1
  28. package/dist/Checkbox.cjs +10 -10
  29. package/dist/Checkbox.css +10 -10
  30. package/dist/Checkbox.mjs +10 -10
  31. package/dist/CloseButton.cjs +17 -28
  32. package/dist/CloseButton.cjs.map +1 -1
  33. package/dist/CloseButton.css +19 -31
  34. package/dist/CloseButton.css.map +1 -1
  35. package/dist/CloseButton.mjs +17 -28
  36. package/dist/CloseButton.mjs.map +1 -1
  37. package/dist/ColorArea.cjs +1 -1
  38. package/dist/ColorArea.css +1 -1
  39. package/dist/ColorArea.mjs +1 -1
  40. package/dist/ColorHandle.cjs +3 -3
  41. package/dist/ColorHandle.css +3 -3
  42. package/dist/ColorHandle.mjs +3 -3
  43. package/dist/ColorSlider.cjs +1 -1
  44. package/dist/ColorSlider.css +1 -1
  45. package/dist/ColorSlider.mjs +1 -1
  46. package/dist/ColorSwatchPicker.cjs +1 -1
  47. package/dist/ColorSwatchPicker.css +1 -1
  48. package/dist/ColorSwatchPicker.mjs +1 -1
  49. package/dist/ColorWheel.cjs +2 -2
  50. package/dist/ColorWheel.css +1 -1
  51. package/dist/ColorWheel.mjs +2 -2
  52. package/dist/ComboBox.cjs +5 -5
  53. package/dist/ComboBox.css +4 -4
  54. package/dist/ComboBox.mjs +5 -5
  55. package/dist/Disclosure.cjs +1 -1
  56. package/dist/Disclosure.css +1 -1
  57. package/dist/Disclosure.mjs +1 -1
  58. package/dist/Divider.cjs +8 -8
  59. package/dist/Divider.cjs.map +1 -1
  60. package/dist/Divider.css +13 -13
  61. package/dist/Divider.css.map +1 -1
  62. package/dist/Divider.mjs +8 -8
  63. package/dist/Divider.mjs.map +1 -1
  64. package/dist/DropZone.cjs +4 -4
  65. package/dist/DropZone.css +2 -2
  66. package/dist/DropZone.mjs +4 -4
  67. package/dist/Field.cjs +23 -18
  68. package/dist/Field.cjs.map +1 -1
  69. package/dist/Field.css +7 -15
  70. package/dist/Field.css.map +1 -1
  71. package/dist/Field.mjs +23 -18
  72. package/dist/Field.mjs.map +1 -1
  73. package/dist/InlineAlert.cjs +24 -29
  74. package/dist/InlineAlert.cjs.map +1 -1
  75. package/dist/InlineAlert.css +15 -19
  76. package/dist/InlineAlert.css.map +1 -1
  77. package/dist/InlineAlert.mjs +24 -29
  78. package/dist/InlineAlert.mjs.map +1 -1
  79. package/dist/Link.cjs +7 -6
  80. package/dist/Link.cjs.map +1 -1
  81. package/dist/Link.css +14 -14
  82. package/dist/Link.css.map +1 -1
  83. package/dist/Link.mjs +7 -6
  84. package/dist/Link.mjs.map +1 -1
  85. package/dist/Menu.cjs +28 -8
  86. package/dist/Menu.cjs.map +1 -1
  87. package/dist/Menu.css +3 -3
  88. package/dist/Menu.css.map +1 -1
  89. package/dist/Menu.mjs +29 -9
  90. package/dist/Menu.mjs.map +1 -1
  91. package/dist/Meter.cjs +13 -13
  92. package/dist/Meter.cjs.map +1 -1
  93. package/dist/Meter.css +18 -22
  94. package/dist/Meter.css.map +1 -1
  95. package/dist/Meter.mjs +13 -13
  96. package/dist/Meter.mjs.map +1 -1
  97. package/dist/Modal.cjs +1 -1
  98. package/dist/Modal.css +1 -1
  99. package/dist/Modal.mjs +1 -1
  100. package/dist/NumberField.cjs +4 -4
  101. package/dist/NumberField.css +4 -4
  102. package/dist/NumberField.mjs +4 -4
  103. package/dist/Picker.cjs +4 -4
  104. package/dist/Picker.css +4 -4
  105. package/dist/Picker.mjs +4 -4
  106. package/dist/Popover.cjs +3 -3
  107. package/dist/Popover.css +3 -3
  108. package/dist/Popover.mjs +3 -3
  109. package/dist/ProgressBar.cjs +20 -18
  110. package/dist/ProgressBar.cjs.map +1 -1
  111. package/dist/ProgressBar.css +20 -24
  112. package/dist/ProgressBar.css.map +1 -1
  113. package/dist/ProgressBar.mjs +20 -18
  114. package/dist/ProgressBar.mjs.map +1 -1
  115. package/dist/ProgressCircle.cjs +11 -9
  116. package/dist/ProgressCircle.cjs.map +1 -1
  117. package/dist/ProgressCircle.css +14 -14
  118. package/dist/ProgressCircle.css.map +1 -1
  119. package/dist/ProgressCircle.mjs +11 -9
  120. package/dist/ProgressCircle.mjs.map +1 -1
  121. package/dist/Provider.cjs +1 -1
  122. package/dist/Provider.css +1 -1
  123. package/dist/Provider.mjs +1 -1
  124. package/dist/Radio.cjs +6 -6
  125. package/dist/Radio.css +6 -6
  126. package/dist/Radio.mjs +6 -6
  127. package/dist/SearchField.cjs +1 -1
  128. package/dist/SearchField.css +1 -1
  129. package/dist/SearchField.mjs +1 -1
  130. package/dist/SegmentedControl.cjs +8 -8
  131. package/dist/SegmentedControl.css +8 -8
  132. package/dist/SegmentedControl.mjs +8 -8
  133. package/dist/Slider.cjs +8 -8
  134. package/dist/Slider.css +5 -5
  135. package/dist/Slider.mjs +8 -8
  136. package/dist/Switch.cjs +7 -7
  137. package/dist/Switch.css +6 -6
  138. package/dist/Switch.mjs +7 -7
  139. package/dist/TableView.cjs +17 -17
  140. package/dist/TableView.css +11 -11
  141. package/dist/TableView.mjs +17 -17
  142. package/dist/Tabs.cjs +5 -5
  143. package/dist/Tabs.css +5 -5
  144. package/dist/Tabs.mjs +5 -5
  145. package/dist/TabsPicker.cjs +1 -1
  146. package/dist/TabsPicker.css +1 -1
  147. package/dist/TabsPicker.mjs +1 -1
  148. package/dist/TagGroup.cjs +10 -10
  149. package/dist/TagGroup.css +8 -8
  150. package/dist/TagGroup.mjs +10 -10
  151. package/dist/ToggleButton.cjs +1 -0
  152. package/dist/ToggleButton.cjs.map +1 -1
  153. package/dist/ToggleButton.css.map +1 -1
  154. package/dist/ToggleButton.mjs +1 -0
  155. package/dist/ToggleButton.mjs.map +1 -1
  156. package/dist/Tooltip.cjs +1 -1
  157. package/dist/Tooltip.css +1 -1
  158. package/dist/Tooltip.mjs +1 -1
  159. package/dist/types.d.ts +9 -9
  160. package/dist/types.d.ts.map +1 -1
  161. package/package.json +18 -18
  162. package/src/ActionButton.tsx +19 -43
  163. package/src/ActionButtonGroup.tsx +1 -1
  164. package/src/Button.tsx +36 -79
  165. package/src/CloseButton.tsx +10 -20
  166. package/src/Divider.tsx +10 -16
  167. package/src/Field.tsx +19 -17
  168. package/src/InlineAlert.tsx +0 -1
  169. package/src/Link.tsx +7 -12
  170. package/src/Menu.tsx +24 -8
  171. package/src/Meter.tsx +7 -14
  172. package/src/ProgressBar.tsx +8 -15
  173. package/src/ProgressCircle.tsx +12 -15
  174. package/src/ToggleButton.tsx +1 -0
  175. package/src/bar-utils.ts +3 -10
  176. package/src/style-utils.ts +15 -8
  177. package/style/dist/spectrum-theme.cjs +15 -1
  178. package/style/dist/spectrum-theme.cjs.map +1 -1
  179. package/style/dist/spectrum-theme.mjs +15 -1
  180. package/style/dist/spectrum-theme.mjs.map +1 -1
  181. package/style/dist/types.d.ts +40 -27
  182. package/style/dist/types.d.ts.map +1 -1
  183. package/style/spectrum-theme.ts +4 -2
  184. package/style/tokens.ts +30 -0
package/dist/Menu.css.map CHANGED
@@ -1 +1 @@
1
- {"mappings":"ACuFkB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0BG;;;;EAYM;;;;EAAA;;;;EASC;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAMN;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmDC;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkBR;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKG;;;;EAAA;;;;EAAA;;;;EAYa;;;;EAAA;;;;EAKnB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoBO;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EASM;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;;;;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAqBb;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgBE;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoGL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkGmB;;;;;AA7Zb;EAqDI;;;;EAAA;;;;EAkJP;;;;EAAA;;;;EAoHH;;;;;AA3TM;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IA+HA;;;;IAqCC;;;;IASM;;;;IAAA;;;;IAAA;;;;IA0BV;;;;;;AAlJO;EAAA;IAAA;;;;IAmDC;;;;IA+FR;;;;;;AA/FQ","sources":["7c22b67265d3212e","packages/@react-spectrum/s2/src/Menu.tsx"],"sourcesContent":["@import \"dc7300f7a31f6746\";\n@import \"ba4f3709c47b6f32\";\n@import \"188776d578edc2d4\";\n@import \"7542e2c368e43074\";\n@import \"a0ece4d15d51b6d1\";\n@import \"9190ed57f0ec543d\";\n@import \"7ea87ac6ab45824a\";\n@import \"8dd2ed15af634baa\";\n@import \"e1b788d5c243c1be\";\n@import \"227155bda7dda199\";\n@import \"9349097043636fe6\";\n@import \"329bb28fb4b64255\";\n@import \"fa4d0c98959eb626\";\n@import \"7ed629d8804e69a8\";\n@import \"c7f5b0af4e97a693\";\n@import \"04aee1e7a62e8b5b\";\n@import \"ddf352cdf38358b0\";\n","/*\n * Copyright 2024 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\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n MenuItemProps as AriaMenuItemProps,\n MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n MenuSectionProps as AriaMenuSectionProps,\n MenuTrigger as AriaMenuTrigger,\n MenuTriggerProps as AriaMenuTriggerProps,\n SubmenuTrigger as AriaSubmenuTrigger,\n SubmenuTriggerProps as AriaSubmenuTriggerProps,\n ContextValue,\n Provider,\n Separator,\n SeparatorProps\n} from 'react-aria-components';\nimport {baseColor, edgeToText, focusRing, fontRelative, size, space, style} from '../style' with {type: 'macro'};\nimport {box, iconStyles} from './Checkbox';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronRightIcon from '../ui-icons/Chevron';\nimport {createContext, forwardRef, JSX, ReactNode, useContext, useRef} from 'react';\nimport {divider} from './Divider';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, KeyboardContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon'; // chevron right removed??\nimport {ImageContext} from './Image';\nimport LinkOutIcon from '../ui-icons/LinkOut';\nimport {mergeStyles} from '../style/runtime';\nimport {Placement, useLocale} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport {pressScale} from './pressScale';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n// viewbox on LinkOut is super weird just because i copied the icon from designs...\n// need to strip id's from icons\n\nexport interface MenuTriggerProps extends AriaMenuTriggerProps {\n /**\n * Alignment of the menu relative to the trigger.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /**\n * Where the Menu opens relative to its trigger.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end',\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children' | 'style' | 'className' | 'dependencies'>, StyleProps {\n /**\n * The size of the Menu.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The contents of the collection.\n */\n children?: ReactNode | ((item: T) => ReactNode)\n}\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: {\n size: {\n S: [edgeToText(24), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(24)],\n M: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n L: [edgeToText(40), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(40)],\n XL: [edgeToText(48), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(48)]\n }\n },\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: {\n isPopover: 'auto'\n },\n maxWidth: {\n isPopover: 320\n },\n padding: {\n isPopover: 8\n },\n fontFamily: 'sans',\n fontSize: 'control'\n}, getAllowedOverrides());\n\nexport let section = style({\n gridColumnStart: 1,\n gridColumnEnd: -1,\n alignItems: 'center',\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid'\n});\n\nexport let sectionHeader = style<{size?: 'S' | 'M' | 'L' | 'XL'}>({\n color: 'neutral',\n gridColumnStart: 2,\n gridColumnEnd: -2,\n boxSizing: 'border-box',\n minHeight: 'control',\n paddingY: centerPadding()\n});\n\nexport let sectionHeading = style({\n font: 'ui',\n fontWeight: 'bold',\n margin: 0\n});\n\nexport let menuitem = style({\n ...focusRing(),\n boxSizing: 'border-box',\n borderRadius: 'control',\n font: 'control',\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n paddingBottom: '--labelPadding',\n backgroundColor: { // TODO: revisit color when I have access to dev mode again\n default: {\n default: 'transparent',\n isFocused: baseColor('gray-100').isFocusVisible\n }\n },\n color: {\n default: 'neutral',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n position: 'relative',\n // each menu item should take up the entire width, the subgrid will handle within the item\n gridColumnStart: 1,\n gridColumnEnd: -1,\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid',\n gridTemplateRows: {\n // min-content prevents second row from 'auto'ing to a size larger then 0 when empty\n default: 'auto minmax(0, min-content)',\n ':has([slot=description])': 'auto auto'\n },\n rowGap: {\n ':has([slot=description])': space(1)\n },\n alignItems: 'baseline',\n minHeight: 'control',\n textDecoration: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n transition: 'default'\n}, getAllowedOverrides());\n\nexport let checkmark = style({\n visibility: {\n default: 'hidden',\n isSelected: 'visible'\n },\n gridArea: 'checkmark',\n color: 'accent',\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'currentColor',\n forcedColors: 'Highlight'\n }\n },\n marginEnd: 'text-to-control',\n aspectRatio: 'square'\n});\n\nlet checkbox = style({\n gridArea: 'checkmark',\n marginEnd: 'text-to-control'\n});\n\nexport let icon = style({\n display: 'block',\n size: fontRelative(20),\n // too small default icon size is wrong, it's like the icons are 1 tshirt size bigger than the rest of the component? check again after typography changes\n // reminder, size of WF is applied via font size\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport let iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon'\n});\n\nlet image = style({\n gridArea: 'icon',\n gridRowEnd: 'span 2',\n marginEnd: 'text-to-visual',\n marginTop: fontRelative(6), // made up, need feedback\n alignSelf: 'center',\n borderRadius: 'sm',\n size: {\n default: 40,\n size: {\n S: 32,\n M: 40,\n L: 44,\n XL: 48 // TODO: feedback, Why is it 50x50, that's on 12.25 so doesn't fit the grid at all\n }\n },\n aspectRatio: 'square',\n objectFit: 'contain'\n});\n\nexport let label = style<{size: string}>({\n gridArea: 'label',\n font: 'control',\n color: '[inherit]',\n fontWeight: 'medium',\n // TODO: token values for padding not defined yet, revisit\n marginTop: '--labelPadding'\n});\n\nexport let description = style({\n gridArea: 'description',\n font: {\n default: 'ui-sm',\n size: {\n S: 'ui-xs',\n M: 'ui-sm',\n L: 'ui',\n XL: 'ui-lg'\n }\n },\n color: {\n default: 'neutral-subdued',\n // Ideally this would use the same token as hover, but we don't have access to that here.\n // TODO: should we always consider isHovered and isFocused to be the same thing?\n isFocused: 'gray-800',\n isDisabled: 'disabled'\n },\n transition: 'default'\n});\n\nlet value = style({\n gridArea: 'value',\n marginStart: 8\n});\n\nlet keyboard = style({\n gridArea: 'keyboard',\n marginStart: 8,\n font: 'ui',\n fontWeight: 'light',\n color: {\n default: 'gray-600',\n isDisabled: 'disabled',\n forcedColors: {\n isDisabled: 'GrayText'\n }\n },\n background: 'gray-25',\n unicodeBidi: 'plaintext'\n});\n\nlet descriptor = style({\n gridArea: 'descriptor',\n marginStart: 8,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalMenuContext = createContext<{size: 'S' | 'M' | 'L' | 'XL', isSubmenu: boolean}>({size: 'M', isSubmenu: false});\nlet InternalMenuTriggerContext = createContext<Omit<MenuTriggerProps, 'children'> | null>(null);\n\n/**\n * Menus display a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MenuContext);\n let {isSubmenu, size: ctxSize} = useContext(InternalMenuContext);\n let {\n children,\n size = ctxSize,\n UNSAFE_style,\n UNSAFE_className,\n styles\n } = props;\n let ctx = useContext(InternalMenuTriggerContext);\n let {align = 'start', direction = 'bottom', shouldFlip} = ctx ?? {};\n\n // TODO: change offset/crossoffset based on size? scale?\n // actual values?\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n if (isSubmenu) {\n initialPlacement = 'end top' as Placement;\n }\n\n let content = (\n <InternalMenuContext.Provider value={{size, isSubmenu: true}}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <AriaMenu\n {...props}\n className={menu({size, isPopover: !!ctx || isSubmenu}, ctx ? null : styles)}>\n {children}\n </AriaMenu>\n </Provider>\n </InternalMenuContext.Provider>\n );\n\n if (ctx || isSubmenu) {\n return (\n <PopoverBase\n ref={ref}\n hideArrow\n placement={initialPlacement}\n shouldFlip={shouldFlip}\n // For submenus, the offset from the edge of the popover should be 10px.\n // Subtract 8px for the padding around the parent menu.\n offset={isSubmenu ? -2 : 8}\n // Offset by padding + border so that the first item in a submenu lines up with the parent menu item.\n crossOffset={isSubmenu ? -9 : 0}\n UNSAFE_style={UNSAFE_style}\n UNSAFE_className={UNSAFE_className}\n styles={styles}>\n {content}\n </PopoverBase>\n );\n }\n\n return content;\n});\n\nexport function Divider(props: SeparatorProps) {\n return (\n <Separator\n {...props}\n className={mergeStyles(\n divider({\n size: 'M',\n orientation: 'horizontal',\n staticColor: undefined\n }), style({\n display: {\n default: 'grid',\n ':last-child': 'none'\n },\n gridColumnStart: 2,\n gridColumnEnd: -2,\n marginY: size(5) // height of the menu separator is 12px, and the divider is 2px\n })\n )} />\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends AriaMenuSectionProps<T> {}\nexport function MenuSection<T extends object>(props: MenuSectionProps<T>) {\n // remember, context doesn't work if it's around Section nor inside\n return (\n <>\n <AriaMenuSection\n {...props}\n className={section}>\n {props.children}\n </AriaMenuSection>\n <Divider />\n </>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'children' | 'style' | 'className'>, StyleProps {\n /**\n * The contents of the item.\n */\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nconst linkIconSize = {\n S: 'M',\n M: 'L',\n L: 'XL',\n XL: 'XL'\n} as const;\n\nexport function MenuItem(props: MenuItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let isLinkOut = isLink && props.target === '_blank';\n let {size} = useContext(InternalMenuContext);\n let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);\n let {direction} = useLocale();\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue}\n ref={ref}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, isFocused: (renderProps.hasSubmenu && renderProps.isOpen) || renderProps.isFocused, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n let checkboxRenderProps = {...renderProps, size, isFocused: false, isFocusVisible: false, isIndeterminate: false, isReadOnly: false, isInvalid: false, isRequired: false};\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon},\n descriptor: {render: centerBaseline({slot: 'descriptor', styles: descriptor})} // TODO: remove once we have default?\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})},\n value: {styles: value}\n }\n }],\n [KeyboardContext, {styles: keyboard({size, isDisabled: renderProps.isDisabled})}],\n [ImageContext, {styles: image({size})}]\n ]}>\n {renderProps.selectionMode === 'single' && !isLink && !renderProps.hasSubmenu && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {renderProps.selectionMode === 'multiple' && !isLink && !renderProps.hasSubmenu && (\n <div className={mergeStyles(checkbox, box(checkboxRenderProps))}>\n <CheckmarkIcon size={size} className={iconStyles} />\n </div>\n )}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n {isLinkOut && <LinkOutIcon size={linkIconSize[size]} className={descriptor} />}\n {renderProps.hasSubmenu && (\n <div slot=\"descriptor\" className={descriptor}>\n <ChevronRightIcon\n size={size}\n className={style({\n scale: {\n direction: {\n rtl: -1\n }\n }\n })({direction})} />\n </div>\n )}\n </Provider>\n </>\n );\n }}\n </AriaMenuItem>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nfunction MenuTrigger(props: MenuTriggerProps) {\n return (\n <InternalMenuTriggerContext.Provider\n value={{\n align: props.align,\n direction: props.direction,\n shouldFlip: props.shouldFlip\n }}>\n <AriaMenuTrigger {...props}>\n {/* RAC sets isPressed via PressResponder when the menu is open.\n We don't want press scaling to appear to get \"stuck\", so override this. */}\n <PressResponder isPressed={false}>\n {props.children}\n </PressResponder>\n </AriaMenuTrigger>\n </InternalMenuTriggerContext.Provider>\n );\n}\n\nexport interface SubmenuTriggerProps extends Omit<AriaSubmenuTriggerProps, 'delay'> {}\n\nconst SubmenuTrigger = AriaSubmenuTrigger as (props: SubmenuTriggerProps) => JSX.Element | null;\n\nexport {MenuTrigger, SubmenuTrigger};\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined<T extends object> extends MenuProps<T>, Omit<MenuTriggerProps, 'children'> {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedMenu<T extends object>(props: ICombined<T>) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Menu.css.map"}
1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;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoGL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkGmB;;;;;AA7Zb;EAqDI;;;;EAAA;;;;EAkJP;;;;EAAA;;;;EAoHH;;;;;AA3TM;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IA+HA;;;;IAqCC;;;;IASM;;;;IAAA;;;;IAAA;;;;IA0BV;;;;;;AAlJO;EAAA;IAAA;;;;IAmDC;;;;IA+FR;;;;;;AA/FQ","sources":["7c22b67265d3212e","packages/@react-spectrum/s2/src/Menu.tsx"],"sourcesContent":["@import \"dc7300f7a31f6746\";\n@import \"ba4f3709c47b6f32\";\n@import \"188776d578edc2d4\";\n@import \"7542e2c368e43074\";\n@import \"a0ece4d15d51b6d1\";\n@import \"9190ed57f0ec543d\";\n@import \"7ea87ac6ab45824a\";\n@import \"8dd2ed15af634baa\";\n@import \"e1b788d5c243c1be\";\n@import \"227155bda7dda199\";\n@import \"9349097043636fe6\";\n@import \"329bb28fb4b64255\";\n@import \"fa4d0c98959eb626\";\n@import \"7ed629d8804e69a8\";\n@import \"c7f5b0af4e97a693\";\n@import \"04aee1e7a62e8b5b\";\n@import \"ddf352cdf38358b0\";\n","/*\n * Copyright 2024 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\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n MenuItemProps as AriaMenuItemProps,\n MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n MenuSectionProps as AriaMenuSectionProps,\n MenuTrigger as AriaMenuTrigger,\n MenuTriggerProps as AriaMenuTriggerProps,\n SubmenuTrigger as AriaSubmenuTrigger,\n SubmenuTriggerProps as AriaSubmenuTriggerProps,\n ContextValue,\n Provider,\n Separator,\n SeparatorProps\n} from 'react-aria-components';\nimport {baseColor, edgeToText, focusRing, fontRelative, size, space, style} from '../style' with {type: 'macro'};\nimport {box, iconStyles} from './Checkbox';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronRightIcon from '../ui-icons/Chevron';\nimport {createContext, forwardRef, JSX, ReactNode, useContext, useRef, useState} from 'react';\nimport {divider} from './Divider';\nimport {DOMRef, DOMRefValue, PressEvent} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, KeyboardContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon'; // chevron right removed??\nimport {ImageContext} from './Image';\nimport LinkOutIcon from '../ui-icons/LinkOut';\nimport {mergeStyles} from '../style/runtime';\nimport {Placement, useLocale} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport {pressScale} from './pressScale';\nimport {useGlobalListeners} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n// viewbox on LinkOut is super weird just because i copied the icon from designs...\n// need to strip id's from icons\n\nexport interface MenuTriggerProps extends AriaMenuTriggerProps {\n /**\n * Alignment of the menu relative to the trigger.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /**\n * Where the Menu opens relative to its trigger.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end',\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children' | 'style' | 'className' | 'dependencies'>, StyleProps {\n /**\n * The size of the Menu.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The contents of the collection.\n */\n children?: ReactNode | ((item: T) => ReactNode)\n}\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: {\n size: {\n S: [edgeToText(24), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(24)],\n M: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n L: [edgeToText(40), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(40)],\n XL: [edgeToText(48), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(48)]\n }\n },\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: {\n isPopover: 'auto'\n },\n maxWidth: {\n isPopover: 320\n },\n padding: {\n isPopover: 8\n },\n fontFamily: 'sans',\n fontSize: 'control'\n}, getAllowedOverrides());\n\nexport let section = style({\n gridColumnStart: 1,\n gridColumnEnd: -1,\n alignItems: 'center',\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid'\n});\n\nexport let sectionHeader = style<{size?: 'S' | 'M' | 'L' | 'XL'}>({\n color: 'neutral',\n gridColumnStart: 2,\n gridColumnEnd: -2,\n boxSizing: 'border-box',\n minHeight: 'control',\n paddingY: centerPadding()\n});\n\nexport let sectionHeading = style({\n font: 'ui',\n fontWeight: 'bold',\n margin: 0\n});\n\nexport let menuitem = style({\n ...focusRing(),\n boxSizing: 'border-box',\n borderRadius: 'control',\n font: 'control',\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n paddingBottom: '--labelPadding',\n backgroundColor: { // TODO: revisit color when I have access to dev mode again\n default: {\n default: 'transparent',\n isFocused: baseColor('gray-100').isFocusVisible\n }\n },\n color: {\n default: 'neutral',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n position: 'relative',\n // each menu item should take up the entire width, the subgrid will handle within the item\n gridColumnStart: 1,\n gridColumnEnd: -1,\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid',\n gridTemplateRows: {\n // min-content prevents second row from 'auto'ing to a size larger then 0 when empty\n default: 'auto minmax(0, min-content)',\n ':has([slot=description])': 'auto auto'\n },\n rowGap: {\n ':has([slot=description])': space(1)\n },\n alignItems: 'baseline',\n minHeight: 'control',\n textDecoration: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n transition: 'default'\n}, getAllowedOverrides());\n\nexport let checkmark = style({\n visibility: {\n default: 'hidden',\n isSelected: 'visible'\n },\n gridArea: 'checkmark',\n color: 'accent',\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'currentColor',\n forcedColors: 'Highlight'\n }\n },\n marginEnd: 'text-to-control',\n aspectRatio: 'square'\n});\n\nlet checkbox = style({\n gridArea: 'checkmark',\n marginEnd: 'text-to-control'\n});\n\nexport let icon = style({\n display: 'block',\n size: fontRelative(20),\n // too small default icon size is wrong, it's like the icons are 1 tshirt size bigger than the rest of the component? check again after typography changes\n // reminder, size of WF is applied via font size\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport let iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon'\n});\n\nlet image = style({\n gridArea: 'icon',\n gridRowEnd: 'span 2',\n marginEnd: 'text-to-visual',\n marginTop: fontRelative(6), // made up, need feedback\n alignSelf: 'center',\n borderRadius: 'sm',\n size: {\n default: 40,\n size: {\n S: 32,\n M: 40,\n L: 44,\n XL: 48 // TODO: feedback, Why is it 50x50, that's on 12.25 so doesn't fit the grid at all\n }\n },\n aspectRatio: 'square',\n objectFit: 'contain'\n});\n\nexport let label = style<{size: string}>({\n gridArea: 'label',\n font: 'control',\n color: '[inherit]',\n fontWeight: 'medium',\n // TODO: token values for padding not defined yet, revisit\n marginTop: '--labelPadding'\n});\n\nexport let description = style({\n gridArea: 'description',\n font: {\n default: 'ui-sm',\n size: {\n S: 'ui-xs',\n M: 'ui-sm',\n L: 'ui',\n XL: 'ui-lg'\n }\n },\n color: {\n default: 'neutral-subdued',\n // Ideally this would use the same token as hover, but we don't have access to that here.\n // TODO: should we always consider isHovered and isFocused to be the same thing?\n isFocused: 'gray-800',\n isDisabled: 'disabled'\n },\n transition: 'default'\n});\n\nlet value = style({\n gridArea: 'value',\n marginStart: 8\n});\n\nlet keyboard = style({\n gridArea: 'keyboard',\n marginStart: 8,\n font: 'ui',\n fontWeight: 'light',\n color: {\n default: 'gray-600',\n isDisabled: 'disabled',\n forcedColors: {\n isDisabled: 'GrayText'\n }\n },\n background: 'gray-25',\n unicodeBidi: 'plaintext'\n});\n\nlet descriptor = style({\n gridArea: 'descriptor',\n marginStart: 8,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalMenuContext = createContext<{size: 'S' | 'M' | 'L' | 'XL', isSubmenu: boolean}>({size: 'M', isSubmenu: false});\nlet InternalMenuTriggerContext = createContext<Omit<MenuTriggerProps, 'children'> | null>(null);\n\n/**\n * Menus display a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MenuContext);\n let {isSubmenu, size: ctxSize} = useContext(InternalMenuContext);\n let {\n children,\n size = ctxSize,\n UNSAFE_style,\n UNSAFE_className,\n styles\n } = props;\n let ctx = useContext(InternalMenuTriggerContext);\n let {align = 'start', direction = 'bottom', shouldFlip} = ctx ?? {};\n\n // TODO: change offset/crossoffset based on size? scale?\n // actual values?\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n if (isSubmenu) {\n initialPlacement = 'end top' as Placement;\n }\n\n let content = (\n <InternalMenuContext.Provider value={{size, isSubmenu: true}}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <AriaMenu\n {...props}\n className={menu({size, isPopover: !!ctx || isSubmenu}, ctx ? null : styles)}>\n {children}\n </AriaMenu>\n </Provider>\n </InternalMenuContext.Provider>\n );\n\n if (ctx || isSubmenu) {\n return (\n <PopoverBase\n ref={ref}\n hideArrow\n placement={initialPlacement}\n shouldFlip={shouldFlip}\n // For submenus, the offset from the edge of the popover should be 10px.\n // Subtract 8px for the padding around the parent menu.\n offset={isSubmenu ? -2 : 8}\n // Offset by padding + border so that the first item in a submenu lines up with the parent menu item.\n crossOffset={isSubmenu ? -9 : 0}\n UNSAFE_style={UNSAFE_style}\n UNSAFE_className={UNSAFE_className}\n styles={styles}>\n {content}\n </PopoverBase>\n );\n }\n\n return content;\n});\n\nexport function Divider(props: SeparatorProps) {\n return (\n <Separator\n {...props}\n className={mergeStyles(\n divider({\n size: 'M',\n orientation: 'horizontal',\n isStaticColor: false\n }), style({\n display: {\n default: 'grid',\n ':last-child': 'none'\n },\n gridColumnStart: 2,\n gridColumnEnd: -2,\n marginY: size(5) // height of the menu separator is 12px, and the divider is 2px\n })\n )} />\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends AriaMenuSectionProps<T> {}\nexport function MenuSection<T extends object>(props: MenuSectionProps<T>) {\n // remember, context doesn't work if it's around Section nor inside\n return (\n <>\n <AriaMenuSection\n {...props}\n className={section}>\n {props.children}\n </AriaMenuSection>\n <Divider />\n </>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'children' | 'style' | 'className'>, StyleProps {\n /**\n * The contents of the item.\n */\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nconst linkIconSize = {\n S: 'M',\n M: 'L',\n L: 'XL',\n XL: 'XL'\n} as const;\n\nexport function MenuItem(props: MenuItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let isLinkOut = isLink && props.target === '_blank';\n let {size} = useContext(InternalMenuContext);\n let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);\n let {direction} = useLocale();\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue}\n ref={ref}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, isFocused: (renderProps.hasSubmenu && renderProps.isOpen) || renderProps.isFocused, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n let checkboxRenderProps = {...renderProps, size, isFocused: false, isFocusVisible: false, isIndeterminate: false, isReadOnly: false, isInvalid: false, isRequired: false};\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon},\n descriptor: {render: centerBaseline({slot: 'descriptor', styles: descriptor})} // TODO: remove once we have default?\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})},\n value: {styles: value}\n }\n }],\n [KeyboardContext, {styles: keyboard({size, isDisabled: renderProps.isDisabled})}],\n [ImageContext, {styles: image({size})}]\n ]}>\n {renderProps.selectionMode === 'single' && !renderProps.hasSubmenu && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {renderProps.selectionMode === 'multiple' && !renderProps.hasSubmenu && (\n <div className={mergeStyles(checkbox, box(checkboxRenderProps))}>\n <CheckmarkIcon size={size} className={iconStyles} />\n </div>\n )}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n {isLinkOut && <LinkOutIcon size={linkIconSize[size]} className={descriptor} />}\n {renderProps.hasSubmenu && (\n <div slot=\"descriptor\" className={descriptor}>\n <ChevronRightIcon\n size={size}\n className={style({\n scale: {\n direction: {\n rtl: -1\n }\n }\n })({direction})} />\n </div>\n )}\n </Provider>\n </>\n );\n }}\n </AriaMenuItem>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nfunction MenuTrigger(props: MenuTriggerProps) {\n // RAC sets isPressed via PressResponder when the menu is open.\n // We don't want press scaling to appear to get \"stuck\", so override this.\n // For mouse interactions, menus open on press start. When the popover underlay appears\n // it covers the trigger button, causing onPressEnd to fire immediately and no press scaling\n // to occur. We override this by listening for pointerup on the document ourselves.\n let [isPressed, setPressed] = useState(false);\n let {addGlobalListener} = useGlobalListeners();\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'mouse') {\n return;\n }\n setPressed(true);\n addGlobalListener(document, 'pointerup', () => {\n setPressed(false);\n }, {once: true, capture: true});\n };\n\n return (\n <InternalMenuTriggerContext.Provider\n value={{\n align: props.align,\n direction: props.direction,\n shouldFlip: props.shouldFlip\n }}>\n <AriaMenuTrigger {...props}>\n <PressResponder onPressStart={onPressStart} isPressed={isPressed}>\n {props.children}\n </PressResponder>\n </AriaMenuTrigger>\n </InternalMenuTriggerContext.Provider>\n );\n}\n\nexport interface SubmenuTriggerProps extends Omit<AriaSubmenuTriggerProps, 'delay'> {}\n\nconst SubmenuTrigger = AriaSubmenuTrigger as (props: SubmenuTriggerProps) => JSX.Element | null;\n\nexport {MenuTrigger, SubmenuTrigger};\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined<T extends object> extends MenuProps<T>, Omit<MenuTriggerProps, 'children'> {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedMenu<T extends object>(props: ICombined<T>) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Menu.css.map"}
package/dist/Menu.mjs CHANGED
@@ -14,9 +14,10 @@ import {pressScale as $10ea7662e51a285b$export$56e8cba416805d8d} from "./pressSc
14
14
  import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
15
15
  import {jsx as $g2Qzl$jsx, jsxs as $g2Qzl$jsxs, Fragment as $g2Qzl$Fragment} from "react/jsx-runtime";
16
16
  import {Provider as $g2Qzl$Provider, Menu as $g2Qzl$Menu, Separator as $g2Qzl$Separator, MenuSection as $g2Qzl$MenuSection, MenuItem as $g2Qzl$MenuItem, MenuTrigger as $g2Qzl$MenuTrigger, SubmenuTrigger as $g2Qzl$SubmenuTrigger} from "react-aria-components";
17
- import {createContext as $g2Qzl$createContext, forwardRef as $g2Qzl$forwardRef, useContext as $g2Qzl$useContext, useRef as $g2Qzl$useRef} from "react";
17
+ import {createContext as $g2Qzl$createContext, forwardRef as $g2Qzl$forwardRef, useContext as $g2Qzl$useContext, useRef as $g2Qzl$useRef, useState as $g2Qzl$useState} from "react";
18
18
  import {useLocale as $g2Qzl$useLocale} from "react-aria";
19
19
  import {PressResponder as $g2Qzl$PressResponder} from "@react-aria/interactions";
20
+ import {useGlobalListeners as $g2Qzl$useGlobalListeners} from "@react-aria/utils";
20
21
 
21
22
  /*
22
23
  * Copyright 2024 Adobe. All rights reserved.
@@ -46,6 +47,7 @@ import {PressResponder as $g2Qzl$PressResponder} from "@react-aria/interactions"
46
47
 
47
48
 
48
49
 
50
+
49
51
  const $13afb0ea5f0ed767$export$c7e742effb1c51e2 = /*#__PURE__*/ (0, $g2Qzl$createContext)(null);
50
52
  let $13afb0ea5f0ed767$export$b1e5508a851be14d = function anonymous(props, overrides) {
51
53
  let rules = " .";
@@ -131,7 +133,7 @@ let $13afb0ea5f0ed767$export$f68e44d881264486 = function anonymous(props, overri
131
133
  }
132
134
  if (props.isFocusVisible) rules += ' _Lb';
133
135
  else rules += ' _La';
134
- rules += ' da_____z';
136
+ rules += ' da_____M';
135
137
  rules += ' dx';
136
138
  rules += ' _Nc';
137
139
  rules += ' _M-3t1z';
@@ -168,7 +170,7 @@ let $13afb0ea5f0ed767$export$f68e44d881264486 = function anonymous(props, overri
168
170
  rules += ' _f-1x99dlob';
169
171
  rules += ' _fa';
170
172
  if (props.isDisabled) {
171
- rules += ' aa_____B';
173
+ rules += ' aa_____O';
172
174
  rules += ' aj';
173
175
  } else {
174
176
  if (props.isPressed) rules += ' ao';
@@ -216,7 +218,7 @@ let $13afb0ea5f0ed767$export$292abbf31ed842a = function anonymous(props) {
216
218
  else if (props.isFocusVisible) rules += ' az';
217
219
  else if (props.isHovered) rules += ' az';
218
220
  else rules += ' ay';
219
- rules += ' -rwx0fg_e-a_____X';
221
+ rules += ' -rwx0fg_e-a______a';
220
222
  rules += ' -rwx0fg_e-b';
221
223
  rules += ' zF';
222
224
  rules += ' _bb';
@@ -413,7 +415,7 @@ let $13afb0ea5f0ed767$var$keyboard = function anonymous(props) {
413
415
  rules += ' _ea';
414
416
  rules += ' _f-1x99dlob';
415
417
  rules += ' _fa';
416
- if (props.isDisabled) rules += ' aa_____B';
418
+ if (props.isDisabled) rules += ' aa_____O';
417
419
  if (props.isDisabled) rules += ' aj';
418
420
  else rules += ' al';
419
421
  return rules;
@@ -513,7 +515,7 @@ function $13afb0ea5f0ed767$export$2e0a83ec2e27ecbb(props) {
513
515
  className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)((0, $bdf52657dac0f070$export$e8c9778bf415dd08)({
514
516
  size: 'M',
515
517
  orientation: 'horizontal',
516
- staticColor: undefined
518
+ isStaticColor: false
517
519
  }), " . _Zf _Z-uamghwj __a-3t1z __b-3hmpw A-1x1h2a6 B-1x1h2a6")
518
520
  });
519
521
  }
@@ -635,14 +637,14 @@ function $13afb0ea5f0ed767$export$2ce376c2cc3355c8(props1) {
635
637
  ]
636
638
  ],
637
639
  children: [
638
- renderProps.selectionMode === 'single' && !isLink && !renderProps.hasSubmenu && /*#__PURE__*/ (0, $g2Qzl$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
640
+ renderProps.selectionMode === 'single' && !renderProps.hasSubmenu && /*#__PURE__*/ (0, $g2Qzl$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
639
641
  size: $13afb0ea5f0ed767$var$checkmarkIconSize[size],
640
642
  className: $13afb0ea5f0ed767$export$292abbf31ed842a({
641
643
  ...renderProps,
642
644
  size: size
643
645
  })
644
646
  }),
645
- renderProps.selectionMode === 'multiple' && !isLink && !renderProps.hasSubmenu && /*#__PURE__*/ (0, $g2Qzl$jsx)("div", {
647
+ renderProps.selectionMode === 'multiple' && !renderProps.hasSubmenu && /*#__PURE__*/ (0, $g2Qzl$jsx)("div", {
646
648
  className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)($13afb0ea5f0ed767$var$checkbox, (0, $9b405e0f8095dce0$export$827f4ee28efc37)(checkboxRenderProps)),
647
649
  children: /*#__PURE__*/ (0, $g2Qzl$jsx)((0, $81cf3d4588736e7d$export$2e2bcd8739ae039), {
648
650
  size: size,
@@ -681,6 +683,23 @@ function $13afb0ea5f0ed767$export$2ce376c2cc3355c8(props1) {
681
683
  * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,
682
684
  * linking the Menu's open state with the trigger's press state.
683
685
  */ function $13afb0ea5f0ed767$export$27d2ad3c5815583e(props) {
686
+ // RAC sets isPressed via PressResponder when the menu is open.
687
+ // We don't want press scaling to appear to get "stuck", so override this.
688
+ // For mouse interactions, menus open on press start. When the popover underlay appears
689
+ // it covers the trigger button, causing onPressEnd to fire immediately and no press scaling
690
+ // to occur. We override this by listening for pointerup on the document ourselves.
691
+ let [isPressed, setPressed] = (0, $g2Qzl$useState)(false);
692
+ let { addGlobalListener: addGlobalListener } = (0, $g2Qzl$useGlobalListeners)();
693
+ let onPressStart = (e)=>{
694
+ if (e.pointerType !== 'mouse') return;
695
+ setPressed(true);
696
+ addGlobalListener(document, 'pointerup', ()=>{
697
+ setPressed(false);
698
+ }, {
699
+ once: true,
700
+ capture: true
701
+ });
702
+ };
684
703
  return /*#__PURE__*/ (0, $g2Qzl$jsx)($13afb0ea5f0ed767$var$InternalMenuTriggerContext.Provider, {
685
704
  value: {
686
705
  align: props.align,
@@ -690,7 +709,8 @@ function $13afb0ea5f0ed767$export$2ce376c2cc3355c8(props1) {
690
709
  children: /*#__PURE__*/ (0, $g2Qzl$jsx)((0, $g2Qzl$MenuTrigger), {
691
710
  ...props,
692
711
  children: /*#__PURE__*/ (0, $g2Qzl$jsx)((0, $g2Qzl$PressResponder), {
693
- isPressed: false,
712
+ onPressStart: onPressStart,
713
+ isPressed: isPressed,
694
714
  children: props.children
695
715
  })
696
716
  })
package/dist/Menu.mjs.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AA2EM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAA6D;AAE7F,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,IAAI;AAYJ,IAAI;;;;;;;;;;;;;;;;;;;AASJ,IAAI;AAMJ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDJ,IAAI;;;;;;;;;;;;;;;;;;AAkBX,IAAI;AAKG,IAAI;AAYJ,IAAI;AAKX,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASJ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,gBAAC,CAAA,GAAA,kBAAc;YAAG,GAAG,KAAK;sBAGxB,cAAA,gBAAC,CAAA,GAAA,qBAAa;gBAAE,WAAW;0BACxB,MAAM,QAAQ;;;;AAKzB;AAIA,MAAM,4CAAiB,CAAA,GAAA,qBAAiB;AAOjC,SAAS,0CAA+B,KAAmB;IAChE,qBAAO,gBAAC;AACV","sources":["packages/@react-spectrum/s2/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n MenuItemProps as AriaMenuItemProps,\n MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n MenuSectionProps as AriaMenuSectionProps,\n MenuTrigger as AriaMenuTrigger,\n MenuTriggerProps as AriaMenuTriggerProps,\n SubmenuTrigger as AriaSubmenuTrigger,\n SubmenuTriggerProps as AriaSubmenuTriggerProps,\n ContextValue,\n Provider,\n Separator,\n SeparatorProps\n} from 'react-aria-components';\nimport {baseColor, edgeToText, focusRing, fontRelative, size, space, style} from '../style' with {type: 'macro'};\nimport {box, iconStyles} from './Checkbox';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronRightIcon from '../ui-icons/Chevron';\nimport {createContext, forwardRef, JSX, ReactNode, useContext, useRef} from 'react';\nimport {divider} from './Divider';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, KeyboardContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon'; // chevron right removed??\nimport {ImageContext} from './Image';\nimport LinkOutIcon from '../ui-icons/LinkOut';\nimport {mergeStyles} from '../style/runtime';\nimport {Placement, useLocale} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport {pressScale} from './pressScale';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n// viewbox on LinkOut is super weird just because i copied the icon from designs...\n// need to strip id's from icons\n\nexport interface MenuTriggerProps extends AriaMenuTriggerProps {\n /**\n * Alignment of the menu relative to the trigger.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /**\n * Where the Menu opens relative to its trigger.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end',\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children' | 'style' | 'className' | 'dependencies'>, StyleProps {\n /**\n * The size of the Menu.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The contents of the collection.\n */\n children?: ReactNode | ((item: T) => ReactNode)\n}\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: {\n size: {\n S: [edgeToText(24), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(24)],\n M: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n L: [edgeToText(40), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(40)],\n XL: [edgeToText(48), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(48)]\n }\n },\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: {\n isPopover: 'auto'\n },\n maxWidth: {\n isPopover: 320\n },\n padding: {\n isPopover: 8\n },\n fontFamily: 'sans',\n fontSize: 'control'\n}, getAllowedOverrides());\n\nexport let section = style({\n gridColumnStart: 1,\n gridColumnEnd: -1,\n alignItems: 'center',\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid'\n});\n\nexport let sectionHeader = style<{size?: 'S' | 'M' | 'L' | 'XL'}>({\n color: 'neutral',\n gridColumnStart: 2,\n gridColumnEnd: -2,\n boxSizing: 'border-box',\n minHeight: 'control',\n paddingY: centerPadding()\n});\n\nexport let sectionHeading = style({\n font: 'ui',\n fontWeight: 'bold',\n margin: 0\n});\n\nexport let menuitem = style({\n ...focusRing(),\n boxSizing: 'border-box',\n borderRadius: 'control',\n font: 'control',\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n paddingBottom: '--labelPadding',\n backgroundColor: { // TODO: revisit color when I have access to dev mode again\n default: {\n default: 'transparent',\n isFocused: baseColor('gray-100').isFocusVisible\n }\n },\n color: {\n default: 'neutral',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n position: 'relative',\n // each menu item should take up the entire width, the subgrid will handle within the item\n gridColumnStart: 1,\n gridColumnEnd: -1,\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid',\n gridTemplateRows: {\n // min-content prevents second row from 'auto'ing to a size larger then 0 when empty\n default: 'auto minmax(0, min-content)',\n ':has([slot=description])': 'auto auto'\n },\n rowGap: {\n ':has([slot=description])': space(1)\n },\n alignItems: 'baseline',\n minHeight: 'control',\n textDecoration: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n transition: 'default'\n}, getAllowedOverrides());\n\nexport let checkmark = style({\n visibility: {\n default: 'hidden',\n isSelected: 'visible'\n },\n gridArea: 'checkmark',\n color: 'accent',\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'currentColor',\n forcedColors: 'Highlight'\n }\n },\n marginEnd: 'text-to-control',\n aspectRatio: 'square'\n});\n\nlet checkbox = style({\n gridArea: 'checkmark',\n marginEnd: 'text-to-control'\n});\n\nexport let icon = style({\n display: 'block',\n size: fontRelative(20),\n // too small default icon size is wrong, it's like the icons are 1 tshirt size bigger than the rest of the component? check again after typography changes\n // reminder, size of WF is applied via font size\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport let iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon'\n});\n\nlet image = style({\n gridArea: 'icon',\n gridRowEnd: 'span 2',\n marginEnd: 'text-to-visual',\n marginTop: fontRelative(6), // made up, need feedback\n alignSelf: 'center',\n borderRadius: 'sm',\n size: {\n default: 40,\n size: {\n S: 32,\n M: 40,\n L: 44,\n XL: 48 // TODO: feedback, Why is it 50x50, that's on 12.25 so doesn't fit the grid at all\n }\n },\n aspectRatio: 'square',\n objectFit: 'contain'\n});\n\nexport let label = style<{size: string}>({\n gridArea: 'label',\n font: 'control',\n color: '[inherit]',\n fontWeight: 'medium',\n // TODO: token values for padding not defined yet, revisit\n marginTop: '--labelPadding'\n});\n\nexport let description = style({\n gridArea: 'description',\n font: {\n default: 'ui-sm',\n size: {\n S: 'ui-xs',\n M: 'ui-sm',\n L: 'ui',\n XL: 'ui-lg'\n }\n },\n color: {\n default: 'neutral-subdued',\n // Ideally this would use the same token as hover, but we don't have access to that here.\n // TODO: should we always consider isHovered and isFocused to be the same thing?\n isFocused: 'gray-800',\n isDisabled: 'disabled'\n },\n transition: 'default'\n});\n\nlet value = style({\n gridArea: 'value',\n marginStart: 8\n});\n\nlet keyboard = style({\n gridArea: 'keyboard',\n marginStart: 8,\n font: 'ui',\n fontWeight: 'light',\n color: {\n default: 'gray-600',\n isDisabled: 'disabled',\n forcedColors: {\n isDisabled: 'GrayText'\n }\n },\n background: 'gray-25',\n unicodeBidi: 'plaintext'\n});\n\nlet descriptor = style({\n gridArea: 'descriptor',\n marginStart: 8,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalMenuContext = createContext<{size: 'S' | 'M' | 'L' | 'XL', isSubmenu: boolean}>({size: 'M', isSubmenu: false});\nlet InternalMenuTriggerContext = createContext<Omit<MenuTriggerProps, 'children'> | null>(null);\n\n/**\n * Menus display a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MenuContext);\n let {isSubmenu, size: ctxSize} = useContext(InternalMenuContext);\n let {\n children,\n size = ctxSize,\n UNSAFE_style,\n UNSAFE_className,\n styles\n } = props;\n let ctx = useContext(InternalMenuTriggerContext);\n let {align = 'start', direction = 'bottom', shouldFlip} = ctx ?? {};\n\n // TODO: change offset/crossoffset based on size? scale?\n // actual values?\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n if (isSubmenu) {\n initialPlacement = 'end top' as Placement;\n }\n\n let content = (\n <InternalMenuContext.Provider value={{size, isSubmenu: true}}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <AriaMenu\n {...props}\n className={menu({size, isPopover: !!ctx || isSubmenu}, ctx ? null : styles)}>\n {children}\n </AriaMenu>\n </Provider>\n </InternalMenuContext.Provider>\n );\n\n if (ctx || isSubmenu) {\n return (\n <PopoverBase\n ref={ref}\n hideArrow\n placement={initialPlacement}\n shouldFlip={shouldFlip}\n // For submenus, the offset from the edge of the popover should be 10px.\n // Subtract 8px for the padding around the parent menu.\n offset={isSubmenu ? -2 : 8}\n // Offset by padding + border so that the first item in a submenu lines up with the parent menu item.\n crossOffset={isSubmenu ? -9 : 0}\n UNSAFE_style={UNSAFE_style}\n UNSAFE_className={UNSAFE_className}\n styles={styles}>\n {content}\n </PopoverBase>\n );\n }\n\n return content;\n});\n\nexport function Divider(props: SeparatorProps) {\n return (\n <Separator\n {...props}\n className={mergeStyles(\n divider({\n size: 'M',\n orientation: 'horizontal',\n staticColor: undefined\n }), style({\n display: {\n default: 'grid',\n ':last-child': 'none'\n },\n gridColumnStart: 2,\n gridColumnEnd: -2,\n marginY: size(5) // height of the menu separator is 12px, and the divider is 2px\n })\n )} />\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends AriaMenuSectionProps<T> {}\nexport function MenuSection<T extends object>(props: MenuSectionProps<T>) {\n // remember, context doesn't work if it's around Section nor inside\n return (\n <>\n <AriaMenuSection\n {...props}\n className={section}>\n {props.children}\n </AriaMenuSection>\n <Divider />\n </>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'children' | 'style' | 'className'>, StyleProps {\n /**\n * The contents of the item.\n */\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nconst linkIconSize = {\n S: 'M',\n M: 'L',\n L: 'XL',\n XL: 'XL'\n} as const;\n\nexport function MenuItem(props: MenuItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let isLinkOut = isLink && props.target === '_blank';\n let {size} = useContext(InternalMenuContext);\n let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);\n let {direction} = useLocale();\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue}\n ref={ref}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, isFocused: (renderProps.hasSubmenu && renderProps.isOpen) || renderProps.isFocused, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n let checkboxRenderProps = {...renderProps, size, isFocused: false, isFocusVisible: false, isIndeterminate: false, isReadOnly: false, isInvalid: false, isRequired: false};\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon},\n descriptor: {render: centerBaseline({slot: 'descriptor', styles: descriptor})} // TODO: remove once we have default?\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})},\n value: {styles: value}\n }\n }],\n [KeyboardContext, {styles: keyboard({size, isDisabled: renderProps.isDisabled})}],\n [ImageContext, {styles: image({size})}]\n ]}>\n {renderProps.selectionMode === 'single' && !isLink && !renderProps.hasSubmenu && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {renderProps.selectionMode === 'multiple' && !isLink && !renderProps.hasSubmenu && (\n <div className={mergeStyles(checkbox, box(checkboxRenderProps))}>\n <CheckmarkIcon size={size} className={iconStyles} />\n </div>\n )}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n {isLinkOut && <LinkOutIcon size={linkIconSize[size]} className={descriptor} />}\n {renderProps.hasSubmenu && (\n <div slot=\"descriptor\" className={descriptor}>\n <ChevronRightIcon\n size={size}\n className={style({\n scale: {\n direction: {\n rtl: -1\n }\n }\n })({direction})} />\n </div>\n )}\n </Provider>\n </>\n );\n }}\n </AriaMenuItem>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nfunction MenuTrigger(props: MenuTriggerProps) {\n return (\n <InternalMenuTriggerContext.Provider\n value={{\n align: props.align,\n direction: props.direction,\n shouldFlip: props.shouldFlip\n }}>\n <AriaMenuTrigger {...props}>\n {/* RAC sets isPressed via PressResponder when the menu is open.\n We don't want press scaling to appear to get \"stuck\", so override this. */}\n <PressResponder isPressed={false}>\n {props.children}\n </PressResponder>\n </AriaMenuTrigger>\n </InternalMenuTriggerContext.Provider>\n );\n}\n\nexport interface SubmenuTriggerProps extends Omit<AriaSubmenuTriggerProps, 'delay'> {}\n\nconst SubmenuTrigger = AriaSubmenuTrigger as (props: SubmenuTriggerProps) => JSX.Element | null;\n\nexport {MenuTrigger, SubmenuTrigger};\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined<T extends object> extends MenuProps<T>, Omit<MenuTriggerProps, 'children'> {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedMenu<T extends object>(props: ICombined<T>) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Menu.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA4EM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAA6D;AAE7F,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,IAAI;AAYJ,IAAI;;;;;;;;;;;;;;;;;;;AASJ,IAAI;AAMJ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDJ,IAAI;;;;;;;;;;;;;;;;;;AAkBX,IAAI;AAKG,IAAI;AAYJ,IAAI;AAKX,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASJ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBX,IAAI;AAKJ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AAgBJ,IAAI;AASJ,IAAI,0DAAsB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WAAW;QACb,GAAG;YAAC,MAAM;YAAM,SAAS;QAAI;IAC/B;IAEA,qBACE,gBAAC,iDAA2B,QAAQ;QAClC,OAAO;YACL,OAAO,MAAM,KAAK;YAClB,WAAW,MAAM,SAAS;YAC1B,YAAY,MAAM,UAAU;QAC9B;kBACA,cAAA,gBAAC,CAAA,GAAA,kBAAc;YAAG,GAAG,KAAK;sBACxB,cAAA,gBAAC,CAAA,GAAA,qBAAa;gBAAE,cAAc;gBAAc,WAAW;0BACpD,MAAM,QAAQ;;;;AAKzB;AAIA,MAAM,4CAAiB,CAAA,GAAA,qBAAiB;AAOjC,SAAS,0CAA+B,KAAmB;IAChE,qBAAO,gBAAC;AACV","sources":["packages/@react-spectrum/s2/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n MenuItemProps as AriaMenuItemProps,\n MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n MenuSectionProps as AriaMenuSectionProps,\n MenuTrigger as AriaMenuTrigger,\n MenuTriggerProps as AriaMenuTriggerProps,\n SubmenuTrigger as AriaSubmenuTrigger,\n SubmenuTriggerProps as AriaSubmenuTriggerProps,\n ContextValue,\n Provider,\n Separator,\n SeparatorProps\n} from 'react-aria-components';\nimport {baseColor, edgeToText, focusRing, fontRelative, size, space, style} from '../style' with {type: 'macro'};\nimport {box, iconStyles} from './Checkbox';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronRightIcon from '../ui-icons/Chevron';\nimport {createContext, forwardRef, JSX, ReactNode, useContext, useRef, useState} from 'react';\nimport {divider} from './Divider';\nimport {DOMRef, DOMRefValue, PressEvent} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, KeyboardContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon'; // chevron right removed??\nimport {ImageContext} from './Image';\nimport LinkOutIcon from '../ui-icons/LinkOut';\nimport {mergeStyles} from '../style/runtime';\nimport {Placement, useLocale} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport {pressScale} from './pressScale';\nimport {useGlobalListeners} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n// viewbox on LinkOut is super weird just because i copied the icon from designs...\n// need to strip id's from icons\n\nexport interface MenuTriggerProps extends AriaMenuTriggerProps {\n /**\n * Alignment of the menu relative to the trigger.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /**\n * Where the Menu opens relative to its trigger.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end',\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children' | 'style' | 'className' | 'dependencies'>, StyleProps {\n /**\n * The size of the Menu.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The contents of the collection.\n */\n children?: ReactNode | ((item: T) => ReactNode)\n}\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: {\n size: {\n S: [edgeToText(24), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(24)],\n M: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n L: [edgeToText(40), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(40)],\n XL: [edgeToText(48), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(48)]\n }\n },\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: {\n isPopover: 'auto'\n },\n maxWidth: {\n isPopover: 320\n },\n padding: {\n isPopover: 8\n },\n fontFamily: 'sans',\n fontSize: 'control'\n}, getAllowedOverrides());\n\nexport let section = style({\n gridColumnStart: 1,\n gridColumnEnd: -1,\n alignItems: 'center',\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid'\n});\n\nexport let sectionHeader = style<{size?: 'S' | 'M' | 'L' | 'XL'}>({\n color: 'neutral',\n gridColumnStart: 2,\n gridColumnEnd: -2,\n boxSizing: 'border-box',\n minHeight: 'control',\n paddingY: centerPadding()\n});\n\nexport let sectionHeading = style({\n font: 'ui',\n fontWeight: 'bold',\n margin: 0\n});\n\nexport let menuitem = style({\n ...focusRing(),\n boxSizing: 'border-box',\n borderRadius: 'control',\n font: 'control',\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n paddingBottom: '--labelPadding',\n backgroundColor: { // TODO: revisit color when I have access to dev mode again\n default: {\n default: 'transparent',\n isFocused: baseColor('gray-100').isFocusVisible\n }\n },\n color: {\n default: 'neutral',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n position: 'relative',\n // each menu item should take up the entire width, the subgrid will handle within the item\n gridColumnStart: 1,\n gridColumnEnd: -1,\n display: 'grid',\n gridTemplateAreas: [\n '. checkmark icon label value keyboard descriptor .',\n '. . . description . . . .'\n ],\n gridTemplateColumns: 'subgrid',\n gridTemplateRows: {\n // min-content prevents second row from 'auto'ing to a size larger then 0 when empty\n default: 'auto minmax(0, min-content)',\n ':has([slot=description])': 'auto auto'\n },\n rowGap: {\n ':has([slot=description])': space(1)\n },\n alignItems: 'baseline',\n minHeight: 'control',\n textDecoration: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n transition: 'default'\n}, getAllowedOverrides());\n\nexport let checkmark = style({\n visibility: {\n default: 'hidden',\n isSelected: 'visible'\n },\n gridArea: 'checkmark',\n color: 'accent',\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'currentColor',\n forcedColors: 'Highlight'\n }\n },\n marginEnd: 'text-to-control',\n aspectRatio: 'square'\n});\n\nlet checkbox = style({\n gridArea: 'checkmark',\n marginEnd: 'text-to-control'\n});\n\nexport let icon = style({\n display: 'block',\n size: fontRelative(20),\n // too small default icon size is wrong, it's like the icons are 1 tshirt size bigger than the rest of the component? check again after typography changes\n // reminder, size of WF is applied via font size\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport let iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon'\n});\n\nlet image = style({\n gridArea: 'icon',\n gridRowEnd: 'span 2',\n marginEnd: 'text-to-visual',\n marginTop: fontRelative(6), // made up, need feedback\n alignSelf: 'center',\n borderRadius: 'sm',\n size: {\n default: 40,\n size: {\n S: 32,\n M: 40,\n L: 44,\n XL: 48 // TODO: feedback, Why is it 50x50, that's on 12.25 so doesn't fit the grid at all\n }\n },\n aspectRatio: 'square',\n objectFit: 'contain'\n});\n\nexport let label = style<{size: string}>({\n gridArea: 'label',\n font: 'control',\n color: '[inherit]',\n fontWeight: 'medium',\n // TODO: token values for padding not defined yet, revisit\n marginTop: '--labelPadding'\n});\n\nexport let description = style({\n gridArea: 'description',\n font: {\n default: 'ui-sm',\n size: {\n S: 'ui-xs',\n M: 'ui-sm',\n L: 'ui',\n XL: 'ui-lg'\n }\n },\n color: {\n default: 'neutral-subdued',\n // Ideally this would use the same token as hover, but we don't have access to that here.\n // TODO: should we always consider isHovered and isFocused to be the same thing?\n isFocused: 'gray-800',\n isDisabled: 'disabled'\n },\n transition: 'default'\n});\n\nlet value = style({\n gridArea: 'value',\n marginStart: 8\n});\n\nlet keyboard = style({\n gridArea: 'keyboard',\n marginStart: 8,\n font: 'ui',\n fontWeight: 'light',\n color: {\n default: 'gray-600',\n isDisabled: 'disabled',\n forcedColors: {\n isDisabled: 'GrayText'\n }\n },\n background: 'gray-25',\n unicodeBidi: 'plaintext'\n});\n\nlet descriptor = style({\n gridArea: 'descriptor',\n marginStart: 8,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalMenuContext = createContext<{size: 'S' | 'M' | 'L' | 'XL', isSubmenu: boolean}>({size: 'M', isSubmenu: false});\nlet InternalMenuTriggerContext = createContext<Omit<MenuTriggerProps, 'children'> | null>(null);\n\n/**\n * Menus display a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MenuContext);\n let {isSubmenu, size: ctxSize} = useContext(InternalMenuContext);\n let {\n children,\n size = ctxSize,\n UNSAFE_style,\n UNSAFE_className,\n styles\n } = props;\n let ctx = useContext(InternalMenuTriggerContext);\n let {align = 'start', direction = 'bottom', shouldFlip} = ctx ?? {};\n\n // TODO: change offset/crossoffset based on size? scale?\n // actual values?\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n if (isSubmenu) {\n initialPlacement = 'end top' as Placement;\n }\n\n let content = (\n <InternalMenuContext.Provider value={{size, isSubmenu: true}}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <AriaMenu\n {...props}\n className={menu({size, isPopover: !!ctx || isSubmenu}, ctx ? null : styles)}>\n {children}\n </AriaMenu>\n </Provider>\n </InternalMenuContext.Provider>\n );\n\n if (ctx || isSubmenu) {\n return (\n <PopoverBase\n ref={ref}\n hideArrow\n placement={initialPlacement}\n shouldFlip={shouldFlip}\n // For submenus, the offset from the edge of the popover should be 10px.\n // Subtract 8px for the padding around the parent menu.\n offset={isSubmenu ? -2 : 8}\n // Offset by padding + border so that the first item in a submenu lines up with the parent menu item.\n crossOffset={isSubmenu ? -9 : 0}\n UNSAFE_style={UNSAFE_style}\n UNSAFE_className={UNSAFE_className}\n styles={styles}>\n {content}\n </PopoverBase>\n );\n }\n\n return content;\n});\n\nexport function Divider(props: SeparatorProps) {\n return (\n <Separator\n {...props}\n className={mergeStyles(\n divider({\n size: 'M',\n orientation: 'horizontal',\n isStaticColor: false\n }), style({\n display: {\n default: 'grid',\n ':last-child': 'none'\n },\n gridColumnStart: 2,\n gridColumnEnd: -2,\n marginY: size(5) // height of the menu separator is 12px, and the divider is 2px\n })\n )} />\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends AriaMenuSectionProps<T> {}\nexport function MenuSection<T extends object>(props: MenuSectionProps<T>) {\n // remember, context doesn't work if it's around Section nor inside\n return (\n <>\n <AriaMenuSection\n {...props}\n className={section}>\n {props.children}\n </AriaMenuSection>\n <Divider />\n </>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'children' | 'style' | 'className'>, StyleProps {\n /**\n * The contents of the item.\n */\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nconst linkIconSize = {\n S: 'M',\n M: 'L',\n L: 'XL',\n XL: 'XL'\n} as const;\n\nexport function MenuItem(props: MenuItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let isLinkOut = isLink && props.target === '_blank';\n let {size} = useContext(InternalMenuContext);\n let textValue = props.textValue || (typeof props.children === 'string' ? props.children : undefined);\n let {direction} = useLocale();\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue}\n ref={ref}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, isFocused: (renderProps.hasSubmenu && renderProps.isOpen) || renderProps.isFocused, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n let checkboxRenderProps = {...renderProps, size, isFocused: false, isFocusVisible: false, isIndeterminate: false, isReadOnly: false, isInvalid: false, isRequired: false};\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon},\n descriptor: {render: centerBaseline({slot: 'descriptor', styles: descriptor})} // TODO: remove once we have default?\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})},\n value: {styles: value}\n }\n }],\n [KeyboardContext, {styles: keyboard({size, isDisabled: renderProps.isDisabled})}],\n [ImageContext, {styles: image({size})}]\n ]}>\n {renderProps.selectionMode === 'single' && !renderProps.hasSubmenu && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {renderProps.selectionMode === 'multiple' && !renderProps.hasSubmenu && (\n <div className={mergeStyles(checkbox, box(checkboxRenderProps))}>\n <CheckmarkIcon size={size} className={iconStyles} />\n </div>\n )}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n {isLinkOut && <LinkOutIcon size={linkIconSize[size]} className={descriptor} />}\n {renderProps.hasSubmenu && (\n <div slot=\"descriptor\" className={descriptor}>\n <ChevronRightIcon\n size={size}\n className={style({\n scale: {\n direction: {\n rtl: -1\n }\n }\n })({direction})} />\n </div>\n )}\n </Provider>\n </>\n );\n }}\n </AriaMenuItem>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nfunction MenuTrigger(props: MenuTriggerProps) {\n // RAC sets isPressed via PressResponder when the menu is open.\n // We don't want press scaling to appear to get \"stuck\", so override this.\n // For mouse interactions, menus open on press start. When the popover underlay appears\n // it covers the trigger button, causing onPressEnd to fire immediately and no press scaling\n // to occur. We override this by listening for pointerup on the document ourselves.\n let [isPressed, setPressed] = useState(false);\n let {addGlobalListener} = useGlobalListeners();\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType !== 'mouse') {\n return;\n }\n setPressed(true);\n addGlobalListener(document, 'pointerup', () => {\n setPressed(false);\n }, {once: true, capture: true});\n };\n\n return (\n <InternalMenuTriggerContext.Provider\n value={{\n align: props.align,\n direction: props.direction,\n shouldFlip: props.shouldFlip\n }}>\n <AriaMenuTrigger {...props}>\n <PressResponder onPressStart={onPressStart} isPressed={isPressed}>\n {props.children}\n </PressResponder>\n </AriaMenuTrigger>\n </InternalMenuTriggerContext.Provider>\n );\n}\n\nexport interface SubmenuTriggerProps extends Omit<AriaSubmenuTriggerProps, 'delay'> {}\n\nconst SubmenuTrigger = AriaSubmenuTrigger as (props: SubmenuTriggerProps) => JSX.Element | null;\n\nexport {MenuTrigger, SubmenuTrigger};\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined<T extends object> extends MenuProps<T>, Omit<MenuTriggerProps, 'children'> {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedMenu<T extends object>(props: ICombined<T>) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Menu.mjs.map"}
package/dist/Meter.cjs CHANGED
@@ -46,6 +46,8 @@ const $f53cdf036c04454a$var$wrapper = function anonymous(props, overrides) {
46
46
  if (/^\s*q/.test(p)) $q = true;
47
47
  if (/^\s*r/.test(p)) $r = true;
48
48
  }
49
+ if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
50
+ else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
49
51
  if (!$U) rules += ' Uc';
50
52
  rules += ' _Zf';
51
53
  if (props.labelPosition === "side") rules += ' __h-jyg4vb';
@@ -95,9 +97,8 @@ const $f53cdf036c04454a$var$valueStyles = function anonymous(props) {
95
97
  rules += ' _eb';
96
98
  rules += ' _f-1x99dlob';
97
99
  rules += ' _fa';
98
- rules += ' aa_____x';
99
- if (props.staticColor === "black") rules += ' a_____s';
100
- else if (props.staticColor === "white") rules += ' a_____d';
100
+ rules += ' aa_____K';
101
+ if (props.isStaticColor) rules += ' a_____G';
101
102
  else if (props.isDisabled) rules += ' aj';
102
103
  else {
103
104
  if (props.isPressed) rules += ' an';
@@ -136,15 +137,14 @@ const $f53cdf036c04454a$var$trackStyles = function anonymous(props) {
136
137
  rules += ' _wf';
137
138
  rules += ' _xf';
138
139
  rules += ' _yf';
139
- rules += ' ba_____w';
140
- if (props.staticColor === "black") rules += ' b_____n';
141
- else if (props.staticColor === "white") rules += ' b____7';
140
+ rules += ' ba_____J';
141
+ if (props.isStaticColor) rules += ' b_____z';
142
142
  else rules += ' bi';
143
143
  rules += ' _Nab';
144
144
  rules += ' _Na';
145
145
  rules += ' _Lab';
146
146
  rules += ' _La';
147
- rules += ' da_____x';
147
+ rules += ' da_____K';
148
148
  rules += ' da';
149
149
  rules += ' __Q-3t1y';
150
150
  if (props.size === "XL") rules += ' ky';
@@ -162,9 +162,8 @@ const $f53cdf036c04454a$var$fillStyles = function anonymous(props) {
162
162
  rules += ' _wf';
163
163
  rules += ' _xf';
164
164
  rules += ' _yf';
165
- rules += ' ba_____x';
166
- if (props.staticColor === "black") rules += ' b_____s';
167
- else if (props.staticColor === "white") rules += ' b_____f';
165
+ rules += ' ba_____K';
166
+ if (props.isStaticColor) rules += ' b_____F';
168
167
  else if (props.variant === "negative") rules += ' b-awl6xt';
169
168
  else if (props.variant === "notice") rules += ' b-1c1g5qb';
170
169
  else if (props.variant === "positive") rules += ' b-32o7sp';
@@ -175,6 +174,7 @@ const $f53cdf036c04454a$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $aQdtU$react
175
174
  [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $f53cdf036c04454a$export$8b645da15a96b44f);
176
175
  let domRef = (0, $aQdtU$reactspectrumutils.useDOMRef)(ref);
177
176
  let { label: label, size: size = 'M', staticColor: staticColor, styles: styles, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, variant: variant = 'informative', labelPosition: labelPosition = 'top', ...groupProps } = props;
177
+ let isStaticColor = !!staticColor;
178
178
  return /*#__PURE__*/ (0, $aQdtU$reactjsxruntime.jsx)((0, $aQdtU$reactariacomponents.Meter), {
179
179
  ...groupProps,
180
180
  ref: domRef,
@@ -198,19 +198,19 @@ const $f53cdf036c04454a$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $aQdtU$react
198
198
  styles: $f53cdf036c04454a$var$valueStyles({
199
199
  size: size,
200
200
  labelAlign: 'end',
201
- staticColor: staticColor
201
+ isStaticColor: isStaticColor
202
202
  }),
203
203
  children: valueText
204
204
  }),
205
205
  /*#__PURE__*/ (0, $aQdtU$reactjsxruntime.jsx)((0, $5eb75e0c130e0669$exports.SkeletonWrapper), {
206
206
  children: /*#__PURE__*/ (0, $aQdtU$reactjsxruntime.jsx)("div", {
207
207
  className: $f53cdf036c04454a$var$trackStyles({
208
- staticColor: staticColor,
208
+ isStaticColor: isStaticColor,
209
209
  size: size
210
210
  }),
211
211
  children: /*#__PURE__*/ (0, $aQdtU$reactjsxruntime.jsx)("div", {
212
212
  className: $f53cdf036c04454a$var$fillStyles({
213
- staticColor: staticColor,
213
+ isStaticColor: isStaticColor,
214
214
  variant: variant
215
215
  }),
216
216
  style: {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA6CM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAyD;AAEjG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;AA4BC,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,KAAiB,EAAE,GAA2B;IAC3F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,SACF,KAAK,QACL,OAAO,kBACP,WAAW,UACX,MAAM,oBACN,mBAAmB,kBACnB,YAAY,WACZ,UAAU,8BACV,gBAAgB,OAChB,GAAG,YACJ,GAAG;IAEJ,qBACE,gCAAC,CAAA,GAAA,gCAAQ;QACN,GAAG,UAAU;QACd,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,8BAAQ;kBACpC;qBACA;yBACA;2BACA;QACF,GAAG;kBACF,CAAC,cAAC,UAAU,aAAE,SAAS,EAAC,iBACvB;;oBACG,uBAAS,gCAAC,CAAA,GAAA,oCAAS;wBAAE,MAAM;wBAAM,YAAW;wBAAQ,eAAe;wBAAe,aAAa;kCAAc;;oBAC7G,uBAAS,gCAAC,CAAA,GAAA,8BAAG;wBAAE,QAAQ,kCAAY;kCAAC;4BAAM,YAAY;yCAAO;wBAAW;kCAAK;;kCAC9E,gCAAC,CAAA,GAAA,yCAAc;kCACb,cAAA,gCAAC;4BAAI,WAAW,kCAAY;6CAAC;sCAAa;4BAAI;sCAC5C,cAAA,gCAAC;gCAAI,WAAW,iCAAW;iDAAC;6CAAa;gCAAO;gCAAI,OAAO;oCAAC,OAAO,aAAa;gCAAG;;;;;;;AAOjG","sources":["packages/@react-spectrum/s2/src/Meter.tsx"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {\n Meter as AriaMeter,\n MeterProps as AriaMeterProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {lightDark, style} from '../style' with {type: 'macro'};\nimport {SkeletonWrapper} from './Skeleton';\nimport {Text} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface MeterStyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/meter/#-Options) of the Meter.\n * @default 'informative'\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative',\n /**\n * The size of the Meter.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n}\n\nexport interface MeterProps extends Omit<AriaMeterProps, 'children' | 'className' | 'style'>, MeterStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst wrapper = style({\n ...bar()\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fillStyles = style<MeterStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: lightDark('informative-800', 'informative-900'), // 'informative-visual',\n variant: {\n positive: lightDark('positive-800', 'positive-900'), // 'positive-visual',\n notice: lightDark('notice-800', 'notice-900'), // 'notice-visual',\n negative: lightDark('negative-800', 'negative-900') // 'negative-visual'\n },\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n }\n});\n\n/**\n * Meters are visual representations of a quantity or an achievement.\n * Their progress is determined by user actions, rather than system actions.\n */\nexport const Meter = forwardRef(function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MeterContext);\n let domRef = useDOMRef(ref);\n\n let {\n label,\n size = 'M',\n staticColor,\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n variant = 'informative',\n labelPosition = 'top',\n ...groupProps\n } = props;\n\n return (\n <AriaMeter\n {...groupProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({\n size,\n variant,\n staticColor,\n labelPosition\n }, styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <Text styles={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</Text>}\n <SkeletonWrapper>\n <div className={trackStyles({staticColor, size})}>\n <div className={fillStyles({staticColor, variant})} style={{width: percentage + '%'}} />\n </div>\n </SkeletonWrapper>\n </>\n )}\n </AriaMeter>\n );\n});\n"],"names":[],"version":3,"file":"Meter.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA6CM,MAAM,0DAAe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s2/src/Meter.tsx"],"sourcesContent":["/*\n * Copyright 2024 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\nimport {\n Meter as AriaMeter,\n MeterProps as AriaMeterProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {lightDark, style} from '../style' with {type: 'macro'};\nimport {SkeletonWrapper} from './Skeleton';\nimport {Text} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface MeterStyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/meter/#-Options) of the Meter.\n * @default 'informative'\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative',\n /**\n * The size of the Meter.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black' | 'auto',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n}\n\nexport interface MeterProps extends Omit<AriaMeterProps, 'children' | 'className' | 'style'>, MeterStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst wrapper = style({\n ...bar()\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fillStyles = style<MeterStyleProps & {isStaticColor: boolean}>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: lightDark('informative-800', 'informative-900'), // 'informative-visual',\n variant: {\n positive: lightDark('positive-800', 'positive-900'), // 'positive-visual',\n notice: lightDark('notice-800', 'notice-900'), // 'notice-visual',\n negative: lightDark('negative-800', 'negative-900') // 'negative-visual'\n },\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'ButtonText'\n }\n});\n\n/**\n * Meters are visual representations of a quantity or an achievement.\n * Their progress is determined by user actions, rather than system actions.\n */\nexport const Meter = forwardRef(function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MeterContext);\n let domRef = useDOMRef(ref);\n\n let {\n label,\n size = 'M',\n staticColor,\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n variant = 'informative',\n labelPosition = 'top',\n ...groupProps\n } = props;\n let isStaticColor = !!staticColor;\n\n return (\n <AriaMeter\n {...groupProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({\n size,\n variant,\n staticColor,\n labelPosition\n }, styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <Text styles={valueStyles({size, labelAlign: 'end', isStaticColor})}>{valueText}</Text>}\n <SkeletonWrapper>\n <div className={trackStyles({isStaticColor, size})}>\n <div className={fillStyles({isStaticColor, variant})} style={{width: percentage + '%'}} />\n </div>\n </SkeletonWrapper>\n </>\n )}\n </AriaMeter>\n );\n});\n"],"names":[],"version":3,"file":"Meter.cjs.map"}
package/dist/Meter.css CHANGED
@@ -1,4 +1,12 @@
1
1
  @layer _.a {
2
+ .-_1de2x0q_b-c {
3
+ --s2-container-bg: white;
4
+ }
5
+
6
+ .-_1de2x0q_b-b {
7
+ --s2-container-bg: black;
8
+ }
9
+
2
10
  .Uc {
3
11
  position: relative;
4
12
  }
@@ -118,12 +126,8 @@
118
126
  color: var(--lightningcss-light, #c6c6c6) var(--lightningcss-dark, #444);
119
127
  }
120
128
 
121
- .a_____d {
122
- color: #ffffffa8;
123
- }
124
-
125
- .a_____s {
126
- color: #000000ed;
129
+ .a_____G {
130
+ color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
127
131
  }
128
132
 
129
133
  .__Hb {
@@ -218,12 +222,8 @@
218
222
  background-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
219
223
  }
220
224
 
221
- .b____7 {
222
- background-color: #ffffff1c;
223
- }
224
-
225
- .b_____n {
226
- background-color: #00000038;
225
+ .b_____z {
226
+ background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .17);
227
227
  }
228
228
 
229
229
  ._Na {
@@ -298,12 +298,8 @@
298
298
  background-color: var(--lightningcss-light, #f03823) var(--lightningcss-dark, #fc432e);
299
299
  }
300
300
 
301
- .b_____f {
302
- background-color: #fffffff0;
303
- }
304
-
305
- .b_____s {
306
- background-color: #000000ed;
301
+ .b_____F {
302
+ background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .94);
307
303
  }
308
304
  }
309
305
 
@@ -381,11 +377,11 @@
381
377
 
382
378
  @layer _.b.a {
383
379
  @media (forced-colors: active) {
384
- .aa_____x {
380
+ .aa_____K {
385
381
  color: buttontext;
386
382
  }
387
383
 
388
- .ba_____w {
384
+ .ba_____J {
389
385
  background-color: buttonface;
390
386
  }
391
387
 
@@ -397,11 +393,11 @@
397
393
  outline-style: solid;
398
394
  }
399
395
 
400
- .da_____x {
396
+ .da_____K {
401
397
  outline-color: buttontext;
402
398
  }
403
399
 
404
- .ba_____x {
400
+ .ba_____K {
405
401
  background-color: buttontext;
406
402
  }
407
403
  }
@@ -1 +1 @@
1
- {"mappings":"ACyDgB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAII;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAaD;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAtBH;EAII;;;;EAAA;;;;;AAJJ;;AAII;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAKA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAaD;;;;;;AAbC;EAAA;IAAA;;;;;;AAaD","sources":["9248845643c61064","packages/@react-spectrum/s2/src/Meter.tsx"],"sourcesContent":["@import \"a82baabbcb8c2181\";\n@import \"387ba29f17cbbc9f\";\n@import \"ae93cf6195cc0b20\";\n@import \"c4a3f6bd0d23c6e6\";\n","/*\n * Copyright 2024 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\nimport {\n Meter as AriaMeter,\n MeterProps as AriaMeterProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {lightDark, style} from '../style' with {type: 'macro'};\nimport {SkeletonWrapper} from './Skeleton';\nimport {Text} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface MeterStyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/meter/#-Options) of the Meter.\n * @default 'informative'\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative',\n /**\n * The size of the Meter.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n}\n\nexport interface MeterProps extends Omit<AriaMeterProps, 'children' | 'className' | 'style'>, MeterStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst wrapper = style({\n ...bar()\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fillStyles = style<MeterStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: lightDark('informative-800', 'informative-900'), // 'informative-visual',\n variant: {\n positive: lightDark('positive-800', 'positive-900'), // 'positive-visual',\n notice: lightDark('notice-800', 'notice-900'), // 'notice-visual',\n negative: lightDark('negative-800', 'negative-900') // 'negative-visual'\n },\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n }\n});\n\n/**\n * Meters are visual representations of a quantity or an achievement.\n * Their progress is determined by user actions, rather than system actions.\n */\nexport const Meter = forwardRef(function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MeterContext);\n let domRef = useDOMRef(ref);\n\n let {\n label,\n size = 'M',\n staticColor,\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n variant = 'informative',\n labelPosition = 'top',\n ...groupProps\n } = props;\n\n return (\n <AriaMeter\n {...groupProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({\n size,\n variant,\n staticColor,\n labelPosition\n }, styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <Text styles={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</Text>}\n <SkeletonWrapper>\n <div className={trackStyles({staticColor, size})}>\n <div className={fillStyles({staticColor, variant})} style={{width: percentage + '%'}} />\n </div>\n </SkeletonWrapper>\n </>\n )}\n </AriaMeter>\n );\n});\n"],"names":[],"version":3,"file":"Meter.css.map"}
1
+ {"mappings":"ACyDgB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAII;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAaD;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAtBH;EAII;;;;EAAA;;;;;AAJJ;;AAII;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAKA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAaD;;;;;;AAbC;EAAA;IAAA;;;;;;AAaD","sources":["9248845643c61064","packages/@react-spectrum/s2/src/Meter.tsx"],"sourcesContent":["@import \"a82baabbcb8c2181\";\n@import \"387ba29f17cbbc9f\";\n@import \"ae93cf6195cc0b20\";\n@import \"c4a3f6bd0d23c6e6\";\n","/*\n * Copyright 2024 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\nimport {\n Meter as AriaMeter,\n MeterProps as AriaMeterProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {lightDark, style} from '../style' with {type: 'macro'};\nimport {SkeletonWrapper} from './Skeleton';\nimport {Text} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface MeterStyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/meter/#-Options) of the Meter.\n * @default 'informative'\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative',\n /**\n * The size of the Meter.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black' | 'auto',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n}\n\nexport interface MeterProps extends Omit<AriaMeterProps, 'children' | 'className' | 'style'>, MeterStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst wrapper = style({\n ...bar()\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fillStyles = style<MeterStyleProps & {isStaticColor: boolean}>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: lightDark('informative-800', 'informative-900'), // 'informative-visual',\n variant: {\n positive: lightDark('positive-800', 'positive-900'), // 'positive-visual',\n notice: lightDark('notice-800', 'notice-900'), // 'notice-visual',\n negative: lightDark('negative-800', 'negative-900') // 'negative-visual'\n },\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'ButtonText'\n }\n});\n\n/**\n * Meters are visual representations of a quantity or an achievement.\n * Their progress is determined by user actions, rather than system actions.\n */\nexport const Meter = forwardRef(function Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MeterContext);\n let domRef = useDOMRef(ref);\n\n let {\n label,\n size = 'M',\n staticColor,\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n variant = 'informative',\n labelPosition = 'top',\n ...groupProps\n } = props;\n let isStaticColor = !!staticColor;\n\n return (\n <AriaMeter\n {...groupProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({\n size,\n variant,\n staticColor,\n labelPosition\n }, styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <Text styles={valueStyles({size, labelAlign: 'end', isStaticColor})}>{valueText}</Text>}\n <SkeletonWrapper>\n <div className={trackStyles({isStaticColor, size})}>\n <div className={fillStyles({isStaticColor, variant})} style={{width: percentage + '%'}} />\n </div>\n </SkeletonWrapper>\n </>\n )}\n </AriaMeter>\n );\n});\n"],"names":[],"version":3,"file":"Meter.css.map"}