@red-hat-developer-hub/backstage-plugin-global-floating-action-button 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +130 -0
- package/dist/components/CustomFab.esm.js +18 -6
- package/dist/components/CustomFab.esm.js.map +1 -1
- package/dist/components/FABWithSubmenu.esm.js +26 -15
- package/dist/components/FABWithSubmenu.esm.js.map +1 -1
- package/dist/components/FloatingButton.esm.js +4 -1
- package/dist/components/FloatingButton.esm.js.map +1 -1
- package/dist/hooks/useTranslation.esm.js +8 -0
- package/dist/hooks/useTranslation.esm.js.map +1 -0
- package/dist/index.d.ts +30 -1
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +8 -2
- package/dist/plugin.esm.js.map +1 -1
- package/dist/translations/de.esm.js +24 -0
- package/dist/translations/de.esm.js.map +1 -0
- package/dist/translations/es.esm.js +24 -0
- package/dist/translations/es.esm.js.map +1 -0
- package/dist/translations/fr.esm.js +24 -0
- package/dist/translations/fr.esm.js.map +1 -0
- package/dist/translations/index.esm.js +16 -0
- package/dist/translations/index.esm.js.map +1 -0
- package/dist/translations/ref.esm.js +40 -0
- package/dist/translations/ref.esm.js.map +1 -0
- package/dist/types.esm.js.map +1 -1
- package/dist/utils/translationUtils.esm.js +10 -0
- package/dist/utils/translationUtils.esm.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -251,6 +251,7 @@ The sections below are relevant for static plugins. If the plugin is expected to
|
|
|
251
251
|
| ------------------ | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
252
252
|
| **slot** | `enum` | The position where the fab will be placed. Valid values: `PAGE_END`, `BOTTOM_LEFT`. | [optional] default to `PAGE_END`. |
|
|
253
253
|
| **label** | `String` | A name for your action button. | required |
|
|
254
|
+
| **labelKey** | `String` | Translation key for the label. If provided, will be used instead of label when translations are available. | optional |
|
|
254
255
|
| **icon** | `String`<br>`React.ReactElement`<br>`SVG image icon`<br>`HTML image icon` | An icon for your floating button. Recommended to use **filled** icons from the [Material Design library](https://fonts.google.com/icons) | optional |
|
|
255
256
|
| **showLabel** | `Boolean` | To display the label next to your icon. | optional |
|
|
256
257
|
| **size** | `'small'`<br>`'medium'`<br>`'large'` | A name for your action button. | [optional] default to `'medium'` |
|
|
@@ -258,10 +259,139 @@ The sections below are relevant for static plugins. If the plugin is expected to
|
|
|
258
259
|
| **onClick** | `React.MouseEventHandler` | the action to be performed on `onClick`. | optional |
|
|
259
260
|
| **to** | `String` | Specify an href if the action button should open a internal/external link. | optional |
|
|
260
261
|
| **toolTip** | `String` | The text to appear on hover. | optional |
|
|
262
|
+
| **toolTipKey** | `String` | Translation key for the tooltip. If provided, will be used instead of toolTip when translations are available. | optional |
|
|
261
263
|
| **priority** | `number` | When multiple sub-menu actions are displayed, the button can be prioritized to position either at the top or the bottom. | optional |
|
|
262
264
|
| **visibleOnPaths** | `string[]` | The action button will appear only on the specified paths and will remain hidden on all other paths. | [optional] default to displaying on all paths. |
|
|
263
265
|
| **excludeOnPaths** | `string[]` | The action button will be hidden only on the specified paths and will appear on all other paths. | [optional] default to displaying on all paths. |
|
|
264
266
|
|
|
267
|
+
### Translation Support
|
|
268
|
+
|
|
269
|
+
The Global Floating Action Button plugin supports internationalization (i18n) through translation keys. You can use `labelKey` and `toolTipKey` properties to provide translation keys instead of static text.
|
|
270
|
+
|
|
271
|
+
#### Using Translation Keys in Dynamic Configuration
|
|
272
|
+
|
|
273
|
+
```yaml title="dynamic-plugins.yaml"
|
|
274
|
+
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-floating-action-button
|
|
275
|
+
disabled: false
|
|
276
|
+
pluginConfig:
|
|
277
|
+
dynamicPlugins:
|
|
278
|
+
frontend:
|
|
279
|
+
red-hat-developer-hub.backstage-plugin-global-floating-action-button:
|
|
280
|
+
mountPoints:
|
|
281
|
+
- mountPoint: application/listener
|
|
282
|
+
importName: DynamicGlobalFloatingActionButton
|
|
283
|
+
- mountPoint: global.floatingactionbutton/config
|
|
284
|
+
importName: NullComponent
|
|
285
|
+
config:
|
|
286
|
+
icon: github
|
|
287
|
+
label: 'GitHub' # Fallback text
|
|
288
|
+
labelKey: 'fab.github.label' # Translation key
|
|
289
|
+
toolTip: 'GitHub Repository' # Fallback text
|
|
290
|
+
toolTipKey: 'fab.github.tooltip' # Translation key
|
|
291
|
+
to: https://github.com/redhat-developer/rhdh-plugins
|
|
292
|
+
- mountPoint: global.floatingactionbutton/config
|
|
293
|
+
importName: NullComponent
|
|
294
|
+
config:
|
|
295
|
+
color: 'success'
|
|
296
|
+
icon: search
|
|
297
|
+
label: 'Create' # Fallback text
|
|
298
|
+
labelKey: 'fab.create.label' # Translation key
|
|
299
|
+
toolTip: 'Create entity' # Fallback text
|
|
300
|
+
toolTipKey: 'fab.create.tooltip' # Translation key
|
|
301
|
+
to: '/create'
|
|
302
|
+
showLabel: true
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Using Translation Keys in Static Configuration
|
|
306
|
+
|
|
307
|
+
```tsx title="packages/app/src/components/Root/Root.tsx"
|
|
308
|
+
import {
|
|
309
|
+
GlobalFloatingActionButton,
|
|
310
|
+
Slot,
|
|
311
|
+
} from '@red-hat-developer-hub/backstage-plugin-global-floating-action-button';
|
|
312
|
+
|
|
313
|
+
export const Root = ({ children }: PropsWithChildren<{}>) => (
|
|
314
|
+
<SidebarPage>
|
|
315
|
+
{/* ... */}
|
|
316
|
+
<GlobalFloatingActionButton
|
|
317
|
+
floatingButtons={[
|
|
318
|
+
{
|
|
319
|
+
color: 'success',
|
|
320
|
+
icon: <CreateComponentIcon />,
|
|
321
|
+
label: 'Create', // Fallback text
|
|
322
|
+
labelKey: 'fab.create.label', // Translation key
|
|
323
|
+
toolTip: 'Create entity', // Fallback text
|
|
324
|
+
toolTipKey: 'fab.create.tooltip', // Translation key
|
|
325
|
+
to: '/create',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
slot: Slot.BOTTOM_LEFT,
|
|
329
|
+
icon: <LibraryBooks />,
|
|
330
|
+
label: 'Docs', // Fallback text
|
|
331
|
+
labelKey: 'fab.docs.label', // Translation key
|
|
332
|
+
toolTip: 'Documentation', // Fallback text
|
|
333
|
+
toolTipKey: 'fab.docs.tooltip', // Translation key
|
|
334
|
+
to: '/docs',
|
|
335
|
+
},
|
|
336
|
+
]}
|
|
337
|
+
/>
|
|
338
|
+
{/* ... */}
|
|
339
|
+
</SidebarPage>
|
|
340
|
+
);
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### Translation Setup
|
|
344
|
+
|
|
345
|
+
The plugin automatically registers its translations when loaded. The translation system is built into the plugin configuration and will be available when the plugin is installed.
|
|
346
|
+
|
|
347
|
+
For dynamic plugins, translations are automatically loaded with the plugin. For static installations, the translations are registered through the plugin's `__experimentalTranslations` configuration.
|
|
348
|
+
|
|
349
|
+
#### Built-in Translation Keys
|
|
350
|
+
|
|
351
|
+
The plugin provides built-in translation keys organized under the `fab` namespace:
|
|
352
|
+
|
|
353
|
+
- `fab.create.label` - "Create"
|
|
354
|
+
- `fab.create.tooltip` - "Create entity"
|
|
355
|
+
- `fab.docs.label` - "Docs"
|
|
356
|
+
- `fab.docs.tooltip` - "Documentation"
|
|
357
|
+
- `fab.apis.label` - "APIs"
|
|
358
|
+
- `fab.apis.tooltip` - "API Documentation"
|
|
359
|
+
- `fab.github.label` - "GitHub"
|
|
360
|
+
- `fab.github.tooltip` - "GitHub Repository"
|
|
361
|
+
- `fab.bulkImport.label` - "Bulk Import"
|
|
362
|
+
- `fab.bulkImport.tooltip` - "Register multiple repositories in bulk"
|
|
363
|
+
- `fab.quay.label` - "Quay"
|
|
364
|
+
- `fab.quay.tooltip` - "Quay Container Registry"
|
|
365
|
+
|
|
366
|
+
#### Supported Languages
|
|
367
|
+
|
|
368
|
+
The plugin includes translations for:
|
|
369
|
+
|
|
370
|
+
- **English** (default)
|
|
371
|
+
- **German** (de)
|
|
372
|
+
- **French** (fr)
|
|
373
|
+
- **Spanish** (es)
|
|
374
|
+
|
|
375
|
+
#### How Translation Resolution Works
|
|
376
|
+
|
|
377
|
+
1. If `labelKey` is provided, the plugin will attempt to resolve the translation key
|
|
378
|
+
2. If the translation key is found, it will be used as the label
|
|
379
|
+
3. If the translation key is not found, the plugin will fall back to the `label` property
|
|
380
|
+
4. The same logic applies to `toolTipKey` and `toolTip`
|
|
381
|
+
|
|
382
|
+
This ensures backward compatibility while providing translation support when available.
|
|
383
|
+
|
|
384
|
+
#### Internal Translation Implementation
|
|
385
|
+
|
|
386
|
+
The plugin uses a centralized translation system where:
|
|
387
|
+
|
|
388
|
+
- The `useTranslation()` hook is called in components that render floating action buttons to ensure proper translation context initialization
|
|
389
|
+
- The translation function (`t`) is passed down to child components that need to resolve translation keys
|
|
390
|
+
- This internal architecture prevents infinite re-render loops and ensures stable component rendering
|
|
391
|
+
- All components that use `CustomFab` must provide the translation function as a prop
|
|
392
|
+
|
|
393
|
+
**Note for Developers**: When extending or modifying the plugin components, ensure that the `useTranslation()` hook is called in parent components and the `t` prop is passed to `CustomFab` instances to maintain proper translation functionality and prevent rendering issues.
|
|
394
|
+
|
|
265
395
|
**NOTE**
|
|
266
396
|
|
|
267
397
|
If multiple floating button actions are assigned to the same `Slot`, they will appear as sub-menu options within the floating button.
|
|
@@ -8,6 +8,7 @@ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
|
8
8
|
import { FabIcon } from './FabIcon.esm.js';
|
|
9
9
|
import { Slot } from '../types.esm.js';
|
|
10
10
|
import { getSlotOptions } from '../utils.esm.js';
|
|
11
|
+
import { getTranslatedTextWithFallback } from '../utils/translationUtils.esm.js';
|
|
11
12
|
|
|
12
13
|
const useStyles = makeStyles(() => ({
|
|
13
14
|
openInNew: { paddingBottom: "5px", paddingTop: "3px" }
|
|
@@ -47,21 +48,32 @@ const FABLabel = ({
|
|
|
47
48
|
const CustomFab = ({
|
|
48
49
|
actionButton,
|
|
49
50
|
size,
|
|
50
|
-
className
|
|
51
|
+
className,
|
|
52
|
+
t
|
|
51
53
|
}) => {
|
|
52
54
|
const navigate = useNavigate();
|
|
53
55
|
const isExternalUri = (uri) => /^([a-z+.-]+):/.test(uri);
|
|
54
56
|
const isExternal = isExternalUri(actionButton.to);
|
|
55
57
|
const newWindow = isExternal && !!/^https?:/.exec(actionButton.to);
|
|
56
58
|
const navigateTo = () => actionButton.to && !isExternal ? navigate(actionButton.to) : "";
|
|
57
|
-
|
|
59
|
+
const resolvedLabel = getTranslatedTextWithFallback(
|
|
60
|
+
t,
|
|
61
|
+
actionButton.labelKey,
|
|
62
|
+
actionButton.label
|
|
63
|
+
);
|
|
64
|
+
const resolvedTooltip = actionButton.toolTip ? getTranslatedTextWithFallback(
|
|
65
|
+
t,
|
|
66
|
+
actionButton.toolTipKey,
|
|
67
|
+
actionButton.toolTip
|
|
68
|
+
) : undefined;
|
|
69
|
+
if (!resolvedLabel) {
|
|
58
70
|
console.warn(
|
|
59
71
|
"Label is missing from your FAB component. A label is required for the aria-label attribute.",
|
|
60
72
|
actionButton
|
|
61
73
|
);
|
|
62
74
|
return null;
|
|
63
75
|
}
|
|
64
|
-
const labelText = (
|
|
76
|
+
const labelText = (resolvedLabel || "").length > 20 ? `${resolvedLabel.slice(0, resolvedLabel.length)}...` : resolvedLabel;
|
|
65
77
|
const getColor = () => {
|
|
66
78
|
if (actionButton.color) {
|
|
67
79
|
return actionButton.color;
|
|
@@ -72,7 +84,7 @@ const CustomFab = ({
|
|
|
72
84
|
return /* @__PURE__ */ jsx(
|
|
73
85
|
Tooltip,
|
|
74
86
|
{
|
|
75
|
-
title:
|
|
87
|
+
title: resolvedTooltip,
|
|
76
88
|
placement: getSlotOptions(actionButton.slot).tooltipDirection,
|
|
77
89
|
children: /* @__PURE__ */ jsx(
|
|
78
90
|
Fab,
|
|
@@ -86,8 +98,8 @@ const CustomFab = ({
|
|
|
86
98
|
variant: actionButton.showLabel || isExternal || !actionButton.icon ? "extended" : "circular",
|
|
87
99
|
size: size || actionButton.size || "medium",
|
|
88
100
|
color: getColor(),
|
|
89
|
-
"aria-label":
|
|
90
|
-
"data-testid": (
|
|
101
|
+
"aria-label": resolvedLabel,
|
|
102
|
+
"data-testid": (resolvedLabel || "").replace(" ", "-").toLocaleLowerCase("en-US"),
|
|
91
103
|
onClick: actionButton.onClick || navigateTo,
|
|
92
104
|
...isExternal ? { href: actionButton.to } : {},
|
|
93
105
|
children: /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFab.esm.js","sources":["../../src/components/CustomFab.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ReactElement } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { makeStyles } from '@mui/styles';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { FabIcon } from './FabIcon';\nimport { FloatingActionButton, Slot } from '../types';\nimport { getSlotOptions } from '../utils';\n\nconst useStyles = makeStyles(() => ({\n openInNew: { paddingBottom: '5px', paddingTop: '3px' },\n}));\n\nconst FABLabel = ({\n label,\n slot,\n showExternalIcon,\n icon,\n order,\n}: {\n label: string;\n slot: Slot;\n showExternalIcon: boolean;\n icon?: string | ReactElement;\n order: { externalIcon?: number; icon?: number };\n}) => {\n const styles = useStyles();\n const marginStyle = getSlotOptions(slot).margin;\n return (\n <>\n {showExternalIcon && (\n <OpenInNewIcon\n className={styles.openInNew}\n sx={{ ...marginStyle, order: order.externalIcon }}\n />\n )}\n {label && (\n <Typography\n sx={{\n ...marginStyle,\n color: '#151515',\n order: 2,\n textTransform: 'none',\n }}\n >\n {label}\n </Typography>\n )}\n {icon && (\n <Typography sx={{ mb: -1, order: order.icon }}>\n <FabIcon icon={icon} />\n </Typography>\n )}\n </>\n );\n};\n\nexport const CustomFab = ({\n actionButton,\n size,\n className,\n}: {\n actionButton: FloatingActionButton;\n size?: 'small' | 'medium' | 'large';\n className?: string;\n}) => {\n const navigate = useNavigate();\n const isExternalUri = (uri: string) => /^([a-z+.-]+):/.test(uri);\n const isExternal = isExternalUri(actionButton.to!);\n const newWindow = isExternal && !!/^https?:/.exec(actionButton.to!);\n const navigateTo = () =>\n actionButton.to && !isExternal ? navigate(actionButton.to) : '';\n\n
|
|
1
|
+
{"version":3,"file":"CustomFab.esm.js","sources":["../../src/components/CustomFab.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ReactElement } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { makeStyles } from '@mui/styles';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { FabIcon } from './FabIcon';\nimport { FloatingActionButton, Slot } from '../types';\nimport { getSlotOptions } from '../utils';\nimport { getTranslatedTextWithFallback } from '../utils/translationUtils';\nimport { TranslationFunction } from '@backstage/core-plugin-api/alpha';\nimport { globalFloatingActionButtonTranslationRef } from '../translations';\n\nconst useStyles = makeStyles(() => ({\n openInNew: { paddingBottom: '5px', paddingTop: '3px' },\n}));\n\nconst FABLabel = ({\n label,\n slot,\n showExternalIcon,\n icon,\n order,\n}: {\n label: string;\n slot: Slot;\n showExternalIcon: boolean;\n icon?: string | ReactElement;\n order: { externalIcon?: number; icon?: number };\n}) => {\n const styles = useStyles();\n const marginStyle = getSlotOptions(slot).margin;\n return (\n <>\n {showExternalIcon && (\n <OpenInNewIcon\n className={styles.openInNew}\n sx={{ ...marginStyle, order: order.externalIcon }}\n />\n )}\n {label && (\n <Typography\n sx={{\n ...marginStyle,\n color: '#151515',\n order: 2,\n textTransform: 'none',\n }}\n >\n {label}\n </Typography>\n )}\n {icon && (\n <Typography sx={{ mb: -1, order: order.icon }}>\n <FabIcon icon={icon} />\n </Typography>\n )}\n </>\n );\n};\n\nexport const CustomFab = ({\n actionButton,\n size,\n className,\n t,\n}: {\n actionButton: FloatingActionButton;\n size?: 'small' | 'medium' | 'large';\n className?: string;\n t: TranslationFunction<typeof globalFloatingActionButtonTranslationRef.T>;\n}) => {\n const navigate = useNavigate();\n const isExternalUri = (uri: string) => /^([a-z+.-]+):/.test(uri);\n const isExternal = isExternalUri(actionButton.to!);\n const newWindow = isExternal && !!/^https?:/.exec(actionButton.to!);\n const navigateTo = () =>\n actionButton.to && !isExternal ? navigate(actionButton.to) : '';\n\n const resolvedLabel = getTranslatedTextWithFallback(\n t,\n actionButton.labelKey,\n actionButton.label,\n );\n const resolvedTooltip = actionButton.toolTip\n ? getTranslatedTextWithFallback(\n t,\n actionButton.toolTipKey,\n actionButton.toolTip,\n )\n : undefined;\n\n if (!resolvedLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Label is missing from your FAB component. A label is required for the aria-label attribute.',\n actionButton,\n );\n return null;\n }\n\n const labelText =\n (resolvedLabel || '').length > 20\n ? `${resolvedLabel.slice(0, resolvedLabel.length)}...`\n : resolvedLabel;\n\n const getColor = () => {\n if (actionButton.color) {\n return actionButton.color;\n }\n return undefined;\n };\n\n const displayOnRight =\n actionButton.slot === Slot.PAGE_END || !actionButton.slot;\n\n return (\n <Tooltip\n title={resolvedTooltip}\n placement={getSlotOptions(actionButton.slot).tooltipDirection}\n >\n <Fab\n {...(newWindow ? { target: '_blank', rel: 'noopener' } : {})}\n className={className}\n style={{\n color: actionButton?.iconColor || '#1f1f1f',\n backgroundColor: actionButton.color ? '' : 'white',\n }}\n variant={\n actionButton.showLabel || isExternal || !actionButton.icon\n ? 'extended'\n : 'circular'\n }\n size={size || actionButton.size || 'medium'}\n color={getColor()}\n aria-label={resolvedLabel}\n data-testid={(resolvedLabel || '')\n .replace(' ', '-')\n .toLocaleLowerCase('en-US')}\n onClick={actionButton.onClick || navigateTo}\n {...(isExternal ? { href: actionButton.to } : {})}\n >\n <FABLabel\n showExternalIcon={isExternal}\n icon={actionButton.icon}\n label={actionButton.showLabel || !actionButton.icon ? labelText : ''}\n order={\n displayOnRight\n ? { externalIcon: isExternal ? 1 : -1, icon: 3 }\n : { externalIcon: isExternal ? 3 : -1, icon: 1 }\n }\n slot={actionButton.slot || Slot.PAGE_END}\n />\n </Fab>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -12,6 +12,8 @@ import Slide from '@mui/material/Slide';
|
|
|
12
12
|
import { CustomFab } from './CustomFab.esm.js';
|
|
13
13
|
import { getSlotOptions } from '../utils.esm.js';
|
|
14
14
|
import Typography from '@mui/material/Typography';
|
|
15
|
+
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
16
|
+
import { getTranslatedTextWithFallback } from '../utils/translationUtils.esm.js';
|
|
15
17
|
|
|
16
18
|
const useStyles = makeStyles((theme) => ({
|
|
17
19
|
fabContainer: {
|
|
@@ -53,6 +55,7 @@ const FABWithSubmenu = ({
|
|
|
53
55
|
setIsMenuOpen(true);
|
|
54
56
|
}
|
|
55
57
|
};
|
|
58
|
+
const { t } = useTranslation();
|
|
56
59
|
return /* @__PURE__ */ jsxs(
|
|
57
60
|
Box,
|
|
58
61
|
{
|
|
@@ -63,21 +66,28 @@ const FABWithSubmenu = ({
|
|
|
63
66
|
id: "floating-button-with-submenu",
|
|
64
67
|
"data-testid": "floating-button-with-submenu",
|
|
65
68
|
children: [
|
|
66
|
-
/* @__PURE__ */ jsx(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Tooltip,
|
|
71
|
+
{
|
|
72
|
+
title: getTranslatedTextWithFallback(t, "fab.menu.tooltip", "Menu"),
|
|
73
|
+
placement: getSlotOptions(slot).tooltipDirection,
|
|
74
|
+
children: /* @__PURE__ */ jsxs(Typography, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(Box, { ref: containerRef, sx: { overflow: "hidden" } }),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
Fab,
|
|
78
|
+
{
|
|
79
|
+
size: "medium",
|
|
80
|
+
color: "info",
|
|
81
|
+
onClick: handleClick,
|
|
82
|
+
"aria-label": "Menu",
|
|
83
|
+
variant: "circular",
|
|
84
|
+
sx: { zIndex: 1e3 },
|
|
85
|
+
children: isMenuOpen ? /* @__PURE__ */ jsx(CloseIcon, { className: styles.menuButtonStyle }) : /* @__PURE__ */ jsx(MenuIcon, { className: styles.menuButtonStyle })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] })
|
|
89
|
+
}
|
|
90
|
+
),
|
|
81
91
|
fabs?.map((fb) => {
|
|
82
92
|
return /* @__PURE__ */ jsx(
|
|
83
93
|
Slide,
|
|
@@ -92,6 +102,7 @@ const FABWithSubmenu = ({
|
|
|
92
102
|
CustomFab,
|
|
93
103
|
{
|
|
94
104
|
actionButton: fb,
|
|
105
|
+
t,
|
|
95
106
|
size: "medium",
|
|
96
107
|
className: styles.button
|
|
97
108
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FABWithSubmenu.esm.js","sources":["../../src/components/FABWithSubmenu.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useRef, useState, useEffect } from 'react';\nimport classnames from 'classnames';\n\nimport { useLocation } from 'react-router-dom';\nimport { makeStyles } from '@mui/styles';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport Box from '@mui/material/Box';\n\nimport CloseIcon from '@mui/icons-material/Close';\nimport MenuIcon from '@mui/icons-material/Menu';\nimport Slide from '@mui/material/Slide';\nimport { CustomFab } from './CustomFab';\nimport { getSlotOptions } from '../utils';\nimport { FloatingActionButton, Slot } from '../types';\nimport Typography from '@mui/material/Typography';\n\nconst useStyles = makeStyles(theme => ({\n fabContainer: {\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n alignItems: 'center',\n gap: '10px',\n },\n button: {\n zIndex: 205,\n color:\n theme && Object.keys(theme).length > 0\n ? theme.palette.grey[500]\n : '#9e9e9e',\n },\n menuButtonStyle: {\n color: 'white',\n },\n}));\n\nexport const FABWithSubmenu = ({\n className,\n fabs,\n slot,\n}: {\n fabs: FloatingActionButton[];\n slot: Slot;\n className?: string;\n}) => {\n const containerRef = useRef<HTMLElement>(null);\n const styles = useStyles();\n const fab = useStyles();\n const { pathname } = useLocation();\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n useEffect(() => {\n return () => {\n setIsMenuOpen(false);\n };\n }, [pathname]);\n\n const handleClick = () => {\n if (isMenuOpen) {\n setTimeout(() => {\n setIsMenuOpen(false);\n }, 300);\n } else {\n setIsMenuOpen(true);\n }\n };\n\n return (\n <Box\n className={classnames(fab.fabContainer, className)}\n sx={{\n flexDirection: 'column-reverse',\n }}\n id=\"floating-button-with-submenu\"\n data-testid=\"floating-button-with-submenu\"\n >\n <Tooltip
|
|
1
|
+
{"version":3,"file":"FABWithSubmenu.esm.js","sources":["../../src/components/FABWithSubmenu.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useRef, useState, useEffect } from 'react';\nimport classnames from 'classnames';\n\nimport { useLocation } from 'react-router-dom';\nimport { makeStyles } from '@mui/styles';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport Box from '@mui/material/Box';\n\nimport CloseIcon from '@mui/icons-material/Close';\nimport MenuIcon from '@mui/icons-material/Menu';\nimport Slide from '@mui/material/Slide';\nimport { CustomFab } from './CustomFab';\nimport { getSlotOptions } from '../utils';\nimport { FloatingActionButton, Slot } from '../types';\nimport Typography from '@mui/material/Typography';\nimport { useTranslation } from '../hooks/useTranslation';\nimport { getTranslatedTextWithFallback } from '../utils/translationUtils';\n\nconst useStyles = makeStyles(theme => ({\n fabContainer: {\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n alignItems: 'center',\n gap: '10px',\n },\n button: {\n zIndex: 205,\n color:\n theme && Object.keys(theme).length > 0\n ? theme.palette.grey[500]\n : '#9e9e9e',\n },\n menuButtonStyle: {\n color: 'white',\n },\n}));\n\nexport const FABWithSubmenu = ({\n className,\n fabs,\n slot,\n}: {\n fabs: FloatingActionButton[];\n slot: Slot;\n className?: string;\n}) => {\n const containerRef = useRef<HTMLElement>(null);\n const styles = useStyles();\n const fab = useStyles();\n const { pathname } = useLocation();\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n useEffect(() => {\n return () => {\n setIsMenuOpen(false);\n };\n }, [pathname]);\n\n const handleClick = () => {\n if (isMenuOpen) {\n setTimeout(() => {\n setIsMenuOpen(false);\n }, 300);\n } else {\n setIsMenuOpen(true);\n }\n };\n // This hook call is necessary to prevent infinite re-render loops\n // The translation context provides stability to the component's render cycle\n const { t } = useTranslation();\n return (\n <Box\n className={classnames(fab.fabContainer, className)}\n sx={{\n flexDirection: 'column-reverse',\n }}\n id=\"floating-button-with-submenu\"\n data-testid=\"floating-button-with-submenu\"\n >\n <Tooltip\n title={getTranslatedTextWithFallback(t, 'fab.menu.tooltip', 'Menu')}\n placement={getSlotOptions(slot).tooltipDirection}\n >\n <Typography>\n <Box ref={containerRef} sx={{ overflow: 'hidden' }} />\n <Fab\n size=\"medium\"\n color=\"info\"\n onClick={handleClick}\n aria-label=\"Menu\"\n variant=\"circular\"\n sx={{ zIndex: 1000 }}\n >\n {isMenuOpen ? (\n <CloseIcon className={styles.menuButtonStyle} />\n ) : (\n <MenuIcon className={styles.menuButtonStyle} />\n )}\n </Fab>\n </Typography>\n </Tooltip>\n {fabs?.map(fb => {\n return (\n <Slide\n key={fb.label}\n direction=\"up\"\n container={containerRef?.current}\n in={isMenuOpen}\n mountOnEnter\n unmountOnExit\n timeout={500}\n >\n <Box>\n <CustomFab\n actionButton={fb}\n t={t}\n size=\"medium\"\n key={fb.label}\n className={styles.button}\n />\n </Box>\n </Slide>\n );\n })}\n </Box>\n );\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -6,6 +6,7 @@ import { makeStyles } from '@mui/styles';
|
|
|
6
6
|
import { FABWithSubmenu } from './FABWithSubmenu.esm.js';
|
|
7
7
|
import { CustomFab } from './CustomFab.esm.js';
|
|
8
8
|
import { filterAndSortButtons } from '../utils.esm.js';
|
|
9
|
+
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
9
10
|
|
|
10
11
|
const useStyles = makeStyles((theme) => ({
|
|
11
12
|
"page-end": {
|
|
@@ -32,6 +33,7 @@ const FloatingButton = ({
|
|
|
32
33
|
const { pathname } = useLocation();
|
|
33
34
|
const fabButton = useStyles();
|
|
34
35
|
const [targetElement, setTargetElement] = useState(null);
|
|
36
|
+
const { t } = useTranslation();
|
|
35
37
|
useEffect(() => {
|
|
36
38
|
const checkTargetElement = () => {
|
|
37
39
|
const element = document.querySelector('[class^="BackstagePage-root"]') ?? document.querySelector("main");
|
|
@@ -71,7 +73,8 @@ const FloatingButton = ({
|
|
|
71
73
|
children: /* @__PURE__ */ jsx(
|
|
72
74
|
CustomFab,
|
|
73
75
|
{
|
|
74
|
-
actionButton: { color: "info", iconColor: "white", ...fabs[0] }
|
|
76
|
+
actionButton: { color: "info", iconColor: "white", ...fabs[0] },
|
|
77
|
+
t
|
|
75
78
|
}
|
|
76
79
|
)
|
|
77
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingButton.esm.js","sources":["../../src/components/FloatingButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useRef, useState, useEffect, useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useLocation } from 'react-router-dom';\n\nimport { makeStyles } from '@mui/styles';\nimport { FABWithSubmenu } from './FABWithSubmenu';\nimport { CustomFab } from './CustomFab';\nimport { FloatingActionButton, Slot } from '../types';\nimport { filterAndSortButtons } from '../utils';\n\nconst useStyles = makeStyles(theme => ({\n 'page-end': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n\n // When quickstart drawer is open, adjust margin\n '.quickstart-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: 'var(--quickstart-drawer-width, 500px) ',\n },\n },\n 'bottom-left': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n paddingLeft: theme?.spacing?.(2) ?? '16px',\n alignItems: 'start',\n },\n}));\n\nexport const FloatingButton = ({\n floatingButtons,\n slot,\n}: {\n floatingButtons: FloatingActionButton[];\n slot: Slot;\n}) => {\n const timeoutRef = useRef<NodeJS.Timeout>();\n const { pathname } = useLocation();\n const fabButton = useStyles();\n const [targetElement, setTargetElement] = useState<Element | null>(null);\n\n useEffect(() => {\n const checkTargetElement = () => {\n const element =\n document.querySelector('[class^=\"BackstagePage-root\"]') ??\n document.querySelector('main');\n if (element) {\n setTargetElement(element);\n } else {\n timeoutRef.current = setTimeout(checkTargetElement, 300);\n }\n };\n checkTargetElement();\n return () => {\n clearTimeout(timeoutRef.current);\n };\n }, [pathname, targetElement]);\n\n const fabs = useMemo(\n () => filterAndSortButtons(floatingButtons, pathname),\n [floatingButtons, pathname],\n );\n\n if (fabs?.length === 0) {\n return null;\n }\n\n let fabDiv;\n if (fabs.length > 1) {\n fabDiv = (\n <FABWithSubmenu className={fabButton[slot]} fabs={fabs} slot={slot} />\n );\n } else {\n fabDiv = (\n <div\n style={{\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n }}\n className={fabButton[slot]}\n id=\"floating-button\"\n data-testid=\"floating-button\"\n >\n <CustomFab\n actionButton={{ color: 'info', iconColor: 'white', ...fabs[0] }}\n />\n </div>\n );\n }\n return targetElement\n ? createPortal(fabDiv, targetElement)\n : createPortal(fabDiv, document.body);\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FloatingButton.esm.js","sources":["../../src/components/FloatingButton.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { useRef, useState, useEffect, useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useLocation } from 'react-router-dom';\n\nimport { makeStyles } from '@mui/styles';\nimport { FABWithSubmenu } from './FABWithSubmenu';\nimport { CustomFab } from './CustomFab';\nimport { FloatingActionButton, Slot } from '../types';\nimport { filterAndSortButtons } from '../utils';\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n 'page-end': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n\n // When quickstart drawer is open, adjust margin\n '.quickstart-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: 'var(--quickstart-drawer-width, 500px) ',\n },\n },\n 'bottom-left': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n paddingLeft: theme?.spacing?.(2) ?? '16px',\n alignItems: 'start',\n },\n}));\n\nexport const FloatingButton = ({\n floatingButtons,\n slot,\n}: {\n floatingButtons: FloatingActionButton[];\n slot: Slot;\n}) => {\n const timeoutRef = useRef<NodeJS.Timeout>();\n const { pathname } = useLocation();\n const fabButton = useStyles();\n const [targetElement, setTargetElement] = useState<Element | null>(null);\n const { t } = useTranslation();\n\n useEffect(() => {\n const checkTargetElement = () => {\n const element =\n document.querySelector('[class^=\"BackstagePage-root\"]') ??\n document.querySelector('main');\n if (element) {\n setTargetElement(element);\n } else {\n timeoutRef.current = setTimeout(checkTargetElement, 300);\n }\n };\n checkTargetElement();\n return () => {\n clearTimeout(timeoutRef.current);\n };\n }, [pathname, targetElement]);\n\n const fabs = useMemo(\n () => filterAndSortButtons(floatingButtons, pathname),\n [floatingButtons, pathname],\n );\n\n if (fabs?.length === 0) {\n return null;\n }\n\n let fabDiv;\n if (fabs.length > 1) {\n fabDiv = (\n <FABWithSubmenu className={fabButton[slot]} fabs={fabs} slot={slot} />\n );\n } else {\n fabDiv = (\n <div\n style={{\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n }}\n className={fabButton[slot]}\n id=\"floating-button\"\n data-testid=\"floating-button\"\n >\n <CustomFab\n actionButton={{ color: 'info', iconColor: 'white', ...fabs[0] }}\n t={t}\n />\n </div>\n );\n }\n return targetElement\n ? createPortal(fabDiv, targetElement)\n : createPortal(fabDiv, document.body);\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
import '../translations/index.esm.js';
|
|
3
|
+
import { globalFloatingActionButtonTranslationRef } from '../translations/ref.esm.js';
|
|
4
|
+
|
|
5
|
+
const useTranslation = () => useTranslationRef(globalFloatingActionButtonTranslationRef);
|
|
6
|
+
|
|
7
|
+
export { useTranslation };
|
|
8
|
+
//# sourceMappingURL=useTranslation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslation.esm.js","sources":["../../src/hooks/useTranslation.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 {\n useTranslationRef,\n TranslationFunction,\n} from '@backstage/core-plugin-api/alpha';\nimport { globalFloatingActionButtonTranslationRef } from '../translations';\n\nexport const useTranslation = (): {\n t: TranslationFunction<typeof globalFloatingActionButtonTranslationRef.T>;\n} => useTranslationRef(globalFloatingActionButtonTranslationRef);\n"],"names":[],"mappings":";;;;AAqBa,MAAA,cAAA,GAAiB,MAEzB,iBAAA,CAAkB,wCAAwC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
|
+
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Slot
|
|
@@ -25,6 +26,7 @@ declare enum Slot {
|
|
|
25
26
|
type FloatingActionButton = {
|
|
26
27
|
slot?: Slot;
|
|
27
28
|
label: string;
|
|
29
|
+
labelKey?: string;
|
|
28
30
|
showLabel?: boolean;
|
|
29
31
|
icon?: string | React.ReactElement;
|
|
30
32
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -33,6 +35,7 @@ type FloatingActionButton = {
|
|
|
33
35
|
onClick?: React.MouseEventHandler;
|
|
34
36
|
to?: string;
|
|
35
37
|
toolTip?: string;
|
|
38
|
+
toolTipKey?: string;
|
|
36
39
|
priority?: number;
|
|
37
40
|
visibleOnPaths?: string[];
|
|
38
41
|
excludeOnPaths?: string[];
|
|
@@ -55,6 +58,32 @@ type FABMountPoint = {
|
|
|
55
58
|
config?: FloatingActionButton;
|
|
56
59
|
};
|
|
57
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Translation reference for global floating action button plugin
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
declare const globalFloatingActionButtonTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"plugin.global-floating-action-button", {
|
|
66
|
+
readonly "fab.menu.tooltip": string;
|
|
67
|
+
readonly "fab.github.label": string;
|
|
68
|
+
readonly "fab.github.tooltip": string;
|
|
69
|
+
readonly "fab.create.label": string;
|
|
70
|
+
readonly "fab.create.tooltip": string;
|
|
71
|
+
readonly "fab.docs.label": string;
|
|
72
|
+
readonly "fab.docs.tooltip": string;
|
|
73
|
+
readonly "fab.apis.label": string;
|
|
74
|
+
readonly "fab.apis.tooltip": string;
|
|
75
|
+
readonly "fab.bulkImport.label": string;
|
|
76
|
+
readonly "fab.bulkImport.tooltip": string;
|
|
77
|
+
readonly "fab.quay.label": string;
|
|
78
|
+
readonly "fab.quay.tooltip": string;
|
|
79
|
+
}>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Translation Resource for Global Floating Action Button
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
declare const globalFloatingActionButtonTranslations: _backstage_core_plugin_api_alpha.TranslationResource<"plugin.global-floating-action-button">;
|
|
86
|
+
|
|
58
87
|
/**
|
|
59
88
|
* Global Floating Action Button Plugin
|
|
60
89
|
*
|
|
@@ -88,4 +117,4 @@ declare const DynamicGlobalFloatingActionButton: React.ComponentType;
|
|
|
88
117
|
*/
|
|
89
118
|
declare const NullComponent: React.ComponentType;
|
|
90
119
|
|
|
91
|
-
export { DynamicGlobalFloatingActionButton, type FABMountPoint, type FloatingActionButton, type FloatingActionButtonWithPositions, GlobalFloatingActionButton, NullComponent, Slot, dynamicGlobalFloatingActionButtonPlugin, globalFloatingActionButtonPlugin };
|
|
120
|
+
export { DynamicGlobalFloatingActionButton, type FABMountPoint, type FloatingActionButton, type FloatingActionButtonWithPositions, GlobalFloatingActionButton, NullComponent, Slot, dynamicGlobalFloatingActionButtonPlugin, globalFloatingActionButtonPlugin, globalFloatingActionButtonTranslationRef, globalFloatingActionButtonTranslations };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { unstable_ClassNameGenerator } from '@mui/material/className';
|
|
2
2
|
export { DynamicGlobalFloatingActionButton, GlobalFloatingActionButton, NullComponent, dynamicGlobalFloatingActionButtonPlugin, globalFloatingActionButtonPlugin } from './plugin.esm.js';
|
|
3
3
|
export { Slot } from './types.esm.js';
|
|
4
|
+
export { globalFloatingActionButtonTranslations } from './translations/index.esm.js';
|
|
5
|
+
export { globalFloatingActionButtonTranslationRef } from './translations/ref.esm.js';
|
|
4
6
|
|
|
5
7
|
unstable_ClassNameGenerator.configure((componentName) => {
|
|
6
8
|
return componentName.startsWith("v5-") ? componentName : `v5-${componentName}`;
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nClassNameGenerator.configure(componentName => {\n return componentName.startsWith('v5-')\n ? componentName\n : `v5-${componentName}`;\n});\n\nexport * from './plugin';\nexport * from './types';\n"],"names":["ClassNameGenerator"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nClassNameGenerator.configure(componentName => {\n return componentName.startsWith('v5-')\n ? componentName\n : `v5-${componentName}`;\n});\n\nexport * from './plugin';\nexport * from './types';\nexport * from './translations';\n"],"names":["ClassNameGenerator"],"mappings":";;;;;;AAkBAA,2BAAA,CAAmB,UAAU,CAAiB,aAAA,KAAA;AAC5C,EAAA,OAAO,cAAc,UAAW,CAAA,KAAK,CACjC,GAAA,aAAA,GACA,MAAM,aAAa,CAAA,CAAA;AACzB,CAAC,CAAA"}
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { createPlugin, createComponentExtension } from '@backstage/core-plugin-api';
|
|
2
|
+
export { globalFloatingActionButtonTranslations } from './translations/index.esm.js';
|
|
3
|
+
import { globalFloatingActionButtonTranslationRef } from './translations/ref.esm.js';
|
|
2
4
|
|
|
3
5
|
const globalFloatingActionButtonPlugin = createPlugin({
|
|
4
6
|
id: "global-floating-action-button"
|
|
5
7
|
});
|
|
6
8
|
const dynamicGlobalFloatingActionButtonPlugin = createPlugin({
|
|
7
|
-
id: "dynamic-global-floating-action-button"
|
|
9
|
+
id: "dynamic-global-floating-action-button",
|
|
10
|
+
__experimentalTranslations: {
|
|
11
|
+
availableLanguages: ["en", "de", "fr", "es"],
|
|
12
|
+
resources: [globalFloatingActionButtonTranslationRef]
|
|
13
|
+
}
|
|
8
14
|
});
|
|
9
15
|
const GlobalFloatingActionButton = globalFloatingActionButtonPlugin.provide(
|
|
10
16
|
createComponentExtension({
|
|
@@ -35,5 +41,5 @@ const NullComponent = dynamicGlobalFloatingActionButtonPlugin.provide(
|
|
|
35
41
|
})
|
|
36
42
|
);
|
|
37
43
|
|
|
38
|
-
export { DynamicGlobalFloatingActionButton, GlobalFloatingActionButton, NullComponent, dynamicGlobalFloatingActionButtonPlugin, globalFloatingActionButtonPlugin };
|
|
44
|
+
export { DynamicGlobalFloatingActionButton, GlobalFloatingActionButton, NullComponent, dynamicGlobalFloatingActionButtonPlugin, globalFloatingActionButtonPlugin, globalFloatingActionButtonTranslationRef };
|
|
39
45
|
//# sourceMappingURL=plugin.esm.js.map
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\n\n/**\n * Global Floating Action Button Plugin\n *\n * @public\n */\nexport const globalFloatingActionButtonPlugin = createPlugin({\n id: 'global-floating-action-button',\n});\n\n/**\n * Dynamic Global Floating Action Button Plugin\n *\n * @public\n */\nexport const dynamicGlobalFloatingActionButtonPlugin = createPlugin({\n id: 'dynamic-global-floating-action-button',\n});\n\n/**\n * Global Floating Action Button\n *\n * @public\n */\nexport const GlobalFloatingActionButton =\n globalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'GlobalFloatingActionButton',\n component: {\n lazy: () =>\n import('./components/GlobalFloatingActionButton').then(\n m => m.GlobalFloatingActionButton,\n ),\n },\n }),\n );\n\n/**\n * Dynamic Global Floating Action Button\n *\n * @public\n */\nexport const DynamicGlobalFloatingActionButton: React.ComponentType =\n dynamicGlobalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'DynamicGlobalFloatingActionButton',\n component: {\n lazy: () =>\n import('./components/DynamicGlobalFloatingActionButton').then(\n m => m.DynamicGlobalFloatingActionButton,\n ),\n },\n }),\n );\n\n/**\n * Null Component\n *\n * @public\n */\nexport const NullComponent: React.ComponentType =\n dynamicGlobalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'NullComponent',\n component: {\n lazy: () =>\n import('./components/NullComponent').then(m => m.NullComponent),\n },\n }),\n );\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { globalFloatingActionButtonTranslationRef } from './translations';\n\n/**\n * Global Floating Action Button Plugin\n *\n * @public\n */\nexport const globalFloatingActionButtonPlugin = createPlugin({\n id: 'global-floating-action-button',\n});\n\n/**\n * Dynamic Global Floating Action Button Plugin\n *\n * @public\n */\nexport const dynamicGlobalFloatingActionButtonPlugin = createPlugin({\n id: 'dynamic-global-floating-action-button',\n __experimentalTranslations: {\n availableLanguages: ['en', 'de', 'fr', 'es'],\n resources: [globalFloatingActionButtonTranslationRef],\n },\n} as any);\n\n/**\n * Global Floating Action Button\n *\n * @public\n */\nexport const GlobalFloatingActionButton =\n globalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'GlobalFloatingActionButton',\n component: {\n lazy: () =>\n import('./components/GlobalFloatingActionButton').then(\n m => m.GlobalFloatingActionButton,\n ),\n },\n }),\n );\n\n/**\n * Dynamic Global Floating Action Button\n *\n * @public\n */\nexport const DynamicGlobalFloatingActionButton: React.ComponentType =\n dynamicGlobalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'DynamicGlobalFloatingActionButton',\n component: {\n lazy: () =>\n import('./components/DynamicGlobalFloatingActionButton').then(\n m => m.DynamicGlobalFloatingActionButton,\n ),\n },\n }),\n );\n\n/**\n * Null Component\n *\n * @public\n */\nexport const NullComponent: React.ComponentType =\n dynamicGlobalFloatingActionButtonPlugin.provide(\n createComponentExtension({\n name: 'NullComponent',\n component: {\n lazy: () =>\n import('./components/NullComponent').then(m => m.NullComponent),\n },\n }),\n );\n\n/**\n * Translation resource for the global floating action button plugin\n *\n * @public\n */\nexport {\n globalFloatingActionButtonTranslations,\n globalFloatingActionButtonTranslationRef,\n} from './translations';\n"],"names":[],"mappings":";;;;AA2BO,MAAM,mCAAmC,YAAa,CAAA;AAAA,EAC3D,EAAI,EAAA;AACN,CAAC;AAOM,MAAM,0CAA0C,YAAa,CAAA;AAAA,EAClE,EAAI,EAAA,uCAAA;AAAA,EACJ,0BAA4B,EAAA;AAAA,IAC1B,kBAAoB,EAAA,CAAC,IAAM,EAAA,IAAA,EAAM,MAAM,IAAI,CAAA;AAAA,IAC3C,SAAA,EAAW,CAAC,wCAAwC;AAAA;AAExD,CAAQ;AAOD,MAAM,6BACX,gCAAiC,CAAA,OAAA;AAAA,EAC/B,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,4BAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,gDAAyC,CAAE,CAAA,IAAA;AAAA,QAChD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAOK,MAAM,oCACX,uCAAwC,CAAA,OAAA;AAAA,EACtC,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,mCAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,uDAAgD,CAAE,CAAA,IAAA;AAAA,QACvD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAOK,MAAM,gBACX,uCAAwC,CAAA,OAAA;AAAA,EACtC,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,mCAA4B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAClE,GACD;AACH;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
import { globalFloatingActionButtonTranslationRef } from './ref.esm.js';
|
|
3
|
+
|
|
4
|
+
const globalFloatingActionButtonTranslationDe = createTranslationMessages({
|
|
5
|
+
ref: globalFloatingActionButtonTranslationRef,
|
|
6
|
+
messages: {
|
|
7
|
+
"fab.create.label": "Erstellen",
|
|
8
|
+
"fab.create.tooltip": "Entit\xE4t erstellen",
|
|
9
|
+
"fab.docs.label": "Dokumentation",
|
|
10
|
+
"fab.docs.tooltip": "Dokumentation",
|
|
11
|
+
"fab.apis.label": "APIs",
|
|
12
|
+
"fab.apis.tooltip": "API-Dokumentation",
|
|
13
|
+
"fab.github.label": "GitHub",
|
|
14
|
+
"fab.github.tooltip": "GitHub-Repository",
|
|
15
|
+
"fab.bulkImport.label": "Bulk-Import",
|
|
16
|
+
"fab.bulkImport.tooltip": "Mehrere Repositories in einem Vorgang registrieren",
|
|
17
|
+
"fab.quay.label": "Quay",
|
|
18
|
+
"fab.quay.tooltip": "Quay Container Registry",
|
|
19
|
+
"fab.menu.tooltip": "Men\xFC"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { globalFloatingActionButtonTranslationDe as default };
|
|
24
|
+
//# sourceMappingURL=de.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de.esm.js","sources":["../../src/translations/de.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\n\nimport { globalFloatingActionButtonTranslationRef } from './ref';\n\nconst globalFloatingActionButtonTranslationDe = createTranslationMessages({\n ref: globalFloatingActionButtonTranslationRef,\n messages: {\n 'fab.create.label': 'Erstellen',\n 'fab.create.tooltip': 'Entität erstellen',\n 'fab.docs.label': 'Dokumentation',\n 'fab.docs.tooltip': 'Dokumentation',\n 'fab.apis.label': 'APIs',\n 'fab.apis.tooltip': 'API-Dokumentation',\n 'fab.github.label': 'GitHub',\n 'fab.github.tooltip': 'GitHub-Repository',\n 'fab.bulkImport.label': 'Bulk-Import',\n 'fab.bulkImport.tooltip':\n 'Mehrere Repositories in einem Vorgang registrieren',\n 'fab.quay.label': 'Quay',\n 'fab.quay.tooltip': 'Quay Container Registry',\n 'fab.menu.tooltip': 'Menü',\n },\n});\n\nexport default globalFloatingActionButtonTranslationDe;\n"],"names":[],"mappings":";;;AAoBA,MAAM,0CAA0C,yBAA0B,CAAA;AAAA,EACxE,GAAK,EAAA,wCAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,kBAAoB,EAAA,WAAA;AAAA,IACpB,oBAAsB,EAAA,sBAAA;AAAA,IACtB,gBAAkB,EAAA,eAAA;AAAA,IAClB,kBAAoB,EAAA,eAAA;AAAA,IACpB,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,mBAAA;AAAA,IACpB,kBAAoB,EAAA,QAAA;AAAA,IACpB,oBAAsB,EAAA,mBAAA;AAAA,IACtB,sBAAwB,EAAA,aAAA;AAAA,IACxB,wBACE,EAAA,oDAAA;AAAA,IACF,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,yBAAA;AAAA,IACpB,kBAAoB,EAAA;AAAA;AAExB,CAAC;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
import { globalFloatingActionButtonTranslationRef } from './ref.esm.js';
|
|
3
|
+
|
|
4
|
+
const globalFloatingActionButtonTranslationEs = createTranslationMessages({
|
|
5
|
+
ref: globalFloatingActionButtonTranslationRef,
|
|
6
|
+
messages: {
|
|
7
|
+
"fab.create.label": "Crear",
|
|
8
|
+
"fab.create.tooltip": "Crear entidad",
|
|
9
|
+
"fab.docs.label": "Documentaci\xF3n",
|
|
10
|
+
"fab.docs.tooltip": "Documentaci\xF3n",
|
|
11
|
+
"fab.apis.label": "APIs",
|
|
12
|
+
"fab.apis.tooltip": "Documentaci\xF3n de API",
|
|
13
|
+
"fab.github.label": "GitHub",
|
|
14
|
+
"fab.github.tooltip": "Repositorio de GitHub",
|
|
15
|
+
"fab.bulkImport.label": "Importaci\xF3n masiva",
|
|
16
|
+
"fab.bulkImport.tooltip": "Registrar m\xFAltiples repositorios de una vez",
|
|
17
|
+
"fab.quay.label": "Quay",
|
|
18
|
+
"fab.quay.tooltip": "Registro de contenedores Quay",
|
|
19
|
+
"fab.menu.tooltip": "Men\xFA"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { globalFloatingActionButtonTranslationEs as default };
|
|
24
|
+
//# sourceMappingURL=es.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"es.esm.js","sources":["../../src/translations/es.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\n\nimport { globalFloatingActionButtonTranslationRef } from './ref';\n\nconst globalFloatingActionButtonTranslationEs = createTranslationMessages({\n ref: globalFloatingActionButtonTranslationRef,\n messages: {\n 'fab.create.label': 'Crear',\n 'fab.create.tooltip': 'Crear entidad',\n 'fab.docs.label': 'Documentación',\n 'fab.docs.tooltip': 'Documentación',\n 'fab.apis.label': 'APIs',\n 'fab.apis.tooltip': 'Documentación de API',\n 'fab.github.label': 'GitHub',\n 'fab.github.tooltip': 'Repositorio de GitHub',\n 'fab.bulkImport.label': 'Importación masiva',\n 'fab.bulkImport.tooltip': 'Registrar múltiples repositorios de una vez',\n 'fab.quay.label': 'Quay',\n 'fab.quay.tooltip': 'Registro de contenedores Quay',\n 'fab.menu.tooltip': 'Menú',\n },\n});\n\nexport default globalFloatingActionButtonTranslationEs;\n"],"names":[],"mappings":";;;AAoBA,MAAM,0CAA0C,yBAA0B,CAAA;AAAA,EACxE,GAAK,EAAA,wCAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,kBAAoB,EAAA,OAAA;AAAA,IACpB,oBAAsB,EAAA,eAAA;AAAA,IACtB,gBAAkB,EAAA,kBAAA;AAAA,IAClB,kBAAoB,EAAA,kBAAA;AAAA,IACpB,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,yBAAA;AAAA,IACpB,kBAAoB,EAAA,QAAA;AAAA,IACpB,oBAAsB,EAAA,uBAAA;AAAA,IACtB,sBAAwB,EAAA,uBAAA;AAAA,IACxB,wBAA0B,EAAA,gDAAA;AAAA,IAC1B,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,+BAAA;AAAA,IACpB,kBAAoB,EAAA;AAAA;AAExB,CAAC;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
import { globalFloatingActionButtonTranslationRef } from './ref.esm.js';
|
|
3
|
+
|
|
4
|
+
const globalFloatingActionButtonTranslationFr = createTranslationMessages({
|
|
5
|
+
ref: globalFloatingActionButtonTranslationRef,
|
|
6
|
+
messages: {
|
|
7
|
+
"fab.create.label": "Cr\xE9er",
|
|
8
|
+
"fab.create.tooltip": "Cr\xE9er une entit\xE9",
|
|
9
|
+
"fab.docs.label": "Documentation",
|
|
10
|
+
"fab.docs.tooltip": "Documentation",
|
|
11
|
+
"fab.apis.label": "APIs",
|
|
12
|
+
"fab.apis.tooltip": "Documentation API",
|
|
13
|
+
"fab.github.label": "GitHub",
|
|
14
|
+
"fab.github.tooltip": "D\xE9p\xF4t GitHub",
|
|
15
|
+
"fab.bulkImport.label": "Import en lot",
|
|
16
|
+
"fab.bulkImport.tooltip": "Enregistrer plusieurs d\xE9p\xF4ts en une seule fois",
|
|
17
|
+
"fab.quay.label": "Quay",
|
|
18
|
+
"fab.quay.tooltip": "Registre de conteneurs Quay",
|
|
19
|
+
"fab.menu.tooltip": "Menu"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { globalFloatingActionButtonTranslationFr as default };
|
|
24
|
+
//# sourceMappingURL=fr.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fr.esm.js","sources":["../../src/translations/fr.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\n\nimport { globalFloatingActionButtonTranslationRef } from './ref';\n\nconst globalFloatingActionButtonTranslationFr = createTranslationMessages({\n ref: globalFloatingActionButtonTranslationRef,\n messages: {\n 'fab.create.label': 'Créer',\n 'fab.create.tooltip': 'Créer une entité',\n 'fab.docs.label': 'Documentation',\n 'fab.docs.tooltip': 'Documentation',\n 'fab.apis.label': 'APIs',\n 'fab.apis.tooltip': 'Documentation API',\n 'fab.github.label': 'GitHub',\n 'fab.github.tooltip': 'Dépôt GitHub',\n 'fab.bulkImport.label': 'Import en lot',\n 'fab.bulkImport.tooltip': 'Enregistrer plusieurs dépôts en une seule fois',\n 'fab.quay.label': 'Quay',\n 'fab.quay.tooltip': 'Registre de conteneurs Quay',\n 'fab.menu.tooltip': 'Menu',\n },\n});\n\nexport default globalFloatingActionButtonTranslationFr;\n"],"names":[],"mappings":";;;AAoBA,MAAM,0CAA0C,yBAA0B,CAAA;AAAA,EACxE,GAAK,EAAA,wCAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,kBAAoB,EAAA,UAAA;AAAA,IACpB,oBAAsB,EAAA,wBAAA;AAAA,IACtB,gBAAkB,EAAA,eAAA;AAAA,IAClB,kBAAoB,EAAA,eAAA;AAAA,IACpB,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,mBAAA;AAAA,IACpB,kBAAoB,EAAA,QAAA;AAAA,IACpB,oBAAsB,EAAA,oBAAA;AAAA,IACtB,sBAAwB,EAAA,eAAA;AAAA,IACxB,wBAA0B,EAAA,sDAAA;AAAA,IAC1B,gBAAkB,EAAA,MAAA;AAAA,IAClB,kBAAoB,EAAA,6BAAA;AAAA,IACpB,kBAAoB,EAAA;AAAA;AAExB,CAAC;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createTranslationResource } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
import { globalFloatingActionButtonTranslationRef } from './ref.esm.js';
|
|
3
|
+
|
|
4
|
+
const globalFloatingActionButtonTranslations = createTranslationResource(
|
|
5
|
+
{
|
|
6
|
+
ref: globalFloatingActionButtonTranslationRef,
|
|
7
|
+
translations: {
|
|
8
|
+
de: () => import('./de.esm.js'),
|
|
9
|
+
fr: () => import('./fr.esm.js'),
|
|
10
|
+
es: () => import('./es.esm.js')
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export { globalFloatingActionButtonTranslationRef, globalFloatingActionButtonTranslations };
|
|
16
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/translations/index.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createTranslationResource } from '@backstage/core-plugin-api/alpha';\n\nimport { globalFloatingActionButtonTranslationRef } from './ref';\n\n/**\n * Translation Resource for Global Floating Action Button\n * @public\n */\nexport const globalFloatingActionButtonTranslations = createTranslationResource(\n {\n ref: globalFloatingActionButtonTranslationRef,\n translations: {\n de: () => import('./de'),\n fr: () => import('./fr'),\n es: () => import('./es'),\n },\n },\n);\n\nexport { globalFloatingActionButtonTranslationRef };\n"],"names":[],"mappings":";;;AAwBO,MAAM,sCAAyC,GAAA,yBAAA;AAAA,EACpD;AAAA,IACE,GAAK,EAAA,wCAAA;AAAA,IACL,YAAc,EAAA;AAAA,MACZ,EAAA,EAAI,MAAM,OAAO,aAAM,CAAA;AAAA,MACvB,EAAA,EAAI,MAAM,OAAO,aAAM,CAAA;AAAA,MACvB,EAAA,EAAI,MAAM,OAAO,aAAM;AAAA;AACzB;AAEJ;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
|
|
3
|
+
const globalFloatingActionButtonMessages = {
|
|
4
|
+
fab: {
|
|
5
|
+
create: {
|
|
6
|
+
label: "Create",
|
|
7
|
+
tooltip: "Create entity"
|
|
8
|
+
},
|
|
9
|
+
docs: {
|
|
10
|
+
label: "Docs",
|
|
11
|
+
tooltip: "Documentation"
|
|
12
|
+
},
|
|
13
|
+
apis: {
|
|
14
|
+
label: "APIs",
|
|
15
|
+
tooltip: "API Documentation"
|
|
16
|
+
},
|
|
17
|
+
github: {
|
|
18
|
+
label: "GitHub",
|
|
19
|
+
tooltip: "GitHub Repository"
|
|
20
|
+
},
|
|
21
|
+
bulkImport: {
|
|
22
|
+
label: "Bulk Import",
|
|
23
|
+
tooltip: "Register multiple repositories in bulk"
|
|
24
|
+
},
|
|
25
|
+
quay: {
|
|
26
|
+
label: "Quay",
|
|
27
|
+
tooltip: "Quay Container Registry"
|
|
28
|
+
},
|
|
29
|
+
menu: {
|
|
30
|
+
tooltip: "Menu"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const globalFloatingActionButtonTranslationRef = createTranslationRef({
|
|
35
|
+
id: "plugin.global-floating-action-button",
|
|
36
|
+
messages: globalFloatingActionButtonMessages
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { globalFloatingActionButtonMessages, globalFloatingActionButtonTranslationRef };
|
|
40
|
+
//# sourceMappingURL=ref.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.esm.js","sources":["../../src/translations/ref.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nexport const globalFloatingActionButtonMessages = {\n fab: {\n create: {\n label: 'Create',\n tooltip: 'Create entity',\n },\n docs: {\n label: 'Docs',\n tooltip: 'Documentation',\n },\n apis: {\n label: 'APIs',\n tooltip: 'API Documentation',\n },\n github: {\n label: 'GitHub',\n tooltip: 'GitHub Repository',\n },\n bulkImport: {\n label: 'Bulk Import',\n tooltip: 'Register multiple repositories in bulk',\n },\n quay: {\n label: 'Quay',\n tooltip: 'Quay Container Registry',\n },\n menu: {\n tooltip: 'Menu',\n },\n },\n};\n\n/**\n * Translation reference for global floating action button plugin\n * @public\n */\nexport const globalFloatingActionButtonTranslationRef = createTranslationRef({\n id: 'plugin.global-floating-action-button',\n messages: globalFloatingActionButtonMessages,\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,kCAAqC,GAAA;AAAA,EAChD,GAAK,EAAA;AAAA,IACH,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA,QAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,KAAO,EAAA,MAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,KAAO,EAAA,MAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA,QAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,UAAY,EAAA;AAAA,MACV,KAAO,EAAA,aAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,KAAO,EAAA,MAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA;AACX;AAEJ;AAMO,MAAM,2CAA2C,oBAAqB,CAAA;AAAA,EAC3E,EAAI,EAAA,sCAAA;AAAA,EACJ,QAAU,EAAA;AACZ,CAAC;;;;"}
|
package/dist/types.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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/**\n * Slot\n *\n * @public\n */\nexport enum Slot {\n /**\n * Positions the floating action button in the bottom-right corner of the page\n */\n PAGE_END = 'page-end',\n /**\n * Positions the floating action button at the bottom center of the page\n */\n BOTTOM_LEFT = 'bottom-left',\n}\n\n/**\n * Floating Action Button\n *\n * @public\n */\nexport type FloatingActionButton = {\n slot?: Slot;\n label: string;\n showLabel?: boolean;\n icon?: string | React.ReactElement;\n size?: 'small' | 'medium' | 'large';\n color?:\n | 'default'\n | 'error'\n | 'info'\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning';\n iconColor?: string;\n onClick?: React.MouseEventHandler;\n to?: string;\n toolTip?: string;\n priority?: number;\n visibleOnPaths?: string[];\n excludeOnPaths?: string[];\n};\n\n/**\n * Floating Action Button With Positions\n *\n * @public\n */\nexport type FloatingActionButtonWithPositions = Array<{\n slot: Slot;\n actions: FloatingActionButton[];\n}>;\n\n/**\n * FAB Mount Point\n *\n * @public\n */\nexport type FABMountPoint = {\n config?: FloatingActionButton;\n};\n"],"names":["Slot"],"mappings":"AAqBY,IAAA,IAAA,qBAAAA,KAAL,KAAA;AAIL,EAAAA,MAAA,UAAW,CAAA,GAAA,UAAA;AAIX,EAAAA,MAAA,aAAc,CAAA,GAAA,aAAA;AARJ,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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/**\n * Slot\n *\n * @public\n */\nexport enum Slot {\n /**\n * Positions the floating action button in the bottom-right corner of the page\n */\n PAGE_END = 'page-end',\n /**\n * Positions the floating action button at the bottom center of the page\n */\n BOTTOM_LEFT = 'bottom-left',\n}\n\n/**\n * Floating Action Button\n *\n * @public\n */\nexport type FloatingActionButton = {\n slot?: Slot;\n label: string;\n labelKey?: string;\n showLabel?: boolean;\n icon?: string | React.ReactElement;\n size?: 'small' | 'medium' | 'large';\n color?:\n | 'default'\n | 'error'\n | 'info'\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning';\n iconColor?: string;\n onClick?: React.MouseEventHandler;\n to?: string;\n toolTip?: string;\n toolTipKey?: string;\n priority?: number;\n visibleOnPaths?: string[];\n excludeOnPaths?: string[];\n};\n\n/**\n * Floating Action Button With Positions\n *\n * @public\n */\nexport type FloatingActionButtonWithPositions = Array<{\n slot: Slot;\n actions: FloatingActionButton[];\n}>;\n\n/**\n * FAB Mount Point\n *\n * @public\n */\nexport type FABMountPoint = {\n config?: FloatingActionButton;\n};\n"],"names":["Slot"],"mappings":"AAqBY,IAAA,IAAA,qBAAAA,KAAL,KAAA;AAIL,EAAAA,MAAA,UAAW,CAAA,GAAA,UAAA;AAIX,EAAAA,MAAA,aAAc,CAAA,GAAA,aAAA;AARJ,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const getTranslatedTextWithFallback = (t, translationKey, fallbackText) => {
|
|
2
|
+
if (!translationKey) {
|
|
3
|
+
return fallbackText;
|
|
4
|
+
}
|
|
5
|
+
const translation = t(translationKey, {});
|
|
6
|
+
return translation !== translationKey ? translation : fallbackText;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { getTranslatedTextWithFallback };
|
|
10
|
+
//# sourceMappingURL=translationUtils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translationUtils.esm.js","sources":["../../src/utils/translationUtils.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { TranslationFunction } from '@backstage/core-plugin-api/alpha';\nimport { globalFloatingActionButtonTranslationRef } from '../translations';\n\n/**\n * Utility function to get translated text with fallback to original text\n *\n * @param t - Translation function\n * @param translationKey - Optional translation key to look up\n * @param fallbackText - Text to display if translation key is not provided or translation is not found\n * @returns Translated text or fallback text\n */\nexport const getTranslatedTextWithFallback = (\n t: TranslationFunction<typeof globalFloatingActionButtonTranslationRef.T>,\n translationKey: string | undefined,\n fallbackText: string,\n): string => {\n if (!translationKey) {\n return fallbackText;\n }\n\n const translation = t(translationKey as keyof typeof t, {});\n return translation !== translationKey ? translation : fallbackText;\n};\n"],"names":[],"mappings":"AA0BO,MAAM,6BAAgC,GAAA,CAC3C,CACA,EAAA,cAAA,EACA,YACW,KAAA;AACX,EAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,IAAO,OAAA,YAAA;AAAA;AAGT,EAAA,MAAM,WAAc,GAAA,CAAA,CAAE,cAAkC,EAAA,EAAE,CAAA;AAC1D,EAAO,OAAA,WAAA,KAAgB,iBAAiB,WAAc,GAAA,YAAA;AACxD;;;;"}
|