@dhasdk/simple-ui 1.0.60 → 1.0.62

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 CHANGED
@@ -53,6 +53,10 @@ Tooltip
53
53
 
54
54
  ## Changelog
55
55
 
56
+ 1.0.62 - fixed 'checked' and 'indeterminate' prop usage for CheckBox, updated documentation for CheckBox re their usage w/ CheckBox and CheckBoxGroup
57
+
58
+ 1.0.61 - added **selectedId** prop to **`RadioGroup`** as well as updated documentation with the **RadioOptions** interface
59
+
56
60
  1.0.60 - added **classNameSvgLine** and **classNameIcon** props to **`CheckBox`** the former to share duties with and more focus **classNameSvg**. The latter allows for positioning of the checkbox icon if needed.
57
61
 
58
62
  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
@@ -789,6 +793,8 @@ The **CheckBoxGroup** component can be optionally used with any number of **Chec
789
793
 
790
794
  **CheckBoxGroup** also takes three props that are directly passed down to **CheckBox**, allowing you to specify any of these values in one place instead of in each instance of **CheckBox**. These three props are all boolean values, described below. They are **`fill`**, **`icon`**, and **`marker`**.
791
795
 
796
+ **Note:** Using **checked** or **indeterminate** on a **`CheckBox`** inside a **`CheckBoxGroup`** will only effect that CheckBox and will not have an effect on the child or parent CheckBoxes as is done when an individual CheckBox is manually clicked inside a CheckBoxGroup. This can for example place a CheckBox in a checked state leaving its children unchecked. If you wish to use **checked** or **indeterminate** on a CheckBox inside a CheckBoxGroup, it is up to the developer to manage the values for all CheckBoxes in that group on initial state.
797
+
792
798
  Used by itself, **CheckBox** behaves as a normal checkbox component and can be used individually or in groups. It also takes the same attributes that a normal **`html input type="checkbox"`** would.
793
799
 
794
800
  ### Props for CheckBoxGroup
@@ -815,6 +821,7 @@ Used by itself, **CheckBox** behaves as a normal checkbox component and can be u
815
821
  | Prop | Type | Optional | Default | Description |
816
822
  | ----------- | -------- | -------- | -------- | ----------- |
817
823
  | ariaLabel | string | Yes | 'CheckBox Component' | The **aria-label** to assign to this CheckBox |
824
+ | checked | boolean | Yes | **`false`** | if present, checkbox is initially displayed in a 'checked' state. See above note for more information |
818
825
  | className | string | Yes | **`'flex items-center'`** | alternate css classes to add/change styling of the **div** that wraps the **input** element. |
819
826
  | classNameIcon | string | Yes | **`''`** | CSS classes that will be applied to the custom icon (non html default) that is the checkbox, indeterminate checkbox, or blank checkbox. Can be useful for positioning, etc. |
820
827
  | classNameInput | string | Yes | **`''`** | alternate css classes to add/change styling of the **input** html element. |
@@ -825,6 +832,7 @@ Used by itself, **CheckBox** behaves as a normal checkbox component and can be u
825
832
  | dataTestId | string | Yes | undefined | A **'data-testid'** value that is applied to the div element that wraps the CheckBox component for testing purposes |
826
833
  | fill | boolean | Yes | {false} | specifies using the **fill** variant or not. If used, the checkbox itself will have a darker solid background. |
827
834
  | icon | boolean | Yes | {true} | When true (default value) this prop will utilize one of two UX created icons to represent a checked, indeterminate, and blank checkbox. When **marker** is true as well, a marker icon is used in place of the checked. |
835
+ | indeterminate | boolean | Yes | **`false`** | if present, checkbox is initially displayed in an 'indeterminate' state. See above note for more information |
828
836
  | marker | boolean | Yes | {false} | When true this boolean will cause the normal checked checkbox to instead display an 'x' marker icon. |
829
837
  | ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
830
838
  | ref | string | Yes | undefined | ref is exposed as a prop, and can be assigned and used on this component as normal |
@@ -1052,7 +1060,7 @@ A reference can also be created and passed to the input component, and the compo
1052
1060
 
1053
1061
  ### Additional Properties & Attributes
1054
1062
 
1055
- This component as mentioned also takes any other property or attribute that a normnal input form field would take, including the **required** property. Setting this property to true will not only requires this input field to have a value for form completion, but also adds an asterisk to the beginning of the label.
1063
+ This component as mentioned also takes any other property or attribute that a normal input form field would take, including the **required** property. Setting this property to true will not only requires this input field to have a value for form completion, but also adds an asterisk to the beginning of the label.
1056
1064
 
1057
1065
  ### Example Usage
1058
1066
 
@@ -1421,6 +1429,7 @@ Full list of props below
1421
1429
  | dataTestId | string | Yes | undefined | A **'data-testid'** value that is applied to the fieldset element that wraps RadioGroup for testing purposes |
1422
1430
  | 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** |
1423
1431
  | options | **`string`** | No | | Array of RadioOption objects that define the options available for selection. |
1432
+ | selectedId | **`string`** | Yes | | A string value matching one of the passed in **`id`** values in the options array. This **`selectedId`** will be pre-selected. |
1424
1433
 
1425
1434
  1. Base CSS Classes
1426
1435
 
@@ -1433,6 +1442,18 @@ Full list of props below
1433
1442
  **`appearance-none w-4 h-4 rounded-[50%] border border-black bg-clip-content checked:bg-black checked:p-[2.5px] checked:border-black`**
1434
1443
 
1435
1444
 
1445
+ 2. Options interface
1446
+
1447
+ ```ts
1448
+ export type RadioOption = {
1449
+ label: string;
1450
+ value: string;
1451
+ id: string;
1452
+ disabled?: boolean;
1453
+ };
1454
+ ```
1455
+
1456
+
1436
1457
  ### Example Usage
1437
1458
 
1438
1459
  Basic RadioGroup