@gtivr4/a1-design-system-react 0.4.1 → 0.6.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/package.json +2 -1
- package/src/components/accordion/Accordion.d.ts +20 -0
- package/src/components/banner/Banner.d.ts +19 -0
- package/src/components/bleed/Bleed.d.ts +17 -0
- package/src/components/blockquote/Blockquote.d.ts +23 -0
- package/src/components/breadcrumb/Breadcrumb.d.ts +22 -0
- package/src/components/button/Button.d.ts +17 -0
- package/src/components/button-container/ButtonContainer.d.ts +11 -0
- package/src/components/calendar/Calendar.d.ts +75 -0
- package/src/components/card/Card.d.ts +31 -0
- package/src/components/checkbox-group/CheckboxGroup.d.ts +37 -0
- package/src/components/choice-group/ChoiceGroup.d.ts +68 -0
- package/src/components/circular-progress/CircularProgress.d.ts +37 -0
- package/src/components/circular-progress/CircularProgress.jsx +85 -0
- package/src/components/circular-progress/circular-progress.css +104 -0
- package/src/components/cluster/Cluster.d.ts +21 -0
- package/src/components/code/Code.d.ts +15 -0
- package/src/components/data-table/DataTable.d.ts +83 -0
- package/src/components/definition-list/DefinitionList.d.ts +51 -0
- package/src/components/definition-list/DefinitionList.jsx +154 -0
- package/src/components/definition-list/definition-list.css +111 -0
- package/src/components/dialog/Dialog.d.ts +22 -0
- package/src/components/dialog/Dialog.jsx +57 -11
- package/src/components/dialog/dialog.css +36 -3
- package/src/components/divider/Divider.d.ts +22 -0
- package/src/components/field/SelectField.d.ts +22 -0
- package/src/components/field/TextField.d.ts +21 -0
- package/src/components/field/TextareaField.d.ts +28 -0
- package/src/components/field-row/FieldRow.d.ts +8 -0
- package/src/components/fieldset/Fieldset.d.ts +27 -0
- package/src/components/figure/Figure.d.ts +39 -0
- package/src/components/grid/Grid.d.ts +38 -0
- package/src/components/heading/Heading.d.ts +43 -0
- package/src/components/heading/Heading.jsx +2 -2
- package/src/components/icon/Icon.d.ts +35 -0
- package/src/components/icon/Icon.jsx +32 -3
- package/src/components/icon/icon.css +21 -1
- package/src/components/icon-button/IconButton.d.ts +14 -0
- package/src/components/inset/Inset.d.ts +17 -0
- package/src/components/inverse/Inverse.d.ts +9 -0
- package/src/components/link/Link.d.ts +15 -0
- package/src/components/list/List.d.ts +40 -0
- package/src/components/menu/Menu.d.ts +41 -0
- package/src/components/message/Message.d.ts +34 -0
- package/src/components/notification/Notification.d.ts +23 -0
- package/src/components/page-layout/PageLayout.d.ts +24 -0
- package/src/components/page-nav/PageNav.d.ts +19 -0
- package/src/components/pagination/Pagination.d.ts +19 -0
- package/src/components/paragraph/Paragraph.d.ts +23 -0
- package/src/components/radio-group/RadioGroup.d.ts +37 -0
- package/src/components/section/Section.d.ts +33 -0
- package/src/components/segmented-control/SegmentedControl.d.ts +23 -0
- package/src/components/side-nav/SideNav.d.ts +62 -0
- package/src/components/spacer/Spacer.d.ts +16 -0
- package/src/components/stack/Stack.d.ts +38 -0
- package/src/components/status-bar/StatusBar.d.ts +42 -0
- package/src/components/switch/Switch.d.ts +27 -0
- package/src/components/system-banner/SystemBanner.d.ts +17 -0
- package/src/components/tabs/Tabs.d.ts +53 -0
- package/src/index.js +2 -0
- package/src/tokens.css +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtivr4/a1-design-system-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React components for the A1 token-driven design system.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"README.md",
|
|
18
18
|
"guidelines/**/*.md",
|
|
19
19
|
"src/**/*.css",
|
|
20
|
+
"src/**/*.d.ts",
|
|
20
21
|
"src/**/*.jsx",
|
|
21
22
|
"src/index.js",
|
|
22
23
|
"!src/**/*.stories.jsx",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface AccordionProps {
|
|
4
|
+
/** Trigger label text */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Controlled open state */
|
|
7
|
+
open?: boolean;
|
|
8
|
+
/** Initial open state (uncontrolled). Default: false */
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
/** Called with the next boolean when the trigger is clicked */
|
|
11
|
+
onChange?: (open: boolean) => void;
|
|
12
|
+
/** Size — affects trigger text size and padding. Default: "md" */
|
|
13
|
+
size?: "sm" | "md" | "lg";
|
|
14
|
+
/** Prevent the accordion from being toggled. Default: false */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare function Accordion(props: AccordionProps): React.ReactElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface BannerProps {
|
|
4
|
+
/** Layout style. "inline" sits within content; "system" spans full width. Default: "inline" */
|
|
5
|
+
variant?: "inline" | "system";
|
|
6
|
+
/** Semantic status colour. Default: "neutral" */
|
|
7
|
+
status?: "neutral" | "info" | "success" | "warn" | "error";
|
|
8
|
+
/** Bold title text shown before the body */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Override the default status icon with any Material Symbols name */
|
|
11
|
+
icon?: string;
|
|
12
|
+
/** Action element (e.g. a Button) rendered at the trailing end */
|
|
13
|
+
action?: React.ReactNode;
|
|
14
|
+
/** Called when the dismiss button is clicked. Omit to hide the dismiss button. */
|
|
15
|
+
onDismiss?: () => void;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare function Banner(props: BannerProps): React.ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
type SpacingToken = 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 64 | 96 | 128;
|
|
4
|
+
|
|
5
|
+
export interface BleedProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
/** Underlying element. Default: "div" */
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
/** Base bleed amount applied to all axes when no axis-specific value is set. Default: 16 */
|
|
9
|
+
space?: SpacingToken | "none";
|
|
10
|
+
/** Block-axis (top/bottom) bleed override. Default: "none" */
|
|
11
|
+
block?: SpacingToken | "none";
|
|
12
|
+
/** Inline-axis (left/right) bleed override. Falls back to `space`. */
|
|
13
|
+
inline?: SpacingToken;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare function Bleed(props: BleedProps): React.ReactElement;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface BlockquoteProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Visual style variant. Default: "border"
|
|
6
|
+
*
|
|
7
|
+
* border — left accent border, subtle background
|
|
8
|
+
* filled — filled neutral surface
|
|
9
|
+
* feature — large centered text with accent bar, for pullquotes
|
|
10
|
+
* minimal — no decoration, plain text
|
|
11
|
+
* accent — filled action-colour background with inverse text
|
|
12
|
+
* pull — centred editorial with curly quotes
|
|
13
|
+
* ruled — top + bottom horizontal rules, centred
|
|
14
|
+
*/
|
|
15
|
+
variant?: "border" | "filled" | "feature" | "minimal" | "accent" | "pull" | "ruled";
|
|
16
|
+
/** Attribution text rendered as a `<figcaption>` */
|
|
17
|
+
cite?: string;
|
|
18
|
+
/** URL that the cite text links to */
|
|
19
|
+
citeUrl?: string;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare function Blockquote(props: BlockquoteProps): React.ReactElement;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface BreadcrumbItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Ordered list of breadcrumb items.
|
|
12
|
+
* The last item is treated as the current page (non-interactive).
|
|
13
|
+
* All previous items render as links or buttons.
|
|
14
|
+
*/
|
|
15
|
+
items?: BreadcrumbItem[];
|
|
16
|
+
/**
|
|
17
|
+
* Label for the back link shown in narrow containers. Defaults to "Back".
|
|
18
|
+
*/
|
|
19
|
+
backLabel?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare function Breadcrumb(props: BreadcrumbProps): React.ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/** Underlying element or component to render. Default: "button" */
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
/** Visual style. Default: "primary" */
|
|
7
|
+
variant?: "primary" | "secondary" | "tertiary" | "destructive" | "success";
|
|
8
|
+
/** Size. Default: "md" */
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
/** Material Symbols icon name to show alongside the label */
|
|
11
|
+
icon?: string;
|
|
12
|
+
/** Whether the icon appears before or after the label. Default: "start" */
|
|
13
|
+
iconPosition?: "start" | "end";
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare function Button(props: ButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface ButtonContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Horizontal alignment of buttons. Default: "start" */
|
|
5
|
+
align?: "start" | "center" | "end";
|
|
6
|
+
/** Default size passed to child Button elements that do not set their own size. */
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare function ButtonContainer(props: ButtonContainerProps): React.ReactElement;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface CalendarMonth {
|
|
4
|
+
/** Full calendar year, e.g. 2026 */
|
|
5
|
+
year: number;
|
|
6
|
+
/** 1-indexed month: 1 = January … 12 = December */
|
|
7
|
+
month: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CalendarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Display mode.
|
|
13
|
+
* - `"scroll"` — renders all months vertically; parent container controls scrolling (default).
|
|
14
|
+
* - `"paginated"` — shows one month at a time with prev/next buttons and month/year selects.
|
|
15
|
+
*/
|
|
16
|
+
variant?: "scroll" | "paginated";
|
|
17
|
+
/**
|
|
18
|
+
* Month to centre the scroll position on at mount (scroll) or the initial month shown (paginated).
|
|
19
|
+
* Accepts a `Date` object or `{ year, month }` (month is 1-indexed).
|
|
20
|
+
* Defaults to the current month.
|
|
21
|
+
*/
|
|
22
|
+
initialMonth?: Date | CalendarMonth;
|
|
23
|
+
/**
|
|
24
|
+
* Total number of months to render. Only applies to `variant="scroll"`.
|
|
25
|
+
* Default: 13
|
|
26
|
+
*/
|
|
27
|
+
monthsToShow?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Highlight today's date with the action colour.
|
|
30
|
+
* Default: true
|
|
31
|
+
*/
|
|
32
|
+
highlightToday?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Apply a background tint to dates before today.
|
|
35
|
+
* Default: true
|
|
36
|
+
*/
|
|
37
|
+
dimPast?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Show a "Today" button in the paginated nav bar that jumps to the current month.
|
|
40
|
+
* Disabled automatically when already on the current month.
|
|
41
|
+
* Only applies to `variant="paginated"`.
|
|
42
|
+
* Default: false
|
|
43
|
+
*/
|
|
44
|
+
todayButton?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Enables date selection. When false (default), the calendar is display-only —
|
|
47
|
+
* no click handlers, hover effects, or keyboard interaction on day cells.
|
|
48
|
+
* Pass `selectedDate` or `defaultSelectedDate` alongside this prop.
|
|
49
|
+
* Default: false
|
|
50
|
+
*/
|
|
51
|
+
selectable?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The currently selected date (controlled). Pass `null` to clear the selection.
|
|
54
|
+
* Omit entirely to use uncontrolled mode with `defaultSelectedDate`.
|
|
55
|
+
*/
|
|
56
|
+
selectedDate?: Date | null;
|
|
57
|
+
/**
|
|
58
|
+
* Initial selected date for uncontrolled mode. Ignored when `selectedDate` is provided.
|
|
59
|
+
*/
|
|
60
|
+
defaultSelectedDate?: Date | null;
|
|
61
|
+
/**
|
|
62
|
+
* Called with the new `Date` whenever the user clicks a selectable day.
|
|
63
|
+
*/
|
|
64
|
+
onChange?: (date: Date) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Earliest selectable date (inclusive). Days before this are disabled.
|
|
67
|
+
*/
|
|
68
|
+
minDate?: Date;
|
|
69
|
+
/**
|
|
70
|
+
* Latest selectable date (inclusive). Days after this are disabled.
|
|
71
|
+
*/
|
|
72
|
+
maxDate?: Date;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare function Calendar(props: CalendarProps): React.ReactElement;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface CardProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** Underlying element. Default: "div" */
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
/** Visual and semantic card variant. Navigation cards make the entire card interactive. Default: "default" */
|
|
7
|
+
variant?: "default" | "navigation";
|
|
8
|
+
/** Destination for navigation cards. When `variant="navigation"` is set, the card renders as an anchor by default. */
|
|
9
|
+
href?: string;
|
|
10
|
+
/** Remove the card border and background. Default: false */
|
|
11
|
+
bare?: boolean;
|
|
12
|
+
/** Material Symbols icon name. Used by `iconDisplay` to render the icon. */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Controls how the icon is displayed.
|
|
16
|
+
* - `"default"` — small tokenised icon block above card content; scales with the card container (sm/md/lg).
|
|
17
|
+
* - `"hero"` — full-bleed coloured header area at the top of the card.
|
|
18
|
+
* - `"none"` — icon is not rendered.
|
|
19
|
+
* Default: `"default"` (when `icon` is provided).
|
|
20
|
+
*/
|
|
21
|
+
iconDisplay?: "none" | "default" | "hero";
|
|
22
|
+
/**
|
|
23
|
+
* Background colour of the hero block when `iconDisplay="hero"`.
|
|
24
|
+
* Accepts a semantic colour role or any valid CSS colour value.
|
|
25
|
+
* Default: "action"
|
|
26
|
+
*/
|
|
27
|
+
heroColor?: "action" | "neutral" | "info" | "success" | "warn" | "error" | (string & {});
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare function Card(props: CardProps): React.ReactElement;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface CheckboxOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CheckboxGroupProps {
|
|
11
|
+
/** Group legend */
|
|
12
|
+
label?: string;
|
|
13
|
+
/** Helper text */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/** Error message */
|
|
16
|
+
error?: string;
|
|
17
|
+
/** Size density. Inherits from parent `Fieldset` when omitted. Default: "default" */
|
|
18
|
+
size?: "comfortable" | "default" | "compact";
|
|
19
|
+
required?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Render checkboxes side by side. Default: false */
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
/** Input name attribute shared by all checkboxes */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Array of checkbox options */
|
|
26
|
+
options?: CheckboxOption[];
|
|
27
|
+
/** Controlled selected values */
|
|
28
|
+
value?: string[];
|
|
29
|
+
/** Default selected values (uncontrolled) */
|
|
30
|
+
defaultValue?: string[];
|
|
31
|
+
/** Called with the full updated array of selected values on change */
|
|
32
|
+
onChange?: (value: string[]) => void;
|
|
33
|
+
id?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare function CheckboxGroup(props: CheckboxGroupProps): React.ReactElement;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface ChoiceGroupSection {
|
|
4
|
+
/** Section heading displayed above the section's tiles */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Options in this section */
|
|
7
|
+
options: ChoiceOption[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ChoiceOption {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
subtext?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ChoiceGroupProps {
|
|
19
|
+
/** Group legend */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Helper text — hidden when error or success is present */
|
|
22
|
+
hint?: string;
|
|
23
|
+
/** Error message */
|
|
24
|
+
error?: string;
|
|
25
|
+
/** Success message — shown instead of hint when present, hidden if error is also present */
|
|
26
|
+
success?: string;
|
|
27
|
+
/** Tile size density — affects only padding and child element sizes. Default: "default" */
|
|
28
|
+
size?: "compact" | "default" | "comfortable";
|
|
29
|
+
/**
|
|
30
|
+
* Column count. Pass a number for a fixed count at all breakpoints, or a
|
|
31
|
+
* breakpoint object for responsive behaviour, e.g. `{ xs: 1, sm: 2, md: 3 }`.
|
|
32
|
+
* Omit (default) for automatic fill based on tile min-width.
|
|
33
|
+
*/
|
|
34
|
+
columns?: number | Partial<Record<"xs" | "sm" | "md" | "lg" | "xl", number>>;
|
|
35
|
+
/**
|
|
36
|
+
* Allow multiple selections (checkbox semantics). When false, only one
|
|
37
|
+
* option may be selected at a time (radio semantics). Default: false
|
|
38
|
+
*/
|
|
39
|
+
multiple?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Place each tile's icon to the left of the label and subtext instead of
|
|
42
|
+
* above the content block. Has no effect on tiles with no icon. Default: false
|
|
43
|
+
*/
|
|
44
|
+
inlineIcon?: boolean;
|
|
45
|
+
required?: boolean;
|
|
46
|
+
/** Input name attribute. Defaults to the group id. */
|
|
47
|
+
name?: string;
|
|
48
|
+
/** Flat list of options. Use sections instead for grouped options with headings. */
|
|
49
|
+
options?: ChoiceOption[];
|
|
50
|
+
/**
|
|
51
|
+
* Options divided into labeled sections with a divider between each group.
|
|
52
|
+
* When provided, options is ignored.
|
|
53
|
+
*/
|
|
54
|
+
sections?: ChoiceGroupSection[];
|
|
55
|
+
/**
|
|
56
|
+
* Controlled value. String for single-select; string[] for multi-select.
|
|
57
|
+
* Pass undefined to use uncontrolled mode.
|
|
58
|
+
*/
|
|
59
|
+
value?: string | string[] | null;
|
|
60
|
+
/** Default value for uncontrolled mode. Default: null / [] */
|
|
61
|
+
defaultValue?: string | string[] | null;
|
|
62
|
+
/** Called with the selected value (string or string[]) on change */
|
|
63
|
+
onChange?: (value: string | string[]) => void;
|
|
64
|
+
id?: string;
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare function ChoiceGroup(props: ChoiceGroupProps): React.ReactElement;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface CircularProgressProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current value. Combined with max to compute the filled arc length.
|
|
6
|
+
* Ignored when indeterminate is true. Default: 0
|
|
7
|
+
*/
|
|
8
|
+
value?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Maximum value. Default: 100
|
|
11
|
+
*/
|
|
12
|
+
max?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Circle diameter. xs renders the smallest ring (no inner content — children
|
|
15
|
+
* are placed inline after the ring instead). Default: "md"
|
|
16
|
+
*/
|
|
17
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
18
|
+
/**
|
|
19
|
+
* Shows a continuously rotating arc instead of a value-based fill.
|
|
20
|
+
* Removes aria-valuenow so assistive technology announces an indeterminate
|
|
21
|
+
* state. Default: false
|
|
22
|
+
*/
|
|
23
|
+
indeterminate?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Content centered inside the ring for sm / md / lg sizes.
|
|
26
|
+
* For xs, children are rendered inline after the ring.
|
|
27
|
+
* Always pass aria-label on the root element for an accessible name since
|
|
28
|
+
* this content receives aria-hidden="true".
|
|
29
|
+
*/
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
/** Additional CSS class names applied to the root element. */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare function CircularProgress(
|
|
36
|
+
props: CircularProgressProps & React.HTMLAttributes<HTMLDivElement>
|
|
37
|
+
): React.ReactElement;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import "./circular-progress.css";
|
|
2
|
+
|
|
3
|
+
const SIZES = ["xs", "sm", "md", "lg"];
|
|
4
|
+
|
|
5
|
+
// SVG uses a 100×100 viewBox with a 10-unit stroke so the ring scales
|
|
6
|
+
// proportionally when the container size changes via CSS.
|
|
7
|
+
const VIEWBOX = 100;
|
|
8
|
+
const STROKE = 10;
|
|
9
|
+
const R = (VIEWBOX - STROKE) / 2; // 45
|
|
10
|
+
const CIRC = 2 * Math.PI * R; // ≈ 282.74
|
|
11
|
+
const ARC = CIRC * 0.25; // 25% arc for indeterminate
|
|
12
|
+
|
|
13
|
+
export function CircularProgress({
|
|
14
|
+
value = 0,
|
|
15
|
+
max = 100,
|
|
16
|
+
size = "md",
|
|
17
|
+
indeterminate = false,
|
|
18
|
+
children,
|
|
19
|
+
className = "",
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const resolvedSize = SIZES.includes(size) ? size : "md";
|
|
23
|
+
const hasInner = resolvedSize !== "xs";
|
|
24
|
+
|
|
25
|
+
const pct = Math.min(1, Math.max(0, max > 0 ? value / max : 0));
|
|
26
|
+
const dashArray = indeterminate ? `${ARC} ${CIRC - ARC}` : CIRC;
|
|
27
|
+
const dashOffset = indeterminate ? 0 : CIRC * (1 - pct);
|
|
28
|
+
|
|
29
|
+
const classes = [
|
|
30
|
+
"a1-circular-progress",
|
|
31
|
+
resolvedSize !== "md" && `a1-circular-progress--${resolvedSize}`,
|
|
32
|
+
indeterminate && "a1-circular-progress--indeterminate",
|
|
33
|
+
className,
|
|
34
|
+
].filter(Boolean).join(" ");
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={classes}
|
|
39
|
+
role="progressbar"
|
|
40
|
+
aria-valuenow={indeterminate ? undefined : value}
|
|
41
|
+
aria-valuemin={0}
|
|
42
|
+
aria-valuemax={max}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<div className="a1-circular-progress__ring">
|
|
46
|
+
<svg
|
|
47
|
+
className="a1-circular-progress__svg"
|
|
48
|
+
viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`}
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
>
|
|
51
|
+
<circle
|
|
52
|
+
className="a1-circular-progress__track"
|
|
53
|
+
cx={VIEWBOX / 2}
|
|
54
|
+
cy={VIEWBOX / 2}
|
|
55
|
+
r={R}
|
|
56
|
+
fill="none"
|
|
57
|
+
strokeWidth={STROKE}
|
|
58
|
+
/>
|
|
59
|
+
<circle
|
|
60
|
+
className="a1-circular-progress__fill"
|
|
61
|
+
cx={VIEWBOX / 2}
|
|
62
|
+
cy={VIEWBOX / 2}
|
|
63
|
+
r={R}
|
|
64
|
+
fill="none"
|
|
65
|
+
strokeWidth={STROKE}
|
|
66
|
+
strokeDasharray={dashArray}
|
|
67
|
+
strokeDashoffset={dashOffset}
|
|
68
|
+
strokeLinecap="round"
|
|
69
|
+
transform={`rotate(-90 ${VIEWBOX / 2} ${VIEWBOX / 2})`}
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
{hasInner && children && (
|
|
73
|
+
<div className="a1-circular-progress__inner" aria-hidden="true">
|
|
74
|
+
{children}
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
{!hasInner && children && (
|
|
79
|
+
<div className="a1-circular-progress__after">
|
|
80
|
+
{children}
|
|
81
|
+
</div>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/* ─── CircularProgress ───────────────────────────────────────────────────────── */
|
|
2
|
+
|
|
3
|
+
.a1-circular-progress {
|
|
4
|
+
--a1-cp-size: var(--component-circular-progress-md-size);
|
|
5
|
+
--a1-cp-track: var(--component-circular-progress-track-color);
|
|
6
|
+
--a1-cp-fill: var(--component-circular-progress-fill-color);
|
|
7
|
+
--a1-cp-gap: var(--component-circular-progress-gap);
|
|
8
|
+
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--a1-cp-gap);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ─── Sizes ──────────────────────────────────────────────────────────────────── */
|
|
15
|
+
|
|
16
|
+
.a1-circular-progress--xs { --a1-cp-size: var(--component-circular-progress-xs-size); }
|
|
17
|
+
.a1-circular-progress--sm { --a1-cp-size: var(--component-circular-progress-sm-size); }
|
|
18
|
+
/* md is the default — no modifier needed */
|
|
19
|
+
.a1-circular-progress--lg { --a1-cp-size: var(--component-circular-progress-lg-size); }
|
|
20
|
+
|
|
21
|
+
/* ─── Ring (SVG + optional inner content) ────────────────────────────────────── */
|
|
22
|
+
|
|
23
|
+
.a1-circular-progress__ring {
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
position: relative;
|
|
26
|
+
width: var(--a1-cp-size);
|
|
27
|
+
height: var(--a1-cp-size);
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* ─── SVG ────────────────────────────────────────────────────────────────────── */
|
|
34
|
+
|
|
35
|
+
.a1-circular-progress__svg {
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
overflow: visible;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ─── Track ──────────────────────────────────────────────────────────────────── */
|
|
44
|
+
|
|
45
|
+
.a1-circular-progress__track {
|
|
46
|
+
stroke: var(--a1-cp-track);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ─── Fill ───────────────────────────────────────────────────────────────────── */
|
|
50
|
+
|
|
51
|
+
.a1-circular-progress__fill {
|
|
52
|
+
stroke: var(--a1-cp-fill);
|
|
53
|
+
transition: stroke-dashoffset var(--semantic-motion-duration-normal) var(--semantic-motion-easing-standard);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ─── Inner content (sm / md / lg) ──────────────────────────────────────────── */
|
|
57
|
+
|
|
58
|
+
/* position: relative sits above the absolute SVG inside the flex __ring */
|
|
59
|
+
.a1-circular-progress__inner {
|
|
60
|
+
position: relative;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
text-align: center;
|
|
66
|
+
/* 80% keeps content within the inner edge of the 10 %-wide viewBox stroke */
|
|
67
|
+
max-width: 80%;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ─── After content (xs only, rendered after the ring in DOM order) ─────────── */
|
|
72
|
+
|
|
73
|
+
.a1-circular-progress__after {
|
|
74
|
+
font-family: var(--component-paragraph-font-family);
|
|
75
|
+
font-size: var(--semantic-font-size-body-sm);
|
|
76
|
+
color: var(--semantic-color-text-default);
|
|
77
|
+
line-height: var(--semantic-font-line-height-body);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ─── Indeterminate (spin) ───────────────────────────────────────────────────── */
|
|
81
|
+
|
|
82
|
+
.a1-circular-progress--indeterminate .a1-circular-progress__svg {
|
|
83
|
+
animation: a1-cp-spin var(--component-circular-progress-indeterminate-duration) linear infinite;
|
|
84
|
+
transform-origin: center;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.a1-circular-progress--indeterminate .a1-circular-progress__fill {
|
|
88
|
+
transition: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes a1-cp-spin {
|
|
92
|
+
to { transform: rotate(360deg); }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ─── Reduced motion ─────────────────────────────────────────────────────────── */
|
|
96
|
+
|
|
97
|
+
@media (prefers-reduced-motion: reduce) {
|
|
98
|
+
.a1-circular-progress--indeterminate .a1-circular-progress__svg {
|
|
99
|
+
animation: none;
|
|
100
|
+
}
|
|
101
|
+
.a1-circular-progress__fill {
|
|
102
|
+
transition: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
type SpacingToken = 1 | 2 | 4 | 6 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 64 | 96 | 128;
|
|
4
|
+
|
|
5
|
+
export interface ClusterProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
/** Underlying element. Default: "div" */
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
/** Gap applied to both row and column. Default: 8 */
|
|
9
|
+
gap?: SpacingToken;
|
|
10
|
+
/** Row gap override */
|
|
11
|
+
rowGap?: SpacingToken;
|
|
12
|
+
/** Column gap override */
|
|
13
|
+
columnGap?: SpacingToken;
|
|
14
|
+
/** Align-items. Default: "center" */
|
|
15
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
16
|
+
/** Justify-content. Default: "start" */
|
|
17
|
+
justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare function Cluster(props: ClusterProps): React.ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** Code presentation. Inline keeps minimal padding for prose; block renders a preformatted block. Default: "inline" */
|
|
5
|
+
variant?: "inline" | "block";
|
|
6
|
+
/** Allow long inline snippets or block code to wrap. Default: false */
|
|
7
|
+
wrapping?: boolean;
|
|
8
|
+
/** Show a small tertiary copy button at the bottom-left of the code block. Default: false */
|
|
9
|
+
copyCode?: boolean;
|
|
10
|
+
/** Text copied to the clipboard. Defaults to the rendered text children. */
|
|
11
|
+
copyText?: string;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare function Code(props: CodeProps): React.ReactElement;
|