@ada-cx/lovelace 1.16.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/components/BubbleOverlay/BubbleOverlay.d.ts +2 -2
- package/dist/components/BubbleOverlay/BubbleOverlay.js.map +1 -1
- package/dist/components/FullscreenOverlay/FullscreenOverlay.d.ts +2 -2
- package/dist/components/FullscreenOverlay/FullscreenOverlay.js.map +1 -1
- package/dist/components/Icon/icons/ArrowUp.d.ts +2 -0
- package/dist/components/Icon/icons/ArrowUp.js +17 -0
- package/dist/components/Icon/icons/ArrowUp.js.map +1 -0
- package/dist/components/Icon/icons/Send.d.ts +2 -0
- package/dist/components/Icon/icons/Send.js +14 -0
- package/dist/components/Icon/icons/Send.js.map +1 -0
- package/dist/components/Icon/icons/index.d.ts +2 -1
- package/dist/components/Sheet/Sheet.d.ts +6 -0
- package/dist/components/Sheet/Sheet.js +13 -7
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/Sheet/SheetBackButton.d.ts +12 -0
- package/dist/components/Sheet/SheetBackButton.js +22 -0
- package/dist/components/Sheet/SheetBackButton.js.map +1 -0
- package/dist/components/Sheet/SheetCloseButton.d.ts +12 -0
- package/dist/components/Sheet/SheetCloseButton.js +22 -0
- package/dist/components/Sheet/SheetCloseButton.js.map +1 -0
- package/dist/components/Sheet/SheetHeader.d.ts +6 -11
- package/dist/components/Sheet/SheetHeader.js +7 -37
- package/dist/components/Sheet/SheetHeader.js.map +1 -1
- package/dist/components/Sheet/SheetTitle.d.ts +11 -0
- package/dist/components/Sheet/SheetTitle.js +16 -0
- package/dist/components/Sheet/SheetTitle.js.map +1 -0
- package/dist/components/Sheet/index.d.ts +3 -0
- package/dist/components/SheetOverlay/SheetOverlay.d.ts +2 -2
- package/dist/components/SheetOverlay/SheetOverlay.js.map +1 -1
- package/dist/components/SurveyRating/SurveyRating.css.js +7 -0
- package/dist/components/SurveyRating/SurveyRating.css.js.map +1 -0
- package/dist/components/{Survey/SurveyRating → SurveyRating}/SurveyRating.d.ts +1 -1
- package/dist/components/{Survey/SurveyRating → SurveyRating}/SurveyRating.js +4 -4
- package/dist/components/SurveyRating/SurveyRating.js.map +1 -0
- package/dist/components/{Survey/SurveyRating → SurveyRating}/index.d.ts +1 -0
- package/dist/components/SurveySelect/SurveySelect.css.js +7 -0
- package/dist/components/SurveySelect/SurveySelect.css.js.map +1 -0
- package/dist/components/{Survey/SurveySelect → SurveySelect}/SurveySelect.d.ts +1 -1
- package/dist/components/{Survey/SurveySelect → SurveySelect}/SurveySelect.js +3 -3
- package/dist/components/SurveySelect/SurveySelect.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +79 -78
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/components/Icon/icons/SendFill.d.ts +0 -2
- package/dist/components/Icon/icons/SendFill.js +0 -14
- package/dist/components/Icon/icons/SendFill.js.map +0 -1
- package/dist/components/Survey/SurveyRating/SurveyRating.css.js +0 -7
- package/dist/components/Survey/SurveyRating/SurveyRating.css.js.map +0 -1
- package/dist/components/Survey/SurveyRating/SurveyRating.js.map +0 -1
- package/dist/components/Survey/SurveySelect/SurveySelect.css.js +0 -7
- package/dist/components/Survey/SurveySelect/SurveySelect.css.js.map +0 -1
- package/dist/components/Survey/SurveySelect/SurveySelect.js.map +0 -1
- package/dist/components/Survey/index.d.ts +0 -3
- /package/dist/components/{Survey → SurveyRating}/SurveyLabelProps.d.ts +0 -0
- /package/dist/components/{Survey/SurveyRating → SurveyRating}/SurveyRating.css.d.ts +0 -0
- /package/dist/components/{Survey/SurveySelect → SurveySelect}/SurveySelect.css.d.ts +0 -0
- /package/dist/components/{Survey/SurveySelect → SurveySelect}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -98,6 +98,13 @@ The colorimetry behind the mapping is also exported: `contrastRatioBetween`, `is
|
|
|
98
98
|
| `@ada-cx/lovelace/tokens.css` | Token definitions (required stylesheet) |
|
|
99
99
|
| `@ada-cx/lovelace/style.css` | Component styles (required stylesheet) |
|
|
100
100
|
|
|
101
|
+
These four imports are the whole public surface. The package has no per-component subpaths and no supported deep imports into `dist/`. Import every component and hook from the package root.
|
|
102
|
+
|
|
103
|
+
Components compose in one of two shapes:
|
|
104
|
+
|
|
105
|
+
- **Dot-namespaced members** for the parts of one widget: `Dialog.Title`, `Sheet.Header`, `Input.Field`, `MenuItem.Checkbox`, `MessageRow.Content`, `Header.Title`.
|
|
106
|
+
- **Flat sibling components** for a container and its repeated children: `Menu` with `MenuItem`, `RadioGroup` with `Radio`.
|
|
107
|
+
|
|
101
108
|
## Scope of this release
|
|
102
109
|
|
|
103
110
|
- **Primitives only.** This package ships design system primitives: buttons, inputs, chips, dialogs, sheets, survey controls, icons, and similar building blocks. Domain composites from the Ada product, such as the CSAT survey form and the file-upload flow, are not included.
|
|
@@ -6,7 +6,7 @@ export interface BubbleOverlayProps {
|
|
|
6
6
|
onOpenChange: (isOpen: boolean) => void;
|
|
7
7
|
/** Dismiss on outside tap. Escape always cancels (RAC default). Defaults to `true`. */
|
|
8
8
|
isDismissable?: boolean;
|
|
9
|
-
/** Accessible name fallback when the child has no `Sheet.
|
|
9
|
+
/** Accessible name fallback when the child has no `Sheet.Title`. */
|
|
10
10
|
"aria-label"?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
children: ReactNode;
|
|
@@ -18,7 +18,7 @@ export interface BubbleOverlayProps {
|
|
|
18
18
|
* / Escape), matching legacy chat's non-dimming anytime-survey bubble. For a
|
|
19
19
|
* dimming bottom sheet use `SheetOverlay`.
|
|
20
20
|
*
|
|
21
|
-
* Give the dialog an accessible name via a `Sheet.
|
|
21
|
+
* Give the dialog an accessible name via a `Sheet.Title` or the
|
|
22
22
|
* `aria-label` prop.
|
|
23
23
|
*/
|
|
24
24
|
export declare function BubbleOverlay({ isOpen, onOpenChange, isDismissable, "aria-label": ariaLabel, className, children, }: BubbleOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BubbleOverlay.js","names":[],"sources":["../../../src/components/BubbleOverlay/BubbleOverlay.tsx"],"sourcesContent":["import type { 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 { bubbleDialog, bubbleModal, bubbleScrim } from \"./BubbleOverlay.css.js\";\n\nexport interface BubbleOverlayProps {\n\t/** Whether the bubble is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (outside tap, Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on outside tap. Escape always cancels (RAC default). Defaults to `true`. */\n\tisDismissable?: boolean;\n\t/** Accessible name fallback when the child has no `Sheet.
|
|
1
|
+
{"version":3,"file":"BubbleOverlay.js","names":[],"sources":["../../../src/components/BubbleOverlay/BubbleOverlay.tsx"],"sourcesContent":["import type { 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 { bubbleDialog, bubbleModal, bubbleScrim } from \"./BubbleOverlay.css.js\";\n\nexport interface BubbleOverlayProps {\n\t/** Whether the bubble is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (outside tap, Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on outside 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\tclassName?: string;\n\tchildren: ReactNode;\n}\n\n/**\n * Non-dimming, near-bottom popover presentation. A compact card centered\n * horizontally near the bottom edge, with a **transparent** backdrop — the chat\n * behind it stays visible. It is still modal (focus-trap + dismiss on outside tap\n * / Escape), matching legacy chat's non-dimming anytime-survey bubble. For a\n * dimming bottom sheet use `SheetOverlay`.\n *\n * Give the dialog an accessible name via a `Sheet.Title` or the\n * `aria-label` prop.\n */\nexport function BubbleOverlay({\n\tisOpen,\n\tonOpenChange,\n\tisDismissable = true,\n\t\"aria-label\": ariaLabel,\n\tclassName,\n\tchildren,\n}: BubbleOverlayProps) {\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={bubbleScrim}\n\t\t\tdir={direction}\n\t\t>\n\t\t\t<OverlayRegistration />\n\t\t\t<Modal className={bubbleModal}>\n\t\t\t\t<AriaDialog\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\tclassName={cx(bubbleDialog, 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":";;;;;;;AAkCA,SAAgB,EAAc,EAC7B,WACA,iBACA,mBAAgB,IAChB,cAAc,GACd,cACA,eACsB;CAItB,IAAM,EAAE,iBAAc,GAAW;AAEjC,QACC,kBAAC,GAAD;EACS;EACM;EACC;EACf,WAAW;EACX,KAAK;YALN,CAOC,kBAAC,GAAD,EAAuB,CAAA,EACvB,kBAAC,GAAD;GAAO,WAAW;aACjB,kBAAC,GAAD;IACC,cAAY;IACZ,WAAW,EAAG,GAAc,EAAU;IAErC;IACW,CAAA;GACN,CAAA,CACM"}
|
|
@@ -6,7 +6,7 @@ export interface FullscreenOverlayProps {
|
|
|
6
6
|
onOpenChange: (isOpen: boolean) => void;
|
|
7
7
|
/** Dismiss on outside tap. Escape always cancels (RAC default). Defaults to `true`. (The surface fills the window, so there is no scrim to tap.) */
|
|
8
8
|
isDismissable?: boolean;
|
|
9
|
-
/** Accessible name fallback when the child has no `Sheet.
|
|
9
|
+
/** Accessible name fallback when the child has no `Sheet.Title`. */
|
|
10
10
|
"aria-label"?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
children: ReactNode;
|
|
@@ -16,7 +16,7 @@ export interface FullscreenOverlayProps {
|
|
|
16
16
|
* corners, focus-trap, slide-up. Wraps arbitrary children (typically a `Sheet`).
|
|
17
17
|
* For a bottom card use `SheetOverlay`; for a centered dialog `Dialog`.
|
|
18
18
|
*
|
|
19
|
-
* Give the dialog an accessible name via a `Sheet.
|
|
19
|
+
* Give the dialog an accessible name via a `Sheet.Title` or the
|
|
20
20
|
* `aria-label` prop.
|
|
21
21
|
*/
|
|
22
22
|
export declare function FullscreenOverlay({ isOpen, onOpenChange, isDismissable, "aria-label": ariaLabel, className, children, }: FullscreenOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenOverlay.js","names":[],"sources":["../../../src/components/FullscreenOverlay/FullscreenOverlay.tsx"],"sourcesContent":["import type { 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 {\n\tfullscreenDialog,\n\tfullscreenModal,\n\tfullscreenScrim,\n} from \"./FullscreenOverlay.css.js\";\n\nexport interface FullscreenOverlayProps {\n\t/** Whether the overlay is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on outside tap. Escape always cancels (RAC default). Defaults to `true`. (The surface fills the window, so there is no scrim to tap.) */\n\tisDismissable?: boolean;\n\t/** Accessible name fallback when the child has no `Sheet.
|
|
1
|
+
{"version":3,"file":"FullscreenOverlay.js","names":[],"sources":["../../../src/components/FullscreenOverlay/FullscreenOverlay.tsx"],"sourcesContent":["import type { 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 {\n\tfullscreenDialog,\n\tfullscreenModal,\n\tfullscreenScrim,\n} from \"./FullscreenOverlay.css.js\";\n\nexport interface FullscreenOverlayProps {\n\t/** Whether the overlay is open. */\n\tisOpen: boolean;\n\t/** Called with the next open state on dismiss (Escape) or programmatic close. */\n\tonOpenChange: (isOpen: boolean) => void;\n\t/** Dismiss on outside tap. Escape always cancels (RAC default). Defaults to `true`. (The surface fills the window, so there is no scrim to tap.) */\n\tisDismissable?: boolean;\n\t/** Accessible name fallback when the child has no `Sheet.Title`. */\n\t\"aria-label\"?: string;\n\tclassName?: string;\n\tchildren: ReactNode;\n}\n\n/**\n * Modal presentation that fills the whole chat window — no size cap, no rounded\n * corners, focus-trap, slide-up. Wraps arbitrary children (typically a `Sheet`).\n * For a bottom card use `SheetOverlay`; for a centered dialog `Dialog`.\n *\n * Give the dialog an accessible name via a `Sheet.Title` or the\n * `aria-label` prop.\n */\nexport function FullscreenOverlay({\n\tisOpen,\n\tonOpenChange,\n\tisDismissable = true,\n\t\"aria-label\": ariaLabel,\n\tclassName,\n\tchildren,\n}: FullscreenOverlayProps) {\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={fullscreenScrim}\n\t\t\tdir={direction}\n\t\t>\n\t\t\t<OverlayRegistration />\n\t\t\t<Modal className={fullscreenModal}>\n\t\t\t\t<AriaDialog\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\tclassName={cx(fullscreenDialog, 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":";;;;;;;AAoCA,SAAgB,EAAkB,EACjC,WACA,iBACA,mBAAgB,IAChB,cAAc,GACd,cACA,eAC0B;CAI1B,IAAM,EAAE,iBAAc,GAAW;AAEjC,QACC,kBAAC,GAAD;EACS;EACM;EACC;EACf,WAAW;EACX,KAAK;YALN,CAOC,kBAAC,GAAD,EAAuB,CAAA,EACvB,kBAAC,GAAD;GAAO,WAAW;aACjB,kBAAC,GAAD;IACC,cAAY;IACZ,WAAW,EAAG,GAAkB,EAAU;IAEzC;IACW,CAAA;GACN,CAAA,CACM"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Icon as e } from "../Icon.js";
|
|
2
|
+
import { Glyph as t } from "./Glyph.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Icon/icons/ArrowUp.tsx
|
|
5
|
+
function r(r) {
|
|
6
|
+
return /* @__PURE__ */ n(e, {
|
|
7
|
+
...r,
|
|
8
|
+
children: /* @__PURE__ */ n(t, { children: /* @__PURE__ */ n("g", {
|
|
9
|
+
transform: "translate(-10 -6)",
|
|
10
|
+
children: /* @__PURE__ */ n("path", { d: "M14.3941 18.9468C14.5179 19.0718 14.6653 19.171 14.8276 19.2387C14.99 19.3063 15.1641 19.3412 15.34 19.3412C15.5158 19.3412 15.69 19.3063 15.8523 19.2387C16.0147 19.171 16.162 19.0718 16.2858 18.9468L20.6689 14.5469L20.6689 24.6667C20.6689 25.0203 20.8093 25.3594 21.0591 25.6095C21.3089 25.8595 21.6478 26 22.0011 26C22.3545 26 22.6933 25.8595 22.9432 25.6095C23.193 25.3594 23.3334 25.0203 23.3334 24.6667L23.3334 14.5469L27.7164 18.9468C27.9673 19.1979 28.3075 19.3389 28.6623 19.3389C29.0171 19.3389 29.3573 19.1979 29.6082 18.9468C29.8591 18.6957 30 18.3552 30 18.0002C30 17.6451 29.8591 17.3046 29.6082 17.0535L22.947 10.387C22.8203 10.2656 22.6709 10.1704 22.5074 10.107C22.3479 10.0364 22.1755 10 22.0011 10C21.8268 10 21.6544 10.0364 21.4949 10.107C21.3314 10.1704 21.182 10.2656 21.0552 10.387L14.3941 17.0535C14.2692 17.1775 14.1701 17.3249 14.1025 17.4874C14.0348 17.6499 14 17.8241 14 18.0002C14 18.1762 14.0348 18.3504 14.1025 18.5129C14.1701 18.6754 14.2692 18.8229 14.3941 18.9468Z" })
|
|
11
|
+
}) })
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as ArrowUp };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=ArrowUp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowUp.js","names":[],"sources":["../../../../src/components/Icon/icons/ArrowUp.tsx"],"sourcesContent":["import type { IconProps } from \"../Icon.js\";\nimport { Icon } from \"../Icon.js\";\nimport { Glyph } from \"./Glyph.js\";\n\nexport function ArrowUp(props: Omit<IconProps, \"children\">) {\n\treturn (\n\t\t<Icon {...props}>\n\t\t\t<Glyph>\n\t\t\t\t{/* Figma symbol carries a drop-shadow filter that offsets the export; recenter\n\t\t\t\t the 16-unit glyph (bbox x[14,30] y[10,26]) within the 24×24 artboard. */}\n\t\t\t\t<g transform=\"translate(-10 -6)\">\n\t\t\t\t\t<path d=\"M14.3941 18.9468C14.5179 19.0718 14.6653 19.171 14.8276 19.2387C14.99 19.3063 15.1641 19.3412 15.34 19.3412C15.5158 19.3412 15.69 19.3063 15.8523 19.2387C16.0147 19.171 16.162 19.0718 16.2858 18.9468L20.6689 14.5469L20.6689 24.6667C20.6689 25.0203 20.8093 25.3594 21.0591 25.6095C21.3089 25.8595 21.6478 26 22.0011 26C22.3545 26 22.6933 25.8595 22.9432 25.6095C23.193 25.3594 23.3334 25.0203 23.3334 24.6667L23.3334 14.5469L27.7164 18.9468C27.9673 19.1979 28.3075 19.3389 28.6623 19.3389C29.0171 19.3389 29.3573 19.1979 29.6082 18.9468C29.8591 18.6957 30 18.3552 30 18.0002C30 17.6451 29.8591 17.3046 29.6082 17.0535L22.947 10.387C22.8203 10.2656 22.6709 10.1704 22.5074 10.107C22.3479 10.0364 22.1755 10 22.0011 10C21.8268 10 21.6544 10.0364 21.4949 10.107C21.3314 10.1704 21.182 10.2656 21.0552 10.387L14.3941 17.0535C14.2692 17.1775 14.1701 17.3249 14.1025 17.4874C14.0348 17.6499 14 17.8241 14 18.0002C14 18.1762 14.0348 18.3504 14.1025 18.5129C14.1701 18.6754 14.2692 18.8229 14.3941 18.9468Z\" />\n\t\t\t\t</g>\n\t\t\t</Glyph>\n\t\t</Icon>\n\t);\n}\n"],"mappings":";;;;AAIA,SAAgB,EAAQ,GAAoC;AAC3D,QACC,kBAAC,GAAD;EAAM,GAAI;YACT,kBAAC,GAAD,EAAA,UAGC,kBAAC,KAAD;GAAG,WAAU;aACZ,kBAAC,QAAD,EAAM,GAAE,y+BAA0+B,CAAA;GAC/+B,CAAA,EACG,CAAA;EACF,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Icon as e } from "../Icon.js";
|
|
2
|
+
import { Glyph as t } from "./Glyph.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Icon/icons/Send.tsx
|
|
5
|
+
function r(r) {
|
|
6
|
+
return /* @__PURE__ */ n(e, {
|
|
7
|
+
...r,
|
|
8
|
+
children: /* @__PURE__ */ n(t, { children: /* @__PURE__ */ n("path", { d: "M16.24 12.64C15.76 13.12 15.04 13.12 14.56 12.64L13 11.08V15.4C13 16.12 12.52 16.6 11.8 16.6C11.08 16.6 10.6 16.12 10.6 15.4V11.08L9.04 12.64C8.56 13.12 7.84 13.12 7.36 12.64C6.88 12.16 6.88 11.44 7.36 10.96L10.96 7.36C11.44 6.88 12.16 6.88 12.64 7.36L14.44 9.16L16.24 10.96C16.72 11.44 16.72 12.16 16.24 12.64Z" }) })
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as Send };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Send.js","names":[],"sources":["../../../../src/components/Icon/icons/Send.tsx"],"sourcesContent":["import type { IconProps } from \"../Icon.js\";\nimport { Icon } from \"../Icon.js\";\nimport { Glyph } from \"./Glyph.js\";\n\nexport function Send(props: Omit<IconProps, \"children\">) {\n\treturn (\n\t\t<Icon {...props}>\n\t\t\t<Glyph>\n\t\t\t\t<path d=\"M16.24 12.64C15.76 13.12 15.04 13.12 14.56 12.64L13 11.08V15.4C13 16.12 12.52 16.6 11.8 16.6C11.08 16.6 10.6 16.12 10.6 15.4V11.08L9.04 12.64C8.56 13.12 7.84 13.12 7.36 12.64C6.88 12.16 6.88 11.44 7.36 10.96L10.96 7.36C11.44 6.88 12.16 6.88 12.64 7.36L14.44 9.16L16.24 10.96C16.72 11.44 16.72 12.16 16.24 12.64Z\" />\n\t\t\t</Glyph>\n\t\t</Icon>\n\t);\n}\n"],"mappings":";;;;AAIA,SAAgB,EAAK,GAAoC;AACxD,QACC,kBAAC,GAAD;EAAM,GAAI;YACT,kBAAC,GAAD,EAAA,UACC,kBAAC,QAAD,EAAM,GAAE,2TAA4T,CAAA,EAC7T,CAAA;EACF,CAAA"}
|
|
@@ -4,6 +4,7 @@ export { ArrowLeft } from "./ArrowLeft.js";
|
|
|
4
4
|
export { ArrowNortheast } from "./ArrowNortheast.js";
|
|
5
5
|
export { ArrowNorthwest } from "./ArrowNorthwest.js";
|
|
6
6
|
export { ArrowRight } from "./ArrowRight.js";
|
|
7
|
+
export { ArrowUp } from "./ArrowUp.js";
|
|
7
8
|
export { Bell } from "./Bell.js";
|
|
8
9
|
export { BellSlash } from "./BellSlash.js";
|
|
9
10
|
export { Checkmark } from "./Checkmark.js";
|
|
@@ -27,7 +28,7 @@ export { Mute } from "./Mute.js";
|
|
|
27
28
|
export { Paperclip } from "./Paperclip.js";
|
|
28
29
|
export { PersonFill } from "./PersonFill.js";
|
|
29
30
|
export { PlayFill } from "./PlayFill.js";
|
|
30
|
-
export {
|
|
31
|
+
export { Send } from "./Send.js";
|
|
31
32
|
export { StarBadgeFill } from "./StarBadgeFill.js";
|
|
32
33
|
export { ThumbsDown } from "./ThumbsDown.js";
|
|
33
34
|
export { ThumbsUp } from "./ThumbsUp.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { SheetActions } from "./SheetActions.js";
|
|
2
|
+
import { SheetBackButton } from "./SheetBackButton.js";
|
|
2
3
|
import { SheetBody } from "./SheetBody.js";
|
|
4
|
+
import { SheetCloseButton } from "./SheetCloseButton.js";
|
|
3
5
|
import { SheetHeader } from "./SheetHeader.js";
|
|
4
6
|
import { SheetRoot } from "./SheetRoot.js";
|
|
7
|
+
import { SheetTitle } from "./SheetTitle.js";
|
|
5
8
|
export type { SheetProps } from "./SheetRoot.js";
|
|
6
9
|
/**
|
|
7
10
|
* Bare bottom-sheet content surface. Renders inline as-is; wrap it in
|
|
@@ -9,6 +12,9 @@ export type { SheetProps } from "./SheetRoot.js";
|
|
|
9
12
|
*/
|
|
10
13
|
export declare const Sheet: typeof SheetRoot & {
|
|
11
14
|
Header: typeof SheetHeader;
|
|
15
|
+
Title: typeof SheetTitle;
|
|
16
|
+
BackButton: typeof SheetBackButton;
|
|
17
|
+
CloseButton: typeof SheetCloseButton;
|
|
12
18
|
Body: typeof SheetBody;
|
|
13
19
|
Actions: typeof SheetActions;
|
|
14
20
|
};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { SheetActions as e } from "./SheetActions.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { SheetBackButton as t } from "./SheetBackButton.js";
|
|
3
|
+
import { SheetBody as n } from "./SheetBody.js";
|
|
4
|
+
import { SheetCloseButton as r } from "./SheetCloseButton.js";
|
|
5
|
+
import { SheetHeader as i } from "./SheetHeader.js";
|
|
6
|
+
import { SheetRoot as a } from "./SheetRoot.js";
|
|
7
|
+
import { SheetTitle as o } from "./SheetTitle.js";
|
|
5
8
|
//#region src/components/Sheet/Sheet.tsx
|
|
6
|
-
var
|
|
7
|
-
Header:
|
|
8
|
-
|
|
9
|
+
var s = Object.assign(a, {
|
|
10
|
+
Header: i,
|
|
11
|
+
Title: o,
|
|
12
|
+
BackButton: t,
|
|
13
|
+
CloseButton: r,
|
|
14
|
+
Body: n,
|
|
9
15
|
Actions: e
|
|
10
16
|
});
|
|
11
17
|
//#endregion
|
|
12
|
-
export {
|
|
18
|
+
export { s as Sheet };
|
|
13
19
|
|
|
14
20
|
//# sourceMappingURL=Sheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.js","names":[],"sources":["../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import { SheetActions } from \"./SheetActions.js\";\nimport { SheetBody } from \"./SheetBody.js\";\nimport { SheetHeader } from \"./SheetHeader.js\";\nimport { SheetRoot } from \"./SheetRoot.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\tBody: SheetBody,\n\tActions: SheetActions,\n});\n"],"mappings":"
|
|
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;CACT,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SheetBackButtonProps {
|
|
2
|
+
onPress: () => void;
|
|
3
|
+
/** Accessible name for the icon-only control. Defaults to "Back". */
|
|
4
|
+
label?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Start-pinned back affordance for `Sheet.Header`. Presets the tertiary `sm`
|
|
9
|
+
* `ArrowLeft` `IconButton` so every sheet's back control is identical; the chevron
|
|
10
|
+
* mirrors under RTL. Absolute-pinned via its wrapper so the title stays centered.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SheetBackButton({ onPress, label, className, }: SheetBackButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { ArrowLeft as t } from "../Icon/icons/ArrowLeft.js";
|
|
3
|
+
import { IconButton as n } from "../IconButton/IconButton.js";
|
|
4
|
+
import { sheetBackIcon as r, sheetHeaderStart as i } from "./Sheet.css.js";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Sheet/SheetBackButton.tsx
|
|
7
|
+
function o({ onPress: o, label: s = "Back", className: c }) {
|
|
8
|
+
return /* @__PURE__ */ a("span", {
|
|
9
|
+
className: e(i, c),
|
|
10
|
+
children: /* @__PURE__ */ a(n, {
|
|
11
|
+
label: s,
|
|
12
|
+
variant: "tertiary",
|
|
13
|
+
size: "sm",
|
|
14
|
+
onPress: o,
|
|
15
|
+
children: /* @__PURE__ */ a(t, { className: r })
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { o as SheetBackButton };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=SheetBackButton.js.map
|
|
@@ -0,0 +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;AACxB,QACC,kBAAC,QAAD;EAAM,WAAW,EAAG,GAAkB,EAAU;YAC/C,kBAAC,GAAD;GAAmB;GAAO,SAAQ;GAAW,MAAK;GAAc;aAC/D,kBAAC,GAAD,EAAW,WAAW,GAAiB,CAAA;GAC3B,CAAA;EACP,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SheetCloseButtonProps {
|
|
2
|
+
onPress: () => void;
|
|
3
|
+
/** Accessible name for the icon-only control. Defaults to "Close". */
|
|
4
|
+
label?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* End-pinned close affordance for `Sheet.Header`. Presets the tertiary `sm`
|
|
9
|
+
* `Xmark` `IconButton` so every sheet's close control is identical. Absolute-pinned
|
|
10
|
+
* via its wrapper so the title stays centered.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SheetCloseButton({ onPress, label, className, }: SheetCloseButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { Xmark as t } from "../Icon/icons/Xmark.js";
|
|
3
|
+
import { IconButton as n } from "../IconButton/IconButton.js";
|
|
4
|
+
import { sheetHeaderEnd as r } from "./Sheet.css.js";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Sheet/SheetCloseButton.tsx
|
|
7
|
+
function a({ onPress: a, label: o = "Close", className: s }) {
|
|
8
|
+
return /* @__PURE__ */ i("span", {
|
|
9
|
+
className: e(r, s),
|
|
10
|
+
children: /* @__PURE__ */ i(n, {
|
|
11
|
+
label: o,
|
|
12
|
+
variant: "tertiary",
|
|
13
|
+
size: "sm",
|
|
14
|
+
onPress: a,
|
|
15
|
+
children: /* @__PURE__ */ i(t, {})
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as SheetCloseButton };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=SheetCloseButton.js.map
|
|
@@ -0,0 +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;AACzB,QACC,kBAAC,QAAD;EAAM,WAAW,EAAG,GAAgB,EAAU;YAC7C,kBAAC,GAAD;GAAmB;GAAO,SAAQ;GAAW,MAAK;GAAc;aAC/D,kBAAC,GAAD,EAAS,CAAA;GACG,CAAA;EACP,CAAA"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
export interface SheetHeaderProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Compose `Sheet.BackButton`, `Sheet.Title`, and `Sheet.CloseButton`. The
|
|
5
|
+
* buttons pin to the edges and the title stays centered, so their visual
|
|
6
|
+
* position is fixed. Focus and reading order still follow the DOM, so author
|
|
7
|
+
* the children in the order `BackButton` → `Title` → `CloseButton`.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
children?: ReactNode;
|
|
9
10
|
className?: string;
|
|
10
|
-
showBack?: boolean;
|
|
11
|
-
onBack?: () => void;
|
|
12
|
-
backLabel?: string;
|
|
13
|
-
showClose?: boolean;
|
|
14
|
-
onClose?: () => void;
|
|
15
|
-
closeLabel?: string;
|
|
16
11
|
}
|
|
17
|
-
export declare function SheetHeader({
|
|
12
|
+
export declare function SheetHeader({ children, className }: SheetHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,44 +1,14 @@
|
|
|
1
1
|
import { cx as e } from "../../utils/cx.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IconButton as r } from "../IconButton/IconButton.js";
|
|
5
|
-
import { sheetBackIcon as i, sheetHeader as a, sheetHeaderEnd as o, sheetHeaderStart as s, sheetHeaderTitle as c } from "./Sheet.css.js";
|
|
6
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
-
import { Heading as d } from "react-aria-components";
|
|
2
|
+
import { sheetHeader as t } from "./Sheet.css.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
8
4
|
//#region src/components/Sheet/SheetHeader.tsx
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
className: e(
|
|
12
|
-
children:
|
|
13
|
-
m.showBack && m.onBack ? /* @__PURE__ */ l("span", {
|
|
14
|
-
className: s,
|
|
15
|
-
children: /* @__PURE__ */ l(r, {
|
|
16
|
-
label: m.backLabel ?? "Back",
|
|
17
|
-
variant: "tertiary",
|
|
18
|
-
size: "sm",
|
|
19
|
-
onPress: m.onBack,
|
|
20
|
-
children: /* @__PURE__ */ l(t, { className: i })
|
|
21
|
-
})
|
|
22
|
-
}) : null,
|
|
23
|
-
f != null && f !== "" ? /* @__PURE__ */ l(d, {
|
|
24
|
-
slot: "title",
|
|
25
|
-
className: c,
|
|
26
|
-
children: f
|
|
27
|
-
}) : null,
|
|
28
|
-
m.showClose && m.onClose ? /* @__PURE__ */ l("span", {
|
|
29
|
-
className: o,
|
|
30
|
-
children: /* @__PURE__ */ l(r, {
|
|
31
|
-
label: m.closeLabel ?? "Close",
|
|
32
|
-
variant: "tertiary",
|
|
33
|
-
size: "sm",
|
|
34
|
-
onPress: m.onClose,
|
|
35
|
-
children: /* @__PURE__ */ l(n, {})
|
|
36
|
-
})
|
|
37
|
-
}) : null
|
|
38
|
-
]
|
|
5
|
+
function r({ children: r, className: i }) {
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
className: e(t, i),
|
|
8
|
+
children: r
|
|
39
9
|
});
|
|
40
10
|
}
|
|
41
11
|
//#endregion
|
|
42
|
-
export {
|
|
12
|
+
export { r as SheetHeader };
|
|
43
13
|
|
|
44
14
|
//# sourceMappingURL=SheetHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetHeader.js","names":[],"sources":["../../../src/components/Sheet/SheetHeader.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {
|
|
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;AACtE,QAAO,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAa,EAAU;EAAG;EAAe,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface SheetTitleProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Centered header title. Renders `slot="title"` so the enclosing `SheetOverlay`
|
|
8
|
+
* derives the dialog's accessible name. Omit it for a title-less sheet and give
|
|
9
|
+
* `SheetOverlay` an `aria-label` instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SheetTitle({ children, className }: SheetTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { sheetHeaderTitle as t } from "./Sheet.css.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { Heading as r } from "react-aria-components";
|
|
5
|
+
//#region src/components/Sheet/SheetTitle.tsx
|
|
6
|
+
function i({ children: i, className: a }) {
|
|
7
|
+
return /* @__PURE__ */ n(r, {
|
|
8
|
+
slot: "title",
|
|
9
|
+
className: e(t, a),
|
|
10
|
+
children: i
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as SheetTitle };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=SheetTitle.js.map
|
|
@@ -0,0 +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;AACpE,QACC,kBAAC,GAAD;EAAS,MAAK;EAAQ,WAAW,EAAG,GAAkB,EAAU;EAC9D;EACQ,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { Sheet, type SheetProps } from "./Sheet.js";
|
|
2
2
|
export type { SheetActionsProps } from "./SheetActions.js";
|
|
3
|
+
export type { SheetBackButtonProps } from "./SheetBackButton.js";
|
|
3
4
|
export type { SheetBodyProps } from "./SheetBody.js";
|
|
5
|
+
export type { SheetCloseButtonProps } from "./SheetCloseButton.js";
|
|
4
6
|
export type { SheetHeaderProps } from "./SheetHeader.js";
|
|
7
|
+
export type { SheetTitleProps } from "./SheetTitle.js";
|
|
@@ -6,7 +6,7 @@ export interface SheetOverlayProps {
|
|
|
6
6
|
onOpenChange: (isOpen: boolean) => void;
|
|
7
7
|
/** Dismiss on scrim tap. Escape always cancels (RAC default). Defaults to `true`. */
|
|
8
8
|
isDismissable?: boolean;
|
|
9
|
-
/** Accessible name fallback when the child has no `Sheet.
|
|
9
|
+
/** Accessible name fallback when the child has no `Sheet.Title`. */
|
|
10
10
|
"aria-label"?: string;
|
|
11
11
|
/** Id of the element describing the sheet, typically a `Sheet.Body`. */
|
|
12
12
|
"aria-describedby"?: string;
|
|
@@ -19,7 +19,7 @@ export interface SheetOverlayProps {
|
|
|
19
19
|
* (typically a `Sheet`). For a full-window surface use `FullscreenOverlay`; for a
|
|
20
20
|
* centered dialog `Dialog`; for a non-dimming bottom bubble `BubbleOverlay`.
|
|
21
21
|
*
|
|
22
|
-
* Give the dialog an accessible name via either a `Sheet.
|
|
22
|
+
* Give the dialog an accessible name via either a `Sheet.Title` or the
|
|
23
23
|
* `aria-label` prop — with neither (e.g. an actions-only Confirm sheet) RAC
|
|
24
24
|
* emits a missing-name warning.
|
|
25
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetOverlay.js","names":[],"sources":["../../../src/components/SheetOverlay/SheetOverlay.tsx"],"sourcesContent":["import type { 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.
|
|
1
|
+
{"version":3,"file":"SheetOverlay.js","names":[],"sources":["../../../src/components/SheetOverlay/SheetOverlay.tsx"],"sourcesContent":["import type { 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\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\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}>\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":";;;;;;;AAoCA,SAAgB,EAAa,EAC5B,WACA,iBACA,mBAAgB,IAChB,cAAc,GACd,oBAAoB,GACpB,cACA,eACqB;CAIrB,IAAM,EAAE,iBAAc,GAAW;AAEjC,QACC,kBAAC,GAAD;EACS;EACM;EACC;EACf,WAAW;EACX,KAAK;YALN,CAOC,kBAAC,GAAD,EAAuB,CAAA,EACvB,kBAAC,GAAD;GAAO,WAAW;aACjB,kBAAC,GAAD;IACC,cAAY;IACZ,oBAAkB;IAClB,WAAW,EAAG,GAAa,EAAU;IAEpC;IACW,CAAA;GACN,CAAA,CACM"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
//#region src/components/SurveyRating/SurveyRating.css.ts
|
|
3
|
+
var e = "ewm1i80", t = "ewm1i81", n = "ewm1i82";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { n as surveyRatingLabels, e as surveyRatingRoot, t as surveyRatingScale };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=SurveyRating.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveyRating.css.js","names":[],"sources":["../../../src/components/SurveyRating/SurveyRating.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { typography } from \"../../styles/typography.js\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const surveyRatingRoot = style({\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tgap: t(\"gap-8\"),\n\twidth: \"fit-content\",\n});\n\nexport const surveyRatingScale = style({\n\tdisplay: \"flex\",\n\tflexWrap: \"wrap\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n});\n\nexport const surveyRatingLabels = style({\n\tdisplay: \"flex\",\n\tjustifyContent: \"space-between\",\n\twidth: \"100%\",\n\t...typography(\"caption\", \"regular\"),\n\tcolor: t(\"color-content-secondary\"),\n});\n"],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode, Ref } from "react";
|
|
2
2
|
import type { Key } from "react-aria-components";
|
|
3
|
-
import type { SurveyLabelProps } from "
|
|
3
|
+
import type { SurveyLabelProps } from "./SurveyLabelProps.js";
|
|
4
4
|
export interface SurveyRatingOption {
|
|
5
5
|
/** Numeric value shown on the chip (e.g. 1–5, 1–10). Rendered unless `icon` is set. */
|
|
6
6
|
value: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cx as e } from "
|
|
2
|
-
import { Chip as t } from "
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { Chip as t } from "../Chip/Chip.js";
|
|
3
3
|
import { surveyRatingRoot as n, surveyRatingScale as r } from "./SurveyRating.css.js";
|
|
4
4
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
import { ToggleButtonGroup as o } from "react-aria-components";
|
|
6
|
-
//#region src/components/
|
|
6
|
+
//#region src/components/SurveyRating/SurveyRating.tsx
|
|
7
7
|
var s = (e, t) => e.key ?? t, c = 7, l = 48, u = 8, d = (e) => {
|
|
8
8
|
let t = Math.max(1, Math.ceil(e / c));
|
|
9
9
|
return Math.max(1, Math.ceil(e / t));
|
|
@@ -41,7 +41,7 @@ function p({ options: c, showLabels: l = !1, isDisabled: u, selectedKey: d, defa
|
|
|
41
41
|
}, s(e, n));
|
|
42
42
|
})
|
|
43
43
|
}), l && (b != null || x != null) && /* @__PURE__ */ a("div", {
|
|
44
|
-
className: "
|
|
44
|
+
className: "ewm1i82",
|
|
45
45
|
children: [/* @__PURE__ */ i("span", { children: b }), /* @__PURE__ */ i("span", { children: x })]
|
|
46
46
|
})]
|
|
47
47
|
});
|
|
@@ -0,0 +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,EAAY,CAAC;AACxD,QAAO,KAAK,IAAI,GAAG,KAAK,KAAK,IAAQ,EAAK,CAAC;GAQtC,KAAoB,MAAkB;CAC3C,IAAM,IAAO,EAAgB,EAAM;AACnC,QAAO,IAAO,KAAgB,IAAO,KAAK;;AAS3C,SAAgB,EAAa,EAC5B,YACA,gBAAa,IACb,eACA,gBACA,uBACA,aACA,cACA,UACA,QACA,cAAc,GACd,mBAAmB,KACE;CACrB,IAAM,IAAW,EAAQ,IAAI,OACvB,IAAY,EAAQ,EAAQ,SAAS,IAAI,OAEzC,KAAyB,MAAmB;EACjD,IAAM,IAAM,EAAK,OAAO,CAAC,GAAG,EAAK,CAAC,KAAK,MACjC,IACL,KAAO,OACJ,OACC,EAAQ,MAAM,GAAG,MAAM,EAAO,GAAG,EAAE,KAAK,EAAI,IAAI;AACrD,MAAW,GAAK,EAAO;IAKlB,KAAU,MAAiC,KAAO,OAAO,EAAE,GAAG,CAAC,EAAI,EACnE,IAAe,MAAgB,KAAA;AAErC,QACC,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,GAAkB,EAAU;EAAS;YAAlE,CACC,kBAAC,GAAD;GACC,eAAc;GACF;GACZ,cAAY,IAAiB,KAAA,IAAY;GACzC,mBAAiB;GACjB,WAAW;GACX,OAAO,EAAE,UAAU,EAAiB,EAAQ,OAAO,EAAE;GACrD,mBAAmB;GACnB,cAAc,IAAe,EAAO,EAAY,GAAG,KAAA;GACnD,qBACC,IAAe,KAAA,IAAY,EAAO,EAAmB;aAGrD,EAAQ,KAAK,GAAQ,MAAU;IAC/B,IAAM,IAAS,EAAO,QAAQ;AAC9B,WACC,kBAAC,GAAD;KAEC,IAAI,EAAO,GAAQ,EAAM;KACzB,SAAS,IAAS,SAAS;KAC3B,MAAK;KACL,cACC,EAAO,kBAAkB,IAAS,EAAO,QAAQ,KAAA;eAGjD,EAAO,QAAQ,EAAO;KACjB,EATD,EAAO,GAAQ,EAAM,CASpB;KAEP;GACiB,CAAA,EACnB,MAAe,KAAY,QAAQ,KAAa,SAChD,kBAAC,OAAD;GAAK,WAAA;aAAL,CACC,kBAAC,QAAD,EAAA,UAAO,GAAgB,CAAA,EACvB,kBAAC,QAAD,EAAA,UAAO,GAAiB,CAAA,CACnB;KAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveySelect.css.js","names":[],"sources":["../../../src/components/SurveySelect/SurveySelect.css.ts"],"sourcesContent":["import { style } from \"@vanilla-extract/css\";\nimport { t } from \"../../tokens/index.js\";\n\nexport const surveySelectRoot = style({\n\tdisplay: \"flex\",\n\tflexWrap: \"wrap\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tgap: t(\"gap-8\"),\n\twidth: \"100%\",\n});\n"],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, Ref } from "react";
|
|
2
2
|
import type { Key } from "react-aria-components";
|
|
3
|
-
import type { SurveyLabelProps } from "../SurveyLabelProps.js";
|
|
3
|
+
import type { SurveyLabelProps } from "../SurveyRating/SurveyLabelProps.js";
|
|
4
4
|
export interface SurveySelectOption {
|
|
5
5
|
/** Chip label text. */
|
|
6
6
|
label: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cx as e } from "
|
|
2
|
-
import { Chip as t } from "
|
|
1
|
+
import { cx as e } from "../../utils/cx.js";
|
|
2
|
+
import { Chip as t } from "../Chip/Chip.js";
|
|
3
3
|
import { surveySelectRoot as n } from "./SurveySelect.css.js";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
import { ToggleButtonGroup as i } from "react-aria-components";
|
|
6
|
-
//#region src/components/
|
|
6
|
+
//#region src/components/SurveySelect/SurveySelect.tsx
|
|
7
7
|
var a = (e, t) => e.key ?? t;
|
|
8
8
|
function o({ options: o, selectionMode: s = "multiple", disallowEmptySelection: c, isDisabled: l, selectedKeys: u, defaultSelectedKeys: d, onChange: f, className: p, style: m, ref: h, "aria-label": g, "aria-labelledby": _ }) {
|
|
9
9
|
let v = (e) => {
|
|
@@ -0,0 +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,EAAM;GAAE,EAAE,CAChE,QAAQ,EAAE,aAAU,EAAK,IAAI,EAAI,CAAC;AACpC,MACC,EAAS,KAAK,MAAM,EAAE,IAAI,EAC1B,EAAS,KAAK,MAAM,EAAE,OAAO,CAC7B;IAGI,IAAe,MAAiB,KAAA;AAEtC,QACC,kBAAC,GAAD;EACM;EACU;EACS;EACZ;EACZ,cAAY,IAAiB,KAAA,IAAY;EACzC,mBAAiB;EACjB,WAAW,EAAG,GAAkB,EAAU;EACnC;EACP,mBAAmB;EACnB,cAAc,IAAe,IAAe,KAAA;EAC5C,qBACC,IAAe,KAAA,IAAa,KAAuB,EAAE;YAGrD,EAAQ,KAAK,GAAQ,MACrB,kBAAC,GAAD;GAEC,IAAI,EAAO,GAAQ,EAAM;GACzB,SAAQ;GACR,MAAK;aAEJ,EAAO;GACF,EAND,EAAO,GAAQ,EAAM,CAMpB,CACN;EACiB,CAAA"}
|