rl-react-components 0.0.0-stage → 2.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -2
  3. package/dist/components/Button/Button.d.ts +8 -0
  4. package/dist/components/Button/index.d.ts +2 -0
  5. package/dist/components/Card/Card.d.ts +28 -0
  6. package/dist/components/Card/index.d.ts +2 -0
  7. package/dist/components/Container/Container.d.ts +12 -0
  8. package/dist/components/Container/index.d.ts +2 -0
  9. package/dist/components/Icon/Icon.d.ts +36 -0
  10. package/dist/components/Icon/index.d.ts +2 -0
  11. package/dist/components/Markdown/Markdown.d.ts +11 -0
  12. package/dist/components/Markdown/index.d.ts +2 -0
  13. package/dist/components/MarkdownEditor/MarkdownEditor.d.ts +24 -0
  14. package/dist/components/MarkdownEditor/index.d.ts +2 -0
  15. package/dist/components/MatrixContainer/MatrixContainer.d.ts +54 -0
  16. package/dist/components/MatrixContainer/index.d.ts +4 -0
  17. package/dist/components/MatrixContainer/matrixConfig.d.ts +49 -0
  18. package/dist/components/OrbitalDots/OrbitalDots.d.ts +52 -0
  19. package/dist/components/OrbitalDots/index.d.ts +4 -0
  20. package/dist/components/OrbitalDots/orbitalDotsConfig.d.ts +54 -0
  21. package/dist/components/PageHero/PageHero.d.ts +10 -0
  22. package/dist/components/PageHero/index.d.ts +2 -0
  23. package/dist/components/PageTransition/PageTransition.d.ts +17 -0
  24. package/dist/components/PageTransition/index.d.ts +2 -0
  25. package/dist/components/Section/Section.d.ts +13 -0
  26. package/dist/components/Section/index.d.ts +2 -0
  27. package/dist/components/Select/Select.d.ts +11 -0
  28. package/dist/components/Select/index.d.ts +2 -0
  29. package/dist/components/ShimmerImage/ShimmerImage.d.ts +11 -0
  30. package/dist/components/ShimmerImage/index.d.ts +2 -0
  31. package/dist/components/SideNav/SideNav.d.ts +43 -0
  32. package/dist/components/SideNav/index.d.ts +2 -0
  33. package/dist/components/Tag/Tag.d.ts +24 -0
  34. package/dist/components/Tag/index.d.ts +2 -0
  35. package/dist/components/TagFilter/TagFilter.d.ts +10 -0
  36. package/dist/components/TagFilter/index.d.ts +2 -0
  37. package/dist/components/Text/Text.d.ts +37 -0
  38. package/dist/components/Text/index.d.ts +2 -0
  39. package/dist/components/TextArea/TextArea.d.ts +5 -0
  40. package/dist/components/TextArea/index.d.ts +2 -0
  41. package/dist/components/TextInput/TextInput.d.ts +7 -0
  42. package/dist/components/TextInput/index.d.ts +2 -0
  43. package/dist/components/Toast/ToastProvider.d.ts +13 -0
  44. package/dist/components/Toast/index.d.ts +2 -0
  45. package/dist/hooks/useDragReorder.d.ts +20 -0
  46. package/dist/hooks/useRotatingMessage.d.ts +10 -0
  47. package/dist/index.d.ts +42 -0
  48. package/dist/index.js +1208 -0
  49. package/dist/styles.css +2 -0
  50. package/package.json +99 -4
@@ -0,0 +1,24 @@
1
+ interface TagBaseProps {
2
+ label: string;
3
+ active?: boolean;
4
+ }
5
+ /**
6
+ * A tag is pressed as a whole or removed with its own button, never both: buttons cannot nest. The
7
+ * remove button shows only `×`, so it cannot be offered without the name a screen reader reads.
8
+ */
9
+ export type TagProps = TagBaseProps & ({
10
+ onClick?: never;
11
+ onRemove?: never;
12
+ removeLabel?: never;
13
+ } | {
14
+ onClick: () => void;
15
+ onRemove?: never;
16
+ removeLabel?: never;
17
+ } | {
18
+ onClick?: never;
19
+ onRemove: () => void;
20
+ /** The accessible name of the remove button, such as "Remove Branding". */
21
+ removeLabel: string;
22
+ });
23
+ export default function Tag({ label, active, onClick, onRemove, removeLabel }: TagProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './Tag';
2
+ export type { TagProps } from './Tag';
@@ -0,0 +1,10 @@
1
+ export interface TagFilterProps {
2
+ tags: string[];
3
+ activeTag: string | null;
4
+ onTagClick: (tag: string | null) => void;
5
+ /** The text of the chip that clears the filter, such as "All". */
6
+ allLabel: string;
7
+ /** Names the row as a group for screen readers, such as "Filter posts by topic". */
8
+ groupLabel?: string;
9
+ }
10
+ export default function TagFilter({ tags, activeTag, onTagClick, allLabel, groupLabel, }: TagFilterProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from './TagFilter';
2
+ export type { TagFilterProps } from './TagFilter';
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ /** The type roles: each sets a font, and some a size, weight, case and letter spacing. */
3
+ export type TextVariant = 'body' | 'display' | 'label' | 'eyebrow' | 'mono';
4
+ /** The steps of the type scale, from 0.75rem (`xs`) to 5rem (`5xl`). */
5
+ export type TextSize = 'xs' | 'sm' | 'base' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
6
+ export type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
7
+ /** A colour token: `default` is `--color-text`, `secondary` is `--color-text-secondary`, and so on. */
8
+ export type TextTone = 'default' | 'secondary' | 'muted' | 'accent' | 'danger' | 'success' | 'warning' | 'info';
9
+ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
10
+ children: React.ReactNode;
11
+ /**
12
+ * The element or component to render. Default: 'p'. It sets the meaning (a paragraph, a
13
+ * heading, a span inside other text), not the look: the other props set that.
14
+ */
15
+ as?: React.ElementType;
16
+ /** The type role. Default: 'body'. */
17
+ variant?: TextVariant;
18
+ /**
19
+ * A step of the type scale. Without it, body, display and mono text take the size of the text
20
+ * around them; a label is `sm` and an eyebrow `xs`.
21
+ */
22
+ size?: TextSize;
23
+ /** Without it, the variant's weight: display is semibold, a label medium, an eyebrow regular,
24
+ * and body and mono text take the weight around them. */
25
+ weight?: TextWeight;
26
+ italic?: boolean;
27
+ /** A colour token. Without it, the text takes the colour around it. */
28
+ tone?: TextTone;
29
+ align?: 'start' | 'center' | 'end';
30
+ /**
31
+ * `true` keeps the text to one line and ends it with an ellipsis. A number, 1 or more, clamps
32
+ * it to that many lines. Either needs a block, or a flex or grid item.
33
+ */
34
+ truncate?: boolean | number;
35
+ }
36
+ /** Text in one of the system's type roles, at a step of its scale, in one of its colours. */
37
+ export default function Text({ as: Root, variant, size, weight, italic, tone, align, truncate, className, style, children, ...props }: TextProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from './Text';
2
+ export type { TextProps, TextSize, TextTone, TextVariant, TextWeight } from './Text';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ label?: string;
4
+ }
5
+ export default function TextArea({ label, className, id, ...props }: TextAreaProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from './TextArea';
2
+ export type { TextAreaProps } from './TextArea';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ label?: string;
4
+ /** Shown under the input, which it describes; the input is then marked invalid. */
5
+ error?: string;
6
+ }
7
+ export default function TextInput({ label, error, className, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props }: TextInputProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default } from './TextInput';
2
+ export type { TextInputProps } from './TextInput';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type ToastVariant = 'success' | 'error' | 'warning' | 'info';
3
+ interface ToastContextValue {
4
+ addToast: (message: string, variant?: ToastVariant, durationMs?: number) => void;
5
+ }
6
+ export declare function useToast(): ToastContextValue;
7
+ export interface ToastProviderProps {
8
+ /** The accessible name of each toast's close button. */
9
+ dismissLabel: string;
10
+ children: React.ReactNode;
11
+ }
12
+ export declare function ToastProvider({ dismissLabel, children }: ToastProviderProps): React.JSX.Element;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ export { ToastProvider, useToast } from './ToastProvider';
2
+ export type { ToastProviderProps, ToastVariant } from './ToastProvider';
@@ -0,0 +1,20 @@
1
+ import type { DragEvent } from 'react';
2
+ /**
3
+ * Drag-and-drop reordering for a list, using native HTML5 drag events.
4
+ * Spread `getItemProps(index)` onto each row. `onReorder` receives the items in their new
5
+ * order after a drop; `draggedIndex` and `overIndex` are there for styling the rows.
6
+ * Dragging needs a mouse, so `moveItem` reorders without one: wire it to buttons such as
7
+ * "Move up" and "Move down".
8
+ */
9
+ export declare function useDragReorder<Item>(items: Item[], onReorder: (reorderedItems: Item[]) => void): {
10
+ draggedIndex: number | null;
11
+ overIndex: number | null;
12
+ getItemProps: (index: number) => {
13
+ draggable: boolean;
14
+ onDragStart: (event: DragEvent<HTMLElement>) => void;
15
+ onDragOver: (event: DragEvent<HTMLElement>) => void;
16
+ onDragEnd: () => void;
17
+ onDrop: (event: DragEvent<HTMLElement>) => void;
18
+ };
19
+ moveItem: (fromIndex: number, toIndex: number) => void;
20
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Cycles through `messages`, one every `intervalMs`.
3
+ * `isFading` is true for a short moment before each swap so the caller can fade the text out.
4
+ * `paused` holds the current message, for a pause control or while the reader hovers or focuses
5
+ * it; the timer starts over when it clears.
6
+ */
7
+ export declare function useRotatingMessage(messages: string[], intervalMs?: number, paused?: boolean): {
8
+ message: string;
9
+ isFading: boolean;
10
+ };
@@ -0,0 +1,42 @@
1
+ export { default as Button } from './components/Button';
2
+ export type { ButtonProps } from './components/Button';
3
+ export { default as Card } from './components/Card';
4
+ export type { CardProps } from './components/Card';
5
+ export { default as Container } from './components/Container';
6
+ export type { ContainerProps } from './components/Container';
7
+ export { default as Icon, ICON_NAMES } from './components/Icon';
8
+ export type { IconName, IconProps } from './components/Icon';
9
+ export { default as Markdown } from './components/Markdown';
10
+ export type { MarkdownProps } from './components/Markdown';
11
+ export { default as MarkdownEditor } from './components/MarkdownEditor';
12
+ export type { MarkdownAction, MarkdownEditorLabels, MarkdownEditorProps, } from './components/MarkdownEditor';
13
+ export { default as MatrixContainer, MATRIX_CONFIG, MATRIX_PRESETS, MATRIX_THEME_CONFIG, } from './components/MatrixContainer';
14
+ export type { MatrixConfig, MatrixContainerProps, MatrixPresetName, } from './components/MatrixContainer';
15
+ export { default as OrbitalDots, ORBITAL_DOTS_CONFIG } from './components/OrbitalDots';
16
+ export type { OrbitalDotsConfig, OrbitalDotsProps } from './components/OrbitalDots';
17
+ export { default as PageHero } from './components/PageHero';
18
+ export type { PageHeroProps } from './components/PageHero';
19
+ export { default as PageTransition } from './components/PageTransition';
20
+ export type { PageTransitionProps } from './components/PageTransition';
21
+ export { default as Section } from './components/Section';
22
+ export type { SectionProps } from './components/Section';
23
+ export { default as Select } from './components/Select';
24
+ export type { SelectProps } from './components/Select';
25
+ export { default as ShimmerImage } from './components/ShimmerImage';
26
+ export type { ShimmerImageProps } from './components/ShimmerImage';
27
+ export { default as SideNav } from './components/SideNav';
28
+ export type { SideNavGroup, SideNavItem, SideNavProps } from './components/SideNav';
29
+ export { default as Tag } from './components/Tag';
30
+ export type { TagProps } from './components/Tag';
31
+ export { default as TagFilter } from './components/TagFilter';
32
+ export type { TagFilterProps } from './components/TagFilter';
33
+ export { default as Text } from './components/Text';
34
+ export type { TextProps, TextSize, TextTone, TextVariant, TextWeight } from './components/Text';
35
+ export { default as TextArea } from './components/TextArea';
36
+ export type { TextAreaProps } from './components/TextArea';
37
+ export { default as TextInput } from './components/TextInput';
38
+ export type { TextInputProps } from './components/TextInput';
39
+ export { ToastProvider, useToast } from './components/Toast';
40
+ export type { ToastProviderProps, ToastVariant } from './components/Toast';
41
+ export { useDragReorder } from './hooks/useDragReorder';
42
+ export { useRotatingMessage } from './hooks/useRotatingMessage';