@stll/ui 0.72.0 → 0.73.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/dist/components/button.d.ts +4 -2
- package/dist/components/button.js +8 -1
- package/dist/components/button.native-classes.js +15 -0
- package/dist/components/button.shared.d.ts +5 -1
- package/dist/components/button.shared.js +6 -0
- package/dist/components/checkbox.d.ts +15 -1
- package/dist/components/checkbox.js +74 -30
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/collapsible.js +3 -3
- package/dist/components/composer.js +1 -1
- package/dist/components/highlighted-textarea.d.ts +13 -0
- package/dist/components/highlighted-textarea.js +47 -0
- package/dist/components/menu.d.ts +2 -1
- package/dist/components/menu.js +4 -1
- package/dist/components/outcome-screen-view.d.ts +88 -0
- package/dist/components/outcome-screen-view.js +170 -0
- package/dist/components/outcome-screen.d.ts +16 -0
- package/dist/components/outcome-screen.js +47 -0
- package/dist/components/popover.d.ts +2 -1
- package/dist/components/popover.js +4 -1
- package/dist/components/table-layout.d.ts +14 -0
- package/dist/components/table-layout.js +15 -0
- package/dist/components/table.d.ts +2 -1
- package/dist/components/table.js +2 -1
- package/dist/components/textarea.d.ts +3 -1
- package/dist/components/textarea.js +27 -15
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +55 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/styles/collapsible.css +26 -0
- package/dist/styles/theme.css +35 -0
- package/package.json +9 -1
|
@@ -15,9 +15,9 @@ declare const BUTTON_LAYOUT_CLASS_NAMES: {
|
|
|
15
15
|
readonly wrap: "h-auto min-h-11 items-start justify-start py-2 text-start whitespace-normal sm:h-auto";
|
|
16
16
|
};
|
|
17
17
|
declare const buttonVariants: (props?: ({
|
|
18
|
-
size?: "chip" | "default" | "icon" | "icon-2xs" | "icon-lg" | "icon-sm" | "icon-xl" | "icon-xs" | "inline" | "lg" | "row" | "sm" | "touch" | "xl" | "xs" | null | undefined;
|
|
18
|
+
size?: "chip" | "default" | "icon" | "icon-2xs" | "icon-lg" | "icon-round" | "icon-sm" | "icon-xl" | "icon-xs" | "inline" | "inspector-row" | "lg" | "row" | "sm" | "touch" | "xl" | "xs" | null | undefined;
|
|
19
19
|
layout?: "wrap" | null | undefined;
|
|
20
|
-
variant?: "default" | "destructive" | "destructive-ghost" | "destructive-outline" | "ghost" | "link" | "muted" | "muted-destructive" | "outline" | "secondary" | null | undefined;
|
|
20
|
+
variant?: "composer" | "default" | "destructive" | "destructive-ghost" | "destructive-outline" | "ghost" | "link" | "muted" | "muted-destructive" | "outline" | "secondary" | null | undefined;
|
|
21
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
22
|
/**
|
|
23
23
|
* The outline a plain button's focus ring follows, matching its content:
|
|
@@ -57,11 +57,13 @@ declare const BUTTON_SIZE_CONTENT: {
|
|
|
57
57
|
readonly default: "text";
|
|
58
58
|
readonly icon: "icon";
|
|
59
59
|
readonly "icon-lg": "icon";
|
|
60
|
+
readonly "icon-round": "icon";
|
|
60
61
|
readonly "icon-sm": "icon";
|
|
61
62
|
readonly "icon-xl": "icon";
|
|
62
63
|
readonly "icon-2xs": "icon";
|
|
63
64
|
readonly "icon-xs": "icon";
|
|
64
65
|
readonly inline: "text";
|
|
66
|
+
readonly "inspector-row": "text";
|
|
65
67
|
readonly lg: "text";
|
|
66
68
|
readonly row: "text";
|
|
67
69
|
readonly sm: "text";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { TOOLBAR_ROW_HEIGHT } from "../inspector/layout-tokens.js";
|
|
2
3
|
import { BUTTON_DISPOSITION, blockDisabledActivation, blockDisabledKeyActivation, resolveButtonDisposition } from "../lib/button-disposition.js";
|
|
3
4
|
import { MENU_ROW_CLASS_NAME } from "../lib/menu-row.js";
|
|
4
5
|
import { rendersNothing } from "../lib/renders-nothing.js";
|
|
@@ -45,11 +46,13 @@ const BUTTON_SIZE_CLASS_NAMES = {
|
|
|
45
46
|
default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
|
|
46
47
|
icon: "size-9 sm:size-8",
|
|
47
48
|
"icon-lg": "size-10 sm:size-9",
|
|
49
|
+
"icon-round": "size-7 rounded-full sm:size-7",
|
|
48
50
|
"icon-sm": "size-8 sm:size-7",
|
|
49
51
|
"icon-xl": "size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
50
52
|
"icon-2xs": "size-5 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-4 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3",
|
|
51
53
|
"icon-xs": "size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",
|
|
52
54
|
inline: "inline h-auto rounded-sm border-0 p-0 text-start text-[length:inherit] leading-[inherit] font-normal whitespace-normal select-text before:rounded-[calc(var(--radius-sm)-1px)] sm:text-[length:inherit] [&_svg]:mx-0 [&_svg]:inline [&_svg]:align-[-0.125em] [&_svg:not(:last-child)]:me-1",
|
|
55
|
+
"inspector-row": `${TOOLBAR_ROW_HEIGHT} justify-start rounded-none px-3`,
|
|
53
56
|
lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
|
|
54
57
|
row: `${MENU_ROW_CLASS_NAME} [&_svg]:mx-0`,
|
|
55
58
|
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] text-sm sm:h-7 sm:text-xs",
|
|
@@ -57,8 +60,10 @@ const BUTTON_SIZE_CLASS_NAMES = {
|
|
|
57
60
|
xl: "h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
58
61
|
xs: "h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"
|
|
59
62
|
};
|
|
63
|
+
const BUTTON_PRIMARY_STATE_CLASS = "shadow-primary/24 data-pressed:bg-primary/80 [:hover:not([data-pressed])]:bg-primary/90 shadow-xs not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none";
|
|
60
64
|
const BUTTON_VARIANT_CLASS_NAMES = {
|
|
61
|
-
|
|
65
|
+
composer: `${tokens("composer")} ${BUTTON_PRIMARY_STATE_CLASS} hover:bg-foreground/90`,
|
|
66
|
+
default: `${tokens("default")} ${BUTTON_PRIMARY_STATE_CLASS}`,
|
|
62
67
|
destructive: `${tokens("destructive")} shadow-destructive/8 data-pressed:border-destructive/56 data-pressed:bg-destructive/20 [:hover:not([data-pressed])]:border-destructive/40 [:hover:not([data-pressed])]:bg-destructive/14 active:bg-destructive/18 shadow-xs not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] [:disabled,:active,[data-pressed]]:shadow-none`,
|
|
63
68
|
"destructive-outline": `${tokens("destructive-outline")} dark:bg-input/32 data-pressed:border-destructive/56 data-pressed:bg-destructive/8 [:hover:not([data-pressed])]:border-destructive/32 [:hover:not([data-pressed])]:bg-destructive/4 shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none`,
|
|
64
69
|
"destructive-ghost": `${tokens("destructive-ghost")} data-pressed:bg-destructive/14 data-pressed:inset-ring-destructive/32 [:hover:not([data-pressed])]:bg-destructive/10 data-pressed:inset-ring`,
|
|
@@ -141,11 +146,13 @@ const BUTTON_SIZE_CONTENT = {
|
|
|
141
146
|
default: BUTTON_CONTENT.text,
|
|
142
147
|
icon: BUTTON_CONTENT.icon,
|
|
143
148
|
"icon-lg": BUTTON_CONTENT.icon,
|
|
149
|
+
"icon-round": BUTTON_CONTENT.icon,
|
|
144
150
|
"icon-sm": BUTTON_CONTENT.icon,
|
|
145
151
|
"icon-xl": BUTTON_CONTENT.icon,
|
|
146
152
|
"icon-2xs": BUTTON_CONTENT.icon,
|
|
147
153
|
"icon-xs": BUTTON_CONTENT.icon,
|
|
148
154
|
inline: BUTTON_CONTENT.text,
|
|
155
|
+
"inspector-row": BUTTON_CONTENT.text,
|
|
149
156
|
lg: BUTTON_CONTENT.text,
|
|
150
157
|
row: BUTTON_CONTENT.text,
|
|
151
158
|
sm: BUTTON_CONTENT.text,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TOOLBAR_ROW_HEIGHT } from "../inspector/layout-tokens.js";
|
|
1
2
|
import { BUTTON_PLAIN_VARIANT, BUTTON_VARIANT_TOKENS } from "./button.shared.js";
|
|
2
3
|
// src/components/button.native-classes.ts
|
|
3
4
|
/** A control's box: centred content inside the variant's border. */
|
|
@@ -28,6 +29,11 @@ const SIZES = {
|
|
|
28
29
|
label: "",
|
|
29
30
|
slop: 0
|
|
30
31
|
},
|
|
32
|
+
"icon-round": {
|
|
33
|
+
box: `${CONTROL} size-7 rounded-full`,
|
|
34
|
+
label: "",
|
|
35
|
+
slop: 8
|
|
36
|
+
},
|
|
31
37
|
"icon-sm": {
|
|
32
38
|
box: `${CONTROL} size-8 rounded-lg`,
|
|
33
39
|
label: "",
|
|
@@ -53,6 +59,11 @@ const SIZES = {
|
|
|
53
59
|
label: "",
|
|
54
60
|
slop: 8
|
|
55
61
|
},
|
|
62
|
+
"inspector-row": {
|
|
63
|
+
box: `${CONTROL} ${TOOLBAR_ROW_HEIGHT} justify-start gap-2 rounded-none px-3`,
|
|
64
|
+
label: "",
|
|
65
|
+
slop: 0
|
|
66
|
+
},
|
|
56
67
|
lg: {
|
|
57
68
|
box: `${CONTROL} min-h-12 gap-2 rounded-lg px-5`,
|
|
58
69
|
label: "",
|
|
@@ -90,6 +101,10 @@ const SIZES = {
|
|
|
90
101
|
* held (a row open beside the list, a chosen option).
|
|
91
102
|
*/
|
|
92
103
|
const PRESS = {
|
|
104
|
+
composer: {
|
|
105
|
+
pressed: "active:opacity-80",
|
|
106
|
+
selected: ""
|
|
107
|
+
},
|
|
93
108
|
default: {
|
|
94
109
|
pressed: "active:opacity-80",
|
|
95
110
|
selected: ""
|
|
@@ -5,6 +5,10 @@ import { ReactNode } from "react";
|
|
|
5
5
|
* focus treatment on top.
|
|
6
6
|
*/
|
|
7
7
|
export declare const BUTTON_VARIANT_TOKENS: {
|
|
8
|
+
readonly composer: {
|
|
9
|
+
readonly surface: "border-primary bg-foreground";
|
|
10
|
+
readonly label: "text-background";
|
|
11
|
+
};
|
|
8
12
|
readonly default: {
|
|
9
13
|
readonly surface: "border-primary bg-primary";
|
|
10
14
|
readonly label: "text-primary-foreground";
|
|
@@ -58,7 +62,7 @@ export type ButtonTokenVariant = keyof typeof BUTTON_VARIANT_TOKENS;
|
|
|
58
62
|
export declare const BUTTON_PLAIN_VARIANT = "plain";
|
|
59
63
|
export type ButtonVariant = ButtonTokenVariant | typeof BUTTON_PLAIN_VARIANT;
|
|
60
64
|
/** Every size a button comes in, on every platform. */
|
|
61
|
-
export declare const BUTTON_SIZES: readonly ["chip", "default", "icon", "icon-lg", "icon-sm", "icon-xl", "icon-2xs", "icon-xs", "inline", "lg", "row", "sm", "touch", "xl", "xs"];
|
|
65
|
+
export declare const BUTTON_SIZES: readonly ["chip", "default", "icon", "icon-lg", "icon-round", "icon-sm", "icon-xl", "icon-2xs", "icon-xs", "inline", "inspector-row", "lg", "row", "sm", "touch", "xl", "xs"];
|
|
62
66
|
export type ButtonSize = (typeof BUTTON_SIZES)[number];
|
|
63
67
|
/**
|
|
64
68
|
* The props every button renderer accepts, with one meaning. A renderer adds
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* focus treatment on top.
|
|
6
6
|
*/
|
|
7
7
|
const BUTTON_VARIANT_TOKENS = {
|
|
8
|
+
composer: {
|
|
9
|
+
surface: "border-primary bg-foreground",
|
|
10
|
+
label: "text-background"
|
|
11
|
+
},
|
|
8
12
|
default: {
|
|
9
13
|
surface: "border-primary bg-primary",
|
|
10
14
|
label: "text-primary-foreground"
|
|
@@ -60,11 +64,13 @@ const BUTTON_SIZES = [
|
|
|
60
64
|
"default",
|
|
61
65
|
"icon",
|
|
62
66
|
"icon-lg",
|
|
67
|
+
"icon-round",
|
|
63
68
|
"icon-sm",
|
|
64
69
|
"icon-xl",
|
|
65
70
|
"icon-2xs",
|
|
66
71
|
"icon-xs",
|
|
67
72
|
"inline",
|
|
73
|
+
"inspector-row",
|
|
68
74
|
"lg",
|
|
69
75
|
"row",
|
|
70
76
|
"sm",
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
2
|
-
|
|
2
|
+
import { TableFirstLine } from "./table-layout.js";
|
|
3
|
+
declare const Checkbox: (props: CheckboxProps) => import("react").JSX.Element;
|
|
4
|
+
type DefaultCheckboxProps = Checkbox$1.Root.Props & {
|
|
5
|
+
appearance?: "default";
|
|
6
|
+
};
|
|
7
|
+
type CellCheckboxProps = Omit<Checkbox$1.Root.Props, "children" | "render" | "nativeButton" | "readOnly" | "defaultChecked" | "checked" | "className" | "style"> & {
|
|
8
|
+
appearance: "cell";
|
|
9
|
+
checked: boolean;
|
|
10
|
+
/** The row's visible number or label, before its checkbox is revealed. */
|
|
11
|
+
rowLabel: string;
|
|
12
|
+
/** Aligns the label and glyph with a text line or a field's first line. */
|
|
13
|
+
firstLine: TableFirstLine;
|
|
14
|
+
onCheckedChange: NonNullable<Checkbox$1.Root.Props["onCheckedChange"]>;
|
|
15
|
+
};
|
|
16
|
+
type CheckboxProps = DefaultCheckboxProps | CellCheckboxProps;
|
|
3
17
|
export { Checkbox };
|
|
@@ -1,45 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { TABLE_FIRST_LINE } from "./table-layout.js";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
5
6
|
// src/components/checkbox.tsx
|
|
6
|
-
const Checkbox = (
|
|
7
|
-
|
|
7
|
+
const Checkbox = (props) => {
|
|
8
|
+
if (props.appearance === "cell") return renderCellCheckbox(props);
|
|
9
|
+
return renderDefaultCheckbox(props);
|
|
10
|
+
};
|
|
11
|
+
const renderDefaultCheckbox = ({ appearance: _appearance, className, ...props }) => /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
12
|
+
className: cn(CHECKBOX_CLASS_NAME, className),
|
|
8
13
|
"data-slot": "checkbox",
|
|
9
14
|
...props,
|
|
10
15
|
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
11
|
-
className:
|
|
16
|
+
className: CHECKBOX_INDICATOR_CLASS_NAME,
|
|
12
17
|
"data-slot": "checkbox-indicator",
|
|
13
18
|
render: (indicatorProps, state) => /* @__PURE__ */ jsx("span", {
|
|
14
19
|
...indicatorProps,
|
|
15
|
-
children:
|
|
16
|
-
"aria-hidden": "true",
|
|
17
|
-
className: "size-3.5 sm:size-3",
|
|
18
|
-
fill: "none",
|
|
19
|
-
height: "24",
|
|
20
|
-
stroke: "currentColor",
|
|
21
|
-
strokeLinecap: "round",
|
|
22
|
-
strokeLinejoin: "round",
|
|
23
|
-
strokeWidth: "3",
|
|
24
|
-
viewBox: "0 0 24 24",
|
|
25
|
-
width: "24",
|
|
26
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
-
children: [/* @__PURE__ */ jsx("title", { children: "Indeterminate" }), /* @__PURE__ */ jsx("path", { d: "M5.252 12h13.496" })]
|
|
28
|
-
}) : /* @__PURE__ */ jsxs("svg", {
|
|
29
|
-
"aria-hidden": "true",
|
|
30
|
-
className: "size-3.5 sm:size-3",
|
|
31
|
-
fill: "none",
|
|
32
|
-
height: "24",
|
|
33
|
-
stroke: "currentColor",
|
|
34
|
-
strokeLinecap: "round",
|
|
35
|
-
strokeLinejoin: "round",
|
|
36
|
-
strokeWidth: "3",
|
|
37
|
-
viewBox: "0 0 24 24",
|
|
38
|
-
width: "24",
|
|
39
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
-
children: [/* @__PURE__ */ jsx("title", { children: "Checked" }), /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })]
|
|
41
|
-
})
|
|
20
|
+
children: /* @__PURE__ */ jsx(CheckboxGlyph, { indeterminate: state.indeterminate })
|
|
42
21
|
})
|
|
43
22
|
})
|
|
44
23
|
});
|
|
24
|
+
const renderCellCheckbox = ({ appearance, rowLabel, firstLine, checked, ...props }) => /* @__PURE__ */ jsxs(Checkbox$1.Root, {
|
|
25
|
+
...props,
|
|
26
|
+
checked,
|
|
27
|
+
"aria-label": props["aria-label"] ?? rowLabel,
|
|
28
|
+
className: "group/selection ring-ring hover:bg-muted/50 data-disabled:text-foreground-disabled absolute inset-0 min-w-12 shrink-0 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent",
|
|
29
|
+
"data-appearance": appearance,
|
|
30
|
+
nativeButton: true,
|
|
31
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
32
|
+
readOnly: false,
|
|
33
|
+
defaultChecked: void 0,
|
|
34
|
+
style: void 0,
|
|
35
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
className: cn("absolute inset-x-0 top-2 flex min-w-12 items-center justify-center", TABLE_FIRST_LINE[firstLine].slot, "text-xs tabular-nums transition-opacity group-hover/row:opacity-0 group-focus-visible/selection:opacity-0 group-data-[state=selected]/row:opacity-0", checked && "opacity-0"),
|
|
38
|
+
"data-slot": "checkbox-cell-label",
|
|
39
|
+
children: rowLabel
|
|
40
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
className: cn("absolute inset-x-0 top-2 flex min-w-12 items-center justify-center", TABLE_FIRST_LINE[firstLine].slot, "pointer-events-none opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-visible/selection:opacity-100 group-data-[state=selected]/row:opacity-100", checked && "opacity-100"),
|
|
43
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
44
|
+
keepMounted: true,
|
|
45
|
+
className: CHECKBOX_CLASS_NAME,
|
|
46
|
+
"data-slot": "checkbox",
|
|
47
|
+
render: (indicatorProps, state) => /* @__PURE__ */ jsx("span", {
|
|
48
|
+
...indicatorProps,
|
|
49
|
+
children: (state.checked || state.indeterminate) && /* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: CHECKBOX_INDICATOR_CLASS_NAME,
|
|
51
|
+
"data-checked": state.checked && !state.indeterminate ? "" : void 0,
|
|
52
|
+
"data-indeterminate": state.indeterminate ? "" : void 0,
|
|
53
|
+
"data-slot": "checkbox-indicator",
|
|
54
|
+
children: /* @__PURE__ */ jsx(CheckboxGlyph, { indeterminate: state.indeterminate })
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
const CHECKBOX_CLASS_NAME = "border-input bg-background ring-ring focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-sm border shadow-xs/5 outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-sm)-1px)] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 data-disabled:opacity-64 sm:size-4 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none";
|
|
61
|
+
const CHECKBOX_INDICATOR_CLASS_NAME = "text-primary-foreground data-checked:bg-primary data-indeterminate:text-foreground absolute -inset-px flex items-center justify-center rounded-sm data-unchecked:hidden";
|
|
62
|
+
const CheckboxGlyph = ({ indeterminate }) => indeterminate ? /* @__PURE__ */ jsxs("svg", {
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
className: "size-3.5 sm:size-3",
|
|
65
|
+
fill: "none",
|
|
66
|
+
height: "24",
|
|
67
|
+
stroke: "currentColor",
|
|
68
|
+
strokeLinecap: "round",
|
|
69
|
+
strokeLinejoin: "round",
|
|
70
|
+
strokeWidth: "3",
|
|
71
|
+
viewBox: "0 0 24 24",
|
|
72
|
+
width: "24",
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Indeterminate" }), /* @__PURE__ */ jsx("path", { d: "M5.252 12h13.496" })]
|
|
75
|
+
}) : /* @__PURE__ */ jsxs("svg", {
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
className: "size-3.5 sm:size-3",
|
|
78
|
+
fill: "none",
|
|
79
|
+
height: "24",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round",
|
|
83
|
+
strokeWidth: "3",
|
|
84
|
+
viewBox: "0 0 24 24",
|
|
85
|
+
width: "24",
|
|
86
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
87
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Checked" }), /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })]
|
|
88
|
+
});
|
|
45
89
|
export { Checkbox };
|
|
@@ -17,8 +17,8 @@ declare const CollapsibleTrigger: ({ className, ...props }: Collapsible$1.Trigge
|
|
|
17
17
|
/**
|
|
18
18
|
* The disclosed content. It adds no padding or type, so opening it reveals
|
|
19
19
|
* content at the rhythm of the surface around it, as a native `<details>`
|
|
20
|
-
* does.
|
|
21
|
-
*
|
|
20
|
+
* does. Layout changes directly: opening content fades in for 200ms,
|
|
21
|
+
* closing hides it immediately, and reduced motion skips the fade.
|
|
22
22
|
*
|
|
23
23
|
* Closed, the content stays in the document. Once mounted it is
|
|
24
24
|
* `hidden="until-found"` (as a native `<details>` keeps it), so find-in-page
|
|
@@ -28,8 +28,8 @@ const CollapsibleTrigger = ({ className, ...props }) => /* @__PURE__ */ jsx(Coll
|
|
|
28
28
|
/**
|
|
29
29
|
* The disclosed content. It adds no padding or type, so opening it reveals
|
|
30
30
|
* content at the rhythm of the surface around it, as a native `<details>`
|
|
31
|
-
* does.
|
|
32
|
-
*
|
|
31
|
+
* does. Layout changes directly: opening content fades in for 200ms,
|
|
32
|
+
* closing hides it immediately, and reduced motion skips the fade.
|
|
33
33
|
*
|
|
34
34
|
* Closed, the content stays in the document. Once mounted it is
|
|
35
35
|
* `hidden="until-found"` (as a native `<details>` keeps it), so find-in-page
|
|
@@ -38,7 +38,7 @@ const CollapsibleTrigger = ({ className, ...props }) => /* @__PURE__ */ jsx(Coll
|
|
|
38
38
|
* `hiddenUntilFound={false}` to unmount it instead.
|
|
39
39
|
*/
|
|
40
40
|
const CollapsiblePanel = ({ className, hiddenUntilFound = true, ...props }) => /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
41
|
-
className: cn("
|
|
41
|
+
className: cn("min-w-0 [&[hidden]:not([hidden=until-found])]:hidden", className),
|
|
42
42
|
"data-slot": "collapsible-panel",
|
|
43
43
|
hiddenUntilFound,
|
|
44
44
|
...props
|
|
@@ -63,8 +63,8 @@ const ComposerStatusRow = ({ start, end, center, className }) => {
|
|
|
63
63
|
const ComposerPicker = ({ ariaLabel, icon, onChange, options, value }) => {
|
|
64
64
|
const current = options.find((option) => option.value === value);
|
|
65
65
|
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsxs(MenuTrigger, {
|
|
66
|
+
appearance: "caption",
|
|
66
67
|
"aria-label": ariaLabel,
|
|
67
|
-
className: COMPOSER_PICKER_TRIGGER_CLASS,
|
|
68
68
|
children: [
|
|
69
69
|
/* @__PURE__ */ jsx("span", {
|
|
70
70
|
className: "flex size-3 shrink-0 items-center justify-center [&>svg]:size-3",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** An editor whose visible text is supplied by a matching highlighted layer. */
|
|
3
|
+
declare const HighlightedTextarea: ({ className, id, name, disabled, value, dir, highlightedContent, onScroll, ...props }: HighlightedTextareaProps) => React.JSX.Element;
|
|
4
|
+
type HighlightedTextareaProps = Omit<React.ComponentProps<"textarea">, "children" | "className" | "defaultValue" | "dir" | "style" | "value" | "wrap"> & {
|
|
5
|
+
/** Layout of the enclosing editor; text presentation belongs to both layers. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Omit to inherit the surrounding direction for both layers. */
|
|
8
|
+
dir?: "ltr" | "rtl";
|
|
9
|
+
/** The same text as value, with optional inline highlighting. */
|
|
10
|
+
highlightedContent: React.ReactNode;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
export { HighlightedTextarea, type HighlightedTextareaProps };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { Field } from "@base-ui/react/field";
|
|
6
|
+
// src/components/highlighted-textarea.tsx
|
|
7
|
+
/** An editor whose visible text is supplied by a matching highlighted layer. */
|
|
8
|
+
const HighlightedTextarea = ({ className, id, name, disabled, value, dir, highlightedContent, onScroll, ...props }) => {
|
|
9
|
+
const backdropRef = useRef(null);
|
|
10
|
+
const syncScroll = (event) => {
|
|
11
|
+
if (backdropRef.current) {
|
|
12
|
+
backdropRef.current.scrollTop = event.currentTarget.scrollTop;
|
|
13
|
+
backdropRef.current.scrollLeft = event.currentTarget.scrollLeft;
|
|
14
|
+
}
|
|
15
|
+
onScroll?.(event);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: cn("relative min-h-0", className),
|
|
19
|
+
"data-slot": "highlighted-textarea",
|
|
20
|
+
dir,
|
|
21
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: cn(TEXT_LAYER_CLASS, "text-foreground pointer-events-none absolute inset-0 overflow-hidden"),
|
|
24
|
+
"data-slot": "highlighted-textarea-backdrop",
|
|
25
|
+
ref: backdropRef,
|
|
26
|
+
children: [highlightedContent, value.endsWith("\n") ? "" : null]
|
|
27
|
+
}), /* @__PURE__ */ jsx(Field.Control, {
|
|
28
|
+
id,
|
|
29
|
+
name,
|
|
30
|
+
disabled,
|
|
31
|
+
value,
|
|
32
|
+
render: /* @__PURE__ */ jsx("textarea", {
|
|
33
|
+
className: cn(TEXT_LAYER_CLASS, "caret-foreground ring-ring absolute inset-0 border-0 bg-transparent text-transparent outline-none [-webkit-text-fill-color:transparent] focus-visible:ring-2 focus-visible:ring-inset"),
|
|
34
|
+
"data-slot": "highlighted-textarea-editor",
|
|
35
|
+
dir,
|
|
36
|
+
...props,
|
|
37
|
+
defaultValue: void 0,
|
|
38
|
+
style: void 0,
|
|
39
|
+
wrap: void 0,
|
|
40
|
+
onScroll: syncScroll,
|
|
41
|
+
children: null
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const TEXT_LAYER_CLASS = "m-0 h-full w-full resize-none scrollbar-stable p-4 font-sans text-sm leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]";
|
|
47
|
+
export { HighlightedTextarea };
|
|
@@ -4,7 +4,8 @@ import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
|
4
4
|
declare const MenuCreateHandle: typeof Menu$1.createHandle;
|
|
5
5
|
declare const Menu: typeof Menu$1.Root;
|
|
6
6
|
declare const MenuPortal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").MenuPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
-
declare function MenuTrigger({ tooltip, ...props }: Menu$1.Trigger.Props & {
|
|
7
|
+
declare function MenuTrigger({ appearance, className, tooltip, ...props }: Menu$1.Trigger.Props & {
|
|
8
|
+
appearance?: "default" | "caption";
|
|
8
9
|
tooltip?: React.ReactNode;
|
|
9
10
|
}): React.JSX.Element;
|
|
10
11
|
declare const MenuAnchor: () => React.JSX.Element;
|
package/dist/components/menu.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { ChevronRightIcon } from "../icons.js";
|
|
3
3
|
import { OVERLAY_LAYER_CLASS_NAMES } from "../lib/overlay-layer.js";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { COMPOSER_PICKER_TRIGGER_CLASS } from "./composer-tokens.js";
|
|
5
6
|
import { DirectionalIcon } from "./directional-icon.js";
|
|
6
7
|
import { Kbd } from "./kbd.js";
|
|
7
8
|
import { renderTooltipTrigger } from "./tooltip-trigger-helper.js";
|
|
@@ -11,10 +12,12 @@ import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
|
11
12
|
const MenuCreateHandle = Menu$1.createHandle;
|
|
12
13
|
const Menu = Menu$1.Root;
|
|
13
14
|
const MenuPortal = Menu$1.Portal;
|
|
14
|
-
function MenuTrigger({ tooltip, ...props }) {
|
|
15
|
+
function MenuTrigger({ appearance = "default", className, tooltip, ...props }) {
|
|
16
|
+
const appearanceClassName = appearance === "caption" ? cn(COMPOSER_PICKER_TRIGGER_CLASS, "relative pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11") : void 0;
|
|
15
17
|
return renderTooltipTrigger({
|
|
16
18
|
tooltip,
|
|
17
19
|
trigger: /* @__PURE__ */ jsx(Menu$1.Trigger, {
|
|
20
|
+
className: typeof className === "function" ? (state) => cn(appearanceClassName, className(state)) : cn(appearanceClassName, className),
|
|
18
21
|
"data-slot": "menu-trigger",
|
|
19
22
|
nativeButton: true,
|
|
20
23
|
...props
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
|
+
export type OutcomeTone = "success" | "error";
|
|
3
|
+
/** One fact about what the flow connected, e.g. Account: jan@firm.example. */
|
|
4
|
+
export type OutcomeDetail = {
|
|
5
|
+
/** What the fact is, in a word or two. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The fact itself; isolated as its own bidi run (names, emails). */
|
|
8
|
+
value: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
type OutcomeLayoutProps = {
|
|
11
|
+
tone: OutcomeTone;
|
|
12
|
+
/** What happened, in a few words. Also the document title. */
|
|
13
|
+
title: string;
|
|
14
|
+
/** What it means, or what to do next. */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** The other side's identity (a logo), drawn in a tile beside stella's. */
|
|
17
|
+
counterpart?: ReactNode;
|
|
18
|
+
/** The flow's facts, drawn by `OutcomeDetailList`. */
|
|
19
|
+
details?: ReactNode;
|
|
20
|
+
/** A command to run next, drawn by `OutcomeCommand`. */
|
|
21
|
+
command?: ReactNode;
|
|
22
|
+
/** The way on, as buttons or links. */
|
|
23
|
+
actions?: ReactNode;
|
|
24
|
+
/** A quiet footnote, drawn by `OutcomeNote`. */
|
|
25
|
+
note?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* `page` owns the viewport; `embedded` sits inside a layout that already
|
|
28
|
+
* frames the page (the sign-in layout).
|
|
29
|
+
*/
|
|
30
|
+
surface?: "page" | "embedded";
|
|
31
|
+
/** The document title, when it differs from `title` (an app suffix). */
|
|
32
|
+
documentTitle?: string;
|
|
33
|
+
/** Makes the heading focusable and hands it over, to move focus to it. */
|
|
34
|
+
headingRef?: Ref<HTMLHeadingElement>;
|
|
35
|
+
};
|
|
36
|
+
export type OutcomeScreenViewProps = Omit<OutcomeLayoutProps, "details" | "command" | "note"> & {
|
|
37
|
+
/**
|
|
38
|
+
* What the flow connected, 1 to 3 facts it already holds (the account, the
|
|
39
|
+
* organization, the access granted). Leave it out when there is nothing
|
|
40
|
+
* specific to say; never fill it with generic text.
|
|
41
|
+
*/
|
|
42
|
+
details?: readonly OutcomeDetail[];
|
|
43
|
+
/** A command the person runs next, e.g. to try again from a terminal. */
|
|
44
|
+
command?: string;
|
|
45
|
+
/**
|
|
46
|
+
* That the tab can be closed, and only when it really can: never beside a
|
|
47
|
+
* redirect or a button, which are the way on themselves.
|
|
48
|
+
*/
|
|
49
|
+
note?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
/** The facts' one quiet surface; its rows are `OutcomeDetailRow`s. */
|
|
52
|
+
export declare const OutcomeDetailList: ({ children }: {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}) => import("react").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* One fact: its label in the start column, the value (one bidi run) beside
|
|
57
|
+
* it. A long value wraps rather than cut short, so an email reads in full.
|
|
58
|
+
*/
|
|
59
|
+
export declare const OutcomeDetailRow: ({ label, value }: {
|
|
60
|
+
label: ReactNode;
|
|
61
|
+
value: ReactNode;
|
|
62
|
+
}) => import("react").JSX.Element;
|
|
63
|
+
/**
|
|
64
|
+
* A place or control in the app, named as it reads there ("General"), set
|
|
65
|
+
* apart inside running text so the way back can be scanned.
|
|
66
|
+
*/
|
|
67
|
+
export declare const OutcomeControl: ({ children }: {
|
|
68
|
+
children: ReactNode;
|
|
69
|
+
}) => import("react").JSX.Element;
|
|
70
|
+
/** A button's label inside running text; the sentence supplies the quotes. */
|
|
71
|
+
export declare const OutcomeButtonLabel: ({ children }: {
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
}) => import("react").JSX.Element;
|
|
74
|
+
/** A command to run, set as code: left to right in every language. */
|
|
75
|
+
export declare const OutcomeCommand: ({ children }: {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
}) => import("react").JSX.Element;
|
|
78
|
+
/** The quiet line under everything else. */
|
|
79
|
+
export declare const OutcomeNote: ({ children }: {
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
}) => import("react").JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* The screen with every optional part already drawn: `OutcomeScreenView`
|
|
84
|
+
* draws them from props, the generator puts template slots in their place.
|
|
85
|
+
*/
|
|
86
|
+
export declare const OutcomeLayout: ({ tone, title, description, counterpart, details, command, actions, note, surface, documentTitle, headingRef }: OutcomeLayoutProps) => import("react").JSX.Element;
|
|
87
|
+
export declare const OutcomeScreenView: ({ details, command, note, ...layout }: OutcomeScreenViewProps) => import("react").JSX.Element;
|
|
88
|
+
export {};
|