@appss/ui 0.0.0-stage → 0.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/AGENTS.md +41 -0
- package/README.md +262 -2
- package/dist/appearances/profiles.d.ts +4 -0
- package/dist/appearances/profiles.d.ts.map +1 -0
- package/dist/appearances/profiles.js +5 -0
- package/dist/appearances/profiles.js.map +1 -0
- package/dist/appearances/reddit/profile.d.ts +187 -0
- package/dist/appearances/reddit/profile.d.ts.map +1 -0
- package/dist/appearances/reddit/profile.js +107 -0
- package/dist/appearances/reddit/profile.js.map +1 -0
- package/dist/appearances/reddit/reddit.module.css.js +240 -0
- package/dist/appearances/reddit/reddit.module.css.js.map +1 -0
- package/dist/appearances/telegram/profile.d.ts +197 -0
- package/dist/appearances/telegram/profile.d.ts.map +1 -0
- package/dist/appearances/telegram/profile.js +114 -0
- package/dist/appearances/telegram/profile.js.map +1 -0
- package/dist/appearances/telegram/telegram.module.css.js +270 -0
- package/dist/appearances/telegram/telegram.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +4 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +91 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.js +30 -0
- package/dist/components/Accordion/Accordion.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.types.d.ts +34 -0
- package/dist/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +4 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +50 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/Avatar.module.css.js +18 -0
- package/dist/components/Avatar/Avatar.module.css.js.map +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +24 -0
- package/dist/components/Avatar/Avatar.types.d.ts.map +1 -0
- package/dist/components/Banner/Banner.d.ts +3 -0
- package/dist/components/Banner/Banner.d.ts.map +1 -0
- package/dist/components/Banner/Banner.js +39 -0
- package/dist/components/Banner/Banner.js.map +1 -0
- package/dist/components/Banner/Banner.module.css.js +24 -0
- package/dist/components/Banner/Banner.module.css.js.map +1 -0
- package/dist/components/Banner/Banner.types.d.ts +25 -0
- package/dist/components/Banner/Banner.types.d.ts.map +1 -0
- package/dist/components/BottomNav/BottomNav.d.ts +3 -0
- package/dist/components/BottomNav/BottomNav.d.ts.map +1 -0
- package/dist/components/BottomNav/BottomNav.js +68 -0
- package/dist/components/BottomNav/BottomNav.js.map +1 -0
- package/dist/components/BottomNav/BottomNav.module.css.js +24 -0
- package/dist/components/BottomNav/BottomNav.module.css.js.map +1 -0
- package/dist/components/BottomNav/BottomNav.types.d.ts +35 -0
- package/dist/components/BottomNav/BottomNav.types.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +52 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.css.js +24 -0
- package/dist/components/Button/Button.module.css.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +23 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Card/Card.d.ts +3 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +50 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.module.css.js +21 -0
- package/dist/components/Card/Card.module.css.js.map +1 -0
- package/dist/components/Card/Card.types.d.ts +23 -0
- package/dist/components/Card/Card.types.d.ts.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.d.ts +7 -0
- package/dist/components/ChatListItem/ChatListItem.d.ts.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.js +75 -0
- package/dist/components/ChatListItem/ChatListItem.js.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.module.css.js +51 -0
- package/dist/components/ChatListItem/ChatListItem.module.css.js.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.types.d.ts +38 -0
- package/dist/components/ChatListItem/ChatListItem.types.d.ts.map +1 -0
- package/dist/components/ChatListItem/MessageStatusIcon.d.ts +7 -0
- package/dist/components/ChatListItem/MessageStatusIcon.d.ts.map +1 -0
- package/dist/components/ChatListItem/MessageStatusIcon.js +18 -0
- package/dist/components/ChatListItem/MessageStatusIcon.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +4 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.js +63 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/Dialog.module.css.js +21 -0
- package/dist/components/Dialog/Dialog.module.css.js.map +1 -0
- package/dist/components/Dialog/Dialog.types.d.ts +26 -0
- package/dist/components/Dialog/Dialog.types.d.ts.map +1 -0
- package/dist/components/Divider/Divider.d.ts +3 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +27 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/Divider.module.css.js +9 -0
- package/dist/components/Divider/Divider.module.css.js.map +1 -0
- package/dist/components/Divider/Divider.types.d.ts +17 -0
- package/dist/components/Divider/Divider.types.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.js +49 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/IconButton.module.css.js +15 -0
- package/dist/components/IconButton/IconButton.module.css.js.map +1 -0
- package/dist/components/IconButton/IconButton.types.d.ts +25 -0
- package/dist/components/IconButton/IconButton.types.d.ts.map +1 -0
- package/dist/components/Likes/Likes.d.ts +4 -0
- package/dist/components/Likes/Likes.d.ts.map +1 -0
- package/dist/components/Likes/Likes.js +85 -0
- package/dist/components/Likes/Likes.js.map +1 -0
- package/dist/components/Likes/Likes.module.css.js +18 -0
- package/dist/components/Likes/Likes.module.css.js.map +1 -0
- package/dist/components/Likes/Likes.types.d.ts +27 -0
- package/dist/components/Likes/Likes.types.d.ts.map +1 -0
- package/dist/components/Link/Link.d.ts +3 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +47 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/Link.module.css.js +15 -0
- package/dist/components/Link/Link.module.css.js.map +1 -0
- package/dist/components/Link/Link.types.d.ts +22 -0
- package/dist/components/Link/Link.types.d.ts.map +1 -0
- package/dist/components/Menu/Menu.d.ts +4 -0
- package/dist/components/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Menu/Menu.js +134 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/Menu.module.css.js +27 -0
- package/dist/components/Menu/Menu.module.css.js.map +1 -0
- package/dist/components/Menu/Menu.types.d.ts +32 -0
- package/dist/components/Menu/Menu.types.d.ts.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.d.ts +3 -0
- package/dist/components/MessageBubble/MessageBubble.d.ts.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.js +85 -0
- package/dist/components/MessageBubble/MessageBubble.js.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.module.css.js +54 -0
- package/dist/components/MessageBubble/MessageBubble.module.css.js.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.types.d.ts +54 -0
- package/dist/components/MessageBubble/MessageBubble.types.d.ts.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.d.ts +3 -0
- package/dist/components/MessageComposer/MessageComposer.d.ts.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.js +55 -0
- package/dist/components/MessageComposer/MessageComposer.js.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.module.css.js +24 -0
- package/dist/components/MessageComposer/MessageComposer.module.css.js.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.types.d.ts +27 -0
- package/dist/components/MessageComposer/MessageComposer.types.d.ts.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.d.ts +3 -0
- package/dist/components/MessageDivider/MessageDivider.d.ts.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.js +28 -0
- package/dist/components/MessageDivider/MessageDivider.js.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.module.css.js +12 -0
- package/dist/components/MessageDivider/MessageDivider.module.css.js.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.types.d.ts +19 -0
- package/dist/components/MessageDivider/MessageDivider.types.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.d.ts +3 -0
- package/dist/components/NavBar/NavBar.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.js +42 -0
- package/dist/components/NavBar/NavBar.js.map +1 -0
- package/dist/components/NavBar/NavBar.module.css.js +24 -0
- package/dist/components/NavBar/NavBar.module.css.js.map +1 -0
- package/dist/components/NavBar/NavBar.types.d.ts +26 -0
- package/dist/components/NavBar/NavBar.types.d.ts.map +1 -0
- package/dist/components/NavList/NavList.d.ts +3 -0
- package/dist/components/NavList/NavList.d.ts.map +1 -0
- package/dist/components/NavList/NavList.js +53 -0
- package/dist/components/NavList/NavList.js.map +1 -0
- package/dist/components/NavList/NavList.module.css.js +24 -0
- package/dist/components/NavList/NavList.module.css.js.map +1 -0
- package/dist/components/NavList/NavList.types.d.ts +31 -0
- package/dist/components/NavList/NavList.types.d.ts.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +3 -0
- package/dist/components/SearchField/SearchField.d.ts.map +1 -0
- package/dist/components/SearchField/SearchField.js +38 -0
- package/dist/components/SearchField/SearchField.js.map +1 -0
- package/dist/components/SearchField/SearchField.module.css.js +18 -0
- package/dist/components/SearchField/SearchField.module.css.js.map +1 -0
- package/dist/components/SearchField/SearchField.types.d.ts +23 -0
- package/dist/components/SearchField/SearchField.types.d.ts.map +1 -0
- package/dist/components/Section/Section.d.ts +4 -0
- package/dist/components/Section/Section.d.ts.map +1 -0
- package/dist/components/Section/Section.js +101 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Section/Section.module.css.js +36 -0
- package/dist/components/Section/Section.module.css.js.map +1 -0
- package/dist/components/Section/Section.types.d.ts +36 -0
- package/dist/components/Section/Section.types.d.ts.map +1 -0
- package/dist/components/Stat/Stat.d.ts +4 -0
- package/dist/components/Stat/Stat.d.ts.map +1 -0
- package/dist/components/Stat/Stat.js +31 -0
- package/dist/components/Stat/Stat.js.map +1 -0
- package/dist/components/Stat/Stat.module.css.js +15 -0
- package/dist/components/Stat/Stat.module.css.js.map +1 -0
- package/dist/components/Stat/Stat.types.d.ts +18 -0
- package/dist/components/Stat/Stat.types.d.ts.map +1 -0
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -0
- package/dist/components/Switch/Switch.js +45 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.module.css.js +21 -0
- package/dist/components/Switch/Switch.module.css.js.map +1 -0
- package/dist/components/Switch/Switch.types.d.ts +19 -0
- package/dist/components/Switch/Switch.types.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +4 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +92 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/Tabs.module.css.js +24 -0
- package/dist/components/Tabs/Tabs.module.css.js.map +1 -0
- package/dist/components/Tabs/Tabs.types.d.ts +31 -0
- package/dist/components/Tabs/Tabs.types.d.ts.map +1 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.d.ts.map +1 -0
- package/dist/components/Tag/Tag.js +33 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Tag/Tag.module.css.js +12 -0
- package/dist/components/Tag/Tag.module.css.js.map +1 -0
- package/dist/components/Tag/Tag.types.d.ts +20 -0
- package/dist/components/Tag/Tag.types.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +63 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.css.js +12 -0
- package/dist/components/Tooltip/Tooltip.module.css.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +24 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts.map +1 -0
- package/dist/core/AppssProvider.d.ts +21 -0
- package/dist/core/AppssProvider.d.ts.map +1 -0
- package/dist/core/AppssProvider.js +42 -0
- package/dist/core/AppssProvider.js.map +1 -0
- package/dist/core/appearance.d.ts +28 -0
- package/dist/core/appearance.d.ts.map +1 -0
- package/dist/core/appearance.js +40 -0
- package/dist/core/appearance.js.map +1 -0
- package/dist/core/host.d.ts +28 -0
- package/dist/core/host.d.ts.map +1 -0
- package/dist/core/host.js +42 -0
- package/dist/core/host.js.map +1 -0
- package/dist/hosts/adapters.d.ts +5 -0
- package/dist/hosts/adapters.d.ts.map +1 -0
- package/dist/hosts/adapters.js +21 -0
- package/dist/hosts/adapters.js.map +1 -0
- package/dist/icons/icons.d.ts +164 -0
- package/dist/icons/icons.d.ts.map +1 -0
- package/dist/icons/icons.js +220 -0
- package/dist/icons/icons.js.map +1 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +43 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations.d.ts +9 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrations.js +27 -0
- package/dist/integrations.js.map +1 -0
- package/dist/modules/hideOnScroll.d.ts +7 -0
- package/dist/modules/hideOnScroll.d.ts.map +1 -0
- package/dist/modules/hideOnScroll.js +39 -0
- package/dist/modules/hideOnScroll.js.map +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +5 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/recipes/buttons.d.ts +30 -0
- package/dist/recipes/buttons.d.ts.map +1 -0
- package/dist/recipes/buttons.js +28 -0
- package/dist/recipes/buttons.js.map +1 -0
- package/dist/recipes/index.d.ts +4 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/index.js +23 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/recipes/navigation.d.ts +36 -0
- package/dist/recipes/navigation.d.ts.map +1 -0
- package/dist/recipes/navigation.js +28 -0
- package/dist/recipes/navigation.js.map +1 -0
- package/dist/recipes/recipes.module.css.js +27 -0
- package/dist/recipes/recipes.module.css.js.map +1 -0
- package/dist/recipes/whatsapp.d.ts +155 -0
- package/dist/recipes/whatsapp.d.ts.map +1 -0
- package/dist/recipes/whatsapp.js +155 -0
- package/dist/recipes/whatsapp.js.map +1 -0
- package/dist/recipes/whatsapp.module.css.js +135 -0
- package/dist/recipes/whatsapp.module.css.js.map +1 -0
- package/dist/styles.css +4157 -0
- package/docs/components/Accordion.md +76 -0
- package/docs/components/Avatar.md +64 -0
- package/docs/components/Banner.md +70 -0
- package/docs/components/BottomNav.md +86 -0
- package/docs/components/Button.md +93 -0
- package/docs/components/Card.md +75 -0
- package/docs/components/Cell.md +89 -0
- package/docs/components/ChatListItem.md +102 -0
- package/docs/components/Dialog.md +93 -0
- package/docs/components/Divider.md +66 -0
- package/docs/components/IconButton.md +86 -0
- package/docs/components/Likes.md +74 -0
- package/docs/components/Link.md +79 -0
- package/docs/components/Menu.md +105 -0
- package/docs/components/MessageBubble.md +91 -0
- package/docs/components/MessageComposer.md +93 -0
- package/docs/components/MessageDivider.md +66 -0
- package/docs/components/NavBar.md +85 -0
- package/docs/components/NavList.md +85 -0
- package/docs/components/SearchField.md +81 -0
- package/docs/components/Section.md +81 -0
- package/docs/components/Stat.md +66 -0
- package/docs/components/Switch.md +74 -0
- package/docs/components/Tabs.md +85 -0
- package/docs/components/Tag.md +63 -0
- package/docs/components/Tooltip.md +62 -0
- package/docs/exports.json +90 -0
- package/docs/foundations.md +99 -0
- package/docs/gaps.json +12 -0
- package/docs/icons.md +20 -0
- package/docs/index.md +57 -0
- package/docs/recipes.md +43 -0
- package/docs/replaces.json +12 -0
- package/package.json +81 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createSlotProps } from "../../core/appearance.js";
|
|
3
|
+
import { useHostAppearance } from "../../core/AppssProvider.js";
|
|
4
|
+
import classes from "./Link.module.css.js";
|
|
5
|
+
function Link({
|
|
6
|
+
appearance,
|
|
7
|
+
recipe,
|
|
8
|
+
adaptation = "host",
|
|
9
|
+
variant = "accent",
|
|
10
|
+
external = false,
|
|
11
|
+
leading,
|
|
12
|
+
trailing,
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
children,
|
|
16
|
+
target,
|
|
17
|
+
rel,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const host = useHostAppearance("Link");
|
|
21
|
+
const slot = createSlotProps(
|
|
22
|
+
{ classNames: classes },
|
|
23
|
+
recipe?.appearance,
|
|
24
|
+
adaptation === "host" ? host : void 0,
|
|
25
|
+
appearance,
|
|
26
|
+
{ classNames: { root: className ?? "" }, styles: { root: style ?? {} } }
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
"a",
|
|
30
|
+
{
|
|
31
|
+
...props,
|
|
32
|
+
...slot("root"),
|
|
33
|
+
target: external ? "_blank" : target,
|
|
34
|
+
rel: external ? "noopener noreferrer" : rel,
|
|
35
|
+
"data-variant": variant,
|
|
36
|
+
children: [
|
|
37
|
+
leading && /* @__PURE__ */ jsx("span", { ...slot("leading"), "aria-hidden": "true", children: leading }),
|
|
38
|
+
children,
|
|
39
|
+
trailing && /* @__PURE__ */ jsx("span", { ...slot("trailing"), "aria-hidden": "true", children: trailing })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
Link
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../src/ui/components/Link/Link.tsx"],"sourcesContent":["import { createSlotProps } from \"../../core/appearance\";\nimport { useHostAppearance } from \"../../core/AppssProvider\";\nimport type { LinkProps, LinkSlot } from \"./Link.types\";\nimport classes from \"./Link.module.css\";\n\nexport function Link({\n appearance,\n recipe,\n adaptation = \"host\",\n variant = \"accent\",\n external = false,\n leading,\n trailing,\n className,\n style,\n children,\n target,\n rel,\n ...props\n}: LinkProps) {\n const host = useHostAppearance(\"Link\");\n const slot = createSlotProps<LinkSlot>(\n { classNames: classes },\n recipe?.appearance,\n adaptation === \"host\" ? host : undefined,\n appearance,\n { classNames: { root: className ?? \"\" }, styles: { root: style ?? {} } },\n );\n\n return (\n <a\n {...props}\n {...slot(\"root\")}\n target={external ? \"_blank\" : target}\n rel={external ? \"noopener noreferrer\" : rel}\n data-variant={variant}\n >\n {leading && (\n <span {...slot(\"leading\")} aria-hidden=\"true\">\n {leading}\n </span>\n )}\n {children}\n {trailing && (\n <span {...slot(\"trailing\")} aria-hidden=\"true\">\n {trailing}\n </span>\n )}\n </a>\n );\n}\n"],"names":[],"mappings":";;;;AAKO,SAAS,KAAK;AAAA,EACnB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAc;AACZ,QAAM,OAAO,kBAAkB,MAAM;AACrC,QAAM,OAAO;AAAA,IACX,EAAE,YAAY,QAAA;AAAA,IACd,QAAQ;AAAA,IACR,eAAe,SAAS,OAAO;AAAA,IAC/B;AAAA,IACA,EAAE,YAAY,EAAE,MAAM,aAAa,MAAM,QAAQ,EAAE,MAAM,SAAS,KAAG;AAAA,EAAE;AAGzE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG,KAAK,MAAM;AAAA,MACf,QAAQ,WAAW,WAAW;AAAA,MAC9B,KAAK,WAAW,wBAAwB;AAAA,MACxC,gBAAc;AAAA,MAEb,UAAA;AAAA,QAAA,WACC,oBAAC,UAAM,GAAG,KAAK,SAAS,GAAG,eAAY,QACpC,UAAA,QAAA,CACH;AAAA,QAED;AAAA,QACA,gCACE,QAAA,EAAM,GAAG,KAAK,UAAU,GAAG,eAAY,QACrC,UAAA,SAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const root = "appss-root-AdPO9";
|
|
2
|
+
const leading = "appss-leading-NYPb6";
|
|
3
|
+
const trailing = "appss-trailing-fOd7h";
|
|
4
|
+
const classes = {
|
|
5
|
+
root,
|
|
6
|
+
leading,
|
|
7
|
+
trailing
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
classes as default,
|
|
11
|
+
leading,
|
|
12
|
+
root,
|
|
13
|
+
trailing
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=Link.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { Appearance, Recipe } from "../../core/appearance";
|
|
3
|
+
export type LinkSlot = "root" | "leading" | "trailing";
|
|
4
|
+
export type LinkAppearance = Appearance<LinkSlot>;
|
|
5
|
+
declare module "../../core/appearance" {
|
|
6
|
+
interface ComponentAppearanceMap {
|
|
7
|
+
Link: LinkAppearance;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type LinkRecipe = Recipe<"Link">;
|
|
11
|
+
export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
12
|
+
href: string;
|
|
13
|
+
appearance?: LinkAppearance;
|
|
14
|
+
recipe?: LinkRecipe;
|
|
15
|
+
adaptation?: "host" | "fixed";
|
|
16
|
+
variant?: "accent" | "subtle";
|
|
17
|
+
/** Opens in a new tab with a safe rel. */
|
|
18
|
+
external?: boolean;
|
|
19
|
+
leading?: ReactNode;
|
|
20
|
+
trailing?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=Link.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.types.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Link/Link.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAElD,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,sBAAsB;QAC9B,IAAI,EAAE,cAAc,CAAC;KACtB;CACF;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACxC,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MenuProps } from "./Menu.types";
|
|
2
|
+
/** Menu button pattern: focus moves into the menu, Escape and outside clicks close it. */
|
|
3
|
+
export declare function Menu({ items, onSelect, trigger, triggerLabel, align, appearance, recipe, adaptation, className, style, ...props }: MenuProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Menu/Menu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAGxD,0FAA0F;AAC1F,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAe,EACf,UAAU,EACV,MAAM,EACN,UAAmB,EACnB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,SAAS,+BAyHX"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useRef, useState, useEffect, Fragment } from "react";
|
|
3
|
+
import { createSlotProps } from "../../core/appearance.js";
|
|
4
|
+
import { useHostAppearance } from "../../core/AppssProvider.js";
|
|
5
|
+
import classes from "./Menu.module.css.js";
|
|
6
|
+
function Menu({
|
|
7
|
+
items,
|
|
8
|
+
onSelect,
|
|
9
|
+
trigger,
|
|
10
|
+
triggerLabel,
|
|
11
|
+
align = "start",
|
|
12
|
+
appearance,
|
|
13
|
+
recipe,
|
|
14
|
+
adaptation = "host",
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
const host = useHostAppearance("Menu");
|
|
20
|
+
const id = useId();
|
|
21
|
+
const rootRef = useRef(null);
|
|
22
|
+
const triggerRef = useRef(null);
|
|
23
|
+
const menuRef = useRef(null);
|
|
24
|
+
const [open, setOpen] = useState(false);
|
|
25
|
+
const slot = createSlotProps(
|
|
26
|
+
{ classNames: classes },
|
|
27
|
+
recipe?.appearance,
|
|
28
|
+
adaptation === "host" ? host : void 0,
|
|
29
|
+
appearance,
|
|
30
|
+
{ classNames: { root: className ?? "" }, styles: { root: style ?? {} } }
|
|
31
|
+
);
|
|
32
|
+
const menuItems = () => Array.from(
|
|
33
|
+
menuRef.current?.querySelectorAll('[role="menuitem"]:not(:disabled)') ?? []
|
|
34
|
+
);
|
|
35
|
+
const close = (restoreFocus) => {
|
|
36
|
+
setOpen(false);
|
|
37
|
+
if (restoreFocus) triggerRef.current?.focus();
|
|
38
|
+
};
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!open) return;
|
|
41
|
+
const list = menuItems();
|
|
42
|
+
(open === "last" ? list.at(-1) : list[0])?.focus();
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
document.addEventListener(
|
|
45
|
+
"pointerdown",
|
|
46
|
+
(event) => {
|
|
47
|
+
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
48
|
+
},
|
|
49
|
+
{ signal: controller.signal }
|
|
50
|
+
);
|
|
51
|
+
return () => controller.abort();
|
|
52
|
+
}, [open]);
|
|
53
|
+
const onTriggerKeyDown = (event) => {
|
|
54
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
setOpen(event.key === "ArrowDown" ? "first" : "last");
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const onMenuKeyDown = (event) => {
|
|
60
|
+
const list = menuItems();
|
|
61
|
+
const index = list.indexOf(document.activeElement);
|
|
62
|
+
const next = {
|
|
63
|
+
ArrowDown: (index + 1) % list.length,
|
|
64
|
+
ArrowUp: (index - 1 + list.length) % list.length,
|
|
65
|
+
Home: 0,
|
|
66
|
+
End: list.length - 1
|
|
67
|
+
}[event.key];
|
|
68
|
+
if (next !== void 0) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
list[next]?.focus();
|
|
71
|
+
} else if (event.key === "Escape") {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
close(true);
|
|
74
|
+
} else if (event.key === "Tab") {
|
|
75
|
+
close(false);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsxs("div", { ...props, ...slot("root"), ref: rootRef, "data-open": Boolean(open), children: [
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
...slot("trigger"),
|
|
83
|
+
ref: triggerRef,
|
|
84
|
+
id: `${id}-trigger`,
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-label": triggerLabel,
|
|
87
|
+
"aria-haspopup": "menu",
|
|
88
|
+
"aria-expanded": Boolean(open),
|
|
89
|
+
"aria-controls": open ? `${id}-menu` : void 0,
|
|
90
|
+
onClick: () => open ? close(false) : setOpen("first"),
|
|
91
|
+
onKeyDown: onTriggerKeyDown,
|
|
92
|
+
children: trigger
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
open && /* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
...slot("popover"),
|
|
99
|
+
ref: menuRef,
|
|
100
|
+
id: `${id}-menu`,
|
|
101
|
+
role: "menu",
|
|
102
|
+
"aria-labelledby": `${id}-trigger`,
|
|
103
|
+
"data-align": align,
|
|
104
|
+
onKeyDown: onMenuKeyDown,
|
|
105
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
item.separatorBefore && /* @__PURE__ */ jsx("div", { ...slot("separator"), role: "separator" }),
|
|
107
|
+
/* @__PURE__ */ jsxs(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
...slot("item"),
|
|
111
|
+
type: "button",
|
|
112
|
+
role: "menuitem",
|
|
113
|
+
tabIndex: -1,
|
|
114
|
+
disabled: item.disabled,
|
|
115
|
+
"data-tone": item.tone ?? "default",
|
|
116
|
+
onClick: () => {
|
|
117
|
+
onSelect?.(item.id);
|
|
118
|
+
close(true);
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
item.icon && /* @__PURE__ */ jsx("span", { ...slot("icon"), "aria-hidden": "true", children: item.icon }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { ...slot("label"), children: item.label })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }, item.id))
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
Menu
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../src/ui/components/Menu/Menu.tsx"],"sourcesContent":["import { Fragment, useEffect, useId, useRef, useState } from \"react\";\nimport type { KeyboardEvent } from \"react\";\nimport { createSlotProps } from \"../../core/appearance\";\nimport { useHostAppearance } from \"../../core/AppssProvider\";\nimport type { MenuProps, MenuSlot } from \"./Menu.types\";\nimport classes from \"./Menu.module.css\";\n\n/** Menu button pattern: focus moves into the menu, Escape and outside clicks close it. */\nexport function Menu({\n items,\n onSelect,\n trigger,\n triggerLabel,\n align = \"start\",\n appearance,\n recipe,\n adaptation = \"host\",\n className,\n style,\n ...props\n}: MenuProps) {\n const host = useHostAppearance(\"Menu\");\n const id = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState<false | \"first\" | \"last\">(false);\n const slot = createSlotProps<MenuSlot>(\n { classNames: classes },\n recipe?.appearance,\n adaptation === \"host\" ? host : undefined,\n appearance,\n { classNames: { root: className ?? \"\" }, styles: { root: style ?? {} } },\n );\n\n const menuItems = () =>\n Array.from(\n menuRef.current?.querySelectorAll<HTMLElement>('[role=\"menuitem\"]:not(:disabled)') ?? [],\n );\n\n const close = (restoreFocus: boolean) => {\n setOpen(false);\n if (restoreFocus) triggerRef.current?.focus();\n };\n\n useEffect(() => {\n if (!open) return;\n const list = menuItems();\n (open === \"last\" ? list.at(-1) : list[0])?.focus();\n const controller = new AbortController();\n document.addEventListener(\n \"pointerdown\",\n (event) => {\n if (!rootRef.current?.contains(event.target as Node)) setOpen(false);\n },\n { signal: controller.signal },\n );\n return () => controller.abort();\n }, [open]);\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n setOpen(event.key === \"ArrowDown\" ? \"first\" : \"last\");\n }\n };\n\n const onMenuKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const list = menuItems();\n const index = list.indexOf(document.activeElement as HTMLElement);\n const next = {\n ArrowDown: (index + 1) % list.length,\n ArrowUp: (index - 1 + list.length) % list.length,\n Home: 0,\n End: list.length - 1,\n }[event.key];\n if (next !== undefined) {\n event.preventDefault();\n list[next]?.focus();\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n close(true);\n } else if (event.key === \"Tab\") {\n close(false);\n }\n };\n\n return (\n <div {...props} {...slot(\"root\")} ref={rootRef} data-open={Boolean(open)}>\n <button\n {...slot(\"trigger\")}\n ref={triggerRef}\n id={`${id}-trigger`}\n type=\"button\"\n aria-label={triggerLabel}\n aria-haspopup=\"menu\"\n aria-expanded={Boolean(open)}\n aria-controls={open ? `${id}-menu` : undefined}\n onClick={() => (open ? close(false) : setOpen(\"first\"))}\n onKeyDown={onTriggerKeyDown}\n >\n {trigger}\n </button>\n {open && (\n <div\n {...slot(\"popover\")}\n ref={menuRef}\n id={`${id}-menu`}\n role=\"menu\"\n aria-labelledby={`${id}-trigger`}\n data-align={align}\n onKeyDown={onMenuKeyDown}\n >\n {items.map((item) => (\n <Fragment key={item.id}>\n {item.separatorBefore && <div {...slot(\"separator\")} role=\"separator\" />}\n <button\n {...slot(\"item\")}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n disabled={item.disabled}\n data-tone={item.tone ?? \"default\"}\n onClick={() => {\n onSelect?.(item.id);\n close(true);\n }}\n >\n {item.icon && (\n <span {...slot(\"icon\")} aria-hidden=\"true\">\n {item.icon}\n </span>\n )}\n <span {...slot(\"label\")}>{item.label}</span>\n </button>\n </Fragment>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const root = "appss-root-t06Tj";
|
|
2
|
+
const trigger = "appss-trigger-sRldz";
|
|
3
|
+
const popover = "appss-popover-unGcR";
|
|
4
|
+
const item = "appss-item-aUo04";
|
|
5
|
+
const icon = "appss-icon-aaYYi";
|
|
6
|
+
const label = "appss-label-l6-R6";
|
|
7
|
+
const separator = "appss-separator-Xf21s";
|
|
8
|
+
const classes = {
|
|
9
|
+
root,
|
|
10
|
+
trigger,
|
|
11
|
+
popover,
|
|
12
|
+
item,
|
|
13
|
+
icon,
|
|
14
|
+
label,
|
|
15
|
+
separator
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
classes as default,
|
|
19
|
+
icon,
|
|
20
|
+
item,
|
|
21
|
+
label,
|
|
22
|
+
popover,
|
|
23
|
+
root,
|
|
24
|
+
separator,
|
|
25
|
+
trigger
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=Menu.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { Appearance, Recipe } from "../../core/appearance";
|
|
3
|
+
export type MenuSlot = "root" | "trigger" | "popover" | "item" | "icon" | "label" | "separator";
|
|
4
|
+
export type MenuAppearance = Appearance<MenuSlot>;
|
|
5
|
+
declare module "../../core/appearance" {
|
|
6
|
+
interface ComponentAppearanceMap {
|
|
7
|
+
Menu: MenuAppearance;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type MenuRecipe = Recipe<"Menu">;
|
|
11
|
+
export interface MenuItem {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
tone?: "default" | "destructive";
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Renders a separator above this item. */
|
|
18
|
+
separatorBefore?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "onSelect"> {
|
|
21
|
+
items: readonly MenuItem[];
|
|
22
|
+
onSelect?: (id: string) => void;
|
|
23
|
+
/** Visible trigger content, e.g. an icon or text. */
|
|
24
|
+
trigger: ReactNode;
|
|
25
|
+
/** Accessible name for the trigger; required when the trigger is icon-only. */
|
|
26
|
+
triggerLabel?: string;
|
|
27
|
+
align?: "start" | "end";
|
|
28
|
+
appearance?: MenuAppearance;
|
|
29
|
+
recipe?: MenuRecipe;
|
|
30
|
+
adaptation?: "host" | "fixed";
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Menu.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Menu/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AAChG,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAElD,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,sBAAsB;QAC9B,IAAI,EAAE,cAAc,CAAC;KACtB;CACF;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACxC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9F,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,qDAAqD;IACrD,OAAO,EAAE,SAAS,CAAC;IACnB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessageBubbleProps } from "./MessageBubble.types";
|
|
2
|
+
export declare function MessageBubble({ direction, time, status, author, authorColor, authorBadge, reply, title, reactions, actions, onAction, avatar, avatarSpace, tail, appearance, recipe, adaptation, className, style, children, ...props }: MessageBubbleProps): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=MessageBubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/ui/components/MessageBubble/MessageBubble.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,MAAM,uBAAuB,CAAC;AAGnF,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,IAAI,EACJ,MAAM,EACN,MAAM,EACN,WAAW,EACX,WAAW,EACX,KAAK,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAmB,EACnB,IAAW,EACX,UAAU,EACV,MAAM,EACN,UAAmB,EACnB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAsEpB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { createSlotProps } from "../../core/appearance.js";
|
|
4
|
+
import { useHostAppearance } from "../../core/AppssProvider.js";
|
|
5
|
+
import { MessageStatusIcon } from "../ChatListItem/MessageStatusIcon.js";
|
|
6
|
+
import classes from "./MessageBubble.module.css.js";
|
|
7
|
+
function MessageBubble({
|
|
8
|
+
direction,
|
|
9
|
+
time,
|
|
10
|
+
status,
|
|
11
|
+
author,
|
|
12
|
+
authorColor,
|
|
13
|
+
authorBadge,
|
|
14
|
+
reply,
|
|
15
|
+
title,
|
|
16
|
+
reactions,
|
|
17
|
+
actions,
|
|
18
|
+
onAction,
|
|
19
|
+
avatar,
|
|
20
|
+
avatarSpace = false,
|
|
21
|
+
tail = true,
|
|
22
|
+
appearance,
|
|
23
|
+
recipe,
|
|
24
|
+
adaptation = "host",
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
const host = useHostAppearance("MessageBubble");
|
|
31
|
+
const slot = createSlotProps(
|
|
32
|
+
{ classNames: classes },
|
|
33
|
+
recipe?.appearance,
|
|
34
|
+
adaptation === "host" ? host : void 0,
|
|
35
|
+
appearance,
|
|
36
|
+
{ classNames: { root: className ?? "" }, styles: { root: style ?? {} } }
|
|
37
|
+
);
|
|
38
|
+
const authorProps = slot("authorName");
|
|
39
|
+
const replyProps = slot("reply");
|
|
40
|
+
const replyColor = reply?.color ? { "--appss-reply-color": reply.color } : void 0;
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { ...props, ...slot("root"), "data-direction": direction, "data-tail": tail, children: [
|
|
42
|
+
(avatar || avatarSpace) && /* @__PURE__ */ jsx("div", { ...slot("avatar"), children: avatar }),
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { ...slot("bubble"), children: [
|
|
44
|
+
(author || authorBadge) && /* @__PURE__ */ jsxs("div", { ...slot("author"), children: [
|
|
45
|
+
author && /* @__PURE__ */ jsx(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
...authorProps,
|
|
49
|
+
style: { ...authorProps.style, ...authorColor ? { color: authorColor } : {} },
|
|
50
|
+
children: author
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
authorBadge && /* @__PURE__ */ jsx("span", { ...slot("authorBadge"), children: authorBadge })
|
|
54
|
+
] }),
|
|
55
|
+
reply && /* @__PURE__ */ jsxs("blockquote", { ...replyProps, style: { ...replyProps.style, ...replyColor }, children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { ...slot("replyAuthor"), children: reply.author }),
|
|
57
|
+
/* @__PURE__ */ jsx("span", { ...slot("replyText"), children: reply.text })
|
|
58
|
+
] }),
|
|
59
|
+
title && /* @__PURE__ */ jsx("div", { ...slot("title"), children: title }),
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { ...slot("content"), children: [
|
|
61
|
+
children,
|
|
62
|
+
reactions && /* @__PURE__ */ jsx("div", { ...slot("reactions"), children: reactions }),
|
|
63
|
+
(time || status) && /* @__PURE__ */ jsxs("span", { ...slot("meta"), children: [
|
|
64
|
+
time && /* @__PURE__ */ jsx("span", { ...slot("time"), children: time }),
|
|
65
|
+
status && direction === "out" && /* @__PURE__ */ jsx(MessageStatusIcon, { ...slot("status"), status })
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
actions && actions.length > 0 && /* @__PURE__ */ jsx("div", { ...slot("actions"), children: actions.map((action) => /* @__PURE__ */ createElement(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
...slot("action"),
|
|
72
|
+
key: action.id,
|
|
73
|
+
type: "button",
|
|
74
|
+
onClick: () => onAction?.(action.id)
|
|
75
|
+
},
|
|
76
|
+
action.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: action.icon }),
|
|
77
|
+
action.label
|
|
78
|
+
)) })
|
|
79
|
+
] })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
MessageBubble
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=MessageBubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.js","sources":["../../../src/ui/components/MessageBubble/MessageBubble.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { createSlotProps } from \"../../core/appearance\";\nimport { useHostAppearance } from \"../../core/AppssProvider\";\nimport { MessageStatusIcon } from \"../ChatListItem/MessageStatusIcon\";\nimport type { MessageBubbleProps, MessageBubbleSlot } from \"./MessageBubble.types\";\nimport classes from \"./MessageBubble.module.css\";\n\nexport function MessageBubble({\n direction,\n time,\n status,\n author,\n authorColor,\n authorBadge,\n reply,\n title,\n reactions,\n actions,\n onAction,\n avatar,\n avatarSpace = false,\n tail = true,\n appearance,\n recipe,\n adaptation = \"host\",\n className,\n style,\n children,\n ...props\n}: MessageBubbleProps) {\n const host = useHostAppearance(\"MessageBubble\");\n const slot = createSlotProps<MessageBubbleSlot>(\n { classNames: classes },\n recipe?.appearance,\n adaptation === \"host\" ? host : undefined,\n appearance,\n { classNames: { root: className ?? \"\" }, styles: { root: style ?? {} } },\n );\n // Instance colors are merged into the slot styles, never replacing them.\n const authorProps = slot(\"authorName\");\n const replyProps = slot(\"reply\");\n const replyColor = reply?.color\n ? ({ \"--appss-reply-color\": reply.color } as CSSProperties)\n : undefined;\n\n return (\n <div {...props} {...slot(\"root\")} data-direction={direction} data-tail={tail}>\n {(avatar || avatarSpace) && <div {...slot(\"avatar\")}>{avatar}</div>}\n <div {...slot(\"bubble\")}>\n {(author || authorBadge) && (\n <div {...slot(\"author\")}>\n {author && (\n <span\n {...authorProps}\n style={{ ...authorProps.style, ...(authorColor ? { color: authorColor } : {}) }}\n >\n {author}\n </span>\n )}\n {authorBadge && <span {...slot(\"authorBadge\")}>{authorBadge}</span>}\n </div>\n )}\n {reply && (\n <blockquote {...replyProps} style={{ ...replyProps.style, ...replyColor }}>\n <span {...slot(\"replyAuthor\")}>{reply.author}</span>\n <span {...slot(\"replyText\")}>{reply.text}</span>\n </blockquote>\n )}\n {title && <div {...slot(\"title\")}>{title}</div>}\n <div {...slot(\"content\")}>\n {children}\n {reactions && <div {...slot(\"reactions\")}>{reactions}</div>}\n {(time || status) && (\n <span {...slot(\"meta\")}>\n {time && <span {...slot(\"time\")}>{time}</span>}\n {status && direction === \"out\" && (\n <MessageStatusIcon {...slot(\"status\")} status={status} />\n )}\n </span>\n )}\n </div>\n {actions && actions.length > 0 && (\n <div {...slot(\"actions\")}>\n {actions.map((action) => (\n <button\n {...slot(\"action\")}\n key={action.id}\n type=\"button\"\n onClick={() => onAction?.(action.id)}\n >\n {action.icon && <span aria-hidden=\"true\">{action.icon}</span>}\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const root = "appss-root-UBxdZ";
|
|
2
|
+
const avatar = "appss-avatar-A8IIT";
|
|
3
|
+
const bubble = "appss-bubble-FWe3x";
|
|
4
|
+
const author = "appss-author-p-T-A";
|
|
5
|
+
const authorName = "appss-authorName-oJKlb";
|
|
6
|
+
const authorBadge = "appss-authorBadge-eeIAZ";
|
|
7
|
+
const reply = "appss-reply-fagAO";
|
|
8
|
+
const replyAuthor = "appss-replyAuthor-N-imm";
|
|
9
|
+
const replyText = "appss-replyText-zGx0A";
|
|
10
|
+
const reactions = "appss-reactions-Yz5TT";
|
|
11
|
+
const title = "appss-title-yao4K";
|
|
12
|
+
const content = "appss-content-UWadi";
|
|
13
|
+
const meta = "appss-meta-I0gYw";
|
|
14
|
+
const status = "appss-status-3pu76";
|
|
15
|
+
const actions = "appss-actions-sTlAr";
|
|
16
|
+
const action = "appss-action-Aa9ZS";
|
|
17
|
+
const classes = {
|
|
18
|
+
root,
|
|
19
|
+
avatar,
|
|
20
|
+
bubble,
|
|
21
|
+
author,
|
|
22
|
+
authorName,
|
|
23
|
+
authorBadge,
|
|
24
|
+
reply,
|
|
25
|
+
replyAuthor,
|
|
26
|
+
replyText,
|
|
27
|
+
reactions,
|
|
28
|
+
title,
|
|
29
|
+
content,
|
|
30
|
+
meta,
|
|
31
|
+
status,
|
|
32
|
+
actions,
|
|
33
|
+
action
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
action,
|
|
37
|
+
actions,
|
|
38
|
+
author,
|
|
39
|
+
authorBadge,
|
|
40
|
+
authorName,
|
|
41
|
+
avatar,
|
|
42
|
+
bubble,
|
|
43
|
+
content,
|
|
44
|
+
classes as default,
|
|
45
|
+
meta,
|
|
46
|
+
reactions,
|
|
47
|
+
reply,
|
|
48
|
+
replyAuthor,
|
|
49
|
+
replyText,
|
|
50
|
+
root,
|
|
51
|
+
status,
|
|
52
|
+
title
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=MessageBubble.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { Appearance, Recipe } from "../../core/appearance";
|
|
3
|
+
import type { MessageStatus } from "../ChatListItem/ChatListItem.types";
|
|
4
|
+
export type MessageBubbleSlot = "root" | "avatar" | "bubble" | "author" | "authorName" | "authorBadge" | "reply" | "replyAuthor" | "replyText" | "title" | "content" | "reactions" | "meta" | "time" | "status" | "actions" | "action";
|
|
5
|
+
export type MessageBubbleAppearance = Appearance<MessageBubbleSlot>;
|
|
6
|
+
declare module "../../core/appearance" {
|
|
7
|
+
interface ComponentAppearanceMap {
|
|
8
|
+
MessageBubble: MessageBubbleAppearance;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export type MessageBubbleRecipe = Recipe<"MessageBubble">;
|
|
12
|
+
export interface MessageBubbleAction {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface MessageBubbleReply {
|
|
18
|
+
author: ReactNode;
|
|
19
|
+
text: ReactNode;
|
|
20
|
+
/** Accent of the quote bar and author name; defaults to the platform link color. */
|
|
21
|
+
color?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MessageBubbleProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
24
|
+
/** in: received, aligned to the start; out: sent by the user, aligned to the end. */
|
|
25
|
+
direction: "in" | "out";
|
|
26
|
+
time?: string;
|
|
27
|
+
/** Delivery state; shown for outgoing messages. */
|
|
28
|
+
status?: MessageStatus;
|
|
29
|
+
/** Sender name in group chats, shown at the top of the bubble. */
|
|
30
|
+
author?: ReactNode;
|
|
31
|
+
/** Color of the sender name; group chats give each member their own. */
|
|
32
|
+
authorColor?: string;
|
|
33
|
+
/** Role label next to the author, e.g. "владелец". */
|
|
34
|
+
authorBadge?: ReactNode;
|
|
35
|
+
/** Quoted message this one replies to. */
|
|
36
|
+
reply?: MessageBubbleReply;
|
|
37
|
+
/** Bold first line, e.g. a business message heading. */
|
|
38
|
+
title?: ReactNode;
|
|
39
|
+
/** Reaction chips under the text. */
|
|
40
|
+
reactions?: ReactNode;
|
|
41
|
+
/** Quick-reply buttons attached under the message. */
|
|
42
|
+
actions?: readonly MessageBubbleAction[];
|
|
43
|
+
onAction?: (id: string) => void;
|
|
44
|
+
/** Sender avatar beside incoming group messages, usually on the last one of a group. */
|
|
45
|
+
avatar?: ReactNode;
|
|
46
|
+
/** Keeps the avatar column empty so a group of messages stays aligned. */
|
|
47
|
+
avatarSpace?: boolean;
|
|
48
|
+
/** Draws the tail; WhatsApp puts it on the first message of a group, Telegram on the last. */
|
|
49
|
+
tail?: boolean;
|
|
50
|
+
appearance?: MessageBubbleAppearance;
|
|
51
|
+
recipe?: MessageBubbleRecipe;
|
|
52
|
+
adaptation?: "host" | "fixed";
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=MessageBubble.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.types.d.ts","sourceRoot":"","sources":["../../../src/ui/components/MessageBubble/MessageBubble.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,OAAO,GACP,aAAa,GACb,WAAW,GACX,OAAO,GACP,SAAS,GACT,WAAW,GACX,MAAM,GACN,MAAM,GACN,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC;AACb,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAEpE,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,sBAAsB;QAC9B,aAAa,EAAE,uBAAuB,CAAC;KACxC;CACF;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACvF,qFAAqF;IACrF,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,wDAAwD;IACxD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,qCAAqC;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,wFAAwF;IACxF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessageComposerProps } from "./MessageComposer.types";
|
|
2
|
+
export declare function MessageComposer({ label, leading, fieldAction, trailing, onSend, onKeyDown, appearance, recipe, adaptation, className, style, ...props }: MessageComposerProps): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=MessageComposer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageComposer.d.ts","sourceRoot":"","sources":["../../../src/ui/components/MessageComposer/MessageComposer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAuB,MAAM,yBAAyB,CAAC;AAGzF,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,OAAO,EACP,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAmB,EACnB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAiCtB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createSlotProps } from "../../core/appearance.js";
|
|
3
|
+
import { useHostAppearance } from "../../core/AppssProvider.js";
|
|
4
|
+
import classes from "./MessageComposer.module.css.js";
|
|
5
|
+
function MessageComposer({
|
|
6
|
+
label,
|
|
7
|
+
leading,
|
|
8
|
+
fieldAction,
|
|
9
|
+
trailing,
|
|
10
|
+
onSend,
|
|
11
|
+
onKeyDown,
|
|
12
|
+
appearance,
|
|
13
|
+
recipe,
|
|
14
|
+
adaptation = "host",
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
const host = useHostAppearance("MessageComposer");
|
|
20
|
+
const slot = createSlotProps(
|
|
21
|
+
{ classNames: classes },
|
|
22
|
+
recipe?.appearance,
|
|
23
|
+
adaptation === "host" ? host : void 0,
|
|
24
|
+
appearance,
|
|
25
|
+
{ classNames: { root: className ?? "" }, styles: { root: style ?? {} } }
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { ...slot("root"), children: [
|
|
28
|
+
leading && /* @__PURE__ */ jsx("div", { ...slot("leading"), children: leading }),
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { ...slot("field"), children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
"input",
|
|
32
|
+
{
|
|
33
|
+
...props,
|
|
34
|
+
...slot("input"),
|
|
35
|
+
type: "text",
|
|
36
|
+
"aria-label": label,
|
|
37
|
+
enterKeyHint: "send",
|
|
38
|
+
onKeyDown: (event) => {
|
|
39
|
+
onKeyDown?.(event);
|
|
40
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing && onSend) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
onSend();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
fieldAction && /* @__PURE__ */ jsx("div", { ...slot("fieldAction"), children: fieldAction })
|
|
48
|
+
] }),
|
|
49
|
+
trailing && /* @__PURE__ */ jsx("div", { ...slot("trailing"), children: trailing })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
MessageComposer
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=MessageComposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageComposer.js","sources":["../../../src/ui/components/MessageComposer/MessageComposer.tsx"],"sourcesContent":["import { createSlotProps } from \"../../core/appearance\";\nimport { useHostAppearance } from \"../../core/AppssProvider\";\nimport type { MessageComposerProps, MessageComposerSlot } from \"./MessageComposer.types\";\nimport classes from \"./MessageComposer.module.css\";\n\nexport function MessageComposer({\n label,\n leading,\n fieldAction,\n trailing,\n onSend,\n onKeyDown,\n appearance,\n recipe,\n adaptation = \"host\",\n className,\n style,\n ...props\n}: MessageComposerProps) {\n const host = useHostAppearance(\"MessageComposer\");\n const slot = createSlotProps<MessageComposerSlot>(\n { classNames: classes },\n recipe?.appearance,\n adaptation === \"host\" ? host : undefined,\n appearance,\n { classNames: { root: className ?? \"\" }, styles: { root: style ?? {} } },\n );\n\n return (\n <div {...slot(\"root\")}>\n {leading && <div {...slot(\"leading\")}>{leading}</div>}\n <div {...slot(\"field\")}>\n <input\n {...props}\n {...slot(\"input\")}\n type=\"text\"\n aria-label={label}\n enterKeyHint=\"send\"\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing && onSend) {\n event.preventDefault();\n onSend();\n }\n }}\n />\n {fieldAction && <div {...slot(\"fieldAction\")}>{fieldAction}</div>}\n </div>\n {trailing && <div {...slot(\"trailing\")}>{trailing}</div>}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AAKO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,QAAM,OAAO,kBAAkB,iBAAiB;AAChD,QAAM,OAAO;AAAA,IACX,EAAE,YAAY,QAAA;AAAA,IACd,QAAQ;AAAA,IACR,eAAe,SAAS,OAAO;AAAA,IAC/B;AAAA,IACA,EAAE,YAAY,EAAE,MAAM,aAAa,MAAM,QAAQ,EAAE,MAAM,SAAS,KAAG;AAAA,EAAE;AAGzE,SACE,qBAAC,OAAA,EAAK,GAAG,KAAK,MAAM,GACjB,UAAA;AAAA,IAAA,+BAAY,OAAA,EAAK,GAAG,KAAK,SAAS,GAAI,UAAA,SAAQ;AAAA,IAC/C,qBAAC,OAAA,EAAK,GAAG,KAAK,OAAO,GACnB,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG,KAAK,OAAO;AAAA,UAChB,MAAK;AAAA,UACL,cAAY;AAAA,UACZ,cAAa;AAAA,UACb,WAAW,CAAC,UAAU;AACpB,wBAAY,KAAK;AACjB,gBAAI,MAAM,QAAQ,WAAW,CAAC,MAAM,YAAY,eAAe,QAAQ;AACrE,oBAAM,eAAA;AACN,qBAAA;AAAA,YACF;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,MAED,eAAe,oBAAC,OAAA,EAAK,GAAG,KAAK,aAAa,GAAI,UAAA,YAAA,CAAY;AAAA,IAAA,GAC7D;AAAA,IACC,YAAY,oBAAC,OAAA,EAAK,GAAG,KAAK,UAAU,GAAI,UAAA,SAAA,CAAS;AAAA,EAAA,GACpD;AAEJ;"}
|