@backstage/ui 0.18.0 → 0.19.0
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/CHANGELOG.md +45 -0
- package/dist/analytics/getNodeText.esm.js.map +1 -1
- package/dist/analytics/useAnalytics.esm.js.map +1 -1
- package/dist/components/Accordion/Accordion.esm.js.map +1 -1
- package/dist/components/Accordion/Accordion.module.css.esm.js +2 -2
- package/dist/components/Accordion/Accordion.module.css.esm.js.map +1 -1
- package/dist/components/Accordion/definition.esm.js.map +1 -1
- package/dist/components/Alert/Alert.esm.js.map +1 -1
- package/dist/components/Alert/Alert.module.css.esm.js +2 -2
- package/dist/components/Alert/Alert.module.css.esm.js.map +1 -1
- package/dist/components/Alert/definition.esm.js.map +1 -1
- package/dist/components/Avatar/Avatar.esm.js.map +1 -1
- package/dist/components/Avatar/Avatar.module.css.esm.js +2 -2
- package/dist/components/Avatar/Avatar.module.css.esm.js.map +1 -1
- package/dist/components/Avatar/definition.esm.js.map +1 -1
- package/dist/components/Badge/Badge.esm.js.map +1 -1
- package/dist/components/Badge/Badge.module.css.esm.js +2 -2
- package/dist/components/Badge/Badge.module.css.esm.js.map +1 -1
- package/dist/components/Badge/definition.esm.js.map +1 -1
- package/dist/components/Box/Box.esm.js.map +1 -1
- package/dist/components/Box/Box.module.css.esm.js +2 -2
- package/dist/components/Box/Box.module.css.esm.js.map +1 -1
- package/dist/components/Box/definition.esm.js.map +1 -1
- package/dist/components/Button/Button.esm.js.map +1 -1
- package/dist/components/Button/Button.module.css.esm.js +2 -2
- package/dist/components/Button/Button.module.css.esm.js.map +1 -1
- package/dist/components/Button/definition.esm.js.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.module.css.esm.js +2 -2
- package/dist/components/ButtonIcon/ButtonIcon.module.css.esm.js.map +1 -1
- package/dist/components/ButtonIcon/definition.esm.js.map +1 -1
- package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
- package/dist/components/ButtonLink/ButtonLink.module.css.esm.js +2 -2
- package/dist/components/ButtonLink/ButtonLink.module.css.esm.js.map +1 -1
- package/dist/components/ButtonLink/definition.esm.js.map +1 -1
- package/dist/components/Card/Card.esm.js.map +1 -1
- package/dist/components/Card/Card.module.css.esm.js +2 -2
- package/dist/components/Card/Card.module.css.esm.js.map +1 -1
- package/dist/components/Card/definition.esm.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.esm.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.css.esm.js +2 -2
- package/dist/components/Checkbox/Checkbox.module.css.esm.js.map +1 -1
- package/dist/components/Checkbox/definition.esm.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.esm.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.module.css.esm.js +2 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.module.css.esm.js.map +1 -1
- package/dist/components/CheckboxGroup/definition.esm.js.map +1 -1
- package/dist/components/Combobox/Combobox.esm.js +72 -10
- package/dist/components/Combobox/Combobox.esm.js.map +1 -1
- package/dist/components/Combobox/Combobox.module.css.esm.js +2 -2
- package/dist/components/Combobox/Combobox.module.css.esm.js.map +1 -1
- package/dist/components/Combobox/ComboboxInput.esm.js.map +1 -1
- package/dist/components/Combobox/ComboboxItem.esm.js.map +1 -1
- package/dist/components/Combobox/ComboboxListBox.esm.js +11 -34
- package/dist/components/Combobox/ComboboxListBox.esm.js.map +1 -1
- package/dist/components/Combobox/definition.esm.js +1 -1
- package/dist/components/Combobox/definition.esm.js.map +1 -1
- package/dist/components/Combobox/useAsyncComboboxState.esm.js.map +1 -1
- package/dist/components/Container/Container.esm.js.map +1 -1
- package/dist/components/Container/Container.module.css.esm.js +2 -2
- package/dist/components/Container/Container.module.css.esm.js.map +1 -1
- package/dist/components/Container/definition.esm.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.esm.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.module.css.esm.js +2 -2
- package/dist/components/DatePicker/DatePicker.module.css.esm.js.map +1 -1
- package/dist/components/DatePicker/DatePickerCalendar.esm.js.map +1 -1
- package/dist/components/DatePicker/DatePickerGroup.esm.js.map +1 -1
- package/dist/components/DatePicker/definition.esm.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.esm.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.module.css.esm.js +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.module.css.esm.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePickerCalendar.esm.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePickerGroup.esm.js.map +1 -1
- package/dist/components/DateRangePicker/definition.esm.js.map +1 -1
- package/dist/components/Dialog/Dialog.esm.js.map +1 -1
- package/dist/components/Dialog/Dialog.module.css.esm.js +2 -2
- package/dist/components/Dialog/Dialog.module.css.esm.js.map +1 -1
- package/dist/components/Dialog/definition.esm.js.map +1 -1
- package/dist/components/FieldError/FieldError.esm.js.map +1 -1
- package/dist/components/FieldError/FieldError.module.css.esm.js +2 -2
- package/dist/components/FieldError/FieldError.module.css.esm.js.map +1 -1
- package/dist/components/FieldError/definition.esm.js.map +1 -1
- package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -1
- package/dist/components/FieldLabel/FieldLabel.module.css.esm.js +2 -2
- package/dist/components/FieldLabel/FieldLabel.module.css.esm.js.map +1 -1
- package/dist/components/FieldLabel/definition.esm.js.map +1 -1
- package/dist/components/Flex/Flex.esm.js.map +1 -1
- package/dist/components/Flex/Flex.module.css.esm.js +2 -2
- package/dist/components/Flex/Flex.module.css.esm.js.map +1 -1
- package/dist/components/Flex/definition.esm.js.map +1 -1
- package/dist/components/FullPage/FullPage.esm.js.map +1 -1
- package/dist/components/FullPage/FullPage.module.css.esm.js +2 -2
- package/dist/components/FullPage/FullPage.module.css.esm.js.map +1 -1
- package/dist/components/FullPage/definition.esm.js.map +1 -1
- package/dist/components/Grid/Grid.esm.js.map +1 -1
- package/dist/components/Grid/Grid.module.css.esm.js +2 -2
- package/dist/components/Grid/Grid.module.css.esm.js.map +1 -1
- package/dist/components/Grid/definition.esm.js.map +1 -1
- package/dist/components/Header/Header.esm.js.map +1 -1
- package/dist/components/Header/Header.module.css.esm.js +2 -2
- package/dist/components/Header/Header.module.css.esm.js.map +1 -1
- package/dist/components/Header/HeaderMetadataStatus.esm.js.map +1 -1
- package/dist/components/Header/HeaderMetadataStatus.module.css.esm.js +2 -2
- package/dist/components/Header/HeaderMetadataStatus.module.css.esm.js.map +1 -1
- package/dist/components/Header/HeaderMetadataUsers.esm.js.map +1 -1
- package/dist/components/Header/HeaderMetadataUsers.module.css.esm.js +2 -2
- package/dist/components/Header/HeaderMetadataUsers.module.css.esm.js.map +1 -1
- package/dist/components/Header/HeaderNav.esm.js.map +1 -1
- package/dist/components/Header/HeaderNav.module.css.esm.js +2 -2
- package/dist/components/Header/HeaderNav.module.css.esm.js.map +1 -1
- package/dist/components/Header/HeaderNavDefinition.esm.js.map +1 -1
- package/dist/components/Header/HeaderNavIndicators.esm.js.map +1 -1
- package/dist/components/Header/definition.esm.js.map +1 -1
- package/dist/components/Link/Link.esm.js.map +1 -1
- package/dist/components/Link/Link.module.css.esm.js +2 -2
- package/dist/components/Link/Link.module.css.esm.js.map +1 -1
- package/dist/components/Link/definition.esm.js.map +1 -1
- package/dist/components/List/List.esm.js.map +1 -1
- package/dist/components/List/List.module.css.esm.js +2 -2
- package/dist/components/List/List.module.css.esm.js.map +1 -1
- package/dist/components/List/definition.esm.js.map +1 -1
- package/dist/components/Menu/Menu.esm.js.map +1 -1
- package/dist/components/Menu/Menu.module.css.esm.js +2 -2
- package/dist/components/Menu/Menu.module.css.esm.js.map +1 -1
- package/dist/components/Menu/definition.esm.js.map +1 -1
- package/dist/components/NumberField/NumberField.esm.js.map +1 -1
- package/dist/components/NumberField/NumberField.module.css.esm.js +2 -2
- package/dist/components/NumberField/NumberField.module.css.esm.js.map +1 -1
- package/dist/components/NumberField/definition.esm.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.esm.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.module.css.esm.js +2 -2
- package/dist/components/PasswordField/PasswordField.module.css.esm.js.map +1 -1
- package/dist/components/PasswordField/definition.esm.js.map +1 -1
- package/dist/components/PluginHeader/PluginHeader.esm.js.map +1 -1
- package/dist/components/PluginHeader/PluginHeader.module.css.esm.js +2 -2
- package/dist/components/PluginHeader/PluginHeader.module.css.esm.js.map +1 -1
- package/dist/components/PluginHeader/PluginHeaderBreadcrumbs.esm.js.map +1 -1
- package/dist/components/PluginHeader/definition.esm.js.map +1 -1
- package/dist/components/PluginHeader/useIsTruncated.esm.js.map +1 -1
- package/dist/components/Popover/Popover.esm.js.map +1 -1
- package/dist/components/Popover/Popover.module.css.esm.js +2 -2
- package/dist/components/Popover/Popover.module.css.esm.js.map +1 -1
- package/dist/components/Popover/definition.esm.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.module.css.esm.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.module.css.esm.js.map +1 -1
- package/dist/components/RadioGroup/definition.esm.js.map +1 -1
- package/dist/components/SearchAutocomplete/SearchAutocomplete.esm.js.map +1 -1
- package/dist/components/SearchAutocomplete/SearchAutocomplete.module.css.esm.js +2 -2
- package/dist/components/SearchAutocomplete/SearchAutocomplete.module.css.esm.js.map +1 -1
- package/dist/components/SearchAutocomplete/definition.esm.js.map +1 -1
- package/dist/components/SearchField/SearchField.esm.js.map +1 -1
- package/dist/components/SearchField/SearchField.module.css.esm.js +2 -2
- package/dist/components/SearchField/SearchField.module.css.esm.js.map +1 -1
- package/dist/components/SearchField/definition.esm.js.map +1 -1
- package/dist/components/Select/Select.esm.js.map +1 -1
- package/dist/components/Select/Select.module.css.esm.js +2 -2
- package/dist/components/Select/Select.module.css.esm.js.map +1 -1
- package/dist/components/Select/SelectContent.esm.js.map +1 -1
- package/dist/components/Select/SelectItem.esm.js.map +1 -1
- package/dist/components/Select/SelectListBox.esm.js.map +1 -1
- package/dist/components/Select/SelectTrigger.esm.js.map +1 -1
- package/dist/components/Select/definition.esm.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.esm.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.module.css.esm.js +2 -2
- package/dist/components/Skeleton/Skeleton.module.css.esm.js.map +1 -1
- package/dist/components/Skeleton/definition.esm.js.map +1 -1
- package/dist/components/Slider/Slider.esm.js.map +1 -1
- package/dist/components/Slider/Slider.module.css.esm.js +2 -2
- package/dist/components/Slider/Slider.module.css.esm.js.map +1 -1
- package/dist/components/Slider/definition.esm.js.map +1 -1
- package/dist/components/Switch/Switch.esm.js.map +1 -1
- package/dist/components/Switch/Switch.module.css.esm.js +2 -2
- package/dist/components/Switch/Switch.module.css.esm.js.map +1 -1
- package/dist/components/Switch/definition.esm.js.map +1 -1
- package/dist/components/Table/Table.module.css.esm.js +2 -2
- package/dist/components/Table/Table.module.css.esm.js.map +1 -1
- package/dist/components/Table/components/Cell.esm.js.map +1 -1
- package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
- package/dist/components/Table/components/CellText.esm.js.map +1 -1
- package/dist/components/Table/components/Column.esm.js.map +1 -1
- package/dist/components/Table/components/Row.esm.js.map +1 -1
- package/dist/components/Table/components/Table.esm.js.map +1 -1
- package/dist/components/Table/components/TableBody.esm.js.map +1 -1
- package/dist/components/Table/components/TableBodySkeleton.esm.js.map +1 -1
- package/dist/components/Table/components/TableHeader.esm.js.map +1 -1
- package/dist/components/Table/components/TableRoot.esm.js.map +1 -1
- package/dist/components/Table/definition.esm.js.map +1 -1
- package/dist/components/Table/hooks/getEffectivePageSize.esm.js.map +1 -1
- package/dist/components/Table/hooks/useCompletePagination.esm.js.map +1 -1
- package/dist/components/Table/hooks/useCursorPagination.esm.js.map +1 -1
- package/dist/components/Table/hooks/useDebouncedReload.esm.js.map +1 -1
- package/dist/components/Table/hooks/useDebouncedValue.esm.js.map +1 -1
- package/dist/components/Table/hooks/useOffsetPagination.esm.js.map +1 -1
- package/dist/components/Table/hooks/usePageCache.esm.js.map +1 -1
- package/dist/components/Table/hooks/useQueryState.esm.js.map +1 -1
- package/dist/components/Table/hooks/useStableCallback.esm.js.map +1 -1
- package/dist/components/Table/hooks/useTable.esm.js.map +1 -1
- package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
- package/dist/components/TablePagination/TablePagination.module.css.esm.js +2 -2
- package/dist/components/TablePagination/TablePagination.module.css.esm.js.map +1 -1
- package/dist/components/TablePagination/definition.esm.js.map +1 -1
- package/dist/components/Tabs/Tabs.esm.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.css.esm.js +2 -2
- package/dist/components/Tabs/Tabs.module.css.esm.js.map +1 -1
- package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -1
- package/dist/components/Tabs/definition.esm.js.map +1 -1
- package/dist/components/TagGroup/TagGroup.esm.js.map +1 -1
- package/dist/components/TagGroup/TagGroup.module.css.esm.js +2 -2
- package/dist/components/TagGroup/TagGroup.module.css.esm.js.map +1 -1
- package/dist/components/TagGroup/definition.esm.js.map +1 -1
- package/dist/components/Text/Text.esm.js.map +1 -1
- package/dist/components/Text/Text.module.css.esm.js +2 -2
- package/dist/components/Text/Text.module.css.esm.js.map +1 -1
- package/dist/components/Text/definition.esm.js.map +1 -1
- package/dist/components/TextAreaField/TextAreaField.esm.js.map +1 -1
- package/dist/components/TextAreaField/TextAreaField.module.css.esm.js +2 -2
- package/dist/components/TextAreaField/TextAreaField.module.css.esm.js.map +1 -1
- package/dist/components/TextAreaField/definition.esm.js.map +1 -1
- package/dist/components/TextField/TextField.esm.js.map +1 -1
- package/dist/components/TextField/TextField.module.css.esm.js +2 -2
- package/dist/components/TextField/TextField.module.css.esm.js.map +1 -1
- package/dist/components/TextField/definition.esm.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.esm.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.module.css.esm.js +2 -2
- package/dist/components/ToggleButton/ToggleButton.module.css.esm.js.map +1 -1
- package/dist/components/ToggleButton/definition.esm.js.map +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js.map +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.module.css.esm.js +2 -2
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.module.css.esm.js.map +1 -1
- package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.esm.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.css.esm.js +2 -2
- package/dist/components/Tooltip/Tooltip.module.css.esm.js.map +1 -1
- package/dist/components/Tooltip/definition.esm.js.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.esm.js.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.module.css.esm.js +2 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.module.css.esm.js.map +1 -1
- package/dist/components/VisuallyHidden/definition.esm.js.map +1 -1
- package/dist/css/styles.css +39 -1
- package/dist/hooks/useBg.esm.js.map +1 -1
- package/dist/hooks/useBreakpoint.esm.js.map +1 -1
- package/dist/hooks/useCollectionAdapter.esm.js.map +1 -1
- package/dist/hooks/useDefinition/defineComponent.esm.js.map +1 -1
- package/dist/hooks/useDefinition/helpers.esm.js.map +1 -1
- package/dist/hooks/useDefinition/useDefinition.esm.js.map +1 -1
- package/dist/hooks/useDefinition/useDefinitionNavigation.esm.js.map +1 -1
- package/dist/hooks/useDelayedVisibility.esm.js.map +1 -1
- package/dist/hooks/useIsomorphicLayoutEffect.esm.js.map +1 -1
- package/dist/hooks/useResolvedHref.esm.js.map +1 -1
- package/dist/hooks/useTrackedSelectionKeys.esm.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/navigation/BUIRoutingProvider.esm.js.map +1 -1
- package/dist/navigation/useNavigation.esm.js.map +1 -1
- package/dist/navigation/useRouting.esm.js.map +1 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
- package/dist/provider/BUIContext.esm.js.map +1 -1
- package/dist/provider/BUIProvider.esm.js.map +1 -1
- package/dist/utils/linkUtils.esm.js.map +1 -1
- package/dist/utils/selectableCollection.esm.js +13 -1
- package/dist/utils/selectableCollection.esm.js.map +1 -1
- package/dist/utils/utilityClassMap.esm.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.esm.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n useRef,\n useState,\n useMemo,\n Children,\n cloneElement,\n isValidElement,\n createContext,\n useContext,\n useEffect,\n useCallback,\n} from 'react';\nimport type { ReactNode } from 'react';\nimport type {\n TabsProps,\n TabListProps,\n TabPanelProps,\n TabsContextValue,\n TabProps,\n} from './types';\nimport { TabsIndicators } from './TabsIndicators';\nimport {\n Tabs as AriaTabs,\n TabList as AriaTabList,\n Tab as AriaTab,\n TabPanel as AriaTabPanel,\n TabProps as AriaTabProps,\n} from 'react-aria-components';\nimport {\n useDefinition,\n type UseDefinitionResult,\n} from '../../hooks/useDefinition';\nimport {\n TabsDefinition,\n TabListDefinition,\n TabDefinition,\n TabPanelDefinition,\n} from './definition';\nimport { getNodeText } from '../../analytics/getNodeText';\nimport { useRoutingIntegration } from '../../navigation/useRouting';\nimport {\n getReactAriaAnchorProps,\n type AnchorNavigation,\n} from '../../navigation/useNavigation';\n\nconst TabsContext = createContext<TabsContextValue | undefined>(undefined);\n\nconst useTabsContext = () => {\n const context = useContext(TabsContext);\n if (!context) {\n throw new Error('Tab components must be used within a Tabs component');\n }\n return context;\n};\n\ntype TabSelectionContextValue = {\n registerRoutedTab: (id: string) => void;\n unregisterRoutedTab: (id: string) => void;\n registerActiveTab: (id: string, segmentCount: number) => void;\n unregisterActiveTab: (id: string) => void;\n};\n\nconst TabSelectionContext = createContext<TabSelectionContextValue | null>(\n null,\n);\n\n/**\n * Strips query params and hash from a href, leaving only the pathname.\n * Tab matching always compares against location.pathname which never includes them.\n */\nconst hrefPathname = (href: string) => href.split('?')[0].split('#')[0];\n\n/**\n * Utility function to determine if a tab should be active based on the matching strategy.\n * This follows the pattern used in WorkaroundNavLink from the sidebar.\n */\nconst isTabActive = (\n tabHref: string,\n currentPathname: string,\n matchStrategy: 'exact' | 'prefix',\n): boolean => {\n const pathname = hrefPathname(tabHref);\n\n if (matchStrategy === 'exact') {\n return pathname === currentPathname;\n }\n\n // Prefix matching - similar to WorkaroundNavLink behavior\n if (pathname === currentPathname) {\n return true;\n }\n\n // Check if current path starts with tab href followed by a slash\n // This prevents /foo matching /foobar\n return currentPathname.startsWith(`${pathname}/`);\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const Tabs = (props: TabsProps) => {\n const { ownProps, restProps } = useDefinition(TabsDefinition, props);\n const { classes, children } = ownProps;\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabRefs = useRef<Map<string, HTMLDivElement>>(new Map());\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n const prevHoveredKey = useRef<string | null>(null);\n\n // State for tracking routed tabs (tabs with hrefs)\n const [routedTabs, setRoutedTabs] = useState<Set<string>>(() => new Set());\n\n // State for tracking active tabs reported by TabRouteRegistration components\n const [activeTabs, setActiveTabs] = useState<Map<string, number>>(\n () => new Map(),\n );\n\n const setTabRef = (key: string, element: HTMLDivElement | null) => {\n if (element) {\n tabRefs.current.set(key, element);\n } else {\n tabRefs.current.delete(key);\n }\n };\n\n // Compute the selected tab based on active tabs with highest segment count\n const selectedTabId = useMemo(() => {\n // No routed tabs - let React Aria handle selection (uncontrolled mode)\n if (routedTabs.size === 0) {\n return undefined;\n }\n\n // Has routed tabs but none are active - use empty string for no selection\n // (React Aria has a bug with null that causes infinite loops)\n if (activeTabs.size === 0) {\n return '';\n }\n\n let selectedId: string | undefined;\n let maxSegments = -1;\n\n activeTabs.forEach((segmentCount, id) => {\n // Pick tab with highest segment count, first one wins on tie\n if (segmentCount > maxSegments) {\n maxSegments = segmentCount;\n selectedId = id;\n }\n });\n\n return selectedId;\n }, [routedTabs, activeTabs]);\n\n const registerRoutedTab = useCallback((id: string) => {\n setRoutedTabs(prev => new Set(prev).add(id));\n }, []);\n\n const unregisterRoutedTab = useCallback((id: string) => {\n setRoutedTabs(prev => {\n const next = new Set(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const registerActiveTab = useCallback((id: string, segmentCount: number) => {\n setActiveTabs(prev => new Map(prev).set(id, segmentCount));\n }, []);\n\n const unregisterActiveTab = useCallback((id: string) => {\n setActiveTabs(prev => {\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n if (!children) return null;\n\n const tabsContextValue: TabsContextValue = {\n tabsRef,\n tabRefs,\n hoveredKey,\n prevHoveredKey,\n setHoveredKey,\n setTabRef,\n };\n\n const selectionContextValue: TabSelectionContextValue = useMemo(\n () => ({\n registerRoutedTab,\n unregisterRoutedTab,\n registerActiveTab,\n unregisterActiveTab,\n }),\n [\n registerRoutedTab,\n unregisterRoutedTab,\n registerActiveTab,\n unregisterActiveTab,\n ],\n );\n\n return (\n <TabsContext.Provider value={tabsContextValue}>\n <TabSelectionContext.Provider value={selectionContextValue}>\n <AriaTabs\n className={classes.root}\n keyboardActivation=\"manual\"\n selectedKey={selectedTabId}\n ref={tabsRef}\n {...restProps}\n >\n {children as ReactNode}\n </AriaTabs>\n </TabSelectionContext.Provider>\n </TabsContext.Provider>\n );\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const TabList = (props: TabListProps) => {\n const { ownProps, restProps } = useDefinition(TabListDefinition, props);\n const { classes, children } = ownProps;\n const { setHoveredKey, tabRefs, tabsRef, hoveredKey, prevHoveredKey } =\n useTabsContext();\n\n const handleHover = (key: string | null) => {\n setHoveredKey(key);\n };\n\n // Clone children with additional props for hover and ref management\n const enhancedChildren = Children.map(children as ReactNode, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onHoverStart: () => handleHover(child.props.id as string),\n onHoverEnd: () => handleHover(null),\n } as Partial<AriaTabProps>);\n }\n return child;\n });\n\n return (\n <div className={classes.root}>\n <AriaTabList\n className={classes.tabList}\n aria-label=\"Toolbar tabs\"\n {...restProps}\n >\n {enhancedChildren}\n </AriaTabList>\n <TabsIndicators\n tabRefs={tabRefs}\n tabsRef={tabsRef}\n hoveredKey={hoveredKey}\n prevHoveredKey={prevHoveredKey}\n />\n </div>\n );\n};\n\n/**\n * Internal component for tabs with internal hrefs.\n * Handles routing registration and active tab tracking.\n * Separated to avoid conditional hook usage in Tab component.\n * @internal\n */\nfunction RoutedTabEffects({\n id,\n href,\n matchStrategy = 'exact',\n}: {\n id: string;\n href: string;\n matchStrategy?: 'exact' | 'prefix';\n}) {\n const selectionCtx = useContext(TabSelectionContext);\n const routing = useRoutingIntegration({ fallback: true });\n const location = routing.useLocation();\n const resolvedPath = routing.useResolvedPath(href);\n\n // Register as a routed tab (for controlled vs uncontrolled mode)\n useEffect(() => {\n if (selectionCtx) {\n selectionCtx.registerRoutedTab(id);\n return () => selectionCtx.unregisterRoutedTab(id);\n }\n return undefined;\n }, [id, selectionCtx]);\n\n // Register as active tab when URL matches (for tab selection)\n const isActive = isTabActive(\n resolvedPath.pathname,\n location.pathname,\n matchStrategy,\n );\n const segmentCount = resolvedPath.pathname.split('/').filter(Boolean).length;\n\n useEffect(() => {\n if (isActive && selectionCtx) {\n selectionCtx.registerActiveTab(id, segmentCount);\n return () => selectionCtx.unregisterActiveTab(id);\n }\n return undefined;\n }, [isActive, id, segmentCount, selectionCtx]);\n\n return null;\n}\n\ntype TabViewProps = {\n definitionResult: UseDefinitionResult<typeof TabDefinition, TabProps>;\n navigation: AnchorNavigation;\n};\n\nconst TabView = ({ definitionResult, navigation }: TabViewProps) => {\n const { ownProps, restProps, analytics } = definitionResult;\n const { classes, matchStrategy, id } = ownProps;\n const { href } = ownProps;\n const { setTabRef } = useTabsContext();\n const navigationProps = getReactAriaAnchorProps(navigation, {\n href,\n routerOptions: restProps.routerOptions,\n });\n\n const handlePress = () => {\n if (href) {\n const text =\n restProps['aria-label'] ??\n getNodeText(restProps.children) ??\n String(href);\n analytics.captureEvent('click', text, {\n attributes: { to: String(href) },\n });\n }\n };\n\n return (\n <>\n {navigation.canMatchRoute && href && (\n <RoutedTabEffects\n id={id as string}\n href={href}\n matchStrategy={matchStrategy}\n />\n )}\n <AriaTab\n id={id}\n className={classes.root}\n ref={el => setTabRef(id as string, el as HTMLDivElement)}\n {...restProps}\n {...navigationProps}\n onPress={e => {\n restProps.onPress?.(e);\n handlePress();\n }}\n />\n </>\n );\n};\n\n/**\n * A component that renders a tab.\n *\n * @public\n */\nexport const Tab = (props: TabProps) => {\n const definitionResult = useDefinition(TabDefinition, props);\n const Navigation = definitionResult.navigation;\n\n return (\n <Navigation\n props={{\n ...definitionResult.restProps,\n href: definitionResult.ownProps.href,\n }}\n view={TabView}\n viewProps={{ definitionResult }}\n />\n );\n};\n\n/**\n * A component that renders the content of a tab.\n *\n * @public\n */\nexport const TabPanel = (props: TabPanelProps) => {\n const { ownProps, restProps } = useDefinition(TabPanelDefinition, props);\n\n return <AriaTabPanel className={ownProps.classes.root} {...restProps} />;\n};\n"],"names":["AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;;;;AA6DA,MAAM,WAAA,GAAc,cAA4C,MAAS,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AACt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AQ,IAAA;AAAA,QACnB,GAAA,EAAK,CAAA,EAAA,KAAM,SAAA,CAAU,EAAA,EAAc,EAAoB,CAAA;AAAA,QACtD,GAAG,SAAA;AAAA,QACH,GAAG,eAAA;AAAA,QACJ,SAAS,CAAA,CAAA,KAAK;AACZ,UAAA,SAAA,CAAU,UAAU,CAAC,CAAA;AACrB,UAAA,WAAA,EAAY;AAAA,QACd;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ,CAAA;AAOO,MAAM,GAAA,GAAM,CAAC,KAAA,KAAoB;AACtC,EAAA,MAAM,gBAAA,GAAmB,aAAA,CAAc,aAAA,EAAe,KAAK,CAAA;AAC3D,EAAA,MAAM,aAAa,gBAAA,CAAiB,UAAA;AAEpC,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,GAAG,gBAAA,CAAiB,SAAA;AAAA,QACpB,IAAA,EAAM,iBAAiB,QAAA,CAAS;AAAA,OAClC;AAAA,MACA,IAAA,EAAM,OAAA;AAAA,MACN,SAAA,EAAW,EAAE,gBAAA;AAAiB;AAAA,GAChC;AAEJ;AAOO,MAAM,QAAA,GAAW,CAAC,KAAA,KAAyB;AAChD,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AAEvE,EAAA,2BAAQC,UAAA,EAAA,EAAa,SAAA,EAAW,SAAS,OAAA,CAAQ,IAAA,EAAO,GAAG,SAAA,EAAW,CAAA;AACxE;;;;"}
|
|
1
|
+
{"version":3,"file":"Tabs.esm.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n useRef,\n useState,\n useMemo,\n Children,\n cloneElement,\n isValidElement,\n createContext,\n useContext,\n useEffect,\n useCallback,\n} from 'react';\nimport type { ReactNode } from 'react';\nimport type {\n TabsProps,\n TabListProps,\n TabPanelProps,\n TabsContextValue,\n TabProps,\n} from './types';\nimport { TabsIndicators } from './TabsIndicators';\nimport {\n Tabs as AriaTabs,\n TabList as AriaTabList,\n Tab as AriaTab,\n TabPanel as AriaTabPanel,\n TabProps as AriaTabProps,\n} from 'react-aria-components';\nimport {\n useDefinition,\n type UseDefinitionResult,\n} from '../../hooks/useDefinition';\nimport {\n TabsDefinition,\n TabListDefinition,\n TabDefinition,\n TabPanelDefinition,\n} from './definition';\nimport { getNodeText } from '../../analytics/getNodeText';\nimport { useRoutingIntegration } from '../../navigation/useRouting';\nimport {\n getReactAriaAnchorProps,\n type AnchorNavigation,\n} from '../../navigation/useNavigation';\n\nconst TabsContext = createContext<TabsContextValue | undefined>(undefined);\n\nconst useTabsContext = () => {\n const context = useContext(TabsContext);\n if (!context) {\n throw new Error('Tab components must be used within a Tabs component');\n }\n return context;\n};\n\ntype TabSelectionContextValue = {\n registerRoutedTab: (id: string) => void;\n unregisterRoutedTab: (id: string) => void;\n registerActiveTab: (id: string, segmentCount: number) => void;\n unregisterActiveTab: (id: string) => void;\n};\n\nconst TabSelectionContext = createContext<TabSelectionContextValue | null>(\n null,\n);\n\n/**\n * Strips query params and hash from a href, leaving only the pathname.\n * Tab matching always compares against location.pathname which never includes them.\n */\nconst hrefPathname = (href: string) => href.split('?')[0].split('#')[0];\n\n/**\n * Utility function to determine if a tab should be active based on the matching strategy.\n * This follows the pattern used in WorkaroundNavLink from the sidebar.\n */\nconst isTabActive = (\n tabHref: string,\n currentPathname: string,\n matchStrategy: 'exact' | 'prefix',\n): boolean => {\n const pathname = hrefPathname(tabHref);\n\n if (matchStrategy === 'exact') {\n return pathname === currentPathname;\n }\n\n // Prefix matching - similar to WorkaroundNavLink behavior\n if (pathname === currentPathname) {\n return true;\n }\n\n // Check if current path starts with tab href followed by a slash\n // This prevents /foo matching /foobar\n return currentPathname.startsWith(`${pathname}/`);\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const Tabs = (props: TabsProps) => {\n const { ownProps, restProps } = useDefinition(TabsDefinition, props);\n const { classes, children } = ownProps;\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabRefs = useRef<Map<string, HTMLDivElement>>(new Map());\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n const prevHoveredKey = useRef<string | null>(null);\n\n // State for tracking routed tabs (tabs with hrefs)\n const [routedTabs, setRoutedTabs] = useState<Set<string>>(() => new Set());\n\n // State for tracking active tabs reported by TabRouteRegistration components\n const [activeTabs, setActiveTabs] = useState<Map<string, number>>(\n () => new Map(),\n );\n\n const setTabRef = (key: string, element: HTMLDivElement | null) => {\n if (element) {\n tabRefs.current.set(key, element);\n } else {\n tabRefs.current.delete(key);\n }\n };\n\n // Compute the selected tab based on active tabs with highest segment count\n const selectedTabId = useMemo(() => {\n // No routed tabs - let React Aria handle selection (uncontrolled mode)\n if (routedTabs.size === 0) {\n return undefined;\n }\n\n // Has routed tabs but none are active - use empty string for no selection\n // (React Aria has a bug with null that causes infinite loops)\n if (activeTabs.size === 0) {\n return '';\n }\n\n let selectedId: string | undefined;\n let maxSegments = -1;\n\n activeTabs.forEach((segmentCount, id) => {\n // Pick tab with highest segment count, first one wins on tie\n if (segmentCount > maxSegments) {\n maxSegments = segmentCount;\n selectedId = id;\n }\n });\n\n return selectedId;\n }, [routedTabs, activeTabs]);\n\n const registerRoutedTab = useCallback((id: string) => {\n setRoutedTabs(prev => new Set(prev).add(id));\n }, []);\n\n const unregisterRoutedTab = useCallback((id: string) => {\n setRoutedTabs(prev => {\n const next = new Set(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const registerActiveTab = useCallback((id: string, segmentCount: number) => {\n setActiveTabs(prev => new Map(prev).set(id, segmentCount));\n }, []);\n\n const unregisterActiveTab = useCallback((id: string) => {\n setActiveTabs(prev => {\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n if (!children) return null;\n\n const tabsContextValue: TabsContextValue = {\n tabsRef,\n tabRefs,\n hoveredKey,\n prevHoveredKey,\n setHoveredKey,\n setTabRef,\n };\n\n const selectionContextValue: TabSelectionContextValue = useMemo(\n () => ({\n registerRoutedTab,\n unregisterRoutedTab,\n registerActiveTab,\n unregisterActiveTab,\n }),\n [\n registerRoutedTab,\n unregisterRoutedTab,\n registerActiveTab,\n unregisterActiveTab,\n ],\n );\n\n return (\n <TabsContext.Provider value={tabsContextValue}>\n <TabSelectionContext.Provider value={selectionContextValue}>\n <AriaTabs\n className={classes.root}\n keyboardActivation=\"manual\"\n selectedKey={selectedTabId}\n ref={tabsRef}\n {...restProps}\n >\n {children as ReactNode}\n </AriaTabs>\n </TabSelectionContext.Provider>\n </TabsContext.Provider>\n );\n};\n\n/**\n * A component that renders a list of tabs.\n *\n * @public\n */\nexport const TabList = (props: TabListProps) => {\n const { ownProps, restProps } = useDefinition(TabListDefinition, props);\n const { classes, children } = ownProps;\n const { setHoveredKey, tabRefs, tabsRef, hoveredKey, prevHoveredKey } =\n useTabsContext();\n\n const handleHover = (key: string | null) => {\n setHoveredKey(key);\n };\n\n // Clone children with additional props for hover and ref management\n const enhancedChildren = Children.map(children as ReactNode, child => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n onHoverStart: () => handleHover(child.props.id as string),\n onHoverEnd: () => handleHover(null),\n } as Partial<AriaTabProps>);\n }\n return child;\n });\n\n return (\n <div className={classes.root}>\n <AriaTabList\n className={classes.tabList}\n aria-label=\"Toolbar tabs\"\n {...restProps}\n >\n {enhancedChildren}\n </AriaTabList>\n <TabsIndicators\n tabRefs={tabRefs}\n tabsRef={tabsRef}\n hoveredKey={hoveredKey}\n prevHoveredKey={prevHoveredKey}\n />\n </div>\n );\n};\n\n/**\n * Internal component for tabs with internal hrefs.\n * Handles routing registration and active tab tracking.\n * Separated to avoid conditional hook usage in Tab component.\n * @internal\n */\nfunction RoutedTabEffects({\n id,\n href,\n matchStrategy = 'exact',\n}: {\n id: string;\n href: string;\n matchStrategy?: 'exact' | 'prefix';\n}) {\n const selectionCtx = useContext(TabSelectionContext);\n const routing = useRoutingIntegration({ fallback: true });\n const location = routing.useLocation();\n const resolvedPath = routing.useResolvedPath(href);\n\n // Register as a routed tab (for controlled vs uncontrolled mode)\n useEffect(() => {\n if (selectionCtx) {\n selectionCtx.registerRoutedTab(id);\n return () => selectionCtx.unregisterRoutedTab(id);\n }\n return undefined;\n }, [id, selectionCtx]);\n\n // Register as active tab when URL matches (for tab selection)\n const isActive = isTabActive(\n resolvedPath.pathname,\n location.pathname,\n matchStrategy,\n );\n const segmentCount = resolvedPath.pathname.split('/').filter(Boolean).length;\n\n useEffect(() => {\n if (isActive && selectionCtx) {\n selectionCtx.registerActiveTab(id, segmentCount);\n return () => selectionCtx.unregisterActiveTab(id);\n }\n return undefined;\n }, [isActive, id, segmentCount, selectionCtx]);\n\n return null;\n}\n\ntype TabViewProps = {\n definitionResult: UseDefinitionResult<typeof TabDefinition, TabProps>;\n navigation: AnchorNavigation;\n};\n\nconst TabView = ({ definitionResult, navigation }: TabViewProps) => {\n const { ownProps, restProps, analytics } = definitionResult;\n const { classes, matchStrategy, id } = ownProps;\n const { href } = ownProps;\n const { setTabRef } = useTabsContext();\n const navigationProps = getReactAriaAnchorProps(navigation, {\n href,\n routerOptions: restProps.routerOptions,\n });\n\n const handlePress = () => {\n if (href) {\n const text =\n restProps['aria-label'] ??\n getNodeText(restProps.children) ??\n String(href);\n analytics.captureEvent('click', text, {\n attributes: { to: String(href) },\n });\n }\n };\n\n return (\n <>\n {navigation.canMatchRoute && href && (\n <RoutedTabEffects\n id={id as string}\n href={href}\n matchStrategy={matchStrategy}\n />\n )}\n <AriaTab\n id={id}\n className={classes.root}\n ref={el => setTabRef(id as string, el as HTMLDivElement)}\n {...restProps}\n {...navigationProps}\n onPress={e => {\n restProps.onPress?.(e);\n handlePress();\n }}\n />\n </>\n );\n};\n\n/**\n * A component that renders a tab.\n *\n * @public\n */\nexport const Tab = (props: TabProps) => {\n const definitionResult = useDefinition(TabDefinition, props);\n const Navigation = definitionResult.navigation;\n\n return (\n <Navigation\n props={{\n ...definitionResult.restProps,\n href: definitionResult.ownProps.href,\n }}\n view={TabView}\n viewProps={{ definitionResult }}\n />\n );\n};\n\n/**\n * A component that renders the content of a tab.\n *\n * @public\n */\nexport const TabPanel = (props: TabPanelProps) => {\n const { ownProps, restProps } = useDefinition(TabPanelDefinition, props);\n\n return <AriaTabPanel className={ownProps.classes.root} {...restProps} />;\n};\n"],"names":["AriaTabs","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;;;;;;;AA6DA,MAAM,WAAA,GAAc,cAA4C,MAAS,CAAA;AAEzE,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,EACvE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;AASA,MAAM,mBAAA,GAAsB,aAAA;AAAA,EAC1B;AACF,CAAA;AAMA,MAAM,YAAA,GAAe,CAAC,IAAA,KAAiB,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA;AAMtE,MAAM,WAAA,GAAc,CAClB,OAAA,EACA,eAAA,EACA,aAAA,KACY;AACZ,EAAA,MAAM,QAAA,GAAW,aAAa,OAAO,CAAA;AAErC,EAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,IAAA,OAAO,QAAA,KAAa,eAAA;AAAA,EACtB;AAGA,EAAA,I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A,QACL,GAAG,gBAAA,CAAiB,SAAA;AAAA,QACpB,IAAA,EAAM,iBAAiB,QAAA,CAAS;AAAA,OAClC;AAAA,MACA,IAAA,EAAM,OAAA;AAAA,MACN,SAAA,EAAW,EAAE,gBAAA;AAAiB;AAAA,GAChC;AAEJ;AAOO,MAAM,QAAA,GAAW,CAAC,KAAA,KAAyB;AAChD,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AAEvE,EAAA,2BAAQC,UAAA,EAAA,EAAa,SAAA,EAAW,SAAS,OAAA,CAAQ,IAAA,EAAO,GAAG,SAAA,EAAW,CAAA;AACxE;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Tabs_bui-
|
|
4
|
-
var styles = {"bui-Tabs":"Tabs_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .Tabs_bui-Tabs__c644deb9e1 {\n /* Initialize CSS variables */\n --active-tab-left: 0px;\n --active-tab-right: 0px;\n --active-tab-top: 0px;\n --active-tab-bottom: 0px;\n --active-tab-width: 0px;\n --active-tab-height: 0px;\n --active-transition-duration: 0s;\n --active-tab-opacity: 0;\n\n --hovered-tab-left: 0px;\n --hovered-tab-right: 0px;\n --hovered-tab-top: 0px;\n --hovered-tab-bottom: 0px;\n --hovered-tab-width: 0px;\n --hovered-tab-height: 0px;\n --hovered-tab-opacity: 0;\n --hovered-transition-duration: 0s;\n }\n\n .Tabs_bui-TabList__c644deb9e1 {\n display: flex;\n flex-direction: row;\n }\n\n .Tabs_bui-TabListWrapper__c644deb9e1 {\n position: relative;\n }\n\n .Tabs_bui-Tab__c644deb9e1 {\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n line-height: 1.15;\n font-weight: var(--bui-font-weight-regular);\n color: var(--bui-fg-secondary);\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n position: relative;\n z-index: 2;\n padding-inline: var(--bui-space-2);\n\n &[data-selected='true'] {\n color: var(--bui-fg-primary);\n }\n }\n\n .Tabs_bui-TabActive__c644deb9e1 {\n content: '';\n position: absolute;\n left: calc(var(--active-tab-left) + var(--bui-space-2));\n bottom: -1px;\n width: calc(var(--active-tab-width) - var(--bui-space-4));\n height: 1px;\n background-color: var(--bui-fg-primary);\n border-radius: 4px;\n transition: left var(--active-transition-duration) ease-out,\n opacity 0.15s ease-out, width var(--active-transition-duration) ease-out;\n opacity: var(--active-tab-opacity);\n }\n\n .Tabs_bui-TabHovered__c644deb9e1 {\n content: '';\n position: absolute;\n left: var(--hovered-tab-left);\n top: calc(var(--hovered-tab-top) + 4px);\n width: var(--hovered-tab-width);\n height: calc(var(--hovered-tab-height) - 8px);\n background-color: var(--bui-bg-neutral-2);\n border-radius: 4px;\n opacity: var(--hovered-tab-opacity);\n transition: left var(--hovered-transition-duration) ease-out,\n top var(--hovered-transition-duration) ease-out,\n width var(--hovered-transition-duration) ease-out,\n height var(--hovered-transition-duration) ease-out, opacity 0.15s ease-out;\n }\n\n .Tabs_bui-TabPanel__c644deb9e1 {\n padding-inline: var(--bui-space-2);\n padding-top: var(--bui-space-4);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .Tabs_bui-TabActive__c644deb9e1,\n .Tabs_bui-TabHovered__c644deb9e1 {\n transition: none;\n }\n }\n}\n";
|
|
4
|
+
var styles = {"bui-Tabs":"Tabs_bui-Tabs__c644deb9e1","bui-TabList":"Tabs_bui-TabList__c644deb9e1","bui-TabListWrapper":"Tabs_bui-TabListWrapper__c644deb9e1","bui-Tab":"Tabs_bui-Tab__c644deb9e1","bui-TabActive":"Tabs_bui-TabActive__c644deb9e1","bui-TabHovered":"Tabs_bui-TabHovered__c644deb9e1","bui-TabPanel":"Tabs_bui-TabPanel__c644deb9e1"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsIndicators.esm.js","sources":["../../../src/components/Tabs/TabsIndicators.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TabListStateContext } from 'react-aria-components';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TabsIndicatorsDefinition } from './definition';\nimport { useContext, useEffect, useCallback, useRef } from 'react';\nimport type { TabsIndicatorsProps } from './types';\n\n/**\n * A component that renders the indicators for the toolbar.\n *\n * @internal\n */\nexport const TabsIndicators = (props: TabsIndicatorsProps) => {\n const { ownProps } = useDefinition(TabsIndicatorsDefinition, props);\n const { classes, tabRefs, tabsRef, hoveredKey, prevHoveredKey } = ownProps;\n const state = useContext(TabListStateContext);\n const prevSelectedKey = useRef<string | null>(null);\n\n const updateCSSVariables = useCallback(\n (animate = true) => {\n // When rendered inside CollectionBuilder's hidden tree (for collection\n // building), there is no TabListStateContext provider, so state is null.\n // Bail out to avoid overwriting CSS variables on the shared tabsRef DOM\n // element that the real instance also writes to.\n if (state == null) return;\n\n if (!tabsRef.current) return;\n\n const tabsRect = tabsRef.current.getBoundingClientRect();\n\n // Set active tab variables\n if (state?.selectedKey != null && state.selectedKey !== '') {\n const activeTab = tabRefs.current.get(state.selectedKey.toString());\n\n if (activeTab) {\n const activeRect = activeTab.getBoundingClientRect();\n const relativeLeft = activeRect.left - tabsRect.left;\n const relativeTop = activeRect.top - tabsRect.top;\n\n // Control transition timing based on whether this is the first time setting active tab\n const isFirstActiveTab = prevSelectedKey.current === null;\n\n if (isFirstActiveTab || !animate) {\n // First time setting active tab or non-animated reposition (e.g.\n // tab resize): no transitions for position\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches, unless\n // more non-animated updates may follow (e.g. a resize in progress)\n if (animate) {\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n });\n }\n } else {\n // Switching between tabs: full transitions\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n\n // Update previous selected key for next time\n prevSelectedKey.current = state.selectedKey.toString();\n\n tabsRef.current.style.setProperty(\n '--active-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-right',\n `${relativeLeft + activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-bottom',\n `${relativeTop + activeRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-width',\n `${activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-height',\n `${activeRect.height}px`,\n );\n tabsRef.current.style.setProperty('--active-tab-opacity', '1');\n }\n } else {\n tabsRef.current.style.setProperty('--active-tab-opacity', '0');\n prevSelectedKey.current = null;\n }\n\n // Set hovered tab variables\n if (hoveredKey) {\n const hoveredTab = tabRefs.current.get(hoveredKey);\n if (hoveredTab) {\n const hoveredRect = hoveredTab.getBoundingClientRect();\n const relativeLeft = hoveredRect.left - tabsRect.left;\n const relativeTop = hoveredRect.top - tabsRect.top;\n\n tabsRef.current.style.setProperty(\n '--hovered-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-right',\n `${relativeLeft + hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-bottom',\n `${relativeTop + hoveredRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-width',\n `${hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-height',\n `${hoveredRect.height}px`,\n );\n // Control transition timing based on whether this is a new hover session\n const isNewHoverSession = prevHoveredKey.current === null;\n\n if (isNewHoverSession || !animate) {\n // Starting new hover session or non-animated reposition (e.g. tab\n // resize): no transitions for position\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches, unless\n // more non-animated updates may follow (e.g. a resize in progress)\n if (animate) {\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n });\n }\n } else {\n // Moving between tabs in same session: full transitions\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n\n // Update previous hover key for next time\n prevHoveredKey.current = hoveredKey;\n\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '1');\n }\n } else {\n // When not hovering, hide with opacity and reset for next hover session\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '0');\n\n // Reset previous hover key so next hover is treated as new session\n prevHoveredKey.current = null;\n }\n },\n [state?.selectedKey, hoveredKey, tabRefs.current],\n );\n\n useEffect(() => {\n updateCSSVariables();\n }, [updateCSSVariables, tabRefs.current.size]);\n\n useEffect(() => {\n const handleResize = () => updateCSSVariables(false);\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [updateCSSVariables]);\n\n useEffect(() => {\n // ResizeObserver is not available in some environments (e.g. Jest/jsdom)\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n let frame: number | null = null;\n const scheduleUpdate = () => {\n if (frame !== null) {\n return;\n }\n\n frame = requestAnimationFrame(() => {\n frame = null;\n updateCSSVariables(false);\n });\n };\n\n const resizeObserver = new ResizeObserver(scheduleUpdate);\n const observeTabs = () => {\n resizeObserver.disconnect();\n for (const tab of tabRefs.current.values()) {\n resizeObserver.observe(tab);\n }\n };\n observeTabs();\n\n // Tab elements can be added, removed, or replaced without this component\n // re-rendering, so watch the DOM to keep the observed set in sync.\n const mutationObserver = new MutationObserver(() => {\n observeTabs();\n scheduleUpdate();\n });\n\n if (tabsRef.current) {\n mutationObserver.observe(tabsRef.current, {\n childList: true,\n subtree: true,\n });\n }\n\n return () => {\n if (frame !== null) {\n cancelAnimationFrame(frame);\n }\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, [updateCSSVariables, tabRefs, tabsRef]);\n\n return (\n <>\n <div className={classes.root} />\n <div className={classes.hovered} />\n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AAAA,OACV,CAAA;AAAA,IACH;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,UAAU,IAAA,EAAM;AAClB,QAAA,oBAAA,CAAqB,KAAK,CAAA;AAAA,MAC5B;AACA,MAAA,cAAA,CAAe,UAAA,EAAW;AAC1B,MAAA,gBAAA,CAAiB,UAAA,EAAW;AAAA,IAC9B,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,kBAAA,EAAoB,OAAA,EAAS,OAAO,CAAC,CAAA;AAEzC,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAM,CAAA;AAAA,oBAC9B,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS;AAAA,GAAA,EACnC,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TabsIndicators.esm.js","sources":["../../../src/components/Tabs/TabsIndicators.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TabListStateContext } from 'react-aria-components';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TabsIndicatorsDefinition } from './definition';\nimport { useContext, useEffect, useCallback, useRef } from 'react';\nimport type { TabsIndicatorsProps } from './types';\n\n/**\n * A component that renders the indicators for the toolbar.\n *\n * @internal\n */\nexport const TabsIndicators = (props: TabsIndicatorsProps) => {\n const { ownProps } = useDefinition(TabsIndicatorsDefinition, props);\n const { classes, tabRefs, tabsRef, hoveredKey, prevHoveredKey } = ownProps;\n const state = useContext(TabListStateContext);\n const prevSelectedKey = useRef<string | null>(null);\n\n const updateCSSVariables = useCallback(\n (animate = true) => {\n // When rendered inside CollectionBuilder's hidden tree (for collection\n // building), there is no TabListStateContext provider, so state is null.\n // Bail out to avoid overwriting CSS variables on the shared tabsRef DOM\n // element that the real instance also writes to.\n if (state == null) return;\n\n if (!tabsRef.current) return;\n\n const tabsRect = tabsRef.current.getBoundingClientRect();\n\n // Set active tab variables\n if (state?.selectedKey != null && state.selectedKey !== '') {\n const activeTab = tabRefs.current.get(state.selectedKey.toString());\n\n if (activeTab) {\n const activeRect = activeTab.getBoundingClientRect();\n const relativeLeft = activeRect.left - tabsRect.left;\n const relativeTop = activeRect.top - tabsRect.top;\n\n // Control transition timing based on whether this is the first time setting active tab\n const isFirstActiveTab = prevSelectedKey.current === null;\n\n if (isFirstActiveTab || !animate) {\n // First time setting active tab or non-animated reposition (e.g.\n // tab resize): no transitions for position\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches, unless\n // more non-animated updates may follow (e.g. a resize in progress)\n if (animate) {\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n });\n }\n } else {\n // Switching between tabs: full transitions\n tabsRef.current.style.setProperty(\n '--active-transition-duration',\n '0.25s',\n );\n }\n\n // Update previous selected key for next time\n prevSelectedKey.current = state.selectedKey.toString();\n\n tabsRef.current.style.setProperty(\n '--active-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-right',\n `${relativeLeft + activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-bottom',\n `${relativeTop + activeRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-width',\n `${activeRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--active-tab-height',\n `${activeRect.height}px`,\n );\n tabsRef.current.style.setProperty('--active-tab-opacity', '1');\n }\n } else {\n tabsRef.current.style.setProperty('--active-tab-opacity', '0');\n prevSelectedKey.current = null;\n }\n\n // Set hovered tab variables\n if (hoveredKey) {\n const hoveredTab = tabRefs.current.get(hoveredKey);\n if (hoveredTab) {\n const hoveredRect = hoveredTab.getBoundingClientRect();\n const relativeLeft = hoveredRect.left - tabsRect.left;\n const relativeTop = hoveredRect.top - tabsRect.top;\n\n tabsRef.current.style.setProperty(\n '--hovered-tab-left',\n `${relativeLeft}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-right',\n `${relativeLeft + hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-top',\n `${relativeTop}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-bottom',\n `${relativeTop + hoveredRect.height}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-width',\n `${hoveredRect.width}px`,\n );\n tabsRef.current.style.setProperty(\n '--hovered-tab-height',\n `${hoveredRect.height}px`,\n );\n // Control transition timing based on whether this is a new hover session\n const isNewHoverSession = prevHoveredKey.current === null;\n\n if (isNewHoverSession || !animate) {\n // Starting new hover session or non-animated reposition (e.g. tab\n // resize): no transitions for position\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0s',\n );\n // Enable transitions on next frame for future tab switches, unless\n // more non-animated updates may follow (e.g. a resize in progress)\n if (animate) {\n requestAnimationFrame(() => {\n if (tabsRef.current) {\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n });\n }\n } else {\n // Moving between tabs in same session: full transitions\n tabsRef.current.style.setProperty(\n '--hovered-transition-duration',\n '0.2s',\n );\n }\n\n // Update previous hover key for next time\n prevHoveredKey.current = hoveredKey;\n\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '1');\n }\n } else {\n // When not hovering, hide with opacity and reset for next hover session\n tabsRef.current.style.setProperty('--hovered-tab-opacity', '0');\n\n // Reset previous hover key so next hover is treated as new session\n prevHoveredKey.current = null;\n }\n },\n [state?.selectedKey, hoveredKey, tabRefs.current],\n );\n\n useEffect(() => {\n updateCSSVariables();\n }, [updateCSSVariables, tabRefs.current.size]);\n\n useEffect(() => {\n const handleResize = () => updateCSSVariables(false);\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [updateCSSVariables]);\n\n useEffect(() => {\n // ResizeObserver is not available in some environments (e.g. Jest/jsdom)\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n\n let frame: number | null = null;\n const scheduleUpdate = () => {\n if (frame !== null) {\n return;\n }\n\n frame = requestAnimationFrame(() => {\n frame = null;\n updateCSSVariables(false);\n });\n };\n\n const resizeObserver = new ResizeObserver(scheduleUpdate);\n const observeTabs = () => {\n resizeObserver.disconnect();\n for (const tab of tabRefs.current.values()) {\n resizeObserver.observe(tab);\n }\n };\n observeTabs();\n\n // Tab elements can be added, removed, or replaced without this component\n // re-rendering, so watch the DOM to keep the observed set in sync.\n const mutationObserver = new MutationObserver(() => {\n observeTabs();\n scheduleUpdate();\n });\n\n if (tabsRef.current) {\n mutationObserver.observe(tabsRef.current, {\n childList: true,\n subtree: true,\n });\n }\n\n return () => {\n if (frame !== null) {\n cancelAnimationFrame(frame);\n }\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, [updateCSSVariables, tabRefs, tabsRef]);\n\n return (\n <>\n <div className={classes.root} />\n <div className={classes.hovered} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BO,MAAM,cAAA,GAAiB,CAAC,KAAA,KAA+B;AAC5D,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,aAAA,CAAc,0BAA0B,KAAK,CAAA;AAClE,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,UAAA,EAAY,gBAAe,GAAI,QAAA;AAClE,EAAA,MAAM,KAAA,GAA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,OAAA,EAAS,OAAO,CAAC,CAAA;AAEzC,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,IAAA,EAAM,CAAA;AAAA,oBAC9B,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS;AAAA,GAAA,EACnC,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tab',\n },\n analytics: true,\n navigation: { type: 'anchor' },\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n noTrack: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {},\n prevHoveredKey: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,oBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,EAC7B,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,MAAM,EAAC;AAAA,IACP,IAAI,EAAC;AAAA,IACL,SAAS;AAAC;AAEd,CAAC;AAGM,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,SAAS,EAAC;AAAA,IACV,YAAY,EAAC;AAAA,IACb,gBAAgB;AAAC;AAErB,CAAC
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Tabs/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type {\n TabsOwnProps,\n TabListOwnProps,\n TabOwnProps,\n TabPanelOwnProps,\n TabsIndicatorsOwnProps,\n} from './types';\nimport styles from './Tabs.module.css';\n\n/**\n * Component definition for Tabs\n * @public\n */\nexport const TabsDefinition = defineComponent<TabsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tabs',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabListDefinition = defineComponent<TabListOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabListWrapper',\n tabList: 'bui-TabList',\n },\n propDefs: {\n className: {},\n children: {},\n },\n});\n\n/** @internal */\nexport const TabDefinition = defineComponent<TabOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tab',\n },\n analytics: true,\n navigation: { type: 'anchor' },\n propDefs: {\n className: {},\n matchStrategy: {},\n href: {},\n id: {},\n noTrack: {},\n },\n});\n\n/** @internal */\nexport const TabPanelDefinition = defineComponent<TabPanelOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabPanel',\n },\n propDefs: {\n className: {},\n },\n});\n\n/** @internal */\nexport const TabsIndicatorsDefinition =\n defineComponent<TabsIndicatorsOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TabActive',\n hovered: 'bui-TabHovered',\n },\n propDefs: {\n tabRefs: {},\n tabsRef: {},\n hoveredKey: {},\n prevHoveredKey: {},\n },\n });\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,iBAAA,GAAoB,iBAAiC,CAAE;AAAA,EAClE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,oBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,UAAU;AAAC;AAEf,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,EAC7B,QAAA,EAAU;AAAA,IACR,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,MAAM,EAAC;AAAA,IACP,IAAI,EAAC;AAAA,IACL,SAAS;AAAC;AAEd,CAAC;AAGM,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,wBAAA,GACX,iBAAwC,CAAE;AAAA,EACxC,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,SAAS,EAAC;AAAA,IACV,YAAY,EAAC;AAAA,IACb,gBAAgB;AAAC;AAErB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TagGroupDefinition, TagDefinition } from './definition';\nimport { getNodeText } from '../../analytics/getNodeText';\nimport { BUIRoutingProvider } from '../../navigation/BUIRoutingProvider';\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);\n const { classes, items, children, renderEmptyState } = ownProps;\n\n return (\n <BUIRoutingProvider>\n <ReactAriaTagGroup className={classes.root} {...restProps}>\n <ReactAriaTagList\n className={classes.list}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </BUIRoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef<HTMLDivElement, TagProps>((props, ref) => {\n const { ownProps, restProps, dataAttributes, analytics } = useDefinition(\n TagDefinition,\n props,\n );\n const { classes, children, icon } = ownProps;\n const rawHref = restProps.href;\n const textValue = typeof children === 'string' ? children : undefined;\n\n const handlePress: typeof restProps.onPress = e => {\n restProps.onPress?.(e);\n if (rawHref) {\n const text =\n (restProps as React.AriaAttributes)['aria-label'] ??\n textValue ??\n getNodeText(children) ??\n String(rawHref);\n analytics.captureEvent('click', text, {\n attributes: { to: String(rawHref) },\n });\n }\n };\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n onPress={handlePress}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && <span className={classes.icon}>{icon}</span>}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton className={classes.removeButton} slot=\"remove\">\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n});\n\nTag.displayName = 'Tag';\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;AAmCO,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,QAAA,EAAU,kBAAiB,GAAI,QAAA;AAEvD,EAAA,uBACE,GAAA,CAAC,sBACC,QAAA,kBAAA,GAAA,CAACA,UA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AAA,EAAA,CAAC,EAAE,cAAA,EAAe,qBACjB,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,MAAO,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC7C,QAAA;AAAA,QACA,cAAA,oBACC,GAAA,CAACC,MAAA,EAAA,EAAgB,SAAA,EAAW,OAAA,CAAQ,YAAA,EAAc,IAAA,EAAK,QAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI,CAAA,EAC/B;AAAA,OAAA,EAEJ;AAAA;AAAA,GAEJ;AAEJ,CAAC;AAED,GAAA,CAAI,WAAA,GAAc,KAAA
|
|
1
|
+
{"version":3,"file":"TagGroup.esm.js","sources":["../../../src/components/TagGroup/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TagProps, TagGroupProps } from './types';\nimport {\n TagGroup as ReactAriaTagGroup,\n TagList as ReactAriaTagList,\n Tag as ReactAriaTag,\n Button as ReactAriaButton,\n} from 'react-aria-components';\nimport { forwardRef, type ReactNode } from 'react';\nimport { RiCloseCircleLine } from '@remixicon/react';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TagGroupDefinition, TagDefinition } from './definition';\nimport { getNodeText } from '../../analytics/getNodeText';\nimport { BUIRoutingProvider } from '../../navigation/BUIRoutingProvider';\n\n/**\n * A component that renders a list of tags.\n *\n * @public\n */\nexport const TagGroup = <T extends object>(props: TagGroupProps<T>) => {\n const { ownProps, restProps } = useDefinition(TagGroupDefinition, props);\n const { classes, items, children, renderEmptyState } = ownProps;\n\n return (\n <BUIRoutingProvider>\n <ReactAriaTagGroup className={classes.root} {...restProps}>\n <ReactAriaTagList\n className={classes.list}\n items={items}\n renderEmptyState={renderEmptyState}\n >\n {children}\n </ReactAriaTagList>\n </ReactAriaTagGroup>\n </BUIRoutingProvider>\n );\n};\n\n/**\n * A component that renders a tag.\n *\n * @public\n */\nexport const Tag = forwardRef<HTMLDivElement, TagProps>((props, ref) => {\n const { ownProps, restProps, dataAttributes, analytics } = useDefinition(\n TagDefinition,\n props,\n );\n const { classes, children, icon } = ownProps;\n const rawHref = restProps.href;\n const textValue = typeof children === 'string' ? children : undefined;\n\n const handlePress: typeof restProps.onPress = e => {\n restProps.onPress?.(e);\n if (rawHref) {\n const text =\n (restProps as React.AriaAttributes)['aria-label'] ??\n textValue ??\n getNodeText(children) ??\n String(rawHref);\n analytics.captureEvent('click', text, {\n attributes: { to: String(rawHref) },\n });\n }\n };\n\n return (\n <ReactAriaTag\n ref={ref}\n textValue={textValue}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n onPress={handlePress}\n >\n {({ allowsRemoving }) => (\n <>\n {icon && <span className={classes.icon}>{icon}</span>}\n {children as ReactNode}\n {allowsRemoving && (\n <ReactAriaButton className={classes.removeButton} slot=\"remove\">\n <RiCloseCircleLine size={16} />\n </ReactAriaButton>\n )}\n </>\n )}\n </ReactAriaTag>\n );\n});\n\nTag.displayName = 'Tag';\n"],"names":["ReactAriaTagGroup","ReactAriaTagList","ReactAriaTag","ReactAriaButton"],"mappings":";;;;;;;;;AAmCO,MAAM,QAAA,GAAW,CAAmB,KAAA,KAA4B;AACrE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA,CAAc,oBAAoB,KAAK,CAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,Q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,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG,SAAA;AAAA,MACJ,OAAA,EAAS,WAAA;AAAA,MAER,QAAA,EAAA,CAAC,EAAE,cAAA,EAAe,qBACjB,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,MAAO,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC7C,QAAA;AAAA,QACA,cAAA,oBACC,GAAA,CAACC,MAAA,EAAA,EAAgB,SAAA,EAAW,OAAA,CAAQ,YAAA,EAAc,IAAA,EAAK,QAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,IAAA,EAAM,EAAA,EAAI,CAAA,EAC/B;AAAA,OAAA,EAEJ;AAAA;AAAA,GAEJ;AAEJ,CAAC;AAED,GAAA,CAAI,WAAA,GAAc,KAAA;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .TagGroup_bui-
|
|
4
|
-
var styles = {"bui-TagList":"TagGroup_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .TagGroup_bui-TagList__88e3be9f9e {\n display: flex;\n flex-wrap: wrap;\n gap: var(--bui-space-2);\n }\n\n .TagGroup_bui-Tag__88e3be9f9e {\n color: var(--bui-fg-primary);\n background-color: var(--bui-bg-neutral-2);\n border-radius: var(--bui-radius-2);\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: var(--bui-font-weight-regular);\n line-height: 1.15;\n gap: var(--bui-space-1);\n transition-property: background-color, box-shadow, color;\n transition-duration: 0.2s;\n transition-timing-function: ease-in-out;\n box-sizing: border-box;\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-size='small'] {\n height: 26px;\n padding: 0 var(--bui-space-2);\n font-size: var(--bui-font-size-1);\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-size='medium'] {\n height: 32px;\n padding: 0 var(--bui-space-2);\n font-size: var(--bui-font-size-2);\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-hovered] {\n background-color: var(--bui-bg-neutral-3);\n cursor: pointer;\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-focus-visible] {\n outline: 2px solid var(--bui-ring);\n outline-offset: 1px;\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-selected] {\n box-shadow: inset 0 0 0 1px var(--bui-fg-secondary);\n }\n\n .TagGroup_bui-Tag__88e3be9f9e[data-disabled] {\n color: var(--bui-fg-disabled);\n cursor: not-allowed;\n }\n\n .TagGroup_bui-TagRemoveButton__88e3be9f9e {\n background-color: transparent;\n border: none;\n cursor: pointer;\n color: var(--bui-fg-primary);\n padding: 0;\n margin: 0;\n width: 1rem;\n height: 1rem;\n }\n\n .TagGroup_bui-TagIcon__88e3be9f9e {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.2s ease-in-out;\n\n svg {\n width: 1rem;\n height: 1rem;\n }\n }\n}\n";
|
|
4
|
+
var styles = {"bui-TagList":"TagGroup_bui-TagList__88e3be9f9e","bui-Tag":"TagGroup_bui-Tag__88e3be9f9e","bui-TagRemoveButton":"TagGroup_bui-TagRemoveButton__88e3be9f9e","bui-TagIcon":"TagGroup_bui-TagIcon__88e3be9f9e"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TagGroup.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n analytics: true,\n propDefs: {\n noTrack: {},\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TagGroup/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TagGroupOwnProps, TagOwnProps } from './types';\nimport styles from './TagGroup.module.css';\n\n/**\n * Component definition for TagGroup\n * @public\n */\nexport const TagGroupDefinition = defineComponent<TagGroupOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TagGroup',\n list: 'bui-TagList',\n },\n propDefs: {\n items: {},\n children: {},\n renderEmptyState: {},\n className: {},\n },\n});\n\n/** @internal */\nexport const TagDefinition = defineComponent<TagOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Tag',\n icon: 'bui-TagIcon',\n removeButton: 'bui-TagRemoveButton',\n },\n analytics: true,\n propDefs: {\n noTrack: {},\n icon: {},\n size: { dataAttribute: true, default: 'small' },\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,kBAAA,GAAqB,iBAAkC,CAAE;AAAA,EACpE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,cAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,kBAAkB,EAAC;AAAA,IACnB,WAAW;AAAC;AAEhB,CAAC;AAGM,MAAM,aAAA,GAAgB,iBAA6B,CAAE;AAAA,EAC1D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,aAAA;AAAA,IACN,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,SAAA,EAAW,IAAA;AAAA,EACX,QAAA,EAAU;AAAA,IACR,SAAS,EAAC;AAAA,IACV,MAAM,EAAC;AAAA,IACP,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/**\n * A typographic primitive that renders text with design system variants, weights, and colors, and can render as any HTML element.\n *\n * @public\n */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAOrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA
|
|
1
|
+
{"version":3,"file":"Text.esm.js","sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef } from 'react';\nimport type { ElementType } from 'react';\nimport type { TextProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextDefinition } from './definition';\n\nfunction TextComponent<T extends ElementType = 'span'>(\n props: TextProps<T>,\n ref: React.Ref<any>,\n) {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextDefinition,\n props,\n );\n const { classes, as } = ownProps;\n\n const Component = as;\n\n return (\n <Component\n ref={ref}\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n />\n );\n}\n\nTextComponent.displayName = 'Text';\n\n/**\n * A typographic primitive that renders text with design system variants, weights, and colors, and can render as any HTML element.\n *\n * @public\n */\nexport const Text = forwardRef(TextComponent) as {\n <T extends ElementType = 'p'>(\n props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },\n ): React.ReactElement<TextProps<T>, T>;\n displayName: string;\n};\n\nText.displayName = 'Text';\n"],"names":[],"mappings":";;;;;AAsBA,SAAS,aAAA,CACP,OACA,GAAA,EACA;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,IAC9C,cAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,EAAA,EAAG,GAAI,QAAA;AAExB,EAAA,MAAM,SAAA,GAAY,EAAA;AAElB,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAW,OAAA,CAAQ,IAAA;AAAA,MAClB,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,MAAA;AAOrB,MAAM,IAAA,GAAO,WAAW,aAAa;AAO5C,IAAA,CAAK,WAAA,GAAc,MAAA;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .Text_bui-
|
|
4
|
-
var styles = {"bui-Text":"Text_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .Text_bui-Text__ea9294252e {\n font-family: var(--bui-font-regular);\n padding: 0;\n margin: 0;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='title-large'] {\n font-size: var(--bui-font-size-8);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='title-medium'] {\n font-size: var(--bui-font-size-7);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='title-small'] {\n font-size: var(--bui-font-size-6);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='title-x-small'] {\n font-size: var(--bui-font-size-5);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='body-large'] {\n font-size: var(--bui-font-size-4);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='body-medium'] {\n font-size: var(--bui-font-size-3);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='body-small'] {\n font-size: var(--bui-font-size-2);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-variant='body-x-small'] {\n font-size: var(--bui-font-size-1);\n line-height: 140%;\n }\n\n .Text_bui-Text__ea9294252e[data-weight='regular'] {\n font-weight: var(--bui-font-weight-regular);\n }\n\n .Text_bui-Text__ea9294252e[data-weight='bold'] {\n font-weight: var(--bui-font-weight-bold);\n }\n\n .Text_bui-Text__ea9294252e[data-color='primary'] {\n color: var(--bui-fg-primary);\n }\n\n .Text_bui-Text__ea9294252e[data-color='secondary'] {\n color: var(--bui-fg-secondary);\n }\n\n .Text_bui-Text__ea9294252e[data-color='danger'] {\n color: var(--bui-fg-danger);\n }\n\n .Text_bui-Text__ea9294252e[data-color='warning'] {\n color: var(--bui-fg-warning);\n }\n\n .Text_bui-Text__ea9294252e[data-color='success'] {\n color: var(--bui-fg-success);\n }\n\n .Text_bui-Text__ea9294252e[data-color='info'] {\n color: var(--bui-fg-info);\n }\n\n .Text_bui-Text__ea9294252e[data-truncate] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .Text_bui-Text__ea9294252e[data-as='span'],\n .Text_bui-Text__ea9294252e[data-as='label'],\n .Text_bui-Text__ea9294252e[data-as='strong'],\n .Text_bui-Text__ea9294252e[data-as='em'],\n .Text_bui-Text__ea9294252e[data-as='small'] {\n display: inline-block;\n }\n}\n";
|
|
4
|
+
var styles = {"bui-Text":"Text_bui-Text__ea9294252e"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/Text/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextOwnProps } from './types';\nimport styles from './Text.module.css';\n\n/**\n * Component definition for Text\n * @public\n */\nexport const TextDefinition = defineComponent<TextOwnProps>()({\n styles,\n classNames: {\n root: 'bui-Text',\n },\n propDefs: {\n as: { default: 'span' },\n variant: { dataAttribute: true, default: 'body-medium' },\n weight: { dataAttribute: true, default: 'regular' },\n color: { dataAttribute: true, default: 'primary' },\n truncate: { dataAttribute: true },\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,cAAA,GAAiB,iBAA8B,CAAE;AAAA,EAC5D,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,IACtB,OAAA,EAAS,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,aAAA,EAAc;AAAA,IACvD,MAAA,EAAQ,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IAClD,KAAA,EAAO,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,SAAA,EAAU;AAAA,IACjD,QAAA,EAAU,EAAE,aAAA,EAAe,IAAA,EAAK;AAAA,IAChC,WAAW;AAAC;AAEhB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaField.esm.js","sources":["../../../src/components/TextAreaField/TextAreaField.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { TextArea, TextField as AriaTextField } from 'react-aria-components';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextAreaFieldProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextAreaFieldDefinition } from './definition';\n\n/**\n * A multi-line text input with an integrated label and inline error display.\n *\n * @public\n */\nexport const TextAreaField = forwardRef<HTMLDivElement, TextAreaFieldProps>(\n (props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextAreaFieldDefinition,\n props,\n );\n const { classes, label, secondaryLabel, placeholder, description, rows } =\n ownProps;\n\n useEffect(() => {\n if (!label && !restProps['aria-label'] && !restProps['aria-labelledby']) {\n console.warn(\n 'TextAreaField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, restProps['aria-label'], restProps['aria-labelledby']]);\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (restProps.isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n descriptionSlot=\"description\"\n />\n <TextArea\n className={classes.textArea}\n data-size={dataAttributes['data-size']}\n placeholder={placeholder}\n rows={rows}\n />\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextAreaField.displayName = 'TextAreaField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AA6BO,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,uBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,gBAAgB,WAAA,EAAa,WAAA,EAAa,MAAK,GACrE,QAAA;AAEF,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,SAAS,CAAC,SAAA,CAAU,YAAY,CAAA,IAAK,CAAC,SAAA,CAAU,iBAAiB,CAAA,EAAG;AACvE,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,CAAU,YAAY,CAAA,EAAG,SAAA,CAAU,iBAAiB,CAAC,CAAC,CAAA;AAGjE,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,SAAA,CAAU,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAEzD,IAAA,uBACE,IAAA;AAAA,MAACA,SAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QAClB,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,KAAA;AAAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB,WAAA;AAAA,cACA,eAAA,EAAgB;AAAA;AAAA,WAClB;AAAA,0BACA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,WAAW,OAAA,CAAQ,QAAA;AAAA,cACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cACrC,WAAA;AAAA,cACA;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA
|
|
1
|
+
{"version":3,"file":"TextAreaField.esm.js","sources":["../../../src/components/TextAreaField/TextAreaField.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { TextArea, TextField as AriaTextField } from 'react-aria-components';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextAreaFieldProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextAreaFieldDefinition } from './definition';\n\n/**\n * A multi-line text input with an integrated label and inline error display.\n *\n * @public\n */\nexport const TextAreaField = forwardRef<HTMLDivElement, TextAreaFieldProps>(\n (props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextAreaFieldDefinition,\n props,\n );\n const { classes, label, secondaryLabel, placeholder, description, rows } =\n ownProps;\n\n useEffect(() => {\n if (!label && !restProps['aria-label'] && !restProps['aria-labelledby']) {\n console.warn(\n 'TextAreaField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, restProps['aria-label'], restProps['aria-labelledby']]);\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (restProps.isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n descriptionSlot=\"description\"\n />\n <TextArea\n className={classes.textArea}\n data-size={dataAttributes['data-size']}\n placeholder={placeholder}\n rows={rows}\n />\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextAreaField.displayName = 'TextAreaField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AA6BO,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,uBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,gBAAgB,WAAA,EAAa,WAAA,EAAa,MAAK,GACrE,QAAA;AAEF,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,SAAS,CAAC,SAAA,CAAU,YAAY,CAAA,IAAK,CAAC,SAAA,CAAU,iBAAiB,CAAA,EAAG;AACvE,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,CAAU,YAAY,CAAA,EAAG,SAAA,CAAU,iBAAiB,CAAC,CAAC,CAAA;AAGjE,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,SAAA,CAAU,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAEzD,IAAA,uBACE,IAAA;AAAA,MAACA,SAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QAClB,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,KAAA;AAAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB,WAAA;AAAA,cACA,eAAA,EAAgB;AAAA;AAAA,WAClB;AAAA,0BACA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,WAAW,OAAA,CAAQ,QAAA;AAAA,cACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cACrC,WAAA;AAAA,cACA;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .TextAreaField_bui-
|
|
4
|
-
var styles = {"bui-TextAreaField":"TextAreaField_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .TextAreaField_bui-TextAreaField__8a64df1a1b {\n display: flex;\n flex-direction: column;\n font-family: var(--bui-font-regular);\n width: 100%;\n flex: 1;\n }\n\n .TextAreaField_bui-TextArea__8a64df1a1b {\n display: block;\n padding: var(--bui-space-2) var(--bui-space-3);\n border-radius: var(--bui-radius-2);\n border: none;\n background-color: var(--bui-bg-neutral-1);\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n line-height: 140%;\n color: var(--bui-fg-primary);\n transition: box-shadow 0.2s ease-in-out;\n width: 100%;\n /* Keep the manual resize handle so users can expand the field. */\n resize: vertical;\n overflow-y: auto;\n\n .TextAreaField_bui-TextAreaField__8a64df1a1b[data-on-bg='neutral-1'] & {\n background-color: var(--bui-bg-neutral-2);\n }\n\n .TextAreaField_bui-TextAreaField__8a64df1a1b[data-on-bg='neutral-2'] & {\n background-color: var(--bui-bg-neutral-3);\n }\n\n .TextAreaField_bui-TextAreaField__8a64df1a1b[data-on-bg='neutral-3'] & {\n background-color: var(--bui-bg-neutral-4);\n }\n\n &[data-focused] {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--bui-ring);\n }\n\n &::placeholder {\n color: var(--bui-fg-secondary);\n }\n\n &[data-invalid] {\n box-shadow: inset 0 0 0 1px var(--bui-border-danger);\n }\n\n &[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n &[data-size='small'] {\n padding: var(--bui-space-1_5) var(--bui-space-3);\n }\n\n &[data-size='medium'] {\n padding: var(--bui-space-2) var(--bui-space-3);\n }\n }\n}\n";
|
|
4
|
+
var styles = {"bui-TextAreaField":"TextAreaField_bui-TextAreaField__8a64df1a1b","bui-TextArea":"TextAreaField_bui-TextArea__8a64df1a1b"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaField.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextAreaField.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextAreaField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextAreaFieldOwnProps } from './types';\nimport styles from './TextAreaField.module.css';\n\n/**\n * Component definition for TextAreaField\n * @public\n */\nexport const TextAreaFieldDefinition = defineComponent<TextAreaFieldOwnProps>()(\n {\n styles,\n classNames: {\n root: 'bui-TextAreaField',\n textArea: 'bui-TextArea',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n placeholder: {},\n rows: { default: 3 },\n label: {},\n description: {},\n secondaryLabel: {},\n },\n },\n);\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,0BAA0B,eAAA,EAAuC;AAAA,EAC5E;AAAA,IACE,MAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,mBAAA;AAAA,MACN,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,EAAA,EAAI,UAAA;AAAA,IACJ,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,MAC9C,WAAW,EAAC;AAAA,MACZ,aAAa,EAAC;AAAA,MACd,IAAA,EAAM,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,MACnB,OAAO,EAAC;AAAA,MACR,aAAa,EAAC;AAAA,MACd,gBAAgB;AAAC;AACnB;AAEJ
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextAreaField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextAreaFieldOwnProps } from './types';\nimport styles from './TextAreaField.module.css';\n\n/**\n * Component definition for TextAreaField\n * @public\n */\nexport const TextAreaFieldDefinition = defineComponent<TextAreaFieldOwnProps>()(\n {\n styles,\n classNames: {\n root: 'bui-TextAreaField',\n textArea: 'bui-TextArea',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n placeholder: {},\n rows: { default: 3 },\n label: {},\n description: {},\n secondaryLabel: {},\n },\n },\n);\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,0BAA0B,eAAA,EAAuC;AAAA,EAC5E;AAAA,IACE,MAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,mBAAA;AAAA,MACN,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,EAAA,EAAI,UAAA;AAAA,IACJ,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,MAC9C,WAAW,EAAC;AAAA,MACZ,aAAa,EAAC;AAAA,MACd,IAAA,EAAM,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,MACnB,OAAO,EAAC;AAAA,MACR,aAAa,EAAC;AAAA,MACd,gBAAgB;AAAC;AACnB;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.esm.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextFieldDefinition } from './definition';\n\n/**\n * A single-line text input with an integrated label, optional icon, and inline error display.\n *\n * @public\n */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextFieldDefinition,\n props,\n );\n const { classes, label, icon, secondaryLabel, placeholder, description } =\n ownProps;\n\n useEffect(() => {\n if (!label && !restProps['aria-label'] && !restProps['aria-labelledby']) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, restProps['aria-label'], restProps['aria-labelledby']]);\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (restProps.isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n descriptionSlot=\"description\"\n />\n <div\n className={classes.inputWrapper}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={classes.inputIcon}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={classes.input}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AA6BO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,mBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,MAAM,cAAA,EAAgB,WAAA,EAAa,aAAY,GACrE,QAAA;AAEF,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,SAAS,CAAC,SAAA,CAAU,YAAY,CAAA,IAAK,CAAC,SAAA,CAAU,iBAAiB,CAAA,EAAG;AACvE,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,CAAU,YA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Content":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, useEffect } from 'react';\nimport { Input, TextField as AriaTextField } from 'react-aria-components';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport type { TextFieldProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { TextFieldDefinition } from './definition';\n\n/**\n * A single-line text input with an integrated label, optional icon, and inline error display.\n *\n * @public\n */\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps>(\n (props, ref) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n TextFieldDefinition,\n props,\n );\n const { classes, label, icon, secondaryLabel, placeholder, description } =\n ownProps;\n\n useEffect(() => {\n if (!label && !restProps['aria-label'] && !restProps['aria-labelledby']) {\n console.warn(\n 'TextField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, restProps['aria-label'], restProps['aria-labelledby']]);\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (restProps.isRequired ? 'Required' : null);\n\n return (\n <AriaTextField\n className={classes.root}\n {...dataAttributes}\n {...restProps}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n descriptionSlot=\"description\"\n />\n <div\n className={classes.inputWrapper}\n data-size={dataAttributes['data-size']}\n >\n {icon && (\n <div\n className={classes.inputIcon}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon}\n </div>\n )}\n <Input\n className={classes.input}\n {...(icon && { 'data-icon': true })}\n placeholder={placeholder}\n />\n </div>\n <FieldError />\n </AriaTextField>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["AriaTextField"],"mappings":";;;;;;;;;;AA6BO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,mBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,MAAM,cAAA,EAAgB,WAAA,EAAa,aAAY,GACrE,QAAA;AAEF,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,SAAS,CAAC,SAAA,CAAU,YAAY,CAAA,IAAK,CAAC,SAAA,CAAU,iBAAiB,CAAA,EAAG;AACvE,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,CAAU,YAAY,CAAA,EAAG,SAAA,CAAU,iBAAiB,CAAC,CAAC,CAAA;AAGjE,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,SAAA,CAAU,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAEzD,IAAA,uBACE,IAAA;AAAA,MAACA,WAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QAClB,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,KAAA;AAAA,cACA,cAAA,EAAgB,kBAAA;AAAA,cAChB,WAAA;AAAA,cACA,eAAA,EAAgB;AAAA;AAAA,WAClB;AAAA,0BACA,IAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAW,OAAA,CAAQ,YAAA;AAAA,cACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,oBACC,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,OAAA,CAAQ,SAAA;AAAA,oBACnB,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA;AAAA;AAAA,iBACH;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,OAAA,CAAQ,KAAA;AAAA,oBAClB,GAAI,IAAA,IAAQ,EAAE,WAAA,EAAa,IAAA,EAAK;AAAA,oBACjC;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .TextField_bui-
|
|
4
|
-
var styles = {"bui-TextField":"TextField_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .TextField_bui-TextField__b1db42542f {\n display: flex;\n flex-direction: column;\n font-family: var(--bui-font-regular);\n width: 100%;\n flex: 1;\n\n &[data-on-bg='neutral-1'] .TextField_bui-Input__b1db42542f {\n background-color: var(--bui-bg-neutral-2);\n }\n\n &[data-on-bg='neutral-2'] .TextField_bui-Input__b1db42542f {\n background-color: var(--bui-bg-neutral-3);\n }\n\n &[data-on-bg='neutral-3'] .TextField_bui-Input__b1db42542f {\n background-color: var(--bui-bg-neutral-4);\n }\n }\n\n .TextField_bui-InputWrapper__b1db42542f {\n position: relative;\n\n &[data-size='small'] .TextField_bui-Input__b1db42542f {\n height: 2rem;\n }\n\n &[data-size='medium'] .TextField_bui-Input__b1db42542f {\n height: 2.5rem;\n }\n\n &[data-size='small'] .TextField_bui-Input__b1db42542f[data-icon] {\n padding-left: var(--bui-space-8);\n }\n\n &[data-size='medium'] .TextField_bui-Input__b1db42542f[data-icon] {\n padding-left: var(--bui-space-9);\n }\n }\n\n .TextField_bui-InputIcon__b1db42542f {\n position: absolute;\n left: var(--bui-space-3);\n top: 50%;\n transform: translateY(-50%);\n margin-right: var(--bui-space-1);\n color: var(--bui-fg-primary);\n flex-shrink: 0;\n pointer-events: none;\n /* To animate the icon when the input is collapsed */\n transition: left 0.2s ease-in-out;\n\n &[data-size='small'],\n &[data-size='small'] svg {\n width: 1rem;\n height: 1rem;\n }\n\n &[data-size='medium'],\n &[data-size='medium'] svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n }\n\n .TextField_bui-Input__b1db42542f {\n display: flex;\n align-items: center;\n padding: 0 var(--bui-space-3);\n border-radius: var(--bui-radius-2);\n border: none;\n background-color: var(--bui-bg-neutral-1);\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n line-height: 1.15;\n color: var(--bui-fg-primary);\n transition: box-shadow 0.2s ease-in-out;\n width: 100%;\n height: 100%;\n cursor: inherit;\n\n &[data-focused] {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--bui-ring);\n }\n\n &::-webkit-search-cancel-button,\n &::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &::placeholder {\n color: var(--bui-fg-secondary);\n }\n\n &[data-invalid] {\n box-shadow: inset 0 0 0 1px var(--bui-border-danger);\n }\n\n &[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n }\n}\n";
|
|
4
|
+
var styles = {"bui-TextField":"TextField_bui-TextField__b1db42542f","bui-Input":"TextField_bui-Input__b1db42542f","bui-InputWrapper":"TextField_bui-InputWrapper__b1db42542f","bui-InputIcon":"TextField_bui-InputIcon__b1db42542f"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextField.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextFieldOwnProps } from './types';\nimport styles from './TextField.module.css';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = defineComponent<TextFieldOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n icon: {},\n placeholder: {},\n label: {},\n description: {},\n secondaryLabel: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,MAAM,EAAC;AAAA,IACP,aAAa,EAAC;AAAA,IACd,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,gBAAgB;AAAC;AAErB,CAAC
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/TextField/definition.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { TextFieldOwnProps } from './types';\nimport styles from './TextField.module.css';\n\n/**\n * Component definition for TextField\n * @public\n */\nexport const TextFieldDefinition = defineComponent<TextFieldOwnProps>()({\n styles,\n classNames: {\n root: 'bui-TextField',\n inputWrapper: 'bui-InputWrapper',\n input: 'bui-Input',\n inputIcon: 'bui-InputIcon',\n inputAction: 'bui-InputAction',\n },\n bg: 'consumer',\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n className: {},\n icon: {},\n placeholder: {},\n label: {},\n description: {},\n secondaryLabel: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,mBAAA,GAAsB,iBAAmC,CAAE;AAAA,EACtE,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,kBAAA;AAAA,IACd,KAAA,EAAO,WAAA;AAAA,IACP,SAAA,EAAW,eAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AAAA,EACA,EAAA,EAAI,UAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,MAAM,EAAC;AAAA,IACP,aAAa,EAAC;AAAA,IACd,OAAO,EAAC;AAAA,IACR,aAAa,EAAC;AAAA,IACd,gBAAgB;AAAC;AAErB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.esm.js","sources":["../../../src/components/ToggleButton/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref } from 'react';\nimport { ToggleButton as AriaToggleButton } from 'react-aria-components';\nimport type { ToggleButtonProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonDefinition } from './definition';\n\n/**\n * A button that maintains a pressed or unpressed state, with optional start and end icon slots.\n *\n * @public\n */\nexport const ToggleButton = forwardRef(\n (props: ToggleButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n ToggleButtonDefinition,\n props,\n );\n const { classes, children, iconStart, iconEnd } = ownProps;\n\n return (\n <AriaToggleButton\n className={classes.root}\n ref={ref}\n {...dataAttributes}\n {...restProps}\n >\n {renderProps => {\n // If children is a function, call it with render props; otherwise use children as-is\n const renderedChildren =\n typeof children === 'function' ? children(renderProps) : children;\n\n return (\n <span className={classes.content} data-slot=\"content\">\n {iconStart}\n {renderedChildren}\n {iconEnd}\n </span>\n );\n }}\n </AriaToggleButton>\n );\n },\n);\n\nToggleButton.displayName = 'ToggleButton';\n"],"names":["AriaToggleButton"],"mappings":";;;;;;AA2BO,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAAA,KAAgC;AACzD,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,sBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAQ,GAAI,QAAA;AAElD,IAAA,uBACE,GAAA;AAAA,MAACA,cAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QACnB,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA,CAAA,WAAA,KAAe;AAEd,UAAA,MAAM,mBACJ,OAAO,QAAA,KAAa,UAAA,GAAa,QAAA,CAAS,WAAW,CAAA,GAAI,QAAA;AAE3D,UAAA,4BACG,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS,aAAU,SAAA,EACzC,QAAA,EAAA;AAAA,YAAA,SAAA;AAAA,YACA,gBAAA;AAAA,YACA;AAAA,WAAA,EACH,CAAA;AAAA,QAEJ;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA
|
|
1
|
+
{"version":3,"file":"ToggleButton.esm.js","sources":["../../../src/components/ToggleButton/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref } from 'react';\nimport { ToggleButton as AriaToggleButton } from 'react-aria-components';\nimport type { ToggleButtonProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonDefinition } from './definition';\n\n/**\n * A button that maintains a pressed or unpressed state, with optional start and end icon slots.\n *\n * @public\n */\nexport const ToggleButton = forwardRef(\n (props: ToggleButtonProps, ref: Ref<HTMLButtonElement>) => {\n const { ownProps, restProps, dataAttributes } = useDefinition(\n ToggleButtonDefinition,\n props,\n );\n const { classes, children, iconStart, iconEnd } = ownProps;\n\n return (\n <AriaToggleButton\n className={classes.root}\n ref={ref}\n {...dataAttributes}\n {...restProps}\n >\n {renderProps => {\n // If children is a function, call it with render props; otherwise use children as-is\n const renderedChildren =\n typeof children === 'function' ? children(renderProps) : children;\n\n return (\n <span className={classes.content} data-slot=\"content\">\n {iconStart}\n {renderedChildren}\n {iconEnd}\n </span>\n );\n }}\n </AriaToggleButton>\n );\n },\n);\n\nToggleButton.displayName = 'ToggleButton';\n"],"names":["AriaToggleButton"],"mappings":";;;;;;AA2BO,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAAA,KAAgC;AACzD,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,cAAA,EAAe,GAAI,aAAA;AAAA,MAC9C,sBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAQ,GAAI,QAAA;AAElD,IAAA,uBACE,GAAA;AAAA,MAACA,cAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAA,CAAQ,IAAA;AAAA,QACnB,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACH,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA,CAAA,WAAA,KAAe;AAEd,UAAA,MAAM,mBACJ,OAAO,QAAA,KAAa,UAAA,GAAa,QAAA,CAAS,WAAW,CAAA,GAAI,QAAA;AAE3D,UAAA,4BACG,MAAA,EAAA,EAAK,SAAA,EAAW,OAAA,CAAQ,OAAA,EAAS,aAAU,SAAA,EACzC,QAAA,EAAA;AAAA,YAAA,SAAA;AAAA,YACA,gBAAA;AAAA,YACA;AAAA,WAAA,EACH,CAAA;AAAA,QAEJ;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, utilities;\n\n@layer components {\n .ToggleButton_bui-
|
|
4
|
-
var styles = {"bui-ToggleButton":"ToggleButton_bui-
|
|
3
|
+
var css_248z = "/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@layer tokens, base, components, theme, utilities;\n\n@layer components {\n .ToggleButton_bui-ToggleButton__c31d0a8bc5 {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--bui-space-1_5);\n border: none;\n border-radius: var(--bui-radius-2);\n background: var(--bui-bg-neutral-1);\n color: var(--bui-fg-primary);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-bold);\n line-height: 1.15;\n padding: 0 var(--bui-space-2);\n cursor: pointer;\n transition: background-color 150ms ease, box-shadow 150ms ease,\n color 150ms ease, transform 100ms ease;\n\n &[data-selected],\n &[data-pressed] {\n background: var(--bui-bg-solid);\n color: var(--bui-fg-solid);\n }\n\n &:not([data-selected])[data-hovered] {\n background: var(--bui-bg-neutral-2);\n }\n\n &[data-disabled] {\n background: var(--bui-bg-neutral-1-disabled);\n color: var(--bui-fg-disabled);\n }\n\n &[data-disabled][data-hovered] {\n background: var(--bui-bg-neutral-1-disabled);\n }\n\n &[data-disabled][data-selected] {\n background: var(--bui-bg-solid-disabled);\n color: var(--bui-fg-disabled);\n }\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-focus-visible] {\n outline: none;\n box-shadow: inset 0 0 0 2px var(--bui-ring);\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-disabled] {\n cursor: not-allowed;\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-pressed] {\n transform: scale(0.98);\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-disabled][data-pressed] {\n transform: none;\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-size='small'] {\n height: 2rem;\n font-size: var(--bui-font-size-3);\n padding: 0 var(--bui-space-2);\n\n svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .ToggleButton_bui-ToggleButton__c31d0a8bc5[data-size='medium'] {\n height: 2.5rem;\n font-size: var(--bui-font-size-4);\n padding: 0 var(--bui-space-3);\n\n svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n }\n\n .ToggleButton_bui-ToggleButtonContent__c31d0a8bc5 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--bui-space-1_5);\n height: 100%;\n width: 100%;\n }\n}\n";
|
|
4
|
+
var styles = {"bui-ToggleButton":"ToggleButton_bui-ToggleButton__c31d0a8bc5","bui-ToggleButtonContent":"ToggleButton_bui-ToggleButtonContent__c31d0a8bc5"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { styles as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleButton.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonOwnProps } from './types';\nimport styles from './ToggleButton.module.css';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = defineComponent<ToggleButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,sBAAA,GAAyB,iBAAsC,CAAE;AAAA,EAC5E,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC
|
|
1
|
+
{"version":3,"file":"definition.esm.js","sources":["../../../src/components/ToggleButton/definition.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { defineComponent } from '../../hooks/useDefinition';\nimport type { ToggleButtonOwnProps } from './types';\nimport styles from './ToggleButton.module.css';\n\n/**\n * Component definition for ToggleButton\n * @public\n */\nexport const ToggleButtonDefinition = defineComponent<ToggleButtonOwnProps>()({\n styles,\n classNames: {\n root: 'bui-ToggleButton',\n content: 'bui-ToggleButtonContent',\n },\n propDefs: {\n size: { dataAttribute: true, default: 'small' },\n iconStart: {},\n iconEnd: {},\n children: {},\n className: {},\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBO,MAAM,sBAAA,GAAyB,iBAAsC,CAAE;AAAA,EAC5E,MAAA;AAAA,EACA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,kBAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,EAAE,aAAA,EAAe,IAAA,EAAM,SAAS,OAAA,EAAQ;AAAA,IAC9C,WAAW,EAAC;AAAA,IACZ,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,WAAW;AAAC;AAEhB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButtonGroup.esm.js","sources":["../../../src/components/ToggleButtonGroup/ToggleButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref } from 'react';\nimport { ToggleButtonGroup as AriaToggleButtonGroup } from 'react-aria-components';\nimport type { ToggleButtonGroupProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonGroupDefinition } from './definition';\n\n/**\n * A container that groups ToggleButton items and manages their collective selection state.\n *\n * @public\n */\nexport const ToggleButtonGroup = forwardRef(\n (props: ToggleButtonGroupProps, ref: Ref<HTMLDivElement>) => {\n const { ownProps, restProps } = useDefinition(\n ToggleButtonGroupDefinition,\n props,\n );\n const { classes, children } = ownProps;\n\n return (\n <AriaToggleButtonGroup className={classes.root} ref={ref} {...restProps}>\n {children}\n </AriaToggleButtonGroup>\n );\n },\n);\n\nToggleButtonGroup.displayName = 'ToggleButtonGroup';\n"],"names":["AriaToggleButtonGroup"],"mappings":";;;;;;AA2BO,MAAM,iBAAA,GAAoB,UAAA;AAAA,EAC/B,CAAC,OAA+B,GAAA,KAA6B;AAC3D,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA;AAAA,MAC9B,2BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,QAAA;AAE9B,IAAA,uBACE,GAAA,CAACA,uBAAsB,SAAA,EAAW,OAAA,CAAQ,MAAM,GAAA,EAAW,GAAG,WAC3D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;AAEA,iBAAA,CAAkB,WAAA,GAAc,mBAAA
|
|
1
|
+
{"version":3,"file":"ToggleButtonGroup.esm.js","sources":["../../../src/components/ToggleButtonGroup/ToggleButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { forwardRef, Ref } from 'react';\nimport { ToggleButtonGroup as AriaToggleButtonGroup } from 'react-aria-components';\nimport type { ToggleButtonGroupProps } from './types';\nimport { useDefinition } from '../../hooks/useDefinition';\nimport { ToggleButtonGroupDefinition } from './definition';\n\n/**\n * A container that groups ToggleButton items and manages their collective selection state.\n *\n * @public\n */\nexport const ToggleButtonGroup = forwardRef(\n (props: ToggleButtonGroupProps, ref: Ref<HTMLDivElement>) => {\n const { ownProps, restProps } = useDefinition(\n ToggleButtonGroupDefinition,\n props,\n );\n const { classes, children } = ownProps;\n\n return (\n <AriaToggleButtonGroup className={classes.root} ref={ref} {...restProps}>\n {children}\n </AriaToggleButtonGroup>\n );\n },\n);\n\nToggleButtonGroup.displayName = 'ToggleButtonGroup';\n"],"names":["AriaToggleButtonGroup"],"mappings":";;;;;;AA2BO,MAAM,iBAAA,GAAoB,UAAA;AAAA,EAC/B,CAAC,OAA+B,GAAA,KAA6B;AAC3D,IAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,aAAA;AAAA,MAC9B,2BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,QAAA;AAE9B,IAAA,uBACE,GAAA,CAACA,uBAAsB,SAAA,EAAW,OAAA,CAAQ,MAAM,GAAA,EAAW,GAAG,WAC3D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;AAEA,iBAAA,CAAkB,WAAA,GAAc,mBAAA;;"}
|