@design-system-rte/react 1.12.2 → 1.14.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/dynamicTab/DynamicTab.d.ts +3 -0
- package/dist/components/dynamicTab/dynamicTabItem/DynamicTabItem.d.ts +3 -0
- package/dist/components/dynamicTab/dynamictab.utils.d.ts +2 -0
- package/dist/components/dynamicTab/hooks/useDisplayTabItemElement.d.ts +14 -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/pickers/daterangepicker/DateRangePicker.d.ts +2 -2
- package/dist/components/pickers/timepicker/hooks/useTimePickerInternalValue.d.ts +1 -1
- package/dist/components/sideNav/SideNav.d.ts +1 -0
- package/dist/components/sideNav/navItem/NavItem.d.ts +1 -0
- package/dist/components/switch/Switch.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/react-package.cjs +1 -1
- package/dist/react-package.js +6109 -5978
- package/dist/style.css +1 -1
- package/package.json +4 -2
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;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DynamicTabItemProps } from '../../../../../core';
|
|
2
|
+
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;
|
|
3
|
+
export default DynamicTabItem;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const useDisplayTabItemElement: ({ tabItem, isActive, hasBadgeContent, iconName, isClosable, }: {
|
|
2
|
+
tabItem: React.RefObject<HTMLLIElement>;
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
hasBadgeContent: boolean;
|
|
5
|
+
iconName?: string;
|
|
6
|
+
isClosable?: boolean;
|
|
7
|
+
}) => {
|
|
8
|
+
shouldDisplayBadge: boolean;
|
|
9
|
+
shouldDisplayIcon: boolean;
|
|
10
|
+
shouldDisplayText: boolean;
|
|
11
|
+
shouldDisplayCloseButton: boolean;
|
|
12
|
+
isZeroToXS: boolean | null;
|
|
13
|
+
};
|
|
14
|
+
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DateRangePickerProps } from '../../../../../core
|
|
2
|
-
declare const DateRangePicker: ({ id, label, labelId, required, showLabelRequirement, value, onChange, hasAction, onValidate, onCancel, minDate, maxDate, disabledDates, disabled, assistiveTextLabel, assistiveAppearance, showAssistiveIcon, assistiveTextLink, isError, readonly, width, }: DateRangePickerProps) => import("react").JSX.Element;
|
|
1
|
+
import { DateRangePickerProps } from '../../../../../core';
|
|
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;
|
|
@@ -4,7 +4,7 @@ declare const useTimePickerInternalValue: (value?: TimeFormat, incrementConfig?:
|
|
|
4
4
|
hourIncrement?: number;
|
|
5
5
|
minuteIncrement?: number;
|
|
6
6
|
secondIncrement?: number;
|
|
7
|
-
}) => {
|
|
7
|
+
}, isControlled?: boolean) => {
|
|
8
8
|
internalTimeValue: TimeFormat;
|
|
9
9
|
updateTimeSegment: (segment: TimeSegmentEnum, val: string) => void;
|
|
10
10
|
handleOnChangeHours: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -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;
|
|
@@ -3,5 +3,5 @@ import { InputHTMLAttributes } from 'react';
|
|
|
3
3
|
interface SwitchProps extends CoreSwitchProps, InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
5
|
}
|
|
6
|
-
declare const Switch: ({ label, appearance, showLabel, showIcon, disabled, readOnly, checked, onChange, ...props }: SwitchProps) => import("react").JSX.Element;
|
|
6
|
+
declare const Switch: ({ label, appearance, showLabel, showIcon, disabled, readOnly, checked, defaultChecked, onChange, ...props }: SwitchProps) => import("react").JSX.Element;
|
|
7
7
|
export default Switch;
|
package/dist/index.d.ts
CHANGED
|
@@ -43,4 +43,6 @@ import { default as Toast } from './components/toast/Toast.tsx';
|
|
|
43
43
|
import { default as ToastQueueProvider } from './components/toast/toastQueue/ToastQueueProvider.tsx';
|
|
44
44
|
import { default as Tooltip } from './components/tooltip/Tooltip.tsx';
|
|
45
45
|
import { default as Treeview } from './components/treeview/Treeview.tsx';
|
|
46
|
-
|
|
46
|
+
import { useNavigationLinkComponent } from './provider/NavigationContext.tsx';
|
|
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, useNavigationLinkComponent, };
|