@ada-cx/lovelace 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ScrollMarker/ScrollMarker.js +1 -5
- package/dist/components/ScrollMarker/ScrollMarker.js.map +1 -1
- package/dist/components/Sheet/SheetBody.d.ts +3 -1
- package/dist/components/Sheet/SheetBody.js +5 -4
- package/dist/components/Sheet/SheetBody.js.map +1 -1
- package/dist/components/SheetOverlay/SheetOverlay.d.ts +3 -1
- package/dist/components/SheetOverlay/SheetOverlay.js +6 -5
- package/dist/components/SheetOverlay/SheetOverlay.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,11 +16,7 @@ function s({ color: s = "default", unreadCount: c, children: l, className: u, "a
|
|
|
16
16
|
color: s,
|
|
17
17
|
type: p ? "withText" : "iconOnly"
|
|
18
18
|
}), u),
|
|
19
|
-
children: [/* @__PURE__ */ r("span", {
|
|
20
|
-
"aria-live": "polite",
|
|
21
|
-
"aria-atomic": "true",
|
|
22
|
-
children: p ? l ?? `${c} unread` : ""
|
|
23
|
-
}), /* @__PURE__ */ r(t, {})]
|
|
19
|
+
children: [/* @__PURE__ */ r("span", { children: p ? l ?? `${c} unread` : "" }), /* @__PURE__ */ r(t, {})]
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
22
|
//#endregion
|
|
@@ -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 */\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 ?? 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
|
|
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 */\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 ?? 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;AAO3B,SAAgB,EAAa,EAC5B,WAAQ,WACR,gBACA,aACA,cACA,cAAc,GACd,GAAG,KACkB;CACrB,IAAM,KAAY,KAAe,MAAM;AACvC,QACC,kBAAC,GAAD;EACC,GAAI;EACJ,cAAY,KAAa;EACzB,cAAY;EACZ,aAAW,IAAW,cAAc;EACpC,WAAW,EACV,EAAiB;GAAE;GAAO,MAAM,IAAW,aAAa;GAAY,CAAC,EACrE,EACA;YARF,CAUC,kBAAC,QAAD,EAAA,UAAO,IAAY,KAAY,GAAG,EAAY,WAAY,IAAU,CAAA,EACpE,kBAAC,GAAD,EAAa,CAAA,CACD"}
|
|
@@ -2,10 +2,12 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
export interface SheetBodyProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
className?: string;
|
|
5
|
+
/** Target for the overlay's `aria-describedby`. */
|
|
6
|
+
id?: string;
|
|
5
7
|
/**
|
|
6
8
|
* Opts the body into a named keyboard-scroll region. Use this only when the
|
|
7
9
|
* body can overflow without containing an enabled, focusable descendant.
|
|
8
10
|
*/
|
|
9
11
|
keyboardScrollLabel?: string;
|
|
10
12
|
}
|
|
11
|
-
export declare function SheetBody({ children, className, keyboardScrollLabel, }: SheetBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function SheetBody({ children, className, id, keyboardScrollLabel, }: SheetBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,15 +2,16 @@ import { cx as e } from "../../utils/cx.js";
|
|
|
2
2
|
import { sheetBody as t } from "./Sheet.css.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Sheet/SheetBody.tsx
|
|
5
|
-
function r({ children: r, className: i,
|
|
6
|
-
let
|
|
7
|
-
"aria-label":
|
|
5
|
+
function r({ children: r, className: i, id: a, keyboardScrollLabel: o }) {
|
|
6
|
+
let s = o === void 0 ? {} : {
|
|
7
|
+
"aria-label": o,
|
|
8
8
|
role: "region",
|
|
9
9
|
tabIndex: 0
|
|
10
10
|
};
|
|
11
11
|
return /* @__PURE__ */ n("div", {
|
|
12
|
+
id: a,
|
|
12
13
|
className: e(t, i),
|
|
13
|
-
...
|
|
14
|
+
...s,
|
|
14
15
|
children: r
|
|
15
16
|
});
|
|
16
17
|
}
|
|
@@ -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/**\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\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 className={cx(sheetBody, className)} {...keyboardScrollProps}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;
|
|
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,EAAE,GACF;EACA,cAAc;EACd,MAAM;EACN,UAAU;EACV;AAEJ,QACC,kBAAC,OAAD;EAAS;EAAI,WAAW,EAAG,GAAW,EAAU;EAAE,GAAI;EACpD;EACI,CAAA"}
|
|
@@ -8,6 +8,8 @@ export interface SheetOverlayProps {
|
|
|
8
8
|
isDismissable?: boolean;
|
|
9
9
|
/** Accessible name fallback when the child has no `Sheet.Header` title. */
|
|
10
10
|
"aria-label"?: string;
|
|
11
|
+
/** Id of the element describing the sheet, typically a `Sheet.Body`. */
|
|
12
|
+
"aria-describedby"?: string;
|
|
11
13
|
className?: string;
|
|
12
14
|
children: ReactNode;
|
|
13
15
|
}
|
|
@@ -21,4 +23,4 @@ export interface SheetOverlayProps {
|
|
|
21
23
|
* `aria-label` prop — with neither (e.g. an actions-only Confirm sheet) RAC
|
|
22
24
|
* emits a missing-name warning.
|
|
23
25
|
*/
|
|
24
|
-
export declare function SheetOverlay({ isOpen, onOpenChange, isDismissable, "aria-label": ariaLabel, className, children, }: SheetOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function SheetOverlay({ isOpen, onOpenChange, isDismissable, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, className, children, }: SheetOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,20 +4,21 @@ import { jsx as i } from "react/jsx-runtime";
|
|
|
4
4
|
import { useLocale as a } from "react-aria";
|
|
5
5
|
import { Dialog as o, Modal as s, ModalOverlay as c } from "react-aria-components";
|
|
6
6
|
//#region src/components/SheetOverlay/SheetOverlay.tsx
|
|
7
|
-
function l({ isOpen: l, onOpenChange: u, isDismissable: d = !0, "aria-label": f,
|
|
8
|
-
let { direction:
|
|
7
|
+
function l({ isOpen: l, onOpenChange: u, isDismissable: d = !0, "aria-label": f, "aria-describedby": p, className: m, children: h }) {
|
|
8
|
+
let { direction: g } = a();
|
|
9
9
|
return /* @__PURE__ */ i(c, {
|
|
10
10
|
isOpen: l,
|
|
11
11
|
onOpenChange: u,
|
|
12
12
|
isDismissable: d,
|
|
13
13
|
className: r,
|
|
14
|
-
dir:
|
|
14
|
+
dir: g,
|
|
15
15
|
children: /* @__PURE__ */ i(s, {
|
|
16
16
|
className: n,
|
|
17
17
|
children: /* @__PURE__ */ i(o, {
|
|
18
18
|
"aria-label": f,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
"aria-describedby": p,
|
|
20
|
+
className: e(t, m),
|
|
21
|
+
children: h
|
|
21
22
|
})
|
|
22
23
|
})
|
|
23
24
|
});
|
|
@@ -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 { 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.Header` title. */\n\t\"aria-label\"?: 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.Header` 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\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<Modal className={sheetModal}>\n\t\t\t\t<AriaDialog\n\t\t\t\t\taria-label={ariaLabel}\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":";;;;;;
|
|
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 { 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.Header` 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.Header` 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<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":";;;;;;AAmCA,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;YAEL,kBAAC,GAAD;GAAO,WAAW;aACjB,kBAAC,GAAD;IACC,cAAY;IACZ,oBAAkB;IAClB,WAAW,EAAG,GAAa,EAAU;IAEpC;IACW,CAAA;GACN,CAAA;EACM,CAAA"}
|
package/package.json
CHANGED