@ecopages/radiant-ui 0.1.0-rc.8 → 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.
Files changed (196) hide show
  1. package/README.md +9 -1
  2. package/dist/components/ui/autocomplete/autocomplete.css +1 -2
  3. package/dist/components/ui/avatar/avatar.css +10 -8
  4. package/dist/components/ui/avatar/avatar.d.ts +3 -1
  5. package/dist/components/ui/calendar/calendar.css +10 -5
  6. package/dist/components/ui/calendar/calendar.script.d.ts +1 -0
  7. package/dist/components/ui/calendar/index.js +1 -1
  8. package/dist/components/ui/calendar/index.js.map +3 -3
  9. package/dist/components/ui/carousel/carousel-autoplay.d.ts +22 -0
  10. package/dist/components/ui/carousel/carousel-swipe.d.ts +17 -0
  11. package/dist/components/ui/carousel/carousel-window.d.ts +63 -0
  12. package/dist/components/ui/carousel/carousel.css +71 -18
  13. package/dist/components/ui/carousel/carousel.d.ts +1 -1
  14. package/dist/components/ui/carousel/carousel.script.d.ts +49 -21
  15. package/dist/components/ui/carousel/index.js +1 -1
  16. package/dist/components/ui/carousel/index.js.map +4 -4
  17. package/dist/components/ui/checkbox/checkbox.script.d.ts +0 -3
  18. package/dist/components/ui/checkbox/index.js +1 -1
  19. package/dist/components/ui/checkbox/index.js.map +4 -4
  20. package/dist/components/ui/checkbox-group/checkbox-group.d.ts +0 -1
  21. package/dist/components/ui/checkbox-group/checkbox-group.script.d.ts +8 -7
  22. package/dist/components/ui/checkbox-group/index.js +1 -1
  23. package/dist/components/ui/checkbox-group/index.js.map +4 -4
  24. package/dist/components/ui/combobox/combobox.css +2 -2
  25. package/dist/components/ui/combobox/combobox.d.ts +1 -2
  26. package/dist/components/ui/combobox/combobox.script.d.ts +13 -6
  27. package/dist/components/ui/combobox/index.js +1 -1
  28. package/dist/components/ui/combobox/index.js.map +4 -4
  29. package/dist/components/ui/cycle-toggle/index.js +1 -1
  30. package/dist/components/ui/cycle-toggle/index.js.map +3 -3
  31. package/dist/components/ui/date-field/date-field.css +13 -17
  32. package/dist/components/ui/date-field/date-field.d.ts +7 -5
  33. package/dist/components/ui/date-field/date-field.script.d.ts +16 -48
  34. package/dist/components/ui/date-field/index.js +1 -1
  35. package/dist/components/ui/date-field/index.js.map +4 -4
  36. package/dist/components/ui/date-input/date-input-segment-dom.d.ts +24 -0
  37. package/dist/components/ui/date-input/date-input.css +50 -0
  38. package/dist/components/ui/date-input/date-input.d.ts +8 -0
  39. package/dist/components/ui/date-input/date-input.script.d.ts +137 -0
  40. package/dist/components/ui/date-input/index.d.ts +2 -0
  41. package/dist/components/ui/date-input/index.js +2 -0
  42. package/dist/components/ui/date-input/index.js.map +7 -0
  43. package/dist/components/ui/date-range-picker/date-range-picker.css +18 -19
  44. package/dist/components/ui/date-range-picker/date-range-picker.d.ts +8 -6
  45. package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +24 -47
  46. package/dist/components/ui/date-range-picker/index.js +1 -1
  47. package/dist/components/ui/date-range-picker/index.js.map +4 -4
  48. package/dist/components/ui/dialog/dialog.css +18 -14
  49. package/dist/components/ui/dialog/dialog.script.d.ts +10 -3
  50. package/dist/components/ui/dialog/index.js +1 -1
  51. package/dist/components/ui/dialog/index.js.map +4 -4
  52. package/dist/components/ui/disclosure/disclosure.css +3 -6
  53. package/dist/components/ui/disclosure/disclosure.d.ts +15 -5
  54. package/dist/components/ui/disclosure/disclosure.script.d.ts +2 -2
  55. package/dist/components/ui/disclosure/index.d.ts +1 -1
  56. package/dist/components/ui/disclosure/index.js +1 -1
  57. package/dist/components/ui/disclosure/index.js.map +4 -4
  58. package/dist/components/ui/field/field.d.ts +1 -1
  59. package/dist/components/ui/field/field.script.d.ts +27 -4
  60. package/dist/components/ui/field/index.js +1 -1
  61. package/dist/components/ui/field/index.js.map +4 -4
  62. package/dist/components/ui/form/control-protocol.d.ts +38 -1
  63. package/dist/components/ui/form/form-context.d.ts +3 -0
  64. package/dist/components/ui/form/form.script.d.ts +7 -0
  65. package/dist/components/ui/form/index.d.ts +2 -1
  66. package/dist/components/ui/form/index.js +1 -1
  67. package/dist/components/ui/form/index.js.map +4 -4
  68. package/dist/components/ui/hover-card/hover-card.css +12 -101
  69. package/dist/components/ui/hover-card/hover-card.script.d.ts +7 -0
  70. package/dist/components/ui/hover-card/index.js +1 -1
  71. package/dist/components/ui/hover-card/index.js.map +4 -4
  72. package/dist/components/ui/input/index.js +1 -1
  73. package/dist/components/ui/input/index.js.map +4 -4
  74. package/dist/components/ui/input/input.css +1 -1
  75. package/dist/components/ui/knob/index.js +1 -1
  76. package/dist/components/ui/knob/index.js.map +3 -3
  77. package/dist/components/ui/knob/knob.css +6 -1
  78. package/dist/components/ui/knob/knob.d.ts +1 -1
  79. package/dist/components/ui/knob/knob.script.d.ts +25 -10
  80. package/dist/components/ui/label/index.js +1 -1
  81. package/dist/components/ui/label/index.js.map +4 -4
  82. package/dist/components/ui/listbox/index.js +1 -1
  83. package/dist/components/ui/listbox/index.js.map +4 -4
  84. package/dist/components/ui/listbox/listbox.d.ts +1 -2
  85. package/dist/components/ui/listbox/listbox.script.d.ts +7 -5
  86. package/dist/components/ui/menu-button/index.js +1 -1
  87. package/dist/components/ui/menu-button/index.js.map +4 -4
  88. package/dist/components/ui/menu-button/menu-button.script.d.ts +1 -1
  89. package/dist/components/ui/menubar/index.js +1 -1
  90. package/dist/components/ui/menubar/index.js.map +4 -4
  91. package/dist/components/ui/meter/index.js +1 -1
  92. package/dist/components/ui/meter/index.js.map +3 -3
  93. package/dist/components/ui/meter/meter.css +27 -2
  94. package/dist/components/ui/meter/meter.script.d.ts +14 -4
  95. package/dist/components/ui/navigation-menu/index.d.ts +1 -1
  96. package/dist/components/ui/navigation-menu/index.js +1 -1
  97. package/dist/components/ui/navigation-menu/index.js.map +4 -4
  98. package/dist/components/ui/navigation-menu/navigation-menu.css +32 -34
  99. package/dist/components/ui/navigation-menu/navigation-menu.d.ts +33 -4
  100. package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +71 -9
  101. package/dist/components/ui/number-field/index.js +1 -1
  102. package/dist/components/ui/number-field/index.js.map +4 -4
  103. package/dist/components/ui/number-field/number-field.css +1 -1
  104. package/dist/components/ui/number-field/number-field.d.ts +1 -1
  105. package/dist/components/ui/number-field/number-field.script.d.ts +7 -9
  106. package/dist/components/ui/pagination/index.d.ts +1 -1
  107. package/dist/components/ui/pagination/index.js +1 -1
  108. package/dist/components/ui/pagination/index.js.map +3 -3
  109. package/dist/components/ui/pagination/pagination.css +50 -13
  110. package/dist/components/ui/pagination/pagination.d.ts +25 -6
  111. package/dist/components/ui/popover/index.js +1 -1
  112. package/dist/components/ui/popover/index.js.map +4 -4
  113. package/dist/components/ui/popover/popover.script.d.ts +5 -0
  114. package/dist/components/ui/radio-group/index.js +1 -1
  115. package/dist/components/ui/radio-group/index.js.map +4 -4
  116. package/dist/components/ui/radio-group/radio-group.script.d.ts +2 -1
  117. package/dist/components/ui/select/index.d.ts +1 -1
  118. package/dist/components/ui/select/index.js +1 -1
  119. package/dist/components/ui/select/index.js.map +4 -4
  120. package/dist/components/ui/select/select.css +4 -3
  121. package/dist/components/ui/select/select.d.ts +7 -5
  122. package/dist/components/ui/select/select.script.d.ts +32 -12
  123. package/dist/components/ui/shared/calendar-popover-behavior.d.ts +27 -0
  124. package/dist/components/ui/shared/listbox-host-controller.d.ts +5 -4
  125. package/dist/components/ui/shared/multi-value.d.ts +18 -8
  126. package/dist/components/ui/shared/numeric-range.d.ts +8 -0
  127. package/dist/components/ui/shared/popover.css +10 -99
  128. package/dist/components/ui/sidebar/index.d.ts +2 -1
  129. package/dist/components/ui/sidebar/index.js +1 -1
  130. package/dist/components/ui/sidebar/index.js.map +4 -4
  131. package/dist/components/ui/sidebar/sidebar-trigger.d.ts +12 -0
  132. package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +42 -29
  133. package/dist/components/ui/sidebar/sidebar.css +67 -61
  134. package/dist/components/ui/sidebar/sidebar.d.ts +1 -7
  135. package/dist/components/ui/sidebar/sidebar.script.d.ts +12 -7
  136. package/dist/components/ui/slider/index.js +1 -1
  137. package/dist/components/ui/slider/index.js.map +4 -4
  138. package/dist/components/ui/slider/slider.css +5 -5
  139. package/dist/components/ui/slider/slider.d.ts +5 -6
  140. package/dist/components/ui/slider/slider.script.d.ts +72 -29
  141. package/dist/components/ui/switch/index.js +1 -1
  142. package/dist/components/ui/switch/index.js.map +4 -4
  143. package/dist/components/ui/switch/switch.css +28 -22
  144. package/dist/components/ui/switch/switch.script.d.ts +10 -3
  145. package/dist/components/ui/table/index.js +1 -1
  146. package/dist/components/ui/table/index.js.map +4 -4
  147. package/dist/components/ui/table/table.d.ts +5 -3
  148. package/dist/components/ui/table/table.script.d.ts +25 -10
  149. package/dist/components/ui/tabs/tabs.css +18 -12
  150. package/dist/components/ui/tabs/tabs.script.d.ts +7 -0
  151. package/dist/components/ui/tag-group/index.js +1 -1
  152. package/dist/components/ui/tag-group/index.js.map +4 -4
  153. package/dist/components/ui/tag-group/tag-group.d.ts +7 -4
  154. package/dist/components/ui/tag-group/tag-group.script.d.ts +7 -5
  155. package/dist/components/ui/textarea/index.js +1 -1
  156. package/dist/components/ui/textarea/index.js.map +4 -4
  157. package/dist/components/ui/textarea/textarea.css +1 -1
  158. package/dist/components/ui/toast/index.js +1 -1
  159. package/dist/components/ui/toast/index.js.map +3 -3
  160. package/dist/components/ui/toast/toast.css +35 -32
  161. package/dist/components/ui/toast/toast.script.d.ts +2 -1
  162. package/dist/components/ui/toast/toaster.script.d.ts +6 -0
  163. package/dist/components/ui/tooltip/index.js +1 -1
  164. package/dist/components/ui/tooltip/index.js.map +4 -4
  165. package/dist/components/ui/tooltip/tooltip.css +14 -94
  166. package/dist/components/ui/tooltip/tooltip.script.d.ts +9 -1
  167. package/dist/components/ui/window-splitter/index.d.ts +1 -1
  168. package/dist/components/ui/window-splitter/index.js +1 -1
  169. package/dist/components/ui/window-splitter/index.js.map +3 -3
  170. package/dist/components/ui/window-splitter/window-splitter.d.ts +1 -1
  171. package/dist/components/ui/window-splitter/window-splitter.script.d.ts +5 -1
  172. package/dist/index.d.ts +1 -0
  173. package/dist/index.js +1 -1
  174. package/dist/index.js.map +4 -4
  175. package/dist/lib/icons/chevron-down.d.ts +0 -1
  176. package/dist/lib/intl-date/index.d.ts +4 -2
  177. package/dist/lib/intl-date/segment-editing.d.ts +34 -0
  178. package/dist/lib/intl-date/segments.d.ts +26 -4
  179. package/dist/lib/non-empty.d.ts +6 -0
  180. package/dist/lib/unique-id.d.ts +11 -0
  181. package/dist/lib/viewport/breakpoints.d.ts +6 -0
  182. package/dist/lib/viewport/mobile-layout.d.ts +15 -0
  183. package/dist/styles/primitives.css +10 -7
  184. package/dist/styles/radiant-ui-core.css +10 -0
  185. package/dist/styles/radiant-ui.css +40 -3
  186. package/dist/styles/style-dependencies.json +18 -6
  187. package/dist/styles/styles.css +456 -246
  188. package/dist/styles/tailwind.css +40 -93
  189. package/dist/styles/tokens/presets/colors/aurora.css +2 -0
  190. package/dist/styles/tokens/presets/colors/basalt.css +2 -0
  191. package/dist/styles/tokens/presets/colors/ember.css +2 -0
  192. package/dist/styles/tokens/presets/colors/glacier.css +2 -0
  193. package/dist/styles/tokens/semantic.css +1 -0
  194. package/dist/styles/tokens/system.css +11 -3
  195. package/dist/styles/tokens/typography/default.css +8 -0
  196. package/package.json +20 -10
@@ -13,7 +13,6 @@ rui-select {
13
13
  }
14
14
  .rui-select__control {
15
15
  display: flex;
16
- min-height: calc(var(--spacing, 0.25rem) * 10);
17
16
  width: 100%;
18
17
  min-width: 0px;
19
18
  align-items: center;
@@ -24,6 +23,7 @@ rui-select {
24
23
  border-color: var(--color-border, var(--border));
25
24
  background-color: var(--color-background, var(--background));
26
25
  padding-inline: var(--spacing-1, var(--space-1));
26
+ min-height: var(--size-control-md);
27
27
  }
28
28
  .rui-select__control:focus-within {
29
29
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
@@ -47,9 +47,9 @@ rui-select {
47
47
  color: var(--color-on-background, var(--on-background));
48
48
  --tw-outline-style: none;
49
49
  outline-style: none;
50
- font-size: var(--text-control, 0.875rem);
50
+ font-size: var(--text-control-input);
51
51
  }
52
- .rui-select__trigger:disabled {
52
+ .rui-select__trigger[aria-disabled='true'] {
53
53
  cursor: not-allowed;
54
54
  opacity: var(--opacity-muted, var(--opacity-muted));
55
55
  }
@@ -90,6 +90,7 @@ rui-select {
90
90
  color: var(--color-on-background, var(--on-background));
91
91
  --tw-outline-style: none;
92
92
  outline-style: none;
93
+ font-size: var(--text-control-input);
93
94
  }
94
95
  .rui-select__search:focus-visible {
95
96
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
@@ -9,13 +9,16 @@ export type RuiSelectControlProps = JsxElementProps<HTMLDivElement>;
9
9
  * @cssclass rui-select__control - Trigger row; bordered, control-height surface.
10
10
  */
11
11
  export declare function RuiSelectControl({ children, class: className, ...props }: RuiSelectControlProps): JsxRenderable;
12
- export type RuiSelectTriggerProps = JsxElementProps<HTMLButtonElement> & {
12
+ export type RuiSelectTriggerProps = JsxElementProps<HTMLDivElement> & {
13
13
  disabled?: boolean;
14
14
  };
15
15
  /**
16
- * Value button. Stamps `[data-select-trigger]`. Place `RuiSelectValue` inside.
16
+ * Combobox surface. Stamps `[data-select-trigger]`. Place `RuiSelectValue` inside.
17
17
  *
18
- * @cssclass rui-select__trigger - Value button; `role="combobox"` set by the controller.
18
+ * @remarks A native `<button>` cannot wrap multi-select chip remove controls
19
+ * (`<button>` in `<button>`). The host sets `role="combobox"`.
20
+ *
21
+ * @cssclass rui-select__trigger - Combobox surface; `role="combobox"` set by the controller.
19
22
  */
20
23
  export declare function RuiSelectTrigger({ children, class: className, disabled, ...props }: RuiSelectTriggerProps): JsxRenderable;
21
24
  export type RuiSelectToggleProps = JsxElementProps<HTMLButtonElement> & {
@@ -63,8 +66,7 @@ export type RuiSelectOptionData = RuiListboxOptionData;
63
66
  * Select view. Wraps children in `[data-ref="root"]`. Pass `options` for the
64
67
  * simple API, or compose `RuiSelect*` children.
65
68
  */
66
- export type RuiSelectViewProps = JsxCustomElementAttributes<RuiSelectElement, Omit<RuiSelectProps, 'value'> & {
69
+ export type RuiSelectViewProps = JsxCustomElementAttributes<RuiSelectElement, RuiSelectProps & {
67
70
  options?: RuiSelectOptionData[];
68
- value?: string | string[];
69
71
  }>;
70
72
  export declare function RuiSelect({ options, children, value, ...props }: RuiSelectViewProps): JsxRenderable;
@@ -1,8 +1,10 @@
1
1
  import { RadiantElement } from '@ecopages/radiant';
2
2
  import type { EventEmitter } from '@ecopages/radiant/tools/event-emitter';
3
+ import { type ViewMultiValue } from '../shared/multi-value';
3
4
  export type RuiSelectSelectionMode = 'single' | 'multiple';
5
+ export type RuiSelectTriggerKind = 'focus' | 'manual';
4
6
  export type RuiSelectProps = {
5
- value?: string;
7
+ value?: ViewMultiValue;
6
8
  /** Accessible name when there is no visible `RuiLabel` associated with the trigger. */
7
9
  label?: string;
8
10
  placeholder?: string;
@@ -13,9 +15,14 @@ export type RuiSelectProps = {
13
15
  * Defaults to false for multiple and true for single.
14
16
  */
15
17
  shouldCloseOnSelect?: boolean;
18
+ /**
19
+ * Controls what opens the listbox. `focus` opens when the trigger receives focus;
20
+ * `manual` requires a click, the toggle, or arrow keys (the default).
21
+ */
22
+ triggerKind?: RuiSelectTriggerKind;
16
23
  };
17
24
  export type RuiSelectChangeDetail = {
18
- value: string;
25
+ value: string[];
19
26
  };
20
27
  /**
21
28
  * `<rui-select>` — a select-only combobox with a button trigger and listbox popup.
@@ -32,9 +39,11 @@ export type RuiSelectChangeDetail = {
32
39
  *
33
40
  * Required:
34
41
  * - `[data-ref="root"]` — shell for popover anchoring.
35
- * - `[data-select-trigger]` — value button. Host sets `id`, `role="combobox"`,
36
- * `aria-haspopup="listbox"`, `aria-autocomplete="none"`, `aria-expanded`,
37
- * `aria-controls`, and `disabled`.
42
+ * - `[data-select-trigger]` — combobox surface (a `div`, not a native button).
43
+ * Host sets `id`, `role="combobox"`, `aria-haspopup="listbox"`,
44
+ * `aria-autocomplete="none"`, `aria-expanded`, `aria-controls`, `tabIndex`,
45
+ * and `aria-disabled`. Do not use a `<button>` here: multi-select chips include
46
+ * remove buttons, and `<button>` in `<button>` aborts HTML parsing.
38
47
  * - `[data-select-value]` — selected value inside the trigger. Host sets
39
48
  * `data-placeholder` when empty and may inject `[data-select-placeholder]`.
40
49
  * - `[data-select-listbox]` — popup shell. Host toggles `hidden`.
@@ -49,8 +58,9 @@ export type RuiSelectChangeDetail = {
49
58
  * - `[data-autocomplete-input]` — search field inside the listbox. When the popup
50
59
  * is open the host moves `role="combobox"` and related `aria-*` to this input.
51
60
  *
52
- * Do not set `role`, `aria-expanded`, `aria-controls`, `aria-haspopup`, or
53
- * `tabIndex` on the trigger — the host owns those.
61
+ * Do not set `role`, `aria-expanded`, `aria-controls`, or `aria-haspopup` on
62
+ * the trigger — the host owns those. The trigger must be a `div`, not a
63
+ * `<button>`: multi-select chips render remove buttons inside it.
54
64
  *
55
65
  * Nested hosts:
56
66
  * - `rui-listbox` (`embedded`) — options at `[role="option"]`; host drives
@@ -61,26 +71,30 @@ export type RuiSelectChangeDetail = {
61
71
  *
62
72
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
63
73
  * @element rui-select
64
- * @attr {string} value - Comma-separated selected values.
74
+ * @attr {string} value - Comma-separated selected values in markup; the property is `string[]`. Default: `[]`.
65
75
  * @attr {string} label - Accessible name when there is no associated `RuiLabel`.
66
76
  * @attr {string} placeholder - Shown when nothing is selected.
67
77
  * @attr {boolean} disabled - Disable the trigger and popup. Default: `false`.
68
78
  * @attr {('single'|'multiple')} selection-mode - Single or multi-select. Default: `single`.
69
79
  * @attr {boolean} should-close-on-select - Whether selecting closes the popup (defaults to `true` for single, `false` for multiple).
70
- * @fires rui-change - Emitted when the selected `value` changes; `detail.value` is comma-separated.
80
+ * @attr {('focus'|'manual')} trigger-kind - Controls what opens the listbox. Default: `manual`.
81
+ * @fires rui-change - Emitted when the selected `value` changes; `detail.value` is `string[]`.
71
82
  *
72
83
  * @remarks
73
84
  * Minimum tree: `[data-ref="root"]` > `[data-select-trigger]` > `[data-select-value]`,
74
85
  * sibling `[data-select-listbox]` > `rui-listbox[embedded]` > `[role="option"]`.
75
86
  * BEM classes live on the view helpers; the host never queries them.
87
+ * Not form-associated: wrap in `rui-field` and read `RuiForm` `onSubmit`.
88
+ * The selected value does not appear in native `FormData`.
76
89
  */
77
90
  export declare class RuiSelect extends RadiantElement {
78
- value: string;
91
+ value: string[];
79
92
  label: string;
80
93
  placeholder: string;
81
94
  disabled: boolean;
82
95
  selectionMode: RuiSelectSelectionMode;
83
96
  shouldCloseOnSelect: boolean | undefined;
97
+ triggerKind: RuiSelectTriggerKind;
84
98
  changeEvent: EventEmitter<RuiSelectChangeDetail>;
85
99
  private open;
86
100
  private readonly uid;
@@ -104,15 +118,14 @@ export declare class RuiSelect extends RadiantElement {
104
118
  private removeSelectedValue;
105
119
  private clearSelection;
106
120
  private getTrigger;
121
+ private isTriggerFocusTarget;
107
122
  private getToggle;
108
- private getClear;
109
123
  private getValueElement;
110
124
  private getListboxPopup;
111
125
  private ensureOptionIds;
112
126
  private getAccessibleName;
113
127
  private syncLabel;
114
128
  private syncTrigger;
115
- private syncClear;
116
129
  private syncToggle;
117
130
  private syncValueDisplay;
118
131
  private setOpen;
@@ -123,6 +136,7 @@ export declare class RuiSelect extends RadiantElement {
123
136
  protected onConnected(): void;
124
137
  disconnectedCallback(): void;
125
138
  onPropsUpdated(): void;
139
+ onTriggerPointerDown(event: PointerEvent): void;
126
140
  onTriggerClick(event: Event): void;
127
141
  onTriggerKeydown(event: KeyboardEvent): void;
128
142
  onSearchKeydown(event: KeyboardEvent): void;
@@ -133,6 +147,12 @@ export declare class RuiSelect extends RadiantElement {
133
147
  onOptionPointerOver(event: Event): void;
134
148
  onOptionMouseDown(event: Event): void;
135
149
  onOptionClick(event: Event): void;
150
+ /**
151
+ * @remarks With `trigger-kind="focus"`, only focus arriving from outside the host
152
+ * opens the listbox. Focus the host moves back itself (option select, clear,
153
+ * toggle, search input) comes from a descendant and never reopens it.
154
+ */
155
+ onRootFocusIn(event: FocusEvent): void;
136
156
  onFocusOut(event: FocusEvent): void;
137
157
  onDocumentPointerDown(event: PointerEvent): void;
138
158
  }
@@ -0,0 +1,27 @@
1
+ export type CalendarPopoverBehaviorConfig = {
2
+ getHost: () => HTMLElement;
3
+ getAnchor: () => HTMLElement | null;
4
+ getFloating: () => HTMLElement | null;
5
+ getOpen: () => boolean;
6
+ getCalendar: () => HTMLElement | null;
7
+ getFocusIso: () => string | undefined;
8
+ };
9
+ /**
10
+ * Shared popover positioning and dismissal for calendar-backed date pickers.
11
+ *
12
+ * @remarks Date-field and date-range-picker keep value commit and selection mode local.
13
+ */
14
+ export declare class CalendarPopoverBehavior {
15
+ private readonly config;
16
+ private popoverController;
17
+ private suppressPopoverDismiss;
18
+ constructor(config: CalendarPopoverBehaviorConfig);
19
+ destroy(): void;
20
+ suppressDismiss(): void;
21
+ syncPopover(): void;
22
+ focusCalendarDay(): void;
23
+ handleFocusOut(event: FocusEvent, onClose: () => void): void;
24
+ private ensureController;
25
+ }
26
+ /** Focus the calendar's selected day, or the roving tabindex day, or the first available day. */
27
+ export declare function focusCalendarPickerDay(calendar: HTMLElement | null, iso?: string): void;
@@ -3,8 +3,8 @@ import type { RuiTagGroup } from '../tag-group/tag-group.script';
3
3
  export type ListboxHostControllerConfig = {
4
4
  getRoot: () => ParentNode | null;
5
5
  getSelectionMode: () => RuiListboxSelectionMode;
6
- getValue: () => string;
7
- setValue: (value: string) => void;
6
+ getValue: () => string[];
7
+ setValue: (value: string[]) => void;
8
8
  /** Popup shell used when no `rui-listbox` host is present. */
9
9
  getPopup?: () => HTMLElement | null;
10
10
  /** Selector for an optional chip host, e.g. `[data-select-value] rui-tag-group`. */
@@ -15,8 +15,9 @@ export type ListboxHostControllerConfig = {
15
15
  *
16
16
  * @remarks Popup open state, filtering, and trigger-kind policy stay on the
17
17
  * owning custom element. This controller owns the contract both hosts must
18
- * agree on: the embedded listbox, the comma-separated value array, option
19
- * `aria-selected`, and optional tag-group chips.
18
+ * agree on: the embedded listbox, the `string[]` value property, option
19
+ * `aria-selected`, and optional tag-group chips. The comma-separated attribute
20
+ * protocol is handled by `multiValueTransform` on each host.
20
21
  */
21
22
  export declare class ListboxHostController {
22
23
  private readonly config;
@@ -1,16 +1,26 @@
1
+ import type { PropTransform } from '@ecopages/radiant';
1
2
  /** Parses the comma-separated value protocol used by multi-select controls. */
2
3
  export declare function parseMultiValue(value: string | null | undefined): string[];
3
4
  /** Serializes multi-select values into the public custom-element value protocol. */
4
5
  export declare function serializeMultiValue(values: readonly string[]): string;
6
+ /** `@prop` transform for comma-separated multi-value host attributes. */
7
+ export declare const multiValueTransform: PropTransform<string[]>;
8
+ /** Shared `@prop` options for comma-separated `string[]` host values. */
9
+ export declare const multiValuePropOptions: {
10
+ readonly type: ArrayConstructor;
11
+ readonly reflect: true;
12
+ readonly transform: PropTransform<string[]>;
13
+ };
5
14
  /**
6
- * View-level `value` accepted by listbox, select, combobox, and checkbox-group.
7
- *
8
- * @remarks The host attribute is always a comma-separated string. JSX may pass
9
- * a string or a `string[]`; commas in the host attribute are delimiters, not
10
- * literal characters inside a token.
15
+ * JSX / view `value` accepted by listbox, select, combobox, checkbox-group,
16
+ * tag-group, and table. The live host property is always `string[]`.
11
17
  */
12
18
  export type ViewMultiValue = string | readonly string[] | undefined;
13
- /** Converts a view `value` into the host attribute protocol. */
14
- export declare function serializeViewValue(value: ViewMultiValue): string | undefined;
15
- /** Reads a view `value` as the selected-token array. */
19
+ /** Reads a view `value` as the selected-token array for SSR of selected children. */
16
20
  export declare function parseViewValue(value: ViewMultiValue): string[];
21
+ /** `@prop` transform for comma-separated numeric host attributes (e.g. slider). */
22
+ export declare const numberArrayTransform: PropTransform<number[]>;
23
+ /**
24
+ * JSX / view `value` accepted by slider. The live host property is always `number[]`.
25
+ */
26
+ export type ViewNumericValue = number | readonly number[] | undefined;
@@ -25,6 +25,14 @@ export declare function fractionDigitsFromStep(step: number): number;
25
25
  export declare function resolveValuePrecision(step: number, valuePrecision: number | undefined): number;
26
26
  /** Formats a numeric value for readouts, tooltips, and `aria-valuetext`. */
27
27
  export declare function formatNumericValue(value: number, valuePrecision: number): string;
28
+ /**
29
+ * Whether two values sit on the same step tick after binary rounding.
30
+ *
31
+ * @remarks IEEE-754 noise can make `clamp(x) !== x` even when both stringify to
32
+ * the same step. Writing the clamped number back into a reflected `value`
33
+ * attribute then oscillates forever (`0.3` ↔ `0.30000000000000004`).
34
+ */
35
+ export declare function valuesAlignOnStep(left: number, right: number, step: number): boolean;
28
36
  /** Normalizes numeric-control bounds and step values into a stable interaction model. */
29
37
  export declare function createNumericRange(min: number, max: number, step: number): NumericRange;
30
38
  /**
@@ -1,16 +1,18 @@
1
1
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
- @layer properties;
3
2
  @layer components {
4
3
  .rui-popover {
4
+ --rui-popover-radius: var(--radius-container);
5
+ --rui-popover-surface: var(--background);
6
+ --rui-popover-border-color: var(--border);
7
+ --rui-popover-shadow: var(--shadow-overlay);
5
8
  z-index: var(--z-index-popover, var(--z-popover));
6
9
  overflow: auto;
7
- border-radius: var(--radius-container, var(--radius-container));
8
- border-style: var(--tw-border-style);
9
- border-width: 1px;
10
- border-color: var(--color-border, var(--border));
11
- background-color: var(--color-background, var(--background));
12
- --tw-shadow: var(--shadow-overlay);
13
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
10
+ max-height: var(--rui-popover-max-height, calc(100dvh - 1rem));
11
+ max-width: var(--rui-popover-max-width, calc(100vw - 1rem));
12
+ border-radius: var(--rui-popover-radius);
13
+ border: 1px solid var(--rui-popover-border-color);
14
+ background-color: var(--rui-popover-surface);
15
+ box-shadow: var(--rui-popover-shadow);
14
16
  }
15
17
  .rui-popover--listbox {
16
18
  display: flex;
@@ -26,94 +28,3 @@
26
28
  display: inline-flex;
27
29
  }
28
30
  }
29
- @property --tw-border-style {
30
- syntax: "*";
31
- inherits: false;
32
- initial-value: solid;
33
- }
34
- @property --tw-shadow {
35
- syntax: "*";
36
- inherits: false;
37
- initial-value: 0 0 #0000;
38
- }
39
- @property --tw-shadow-color {
40
- syntax: "*";
41
- inherits: false;
42
- }
43
- @property --tw-shadow-alpha {
44
- syntax: "<percentage>";
45
- inherits: false;
46
- initial-value: 100%;
47
- }
48
- @property --tw-inset-shadow {
49
- syntax: "*";
50
- inherits: false;
51
- initial-value: 0 0 #0000;
52
- }
53
- @property --tw-inset-shadow-color {
54
- syntax: "*";
55
- inherits: false;
56
- }
57
- @property --tw-inset-shadow-alpha {
58
- syntax: "<percentage>";
59
- inherits: false;
60
- initial-value: 100%;
61
- }
62
- @property --tw-ring-color {
63
- syntax: "*";
64
- inherits: false;
65
- }
66
- @property --tw-ring-shadow {
67
- syntax: "*";
68
- inherits: false;
69
- initial-value: 0 0 #0000;
70
- }
71
- @property --tw-inset-ring-color {
72
- syntax: "*";
73
- inherits: false;
74
- }
75
- @property --tw-inset-ring-shadow {
76
- syntax: "*";
77
- inherits: false;
78
- initial-value: 0 0 #0000;
79
- }
80
- @property --tw-ring-inset {
81
- syntax: "*";
82
- inherits: false;
83
- }
84
- @property --tw-ring-offset-width {
85
- syntax: "<length>";
86
- inherits: false;
87
- initial-value: 0px;
88
- }
89
- @property --tw-ring-offset-color {
90
- syntax: "*";
91
- inherits: false;
92
- initial-value: #fff;
93
- }
94
- @property --tw-ring-offset-shadow {
95
- syntax: "*";
96
- inherits: false;
97
- initial-value: 0 0 #0000;
98
- }
99
- @layer properties {
100
- @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
101
- *, ::before, ::after, ::backdrop {
102
- --tw-border-style: solid;
103
- --tw-shadow: 0 0 #0000;
104
- --tw-shadow-color: initial;
105
- --tw-shadow-alpha: 100%;
106
- --tw-inset-shadow: 0 0 #0000;
107
- --tw-inset-shadow-color: initial;
108
- --tw-inset-shadow-alpha: 100%;
109
- --tw-ring-color: initial;
110
- --tw-ring-shadow: 0 0 #0000;
111
- --tw-inset-ring-color: initial;
112
- --tw-inset-ring-shadow: 0 0 #0000;
113
- --tw-ring-inset: initial;
114
- --tw-ring-offset-width: 0px;
115
- --tw-ring-offset-color: #fff;
116
- --tw-ring-offset-shadow: 0 0 #0000;
117
- }
118
- }
119
- }
@@ -1,3 +1,4 @@
1
1
  export { RuiSidebar as RuiSidebarElement, type RuiSidebarProps, type RuiSidebarVariant, type RuiSidebarSide, type RuiSidebarCollapsible, type RuiSidebarState, type RuiSidebarMatchMode, type RuiSidebarToggleDetail, type RuiSidebarResizeDetail, } from './sidebar.script';
2
2
  export { RuiSidebarTrigger as RuiSidebarTriggerElement, type RuiSidebarTriggerProps, type RuiSidebarTriggerPlacement, } from './sidebar-trigger.script';
3
- export { RuiSidebar, RuiSidebarTrigger, RuiSidebarProvider, RuiSidebarHeader, RuiSidebarContent, RuiSidebarFooter, RuiSidebarSeparator, RuiSidebarGroup, RuiSidebarGroupLabel, RuiSidebarGroupAction, RuiSidebarGroupHeader, RuiSidebarMenu, RuiSidebarMenuItem, RuiSidebarMenuButton, RuiSidebarMenuAction, RuiSidebarInset, type RuiSidebarProviderProps, type RuiSidebarHeaderProps, type RuiSidebarContentProps, type RuiSidebarFooterProps, type RuiSidebarSeparatorProps, type RuiSidebarGroupProps, type RuiSidebarGroupLabelProps, type RuiSidebarGroupActionProps, type RuiSidebarGroupHeaderProps, type RuiSidebarMenuProps, type RuiSidebarMenuItemProps, type RuiSidebarMenuButtonControlProps, type RuiSidebarMenuButtonLinkProps, type RuiSidebarMenuButtonProps, type RuiSidebarMenuActionProps, type RuiSidebarInsetProps, type RuiSidebarViewProps, type RuiSidebarTriggerViewProps, } from './sidebar';
3
+ export { RuiSidebarTrigger, type RuiSidebarTriggerViewProps } from './sidebar-trigger';
4
+ export { RuiSidebar, RuiSidebarProvider, RuiSidebarHeader, RuiSidebarContent, RuiSidebarFooter, RuiSidebarSeparator, RuiSidebarGroup, RuiSidebarGroupLabel, RuiSidebarGroupAction, RuiSidebarGroupHeader, RuiSidebarMenu, RuiSidebarMenuItem, RuiSidebarMenuButton, RuiSidebarMenuAction, RuiSidebarInset, type RuiSidebarProviderProps, type RuiSidebarHeaderProps, type RuiSidebarContentProps, type RuiSidebarFooterProps, type RuiSidebarSeparatorProps, type RuiSidebarGroupProps, type RuiSidebarGroupLabelProps, type RuiSidebarGroupActionProps, type RuiSidebarGroupHeaderProps, type RuiSidebarMenuProps, type RuiSidebarMenuItemProps, type RuiSidebarMenuButtonControlProps, type RuiSidebarMenuButtonLinkProps, type RuiSidebarMenuButtonProps, type RuiSidebarMenuActionProps, type RuiSidebarInsetProps, type RuiSidebarViewProps, } from './sidebar';
@@ -1,2 +1,2 @@
1
- import{RadiantElement as fe,bound as me,customElement as Ye,event as ct,onEvent as st,onUpdated as ht,prop as x,query as lt,state as Xe}from"@ecopages/radiant";import{isServer as Je}from"@ecopages/radiant/is-server";function ft(i){return i.split(",").map(t=>t.trim()).filter(t=>t.length>0)}var mt,gt,_t,vt,yt,St,wt,At,Mt,xt,Et,kt,Lt,Tt,Rt,Ct,Wt,Ot,Dt,zt,Bt,Pt,It,jt,Ut,Vt,Kt,Ht,Qt,$t,qt,Gt,Ft,Yt,Xt,Jt,Nt,Zt,te,ee,ie,re,ne,ae,se,oe,le,de,ue,ce,he,pe;function $e(i,t,e,r,c,m){var f,n,R,E,v,B,L,V=Symbol.metadata||Symbol.for("Symbol.metadata"),H=Object.defineProperty,D=Object.create,Q=[D(null),D(null)],K=t.length;function C(a,g,p){return function(s,o){g&&(o=s,s=i);for(var _=0;_<a.length;_++)o=a[_].apply(s,p?[o]:[]);return p?o:s}}function y(a,g,p,s){if(typeof a!="function"&&(s||a!==void 0))throw new TypeError(g+" must "+(p||"be")+" a function"+(s?"":" or undefined"));return a}function $(a,g,p,s,o,_,k,b,S,w,N){function G(u){if(!N(u))throw new TypeError("Attempted to access private element on non-instance")}var F=[].concat(g[0]),Z=g[3],Y=!k,W=o===1,tt=o===3,et=o===4,P=o===2;function I(u,T,nt){return function(U,at){return T&&(at=U,U=a),nt&&nt(U),d[u].call(U,at)}}if(!Y){var d={},X=[],M=tt?"get":et||W?"set":"value";if(S?(w||W?d={get:be(function(){return Z(this)},s,"get"),set:function(u){g[4](this,u)}}:d[M]=Z,w||be(d[M],s,P?"":M)):w||(d=Object.getOwnPropertyDescriptor(a,s)),!w&&!S){if((n=Q[+b][s])&&(n^o)!==7)throw Error("Decorating two elements with the same name ("+d[M].name+") is not supported yet");Q[+b][s]=o<3?1:o}}for(var h=a,j=F.length-1;j>=0;j-=p?2:1){var it=y(F[j],"A decorator","be",!0),rt=p?F[j-1]:void 0,J={},O={kind:["field","accessor","method","getter","setter","class"][o],name:s,metadata:f,addInitializer:function(u,T){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");y(T,"An initializer","be",!0),_.push(T)}.bind(null,J)};if(Y)n=it.call(rt,h,O),J.v=1,y(n,"class decorators","return")&&(h=n);else if(O.static=b,O.private=S,n=O.access={has:S?N.bind():function(u){return s in u}},et||(n.get=S?P?function(u){return G(u),d.value}:I("get",0,G):function(u){return u[s]}),P||tt||(n.set=S?I("set",0,G):function(u,T){u[s]=T}),h=it.call(rt,W?{get:d.get,set:d.set}:d[M],O),J.v=1,W){if(typeof h=="object"&&h)(n=y(h.get,"accessor.get"))&&(d.get=n),(n=y(h.set,"accessor.set"))&&(d.set=n),(n=y(h.init,"accessor.init"))&&X.unshift(n);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else y(h,(w?"field":"method")+" decorators","return")&&(w?X.unshift(h):d[M]=h)}return o<2&&k.push(C(X,b,1),C(_,b,0)),w||Y||(S?W?k.splice(-1,0,I("get",b),I("set",b)):k.push(P?d[M]:y.call.bind(d[M])):H(a,s,d)),h}function q(a){return H(a,V,{configurable:!0,enumerable:!0,value:f})}return m!==void 0&&(f=m[V]),f=D(f??null),v=[],B=function(a){a&&v.push(C(a))},L=function(a,g){for(var p=0;p<e.length;p++){var s=e[p],o=s[1],_=7&o;if((8&o)==a&&!_==g){var k=s[2],b=!!s[3],S=16&o;$(a?i:i.prototype,s,S,b?"#"+k:qe(k),_,_<2?[]:a?E=E||[]:R=R||[],v,!!a,b,g,a&&b?function(w){return Fe(w)===i}:c)}}},L(8,0),L(0,0),L(8,1),L(0,1),B(R),B(E),n=v,K||q(i),{e:n,get c(){var a=[];return K&&[q(i=$(i,[t],r,i.name,5,a)),C(a,1)]}}}function qe(i){var t=Ge(i,"string");return typeof t=="symbol"?t:t+""}function Ge(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var r=e.call(i,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function be(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function Fe(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}var Ne=256,Ze=48,ti=200,ei=480,ii=768,ri="b",ge=8,_e=32,ve='[data-ref="menu-button"]';function ni(i){return i.metaKey||i.ctrlKey}function ai(){return typeof window<"u"&&typeof window.matchMedia=="function"}function dt(i){return i==="left"||i==="right"}var Se,ye=class extends fe{static{({e:[_t,vt,yt,St,wt,At,Mt,xt,Et,kt,Lt,Tt,Rt,Ct,Wt,Ot,Dt,zt,Bt,Pt,It,jt,Ut,Vt,Kt,Ht,Qt,$t,qt,Gt,Ft,Yt,Xt,Jt,Nt,Zt,te,ee,ie,re,ne,ae,se,oe,le,de,ue,ce,he,pe,mt],c:[Se,gt]}=$e(this,[Ye("rui-sidebar")],[[x({type:String,reflect:!0,defaultValue:"sidebar"}),0,"variant"],[x({type:String,reflect:!0,defaultValue:"left"}),0,"side"],[x({type:String,reflect:!0,defaultValue:"off"}),0,"collapsible"],[x({type:Number,defaultValue:Ne}),0,"defaultWidth"],[x({type:Number,reflect:!0,attribute:"width"}),0,"width"],[x({type:Number,defaultValue:ti}),0,"minWidth"],[x({type:Number,defaultValue:ei}),0,"maxWidth"],[x({type:Boolean,defaultValue:!1}),0,"resizable"],[x({type:Boolean,defaultValue:!0}),0,"defaultOpen"],[x({type:Boolean,defaultValue:!1}),0,"mobileDefaultOpen"],[x({type:Boolean,attribute:"open"}),0,"open"],[x({type:Number,defaultValue:ii}),0,"mobileBreakpoint"],[x({type:String,defaultValue:"Sidebar"}),0,"label"],[x({type:Boolean,reflect:!0,attribute:"match-active"}),0,"matchActive"],[x({type:String,defaultValue:"pathname"}),0,"matchMode"],[x({type:Boolean,attribute:"scroll-active-on-mount"}),0,"scrollActiveOnMount"],[x({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[lt({ref:"root"}),0,"rootTarget"],[lt({ref:"pane"}),0,"paneTarget"],[lt({ref:"handle"}),0,"handleTarget"],[lt({ref:"scrim"}),0,"scrimTarget"],[ct({name:"rui-sidebar-toggle",bubbles:!0,composed:!0}),0,"toggleEvent"],[ct({name:"rui-sidebar-resize",bubbles:!0,composed:!0}),0,"resizeEvent"],[ct({name:"rui-sidebar-mobile-change",bubbles:!0,composed:!0}),0,"mobileChangeEvent"],[Xe,0,"isMobile"],[ht(["open","collapsible","variant","side","width","defaultWidth","defaultOpen","minWidth","maxWidth","isMobile","resizable","label"]),2,"onStateUpdated"],[ht(["mobileBreakpoint"]),2,"onMobileBreakpointUpdated"],[ht(["matchActive","matchMode","navigationEvents"]),2,"onMatchSettingsUpdated"],[me,2,"onPointerMove"],[me,2,"onPointerUp"],[st({ref:"handle",type:"pointerdown"}),2,"onHandlePointerDown"],[st({ref:"handle",type:"keydown"}),2,"onHandleKeydown"],[st({ref:"scrim",type:"click"}),2,"onScrimClick"],[st({selector:ve,type:"click"}),2,"onMenuLinkClick"],[st({document:!0,type:"keydown"}),2,"onHostKeydown"]],0,void 0,fe))}variant=(mt(this),_t(this));side=(vt(this),yt(this));collapsible=(St(this),wt(this));defaultWidth=(At(this),Mt(this));width=(xt(this),Et(this));minWidth=(kt(this),Lt(this));maxWidth=(Tt(this),Rt(this));resizable=(Ct(this),Wt(this));defaultOpen=(Ot(this),Dt(this));mobileDefaultOpen=(zt(this),Bt(this));open=(Pt(this),It(this));mobileBreakpoint=(jt(this),Ut(this));label=(Vt(this),Kt(this));matchActive=(Ht(this),Qt(this,!1));matchMode=($t(this),qt(this));scrollActiveOnMount=(Gt(this),Ft(this,!1));navigationEvents=(Yt(this),Xt(this,""));rootTarget=(Jt(this),Nt(this));paneTarget=(Zt(this),te(this));handleTarget=(ee(this),ie(this));scrimTarget=(re(this),ne(this));toggleEvent=(ae(this),se(this));resizeEvent=(oe(this),le(this));mobileChangeEvent=(de(this),ue(this));isMobile=(ce(this),he(this,!1));mediaQuery=(pe(this),null);mediaListener=t=>this.setMobile(t.matches);dragging=!1;dragStartCoord=0;dragStartSize=0;navigationCleanups=[];didScrollActiveOnMount=!1;openControlled=!1;mobileReady=!1;connectedCallback(){super.connectedCallback(),this.ensureWidthInitialized(),this.setAttribute("role","complementary"),this.setAttribute("aria-label",this.label),this.syncPresentation(),this.attachNavigationListeners()}onConnected(){this.ensureWidthInitialized(),this.openControlled=this.open!==void 0,this.bindMobileMediaQuery(),this.openControlled||(this.open=this.isMobile?this.mobileDefaultOpen:this.defaultOpen),this.syncPresentation(),this.syncPaneWidthVar(),this.syncActiveLinksAfterRender(!0),this.mobileReady=!0}hydrate(){super.hydrate(),this.syncActiveLinksAfterRender(!0)}update(){super.update(),this.syncActiveLinksAfterRender(!1)}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>{this.syncActiveLinksAfterRender(!1)})}disconnectedCallback(){this.endDrag(),this.unbindMobileMediaQuery(),this.detachNavigationListeners(),this.mobileReady=!1,super.disconnectedCallback()}syncActiveLinksAfterRender(t){let e=t&&this.scrollActiveOnMount&&!this.didScrollActiveOnMount;this.syncActiveLinks(e),e&&(this.didScrollActiveOnMount=!0)}syncPresentation(){let t=dt(this.side),e=this.isOpen(),r=e?"expanded":"collapsed",c=this.resizable&&this.collapsible==="off"&&e&&!this.isMobile,m=!(e||!this.isMobile&&this.collapsible==="icon"),f=this.paneWidth();this.setAttribute("data-state",r),this.setAttribute("data-collapsible",this.collapsible),this.setAttribute("data-variant",this.variant),this.setAttribute("data-side",this.side),this.setAttribute("data-mobile",String(this.isMobile)),this.setAttribute("data-pane-width",String(f));let n=this.rootTarget;n&&(n.dataset.state=r,n.dataset.collapsible=this.collapsible,n.dataset.variant=this.variant,n.dataset.side=this.side,n.dataset.mobile=String(this.isMobile));let R=this.scrimTarget;R&&R.toggleAttribute("hidden",!(this.isMobile&&e));let E=this.paneTarget;E&&(E.dataset.side=this.side,E.dataset.variant=this.variant,E.setAttribute("aria-label",this.label),m?E.setAttribute("inert",""):E.removeAttribute("inert"));let v=this.handleTarget;v&&(v.toggleAttribute("hidden",!c),c&&(v.setAttribute("aria-orientation",t?"vertical":"horizontal"),v.setAttribute("aria-valuenow",String(f)),v.setAttribute("aria-valuemin",String(this.minWidth)),v.setAttribute("aria-valuemax",String(this.maxWidth)),v.setAttribute("aria-label",`${this.label} resize handle`)))}isOpen(){return this.open!==void 0?this.open:this.defaultOpen}ensureWidthInitialized(){this.hasAttribute("width")||(this.width===void 0||this.width===0)&&(this.width=this.defaultWidth)}onStateUpdated(){this.syncPresentation(),this.syncPaneWidthVar()}onMobileBreakpointUpdated(){this.bindMobileMediaQuery()}onMatchSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners(),this.syncActiveLinks(!1)}syncActiveLinks(t=!1){if(!this.matchActive||typeof window>"u"||typeof window.location>"u")return!1;let e=window.location.pathname,r=!1;for(let c of this.querySelectorAll(ve)){let m=this.isLinkActive(c,e);c.classList.toggle("rui-sidebar__menu-button--active",m),m?(c.setAttribute("aria-current","page"),t&&!r&&(c.scrollIntoView({block:"nearest"}),r=!0)):c.removeAttribute("aria-current")}return r}isLinkActive(t,e){let r=t.pathname;return this.matchMode==="prefix"?e===r||e.startsWith(`${r}/`):r===e}attachNavigationListeners(){if(Je||!this.isConnected||!this.matchActive||typeof window>"u"||typeof window.addEventListener!="function")return;let t=()=>this.syncActiveLinks(!1);if(window.addEventListener("popstate",t),this.navigationCleanups.push(()=>window.removeEventListener("popstate",t)),typeof document<"u"&&typeof document.addEventListener=="function")for(let e of ft(this.navigationEvents))document.addEventListener(e,t),this.navigationCleanups.push(()=>document.removeEventListener(e,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}unbindMobileMediaQuery(){this.mediaQuery?.removeEventListener("change",this.mediaListener),this.mediaQuery=null}bindMobileMediaQuery(){if(this.unbindMobileMediaQuery(),this.mobileBreakpoint<=0||!ai()){this.setMobile(!1);return}this.mediaQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.mediaQuery.addEventListener("change",this.mediaListener),this.setMobile(this.mediaQuery.matches)}setMobile(t){if(t===this.isMobile)return;let e=this.isMobile&&!t,r=!this.isMobile&&t;this.isMobile=t;let c=this.mobileReady&&!this.openControlled;c&&e&&this.collapsible==="off"&&!this.isOpen()?this.setOpen(!0):c&&r?this.setOpen(this.mobileDefaultOpen):this.syncPaneWidthVar(),this.mobileChangeEvent.emit({mobile:t})}clampWidth(t){return Math.min(this.maxWidth,Math.max(this.minWidth,t))}paneWidth(){return this.isOpen()?this.width&&this.width>0?this.width:this.defaultWidth:this.isMobile?0:this.collapsible==="icon"?Ze:0}syncPaneWidthVar(t=this.paneWidth()){let e=this.rootTarget;e&&e.style.setProperty("--rui-sidebar-pane-width",`${t}px`),this.paneTarget&&(this.paneTarget.style.removeProperty("width"),this.paneTarget.style.removeProperty("height")),this.setAttribute("data-pane-width",String(t))}applyWidth(t,e){let r=this.clampWidth(t);this.width=r,this.syncPaneWidthVar(r),e&&this.resizeEvent.emit({width:r})}toggle(){this.setOpen(!this.isOpen())}setOpen(t){let e=this.isOpen();if(t===e){this.syncPresentation(),this.syncPaneWidthVar();return}this.open=t;let r=t?"expanded":"collapsed";this.syncPresentation(),this.syncPaneWidthVar(),this.toggleEvent.emit({open:t,state:r})}beginDrag(t){if(t.button!==0||this.collapsible!=="off")return;this.dragging=!0;let e=dt(this.side);this.dragStartCoord=e?t.clientX:t.clientY,this.dragStartSize=this.paneWidth(),this.handleTarget?.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerUp)}endDrag(){this.dragging&&(this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp))}onPointerMove(t){if(!this.dragging)return;let r=dt(this.side)?t.clientX:t.clientY,c=this.side==="right"?this.dragStartCoord-r:r-this.dragStartCoord;this.applyWidth(this.dragStartSize+c,!0)}onPointerUp(){this.endDrag()}onHandlePointerDown(t){t.preventDefault(),this.beginDrag(t)}onHandleKeydown(t){let e=t,r=this.paneWidth(),c=dt(this.side),m=c?"ArrowLeft":"ArrowUp",f=c?"ArrowRight":"ArrowDown",n=r;if(e.key===m)n=r-(e.shiftKey?_e:ge);else if(e.key===f)n=r+(e.shiftKey?_e:ge);else if(e.key==="Home")n=this.minWidth;else if(e.key==="End")n=this.maxWidth;else return;t.preventDefault(),this.applyWidth(n,!0)}onScrimClick(){this.isMobile&&this.setOpen(!1)}onMenuLinkClick(){this.isMobile&&this.setOpen(!1)}onHostKeydown(t){let e=t;if(e.key==="Escape"&&this.isMobile&&this.isOpen()){e.preventDefault(),this.setOpen(!1);return}ni(e)&&e.key.toLowerCase()===ri&&(e.preventDefault(),this.toggle())}static{gt()}};import{RadiantElement as je,customElement as ui,onEvent as ci,onUpdated as Ue,prop as ot,query as hi,state as pi}from"@ecopages/radiant";var we,Ae,Me,xe,Ee,ke,Le,Te,Re,Ce,We,Oe,De,ze,Be,Pe;function si(i,t,e,r,c,m){var f,n,R,E,v,B,L,V=Symbol.metadata||Symbol.for("Symbol.metadata"),H=Object.defineProperty,D=Object.create,Q=[D(null),D(null)],K=t.length;function C(a,g,p){return function(s,o){g&&(o=s,s=i);for(var _=0;_<a.length;_++)o=a[_].apply(s,p?[o]:[]);return p?o:s}}function y(a,g,p,s){if(typeof a!="function"&&(s||a!==void 0))throw new TypeError(g+" must "+(p||"be")+" a function"+(s?"":" or undefined"));return a}function $(a,g,p,s,o,_,k,b,S,w,N){function G(u){if(!N(u))throw new TypeError("Attempted to access private element on non-instance")}var F=[].concat(g[0]),Z=g[3],Y=!k,W=o===1,tt=o===3,et=o===4,P=o===2;function I(u,T,nt){return function(U,at){return T&&(at=U,U=a),nt&&nt(U),d[u].call(U,at)}}if(!Y){var d={},X=[],M=tt?"get":et||W?"set":"value";if(S?(w||W?d={get:Ie(function(){return Z(this)},s,"get"),set:function(u){g[4](this,u)}}:d[M]=Z,w||Ie(d[M],s,P?"":M)):w||(d=Object.getOwnPropertyDescriptor(a,s)),!w&&!S){if((n=Q[+b][s])&&(n^o)!==7)throw Error("Decorating two elements with the same name ("+d[M].name+") is not supported yet");Q[+b][s]=o<3?1:o}}for(var h=a,j=F.length-1;j>=0;j-=p?2:1){var it=y(F[j],"A decorator","be",!0),rt=p?F[j-1]:void 0,J={},O={kind:["field","accessor","method","getter","setter","class"][o],name:s,metadata:f,addInitializer:function(u,T){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");y(T,"An initializer","be",!0),_.push(T)}.bind(null,J)};if(Y)n=it.call(rt,h,O),J.v=1,y(n,"class decorators","return")&&(h=n);else if(O.static=b,O.private=S,n=O.access={has:S?N.bind():function(u){return s in u}},et||(n.get=S?P?function(u){return G(u),d.value}:I("get",0,G):function(u){return u[s]}),P||tt||(n.set=S?I("set",0,G):function(u,T){u[s]=T}),h=it.call(rt,W?{get:d.get,set:d.set}:d[M],O),J.v=1,W){if(typeof h=="object"&&h)(n=y(h.get,"accessor.get"))&&(d.get=n),(n=y(h.set,"accessor.set"))&&(d.set=n),(n=y(h.init,"accessor.init"))&&X.unshift(n);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else y(h,(w?"field":"method")+" decorators","return")&&(w?X.unshift(h):d[M]=h)}return o<2&&k.push(C(X,b,1),C(_,b,0)),w||Y||(S?W?k.splice(-1,0,I("get",b),I("set",b)):k.push(P?d[M]:y.call.bind(d[M])):H(a,s,d)),h}function q(a){return H(a,V,{configurable:!0,enumerable:!0,value:f})}return m!==void 0&&(f=m[V]),f=D(f??null),v=[],B=function(a){a&&v.push(C(a))},L=function(a,g){for(var p=0;p<e.length;p++){var s=e[p],o=s[1],_=7&o;if((8&o)==a&&!_==g){var k=s[2],b=!!s[3],S=16&o;$(a?i:i.prototype,s,S,b?"#"+k:oi(k),_,_<2?[]:a?E=E||[]:R=R||[],v,!!a,b,g,a&&b?function(w){return di(w)===i}:c)}}},L(8,0),L(0,0),L(8,1),L(0,1),B(R),B(E),n=v,K||q(i),{e:n,get c(){var a=[];return K&&[q(i=$(i,[t],r,i.name,5,a)),C(a,1)]}}}function oi(i){var t=li(i,"string");return typeof t=="symbol"?t:t+""}function li(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var r=e.call(i,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Ie(i,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(i,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return i}function di(i){if(Object(i)!==i)throw TypeError("right-hand side of 'in' should be an object, got "+(i!==null?typeof i:"null"));return i}var Ke,Ve=class extends je{static{({e:[Me,xe,Ee,ke,Le,Te,Re,Ce,We,Oe,De,ze,Be,Pe,we],c:[Ke,Ae]}=si(this,[ui("rui-sidebar-trigger")],[[ot({type:String,defaultValue:""}),0,"controls"],[ot({type:String,attribute:"button-label",defaultValue:"Toggle sidebar"}),0,"buttonLabel"],[ot({type:String,reflect:!0,defaultValue:""}),0,"placement"],[ot({type:String,defaultValue:"ghost"}),0,"variant"],[ot({type:String,defaultValue:"md"}),0,"size"],[hi({ref:"button"}),0,"buttonTarget"],[pi,0,"sidebarState"],[Ue(["controls","buttonLabel","placement"]),2,"onBindingUpdated"],[Ue(["variant","size"]),2,"onPresentationUpdated"],[ci({ref:"button",type:"click"}),2,"onButtonClick"]],0,void 0,je))}controls=(we(this),Me(this));buttonLabel=(xe(this),Ee(this));placement=(ke(this),Le(this));variant=(Te(this),Re(this));size=(Ce(this),We(this));buttonTarget=(Oe(this),De(this));sidebarState=(ze(this),Be(this,"expanded"));sidebarListener=(Pe(this),null);attachedSidebar=null;initialSyncFrame=null;connectedCallback(){super.connectedCallback(),this.syncWithSidebar(),queueMicrotask(()=>queueMicrotask(()=>this.syncWithSidebar())),this.initialSyncFrame=requestAnimationFrame(()=>{this.initialSyncFrame=null,this.syncWithSidebar()})}disconnectedCallback(){this.initialSyncFrame!=null&&(cancelAnimationFrame(this.initialSyncFrame),this.initialSyncFrame=null),this.detachFromSidebar(),super.disconnectedCallback()}onBindingUpdated(){this.detachFromSidebar(),this.syncWithSidebar(),this.applyState(this.attachedSidebar?this.readState(this.attachedSidebar):"expanded")}onPresentationUpdated(){this.syncButtonPresentation()}resolveSidebar(){let t=this.controls?.trim();if(t){let r=document.getElementById(t);if(r)return r}let e=this.closest("rui-sidebar");return e?.id?e:null}syncWithSidebar(){let t=this.resolveSidebar();if(t===this.attachedSidebar){t&&this.applyState(this.readState(t));return}this.detachFromSidebar(),t&&(this.attachedSidebar=t,this.sidebarListener=e=>{let r=e.detail;this.applyState(r.state)},t.addEventListener("rui-sidebar-toggle",this.sidebarListener),this.applyState(this.readState(t)))}detachFromSidebar(){this.attachedSidebar&&this.sidebarListener&&this.attachedSidebar.removeEventListener("rui-sidebar-toggle",this.sidebarListener),this.attachedSidebar=null,this.sidebarListener=null}readState(t){return t.getAttribute("data-state")??"expanded"}resolvedPlacement(){if(this.classList.contains("rui-sidebar-trigger-placement--header"))return"header";if(this.classList.contains("rui-sidebar-trigger-placement--inset"))return"inset";let t=this.getAttribute("data-placement");return t==="header"||t==="inset"?t:this.placement}resolvedButtonLabel(t=this.sidebarState){if(this.resolvedPlacement()==="inset")return t==="expanded"?"Close navigation":"Open navigation";let e=this.getAttribute("data-button-label")?.trim();if(e)return e;let r=this.getAttribute("button-label")?.trim();return r||this.buttonLabel||"Toggle sidebar"}applyState(t){this.sidebarState=t;let e=this.buttonTarget;if(!e)return;let r=this.resolveSidebar(),c=this.resolvedButtonLabel(t);e.setAttribute("aria-expanded",String(t==="expanded")),e.setAttribute("data-sidebar-state",t),e.setAttribute("aria-label",c),r?.id?e.setAttribute("aria-controls",r.id):this.controls&&e.setAttribute("aria-controls",this.controls),this.syncButtonPresentation()}syncButtonPresentation(){let t=this.buttonTarget;t&&(t.className=`rui-button rui-button--${this.variant} rui-button--${this.size} rui-sidebar__trigger ${this.placementClass()}`.trim())}onButtonClick(t){t.preventDefault(),t.stopPropagation();let e=this.resolveSidebar();e&&typeof e.toggle=="function"&&e.toggle()}placementClass(){return this.resolvedPlacement()==="header"?"rui-sidebar__trigger--header":this.resolvedPlacement()==="inset"?"rui-sidebar__trigger--inset":""}static{Ae()}};import{jsx as l,jsxs as z}from"@ecopages/jsx/jsx-runtime";function pt(i,t){return t===void 0||i?.label!==void 0?i:{...i,label:t}}function ut(...i){for(let t of i)if(t!==void 0)return t}function A(...i){return i.filter(Boolean).join(" ")}function bt(i,...t){let e={...i};for(let r of t)delete e[r];return e}function bi({layout:i="default",siteHeader:t,sidebar:e,children:r,class:c,...m}){return i==="docs"?z("div",{...m,class:A("rui-sidebar-provider",c),"data-layout":i,children:[t?l("div",{class:"rui-sidebar-provider__site-header",children:t}):null,z("div",{class:"rui-sidebar-provider__body",children:[e,r]})]}):z("div",{...m,class:A("rui-sidebar-provider",c),"data-layout":i,children:[e,r]})}function fi({children:i,class:t,...e}){return l("div",{...e,class:A("rui-sidebar__header",t),children:i})}function mi({children:i,class:t,...e}){return l("div",{...e,class:A("rui-sidebar__content",t),children:i})}function gi({children:i,class:t,...e}){return l("div",{...e,class:A("rui-sidebar__footer",t),children:i})}function _i({class:i,...t}){return l("hr",{...t,role:"separator","aria-orientation":"horizontal",class:A("rui-sidebar__separator",i)})}function vi({children:i,class:t,...e}){return l("section",{...e,class:A("rui-sidebar__group",t),children:i})}function He({children:i,class:t,...e}){return l("h2",{...e,class:A("rui-sidebar__group-label",t),children:i})}function yi({children:i,class:t,...e}){return l("button",{...e,type:"button",class:A("rui-sidebar__group-action",t),children:i})}function Si({label:i,action:t,class:e,...r}){return z("div",{...r,class:A("rui-sidebar__group-header",e),children:[l(He,{children:i}),t]})}function wi({children:i,class:t,...e}){return l("ul",{...e,role:"list",class:A("rui-sidebar__menu",t),children:i})}function Ai({children:i,class:t,...e}){return l("li",{...e,class:A("rui-sidebar__menu-item",t),children:i})}function Qe(i){if(i.href!==void 0){let{children:V,class:H,isActive:D,href:Q,tooltip:K,aria:C,title:y,"aria-current":$,...q}=i;return l("a",{...bt(q,"as"),aria:pt(C,typeof V=="string"?void 0:K),href:Q,"data-ref":"menu-button",class:A("rui-sidebar__menu-button",D&&"rui-sidebar__menu-button--active",H),"aria-current":D?"page":$,title:ut(y,K),children:V})}let{children:t,class:e,isActive:r,type:c="button",tooltip:m,disabled:f,onClick:n,aria:R,title:E,"aria-current":v,"on:click":B,...L}=i;return l("button",{...bt(L,"as","href"),aria:pt(R,typeof t=="string"?void 0:m),type:c,"data-ref":"menu-button",class:A("rui-sidebar__menu-button",r&&"rui-sidebar__menu-button--active",e),"aria-current":r?"page":v,disabled:f,title:ut(E,m),"on:click":ut(B,n),children:t})}function Mi(i){let{class:t,...e}=i;return l(Qe,{class:A("rui-sidebar__menu-action",t),...e})}function xi({children:i,class:t,...e}){return l("main",{...e,class:A("rui-sidebar__inset",t),children:i})}function Ei({children:i,open:t,label:e,...r}){return l("rui-sidebar",{...r,"prop:open":t,label:e,children:z("div",{class:"rui-sidebar","data-ref":"root",children:[l("button",{"data-ref":"scrim",type:"button",class:"rui-sidebar__scrim",tabindex:-1,"aria-label":"Close sidebar",hidden:!0}),l("div",{"data-ref":"pane",class:"rui-sidebar__pane","aria-label":e,children:i}),l("div",{"data-ref":"handle",class:"rui-sidebar__handle",role:"separator",tabindex:0,hidden:!0,children:l("span",{class:"rui-sidebar__handle-grip","aria-hidden":"true"})})]})})}function ki(){return z("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:[z("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--collapse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),l("path",{d:"M9 3v18"}),l("path",{d:"m14 15 3-3-3-3"})]}),z("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--expand",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),l("path",{d:"M9 3v18"}),l("path",{d:"m14 9-3 3 3 3"})]}),z("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--close",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("path",{d:"M18 6 6 18"}),l("path",{d:"m6 6 12 12"})]}),z("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--menu",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("path",{d:"M4 6h16"}),l("path",{d:"M4 12h16"}),l("path",{d:"M4 18h16"})]})]})}function Li({children:i,class:t,triggerLabel:e,placement:r,variant:c="ghost",size:m="md",...f}){let n=e??"Toggle sidebar";return l("rui-sidebar-trigger",{...f,class:A(t,r&&`rui-sidebar-trigger-placement--${r}`),"prop:buttonLabel":n,data:{buttonLabel:n},placement:r,variant:c,size:m,children:l("button",{"data-ref":"button",type:"button",class:A("rui-button",`rui-button--${c}`,`rui-button--${m}`,"rui-sidebar__trigger"),children:i??l(ki,{})})})}export{Ei as RuiSidebar,mi as RuiSidebarContent,Se as RuiSidebarElement,gi as RuiSidebarFooter,vi as RuiSidebarGroup,yi as RuiSidebarGroupAction,Si as RuiSidebarGroupHeader,He as RuiSidebarGroupLabel,fi as RuiSidebarHeader,xi as RuiSidebarInset,wi as RuiSidebarMenu,Mi as RuiSidebarMenuAction,Qe as RuiSidebarMenuButton,Ai as RuiSidebarMenuItem,bi as RuiSidebarProvider,_i as RuiSidebarSeparator,Li as RuiSidebarTrigger,Ke as RuiSidebarTriggerElement};
1
+ import{RadiantElement as ye,bindTo as ot,bound as Se,customElement as oi,event as ft,onEvent as st,onUpdated as mt,prop as x,query as ct,state as si}from"@ecopages/radiant";import{isServer as li}from"@ecopages/radiant/is-server";function yt(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}var St,wt,xt,Mt,Et,Tt,At,kt,Rt,Ct,Ot,Lt,Wt,Dt,zt,It,Bt,jt,Pt,Vt,Ut,Kt,Gt,Ht,Qt,$t,Yt,Xt,qt,Nt,Zt,Jt,Ft,te,ee,ie,re,ne,ae,oe,se,le,de,ue,ce,he,pe,be,fe,me,ge,_e;function ii(e,t,i,r,u,f){var b,o,A,z,C,I,k,U=Symbol.metadata||Symbol.for("Symbol.metadata"),G=Object.defineProperty,D=Object.create,H=[D(null),D(null)],K=t.length;function O(n,m,h){return function(a,s){m&&(s=a,a=e);for(var g=0;g<n.length;g++)s=n[g].apply(a,h?[s]:[]);return h?s:a}}function v(n,m,h,a){if(typeof n!="function"&&(a||n!==void 0))throw new TypeError(m+" must "+(h||"be")+" a function"+(a?"":" or undefined"));return n}function Q(n,m,h,a,s,g,E,p,y,S,J){function Y(d){if(!J(d))throw new TypeError("Attempted to access private element on non-instance")}var X=[].concat(m[0]),F=m[3],q=!E,L=s===1,tt=s===3,et=s===4,B=s===2;function j(d,R,nt){return function(V,at){return R&&(at=V,V=n),nt&&nt(V),l[d].call(V,at)}}if(!q){var l={},N=[],w=tt?"get":et||L?"set":"value";if(y?(S||L?l={get:ve(function(){return F(this)},a,"get"),set:function(d){m[4](this,d)}}:l[w]=F,S||ve(l[w],a,B?"":w)):S||(l=Object.getOwnPropertyDescriptor(n,a)),!S&&!y){if((o=H[+p][a])&&(o^s)!==7)throw Error("Decorating two elements with the same name ("+l[w].name+") is not supported yet");H[+p][a]=s<3?1:s}}for(var c=n,P=X.length-1;P>=0;P-=h?2:1){var it=v(X[P],"A decorator","be",!0),rt=h?X[P-1]:void 0,Z={},W={kind:["field","accessor","method","getter","setter","class"][s],name:a,metadata:b,addInitializer:function(d,R){if(d.v)throw new TypeError("attempted to call addInitializer after decoration was finished");v(R,"An initializer","be",!0),g.push(R)}.bind(null,Z)};if(q)o=it.call(rt,c,W),Z.v=1,v(o,"class decorators","return")&&(c=o);else if(W.static=p,W.private=y,o=W.access={has:y?J.bind():function(d){return a in d}},et||(o.get=y?B?function(d){return Y(d),l.value}:j("get",0,Y):function(d){return d[a]}),B||tt||(o.set=y?j("set",0,Y):function(d,R){d[a]=R}),c=it.call(rt,L?{get:l.get,set:l.set}:l[w],W),Z.v=1,L){if(typeof c=="object"&&c)(o=v(c.get,"accessor.get"))&&(l.get=o),(o=v(c.set,"accessor.set"))&&(l.set=o),(o=v(c.init,"accessor.init"))&&N.unshift(o);else if(c!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else v(c,(S?"field":"method")+" decorators","return")&&(S?N.unshift(c):l[w]=c)}return s<2&&E.push(O(N,p,1),O(g,p,0)),S||q||(y?L?E.splice(-1,0,j("get",p),j("set",p)):E.push(B?l[w]:v.call.bind(l[w])):G(n,a,l)),c}function $(n){return G(n,U,{configurable:!0,enumerable:!0,value:b})}return f!==void 0&&(b=f[U]),b=D(b??null),C=[],I=function(n){n&&C.push(O(n))},k=function(n,m){for(var h=0;h<i.length;h++){var a=i[h],s=a[1],g=7&s;if((8&s)==n&&!g==m){var E=a[2],p=!!a[3],y=16&s;Q(n?e:e.prototype,a,y,p?"#"+E:ri(E),g,g<2?[]:n?z=z||[]:A=A||[],C,!!n,p,m,n&&p?function(S){return ai(S)===e}:u)}}},k(8,0),k(0,0),k(8,1),k(0,1),I(A),I(z),o=C,K||$(e),{e:o,get c(){var n=[];return K&&[$(e=Q(e,[t],r,e.name,5,n)),O(n,1)]}}}function ri(e){var t=ni(e,"string");return typeof t=="symbol"?t:t+""}function ni(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ve(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function ai(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 di=256,ui=48,ci=200,hi=480,pi="b",we=8,xe=32,Me='[data-ref="menu-button"]';function bi(e){return e.metaKey||e.ctrlKey}function fi(){return typeof window<"u"&&typeof window.matchMedia=="function"}function ht(e){return e==="left"||e==="right"}var Te,Ee=class extends ye{static{({e:[xt,Mt,Et,Tt,At,kt,Rt,Ct,Ot,Lt,Wt,Dt,zt,It,Bt,jt,Pt,Vt,Ut,Kt,Gt,Ht,Qt,$t,Yt,Xt,qt,Nt,Zt,Jt,Ft,te,ee,ie,re,ne,ae,oe,se,le,de,ue,ce,he,pe,be,fe,me,ge,_e,St],c:[Te,wt]}=ii(this,[oi("rui-sidebar")],[[[x({type:String,reflect:!0,defaultValue:"sidebar"}),ot([{attr:"data-variant"},{ref:"root",attr:"data-variant"},{ref:"pane",attr:"data-variant"}])],0,"variant"],[[x({type:String,reflect:!0,defaultValue:"left"}),ot([{attr:"data-side"},{ref:"root",attr:"data-side"},{ref:"pane",attr:"data-side"}])],0,"side"],[[x({type:String,reflect:!0,defaultValue:"off"}),ot([{attr:"data-collapsible"},{ref:"root",attr:"data-collapsible"}])],0,"collapsible"],[x({type:Number,defaultValue:di}),0,"defaultWidth"],[x({type:Number,reflect:!0,attribute:"width"}),0,"width"],[x({type:Number,defaultValue:ci}),0,"minWidth"],[x({type:Number,defaultValue:hi}),0,"maxWidth"],[x({type:Boolean,defaultValue:!1}),0,"resizable"],[x({type:Boolean,defaultValue:!0}),0,"defaultOpen"],[x({type:Boolean,defaultValue:!1}),0,"mobileDefaultOpen"],[x({type:Boolean,attribute:"open"}),0,"open"],[x({type:Number,defaultValue:768}),0,"mobileBreakpoint"],[[x({type:String,defaultValue:"Sidebar"}),ot([{attr:"aria-label"},{ref:"pane",attr:"aria-label"}])],0,"label"],[x({type:Boolean,reflect:!0,attribute:"match-active"}),0,"matchActive"],[x({type:String,defaultValue:"pathname"}),0,"matchMode"],[x({type:Boolean,attribute:"scroll-active-on-mount"}),0,"scrollActiveOnMount"],[x({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[ct({ref:"root"}),0,"rootTarget"],[ct({ref:"pane"}),0,"paneTarget"],[ct({ref:"handle"}),0,"handleTarget"],[ct({ref:"scrim"}),0,"scrimTarget"],[ft({name:"rui-sidebar-toggle",bubbles:!0,composed:!0}),0,"toggleEvent"],[ft({name:"rui-sidebar-resize",bubbles:!0,composed:!0}),0,"resizeEvent"],[ft({name:"rui-sidebar-mobile-change",bubbles:!0,composed:!0}),0,"mobileChangeEvent"],[[si,ot([{attr:"data-mobile"},{ref:"root",attr:"data-mobile"}])],0,"isMobile"],[mt(["open","collapsible","variant","side","width","defaultWidth","defaultOpen","minWidth","maxWidth","isMobile","resizable","label"]),2,"onStateUpdated"],[mt(["mobileBreakpoint"]),2,"onMobileBreakpointUpdated"],[mt(["matchActive","matchMode","navigationEvents"]),2,"onMatchSettingsUpdated"],[Se,2,"onPointerMove"],[Se,2,"onPointerUp"],[st({ref:"handle",type:"pointerdown"}),2,"onHandlePointerDown"],[st({ref:"handle",type:"keydown"}),2,"onHandleKeydown"],[st({ref:"scrim",type:"click"}),2,"onScrimClick"],[st({selector:Me,type:"click"}),2,"onMenuLinkClick"],[st({document:!0,type:"keydown"}),2,"onHostKeydown"]],0,void 0,ye))}variant=(St(this),xt(this));side=(Mt(this),Et(this));collapsible=(Tt(this),At(this));defaultWidth=(kt(this),Rt(this));width=(Ct(this),Ot(this));minWidth=(Lt(this),Wt(this));maxWidth=(Dt(this),zt(this));resizable=(It(this),Bt(this));defaultOpen=(jt(this),Pt(this));mobileDefaultOpen=(Vt(this),Ut(this));open=(Kt(this),Gt(this));mobileBreakpoint=(Ht(this),Qt(this));label=($t(this),Yt(this));matchActive=(Xt(this),qt(this,!1));matchMode=(Nt(this),Zt(this));scrollActiveOnMount=(Jt(this),Ft(this,!1));navigationEvents=(te(this),ee(this,""));rootTarget=(ie(this),re(this));paneTarget=(ne(this),ae(this));handleTarget=(oe(this),se(this));scrimTarget=(le(this),de(this));toggleEvent=(ue(this),ce(this));resizeEvent=(he(this),pe(this));mobileChangeEvent=(be(this),fe(this));isMobile=(me(this),ge(this,!1));mediaQuery=(_e(this),null);mediaListener=t=>this.setMobile(t.matches);dragging=!1;dragStartCoord=0;dragStartSize=0;navigationCleanups=[];didScrollActiveOnMount=!1;openControlled=!1;mobileReady=!1;connectedCallback(){super.connectedCallback(),this.ensureWidthInitialized(),this.setAttribute("role","complementary"),this.attachNavigationListeners()}onConnected(){this.ensureWidthInitialized(),this.openControlled=this.open!==void 0,this.bindMobileMediaQuery(),this.openControlled||(this.open=this.isMobile?this.mobileDefaultOpen:this.defaultOpen),this.syncPresentation(),this.syncPaneWidthVar(),this.mobileReady=!0}updated(t){super.updated(t);let i=this.scrollActiveOnMount&&!this.didScrollActiveOnMount;this.syncActiveLinks(i),i&&(this.didScrollActiveOnMount=!0)}disconnectedCallback(){this.endDrag(),this.unbindMobileMediaQuery(),this.detachNavigationListeners(),this.mobileReady=!1,super.disconnectedCallback()}syncPresentation(){let t=this.isOpen(),i=t?"expanded":"collapsed",r=this.resizable&&this.collapsible==="off"&&t&&!this.isMobile,u=!(t||!this.isMobile&&this.collapsible==="icon"),f=this.paneWidth();this.setAttribute("data-state",i),this.setAttribute("data-pane-width",String(f));let b=this.rootTarget;b&&(b.dataset.state=i);let o=this.scrimTarget;o&&o.toggleAttribute("hidden",!(this.isMobile&&t));let A=this.paneTarget;A&&(u?A.setAttribute("inert",""):A.removeAttribute("inert")),this.syncHandlePresentation(r,f)}syncHandlePresentation(t,i){let r=this.handleTarget;r&&(r.toggleAttribute("hidden",!t),t&&(r.setAttribute("aria-orientation",ht(this.side)?"vertical":"horizontal"),r.setAttribute("aria-valuenow",String(i)),r.setAttribute("aria-valuemin",String(this.minWidth)),r.setAttribute("aria-valuemax",String(this.maxWidth)),r.setAttribute("aria-label",`${this.label} resize handle`)))}isOpen(){return this.open!==void 0?this.open:this.defaultOpen}ensureWidthInitialized(){this.hasAttribute("width")||(this.width===void 0||this.width===0)&&(this.width=this.defaultWidth)}onStateUpdated(){this.syncPresentation(),this.syncPaneWidthVar()}onMobileBreakpointUpdated(){this.bindMobileMediaQuery()}onMatchSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners()}syncActiveLinks(t=!1){if(!this.matchActive||typeof window>"u"||typeof window.location>"u")return!1;let i=window.location.pathname,r=!1;for(let u of this.querySelectorAll(Me)){let f=this.isLinkActive(u,i);u.classList.toggle("rui-sidebar__menu-button--active",f),f?(u.setAttribute("aria-current","page"),t&&!r&&(u.scrollIntoView({block:"nearest"}),r=!0)):u.removeAttribute("aria-current")}return r}isLinkActive(t,i){let r=t.pathname;return this.matchMode==="prefix"?i===r||i.startsWith(`${r}/`):r===i}attachNavigationListeners(){if(li||!this.isConnected||!this.matchActive||typeof window>"u"||typeof window.addEventListener!="function")return;let t=()=>this.syncActiveLinks(!1);if(window.addEventListener("popstate",t),this.navigationCleanups.push(()=>window.removeEventListener("popstate",t)),typeof document<"u"&&typeof document.addEventListener=="function")for(let i of yt(this.navigationEvents))document.addEventListener(i,t),this.navigationCleanups.push(()=>document.removeEventListener(i,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}unbindMobileMediaQuery(){this.mediaQuery?.removeEventListener("change",this.mediaListener),this.mediaQuery=null}bindMobileMediaQuery(){if(this.unbindMobileMediaQuery(),this.mobileBreakpoint<=0||!fi()){this.setMobile(!1);return}this.mediaQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.mediaQuery.addEventListener("change",this.mediaListener),this.setMobile(this.mediaQuery.matches)}setMobile(t){if(t===this.isMobile)return;let i=this.isMobile&&!t,r=!this.isMobile&&t;this.isMobile=t;let u=this.mobileReady&&!this.openControlled;u&&i&&this.collapsible==="off"&&!this.isOpen()?this.setOpen(!0):u&&r?this.setOpen(this.mobileDefaultOpen):this.syncPaneWidthVar(),this.mobileChangeEvent.emit({mobile:t})}clampWidth(t){return Math.min(this.maxWidth,Math.max(this.minWidth,t))}paneWidth(){return this.isOpen()?this.width&&this.width>0?this.width:this.defaultWidth:this.isMobile?0:this.collapsible==="icon"?ui:0}syncPaneWidthVar(t=this.paneWidth()){let i=this.rootTarget;i&&i.style.setProperty("--rui-sidebar-pane-width",`${t}px`),this.paneTarget&&(this.paneTarget.style.removeProperty("width"),this.paneTarget.style.removeProperty("height")),this.setAttribute("data-pane-width",String(t))}applyWidth(t,i){let r=this.clampWidth(t);this.width=r,this.syncPaneWidthVar(r),i&&this.resizeEvent.emit({width:r})}toggle(){this.setOpen(!this.isOpen())}setOpen(t){let i=this.isOpen();if(t===i){this.syncPresentation(),this.syncPaneWidthVar();return}this.open=t;let r=t?"expanded":"collapsed";this.syncPresentation(),this.syncPaneWidthVar(),this.toggleEvent.emit({open:t,state:r})}beginDrag(t){if(t.button!==0||this.collapsible!=="off")return;this.dragging=!0;let i=ht(this.side);this.dragStartCoord=i?t.clientX:t.clientY,this.dragStartSize=this.paneWidth(),this.handleTarget?.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerUp)}endDrag(){this.dragging&&(this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp))}onPointerMove(t){if(!this.dragging)return;let r=ht(this.side)?t.clientX:t.clientY,u=this.side==="right"?this.dragStartCoord-r:r-this.dragStartCoord;this.applyWidth(this.dragStartSize+u,!0)}onPointerUp(){this.endDrag()}onHandlePointerDown(t){t.preventDefault(),this.beginDrag(t)}onHandleKeydown(t){let i=t,r=this.paneWidth(),u=ht(this.side),f=u?"ArrowLeft":"ArrowUp",b=u?"ArrowRight":"ArrowDown",o=r;if(i.key===f)o=r-(i.shiftKey?xe:we);else if(i.key===b)o=r+(i.shiftKey?xe:we);else if(i.key==="Home")o=this.minWidth;else if(i.key==="End")o=this.maxWidth;else return;t.preventDefault(),this.applyWidth(o,!0)}onScrimClick(){this.isMobile&&this.setOpen(!1)}onMenuLinkClick(){this.isMobile&&this.setOpen(!1)}onHostKeydown(t){let i=t;if(i.key==="Escape"&&this.isMobile&&this.isOpen()){i.preventDefault(),this.setOpen(!1);return}bi(i)&&i.key.toLowerCase()===pi&&(i.preventDefault(),this.toggle())}static{wt()}};import{RadiantElement as Xe,bindTo as pt,customElement as yi,onEvent as Si,onUpdated as qe,prop as lt,query as wi,state as gt}from"@ecopages/radiant";var Ae,ke,Re,Ce,Oe,Le,We,De,ze,Ie,Be,je,Pe,Ve,Ue,Ke,Ge,He,Qe,$e;function mi(e,t,i,r,u,f){var b,o,A,z,C,I,k,U=Symbol.metadata||Symbol.for("Symbol.metadata"),G=Object.defineProperty,D=Object.create,H=[D(null),D(null)],K=t.length;function O(n,m,h){return function(a,s){m&&(s=a,a=e);for(var g=0;g<n.length;g++)s=n[g].apply(a,h?[s]:[]);return h?s:a}}function v(n,m,h,a){if(typeof n!="function"&&(a||n!==void 0))throw new TypeError(m+" must "+(h||"be")+" a function"+(a?"":" or undefined"));return n}function Q(n,m,h,a,s,g,E,p,y,S,J){function Y(d){if(!J(d))throw new TypeError("Attempted to access private element on non-instance")}var X=[].concat(m[0]),F=m[3],q=!E,L=s===1,tt=s===3,et=s===4,B=s===2;function j(d,R,nt){return function(V,at){return R&&(at=V,V=n),nt&&nt(V),l[d].call(V,at)}}if(!q){var l={},N=[],w=tt?"get":et||L?"set":"value";if(y?(S||L?l={get:Ye(function(){return F(this)},a,"get"),set:function(d){m[4](this,d)}}:l[w]=F,S||Ye(l[w],a,B?"":w)):S||(l=Object.getOwnPropertyDescriptor(n,a)),!S&&!y){if((o=H[+p][a])&&(o^s)!==7)throw Error("Decorating two elements with the same name ("+l[w].name+") is not supported yet");H[+p][a]=s<3?1:s}}for(var c=n,P=X.length-1;P>=0;P-=h?2:1){var it=v(X[P],"A decorator","be",!0),rt=h?X[P-1]:void 0,Z={},W={kind:["field","accessor","method","getter","setter","class"][s],name:a,metadata:b,addInitializer:function(d,R){if(d.v)throw new TypeError("attempted to call addInitializer after decoration was finished");v(R,"An initializer","be",!0),g.push(R)}.bind(null,Z)};if(q)o=it.call(rt,c,W),Z.v=1,v(o,"class decorators","return")&&(c=o);else if(W.static=p,W.private=y,o=W.access={has:y?J.bind():function(d){return a in d}},et||(o.get=y?B?function(d){return Y(d),l.value}:j("get",0,Y):function(d){return d[a]}),B||tt||(o.set=y?j("set",0,Y):function(d,R){d[a]=R}),c=it.call(rt,L?{get:l.get,set:l.set}:l[w],W),Z.v=1,L){if(typeof c=="object"&&c)(o=v(c.get,"accessor.get"))&&(l.get=o),(o=v(c.set,"accessor.set"))&&(l.set=o),(o=v(c.init,"accessor.init"))&&N.unshift(o);else if(c!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else v(c,(S?"field":"method")+" decorators","return")&&(S?N.unshift(c):l[w]=c)}return s<2&&E.push(O(N,p,1),O(g,p,0)),S||q||(y?L?E.splice(-1,0,j("get",p),j("set",p)):E.push(B?l[w]:v.call.bind(l[w])):G(n,a,l)),c}function $(n){return G(n,U,{configurable:!0,enumerable:!0,value:b})}return f!==void 0&&(b=f[U]),b=D(b??null),C=[],I=function(n){n&&C.push(O(n))},k=function(n,m){for(var h=0;h<i.length;h++){var a=i[h],s=a[1],g=7&s;if((8&s)==n&&!g==m){var E=a[2],p=!!a[3],y=16&s;Q(n?e:e.prototype,a,y,p?"#"+E:gi(E),g,g<2?[]:n?z=z||[]:A=A||[],C,!!n,p,m,n&&p?function(S){return vi(S)===e}:u)}}},k(8,0),k(0,0),k(8,1),k(0,1),I(A),I(z),o=C,K||$(e),{e:o,get c(){var n=[];return K&&[$(e=Q(e,[t],r,e.name,5,n)),O(n,1)]}}}function gi(e){var t=_i(e,"string");return typeof t=="symbol"?t:t+""}function _i(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ye(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function vi(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 Ne="Toggle sidebar",xi=["filled","outline","ghost"],Mi=["sm","md","lg"];function Je({variant:e,size:t}){return`rui-button rui-button--${e} rui-button--${t} rui-sidebar__trigger`}function Ei(e){return e==="inset"?"collapsed":"expanded"}var Fe,Ze=class extends Xe{static{({e:[Re,Ce,Oe,Le,We,De,ze,Ie,Be,je,Pe,Ve,Ue,Ke,Ge,He,Qe,$e,Ae],c:[Fe,ke]}=mi(this,[yi("rui-sidebar-trigger")],[[lt({type:String,defaultValue:""}),0,"controls"],[[lt({type:String,attribute:"button-label",defaultValue:Ne}),pt({ref:"button",attr:"aria-label",map:t=>t?.trim()||Ne})],0,"buttonLabel"],[lt({type:String,reflect:!0,defaultValue:""}),0,"placement"],[lt({type:String,defaultValue:"ghost"}),0,"variant"],[lt({type:String,defaultValue:"md"}),0,"size"],[wi({ref:"button"}),0,"buttonTarget"],[[gt,pt([{attr:"data-sidebar-state"},{ref:"button",attr:"aria-expanded",map:t=>String(t==="expanded")}])],0,"sidebarState"],[[gt,pt({attr:"data-sidebar-mobile"})],0,"sidebarMobile"],[[gt,pt({attr:"data-sidebar-collapsible"})],0,"sidebarCollapsible"],[qe(["controls","placement"]),2,"onTargetUpdated"],[qe(["variant","size"]),2,"onPresentationUpdated"],[Si({ref:"button",type:"click"}),2,"onButtonClick"]],0,void 0,Xe))}controls=(Ae(this),Re(this));buttonLabel=(Ce(this),Oe(this));placement=(Le(this),We(this));variant=(De(this),ze(this));size=(Ie(this),Be(this));buttonTarget=(je(this),Pe(this));sidebarState=(Ve(this),Ue(this,"expanded"));sidebarMobile=(Ke(this),Ge(this,null));sidebarCollapsible=(He(this),Qe(this,null));sidebarObserver=($e(this),null);attachedSidebar=null;onConnected(){this.syncWithSidebar()}disconnectedCallback(){this.detachFromSidebar(),super.disconnectedCallback()}onTargetUpdated(){this.syncWithSidebar()}onPresentationUpdated(){let t=this.buttonTarget?.classList;if(t){for(let i of xi)t.toggle(`rui-button--${i}`,i===this.variant);for(let i of Mi)t.toggle(`rui-button--${i}`,i===this.size)}}resolveSidebar(){let t=this.controls?.trim();if(t){let r=document.getElementById(t);return r?.localName==="rui-sidebar"?r:null}let i=this.closest("rui-sidebar");return i?.id?i:null}syncWithSidebar(){let t=this.resolveSidebar();t!==this.attachedSidebar&&(this.detachFromSidebar(),t&&(this.attachedSidebar=t,typeof MutationObserver=="function"&&(this.sidebarObserver=new MutationObserver(()=>this.applyState()),this.sidebarObserver.observe(t,{attributes:!0,attributeFilter:["data-state","data-mobile","data-collapsible"]}))));let i=t?.id||this.controls;i?this.buttonTarget?.setAttribute("aria-controls",i):this.buttonTarget?.removeAttribute("aria-controls"),this.applyState()}detachFromSidebar(){this.sidebarObserver?.disconnect(),this.attachedSidebar=null,this.sidebarObserver=null}applyState(){let t=this.attachedSidebar;if(!t){this.sidebarState=Ei(this.placement),this.sidebarMobile=null,this.sidebarCollapsible=null;return}this.sidebarState=t.getAttribute("data-state")==="collapsed"?"collapsed":"expanded",this.sidebarMobile=t.getAttribute("data-mobile")==="true",this.sidebarCollapsible=t.getAttribute("data-collapsible")??"off"}onButtonClick(t){t.preventDefault(),t.stopPropagation();let i=this.resolveSidebar();i&&typeof i.toggle=="function"&&i.toggle()}static{ke()}};import{jsx as T,jsxs as dt}from"@ecopages/jsx/jsx-runtime";function Ti(){return dt("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:[dt("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--collapse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[T("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),T("path",{d:"M9 3v18"}),T("path",{d:"m14 15 3-3-3-3"})]}),dt("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--expand",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[T("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),T("path",{d:"M9 3v18"}),T("path",{d:"m14 9-3 3 3 3"})]}),dt("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--close",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[T("path",{d:"M18 6 6 18"}),T("path",{d:"m6 6 12 12"})]}),dt("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--menu",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[T("path",{d:"M4 6h16"}),T("path",{d:"M4 12h16"}),T("path",{d:"M4 18h16"})]})]})}function Ai({children:e,triggerLabel:t,placement:i,variant:r="ghost",size:u="md",controls:f,...b}){return T("rui-sidebar-trigger",{...b,"prop:buttonLabel":t,placement:i,variant:r,size:u,controls:f,children:T("button",{"data-ref":"button",type:"button",class:Je({variant:r,size:u}),children:e??T(Ti,{})})})}import{jsx as _,jsxs as ut}from"@ecopages/jsx/jsx-runtime";function _t(e,t){return t===void 0||e?.label!==void 0?e:{...e,label:t}}function bt(...e){for(let t of e)if(t!==void 0)return t}function M(...e){return e.filter(Boolean).join(" ")}function vt(e,...t){let i={...e};for(let r of t)delete i[r];return i}function ki({layout:e="default",siteHeader:t,sidebar:i,children:r,class:u,...f}){return e==="docs"?ut("div",{...f,class:M("rui-sidebar-provider",u),"data-layout":e,children:[t?_("div",{class:"rui-sidebar-provider__site-header",children:t}):null,ut("div",{class:"rui-sidebar-provider__body",children:[i,r]})]}):ut("div",{...f,class:M("rui-sidebar-provider",u),"data-layout":e,children:[i,r]})}function Ri({children:e,class:t,...i}){return _("div",{...i,class:M("rui-sidebar__header",t),children:e})}function Ci({children:e,class:t,...i}){return _("div",{...i,class:M("rui-sidebar__content",t),children:e})}function Oi({children:e,class:t,...i}){return _("div",{...i,class:M("rui-sidebar__footer",t),children:e})}function Li({class:e,...t}){return _("hr",{...t,role:"separator","aria-orientation":"horizontal",class:M("rui-sidebar__separator",e)})}function Wi({children:e,class:t,...i}){return _("section",{...i,class:M("rui-sidebar__group",t),children:e})}function ti({children:e,class:t,...i}){return _("h2",{...i,class:M("rui-sidebar__group-label",t),children:e})}function Di({children:e,class:t,...i}){return _("button",{...i,type:"button",class:M("rui-sidebar__group-action",t),children:e})}function zi({label:e,action:t,class:i,...r}){return ut("div",{...r,class:M("rui-sidebar__group-header",i),children:[_(ti,{children:e}),t]})}function Ii({children:e,class:t,...i}){return _("ul",{...i,role:"list",class:M("rui-sidebar__menu",t),children:e})}function Bi({children:e,class:t,...i}){return _("li",{...i,class:M("rui-sidebar__menu-item",t),children:e})}function ei(e){if(e.href!==void 0){let{children:U,class:G,isActive:D,href:H,tooltip:K,aria:O,title:v,"aria-current":Q,...$}=e;return _("a",{...vt($,"as"),aria:_t(O,typeof U=="string"?void 0:K),href:H,"data-ref":"menu-button",class:M("rui-sidebar__menu-button",D&&"rui-sidebar__menu-button--active",G),"aria-current":D?"page":Q,title:bt(v,K),children:U})}let{children:t,class:i,isActive:r,type:u="button",tooltip:f,disabled:b,onClick:o,aria:A,title:z,"aria-current":C,"on:click":I,...k}=e;return _("button",{...vt(k,"as","href"),aria:_t(A,typeof t=="string"?void 0:f),type:u,"data-ref":"menu-button",class:M("rui-sidebar__menu-button",r&&"rui-sidebar__menu-button--active",i),"aria-current":r?"page":C,disabled:b,title:bt(z,f),"on:click":bt(I,o),children:t})}function ji(e){let{class:t,...i}=e;return _(ei,{class:M("rui-sidebar__menu-action",t),...i})}function Pi({children:e,class:t,...i}){return _("main",{...i,class:M("rui-sidebar__inset",t),children:e})}function Vi({children:e,open:t,label:i,...r}){return _("rui-sidebar",{...r,"prop:open":t,label:i,children:ut("div",{class:"rui-sidebar","data-ref":"root",children:[_("button",{"data-ref":"scrim",type:"button",class:"rui-sidebar__scrim",tabindex:-1,"aria-label":"Close sidebar",hidden:!0}),_("div",{"data-ref":"pane",class:"rui-sidebar__pane","aria-label":i,children:e}),_("div",{"data-ref":"handle",class:"rui-sidebar__handle",role:"separator",tabindex:0,hidden:!0,children:_("span",{class:"rui-sidebar__handle-grip","aria-hidden":"true"})})]})})}export{Vi as RuiSidebar,Ci as RuiSidebarContent,Te as RuiSidebarElement,Oi as RuiSidebarFooter,Wi as RuiSidebarGroup,Di as RuiSidebarGroupAction,zi as RuiSidebarGroupHeader,ti as RuiSidebarGroupLabel,Ri as RuiSidebarHeader,Pi as RuiSidebarInset,Ii as RuiSidebarMenu,ji as RuiSidebarMenuAction,ei as RuiSidebarMenuButton,Bi as RuiSidebarMenuItem,ki as RuiSidebarProvider,Li as RuiSidebarSeparator,Ai as RuiSidebarTrigger,Fe as RuiSidebarTriggerElement};
2
2
  //# sourceMappingURL=index.js.map