@tonycodes-ui/mortar 0.22.2 → 0.23.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/auth.d.ts CHANGED
@@ -73,7 +73,7 @@ export interface PasswordStrength {
73
73
  /** Visible and announced value, e.g. "Strong". */
74
74
  label: string;
75
75
  }
76
- export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type">, FieldDescription {
76
+ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "children">, FieldDescription {
77
77
  /**
78
78
  * `current` (sign-in) sets autocomplete="current-password"; `new` (sign-up,
79
79
  * reset) sets "new-password" so password managers offer to generate one.
@@ -85,6 +85,8 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
85
85
  strength?: PasswordStrength;
86
86
  /** Accessible name of the show/hide toggle; its pressed state says whether the password is visible. */
87
87
  toggleLabel?: string;
88
+ /** Not accepted: the accessible name is `label`. */
89
+ children?: never;
88
90
  }
89
91
  /**
90
92
  * Password field with a show/hide toggle, optional requirement checklist and
package/dist/auth.js CHANGED
@@ -31,7 +31,8 @@ export function AuthLayout({ title, description, logo, layout = "center", headin
31
31
  * Password field with a show/hide toggle, optional requirement checklist and
32
32
  * strength meter. Paste is never blocked.
33
33
  */
34
- export const PasswordInput = forwardRef(function PasswordInput({ label, hint, error, id, className, purpose = "current", requirements, strength, toggleLabel = "Show password", autoComplete, ...props }, ref) {
34
+ export const PasswordInput = forwardRef(function PasswordInput({ label, hint, error, id, className, purpose = "current", requirements, strength, toggleLabel = "Show password", autoComplete, children: _children, ...props }, ref) {
35
+ void _children;
35
36
  const [visible, setVisible] = useState(false);
36
37
  const requirementsId = useId();
37
38
  const { fieldId, messageId, describedBy } = useField({
@@ -61,7 +61,7 @@ export declare function FieldLabel({ htmlFor, label, required, }: {
61
61
  label: string;
62
62
  required?: boolean;
63
63
  }): import("react").JSX.Element;
64
- export interface InputProps extends InputHTMLAttributes<HTMLInputElement>, FieldDescription {
64
+ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "children">, FieldDescription {
65
65
  prefix?: string;
66
66
  suffix?: string;
67
67
  /** Decorative icon inside the field, before the text. */
@@ -70,6 +70,8 @@ export interface InputProps extends InputHTMLAttributes<HTMLInputElement>, Field
70
70
  trailingIcon?: ReactNode;
71
71
  /** Button or menu attached to the end of the field, e.g. "Sort" or "Copy". */
72
72
  action?: ReactNode;
73
+ /** Not accepted: use label, prefix, suffix or the icon slots. */
74
+ children?: never;
73
75
  }
74
76
  export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
75
77
  export declare function Select({ label, options, id, hint, error, className, ...props }: SelectHTMLAttributes<HTMLSelectElement> & FieldDescription & {
@@ -87,17 +89,21 @@ export declare function Fieldset({ legend, description, disabled, children, clas
87
89
  className?: string;
88
90
  }): import("react").JSX.Element;
89
91
  export declare function TextArea({ label, id, hint, error, className, ...props }: TextareaHTMLAttributes<HTMLTextAreaElement> & FieldDescription): import("react").JSX.Element;
90
- export declare function Checkbox({ label, description, error, className, ...props }: Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & {
92
+ export declare function Checkbox({ label, description, error, className, children: _children, ...props }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "children"> & {
91
93
  label: ReactNode;
92
94
  /** Secondary line under the label, announced as the description (the checkbox's hint). */
93
95
  description?: ReactNode;
94
96
  /** Marks the checkbox invalid; the message is announced when it appears. */
95
97
  error?: string;
98
+ /** Not accepted: the accessible name is `label`. */
99
+ children?: never;
96
100
  }): import("react").JSX.Element;
97
- export declare function Switch({ label, description, className, ...props }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "role"> & {
101
+ export declare function Switch({ label, description, className, children: _children, ...props }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "role" | "children"> & {
98
102
  label: string;
99
103
  /** Secondary line under the label, announced as the description. */
100
104
  description?: ReactNode;
105
+ /** Not accepted: the accessible name is `label`. */
106
+ children?: never;
101
107
  }): import("react").JSX.Element;
102
108
  export declare function RadioGroup({ label, name, value, onChange, options, layout, hint, error, required, id, className, }: {
103
109
  label: string;
@@ -33,7 +33,8 @@ export function Badge({ children, tone = "neutral", className, }) {
33
33
  export function FieldLabel({ htmlFor, label, required, }) {
34
34
  return (_jsxs("label", { htmlFor: htmlFor, children: [label, required && _jsx(RequiredMark, {})] }));
35
35
  }
36
- export const Input = forwardRef(function Input({ label, hint, error, id, prefix, suffix, leadingIcon, trailingIcon, action, className, ...props }, ref) {
36
+ export const Input = forwardRef(function Input({ label, hint, error, id, prefix, suffix, leadingIcon, trailingIcon, action, className, children: _children, ...props }, ref) {
37
+ void _children;
37
38
  const { fieldId, messageId, describedBy } = useField({
38
39
  id,
39
40
  hint,
@@ -103,14 +104,16 @@ function useDescribedLayout(active, input) {
103
104
  }, [described, input]);
104
105
  return described;
105
106
  }
106
- export function Checkbox({ label, description, error, className, ...props }) {
107
+ export function Checkbox({ label, description, error, className, children: _children, ...props }) {
108
+ void _children;
107
109
  const input = useRef(null);
108
110
  const described = useDescribedLayout(!!(description || error), input);
109
111
  if (described)
110
112
  return (_jsx(DescribedChoice, { component: "Checkbox", id: props.id, label: label, description: description, error: error, required: props.required, describedBy: props["aria-describedby"], className: className, input: (attrs) => (_jsx("input", { ...props, ...attrs, ref: input, "aria-invalid": error ? true : props["aria-invalid"], type: "checkbox" })) }));
111
113
  return (_jsxs("label", { ...componentRoot("Checkbox"), className: cx("m-choice", className), children: [_jsx("input", { ...props, ref: input, type: "checkbox" }), label, props.required && _jsx(RequiredMark, {})] }));
112
114
  }
113
- export function Switch({ label, description, className, ...props }) {
115
+ export function Switch({ label, description, className, children: _children, ...props }) {
116
+ void _children;
114
117
  const input = useRef(null);
115
118
  const described = useDescribedLayout(!!description, input);
116
119
  if (described)
package/docs/agents.md CHANGED
@@ -108,6 +108,7 @@ Add `--json` for machine-readable output. `mortar audit` exits with status 1 whe
108
108
  | `class-override` | error | A Tailwind arbitrary variant that targets `.m-*` classes, such as `[&_.m-button]:rounded-none` |
109
109
  | `local-copy` | error | A copy of a Mortar source file, or code rendering Mortar's component marker |
110
110
  | `raw-element` | error | A raw `<table>`, `<select>`, `<textarea>`, `<dialog>`, `<progress>` or `<input>` (by type; not `hidden`, `file`, `range`, `color` or `image`) anywhere in an app that uses Mortar, naming the component to use instead. A raw `<button>` is a warning. The mapping comes from each contract's `replaces` field, so new components extend it |
111
+ | `legacy-package` | error | An import or `package.json` dependency of the retired private-registry package (see [CHANGELOG Migration](../CHANGELOG.md#migration)); install and import `@tonycodes-ui/mortar` instead. A `node_modules` copy of the old package does not count as installing the public one |
111
112
  | `email-app-import` | error | In an email (a file importing `@tonycodes-ui/mortar/email` or React Email), an app component or `styles.css`, naming the email component to use. Raw elements in emails are not reported: email layout is tables |
112
113
  | `email-peer-missing` | error | `@tonycodes-ui/mortar/email` is imported but `@react-email/components` is not in package.json |
113
114
  | `missing-styles` | error | No import of `@tonycodes-ui/mortar/styles.css` |
@@ -117,7 +118,7 @@ Add `--json` for machine-readable output. `mortar audit` exits with status 1 whe
117
118
  | `raw-colour` | warning | Hex, `rgb()`/`oklch()` colours or Tailwind palette classes in files that render Mortar components, except where they define a brand (`brandTokens`, `brandToCss`/`brandToStyle`/`registerBrand` arguments, `BrandDefinition` objects, `--m-brand-*` values) |
118
119
  | `limited-data` | info | The installed release has no agent data, so a newer catalogue was used |
119
120
 
120
- The audit is a fast scanner, not a type checker. It does not see props passed through a spread (`{...props}`), components re-exported or wrapped under another name, class names built at runtime, or markup in `.vue`, `.svelte`, `.astro` or `.html` files. Run the app's typecheck and build as well.
121
+ The audit is a fast scanner, not a type checker. It checks JSX body children when a component's contract has no `children` slot (for example `<Switch>…</Switch>`). It does not see props passed through a spread (`{...props}`), components re-exported or wrapped under another name, class names built at runtime, or markup in `.vue`, `.svelte`, `.astro` or `.html` files. Run the app's typecheck and build as well.
121
122
 
122
123
  A clean audit means the audit found none of the problems above. It is not proof that a page is built only from Mortar components: hand-written layout, typography or animation in the app's own markup is invisible to it unless it touches Mortar's classes or colours. Do not report a passing audit as that proof. To show a page is composed from the kit, point to the components it renders (each root carries `data-m-component`) and to [what you can extend](theming.md#what-you-can-extend).
123
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonycodes-ui/mortar",
3
- "version": "0.22.2",
3
+ "version": "0.23.0",
4
4
  "description": "Mortar: a shared design foundation, application and marketing UI for React and Tailwind.",
5
5
  "keywords": [
6
6
  "react",
package/src/auth.tsx CHANGED
@@ -176,7 +176,7 @@ export interface PasswordStrength {
176
176
  }
177
177
  export interface PasswordInputProps
178
178
  extends
179
- Omit<InputHTMLAttributes<HTMLInputElement>, "type">,
179
+ Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "children">,
180
180
  FieldDescription {
181
181
  /**
182
182
  * `current` (sign-in) sets autocomplete="current-password"; `new` (sign-up,
@@ -189,6 +189,8 @@ export interface PasswordInputProps
189
189
  strength?: PasswordStrength;
190
190
  /** Accessible name of the show/hide toggle; its pressed state says whether the password is visible. */
191
191
  toggleLabel?: string;
192
+ /** Not accepted: the accessible name is `label`. */
193
+ children?: never;
192
194
  }
193
195
  /**
194
196
  * Password field with a show/hide toggle, optional requirement checklist and
@@ -207,10 +209,12 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
207
209
  strength,
208
210
  toggleLabel = "Show password",
209
211
  autoComplete,
212
+ children: _children,
210
213
  ...props
211
214
  },
212
215
  ref,
213
216
  ) {
217
+ void _children;
214
218
  const [visible, setVisible] = useState(false);
215
219
  const requirementsId = useId();
216
220
  const { fieldId, messageId, describedBy } = useField({
@@ -233,7 +233,9 @@ export function FieldLabel({
233
233
  );
234
234
  }
235
235
  export interface InputProps
236
- extends InputHTMLAttributes<HTMLInputElement>, FieldDescription {
236
+ extends
237
+ Omit<InputHTMLAttributes<HTMLInputElement>, "children">,
238
+ FieldDescription {
237
239
  prefix?: string;
238
240
  suffix?: string;
239
241
  /** Decorative icon inside the field, before the text. */
@@ -242,6 +244,8 @@ export interface InputProps
242
244
  trailingIcon?: ReactNode;
243
245
  /** Button or menu attached to the end of the field, e.g. "Sort" or "Copy". */
244
246
  action?: ReactNode;
247
+ /** Not accepted: use label, prefix, suffix or the icon slots. */
248
+ children?: never;
245
249
  }
246
250
  export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
247
251
  {
@@ -255,10 +259,12 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
255
259
  trailingIcon,
256
260
  action,
257
261
  className,
262
+ children: _children,
258
263
  ...props
259
264
  },
260
265
  ref,
261
266
  ) {
267
+ void _children;
262
268
  const { fieldId, messageId, describedBy } = useField({
263
269
  id,
264
270
  hint,
@@ -474,14 +480,18 @@ export function Checkbox({
474
480
  description,
475
481
  error,
476
482
  className,
483
+ children: _children,
477
484
  ...props
478
- }: Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & {
485
+ }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "children"> & {
479
486
  label: ReactNode;
480
487
  /** Secondary line under the label, announced as the description (the checkbox's hint). */
481
488
  description?: ReactNode;
482
489
  /** Marks the checkbox invalid; the message is announced when it appears. */
483
490
  error?: string;
491
+ /** Not accepted: the accessible name is `label`. */
492
+ children?: never;
484
493
  }) {
494
+ void _children;
485
495
  const input = useRef<HTMLInputElement>(null);
486
496
  const described = useDescribedLayout(!!(description || error), input);
487
497
  if (described)
@@ -518,12 +528,16 @@ export function Switch({
518
528
  label,
519
529
  description,
520
530
  className,
531
+ children: _children,
521
532
  ...props
522
- }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "role"> & {
533
+ }: Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "role" | "children"> & {
523
534
  label: string;
524
535
  /** Secondary line under the label, announced as the description. */
525
536
  description?: ReactNode;
537
+ /** Not accepted: the accessible name is `label`. */
538
+ children?: never;
526
539
  }) {
540
+ void _children;
527
541
  const input = useRef<HTMLInputElement>(null);
528
542
  const described = useDescribedLayout(!!description, input);
529
543
  if (described)