@dhasdk/simple-ui 1.0.65 → 1.0.67
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 +23 -10
- package/index.css +1 -1
- package/index.js +17 -17
- package/index.mjs +1115 -1109
- 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.66 - added **`inline`** prop to **`RadioGroup`**, allows for a flex-row layout of RadioGroup items as opposed to the default flex-column layout
|
|
57
|
+
|
|
56
58
|
1.0.65 - changed **label** on **`Input`** component to a **`ReactNode`** type. Also updated **aria-label**
|
|
57
59
|
handling logic to compensate (dev can enter **aria-label** manually, if not present and label is of
|
|
58
60
|
type string, will use **label** as the **aria-label**).
|
|
@@ -1437,6 +1439,7 @@ Full list of props below
|
|
|
1437
1439
|
| 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. |
|
|
1438
1440
|
| 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. |
|
|
1439
1441
|
| dataTestId | string | Yes | undefined | A **'data-testid'** value that is applied to the fieldset element that wraps RadioGroup for testing purposes |
|
|
1442
|
+
| inline | boolean | Yes | false | If **`true`**, the radio group is layed out in a flex-row instead of a flex-column. |
|
|
1440
1443
|
| 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** |
|
|
1441
1444
|
| options | **`string`** | No | | Array of RadioOption objects that define the options available for selection. |
|
|
1442
1445
|
| selectedId | **`string`** | Yes | | A string value matching one of the passed in **`id`** values in the options array. This **`selectedId`** will be pre-selected. |
|
|
@@ -1445,20 +1448,30 @@ Full list of props below
|
|
|
1445
1448
|
|
|
1446
1449
|
- label:
|
|
1447
1450
|
|
|
1448
|
-
|
|
1451
|
+
```tsx
|
|
1452
|
+
twMerge(
|
|
1453
|
+
"flex items-center gap-1 cursor-pointer",
|
|
1454
|
+
inline ? "mr-4 mb-1" : "mb-2",
|
|
1455
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
1456
|
+
classNameLabel
|
|
1457
|
+
)
|
|
1458
|
+
```
|
|
1449
1459
|
|
|
1450
1460
|
- input:
|
|
1451
1461
|
|
|
1452
|
-
|
|
1462
|
+
```tsx
|
|
1463
|
+
appearance-none w-4 h-4 rounded-[50%] border border-black bg-clip-content
|
|
1464
|
+
checked:bg-black checked:p-[2.5px] checked:border-black
|
|
1465
|
+
```
|
|
1453
1466
|
|
|
1454
1467
|
|
|
1455
1468
|
2. Options interface
|
|
1456
1469
|
|
|
1457
1470
|
```ts
|
|
1458
1471
|
export type RadioOption = {
|
|
1472
|
+
id: string;
|
|
1459
1473
|
label: string;
|
|
1460
1474
|
value: string;
|
|
1461
|
-
id: string;
|
|
1462
1475
|
disabled?: boolean;
|
|
1463
1476
|
};
|
|
1464
1477
|
```
|
|
@@ -1471,12 +1484,12 @@ Basic RadioGroup
|
|
|
1471
1484
|
```jsx
|
|
1472
1485
|
const radioOptions: RadioOption[] = [
|
|
1473
1486
|
{
|
|
1474
|
-
id: 0,
|
|
1487
|
+
id: '0',
|
|
1475
1488
|
label: 'Option One',
|
|
1476
1489
|
value:'some-value'
|
|
1477
1490
|
},
|
|
1478
1491
|
{
|
|
1479
|
-
id: 1,
|
|
1492
|
+
id: '1',
|
|
1480
1493
|
label: 'Option Two',
|
|
1481
1494
|
value: 'some-value2'
|
|
1482
1495
|
}
|
|
@@ -1495,27 +1508,27 @@ RadioGroup w/ 5 options
|
|
|
1495
1508
|
|
|
1496
1509
|
const fiveRadioOptions: RadioOption[] = [
|
|
1497
1510
|
{
|
|
1498
|
-
id: 0,
|
|
1511
|
+
id: '0',
|
|
1499
1512
|
label: 'Option One',
|
|
1500
1513
|
value: 'some-value'
|
|
1501
1514
|
},
|
|
1502
1515
|
{
|
|
1503
|
-
id: 1,
|
|
1516
|
+
id: '1',
|
|
1504
1517
|
label: 'Option Two',
|
|
1505
1518
|
value: 'some-value2'
|
|
1506
1519
|
},
|
|
1507
1520
|
{
|
|
1508
|
-
id: 2,
|
|
1521
|
+
id: '2',
|
|
1509
1522
|
label: 'Option Three',
|
|
1510
1523
|
value: 'some-value3'
|
|
1511
1524
|
},
|
|
1512
1525
|
{
|
|
1513
|
-
id: 3,
|
|
1526
|
+
id: '3',
|
|
1514
1527
|
label: 'Option Four',
|
|
1515
1528
|
value: 'some-value4'
|
|
1516
1529
|
},
|
|
1517
1530
|
{
|
|
1518
|
-
id: 4,
|
|
1531
|
+
id: '4',
|
|
1519
1532
|
label: 'Option Five',
|
|
1520
1533
|
value: 'some-value5'
|
|
1521
1534
|
},
|