@ecopages/radiant-ui 0.1.0-rc.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/components/ui/alert/alert.d.ts +2 -4
- package/dist/components/ui/alert/alert.script.d.ts +25 -15
- package/dist/components/ui/autocomplete/autocomplete.css +1 -2
- package/dist/components/ui/autocomplete/autocomplete.d.ts +8 -3
- package/dist/components/ui/autocomplete/autocomplete.script.d.ts +29 -4
- package/dist/components/ui/avatar/avatar.css +10 -8
- package/dist/components/ui/avatar/avatar.d.ts +3 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +11 -11
- package/dist/components/ui/breadcrumb/breadcrumb.script.d.ts +10 -10
- package/dist/components/ui/calendar/calendar.css +10 -5
- package/dist/components/ui/calendar/calendar.script.d.ts +24 -21
- package/dist/components/ui/calendar/index.js +1 -1
- package/dist/components/ui/calendar/index.js.map +3 -3
- package/dist/components/ui/carousel/carousel-autoplay.d.ts +22 -0
- package/dist/components/ui/carousel/carousel-swipe.d.ts +17 -0
- package/dist/components/ui/carousel/carousel-window.d.ts +63 -0
- package/dist/components/ui/carousel/carousel.css +71 -18
- package/dist/components/ui/carousel/carousel.d.ts +8 -4
- package/dist/components/ui/carousel/carousel.script.d.ts +73 -40
- package/dist/components/ui/carousel/index.js +1 -1
- package/dist/components/ui/carousel/index.js.map +4 -4
- package/dist/components/ui/checkbox/checkbox.d.ts +11 -0
- package/dist/components/ui/checkbox/checkbox.script.d.ts +31 -8
- package/dist/components/ui/checkbox/index.js +1 -1
- package/dist/components/ui/checkbox/index.js.map +4 -4
- package/dist/components/ui/checkbox-group/checkbox-group.d.ts +4 -2
- package/dist/components/ui/checkbox-group/checkbox-group.script.d.ts +39 -20
- package/dist/components/ui/checkbox-group/index.js +1 -1
- package/dist/components/ui/checkbox-group/index.js.map +4 -4
- package/dist/components/ui/combobox/combobox.css +9 -1
- package/dist/components/ui/combobox/combobox.d.ts +12 -4
- package/dist/components/ui/combobox/combobox.script.d.ts +74 -25
- package/dist/components/ui/combobox/index.d.ts +2 -2
- package/dist/components/ui/combobox/index.js +1 -1
- package/dist/components/ui/combobox/index.js.map +4 -4
- package/dist/components/ui/cycle-toggle/cycle-toggle.d.ts +6 -2
- package/dist/components/ui/cycle-toggle/cycle-toggle.script.d.ts +35 -4
- package/dist/components/ui/cycle-toggle/index.js +1 -1
- package/dist/components/ui/cycle-toggle/index.js.map +3 -3
- package/dist/components/ui/date-field/date-field.css +13 -17
- package/dist/components/ui/date-field/date-field.d.ts +10 -8
- package/dist/components/ui/date-field/date-field.script.d.ts +35 -52
- package/dist/components/ui/date-field/index.js +1 -1
- package/dist/components/ui/date-field/index.js.map +4 -4
- package/dist/components/ui/date-input/date-input-segment-dom.d.ts +24 -0
- package/dist/components/ui/date-input/date-input.css +50 -0
- package/dist/components/ui/date-input/date-input.d.ts +8 -0
- package/dist/components/ui/date-input/date-input.script.d.ts +137 -0
- package/dist/components/ui/date-input/index.d.ts +2 -0
- package/dist/components/ui/date-input/index.js +2 -0
- package/dist/components/ui/date-input/index.js.map +7 -0
- package/dist/components/ui/date-range-picker/date-range-picker.css +18 -19
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +11 -9
- package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +42 -51
- package/dist/components/ui/date-range-picker/index.js +1 -1
- package/dist/components/ui/date-range-picker/index.js.map +4 -4
- package/dist/components/ui/dialog/dialog.css +18 -14
- package/dist/components/ui/dialog/dialog.d.ts +6 -0
- package/dist/components/ui/dialog/dialog.script.d.ts +43 -10
- package/dist/components/ui/dialog/index.js +1 -1
- package/dist/components/ui/dialog/index.js.map +4 -4
- package/dist/components/ui/disclosure/disclosure-group.script.d.ts +19 -3
- package/dist/components/ui/disclosure/disclosure.css +3 -6
- package/dist/components/ui/disclosure/disclosure.d.ts +23 -7
- package/dist/components/ui/disclosure/disclosure.script.d.ts +31 -7
- package/dist/components/ui/disclosure/index.d.ts +1 -1
- package/dist/components/ui/disclosure/index.js +1 -1
- package/dist/components/ui/disclosure/index.js.map +4 -4
- package/dist/components/ui/field/field-description.d.ts +1 -0
- package/dist/components/ui/field/field-error.d.ts +2 -2
- package/dist/components/ui/field/field.d.ts +4 -4
- package/dist/components/ui/field/field.script.d.ts +54 -24
- package/dist/components/ui/field/index.js +1 -1
- package/dist/components/ui/field/index.js.map +4 -4
- package/dist/components/ui/form/control-protocol.d.ts +38 -1
- package/dist/components/ui/form/form-context.d.ts +3 -0
- package/dist/components/ui/form/form.d.ts +6 -0
- package/dist/components/ui/form/form.script.d.ts +29 -12
- package/dist/components/ui/form/index.d.ts +2 -1
- package/dist/components/ui/form/index.js +1 -1
- package/dist/components/ui/form/index.js.map +4 -4
- package/dist/components/ui/grid/grid.d.ts +4 -3
- package/dist/components/ui/grid/grid.script.d.ts +19 -11
- package/dist/components/ui/hover-card/hover-card.css +12 -101
- package/dist/components/ui/hover-card/hover-card.d.ts +7 -2
- package/dist/components/ui/hover-card/hover-card.script.d.ts +36 -5
- package/dist/components/ui/hover-card/index.js +1 -1
- package/dist/components/ui/hover-card/index.js.map +4 -4
- package/dist/components/ui/input/index.js +1 -1
- package/dist/components/ui/input/index.js.map +4 -4
- package/dist/components/ui/input/input.css +1 -1
- package/dist/components/ui/knob/index.js +1 -1
- package/dist/components/ui/knob/index.js.map +3 -3
- package/dist/components/ui/knob/knob.css +6 -1
- package/dist/components/ui/knob/knob.d.ts +4 -4
- package/dist/components/ui/knob/knob.script.d.ts +55 -20
- package/dist/components/ui/label/index.js +1 -1
- package/dist/components/ui/label/index.js.map +4 -4
- package/dist/components/ui/label/label.d.ts +2 -1
- package/dist/components/ui/listbox/index.d.ts +2 -2
- package/dist/components/ui/listbox/index.js +1 -1
- package/dist/components/ui/listbox/index.js.map +4 -4
- package/dist/components/ui/listbox/listbox.css +14 -0
- package/dist/components/ui/listbox/listbox.d.ts +16 -2
- package/dist/components/ui/listbox/listbox.script.d.ts +55 -12
- package/dist/components/ui/menu-button/index.js +1 -1
- package/dist/components/ui/menu-button/index.js.map +4 -4
- package/dist/components/ui/menu-button/menu-button.d.ts +2 -2
- package/dist/components/ui/menu-button/menu-button.script.d.ts +30 -27
- package/dist/components/ui/menubar/index.js +1 -1
- package/dist/components/ui/menubar/index.js.map +4 -4
- package/dist/components/ui/menubar/menubar.script.d.ts +41 -15
- package/dist/components/ui/meter/index.js +1 -1
- package/dist/components/ui/meter/index.js.map +3 -3
- package/dist/components/ui/meter/meter.css +27 -2
- package/dist/components/ui/meter/meter.script.d.ts +19 -14
- package/dist/components/ui/navigation-menu/index.d.ts +1 -1
- package/dist/components/ui/navigation-menu/index.js +1 -1
- package/dist/components/ui/navigation-menu/index.js.map +4 -4
- package/dist/components/ui/navigation-menu/navigation-menu.css +32 -34
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +34 -5
- package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +93 -12
- package/dist/components/ui/number-field/index.js +1 -1
- package/dist/components/ui/number-field/index.js.map +4 -4
- package/dist/components/ui/number-field/number-field.css +1 -1
- package/dist/components/ui/number-field/number-field.d.ts +8 -19
- package/dist/components/ui/number-field/number-field.script.d.ts +30 -9
- package/dist/components/ui/pagination/index.d.ts +1 -1
- package/dist/components/ui/pagination/index.js +1 -1
- package/dist/components/ui/pagination/index.js.map +3 -3
- package/dist/components/ui/pagination/pagination.css +50 -13
- package/dist/components/ui/pagination/pagination.d.ts +33 -9
- package/dist/components/ui/pagination/pagination.script.d.ts +29 -9
- package/dist/components/ui/popover/index.js +1 -1
- package/dist/components/ui/popover/index.js.map +4 -4
- package/dist/components/ui/popover/popover.d.ts +17 -1
- package/dist/components/ui/popover/popover.script.d.ts +57 -9
- package/dist/components/ui/radio-group/index.js +1 -1
- package/dist/components/ui/radio-group/index.js.map +4 -4
- package/dist/components/ui/radio-group/radio-group.d.ts +2 -2
- package/dist/components/ui/radio-group/radio-group.script.d.ts +35 -16
- package/dist/components/ui/select/index.d.ts +2 -2
- package/dist/components/ui/select/index.js +1 -1
- package/dist/components/ui/select/index.js.map +4 -4
- package/dist/components/ui/select/select.css +8 -6
- package/dist/components/ui/select/select.d.ts +18 -9
- package/dist/components/ui/select/select.script.d.ts +74 -26
- package/dist/components/ui/shared/calendar-popover-behavior.d.ts +27 -0
- package/dist/components/ui/shared/control-toggle.css +8 -4
- package/dist/components/ui/shared/field-label.d.ts +5 -0
- package/dist/components/ui/shared/listbox-host-controller.d.ts +41 -0
- package/dist/components/ui/shared/listbox-option.d.ts +4 -0
- package/dist/components/ui/shared/multi-value.d.ts +23 -1
- package/dist/components/ui/shared/numeric-range.d.ts +8 -0
- package/dist/components/ui/shared/popover.css +10 -99
- package/dist/components/ui/sidebar/index.d.ts +2 -1
- package/dist/components/ui/sidebar/index.js +1 -1
- package/dist/components/ui/sidebar/index.js.map +4 -4
- package/dist/components/ui/sidebar/sidebar-trigger.d.ts +12 -0
- package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +52 -31
- package/dist/components/ui/sidebar/sidebar.css +67 -61
- package/dist/components/ui/sidebar/sidebar.d.ts +9 -4
- package/dist/components/ui/sidebar/sidebar.script.d.ts +42 -20
- package/dist/components/ui/slider/index.js +1 -1
- package/dist/components/ui/slider/index.js.map +4 -4
- package/dist/components/ui/slider/slider.css +5 -5
- package/dist/components/ui/slider/slider.d.ts +20 -10
- package/dist/components/ui/slider/slider.script.d.ts +103 -27
- package/dist/components/ui/switch/index.js +1 -1
- package/dist/components/ui/switch/index.js.map +4 -4
- package/dist/components/ui/switch/switch.css +28 -22
- package/dist/components/ui/switch/switch.d.ts +13 -0
- package/dist/components/ui/switch/switch.script.d.ts +34 -8
- package/dist/components/ui/table/index.js +1 -1
- package/dist/components/ui/table/index.js.map +4 -4
- package/dist/components/ui/table/table.d.ts +9 -7
- package/dist/components/ui/table/table.script.d.ts +55 -12
- package/dist/components/ui/tabs/tabs.css +18 -12
- package/dist/components/ui/tabs/tabs.d.ts +7 -4
- package/dist/components/ui/tabs/tabs.script.d.ts +39 -9
- package/dist/components/ui/tag-group/index.js +1 -1
- package/dist/components/ui/tag-group/index.js.map +4 -4
- package/dist/components/ui/tag-group/tag-group.d.ts +19 -7
- package/dist/components/ui/tag-group/tag-group.script.d.ts +58 -10
- package/dist/components/ui/textarea/index.js +1 -1
- package/dist/components/ui/textarea/index.js.map +4 -4
- package/dist/components/ui/textarea/textarea.css +1 -1
- package/dist/components/ui/toast/index.js +1 -1
- package/dist/components/ui/toast/index.js.map +4 -4
- package/dist/components/ui/toast/toast.css +35 -32
- package/dist/components/ui/toast/toast.script.d.ts +17 -31
- package/dist/components/ui/toast/toaster.script.d.ts +24 -12
- package/dist/components/ui/toc/toc.script.d.ts +19 -8
- package/dist/components/ui/toolbar/toolbar.d.ts +5 -0
- package/dist/components/ui/toolbar/toolbar.script.d.ts +24 -4
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/components/ui/tooltip/index.js.map +4 -4
- package/dist/components/ui/tooltip/tooltip.css +14 -94
- package/dist/components/ui/tooltip/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip/tooltip.script.d.ts +36 -6
- package/dist/components/ui/tree/tree.d.ts +4 -3
- package/dist/components/ui/tree/tree.script.d.ts +28 -15
- package/dist/components/ui/treegrid/treegrid.d.ts +5 -3
- package/dist/components/ui/treegrid/treegrid.script.d.ts +33 -14
- package/dist/components/ui/window-splitter/index.d.ts +1 -1
- package/dist/components/ui/window-splitter/index.js +1 -1
- package/dist/components/ui/window-splitter/index.js.map +3 -3
- package/dist/components/ui/window-splitter/window-splitter.d.ts +10 -1
- package/dist/components/ui/window-splitter/window-splitter.script.d.ts +26 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/icons/check.d.ts +3 -0
- package/dist/lib/icons/chevron-down.d.ts +0 -1
- package/dist/lib/icons/index.d.ts +2 -0
- package/dist/lib/icons/x.d.ts +5 -0
- package/dist/lib/intl-date/index.d.ts +4 -2
- package/dist/lib/intl-date/segment-editing.d.ts +34 -0
- package/dist/lib/intl-date/segments.d.ts +26 -4
- package/dist/lib/non-empty.d.ts +6 -0
- package/dist/lib/unique-id.d.ts +11 -0
- package/dist/lib/viewport/breakpoints.d.ts +6 -0
- package/dist/lib/viewport/mobile-layout.d.ts +15 -0
- package/dist/styles/primitives.css +14 -11
- package/dist/styles/radiant-ui-core.css +10 -0
- package/dist/styles/radiant-ui.css +40 -11
- package/dist/styles/style-dependencies.json +38 -13
- package/dist/styles/styles.css +485 -252
- package/dist/styles/tailwind.css +40 -101
- package/dist/styles/tokens/presets/colors/aurora.css +2 -0
- package/dist/styles/tokens/presets/colors/basalt.css +2 -0
- package/dist/styles/tokens/presets/colors/ember.css +2 -0
- package/dist/styles/tokens/presets/colors/glacier.css +2 -0
- package/dist/styles/tokens/semantic.css +1 -0
- package/dist/styles/tokens/system.css +11 -3
- package/dist/styles/tokens/typography/default.css +8 -0
- package/package.json +27 -13
|
@@ -9,28 +9,54 @@ export type RuiMenubarChangeDetail = {
|
|
|
9
9
|
/**
|
|
10
10
|
* `<rui-menubar>` — a horizontal menubar of menus.
|
|
11
11
|
*
|
|
12
|
+
* The custom element is a behavior host: it does not render the composed tree.
|
|
13
|
+
* Import the script and place light-DOM children that match the contract below,
|
|
14
|
+
* or use the `RuiMenubar*` view helpers which stamp the same targets.
|
|
15
|
+
*
|
|
12
16
|
* Implements the APG Menubar pattern: top-level items use `role="menuitem"` with
|
|
13
|
-
* `aria-haspopup` / `aria-expanded` when they own a nested `[role="menu"]`.
|
|
14
|
-
* keys move across the bar; Enter/Space/ArrowDown open the popup; Escape closes it.
|
|
15
|
-
* Nested branches open after a 200 ms pointer-hover delay without changing
|
|
16
|
-
* keyboard focus. Keyboard branch activation opens the submenu and focuses its
|
|
17
|
-
* first item.
|
|
17
|
+
* `aria-haspopup` / `aria-expanded` when they own a nested `[role="menu"]`.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
19
|
+
* ## Light-DOM contract
|
|
20
|
+
*
|
|
21
|
+
* Required:
|
|
22
|
+
* - `[data-ref="root"]` — menubar landmark shell (`role="menubar"`).
|
|
23
|
+
* - `[data-ref="menubar-root"]` — one top-level menu block (trigger + popup).
|
|
24
|
+
* - `[role="menuitem"]` — top-level item inside each `menubar-root`. Host sets
|
|
25
|
+
* `aria-expanded` and `aria-haspopup` when a sibling `[role="menu"]` exists.
|
|
26
|
+
* - `[role="menu"]` — popup surface, direct child of `menubar-root`. Host toggles
|
|
27
|
+
* `hidden` and positions via popover controller.
|
|
28
|
+
*
|
|
29
|
+
* Per menu item (at any depth):
|
|
30
|
+
* - `[role="menuitem"]` — action or branch. Host reads `data-value` or text on activate.
|
|
31
|
+
* - `data-value` — optional identity emitted in `rui-change`.
|
|
32
|
+
*
|
|
33
|
+
* Branch pattern: a `[role="menuitem"]` with `aria-haspopup` followed by a sibling
|
|
34
|
+
* `[role="menu"]` (or `[data-ref="submenu-menu"]` in nested flyouts).
|
|
35
|
+
*
|
|
36
|
+
* Do not set `aria-expanded` on top-level items — the host owns it.
|
|
37
|
+
*
|
|
38
|
+
* Nested hosts: none.
|
|
28
39
|
*
|
|
29
40
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
|
|
30
41
|
* @element rui-menubar
|
|
31
42
|
* @attr {string} label - Accessible name for the `role="menubar"` landmark.
|
|
32
43
|
* @fires rui-change - Emitted when a menu item is activated; `detail.value` is the item's `data-value` or text.
|
|
33
|
-
*
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Minimum tree:
|
|
47
|
+
*
|
|
48
|
+
* ```html
|
|
49
|
+
* <div data-ref="root" role="menubar">
|
|
50
|
+
* <div data-ref="menubar-root">
|
|
51
|
+
* <button role="menuitem" aria-haspopup="true">File</button>
|
|
52
|
+
* <div role="menu" hidden>
|
|
53
|
+
* <button role="menuitem" data-value="new">New</button>
|
|
54
|
+
* </div>
|
|
55
|
+
* </div>
|
|
56
|
+
* </div>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* BEM classes live on the view helpers; the host never queries them.
|
|
34
60
|
* @cssprop --rui-menu-item-hover - Hover / expanded item fill. Default: `--surface-container-low`.
|
|
35
61
|
*/
|
|
36
62
|
export declare class RuiMenubar extends RadiantElement {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as q,jsxs as B}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as be,customElement as Se,onUpdated as Re,prop as I,state as $e}from"@ecopages/radiant";var ne,ae,oe,se,ue,le,ce,me,he,fe,pe,de;function xe(e,r,d,x,ge,G){var y,a,V,k,S,A,w,J=Symbol.metadata||Symbol.for("Symbol.metadata"),Q=Object.defineProperty,O=Object.create,W=[O(null),O(null)],X=r.length;function R(t,m,l){return function(i,n){m&&(n=i,i=e);for(var h=0;h<t.length;h++)n=t[h].apply(i,l?[n]:[]);return l?n:i}}function v(t,m,l,i){if(typeof t!="function"&&(i||t!==void 0))throw new TypeError(m+" must "+(l||"be")+" a function"+(i?"":" or undefined"));return t}function Y(t,m,l,i,n,h,_,c,f,p,H){function U(s){if(!H(s))throw new TypeError("Attempted to access private element on non-instance")}var z=[].concat(m[0]),F=m[3],L=!_,j=n===1,N=n===3,P=n===4,$=n===2;function M(s,g,re){return function(T,ie){return g&&(ie=T,T=t),re&&re(T),o[s].call(T,ie)}}if(!L){var o={},C=[],b=N?"get":P||j?"set":"value";if(f?(p||j?o={get:ve(function(){return F(this)},i,"get"),set:function(s){m[4](this,s)}}:o[b]=F,p||ve(o[b],i,$?"":b)):p||(o=Object.getOwnPropertyDescriptor(t,i)),!p&&!f){if((a=W[+c][i])&&(a^n)!==7)throw Error("Decorating two elements with the same name ("+o[b].name+") is not supported yet");W[+c][i]=n<3?1:n}}for(var u=t,D=z.length-1;D>=0;D-=l?2:1){var ee=v(z[D],"A decorator","be",!0),te=l?z[D-1]:void 0,K={},E={kind:["field","accessor","method","getter","setter","class"][n],name:i,metadata:y,addInitializer:function(s,g){if(s.v)throw new TypeError("attempted to call addInitializer after decoration was finished");v(g,"An initializer","be",!0),h.push(g)}.bind(null,K)};if(L)a=ee.call(te,u,E),K.v=1,v(a,"class decorators","return")&&(u=a);else if(E.static=c,E.private=f,a=E.access={has:f?H.bind():function(s){return i in s}},P||(a.get=f?$?function(s){return U(s),o.value}:M("get",0,U):function(s){return s[i]}),$||N||(a.set=f?M("set",0,U):function(s,g){s[i]=g}),u=ee.call(te,j?{get:o.get,set:o.set}:o[b],E),K.v=1,j){if(typeof u=="object"&&u)(a=v(u.get,"accessor.get"))&&(o.get=a),(a=v(u.set,"accessor.set"))&&(o.set=a),(a=v(u.init,"accessor.init"))&&C.unshift(a);else if(u!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else v(u,(p?"field":"method")+" decorators","return")&&(p?C.unshift(u):o[b]=u)}return n<2&&_.push(R(C,c,1),R(h,c,0)),p||L||(f?j?_.splice(-1,0,M("get",c),M("set",c)):_.push($?o[b]:v.call.bind(o[b])):Q(t,i,o)),u}function Z(t){return Q(t,J,{configurable:!0,enumerable:!0,value:y})}return G!==void 0&&(y=G[J]),y=O(y??null),S=[],A=function(t){t&&S.push(R(t))},w=function(t,m){for(var l=0;l<d.length;l++){var i=d[l],n=i[1],h=7&n;if((8&n)==t&&!h==m){var _=i[2],c=!!i[3],f=16&n;Y(t?e:e.prototype,i,f,c?"#"+_:we(_),h,h<2?[]:t?k=k||[]:V=V||[],S,!!t,c,m,t&&c?function(p){return Ee(p)===e}:ge)}}},w(8,0),w(0,0),w(8,1),w(0,1),A(V),A(k),a=S,X||Z(e),{e:a,get c(){var t=[];return X&&[Z(e=Y(e,[r],x,e.name,5,t)),R(t,1)]}}}function we(e){var r=je(e,"string");return typeof r=="symbol"?r:r+""}function je(e,r){if(typeof e!="object"||!e)return e;var d=e[Symbol.toPrimitive];if(d!==void 0){var x=d.call(e,r||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function ve(e,r,d){typeof r=="symbol"&&(r=(r=r.description)?"["+r+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:d?d+" "+r:r})}catch{}return e}function Ee(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ye,_e=class extends be{static{({e:[oe,se,ue,le,ce,me,he,fe,pe,de,ne],c:[ye,ae]}=xe(this,[Se("rui-meter")],[[I({type:Number,reflect:!0,defaultValue:0}),0,"value"],[I({type:Number,defaultValue:0}),0,"min"],[I({type:Number,defaultValue:100}),0,"max"],[I({type:String,defaultValue:""}),0,"label"],[$e,0,"percent"],[Re(["value","min","max"]),2,"onRangeUpdated"]],0,void 0,be))}value=(ne(this),oe(this));min=(se(this),ue(this));max=(le(this),ce(this));label=(me(this),he(this));percent=(fe(this),pe(this,0));resolvedAriaLabel=(de(this),this.$.label.map(r=>r||void 0));trackStyle=this.$.percent.map(r=>({"--rui-meter-percent":`${r}%`}));onRangeUpdated(){let r=this.max===this.min?0:Math.round((this.value-this.min)/(this.max-this.min)*100);this.percent=Math.min(100,Math.max(0,r))}render(){return B("div",{class:"rui-meter",children:[this.label?q("span",{class:"rui-meter__label",children:this.$.label}):null,B("meter",{class:"rui-meter__bar",min:this.$.min,max:this.$.max,value:this.$.value,"aria-label":this.resolvedAriaLabel,children:[this.$.percent,"%"]}),q("div",{class:"rui-meter__track",style:this.trackStyle,"aria-hidden":"true",children:q("div",{class:"rui-meter__fill"})}),B("span",{class:"rui-meter__value","aria-hidden":"true",children:[this.$.percent,"%"]})]})}static{ae()}};import{jsx as Me}from"@ecopages/jsx/jsx-runtime";function De(e){return Me("rui-meter",{...e})}export{De as RuiMeter,ye as RuiMeterElement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/ui/meter/meter.script.tsx", "../../../../src/components/ui/meter/meter.tsx"],
|
|
4
|
-
"sourcesContent": ["let _initProto, _initClass, _init_value, _init_extra_value, _init_min, _init_extra_min, _init_max, _init_extra_max, _init_label, _init_extra_label, _init_percent, _init_extra_percent;\nfunction _applyDecs(e, t, n, r, o, i) { var a, c, u, s, f, l, p, d = Symbol.metadata || Symbol.for(\"Symbol.metadata\"), m = Object.defineProperty, h = Object.create, y = [h(null), h(null)], v = t.length; function g(t, n, r) { return function (o, i) { n && (i = o, o = e); for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); return r ? i : o; }; } function b(e, t, n, r) { if (\"function\" != typeof e && (r || void 0 !== e)) throw new TypeError(t + \" must \" + (n || \"be\") + \" a function\" + (r ? \"\" : \" or undefined\")); return e; } function applyDec(e, t, n, r, o, i, u, s, f, l, p) { function d(e) { if (!p(e)) throw new TypeError(\"Attempted to access private element on non-instance\"); } var h = [].concat(t[0]), v = t[3], w = !u, D = 1 === o, S = 3 === o, j = 4 === o, E = 2 === o; function I(t, n, r) { return function (o, i) { return n && (i = o, o = e), r && r(o), P[t].call(o, i); }; } if (!w) { var P = {}, k = [], F = S ? \"get\" : j || D ? \"set\" : \"value\"; if (f ? (l || D ? P = { get: _setFunctionName(function () { return v(this); }, r, \"get\"), set: function (e) { t[4](this, e); } } : P[F] = v, l || _setFunctionName(P[F], r, E ? \"\" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { if ((c = y[+s][r]) && 7 !== (c ^ o)) throw Error(\"Decorating two elements with the same name (\" + P[F].name + \") is not supported yet\"); y[+s][r] = o < 3 ? 1 : o; } } for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { var T = b(h[O], \"A decorator\", \"be\", !0), z = n ? h[O - 1] : void 0, A = {}, H = { kind: [\"field\", \"accessor\", \"method\", \"getter\", \"setter\", \"class\"][o], name: r, metadata: a, addInitializer: function (e, t) { if (e.v) throw new TypeError(\"attempted to call addInitializer after decoration was finished\"); b(t, \"An initializer\", \"be\", !0), i.push(t); }.bind(null, A) }; if (w) c = T.call(z, N, H), A.v = 1, b(c, \"class decorators\", \"return\") && (N = c);else if (H.static = s, H.private = f, c = H.access = { has: f ? p.bind() : function (e) { return r in e; } }, j || (c.get = f ? E ? function (e) { return d(e), P.value; } : I(\"get\", 0, d) : function (e) { return e[r]; }), E || S || (c.set = f ? I(\"set\", 0, d) : function (e, t) { e[r] = t; }), N = T.call(z, D ? { get: P.get, set: P.set } : P[F], H), A.v = 1, D) { if (\"object\" == typeof N && N) (c = b(N.get, \"accessor.get\")) && (P.get = c), (c = b(N.set, \"accessor.set\")) && (P.set = c), (c = b(N.init, \"accessor.init\")) && k.unshift(c);else if (void 0 !== N) throw new TypeError(\"accessor decorators must return an object with get, set, or init properties or undefined\"); } else b(N, (l ? \"field\" : \"method\") + \" decorators\", \"return\") && (l ? k.unshift(N) : P[F] = N); } return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I(\"get\", s), I(\"set\", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; } function w(e) { return m(e, d, { configurable: !0, enumerable: !0, value: a }); } return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) { e && f.push(g(e)); }, p = function (t, r) { for (var i = 0; i < n.length; i++) { var a = n[i], c = a[1], l = 7 & c; if ((8 & c) == t && !l == r) { var p = a[2], d = !!a[3], m = 16 & c; applyDec(t ? e : e.prototype, a, m, d ? \"#\" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { return _checkInRHS(t) === e; } : o); } } }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { e: c, get c() { var n = []; return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; } }; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _setFunctionName(e, t, n) { \"symbol\" == typeof t && (t = (t = t.description) ? \"[\" + t + \"]\" : \"\"); try { Object.defineProperty(e, \"name\", { configurable: !0, value: n ? n + \" \" + t : t }); } catch (e) {} return e; }\nfunction _checkInRHS(e) { if (Object(e) !== e) throw TypeError(\"right-hand side of 'in' should be an object, got \" + (null !== e ? typeof e : \"null\")); return e; }\nimport { jsx, jsxs } from \"@ecopages/jsx/jsx-runtime\";\nimport { RadiantElement, customElement, onUpdated, prop, state } from \"@ecopages/radiant\";\nlet _RuiMeter;\nclass RuiMeter extends RadiantElement {\n static {\n ({\n e: [_init_value, _init_extra_value, _init_min, _init_extra_min, _init_max, _init_extra_max, _init_label, _init_extra_label, _init_percent, _init_extra_percent, _initProto],\n c: [_RuiMeter, _initClass]\n } = _applyDecs(this, [customElement(\"rui-meter\")], [[prop({\n type: Number,\n reflect: true,\n defaultValue: 0\n }), 0, \"value\"], [prop({\n type: Number,\n defaultValue: 0\n }), 0, \"min\"], [prop({\n type: Number,\n defaultValue: 100\n }), 0, \"max\"], [prop({\n type: String,\n defaultValue: \"\"\n }), 0, \"label\"], [state, 0, \"percent\"], [onUpdated([\"value\", \"min\", \"max\"]), 2, \"onRangeUpdated\"]], 0, void 0, RadiantElement));\n }\n value = (_initProto(this), _init_value(this));\n min = (_init_extra_value(this), _init_min(this));\n max = (_init_extra_min(this), _init_max(this));\n label = (_init_extra_max(this), _init_label(this));\n percent = (_init_extra_label(this), _init_percent(this, 0));\n resolvedAriaLabel = (_init_extra_percent(this), this.$.label.map(label => label || void 0));\n onRangeUpdated() {\n
|
|
5
|
-
"mappings": "AAMA,OAAS,OAAAA,
|
|
6
|
-
"names": ["jsx", "jsxs", "RadiantElement", "customElement", "onUpdated", "prop", "state", "_initProto", "_initClass", "_init_value", "_init_extra_value", "_init_min", "_init_extra_min", "_init_max", "_init_extra_max", "_init_label", "_init_extra_label", "_init_percent", "_init_extra_percent", "_applyDecs", "t", "n", "r", "o", "i", "a", "c", "u", "s", "f", "l", "p", "d", "m", "h", "y", "v", "g", "b", "e", "applyDec", "w", "D", "S", "j", "E", "I", "P", "k", "F", "_setFunctionName", "N", "O", "T", "z", "A", "H", "_toPropertyKey", "_checkInRHS", "_toPrimitive", "_RuiMeter", "RuiMeter", "label", "jsx", "RuiMeter", "props", "jsx"]
|
|
4
|
+
"sourcesContent": ["let _initProto, _initClass, _init_value, _init_extra_value, _init_min, _init_extra_min, _init_max, _init_extra_max, _init_label, _init_extra_label, _init_percent, _init_extra_percent;\nfunction _applyDecs(e, t, n, r, o, i) { var a, c, u, s, f, l, p, d = Symbol.metadata || Symbol.for(\"Symbol.metadata\"), m = Object.defineProperty, h = Object.create, y = [h(null), h(null)], v = t.length; function g(t, n, r) { return function (o, i) { n && (i = o, o = e); for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); return r ? i : o; }; } function b(e, t, n, r) { if (\"function\" != typeof e && (r || void 0 !== e)) throw new TypeError(t + \" must \" + (n || \"be\") + \" a function\" + (r ? \"\" : \" or undefined\")); return e; } function applyDec(e, t, n, r, o, i, u, s, f, l, p) { function d(e) { if (!p(e)) throw new TypeError(\"Attempted to access private element on non-instance\"); } var h = [].concat(t[0]), v = t[3], w = !u, D = 1 === o, S = 3 === o, j = 4 === o, E = 2 === o; function I(t, n, r) { return function (o, i) { return n && (i = o, o = e), r && r(o), P[t].call(o, i); }; } if (!w) { var P = {}, k = [], F = S ? \"get\" : j || D ? \"set\" : \"value\"; if (f ? (l || D ? P = { get: _setFunctionName(function () { return v(this); }, r, \"get\"), set: function (e) { t[4](this, e); } } : P[F] = v, l || _setFunctionName(P[F], r, E ? \"\" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { if ((c = y[+s][r]) && 7 !== (c ^ o)) throw Error(\"Decorating two elements with the same name (\" + P[F].name + \") is not supported yet\"); y[+s][r] = o < 3 ? 1 : o; } } for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { var T = b(h[O], \"A decorator\", \"be\", !0), z = n ? h[O - 1] : void 0, A = {}, H = { kind: [\"field\", \"accessor\", \"method\", \"getter\", \"setter\", \"class\"][o], name: r, metadata: a, addInitializer: function (e, t) { if (e.v) throw new TypeError(\"attempted to call addInitializer after decoration was finished\"); b(t, \"An initializer\", \"be\", !0), i.push(t); }.bind(null, A) }; if (w) c = T.call(z, N, H), A.v = 1, b(c, \"class decorators\", \"return\") && (N = c);else if (H.static = s, H.private = f, c = H.access = { has: f ? p.bind() : function (e) { return r in e; } }, j || (c.get = f ? E ? function (e) { return d(e), P.value; } : I(\"get\", 0, d) : function (e) { return e[r]; }), E || S || (c.set = f ? I(\"set\", 0, d) : function (e, t) { e[r] = t; }), N = T.call(z, D ? { get: P.get, set: P.set } : P[F], H), A.v = 1, D) { if (\"object\" == typeof N && N) (c = b(N.get, \"accessor.get\")) && (P.get = c), (c = b(N.set, \"accessor.set\")) && (P.set = c), (c = b(N.init, \"accessor.init\")) && k.unshift(c);else if (void 0 !== N) throw new TypeError(\"accessor decorators must return an object with get, set, or init properties or undefined\"); } else b(N, (l ? \"field\" : \"method\") + \" decorators\", \"return\") && (l ? k.unshift(N) : P[F] = N); } return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I(\"get\", s), I(\"set\", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; } function w(e) { return m(e, d, { configurable: !0, enumerable: !0, value: a }); } return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) { e && f.push(g(e)); }, p = function (t, r) { for (var i = 0; i < n.length; i++) { var a = n[i], c = a[1], l = 7 & c; if ((8 & c) == t && !l == r) { var p = a[2], d = !!a[3], m = 16 & c; applyDec(t ? e : e.prototype, a, m, d ? \"#\" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { return _checkInRHS(t) === e; } : o); } } }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { e: c, get c() { var n = []; return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; } }; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _setFunctionName(e, t, n) { \"symbol\" == typeof t && (t = (t = t.description) ? \"[\" + t + \"]\" : \"\"); try { Object.defineProperty(e, \"name\", { configurable: !0, value: n ? n + \" \" + t : t }); } catch (e) {} return e; }\nfunction _checkInRHS(e) { if (Object(e) !== e) throw TypeError(\"right-hand side of 'in' should be an object, got \" + (null !== e ? typeof e : \"null\")); return e; }\nimport { jsx, jsxs } from \"@ecopages/jsx/jsx-runtime\";\nimport { RadiantElement, customElement, onUpdated, prop, state } from \"@ecopages/radiant\";\nlet _RuiMeter;\nclass RuiMeter extends RadiantElement {\n static {\n ({\n e: [_init_value, _init_extra_value, _init_min, _init_extra_min, _init_max, _init_extra_max, _init_label, _init_extra_label, _init_percent, _init_extra_percent, _initProto],\n c: [_RuiMeter, _initClass]\n } = _applyDecs(this, [customElement(\"rui-meter\")], [[prop({\n type: Number,\n reflect: true,\n defaultValue: 0\n }), 0, \"value\"], [prop({\n type: Number,\n defaultValue: 0\n }), 0, \"min\"], [prop({\n type: Number,\n defaultValue: 100\n }), 0, \"max\"], [prop({\n type: String,\n defaultValue: \"\"\n }), 0, \"label\"], [state, 0, \"percent\"], [onUpdated([\"value\", \"min\", \"max\"]), 2, \"onRangeUpdated\"]], 0, void 0, RadiantElement));\n }\n value = (_initProto(this), _init_value(this));\n min = (_init_extra_value(this), _init_min(this));\n max = (_init_extra_min(this), _init_max(this));\n label = (_init_extra_max(this), _init_label(this));\n percent = (_init_extra_label(this), _init_percent(this, 0));\n resolvedAriaLabel = (_init_extra_percent(this), this.$.label.map(label => label || void 0));\n trackStyle = this.$.percent.map(percent => ({\n \"--rui-meter-percent\": `${percent}%`\n }));\n onRangeUpdated() {\n const percent = this.max === this.min ? 0 : Math.round((this.value - this.min) / (this.max - this.min) * 100);\n this.percent = Math.min(100, Math.max(0, percent));\n }\n render() {\n return /* @__PURE__ */jsxs(\"div\", {\n class: \"rui-meter\",\n children: [this.label ? /* @__PURE__ */jsx(\"span\", {\n class: \"rui-meter__label\",\n children: this.$.label\n }) : null, /* @__PURE__ */jsxs(\"meter\", {\n class: \"rui-meter__bar\",\n min: this.$.min,\n max: this.$.max,\n value: this.$.value,\n \"aria-label\": this.resolvedAriaLabel,\n children: [this.$.percent, \"%\"]\n }), /* @__PURE__ */jsx(\"div\", {\n class: \"rui-meter__track\",\n style: this.trackStyle,\n \"aria-hidden\": \"true\",\n children: /* @__PURE__ */jsx(\"div\", {\n class: \"rui-meter__fill\"\n })\n }), /* @__PURE__ */jsxs(\"span\", {\n class: \"rui-meter__value\",\n \"aria-hidden\": \"true\",\n children: [this.$.percent, \"%\"]\n })]\n });\n }\n static {\n _initClass();\n }\n}\nexport { _RuiMeter as RuiMeter };", "import { jsx } from \"@ecopages/jsx/jsx-runtime\";\nimport \"./meter.script\";\nexport function RuiMeter(props) {\n return /* @__PURE__ */jsx(\"rui-meter\", {\n ...props\n });\n}"],
|
|
5
|
+
"mappings": "AA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ass", "_init_value", "_init_extra_value", "_init_min", "_init_extra_min", "_init_max", "_init_extra_max", "_init_label", "_init_extra_label", "_init_percent", "_init_extra_percent", "_applyDecs", "t", "n", "r", "o", "i", "a", "c", "u", "s", "f", "l", "p", "d", "m", "h", "y", "v", "g", "b", "e", "applyDec", "w", "D", "S", "j", "E", "I", "P", "k", "F", "_setFunctionName", "N", "O", "T", "z", "A", "H", "_toPropertyKey", "_checkInRHS", "_toPrimitive", "_RuiMeter", "RuiMeter", "label", "percent", "jsx", "RuiMeter", "props", "jsx"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
rui-meter {
|
|
4
|
+
--rui-meter-track-color: var(--rui-track-color, var(--rui-track-fill));
|
|
5
|
+
--rui-meter-fill-color: var(--primary);
|
|
6
|
+
--rui-meter-radius: var(--radius-control);
|
|
7
|
+
--rui-meter-height: 0.75rem;
|
|
8
|
+
--rui-meter-width: 12rem;
|
|
4
9
|
display: block;
|
|
5
10
|
}
|
|
6
11
|
@layer components {
|
|
@@ -12,8 +17,28 @@ rui-meter {
|
|
|
12
17
|
line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
|
|
13
18
|
}
|
|
14
19
|
.rui-meter__bar {
|
|
15
|
-
|
|
16
|
-
width:
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 1px;
|
|
22
|
+
height: 1px;
|
|
23
|
+
padding: 0;
|
|
24
|
+
margin: -1px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
clip-path: inset(50%);
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
border-width: 0;
|
|
29
|
+
}
|
|
30
|
+
.rui-meter__track {
|
|
31
|
+
block-size: var(--rui-meter-height, 0.75rem);
|
|
32
|
+
inline-size: var(--rui-meter-width, 12rem);
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
background: var(--rui-meter-track-color, var(--rui-track-fill));
|
|
35
|
+
border-radius: var(--rui-meter-radius, var(--radius-control));
|
|
36
|
+
}
|
|
37
|
+
.rui-meter__fill {
|
|
38
|
+
block-size: 100%;
|
|
39
|
+
inline-size: var(--rui-meter-percent, 0%);
|
|
40
|
+
background: var(--rui-meter-fill-color, var(--primary));
|
|
41
|
+
border-radius: var(--rui-meter-radius, var(--radius-control));
|
|
17
42
|
}
|
|
18
43
|
.rui-meter__value {
|
|
19
44
|
color: var(--color-on-surface, var(--on-surface));
|
|
@@ -13,33 +13,37 @@ type RuiMeterBindings = {
|
|
|
13
13
|
percent: number;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* `<rui-meter>` —
|
|
16
|
+
* `<rui-meter>` — graphical display of a numeric value within a range.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Derived Tree: the host `render()` owns the label, native `<meter>`, visual track, and percent
|
|
19
|
+
* readout. Pass `value`, `min`, `max`, and `label` as attributes or props; there
|
|
20
|
+
* is no authored light-DOM child contract.
|
|
19
21
|
*
|
|
20
22
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/meter/
|
|
21
|
-
*
|
|
22
23
|
* @element rui-meter
|
|
23
|
-
*
|
|
24
24
|
* @attr {number} value - Current value. Default: `0`.
|
|
25
25
|
* @attr {number} min - Range minimum. Default: `0`.
|
|
26
26
|
* @attr {number} max - Range maximum. Default: `100`.
|
|
27
|
-
* @attr {string} label - Text describing what is measured (
|
|
28
|
-
* name). Default: `''`.
|
|
27
|
+
* @attr {string} label - Text describing what is measured (accessible name). Default: `''`.
|
|
29
28
|
*
|
|
30
29
|
* @remarks
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* **Why a custom element?** The view wraps the native element to compose label
|
|
36
|
-
* + value chrome; percent derivation from `value`/`min`/`max` is reactive prop
|
|
37
|
-
* math, which a JSX view would need manual subscription for.
|
|
30
|
+
* The visually hidden native `<meter>` retains range semantics. The track and fill
|
|
31
|
+
* are presentational and follow the derived percent;
|
|
32
|
+
* the numeric readout beside it is `aria-hidden`. Percent is derived reactively
|
|
33
|
+
* from `value` / `min` / `max` and clamped to 0..100, matching the native `<meter>`.
|
|
38
34
|
*
|
|
39
35
|
* @cssclass rui-meter - Root row (label, bar, value).
|
|
40
36
|
* @cssclass rui-meter__label - Text describing the measurement.
|
|
41
|
-
* @cssclass rui-meter__bar - The native `<meter>`.
|
|
37
|
+
* @cssclass rui-meter__bar - The visually hidden native `<meter>`.
|
|
38
|
+
* @cssclass rui-meter__track - Presentational track.
|
|
39
|
+
* @cssclass rui-meter__fill - Presentational fill.
|
|
42
40
|
* @cssclass rui-meter__value - Numeric readout (`aria-hidden`).
|
|
41
|
+
*
|
|
42
|
+
* @cssprop --rui-meter-track-color - Bar track background. Default: `--rui-track-color` / `--rui-track-fill`.
|
|
43
|
+
* @cssprop --rui-meter-fill-color - Filled portion. Default: `--primary`.
|
|
44
|
+
* @cssprop --rui-meter-radius - Track and fill corner radius. Default: `--radius-control`.
|
|
45
|
+
* @cssprop --rui-meter-height - Bar block size. Default: `0.75rem`.
|
|
46
|
+
* @cssprop --rui-meter-width - Bar inline size. Default: `12rem`.
|
|
43
47
|
*/
|
|
44
48
|
export declare class RuiMeter extends RadiantElement<RuiMeterBindings> {
|
|
45
49
|
value: number;
|
|
@@ -48,6 +52,7 @@ export declare class RuiMeter extends RadiantElement<RuiMeterBindings> {
|
|
|
48
52
|
label: string;
|
|
49
53
|
percent: number;
|
|
50
54
|
private readonly resolvedAriaLabel;
|
|
55
|
+
private readonly trackStyle;
|
|
51
56
|
onRangeUpdated(): void;
|
|
52
57
|
render(): import("@ecopages/jsx").JsxRenderable;
|
|
53
58
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { RuiNavigationMenu, RuiNavigationMenuBar, RuiNavigationMenuPanels, RuiNavigationMenuTrigger, RuiNavigationMenuLink, RuiNavigationMenuPanel, type RuiNavigationMenuTriggerProps, type RuiNavigationMenuLinkProps, type RuiNavigationMenuPanelProps, } from './navigation-menu';
|
|
2
|
-
export { RuiNavigationMenu as RuiNavigationMenuElement, type RuiNavigationMenuProps } from './navigation-menu.script';
|
|
2
|
+
export { NAVIGATION_MENU_DEFAULT_CLOSE_DELAY, NAVIGATION_MENU_DEFAULT_HOVER_DELAY, RuiNavigationMenu as RuiNavigationMenuElement, type RuiNavigationMenuProps, } from './navigation-menu.script';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as I}from"@ecopages/jsx/jsx-runtime";function D(...n){return n.filter(Boolean).join(" ")}import{RadiantElement as gt,customElement as Rt,onEvent as q,prop as Mt}from"@ecopages/radiant";var bt="a[href], button, input, select, textarea, [tabindex]";function ut(n){return Array.from(n.querySelectorAll(bt)).filter(t=>!t.hasAttribute("disabled"))}function Y(n,t){n.forEach((e,r)=>{let u=r===t?0:-1;e.tabIndex!==u&&(e.tabIndex=u)})}function yt(n,t){if(!n.length)return null;let e=Math.max(0,Math.min(n.length-1,t));return Y(n,e),n[e]?.focus(),n[e]??null}function xt(n,t){return n==="Home"?"first":n==="End"?"last":t==="horizontal"?n==="ArrowRight"?"next":n==="ArrowLeft"?"prev":null:n==="ArrowDown"?"next":n==="ArrowUp"?"prev":null}function Z(n){let{items:t,current:e,key:r,orientation:u="horizontal",wrap:h=!0}=n;if(!t.length||!e)return{handled:!1};let s=t.indexOf(e);if(s<0)return{handled:!1};let a=xt(r,u);if(!a)return{handled:!1};let d=s;a==="first"?d=0:a==="last"?d=t.length-1:a==="next"?d=h?(s+1)%t.length:Math.min(t.length-1,s+1):d=h?(s-1+t.length)%t.length:Math.max(0,s-1);let E=yt(t,d);return E?{handled:!0,index:d,item:E}:{handled:!1}}var st,lt,ct,ft;function wt(n,t,e,r,u,h){var s,a,d,E,x,S,M,K=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,T=Object.create,B=[T(null),T(null)],N=t.length;function _(i,p,v){return function(o,l){p&&(l=o,o=n);for(var y=0;y<i.length;y++)l=i[y].apply(o,v?[l]:[]);return v?l:o}}function b(i,p,v,o){if(typeof i!="function"&&(o||i!==void 0))throw new TypeError(p+" must "+(v||"be")+" a function"+(o?"":" or undefined"));return i}function z(i,p,v,o,l,y,P,m,w,A,H){function W(f){if(!H(f))throw new TypeError("Attempted to access private element on non-instance")}var G=[].concat(p[0]),tt=p[3],J=!P,C=l===1,et=l===3,nt=l===4,$=l===2;function L(f,V,at){return function(U,ot){return V&&(ot=U,U=i),at&&at(U),c[f].call(U,ot)}}if(!J){var c={},Q=[],R=et?"get":nt||C?"set":"value";if(w?(A||C?c={get:dt(function(){return tt(this)},o,"get"),set:function(f){p[4](this,f)}}:c[R]=tt,A||dt(c[R],o,$?"":R)):A||(c=Object.getOwnPropertyDescriptor(i,o)),!A&&!w){if((a=B[+m][o])&&(a^l)!==7)throw Error("Decorating two elements with the same name ("+c[R].name+") is not supported yet");B[+m][o]=l<3?1:l}}for(var g=i,F=G.length-1;F>=0;F-=v?2:1){var rt=b(G[F],"A decorator","be",!0),it=v?G[F-1]:void 0,X={},j={kind:["field","accessor","method","getter","setter","class"][l],name:o,metadata:s,addInitializer:function(f,V){if(f.v)throw new TypeError("attempted to call addInitializer after decoration was finished");b(V,"An initializer","be",!0),y.push(V)}.bind(null,X)};if(J)a=rt.call(it,g,j),X.v=1,b(a,"class decorators","return")&&(g=a);else if(j.static=m,j.private=w,a=j.access={has:w?H.bind():function(f){return o in f}},nt||(a.get=w?$?function(f){return W(f),c.value}:L("get",0,W):function(f){return f[o]}),$||et||(a.set=w?L("set",0,W):function(f,V){f[o]=V}),g=rt.call(it,C?{get:c.get,set:c.set}:c[R],j),X.v=1,C){if(typeof g=="object"&&g)(a=b(g.get,"accessor.get"))&&(c.get=a),(a=b(g.set,"accessor.set"))&&(c.set=a),(a=b(g.init,"accessor.init"))&&Q.unshift(a);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(g,(A?"field":"method")+" decorators","return")&&(A?Q.unshift(g):c[R]=g)}return l<2&&P.push(_(Q,m,1),_(y,m,0)),A||J||(w?C?P.splice(-1,0,L("get",m),L("set",m)):P.push($?c[R]:b.call.bind(c[R])):k(i,o,c)),g}function O(i){return k(i,K,{configurable:!0,enumerable:!0,value:s})}return h!==void 0&&(s=h[K]),s=T(s??null),x=[],S=function(i){i&&x.push(_(i))},M=function(i,p){for(var v=0;v<e.length;v++){var o=e[v],l=o[1],y=7&l;if((8&l)==i&&!y==p){var P=o[2],m=!!o[3],w=16&l;z(i?n:n.prototype,o,w,m?"#"+P:At(P),y,y<2?[]:i?E=E||[]:d=d||[],x,!!i,m,p,i&&m?function(A){return Tt(A)===n}:u)}}},M(8,0),M(0,0),M(8,1),M(0,1),S(d),S(E),a=x,N||O(n),{e:a,get c(){var i=[];return N&&[O(n=z(n,[t],r,n.name,5,i)),_(i,1)]}}}function At(n){var t=Et(n,"string");return typeof t=="symbol"?t:t+""}function Et(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function dt(n,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(n,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return n}function Tt(n){if(Object(n)!==n)throw TypeError("right-hand side of 'in' should be an object, got "+(n!==null?typeof n:"null"));return n}var pt,ht=class extends gt{static{({e:[ct,ft,st],c:[pt,lt]}=wt(this,[Rt("rui-navigation-menu")],[[Mt({type:String,defaultValue:""}),0,"label"],[q({document:!0,type:"click"}),2,"onDocumentClick"],[q({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[q({ref:"root",type:"keydown"}),2,"onRootKeydown"],[q({selector:"[data-navigation-trigger]",type:"click"}),2,"onTriggerClick"],[q({selector:"[data-navigation-item]",type:"keydown"}),2,"onBarItemKeydown"],[q({selector:"[data-navigation-panel]",type:"keydown"}),2,"onPanelKeydown"]],0,void 0,gt))}label=(st(this),ct(this));openValue=(ft(this),null);onConnected(){this.syncPanels(),this.syncBarRovingTabindex()}getBarItems(){return Array.from(this.querySelectorAll("[data-navigation-item]"))}syncBarRovingTabindex(){let t=this.getBarItems(),e=Math.max(0,t.findIndex(r=>r.tabIndex===0||r===document.activeElement));Y(t,e)}isBarTrigger(t){return t.hasAttribute("data-navigation-trigger")}getTriggers(){return Array.from(this.querySelectorAll("[data-navigation-trigger]"))}getPanel(t){return this.querySelector(`[data-navigation-panel][data-value="${t}"]`)}getTrigger(t){return this.querySelector(`[data-navigation-trigger][data-value="${t}"]`)}getPanels(){return Array.from(this.querySelectorAll("[data-navigation-panel]"))}getPanelFocusables(t){return ut(t)}focusPanelEntry(t){let e=this.getPanel(t);if(!e){this.getTrigger(t)?.focus();return}let r=this.getPanelFocusables(e);if(r.length>0){r[0].focus();return}e.hasAttribute("tabindex")||(e.tabIndex=-1),e.focus()}syncPanels(){for(let t of this.getPanels()){let e=t.getAttribute("data-value")??"",r=this.openValue===e;t.toggleAttribute("hidden",!r),t.dataset.state=r?"open":"closed",t.setAttribute("aria-hidden",String(!r));let u=this.getTrigger(e);u&&(u.setAttribute("aria-expanded",String(r)),t.setAttribute("role","region"),t.setAttribute("aria-labelledby",u.id||`${e}-trigger`),u.id||(u.id=`${e}-trigger`))}for(let t of this.getTriggers()){let e=t.getAttribute("data-value")??"",r=this.openValue===e;t.setAttribute("aria-expanded",String(r)),this.getPanel(e)?t.setAttribute("aria-haspopup","true"):t.removeAttribute("aria-haspopup")}}closeMenu(t=!1){let e=this.openValue;e&&(this.openValue=null,this.syncPanels(),t&&this.getTrigger(e)?.focus())}openPanel(t,e=!0){if(this.openValue===t){this.closeMenu(!0);return}this.openValue=t,this.syncPanels(),queueMicrotask(()=>{e?this.focusPanelEntry(t):this.getTrigger(t)?.focus()})}getEventElement(t){let e=t.target;return e instanceof Element?e:e instanceof Text?e.parentElement:null}isWithinOpenPanel(t){if(!this.openValue)return!1;let e=this.getPanel(this.openValue);return e?t.composedPath().some(r=>r instanceof Node&&e.contains(r)):!1}onDocumentClick(t){if(!this.openValue||this.isWithinOpenPanel(t))return;let e=this.getEventElement(t);e&&this.contains(e)||this.closeMenu()}onDocumentKeydown(t){if(t.key!=="Escape"||!this.openValue)return;let e=document.activeElement;e&&!this.contains(e)||(t.preventDefault(),this.closeMenu(!0))}onRootKeydown(t){t.key==="Escape"&&this.openValue&&(t.preventDefault(),this.closeMenu(!0))}onTriggerClick(t){let e=t.target.closest("[data-navigation-trigger]"),r=e?.getAttribute("data-value");!e||!r||(t.preventDefault(),this.openPanel(r))}onBarItemKeydown(t){let e=t.target.closest("[data-navigation-item]");if(!e||this.handleBarTriggerKeydown(t,e))return;let r=Z({items:this.getBarItems(),current:e,key:t.key,orientation:"horizontal",wrap:!1});r.handled&&(t.preventDefault(),this.syncMenuToBarItem(r.item))}handleBarTriggerKeydown(t,e){if(t.key==="Escape")return this.openValue&&(t.preventDefault(),this.closeMenu(!0)),!0;let r=e.getAttribute("data-value");return!this.isBarTrigger(e)||!r?!1:t.key==="Enter"||t.key===" "?(t.preventDefault(),this.openPanel(r),!0):t.key!=="ArrowDown"?!1:(t.preventDefault(),this.openValue===r?this.focusPanelEntry(r):this.openPanel(r),!0)}syncMenuToBarItem(t){if(!this.openValue)return;let e=t.getAttribute("data-value");this.isBarTrigger(t)&&e?this.openPanel(e):this.closeMenu(!1)}onPanelKeydown(t){let e=t.target;if(!(e instanceof Element))return;let r=e.closest("[data-navigation-panel]");if(!r||r.hidden)return;let u=r.getAttribute("data-value");if(!u||this.openValue!==u)return;let h=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!h||!r.contains(h))return;if(t.key==="Escape"){t.preventDefault(),this.closeMenu(!0);return}let s=this.getPanelFocusables(r);if(t.key==="ArrowUp"&&h===s[0]){t.preventDefault(),this.getTrigger(u)?.focus();return}!s.length||!Z({items:s,current:h,key:t.key,orientation:"vertical",wrap:!1}).handled||t.preventDefault()}static{lt()}};import{jsx as vt}from"@ecopages/jsx/jsx-runtime";function kt(n,t,e){if(n!==void 0)return n;if(t)return e}function Pt(n,t){if(typeof n=="function"){n(t);return}n!=null&&typeof n=="object"&&"handleEvent"in n&&n.handleEvent(t)}function mt(n){if(n.href!==void 0){let{href:k,target:T,rel:B,download:N,children:_,class:b,variant:z,size:O,square:i,...p}=n;return vt("a",{...p,href:k,target:T,rel:B,download:N,class:D("rui-button",`rui-button--${z??"filled"}`,`rui-button--${O??"md"}`,i&&"rui-button--square",b),children:_})}let{variant:t,size:e,square:r,class:u,children:h,type:s="button",disabled:a,pressed:d,defaultPressed:E=!1,toggle:x=!1,"on:click":S,...M}=n,K=k=>{if(x&&d===void 0){let T=k.currentTarget,B=T.getAttribute("aria-pressed")!=="true";T.setAttribute("aria-pressed",String(B))}Pt(S,k)};return vt("button",{...M,type:s,class:D("rui-button",`rui-button--${t??"filled"}`,`rui-button--${e??"md"}`,r&&"rui-button--square",u),disabled:a,"aria-pressed":kt(d,x,E),"data-toggle":x&&d===void 0?"":void 0,"on:click":x||S?K:void 0,children:h})}function Dt({children:n,class:t,...e}){return I("div",{...e,"data-ref":"bar",class:D("rui-navigation-menu__bar",t),children:n})}function It({children:n,class:t,...e}){return I("div",{...e,"data-ref":"panels",class:D("rui-navigation-menu__panels",t),children:n})}function St({children:n,label:t,...e}){return I("rui-navigation-menu",{...e,label:t,children:I("nav",{class:"rui-navigation-menu","data-ref":"root","aria-label":t||void 0,children:n})})}function Bt({children:n,value:t,variant:e="ghost",class:r,...u}){return I(mt,{...u,variant:e,class:r,"data-navigation-item":!0,"data-navigation-trigger":!0,"data-value":t,children:n})}function _t({children:n,href:t,class:e,...r}){return I("a",{...r,href:t,"data-navigation-item":!0,class:D("rui-button","rui-button--ghost","rui-button--md",e),children:n})}function Vt({children:n,value:t,class:e,...r}){return I("div",{...r,class:e,"data-navigation-panel":!0,"data-value":t,children:n})}export{St as RuiNavigationMenu,Dt as RuiNavigationMenuBar,pt as RuiNavigationMenuElement,_t as RuiNavigationMenuLink,Vt as RuiNavigationMenuPanel,It as RuiNavigationMenuPanels,Bt as RuiNavigationMenuTrigger};
|
|
1
|
+
import{jsx as V}from"@ecopages/jsx/jsx-runtime";function I(...t){return t.filter(Boolean).join(" ")}import{RadiantElement as Ce,customElement as nt,onEvent as x,prop as G}from"@ecopages/radiant";var Be="a[href], button, input, select, textarea, [tabindex]";function he(t){return Array.from(t.querySelectorAll(Be)).filter(e=>!e.hasAttribute("disabled"))}function Q(t,e){t.forEach((n,r)=>{let i=r===e?0:-1;n.tabIndex!==i&&(n.tabIndex=i)})}function Ne(t,e){if(!t.length)return null;let n=Math.max(0,Math.min(t.length-1,e));return Q(t,n),t[n]?.focus(),t[n]??null}function Le(t,e){return t==="Home"?"first":t==="End"?"last":e==="horizontal"?t==="ArrowRight"?"next":t==="ArrowLeft"?"prev":null:t==="ArrowDown"?"next":t==="ArrowUp"?"prev":null}function ee(t){let{items:e,current:n,key:r,orientation:i="horizontal",wrap:a=!0}=t;if(!e.length||!n)return{handled:!1};let o=e.indexOf(n);if(o<0)return{handled:!1};let s=Le(r,i);if(!s)return{handled:!1};let u=o;s==="first"?u=0:s==="last"?u=e.length-1:s==="next"?u=a?(o+1)%e.length:Math.min(e.length-1,o+1):u=a?(o-1+e.length)%e.length:Math.max(0,o-1);let d=Ne(e,u);return d?{handled:!0,index:u,item:d}:{handled:!1}}var qe=/^[A-Za-z][A-Za-z0-9_-]*$/;function fe(t){return qe.test(t)}function Ue(t){let e=t.trim();if(fe(e))return e;let n=`rui-${e}`;return e&&fe(n)?n:"rui"}function te(t){let e=typeof crypto.randomUUID=="function"?crypto.randomUUID().replace(/-/g,""):Array.from(crypto.getRandomValues(new Uint8Array(16)),n=>n.toString(16).padStart(2,"0")).join("");return`${Ue(t)}-${e}`}var je={top:"bottom",bottom:"top",left:"right",right:"left"},We=8,ne=new WeakMap;function $e(t){ne.has(t)&&(t.style.width="",t.style.minWidth="",t.style.maxWidth="",t.style.boxSizing="",ne.delete(t))}function Ke(t){let e=t.indexOf("-");if(e===-1)return{side:t,align:"center"};let n=t.slice(0,e),r=t.slice(e+1);return{side:n,align:r==="start"||r==="end"?r:"center"}}function ge(t){return t==="top"||t==="bottom"?"y":"x"}function de(t,e,n,r,i){let{width:a,height:o}=e,s=0,u=0;switch(n){case"top":u=t.top-o-i;break;case"bottom":u=t.bottom+i;break;case"left":s=t.left-a-i;break;case"right":s=t.right+i;break}return ge(n)==="y"?r==="start"?s=t.left:r==="end"?s=t.right-a:s=t.left+(t.width-a)/2:r==="start"?u=t.top:r==="end"?u=t.bottom-o:u=t.top+(t.height-o)/2,{x:s,y:u}}function Ge(t,e,n,r){let{padding:i,width:a,height:o}=r;return n==="top"?Math.max(0,i-t.y):n==="bottom"?Math.max(0,t.y+e.height-(o-i)):n==="left"?Math.max(0,i-t.x):Math.max(0,t.x+e.width-(a-i))}function pe(t,e,n,r){let{padding:i,width:a,height:o}=r;return n==="top"?t.top-i-e.height:n==="bottom"?o-i-e.height-t.bottom:n==="left"?t.left-i-e.width:a-i-e.width-t.right}function ze(t,e){return e==="center"?t:`${t}-${e}`}function Ye(t,e,n,r){let{padding:i,width:a,height:o}=r;if(ge(n)==="y"){let u=Math.max(i,a-i-e.width);return{x:Math.min(Math.max(t.x,i),u),y:Math.max(i,t.y)}}let s=Math.max(i,o-i-e.height);return{x:Math.max(i,t.x),y:Math.min(Math.max(t.y,i),s)}}function Ze(t,e,n,r,i={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:We}){let{side:a,align:o}=Ke(n),s=de(t,e,a,o,r),u=Ge(s,e,a,i),d=a,m=s;if(u>0){let w=je[a],A=de(t,e,w,o,r),H=pe(t,e,a,i);pe(t,e,w,i)>H&&(d=w,m=A)}return{coords:Ye(m,e,d,i),placement:ze(d,o)}}function Xe(t,e,n,r,i={}){let a=i.matchAnchorWidth===!0,o=t.offsetWidth,s=a?{width:o,height:e.offsetHeight}:{width:e.offsetWidth,height:e.offsetHeight};a?(e.style.width=`${o}px`,e.style.minWidth=`${o}px`,e.style.maxWidth=`${o}px`,e.style.boxSizing="border-box",ne.set(e,!0)):$e(e);let{coords:u,placement:d}=Ze(t.getBoundingClientRect(),s,n,r);return Object.assign(e.style,{position:"fixed",left:`${u.x}px`,top:`${u.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),e.setAttribute("data-placement",d),d}function me({anchor:t,floating:e,getPlacement:n,gap:r,matchAnchorWidth:i}){let a=()=>{e.hidden||Xe(t,e,n(),r,{matchAnchorWidth:i})};a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0);let o=new ResizeObserver(a);return o.observe(t),o.observe(e),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0),o.disconnect()}}function ve(t,e=document.body){let n=t.parentNode;if(!n)return{unmount:()=>{}};let r=document.createComment("rui-portal");return n.insertBefore(r,t),e.appendChild(t),{unmount:()=>{let i=r.parentNode;i&&(i.insertBefore(t,r),r.remove())}}}function ye(t,e,n){return n?!!(t?.contains(n)||e?.contains(n)):!1}function be(t,e,n){return!ye(t,e,n)}var K=class{config;cleanupFloating=null;portalHandle=null;floatingElement=null;constructor(e){this.config=e}updateConfig(e){this.config={...this.config,...e}}sync(){let e=this.resolveFloating();if(!e)return;if(!this.config.getOpen()){this.teardown(),e.toggleAttribute("hidden",!0);return}let r=this.config.getAnchor();if(!r)return;e.toggleAttribute("hidden",!1),this.config.portal!==!1?this.portalHandle||(this.portalHandle=ve(e,this.config.portalContainer??document.body)):this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null),this.teardownFloating(),this.cleanupFloating=me({anchor:r,floating:e,getPlacement:this.config.getPlacement,gap:this.config.gap??8,matchAnchorWidth:this.config.matchAnchorWidth})}contains(e){return ye(this.config.getAnchor(),this.resolveFloating(),e)}getFloatingElement(){return this.resolveFloating()}teardown(){this.teardownFloating(),this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null)}destroy(){this.teardown(),this.floatingElement=null}resolveFloating(){let e=this.config.getFloating();return e&&(this.floatingElement=e),e??this.floatingElement}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}};var xe,we,Te,Pe,Ae,Ee,Oe,Me,_e,De;function Je(t,e,n,r,i,a){var o,s,u,d,m,w,A,H=Symbol.metadata||Symbol.for("Symbol.metadata"),M=Object.defineProperty,_=Object.create,F=[_(null),_(null)],N=e.length;function R(l,v,y){return function(c,h){v&&(h=c,c=t);for(var P=0;P<l.length;P++)h=l[P].apply(c,y?[h]:[]);return y?h:c}}function T(l,v,y,c){if(typeof l!="function"&&(c||l!==void 0))throw new TypeError(v+" must "+(y||"be")+" a function"+(c?"":" or undefined"));return l}function L(l,v,y,c,h,P,C,b,E,O,re){function z(p){if(!re(p))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(v[0]),ie=v[3],Z=!C,k=h===1,oe=h===3,ae=h===4,U=h===2;function j(p,S,le){return function($,ce){return S&&(ce=$,$=l),le&&le($),f[p].call($,ce)}}if(!Z){var f={},X=[],D=oe?"get":ae||k?"set":"value";if(E?(O||k?f={get:Ie(function(){return ie(this)},c,"get"),set:function(p){v[4](this,p)}}:f[D]=ie,O||Ie(f[D],c,U?"":D)):O||(f=Object.getOwnPropertyDescriptor(l,c)),!O&&!E){if((s=F[+b][c])&&(s^h)!==7)throw Error("Decorating two elements with the same name ("+f[D].name+") is not supported yet");F[+b][c]=h<3?1:h}}for(var g=l,W=Y.length-1;W>=0;W-=y?2:1){var se=T(Y[W],"A decorator","be",!0),ue=y?Y[W-1]:void 0,J={},B={kind:["field","accessor","method","getter","setter","class"][h],name:c,metadata:o,addInitializer:function(p,S){if(p.v)throw new TypeError("attempted to call addInitializer after decoration was finished");T(S,"An initializer","be",!0),P.push(S)}.bind(null,J)};if(Z)s=se.call(ue,g,B),J.v=1,T(s,"class decorators","return")&&(g=s);else if(B.static=b,B.private=E,s=B.access={has:E?re.bind():function(p){return c in p}},ae||(s.get=E?U?function(p){return z(p),f.value}:j("get",0,z):function(p){return p[c]}),U||oe||(s.set=E?j("set",0,z):function(p,S){p[c]=S}),g=se.call(ue,k?{get:f.get,set:f.set}:f[D],B),J.v=1,k){if(typeof g=="object"&&g)(s=T(g.get,"accessor.get"))&&(f.get=s),(s=T(g.set,"accessor.set"))&&(f.set=s),(s=T(g.init,"accessor.init"))&&X.unshift(s);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else T(g,(O?"field":"method")+" decorators","return")&&(O?X.unshift(g):f[D]=g)}return h<2&&C.push(R(X,b,1),R(P,b,0)),O||Z||(E?k?C.splice(-1,0,j("get",b),j("set",b)):C.push(U?f[D]:T.call.bind(f[D])):M(l,c,f)),g}function q(l){return M(l,H,{configurable:!0,enumerable:!0,value:o})}return a!==void 0&&(o=a[H]),o=_(o??null),m=[],w=function(l){l&&m.push(R(l))},A=function(l,v){for(var y=0;y<n.length;y++){var c=n[y],h=c[1],P=7&h;if((8&h)==l&&!P==v){var C=c[2],b=!!c[3],E=16&h;L(l?t:t.prototype,c,E,b?"#"+C:Qe(C),P,P<2?[]:l?d=d||[]:u=u||[],m,!!l,b,v,l&&b?function(O){return tt(O)===t}:i)}}},A(8,0),A(0,0),A(8,1),A(0,1),w(u),w(d),s=m,N||q(t),{e:s,get c(){var l=[];return N&&[q(t=L(t,[e],r,t.name,5,l)),R(l,1)]}}}function Qe(t){var e=et(t,"string");return typeof e=="symbol"?e:e+""}function et(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ie(t,e,n){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:n?n+" "+e:e})}catch{}return t}function tt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}var He=200,Fe=150,rt=8,Re,Ve=class extends Ce{static{({e:[Te,Pe,Ae,Ee,Oe,Me,_e,De,xe],c:[Re,we]}=Je(this,[nt("rui-navigation-menu")],[[G({type:String,defaultValue:""}),0,"label"],[G({type:Boolean,reflect:!0,attribute:"open-on-hover",defaultValue:!1}),0,"openOnHover"],[G({type:Number,attribute:"hover-delay",defaultValue:He}),0,"hoverDelay"],[G({type:Number,attribute:"close-delay",defaultValue:Fe}),0,"closeDelay"],[x({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[x({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[x({ref:"root",type:"keydown"}),2,"onRootKeydown"],[x({selector:"[data-navigation-trigger]",type:"click"}),2,"onTriggerClick"],[x({selector:"[data-navigation-trigger]",type:"pointerover"}),2,"onTriggerPointerOver"],[x({selector:"[data-navigation-trigger]",type:"pointerout"}),2,"onTriggerPointerOut"],[x({selector:"[data-navigation-panel]",type:"pointerover"}),2,"onPanelPointerOver"],[x({selector:"[data-navigation-panel]",type:"pointerout"}),2,"onPanelPointerOut"],[x({selector:"[data-navigation-item]",type:"pointerover"}),2,"onBarItemPointerOver"],[x({selector:"[data-navigation-item]",type:"keydown"}),2,"onBarItemKeydown"],[x({selector:"[data-navigation-panel]",type:"keydown"}),2,"onPanelKeydown"]],0,void 0,Ce))}label=(xe(this),Te(this));openOnHover=(Pe(this),Ae(this));hoverDelay=(Ee(this),Oe(this));closeDelay=(Me(this),_e(this));openValue=(De(this),null);popoverController=null;openTimer=null;closeTimer=null;onConnected(){this.syncPanels(),this.syncBarRovingTabindex(),this.syncPopover()}disconnectedCallback(){this.clearHoverTimers(),this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}clearHoverTimers(){this.openTimer&&clearTimeout(this.openTimer),this.closeTimer&&clearTimeout(this.closeTimer),this.openTimer=null,this.closeTimer=null}getBarItems(){return Array.from(this.querySelectorAll("[data-navigation-item]"))}syncBarRovingTabindex(){let e=this.getBarItems(),n=Math.max(0,e.findIndex(r=>r.tabIndex===0||r===document.activeElement));Q(e,n)}isBarTrigger(e){return e.hasAttribute("data-navigation-trigger")}getTriggers(){return Array.from(this.querySelectorAll("[data-navigation-trigger]"))}getPanel(e){return this.querySelector(`[data-navigation-panel][data-value="${e}"]`)}getTrigger(e){return this.querySelector(`[data-navigation-trigger][data-value="${e}"]`)}getPanels(){return Array.from(this.querySelectorAll("[data-navigation-panel]"))}getPanelFocusables(e){return he(e)}getOpenTrigger(){return this.openValue?this.getTrigger(this.openValue):null}getOpenPanel(){return this.openValue?this.getPanel(this.openValue):null}focusPanelEntry(e){let n=this.getPanel(e);if(!n){this.getTrigger(e)?.focus();return}let r=this.getPanelFocusables(n);if(r.length>0){r[0].focus();return}n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus()}ensurePairIds(e,n){e.id||(e.id=te("rui-navigation-trigger")),n.id||(n.id=te("rui-navigation-panel"))}syncPanels(){for(let e of this.getPanels()){let n=e.getAttribute("data-value")??"",r=this.openValue===n;e.toggleAttribute("hidden",!r),e.dataset.state=r?"open":"closed",e.setAttribute("aria-hidden",String(!r)),e.setAttribute("role","region");let i=this.getTrigger(n);i&&(this.ensurePairIds(i,e),i.setAttribute("aria-expanded",String(r)),i.setAttribute("aria-controls",e.id),e.setAttribute("aria-labelledby",i.id))}for(let e of this.getTriggers()){let n=e.getAttribute("data-value")??"",r=this.openValue===n;e.setAttribute("aria-expanded",String(r)),this.getPanel(n)?e.setAttribute("aria-haspopup","true"):e.removeAttribute("aria-haspopup")}}ensurePopoverController(){return this.popoverController||(this.popoverController=new K({getAnchor:()=>this.getOpenTrigger(),getFloating:()=>this.getOpenPanel(),getOpen:()=>!!this.openValue,getPlacement:()=>"bottom-start",gap:rt,portal:!1})),this.popoverController}syncPopover(){let e=this.ensurePopoverController();e.updateConfig({getAnchor:()=>this.getOpenTrigger(),getFloating:()=>this.getOpenPanel(),getOpen:()=>!!this.openValue}),e.sync()}closeMenu(e=!1){let n=this.openValue;n&&(this.clearHoverTimers(),this.openValue=null,this.syncPanels(),this.syncPopover(),e&&this.getTrigger(n)?.focus())}openPanel(e,n={}){let{focusPanel:r=!0,toggle:i=!0}=n;if(this.openValue===e){i&&this.closeMenu(!0);return}this.clearHoverTimers();let a=this.getOpenPanel(),o=!!(a&&document.activeElement instanceof Node&&a.contains(document.activeElement));this.openValue=e,this.syncPanels(),this.syncPopover(),queueMicrotask(()=>{if(r){this.focusPanelEntry(e);return}o&&this.getTrigger(e)?.focus()})}isTouchPointer(e){return e.pointerType==="touch"}pointerIsInOpenMenu(e){return e instanceof Node?!be(this.getOpenTrigger(),this.getOpenPanel(),e):!1}triggerValueFromEvent(e){let n=e.target;return n instanceof Element?n.closest("[data-navigation-trigger]")?.getAttribute("data-value")??null:null}scheduleHoverOpen(e){if(!this.openOnHover||!this.getPanel(e)||(this.clearHoverTimers(),this.openValue===e))return;let n=this.openValue?0:Math.max(0,this.hoverDelay);if(n<=0){this.openPanel(e,{focusPanel:!1,toggle:!1});return}this.openTimer=setTimeout(()=>{this.openTimer=null,this.openPanel(e,{focusPanel:!1,toggle:!1})},n)}scheduleHoverClose(){if(!this.openOnHover||!this.openValue){this.clearHoverTimers();return}this.clearHoverTimers();let e=Math.max(0,this.closeDelay);if(e<=0){this.closeMenu();return}this.closeTimer=setTimeout(()=>{this.closeTimer=null,this.closeMenu()},e)}onDocumentPointerDown(e){this.openValue&&(this.pointerIsInOpenMenu(e.target)||this.closeMenu())}onDocumentKeydown(e){if(e.key!=="Escape"||!this.openValue)return;let n=document.activeElement,r=this.getOpenPanel();n&&!this.contains(n)&&!(r&&r.contains(n))||(e.preventDefault(),this.closeMenu(!0))}onRootKeydown(e){e.key==="Escape"&&this.openValue&&(e.preventDefault(),this.closeMenu(!0))}onTriggerClick(e){let n=e.target.closest("[data-navigation-trigger]"),r=n?.getAttribute("data-value");!n||!r||(e.preventDefault(),this.openPanel(r))}onTriggerPointerOver(e){if(!this.openOnHover||this.isTouchPointer(e))return;let n=this.triggerValueFromEvent(e);n&&this.scheduleHoverOpen(n)}onTriggerPointerOut(e){if(!this.openOnHover||this.isTouchPointer(e)||this.pointerIsInOpenMenu(e.relatedTarget))return;let n=e.relatedTarget;n instanceof Element&&n.closest("[data-navigation-trigger]")&&this.contains(n)||this.scheduleHoverClose()}onPanelPointerOver(e){if(!this.openOnHover||this.isTouchPointer(e)||!this.openValue)return;let n=e.target.closest("[data-navigation-panel]");!n||n.getAttribute("data-value")!==this.openValue||this.clearHoverTimers()}onPanelPointerOut(e){!this.openOnHover||this.isTouchPointer(e)||this.pointerIsInOpenMenu(e.relatedTarget)||this.scheduleHoverClose()}onBarItemPointerOver(e){if(!this.openOnHover||this.isTouchPointer(e)||!this.openValue)return;let n=e.target.closest("[data-navigation-item]");!n||this.isBarTrigger(n)||this.scheduleHoverClose()}onBarItemKeydown(e){let n=e.target.closest("[data-navigation-item]");if(!n||this.handleBarTriggerKeydown(e,n))return;let r=ee({items:this.getBarItems(),current:n,key:e.key,orientation:"horizontal",wrap:!1});r.handled&&(e.preventDefault(),this.syncMenuToBarItem(r.item))}handleBarTriggerKeydown(e,n){if(e.key==="Escape")return this.openValue&&(e.preventDefault(),this.closeMenu(!0)),!0;let r=n.getAttribute("data-value");return!this.isBarTrigger(n)||!r?!1:e.key==="Enter"||e.key===" "?(e.preventDefault(),this.openPanel(r),!0):e.key!=="ArrowDown"?!1:(e.preventDefault(),this.openValue===r?this.focusPanelEntry(r):this.openPanel(r),!0)}syncMenuToBarItem(e){if(!this.openValue)return;let n=e.getAttribute("data-value");this.isBarTrigger(e)&&n?this.openPanel(n):this.closeMenu(!1)}onPanelKeydown(e){let n=e.target;if(!(n instanceof Element))return;let r=n.closest("[data-navigation-panel]");if(!r||r.hidden)return;let i=r.getAttribute("data-value");if(!i||this.openValue!==i)return;let a=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!a||!r.contains(a))return;if(e.key==="Escape"){e.preventDefault(),this.closeMenu(!0);return}let o=this.getPanelFocusables(r);if(e.key==="ArrowUp"&&a===o[0]){e.preventDefault(),this.getTrigger(i)?.focus();return}!o.length||!ee({items:o,current:a,key:e.key,orientation:"vertical",wrap:!1}).handled||e.preventDefault()}static{we()}};import{jsx as Se}from"@ecopages/jsx/jsx-runtime";function it(t,e,n){if(t!==void 0)return t;if(e)return n}function ot(t,e){if(typeof t=="function"){t(e);return}t!=null&&typeof t=="object"&&"handleEvent"in t&&t.handleEvent(e)}function ke(t){if(t.href!==void 0){let{href:M,target:_,rel:F,download:N,children:R,class:T,variant:L,size:q,square:l,...v}=t;return Se("a",{...v,href:M,target:_,rel:F,download:N,class:I("rui-button",`rui-button--${L??"filled"}`,`rui-button--${q??"md"}`,l&&"rui-button--square",T),children:R})}let{variant:e,size:n,square:r,class:i,children:a,type:o="button",disabled:s,pressed:u,defaultPressed:d=!1,toggle:m=!1,"on:click":w,...A}=t,H=M=>{if(m&&u===void 0){let _=M.currentTarget,F=_.getAttribute("aria-pressed")!=="true";_.setAttribute("aria-pressed",String(F))}ot(w,M)};return Se("button",{...A,type:o,class:I("rui-button",`rui-button--${e??"filled"}`,`rui-button--${n??"md"}`,r&&"rui-button--square",i),disabled:s,"aria-pressed":it(u,m,d),"data-toggle":m&&u===void 0?"":void 0,"on:click":m||w?H:void 0,children:a})}function at({children:t,class:e,...n}){return V("div",{...n,"data-ref":"bar",class:I("rui-navigation-menu__bar",e),children:t})}function st({children:t,class:e,...n}){return V("div",{...n,"data-ref":"panels",class:I("rui-navigation-menu__panels",e),children:t})}function ut({children:t,label:e,...n}){return V("rui-navigation-menu",{...n,label:e,children:V("nav",{class:"rui-navigation-menu","data-ref":"root","aria-label":e||void 0,children:t})})}function lt({children:t,value:e,variant:n="ghost",class:r,...i}){return V(ke,{...i,variant:n,class:r,"data-navigation-item":!0,"data-navigation-trigger":!0,"data-value":e,children:t})}function ct({children:t,href:e,class:n,...r}){return V("a",{...r,href:e,"data-navigation-item":!0,class:I("rui-button","rui-button--ghost","rui-button--md",n),children:t})}function ht({children:t,value:e,class:n,...r}){return V("div",{...r,class:I("rui-navigation-menu__panel","rui-popover","rui-floating",n),"data-navigation-panel":!0,"data-value":e,children:t})}export{Fe as NAVIGATION_MENU_DEFAULT_CLOSE_DELAY,He as NAVIGATION_MENU_DEFAULT_HOVER_DELAY,ut as RuiNavigationMenu,at as RuiNavigationMenuBar,Re as RuiNavigationMenuElement,ct as RuiNavigationMenuLink,ht as RuiNavigationMenuPanel,st as RuiNavigationMenuPanels,lt as RuiNavigationMenuTrigger};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|