@eodparks/ui 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.js +57 -0
- package/dist/alert-dialog.d.ts +50 -0
- package/dist/alert-dialog.js +149 -0
- package/dist/alert.d.ts +23 -0
- package/dist/alert.js +87 -0
- package/dist/avatar.d.ts +35 -0
- package/dist/avatar.js +118 -0
- package/dist/badge.d.ts +27 -0
- package/dist/badge.js +148 -0
- package/dist/button-Bu72BGjv.d.ts +15 -0
- package/dist/button-DEsRlveL.js +86 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +1 -0
- package/dist/calendar-DhsRPq2D.d.ts +23 -0
- package/dist/calendar-kbn4gZ1a.js +110 -0
- package/dist/calendar.d.ts +2 -0
- package/dist/calendar.js +1 -0
- package/dist/card-tkP52GwZ.js +77 -0
- package/dist/card.d.ts +18 -0
- package/dist/card.js +1 -0
- package/dist/chart.d.ts +52 -0
- package/dist/chart.js +163 -0
- package/dist/checkbox.d.ts +7 -0
- package/dist/checkbox.js +26 -0
- package/dist/cn-B-fHM4Ov.js +12 -0
- package/dist/collapsible.d.ts +10 -0
- package/dist/collapsible.js +23 -0
- package/dist/command.d.ts +38 -0
- package/dist/command.js +124 -0
- package/dist/date-picker.d.ts +46 -0
- package/dist/date-picker.js +159 -0
- package/dist/dialog-JjpMFEDR.js +117 -0
- package/dist/dialog.d.ts +2 -0
- package/dist/dialog.js +3 -0
- package/dist/dropdown-menu-B_VG1VXX.js +116 -0
- package/dist/dropdown-menu-CZ8xcq1d.d.ts +38 -0
- package/dist/dropdown-menu.d.ts +2 -0
- package/dist/dropdown-menu.js +1 -0
- package/dist/empty-state-B11Uq0U_.js +66 -0
- package/dist/empty-state.d.ts +15 -0
- package/dist/empty-state.js +1 -0
- package/dist/error-state.d.ts +48 -0
- package/dist/error-state.js +139 -0
- package/dist/field-Cwhz73-_.d.ts +15 -0
- package/dist/field-D-n7O1n6.js +63 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +1 -0
- package/dist/focus-ring-BpxMbGAn.js +3 -0
- package/dist/form-actions.d.ts +21 -0
- package/dist/form-actions.js +41 -0
- package/dist/forms/formik.d.ts +20 -0
- package/dist/forms/formik.js +50 -0
- package/dist/forms/rhf.d.ts +32 -0
- package/dist/forms/rhf.js +114 -0
- package/dist/icon-button-XAjcFsZ2.js +14 -0
- package/dist/icon-button.d.ts +9 -0
- package/dist/icon-button.js +1 -0
- package/dist/icon.d.ts +15 -0
- package/dist/icon.js +21 -0
- package/dist/index-C-tNDS8C.d.ts +29 -0
- package/dist/input-BxjcqQS1.js +49 -0
- package/dist/input-group.d.ts +12 -0
- package/dist/input-group.js +26 -0
- package/dist/input.d.ts +15 -0
- package/dist/input.js +1 -0
- package/dist/label-BrOAJU1p.js +31 -0
- package/dist/label-CUAiaBbm.d.ts +13 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +1 -0
- package/dist/native-select.d.ts +8 -0
- package/dist/native-select.js +41 -0
- package/dist/page-header.d.ts +19 -0
- package/dist/page-header.js +51 -0
- package/dist/pagination.d.ts +47 -0
- package/dist/pagination.js +131 -0
- package/dist/password-input.d.ts +14 -0
- package/dist/password-input.js +41 -0
- package/dist/popover.d.ts +19 -0
- package/dist/popover.js +54 -0
- package/dist/popup-CLsuJ-AA.js +6 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +36 -0
- package/dist/radio-group.d.ts +14 -0
- package/dist/radio-group.js +25 -0
- package/dist/scroll-area.d.ts +16 -0
- package/dist/scroll-area.js +52 -0
- package/dist/select-Cq_JDuYO.js +266 -0
- package/dist/select.d.ts +40 -0
- package/dist/select.js +1 -0
- package/dist/separator.d.ts +8 -0
- package/dist/separator.js +38 -0
- package/dist/sheet.d.ts +27 -0
- package/dist/sheet.js +95 -0
- package/dist/skeleton.d.ts +19 -0
- package/dist/skeleton.js +45 -0
- package/dist/spinner.d.ts +13 -0
- package/dist/spinner.js +44 -0
- package/dist/switch.d.ts +7 -0
- package/dist/switch.js +19 -0
- package/dist/table.d.ts +24 -0
- package/dist/table.js +75 -0
- package/dist/tabs.d.ts +24 -0
- package/dist/tabs.js +74 -0
- package/dist/textarea.d.ts +5 -0
- package/dist/textarea.js +15 -0
- package/dist/theme-toggle.d.ts +11 -0
- package/dist/theme-toggle.js +50 -0
- package/dist/toast.d.ts +12 -0
- package/dist/toast.js +105 -0
- package/dist/tooltip-BsVKZDXs.js +47 -0
- package/dist/tooltip.d.ts +18 -0
- package/dist/tooltip.js +1 -0
- package/dist/typography-Dy3PCTrL.js +34 -0
- package/dist/typography.d.ts +11 -0
- package/dist/typography.js +1 -0
- package/dist/visually-hidden-BrCs6ZEy.js +11 -0
- package/dist/visually-hidden.d.ts +3 -0
- package/dist/visually-hidden.js +1 -0
- package/docs/accessibility.md +95 -0
- package/docs/accordion.md +89 -0
- package/docs/alert-dialog.md +157 -0
- package/docs/alert.md +70 -0
- package/docs/avatar.md +57 -0
- package/docs/badge.md +51 -0
- package/docs/button.md +121 -0
- package/docs/calendar.md +116 -0
- package/docs/card.md +74 -0
- package/docs/chart.md +93 -0
- package/docs/checkbox.md +119 -0
- package/docs/collapsible.md +76 -0
- package/docs/command.md +114 -0
- package/docs/date-picker.md +177 -0
- package/docs/dialog.md +110 -0
- package/docs/dropdown-menu.md +126 -0
- package/docs/empty-state.md +65 -0
- package/docs/error-state.md +59 -0
- package/docs/field.md +54 -0
- package/docs/form-actions.md +55 -0
- package/docs/forms/formik.md +42 -0
- package/docs/forms/rhf.md +64 -0
- package/docs/icon-button.md +84 -0
- package/docs/icon.md +77 -0
- package/docs/input-group.md +47 -0
- package/docs/input.md +46 -0
- package/docs/label.md +33 -0
- package/docs/layout.md +102 -0
- package/docs/llms.txt +72 -0
- package/docs/native-select.md +87 -0
- package/docs/page-header.md +61 -0
- package/docs/pagination.md +107 -0
- package/docs/password-input.md +30 -0
- package/docs/popover.md +103 -0
- package/docs/progress.md +53 -0
- package/docs/radio-group.md +119 -0
- package/docs/scroll-area.md +85 -0
- package/docs/select.md +106 -0
- package/docs/separator.md +38 -0
- package/docs/sheet.md +118 -0
- package/docs/skeleton.md +50 -0
- package/docs/spinner.md +46 -0
- package/docs/switch.md +92 -0
- package/docs/table.md +87 -0
- package/docs/tabs.md +96 -0
- package/docs/textarea.md +38 -0
- package/docs/theme-toggle.md +76 -0
- package/docs/toast.md +95 -0
- package/docs/tooltip.md +101 -0
- package/docs/typography.md +96 -0
- package/docs/visually-hidden.md +44 -0
- package/layer.css +22 -0
- package/package.json +275 -3
- package/skills/eod-ui/SKILL.md +37 -0
- package/styles.css +2 -0
- package/README.md +0 -3
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PartProps } from "@ui-sdk/react/primitive";
|
|
2
|
+
type TableProps = PartProps<"table"> & {
|
|
3
|
+
/** Keeps the header row at the top of the scroll container. Give `containerClassName` a max height. */
|
|
4
|
+
stickyHeader?: boolean;
|
|
5
|
+
containerClassName?: string;
|
|
6
|
+
/** Names the scroll container and makes it a tab stop, so keys can scroll a table wider or taller than its box. */
|
|
7
|
+
scrollLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
declare function Table({ stickyHeader, containerClassName, scrollLabel, render, className, ...props }: TableProps): import("react").JSX.Element;
|
|
10
|
+
declare function TableHeader({ render, className, ...props }: PartProps<"thead">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
11
|
+
declare function TableBody({ render, className, ...props }: PartProps<"tbody">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
12
|
+
declare function TableFooter({ render, className, ...props }: PartProps<"tfoot">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
|
+
type TableRowProps = PartProps<"tr"> & {
|
|
14
|
+
/** Fills the row. A plain table has no selection role, so pair it with a checkbox that names it. */
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function TableRow({ selected, render, className, ...props }: TableRowProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
18
|
+
type CellProps = {
|
|
19
|
+
numeric?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare function TableHead({ numeric, render, className, ...props }: PartProps<"th"> & CellProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
22
|
+
declare function TableCell({ numeric, render, className, ...props }: PartProps<"td"> & CellProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
23
|
+
declare function TableCaption({ render, className, ...props }: PartProps<"caption">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
24
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, type TableRowProps };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
3
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
4
|
+
import { n as textVariants } from "./typography-Dy3PCTrL.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/table/table.tsx
|
|
7
|
+
function Table({ stickyHeader, containerClassName, scrollLabel, render, className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
"data-slot": "table-container",
|
|
10
|
+
...scrollLabel && {
|
|
11
|
+
role: "region",
|
|
12
|
+
"aria-label": scrollLabel,
|
|
13
|
+
tabIndex: 0
|
|
14
|
+
},
|
|
15
|
+
className: cn(`relative w-full overflow-auto rounded-item ${focusRing}`, containerClassName),
|
|
16
|
+
children: renderElement("table", {
|
|
17
|
+
...props,
|
|
18
|
+
"data-slot": "table",
|
|
19
|
+
...stickyHeader && { "data-sticky": "" },
|
|
20
|
+
className: withBase(`w-full border-separate border-spacing-0 caption-bottom ${textVariants({ variant: "small" })}`, className)
|
|
21
|
+
}, render)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TableHeader({ render, className, ...props }) {
|
|
25
|
+
return renderElement("thead", {
|
|
26
|
+
...props,
|
|
27
|
+
"data-slot": "table-header",
|
|
28
|
+
className: withBase("in-data-sticky:[&_th]:sticky in-data-sticky:[&_th]:top-0 in-data-sticky:[&_th]:z-10 in-data-sticky:[&_th]:bg-background", className)
|
|
29
|
+
}, render);
|
|
30
|
+
}
|
|
31
|
+
function TableBody({ render, className, ...props }) {
|
|
32
|
+
return renderElement("tbody", {
|
|
33
|
+
...props,
|
|
34
|
+
"data-slot": "table-body",
|
|
35
|
+
className
|
|
36
|
+
}, render);
|
|
37
|
+
}
|
|
38
|
+
function TableFooter({ render, className, ...props }) {
|
|
39
|
+
return renderElement("tfoot", {
|
|
40
|
+
...props,
|
|
41
|
+
"data-slot": "table-footer",
|
|
42
|
+
className: withBase("bg-muted font-medium", className)
|
|
43
|
+
}, render);
|
|
44
|
+
}
|
|
45
|
+
function TableRow({ selected, render, className, ...props }) {
|
|
46
|
+
return renderElement("tr", {
|
|
47
|
+
...props,
|
|
48
|
+
"data-slot": "table-row",
|
|
49
|
+
...selected && { "data-selected": "" },
|
|
50
|
+
className: withBase("hover:bg-muted/50 data-selected:bg-muted", className)
|
|
51
|
+
}, render);
|
|
52
|
+
}
|
|
53
|
+
function TableHead({ numeric, render, className, ...props }) {
|
|
54
|
+
return renderElement("th", {
|
|
55
|
+
scope: "col",
|
|
56
|
+
...props,
|
|
57
|
+
"data-slot": "table-head",
|
|
58
|
+
className: withBase(`border-b px-3 py-(--table-cell-py) align-middle font-medium whitespace-nowrap text-muted-foreground ${numeric ? "text-end tabular-nums" : "text-start"}`, className)
|
|
59
|
+
}, render);
|
|
60
|
+
}
|
|
61
|
+
function TableCell({ numeric, render, className, ...props }) {
|
|
62
|
+
return renderElement("td", {
|
|
63
|
+
...props,
|
|
64
|
+
"data-slot": "table-cell",
|
|
65
|
+
className: withBase(`border-b px-3 py-(--table-cell-py) align-middle ${numeric ? "text-end tabular-nums" : "text-start"}`, className)
|
|
66
|
+
}, render);
|
|
67
|
+
}
|
|
68
|
+
function TableCaption({ render, className, ...props }) {
|
|
69
|
+
return renderElement("caption", {
|
|
70
|
+
...props,
|
|
71
|
+
"data-slot": "table-caption",
|
|
72
|
+
className: withBase(`py-2 text-start ${textVariants({ variant: "caption" })}`, className)
|
|
73
|
+
}, render);
|
|
74
|
+
}
|
|
75
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Tabs as Tabs$1, TabsList as TabsList$1, TabsPanel, TabsTab } from "@ui-sdk/react/tabs";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
type TabsVariant = "pill" | "line";
|
|
4
|
+
type UITabsProps = ComponentProps<typeof Tabs$1>;
|
|
5
|
+
type ValueDetails = Parameters<NonNullable<UITabsProps["onValueChange"]>>[1];
|
|
6
|
+
type TabsProps = Omit<UITabsProps, "value" | "defaultValue" | "onValueChange"> & {
|
|
7
|
+
/** `""` selects no tab. */
|
|
8
|
+
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
onValueChange?: (value: string, details: ValueDetails) => void;
|
|
11
|
+
};
|
|
12
|
+
declare function Tabs({ value, defaultValue, onValueChange, className, ...props }: TabsProps): import("react").JSX.Element;
|
|
13
|
+
type TabsListProps = ComponentProps<typeof TabsList$1> & {
|
|
14
|
+
variant?: TabsVariant;
|
|
15
|
+
};
|
|
16
|
+
/** Name the list with `aria-label`; it is what a screen reader announces for the group. */
|
|
17
|
+
declare function TabsList({ variant, className, ...props }: TabsListProps): import("react").JSX.Element;
|
|
18
|
+
type TabsTriggerProps = ComponentProps<typeof TabsTab>;
|
|
19
|
+
declare function TabsTrigger({ className, ...props }: TabsTriggerProps): import("react").JSX.Element;
|
|
20
|
+
type TabsContentProps = ComponentProps<typeof TabsPanel>;
|
|
21
|
+
declare function TabsContent({ className, ...props }: TabsContentProps): import("react").JSX.Element;
|
|
22
|
+
/** A count beside a tab label. It is read as part of the tab's name. */
|
|
23
|
+
declare function TabsCount({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
24
|
+
export { Tabs, TabsContent, type TabsContentProps, TabsCount, TabsList, type TabsListProps, type TabsProps, TabsTrigger, type TabsTriggerProps, type TabsVariant };
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Tabs as Tabs$1, TabsList as TabsList$1, TabsPanel, TabsTab } from "@ui-sdk/react/tabs";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
5
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// src/tabs/tabs.tsx
|
|
8
|
+
const VariantContext = createContext("pill");
|
|
9
|
+
function Tabs({ value, defaultValue, onValueChange, className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Tabs$1, {
|
|
11
|
+
...props,
|
|
12
|
+
value: value === void 0 ? void 0 : value || null,
|
|
13
|
+
defaultValue: defaultValue === void 0 ? void 0 : defaultValue || null,
|
|
14
|
+
onValueChange: (next, details) => onValueChange?.(next ?? "", details),
|
|
15
|
+
className: withBase("flex flex-col gap-4 data-[orientation=vertical]:flex-row", className)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const listVariants = cva("flex flex-wrap items-center gap-1 data-[orientation=vertical]:flex-col", {
|
|
19
|
+
variants: { variant: {
|
|
20
|
+
pill: "w-fit rounded-control bg-muted p-1 text-muted-foreground data-[orientation=vertical]:items-stretch",
|
|
21
|
+
line: "border-b text-muted-foreground data-[orientation=vertical]:items-stretch data-[orientation=vertical]:border-s data-[orientation=vertical]:border-b-0"
|
|
22
|
+
} },
|
|
23
|
+
defaultVariants: { variant: "pill" }
|
|
24
|
+
});
|
|
25
|
+
/** Name the list with `aria-label`; it is what a screen reader announces for the group. */
|
|
26
|
+
function TabsList({ variant = "pill", className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(VariantContext, {
|
|
28
|
+
value: variant,
|
|
29
|
+
children: /* @__PURE__ */ jsx(TabsList$1, {
|
|
30
|
+
...props,
|
|
31
|
+
"data-variant": variant,
|
|
32
|
+
className: withBase(listVariants({ variant }), className)
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const triggerVariants = cva([
|
|
37
|
+
"relative inline-flex items-center justify-center gap-2 py-1 text-center data-[orientation=vertical]:justify-start data-[orientation=vertical]:text-start text-sm font-medium text-muted-foreground transition-colors",
|
|
38
|
+
focusRing,
|
|
39
|
+
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
40
|
+
"data-disabled:cursor-not-allowed data-disabled:opacity-50 not-data-disabled:hover:text-foreground data-selected:text-foreground"
|
|
41
|
+
], {
|
|
42
|
+
variants: { variant: {
|
|
43
|
+
pill: "min-h-(--control-h-sm) rounded-item border border-transparent px-3 data-selected:border-muted-foreground data-selected:bg-background data-selected:shadow-sm",
|
|
44
|
+
line: [
|
|
45
|
+
"min-h-(--control-h) rounded-item px-3",
|
|
46
|
+
"after:absolute after:bg-primary after:opacity-0 data-selected:after:opacity-100",
|
|
47
|
+
"data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:-bottom-px data-[orientation=horizontal]:after:h-0.5",
|
|
48
|
+
"data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:-start-px data-[orientation=vertical]:after:w-0.5"
|
|
49
|
+
]
|
|
50
|
+
} },
|
|
51
|
+
defaultVariants: { variant: "pill" }
|
|
52
|
+
});
|
|
53
|
+
function TabsTrigger({ className, ...props }) {
|
|
54
|
+
const variant = use(VariantContext);
|
|
55
|
+
return /* @__PURE__ */ jsx(TabsTab, {
|
|
56
|
+
...props,
|
|
57
|
+
className: withBase(triggerVariants({ variant }), className)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function TabsContent({ className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(TabsPanel, {
|
|
62
|
+
...props,
|
|
63
|
+
className: withBase(cn("flex-1 rounded-item", focusRing), className)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** A count beside a tab label. It is read as part of the tab's name. */
|
|
67
|
+
function TabsCount({ className, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx("span", {
|
|
69
|
+
"data-slot": "tabs-count",
|
|
70
|
+
...props,
|
|
71
|
+
className: cn("inline-flex min-w-5 items-center justify-center rounded-full border bg-background px-1.5 text-xs/4 font-medium text-foreground tabular-nums", className)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export { Tabs, TabsContent, TabsCount, TabsList, TabsTrigger };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Textarea as Textarea$1 } from "@ui-sdk/react/textarea";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
type TextareaProps = ComponentProps<typeof Textarea$1>;
|
|
4
|
+
declare function Textarea({ autoResize, className, ...props }: TextareaProps): import("react").JSX.Element;
|
|
5
|
+
export { Textarea, type TextareaProps };
|
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Textarea as Textarea$1 } from "@ui-sdk/react/textarea";
|
|
2
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
3
|
+
import { r as box } from "./input-BxjcqQS1.js";
|
|
4
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/textarea/textarea.tsx
|
|
7
|
+
const base = cn(box, "min-h-20 px-3 py-2 placeholder:text-muted-foreground read-only:bg-muted", focusRing);
|
|
8
|
+
function Textarea({ autoResize, className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Textarea$1, {
|
|
10
|
+
autoResize,
|
|
11
|
+
...props,
|
|
12
|
+
className: withBase(cn(base, autoResize ? "max-h-64 resize-none" : "resize-y"), className)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { Textarea };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { f as DropdownMenuProps } from "./dropdown-menu-CZ8xcq1d.js";
|
|
2
|
+
type ThemeToggleValue = "light" | "dark" | "system";
|
|
3
|
+
type ThemeToggleProps = Pick<DropdownMenuProps, "open" | "defaultOpen" | "onOpenChange"> & {
|
|
4
|
+
/** next-themes' `theme`: a string, and `undefined` until it has read the stored choice. */
|
|
5
|
+
value: string | undefined;
|
|
6
|
+
onValueChange: (value: ThemeToggleValue) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
labels?: Partial<Record<ThemeToggleValue, string>>;
|
|
9
|
+
};
|
|
10
|
+
declare function ThemeToggle({ value, onValueChange, label, labels, ...props }: ThemeToggleProps): import("react").JSX.Element;
|
|
11
|
+
export { ThemeToggle, type ThemeToggleProps, type ThemeToggleValue };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
|
|
2
|
+
import { c as DropdownMenuRadioItem, p as DropdownMenuTrigger, r as DropdownMenuContent, s as DropdownMenuRadioGroup, t as DropdownMenu } from "./dropdown-menu-B_VG1VXX.js";
|
|
3
|
+
import { t as IconButton } from "./icon-button-XAjcFsZ2.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/theme-toggle/theme-toggle.tsx
|
|
6
|
+
const items = [
|
|
7
|
+
{
|
|
8
|
+
value: "light",
|
|
9
|
+
icon: SunIcon,
|
|
10
|
+
text: "Light"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "dark",
|
|
14
|
+
icon: MoonIcon,
|
|
15
|
+
text: "Dark"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "system",
|
|
19
|
+
icon: MonitorIcon,
|
|
20
|
+
text: "System"
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
function ThemeToggle({ value, onValueChange, label = "Choose appearance", labels, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
25
|
+
...props,
|
|
26
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsxs(IconButton, {
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
"aria-label": label,
|
|
29
|
+
children: [/* @__PURE__ */ jsx(SunIcon, {
|
|
30
|
+
"aria-hidden": true,
|
|
31
|
+
className: "dark:hidden"
|
|
32
|
+
}), /* @__PURE__ */ jsx(MoonIcon, {
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
className: "hidden dark:block"
|
|
35
|
+
})]
|
|
36
|
+
}) }), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
37
|
+
align: "end",
|
|
38
|
+
children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
|
|
39
|
+
value: value ?? "",
|
|
40
|
+
onValueChange: (next) => onValueChange(next),
|
|
41
|
+
children: items.map(({ value: item, icon: Glyph, text }) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
42
|
+
value: item,
|
|
43
|
+
closeOnSelect: true,
|
|
44
|
+
children: [/* @__PURE__ */ jsx(Glyph, { "aria-hidden": true }), labels?.[item] ?? text]
|
|
45
|
+
}, item))
|
|
46
|
+
})
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { ThemeToggle };
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { ExternalToast, Toaster as Toaster$1, toast as toast$1 } from "sonner";
|
|
3
|
+
declare const toast: typeof toast$1;
|
|
4
|
+
type ToasterProps = Omit<ComponentProps<typeof Toaster$1>, "toastOptions" | "icons"> & {
|
|
5
|
+
/** Accessible name of each toast's close button. */
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
/** Accessible name of the region that holds the toasts. */
|
|
8
|
+
label?: string;
|
|
9
|
+
toastOptions?: Omit<NonNullable<ComponentProps<typeof Toaster$1>["toastOptions"]>, "unstyled">;
|
|
10
|
+
};
|
|
11
|
+
declare function Toaster({ closeLabel, label, position, closeButton, toastOptions, ...props }: ToasterProps): import("react").JSX.Element;
|
|
12
|
+
export { type ExternalToast, Toaster, type ToasterProps, toast };
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { bindPersistentLayer } from "@ui-sdk/core";
|
|
2
|
+
import { CircleCheckIcon, CircleXIcon, InfoIcon, LoaderCircleIcon, TriangleAlertIcon, XIcon } from "lucide-react";
|
|
3
|
+
import { isValidElement, useEffect, useRef } from "react";
|
|
4
|
+
import { Toaster as Toaster$1, toast as toast$1 } from "sonner";
|
|
5
|
+
import { n as buttonVariants } from "./button-DEsRlveL.js";
|
|
6
|
+
import { t as cn } from "./cn-B-fHM4Ov.js";
|
|
7
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
8
|
+
import { n as textVariants } from "./typography-Dy3PCTrL.js";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
// src/toast/toast.tsx
|
|
11
|
+
const successDuration = 4e3;
|
|
12
|
+
const errorDuration = 8e3;
|
|
13
|
+
function withErrorDuration(data) {
|
|
14
|
+
const { error } = data;
|
|
15
|
+
if (error === void 0) return data;
|
|
16
|
+
const duration = data.duration ?? errorDuration;
|
|
17
|
+
return {
|
|
18
|
+
...data,
|
|
19
|
+
error: async (reason) => {
|
|
20
|
+
const result = typeof error === "function" ? await error(reason) : error;
|
|
21
|
+
return result !== null && typeof result === "object" && !isValidElement(result) ? {
|
|
22
|
+
duration,
|
|
23
|
+
...result
|
|
24
|
+
} : {
|
|
25
|
+
message: result,
|
|
26
|
+
duration
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const toast = Object.assign((message, data) => toast$1(message, data), {
|
|
32
|
+
...toast$1,
|
|
33
|
+
error: (message, data) => toast$1.error(message, {
|
|
34
|
+
duration: errorDuration,
|
|
35
|
+
...data
|
|
36
|
+
}),
|
|
37
|
+
promise: ((promise, data) => toast$1.promise(promise, data && withErrorDuration(data)))
|
|
38
|
+
});
|
|
39
|
+
const classNames = {
|
|
40
|
+
toast: "group/toast relative flex font-sans w-(--width) items-start gap-3 rounded-surface border p-4 shadow-lg wrap-anywhere",
|
|
41
|
+
default: "border-border bg-popover text-popover-foreground",
|
|
42
|
+
loading: "border-border bg-popover text-popover-foreground",
|
|
43
|
+
success: "border-success-border bg-success-subtle text-success-subtle-foreground",
|
|
44
|
+
error: "border-destructive-border bg-destructive-subtle text-destructive-subtle-foreground",
|
|
45
|
+
warning: "border-warning-border bg-warning-subtle text-warning-subtle-foreground",
|
|
46
|
+
info: "border-info-border bg-info-subtle text-info-subtle-foreground",
|
|
47
|
+
content: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
48
|
+
title: textVariants({ variant: "label" }),
|
|
49
|
+
description: cn(textVariants({ variant: "small" }), "opacity-90"),
|
|
50
|
+
icon: "relative mt-0.5 flex size-4 shrink-0 items-center [&_svg]:size-4",
|
|
51
|
+
actionButton: cn(buttonVariants({ size: "sm" }), "shrink-0 self-center"),
|
|
52
|
+
cancelButton: cn(buttonVariants({
|
|
53
|
+
variant: "outline",
|
|
54
|
+
size: "sm"
|
|
55
|
+
}), "shrink-0 self-center"),
|
|
56
|
+
closeButton: cn("absolute -end-2 -top-2 inline-flex size-6 items-center justify-center rounded-full border bg-background text-foreground hover:bg-accent [&_svg]:size-3.5", focusRing)
|
|
57
|
+
};
|
|
58
|
+
const icons = {
|
|
59
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { "aria-hidden": "true" }),
|
|
60
|
+
error: /* @__PURE__ */ jsx(CircleXIcon, { "aria-hidden": "true" }),
|
|
61
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { "aria-hidden": "true" }),
|
|
62
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true" }),
|
|
63
|
+
loading: /* @__PURE__ */ jsx(LoaderCircleIcon, {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: "animate-spin motion-reduce:animate-none"
|
|
66
|
+
}),
|
|
67
|
+
close: /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
|
|
68
|
+
};
|
|
69
|
+
function Toaster({ closeLabel = "Close", label = "Notifications", position = "bottom-right", closeButton = true, toastOptions, ...props }) {
|
|
70
|
+
const ref = useRef(null);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const layer = ref.current;
|
|
73
|
+
if (!layer) return;
|
|
74
|
+
layer.showPopover();
|
|
75
|
+
const release = bindPersistentLayer(layer);
|
|
76
|
+
return () => {
|
|
77
|
+
release();
|
|
78
|
+
layer.hidePopover();
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
return /* @__PURE__ */ jsx("div", {
|
|
82
|
+
ref,
|
|
83
|
+
popover: "manual",
|
|
84
|
+
"data-slot": "toaster-layer",
|
|
85
|
+
className: "inset-auto m-0 size-0 overflow-visible border-0 bg-transparent p-0",
|
|
86
|
+
children: /* @__PURE__ */ jsx(Toaster$1, {
|
|
87
|
+
position,
|
|
88
|
+
closeButton,
|
|
89
|
+
containerAriaLabel: label,
|
|
90
|
+
icons,
|
|
91
|
+
toastOptions: {
|
|
92
|
+
duration: successDuration,
|
|
93
|
+
closeButtonAriaLabel: closeLabel,
|
|
94
|
+
...toastOptions,
|
|
95
|
+
unstyled: true,
|
|
96
|
+
classNames: {
|
|
97
|
+
...classNames,
|
|
98
|
+
...toastOptions?.classNames
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
...props
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export { Toaster, toast };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Tooltip as Tooltip$1, TooltipArrow as TooltipArrow$1, TooltipContent as TooltipContent$1, TooltipShortcut as TooltipShortcut$1, TooltipTrigger as TooltipTrigger$1 } from "@ui-sdk/react/tooltip";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
4
|
+
import { n as textVariants } from "./typography-Dy3PCTrL.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/tooltip/tooltip.tsx
|
|
7
|
+
const DelayContext = createContext(void 0);
|
|
8
|
+
function TooltipProvider({ delayDuration, children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(DelayContext, {
|
|
10
|
+
value: delayDuration,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function Tooltip({ delay, ...props }) {
|
|
15
|
+
const shared = use(DelayContext);
|
|
16
|
+
return /* @__PURE__ */ jsx(Tooltip$1, {
|
|
17
|
+
delay: delay ?? shared,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function TooltipTrigger(props) {
|
|
22
|
+
return /* @__PURE__ */ jsx(TooltipTrigger$1, { ...props });
|
|
23
|
+
}
|
|
24
|
+
const contentClass = cn(textVariants({ variant: "caption" }), "m-0 flex w-fit max-w-xs items-center gap-2 rounded-item bg-foreground px-3 py-1.5 text-background text-balance wrap-anywhere", "origin-(--transform-origin) transition-[opacity,scale] duration-150 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none motion-reduce:data-starting-style:scale-100 motion-reduce:data-ending-style:scale-100");
|
|
25
|
+
function TooltipContent({ side = "top", sideOffset = 4, className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(TooltipContent$1, {
|
|
27
|
+
side,
|
|
28
|
+
sideOffset,
|
|
29
|
+
className: withBase(contentClass, className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const arrowClass = cn("size-2 rotate-45 bg-foreground", "data-[side=bottom]:top-0 data-[side=bottom]:-translate-y-1/2", "data-[side=top]:bottom-0 data-[side=top]:translate-y-1/2", "data-[side=left]:right-0 data-[side=left]:translate-x-1/2", "data-[side=right]:left-0 data-[side=right]:-translate-x-1/2");
|
|
34
|
+
function TooltipArrow({ className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(TooltipArrow$1, {
|
|
36
|
+
"aria-hidden": true,
|
|
37
|
+
className: withBase(arrowClass, className),
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function TooltipShortcut({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(TooltipShortcut$1, {
|
|
43
|
+
className: withBase("font-medium opacity-80", className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { TooltipShortcut as a, TooltipProvider as i, TooltipArrow as n, TooltipTrigger as o, TooltipContent as r, Tooltip as t };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Tooltip as Tooltip$1, TooltipArrow as TooltipArrow$1, TooltipContent as TooltipContent$1, TooltipShortcut as TooltipShortcut$1, TooltipTrigger as TooltipTrigger$1 } from "@ui-sdk/react/tooltip";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
type TooltipProviderProps = {
|
|
4
|
+
delayDuration?: number;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function TooltipProvider({ delayDuration, children }: TooltipProviderProps): import("react").JSX.Element;
|
|
8
|
+
type TooltipProps = ComponentProps<typeof Tooltip$1>;
|
|
9
|
+
declare function Tooltip({ delay, ...props }: TooltipProps): import("react").JSX.Element;
|
|
10
|
+
type TooltipTriggerProps = ComponentProps<typeof TooltipTrigger$1>;
|
|
11
|
+
declare function TooltipTrigger(props: TooltipTriggerProps): import("react").JSX.Element;
|
|
12
|
+
type TooltipContentProps = ComponentProps<typeof TooltipContent$1>;
|
|
13
|
+
declare function TooltipContent({ side, sideOffset, className, ...props }: TooltipContentProps): import("react").JSX.Element;
|
|
14
|
+
type TooltipArrowProps = ComponentProps<typeof TooltipArrow$1>;
|
|
15
|
+
declare function TooltipArrow({ className, ...props }: TooltipArrowProps): import("react").JSX.Element;
|
|
16
|
+
type TooltipShortcutProps = ComponentProps<typeof TooltipShortcut$1>;
|
|
17
|
+
declare function TooltipShortcut({ className, ...props }: TooltipShortcutProps): import("react").JSX.Element;
|
|
18
|
+
export { Tooltip, TooltipArrow, type TooltipArrowProps, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipShortcut, type TooltipShortcutProps, TooltipTrigger, type TooltipTriggerProps };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Tooltip, n as TooltipArrow, r as TooltipContent, i as TooltipProvider, a as TooltipShortcut, o as TooltipTrigger } from "./tooltip-BsVKZDXs.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { n as withBase } from "./cn-B-fHM4Ov.js";
|
|
4
|
+
// src/typography/typography.tsx
|
|
5
|
+
const textVariants = cva("", {
|
|
6
|
+
variants: { variant: {
|
|
7
|
+
"page-title": "text-2xl/8 font-semibold tracking-tight text-balance",
|
|
8
|
+
"section-title": "text-lg/7 font-semibold tracking-tight text-balance",
|
|
9
|
+
body: "text-base/6",
|
|
10
|
+
small: "text-sm/5",
|
|
11
|
+
caption: "text-xs/4 text-muted-foreground",
|
|
12
|
+
label: "text-sm/5 font-medium",
|
|
13
|
+
code: "font-mono text-sm/5 tracking-normal"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { variant: "body" }
|
|
16
|
+
});
|
|
17
|
+
const tags = {
|
|
18
|
+
"page-title": "h1",
|
|
19
|
+
"section-title": "h2",
|
|
20
|
+
body: "p",
|
|
21
|
+
small: "p",
|
|
22
|
+
caption: "p",
|
|
23
|
+
label: "span",
|
|
24
|
+
code: "code"
|
|
25
|
+
};
|
|
26
|
+
function Text({ variant = "body", render, className, ...props }) {
|
|
27
|
+
return renderElement(tags[variant], {
|
|
28
|
+
...props,
|
|
29
|
+
"data-slot": "text",
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
className: withBase(textVariants({ variant }), className)
|
|
32
|
+
}, render);
|
|
33
|
+
}
|
|
34
|
+
export { textVariants as n, Text as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PartProps } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const textVariants: (props?: ({
|
|
4
|
+
variant?: "body" | "caption" | "code" | "label" | "small" | "page-title" | "section-title" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
type TextVariant = NonNullable<VariantProps<typeof textVariants>["variant"]>;
|
|
7
|
+
type TextProps = PartProps<"p"> & {
|
|
8
|
+
variant?: TextVariant;
|
|
9
|
+
};
|
|
10
|
+
declare function Text({ variant, render, className, ...props }: TextProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
11
|
+
export { Text, type TextProps, type TextVariant, textVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Text, n as textVariants } from "./typography-Dy3PCTrL.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { n as withBase } from "./cn-B-fHM4Ov.js";
|
|
3
|
+
// src/visually-hidden/visually-hidden.tsx
|
|
4
|
+
function VisuallyHidden({ render, className, ...props }) {
|
|
5
|
+
return renderElement("span", {
|
|
6
|
+
...props,
|
|
7
|
+
"data-slot": "visually-hidden",
|
|
8
|
+
className: withBase("sr-only", className)
|
|
9
|
+
}, render);
|
|
10
|
+
}
|
|
11
|
+
export { VisuallyHidden as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as VisuallyHidden } from "./visually-hidden-BrCs6ZEy.js";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Accessibility baseline
|
|
2
|
+
|
|
3
|
+
What every component meets before it merges: WCAG 2.2 AA, one focus ring, contrast floors, standard keys, names on every control, and the checks that prove each.
|
|
4
|
+
|
|
5
|
+
`e2e/accessibility.spec.ts` is the executable form of this page, and `e2e/fixtures/a11y.ts`
|
|
6
|
+
holds the helpers every component spec uses for the same checks.
|
|
7
|
+
|
|
8
|
+
## Target
|
|
9
|
+
|
|
10
|
+
WCAG 2.2 level AA, for every component, in light and dark. It is not optional per component: a
|
|
11
|
+
component that cannot meet a criterion documents why in its conformance file, and the
|
|
12
|
+
exemption is reviewed.
|
|
13
|
+
|
|
14
|
+
## Contrast
|
|
15
|
+
|
|
16
|
+
| What | Floor | Checked by |
|
|
17
|
+
| ---------------------------------------------------- | ----- | ------------------------------------------------------------ |
|
|
18
|
+
| text under 24px (or under 18.66px bold) | 4.5:1 | `contrastOf(locator)` |
|
|
19
|
+
| larger text, icons that carry meaning | 3:1 | `contrastOf(locator)` |
|
|
20
|
+
| control edges, focus rings, state fills, chart marks | 3:1 | `contrastOf(locator, "border-top-color")`, `expectFocusRing` |
|
|
21
|
+
|
|
22
|
+
Every token pair is checked once in `e2e/tokens.spec.ts`; a component spec checks the pairs it
|
|
23
|
+
actually paints, in both themes, in the browser. Use theme colours in the pairs the tokens
|
|
24
|
+
README lists (`bg-card` with `text-card-foreground`), and never an opacity that lowers text
|
|
25
|
+
below its floor. Disabled controls are exempt from the floors and use `opacity-50`.
|
|
26
|
+
|
|
27
|
+
## Focus ring
|
|
28
|
+
|
|
29
|
+
One ring for every focusable element, from `internal/focus-ring.ts`: a 2px gap in the page
|
|
30
|
+
colour, then a 2px ring in `--ring`. It shows on keyboard focus (`:focus-visible`), not after a
|
|
31
|
+
mouse click. No component draws its own outline or removes the ring. A component inside a
|
|
32
|
+
clipping container must leave 4px for it. `expectFocusRing(locator)` asserts both layers and
|
|
33
|
+
3:1 for the ring against the gap and against the surface around the element.
|
|
34
|
+
|
|
35
|
+
## Keyboard
|
|
36
|
+
|
|
37
|
+
Everything works without a pointer, and the same key does the same thing everywhere. UI SDK
|
|
38
|
+
provides these; a wrapper must not change them.
|
|
39
|
+
|
|
40
|
+
| Key | Does |
|
|
41
|
+
| ---------------- | --------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| Tab, Shift+Tab | move between controls in DOM order; one tab stop for a composite (tabs, radio group, menu, toolbar) |
|
|
43
|
+
| Enter, Space | press a button; Enter follows a link; Space toggles a checkbox or switch |
|
|
44
|
+
| Arrow keys | move inside a composite: list, menu, tabs, radio group, calendar, slider |
|
|
45
|
+
| Home, End | first and last item of a composite |
|
|
46
|
+
| Escape | close the topmost popup or dialog and return focus to what opened it |
|
|
47
|
+
| typed characters | jump to the matching item in a list or menu |
|
|
48
|
+
|
|
49
|
+
Disabled buttons stay in the tab order (`aria-disabled`) so people can find them and learn
|
|
50
|
+
why. Focus never lands on something invisible, and it returns to the trigger when a popup
|
|
51
|
+
closes. Tab order follows the visual order; no positive `tabIndex`.
|
|
52
|
+
|
|
53
|
+
## Roles and names
|
|
54
|
+
|
|
55
|
+
Roles, states and properties come from UI SDK and from native elements. Do not hand-write a
|
|
56
|
+
role UI SDK provides. Every control has an accessible name: a visible label, a label part
|
|
57
|
+
(`FieldLabel`, `DialogTitle`), or `aria-label` where there is no visible text. A decorative
|
|
58
|
+
icon is `aria-hidden`; text that only assistive technology needs uses `VisuallyHidden`.
|
|
59
|
+
Behavioural components run UI SDK's pattern check on `/__check/<name>`, and every states page
|
|
60
|
+
runs axe with the WCAG 2.2 AA rule tags, in both themes.
|
|
61
|
+
|
|
62
|
+
## Target size
|
|
63
|
+
|
|
64
|
+
Pointer targets are at least 24 by 24 CSS pixels (WCAG 2.5.8), checked with
|
|
65
|
+
`expectTargetSize(locator)`. Default controls are 40px high.
|
|
66
|
+
|
|
67
|
+
## Motion
|
|
68
|
+
|
|
69
|
+
Transitions are short (150ms) and stop under `prefers-reduced-motion: reduce`, where the theme
|
|
70
|
+
cuts every transition and animation. Nothing flashes, and no motion is needed to understand a
|
|
71
|
+
state.
|
|
72
|
+
|
|
73
|
+
## Zoom and reflow
|
|
74
|
+
|
|
75
|
+
Sizes are in `rem`. A page holds up at 200% zoom and at 320 CSS pixels wide without sideways
|
|
76
|
+
scrolling (`expectNoHorizontalScroll(page)`).
|
|
77
|
+
|
|
78
|
+
## Screen readers
|
|
79
|
+
|
|
80
|
+
Each P0 component is checked by hand with VoiceOver on Safari and NVDA on Chrome before 1.0.
|
|
81
|
+
The conformance file records the check as `manual` with its date; `null` means not done yet.
|
|
82
|
+
|
|
83
|
+
## What each component spec proves
|
|
84
|
+
|
|
85
|
+
| Check | How |
|
|
86
|
+
| ------------------------------------- | --------------------------------------------------- |
|
|
87
|
+
| zero axe violations, light and dark | `expectNoAxeViolations(page, testInfo)` |
|
|
88
|
+
| the focus ring | `expectFocusRing(locator)` after a real Tab |
|
|
89
|
+
| contrast of what it paints | `contrastOf(locator)` in both themes |
|
|
90
|
+
| keyboard path | real key presses; `expectTabOrder(page, [...])` |
|
|
91
|
+
| ARIA pattern (behavioural components) | `window.eodCheck.pattern(...)` on `/__check/<name>` |
|
|
92
|
+
| target size | `expectTargetSize(locator)` |
|
|
93
|
+
| no sideways scroll | `expectNoHorizontalScroll(page)` |
|
|
94
|
+
|
|
95
|
+
Every interactive component maps `design/accessibility` in its conformance file.
|