@editora/ui-core 0.1.19 → 0.1.21

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.
Files changed (313) hide show
  1. package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
  2. package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
  3. package/dist/accordion.cjs.js +3 -3
  4. package/dist/accordion.esm.js +39 -62
  5. package/dist/alert-dialog.cjs.js +19 -19
  6. package/dist/alert-dialog.esm.js +69 -87
  7. package/dist/alert.cjs.js +1 -1
  8. package/dist/alert.esm.js +4 -7
  9. package/dist/anchor.cjs.js +2 -2
  10. package/dist/anchor.esm.js +3 -3
  11. package/dist/animated-beam.cjs.js +83 -83
  12. package/dist/animated-beam.esm.js +250 -277
  13. package/dist/animated-list.cjs.js +4 -4
  14. package/dist/animated-list.esm.js +47 -61
  15. package/dist/animated-text.cjs.js +2 -2
  16. package/dist/animated-text.esm.js +13 -24
  17. package/dist/app-header.cjs.js +3 -3
  18. package/dist/app-header.esm.js +11 -13
  19. package/dist/aspect-ratio.cjs.js +1 -1
  20. package/dist/aspect-ratio.esm.js +4 -7
  21. package/dist/avatar.cjs.js +1 -1
  22. package/dist/avatar.esm.js +7 -13
  23. package/dist/badge.cjs.js +1 -1
  24. package/dist/badge.esm.js +4 -7
  25. package/dist/block-controls.cjs.js +2 -2
  26. package/dist/block-controls.esm.js +19 -35
  27. package/dist/box.cjs.js +1 -1
  28. package/dist/box.esm.js +8 -15
  29. package/dist/breadcrumb.cjs.js +2 -2
  30. package/dist/breadcrumb.esm.js +20 -37
  31. package/dist/button.cjs.js +1 -521
  32. package/dist/button.esm.js +2 -671
  33. package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
  34. package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
  35. package/dist/calendar.cjs.js +1 -1
  36. package/dist/calendar.esm.js +8 -9
  37. package/dist/card.cjs.js +4 -4
  38. package/dist/card.esm.js +13 -19
  39. package/dist/chart.cjs.js +64 -64
  40. package/dist/chart.esm.js +223 -254
  41. package/dist/checkbox.cjs.js +1 -1
  42. package/dist/checkbox.esm.js +2 -3
  43. package/dist/collapsible.cjs.js +1 -1
  44. package/dist/collapsible.esm.js +5 -9
  45. package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
  46. package/dist/collection.cjs.js +1 -1
  47. package/dist/collection.esm.js +30 -29
  48. package/dist/color-picker.cjs.js +10 -10
  49. package/dist/color-picker.esm.js +190 -253
  50. package/dist/combobox.cjs.js +13 -13
  51. package/dist/combobox.esm.js +93 -126
  52. package/dist/command-palette.cjs.js +3 -3
  53. package/dist/command-palette.esm.js +19 -30
  54. package/dist/command.cjs.js +4 -4
  55. package/dist/command.esm.js +41 -53
  56. package/dist/components/ui-collection.d.ts.map +1 -1
  57. package/dist/components/ui-multi-select.d.ts.map +1 -1
  58. package/dist/components/ui-orbiter.d.ts.map +1 -1
  59. package/dist/components/ui-portal.d.ts.map +1 -1
  60. package/dist/components/ui-positioner.d.ts.map +1 -1
  61. package/dist/components/ui-skeleton.d.ts.map +1 -1
  62. package/dist/components/ui-sortable.d.ts +8 -0
  63. package/dist/components/ui-sortable.d.ts.map +1 -1
  64. package/dist/components/ui-split-button.d.ts +1 -0
  65. package/dist/components/ui-split-button.d.ts.map +1 -1
  66. package/dist/components/ui-tabs.d.ts.map +1 -1
  67. package/dist/components/ui-textarea.d.ts.map +1 -1
  68. package/dist/components/ui-time-picker.d.ts.map +1 -1
  69. package/dist/container.cjs.js +2 -2
  70. package/dist/container.esm.js +2 -3
  71. package/dist/context-menu.cjs.js +8 -8
  72. package/dist/context-menu.esm.js +157 -219
  73. package/dist/control-group.cjs.js +1 -1
  74. package/dist/control-group.esm.js +2 -3
  75. package/dist/data-table.cjs.js +4 -4
  76. package/dist/data-table.esm.js +299 -381
  77. package/dist/date-field.cjs.js +3 -3
  78. package/dist/date-field.esm.js +68 -80
  79. package/dist/date-picker.cjs.js +9 -9
  80. package/dist/date-picker.esm.js +69 -97
  81. package/dist/date-range-picker.cjs.js +3 -3
  82. package/dist/date-range-picker.esm.js +32 -56
  83. package/dist/date-range-time-picker.cjs.js +9 -9
  84. package/dist/date-range-time-picker.esm.js +111 -140
  85. package/dist/date-time-picker.cjs.js +7 -7
  86. package/dist/date-time-picker.esm.js +115 -147
  87. package/dist/date-time-utils-Dmost5Ee.js +1 -0
  88. package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
  89. package/dist/description.cjs.js +1 -1
  90. package/dist/description.esm.js +3 -5
  91. package/dist/dialog.cjs.js +12 -12
  92. package/dist/dialog.esm.js +44 -63
  93. package/dist/direction-provider.cjs.js +1 -1
  94. package/dist/direction-provider.esm.js +2 -3
  95. package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
  96. package/dist/dismissable-layer-DNfrKA20.js +1 -0
  97. package/dist/dismissable-layer.cjs.js +2 -2
  98. package/dist/dismissable-layer.esm.js +4 -6
  99. package/dist/dock.cjs.js +5 -5
  100. package/dist/dock.esm.js +134 -155
  101. package/dist/drawer.cjs.js +2 -2
  102. package/dist/drawer.esm.js +18 -35
  103. package/dist/dropdown.cjs.js +2 -2
  104. package/dist/dropdown.esm.js +119 -149
  105. package/dist/dropzone.cjs.js +1 -1
  106. package/dist/dropzone.esm.js +0 -1
  107. package/dist/empty-state.cjs.js +1 -1
  108. package/dist/empty-state.esm.js +1 -1
  109. package/dist/field-error.cjs.js +1 -1
  110. package/dist/field-error.esm.js +3 -5
  111. package/dist/field.cjs.js +5 -5
  112. package/dist/field.esm.js +27 -34
  113. package/dist/fieldset.cjs.js +4 -4
  114. package/dist/fieldset.esm.js +19 -24
  115. package/dist/file-upload.cjs.js +4 -4
  116. package/dist/file-upload.esm.js +69 -93
  117. package/dist/flex.cjs.js +1 -1
  118. package/dist/flex.esm.js +5 -9
  119. package/dist/floating-toolbar.cjs.js +4 -4
  120. package/dist/floating-toolbar.esm.js +60 -85
  121. package/dist/focus-scope-Bwug2gDv.js +1 -0
  122. package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
  123. package/dist/focus-scope.cjs.js +2 -2
  124. package/dist/focus-scope.esm.js +15 -20
  125. package/dist/form.cjs.js +2 -2
  126. package/dist/form.esm.js +26 -53
  127. package/dist/gantt.cjs.js +43 -43
  128. package/dist/gantt.esm.js +295 -322
  129. package/dist/grid.cjs.js +1 -1
  130. package/dist/grid.esm.js +5 -9
  131. package/dist/hover-card.cjs.js +4 -4
  132. package/dist/hover-card.esm.js +22 -28
  133. package/dist/icon-cloud.cjs.js +7 -7
  134. package/dist/icon-cloud.esm.js +48 -62
  135. package/dist/icon.cjs.js +1 -1
  136. package/dist/icon.esm.js +2 -4
  137. package/dist/index.cjs.js +1 -1
  138. package/dist/index.esm.js +378 -390
  139. package/dist/inline-edit.cjs.js +11 -11
  140. package/dist/inline-edit.esm.js +32 -36
  141. package/dist/input.cjs.js +17 -17
  142. package/dist/input.esm.js +50 -63
  143. package/dist/label.cjs.js +2 -2
  144. package/dist/label.esm.js +8 -17
  145. package/dist/layout.cjs.js +2 -2
  146. package/dist/layout.esm.js +20 -26
  147. package/dist/listbox-B6QgECax.js +46 -0
  148. package/dist/listbox-DJamVeFj.mjs +200 -0
  149. package/dist/listbox.cjs.js +1 -1
  150. package/dist/listbox.esm.js +2 -4
  151. package/dist/marquee.cjs.js +5 -5
  152. package/dist/marquee.esm.js +33 -50
  153. package/dist/masonry-grid.cjs.js +1 -1
  154. package/dist/masonry-grid.esm.js +5 -9
  155. package/dist/menu.cjs.js +3 -3
  156. package/dist/menu.esm.js +106 -126
  157. package/dist/menubar.cjs.js +5 -5
  158. package/dist/menubar.esm.js +118 -164
  159. package/dist/meter.cjs.js +2 -2
  160. package/dist/meter.esm.js +4 -4
  161. package/dist/multi-select.cjs.js +5 -5
  162. package/dist/multi-select.esm.js +125 -137
  163. package/dist/navigation-menu.cjs.js +4 -4
  164. package/dist/navigation-menu.esm.js +44 -55
  165. package/dist/number-field.cjs.js +2 -2
  166. package/dist/number-field.esm.js +73 -98
  167. package/dist/number-ticker.cjs.js +3 -3
  168. package/dist/number-ticker.esm.js +22 -43
  169. package/dist/odometer.cjs.js +1 -1
  170. package/dist/odometer.esm.js +5 -9
  171. package/dist/orbiter.cjs.js +13 -13
  172. package/dist/orbiter.esm.js +79 -90
  173. package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
  174. package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
  175. package/dist/pagination.cjs.js +2 -2
  176. package/dist/pagination.esm.js +14 -18
  177. package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
  178. package/dist/panel-group-CaD0_KQf.js +36 -0
  179. package/dist/panel-group.cjs.js +1 -1
  180. package/dist/panel-group.esm.js +2 -5
  181. package/dist/panel.cjs.js +4 -4
  182. package/dist/panel.esm.js +8 -10
  183. package/dist/password-field.cjs.js +9 -9
  184. package/dist/password-field.esm.js +62 -82
  185. package/dist/pin-input.cjs.js +3 -3
  186. package/dist/pin-input.esm.js +33 -39
  187. package/dist/placement-grid.cjs.js +4 -4
  188. package/dist/placement-grid.esm.js +108 -131
  189. package/dist/plugin-panel.cjs.js +7 -7
  190. package/dist/plugin-panel.esm.js +13 -15
  191. package/dist/popover.cjs.js +2 -2
  192. package/dist/popover.esm.js +21 -31
  193. package/dist/portal-DgpQ3Jo1.js +1 -0
  194. package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
  195. package/dist/portal.cjs.js +3 -3
  196. package/dist/portal.esm.js +20 -28
  197. package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
  198. package/dist/positioner-D_fqyx_j.js +1 -0
  199. package/dist/positioner.cjs.js +2 -2
  200. package/dist/positioner.esm.js +22 -28
  201. package/dist/presence.cjs.js +1 -1
  202. package/dist/presence.esm.js +7 -13
  203. package/dist/primitives/auto-scroll.d.ts +9 -0
  204. package/dist/primitives/auto-scroll.d.ts.map +1 -0
  205. package/dist/primitives/selector.d.ts +4 -0
  206. package/dist/primitives/selector.d.ts.map +1 -0
  207. package/dist/progress.cjs.js +1 -1
  208. package/dist/progress.esm.js +5 -9
  209. package/dist/quick-actions.cjs.js +6 -6
  210. package/dist/quick-actions.esm.js +52 -62
  211. package/dist/radio-group.cjs.js +13 -13
  212. package/dist/radio-group.esm.js +39 -51
  213. package/dist/radio.cjs.js +1 -1
  214. package/dist/radio.esm.js +5 -9
  215. package/dist/rating.cjs.js +1 -1
  216. package/dist/rating.esm.js +12 -23
  217. package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
  218. package/dist/roving-focus-group.cjs.js +1 -1
  219. package/dist/roving-focus-group.esm.js +3 -5
  220. package/dist/runtime-CTaOSmBj.js +1 -0
  221. package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
  222. package/dist/runtime.cjs.js +1 -1
  223. package/dist/runtime.esm.js +6 -6
  224. package/dist/scroll-area.cjs.js +3 -3
  225. package/dist/scroll-area.esm.js +38 -46
  226. package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
  227. package/dist/section.cjs.js +1 -1
  228. package/dist/section.esm.js +1 -1
  229. package/dist/select.cjs.js +7 -7
  230. package/dist/select.esm.js +67 -97
  231. package/dist/selection-popup.cjs.js +1 -1
  232. package/dist/selection-popup.esm.js +8 -15
  233. package/dist/selector-BvAh35ve.js +1 -0
  234. package/dist/selector-WI8pD7YO.mjs +18 -0
  235. package/dist/separator.cjs.js +1 -1
  236. package/dist/separator.esm.js +1 -1
  237. package/dist/sidebar.cjs.js +18 -18
  238. package/dist/sidebar.esm.js +117 -139
  239. package/dist/skeleton.cjs.js +11 -11
  240. package/dist/skeleton.esm.js +27 -24
  241. package/dist/slider.cjs.js +1 -1
  242. package/dist/slider.esm.js +6 -11
  243. package/dist/slot.cjs.js +4 -4
  244. package/dist/slot.esm.js +16 -19
  245. package/dist/sortable.cjs.js +79 -65
  246. package/dist/sortable.esm.js +714 -734
  247. package/dist/spinning-text.cjs.js +12 -12
  248. package/dist/spinning-text.esm.js +80 -92
  249. package/dist/split-button.cjs.js +4 -4
  250. package/dist/split-button.esm.js +77 -62
  251. package/dist/splitter.cjs.js +1 -1
  252. package/dist/splitter.esm.js +1 -1
  253. package/dist/stepper.cjs.js +8 -8
  254. package/dist/stepper.esm.js +32 -52
  255. package/dist/switch.cjs.js +7 -7
  256. package/dist/switch.esm.js +23 -31
  257. package/dist/table.cjs.js +2 -2
  258. package/dist/table.esm.js +46 -56
  259. package/dist/tabs.cjs.js +8 -8
  260. package/dist/tabs.esm.js +89 -109
  261. package/dist/tags-input.cjs.js +4 -4
  262. package/dist/tags-input.esm.js +45 -62
  263. package/dist/textarea.cjs.js +10 -10
  264. package/dist/textarea.esm.js +49 -52
  265. package/dist/time-field.cjs.js +4 -4
  266. package/dist/time-field.esm.js +70 -84
  267. package/dist/time-picker.cjs.js +22 -22
  268. package/dist/time-picker.esm.js +88 -110
  269. package/dist/timeline.cjs.js +1 -1
  270. package/dist/timeline.esm.js +3 -5
  271. package/dist/toast.cjs.js +2 -2
  272. package/dist/toast.esm.js +33 -47
  273. package/dist/toggle-group.cjs.js +6 -6
  274. package/dist/toggle-group.esm.js +85 -105
  275. package/dist/toggle.cjs.js +1 -1
  276. package/dist/toggle.esm.js +3 -5
  277. package/dist/toolbar.cjs.js +1 -1
  278. package/dist/toolbar.esm.js +13 -24
  279. package/dist/tooltip.cjs.js +2 -2
  280. package/dist/tooltip.esm.js +31 -42
  281. package/dist/transfer-list.cjs.js +31 -31
  282. package/dist/transfer-list.esm.js +114 -127
  283. package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
  284. package/dist/tree-Dx_kv_ih.js +39 -0
  285. package/dist/tree-item.cjs.js +2 -2
  286. package/dist/tree-item.esm.js +2 -3
  287. package/dist/tree.cjs.js +1 -1
  288. package/dist/tree.esm.js +2 -5
  289. package/dist/ui-button-Q0GNNWKC.mjs +665 -0
  290. package/dist/ui-button-rXQOS9QJ.js +521 -0
  291. package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
  292. package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
  293. package/dist/visually-hidden.cjs.js +1 -1
  294. package/dist/visually-hidden.esm.js +1 -1
  295. package/dist/wizard.cjs.js +14 -14
  296. package/dist/wizard.esm.js +85 -105
  297. package/package.json +2 -2
  298. package/dist/date-time-utils-66480de4.js +0 -1
  299. package/dist/date-time-utils-a2c7af25.mjs +0 -307
  300. package/dist/dismissable-layer-193e3bed.js +0 -1
  301. package/dist/focus-scope-2b12b4e7.js +0 -1
  302. package/dist/listbox-308789a0.mjs +0 -210
  303. package/dist/listbox-ef2f708e.js +0 -46
  304. package/dist/panel-group-40254cdd.js +0 -36
  305. package/dist/portal-c69756c0.js +0 -1
  306. package/dist/positioner-33529bb8.js +0 -1
  307. package/dist/runtime-3f13807b.js +0 -1
  308. package/dist/tree-0a7a8d05.js +0 -39
  309. /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
  310. /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
  311. /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
  312. /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
  313. /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./ElementBase-1b301e7f.js"),c=require("./roving-focus-group-5c059bf9.js"),x=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./ElementBase-EV6mVBUV.js"),c=require("./roving-focus-group-BdJ_4Njm.js"),g=`
2
2
  :host {
3
3
  display: block;
4
4
  width: 100%;
@@ -229,27 +229,27 @@
229
229
  background: Highlight;
230
230
  }
231
231
  }
232
- `;function h(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p(s){return s==="horizontal"?"horizontal":"vertical"}function _(s){return s==="sm"||s==="lg"?s:"md"}function m(s){return s==="card"||s==="segmented"?s:"default"}function I(s){return s==="neutral"||s==="success"||s==="warning"||s==="danger"||s==="info"?s:"brand"}class f extends g.ElementBase{constructor(){super(),this._value="",this._disabled=!1,this._required=!1,this._orientation="vertical",this._focusIndex=-1,this._options=[],this._observer=null,this._onClickBound=e=>this._onClick(e),this._onKeydownBound=e=>this._onKeydown(e)}static get observedAttributes(){return["value","disabled","required","name","orientation","variant","size","tone","options","headless"]}connectedCallback(){this._syncFromAttributes(),super.connectedCallback(),this.root.addEventListener("click",this._onClickBound),this.root.addEventListener("keydown",this._onKeydownBound),typeof MutationObserver<"u"&&(this._observer||(this._observer=new MutationObserver(()=>{this.hasAttribute("options")||(this._syncFromAttributes(),this.requestRender())})),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){var e;this.root.removeEventListener("click",this._onClickBound),this.root.removeEventListener("keydown",this._onKeydownBound),(e=this._observer)==null||e.disconnect(),super.disconnectedCallback()}attributeChangedCallback(e,i,t){i!==t&&(this._syncFromAttributes(),e==="options"?this.requestRender():this._syncInteractiveState(),e==="value"&&this.dispatchEvent(new CustomEvent("valuechange",{detail:{value:this._value},bubbles:!0,composed:!0})))}get value(){return this._value}set value(e){const i=String(e||"");i!==this._value&&this.setAttribute("value",i)}get disabled(){return this._disabled}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}_syncFromAttributes(){var e;if(this._value=this.getAttribute("value")||"",this._disabled=this.hasAttribute("disabled"),this._required=this.hasAttribute("required"),this._orientation=p(this.getAttribute("orientation")),this._options=this._collectOptions(),this._focusIndex<0||this._focusIndex>=this._options.length||(e=this._options[this._focusIndex])!=null&&e.disabled){const i=this._findSelectedIndex();this._focusIndex=i>=0?i:this._findFirstEnabledIndex()}}_collectOptions(){const e=this.getAttribute("options");if(e&&e.trim())try{const t=JSON.parse(e);if(Array.isArray(t)){const r=t.map((o,a)=>{if(typeof o=="string")return{value:o,label:o,disabled:!1};if(o&&typeof o=="object"){const n=String(o.value??`option-${a+1}`),d=String(o.label??n),l=o.description==null?void 0:String(o.description),u=!!o.disabled;return{value:n,label:d,description:l,disabled:u}}return null}).filter(Boolean);if(r.length)return r}}catch{}return Array.from(this.children).filter(t=>t instanceof HTMLElement&&t.hasAttribute("data-radio")).map((t,r)=>{const o=t.getAttribute("data-value")||t.getAttribute("value"),a=(t.getAttribute("data-label")||t.textContent||"").trim(),n=(o||a||`option-${r+1}`).trim(),d=(t.getAttribute("data-description")||"").trim()||void 0,l=t.hasAttribute("data-disabled")||t.getAttribute("aria-disabled")==="true";return{value:n,label:a||n,description:d,disabled:l}})}_findSelectedIndex(){const e=this._options.findIndex(i=>i.value===this._value&&!i.disabled);return e>=0?e:this._value?-1:this._findFirstEnabledIndex()}_findFirstEnabledIndex(){return this._options.findIndex(e=>!e.disabled)}_selectIndex(e,i){if(this._disabled)return;const t=this._options[e];if(!t||t.disabled)return;const r=this._value!==t.value;if(this._focusIndex=e,r){this._value=t.value,this.getAttribute("value")!==t.value?this.setAttribute("value",t.value):this.requestRender();const o={value:t.value,option:{...t},reason:i,name:this.getAttribute("name")||void 0};this.dispatchEvent(new CustomEvent("input",{detail:o,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))}else this.requestRender();this._focusOption(e)}_moveSelection(e){const i=c.moveRovingFocusIndex(this._options,this._focusIndex,e>0?1:-1,{wrap:!0,fallbackIndex:c.resolveRovingFocusIndex(this._options,{activeIndex:this._focusIndex,selectedIndex:this._findSelectedIndex(),getDisabled:t=>!!t.disabled}),getDisabled:t=>!!t.disabled});i>=0&&this._selectIndex(i,"keyboard")}_focusOption(e){const i=this.root.querySelector(`.option[data-index="${e}"]`);c.focusRovingItem(i)}_syncInteractiveState(){if(!this.root.querySelector(".root"))return;this.setAttribute("role","radiogroup"),this.setAttribute("aria-disabled",this._disabled?"true":"false"),this.setAttribute("aria-required",this._required?"true":"false"),this.setAttribute("aria-orientation",this._orientation);const i=this._findSelectedIndex(),t=i>=0?i:this._findFirstEnabledIndex();this._focusIndex=c.resolveRovingFocusIndex(this._options,{activeIndex:this._focusIndex,selectedIndex:t,getDisabled:a=>!!a.disabled});const r=this.root.querySelectorAll(".option[data-index]");r.forEach(a=>{const n=Number(a.getAttribute("data-index"));if(Number.isNaN(n))return;const d=this._options[n];if(!d)return;const l=n===t,u=this._disabled||!!d.disabled,b=n===this._focusIndex?0:-1;a.setAttribute("data-value",d.value),a.setAttribute("data-checked",l?"true":"false"),a.setAttribute("data-disabled",u?"true":"false"),a.setAttribute("aria-checked",l?"true":"false"),a.setAttribute("aria-disabled",u?"true":"false"),a.setAttribute("tabindex",String(b))});const o=Array.from(r);c.syncRovingTabStops(o,o[this._focusIndex]||null,{activeAttribute:null})}_onClick(e){const i=e.target;if(!i)return;const t=i.closest(".option");if(!t)return;const r=Number(t.getAttribute("data-index"));Number.isNaN(r)||this._selectIndex(r,"click")}_onKeydown(e){if(this._disabled)return;const i=e.key,t=this._orientation==="horizontal";if(i==="ArrowRight"&&t||i==="ArrowDown"){e.preventDefault(),this._moveSelection(1);return}if(i==="ArrowLeft"&&t||i==="ArrowUp"){e.preventDefault(),this._moveSelection(-1);return}if(i==="Home"){e.preventDefault();const r=c.getRovingFocusBoundaryIndex(this._options,"first",o=>!!o.disabled);r>=0&&this._selectIndex(r,"keyboard");return}if(i==="End"){e.preventDefault();const r=c.getRovingFocusBoundaryIndex(this._options,"last",o=>!!o.disabled);r>=0&&this._selectIndex(r,"keyboard");return}if(i===" "||i==="Enter"){e.preventDefault();const r=this._focusIndex>=0?this._focusIndex:this._findSelectedIndex();r>=0&&this._selectIndex(r,"keyboard")}}render(){var n;const e=_(this.getAttribute("size")),i=m(this.getAttribute("variant")),t=I(this.getAttribute("tone")),r=p(this.getAttribute("orientation"));this.setAttribute("role","radiogroup"),this.setAttribute("aria-disabled",this._disabled?"true":"false"),this.setAttribute("aria-required",this._required?"true":"false"),this.setAttribute("aria-orientation",r);const o=this._findSelectedIndex(),a=o>=0?o:this._findFirstEnabledIndex();(this._focusIndex<0||this._focusIndex>=this._options.length||(n=this._options[this._focusIndex])!=null&&n.disabled)&&(this._focusIndex=a),this.setContent(`
233
- <style>${x}</style>
232
+ `;function h(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p(s){return s==="horizontal"?"horizontal":"vertical"}function x(s){return s==="sm"||s==="lg"?s:"md"}function _(s){return s==="card"||s==="segmented"?s:"default"}function m(s){return s==="neutral"||s==="success"||s==="warning"||s==="danger"||s==="info"?s:"brand"}class f extends v.ElementBase{constructor(){super(),this._value="",this._disabled=!1,this._required=!1,this._orientation="vertical",this._focusIndex=-1,this._options=[],this._observer=null,this._onClickBound=e=>this._onClick(e),this._onKeydownBound=e=>this._onKeydown(e)}static get observedAttributes(){return["value","disabled","required","name","orientation","variant","size","tone","options","headless"]}connectedCallback(){this._syncFromAttributes(),super.connectedCallback(),this.root.addEventListener("click",this._onClickBound),this.root.addEventListener("keydown",this._onKeydownBound),typeof MutationObserver<"u"&&(this._observer||(this._observer=new MutationObserver(()=>{this.hasAttribute("options")||(this._syncFromAttributes(),this.requestRender())})),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this.root.removeEventListener("click",this._onClickBound),this.root.removeEventListener("keydown",this._onKeydownBound),this._observer?.disconnect(),super.disconnectedCallback()}attributeChangedCallback(e,i,t){i!==t&&(this._syncFromAttributes(),e==="options"?this.requestRender():this._syncInteractiveState(),e==="value"&&this.dispatchEvent(new CustomEvent("valuechange",{detail:{value:this._value},bubbles:!0,composed:!0})))}get value(){return this._value}set value(e){const i=String(e||"");i!==this._value&&this.setAttribute("value",i)}get disabled(){return this._disabled}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}_syncFromAttributes(){if(this._value=this.getAttribute("value")||"",this._disabled=this.hasAttribute("disabled"),this._required=this.hasAttribute("required"),this._orientation=p(this.getAttribute("orientation")),this._options=this._collectOptions(),this._focusIndex<0||this._focusIndex>=this._options.length||this._options[this._focusIndex]?.disabled){const e=this._findSelectedIndex();this._focusIndex=e>=0?e:this._findFirstEnabledIndex()}}_collectOptions(){const e=this.getAttribute("options");if(e&&e.trim())try{const t=JSON.parse(e);if(Array.isArray(t)){const r=t.map((o,a)=>{if(typeof o=="string")return{value:o,label:o,disabled:!1};if(o&&typeof o=="object"){const n=String(o.value??`option-${a+1}`),d=String(o.label??n),l=o.description==null?void 0:String(o.description),u=!!o.disabled;return{value:n,label:d,description:l,disabled:u}}return null}).filter(Boolean);if(r.length)return r}}catch{}return Array.from(this.children).filter(t=>t instanceof HTMLElement&&t.hasAttribute("data-radio")).map((t,r)=>{const o=t.getAttribute("data-value")||t.getAttribute("value"),a=(t.getAttribute("data-label")||t.textContent||"").trim(),n=(o||a||`option-${r+1}`).trim(),d=(t.getAttribute("data-description")||"").trim()||void 0,l=t.hasAttribute("data-disabled")||t.getAttribute("aria-disabled")==="true";return{value:n,label:a||n,description:d,disabled:l}})}_findSelectedIndex(){const e=this._options.findIndex(i=>i.value===this._value&&!i.disabled);return e>=0?e:this._value?-1:this._findFirstEnabledIndex()}_findFirstEnabledIndex(){return this._options.findIndex(e=>!e.disabled)}_selectIndex(e,i){if(this._disabled)return;const t=this._options[e];if(!t||t.disabled)return;const r=this._value!==t.value;if(this._focusIndex=e,r){this._value=t.value,this.getAttribute("value")!==t.value?this.setAttribute("value",t.value):this.requestRender();const o={value:t.value,option:{...t},reason:i,name:this.getAttribute("name")||void 0};this.dispatchEvent(new CustomEvent("input",{detail:o,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))}else this.requestRender();this._focusOption(e)}_moveSelection(e){const i=c.moveRovingFocusIndex(this._options,this._focusIndex,e>0?1:-1,{wrap:!0,fallbackIndex:c.resolveRovingFocusIndex(this._options,{activeIndex:this._focusIndex,selectedIndex:this._findSelectedIndex(),getDisabled:t=>!!t.disabled}),getDisabled:t=>!!t.disabled});i>=0&&this._selectIndex(i,"keyboard")}_focusOption(e){const i=this.root.querySelector(`.option[data-index="${e}"]`);c.focusRovingItem(i)}_syncInteractiveState(){if(!this.root.querySelector(".root"))return;this.setAttribute("role","radiogroup"),this.setAttribute("aria-disabled",this._disabled?"true":"false"),this.setAttribute("aria-required",this._required?"true":"false"),this.setAttribute("aria-orientation",this._orientation);const i=this._findSelectedIndex(),t=i>=0?i:this._findFirstEnabledIndex();this._focusIndex=c.resolveRovingFocusIndex(this._options,{activeIndex:this._focusIndex,selectedIndex:t,getDisabled:a=>!!a.disabled});const r=this.root.querySelectorAll(".option[data-index]");r.forEach(a=>{const n=Number(a.getAttribute("data-index"));if(Number.isNaN(n))return;const d=this._options[n];if(!d)return;const l=n===t,u=this._disabled||!!d.disabled,b=n===this._focusIndex?0:-1;a.setAttribute("data-value",d.value),a.setAttribute("data-checked",l?"true":"false"),a.setAttribute("data-disabled",u?"true":"false"),a.setAttribute("aria-checked",l?"true":"false"),a.setAttribute("aria-disabled",u?"true":"false"),a.setAttribute("tabindex",String(b))});const o=Array.from(r);c.syncRovingTabStops(o,o[this._focusIndex]||null,{activeAttribute:null})}_onClick(e){const i=e.target;if(!i)return;const t=i.closest(".option");if(!t)return;const r=Number(t.getAttribute("data-index"));Number.isNaN(r)||this._selectIndex(r,"click")}_onKeydown(e){if(this._disabled)return;const i=e.key,t=this._orientation==="horizontal";if(i==="ArrowRight"&&t||i==="ArrowDown"){e.preventDefault(),this._moveSelection(1);return}if(i==="ArrowLeft"&&t||i==="ArrowUp"){e.preventDefault(),this._moveSelection(-1);return}if(i==="Home"){e.preventDefault();const r=c.getRovingFocusBoundaryIndex(this._options,"first",o=>!!o.disabled);r>=0&&this._selectIndex(r,"keyboard");return}if(i==="End"){e.preventDefault();const r=c.getRovingFocusBoundaryIndex(this._options,"last",o=>!!o.disabled);r>=0&&this._selectIndex(r,"keyboard");return}if(i===" "||i==="Enter"){e.preventDefault();const r=this._focusIndex>=0?this._focusIndex:this._findSelectedIndex();r>=0&&this._selectIndex(r,"keyboard")}}render(){const e=x(this.getAttribute("size")),i=_(this.getAttribute("variant")),t=m(this.getAttribute("tone")),r=p(this.getAttribute("orientation"));this.setAttribute("role","radiogroup"),this.setAttribute("aria-disabled",this._disabled?"true":"false"),this.setAttribute("aria-required",this._required?"true":"false"),this.setAttribute("aria-orientation",r);const o=this._findSelectedIndex(),a=o>=0?o:this._findFirstEnabledIndex();(this._focusIndex<0||this._focusIndex>=this._options.length||this._options[this._focusIndex]?.disabled)&&(this._focusIndex=a),this.setContent(`
233
+ <style>${g}</style>
234
234
  <div class="root" part="root" data-size="${e}" data-variant="${i}" data-tone="${t}">
235
- ${this._options.map((d,l)=>{const u=l===a,b=this._disabled||!!d.disabled,v=l===this._focusIndex?0:-1;return`
235
+ ${this._options.map((n,d)=>{const l=d===a,u=this._disabled||!!n.disabled,b=d===this._focusIndex?0:-1;return`
236
236
  <button
237
237
  type="button"
238
238
  class="option"
239
239
  part="option"
240
240
  role="radio"
241
- data-index="${l}"
242
- data-value="${h(d.value)}"
243
- data-checked="${u?"true":"false"}"
244
- data-disabled="${b?"true":"false"}"
245
- aria-checked="${u?"true":"false"}"
246
- aria-disabled="${b?"true":"false"}"
247
- tabindex="${v}"
241
+ data-index="${d}"
242
+ data-value="${h(n.value)}"
243
+ data-checked="${l?"true":"false"}"
244
+ data-disabled="${u?"true":"false"}"
245
+ aria-checked="${l?"true":"false"}"
246
+ aria-disabled="${u?"true":"false"}"
247
+ tabindex="${b}"
248
248
  >
249
249
  <span class="control" part="control"><span class="dot" part="dot"></span></span>
250
250
  <span class="text" part="text">
251
- <span class="label" part="label">${h(d.label)}</span>
252
- ${d.description?`<span class="description" part="description">${h(d.description)}</span>`:""}
251
+ <span class="label" part="label">${h(n.label)}</span>
252
+ ${n.description?`<span class="description" part="description">${h(n.description)}</span>`:""}
253
253
  </span>
254
254
  </button>
255
255
  `}).join("")}
@@ -1,6 +1,6 @@
1
- import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { m as g, r as h, f as m, s as _, g as p } from "./roving-focus-group-4350c9a7.mjs";
3
- const I = `
1
+ import { E as v } from "./ElementBase-YlTLMsGk.mjs";
2
+ import { m as x, r as h, f as g, s as m, g as p } from "./roving-focus-group-Dbm1Jko_.mjs";
3
+ const _ = `
4
4
  :host {
5
5
  display: block;
6
6
  width: 100%;
@@ -238,16 +238,16 @@ function b(s) {
238
238
  function f(s) {
239
239
  return s === "horizontal" ? "horizontal" : "vertical";
240
240
  }
241
- function A(s) {
241
+ function I(s) {
242
242
  return s === "sm" || s === "lg" ? s : "md";
243
243
  }
244
- function y(s) {
244
+ function A(s) {
245
245
  return s === "card" || s === "segmented" ? s : "default";
246
246
  }
247
- function k(s) {
247
+ function y(s) {
248
248
  return s === "neutral" || s === "success" || s === "warning" || s === "danger" || s === "info" ? s : "brand";
249
249
  }
250
- class w extends x {
250
+ class k extends v {
251
251
  constructor() {
252
252
  super(), this._value = "", this._disabled = !1, this._required = !1, this._orientation = "vertical", this._focusIndex = -1, this._options = [], this._observer = null, this._onClickBound = (e) => this._onClick(e), this._onKeydownBound = (e) => this._onKeydown(e);
253
253
  }
@@ -271,8 +271,7 @@ class w extends x {
271
271
  })), this._observer.observe(this, { childList: !0, subtree: !0, characterData: !0 }));
272
272
  }
273
273
  disconnectedCallback() {
274
- var e;
275
- this.root.removeEventListener("click", this._onClickBound), this.root.removeEventListener("keydown", this._onKeydownBound), (e = this._observer) == null || e.disconnect(), super.disconnectedCallback();
274
+ this.root.removeEventListener("click", this._onClickBound), this.root.removeEventListener("keydown", this._onKeydownBound), this._observer?.disconnect(), super.disconnectedCallback();
276
275
  }
277
276
  attributeChangedCallback(e, i, t) {
278
277
  i !== t && (this._syncFromAttributes(), e === "options" ? this.requestRender() : this._syncInteractiveState(), e === "value" && this.dispatchEvent(
@@ -297,10 +296,9 @@ class w extends x {
297
296
  e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
298
297
  }
299
298
  _syncFromAttributes() {
300
- var e;
301
- if (this._value = this.getAttribute("value") || "", this._disabled = this.hasAttribute("disabled"), this._required = this.hasAttribute("required"), this._orientation = f(this.getAttribute("orientation")), this._options = this._collectOptions(), this._focusIndex < 0 || this._focusIndex >= this._options.length || (e = this._options[this._focusIndex]) != null && e.disabled) {
302
- const i = this._findSelectedIndex();
303
- this._focusIndex = i >= 0 ? i : this._findFirstEnabledIndex();
299
+ if (this._value = this.getAttribute("value") || "", this._disabled = this.hasAttribute("disabled"), this._required = this.hasAttribute("required"), this._orientation = f(this.getAttribute("orientation")), this._options = this._collectOptions(), this._focusIndex < 0 || this._focusIndex >= this._options.length || this._options[this._focusIndex]?.disabled) {
300
+ const e = this._findSelectedIndex();
301
+ this._focusIndex = e >= 0 ? e : this._findFirstEnabledIndex();
304
302
  }
305
303
  }
306
304
  _collectOptions() {
@@ -318,8 +316,7 @@ class w extends x {
318
316
  }
319
317
  return null;
320
318
  }).filter(Boolean);
321
- if (r.length)
322
- return r;
319
+ if (r.length) return r;
323
320
  }
324
321
  } catch {
325
322
  }
@@ -338,11 +335,9 @@ class w extends x {
338
335
  return this._options.findIndex((e) => !e.disabled);
339
336
  }
340
337
  _selectIndex(e, i) {
341
- if (this._disabled)
342
- return;
338
+ if (this._disabled) return;
343
339
  const t = this._options[e];
344
- if (!t || t.disabled)
345
- return;
340
+ if (!t || t.disabled) return;
346
341
  const r = this._value !== t.value;
347
342
  if (this._focusIndex = e, r) {
348
343
  this._value = t.value, this.getAttribute("value") !== t.value ? this.setAttribute("value", t.value) : this.requestRender();
@@ -353,7 +348,7 @@ class w extends x {
353
348
  this._focusOption(e);
354
349
  }
355
350
  _moveSelection(e) {
356
- const i = g(this._options, this._focusIndex, e > 0 ? 1 : -1, {
351
+ const i = x(this._options, this._focusIndex, e > 0 ? 1 : -1, {
357
352
  wrap: !0,
358
353
  fallbackIndex: h(this._options, {
359
354
  activeIndex: this._focusIndex,
@@ -366,11 +361,10 @@ class w extends x {
366
361
  }
367
362
  _focusOption(e) {
368
363
  const i = this.root.querySelector(`.option[data-index="${e}"]`);
369
- m(i);
364
+ g(i);
370
365
  }
371
366
  _syncInteractiveState() {
372
- if (!this.root.querySelector(".root"))
373
- return;
367
+ if (!this.root.querySelector(".root")) return;
374
368
  this.setAttribute("role", "radiogroup"), this.setAttribute("aria-disabled", this._disabled ? "true" : "false"), this.setAttribute("aria-required", this._required ? "true" : "false"), this.setAttribute("aria-orientation", this._orientation);
375
369
  const i = this._findSelectedIndex(), t = i >= 0 ? i : this._findFirstEnabledIndex();
376
370
  this._focusIndex = h(this._options, {
@@ -381,30 +375,25 @@ class w extends x {
381
375
  const r = this.root.querySelectorAll(".option[data-index]");
382
376
  r.forEach((a) => {
383
377
  const n = Number(a.getAttribute("data-index"));
384
- if (Number.isNaN(n))
385
- return;
378
+ if (Number.isNaN(n)) return;
386
379
  const d = this._options[n];
387
- if (!d)
388
- return;
380
+ if (!d) return;
389
381
  const l = n === t, u = this._disabled || !!d.disabled, c = n === this._focusIndex ? 0 : -1;
390
382
  a.setAttribute("data-value", d.value), a.setAttribute("data-checked", l ? "true" : "false"), a.setAttribute("data-disabled", u ? "true" : "false"), a.setAttribute("aria-checked", l ? "true" : "false"), a.setAttribute("aria-disabled", u ? "true" : "false"), a.setAttribute("tabindex", String(c));
391
383
  });
392
384
  const o = Array.from(r);
393
- _(o, o[this._focusIndex] || null, { activeAttribute: null });
385
+ m(o, o[this._focusIndex] || null, { activeAttribute: null });
394
386
  }
395
387
  _onClick(e) {
396
388
  const i = e.target;
397
- if (!i)
398
- return;
389
+ if (!i) return;
399
390
  const t = i.closest(".option");
400
- if (!t)
401
- return;
391
+ if (!t) return;
402
392
  const r = Number(t.getAttribute("data-index"));
403
393
  Number.isNaN(r) || this._selectIndex(r, "click");
404
394
  }
405
395
  _onKeydown(e) {
406
- if (this._disabled)
407
- return;
396
+ if (this._disabled) return;
408
397
  const i = e.key, t = this._orientation === "horizontal";
409
398
  if (i === "ArrowRight" && t || i === "ArrowDown") {
410
399
  e.preventDefault(), this._moveSelection(1);
@@ -433,33 +422,32 @@ class w extends x {
433
422
  }
434
423
  }
435
424
  render() {
436
- var n;
437
- const e = A(this.getAttribute("size")), i = y(this.getAttribute("variant")), t = k(this.getAttribute("tone")), r = f(this.getAttribute("orientation"));
425
+ const e = I(this.getAttribute("size")), i = A(this.getAttribute("variant")), t = y(this.getAttribute("tone")), r = f(this.getAttribute("orientation"));
438
426
  this.setAttribute("role", "radiogroup"), this.setAttribute("aria-disabled", this._disabled ? "true" : "false"), this.setAttribute("aria-required", this._required ? "true" : "false"), this.setAttribute("aria-orientation", r);
439
427
  const o = this._findSelectedIndex(), a = o >= 0 ? o : this._findFirstEnabledIndex();
440
- (this._focusIndex < 0 || this._focusIndex >= this._options.length || (n = this._options[this._focusIndex]) != null && n.disabled) && (this._focusIndex = a), this.setContent(`
441
- <style>${I}</style>
428
+ (this._focusIndex < 0 || this._focusIndex >= this._options.length || this._options[this._focusIndex]?.disabled) && (this._focusIndex = a), this.setContent(`
429
+ <style>${_}</style>
442
430
  <div class="root" part="root" data-size="${e}" data-variant="${i}" data-tone="${t}">
443
- ${this._options.map((d, l) => {
444
- const u = l === a, c = this._disabled || !!d.disabled, v = l === this._focusIndex ? 0 : -1;
431
+ ${this._options.map((n, d) => {
432
+ const l = d === a, u = this._disabled || !!n.disabled, c = d === this._focusIndex ? 0 : -1;
445
433
  return `
446
434
  <button
447
435
  type="button"
448
436
  class="option"
449
437
  part="option"
450
438
  role="radio"
451
- data-index="${l}"
452
- data-value="${b(d.value)}"
453
- data-checked="${u ? "true" : "false"}"
454
- data-disabled="${c ? "true" : "false"}"
455
- aria-checked="${u ? "true" : "false"}"
456
- aria-disabled="${c ? "true" : "false"}"
457
- tabindex="${v}"
439
+ data-index="${d}"
440
+ data-value="${b(n.value)}"
441
+ data-checked="${l ? "true" : "false"}"
442
+ data-disabled="${u ? "true" : "false"}"
443
+ aria-checked="${l ? "true" : "false"}"
444
+ aria-disabled="${u ? "true" : "false"}"
445
+ tabindex="${c}"
458
446
  >
459
447
  <span class="control" part="control"><span class="dot" part="dot"></span></span>
460
448
  <span class="text" part="text">
461
- <span class="label" part="label">${b(d.label)}</span>
462
- ${d.description ? `<span class="description" part="description">${b(d.description)}</span>` : ""}
449
+ <span class="label" part="label">${b(n.label)}</span>
450
+ ${n.description ? `<span class="description" part="description">${b(n.description)}</span>` : ""}
463
451
  </span>
464
452
  </button>
465
453
  `;
@@ -471,7 +459,7 @@ class w extends x {
471
459
  return e === "options";
472
460
  }
473
461
  }
474
- typeof customElements < "u" && !customElements.get("ui-radio-group") && customElements.define("ui-radio-group", w);
462
+ typeof customElements < "u" && !customElements.get("ui-radio-group") && customElements.define("ui-radio-group", k);
475
463
  export {
476
- w as UIRadioGroup
464
+ k as UIRadioGroup
477
465
  };
package/dist/radio.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./ElementBase-1b301e7f.js"),u=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./ElementBase-EV6mVBUV.js"),u=`
2
2
  :host {
3
3
  --ui-radio-size: 18px;
4
4
  --ui-radio-hit-area: 24px;
package/dist/radio.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as l } from "./ElementBase-909688f3.mjs";
1
+ import { E as l } from "./ElementBase-YlTLMsGk.mjs";
2
2
  const u = `
3
3
  :host {
4
4
  --ui-radio-size: 18px;
@@ -371,15 +371,13 @@ class s extends l {
371
371
  }
372
372
  _resolveQueryScope() {
373
373
  const e = this.closest("form, ui-form");
374
- if (e)
375
- return e;
374
+ if (e) return e;
376
375
  const i = this.getRootNode();
377
376
  return i instanceof Document || i instanceof ShadowRoot || i instanceof Element ? i : null;
378
377
  }
379
378
  _getGroupMembers() {
380
379
  const e = this.name.trim();
381
- if (!e)
382
- return [this];
380
+ if (!e) return [this];
383
381
  const i = this._resolveQueryScope();
384
382
  return !i || !("querySelectorAll" in i) ? [this] : Array.from(i.querySelectorAll("ui-radio")).filter(
385
383
  (t) => t instanceof s && t.name === e
@@ -398,8 +396,7 @@ class s extends l {
398
396
  }
399
397
  }
400
398
  _checkFromUser(e) {
401
- if (this.disabled || this.loading || this.checked)
402
- return;
399
+ if (this.disabled || this.loading || this.checked) return;
403
400
  this.checked = !0;
404
401
  const i = {
405
402
  checked: !0,
@@ -411,8 +408,7 @@ class s extends l {
411
408
  }
412
409
  _moveGroupSelection(e) {
413
410
  const i = this._getGroupMembers().filter((n) => !n.disabled && !n.loading);
414
- if (i.length <= 1)
415
- return;
411
+ if (i.length <= 1) return;
416
412
  const d = (Math.max(i.indexOf(this), 0) + e + i.length) % i.length, a = i[d];
417
413
  !a || a === this || (a._checkFromUser("keyboard"), a._focusSelf());
418
414
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("./ElementBase-1b301e7f.js"),C=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("./ElementBase-EV6mVBUV.js"),C=`
2
2
  :host {
3
3
  --ui-rating-size: var(--ui-control-size, var(--ui-font-size-lg, 20px));
4
4
  --ui-rating-gap: var(--ui-control-gap, 6px);
@@ -1,4 +1,4 @@
1
- import { E as V } from "./ElementBase-909688f3.mjs";
1
+ import { E as V } from "./ElementBase-YlTLMsGk.mjs";
2
2
  const M = `
3
3
  :host {
4
4
  --ui-rating-size: var(--ui-control-size, var(--ui-font-size-lg, 20px));
@@ -339,8 +339,7 @@ function y(e) {
339
339
  return e === "scale" || e === "pulse" || e === "none" ? e : null;
340
340
  }
341
341
  function q(e) {
342
- if (!e)
343
- return null;
342
+ if (!e) return null;
344
343
  const t = e.trim();
345
344
  return t ? t === "full" ? "999px" : /^-?\\d+(\\.\\d+)?$/.test(t) ? `${t}px` : t : null;
346
345
  }
@@ -357,15 +356,13 @@ function u(e, t) {
357
356
  }
358
357
  function o(e, t) {
359
358
  const i = e.getAttribute(t);
360
- if (i != null)
361
- return i;
359
+ if (i != null) return i;
362
360
  const r = e[t];
363
361
  return typeof r == "string" && r.length > 0 ? r : null;
364
362
  }
365
363
  function f(e, t) {
366
364
  const i = e.getAttribute(t);
367
- if (i != null)
368
- return x(i);
365
+ if (i != null) return x(i);
369
366
  const r = e[t];
370
367
  return typeof r == "boolean" ? r : typeof r == "string" ? x(r) : !1;
371
368
  }
@@ -434,8 +431,7 @@ class B extends V {
434
431
  }
435
432
  set value(t) {
436
433
  const i = Number(t);
437
- if (!Number.isFinite(i))
438
- return;
434
+ if (!Number.isFinite(i)) return;
439
435
  const r = l(u(i, this._precision), 0, this._max);
440
436
  this._value !== r && (this._value = r, this.setAttribute("value", String(this._value)), this._syncStars(), this._syncAria(), this._emit("change"), this._emit("input"));
441
437
  }
@@ -468,15 +464,13 @@ class B extends V {
468
464
  return t instanceof Element ? t.closest(".star") : null;
469
465
  }
470
466
  _getStarIndex(t) {
471
- if (!t)
472
- return -1;
467
+ if (!t) return -1;
473
468
  const i = Number(t.dataset.index);
474
469
  return Number.isFinite(i) ? i : -1;
475
470
  }
476
471
  _getValueFromPointer(t, i) {
477
472
  const r = this._getStarIndex(i);
478
- if (r === -1)
479
- return this._value;
473
+ if (r === -1) return this._value;
480
474
  if (this._precision !== 0.5)
481
475
  return r + 1;
482
476
  const s = i.getBoundingClientRect(), n = t.clientX - s.left <= s.width / 2 ? 0.5 : 1;
@@ -489,14 +483,12 @@ class B extends V {
489
483
  return `${this._formatValue(t)} out of ${this._max}`;
490
484
  }
491
485
  _onRootClick(t) {
492
- if (this._disabled || this._readonly)
493
- return;
486
+ if (this._disabled || this._readonly) return;
494
487
  const i = t, r = this._getStarFromEventTarget(i.target);
495
488
  r && (this.value = this._getValueFromPointer(i, r));
496
489
  }
497
490
  _onRootMouseMove(t) {
498
- if (this._disabled || this._readonly)
499
- return;
491
+ if (this._disabled || this._readonly) return;
500
492
  const i = t, r = this._getStarFromEventTarget(i.target);
501
493
  r && (this._hoverValue = this._getValueFromPointer(i, r), this.setAttribute("state", "hover"), this._syncStars());
502
494
  }
@@ -504,8 +496,7 @@ class B extends V {
504
496
  this._disabled || this._readonly || (this._hoverValue = 0, this.removeAttribute("state"), this._syncStars());
505
497
  }
506
498
  _onRootFocusIn(t) {
507
- if (this._disabled || this._readonly)
508
- return;
499
+ if (this._disabled || this._readonly) return;
509
500
  const i = this._getStarFromEventTarget(t.target), r = this._getStarIndex(i);
510
501
  r !== -1 && (this._hoverValue = r + 1, this.setAttribute("state", "focus"), this._syncStars());
511
502
  }
@@ -513,11 +504,9 @@ class B extends V {
513
504
  this._disabled || this._readonly || (this._hoverValue = 0, this.removeAttribute("state"), this._syncStars());
514
505
  }
515
506
  _onRootKeyDown(t) {
516
- if (this._disabled || this._readonly)
517
- return;
507
+ if (this._disabled || this._readonly) return;
518
508
  const i = t, r = this._getStarFromEventTarget(i.target), s = this._getStarIndex(r);
519
- if (s === -1)
520
- return;
509
+ if (s === -1) return;
521
510
  let a = this._value;
522
511
  const n = this._precision;
523
512
  switch (i.key) {
@@ -5,8 +5,7 @@ function d(e, n, r = a) {
5
5
  if (n === "first")
6
6
  return e.findIndex((t) => !r(t));
7
7
  for (let t = e.length - 1; t >= 0; t -= 1)
8
- if (!r(e[t]))
9
- return t;
8
+ if (!r(e[t])) return t;
10
9
  return -1;
11
10
  }
12
11
  function o(e, n = {}) {
@@ -14,15 +13,13 @@ function o(e, n = {}) {
14
13
  return t >= 0 && t < e.length && !r(e[t]) ? t : c >= 0 && c < e.length && !r(e[c]) ? c : d(e, "first", r);
15
14
  }
16
15
  function i(e, n, r, t = {}) {
17
- if (!e.length)
18
- return -1;
16
+ if (!e.length) return -1;
19
17
  const c = t.getDisabled || a, f = t.wrap !== !1;
20
18
  let u = typeof t.fallbackIndex == "number" ? t.fallbackIndex : n;
21
19
  for (let l = 0; l < e.length; l += 1) {
22
20
  if (u += r, !f && (u < 0 || u >= e.length))
23
21
  return -1;
24
- if (u < 0 && (u = e.length - 1), u >= e.length && (u = 0), !c(e[u]))
25
- return u;
22
+ if (u < 0 && (u = e.length - 1), u >= e.length && (u = 0), !c(e[u])) return u;
26
23
  }
27
24
  return -1;
28
25
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./roving-focus-group-5c059bf9.js");function d(n){if(!n.isConnected||n.hidden)return!1;const t=window.getComputedStyle(n);return!(t.display==="none"||t.visibility==="hidden")}function u(n){const t=n.getAttribute("aria-disabled");return n.hasAttribute("disabled")||t==="true"||n.disabled===!0}class l extends HTMLElement{constructor(){super(...arguments),this._container=null}static get observedAttributes(){return["item-selector","direct-item-selector","active-attribute","loop"]}get container(){return this._container}set container(t){this._container=t}get itemSelector(){return this.getAttribute("item-selector")||'[tabindex], button, [role="tab"], [role="radio"]'}get directItemSelector(){return this.getAttribute("direct-item-selector")||""}get activeAttribute(){const t=this.getAttribute("active-attribute");return t===""?null:t||null}queryItems(){const t=this._container||this,i=this.directItemSelector.trim();let e=i?Array.from(t.querySelectorAll(i)):[];return e.length||(e=Array.from(t.querySelectorAll(this.itemSelector))),e.filter(r=>d(r))}queryEnabledItems(){return this.queryItems().filter(t=>!u(t))}getActiveItem(){return this.queryItems().find(t=>t.getAttribute("tabindex")==="0")||null}setActiveItem(t,i={}){const e=this.queryItems(),r=t&&e.includes(t)&&!u(t)?t:null;return s.syncRovingTabStops(e,r,{activeAttribute:this.activeAttribute}),r&&i.focus&&s.focusRovingItem(r),this.dispatchEvent(new CustomEvent("active-item-change",{detail:{item:r},bubbles:!0,composed:!0})),r}focusBoundary(t,i={}){const e=this.queryItems(),r=s.getRovingFocusBoundaryIndex(e,t,u);return r<0?null:this.setActiveItem(e[r],i)}move(t,i={}){const e=this.queryItems();if(!e.length)return null;const r=i.current||this.getActiveItem(),o=r?e.indexOf(r):-1,a=s.resolveRovingFocusIndex(e,{activeIndex:o,getDisabled:u}),c=s.moveRovingFocusIndex(e,o,t,{wrap:i.wrap!==!1&&this.getAttribute("loop")!=="false",fallbackIndex:a,getDisabled:u});return c<0?null:this.setActiveItem(e[c],{focus:i.focus})}}typeof customElements<"u"&&!customElements.get("ui-roving-focus-group")&&customElements.define("ui-roving-focus-group",l);exports.UIRovingFocusGroup=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./roving-focus-group-BdJ_4Njm.js");function d(n){if(!n.isConnected||n.hidden)return!1;const t=window.getComputedStyle(n);return!(t.display==="none"||t.visibility==="hidden")}function u(n){const t=n.getAttribute("aria-disabled");return n.hasAttribute("disabled")||t==="true"||n.disabled===!0}class l extends HTMLElement{constructor(){super(...arguments),this._container=null}static get observedAttributes(){return["item-selector","direct-item-selector","active-attribute","loop"]}get container(){return this._container}set container(t){this._container=t}get itemSelector(){return this.getAttribute("item-selector")||'[tabindex], button, [role="tab"], [role="radio"]'}get directItemSelector(){return this.getAttribute("direct-item-selector")||""}get activeAttribute(){const t=this.getAttribute("active-attribute");return t===""?null:t||null}queryItems(){const t=this._container||this,i=this.directItemSelector.trim();let e=i?Array.from(t.querySelectorAll(i)):[];return e.length||(e=Array.from(t.querySelectorAll(this.itemSelector))),e.filter(r=>d(r))}queryEnabledItems(){return this.queryItems().filter(t=>!u(t))}getActiveItem(){return this.queryItems().find(t=>t.getAttribute("tabindex")==="0")||null}setActiveItem(t,i={}){const e=this.queryItems(),r=t&&e.includes(t)&&!u(t)?t:null;return s.syncRovingTabStops(e,r,{activeAttribute:this.activeAttribute}),r&&i.focus&&s.focusRovingItem(r),this.dispatchEvent(new CustomEvent("active-item-change",{detail:{item:r},bubbles:!0,composed:!0})),r}focusBoundary(t,i={}){const e=this.queryItems(),r=s.getRovingFocusBoundaryIndex(e,t,u);return r<0?null:this.setActiveItem(e[r],i)}move(t,i={}){const e=this.queryItems();if(!e.length)return null;const r=i.current||this.getActiveItem(),o=r?e.indexOf(r):-1,a=s.resolveRovingFocusIndex(e,{activeIndex:o,getDisabled:u}),c=s.moveRovingFocusIndex(e,o,t,{wrap:i.wrap!==!1&&this.getAttribute("loop")!=="false",fallbackIndex:a,getDisabled:u});return c<0?null:this.setActiveItem(e[c],{focus:i.focus})}}typeof customElements<"u"&&!customElements.get("ui-roving-focus-group")&&customElements.define("ui-roving-focus-group",l);exports.UIRovingFocusGroup=l;
@@ -1,7 +1,6 @@
1
- import { s as l, f as a, g as d, r as m, m as f } from "./roving-focus-group-4350c9a7.mjs";
1
+ import { s as l, f as a, g as d, r as m, m as f } from "./roving-focus-group-Dbm1Jko_.mjs";
2
2
  function b(s) {
3
- if (!s.isConnected || s.hidden)
4
- return !1;
3
+ if (!s.isConnected || s.hidden) return !1;
5
4
  const t = window.getComputedStyle(s);
6
5
  return !(t.display === "none" || t.visibility === "hidden");
7
6
  }
@@ -53,8 +52,7 @@ class g extends HTMLElement {
53
52
  }
54
53
  move(t, i = {}) {
55
54
  const e = this.queryItems();
56
- if (!e.length)
57
- return null;
55
+ if (!e.length) return null;
58
56
  const r = i.current || this.getActiveItem(), u = r ? e.indexOf(r) : -1, c = m(e, {
59
57
  activeIndex: u,
60
58
  getDisabled: n