playbook_ui 14.25.0.pre.alpha.PLAY2413togglefocusstate9860 → 14.25.0.pre.alpha.PLAY2413togglefocusstate9920
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 +4 -4
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +9 -2
- data/app/pb_kits/playbook/pb_toggle/toggle.html.erb +1 -1
- data/app/pb_kits/playbook/pb_toggle/toggle.rb +2 -1
- data/dist/chunks/{_weekday_stacked-2gKd1RZJ.js → _weekday_stacked-DNhBc3T2.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08c5fafb74ac67e1633ca73e3cd435d8990e29908bae3fa569c6235c52640c58'
|
4
|
+
data.tar.gz: ded16b9d9f16fdfce8c21c80c5a6266783dfe5e1343a06ae1b465e1086eed059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab9fa7145f8d46552d5a0320d50efd33df12c93a993a69c75bb21f2c443bc0b35af97962e691c72a7c24dea8ef47f1df77b4272a03f8417d8ff76cb73092ca6
|
7
|
+
data.tar.gz: fd23cd05afe95eb13f5857fb789a49a7f17f3cd79fe4eb0fc557657044d0208695407bf9dbb628a960ea1f05752ddbd7906b2df0189d05c51255a08d35b8cdba
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React, { useState } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import type { InputCallback } from '../types'
|
4
|
+
import { uniqueId } from '../utilities/object'
|
4
5
|
|
5
6
|
import {
|
6
7
|
buildAriaProps,
|
@@ -57,6 +58,9 @@ const Toggle = ({
|
|
57
58
|
}
|
58
59
|
))
|
59
60
|
|
61
|
+
const [autoId] = useState(() => uniqueId('toggle-'))
|
62
|
+
const inputId = id ? `${id}-input` : `${autoId}-input`
|
63
|
+
|
60
64
|
return (
|
61
65
|
<div
|
62
66
|
{...ariaProps}
|
@@ -65,7 +69,9 @@ const Toggle = ({
|
|
65
69
|
className={classnames(css, globalProps(props), className)}
|
66
70
|
id={id}
|
67
71
|
>
|
68
|
-
<label className="pb_toggle_wrapper"
|
72
|
+
<label className="pb_toggle_wrapper"
|
73
|
+
htmlFor={inputId}
|
74
|
+
>
|
69
75
|
{children && children}
|
70
76
|
|
71
77
|
{!children &&
|
@@ -73,6 +79,7 @@ const Toggle = ({
|
|
73
79
|
{...props}
|
74
80
|
defaultChecked={checked}
|
75
81
|
disabled={disabled}
|
82
|
+
id={inputId}
|
76
83
|
name={name}
|
77
84
|
onChange={onChange}
|
78
85
|
tabIndex={tabIndex}
|
@@ -22,7 +22,8 @@ module Playbook
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def input
|
25
|
-
|
25
|
+
input_id = id.present? ? "#{id}-input" : "pb_toggle_#{SecureRandom.hex(4)}"
|
26
|
+
check_box_tag(name, value, checked, input_options.merge(disabled: disabled, id: input_id))
|
26
27
|
end
|
27
28
|
|
28
29
|
private
|