@page-speed/forms 0.3.6 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/inputs.d.cts CHANGED
@@ -124,10 +124,13 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
124
124
  */
125
125
  indeterminate?: boolean;
126
126
  /**
127
- * Label text for the checkbox
128
- * Can also wrap checkbox in a label element
127
+ * Label text for the checkbox (primary text)
129
128
  */
130
129
  label?: React.ReactNode;
130
+ /**
131
+ * Optional description text below the label (secondary text)
132
+ */
133
+ description?: React.ReactNode;
131
134
  /**
132
135
  * Additional native input attributes
133
136
  */
@@ -144,7 +147,8 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
144
147
  * - Error state styling
145
148
  * - Controlled input behavior
146
149
  * - Indeterminate state support
147
- * - Optional label text
150
+ * - Optional label and description text (with nil guards)
151
+ * - Proper field-based layout structure
148
152
  * - All native checkbox attributes supported
149
153
  *
150
154
  * @example
@@ -154,6 +158,7 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
154
158
  * <Checkbox
155
159
  * {...form.getFieldProps('terms')}
156
160
  * label="I agree to the terms and conditions"
161
+ * description="By clicking this checkbox, you agree to the terms."
157
162
  * error={!!form.errors.terms}
158
163
  * aria-describedby={form.errors.terms ? 'terms-error' : undefined}
159
164
  * />
@@ -173,7 +178,7 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
173
178
  *
174
179
  * @see https://opensite.ai/developers/page-speed/forms/checkbox
175
180
  */
176
- declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className, indeterminate, label, ...props }: CheckboxProps): React.JSX.Element;
181
+ declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className, indeterminate, label, description, ...props }: CheckboxProps): React.JSX.Element;
177
182
  declare namespace Checkbox {
178
183
  var displayName: string;
179
184
  }
@@ -329,11 +334,11 @@ interface RadioOption {
329
334
  */
330
335
  value: string;
331
336
  /**
332
- * Display label for the option
337
+ * Display label for the option (primary text)
333
338
  */
334
339
  label: React.ReactNode;
335
340
  /**
336
- * Optional description text below the label
341
+ * Optional description text below the label (secondary text)
337
342
  */
338
343
  description?: React.ReactNode;
339
344
  /**
@@ -379,8 +384,9 @@ interface RadioProps extends Omit<InputProps<string>, "onChange" | "placeholder"
379
384
  * - Controlled input behavior
380
385
  * - Keyboard navigation (arrow keys)
381
386
  * - Inline or stacked layout
382
- * - Optional descriptions for each option
387
+ * - Optional descriptions for each option (with nil guard)
383
388
  * - Individual option disabled state
389
+ * - Card-based styling with proper visual hierarchy
384
390
  * - All native radio attributes supported
385
391
  *
386
392
  * @example
package/dist/inputs.d.ts CHANGED
@@ -124,10 +124,13 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
124
124
  */
125
125
  indeterminate?: boolean;
126
126
  /**
127
- * Label text for the checkbox
128
- * Can also wrap checkbox in a label element
127
+ * Label text for the checkbox (primary text)
129
128
  */
130
129
  label?: React.ReactNode;
130
+ /**
131
+ * Optional description text below the label (secondary text)
132
+ */
133
+ description?: React.ReactNode;
131
134
  /**
132
135
  * Additional native input attributes
133
136
  */
@@ -144,7 +147,8 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
144
147
  * - Error state styling
145
148
  * - Controlled input behavior
146
149
  * - Indeterminate state support
147
- * - Optional label text
150
+ * - Optional label and description text (with nil guards)
151
+ * - Proper field-based layout structure
148
152
  * - All native checkbox attributes supported
149
153
  *
150
154
  * @example
@@ -154,6 +158,7 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
154
158
  * <Checkbox
155
159
  * {...form.getFieldProps('terms')}
156
160
  * label="I agree to the terms and conditions"
161
+ * description="By clicking this checkbox, you agree to the terms."
157
162
  * error={!!form.errors.terms}
158
163
  * aria-describedby={form.errors.terms ? 'terms-error' : undefined}
159
164
  * />
@@ -173,7 +178,7 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
173
178
  *
174
179
  * @see https://opensite.ai/developers/page-speed/forms/checkbox
175
180
  */
176
- declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className, indeterminate, label, ...props }: CheckboxProps): React.JSX.Element;
181
+ declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className, indeterminate, label, description, ...props }: CheckboxProps): React.JSX.Element;
177
182
  declare namespace Checkbox {
178
183
  var displayName: string;
179
184
  }
@@ -329,11 +334,11 @@ interface RadioOption {
329
334
  */
330
335
  value: string;
331
336
  /**
332
- * Display label for the option
337
+ * Display label for the option (primary text)
333
338
  */
334
339
  label: React.ReactNode;
335
340
  /**
336
- * Optional description text below the label
341
+ * Optional description text below the label (secondary text)
337
342
  */
338
343
  description?: React.ReactNode;
339
344
  /**
@@ -379,8 +384,9 @@ interface RadioProps extends Omit<InputProps<string>, "onChange" | "placeholder"
379
384
  * - Controlled input behavior
380
385
  * - Keyboard navigation (arrow keys)
381
386
  * - Inline or stacked layout
382
- * - Optional descriptions for each option
387
+ * - Optional descriptions for each option (with nil guard)
383
388
  * - Individual option disabled state
389
+ * - Card-based styling with proper visual hierarchy
384
390
  * - All native radio attributes supported
385
391
  *
386
392
  * @example