@lab206/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +114 -0
- package/README.md +6 -0
- package/dist/components/Accordion.d.ts +25 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +123 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/Alert.d.ts +17 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +59 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/AspectRatio.d.ts +13 -0
- package/dist/components/AspectRatio.d.ts.map +1 -0
- package/dist/components/AspectRatio.js +38 -0
- package/dist/components/AspectRatio.js.map +1 -0
- package/dist/components/Avatar.d.ts +17 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +57 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +12 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +62 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Breadcrumb.d.ts +16 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb.js +76 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Button.d.ts +28 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +110 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +18 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +57 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +107 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Chip.d.ts +18 -0
- package/dist/components/Chip.d.ts.map +1 -0
- package/dist/components/Chip.js +103 -0
- package/dist/components/Chip.js.map +1 -0
- package/dist/components/Code.d.ts +12 -0
- package/dist/components/Code.d.ts.map +1 -0
- package/dist/components/Code.js +57 -0
- package/dist/components/Code.js.map +1 -0
- package/dist/components/Collapse.d.ts +15 -0
- package/dist/components/Collapse.d.ts.map +1 -0
- package/dist/components/Collapse.js +49 -0
- package/dist/components/Collapse.js.map +1 -0
- package/dist/components/Combobox.d.ts +47 -0
- package/dist/components/Combobox.d.ts.map +1 -0
- package/dist/components/Combobox.js +325 -0
- package/dist/components/Combobox.js.map +1 -0
- package/dist/components/Command.d.ts +42 -0
- package/dist/components/Command.d.ts.map +1 -0
- package/dist/components/Command.js +263 -0
- package/dist/components/Command.js.map +1 -0
- package/dist/components/Container.d.ts +11 -0
- package/dist/components/Container.d.ts.map +1 -0
- package/dist/components/Container.js +38 -0
- package/dist/components/Container.js.map +1 -0
- package/dist/components/Dialog.d.ts +26 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog.js +159 -0
- package/dist/components/Dialog.js.map +1 -0
- package/dist/components/Divider.d.ts +10 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +52 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Drawer.d.ts +19 -0
- package/dist/components/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer.js +131 -0
- package/dist/components/Drawer.js.map +1 -0
- package/dist/components/Empty.d.ts +17 -0
- package/dist/components/Empty.d.ts.map +1 -0
- package/dist/components/Empty.js +51 -0
- package/dist/components/Empty.js.map +1 -0
- package/dist/components/Field.d.ts +27 -0
- package/dist/components/Field.d.ts.map +1 -0
- package/dist/components/Field.js +153 -0
- package/dist/components/Field.js.map +1 -0
- package/dist/components/Grid.d.ts +13 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/Grid.js +44 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Input.d.ts +55 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +113 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Kbd.d.ts +10 -0
- package/dist/components/Kbd.d.ts.map +1 -0
- package/dist/components/Kbd.js +41 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/Label.d.ts +13 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Label.js +34 -0
- package/dist/components/Label.js.map +1 -0
- package/dist/components/Link.d.ts +18 -0
- package/dist/components/Link.d.ts.map +1 -0
- package/dist/components/Link.js +41 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/List.d.ts +22 -0
- package/dist/components/List.d.ts.map +1 -0
- package/dist/components/List.js +157 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/Menu.d.ts +28 -0
- package/dist/components/Menu.d.ts.map +1 -0
- package/dist/components/Menu.js +126 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/NumberInput.d.ts +27 -0
- package/dist/components/NumberInput.d.ts.map +1 -0
- package/dist/components/NumberInput.js +92 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/Pagination.d.ts +13 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +104 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Popover.d.ts +26 -0
- package/dist/components/Popover.d.ts.map +1 -0
- package/dist/components/Popover.js +165 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Progress.d.ts +15 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/Progress.js +63 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/Radio.d.ts +25 -0
- package/dist/components/Radio.d.ts.map +1 -0
- package/dist/components/Radio.js +95 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/ScrollArea.d.ts +13 -0
- package/dist/components/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea.js +33 -0
- package/dist/components/ScrollArea.js.map +1 -0
- package/dist/components/Select.d.ts +34 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +108 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Skeleton.d.ts +18 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +86 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Slider.d.ts +26 -0
- package/dist/components/Slider.d.ts.map +1 -0
- package/dist/components/Slider.js +113 -0
- package/dist/components/Slider.js.map +1 -0
- package/dist/components/Spinner.d.ts +12 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +44 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Stack.d.ts +21 -0
- package/dist/components/Stack.d.ts.map +1 -0
- package/dist/components/Stack.js +48 -0
- package/dist/components/Stack.js.map +1 -0
- package/dist/components/Stat.d.ts +23 -0
- package/dist/components/Stat.d.ts.map +1 -0
- package/dist/components/Stat.js +115 -0
- package/dist/components/Stat.js.map +1 -0
- package/dist/components/Steps.d.ts +20 -0
- package/dist/components/Steps.d.ts.map +1 -0
- package/dist/components/Steps.js +126 -0
- package/dist/components/Steps.js.map +1 -0
- package/dist/components/Switch.d.ts +23 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +108 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Table.d.ts +27 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +112 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.d.ts +27 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs.js +171 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Text.d.ts +17 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +48 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/components/Textarea.d.ts +32 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea.js +91 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/Timeline.d.ts +17 -0
- package/dist/components/Timeline.d.ts.map +1 -0
- package/dist/components/Timeline.js +95 -0
- package/dist/components/Timeline.js.map +1 -0
- package/dist/components/Toast.d.ts +36 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +143 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/ToggleGroup.d.ts +25 -0
- package/dist/components/ToggleGroup.d.ts.map +1 -0
- package/dist/components/ToggleGroup.js +103 -0
- package/dist/components/ToggleGroup.js.map +1 -0
- package/dist/components/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +141 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Transition.d.ts +22 -0
- package/dist/components/Transition.d.ts.map +1 -0
- package/dist/components/Transition.js +139 -0
- package/dist/components/Transition.js.map +1 -0
- package/dist/density.d.ts +21 -0
- package/dist/density.d.ts.map +1 -0
- package/dist/density.js +31 -0
- package/dist/density.js.map +1 -0
- package/dist/dev.d.ts +27 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +77 -0
- package/dist/dev.js.map +1 -0
- package/dist/focusTrap.d.ts +6 -0
- package/dist/focusTrap.d.ts.map +1 -0
- package/dist/focusTrap.js +55 -0
- package/dist/focusTrap.js.map +1 -0
- package/dist/form.d.ts +125 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +192 -0
- package/dist/form.js.map +1 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.d.ts +29 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +43 -0
- package/dist/motion.js.map +1 -0
- package/dist/overlay.d.ts +63 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +172 -0
- package/dist/overlay.js.map +1 -0
- package/dist/palette.d.ts +20 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +52 -0
- package/dist/palette.js.map +1 -0
- package/dist/reactive.d.ts +25 -0
- package/dist/reactive.d.ts.map +1 -0
- package/dist/reactive.js +43 -0
- package/dist/reactive.js.map +1 -0
- package/dist/rovingFocus.d.ts +36 -0
- package/dist/rovingFocus.d.ts.map +1 -0
- package/dist/rovingFocus.js +127 -0
- package/dist/rovingFocus.js.map +1 -0
- package/dist/size-entries/form-kit.d.ts +12 -0
- package/dist/size-entries/form-kit.d.ts.map +1 -0
- package/dist/size-entries/form-kit.js +12 -0
- package/dist/size-entries/form-kit.js.map +1 -0
- package/dist/styles.d.ts +29 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +53 -0
- package/dist/styles.js.map +1 -0
- package/dist/theme.d.ts +22 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +32 -0
- package/dist/theme.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +24 -0
- package/dist/utils.js.map +1 -0
- package/package.json +71 -0
- package/src/components/Accordion.tsx +194 -0
- package/src/components/Alert.tsx +88 -0
- package/src/components/AspectRatio.tsx +64 -0
- package/src/components/Avatar.tsx +89 -0
- package/src/components/Badge.tsx +84 -0
- package/src/components/Breadcrumb.tsx +116 -0
- package/src/components/Button.tsx +148 -0
- package/src/components/Card.tsx +92 -0
- package/src/components/Checkbox.tsx +143 -0
- package/src/components/Chip.tsx +153 -0
- package/src/components/Code.tsx +71 -0
- package/src/components/Collapse.tsx +76 -0
- package/src/components/Combobox.tsx +438 -0
- package/src/components/Command.tsx +380 -0
- package/src/components/Container.tsx +58 -0
- package/src/components/Dialog.tsx +226 -0
- package/src/components/Divider.tsx +72 -0
- package/src/components/Drawer.tsx +191 -0
- package/src/components/Empty.tsx +86 -0
- package/src/components/Field.tsx +184 -0
- package/src/components/Grid.tsx +67 -0
- package/src/components/Input.tsx +169 -0
- package/src/components/Kbd.tsx +57 -0
- package/src/components/Label.tsx +54 -0
- package/src/components/Link.tsx +87 -0
- package/src/components/List.tsx +236 -0
- package/src/components/Menu.tsx +195 -0
- package/src/components/NumberInput.tsx +158 -0
- package/src/components/Pagination.tsx +153 -0
- package/src/components/Popover.tsx +219 -0
- package/src/components/Progress.tsx +108 -0
- package/src/components/Radio.tsx +161 -0
- package/src/components/ScrollArea.tsx +58 -0
- package/src/components/Select.tsx +128 -0
- package/src/components/Skeleton.tsx +117 -0
- package/src/components/Slider.tsx +175 -0
- package/src/components/Spinner.tsx +70 -0
- package/src/components/Stack.tsx +79 -0
- package/src/components/Stat.tsx +169 -0
- package/src/components/Steps.tsx +191 -0
- package/src/components/Switch.tsx +146 -0
- package/src/components/Table.tsx +168 -0
- package/src/components/Tabs.tsx +246 -0
- package/src/components/Text.tsx +69 -0
- package/src/components/Textarea.tsx +128 -0
- package/src/components/Timeline.tsx +150 -0
- package/src/components/Toast.tsx +221 -0
- package/src/components/ToggleGroup.tsx +161 -0
- package/src/components/Tooltip.tsx +187 -0
- package/src/components/Transition.tsx +155 -0
- package/src/density.ts +46 -0
- package/src/dev.ts +87 -0
- package/src/focusTrap.ts +61 -0
- package/src/form.ts +269 -0
- package/src/index.ts +243 -0
- package/src/motion.ts +62 -0
- package/src/overlay.ts +232 -0
- package/src/palette.ts +70 -0
- package/src/reactive.ts +54 -0
- package/src/rovingFocus.ts +171 -0
- package/src/size-entries/form-kit.ts +11 -0
- package/src/styles/base.css +70 -0
- package/src/styles/theme.css +14 -0
- package/src/styles/tokens.css +377 -0
- package/src/styles/utilities.css +216 -0
- package/src/styles.ts +52 -0
- package/src/theme.ts +48 -0
- package/src/utils.ts +25 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type KbdProps = {
|
|
2
|
+
class?: string | (() => string);
|
|
3
|
+
children?: unknown;
|
|
4
|
+
};
|
|
5
|
+
/** Keyboard key affordance for shortcuts and docs. */
|
|
6
|
+
export declare const Kbd: import("@lab206/dom").Component<{
|
|
7
|
+
class?: string | (() => string);
|
|
8
|
+
children?: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=Kbd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.d.ts","sourceRoot":"","sources":["../../src/components/Kbd.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkCF,sDAAsD;AACtD,eAAO,MAAM,GAAG;YArCN,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;eACpB,OAAO;EAmDlB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@lab206/dom/jsx-runtime";
|
|
2
|
+
import { component } from "@lab206/dom";
|
|
3
|
+
import { cx } from "../utils.js";
|
|
4
|
+
const styles = `
|
|
5
|
+
.pu-kbd {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
min-width: 1.4em;
|
|
10
|
+
padding: 0.12em 0.4em;
|
|
11
|
+
border-radius: 6px;
|
|
12
|
+
border: 1px solid var(--pu-color-border);
|
|
13
|
+
border-bottom-width: 2px;
|
|
14
|
+
background: var(--pu-color-surface-2);
|
|
15
|
+
color: var(--pu-color-text-muted);
|
|
16
|
+
font-family: var(--pu-font-mono);
|
|
17
|
+
font-size: 0.78em;
|
|
18
|
+
font-weight: var(--pu-font-semibold);
|
|
19
|
+
line-height: 1.3;
|
|
20
|
+
letter-spacing: 0.02em;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
box-shadow: var(--pu-shadow-xs);
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
let injected = false;
|
|
26
|
+
function ensureStyles() {
|
|
27
|
+
if (injected || typeof document === "undefined")
|
|
28
|
+
return;
|
|
29
|
+
injected = true;
|
|
30
|
+
const el = document.createElement("style");
|
|
31
|
+
el.setAttribute("data-pu-ui", "kbd");
|
|
32
|
+
el.textContent = styles;
|
|
33
|
+
document.head.appendChild(el);
|
|
34
|
+
}
|
|
35
|
+
/** Keyboard key affordance for shortcuts and docs. */
|
|
36
|
+
export const Kbd = component((raw) => {
|
|
37
|
+
ensureStyles();
|
|
38
|
+
const props = raw;
|
|
39
|
+
return (_jsx("kbd", { class: () => cx("pu-kbd", typeof props.class === "function" ? props.class() : props.class), children: props.children }));
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=Kbd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.js","sourceRoot":"","sources":["../../src/components/Kbd.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;CAoBd,CAAC;AAEF,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAS,YAAY;IACnB,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IACxD,QAAQ,GAAG,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACrC,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,GAAa,EAAE,EAAE;IAC7C,YAAY,EAAE,CAAC;IACf,MAAM,KAAK,GAAG,GAA+B,CAAC;IAC9C,OAAO,CACL,cACE,KAAK,EAAE,GAAG,EAAE,CACV,EAAE,CACA,QAAQ,EACR,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAChE,YAGF,KAAK,CAAC,QAAiB,GACpB,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type LabelProps = {
|
|
2
|
+
htmlFor?: string;
|
|
3
|
+
required?: boolean;
|
|
4
|
+
class?: string | (() => string);
|
|
5
|
+
children?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const Label: import("@lab206/dom").Component<{
|
|
8
|
+
htmlFor?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
class?: string | (() => string);
|
|
11
|
+
children?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../src/components/Label.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA4BF,eAAO,MAAM,KAAK;cAhCN,MAAM;eACL,OAAO;YACV,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;eACpB,OAAO;EA8ClB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@lab206/dom/jsx-runtime";
|
|
2
|
+
import { component, mergeProps } from "@lab206/dom";
|
|
3
|
+
import { cx } from "../utils.js";
|
|
4
|
+
const styles = `
|
|
5
|
+
.pu-label {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: baseline;
|
|
8
|
+
gap: 0.25rem;
|
|
9
|
+
font-size: var(--pu-label-size);
|
|
10
|
+
font-weight: var(--pu-font-semibold);
|
|
11
|
+
color: var(--pu-color-text);
|
|
12
|
+
line-height: 1.3;
|
|
13
|
+
}
|
|
14
|
+
.pu-label__req {
|
|
15
|
+
color: var(--pu-color-danger);
|
|
16
|
+
font-weight: var(--pu-font-bold);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
let injected = false;
|
|
20
|
+
function ensureStyles() {
|
|
21
|
+
if (injected || typeof document === "undefined")
|
|
22
|
+
return;
|
|
23
|
+
injected = true;
|
|
24
|
+
const el = document.createElement("style");
|
|
25
|
+
el.setAttribute("data-pu-ui", "label");
|
|
26
|
+
el.textContent = styles;
|
|
27
|
+
document.head.appendChild(el);
|
|
28
|
+
}
|
|
29
|
+
export const Label = component((raw) => {
|
|
30
|
+
ensureStyles();
|
|
31
|
+
const props = mergeProps({}, raw);
|
|
32
|
+
return (_jsxs("label", { class: () => cx("pu-label", typeof props.class === "function" ? props.class() : props.class), for: props.htmlFor, children: [props.children, props.required ? _jsx("span", { class: "pu-label__req", "aria-hidden": "true", children: "*" }) : null] }));
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../src/components/Label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AASjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;CAcd,CAAC;AAEF,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAS,YAAY;IACnB,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IACxD,QAAQ,GAAG,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvC,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,GAAe,EAAE,EAAE;IACjD,YAAY,EAAE,CAAC;IACf,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,EAAE,GAAG,CAA+B,CAAC;IAChE,OAAO,CACL,iBACE,KAAK,EAAE,GAAG,EAAE,CACV,EAAE,CACA,UAAU,EACV,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAChE,EAEH,GAAG,EAAE,KAAK,CAAC,OAAO,aAEjB,KAAK,CAAC,QAAiB,EACvB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAM,KAAK,EAAC,eAAe,iBAAa,MAAM,kBAAS,CAAC,CAAC,CAAC,IAAI,IAC1E,CACT,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type LinkProps = {
|
|
2
|
+
href?: string;
|
|
3
|
+
external?: boolean;
|
|
4
|
+
muted?: boolean;
|
|
5
|
+
class?: string | (() => string);
|
|
6
|
+
onClick?: (e: MouseEvent) => void;
|
|
7
|
+
children?: unknown;
|
|
8
|
+
};
|
|
9
|
+
/** Styled anchor (or button-like when no href). */
|
|
10
|
+
export declare const Link: import("@lab206/dom").Component<{
|
|
11
|
+
href?: string;
|
|
12
|
+
external?: boolean;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
class?: string | (() => string);
|
|
15
|
+
onClick?: (e: MouseEvent) => void;
|
|
16
|
+
children?: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAiCF,mDAAmD;AACnD,eAAO,MAAM,IAAI;WAxCR,MAAM;eACF,OAAO;YACV,OAAO;YACP,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;cACrB,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;eACtB,OAAO;EA4ElB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@lab206/dom/jsx-runtime";
|
|
2
|
+
import { component } from "@lab206/dom";
|
|
3
|
+
import { cx } from "../utils.js";
|
|
4
|
+
import { createStyleSheet } from "../styles.js";
|
|
5
|
+
const ensure = createStyleSheet("link", `
|
|
6
|
+
.pu-link {
|
|
7
|
+
color: var(--pu-color-accent);
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
font-weight: var(--pu-font-medium);
|
|
10
|
+
transition: color var(--pu-duration) var(--pu-ease);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.pu-link:hover {
|
|
14
|
+
text-decoration: underline;
|
|
15
|
+
text-underline-offset: 2px;
|
|
16
|
+
}
|
|
17
|
+
.pu-link:focus-visible {
|
|
18
|
+
outline: none;
|
|
19
|
+
border-radius: 2px;
|
|
20
|
+
box-shadow:
|
|
21
|
+
0 0 0 2px var(--pu-color-surface),
|
|
22
|
+
0 0 0 4px color-mix(in srgb, var(--pu-color-focus) 55%, transparent);
|
|
23
|
+
}
|
|
24
|
+
.pu-link--muted {
|
|
25
|
+
color: var(--pu-color-text-muted);
|
|
26
|
+
font-weight: var(--pu-font-normal);
|
|
27
|
+
}
|
|
28
|
+
.pu-link--muted:hover {
|
|
29
|
+
color: var(--pu-color-text);
|
|
30
|
+
}
|
|
31
|
+
`);
|
|
32
|
+
/** Styled anchor (or button-like when no href). */
|
|
33
|
+
export const Link = component((raw) => {
|
|
34
|
+
ensure();
|
|
35
|
+
const props = raw;
|
|
36
|
+
if (props.href) {
|
|
37
|
+
return (_jsx("a", { class: () => cx("pu-link", props.muted && "pu-link--muted", typeof props.class === "function" ? props.class() : props.class), href: props.href, target: props.external ? "_blank" : undefined, rel: props.external ? "noopener noreferrer" : undefined, onClick: props.onClick, ref: (el) => ensure(el.ownerDocument), children: props.children }));
|
|
38
|
+
}
|
|
39
|
+
return (_jsx("button", { type: "button", class: () => cx("pu-link", props.muted && "pu-link--muted", typeof props.class === "function" ? props.class() : props.class), onClick: props.onClick, ref: (el) => ensure(el.ownerDocument), children: props.children }));
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWhD,MAAM,MAAM,GAAG,gBAAgB,CAC7B,MAAM,EACN;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BD,CACA,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,GAAc,EAAE,EAAE;IAC/C,MAAM,EAAE,CAAC;IACT,MAAM,KAAK,GAAG,GAAgC,CAAC;IAE/C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CACL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Props = {
|
|
9
|
+
items: ListItemData[] | (() => ListItemData[]);
|
|
10
|
+
/** Selected id (optional highlight) */
|
|
11
|
+
value?: string | (() => string);
|
|
12
|
+
onSelect?: (id: string) => void;
|
|
13
|
+
class?: string | (() => string);
|
|
14
|
+
};
|
|
15
|
+
/** Interactive list group with arrow-key roving focus. */
|
|
16
|
+
export declare const List: import("@lab206/dom").Component<{
|
|
17
|
+
items: ListItemData[] | (() => ListItemData[]);
|
|
18
|
+
value?: string | (() => string);
|
|
19
|
+
onSelect?: (id: string) => void;
|
|
20
|
+
class?: string | (() => string);
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=List.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/components/List.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC;IAC/C,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;CACjC,CAAC;AAmFF,0DAA0D;AAC1D,eAAO,MAAM,IAAI;WAzFR,YAAY,EAAE,GAAG,CAAC,MAAM,YAAY,EAAE,CAAC;YAEtC,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;eACpB,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;YACvB,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;EAoN/B,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@lab206/dom/jsx-runtime";
|
|
2
|
+
import { For, component } from "@lab206/dom";
|
|
3
|
+
import { cx } from "../utils.js";
|
|
4
|
+
import { createStyleSheet } from "../styles.js";
|
|
5
|
+
import { applyRovingTabIndex, focusRovingItem, handleRovingKeydown, listRovingItems, } from "../rovingFocus.js";
|
|
6
|
+
const OPT_SEL = '[role="option"]:not([disabled])';
|
|
7
|
+
const ensure = createStyleSheet("list", `
|
|
8
|
+
.pu-list {
|
|
9
|
+
list-style: none;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0.25rem;
|
|
12
|
+
border: 1px solid var(--pu-color-border);
|
|
13
|
+
border-radius: var(--pu-radius-lg);
|
|
14
|
+
background: var(--pu-color-surface);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
.pu-list__item {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
gap: 0.75rem;
|
|
22
|
+
width: 100%;
|
|
23
|
+
appearance: none;
|
|
24
|
+
border: 0;
|
|
25
|
+
background: transparent;
|
|
26
|
+
text-align: left;
|
|
27
|
+
font: inherit;
|
|
28
|
+
padding: 0.7rem 0.85rem;
|
|
29
|
+
border-radius: var(--pu-radius-md);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
color: var(--pu-color-text);
|
|
32
|
+
transition:
|
|
33
|
+
background var(--pu-duration) var(--pu-ease-out),
|
|
34
|
+
transform var(--pu-duration-fast) var(--pu-ease-out),
|
|
35
|
+
box-shadow var(--pu-duration) var(--pu-ease-out);
|
|
36
|
+
}
|
|
37
|
+
.pu-list__item:hover:not(:disabled) {
|
|
38
|
+
background: var(--pu-color-surface-2);
|
|
39
|
+
transform: translateX(2px);
|
|
40
|
+
}
|
|
41
|
+
.pu-list__item.is-selected {
|
|
42
|
+
background: color-mix(in srgb, var(--pu-color-accent) 12%, transparent);
|
|
43
|
+
box-shadow: inset 2px 0 0 var(--pu-color-accent);
|
|
44
|
+
}
|
|
45
|
+
.pu-list__item:focus-visible:not(:disabled) {
|
|
46
|
+
outline: none;
|
|
47
|
+
background: var(--pu-color-surface-2);
|
|
48
|
+
box-shadow:
|
|
49
|
+
inset 2px 0 0 var(--pu-color-accent),
|
|
50
|
+
0 0 0 2px color-mix(in srgb, var(--pu-color-focus) 40%, transparent);
|
|
51
|
+
}
|
|
52
|
+
.pu-list__item:disabled {
|
|
53
|
+
opacity: 0.45;
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
}
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
.pu-list__item { transition: none; }
|
|
58
|
+
.pu-list__item:hover:not(:disabled) { transform: none; }
|
|
59
|
+
}
|
|
60
|
+
.pu-list__main {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 0.15rem;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
.pu-list__label {
|
|
67
|
+
font-size: var(--pu-text-sm);
|
|
68
|
+
font-weight: var(--pu-font-medium);
|
|
69
|
+
}
|
|
70
|
+
.pu-list__desc {
|
|
71
|
+
font-size: var(--pu-text-xs);
|
|
72
|
+
color: var(--pu-color-text-muted);
|
|
73
|
+
line-height: 1.4;
|
|
74
|
+
}
|
|
75
|
+
.pu-list__meta {
|
|
76
|
+
font-size: var(--pu-text-xs);
|
|
77
|
+
color: var(--pu-color-text-muted);
|
|
78
|
+
font-variant-numeric: tabular-nums;
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
}
|
|
81
|
+
`);
|
|
82
|
+
/** Interactive list group with arrow-key roving focus. */
|
|
83
|
+
export const List = component((raw) => {
|
|
84
|
+
ensure();
|
|
85
|
+
const props = raw;
|
|
86
|
+
let listEl = null;
|
|
87
|
+
const getItems = () => typeof props.items === "function"
|
|
88
|
+
? props.items()
|
|
89
|
+
: (props.items ?? []);
|
|
90
|
+
const selected = () => typeof props.value === "function"
|
|
91
|
+
? props.value()
|
|
92
|
+
: (props.value ?? "");
|
|
93
|
+
const syncTabIndex = () => {
|
|
94
|
+
if (!listEl)
|
|
95
|
+
return;
|
|
96
|
+
const opts = listRovingItems(listEl, OPT_SEL);
|
|
97
|
+
const idx = opts.findIndex((el) => el.getAttribute("data-list-id") === selected());
|
|
98
|
+
applyRovingTabIndex(opts, idx >= 0 ? idx : 0);
|
|
99
|
+
};
|
|
100
|
+
return (_jsx("ul", { class: () => cx("pu-list", typeof props.class === "function" ? props.class() : props.class), role: "listbox", tabindex: 0, "aria-activedescendant": () => {
|
|
101
|
+
const id = selected();
|
|
102
|
+
return id ? `pu-list-opt-${id}` : undefined;
|
|
103
|
+
}, ref: (el) => {
|
|
104
|
+
listEl = el;
|
|
105
|
+
ensure(el.ownerDocument);
|
|
106
|
+
window.setTimeout(syncTabIndex, 0);
|
|
107
|
+
}, onFocus: () => {
|
|
108
|
+
// When listbox receives focus, move into an option
|
|
109
|
+
if (!listEl)
|
|
110
|
+
return;
|
|
111
|
+
if (listEl.contains(listEl.ownerDocument.activeElement) &&
|
|
112
|
+
listEl.ownerDocument.activeElement !== listEl) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const opts = listRovingItems(listEl, OPT_SEL);
|
|
116
|
+
const idx = opts.findIndex((el) => el.getAttribute("data-list-id") === selected());
|
|
117
|
+
focusRovingItem(opts, idx >= 0 ? idx : 0);
|
|
118
|
+
}, onKeyDown: (e) => {
|
|
119
|
+
if (!listEl)
|
|
120
|
+
return;
|
|
121
|
+
handleRovingKeydown(e, listEl, OPT_SEL, {
|
|
122
|
+
orientation: "vertical",
|
|
123
|
+
loop: true,
|
|
124
|
+
onActivate: (el) => {
|
|
125
|
+
const id = el.getAttribute("data-list-id");
|
|
126
|
+
if (id)
|
|
127
|
+
props.onSelect?.(id);
|
|
128
|
+
},
|
|
129
|
+
onMove: (el) => {
|
|
130
|
+
// Optional: live-select on move — keep selection on activate only
|
|
131
|
+
void el;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}, children: _jsx(For, { each: getItems, children: (item) => (_jsx("li", { role: "none", style: { display: "block", margin: 0, padding: 0 }, children: _jsxs("button", { type: "button", role: "option", tabindex: -1, id: () => `pu-list-opt-${item().id}`, "data-list-id": () => item().id, class: () => cx("pu-list__item", selected() === item().id && "is-selected"), "aria-selected": () => selected() === item().id, disabled: () => !!item().disabled, onClick: () => props.onSelect?.(item().id), onFocus: () => {
|
|
135
|
+
if (!listEl)
|
|
136
|
+
return;
|
|
137
|
+
const opts = listRovingItems(listEl, OPT_SEL);
|
|
138
|
+
const idx = opts.findIndex((el) => el.getAttribute("data-list-id") === item().id);
|
|
139
|
+
if (idx >= 0)
|
|
140
|
+
applyRovingTabIndex(opts, idx);
|
|
141
|
+
}, children: [_jsxs("span", { class: "pu-list__main", children: [_jsx("span", { class: "pu-list__label", children: () => item().label }), () => item().description
|
|
142
|
+
? (() => {
|
|
143
|
+
const s = document.createElement("span");
|
|
144
|
+
s.className = "pu-list__desc";
|
|
145
|
+
s.textContent = item().description;
|
|
146
|
+
return s;
|
|
147
|
+
})()
|
|
148
|
+
: null] }), () => item().meta
|
|
149
|
+
? (() => {
|
|
150
|
+
const s = document.createElement("span");
|
|
151
|
+
s.className = "pu-list__meta";
|
|
152
|
+
s.textContent = item().meta;
|
|
153
|
+
return s;
|
|
154
|
+
})()
|
|
155
|
+
: null] }) })) }) }));
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/components/List.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,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,EAAE;4BACN,CAAC,CAAC,IAAI,IAEH,GACN,CACN,GACG,GACH,CACN,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type MenuItem = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
danger?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type MenuProps = {
|
|
8
|
+
/** Items shown in the menu */
|
|
9
|
+
items: MenuItem[] | (() => MenuItem[]);
|
|
10
|
+
/** Trigger node (Button recommended) */
|
|
11
|
+
trigger: unknown;
|
|
12
|
+
/** Called when an enabled item is chosen */
|
|
13
|
+
onSelect?: (id: string) => void;
|
|
14
|
+
align?: "start" | "center" | "end";
|
|
15
|
+
class?: string | (() => string);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Action menu built on Popover.
|
|
19
|
+
* Arrow / Home / End roving focus · Enter / Space select · Esc closes (Popover).
|
|
20
|
+
*/
|
|
21
|
+
export declare const Menu: import("@lab206/dom").Component<{
|
|
22
|
+
items: MenuItem[] | (() => MenuItem[]);
|
|
23
|
+
trigger: unknown;
|
|
24
|
+
onSelect?: (id: string) => void;
|
|
25
|
+
align?: "start" | "center" | "end";
|
|
26
|
+
class?: string | (() => string);
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../src/components/Menu.tsx"],"names":[],"mappings":"AAWA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,8BAA8B;IAC9B,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAC;IACvC,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;CACjC,CAAC;AAoEF;;;GAGG;AACH,eAAO,MAAM,IAAI;WA/ER,QAAQ,EAAE,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAC;aAE7B,OAAO;eAEL,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;YACvB,OAAO,GAAG,QAAQ,GAAG,KAAK;YAC1B,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC;EAwK/B,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@lab206/dom/jsx-runtime";
|
|
2
|
+
import { signal, effect } from "@lab206/core";
|
|
3
|
+
import { For, component, mergeProps } from "@lab206/dom";
|
|
4
|
+
import { cx } from "../utils.js";
|
|
5
|
+
import { Popover } from "./Popover.js";
|
|
6
|
+
import { focusRovingItem, handleRovingKeydown, initRovingFocus, listRovingItems, } from "../rovingFocus.js";
|
|
7
|
+
const ITEM_SEL = '[role="menuitem"]:not([disabled])';
|
|
8
|
+
const styles = `
|
|
9
|
+
.pu-menu {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 2px;
|
|
13
|
+
min-width: 10.5rem;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
.pu-menu__item {
|
|
18
|
+
appearance: none;
|
|
19
|
+
border: 0;
|
|
20
|
+
background: transparent;
|
|
21
|
+
text-align: left;
|
|
22
|
+
width: 100%;
|
|
23
|
+
font: inherit;
|
|
24
|
+
font-size: var(--pu-text-sm);
|
|
25
|
+
font-weight: var(--pu-font-medium);
|
|
26
|
+
letter-spacing: -0.01em;
|
|
27
|
+
color: var(--pu-color-text);
|
|
28
|
+
padding: 0.5rem 0.65rem;
|
|
29
|
+
border-radius: var(--pu-radius-sm);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
transition:
|
|
32
|
+
background var(--pu-duration-fast) var(--pu-ease-out),
|
|
33
|
+
transform var(--pu-duration-fast) var(--pu-ease-out),
|
|
34
|
+
color var(--pu-duration-fast) var(--pu-ease-out);
|
|
35
|
+
}
|
|
36
|
+
.pu-menu__item:hover:not(:disabled),
|
|
37
|
+
.pu-menu__item:focus-visible:not(:disabled) {
|
|
38
|
+
background: var(--pu-color-surface-2);
|
|
39
|
+
transform: translateX(2px);
|
|
40
|
+
outline: none;
|
|
41
|
+
}
|
|
42
|
+
.pu-menu__item:focus-visible:not(:disabled) {
|
|
43
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--pu-color-focus) 45%, transparent);
|
|
44
|
+
}
|
|
45
|
+
.pu-menu__item:disabled {
|
|
46
|
+
opacity: 0.45;
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
49
|
+
.pu-menu__item--danger {
|
|
50
|
+
color: var(--pu-color-danger);
|
|
51
|
+
}
|
|
52
|
+
.pu-menu__item--danger:hover:not(:disabled),
|
|
53
|
+
.pu-menu__item--danger:focus-visible:not(:disabled) {
|
|
54
|
+
background: color-mix(in srgb, var(--pu-color-danger) 12%, transparent);
|
|
55
|
+
}
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
.pu-menu__item { transition: none; }
|
|
58
|
+
.pu-menu__item:hover:not(:disabled),
|
|
59
|
+
.pu-menu__item:focus-visible:not(:disabled) { transform: none; }
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
function ensureStyles(doc = document) {
|
|
63
|
+
if (typeof doc === "undefined")
|
|
64
|
+
return;
|
|
65
|
+
if (doc.querySelector('style[data-pu-ui="menu"]'))
|
|
66
|
+
return;
|
|
67
|
+
const el = doc.createElement("style");
|
|
68
|
+
el.setAttribute("data-pu-ui", "menu");
|
|
69
|
+
el.textContent = styles;
|
|
70
|
+
doc.head.appendChild(el);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Action menu built on Popover.
|
|
74
|
+
* Arrow / Home / End roving focus · Enter / Space select · Esc closes (Popover).
|
|
75
|
+
*/
|
|
76
|
+
export const Menu = component((raw) => {
|
|
77
|
+
ensureStyles();
|
|
78
|
+
const props = mergeProps({ align: "start" }, raw);
|
|
79
|
+
const open = signal(false);
|
|
80
|
+
let menuEl = null;
|
|
81
|
+
const getItems = () => {
|
|
82
|
+
const i = props.items;
|
|
83
|
+
return typeof i === "function" ? i() : (i ?? []);
|
|
84
|
+
};
|
|
85
|
+
const pick = (id) => {
|
|
86
|
+
const item = getItems().find((x) => x.id === id);
|
|
87
|
+
if (!item || item.disabled)
|
|
88
|
+
return;
|
|
89
|
+
props.onSelect?.(id);
|
|
90
|
+
open.set(false);
|
|
91
|
+
};
|
|
92
|
+
// Focus first enabled item when menu opens
|
|
93
|
+
effect(() => {
|
|
94
|
+
if (!open())
|
|
95
|
+
return;
|
|
96
|
+
const t = window.setTimeout(() => {
|
|
97
|
+
if (!menuEl)
|
|
98
|
+
return;
|
|
99
|
+
initRovingFocus(menuEl, ITEM_SEL, 0);
|
|
100
|
+
const items = listRovingItems(menuEl, ITEM_SEL);
|
|
101
|
+
focusRovingItem(items, 0);
|
|
102
|
+
}, 0);
|
|
103
|
+
return () => window.clearTimeout(t);
|
|
104
|
+
});
|
|
105
|
+
return (_jsx("div", { class: () => cx("pu-menu-root", typeof props.class === "function" ? props.class() : props.class), ref: (el) => ensureStyles(el.ownerDocument), children: _jsx(Popover, { open: open, onOpenChange: (v) => open.set(v), align: props.align, trigger: props.trigger, children: _jsx("div", { class: "pu-menu", role: "menu", ref: (el) => {
|
|
106
|
+
menuEl = el;
|
|
107
|
+
}, onKeyDown: (e) => {
|
|
108
|
+
if (!menuEl)
|
|
109
|
+
return;
|
|
110
|
+
handleRovingKeydown(e, menuEl, ITEM_SEL, {
|
|
111
|
+
orientation: "vertical",
|
|
112
|
+
loop: true,
|
|
113
|
+
onActivate: (el) => {
|
|
114
|
+
const id = el.dataset.menuId;
|
|
115
|
+
if (id)
|
|
116
|
+
pick(id);
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}, children: _jsx(For, { each: getItems, children: (item) => (_jsx("button", { type: "button", role: "menuitem", tabindex: -1, "data-menu-id": () => item().id, class: () => cx("pu-menu__item", item().danger && "pu-menu__item--danger"), disabled: () => !!item().disabled, onClick: (e) => {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
if (item().disabled)
|
|
122
|
+
return;
|
|
123
|
+
pick(item().id);
|
|
124
|
+
}, children: () => item().label })) }) }) }) }));
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../src/components/Menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAoB3B,MAAM,QAAQ,GAAG,mCAAmC,CAAC;AAErD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDd,CAAC;AAEF,SAAS,YAAY,CAAC,MAAgB,QAAQ;IAC5C,IAAI,OAAO,GAAG,KAAK,WAAW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AU;wBACvB,IAAI,EAAE,IAAI;wBACV,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE;4BACjB,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;4BAC7B,IAAI,EAAE;gCAAE,IAAI,CAAC,EAAE,CAAC,CAAC;wBACnB,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC,YAED,KAAC,GAAG,IAAC,IAAI,EAAE,QAAQ,YAChB,CAAC,IAAI,EAAE,EAAE,CAAC,CACT,iBACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,kBACE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAC7B,KAAK,EAAE,GAAG,EAAE,CACV,EAAE,CACA,eAAe,EACf,IAAI,EAAE,CAAC,MAAM,IAAI,uBAAuB,CACzC,EAEH,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EACjC,OAAO,EAAE,CAAC,CAAa,EAAE,EAAE;4BACzB,CAAC,CAAC,eAAe,EAAE,CAAC;4BACpB,IAAI,IAAI,EAAE,CAAC,QAAQ;gCAAE,OAAO;4BAC5B,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;wBAClB,CAAC,YAEA,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GACZ,CACV,GACG,GACF,GACE,GACN,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type MaybeReactive } from "../reactive.js";
|
|
2
|
+
export type NumberInputProps = {
|
|
3
|
+
value?: MaybeReactive<number>;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
disabled?: MaybeReactive<boolean>;
|
|
8
|
+
onChange?: (value: number) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
class?: MaybeReactive<string>;
|
|
11
|
+
id?: string;
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Numeric stepper with − / + controls. */
|
|
15
|
+
export declare const NumberInput: import("@lab206/dom").Component<{
|
|
16
|
+
value?: MaybeReactive<number>;
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
step?: number;
|
|
20
|
+
disabled?: MaybeReactive<boolean>;
|
|
21
|
+
onChange?: (value: number) => void;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
class?: MaybeReactive<string>;
|
|
24
|
+
id?: string;
|
|
25
|
+
"aria-label"?: string;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=NumberInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/components/NumberInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAyEF,2CAA2C;AAC3C,eAAO,MAAM,WAAW;YApFd,aAAa,CAAC,MAAM,CAAC;UACvB,MAAM;UACN,MAAM;WACL,MAAM;eACF,aAAa,CAAC,OAAO,CAAC;eACtB,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;kBACpB,MAAM;YACZ,aAAa,CAAC,MAAM,CAAC;SACxB,MAAM;mBACI,MAAM;EA8IrB,CAAC"}
|