@react-spectrum/s2 3.0.0-nightly-101d0772b-250113 → 3.0.0-nightly-1b425caa2-250114

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 (53) hide show
  1. package/dist/ActionBar.cjs +11 -8
  2. package/dist/ActionBar.cjs.map +1 -1
  3. package/dist/ActionBar.css +15 -32
  4. package/dist/ActionBar.css.map +1 -1
  5. package/dist/ActionBar.mjs +12 -9
  6. package/dist/ActionBar.mjs.map +1 -1
  7. package/dist/Modal.cjs +15 -21
  8. package/dist/Modal.cjs.map +1 -1
  9. package/dist/Modal.css +22 -46
  10. package/dist/Modal.css.map +1 -1
  11. package/dist/Modal.mjs +15 -21
  12. package/dist/Modal.mjs.map +1 -1
  13. package/dist/Popover.cjs +19 -37
  14. package/dist/Popover.cjs.map +1 -1
  15. package/dist/Popover.css +28 -99
  16. package/dist/Popover.css.map +1 -1
  17. package/dist/Popover.mjs +19 -37
  18. package/dist/Popover.mjs.map +1 -1
  19. package/dist/Tabs.cjs +177 -414
  20. package/dist/Tabs.cjs.map +1 -1
  21. package/dist/Tabs.css +120 -208
  22. package/dist/Tabs.css.map +1 -1
  23. package/dist/Tabs.mjs +179 -416
  24. package/dist/Tabs.mjs.map +1 -1
  25. package/dist/Tooltip.cjs +19 -16
  26. package/dist/Tooltip.cjs.map +1 -1
  27. package/dist/Tooltip.css +25 -40
  28. package/dist/Tooltip.css.map +1 -1
  29. package/dist/Tooltip.mjs +19 -16
  30. package/dist/Tooltip.mjs.map +1 -1
  31. package/dist/en-US.cjs +0 -1
  32. package/dist/en-US.cjs.map +1 -1
  33. package/dist/en-US.mjs +0 -1
  34. package/dist/en-US.mjs.map +1 -1
  35. package/dist/he-IL.cjs +0 -1
  36. package/dist/he-IL.cjs.map +1 -1
  37. package/dist/he-IL.mjs +0 -1
  38. package/dist/he-IL.mjs.map +1 -1
  39. package/dist/types.d.ts +7 -11
  40. package/dist/types.d.ts.map +1 -1
  41. package/package.json +19 -19
  42. package/src/ActionBar.tsx +15 -18
  43. package/src/Modal.tsx +17 -44
  44. package/src/Popover.tsx +21 -89
  45. package/src/Tabs.tsx +156 -427
  46. package/src/Tooltip.tsx +25 -42
  47. package/dist/TabsPicker.cjs +0 -388
  48. package/dist/TabsPicker.cjs.map +0 -1
  49. package/dist/TabsPicker.css +0 -440
  50. package/dist/TabsPicker.css.map +0 -1
  51. package/dist/TabsPicker.mjs +0 -382
  52. package/dist/TabsPicker.mjs.map +0 -1
  53. package/src/TabsPicker.tsx +0 -341
@@ -46,8 +46,6 @@ $parcel$export(module.exports, "useActionBarContainer", () => $85bf454149fe9ddc$
46
46
 
47
47
 
48
48
 
49
- const $85bf454149fe9ddc$var$slideIn = "-d9bqcx";
50
- const $85bf454149fe9ddc$var$slideOut = "-e7i2y9";
51
49
  const $85bf454149fe9ddc$var$actionBarStyles = function anonymous(props) {
52
50
  let rules = " .";
53
51
  rules += ' _wd';
@@ -86,11 +84,13 @@ const $85bf454149fe9ddc$var$actionBarStyles = function anonymous(props) {
86
84
  rules += ' y_d';
87
85
  rules += ' z_d';
88
86
  rules += ' r_______________T';
89
- if (props.isExiting) rules += ' _T-1o599gf';
90
- else if (props.isInContainer) rules += ' _T-13zcd4x';
91
- rules += ' _U-375xx3';
92
- if (props.isExiting) rules += ' _Za';
93
- else if (props.isInContainer) rules += ' _Za';
87
+ rules += ' _Pa';
88
+ rules += ' _R-375xx3';
89
+ rules += ' _Sa';
90
+ if (props.isExiting) rules += ' Q8';
91
+ else if (props.isEntering) rules += ' Q8';
92
+ if (props.isExiting) rules += ' _L-3t1x';
93
+ else if (props.isEntering) rules += ' _L-3t1x';
94
94
  return rules;
95
95
  };
96
96
  const $85bf454149fe9ddc$export$9f306827c48feef4 = /*#__PURE__*/ (0, $cRsNx$react.createContext)(null);
@@ -147,14 +147,17 @@ const $85bf454149fe9ddc$var$ActionBarInner = /*#__PURE__*/ (0, $cRsNx$react.forw
147
147
  stringFormatter,
148
148
  scrollRef
149
149
  ]);
150
+ let objectRef = (0, $cRsNx$reactariautils.useObjectRef)(ref);
151
+ let isEntering = (0, $cRsNx$reactariautils.useEnterAnimation)(objectRef, !!scrollRef);
150
152
  return /*#__PURE__*/ (0, $cRsNx$reactjsxruntime.jsx)((0, $cRsNx$reactaria.FocusScope), {
151
153
  restoreFocus: true,
152
154
  children: /*#__PURE__*/ (0, $cRsNx$reactjsxruntime.jsxs)("div", {
153
- ref: ref,
155
+ ref: objectRef,
154
156
  ...keyboardProps,
155
157
  className: $85bf454149fe9ddc$var$actionBarStyles({
156
158
  isEmphasized: isEmphasized,
157
159
  isInContainer: !!scrollRef,
160
+ isEntering: isEntering,
158
161
  isExiting: isExiting
159
162
  }),
160
163
  style: {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAmBD,MAAM;AAKN,MAAM;AAKN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DC,MAAM,0DAAmB,CAAA,GAAA,0BAAY,EAAsE;AAE3G,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAAU,KAAqB,EAAE,GAA2B;IACvG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,SAAS,MAAM,iBAAiB,KAAK;IACzC,IAAI,YAAY,CAAA,GAAA,sCAAe,EAAE,QAAQ,UAAU,MAAM,SAAS,IAAI;IACtE,IAAI,CAAC,UAAU,CAAC,WACd,OAAO;IAGT,qBAAO,gCAAC;QAAgB,GAAG,KAAK;QAAE,KAAK;QAAQ,WAAW;;AAC5D;AAEA,MAAM,qDAAiB,CAAA,GAAA,uBAAS,EAAE,SAAS,eAAe,MAA4C,EAAE,GAAwC;IAC9I,IAAI,gBAAC,YAAY,qBAAE,oBAA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AmB,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YACpC,KAAK;uBACL;+BACA;YACA,kBAAkB,IAAM,gBAAgB,IAAI;QAC9C,CAAA,GAAI;QAAC;QAAW;QAAc;QAAmB;KAAgB;IAEjE,IAAI,mBAAmB,CAAA,GAAA,oBAAM,EAAE,kBAC7B,gCAAC,0CAAiB,QAAQ;YAAC,OAAO;sBAC/B;YAEF;QAAC;QAAkB;KAAU;IAEhC,OAAO;sBACL;QACA,mBAAmB;QACnB,WAAW;yBACX;IACF;AACF","sources":["packages/@react-spectrum/s2/src/ActionBar.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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useExitAnimation, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst slideIn = keyframes(`\n from { transform: translateY(100%); opacity: 0 }\n to { transform: translateY(0px); opacity: 1 }\n`);\n\nconst slideOut = keyframes(`\n from { transform: translateY(0px); opacity: 1 }\n to { transform: translateY(100%); opacity: 0 }\n`);\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n animation: {\n isInContainer: slideIn,\n isExiting: slideOut\n },\n animationDuration: 200\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={ref}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext,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C;QAAkB;KAAU;IAEhC,OAAO;sBACL;QACA,mBAAmB;QACnB,WAAW;yBACX;IACF;AACF","sources":["packages/@react-spectrum/s2/src/ActionBar.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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEnterAnimation, useExitAnimation, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n transition: 'default',\n transitionDuration: 200,\n translateY: {\n isEntering: 'full',\n isExiting: 'full'\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n let objectRef = useObjectRef(ref);\n let isEntering = useEnterAnimation(objectRef, !!scrollRef);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={objectRef}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isEntering, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext, actionBar]);\n\n return {\n selectedKeys,\n onSelectionChange: setSelectedKeys,\n actionBar: wrappedActionBar,\n actionBarHeight\n };\n}\n"],"names":[],"version":3,"file":"ActionBar.cjs.map"}
@@ -1,27 +1,3 @@
1
- @keyframes -d9bqcx {
2
- from {
3
- opacity: 0;
4
- transform: translateY(100%);
5
- }
6
-
7
- to {
8
- opacity: 1;
9
- transform: translateY(0);
10
- }
11
- }
12
-
13
- @keyframes -e7i2y9 {
14
- from {
15
- opacity: 1;
16
- transform: translateY(0);
17
- }
18
-
19
- to {
20
- opacity: 0;
21
- transform: translateY(100%);
22
- }
23
- }
24
-
25
1
  @layer _.a {
26
2
  ._wd {
27
3
  border-start-start-radius: .625rem;
@@ -139,20 +115,27 @@
139
115
  max-width: calc(60rem * var(--s2-scale));
140
116
  }
141
117
 
142
- ._T-13zcd4x {
143
- animation-name: -d9bqcx;
118
+ ._Pa {
119
+ transition-property: color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter;
144
120
  }
145
121
 
146
- ._T-1o599gf {
147
- animation-name: -e7i2y9;
122
+ ._R-375xx3 {
123
+ transition-duration: .2s;
148
124
  }
149
125
 
150
- ._U-375xx3 {
151
- animation-duration: .2s;
126
+ ._Sa {
127
+ transition-timing-function: cubic-bezier(.45, 0, .4, 1);
152
128
  }
153
129
 
154
- ._Za {
155
- animation-timing-function: cubic-bezier(.45, 0, .4, 1);
130
+ .Q8 {
131
+ --translateY: 100%;
132
+ translate: var(--translateX, 0) var(--translateY, 0);
133
+ translate: var(--translateX, 0) var(--translateY, 0);
134
+ }
135
+
136
+ ._L-3t1x {
137
+ opacity: 0;
138
+ opacity: 0;
156
139
  }
157
140
 
158
141
  .__B-3t1y {
@@ -1 +1 @@
1
- {"mappings":"AC6BgB;;;;;;;;;;;;AAKC;;;;;;;;;;;;AAKO;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;;;;EAgIA;;;;EAAA;;;;EAQA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKG;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA7IH;EA6IG;;;;EAAA;;;;;AA7IH;;AAAA;EAAA;IAAA;;;;;;AAgIA;;;;AAaG;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA","sources":["a1b352514784d267","packages/@react-spectrum/s2/src/ActionBar.tsx"],"sourcesContent":["@import \"ae871d7b3899fe46\";\n@import \"b12d7526a8920c7d\";\n@import \"ac539ec7d1ef9296\";\n@import \"e8e91cecf3846843\";\n@import \"c4ab5756a1b19858\";\n@import \"8a738eda46f0e432\";\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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useExitAnimation, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst slideIn = keyframes(`\n from { transform: translateY(100%); opacity: 0 }\n to { transform: translateY(0px); opacity: 1 }\n`);\n\nconst slideOut = keyframes(`\n from { transform: translateY(0px); opacity: 1 }\n to { transform: translateY(100%); opacity: 0 }\n`);\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n animation: {\n isInContainer: slideIn,\n isExiting: slideOut\n },\n animationDuration: 200\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={ref}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext, actionBar]);\n\n return {\n selectedKeys,\n onSelectionChange: setSelectedKeys,\n actionBar: wrappedActionBar,\n actionBarHeight\n };\n}\n"],"names":[],"version":3,"file":"ActionBar.css.map"}
1
+ {"mappings":"AC4BwB;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;;;;;EAwIA;;;;EAAA;;;;EAQA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKG;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AArJH;EAqJG;;;;EAAA;;;;;AArJH;;AAAA;EAAA;IAAA;;;;;;AAwIA;;;;AAaG;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA","sources":["a1b352514784d267","packages/@react-spectrum/s2/src/ActionBar.tsx"],"sourcesContent":["@import \"ae871d7b3899fe46\";\n@import \"b12d7526a8920c7d\";\n@import \"ac539ec7d1ef9296\";\n@import \"e8e91cecf3846843\";\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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEnterAnimation, useExitAnimation, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n transition: 'default',\n transitionDuration: 200,\n translateY: {\n isEntering: 'full',\n isExiting: 'full'\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n let objectRef = useObjectRef(ref);\n let isEntering = useEnterAnimation(objectRef, !!scrollRef);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={objectRef}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isEntering, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext, actionBar]);\n\n return {\n selectedKeys,\n onSelectionChange: setSelectedKeys,\n actionBar: wrappedActionBar,\n actionBarHeight\n };\n}\n"],"names":[],"version":3,"file":"ActionBar.css.map"}
@@ -9,7 +9,7 @@ import {createContext as $kxwJw$createContext, forwardRef as $kxwJw$forwardRef,
9
9
  import {useKeyboard as $kxwJw$useKeyboard, FocusScope as $kxwJw$FocusScope} from "react-aria";
10
10
  import {useControlledState as $kxwJw$useControlledState} from "@react-stately/utils";
11
11
  import {useDOMRef as $kxwJw$useDOMRef} from "@react-spectrum/utils";
12
- import {useExitAnimation as $kxwJw$useExitAnimation, useResizeObserver as $kxwJw$useResizeObserver} from "@react-aria/utils";
12
+ import {useExitAnimation as $kxwJw$useExitAnimation, useResizeObserver as $kxwJw$useResizeObserver, useObjectRef as $kxwJw$useObjectRef, useEnterAnimation as $kxwJw$useEnterAnimation} from "@react-aria/utils";
13
13
  import {useLocalizedStringFormatter as $kxwJw$useLocalizedStringFormatter} from "@react-aria/i18n";
14
14
 
15
15
 
@@ -38,8 +38,6 @@ function $parcel$interopDefault(a) {
38
38
 
39
39
 
40
40
 
41
- const $f21f2186348fbc5b$var$slideIn = "-d9bqcx";
42
- const $f21f2186348fbc5b$var$slideOut = "-e7i2y9";
43
41
  const $f21f2186348fbc5b$var$actionBarStyles = function anonymous(props) {
44
42
  let rules = " .";
45
43
  rules += ' _wd';
@@ -78,11 +76,13 @@ const $f21f2186348fbc5b$var$actionBarStyles = function anonymous(props) {
78
76
  rules += ' y_d';
79
77
  rules += ' z_d';
80
78
  rules += ' r_______________T';
81
- if (props.isExiting) rules += ' _T-1o599gf';
82
- else if (props.isInContainer) rules += ' _T-13zcd4x';
83
- rules += ' _U-375xx3';
84
- if (props.isExiting) rules += ' _Za';
85
- else if (props.isInContainer) rules += ' _Za';
79
+ rules += ' _Pa';
80
+ rules += ' _R-375xx3';
81
+ rules += ' _Sa';
82
+ if (props.isExiting) rules += ' Q8';
83
+ else if (props.isEntering) rules += ' Q8';
84
+ if (props.isExiting) rules += ' _L-3t1x';
85
+ else if (props.isEntering) rules += ' _L-3t1x';
86
86
  return rules;
87
87
  };
88
88
  const $f21f2186348fbc5b$export$9f306827c48feef4 = /*#__PURE__*/ (0, $kxwJw$createContext)(null);
@@ -139,14 +139,17 @@ const $f21f2186348fbc5b$var$ActionBarInner = /*#__PURE__*/ (0, $kxwJw$forwardRef
139
139
  stringFormatter,
140
140
  scrollRef
141
141
  ]);
142
+ let objectRef = (0, $kxwJw$useObjectRef)(ref);
143
+ let isEntering = (0, $kxwJw$useEnterAnimation)(objectRef, !!scrollRef);
142
144
  return /*#__PURE__*/ (0, $kxwJw$jsx)((0, $kxwJw$FocusScope), {
143
145
  restoreFocus: true,
144
146
  children: /*#__PURE__*/ (0, $kxwJw$jsxs)("div", {
145
- ref: ref,
147
+ ref: objectRef,
146
148
  ...keyboardProps,
147
149
  className: $f21f2186348fbc5b$var$actionBarStyles({
148
150
  isEmphasized: isEmphasized,
149
151
  isInContainer: !!scrollRef,
152
+ isEntering: isEntering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AAc,QACX,gBAAgB,MAAM,CAAC,2BACvB,gBAAgB,MAAM,CAAC,sBAAsB;gCAAC,OAAO;4BAAS;;;;;;;AAM9E;AAUO,SAAS,0CAAsB,KAAkC;IACtE,IAAI,mBAAC,eAAe,aAAE,SAAS,EAAC,GAAG;IACnC,IAAI,CAAC,cAAc,gBAAgB,GAAG,CAAA,GAAA,yBAAiB,EAAE,MAAM,YAAY,EAAE,MAAM,mBAAmB,IAAI,IAAI,OAAO,MAAM,iBAAiB;IAC5I,IAAI,kBAAkB,CAAA,GAAA,cAAM,EAAE,IAAM,iBAAiB,QAAQ,eAAwB,IAAI,IAAI,eAAe;QAAC;KAAa;IAC1H,IAAI,YAAY,CAAA,GAAA,cAAM,EAAE,IAAM,kBAAkB,kBAAkB;QAAC;QAAiB;KAAgB;IACpG,IAAI,oBAAoB,oBAAoB,QAAQ,QAAiB,gBAAgB,IAAI;IACzF,IAAI,CAAC,iBAAiB,mBAAmB,GAAG,CAAA,GAAA,eAAO,EAAE;IACrD,IAAI,eAAe,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC9B,IAAI,YAAY,KAAK;QACrB,IAAI,WACF,mBAAmB,UAAU,YAAY,GAAG;aAE5C,mBAAmB;IAEvB,GAAG,EAAE;IAEL,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YACpC,KAAK;uBACL;+BACA;YACA,kBAAkB,IAAM,gBAAgB,IAAI;QAC9C,CAAA,GAAI;QAAC;QAAW;QAAc;QAAmB;KAAgB;IAEjE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE,kBAC7B,gBAAC,0CAAiB,QAAQ;YAAC,OAAO;sBAC/B;YAEF;QAAC;QAAkB;KAAU;IAEhC,OAAO;sBACL;QACA,mBAAmB;QACnB,WAAW;yBACX;IACF;AACF","sources":["packages/@react-spectrum/s2/src/ActionBar.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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useExitAnimation, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst slideIn = keyframes(`\n from { transform: translateY(100%); opacity: 0 }\n to { transform: translateY(0px); opacity: 1 }\n`);\n\nconst slideOut = keyframes(`\n from { transform: translateY(0px); opacity: 1 }\n to { transform: translateY(100%); opacity: 0 }\n`);\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n animation: {\n isInContainer: slideIn,\n isExiting: slideOut\n },\n animationDuration: 200\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={ref}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext, actionBar]);\n\n return {\n selectedKeys,\n onSelectionChange: setSelectedKeys,\n actionBar: wrappedActionBar,\n actionBarHeight\n };\n}\n"],"names":[],"version":3,"file":"ActionBar.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAkBD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEC,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAsE;AAE3G,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAAU,KAAqB,EAAE,GAA2B;IACvG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE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,IAAI,OAAO,MAAM,iBAAiB;IAC5I,IAAI,kBAAkB,CAAA,GAAA,cAAM,EAAE,IAAM,iBAAiB,QAAQ,eAAwB,IAAI,IAAI,eAAe;QAAC;KAAa;IAC1H,IAAI,YAAY,CAAA,GAAA,cAAM,EAAE,IAAM,kBAAkB,kBAAkB;QAAC;QAAiB;KAAgB;IACpG,IAAI,oBAAoB,oBAAoB,QAAQ,QAAiB,gBAAgB,IAAI;IACzF,IAAI,CAAC,iBAAiB,mBAAmB,GAAG,CAAA,GAAA,eAAO,EAAE;IACrD,IAAI,eAAe,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC9B,IAAI,YAAY,KAAK;QACrB,IAAI,WACF,mBAAmB,UAAU,YAAY,GAAG;aAE5C,mBAAmB;IAEvB,GAAG,EAAE;IAEL,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YACpC,KAAK;uBACL;+BACA;YACA,kBAAkB,IAAM,gBAAgB,IAAI;QAC9C,CAAA,GAAI;QAAC;QAAW;QAAc;QAAmB;KAAgB;IAEjE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE,kBAC7B,gBAAC,0CAAiB,QAAQ;YAAC,OAAO;sBAC/B;YAEF;QAAC;QAAkB;KAAU;IAEhC,OAAO;sBACL;QACA,mBAAmB;QACnB,WAAW;yBACX;IACF;AACF","sources":["packages/@react-spectrum/s2/src/ActionBar.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 {ActionButtonGroup} from './ActionButtonGroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {CloseButton} from './CloseButton';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, Key} from '@react-types/shared';\nimport {FocusScope, useKeyboard} from 'react-aria';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {style} from '../style' with {type: 'macro'};\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEnterAnimation, useExitAnimation, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nconst actionBarStyles = style({\n borderRadius: 'lg',\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'elevated',\n isEmphasized: 'neutral'\n }\n },\n backgroundColor: '--s2-container-bg',\n boxShadow: 'elevated',\n boxSizing: 'border-box',\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineOffset: -1,\n outlineColor: {\n default: 'gray-200',\n isEmphasized: 'transparent',\n forcedColors: 'ButtonBorder'\n },\n paddingX: 8,\n paddingY: 12,\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n position: {\n isInContainer: 'absolute'\n },\n bottom: 8,\n insetStart: 8,\n '--insetEnd': {\n type: 'insetEnd',\n value: 8\n },\n width: {\n default: 'full',\n isInContainer: 'auto'\n },\n marginX: 'auto',\n maxWidth: 960,\n transition: 'default',\n transitionDuration: 200,\n translateY: {\n isEntering: 'full',\n isExiting: 'full'\n },\n opacity: {\n isEntering: 0,\n isExiting: 0\n }\n});\n\nexport interface ActionBarProps extends SlotProps {\n /** A list of ActionButtons to display. */\n children: ReactNode,\n /** Whether the ActionBar should be displayed with a emphasized style. */\n isEmphasized?: boolean,\n /** The number of selected items that the ActionBar is currently linked to. If 0, the ActionBar is hidden. */\n selectedItemCount?: number | 'all',\n /** Handler that is called when the ActionBar clear button is pressed. */\n onClearSelection?: () => void,\n /** A ref to the scrollable element the ActionBar appears above. */\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport const ActionBarContext = createContext<ContextValue<Partial<ActionBarProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const ActionBar = forwardRef(function ActionBar(props: ActionBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ActionBarContext);\n let domRef = useDOMRef(ref);\n\n let isOpen = props.selectedItemCount !== 0;\n let isExiting = useExitAnimation(domRef, isOpen && props.scrollRef != null);\n if (!isOpen && !isExiting) {\n return null;\n }\n\n return <ActionBarInner {...props} ref={domRef} isExiting={isExiting} />;\n});\n\nconst ActionBarInner = forwardRef(function ActionBarInner(props: ActionBarProps & {isExiting: boolean}, ref: ForwardedRef<HTMLDivElement | null>) {\n let {isEmphasized, selectedItemCount = 0, children, onClearSelection, isExiting} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n\n // Store the last count greater than zero so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n \n // Measure the width of the collection's scrollbar and offset the action bar by that amount.\n let scrollRef = props.scrollRef;\n let [scrollbarWidth, setScrollbarWidth] = useState(0);\n let updateScrollbarWidth = useCallback(() => {\n let el = scrollRef?.current;\n if (el) {\n let w = el.offsetWidth - el.clientWidth;\n setScrollbarWidth(w);\n }\n }, [scrollRef]);\n\n useResizeObserver({\n ref: scrollRef,\n onResize: updateScrollbarWidth\n });\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection?.();\n } else {\n e.continuePropagation();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current && scrollRef) {\n isInitial.current = false;\n announce(stringFormatter.format('actionbar.actionsAvailable'));\n }\n }, [stringFormatter, scrollRef]);\n\n let objectRef = useObjectRef(ref);\n let isEntering = useEnterAnimation(objectRef, !!scrollRef);\n\n return (\n <FocusScope restoreFocus>\n <div\n ref={objectRef}\n {...keyboardProps}\n className={actionBarStyles({isEmphasized, isInContainer: !!scrollRef, isEntering, isExiting})}\n style={{insetInlineEnd: `calc(var(--insetEnd) + ${scrollbarWidth}px)`}}>\n <div className={style({order: 1, marginStart: 'auto'})}>\n <ActionButtonGroup\n staticColor={isEmphasized ? 'auto' : undefined}\n isQuiet\n aria-label={stringFormatter.format('actionbar.actions')}>\n {children}\n </ActionButtonGroup>\n </div>\n <div className={style({order: 0, display: 'flex', alignItems: 'center', gap: 4})}>\n <CloseButton\n staticColor={isEmphasized ? 'auto' : undefined}\n aria-label={stringFormatter.format('actionbar.clearSelection')}\n onPress={() => onClearSelection?.()} />\n <span className={style({font: 'ui', color: {default: 'neutral', isEmphasized: 'gray-25'}})({isEmphasized})}>\n {lastCount === 'all'\n ? stringFormatter.format('actionbar.selectedAll')\n : stringFormatter.format('actionbar.selected', {count: lastCount})}\n </span>\n </div>\n </div>\n </FocusScope>\n );\n});\n\ninterface ActionBarContainerHookProps {\n selectedKeys?: 'all' | Iterable<Key>,\n defaultSelectedKeys?: 'all' | Iterable<Key>,\n onSelectionChange?: (keys: Set<Key>) => void,\n renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement,\n scrollRef?: RefObject<HTMLElement | null>\n}\n\nexport function useActionBarContainer(props: ActionBarContainerHookProps) {\n let {renderActionBar, scrollRef} = props;\n let [selectedKeys, setSelectedKeys] = useControlledState(props.selectedKeys, props.defaultSelectedKeys || new Set(), props.onSelectionChange);\n let selectedKeysSet = useMemo(() => selectedKeys === 'all' ? selectedKeys as 'all' : new Set(selectedKeys), [selectedKeys]);\n let actionBar = useMemo(() => renderActionBar?.(selectedKeysSet), [renderActionBar, selectedKeysSet]);\n let selectedItemCount = selectedKeysSet === 'all' ? 'all' as const : selectedKeysSet.size;\n let [actionBarHeight, setActionBarHeight] = useState(0);\n let actionBarRef = useCallback((ref: DOMRefValue | null) => {\n let actionBar = ref?.UNSAFE_getDOMNode();\n if (actionBar) {\n setActionBarHeight(actionBar.offsetHeight + 8);\n } else {\n setActionBarHeight(0);\n }\n }, []);\n\n let actionBarContext = useMemo(() => ({\n ref: actionBarRef,\n scrollRef,\n selectedItemCount,\n onClearSelection: () => setSelectedKeys(new Set())\n }), [scrollRef, actionBarRef, selectedItemCount, setSelectedKeys]);\n\n let wrappedActionBar = useMemo(() => (\n <ActionBarContext.Provider value={actionBarContext}>\n {actionBar}\n </ActionBarContext.Provider>\n ), [actionBarContext, actionBar]);\n\n return {\n selectedKeys,\n onSelectionChange: setSelectedKeys,\n actionBar: wrappedActionBar,\n actionBarHeight\n };\n}\n"],"names":[],"version":3,"file":"ActionBar.mjs.map"}
package/dist/Modal.cjs CHANGED
@@ -26,8 +26,6 @@ $parcel$export(module.exports, "Modal", () => $8e678305a8c10028$export$2b77a92f1
26
26
 
27
27
 
28
28
 
29
- const $8e678305a8c10028$var$fade = "-_1llqja1";
30
- const $8e678305a8c10028$var$fadeAndSlide = "-_1mhijd";
31
29
  const $8e678305a8c10028$var$modalOverlayStyles = function anonymous(props) {
32
30
  let rules = " .";
33
31
  if (props.colorScheme === "dark") rules += ' _Bb';
@@ -44,14 +42,12 @@ const $8e678305a8c10028$var$modalOverlayStyles = function anonymous(props) {
44
42
  rules += ' _0d';
45
43
  rules += ' _2c';
46
44
  rules += ' _3d';
47
- if (props.isExiting) rules += ' _T-jzzex7';
48
- else if (props.isEntering) rules += ' _T-jzzex7';
49
- if (props.isExiting) rules += ' _U-375x5l';
50
- else if (props.isEntering) rules += ' _U-375y1o';
51
- if (props.isExiting) rules += ' _Za';
52
- else if (props.isEntering) rules += ' _Za';
53
- if (props.isExiting) rules += ' _Wb';
54
- else if (props.isEntering) rules += ' _Wa';
45
+ if (props.isExiting) rules += ' _L-3t1x';
46
+ else if (props.isEntering) rules += ' _L-3t1x';
47
+ rules += ' _Pc';
48
+ if (props.isExiting) rules += ' _R-375x5l';
49
+ else rules += ' _R-375y1o';
50
+ rules += ' _Sa';
55
51
  return rules;
56
52
  };
57
53
  const $8e678305a8c10028$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $j6TWk$react.forwardRef)(function Modal(props1, ref) {
@@ -106,17 +102,15 @@ const $8e678305a8c10028$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $j6TWk$react
106
102
  else rules += ' p-yjhhbg';
107
103
  rules += ' -_1de2x0q_b-______x';
108
104
  rules += ' b-1de2x0q';
109
- if (props.isExiting) rules += ' _T-jzzex7';
110
- else if (props.isEntering) rules += ' _T-1addjaq';
111
- if (props.isExiting) rules += ' _U-375x5l';
112
- else if (props.isEntering) rules += ' _U-375y1o';
113
- if (props.isExiting) rules += ' _Za';
114
- else if (props.isEntering) rules += ' _Za';
115
- if (props.isExiting) rules += ' _V-3t1x';
116
- else if (props.isEntering) rules += ' _V-375x8c';
117
- if (props.isExiting) rules += ' _Wb';
118
- else if (props.isEntering) rules += ' _Wa';
119
- rules += ' _Xd';
105
+ if (props.isExiting) rules += ' _L-3t1x';
106
+ else if (props.isEntering) rules += ' _L-3t1x';
107
+ if (props.isEntering) rules += ' Qg';
108
+ rules += ' _P-19n5zko';
109
+ if (props.isExiting) rules += ' _R-375x5l';
110
+ else rules += ' _R-375y1o';
111
+ rules += ' _Sa';
112
+ if (props.isExiting) rules += ' _Q-3t1x';
113
+ else rules += ' _Q-375x8c';
120
114
  rules += ' _Mb';
121
115
  rules += ' _Ob';
122
116
  rules += ' da';
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBD,MAAM;AAUN,MAAM;AAYN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BC,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,MAAiB,EAAE,GAA2B;IAC3F,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,oCAAQ;IAElC,0DAA0D;IAC1D,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC;QACzB,OAA4C,OAAO,GAAG;QACvD,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;QACX;IACF,GAAG;QAAC;QAAQ;QAAW;KAAO;IAE9B,qBACE,gCAAC,CAAA,GAAA,uCAAW;QACT,GAAG,MAAK;QACT,WAAW,CAAA,cAAe,yCAAmB;gBAAC,GAAG,WAAW;6BAAE;YAAW;kBACzE,cAAA,gCAAC,CAAA,GAAA,gCAAO;YACL,GAAG,MAAK;YACT,KAAK;YACL,WAAW,CAAA,cAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiEvB;oBAAC,GAAG,WAAW;oBAAE,MAAM,OAAM,IAAI;gBAAA;;;AAG5C","sources":["packages/@react-spectrum/s2/src/Modal.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 {colorScheme} from './style-utils' with {type: 'macro'};\nimport {ColorSchemeContext} from './Provider';\nimport {DOMRef} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal, useLocale} from 'react-aria-components';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\ninterface ModalProps extends ModalOverlayProps {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst fade = keyframes(`\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n`);\n\nconst fadeAndSlide = keyframes(`\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`);\n\nconst modalOverlayStyles = style({\n ...colorScheme(),\n position: 'fixed',\n inset: 0,\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n animation: {\n isEntering: fade,\n isExiting: fade\n },\n animationDuration: {\n isEntering: 250,\n isExiting: 130\n },\n animationDirection: {\n isEntering: 'normal',\n isExiting: 'reverse'\n }\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576,\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '[90vw]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '[90vh]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n animation: {\n isEntering: fadeAndSlide,\n isExiting: fade\n },\n animationDuration: {\n isEntering: 250,\n isExiting: 130\n },\n animationDelay: {\n isEntering: 160,\n isExiting: 0\n },\n animationDirection: {\n isEntering: 'normal',\n isExiting: 'reverse'\n },\n animationFillMode: 'both',\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAmBD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAuBC,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,MAAiB,EAAE,GAA2B;IAC3F,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,oCAAQ;IAElC,0DAA0D;IAC1D,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC;QACzB,OAA4C,OAAO,GAAG;QACvD,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;QACX;IACF,GAAG;QAAC;QAAQ;QAAW;KAAO;IAE9B,qBACE,gCAAC,CAAA,GAAA,uCAAW;QACT,GAAG,MAAK;QACT,WAAW,CAAA,cAAe,yCAAmB;gBAAC,GAAG,WAAW;6BAAE;YAAW;kBACzE,cAAA,gCAAC,CAAA,GAAA,gCAAO;YACL,GAAG,MAAK;YACT,KAAK;YACL,WAAW,CAAA,cAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgEvB;oBAAC,GAAG,WAAW;oBAAE,MAAM,OAAM,IAAI;gBAAA;;;AAG5C","sources":["packages/@react-spectrum/s2/src/Modal.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 {colorScheme} from './style-utils' with {type: 'macro'};\nimport {ColorSchemeContext} from './Provider';\nimport {DOMRef} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal, useLocale} from 'react-aria-components';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\ninterface ModalProps extends ModalOverlayProps {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...colorScheme(),\n position: 'fixed',\n inset: 0,\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576,\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '[90vw]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '[90vh]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
package/dist/Modal.css CHANGED
@@ -1,25 +1,3 @@
1
- @keyframes -_1llqja1 {
2
- from {
3
- opacity: 0;
4
- }
5
-
6
- to {
7
- opacity: 1;
8
- }
9
- }
10
-
11
- @keyframes -_1mhijd {
12
- from {
13
- opacity: 0;
14
- transform: translateY(20px);
15
- }
16
-
17
- to {
18
- opacity: 1;
19
- transform: translateY(0);
20
- }
21
- }
22
-
23
1
  @layer _.a {
24
2
  ._B-10jn6wd {
25
3
  color-scheme: var(--lightningcss-light, light) var(--lightningcss-dark, dark);
@@ -86,6 +64,10 @@
86
64
  justify-content: center;
87
65
  }
88
66
 
67
+ ._Pc {
68
+ transition-property: opacity;
69
+ }
70
+
89
71
  ._0d {
90
72
  display: flex;
91
73
  }
@@ -178,44 +160,38 @@
178
160
  background-color: var(--s2-container-bg);
179
161
  }
180
162
 
181
- ._T-1addjaq {
182
- animation-name: -_1mhijd;
183
- }
184
-
185
- ._T-jzzex7 {
186
- animation-name: -_1llqja1;
187
- }
188
-
189
- ._U-375y1o {
190
- animation-duration: .25s;
163
+ ._L-3t1x {
164
+ opacity: 0;
165
+ opacity: 0;
191
166
  }
192
167
 
193
- ._U-375x5l {
194
- animation-duration: .13s;
168
+ .Qg {
169
+ --translateY: 1.25rem;
170
+ translate: var(--translateX, 0) var(--translateY, 0);
195
171
  }
196
172
 
197
- ._Za {
198
- animation-timing-function: cubic-bezier(.45, 0, .4, 1);
173
+ ._P-19n5zko {
174
+ transition-property: opacity, translate;
199
175
  }
200
176
 
201
- ._V-375x8c {
202
- animation-delay: .16s;
177
+ ._R-375y1o {
178
+ transition-duration: .25s;
203
179
  }
204
180
 
205
- ._V-3t1x {
206
- animation-delay: 0s;
181
+ ._R-375x5l {
182
+ transition-duration: .13s;
207
183
  }
208
184
 
209
- ._Wa {
210
- animation-direction: normal;
185
+ ._Sa {
186
+ transition-timing-function: cubic-bezier(.45, 0, .4, 1);
211
187
  }
212
188
 
213
- ._Wb {
214
- animation-direction: reverse;
189
+ ._Q-375x8c {
190
+ transition-delay: .16s;
215
191
  }
216
192
 
217
- ._Xd {
218
- animation-fill-mode: both;
193
+ ._Q-3t1x {
194
+ transition-delay: 0s;
219
195
  }
220
196
 
221
197
  ._Mb {
@@ -1 +1 @@
1
- {"mappings":"AC8Ba;;;;;;;;;;AAUQ;;;;;;;;;;;;AAYM;EAAA;;;;EAAA;;;;;;EAAA;IAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+CO;;;;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;;;;;AA/CP;;AA+CO","sources":["be2ce4448c91abb5","packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["@import \"003d01b6d2f33501\";\n@import \"15edcb25b251bc58\";\n@import \"1ef8b667afb08263\";\n@import \"3b2472fc4486ca92\";\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 {colorScheme} from './style-utils' with {type: 'macro'};\nimport {ColorSchemeContext} from './Provider';\nimport {DOMRef} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal, useLocale} from 'react-aria-components';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\ninterface ModalProps extends ModalOverlayProps {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst fade = keyframes(`\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n`);\n\nconst fadeAndSlide = keyframes(`\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`);\n\nconst modalOverlayStyles = style({\n ...colorScheme(),\n position: 'fixed',\n inset: 0,\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n animation: {\n isEntering: fade,\n isExiting: fade\n },\n animationDuration: {\n isEntering: 250,\n isExiting: 130\n },\n animationDirection: {\n isEntering: 'normal',\n isExiting: 'reverse'\n }\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576,\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '[90vw]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '[90vh]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n animation: {\n isEntering: fadeAndSlide,\n isExiting: fade\n },\n animationDuration: {\n isEntering: 250,\n isExiting: 130\n },\n animationDelay: {\n isEntering: 160,\n isExiting: 0\n },\n animationDirection: {\n isEntering: 'normal',\n isExiting: 'reverse'\n },\n animationFillMode: 'both',\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.css.map"}
1
+ {"mappings":"AC6B2B;EAAA;;;;EAAA;;;;;;EAAA;IAAA;;;;;;EAAA;;;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA4CO;;;;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;;;;;AA5CP;;AA4CO","sources":["be2ce4448c91abb5","packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["@import \"003d01b6d2f33501\";\n@import \"15edcb25b251bc58\";\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 {colorScheme} from './style-utils' with {type: 'macro'};\nimport {ColorSchemeContext} from './Provider';\nimport {DOMRef} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal, useLocale} from 'react-aria-components';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\n\ninterface ModalProps extends ModalOverlayProps {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...colorScheme(),\n position: 'fixed',\n inset: 0,\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576,\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: '[calc(100% - 40px)]',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '[90vw]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '[90vh]',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.css.map"}
package/dist/Modal.mjs CHANGED
@@ -20,8 +20,6 @@ import {useDOMRef as $fdAcL$useDOMRef} from "@react-spectrum/utils";
20
20
 
21
21
 
22
22
 
23
- const $c46d159bd615e407$var$fade = "-_1llqja1";
24
- const $c46d159bd615e407$var$fadeAndSlide = "-_1mhijd";
25
23
  const $c46d159bd615e407$var$modalOverlayStyles = function anonymous(props) {
26
24
  let rules = " .";
27
25
  if (props.colorScheme === "dark") rules += ' _Bb';
@@ -38,14 +36,12 @@ const $c46d159bd615e407$var$modalOverlayStyles = function anonymous(props) {
38
36
  rules += ' _0d';
39
37
  rules += ' _2c';
40
38
  rules += ' _3d';
41
- if (props.isExiting) rules += ' _T-jzzex7';
42
- else if (props.isEntering) rules += ' _T-jzzex7';
43
- if (props.isExiting) rules += ' _U-375x5l';
44
- else if (props.isEntering) rules += ' _U-375y1o';
45
- if (props.isExiting) rules += ' _Za';
46
- else if (props.isEntering) rules += ' _Za';
47
- if (props.isExiting) rules += ' _Wb';
48
- else if (props.isEntering) rules += ' _Wa';
39
+ if (props.isExiting) rules += ' _L-3t1x';
40
+ else if (props.isEntering) rules += ' _L-3t1x';
41
+ rules += ' _Pc';
42
+ if (props.isExiting) rules += ' _R-375x5l';
43
+ else rules += ' _R-375y1o';
44
+ rules += ' _Sa';
49
45
  return rules;
50
46
  };
51
47
  const $c46d159bd615e407$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $fdAcL$forwardRef)(function Modal(props1, ref) {
@@ -100,17 +96,15 @@ const $c46d159bd615e407$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $fdAcL$forwa
100
96
  else rules += ' p-yjhhbg';
101
97
  rules += ' -_1de2x0q_b-______x';
102
98
  rules += ' b-1de2x0q';
103
- if (props.isExiting) rules += ' _T-jzzex7';
104
- else if (props.isEntering) rules += ' _T-1addjaq';
105
- if (props.isExiting) rules += ' _U-375x5l';
106
- else if (props.isEntering) rules += ' _U-375y1o';
107
- if (props.isExiting) rules += ' _Za';
108
- else if (props.isEntering) rules += ' _Za';
109
- if (props.isExiting) rules += ' _V-3t1x';
110
- else if (props.isEntering) rules += ' _V-375x8c';
111
- if (props.isExiting) rules += ' _Wb';
112
- else if (props.isEntering) rules += ' _Wa';
113
- rules += ' _Xd';
99
+ if (props.isExiting) rules += ' _L-3t1x';
100
+ else if (props.isEntering) rules += ' _L-3t1x';
101
+ if (props.isEntering) rules += ' Qg';
102
+ rules += ' _P-19n5zko';
103
+ if (props.isExiting) rules += ' _R-375x5l';
104
+ else rules += ' _R-375y1o';
105
+ rules += ' _Sa';
106
+ if (props.isExiting) rules += ' _Q-3t1x';
107
+ else rules += ' _Q-375x8c';
114
108
  rules += ' _Mb';
115
109
  rules += ' _Ob';
116
110
  rules += ' da';