@brightspot/ui 6.7.1-pr.405.2026.10.26 → 6.8.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/dist/components/radio/Radio.d.ts +112 -0
- package/dist/components/radio/Radio.d.ts.map +1 -0
- package/dist/components/radio/Radio.js +228 -0
- package/dist/components/radio/Radio.js.map +1 -0
- package/dist/components/radio/RadioGroup.d.ts +94 -0
- package/dist/components/radio/RadioGroup.d.ts.map +1 -0
- package/dist/components/radio/RadioGroup.js +249 -0
- package/dist/components/radio/RadioGroup.js.map +1 -0
- package/dist/custom-elements.json +840 -0
- package/dist/storybook/assets/{ActionBar.stories-h4LZnjPi.js → ActionBar.stories-BOXYJYXy.js} +31 -28
- package/dist/storybook/assets/ActionItem-WoDvowFu.js +16 -0
- package/dist/storybook/assets/{ActionItem.stories-DrtiuK_q.js → ActionItem.stories-CVFoWP54.js} +2 -2
- package/dist/storybook/assets/AiSparkle.stories-Psv9jNpy.js +73 -0
- package/dist/storybook/assets/Avatar-CIQcHS8b.js +4 -0
- package/dist/storybook/assets/Avatar.stories-BE2Xn8fx.js +213 -0
- package/dist/storybook/assets/AvatarGroup-Chs0VKPg.js +1 -0
- package/dist/storybook/assets/AvatarGroup.stories-2ar6gCeX.js +225 -0
- package/dist/storybook/assets/Badge-AV20mCMJ.js +1 -0
- package/dist/storybook/assets/{Badge.stories-oHJYKBIM.js → Badge.stories-w9LqNw0A.js} +4 -4
- package/dist/storybook/assets/Banner-FSFX1AIb.css +1 -0
- package/dist/storybook/assets/{Banner.stories-BXYde1iZ.js → Banner.stories-Clhh1bBs.js} +14 -14
- package/dist/storybook/assets/Button-B7fn_wd5.js +10 -0
- package/dist/storybook/assets/Button.stories-5h4M8nd2.js +54 -0
- package/dist/storybook/assets/ButtonGroup-BmndBsBy.js +1 -0
- package/dist/storybook/assets/{ButtonGroup.stories-Ch1Tu6Kj.js → ButtonGroup.stories-CR1H4H7u.js} +7 -7
- package/dist/storybook/assets/Card-DyntwdY-.css +1 -0
- package/dist/storybook/assets/{Card.stories-Nl10FlTb.js → Card.stories-Bz5vXq5y.js} +60 -29
- package/dist/storybook/assets/{Celebrate.stories-Ds1-srNO.js → Celebrate.stories-Bu3CNw0k.js} +5 -5
- package/dist/storybook/assets/Checkbox-BALsanB1.js +30 -0
- package/dist/storybook/assets/{Checkbox.stories-Bk9fNdcL.js → Checkbox.stories-BdvCht5c.js} +10 -10
- package/dist/storybook/assets/CircularProgress-BeE2fWON.js +42 -0
- package/dist/storybook/assets/{CircularProgress.stories-DzhTWHYN.js → CircularProgress.stories-CL8Lc6eU.js} +2 -2
- package/dist/storybook/assets/ClipboardMixin-C6wcbXIO.js +1 -0
- package/dist/storybook/assets/{ClipboardMixin.stories-BnFXCiFJ.js → ClipboardMixin.stories-BsjzC7wd.js} +6 -6
- package/dist/storybook/assets/{Color-6BZIO3FS-BntnPWZM.js → Color-6BZIO3FS-Dsd6EVV9.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-0AeeEVVw.js → Colors.stories-CkCdNN9Y.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-kjjXfgj6.js → CombinedEffects.stories-QG78pIiG.js} +2 -2
- package/dist/storybook/assets/{ComponentStatesMixin-Bf5gvpXs.js → ComponentStatesMixin-CG-Dx_Vk.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-BwDY3N5N.js → ComponentStatesMixin.stories-B1yuAqua.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-DHz4lvAk.js → CopyToClipboard.stories-CyKcumJ9.js} +18 -10
- package/dist/storybook/assets/{Debounce.stories-3QSaZZAP.js → Debounce.stories-BuNskQ33.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-DvuqJl5p.js → DocsRenderer-LL677BLK-BrPyc8XX.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-B_SUX4kQ.js → Dropdown.stories-DHXeP07z.js} +2 -2
- package/dist/storybook/assets/DropdownMenu-WoWnJiQk.js +42 -0
- package/dist/storybook/assets/EmptyState-h0A4Qpiu.css +1 -0
- package/dist/storybook/assets/{EmptyState.stories-EL9oDdMl.js → EmptyState.stories-BRoVusey.js} +33 -21
- package/dist/storybook/assets/EscaAvatar.stories-CWAE-4Uz.js +140 -0
- package/dist/storybook/assets/{Events.stories-BijV4stG.js → Events.stories-D-npDwlx.js} +2 -2
- package/dist/storybook/assets/{Heading.stories-BEWjqFbE.js → Heading.stories-D7hmvFEN.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-Z4lM_TPD.js → HueRipple.stories-Dx3ozdHi.js} +2 -2
- package/dist/storybook/assets/Icon-DPQKiWDz.js +34409 -0
- package/dist/storybook/assets/{Icon.stories-DAMHb2XQ.js → Icon.stories-CVsQvcwd.js} +10 -10
- package/dist/storybook/assets/IconButton-Dp4Z06bL.js +12 -0
- package/dist/storybook/assets/{IconButton.stories-DQ7WseyR.js → IconButton.stories-DTbfHfcQ.js} +2 -2
- package/dist/storybook/assets/LinearProgress-DG3tPlGH.js +25 -0
- package/dist/storybook/assets/{LinearProgress.stories-v9OOfaD3.js → LinearProgress.stories-VIU6OqYd.js} +2 -2
- package/dist/storybook/assets/Message-BzkpGg8z.js +28 -0
- package/dist/storybook/assets/Message-CM3eexdu.css +1 -0
- package/dist/storybook/assets/{Message.stories-0GFTbybz.js → Message.stories-C9bzoQes.js} +2 -2
- package/dist/storybook/assets/OnFindMixin-CeeYfx9k.js +1 -0
- package/dist/storybook/assets/{OnFindMixin.stories-DbGsd7N-.js → OnFindMixin.stories-Dq06nuVf.js} +9 -9
- package/dist/storybook/assets/Pagination-CnWa6AX5.js +88 -0
- package/dist/storybook/assets/{Pagination.stories-W-Fg9qDN.js → Pagination.stories-BsH2eN2W.js} +33 -33
- package/dist/storybook/assets/{Popover.stories-CvB5GueC.js → Popover.stories-CLnzpgEE.js} +16 -16
- package/dist/storybook/assets/ProgressMixin-D1atDw3n.js +1 -0
- package/dist/storybook/assets/Radio-B6Aq6K0V.js +25 -0
- package/dist/storybook/assets/Radio.stories-BCVbISmb.js +71 -0
- package/dist/storybook/assets/RadioGroup.stories-B-TGP_-v.js +221 -0
- package/dist/storybook/assets/{ReadyMixin-Br9owaZV.js → ReadyMixin-C8HW2nGE.js} +1 -1
- package/dist/storybook/assets/RovingTabindexMixin-DI5rmyR7.js +1 -0
- package/dist/storybook/assets/{RovingTabindexMixin.stories-anjAbAzC.js → RovingTabindexMixin.stories-DVKCC_R7.js} +5 -5
- package/dist/storybook/assets/{Rtc.stories-VHR68JiM.js → Rtc.stories-bBYHOszW.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-D_D-r-JK.js → ScrollShadow.stories-BIK8YINt.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-BBc3Ddok.js → Switch.stories-COEk74kM.js} +60 -27
- package/dist/storybook/assets/{Tab.stories-Co1bcV-c.js → Tab.stories-Dbt9JvSx.js} +7 -7
- package/dist/storybook/assets/Tabs-BIScOPS0.js +17 -0
- package/dist/storybook/assets/{Tabs.stories-uhbYgv3l.js → Tabs.stories-CodKgVf2.js} +6 -6
- package/dist/storybook/assets/{Throttle.stories-Lq5D5WmY.js → Throttle.stories-BhIqWWrQ.js} +1 -1
- package/dist/storybook/assets/Tooltip.stories-DKD8nBM1.js +143 -0
- package/dist/storybook/assets/TooltipMixin-CRNNusJ7.js +1 -0
- package/dist/storybook/assets/{Upload.stories-CLtYPw8U.js → Upload.stories-WTO15ST1.js} +102 -52
- package/dist/storybook/assets/UploadItem-DejgZ5A0.js +54 -0
- package/dist/storybook/assets/{UploadItem.stories-CsikX2BV.js → UploadItem.stories-Pk3ghOcI.js} +4 -4
- package/dist/storybook/assets/{Welcome.stories-Dgl9qFjv.js → Welcome.stories-DrNnxvt9.js} +9 -9
- package/dist/storybook/assets/Widget-elBzGg8w.css +1 -0
- package/dist/storybook/assets/Widget.stories-CYC5Qdac.js +279 -0
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-tGrEodOE.js → WithTooltip-65CFNBJE-DK6PZNaa.js} +1 -1
- package/dist/storybook/assets/ai-sparkle-BZMJJAxY.js +1 -0
- package/dist/storybook/assets/aria-D5THOgos.js +1 -0
- package/dist/storybook/assets/{blocks-BXvz9yPY.js → blocks-Dzcxb014.js} +5 -5
- package/dist/storybook/assets/esca-glow-BwdhBvIX.js +2 -0
- package/dist/storybook/assets/esca-idle-B-fumiIb.js +1 -0
- package/dist/storybook/assets/esca-search-rwNfo19I.js +1 -0
- package/dist/storybook/assets/esca-task-complete-BAJP2dY2.js +1 -0
- package/dist/storybook/assets/esca-wave-Bjs4CUR7.js +1 -0
- package/dist/storybook/assets/{formatter-EIJCOSYU-D4wnoi50.js → formatter-EIJCOSYU-PioIuXjk.js} +1 -1
- package/dist/storybook/assets/i18n-BQ-Uj-0B.js +1 -0
- package/dist/storybook/assets/if-defined-DL7cQU7O.js +1 -0
- package/dist/storybook/assets/{iframe-BJAXLO__.js → iframe-Byo_x5o2.js} +158 -158
- package/dist/storybook/assets/{iframe-DM45AEWn.css → iframe-BzrT7trF.css} +1 -1
- package/dist/storybook/assets/{index-Vq-HO77I.js → index-gox-Wle0.js} +1 -1
- package/dist/storybook/assets/lottie_svg-3t2UJxjZ.js +2 -0
- package/dist/storybook/assets/{onFind-DvWzOs0i.js → onFind-BWiaccUj.js} +1 -1
- package/dist/storybook/assets/{onFind.stories-CYhYy57J.js → onFind.stories-CC_XTN2G.js} +1 -1
- package/dist/storybook/assets/{onRemove.stories-BGlN20MR.js → onRemove.stories-CXxpL4ud.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-g7Yr3k3S.js → onVisible.stories-DKA9cexx.js} +1 -1
- package/dist/storybook/assets/property-_few0Xe5.js +1 -0
- package/dist/storybook/assets/ref-BaIdO8Sk.js +1 -0
- package/dist/storybook/assets/state-BBcPmYaV.js +1 -0
- package/dist/storybook/assets/{style-map-B-NBwRI-.js → style-map-DxZm5Cj7.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-CiAkaRF_.js → syntaxhighlighter-ED5Y7EFY-B0_bSGZz.js} +1 -1
- package/dist/storybook/iframe.html +2 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/tailwind-plugin-radio.d.ts +2 -0
- package/dist/tailwind-plugin-radio.d.ts.map +1 -0
- package/dist/tailwind-plugin-radio.js +264 -0
- package/dist/tailwind-plugin-radio.js.map +1 -0
- package/dist/tailwind-plugin-radio.ts +301 -0
- package/dist/tailwind.config.d.ts.map +1 -1
- package/dist/tailwind.config.js +2 -0
- package/dist/tailwind.config.js.map +1 -1
- package/dist/tailwind.config.ts +2 -0
- package/dist/util/EventEmitterMixin.d.ts +9 -0
- package/dist/util/EventEmitterMixin.d.ts.map +1 -1
- package/dist/util/EventEmitterMixin.js.map +1 -1
- package/docs/components/README.md +2 -0
- package/docs/components/Radio.md +105 -0
- package/docs/components/RadioGroup.md +63 -0
- package/package.json +2 -1
- package/src/legacy/tool-ui/src/AnalyticsWidget.ts +19 -9
- package/src/legacy/tool-ui/src/ContentInputGroup.ts +18 -13
- package/src/legacy/tool-ui/src/main/webapp/dist/{RTEProseMirror.e4f881c67b2f3865776b.js → RTEProseMirror.8773fe3756519d83608e.js} +4 -4
- package/src/legacy/tool-ui/src/main/webapp/dist/{v4.94878a2d8b5c7787df69.js → v4.5311585e2e77268a6386.js} +4 -4
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.990bf181d01e0cbb18e8.css +140 -0
- package/src/legacy/tool-ui/src/main/webapp/dist/{v5.de9169aefaf9fc4323ff.js → v5.c96a164f24a2a102bde0.js} +4 -4
- package/dist/storybook/assets/AiSparkle.stories-vyk5EN2Y.js +0 -72
- package/dist/storybook/assets/Avatar.stories-y9T1MrQQ.js +0 -213
- package/dist/storybook/assets/AvatarGroup.stories-52-tqOb2.js +0 -225
- package/dist/storybook/assets/Button-CAMYBU_U.js +0 -10
- package/dist/storybook/assets/Button.stories-DSDjifLT.js +0 -54
- package/dist/storybook/assets/EscaAvatar.stories-CckR2oJo.js +0 -139
- package/dist/storybook/assets/LucideDynamicLoader-BuoNL33C.js +0 -1
- package/dist/storybook/assets/Tooltip.stories-CJ8sPHvm.js +0 -143
- package/dist/storybook/assets/Widget.stories-Dmg4GwlK.js +0 -233
- package/dist/storybook/assets/if-defined-BqGMNNFr.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.367effd3850ba2b3ccb2.css +0 -140
- /package/src/legacy/tool-ui/src/main/webapp/dist/{RTEProseMirror.e4f881c67b2f3865776b.js.LICENSE.txt → RTEProseMirror.8773fe3756519d83608e.js.LICENSE.txt} +0 -0
- /package/src/legacy/tool-ui/src/main/webapp/dist/{v4.94878a2d8b5c7787df69.js.LICENSE.txt → v4.5311585e2e77268a6386.js.LICENSE.txt} +0 -0
- /package/src/legacy/tool-ui/src/main/webapp/dist/{v5.de9169aefaf9fc4323ff.js.LICENSE.txt → v5.c96a164f24a2a102bde0.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const Radio_base: (new (...args: any[]) => import("../../util/TooltipMixin.js").TooltipMixinInterface) & (new (...args: any[]) => import("../../util/EventEmitterMixin.js").EventEmitterMixinInterface) & (new (...args: any[]) => import("../../util/ReadyMixin.js").ReadyMixinInterface) & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* A single radio option, selectable from a set of mutually exclusive choices.
|
|
5
|
+
*
|
|
6
|
+
* Uses a hidden native radio input internally for accessibility and form
|
|
7
|
+
* participation. Styled via the `btu-radio` Tailwind plugin classes. Typically
|
|
8
|
+
* placed inside a `btu-radio-group`, which owns the shared `name`, selection
|
|
9
|
+
* state, and arrow-key navigation; a standalone radio also works but manages
|
|
10
|
+
* only its own checked state. The component manages its own `className` — do not
|
|
11
|
+
* modify it externally after initialization (classes present at connection time
|
|
12
|
+
* are preserved).
|
|
13
|
+
*
|
|
14
|
+
* @element btu-radio
|
|
15
|
+
*
|
|
16
|
+
* @fires {CustomEvent} btu-radio-ready - Fired after the radio is first rendered and initialized
|
|
17
|
+
* @fires {CustomEvent<{ checked: boolean; value: string }>} btu-radio-change - Fired when the user selects this option
|
|
18
|
+
*
|
|
19
|
+
* @cssprop --radio-color-primary - Fill and border color when selected (default: oklch(var(--btu-theme-primary-700)))
|
|
20
|
+
* @cssprop --radio-color-border - Border color in the unselected state (default: oklch(var(--btu-theme-gray-300)))
|
|
21
|
+
* @cssprop --radio-color-error - Border and text color in the error state (default: oklch(var(--btu-theme-error-600)))
|
|
22
|
+
* @cssprop --radio-label-spacing - Distance between the radio and the label (default: 0.75rem)
|
|
23
|
+
* @cssprop --radio-box-size - [Internal] Diameter of the radio control, set by the size variant (sm: 1rem, md: 1.25rem). Use the `size` attribute instead of overriding directly — the dot must scale in tandem.
|
|
24
|
+
* @cssprop --radio-dot-size - [Internal] Diameter of the selected dot, set by the size variant (sm: 0.375rem, md: 0.5rem). Use the `size` attribute instead of overriding directly.
|
|
25
|
+
*/
|
|
26
|
+
export default class Radio extends Radio_base {
|
|
27
|
+
/**
|
|
28
|
+
* The text label displayed next to the radio.
|
|
29
|
+
* @attr
|
|
30
|
+
*/
|
|
31
|
+
label: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Optional helper text displayed below the label.
|
|
34
|
+
* @attr
|
|
35
|
+
*/
|
|
36
|
+
description: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Controls the scale of the radio and associated typography.
|
|
39
|
+
* @attr
|
|
40
|
+
*/
|
|
41
|
+
size: 'sm' | 'md';
|
|
42
|
+
/**
|
|
43
|
+
* Whether this option is currently selected.
|
|
44
|
+
* @attr
|
|
45
|
+
*/
|
|
46
|
+
checked: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* If true, the radio is non-interactive and visually muted.
|
|
49
|
+
* @attr
|
|
50
|
+
*/
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* If true, displays error styling on the radio.
|
|
54
|
+
* @attr
|
|
55
|
+
*/
|
|
56
|
+
invalid: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Error message text displayed below the radio when validation fails.
|
|
59
|
+
* Setting this also activates error styling without needing to set invalid.
|
|
60
|
+
* @attr
|
|
61
|
+
*/
|
|
62
|
+
error: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Value submitted with the form when this option is selected.
|
|
65
|
+
* @attr
|
|
66
|
+
*/
|
|
67
|
+
value: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Name of the form control. Usually set by the parent `btu-radio-group` so
|
|
70
|
+
* every option in the group shares one name.
|
|
71
|
+
* @attr
|
|
72
|
+
*/
|
|
73
|
+
name: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* @internal Roving tabindex value. Defaults to 0 so a standalone radio is
|
|
76
|
+
* keyboard-reachable; a parent btu-radio-group overrides it per its roving model.
|
|
77
|
+
*/
|
|
78
|
+
_tabindex: number;
|
|
79
|
+
/** @internal Disabled state pushed down by a disabled parent btu-radio-group */
|
|
80
|
+
_groupDisabled: boolean;
|
|
81
|
+
/** @internal Required state pushed down by a required parent btu-radio-group */
|
|
82
|
+
_groupRequired: boolean;
|
|
83
|
+
private _userInitiated;
|
|
84
|
+
private _initialClasses;
|
|
85
|
+
private _initialClassesCaptured;
|
|
86
|
+
private _descId;
|
|
87
|
+
private _errorId;
|
|
88
|
+
connectedCallback(): void;
|
|
89
|
+
disconnectedCallback(): void;
|
|
90
|
+
createRenderRoot(): this;
|
|
91
|
+
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
92
|
+
firstUpdated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
93
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
94
|
+
private _onInputChange;
|
|
95
|
+
private _handleClick;
|
|
96
|
+
/** @internal Own `disabled`, or `disabled` inherited from the parent group */
|
|
97
|
+
private get _isDisabled();
|
|
98
|
+
private get _describedBy();
|
|
99
|
+
/** @internal
|
|
100
|
+
* TooltipMixin puts aria-describedby on the host, but focus lands on the inner
|
|
101
|
+
* input — point it at the input instead, merged with the description/error ids.
|
|
102
|
+
*/
|
|
103
|
+
private _relayAriaDescribedBy;
|
|
104
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
105
|
+
}
|
|
106
|
+
declare global {
|
|
107
|
+
interface HTMLElementTagNameMap {
|
|
108
|
+
'btu-radio': Radio;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAA;;AAQ/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,UAAuD;IACxF;;;OAGG;IAEH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB;;;OAGG;IAEH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAE/B;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAO;IAExB;;;OAGG;IAEH,OAAO,UAAQ;IAEf;;;OAGG;IAEH,QAAQ,UAAQ;IAEhB;;;OAGG;IAEH,OAAO,UAAQ;IAEf;;;;OAIG;IAEH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB;;;OAGG;IAEH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB;;;;OAIG;IAEH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IAExB;;;OAGG;IACH,SAAS,SAAI;IAEb,gFAAgF;IAChF,cAAc,UAAQ;IAEtB,gFAAgF;IAChF,cAAc,UAAQ;IAEtB,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,OAAO,CAAsC;IACrD,OAAO,CAAC,QAAQ,CAAuC;IAEvD,iBAAiB,IAAI,IAAI;IAWzB,oBAAoB,IAAI,IAAI;IAK5B,gBAAgB;IAIhB,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAW3E,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAK7E,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAkBxE,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,YAAY,CASnB;IAED,8EAA8E;IAC9E,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,YAAY,GAKvB;IAED;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAa7B,MAAM;CA+BP;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,KAAK,CAAA;KACnB;CACF"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, nothing } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
|
+
import { live } from 'lit/directives/live.js';
|
|
11
|
+
import { EventEmitterMixin } from '../../util/EventEmitterMixin.js';
|
|
12
|
+
import { ReadyMixin } from '../../util/ReadyMixin.js';
|
|
13
|
+
import { TooltipMixin } from '../../util/TooltipMixin.js';
|
|
14
|
+
/**
|
|
15
|
+
* A single radio option, selectable from a set of mutually exclusive choices.
|
|
16
|
+
*
|
|
17
|
+
* Uses a hidden native radio input internally for accessibility and form
|
|
18
|
+
* participation. Styled via the `btu-radio` Tailwind plugin classes. Typically
|
|
19
|
+
* placed inside a `btu-radio-group`, which owns the shared `name`, selection
|
|
20
|
+
* state, and arrow-key navigation; a standalone radio also works but manages
|
|
21
|
+
* only its own checked state. The component manages its own `className` — do not
|
|
22
|
+
* modify it externally after initialization (classes present at connection time
|
|
23
|
+
* are preserved).
|
|
24
|
+
*
|
|
25
|
+
* @element btu-radio
|
|
26
|
+
*
|
|
27
|
+
* @fires {CustomEvent} btu-radio-ready - Fired after the radio is first rendered and initialized
|
|
28
|
+
* @fires {CustomEvent<{ checked: boolean; value: string }>} btu-radio-change - Fired when the user selects this option
|
|
29
|
+
*
|
|
30
|
+
* @cssprop --radio-color-primary - Fill and border color when selected (default: oklch(var(--btu-theme-primary-700)))
|
|
31
|
+
* @cssprop --radio-color-border - Border color in the unselected state (default: oklch(var(--btu-theme-gray-300)))
|
|
32
|
+
* @cssprop --radio-color-error - Border and text color in the error state (default: oklch(var(--btu-theme-error-600)))
|
|
33
|
+
* @cssprop --radio-label-spacing - Distance between the radio and the label (default: 0.75rem)
|
|
34
|
+
* @cssprop --radio-box-size - [Internal] Diameter of the radio control, set by the size variant (sm: 1rem, md: 1.25rem). Use the `size` attribute instead of overriding directly — the dot must scale in tandem.
|
|
35
|
+
* @cssprop --radio-dot-size - [Internal] Diameter of the selected dot, set by the size variant (sm: 0.375rem, md: 0.5rem). Use the `size` attribute instead of overriding directly.
|
|
36
|
+
*/
|
|
37
|
+
export default class Radio extends TooltipMixin(EventEmitterMixin(ReadyMixin(LitElement))) {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
/**
|
|
41
|
+
* Controls the scale of the radio and associated typography.
|
|
42
|
+
* @attr
|
|
43
|
+
*/
|
|
44
|
+
this.size = 'sm';
|
|
45
|
+
/**
|
|
46
|
+
* Whether this option is currently selected.
|
|
47
|
+
* @attr
|
|
48
|
+
*/
|
|
49
|
+
this.checked = false;
|
|
50
|
+
/**
|
|
51
|
+
* If true, the radio is non-interactive and visually muted.
|
|
52
|
+
* @attr
|
|
53
|
+
*/
|
|
54
|
+
this.disabled = false;
|
|
55
|
+
/**
|
|
56
|
+
* If true, displays error styling on the radio.
|
|
57
|
+
* @attr
|
|
58
|
+
*/
|
|
59
|
+
this.invalid = false;
|
|
60
|
+
/**
|
|
61
|
+
* @internal Roving tabindex value. Defaults to 0 so a standalone radio is
|
|
62
|
+
* keyboard-reachable; a parent btu-radio-group overrides it per its roving model.
|
|
63
|
+
*/
|
|
64
|
+
this._tabindex = 0;
|
|
65
|
+
/** @internal Disabled state pushed down by a disabled parent btu-radio-group */
|
|
66
|
+
this._groupDisabled = false;
|
|
67
|
+
/** @internal Required state pushed down by a required parent btu-radio-group */
|
|
68
|
+
this._groupRequired = false;
|
|
69
|
+
this._userInitiated = false;
|
|
70
|
+
this._initialClasses = [];
|
|
71
|
+
this._initialClassesCaptured = false;
|
|
72
|
+
this._descId = `radio-desc-${crypto.randomUUID()}`;
|
|
73
|
+
this._errorId = `radio-error-${crypto.randomUUID()}`;
|
|
74
|
+
this._handleClick = (e) => {
|
|
75
|
+
if (this._isDisabled)
|
|
76
|
+
return;
|
|
77
|
+
// input.click() fires a synthetic click that bubbles back here — skip it
|
|
78
|
+
if (e.target.closest('.btu-radio-input'))
|
|
79
|
+
return;
|
|
80
|
+
const input = this.renderRoot.querySelector('.btu-radio-input');
|
|
81
|
+
// Focus before clicking so the arrow keys keep working after a mouse click;
|
|
82
|
+
// focusVisible: false keeps the focus ring off, like a native click (not in TS's DOM types yet)
|
|
83
|
+
input?.focus({ focusVisible: false });
|
|
84
|
+
input?.click();
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
connectedCallback() {
|
|
88
|
+
super.connectedCallback();
|
|
89
|
+
if (!this._initialClassesCaptured) {
|
|
90
|
+
if (this.className) {
|
|
91
|
+
this._initialClasses = this.className.split(' ').filter(c => c.trim());
|
|
92
|
+
}
|
|
93
|
+
this._initialClassesCaptured = true;
|
|
94
|
+
}
|
|
95
|
+
this.addEventListener('click', this._handleClick);
|
|
96
|
+
}
|
|
97
|
+
disconnectedCallback() {
|
|
98
|
+
super.disconnectedCallback();
|
|
99
|
+
this.removeEventListener('click', this._handleClick);
|
|
100
|
+
}
|
|
101
|
+
createRenderRoot() {
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
willUpdate(changedProperties) {
|
|
105
|
+
super.willUpdate(changedProperties);
|
|
106
|
+
const classes = [
|
|
107
|
+
...this._initialClasses,
|
|
108
|
+
'btu-radio',
|
|
109
|
+
this.size === 'md' && 'btu-radio-md',
|
|
110
|
+
(this.invalid || this.error) && 'btu-radio-invalid',
|
|
111
|
+
];
|
|
112
|
+
this.className = classes.filter(Boolean).join(' ');
|
|
113
|
+
}
|
|
114
|
+
firstUpdated(changedProperties) {
|
|
115
|
+
super.firstUpdated(changedProperties);
|
|
116
|
+
this.emit('btu-radio-ready');
|
|
117
|
+
}
|
|
118
|
+
updated(changedProperties) {
|
|
119
|
+
super.updated(changedProperties);
|
|
120
|
+
this._relayAriaDescribedBy();
|
|
121
|
+
if (!this._userInitiated)
|
|
122
|
+
return;
|
|
123
|
+
this._userInitiated = false;
|
|
124
|
+
if (changedProperties.has('checked')) {
|
|
125
|
+
if (this.value == null) {
|
|
126
|
+
console.warn('btu-radio: selected without a `value`; the parent btu-radio-group cannot track this option.', this);
|
|
127
|
+
}
|
|
128
|
+
this.emit('btu-radio-change', { checked: this.checked, value: this.value ?? '' });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
_onInputChange(e) {
|
|
132
|
+
const input = e.target;
|
|
133
|
+
this._userInitiated = true;
|
|
134
|
+
this.checked = input.checked;
|
|
135
|
+
}
|
|
136
|
+
/** @internal Own `disabled`, or `disabled` inherited from the parent group */
|
|
137
|
+
get _isDisabled() {
|
|
138
|
+
return this.disabled || this._groupDisabled;
|
|
139
|
+
}
|
|
140
|
+
get _describedBy() {
|
|
141
|
+
const ids = [];
|
|
142
|
+
if (this.description)
|
|
143
|
+
ids.push(this._descId);
|
|
144
|
+
if (this.error)
|
|
145
|
+
ids.push(this._errorId);
|
|
146
|
+
return ids.length ? ids.join(' ') : undefined;
|
|
147
|
+
}
|
|
148
|
+
/** @internal
|
|
149
|
+
* TooltipMixin puts aria-describedby on the host, but focus lands on the inner
|
|
150
|
+
* input — point it at the input instead, merged with the description/error ids.
|
|
151
|
+
*/
|
|
152
|
+
_relayAriaDescribedBy() {
|
|
153
|
+
const input = this.renderRoot.querySelector('.btu-radio-input');
|
|
154
|
+
if (!input)
|
|
155
|
+
return;
|
|
156
|
+
this.removeAttribute('aria-describedby');
|
|
157
|
+
const tooltipId = this.renderRoot.querySelector('[data-tooltip-internal]')?.id;
|
|
158
|
+
const ids = [this._describedBy, tooltipId].filter(Boolean).join(' ');
|
|
159
|
+
if (ids) {
|
|
160
|
+
input.setAttribute('aria-describedby', ids);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
input.removeAttribute('aria-describedby');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
render() {
|
|
167
|
+
return html `
|
|
168
|
+
<input
|
|
169
|
+
type="radio"
|
|
170
|
+
class="btu-radio-input"
|
|
171
|
+
.checked=${live(this.checked)}
|
|
172
|
+
?disabled=${this._isDisabled}
|
|
173
|
+
?required=${this._groupRequired}
|
|
174
|
+
name=${ifDefined(this.name)}
|
|
175
|
+
value=${ifDefined(this.value)}
|
|
176
|
+
tabindex=${this._tabindex}
|
|
177
|
+
aria-label=${ifDefined(this.label)}
|
|
178
|
+
aria-invalid=${ifDefined(this.invalid || this.error ? 'true' : undefined)}
|
|
179
|
+
@change=${this._onInputChange}
|
|
180
|
+
/>
|
|
181
|
+
<span class="btu-radio-box">
|
|
182
|
+
<span class="btu-radio-dot"></span>
|
|
183
|
+
</span>
|
|
184
|
+
${this.label || this.description || this.error
|
|
185
|
+
? html `
|
|
186
|
+
<span class="btu-radio-text">
|
|
187
|
+
${this.label ? html `<span class="btu-radio-label">${this.label}</span>` : nothing}
|
|
188
|
+
${this.description
|
|
189
|
+
? html `<span id=${this._descId} class="btu-radio-description">${this.description}</span>`
|
|
190
|
+
: nothing}
|
|
191
|
+
${this.error ? html `<span id=${this._errorId} class="btu-radio-error">${this.error}</span>` : nothing}
|
|
192
|
+
</span>
|
|
193
|
+
`
|
|
194
|
+
: nothing}
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
__decorate([
|
|
199
|
+
property()
|
|
200
|
+
], Radio.prototype, "label", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property()
|
|
203
|
+
], Radio.prototype, "description", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ reflect: true })
|
|
206
|
+
], Radio.prototype, "size", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: Boolean, reflect: true })
|
|
209
|
+
], Radio.prototype, "checked", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: Boolean, reflect: true })
|
|
212
|
+
], Radio.prototype, "disabled", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Boolean, reflect: true })
|
|
215
|
+
], Radio.prototype, "invalid", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property()
|
|
218
|
+
], Radio.prototype, "error", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property()
|
|
221
|
+
], Radio.prototype, "value", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
property()
|
|
224
|
+
], Radio.prototype, "name", void 0);
|
|
225
|
+
if (!customElements.get('btu-radio')) {
|
|
226
|
+
customElements.define('btu-radio', Radio);
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=Radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/radio/Radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAA1F;;QAeE;;;WAGG;QAEH,SAAI,GAAgB,IAAI,CAAA;QAExB;;;WAGG;QAEH,YAAO,GAAG,KAAK,CAAA;QAEf;;;WAGG;QAEH,aAAQ,GAAG,KAAK,CAAA;QAEhB;;;WAGG;QAEH,YAAO,GAAG,KAAK,CAAA;QAyBf;;;WAGG;QACH,cAAS,GAAG,CAAC,CAAA;QAEb,gFAAgF;QAChF,mBAAc,GAAG,KAAK,CAAA;QAEtB,gFAAgF;QAChF,mBAAc,GAAG,KAAK,CAAA;QAEd,mBAAc,GAAG,KAAK,CAAA;QACtB,oBAAe,GAAa,EAAE,CAAA;QAC9B,4BAAuB,GAAG,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AO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAC5B;AAQf;IADC,QAAQ,EAAE;oCACc;AAOzB;IADC,QAAQ,EAAE;oCACc;AAQzB;IADC,QAAQ,EAAE;mCACa;AAyJ1B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;IACrC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const RadioGroup_base: (new (...args: any[]) => import("../../util/RovingTabindexMixin.js").RovingTabindexInterface) & (new (...args: any[]) => import("../../util/EventEmitterMixin.js").EventEmitterMixinInterface) & (new (...args: any[]) => import("../../util/ReadyMixin.js").ReadyMixinInterface) & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* A container that groups `btu-radio` options into a single-select control.
|
|
5
|
+
*
|
|
6
|
+
* Owns the shared form `name`, the selected `value`, and keyboard navigation
|
|
7
|
+
* following the WAI-ARIA radio group pattern: a single roving tabstop, and
|
|
8
|
+
* arrow keys that move focus and select in one step. Selection state and the
|
|
9
|
+
* `disabled` / `size` properties are propagated down to child radios.
|
|
10
|
+
*
|
|
11
|
+
* @element btu-radio-group
|
|
12
|
+
*
|
|
13
|
+
* @fires {CustomEvent} btu-radio-group-ready - Fired after first render and initialization
|
|
14
|
+
* @fires {CustomEvent<{ value: string }>} btu-radio-group-change - Fired when the selected value changes
|
|
15
|
+
* @fires {CustomEvent} btu-radio-ready - Fired when a child radio finishes initialization (bubbles from btu-radio)
|
|
16
|
+
* @fires {CustomEvent<{ checked: boolean; value: string }>} btu-radio-change - Fired when a child radio is selected (bubbles from btu-radio)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```html
|
|
20
|
+
* <btu-radio-group name="plan" value="pro">
|
|
21
|
+
* <btu-radio value="free" label="Free"></btu-radio>
|
|
22
|
+
* <btu-radio value="pro" label="Pro"></btu-radio>
|
|
23
|
+
* <btu-radio value="team" label="Team" disabled></btu-radio>
|
|
24
|
+
* </btu-radio-group>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export default class RadioGroup extends RadioGroup_base {
|
|
28
|
+
/**
|
|
29
|
+
* Form field name shared by every radio in the group.
|
|
30
|
+
* @attr
|
|
31
|
+
*/
|
|
32
|
+
name: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Value of the currently selected option.
|
|
35
|
+
* @attr
|
|
36
|
+
*/
|
|
37
|
+
value: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Layout direction of the options.
|
|
40
|
+
* @attr
|
|
41
|
+
*/
|
|
42
|
+
orientation: 'vertical' | 'horizontal';
|
|
43
|
+
/**
|
|
44
|
+
* Controls the scale of every radio in the group.
|
|
45
|
+
* @attr
|
|
46
|
+
*/
|
|
47
|
+
size: 'sm' | 'md';
|
|
48
|
+
/**
|
|
49
|
+
* Marks a selection as mandatory for form submission.
|
|
50
|
+
* @attr
|
|
51
|
+
*/
|
|
52
|
+
required: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Disables every option in the group.
|
|
55
|
+
* @attr
|
|
56
|
+
*/
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
/** @internal */
|
|
59
|
+
private _initialClasses;
|
|
60
|
+
/** @internal */
|
|
61
|
+
private _initialClassesCaptured;
|
|
62
|
+
/** @internal */
|
|
63
|
+
private _boundHandleRadioChange;
|
|
64
|
+
/** @internal */
|
|
65
|
+
private _boundHandleKeyDown;
|
|
66
|
+
connectedCallback(): void;
|
|
67
|
+
disconnectedCallback(): void;
|
|
68
|
+
createRenderRoot(): this;
|
|
69
|
+
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
70
|
+
firstUpdated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
71
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
72
|
+
/** @internal Focusable native inputs of enabled radios, in DOM order */
|
|
73
|
+
_getRovingTargets(): HTMLElement[];
|
|
74
|
+
/** @internal */
|
|
75
|
+
private _getRadios;
|
|
76
|
+
/** @internal Push group state down to each child radio */
|
|
77
|
+
private _syncRadios;
|
|
78
|
+
/** @internal Select a value, sync children, and announce the change */
|
|
79
|
+
private _selectValue;
|
|
80
|
+
/** @internal */
|
|
81
|
+
private _handleRadioChange;
|
|
82
|
+
/** @internal Select whichever enabled radio currently holds focus */
|
|
83
|
+
private _selectFocusedRadio;
|
|
84
|
+
/** @internal WAI-ARIA radio group: arrows move focus and select together */
|
|
85
|
+
private _handleKeyDown;
|
|
86
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
87
|
+
}
|
|
88
|
+
declare global {
|
|
89
|
+
interface HTMLElementTagNameMap {
|
|
90
|
+
'btu-radio-group': RadioGroup;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAA;;AAOtC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,eAA8D;IACpG;;;OAGG;IAEH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IAExB;;;OAGG;IAEH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAEzB;;;OAGG;IAEH,WAAW,EAAE,UAAU,GAAG,YAAY,CAAa;IAEnD;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAO;IAExB;;;OAGG;IAEH,QAAQ,UAAQ;IAEhB;;;OAGG;IAEH,QAAQ,UAAQ;IAEhB,gBAAgB;IAChB,OAAO,CAAC,eAAe,CAAe;IACtC,gBAAgB;IAChB,OAA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