@openwarelabs/ui 0.10.0 → 0.11.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 +5 -1
- package/dist/components/Avatar/Avatar.d.cts +2 -13
- package/dist/components/Avatar/Avatar.d.ts +2 -13
- package/dist/components/Avatar/Avatar.types.d.cts +13 -0
- package/dist/components/Avatar/Avatar.types.d.ts +13 -0
- package/dist/components/Calendar/DatePicker.d.cts +2 -19
- package/dist/components/Calendar/DatePicker.d.ts +2 -19
- package/dist/components/Calendar/DatePicker.types.d.cts +19 -0
- package/dist/components/Calendar/DatePicker.types.d.ts +19 -0
- package/dist/components/Calendar/DateRangePicker.d.cts +2 -34
- package/dist/components/Calendar/DateRangePicker.d.ts +2 -34
- package/dist/components/Calendar/DateRangePicker.types.d.cts +34 -0
- package/dist/components/Calendar/DateRangePicker.types.d.ts +34 -0
- package/dist/components/ColorPicker/ColorPicker.d.cts +2 -55
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -55
- package/dist/components/ColorPicker/ColorPicker.types.d.cts +54 -0
- package/dist/components/ColorPicker/ColorPicker.types.d.ts +54 -0
- package/dist/components/Container/Container.d.cts +7 -0
- package/dist/components/Container/Container.d.ts +7 -0
- package/dist/components/Container/Container.types.d.cts +12 -0
- package/dist/components/Container/Container.types.d.ts +12 -0
- package/dist/components/ListBox/ListBox.d.cts +3 -61
- package/dist/components/ListBox/ListBox.d.ts +3 -61
- package/dist/components/ListBox/ListBox.types.d.cts +61 -0
- package/dist/components/ListBox/ListBox.types.d.ts +61 -0
- package/dist/components/Prose/Prose.d.cts +2 -16
- package/dist/components/Prose/Prose.d.ts +2 -16
- package/dist/components/Prose/Prose.types.d.cts +16 -0
- package/dist/components/Prose/Prose.types.d.ts +16 -0
- package/dist/components/Section/Section.d.cts +7 -0
- package/dist/components/Section/Section.d.ts +7 -0
- package/dist/components/Section/Section.types.d.cts +16 -0
- package/dist/components/Section/Section.types.d.ts +16 -0
- package/dist/components.css +83 -0
- package/dist/index.cjs +333 -298
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +320 -285
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +7 -7
- package/dist/styles.css +86 -0
- package/dist/tokens.css +3 -0
- package/dist/tokens.json +15 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
React components and design tokens with a quiet, tactile look: a midnight brand colour, a brass accent kept small, cool slate surfaces, buttons that press in, and Inter. Light and dark themes, and a brand colour you can swap.
|
|
4
4
|
|
|
5
|
+
**Docs: [openwarelabs.github.io/ui](https://openwarelabs.github.io/ui/)**: every component with live examples and props, every block, the tokens and the guides. It's published from each release, so it matches the packages on npm.
|
|
6
|
+
|
|
5
7
|
## Docs
|
|
6
8
|
|
|
9
|
+
To run them from the repository:
|
|
10
|
+
|
|
7
11
|
```sh
|
|
8
12
|
npm install # installs and builds dist/
|
|
9
13
|
npm run dev # the docs site: http://localhost:5173
|
|
@@ -133,7 +137,7 @@ Five checks have to pass to merge:
|
|
|
133
137
|
- **Visual**: every block (desktop and phone width) and every component example, in light and dark, rendered from the PR and from `main` and compared pixel by pixel. If something looks different, the run's summary lists it and the `visual-report` artifact shows each one before, after and with the changed pixels marked. When the change is meant, add the **visual change** label and the check passes. `npm run visual` runs the same comparison locally against `main` (`-- --filter Hero` for a few).
|
|
134
138
|
- **Accessibility**: axe over every block (desktop and phone width) and every component example, in light and dark, against WCAG 2.2 A and AA. The run's summary lists each problem with the element and how to fix it. `a11y-known.json` lists the problems there already were, which don't fail it; fixing one means lowering its count. `npm run a11y` runs it locally (`-- --filter Hero` for a few).
|
|
135
139
|
|
|
136
|
-
Dependabot opens a pull request each Monday with the week's npm and GitHub Actions updates, minor and patch ones grouped
|
|
140
|
+
Dependabot opens a pull request each Monday with the week's npm and GitHub Actions updates, minor and patch ones grouped, and React with React DOM in one. Only Checks runs on those (types, builds, size and the package smoke test): PR title, Cleaner, Visual and Accessibility are for changes people make, and skipped jobs count as passing.
|
|
137
141
|
|
|
138
142
|
`scripts/setup-github.sh` sets this up on GitHub (squash merges only, the PR title as the commit, the ruleset for `main`, the visual change label). Repository admins can bypass the ruleset, which `npm run release` uses to push its version commit and tag.
|
|
139
143
|
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
/** A photo URL. If it fails to load, the initials show instead. */
|
|
6
|
-
src?: string;
|
|
7
|
-
/** sm 24px, md 28px, lg 36px, xl 48px, or any size in pixels, such as 96 for a team page. The initials scale with it.
|
|
8
|
-
* @default "md" */
|
|
9
|
-
size?: AvatarSize;
|
|
10
|
-
/** Give it when the avatar stands alone; beside the name, leave it out and it's hidden from screen readers. */
|
|
11
|
-
label?: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
export type AvatarSize = "sm" | "md" | "lg" | "xl" | number;
|
|
2
|
+
import type { AvatarProps, AvatarSize } from "./Avatar.types.cjs";
|
|
3
|
+
export type { AvatarProps, AvatarSize } from "./Avatar.types.cjs";
|
|
15
4
|
/**
|
|
16
5
|
* The class and style that size an avatar: a named size's class, or a pixel size through --ow-avatar-size.
|
|
17
6
|
* @internal
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
/** A photo URL. If it fails to load, the initials show instead. */
|
|
6
|
-
src?: string;
|
|
7
|
-
/** sm 24px, md 28px, lg 36px, xl 48px, or any size in pixels, such as 96 for a team page. The initials scale with it.
|
|
8
|
-
* @default "md" */
|
|
9
|
-
size?: AvatarSize;
|
|
10
|
-
/** Give it when the avatar stands alone; beside the name, leave it out and it's hidden from screen readers. */
|
|
11
|
-
label?: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
export type AvatarSize = "sm" | "md" | "lg" | "xl" | number;
|
|
2
|
+
import type { AvatarProps, AvatarSize } from "./Avatar.types.js";
|
|
3
|
+
export type { AvatarProps, AvatarSize } from "./Avatar.types.js";
|
|
15
4
|
/**
|
|
16
5
|
* The class and style that size an avatar: a named size's class, or a pixel size through --ow-avatar-size.
|
|
17
6
|
* @internal
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AvatarProps {
|
|
2
|
+
/** The person's name; its initials show when there's no image. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** A photo URL. If it fails to load, the initials show instead. */
|
|
5
|
+
src?: string;
|
|
6
|
+
/** sm 24px, md 28px, lg 36px, xl 48px, or any size in pixels, such as 96 for a team page. The initials scale with it.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
/** Give it when the avatar stands alone; beside the name, leave it out and it's hidden from screen readers. */
|
|
10
|
+
label?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl" | number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AvatarProps {
|
|
2
|
+
/** The person's name; its initials show when there's no image. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** A photo URL. If it fails to load, the initials show instead. */
|
|
5
|
+
src?: string;
|
|
6
|
+
/** sm 24px, md 28px, lg 36px, xl 48px, or any size in pixels, such as 96 for a team page. The initials scale with it.
|
|
7
|
+
* @default "md" */
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
/** Give it when the avatar stands alone; beside the name, leave it out and it's hidden from screen readers. */
|
|
10
|
+
label?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl" | number;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
/** Shown when no date is chosen.
|
|
4
|
-
* @default "Pick a date" */
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
/** How the chosen date is written in the field.
|
|
7
|
-
* @default { dateStyle: "medium" } */
|
|
8
|
-
formatOptions?: Intl.DateTimeFormatOptions;
|
|
9
|
-
/** @default "md" */
|
|
10
|
-
size?: "sm" | "md";
|
|
11
|
-
/** @default false */
|
|
12
|
-
isInvalid?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
id?: string;
|
|
15
|
-
"aria-label"?: string;
|
|
16
|
-
"aria-labelledby"?: string;
|
|
17
|
-
"aria-describedby"?: string;
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
1
|
+
import type { DatePickerProps } from "./DatePicker.types.cjs";
|
|
2
|
+
export type { DatePickerProps } from "./DatePicker.types.cjs";
|
|
20
3
|
/** A field that opens a Calendar. Choosing a date closes it; Escape closes it without changing anything. */
|
|
21
4
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
/** Shown when no date is chosen.
|
|
4
|
-
* @default "Pick a date" */
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
/** How the chosen date is written in the field.
|
|
7
|
-
* @default { dateStyle: "medium" } */
|
|
8
|
-
formatOptions?: Intl.DateTimeFormatOptions;
|
|
9
|
-
/** @default "md" */
|
|
10
|
-
size?: "sm" | "md";
|
|
11
|
-
/** @default false */
|
|
12
|
-
isInvalid?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
id?: string;
|
|
15
|
-
"aria-label"?: string;
|
|
16
|
-
"aria-labelledby"?: string;
|
|
17
|
-
"aria-describedby"?: string;
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
1
|
+
import type { DatePickerProps } from "./DatePicker.types.js";
|
|
2
|
+
export type { DatePickerProps } from "./DatePicker.types.js";
|
|
20
3
|
/** A field that opens a Calendar. Choosing a date closes it; Escape closes it without changing anything. */
|
|
21
4
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CalendarProps } from "./Calendar.cjs";
|
|
2
|
+
export interface DatePickerProps extends Omit<CalendarProps, "autoFocus" | "className"> {
|
|
3
|
+
/** Shown when no date is chosen.
|
|
4
|
+
* @default "Pick a date" */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** How the chosen date is written in the field.
|
|
7
|
+
* @default { dateStyle: "medium" } */
|
|
8
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
9
|
+
/** @default "md" */
|
|
10
|
+
size?: "sm" | "md";
|
|
11
|
+
/** @default false */
|
|
12
|
+
isInvalid?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
id?: string;
|
|
15
|
+
"aria-label"?: string;
|
|
16
|
+
"aria-labelledby"?: string;
|
|
17
|
+
"aria-describedby"?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CalendarProps } from "./Calendar.js";
|
|
2
|
+
export interface DatePickerProps extends Omit<CalendarProps, "autoFocus" | "className"> {
|
|
3
|
+
/** Shown when no date is chosen.
|
|
4
|
+
* @default "Pick a date" */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** How the chosen date is written in the field.
|
|
7
|
+
* @default { dateStyle: "medium" } */
|
|
8
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
9
|
+
/** @default "md" */
|
|
10
|
+
size?: "sm" | "md";
|
|
11
|
+
/** @default false */
|
|
12
|
+
isInvalid?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
id?: string;
|
|
15
|
+
"aria-label"?: string;
|
|
16
|
+
"aria-labelledby"?: string;
|
|
17
|
+
"aria-describedby"?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export interface DateRangePreset {
|
|
4
|
-
/** What the list shows, in sentence case. */
|
|
5
|
-
label: string;
|
|
6
|
-
range: DateRange;
|
|
7
|
-
}
|
|
8
|
-
export interface DateRangePickerProps extends Omit<RangeCalendarProps, "autoFocus" | "className" | "visibleMonths"> {
|
|
9
|
-
/** Ranges to pick in one go, listed beside the calendar: "Last 7 days", "This month". */
|
|
10
|
-
presets?: DateRangePreset[];
|
|
11
|
-
/** How many months the calendar shows side by side. Phones always get one.
|
|
12
|
-
* @default 2 */
|
|
13
|
-
visibleMonths?: 1 | 2;
|
|
14
|
-
/** Shown when no range is chosen.
|
|
15
|
-
* @default "Pick dates" */
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
/** How each date is written in the field; dates the two ends share are written once, as in "3 – 9 Oct 2026".
|
|
18
|
-
* @default { dateStyle: "medium" } */
|
|
19
|
-
formatOptions?: Intl.DateTimeFormatOptions;
|
|
20
|
-
/** md is 40px tall, sm 32px.
|
|
21
|
-
* @default "md" */
|
|
22
|
-
size?: "sm" | "md";
|
|
23
|
-
/** @default false */
|
|
24
|
-
isInvalid?: boolean;
|
|
25
|
-
/** @default false */
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** For the field's button, so a label can point at it. */
|
|
28
|
-
id?: string;
|
|
29
|
-
"aria-label"?: string;
|
|
30
|
-
"aria-labelledby"?: string;
|
|
31
|
-
"aria-describedby"?: string;
|
|
32
|
-
/** Classes for the field, e.g. a width. */
|
|
33
|
-
className?: string;
|
|
34
|
-
}
|
|
1
|
+
import type { DateRangePickerProps } from "./DateRangePicker.types.cjs";
|
|
2
|
+
export type { DateRangePickerProps, DateRangePreset } from "./DateRangePicker.types.cjs";
|
|
35
3
|
/**
|
|
36
4
|
* A field that opens a two-month RangeCalendar, with optional presets beside it. Picking the second day, or a preset,
|
|
37
5
|
* closes it; Escape closes it without changing anything. Once there's a range, a clear button empties it.
|
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export interface DateRangePreset {
|
|
4
|
-
/** What the list shows, in sentence case. */
|
|
5
|
-
label: string;
|
|
6
|
-
range: DateRange;
|
|
7
|
-
}
|
|
8
|
-
export interface DateRangePickerProps extends Omit<RangeCalendarProps, "autoFocus" | "className" | "visibleMonths"> {
|
|
9
|
-
/** Ranges to pick in one go, listed beside the calendar: "Last 7 days", "This month". */
|
|
10
|
-
presets?: DateRangePreset[];
|
|
11
|
-
/** How many months the calendar shows side by side. Phones always get one.
|
|
12
|
-
* @default 2 */
|
|
13
|
-
visibleMonths?: 1 | 2;
|
|
14
|
-
/** Shown when no range is chosen.
|
|
15
|
-
* @default "Pick dates" */
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
/** How each date is written in the field; dates the two ends share are written once, as in "3 – 9 Oct 2026".
|
|
18
|
-
* @default { dateStyle: "medium" } */
|
|
19
|
-
formatOptions?: Intl.DateTimeFormatOptions;
|
|
20
|
-
/** md is 40px tall, sm 32px.
|
|
21
|
-
* @default "md" */
|
|
22
|
-
size?: "sm" | "md";
|
|
23
|
-
/** @default false */
|
|
24
|
-
isInvalid?: boolean;
|
|
25
|
-
/** @default false */
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** For the field's button, so a label can point at it. */
|
|
28
|
-
id?: string;
|
|
29
|
-
"aria-label"?: string;
|
|
30
|
-
"aria-labelledby"?: string;
|
|
31
|
-
"aria-describedby"?: string;
|
|
32
|
-
/** Classes for the field, e.g. a width. */
|
|
33
|
-
className?: string;
|
|
34
|
-
}
|
|
1
|
+
import type { DateRangePickerProps } from "./DateRangePicker.types.js";
|
|
2
|
+
export type { DateRangePickerProps, DateRangePreset } from "./DateRangePicker.types.js";
|
|
35
3
|
/**
|
|
36
4
|
* A field that opens a two-month RangeCalendar, with optional presets beside it. Picking the second day, or a preset,
|
|
37
5
|
* closes it; Escape closes it without changing anything. Once there's a range, a clear button empties it.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DateRange, RangeCalendarProps } from "./RangeCalendar.cjs";
|
|
2
|
+
/** A named range to pick in one go, such as "Last 7 days". */
|
|
3
|
+
export interface DateRangePreset {
|
|
4
|
+
/** What the list shows, in sentence case. */
|
|
5
|
+
label: string;
|
|
6
|
+
range: DateRange;
|
|
7
|
+
}
|
|
8
|
+
export interface DateRangePickerProps extends Omit<RangeCalendarProps, "autoFocus" | "className" | "visibleMonths"> {
|
|
9
|
+
/** Ranges to pick in one go, listed beside the calendar: "Last 7 days", "This month". */
|
|
10
|
+
presets?: DateRangePreset[];
|
|
11
|
+
/** How many months the calendar shows side by side. Phones always get one.
|
|
12
|
+
* @default 2 */
|
|
13
|
+
visibleMonths?: 1 | 2;
|
|
14
|
+
/** Shown when no range is chosen.
|
|
15
|
+
* @default "Pick dates" */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** How each date is written in the field; dates the two ends share are written once, as in "3 – 9 Oct 2026".
|
|
18
|
+
* @default { dateStyle: "medium" } */
|
|
19
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
20
|
+
/** md is 40px tall, sm 32px.
|
|
21
|
+
* @default "md" */
|
|
22
|
+
size?: "sm" | "md";
|
|
23
|
+
/** @default false */
|
|
24
|
+
isInvalid?: boolean;
|
|
25
|
+
/** @default false */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** For the field's button, so a label can point at it. */
|
|
28
|
+
id?: string;
|
|
29
|
+
"aria-label"?: string;
|
|
30
|
+
"aria-labelledby"?: string;
|
|
31
|
+
"aria-describedby"?: string;
|
|
32
|
+
/** Classes for the field, e.g. a width. */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DateRange, RangeCalendarProps } from "./RangeCalendar.js";
|
|
2
|
+
/** A named range to pick in one go, such as "Last 7 days". */
|
|
3
|
+
export interface DateRangePreset {
|
|
4
|
+
/** What the list shows, in sentence case. */
|
|
5
|
+
label: string;
|
|
6
|
+
range: DateRange;
|
|
7
|
+
}
|
|
8
|
+
export interface DateRangePickerProps extends Omit<RangeCalendarProps, "autoFocus" | "className" | "visibleMonths"> {
|
|
9
|
+
/** Ranges to pick in one go, listed beside the calendar: "Last 7 days", "This month". */
|
|
10
|
+
presets?: DateRangePreset[];
|
|
11
|
+
/** How many months the calendar shows side by side. Phones always get one.
|
|
12
|
+
* @default 2 */
|
|
13
|
+
visibleMonths?: 1 | 2;
|
|
14
|
+
/** Shown when no range is chosen.
|
|
15
|
+
* @default "Pick dates" */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** How each date is written in the field; dates the two ends share are written once, as in "3 – 9 Oct 2026".
|
|
18
|
+
* @default { dateStyle: "medium" } */
|
|
19
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
20
|
+
/** md is 40px tall, sm 32px.
|
|
21
|
+
* @default "md" */
|
|
22
|
+
size?: "sm" | "md";
|
|
23
|
+
/** @default false */
|
|
24
|
+
isInvalid?: boolean;
|
|
25
|
+
/** @default false */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** For the field's button, so a label can point at it. */
|
|
28
|
+
id?: string;
|
|
29
|
+
"aria-label"?: string;
|
|
30
|
+
"aria-labelledby"?: string;
|
|
31
|
+
"aria-describedby"?: string;
|
|
32
|
+
/** Classes for the field, e.g. a width. */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
@@ -1,62 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type ColorSwatchOption = string | {
|
|
4
|
-
color: string;
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
export interface ColorPickerProps {
|
|
8
|
-
/** A hex colour: "#0d9488", or "#0d9488cc" with alpha. */
|
|
9
|
-
value?: string;
|
|
10
|
-
/** @default "#312c7e" */
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
/** Called with a lowercase hex colour as the person drags, types or picks. */
|
|
13
|
-
onChange?(color: string): void;
|
|
14
|
-
/** Adds an opacity slider; colours come back as #rrggbbaa.
|
|
15
|
-
* @default false */
|
|
16
|
-
alpha?: boolean;
|
|
17
|
-
/** Ready-made colours as swatches under the picker. */
|
|
18
|
-
swatches?: ColorSwatchOption[];
|
|
19
|
-
/** The hex field under the picker.
|
|
20
|
-
* @default true */
|
|
21
|
-
showInput?: boolean;
|
|
22
|
-
/** A button that picks a colour from anywhere on the screen, where the browser can (Chrome and Edge).
|
|
23
|
-
* @default true */
|
|
24
|
-
eyeDropper?: boolean;
|
|
25
|
-
/** Names the picker for screen readers.
|
|
26
|
-
* @default "Colour" */
|
|
27
|
-
"aria-label"?: string;
|
|
28
|
-
className?: string;
|
|
29
|
-
}
|
|
30
|
-
interface EyeDropperResult {
|
|
31
|
-
sRGBHex: string;
|
|
32
|
-
}
|
|
33
|
-
declare global {
|
|
34
|
-
interface Window {
|
|
35
|
-
EyeDropper?: new () => {
|
|
36
|
-
open(): Promise<EyeDropperResult>;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
import type { ColorFieldProps, ColorPickerProps } from "./ColorPicker.types.cjs";
|
|
2
|
+
export type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from "./ColorPicker.types.cjs";
|
|
40
3
|
/**
|
|
41
4
|
* Picks a colour: a saturation area and a hue slider (react-colorful, dressed in Openware's look), a hex field,
|
|
42
5
|
* an eyedropper where the browser has one, and optional swatches. The area and sliders work with the arrow keys.
|
|
43
6
|
*/
|
|
44
7
|
export declare function ColorPicker({ value, defaultValue, onChange, alpha, swatches, showInput, eyeDropper, "aria-label": ariaLabel, className, }: ColorPickerProps): import("react").JSX.Element;
|
|
45
|
-
export interface ColorFieldProps extends Omit<ColorPickerProps, "className" | "aria-label"> {
|
|
46
|
-
/** @default "md" */
|
|
47
|
-
size?: "sm" | "md";
|
|
48
|
-
/** @default false */
|
|
49
|
-
isInvalid?: boolean;
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
/** Where the picker opens; it flips when there's no room.
|
|
52
|
-
* @default "bottom-start" */
|
|
53
|
-
placement?: Placement;
|
|
54
|
-
id?: string;
|
|
55
|
-
"aria-label"?: string;
|
|
56
|
-
"aria-labelledby"?: string;
|
|
57
|
-
"aria-describedby"?: string;
|
|
58
|
-
className?: string;
|
|
59
|
-
}
|
|
60
8
|
/** A field that shows a colour and its hex, and opens a ColorPicker below. Escape or a click outside closes it. */
|
|
61
9
|
export declare const ColorField: import("react").ForwardRefExoticComponent<ColorFieldProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
62
|
-
export {};
|
|
@@ -1,62 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type ColorSwatchOption = string | {
|
|
4
|
-
color: string;
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
export interface ColorPickerProps {
|
|
8
|
-
/** A hex colour: "#0d9488", or "#0d9488cc" with alpha. */
|
|
9
|
-
value?: string;
|
|
10
|
-
/** @default "#312c7e" */
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
/** Called with a lowercase hex colour as the person drags, types or picks. */
|
|
13
|
-
onChange?(color: string): void;
|
|
14
|
-
/** Adds an opacity slider; colours come back as #rrggbbaa.
|
|
15
|
-
* @default false */
|
|
16
|
-
alpha?: boolean;
|
|
17
|
-
/** Ready-made colours as swatches under the picker. */
|
|
18
|
-
swatches?: ColorSwatchOption[];
|
|
19
|
-
/** The hex field under the picker.
|
|
20
|
-
* @default true */
|
|
21
|
-
showInput?: boolean;
|
|
22
|
-
/** A button that picks a colour from anywhere on the screen, where the browser can (Chrome and Edge).
|
|
23
|
-
* @default true */
|
|
24
|
-
eyeDropper?: boolean;
|
|
25
|
-
/** Names the picker for screen readers.
|
|
26
|
-
* @default "Colour" */
|
|
27
|
-
"aria-label"?: string;
|
|
28
|
-
className?: string;
|
|
29
|
-
}
|
|
30
|
-
interface EyeDropperResult {
|
|
31
|
-
sRGBHex: string;
|
|
32
|
-
}
|
|
33
|
-
declare global {
|
|
34
|
-
interface Window {
|
|
35
|
-
EyeDropper?: new () => {
|
|
36
|
-
open(): Promise<EyeDropperResult>;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
import type { ColorFieldProps, ColorPickerProps } from "./ColorPicker.types.js";
|
|
2
|
+
export type { ColorFieldProps, ColorPickerProps, ColorSwatchOption } from "./ColorPicker.types.js";
|
|
40
3
|
/**
|
|
41
4
|
* Picks a colour: a saturation area and a hue slider (react-colorful, dressed in Openware's look), a hex field,
|
|
42
5
|
* an eyedropper where the browser has one, and optional swatches. The area and sliders work with the arrow keys.
|
|
43
6
|
*/
|
|
44
7
|
export declare function ColorPicker({ value, defaultValue, onChange, alpha, swatches, showInput, eyeDropper, "aria-label": ariaLabel, className, }: ColorPickerProps): import("react").JSX.Element;
|
|
45
|
-
export interface ColorFieldProps extends Omit<ColorPickerProps, "className" | "aria-label"> {
|
|
46
|
-
/** @default "md" */
|
|
47
|
-
size?: "sm" | "md";
|
|
48
|
-
/** @default false */
|
|
49
|
-
isInvalid?: boolean;
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
/** Where the picker opens; it flips when there's no room.
|
|
52
|
-
* @default "bottom-start" */
|
|
53
|
-
placement?: Placement;
|
|
54
|
-
id?: string;
|
|
55
|
-
"aria-label"?: string;
|
|
56
|
-
"aria-labelledby"?: string;
|
|
57
|
-
"aria-describedby"?: string;
|
|
58
|
-
className?: string;
|
|
59
|
-
}
|
|
60
8
|
/** A field that shows a colour and its hex, and opens a ColorPicker below. Escape or a click outside closes it. */
|
|
61
9
|
export declare const ColorField: import("react").ForwardRefExoticComponent<ColorFieldProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
62
|
-
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Placement } from "../../hooks/useFloating.cjs";
|
|
2
|
+
/** What a swatch is: a colour, or a colour with a name to read out. */
|
|
3
|
+
export type ColorSwatchOption = string | {
|
|
4
|
+
color: string;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
export interface ColorPickerProps {
|
|
8
|
+
/** A hex colour: "#0d9488", or "#0d9488cc" with alpha. */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** @default "#312c7e" */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** Called with a lowercase hex colour as the person drags, types or picks. */
|
|
13
|
+
onChange?(color: string): void;
|
|
14
|
+
/** Adds an opacity slider; colours come back as #rrggbbaa.
|
|
15
|
+
* @default false */
|
|
16
|
+
alpha?: boolean;
|
|
17
|
+
/** Ready-made colours as swatches under the picker. */
|
|
18
|
+
swatches?: ColorSwatchOption[];
|
|
19
|
+
/** The hex field under the picker.
|
|
20
|
+
* @default true */
|
|
21
|
+
showInput?: boolean;
|
|
22
|
+
/** A button that picks a colour from anywhere on the screen, where the browser can (Chrome and Edge).
|
|
23
|
+
* @default true */
|
|
24
|
+
eyeDropper?: boolean;
|
|
25
|
+
/** Names the picker for screen readers.
|
|
26
|
+
* @default "Colour" */
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EyeDropperResult {
|
|
31
|
+
sRGBHex: string;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
EyeDropper?: new () => {
|
|
36
|
+
open(): Promise<EyeDropperResult>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export interface ColorFieldProps extends Omit<ColorPickerProps, "className" | "aria-label"> {
|
|
41
|
+
/** @default "md" */
|
|
42
|
+
size?: "sm" | "md";
|
|
43
|
+
/** @default false */
|
|
44
|
+
isInvalid?: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Where the picker opens; it flips when there's no room.
|
|
47
|
+
* @default "bottom-start" */
|
|
48
|
+
placement?: Placement;
|
|
49
|
+
id?: string;
|
|
50
|
+
"aria-label"?: string;
|
|
51
|
+
"aria-labelledby"?: string;
|
|
52
|
+
"aria-describedby"?: string;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Placement } from "../../hooks/useFloating.js";
|
|
2
|
+
/** What a swatch is: a colour, or a colour with a name to read out. */
|
|
3
|
+
export type ColorSwatchOption = string | {
|
|
4
|
+
color: string;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
export interface ColorPickerProps {
|
|
8
|
+
/** A hex colour: "#0d9488", or "#0d9488cc" with alpha. */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** @default "#312c7e" */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** Called with a lowercase hex colour as the person drags, types or picks. */
|
|
13
|
+
onChange?(color: string): void;
|
|
14
|
+
/** Adds an opacity slider; colours come back as #rrggbbaa.
|
|
15
|
+
* @default false */
|
|
16
|
+
alpha?: boolean;
|
|
17
|
+
/** Ready-made colours as swatches under the picker. */
|
|
18
|
+
swatches?: ColorSwatchOption[];
|
|
19
|
+
/** The hex field under the picker.
|
|
20
|
+
* @default true */
|
|
21
|
+
showInput?: boolean;
|
|
22
|
+
/** A button that picks a colour from anywhere on the screen, where the browser can (Chrome and Edge).
|
|
23
|
+
* @default true */
|
|
24
|
+
eyeDropper?: boolean;
|
|
25
|
+
/** Names the picker for screen readers.
|
|
26
|
+
* @default "Colour" */
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EyeDropperResult {
|
|
31
|
+
sRGBHex: string;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
EyeDropper?: new () => {
|
|
36
|
+
open(): Promise<EyeDropperResult>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export interface ColorFieldProps extends Omit<ColorPickerProps, "className" | "aria-label"> {
|
|
41
|
+
/** @default "md" */
|
|
42
|
+
size?: "sm" | "md";
|
|
43
|
+
/** @default false */
|
|
44
|
+
isInvalid?: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Where the picker opens; it flips when there's no room.
|
|
47
|
+
* @default "bottom-start" */
|
|
48
|
+
placement?: Placement;
|
|
49
|
+
id?: string;
|
|
50
|
+
"aria-label"?: string;
|
|
51
|
+
"aria-labelledby"?: string;
|
|
52
|
+
"aria-describedby"?: string;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContainerProps } from "./Container.types.cjs";
|
|
2
|
+
export type { ContainerProps, ContainerSize } from "./Container.types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Centres content at a set width with the page's side margins: 32px, and the phone gutter under 760px. Every block
|
|
5
|
+
* lines its content up the same way, so whatever sits in a Container lines up with the blocks above and below it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Container({ size, as: Element, className, ...props }: ContainerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContainerProps } from "./Container.types.js";
|
|
2
|
+
export type { ContainerProps, ContainerSize } from "./Container.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Centres content at a set width with the page's side margins: 32px, and the phone gutter under 760px. Every block
|
|
5
|
+
* lines its content up the same way, so whatever sits in a Container lines up with the blocks above and below it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Container({ size, as: Element, className, ...props }: ContainerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from "react";
|
|
2
|
+
export type ContainerSize = "narrow" | "page" | "wide" | "full";
|
|
3
|
+
export interface ContainerProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* How wide the content can get: `page` is the blocks' width (1200px), `narrow` a reading width for an article or
|
|
6
|
+
* a form (720px), `wide` room for a dashboard or a big table (1440px), `full` no cap, only the side margins.
|
|
7
|
+
* @default "page"
|
|
8
|
+
*/
|
|
9
|
+
size?: ContainerSize;
|
|
10
|
+
/** The element to render, such as `main` or `section`. @default "div" */
|
|
11
|
+
as?: ElementType;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from "react";
|
|
2
|
+
export type ContainerSize = "narrow" | "page" | "wide" | "full";
|
|
3
|
+
export interface ContainerProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* How wide the content can get: `page` is the blocks' width (1200px), `narrow` a reading width for an article or
|
|
6
|
+
* a form (720px), `wide` room for a dashboard or a big table (1440px), `full` no cap, only the side margins.
|
|
7
|
+
* @default "page"
|
|
8
|
+
*/
|
|
9
|
+
size?: ContainerSize;
|
|
10
|
+
/** The element to render, such as `main` or `section`. @default "div" */
|
|
11
|
+
as?: ElementType;
|
|
12
|
+
}
|