@azmr/ui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +171 -0
  2. package/dist/avatar.d.ts +58 -0
  3. package/dist/avatar.js +84 -0
  4. package/dist/breadcrumb.d.ts +47 -0
  5. package/dist/breadcrumb.js +120 -0
  6. package/dist/button-CYt2Zw3D.d.ts +64 -0
  7. package/dist/button.d.ts +54 -0
  8. package/dist/button.js +19 -0
  9. package/dist/chunk-2RIWL363.js +27 -0
  10. package/dist/chunk-2TQSHVXA.js +12 -0
  11. package/dist/chunk-7EOSDFS3.js +10 -0
  12. package/dist/chunk-C2HKIPLQ.js +118 -0
  13. package/dist/chunk-CAJLW6K2.js +16 -0
  14. package/dist/chunk-CZJZYN54.js +36 -0
  15. package/dist/chunk-EE4V6XMB.js +35 -0
  16. package/dist/chunk-EFHRRLAW.js +211 -0
  17. package/dist/chunk-GLB75NT3.js +21 -0
  18. package/dist/chunk-GX2YEJ43.js +36 -0
  19. package/dist/chunk-LTOLV67A.js +19 -0
  20. package/dist/chunk-LZMX27IZ.js +10 -0
  21. package/dist/chunk-NIIDYIZA.js +1 -0
  22. package/dist/chunk-Q4PPM2SU.js +97 -0
  23. package/dist/chunk-WVE2E37B.js +20 -0
  24. package/dist/chunk-XRZHP6BD.js +92 -0
  25. package/dist/disclosure.d.ts +72 -0
  26. package/dist/disclosure.js +221 -0
  27. package/dist/display.d.ts +111 -0
  28. package/dist/display.js +237 -0
  29. package/dist/features-dom-MCGKRLN5.js +7 -0
  30. package/dist/features-max-COBTQCO6.js +7 -0
  31. package/dist/floating.d.ts +81 -0
  32. package/dist/floating.js +231 -0
  33. package/dist/hooks.d.ts +33 -0
  34. package/dist/hooks.js +55 -0
  35. package/dist/icons/lucide.d.ts +77 -0
  36. package/dist/icons/lucide.js +135 -0
  37. package/dist/icons/mui-map.d.ts +1268 -0
  38. package/dist/icons/mui-map.js +352 -0
  39. package/dist/icons.d.ts +48 -0
  40. package/dist/icons.js +19 -0
  41. package/dist/index.d.ts +238 -3
  42. package/dist/index.js +242 -15
  43. package/dist/input.d.ts +14 -0
  44. package/dist/input.js +8 -0
  45. package/dist/layout/mui-map.d.ts +80 -0
  46. package/dist/layout/mui-map.js +104 -0
  47. package/dist/layout.d.ts +89 -0
  48. package/dist/layout.js +455 -0
  49. package/dist/lib.d.ts +11 -0
  50. package/dist/lib.js +6 -0
  51. package/dist/menu.d.ts +105 -0
  52. package/dist/menu.js +56 -0
  53. package/dist/modal.d.ts +105 -0
  54. package/dist/modal.js +273 -0
  55. package/dist/motion.css +295 -0
  56. package/dist/motion.d.ts +49 -0
  57. package/dist/motion.js +48 -0
  58. package/dist/pagination.d.ts +82 -0
  59. package/dist/pagination.js +211 -0
  60. package/dist/presets.d.ts +97 -0
  61. package/dist/presets.js +94 -0
  62. package/dist/progress.d.ts +70 -0
  63. package/dist/progress.js +138 -0
  64. package/dist/react.d.ts +81 -0
  65. package/dist/react.js +281 -0
  66. package/dist/responsive-YJBnvsjt.d.ts +69 -0
  67. package/dist/scroll-area.d.ts +30 -0
  68. package/dist/scroll-area.js +80 -0
  69. package/dist/shared-Fkx-sjPt.d.ts +15 -0
  70. package/dist/spinner.d.ts +18 -0
  71. package/dist/spinner.js +39 -0
  72. package/dist/split-button.d.ts +32 -0
  73. package/dist/split-button.js +54 -0
  74. package/dist/stepper.d.ts +27 -0
  75. package/dist/stepper.js +104 -0
  76. package/dist/styles.css +24 -0
  77. package/dist/table.d.ts +52 -0
  78. package/dist/table.js +124 -0
  79. package/dist/theme.d.ts +111 -0
  80. package/dist/theme.js +414 -0
  81. package/dist/toast.d.ts +77 -0
  82. package/dist/toast.js +203 -0
  83. package/dist/toggle.d.ts +55 -0
  84. package/dist/toggle.js +88 -0
  85. package/dist/tokens.css +337 -0
  86. package/dist/transition.d.ts +51 -0
  87. package/dist/transition.js +79 -0
  88. package/dist/types-BBudf463.d.ts +39 -0
  89. package/dist/typography/mui-map.d.ts +91 -0
  90. package/dist/typography/mui-map.js +62 -0
  91. package/dist/typography.d.ts +90 -0
  92. package/dist/typography.js +193 -0
  93. package/dist/useSignal-C-3ZGURN.d.ts +21 -0
  94. package/dist/variants-De0c0ucO.d.ts +60 -0
  95. package/package.json +179 -13
@@ -0,0 +1,104 @@
1
+ import {
2
+ Icon
3
+ } from "./chunk-Q4PPM2SU.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-7EOSDFS3.js";
7
+
8
+ // src/components/stepper/stepper.tsx
9
+ import { Check, X } from "lucide-react";
10
+ import { forwardRef } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ var STATUS_LABELS = {
13
+ complete: "Completed",
14
+ current: "Current step",
15
+ upcoming: "Not started",
16
+ error: "Error"
17
+ };
18
+ var INDICATOR = {
19
+ complete: "border-primary bg-primary text-primary-foreground",
20
+ current: "border-primary bg-background text-primary",
21
+ upcoming: "border-border bg-background text-muted-foreground",
22
+ error: "border-destructive bg-background text-destructive"
23
+ };
24
+ var Stepper = forwardRef(function Stepper2({
25
+ steps,
26
+ current,
27
+ orientation = "horizontal",
28
+ label = "Progress",
29
+ statusLabels,
30
+ className,
31
+ ...props
32
+ }, ref) {
33
+ const words = { ...STATUS_LABELS, ...statusLabels };
34
+ const horizontal = orientation === "horizontal";
35
+ return /* @__PURE__ */ jsx(
36
+ "ol",
37
+ {
38
+ ref,
39
+ "aria-label": label,
40
+ "data-orientation": orientation,
41
+ className: cn(horizontal ? "flex flex-row items-start" : "flex flex-col", className),
42
+ ...props,
43
+ children: steps.map((step, index) => {
44
+ const status = step.status === "error" ? "error" : index < current ? "complete" : index === current ? "current" : "upcoming";
45
+ const last = index === steps.length - 1;
46
+ return /* @__PURE__ */ jsxs(
47
+ "li",
48
+ {
49
+ "data-status": status,
50
+ "aria-current": status === "current" ? "step" : void 0,
51
+ className: cn(
52
+ "flex",
53
+ horizontal ? "flex-1 flex-row items-center last:flex-none" : "flex-col"
54
+ ),
55
+ children: [
56
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
57
+ /* @__PURE__ */ jsx(
58
+ "span",
59
+ {
60
+ "data-azmr-step-indicator": "",
61
+ className: cn(
62
+ "flex size-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-medium",
63
+ INDICATOR[status]
64
+ ),
65
+ children: status === "complete" ? /* @__PURE__ */ jsx(Icon, { icon: Check }) : status === "error" ? /* @__PURE__ */ jsx(Icon, { icon: X }) : index + 1
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsxs("span", { className: "grid text-left", children: [
69
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: words[status] }),
70
+ /* @__PURE__ */ jsx(
71
+ "span",
72
+ {
73
+ className: cn(
74
+ "text-sm font-medium",
75
+ status === "upcoming" && "text-muted-foreground"
76
+ ),
77
+ children: step.label
78
+ }
79
+ ),
80
+ step.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: step.description })
81
+ ] })
82
+ ] }),
83
+ !last && /* @__PURE__ */ jsx(
84
+ "span",
85
+ {
86
+ "data-azmr-step-connector": "",
87
+ "aria-hidden": "true",
88
+ className: cn(
89
+ index < current ? "bg-primary" : "bg-border",
90
+ horizontal ? "mx-3 h-px min-w-6 flex-1" : "my-2 ml-4 min-h-6 w-px"
91
+ )
92
+ }
93
+ )
94
+ ]
95
+ },
96
+ index
97
+ );
98
+ })
99
+ }
100
+ );
101
+ });
102
+ export {
103
+ Stepper
104
+ };
@@ -0,0 +1,24 @@
1
+ /*
2
+ * @azmr/ui stylesheet: the design tokens plus the global base rules.
3
+ *
4
+ * @import "tailwindcss";
5
+ * @import "@azmr/ui/styles.css";
6
+ *
7
+ * Importing this changes the page itself: the body gets our background and text colours, and every
8
+ * element's default border and outline colour become our tokens. For an app that already has global
9
+ * styles (another UI library mid-migration, a docs site), import "@azmr/ui/tokens.css" instead:
10
+ * the same tokens, themes, density and utilities, without these global rules.
11
+ */
12
+ @import "./tokens.css";
13
+
14
+ @layer base {
15
+ * {
16
+ border-color: var(--border);
17
+ outline-color: var(--ring);
18
+ }
19
+
20
+ body {
21
+ background-color: var(--background);
22
+ color: var(--foreground);
23
+ }
24
+ }
@@ -0,0 +1,52 @@
1
+ import * as react from 'react';
2
+ import { TableHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
3
+
4
+ type Align = "left" | "center" | "right";
5
+ interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
6
+ /**
7
+ * Names the scrolling container. When set it becomes a labelled, focusable region, so a keyboard
8
+ * user can scroll a table that is wider than its space. Give a wide table a label.
9
+ */
10
+ label?: string;
11
+ /** Classes for the scrolling container, such as a `max-h-96` so the table scrolls vertically. */
12
+ containerClassName?: string;
13
+ /** Keep the header row in view while the body scrolls. Give the container a height. */
14
+ stickyHeader?: boolean;
15
+ /** Tint every other body row. */
16
+ striped?: boolean;
17
+ /** Tint the row under the pointer. */
18
+ hoverable?: boolean;
19
+ }
20
+ /**
21
+ * A semantic, non-interactive table. It is a native `<table>`, so it already has the table, row and
22
+ * cell roles; name it with a `TableCaption`. Server-safe.
23
+ */
24
+ declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
25
+ declare const TableHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
26
+ declare const TableBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
27
+ declare const TableFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
28
+ interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
29
+ /** Marks the row as selected (`data-selected`) and tints it. */
30
+ selected?: boolean;
31
+ }
32
+ declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
33
+ interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
34
+ /** Horizontal alignment. Default `left`. */
35
+ align?: Align;
36
+ }
37
+ /** A header cell. `scope="col"` by default; use `scope="row"` for the first cell of a row. */
38
+ declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
39
+ interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
40
+ align?: Align;
41
+ /** Right-aligns and uses tabular figures, so a column of numbers lines up. */
42
+ numeric?: boolean;
43
+ }
44
+ declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
45
+ interface TableCaptionProps extends HTMLAttributes<HTMLTableCaptionElement> {
46
+ /** Hide the caption visually but keep it as the table's name. */
47
+ srOnly?: boolean;
48
+ }
49
+ /** The table's name. Prefer a visible caption; `srOnly` keeps it for assistive technology only. */
50
+ declare const TableCaption: react.ForwardRefExoticComponent<TableCaptionProps & react.RefAttributes<HTMLTableCaptionElement>>;
51
+
52
+ export { Table, TableBody, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, TableHead, type TableHeadProps, TableHeader, type TableProps, TableRow, type TableRowProps };
package/dist/table.js ADDED
@@ -0,0 +1,124 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-7EOSDFS3.js";
4
+
5
+ // src/components/table/table.tsx
6
+ import {
7
+ forwardRef
8
+ } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var ALIGN = { left: "text-left", center: "text-center", right: "text-right" };
11
+ var Table = forwardRef(function Table2({ label, containerClassName, stickyHeader, striped, hoverable, className, ...props }, ref) {
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ ...label ? { role: "region", "aria-label": label, tabIndex: 0 } : {},
16
+ className: cn(
17
+ "relative w-full overflow-x-auto",
18
+ label && "rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
19
+ stickyHeader && "overflow-y-auto",
20
+ containerClassName
21
+ ),
22
+ children: /* @__PURE__ */ jsx(
23
+ "table",
24
+ {
25
+ ref,
26
+ className: cn(
27
+ "w-full caption-bottom border-collapse text-sm",
28
+ stickyHeader && "[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:bg-background [&_thead_th]:shadow-[inset_0_-1px_0_0_var(--color-border)]",
29
+ striped && "[&_tbody_tr:nth-child(even)]:bg-muted/50",
30
+ hoverable && "[&_tbody_tr:hover]:bg-muted/50",
31
+ className
32
+ ),
33
+ ...props
34
+ }
35
+ )
36
+ }
37
+ );
38
+ });
39
+ var TableHeader = forwardRef(function TableHeader2({ className, ...props }, ref) {
40
+ return /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props });
41
+ });
42
+ var TableBody = forwardRef(function TableBody2({ className, ...props }, ref) {
43
+ return /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
44
+ });
45
+ var TableFooter = forwardRef(function TableFooter2({ className, ...props }, ref) {
46
+ return /* @__PURE__ */ jsx(
47
+ "tfoot",
48
+ {
49
+ ref,
50
+ className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
51
+ ...props
52
+ }
53
+ );
54
+ });
55
+ var TableRow = forwardRef(function TableRow2({ selected, className, ...props }, ref) {
56
+ return /* @__PURE__ */ jsx(
57
+ "tr",
58
+ {
59
+ ref,
60
+ "data-selected": selected ? "" : void 0,
61
+ className: cn(
62
+ "h-(--density-row-height) border-b border-border transition-colors data-[selected]:bg-muted",
63
+ className
64
+ ),
65
+ ...props
66
+ }
67
+ );
68
+ });
69
+ var TableHead = forwardRef(function TableHead2({ scope = "col", align = "left", className, ...props }, ref) {
70
+ return /* @__PURE__ */ jsx(
71
+ "th",
72
+ {
73
+ ref,
74
+ scope,
75
+ className: cn(
76
+ "px-3 text-left align-middle font-medium text-muted-foreground",
77
+ ALIGN[align],
78
+ className
79
+ ),
80
+ ...props
81
+ }
82
+ );
83
+ });
84
+ var TableCell = forwardRef(function TableCell2({ align, numeric, className, ...props }, ref) {
85
+ return /* @__PURE__ */ jsx(
86
+ "td",
87
+ {
88
+ ref,
89
+ className: cn(
90
+ "px-3 py-2 align-middle",
91
+ numeric && "text-right tabular-nums",
92
+ align && ALIGN[align],
93
+ className
94
+ ),
95
+ ...props
96
+ }
97
+ );
98
+ });
99
+ var TableCaption = forwardRef(
100
+ function TableCaption2({ srOnly, className, ...props }, ref) {
101
+ return /* @__PURE__ */ jsx(
102
+ "caption",
103
+ {
104
+ ref,
105
+ className: cn(
106
+ "mt-4 caption-bottom text-sm text-muted-foreground",
107
+ srOnly && "sr-only",
108
+ className
109
+ ),
110
+ ...props
111
+ }
112
+ );
113
+ }
114
+ );
115
+ export {
116
+ Table,
117
+ TableBody,
118
+ TableCaption,
119
+ TableCell,
120
+ TableFooter,
121
+ TableHead,
122
+ TableHeader,
123
+ TableRow
124
+ };
@@ -0,0 +1,111 @@
1
+ declare const THEME_PREFERENCES: readonly ["light", "dark", "system"];
2
+ type ThemePreference = (typeof THEME_PREFERENCES)[number];
3
+ declare const DENSITIES: readonly ["compact", "comfortable", "spacious"];
4
+ type Density = (typeof DENSITIES)[number];
5
+ declare const THEME_COOKIE = "azmr-theme";
6
+ declare const DENSITY_COOKIE = "azmr-density";
7
+ /** Validate untrusted input (a cookie, storage, a query string) down to a known value. */
8
+ declare function parseThemePreference(value: unknown, fallback?: ThemePreference): ThemePreference;
9
+ declare function parseDensity(value: unknown, fallback?: Density): Density;
10
+ /** Read one cookie from a `Cookie` header / `document.cookie` string. */
11
+ declare function readCookie(header: string | null | undefined, name: string): string | undefined;
12
+ interface CookieOptions {
13
+ /** Add the `Secure` attribute (set when the page is served over HTTPS). */
14
+ secure?: boolean;
15
+ }
16
+ /** Build a `Set-Cookie` / `document.cookie` string: path-wide, one year, SameSite=Lax. */
17
+ declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;
18
+ interface HtmlAttributes {
19
+ "data-theme"?: "light" | "dark";
20
+ "data-density"?: "compact" | "spacious";
21
+ }
22
+ interface HtmlAttributesInput {
23
+ theme?: ThemePreference;
24
+ density?: Density;
25
+ }
26
+ declare function buildHtmlAttributes({ theme, density }: HtmlAttributesInput): HtmlAttributes;
27
+ /**
28
+ * Attributes for `<html>` in a server layout:
29
+ * `<html lang="en-NZ" {...htmlAttributes.fromCookies(cookieHeader)}>`.
30
+ */
31
+ declare const htmlAttributes: typeof buildHtmlAttributes & {
32
+ fromCookies(header: string | null | undefined): HtmlAttributes;
33
+ };
34
+
35
+ interface Oklch {
36
+ l: number;
37
+ c: number;
38
+ h: number;
39
+ }
40
+ interface ThemeOptions {
41
+ /** Brand colour as `#rgb`, `#rrggbb`, `oklch(L C H)` or `{ l, c, h }`. */
42
+ primary?: string | Oklch;
43
+ /** Secondary surfaces (secondary Button, Badge). Same accepted formats as `primary`. */
44
+ secondary?: string | Oklch;
45
+ /**
46
+ * Status colours. Each is derived so its foreground is AA on it in both modes, and so it stays
47
+ * readable as text on the page and on cards (`Text tone`, form errors). `destructive` is the
48
+ * "danger" colour.
49
+ */
50
+ success?: string | Oklch;
51
+ warning?: string | Oklch;
52
+ info?: string | Oklch;
53
+ destructive?: string | Oklch;
54
+ /** `rem` or `px`, e.g. `0.5rem`. */
55
+ radius?: string;
56
+ /** A CSS font-family list, e.g. `Inter, "Segoe UI", sans-serif`. */
57
+ font?: string;
58
+ density?: Density;
59
+ }
60
+ interface Theme {
61
+ /** Custom properties to set on `:root` (or any ancestor), e.g. via a `style` prop. */
62
+ cssVariables: Record<string, string>;
63
+ /** The same variables as a `:root { ... }` rule. */
64
+ css: string;
65
+ /** Attributes for `<html>` (density). */
66
+ htmlAttributes: HtmlAttributes;
67
+ }
68
+ declare function createTheme(options?: ThemeOptions): Theme;
69
+
70
+ declare function themeInitScript(): string;
71
+
72
+ interface LocaleMessages {
73
+ close: string;
74
+ cancel: string;
75
+ confirm: string;
76
+ loading: string;
77
+ noResults: string;
78
+ clear: string;
79
+ search: string;
80
+ previousPage: string;
81
+ nextPage: string;
82
+ }
83
+ declare const DEFAULT_MESSAGES: Readonly<LocaleMessages>;
84
+ type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
85
+ interface LocaleOptions {
86
+ /** BCP 47 tag. Default `en-NZ`. */
87
+ locale?: string;
88
+ /** ISO 4217 code. Default `NZD`. */
89
+ currency?: string;
90
+ /** 0 = Sunday ... 6 = Saturday. Default 1 (Monday). */
91
+ weekStartsOn?: WeekStart;
92
+ /** IANA zone used to display instants. Default: the runtime's zone. */
93
+ timeZone?: string;
94
+ messages?: Partial<LocaleMessages>;
95
+ }
96
+ type DateInput = Date | number | string | null | undefined;
97
+ interface Locale {
98
+ readonly locale: string;
99
+ readonly currency: string;
100
+ readonly weekStartsOn: WeekStart;
101
+ readonly timeZone: string | undefined;
102
+ readonly messages: LocaleMessages;
103
+ formatNumber(value: number | null | undefined, options?: Intl.NumberFormatOptions): string;
104
+ formatCurrency(value: number | null | undefined, options?: Intl.NumberFormatOptions): string;
105
+ /** Date-only strings (`2026-10-15`) print that calendar day in every time zone. */
106
+ formatDate(value: DateInput, options?: Intl.DateTimeFormatOptions): string;
107
+ formatDateTime(value: DateInput, options?: Intl.DateTimeFormatOptions): string;
108
+ }
109
+ declare function createLocale(options?: LocaleOptions): Locale;
110
+
111
+ export { type CookieOptions, DEFAULT_MESSAGES, DENSITIES, DENSITY_COOKIE, type DateInput, type Density, type HtmlAttributes, type Locale, type LocaleMessages, type LocaleOptions, type Oklch, THEME_COOKIE, THEME_PREFERENCES, type Theme, type ThemeOptions, type ThemePreference, type WeekStart, createLocale, createTheme, htmlAttributes, parseDensity, parseThemePreference, readCookie, serializeCookie, themeInitScript };