@langchain/macaw-components 1.1.0 → 1.2.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/catalog.json +524 -482
- package/dist/components/Accordion/Accordion.d.ts +63 -0
- package/dist/components/Accordion/Accordion.js +170 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Attachment/Attachment.js +3 -3
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Banner/Banner.js +2 -2
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/ChartCard/ChartCard.js +2 -2
- package/dist/components/ChartCard/ChartCardSkeleton.d.ts +1 -1
- package/dist/components/ChartCard/ChartCardSkeleton.js +14 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -1
- package/dist/components/ChartLegend/ChartLegend.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Code/CodeLite.js +2 -2
- package/dist/components/Code/index.js +1 -1
- package/dist/components/Command/CommandMenu.js +1 -1
- package/dist/components/CopyButton/CopyButton.js +2 -2
- package/dist/components/Dialog/index.js +3 -3
- package/dist/components/ErrorMessage/ErrorMessage.js +3 -3
- package/dist/components/IconButton/IconButton.js +2 -2
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Pane/Pane.js +2 -2
- package/dist/components/Select/Select.d.ts +8 -0
- package/dist/components/Select/Select.js +4 -4
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectPrimitive.js +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +27 -0
- package/dist/components/StatusBadge/StatusBadge.js +42 -0
- package/dist/components/StatusBadge/StatusBadge.js.map +1 -0
- package/dist/components/StatusBadge/index.d.ts +2 -0
- package/dist/components/StatusBadge/index.js +2 -0
- package/dist/components/Toast/index.js +2 -2
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Typeahead/TypeaheadParts.js +2 -2
- package/dist/components/Typeahead/TypeaheadView.js +1 -1
- package/dist/components/UnsavedChangesDialog.js +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +7 -6
- package/dist/icons/LongTailPhosphorIcons.js +1 -1
- package/dist/icons/PaddedPhosphorIcons.js +2 -2
- package/dist/index.js +7 -6
- package/dist/utilities.css +1 -1
- package/docs/STYLES.md +1 -1
- package/package.json +20 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface AccordionProps {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
/** Sits right of the title, such as a button to add another item. */
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* `AccordionItem`s, or the list's empty or loading content, such as an
|
|
9
|
+
* `EmptyState`, which fills the card as-is. Without children it's just the
|
|
10
|
+
* header, for a section of plain fields.
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A section of `AccordionItem`s in one bordered card, with an optional title,
|
|
17
|
+
* description, and action above.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Accordion({ title, description, action, children, className, }: AccordionProps): import("react").JSX.Element;
|
|
20
|
+
/** One entry in an `AccordionItem`'s overflow menu. */
|
|
21
|
+
export interface AccordionItemMenuItem {
|
|
22
|
+
/** The entry's name, in Title Case, such as Remove. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** A quiet line under the label, such as what the entry does. */
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Called when the viewer picks the entry; the menu then closes. */
|
|
27
|
+
onSelect: () => void;
|
|
28
|
+
/** `destructive` marks an entry that removes or revokes something. */
|
|
29
|
+
tone?: 'default' | 'destructive';
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface AccordionItemProps {
|
|
33
|
+
/** A mark at 16px, which the item puts in a tile. */
|
|
34
|
+
icon?: ReactNode;
|
|
35
|
+
/** A person's or account's name, shown as an avatar in place of `icon`. */
|
|
36
|
+
avatar?: string;
|
|
37
|
+
title: ReactNode;
|
|
38
|
+
/** Sits beside the title, such as a `StatusBadge`. */
|
|
39
|
+
badge?: ReactNode;
|
|
40
|
+
/** A quiet line under the title. */
|
|
41
|
+
description?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* The item's own action, kept on its header whether or not it's expanded,
|
|
44
|
+
* such as a `Switch`, a `Select` with `variant="plain"`, or a button.
|
|
45
|
+
*/
|
|
46
|
+
action?: ReactNode;
|
|
47
|
+
/** Entries for the item's overflow menu, such as Rename or Remove. */
|
|
48
|
+
menuItems?: AccordionItemMenuItem[];
|
|
49
|
+
/**
|
|
50
|
+
* The item's expandable body, shown below the header when expanded. Without
|
|
51
|
+
* it the item doesn't expand.
|
|
52
|
+
*/
|
|
53
|
+
contents?: ReactNode;
|
|
54
|
+
defaultExpanded?: boolean;
|
|
55
|
+
/** Called when the viewer expands or collapses the item. */
|
|
56
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One item in an `Accordion`: a header with a title, its action, and an
|
|
61
|
+
* overflow menu, which expands to show its `contents` when it has any.
|
|
62
|
+
*/
|
|
63
|
+
export declare function AccordionItem({ icon: iconProp, avatar, title, badge, description, action, menuItems, contents, defaultExpanded, onExpandedChange, className, }: AccordionItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { CaretDownIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
2
|
+
import { animation } from "../../utils/animation.js";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { Text } from "../Text/Text.js";
|
|
5
|
+
import { Avatar } from "../Avatar/Avatar.js";
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../DropdownMenu/DropdownMenu.js";
|
|
7
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
8
|
+
import { Children, Fragment, isValidElement, useId, useState } from "react";
|
|
9
|
+
import { DotsThreeIcon } from "@phosphor-icons/react/dist/ssr/DotsThree";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region packages/components/src/components/Accordion/Accordion.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Whether a node renders anything, with fragments opened up, so a fragment of
|
|
14
|
+
* only `false` or `null` children counts as empty.
|
|
15
|
+
*/
|
|
16
|
+
function hasContent(node) {
|
|
17
|
+
return Children.toArray(node).some((child) => isValidElement(child) && child.type === Fragment ? hasContent(child.props.children) : true);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A section of `AccordionItem`s in one bordered card, with an optional title,
|
|
21
|
+
* description, and action above.
|
|
22
|
+
*/
|
|
23
|
+
function Accordion({ title, description, action, children, className }) {
|
|
24
|
+
const titleId = useId();
|
|
25
|
+
const hasHeader = title != null || description != null || action != null;
|
|
26
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
27
|
+
"aria-labelledby": title != null ? titleId : void 0,
|
|
28
|
+
className: cn("flex flex-col gap-space-3", className),
|
|
29
|
+
children: [hasHeader && /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: "flex flex-col gap-space-1",
|
|
31
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "flex items-center justify-between gap-space-3",
|
|
33
|
+
children: [title != null && /* @__PURE__ */ jsx(Text, {
|
|
34
|
+
as: "h3",
|
|
35
|
+
variant: "h3",
|
|
36
|
+
id: titleId,
|
|
37
|
+
children: title
|
|
38
|
+
}), action != null && /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "ml-auto flex shrink-0 items-center gap-space-2",
|
|
40
|
+
children: action
|
|
41
|
+
})]
|
|
42
|
+
}), description != null && /* @__PURE__ */ jsx(Text, {
|
|
43
|
+
as: "p",
|
|
44
|
+
variant: "sm",
|
|
45
|
+
color: "tertiary",
|
|
46
|
+
children: description
|
|
47
|
+
})]
|
|
48
|
+
}), hasContent(children) && /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "flex flex-col divide-y divide-subtle overflow-hidden rounded-md border border-default bg-surface-level-1",
|
|
50
|
+
children
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One item in an `Accordion`: a header with a title, its action, and an
|
|
56
|
+
* overflow menu, which expands to show its `contents` when it has any.
|
|
57
|
+
*/
|
|
58
|
+
function AccordionItem({ icon: iconProp, avatar, title, badge, description, action, menuItems, contents, defaultExpanded = false, onExpandedChange, className }) {
|
|
59
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
60
|
+
function toggle() {
|
|
61
|
+
setExpanded(!expanded);
|
|
62
|
+
onExpandedChange?.(!expanded);
|
|
63
|
+
}
|
|
64
|
+
const bodyId = useId();
|
|
65
|
+
const icon = avatar != null ? /* @__PURE__ */ jsx(Avatar, {
|
|
66
|
+
label: avatar,
|
|
67
|
+
size: "sm",
|
|
68
|
+
shape: "circle"
|
|
69
|
+
}) : iconProp;
|
|
70
|
+
const label = typeof title === "string" ? title : "item";
|
|
71
|
+
const hasBody = hasContent(contents);
|
|
72
|
+
const hasMenu = menuItems != null && menuItems.length > 0;
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: cn("flex flex-col", className),
|
|
75
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: "flex items-center gap-space-2 px-space-3 py-space-2",
|
|
77
|
+
children: [
|
|
78
|
+
icon != null && /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: cn("flex size-6 shrink-0 items-center justify-center", avatar == null && "rounded-sm bg-surface-level-2 text-icon-secondary [&>*]:size-4"),
|
|
80
|
+
children: icon
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "flex min-w-0 flex-1 flex-wrap items-center justify-between gap-x-space-3 gap-y-space-2",
|
|
84
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: cn("flex min-h-6 min-w-0 flex-1 basis-16 flex-col justify-center", hasBody && "cursor-pointer"),
|
|
86
|
+
onClick: hasBody ? toggle : void 0,
|
|
87
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
88
|
+
className: "flex min-w-0 items-center gap-space-2",
|
|
89
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
90
|
+
as: "span",
|
|
91
|
+
variant: "sm",
|
|
92
|
+
weight: "medium",
|
|
93
|
+
className: "truncate text-primary",
|
|
94
|
+
children: title
|
|
95
|
+
}), badge]
|
|
96
|
+
}), description != null && /* @__PURE__ */ jsx(Text, {
|
|
97
|
+
as: "span",
|
|
98
|
+
variant: "xs",
|
|
99
|
+
color: "tertiary",
|
|
100
|
+
className: "truncate",
|
|
101
|
+
children: description
|
|
102
|
+
})]
|
|
103
|
+
}), action != null && /* @__PURE__ */ jsx("div", {
|
|
104
|
+
className: "flex min-h-6 shrink-0 items-center gap-space-2",
|
|
105
|
+
children: action
|
|
106
|
+
})]
|
|
107
|
+
}),
|
|
108
|
+
(hasMenu || hasBody) && /* @__PURE__ */ jsxs("div", {
|
|
109
|
+
className: "flex shrink-0 items-center gap-space-2",
|
|
110
|
+
children: [hasMenu && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
111
|
+
asChild: true,
|
|
112
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
113
|
+
icon: DotsThreeIcon,
|
|
114
|
+
iconWeight: "regular",
|
|
115
|
+
label: `${label} options`,
|
|
116
|
+
variant: "plain",
|
|
117
|
+
color: "secondary",
|
|
118
|
+
size: "sm"
|
|
119
|
+
})
|
|
120
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
121
|
+
align: "end",
|
|
122
|
+
className: "max-w-xs",
|
|
123
|
+
children: menuItems.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
124
|
+
disabled: item.disabled,
|
|
125
|
+
onSelect: item.onSelect,
|
|
126
|
+
className: "flex-col items-start justify-center",
|
|
127
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
128
|
+
as: "span",
|
|
129
|
+
variant: "sm",
|
|
130
|
+
color: item.tone === "destructive" ? "error" : "primary",
|
|
131
|
+
children: item.label
|
|
132
|
+
}), item.description != null && /* @__PURE__ */ jsx(Text, {
|
|
133
|
+
as: "span",
|
|
134
|
+
variant: "xs",
|
|
135
|
+
color: "tertiary",
|
|
136
|
+
children: item.description
|
|
137
|
+
})]
|
|
138
|
+
}, item.label))
|
|
139
|
+
})] }), hasBody && /* @__PURE__ */ jsx(IconButton, {
|
|
140
|
+
icon: CaretDownIcon,
|
|
141
|
+
iconWeight: "regular",
|
|
142
|
+
label: expanded ? `Hide ${label}` : `Show ${label}`,
|
|
143
|
+
variant: "plain",
|
|
144
|
+
color: "secondary",
|
|
145
|
+
size: "sm",
|
|
146
|
+
"aria-expanded": expanded,
|
|
147
|
+
"aria-controls": bodyId,
|
|
148
|
+
onClick: toggle,
|
|
149
|
+
className: cn("[&_svg]:transition-transform [&_svg]:duration-normal motion-reduce:[&_svg]:transition-none", !expanded && "[&_svg]:-rotate-90")
|
|
150
|
+
})]
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
}), hasBody && /* @__PURE__ */ jsx("div", {
|
|
154
|
+
id: bodyId,
|
|
155
|
+
className: cn(animation.contentResize, "motion-reduce:transition-none", expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
156
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: "overflow-hidden",
|
|
158
|
+
inert: !expanded,
|
|
159
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
160
|
+
className: "border-t border-subtle px-space-3 py-space-2",
|
|
161
|
+
children: contents
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
export { Accordion, AccordionItem };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=Accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.js","names":[],"sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n isValidElement,\n type ReactNode,\n useId,\n useState,\n} from 'react';\n\nimport { DotsThreeIcon } from '@phosphor-icons/react/dist/ssr/DotsThree';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { animation } from '../../utils/animation';\nimport { cn } from '../../utils/cn';\nimport { Avatar } from '../Avatar';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../DropdownMenu';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\n\n/**\n * Whether a node renders anything, with fragments opened up, so a fragment of\n * only `false` or `null` children counts as empty.\n */\nfunction hasContent(node: ReactNode): boolean {\n return Children.toArray(node).some((child) =>\n isValidElement<{ children?: ReactNode }>(child) && child.type === Fragment\n ? hasContent(child.props.children)\n : true\n );\n}\n\nexport interface AccordionProps {\n title?: ReactNode;\n description?: ReactNode;\n /** Sits right of the title, such as a button to add another item. */\n action?: ReactNode;\n /**\n * `AccordionItem`s, or the list's empty or loading content, such as an\n * `EmptyState`, which fills the card as-is. Without children it's just the\n * header, for a section of plain fields.\n */\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A section of `AccordionItem`s in one bordered card, with an optional title,\n * description, and action above.\n */\nexport function Accordion({\n title,\n description,\n action,\n children,\n className,\n}: AccordionProps) {\n const titleId = useId();\n const hasHeader = title != null || description != null || action != null;\n return (\n <section\n // Names the section after its title, so it reads as a landmark.\n aria-labelledby={title != null ? titleId : undefined}\n className={cn('flex flex-col gap-space-3', className)}\n >\n {hasHeader && (\n <div className=\"flex flex-col gap-space-1\">\n {/* The action centers on the title's line, so it stays put however\n far the description wraps. */}\n <div className=\"flex items-center justify-between gap-space-3\">\n {title != null && (\n <Text as=\"h3\" variant=\"h3\" id={titleId}>\n {title}\n </Text>\n )}\n {action != null && (\n <div className=\"ml-auto flex shrink-0 items-center gap-space-2\">\n {action}\n </div>\n )}\n </div>\n {description != null && (\n <Text as=\"p\" variant=\"sm\" color=\"tertiary\">\n {description}\n </Text>\n )}\n </div>\n )}\n {hasContent(children) && (\n <div className=\"flex flex-col divide-y divide-subtle overflow-hidden rounded-md border border-default bg-surface-level-1\">\n {children}\n </div>\n )}\n </section>\n );\n}\n\n/** One entry in an `AccordionItem`'s overflow menu. */\nexport interface AccordionItemMenuItem {\n /** The entry's name, in Title Case, such as Remove. */\n label: string;\n /** A quiet line under the label, such as what the entry does. */\n description?: string;\n /** Called when the viewer picks the entry; the menu then closes. */\n onSelect: () => void;\n /** `destructive` marks an entry that removes or revokes something. */\n tone?: 'default' | 'destructive';\n disabled?: boolean;\n}\n\nexport interface AccordionItemProps {\n /** A mark at 16px, which the item puts in a tile. */\n icon?: ReactNode;\n /** A person's or account's name, shown as an avatar in place of `icon`. */\n avatar?: string;\n title: ReactNode;\n /** Sits beside the title, such as a `StatusBadge`. */\n badge?: ReactNode;\n /** A quiet line under the title. */\n description?: ReactNode;\n /**\n * The item's own action, kept on its header whether or not it's expanded,\n * such as a `Switch`, a `Select` with `variant=\"plain\"`, or a button.\n */\n action?: ReactNode;\n /** Entries for the item's overflow menu, such as Rename or Remove. */\n menuItems?: AccordionItemMenuItem[];\n /**\n * The item's expandable body, shown below the header when expanded. Without\n * it the item doesn't expand.\n */\n contents?: ReactNode;\n defaultExpanded?: boolean;\n /** Called when the viewer expands or collapses the item. */\n onExpandedChange?: (expanded: boolean) => void;\n className?: string;\n}\n\n/**\n * One item in an `Accordion`: a header with a title, its action, and an\n * overflow menu, which expands to show its `contents` when it has any.\n */\nexport function AccordionItem({\n icon: iconProp,\n avatar,\n title,\n badge,\n description,\n action,\n menuItems,\n contents,\n defaultExpanded = false,\n onExpandedChange,\n className,\n}: AccordionItemProps) {\n const [expanded, setExpanded] = useState(defaultExpanded);\n function toggle() {\n setExpanded(!expanded);\n onExpandedChange?.(!expanded);\n }\n const bodyId = useId();\n const icon =\n avatar != null ? (\n <Avatar label={avatar} size=\"sm\" shape=\"circle\" />\n ) : (\n iconProp\n );\n const label = typeof title === 'string' ? title : 'item';\n const hasBody = hasContent(contents);\n\n const hasMenu = menuItems != null && menuItems.length > 0;\n\n return (\n <div className={cn('flex flex-col', className)}>\n {/* Everything centers on the header row, so the icon tile, the action,\n the menu, and the caret share one axis with or without a\n description. The tile and the trailing control are both 24px and\n inset by the row's px-space-3, mirroring each other. */}\n <div className=\"flex items-center gap-space-2 px-space-3 py-space-2\">\n {icon != null && (\n <span\n className={cn(\n 'flex size-6 shrink-0 items-center justify-center',\n // An avatar is its own shape, so it goes without the tile.\n avatar == null &&\n 'rounded-sm bg-surface-level-2 text-icon-secondary [&>*]:size-4'\n )}\n >\n {icon}\n </span>\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-x-space-3 gap-y-space-2\">\n {/* The title also toggles the item for a pointer; the caret is the\n control a keyboard or screen reader uses. */}\n <div\n className={cn(\n 'flex min-h-6 min-w-0 flex-1 basis-16 flex-col justify-center',\n hasBody && 'cursor-pointer'\n )}\n onClick={hasBody ? toggle : undefined}\n >\n <span className=\"flex min-w-0 items-center gap-space-2\">\n <Text\n as=\"span\"\n variant=\"sm\"\n weight=\"medium\"\n className=\"truncate text-primary\"\n >\n {title}\n </Text>\n {badge}\n </span>\n {description != null && (\n <Text\n as=\"span\"\n variant=\"xs\"\n color=\"tertiary\"\n className=\"truncate\"\n >\n {description}\n </Text>\n )}\n </div>\n\n {/* The title grows to fill the header, which keeps the action on\n the right until it wraps under the title. */}\n {action != null && (\n <div className=\"flex min-h-6 shrink-0 items-center gap-space-2\">\n {action}\n </div>\n )}\n </div>\n\n {/* Kept out of the wrapping area, so the menu and caret stay pinned\n to the row's right edge, opposite the icon tile. */}\n {(hasMenu || hasBody) && (\n <div className=\"flex shrink-0 items-center gap-space-2\">\n {hasMenu && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton\n icon={DotsThreeIcon}\n iconWeight=\"regular\"\n label={`${label} options`}\n variant=\"plain\"\n color=\"secondary\"\n size=\"sm\"\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"max-w-xs\">\n {menuItems.map((item) => (\n <DropdownMenuItem\n key={item.label}\n disabled={item.disabled}\n onSelect={item.onSelect}\n className=\"flex-col items-start justify-center\"\n >\n <Text\n as=\"span\"\n variant=\"sm\"\n color={\n item.tone === 'destructive' ? 'error' : 'primary'\n }\n >\n {item.label}\n </Text>\n {item.description != null && (\n <Text as=\"span\" variant=\"xs\" color=\"tertiary\">\n {item.description}\n </Text>\n )}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n {hasBody && (\n <IconButton\n icon={CaretDownIcon}\n iconWeight=\"regular\"\n label={expanded ? `Hide ${label}` : `Show ${label}`}\n variant=\"plain\"\n color=\"secondary\"\n size=\"sm\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={toggle}\n className={cn(\n '[&_svg]:transition-transform [&_svg]:duration-normal motion-reduce:[&_svg]:transition-none',\n !expanded && '[&_svg]:-rotate-90'\n )}\n />\n )}\n </div>\n )}\n </div>\n\n {hasBody && (\n <div\n id={bodyId}\n className={cn(\n animation.contentResize,\n 'motion-reduce:transition-none',\n expanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'\n )}\n >\n <div className=\"overflow-hidden\" inert={!expanded}>\n <div className=\"border-t border-subtle px-space-3 py-space-2\">\n {contents}\n </div>\n </div>\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,oBAAC,MAAD;QACE,IAAG;QACH,SAAQ;QACR,OACE,KAAK,SAAS,gBAAgB,UAAU;QAGzC,UAAA,KAAK;OACF,CAAA,GACL,KAAK,eAAe,QACnB,oBAAC,MAAD;QAAM,IAAG;QAAO,SAAQ;QAAK,OAAM;QAChC,UAAA,KAAK;OACF,CAAA,CAEQ;MAnBX,GAAA,KAAK,KAmBM,CACnB;KACkB,CAAA,CACT,EAAA,CAAA,GAEf,WACC,oBAAC,YAAD;MACE,MAAM;MACN,YAAW;MACX,OAAO,WAAW,QAAQ,UAAU,QAAQ;MAC5C,SAAQ;MACR,OAAM;MACN,MAAK;MACL,iBAAe;MACf,iBAAe;MACf,SAAS;MACT,WAAW,GACT,8FACA,CAAC,YAAY,oBACf;KACD,CAAA,CAEA;;GAEJ;EAEJ,CAAA,GAAA,WACC,oBAAC,OAAD;GACE,IAAI;GACJ,WAAW,GACT,UAAU,eACV,iCACA,WAAW,oBAAoB,iBACjC;GAEA,UAAA,oBAAC,OAAD;IAAK,WAAU;IAAkB,OAAO,CAAC;IACvC,UAAA,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA;IACE,CAAA;GACF,CAAA;EACF,CAAA,CAEJ;;AAET"}
|
|
@@ -2,15 +2,15 @@ import { cn } from "../../utils/cn.js";
|
|
|
2
2
|
import { CONTROL_SIZES, VISUAL_ELEMENT_SIZES } from "../../utils/componentSizes.js";
|
|
3
3
|
import { Text } from "../Text/Text.js";
|
|
4
4
|
import { SpinnerIcon } from "../Spinner/Spinner.js";
|
|
5
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
6
|
import { Button } from "../Button/Button.js";
|
|
6
7
|
import { Icon } from "../Icon/Icon.js";
|
|
7
|
-
import { IconButton } from "../IconButton/IconButton.js";
|
|
8
8
|
import { t as getAttachmentIcon } from "../../_chunks/render-attachment-icon-BWBEMxXZ.js";
|
|
9
9
|
import { forwardRef, useId } from "react";
|
|
10
|
-
import { FileIcon } from "@phosphor-icons/react/dist/ssr/File";
|
|
11
|
-
import { WarningCircleIcon } from "@phosphor-icons/react/dist/ssr/WarningCircle";
|
|
12
10
|
import { XIcon } from "@phosphor-icons/react/dist/ssr/X";
|
|
13
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { FileIcon } from "@phosphor-icons/react/dist/ssr/File";
|
|
13
|
+
import { WarningCircleIcon } from "@phosphor-icons/react/dist/ssr/WarningCircle";
|
|
14
14
|
//#region packages/components/src/components/Attachment/Attachment.tsx
|
|
15
15
|
var SIZE_STYLES = {
|
|
16
16
|
sm: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
2
|
import { VISUAL_ELEMENT_SIZES } from "../../utils/componentSizes.js";
|
|
3
|
-
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
4
3
|
import { getColorByString } from "../../utils/get-color-by-string.js";
|
|
4
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { sanitizeUrl } from "@braintree/sanitize-url";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { XIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { Text } from "../Text/Text.js";
|
|
3
|
-
import { Icon } from "../Icon/Icon.js";
|
|
4
4
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Icon } from "../Icon/Icon.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { CheckCircleIcon } from "@phosphor-icons/react/dist/ssr/CheckCircle";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
2
|
import { CONTROL_SIZES } from "../../utils/componentSizes.js";
|
|
3
3
|
import { Text } from "../Text/Text.js";
|
|
4
|
-
import { Badge } from "../Badge/Badge.js";
|
|
5
|
-
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
4
|
import { buttonStyleMap } from "./constants.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
|
+
import { Badge } from "../Badge/Badge.js";
|
|
7
7
|
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region packages/components/src/components/Button/Button.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { DotsSixVerticalIcon, XCloseIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { Text } from "../Text/Text.js";
|
|
3
|
-
import { IconButton } from "../IconButton/IconButton.js";
|
|
4
|
-
import { DotsSixVerticalIcon, XCloseIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
5
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "../DropdownMenu/DropdownMenu.js";
|
|
5
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
6
6
|
import { EmptyState } from "../EmptyState/EmptyState.js";
|
|
7
7
|
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
8
8
|
import { ChartCardSkeleton } from "./ChartCardSkeleton.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export type ChartCardSkeletonVariant = 'bar' | 'line' | 'donut' | 'metric' | 'sparkline' | 'sankey';
|
|
2
|
+
export type ChartCardSkeletonVariant = 'bar' | 'horizontal-bar' | 'line' | 'donut' | 'metric' | 'sparkline' | 'sankey';
|
|
3
3
|
export declare const ChartCardSkeleton: ({ variant, className, style, }: {
|
|
4
4
|
variant: ChartCardSkeletonVariant;
|
|
5
5
|
className?: string;
|
|
@@ -2,6 +2,13 @@ import { cn } from "../../utils/cn.js";
|
|
|
2
2
|
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region packages/components/src/components/ChartCard/ChartCardSkeleton.tsx
|
|
5
|
+
var HORIZONTAL_BAR_WIDTHS = [
|
|
6
|
+
"35%",
|
|
7
|
+
"62%",
|
|
8
|
+
"48%",
|
|
9
|
+
"78%",
|
|
10
|
+
"55%"
|
|
11
|
+
];
|
|
5
12
|
var BAR_HEIGHTS = [
|
|
6
13
|
"35%",
|
|
7
14
|
"62%",
|
|
@@ -40,6 +47,13 @@ var ChartCardSkeleton = ({ variant, className, style }) => /* @__PURE__ */ jsxs(
|
|
|
40
47
|
style: { height }
|
|
41
48
|
}, index))
|
|
42
49
|
}) }),
|
|
50
|
+
variant === "horizontal-bar" && /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "flex size-full flex-col gap-space-2 py-space-2",
|
|
52
|
+
children: HORIZONTAL_BAR_WIDTHS.map((width, index) => /* @__PURE__ */ jsx(Skeleton, {
|
|
53
|
+
className: "min-h-0 flex-1 rounded-l-none rounded-r-md motion-reduce:animate-none",
|
|
54
|
+
style: { width }
|
|
55
|
+
}, index))
|
|
56
|
+
}) }),
|
|
43
57
|
(variant === "line" || variant === "sparkline") && /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsx(Skeleton, {
|
|
44
58
|
className: "size-full rounded-none motion-reduce:animate-none",
|
|
45
59
|
style: { clipPath: "polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartCardSkeleton.js","names":[],"sources":["../../../src/components/ChartCard/ChartCardSkeleton.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Skeleton } from '../Skeleton';\n\nexport type ChartCardSkeletonVariant =\n | 'bar'\n | 'line'\n | 'donut'\n | 'metric'\n | 'sparkline'\n | 'sankey';\n\nconst BAR_HEIGHTS = ['35%', '62%', '48%', '78%', '55%', '70%', '42%'] as const;\n\nconst LegendSkeleton = () => (\n <div aria-hidden=\"true\" className=\"flex min-w-0 items-center gap-space-2\">\n <Skeleton className=\"h-4 w-20 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-24 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-16 motion-reduce:animate-none\" />\n </div>\n);\n\nconst Plot = ({ children }: { children: React.ReactNode }) => (\n <div className=\"relative min-h-0 flex-1 border-b border-l border-muted\">\n {/* Anchor percentage-sized marks to the plot even in auto-height cards. */}\n <div className=\"absolute inset-0 flex px-space-2\">{children}</div>\n </div>\n);\n\nexport const ChartCardSkeleton = ({\n variant,\n className,\n style,\n}: {\n variant: ChartCardSkeletonVariant;\n className?: string;\n style?: CSSProperties;\n}) => (\n <div\n role=\"status\"\n aria-label=\"Loading chart\"\n style={style}\n className={cn(\n 'flex min-h-[13.5rem] flex-1 flex-col gap-space-2',\n variant === 'metric' && 'min-h-0',\n className\n )}\n >\n {variant === 'bar' && (\n <Plot>\n <div className=\"flex size-full items-end gap-space-2\">\n {BAR_HEIGHTS.map((height, index) => (\n <Skeleton\n key={index}\n className=\"min-w-0 flex-1 rounded-b-none rounded-t-md motion-reduce:animate-none\"\n style={{ height }}\n />\n ))}\n </div>\n </Plot>\n )}\n {(variant === 'line' || variant === 'sparkline') && (\n <Plot>\n <Skeleton\n className=\"size-full rounded-none motion-reduce:animate-none\"\n style={{\n clipPath:\n 'polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)',\n }}\n />\n </Plot>\n )}\n {variant === 'donut' && (\n <div className=\"flex min-h-0 flex-1 items-center justify-center\">\n <div className=\"size-32 animate-pulse rounded-full border-[1.5rem] border-muted motion-reduce:animate-none\" />\n </div>\n )}\n {variant === 'sankey' && (\n <div aria-hidden=\"true\" className=\"relative min-h-0 flex-1\">\n <svg\n viewBox=\"0 0 400 192\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n fill=\"var(--bg-surface-level-3)\"\n className=\"absolute inset-0 size-full animate-pulse motion-reduce:animate-none\"\n >\n <g opacity={0.5}>\n {[0, 184].map((offset) => (\n <g key={offset} transform={`translate(${offset} 0)`}>\n <path d=\"M20 12H196V60H20Z\" />\n <path d=\"M20 60C108 60 108 108 196 108V132C108 132 108 84 20 84Z\" />\n <path d=\"M20 108C108 108 108 60 196 60V84C108 84 108 132 20 132Z\" />\n <path d=\"M20 132H196V180H20Z\" />\n </g>\n ))}\n </g>\n {[12, 196, 380].map((x) => (\n <g key={x}>\n <rect x={x} y={12} width={8} height={72} />\n <rect x={x} y={108} width={8} height={72} />\n </g>\n ))}\n </svg>\n </div>\n )}\n {variant === 'metric' && (\n <div className=\"flex min-h-0 flex-1 flex-col justify-center gap-space-2\">\n <Skeleton className=\"h-9 w-1/2 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-2/3 motion-reduce:animate-none\" />\n </div>\n )}\n {variant !== 'metric' && <LegendSkeleton />}\n </div>\n);\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ChartCardSkeleton.js","names":[],"sources":["../../../src/components/ChartCard/ChartCardSkeleton.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Skeleton } from '../Skeleton';\n\nexport type ChartCardSkeletonVariant =\n | 'bar'\n | 'horizontal-bar'\n | 'line'\n | 'donut'\n | 'metric'\n | 'sparkline'\n | 'sankey';\n\nconst HORIZONTAL_BAR_WIDTHS = ['35%', '62%', '48%', '78%', '55%'] as const;\n\nconst BAR_HEIGHTS = ['35%', '62%', '48%', '78%', '55%', '70%', '42%'] as const;\n\nconst LegendSkeleton = () => (\n <div aria-hidden=\"true\" className=\"flex min-w-0 items-center gap-space-2\">\n <Skeleton className=\"h-4 w-20 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-24 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-16 motion-reduce:animate-none\" />\n </div>\n);\n\nconst Plot = ({ children }: { children: React.ReactNode }) => (\n <div className=\"relative min-h-0 flex-1 border-b border-l border-muted\">\n {/* Anchor percentage-sized marks to the plot even in auto-height cards. */}\n <div className=\"absolute inset-0 flex px-space-2\">{children}</div>\n </div>\n);\n\nexport const ChartCardSkeleton = ({\n variant,\n className,\n style,\n}: {\n variant: ChartCardSkeletonVariant;\n className?: string;\n style?: CSSProperties;\n}) => (\n <div\n role=\"status\"\n aria-label=\"Loading chart\"\n style={style}\n className={cn(\n 'flex min-h-[13.5rem] flex-1 flex-col gap-space-2',\n variant === 'metric' && 'min-h-0',\n className\n )}\n >\n {variant === 'bar' && (\n <Plot>\n <div className=\"flex size-full items-end gap-space-2\">\n {BAR_HEIGHTS.map((height, index) => (\n <Skeleton\n key={index}\n className=\"min-w-0 flex-1 rounded-b-none rounded-t-md motion-reduce:animate-none\"\n style={{ height }}\n />\n ))}\n </div>\n </Plot>\n )}\n {variant === 'horizontal-bar' && (\n <Plot>\n <div className=\"flex size-full flex-col gap-space-2 py-space-2\">\n {HORIZONTAL_BAR_WIDTHS.map((width, index) => (\n <Skeleton\n key={index}\n className=\"min-h-0 flex-1 rounded-l-none rounded-r-md motion-reduce:animate-none\"\n style={{ width }}\n />\n ))}\n </div>\n </Plot>\n )}\n {(variant === 'line' || variant === 'sparkline') && (\n <Plot>\n <Skeleton\n className=\"size-full rounded-none motion-reduce:animate-none\"\n style={{\n clipPath:\n 'polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)',\n }}\n />\n </Plot>\n )}\n {variant === 'donut' && (\n <div className=\"flex min-h-0 flex-1 items-center justify-center\">\n <div className=\"size-32 animate-pulse rounded-full border-[1.5rem] border-muted motion-reduce:animate-none\" />\n </div>\n )}\n {variant === 'sankey' && (\n <div aria-hidden=\"true\" className=\"relative min-h-0 flex-1\">\n <svg\n viewBox=\"0 0 400 192\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n fill=\"var(--bg-surface-level-3)\"\n className=\"absolute inset-0 size-full animate-pulse motion-reduce:animate-none\"\n >\n <g opacity={0.5}>\n {[0, 184].map((offset) => (\n <g key={offset} transform={`translate(${offset} 0)`}>\n <path d=\"M20 12H196V60H20Z\" />\n <path d=\"M20 60C108 60 108 108 196 108V132C108 132 108 84 20 84Z\" />\n <path d=\"M20 108C108 108 108 60 196 60V84C108 84 108 132 20 132Z\" />\n <path d=\"M20 132H196V180H20Z\" />\n </g>\n ))}\n </g>\n {[12, 196, 380].map((x) => (\n <g key={x}>\n <rect x={x} y={12} width={8} height={72} />\n <rect x={x} y={108} width={8} height={72} />\n </g>\n ))}\n </svg>\n </div>\n )}\n {variant === 'metric' && (\n <div className=\"flex min-h-0 flex-1 flex-col justify-center gap-space-2\">\n <Skeleton className=\"h-9 w-1/2 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-2/3 motion-reduce:animate-none\" />\n </div>\n )}\n {variant !== 'metric' && <LegendSkeleton />}\n </div>\n);\n"],"mappings":";;;;AAcA,IAAM,wBAAwB;CAAC;CAAO;CAAO;CAAO;CAAO;AAAK;AAEhE,IAAM,cAAc;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAEpE,IAAM,uBACJ,qBAAC,OAAD;CAAK,eAAY;CAAO,WAAU;CAAlC,UAAA;EACE,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;EAC3D,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;EAC3D,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;CACxD;;AAGP,IAAM,QAAQ,EAAE,eACd,oBAAC,OAAD;CAAK,WAAU;CAEb,UAAA,oBAAC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2D,CAAA;OACnE,oBAAC,QAAD,EAAM,GAAE,sBAAuB,CAAA;MAC9B;KALK,GAAA,MAKL,CACJ;IACA,CAAA,GACF;KAAC;KAAI;KAAK;IAAG,CAAC,CAAC,KAAK,MACnB,qBAAC,KAAD,EAAA,UAAA,CACE,oBAAC,QAAD;KAAS;KAAG,GAAG;KAAI,OAAO;KAAG,QAAQ;IAAK,CAAA,GAC1C,oBAAC,QAAD;KAAS;KAAG,GAAG;KAAK,OAAO;KAAG,QAAQ;IAAK,CAAA,CAC1C,EAAA,GAHK,CAGL,CACJ,CACE;;EACF,CAAA;EAEN,YAAY,YACX,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,UAAD,EAAU,WAAU,uCAAwC,CAAA,GAC5D,oBAAC,UAAD,EAAU,WAAU,uCAAwC,CAAA,CACzD;;EAEN,YAAY,YAAY,oBAAC,gBAAD,CAAiB,CAAA;CACvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
2
3
|
import { Badge } from "../Badge/Badge.js";
|
|
3
4
|
import { Button } from "../Button/Button.js";
|
|
4
|
-
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
5
5
|
import { SPACE_SCALE_PX } from "../../utils/spacing.js";
|
|
6
6
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../Popover/Popover.js";
|
|
7
7
|
import { getChartLegendListColumns, getChartLegendListGridTemplate, widthsMatch } from "./utils.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CheckIcon, MinusIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { SELECTION_CONTROL_HIT_AREA_STYLES } from "../../utils/componentSizes.js";
|
|
3
4
|
import { Text } from "../Text/Text.js";
|
|
4
|
-
import { CheckIcon, MinusIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
5
5
|
import { checkboxBaseStyles, checkboxFocusStyles, checkboxIconSizes, checkboxIndicatorStyles, checkboxRootStateStyles, checkboxSizeStyles } from "./constants.js";
|
|
6
6
|
import { forwardRef, useId } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { CaretDownIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { Text } from "../Text/Text.js";
|
|
3
4
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
4
|
-
import { CaretDownIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
5
5
|
import { useCodeMirror } from "../../utils/useCodeMirror.js";
|
|
6
6
|
import { CopyIconButton } from "../CopyButton/CopyButton.js";
|
|
7
7
|
import { convertFile, getVisibleLines, parseFile } from "./CodeLite.utils.js";
|
|
8
8
|
import { CodeToolbar } from "./CodeToolbar.js";
|
|
9
9
|
import { Suspense, lazy, memo, useEffect, useRef, useState } from "react";
|
|
10
|
+
import { DotsThreeIcon } from "@phosphor-icons/react/dist/ssr/DotsThree";
|
|
10
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import { TableVirtuoso } from "react-virtuoso";
|
|
12
|
-
import { DotsThreeIcon } from "@phosphor-icons/react/dist/ssr/DotsThree";
|
|
13
13
|
//#region packages/components/src/components/Code/CodeLite.tsx
|
|
14
14
|
var LazyCodeLiteDiff = lazy(() => import("./CodeLiteDiff.js").then((module) => ({ default: module.CodeLiteDiff })));
|
|
15
15
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
|
-
import { Button } from "../Button/Button.js";
|
|
3
2
|
import zIndices from "../../utils/zIndices.js";
|
|
4
3
|
import { useZIndex } from "../../utils/useZIndex.js";
|
|
4
|
+
import { Button } from "../Button/Button.js";
|
|
5
5
|
import { Banner } from "../Banner/Banner.js";
|
|
6
6
|
import "../Banner/index.js";
|
|
7
7
|
import { useColorScheme } from "../../hooks/useColorScheme.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { CheckIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { OPTION_ROW_SIZES } from "../../utils/componentSizes.js";
|
|
3
4
|
import { Text } from "../Text/Text.js";
|
|
4
5
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
5
6
|
import { Icon } from "../Icon/Icon.js";
|
|
6
|
-
import { CheckIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
7
7
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "./Command.js";
|
|
8
8
|
import { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CheckIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { Text } from "../Text/Text.js";
|
|
2
|
-
import { Button } from "../Button/Button.js";
|
|
3
3
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "../Button/Button.js";
|
|
5
5
|
import { pickDataAttributes } from "../../utils/dataAttributes.js";
|
|
6
6
|
import { useCopy } from "./useCopy.js";
|
|
7
7
|
import { useState } from "react";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { XIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
|
-
import { Text } from "../Text/Text.js";
|
|
3
3
|
import zIndices from "../../utils/zIndices.js";
|
|
4
4
|
import { useZIndex } from "../../utils/useZIndex.js";
|
|
5
5
|
import { ZIndexProvider } from "../../utils/ZIndexContext.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Text } from "../Text/Text.js";
|
|
7
7
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Icon } from "../Icon/Icon.js";
|
|
9
9
|
import { pickDataAttributes } from "../../utils/dataAttributes.js";
|
|
10
10
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
11
11
|
import { ModalLayerProvider, ModalProvider, useCurrentModalLayer, useModalLayer } from "../../utils/ModalLayerContext.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { CaretRightIcon, XCloseIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { Text } from "../Text/Text.js";
|
|
3
|
-
import { Icon } from "../Icon/Icon.js";
|
|
4
4
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Icon } from "../Icon/Icon.js";
|
|
6
6
|
import { CopyIconButton } from "../CopyButton/CopyButton.js";
|
|
7
7
|
import { prettifyErrorPayload } from "../../utils/prettify-error-payload.js";
|
|
8
8
|
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { ExclamationMarkIcon } from "@phosphor-icons/react/dist/ssr/ExclamationMark";
|
|
11
10
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
11
|
+
import { ExclamationMarkIcon } from "@phosphor-icons/react/dist/ssr/ExclamationMark";
|
|
12
12
|
//#region packages/components/src/components/ErrorMessage/ErrorMessage.tsx
|
|
13
13
|
var sizeStyles = {
|
|
14
14
|
sm: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
2
|
import { CONTROL_SIZES } from "../../utils/componentSizes.js";
|
|
3
|
-
import { Spinner } from "../Spinner/Spinner.js";
|
|
4
|
-
import { buttonStyleMap } from "../Button/constants.js";
|
|
5
3
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
4
|
+
import { buttonStyleMap } from "../Button/constants.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
6
|
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region packages/components/src/components/IconButton/IconButton.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
2
|
import { Text } from "../Text/Text.js";
|
|
3
|
-
import { Icon } from "../Icon/Icon.js";
|
|
4
3
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
4
|
+
import { Icon } from "../Icon/Icon.js";
|
|
5
5
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
6
6
|
import { CONTROL_ICON_SIZES } from "../../utils/controlIconSizes.js";
|
|
7
7
|
import { INPUT_TEXT_CLASSES, getInputContainerClasses, getInputElementClasses } from "./inputStyles.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { CaretDoubleRightIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
|
-
import { Text } from "../Text/Text.js";
|
|
3
3
|
import zIndices from "../../utils/zIndices.js";
|
|
4
4
|
import { useZIndex } from "../../utils/useZIndex.js";
|
|
5
5
|
import { ZIndexProvider } from "../../utils/ZIndexContext.js";
|
|
6
|
+
import { Text } from "../Text/Text.js";
|
|
6
7
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
7
|
-
import { CaretDoubleRightIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
8
8
|
import { pickDataAttributes } from "../../utils/dataAttributes.js";
|
|
9
9
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
10
10
|
import { ModalLayerProvider, useCurrentModalLayer, useModalLayer } from "../../utils/ModalLayerContext.js";
|
|
@@ -18,6 +18,7 @@ export interface SelectGroup<T extends string = string> {
|
|
|
18
18
|
options: SelectOption<T>[];
|
|
19
19
|
}
|
|
20
20
|
export type SelectSize = ControlSize;
|
|
21
|
+
export type SelectVariant = 'outlined' | 'plain';
|
|
21
22
|
interface SelectBaseProps<T extends string = string> extends DataAttributes {
|
|
22
23
|
/** The currently selected value */
|
|
23
24
|
value?: T;
|
|
@@ -51,6 +52,13 @@ interface SelectBaseProps<T extends string = string> extends DataAttributes {
|
|
|
51
52
|
endReachedThresholdPx?: number;
|
|
52
53
|
/** Additional class name for the trigger button */
|
|
53
54
|
triggerClassName?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Trigger appearance. `outlined` (default) is a full-width form field.
|
|
57
|
+
* `plain` drops the field fill and border and sizes the trigger to its
|
|
58
|
+
* value, so it reads as text until hovered — for an inline setting in a row,
|
|
59
|
+
* such as a member's role, where a field box would crowd it.
|
|
60
|
+
*/
|
|
61
|
+
variant?: SelectVariant;
|
|
54
62
|
/** Additional class name for the popover content */
|
|
55
63
|
contentClassName?: string;
|
|
56
64
|
/** Custom render function for the selected value in the trigger */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { CaretDownIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { CONTROL_SIZES } from "../../utils/componentSizes.js";
|
|
3
4
|
import { Text } from "../Text/Text.js";
|
|
4
5
|
import { Button } from "../Button/Button.js";
|
|
5
6
|
import { Icon } from "../Icon/Icon.js";
|
|
6
|
-
import { CaretDownIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
7
7
|
import { pickDataAttributes } from "../../utils/dataAttributes.js";
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from "../Popover/Popover.js";
|
|
9
9
|
import { CONTROL_ICON_SIZES } from "../../utils/controlIconSizes.js";
|
|
@@ -21,7 +21,7 @@ function optionToItem(opt) {
|
|
|
21
21
|
keywords: opt.label ? [opt.label] : void 0
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function OptionSelect({ value, onChange, options, groups, placeholder = "Select...", searchPlaceholder = "Search...", disabled = false, size = "sm", emptyText = "No results found.", open: controlledOpen, onOpenChange: controlledOnOpenChange, allowDeselect, hideSearch = true, disableFilter, onSearchChange, loading, loadingRows, onEndReached, endReachedThresholdPx, triggerClassName, contentClassName, renderValue, renderOption, side, align = "start", "aria-label": ariaLabel, "data-testid": dataTestId, ...rest }) {
|
|
24
|
+
function OptionSelect({ value, onChange, options, groups, placeholder = "Select...", searchPlaceholder = "Search...", disabled = false, size = "sm", emptyText = "No results found.", open: controlledOpen, onOpenChange: controlledOnOpenChange, allowDeselect, hideSearch = true, disableFilter, onSearchChange, loading, loadingRows, onEndReached, endReachedThresholdPx, triggerClassName, variant = "outlined", contentClassName, renderValue, renderOption, side, align = "start", "aria-label": ariaLabel, "data-testid": dataTestId, ...rest }) {
|
|
25
25
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
26
26
|
const isControlled = controlledOpen !== void 0;
|
|
27
27
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
@@ -85,10 +85,10 @@ function OptionSelect({ value, onChange, options, groups, placeholder = "Select.
|
|
|
85
85
|
role: "combobox",
|
|
86
86
|
"aria-expanded": open,
|
|
87
87
|
"aria-label": ariaLabel ?? placeholder,
|
|
88
|
-
variant
|
|
88
|
+
variant,
|
|
89
89
|
color: "secondary",
|
|
90
90
|
size: triggerButtonSize,
|
|
91
|
-
className: cn("box-border
|
|
91
|
+
className: cn("box-border justify-between py-0", CONTROL_SIZES[size].heightClassName, variant === "plain" ? cn("w-auto max-w-full gap-space-1 px-space-1", disabled && "bg-disabled text-disabled dark:bg-disabled") : cn("w-full", disabled ? "border-muted bg-input-disabled text-disabled dark:bg-input-disabled" : "bg-input border-muted hover:border-subtle focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none"), triggerClassName),
|
|
92
92
|
disabled,
|
|
93
93
|
"data-testid": dataTestId,
|
|
94
94
|
children: [triggerContent, /* @__PURE__ */ jsx(Icon, {
|