@edux-design/buttons 0.3.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @edux-design/buttons
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Correct ButtonGroupItem declarations to describe its render-null option marker and seven existing fields. DOM refs and handlers remain on Button or ButtonGroup; JavaScript behaviour is unchanged.
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -207,10 +207,59 @@ type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" |
207
207
  isStretched?: boolean;
208
208
  };
209
209
 
210
- declare function ButtonGroupItem(_props: any): any;
210
+ /**
211
+ * Option marker consumed by ButtonGroup; it does not render a DOM element.
212
+ *
213
+ * @typedef {Object} ButtonGroupItemProps
214
+ * @property {React.ReactNode} [children] - Label used when label is omitted.
215
+ * @property {React.ReactNode} [label] - Main label for the option.
216
+ * @property {React.ReactNode} [startAdornment] - Optional leading element.
217
+ * @property {React.ReactNode} [endAdornment] - Optional trailing element.
218
+ * @property {React.ReactNode} [endIcon] - Legacy trailing-element alias.
219
+ * @property {string|number} [value] - Selection value; defaults to the option index.
220
+ * @property {boolean} [disabled] - Whether the option is disabled.
221
+ */
222
+ /**
223
+ * @param {ButtonGroupItemProps} _props
224
+ * @returns {null}
225
+ */
226
+ declare function ButtonGroupItem(_props: ButtonGroupItemProps): null;
211
227
  declare namespace ButtonGroupItem {
212
228
  let displayName: string;
213
229
  }
230
+ /**
231
+ * Option marker consumed by ButtonGroup; it does not render a DOM element.
232
+ */
233
+ type ButtonGroupItemProps = {
234
+ /**
235
+ * - Label used when label is omitted.
236
+ */
237
+ children?: React.ReactNode;
238
+ /**
239
+ * - Main label for the option.
240
+ */
241
+ label?: React.ReactNode;
242
+ /**
243
+ * - Optional leading element.
244
+ */
245
+ startAdornment?: React.ReactNode;
246
+ /**
247
+ * - Optional trailing element.
248
+ */
249
+ endAdornment?: React.ReactNode;
250
+ /**
251
+ * - Legacy trailing-element alias.
252
+ */
253
+ endIcon?: React.ReactNode;
254
+ /**
255
+ * - Selection value; defaults to the option index.
256
+ */
257
+ value?: string | number;
258
+ /**
259
+ * - Whether the option is disabled.
260
+ */
261
+ disabled?: boolean;
262
+ };
214
263
 
215
264
  /**
216
265
  * ButtonCounter (stepper) component.
package/dist/index.d.ts CHANGED
@@ -207,10 +207,59 @@ type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" |
207
207
  isStretched?: boolean;
208
208
  };
209
209
 
210
- declare function ButtonGroupItem(_props: any): any;
210
+ /**
211
+ * Option marker consumed by ButtonGroup; it does not render a DOM element.
212
+ *
213
+ * @typedef {Object} ButtonGroupItemProps
214
+ * @property {React.ReactNode} [children] - Label used when label is omitted.
215
+ * @property {React.ReactNode} [label] - Main label for the option.
216
+ * @property {React.ReactNode} [startAdornment] - Optional leading element.
217
+ * @property {React.ReactNode} [endAdornment] - Optional trailing element.
218
+ * @property {React.ReactNode} [endIcon] - Legacy trailing-element alias.
219
+ * @property {string|number} [value] - Selection value; defaults to the option index.
220
+ * @property {boolean} [disabled] - Whether the option is disabled.
221
+ */
222
+ /**
223
+ * @param {ButtonGroupItemProps} _props
224
+ * @returns {null}
225
+ */
226
+ declare function ButtonGroupItem(_props: ButtonGroupItemProps): null;
211
227
  declare namespace ButtonGroupItem {
212
228
  let displayName: string;
213
229
  }
230
+ /**
231
+ * Option marker consumed by ButtonGroup; it does not render a DOM element.
232
+ */
233
+ type ButtonGroupItemProps = {
234
+ /**
235
+ * - Label used when label is omitted.
236
+ */
237
+ children?: React.ReactNode;
238
+ /**
239
+ * - Main label for the option.
240
+ */
241
+ label?: React.ReactNode;
242
+ /**
243
+ * - Optional leading element.
244
+ */
245
+ startAdornment?: React.ReactNode;
246
+ /**
247
+ * - Optional trailing element.
248
+ */
249
+ endAdornment?: React.ReactNode;
250
+ /**
251
+ * - Legacy trailing-element alias.
252
+ */
253
+ endIcon?: React.ReactNode;
254
+ /**
255
+ * - Selection value; defaults to the option index.
256
+ */
257
+ value?: string | number;
258
+ /**
259
+ * - Whether the option is disabled.
260
+ */
261
+ disabled?: boolean;
262
+ };
214
263
 
215
264
  /**
216
265
  * ButtonCounter (stepper) component.
@@ -0,0 +1,25 @@
1
+ # ButtonGroup option types
2
+
3
+ `ButtonGroupItem` is an option marker read by `ButtonGroup`. It accepts `value`
4
+ (string or number), `disabled` (boolean), `label`, `children`, `startAdornment`,
5
+ `endAdornment`, and the legacy `endIcon` alias. Omitted values use the option's
6
+ index. The label falls back to children, then an automatically numbered label.
7
+
8
+ The marker renders no DOM element. It does not forward a ref, native button
9
+ attributes, or event handlers. Put selection handling on `ButtonGroup.onChange`,
10
+ which receives the selected value and option. The group forwards a div ref and
11
+ native div attributes. Use `Button` for a native button ref, attributes, and events.
12
+
13
+ ```tsx
14
+ <ButtonGroup defaultValue="draft" onChange={(value) => setFilter(value)}>
15
+ <ButtonGroupItem value="draft">Draft</ButtonGroupItem>
16
+ <ButtonGroupItem value="published" endAdornment={<span>3</span>}>
17
+ Published
18
+ </ButtonGroupItem>
19
+ <ButtonGroupItem value="archived" disabled>Archived</ButtonGroupItem>
20
+ </ButtonGroup>
21
+ ```
22
+
23
+ The package-local `test/button-group-api.tsx` fixture checks the public entry point
24
+ under strict TypeScript, including no-`any` assertions, native button refs/events,
25
+ selection values, disabled options, and rejection of unsupported marker props.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edux-design/buttons",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -25,8 +25,6 @@
25
25
  "dist",
26
26
  "docs",
27
27
  "README.md",
28
- "CHANGELOG.md",
29
- "LICENSE",
30
- "LICENSE.md"
28
+ "CHANGELOG.md"
31
29
  ]
32
30
  }