{"version":3,"file":"/Users/anthonygubler/development/dojo-org/widgets/src/number-input/index.tsx","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,SAAqD,MAAM,eAAe,CAAC;AAClF,OAAO,KAAK,YAAY,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,cAAc,MAAM,qCAAqC,CAAC;AAatE,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KAC/B,UAAU,EAAyB;KACnC,QAAQ,EAAiC,CAAC;AAE5C,eAAe,OAAO,CAAC,SAAS,WAAW,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE;IAC1F,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;IAEtD,SAAS,cAAc,CAAC,aAAiC;QACxD,IAAI,CAAC,OAAO,EAAE;YACb,OAAO;SACP;QACD,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,KAAK,EAAE,EAAE;YACxD,OAAO,EAAE,CAAC;SACV;aAAM;YACN,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;SACnC;IACF,CAAC;IAED,OAAO,CACN,IAAC,SAAS,oBACL,UAAU,EAAE,IAChB,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,EAC/C,YAAY,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,EAAE,EAC3E,OAAO,EAAE,cAAc,EACvB,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,KAAK,CAAC,OAAO,CACnB,YAAY,EACZ,cAAc,CACd,KAEA,QAAQ,EAAE,CAAC,CAAC,CAAC,CACH,CACZ,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { create, tsx } from '@dojo/framework/core/vdom';\n\nimport theme from '../middleware/theme';\nimport TextInput, { BaseInputProperties, TextInputChildren } from '../text-input';\nimport * as textInputCss from '../theme/default/text-input.m.css';\nimport * as numberInputCss from '../theme/default/number-input.m.css';\n\nexport interface NumberInputProperties extends BaseInputProperties<{ value: number }> {\n\t/** The min value a number can be */\n\tmin?: number;\n\t/** The max value a number can be */\n\tmax?: number;\n\t/** The step to increment the number value by */\n\tstep?: number;\n\t/** Represents if the input value is valid */\n\tvalid?: { valid?: boolean; message?: string } | boolean;\n}\n\nconst factory = create({ theme })\n\t.properties<NumberInputProperties>()\n\t.children<TextInputChildren | undefined>();\n\nexport default factory(function NumberInput({ properties, children, middleware: { theme } }) {\n\tconst { initialValue, value, onValue } = properties();\n\n\tfunction onValueAdapter(valueAsString: string | undefined) {\n\t\tif (!onValue) {\n\t\t\treturn;\n\t\t}\n\t\tif (valueAsString === undefined || valueAsString === '') {\n\t\t\tonValue();\n\t\t} else {\n\t\t\tonValue(parseFloat(valueAsString));\n\t\t}\n\t}\n\n\treturn (\n\t\t<TextInput\n\t\t\t{...properties()}\n\t\t\tvalue={value === undefined ? value : `${value}`}\n\t\t\tinitialValue={initialValue === undefined ? initialValue : `${initialValue}`}\n\t\t\tonValue={onValueAdapter}\n\t\t\ttype=\"number\"\n\t\t\ttheme={theme.compose(\n\t\t\t\ttextInputCss,\n\t\t\t\tnumberInputCss\n\t\t\t)}\n\t\t>\n\t\t\t{children()[0]}\n\t\t</TextInput>\n\t);\n});\n"]}