@design-system-rte/react 1.13.0 → 1.15.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/README.md +43 -16
- package/dist/components/drawer/Drawer.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.d.ts +12 -2
- package/dist/components/dynamicTab/DynamicTab.d.ts +3 -0
- package/dist/components/dynamicTab/dynamicTabItem/DynamicTabItem.d.ts +6 -0
- package/dist/components/dynamicTab/hooks/useDisplayTabItemElement.d.ts +15 -0
- package/dist/components/dynamicTab/hooks/useLastPressedKey.d.ts +2 -0
- package/dist/components/dynamicTab/provider/DragAndDropProvider.d.ts +11 -0
- package/dist/components/link/Link.d.ts +3 -1
- package/dist/components/pagination/Pagination.d.ts +6 -0
- package/dist/components/pickers/daterangepicker/DateRangePicker.d.ts +1 -1
- package/dist/components/select/Select.d.ts +2 -0
- package/dist/components/sideNav/SideNav.d.ts +1 -0
- package/dist/components/sideNav/navItem/NavItem.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/react-package.cjs +1 -1
- package/dist/react-package.js +5550 -5310
- package/dist/style.css +1 -1
- package/package.json +4 -2
- package/dist/components/dropdown/BaseDropdown.d.ts +0 -12
package/README.md
CHANGED
|
@@ -1,35 +1,62 @@
|
|
|
1
1
|
### Installation Instructions
|
|
2
2
|
|
|
3
3
|
1. **Add Design System base styles:**
|
|
4
|
-
```tsx
|
|
5
|
-
import "@design-system-rte/react/style.css";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
```tsx
|
|
6
|
+
import "@design-system-rte/react/style.css";
|
|
7
|
+
|
|
8
|
+
createRoot(document.getElementById("root")!).render(
|
|
9
|
+
<StrictMode>
|
|
10
|
+
<App />
|
|
11
|
+
</StrictMode>,
|
|
12
|
+
);
|
|
13
|
+
```
|
|
13
14
|
|
|
14
15
|
2. **Add Branding/Theme Mixin:**
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
Include the branding/theme mixin in your main `.scss` file. This will create a style scope for the components.
|
|
17
18
|
(If you don't have scss support, you can use the .css files in `@design-system/core/css/rte-themes.css` and add them to your main styles file).
|
|
19
|
+
|
|
18
20
|
```scss
|
|
19
|
-
|
|
21
|
+
@use "@design-system-rte/core/design-tokens/tokens/mixins" as *;
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
@include theme-selector("bleu_iceberg", "light");
|
|
22
24
|
```
|
|
23
25
|
|
|
24
26
|
3. **Add HTML Selector:**
|
|
25
|
-
|
|
27
|
+
|
|
26
28
|
Add an HTML selector to define the context for applying component styles.
|
|
29
|
+
|
|
27
30
|
```html
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
<body data-theme="bleu_iceberg" data-mode="light">
|
|
32
|
+
...
|
|
33
|
+
</body>
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
4. **Use Components:**
|
|
34
|
-
|
|
37
|
+
|
|
35
38
|
Implement the different components as documented in the [Storybook](https://opensource.rte-france.com/design-system-rte/?path=/docs/react_composants-button--docs) provided with the library.
|
|
39
|
+
|
|
40
|
+
### Routing / SPA navigation
|
|
41
|
+
|
|
42
|
+
By default, navigable components (`Link`, `NavItem`, `NavMenu`, `SideNav`, `Header`, `Breadcrumbs`) render a native `<a>` tag, which triggers a full page reload. To enable client-side (SPA) navigation with the router of your choice you can inject its `Link` component instead of the native `<a>` tag. This mechanism has no dependency on any routing library: you provide the component, the design system just renders it.
|
|
43
|
+
|
|
44
|
+
You can do it using **via `NavigationProvider`** configured once at the root of your app.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { NavigationProvider } from "@design-system-rte/react";
|
|
48
|
+
import { Link as RouterLink } from "react-router-dom"; // or any other router library
|
|
49
|
+
|
|
50
|
+
<NavigationProvider linkComponent={RouterLink}>
|
|
51
|
+
<App />
|
|
52
|
+
</NavigationProvider>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
You can also use the `customLinkComponent` prop on the `Link` component to override the default behavior for a specific link.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Link as RouterLink } from "react-router-dom"; // or any other router library
|
|
59
|
+
<Link to="/home" label="Home" customLinkComponent={RouterLink} />;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Without any configuration, all components keep rendering our native `<Link>` component — this is fully backward compatible.
|
|
@@ -6,5 +6,5 @@ interface DrawerProps extends coreDrawerProps, Omit<React.HTMLAttributes<HTMLDiv
|
|
|
6
6
|
children?: React.ReactNode | React.ReactNode[];
|
|
7
7
|
width?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const Drawer: ({ id, title, icon, iconAppearance, isOpen, onClose, onClickToggle, closeOnOverlayClick, primaryButtonLabel, secondaryButtonLabel, isCollapsible, content, header, footer, position, width, children, fixedHeader, closeOnEscape, isClosable, onClickPrimaryButton, onClickSecondaryButton, ...props }: DrawerProps) => import("react").JSX.Element | null;
|
|
9
|
+
declare const Drawer: ({ id, title, icon, iconAppearance, isOpen, onClose, onClickToggle, closeOnOverlayClick, primaryButtonLabel, secondaryButtonLabel, isCollapsible, content, header, footer, position, width, children, fixedHeader, showHeader, closeOnEscape, isClosable, onClickPrimaryButton, onClickSecondaryButton, ...props }: DrawerProps) => import("react").JSX.Element | null;
|
|
10
10
|
export default Drawer;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DropdownProps as CoreDropdownProps } from '../../../../core/components/dropdown/dropdown.interface';
|
|
2
|
+
export type OverlayPriority = "low" | "high";
|
|
3
|
+
export interface DropdownProps extends CoreDropdownProps, React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
trigger: React.ReactNode;
|
|
5
|
+
header?: React.ReactNode;
|
|
6
|
+
footer?: React.ReactNode;
|
|
7
|
+
isList?: boolean;
|
|
8
|
+
hasMaxWidth?: boolean;
|
|
9
|
+
overlayLevel?: OverlayPriority;
|
|
10
|
+
maxHeight?: number | string;
|
|
11
|
+
}
|
|
12
|
+
export declare const Dropdown: import('react').ForwardRefExoticComponent<DropdownProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
13
|
export default Dropdown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DynamicTabItemProps as CoreDynamicTabItemProps } from '../../../../../core';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
interface DynamicTabItemProps extends CoreDynamicTabItemProps, Omit<HTMLAttributes<HTMLLIElement>, keyof CoreDynamicTabItemProps> {
|
|
4
|
+
}
|
|
5
|
+
declare const DynamicTabItem: ({ id, index, title, parentId, appearance, isActive, onClick, onClickClose, onChangeTabTitle, compactSpacing, isEditable, badgeContent, badgeCount, badgeIcon, badgeType, iconName, isClosable, updateIndicator, isHidden, setIsMoving: setIsMovingExternal, isMoving: isMovingExternal, }: DynamicTabItemProps) => import("react").JSX.Element;
|
|
6
|
+
export default DynamicTabItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
declare const useDisplayTabItemElement: ({ tabItem, isActive, hasBadgeContent, iconName, isClosable, }: {
|
|
3
|
+
tabItem: RefObject<HTMLLIElement>;
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
hasBadgeContent: boolean;
|
|
6
|
+
iconName?: string;
|
|
7
|
+
isClosable?: boolean;
|
|
8
|
+
}) => {
|
|
9
|
+
shouldDisplayBadge: boolean;
|
|
10
|
+
shouldDisplayIcon: boolean;
|
|
11
|
+
shouldDisplayText: boolean;
|
|
12
|
+
shouldDisplayCloseButton: boolean;
|
|
13
|
+
isZeroToXS: boolean | null;
|
|
14
|
+
};
|
|
15
|
+
export default useDisplayTabItemElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DynamicTabItemOption } from '../../../../../core';
|
|
2
|
+
interface DragAndDropProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
internalOptions: DynamicTabItemOption[];
|
|
5
|
+
setInternalOptions: (options: DynamicTabItemOption[]) => void;
|
|
6
|
+
onUpdateTabs?: (options: DynamicTabItemOption[]) => void;
|
|
7
|
+
onDragEndCallback?: () => void;
|
|
8
|
+
onBeforeDragStartCallback?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const DragAndDropProvider: ({ children, internalOptions, setInternalOptions, onUpdateTabs, onDragEndCallback, onBeforeDragStartCallback, }: DragAndDropProviderProps) => import("react").JSX.Element;
|
|
11
|
+
export default DragAndDropProvider;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LinkProps as CoreLinkProps } from '../../../../core/components/link/link.interface';
|
|
2
|
-
|
|
2
|
+
import { RoutingComponentProps } from '../../abstract/routing/routing.interface';
|
|
3
|
+
interface LinkProps extends CoreLinkProps, RoutingComponentProps, React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
4
|
+
to?: string;
|
|
3
5
|
}
|
|
4
6
|
declare const Link: import('react').ForwardRefExoticComponent<LinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
5
7
|
export default Link;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PaginationProps as CorePaginationProps } from '../../../../core';
|
|
2
|
+
interface PaginationProps extends CorePaginationProps, React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
onPageChange?: (page: number) => void;
|
|
4
|
+
}
|
|
5
|
+
declare const Pagination: ({ appearance, activePage, totalPages, onPageChange, hasGoToFirst, hasGoToPrev, hasGoToNext, hasGoToLast, }: PaginationProps) => import("react").JSX.Element;
|
|
6
|
+
export default Pagination;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DateRangePickerProps } from '../../../../../core
|
|
1
|
+
import { DateRangePickerProps } from '../../../../../core';
|
|
2
2
|
declare const DateRangePicker: ({ id, label, labelId, required, showLabelRequirement, value, defaultValue, onChange, hasAction, onValidate, onCancel, minDate, maxDate, disabledDates, disabled, assistiveTextLabel, assistiveAppearance, showAssistiveIcon, assistiveTextLink, isError, readonly, width, }: DateRangePickerProps) => import("react").JSX.Element;
|
|
3
3
|
export default DateRangePicker;
|
|
@@ -5,6 +5,7 @@ interface SingleSelectProps extends Omit<coreSelectProps, "value" | "onChange">
|
|
|
5
5
|
header?: React.ReactNode;
|
|
6
6
|
footer?: React.ReactNode;
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
|
+
body?: React.ReactNode;
|
|
8
9
|
}
|
|
9
10
|
interface MultiSelectProps extends Omit<coreSelectProps, "value" | "onChange"> {
|
|
10
11
|
multiple: true;
|
|
@@ -12,6 +13,7 @@ interface MultiSelectProps extends Omit<coreSelectProps, "value" | "onChange"> {
|
|
|
12
13
|
header?: React.ReactNode;
|
|
13
14
|
footer?: React.ReactNode;
|
|
14
15
|
onChange?: (value: string[]) => void;
|
|
16
|
+
body?: React.ReactNode;
|
|
15
17
|
}
|
|
16
18
|
export type SelectProps = SingleSelectProps | MultiSelectProps;
|
|
17
19
|
declare const Select: import('react').ForwardRefExoticComponent<SelectProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -4,6 +4,7 @@ interface SideNavProps extends Partial<CoreSideNavProps>, Omit<React.HTMLAttribu
|
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
defaultCollapsed?: boolean;
|
|
6
6
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
7
|
+
onActiveItemChange?: (id: string | undefined) => void;
|
|
7
8
|
}
|
|
8
9
|
declare const SideNav: import('react').ForwardRefExoticComponent<SideNavProps & import('react').RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
9
10
|
export default SideNav;
|
|
@@ -2,6 +2,7 @@ import { NavItemProps as CoreNavItemProps } from '../../../../../core/components
|
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
interface NavItemProps extends CoreNavItemProps, Omit<HTMLAttributes<HTMLDivElement>, "onClick" | "id"> {
|
|
4
4
|
children?: ReactNode;
|
|
5
|
+
onActiveItemChange?: (id: string | undefined) => void;
|
|
5
6
|
}
|
|
6
7
|
declare const NavItem: import('react').ForwardRefExoticComponent<NavItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
8
|
export default NavItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { default as IconButtonToggle } from './components/iconButtonToggle/IconB
|
|
|
21
21
|
import { default as Link } from './components/link/Link.tsx';
|
|
22
22
|
import { default as Loader } from './components/loader/Loader.tsx';
|
|
23
23
|
import { default as Modal } from './components/modal/Modal.tsx';
|
|
24
|
+
import { default as Pagination } from './components/pagination/Pagination.tsx';
|
|
24
25
|
import { default as DatePicker } from './components/pickers/datepicker/DatePicker.tsx';
|
|
25
26
|
import { default as DateRangePicker } from './components/pickers/daterangepicker/DateRangePicker.tsx';
|
|
26
27
|
import { default as TimePicker } from './components/pickers/timepicker/TimePicker.tsx';
|
|
@@ -43,4 +44,5 @@ import { default as Toast } from './components/toast/Toast.tsx';
|
|
|
43
44
|
import { default as ToastQueueProvider } from './components/toast/toastQueue/ToastQueueProvider.tsx';
|
|
44
45
|
import { default as Tooltip } from './components/tooltip/Tooltip.tsx';
|
|
45
46
|
import { default as Treeview } from './components/treeview/Treeview.tsx';
|
|
46
|
-
|
|
47
|
+
import { default as NavigationProvider } from './provider/NavigationProvider.tsx';
|
|
48
|
+
export { Avatar, Accordion, Button, Grid, Checkbox, CheckboxGroup, Link, RadioButton, RadioButtonGroup, Icon, IconButton, IconButtonToggle, Loader, SplitButton, Tooltip, BaseTextInput as TextInput, Chip, Badge, Textarea, Divider, Drawer, Switch, SegmentedControl, Breadcrumbs, Banner, Popover, Modal, SideNav, Stepper, BaseSideNav, Card, Toast, ToastQueueProvider, Tag, Tab, TimePicker, Treeview, Searchbar, Select, FileUpload, DatePicker, Dropdown, DropdownItem, DateRangePicker, Header, NavigationProvider, Pagination, };
|