File tree Expand file tree Collapse file tree 6 files changed +51
-9
lines changed
packages/snaps-sdk/src/jsx/components/form Expand file tree Collapse file tree 6 files changed +51
-9
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { createSnapComponent } from '../../component';
88 * @property checked - Whether the checkbox is checked or not.
99 * @property label - An optional label for the checkbox.
1010 * @property variant - An optional variant for the checkbox.
11- * @property disabled - Whether the Checkbox is disabled.
11+ * @property disabled - Whether the checkbox is disabled.
1212 */
1313export type CheckboxProps = {
1414 name : string ;
@@ -29,7 +29,7 @@ const TYPE = 'Checkbox';
2929 * @param props.checked - Whether the checkbox is checked or not.
3030 * @param props.label - An optional label for the checkbox.
3131 * @param props.variant - An optional variant for the checkbox.
32- * @param props.disabled - Whether the Checkbox is disabled.
32+ * @param props.disabled - Whether the checkbox is disabled.
3333 * @returns A checkbox element.
3434 * @example
3535 * <Checkbox name="accept-terms" />
Original file line number Diff line number Diff line change @@ -66,4 +66,41 @@ describe('Dropdown', () => {
6666 key : null ,
6767 } ) ;
6868 } ) ;
69+
70+ it ( 'renders disabled dropdown with options' , ( ) => {
71+ const result = (
72+ < Dropdown name = "dropdown" value = "foo" disabled = { true } >
73+ < Option value = "foo" > Foo</ Option >
74+ < Option value = "bar" > Bar</ Option >
75+ </ Dropdown >
76+ ) ;
77+
78+ expect ( result ) . toStrictEqual ( {
79+ type : 'Dropdown' ,
80+ props : {
81+ name : 'dropdown' ,
82+ value : 'foo' ,
83+ disabled : true ,
84+ children : [
85+ {
86+ type : 'Option' ,
87+ props : {
88+ value : 'foo' ,
89+ children : 'Foo' ,
90+ } ,
91+ key : null ,
92+ } ,
93+ {
94+ type : 'Option' ,
95+ props : {
96+ value : 'bar' ,
97+ children : 'Bar' ,
98+ } ,
99+ key : null ,
100+ } ,
101+ ] ,
102+ } ,
103+ key : null ,
104+ } ) ;
105+ } ) ;
69106} ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import type { OptionElement } from './Option';
99 * state in the form data.
1010 * @property value - The selected value of the dropdown.
1111 * @property children - The children of the dropdown.
12- * @property disabled - Whether the Dropdown is disabled.
12+ * @property disabled - Whether the dropdown is disabled.
1313 */
1414export type DropdownProps = {
1515 name : string ;
@@ -28,7 +28,7 @@ const TYPE = 'Dropdown';
2828 * state in the form data.
2929 * @param props.value - The selected value of the dropdown.
3030 * @param props.children - The children of the dropdown.
31- * @param props.disabled - Whether the Dropdown is disabled.
31+ * @param props.disabled - Whether the dropdown is disabled.
3232 * @returns A dropdown element.
3333 * @example
3434 * <Dropdown name="dropdown">
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { createSnapComponent } from '../../component';
66 * @property value - The value of the radio option. This is used to populate the
77 * state in the form data.
88 * @property children - The text to display.
9- * @property disabled - Whether the Radio is disabled.
9+ * @property disabled - Whether the radio is disabled.
1010 */
1111type RadioProps = {
1212 value : string ;
@@ -24,7 +24,7 @@ const TYPE = 'Radio';
2424 * @param props.value - The value of the radio option. This is used to populate the
2525 * state in the form data.
2626 * @param props.children - The text to display.
27- * @param props.disabled - Whether the Radio is disabled.
27+ * @param props.disabled - Whether the radio is disabled.
2828 * @returns A radio element.
2929 * @example
3030 * <RadioGroup name="radio-group">
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const TYPE = 'RadioGroup';
1111 * state in the form data.
1212 * @property value - The value of the radio group element.
1313 * @property children - Radio options in form of <Radio> elements.
14- * @property disabled - Whether the RadioGroup is disabled.
14+ * @property disabled - Whether the radio group is disabled.
1515 */
1616type RadioGroupProps = {
1717 name : string ;
@@ -23,6 +23,11 @@ type RadioGroupProps = {
2323/**
2424 * A RadioGroup component, used to display multiple choices, where only one can be chosen.
2525 *
26+ * @param props.name - The name of the dropdown. This is used to identify the
27+ * state in the form data.
28+ * @param props.value - The value of the radio group element.
29+ * @param props.children - Radio options in form of <Radio> elements.
30+ * @param props.disabled - Whether the radio group is disabled.
2631 * @returns A RadioGroup element.
2732 * @example
2833 * <RadioGroup />
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import type { SelectorOptionElement } from './SelectorOption';
1010 * @property title - The title of the selector. This is displayed in the UI.
1111 * @property value - The selected value of the selector.
1212 * @property children - The children of the selector.
13- * @property disabled - Whether the Selector is disabled.
13+ * @property disabled - Whether the selector is disabled.
1414 */
1515export type SelectorProps = {
1616 name : string ;
@@ -31,7 +31,7 @@ const TYPE = 'Selector';
3131 * @param props.title - The title of the selector field. This is displayed in the UI.
3232 * @param props.value - The selected value of the selector.
3333 * @param props.children - The children of the selector.
34- * @property disabled - Whether the Selector is disabled.
34+ * @property disabled - Whether the selector is disabled.
3535 * @returns A selector element.
3636 * @example
3737 * <Selector name="selector">
You can’t perform that action at this time.
0 commit comments