@react-spectrum/s2 3.0.0-nightly-1457dedc6-250313 → 3.0.0-nightly-9d471e48d-250314

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 (106) hide show
  1. package/dist/ActionBar.cjs.map +1 -1
  2. package/dist/ActionBar.css.map +1 -1
  3. package/dist/ActionBar.mjs.map +1 -1
  4. package/dist/Add.cjs.map +1 -1
  5. package/dist/Add.mjs.map +1 -1
  6. package/dist/Asterisk.cjs.map +1 -1
  7. package/dist/Asterisk.mjs.map +1 -1
  8. package/dist/CenterBaseline.cjs.map +1 -1
  9. package/dist/CenterBaseline.css.map +1 -1
  10. package/dist/CenterBaseline.mjs.map +1 -1
  11. package/dist/Checkmark.cjs.map +1 -1
  12. package/dist/Checkmark.mjs.map +1 -1
  13. package/dist/Chevron.cjs.map +1 -1
  14. package/dist/Chevron.mjs.map +1 -1
  15. package/dist/ColorHandle.cjs.map +1 -1
  16. package/dist/ColorHandle.css.map +1 -1
  17. package/dist/ColorHandle.mjs.map +1 -1
  18. package/dist/ComboBox.cjs.map +1 -1
  19. package/dist/ComboBox.css.map +1 -1
  20. package/dist/ComboBox.mjs.map +1 -1
  21. package/dist/Cross.cjs.map +1 -1
  22. package/dist/Cross.mjs.map +1 -1
  23. package/dist/Dash.cjs.map +1 -1
  24. package/dist/Dash.mjs.map +1 -1
  25. package/dist/DialogContainer.cjs.map +1 -1
  26. package/dist/DialogContainer.mjs.map +1 -1
  27. package/dist/DialogTrigger.cjs.map +1 -1
  28. package/dist/DialogTrigger.mjs.map +1 -1
  29. package/dist/Field.cjs.map +1 -1
  30. package/dist/Field.css.map +1 -1
  31. package/dist/Field.mjs.map +1 -1
  32. package/dist/ImageCoordinator.cjs.map +1 -1
  33. package/dist/ImageCoordinator.mjs.map +1 -1
  34. package/dist/LinkOut.cjs.map +1 -1
  35. package/dist/LinkOut.mjs.map +1 -1
  36. package/dist/Menu.cjs.map +1 -1
  37. package/dist/Menu.css.map +1 -1
  38. package/dist/Menu.mjs.map +1 -1
  39. package/dist/Picker.cjs.map +1 -1
  40. package/dist/Picker.css.map +1 -1
  41. package/dist/Picker.mjs.map +1 -1
  42. package/dist/Provider.cjs.map +1 -1
  43. package/dist/Provider.css.map +1 -1
  44. package/dist/Provider.mjs.map +1 -1
  45. package/dist/Slider.cjs.map +1 -1
  46. package/dist/Slider.css.map +1 -1
  47. package/dist/Slider.mjs.map +1 -1
  48. package/dist/Tabs.cjs +1 -0
  49. package/dist/Tabs.cjs.map +1 -1
  50. package/dist/Tabs.css.map +1 -1
  51. package/dist/Tabs.mjs +1 -0
  52. package/dist/Tabs.mjs.map +1 -1
  53. package/dist/TabsPicker.cjs.map +1 -1
  54. package/dist/TabsPicker.css.map +1 -1
  55. package/dist/TabsPicker.mjs.map +1 -1
  56. package/dist/Tooltip.cjs.map +1 -1
  57. package/dist/Tooltip.css.map +1 -1
  58. package/dist/Tooltip.mjs.map +1 -1
  59. package/dist/TreeView.cjs.map +1 -1
  60. package/dist/TreeView.css.map +1 -1
  61. package/dist/TreeView.mjs.map +1 -1
  62. package/dist/pressScale.cjs.map +1 -1
  63. package/dist/pressScale.mjs.map +1 -1
  64. package/dist/types.d.ts +20 -20
  65. package/dist/types.d.ts.map +1 -1
  66. package/icons/Skeleton.cjs.map +1 -1
  67. package/icons/Skeleton.css.map +1 -1
  68. package/icons/Skeleton.mjs.map +1 -1
  69. package/package.json +18 -18
  70. package/src/ActionBar.tsx +9 -2
  71. package/src/Calendar.tsx +2 -1
  72. package/src/CenterBaseline.tsx +1 -1
  73. package/src/ColorHandle.tsx +2 -2
  74. package/src/ComboBox.tsx +2 -2
  75. package/src/DateField.tsx +1 -1
  76. package/src/DatePicker.tsx +1 -1
  77. package/src/DateRangePicker.tsx +1 -1
  78. package/src/DialogContainer.tsx +2 -2
  79. package/src/DialogTrigger.tsx +2 -1
  80. package/src/Field.tsx +2 -2
  81. package/src/ImageCoordinator.tsx +3 -3
  82. package/src/ListBox.tsx +3 -2
  83. package/src/Menu.tsx +5 -5
  84. package/src/Picker.tsx +2 -2
  85. package/src/Provider.tsx +1 -1
  86. package/src/RangeCalendar.tsx +2 -1
  87. package/src/Skeleton.tsx +4 -4
  88. package/src/Slider.tsx +1 -1
  89. package/src/Tabs.tsx +4 -3
  90. package/src/TabsPicker.tsx +1 -1
  91. package/src/TimeField.tsx +1 -1
  92. package/src/Toolbar.tsx +2 -1
  93. package/src/Tooltip.tsx +2 -2
  94. package/src/TreeView.tsx +2 -2
  95. package/src/page.macro.ts +3 -3
  96. package/src/pressScale.ts +1 -1
  97. package/src/style-utils.ts +2 -2
  98. package/style/dist/spectrum-theme.cjs.map +1 -1
  99. package/style/dist/spectrum-theme.mjs.map +1 -1
  100. package/style/dist/style-macro.cjs.map +1 -1
  101. package/style/dist/style-macro.mjs.map +1 -1
  102. package/style/dist/types.d.ts +4 -4
  103. package/style/dist/types.d.ts.map +1 -1
  104. package/style/spectrum-theme.ts +5 -5
  105. package/style/style-macro.ts +3 -3
  106. package/style/tokens.ts +22 -6
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA+EM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAAiF;AAC1H,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWX,MAAM;AAON,MAAM;AAQN,MAAM;;;;;;;;;;AASN,IAAI,+DAA2B,CAAA,GAAA,oBAAY,EAAE;AAC7C,SAAS,6BAAyB,MAAqB,EAAE,GAAoC;IAC3F,CAAC,QAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,QAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,SAAQ,CAAA,GAAA,yCAAW,EAAE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\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 */\nimport {\n PopoverProps as AriaPopoverProps,\n Select as AriaSelect,\n SelectProps as AriaSelectProps,\n Button,\n ContextValue,\n DEFAULT_SLOT,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxProps,\n Provider,\n SelectValue\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {\n checkmark,\n description,\n icon,\n label,\n menuitem,\n sectionHeader,\n sectionHeading\n} from './Menu';\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronIcon from '../ui-icons/Chevron';\nimport {edgeToText, focusRing, size, style} from '../style' with {type: 'macro'};\nimport {fieldInput, StyleProps} from './style-utils' with {type: 'macro'};\nimport {\n FieldLabel\n} from './Field';\nimport {FocusableRef, FocusableRefValue, SpectrumLabelableProps} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon';\nimport {Placement} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {pressScale} from './pressScale';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, ReactNode, useContext, useRef} from 'react';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nexport interface PickerStyleProps {\n}\nexport interface PickerProps<T extends object> extends\n Omit<AriaSelectProps<T>, 'children' | 'style' | 'className' | 'placeholder'>,\n PickerStyleProps,\n StyleProps,\n SpectrumLabelableProps,\n Pick<ListBoxProps<T>, 'items'>,\n Pick<AriaPopoverProps, 'shouldFlip'> {\n /** The contents of the collection. */\n children: ReactNode | ((item: T) => ReactNode),\n /**\n * Direction the menu will render relative to the Picker.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top',\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n menuWidth?: number,\n /** Density of the tabs, affects the height of the picker. */\n density: 'compact' | 'regular',\n /**\n * If the tab picker should only display icon and no text for the button label.\n * @default 'show\n */\n labelBehavior?: 'show' | 'hide',\n /** Id for the SelectedValue so we can label using it. */\n valueId?: string\n}\nexport const PickerContext = createContext<ContextValue<Partial<PickerProps<any>>, FocusableRefValue<HTMLButtonElement>>>(null);\nconst inputButton = style({\n ...focusRing(),\n ...fieldInput(),\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n position: 'relative',\n font: 'ui',\n display: 'flex',\n textAlign: 'start',\n borderStyle: 'none',\n borderRadius: 'sm',\n alignItems: 'center',\n transition: 'default',\n columnGap: 'text-to-visual',\n paddingX: 0,\n backgroundColor: 'transparent',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n maxWidth: {\n isQuiet: 'max'\n },\n disableTapHighlight: true,\n height: {\n default: 48,\n density: {\n compact: 32\n }\n },\n boxSizing: 'border-box'\n});\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: 'auto',\n padding: 8,\n fontFamily: 'sans',\n fontSize: 'control'\n});\nconst valueStyles = style({\n flexGrow: 0,\n truncate: true,\n display: 'flex',\n alignItems: 'center',\n height: 'full'\n});\nconst iconStyles = style({\n flexShrink: 0,\n rotate: 90,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\nconst iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon',\n paddingStart: {\n labelBehavior: {\n hide: size(6)\n }\n }\n});\nlet InsideSelectValueContext = createContext(false);\nfunction Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PickerContext);\n let domRef = useFocusableRef(ref);\n props = useFormProps(props);\n let {\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n children,\n items,\n density,\n labelBehavior = 'show',\n valueId,\n ...pickerProps\n } = props;\n let isQuiet = true;\n const menuOffset: number = 6;\n const size = 'M';\n let ariaLabelledby = props['aria-labelledby'] ?? '';\n return (\n <div>\n <AriaSelect\n {...pickerProps}\n aria-labelledby={`${labelBehavior === 'hide' ? valueId : ''} ${ariaLabelledby}`}>\n {({isOpen}) => (\n <>\n <FieldLabel isQuiet={isQuiet} />\n <Button\n ref={domRef}\n style={renderProps => pressScale(domRef)(renderProps)}\n // Prevent press scale from sticking while Picker is open.\n // @ts-ignore\n isPressed={false}\n className={renderProps => inputButton({\n ...renderProps,\n size: 'M',\n isOpen,\n isQuiet,\n density\n })}>\n <SelectValue className={valueStyles + ' ' + raw('&> * {display: none;}')}>\n {({defaultChildren}) => {\n return (\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {\n render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({labelBehavior})}),\n styles: icon\n }\n }\n }],\n [TextContext, {\n slots: {\n // Default slot is useful when converting other collections to PickerItems.\n [DEFAULT_SLOT]: {\n id: valueId,\n styles: style({\n display: {\n default: 'block',\n labelBehavior: {\n hide: 'none'\n }\n },\n flexGrow: 1,\n truncate: true\n })({labelBehavior})\n }\n }\n }],\n [InsideSelectValueContext, true]\n ]}>\n {defaultChildren}\n </Provider>\n );\n }}\n </SelectValue>\n <ChevronIcon\n size={size}\n className={iconStyles} />\n </Button>\n <PopoverBase\n hideArrow\n offset={menuOffset}\n placement={`${direction} ${align}` as Placement}\n shouldFlip={shouldFlip}\n styles={style({\n marginStart: -12,\n minWidth: 192,\n width: '[calc(var(--trigger-width) + (-2 * self(marginStart)))]'\n })}>\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 <ListBox\n items={items}\n className={menu}>\n {children}\n </ListBox>\n </Provider>\n </PopoverBase>\n </>\n )}\n </AriaSelect>\n <TabLine isDisabled={props.isDisabled} />\n </div>\n );\n}\n/**\n * Pickers allow users to choose a single option from a collapsible list of options when space is limited.\n */\nlet _Picker = /*#__PURE__*/ (forwardRef as forwardRefType)(Picker);\nexport {_Picker as Picker};\n\n\nconst selectedIndicator = style({\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: '[2px]',\n borderStyle: 'none',\n borderRadius: 'full',\n marginTop: '[-2px]',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\nfunction TabLine(props) {\n return <div className={selectedIndicator(props)} />;\n}\n\n\nexport interface PickerItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {\n children: ReactNode\n}\nexport function PickerItem(props: PickerItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n const size = 'M';\n return (\n <ListBoxItem\n {...props}\n ref={ref}\n textValue={props.textValue || (typeof props.children === 'string' ? props.children as string : undefined)}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n return (\n <DefaultProvider\n context={IconContext}\n value={{slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({})}), styles: icon}\n }}}>\n <DefaultProvider\n context={TextContext}\n value={{\n slots: {\n [DEFAULT_SLOT]: {styles: label({size})}\n }\n }}>\n {!isLink && <CheckmarkIcon size={size} className={checkmark({...renderProps, size})} />}\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n </DefaultProvider>\n </DefaultProvider>\n );\n }}\n </ListBoxItem>\n );\n}\n// A Context.Provider that only sets a value if not inside SelectValue.\nfunction DefaultProvider({context, value, children}: {context: React.Context<any>, value: any, children: any}) {\n let inSelectValue = useContext(InsideSelectValueContext);\n if (inSelectValue) {\n return children;\n }\n return <context.Provider value={value}>{children}</context.Provider>;\n}\n"],"names":[],"version":3,"file":"TabsPicker.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA+EM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAAiF;AAC1H,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWX,MAAM;AAON,MAAM;AAQN,MAAM;;;;;;;;;;AASN,IAAI,+DAA2B,CAAA,GAAA,oBAAY,EAAE;AAC7C,SAAS,6BAAyB,MAAqB,EAAE,GAAoC;IAC3F,CAAC,QAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,QAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,SAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,aACF,YAAY,iBACZ,QAAQ,qBACR,aAAa,gBACb,QAAQ,SACR,KAAK,WACL,OAAO,iBACP,gBAAgB,iBAChB,OAAO,EACP,GAAG,aACJ,GAAG;IACJ,IAAI,UAAU;IACd,MAAM,aAAqB;IAC3B,MAAM,OAAO;IACb,IAAI,iBAAiB,MAAK,CAAC,kBAAkB,IAAI;IACjD,qBACE,iBAAC;;0BACC,gBAAC,CAAA,GAAA,aAAS;gBACP,GAAG,WAAW;gBACf,mBAAiB,GAAG,kBAAkB,SAAS,UAAU,GAAG,CAAC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C,OAAO;wBACb,MAAM;4BAAC,QAAQ,CAAA,GAAA,yCAAa,EAAE;gCAAC,MAAM;gCAAQ,QAAQ,wCAAkB,CAAC;4BAAE;4BAAI,QAAQ,CAAA,GAAA,yCAAG;wBAAC;oBAC5F;gBAAC;0BACD,cAAA,iBAAC;oBACC,SAAS,CAAA,GAAA,yCAAU;oBACnB,OAAO;wBACL,OAAO;4BACL,CAAC,CAAA,GAAA,mBAAW,EAAE,EAAE;gCAAC,QAAQ,CAAA,GAAA,yCAAI,EAAE;0CAAC;gCAAI;4BAAE;wBACxC;oBACF;;wBACC,CAAC,wBAAU,gBAAC,CAAA,GAAA,wCAAY;4BAAE,MAAM;4BAAM,WAAW,CAAA,GAAA,wCAAQ,EAAE;gCAAC,GAAG,WAAW;sCAAE;4BAAI;;wBAChF,OAAO,aAAa,yBAAW,gBAAC,CAAA,GAAA,yCAAG;sCAAG;6BAAmB;;;;QAIlE;;AAGN;AACA,uEAAuE;AACvE,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,YAAE,QAAQ,EAA2D;IAC3G,IAAI,gBAAgB,CAAA,GAAA,iBAAS,EAAE;IAC/B,IAAI,eACF,OAAO;IAET,qBAAO,gBAAC,QAAQ,QAAQ;QAAC,OAAO;kBAAQ;;AAC1C","sources":["packages/@react-spectrum/s2/src/TabsPicker.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 */\nimport {\n PopoverProps as AriaPopoverProps,\n Select as AriaSelect,\n SelectProps as AriaSelectProps,\n Button,\n ContextValue,\n DEFAULT_SLOT,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxProps,\n Provider,\n SelectValue\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {\n checkmark,\n description,\n icon,\n label,\n menuitem,\n sectionHeader,\n sectionHeading\n} from './Menu';\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronIcon from '../ui-icons/Chevron';\nimport {edgeToText, focusRing, size, style} from '../style' with {type: 'macro'};\nimport {fieldInput, StyleProps} from './style-utils' with {type: 'macro'};\nimport {\n FieldLabel\n} from './Field';\nimport {FocusableRef, FocusableRefValue, SpectrumLabelableProps} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon';\nimport {Placement} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {pressScale} from './pressScale';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, ReactNode, useContext, useRef} from 'react';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nexport interface PickerStyleProps {\n}\nexport interface PickerProps<T extends object> extends\n Omit<AriaSelectProps<T>, 'children' | 'style' | 'className' | 'placeholder'>,\n PickerStyleProps,\n StyleProps,\n SpectrumLabelableProps,\n Pick<ListBoxProps<T>, 'items'>,\n Pick<AriaPopoverProps, 'shouldFlip'> {\n /** The contents of the collection. */\n children: ReactNode | ((item: T) => ReactNode),\n /**\n * Direction the menu will render relative to the Picker.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top',\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n menuWidth?: number,\n /** Density of the tabs, affects the height of the picker. */\n density: 'compact' | 'regular',\n /**\n * If the tab picker should only display icon and no text for the button label.\n * @default 'show\n */\n labelBehavior?: 'show' | 'hide',\n /** Id for the SelectedValue so we can label using it. */\n valueId?: string\n}\nexport const PickerContext = createContext<ContextValue<Partial<PickerProps<any>>, FocusableRefValue<HTMLButtonElement>>>(null);\nconst inputButton = style({\n ...focusRing(),\n ...fieldInput(),\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n position: 'relative',\n font: 'ui',\n display: 'flex',\n textAlign: 'start',\n borderStyle: 'none',\n borderRadius: 'sm',\n alignItems: 'center',\n transition: 'default',\n columnGap: 'text-to-visual',\n paddingX: 0,\n backgroundColor: 'transparent',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n maxWidth: {\n isQuiet: 'max'\n },\n disableTapHighlight: true,\n height: {\n default: 48,\n density: {\n compact: 32\n }\n },\n boxSizing: 'border-box'\n});\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: 'auto',\n padding: 8,\n fontFamily: 'sans',\n fontSize: 'control'\n});\nconst valueStyles = style({\n flexGrow: 0,\n truncate: true,\n display: 'flex',\n alignItems: 'center',\n height: 'full'\n});\nconst iconStyles = style({\n flexShrink: 0,\n rotate: 90,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\nconst iconCenterWrapper = style({\n display: 'flex',\n gridArea: 'icon',\n paddingStart: {\n labelBehavior: {\n hide: size(6)\n }\n }\n});\nlet InsideSelectValueContext = createContext(false);\nfunction Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PickerContext);\n let domRef = useFocusableRef(ref);\n props = useFormProps(props);\n let {\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n children,\n items,\n density,\n labelBehavior = 'show',\n valueId,\n ...pickerProps\n } = props;\n let isQuiet = true;\n const menuOffset: number = 6;\n const size = 'M';\n let ariaLabelledby = props['aria-labelledby'] ?? '';\n return (\n <div>\n <AriaSelect\n {...pickerProps}\n aria-labelledby={`${labelBehavior === 'hide' ? valueId : ''} ${ariaLabelledby}`}>\n {({isOpen}) => (\n <>\n <FieldLabel isQuiet={isQuiet} />\n <Button\n ref={domRef}\n style={renderProps => pressScale(domRef)(renderProps)}\n // Prevent press scale from sticking while Picker is open.\n // @ts-ignore\n isPressed={false}\n className={renderProps => inputButton({\n ...renderProps,\n size: 'M',\n isOpen,\n isQuiet,\n density\n })}>\n <SelectValue className={valueStyles + ' ' + raw('&> * {display: none;}')}>\n {({defaultChildren}) => {\n return (\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {\n render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({labelBehavior})}),\n styles: icon\n }\n }\n }],\n [TextContext, {\n slots: {\n // Default slot is useful when converting other collections to PickerItems.\n [DEFAULT_SLOT]: {\n id: valueId,\n styles: style({\n display: {\n default: 'block',\n labelBehavior: {\n hide: 'none'\n }\n },\n flexGrow: 1,\n truncate: true\n })({labelBehavior})\n }\n }\n }],\n [InsideSelectValueContext, true]\n ]}>\n {defaultChildren}\n </Provider>\n );\n }}\n </SelectValue>\n <ChevronIcon\n size={size}\n className={iconStyles} />\n </Button>\n <PopoverBase\n hideArrow\n offset={menuOffset}\n placement={`${direction} ${align}` as Placement}\n shouldFlip={shouldFlip}\n styles={style({\n marginStart: -12,\n minWidth: 192,\n width: '[calc(var(--trigger-width) + (-2 * self(marginStart)))]'\n })}>\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 <ListBox\n items={items}\n className={menu}>\n {children}\n </ListBox>\n </Provider>\n </PopoverBase>\n </>\n )}\n </AriaSelect>\n <TabLine isDisabled={props.isDisabled} />\n </div>\n );\n}\n/**\n * Pickers allow users to choose a single option from a collapsible list of options when space is limited.\n */\nlet _Picker = /*#__PURE__*/ (forwardRef as forwardRefType)(Picker);\nexport {_Picker as Picker};\n\n\nconst selectedIndicator = style({\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: '[2px]',\n borderStyle: 'none',\n borderRadius: 'full',\n marginTop: '[-2px]',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\nfunction TabLine(props) {\n return <div className={selectedIndicator(props)} />;\n}\n\n\nexport interface PickerItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {\n children: ReactNode\n}\nexport function PickerItem(props: PickerItemProps): ReactNode {\n let ref = useRef(null);\n let isLink = props.href != null;\n const size = 'M';\n return (\n <ListBoxItem\n {...props}\n ref={ref}\n textValue={props.textValue || (typeof props.children === 'string' ? props.children as string : undefined)}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n return (\n <DefaultProvider\n context={IconContext}\n value={{slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({})}), styles: icon}\n }}}>\n <DefaultProvider\n context={TextContext}\n value={{\n slots: {\n [DEFAULT_SLOT]: {styles: label({size})}\n }\n }}>\n {!isLink && <CheckmarkIcon size={size} className={checkmark({...renderProps, size})} />}\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n </DefaultProvider>\n </DefaultProvider>\n );\n }}\n </ListBoxItem>\n );\n}\n// A Context.Provider that only sets a value if not inside SelectValue.\nfunction DefaultProvider({context, value, children}: {context: React.Context<any>, value: any, children: any}) {\n let inSelectValue = useContext(InsideSelectValueContext);\n if (inSelectValue) {\n return children;\n }\n return <context.Provider value={value}>{children}</context.Provider>;\n}\n"],"names":[],"version":3,"file":"TabsPicker.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;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GAAG,WAAW;6BAAE;YAAW;kBAChF,CAAA,4BACC;;kCACE,gCAAC,CAAA,GAAA,uCAAW;kCACV,cAAA,gCAAC;4BAAI,WAAW,kCAAY;4BAAc,OAAM;4BAA6B,OAAM;4BAAK,QAAO;4BAAI,SAAQ;sCACzG,cAAA,gCAAC;gCAAK,GAAE;;;;oBAGX;;;;AAKX;AAOO,SAAS,0CAAe,KAA0B;IACvD,IAAI,oBACF,gBAAgB,eAChB,WAAW,UACX,MAAM,aACN,SAAS,cACT,UAAU,EACV,GAAG,cACJ,GAAG;IAEJ,qBACE,gCAAC,CAAA,GAAA,yCAAiB;QAAG,GAAG,YAAY;kBAClC,cAAA,gCAAC,oDAA8B,QAAQ;YACrC,OAAO;gBACL,kBAAkB;gBAClB,aAAa;gBACb,QAAQ;gBACR,WAAW;gBACX,YAAY;YACd;sBACC,MAAM,QAAQ;;;AAIvB;AAMO,SAAS,0CAAgB,KAAgB;IAC9C,qBAAO,gCAAC;AACV","sources":["packages/@react-spectrum/s2/src/Tooltip.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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps) {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAmCD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DN,MAAM;;;;;;;;;;;;AAmBN,IAAI,oEAAgC,CAAA,GAAA,0BAAY,EAAgC,CAAC;AAK1E,MAAM,0DAAU,CAAA,GAAA,uBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACjG,IAAI,YAAC,QAAQ,gBAAE,YAAY,oBAAE,mBAAmB,IAAG,GAAG;IACtD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,eAChB,WAAW,UACX,MAAM,aACN,YAAY,mBACZ,UAAU,EACX,GAAG,CAAA,GAAA,uBAAS,EAAE;IACf,IAAI,cAAc,CAAA,GAAA,uB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;;;AAIvB;AAMO,SAAS,0CAAgB,KAAgB;IAC9C,qBAAO,gCAAC;AACV","sources":["packages/@react-spectrum/s2/src/Tooltip.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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps): ReactNode {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined): ReactNode {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"AC6CgB;EAAA;;;;EAAA;;;;;;EAAA;IAAA;;;;;;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;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EA6DI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;;;AA7DJ;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA","sources":["aa7688246f893a38","packages/@react-spectrum/s2/src/Tooltip.tsx"],"sourcesContent":["@import \"98a0a1b80e895d38\";\n@import \"c07030e64bc8758c\";\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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps) {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.css.map"}
1
+ {"mappings":"AC6CgB;EAAA;;;;EAAA;;;;;;EAAA;IAAA;;;;;;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;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EA6DI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;;;AA7DJ;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA","sources":["aa7688246f893a38","packages/@react-spectrum/s2/src/Tooltip.tsx"],"sourcesContent":["@import \"98a0a1b80e895d38\";\n@import \"c07030e64bc8758c\";\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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps): ReactNode {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined): ReactNode {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.css.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAmCD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DN,MAAM;;;;;;;;;;;;AAmBN,IAAI,oEAAgC,CAAA,GAAA,oBAAY,EAAgC,CAAC;AAK1E,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACjG,IAAI,YAAC,QAAQ,gBAAE,YAAY,oBAAE,mBAAmB,IAAG,GAAG;IACtD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,eAChB,WAAW,UACX,MAAM,aACN,YAAY,mBACZ,UAAU,EACX,GAAG,CAAA,GAAA,iBAAS,EAAE;IACf,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,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AMO,SAAS,0CAAgB,KAAgB;IAC9C,qBAAO,gBAAC;AACV","sources":["packages/@react-spectrum/s2/src/Tooltip.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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps) {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined) {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.mjs.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAmCD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DN,MAAM;;;;;;;;;;;;AAmBN,IAAI,oEAAgC,CAAA,GAAA,oBAAY,EAAgC,CAAC;AAK1E,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACjG,IAAI,YAAC,QAAQ,gBAAE,YAAY,oBAAE,mBAAmB,IAAG,GAAG;IACtD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,eAChB,WAAW,UACX,MAAM,aACN,YAAY,mBACZ,UAAU,EACX,GAAG,CAAA,GAAA,iBAAS,EAAE;IACf,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAClC,IAAI,CAAC,cAAc,gBAAgB,GAAG,CAAA,GAAA,eAAO,EAAE;IAE/C,0DAA0D;IAC1D,IAAI,aAAa,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC3B,OAA4C,OAAO,GAAG;QACvD,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;YACT,IAAI,uBAAuB,OAAO,WAAW,cAAc,OAAO,gBAAgB,CAAC,IAAI,YAAY,GAAG;YACtG,IAAI,yBAAyB,IAC3B,gBAAgB,SAAS,sBAAsB;QAEnD;IACF,GAAG;QAAC;QAAQ;QAAW;KAAO;IAE9B,qBACE,gBAAC,CAAA,GAAA,cAAU;QACR,GAAG,KAAK;QACT,qBAAqB;QACrB,kBAAkB;QAClB,aAAa;QACb,QAAQ;QACR,WAAW;QACX,YAAY;QACZ,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,8BAAQ;gBAAC,GAAG,WAAW;6BAAE;YAAW;kBAChF,CAAA,4BACC;;kCACE,gBAAC,CAAA,GAAA,mBAAW;kCACV,cAAA,gBAAC;4BAAI,WAAW,kCAAY;4BAAc,OAAM;4BAA6B,OAAM;4BAAK,QAAO;4BAAI,SAAQ;sCACzG,cAAA,gBAAC;gCAAK,GAAE;;;;oBAGX;;;;AAKX;AAOO,SAAS,0CAAe,KAA0B;IACvD,IAAI,oBACF,gBAAgB,eAChB,WAAW,UACX,MAAM,aACN,SAAS,cACT,UAAU,EACV,GAAG,cACJ,GAAG;IAEJ,qBACE,gBAAC,CAAA,GAAA,qBAAiB;QAAG,GAAG,YAAY;kBAClC,cAAA,gBAAC,oDAA8B,QAAQ;YACrC,OAAO;gBACL,kBAAkB;gBAClB,aAAa;gBACb,QAAQ;gBACR,WAAW;gBACX,YAAY;YACd;sBACC,MAAM,QAAQ;;;AAIvB;AAMO,SAAS,0CAAgB,KAAgB;IAC9C,qBAAO,gBAAC;AACV","sources":["packages/@react-spectrum/s2/src/Tooltip.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 Tooltip as AriaTooltip,\n TooltipProps as AriaTooltipProps,\n TooltipTrigger as AriaTooltipTrigger,\n TooltipTriggerComponentProps as AriaTooltipTriggerComponentProps,\n OverlayArrow,\n TooltipRenderProps,\n useLocale\n} from 'react-aria-components';\nimport {centerPadding, colorScheme, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ColorScheme} from '@react-types/provider';\nimport {ColorSchemeContext} from './Provider';\nimport {createContext, forwardRef, MutableRefObject, ReactNode, useCallback, useContext, useState} from 'react';\nimport {DOMRef} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\nexport interface TooltipTriggerProps extends Omit<AriaTooltipTriggerComponentProps, 'children' | 'closeDelay'>, Pick<AriaTooltipProps, 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset'> {\n /** The content of the tooltip. */\n children: ReactNode,\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'top'\n */\n placement?: 'start' | 'end' | 'right' | 'left' | 'top' | 'bottom'\n}\n\nexport interface TooltipProps extends Omit<AriaTooltipProps, 'children' | 'className' | 'style' | 'triggerRef' | 'UNSTABLE_portalContainer' | 'isEntering' | 'isExiting' | 'placement' | 'containerPadding' | 'offset' | 'crossOffset' | 'shouldFlip' | 'arrowBoundaryOffset' | 'isOpen' | 'defaultOpen' | 'onOpenChange'>, UnsafeStyles {\n /** The content of the tooltip. */\n children: ReactNode\n}\n\nconst tooltip = style<TooltipRenderProps & {colorScheme: ColorScheme | 'light dark' | null}>({\n ...colorScheme(),\n justifyContent: 'center',\n alignItems: 'center',\n maxWidth: 160,\n minHeight: 24,\n boxSizing: 'border-box',\n font: 'ui-sm',\n color: {\n default: 'gray-25',\n forcedColors: 'ButtonText'\n },\n borderWidth: {\n forcedColors: 1\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderColor: {\n forcedColors: 'transparent'\n },\n backgroundColor: 'neutral',\n borderRadius: 'control',\n paddingX: 'edge-to-text',\n paddingY: centerPadding(),\n margin: 8,\n transition: 'default',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n }\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nconst arrowStyles = style<TooltipRenderProps>({\n display: 'block',\n fill: 'gray-800',\n rotate: {\n placement: {\n top: 0,\n bottom: '180deg',\n left: '-90deg',\n right: '90deg'\n }\n },\n translateX: {\n placement: {\n left: '[-25%]',\n right: '[25%]'\n }\n }\n});\n\nlet InternalTooltipTriggerContext = createContext<Partial<TooltipTriggerProps>>({});\n\n/**\n * Display container for Tooltip content. Has a directional arrow dependent on its placement.\n */\nexport const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOMRef<HTMLDivElement>) {\n let {children, UNSAFE_style, UNSAFE_className = ''} = props;\n let domRef = useDOMRef(ref);\n let {\n containerPadding,\n crossOffset,\n offset,\n placement = 'top',\n shouldFlip\n } = useContext(InternalTooltipTriggerContext);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n let [borderRadius, setBorderRadius] = useState(0);\n\n // TODO: should we pass through lang and dir props in RAC?\n let tooltipRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [locale, direction, domRef]);\n\n return (\n <AriaTooltip\n {...props}\n arrowBoundaryOffset={borderRadius}\n containerPadding={containerPadding}\n crossOffset={crossOffset}\n offset={offset}\n placement={placement}\n shouldFlip={shouldFlip}\n ref={tooltipRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}>\n {renderProps => (\n <>\n <OverlayArrow>\n <svg className={arrowStyles(renderProps)} xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"5\" viewBox=\"0 0 10 5\">\n <path d=\"M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z\" />\n </svg>\n </OverlayArrow>\n {children}\n </>\n )}\n </AriaTooltip>\n );\n});\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerProps): ReactNode {\n let {\n containerPadding,\n crossOffset,\n offset,\n placement,\n shouldFlip,\n ...triggerProps\n } = props;\n\n return (\n <AriaTooltipTrigger {...triggerProps}>\n <InternalTooltipTriggerContext.Provider\n value={{\n containerPadding: containerPadding,\n crossOffset: crossOffset,\n offset: offset,\n placement: placement,\n shouldFlip: shouldFlip\n }}>\n {props.children}\n </InternalTooltipTriggerContext.Provider>\n </AriaTooltipTrigger>\n );\n}\n\n\n// This is purely so that storybook generates the types for both Menu and MenuTrigger\ninterface ICombined extends Omit<TooltipProps, 'placement'>, TooltipTriggerProps {}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function CombinedTooltip(props: ICombined): ReactNode {\n return <div />;\n}\n"],"names":[],"version":3,"file":"Tooltip.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAsDD,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAA4B,CAAC;AAGrE,IAAI,0DAAsB,CAAA,GAAA,0BAAY,EAAkD,CAAC;AAEzF,4KAA4K;AAC5K,gHAAgH;AAChH,sIAAsI;AACtI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBN,SAAS,+BAAS,KAAoB,EAAE,GAA2B;IACjE,IAAI,YAAC,QAAQ,cAAE,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,gBAAE,YAAY,EAAC,GAAG;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;kBAC/G,cAAA,gCAAC,CAAA,GAAA,iCAAM;YACL,WAAW;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps) => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps) => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.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,GAAG,CAAA,GAAA,0CAAc,EAAE;QAAC,GAAG,MAAK;QAAE,MAAM;IAAS,GAAG,iBAAiB,CAAA,GAAA,wCAAY;IACjG,IAAI,cAAC,UAAU,cAAE,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAC,GAAG;IAChD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,0BAAQ;IAC1B,aAAa,cAAc;IAE3B,qBACE,gCAAC,CAAA,GAAA,iCAAK;QACH,GAAG,MAAK;QACT,KAAK;QACL,MAAK;QACL,kHAAkH;QAClH,qBAAqB,CAAA,GAAA,+BAAQ,OAAO,CAAC;QACrC,mBAAmB;QACnB,WAAW,CAAA,cAAe,mCAAa;gBAAC,GAAG,WAAW;4BAAE;gBAAY,OAAO,cAAc;uBAAO;0BAAO;YAAQ;kBAC/G,cAAA,gCAAC,CAAA,GAAA,iCAAM;YACL,WAAW;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps): ReactNode => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"ACwEa;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAqFG;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA2BK;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoDA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAOJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EASG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAOA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAOG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAeO;;;;;;;;;;;;;EAgEL;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAWC;;;;EAAA;;;;EAAA;;;;EAOuD;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgB5D;;;;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;;;;EAkDF;;;;;EAAA;;;;;EAAA;;;;;EAAA;;;;;EAAA;;;;;AArWN;EAqFG;;;;EAAA;;;;;AArFH;EAAA;IAqFG;;;;IAAA;;;;IA2BK;;;;IAAA;;;;IAmL4D;;;;IAgB5D;;;;;;AA9NL;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAsFC","sources":["56ed516746d0036e","packages/@react-spectrum/s2/src/TreeView.tsx"],"sourcesContent":["@import \"9f0cb543acce7895\";\n@import \"1efe6bd9df94f465\";\n@import \"bdf071bf66df1ce3\";\n@import \"0330b2193d88b3df\";\n@import \"888ae06603582201\";\n@import \"73010de75c5ff12a\";\n@import \"6f9cf7ba5fc61169\";\n@import \"e3d8cbff54f98abf\";\n@import \"5ce50fd84b82affa\";\n@import \"e7f15e944ad73835\";\n@import \"17e37b578317afa7\";\n@import \"664b85d9761c64e2\";\n@import \"b6201a1b57a21b4e\";\n@import \"73100caf88a76f92\";\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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps) => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps) => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.css.map"}
1
+ {"mappings":"ACwEa;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAqFG;;;;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;IA2BK;;;;IAAA;;;;IAmL4D;;;;IAgB5D;;;;;;AA9NL;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAsFC","sources":["56ed516746d0036e","packages/@react-spectrum/s2/src/TreeView.tsx"],"sourcesContent":["@import \"9f0cb543acce7895\";\n@import \"1efe6bd9df94f465\";\n@import \"bdf071bf66df1ce3\";\n@import \"0330b2193d88b3df\";\n@import \"888ae06603582201\";\n@import \"73010de75c5ff12a\";\n@import \"6f9cf7ba5fc61169\";\n@import \"e3d8cbff54f98abf\";\n@import \"5ce50fd84b82affa\";\n@import \"e7f15e944ad73835\";\n@import \"17e37b578317afa7\";\n@import \"664b85d9761c64e2\";\n@import \"b6201a1b57a21b4e\";\n@import \"73100caf88a76f92\";\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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps): ReactNode => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.css.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAsDD,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA4B,CAAC;AAGrE,IAAI,0DAAsB,CAAA,GAAA,oBAAY,EAAkD,CAAC;AAEzF,4KAA4K;AAC5K,gHAAgH;AAChH,sIAAsI;AACtI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBN,SAAS,+BAAS,KAAoB,EAAE,GAA2B;IACjE,IAAI,YAAC,QAAQ,cAAE,UAAU,gBAAE,YAAY,oBAAE,gBAAgB,gBAAE,YAAY,EAAC,GAAG;IAC3E,IAAI,QAAQ,CAAA,GAAA,yCAAO;IAEnB,IAAI;IACJ,IAAI,OAAO,aAAa,YACtB,WAAW;IAGb,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gBAAC,CAAA,GAAA,kBAAU;QACT,QAAQ,CAAA,GAAA,iBAAS;QACjB,eAAe;YACb,WAAW,UAAU,UAAU,KAAK;YACpC,KAAK,aAAa,IAAI;QACxB;kBACA,cAAA,gBAAC,0CAAoB,QAAQ;YAAC,OAAO;0BAAC;YAAQ;sBAC5C,cAAA,gBAAC,0C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AAA,yCAAgB;gCAAG;oCAAC,QAAQ;oCAAgB,SAAS;gCAAI;6BAAE;yBAC7D;kCACA;;oBAEF,kBAAkB,4BAAc,gBAAC;wBAAI,MAAK;wBAAe,WAAW;;;;;;;;;;;;;;;;;;0BAAsD;4BAAC,gBAAgB;wBAAI;;;;QAGtJ;;AAGN;AAUA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCN,SAAS,2CAAqB,MAAgC;IAC5D,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAqB;IAChD,IAAI,CAAC,WAAW,IAAI,GAAG,CAAA,GAAA,sBAAc,EAAE;QAAC,GAAG,MAAK;QAAE,MAAM;IAAS,GAAG,iBAAiB,CAAA,GAAA,oBAAY;IACjG,IAAI,cAAC,UAAU,cAAE,UAAU,SAAE,KAAK,YAAE,QAAQ,EAAC,GAAG;IAChD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,aAAa,cAAc;IAE3B,qBACE,gBAAC,CAAA,GAAA,aAAK;QACH,GAAG,MAAK;QACT,KAAK;QACL,MAAK;QACL,kHAAkH;QAClH,qBAAqB,CAAA,GAAA,gBAAQ,OAAO,CAAC;QACrC,mBAAmB;QACnB,WAAW,CAAA,cAAe,mCAAa;gBAAC,GAAG,WAAW;4BAAE;gBAAY,OAAO,cAAc;uBAAO;0BAAO;YAAQ;kBAC/G,cAAA,gBAAC,CAAA,GAAA,wCAAM;YACL,WAAW;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps) => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps) => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAsDD,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA4B,CAAC;AAGrE,IAAI,0DAAsB,CAAA,GAAA,oBAAY,EAAkD,CAAC;AAEzF,4KAA4K;AAC5K,gHAAgH;AAChH,sIAAsI;AACtI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBN,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,CAAC;QACrC,mBAAmB;QACnB,WAAW,CAAA,cAAe,mCAAa;gBAAC,GAAG,WAAW;4BAAE;gBAAY,OAAO,cAAc;uBAAO;0BAAO;YAAQ;kBAC/G,cAAA,gBAAC,CAAA,GAAA,wCAAM;YACL,WAAW;;;;;;;;cAWR;2BAAC;YAAS;;;AAGrB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/TreeView.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 {ActionButtonGroupContext} from './ActionButtonGroup';\nimport {ActionMenuContext} from './ActionMenu';\nimport {\n Button,\n ButtonContext,\n ListLayout,\n Provider,\n TreeItemProps as RACTreeItemProps,\n TreeProps as RACTreeProps,\n Tree,\n TreeItem,\n TreeItemContent,\n TreeItemContentProps,\n useContextProps,\n Virtualizer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Checkbox} from './Checkbox';\nimport Chevron from '../ui-icons/Chevron';\nimport {colorMix, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {DOMRef, Key} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {isAndroid} from '@react-aria/utils';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, JSXElementConstructor, ReactElement, ReactNode, useContext, useRef} from 'react';\nimport {TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from 'react-aria';\nimport {useScale} from './utils';\n\ninterface S2TreeProps {\n // Only detatched is supported right now with the current styles from Spectrum\n isDetached?: boolean,\n onAction?: (key: Key) => void,\n // not fully supported yet\n isEmphasized?: boolean\n}\n\nexport interface TreeViewProps extends Omit<RACTreeProps<any>, 'style' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, UnsafeStyles, S2TreeProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nexport interface TreeViewItemProps extends Omit<RACTreeItemProps, 'className' | 'style'> {\n /** Whether this item has children, even if not loaded yet. */\n hasChildItems?: boolean\n}\n\ninterface TreeRendererContextValue {\n renderer?: (item) => ReactElement<any, string | JSXElementConstructor<any>>\n}\nconst TreeRendererContext = createContext<TreeRendererContextValue>({});\n\n\nlet InternalTreeContext = createContext<{isDetached?: boolean, isEmphasized?: boolean}>({});\n\n// TODO: the below is needed so the borders of the top and bottom row isn't cut off if the TreeView is wrapped within a container by always reserving the 2px needed for the\n// keyboard focus ring. Perhaps find a different way of rendering the outlines since the top of the item doesn't\n// scroll into view due to how the ring is offset. Alternatively, have the tree render the top/bottom outline like it does in Listview\nconst tree = style({\n ...focusRing(),\n outlineOffset: -2, // make certain we are visible inside overflow hidden containers\n userSelect: 'none',\n minHeight: 0,\n minWidth: 0,\n width: 'full',\n height: 'full',\n overflow: 'auto',\n boxSizing: 'border-box',\n justifyContent: {\n isEmpty: 'center'\n },\n alignItems: {\n isEmpty: 'center'\n },\n '--indent': {\n type: 'width',\n value: 16\n }\n}, getAllowedOverrides({height: true}));\n\nfunction TreeView(props: TreeViewProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isDetached, isEmphasized, UNSAFE_className, UNSAFE_style} = props;\n let scale = useScale();\n\n let renderer;\n if (typeof children === 'function') {\n renderer = children;\n }\n\n let domRef = useDOMRef(ref);\n\n return (\n <Virtualizer\n layout={ListLayout}\n layoutOptions={{\n rowHeight: scale === 'large' ? 50 : 40,\n gap: isDetached ? 2 : 0\n }}>\n <TreeRendererContext.Provider value={{renderer}}>\n <InternalTreeContext.Provider value={{isDetached, isEmphasized}}>\n <Tree\n {...props}\n style={UNSAFE_style}\n className={renderProps => (UNSAFE_className ?? '') + tree({isDetached, ...renderProps}, props.styles)}\n selectionBehavior=\"toggle\"\n ref={domRef}>\n {props.children}\n </Tree>\n </InternalTreeContext.Provider>\n </TreeRendererContext.Provider>\n </Virtualizer>\n );\n}\n\nconst selectedBackground = lightDark(colorMix('gray-25', 'informative-900', 10), colorMix('gray-25', 'informative-700', 10));\nconst selectedActiveBackground = lightDark(colorMix('gray-25', 'informative-900', 15), colorMix('gray-25', 'informative-700', 15));\n\nconst rowBackgroundColor = {\n default: '--s2-container-bg',\n isFocusVisibleWithin: colorMix('gray-25', 'gray-900', 7),\n isHovered: colorMix('gray-25', 'gray-900', 7),\n isPressed: colorMix('gray-25', 'gray-900', 10),\n isSelected: {\n default: colorMix('gray-25', 'gray-900', 7),\n isEmphasized: selectedBackground,\n isFocusVisibleWithin: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isHovered: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n },\n isPressed: {\n default: colorMix('gray-25', 'gray-900', 10),\n isEmphasized: selectedActiveBackground\n }\n },\n forcedColors: {\n default: 'Background'\n }\n} as const;\n\nconst treeRow = style({\n position: 'relative',\n display: 'flex',\n height: 40,\n width: 'full',\n boxSizing: 'border-box',\n font: 'ui',\n color: 'body',\n outlineStyle: 'none',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--rowBackgroundColor': {\n type: 'backgroundColor',\n value: rowBackgroundColor\n },\n '--rowFocusIndicatorColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n }\n});\n\n\nconst treeCellGrid = style({\n display: 'grid',\n width: 'full',\n height: 'full',\n boxSizing: 'border-box',\n alignContent: 'center',\n alignItems: 'center',\n gridTemplateColumns: ['auto', 'auto', 'auto', 'auto', 'auto', '1fr', 'minmax(0, auto)', 'auto'],\n gridTemplateRows: '1fr',\n gridTemplateAreas: [\n 'drag-handle checkbox level-padding expand-button icon content actions actionmenu'\n ],\n backgroundColor: '--rowBackgroundColor',\n paddingEnd: 4, // account for any focus rings on the last item in the cell\n color: {\n isDisabled: {\n default: 'gray-400',\n forcedColors: 'GrayText'\n }\n },\n '--rowSelectedBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'gray-800',\n isFocusVisible: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n '--rowForcedFocusBorderColor': {\n type: 'outlineColor',\n value: {\n default: 'focus-ring',\n forcedColors: 'Highlight'\n }\n },\n borderColor: {\n isDetached: {\n default: 'transparent',\n isSelected: '--rowSelectedBorderColor'\n }\n },\n borderWidth: {\n isDetached: 1\n },\n borderRadius: {\n isDetached: 'default'\n },\n borderStyle: {\n isDetached: 'solid'\n }\n});\n\nconst treeCheckbox = style({\n gridArea: 'checkbox',\n marginStart: 12,\n marginEnd: 0,\n paddingEnd: 0\n});\n\nconst treeIcon = style({\n gridArea: 'icon',\n marginEnd: 'text-to-visual',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst treeContent = style({\n gridArea: 'content',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n overflow: 'hidden'\n});\n\nconst treeActions = style({\n gridArea: 'actions',\n /* TODO: I made this one up, confirm desired behavior. These paddings are to make sure the action group has enough padding for the focus ring */\n marginStart: 2,\n marginEnd: 4\n});\n\nconst treeActionMenu = style({\n gridArea: 'actionmenu'\n});\n\nconst cellFocus = {\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineOffset: -2,\n outlineWidth: 2,\n outlineColor: 'focus-ring',\n borderRadius: '[6px]'\n} as const;\n\nconst treeRowFocusIndicator = raw(`\n &:before {\n content: \"\";\n display: inline-block;\n position: sticky;\n inset-inline-start: 0;\n width: 3px;\n height: 100%;\n margin-inline-end: -3px;\n margin-block-end: 1px;\n z-index: 3;\n background-color: var(--rowFocusIndicatorColor);\n }`\n);\n\nexport const TreeViewItem = (props: TreeViewItemProps): ReactNode => {\n let {\n href\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n\n return (\n <TreeItem\n {...props}\n className={(renderProps) => treeRow({\n ...renderProps,\n isLink: !!href, isEmphasized\n }) + (renderProps.isFocusVisible && !isDetached ? ' ' + treeRowFocusIndicator : '')} />\n );\n};\n\nexport interface TreeViewItemContentProps extends Omit<TreeItemContentProps, 'children'> {\n /** Rendered contents of the tree item or child items. */\n children: ReactNode\n}\n\nexport const TreeViewItemContent = (props: TreeViewItemContentProps): ReactNode => {\n let {\n children\n } = props;\n let {isDetached, isEmphasized} = useContext(InternalTreeContext);\n let scale = useScale();\n\n return (\n <TreeItemContent>\n {({isExpanded, hasChildItems, selectionMode, selectionBehavior, isDisabled, isFocusVisible, isSelected, id, state}) => {\n let isNextSelected = false;\n let isNextFocused = false;\n let keyAfter = state.collection.getKeyAfter(id);\n if (keyAfter != null) {\n isNextSelected = state.selectionManager.isSelected(keyAfter);\n }\n let isFirst = state.collection.getFirstKey() === id;\n return (\n <div className={treeCellGrid({isDisabled, isNextSelected, isSelected, isFirst, isNextFocused, isDetached})}>\n {selectionMode !== 'none' && selectionBehavior === 'toggle' && (\n // TODO: add transition?\n <div className={treeCheckbox}>\n <Checkbox\n isEmphasized={isEmphasized}\n slot=\"selection\" />\n </div>\n )}\n <div\n className={style({\n gridArea: 'level-padding',\n width: '[calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))]'\n })} />\n {/* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */}\n <ExpandableRowChevron isDisabled={isDisabled} isExpanded={isExpanded} scale={scale} isHidden={!(hasChildItems)} />\n <Provider\n values={[\n [TextContext, {styles: treeContent}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: treeIcon}),\n styles: style({size: fontRelative(20), flexShrink: 0})\n }],\n [ActionButtonGroupContext, {styles: treeActions}],\n [ActionMenuContext, {styles: treeActionMenu, isQuiet: true}]\n ]}>\n {children}\n </Provider>\n {isFocusVisible && isDetached && <div role=\"presentation\" className={style({...cellFocus, position: 'absolute', inset: 0})({isFocusVisible: true})} />}\n </div>\n );\n }}\n </TreeItemContent>\n );\n};\n\ninterface ExpandableRowChevronProps {\n isExpanded?: boolean,\n isDisabled?: boolean,\n isRTL?: boolean,\n scale: 'medium' | 'large',\n isHidden?: boolean\n}\n\nconst expandButton = style<ExpandableRowChevronProps>({\n gridArea: 'expand-button',\n color: {\n default: '[inherit]',\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n height: 40,\n width: 40,\n display: 'flex',\n flexWrap: 'wrap',\n alignContent: 'center',\n justifyContent: 'center',\n outlineStyle: 'none',\n cursor: 'default',\n transform: {\n isExpanded: {\n default: 'rotate(90deg)',\n isRTL: 'rotate(-90deg)'\n }\n },\n padding: 0,\n transition: 'default',\n backgroundColor: 'transparent',\n borderStyle: 'none',\n disableTapHighlight: true,\n visibility: {\n isHidden: 'hidden'\n }\n});\n\nfunction ExpandableRowChevron(props: ExpandableRowChevronProps) {\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n let [fullProps, ref] = useContextProps({...props, slot: 'chevron'}, expandButtonRef, ButtonContext);\n let {isExpanded, isDisabled, scale, isHidden} = fullProps;\n let {direction} = useLocale();\n isDisabled = isDisabled || isHidden;\n\n return (\n <Button\n {...props}\n ref={ref}\n slot=\"chevron\"\n // Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually \"focus\" it\n excludeFromTabOrder={isAndroid() && !isDisabled}\n preventFocusOnPress\n className={renderProps => expandButton({...renderProps, isExpanded, isRTL: direction === 'rtl', scale, isHidden})}>\n <Chevron\n className={style({\n scale: {\n direction: {\n ltr: '1',\n rtl: '-1'\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })({direction})} />\n </Button>\n );\n}\n\n/**\n * A tree view provides users with a way to navigate nested hierarchical information.\n */\nconst _TreeView = forwardRef(TreeView);\nexport {_TreeView as TreeView};\n"],"names":[],"version":3,"file":"TreeView.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAA2C,GAAkC,EAAE,KAA2D;IACxJ,OAAO,CAAA,GAAA,6CAAiB,EAAE,OAAO,CAAC,OAAO;QACvC,IAAI,YAAY,SAAS,IAAI,IAAI,OAAO,EAAE;YACxC,IAAI,SAAC,QAAQ,WAAG,SAAS,GAAE,GAAG,IAAI,OAAO,CAAC,qBAAqB,MAAM,CAAC;YACtE,OAAO;gBACL,GAAG,KAAK;gBACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;gBAClD,WAAW,GAAG,OAAO,aAAa,GAAG,aAAa,EAAE,KAAK,GAAG,CAAC,QAAQ,QAAQ,GAAG,IAAI,2BAA2B,CAAC;YAClH;QACF,OACE,OAAO;YACL,GAAG,KAAK;YACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;QACpD;IAEJ;AACF","sources":["packages/@react-spectrum/s2/src/pressScale.ts"],"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 {composeRenderProps} from 'react-aria-components';\nimport {CSSProperties, RefObject} from 'react';\n\nexport function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)) {\n return composeRenderProps(style, (style, renderProps: R) => {\n if (renderProps.isPressed && ref.current) {\n let {width = 0, height = 0} = ref.current.getBoundingClientRect() ?? {};\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`,\n transform: `${style?.transform ?? ''} perspective(${Math.max(height, width / 3, 24)}px) translate3d(0, 0, -2px)`\n };\n } else {\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"pressScale.cjs.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAA2C,GAAkC,EAAE,KAA2D;IACxJ,OAAO,CAAA,GAAA,6CAAiB,EAAE,OAAO,CAAC,OAAO;QACvC,IAAI,YAAY,SAAS,IAAI,IAAI,OAAO,EAAE;YACxC,IAAI,SAAC,QAAQ,WAAG,SAAS,GAAE,GAAG,IAAI,OAAO,CAAC,qBAAqB,MAAM,CAAC;YACtE,OAAO;gBACL,GAAG,KAAK;gBACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;gBAClD,WAAW,GAAG,OAAO,aAAa,GAAG,aAAa,EAAE,KAAK,GAAG,CAAC,QAAQ,QAAQ,GAAG,IAAI,2BAA2B,CAAC;YAClH;QACF,OACE,OAAO;YACL,GAAG,KAAK;YACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;QACpD;IAEJ;AACF","sources":["packages/@react-spectrum/s2/src/pressScale.ts"],"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 {composeRenderProps} from 'react-aria-components';\nimport {CSSProperties, RefObject} from 'react';\n\nexport function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)): (renderProps: R) => CSSProperties {\n return composeRenderProps(style, (style, renderProps: R) => {\n if (renderProps.isPressed && ref.current) {\n let {width = 0, height = 0} = ref.current.getBoundingClientRect() ?? {};\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`,\n transform: `${style?.transform ?? ''} perspective(${Math.max(height, width / 3, 24)}px) translate3d(0, 0, -2px)`\n };\n } else {\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"pressScale.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAA2C,GAAkC,EAAE,KAA2D;IACxJ,OAAO,CAAA,GAAA,yBAAiB,EAAE,OAAO,CAAC,OAAO;QACvC,IAAI,YAAY,SAAS,IAAI,IAAI,OAAO,EAAE;YACxC,IAAI,SAAC,QAAQ,WAAG,SAAS,GAAE,GAAG,IAAI,OAAO,CAAC,qBAAqB,MAAM,CAAC;YACtE,OAAO;gBACL,GAAG,KAAK;gBACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;gBAClD,WAAW,GAAG,OAAO,aAAa,GAAG,aAAa,EAAE,KAAK,GAAG,CAAC,QAAQ,QAAQ,GAAG,IAAI,2BAA2B,CAAC;YAClH;QACF,OACE,OAAO;YACL,GAAG,KAAK;YACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;QACpD;IAEJ;AACF","sources":["packages/@react-spectrum/s2/src/pressScale.ts"],"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 {composeRenderProps} from 'react-aria-components';\nimport {CSSProperties, RefObject} from 'react';\n\nexport function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)) {\n return composeRenderProps(style, (style, renderProps: R) => {\n if (renderProps.isPressed && ref.current) {\n let {width = 0, height = 0} = ref.current.getBoundingClientRect() ?? {};\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`,\n transform: `${style?.transform ?? ''} perspective(${Math.max(height, width / 3, 24)}px) translate3d(0, 0, -2px)`\n };\n } else {\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"pressScale.mjs.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAA2C,GAAkC,EAAE,KAA2D;IACxJ,OAAO,CAAA,GAAA,yBAAiB,EAAE,OAAO,CAAC,OAAO;QACvC,IAAI,YAAY,SAAS,IAAI,IAAI,OAAO,EAAE;YACxC,IAAI,SAAC,QAAQ,WAAG,SAAS,GAAE,GAAG,IAAI,OAAO,CAAC,qBAAqB,MAAM,CAAC;YACtE,OAAO;gBACL,GAAG,KAAK;gBACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;gBAClD,WAAW,GAAG,OAAO,aAAa,GAAG,aAAa,EAAE,KAAK,GAAG,CAAC,QAAQ,QAAQ,GAAG,IAAI,2BAA2B,CAAC;YAClH;QACF,OACE,OAAO;YACL,GAAG,KAAK;YACR,YAAY,GAAG,OAAO,cAAc,GAAG,UAAU,CAAC;QACpD;IAEJ;AACF","sources":["packages/@react-spectrum/s2/src/pressScale.ts"],"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 {composeRenderProps} from 'react-aria-components';\nimport {CSSProperties, RefObject} from 'react';\n\nexport function pressScale<R extends {isPressed: boolean}>(ref: RefObject<HTMLElement | null>, style?: CSSProperties | ((renderProps: R) => CSSProperties)): (renderProps: R) => CSSProperties {\n return composeRenderProps(style, (style, renderProps: R) => {\n if (renderProps.isPressed && ref.current) {\n let {width = 0, height = 0} = ref.current.getBoundingClientRect() ?? {};\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`,\n transform: `${style?.transform ?? ''} perspective(${Math.max(height, width / 3, 24)}px) translate3d(0, 0, -2px)`\n };\n } else {\n return {\n ...style,\n willChange: `${style?.willChange ?? ''} transform`\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"pressScale.mjs.map"}