shadcn_phlexcomponents 0.1.17 → 0.1.18
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/javascript/controllers/accordion_controller.js +90 -100
- data/app/javascript/controllers/alert_dialog_controller.js +4 -4
- data/app/javascript/controllers/avatar_controller.js +11 -11
- data/app/javascript/controllers/checkbox_controller.js +26 -25
- data/app/javascript/controllers/collapsible_controller.js +36 -34
- data/app/javascript/controllers/combobox_controller.js +231 -262
- data/app/javascript/controllers/command_controller.js +184 -204
- data/app/javascript/controllers/date_picker_controller.js +257 -240
- data/app/javascript/controllers/date_range_picker_controller.js +200 -188
- data/app/javascript/controllers/dialog_controller.js +78 -78
- data/app/javascript/controllers/dropdown_menu_controller.js +208 -228
- data/app/javascript/controllers/dropdown_menu_sub_controller.js +97 -110
- data/app/javascript/controllers/form_field_controller.js +16 -16
- data/app/javascript/controllers/hover_card_controller.js +71 -68
- data/app/javascript/controllers/loading_button_controller.js +10 -10
- data/app/javascript/controllers/popover_controller.js +78 -84
- data/app/javascript/controllers/progress_controller.js +11 -11
- data/app/javascript/controllers/radio_group_controller.js +74 -74
- data/app/javascript/controllers/select_controller.js +232 -246
- data/app/javascript/controllers/sidebar_controller.js +27 -26
- data/app/javascript/controllers/sidebar_trigger_controller.js +9 -12
- data/app/javascript/controllers/slider_controller.js +74 -73
- data/app/javascript/controllers/switch_controller.js +23 -22
- data/app/javascript/controllers/tabs_controller.js +61 -60
- data/app/javascript/controllers/theme_switcher_controller.js +27 -27
- data/app/javascript/controllers/toast_container_controller.js +31 -44
- data/app/javascript/controllers/toast_controller.js +18 -18
- data/app/javascript/controllers/toggle_controller.js +17 -16
- data/app/javascript/controllers/toggle_group_controller.js +17 -16
- data/app/javascript/controllers/tooltip_controller.js +77 -74
- data/app/javascript/shadcn_phlexcomponents.js +58 -58
- data/app/javascript/utils/command.js +334 -392
- data/app/javascript/utils/floating_ui.js +108 -147
- data/app/javascript/utils/index.js +190 -253
- data/app/stylesheets/date_picker.css +1 -1
- data/app/stylesheets/shadcn_phlexcomponents.css +173 -0
- data/app/typescript/controllers/combobox_controller.ts +0 -1
- data/app/typescript/controllers/date_picker_controller.ts +25 -7
- data/app/typescript/controllers/tooltip_controller.ts +1 -1
- data/app/typescript/utils/command.ts +0 -2
- data/app/typescript/utils/floating_ui.ts +11 -20
- data/app/typescript/utils/index.ts +0 -7
- data/lib/shadcn_phlexcomponents/components/accordion.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/alert_dialog.rb +6 -6
- data/lib/shadcn_phlexcomponents/components/base.rb +2 -2
- data/lib/shadcn_phlexcomponents/components/combobox.rb +13 -13
- data/lib/shadcn_phlexcomponents/components/command.rb +13 -13
- data/lib/shadcn_phlexcomponents/components/date_picker.rb +18 -12
- data/lib/shadcn_phlexcomponents/components/date_range_picker.rb +7 -3
- data/lib/shadcn_phlexcomponents/components/dialog.rb +6 -6
- data/lib/shadcn_phlexcomponents/components/sheet.rb +7 -7
- data/lib/shadcn_phlexcomponents/components/toggle.rb +1 -1
- data/lib/shadcn_phlexcomponents/version.rb +1 -1
- metadata +2 -1
@@ -1,20 +1,20 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
2
|
const FormFieldController = class extends Controller {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
connect() {
|
4
|
+
const hintContainer = this.element.querySelector('[data-remove-label]');
|
5
|
+
const labelContainer = this.element.querySelector('[data-remove-hint]');
|
6
|
+
if (hintContainer) {
|
7
|
+
const label = hintContainer.querySelector('label');
|
8
|
+
const hint = hintContainer.querySelector('p');
|
9
|
+
label.remove();
|
10
|
+
hintContainer.replaceWith(hint);
|
11
|
+
}
|
12
|
+
if (labelContainer) {
|
13
|
+
const hint = labelContainer.querySelector('p');
|
14
|
+
const label = labelContainer.querySelector('label');
|
15
|
+
hint.remove();
|
16
|
+
labelContainer.replaceWith(label);
|
17
|
+
}
|
11
18
|
}
|
12
|
-
if (labelContainer) {
|
13
|
-
const hint = labelContainer.querySelector("p");
|
14
|
-
const label = labelContainer.querySelector("label");
|
15
|
-
hint.remove();
|
16
|
-
labelContainer.replaceWith(label);
|
17
|
-
}
|
18
|
-
}
|
19
19
|
};
|
20
20
|
export { FormFieldController };
|
@@ -1,73 +1,76 @@
|
|
1
|
-
import { Controller } from
|
2
|
-
import { useHover } from
|
3
|
-
import { initFloatingUi } from
|
4
|
-
import { showContent, hideContent } from
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
|
+
import { useHover } from 'stimulus-use';
|
3
|
+
import { initFloatingUi } from '../utils/floating_ui';
|
4
|
+
import { showContent, hideContent } from '../utils';
|
5
5
|
const HoverCardController = class extends Controller {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
open() {
|
17
|
-
window.clearTimeout(this.closeTimeout);
|
18
|
-
this.isOpenValue = true;
|
19
|
-
}
|
20
|
-
close() {
|
21
|
-
this.closeTimeout = window.setTimeout(() => {
|
22
|
-
this.isOpenValue = false;
|
23
|
-
}, 250);
|
24
|
-
}
|
25
|
-
// for useHover
|
26
|
-
mouseEnter() {
|
27
|
-
this.open();
|
28
|
-
}
|
29
|
-
// for useHover
|
30
|
-
mouseLeave() {
|
31
|
-
this.close();
|
32
|
-
}
|
33
|
-
isOpenValueChanged(isOpen) {
|
34
|
-
if (isOpen) {
|
35
|
-
showContent({
|
36
|
-
content: this.contentTarget,
|
37
|
-
contentContainer: this.contentContainerTarget,
|
38
|
-
});
|
39
|
-
this.setupEventListeners();
|
40
|
-
this.cleanup = initFloatingUi({
|
41
|
-
referenceElement: this.triggerTarget,
|
42
|
-
floatingElement: this.contentContainerTarget,
|
43
|
-
side: this.contentTarget.dataset.side,
|
44
|
-
align: this.contentTarget.dataset.align,
|
45
|
-
sideOffset: 4,
|
46
|
-
});
|
47
|
-
} else {
|
48
|
-
hideContent({
|
49
|
-
content: this.contentTarget,
|
50
|
-
contentContainer: this.contentContainerTarget,
|
51
|
-
});
|
52
|
-
this.cleanupEventListeners();
|
6
|
+
// targets
|
7
|
+
static targets = ['trigger', 'content', 'contentContainer'];
|
8
|
+
// values
|
9
|
+
static values = {
|
10
|
+
isOpen: Boolean,
|
11
|
+
};
|
12
|
+
connect() {
|
13
|
+
this.DOMKeydownListener = this.onDOMKeydown.bind(this);
|
14
|
+
useHover(this, { element: this.triggerTarget, dispatchEvent: false });
|
53
15
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
16
|
+
open() {
|
17
|
+
window.clearTimeout(this.closeTimeout);
|
18
|
+
this.isOpenValue = true;
|
19
|
+
}
|
20
|
+
close() {
|
21
|
+
this.closeTimeout = window.setTimeout(() => {
|
22
|
+
this.isOpenValue = false;
|
23
|
+
}, 250);
|
24
|
+
}
|
25
|
+
// for useHover
|
26
|
+
mouseEnter() {
|
27
|
+
this.open();
|
28
|
+
}
|
29
|
+
// for useHover
|
30
|
+
mouseLeave() {
|
31
|
+
this.close();
|
32
|
+
}
|
33
|
+
isOpenValueChanged(isOpen) {
|
34
|
+
if (isOpen) {
|
35
|
+
showContent({
|
36
|
+
content: this.contentTarget,
|
37
|
+
contentContainer: this.contentContainerTarget,
|
38
|
+
});
|
39
|
+
this.setupEventListeners();
|
40
|
+
this.cleanup = initFloatingUi({
|
41
|
+
referenceElement: this.triggerTarget,
|
42
|
+
floatingElement: this.contentContainerTarget,
|
43
|
+
side: this.contentTarget.dataset.side,
|
44
|
+
align: this.contentTarget.dataset.align,
|
45
|
+
sideOffset: 4,
|
46
|
+
});
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
hideContent({
|
50
|
+
content: this.contentTarget,
|
51
|
+
contentContainer: this.contentContainerTarget,
|
52
|
+
});
|
53
|
+
this.cleanupEventListeners();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
disconnect() {
|
57
|
+
this.cleanupEventListeners();
|
58
|
+
}
|
59
|
+
setupEventListeners() {
|
60
|
+
document.addEventListener('keydown', this.DOMKeydownListener);
|
61
|
+
}
|
62
|
+
cleanupEventListeners() {
|
63
|
+
if (this.cleanup)
|
64
|
+
this.cleanup();
|
65
|
+
document.removeEventListener('keydown', this.DOMKeydownListener);
|
66
|
+
}
|
67
|
+
onDOMKeydown(event) {
|
68
|
+
if (!this.isOpenValue)
|
69
|
+
return;
|
70
|
+
const key = event.key;
|
71
|
+
if (key === 'Escape') {
|
72
|
+
this.close();
|
73
|
+
}
|
70
74
|
}
|
71
|
-
}
|
72
75
|
};
|
73
76
|
export { HoverCardController };
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
2
|
const LoadingButtonController = class extends Controller {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
connect() {
|
4
|
+
const el = this.element;
|
5
|
+
const form = el.closest('form');
|
6
|
+
if (form && form.dataset.turbo === 'false') {
|
7
|
+
form.addEventListener('submit', () => {
|
8
|
+
form.ariaBusy = 'true';
|
9
|
+
el.disabled = true;
|
10
|
+
});
|
11
|
+
}
|
11
12
|
}
|
12
|
-
}
|
13
13
|
};
|
14
14
|
export { LoadingButtonController };
|
@@ -1,90 +1,84 @@
|
|
1
|
-
import { Controller } from
|
2
|
-
import { useClickOutside } from
|
3
|
-
import { initFloatingUi } from
|
4
|
-
import {
|
5
|
-
focusTrigger,
|
6
|
-
getFocusableElements,
|
7
|
-
showContent,
|
8
|
-
hideContent,
|
9
|
-
onClickOutside,
|
10
|
-
handleTabNavigation,
|
11
|
-
focusElement,
|
12
|
-
} from "../utils";
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
|
+
import { useClickOutside } from 'stimulus-use';
|
3
|
+
import { initFloatingUi } from '../utils/floating_ui';
|
4
|
+
import { focusTrigger, getFocusableElements, showContent, hideContent, onClickOutside, handleTabNavigation, focusElement, } from '../utils';
|
13
5
|
const PopoverController = class extends Controller {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
element: this.contentTarget,
|
22
|
-
dispatchEvent: false,
|
23
|
-
});
|
24
|
-
}
|
25
|
-
toggle() {
|
26
|
-
if (this.isOpenValue) {
|
27
|
-
this.close();
|
28
|
-
} else {
|
29
|
-
this.open();
|
6
|
+
// targets
|
7
|
+
static targets = ['trigger', 'contentContainer', 'content'];
|
8
|
+
// values
|
9
|
+
static values = { isOpen: Boolean };
|
10
|
+
connect() {
|
11
|
+
this.DOMKeydownListener = this.onDOMKeydown.bind(this);
|
12
|
+
useClickOutside(this, { element: this.contentTarget, dispatchEvent: false });
|
30
13
|
}
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
clickOutside(event) {
|
39
|
-
onClickOutside(this, event);
|
40
|
-
}
|
41
|
-
isOpenValueChanged(isOpen, previousIsOpen) {
|
42
|
-
if (isOpen) {
|
43
|
-
showContent({
|
44
|
-
trigger: this.triggerTarget,
|
45
|
-
content: this.contentTarget,
|
46
|
-
contentContainer: this.contentContainerTarget,
|
47
|
-
});
|
48
|
-
this.cleanup = initFloatingUi({
|
49
|
-
referenceElement: this.triggerTarget,
|
50
|
-
floatingElement: this.contentContainerTarget,
|
51
|
-
side: this.contentTarget.dataset.side,
|
52
|
-
align: this.contentTarget.dataset.align,
|
53
|
-
sideOffset: 4,
|
54
|
-
});
|
55
|
-
const focusableElements = getFocusableElements(this.contentTarget);
|
56
|
-
focusElement(focusableElements[0]);
|
57
|
-
this.setupEventListeners();
|
58
|
-
} else {
|
59
|
-
hideContent({
|
60
|
-
trigger: this.triggerTarget,
|
61
|
-
content: this.contentTarget,
|
62
|
-
contentContainer: this.contentContainerTarget,
|
63
|
-
});
|
64
|
-
if (previousIsOpen) {
|
65
|
-
focusTrigger(this.triggerTarget);
|
66
|
-
}
|
67
|
-
this.cleanupEventListeners();
|
14
|
+
toggle() {
|
15
|
+
if (this.isOpenValue) {
|
16
|
+
this.close();
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
this.open();
|
20
|
+
}
|
68
21
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
22
|
+
open() {
|
23
|
+
this.isOpenValue = true;
|
24
|
+
}
|
25
|
+
close() {
|
26
|
+
this.isOpenValue = false;
|
27
|
+
}
|
28
|
+
clickOutside(event) {
|
29
|
+
onClickOutside(this, event);
|
30
|
+
}
|
31
|
+
isOpenValueChanged(isOpen, previousIsOpen) {
|
32
|
+
if (isOpen) {
|
33
|
+
showContent({
|
34
|
+
trigger: this.triggerTarget,
|
35
|
+
content: this.contentTarget,
|
36
|
+
contentContainer: this.contentContainerTarget,
|
37
|
+
});
|
38
|
+
this.cleanup = initFloatingUi({
|
39
|
+
referenceElement: this.triggerTarget,
|
40
|
+
floatingElement: this.contentContainerTarget,
|
41
|
+
side: this.contentTarget.dataset.side,
|
42
|
+
align: this.contentTarget.dataset.align,
|
43
|
+
sideOffset: 4,
|
44
|
+
});
|
45
|
+
const focusableElements = getFocusableElements(this.contentTarget);
|
46
|
+
focusElement(focusableElements[0]);
|
47
|
+
this.setupEventListeners();
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
hideContent({
|
51
|
+
trigger: this.triggerTarget,
|
52
|
+
content: this.contentTarget,
|
53
|
+
contentContainer: this.contentContainerTarget,
|
54
|
+
});
|
55
|
+
if (previousIsOpen) {
|
56
|
+
focusTrigger(this.triggerTarget);
|
57
|
+
}
|
58
|
+
this.cleanupEventListeners();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
disconnect() {
|
62
|
+
this.cleanupEventListeners();
|
63
|
+
}
|
64
|
+
setupEventListeners() {
|
65
|
+
document.addEventListener('keydown', this.DOMKeydownListener);
|
66
|
+
}
|
67
|
+
cleanupEventListeners() {
|
68
|
+
if (this.cleanup)
|
69
|
+
this.cleanup();
|
70
|
+
document.removeEventListener('keydown', this.DOMKeydownListener);
|
71
|
+
}
|
72
|
+
onDOMKeydown(event) {
|
73
|
+
if (!this.isOpenValue)
|
74
|
+
return;
|
75
|
+
const key = event.key;
|
76
|
+
if (key === 'Escape') {
|
77
|
+
this.close();
|
78
|
+
}
|
79
|
+
else if (key === 'Tab') {
|
80
|
+
handleTabNavigation(this.contentTarget, event);
|
81
|
+
}
|
87
82
|
}
|
88
|
-
}
|
89
83
|
};
|
90
84
|
export { PopoverController };
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
2
|
const ProgressController = class extends Controller {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
// targets
|
4
|
+
static targets = ['indicator'];
|
5
|
+
// values
|
6
|
+
static values = {
|
7
|
+
percent: Number,
|
8
|
+
};
|
9
|
+
percentValueChanged(value) {
|
10
|
+
this.element.setAttribute('aria-valuenow', `${value}`);
|
11
|
+
this.indicatorTarget.style.transform = `translateX(-${100 - value}%)`;
|
12
|
+
}
|
13
13
|
};
|
14
14
|
export { ProgressController };
|
@@ -1,80 +1,80 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
2
|
const RadioGroupController = class extends Controller {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
// targets
|
4
|
+
static targets = ['item', 'input', 'indicator'];
|
5
|
+
// values
|
6
|
+
static values = {
|
7
|
+
selected: String,
|
8
|
+
};
|
9
|
+
connect() {
|
10
|
+
if (!this.selectedValue) {
|
11
|
+
this.itemTargets[0].tabIndex = 0;
|
12
|
+
}
|
12
13
|
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
this.selectedValue = item.dataset.value;
|
17
|
-
}
|
18
|
-
selectItem(event) {
|
19
|
-
const focusableItems = this.itemTargets.filter((t) => !t.disabled);
|
20
|
-
const item = event.currentTarget;
|
21
|
-
const index = focusableItems.indexOf(item);
|
22
|
-
const key = event.key;
|
23
|
-
let newIndex = 0;
|
24
|
-
if (["ArrowUp", "ArrowLeft"].includes(key)) {
|
25
|
-
newIndex = index - 1;
|
26
|
-
if (newIndex < 0) {
|
27
|
-
newIndex = focusableItems.length - 1;
|
28
|
-
}
|
29
|
-
} else {
|
30
|
-
newIndex = index + 1;
|
31
|
-
if (newIndex > focusableItems.length - 1) {
|
32
|
-
newIndex = 0;
|
33
|
-
}
|
14
|
+
select(event) {
|
15
|
+
const item = event.currentTarget;
|
16
|
+
this.selectedValue = item.dataset.value;
|
34
17
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
18
|
+
selectItem(event) {
|
19
|
+
const focusableItems = this.itemTargets.filter((t) => !t.disabled);
|
20
|
+
const item = event.currentTarget;
|
21
|
+
const index = focusableItems.indexOf(item);
|
22
|
+
const key = event.key;
|
23
|
+
let newIndex = 0;
|
24
|
+
if (['ArrowUp', 'ArrowLeft'].includes(key)) {
|
25
|
+
newIndex = index - 1;
|
26
|
+
if (newIndex < 0) {
|
27
|
+
newIndex = focusableItems.length - 1;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
newIndex = index + 1;
|
32
|
+
if (newIndex > focusableItems.length - 1) {
|
33
|
+
newIndex = 0;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
this.selectedValue = focusableItems[newIndex].dataset.value;
|
37
|
+
}
|
38
|
+
preventDefault(event) {
|
39
|
+
event.preventDefault();
|
40
|
+
}
|
41
|
+
focusItem() {
|
42
|
+
const item = this.itemTargets.find((i) => i.dataset.value === this.selectedValue);
|
43
|
+
if (!item)
|
44
|
+
return;
|
45
|
+
// Focus first item that is not disabled and allow it to be focused
|
46
|
+
if (item.disabled) {
|
47
|
+
item.tabIndex = -1;
|
48
|
+
const focusableItems = this.itemTargets.filter((t) => !t.disabled);
|
49
|
+
if (focusableItems.length > 0) {
|
50
|
+
focusableItems[0].focus();
|
51
|
+
focusableItems[0].tabIndex = 0;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
item.focus();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
selectedValueChanged(value) {
|
59
|
+
this.itemTargets.forEach((item) => {
|
60
|
+
const input = item.querySelector('[data-radio-group-target="input"]');
|
61
|
+
const indicator = item.querySelector('[data-radio-group-target="indicator"]');
|
62
|
+
if (value === item.dataset.value) {
|
63
|
+
input.checked = true;
|
64
|
+
item.tabIndex = 0;
|
65
|
+
item.ariaChecked = 'true';
|
66
|
+
item.dataset.state = 'checked';
|
67
|
+
indicator.classList.remove('hidden');
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
input.checked = false;
|
71
|
+
item.tabIndex = -1;
|
72
|
+
item.ariaChecked = 'false';
|
73
|
+
item.dataset.state = 'unchecked';
|
74
|
+
indicator.classList.add('hidden');
|
75
|
+
}
|
76
|
+
});
|
77
|
+
this.focusItem();
|
55
78
|
}
|
56
|
-
}
|
57
|
-
selectedValueChanged(value) {
|
58
|
-
this.itemTargets.forEach((item) => {
|
59
|
-
const input = item.querySelector('[data-radio-group-target="input"]');
|
60
|
-
const indicator = item.querySelector(
|
61
|
-
'[data-radio-group-target="indicator"]',
|
62
|
-
);
|
63
|
-
if (value === item.dataset.value) {
|
64
|
-
input.checked = true;
|
65
|
-
item.tabIndex = 0;
|
66
|
-
item.ariaChecked = "true";
|
67
|
-
item.dataset.state = "checked";
|
68
|
-
indicator.classList.remove("hidden");
|
69
|
-
} else {
|
70
|
-
input.checked = false;
|
71
|
-
item.tabIndex = -1;
|
72
|
-
item.ariaChecked = "false";
|
73
|
-
item.dataset.state = "unchecked";
|
74
|
-
indicator.classList.add("hidden");
|
75
|
-
}
|
76
|
-
});
|
77
|
-
this.focusItem();
|
78
|
-
}
|
79
79
|
};
|
80
80
|
export { RadioGroupController };
|