@ltht-react/input 2.0.192 → 2.0.194
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/README.md +15 -15
- package/package.json +7 -7
- package/src/atoms/checkbox.tsx +92 -92
- package/src/atoms/daypicker.tsx +229 -229
- package/src/atoms/index.tsx +5 -5
- package/src/atoms/radio.tsx +47 -47
- package/src/atoms/text.tsx +57 -57
- package/src/index.tsx +2 -2
- package/src/molecules/daypicker-range.tsx +89 -89
- package/src/molecules/index.tsx +1 -1
- package/lib/atoms/checkbox.d.ts +0 -8
- package/lib/atoms/checkbox.js +0 -47
- package/lib/atoms/checkbox.js.map +0 -1
- package/lib/atoms/daypicker.d.ts +0 -24
- package/lib/atoms/daypicker.js +0 -113
- package/lib/atoms/daypicker.js.map +0 -1
- package/lib/atoms/index.d.ts +0 -5
- package/lib/atoms/index.js +0 -17
- package/lib/atoms/index.js.map +0 -1
- package/lib/atoms/radio.d.ts +0 -10
- package/lib/atoms/radio.js +0 -48
- package/lib/atoms/radio.js.map +0 -1
- package/lib/atoms/text.d.ts +0 -7
- package/lib/atoms/text.js +0 -48
- package/lib/atoms/text.js.map +0 -1
- package/lib/atoms/toggle.d.ts +0 -7
- package/lib/atoms/toggle.js +0 -41
- package/lib/atoms/toggle.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -19
- package/lib/index.js.map +0 -1
- package/lib/molecules/daypicker-range.d.ts +0 -10
- package/lib/molecules/daypicker-range.js +0 -48
- package/lib/molecules/daypicker-range.js.map +0 -1
- package/lib/molecules/index.d.ts +0 -1
- package/lib/molecules/index.js +0 -9
- package/lib/molecules/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# Input
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
|
-
### Import
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import Input from '@ltht-react/input'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
<Input />
|
|
15
|
-
```
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
### Import
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import Input from '@ltht-react/input'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<Input />
|
|
15
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/input",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.194",
|
|
4
4
|
"description": "ltht-react styled Input component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/icon": "^2.0.
|
|
33
|
-
"@ltht-react/styles": "^2.0.
|
|
34
|
-
"@ltht-react/types": "^2.0.
|
|
35
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.194",
|
|
32
|
+
"@ltht-react/icon": "^2.0.194",
|
|
33
|
+
"@ltht-react/styles": "^2.0.194",
|
|
34
|
+
"@ltht-react/types": "^2.0.194",
|
|
35
|
+
"@ltht-react/utils": "^2.0.194",
|
|
36
36
|
"@popperjs/core": "^2.11.5",
|
|
37
37
|
"date-fns": "^3.6.0",
|
|
38
38
|
"focus-trap-react": "^9.0.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react-day-picker": "^8.9.1",
|
|
42
42
|
"react-popper": "^2.3.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "2eb4b88fa2bc19baa1be9433dbe29fe1a947dc62"
|
|
45
45
|
}
|
package/src/atoms/checkbox.tsx
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { FC, HTMLAttributes, InputHTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import { BADGE_COLOURS, INPUT_COLOURS } from '@ltht-react/styles'
|
|
4
|
-
import { css } from '@emotion/react'
|
|
5
|
-
|
|
6
|
-
const StyledCheckbox = styled.div<ConditionalStyles>`
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
${(props) =>
|
|
10
|
-
props.checked &&
|
|
11
|
-
css`
|
|
12
|
-
background-color: ${INPUT_COLOURS.RADIO_SELECTED};
|
|
13
|
-
`}
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const StyledInput = styled.input`
|
|
17
|
-
appearance: none;
|
|
18
|
-
height: 1.2em;
|
|
19
|
-
margin: 0;
|
|
20
|
-
margin-right: 0.5em;
|
|
21
|
-
position: relative;
|
|
22
|
-
width: 1em;
|
|
23
|
-
|
|
24
|
-
&:before {
|
|
25
|
-
border: solid 1px grey;
|
|
26
|
-
border-radius: 3px;
|
|
27
|
-
content: '';
|
|
28
|
-
display: inline-block;
|
|
29
|
-
height: 1em;
|
|
30
|
-
width: 1em;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&:checked:before {
|
|
34
|
-
background-color: ${BADGE_COLOURS.PRIMARY};
|
|
35
|
-
content: '';
|
|
36
|
-
color: white;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&:checked:after {
|
|
40
|
-
color: white;
|
|
41
|
-
content: '\\2714';
|
|
42
|
-
font-size: 0.8em;
|
|
43
|
-
height: 1em;
|
|
44
|
-
left: 0.25em;
|
|
45
|
-
position: absolute;
|
|
46
|
-
top: 0;
|
|
47
|
-
width: 1em;
|
|
48
|
-
}
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
const StyledLabel = styled.label`
|
|
52
|
-
display: inline-block;
|
|
53
|
-
margin-bottom: 0;
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
const Checkbox: FC<Props> = ({
|
|
57
|
-
id,
|
|
58
|
-
checked = false,
|
|
59
|
-
onChange,
|
|
60
|
-
children,
|
|
61
|
-
name,
|
|
62
|
-
parentDivAttributes = {},
|
|
63
|
-
labelAttributes = {},
|
|
64
|
-
...rest
|
|
65
|
-
}) => (
|
|
66
|
-
<StyledCheckbox checked={checked} {...parentDivAttributes}>
|
|
67
|
-
<StyledInput
|
|
68
|
-
id={id}
|
|
69
|
-
onChange={onChange}
|
|
70
|
-
type="checkbox"
|
|
71
|
-
checked={checked}
|
|
72
|
-
aria-checked={checked}
|
|
73
|
-
role="checkbox"
|
|
74
|
-
name={name}
|
|
75
|
-
{...rest}
|
|
76
|
-
/>
|
|
77
|
-
<StyledLabel htmlFor={id} {...labelAttributes}>
|
|
78
|
-
{children}
|
|
79
|
-
</StyledLabel>
|
|
80
|
-
</StyledCheckbox>
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
interface ConditionalStyles extends InputHTMLAttributes<HTMLInputElement> {
|
|
84
|
-
checked: boolean
|
|
85
|
-
}
|
|
86
|
-
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
87
|
-
children: React.ReactNode
|
|
88
|
-
parentDivAttributes?: HTMLAttributes<HTMLDivElement>
|
|
89
|
-
labelAttributes?: HTMLAttributes<HTMLLabelElement>
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default Checkbox
|
|
1
|
+
import { FC, HTMLAttributes, InputHTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import { BADGE_COLOURS, INPUT_COLOURS } from '@ltht-react/styles'
|
|
4
|
+
import { css } from '@emotion/react'
|
|
5
|
+
|
|
6
|
+
const StyledCheckbox = styled.div<ConditionalStyles>`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
${(props) =>
|
|
10
|
+
props.checked &&
|
|
11
|
+
css`
|
|
12
|
+
background-color: ${INPUT_COLOURS.RADIO_SELECTED};
|
|
13
|
+
`}
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const StyledInput = styled.input`
|
|
17
|
+
appearance: none;
|
|
18
|
+
height: 1.2em;
|
|
19
|
+
margin: 0;
|
|
20
|
+
margin-right: 0.5em;
|
|
21
|
+
position: relative;
|
|
22
|
+
width: 1em;
|
|
23
|
+
|
|
24
|
+
&:before {
|
|
25
|
+
border: solid 1px grey;
|
|
26
|
+
border-radius: 3px;
|
|
27
|
+
content: '';
|
|
28
|
+
display: inline-block;
|
|
29
|
+
height: 1em;
|
|
30
|
+
width: 1em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:checked:before {
|
|
34
|
+
background-color: ${BADGE_COLOURS.PRIMARY};
|
|
35
|
+
content: '';
|
|
36
|
+
color: white;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:checked:after {
|
|
40
|
+
color: white;
|
|
41
|
+
content: '\\2714';
|
|
42
|
+
font-size: 0.8em;
|
|
43
|
+
height: 1em;
|
|
44
|
+
left: 0.25em;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
width: 1em;
|
|
48
|
+
}
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
const StyledLabel = styled.label`
|
|
52
|
+
display: inline-block;
|
|
53
|
+
margin-bottom: 0;
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
const Checkbox: FC<Props> = ({
|
|
57
|
+
id,
|
|
58
|
+
checked = false,
|
|
59
|
+
onChange,
|
|
60
|
+
children,
|
|
61
|
+
name,
|
|
62
|
+
parentDivAttributes = {},
|
|
63
|
+
labelAttributes = {},
|
|
64
|
+
...rest
|
|
65
|
+
}) => (
|
|
66
|
+
<StyledCheckbox checked={checked} {...parentDivAttributes}>
|
|
67
|
+
<StyledInput
|
|
68
|
+
id={id}
|
|
69
|
+
onChange={onChange}
|
|
70
|
+
type="checkbox"
|
|
71
|
+
checked={checked}
|
|
72
|
+
aria-checked={checked}
|
|
73
|
+
role="checkbox"
|
|
74
|
+
name={name}
|
|
75
|
+
{...rest}
|
|
76
|
+
/>
|
|
77
|
+
<StyledLabel htmlFor={id} {...labelAttributes}>
|
|
78
|
+
{children}
|
|
79
|
+
</StyledLabel>
|
|
80
|
+
</StyledCheckbox>
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
interface ConditionalStyles extends InputHTMLAttributes<HTMLInputElement> {
|
|
84
|
+
checked: boolean
|
|
85
|
+
}
|
|
86
|
+
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
87
|
+
children: React.ReactNode
|
|
88
|
+
parentDivAttributes?: HTMLAttributes<HTMLDivElement>
|
|
89
|
+
labelAttributes?: HTMLAttributes<HTMLLabelElement>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default Checkbox
|