@ksojecki/purpose-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/README.md +79 -2
- package/assets/fonts/Karla[wght].ttf +0 -0
- package/assets/fonts/OFL.txt +93 -0
- package/dist/Alert-D-5k0maf.js +23 -0
- package/dist/Button-T8UI5igR.js +112 -0
- package/dist/Dropdown-BZKzAbKB.js +56 -0
- package/dist/Heading-CWDWXU_n.js +27 -0
- package/dist/IconButton-P7nSooA3.js +18 -0
- package/dist/Link-9mNYgEzY.js +36 -0
- package/dist/Paragraph-DFwfb2Yt.js +14 -0
- package/dist/Switch-CI8vMkGz.js +84 -0
- package/dist/actions/Button.d.ts +69 -0
- package/dist/actions/ButtonGroup.d.ts +20 -0
- package/dist/actions/IconActionButtons.d.ts +34 -0
- package/dist/actions/IconButton.d.ts +21 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +41 -0
- package/dist/classNames-x6JVYA2t.js +5 -0
- package/dist/data/DataTable.d.ts +47 -0
- package/dist/data/Metric.d.ts +46 -0
- package/dist/data/Table.d.ts +33 -0
- package/dist/data/index.d.ts +8 -0
- package/dist/data/index.js +85 -0
- package/dist/feedback/Alert.d.ts +23 -0
- package/dist/feedback/Badge.d.ts +23 -0
- package/dist/feedback/ConfirmDeletePanel.d.ts +32 -0
- package/dist/feedback/EmptyState.d.ts +22 -0
- package/dist/feedback/Progress.d.ts +24 -0
- package/dist/feedback/Skeleton.d.ts +10 -0
- package/dist/feedback/Spinner.d.ts +16 -0
- package/dist/feedback/Toast.d.ts +48 -0
- package/dist/feedback/Tooltip.d.ts +21 -0
- package/dist/feedback/index.d.ts +15 -0
- package/dist/feedback/index.js +138 -0
- package/dist/forms/Checkbox.d.ts +16 -0
- package/dist/forms/DatePicker.d.ts +51 -0
- package/dist/forms/Field.d.ts +65 -0
- package/dist/forms/FileInput.d.ts +20 -0
- package/dist/forms/FilterBar.d.ts +21 -0
- package/dist/forms/FilterRow.d.ts +20 -0
- package/dist/forms/FormActions.d.ts +28 -0
- package/dist/forms/FormField.d.ts +39 -0
- package/dist/forms/Input.d.ts +20 -0
- package/dist/forms/Radio.d.ts +52 -0
- package/dist/forms/Range.d.ts +24 -0
- package/dist/forms/SegmentedControl.d.ts +33 -0
- package/dist/forms/Select.d.ts +23 -0
- package/dist/forms/Switch.d.ts +15 -0
- package/dist/forms/Textarea.d.ts +20 -0
- package/dist/forms/TimePicker.d.ts +29 -0
- package/dist/forms/index.d.ts +21 -0
- package/dist/forms/index.js +429 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons-CMOARHwx.js +18 -0
- package/dist/internal/classNames.d.ts +1 -0
- package/dist/internal/purpose.d.ts +7 -0
- package/dist/layout/BottomSheet.d.ts +25 -0
- package/dist/layout/Card.d.ts +22 -0
- package/dist/layout/Disclosure.d.ts +18 -0
- package/dist/layout/Divider.d.ts +16 -0
- package/dist/layout/Page/Content.d.ts +11 -0
- package/dist/layout/Page/Page.d.ts +6 -0
- package/dist/layout/Page/index.d.ts +19 -0
- package/dist/layout/PageContainer.d.ts +18 -0
- package/dist/layout/PageHeader.d.ts +25 -0
- package/dist/layout/Section.d.ts +22 -0
- package/dist/layout/index.d.ts +13 -0
- package/dist/layout/index.js +173 -0
- package/dist/navigation/Dropdown.d.ts +47 -0
- package/dist/navigation/Link.d.ts +32 -0
- package/dist/navigation/Menu.d.ts +89 -0
- package/dist/navigation/NavMenu.d.ts +56 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.js +128 -0
- package/dist/navigation/popoverFade.d.ts +5 -0
- package/dist/overlays/ConsentBanner/ConsentBanner.d.ts +35 -0
- package/dist/overlays/ConsentBanner/index.d.ts +1 -0
- package/dist/overlays/ConsentSettings/ConsentSettings.d.ts +48 -0
- package/dist/overlays/ConsentSettings/index.d.ts +1 -0
- package/dist/overlays/ModalWindow/ModalWindow.d.ts +60 -0
- package/dist/overlays/ModalWindow/index.d.ts +3 -0
- package/dist/overlays/index.d.ts +8 -0
- package/dist/overlays/index.js +195 -0
- package/dist/typography/Heading/Heading.d.ts +24 -0
- package/dist/typography/Heading/index.d.ts +1 -0
- package/dist/typography/Paragraph.d.ts +16 -0
- package/dist/typography/Prose.d.ts +17 -0
- package/dist/typography/index.d.ts +8 -0
- package/dist/typography/index.js +12 -0
- package/package.json +121 -4
- package/styles/budget.css +9 -0
- package/styles/generic.css +9 -0
- package/styles/roadsign.css +9 -0
- package/styles/traffic.css +9 -0
- package/theme.css +341 -0
- package/themes/budget.css +103 -0
- package/themes/generic.css +103 -0
- package/themes/roadsign.css +103 -0
- package/themes/traffic.css +103 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { t as e } from "../Button-T8UI5igR.js";
|
|
2
|
+
import { t } from "../classNames-x6JVYA2t.js";
|
|
3
|
+
import { t as n } from "../Heading-CWDWXU_n.js";
|
|
4
|
+
import { t as r } from "../Paragraph-DFwfb2Yt.js";
|
|
5
|
+
import { useId as i, useState as a } from "react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
// src/layout/BottomSheet.tsx
|
|
8
|
+
function l({ children: n, className: r, defaultOpen: o = !0, onOpenChange: l, open: u, summary: d, title: f, ...p }) {
|
|
9
|
+
let [m, h] = a(o), g = u ?? m, _ = i(), v = i(), y = () => {
|
|
10
|
+
let e = !g;
|
|
11
|
+
u === void 0 && h(e), l?.(e);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ c("section", {
|
|
14
|
+
...p,
|
|
15
|
+
className: t("flex min-h-0 shrink-0 animate-slide-up flex-col rounded-t-box border-t border-base-300 bg-base-100 shadow-lg", r),
|
|
16
|
+
children: [/* @__PURE__ */ c(e, {
|
|
17
|
+
"aria-controls": _,
|
|
18
|
+
"aria-describedby": d ? v : void 0,
|
|
19
|
+
"aria-expanded": g,
|
|
20
|
+
className: "h-auto w-full shrink-0 flex-col gap-2 rounded-none rounded-t-box py-3",
|
|
21
|
+
fullWidth: !0,
|
|
22
|
+
onClick: y,
|
|
23
|
+
tone: "default",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ s("span", {
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: "h-1 w-10 rounded-full bg-base-300"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ s("span", { children: f }),
|
|
30
|
+
d ? /* @__PURE__ */ s("span", {
|
|
31
|
+
className: "w-full",
|
|
32
|
+
id: v,
|
|
33
|
+
children: d
|
|
34
|
+
}) : null
|
|
35
|
+
]
|
|
36
|
+
}), /* @__PURE__ */ s("div", {
|
|
37
|
+
className: "min-h-0 overflow-y-auto overscroll-contain",
|
|
38
|
+
hidden: !g,
|
|
39
|
+
id: _,
|
|
40
|
+
children: n
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// src/layout/Card.tsx
|
|
45
|
+
var u = "card bg-base-100 shadow", d = "card-body", f = "card-actions justify-end", p = {
|
|
46
|
+
sm: "card-sm",
|
|
47
|
+
md: "card-md",
|
|
48
|
+
lg: "card-lg"
|
|
49
|
+
};
|
|
50
|
+
function m({ actions: e, as: n = "section", children: r, className: i, size: a = "md", title: o, ...l }) {
|
|
51
|
+
return /* @__PURE__ */ s(n, {
|
|
52
|
+
...l,
|
|
53
|
+
className: t(u, p[a], i),
|
|
54
|
+
children: /* @__PURE__ */ c("div", {
|
|
55
|
+
className: d,
|
|
56
|
+
children: [
|
|
57
|
+
o === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
58
|
+
className: "card-title",
|
|
59
|
+
children: o
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ s("div", { children: r }),
|
|
62
|
+
e === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
63
|
+
className: f,
|
|
64
|
+
children: e
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// src/layout/Disclosure.tsx
|
|
71
|
+
var h = ({ bordered: e = !1, children: n, className: r, open: i, summary: a, ...o }) => /* @__PURE__ */ c("details", {
|
|
72
|
+
...o,
|
|
73
|
+
className: t("collapse collapse-arrow", e ? "border border-base-300" : void 0, r),
|
|
74
|
+
open: i,
|
|
75
|
+
children: [/* @__PURE__ */ s("summary", {
|
|
76
|
+
className: "collapse-title",
|
|
77
|
+
children: a
|
|
78
|
+
}), /* @__PURE__ */ s("div", {
|
|
79
|
+
className: "collapse-content",
|
|
80
|
+
children: n
|
|
81
|
+
})]
|
|
82
|
+
}), g = ({ children: e, className: n, row: r = !1, vertical: i = !1, ...a }) => /* @__PURE__ */ s("div", {
|
|
83
|
+
...a,
|
|
84
|
+
className: t("divider", i ? "divider-vertical" : void 0, r ? "divider-horizontal" : void 0, n),
|
|
85
|
+
children: e
|
|
86
|
+
}), _ = {
|
|
87
|
+
standard: "max-w-5xl",
|
|
88
|
+
wide: "max-w-6xl",
|
|
89
|
+
full: ""
|
|
90
|
+
};
|
|
91
|
+
function v({ children: e, className: n, width: r = "standard", ...i }) {
|
|
92
|
+
return /* @__PURE__ */ s("div", {
|
|
93
|
+
...i,
|
|
94
|
+
className: t("mx-auto w-full", _[r], n),
|
|
95
|
+
children: e
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// src/layout/PageHeader.tsx
|
|
99
|
+
function y({ actions: e, className: i, appearance: a = "default", description: o, eyebrow: l, meta: u, title: d, ...f }) {
|
|
100
|
+
return /* @__PURE__ */ c("header", {
|
|
101
|
+
...f,
|
|
102
|
+
className: t("flex flex-col", a === "plain" ? "gap-3 py-2" : "gap-4 rounded-box border border-base-300 bg-base-100 p-6 shadow-(--elevation-1)", i),
|
|
103
|
+
children: [/* @__PURE__ */ c("div", {
|
|
104
|
+
className: t("flex flex-col lg:flex-row lg:items-start lg:justify-between", a === "plain" ? "gap-3" : "gap-4"),
|
|
105
|
+
children: [/* @__PURE__ */ c("div", {
|
|
106
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
107
|
+
children: [
|
|
108
|
+
l === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
109
|
+
className: "text-sm font-medium uppercase tracking-[0.16em] text-base-content/50",
|
|
110
|
+
children: l
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ s(n, {
|
|
113
|
+
className: "font-semibold",
|
|
114
|
+
level: 1,
|
|
115
|
+
children: d
|
|
116
|
+
}),
|
|
117
|
+
o === void 0 ? null : /* @__PURE__ */ s(r, {
|
|
118
|
+
tone: "muted",
|
|
119
|
+
children: o
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}), e === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
123
|
+
className: "flex flex-wrap gap-2 lg:justify-end",
|
|
124
|
+
children: e
|
|
125
|
+
})]
|
|
126
|
+
}), u === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
127
|
+
className: "flex flex-wrap gap-3 text-sm text-base-content/70",
|
|
128
|
+
children: u
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// src/layout/Section.tsx
|
|
133
|
+
function b({ actions: e, appearance: i = "default", children: a, className: o, contentClassName: l, description: u, title: d, ...f }) {
|
|
134
|
+
return /* @__PURE__ */ c("section", {
|
|
135
|
+
...f,
|
|
136
|
+
className: t(i === "plain" ? "py-2" : "rounded-box border border-base-300 bg-base-100 p-6 shadow-(--elevation-1)", o),
|
|
137
|
+
children: [/* @__PURE__ */ c("div", {
|
|
138
|
+
className: t("flex flex-col sm:flex-row sm:items-start sm:justify-between", i === "plain" ? "gap-2" : "gap-3"),
|
|
139
|
+
children: [/* @__PURE__ */ c("div", {
|
|
140
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
141
|
+
children: [/* @__PURE__ */ s(n, {
|
|
142
|
+
className: "font-semibold",
|
|
143
|
+
level: 2,
|
|
144
|
+
children: d
|
|
145
|
+
}), u === void 0 ? null : /* @__PURE__ */ s(r, {
|
|
146
|
+
tone: "muted",
|
|
147
|
+
children: u
|
|
148
|
+
})]
|
|
149
|
+
}), e === void 0 ? null : /* @__PURE__ */ s("div", {
|
|
150
|
+
className: "flex flex-wrap gap-2 sm:justify-end",
|
|
151
|
+
children: e
|
|
152
|
+
})]
|
|
153
|
+
}), /* @__PURE__ */ s("div", {
|
|
154
|
+
className: t(i === "plain" ? "mt-3" : "mt-5", l),
|
|
155
|
+
children: a
|
|
156
|
+
})]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
// src/layout/Page/index.ts
|
|
160
|
+
var x = Object.assign(({ children: e, className: n }) => {
|
|
161
|
+
let [r, i] = e;
|
|
162
|
+
return /* @__PURE__ */ c("main", {
|
|
163
|
+
className: t("p-4 w-full flex flex-col gap-4 animate-fade-in", n),
|
|
164
|
+
children: [r, i]
|
|
165
|
+
});
|
|
166
|
+
}, {
|
|
167
|
+
Title: ({ children: e }) => /* @__PURE__ */ s(n, {
|
|
168
|
+
level: 1,
|
|
169
|
+
children: e
|
|
170
|
+
}),
|
|
171
|
+
Content: ({ children: e }) => /* @__PURE__ */ s(o, { children: e })
|
|
172
|
+
});
|
|
173
|
+
export { l as BottomSheet, m as Card, h as Disclosure, g as Divider, x as Page, v as PageContainer, y as PageHeader, b as Section };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ButtonSize, type ButtonTone } from '../actions/Button';
|
|
3
|
+
import type { ActionPurpose } from '../internal/purpose';
|
|
4
|
+
export type DropdownAlign = 'start' | 'end';
|
|
5
|
+
export interface DropdownProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Extra panel classes, such as a width. */
|
|
8
|
+
contentClassName?: string;
|
|
9
|
+
/** Hide the panel after a click on a link or button inside it. */
|
|
10
|
+
closeOnSelect?: boolean;
|
|
11
|
+
/** Disables the trigger. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Alias of `triggerClassName`: both are joined onto the trigger. `ButtonGroup` adds `join-item` through it. */
|
|
14
|
+
className?: string;
|
|
15
|
+
align?: DropdownAlign;
|
|
16
|
+
/** Fires from the popover `toggle` event with the new open state. */
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
/** Controlled open state, for a parent that closes the panel after a choice. Omit it for the native popover. */
|
|
19
|
+
open?: boolean;
|
|
20
|
+
trigger: ReactNode;
|
|
21
|
+
/** Extra trigger classes, such as a text colour for a coloured header. */
|
|
22
|
+
triggerClassName?: string;
|
|
23
|
+
/** Accessible name for the trigger; include any visible trigger text. */
|
|
24
|
+
triggerLabel?: string;
|
|
25
|
+
/** Id of the trigger button, for a `<label htmlFor>`. */
|
|
26
|
+
triggerId?: string;
|
|
27
|
+
triggerPurpose?: ActionPurpose;
|
|
28
|
+
/** Explicit trigger tone; wins over the tone of `triggerPurpose`. */
|
|
29
|
+
triggerTone?: ButtonTone;
|
|
30
|
+
triggerSize?: ButtonSize;
|
|
31
|
+
triggerSquare?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Trigger button with a panel in a native popover. Omit `open` to leave opening and closing to the platform; set it to control the panel from the parent.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Dropdown align="end" trigger="Export" triggerPurpose="neutral">
|
|
39
|
+
* <Menu>
|
|
40
|
+
* <MenuItem>
|
|
41
|
+
* <MenuButton>CSV</MenuButton>
|
|
42
|
+
* </MenuItem>
|
|
43
|
+
* </Menu>
|
|
44
|
+
* </Dropdown>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function Dropdown({ children, className, contentClassName, closeOnSelect, disabled, align, onOpenChange, open: controlledOpen, trigger, triggerClassName, triggerId, triggerLabel, triggerPurpose, triggerSize, triggerSquare, triggerTone, }: DropdownProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type To } from 'react-router';
|
|
3
|
+
import { type ButtonSize, type ButtonTone, type ButtonVariant } from '../actions/Button';
|
|
4
|
+
import type { ActionPurpose } from '../internal/purpose';
|
|
5
|
+
export type LinkTone = ButtonTone;
|
|
6
|
+
export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
to: To;
|
|
9
|
+
asButton?: boolean;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
/** Semantic action meaning. Colour comes from it unless `tone` is set. */
|
|
12
|
+
purpose?: ActionPurpose;
|
|
13
|
+
/** Button size; only applies with `asButton`. */
|
|
14
|
+
size?: ButtonSize;
|
|
15
|
+
/** Square icon-only button; only applies with `asButton`. */
|
|
16
|
+
square?: boolean;
|
|
17
|
+
tone?: LinkTone;
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Link component that can render as a styled link or button.
|
|
22
|
+
* When asButton is true, it shares Button's classes; otherwise it uses link classes.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Link to="/invoices">All invoices</Link>
|
|
27
|
+
* <Link asButton purpose="create" to="/invoices/new">
|
|
28
|
+
* New invoice
|
|
29
|
+
* </Link>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const Link: ({ children, className, to, asButton, fullWidth, purpose, size, square, tone, variant, ...props }: LinkProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type To } from 'react-router';
|
|
3
|
+
import type { ButtonSize } from '../actions/Button';
|
|
4
|
+
export type MenuSize = ButtonSize;
|
|
5
|
+
export interface MenuProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
horizontal?: boolean;
|
|
9
|
+
size?: MenuSize;
|
|
10
|
+
}
|
|
11
|
+
export interface MenuItemProps {
|
|
12
|
+
/** A single link or button. The state classes are added to it. */
|
|
13
|
+
children: ReactElement<AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
to?: To;
|
|
16
|
+
}>;
|
|
17
|
+
active?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface MenuNavLinkProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** Match the route only when it is exactly `to`. */
|
|
23
|
+
end?: boolean;
|
|
24
|
+
to: To;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Vertical list of links or buttons; `horizontal` lays the items out in a row.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Menu>
|
|
32
|
+
* <MenuTitle>Account</MenuTitle>
|
|
33
|
+
* <MenuNavLink to="/profile">Profile</MenuNavLink>
|
|
34
|
+
* <MenuItem>
|
|
35
|
+
* <MenuButton onClick={signOut}>Sign out</MenuButton>
|
|
36
|
+
* </MenuItem>
|
|
37
|
+
* </Menu>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function Menu({ children, className, horizontal, size }: MenuProps): import("react").JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* Wraps one link or button in an `li`; `active` and `disabled` mark the child.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <MenuItem disabled>
|
|
47
|
+
* <MenuButton>Archive</MenuButton>
|
|
48
|
+
* </MenuItem>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function MenuItem({ children, active, disabled }: MenuItemProps): import("react").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Plain button for a `MenuItem`: menu row styling, not the `btn` look. Pass `aria-current` for the selected row.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <MenuItem>
|
|
58
|
+
* <MenuButton aria-current="true" onClick={showAll}>
|
|
59
|
+
* All
|
|
60
|
+
* </MenuButton>
|
|
61
|
+
* </MenuItem>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function MenuButton(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* Non-interactive row that labels the menu items after it.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <MenuTitle>Account</MenuTitle>
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function MenuTitle({ children }: {
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}): import("react").JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* Router link in a menu item that gets `menu-active` while its route matches.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <Menu>
|
|
82
|
+
* <MenuNavLink end to="/">
|
|
83
|
+
* Overview
|
|
84
|
+
* </MenuNavLink>
|
|
85
|
+
* <MenuNavLink to="/invoices">Invoices</MenuNavLink>
|
|
86
|
+
* </Menu>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function MenuNavLink({ children, end, to }: MenuNavLinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface NavMenuProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Extra megamenu classes, such as a text colour for a coloured navbar. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Text of the mobile toggle; also its accessible name. */
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NavMenuItemProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface NavMenuColumnProps {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
title?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mobile toggle plus a horizontal megamenu on `md` and up; vertical below it.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <NavMenu label="Menu">
|
|
23
|
+
* <NavMenuItem label="Reports">
|
|
24
|
+
* <NavMenuColumn title="Sales">
|
|
25
|
+
* <MenuNavLink to="/reports/monthly">Monthly</MenuNavLink>
|
|
26
|
+
* </NavMenuColumn>
|
|
27
|
+
* </NavMenuItem>
|
|
28
|
+
* </NavMenu>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function NavMenu({ children, className, label }: NavMenuProps): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Top-level megamenu button that opens its own panel; pass `NavMenuColumn`s as children.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <NavMenuItem label="Reports">
|
|
38
|
+
* <NavMenuColumn title="Sales">
|
|
39
|
+
* <MenuNavLink to="/reports/monthly">Monthly</MenuNavLink>
|
|
40
|
+
* </NavMenuColumn>
|
|
41
|
+
* </NavMenuItem>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function NavMenuItem({ children, label }: NavMenuItemProps): import("react").JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* One column of links inside a `NavMenuItem` panel.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <NavMenuColumn title="Sales">
|
|
51
|
+
* <MenuNavLink to="/reports/monthly">Monthly</MenuNavLink>
|
|
52
|
+
* <MenuNavLink to="/reports/yearly">Yearly</MenuNavLink>
|
|
53
|
+
* </NavMenuColumn>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function NavMenuColumn({ children, title }: NavMenuColumnProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { t as e } from "../Link-9mNYgEzY.js";
|
|
2
|
+
import { t } from "../classNames-x6JVYA2t.js";
|
|
3
|
+
import { a as n, i as r, n as i, r as a, t as o } from "../Dropdown-BZKzAbKB.js";
|
|
4
|
+
import { t as s } from "../Button-T8UI5igR.js";
|
|
5
|
+
import { cloneElement as c, createElement as l, useEffect as u, useId as d, useRef as f, useState as p } from "react";
|
|
6
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
7
|
+
import { NavLink as _ } from "react-router";
|
|
8
|
+
// src/navigation/Menu.tsx
|
|
9
|
+
var v = {
|
|
10
|
+
xs: "menu-xs",
|
|
11
|
+
sm: "menu-sm",
|
|
12
|
+
md: "",
|
|
13
|
+
lg: "menu-lg"
|
|
14
|
+
};
|
|
15
|
+
function y({ children: e, className: n, horizontal: r = !1, size: i = "md" }) {
|
|
16
|
+
return /* @__PURE__ */ h("ul", {
|
|
17
|
+
className: t("menu", r ? "menu-horizontal" : void 0, v[i], n),
|
|
18
|
+
children: e
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function b(e) {
|
|
22
|
+
return e.type === "a" || e.props.href !== void 0 || e.props.to !== void 0;
|
|
23
|
+
}
|
|
24
|
+
function x(e, t) {
|
|
25
|
+
let { href: n, onClick: r, to: i, ...a } = e.props;
|
|
26
|
+
return l("a", {
|
|
27
|
+
...a,
|
|
28
|
+
"aria-disabled": !0,
|
|
29
|
+
className: t,
|
|
30
|
+
role: "link"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function S({ children: e, active: n = !1, disabled: r = !1 }) {
|
|
34
|
+
let i = t(e.props.className, n ? "menu-active" : void 0, r ? "menu-disabled" : void 0);
|
|
35
|
+
return r && b(e) ? /* @__PURE__ */ h("li", { children: x(e, i) }) : r ? /* @__PURE__ */ h("li", { children: c(e, {
|
|
36
|
+
className: i,
|
|
37
|
+
disabled: !0
|
|
38
|
+
}) }) : /* @__PURE__ */ h("li", { children: c(e, { className: i || void 0 }) });
|
|
39
|
+
}
|
|
40
|
+
function C(e) {
|
|
41
|
+
return /* @__PURE__ */ h("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
...e
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function w({ children: e }) {
|
|
47
|
+
return /* @__PURE__ */ h("li", {
|
|
48
|
+
className: "menu-title",
|
|
49
|
+
children: e
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function T({ children: e, end: t = !1, to: n }) {
|
|
53
|
+
return /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(_, {
|
|
54
|
+
className: ({ isActive: e }) => e ? "menu-active" : "",
|
|
55
|
+
end: t,
|
|
56
|
+
to: n,
|
|
57
|
+
children: e
|
|
58
|
+
}) });
|
|
59
|
+
}
|
|
60
|
+
// src/navigation/NavMenu.tsx
|
|
61
|
+
function E(e) {
|
|
62
|
+
return `${e}-${d().replaceAll(/\W/g, "")}`;
|
|
63
|
+
}
|
|
64
|
+
var D = "a, button:not([popovertarget])";
|
|
65
|
+
function O() {
|
|
66
|
+
let [e, t] = p(!1);
|
|
67
|
+
return {
|
|
68
|
+
open: e,
|
|
69
|
+
onToggle: (e) => t(e.newState === "open")
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function k(e) {
|
|
73
|
+
u(() => {
|
|
74
|
+
let t = e.current;
|
|
75
|
+
if (!t) return;
|
|
76
|
+
let n = (e) => {
|
|
77
|
+
e.target instanceof Element && e.target.closest(D) && t.hidePopover?.();
|
|
78
|
+
};
|
|
79
|
+
return t.addEventListener("click", n), () => t.removeEventListener("click", n);
|
|
80
|
+
}, [e]);
|
|
81
|
+
}
|
|
82
|
+
function A({ children: e, className: r, label: i }) {
|
|
83
|
+
let o = E("megamenu"), c = f(null), l = O();
|
|
84
|
+
return k(c), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
|
|
85
|
+
"aria-expanded": l.open,
|
|
86
|
+
"aria-haspopup": "true",
|
|
87
|
+
className: "md:hidden",
|
|
88
|
+
popoverTarget: o,
|
|
89
|
+
size: "sm",
|
|
90
|
+
tone: "ghost",
|
|
91
|
+
children: i
|
|
92
|
+
}), /* @__PURE__ */ g("div", {
|
|
93
|
+
className: t("megamenu max-md:megamenu-vertical md:gap-1 md:text-inherit max-md:rounded-box max-md:border max-md:border-base-300 max-md:bg-base-100 max-md:bg-linear-to-b max-md:from-(--surface-highlight) max-md:to-transparent max-md:fixed max-md:inset-x-3 max-md:[position-area:none] max-md:top-[4.9rem] max-md:bottom-auto max-md:m-0 max-md:w-auto max-md:p-2 max-md:text-base-content max-md:shadow-(--elevation-3)", n, a, r),
|
|
94
|
+
id: o,
|
|
95
|
+
onToggle: l.onToggle,
|
|
96
|
+
popover: "auto",
|
|
97
|
+
ref: c,
|
|
98
|
+
children: [/* @__PURE__ */ h("span", { className: "megamenu-active" }), e]
|
|
99
|
+
})] });
|
|
100
|
+
}
|
|
101
|
+
function j({ children: e, label: n }) {
|
|
102
|
+
let a = E("megamenu-item"), o = f(null), s = O();
|
|
103
|
+
return k(o), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("button", {
|
|
104
|
+
"aria-expanded": s.open,
|
|
105
|
+
"aria-haspopup": "true",
|
|
106
|
+
className: "md:h-auto md:gap-2 md:border-0 md:px-3 md:py-1.5 md:text-inherit max-md:w-full max-md:justify-start max-md:pointer-events-none max-md:mt-1 max-md:h-auto max-md:min-h-0 max-md:rounded-none max-md:border-0 max-md:border-t max-md:border-base-300 max-md:px-4 max-md:py-2 max-md:shadow-none max-md:text-xs max-md:font-bold max-md:tracking-wider max-md:uppercase max-md:text-(--ink-muted)",
|
|
107
|
+
popoverTarget: a,
|
|
108
|
+
type: "button",
|
|
109
|
+
children: n
|
|
110
|
+
}), /* @__PURE__ */ h("div", {
|
|
111
|
+
className: t("text-base-content max-md:w-full md:[position-area:block-end_span-inline-start] md:bg-linear-to-b md:from-(--surface-highlight) md:to-transparent md:shadow-(--elevation-3)", r, i),
|
|
112
|
+
id: a,
|
|
113
|
+
onToggle: s.onToggle,
|
|
114
|
+
popover: "auto",
|
|
115
|
+
ref: o,
|
|
116
|
+
children: /* @__PURE__ */ h("div", {
|
|
117
|
+
className: "flex max-md:flex-col max-md:items-stretch items-start gap-4 p-2 max-md:p-0",
|
|
118
|
+
children: e
|
|
119
|
+
})
|
|
120
|
+
})] });
|
|
121
|
+
}
|
|
122
|
+
function M({ children: e, title: t }) {
|
|
123
|
+
return /* @__PURE__ */ g(y, {
|
|
124
|
+
className: "w-full",
|
|
125
|
+
children: [t ? /* @__PURE__ */ h(w, { children: t }) : null, e]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export { o as Dropdown, e as Link, y as Menu, C as MenuButton, S as MenuItem, T as MenuNavLink, w as MenuTitle, A as NavMenu, M as NavMenuColumn, j as NavMenuItem };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const POPOVER_FADE = "opacity-0 transition-[opacity,scale,translate,display,overlay] transition-discrete duration-(--motion-base) motion-reduce:transition-none [&:popover-open]:opacity-100 starting:[&:popover-open]:opacity-0";
|
|
2
|
+
export declare const POPOVER_BACKDROP = "backdrop:bg-base-content/0 backdrop:transition-[background-color,display,overlay] backdrop:transition-discrete backdrop:duration-(--motion-base) motion-reduce:backdrop:transition-none [&:popover-open]:backdrop:bg-(--overlay-backdrop) starting:[&:popover-open]:backdrop:bg-base-content/0";
|
|
3
|
+
export declare const POPOVER_FADE_MOBILE = "max-md:opacity-0 max-md:transition-[opacity,scale,translate,display,overlay] max-md:transition-discrete max-md:duration-(--motion-base) max-md:motion-reduce:transition-none max-md:[&:popover-open]:opacity-100 max-md:starting:[&:popover-open]:opacity-0";
|
|
4
|
+
export declare const POPOVER_BACKDROP_MOBILE = "max-md:backdrop:bg-base-content/0 max-md:backdrop:transition-[background-color,display,overlay] max-md:backdrop:transition-discrete max-md:backdrop:duration-(--motion-base) max-md:motion-reduce:backdrop:transition-none max-md:[&:popover-open]:backdrop:bg-(--overlay-backdrop) max-md:starting:[&:popover-open]:backdrop:bg-base-content/0";
|
|
5
|
+
export declare const POPOVER_FADE_DESKTOP = "md:opacity-0 md:transition-[opacity,scale,translate,display,overlay] md:transition-discrete md:duration-(--motion-base) md:motion-reduce:transition-none md:[&:popover-open]:opacity-100 md:starting:[&:popover-open]:opacity-0";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { To } from 'react-router';
|
|
2
|
+
export interface ConsentBannerProps {
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
policyLink: {
|
|
6
|
+
label: string;
|
|
7
|
+
to: To;
|
|
8
|
+
};
|
|
9
|
+
settingsLabel: string;
|
|
10
|
+
rejectLabel: string;
|
|
11
|
+
acceptLabel: string;
|
|
12
|
+
onSettings: () => void;
|
|
13
|
+
onReject: () => void;
|
|
14
|
+
onAccept: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Non-modal consent prompt pinned to the bottom of the viewport. The page stays usable behind it.
|
|
18
|
+
* z-[1200] sits above toasts (z-[1100]) and typical map-library overlays (z-[1000]).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ConsentBanner
|
|
23
|
+
* acceptLabel="Accept"
|
|
24
|
+
* body="We use cookies to measure page performance."
|
|
25
|
+
* onAccept={accept}
|
|
26
|
+
* onReject={reject}
|
|
27
|
+
* onSettings={openSettings}
|
|
28
|
+
* policyLink={{ label: 'Privacy policy', to: '/privacy' }}
|
|
29
|
+
* rejectLabel="Reject"
|
|
30
|
+
* settingsLabel="Settings"
|
|
31
|
+
* title="Cookies"
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function ConsentBanner({ title, body, policyLink, settingsLabel, rejectLabel, acceptLabel, onSettings, onReject, onAccept, }: ConsentBannerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConsentBanner';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { To } from 'react-router';
|
|
2
|
+
export interface ConsentSettingsProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Current saved value of the optional usage-statistics switch. */
|
|
5
|
+
rumEnabled: boolean;
|
|
6
|
+
/** Receives the switch value; the caller decides when to close. */
|
|
7
|
+
onSave: (rum: boolean) => void;
|
|
8
|
+
onAcceptAll: () => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
title: string;
|
|
11
|
+
intro: string;
|
|
12
|
+
necessaryLabel: string;
|
|
13
|
+
necessaryDescription: string;
|
|
14
|
+
rumLabel: string;
|
|
15
|
+
rumDescription: string;
|
|
16
|
+
saveLabel: string;
|
|
17
|
+
acceptAllLabel: string;
|
|
18
|
+
closeLabel: string;
|
|
19
|
+
policyLink: {
|
|
20
|
+
label: string;
|
|
21
|
+
to: To;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Consent preferences dialog. The optional switch stays local until Save, and reopening resets it to `rumEnabled`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <ConsentSettings
|
|
30
|
+
* acceptAllLabel="Accept all"
|
|
31
|
+
* closeLabel="Close"
|
|
32
|
+
* intro="Choose which categories we may use."
|
|
33
|
+
* necessaryDescription="Required for the site to work."
|
|
34
|
+
* necessaryLabel="Necessary"
|
|
35
|
+
* onAcceptAll={acceptAll}
|
|
36
|
+
* onClose={close}
|
|
37
|
+
* onSave={saveRum}
|
|
38
|
+
* open={isOpen}
|
|
39
|
+
* policyLink={{ label: 'Privacy policy', to: '/privacy' }}
|
|
40
|
+
* rumDescription="Helps us understand page performance."
|
|
41
|
+
* rumEnabled={rumEnabled}
|
|
42
|
+
* rumLabel="Usage statistics"
|
|
43
|
+
* saveLabel="Save"
|
|
44
|
+
* title="Privacy settings"
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function ConsentSettings({ open, rumEnabled, onSave, onAcceptAll, onClose, title, intro, necessaryLabel, necessaryDescription, rumLabel, rumDescription, saveLabel, acceptAllLabel, closeLabel, policyLink, }: ConsentSettingsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConsentSettings';
|