playbook_ui 9.3.0 → 9.4.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c56b74cd258f0a3479d6f6acdaebe1792f3e5a30bbca45c3f2b21493ed2b5f4
|
4
|
+
data.tar.gz: 151e4c6b8f15c191ca1358de007a3ba373fb7da32d8d1f3afd5d0743a86ae364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a079d327c1a318bb826104f242c104286dd0d996e8adfe325ca719488d790fd73ef71d6ab302c835a368852e5b993f3831480faf0b609aeccdd99e37a9aaee4b
|
7
|
+
data.tar.gz: 3cf8ead3bf3712caaf275ef4559207108d655315d2c5c43505aba4a0203e91c788ce50cfe51c36d85a0cacf2c364ad65e593b6607a8003fcdd8da48aabd0396f
|
@@ -53,9 +53,10 @@ const Checkbox = (props: CheckboxProps) => {
|
|
53
53
|
|
54
54
|
useEffect(() => {
|
55
55
|
if (checkRef.current) {
|
56
|
+
checkRef.current.checked = checked
|
56
57
|
checkRef.current.indeterminate = indeterminate
|
57
58
|
}
|
58
|
-
}, [indeterminate])
|
59
|
+
}, [indeterminate, checked])
|
59
60
|
|
60
61
|
return (
|
61
62
|
<label
|
@@ -4,12 +4,13 @@
|
|
4
4
|
$transition: $transition_cubic;
|
5
5
|
|
6
6
|
[class^=pb_checkbox_kit] {
|
7
|
-
display: inline-flex;
|
8
7
|
cursor: pointer;
|
8
|
+
display: inline-flex;
|
9
|
+
vertical-align: middle;
|
9
10
|
.pb_checkbox_label {
|
10
|
-
padding-left: $space_xs;
|
11
11
|
cursor: pointer;
|
12
12
|
font-size: $text_lt_default;
|
13
|
+
padding-left: $space_xs;
|
13
14
|
user-select: none;
|
14
15
|
}
|
15
16
|
|
@@ -1,15 +1,73 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Checkbox } from '../..'
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Checkbox, Table } from '../..'
|
3
3
|
|
4
4
|
const CheckboxIndeterminate = (props) => {
|
5
|
+
const [checkboxes, setCheckboxes] = useState([
|
6
|
+
{ name: 'Coffee', checked: false },
|
7
|
+
{ name: 'Ice Cream', checked: false },
|
8
|
+
{ name: 'Chocolate', checked: true },
|
9
|
+
])
|
10
|
+
|
11
|
+
const isAllChecked = !checkboxes.find((checkbox) => !checkbox.checked)
|
12
|
+
const isNoneChecked = !checkboxes.find((checkbox) => checkbox.checked)
|
13
|
+
|
14
|
+
const processCheckboxes = (checked) =>
|
15
|
+
checkboxes.slice(0).map((checkbox) => {
|
16
|
+
checkbox.checked = checked
|
17
|
+
return checkbox
|
18
|
+
})
|
19
|
+
|
20
|
+
const onToggleAll = () => {
|
21
|
+
setCheckboxes(
|
22
|
+
isNoneChecked ? processCheckboxes(true) : processCheckboxes(false)
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
const updateCheckboxes = (checkbox, index) => {
|
27
|
+
const newCheckboxes = checkboxes.slice(0)
|
28
|
+
newCheckboxes[index].checked = !checkbox.checked
|
29
|
+
setCheckboxes(newCheckboxes)
|
30
|
+
}
|
31
|
+
|
5
32
|
return (
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
33
|
+
<Table
|
34
|
+
container={false}
|
35
|
+
size="md"
|
36
|
+
>
|
37
|
+
<thead>
|
38
|
+
<tr>
|
39
|
+
<th>
|
40
|
+
<Checkbox
|
41
|
+
checked={isAllChecked}
|
42
|
+
indeterminate={!isAllChecked && !isNoneChecked}
|
43
|
+
name="checkbox-name"
|
44
|
+
onChange={onToggleAll}
|
45
|
+
text={isNoneChecked ? 'Check All' : 'Uncheck All'}
|
46
|
+
value="check-box value"
|
47
|
+
{...props}
|
48
|
+
/>
|
49
|
+
</th>
|
50
|
+
</tr>
|
51
|
+
</thead>
|
52
|
+
<tbody>
|
53
|
+
{checkboxes.map((checkbox, index) => (
|
54
|
+
<tr key={index}>
|
55
|
+
<td>
|
56
|
+
<Checkbox
|
57
|
+
checked={checkbox.checked}
|
58
|
+
name={checkbox.name}
|
59
|
+
onChange={() => {
|
60
|
+
updateCheckboxes(checkbox, index)
|
61
|
+
}}
|
62
|
+
text={checkbox.name}
|
63
|
+
value="check-box value"
|
64
|
+
{...props}
|
65
|
+
/>
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
))}
|
69
|
+
</tbody>
|
70
|
+
</Table>
|
13
71
|
)
|
14
72
|
}
|
15
73
|
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-04-
|
12
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|