tfy-web-components 0.0.34 → 0.0.35
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/README.md +49 -58
- package/dist/Button-C77b7jpW.js +284 -0
- package/dist/Button-C77b7jpW.js.map +1 -0
- package/dist/CompositeItem-BGwD51jI.js +33 -0
- package/dist/CompositeItem-BGwD51jI.js.map +1 -0
- package/dist/CompositeList-D4xmSZ5V.js +291 -0
- package/dist/CompositeList-D4xmSZ5V.js.map +1 -0
- package/dist/CompositeRoot-BxrPc7F6.js +351 -0
- package/dist/CompositeRoot-BxrPc7F6.js.map +1 -0
- package/dist/DirectionContext-Pb9yafF5.js +11 -0
- package/dist/DirectionContext-Pb9yafF5.js.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.js +13 -0
- package/dist/FieldItemContext-DRVgx-D1.js.map +1 -0
- package/dist/{Input-BvwIpntS.js → Input-Dhmo6L2n.js} +100 -78
- package/dist/Input-Dhmo6L2n.js.map +1 -0
- package/dist/Modal-C4MUy9GD.js +696 -0
- package/dist/Modal-C4MUy9GD.js.map +1 -0
- package/dist/{MonacoEditorCore-xfpJ6z-E.js → MonacoEditorCore-n-df5f7I.js} +2 -2
- package/dist/{MonacoEditorCore-xfpJ6z-E.js.map → MonacoEditorCore-n-df5f7I.js.map} +1 -1
- package/dist/Popover-eC_vX5By.js +1074 -0
- package/dist/Popover-eC_vX5By.js.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js.map +1 -0
- package/dist/Tooltip-BuGLP-PU.js +4096 -0
- package/dist/Tooltip-BuGLP-PU.js.map +1 -0
- package/dist/classNames-B1XpQHle.js +44 -0
- package/dist/classNames-B1XpQHle.js.map +1 -0
- package/dist/components/atoms/Accordion.d.ts +19 -37
- package/dist/components/atoms/Accordion.es.js +847 -78
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/AudioPlayer.es.js +9 -9
- package/dist/components/atoms/AudioPlayer.es.js.map +1 -1
- package/dist/components/atoms/Avatar.d.ts +42 -9
- package/dist/components/atoms/Avatar.es.js +491 -36
- package/dist/components/atoms/Avatar.es.js.map +1 -1
- package/dist/components/atoms/Badge.d.ts +40 -35
- package/dist/components/atoms/Badge.es.js +163 -53
- package/dist/components/atoms/Badge.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +37 -16
- package/dist/components/atoms/Button.es.js +16 -221
- package/dist/components/atoms/Button.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.d.ts +53 -0
- package/dist/components/atoms/ButtonGroup.es.js +349 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +23 -9
- package/dist/components/atoms/IconButton.es.js +82 -16
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/IconProvider.d.ts +1 -1
- package/dist/components/atoms/IconProvider.es.js +48 -7
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- package/dist/components/atoms/Modal.d.ts +27 -3
- package/dist/components/atoms/Modal.es.js +15 -16
- package/dist/components/atoms/Modal.es.js.map +1 -1
- package/dist/components/atoms/Notification.d.ts +1 -1
- package/dist/components/atoms/Notification.es.js +26 -3
- package/dist/components/atoms/Notification.es.js.map +1 -1
- package/dist/components/atoms/OutlinedRadio.d.ts +6 -2
- package/dist/components/atoms/OutlinedRadio.es.js +12 -25
- package/dist/components/atoms/OutlinedRadio.es.js.map +1 -1
- package/dist/components/atoms/Progress.d.ts +48 -0
- package/dist/components/atoms/Progress.es.js +279 -0
- package/dist/components/atoms/Progress.es.js.map +1 -0
- package/dist/components/atoms/Skeleton.d.ts +9 -3
- package/dist/components/atoms/Skeleton.es.js +33 -3
- package/dist/components/atoms/Skeleton.es.js.map +1 -1
- package/dist/components/atoms/Spinner.d.ts +15 -4
- package/dist/components/atoms/Spinner.es.js +86 -22
- package/dist/components/atoms/Spinner.es.js.map +1 -1
- package/dist/components/atoms/Switch.d.ts +19 -7
- package/dist/components/atoms/Switch.es.js +288 -50
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.d.ts +17 -3
- package/dist/components/atoms/TabButton.es.js +647 -25
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/TabPanel.es.js +1 -1
- package/dist/components/atoms/Tag.d.ts +43 -0
- package/dist/components/atoms/Tag.es.js +219 -0
- package/dist/components/atoms/Tag.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +36 -14
- package/dist/components/atoms/Tooltip.es.js +7 -114
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.d.ts +1 -1
- package/dist/components/molecules/Alert.es.js +13 -9
- package/dist/components/molecules/Alert.es.js.map +1 -1
- package/dist/components/molecules/CopyField.d.ts +2 -2
- package/dist/components/molecules/CopyField.es.js +3 -4
- package/dist/components/molecules/CopyField.es.js.map +1 -1
- package/dist/components/molecules/CustomDrawer.d.ts +5 -4
- package/dist/components/molecules/CustomDrawer.es.js +141 -82
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
- package/dist/components/molecules/Dialog.d.ts +16 -8
- package/dist/components/molecules/Dialog.es.js +33 -31
- package/dist/components/molecules/Dialog.es.js.map +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +15 -11
- package/dist/components/molecules/ImagesPreview.es.js.map +1 -1
- package/dist/components/molecules/Input.d.ts +1 -1
- package/dist/components/molecules/Input.es.js +3 -5
- package/dist/components/molecules/Input.es.js.map +1 -1
- package/dist/components/molecules/Markdown/ExpandableMarkdown.d.ts +8 -8
- package/dist/components/molecules/Markdown/components.d.ts +12 -11
- package/dist/components/molecules/Markdown.es.js +26 -49
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/Notify.d.ts +30 -1
- package/dist/components/molecules/Notify.es.js +91 -36
- package/dist/components/molecules/Notify.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +32 -19
- package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
- package/dist/components/molecules/ToggleButton.d.ts +3 -2
- package/dist/components/molecules/ToggleButton.es.js +155 -57
- package/dist/components/molecules/ToggleButton.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessage.es.js +2 -2
- package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +5 -5
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/index.d.ts +0 -6
- package/dist/components/molecules/agent-chat.es.js +76 -407
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/components/molecules/monacoEditorCore/MonacoEditorCore.d.ts +0 -1
- package/dist/components/theme/colors.d.ts +17 -53
- package/dist/components/theme/colors.es.js +384 -180
- package/dist/components/theme/colors.es.js.map +1 -1
- package/dist/components/theme/theme.d.ts +14 -11
- package/dist/components/theme/theme.es.js +3 -64
- package/dist/components/theme/theme.es.js.map +1 -1
- package/dist/components/theme/useTheme.es.js +1 -4
- package/dist/components/theme/useTheme.es.js.map +1 -1
- package/dist/composite-CrCQWAKA.js +108 -0
- package/dist/composite-CrCQWAKA.js.map +1 -0
- package/dist/composite-DCpXNxz9.js +66 -0
- package/dist/composite-DCpXNxz9.js.map +1 -0
- package/dist/conversions-CbWPvHRE.js +14 -0
- package/dist/conversions-CbWPvHRE.js.map +1 -0
- package/dist/error-FX4R42W-.js +6 -0
- package/dist/error-FX4R42W-.js.map +1 -0
- package/dist/fonts.css +7 -0
- package/dist/hooks/useContainerDimensions.d.ts +1 -1
- package/dist/index-B806bfA-.js +257 -0
- package/dist/index-B806bfA-.js.map +1 -0
- package/dist/index-DSVg79g-.js +45 -0
- package/dist/index-DSVg79g-.js.map +1 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.es.js +56 -9
- package/dist/index.es.js.map +1 -1
- package/dist/inertValue-IJM5NA30.js +11 -0
- package/dist/inertValue-IJM5NA30.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/markdown.css +13 -14
- package/dist/new-components/atoms/Checkbox.d.ts +6 -0
- package/dist/new-components/atoms/Checkbox.es.js +423 -0
- package/dist/new-components/atoms/Checkbox.es.js.map +1 -0
- package/dist/new-components/atoms/Chip.d.ts +38 -0
- package/dist/new-components/atoms/Chip.es.js +269 -0
- package/dist/new-components/atoms/Chip.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.d.ts +87 -0
- package/dist/new-components/atoms/Popover.es.js +21 -0
- package/dist/new-components/atoms/Popover.es.js.map +1 -0
- package/dist/new-components/atoms/Radio.d.ts +14 -0
- package/dist/new-components/atoms/Radio.es.js +536 -0
- package/dist/new-components/atoms/Radio.es.js.map +1 -0
- package/dist/new-components/atoms/SegmentedControl.d.ts +28 -0
- package/dist/new-components/atoms/SegmentedControl.es.js +326 -0
- package/dist/new-components/atoms/SegmentedControl.es.js.map +1 -0
- package/dist/new-components/atoms/Slider.d.ts +8 -0
- package/dist/new-components/atoms/Slider.es.js +1415 -0
- package/dist/new-components/atoms/Slider.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.d.ts +43 -0
- package/dist/new-components/atoms/Toggletip.es.js +216 -0
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -0
- package/dist/new-components/atoms/stories/ThemeComparison.d.ts +8 -0
- package/dist/shadowDom-Bq4g0Qeu.js +52 -0
- package/dist/shadowDom-Bq4g0Qeu.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/theme.css +9 -154
- package/dist/tokens.css +1136 -0
- package/dist/useAnimationFrame-DwhymJoW.js +108 -0
- package/dist/useAnimationFrame-DwhymJoW.js.map +1 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js +49 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js.map +1 -0
- package/dist/useBaseUiId-Ch7ujXpo.js +281 -0
- package/dist/useBaseUiId-Ch7ujXpo.js.map +1 -0
- package/dist/useButton-PUBhT4Vo.js +235 -0
- package/dist/useButton-PUBhT4Vo.js.map +1 -0
- package/dist/useControlled-BSyYkg5C.js +65 -0
- package/dist/useControlled-BSyYkg5C.js.map +1 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js +499 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js.map +1 -0
- package/dist/useLabelableId-DCLzrdD-.js +241 -0
- package/dist/useLabelableId-DCLzrdD-.js.map +1 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js +1086 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js.map +1 -0
- package/dist/usePopupHandleStore-BdS-xYID.js +2372 -0
- package/dist/usePopupHandleStore-BdS-xYID.js.map +1 -0
- package/dist/useTimeout-BXf1hDIL.js +46 -0
- package/dist/useTimeout-BXf1hDIL.js.map +1 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js +202 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js.map +1 -0
- package/dist/useValueAsRef-BfFRcMg6.js +28 -0
- package/dist/useValueAsRef-BfFRcMg6.js.map +1 -0
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/visuallyHidden-B6H2X3_Y.js +26 -0
- package/dist/visuallyHidden-B6H2X3_Y.js.map +1 -0
- package/dist/vite-env.d.ts +18 -0
- package/package.json +30 -22
- package/dist/Input-BvwIpntS.js.map +0 -1
- package/dist/Notification-BT4CZ69U.js +0 -39
- package/dist/Notification-BT4CZ69U.js.map +0 -1
- package/dist/RootFontSizeContext-7vgn7Y_k.js +0 -22
- package/dist/RootFontSizeContext-7vgn7Y_k.js.map +0 -1
- package/dist/classNames-Dy-RXSjS.js +0 -9
- package/dist/classNames-Dy-RXSjS.js.map +0 -1
- package/dist/components/molecules/DropdownMenu.d.ts +0 -18
- package/dist/components/molecules/DropdownMenu.es.js +0 -104
- package/dist/components/molecules/DropdownMenu.es.js.map +0 -1
- package/dist/components/molecules/ThumbsFeedback.d.ts +0 -13
- package/dist/components/molecules/ThumbsFeedback.es.js +0 -98
- package/dist/components/molecules/ThumbsFeedback.es.js.map +0 -1
- package/dist/components/molecules/agent-chat/SandboxToolCall.d.ts +0 -15
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +0 -26
- package/dist/components/molecules/agent-chat/ToolCallContentBlock.d.ts +0 -17
- package/dist/components/theme/lightColorPlugin.d.ts +0 -1
- package/dist/components/theme/lightColorPlugin.es.js +0 -92
- package/dist/components/theme/lightColorPlugin.es.js.map +0 -1
- package/dist/tailwindPreset.d.ts +0 -144
- package/dist/tailwindPreset.es.js +0 -100
- package/dist/tailwindPreset.es.js.map +0 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as cva } from "../../index-DSVg79g-.js";
|
|
3
|
+
import { faCheck, faXmark, faPlus, faCircleExclamation, faBook } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import IconProvider from "../../components/atoms/IconProvider.es.js";
|
|
5
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
6
|
+
const NEUTRAL_SURFACE = "border-border-secondary bg-background-fill-secondary text-text-primary hover:border-border-default hover:bg-background-fill-ghost-hover";
|
|
7
|
+
const OVERLAY_SURFACE = "border-border-subtle bg-background-surface-overlay text-text-primary hover:border-border-default hover:bg-background-fill-ghost-hover";
|
|
8
|
+
const ADD_SURFACE = "border-dashed border-border-default bg-transparent text-text-secondary hover:bg-background-fill-ghost-hover";
|
|
9
|
+
const chipVariants = cva(
|
|
10
|
+
"group inline-flex w-fit shrink-0 cursor-pointer items-center justify-center gap-space-4 whitespace-nowrap border text-label-sm transition-colors focus-ring disabled:pointer-events-none disabled:opacity-50",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
behavior: {
|
|
14
|
+
filter: "",
|
|
15
|
+
input: "",
|
|
16
|
+
assist: "",
|
|
17
|
+
count: "",
|
|
18
|
+
permission: "",
|
|
19
|
+
"key-value": ""
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
sm: "h-5 py-0.5",
|
|
23
|
+
md: "h-6 py-1",
|
|
24
|
+
lg: "h-7 py-1 text-label-md"
|
|
25
|
+
},
|
|
26
|
+
inset: {
|
|
27
|
+
default: "px-space-8",
|
|
28
|
+
cell: "overflow-hidden py-0 pr-space-8 pl-0",
|
|
29
|
+
icon: "w-13 px-0",
|
|
30
|
+
avatar: "px-space-4 py-0"
|
|
31
|
+
},
|
|
32
|
+
roundness: {
|
|
33
|
+
default: "rounded-sm",
|
|
34
|
+
pill: "rounded-pill",
|
|
35
|
+
none: "rounded-none"
|
|
36
|
+
},
|
|
37
|
+
selected: { true: "", false: "" },
|
|
38
|
+
state: { add: "", selected: "", remove: "", status: "", special: "" },
|
|
39
|
+
error: { true: "", false: "" }
|
|
40
|
+
},
|
|
41
|
+
compoundVariants: [
|
|
42
|
+
{ behavior: ["filter", "assist"], selected: false, className: NEUTRAL_SURFACE },
|
|
43
|
+
{
|
|
44
|
+
behavior: "filter",
|
|
45
|
+
selected: true,
|
|
46
|
+
className: "border-border-brand-bold bg-background-fill-brand-selected text-text-inverse hover:bg-background-fill-brand-hover hover:text-text-on-solid"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
behavior: "count",
|
|
50
|
+
className: "border-transparent bg-background-surface-selected text-text-secondary hover:border-border-default hover:bg-background-fill-ghost-hover"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
behavior: "permission",
|
|
54
|
+
className: "gap-space-8 bg-background-surface-striped text-text-primary hover:bg-background-fill-ghost-hover"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
behavior: "permission",
|
|
58
|
+
selected: false,
|
|
59
|
+
className: "border-background-item-hover hover:border-border-default"
|
|
60
|
+
},
|
|
61
|
+
{ behavior: "permission", selected: true, className: "border-background-fill-brand" },
|
|
62
|
+
{ behavior: ["input", "key-value"], state: "add", className: ADD_SURFACE },
|
|
63
|
+
{
|
|
64
|
+
behavior: "input",
|
|
65
|
+
state: ["selected", "remove"],
|
|
66
|
+
error: false,
|
|
67
|
+
className: "border-border-secondary bg-background-surface-input text-text-secondary hover:border-border-default hover:bg-background-fill-ghost-hover"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
behavior: "input",
|
|
71
|
+
state: ["selected", "remove"],
|
|
72
|
+
error: true,
|
|
73
|
+
className: "border-border-error bg-background-surface-error text-text-primary"
|
|
74
|
+
},
|
|
75
|
+
{ behavior: "key-value", state: ["selected", "status", "remove"], className: NEUTRAL_SURFACE },
|
|
76
|
+
{ behavior: "key-value", state: "special", className: OVERLAY_SURFACE },
|
|
77
|
+
{ behavior: "key-value", inset: "avatar", className: OVERLAY_SURFACE },
|
|
78
|
+
{ size: "lg", inset: "default", className: "px-space-10" }
|
|
79
|
+
],
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
behavior: "filter",
|
|
82
|
+
size: "md",
|
|
83
|
+
inset: "default",
|
|
84
|
+
roundness: "default",
|
|
85
|
+
selected: false,
|
|
86
|
+
error: false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
const CELL = "inline-flex shrink-0 items-center self-stretch border-r";
|
|
91
|
+
function resolveFilterIcons(selected, leading, trailing) {
|
|
92
|
+
if (!selected) return { leading, trailing };
|
|
93
|
+
if (trailing != null && leading == null) return { leading: void 0, trailing: faCheck };
|
|
94
|
+
return { leading: faCheck, trailing };
|
|
95
|
+
}
|
|
96
|
+
function resolveRoundness(behavior, roundness) {
|
|
97
|
+
if (behavior === "permission") return "none";
|
|
98
|
+
if (behavior === "input" || behavior === "count" || behavior === "key-value") return roundness;
|
|
99
|
+
return "default";
|
|
100
|
+
}
|
|
101
|
+
function Chip({
|
|
102
|
+
behavior = "filter",
|
|
103
|
+
size = "md",
|
|
104
|
+
roundness = "default",
|
|
105
|
+
selected = false,
|
|
106
|
+
state,
|
|
107
|
+
error = false,
|
|
108
|
+
appearance = "default",
|
|
109
|
+
leadingCell = false,
|
|
110
|
+
avatar,
|
|
111
|
+
leadingIcon,
|
|
112
|
+
trailingIcon,
|
|
113
|
+
label,
|
|
114
|
+
valueLabel,
|
|
115
|
+
children,
|
|
116
|
+
className,
|
|
117
|
+
type = "button",
|
|
118
|
+
...props
|
|
119
|
+
}) {
|
|
120
|
+
const resolvedBehavior = behavior ?? "filter";
|
|
121
|
+
const resolvedSize = size ?? "md";
|
|
122
|
+
const iconSize = resolvedSize === "lg" ? 0.875 : 0.75;
|
|
123
|
+
const isToggle = resolvedBehavior === "filter" || resolvedBehavior === "permission";
|
|
124
|
+
const isSelected = isToggle && !!selected;
|
|
125
|
+
const resolvedState = resolvedBehavior === "input" ? state ?? (selected ? "remove" : "add") : resolvedBehavior === "key-value" ? state ?? "selected" : void 0;
|
|
126
|
+
const hasError = resolvedBehavior === "input" && resolvedState !== "add" && error;
|
|
127
|
+
const icon = (glyph, iconClassName) => /* @__PURE__ */ jsx(IconProvider, { "aria-hidden": true, icon: glyph, size: iconSize, className: classNames("shrink-0", iconClassName) });
|
|
128
|
+
const text = (content2, slot, textClassName) => content2 != null && content2 !== false ? /* @__PURE__ */ jsx("span", { "data-slot": slot, className: textClassName, children: content2 }) : null;
|
|
129
|
+
let inset = "default";
|
|
130
|
+
let content;
|
|
131
|
+
if (resolvedBehavior === "permission") {
|
|
132
|
+
inset = "cell";
|
|
133
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
134
|
+
/* @__PURE__ */ jsxs(
|
|
135
|
+
"span",
|
|
136
|
+
{
|
|
137
|
+
"aria-hidden": true,
|
|
138
|
+
"data-slot": "chip-cell",
|
|
139
|
+
className: classNames(
|
|
140
|
+
CELL,
|
|
141
|
+
"relative w-5 justify-center",
|
|
142
|
+
isSelected ? "border-background-fill-brand text-background-fill-brand" : "border-background-item-hover text-border-brand group-hover:border-border-default"
|
|
143
|
+
),
|
|
144
|
+
children: [
|
|
145
|
+
isSelected && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 bg-background-fill-brand/25" }),
|
|
146
|
+
/* @__PURE__ */ jsx(IconProvider, { icon: faCheck, size: 0.75, className: "relative" })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
text(children ?? label, "chip-label")
|
|
151
|
+
] });
|
|
152
|
+
} else if (resolvedBehavior === "input") {
|
|
153
|
+
const labelContent = children ?? label;
|
|
154
|
+
if (resolvedState === "add") {
|
|
155
|
+
if (labelContent == null) inset = "icon";
|
|
156
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
157
|
+
icon(leadingIcon ?? faPlus, "text-icon-secondary"),
|
|
158
|
+
text(labelContent, "chip-label"),
|
|
159
|
+
trailingIcon && icon(trailingIcon, "text-icon-secondary")
|
|
160
|
+
] });
|
|
161
|
+
} else {
|
|
162
|
+
const trailing = resolvedState === "remove" ? trailingIcon ?? faXmark : trailingIcon;
|
|
163
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
164
|
+
hasError ? icon(faCircleExclamation, "text-icon-error") : leadingIcon && icon(leadingIcon, "text-icon-secondary"),
|
|
165
|
+
text(labelContent, "chip-label"),
|
|
166
|
+
trailing && icon(trailing, "text-icon-primary")
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
} else if (resolvedBehavior === "key-value") {
|
|
170
|
+
const value = valueLabel ?? children;
|
|
171
|
+
const isTinted = appearance === "tinted";
|
|
172
|
+
if (resolvedState === "add") {
|
|
173
|
+
inset = "icon";
|
|
174
|
+
content = icon(leadingIcon ?? faPlus, "text-icon-secondary");
|
|
175
|
+
} else if (avatar != null) {
|
|
176
|
+
inset = "avatar";
|
|
177
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
178
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "chip-avatar", className: "inline-flex size-4 shrink-0 overflow-hidden rounded-pill", children: avatar }),
|
|
179
|
+
text(value, "chip-value", "text-text-primary"),
|
|
180
|
+
resolvedState === "status" && /* @__PURE__ */ jsx("span", { "data-slot": "chip-status", className: "size-1.5 shrink-0 rounded-pill bg-icon-success" }),
|
|
181
|
+
(resolvedState === "remove" || resolvedState === "special") && icon(faXmark, "text-icon-primary")
|
|
182
|
+
] });
|
|
183
|
+
} else {
|
|
184
|
+
const isSpecial = resolvedState === "special";
|
|
185
|
+
const hasLeadingCell = leadingCell && leadingIcon != null && !isSpecial;
|
|
186
|
+
if (isSpecial || hasLeadingCell || isTinted) inset = "cell";
|
|
187
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
188
|
+
isSpecial && /* @__PURE__ */ jsx(
|
|
189
|
+
"span",
|
|
190
|
+
{
|
|
191
|
+
"data-slot": "chip-cell",
|
|
192
|
+
className: classNames(
|
|
193
|
+
CELL,
|
|
194
|
+
"border-border-subtle bg-background-fill-brand-selected px-space-8 text-text-inverse"
|
|
195
|
+
),
|
|
196
|
+
children: icon(leadingIcon ?? faBook)
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
hasLeadingCell && /* @__PURE__ */ jsx(
|
|
200
|
+
"span",
|
|
201
|
+
{
|
|
202
|
+
"data-slot": "chip-cell",
|
|
203
|
+
className: classNames(
|
|
204
|
+
CELL,
|
|
205
|
+
"w-5 justify-center border-border-secondary bg-background-surface-brand text-icon-brand"
|
|
206
|
+
),
|
|
207
|
+
children: icon(leadingIcon)
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
!isSpecial && !hasLeadingCell && !isTinted && leadingIcon && icon(leadingIcon, "text-icon-secondary"),
|
|
211
|
+
isTinted ? /* @__PURE__ */ jsxs(
|
|
212
|
+
"span",
|
|
213
|
+
{
|
|
214
|
+
"data-slot": "chip-key",
|
|
215
|
+
className: classNames(
|
|
216
|
+
CELL,
|
|
217
|
+
"gap-space-4 border-border-secondary bg-background-surface-brand px-space-8 text-text-primary"
|
|
218
|
+
),
|
|
219
|
+
children: [
|
|
220
|
+
!hasLeadingCell && leadingIcon && icon(leadingIcon, "text-icon-secondary"),
|
|
221
|
+
label
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
) : text(label, "chip-key", appearance === "mono" ? "text-code-sm text-text-secondary" : "text-text-primary"),
|
|
225
|
+
text(value, "chip-value", appearance === "default" ? "text-text-tertiary" : "text-text-primary"),
|
|
226
|
+
resolvedState === "status" && /* @__PURE__ */ jsx("span", { "data-slot": "chip-status", className: "size-1.5 shrink-0 rounded-pill bg-icon-success" }),
|
|
227
|
+
(resolvedState === "remove" || isSpecial) && icon(faXmark, "text-icon-primary")
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
} else if (resolvedBehavior === "count") {
|
|
231
|
+
content = text(children ?? label, "chip-label");
|
|
232
|
+
} else {
|
|
233
|
+
const icons = resolvedBehavior === "filter" ? resolveFilterIcons(isSelected, leadingIcon, trailingIcon) : { leading: leadingIcon, trailing: trailingIcon };
|
|
234
|
+
const iconClass = isSelected ? void 0 : "text-icon-secondary";
|
|
235
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
236
|
+
icons.leading && icon(icons.leading, iconClass),
|
|
237
|
+
text(children ?? label, "chip-label"),
|
|
238
|
+
icons.trailing && icon(icons.trailing, iconClass)
|
|
239
|
+
] });
|
|
240
|
+
}
|
|
241
|
+
return /* @__PURE__ */ jsx(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
"data-slot": "chip",
|
|
245
|
+
"data-selected": isSelected ? "" : void 0,
|
|
246
|
+
"aria-pressed": isToggle ? isSelected : void 0,
|
|
247
|
+
type,
|
|
248
|
+
...props,
|
|
249
|
+
className: classNames(
|
|
250
|
+
chipVariants({
|
|
251
|
+
behavior: resolvedBehavior,
|
|
252
|
+
size: resolvedSize,
|
|
253
|
+
inset,
|
|
254
|
+
roundness: resolveRoundness(resolvedBehavior, roundness ?? "default"),
|
|
255
|
+
selected: isSelected,
|
|
256
|
+
state: resolvedState,
|
|
257
|
+
error: hasError
|
|
258
|
+
}),
|
|
259
|
+
className
|
|
260
|
+
),
|
|
261
|
+
children: content
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
export {
|
|
266
|
+
chipVariants,
|
|
267
|
+
Chip as default
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=Chip.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.es.js","sources":["../../../src/new-components/atoms/Chip.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva } from 'class-variance-authority'\nimport { faBook, faCheck, faCircleExclamation, faPlus, faXmark } from '@fortawesome/free-solid-svg-icons'\n\nimport IconProvider, { type IconProp } from '@/components/atoms/IconProvider'\nimport { cn } from '@/lib/utils'\n\nconst NEUTRAL_SURFACE =\n 'border-border-secondary bg-background-fill-secondary text-text-primary hover:border-border-default hover:bg-background-fill-ghost-hover'\nconst OVERLAY_SURFACE =\n 'border-border-subtle bg-background-surface-overlay text-text-primary hover:border-border-default hover:bg-background-fill-ghost-hover'\nconst ADD_SURFACE =\n 'border-dashed border-border-default bg-transparent text-text-secondary hover:bg-background-fill-ghost-hover'\n\nconst chipVariants = cva(\n 'group inline-flex w-fit shrink-0 cursor-pointer items-center justify-center gap-space-4 whitespace-nowrap border text-label-sm transition-colors focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n behavior: {\n filter: '',\n input: '',\n assist: '',\n count: '',\n permission: '',\n 'key-value': '',\n },\n size: {\n sm: 'h-5 py-0.5',\n md: 'h-6 py-1',\n lg: 'h-7 py-1 text-label-md',\n },\n inset: {\n default: 'px-space-8',\n cell: 'overflow-hidden py-0 pr-space-8 pl-0',\n icon: 'w-13 px-0',\n avatar: 'px-space-4 py-0',\n },\n roundness: {\n default: 'rounded-sm',\n pill: 'rounded-pill',\n none: 'rounded-none',\n },\n selected: { true: '', false: '' },\n state: { add: '', selected: '', remove: '', status: '', special: '' },\n error: { true: '', false: '' },\n },\n compoundVariants: [\n { behavior: ['filter', 'assist'], selected: false, className: NEUTRAL_SURFACE },\n {\n behavior: 'filter',\n selected: true,\n className:\n 'border-border-brand-bold bg-background-fill-brand-selected text-text-inverse hover:bg-background-fill-brand-hover hover:text-text-on-solid',\n },\n {\n behavior: 'count',\n className:\n 'border-transparent bg-background-surface-selected text-text-secondary hover:border-border-default hover:bg-background-fill-ghost-hover',\n },\n {\n behavior: 'permission',\n className: 'gap-space-8 bg-background-surface-striped text-text-primary hover:bg-background-fill-ghost-hover',\n },\n {\n behavior: 'permission',\n selected: false,\n className: 'border-background-item-hover hover:border-border-default',\n },\n { behavior: 'permission', selected: true, className: 'border-background-fill-brand' },\n { behavior: ['input', 'key-value'], state: 'add', className: ADD_SURFACE },\n {\n behavior: 'input',\n state: ['selected', 'remove'],\n error: false,\n className:\n 'border-border-secondary bg-background-surface-input text-text-secondary hover:border-border-default hover:bg-background-fill-ghost-hover',\n },\n {\n behavior: 'input',\n state: ['selected', 'remove'],\n error: true,\n className: 'border-border-error bg-background-surface-error text-text-primary',\n },\n { behavior: 'key-value', state: ['selected', 'status', 'remove'], className: NEUTRAL_SURFACE },\n { behavior: 'key-value', state: 'special', className: OVERLAY_SURFACE },\n { behavior: 'key-value', inset: 'avatar', className: OVERLAY_SURFACE },\n { size: 'lg', inset: 'default', className: 'px-space-10' },\n ],\n defaultVariants: {\n behavior: 'filter',\n size: 'md',\n inset: 'default',\n roundness: 'default',\n selected: false,\n error: false,\n },\n },\n)\n\ntype ChipBehavior = 'filter' | 'input' | 'assist' | 'count' | 'permission' | 'key-value'\ntype ChipState = 'add' | 'selected' | 'remove' | 'status' | 'special'\n\nexport type ChipProps = Omit<React.ComponentProps<'button'>, 'prefix'> & {\n behavior?: ChipBehavior | null\n size?: 'sm' | 'md' | 'lg' | null\n /** Honoured by Input, Count and Key-value; the other behaviours have a fixed shape. */\n roundness?: 'default' | 'pill' | null\n /** Filter and Permission only. */\n selected?: boolean | null\n /** Input: add / selected / remove. Key-value: add / selected / status / remove / special. */\n state?: ChipState\n /** Input `selected` / `remove` only. */\n error?: boolean\n /** Key-value \"Style\". */\n appearance?: 'default' | 'mono' | 'tinted'\n /** Key-value: render `leadingIcon` in a tinted leading cell. */\n leadingCell?: boolean\n /** Key-value collaborator: an avatar replaces the key. */\n avatar?: React.ReactNode\n leadingIcon?: IconProp\n trailingIcon?: IconProp\n label?: React.ReactNode\n valueLabel?: React.ReactNode\n}\n\nconst CELL = 'inline-flex shrink-0 items-center self-stretch border-r'\n\nfunction resolveFilterIcons(selected: boolean, leading?: IconProp, trailing?: IconProp) {\n if (!selected) return { leading, trailing }\n if (trailing != null && leading == null) return { leading: undefined, trailing: faCheck as IconProp }\n return { leading: faCheck as IconProp, trailing }\n}\n\nfunction resolveRoundness(behavior: ChipBehavior, roundness: 'default' | 'pill') {\n if (behavior === 'permission') return 'none'\n if (behavior === 'input' || behavior === 'count' || behavior === 'key-value') return roundness\n return 'default'\n}\n\nfunction Chip({\n behavior = 'filter',\n size = 'md',\n roundness = 'default',\n selected = false,\n state,\n error = false,\n appearance = 'default',\n leadingCell = false,\n avatar,\n leadingIcon,\n trailingIcon,\n label,\n valueLabel,\n children,\n className,\n type = 'button',\n ...props\n}: ChipProps) {\n const resolvedBehavior = behavior ?? 'filter'\n const resolvedSize = size ?? 'md'\n const iconSize = resolvedSize === 'lg' ? 0.875 : 0.75\n const isToggle = resolvedBehavior === 'filter' || resolvedBehavior === 'permission'\n const isSelected = isToggle && !!selected\n const resolvedState: ChipState | undefined =\n resolvedBehavior === 'input'\n ? state ?? (selected ? 'remove' : 'add')\n : resolvedBehavior === 'key-value'\n ? state ?? 'selected'\n : undefined\n const hasError = resolvedBehavior === 'input' && resolvedState !== 'add' && error\n\n const icon = (glyph: IconProp, iconClassName?: string) => (\n <IconProvider aria-hidden icon={glyph} size={iconSize} className={cn('shrink-0', iconClassName)} />\n )\n const text = (content: React.ReactNode, slot: string, textClassName?: string) =>\n content != null && content !== false ? (\n <span data-slot={slot} className={textClassName}>\n {content}\n </span>\n ) : null\n\n let inset: 'default' | 'cell' | 'icon' | 'avatar' = 'default'\n let content: React.ReactNode\n\n if (resolvedBehavior === 'permission') {\n inset = 'cell'\n content = (\n <>\n <span\n aria-hidden\n data-slot=\"chip-cell\"\n className={cn(\n CELL,\n 'relative w-5 justify-center',\n isSelected\n ? 'border-background-fill-brand text-background-fill-brand'\n : 'border-background-item-hover text-border-brand group-hover:border-border-default',\n )}\n >\n {isSelected && <span className=\"absolute inset-0 bg-background-fill-brand/25\" />}\n <IconProvider icon={faCheck} size={0.75} className=\"relative\" />\n </span>\n {text(children ?? label, 'chip-label')}\n </>\n )\n } else if (resolvedBehavior === 'input') {\n const labelContent = children ?? label\n if (resolvedState === 'add') {\n if (labelContent == null) inset = 'icon'\n content = (\n <>\n {icon(leadingIcon ?? faPlus, 'text-icon-secondary')}\n {text(labelContent, 'chip-label')}\n {trailingIcon && icon(trailingIcon, 'text-icon-secondary')}\n </>\n )\n } else {\n const trailing = resolvedState === 'remove' ? trailingIcon ?? faXmark : trailingIcon\n content = (\n <>\n {hasError\n ? icon(faCircleExclamation, 'text-icon-error')\n : leadingIcon && icon(leadingIcon, 'text-icon-secondary')}\n {text(labelContent, 'chip-label')}\n {trailing && icon(trailing, 'text-icon-primary')}\n </>\n )\n }\n } else if (resolvedBehavior === 'key-value') {\n const value = valueLabel ?? children\n const isTinted = appearance === 'tinted'\n if (resolvedState === 'add') {\n inset = 'icon'\n content = icon(leadingIcon ?? faPlus, 'text-icon-secondary')\n } else if (avatar != null) {\n inset = 'avatar'\n content = (\n <>\n <span data-slot=\"chip-avatar\" className=\"inline-flex size-4 shrink-0 overflow-hidden rounded-pill\">\n {avatar}\n </span>\n {text(value, 'chip-value', 'text-text-primary')}\n {resolvedState === 'status' && (\n <span data-slot=\"chip-status\" className=\"size-1.5 shrink-0 rounded-pill bg-icon-success\" />\n )}\n {(resolvedState === 'remove' || resolvedState === 'special') && icon(faXmark, 'text-icon-primary')}\n </>\n )\n } else {\n const isSpecial = resolvedState === 'special'\n const hasLeadingCell = leadingCell && leadingIcon != null && !isSpecial\n if (isSpecial || hasLeadingCell || isTinted) inset = 'cell'\n content = (\n <>\n {isSpecial && (\n <span\n data-slot=\"chip-cell\"\n className={cn(\n CELL,\n 'border-border-subtle bg-background-fill-brand-selected px-space-8 text-text-inverse',\n )}\n >\n {icon(leadingIcon ?? faBook)}\n </span>\n )}\n {hasLeadingCell && (\n <span\n data-slot=\"chip-cell\"\n className={cn(\n CELL,\n 'w-5 justify-center border-border-secondary bg-background-surface-brand text-icon-brand',\n )}\n >\n {icon(leadingIcon)}\n </span>\n )}\n {!isSpecial && !hasLeadingCell && !isTinted && leadingIcon && icon(leadingIcon, 'text-icon-secondary')}\n {isTinted ? (\n <span\n data-slot=\"chip-key\"\n className={cn(\n CELL,\n 'gap-space-4 border-border-secondary bg-background-surface-brand px-space-8 text-text-primary',\n )}\n >\n {!hasLeadingCell && leadingIcon && icon(leadingIcon, 'text-icon-secondary')}\n {label}\n </span>\n ) : (\n text(label, 'chip-key', appearance === 'mono' ? 'text-code-sm text-text-secondary' : 'text-text-primary')\n )}\n {text(value, 'chip-value', appearance === 'default' ? 'text-text-tertiary' : 'text-text-primary')}\n {resolvedState === 'status' && (\n <span data-slot=\"chip-status\" className=\"size-1.5 shrink-0 rounded-pill bg-icon-success\" />\n )}\n {(resolvedState === 'remove' || isSpecial) && icon(faXmark, 'text-icon-primary')}\n </>\n )\n }\n } else if (resolvedBehavior === 'count') {\n content = text(children ?? label, 'chip-label')\n } else {\n const icons =\n resolvedBehavior === 'filter'\n ? resolveFilterIcons(isSelected, leadingIcon, trailingIcon)\n : { leading: leadingIcon, trailing: trailingIcon }\n const iconClass = isSelected ? undefined : 'text-icon-secondary'\n content = (\n <>\n {icons.leading && icon(icons.leading, iconClass)}\n {text(children ?? label, 'chip-label')}\n {icons.trailing && icon(icons.trailing, iconClass)}\n </>\n )\n }\n\n return (\n <button\n data-slot=\"chip\"\n data-selected={isSelected ? '' : undefined}\n aria-pressed={isToggle ? isSelected : undefined}\n type={type}\n {...props}\n className={cn(\n chipVariants({\n behavior: resolvedBehavior,\n size: resolvedSize,\n inset,\n roundness: resolveRoundness(resolvedBehavior, roundness ?? 'default'),\n selected: isSelected,\n state: resolvedState,\n error: hasError,\n }),\n className,\n )}\n >\n {content}\n </button>\n )\n}\n\nexport { chipVariants }\nexport default Chip\n"],"names":["cn","content"],"mappings":";;;;;AAOA,MAAM,kBACJ;AACF,MAAM,kBACJ;AACF,MAAM,cACJ;AAEF,MAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,UAAU;AAAA,QACR,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,aAAa;AAAA,MAAA;AAAA,MAEf,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,MAEN,OAAO;AAAA,QACL,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA;AAAA,MAEV,WAAW;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,MAER,UAAU,EAAE,MAAM,IAAI,OAAO,GAAA;AAAA,MAC7B,OAAO,EAAE,KAAK,IAAI,UAAU,IAAI,QAAQ,IAAI,QAAQ,IAAI,SAAS,GAAA;AAAA,MACjE,OAAO,EAAE,MAAM,IAAI,OAAO,GAAA;AAAA,IAAG;AAAA,IAE/B,kBAAkB;AAAA,MAChB,EAAE,UAAU,CAAC,UAAU,QAAQ,GAAG,UAAU,OAAO,WAAW,gBAAA;AAAA,MAC9D;AAAA,QACE,UAAU;AAAA,QACV,UAAU;AAAA,QACV,WACE;AAAA,MAAA;AAAA,MAEJ;AAAA,QACE,UAAU;AAAA,QACV,WACE;AAAA,MAAA;AAAA,MAEJ;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,MAAA;A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AAAA,MAC9C,KAAK,YAAY,OAAO,YAAY;AAAA,MACpC,MAAM,YAAY,KAAK,MAAM,UAAU,SAAS;AAAA,IAAA,GACnD;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,iBAAe,aAAa,KAAK;AAAA,MACjC,gBAAc,WAAW,aAAa;AAAA,MACtC;AAAA,MACC,GAAG;AAAA,MACJ,WAAWA;AAAAA,QACT,aAAa;AAAA,UACX,UAAU;AAAA,UACV,MAAM;AAAA,UACN;AAAA,UACA,WAAW,iBAAiB,kBAAkB,aAAa,SAAS;AAAA,UACpE,UAAU;AAAA,UACV,OAAO;AAAA,UACP,OAAO;AAAA,QAAA,CACR;AAAA,QACD;AAAA,MAAA;AAAA,MAGD,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
|
|
4
|
+
declare const popoverContentVariants: (props?: ({
|
|
5
|
+
size?: "auto" | "sm" | "lg" | "md" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function PopoverRoot({ modal, ...props }: PopoverPrimitive.Root.Props): React.JSX.Element;
|
|
8
|
+
declare function PopoverTrigger(props: PopoverPrimitive.Trigger.Props): React.JSX.Element;
|
|
9
|
+
declare function PopoverArrow({ className, ...props }: PopoverPrimitive.Arrow.Props): React.JSX.Element;
|
|
10
|
+
type PopoverContentProps = PopoverPrimitive.Popup.Props & VariantProps<typeof popoverContentVariants> & Pick<PopoverPrimitive.Positioner.Props, 'alignOffset' | 'anchor' | 'arrowPadding' | 'collisionAvoidance' | 'sideOffset'> & {
|
|
11
|
+
alignment?: PopoverPrimitive.Positioner.Props['align'];
|
|
12
|
+
arrow?: boolean;
|
|
13
|
+
container?: PopoverPrimitive.Portal.Props['container'];
|
|
14
|
+
placement?: PopoverPrimitive.Positioner.Props['side'];
|
|
15
|
+
positionerId?: string;
|
|
16
|
+
positionerClassName?: string;
|
|
17
|
+
};
|
|
18
|
+
declare function PopoverContent({ alignment, alignOffset, anchor, arrow, arrowPadding, children, className, collisionAvoidance, container, placement, positionerId, positionerClassName, sideOffset, size, ...props }: PopoverContentProps): React.JSX.Element;
|
|
19
|
+
declare function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
20
|
+
declare function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props): React.JSX.Element;
|
|
21
|
+
declare function PopoverClose({ children, className, 'aria-label': ariaLabel, ...props }: PopoverPrimitive.Close.Props): React.JSX.Element;
|
|
22
|
+
declare function PopoverBody({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
23
|
+
declare function PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props): React.JSX.Element;
|
|
24
|
+
declare function PopoverFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
25
|
+
type PopoverOrigin = {
|
|
26
|
+
horizontal: 'center' | 'left' | 'right' | number;
|
|
27
|
+
vertical: 'bottom' | 'center' | 'top' | number;
|
|
28
|
+
};
|
|
29
|
+
type PopoverCloseReason = 'backdropClick' | 'escapeKeyDown';
|
|
30
|
+
type PopoverActions = {
|
|
31
|
+
updatePosition: () => void;
|
|
32
|
+
};
|
|
33
|
+
type LegacyPopoverSlotProps = {
|
|
34
|
+
paper?: {
|
|
35
|
+
className?: string;
|
|
36
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
37
|
+
sx?: unknown;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
transition?: {
|
|
41
|
+
onEntered?: () => void;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
};
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
type PopoverWrapperBaseProps = Pick<PopoverPrimitive.Root.Props, 'defaultOpen' | 'modal' | 'onOpenChange' | 'onOpenChangeComplete' | 'open'> & Omit<PopoverContentProps, 'alignment' | 'anchor' | 'children' | 'className' | 'placement' | 'positionerClassName' | 'positionerId' | 'ref'> & {
|
|
47
|
+
action?: React.Ref<PopoverActions>;
|
|
48
|
+
align?: PopoverContentProps['alignment'];
|
|
49
|
+
anchorOrigin?: PopoverOrigin;
|
|
50
|
+
children: React.ReactNode;
|
|
51
|
+
className?: string;
|
|
52
|
+
classes?: {
|
|
53
|
+
paper?: string;
|
|
54
|
+
root?: string;
|
|
55
|
+
[key: string]: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
/** @deprecated Base UI handles unmounting after transitions. */
|
|
58
|
+
closeAfterTransition?: unknown;
|
|
59
|
+
contentClassName?: string;
|
|
60
|
+
/** Controls Base UI focus trapping in external-anchor mode. */
|
|
61
|
+
disableEnforceFocus?: boolean;
|
|
62
|
+
id?: string;
|
|
63
|
+
onClose?: (event: Event, reason: PopoverCloseReason) => void;
|
|
64
|
+
side?: PopoverContentProps['placement'];
|
|
65
|
+
slotProps?: LegacyPopoverSlotProps;
|
|
66
|
+
/** @deprecated MUI Emotion styles are accepted but ignored. Use token-based classes. */
|
|
67
|
+
sx?: unknown;
|
|
68
|
+
transformOrigin?: PopoverOrigin;
|
|
69
|
+
};
|
|
70
|
+
type TriggerPopoverProps = PopoverWrapperBaseProps & {
|
|
71
|
+
anchorEl?: never;
|
|
72
|
+
trigger: React.ReactElement;
|
|
73
|
+
triggerProps?: Omit<PopoverPrimitive.Trigger.Props, 'children' | 'render'>;
|
|
74
|
+
};
|
|
75
|
+
type AnchoredPopoverProps = PopoverWrapperBaseProps & {
|
|
76
|
+
anchorEl: Element | null | undefined | (() => Element | null);
|
|
77
|
+
trigger?: never;
|
|
78
|
+
triggerProps?: never;
|
|
79
|
+
};
|
|
80
|
+
type PopoverWrapperProps = TriggerPopoverProps | AnchoredPopoverProps;
|
|
81
|
+
/**
|
|
82
|
+
* Convenience API for the common popover composition.
|
|
83
|
+
* Use the compound parts directly when the root, trigger, or content need custom composition.
|
|
84
|
+
*/
|
|
85
|
+
declare function Popover({ action, align, anchorEl, anchorOrigin, className, classes, closeAfterTransition: _closeAfterTransition, children, contentClassName, defaultOpen, disableEnforceFocus, id, modal, onClose, onOpenChange, onOpenChangeComplete, open, side, sideOffset, slotProps, sx: _sx, transformOrigin, trigger, triggerProps, ...contentProps }: PopoverWrapperProps): React.JSX.Element;
|
|
86
|
+
export { Popover, PopoverArrow, PopoverBody, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverRoot, PopoverTitle, PopoverTrigger, };
|
|
87
|
+
export type { AnchoredPopoverProps, PopoverActions, PopoverCloseReason, PopoverContentProps, PopoverOrigin, PopoverWrapperProps, TriggerPopoverProps, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../../index-DSVg79g-.js";
|
|
4
|
+
import "../../Button-C77b7jpW.js";
|
|
5
|
+
import "../../components/atoms/IconProvider.es.js";
|
|
6
|
+
import "../../classNames-B1XpQHle.js";
|
|
7
|
+
import { P, a, b, c, d, e, f, g, h, i, j } from "../../Popover-eC_vX5By.js";
|
|
8
|
+
export {
|
|
9
|
+
P as Popover,
|
|
10
|
+
a as PopoverArrow,
|
|
11
|
+
b as PopoverBody,
|
|
12
|
+
c as PopoverClose,
|
|
13
|
+
d as PopoverContent,
|
|
14
|
+
e as PopoverDescription,
|
|
15
|
+
f as PopoverFooter,
|
|
16
|
+
g as PopoverHeader,
|
|
17
|
+
h as PopoverRoot,
|
|
18
|
+
i as PopoverTitle,
|
|
19
|
+
j as PopoverTrigger
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=Popover.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Radio as RadioPrimitive } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';
|
|
4
|
+
export type RadioProps<Value = string> = RadioPrimitive.Root.Props<Value> & {
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare function Radio<Value = string>({ className, invalid, ...props }: RadioProps<Value>): React.JSX.Element;
|
|
8
|
+
export type RadioGroupProps<Value = string> = RadioGroupPrimitive.Props<Value> & {
|
|
9
|
+
orientation?: 'horizontal' | 'vertical';
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function RadioGroup<Value = string>({ className, orientation, invalid, ...props }: RadioGroupProps<Value>): React.JSX.Element;
|
|
13
|
+
export { RadioGroup };
|
|
14
|
+
export default Radio;
|