rl-react-components 2.6.0 → 2.9.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 +11 -11
- package/dist/components/Accordion/Accordion.d.ts +19 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +10 -1
- package/dist/components/Container/Container.d.ts +3 -2
- package/dist/components/IconButton/IconButton.d.ts +9 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +10 -3
- package/dist/components/ShimmerImage/ShimmerImage.d.ts +6 -1
- package/dist/components/TagGroup/TagGroup.d.ts +24 -0
- package/dist/components/TagGroup/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -1
- package/dist/components/TextInput/TextInput.d.ts +5 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +383 -219
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,17 +89,17 @@ override any of them in its own CSS.
|
|
|
89
89
|
|
|
90
90
|
## What is inside
|
|
91
91
|
|
|
92
|
-
| Group | Components and hooks
|
|
93
|
-
| -------------- |
|
|
94
|
-
| Foundations | `Text`, `Icon`
|
|
95
|
-
| Layout | `Container`, `Section`, `PageHero`, `PageTransition`
|
|
96
|
-
| Navigation | `SideNav`
|
|
97
|
-
| Forms | `Button`, `TextInput`, `TextArea`, `Select`, `Checkbox` |
|
|
98
|
-
| Tags | `Tag`, `TagFilter`
|
|
99
|
-
| Content | `Card`, `Markdown`, `MarkdownEditor`, `ShimmerImage`
|
|
100
|
-
| Feedback | `ToastProvider`, `useToast`
|
|
101
|
-
| Canvas effects | `MatrixContainer`, `OrbitalDots`
|
|
102
|
-
| Hooks | `useDragReorder`, `useRotatingMessage`
|
|
92
|
+
| Group | Components and hooks |
|
|
93
|
+
| -------------- | --------------------------------------------------------------------- |
|
|
94
|
+
| Foundations | `Text`, `Icon` |
|
|
95
|
+
| Layout | `Container`, `Section`, `PageHero`, `PageTransition` |
|
|
96
|
+
| Navigation | `SideNav` |
|
|
97
|
+
| Forms | `Button`, `IconButton`, `TextInput`, `TextArea`, `Select`, `Checkbox` |
|
|
98
|
+
| Tags | `Tag`, `TagFilter`, `TagGroup` |
|
|
99
|
+
| Content | `Card`, `Accordion`, `Markdown`, `MarkdownEditor`, `ShimmerImage` |
|
|
100
|
+
| Feedback | `ToastProvider`, `useToast` |
|
|
101
|
+
| Canvas effects | `MatrixContainer`, `OrbitalDots` |
|
|
102
|
+
| Hooks | `useDragReorder`, `useRotatingMessage` |
|
|
103
103
|
|
|
104
104
|
## Documentation
|
|
105
105
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AccordionItem {
|
|
3
|
+
/** Tells the items apart, and names the ones in `defaultOpen`. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Always shown. Pressing it opens and closes the item, so it holds nothing clickable. */
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface AccordionProps {
|
|
10
|
+
items: AccordionItem[];
|
|
11
|
+
/** The ids of the items that start open. */
|
|
12
|
+
defaultOpen?: string[];
|
|
13
|
+
/** Opening an item closes the one that was open. */
|
|
14
|
+
singleOpen?: boolean;
|
|
15
|
+
/** Renders each title as a heading of this level instead of plain text. */
|
|
16
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export default function Accordion({ items, defaultOpen, singleOpen, headingLevel, className, }: AccordionProps): React.JSX.Element;
|
|
@@ -4,5 +4,14 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
4
4
|
size?: 'small' | 'medium' | 'large';
|
|
5
5
|
fullWidth?: boolean;
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
+
/** Makes it a link that looks like a button, for an action that goes to another place. */
|
|
8
|
+
href?: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
rel?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The element or component to render. Default: 'a' with `href`, else 'button'. Pass a router's
|
|
13
|
+
* link component with `href` to navigate without a page load: it receives `href` and the rest.
|
|
14
|
+
*/
|
|
15
|
+
as?: React.ElementType;
|
|
7
16
|
}
|
|
8
|
-
export default function Button({ variant, size, fullWidth, children, className, ...props }: ButtonProps): React.JSX.Element;
|
|
17
|
+
export default function Button({ variant, size, fullWidth, children, className, href, target, rel, as, type, disabled, onClick, ...props }: ButtonProps): React.JSX.Element;
|
|
@@ -3,10 +3,11 @@ export interface ContainerProps {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
/**
|
|
5
5
|
* The breakpoint whose width caps the container: `sm` 640px, `md` 768px, `lg` 1024px,
|
|
6
|
-
* `xl` 1280px, `xxl` 1600px.
|
|
6
|
+
* `xl` 1280px, `xxl` 1600px. With none, the cap is the app's `--container-max-width`,
|
|
7
|
+
* or 1280px where that is not set.
|
|
7
8
|
*/
|
|
8
9
|
size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
9
10
|
className?: string;
|
|
10
11
|
as?: React.ElementType;
|
|
11
12
|
}
|
|
12
|
-
export default function Container({ children, size, className, as: Tag
|
|
13
|
+
export default function Container({ children, size, className, as: Tag }: ContainerProps): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label' | 'aria-labelledby' | 'children'> {
|
|
3
|
+
/** The button's name for screen readers, and its tooltip. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The icon, such as an `<Icon>`. Decorative: the label names the button. */
|
|
6
|
+
icon: React.ReactNode;
|
|
7
|
+
variant?: 'default' | 'danger';
|
|
8
|
+
}
|
|
9
|
+
export default function IconButton({ label, icon, variant, type, title, className, ...props }: IconButtonProps): React.JSX.Element;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
3
3
|
label?: string;
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/** A line under the select that describes it. */
|
|
5
|
+
hint?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The text of an empty first option, such as "Select...". With none there is no empty option,
|
|
8
|
+
* for a field that always has a value.
|
|
9
|
+
*/
|
|
10
|
+
placeholder?: string;
|
|
6
11
|
options: {
|
|
7
12
|
value: string;
|
|
8
13
|
label: string;
|
|
9
14
|
}[];
|
|
15
|
+
/** Less padding, for a field in a row of controls. The text keeps its size. */
|
|
16
|
+
compact?: boolean;
|
|
10
17
|
}
|
|
11
|
-
export default function Select({ label, placeholder, options, className, id, ...props }: SelectProps): React.JSX.Element;
|
|
18
|
+
export default function Select({ label, hint, placeholder, options, compact, className, id, 'aria-describedby': ariaDescribedBy, ...props }: SelectProps): React.JSX.Element;
|
|
@@ -3,9 +3,14 @@ export interface ShimmerImageProps extends Omit<React.ImgHTMLAttributes<HTMLImag
|
|
|
3
3
|
src: string;
|
|
4
4
|
/** Describes the picture. Pass an empty string for a decorative one. */
|
|
5
5
|
alt: string;
|
|
6
|
+
/**
|
|
7
|
+
* Shown in place of the image when `src` is empty or its file cannot be loaded, such as a
|
|
8
|
+
* placeholder tile. Without it a broken image keeps shimmering.
|
|
9
|
+
*/
|
|
10
|
+
fallback?: React.ReactNode;
|
|
6
11
|
}
|
|
7
12
|
/**
|
|
8
13
|
* An `<img>` that fills its positioned parent, shows a shimmer while the file loads and fades the
|
|
9
14
|
* picture in once it has decoded. `className` lands on the `<img>`.
|
|
10
15
|
*/
|
|
11
|
-
export default function ShimmerImage({ src, alt, className, ...imageProps }: ShimmerImageProps): React.JSX.Element;
|
|
16
|
+
export default function ShimmerImage({ src, alt, fallback, className, onError, ...imageProps }: ShimmerImageProps): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface TagGroupOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface TagGroupBaseProps {
|
|
6
|
+
/** Shown above the tags. It names the group. */
|
|
7
|
+
label: string;
|
|
8
|
+
options: TagGroupOption[];
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Several tags can be picked, or with `selection="single"` one at most. */
|
|
12
|
+
export type TagGroupProps = TagGroupBaseProps & ({
|
|
13
|
+
selection?: 'multiple';
|
|
14
|
+
/** The values picked, in the order they were picked. */
|
|
15
|
+
selected: string[];
|
|
16
|
+
onChange: (selected: string[]) => void;
|
|
17
|
+
} | {
|
|
18
|
+
selection: 'single';
|
|
19
|
+
selected: string | null;
|
|
20
|
+
/** Gets null when the picked tag is pressed again. */
|
|
21
|
+
onChange: (selected: string | null) => void;
|
|
22
|
+
});
|
|
23
|
+
export default function TagGroup(props: TagGroupProps): import("react").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
3
|
label?: string;
|
|
4
|
+
/** A line under the text area that describes it. */
|
|
5
|
+
hint?: string;
|
|
4
6
|
}
|
|
5
|
-
export default function TextArea({ label, className, id, ...props }: TextAreaProps): React.JSX.Element;
|
|
7
|
+
export default function TextArea({ label, hint, className, id, 'aria-describedby': ariaDescribedBy, ...props }: TextAreaProps): React.JSX.Element;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
3
|
label?: string;
|
|
4
|
+
/** A line under the input that describes it, such as what a password needs. */
|
|
5
|
+
hint?: string;
|
|
4
6
|
/** Shown under the input, which it describes; the input is then marked invalid. */
|
|
5
7
|
error?: string;
|
|
8
|
+
/** Less padding, for a field in a row of controls. The text keeps its size. */
|
|
9
|
+
compact?: boolean;
|
|
6
10
|
}
|
|
7
|
-
export default function TextInput({ label, error, className, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props }: TextInputProps): React.JSX.Element;
|
|
11
|
+
export default function TextInput({ label, hint, error, compact, className, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props }: TextInputProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default as Accordion } from './components/Accordion';
|
|
2
|
+
export type { AccordionItem, AccordionProps } from './components/Accordion';
|
|
1
3
|
export { default as Button } from './components/Button';
|
|
2
4
|
export type { ButtonProps } from './components/Button';
|
|
3
5
|
export { default as Card } from './components/Card';
|
|
@@ -8,6 +10,8 @@ export { default as Container } from './components/Container';
|
|
|
8
10
|
export type { ContainerProps } from './components/Container';
|
|
9
11
|
export { default as Icon, ICON_NAMES } from './components/Icon';
|
|
10
12
|
export type { IconName, IconProps } from './components/Icon';
|
|
13
|
+
export { default as IconButton } from './components/IconButton';
|
|
14
|
+
export type { IconButtonProps } from './components/IconButton';
|
|
11
15
|
export { default as Markdown } from './components/Markdown';
|
|
12
16
|
export type { MarkdownProps } from './components/Markdown';
|
|
13
17
|
export { default as MarkdownEditor } from './components/MarkdownEditor';
|
|
@@ -32,6 +36,8 @@ export { default as Tag } from './components/Tag';
|
|
|
32
36
|
export type { TagProps } from './components/Tag';
|
|
33
37
|
export { default as TagFilter } from './components/TagFilter';
|
|
34
38
|
export type { TagFilterProps } from './components/TagFilter';
|
|
39
|
+
export { default as TagGroup } from './components/TagGroup';
|
|
40
|
+
export type { TagGroupOption, TagGroupProps } from './components/TagGroup';
|
|
35
41
|
export { default as Text } from './components/Text';
|
|
36
42
|
export type { TextProps, TextSize, TextTone, TextVariant, TextWeight } from './components/Text';
|
|
37
43
|
export { default as TextArea } from './components/TextArea';
|