@backstage/ui 0.0.0-nightly-20250722024836
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 +294 -0
- package/README.md +18 -0
- package/css/styles.css +10823 -0
- package/dist/components/Avatar/Avatar.esm.js +29 -0
- package/dist/components/Avatar/Avatar.esm.js.map +1 -0
- package/dist/components/Box/Box.esm.js +34 -0
- package/dist/components/Box/Box.esm.js.map +1 -0
- package/dist/components/Box/Box.props.esm.js +7 -0
- package/dist/components/Box/Box.props.esm.js.map +1 -0
- package/dist/components/Button/Button.esm.js +41 -0
- package/dist/components/Button/Button.esm.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.esm.js +37 -0
- package/dist/components/ButtonIcon/ButtonIcon.esm.js.map +1 -0
- package/dist/components/ButtonLink/ButtonLink.esm.js +42 -0
- package/dist/components/ButtonLink/ButtonLink.esm.js.map +1 -0
- package/dist/components/Card/Card.esm.js +53 -0
- package/dist/components/Card/Card.esm.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.esm.js +74 -0
- package/dist/components/Checkbox/Checkbox.esm.js.map +1 -0
- package/dist/components/Collapsible/Collapsible.esm.js +50 -0
- package/dist/components/Collapsible/Collapsible.esm.js.map +1 -0
- package/dist/components/Container/Container.esm.js +35 -0
- package/dist/components/Container/Container.esm.js.map +1 -0
- package/dist/components/DataTable/DataTable.esm.js +26 -0
- package/dist/components/DataTable/DataTable.esm.js.map +1 -0
- package/dist/components/DataTable/Pagination/DataTablePagination.esm.js +84 -0
- package/dist/components/DataTable/Pagination/DataTablePagination.esm.js.map +1 -0
- package/dist/components/DataTable/Root/DataTableRoot.esm.js +24 -0
- package/dist/components/DataTable/Root/DataTableRoot.esm.js.map +1 -0
- package/dist/components/DataTable/Table/DataTableTable.esm.js +64 -0
- package/dist/components/DataTable/Table/DataTableTable.esm.js.map +1 -0
- package/dist/components/FieldError/FieldError.esm.js +22 -0
- package/dist/components/FieldError/FieldError.esm.js.map +1 -0
- package/dist/components/FieldLabel/FieldLabel.esm.js +27 -0
- package/dist/components/FieldLabel/FieldLabel.esm.js.map +1 -0
- package/dist/components/Flex/Flex.esm.js +26 -0
- package/dist/components/Flex/Flex.esm.js.map +1 -0
- package/dist/components/Flex/Flex.props.esm.js +31 -0
- package/dist/components/Flex/Flex.props.esm.js.map +1 -0
- package/dist/components/Grid/Grid.esm.js +43 -0
- package/dist/components/Grid/Grid.esm.js.map +1 -0
- package/dist/components/Grid/Grid.props.esm.js +58 -0
- package/dist/components/Grid/Grid.props.esm.js.map +1 -0
- package/dist/components/Header/Header.esm.js +27 -0
- package/dist/components/Header/Header.esm.js.map +1 -0
- package/dist/components/Header/HeaderToolbar.esm.js +121 -0
- package/dist/components/Header/HeaderToolbar.esm.js.map +1 -0
- package/dist/components/HeaderPage/HeaderPage.esm.js +48 -0
- package/dist/components/HeaderPage/HeaderPage.esm.js.map +1 -0
- package/dist/components/Heading/Heading.esm.js +37 -0
- package/dist/components/Heading/Heading.esm.js.map +1 -0
- package/dist/components/Icon/Icon.esm.js +29 -0
- package/dist/components/Icon/Icon.esm.js.map +1 -0
- package/dist/components/Icon/context.esm.js +10 -0
- package/dist/components/Icon/context.esm.js.map +1 -0
- package/dist/components/Icon/icons.esm.js +63 -0
- package/dist/components/Icon/icons.esm.js.map +1 -0
- package/dist/components/Icon/provider.esm.js +12 -0
- package/dist/components/Icon/provider.esm.js.map +1 -0
- package/dist/components/Link/Link.esm.js +63 -0
- package/dist/components/Link/Link.esm.js.map +1 -0
- package/dist/components/Menu/Combobox.esm.js +212 -0
- package/dist/components/Menu/Combobox.esm.js.map +1 -0
- package/dist/components/Menu/Menu.esm.js +224 -0
- package/dist/components/Menu/Menu.esm.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.esm.js +71 -0
- package/dist/components/RadioGroup/RadioGroup.esm.js.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.esm.js +63 -0
- package/dist/components/ScrollArea/ScrollArea.esm.js.map +1 -0
- package/dist/components/SearchField/SearchField.esm.js +107 -0
- package/dist/components/SearchField/SearchField.esm.js.map +1 -0
- package/dist/components/Select/Select.esm.js +89 -0
- package/dist/components/Select/Select.esm.js.map +1 -0
- package/dist/components/Select/Select.styles.css.esm.js +7 -0
- package/dist/components/Select/Select.styles.css.esm.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.esm.js +22 -0
- package/dist/components/Skeleton/Skeleton.esm.js.map +1 -0
- package/dist/components/Switch/Switch.esm.js +18 -0
- package/dist/components/Switch/Switch.esm.js.map +1 -0
- package/dist/components/Table/Table.esm.js +68 -0
- package/dist/components/Table/Table.esm.js.map +1 -0
- package/dist/components/Table/TableCell/TableCell.esm.js +13 -0
- package/dist/components/Table/TableCell/TableCell.esm.js.map +1 -0
- package/dist/components/Table/TableCellLink/TableCellLink.esm.js +28 -0
- package/dist/components/Table/TableCellLink/TableCellLink.esm.js.map +1 -0
- package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js +40 -0
- package/dist/components/Table/TableCellProfile/TableCellProfile.esm.js.map +1 -0
- package/dist/components/Table/TableCellText/TableCellText.esm.js +27 -0
- package/dist/components/Table/TableCellText/TableCellText.esm.js.map +1 -0
- package/dist/components/Tabs/Tabs.esm.js +127 -0
- package/dist/components/Tabs/Tabs.esm.js.map +1 -0
- package/dist/components/Tabs/TabsIndicators.esm.js +140 -0
- package/dist/components/Tabs/TabsIndicators.esm.js.map +1 -0
- package/dist/components/Text/Text.esm.js +39 -0
- package/dist/components/Text/Text.esm.js.map +1 -0
- package/dist/components/TextField/TextField.esm.js +88 -0
- package/dist/components/TextField/TextField.esm.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.esm.js +31 -0
- package/dist/components/Tooltip/Tooltip.esm.js.map +1 -0
- package/dist/hooks/useBreakpoint.esm.js +43 -0
- package/dist/hooks/useBreakpoint.esm.js.map +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.esm.js +6 -0
- package/dist/hooks/useIsomorphicLayoutEffect.esm.js.map +1 -0
- package/dist/hooks/useMediaQuery.esm.js +44 -0
- package/dist/hooks/useMediaQuery.esm.js.map +1 -0
- package/dist/hooks/useStyles.esm.js +46 -0
- package/dist/hooks/useStyles.esm.js.map +1 -0
- package/dist/index.d.ts +1399 -0
- package/dist/index.esm.js +40 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js +29 -0
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -0
- package/dist/props/display.props.esm.js +12 -0
- package/dist/props/display.props.esm.js.map +1 -0
- package/dist/props/gap-props.esm.js +15 -0
- package/dist/props/gap-props.esm.js.map +1 -0
- package/dist/props/height.props.esm.js +23 -0
- package/dist/props/height.props.esm.js.map +1 -0
- package/dist/props/margin.props.esm.js +54 -0
- package/dist/props/margin.props.esm.js.map +1 -0
- package/dist/props/padding.props.esm.js +54 -0
- package/dist/props/padding.props.esm.js.map +1 -0
- package/dist/props/position.props.esm.js +18 -0
- package/dist/props/position.props.esm.js.map +1 -0
- package/dist/props/prop-def.esm.js +4 -0
- package/dist/props/prop-def.esm.js.map +1 -0
- package/dist/props/spacing.props.esm.js +28 -0
- package/dist/props/spacing.props.esm.js.map +1 -0
- package/dist/props/width.props.esm.js +23 -0
- package/dist/props/width.props.esm.js.map +1 -0
- package/dist/utils/componentDefinitions.esm.js +272 -0
- package/dist/utils/componentDefinitions.esm.js.map +1 -0
- package/dist/utils/extractProps.esm.js +49 -0
- package/dist/utils/extractProps.esm.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, forwardRef, useContext } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
const DataTableContext = createContext(
|
|
6
|
+
null
|
|
7
|
+
);
|
|
8
|
+
const DataTableRoot = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const { className, table, ...rest } = props;
|
|
11
|
+
return /* @__PURE__ */ jsx(DataTableContext.Provider, { value: { table }, children: /* @__PURE__ */ jsx("div", { ref, className: clsx("bui-DataTable", className), ...rest }) });
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
DataTableRoot.displayName = "DataTableRoot";
|
|
15
|
+
function useDataTable() {
|
|
16
|
+
const context = useContext(DataTableContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("useDataTable must be used within a DataTableRoot");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { DataTableContext, DataTableRoot, useDataTable };
|
|
24
|
+
//# sourceMappingURL=DataTableRoot.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTableRoot.esm.js","sources":["../../../../src/components/DataTable/Root/DataTableRoot.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, createContext, useContext } from 'react';\nimport clsx from 'clsx';\nimport { DataTableRootProps } from './types';\nimport { Table } from '@tanstack/react-table';\n\ntype DataTableContextType<TData> = {\n table: Table<TData>;\n};\n\n/** @public */\nexport const DataTableContext = createContext<DataTableContextType<any> | null>(\n null,\n);\n\n/** @public */\nconst DataTableRoot = forwardRef(\n <TData,>(\n props: DataTableRootProps<TData>,\n ref: React.ForwardedRef<HTMLDivElement>,\n ) => {\n const { className, table, ...rest } = props;\n\n return (\n <DataTableContext.Provider value={{ table }}>\n <div ref={ref} className={clsx('bui-DataTable', className)} {...rest} />\n </DataTableContext.Provider>\n );\n },\n);\n\nDataTableRoot.displayName = 'DataTableRoot';\n\nexport { DataTableRoot };\n\n/** @public */\nexport function useDataTable<TData>() {\n const context = useContext(DataTableContext);\n if (!context) {\n throw new Error('useDataTable must be used within a DataTableRoot');\n }\n return context as DataTableContextType<TData>;\n}\n"],"names":[],"mappings":";;;;AA0BO,MAAM,gBAAmB,GAAA,aAAA;AAAA,EAC9B;AACF;AAGA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CACE,OACA,GACG,KAAA;AACH,IAAA,MAAM,EAAE,SAAA,EAAW,KAAO,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtC,IAAA,2BACG,gBAAiB,CAAA,QAAA,EAAjB,EAA0B,KAAO,EAAA,EAAE,OAClC,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAU,WAAW,IAAK,CAAA,eAAA,EAAiB,SAAS,CAAI,EAAA,GAAG,MAAM,CACxE,EAAA,CAAA;AAAA;AAGN;AAEA,aAAA,CAAc,WAAc,GAAA,eAAA;AAKrB,SAAS,YAAsB,GAAA;AACpC,EAAM,MAAA,OAAA,GAAU,WAAW,gBAAgB,CAAA;AAC3C,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,kDAAkD,CAAA;AAAA;AAEpE,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Table } from '../../Table/Table.esm.js';
|
|
5
|
+
import { useDataTable } from '../Root/DataTableRoot.esm.js';
|
|
6
|
+
import { flexRender } from '@tanstack/react-table';
|
|
7
|
+
|
|
8
|
+
const DataTableTable = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const { className, ...rest } = props;
|
|
11
|
+
const { table } = useDataTable();
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Table.Root,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
style: { minWidth: table.getTotalSize() },
|
|
17
|
+
className: clsx(className),
|
|
18
|
+
...rest,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Table.Head,
|
|
23
|
+
{
|
|
24
|
+
style: { width: header.getSize() },
|
|
25
|
+
children: header.isPlaceholder ? null : flexRender(
|
|
26
|
+
header.column.columnDef.header,
|
|
27
|
+
header.getContext()
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
header.id
|
|
31
|
+
);
|
|
32
|
+
}) }, headerGroup.id)) }),
|
|
33
|
+
/* @__PURE__ */ jsx(Table.Body, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
|
|
34
|
+
Table.Row,
|
|
35
|
+
{
|
|
36
|
+
"data-state": row.getIsSelected() && "selected",
|
|
37
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
|
|
38
|
+
Table.Cell,
|
|
39
|
+
{
|
|
40
|
+
style: { width: cell.column.getSize() },
|
|
41
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
42
|
+
},
|
|
43
|
+
cell.id
|
|
44
|
+
))
|
|
45
|
+
},
|
|
46
|
+
row.id
|
|
47
|
+
)) : /* @__PURE__ */ jsx(Table.Row, { children: /* @__PURE__ */ jsx(
|
|
48
|
+
Table.Cell,
|
|
49
|
+
{
|
|
50
|
+
colSpan: table.getAllColumns().length,
|
|
51
|
+
className: "h-24 text-center",
|
|
52
|
+
style: { width: table.getTotalSize() },
|
|
53
|
+
children: "No results."
|
|
54
|
+
}
|
|
55
|
+
) }) })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
DataTableTable.displayName = "DataTableRoot";
|
|
62
|
+
|
|
63
|
+
export { DataTableTable };
|
|
64
|
+
//# sourceMappingURL=DataTableTable.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTableTable.esm.js","sources":["../../../../src/components/DataTable/Table/DataTableTable.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 clsx from 'clsx';\nimport { DataTableTableProps } from './types';\nimport { Table } from '../../Table';\nimport { useDataTable } from '../Root/DataTableRoot';\nimport { flexRender } from '@tanstack/react-table';\n\n/** @public */\nconst DataTableTable = forwardRef(\n (props: DataTableTableProps, ref: React.ForwardedRef<HTMLTableElement>) => {\n const { className, ...rest } = props;\n const { table } = useDataTable();\n\n return (\n <Table.Root\n ref={ref}\n style={{ minWidth: table.getTotalSize() }}\n className={clsx(className)}\n {...rest}\n >\n <Table.Header>\n {table.getHeaderGroups().map(headerGroup => (\n <Table.Row key={headerGroup.id}>\n {headerGroup.headers.map(header => {\n return (\n <Table.Head\n key={header.id}\n style={{ width: header.getSize() }}\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n </Table.Head>\n );\n })}\n </Table.Row>\n ))}\n </Table.Header>\n <Table.Body>\n {table.getRowModel().rows?.length ? (\n table.getRowModel().rows.map(row => (\n <Table.Row\n key={row.id}\n data-state={row.getIsSelected() && 'selected'}\n >\n {row.getVisibleCells().map(cell => (\n <Table.Cell\n key={cell.id}\n style={{ width: cell.column.getSize() }}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </Table.Cell>\n ))}\n </Table.Row>\n ))\n ) : (\n <Table.Row>\n <Table.Cell\n colSpan={table.getAllColumns().length}\n className=\"h-24 text-center\"\n style={{ width: table.getTotalSize() }}\n >\n No results.\n </Table.Cell>\n </Table.Row>\n )}\n </Table.Body>\n </Table.Root>\n );\n },\n);\n\nDataTableTable.displayName = 'DataTableRoot';\n\nexport { DataTableTable };\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,cAAiB,GAAA,UAAA;AAAA,EACrB,CAAC,OAA4B,GAA8C,KAAA;AACzE,IAAA,MAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAS,GAAA,KAAA;AAC/B,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,YAAa,EAAA;AAE/B,IACE,uBAAA,IAAA;AAAA,MAAC,KAAM,CAAA,IAAA;AAAA,MAAN;AAAA,QACC,GAAA;AAAA,QACA,KAAO,EAAA,EAAE,QAAU,EAAA,KAAA,CAAM,cAAe,EAAA;AAAA,QACxC,SAAA,EAAW,KAAK,SAAS,CAAA;AAAA,QACxB,GAAG,IAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAM,CAAA,MAAA,EAAN,EACE,QAAA,EAAA,KAAA,CAAM,iBAAkB,CAAA,GAAA,CAAI,CAC3B,WAAA,qBAAA,GAAA,CAAC,MAAM,GAAN,EAAA,EACE,QAAY,EAAA,WAAA,CAAA,OAAA,CAAQ,IAAI,CAAU,MAAA,KAAA;AACjC,YACE,uBAAA,GAAA;AAAA,cAAC,KAAM,CAAA,IAAA;AAAA,cAAN;AAAA,gBAEC,KAAO,EAAA,EAAE,KAAO,EAAA,MAAA,CAAO,SAAU,EAAA;AAAA,gBAEhC,QAAA,EAAA,MAAA,CAAO,gBACJ,IACA,GAAA,UAAA;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,cAAA,CAAe,WAAc,GAAA,eAAA;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { FieldError as FieldError$1 } from 'react-aria-components';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
const FieldError = forwardRef(
|
|
7
|
+
(props, ref) => {
|
|
8
|
+
const { className, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
FieldError$1,
|
|
11
|
+
{
|
|
12
|
+
className: clsx("bui-FieldError", className),
|
|
13
|
+
ref,
|
|
14
|
+
...rest
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
FieldError.displayName = "FieldError";
|
|
20
|
+
|
|
21
|
+
export { FieldError };
|
|
22
|
+
//# sourceMappingURL=FieldError.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldError.esm.js","sources":["../../../src/components/FieldError/FieldError.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 } from 'react';\nimport {\n FieldError as AriaFieldError,\n type FieldErrorProps,\n} from 'react-aria-components';\nimport clsx from 'clsx';\n\n/** @public */\nexport const FieldError = forwardRef<HTMLDivElement, FieldErrorProps>(\n (props: FieldErrorProps, ref) => {\n const { className, ...rest } = props;\n\n return (\n <AriaFieldError\n className={clsx('bui-FieldError', className)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldError.displayName = 'FieldError';\n"],"names":["AriaFieldError"],"mappings":";;;;;AAwBO,MAAM,UAAa,GAAA,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAQ,KAAA;AAC/B,IAAA,MAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAS,GAAA,KAAA;AAE/B,IACE,uBAAA,GAAA;AAAA,MAACA,YAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAK,CAAA,gBAAA,EAAkB,SAAS,CAAA;AAAA,QAC3C,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA;AAGN;AAEA,UAAA,CAAW,WAAc,GAAA,YAAA;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Label } from 'react-aria-components';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
5
|
+
|
|
6
|
+
const FieldLabel = forwardRef(
|
|
7
|
+
(props, ref) => {
|
|
8
|
+
const { label, secondaryLabel, description, htmlFor, id, ...rest } = props;
|
|
9
|
+
const { classNames } = useStyles("FieldLabel");
|
|
10
|
+
if (!label) return null;
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames.root, ...rest, ref, children: [
|
|
12
|
+
label && /* @__PURE__ */ jsxs(Label, { className: classNames.label, htmlFor, id, children: [
|
|
13
|
+
label,
|
|
14
|
+
secondaryLabel && /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: classNames.secondaryLabel, children: [
|
|
15
|
+
"(",
|
|
16
|
+
secondaryLabel,
|
|
17
|
+
")"
|
|
18
|
+
] })
|
|
19
|
+
] }),
|
|
20
|
+
description && /* @__PURE__ */ jsx("div", { className: classNames.description, children: description })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
FieldLabel.displayName = "FieldLabel";
|
|
25
|
+
|
|
26
|
+
export { FieldLabel };
|
|
27
|
+
//# sourceMappingURL=FieldLabel.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldLabel.esm.js","sources":["../../../src/components/FieldLabel/FieldLabel.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 */\nimport { Label } from 'react-aria-components';\nimport { forwardRef } from 'react';\nimport type { FieldLabelProps } from './types';\nimport { useStyles } from '../../hooks/useStyles';\n\n/** @public */\nexport const FieldLabel = forwardRef<HTMLDivElement, FieldLabelProps>(\n (props: FieldLabelProps, ref) => {\n const { label, secondaryLabel, description, htmlFor, id, ...rest } = props;\n\n const { classNames } = useStyles('FieldLabel');\n\n if (!label) return null;\n\n return (\n <div className={classNames.root} {...rest} ref={ref}>\n {label && (\n <Label className={classNames.label} htmlFor={htmlFor} id={id}>\n {label}\n {secondaryLabel && (\n <span aria-hidden=\"true\" className={classNames.secondaryLabel}>\n ({secondaryLabel})\n </span>\n )}\n </Label>\n )}\n {description && (\n <div className={classNames.description}>{description}</div>\n )}\n </div>\n );\n },\n);\n\nFieldLabel.displayName = 'FieldLabel';\n"],"names":[],"mappings":";;;;;AAqBO,MAAM,UAAa,GAAA,UAAA;AAAA,EACxB,CAAC,OAAwB,GAAQ,KAAA;AAC/B,IAAM,MAAA,EAAE,OAAO,cAAgB,EAAA,WAAA,EAAa,SAAS,EAAI,EAAA,GAAG,MAAS,GAAA,KAAA;AAErE,IAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,YAAY,CAAA;AAE7C,IAAI,IAAA,CAAC,OAAc,OAAA,IAAA;AAEnB,IAAA,4BACG,KAAI,EAAA,EAAA,SAAA,EAAW,WAAW,IAAO,EAAA,GAAG,MAAM,GACxC,EAAA,QAAA,EAAA;AAAA,MAAA,KAAA,yBACE,KAAM,EAAA,EAAA,SAAA,EAAW,UAAW,CAAA,KAAA,EAAO,SAAkB,EACnD,EAAA,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,QACA,kCACE,IAAA,CAAA,MAAA,EAAA,EAAK,eAAY,MAAO,EAAA,SAAA,EAAW,WAAW,cAAgB,EAAA,QAAA,EAAA;AAAA,UAAA,GAAA;AAAA,UAC3D,cAAA;AAAA,UAAe;AAAA,SACnB,EAAA;AAAA,OAEJ,EAAA,CAAA;AAAA,MAED,+BACE,GAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,UAAA,CAAW,aAAc,QAAY,EAAA,WAAA,EAAA;AAAA,KAEzD,EAAA,CAAA;AAAA;AAGN;AAEA,UAAA,CAAW,WAAc,GAAA,YAAA;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { forwardRef, createElement } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { flexPropDefs } from './Flex.props.esm.js';
|
|
4
|
+
import { extractProps } from '../../utils/extractProps.esm.js';
|
|
5
|
+
import { gapPropDefs } from '../../props/gap-props.esm.js';
|
|
6
|
+
import { spacingPropDefs } from '../../props/spacing.props.esm.js';
|
|
7
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
8
|
+
|
|
9
|
+
const Flex = forwardRef((props, ref) => {
|
|
10
|
+
const propDefs = {
|
|
11
|
+
...gapPropDefs,
|
|
12
|
+
...flexPropDefs,
|
|
13
|
+
...spacingPropDefs
|
|
14
|
+
};
|
|
15
|
+
const { classNames } = useStyles("Flex");
|
|
16
|
+
const { className, style } = extractProps(props, propDefs);
|
|
17
|
+
return createElement("div", {
|
|
18
|
+
ref,
|
|
19
|
+
className: clsx(classNames.root, className),
|
|
20
|
+
style,
|
|
21
|
+
children: props.children
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export { Flex };
|
|
26
|
+
//# sourceMappingURL=Flex.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.esm.js","sources":["../../../src/components/Flex/Flex.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 { createElement, forwardRef } from 'react';\nimport { FlexProps } from './types';\nimport clsx from 'clsx';\nimport { flexPropDefs } from './Flex.props';\nimport { extractProps } from '../../utils/extractProps';\nimport { gapPropDefs } from '../../props/gap-props';\nimport { spacingPropDefs } from '../../props/spacing.props';\nimport { useStyles } from '../../hooks/useStyles';\n\n/** @public */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>((props, ref) => {\n const propDefs = {\n ...gapPropDefs,\n ...flexPropDefs,\n ...spacingPropDefs,\n };\n\n const { classNames } = useStyles('Flex');\n const { className, style } = extractProps(props, propDefs);\n\n return createElement('div', {\n ref,\n className: clsx(classNames.root, className),\n style,\n children: props.children,\n });\n});\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,IAAO,GAAA,UAAA,CAAsC,CAAC,KAAA,EAAO,GAAQ,KAAA;AACxE,EAAA,MAAM,QAAW,GAAA;AAAA,IACf,GAAG,WAAA;AAAA,IACH,GAAG,YAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,MAAM,CAAA;AACvC,EAAA,MAAM,EAAE,SAAW,EAAA,KAAA,EAAU,GAAA,YAAA,CAAa,OAAO,QAAQ,CAAA;AAEzD,EAAA,OAAO,cAAc,KAAO,EAAA;AAAA,IAC1B,GAAA;AAAA,IACA,SAAW,EAAA,IAAA,CAAK,UAAW,CAAA,IAAA,EAAM,SAAS,CAAA;AAAA,IAC1C,KAAA;AAAA,IACA,UAAU,KAAM,CAAA;AAAA,GACjB,CAAA;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const alignValues = ["start", "center", "end", "baseline", "stretch"];
|
|
2
|
+
const directionValues = [
|
|
3
|
+
"row",
|
|
4
|
+
"column",
|
|
5
|
+
"row-reverse",
|
|
6
|
+
"column-reverse"
|
|
7
|
+
];
|
|
8
|
+
const justifyValues = ["start", "center", "end", "between"];
|
|
9
|
+
const flexPropDefs = {
|
|
10
|
+
align: {
|
|
11
|
+
type: "enum",
|
|
12
|
+
className: "bui-align",
|
|
13
|
+
values: alignValues,
|
|
14
|
+
responsive: true
|
|
15
|
+
},
|
|
16
|
+
direction: {
|
|
17
|
+
type: "enum",
|
|
18
|
+
className: "bui-fd",
|
|
19
|
+
values: directionValues,
|
|
20
|
+
responsive: true
|
|
21
|
+
},
|
|
22
|
+
justify: {
|
|
23
|
+
type: "enum",
|
|
24
|
+
className: "bui-jc",
|
|
25
|
+
values: justifyValues,
|
|
26
|
+
responsive: true
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { flexPropDefs };
|
|
31
|
+
//# sourceMappingURL=Flex.props.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.props.esm.js","sources":["../../../src/components/Flex/Flex.props.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 type { PropDef, GetPropDefTypes } from '../../props/prop-def';\n\nconst alignValues = ['start', 'center', 'end', 'baseline', 'stretch'] as const;\nconst directionValues = [\n 'row',\n 'column',\n 'row-reverse',\n 'column-reverse',\n] as const;\nconst justifyValues = ['start', 'center', 'end', 'between'] as const;\n\n/** @public */\nconst flexPropDefs = {\n align: {\n type: 'enum',\n className: 'bui-align',\n values: alignValues,\n responsive: true,\n },\n direction: {\n type: 'enum',\n className: 'bui-fd',\n values: directionValues,\n responsive: true,\n },\n justify: {\n type: 'enum',\n className: 'bui-jc',\n values: justifyValues,\n responsive: true,\n },\n} satisfies {\n align: PropDef<(typeof alignValues)[number]>;\n direction: PropDef<(typeof directionValues)[number]>;\n justify: PropDef<(typeof justifyValues)[number]>;\n};\n\n/** @public */\ntype FlexOwnProps = GetPropDefTypes<typeof flexPropDefs>;\n\nexport { flexPropDefs };\nexport type { FlexOwnProps };\n"],"names":[],"mappings":"AAkBA,MAAM,cAAc,CAAC,OAAA,EAAS,QAAU,EAAA,KAAA,EAAO,YAAY,SAAS,CAAA;AACpE,MAAM,eAAkB,GAAA;AAAA,EACtB,KAAA;AAAA,EACA,QAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA;AACA,MAAM,aAAgB,GAAA,CAAC,OAAS,EAAA,QAAA,EAAU,OAAO,SAAS,CAAA;AAG1D,MAAM,YAAe,GAAA;AAAA,EACnB,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,SAAW,EAAA,WAAA;AAAA,IACX,MAAQ,EAAA,WAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,IACN,SAAW,EAAA,QAAA;AAAA,IACX,MAAQ,EAAA,eAAA;AAAA,IACR,UAAY,EAAA;AAAA,GACd;AAAA,EACA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,MAAA;AAAA,IACN,SAAW,EAAA,QAAA;AAAA,IACX,MAAQ,EAAA,aAAA;AAAA,IACR,UAAY,EAAA;AAAA;AAEhB;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { forwardRef, createElement } from 'react';
|
|
2
|
+
import { gapPropDefs } from '../../props/gap-props.esm.js';
|
|
3
|
+
import { extractProps } from '../../utils/extractProps.esm.js';
|
|
4
|
+
import { gridPropDefs, gridItemPropDefs } from './Grid.props.esm.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { spacingPropDefs } from '../../props/spacing.props.esm.js';
|
|
7
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
8
|
+
|
|
9
|
+
const GridRoot = forwardRef((props, ref) => {
|
|
10
|
+
const propDefs = {
|
|
11
|
+
...gapPropDefs,
|
|
12
|
+
...gridPropDefs,
|
|
13
|
+
...spacingPropDefs
|
|
14
|
+
};
|
|
15
|
+
const { classNames } = useStyles("Grid");
|
|
16
|
+
const { className, style } = extractProps(props, propDefs);
|
|
17
|
+
return createElement("div", {
|
|
18
|
+
ref,
|
|
19
|
+
className: clsx(classNames.root, className),
|
|
20
|
+
style,
|
|
21
|
+
children: props.children
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
const GridItem = forwardRef((props, ref) => {
|
|
25
|
+
const propDefs = {
|
|
26
|
+
...gridItemPropDefs
|
|
27
|
+
};
|
|
28
|
+
const { classNames } = useStyles("Grid");
|
|
29
|
+
const { className, style } = extractProps(props, propDefs);
|
|
30
|
+
return createElement("div", {
|
|
31
|
+
ref,
|
|
32
|
+
className: clsx(classNames.item, className),
|
|
33
|
+
style,
|
|
34
|
+
children: props.children
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
const Grid = {
|
|
38
|
+
Root: GridRoot,
|
|
39
|
+
Item: GridItem
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Grid };
|
|
43
|
+
//# sourceMappingURL=Grid.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.esm.js","sources":["../../../src/components/Grid/Grid.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 { createElement, forwardRef } from 'react';\nimport { gapPropDefs } from '../../props/gap-props';\nimport { extractProps } from '../../utils/extractProps';\nimport { gridItemPropDefs, gridPropDefs } from './Grid.props';\nimport clsx from 'clsx';\nimport type { GridItemProps, GridProps } from './types';\nimport { spacingPropDefs } from '../../props/spacing.props';\nimport { useStyles } from '../../hooks/useStyles';\n\nconst GridRoot = forwardRef<HTMLDivElement, GridProps>((props, ref) => {\n const propDefs = {\n ...gapPropDefs,\n ...gridPropDefs,\n ...spacingPropDefs,\n };\n\n const { classNames } = useStyles('Grid');\n\n const { className, style } = extractProps(props, propDefs);\n\n return createElement('div', {\n ref,\n className: clsx(classNames.root, className),\n style,\n children: props.children,\n });\n});\n\nconst GridItem = forwardRef<HTMLDivElement, GridItemProps>((props, ref) => {\n const propDefs = {\n ...gridItemPropDefs,\n };\n\n const { classNames } = useStyles('Grid');\n const { className, style } = extractProps(props, propDefs);\n\n return createElement('div', {\n ref,\n className: clsx(classNames.item, className),\n style,\n children: props.children,\n });\n});\n\n/** @public */\nexport const Grid = {\n Root: GridRoot,\n Item: GridItem,\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,QAAW,GAAA,UAAA,CAAsC,CAAC,KAAA,E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
9
|
+
"8",
|
|
10
|
+
"9",
|
|
11
|
+
"10",
|
|
12
|
+
"11",
|
|
13
|
+
"12",
|
|
14
|
+
"auto"
|
|
15
|
+
];
|
|
16
|
+
const gridPropDefs = {
|
|
17
|
+
columns: {
|
|
18
|
+
type: "enum | string",
|
|
19
|
+
className: "bui-columns",
|
|
20
|
+
customProperties: ["--columns"],
|
|
21
|
+
values: columnsValues,
|
|
22
|
+
responsive: true,
|
|
23
|
+
default: "auto"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const gridItemPropDefs = {
|
|
27
|
+
colSpan: {
|
|
28
|
+
type: "enum | string",
|
|
29
|
+
className: "bui-col-span",
|
|
30
|
+
customProperties: ["--col-span"],
|
|
31
|
+
values: columnsValues,
|
|
32
|
+
responsive: true
|
|
33
|
+
},
|
|
34
|
+
colEnd: {
|
|
35
|
+
type: "enum | string",
|
|
36
|
+
className: "bui-col-end",
|
|
37
|
+
customProperties: ["--col-end"],
|
|
38
|
+
values: columnsValues,
|
|
39
|
+
responsive: true
|
|
40
|
+
},
|
|
41
|
+
colStart: {
|
|
42
|
+
type: "enum | string",
|
|
43
|
+
className: "bui-col-start",
|
|
44
|
+
customProperties: ["--col-start"],
|
|
45
|
+
values: columnsValues,
|
|
46
|
+
responsive: true
|
|
47
|
+
},
|
|
48
|
+
rowSpan: {
|
|
49
|
+
type: "enum | string",
|
|
50
|
+
className: "bui-row-span",
|
|
51
|
+
customProperties: ["--row-span"],
|
|
52
|
+
values: columnsValues,
|
|
53
|
+
responsive: true
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { gridItemPropDefs, gridPropDefs };
|
|
58
|
+
//# sourceMappingURL=Grid.props.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.props.esm.js","sources":["../../../src/components/Grid/Grid.props.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 type { PropDef, GetPropDefTypes } from '../../props/prop-def';\n\nconst columnsValues = [\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n '10',\n '11',\n '12',\n 'auto',\n] as const;\n\n/** @public */\nconst gridPropDefs = {\n columns: {\n type: 'enum | string',\n className: 'bui-columns',\n customProperties: ['--columns'],\n values: columnsValues,\n responsive: true,\n default: 'auto',\n },\n} satisfies {\n columns: PropDef<(typeof columnsValues)[number]>;\n};\n\n/** @public */\nconst gridItemPropDefs = {\n colSpan: {\n type: 'enum | string',\n className: 'bui-col-span',\n customProperties: ['--col-span'],\n values: columnsValues,\n responsive: true,\n },\n colEnd: {\n type: 'enum | string',\n className: 'bui-col-end',\n customProperties: ['--col-end'],\n values: columnsValues,\n responsive: true,\n },\n colStart: {\n type: 'enum | string',\n className: 'bui-col-start',\n customProperties: ['--col-start'],\n values: columnsValues,\n responsive: true,\n },\n rowSpan: {\n type: 'enum | string',\n className: 'bui-row-span',\n customProperties: ['--row-span'],\n values: columnsValues,\n responsive: true,\n },\n} satisfies {\n colSpan: PropDef<(typeof columnsValues)[number]>;\n colEnd: PropDef<(typeof columnsValues)[number]>;\n colStart: PropDef<(typeof columnsValues)[number]>;\n rowSpan: PropDef<(typeof columnsValues)[number]>;\n};\n\n/** @public */\ntype GridOwnProps = GetPropDefTypes<typeof gridPropDefs>;\n\n/** @public */\ntype GridItemOwnProps = GetPropDefTypes<typeof gridItemPropDefs>;\n\nexport { gridPropDefs, gridItemPropDefs };\nexport type { GridOwnProps, GridItemOwnProps };\n"],"names":[],"mappings":"AAkBA,MAAM,aAAgB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;AAAA,IACR,UAAY,EAAA;AAAA;AAEhB;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { HeaderToolbar } from './HeaderToolbar.esm.js';
|
|
3
|
+
import { Tabs, TabList, Tab } from '../Tabs/Tabs.esm.js';
|
|
4
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
5
|
+
|
|
6
|
+
const Header = (props) => {
|
|
7
|
+
const { tabs, icon, title, menuItems, breadcrumbs, customActions } = props;
|
|
8
|
+
const { classNames } = useStyles("Header");
|
|
9
|
+
const hasTabs = tabs && tabs.length > 0;
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
HeaderToolbar,
|
|
13
|
+
{
|
|
14
|
+
icon,
|
|
15
|
+
title,
|
|
16
|
+
menuItems,
|
|
17
|
+
breadcrumbs,
|
|
18
|
+
customActions,
|
|
19
|
+
hasTabs
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
tabs && /* @__PURE__ */ jsx("div", { className: classNames.tabsWrapper, children: /* @__PURE__ */ jsx(Tabs, { onSelectionChange: props.onTabSelectionChange, children: /* @__PURE__ */ jsx(TabList, { children: tabs?.map((tab) => /* @__PURE__ */ jsx(Tab, { id: tab.id, href: tab.href, children: tab.label }, tab.id)) }) }) })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { Header };
|
|
27
|
+
//# sourceMappingURL=Header.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.esm.js","sources":["../../../src/components/Header/Header.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 type { HeaderProps } from './types';\nimport { HeaderToolbar } from './HeaderToolbar';\nimport { Tabs, TabList, Tab } from '../Tabs';\nimport { useStyles } from '../../hooks/useStyles';\nimport { type NavigateOptions } from 'react-router-dom';\n\ndeclare module 'react-aria-components' {\n interface RouterConfig {\n routerOptions: NavigateOptions;\n }\n}\n\n/**\n * A component that renders a toolbar.\n *\n * @public\n */\nexport const Header = (props: HeaderProps) => {\n const { tabs, icon, title, menuItems, breadcrumbs, customActions } = props;\n\n const { classNames } = useStyles('Header');\n\n const hasTabs = tabs && tabs.length > 0;\n\n return (\n <>\n <HeaderToolbar\n icon={icon}\n title={title}\n menuItems={menuItems}\n breadcrumbs={breadcrumbs}\n customActions={customActions}\n hasTabs={hasTabs}\n />\n {tabs && (\n <div className={classNames.tabsWrapper}>\n <Tabs onSelectionChange={props.onTabSelectionChange}>\n <TabList>\n {tabs?.map(tab => (\n <Tab key={tab.id} id={tab.id} href={tab.href}>\n {tab.label}\n </Tab>\n ))}\n </TabList>\n </Tabs>\n </div>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAiCa,MAAA,MAAA,GAAS,CAAC,KAAuB,KAAA;AAC5C,EAAA,MAAM,EAAE,IAAM,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,WAAA,EAAa,eAAkB,GAAA,KAAA;AAErE,EAAA,MAAM,EAAE,UAAA,EAAe,GAAA,SAAA,CAAU,QAAQ,CAAA;AAEzC,EAAM,MAAA,OAAA,GAAU,IAAQ,IAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAEtC,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,KAAA;AAAA,QACA,SAAA;AAAA,QACA,WAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,IACC,IACC,oBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,UAAW,CAAA,WAAA,EACzB,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,iBAAmB,EAAA,KAAA,CAAM,oBAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,WACE,QAAM,EAAA,IAAA,EAAA,GAAA,CAAI,CACT,GAAA,qBAAA,GAAA,CAAC,GAAiB,EAAA,EAAA,EAAA,EAAI,GAAI,CAAA,EAAA,EAAI,MAAM,GAAI,CAAA,IAAA,EACrC,QAAI,EAAA,GAAA,CAAA,KAAA,EAAA,EADG,GAAI,CAAA,EAEd,CACD,CAAA,EACH,GACF,CACF,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Link } from 'react-aria-components';
|
|
3
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
4
|
+
import { useRef, useState, useEffect } from 'react';
|
|
5
|
+
import { RiShapesLine, RiArrowRightSLine, RiMore2Line } from '@remixicon/react';
|
|
6
|
+
import { ButtonIcon } from '../ButtonIcon/ButtonIcon.esm.js';
|
|
7
|
+
import { Menu } from '../Menu/Menu.esm.js';
|
|
8
|
+
import { Text } from '../Text/Text.esm.js';
|
|
9
|
+
import { useScroll, useTransform, motion } from 'motion/react';
|
|
10
|
+
|
|
11
|
+
const HeaderToolbar = (props) => {
|
|
12
|
+
const { icon, title, menuItems, breadcrumbs, customActions, hasTabs } = props;
|
|
13
|
+
const { classNames } = useStyles("Header");
|
|
14
|
+
const { scrollY } = useScroll();
|
|
15
|
+
const breadcrumbOpacity = useTransform(scrollY, [80, 120], [0, 1]);
|
|
16
|
+
const toolbarWrapperRef = useRef(null);
|
|
17
|
+
const toolbarContentRef = useRef(null);
|
|
18
|
+
const toolbarControlsRef = useRef(null);
|
|
19
|
+
const [showBreadcrumbs, setShowBreadcrumbs] = useState(true);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const wrapper = toolbarWrapperRef.current;
|
|
22
|
+
if (!wrapper) return;
|
|
23
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
24
|
+
const wrapper2 = toolbarWrapperRef.current;
|
|
25
|
+
const content = toolbarContentRef.current;
|
|
26
|
+
const options = toolbarControlsRef.current;
|
|
27
|
+
if (!wrapper2 || !content) return;
|
|
28
|
+
const wrapperRect = wrapper2.getBoundingClientRect();
|
|
29
|
+
const wrapperWidth = wrapperRect.width;
|
|
30
|
+
const wrapperPadding = 24;
|
|
31
|
+
const availableWidth = wrapperWidth - wrapperPadding;
|
|
32
|
+
const contentRect = content.getBoundingClientRect();
|
|
33
|
+
const contentWidth = contentRect?.width || 0;
|
|
34
|
+
const optionsRect = options?.getBoundingClientRect();
|
|
35
|
+
const optionsWidth = optionsRect?.width || 0;
|
|
36
|
+
const shouldShowBreadcrumbs = contentWidth + optionsWidth + 32 <= availableWidth;
|
|
37
|
+
setShowBreadcrumbs(
|
|
38
|
+
(prev) => prev !== shouldShowBreadcrumbs ? shouldShowBreadcrumbs : prev
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
resizeObserver.observe(wrapper);
|
|
42
|
+
return () => {
|
|
43
|
+
resizeObserver.disconnect();
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return /* @__PURE__ */ jsx("div", { className: classNames.toolbar, "data-has-tabs": hasTabs, children: /* @__PURE__ */ jsxs("div", { className: classNames.toolbarWrapper, ref: toolbarWrapperRef, children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: classNames.toolbarContent, ref: toolbarContentRef, children: [
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: classNames.toolbarName, children: [
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: classNames.toolbarIcon, children: icon || /* @__PURE__ */ jsx(RiShapesLine, {}) }),
|
|
50
|
+
/* @__PURE__ */ jsx(Text, { variant: "body", children: title || "Your plugin" })
|
|
51
|
+
] }),
|
|
52
|
+
breadcrumbs && /* @__PURE__ */ jsxs(
|
|
53
|
+
motion.div,
|
|
54
|
+
{
|
|
55
|
+
className: classNames.breadcrumbs,
|
|
56
|
+
style: {
|
|
57
|
+
opacity: breadcrumbOpacity,
|
|
58
|
+
visibility: showBreadcrumbs ? "visible" : "hidden"
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
RiArrowRightSLine,
|
|
63
|
+
{
|
|
64
|
+
size: 16,
|
|
65
|
+
className: classNames.breadcrumbSeparator
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
breadcrumbs.map((breadcrumb, index) => /* @__PURE__ */ jsxs("div", { className: classNames.breadcrumb, children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Link,
|
|
71
|
+
{
|
|
72
|
+
href: breadcrumb.href,
|
|
73
|
+
className: classNames.breadcrumbLink,
|
|
74
|
+
"data-active": index === breadcrumbs.length - 1,
|
|
75
|
+
children: breadcrumb.label
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
index < breadcrumbs.length - 1 && /* @__PURE__ */ jsx(
|
|
79
|
+
RiArrowRightSLine,
|
|
80
|
+
{
|
|
81
|
+
size: 16,
|
|
82
|
+
className: classNames.breadcrumbSeparator
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] }, breadcrumb.label))
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: classNames.toolbarControls, ref: toolbarControlsRef, children: [
|
|
91
|
+
customActions,
|
|
92
|
+
menuItems && /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
Menu.Trigger,
|
|
95
|
+
{
|
|
96
|
+
render: (props2) => /* @__PURE__ */ jsx(
|
|
97
|
+
ButtonIcon,
|
|
98
|
+
{
|
|
99
|
+
size: "small",
|
|
100
|
+
icon: /* @__PURE__ */ jsx(RiMore2Line, {}),
|
|
101
|
+
variant: "tertiary",
|
|
102
|
+
...props2
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { sideOffset: 4, align: "end", children: /* @__PURE__ */ jsx(Menu.Popup, { children: menuItems.map((option) => /* @__PURE__ */ jsx(
|
|
108
|
+
Menu.Item,
|
|
109
|
+
{
|
|
110
|
+
onClick: () => option.onClick?.(),
|
|
111
|
+
children: option.label
|
|
112
|
+
},
|
|
113
|
+
option.value
|
|
114
|
+
)) }) }) })
|
|
115
|
+
] })
|
|
116
|
+
] })
|
|
117
|
+
] }) });
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { HeaderToolbar };
|
|
121
|
+
//# sourceMappingURL=HeaderToolbar.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderToolbar.esm.js","sources":["../../../src/components/Header/HeaderToolbar.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 { Link } from 'react-aria-components';\nimport { useStyles } from '../../hooks/useStyles';\nimport { useRef, useState, useEffect } from 'react';\nimport { RiArrowRightSLine, RiMore2Line, RiShapesLine } from '@remixicon/react';\nimport type { HeaderToolbarProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Menu } from '../Menu';\nimport { Text } from '../Text';\nimport { motion, useScroll, useTransform } from 'motion/react';\n\n/**\n * A component that renders a toolbar.\n *\n * @internal\n */\nexport const HeaderToolbar = (props: HeaderToolbarProps) => {\n const { icon, title, menuItems, breadcrumbs, customActions, hasTabs } = props;\n const { classNames } = useStyles('Header');\n\n const { scrollY } = useScroll();\n const breadcrumbOpacity = useTransform(scrollY, [80, 120], [0, 1]);\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 // State for breadcrumb visibility\n const [showBreadcrumbs, setShowBreadcrumbs] = useState(true);\n\n // Set up resize observer\n useEffect(() => {\n const wrapper = toolbarWrapperRef.current;\n if (!wrapper) return;\n\n const resizeObserver = new ResizeObserver(() => {\n const wrapper = toolbarWrapperRef.current;\n const content = toolbarContentRef.current;\n const options = toolbarControlsRef.current;\n\n if (!wrapper || !content) return;\n\n // Get dimensions\n const wrapperRect = wrapper.getBoundingClientRect();\n const wrapperWidth = wrapperRect.width;\n const wrapperPadding = 24; // 12px on each side (var(--bui-space-3))\n const availableWidth = wrapperWidth - wrapperPadding;\n\n // Calculate required width for content\n const contentRect = content.getBoundingClientRect();\n const contentWidth = contentRect?.width || 0;\n\n // Calculate options width (if exists)\n const optionsRect = options?.getBoundingClientRect();\n const optionsWidth = optionsRect?.width || 0;\n\n // Check if we need to hide breadcrumbs\n const shouldShowBreadcrumbs =\n contentWidth + optionsWidth + 32 <= availableWidth;\n\n // Only update state if the value actually changed to prevent flickering\n setShowBreadcrumbs(prev =>\n prev !== shouldShowBreadcrumbs ? shouldShowBreadcrumbs : prev,\n );\n });\n\n resizeObserver.observe(wrapper);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n return (\n <div className={classNames.toolbar} data-has-tabs={hasTabs}>\n <div className={classNames.toolbarWrapper} ref={toolbarWrapperRef}>\n <div className={classNames.toolbarContent} ref={toolbarContentRef}>\n <div className={classNames.toolbarName}>\n <div className={classNames.toolbarIcon}>\n {icon || <RiShapesLine />}\n </div>\n <Text variant=\"body\">{title || 'Your plugin'}</Text>\n </div>\n {breadcrumbs && (\n <motion.div\n className={classNames.breadcrumbs}\n style={{\n opacity: breadcrumbOpacity,\n visibility: showBreadcrumbs ? 'visible' : 'hidden',\n }}\n >\n <RiArrowRightSLine\n size={16}\n className={classNames.breadcrumbSeparator}\n />\n {breadcrumbs.map((breadcrumb, index) => (\n <div key={breadcrumb.label} className={classNames.breadcrumb}>\n <Link\n href={breadcrumb.href}\n className={classNames.breadcrumbLink}\n data-active={index === breadcrumbs.length - 1}\n >\n {breadcrumb.label}\n </Link>\n {index < breadcrumbs.length - 1 && (\n <RiArrowRightSLine\n size={16}\n className={classNames.breadcrumbSeparator}\n />\n )}\n </div>\n ))}\n </motion.div>\n )}\n </div>\n <div className={classNames.toolbarControls} ref={toolbarControlsRef}>\n {customActions}\n {menuItems && (\n <Menu.Root>\n <Menu.Trigger\n render={props => (\n <ButtonIcon\n size=\"small\"\n icon={<RiMore2Line />}\n variant=\"tertiary\"\n {...props}\n />\n )}\n />\n <Menu.Portal>\n <Menu.Positioner sideOffset={4} align=\"end\">\n <Menu.Popup>\n {menuItems.map(option => (\n <Menu.Item\n key={option.value}\n onClick={() => option.onClick?.()}\n >\n {option.label}\n </Menu.Item>\n ))}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n )}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["wrapper","props"],"mappings":";;;;;;;;;;AA+Ba,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAA,MAAM,EAAE,IAAM,EAAA,KAAA,EAAO,WAAW,WAAa,EAAA,aAAA,EAAe,SAAY,GAAA,KAAA;AACxE,EAAA,MAAM,EA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GAAGA;AAAA;AAAA;AACN;AAAA,SAEJ;AAAA,4BACC,IAAK,CAAA,MAAA,EAAL,EACC,QAAC,kBAAA,GAAA,CAAA,IAAA,CAAK,YAAL,EAAgB,UAAA,EAAY,CAAG,EAAA,KAAA,EAAM,OACpC,QAAC,kBAAA,GAAA,CAAA,IAAA,CAAK,OAAL,EACE,QAAA,EAAA,SAAA,CAAU,IAAI,CACb,MAAA,qBAAA,GAAA;AAAA,UAAC,IAAK,CAAA,IAAA;AAAA,UAAL;AAAA,YAEC,OAAA,EAAS,MAAM,MAAA,CAAO,OAAU,IAAA;AAAA,YAE/B,QAAO,EAAA,MAAA,CAAA;AAAA,WAAA;AAAA,UAHH,MAAO,CAAA;AAAA,SAKf,CACH,EAAA,CAAA,EACF,CACF,EAAA;AAAA,OACF,EAAA;AAAA,KAEJ,EAAA;AAAA,GAAA,EACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Heading } from '../Heading/Heading.esm.js';
|
|
3
|
+
import { Menu } from '../Menu/Menu.esm.js';
|
|
4
|
+
import { ButtonIcon } from '../ButtonIcon/ButtonIcon.esm.js';
|
|
5
|
+
import { RiMore2Line } from '@remixicon/react';
|
|
6
|
+
import { Tabs, TabList, Tab } from '../Tabs/Tabs.esm.js';
|
|
7
|
+
import { useStyles } from '../../hooks/useStyles.esm.js';
|
|
8
|
+
|
|
9
|
+
const HeaderPage = (props) => {
|
|
10
|
+
const { title, menuItems, tabs, customActions } = props;
|
|
11
|
+
const { classNames } = useStyles("HeaderPage");
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames.root, children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("div", { className: classNames.content, children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Heading, { variant: "title4", children: title }),
|
|
15
|
+
/* @__PURE__ */ jsxs("div", { className: classNames.controls, children: [
|
|
16
|
+
customActions,
|
|
17
|
+
menuItems && /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
Menu.Trigger,
|
|
20
|
+
{
|
|
21
|
+
render: (props2) => /* @__PURE__ */ jsx(
|
|
22
|
+
ButtonIcon,
|
|
23
|
+
{
|
|
24
|
+
...props2,
|
|
25
|
+
size: "small",
|
|
26
|
+
icon: /* @__PURE__ */ jsx(RiMore2Line, {}),
|
|
27
|
+
variant: "tertiary"
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { sideOffset: 4, align: "end", children: /* @__PURE__ */ jsx(Menu.Popup, { children: menuItems.map((menuItem) => /* @__PURE__ */ jsx(
|
|
33
|
+
Menu.Item,
|
|
34
|
+
{
|
|
35
|
+
onClick: () => menuItem.onClick?.(),
|
|
36
|
+
children: menuItem.label
|
|
37
|
+
},
|
|
38
|
+
menuItem.value
|
|
39
|
+
)) }) }) })
|
|
40
|
+
] })
|
|
41
|
+
] })
|
|
42
|
+
] }),
|
|
43
|
+
tabs && /* @__PURE__ */ jsx("div", { className: classNames.tabsWrapper, children: /* @__PURE__ */ jsx(Tabs, { children: /* @__PURE__ */ jsx(TabList, { children: tabs.map((tab) => /* @__PURE__ */ jsx(Tab, { id: tab.id, href: tab.href, children: tab.label }, tab.id)) }) }) })
|
|
44
|
+
] });
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { HeaderPage };
|
|
48
|
+
//# sourceMappingURL=HeaderPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderPage.esm.js","sources":["../../../src/components/HeaderPage/HeaderPage.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 { HeaderPageProps } from './types';\nimport { Heading } from '../Heading';\nimport { Menu } from '../Menu';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RiMore2Line } from '@remixicon/react';\nimport { Tabs, TabList, Tab } from '../Tabs';\nimport { useStyles } from '../../hooks/useStyles';\n\n/**\n * A component that renders a header page.\n *\n * @public\n */\nexport const HeaderPage = (props: HeaderPageProps) => {\n const { title, menuItems, tabs, customActions } = props;\n const { classNames } = useStyles('HeaderPage');\n\n return (\n <div className={classNames.root}>\n <div className={classNames.content}>\n <Heading variant=\"title4\">{title}</Heading>\n <div className={classNames.controls}>\n {customActions}\n {menuItems && (\n <Menu.Root>\n <Menu.Trigger\n render={props => (\n <ButtonIcon\n {...props}\n size=\"small\"\n icon={<RiMore2Line />}\n variant=\"tertiary\"\n />\n )}\n />\n <Menu.Portal>\n <Menu.Positioner sideOffset={4} align=\"end\">\n <Menu.Popup>\n {menuItems.map(menuItem => (\n <Menu.Item\n key={menuItem.value}\n onClick={() => menuItem.onClick?.()}\n >\n {menuItem.label}\n </Menu.Item>\n ))}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n )}\n </div>\n </div>\n {tabs && (\n <div className={classNames.tabsWrapper}>\n <Tabs>\n <TabList>\n {tabs.map(tab => (\n <Tab key={tab.id} id={tab.id} href={tab.href}>\n {tab.label}\n </Tab>\n ))}\n </TabList>\n </Tabs>\n </div>\n )}\n </div>\n );\n};\n"],"names":["props"],"mappings":";;;;;;;;AA6Ba,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAA,MAAM,EAAE,KAAA,EAAO,SAAW,EAAA,IAAA,EAAM,eA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