@dhasdk/simple-ui 1.0.58 → 1.0.59
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/README.md +25 -0
- package/index.js +15 -15
- package/index.mjs +637 -636
- package/lib/RadioGroup.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ Tooltip
|
|
|
53
53
|
|
|
54
54
|
## Changelog
|
|
55
55
|
|
|
56
|
+
1.0.59 - added **method** property to the **RadioOption** type for RadioGroup, allowing user to pass in a callback method for checked/unchecked state changes
|
|
57
|
+
|
|
56
58
|
1.0.58 - removed console.log statement from **`RadioGroup`** component
|
|
57
59
|
|
|
58
60
|
1.0.57 - added **`className`** prop to **`ProgressBar`** to style the outer div that is the container
|
|
@@ -1398,6 +1400,7 @@ This component takes multiple optional props in addition to any other html attri
|
|
|
1398
1400
|
|
|
1399
1401
|
See **example usage** below for an example of retrieving the selected radio item.
|
|
1400
1402
|
|
|
1403
|
+
The **method** prop allows for a callback method that is called for every change on a radio item in the group. Example below.
|
|
1401
1404
|
|
|
1402
1405
|
Full list of props below
|
|
1403
1406
|
|
|
@@ -1410,6 +1413,7 @@ Full list of props below
|
|
|
1410
1413
|
| classNameInput | **`string`** | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the input element of the component. |
|
|
1411
1414
|
| classNameLabel | **`string`** | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the label element of the component. |
|
|
1412
1415
|
| dataTestId | string | Yes | undefined | A **'data-testid'** value that is applied to the fieldset element that wraps RadioGroup for testing purposes |
|
|
1416
|
+
| method | (id: string, value: string) => void | Yes | undefined | A callback method that is called anytime a radio item is clicked on. The value **`method={(id, value) => console.log("id/value: " + id + "/" + value)}`** might print something like **id/value: 2/value-2** |
|
|
1413
1417
|
| options | **`string`** | No | | Array of RadioOption objects that define the options available for selection. |
|
|
1414
1418
|
|
|
1415
1419
|
1. Base CSS Classes
|
|
@@ -1490,6 +1494,27 @@ Example checking radio items for checked state
|
|
|
1490
1494
|
console.log(radio?.checked);
|
|
1491
1495
|
```
|
|
1492
1496
|
|
|
1497
|
+
Using a callback method
|
|
1498
|
+
|
|
1499
|
+
```jsx
|
|
1500
|
+
const radioOptions: RadioOption[] = [
|
|
1501
|
+
{
|
|
1502
|
+
label: 'Option One',
|
|
1503
|
+
value:'item-1',
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
label: 'Option Two',
|
|
1507
|
+
value: 'item-2',
|
|
1508
|
+
}
|
|
1509
|
+
]
|
|
1510
|
+
|
|
1511
|
+
<RadioGroup title="Radio Title"
|
|
1512
|
+
options={radioOptions}
|
|
1513
|
+
method={(id, value) => console.log("id/value: " + id + "/" + value)}
|
|
1514
|
+
// would print "id/value 1/item-1" or "id/value 2/item-2"
|
|
1515
|
+
/>
|
|
1516
|
+
```
|
|
1517
|
+
|
|
1493
1518
|
### Dependencies
|
|
1494
1519
|
|
|
1495
1520
|
**_none_**
|