diff --git a/next-docs/pages/components/input.tsx b/next-docs/pages/components/input.tsx index 35527ecd09..2234263080 100644 --- a/next-docs/pages/components/input.tsx +++ b/next-docs/pages/components/input.tsx @@ -4,6 +4,7 @@ import type { ComponentNames } from '../../components/getComponent'; import Layout from '../../components/Layout'; import PropsTable from '../../components/PropsTable'; import Bg from '../../public/examples/input/Bg'; +import Controled from '../../public/examples/input/Controled'; import Default from '../../public/examples/input/Default'; import Sizes from '../../public/examples/input/Sizes'; import States from '../../public/examples/input/States'; @@ -54,6 +55,11 @@ const PageInput = () => { preview={} code={examples ? examples.Types : 'Loading'} /> + } + code={examples ? examples.Controled : 'Loading'} + /> { + const [color, setColor] = useState('FFFFFF'); + return ( + + { + setColor(e.target.value); + }} + /> + + Result: {color} + + + ); +}; + +export default Example; diff --git a/next-docs/public/examples/input/CustomDate.tsx b/next-docs/public/examples/input/CustomDate.tsx new file mode 100644 index 0000000000..d18b21062e --- /dev/null +++ b/next-docs/public/examples/input/CustomDate.tsx @@ -0,0 +1,56 @@ +//This exemple should be discussed about separate date-picker component +import { Input, Label } from '@heathmont/moon-core-tw'; +import { TimeCalendarDate } from '@heathmont/moon-icons-tw'; + +const Example = () => ( + <> + + + Date with placeholder + + { + e.target.type = 'date'; + e.target?.showPicker(); + }} + onBlur={(e) => (e.target.type = 'text')} + /> + + + + + + + Time + + { + e.target.type = 'time'; + e.target?.showPicker(); + }} + onBlur={(e) => (e.target.type = 'text')} + /> + + + + + Datetime local + + + + > +); + +export default Example; diff --git a/next-docs/public/examples/input/__tests__/__snapshots__/index.test.tsx.snap b/next-docs/public/examples/input/__tests__/__snapshots__/index.test.tsx.snap index ea0f0a3c02..84cc62364d 100644 --- a/next-docs/public/examples/input/__tests__/__snapshots__/index.test.tsx.snap +++ b/next-docs/public/examples/input/__tests__/__snapshots__/index.test.tsx.snap @@ -123,6 +123,113 @@ Object { } `; +exports[`Input in RTL renders Controled 1`] = ` +Object { + "asFragment": [Function], + "baseElement": + + + + + + + Result: + + + FFFFFF + + + + + , + "container": + + + + + + Result: + + + FFFFFF + + + + , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + exports[`Input in RTL renders Default 1`] = ` Object { "asFragment": [Function], @@ -1064,6 +1171,105 @@ Object { } `; +exports[`Input renders Controled 1`] = ` +Object { + "asFragment": [Function], + "baseElement": + + + + + + Result: + + + FFFFFF + + + + , + "container": + + + + + Result: + + + FFFFFF + + + , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + exports[`Input renders Default 1`] = ` Object { "asFragment": [Function], diff --git a/next-docs/public/examples/input/__tests__/index.test.tsx b/next-docs/public/examples/input/__tests__/index.test.tsx index 0c22827837..35913cd9e7 100644 --- a/next-docs/public/examples/input/__tests__/index.test.tsx +++ b/next-docs/public/examples/input/__tests__/index.test.tsx @@ -8,6 +8,7 @@ import Default from '../Default'; import Sizes from '../Sizes'; import Types from '../Types'; import States from '../States'; +import Controled from '../Controled'; const withRtl = (component: JSX.Element) => {component}; @@ -33,6 +34,10 @@ describe('Input', () => { const tree = render(); expect(tree).toMatchSnapshot(); }); + it('renders Controled', () => { + const tree = render(); + expect(tree).toMatchSnapshot(); + }); }); describe('Input in RTL', () => { @@ -57,4 +62,8 @@ describe('Input in RTL', () => { const tree = render(withRtl()); expect(tree).toMatchSnapshot(); }); + it('renders Controled', () => { + const tree = render(withRtl()); + expect(tree).toMatchSnapshot(); + }); });
+ Result: {color} +
+ + Result: + + + FFFFFF +