UNPKG

@react-spectrum/s2

Version:
1 lines 2.99 kB
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAYM,MAAM,0DAA2B,CAAA,GAAA,oBAAY,EAAiE;AAK9G,MAAM,0DAAoB,CAAA,GAAA,iBAAS,EAAE,SAAS,kBAAkB,KAA6B,EAAE,GAAiC;IACrI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WACF,UAAU,iBACV,OAAO,kBACP,cAAc,2BACd,WAAW,YACX,QAAQ,oBACR,mBAAmB,kBACnB,YAAY,UACZ,MAAM,EACP,GAAG;IAEJ,qBACE,gBAAC,CAAA,GAAA,wBAAmB;QACjB,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,CAAA,GAAA,yCAAe,EAAE;kBAAC;qBAAM;yBAAS;yBAAa;QAAW,GAAG;kBAC1F,cAAA,gBAAC,0CAAyB,QAAQ;YAAC,OAAO;sBACvC;;;AAIT","sources":["packages/@react-spectrum/s2/src/ToggleButtonGroup.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 {ActionButtonGroupProps, actionGroupStyle} from './ActionButtonGroup';\nimport {ContextValue, ToggleButtonGroup as RACToggleButtonGroup, ToggleButtonGroupProps as RACToggleButtonGroupProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef} from 'react';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonGroupProps extends ActionButtonGroupProps, Omit<RACToggleButtonGroupProps, 'children' | 'style' | 'className'> {\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonGroupContext = createContext<ContextValue<Partial<ToggleButtonGroupProps>, HTMLDivElement>>(null);\n\n/**\n * A ToggleButtonGroup is a grouping of related ToggleButtons, with single or multiple selection.\n */\nexport const ToggleButtonGroup = forwardRef(function ToggleButtonGroup(props: ToggleButtonGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonGroupContext);\n let {\n density = 'regular',\n size = 'M',\n orientation = 'horizontal',\n isJustified,\n children,\n UNSAFE_className = '',\n UNSAFE_style,\n styles\n } = props;\n\n return (\n <RACToggleButtonGroup\n {...props}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + actionGroupStyle({size, density, orientation, isJustified}, styles)}>\n <ToggleButtonGroupContext.Provider value={props}>\n {children}\n </ToggleButtonGroupContext.Provider>\n </RACToggleButtonGroup>\n );\n});\n"],"names":[],"version":3,"file":"ToggleButtonGroup.mjs.map"}