@paul-portfolio/react 0.4.0 → 0.4.2
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/dist/Button.d.ts +1 -1
- package/dist/FilterBar.d.ts +15 -0
- package/dist/FilterBar.js +11 -0
- package/dist/Select.d.ts +20 -0
- package/dist/Select.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type AnchorHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
2
|
+
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'gel';
|
|
3
3
|
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
4
|
type BaseProps = {
|
|
5
5
|
variant?: ButtonVariant;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A labelled region that holds a wrapping row of filter controls (typically
|
|
4
|
+
* `Select`s). Renders a `<section>` landmark so its controls sit inside a named
|
|
5
|
+
* region, with a centered, max-width row that wraps when space is tight.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FilterBar: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "aria-label"> & {
|
|
8
|
+
/**
|
|
9
|
+
* Accessible name for the region (e.g. "Team and player filters"). Required
|
|
10
|
+
* because the bar is a labelled landmark; without a name the region would be
|
|
11
|
+
* ignored by assistive tech.
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from './cx';
|
|
4
|
+
/**
|
|
5
|
+
* A labelled region that holds a wrapping row of filter controls (typically
|
|
6
|
+
* `Select`s). Renders a `<section>` landmark so its controls sit inside a named
|
|
7
|
+
* region, with a centered, max-width row that wraps when space is tight.
|
|
8
|
+
*/
|
|
9
|
+
export const FilterBar = forwardRef(function FilterBar({ label, children, className, ...props }, ref) {
|
|
10
|
+
return (_jsx("section", { ref: ref, "aria-label": label, className: cx('filter-bar', className), ...props, children: _jsx("div", { className: "filter-bar__row", children: children }) }));
|
|
11
|
+
});
|
package/dist/Select.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type SelectHTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A labelled, accessible `<select>` that shares the input styling and paints
|
|
4
|
+
* its own chevron (the native one is hidden for cross-browser consistency).
|
|
5
|
+
* When rendered without a visible `label`, pass an `aria-label` so the control
|
|
6
|
+
* still has an accessible name.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Select: import("react").ForwardRefExoticComponent<Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> & {
|
|
9
|
+
label?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
helper?: string;
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
/**
|
|
14
|
+
* `vertical` (default) stacks the label above the control, matching the
|
|
15
|
+
* input field family. `horizontal` puts the label inline to the left, for
|
|
16
|
+
* compact filter rows (see `FilterBar`).
|
|
17
|
+
*/
|
|
18
|
+
orientation?: 'vertical' | 'horizontal';
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
} & import("react").RefAttributes<HTMLSelectElement>>;
|
package/dist/Select.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from 'react';
|
|
3
|
+
import { cx } from './cx';
|
|
4
|
+
/**
|
|
5
|
+
* A labelled, accessible `<select>` that shares the input styling and paints
|
|
6
|
+
* its own chevron (the native one is hidden for cross-browser consistency).
|
|
7
|
+
* When rendered without a visible `label`, pass an `aria-label` so the control
|
|
8
|
+
* still has an accessible name.
|
|
9
|
+
*/
|
|
10
|
+
export const Select = forwardRef(function Select({ label, error, helper, size, orientation = 'vertical', disabled, className, children, ...props }, ref) {
|
|
11
|
+
const id = useId();
|
|
12
|
+
const helperId = `${id}-helper`;
|
|
13
|
+
const helperText = error || helper;
|
|
14
|
+
return (_jsxs("div", { className: cx('select__wrapper', orientation === 'horizontal' && 'select__wrapper--horizontal'), children: [label && _jsx("label", { className: "select__label", htmlFor: id, children: label }), _jsx("select", { ref: ref, id: id, className: cx('select', size && size !== 'md' && `select--${size}`, error && 'select--error', className), disabled: disabled, "aria-invalid": error ? true : undefined, "aria-describedby": helperText ? helperId : undefined, ...props, children: children }), helperText && (_jsx("span", { id: helperId, className: cx('select__helper', error && 'select__helper--error'), children: helperText }))] }));
|
|
15
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { Card } from './Card';
|
|
|
4
4
|
export { Chip } from './Chip';
|
|
5
5
|
export { Input } from './Input';
|
|
6
6
|
export { Textarea } from './Textarea';
|
|
7
|
+
export { Select } from './Select';
|
|
8
|
+
export { FilterBar } from './FilterBar';
|
|
7
9
|
export { Switch } from './Switch';
|
|
8
10
|
export { Modal } from './Modal';
|
|
9
11
|
export { Tooltip } from './Tooltip';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,8 @@ export { Card } from './Card';
|
|
|
4
4
|
export { Chip } from './Chip';
|
|
5
5
|
export { Input } from './Input';
|
|
6
6
|
export { Textarea } from './Textarea';
|
|
7
|
+
export { Select } from './Select';
|
|
8
|
+
export { FilterBar } from './FilterBar';
|
|
7
9
|
export { Switch } from './Switch';
|
|
8
10
|
export { Modal } from './Modal';
|
|
9
11
|
export { Tooltip } from './Tooltip';
|