@backstage/ui 0.9.0-next.1 → 0.9.0-next.3
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 +95 -0
- package/css/styles.css +8 -0
- package/dist/components/Accordion/Accordion.esm.js +109 -0
- package/dist/components/Accordion/Accordion.esm.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.esm.js +8 -0
- package/dist/components/Accordion/Accordion.module.css.esm.js.map +1 -0
- package/dist/components/Avatar/Avatar.esm.js +39 -23
- package/dist/components/Avatar/Avatar.esm.js.map +1 -1
- package/dist/components/Avatar/Avatar.module.css.esm.js +1 -1
- package/dist/components/Button/Button.esm.js +28 -9
- package/dist/components/Button/Button.esm.js.map +1 -1
- package/dist/components/Button/Button.module.css.esm.js +2 -2
- package/dist/components/ButtonIcon/ButtonIcon.esm.js +35 -4
- package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -1
- package/dist/components/ButtonLink/ButtonLink.esm.js +18 -30
- package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -1
- package/dist/components/Dialog/Dialog.module.css.esm.js +1 -1
- package/dist/components/Header/HeaderToolbar.esm.js +3 -5
- package/dist/components/Header/HeaderToolbar.esm.js.map +1 -1
- package/dist/components/Link/Link.esm.js +11 -39
- package/dist/components/Link/Link.esm.js.map +1 -1
- package/dist/components/Link/Link.module.css.esm.js +3 -3
- package/dist/components/Menu/Menu.module.css.esm.js +1 -1
- package/dist/components/Popover/Popover.module.css.esm.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.module.css.esm.js +1 -1
- package/dist/components/SearchField/SearchField.esm.js +17 -33
- package/dist/components/SearchField/SearchField.esm.js.map +1 -1
- package/dist/components/SearchField/SearchField.module.css.esm.js +3 -3
- package/dist/components/Select/Select.esm.js +17 -53
- 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/SelectContent.esm.js +55 -0
- package/dist/components/Select/SelectContent.esm.js.map +1 -0
- package/dist/components/Select/SelectListBox.esm.js +54 -0
- package/dist/components/Select/SelectListBox.esm.js.map +1 -0
- package/dist/components/Select/SelectTrigger.esm.js +23 -0
- package/dist/components/Select/SelectTrigger.esm.js.map +1 -0
- package/dist/components/Table/Table.module.css.esm.js +2 -2
- package/dist/components/Table/components/CellProfile.esm.js +2 -34
- package/dist/components/Table/components/CellProfile.esm.js.map +1 -1
- package/dist/components/Table/components/Row.esm.js +2 -0
- package/dist/components/Table/components/Row.esm.js.map +1 -1
- package/dist/components/Text/Text.esm.js +3 -3
- package/dist/components/Text/Text.esm.js.map +1 -1
- package/dist/components/Text/Text.module.css.esm.js +2 -2
- package/dist/components/TextField/TextField.esm.js +5 -5
- package/dist/components/TextField/TextField.esm.js.map +1 -1
- package/dist/components/TextField/TextField.module.css.esm.js +2 -2
- package/dist/index.d.ts +124 -35
- package/dist/index.esm.js +1 -1
- package/dist/utils/componentDefinitions.esm.js +38 -15
- package/dist/utils/componentDefinitions.esm.js.map +1 -1
- package/package.json +2 -3
- package/dist/components/Collapsible/Collapsible.esm.js +0 -55
- package/dist/components/Collapsible/Collapsible.esm.js.map +0 -1
- package/dist/components/Collapsible/Collapsible.module.css.esm.js +0 -8
- package/dist/components/Collapsible/Collapsible.module.css.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.esm.js","sources":["../../../src/components/ButtonLink/ButtonLink.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Link as RALink, RouterProvider } from 'react-aria-components';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport type { ButtonLinkProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport stylesButton from '../Button/Button.module.css';\n\n/** @public */\nexport const ButtonLink = forwardRef(\n (props: ButtonLinkProps, ref: Ref<HTMLAnchorElement>) => {\n const navigate = useNavigate();\n\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { classNames: classNamesButtonLink } = useStyles('ButtonLink');\n\n const { children, className, iconStart, iconEnd, href, ...rest } =\n cleanedProps;\n\n const isExternal = isExternalLink(href);\n\n
|
|
1
|
+
{"version":3,"file":"ButtonLink.esm.js","sources":["../../../src/components/ButtonLink/ButtonLink.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 clsx from 'clsx';\nimport { forwardRef, Ref } from 'react';\nimport { Link as RALink, RouterProvider } from 'react-aria-components';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport type { ButtonLinkProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport stylesButton from '../Button/Button.module.css';\n\n/** @public */\nexport const ButtonLink = forwardRef(\n (props: ButtonLinkProps, ref: Ref<HTMLAnchorElement>) => {\n const navigate = useNavigate();\n\n const { classNames, dataAttributes, cleanedProps } = useStyles('Button', {\n size: 'small',\n variant: 'primary',\n ...props,\n });\n\n const { classNames: classNamesButtonLink } = useStyles('ButtonLink');\n\n const { children, className, iconStart, iconEnd, href, ...rest } =\n cleanedProps;\n\n const isExternal = isExternalLink(href);\n\n const linkButton = (\n <RALink\n className={clsx(\n classNames.root,\n classNamesButtonLink.root,\n stylesButton[classNames.root],\n className,\n )}\n ref={ref}\n {...dataAttributes}\n href={href}\n {...rest}\n >\n <span\n className={clsx(classNames.content, stylesButton[classNames.content])}\n >\n {iconStart}\n {children}\n {iconEnd}\n </span>\n </RALink>\n );\n\n // If it's an external link, render RALink without RouterProvider\n if (isExternal) {\n return linkButton;\n }\n\n // For internal links, use RouterProvider\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n {linkButton}\n </RouterProvider>\n );\n },\n);\n\nButtonLink.displayName = 'ButtonLink';\n"],"names":["RALink"],"mappings":";;;;;;;;;AA0BO,MAAM,UAAA,GAAa,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAA,KAAgC;AACvD,IAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,QAAA,EAAU;AAAA,MACvE,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,SAAA;AAAA,MACT,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,EAAE,UAAA,EAAY,oBAAA,EAAqB,GAAI,UAAU,YAAY,CAAA;AAEnE,IAAA,MAAM,EAAE,UAAU,SAAA,EAAW,SAAA,EAAW,SAAS,IAAA,EAAM,GAAG,MAAK,GAC7D,YAAA;AAEF,IAAA,MAAM,UAAA,GAAa,eAAe,IAAI,CAAA;AAEtC,IAAA,MAAM,UAAA,mBACJ,GAAA;AAAA,MAACA,IAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,UAAA,CAAW,IAAA;AAAA,UACX,oBAAA,CAAqB,IAAA;AAAA,UACrB,YAAA,CAAa,WAAW,IAAI,CAAA;AAAA,UAC5B;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG,cAAA;AAAA,QACJ,IAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEJ,QAAA,kBAAA,IAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,WAAW,IAAA,CAAK,UAAA,CAAW,SAAS,YAAA,CAAa,UAAA,CAAW,OAAO,CAAC,CAAA;AAAA,YAEnE,QAAA,EAAA;AAAA,cAAA,SAAA;AAAA,cACA,QAAA;AAAA,cACA;AAAA;AAAA;AAAA;AACH;AAAA,KACF;AAIF,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,OAAO,UAAA;AAAA,IACT;AAGA,IAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EAAe,QAAA,EAAoB,OAAA,EACjC,QAAA,EAAA,UAAA,EACH,CAAA;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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 .Dialog-module_bui-DialogOverlay__5nqD5 {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background:
|
|
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 .Dialog-module_bui-DialogOverlay__5nqD5 {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: color-mix(in srgb, var(--bui-gray-2) 80%, transparent);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n }\n\n [data-theme='dark'] .Dialog-module_bui-Dialog__Cnu24 {\n background: rgba(0, 0, 0, 0.5);\n }\n\n .Dialog-module_bui-DialogOverlay__5nqD5[data-entering] {\n animation: Dialog-module_fade-in__17nJR 200ms ease-out forwards;\n }\n\n .Dialog-module_bui-DialogOverlay__5nqD5[data-exiting] {\n animation: Dialog-module_fade-out__jMAaZ 150ms ease-out forwards;\n }\n\n .Dialog-module_bui-Dialog__Cnu24 {\n background: var(--bui-bg-surface-1);\n border-radius: 0.5rem;\n border: 1px solid var(--bui-border);\n color: var(--bui-fg-primary);\n position: relative;\n width: min(var(--bui-dialog-min-width, 400px), calc(100vw - 3rem));\n max-width: calc(100vw - 3rem);\n height: min(var(--bui-dialog-min-height, auto), calc(100vh - 3rem));\n max-height: calc(100vh - 3rem);\n display: flex;\n flex-direction: column;\n outline: none;\n }\n\n /* Dialog entering animation */\n .Dialog-module_bui-DialogOverlay__5nqD5[data-entering] .Dialog-module_bui-Dialog__Cnu24 {\n animation: Dialog-module_dialog-enter__3NC2w 150ms ease-out forwards;\n }\n\n /* Dialog exiting animation */\n .Dialog-module_bui-DialogOverlay__5nqD5[data-exiting] .Dialog-module_bui-Dialog__Cnu24 {\n animation: Dialog-module_dialog-exit__21RUM 150ms ease-out forwards;\n }\n\n .Dialog-module_bui-DialogHeader__D340y {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-inline: var(--bui-space-3);\n padding-block: var(--bui-space-2);\n border-bottom: 1px solid var(--bui-border);\n }\n\n .Dialog-module_bui-DialogHeaderTitle__1UEkF {\n font-size: var(--bui-font-size-3);\n font-weight: var(--bui-font-weight-bold);\n margin: 0;\n }\n\n .Dialog-module_bui-DialogFooter__k2SK8 {\n display: flex;\n align-items: center;\n justify-content: end;\n gap: var(--bui-space-2);\n padding-inline: var(--bui-space-3);\n padding-block: var(--bui-space-3);\n border-top: 1px solid var(--bui-border);\n }\n\n .Dialog-module_bui-DialogBody__2olLx {\n padding: var(--bui-space-3);\n flex: 1;\n overflow-y: auto;\n }\n\n /* Keyframe animations */\n @keyframes Dialog-module_fade-in__17nJR {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes Dialog-module_fade-out__jMAaZ {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n\n @keyframes Dialog-module_dialog-enter__3NC2w {\n from {\n opacity: 0.5;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes Dialog-module_dialog-exit__21RUM {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.95);\n }\n }\n}\n";
|
|
4
4
|
var styles = {"bui-DialogOverlay":"Dialog-module_bui-DialogOverlay__5nqD5","bui-Dialog":"Dialog-module_bui-Dialog__Cnu24","fade-in":"Dialog-module_fade-in__17nJR","fade-out":"Dialog-module_fade-out__jMAaZ","dialog-enter":"Dialog-module_dialog-enter__3NC2w","dialog-exit":"Dialog-module_dialog-exit__21RUM","bui-DialogHeader":"Dialog-module_bui-DialogHeader__D340y","bui-DialogHeaderTitle":"Dialog-module_bui-DialogHeaderTitle__1UEkF","bui-DialogFooter":"Dialog-module_bui-DialogFooter__k2SK8","bui-DialogBody":"Dialog-module_bui-DialogBody__2olLx"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Link } from 'react-aria-components';
|
|
3
3
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
4
4
|
import { useRef } from 'react';
|
|
5
5
|
import { RiShapesLine } from '@remixicon/react';
|
|
6
6
|
import { Text } from '../Text/Text.esm.js';
|
|
7
|
-
import { useNavigate, useHref } from 'react-router-dom';
|
|
8
7
|
import styles from './Header.module.css.esm.js';
|
|
9
8
|
import clsx from 'clsx';
|
|
10
9
|
|
|
11
10
|
const HeaderToolbar = (props) => {
|
|
12
11
|
const { classNames, cleanedProps } = useStyles("Header", props);
|
|
13
12
|
const { className, icon, title, titleLink, customActions, hasTabs } = cleanedProps;
|
|
14
|
-
let navigate = useNavigate();
|
|
15
13
|
const toolbarWrapperRef = useRef(null);
|
|
16
14
|
const toolbarContentRef = useRef(null);
|
|
17
15
|
const toolbarControlsRef = useRef(null);
|
|
@@ -25,7 +23,7 @@ const HeaderToolbar = (props) => {
|
|
|
25
23
|
),
|
|
26
24
|
/* @__PURE__ */ jsx(Text, { variant: "body-medium", children: title || "Your plugin" })
|
|
27
25
|
] });
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
29
27
|
"div",
|
|
30
28
|
{
|
|
31
29
|
className: clsx(
|
|
@@ -88,7 +86,7 @@ const HeaderToolbar = (props) => {
|
|
|
88
86
|
}
|
|
89
87
|
)
|
|
90
88
|
}
|
|
91
|
-
)
|
|
89
|
+
);
|
|
92
90
|
};
|
|
93
91
|
|
|
94
92
|
export { HeaderToolbar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderToolbar.esm.js","sources":["../../../src/components/Header/HeaderToolbar.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 { Link
|
|
1
|
+
{"version":3,"file":"HeaderToolbar.esm.js","sources":["../../../src/components/Header/HeaderToolbar.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 { Link } from 'react-aria-components';\nimport { useStyles } from '../../hooks/useStyles';\nimport { useRef } from 'react';\nimport { RiShapesLine } from '@remixicon/react';\nimport type { HeaderToolbarProps } from './types';\nimport { Text } from '../Text';\nimport styles from './Header.module.css';\nimport clsx from 'clsx';\n\n/**\n * A component that renders a toolbar.\n *\n * @internal\n */\nexport const HeaderToolbar = (props: HeaderToolbarProps) => {\n const { classNames, cleanedProps } = useStyles('Header', props);\n const { className, icon, title, titleLink, customActions, hasTabs } =\n cleanedProps;\n\n // Refs for collision detection\n const toolbarWrapperRef = useRef<HTMLDivElement>(null);\n const toolbarContentRef = useRef<HTMLDivElement>(null);\n const toolbarControlsRef = useRef<HTMLDivElement>(null);\n\n const titleContent = (\n <>\n <div\n className={clsx(classNames.toolbarIcon, styles[classNames.toolbarIcon])}\n >\n {icon || <RiShapesLine />}\n </div>\n <Text variant=\"body-medium\">{title || 'Your plugin'}</Text>\n </>\n );\n\n return (\n <div\n className={clsx(\n classNames.toolbar,\n styles[classNames.toolbar],\n className,\n )}\n data-has-tabs={hasTabs}\n >\n <div\n className={clsx(\n classNames.toolbarWrapper,\n styles[classNames.toolbarWrapper],\n )}\n ref={toolbarWrapperRef}\n >\n <div\n className={clsx(\n classNames.toolbarContent,\n styles[classNames.toolbarContent],\n )}\n ref={toolbarContentRef}\n >\n <Text as=\"h1\" variant=\"body-medium\">\n {titleLink ? (\n <Link\n className={clsx(\n classNames.toolbarName,\n styles[classNames.toolbarName],\n )}\n href={titleLink}\n >\n {titleContent}\n </Link>\n ) : (\n <div\n className={clsx(\n classNames.toolbarName,\n styles[classNames.toolbarName],\n )}\n >\n {titleContent}\n </div>\n )}\n </Text>\n </div>\n <div\n className={clsx(\n classNames.toolbarControls,\n styles[classNames.toolbarControls],\n )}\n ref={toolbarControlsRef}\n >\n {customActions}\n </div>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA8BO,MAAM,aAAA,GAAgB,CAAC,KAAA,KAA8B;AAC1D,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,SAAA,CAAU,UAAU,KAAK,CAAA;AAC9D,EAAA,MAAM,EAAE,SAAA,EAAW,IAAA,EAAM,OAAO,SAAA,EAAW,aAAA,EAAe,SAAQ,GAChE,YAAA;AAGF,EAAA,MAAM,iBAAA,GAAoB,OAAuB,IAAI,CAAA;AACrD,EAAA,MAAM,iBAAA,GAAoB,OAAuB,IAAI,CAAA;AACrD,EAAA,MAAM,kBAAA,GAAqB,OAAuB,IAAI,CAAA;AAEtD,EAAA,MAAM,+BACJ,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,IAAA,CAAK,UAAA,CAAW,aAAa,MAAA,CAAO,UAAA,CAAW,WAAW,CAAC,CAAA;AAAA,QAErE,QAAA,EAAA,IAAA,wBAAS,YAAA,EAAA,EAAa;AAAA;AAAA,KACzB;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,aAAA,EAAe,mBAAS,aAAA,EAAc;AAAA,GAAA,EACtD,CAAA;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,IAAA;AAAA,QACT,UAAA,CAAW,OAAA;AAAA,QACX,MAAA,CAAO,WAAW,OAAO,CAAA;AAAA,QACzB;AAAA,OACF;AAAA,MACA,eAAA,EAAe,OAAA;AAAA,MAEf,QAAA,kBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAW,IAAA;AAAA,YACT,UAAA,CAAW,cAAA;AAAA,YACX,MAAA,CAAO,WAAW,cAAc;AAAA,WAClC;AAAA,UACA,GAAA,EAAK,iBAAA;AAAA,UAEL,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAW,IAAA;AAAA,kBACT,UAAA,CAAW,cAAA;AAAA,kBACX,MAAA,CAAO,WAAW,cAAc;AAAA,iBAClC;AAAA,gBACA,GAAA,EAAK,iBAAA;AAAA,gBAEL,8BAAC,IAAA,EAAA,EAAK,EAAA,EAAG,IAAA,EAAK,OAAA,EAAQ,eACnB,QAAA,EAAA,SAAA,mBACC,GAAA;AAAA,kBAAC,IAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,WAAA;AAAA,sBACX,MAAA,CAAO,WAAW,WAAW;AAAA,qBAC/B;AAAA,oBACA,IAAA,EAAM,SAAA;AAAA,oBAEL,QAAA,EAAA;AAAA;AAAA,iBACH,mBAEA,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,WAAA;AAAA,sBACX,MAAA,CAAO,WAAW,WAAW;AAAA,qBAC/B;AAAA,oBAEC,QAAA,EAAA;AAAA;AAAA,iBACH,EAEJ;AAAA;AAAA,aACF;AAAA,4BACA,GAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAW,IAAA;AAAA,kBACT,UAAA,CAAW,eAAA;AAAA,kBACX,MAAA,CAAO,WAAW,eAAe;AAAA,iBACnC;AAAA,gBACA,GAAA,EAAK,kBAAA;AAAA,gBAEJ,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -5,60 +5,32 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
6
6
|
import { useNavigate, useHref } from 'react-router-dom';
|
|
7
7
|
import { isExternalLink } from '../../utils/isExternalLink.esm.js';
|
|
8
|
-
import
|
|
9
|
-
import stylesText from '../Text/Text.module.css.esm.js';
|
|
8
|
+
import styles from './Link.module.css.esm.js';
|
|
10
9
|
|
|
11
10
|
const Link = forwardRef((props, ref) => {
|
|
12
11
|
const navigate = useNavigate();
|
|
13
|
-
const { classNames
|
|
14
|
-
const {
|
|
15
|
-
classNames: classNamesText,
|
|
16
|
-
dataAttributes: textDataAttributes,
|
|
17
|
-
cleanedProps
|
|
18
|
-
} = useStyles("Text", {
|
|
12
|
+
const { classNames, dataAttributes, cleanedProps } = useStyles("Link", {
|
|
19
13
|
variant: "body",
|
|
20
14
|
weight: "regular",
|
|
21
15
|
color: "primary",
|
|
22
16
|
...props
|
|
23
17
|
});
|
|
24
|
-
const { className,
|
|
18
|
+
const { className, href, ...restProps } = cleanedProps;
|
|
25
19
|
const isExternal = isExternalLink(href);
|
|
26
|
-
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
28
|
-
Link$1,
|
|
29
|
-
{
|
|
30
|
-
ref,
|
|
31
|
-
className: clsx(
|
|
32
|
-
classNamesText.root,
|
|
33
|
-
classNamesLink.root,
|
|
34
|
-
stylesText[classNamesText.root],
|
|
35
|
-
stylesLink[classNamesLink.root],
|
|
36
|
-
className
|
|
37
|
-
),
|
|
38
|
-
"data-truncate": truncate,
|
|
39
|
-
href,
|
|
40
|
-
...textDataAttributes,
|
|
41
|
-
...restProps
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: /* @__PURE__ */ jsx(
|
|
20
|
+
const component = /* @__PURE__ */ jsx(
|
|
46
21
|
Link$1,
|
|
47
22
|
{
|
|
48
23
|
ref,
|
|
49
|
-
className: clsx(
|
|
50
|
-
classNamesText.root,
|
|
51
|
-
classNamesLink.root,
|
|
52
|
-
stylesText[classNamesText.root],
|
|
53
|
-
stylesLink[classNamesLink.root],
|
|
54
|
-
className
|
|
55
|
-
),
|
|
56
|
-
"data-truncate": truncate,
|
|
57
|
-
...textDataAttributes,
|
|
24
|
+
className: clsx(classNames.root, styles[classNames.root], className),
|
|
58
25
|
href,
|
|
26
|
+
...dataAttributes,
|
|
59
27
|
...restProps
|
|
60
28
|
}
|
|
61
|
-
)
|
|
29
|
+
);
|
|
30
|
+
if (isExternal) {
|
|
31
|
+
return component;
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children: component });
|
|
62
34
|
});
|
|
63
35
|
Link.displayName = "Link";
|
|
64
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.esm.js","sources":["../../../src/components/Link/Link.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 { Link as AriaLink, RouterProvider } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport type { LinkProps } from './types';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport
|
|
1
|
+
{"version":3,"file":"Link.esm.js","sources":["../../../src/components/Link/Link.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 { Link as AriaLink, RouterProvider } from 'react-aria-components';\nimport clsx from 'clsx';\nimport { useStyles } from '../../hooks/useStyles';\nimport type { LinkProps } from './types';\nimport { useNavigate, useHref } from 'react-router-dom';\nimport { isExternalLink } from '../../utils/isExternalLink';\nimport styles from './Link.module.css';\n\n/** @public */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {\n const navigate = useNavigate();\n const { classNames, dataAttributes, cleanedProps } = useStyles('Link', {\n variant: 'body',\n weight: 'regular',\n color: 'primary',\n ...props,\n });\n\n const { className, href, ...restProps } = cleanedProps;\n\n const isExternal = isExternalLink(href);\n\n const component = (\n <AriaLink\n ref={ref}\n className={clsx(classNames.root, styles[classNames.root], className)}\n href={href}\n {...dataAttributes}\n {...restProps}\n />\n );\n\n // If it's an external link, render AriaLink without RouterProvider\n if (isExternal) {\n return component;\n }\n\n // For internal links, use RouterProvider\n return (\n <RouterProvider navigate={navigate} useHref={useHref}>\n {component}\n </RouterProvider>\n );\n});\n\nLink.displayName = 'Link';\n"],"names":["AriaLink"],"mappings":";;;;;;;;;AA0BO,MAAM,IAAA,GAAO,UAAA,CAAyC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC3E,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAU,MAAA,EAAQ;AAAA,IACrE,OAAA,EAAS,MAAA;AAAA,IACT,MAAA,EAAQ,SAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,GAAG;AAAA,GACJ,CAAA;AAED,EAAA,MAAM,EAAE,SAAA,EAAW,IAAA,EAAM,GAAG,WAAU,GAAI,YAAA;AAE1C,EAAA,MAAM,UAAA,GAAa,eAAe,IAAI,CAAA;AAEtC,EAAA,MAAM,SAAA,mBACJ,GAAA;AAAA,IAACA,MAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,MACnE,IAAA;AAAA,MACC,GAAG,cAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAIF,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,OAAO,SAAA;AAAA,EACT;AAGA,EAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EAAe,QAAA,EAAoB,OAAA,EACjC,QAAA,EAAA,SAAA,EACH,CAAA;AAEJ,CAAC;AAED,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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 .Link-module_bui-Link__3bbuU {\n font-family: var(--bui-font-regular);\n padding: 0;\n margin: 0;\n cursor: pointer;\n text-decoration-line: none;\n display: inline-block;\n\n &:hover {\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-thickness: min(2px, max(1px, 0.05em));\n text-underline-offset: calc(0.025em + 2px);\n text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);\n }\n }\n}\n";
|
|
4
|
-
var
|
|
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 .Link-module_bui-Link__3bbuU {\n font-family: var(--bui-font-regular);\n padding: 0;\n margin: 0;\n cursor: pointer;\n text-decoration-line: none;\n display: inline-block;\n\n &:hover {\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-thickness: min(2px, max(1px, 0.05em));\n text-underline-offset: calc(0.025em + 2px);\n text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);\n }\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='title-large'] {\n font-size: var(--bui-font-size-8);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='title-medium'] {\n font-size: var(--bui-font-size-7);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='title-small'] {\n font-size: var(--bui-font-size-6);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='title-x-small'] {\n font-size: var(--bui-font-size-5);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='body-large'] {\n font-size: var(--bui-font-size-4);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='body-medium'] {\n font-size: var(--bui-font-size-3);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='body-small'] {\n font-size: var(--bui-font-size-2);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-variant='body-x-small'] {\n font-size: var(--bui-font-size-1);\n line-height: 140%;\n }\n\n .Link-module_bui-Link__3bbuU[data-weight='regular'] {\n font-weight: var(--bui-font-weight-regular);\n }\n\n .Link-module_bui-Link__3bbuU[data-weight='bold'] {\n font-weight: var(--bui-font-weight-bold);\n }\n\n .Link-module_bui-Link__3bbuU[data-color='primary'] {\n color: var(--bui-fg-primary);\n }\n\n .Link-module_bui-Link__3bbuU[data-color='secondary'] {\n color: var(--bui-fg-secondary);\n }\n\n .Link-module_bui-Link__3bbuU[data-color='danger'] {\n color: var(--bui-fg-danger);\n }\n\n .Link-module_bui-Link__3bbuU[data-color='warning'] {\n color: var(--bui-fg-warning);\n }\n\n .Link-module_bui-Link__3bbuU[data-color='success'] {\n color: var(--bui-fg-success);\n }\n\n .Link-module_bui-Link__3bbuU[data-truncate] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n}\n";
|
|
4
|
+
var styles = {"bui-Link":"Link-module_bui-Link__3bbuU"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { styles as default };
|
|
8
8
|
//# sourceMappingURL=Link.module.css.esm.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
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 .Menu-module_bui-MenuPopover__2_pRD {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--bui-border);\n border-radius: var(--bui-radius-2);\n background: var(--bui-bg-surface-1);\n color: var(--bui-fg-primary);\n outline: none;\n transition: transform 200ms, opacity 200ms;\n /* Let React Aria handle height constraints naturally */\n min-height: 0;\n /* Remove overflow from popover since ScrollArea will handle it */\n overflow: hidden;\n\n &[data-entering],\n &[data-exiting] {\n transform: var(--origin);\n opacity: 0;\n }\n\n &[data-placement='top'] {\n --origin: translateY(8px);\n }\n\n &[data-placement='bottom'] {\n --origin: translateY(-8px);\n }\n\n &[data-placement='right'] {\n --origin: translateX(-8px);\n }\n\n &[data-placement='left'] {\n --origin: translateX(8px);\n }\n }\n\n .Menu-module_bui-MenuContent__3DAPp {\n max-height: inherit;\n box-sizing: border-box;\n overflow: auto;\n min-width: 150px;\n box-sizing: border-box;\n outline: none;\n padding-block: var(--bui-space-1);\n }\n\n .Menu-module_bui-MenuItem__2UbNh {\n padding-inline: var(--bui-space-1);\n display: block;\n\n &[data-focused] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-open] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-color='danger'] .Menu-module_bui-MenuItemWrapper__3SEGE {\n color: var(--bui-fg-danger);\n }\n\n &[data-color='danger'][data-focused] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-danger);\n color: var(--bui-fg-danger);\n }\n\n &[data-has-submenu] {\n & > .Menu-module_bui-MenuItemWrapper__3SEGE > .Menu-module_bui-MenuItemArrow__2Gdal {\n display: block;\n }\n }\n }\n\n .Menu-module_bui-MenuItemWrapper__3SEGE {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 2rem;\n padding-inline: var(--bui-space-2);\n border-radius: var(--bui-radius-2);\n outline: none;\n cursor: default;\n color: var(--bui-fg-primary);\n font-size: var(--bui-font-size-3);\n gap: var(--bui-space-6);\n }\n\n .Menu-module_bui-MenuItemListBox__3OVkY {\n padding-inline: var(--bui-space-1);\n display: block;\n\n &:hover .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-selected] .Menu-module_bui-MenuItemListBoxCheck__3flwX {\n & > svg {\n opacity: 1;\n color: var(--bui-fg-primary);\n }\n }\n }\n\n .Menu-module_bui-MenuItemListBoxCheck__3flwX {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n\n & > svg {\n opacity: 0;\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuItemContent__2jc-_ {\n display: flex;\n align-items: center;\n gap: var(--bui-space-2);\n\n & > svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuItemArrow__2Gdal {\n display: none;\n width: 1rem;\n height: 1rem;\n\n & > svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuSection__3OeyZ {\n &:first-child .Menu-module_bui-MenuSectionHeader__yFmfK {\n padding-top: 0;\n }\n }\n\n .Menu-module_bui-MenuSectionHeader__yFmfK {\n height: 2rem;\n display: flex;\n align-items: center;\n padding-top: var(--bui-space-3);\n padding-left: var(--bui-space-3);\n color: var(--bui-fg-primary);\n font-size: var(--bui-font-size-1);\n font-weight: bold;\n letter-spacing: 0.05rem;\n text-transform: uppercase;\n }\n\n .Menu-module_bui-MenuSeparator__-EtU8 {\n height: 1px;\n background: var(--bui-border);\n margin-inline: var(--bui-space-1_5);\n margin-block: var(--bui-space-1);\n }\n\n .Menu-module_bui-MenuSearchField__1sNMj {\n
|
|
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 .Menu-module_bui-MenuPopover__2_pRD {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--bui-border);\n border-radius: var(--bui-radius-2);\n background: var(--bui-bg-surface-1);\n color: var(--bui-fg-primary);\n outline: none;\n transition: transform 200ms, opacity 200ms;\n /* Let React Aria handle height constraints naturally */\n min-height: 0;\n /* Remove overflow from popover since ScrollArea will handle it */\n overflow: hidden;\n\n &[data-entering],\n &[data-exiting] {\n transform: var(--origin);\n opacity: 0;\n }\n\n &[data-placement='top'] {\n --origin: translateY(8px);\n }\n\n &[data-placement='bottom'] {\n --origin: translateY(-8px);\n }\n\n &[data-placement='right'] {\n --origin: translateX(-8px);\n }\n\n &[data-placement='left'] {\n --origin: translateX(8px);\n }\n }\n\n .Menu-module_bui-MenuContent__3DAPp {\n max-height: inherit;\n box-sizing: border-box;\n overflow: auto;\n min-width: 150px;\n box-sizing: border-box;\n outline: none;\n padding-block: var(--bui-space-1);\n }\n\n .Menu-module_bui-MenuItem__2UbNh {\n padding-inline: var(--bui-space-1);\n display: block;\n\n &[data-focused] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-open] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-color='danger'] .Menu-module_bui-MenuItemWrapper__3SEGE {\n color: var(--bui-fg-danger);\n }\n\n &[data-color='danger'][data-focused] .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-danger);\n color: var(--bui-fg-danger);\n }\n\n &[data-has-submenu] {\n & > .Menu-module_bui-MenuItemWrapper__3SEGE > .Menu-module_bui-MenuItemArrow__2Gdal {\n display: block;\n }\n }\n }\n\n .Menu-module_bui-MenuItemWrapper__3SEGE {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 2rem;\n padding-inline: var(--bui-space-2);\n border-radius: var(--bui-radius-2);\n outline: none;\n cursor: default;\n color: var(--bui-fg-primary);\n font-size: var(--bui-font-size-3);\n gap: var(--bui-space-6);\n }\n\n .Menu-module_bui-MenuItemListBox__3OVkY {\n padding-inline: var(--bui-space-1);\n display: block;\n\n &:hover .Menu-module_bui-MenuItemWrapper__3SEGE {\n background: var(--bui-bg-surface-2);\n color: var(--bui-fg-primary);\n }\n\n &[data-selected] .Menu-module_bui-MenuItemListBoxCheck__3flwX {\n & > svg {\n opacity: 1;\n color: var(--bui-fg-primary);\n }\n }\n }\n\n .Menu-module_bui-MenuItemListBoxCheck__3flwX {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n\n & > svg {\n opacity: 0;\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuItemContent__2jc-_ {\n display: flex;\n align-items: center;\n gap: var(--bui-space-2);\n\n & > svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuItemArrow__2Gdal {\n display: none;\n width: 1rem;\n height: 1rem;\n\n & > svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuSection__3OeyZ {\n &:first-child .Menu-module_bui-MenuSectionHeader__yFmfK {\n padding-top: 0;\n }\n }\n\n .Menu-module_bui-MenuSectionHeader__yFmfK {\n height: 2rem;\n display: flex;\n align-items: center;\n padding-top: var(--bui-space-3);\n padding-left: var(--bui-space-3);\n color: var(--bui-fg-primary);\n font-size: var(--bui-font-size-1);\n font-weight: bold;\n letter-spacing: 0.05rem;\n text-transform: uppercase;\n }\n\n .Menu-module_bui-MenuSeparator__-EtU8 {\n height: 1px;\n background: var(--bui-border);\n margin-inline: var(--bui-space-1_5);\n margin-block: var(--bui-space-1);\n }\n\n .Menu-module_bui-MenuSearchField__1sNMj {\n font-family: var(--bui-font-regular);\n width: 100%;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n border-bottom: 1px solid var(--bui-border);\n background-color: var(--bui-bg-surface-1);\n height: 2rem;\n\n &[data-empty] {\n .Menu-module_bui-MenuSearchFieldClear__3bwIe {\n visibility: hidden;\n }\n }\n }\n\n .Menu-module_bui-MenuSearchFieldInput__2jPs5 {\n flex: 1;\n display: flex;\n align-items: center;\n padding: 0;\n border: none;\n background-color: transparent;\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n color: var(--bui-fg-primary);\n width: 100%;\n height: 100%;\n outline: none;\n cursor: inherit;\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 &:first-child {\n padding-inline: var(--bui-space-3) 0;\n }\n }\n\n .Menu-module_bui-MenuSearchFieldClear__3bwIe {\n flex: 0 0 auto;\n display: grid;\n place-content: center;\n background-color: transparent;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n color: var(--bui-fg-secondary);\n transition: color 0.2s ease-in-out;\n width: 2rem;\n height: 2rem;\n\n &:hover {\n color: var(--bui-fg-primary);\n }\n\n & > svg {\n width: 1rem;\n height: 1rem;\n }\n }\n\n .Menu-module_bui-MenuEmptyState__wPwuq {\n padding-inline: var(--bui-space-3);\n padding-block: var(--bui-space-2);\n color: var(--bui-fg-secondary);\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n }\n}\n";
|
|
4
4
|
var styles = {"bui-MenuPopover":"Menu-module_bui-MenuPopover__2_pRD","bui-MenuContent":"Menu-module_bui-MenuContent__3DAPp","bui-MenuItem":"Menu-module_bui-MenuItem__2UbNh","bui-MenuItemWrapper":"Menu-module_bui-MenuItemWrapper__3SEGE","bui-MenuItemArrow":"Menu-module_bui-MenuItemArrow__2Gdal","bui-MenuItemListBox":"Menu-module_bui-MenuItemListBox__3OVkY","bui-MenuItemListBoxCheck":"Menu-module_bui-MenuItemListBoxCheck__3flwX","bui-MenuItemContent":"Menu-module_bui-MenuItemContent__2jc-_","bui-MenuSection":"Menu-module_bui-MenuSection__3OeyZ","bui-MenuSectionHeader":"Menu-module_bui-MenuSectionHeader__yFmfK","bui-MenuSeparator":"Menu-module_bui-MenuSeparator__-EtU8","bui-MenuSearchField":"Menu-module_bui-MenuSearchField__1sNMj","bui-MenuSearchFieldClear":"Menu-module_bui-MenuSearchFieldClear__3bwIe","bui-MenuSearchFieldInput":"Menu-module_bui-MenuSearchFieldInput__2jPs5","bui-MenuEmptyState":"Menu-module_bui-MenuEmptyState__wPwuq"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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 .Popover-module_bui-Popover__100-n {\n margin-right: 12px;\n overflow:
|
|
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 .Popover-module_bui-Popover__100-n {\n margin-right: 12px;\n overflow-x: hidden;\n overflow-y: auto;\n background-color: var(--bui-bg-surface-1);\n border: 1px solid var(--bui-border);\n border-radius: var(--bui-radius-3);\n padding-block: var(--bui-space-1);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n }\n}\n";
|
|
4
4
|
var stylesPopover = {"bui-Popover":"Popover-module_bui-Popover__100-n"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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 .RadioGroup-module_bui-RadioGroup__v70Qu {\n display: flex;\n flex-direction: column;\n color: var(--bui-fg-primary);\n }\n\n .RadioGroup-module_bui-RadioGroup__v70Qu[data-orientation='horizontal'] .RadioGroup-module_bui-RadioGroupContent__1rG0a {\n flex-direction: row;\n gap: var(--bui-space-4);\n }\n\n .RadioGroup-module_bui-RadioGroupContent__1rG0a {\n display: flex;\n flex-direction: column;\n gap: var(--bui-space-2);\n }\n\n .RadioGroup-module_bui-Radio__1769d {\n display: flex;\n /* This is needed so the HiddenInput is positioned correctly */\n position: relative;\n align-items: center;\n gap: var(--bui-space-2);\n font-size: var(--bui-font-size-2);\n color: var(--bui-fg-primary);\n forced-color-adjust: none;\n\n &:before {\n content: '';\n display: block;\n width: 1rem;\n height: 1rem;\n box-sizing: border-box;\n border: 0.125rem solid var(--bui-border);\n background: var(--bui-gray-1);\n border-radius: var(--bui-radius-full);\n transition: all 200ms;\n }\n\n &[data-pressed]:before {\n border-color: var(--bui-border);\n }\n\n &[data-selected] {\n &:before {\n border-color: var(--bui-bg-solid);\n border-width: 0.25rem;\n }\n\n &[data-pressed]:before {\n border-color: var(--bui-bg-solid);\n }\n }\n\n &[data-focus-visible]:before {\n outline: 2px solid var(--bui-ring);\n outline-offset: 2px;\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: var(--bui-fg-disabled);\n\n &:before {\n border-color: var(--bui-border-disabled);\n background: var(--bui-bg-disabled);\n }\n\n &[data-selected]:before {\n border-color: var(--bui-border-disabled);\n }\n }\n\n &[data-invalid]:before {\n border-color: var(--bui-border-danger);\n }\n\n &[data-invalid][data-selected]:before {\n border-color: var(--bui-border-danger);\n }\n\n /* Ensure disabled state prevails over invalid state */\n &[data-disabled][data-invalid] {\n color: var(--bui-fg-disabled);\n\n &:before {\n border-color: var(--bui-border-disabled);\n background: var(--bui-bg-disabled);\n }\n\n &[data-selected]:before {\n border-color: var(--bui-border-disabled);\n }\n }\n }\n}\n";
|
|
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 .RadioGroup-module_bui-RadioGroup__v70Qu {\n display: flex;\n flex-direction: column;\n color: var(--bui-fg-primary);\n }\n\n .RadioGroup-module_bui-RadioGroup__v70Qu[data-orientation='horizontal'] .RadioGroup-module_bui-RadioGroupContent__1rG0a {\n flex-direction: row;\n gap: var(--bui-space-4);\n }\n\n .RadioGroup-module_bui-RadioGroupContent__1rG0a {\n display: flex;\n flex-direction: column;\n gap: var(--bui-space-2);\n }\n\n .RadioGroup-module_bui-Radio__1769d {\n display: flex;\n /* This is needed so the HiddenInput is positioned correctly */\n position: relative;\n align-items: center;\n gap: var(--bui-space-2);\n font-size: var(--bui-font-size-2);\n color: var(--bui-fg-primary);\n forced-color-adjust: none;\n\n &:before {\n content: '';\n display: block;\n width: 1rem;\n height: 1rem;\n box-sizing: border-box;\n border: 0.125rem solid var(--bui-border);\n background: var(--bui-gray-1);\n border-radius: var(--bui-radius-full);\n transition: all 200ms;\n flex-shrink: 0;\n flex-grow: 0;\n }\n\n &[data-pressed]:before {\n border-color: var(--bui-border);\n }\n\n &[data-selected] {\n &:before {\n border-color: var(--bui-bg-solid);\n border-width: 0.25rem;\n }\n\n &[data-pressed]:before {\n border-color: var(--bui-bg-solid);\n }\n }\n\n &[data-focus-visible]:before {\n outline: 2px solid var(--bui-ring);\n outline-offset: 2px;\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: var(--bui-fg-disabled);\n\n &:before {\n border-color: var(--bui-border-disabled);\n background: var(--bui-bg-disabled);\n }\n\n &[data-selected]:before {\n border-color: var(--bui-border-disabled);\n }\n }\n\n &[data-invalid]:before {\n border-color: var(--bui-border-danger);\n }\n\n &[data-invalid][data-selected]:before {\n border-color: var(--bui-border-danger);\n }\n\n /* Ensure disabled state prevails over invalid state */\n &[data-disabled][data-invalid] {\n color: var(--bui-fg-disabled);\n\n &:before {\n border-color: var(--bui-border-disabled);\n background: var(--bui-bg-disabled);\n }\n\n &[data-selected]:before {\n border-color: var(--bui-border-disabled);\n }\n }\n }\n}\n";
|
|
4
4
|
var styles = {"bui-RadioGroup":"RadioGroup-module_bui-RadioGroup__v70Qu","bui-RadioGroupContent":"RadioGroup-module_bui-RadioGroupContent__1rG0a","bui-Radio":"RadioGroup-module_bui-Radio__1769d"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -6,8 +6,7 @@ import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
|
|
|
6
6
|
import { FieldError } from '../FieldError/FieldError.esm.js';
|
|
7
7
|
import { RiSearch2Line, RiCloseCircleLine } from '@remixicon/react';
|
|
8
8
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
9
|
-
import
|
|
10
|
-
import stylesTextField from '../TextField/TextField.module.css.esm.js';
|
|
9
|
+
import styles from './SearchField.module.css.esm.js';
|
|
11
10
|
|
|
12
11
|
const SearchField = forwardRef(
|
|
13
12
|
(props, ref) => {
|
|
@@ -25,18 +24,15 @@ const SearchField = forwardRef(
|
|
|
25
24
|
);
|
|
26
25
|
}
|
|
27
26
|
}, [label, ariaLabel, ariaLabelledBy]);
|
|
28
|
-
const { classNames
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
startCollapsed: false,
|
|
38
|
-
...props
|
|
39
|
-
});
|
|
27
|
+
const { classNames, dataAttributes, style, cleanedProps } = useStyles(
|
|
28
|
+
"SearchField",
|
|
29
|
+
{
|
|
30
|
+
size: "small",
|
|
31
|
+
placeholder: "Search",
|
|
32
|
+
startCollapsed: false,
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
);
|
|
40
36
|
const {
|
|
41
37
|
className,
|
|
42
38
|
description,
|
|
@@ -69,13 +65,7 @@ const SearchField = forwardRef(
|
|
|
69
65
|
return /* @__PURE__ */ jsxs(
|
|
70
66
|
SearchField$1,
|
|
71
67
|
{
|
|
72
|
-
className: clsx(
|
|
73
|
-
textFieldClassNames.root,
|
|
74
|
-
searchFieldClassNames.root,
|
|
75
|
-
stylesTextField[textFieldClassNames.root],
|
|
76
|
-
stylesSearchField[searchFieldClassNames.root],
|
|
77
|
-
className
|
|
78
|
-
),
|
|
68
|
+
className: clsx(classNames.root, styles[classNames.root], className),
|
|
79
69
|
...dataAttributes,
|
|
80
70
|
"aria-label": ariaLabel,
|
|
81
71
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -98,8 +88,8 @@ const SearchField = forwardRef(
|
|
|
98
88
|
"div",
|
|
99
89
|
{
|
|
100
90
|
className: clsx(
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
classNames.inputWrapper,
|
|
92
|
+
styles[classNames.inputWrapper]
|
|
103
93
|
),
|
|
104
94
|
"data-size": dataAttributes["data-size"],
|
|
105
95
|
children: [
|
|
@@ -107,8 +97,8 @@ const SearchField = forwardRef(
|
|
|
107
97
|
"div",
|
|
108
98
|
{
|
|
109
99
|
className: clsx(
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
classNames.inputIcon,
|
|
101
|
+
styles[classNames.inputIcon]
|
|
112
102
|
),
|
|
113
103
|
"data-size": dataAttributes["data-size"],
|
|
114
104
|
"aria-hidden": "true",
|
|
@@ -118,10 +108,7 @@ const SearchField = forwardRef(
|
|
|
118
108
|
/* @__PURE__ */ jsx(
|
|
119
109
|
Input,
|
|
120
110
|
{
|
|
121
|
-
className: clsx(
|
|
122
|
-
textFieldClassNames.input,
|
|
123
|
-
stylesTextField[textFieldClassNames.input]
|
|
124
|
-
),
|
|
111
|
+
className: clsx(classNames.input, styles[classNames.input]),
|
|
125
112
|
...icon !== false && { "data-icon": true },
|
|
126
113
|
placeholder
|
|
127
114
|
}
|
|
@@ -129,10 +116,7 @@ const SearchField = forwardRef(
|
|
|
129
116
|
/* @__PURE__ */ jsx(
|
|
130
117
|
Button,
|
|
131
118
|
{
|
|
132
|
-
className: clsx(
|
|
133
|
-
searchFieldClassNames.clear,
|
|
134
|
-
stylesSearchField[searchFieldClassNames.clear]
|
|
135
|
-
),
|
|
119
|
+
className: clsx(classNames.clear, styles[classNames.clear]),
|
|
136
120
|
"data-size": dataAttributes["data-size"],
|
|
137
121
|
children: /* @__PURE__ */ jsx(RiCloseCircleLine, {})
|
|
138
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.esm.js","sources":["../../../src/components/SearchField/SearchField.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, useState } from 'react';\nimport {\n Input,\n SearchField as AriaSearchField,\n Button,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport { RiSearch2Line, RiCloseCircleLine } from '@remixicon/react';\nimport { useStyles } from '../../hooks/useStyles';\nimport
|
|
1
|
+
{"version":3,"file":"SearchField.esm.js","sources":["../../../src/components/SearchField/SearchField.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, useState } from 'react';\nimport {\n Input,\n SearchField as AriaSearchField,\n Button,\n} from 'react-aria-components';\nimport clsx from 'clsx';\nimport { FieldLabel } from '../FieldLabel';\nimport { FieldError } from '../FieldError';\nimport { RiSearch2Line, RiCloseCircleLine } from '@remixicon/react';\nimport { useStyles } from '../../hooks/useStyles';\nimport styles from './SearchField.module.css';\n\nimport type { SearchFieldProps } from './types';\n\n/** @public */\nexport const SearchField = forwardRef<HTMLDivElement, SearchFieldProps>(\n (props, ref) => {\n const {\n label,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n } = props;\n\n const [isCollapsed, setIsCollapsed] = useState(false);\n const [shouldCollapse, setShouldCollapse] = useState(true);\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'SearchField requires either a visible label, aria-label, or aria-labelledby for accessibility',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const { classNames, dataAttributes, style, cleanedProps } = useStyles(\n 'SearchField',\n {\n size: 'small',\n placeholder: 'Search',\n startCollapsed: false,\n ...props,\n },\n );\n\n const {\n className,\n description,\n icon,\n isRequired,\n secondaryLabel,\n placeholder,\n startCollapsed,\n ...rest\n } = cleanedProps;\n\n // If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.\n const secondaryLabelText =\n secondaryLabel || (isRequired ? 'Required' : null);\n\n const handleClick = (isFocused: boolean) => {\n props.onFocusChange?.(isFocused);\n if (shouldCollapse) {\n if (isFocused) {\n setIsCollapsed(true);\n } else {\n setIsCollapsed(false);\n }\n }\n };\n\n const handleChange = (value: string) => {\n props.onChange?.(value);\n if (value.length > 0) {\n setShouldCollapse(false);\n } else {\n setShouldCollapse(true);\n }\n };\n\n return (\n <AriaSearchField\n className={clsx(classNames.root, styles[classNames.root], className)}\n {...dataAttributes}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n data-collapsed={isCollapsed}\n onFocusChange={handleClick}\n onChange={handleChange}\n style={style}\n {...rest}\n ref={ref}\n >\n <FieldLabel\n label={label}\n secondaryLabel={secondaryLabelText}\n description={description}\n />\n <div\n className={clsx(\n classNames.inputWrapper,\n styles[classNames.inputWrapper],\n )}\n data-size={dataAttributes['data-size']}\n >\n {icon !== false && (\n <div\n className={clsx(\n classNames.inputIcon,\n styles[classNames.inputIcon],\n )}\n data-size={dataAttributes['data-size']}\n aria-hidden=\"true\"\n >\n {icon || <RiSearch2Line />}\n </div>\n )}\n <Input\n className={clsx(classNames.input, styles[classNames.input])}\n {...(icon !== false && { 'data-icon': true })}\n placeholder={placeholder}\n />\n <Button\n className={clsx(classNames.clear, styles[classNames.clear])}\n data-size={dataAttributes['data-size']}\n >\n <RiCloseCircleLine />\n </Button>\n </div>\n <FieldError />\n </AriaSearchField>\n );\n },\n);\n\nSearchField.displayName = 'searchField';\n"],"names":["AriaSearchField"],"mappings":";;;;;;;;;;AAgCO,MAAM,WAAA,GAAc,UAAA;AAAA,EACzB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM;AAAA,MACJ,KAAA;AAAA,MACA,YAAA,EAAc,SAAA;AAAA,MACd,iBAAA,EAAmB;AAAA,KACrB,GAAI,KAAA;AAEJ,IAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA;AACpD,IAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAS,IAAI,CAAA;AAEzD,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,KAAA,IAAS,CAAC,SAAA,IAAa,CAAC,cAAA,EAAgB;AAC3C,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN;AAAA,SACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAA,EAAW,cAAc,CAAC,CAAA;AAErC,IAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAgB,KAAA,EAAO,cAAa,GAAI,SAAA;AAAA,MAC1D,aAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,WAAA,EAAa,QAAA;AAAA,QACb,cAAA,EAAgB,KAAA;AAAA,QAChB,GAAG;AAAA;AACL,KACF;AAEA,IAAA,MAAM;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,GAAG;AAAA,KACL,GAAI,YAAA;AAGJ,IAAA,MAAM,kBAAA,GACJ,cAAA,KAAmB,UAAA,GAAa,UAAA,GAAa,IAAA,CAAA;AAE/C,IAAA,MAAM,WAAA,GAAc,CAAC,SAAA,KAAuB;AAC1C,MAAA,KAAA,CAAM,gBAAgB,SAAS,CAAA;AAC/B,MAAA,IAAI,cAAA,EAAgB;AAClB,QAAA,IAAI,SAAA,EAAW;AACb,UAAA,cAAA,CAAe,IAAI,CAAA;AAAA,QACrB,CAAA,MAAO;AACL,UAAA,cAAA,CAAe,KAAK,CAAA;AAAA,QACtB;AAAA,MACF;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAkB;AACtC,MAAA,KAAA,CAAM,WAAW,KAAK,CAAA;AACtB,MAAA,IAAI,KAAA,CAAM,SAAS,CAAA,EAAG;AACpB,QAAA,iBAAA,CAAkB,KAAK,CAAA;AAAA,MACzB,CAAA,MAAO;AACL,QAAA,iBAAA,CAAkB,IAAI,CAAA;AAAA,MACxB;AAAA,IACF,CAAA;AAEA,IAAA,uBACE,IAAA;AAAA,MAACA,aAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,KAAK,UAAA,CAAW,IAAA,EAAM,OAAO,UAAA,CAAW,IAAI,GAAG,SAAS,CAAA;AAAA,QAClE,GAAG,cAAA;AAAA,QACJ,YAAA,EAAY,SAAA;AAAA,QACZ,iBAAA,EAAiB,cAAA;AAAA,QACjB,gBAAA,EAAgB,WAAA;AAAA,QAChB,aAAA,EAAe,WAAA;AAAA,QACf,QAAA,EAAU,YAAA;AAAA,QACV,KAAA;AAAA,QACC,GAAG,IAAA;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;AAAA;AAAA,WACF;AAAA,0BACA,IAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,IAAA;AAAA,gBACT,UAAA,CAAW,YAAA;AAAA,gBACX,MAAA,CAAO,WAAW,YAAY;AAAA,eAChC;AAAA,cACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,cAEpC,QAAA,EAAA;AAAA,gBAAA,IAAA,KAAS,KAAA,oBACR,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,SAAA,EAAW,IAAA;AAAA,sBACT,UAAA,CAAW,SAAA;AAAA,sBACX,MAAA,CAAO,WAAW,SAAS;AAAA,qBAC7B;AAAA,oBACA,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBACrC,aAAA,EAAY,MAAA;AAAA,oBAEX,QAAA,EAAA,IAAA,wBAAS,aAAA,EAAA,EAAc;AAAA;AAAA,iBAC1B;AAAA,gCAEF,GAAA;AAAA,kBAAC,KAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,oBACzD,GAAI,IAAA,KAAS,KAAA,IAAS,EAAE,aAAa,IAAA,EAAK;AAAA,oBAC3C;AAAA;AAAA,iBACF;AAAA,gCACA,GAAA;AAAA,kBAAC,MAAA;AAAA,kBAAA;AAAA,oBACC,WAAW,IAAA,CAAK,UAAA,CAAW,OAAO,MAAA,CAAO,UAAA,CAAW,KAAK,CAAC,CAAA;AAAA,oBAC1D,WAAA,EAAW,eAAe,WAAW,CAAA;AAAA,oBAErC,8BAAC,iBAAA,EAAA,EAAkB;AAAA;AAAA;AACrB;AAAA;AAAA,WACF;AAAA,8BACC,UAAA,EAAA,EAAW;AAAA;AAAA;AAAA,KACd;AAAA,EAEJ;AACF;AAEA,WAAA,CAAY,WAAA,GAAc,aAAA;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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 .SearchField-module_bui-SearchField__2TyT_ {\n flex: 1;\n flex-shrink: 0;\n\n &[data-empty] {\n .SearchField-module_bui-
|
|
4
|
-
var
|
|
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 .SearchField-module_bui-SearchField__2TyT_ {\n display: flex;\n flex-direction: column;\n font-family: var(--bui-font-regular);\n width: 100%;\n flex: 1;\n flex-shrink: 0;\n\n &[data-size='small'] {\n --search-field-item-height: 2rem;\n }\n\n &[data-size='medium'] {\n --search-field-item-height: 2.5rem;\n }\n\n &[data-empty] {\n .SearchField-module_bui-SearchFieldClear__1gJQc {\n display: none;\n }\n }\n\n &[data-startCollapsed='true'] {\n transition: flex-basis 0.3s ease-in-out;\n padding: 0;\n flex: 0 1 auto;\n\n &[data-collapsed='true'] {\n flex-basis: 200px;\n }\n\n &[data-collapsed='false'] {\n cursor: pointer;\n\n &[data-size='medium'] {\n flex-basis: 2.5rem;\n height: 2.5rem;\n }\n\n &[data-size='small'] {\n flex-basis: 2rem;\n height: 2rem;\n }\n\n &[data-size='medium'] .SearchField-module_bui-SearchFieldInput__3Opoj {\n &::placeholder {\n opacity: 0;\n }\n }\n\n &[data-size='small'] .SearchField-module_bui-SearchFieldInput__3Opoj {\n &::placeholder {\n opacity: 0;\n }\n }\n\n .SearchField-module_bui-SearchFieldInputWrapper__1JEG8 {\n .SearchField-module_bui-SearchFieldInput__3Opoj[data-icon] {\n padding-right: 0px;\n }\n }\n }\n }\n }\n\n .SearchField-module_bui-SearchFieldInputWrapper__1JEG8 {\n display: flex;\n align-items: center;\n border-radius: var(--bui-radius-2);\n border: 1px solid var(--bui-border);\n background-color: var(--bui-bg-surface-1);\n transition: border-color 0.2s ease-in-out, outline-color 0.2s ease-in-out;\n\n &[data-size='small'] {\n height: 2rem;\n }\n\n &[data-size='medium'] {\n height: 2.5rem;\n }\n\n &:focus-within {\n border-color: var(--bui-border-pressed);\n outline-width: 0px;\n }\n\n &:hover {\n border-color: var(--bui-border-hover);\n }\n\n &[data-invalid] {\n border-color: var(--bui-fg-danger);\n }\n\n &[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n border: 1px solid var(--bui-border-disabled);\n }\n }\n\n .SearchField-module_bui-SearchFieldInputIcon__EA0t9 {\n flex: 0 0 auto;\n display: grid;\n place-content: center;\n color: var(--bui-fg-primary);\n pointer-events: none;\n width: var(--search-field-item-height);\n height: var(--search-field-item-height);\n /* To animate the icon when the input is collapsed */\n transition: opacity 0.2s ease-in-out;\n\n & svg {\n .SearchField-module_bui-SearchField__2TyT_[data-size='small'] & {\n width: 1rem;\n height: 1rem;\n }\n\n .SearchField-module_bui-SearchField__2TyT_[data-size='medium'] & {\n width: 1.25rem;\n height: 1.25rem;\n }\n }\n }\n\n .SearchField-module_bui-SearchFieldInput__3Opoj {\n flex: 1;\n display: flex;\n align-items: center;\n padding: 0;\n border: none;\n background-color: transparent;\n font-size: var(--bui-font-size-3);\n font-family: var(--bui-font-regular);\n font-weight: var(--bui-font-weight-regular);\n color: var(--bui-fg-primary);\n transition: padding 0.3s ease-in-out;\n width: 100%;\n height: 100%;\n outline: none;\n cursor: inherit;\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-disabled] {\n cursor: not-allowed;\n }\n\n &:first-child {\n .SearchField-module_bui-SearchField__2TyT_[data-size='small'] & {\n padding-inline: var(--bui-space-3) 0;\n }\n\n .SearchField-module_bui-SearchField__2TyT_[data-size='medium'] & {\n padding-inline: var(--bui-space-3) 0;\n }\n }\n }\n\n .SearchField-module_bui-SearchFieldClear__1gJQc {\n flex: 0 0 auto;\n display: grid;\n place-content: center;\n background-color: transparent;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n color: var(--bui-fg-secondary);\n transition: color 0.2s ease-in-out;\n width: var(--search-field-item-height);\n height: var(--search-field-item-height);\n\n &:hover {\n color: var(--bui-fg-primary);\n }\n\n & svg {\n width: 1rem;\n height: 1rem;\n }\n }\n}\n";
|
|
4
|
+
var styles = {"bui-SearchField":"SearchField-module_bui-SearchField__2TyT_","bui-SearchFieldClear":"SearchField-module_bui-SearchFieldClear__1gJQc","bui-SearchFieldInput":"SearchField-module_bui-SearchFieldInput__3Opoj","bui-SearchFieldInputWrapper":"SearchField-module_bui-SearchFieldInputWrapper__1JEG8","bui-SearchFieldInputIcon":"SearchField-module_bui-SearchFieldInputIcon__EA0t9"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { styles as default };
|
|
8
8
|
//# sourceMappingURL=SearchField.module.css.esm.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, useEffect } from 'react';
|
|
3
|
-
import { Select as Select$1,
|
|
3
|
+
import { Select as Select$1, Popover } from 'react-aria-components';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
6
6
|
import { FieldLabel } from '../FieldLabel/FieldLabel.esm.js';
|
|
7
7
|
import { FieldError } from '../FieldError/FieldError.esm.js';
|
|
8
8
|
import styles from './Select.module.css.esm.js';
|
|
9
9
|
import stylesPopover from '../Popover/Popover.module.css.esm.js';
|
|
10
|
-
import {
|
|
10
|
+
import { SelectTrigger } from './SelectTrigger.esm.js';
|
|
11
|
+
import { SelectContent } from './SelectContent.esm.js';
|
|
11
12
|
|
|
12
13
|
const Select = forwardRef((props, ref) => {
|
|
13
14
|
const { classNames: popoverClassNames } = useStyles("Popover");
|
|
@@ -21,14 +22,13 @@ const Select = forwardRef((props, ref) => {
|
|
|
21
22
|
label,
|
|
22
23
|
description,
|
|
23
24
|
options,
|
|
24
|
-
placeholder,
|
|
25
|
-
size,
|
|
26
25
|
icon,
|
|
26
|
+
searchable,
|
|
27
|
+
searchPlaceholder,
|
|
27
28
|
"aria-label": ariaLabel,
|
|
28
29
|
"aria-labelledby": ariaLabelledBy,
|
|
29
30
|
isRequired,
|
|
30
31
|
secondaryLabel,
|
|
31
|
-
style,
|
|
32
32
|
...rest
|
|
33
33
|
} = cleanedProps;
|
|
34
34
|
useEffect(() => {
|
|
@@ -57,62 +57,26 @@ const Select = forwardRef((props, ref) => {
|
|
|
57
57
|
description
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
Button,
|
|
62
|
-
{
|
|
63
|
-
className: clsx(classNames.trigger, styles[classNames.trigger]),
|
|
64
|
-
"data-size": dataAttributes["data-size"],
|
|
65
|
-
children: [
|
|
66
|
-
icon,
|
|
67
|
-
/* @__PURE__ */ jsx(
|
|
68
|
-
SelectValue,
|
|
69
|
-
{
|
|
70
|
-
className: clsx(classNames.value, styles[classNames.value])
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsx(RiArrowDownSLine, { "aria-hidden": "true" })
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
),
|
|
60
|
+
/* @__PURE__ */ jsx(SelectTrigger, { icon }),
|
|
77
61
|
/* @__PURE__ */ jsx(FieldError, {}),
|
|
78
62
|
/* @__PURE__ */ jsx(
|
|
79
63
|
Popover,
|
|
80
64
|
{
|
|
81
65
|
className: clsx(
|
|
82
66
|
popoverClassNames.root,
|
|
83
|
-
stylesPopover[popoverClassNames.root]
|
|
67
|
+
stylesPopover[popoverClassNames.root],
|
|
68
|
+
classNames.popover,
|
|
69
|
+
styles[classNames.popover]
|
|
84
70
|
),
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
...dataAttributes,
|
|
72
|
+
children: /* @__PURE__ */ jsx(
|
|
73
|
+
SelectContent,
|
|
87
74
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
className: clsx(
|
|
95
|
-
classNames.itemIndicator,
|
|
96
|
-
styles[classNames.itemIndicator]
|
|
97
|
-
),
|
|
98
|
-
children: /* @__PURE__ */ jsx(RiCheckLine, {})
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
-
Text,
|
|
103
|
-
{
|
|
104
|
-
slot: "label",
|
|
105
|
-
className: clsx(
|
|
106
|
-
classNames.itemLabel,
|
|
107
|
-
styles[classNames.itemLabel]
|
|
108
|
-
),
|
|
109
|
-
children: option.label
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
option.value
|
|
115
|
-
)) })
|
|
75
|
+
searchable,
|
|
76
|
+
searchPlaceholder,
|
|
77
|
+
options
|
|
78
|
+
}
|
|
79
|
+
)
|
|
116
80
|
}
|
|
117
81
|
)
|
|
118
82
|
]
|