File tree Expand file tree Collapse file tree 2 files changed +68
-1
lines changed
src/components/widgets/TextWidget Expand file tree Collapse file tree 2 files changed +68
-1
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,67 @@ Default.args = {
1313 name : Type . String ( { title : 'Name' , description : 'description' } ) ,
1414 } ) ,
1515}
16+
17+ export const Number = DefaultStory . bind ( { } )
18+ Number . args = {
19+ schema : Type . Object ( {
20+ name : Type . Number ( { title : 'Number' , description : 'description' } ) ,
21+ } ) ,
22+ }
23+
24+ export const Integer = DefaultStory . bind ( { } )
25+ Integer . args = {
26+ schema : Type . Object ( {
27+ name : Type . Integer ( { title : 'Integer' , description : 'description' } ) ,
28+ } ) ,
29+ }
30+
31+ export const Limited = DefaultStory . bind ( { } )
32+ Limited . args = {
33+ schema : Type . Object ( {
34+ name : Type . Integer ( {
35+ title : 'Limited' ,
36+ minimum : 0 ,
37+ maximum : 10 ,
38+ description : 'min 0 - max 10' ,
39+ } ) ,
40+ } ) ,
41+ }
42+
43+ export const Multiple = DefaultStory . bind ( { } )
44+ Multiple . args = {
45+ schema : Type . Object ( {
46+ name : Type . Integer ( {
47+ title : 'Multiple' ,
48+ minimum : 0 ,
49+ maximum : 10 ,
50+ multipleOf : 2 ,
51+ description : '0-2 multiple of 2' ,
52+ } ) ,
53+ } ) ,
54+ }
55+
56+ export const LimitedFloat = DefaultStory . bind ( { } )
57+ LimitedFloat . args = {
58+ schema : Type . Object ( {
59+ name : Type . Number ( {
60+ title : 'Float' ,
61+ minimum : 0 ,
62+ maximum : 1 ,
63+ description : 'between 0 and 1' ,
64+ } ) ,
65+ } ) ,
66+ }
67+
68+ export const MultipleFloat = DefaultStory . bind ( { } )
69+ MultipleFloat . args = {
70+ schema : Type . Object ( {
71+ name : Type . Number ( {
72+ title : 'Multiple Float' ,
73+ minimum : 0 ,
74+ maximum : 1 ,
75+ multipleOf : 0.01 ,
76+ description : 'between 0 and 1, multiple of 0.01' ,
77+ } ) ,
78+ } ) ,
79+ }
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ export const TextWidget: FC<TextWidgetProps> = ({
6060
6161 const inputType = getInputType ( type ?? schema . type ?? 'string' )
6262
63- const rangeProps = inputType === 'number' ? { ...rangeSpec ( schema ) } : { }
63+ const rangeProps =
64+ inputType === 'number'
65+ ? { step : schema . type === 'integer' ? '1' : 'any' , ...rangeSpec ( schema ) }
66+ : { }
6467
6568 return (
6669 < Input
You can’t perform that action at this time.
0 commit comments