@bayonai/mui-design 1.3.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/CHANGELOG.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  All notable changes to `@bayonai/mui-design` will be documented in this file.
4
4
 
5
- ## 1.3.0 (unreleased)
5
+ ## 1.4.0 - 2026-11-12
6
6
 
7
- - Add reusable metadata value-row and explicit venue-search presentation.
7
+ - Add reusable metadata value-row/group spacing, neutral template badge, and explicit venue-search presentation.
8
8
 
9
9
  ## 1.2.1 - 2026-11-12
10
10
 
package/README.md CHANGED
@@ -211,7 +211,11 @@ open action retains its accessible label and tooltip.
211
211
  ### Location presentation
212
212
 
213
213
  `@bayonai/mui-design/location` exposes `MetadataValueField`,
214
- `VenueSearchDialog`, `GeographicLocationField`, and `SearchInputAction`. Supply an authorized `searchVenues`
214
+ `VenueSearchDialog`, `GeographicLocationField`, `MetadataFieldGroup`,
215
+ `TemplateBadge`, and `SearchInputAction`. `MetadataFieldGroup` and the exported
216
+ spacing constants preserve the close-label / separated-field rhythm. The exported
217
+ `metadataFieldLabelSx` and `metadataValueRowSx` recipes let hosts apply the same
218
+ layout to custom field controls. Supply an authorized `searchVenues`
215
219
  callback to the dialog; its result labels and addresses are transient. The user
216
220
  must explicitly search and select a result. Hosts provide credential handling,
217
221
  rate limits, persistence, billing configuration, safe error policy, clipboard
@@ -235,11 +239,17 @@ import { placeLocationMapsUrl } from "@bayonai/location";
235
239
  The field calls the host-provided search function only after explicit action;
236
240
  `onChange` supplies a selected Google Place ID or `undefined` for Clear. Hosts
237
241
  may override field and picker copy while the Google Maps logo remains unchanged.
238
- Only HTTPS Google Maps URLs are linked; invalid links display the label and a
239
- safe console diagnostic instead. Hosts should retain prior values until their
242
+ Only HTTPS `google.com/maps`, `www.google.com/maps`, and `maps.google.com`
243
+ URLs are linked; invalid links display the label and a safe console diagnostic
244
+ instead. Hosts should retain prior values until their
240
245
  own form's accepted save and implement any error/clipboard feedback policies.
241
246
 
242
247
  The picker embeds the unmodified official Google Maps attribution logos from the
243
248
  [Google attribution assets](https://developers.google.com/static/maps/documentation/images/Google_Maps_Attribution_Assets.zip).
244
249
  Keep attribution visible and follow the [Places API policies](https://developers.google.com/maps/documentation/places/web-service/policies)
245
- when presenting Google content.
250
+ when presenting Google content. Applications using a restrictive Content Security
251
+ Policy must permit `data:` images in `img-src` so the embedded attribution logo
252
+ remains visible.
253
+
254
+ `TemplateBadge` is the compact neutral marker for host-identified template
255
+ types. Hosts decide which types have a template and may supply a localized label.
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.METADATA_FIELD_GROUP_SPACING = exports.METADATA_FIELD_LABEL_SPACING = void 0;
5
+ exports.MetadataFieldGroup = MetadataFieldGroup;
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const material_1 = require("@mui/material");
8
+ /** Keep each label close to its value and separate neighboring fields. */
9
+ exports.METADATA_FIELD_LABEL_SPACING = 0.25;
10
+ exports.METADATA_FIELD_GROUP_SPACING = 2.5;
11
+ function MetadataFieldGroup(props) {
12
+ return (0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: exports.METADATA_FIELD_GROUP_SPACING, ...props });
13
+ }
@@ -1,23 +1,27 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.metadataValueRowSx = exports.metadataFieldLabelSx = void 0;
4
5
  exports.MetadataValueField = MetadataValueField;
5
6
  const jsx_runtime_1 = require("react/jsx-runtime");
6
7
  const material_1 = require("@mui/material");
7
- /** Compact label/value row; consumers own actions, wording and persistence. */
8
+ const MetadataFieldGroup_js_1 = require("./MetadataFieldGroup.js");
9
+ // Shared recipes preserve the field's label rhythm and underlined value row.
10
+ exports.metadataFieldLabelSx = {
11
+ color: "text.secondary",
12
+ fontSize: "0.75rem",
13
+ fontWeight: 700,
14
+ letterSpacing: "0.04em",
15
+ lineHeight: 1.2,
16
+ textTransform: "uppercase",
17
+ };
18
+ exports.metadataValueRowSx = {
19
+ alignItems: "center",
20
+ borderBottom: 1,
21
+ borderColor: "divider",
22
+ minHeight: 40,
23
+ minWidth: 0,
24
+ };
8
25
  function MetadataValueField({ label, children, actions, }) {
9
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 0.25, sx: { minWidth: 0 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "span", variant: "caption", sx: {
10
- color: "text.secondary",
11
- fontSize: "0.75rem",
12
- fontWeight: 700,
13
- letterSpacing: "0.04em",
14
- lineHeight: 1.2,
15
- textTransform: "uppercase",
16
- }, children: label }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 0.5, sx: {
17
- alignItems: "center",
18
- borderBottom: 1,
19
- borderColor: "divider",
20
- minHeight: 40,
21
- minWidth: 0,
22
- }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1, minWidth: 0, overflowWrap: "anywhere" }, children: children }), actions] })] }));
26
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: MetadataFieldGroup_js_1.METADATA_FIELD_LABEL_SPACING, sx: { minWidth: 0 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "span", variant: "caption", sx: exports.metadataFieldLabelSx, children: label }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 0.5, sx: exports.metadataValueRowSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1, minWidth: 0, overflowWrap: "anywhere" }, children: children }), actions] })] }));
23
27
  }
@@ -9,7 +9,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const Search_1 = __importDefault(require("@mui/icons-material/Search"));
10
10
  const material_1 = require("@mui/material");
11
11
  const LoadingIconButton_js_1 = require("../actions/LoadingIconButton.js");
12
- /** Shared trailing action for search text fields; typing never starts a lookup. */
13
12
  function SearchInputAction({ label, loadingLabel, loading = false, disabled = false, onSearch, }) {
14
13
  return ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: loading ? loadingLabel : label, children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingIconButton_js_1.LoadingIconButton, { "aria-label": label, loadingLabel: loadingLabel, loading: loading, disabled: disabled, onClick: onSearch, type: "button", edge: "end", children: (0, jsx_runtime_1.jsx)(Search_1.default, {}) }) }) }) }));
15
14
  }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TemplateBadge = TemplateBadge;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const material_1 = require("@mui/material");
7
+ function TemplateBadge({ label = "Template" }) {
8
+ return ((0, jsx_runtime_1.jsx)(material_1.Chip, { component: "span", label: label, size: "small", sx: { flex: "0 0 auto", fontSize: "0.68rem", height: 20, ml: 1 } }));
9
+ }
@@ -48,8 +48,21 @@ function VenueSearchDialog({ placeName = "", canSearch = true, searchVenues, cop
48
48
  // A deliberate Search is one billable lookup. Never search per keystroke,
49
49
  // auto-select the first prediction, or persist Google's returned address.
50
50
  const result = await searchVenues(name);
51
+ if (!Array.isArray(result))
52
+ throw new Error("Venue search returned an invalid result list.");
53
+ // Keep the picker bounded and never allow malformed provider IDs to be selected.
54
+ const choices = result
55
+ .slice(0, 5)
56
+ .filter((venue) => venue &&
57
+ typeof venue.placeId === "string" &&
58
+ venue.placeId.length > 0 &&
59
+ venue.placeId.length <= 512 &&
60
+ !/[\s\u0000-\u001f\u007f]/u.test(venue.placeId) &&
61
+ typeof venue.name === "string" &&
62
+ venue.name.trim().length > 0 &&
63
+ (venue.address === undefined || typeof venue.address === "string"));
51
64
  if (current === generation.current)
52
- setVenues(result);
65
+ setVenues(choices);
53
66
  }
54
67
  catch (error) {
55
68
  if (current === generation.current) {
@@ -1,12 +1,20 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.GeographicLocationField = exports.MetadataValueField = exports.SearchInputAction = exports.VenueSearchDialog = void 0;
4
+ exports.METADATA_FIELD_LABEL_SPACING = exports.METADATA_FIELD_GROUP_SPACING = exports.MetadataFieldGroup = exports.TemplateBadge = exports.GeographicLocationField = exports.metadataValueRowSx = exports.metadataFieldLabelSx = exports.MetadataValueField = exports.SearchInputAction = exports.VenueSearchDialog = void 0;
5
5
  var VenueSearchDialog_js_1 = require("./VenueSearchDialog.js");
6
6
  Object.defineProperty(exports, "VenueSearchDialog", { enumerable: true, get: function () { return VenueSearchDialog_js_1.VenueSearchDialog; } });
7
7
  var SearchInputAction_js_1 = require("./SearchInputAction.js");
8
8
  Object.defineProperty(exports, "SearchInputAction", { enumerable: true, get: function () { return SearchInputAction_js_1.SearchInputAction; } });
9
9
  var MetadataValueField_js_1 = require("./MetadataValueField.js");
10
10
  Object.defineProperty(exports, "MetadataValueField", { enumerable: true, get: function () { return MetadataValueField_js_1.MetadataValueField; } });
11
+ Object.defineProperty(exports, "metadataFieldLabelSx", { enumerable: true, get: function () { return MetadataValueField_js_1.metadataFieldLabelSx; } });
12
+ Object.defineProperty(exports, "metadataValueRowSx", { enumerable: true, get: function () { return MetadataValueField_js_1.metadataValueRowSx; } });
11
13
  var GeographicLocationField_js_1 = require("./GeographicLocationField.js");
12
14
  Object.defineProperty(exports, "GeographicLocationField", { enumerable: true, get: function () { return GeographicLocationField_js_1.GeographicLocationField; } });
15
+ var TemplateBadge_js_1 = require("./TemplateBadge.js");
16
+ Object.defineProperty(exports, "TemplateBadge", { enumerable: true, get: function () { return TemplateBadge_js_1.TemplateBadge; } });
17
+ var MetadataFieldGroup_js_1 = require("./MetadataFieldGroup.js");
18
+ Object.defineProperty(exports, "MetadataFieldGroup", { enumerable: true, get: function () { return MetadataFieldGroup_js_1.MetadataFieldGroup; } });
19
+ Object.defineProperty(exports, "METADATA_FIELD_GROUP_SPACING", { enumerable: true, get: function () { return MetadataFieldGroup_js_1.METADATA_FIELD_GROUP_SPACING; } });
20
+ Object.defineProperty(exports, "METADATA_FIELD_LABEL_SPACING", { enumerable: true, get: function () { return MetadataFieldGroup_js_1.METADATA_FIELD_LABEL_SPACING; } });
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Stack } from "@mui/material";
4
+ /** Keep each label close to its value and separate neighboring fields. */
5
+ export const METADATA_FIELD_LABEL_SPACING = 0.25;
6
+ export const METADATA_FIELD_GROUP_SPACING = 2.5;
7
+ export function MetadataFieldGroup(props) {
8
+ return _jsx(Stack, { spacing: METADATA_FIELD_GROUP_SPACING, ...props });
9
+ }
@@ -1,20 +1,23 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Box, Stack, Typography } from "@mui/material";
4
- /** Compact label/value row; consumers own actions, wording and persistence. */
4
+ import { METADATA_FIELD_LABEL_SPACING } from "./MetadataFieldGroup.js";
5
+ // Shared recipes preserve the field's label rhythm and underlined value row.
6
+ export const metadataFieldLabelSx = {
7
+ color: "text.secondary",
8
+ fontSize: "0.75rem",
9
+ fontWeight: 700,
10
+ letterSpacing: "0.04em",
11
+ lineHeight: 1.2,
12
+ textTransform: "uppercase",
13
+ };
14
+ export const metadataValueRowSx = {
15
+ alignItems: "center",
16
+ borderBottom: 1,
17
+ borderColor: "divider",
18
+ minHeight: 40,
19
+ minWidth: 0,
20
+ };
5
21
  export function MetadataValueField({ label, children, actions, }) {
6
- return (_jsxs(Stack, { spacing: 0.25, sx: { minWidth: 0 }, children: [_jsx(Typography, { component: "span", variant: "caption", sx: {
7
- color: "text.secondary",
8
- fontSize: "0.75rem",
9
- fontWeight: 700,
10
- letterSpacing: "0.04em",
11
- lineHeight: 1.2,
12
- textTransform: "uppercase",
13
- }, children: label }), _jsxs(Stack, { direction: "row", spacing: 0.5, sx: {
14
- alignItems: "center",
15
- borderBottom: 1,
16
- borderColor: "divider",
17
- minHeight: 40,
18
- minWidth: 0,
19
- }, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0, overflowWrap: "anywhere" }, children: children }), actions] })] }));
22
+ return (_jsxs(Stack, { spacing: METADATA_FIELD_LABEL_SPACING, sx: { minWidth: 0 }, children: [_jsx(Typography, { component: "span", variant: "caption", sx: metadataFieldLabelSx, children: label }), _jsxs(Stack, { direction: "row", spacing: 0.5, sx: metadataValueRowSx, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0, overflowWrap: "anywhere" }, children: children }), actions] })] }));
20
23
  }
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import SearchIcon from "@mui/icons-material/Search";
4
4
  import { InputAdornment, Tooltip } from "@mui/material";
5
5
  import { LoadingIconButton } from "../actions/LoadingIconButton.js";
6
- /** Shared trailing action for search text fields; typing never starts a lookup. */
7
6
  export function SearchInputAction({ label, loadingLabel, loading = false, disabled = false, onSearch, }) {
8
7
  return (_jsx(InputAdornment, { position: "end", children: _jsx(Tooltip, { title: loading ? loadingLabel : label, children: _jsx("span", { children: _jsx(LoadingIconButton, { "aria-label": label, loadingLabel: loadingLabel, loading: loading, disabled: disabled, onClick: onSearch, type: "button", edge: "end", children: _jsx(SearchIcon, {}) }) }) }) }));
9
8
  }
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Chip } from "@mui/material";
4
+ export function TemplateBadge({ label = "Template" }) {
5
+ return (_jsx(Chip, { component: "span", label: label, size: "small", sx: { flex: "0 0 auto", fontSize: "0.68rem", height: 20, ml: 1 } }));
6
+ }
@@ -45,8 +45,21 @@ export function VenueSearchDialog({ placeName = "", canSearch = true, searchVenu
45
45
  // A deliberate Search is one billable lookup. Never search per keystroke,
46
46
  // auto-select the first prediction, or persist Google's returned address.
47
47
  const result = await searchVenues(name);
48
+ if (!Array.isArray(result))
49
+ throw new Error("Venue search returned an invalid result list.");
50
+ // Keep the picker bounded and never allow malformed provider IDs to be selected.
51
+ const choices = result
52
+ .slice(0, 5)
53
+ .filter((venue) => venue &&
54
+ typeof venue.placeId === "string" &&
55
+ venue.placeId.length > 0 &&
56
+ venue.placeId.length <= 512 &&
57
+ !/[\s\u0000-\u001f\u007f]/u.test(venue.placeId) &&
58
+ typeof venue.name === "string" &&
59
+ venue.name.trim().length > 0 &&
60
+ (venue.address === undefined || typeof venue.address === "string"));
48
61
  if (current === generation.current)
49
- setVenues(result);
62
+ setVenues(choices);
50
63
  }
51
64
  catch (error) {
52
65
  if (current === generation.current) {
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
  export { VenueSearchDialog, } from "./VenueSearchDialog.js";
3
- export { SearchInputAction } from "./SearchInputAction.js";
4
- export { MetadataValueField } from "./MetadataValueField.js";
3
+ export { SearchInputAction, } from "./SearchInputAction.js";
4
+ export { MetadataValueField, metadataFieldLabelSx, metadataValueRowSx, } from "./MetadataValueField.js";
5
5
  export { GeographicLocationField, } from "./GeographicLocationField.js";
6
+ export { TemplateBadge } from "./TemplateBadge.js";
7
+ export { MetadataFieldGroup, METADATA_FIELD_GROUP_SPACING, METADATA_FIELD_LABEL_SPACING, } from "./MetadataFieldGroup.js";
@@ -0,0 +1,5 @@
1
+ import { type StackProps } from "@mui/material";
2
+ /** Keep each label close to its value and separate neighboring fields. */
3
+ export declare const METADATA_FIELD_LABEL_SPACING = 0.25;
4
+ export declare const METADATA_FIELD_GROUP_SPACING = 2.5;
5
+ export declare function MetadataFieldGroup(props: StackProps): import("react").JSX.Element;
@@ -1,7 +1,23 @@
1
1
  import type { ReactNode } from "react";
2
+ export declare const metadataFieldLabelSx: {
3
+ readonly color: "text.secondary";
4
+ readonly fontSize: "0.75rem";
5
+ readonly fontWeight: 700;
6
+ readonly letterSpacing: "0.04em";
7
+ readonly lineHeight: 1.2;
8
+ readonly textTransform: "uppercase";
9
+ };
10
+ export declare const metadataValueRowSx: {
11
+ readonly alignItems: "center";
12
+ readonly borderBottom: 1;
13
+ readonly borderColor: "divider";
14
+ readonly minHeight: 40;
15
+ readonly minWidth: 0;
16
+ };
2
17
  /** Compact label/value row; consumers own actions, wording and persistence. */
3
- export declare function MetadataValueField({ label, children, actions, }: {
18
+ export type MetadataValueFieldProps = {
4
19
  label: ReactNode;
5
20
  children: ReactNode;
6
21
  actions?: ReactNode;
7
- }): import("react").JSX.Element;
22
+ };
23
+ export declare function MetadataValueField({ label, children, actions, }: MetadataValueFieldProps): import("react").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  /** Shared trailing action for search text fields; typing never starts a lookup. */
2
- export declare function SearchInputAction({ label, loadingLabel, loading, disabled, onSearch, }: {
2
+ export type SearchInputActionProps = {
3
3
  label: string;
4
4
  loadingLabel: string;
5
5
  loading?: boolean;
6
6
  disabled?: boolean;
7
7
  onSearch: () => void;
8
- }): import("react").JSX.Element;
8
+ };
9
+ export declare function SearchInputAction({ label, loadingLabel, loading, disabled, onSearch, }: SearchInputActionProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ /** A neutral marker; the host decides which types have templates. */
2
+ export type TemplateBadgeProps = {
3
+ label?: string;
4
+ };
5
+ export declare function TemplateBadge({ label }: TemplateBadgeProps): import("react").JSX.Element;
@@ -22,11 +22,12 @@ export type VenueSearchCopy = {
22
22
  noResults: string;
23
23
  failure: string;
24
24
  };
25
- export declare function VenueSearchDialog({ placeName, canSearch, searchVenues, copy, onClose, onChange, }: {
25
+ export type VenueSearchDialogProps = {
26
26
  placeName?: string;
27
27
  canSearch?: boolean;
28
28
  searchVenues: (query: string) => Promise<VenueSuggestion[]>;
29
29
  copy?: Partial<VenueSearchCopy>;
30
30
  onClose: () => void;
31
31
  onChange: (pin: GoogleVenueReference) => void;
32
- }): import("react").JSX.Element;
32
+ };
33
+ export declare function VenueSearchDialog({ placeName, canSearch, searchVenues, copy, onClose, onChange, }: VenueSearchDialogProps): import("react").JSX.Element;
@@ -1,4 +1,6 @@
1
- export { VenueSearchDialog, type VenueSuggestion, type VenueSearchCopy, type GoogleVenueReference, } from "./VenueSearchDialog.js";
2
- export { SearchInputAction } from "./SearchInputAction.js";
3
- export { MetadataValueField } from "./MetadataValueField.js";
1
+ export { VenueSearchDialog, type VenueSuggestion, type VenueSearchCopy, type VenueSearchDialogProps, type GoogleVenueReference, } from "./VenueSearchDialog.js";
2
+ export { SearchInputAction, type SearchInputActionProps, } from "./SearchInputAction.js";
3
+ export { MetadataValueField, metadataFieldLabelSx, metadataValueRowSx, type MetadataValueFieldProps, } from "./MetadataValueField.js";
4
4
  export { GeographicLocationField, type GeographicLocationFieldProps, type GeographicLocationCopy, } from "./GeographicLocationField.js";
5
+ export { TemplateBadge, type TemplateBadgeProps } from "./TemplateBadge.js";
6
+ export { MetadataFieldGroup, METADATA_FIELD_GROUP_SPACING, METADATA_FIELD_LABEL_SPACING, } from "./MetadataFieldGroup.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bayonai/mui-design",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Shared Bayon AI Material UI theme, style recipes, and reusable design components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",