@ada-cx/lovelace 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AgentMessage/AgentMessage.js.map +1 -1
- package/dist/components/AttachmentChip/AttachmentChip.css.js +1 -1
- package/dist/components/AttachmentChip/AttachmentChip.js.map +1 -1
- package/dist/components/Avatar/Avatar.css.js +1 -1
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/AvatarPlaceholder.js.map +1 -1
- package/dist/components/Banner/Banner.css.js +1 -1
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Banner/BannerContainer.js.map +1 -1
- package/dist/components/Banner/BannerContainerSlide.js.map +1 -1
- package/dist/components/BubbleOverlay/BubbleOverlay.js.map +1 -1
- package/dist/components/Button/Button.css.js +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/CardActions.js.map +1 -1
- package/dist/components/Card/CardBody.js.map +1 -1
- package/dist/components/Card/CardDescription.js.map +1 -1
- package/dist/components/Card/CardMedia.js.map +1 -1
- package/dist/components/Card/CardRoot.js.map +1 -1
- package/dist/components/Card/CardTitle.js.map +1 -1
- package/dist/components/Carousel/Carousel.js +60 -60
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/CarouselItem.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.css.js +1 -1
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/components/Checkbox/CheckboxIndicator.js.map +1 -1
- package/dist/components/Chip/Chip.css.js +1 -1
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Dialog/Dialog.css.js +1 -1
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/DialogActions.js.map +1 -1
- package/dist/components/Dialog/DialogBody.js.map +1 -1
- package/dist/components/Dialog/DialogContent.js.map +1 -1
- package/dist/components/Dialog/DialogIcon.js.map +1 -1
- package/dist/components/Dialog/DialogRoot.js.map +1 -1
- package/dist/components/Dialog/DialogTitle.js.map +1 -1
- package/dist/components/DialogOverlay/DialogOverlay.js.map +1 -1
- package/dist/components/Divider/Divider.css.js +1 -1
- package/dist/components/Divider/Divider.js.map +1 -1
- package/dist/components/DropZone/DropZone.js.map +1 -1
- package/dist/components/FullscreenOverlay/FullscreenOverlay.js.map +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/HeaderRoot.js.map +1 -1
- package/dist/components/Header/HeaderTitle.js.map +1 -1
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Icon/icons/AdaLogo.js.map +1 -1
- package/dist/components/Icon/icons/ArrowDown.js.map +1 -1
- package/dist/components/Icon/icons/ArrowLeft.js.map +1 -1
- package/dist/components/Icon/icons/ArrowNortheast.js.map +1 -1
- package/dist/components/Icon/icons/ArrowNorthwest.js.map +1 -1
- package/dist/components/Icon/icons/ArrowRight.js.map +1 -1
- package/dist/components/Icon/icons/ArrowUp.js.map +1 -1
- package/dist/components/Icon/icons/Bell.js.map +1 -1
- package/dist/components/Icon/icons/BellSlash.js.map +1 -1
- package/dist/components/Icon/icons/Checkmark.js.map +1 -1
- package/dist/components/Icon/icons/CheckmarkCircle.js.map +1 -1
- package/dist/components/Icon/icons/ChevronLeft.js.map +1 -1
- package/dist/components/Icon/icons/ChevronRight.js.map +1 -1
- package/dist/components/Icon/icons/CloudUpload.js.map +1 -1
- package/dist/components/Icon/icons/Document.js.map +1 -1
- package/dist/components/Icon/icons/Download.js.map +1 -1
- package/dist/components/Icon/icons/Ellipses.js.map +1 -1
- package/dist/components/Icon/icons/Email.js.map +1 -1
- package/dist/components/Icon/icons/ExclamationSync.js.map +1 -1
- package/dist/components/Icon/icons/ExclamationTriangle.js.map +1 -1
- package/dist/components/Icon/icons/Eye.js.map +1 -1
- package/dist/components/Icon/icons/EyeSlash.js.map +1 -1
- package/dist/components/Icon/icons/Glyph.js.map +1 -1
- package/dist/components/Icon/icons/Language.js.map +1 -1
- package/dist/components/Icon/icons/MediaSlash.js.map +1 -1
- package/dist/components/Icon/icons/MessagingFill.js.map +1 -1
- package/dist/components/Icon/icons/Minimize.js.map +1 -1
- package/dist/components/Icon/icons/Mute.js.map +1 -1
- package/dist/components/Icon/icons/Paperclip.js.map +1 -1
- package/dist/components/Icon/icons/PersonFill.js.map +1 -1
- package/dist/components/Icon/icons/PlayFill.js.map +1 -1
- package/dist/components/Icon/icons/Send.js.map +1 -1
- package/dist/components/Icon/icons/StarBadgeFill.js.map +1 -1
- package/dist/components/Icon/icons/ThumbsDown.js.map +1 -1
- package/dist/components/Icon/icons/ThumbsUp.js.map +1 -1
- package/dist/components/Icon/icons/Volume.js.map +1 -1
- package/dist/components/Icon/icons/Xmark.js.map +1 -1
- package/dist/components/Icon/icons/XmarkCircle.js.map +1 -1
- package/dist/components/IconButton/IconButton.css.js +1 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Input/Input.context.js.map +1 -1
- package/dist/components/Input/Input.css.js +1 -1
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/InputAttachments.js.map +1 -1
- package/dist/components/Input/InputButton.js.map +1 -1
- package/dist/components/Input/InputControl.js.map +1 -1
- package/dist/components/Input/InputField.js.map +1 -1
- package/dist/components/Input/InputHelperText.js.map +1 -1
- package/dist/components/Input/InputLabel.js.map +1 -1
- package/dist/components/Input/InputRoot.js.map +1 -1
- package/dist/components/Input/InputTextArea.js.map +1 -1
- package/dist/components/Link/Link.css.js +1 -1
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/MenuItem/Menu.js.map +1 -1
- package/dist/components/MenuItem/MenuItem.js.map +1 -1
- package/dist/components/MenuItem/MenuItemCheckbox.js.map +1 -1
- package/dist/components/MenuItem/MenuItemLabel.js.map +1 -1
- package/dist/components/MenuItem/MenuItemRadio.js.map +1 -1
- package/dist/components/MenuItem/MenuItemRoot.js.map +1 -1
- package/dist/components/MenuItem/MenuItemToggle.js.map +1 -1
- package/dist/components/MessageError/MessageError.js.map +1 -1
- package/dist/components/MessageProse/MessageProse.js.map +1 -1
- package/dist/components/MessageRow/MessageRow.context.js.map +1 -1
- package/dist/components/MessageRow/MessageRow.css.js +1 -1
- package/dist/components/MessageRow/MessageRow.js.map +1 -1
- package/dist/components/MessageRow/MessageRowContent.js.map +1 -1
- package/dist/components/MessageRow/MessageRowRoot.js.map +1 -1
- package/dist/components/PictureMessage/PictureMessage.css.js +1 -1
- package/dist/components/PictureMessage/PictureMessage.js.map +1 -1
- package/dist/components/PillButton/PillButton.css.js +1 -1
- package/dist/components/PillButton/PillButton.js.map +1 -1
- package/dist/components/ProactiveMessage/ProactiveMessage.js.map +1 -1
- package/dist/components/Radio/Radio.css.js +1 -1
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/RadioGroup.js.map +1 -1
- package/dist/components/Radio/RadioIndicator.js.map +1 -1
- package/dist/components/ScrollMarker/ScrollMarker.css.js +1 -1
- package/dist/components/ScrollMarker/ScrollMarker.js.map +1 -1
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/Sheet/SheetActions.js.map +1 -1
- package/dist/components/Sheet/SheetBackButton.js.map +1 -1
- package/dist/components/Sheet/SheetBody.js.map +1 -1
- package/dist/components/Sheet/SheetCloseButton.js.map +1 -1
- package/dist/components/Sheet/SheetHeader.js.map +1 -1
- package/dist/components/Sheet/SheetRoot.js.map +1 -1
- package/dist/components/Sheet/SheetTitle.js.map +1 -1
- package/dist/components/SheetOverlay/SheetOverlay.js.map +1 -1
- package/dist/components/Spinner/Spinner.css.js +1 -1
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/SurveyRating/SurveyRating.js.map +1 -1
- package/dist/components/SurveySelect/SurveySelect.js.map +1 -1
- package/dist/components/Text/Text.css.js +1 -1
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/ThinkingShimmer/ThinkingShimmer.js.map +1 -1
- package/dist/components/Toast/Toast.css.js +1 -1
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/ToastContainer.js.map +1 -1
- package/dist/components/Toast/index.js +4 -4
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Toggle/ToggleIndicator.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/TypingIndicator/TypingIndicator.js.map +1 -1
- package/dist/components/UserMessage/UserMessage.js.map +1 -1
- package/dist/components/VideoMessage/VideoMessage.css.js +1 -1
- package/dist/components/VideoMessage/VideoMessage.js.map +1 -1
- package/dist/hooks/overlayRegistry.js.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.js.map +1 -1
- package/dist/hooks/useSubmitOnEnter.js.map +1 -1
- package/dist/runtime/LovelaceProvider.js +6 -6
- package/dist/runtime/LovelaceProvider.js.map +1 -1
- package/dist/runtime/branding.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens/tokens.js.map +1 -1
- package/dist/utils/animation.js.map +1 -1
- package/dist/utils/cx.js.map +1 -1
- package/dist/vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js +1 -1
- package/dist/vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageProse.js","names":[],"sources":["../../../src/components/MessageProse/MessageProse.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { messageProse } from \"./MessageProse.css.js\";\n\nexport interface MessageProseProps {\n\t/** The per-sender class the hosting message component adds. */\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * The body element of a message: the prose rules, message typography, and\n * `dir=\"auto\"`.\n *\n * Internal — not exported from the package. It exists because the pairing of\n * `dir=\"auto\"` with the prose class is an invariant that a shared *style*\n * cannot carry: direction detection is markup. Both message components\n * repeated the pair with nothing enforcing it.\n *\n * It stamps `data-slot=\"message-body\"`, which is the only stable way to find a\n * rendered message body: the class names are build hashes. Both message\n * components inherit the hook by composing this.\n *\n * `dir` is applied after the caller's props so a consumer cannot break the\n * pairing by passing one.\n */\nexport function MessageProse({\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageProseProps) {\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdir=\"auto\"\n\t\t\tdata-slot=\"message-body\"\n\t\t\tclassName={cx(messageProse, className)}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AA4BA,SAAgB,EAAa,EAC5B,cACA,aACA,GAAG,KACkB;
|
|
1
|
+
{"version":3,"file":"MessageProse.js","names":[],"sources":["../../../src/components/MessageProse/MessageProse.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { messageProse } from \"./MessageProse.css.js\";\n\nexport interface MessageProseProps {\n\t/** The per-sender class the hosting message component adds. */\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * The body element of a message: the prose rules, message typography, and\n * `dir=\"auto\"`.\n *\n * Internal — not exported from the package. It exists because the pairing of\n * `dir=\"auto\"` with the prose class is an invariant that a shared *style*\n * cannot carry: direction detection is markup. Both message components\n * repeated the pair with nothing enforcing it.\n *\n * It stamps `data-slot=\"message-body\"`, which is the only stable way to find a\n * rendered message body: the class names are build hashes. Both message\n * components inherit the hook by composing this.\n *\n * `dir` is applied after the caller's props so a consumer cannot break the\n * pairing by passing one.\n */\nexport function MessageProse({\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageProseProps) {\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdir=\"auto\"\n\t\t\tdata-slot=\"message-body\"\n\t\t\tclassName={cx(messageProse, className)}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AA4BA,SAAgB,EAAa,EAC5B,cACA,aACA,GAAG,KACkB;CACrB,OACC,kBAAC,OAAD;EACC,GAAI;EACJ,KAAI;EACJ,aAAU;EACV,WAAW,EAAG,GAAc,CAAS;EAEpC;CACG,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageRow.context.js","names":[],"sources":["../../../src/components/MessageRow/MessageRow.context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport type MessageSender = \"user\" | \"agent\";\n\n/** Lets `MessageRow.Content` align and cap itself, so a caller cannot pass a\n * row and a column that disagree on the sender. */\nexport const MessageRowContext = createContext<MessageSender>(\"agent\");\n\nexport const useMessageRowSender = () => useContext(MessageRowContext);\n"],"mappings":";;AAMA,IAAa,IAAoB,EAA6B,
|
|
1
|
+
{"version":3,"file":"MessageRow.context.js","names":[],"sources":["../../../src/components/MessageRow/MessageRow.context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport type MessageSender = \"user\" | \"agent\";\n\n/** Lets `MessageRow.Content` align and cap itself, so a caller cannot pass a\n * row and a column that disagree on the sender. */\nexport const MessageRowContext = createContext<MessageSender>(\"agent\");\n\nexport const useMessageRowSender = () => useContext(MessageRowContext);\n"],"mappings":";;AAMA,IAAa,IAAoB,EAA6B,OAAO,GAExD,UAA4B,EAAW,CAAiB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/MessageRow/MessageRow.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageRow.js","names":[],"sources":["../../../src/components/MessageRow/MessageRow.tsx"],"sourcesContent":["import { MessageRowContent } from \"./MessageRowContent.js\";\nimport { MessageRowRoot } from \"./MessageRowRoot.js\";\n\nexport type { MessageSender } from \"./MessageRow.context.js\";\nexport type { MessageRowContentProps } from \"./MessageRowContent.js\";\nexport type { MessageRowProps } from \"./MessageRowRoot.js\";\n\nexport const MessageRow = Object.assign(MessageRowRoot, {\n\tContent: MessageRowContent,\n});\n"],"mappings":";;;AAOA,IAAa,IAAa,OAAO,OAAO,GAAgB,EACvD,SAAS,
|
|
1
|
+
{"version":3,"file":"MessageRow.js","names":[],"sources":["../../../src/components/MessageRow/MessageRow.tsx"],"sourcesContent":["import { MessageRowContent } from \"./MessageRowContent.js\";\nimport { MessageRowRoot } from \"./MessageRowRoot.js\";\n\nexport type { MessageSender } from \"./MessageRow.context.js\";\nexport type { MessageRowContentProps } from \"./MessageRowContent.js\";\nexport type { MessageRowProps } from \"./MessageRowRoot.js\";\n\nexport const MessageRow = Object.assign(MessageRowRoot, {\n\tContent: MessageRowContent,\n});\n"],"mappings":";;;AAOA,IAAa,IAAa,OAAO,OAAO,GAAgB,EACvD,SAAS,EACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageRowContent.js","names":[],"sources":["../../../src/components/MessageRow/MessageRowContent.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { useMessageRowSender } from \"./MessageRow.context.js\";\nimport { messageRowContent } from \"./MessageRow.css.js\";\n\nexport interface MessageRowContentProps {\n\t/** Lets the column span the row, for content that supplies no width itself. */\n\tfill?: boolean;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * The column holding everything that belongs to the message: the message body\n * and any sibling the transcript places with it, such as an attribution, a\n * reaction bar or a retry control.\n *\n * Carries the message typography, so a row whose content is a card, a widget or\n * media reads at message size without rendering a prose body.\n *\n * Stamps `data-slot=\"content\"` for a transcript that needs to find it.\n */\nexport function MessageRowContent({\n\tfill = false,\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageRowContentProps) {\n\tconst sender = useMessageRowSender();\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-slot=\"content\"\n\t\t\tclassName={cx(messageRowContent({ sender, fill }), className)}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAkB,EACjC,UAAO,IACP,cACA,aACA,GAAG,KACuB;CAC1B,IAAM,IAAS,
|
|
1
|
+
{"version":3,"file":"MessageRowContent.js","names":[],"sources":["../../../src/components/MessageRow/MessageRowContent.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { useMessageRowSender } from \"./MessageRow.context.js\";\nimport { messageRowContent } from \"./MessageRow.css.js\";\n\nexport interface MessageRowContentProps {\n\t/** Lets the column span the row, for content that supplies no width itself. */\n\tfill?: boolean;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * The column holding everything that belongs to the message: the message body\n * and any sibling the transcript places with it, such as an attribution, a\n * reaction bar or a retry control.\n *\n * Carries the message typography, so a row whose content is a card, a widget or\n * media reads at message size without rendering a prose body.\n *\n * Stamps `data-slot=\"content\"` for a transcript that needs to find it.\n */\nexport function MessageRowContent({\n\tfill = false,\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageRowContentProps) {\n\tconst sender = useMessageRowSender();\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-slot=\"content\"\n\t\t\tclassName={cx(messageRowContent({ sender, fill }), className)}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAkB,EACjC,UAAO,IACP,cACA,aACA,GAAG,KACuB;CAC1B,IAAM,IAAS,EAAoB;CAEnC,OACC,kBAAC,OAAD;EACC,GAAI;EACJ,aAAU;EACV,WAAW,EAAG,EAAkB;GAAE;GAAQ;EAAK,CAAC,GAAG,CAAS;EAE3D;CACG,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageRowRoot.js","names":[],"sources":["../../../src/components/MessageRow/MessageRowRoot.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport type { MessageSender } from \"./MessageRow.context.js\";\nimport { MessageRowContext } from \"./MessageRow.context.js\";\nimport { messageRowRoot } from \"./MessageRow.css.js\";\n\nexport interface MessageRowProps {\n\tsender: MessageSender;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The avatar gutter, then `MessageRow.Content`. */\n\tchildren?: ReactNode;\n}\n\n/**\n * One row of a transcript: an optional leading avatar gutter, then the column\n * of everything that belongs to the message.\n *\n * The avatar is a child rather than a prop because a companion control inside\n * the column aligns with the message text only while the avatar stays the\n * column's sibling.\n *\n * The row imposes no message body. A row that wants prose renders\n * `AgentMessage` or `UserMessage` inside the column; a card, a widget or media\n * renders neither.\n */\nexport function MessageRowRoot({\n\tsender,\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageRowProps) {\n\treturn (\n\t\t<MessageRowContext.Provider value={sender}>\n\t\t\t<div {...rest} className={cx(messageRowRoot({ sender }), className)}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</MessageRowContext.Provider>\n\t);\n}\n"],"mappings":";;;;;AA2BA,SAAgB,EAAe,EAC9B,WACA,cACA,aACA,GAAG,KACgB;
|
|
1
|
+
{"version":3,"file":"MessageRowRoot.js","names":[],"sources":["../../../src/components/MessageRow/MessageRowRoot.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport type { MessageSender } from \"./MessageRow.context.js\";\nimport { MessageRowContext } from \"./MessageRow.context.js\";\nimport { messageRowRoot } from \"./MessageRow.css.js\";\n\nexport interface MessageRowProps {\n\tsender: MessageSender;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The avatar gutter, then `MessageRow.Content`. */\n\tchildren?: ReactNode;\n}\n\n/**\n * One row of a transcript: an optional leading avatar gutter, then the column\n * of everything that belongs to the message.\n *\n * The avatar is a child rather than a prop because a companion control inside\n * the column aligns with the message text only while the avatar stays the\n * column's sibling.\n *\n * The row imposes no message body. A row that wants prose renders\n * `AgentMessage` or `UserMessage` inside the column; a card, a widget or media\n * renders neither.\n */\nexport function MessageRowRoot({\n\tsender,\n\tclassName,\n\tchildren,\n\t...rest\n}: MessageRowProps) {\n\treturn (\n\t\t<MessageRowContext.Provider value={sender}>\n\t\t\t<div {...rest} className={cx(messageRowRoot({ sender }), className)}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</MessageRowContext.Provider>\n\t);\n}\n"],"mappings":";;;;;AA2BA,SAAgB,EAAe,EAC9B,WACA,cACA,aACA,GAAG,KACgB;CACnB,OACC,kBAAC,EAAkB,UAAnB;EAA4B,OAAO;YAClC,kBAAC,OAAD;GAAK,GAAI;GAAM,WAAW,EAAG,EAAe,EAAE,UAAO,CAAC,GAAG,CAAS;GAChE;EACG,CAAA;CACsB,CAAA;AAE9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/PictureMessage/PictureMessage.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PictureMessage.js","names":[],"sources":["../../../src/components/PictureMessage/PictureMessage.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport { useState } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { MediaSlash } from \"../Icon/icons/MediaSlash.js\";\nimport type { ImageLoadingStatus } from \"../Image/index.js\";\nimport { Image } from \"../Image/index.js\";\nimport { pictureImage, pictureRoot } from \"./PictureMessage.css.js\";\n\nexport type PictureAspectRatio = \"16:9\" | \"4:3\" | \"1:1\" | \"3:4\" | \"9:16\";\n\nexport interface PictureMessageProps {\n\t/**\n\t * Image URL. When absent — or when `unavailable` is set — the muted\n\t * \"image unavailable\" placeholder renders instead of the picture.\n\t */\n\tsrc?: string;\n\t/** Alt text describing the image. Never leave empty for content images. */\n\talt: string;\n\t/**\n\t * Frame proportions — bind to the source image's proportions so it isn't\n\t * cropped. The frame is context-sized (fills its container's width); the\n\t * consumer constrains it to the message column. When omitted, the frame\n\t * takes its height from the image's natural proportions.\n\t */\n\taspectRatio?: PictureAspectRatio;\n\t/** Force the \"image unavailable\" placeholder (media-slash on a muted box). */\n\tunavailable?: boolean;\n\t/**\n\t * Reports the underlying image's load state so a consumer can reserve space\n\t * while loading or react to a load failure. The frame already swaps to the\n\t * unavailable placeholder on error on its own.\n\t */\n\tonLoadingStatusChange?: (status: ImageLoadingStatus) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nconst UNAVAILABLE_LABEL = \"Image unavailable\";\n\n/**\n * A rounded image attachment rendered inside a chat message. Clips the picture to\n * the media-preview corner radius and holds it at a fixed aspect ratio; when the\n * image is missing or unavailable — or when the image fails to load — it shows a\n * muted media-slash placeholder.\n */\nexport function PictureMessage({\n\tsrc,\n\talt,\n\taspectRatio,\n\tunavailable = false,\n\tonLoadingStatusChange,\n\tclassName,\n\t...rest\n}: PictureMessageProps) {\n\tconst [status, setStatus] = useState<ImageLoadingStatus>(\"loading\");\n\tconst forced = unavailable || !src;\n\tconst showPlaceholder = forced || status === \"error\";\n\t// Lovelace can be consumed from older/untyped JavaScript even though the TS\n\t// contract requires a string, so the failure path must remain total.\n\tconst description = typeof alt === \"string\" ? alt.trim() : \"\";\n\tconst unavailableLabel = description\n\t\t? `${UNAVAILABLE_LABEL}: ${description}`\n\t\t: UNAVAILABLE_LABEL;\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-aspect-ratio={aspectRatio}\n\t\t\tdata-unavailable={showPlaceholder || undefined}\n\t\t\tdata-status={forced ? undefined : status}\n\t\t\tclassName={cx(\n\t\t\t\tpictureRoot({ aspectRatio, unavailable: showPlaceholder }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{forced ? (\n\t\t\t\t<MediaSlash label={unavailableLabel} />\n\t\t\t) : (\n\t\t\t\t<Image\n\t\t\t\t\tclassName={pictureImage}\n\t\t\t\t\tsrc={src}\n\t\t\t\t\talt={alt}\n\t\t\t\t\tfallback={<MediaSlash label={unavailableLabel} />}\n\t\t\t\t\tonLoadingStatusChange={(next) => {\n\t\t\t\t\t\tsetStatus(next);\n\t\t\t\t\t\tonLoadingStatusChange?.(next);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAsCA,IAAM,IAAoB;AAQ1B,SAAgB,EAAe,EAC9B,QACA,QACA,gBACA,iBAAc,IACd,0BACA,cACA,GAAG,KACoB;CACvB,IAAM,CAAC,GAAQ,KAAa,EAA6B,
|
|
1
|
+
{"version":3,"file":"PictureMessage.js","names":[],"sources":["../../../src/components/PictureMessage/PictureMessage.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport { useState } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { MediaSlash } from \"../Icon/icons/MediaSlash.js\";\nimport type { ImageLoadingStatus } from \"../Image/index.js\";\nimport { Image } from \"../Image/index.js\";\nimport { pictureImage, pictureRoot } from \"./PictureMessage.css.js\";\n\nexport type PictureAspectRatio = \"16:9\" | \"4:3\" | \"1:1\" | \"3:4\" | \"9:16\";\n\nexport interface PictureMessageProps {\n\t/**\n\t * Image URL. When absent — or when `unavailable` is set — the muted\n\t * \"image unavailable\" placeholder renders instead of the picture.\n\t */\n\tsrc?: string;\n\t/** Alt text describing the image. Never leave empty for content images. */\n\talt: string;\n\t/**\n\t * Frame proportions — bind to the source image's proportions so it isn't\n\t * cropped. The frame is context-sized (fills its container's width); the\n\t * consumer constrains it to the message column. When omitted, the frame\n\t * takes its height from the image's natural proportions.\n\t */\n\taspectRatio?: PictureAspectRatio;\n\t/** Force the \"image unavailable\" placeholder (media-slash on a muted box). */\n\tunavailable?: boolean;\n\t/**\n\t * Reports the underlying image's load state so a consumer can reserve space\n\t * while loading or react to a load failure. The frame already swaps to the\n\t * unavailable placeholder on error on its own.\n\t */\n\tonLoadingStatusChange?: (status: ImageLoadingStatus) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nconst UNAVAILABLE_LABEL = \"Image unavailable\";\n\n/**\n * A rounded image attachment rendered inside a chat message. Clips the picture to\n * the media-preview corner radius and holds it at a fixed aspect ratio; when the\n * image is missing or unavailable — or when the image fails to load — it shows a\n * muted media-slash placeholder.\n */\nexport function PictureMessage({\n\tsrc,\n\talt,\n\taspectRatio,\n\tunavailable = false,\n\tonLoadingStatusChange,\n\tclassName,\n\t...rest\n}: PictureMessageProps) {\n\tconst [status, setStatus] = useState<ImageLoadingStatus>(\"loading\");\n\tconst forced = unavailable || !src;\n\tconst showPlaceholder = forced || status === \"error\";\n\t// Lovelace can be consumed from older/untyped JavaScript even though the TS\n\t// contract requires a string, so the failure path must remain total.\n\tconst description = typeof alt === \"string\" ? alt.trim() : \"\";\n\tconst unavailableLabel = description\n\t\t? `${UNAVAILABLE_LABEL}: ${description}`\n\t\t: UNAVAILABLE_LABEL;\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tdata-aspect-ratio={aspectRatio}\n\t\t\tdata-unavailable={showPlaceholder || undefined}\n\t\t\tdata-status={forced ? undefined : status}\n\t\t\tclassName={cx(\n\t\t\t\tpictureRoot({ aspectRatio, unavailable: showPlaceholder }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{forced ? (\n\t\t\t\t<MediaSlash label={unavailableLabel} />\n\t\t\t) : (\n\t\t\t\t<Image\n\t\t\t\t\tclassName={pictureImage}\n\t\t\t\t\tsrc={src}\n\t\t\t\t\talt={alt}\n\t\t\t\t\tfallback={<MediaSlash label={unavailableLabel} />}\n\t\t\t\t\tonLoadingStatusChange={(next) => {\n\t\t\t\t\t\tsetStatus(next);\n\t\t\t\t\t\tonLoadingStatusChange?.(next);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAsCA,IAAM,IAAoB;AAQ1B,SAAgB,EAAe,EAC9B,QACA,QACA,gBACA,iBAAc,IACd,0BACA,cACA,GAAG,KACoB;CACvB,IAAM,CAAC,GAAQ,KAAa,EAA6B,SAAS,GAC5D,IAAS,KAAe,CAAC,GACzB,IAAkB,KAAU,MAAW,SAGvC,IAAc,OAAO,KAAQ,WAAW,EAAI,KAAK,IAAI,IACrD,IAAmB,IACtB,GAAG,EAAkB,IAAI,MACzB;CACH,OACC,kBAAC,OAAD;EACC,GAAI;EACJ,qBAAmB;EACnB,oBAAkB,KAAmB,KAAA;EACrC,eAAa,IAAS,KAAA,IAAY;EAClC,WAAW,EACV,EAAY;GAAE;GAAa,aAAa;EAAgB,CAAC,GACzD,CACD;YAEC,IACA,kBAAC,GAAD,EAAY,OAAO,EAAmB,CAAA,IAEtC,kBAAC,GAAD;GACC,WAAW;GACN;GACA;GACL,UAAU,kBAAC,GAAD,EAAY,OAAO,EAAmB,CAAA;GAChD,wBAAwB,MAAS;IAEhC,AADA,EAAU,CAAI,GACd,IAAwB,CAAI;GAC7B;EACA,CAAA;CAEE,CAAA;AAEP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/PillButton/PillButton.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillButton.js","names":[],"sources":["../../../src/components/PillButton/PillButton.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { ButtonProps as AriaButtonProps } from \"react-aria-components\";\nimport { Button as AriaButton } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { pillButtonRoot } from \"./PillButton.css.js\";\n\nexport type PillButtonSize = \"md\" | \"sm\";\n\nexport interface PillButtonProps\n\textends Omit<AriaButtonProps, \"children\" | \"className\" | \"style\"> {\n\tsize?: PillButtonSize;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLButtonElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * Fully-rounded action button with a single accent-on-surface style. Unlike\n * `Button`, it has no intent/destructive variants. Accepts text and/or an\n * `<Icon>` child; an icon-only pill needs an `aria-label`.\n */\nexport function PillButton({\n\tsize = \"md\",\n\tclassName,\n\tchildren,\n\t...rest\n}: PillButtonProps) {\n\treturn (\n\t\t<AriaButton\n\t\t\t{...rest}\n\t\t\tdata-slot=\"pill-button\"\n\t\t\tdata-size={size}\n\t\t\tclassName={cx(pillButtonRoot({ size }), className)}\n\t\t>\n\t\t\t{children}\n\t\t</AriaButton>\n\t);\n}\n"],"mappings":";;;;;AAsBA,SAAgB,EAAW,EAC1B,UAAO,MACP,cACA,aACA,GAAG,KACgB;
|
|
1
|
+
{"version":3,"file":"PillButton.js","names":[],"sources":["../../../src/components/PillButton/PillButton.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { ButtonProps as AriaButtonProps } from \"react-aria-components\";\nimport { Button as AriaButton } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { pillButtonRoot } from \"./PillButton.css.js\";\n\nexport type PillButtonSize = \"md\" | \"sm\";\n\nexport interface PillButtonProps\n\textends Omit<AriaButtonProps, \"children\" | \"className\" | \"style\"> {\n\tsize?: PillButtonSize;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLButtonElement>;\n\tchildren?: ReactNode;\n}\n\n/**\n * Fully-rounded action button with a single accent-on-surface style. Unlike\n * `Button`, it has no intent/destructive variants. Accepts text and/or an\n * `<Icon>` child; an icon-only pill needs an `aria-label`.\n */\nexport function PillButton({\n\tsize = \"md\",\n\tclassName,\n\tchildren,\n\t...rest\n}: PillButtonProps) {\n\treturn (\n\t\t<AriaButton\n\t\t\t{...rest}\n\t\t\tdata-slot=\"pill-button\"\n\t\t\tdata-size={size}\n\t\t\tclassName={cx(pillButtonRoot({ size }), className)}\n\t\t>\n\t\t\t{children}\n\t\t</AriaButton>\n\t);\n}\n"],"mappings":";;;;;AAsBA,SAAgB,EAAW,EAC1B,UAAO,MACP,cACA,aACA,GAAG,KACgB;CACnB,OACC,kBAAC,GAAD;EACC,GAAI;EACJ,aAAU;EACV,aAAW;EACX,WAAW,EAAG,EAAe,EAAE,QAAK,CAAC,GAAG,CAAS;EAEhD;CACU,CAAA;AAEd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProactiveMessage.js","names":[],"sources":["../../../src/components/ProactiveMessage/ProactiveMessage.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { proactiveMessageRoot } from \"./ProactiveMessage.css.js\";\n\nexport interface ProactiveMessageProps {\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** Message content — body text, or an inline link/element. */\n\tchildren?: ReactNode;\n}\n\n/**\n * A proactive (campaign) message bubble: a rounded, elevated surface holding a\n * short outbound message. The content is whatever you pass as `children` — body\n * text (the Figma \"Message\" variant) or an inline link (the \"Link\" variant).\n * Direction is detected from the content so the bubble mirrors under RTL.\n *\n * Picture and grouped campaigns are compositions, not props: render\n * `PictureMessage` for a picture, and stack these bubbles beside a dismiss\n * `IconButton` for a group.\n */\nexport function ProactiveMessage({\n\tclassName,\n\tchildren,\n\t...rest\n}: ProactiveMessageProps) {\n\treturn (\n\t\t<div {...rest} dir=\"auto\" className={cx(proactiveMessageRoot, className)}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAsBA,SAAgB,EAAiB,EAChC,cACA,aACA,GAAG,KACsB;
|
|
1
|
+
{"version":3,"file":"ProactiveMessage.js","names":[],"sources":["../../../src/components/ProactiveMessage/ProactiveMessage.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { proactiveMessageRoot } from \"./ProactiveMessage.css.js\";\n\nexport interface ProactiveMessageProps {\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** Message content — body text, or an inline link/element. */\n\tchildren?: ReactNode;\n}\n\n/**\n * A proactive (campaign) message bubble: a rounded, elevated surface holding a\n * short outbound message. The content is whatever you pass as `children` — body\n * text (the Figma \"Message\" variant) or an inline link (the \"Link\" variant).\n * Direction is detected from the content so the bubble mirrors under RTL.\n *\n * Picture and grouped campaigns are compositions, not props: render\n * `PictureMessage` for a picture, and stack these bubbles beside a dismiss\n * `IconButton` for a group.\n */\nexport function ProactiveMessage({\n\tclassName,\n\tchildren,\n\t...rest\n}: ProactiveMessageProps) {\n\treturn (\n\t\t<div {...rest} dir=\"auto\" className={cx(proactiveMessageRoot, className)}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAsBA,SAAgB,EAAiB,EAChC,cACA,aACA,GAAG,KACsB;CACzB,OACC,kBAAC,OAAD;EAAK,GAAI;EAAM,KAAI;EAAO,WAAW,EAAG,GAAsB,CAAS;EACrE;CACG,CAAA;AAEP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/Radio/Radio.css.ts
|
|
4
4
|
var t = "mufew31", n = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { RadioProps as AriaRadioProps } from \"react-aria-components\";\nimport { Radio as AriaRadio } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioLabel, radioRoot } from \"./Radio.css.js\";\nimport { RadioIndicator } from \"./RadioIndicator.js\";\n\nexport type RadioVariant = \"inline\" | \"row\";\n\nexport interface RadioProps\n\textends Omit<AriaRadioProps, \"className\" | \"style\" | \"children\"> {\n\t/**\n\t * `inline` (default) sits the control beside its label at content width. `row`\n\t * renders the 40px selectable row Figma draws for a menu item — use it for a\n\t * `RadioGroup` presented as a list of options.\n\t */\n\tvariant?: RadioVariant;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLLabelElement>;\n\t/** Label shown beside the control. Omit only when the option is labelled externally. */\n\tchildren?: ReactNode;\n}\n\n/**\n * A single option within a `RadioGroup`. The visual circle is drawn here; the\n * checked/hover/focus/disabled states are driven by the data-attributes React\n * Aria sets on the label, so this component takes no state props of its own.\n */\nexport function Radio({\n\tvariant = \"inline\",\n\tclassName,\n\tchildren,\n\t...rest\n}: RadioProps) {\n\treturn (\n\t\t<AriaRadio {...rest} className={cx(radioRoot({ variant }), className)}>\n\t\t\t<RadioIndicator hasStateLayer={variant === \"inline\"} />\n\t\t\t{children != null && typeof children !== \"boolean\" && (\n\t\t\t\t<span data-slot=\"label\" className={radioLabel}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</AriaRadio>\n\t);\n}\n"],"mappings":";;;;;;AA6BA,SAAgB,EAAM,EACrB,aAAU,UACV,cACA,aACA,GAAG,KACW;
|
|
1
|
+
{"version":3,"file":"Radio.js","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { RadioProps as AriaRadioProps } from \"react-aria-components\";\nimport { Radio as AriaRadio } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioLabel, radioRoot } from \"./Radio.css.js\";\nimport { RadioIndicator } from \"./RadioIndicator.js\";\n\nexport type RadioVariant = \"inline\" | \"row\";\n\nexport interface RadioProps\n\textends Omit<AriaRadioProps, \"className\" | \"style\" | \"children\"> {\n\t/**\n\t * `inline` (default) sits the control beside its label at content width. `row`\n\t * renders the 40px selectable row Figma draws for a menu item — use it for a\n\t * `RadioGroup` presented as a list of options.\n\t */\n\tvariant?: RadioVariant;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLLabelElement>;\n\t/** Label shown beside the control. Omit only when the option is labelled externally. */\n\tchildren?: ReactNode;\n}\n\n/**\n * A single option within a `RadioGroup`. The visual circle is drawn here; the\n * checked/hover/focus/disabled states are driven by the data-attributes React\n * Aria sets on the label, so this component takes no state props of its own.\n */\nexport function Radio({\n\tvariant = \"inline\",\n\tclassName,\n\tchildren,\n\t...rest\n}: RadioProps) {\n\treturn (\n\t\t<AriaRadio {...rest} className={cx(radioRoot({ variant }), className)}>\n\t\t\t<RadioIndicator hasStateLayer={variant === \"inline\"} />\n\t\t\t{children != null && typeof children !== \"boolean\" && (\n\t\t\t\t<span data-slot=\"label\" className={radioLabel}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</AriaRadio>\n\t);\n}\n"],"mappings":";;;;;;AA6BA,SAAgB,EAAM,EACrB,aAAU,UACV,cACA,aACA,GAAG,KACW;CACd,OACC,kBAAC,GAAD;EAAW,GAAI;EAAM,WAAW,EAAG,EAAU,EAAE,WAAQ,CAAC,GAAG,CAAS;YAApE,CACC,kBAAC,GAAD,EAAgB,eAAe,MAAY,SAAW,CAAA,GACrD,KAAY,QAAQ,OAAO,KAAa,aACxC,kBAAC,QAAD;GAAM,aAAU;GAAQ,WAAA;GACtB;EACI,CAAA,CAEG;;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","names":[],"sources":["../../../src/components/Radio/RadioGroup.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { RadioGroupProps as AriaRadioGroupProps } from \"react-aria-components\";\nimport { RadioGroup as AriaRadioGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioGroup } from \"./Radio.css.js\";\n\nexport interface RadioGroupProps\n\textends Omit<AriaRadioGroupProps, \"className\" | \"style\" | \"children\"> {\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The `Radio` options for this group. */\n\tchildren: ReactNode;\n}\n\n/**\n * Single-select group: exactly one child `Radio` may be selected at a time.\n * Owns the selected value (`value`/`onChange`), keyboard navigation, and the\n * group's accessible name — supply `aria-label` or `aria-labelledby`.\n */\nexport function RadioGroup({ className, children, ...rest }: RadioGroupProps) {\n\treturn (\n\t\t<AriaRadioGroup {...rest} className={cx(radioGroup, className)}>\n\t\t\t{children}\n\t\t</AriaRadioGroup>\n\t);\n}\n"],"mappings":";;;;;AAoBA,SAAgB,EAAW,EAAE,cAAW,aAAU,GAAG,KAAyB;
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":[],"sources":["../../../src/components/Radio/RadioGroup.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { RadioGroupProps as AriaRadioGroupProps } from \"react-aria-components\";\nimport { RadioGroup as AriaRadioGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioGroup } from \"./Radio.css.js\";\n\nexport interface RadioGroupProps\n\textends Omit<AriaRadioGroupProps, \"className\" | \"style\" | \"children\"> {\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The `Radio` options for this group. */\n\tchildren: ReactNode;\n}\n\n/**\n * Single-select group: exactly one child `Radio` may be selected at a time.\n * Owns the selected value (`value`/`onChange`), keyboard navigation, and the\n * group's accessible name — supply `aria-label` or `aria-labelledby`.\n */\nexport function RadioGroup({ className, children, ...rest }: RadioGroupProps) {\n\treturn (\n\t\t<AriaRadioGroup {...rest} className={cx(radioGroup, className)}>\n\t\t\t{children}\n\t\t</AriaRadioGroup>\n\t);\n}\n"],"mappings":";;;;;AAoBA,SAAgB,EAAW,EAAE,cAAW,aAAU,GAAG,KAAyB;CAC7E,OACC,kBAAC,GAAD;EAAgB,GAAI;EAAM,WAAW,EAAG,GAAY,CAAS;EAC3D;CACc,CAAA;AAElB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioIndicator.js","names":[],"sources":["../../../src/components/Radio/RadioIndicator.tsx"],"sourcesContent":["import type { Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioControl, radioDot } from \"./Radio.css.js\";\n\nexport interface RadioIndicatorProps {\n\t/**\n\t * Draw the control's own hover border, focus ring and state layer. True for a\n\t * standalone `Radio`, where the circle is the only affordance; false inside a\n\t * row, which draws those on the row itself — leaving it true there would paint\n\t * both.\n\t */\n\thasStateLayer?: boolean;\n\tclassName?: string;\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * The 24px radio circle and its center dot, with no control of its own.\n *\n * Selection and disabled state are read from whichever ancestor element carries\n * React Aria's `data-selected` / `data-disabled` — the RAC `Radio` label, or a\n * `MenuItem` row — so the same markup and the same styles serve both hosts and\n * cannot drift apart. It must stay a **direct** child of that element; the state\n * rules use a child selector so an unrelated selected ancestor can't reach in.\n */\nexport function RadioIndicator({\n\thasStateLayer = true,\n\tclassName,\n\tref,\n}: RadioIndicatorProps) {\n\treturn (\n\t\t<span\n\t\t\tref={ref}\n\t\t\tdata-slot=\"indicator\"\n\t\t\tdata-state-layer={hasStateLayer || undefined}\n\t\t\tclassName={cx(radioControl, className)}\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<span className={radioDot} />\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;AAyBA,SAAgB,EAAe,EAC9B,mBAAgB,IAChB,cACA,UACuB;
|
|
1
|
+
{"version":3,"file":"RadioIndicator.js","names":[],"sources":["../../../src/components/Radio/RadioIndicator.tsx"],"sourcesContent":["import type { Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { radioControl, radioDot } from \"./Radio.css.js\";\n\nexport interface RadioIndicatorProps {\n\t/**\n\t * Draw the control's own hover border, focus ring and state layer. True for a\n\t * standalone `Radio`, where the circle is the only affordance; false inside a\n\t * row, which draws those on the row itself — leaving it true there would paint\n\t * both.\n\t */\n\thasStateLayer?: boolean;\n\tclassName?: string;\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * The 24px radio circle and its center dot, with no control of its own.\n *\n * Selection and disabled state are read from whichever ancestor element carries\n * React Aria's `data-selected` / `data-disabled` — the RAC `Radio` label, or a\n * `MenuItem` row — so the same markup and the same styles serve both hosts and\n * cannot drift apart. It must stay a **direct** child of that element; the state\n * rules use a child selector so an unrelated selected ancestor can't reach in.\n */\nexport function RadioIndicator({\n\thasStateLayer = true,\n\tclassName,\n\tref,\n}: RadioIndicatorProps) {\n\treturn (\n\t\t<span\n\t\t\tref={ref}\n\t\t\tdata-slot=\"indicator\"\n\t\t\tdata-state-layer={hasStateLayer || undefined}\n\t\t\tclassName={cx(radioControl, className)}\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<span className={radioDot} />\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;AAyBA,SAAgB,EAAe,EAC9B,mBAAgB,IAChB,cACA,UACuB;CACvB,OACC,kBAAC,QAAD;EACM;EACL,aAAU;EACV,oBAAkB,KAAiB,KAAA;EACnC,WAAW,EAAG,GAAc,CAAS;EACrC,eAAY;YAEZ,kBAAC,QAAD,EAAM,WAAW,EAAW,CAAA;CACvB,CAAA;AAER"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/ScrollMarker/ScrollMarker.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollMarker.js","names":[],"sources":["../../../src/components/ScrollMarker/ScrollMarker.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { ButtonProps as AriaButtonProps } from \"react-aria-components\";\nimport { Button as AriaButton } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { ArrowDown } from \"../Icon/icons/ArrowDown.js\";\nimport { scrollMarkerRoot } from \"./ScrollMarker.css.js\";\n\nexport type ScrollMarkerColor = \"default\" | \"brand\";\n\nexport interface ScrollMarkerProps\n\textends Omit<AriaButtonProps, \"children\" | \"className\" | \"style\"> {\n\t/** `default` sits on the inverse surface; `brand` on the accent surface. */\n\tcolor?: ScrollMarkerColor;\n\t/**\n\t * Unread messages waiting below the fold. `0`/undefined renders the compact\n\t * icon-only marker; `≥1` renders the labelled \"unread\" pill.\n\t */\n\tunreadCount?: number;\n\t/**\n\t * Overrides the with-text label (e.g. a localized \"2 unread\"). When omitted, the\n\t * label defaults to `\"{unreadCount} unread\"`. Rendered only when `unreadCount ≥ 1`.\n\t */\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLButtonElement>;\n}\n\nconst DEFAULT_ARIA_LABEL = \"Scroll to latest message\";\n\n/**\n * The chat \"jump to latest\" marker, shown when the user has scrolled up. Renders a\n * compact down-arrow button, or — once messages arrive below the fold — an unread-count\n * pill. Selection of icon-only vs with-text is derived from `unreadCount`.\n *\n * The with-text pill takes its accessible name from the visible label. An `aria-label`\n * passed for it must start with that label, so voice-control users can say what they see.\n */\nexport function ScrollMarker({\n\tcolor = \"default\",\n\tunreadCount,\n\tchildren,\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t...rest\n}: ScrollMarkerProps) {\n\tconst withText = (unreadCount ?? 0) >= 1;\n\treturn (\n\t\t<AriaButton\n\t\t\t{...rest}\n\t\t\taria-label={ariaLabel ?? (withText ? undefined : DEFAULT_ARIA_LABEL)}\n\t\t\tdata-color={color}\n\t\t\tdata-type={withText ? \"with-text\" : \"icon-only\"}\n\t\t\tclassName={cx(\n\t\t\t\tscrollMarkerRoot({ color, type: withText ? \"withText\" : \"iconOnly\" }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<span>{withText ? (children ?? `${unreadCount} unread`) : \"\"}</span>\n\t\t\t<ArrowDown />\n\t\t</AriaButton>\n\t);\n}\n"],"mappings":";;;;;;AA4BA,IAAM,IAAqB;AAU3B,SAAgB,EAAa,EAC5B,WAAQ,WACR,gBACA,aACA,cACA,cAAc,GACd,GAAG,KACkB;CACrB,IAAM,KAAY,KAAe,MAAM;
|
|
1
|
+
{"version":3,"file":"ScrollMarker.js","names":[],"sources":["../../../src/components/ScrollMarker/ScrollMarker.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { ButtonProps as AriaButtonProps } from \"react-aria-components\";\nimport { Button as AriaButton } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { ArrowDown } from \"../Icon/icons/ArrowDown.js\";\nimport { scrollMarkerRoot } from \"./ScrollMarker.css.js\";\n\nexport type ScrollMarkerColor = \"default\" | \"brand\";\n\nexport interface ScrollMarkerProps\n\textends Omit<AriaButtonProps, \"children\" | \"className\" | \"style\"> {\n\t/** `default` sits on the inverse surface; `brand` on the accent surface. */\n\tcolor?: ScrollMarkerColor;\n\t/**\n\t * Unread messages waiting below the fold. `0`/undefined renders the compact\n\t * icon-only marker; `≥1` renders the labelled \"unread\" pill.\n\t */\n\tunreadCount?: number;\n\t/**\n\t * Overrides the with-text label (e.g. a localized \"2 unread\"). When omitted, the\n\t * label defaults to `\"{unreadCount} unread\"`. Rendered only when `unreadCount ≥ 1`.\n\t */\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLButtonElement>;\n}\n\nconst DEFAULT_ARIA_LABEL = \"Scroll to latest message\";\n\n/**\n * The chat \"jump to latest\" marker, shown when the user has scrolled up. Renders a\n * compact down-arrow button, or — once messages arrive below the fold — an unread-count\n * pill. Selection of icon-only vs with-text is derived from `unreadCount`.\n *\n * The with-text pill takes its accessible name from the visible label. An `aria-label`\n * passed for it must start with that label, so voice-control users can say what they see.\n */\nexport function ScrollMarker({\n\tcolor = \"default\",\n\tunreadCount,\n\tchildren,\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t...rest\n}: ScrollMarkerProps) {\n\tconst withText = (unreadCount ?? 0) >= 1;\n\treturn (\n\t\t<AriaButton\n\t\t\t{...rest}\n\t\t\taria-label={ariaLabel ?? (withText ? undefined : DEFAULT_ARIA_LABEL)}\n\t\t\tdata-color={color}\n\t\t\tdata-type={withText ? \"with-text\" : \"icon-only\"}\n\t\t\tclassName={cx(\n\t\t\t\tscrollMarkerRoot({ color, type: withText ? \"withText\" : \"iconOnly\" }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<span>{withText ? (children ?? `${unreadCount} unread`) : \"\"}</span>\n\t\t\t<ArrowDown />\n\t\t</AriaButton>\n\t);\n}\n"],"mappings":";;;;;;AA4BA,IAAM,IAAqB;AAU3B,SAAgB,EAAa,EAC5B,WAAQ,WACR,gBACA,aACA,cACA,cAAc,GACd,GAAG,KACkB;CACrB,IAAM,KAAY,KAAe,MAAM;CACvC,OACC,kBAAC,GAAD;EACC,GAAI;EACJ,cAAY,MAAc,IAAW,KAAA,IAAY;EACjD,cAAY;EACZ,aAAW,IAAW,cAAc;EACpC,WAAW,EACV,EAAiB;GAAE;GAAO,MAAM,IAAW,aAAa;EAAW,CAAC,GACpE,CACD;YARD,CAUC,kBAAC,QAAD,EAAA,UAAO,IAAY,KAAY,GAAG,EAAY,WAAY,GAAS,CAAA,GACnE,kBAAC,GAAD,CAAY,CAAA,CACD;;AAEd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.js","names":[],"sources":["../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import { SheetActions } from \"./SheetActions.js\";\nimport { SheetBackButton } from \"./SheetBackButton.js\";\nimport { SheetBody } from \"./SheetBody.js\";\nimport { SheetCloseButton } from \"./SheetCloseButton.js\";\nimport { SheetHeader } from \"./SheetHeader.js\";\nimport { SheetRoot } from \"./SheetRoot.js\";\nimport { SheetTitle } from \"./SheetTitle.js\";\n\nexport type { SheetProps } from \"./SheetRoot.js\";\n\n/**\n * Bare bottom-sheet content surface. Renders inline as-is; wrap it in\n * `SheetOverlay` for the modal, scrim-backed, slide-up presentation.\n */\nexport const Sheet = Object.assign(SheetRoot, {\n\tHeader: SheetHeader,\n\tTitle: SheetTitle,\n\tBackButton: SheetBackButton,\n\tCloseButton: SheetCloseButton,\n\tBody: SheetBody,\n\tActions: SheetActions,\n});\n"],"mappings":";;;;;;;;AAcA,IAAa,IAAQ,OAAO,OAAO,GAAW;CAC7C,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,aAAa;CACb,MAAM;CACN,SAAS;
|
|
1
|
+
{"version":3,"file":"Sheet.js","names":[],"sources":["../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import { SheetActions } from \"./SheetActions.js\";\nimport { SheetBackButton } from \"./SheetBackButton.js\";\nimport { SheetBody } from \"./SheetBody.js\";\nimport { SheetCloseButton } from \"./SheetCloseButton.js\";\nimport { SheetHeader } from \"./SheetHeader.js\";\nimport { SheetRoot } from \"./SheetRoot.js\";\nimport { SheetTitle } from \"./SheetTitle.js\";\n\nexport type { SheetProps } from \"./SheetRoot.js\";\n\n/**\n * Bare bottom-sheet content surface. Renders inline as-is; wrap it in\n * `SheetOverlay` for the modal, scrim-backed, slide-up presentation.\n */\nexport const Sheet = Object.assign(SheetRoot, {\n\tHeader: SheetHeader,\n\tTitle: SheetTitle,\n\tBackButton: SheetBackButton,\n\tCloseButton: SheetCloseButton,\n\tBody: SheetBody,\n\tActions: SheetActions,\n});\n"],"mappings":";;;;;;;;AAcA,IAAa,IAAQ,OAAO,OAAO,GAAW;CAC7C,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,aAAa;CACb,MAAM;CACN,SAAS;AACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetActions.js","names":[],"sources":["../../../src/components/Sheet/SheetActions.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetActions } from \"./Sheet.css.js\";\n\nexport interface SheetActionsProps {\n\t/** The action buttons, stacked full-width in reading/focus order (primary first). */\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\nexport function SheetActions({ children, className }: SheetActionsProps) {\n\treturn <div className={cx(sheetActions, className)}>{children}</div>;\n}\n"],"mappings":";;;;AAUA,SAAgB,EAAa,EAAE,aAAU,gBAAgC;
|
|
1
|
+
{"version":3,"file":"SheetActions.js","names":[],"sources":["../../../src/components/Sheet/SheetActions.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetActions } from \"./Sheet.css.js\";\n\nexport interface SheetActionsProps {\n\t/** The action buttons, stacked full-width in reading/focus order (primary first). */\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\nexport function SheetActions({ children, className }: SheetActionsProps) {\n\treturn <div className={cx(sheetActions, className)}>{children}</div>;\n}\n"],"mappings":";;;;AAUA,SAAgB,EAAa,EAAE,aAAU,gBAAgC;CACxE,OAAO,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAc,CAAS;EAAI;CAAc,CAAA;AACpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetBackButton.js","names":[],"sources":["../../../src/components/Sheet/SheetBackButton.tsx"],"sourcesContent":["import { cx } from \"../../utils/cx.js\";\nimport { ArrowLeft } from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/index.js\";\nimport { sheetBackIcon, sheetHeaderStart } from \"./Sheet.css.js\";\n\nexport interface SheetBackButtonProps {\n\tonPress: () => void;\n\t/** Accessible name for the icon-only control. Defaults to \"Back\". */\n\tlabel?: string;\n\tclassName?: string;\n}\n\n/**\n * Start-pinned back affordance for `Sheet.Header`. Presets the tertiary `sm`\n * `ArrowLeft` `IconButton` so every sheet's back control is identical; the chevron\n * mirrors under RTL. Absolute-pinned via its wrapper so the title stays centered.\n */\nexport function SheetBackButton({\n\tonPress,\n\tlabel = \"Back\",\n\tclassName,\n}: SheetBackButtonProps) {\n\treturn (\n\t\t<span className={cx(sheetHeaderStart, className)}>\n\t\t\t<IconButton label={label} variant=\"tertiary\" size=\"sm\" onPress={onPress}>\n\t\t\t\t<ArrowLeft className={sheetBackIcon} />\n\t\t\t</IconButton>\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,EAAgB,EAC/B,YACA,WAAQ,QACR,gBACwB;
|
|
1
|
+
{"version":3,"file":"SheetBackButton.js","names":[],"sources":["../../../src/components/Sheet/SheetBackButton.tsx"],"sourcesContent":["import { cx } from \"../../utils/cx.js\";\nimport { ArrowLeft } from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/index.js\";\nimport { sheetBackIcon, sheetHeaderStart } from \"./Sheet.css.js\";\n\nexport interface SheetBackButtonProps {\n\tonPress: () => void;\n\t/** Accessible name for the icon-only control. Defaults to \"Back\". */\n\tlabel?: string;\n\tclassName?: string;\n}\n\n/**\n * Start-pinned back affordance for `Sheet.Header`. Presets the tertiary `sm`\n * `ArrowLeft` `IconButton` so every sheet's back control is identical; the chevron\n * mirrors under RTL. Absolute-pinned via its wrapper so the title stays centered.\n */\nexport function SheetBackButton({\n\tonPress,\n\tlabel = \"Back\",\n\tclassName,\n}: SheetBackButtonProps) {\n\treturn (\n\t\t<span className={cx(sheetHeaderStart, className)}>\n\t\t\t<IconButton label={label} variant=\"tertiary\" size=\"sm\" onPress={onPress}>\n\t\t\t\t<ArrowLeft className={sheetBackIcon} />\n\t\t\t</IconButton>\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,EAAgB,EAC/B,YACA,WAAQ,QACR,gBACwB;CACxB,OACC,kBAAC,QAAD;EAAM,WAAW,EAAG,GAAkB,CAAS;YAC9C,kBAAC,GAAD;GAAmB;GAAO,SAAQ;GAAW,MAAK;GAAc;aAC/D,kBAAC,GAAD,EAAW,WAAW,EAAgB,CAAA;EAC3B,CAAA;CACP,CAAA;AAER"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetBody.js","names":[],"sources":["../../../src/components/Sheet/SheetBody.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetBody } from \"./Sheet.css.js\";\n\nexport interface SheetBodyProps {\n\tchildren?: ReactNode;\n\tclassName?: string;\n\t/** Target for the overlay's `aria-describedby`. */\n\tid?: string;\n\t/**\n\t * Opts the body into a named keyboard-scroll region. Use this only when the\n\t * body can overflow without containing an enabled, focusable descendant.\n\t */\n\tkeyboardScrollLabel?: string;\n}\n\nexport function SheetBody({\n\tchildren,\n\tclassName,\n\tid,\n\tkeyboardScrollLabel,\n}: SheetBodyProps) {\n\tconst keyboardScrollProps =\n\t\tkeyboardScrollLabel === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\t\"aria-label\": keyboardScrollLabel,\n\t\t\t\t\trole: \"region\" as const,\n\t\t\t\t\ttabIndex: 0,\n\t\t\t\t};\n\n\treturn (\n\t\t<div id={id} className={cx(sheetBody, className)} {...keyboardScrollProps}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAgBA,SAAgB,EAAU,EACzB,aACA,cACA,OACA,0BACkB;CAClB,IAAM,IACL,MAAwB,KAAA,IACrB,
|
|
1
|
+
{"version":3,"file":"SheetBody.js","names":[],"sources":["../../../src/components/Sheet/SheetBody.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetBody } from \"./Sheet.css.js\";\n\nexport interface SheetBodyProps {\n\tchildren?: ReactNode;\n\tclassName?: string;\n\t/** Target for the overlay's `aria-describedby`. */\n\tid?: string;\n\t/**\n\t * Opts the body into a named keyboard-scroll region. Use this only when the\n\t * body can overflow without containing an enabled, focusable descendant.\n\t */\n\tkeyboardScrollLabel?: string;\n}\n\nexport function SheetBody({\n\tchildren,\n\tclassName,\n\tid,\n\tkeyboardScrollLabel,\n}: SheetBodyProps) {\n\tconst keyboardScrollProps =\n\t\tkeyboardScrollLabel === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\t\"aria-label\": keyboardScrollLabel,\n\t\t\t\t\trole: \"region\" as const,\n\t\t\t\t\ttabIndex: 0,\n\t\t\t\t};\n\n\treturn (\n\t\t<div id={id} className={cx(sheetBody, className)} {...keyboardScrollProps}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAgBA,SAAgB,EAAU,EACzB,aACA,cACA,OACA,0BACkB;CAClB,IAAM,IACL,MAAwB,KAAA,IACrB,CAAC,IACD;EACA,cAAc;EACd,MAAM;EACN,UAAU;CACX;CAEH,OACC,kBAAC,OAAD;EAAS;EAAI,WAAW,EAAG,GAAW,CAAS;EAAG,GAAI;EACpD;CACG,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetCloseButton.js","names":[],"sources":["../../../src/components/Sheet/SheetCloseButton.tsx"],"sourcesContent":["import { cx } from \"../../utils/cx.js\";\nimport { Xmark } from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/index.js\";\nimport { sheetHeaderEnd } from \"./Sheet.css.js\";\n\nexport interface SheetCloseButtonProps {\n\tonPress: () => void;\n\t/** Accessible name for the icon-only control. Defaults to \"Close\". */\n\tlabel?: string;\n\tclassName?: string;\n}\n\n/**\n * End-pinned close affordance for `Sheet.Header`. Presets the tertiary `sm`\n * `Xmark` `IconButton` so every sheet's close control is identical. Absolute-pinned\n * via its wrapper so the title stays centered.\n */\nexport function SheetCloseButton({\n\tonPress,\n\tlabel = \"Close\",\n\tclassName,\n}: SheetCloseButtonProps) {\n\treturn (\n\t\t<span className={cx(sheetHeaderEnd, className)}>\n\t\t\t<IconButton label={label} variant=\"tertiary\" size=\"sm\" onPress={onPress}>\n\t\t\t\t<Xmark />\n\t\t\t</IconButton>\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,EAAiB,EAChC,YACA,WAAQ,SACR,gBACyB;
|
|
1
|
+
{"version":3,"file":"SheetCloseButton.js","names":[],"sources":["../../../src/components/Sheet/SheetCloseButton.tsx"],"sourcesContent":["import { cx } from \"../../utils/cx.js\";\nimport { Xmark } from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/index.js\";\nimport { sheetHeaderEnd } from \"./Sheet.css.js\";\n\nexport interface SheetCloseButtonProps {\n\tonPress: () => void;\n\t/** Accessible name for the icon-only control. Defaults to \"Close\". */\n\tlabel?: string;\n\tclassName?: string;\n}\n\n/**\n * End-pinned close affordance for `Sheet.Header`. Presets the tertiary `sm`\n * `Xmark` `IconButton` so every sheet's close control is identical. Absolute-pinned\n * via its wrapper so the title stays centered.\n */\nexport function SheetCloseButton({\n\tonPress,\n\tlabel = \"Close\",\n\tclassName,\n}: SheetCloseButtonProps) {\n\treturn (\n\t\t<span className={cx(sheetHeaderEnd, className)}>\n\t\t\t<IconButton label={label} variant=\"tertiary\" size=\"sm\" onPress={onPress}>\n\t\t\t\t<Xmark />\n\t\t\t</IconButton>\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,EAAiB,EAChC,YACA,WAAQ,SACR,gBACyB;CACzB,OACC,kBAAC,QAAD;EAAM,WAAW,EAAG,GAAgB,CAAS;YAC5C,kBAAC,GAAD;GAAmB;GAAO,SAAQ;GAAW,MAAK;GAAc;aAC/D,kBAAC,GAAD,CAAQ,CAAA;EACG,CAAA;CACP,CAAA;AAER"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetHeader.js","names":[],"sources":["../../../src/components/Sheet/SheetHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetHeader } from \"./Sheet.css.js\";\n\nexport interface SheetHeaderProps {\n\t/**\n\t * Compose `Sheet.BackButton`, `Sheet.Title`, and `Sheet.CloseButton`. The\n\t * buttons pin to the edges and the title stays centered, so their visual\n\t * position is fixed. Focus and reading order still follow the DOM, so author\n\t * the children in the order `BackButton` → `Title` → `CloseButton`.\n\t */\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\nexport function SheetHeader({ children, className }: SheetHeaderProps) {\n\treturn <div className={cx(sheetHeader, className)}>{children}</div>;\n}\n"],"mappings":";;;;AAeA,SAAgB,EAAY,EAAE,aAAU,gBAA+B;
|
|
1
|
+
{"version":3,"file":"SheetHeader.js","names":[],"sources":["../../../src/components/Sheet/SheetHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetHeader } from \"./Sheet.css.js\";\n\nexport interface SheetHeaderProps {\n\t/**\n\t * Compose `Sheet.BackButton`, `Sheet.Title`, and `Sheet.CloseButton`. The\n\t * buttons pin to the edges and the title stays centered, so their visual\n\t * position is fixed. Focus and reading order still follow the DOM, so author\n\t * the children in the order `BackButton` → `Title` → `CloseButton`.\n\t */\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\nexport function SheetHeader({ children, className }: SheetHeaderProps) {\n\treturn <div className={cx(sheetHeader, className)}>{children}</div>;\n}\n"],"mappings":";;;;AAeA,SAAgB,EAAY,EAAE,aAAU,gBAA+B;CACtE,OAAO,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAa,CAAS;EAAI;CAAc,CAAA;AACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetRoot.js","names":[],"sources":["../../../src/components/Sheet/SheetRoot.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetRoot } from \"./Sheet.css.js\";\n\nexport interface SheetProps {\n\t/** Composed parts, canonical order: `Sheet.Header` → `Sheet.Body` → `Sheet.Actions`. */\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nexport function SheetRoot({ children, className, style, ref }: SheetProps) {\n\treturn (\n\t\t<div ref={ref} className={cx(sheetRoot, className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAYA,SAAgB,EAAU,EAAE,aAAU,cAAW,UAAO,UAAmB;
|
|
1
|
+
{"version":3,"file":"SheetRoot.js","names":[],"sources":["../../../src/components/Sheet/SheetRoot.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetRoot } from \"./Sheet.css.js\";\n\nexport interface SheetProps {\n\t/** Composed parts, canonical order: `Sheet.Header` → `Sheet.Body` → `Sheet.Actions`. */\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nexport function SheetRoot({ children, className, style, ref }: SheetProps) {\n\treturn (\n\t\t<div ref={ref} className={cx(sheetRoot, className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAYA,SAAgB,EAAU,EAAE,aAAU,cAAW,UAAO,UAAmB;CAC1E,OACC,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,GAAW,CAAS;EAAU;EACzD;CACG,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetTitle.js","names":[],"sources":["../../../src/components/Sheet/SheetTitle.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Heading } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetHeaderTitle } from \"./Sheet.css.js\";\n\nexport interface SheetTitleProps {\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Centered header title. Renders `slot=\"title\"` so the enclosing `SheetOverlay`\n * derives the dialog's accessible name. Omit it for a title-less sheet and give\n * `SheetOverlay` an `aria-label` instead.\n */\nexport function SheetTitle({ children, className }: SheetTitleProps) {\n\treturn (\n\t\t<Heading slot=\"title\" className={cx(sheetHeaderTitle, className)}>\n\t\t\t{children}\n\t\t</Heading>\n\t);\n}\n"],"mappings":";;;;;AAeA,SAAgB,EAAW,EAAE,aAAU,gBAA8B;
|
|
1
|
+
{"version":3,"file":"SheetTitle.js","names":[],"sources":["../../../src/components/Sheet/SheetTitle.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Heading } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetHeaderTitle } from \"./Sheet.css.js\";\n\nexport interface SheetTitleProps {\n\tchildren?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Centered header title. Renders `slot=\"title\"` so the enclosing `SheetOverlay`\n * derives the dialog's accessible name. Omit it for a title-less sheet and give\n * `SheetOverlay` an `aria-label` instead.\n */\nexport function SheetTitle({ children, className }: SheetTitleProps) {\n\treturn (\n\t\t<Heading slot=\"title\" className={cx(sheetHeaderTitle, className)}>\n\t\t\t{children}\n\t\t</Heading>\n\t);\n}\n"],"mappings":";;;;;AAeA,SAAgB,EAAW,EAAE,aAAU,gBAA8B;CACpE,OACC,kBAAC,GAAD;EAAS,MAAK;EAAQ,WAAW,EAAG,GAAkB,CAAS;EAC7D;CACO,CAAA;AAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetOverlay.js","names":[],"sources":["../../../src/components/SheetOverlay/SheetOverlay.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { useLocale } from \"react-aria\";\nimport {\n\tDialog as AriaDialog,\n\tModal,\n\tModalOverlay,\n} from \"react-aria-components\";\nimport { OverlayRegistration } from \"../../hooks/overlayRegistry.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetDialog, sheetModal, sheetScrim } from \"./SheetOverlay.css.js\";\n\nexport interface SheetOverlayProps {\n\t/** Whether the sheet is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (scrim tap, Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on scrim tap. Escape always cancels (RAC default). Defaults to `true`. */\n\tisDismissable?: boolean;\n\t/** Accessible name fallback when the child has no `Sheet.Title`. */\n\t\"aria-label\"?: string;\n\t/** Id of the element describing the sheet, typically a `Sheet.Body`. */\n\t\"aria-describedby\"?: string;\n\t/** Maximum sheet height. Defaults to 80% of the available height. */\n\tmaxHeight?: CSSProperties[\"maxHeight\"];\n\tclassName?: string;\n\tchildren: ReactNode;\n}\n\n/**\n * Modal bottom-sheet presentation: dark scrim, focus-trap, dismiss-on-tap/Escape,\n * bottom-anchored, rounded-top corners, slide-up. Wraps arbitrary children\n * (typically a `Sheet`). For a full-window surface use `FullscreenOverlay`; for a\n * centered dialog `Dialog`; for a non-dimming bottom bubble `BubbleOverlay`.\n *\n * Give the dialog an accessible name via either a `Sheet.Title` or the\n * `aria-label` prop — with neither (e.g. an actions-only Confirm sheet) RAC\n * emits a missing-name warning.\n */\nexport function SheetOverlay({\n\tisOpen,\n\tonOpenChange,\n\tisDismissable = true,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\tclassName,\n\tmaxHeight,\n\tchildren,\n}: SheetOverlayProps) {\n\t// Stated, not inherited: this renders through a portal, so its direction must\n\t// not depend on where the portal lands. See the portalled-surface scenario\n\t// under the RTL requirement in openspec/specs/accessibility/spec.md.\n\tconst { direction } = useLocale();\n\n\treturn (\n\t\t<ModalOverlay\n\t\t\tisOpen={isOpen}\n\t\t\tonOpenChange={onOpenChange}\n\t\t\tisDismissable={isDismissable}\n\t\t\tclassName={sheetScrim}\n\t\t\tdir={direction}\n\t\t>\n\t\t\t<OverlayRegistration />\n\t\t\t<Modal className={sheetModal} style={{ maxHeight }}>\n\t\t\t\t<AriaDialog\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\tclassName={cx(sheetDialog, className)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</AriaDialog>\n\t\t\t</Modal>\n\t\t</ModalOverlay>\n\t);\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,EAAa,EAC5B,WACA,iBACA,mBAAgB,IAChB,cAAc,GACd,oBAAoB,GACpB,cACA,cACA,eACqB;CAIrB,IAAM,EAAE,iBAAc,
|
|
1
|
+
{"version":3,"file":"SheetOverlay.js","names":[],"sources":["../../../src/components/SheetOverlay/SheetOverlay.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { useLocale } from \"react-aria\";\nimport {\n\tDialog as AriaDialog,\n\tModal,\n\tModalOverlay,\n} from \"react-aria-components\";\nimport { OverlayRegistration } from \"../../hooks/overlayRegistry.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { sheetDialog, sheetModal, sheetScrim } from \"./SheetOverlay.css.js\";\n\nexport interface SheetOverlayProps {\n\t/** Whether the sheet is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (scrim tap, Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on scrim tap. Escape always cancels (RAC default). Defaults to `true`. */\n\tisDismissable?: boolean;\n\t/** Accessible name fallback when the child has no `Sheet.Title`. */\n\t\"aria-label\"?: string;\n\t/** Id of the element describing the sheet, typically a `Sheet.Body`. */\n\t\"aria-describedby\"?: string;\n\t/** Maximum sheet height. Defaults to 80% of the available height. */\n\tmaxHeight?: CSSProperties[\"maxHeight\"];\n\tclassName?: string;\n\tchildren: ReactNode;\n}\n\n/**\n * Modal bottom-sheet presentation: dark scrim, focus-trap, dismiss-on-tap/Escape,\n * bottom-anchored, rounded-top corners, slide-up. Wraps arbitrary children\n * (typically a `Sheet`). For a full-window surface use `FullscreenOverlay`; for a\n * centered dialog `Dialog`; for a non-dimming bottom bubble `BubbleOverlay`.\n *\n * Give the dialog an accessible name via either a `Sheet.Title` or the\n * `aria-label` prop — with neither (e.g. an actions-only Confirm sheet) RAC\n * emits a missing-name warning.\n */\nexport function SheetOverlay({\n\tisOpen,\n\tonOpenChange,\n\tisDismissable = true,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\tclassName,\n\tmaxHeight,\n\tchildren,\n}: SheetOverlayProps) {\n\t// Stated, not inherited: this renders through a portal, so its direction must\n\t// not depend on where the portal lands. See the portalled-surface scenario\n\t// under the RTL requirement in openspec/specs/accessibility/spec.md.\n\tconst { direction } = useLocale();\n\n\treturn (\n\t\t<ModalOverlay\n\t\t\tisOpen={isOpen}\n\t\t\tonOpenChange={onOpenChange}\n\t\t\tisDismissable={isDismissable}\n\t\t\tclassName={sheetScrim}\n\t\t\tdir={direction}\n\t\t>\n\t\t\t<OverlayRegistration />\n\t\t\t<Modal className={sheetModal} style={{ maxHeight }}>\n\t\t\t\t<AriaDialog\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\tclassName={cx(sheetDialog, className)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</AriaDialog>\n\t\t\t</Modal>\n\t\t</ModalOverlay>\n\t);\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,EAAa,EAC5B,WACA,iBACA,mBAAgB,IAChB,cAAc,GACd,oBAAoB,GACpB,cACA,cACA,eACqB;CAIrB,IAAM,EAAE,iBAAc,EAAU;CAEhC,OACC,kBAAC,GAAD;EACS;EACM;EACC;EACf,WAAW;EACX,KAAK;YALN,CAOC,kBAAC,GAAD,CAAsB,CAAA,GACtB,kBAAC,GAAD;GAAO,WAAW;GAAY,OAAO,EAAE,aAAU;aAChD,kBAAC,GAAD;IACC,cAAY;IACZ,oBAAkB;IAClB,WAAW,EAAG,GAAa,CAAS;IAEnC;GACU,CAAA;EACN,CAAA,CACM;;AAEhB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/Spinner/Spinner.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","names":[],"sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport { usePrefersReducedMotion } from \"../../hooks/index.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { spinner } from \"./Spinner.css.js\";\n\nexport type SpinnerSize = \"sm\" | \"lg\";\nexport type SpinnerBackground = \"default\" | \"accent\";\n\nexport interface SpinnerProps {\n\t/** `sm` (16px) for inline / in-button, `lg` (32px) for region / page. */\n\tsize?: SpinnerSize;\n\t/**\n\t * The background the spinner sits on. `default` adapts to light/dark mode;\n\t * `accent` is for filled-accent (brand-colored) surfaces where the arc must\n\t * stay white in both themes, since the accent color does not invert.\n\t */\n\tbackground?: SpinnerBackground;\n\t/** Accessible name announced by assistive tech. */\n\tlabel?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nexport function Spinner({\n\tsize = \"sm\",\n\tbackground = \"default\",\n\tlabel = \"Loading\",\n\tclassName,\n\t...rest\n}: SpinnerProps) {\n\tconst reducedMotion = usePrefersReducedMotion();\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\trole=\"status\"\n\t\t\taria-label={label}\n\t\t\tdata-size={size}\n\t\t\tdata-background={background}\n\t\t\tdata-reduced-motion={reducedMotion || undefined}\n\t\t\tclassName={cx(spinner({ size, background }), className)}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAQ,EACvB,UAAO,MACP,gBAAa,WACb,WAAQ,WACR,cACA,GAAG,KACa;CAChB,IAAM,IAAgB,
|
|
1
|
+
{"version":3,"file":"Spinner.js","names":[],"sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport { usePrefersReducedMotion } from \"../../hooks/index.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { spinner } from \"./Spinner.css.js\";\n\nexport type SpinnerSize = \"sm\" | \"lg\";\nexport type SpinnerBackground = \"default\" | \"accent\";\n\nexport interface SpinnerProps {\n\t/** `sm` (16px) for inline / in-button, `lg` (32px) for region / page. */\n\tsize?: SpinnerSize;\n\t/**\n\t * The background the spinner sits on. `default` adapts to light/dark mode;\n\t * `accent` is for filled-accent (brand-colored) surfaces where the arc must\n\t * stay white in both themes, since the accent color does not invert.\n\t */\n\tbackground?: SpinnerBackground;\n\t/** Accessible name announced by assistive tech. */\n\tlabel?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n}\n\nexport function Spinner({\n\tsize = \"sm\",\n\tbackground = \"default\",\n\tlabel = \"Loading\",\n\tclassName,\n\t...rest\n}: SpinnerProps) {\n\tconst reducedMotion = usePrefersReducedMotion();\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\trole=\"status\"\n\t\t\taria-label={label}\n\t\t\tdata-size={size}\n\t\t\tdata-background={background}\n\t\t\tdata-reduced-motion={reducedMotion || undefined}\n\t\t\tclassName={cx(spinner({ size, background }), className)}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;AAwBA,SAAgB,EAAQ,EACvB,UAAO,MACP,gBAAa,WACb,WAAQ,WACR,cACA,GAAG,KACa;CAChB,IAAM,IAAgB,EAAwB;CAC9C,OACC,kBAAC,OAAD;EACC,GAAI;EACJ,MAAK;EACL,cAAY;EACZ,aAAW;EACX,mBAAiB;EACjB,uBAAqB,KAAiB,KAAA;EACtC,WAAW,EAAG,EAAQ;GAAE;GAAM;EAAW,CAAC,GAAG,CAAS;CACtD,CAAA;AAEH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveyRating.js","names":[],"sources":["../../../src/components/SurveyRating/SurveyRating.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport { ToggleButtonGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { Chip } from \"../Chip/index.js\";\nimport type { SurveyLabelProps } from \"./SurveyLabelProps.js\";\nimport {\n\tsurveyRatingLabels,\n\tsurveyRatingRoot,\n\tsurveyRatingScale,\n} from \"./SurveyRating.css.js\";\n\nexport interface SurveyRatingOption {\n\t/** Numeric value shown on the chip (e.g. 1–5, 1–10). Rendered unless `icon` is set. */\n\tvalue: number;\n\t/** Stable identity used for selection. Defaults to the option's array index. */\n\tkey?: Key;\n\t/** Endpoint label to render as selected option. */\n\tlabel?: string;\n\t/** Renders an icon chip (emoji, thumbs) instead of the numeric value. */\n\ticon?: ReactNode;\n\t/** Accessible name for the option. Overrides the numeric value / icon; icon options fall back to `label`. */\n\t\"aria-label\"?: string;\n}\n\nexport type SurveyRatingProps = SurveyLabelProps & {\n\t/** Ordered rating options, lowest value first. */\n\toptions: SurveyRatingOption[];\n\t/** Show the first and last options' labels as scale endpoints. */\n\tshowLabels?: boolean;\n\tisDisabled?: boolean;\n\t/** Selected option key (controlled). `null` means nothing selected. */\n\tselectedKey?: Key | null;\n\t/** Initially-selected option key (uncontrolled). */\n\tdefaultSelectedKey?: Key | null;\n\t/** Fires with the newly-selected key and option, or `null` when deselected. */\n\tonChange?: (key: Key | null, option: SurveyRatingOption | null) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n};\n\nconst keyFor = (option: SurveyRatingOption, index: number) =>\n\toption.key ?? index;\n\n/** Most chips allowed on one row before the scale wraps to a balanced grid. */\nconst MAX_PER_ROW = 7;\n\n/** Chip footprint at `size=\"lg\"` — mirrors Chip.css.ts's fixed 48px square + gap-8. */\nconst CHIP_SIZE_LG = 48;\nconst CHIP_GAP = 8;\n\n/** Column count that splits `count` options into evenly-sized rows (11 → 6, 10 → 5, 7 → 7). */\nconst balancedColumns = (count: number) => {\n\tconst rows = Math.max(1, Math.ceil(count / MAX_PER_ROW));\n\treturn Math.max(1, Math.ceil(count / rows));\n};\n\n/**\n * Width that wraps the scale at the balanced column count. A cap rather than a fixed\n * track count, so a container narrower than this wraps further instead of overflowing\n * (the 0-10 scale is 328px wide — wider than the 320px BubbleOverlay cap).\n */\nconst balancedMaxWidth = (count: number) => {\n\tconst cols = balancedColumns(count);\n\treturn cols * CHIP_SIZE_LG + (cols - 1) * CHIP_GAP;\n};\n\n/**\n * Single-select rating scale for post-conversation surveys. Renders each option as a\n * square {@link Chip}; a numeric `value` or an `icon` (emoji, thumbs) per option supports\n * arbitrary scales. Exactly one option is selectable at a time, and tapping the selected\n * option deselects it (React Aria toggle semantics).\n */\nexport function SurveyRating({\n\toptions,\n\tshowLabels = false,\n\tisDisabled,\n\tselectedKey,\n\tdefaultSelectedKey,\n\tonChange,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledBy,\n}: SurveyRatingProps) {\n\tconst lowLabel = options[0]?.label;\n\tconst highLabel = options[options.length - 1]?.label;\n\n\tconst handleSelectionChange = (keys: Set<Key>) => {\n\t\tconst key = keys.size ? [...keys][0] : null;\n\t\tconst option =\n\t\t\tkey == null\n\t\t\t\t? null\n\t\t\t\t: (options.find((o, i) => keyFor(o, i) === key) ?? null);\n\t\tonChange?.(key, option);\n\t};\n\n\t// Translate the single-key facade into RAC's Set-based controlled/uncontrolled props:\n\t// a defined `selectedKey` (including `null`) is controlled; otherwise it's uncontrolled.\n\tconst toKeys = (key: Key | null | undefined) => (key == null ? [] : [key]);\n\tconst isControlled = selectedKey !== undefined;\n\n\treturn (\n\t\t<div ref={ref} className={cx(surveyRatingRoot, className)} style={style}>\n\t\t\t<ToggleButtonGroup\n\t\t\t\tselectionMode=\"single\"\n\t\t\t\tisDisabled={isDisabled}\n\t\t\t\taria-label={ariaLabelledBy ? undefined : ariaLabel}\n\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\tclassName={surveyRatingScale}\n\t\t\t\tstyle={{ maxWidth: balancedMaxWidth(options.length) }}\n\t\t\t\tonSelectionChange={handleSelectionChange}\n\t\t\t\tselectedKeys={isControlled ? toKeys(selectedKey) : undefined}\n\t\t\t\tdefaultSelectedKeys={\n\t\t\t\t\tisControlled ? undefined : toKeys(defaultSelectedKey)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{options.map((option, index) => {\n\t\t\t\t\tconst isIcon = option.icon != null;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\tkey={keyFor(option, index)}\n\t\t\t\t\t\t\tid={keyFor(option, index)}\n\t\t\t\t\t\t\tvariant={isIcon ? \"icon\" : \"number\"}\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\toption[\"aria-label\"] ?? (isIcon ? option.label : undefined)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{option.icon ?? option.value}\n\t\t\t\t\t\t</Chip>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ToggleButtonGroup>\n\t\t\t{showLabels && (lowLabel != null || highLabel != null) && (\n\t\t\t\t<div className={surveyRatingLabels}>\n\t\t\t\t\t<span>{lowLabel}</span>\n\t\t\t\t\t<span>{highLabel}</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AA0CA,IAAM,KAAU,GAA4B,MAC3C,EAAO,OAAO,GAGT,IAAc,GAGd,IAAe,IACf,IAAW,GAGX,KAAmB,MAAkB;CAC1C,IAAM,IAAO,KAAK,IAAI,GAAG,KAAK,KAAK,IAAQ,
|
|
1
|
+
{"version":3,"file":"SurveyRating.js","names":[],"sources":["../../../src/components/SurveyRating/SurveyRating.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport { ToggleButtonGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { Chip } from \"../Chip/index.js\";\nimport type { SurveyLabelProps } from \"./SurveyLabelProps.js\";\nimport {\n\tsurveyRatingLabels,\n\tsurveyRatingRoot,\n\tsurveyRatingScale,\n} from \"./SurveyRating.css.js\";\n\nexport interface SurveyRatingOption {\n\t/** Numeric value shown on the chip (e.g. 1–5, 1–10). Rendered unless `icon` is set. */\n\tvalue: number;\n\t/** Stable identity used for selection. Defaults to the option's array index. */\n\tkey?: Key;\n\t/** Endpoint label to render as selected option. */\n\tlabel?: string;\n\t/** Renders an icon chip (emoji, thumbs) instead of the numeric value. */\n\ticon?: ReactNode;\n\t/** Accessible name for the option. Overrides the numeric value / icon; icon options fall back to `label`. */\n\t\"aria-label\"?: string;\n}\n\nexport type SurveyRatingProps = SurveyLabelProps & {\n\t/** Ordered rating options, lowest value first. */\n\toptions: SurveyRatingOption[];\n\t/** Show the first and last options' labels as scale endpoints. */\n\tshowLabels?: boolean;\n\tisDisabled?: boolean;\n\t/** Selected option key (controlled). `null` means nothing selected. */\n\tselectedKey?: Key | null;\n\t/** Initially-selected option key (uncontrolled). */\n\tdefaultSelectedKey?: Key | null;\n\t/** Fires with the newly-selected key and option, or `null` when deselected. */\n\tonChange?: (key: Key | null, option: SurveyRatingOption | null) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n};\n\nconst keyFor = (option: SurveyRatingOption, index: number) =>\n\toption.key ?? index;\n\n/** Most chips allowed on one row before the scale wraps to a balanced grid. */\nconst MAX_PER_ROW = 7;\n\n/** Chip footprint at `size=\"lg\"` — mirrors Chip.css.ts's fixed 48px square + gap-8. */\nconst CHIP_SIZE_LG = 48;\nconst CHIP_GAP = 8;\n\n/** Column count that splits `count` options into evenly-sized rows (11 → 6, 10 → 5, 7 → 7). */\nconst balancedColumns = (count: number) => {\n\tconst rows = Math.max(1, Math.ceil(count / MAX_PER_ROW));\n\treturn Math.max(1, Math.ceil(count / rows));\n};\n\n/**\n * Width that wraps the scale at the balanced column count. A cap rather than a fixed\n * track count, so a container narrower than this wraps further instead of overflowing\n * (the 0-10 scale is 328px wide — wider than the 320px BubbleOverlay cap).\n */\nconst balancedMaxWidth = (count: number) => {\n\tconst cols = balancedColumns(count);\n\treturn cols * CHIP_SIZE_LG + (cols - 1) * CHIP_GAP;\n};\n\n/**\n * Single-select rating scale for post-conversation surveys. Renders each option as a\n * square {@link Chip}; a numeric `value` or an `icon` (emoji, thumbs) per option supports\n * arbitrary scales. Exactly one option is selectable at a time, and tapping the selected\n * option deselects it (React Aria toggle semantics).\n */\nexport function SurveyRating({\n\toptions,\n\tshowLabels = false,\n\tisDisabled,\n\tselectedKey,\n\tdefaultSelectedKey,\n\tonChange,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledBy,\n}: SurveyRatingProps) {\n\tconst lowLabel = options[0]?.label;\n\tconst highLabel = options[options.length - 1]?.label;\n\n\tconst handleSelectionChange = (keys: Set<Key>) => {\n\t\tconst key = keys.size ? [...keys][0] : null;\n\t\tconst option =\n\t\t\tkey == null\n\t\t\t\t? null\n\t\t\t\t: (options.find((o, i) => keyFor(o, i) === key) ?? null);\n\t\tonChange?.(key, option);\n\t};\n\n\t// Translate the single-key facade into RAC's Set-based controlled/uncontrolled props:\n\t// a defined `selectedKey` (including `null`) is controlled; otherwise it's uncontrolled.\n\tconst toKeys = (key: Key | null | undefined) => (key == null ? [] : [key]);\n\tconst isControlled = selectedKey !== undefined;\n\n\treturn (\n\t\t<div ref={ref} className={cx(surveyRatingRoot, className)} style={style}>\n\t\t\t<ToggleButtonGroup\n\t\t\t\tselectionMode=\"single\"\n\t\t\t\tisDisabled={isDisabled}\n\t\t\t\taria-label={ariaLabelledBy ? undefined : ariaLabel}\n\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\tclassName={surveyRatingScale}\n\t\t\t\tstyle={{ maxWidth: balancedMaxWidth(options.length) }}\n\t\t\t\tonSelectionChange={handleSelectionChange}\n\t\t\t\tselectedKeys={isControlled ? toKeys(selectedKey) : undefined}\n\t\t\t\tdefaultSelectedKeys={\n\t\t\t\t\tisControlled ? undefined : toKeys(defaultSelectedKey)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{options.map((option, index) => {\n\t\t\t\t\tconst isIcon = option.icon != null;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\tkey={keyFor(option, index)}\n\t\t\t\t\t\t\tid={keyFor(option, index)}\n\t\t\t\t\t\t\tvariant={isIcon ? \"icon\" : \"number\"}\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\toption[\"aria-label\"] ?? (isIcon ? option.label : undefined)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{option.icon ?? option.value}\n\t\t\t\t\t\t</Chip>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ToggleButtonGroup>\n\t\t\t{showLabels && (lowLabel != null || highLabel != null) && (\n\t\t\t\t<div className={surveyRatingLabels}>\n\t\t\t\t\t<span>{lowLabel}</span>\n\t\t\t\t\t<span>{highLabel}</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AA0CA,IAAM,KAAU,GAA4B,MAC3C,EAAO,OAAO,GAGT,IAAc,GAGd,IAAe,IACf,IAAW,GAGX,KAAmB,MAAkB;CAC1C,IAAM,IAAO,KAAK,IAAI,GAAG,KAAK,KAAK,IAAQ,CAAW,CAAC;CACvD,OAAO,KAAK,IAAI,GAAG,KAAK,KAAK,IAAQ,CAAI,CAAC;AAC3C,GAOM,KAAoB,MAAkB;CAC3C,IAAM,IAAO,EAAgB,CAAK;CAClC,OAAO,IAAO,KAAgB,IAAO,KAAK;AAC3C;AAQA,SAAgB,EAAa,EAC5B,YACA,gBAAa,IACb,eACA,gBACA,uBACA,aACA,cACA,UACA,QACA,cAAc,GACd,mBAAmB,KACE;CACrB,IAAM,IAAW,EAAQ,EAAE,EAAE,OACvB,IAAY,EAAQ,EAAQ,SAAS,EAAE,EAAE,OAEzC,KAAyB,MAAmB;EACjD,IAAM,IAAM,EAAK,OAAO,CAAC,GAAG,CAAI,CAAC,CAAC,KAAK,MACjC,IACL,KAAO,OACJ,OACC,EAAQ,MAAM,GAAG,MAAM,EAAO,GAAG,CAAC,MAAM,CAAG,KAAK;EACrD,IAAW,GAAK,CAAM;CACvB,GAIM,KAAU,MAAiC,KAAO,OAAO,CAAC,IAAI,CAAC,CAAG,GAClE,IAAe,MAAgB,KAAA;CAErC,OACC,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,GAAkB,CAAS;EAAU;YAAlE,CACC,kBAAC,GAAD;GACC,eAAc;GACF;GACZ,cAAY,IAAiB,KAAA,IAAY;GACzC,mBAAiB;GACjB,WAAW;GACX,OAAO,EAAE,UAAU,EAAiB,EAAQ,MAAM,EAAE;GACpD,mBAAmB;GACnB,cAAc,IAAe,EAAO,CAAW,IAAI,KAAA;GACnD,qBACC,IAAe,KAAA,IAAY,EAAO,CAAkB;aAGpD,EAAQ,KAAK,GAAQ,MAAU;IAC/B,IAAM,IAAS,EAAO,QAAQ;IAC9B,OACC,kBAAC,GAAD;KAEC,IAAI,EAAO,GAAQ,CAAK;KACxB,SAAS,IAAS,SAAS;KAC3B,MAAK;KACL,cACC,EAAO,kBAAkB,IAAS,EAAO,QAAQ,KAAA;eAGjD,EAAO,QAAQ,EAAO;IAClB,GATA,EAAO,GAAQ,CAAK,CASpB;GAER,CAAC;EACiB,CAAA,GAClB,MAAe,KAAY,QAAQ,KAAa,SAChD,kBAAC,OAAD;GAAK,WAAA;aAAL,CACC,kBAAC,QAAD,EAAA,UAAO,EAAe,CAAA,GACtB,kBAAC,QAAD,EAAA,UAAO,EAAgB,CAAA,CACnB;IAEF;;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveySelect.js","names":[],"sources":["../../../src/components/SurveySelect/SurveySelect.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport { ToggleButtonGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { Chip } from \"../Chip/index.js\";\nimport type { SurveyLabelProps } from \"../SurveyRating/SurveyLabelProps.js\";\nimport { surveySelectRoot } from \"./SurveySelect.css.js\";\n\nexport interface SurveySelectOption {\n\t/** Chip label text. */\n\tlabel: string;\n\t/** Stable identity used for selection. Defaults to the option's array index. */\n\tkey?: Key;\n}\n\nexport type SurveySelectProps = SurveyLabelProps & {\n\t/** Selectable options, rendered in order. */\n\toptions: SurveySelectOption[];\n\t/**\n\t * `multiple` (default) allows any number of selected chips; `single` allows at\n\t * most one (e.g. a Yes/No question) and renders as a radiogroup.\n\t */\n\tselectionMode?: \"single\" | \"multiple\";\n\t/**\n\t * When `true`, a selected option can't be toggled back off — restores radio\n\t * semantics for a required single-select (e.g. a Yes/No question).\n\t */\n\tdisallowEmptySelection?: boolean;\n\tisDisabled?: boolean;\n\t/** Selected option keys (controlled). */\n\tselectedKeys?: Key[];\n\t/** Initially-selected option keys (uncontrolled). */\n\tdefaultSelectedKeys?: Key[];\n\t/** Fires with the full set of selected keys and their options, in option order. */\n\tonChange?: (keys: Key[], options: SurveySelectOption[]) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n};\n\nconst keyFor = (option: SurveySelectOption, index: number) =>\n\toption.key ?? index;\n\n/**\n * Multi-select chip group for surveys — the labelled-pill counterpart to the single-select\n * {@link SurveyRating}. Any number of options can be selected at once; selection state\n * renders the accent fill on each {@link Chip}.\n */\nexport function SurveySelect({\n\toptions,\n\tselectionMode = \"multiple\",\n\tdisallowEmptySelection,\n\tisDisabled,\n\tselectedKeys,\n\tdefaultSelectedKeys,\n\tonChange,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledBy,\n}: SurveySelectProps) {\n\tconst handleSelectionChange = (keys: Set<Key>) => {\n\t\tconst selected = options\n\t\t\t.map((option, index) => ({ option, key: keyFor(option, index) }))\n\t\t\t.filter(({ key }) => keys.has(key));\n\t\tonChange?.(\n\t\t\tselected.map((s) => s.key),\n\t\t\tselected.map((s) => s.option),\n\t\t);\n\t};\n\n\tconst isControlled = selectedKeys !== undefined;\n\n\treturn (\n\t\t<ToggleButtonGroup\n\t\t\tref={ref}\n\t\t\tselectionMode={selectionMode}\n\t\t\tdisallowEmptySelection={disallowEmptySelection}\n\t\t\tisDisabled={isDisabled}\n\t\t\taria-label={ariaLabelledBy ? undefined : ariaLabel}\n\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\tclassName={cx(surveySelectRoot, className)}\n\t\t\tstyle={style}\n\t\t\tonSelectionChange={handleSelectionChange}\n\t\t\tselectedKeys={isControlled ? selectedKeys : undefined}\n\t\t\tdefaultSelectedKeys={\n\t\t\t\tisControlled ? undefined : (defaultSelectedKeys ?? [])\n\t\t\t}\n\t\t>\n\t\t\t{options.map((option, index) => (\n\t\t\t\t<Chip\n\t\t\t\t\tkey={keyFor(option, index)}\n\t\t\t\t\tid={keyFor(option, index)}\n\t\t\t\t\tvariant=\"text\"\n\t\t\t\t\tsize=\"md\"\n\t\t\t\t>\n\t\t\t\t\t{option.label}\n\t\t\t\t</Chip>\n\t\t\t))}\n\t\t</ToggleButtonGroup>\n\t);\n}\n"],"mappings":";;;;;;AAwCA,IAAM,KAAU,GAA4B,MAC3C,EAAO,OAAO;AAOf,SAAgB,EAAa,EAC5B,YACA,mBAAgB,YAChB,2BACA,eACA,iBACA,wBACA,aACA,cACA,UACA,QACA,cAAc,GACd,mBAAmB,KACE;CACrB,IAAM,KAAyB,MAAmB;EACjD,IAAM,IAAW,EACf,KAAK,GAAQ,OAAW;GAAE;GAAQ,KAAK,EAAO,GAAQ,
|
|
1
|
+
{"version":3,"file":"SurveySelect.js","names":[],"sources":["../../../src/components/SurveySelect/SurveySelect.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport { ToggleButtonGroup } from \"react-aria-components\";\nimport { cx } from \"../../utils/cx.js\";\nimport { Chip } from \"../Chip/index.js\";\nimport type { SurveyLabelProps } from \"../SurveyRating/SurveyLabelProps.js\";\nimport { surveySelectRoot } from \"./SurveySelect.css.js\";\n\nexport interface SurveySelectOption {\n\t/** Chip label text. */\n\tlabel: string;\n\t/** Stable identity used for selection. Defaults to the option's array index. */\n\tkey?: Key;\n}\n\nexport type SurveySelectProps = SurveyLabelProps & {\n\t/** Selectable options, rendered in order. */\n\toptions: SurveySelectOption[];\n\t/**\n\t * `multiple` (default) allows any number of selected chips; `single` allows at\n\t * most one (e.g. a Yes/No question) and renders as a radiogroup.\n\t */\n\tselectionMode?: \"single\" | \"multiple\";\n\t/**\n\t * When `true`, a selected option can't be toggled back off — restores radio\n\t * semantics for a required single-select (e.g. a Yes/No question).\n\t */\n\tdisallowEmptySelection?: boolean;\n\tisDisabled?: boolean;\n\t/** Selected option keys (controlled). */\n\tselectedKeys?: Key[];\n\t/** Initially-selected option keys (uncontrolled). */\n\tdefaultSelectedKeys?: Key[];\n\t/** Fires with the full set of selected keys and their options, in option order. */\n\tonChange?: (keys: Key[], options: SurveySelectOption[]) => void;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n};\n\nconst keyFor = (option: SurveySelectOption, index: number) =>\n\toption.key ?? index;\n\n/**\n * Multi-select chip group for surveys — the labelled-pill counterpart to the single-select\n * {@link SurveyRating}. Any number of options can be selected at once; selection state\n * renders the accent fill on each {@link Chip}.\n */\nexport function SurveySelect({\n\toptions,\n\tselectionMode = \"multiple\",\n\tdisallowEmptySelection,\n\tisDisabled,\n\tselectedKeys,\n\tdefaultSelectedKeys,\n\tonChange,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledBy,\n}: SurveySelectProps) {\n\tconst handleSelectionChange = (keys: Set<Key>) => {\n\t\tconst selected = options\n\t\t\t.map((option, index) => ({ option, key: keyFor(option, index) }))\n\t\t\t.filter(({ key }) => keys.has(key));\n\t\tonChange?.(\n\t\t\tselected.map((s) => s.key),\n\t\t\tselected.map((s) => s.option),\n\t\t);\n\t};\n\n\tconst isControlled = selectedKeys !== undefined;\n\n\treturn (\n\t\t<ToggleButtonGroup\n\t\t\tref={ref}\n\t\t\tselectionMode={selectionMode}\n\t\t\tdisallowEmptySelection={disallowEmptySelection}\n\t\t\tisDisabled={isDisabled}\n\t\t\taria-label={ariaLabelledBy ? undefined : ariaLabel}\n\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\tclassName={cx(surveySelectRoot, className)}\n\t\t\tstyle={style}\n\t\t\tonSelectionChange={handleSelectionChange}\n\t\t\tselectedKeys={isControlled ? selectedKeys : undefined}\n\t\t\tdefaultSelectedKeys={\n\t\t\t\tisControlled ? undefined : (defaultSelectedKeys ?? [])\n\t\t\t}\n\t\t>\n\t\t\t{options.map((option, index) => (\n\t\t\t\t<Chip\n\t\t\t\t\tkey={keyFor(option, index)}\n\t\t\t\t\tid={keyFor(option, index)}\n\t\t\t\t\tvariant=\"text\"\n\t\t\t\t\tsize=\"md\"\n\t\t\t\t>\n\t\t\t\t\t{option.label}\n\t\t\t\t</Chip>\n\t\t\t))}\n\t\t</ToggleButtonGroup>\n\t);\n}\n"],"mappings":";;;;;;AAwCA,IAAM,KAAU,GAA4B,MAC3C,EAAO,OAAO;AAOf,SAAgB,EAAa,EAC5B,YACA,mBAAgB,YAChB,2BACA,eACA,iBACA,wBACA,aACA,cACA,UACA,QACA,cAAc,GACd,mBAAmB,KACE;CACrB,IAAM,KAAyB,MAAmB;EACjD,IAAM,IAAW,EACf,KAAK,GAAQ,OAAW;GAAE;GAAQ,KAAK,EAAO,GAAQ,CAAK;EAAE,EAAE,CAAC,CAChE,QAAQ,EAAE,aAAU,EAAK,IAAI,CAAG,CAAC;EACnC,IACC,EAAS,KAAK,MAAM,EAAE,GAAG,GACzB,EAAS,KAAK,MAAM,EAAE,MAAM,CAC7B;CACD,GAEM,IAAe,MAAiB,KAAA;CAEtC,OACC,kBAAC,GAAD;EACM;EACU;EACS;EACZ;EACZ,cAAY,IAAiB,KAAA,IAAY;EACzC,mBAAiB;EACjB,WAAW,EAAG,GAAkB,CAAS;EAClC;EACP,mBAAmB;EACnB,cAAc,IAAe,IAAe,KAAA;EAC5C,qBACC,IAAe,KAAA,IAAa,KAAuB,CAAC;YAGpD,EAAQ,KAAK,GAAQ,MACrB,kBAAC,GAAD;GAEC,IAAI,EAAO,GAAQ,CAAK;GACxB,SAAQ;GACR,MAAK;aAEJ,EAAO;EACH,GANA,EAAO,GAAQ,CAAK,CAMpB,CACN;CACiB,CAAA;AAErB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/Text/Text.css.ts
|
|
4
4
|
var t = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":[],"sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, Ref } from \"react\";\nimport type { TextVariant, TextWeight } from \"../../styles/typography.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { textRoot } from \"./Text.css.js\";\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n\t/**\n\t * Which semantic type tier to render at. Mirrors the Figma variable names.\n\t */\n\tvariant?: TextVariant;\n\tweight?: TextWeight;\n\t/**\n\t * The element to render. Defaults to `<span>`.\n\t *\n\t * Not for headings: a heading takes its level from its role, so compose RAC's\n\t * `Heading` there instead, as `Dialog.Title` does.\n\t */\n\tas?: keyof HTMLElementTagNameMap;\n\tref?: Ref<HTMLElement>;\n}\n\n/**\n * Text at one of the four semantic type tiers.\n *\n * Tier and weight are independent axes because they are independent in\n * practice: `body` ships at `regular` on seven components and `medium` on\n * seven others.\n *\n * Use this for a piece of text that owns its own element. A component whose\n * type sits on its own root — a `<button>`, a `<label>`, a toast — spreads\n * `typography()` into that root's class instead, rather than nesting a `Text`\n * inside itself.\n */\nexport function Text({\n\tvariant = \"body\",\n\tweight = \"regular\",\n\tclassName,\n\tas: Element = \"span\",\n\t...rest\n}: TextProps) {\n\tconst Component = Element as ElementType;\n\treturn (\n\t\t<Component\n\t\t\t{...rest}\n\t\t\tclassName={cx(textRoot({ variant, weight }), className)}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;AAiCA,SAAgB,EAAK,EACpB,aAAU,QACV,YAAS,WACT,cACA,IAAI,IAAU,QACd,GAAG,KACU;
|
|
1
|
+
{"version":3,"file":"Text.js","names":[],"sources":["../../../src/components/Text/Text.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, Ref } from \"react\";\nimport type { TextVariant, TextWeight } from \"../../styles/typography.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { textRoot } from \"./Text.css.js\";\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n\t/**\n\t * Which semantic type tier to render at. Mirrors the Figma variable names.\n\t */\n\tvariant?: TextVariant;\n\tweight?: TextWeight;\n\t/**\n\t * The element to render. Defaults to `<span>`.\n\t *\n\t * Not for headings: a heading takes its level from its role, so compose RAC's\n\t * `Heading` there instead, as `Dialog.Title` does.\n\t */\n\tas?: keyof HTMLElementTagNameMap;\n\tref?: Ref<HTMLElement>;\n}\n\n/**\n * Text at one of the four semantic type tiers.\n *\n * Tier and weight are independent axes because they are independent in\n * practice: `body` ships at `regular` on seven components and `medium` on\n * seven others.\n *\n * Use this for a piece of text that owns its own element. A component whose\n * type sits on its own root — a `<button>`, a `<label>`, a toast — spreads\n * `typography()` into that root's class instead, rather than nesting a `Text`\n * inside itself.\n */\nexport function Text({\n\tvariant = \"body\",\n\tweight = \"regular\",\n\tclassName,\n\tas: Element = \"span\",\n\t...rest\n}: TextProps) {\n\tconst Component = Element as ElementType;\n\treturn (\n\t\t<Component\n\t\t\t{...rest}\n\t\t\tclassName={cx(textRoot({ variant, weight }), className)}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;AAiCA,SAAgB,EAAK,EACpB,aAAU,QACV,YAAS,WACT,cACA,IAAI,IAAU,QACd,GAAG,KACU;CAEb,OACC,kBAAC,GAAD;EACC,GAAI;EACJ,WAAW,EAAG,EAAS;GAAE;GAAS;EAAO,CAAC,GAAG,CAAS;CACtD,CAAA;AAEH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingShimmer.js","names":[],"sources":["../../../src/components/ThinkingShimmer/ThinkingShimmer.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { dot, ellipsis, root, visuallyHidden } from \"./ThinkingShimmer.css.js\";\n\nexport interface ThinkingShimmerProps\n\textends Omit<HTMLAttributes<HTMLSpanElement>, \"children\"> {\n\t/** Visible and announced label. Trailing dots are normalized before the animated ellipsis is appended. */\n\tlabel?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * AI thinking indicator — a label with a trailing ellipsis, shown while the AI\n * agent is generating a response. A single shimmer band sweeps continuously\n * through the whole label (word and dots). Render it as a transient status line in\n * the message list while the assistant is streaming (or before the first token),\n * and remove it once content arrives. Use only for AI generation, not for a human\n * agent typing.\n *\n * Exposed as a polite live region. Two distinct a11y paths carry the same\n * `announced` string, which defaults to `label`: `aria-label` gives the region\n * its accessible name (`role=\"status\"` is not name-from-content, so descendant\n * text alone yields no name), and a visually-hidden copy of the text drives the\n * on-appearance announcement (live regions announce rendered text, not\n * `aria-label`). Both are needed — dropping either loses the name or the\n * announcement. The visible word (which strips trailing dots before rendering\n * the animated ellipsis) and dots are hidden from assistive tech. Honors reduced\n * motion by holding the shimmer static at a flat resting color.\n *\n * Reliable on-appearance announcement additionally depends on the consuming\n * surface keeping a persistent live region present before this mounts (the app's\n * MessageList/MessageAnnouncer already do); validate with a real screen reader\n * when a surface adopts this component.\n *\n * A surface that already wraps this in its own live region should pass\n * `aria-live=\"off\"`: two nested regions announce the same text twice, in an order\n * neither controls.\n */\nexport function ThinkingShimmer({\n\tlabel = \"Thinking\",\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t\"aria-live\": ariaLive = \"polite\",\n\t...rest\n}: ThinkingShimmerProps) {\n\tconst visibleLabel = stripTrailingEllipsis(label);\n\tconst announced = ariaLabel ?? label;\n\treturn (\n\t\t<span\n\t\t\t{...rest}\n\t\t\trole=\"status\"\n\t\t\taria-live={ariaLive}\n\t\t\taria-label={announced}\n\t\t\tclassName={cx(root, className)}\n\t\t>\n\t\t\t<span className={visuallyHidden}>{announced}</span>\n\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t{visibleLabel}\n\t\t\t\t<span className={ellipsis}>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</span>\n\t);\n}\n\nfunction stripTrailingEllipsis(label: string): string {\n\treturn label.replace(/[\\s.…]+$/, \"\");\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAAgB,EAC/B,WAAQ,YACR,cACA,cAAc,GACd,aAAa,IAAW,UACxB,GAAG,KACqB;CACxB,IAAM,IAAe,EAAsB,
|
|
1
|
+
{"version":3,"file":"ThinkingShimmer.js","names":[],"sources":["../../../src/components/ThinkingShimmer/ThinkingShimmer.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, Ref } from \"react\";\nimport { cx } from \"../../utils/cx.js\";\nimport { dot, ellipsis, root, visuallyHidden } from \"./ThinkingShimmer.css.js\";\n\nexport interface ThinkingShimmerProps\n\textends Omit<HTMLAttributes<HTMLSpanElement>, \"children\"> {\n\t/** Visible and announced label. Trailing dots are normalized before the animated ellipsis is appended. */\n\tlabel?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * AI thinking indicator — a label with a trailing ellipsis, shown while the AI\n * agent is generating a response. A single shimmer band sweeps continuously\n * through the whole label (word and dots). Render it as a transient status line in\n * the message list while the assistant is streaming (or before the first token),\n * and remove it once content arrives. Use only for AI generation, not for a human\n * agent typing.\n *\n * Exposed as a polite live region. Two distinct a11y paths carry the same\n * `announced` string, which defaults to `label`: `aria-label` gives the region\n * its accessible name (`role=\"status\"` is not name-from-content, so descendant\n * text alone yields no name), and a visually-hidden copy of the text drives the\n * on-appearance announcement (live regions announce rendered text, not\n * `aria-label`). Both are needed — dropping either loses the name or the\n * announcement. The visible word (which strips trailing dots before rendering\n * the animated ellipsis) and dots are hidden from assistive tech. Honors reduced\n * motion by holding the shimmer static at a flat resting color.\n *\n * Reliable on-appearance announcement additionally depends on the consuming\n * surface keeping a persistent live region present before this mounts (the app's\n * MessageList/MessageAnnouncer already do); validate with a real screen reader\n * when a surface adopts this component.\n *\n * A surface that already wraps this in its own live region should pass\n * `aria-live=\"off\"`: two nested regions announce the same text twice, in an order\n * neither controls.\n */\nexport function ThinkingShimmer({\n\tlabel = \"Thinking\",\n\tclassName,\n\t\"aria-label\": ariaLabel,\n\t\"aria-live\": ariaLive = \"polite\",\n\t...rest\n}: ThinkingShimmerProps) {\n\tconst visibleLabel = stripTrailingEllipsis(label);\n\tconst announced = ariaLabel ?? label;\n\treturn (\n\t\t<span\n\t\t\t{...rest}\n\t\t\trole=\"status\"\n\t\t\taria-live={ariaLive}\n\t\t\taria-label={announced}\n\t\t\tclassName={cx(root, className)}\n\t\t>\n\t\t\t<span className={visuallyHidden}>{announced}</span>\n\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t{visibleLabel}\n\t\t\t\t<span className={ellipsis}>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t\t<span className={dot}>.</span>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</span>\n\t);\n}\n\nfunction stripTrailingEllipsis(label: string): string {\n\treturn label.replace(/[\\s.…]+$/, \"\");\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAAgB,EAC/B,WAAQ,YACR,cACA,cAAc,GACd,aAAa,IAAW,UACxB,GAAG,KACqB;CACxB,IAAM,IAAe,EAAsB,CAAK,GAC1C,IAAY,KAAa;CAC/B,OACC,kBAAC,QAAD;EACC,GAAI;EACJ,MAAK;EACL,aAAW;EACX,cAAY;EACZ,WAAW,EAAG,GAAM,CAAS;YAL9B,CAOC,kBAAC,QAAD;GAAM,WAAW;aAAiB;EAAgB,CAAA,GAClD,kBAAC,QAAD;GAAM,eAAY;aAAlB,CACE,GACD,kBAAC,QAAD;IAAM,WAAW;cAAjB;KACC,kBAAC,QAAD;MAAM,WAAW;gBAAK;KAAO,CAAA;KAC7B,kBAAC,QAAD;MAAM,WAAW;gBAAK;KAAO,CAAA;KAC7B,kBAAC,QAAD;MAAM,WAAW;gBAAK;KAAO,CAAA;IACxB;KACD;IACD;;AAER;AAEA,SAAS,EAAsB,GAAuB;CACrD,OAAO,EAAM,QAAQ,YAAY,EAAE;AACpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e } from "../../vendor/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/Toast/Toast.css.ts
|
|
4
4
|
var t = "_16991601", n = e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from \"react\";\nimport type { PressEvent } from \"react-aria\";\nimport { cx } from \"../../utils/cx.js\";\nimport {\n\tCheckmarkCircle,\n\tExclamationTriangle,\n\tXmark,\n\tXmarkCircle,\n} from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Spinner } from \"../Spinner/Spinner.js\";\nimport { toast, toastDismiss, toastIcon, toastMessage } from \"./Toast.css.js\";\n\nexport type ToastStatus =\n\t| \"success\"\n\t| \"warning\"\n\t| \"error\"\n\t| \"custom\"\n\t| \"loading\";\n\nconst STATUS_ICON = {\n\tsuccess: CheckmarkCircle,\n\twarning: ExclamationTriangle,\n\terror: XmarkCircle,\n} as const;\n\nexport interface ToastProps {\n\t/**\n\t * The outcome being reported — selects the leading glyph and its colour. Bind\n\t * it to the result of the action, not the UI. `custom` takes the glyph from\n\t * `icon`; `loading` shows a spinner and refuses a dismiss control.\n\t */\n\tstatus?: ToastStatus;\n\t/** The glyph for `status=\"custom\"`. Ignored for every other status. */\n\ticon?: ReactNode;\n\t/**\n\t * Renders a trailing dismiss button and runs this when the user presses it.\n\t * Ignored while `status=\"loading\"`, whose lifetime belongs to whatever raised\n\t * it rather than to the reader.\n\t */\n\tonDismiss?: (event: PressEvent) => void;\n\t/** Accessible name for the dismiss button. Localize it. */\n\tdismissLabel?: string;\n\t/**\n\t * Takes the press away while the card is on screen only to finish leaving.\n\t * WebKit added `inert` in 15.5, after the iOS 15.4 floor in\n\t * `messaging/vite.browser-targets.mjs`. At that floor, the container's `inert`\n\t * attribute leaves the button tabbable even though its press no longer acts\n\t * on anything. Disabling keeps the card's layout still through the travel,\n\t * which removing the button would not.\n\t */\n\tdismissDisabled?: boolean;\n\t/**\n\t * Attributes for the message element. A container that owns announcement\n\t * passes its live-region props through here, so the dismiss button stays\n\t * outside what gets announced.\n\t */\n\tmessageProps?: HTMLAttributes<HTMLElement>;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The message to display. Keep it to a single line. */\n\tchildren?: ReactNode;\n}\n\nfunction LeadingGlyph({\n\tstatus,\n\ticon,\n}: {\n\tstatus: ToastStatus;\n\ticon: ReactNode;\n}) {\n\tif (status === \"loading\") {\n\t\t// Spinner carries its own `role=\"status\" aria-label=\"Loading\"`, and the\n\t\t// container already puts a live region on the message. Two of them inside\n\t\t// one alertdialog announces \"Loading\" ahead of the message, so this one is\n\t\t// hidden — the copy is what the reader needs.\n\t\treturn (\n\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t<Spinner size=\"sm\" />\n\t\t\t</span>\n\t\t);\n\t}\n\tif (status === \"custom\") {\n\t\treturn icon;\n\t}\n\tconst StatusIcon = STATUS_ICON[status];\n\treturn <StatusIcon />;\n}\n\n/**\n * The floating surface for a transient event — a card that sits above the\n * transcript on a neutral background, rather than the tinted full-width strip\n * `Banner` paints for a lasting condition. The two differ on purpose:\n * a card reads as passing through, a strip as part of the page.\n *\n * Purely presentational, and carries no live region of its own, so it can sit\n * inside a container that owns the announcement. Rendering it standalone\n * announces nothing — reach for `ToastContainer`.\n */\nexport function Toast({\n\tstatus = \"success\",\n\ticon,\n\tonDismiss,\n\tdismissLabel = \"Dismiss notification\",\n\tdismissDisabled = false,\n\tmessageProps,\n\tclassName,\n\tchildren,\n\t...rest\n}: ToastProps) {\n\t// Loading owns its own lifetime, so it never offers a dismiss control even\n\t// when the consumer passes one.\n\tconst canDismiss = !!onDismiss && status !== \"loading\";\n\t// Decided before the element exists: an element is truthy even when the\n\t// component returns null, so testing the rendered glyph would leave an empty\n\t// slot — and its `gap-8` — indenting the message of an iconless `custom`.\n\tconst hasGlyph = status !== \"custom\" || !!icon;\n\n\treturn (\n\t\t<div {...rest} data-status={status} className={cx(toast, className)}>\n\t\t\t{hasGlyph ? (\n\t\t\t\t<span className={toastIcon({ status })}>\n\t\t\t\t\t<LeadingGlyph status={status} icon={icon} />\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t{/* A div, not a span: a container that owns announcement puts a live\n\t\t\t region here, and React Aria renders that region as a div. */}\n\t\t\t<div\n\t\t\t\t{...messageProps}\n\t\t\t\tclassName={cx(messageProps?.className, toastMessage)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t\t{canDismiss && (\n\t\t\t\t<IconButton\n\t\t\t\t\tlabel={dismissLabel}\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tisDisabled={dismissDisabled}\n\t\t\t\t\tonPress={onDismiss}\n\t\t\t\t\tclassName={toastDismiss}\n\t\t\t\t>\n\t\t\t\t\t<Xmark />\n\t\t\t\t</IconButton>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,IAAc;CACnB,SAAS;CACT,SAAS;CACT,OAAO;
|
|
1
|
+
{"version":3,"file":"Toast.js","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from \"react\";\nimport type { PressEvent } from \"react-aria\";\nimport { cx } from \"../../utils/cx.js\";\nimport {\n\tCheckmarkCircle,\n\tExclamationTriangle,\n\tXmark,\n\tXmarkCircle,\n} from \"../Icon/icons/index.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Spinner } from \"../Spinner/Spinner.js\";\nimport { toast, toastDismiss, toastIcon, toastMessage } from \"./Toast.css.js\";\n\nexport type ToastStatus =\n\t| \"success\"\n\t| \"warning\"\n\t| \"error\"\n\t| \"custom\"\n\t| \"loading\";\n\nconst STATUS_ICON = {\n\tsuccess: CheckmarkCircle,\n\twarning: ExclamationTriangle,\n\terror: XmarkCircle,\n} as const;\n\nexport interface ToastProps {\n\t/**\n\t * The outcome being reported — selects the leading glyph and its colour. Bind\n\t * it to the result of the action, not the UI. `custom` takes the glyph from\n\t * `icon`; `loading` shows a spinner and refuses a dismiss control.\n\t */\n\tstatus?: ToastStatus;\n\t/** The glyph for `status=\"custom\"`. Ignored for every other status. */\n\ticon?: ReactNode;\n\t/**\n\t * Renders a trailing dismiss button and runs this when the user presses it.\n\t * Ignored while `status=\"loading\"`, whose lifetime belongs to whatever raised\n\t * it rather than to the reader.\n\t */\n\tonDismiss?: (event: PressEvent) => void;\n\t/** Accessible name for the dismiss button. Localize it. */\n\tdismissLabel?: string;\n\t/**\n\t * Takes the press away while the card is on screen only to finish leaving.\n\t * WebKit added `inert` in 15.5, after the iOS 15.4 floor in\n\t * `messaging/vite.browser-targets.mjs`. At that floor, the container's `inert`\n\t * attribute leaves the button tabbable even though its press no longer acts\n\t * on anything. Disabling keeps the card's layout still through the travel,\n\t * which removing the button would not.\n\t */\n\tdismissDisabled?: boolean;\n\t/**\n\t * Attributes for the message element. A container that owns announcement\n\t * passes its live-region props through here, so the dismiss button stays\n\t * outside what gets announced.\n\t */\n\tmessageProps?: HTMLAttributes<HTMLElement>;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\tref?: Ref<HTMLDivElement>;\n\t/** The message to display. Keep it to a single line. */\n\tchildren?: ReactNode;\n}\n\nfunction LeadingGlyph({\n\tstatus,\n\ticon,\n}: {\n\tstatus: ToastStatus;\n\ticon: ReactNode;\n}) {\n\tif (status === \"loading\") {\n\t\t// Spinner carries its own `role=\"status\" aria-label=\"Loading\"`, and the\n\t\t// container already puts a live region on the message. Two of them inside\n\t\t// one alertdialog announces \"Loading\" ahead of the message, so this one is\n\t\t// hidden — the copy is what the reader needs.\n\t\treturn (\n\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t<Spinner size=\"sm\" />\n\t\t\t</span>\n\t\t);\n\t}\n\tif (status === \"custom\") {\n\t\treturn icon;\n\t}\n\tconst StatusIcon = STATUS_ICON[status];\n\treturn <StatusIcon />;\n}\n\n/**\n * The floating surface for a transient event — a card that sits above the\n * transcript on a neutral background, rather than the tinted full-width strip\n * `Banner` paints for a lasting condition. The two differ on purpose:\n * a card reads as passing through, a strip as part of the page.\n *\n * Purely presentational, and carries no live region of its own, so it can sit\n * inside a container that owns the announcement. Rendering it standalone\n * announces nothing — reach for `ToastContainer`.\n */\nexport function Toast({\n\tstatus = \"success\",\n\ticon,\n\tonDismiss,\n\tdismissLabel = \"Dismiss notification\",\n\tdismissDisabled = false,\n\tmessageProps,\n\tclassName,\n\tchildren,\n\t...rest\n}: ToastProps) {\n\t// Loading owns its own lifetime, so it never offers a dismiss control even\n\t// when the consumer passes one.\n\tconst canDismiss = !!onDismiss && status !== \"loading\";\n\t// Decided before the element exists: an element is truthy even when the\n\t// component returns null, so testing the rendered glyph would leave an empty\n\t// slot — and its `gap-8` — indenting the message of an iconless `custom`.\n\tconst hasGlyph = status !== \"custom\" || !!icon;\n\n\treturn (\n\t\t<div {...rest} data-status={status} className={cx(toast, className)}>\n\t\t\t{hasGlyph ? (\n\t\t\t\t<span className={toastIcon({ status })}>\n\t\t\t\t\t<LeadingGlyph status={status} icon={icon} />\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t{/* A div, not a span: a container that owns announcement puts a live\n\t\t\t region here, and React Aria renders that region as a div. */}\n\t\t\t<div\n\t\t\t\t{...messageProps}\n\t\t\t\tclassName={cx(messageProps?.className, toastMessage)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t\t{canDismiss && (\n\t\t\t\t<IconButton\n\t\t\t\t\tlabel={dismissLabel}\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tisDisabled={dismissDisabled}\n\t\t\t\t\tonPress={onDismiss}\n\t\t\t\t\tclassName={toastDismiss}\n\t\t\t\t>\n\t\t\t\t\t<Xmark />\n\t\t\t\t</IconButton>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,IAAc;CACnB,SAAS;CACT,SAAS;CACT,OAAO;AACR;AAyCA,SAAS,EAAa,EACrB,WACA,WAIE;CACF,IAAI,MAAW,WAKd,OACC,kBAAC,QAAD;EAAM,eAAY;YACjB,kBAAC,GAAD,EAAS,MAAK,KAAM,CAAA;CACf,CAAA;CAGR,IAAI,MAAW,UACd,OAAO;CAER,IAAM,IAAa,EAAY;CAC/B,OAAO,kBAAC,GAAD,CAAa,CAAA;AACrB;AAYA,SAAgB,EAAM,EACrB,YAAS,WACT,SACA,cACA,kBAAe,wBACf,qBAAkB,IAClB,iBACA,cACA,aACA,GAAG,KACW;CAGd,IAAM,IAAa,CAAC,CAAC,KAAa,MAAW,WAIvC,IAAW,MAAW,YAAY,CAAC,CAAC;CAE1C,OACC,kBAAC,OAAD;EAAK,GAAI;EAAM,eAAa;EAAQ,WAAW,EAAG,GAAO,CAAS;YAAlE;GACE,IACA,kBAAC,QAAD;IAAM,WAAW,EAAU,EAAE,UAAO,CAAC;cACpC,kBAAC,GAAD;KAAsB;KAAc;IAAO,CAAA;GACtC,CAAA,IACH;GAGJ,kBAAC,OAAD;IACC,GAAI;IACJ,WAAW,EAAG,GAAc,WAAW,CAAY;IAElD;GACG,CAAA;GACJ,KACA,kBAAC,GAAD;IACC,OAAO;IACP,SAAQ;IACR,MAAK;IACL,YAAY;IACZ,SAAS;IACT,WAAA;cAEA,kBAAC,GAAD,CAAQ,CAAA;GACG,CAAA;EAET;;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastContainer.js","names":[],"sources":["../../../src/components/Toast/ToastContainer.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport type { PressEvent } from \"react-aria\";\nimport { UNSAFE_PortalProvider, useFocusVisible } from \"react-aria\";\nimport {\n\tButtonContext,\n\tTextContext,\n\tUNSTABLE_Toast,\n\tUNSTABLE_ToastList,\n\tUNSTABLE_ToastRegion,\n\tuseSlottedContext,\n} from \"react-aria-components\";\nimport type { QueuedToast, ToastQueue } from \"react-stately\";\nimport { useHasOpenOverlay } from \"../../hooks/overlayRegistry.js\";\nimport { useEnterAnimation, useExitAnimation } from \"../../utils/animation.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { toastAnchor, toastCard, toastList, toastRegion } from \"./Toast.css.js\";\nimport { Toast } from \"./Toast.js\";\nimport type { ToastItem } from \"./ToastItem.js\";\n\nexport interface ToastContainerProps {\n\t/** The queue to display. Create one per surface with `new ToastQueue()`. */\n\tqueue: ToastQueue<ToastItem>;\n\t/**\n\t * Keys of the toasts that are leaving. Keep each one on the queue until\n\t * `onExited` reports it, or it unmounts part-way through its travel.\n\t */\n\texiting: ReadonlySet<string>;\n\t/** Runs when a leaving toast finishes its travel and can be closed. */\n\tonExited: (key: string) => void;\n\t/** Runs when the reader presses a toast's dismiss button. */\n\tonDismiss: (key: string) => void;\n\t/**\n\t * Overrides the region's accessible name. Leave it unset: the default is\n\t * already localized and counts the toasts on show (\"2 notifications.\"), which\n\t * is what a screen-reader user hears on navigating here with F6.\n\t */\n\t\"aria-label\"?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\t/** Attaches to the always-mounted anchor, not the region. */\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface ToastCardProps {\n\ttoast: QueuedToast<ToastItem>;\n\tisExiting: boolean;\n\tonExited: (key: string) => void;\n\tonDismiss: (key: string) => void;\n}\n\n/**\n * The card's own dismiss control, named from the one React Aria would have\n * rendered.\n *\n * React Aria hands its close button down through `ButtonContext` under a `close`\n * slot, carrying both the localized name and a press handler that closes the\n * toast outright. `mergeProps` chains `on*` handlers rather than replacing them,\n * so a React Aria button given the container's handler would run both and take\n * the card off the queue before it could travel. Taking the name alone leaves the\n * lifetime with the caller.\n */\nfunction ToastDismiss({\n\tstatus,\n\ticon,\n\tmessage,\n\tisExiting,\n\tonPress,\n}: {\n\tstatus: NonNullable<ToastItem[\"status\"]>;\n\ticon: ToastItem[\"icon\"];\n\tmessage: ToastItem[\"message\"];\n\tisExiting: boolean;\n\tonPress: (event: PressEvent) => void;\n}) {\n\tconst closeButton = useSlottedContext(ButtonContext, \"close\");\n\t// React Aria names the card through `aria-labelledby`, pointing at the id it\n\t// hands down under the `title` slot. Nothing here renders its `Text`, so the\n\t// message has to carry that id or the card has no accessible name at all.\n\tconst title = useSlottedContext(TextContext, \"title\");\n\t// React Aria hides its own content element on the first render and reveals it\n\t// on the next, which is what makes NVDA announce a toast that mounts with its\n\t// text already in place. Those props reach that element through a context the\n\t// package does not export, so the reveal is repeated here.\n\tconst [isRevealed, setIsRevealed] = useState(false);\n\tuseLayoutEffect(() => setIsRevealed(true), []);\n\treturn (\n\t\t<Toast\n\t\t\tstatus={status}\n\t\t\ticon={icon}\n\t\t\tonDismiss={onPress}\n\t\t\t// The card carries `inert` by now, but WebKit added `inert` in 15.5,\n\t\t\t// after the iOS 15.4 floor in `messaging/vite.browser-targets.mjs`. At\n\t\t\t// that floor the button stays tabbable and offers a press that no longer\n\t\t\t// acts on anything, so it has to be disabled in its own right.\n\t\t\tdismissDisabled={isExiting}\n\t\t\tdismissLabel={closeButton?.[\"aria-label\"]}\n\t\t\t// The live region rides the message box itself. React Aria's own\n\t\t\t// `ToastContent` would need `display: contents` to stay out of the card's\n\t\t\t// row, and WebKit drops a box-less element from the accessibility tree\n\t\t\t// until 16, below the floor above, so the announcement would never reach\n\t\t\t// the reader there.\n\t\t\tmessageProps={{\n\t\t\t\tid: title && \"id\" in title ? title.id : undefined,\n\t\t\t\t// React Aria hardcodes `role=\"alert\"` for every toast, which interrupts\n\t\t\t\t// the reader whatever the outcome. The queue is one shared surface, so\n\t\t\t\t// urgency is chosen per card: a failure interrupts, anything else waits\n\t\t\t\t// its turn.\n\t\t\t\trole: status === \"error\" ? \"alert\" : \"status\",\n\t\t\t\t\"aria-live\": status === \"error\" ? \"assertive\" : \"polite\",\n\t\t\t\t\"aria-atomic\": \"true\",\n\t\t\t\t\"aria-hidden\": isRevealed ? undefined : \"true\",\n\t\t\t}}\n\t\t>\n\t\t\t{message}\n\t\t</Toast>\n\t);\n}\n\n/**\n * Where focus goes when the card under it leaves: the next card down the stack,\n * then the one above it, then the region itself. Landing on the region keeps\n * focus inside it, so React Aria still holds the element the reader came from and\n * restores it once the last card has gone.\n */\nfunction nextFocusTarget(element: HTMLElement): HTMLElement | null {\n\tconst region = element.closest<HTMLElement>('[role=\"region\"]');\n\t// React Aria wraps each card in a list item of its own, so the cards are read\n\t// off the region rather than from the element's own parent.\n\tconst cards = [\n\t\t...(region?.querySelectorAll<HTMLElement>(`.${toastCard}`) ?? []),\n\t];\n\tconst index = cards.indexOf(element);\n\tif (index === -1) {\n\t\treturn region;\n\t}\n\tconst settled = (card: HTMLElement) => !card.hasAttribute(\"data-exiting\");\n\t// `toastList` is `column-reverse`, so a higher DOM index sits visually above\n\t// and a lower one below. Take the card below first, nearest first, then walk\n\t// up, so focus lands on the card that rises into the freed row.\n\treturn (\n\t\tcards.slice(0, index).reverse().find(settled) ??\n\t\tcards.slice(index + 1).find(settled) ??\n\t\tregion\n\t);\n}\n\nfunction ToastCard({ toast, isExiting, onExited, onDismiss }: ToastCardProps) {\n\tconst ref = useRef<HTMLDivElement>(null);\n\t// The card rises in from `[data-entering]` and falls back out to\n\t// `[data-exiting]`, both off-screen, with a transition between. A transition\n\t// resumes from the current computed value, so a card dismissed mid-entry\n\t// reverses from wherever it stands. `useExitAnimation` and `useEnterAnimation`\n\t// watch the same transition, the way `BannerContainerSlide` does.\n\tconst isEntering = useEnterAnimation(ref);\n\tconst isLeaving = useExitAnimation(ref, !isExiting);\n\tconst { isFocusVisible } = useFocusVisible();\n\n\tuseEffect(() => {\n\t\tif (isExiting && !isLeaving) {\n\t\t\tonExited(toast.key);\n\t\t}\n\t}, [isExiting, isLeaving, onExited, toast.key]);\n\n\t// `inert` below drops the focus it holds to the document body. React Aria moves\n\t// focus for a toast that leaves the queue, and the card stays on the queue until\n\t// its travel is over, so the reader is handed on from here instead. It runs\n\t// before the effect below, which is what leaves it a card to read focus off.\n\t//\n\t// Only for a reader working the keyboard, though. A dismiss button focuses\n\t// itself under a mouse press in Chrome, so handing that on would park an\n\t// invisible focus on the card left standing, and a consumer that reads focus as\n\t// the reader asking for more time would hold its countdown there for as long as\n\t// the reader left the page alone.\n\tuseLayoutEffect(() => {\n\t\tconst element = ref.current;\n\t\tif (!isExiting || !element || !isFocusVisible) {\n\t\t\treturn;\n\t\t}\n\t\tif (element.contains(document.activeElement)) {\n\t\t\tnextFocusTarget(element)?.focus();\n\t\t}\n\t}, [isExiting, isFocusVisible]);\n\n\t// The caller has already let the card go, so it is on screen only to finish its\n\t// travel. `inert` takes it out of the accessibility tree, out of the tab order\n\t// and away from the pointer in one attribute. WebKit added `inert` in 15.5, and\n\t// the floor in `messaging/vite.browser-targets.mjs` is 15.4, so `role` and\n\t// `tabIndex` come off the element as well. React Aria pins both through props,\n\t// and a card never comes back from leaving, so nothing puts them back.\n\tuseLayoutEffect(() => {\n\t\tconst element = ref.current;\n\t\tif (!isExiting || !element) {\n\t\t\treturn;\n\t\t}\n\t\telement.setAttribute(\"inert\", \"\");\n\t\t// At the 15.4 floor `inert` does nothing, so the card would keep announcing\n\t\t// and stay in the reader's tree for the whole of its travel.\n\t\telement.setAttribute(\"aria-hidden\", \"true\");\n\t\telement.tabIndex = -1;\n\t\telement.removeAttribute(\"role\");\n\t}, [isExiting]);\n\n\tconst { status = \"success\", message, icon } = toast.content;\n\n\treturn (\n\t\t<UNSTABLE_Toast\n\t\t\ttoast={toast}\n\t\t\tref={ref}\n\t\t\tclassName={toastCard}\n\t\t\tdata-entering={isEntering || undefined}\n\t\t\tdata-exiting={isExiting || undefined}\n\t\t>\n\t\t\t<ToastDismiss\n\t\t\t\tstatus={status}\n\t\t\t\ticon={icon}\n\t\t\t\tmessage={message}\n\t\t\t\tisExiting={isExiting}\n\t\t\t\tonPress={(event) => {\n\t\t\t\t\t// The exit re-render disables this button, and a native disabled\n\t\t\t\t\t// button drops its focus to the document body in the same commit,\n\t\t\t\t\t// before the layout effect below can read focus off the card. Hand a\n\t\t\t\t\t// keyboard reader on here, while the button still holds focus.\n\t\t\t\t\tif (event.pointerType === \"keyboard\") {\n\t\t\t\t\t\tconst element = ref.current;\n\t\t\t\t\t\tif (element?.contains(document.activeElement)) {\n\t\t\t\t\t\t\tnextFocusTarget(element)?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tonDismiss(toast.key);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</UNSTABLE_Toast>\n\t);\n}\n\n/**\n * Displays the toasts on a queue as a labelled landmark region.\n *\n * The container owns announcement, the card surface and the motion. It does not\n * own the clock: the caller decides which toasts exist, when each one leaves, and\n * what a dismiss press means. Mark a toast in `exiting` to start its travel, and\n * take it off the queue when `onExited` reports it.\n *\n * No region renders while the queue is empty, so it does not sit in the\n * accessibility tree between notifications. The anchor it renders into stays\n * mounted regardless, carrying `data-react-aria-top-layer`: React Aria reads that\n * attribute to decide what an open overlay hides, what a press outside an overlay\n * counts as, and what a focus scope lets go. An anchor that came and went with the\n * toasts would leave the consumer's chrome hidden, and a toast raised afterwards\n * would mount inside that hidden subtree and never be announced.\n *\n * That exemption is why no region renders while a modal overlay is open. The\n * region is anchored in the consumer's chrome, which the overlay paints over and\n * seals off from the pointer, so a toast there would be announced and F6-reachable\n * with a dismiss control nobody could press.\n */\nexport function ToastContainer({\n\tqueue,\n\texiting,\n\tonExited,\n\tonDismiss,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n}: ToastContainerProps) {\n\tconst [anchor, setAnchor] = useState<HTMLDivElement | null>(null);\n\tconst hasOpenOverlay = useHasOpenOverlay();\n\n\tconst attachAnchor = useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\tsetAnchor(node);\n\t\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(node);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = node;\n\t\t\t}\n\t\t},\n\t\t[ref],\n\t);\n\n\t// React Aria's region portals itself through whatever `UNSAFE_PortalProvider`\n\t// it finds, and a consumer that scopes one to its app root would take the\n\t// toasts out of this container entirely. Pointing a nested provider at the\n\t// anchor keeps them where the consumer placed them.\n\tconst getContainer = useCallback(() => anchor ?? document.body, [anchor]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-react-aria-top-layer=\"true\"\n\t\t\tref={attachAnchor}\n\t\t\tclassName={cx(toastAnchor, className)}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t{anchor && !hasOpenOverlay && (\n\t\t\t\t<UNSAFE_PortalProvider getContainer={getContainer}>\n\t\t\t\t\t<UNSTABLE_ToastRegion\n\t\t\t\t\t\tqueue={queue}\n\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\tclassName={toastRegion}\n\t\t\t\t\t>\n\t\t\t\t\t\t<UNSTABLE_ToastList<ToastItem> className={toastList}>\n\t\t\t\t\t\t\t{({ toast }) => (\n\t\t\t\t\t\t\t\t<ToastCard\n\t\t\t\t\t\t\t\t\ttoast={toast}\n\t\t\t\t\t\t\t\t\tisExiting={exiting.has(toast.key)}\n\t\t\t\t\t\t\t\t\tonExited={onExited}\n\t\t\t\t\t\t\t\t\tonDismiss={onDismiss}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</UNSTABLE_ToastList>\n\t\t\t\t\t</UNSTABLE_ToastRegion>\n\t\t\t\t</UNSAFE_PortalProvider>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAoEA,SAAS,EAAa,EACrB,WACA,SACA,YACA,cACA,cAOE;CACF,IAAM,IAAc,EAAkB,GAAe,QAAQ,EAIvD,IAAQ,EAAkB,GAAa,QAAQ,EAK/C,CAAC,GAAY,KAAiB,EAAS,GAAM;AAEnD,QADA,QAAsB,EAAc,GAAK,EAAE,EAAE,CAAC,EAE7C,kBAAC,GAAD;EACS;EACF;EACN,WAAW;EAKX,iBAAiB;EACjB,cAAc,IAAc;EAM5B,cAAc;GACb,IAAI,KAAS,QAAQ,IAAQ,EAAM,KAAK,KAAA;GAKxC,MAAM,MAAW,UAAU,UAAU;GACrC,aAAa,MAAW,UAAU,cAAc;GAChD,eAAe;GACf,eAAe,IAAa,KAAA,IAAY;GACxC;YAEA;EACM,CAAA;;AAUV,SAAS,EAAgB,GAA0C;CAClE,IAAM,IAAS,EAAQ,QAAqB,oBAAkB,EAGxD,IAAQ,CACb,GAAI,GAAQ,iBAA8B,aAAgB,IAAI,EAAE,CAChE,EACK,IAAQ,EAAM,QAAQ,EAAQ;AACpC,KAAI,MAAU,GACb,QAAO;CAER,IAAM,KAAW,MAAsB,CAAC,EAAK,aAAa,eAAe;AAIzE,QACC,EAAM,MAAM,GAAG,EAAM,CAAC,SAAS,CAAC,KAAK,EAAQ,IAC7C,EAAM,MAAM,IAAQ,EAAE,CAAC,KAAK,EAAQ,IACpC;;AAIF,SAAS,EAAU,EAAE,UAAO,cAAW,aAAU,gBAA6B;CAC7E,IAAM,IAAM,EAAuB,KAAK,EAMlC,IAAa,EAAkB,EAAI,EACnC,IAAY,EAAiB,GAAK,CAAC,EAAU,EAC7C,EAAE,sBAAmB,GAAiB;AAkC5C,CAhCA,QAAgB;AACf,EAAI,KAAa,CAAC,KACjB,EAAS,EAAM,IAAI;IAElB;EAAC;EAAW;EAAW;EAAU,EAAM;EAAI,CAAC,EAY/C,QAAsB;EACrB,IAAM,IAAU,EAAI;AAChB,GAAC,KAAa,CAAC,KAAW,CAAC,KAG3B,EAAQ,SAAS,SAAS,cAAc,IAC3C,EAAgB,EAAQ,EAAE,OAAO;IAEhC,CAAC,GAAW,EAAe,CAAC,EAQ/B,QAAsB;EACrB,IAAM,IAAU,EAAI;AAChB,GAAC,KAAa,CAAC,MAGnB,EAAQ,aAAa,SAAS,GAAG,EAGjC,EAAQ,aAAa,eAAe,OAAO,EAC3C,EAAQ,WAAW,IACnB,EAAQ,gBAAgB,OAAO;IAC7B,CAAC,EAAU,CAAC;CAEf,IAAM,EAAE,YAAS,WAAW,YAAS,YAAS,EAAM;AAEpD,QACC,kBAAC,GAAD;EACQ;EACF;EACL,WAAW;EACX,iBAAe,KAAc,KAAA;EAC7B,gBAAc,KAAa,KAAA;YAE3B,kBAAC,GAAD;GACS;GACF;GACG;GACE;GACX,UAAU,MAAU;AAKnB,QAAI,EAAM,gBAAgB,YAAY;KACrC,IAAM,IAAU,EAAI;AACpB,KAAI,GAAS,SAAS,SAAS,cAAc,IAC5C,EAAgB,EAAQ,EAAE,OAAO;;AAGnC,MAAU,EAAM,IAAI;;GAEpB,CAAA;EACc,CAAA;;AAyBnB,SAAgB,EAAe,EAC9B,UACA,YACA,aACA,cACA,cACA,UACA,QACA,cAAc,KACS;CACvB,IAAM,CAAC,GAAQ,KAAa,EAAgC,KAAK,EAC3D,IAAiB,GAAmB,EAEpC,IAAe,GACnB,MAAgC;AAEhC,EADA,EAAU,EAAK,EACX,OAAO,KAAQ,aAClB,EAAI,EAAK,GACC,MACV,EAAI,UAAU;IAGhB,CAAC,EAAI,CACL,EAMK,IAAe,QAAkB,KAAU,SAAS,MAAM,CAAC,EAAO,CAAC;AAEzE,QACC,kBAAC,OAAD;EACC,6BAA0B;EAC1B,KAAK;EACL,WAAW,EAAG,GAAa,EAAU;EAC9B;YAEN,KAAU,CAAC,KACX,kBAAC,GAAD;GAAqC;aACpC,kBAAC,GAAD;IACQ;IACP,cAAY;IACZ,WAAA;cAEA,kBAAC,GAAD;KAA+B,WAAA;gBAC5B,EAAE,eACH,kBAAC,GAAD;MACQ;MACP,WAAW,EAAQ,IAAI,EAAM,IAAI;MACvB;MACC;MACV,CAAA;KAEiB,CAAA;IACC,CAAA;GACA,CAAA;EAEpB,CAAA"}
|
|
1
|
+
{"version":3,"file":"ToastContainer.js","names":[],"sources":["../../../src/components/Toast/ToastContainer.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from \"react\";\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport type { PressEvent } from \"react-aria\";\nimport { UNSAFE_PortalProvider, useFocusVisible } from \"react-aria\";\nimport {\n\tButtonContext,\n\tTextContext,\n\tUNSTABLE_Toast,\n\tUNSTABLE_ToastList,\n\tUNSTABLE_ToastRegion,\n\tuseSlottedContext,\n} from \"react-aria-components\";\nimport type { QueuedToast, ToastQueue } from \"react-stately\";\nimport { useHasOpenOverlay } from \"../../hooks/overlayRegistry.js\";\nimport { useEnterAnimation, useExitAnimation } from \"../../utils/animation.js\";\nimport { cx } from \"../../utils/cx.js\";\nimport { toastAnchor, toastCard, toastList, toastRegion } from \"./Toast.css.js\";\nimport { Toast } from \"./Toast.js\";\nimport type { ToastItem } from \"./ToastItem.js\";\n\nexport interface ToastContainerProps {\n\t/** The queue to display. Create one per surface with `new ToastQueue()`. */\n\tqueue: ToastQueue<ToastItem>;\n\t/**\n\t * Keys of the toasts that are leaving. Keep each one on the queue until\n\t * `onExited` reports it, or it unmounts part-way through its travel.\n\t */\n\texiting: ReadonlySet<string>;\n\t/** Runs when a leaving toast finishes its travel and can be closed. */\n\tonExited: (key: string) => void;\n\t/** Runs when the reader presses a toast's dismiss button. */\n\tonDismiss: (key: string) => void;\n\t/**\n\t * Overrides the region's accessible name. Leave it unset: the default is\n\t * already localized and counts the toasts on show (\"2 notifications.\"), which\n\t * is what a screen-reader user hears on navigating here with F6.\n\t */\n\t\"aria-label\"?: string;\n\tclassName?: string;\n\tstyle?: CSSProperties;\n\t/** Attaches to the always-mounted anchor, not the region. */\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface ToastCardProps {\n\ttoast: QueuedToast<ToastItem>;\n\tisExiting: boolean;\n\tonExited: (key: string) => void;\n\tonDismiss: (key: string) => void;\n}\n\n/**\n * The card's own dismiss control, named from the one React Aria would have\n * rendered.\n *\n * React Aria hands its close button down through `ButtonContext` under a `close`\n * slot, carrying both the localized name and a press handler that closes the\n * toast outright. `mergeProps` chains `on*` handlers rather than replacing them,\n * so a React Aria button given the container's handler would run both and take\n * the card off the queue before it could travel. Taking the name alone leaves the\n * lifetime with the caller.\n */\nfunction ToastDismiss({\n\tstatus,\n\ticon,\n\tmessage,\n\tisExiting,\n\tonPress,\n}: {\n\tstatus: NonNullable<ToastItem[\"status\"]>;\n\ticon: ToastItem[\"icon\"];\n\tmessage: ToastItem[\"message\"];\n\tisExiting: boolean;\n\tonPress: (event: PressEvent) => void;\n}) {\n\tconst closeButton = useSlottedContext(ButtonContext, \"close\");\n\t// React Aria names the card through `aria-labelledby`, pointing at the id it\n\t// hands down under the `title` slot. Nothing here renders its `Text`, so the\n\t// message has to carry that id or the card has no accessible name at all.\n\tconst title = useSlottedContext(TextContext, \"title\");\n\t// React Aria hides its own content element on the first render and reveals it\n\t// on the next, which is what makes NVDA announce a toast that mounts with its\n\t// text already in place. Those props reach that element through a context the\n\t// package does not export, so the reveal is repeated here.\n\tconst [isRevealed, setIsRevealed] = useState(false);\n\tuseLayoutEffect(() => setIsRevealed(true), []);\n\treturn (\n\t\t<Toast\n\t\t\tstatus={status}\n\t\t\ticon={icon}\n\t\t\tonDismiss={onPress}\n\t\t\t// The card carries `inert` by now, but WebKit added `inert` in 15.5,\n\t\t\t// after the iOS 15.4 floor in `messaging/vite.browser-targets.mjs`. At\n\t\t\t// that floor the button stays tabbable and offers a press that no longer\n\t\t\t// acts on anything, so it has to be disabled in its own right.\n\t\t\tdismissDisabled={isExiting}\n\t\t\tdismissLabel={closeButton?.[\"aria-label\"]}\n\t\t\t// The live region rides the message box itself. React Aria's own\n\t\t\t// `ToastContent` would need `display: contents` to stay out of the card's\n\t\t\t// row, and WebKit drops a box-less element from the accessibility tree\n\t\t\t// until 16, below the floor above, so the announcement would never reach\n\t\t\t// the reader there.\n\t\t\tmessageProps={{\n\t\t\t\tid: title && \"id\" in title ? title.id : undefined,\n\t\t\t\t// React Aria hardcodes `role=\"alert\"` for every toast, which interrupts\n\t\t\t\t// the reader whatever the outcome. The queue is one shared surface, so\n\t\t\t\t// urgency is chosen per card: a failure interrupts, anything else waits\n\t\t\t\t// its turn.\n\t\t\t\trole: status === \"error\" ? \"alert\" : \"status\",\n\t\t\t\t\"aria-live\": status === \"error\" ? \"assertive\" : \"polite\",\n\t\t\t\t\"aria-atomic\": \"true\",\n\t\t\t\t\"aria-hidden\": isRevealed ? undefined : \"true\",\n\t\t\t}}\n\t\t>\n\t\t\t{message}\n\t\t</Toast>\n\t);\n}\n\n/**\n * Where focus goes when the card under it leaves: the next card down the stack,\n * then the one above it, then the region itself. Landing on the region keeps\n * focus inside it, so React Aria still holds the element the reader came from and\n * restores it once the last card has gone.\n */\nfunction nextFocusTarget(element: HTMLElement): HTMLElement | null {\n\tconst region = element.closest<HTMLElement>('[role=\"region\"]');\n\t// React Aria wraps each card in a list item of its own, so the cards are read\n\t// off the region rather than from the element's own parent.\n\tconst cards = [\n\t\t...(region?.querySelectorAll<HTMLElement>(`.${toastCard}`) ?? []),\n\t];\n\tconst index = cards.indexOf(element);\n\tif (index === -1) {\n\t\treturn region;\n\t}\n\tconst settled = (card: HTMLElement) => !card.hasAttribute(\"data-exiting\");\n\t// `toastList` is `column-reverse`, so a higher DOM index sits visually above\n\t// and a lower one below. Take the card below first, nearest first, then walk\n\t// up, so focus lands on the card that rises into the freed row.\n\treturn (\n\t\tcards.slice(0, index).reverse().find(settled) ??\n\t\tcards.slice(index + 1).find(settled) ??\n\t\tregion\n\t);\n}\n\nfunction ToastCard({ toast, isExiting, onExited, onDismiss }: ToastCardProps) {\n\tconst ref = useRef<HTMLDivElement>(null);\n\t// The card rises in from `[data-entering]` and falls back out to\n\t// `[data-exiting]`, both off-screen, with a transition between. A transition\n\t// resumes from the current computed value, so a card dismissed mid-entry\n\t// reverses from wherever it stands. `useExitAnimation` and `useEnterAnimation`\n\t// watch the same transition, the way `BannerContainerSlide` does.\n\tconst isEntering = useEnterAnimation(ref);\n\tconst isLeaving = useExitAnimation(ref, !isExiting);\n\tconst { isFocusVisible } = useFocusVisible();\n\n\tuseEffect(() => {\n\t\tif (isExiting && !isLeaving) {\n\t\t\tonExited(toast.key);\n\t\t}\n\t}, [isExiting, isLeaving, onExited, toast.key]);\n\n\t// `inert` below drops the focus it holds to the document body. React Aria moves\n\t// focus for a toast that leaves the queue, and the card stays on the queue until\n\t// its travel is over, so the reader is handed on from here instead. It runs\n\t// before the effect below, which is what leaves it a card to read focus off.\n\t//\n\t// Only for a reader working the keyboard, though. A dismiss button focuses\n\t// itself under a mouse press in Chrome, so handing that on would park an\n\t// invisible focus on the card left standing, and a consumer that reads focus as\n\t// the reader asking for more time would hold its countdown there for as long as\n\t// the reader left the page alone.\n\tuseLayoutEffect(() => {\n\t\tconst element = ref.current;\n\t\tif (!isExiting || !element || !isFocusVisible) {\n\t\t\treturn;\n\t\t}\n\t\tif (element.contains(document.activeElement)) {\n\t\t\tnextFocusTarget(element)?.focus();\n\t\t}\n\t}, [isExiting, isFocusVisible]);\n\n\t// The caller has already let the card go, so it is on screen only to finish its\n\t// travel. `inert` takes it out of the accessibility tree, out of the tab order\n\t// and away from the pointer in one attribute. WebKit added `inert` in 15.5, and\n\t// the floor in `messaging/vite.browser-targets.mjs` is 15.4, so `role` and\n\t// `tabIndex` come off the element as well. React Aria pins both through props,\n\t// and a card never comes back from leaving, so nothing puts them back.\n\tuseLayoutEffect(() => {\n\t\tconst element = ref.current;\n\t\tif (!isExiting || !element) {\n\t\t\treturn;\n\t\t}\n\t\telement.setAttribute(\"inert\", \"\");\n\t\t// At the 15.4 floor `inert` does nothing, so the card would keep announcing\n\t\t// and stay in the reader's tree for the whole of its travel.\n\t\telement.setAttribute(\"aria-hidden\", \"true\");\n\t\telement.tabIndex = -1;\n\t\telement.removeAttribute(\"role\");\n\t}, [isExiting]);\n\n\tconst { status = \"success\", message, icon } = toast.content;\n\n\treturn (\n\t\t<UNSTABLE_Toast\n\t\t\ttoast={toast}\n\t\t\tref={ref}\n\t\t\tclassName={toastCard}\n\t\t\tdata-entering={isEntering || undefined}\n\t\t\tdata-exiting={isExiting || undefined}\n\t\t>\n\t\t\t<ToastDismiss\n\t\t\t\tstatus={status}\n\t\t\t\ticon={icon}\n\t\t\t\tmessage={message}\n\t\t\t\tisExiting={isExiting}\n\t\t\t\tonPress={(event) => {\n\t\t\t\t\t// The exit re-render disables this button, and a native disabled\n\t\t\t\t\t// button drops its focus to the document body in the same commit,\n\t\t\t\t\t// before the layout effect below can read focus off the card. Hand a\n\t\t\t\t\t// keyboard reader on here, while the button still holds focus.\n\t\t\t\t\tif (event.pointerType === \"keyboard\") {\n\t\t\t\t\t\tconst element = ref.current;\n\t\t\t\t\t\tif (element?.contains(document.activeElement)) {\n\t\t\t\t\t\t\tnextFocusTarget(element)?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tonDismiss(toast.key);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</UNSTABLE_Toast>\n\t);\n}\n\n/**\n * Displays the toasts on a queue as a labelled landmark region.\n *\n * The container owns announcement, the card surface and the motion. It does not\n * own the clock: the caller decides which toasts exist, when each one leaves, and\n * what a dismiss press means. Mark a toast in `exiting` to start its travel, and\n * take it off the queue when `onExited` reports it.\n *\n * No region renders while the queue is empty, so it does not sit in the\n * accessibility tree between notifications. The anchor it renders into stays\n * mounted regardless, carrying `data-react-aria-top-layer`: React Aria reads that\n * attribute to decide what an open overlay hides, what a press outside an overlay\n * counts as, and what a focus scope lets go. An anchor that came and went with the\n * toasts would leave the consumer's chrome hidden, and a toast raised afterwards\n * would mount inside that hidden subtree and never be announced.\n *\n * That exemption is why no region renders while a modal overlay is open. The\n * region is anchored in the consumer's chrome, which the overlay paints over and\n * seals off from the pointer, so a toast there would be announced and F6-reachable\n * with a dismiss control nobody could press.\n */\nexport function ToastContainer({\n\tqueue,\n\texiting,\n\tonExited,\n\tonDismiss,\n\tclassName,\n\tstyle,\n\tref,\n\t\"aria-label\": ariaLabel,\n}: ToastContainerProps) {\n\tconst [anchor, setAnchor] = useState<HTMLDivElement | null>(null);\n\tconst hasOpenOverlay = useHasOpenOverlay();\n\n\tconst attachAnchor = useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\tsetAnchor(node);\n\t\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(node);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = node;\n\t\t\t}\n\t\t},\n\t\t[ref],\n\t);\n\n\t// React Aria's region portals itself through whatever `UNSAFE_PortalProvider`\n\t// it finds, and a consumer that scopes one to its app root would take the\n\t// toasts out of this container entirely. Pointing a nested provider at the\n\t// anchor keeps them where the consumer placed them.\n\tconst getContainer = useCallback(() => anchor ?? document.body, [anchor]);\n\n\treturn (\n\t\t<div\n\t\t\tdata-react-aria-top-layer=\"true\"\n\t\t\tref={attachAnchor}\n\t\t\tclassName={cx(toastAnchor, className)}\n\t\t\tstyle={style}\n\t\t>\n\t\t\t{anchor && !hasOpenOverlay && (\n\t\t\t\t<UNSAFE_PortalProvider getContainer={getContainer}>\n\t\t\t\t\t<UNSTABLE_ToastRegion\n\t\t\t\t\t\tqueue={queue}\n\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\tclassName={toastRegion}\n\t\t\t\t\t>\n\t\t\t\t\t\t<UNSTABLE_ToastList<ToastItem> className={toastList}>\n\t\t\t\t\t\t\t{({ toast }) => (\n\t\t\t\t\t\t\t\t<ToastCard\n\t\t\t\t\t\t\t\t\ttoast={toast}\n\t\t\t\t\t\t\t\t\tisExiting={exiting.has(toast.key)}\n\t\t\t\t\t\t\t\t\tonExited={onExited}\n\t\t\t\t\t\t\t\t\tonDismiss={onDismiss}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</UNSTABLE_ToastList>\n\t\t\t\t\t</UNSTABLE_ToastRegion>\n\t\t\t\t</UNSAFE_PortalProvider>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAoEA,SAAS,EAAa,EACrB,WACA,SACA,YACA,cACA,cAOE;CACF,IAAM,IAAc,EAAkB,GAAe,OAAO,GAItD,IAAQ,EAAkB,GAAa,OAAO,GAK9C,CAAC,GAAY,KAAiB,EAAS,EAAK;CAElD,OADA,QAAsB,EAAc,EAAI,GAAG,CAAC,CAAC,GAE5C,kBAAC,GAAD;EACS;EACF;EACN,WAAW;EAKX,iBAAiB;EACjB,cAAc,IAAc;EAM5B,cAAc;GACb,IAAI,KAAS,QAAQ,IAAQ,EAAM,KAAK,KAAA;GAKxC,MAAM,MAAW,UAAU,UAAU;GACrC,aAAa,MAAW,UAAU,cAAc;GAChD,eAAe;GACf,eAAe,IAAa,KAAA,IAAY;EACzC;YAEC;CACK,CAAA;AAET;AAQA,SAAS,EAAgB,GAA0C;CAClE,IAAM,IAAS,EAAQ,QAAqB,mBAAiB,GAGvD,IAAQ,CACb,GAAI,GAAQ,iBAA8B,YAAe,KAAK,CAAC,CAChE,GACM,IAAQ,EAAM,QAAQ,CAAO;CACnC,IAAI,MAAU,IACb,OAAO;CAER,IAAM,KAAW,MAAsB,CAAC,EAAK,aAAa,cAAc;CAIxE,OACC,EAAM,MAAM,GAAG,CAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAO,KAC5C,EAAM,MAAM,IAAQ,CAAC,CAAC,CAAC,KAAK,CAAO,KACnC;AAEF;AAEA,SAAS,EAAU,EAAE,UAAO,cAAW,aAAU,gBAA6B;CAC7E,IAAM,IAAM,EAAuB,IAAI,GAMjC,IAAa,EAAkB,CAAG,GAClC,IAAY,EAAiB,GAAK,CAAC,CAAS,GAC5C,EAAE,sBAAmB,EAAgB;CAkC3C,AAhCA,QAAgB;EACf,AAAI,KAAa,CAAC,KACjB,EAAS,EAAM,GAAG;CAEpB,GAAG;EAAC;EAAW;EAAW;EAAU,EAAM;CAAG,CAAC,GAY9C,QAAsB;EACrB,IAAM,IAAU,EAAI;EAChB,CAAC,KAAa,CAAC,KAAW,CAAC,KAG3B,EAAQ,SAAS,SAAS,aAAa,KAC1C,EAAgB,CAAO,CAAC,EAAE,MAAM;CAElC,GAAG,CAAC,GAAW,CAAc,CAAC,GAQ9B,QAAsB;EACrB,IAAM,IAAU,EAAI;EAChB,CAAC,KAAa,CAAC,MAGnB,EAAQ,aAAa,SAAS,EAAE,GAGhC,EAAQ,aAAa,eAAe,MAAM,GAC1C,EAAQ,WAAW,IACnB,EAAQ,gBAAgB,MAAM;CAC/B,GAAG,CAAC,CAAS,CAAC;CAEd,IAAM,EAAE,YAAS,WAAW,YAAS,YAAS,EAAM;CAEpD,OACC,kBAAC,GAAD;EACQ;EACF;EACL,WAAW;EACX,iBAAe,KAAc,KAAA;EAC7B,gBAAc,KAAa,KAAA;YAE3B,kBAAC,GAAD;GACS;GACF;GACG;GACE;GACX,UAAU,MAAU;IAKnB,IAAI,EAAM,gBAAgB,YAAY;KACrC,IAAM,IAAU,EAAI;KACpB,AAAI,GAAS,SAAS,SAAS,aAAa,KAC3C,EAAgB,CAAO,CAAC,EAAE,MAAM;IAElC;IACA,EAAU,EAAM,GAAG;GACpB;EACA,CAAA;CACc,CAAA;AAElB;AAuBA,SAAgB,EAAe,EAC9B,UACA,YACA,aACA,cACA,cACA,UACA,QACA,cAAc,KACS;CACvB,IAAM,CAAC,GAAQ,KAAa,EAAgC,IAAI,GAC1D,IAAiB,EAAkB,GAEnC,IAAe,GACnB,MAAgC;EAEhC,AADA,EAAU,CAAI,GACV,OAAO,KAAQ,aAClB,EAAI,CAAI,IACE,MACV,EAAI,UAAU;CAEhB,GACA,CAAC,CAAG,CACL,GAMM,IAAe,QAAkB,KAAU,SAAS,MAAM,CAAC,CAAM,CAAC;CAExE,OACC,kBAAC,OAAD;EACC,6BAA0B;EAC1B,KAAK;EACL,WAAW,EAAG,GAAa,CAAS;EAC7B;YAEN,KAAU,CAAC,KACX,kBAAC,GAAD;GAAqC;aACpC,kBAAC,GAAD;IACQ;IACP,cAAY;IACZ,WAAA;cAEA,kBAAC,GAAD;KAA+B,WAAA;gBAC5B,EAAE,eACH,kBAAC,GAAD;MACQ;MACP,WAAW,EAAQ,IAAI,EAAM,GAAG;MACtB;MACC;KACX,CAAA;IAEiB,CAAA;GACC,CAAA;EACA,CAAA;CAEpB,CAAA;AAEP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./Toast.js";
|
|
2
|
-
import "./ToastContainer.js";
|
|
3
|
-
import { ToastQueue as
|
|
4
|
-
export { e as ToastQueue };
|
|
1
|
+
import { Toast as e } from "./Toast.js";
|
|
2
|
+
import { ToastContainer as t } from "./ToastContainer.js";
|
|
3
|
+
import { ToastQueue as n } from "react-stately";
|
|
4
|
+
export { e as Toast, t as ToastContainer, n as ToastQueue };
|