@pautena/react-design-system 0.7.4 → 0.8.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.
Files changed (64) hide show
  1. package/dist/cjs/index.js +4 -4
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/data-display/label/label.d.ts +6 -2
  4. package/dist/cjs/types/components/dialogs/bootstrap-dialog/bootstrap-dialog.d.ts +1 -1
  5. package/dist/cjs/types/components/dialogs/confirm-dialog/confirm-dialog.d.ts +2 -1
  6. package/dist/cjs/types/components/dialogs/dialog.types.d.ts +2 -0
  7. package/dist/cjs/types/components/navigation/index.d.ts +2 -1
  8. package/dist/cjs/types/components/navigation/tab-card/tab-card-panel.d.ts +7 -0
  9. package/dist/cjs/types/components/navigation/tab-card/tab-card.context.d.ts +3 -0
  10. package/dist/cjs/types/components/navigation/tab-card/tab-card.d.ts +11 -0
  11. package/dist/cjs/types/components/navigation/tab-card/tab-card.dummy.d.ts +14 -0
  12. package/dist/esm/index.js +4 -4
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/types/components/data-display/label/label.d.ts +6 -2
  15. package/dist/esm/types/components/dialogs/bootstrap-dialog/bootstrap-dialog.d.ts +1 -1
  16. package/dist/esm/types/components/dialogs/confirm-dialog/confirm-dialog.d.ts +2 -1
  17. package/dist/esm/types/components/dialogs/dialog.types.d.ts +2 -0
  18. package/dist/esm/types/components/navigation/index.d.ts +2 -1
  19. package/dist/esm/types/components/navigation/tab-card/tab-card-panel.d.ts +7 -0
  20. package/dist/esm/types/components/navigation/tab-card/tab-card.context.d.ts +3 -0
  21. package/dist/esm/types/components/navigation/tab-card/tab-card.d.ts +11 -0
  22. package/dist/esm/types/components/navigation/tab-card/tab-card.dummy.d.ts +14 -0
  23. package/dist/index.d.ts +23 -10
  24. package/package.json +1 -1
  25. package/src/components/data-display/board/board.tsx +13 -3
  26. package/src/components/data-display/header/header.stories.tsx +1 -1
  27. package/src/components/data-display/label/label.test.tsx +3 -3
  28. package/src/components/data-display/label/label.tsx +45 -17
  29. package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.test.tsx +34 -0
  30. package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.tsx +4 -2
  31. package/src/components/dialogs/confirm-dialog/confirm-dialog.stories.tsx +13 -1
  32. package/src/components/dialogs/confirm-dialog/confirm-dialog.test.tsx +35 -0
  33. package/src/components/dialogs/confirm-dialog/confirm-dialog.tsx +17 -1
  34. package/src/components/dialogs/dialog.types.ts +2 -0
  35. package/src/components/drawers/drawer-item/drawer-item.test.tsx +1 -2
  36. package/src/components/navigation/index.ts +2 -1
  37. package/src/components/navigation/tab-card/tab-card-panel.tsx +19 -0
  38. package/src/components/navigation/tab-card/tab-card.context.tsx +7 -0
  39. package/src/components/navigation/tab-card/tab-card.dummy.tsx +34 -0
  40. package/src/components/navigation/{tab/tab-card → tab-card}/tab-card.stories.tsx +2 -2
  41. package/src/components/navigation/tab-card/tab-card.test.tsx +74 -0
  42. package/src/components/navigation/tab-card/tab-card.tsx +81 -0
  43. package/src/components/navigation/{tab/tab-panel → tab-panel}/tab-panel.test.tsx +1 -1
  44. package/src/components/value-displays/value-rating/value-rating.tsx +1 -2
  45. package/src/generators/object-details/object-details.tsx +0 -2
  46. package/dist/cjs/types/components/navigation/tab/index.d.ts +0 -2
  47. package/dist/cjs/types/components/navigation/tab/tab-card/tab-card.d.ts +0 -5
  48. package/dist/cjs/types/components/navigation/tab/tab-card/tab-card.dummy.d.ts +0 -6
  49. package/dist/esm/types/components/navigation/tab/index.d.ts +0 -2
  50. package/dist/esm/types/components/navigation/tab/tab-card/tab-card.d.ts +0 -5
  51. package/dist/esm/types/components/navigation/tab/tab-card/tab-card.dummy.d.ts +0 -6
  52. package/src/components/navigation/tab/index.ts +0 -2
  53. package/src/components/navigation/tab/tab-card/tab-card.dummy.tsx +0 -30
  54. package/src/components/navigation/tab/tab-card/tab-card.test.tsx +0 -53
  55. package/src/components/navigation/tab/tab-card/tab-card.tsx +0 -27
  56. /package/dist/cjs/types/components/navigation/{tab/tab-card → tab-card}/index.d.ts +0 -0
  57. /package/dist/cjs/types/components/navigation/{tab/tab-panel → tab-panel}/index.d.ts +0 -0
  58. /package/dist/cjs/types/components/navigation/{tab/tab-panel → tab-panel}/tab-panel.d.ts +0 -0
  59. /package/dist/esm/types/components/navigation/{tab/tab-card → tab-card}/index.d.ts +0 -0
  60. /package/dist/esm/types/components/navigation/{tab/tab-panel → tab-panel}/index.d.ts +0 -0
  61. /package/dist/esm/types/components/navigation/{tab/tab-panel → tab-panel}/tab-panel.d.ts +0 -0
  62. /package/src/components/navigation/{tab/tab-card → tab-card}/index.ts +0 -0
  63. /package/src/components/navigation/{tab/tab-panel → tab-panel}/index.ts +0 -0
  64. /package/src/components/navigation/{tab/tab-panel → tab-panel}/tab-panel.tsx +0 -0
@@ -1,5 +1,5 @@
1
1
  import { SxProps, Theme } from "@mui/material";
2
- export type LabelVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error";
2
+ export type LabelVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error" | "success";
3
3
  export declare const labelClasses: {
4
4
  root: string;
5
5
  };
@@ -16,8 +16,12 @@ export interface LabelProps {
16
16
  * Custom styles
17
17
  */
18
18
  sx?: SxProps<Theme>;
19
+ /**
20
+ * Show the text as uppercase
21
+ */
22
+ textTransform?: "none" | "capitalize" | "uppercase";
19
23
  }
20
24
  /**
21
25
  * Compact element to represent a text
22
26
  */
23
- export declare const Label: ({ text, variant, sx }: LabelProps) => JSX.Element;
27
+ export declare const Label: ({ text, variant, textTransform, sx, }: LabelProps) => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { BootstrapDialogDialogProps } from "../dialog.types";
2
- export declare const BootstrapDialog: ({ open, title, component, componentProps, disabled, actions, children, loading, cancelable, callCloseWhenCancel, acceptable, acceptText, cancelText, onAccept, onCancel, onClose, acceptType, }: BootstrapDialogDialogProps) => JSX.Element;
2
+ export declare const BootstrapDialog: ({ open, title, component, componentProps, disabled, disableAccept, disableCancel, actions, children, loading, cancelable, callCloseWhenCancel, acceptable, acceptText, cancelText, onAccept, onCancel, onClose, acceptType, }: BootstrapDialogDialogProps) => JSX.Element;
@@ -3,8 +3,9 @@ type OmitBaseDialogProps = "cancelable" | "acceptable" | "onAccept" | "onCancel"
3
3
  export interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {
4
4
  confirmText?: string;
5
5
  canceText?: string;
6
+ passphrase?: string;
6
7
  onCancel: () => void;
7
8
  onConfirm: () => void;
8
9
  }
9
- export declare const ConfirmDialog: ({ open, title, loading, disabled, confirmText, cancelText, children, onConfirm, onCancel, }: ConfirmDialogProps) => JSX.Element;
10
+ export declare const ConfirmDialog: ({ open, title, loading, disabled, confirmText, cancelText, passphrase, children, onConfirm, onCancel, }: ConfirmDialogProps) => JSX.Element;
10
11
  export {};
@@ -11,6 +11,8 @@ export type BootstrapDialogDialogProps = PropsWithChildren<{
11
11
  title: string;
12
12
  loading?: boolean;
13
13
  disabled?: boolean;
14
+ disableAccept?: boolean;
15
+ disableCancel?: boolean;
14
16
  cancelable?: boolean;
15
17
  acceptable?: boolean;
16
18
  callCloseWhenCancel?: boolean;
@@ -1 +1,2 @@
1
- export * from "./tab";
1
+ export * from "./tab-card";
2
+ export * from "./tab-panel";
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ import { SxProps, Theme } from "@mui/material";
3
+ export type TabCardPanelProps = PropsWithChildren<{
4
+ index: number | number[];
5
+ sx?: SxProps<Theme>;
6
+ }>;
7
+ export declare const TabCardPanel: ({ index, children, sx }: TabCardPanelProps) => JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export declare const TabCardContext: import("react").Context<[number, Dispatch<SetStateAction<number>>]>;
3
+ export declare const TabCardContextProvider: import("react").Provider<[number, Dispatch<SetStateAction<number>>]>;
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren, ReactElement } from "react";
2
+ export interface TabData {
3
+ text: string;
4
+ icon?: ReactElement;
5
+ }
6
+ export type TabCardProps = PropsWithChildren<{
7
+ tabs: TabData[];
8
+ initialTab?: number;
9
+ onChangeTab?: (tab: TabData, index: number) => void;
10
+ }>;
11
+ export declare const TabCard: ({ children, tabs, initialTab, onChangeTab, }: TabCardProps) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { TabData } from "./tab-card";
2
+ export declare const DummyTabs: ({
3
+ text: string;
4
+ icon?: undefined;
5
+ } | {
6
+ text: string;
7
+ icon: JSX.Element;
8
+ })[];
9
+ export interface TabCardDummyProps {
10
+ tabs: TabData[];
11
+ initialTab: number;
12
+ onChangeTab: (tab: TabData, index: number) => void;
13
+ }
14
+ export declare function TabCardDummy({ tabs, initialTab, onChangeTab }: TabCardDummyProps): JSX.Element;
package/dist/index.d.ts CHANGED
@@ -196,7 +196,7 @@ interface BulletProps {
196
196
  */
197
197
  declare const Bullet: ({ variant, sx }: BulletProps) => JSX.Element;
198
198
 
199
- type LabelVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error";
199
+ type LabelVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error" | "success";
200
200
  declare const labelClasses: {
201
201
  root: string;
202
202
  };
@@ -213,11 +213,15 @@ interface LabelProps {
213
213
  * Custom styles
214
214
  */
215
215
  sx?: SxProps<Theme>;
216
+ /**
217
+ * Show the text as uppercase
218
+ */
219
+ textTransform?: "none" | "capitalize" | "uppercase";
216
220
  }
217
221
  /**
218
222
  * Compact element to represent a text
219
223
  */
220
- declare const Label: ({ text, variant, sx }: LabelProps) => JSX.Element;
224
+ declare const Label: ({ text, variant, textTransform, sx, }: LabelProps) => JSX.Element;
221
225
 
222
226
  type HeaderPreset = PropTypes.Color | "transparent";
223
227
  type HeaderActionVariant = "text" | "outlined" | "contained";
@@ -511,17 +515,23 @@ type TextFieldProps = TextFieldProps$1 & {
511
515
  };
512
516
  declare const TextField: ({ id: overrideId, label, InputLabelProps, InputProps, fetching, loading, helperText, hexColor, size, fullWidth, sx, ...rest }: TextFieldProps) => JSX.Element;
513
517
 
518
+ interface TabData {
519
+ text: string;
520
+ icon?: ReactElement;
521
+ }
522
+ type TabCardProps = PropsWithChildren<{
523
+ tabs: TabData[];
524
+ initialTab?: number;
525
+ onChangeTab?: (tab: TabData, index: number) => void;
526
+ }>;
527
+ declare const TabCard: ({ children, tabs, initialTab, onChangeTab, }: TabCardProps) => JSX.Element;
528
+
514
529
  interface TabPanelProps {
515
530
  children?: React__default.ReactNode;
516
531
  index: number | number[];
517
532
  }
518
533
  declare function TabPanel({ children, index }: TabPanelProps): JSX.Element;
519
534
 
520
- type TabCardProps = PropsWithChildren<{
521
- tabs: string[];
522
- }>;
523
- declare const TabCard: ({ children, tabs }: TabCardProps) => JSX.Element;
524
-
525
535
  type Order = "asc" | "desc";
526
536
  interface HeadCell<T> {
527
537
  disablePadding: boolean;
@@ -634,6 +644,8 @@ type BootstrapDialogDialogProps = PropsWithChildren<{
634
644
  title: string;
635
645
  loading?: boolean;
636
646
  disabled?: boolean;
647
+ disableAccept?: boolean;
648
+ disableCancel?: boolean;
637
649
  cancelable?: boolean;
638
650
  acceptable?: boolean;
639
651
  callCloseWhenCancel?: boolean;
@@ -652,10 +664,11 @@ type OmitBaseDialogProps$1 = "cancelable" | "acceptable" | "onAccept" | "onCance
652
664
  interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps$1> {
653
665
  confirmText?: string;
654
666
  canceText?: string;
667
+ passphrase?: string;
655
668
  onCancel: () => void;
656
669
  onConfirm: () => void;
657
670
  }
658
- declare const ConfirmDialog: ({ open, title, loading, disabled, confirmText, cancelText, children, onConfirm, onCancel, }: ConfirmDialogProps) => JSX.Element;
671
+ declare const ConfirmDialog: ({ open, title, loading, disabled, confirmText, cancelText, passphrase, children, onConfirm, onCancel, }: ConfirmDialogProps) => JSX.Element;
659
672
 
660
673
  type OmitBaseDialogProps = "cancelable" | "acceptable" | "onAccept" | "onCancel" | "onClose" | "actions" | "callCloseWhenCancel" | "component" | "acceptType";
661
674
  interface FormDialogProps<T> extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {
@@ -666,7 +679,7 @@ interface FormDialogProps<T> extends Omit<BootstrapDialogDialogProps, OmitBaseDi
666
679
  }
667
680
  declare const FormDialog: <T>({ open, title, loading, disabled, submitText, cancelText, children, onSubmit, onCancel, }: FormDialogProps<T>) => JSX.Element;
668
681
 
669
- declare const BootstrapDialog: ({ open, title, component, componentProps, disabled, actions, children, loading, cancelable, callCloseWhenCancel, acceptable, acceptText, cancelText, onAccept, onCancel, onClose, acceptType, }: BootstrapDialogDialogProps) => JSX.Element;
682
+ declare const BootstrapDialog: ({ open, title, component, componentProps, disabled, disableAccept, disableCancel, actions, children, loading, cancelable, callCloseWhenCancel, acceptable, acceptText, cancelText, onAccept, onCancel, onClose, acceptType, }: BootstrapDialogDialogProps) => JSX.Element;
670
683
 
671
684
  declare const useDialog: (intialOpen?: boolean) => {
672
685
  isOpen: boolean;
@@ -1001,4 +1014,4 @@ type TabProviderProps = PropsWithChildren<{
1001
1014
  }>;
1002
1015
  declare const TabProvider: ({ children, initialValue }: TabProviderProps) => JSX.Element;
1003
1016
 
1004
- export { ArrayFieldType, ArrayGroupField, ArrayInstanceType, Autocomplete, AutocompleteProps, BaseFieldType, BaseValueProps, BasicModelInstance, Board, BoardProps, BootstrapDialog, BootstrapDialogDialogProps, Bullet, BulletProps, BulletVariant, CenterContainer, CenterContainerProps, ConfirmDialog, ConfirmDialogProps, Content, ContentComponent, ContentElement, ContentPlaceholder, ContentPlaceholderProps, ContentProps, DefaultPlaceholder, DialogAction, Drawer, DrawerAppBar, DrawerAppBarComponent, DrawerAppBarElement, DrawerAppBarProps, DrawerComponent, DrawerContent, DrawerContentComponent, DrawerContentElement, DrawerContentProps, DrawerContext, DrawerContextProps, DrawerElement, DrawerHeader, DrawerItemAvatar, DrawerItemBullet, DrawerItemLabel, DrawerLayout, DrawerLayoutProps, DrawerMain, DrawerMainProps, DrawerNavigation, DrawerNavigationItem, DrawerNavigationItemCollapsable, DrawerNavigationItemLink, DrawerNavigationSection, DrawerProps, DrawerProvider, DrawerProviderProps, DrawerSection, DrawerSectionProps, DrawerSize, DrawerState, DrawerSubheader, DrawerSubheaderProps, DrawerVariant, EditInputType, EditableValueProps, EnhancedRemoteTable, EnhancedRemoteTableProps, EnhancedTable, EnhancedTableHead, ExpandableAlert, ExpandableAlertProps, FieldType, FormDialog, FormDialogProps, GroupField, GroupInstanceType, GroupValueCard, GroupValueCardProps, HeadCell, Header, HeaderAction, HeaderActionVariant, HeaderBreadcrumb, HeaderComponent, HeaderElement, HeaderLayout, HeaderLayoutError, HeaderLayoutProps, HeaderNavigationButton, HeaderPreset, HeaderProps, HeaderTab, IdleRequest, Label, LabelProps, LabelVariant, LoadingArea, LoadingRequest, LoremIpsumPlaceholder, LoremIpsumPlaceholderProps, Markdown, MarkdownProps, Model, ModelField, ModelFieldTypes, ModelForm, ModelFormProps, ModelRouter, ModelRouterProps, Notification, NotificationCenterContext, NotificationCenterProps, NotificationCenterProvider, NotificationCenterProviderProps, NotificationCenterProviderUndefinedError, NotifyWhenValueChangesOptions, ObjectDetails, ObjectDetailsProps, Order, Placeholder, PlaceholderAction, PlaceholderIcon, PlaceholderIconArgs, PlaceholderProps, QueryContainer, QueryContainerError, QueryContainerProps, QueryContainerSuccess, RequestState, Select, SelectProps, SelectSize, SignIn, SignInProps, SingleFieldType, SkeletonCard, SkeletonCardProps, SkeletonGrid, SkeletonGridProps, SuccessRequest, TabCard, TabCardProps, TabContext, TabContextProvider, TabPanel, TabProvider, TableList, TableListProps, TableRowOption, TextField, TextFieldProps, UndefinedProvider, ValueBoolean, ValueBooleanProps, ValueCard, ValueCardProps, ValueDatetime, ValueDatetimeProps, ValueEditButton, ValueEditButtonProps, ValueEditButtons, ValueEditButtonsProps, ValueItem, ValueItemComponent, ValueItemElement, ValueItemProps, ValueRating, ValueRatingProps, ValueText, ValueTextProps, bulletClasses, getDrawerItemColors, getFormData, getRandomItem, labelClasses, markdownDefaultOptions, newArrayWithSize, newBreakpointsCounter, newInstanceFromValuesOrZeroValue, useDialog, useDrawer, useEditableValueDisplay, useGetDefaultThemeColor, useNotificationCenter, useNotifyWhenValueChanges, useTab, valueItemClasses };
1017
+ export { ArrayFieldType, ArrayGroupField, ArrayInstanceType, Autocomplete, AutocompleteProps, BaseFieldType, BaseValueProps, BasicModelInstance, Board, BoardProps, BootstrapDialog, BootstrapDialogDialogProps, Bullet, BulletProps, BulletVariant, CenterContainer, CenterContainerProps, ConfirmDialog, ConfirmDialogProps, Content, ContentComponent, ContentElement, ContentPlaceholder, ContentPlaceholderProps, ContentProps, DefaultPlaceholder, DialogAction, Drawer, DrawerAppBar, DrawerAppBarComponent, DrawerAppBarElement, DrawerAppBarProps, DrawerComponent, DrawerContent, DrawerContentComponent, DrawerContentElement, DrawerContentProps, DrawerContext, DrawerContextProps, DrawerElement, DrawerHeader, DrawerItemAvatar, DrawerItemBullet, DrawerItemLabel, DrawerLayout, DrawerLayoutProps, DrawerMain, DrawerMainProps, DrawerNavigation, DrawerNavigationItem, DrawerNavigationItemCollapsable, DrawerNavigationItemLink, DrawerNavigationSection, DrawerProps, DrawerProvider, DrawerProviderProps, DrawerSection, DrawerSectionProps, DrawerSize, DrawerState, DrawerSubheader, DrawerSubheaderProps, DrawerVariant, EditInputType, EditableValueProps, EnhancedRemoteTable, EnhancedRemoteTableProps, EnhancedTable, EnhancedTableHead, ExpandableAlert, ExpandableAlertProps, FieldType, FormDialog, FormDialogProps, GroupField, GroupInstanceType, GroupValueCard, GroupValueCardProps, HeadCell, Header, HeaderAction, HeaderActionVariant, HeaderBreadcrumb, HeaderComponent, HeaderElement, HeaderLayout, HeaderLayoutError, HeaderLayoutProps, HeaderNavigationButton, HeaderPreset, HeaderProps, HeaderTab, IdleRequest, Label, LabelProps, LabelVariant, LoadingArea, LoadingRequest, LoremIpsumPlaceholder, LoremIpsumPlaceholderProps, Markdown, MarkdownProps, Model, ModelField, ModelFieldTypes, ModelForm, ModelFormProps, ModelRouter, ModelRouterProps, Notification, NotificationCenterContext, NotificationCenterProps, NotificationCenterProvider, NotificationCenterProviderProps, NotificationCenterProviderUndefinedError, NotifyWhenValueChangesOptions, ObjectDetails, ObjectDetailsProps, Order, Placeholder, PlaceholderAction, PlaceholderIcon, PlaceholderIconArgs, PlaceholderProps, QueryContainer, QueryContainerError, QueryContainerProps, QueryContainerSuccess, RequestState, Select, SelectProps, SelectSize, SignIn, SignInProps, SingleFieldType, SkeletonCard, SkeletonCardProps, SkeletonGrid, SkeletonGridProps, SuccessRequest, TabCard, TabCardProps, TabContext, TabContextProvider, TabData, TabPanel, TabProvider, TableList, TableListProps, TableRowOption, TextField, TextFieldProps, UndefinedProvider, ValueBoolean, ValueBooleanProps, ValueCard, ValueCardProps, ValueDatetime, ValueDatetimeProps, ValueEditButton, ValueEditButtonProps, ValueEditButtons, ValueEditButtonsProps, ValueItem, ValueItemComponent, ValueItemElement, ValueItemProps, ValueRating, ValueRatingProps, ValueText, ValueTextProps, bulletClasses, getDrawerItemColors, getFormData, getRandomItem, labelClasses, markdownDefaultOptions, newArrayWithSize, newBreakpointsCounter, newInstanceFromValuesOrZeroValue, useDialog, useDrawer, useEditableValueDisplay, useGetDefaultThemeColor, useNotificationCenter, useNotifyWhenValueChanges, useTab, valueItemClasses };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pautena/react-design-system",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "My custom design system on top of MUI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -48,10 +48,20 @@ export const Board = ({
48
48
  const markdown = markdownProps && <Markdown content={markdownProps} />;
49
49
 
50
50
  return (
51
- <Paper sx={{ pl: 2, pr: 4, py: 1, backgroundColor: blueGrey[800], color: "white", ...sx }}>
51
+ <Paper
52
+ sx={{
53
+ position: "relative",
54
+ pl: 2,
55
+ pr: 4,
56
+ py: 1,
57
+ backgroundColor: blueGrey[800],
58
+ color: "white",
59
+ ...sx,
60
+ }}
61
+ >
52
62
  <Box display="flex" flexDirection="row">
53
63
  <Box width={1}>{children || markdown || content}</Box>
54
- <Box sx={{ position: "absolute", top: themeSpacing(2), right: themeSpacing(2) }}>
64
+ <Box sx={{ position: "absolute", top: themeSpacing(0.5), right: themeSpacing(0.5) }}>
55
65
  {copyContent && (
56
66
  <IconButton
57
67
  aria-label="copy board content"
@@ -59,7 +69,7 @@ export const Board = ({
59
69
  onClick={() => navigator.clipboard.writeText(copyContent)}
60
70
  >
61
71
  <Tooltip title="Copy">
62
- <ContentCopyIcon sx={{ fontSize: typography.pxToRem(22) }} />
72
+ <ContentCopyIcon sx={{ fontSize: typography.pxToRem(18) }} />
63
73
  </Tooltip>
64
74
  </IconButton>
65
75
  )}
@@ -7,7 +7,7 @@ import React from "react";
7
7
  import { TabProvider } from "~/providers";
8
8
  import { Content } from "~/components/containers";
9
9
  import { Box, Typography } from "@mui/material";
10
- import { TabPanel } from "~/components/navigation/tab/tab-panel";
10
+ import { TabPanel } from "~/components/navigation/tab-panel";
11
11
  import { Route, Routes, useLocation } from "react-router-dom";
12
12
 
13
13
  export default {
@@ -10,13 +10,13 @@ describe("Label", () => {
10
10
  it("renders the label text", () => {
11
11
  renderComponent();
12
12
 
13
- expect(screen.getByText("LOREM IPSUM")).toBeInTheDocument();
13
+ expect(screen.getByText("lorem ipsum")).toBeInTheDocument();
14
14
  });
15
15
 
16
16
  it("renders as default without a variant", () => {
17
17
  renderComponent(undefined);
18
18
 
19
- expect(screen.getByRole("label")).toHaveAttribute("aria-describedby", "default");
19
+ expect(screen.getByRole("label", { name: /default/i })).toBeVisible();
20
20
  });
21
21
 
22
22
  it.each([["primary"], ["secondary"], ["default"], ["info"], ["warning"], ["error"]])(
@@ -24,7 +24,7 @@ describe("Label", () => {
24
24
  (variant: string) => {
25
25
  renderComponent(variant as LabelVariant);
26
26
 
27
- expect(screen.getByRole("label")).toHaveAttribute("aria-describedby", variant);
27
+ expect(screen.getByRole("label", { name: `lorem ipsum ${variant} label` })).toBeVisible();
28
28
  },
29
29
  );
30
30
  });
@@ -1,7 +1,14 @@
1
- import { Box, SxProps, Theme, Typography, useTheme } from "@mui/material";
1
+ import { Box, SxProps, Theme, useTheme } from "@mui/material";
2
2
  import React from "react";
3
3
 
4
- export type LabelVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error";
4
+ export type LabelVariant =
5
+ | "primary"
6
+ | "secondary"
7
+ | "default"
8
+ | "info"
9
+ | "warning"
10
+ | "error"
11
+ | "success";
5
12
 
6
13
  export const labelClasses = {
7
14
  root: "RdsLabel-root",
@@ -21,21 +28,32 @@ export interface LabelProps {
21
28
  * Custom styles
22
29
  */
23
30
  sx?: SxProps<Theme>;
31
+
32
+ /**
33
+ * Show the text as uppercase
34
+ */
35
+ textTransform?: "none" | "capitalize" | "uppercase";
24
36
  }
25
37
 
26
38
  /**
27
39
  * Compact element to represent a text
28
40
  */
29
- export const Label = ({ text, variant = "default", sx }: LabelProps) => {
30
- const { palette } = useTheme();
41
+ export const Label = ({
42
+ text,
43
+ variant = "default",
44
+ textTransform = "capitalize",
45
+ sx,
46
+ }: LabelProps) => {
47
+ const { palette, typography } = useTheme();
31
48
 
32
49
  const backgroundColor: Record<LabelVariant, string> = {
33
50
  default: palette.mode === "light" ? palette.grey[100] : palette.grey[900],
34
- primary: palette.primary.main,
35
- secondary: palette.secondary.main,
36
- info: palette.info.main,
37
- warning: palette.warning.main,
38
- error: palette.error.main,
51
+ primary: palette.primary.light,
52
+ secondary: palette.secondary.light,
53
+ info: palette.info.light,
54
+ warning: palette.warning.light,
55
+ error: palette.error.light,
56
+ success: palette.success.light,
39
57
  };
40
58
 
41
59
  const textColor: Record<LabelVariant, string> = {
@@ -45,21 +63,31 @@ export const Label = ({ text, variant = "default", sx }: LabelProps) => {
45
63
  info: palette.info.contrastText,
46
64
  warning: palette.warning.contrastText,
47
65
  error: palette.error.contrastText,
66
+ success: palette.success.contrastText,
48
67
  };
49
68
 
50
69
  return (
51
70
  <Box
52
- px={1}
53
- sx={{ backgroundColor: backgroundColor[variant], ...sx }}
54
- borderRadius={1}
71
+ height={24}
72
+ minWidth={22}
73
+ display="inline-flex"
74
+ justifyContent="center"
75
+ alignItems="center"
76
+ bgcolor={backgroundColor[variant]}
55
77
  color={textColor[variant]}
56
- className={labelClasses.root}
78
+ fontSize={typography.caption.fontSize}
79
+ fontWeight={typography.fontWeightBold}
80
+ lineHeight={0}
81
+ textTransform={textTransform}
82
+ whiteSpace="nowrap"
83
+ borderRadius={2}
57
84
  role="label"
58
- aria-describedby={variant}
85
+ aria-label={`${text} ${variant} label`}
86
+ py={0}
87
+ px={1}
88
+ sx={{ cursor: "default", ...sx }}
59
89
  >
60
- <Typography variant="caption" fontWeight={700}>
61
- {text.toUpperCase()}
62
- </Typography>
90
+ {text}
63
91
  </Box>
64
92
  );
65
93
  };
@@ -9,6 +9,8 @@ import { vi } from "vitest";
9
9
  interface DialogRenderArgs {
10
10
  open: boolean;
11
11
  disabled?: boolean;
12
+ disableCancel?: boolean;
13
+ disableAccept?: boolean;
12
14
  cancelable?: boolean;
13
15
  acceptable?: boolean;
14
16
  callCloseWhenCancel?: boolean;
@@ -41,6 +43,8 @@ describe("BootstrapDialog", () => {
41
43
  const renderComponent = ({
42
44
  open,
43
45
  disabled,
46
+ disableCancel,
47
+ disableAccept,
44
48
  cancelable,
45
49
  acceptable,
46
50
  callCloseWhenCancel,
@@ -57,6 +61,8 @@ describe("BootstrapDialog", () => {
57
61
  <BootstrapDialog
58
62
  open={open}
59
63
  disabled={disabled}
64
+ disableAccept={disableAccept}
65
+ disableCancel={disableCancel}
60
66
  cancelable={cancelable}
61
67
  acceptable={acceptable}
62
68
  callCloseWhenCancel={callCloseWhenCancel}
@@ -136,6 +142,34 @@ describe("BootstrapDialog", () => {
136
142
  });
137
143
  });
138
144
 
145
+ describe("disableCancel", () => {
146
+ it("should have the Cancel button as disabled if is true", () => {
147
+ renderComponent({ open: true, disableCancel: true, cancelable: true });
148
+
149
+ expect(screen.getByRole("button", { name: /cancel/i })).toBeDisabled();
150
+ });
151
+
152
+ it("should not have the Cancel button as disabled if is false", () => {
153
+ renderComponent({ open: true, disableCancel: false, cancelable: true });
154
+
155
+ expect(screen.getByRole("button", { name: /cancel/i })).not.toBeDisabled();
156
+ });
157
+ });
158
+
159
+ describe("disableAccept", () => {
160
+ it("should have the Cancel button as disabled if is true", () => {
161
+ renderComponent({ open: true, disableAccept: true, acceptable: true });
162
+
163
+ expect(screen.getByRole("button", { name: /accept/i })).toBeDisabled();
164
+ });
165
+
166
+ it("should not have the Cancel button as disabled if is false", () => {
167
+ renderComponent({ open: true, disableAccept: false, acceptable: true });
168
+
169
+ expect(screen.getByRole("button", { name: /accept/i })).not.toBeDisabled();
170
+ });
171
+ });
172
+
139
173
  it("should be able to change the cancel button text", () => {
140
174
  renderComponent({ open: true, cancelable: true, cancelText: "updated cancel" });
141
175
 
@@ -19,6 +19,8 @@ export const BootstrapDialog = ({
19
19
  component,
20
20
  componentProps = {},
21
21
  disabled,
22
+ disableAccept,
23
+ disableCancel,
22
24
  actions = [],
23
25
  children,
24
26
  loading,
@@ -67,7 +69,7 @@ export const BootstrapDialog = ({
67
69
  {cancelable && (
68
70
  <Button
69
71
  color="error"
70
- disabled={disabled}
72
+ disabled={disabled || disableCancel}
71
73
  onClick={() => {
72
74
  onCancel();
73
75
  callCloseWhenCancel && onClose();
@@ -81,7 +83,7 @@ export const BootstrapDialog = ({
81
83
  <LoadingButton
82
84
  type={acceptType}
83
85
  loading={loading}
84
- disabled={disabled}
86
+ disabled={disabled || disableAccept}
85
87
  onClick={onAccept}
86
88
  >
87
89
  {acceptText}
@@ -1,5 +1,5 @@
1
1
  import { DialogContentText } from "@mui/material";
2
- import { Meta, StoryFn, StoryObj } from "@storybook/react";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
3
  import { loremIpsum } from "lorem-ipsum";
4
4
  import React from "react";
5
5
  import { StoryDialogManager } from "~/storybook";
@@ -44,3 +44,15 @@ export const CustomButtonText: Story = {
44
44
  cancelText: "Don't create a token",
45
45
  },
46
46
  };
47
+
48
+ export const Passphrase: Story = {
49
+ args: {
50
+ title: "Lorem ipsum",
51
+ children: (
52
+ <DialogContentText sx={{ mb: 1 }}>
53
+ Write the passphrase to confirm your action
54
+ </DialogContentText>
55
+ ),
56
+ passphrase: "delete permanently",
57
+ },
58
+ };
@@ -12,6 +12,7 @@ interface DialogRenderArgs {
12
12
  cancelText?: string;
13
13
  loading?: boolean;
14
14
  content?: string | string[];
15
+ passphrase?: string;
15
16
  }
16
17
 
17
18
  describe("ConfirmDialog", () => {
@@ -21,6 +22,7 @@ describe("ConfirmDialog", () => {
21
22
  confirmText,
22
23
  cancelText,
23
24
  loading,
25
+ passphrase,
24
26
  }: DialogRenderArgs) => {
25
27
  const onCancel = vi.fn();
26
28
  const onConfirm = vi.fn();
@@ -30,6 +32,7 @@ describe("ConfirmDialog", () => {
30
32
  open={open}
31
33
  disabled={disabled}
32
34
  loading={loading}
35
+ passphrase={passphrase}
33
36
  title="lorem ipsum"
34
37
  onCancel={onCancel}
35
38
  onConfirm={onConfirm}
@@ -148,4 +151,36 @@ describe("ConfirmDialog", () => {
148
151
  expect(screen.getByRole("button", { name: /confirm/i })).toBeDisabled();
149
152
  });
150
153
  });
154
+
155
+ describe("passphrase", () => {
156
+ it("should render an input to enter a passphrase", () => {
157
+ renderComponent({ open: true, passphrase: "delete permanently" });
158
+
159
+ const input = screen.getByRole("textbox");
160
+ expect(input).toBeVisible();
161
+ expect(input).toHaveAttribute("placeholder", "delete permanently");
162
+ });
163
+
164
+ it("should have the confirm button disabled by default", () => {
165
+ renderComponent({ open: true, passphrase: "delete permanently" });
166
+
167
+ expect(screen.getByRole("button", { name: /confirm/i })).toBeDisabled();
168
+ });
169
+
170
+ it("should have the confirm button disabled if the user writes a non valid passphrase", async () => {
171
+ renderComponent({ open: true, passphrase: "delete permanently" });
172
+
173
+ await userEvent.type(screen.getByRole("textbox"), "invalid passphrase");
174
+
175
+ expect(screen.getByRole("button", { name: /confirm/i })).toBeDisabled();
176
+ });
177
+
178
+ it("should have the confirm button enabled if the user writes a valid passphrase", async () => {
179
+ renderComponent({ open: true, passphrase: "delete permanently" });
180
+
181
+ await userEvent.type(screen.getByRole("textbox"), "delete permanently");
182
+
183
+ expect(screen.getByRole("button", { name: /confirm/i })).not.toBeDisabled();
184
+ });
185
+ });
151
186
  });
@@ -1,6 +1,7 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
2
  import { BootstrapDialog } from "../bootstrap-dialog";
3
3
  import { BootstrapDialogDialogProps } from "../dialog.types";
4
+ import { TextField } from "@mui/material";
4
5
 
5
6
  type OmitBaseDialogProps =
6
7
  | "cancelable"
@@ -15,6 +16,7 @@ type OmitBaseDialogProps =
15
16
  export interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {
16
17
  confirmText?: string;
17
18
  canceText?: string;
19
+ passphrase?: string;
18
20
  onCancel: () => void;
19
21
  onConfirm: () => void;
20
22
  }
@@ -26,15 +28,20 @@ export const ConfirmDialog = ({
26
28
  disabled,
27
29
  confirmText = "Confirm",
28
30
  cancelText = "Cancel",
31
+ passphrase,
29
32
  children,
30
33
  onConfirm,
31
34
  onCancel,
32
35
  }: ConfirmDialogProps) => {
36
+ const [inputPassphrase, setInputPassphrase] = useState("");
37
+ const validPassphrase = !passphrase || inputPassphrase === passphrase;
38
+
33
39
  return (
34
40
  <BootstrapDialog
35
41
  title={title}
36
42
  loading={loading}
37
43
  disabled={loading || disabled}
44
+ disableAccept={!validPassphrase}
38
45
  open={open}
39
46
  onClose={onCancel}
40
47
  acceptable
@@ -46,6 +53,15 @@ export const ConfirmDialog = ({
46
53
  onAccept={onConfirm}
47
54
  >
48
55
  {children}
56
+ {passphrase && (
57
+ <TextField
58
+ size="small"
59
+ fullWidth
60
+ value={inputPassphrase}
61
+ onChange={(e) => setInputPassphrase(e.target.value)}
62
+ placeholder={passphrase}
63
+ />
64
+ )}
49
65
  </BootstrapDialog>
50
66
  );
51
67
  };
@@ -12,6 +12,8 @@ export type BootstrapDialogDialogProps = PropsWithChildren<{
12
12
  title: string;
13
13
  loading?: boolean;
14
14
  disabled?: boolean;
15
+ disableAccept?: boolean;
16
+ disableCancel?: boolean;
15
17
  cancelable?: boolean;
16
18
  acceptable?: boolean;
17
19
  callCloseWhenCancel?: boolean;
@@ -228,9 +228,8 @@ describe("DrawerItem", () => {
228
228
  it("should render a label when is set", () => {
229
229
  renderComponent({ item: mockLinkLabelDrawerNavigationItem });
230
230
 
231
- const label = screen.getByRole("label", { name: /10/i });
231
+ const label = screen.getByRole("label", { name: "10 error label" });
232
232
  expect(label).toBeVisible();
233
- expect(label).toHaveAttribute("aria-describedby", "error");
234
233
  });
235
234
 
236
235
  it("shouldn't render a label if is not set", () => {
@@ -1 +1,2 @@
1
- export * from "./tab";
1
+ export * from "./tab-card";
2
+ export * from "./tab-panel";
@@ -0,0 +1,19 @@
1
+ import { PropsWithChildren, useContext } from "react";
2
+ import { TabCardContext } from "./tab-card.context";
3
+ import React from "react";
4
+ import { Box, SxProps, Theme } from "@mui/material";
5
+
6
+ export type TabCardPanelProps = PropsWithChildren<{
7
+ index: number | number[];
8
+ sx?: SxProps<Theme>;
9
+ }>;
10
+
11
+ export const TabCardPanel = ({ index, children, sx }: TabCardPanelProps) => {
12
+ const [value] = useContext(TabCardContext);
13
+ let isTab = value === index;
14
+ if (Array.isArray(index)) {
15
+ isTab = index.includes(value);
16
+ }
17
+
18
+ return isTab ? <Box sx={sx}>{children}</Box> : null;
19
+ };
@@ -0,0 +1,7 @@
1
+ import { createContext, Dispatch, SetStateAction } from "react";
2
+
3
+ export const TabCardContext = createContext<[number, Dispatch<SetStateAction<number>>]>([
4
+ 0,
5
+ () => null,
6
+ ]);
7
+ export const TabCardContextProvider = TabCardContext.Provider;