@digigov/react-core 0.22.1 → 0.23.1
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.
- package/AccordionSectionSummaryHeading/index.js +2 -22
- package/CHANGELOG.md +16 -1
- package/Nav/__snapshots__/index.test.tsx.snap +4 -4
- package/Nav/index.js +1 -1
- package/NavList/__snapshots__/index.test.tsx.snap +4 -4
- package/NavList/index.d.ts +1 -6
- package/NavList/index.js +2 -4
- package/NavListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/NavListItem/index.d.ts +1 -6
- package/NavListItem/index.js +2 -4
- package/NavListItemButton/__snapshots__/index.test.tsx.snap +9 -9
- package/NavListItemButton/index.js +1 -1
- package/NavListItemLink/__snapshots__/index.test.tsx.snap +15 -24
- package/NavListItemLink/index.js +2 -3
- package/NavMenu/__snapshots__/index.test.tsx.snap +2 -2
- package/NavMenu/index.js +1 -1
- package/NavMenuContainer/index.js +1 -3
- package/NavMenuContainerContent/index.js +1 -3
- package/NavMenuContainerContentList/__snapshots__/index.test.tsx.snap +2 -2
- package/NavMenuContainerContentList/index.d.ts +1 -6
- package/NavMenuContainerContentList/index.js +2 -4
- package/NavMenuContainerContentListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/NavMenuContainerContentListItem/index.js +1 -1
- package/NavMenuContainerTitle/index.d.ts +1 -6
- package/NavMenuContainerTitle/index.js +3 -5
- package/SingleCharacterInputContainer/__snapshots__/index.test.tsx.snap +16 -0
- package/SingleCharacterInputContainer/index.d.ts +11 -0
- package/SingleCharacterInputContainer/index.js +40 -0
- package/SingleCharacterInputContainer/index.test.d.ts +1 -0
- package/SingleCharacterInputContainer/index.test.js +15 -0
- package/SingleCharacterInputItem/__snapshots__/index.test.tsx.snap +173 -0
- package/SingleCharacterInputItem/index.d.ts +32 -0
- package/SingleCharacterInputItem/index.js +50 -0
- package/SingleCharacterInputItem/index.test.d.ts +1 -0
- package/SingleCharacterInputItem/index.test.js +68 -0
- package/es/AccordionSectionSummaryHeading/index.js +2 -14
- package/es/Nav/__snapshots__/index.test.tsx.snap +4 -4
- package/es/Nav/index.js +1 -1
- package/es/NavList/__snapshots__/index.test.tsx.snap +4 -4
- package/es/NavList/index.js +2 -4
- package/es/NavListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/es/NavListItem/index.js +2 -4
- package/es/NavListItemButton/__snapshots__/index.test.tsx.snap +9 -9
- package/es/NavListItemButton/index.js +1 -1
- package/es/NavListItemLink/__snapshots__/index.test.tsx.snap +15 -24
- package/es/NavListItemLink/index.js +2 -3
- package/es/NavMenu/__snapshots__/index.test.tsx.snap +2 -2
- package/es/NavMenu/index.js +1 -1
- package/es/NavMenuContainer/index.js +1 -2
- package/es/NavMenuContainerContent/index.js +1 -2
- package/es/NavMenuContainerContentList/__snapshots__/index.test.tsx.snap +2 -2
- package/es/NavMenuContainerContentList/index.js +2 -4
- package/es/NavMenuContainerContentListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/es/NavMenuContainerContentListItem/index.js +1 -1
- package/es/NavMenuContainerTitle/index.js +3 -5
- package/es/SingleCharacterInputContainer/__snapshots__/index.test.tsx.snap +16 -0
- package/es/SingleCharacterInputContainer/index.js +24 -0
- package/es/SingleCharacterInputContainer/index.test.js +9 -0
- package/es/SingleCharacterInputItem/__snapshots__/index.test.tsx.snap +173 -0
- package/es/SingleCharacterInputItem/index.js +34 -0
- package/es/SingleCharacterInputItem/index.test.js +62 -0
- package/es/index.js +2 -0
- package/es/registry.js +4 -0
- package/esm/AccordionSectionSummaryHeading/index.js +2 -14
- package/esm/Nav/__snapshots__/index.test.tsx.snap +4 -4
- package/esm/Nav/index.js +1 -1
- package/esm/NavList/__snapshots__/index.test.tsx.snap +4 -4
- package/esm/NavList/index.js +2 -4
- package/esm/NavListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/NavListItem/index.js +2 -4
- package/esm/NavListItemButton/__snapshots__/index.test.tsx.snap +9 -9
- package/esm/NavListItemButton/index.js +1 -1
- package/esm/NavListItemLink/__snapshots__/index.test.tsx.snap +15 -24
- package/esm/NavListItemLink/index.js +2 -3
- package/esm/NavMenu/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/NavMenu/index.js +1 -1
- package/esm/NavMenuContainer/index.js +1 -2
- package/esm/NavMenuContainerContent/index.js +1 -2
- package/esm/NavMenuContainerContentList/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/NavMenuContainerContentList/index.js +2 -4
- package/esm/NavMenuContainerContentListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/NavMenuContainerContentListItem/index.js +1 -1
- package/esm/NavMenuContainerTitle/index.js +3 -5
- package/esm/SingleCharacterInputContainer/__snapshots__/index.test.tsx.snap +16 -0
- package/esm/SingleCharacterInputContainer/index.js +24 -0
- package/esm/SingleCharacterInputContainer/index.test.js +9 -0
- package/esm/SingleCharacterInputItem/__snapshots__/index.test.tsx.snap +173 -0
- package/esm/SingleCharacterInputItem/index.js +34 -0
- package/esm/SingleCharacterInputItem/index.test.js +62 -0
- package/esm/index.js +3 -1
- package/esm/registry.js +4 -0
- package/index.d.ts +2 -0
- package/index.js +26 -0
- package/package.json +2 -2
- package/registry.d.ts +2 -0
- package/registry.js +6 -0
- package/src/AccordionSectionSummaryHeading/index.tsx +1 -8
- package/src/Nav/__snapshots__/index.test.tsx.snap +4 -4
- package/src/Nav/index.tsx +7 -6
- package/src/NavList/__snapshots__/index.test.tsx.snap +4 -4
- package/src/NavList/index.tsx +3 -13
- package/src/NavListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/src/NavListItem/index.tsx +3 -13
- package/src/NavListItemButton/__snapshots__/index.test.tsx.snap +9 -9
- package/src/NavListItemButton/index.tsx +2 -2
- package/src/NavListItemLink/__snapshots__/index.test.tsx.snap +15 -24
- package/src/NavListItemLink/index.tsx +3 -3
- package/src/NavMenu/__snapshots__/index.test.tsx.snap +2 -2
- package/src/NavMenu/index.tsx +4 -3
- package/src/NavMenuContainer/index.tsx +1 -2
- package/src/NavMenuContainerContent/index.tsx +1 -2
- package/src/NavMenuContainerContentList/__snapshots__/index.test.tsx.snap +2 -2
- package/src/NavMenuContainerContentList/index.tsx +3 -13
- package/src/NavMenuContainerContentListItem/__snapshots__/index.test.tsx.snap +2 -2
- package/src/NavMenuContainerContentListItem/index.tsx +1 -1
- package/src/NavMenuContainerTitle/index.tsx +4 -14
- package/src/SingleCharacterInputContainer/__snapshots__/index.test.tsx.snap +16 -0
- package/src/SingleCharacterInputContainer/index.test.tsx +10 -0
- package/src/SingleCharacterInputContainer/index.tsx +32 -0
- package/src/SingleCharacterInputItem/__snapshots__/index.test.tsx.snap +173 -0
- package/src/SingleCharacterInputItem/index.test.tsx +45 -0
- package/src/SingleCharacterInputItem/index.tsx +63 -0
- package/src/index.ts +2 -0
- package/src/registry.js +4 -0
|
@@ -5,11 +5,11 @@ exports[`renders the NavMenu with no props 1`] = `
|
|
|
5
5
|
<ForwardRef(Base)
|
|
6
6
|
aria-hidden={true}
|
|
7
7
|
as="div"
|
|
8
|
-
className="govgr-nav-
|
|
8
|
+
className="govgr-nav-menu--horizontal govgr-nav-menu--hidden govgr-nav-menu"
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
11
|
aria-hidden={true}
|
|
12
|
-
className="govgr-nav-
|
|
12
|
+
className="govgr-nav-menu--horizontal govgr-nav-menu--hidden govgr-nav-menu"
|
|
13
13
|
>
|
|
14
14
|
hello
|
|
15
15
|
</div>
|
package/esm/NavMenu/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export var NavMenu = /*#__PURE__*/React.forwardRef(function NavMenu(_ref, ref) {
|
|
|
21
21
|
as: "div",
|
|
22
22
|
ref: ref,
|
|
23
23
|
"aria-hidden": !active,
|
|
24
|
-
className: clsx(className, layout === 'horizontal' && 'govgr-nav-
|
|
24
|
+
className: clsx(className, layout === 'horizontal' && 'govgr-nav-menu--horizontal', layout === 'vertical' && 'govgr-nav-menu--vertical', !active && 'govgr-nav-menu--hidden', true && 'govgr-nav-menu')
|
|
25
25
|
}, props), children);
|
|
26
26
|
});
|
|
27
27
|
export default NavMenu;
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "layout", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import Container from '@digigov/react-core/Container';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -19,7 +18,7 @@ export var NavMenuContainer = /*#__PURE__*/React.forwardRef(function NavMenuCont
|
|
|
19
18
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
20
19
|
cols: layout === 'horizontal',
|
|
21
20
|
ref: ref,
|
|
22
|
-
className:
|
|
21
|
+
className: className
|
|
23
22
|
}, props), children);
|
|
24
23
|
});
|
|
25
24
|
export default NavMenuContainer;
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import Grid from '@digigov/react-core/Grid';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -19,7 +18,7 @@ export var NavMenuContainerContent = /*#__PURE__*/React.forwardRef(function NavM
|
|
|
19
18
|
item: true,
|
|
20
19
|
md: 2,
|
|
21
20
|
ref: ref,
|
|
22
|
-
className:
|
|
21
|
+
className: className
|
|
23
22
|
}, props), children);
|
|
24
23
|
});
|
|
25
24
|
export default NavMenuContainerContent;
|
|
@@ -4,10 +4,10 @@ exports[`renders the NavMenuContainerContentList with no props 1`] = `
|
|
|
4
4
|
<ForwardRef(NavMenuContainerContentList)>
|
|
5
5
|
<ForwardRef(Base)
|
|
6
6
|
as="ul"
|
|
7
|
-
className="govgr-nav-
|
|
7
|
+
className="govgr-nav-menu__content-list"
|
|
8
8
|
>
|
|
9
9
|
<ul
|
|
10
|
-
className="govgr-nav-
|
|
10
|
+
className="govgr-nav-menu__content-list"
|
|
11
11
|
>
|
|
12
12
|
hello
|
|
13
13
|
</ul>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "
|
|
3
|
+
var _excluded = ["className", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Base from '@digigov/react-core/Base';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -11,15 +11,13 @@ import clsx from 'clsx';
|
|
|
11
11
|
*/
|
|
12
12
|
export var NavMenuContainerContentList = /*#__PURE__*/React.forwardRef(function NavMenuContainerContentList(_ref, ref) {
|
|
13
13
|
var className = _ref.className,
|
|
14
|
-
_ref$layout = _ref.layout,
|
|
15
|
-
layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
|
|
16
14
|
children = _ref.children,
|
|
17
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
16
|
|
|
19
17
|
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
20
18
|
as: "ul",
|
|
21
19
|
ref: ref,
|
|
22
|
-
className: clsx(className,
|
|
20
|
+
className: clsx(className, true && 'govgr-nav-menu__content-list')
|
|
23
21
|
}, props), children);
|
|
24
22
|
});
|
|
25
23
|
export default NavMenuContainerContentList;
|
|
@@ -4,10 +4,10 @@ exports[`renders the NavMenuContainerContentListItem with no props 1`] = `
|
|
|
4
4
|
<ForwardRef(NavMenuContainerContentListItem)>
|
|
5
5
|
<ForwardRef(Base)
|
|
6
6
|
as="li"
|
|
7
|
-
className="govgr-nav-
|
|
7
|
+
className="govgr-nav-menu__content-list-item"
|
|
8
8
|
>
|
|
9
9
|
<li
|
|
10
|
-
className="govgr-nav-
|
|
10
|
+
className="govgr-nav-menu__content-list-item"
|
|
11
11
|
>
|
|
12
12
|
hello
|
|
13
13
|
</li>
|
|
@@ -17,7 +17,7 @@ export var NavMenuContainerContentListItem = /*#__PURE__*/React.forwardRef(funct
|
|
|
17
17
|
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
18
18
|
as: "li",
|
|
19
19
|
ref: ref,
|
|
20
|
-
className: clsx(className, true && 'govgr-nav-
|
|
20
|
+
className: clsx(className, true && 'govgr-nav-menu__content-list-item')
|
|
21
21
|
}, props), children);
|
|
22
22
|
});
|
|
23
23
|
export default NavMenuContainerContentListItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "
|
|
3
|
+
var _excluded = ["className", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import Grid from '@digigov/react-core/Grid';
|
|
@@ -13,8 +13,6 @@ import Heading from '@digigov/react-core/Heading';
|
|
|
13
13
|
*/
|
|
14
14
|
export var NavMenuContainerTitle = /*#__PURE__*/React.forwardRef(function NavMenuContainerTitle(_ref, ref) {
|
|
15
15
|
var className = _ref.className,
|
|
16
|
-
_ref$layout = _ref.layout,
|
|
17
|
-
layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
|
|
18
16
|
children = _ref.children,
|
|
19
17
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
18
|
|
|
@@ -22,11 +20,11 @@ export var NavMenuContainerTitle = /*#__PURE__*/React.forwardRef(function NavMen
|
|
|
22
20
|
item: true,
|
|
23
21
|
md: 1,
|
|
24
22
|
ref: ref,
|
|
25
|
-
className: clsx(className,
|
|
23
|
+
className: clsx(className, true && 'govgr-nav-menu__container-title')
|
|
26
24
|
}, props), /*#__PURE__*/React.createElement(Heading, {
|
|
27
25
|
element: "h3",
|
|
28
26
|
size: "m",
|
|
29
|
-
className: clsx(
|
|
27
|
+
className: clsx(true && 'govgr-nav-menu__container-title-heading')
|
|
30
28
|
}, children));
|
|
31
29
|
});
|
|
32
30
|
export default NavMenuContainerTitle;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the SingleCharacterInputContainer with no props 1`] = `
|
|
4
|
+
<ForwardRef(SingleCharacterInputContainer)>
|
|
5
|
+
<ForwardRef(Base)
|
|
6
|
+
as="div"
|
|
7
|
+
className="govgr-single-character-input--container"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
className="govgr-single-character-input--container"
|
|
11
|
+
>
|
|
12
|
+
hello
|
|
13
|
+
</div>
|
|
14
|
+
</ForwardRef(Base)>
|
|
15
|
+
</ForwardRef(SingleCharacterInputContainer)>
|
|
16
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Base from '@digigov/react-core/Base';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Details for the SingleCharacterInputContainer.
|
|
10
|
+
* It is used as a parent component to wrap SingleCharacterInput component.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export var SingleCharacterInputContainer = /*#__PURE__*/React.forwardRef(function SingleCharacterInputContainer(_ref, ref) {
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
|
|
18
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
19
|
+
as: "div",
|
|
20
|
+
ref: ref,
|
|
21
|
+
className: clsx(className, true && 'govgr-single-character-input--container')
|
|
22
|
+
}, props), children);
|
|
23
|
+
});
|
|
24
|
+
export default SingleCharacterInputContainer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import SingleCharacterInputContainer from '@digigov/react-core/SingleCharacterInputContainer';
|
|
4
|
+
|
|
5
|
+
var _ref = /*#__PURE__*/React.createElement(SingleCharacterInputContainer, null, "hello");
|
|
6
|
+
|
|
7
|
+
it('renders the SingleCharacterInputContainer with no props', function () {
|
|
8
|
+
expect(mount(_ref)).toMatchSnapshot();
|
|
9
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the SingleCharacterInputItem with maxLength prop 1`] = `
|
|
4
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
5
|
+
maxLength={6}
|
|
6
|
+
>
|
|
7
|
+
<ForwardRef(Base)
|
|
8
|
+
as="input"
|
|
9
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
10
|
+
inputMode="numeric"
|
|
11
|
+
maxLength={6}
|
|
12
|
+
pattern="[0-9]*"
|
|
13
|
+
type="text"
|
|
14
|
+
>
|
|
15
|
+
<input
|
|
16
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
17
|
+
inputMode="numeric"
|
|
18
|
+
maxLength={6}
|
|
19
|
+
pattern="[0-9]*"
|
|
20
|
+
type="text"
|
|
21
|
+
/>
|
|
22
|
+
</ForwardRef(Base)>
|
|
23
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`renders the SingleCharacterInputItem with name and error props 1`] = `
|
|
27
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
28
|
+
error={true}
|
|
29
|
+
name="single-character-input"
|
|
30
|
+
>
|
|
31
|
+
<ForwardRef(Base)
|
|
32
|
+
as="input"
|
|
33
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
34
|
+
inputMode="numeric"
|
|
35
|
+
maxLength={1}
|
|
36
|
+
name="single-character-input"
|
|
37
|
+
pattern="[0-9]*"
|
|
38
|
+
type="text"
|
|
39
|
+
>
|
|
40
|
+
<input
|
|
41
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
42
|
+
inputMode="numeric"
|
|
43
|
+
maxLength={1}
|
|
44
|
+
name="single-character-input"
|
|
45
|
+
pattern="[0-9]*"
|
|
46
|
+
type="text"
|
|
47
|
+
/>
|
|
48
|
+
</ForwardRef(Base)>
|
|
49
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`renders the SingleCharacterInputItem with name and error props 2`] = `
|
|
53
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
54
|
+
error={true}
|
|
55
|
+
name="single-character-input"
|
|
56
|
+
>
|
|
57
|
+
<ForwardRef(Base)
|
|
58
|
+
as="input"
|
|
59
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
60
|
+
inputMode="numeric"
|
|
61
|
+
maxLength={1}
|
|
62
|
+
name="single-character-input"
|
|
63
|
+
pattern="[0-9]*"
|
|
64
|
+
type="text"
|
|
65
|
+
>
|
|
66
|
+
<input
|
|
67
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
68
|
+
inputMode="numeric"
|
|
69
|
+
maxLength={1}
|
|
70
|
+
name="single-character-input"
|
|
71
|
+
pattern="[0-9]*"
|
|
72
|
+
type="text"
|
|
73
|
+
/>
|
|
74
|
+
</ForwardRef(Base)>
|
|
75
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`renders the SingleCharacterInputItem with name prop 1`] = `
|
|
79
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
80
|
+
name="single-character-input"
|
|
81
|
+
>
|
|
82
|
+
<ForwardRef(Base)
|
|
83
|
+
as="input"
|
|
84
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
85
|
+
inputMode="numeric"
|
|
86
|
+
maxLength={1}
|
|
87
|
+
name="single-character-input"
|
|
88
|
+
pattern="[0-9]*"
|
|
89
|
+
type="text"
|
|
90
|
+
>
|
|
91
|
+
<input
|
|
92
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
93
|
+
inputMode="numeric"
|
|
94
|
+
maxLength={1}
|
|
95
|
+
name="single-character-input"
|
|
96
|
+
pattern="[0-9]*"
|
|
97
|
+
type="text"
|
|
98
|
+
/>
|
|
99
|
+
</ForwardRef(Base)>
|
|
100
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`renders the SingleCharacterInputItem with name, pattern, maxLength and error props 1`] = `
|
|
104
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
105
|
+
error={true}
|
|
106
|
+
maxLength={6}
|
|
107
|
+
name="single-character-input"
|
|
108
|
+
pattern="\\\\d{1}"
|
|
109
|
+
>
|
|
110
|
+
<ForwardRef(Base)
|
|
111
|
+
as="input"
|
|
112
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
113
|
+
inputMode="numeric"
|
|
114
|
+
maxLength={6}
|
|
115
|
+
name="single-character-input"
|
|
116
|
+
pattern="\\\\d{1}"
|
|
117
|
+
type="text"
|
|
118
|
+
>
|
|
119
|
+
<input
|
|
120
|
+
className="govgr-error-input govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
121
|
+
inputMode="numeric"
|
|
122
|
+
maxLength={6}
|
|
123
|
+
name="single-character-input"
|
|
124
|
+
pattern="\\\\d{1}"
|
|
125
|
+
type="text"
|
|
126
|
+
/>
|
|
127
|
+
</ForwardRef(Base)>
|
|
128
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
exports[`renders the SingleCharacterInputItem with no props 1`] = `
|
|
132
|
+
<ForwardRef(SingleCharacterInputItem)>
|
|
133
|
+
<ForwardRef(Base)
|
|
134
|
+
as="input"
|
|
135
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
136
|
+
inputMode="numeric"
|
|
137
|
+
maxLength={1}
|
|
138
|
+
pattern="[0-9]*"
|
|
139
|
+
type="text"
|
|
140
|
+
>
|
|
141
|
+
<input
|
|
142
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
143
|
+
inputMode="numeric"
|
|
144
|
+
maxLength={1}
|
|
145
|
+
pattern="[0-9]*"
|
|
146
|
+
type="text"
|
|
147
|
+
/>
|
|
148
|
+
</ForwardRef(Base)>
|
|
149
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
exports[`renders the SingleCharacterInputItem with pattern prop 1`] = `
|
|
153
|
+
<ForwardRef(SingleCharacterInputItem)
|
|
154
|
+
pattern="\\\\d{1}"
|
|
155
|
+
>
|
|
156
|
+
<ForwardRef(Base)
|
|
157
|
+
as="input"
|
|
158
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
159
|
+
inputMode="numeric"
|
|
160
|
+
maxLength={1}
|
|
161
|
+
pattern="\\\\d{1}"
|
|
162
|
+
type="text"
|
|
163
|
+
>
|
|
164
|
+
<input
|
|
165
|
+
className="govgr-otp-input__item govgr-input govgr-otp-input--width"
|
|
166
|
+
inputMode="numeric"
|
|
167
|
+
maxLength={1}
|
|
168
|
+
pattern="\\\\d{1}"
|
|
169
|
+
type="text"
|
|
170
|
+
/>
|
|
171
|
+
</ForwardRef(Base)>
|
|
172
|
+
</ForwardRef(SingleCharacterInputItem)>
|
|
173
|
+
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["name", "error", "className", "pattern", "maxLength"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Base from '@digigov/react-core/Base';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Details for the SingleCharacterInputItem.
|
|
10
|
+
* SingleCharacterInputItem component is used for displaying simple digital character inputs.
|
|
11
|
+
* SingleCharacterInputItem component must be included inside SingleCharacterInputContainer component as children component
|
|
12
|
+
*/
|
|
13
|
+
export var SingleCharacterInputItem = /*#__PURE__*/React.forwardRef(function SingleCharacterInputItem(_ref, ref) {
|
|
14
|
+
var name = _ref.name,
|
|
15
|
+
error = _ref.error,
|
|
16
|
+
className = _ref.className,
|
|
17
|
+
_ref$pattern = _ref.pattern,
|
|
18
|
+
pattern = _ref$pattern === void 0 ? '[0-9]*' : _ref$pattern,
|
|
19
|
+
_ref$maxLength = _ref.maxLength,
|
|
20
|
+
maxLength = _ref$maxLength === void 0 ? 1 : _ref$maxLength,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Base, _extends({
|
|
24
|
+
as: "input",
|
|
25
|
+
ref: ref,
|
|
26
|
+
type: "text",
|
|
27
|
+
pattern: pattern,
|
|
28
|
+
maxLength: maxLength,
|
|
29
|
+
inputMode: "numeric",
|
|
30
|
+
name: name,
|
|
31
|
+
className: clsx(error === true && 'govgr-error-input', className && className, true && ['govgr-otp-input__item', 'govgr-input', 'govgr-otp-input--width'])
|
|
32
|
+
}, props)));
|
|
33
|
+
});
|
|
34
|
+
export default SingleCharacterInputItem;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import SingleCharacterInputItem from '@digigov/react-core/SingleCharacterInputItem';
|
|
4
|
+
|
|
5
|
+
var _ref = /*#__PURE__*/React.createElement(SingleCharacterInputItem, null);
|
|
6
|
+
|
|
7
|
+
it('renders the SingleCharacterInputItem with no props', function () {
|
|
8
|
+
expect(mount(_ref)).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var _ref2 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
12
|
+
maxLength: 6
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders the SingleCharacterInputItem with maxLength prop', function () {
|
|
16
|
+
expect(mount(_ref2)).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _ref3 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
20
|
+
name: 'single-character-input'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders the SingleCharacterInputItem with name prop', function () {
|
|
24
|
+
expect(mount(_ref3)).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _ref4 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
28
|
+
name: 'single-character-input',
|
|
29
|
+
error: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders the SingleCharacterInputItem with name and error props', function () {
|
|
33
|
+
expect(mount(_ref4)).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
var _ref5 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
37
|
+
pattern: "\\d{1}"
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('renders the SingleCharacterInputItem with pattern prop', function () {
|
|
41
|
+
expect(mount(_ref5)).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var _ref6 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
45
|
+
name: 'single-character-input',
|
|
46
|
+
error: true
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('renders the SingleCharacterInputItem with name and error props', function () {
|
|
50
|
+
expect(mount(_ref6)).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var _ref7 = /*#__PURE__*/React.createElement(SingleCharacterInputItem, {
|
|
54
|
+
name: 'single-character-input',
|
|
55
|
+
pattern: "\\d{1}",
|
|
56
|
+
maxLength: 6,
|
|
57
|
+
error: true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('renders the SingleCharacterInputItem with name, pattern, maxLength and error props', function () {
|
|
61
|
+
expect(mount(_ref7)).toMatchSnapshot();
|
|
62
|
+
});
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Digigov v0.
|
|
1
|
+
/** @license Digigov v0.23.1
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the BSD-2-Clause license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -126,6 +126,8 @@ export * from '@digigov/react-core/RadioConditional';
|
|
|
126
126
|
export * from '@digigov/react-core/SectionBreak';
|
|
127
127
|
export * from '@digigov/react-core/SelectContainer';
|
|
128
128
|
export * from '@digigov/react-core/SelectOption';
|
|
129
|
+
export * from '@digigov/react-core/SingleCharacterInputContainer';
|
|
130
|
+
export * from '@digigov/react-core/SingleCharacterInputItem';
|
|
129
131
|
export * from '@digigov/react-core/SkipLink';
|
|
130
132
|
export * from '@digigov/react-core/SummaryList';
|
|
131
133
|
export * from '@digigov/react-core/SummaryListItem';
|
package/esm/registry.js
CHANGED
|
@@ -130,6 +130,8 @@ import * as _digigov_react_core_RadioItem from '@digigov/react-core/RadioItem';
|
|
|
130
130
|
import * as _digigov_react_core_SectionBreak from '@digigov/react-core/SectionBreak';
|
|
131
131
|
import * as _digigov_react_core_SelectContainer from '@digigov/react-core/SelectContainer';
|
|
132
132
|
import * as _digigov_react_core_SelectOption from '@digigov/react-core/SelectOption';
|
|
133
|
+
import * as _digigov_react_core_SingleCharacterInputContainer from '@digigov/react-core/SingleCharacterInputContainer';
|
|
134
|
+
import * as _digigov_react_core_SingleCharacterInputItem from '@digigov/react-core/SingleCharacterInputItem';
|
|
133
135
|
import * as _digigov_react_core_SkipLink from '@digigov/react-core/SkipLink';
|
|
134
136
|
import * as _digigov_react_core_SummaryList from '@digigov/react-core/SummaryList';
|
|
135
137
|
import * as _digigov_react_core_SummaryListItem from '@digigov/react-core/SummaryListItem';
|
|
@@ -306,6 +308,8 @@ export default {
|
|
|
306
308
|
'@digigov/react-core/SectionBreak': lazyImport(_digigov_react_core_SectionBreak),
|
|
307
309
|
'@digigov/react-core/SelectContainer': lazyImport(_digigov_react_core_SelectContainer),
|
|
308
310
|
'@digigov/react-core/SelectOption': lazyImport(_digigov_react_core_SelectOption),
|
|
311
|
+
'@digigov/react-core/SingleCharacterInputContainer': lazyImport(_digigov_react_core_SingleCharacterInputContainer),
|
|
312
|
+
'@digigov/react-core/SingleCharacterInputItem': lazyImport(_digigov_react_core_SingleCharacterInputItem),
|
|
309
313
|
'@digigov/react-core/SkipLink': lazyImport(_digigov_react_core_SkipLink),
|
|
310
314
|
'@digigov/react-core/SummaryList': lazyImport(_digigov_react_core_SummaryList),
|
|
311
315
|
'@digigov/react-core/SummaryListItem': lazyImport(_digigov_react_core_SummaryListItem),
|
package/index.d.ts
CHANGED
|
@@ -121,6 +121,8 @@ export * from '@digigov/react-core/RadioConditional';
|
|
|
121
121
|
export * from '@digigov/react-core/SectionBreak';
|
|
122
122
|
export * from '@digigov/react-core/SelectContainer';
|
|
123
123
|
export * from '@digigov/react-core/SelectOption';
|
|
124
|
+
export * from '@digigov/react-core/SingleCharacterInputContainer';
|
|
125
|
+
export * from '@digigov/react-core/SingleCharacterInputItem';
|
|
124
126
|
export * from '@digigov/react-core/SkipLink';
|
|
125
127
|
export * from '@digigov/react-core/SummaryList';
|
|
126
128
|
export * from '@digigov/react-core/SummaryListItem';
|
package/index.js
CHANGED
|
@@ -1603,6 +1603,32 @@ Object.keys(_SelectOption).forEach(function (key) {
|
|
|
1603
1603
|
});
|
|
1604
1604
|
});
|
|
1605
1605
|
|
|
1606
|
+
var _SingleCharacterInputContainer = require("@digigov/react-core/SingleCharacterInputContainer");
|
|
1607
|
+
|
|
1608
|
+
Object.keys(_SingleCharacterInputContainer).forEach(function (key) {
|
|
1609
|
+
if (key === "default" || key === "__esModule") return;
|
|
1610
|
+
if (key in exports && exports[key] === _SingleCharacterInputContainer[key]) return;
|
|
1611
|
+
Object.defineProperty(exports, key, {
|
|
1612
|
+
enumerable: true,
|
|
1613
|
+
get: function get() {
|
|
1614
|
+
return _SingleCharacterInputContainer[key];
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
});
|
|
1618
|
+
|
|
1619
|
+
var _SingleCharacterInputItem = require("@digigov/react-core/SingleCharacterInputItem");
|
|
1620
|
+
|
|
1621
|
+
Object.keys(_SingleCharacterInputItem).forEach(function (key) {
|
|
1622
|
+
if (key === "default" || key === "__esModule") return;
|
|
1623
|
+
if (key in exports && exports[key] === _SingleCharacterInputItem[key]) return;
|
|
1624
|
+
Object.defineProperty(exports, key, {
|
|
1625
|
+
enumerable: true,
|
|
1626
|
+
get: function get() {
|
|
1627
|
+
return _SingleCharacterInputItem[key];
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1606
1632
|
var _SkipLink = require("@digigov/react-core/SkipLink");
|
|
1607
1633
|
|
|
1608
1634
|
Object.keys(_SkipLink).forEach(function (key) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/react-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "@digigov react core components",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "dist"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@digigov/css": "0.
|
|
14
|
+
"@digigov/css": "0.35.0",
|
|
15
15
|
"clsx": "1.1.1",
|
|
16
16
|
"react": "^16.8.0 || ^17.0.0",
|
|
17
17
|
"react-dom": "^16.8.0 || ^17.0.0"
|
package/registry.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ declare var _default: {
|
|
|
131
131
|
'@digigov/react-core/SectionBreak': {};
|
|
132
132
|
'@digigov/react-core/SelectContainer': {};
|
|
133
133
|
'@digigov/react-core/SelectOption': {};
|
|
134
|
+
'@digigov/react-core/SingleCharacterInputContainer': {};
|
|
135
|
+
'@digigov/react-core/SingleCharacterInputItem': {};
|
|
134
136
|
'@digigov/react-core/SkipLink': {};
|
|
135
137
|
'@digigov/react-core/SummaryList': {};
|
|
136
138
|
'@digigov/react-core/SummaryListItem': {};
|
package/registry.js
CHANGED
|
@@ -271,6 +271,10 @@ var _digigov_react_core_SelectContainer = _interopRequireWildcard(require("@digi
|
|
|
271
271
|
|
|
272
272
|
var _digigov_react_core_SelectOption = _interopRequireWildcard(require("@digigov/react-core/SelectOption"));
|
|
273
273
|
|
|
274
|
+
var _digigov_react_core_SingleCharacterInputContainer = _interopRequireWildcard(require("@digigov/react-core/SingleCharacterInputContainer"));
|
|
275
|
+
|
|
276
|
+
var _digigov_react_core_SingleCharacterInputItem = _interopRequireWildcard(require("@digigov/react-core/SingleCharacterInputItem"));
|
|
277
|
+
|
|
274
278
|
var _digigov_react_core_SkipLink = _interopRequireWildcard(require("@digigov/react-core/SkipLink"));
|
|
275
279
|
|
|
276
280
|
var _digigov_react_core_SummaryList = _interopRequireWildcard(require("@digigov/react-core/SummaryList"));
|
|
@@ -478,6 +482,8 @@ var _default = {
|
|
|
478
482
|
'@digigov/react-core/SectionBreak': lazyImport(_digigov_react_core_SectionBreak),
|
|
479
483
|
'@digigov/react-core/SelectContainer': lazyImport(_digigov_react_core_SelectContainer),
|
|
480
484
|
'@digigov/react-core/SelectOption': lazyImport(_digigov_react_core_SelectOption),
|
|
485
|
+
'@digigov/react-core/SingleCharacterInputContainer': lazyImport(_digigov_react_core_SingleCharacterInputContainer),
|
|
486
|
+
'@digigov/react-core/SingleCharacterInputItem': lazyImport(_digigov_react_core_SingleCharacterInputItem),
|
|
481
487
|
'@digigov/react-core/SkipLink': lazyImport(_digigov_react_core_SkipLink),
|
|
482
488
|
'@digigov/react-core/SummaryList': lazyImport(_digigov_react_core_SummaryList),
|
|
483
489
|
'@digigov/react-core/SummaryListItem': lazyImport(_digigov_react_core_SummaryListItem),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
@@ -13,11 +13,6 @@ export const AccordionSectionSummaryHeading = React.forwardRef<
|
|
|
13
13
|
{ className, children, ...props },
|
|
14
14
|
ref
|
|
15
15
|
) {
|
|
16
|
-
const toggleExpanded = () => {
|
|
17
|
-
setExpanded(!isExpanded);
|
|
18
|
-
};
|
|
19
|
-
const [isExpanded, setExpanded] = useState(false);
|
|
20
|
-
|
|
21
16
|
return (
|
|
22
17
|
<Base
|
|
23
18
|
as="h2"
|
|
@@ -27,8 +22,6 @@ export const AccordionSectionSummaryHeading = React.forwardRef<
|
|
|
27
22
|
})}
|
|
28
23
|
{...props}
|
|
29
24
|
role="button"
|
|
30
|
-
aria-expanded={isExpanded}
|
|
31
|
-
onClick={toggleExpanded}
|
|
32
25
|
>
|
|
33
26
|
<span
|
|
34
27
|
className={clsx({
|
|
@@ -4,10 +4,10 @@ exports[`renders the Nav with no props 1`] = `
|
|
|
4
4
|
<ForwardRef(Nav)>
|
|
5
5
|
<ForwardRef(Base)
|
|
6
6
|
as="nav"
|
|
7
|
-
className="govgr-nav-
|
|
7
|
+
className="govgr-nav--horizontal govgr-nav--border govgr-nav--fixed govgr-nav"
|
|
8
8
|
>
|
|
9
9
|
<nav
|
|
10
|
-
className="govgr-nav-
|
|
10
|
+
className="govgr-nav--horizontal govgr-nav--border govgr-nav--fixed govgr-nav"
|
|
11
11
|
>
|
|
12
12
|
hello
|
|
13
13
|
</nav>
|
|
@@ -21,10 +21,10 @@ exports[`renders the Nav with open prop 1`] = `
|
|
|
21
21
|
>
|
|
22
22
|
<ForwardRef(Base)
|
|
23
23
|
as="nav"
|
|
24
|
-
className="govgr-nav-
|
|
24
|
+
className="govgr-nav--horizontal govgr-nav--border govgr-nav--fixed govgr-nav govgr-nav--open"
|
|
25
25
|
>
|
|
26
26
|
<nav
|
|
27
|
-
className="govgr-nav-
|
|
27
|
+
className="govgr-nav--horizontal govgr-nav--border govgr-nav--fixed govgr-nav govgr-nav--open"
|
|
28
28
|
>
|
|
29
29
|
hello
|
|
30
30
|
</nav>
|