@react-spectrum/s2 3.0.0-nightly-c81a23ccd-250409 → 3.0.0-nightly-9723225d6-250412
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.
- package/dist/ActionButton.cjs +1 -0
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +1 -0
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +1 -1
- package/dist/Card.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +2 -2
- package/dist/ColorSwatchPicker.cjs.map +1 -1
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +2 -2
- package/dist/ColorSwatchPicker.mjs.map +1 -1
- package/dist/Content.cjs +6 -6
- package/dist/Content.cjs.map +1 -1
- package/dist/Content.mjs +6 -6
- package/dist/Content.mjs.map +1 -1
- package/dist/Disclosure.cjs +24 -21
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +12 -20
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +24 -21
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/NotificationBadge.cjs +15 -9
- package/dist/NotificationBadge.cjs.map +1 -1
- package/dist/NotificationBadge.css +22 -10
- package/dist/NotificationBadge.css.map +1 -1
- package/dist/NotificationBadge.mjs +15 -9
- package/dist/NotificationBadge.mjs.map +1 -1
- package/dist/TableView.cjs +28 -16
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +29 -17
- package/dist/TableView.mjs.map +1 -1
- package/dist/Toast.cjs +557 -0
- package/dist/Toast.cjs.map +1 -0
- package/dist/Toast.css +461 -0
- package/dist/Toast.css.map +1 -0
- package/dist/Toast.mjs +551 -0
- package/dist/Toast.mjs.map +1 -0
- package/dist/Toast_module.cjs +70 -0
- package/dist/Toast_module.cjs.map +1 -0
- package/dist/Toast_module.css +119 -0
- package/dist/Toast_module.css.map +1 -0
- package/dist/Toast_module.mjs +72 -0
- package/dist/Toast_module.mjs.map +1 -0
- package/dist/ar-AE.cjs +6 -1
- package/dist/ar-AE.cjs.map +1 -1
- package/dist/ar-AE.mjs +6 -1
- package/dist/ar-AE.mjs.map +1 -1
- package/dist/bg-BG.cjs +6 -1
- package/dist/bg-BG.cjs.map +1 -1
- package/dist/bg-BG.mjs +6 -1
- package/dist/bg-BG.mjs.map +1 -1
- package/dist/cs-CZ.cjs +10 -2
- package/dist/cs-CZ.cjs.map +1 -1
- package/dist/cs-CZ.mjs +10 -2
- package/dist/cs-CZ.mjs.map +1 -1
- package/dist/da-DK.cjs +8 -3
- package/dist/da-DK.cjs.map +1 -1
- package/dist/da-DK.mjs +8 -3
- package/dist/da-DK.mjs.map +1 -1
- package/dist/de-DE.cjs +7 -3
- package/dist/de-DE.cjs.map +1 -1
- package/dist/de-DE.mjs +7 -3
- package/dist/de-DE.mjs.map +1 -1
- package/dist/el-GR.cjs +6 -1
- package/dist/el-GR.cjs.map +1 -1
- package/dist/el-GR.mjs +6 -1
- package/dist/el-GR.mjs.map +1 -1
- package/dist/en-US.cjs +5 -1
- package/dist/en-US.cjs.map +1 -1
- package/dist/en-US.mjs +5 -1
- package/dist/en-US.mjs.map +1 -1
- package/dist/es-ES.cjs +10 -6
- package/dist/es-ES.cjs.map +1 -1
- package/dist/es-ES.mjs +10 -6
- package/dist/es-ES.mjs.map +1 -1
- package/dist/et-EE.cjs +6 -1
- package/dist/et-EE.cjs.map +1 -1
- package/dist/et-EE.mjs +6 -1
- package/dist/et-EE.mjs.map +1 -1
- package/dist/fi-FI.cjs +7 -2
- package/dist/fi-FI.cjs.map +1 -1
- package/dist/fi-FI.mjs +7 -2
- package/dist/fi-FI.mjs.map +1 -1
- package/dist/fr-FR.cjs +7 -3
- package/dist/fr-FR.cjs.map +1 -1
- package/dist/fr-FR.mjs +7 -3
- package/dist/fr-FR.mjs.map +1 -1
- package/dist/he-IL.cjs +9 -5
- package/dist/he-IL.cjs.map +1 -1
- package/dist/he-IL.mjs +9 -5
- package/dist/he-IL.mjs.map +1 -1
- package/dist/hr-HR.cjs +11 -3
- package/dist/hr-HR.cjs.map +1 -1
- package/dist/hr-HR.mjs +11 -3
- package/dist/hr-HR.mjs.map +1 -1
- package/dist/hu-HU.cjs +6 -1
- package/dist/hu-HU.cjs.map +1 -1
- package/dist/hu-HU.mjs +6 -1
- package/dist/hu-HU.mjs.map +1 -1
- package/dist/it-IT.cjs +6 -2
- package/dist/it-IT.cjs.map +1 -1
- package/dist/it-IT.mjs +6 -2
- package/dist/it-IT.mjs.map +1 -1
- package/dist/ja-JP.cjs +7 -2
- package/dist/ja-JP.cjs.map +1 -1
- package/dist/ja-JP.mjs +7 -2
- package/dist/ja-JP.mjs.map +1 -1
- package/dist/ko-KR.cjs +8 -3
- package/dist/ko-KR.cjs.map +1 -1
- package/dist/ko-KR.mjs +8 -3
- package/dist/ko-KR.mjs.map +1 -1
- package/dist/lt-LT.cjs +8 -3
- package/dist/lt-LT.cjs.map +1 -1
- package/dist/lt-LT.mjs +8 -3
- package/dist/lt-LT.mjs.map +1 -1
- package/dist/lv-LV.cjs +9 -4
- package/dist/lv-LV.cjs.map +1 -1
- package/dist/lv-LV.mjs +9 -4
- package/dist/lv-LV.mjs.map +1 -1
- package/dist/main.cjs +4 -2
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +4 -2
- package/dist/module.mjs.map +1 -1
- package/dist/nb-NO.cjs +12 -4
- package/dist/nb-NO.cjs.map +1 -1
- package/dist/nb-NO.mjs +12 -4
- package/dist/nb-NO.mjs.map +1 -1
- package/dist/nl-NL.cjs +6 -1
- package/dist/nl-NL.cjs.map +1 -1
- package/dist/nl-NL.mjs +6 -1
- package/dist/nl-NL.mjs.map +1 -1
- package/dist/pl-PL.cjs +11 -3
- package/dist/pl-PL.cjs.map +1 -1
- package/dist/pl-PL.mjs +11 -3
- package/dist/pl-PL.mjs.map +1 -1
- package/dist/pt-BR.cjs +6 -1
- package/dist/pt-BR.cjs.map +1 -1
- package/dist/pt-BR.mjs +6 -1
- package/dist/pt-BR.mjs.map +1 -1
- package/dist/pt-PT.cjs +6 -1
- package/dist/pt-PT.cjs.map +1 -1
- package/dist/pt-PT.mjs +6 -1
- package/dist/pt-PT.mjs.map +1 -1
- package/dist/ro-RO.cjs +8 -4
- package/dist/ro-RO.cjs.map +1 -1
- package/dist/ro-RO.mjs +8 -4
- package/dist/ro-RO.mjs.map +1 -1
- package/dist/ru-RU.cjs +11 -3
- package/dist/ru-RU.cjs.map +1 -1
- package/dist/ru-RU.mjs +11 -3
- package/dist/ru-RU.mjs.map +1 -1
- package/dist/sk-SK.cjs +10 -2
- package/dist/sk-SK.cjs.map +1 -1
- package/dist/sk-SK.mjs +10 -2
- package/dist/sk-SK.mjs.map +1 -1
- package/dist/sl-SI.cjs +11 -3
- package/dist/sl-SI.cjs.map +1 -1
- package/dist/sl-SI.mjs +11 -3
- package/dist/sl-SI.mjs.map +1 -1
- package/dist/sr-SP.cjs +10 -2
- package/dist/sr-SP.cjs.map +1 -1
- package/dist/sr-SP.mjs +10 -2
- package/dist/sr-SP.mjs.map +1 -1
- package/dist/sv-SE.cjs +6 -2
- package/dist/sv-SE.cjs.map +1 -1
- package/dist/sv-SE.mjs +6 -2
- package/dist/sv-SE.mjs.map +1 -1
- package/dist/tr-TR.cjs +7 -2
- package/dist/tr-TR.cjs.map +1 -1
- package/dist/tr-TR.mjs +7 -2
- package/dist/tr-TR.mjs.map +1 -1
- package/dist/types.d.ts +49 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.cjs +10 -2
- package/dist/uk-UA.cjs.map +1 -1
- package/dist/uk-UA.mjs +10 -2
- package/dist/uk-UA.mjs.map +1 -1
- package/dist/zh-CN.cjs +6 -1
- package/dist/zh-CN.cjs.map +1 -1
- package/dist/zh-CN.mjs +6 -1
- package/dist/zh-CN.mjs.map +1 -1
- package/dist/zh-TW.cjs +6 -1
- package/dist/zh-TW.cjs.map +1 -1
- package/dist/zh-TW.mjs +6 -1
- package/dist/zh-TW.mjs.map +1 -1
- package/package.json +20 -19
- package/src/ActionButton.tsx +1 -0
- package/src/Card.tsx +1 -1
- package/src/ColorSwatchPicker.tsx +2 -1
- package/src/Content.tsx +6 -6
- package/src/Disclosure.tsx +18 -24
- package/src/NotificationBadge.tsx +7 -3
- package/src/TableView.tsx +45 -29
- package/src/Toast.module.css +153 -0
- package/src/Toast.tsx +579 -0
- package/src/index.ts +3 -1
package/dist/Disclosure.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA+BM,MAAM,0DAAoB,CAAA,GAAA,0BAAY,EAAuE;AAEpH,MAAM;;;;;;;;;;;;;;;;;;;;;;AA2BC,MAAM,0DAAa,CAAA,GAAA,uBAAS,EAAE,SAAS,WAAW,KAAsB,EAAE,GAA2B;IAC1G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,cACP,UAAU,oBACV,OAAO,gBACP,YAAY,oBACZ,mBAAmB,IACpB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,YAAY,CAAA,GAAA,uBAAS,EAAE,+CAAuB;IAElD,qBACE,gCAAC,CAAA,GAAA,mCAAO;QACN,QAAQ;YACN;gBAAC;gBAAmB;0BAAC;6BAAM;6BAAS;gBAAO;aAAE;SAC9C;kBACD,cAAA,gCAAC,CAAA,GAAA,qCAAY;YACV,GAAG,KAAK;YACT,KAAK;YACL,OAAO;YACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,iCAAW;yBAAC;2BAAS;YAAS,GAAG,MAAM,MAAM;sBAClF,MAAM,QAAQ;;;A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AQ;QACZ,KAAK;QACL,OAAO;QACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,kCAAY;kBAAC;wBAAM;QAAU;kBAClE,MAAM,QAAQ;;AAGrB","sources":["packages/@react-spectrum/s2/src/Disclosure.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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'heading-xs',\n M: 'heading-sm',\n L: 'heading',\n XL: 'heading-lg'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n M: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n L: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n },\n XL: {\n density: {\n compact: 48,\n regular: 56,\n spacious: 64\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n let mapSize = {\n S: 'XS',\n M: 'S',\n L: 'M',\n XL: 'L'\n };\n\n // maps to one size smaller in the compact density to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n if (density === 'compact') {\n newSize = mapSize[size ?? 'M'] as 'XS' | 'S' | 'M' | 'L';\n }\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA+BM,MAAM,0DAAoB,CAAA,GAAA,0BAAY,EAAuE;AAEpH,MAAM;;;;;;;;;;;;;;;;;;;;;;AA2BC,MAAM,0DAAa,CAAA,GAAA,uBAAS,EAAE,SAAS,WAAW,KAAsB,EAAE,GAA2B;IAC1G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,cACP,UAAU,oBACV,OAAO,gBACP,YAAY,oBACZ,mBAAmB,IACpB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,YAAY,CAAA,GAAA,uBAAS,EAAE,+CAAuB;IAElD,qBACE,gCAAC,CAAA,GAAA,mCAAO;QACN,QAAQ;YACN;gBAAC;gBAAmB;0BAAC;6BAAM;6BAAS;gBAAO;aAAE;SAC9C;kBACD,cAAA,gCAAC,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AE;IAChC,IAAI,QAAC,IAAI,EAAC,GAAG,CAAA,GAAA,4CAAgB,EAAE;IAC/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,iDAAqB;IACnD,IAAI,WAAW,CAAA,GAAA,mCAAQ,EAAE;IACzB,qBACE,gCAAC,CAAA,GAAA,0CAAiB;QACf,GAAG,QAAQ;QACZ,KAAK;QACL,OAAO;QACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,kCAAY;kBAAC;wBAAM;QAAU;kBAClE,MAAM,QAAQ;;AAGrB","sources":["packages/@react-spectrum/s2/src/Disclosure.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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'title-sm',\n M: 'title',\n L: 'title-lg',\n XL: 'title-xl'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 18,\n regular: 24,\n spacious: 32\n }\n },\n M: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n L: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n XL: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n // Shift button size down by 2 for compact density, 1 for regular/spacious to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n const sizes = ['XS', 'S', 'M', 'L', 'XL'];\n const currentIndex = sizes.indexOf(size ?? 'M');\n const shift = density === 'compact' ? 2 : 1;\n newSize = sizes[Math.max(0, currentIndex - shift)] as 'XS' | 'S' | 'M' | 'L' | 'XL';\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.cjs.map"}
|
package/dist/Disclosure.css
CHANGED
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
outline-offset: -2px;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
._ee {
|
|
75
|
+
font-size: .875rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
._ei {
|
|
75
79
|
font-size: 1.125rem;
|
|
76
80
|
}
|
|
@@ -79,14 +83,6 @@
|
|
|
79
83
|
font-size: 1.25rem;
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
._ej {
|
|
83
|
-
font-size: 1.375rem;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
._en {
|
|
87
|
-
font-size: 1.75rem;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
86
|
._fd {
|
|
91
87
|
font-variation-settings: "wght" 700;
|
|
92
88
|
font-synthesis-weight: none;
|
|
@@ -213,6 +209,10 @@
|
|
|
213
209
|
-webkit-tap-highlight-color: #0000;
|
|
214
210
|
}
|
|
215
211
|
|
|
212
|
+
.-_375tou_o-G {
|
|
213
|
+
--o: calc(1.125rem * var(--s2-scale));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
216
|
.-_375tou_o-M {
|
|
217
217
|
--o: calc(1.5rem * var(--s2-scale));
|
|
218
218
|
}
|
|
@@ -233,10 +233,6 @@
|
|
|
233
233
|
--o: calc(3.5rem * var(--s2-scale));
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
.-_375tou_o-_q {
|
|
237
|
-
--o: calc(4rem * var(--s2-scale));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
236
|
.-_375tp0_u-a {
|
|
241
237
|
--u: 0px;
|
|
242
238
|
}
|
|
@@ -404,6 +400,10 @@
|
|
|
404
400
|
|
|
405
401
|
@layer _.b.b {
|
|
406
402
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
403
|
+
._ebf {
|
|
404
|
+
font-size: 1.0625rem;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
407
|
._ebj {
|
|
408
408
|
font-size: 1.375rem;
|
|
409
409
|
}
|
|
@@ -412,14 +412,6 @@
|
|
|
412
412
|
font-size: 1.5rem;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
._ebm {
|
|
416
|
-
font-size: 1.6875rem;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
._ebo {
|
|
420
|
-
font-size: 2.125rem;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
415
|
._ebh {
|
|
424
416
|
font-size: 1.1875rem;
|
|
425
417
|
}
|
package/dist/Disclosure.css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912b2c65\";\n@import \"54c3947845455457\";\n@import \"47e48706d70658de\";\n@import \"879f5cdc449bf13e\";\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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'heading-xs',\n M: 'heading-sm',\n L: 'heading',\n XL: 'heading-lg'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n M: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n L: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n },\n XL: {\n density: {\n compact: 48,\n regular: 56,\n spacious: 64\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n let mapSize = {\n S: 'XS',\n M: 'S',\n L: 'M',\n XL: 'L'\n };\n\n // maps to one size smaller in the compact density to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n if (density === 'compact') {\n newSize = mapSize[size ?? 'M'] as 'XS' | 'S' | 'M' | 'L';\n }\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.css.map"}
|
|
1
|
+
{"mappings":"AC2CmB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAsEE;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAQA;;;;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;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA4EC;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAuCwB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6D1B;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA9PD;EAAA;;;;EAAA;;;;EA8EE;;;;EAgLD;;;;EAAA;;;;;AAhLC;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAgLD","sources":["af82a6f8008c749b","packages/@react-spectrum/s2/src/Disclosure.tsx"],"sourcesContent":["@import \"02b9b02b69a441b2\";\n@import \"80d1cf6aba9342e9\";\n@import \"d47c144c912b2c65\";\n@import \"54c3947845455457\";\n@import \"47e48706d70658de\";\n@import \"879f5cdc449bf13e\";\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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'title-sm',\n M: 'title',\n L: 'title-lg',\n XL: 'title-xl'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 18,\n regular: 24,\n spacious: 32\n }\n },\n M: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n L: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n XL: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n // Shift button size down by 2 for compact density, 1 for regular/spacious to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n const sizes = ['XS', 'S', 'M', 'L', 'XL'];\n const currentIndex = sizes.indexOf(size ?? 'M');\n const shift = density === 'compact' ? 2 : 1;\n newSize = sizes[Math.max(0, currentIndex - shift)] as 'XS' | 'S' | 'M' | 'L' | 'XL';\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.css.map"}
|
package/dist/Disclosure.mjs
CHANGED
|
@@ -97,17 +97,17 @@ const $cf1d656285911959$var$buttonStyles = function anonymous(props) {
|
|
|
97
97
|
rules += ' _d-enzrfpb';
|
|
98
98
|
rules += ' _da';
|
|
99
99
|
if (props.size === "XL") {
|
|
100
|
-
rules += ' _ebo';
|
|
101
|
-
rules += ' _en';
|
|
102
|
-
} else if (props.size === "L") {
|
|
103
|
-
rules += ' _ebm';
|
|
104
|
-
rules += ' _ej';
|
|
105
|
-
} else if (props.size === "M") {
|
|
106
100
|
rules += ' _ebl';
|
|
107
101
|
rules += ' _ek';
|
|
108
|
-
} else if (props.size === "
|
|
102
|
+
} else if (props.size === "L") {
|
|
109
103
|
rules += ' _ebj';
|
|
110
104
|
rules += ' _ei';
|
|
105
|
+
} else if (props.size === "M") {
|
|
106
|
+
rules += ' _ebh';
|
|
107
|
+
rules += ' _eg';
|
|
108
|
+
} else if (props.size === "S") {
|
|
109
|
+
rules += ' _ebf';
|
|
110
|
+
rules += ' _ee';
|
|
111
111
|
}
|
|
112
112
|
rules += ' _fd';
|
|
113
113
|
rules += ' _g-1x99dlob';
|
|
@@ -156,21 +156,21 @@ const $cf1d656285911959$var$buttonStyles = function anonymous(props) {
|
|
|
156
156
|
rules += ' _ka';
|
|
157
157
|
rules += ' __S-yksgrp';
|
|
158
158
|
if (props.size === "XL") {
|
|
159
|
-
if (props.density === "spacious") rules += ' -_375tou_o-_q';
|
|
160
|
-
else if (props.density === "regular") rules += ' -_375tou_o-_i';
|
|
161
|
-
else if (props.density === "compact") rules += ' -_375tou_o-_a';
|
|
162
|
-
} else if (props.size === "L") {
|
|
163
159
|
if (props.density === "spacious") rules += ' -_375tou_o-_i';
|
|
164
160
|
else if (props.density === "regular") rules += ' -_375tou_o-_a';
|
|
165
161
|
else if (props.density === "compact") rules += ' -_375tou_o-2';
|
|
166
|
-
} else if (props.size === "
|
|
162
|
+
} else if (props.size === "L") {
|
|
167
163
|
if (props.density === "spacious") rules += ' -_375tou_o-_a';
|
|
168
164
|
else if (props.density === "regular") rules += ' -_375tou_o-2';
|
|
169
165
|
else if (props.density === "compact") rules += ' -_375tou_o-U';
|
|
170
|
-
} else if (props.size === "
|
|
166
|
+
} else if (props.size === "M") {
|
|
171
167
|
if (props.density === "spacious") rules += ' -_375tou_o-2';
|
|
172
168
|
else if (props.density === "regular") rules += ' -_375tou_o-U';
|
|
173
169
|
else if (props.density === "compact") rules += ' -_375tou_o-M';
|
|
170
|
+
} else if (props.size === "S") {
|
|
171
|
+
if (props.density === "spacious") rules += ' -_375tou_o-U';
|
|
172
|
+
else if (props.density === "regular") rules += ' -_375tou_o-M';
|
|
173
|
+
else if (props.density === "compact") rules += ' -_375tou_o-G';
|
|
174
174
|
}
|
|
175
175
|
rules += ' -_375tp0_u-a';
|
|
176
176
|
rules += ' -_375tp1_v-a';
|
|
@@ -192,15 +192,18 @@ function $cf1d656285911959$var$DisclosureHeaderWithForwardRef(props, ref) {
|
|
|
192
192
|
let { UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style, children: children } = props;
|
|
193
193
|
let domRef = (0, $7VHtn$useDOMRef)(ref);
|
|
194
194
|
let { size: size, isQuiet: isQuiet, density: density } = (0, $7VHtn$useSlottedContext)($cf1d656285911959$export$d665dd135a51b28a);
|
|
195
|
-
|
|
196
|
-
S: 'XS',
|
|
197
|
-
M: 'S',
|
|
198
|
-
L: 'M',
|
|
199
|
-
XL: 'L'
|
|
200
|
-
};
|
|
201
|
-
// maps to one size smaller in the compact density to ensure there is space between the top and bottom of the action button and container
|
|
195
|
+
// Shift button size down by 2 for compact density, 1 for regular/spacious to ensure there is space between the top and bottom of the action button and container
|
|
202
196
|
let newSize = size;
|
|
203
|
-
|
|
197
|
+
const sizes = [
|
|
198
|
+
'XS',
|
|
199
|
+
'S',
|
|
200
|
+
'M',
|
|
201
|
+
'L',
|
|
202
|
+
'XL'
|
|
203
|
+
];
|
|
204
|
+
const currentIndex = sizes.indexOf(size ?? 'M');
|
|
205
|
+
const shift = density === 'compact' ? 2 : 1;
|
|
206
|
+
newSize = sizes[Math.max(0, currentIndex - shift)];
|
|
204
207
|
return /*#__PURE__*/ (0, $7VHtn$jsx)((0, $7VHtn$Provider), {
|
|
205
208
|
values: [
|
|
206
209
|
[
|
package/dist/Disclosure.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;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AAK;;8BAC/F,gBAAC,CAAA,GAAA,yCAAa;8BACZ,cAAA,gBAAC,CAAA,GAAA,wCAAM;wBAAE,MAAM;wBAAM,WAAW,oCAAc;wCAAC;mCAAY;wBAAK;wBAAI,eAAY;;;gBAEjF,MAAM,QAAQ;;;;IAIrB,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IACrB,IAAI,KACF,OAAO;IAGT,qBACE,gBAAC;kBACE;;AAGP;AAMA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBC,MAAM,0DAAkB,CAAA,GAAA,iBAAS,EAAE,SAAS,gBAAgB,KAA2B,EAAE,GAA2B;IACzH,IAAI,gBACF,YAAY,oBACZ,mBAAmB,IACnB,GAAG,YACJ,GAAG;IACJ,MAAM,WAAW,CAAA,GAAA,qBAAa,EAAE;IAChC,IAAI,QAAC,IAAI,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;IAC/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6BAAqB;IACnD,IAAI,WAAW,CAAA,GAAA,gBAAQ,EAAE;IACzB,qBACE,gBAAC,CAAA,GAAA,sBAAiB;QACf,GAAG,QAAQ;QACZ,KAAK;QACL,OAAO;QACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,kCAAY;kBAAC;wBAAM;QAAU;kBAClE,MAAM,QAAQ;;AAGrB","sources":["packages/@react-spectrum/s2/src/Disclosure.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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'heading-xs',\n M: 'heading-sm',\n L: 'heading',\n XL: 'heading-lg'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n M: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n L: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n },\n XL: {\n density: {\n compact: 48,\n regular: 56,\n spacious: 64\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n let mapSize = {\n S: 'XS',\n M: 'S',\n L: 'M',\n XL: 'L'\n };\n\n // maps to one size smaller in the compact density to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n if (density === 'compact') {\n newSize = mapSize[size ?? 'M'] as 'XS' | 'S' | 'M' | 'L';\n }\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA+BM,MAAM,0DAAoB,CAAA,GAAA,oBAAY,EAAuE;AAEpH,MAAM;;;;;;;;;;;;;;;;;;;;;;AA2BC,MAAM,0DAAa,CAAA,GAAA,iBAAS,EAAE,SAAS,WAAW,KAAsB,EAAE,GAA2B;IAC1G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,cACP,UAAU,oBACV,OAAO,gBACP,YAAY,oBACZ,mBAAmB,IACpB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,IAAI,YAAY,CAAA,GAAA,iBAAS,EAAE,+CAAuB;IAElD,qBACE,gBAAC,CAAA,GAAA,eAAO;QACN,QAAQ;YACN;gBAAC;gBAAmB;0BAAC;6BAAM;6BAAS;gBAAO;aAAE;SAC9C;kBACD,cAAA,gBAAC,CAAA,GAAA,iBAAY;YACV,GAAG,KAAK;YACT,KAAK;YACL,OAAO;YACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,iCAAW;yBAAC;2BAAS;YAAS,GAAG,MAAM,MAAM;sBAClF,MAAM,QAAQ;;;AAIvB;AAgBA,MAAM;AAQN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EN,MAAM;;;;;;;;;;;AAaN,MAAM,+DAA2B,CAAA,GAAA,oBAAY,EAAa;AAE1D,SAAS,qDAA+B,KAA4B,EAAE,GAA2B;IAC/F,IAAI,oBACF,gBAAgB,gBAChB,YAAY,YACZ,QAAQ,EACT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,cAAM;QACJ,GAAG,QAAQ;QACZ,OAAO;QACP,KAAK;QACL,OAAO;QACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK;kBACtC,cAAA,iBAAC,CAAA,GAAA,aAAK;YAAE,WAAW,CAAC,cAAgB,mCAAa;oBAAC,GAAG,WAAW;0BAAE;6BAAM;6BAAS;gBAAO;YAAI,MAAK;;8BAC/F,gBAAC,CAAA,GAAA,yCAAa;8BACZ,cAAA,gBAAC,CAAA,GAAA,wCAAM;wBAAE,MAAM;wBAAM,WAAW,oCAAc;wCAAC;mCAAY;wBAAK;wBAAI,eAAY;;;gBAEjF,MAAM,QAAQ;;;;IAIrB,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IACrB,IAAI,KACF,OAAO;IAGT,qBACE,gBAAC;kBACE;;AAGP;AAMA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBC,MAAM,0DAAkB,CAAA,GAAA,iBAAS,EAAE,SAAS,gBAAgB,KAA2B,EAAE,GAA2B;IACzH,IAAI,gBACF,YAAY,oBACZ,mBAAmB,IACnB,GAAG,YACJ,GAAG;IACJ,MAAM,WAAW,CAAA,GAAA,qBAAa,EAAE;IAChC,IAAI,QAAC,IAAI,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;IAC/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6BAAqB;IACnD,IAAI,WAAW,CAAA,GAAA,gBAAQ,EAAE;IACzB,qBACE,gBAAC,CAAA,GAAA,sBAAiB;QACf,GAAG,QAAQ;QACZ,KAAK;QACL,OAAO;QACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,kCAAY;kBAAC;wBAAM;QAAU;kBAClE,MAAM,QAAQ;;AAGrB","sources":["packages/@react-spectrum/s2/src/Disclosure.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 {ActionButtonContext} from './ActionButton';\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';\nimport {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';\nimport {CenterBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };\nimport Chevron from '../ui-icons/Chevron';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, lightDark, style} from '../style' with { type: 'macro' };\nimport React, {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface DisclosureProps extends Omit<RACDisclosureProps, 'className' | 'style' | 'children'>, StyleProps {\n /**\n * The size of the disclosure.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * The amount of space between the disclosures.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /** Whether the disclosure should be displayed with a quiet style. */\n isQuiet?: boolean,\n /** The contents of the disclosure, consisting of a DisclosureTitle and DisclosurePanel. */\n children: ReactNode\n}\n\nexport const DisclosureContext = createContext<ContextValue<Partial<DisclosureProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst disclosure = style({\n color: 'heading',\n borderTopWidth: {\n default: 1,\n isQuiet: 0\n },\n borderBottomWidth: {\n default: 1,\n isQuiet: 0,\n isInGroup: {\n default: 0,\n ':last-child': {\n default: 1,\n isQuiet: 0\n }\n }\n },\n borderStartWidth: 0,\n borderEndWidth: 0,\n borderStyle: 'solid',\n borderColor: 'gray-200',\n minWidth: 200\n}, getAllowedOverrides());\n\n/**\n * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.\n */\nexport const Disclosure = forwardRef(function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, DisclosureContext);\n let {\n size = 'M',\n density = 'regular',\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let isInGroup = useContext(DisclosureContext) !== null;\n\n return (\n <Provider\n values={[\n [DisclosureContext, {size, isQuiet, density}]\n ]}>\n <RACDisclosure\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + disclosure({isQuiet, isInGroup}, props.styles)}>\n {props.children}\n </RACDisclosure>\n </Provider>\n );\n});\n\nexport interface DisclosureTitleProps extends UnsafeStyles, DOMProps {\n /** The heading level of the disclosure header.\n * \n * @default 3\n */\n level?: number,\n /** The contents of the disclosure header. */\n children: React.ReactNode\n}\n\ninterface DisclosureHeaderProps extends UnsafeStyles, DOMProps {\n children: React.ReactNode\n}\n\nconst headingStyle = style({\n margin: 0,\n flexGrow: 1,\n display: 'flex',\n flexShrink: 1,\n minWidth: 0\n});\n\nconst buttonStyles = style({\n ...focusRing(),\n outlineOffset: -2,\n font: 'heading',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n fontWeight: 'bold',\n fontSize: {\n size: {\n S: 'title-sm',\n M: 'title',\n L: 'title-lg',\n XL: 'title-xl'\n }\n },\n lineHeight: 'ui',\n display: 'flex',\n flexGrow: 1,\n alignItems: 'baseline',\n paddingX: '[calc(self(minHeight) * 3/8 - 1px)]',\n paddingY: centerPadding(),\n gap: '[calc(self(minHeight) * 3/8 - 1px)]',\n minHeight: {\n // compact is equivalent to 'control', but other densities have more padding.\n size: {\n S: {\n density: {\n compact: 18,\n regular: 24,\n spacious: 32\n }\n },\n M: {\n density: {\n compact: 24,\n regular: 32,\n spacious: 40\n }\n },\n L: {\n density: {\n compact: 32,\n regular: 40,\n spacious: 48\n }\n },\n XL: {\n density: {\n compact: 40,\n regular: 48,\n spacious: 56\n }\n }\n }\n },\n width: 'full',\n backgroundColor: {\n default: 'transparent',\n isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),\n isHovered: lightDark('transparent-black-100', 'transparent-white-100'),\n isPressed: lightDark('transparent-black-300', 'transparent-white-300')\n },\n transition: 'default',\n borderWidth: 0,\n borderRadius: {\n // Only rounded for keyboard focus and quiet.\n default: 'none',\n isFocusVisible: 'control',\n isQuiet: 'control'\n },\n textAlign: 'start',\n disableTapHighlight: true\n});\n\nconst chevronStyles = style({\n rotate: {\n isRTL: 180,\n isExpanded: 90\n },\n transition: 'default',\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n flexShrink: 0\n});\n\nconst InternalDisclosureHeader = createContext<{} | null>(null);\n\nfunction DisclosureHeaderWithForwardRef(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_className,\n UNSAFE_style,\n children\n } = props;\n let domRef = useDOMRef(ref);\n let {size, isQuiet, density} = useSlottedContext(DisclosureContext)!;\n\n // Shift button size down by 2 for compact density, 1 for regular/spacious to ensure there is space between the top and bottom of the action button and container\n let newSize : 'XS' | 'S' | 'M' | 'L' | 'XL' | undefined = size;\n const sizes = ['XS', 'S', 'M', 'L', 'XL'];\n const currentIndex = sizes.indexOf(size ?? 'M');\n const shift = density === 'compact' ? 2 : 1;\n newSize = sizes[Math.max(0, currentIndex - shift)] as 'XS' | 'S' | 'M' | 'L' | 'XL';\n\n return (\n <Provider\n values={[\n [ActionButtonContext, {size: newSize, isQuiet}],\n [InternalDisclosureHeader, {}]\n ]}>\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + style({display: 'flex', alignItems: 'center', gap: 4})}\n ref={domRef}>\n {children}\n </div>\n </Provider>\n );\n}\n\n/**\n * A wrapper element for the disclosure title that can contain other elements not part of the trigger.\n */\nexport const DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeaderWithForwardRef);\n\n/**\n * A disclosure title consisting of a heading and a trigger button to expand/collapse the panel.\n */\nexport const DisclosureTitle = forwardRef(function DisclosureTitle(props: DisclosureTitleProps, ref: DOMRef<HTMLDivElement>) {\n let {\n level = 3,\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n const domProps = filterDOMProps(otherProps);\n let {direction} = useLocale();\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let {size, density, isQuiet} = useSlottedContext(DisclosureContext)!;\n let isRTL = direction === 'rtl';\n\n let buttonTrigger = (\n <Heading\n {...domProps}\n level={level}\n ref={domRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + headingStyle}>\n <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot=\"trigger\">\n <CenterBaseline>\n <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden=\"true\" />\n </CenterBaseline>\n {props.children}\n </Button>\n </Heading>\n );\n let ctx = useContext(InternalDisclosureHeader);\n if (ctx) {\n return buttonTrigger;\n }\n\n return (\n <DisclosureHeader>\n {buttonTrigger}\n </DisclosureHeader>\n );\n});\n\nexport interface DisclosurePanelProps extends Omit<RACDisclosurePanelProps, 'className' | 'style' | 'children'>, UnsafeStyles, DOMProps, AriaLabelingProps {\n children: React.ReactNode\n}\n\nconst panelStyles = style({\n font: 'body',\n paddingTop: {\n isExpanded: 8\n },\n paddingBottom: {\n isExpanded: 16\n },\n paddingX: {\n isExpanded: {\n size: {\n S: 8,\n M: 9,\n L: 12,\n XL: 15\n }\n }\n }\n});\n\n/**\n * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.\n */\nexport const DisclosurePanel = forwardRef(function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement>) {\n let {\n UNSAFE_style,\n UNSAFE_className = '',\n ...otherProps\n } = props;\n const domProps = filterDOMProps(otherProps);\n let {size} = useSlottedContext(DisclosureContext)!;\n let {isExpanded} = useContext(DisclosureStateContext)!;\n let panelRef = useDOMRef(ref);\n return (\n <RACDisclosurePanel\n {...domProps}\n ref={panelRef}\n style={UNSAFE_style}\n className={(UNSAFE_className ?? '') + panelStyles({size, isExpanded})}>\n {props.children}\n </RACDisclosurePanel>\n );\n});\n\n"],"names":[],"version":3,"file":"Disclosure.mjs.map"}
|
|
@@ -71,7 +71,8 @@ const $cd7301fb33ba8690$var$badge = function anonymous(props, overrides) {
|
|
|
71
71
|
rules += ' _g-1x99dlob';
|
|
72
72
|
rules += ' _ga';
|
|
73
73
|
rules += ' aa_____K';
|
|
74
|
-
rules += '
|
|
74
|
+
if (props.isStaticColor) rules += ' a_____R';
|
|
75
|
+
else rules += ' ac';
|
|
75
76
|
rules += ' waa';
|
|
76
77
|
rules += ' ua-375yri';
|
|
77
78
|
rules += ' va-375yri';
|
|
@@ -80,21 +81,25 @@ const $cd7301fb33ba8690$var$badge = function anonymous(props, overrides) {
|
|
|
80
81
|
rules += ' ca_____I';
|
|
81
82
|
rules += ' _3d';
|
|
82
83
|
rules += ' _2c';
|
|
83
|
-
rules += '
|
|
84
|
-
if (props.isPressed) rules += ' b_____S';
|
|
85
|
-
else if (props.isFocusVisible) rules += ' b_____S';
|
|
86
|
-
else if (props.isHovered) rules += ' b_____S';
|
|
87
|
-
else rules += ' b_____R';
|
|
84
|
+
rules += ' b-375toh';
|
|
88
85
|
rules += ' k-375toq';
|
|
89
86
|
if (props.isSingleDigit) rules += ' _cb';
|
|
90
87
|
else if (props.isIndicatorOnly) rules += ' _cb';
|
|
91
|
-
if (!$l) rules += '
|
|
88
|
+
if (!$l) rules += ' ld';
|
|
92
89
|
if (props.isDoubleDigit) rules += ' CI';
|
|
93
90
|
if (props.isDoubleDigit) rules += ' DI';
|
|
94
91
|
rules += ' _wg';
|
|
95
92
|
rules += ' _xg';
|
|
96
93
|
rules += ' _yg';
|
|
97
94
|
rules += ' _zg';
|
|
95
|
+
rules += ' -_375toh_b-a_____J';
|
|
96
|
+
if (props.isStaticColor) rules += ' -_375toh_b-_____G';
|
|
97
|
+
else {
|
|
98
|
+
if (props.isPressed) rules += ' -_375toh_b-_____S';
|
|
99
|
+
else if (props.isFocusVisible) rules += ' -_375toh_b-_____S';
|
|
100
|
+
else if (props.isHovered) rules += ' -_375toh_b-_____S';
|
|
101
|
+
else rules += ' -_375toh_b-_____R';
|
|
102
|
+
}
|
|
98
103
|
if (props.size === "XL") {
|
|
99
104
|
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
100
105
|
else rules += ' -_375toq_k-G';
|
|
@@ -113,7 +118,7 @@ const $cd7301fb33ba8690$var$badge = function anonymous(props, overrides) {
|
|
|
113
118
|
const $cd7301fb33ba8690$export$529cab0ca6be204e = /*#__PURE__*/ (0, $62rny$react.forwardRef)(function Badge(props, ref) {
|
|
114
119
|
let stringFormatter = (0, $62rny$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
|
|
115
120
|
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $cd7301fb33ba8690$export$9ab75c96ebaa396c);
|
|
116
|
-
let { size: size = 'S', value: value, isDisabled: isDisabled = false, ...otherProps } = props;
|
|
121
|
+
let { size: size = 'S', value: value, isDisabled: isDisabled = false, staticColor: staticColor, ...otherProps } = props;
|
|
117
122
|
let domRef = (0, $62rny$reactspectrumutils.useDOMRef)(ref);
|
|
118
123
|
let { locale: locale } = (0, $62rny$reactariai18n.useLocale)();
|
|
119
124
|
let formattedValue = '';
|
|
@@ -145,7 +150,8 @@ const $cd7301fb33ba8690$export$529cab0ca6be204e = /*#__PURE__*/ (0, $62rny$react
|
|
|
145
150
|
isIndicatorOnly: isIndicatorOnly,
|
|
146
151
|
isSingleDigit: isSingleDigit,
|
|
147
152
|
isDoubleDigit: isDoubleDigit,
|
|
148
|
-
isDisabled: isDisabled
|
|
153
|
+
isDisabled: isDisabled,
|
|
154
|
+
isStaticColor: !!staticColor
|
|
149
155
|
}, props.styles),
|
|
150
156
|
style: props.UNSAFE_style,
|
|
151
157
|
ref: domRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoCM,MAAM,0DAA2B,CAAA,GAAA,0BAAY,EAAqF;AAEzI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEC,MAAM,0DAAoB,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,KAA6B,EAAE,GAA2B;IACnH,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,YACP,KAAK,cACL,aAAa,oBACb,WAAW,EACX,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,iBAAiB;IAErB,IAAI,kBAAkB;IACtB,IAAI,gBAAgB;IACpB,IAAI,gBAAgB;IAEpB,IAAI,SAAS,MACX,kBAAkB;SACb,IAAI,SAAS,GAClB,MAAM,IAAI,MAAM;SACX,IAAI,CAAC,OAAO,SAAS,CAAC,QAC3B,MAAM,IAAI,MAAM;SACX;QACL,iBAAiB,IAAI,CAAA,GAAA,8CAAc,EAAE,QAAQ,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO;QACpE,IAAI,SAAS,KAAK,GAAG,CAAC,SAAS,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG,IAAI,GAAI,4GAA4G;QACpL,IAAI,WAAW,GACb,gBAAgB;aACX,IAAI,WAAW,GACpB,gBAAgB;QAGlB,IAAI,QAAQ,IACV,iBAAiB,gBAAgB,MAAM,CAAC,0BAA0B;YAAC,eAAe;QAAc;IAEpG;IAEA,IAAI,YAAY,KAAK,CAAC,aAAa,IAAI;IACvC,IAAI,cAAc,aAAa,iBAC7B,YAAY,gBAAgB,MAAM,CAAC;IAGrC,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,YAAY;YAAC,WAAW;QAAI,EAAE;QACjD,MAAM,aAAa;QACnB,cAAY;QACZ,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,4BAAM;kBAAC;6BAAM;2BAAiB;2BAAe;wBAAe;YAAY,eAAe,CAAC,CAAC;QAAW,GAAG,MAAM,MAAM;QAC/J,OAAO,MAAM,YAAY;QACzB,KAAK;kBACJ;;AAGP","sources":["packages/@react-spectrum/s2/src/NotificationBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFormatter} from '@internationalized/number';\nimport React, {createContext, forwardRef} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface NotificationBadgeStyleProps {\n /**\n * The size of the notification badge.\n *\n * @default 'S'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport interface NotificationBadgeProps extends DOMProps, AriaLabelingProps, StyleProps, NotificationBadgeStyleProps, SlotProps {\n /**\n * The value to be displayed in the notification badge.\n */\n value?: number | null\n}\n\ninterface NotificationBadgeContextProps extends Partial<NotificationBadgeProps> {\n isDisabled?: boolean,\n staticColor?: 'black' | 'white' | 'auto'\n}\n\nexport const NotificationBadgeContext = createContext<ContextValue<Partial<NotificationBadgeContextProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst badge = style({\n display: {\n default: 'flex',\n isDisabled: 'none'\n },\n font: 'control',\n color: {\n default: 'white',\n isStaticColor: 'auto',\n forcedColors: 'ButtonText'\n },\n fontSize: {\n size: {\n S: 'ui-xs',\n M: 'ui-xs',\n L: 'ui-sm',\n XL: 'ui'\n }\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderWidth: {\n forcedColors: '[1px]'\n },\n borderColor: {\n forcedColors: 'ButtonBorder'\n },\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'ButtonFace'\n },\n height: {\n size: {\n S: {\n default: 12,\n isIndicatorOnly: 8\n },\n M: {\n default: fontRelative(18), // sort of arbitrary? tried to get as close to the figma designs as possible\n isIndicatorOnly: 8\n },\n L: {\n default: 16,\n isIndicatorOnly: fontRelative(12)\n },\n XL: {\n default: 18,\n isIndicatorOnly: fontRelative(12)\n }\n }\n },\n aspectRatio: {\n isIndicatorOnly: 'square',\n isSingleDigit: 'square'\n },\n width: 'max',\n paddingX: {\n isDoubleDigit: 'edge-to-text'\n },\n borderRadius: 'pill'\n}, getAllowedOverrides());\n\n/**\n * Notification badges are used to indicate new or pending activity .\n */\nexport const NotificationBadge = forwardRef(function Badge(props: NotificationBadgeProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, NotificationBadgeContext);\n let {\n size = 'S',\n value,\n isDisabled = false,\n staticColor,\n ...otherProps\n } = props as NotificationBadgeContextProps;\n let domRef = useDOMRef(ref);\n let {locale} = useLocale();\n let formattedValue = '';\n\n let isIndicatorOnly = false;\n let isSingleDigit = false;\n let isDoubleDigit = false;\n\n if (value == null) {\n isIndicatorOnly = true;\n } else if (value <= 0) {\n throw new Error('Value cannot be negative or zero');\n } else if (!Number.isInteger(value)) {\n throw new Error('Value must be a positive integer');\n } else {\n formattedValue = new NumberFormatter(locale).format(Math.min(value, 99));\n let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)\n if (length === 1) {\n isSingleDigit = true;\n } else if (length === 2) {\n isDoubleDigit = true;\n }\n\n if (value > 99) {\n formattedValue = stringFormatter.format('notificationbadge.plus', {notifications: formattedValue});\n }\n }\n\n let ariaLabel = props['aria-label'] || undefined;\n if (ariaLabel === undefined && isIndicatorOnly) {\n ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');\n }\n\n return (\n <span\n {...filterDOMProps(otherProps, {labelable: true})}\n role={ariaLabel && 'img'}\n aria-label={ariaLabel}\n className={(props.UNSAFE_className || '') + badge({size, isIndicatorOnly, isSingleDigit, isDoubleDigit, isDisabled, isStaticColor: !!staticColor}, props.styles)}\n style={props.UNSAFE_style}\n ref={domRef}>\n {formattedValue}\n </span>\n );\n});\n"],"names":[],"version":3,"file":"NotificationBadge.cjs.map"}
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
color: #fff;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
.a_____R {
|
|
41
|
+
color: lch(from var(--b, var(--s2-container-bg)) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
._3d {
|
|
41
45
|
justify-content: center;
|
|
42
46
|
}
|
|
@@ -45,12 +49,8 @@
|
|
|
45
49
|
align-items: center;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
.
|
|
49
|
-
background-color: var(--
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.b_____S {
|
|
53
|
-
background-color: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
52
|
+
.b-375toh {
|
|
53
|
+
background-color: var(--b);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.k-375toq {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
aspect-ratio: 1;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.
|
|
66
|
-
width:
|
|
65
|
+
.ld {
|
|
66
|
+
width: max-content;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.CI {
|
|
@@ -90,6 +90,18 @@
|
|
|
90
90
|
border-end-end-radius: calc(var(--k, var(--o, 9999px)) / 2);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
.-_375toh_b-_____R {
|
|
94
|
+
--b: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #4069fd);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.-_375toh_b-_____S {
|
|
98
|
+
--b: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.-_375toh_b-_____G {
|
|
102
|
+
--b: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
.-_375toq_k-A {
|
|
94
106
|
--k: calc(.75rem * var(--s2-scale));
|
|
95
107
|
}
|
|
@@ -207,8 +219,8 @@
|
|
|
207
219
|
border-color: buttonborder;
|
|
208
220
|
}
|
|
209
221
|
|
|
210
|
-
|
|
211
|
-
|
|
222
|
+
.-_375toh_b-a_____J {
|
|
223
|
+
--b: ButtonFace;
|
|
212
224
|
}
|
|
213
225
|
}
|
|
214
226
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"AAgDc;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;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA","sources":["packages/@react-spectrum/s2/src/NotificationBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFormatter} from '@internationalized/number';\nimport React, {createContext, forwardRef} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface NotificationBadgeStyleProps {\n /**\n * The size of the notification badge.\n *\n * @default 'S'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport interface NotificationBadgeProps extends DOMProps, AriaLabelingProps, StyleProps, NotificationBadgeStyleProps, SlotProps {\n /**\n * The value to be displayed in the notification badge.\n */\n value?: number | null\n}\n\ninterface NotificationBadgeContextProps extends Partial<NotificationBadgeProps> {\n isDisabled?: boolean,\n staticColor?: 'black' | 'white' | 'auto'\n}\n\nexport const NotificationBadgeContext = createContext<ContextValue<Partial<NotificationBadgeContextProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst badge = style({\n display: {\n default: 'flex',\n isDisabled: 'none'\n },\n font: 'control',\n color: {\n default: 'white',\n isStaticColor: 'auto',\n forcedColors: 'ButtonText'\n },\n fontSize: {\n size: {\n S: 'ui-xs',\n M: 'ui-xs',\n L: 'ui-sm',\n XL: 'ui'\n }\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderWidth: {\n forcedColors: '[1px]'\n },\n borderColor: {\n forcedColors: 'ButtonBorder'\n },\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'ButtonFace'\n },\n height: {\n size: {\n S: {\n default: 12,\n isIndicatorOnly: 8\n },\n M: {\n default: fontRelative(18), // sort of arbitrary? tried to get as close to the figma designs as possible\n isIndicatorOnly: 8\n },\n L: {\n default: 16,\n isIndicatorOnly: fontRelative(12)\n },\n XL: {\n default: 18,\n isIndicatorOnly: fontRelative(12)\n }\n }\n },\n aspectRatio: {\n isIndicatorOnly: 'square',\n isSingleDigit: 'square'\n },\n width: 'max',\n paddingX: {\n isDoubleDigit: 'edge-to-text'\n },\n borderRadius: 'pill'\n}, getAllowedOverrides());\n\n/**\n * Notification badges are used to indicate new or pending activity .\n */\nexport const NotificationBadge = forwardRef(function Badge(props: NotificationBadgeProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, NotificationBadgeContext);\n let {\n size = 'S',\n value,\n isDisabled = false,\n staticColor,\n ...otherProps\n } = props as NotificationBadgeContextProps;\n let domRef = useDOMRef(ref);\n let {locale} = useLocale();\n let formattedValue = '';\n\n let isIndicatorOnly = false;\n let isSingleDigit = false;\n let isDoubleDigit = false;\n\n if (value == null) {\n isIndicatorOnly = true;\n } else if (value <= 0) {\n throw new Error('Value cannot be negative or zero');\n } else if (!Number.isInteger(value)) {\n throw new Error('Value must be a positive integer');\n } else {\n formattedValue = new NumberFormatter(locale).format(Math.min(value, 99));\n let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)\n if (length === 1) {\n isSingleDigit = true;\n } else if (length === 2) {\n isDoubleDigit = true;\n }\n\n if (value > 99) {\n formattedValue = stringFormatter.format('notificationbadge.plus', {notifications: formattedValue});\n }\n }\n\n let ariaLabel = props['aria-label'] || undefined;\n if (ariaLabel === undefined && isIndicatorOnly) {\n ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');\n }\n\n return (\n <span\n {...filterDOMProps(otherProps, {labelable: true})}\n role={ariaLabel && 'img'}\n aria-label={ariaLabel}\n className={(props.UNSAFE_className || '') + badge({size, isIndicatorOnly, isSingleDigit, isDoubleDigit, isDisabled, isStaticColor: !!staticColor}, props.styles)}\n style={props.UNSAFE_style}\n ref={domRef}>\n {formattedValue}\n </span>\n );\n});\n"],"names":[],"version":3,"file":"NotificationBadge.css.map"}
|
|
@@ -64,7 +64,8 @@ const $bfb270fb056fefc5$var$badge = function anonymous(props, overrides) {
|
|
|
64
64
|
rules += ' _g-1x99dlob';
|
|
65
65
|
rules += ' _ga';
|
|
66
66
|
rules += ' aa_____K';
|
|
67
|
-
rules += '
|
|
67
|
+
if (props.isStaticColor) rules += ' a_____R';
|
|
68
|
+
else rules += ' ac';
|
|
68
69
|
rules += ' waa';
|
|
69
70
|
rules += ' ua-375yri';
|
|
70
71
|
rules += ' va-375yri';
|
|
@@ -73,21 +74,25 @@ const $bfb270fb056fefc5$var$badge = function anonymous(props, overrides) {
|
|
|
73
74
|
rules += ' ca_____I';
|
|
74
75
|
rules += ' _3d';
|
|
75
76
|
rules += ' _2c';
|
|
76
|
-
rules += '
|
|
77
|
-
if (props.isPressed) rules += ' b_____S';
|
|
78
|
-
else if (props.isFocusVisible) rules += ' b_____S';
|
|
79
|
-
else if (props.isHovered) rules += ' b_____S';
|
|
80
|
-
else rules += ' b_____R';
|
|
77
|
+
rules += ' b-375toh';
|
|
81
78
|
rules += ' k-375toq';
|
|
82
79
|
if (props.isSingleDigit) rules += ' _cb';
|
|
83
80
|
else if (props.isIndicatorOnly) rules += ' _cb';
|
|
84
|
-
if (!$l) rules += '
|
|
81
|
+
if (!$l) rules += ' ld';
|
|
85
82
|
if (props.isDoubleDigit) rules += ' CI';
|
|
86
83
|
if (props.isDoubleDigit) rules += ' DI';
|
|
87
84
|
rules += ' _wg';
|
|
88
85
|
rules += ' _xg';
|
|
89
86
|
rules += ' _yg';
|
|
90
87
|
rules += ' _zg';
|
|
88
|
+
rules += ' -_375toh_b-a_____J';
|
|
89
|
+
if (props.isStaticColor) rules += ' -_375toh_b-_____G';
|
|
90
|
+
else {
|
|
91
|
+
if (props.isPressed) rules += ' -_375toh_b-_____S';
|
|
92
|
+
else if (props.isFocusVisible) rules += ' -_375toh_b-_____S';
|
|
93
|
+
else if (props.isHovered) rules += ' -_375toh_b-_____S';
|
|
94
|
+
else rules += ' -_375toh_b-_____R';
|
|
95
|
+
}
|
|
91
96
|
if (props.size === "XL") {
|
|
92
97
|
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
93
98
|
else rules += ' -_375toq_k-G';
|
|
@@ -106,7 +111,7 @@ const $bfb270fb056fefc5$var$badge = function anonymous(props, overrides) {
|
|
|
106
111
|
const $bfb270fb056fefc5$export$529cab0ca6be204e = /*#__PURE__*/ (0, $bfWIi$forwardRef)(function Badge(props, ref) {
|
|
107
112
|
let stringFormatter = (0, $bfWIi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bfWIi$intlStringsmjs))), '@react-spectrum/s2');
|
|
108
113
|
[props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $bfb270fb056fefc5$export$9ab75c96ebaa396c);
|
|
109
|
-
let { size: size = 'S', value: value, isDisabled: isDisabled = false, ...otherProps } = props;
|
|
114
|
+
let { size: size = 'S', value: value, isDisabled: isDisabled = false, staticColor: staticColor, ...otherProps } = props;
|
|
110
115
|
let domRef = (0, $bfWIi$useDOMRef)(ref);
|
|
111
116
|
let { locale: locale } = (0, $bfWIi$useLocale)();
|
|
112
117
|
let formattedValue = '';
|
|
@@ -138,7 +143,8 @@ const $bfb270fb056fefc5$export$529cab0ca6be204e = /*#__PURE__*/ (0, $bfWIi$forwa
|
|
|
138
143
|
isIndicatorOnly: isIndicatorOnly,
|
|
139
144
|
isSingleDigit: isSingleDigit,
|
|
140
145
|
isDoubleDigit: isDoubleDigit,
|
|
141
|
-
isDisabled: isDisabled
|
|
146
|
+
isDisabled: isDisabled,
|
|
147
|
+
isStaticColor: !!staticColor
|
|
142
148
|
}, props.styles),
|
|
143
149
|
style: props.UNSAFE_style,
|
|
144
150
|
ref: domRef,
|