@toptal/picasso-forms 73.0.18 → 73.0.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,eAAe,CAAA;AAI7D,oBAAY,KAAK,GAAG,gBAAgB,GAClC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GACrC,eAAe,CAAA;AAOjB,eAAO,MAAM,WAAW;YAAW,KAAK;;;
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,eAAe,CAAA;AAI7D,oBAAY,KAAK,GAAG,gBAAgB,GAClC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GACrC,eAAe,CAAA;AAOjB,eAAO,MAAM,WAAW;YAAW,KAAK;;;CA6CvC,CAAA;AAMD,eAAe,WAAW,CAAA"}
|
|
@@ -27,7 +27,7 @@ export const NumberInput = (props) => {
|
|
|
27
27
|
return `Must be greater than or equal to ${min}.`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
return (React.createElement(InputField, Object.assign({}, rest, { validate: composeValidators([validateNumberLimits, validate]), label: label ? (React.createElement(FieldLabel, { name: props.name, required: props.required, label: label, labelEndAdornment: labelEndAdornment, titleCase: titleCase })) : null }), (inputProps) => {
|
|
30
|
+
return (React.createElement(InputField, Object.assign({ min: min, max: max }, rest, { validate: composeValidators([validateNumberLimits, validate]), label: label ? (React.createElement(FieldLabel, { name: props.name, required: props.required, label: label, labelEndAdornment: labelEndAdornment, titleCase: titleCase })) : null }), (inputProps) => {
|
|
31
31
|
return React.createElement(PicassoNumberInput, Object.assign({}, inputProps));
|
|
32
32
|
}));
|
|
33
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGhF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGrC,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,UAAU,MAAM,eAAe,CAAA;AAMtC,MAAM,GAAG,GAAG,CAAC,UAAU,CAAA;AACvB,MAAM,GAAG,GAAG,UAAU,CAAA;AAEtB,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAA;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;IAC1C,MAAM,EACJ,GAAG,GAAG,GAAG,EACT,GAAG,GAAG,GAAG,EACT,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,SAAS,KAEP,KAAK,EADJ,IAAI,UACL,KAAK,EARH,qEAQL,CAAQ,CAAA;IAET,MAAM,oBAAoB,GAEtB,KAAK,CAAC,EAAE;QACV,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE;YACvB,OAAO,iCAAiC,GAAG,GAAG,CAAA;SAC/C;QACD,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE;YACvB,OAAO,oCAAoC,GAAG,GAAG,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,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,SAAS,GACpB,CACH,CAAC,CAAC,CAAC,IAAI,KAGT,CAAC,UAA4B,EAAE,EAAE;QAChC,OAAO,oBAAC,kBAAkB,oBAAK,UAAU,EAAI,CAAA;IAC/C,CAAC,CACU,CACd,CAAA;AACH,CAAC,CAAA;AAED,WAAW,CAAC,YAAY,GAAG,EAAE,CAAA;AAE7B,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC,eAAe,WAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@toptal/picasso-test-utils'
|
|
3
|
+
|
|
4
|
+
import { FormCompound as Form } from '../FormCompound'
|
|
5
|
+
import { NumberInput, type Props } from './NumberInput'
|
|
6
|
+
|
|
7
|
+
const numberInputMock = jest.fn()
|
|
8
|
+
|
|
9
|
+
jest.mock('@toptal/picasso-number-input', () => ({
|
|
10
|
+
...jest.requireActual('@toptal/picasso-number-input'),
|
|
11
|
+
NumberInput: (props: any) => numberInputMock(props),
|
|
12
|
+
}))
|
|
13
|
+
|
|
14
|
+
const renderFormWithNumberInput = (props: Props) =>
|
|
15
|
+
render(
|
|
16
|
+
<Form.ConfigProvider value={{}}>
|
|
17
|
+
<Form onSubmit={() => {}}>
|
|
18
|
+
<NumberInput label='Test' data-testid='number-input' {...props} />
|
|
19
|
+
</Form>
|
|
20
|
+
</Form.ConfigProvider>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
describe('Form.NumberInput', () => {
|
|
24
|
+
describe('when "min" and "max" props are provided', () => {
|
|
25
|
+
it('passes them to NumberInput', () => {
|
|
26
|
+
renderFormWithNumberInput({
|
|
27
|
+
min: '8',
|
|
28
|
+
max: '12',
|
|
29
|
+
name: 'test-input',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
expect(numberInputMock).toHaveBeenCalledTimes(1)
|
|
33
|
+
expect(numberInputMock).toHaveBeenCalledWith(
|
|
34
|
+
expect.objectContaining({
|
|
35
|
+
min: '8',
|
|
36
|
+
max: '12',
|
|
37
|
+
name: 'test-input',
|
|
38
|
+
})
|
|
39
|
+
)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})
|