@ecopages/radiant-ui 0.1.0-rc.7 → 0.1.0-rc.8

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 (147) hide show
  1. package/README.md +2 -2
  2. package/dist/components/ui/alert/alert.d.ts +2 -4
  3. package/dist/components/ui/alert/alert.script.d.ts +25 -15
  4. package/dist/components/ui/autocomplete/autocomplete.d.ts +8 -3
  5. package/dist/components/ui/autocomplete/autocomplete.script.d.ts +29 -4
  6. package/dist/components/ui/breadcrumb/breadcrumb.d.ts +11 -11
  7. package/dist/components/ui/breadcrumb/breadcrumb.script.d.ts +10 -10
  8. package/dist/components/ui/calendar/calendar.script.d.ts +23 -21
  9. package/dist/components/ui/carousel/carousel.d.ts +7 -3
  10. package/dist/components/ui/carousel/carousel.script.d.ts +30 -25
  11. package/dist/components/ui/carousel/index.js +1 -1
  12. package/dist/components/ui/carousel/index.js.map +3 -3
  13. package/dist/components/ui/checkbox/checkbox.d.ts +11 -0
  14. package/dist/components/ui/checkbox/checkbox.script.d.ts +31 -5
  15. package/dist/components/ui/checkbox-group/checkbox-group.d.ts +4 -1
  16. package/dist/components/ui/checkbox-group/checkbox-group.script.d.ts +32 -14
  17. package/dist/components/ui/checkbox-group/index.js +1 -1
  18. package/dist/components/ui/checkbox-group/index.js.map +3 -3
  19. package/dist/components/ui/combobox/combobox.css +9 -1
  20. package/dist/components/ui/combobox/combobox.d.ts +13 -4
  21. package/dist/components/ui/combobox/combobox.script.d.ts +62 -20
  22. package/dist/components/ui/combobox/index.d.ts +2 -2
  23. package/dist/components/ui/combobox/index.js +1 -1
  24. package/dist/components/ui/combobox/index.js.map +4 -4
  25. package/dist/components/ui/cycle-toggle/cycle-toggle.d.ts +6 -2
  26. package/dist/components/ui/cycle-toggle/cycle-toggle.script.d.ts +35 -4
  27. package/dist/components/ui/date-field/date-field.d.ts +4 -4
  28. package/dist/components/ui/date-field/date-field.script.d.ts +27 -12
  29. package/dist/components/ui/date-field/index.js +1 -1
  30. package/dist/components/ui/date-field/index.js.map +3 -3
  31. package/dist/components/ui/date-range-picker/date-range-picker.d.ts +5 -5
  32. package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +29 -15
  33. package/dist/components/ui/date-range-picker/index.js +1 -1
  34. package/dist/components/ui/dialog/dialog.d.ts +6 -0
  35. package/dist/components/ui/dialog/dialog.script.d.ts +33 -7
  36. package/dist/components/ui/dialog/index.js +1 -1
  37. package/dist/components/ui/dialog/index.js.map +4 -4
  38. package/dist/components/ui/disclosure/disclosure-group.script.d.ts +19 -3
  39. package/dist/components/ui/disclosure/disclosure.d.ts +8 -2
  40. package/dist/components/ui/disclosure/disclosure.script.d.ts +29 -5
  41. package/dist/components/ui/field/field-description.d.ts +1 -0
  42. package/dist/components/ui/field/field-error.d.ts +2 -2
  43. package/dist/components/ui/field/field.d.ts +4 -4
  44. package/dist/components/ui/field/field.script.d.ts +27 -20
  45. package/dist/components/ui/field/index.js +1 -1
  46. package/dist/components/ui/field/index.js.map +4 -4
  47. package/dist/components/ui/form/form.d.ts +6 -0
  48. package/dist/components/ui/form/form.script.d.ts +23 -13
  49. package/dist/components/ui/form/index.js +1 -1
  50. package/dist/components/ui/form/index.js.map +3 -3
  51. package/dist/components/ui/grid/grid.d.ts +4 -3
  52. package/dist/components/ui/grid/grid.script.d.ts +19 -11
  53. package/dist/components/ui/hover-card/hover-card.d.ts +7 -2
  54. package/dist/components/ui/hover-card/hover-card.script.d.ts +29 -5
  55. package/dist/components/ui/hover-card/index.js +1 -1
  56. package/dist/components/ui/hover-card/index.js.map +3 -3
  57. package/dist/components/ui/input/index.js +1 -1
  58. package/dist/components/ui/input/index.js.map +2 -2
  59. package/dist/components/ui/knob/knob.d.ts +3 -3
  60. package/dist/components/ui/knob/knob.script.d.ts +31 -11
  61. package/dist/components/ui/label/index.js +1 -1
  62. package/dist/components/ui/label/index.js.map +2 -2
  63. package/dist/components/ui/label/label.d.ts +2 -1
  64. package/dist/components/ui/listbox/index.d.ts +2 -2
  65. package/dist/components/ui/listbox/index.js +1 -1
  66. package/dist/components/ui/listbox/index.js.map +4 -4
  67. package/dist/components/ui/listbox/listbox.css +14 -0
  68. package/dist/components/ui/listbox/listbox.d.ts +17 -2
  69. package/dist/components/ui/listbox/listbox.script.d.ts +49 -8
  70. package/dist/components/ui/menu-button/menu-button.d.ts +2 -2
  71. package/dist/components/ui/menu-button/menu-button.script.d.ts +29 -26
  72. package/dist/components/ui/menubar/menubar.script.d.ts +41 -15
  73. package/dist/components/ui/meter/meter.script.d.ts +8 -13
  74. package/dist/components/ui/navigation-menu/navigation-menu.d.ts +3 -3
  75. package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +28 -9
  76. package/dist/components/ui/number-field/index.js +1 -1
  77. package/dist/components/ui/number-field/index.js.map +3 -3
  78. package/dist/components/ui/number-field/number-field.d.ts +8 -19
  79. package/dist/components/ui/number-field/number-field.script.d.ts +26 -3
  80. package/dist/components/ui/pagination/index.js +1 -1
  81. package/dist/components/ui/pagination/pagination.d.ts +9 -4
  82. package/dist/components/ui/pagination/pagination.script.d.ts +29 -9
  83. package/dist/components/ui/popover/popover.d.ts +17 -1
  84. package/dist/components/ui/popover/popover.script.d.ts +52 -9
  85. package/dist/components/ui/radio-group/radio-group.d.ts +2 -2
  86. package/dist/components/ui/radio-group/radio-group.script.d.ts +33 -15
  87. package/dist/components/ui/select/index.d.ts +1 -1
  88. package/dist/components/ui/select/index.js +1 -1
  89. package/dist/components/ui/select/index.js.map +4 -4
  90. package/dist/components/ui/select/select.css +4 -3
  91. package/dist/components/ui/select/select.d.ts +15 -8
  92. package/dist/components/ui/select/select.script.d.ts +51 -23
  93. package/dist/components/ui/shared/control-toggle.css +8 -4
  94. package/dist/components/ui/shared/field-label.d.ts +5 -0
  95. package/dist/components/ui/shared/listbox-host-controller.d.ts +40 -0
  96. package/dist/components/ui/shared/listbox-option.d.ts +4 -0
  97. package/dist/components/ui/shared/multi-value.d.ts +13 -1
  98. package/dist/components/ui/sidebar/index.js +1 -1
  99. package/dist/components/ui/sidebar/index.js.map +2 -2
  100. package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +15 -7
  101. package/dist/components/ui/sidebar/sidebar.d.ts +11 -0
  102. package/dist/components/ui/sidebar/sidebar.script.d.ts +30 -13
  103. package/dist/components/ui/slider/slider.d.ts +16 -5
  104. package/dist/components/ui/slider/slider.script.d.ts +36 -3
  105. package/dist/components/ui/switch/switch.d.ts +13 -0
  106. package/dist/components/ui/switch/switch.script.d.ts +24 -5
  107. package/dist/components/ui/table/index.js +1 -1
  108. package/dist/components/ui/table/index.js.map +3 -3
  109. package/dist/components/ui/table/table.d.ts +4 -4
  110. package/dist/components/ui/table/table.script.d.ts +32 -4
  111. package/dist/components/ui/tabs/tabs.d.ts +7 -4
  112. package/dist/components/ui/tabs/tabs.script.d.ts +32 -9
  113. package/dist/components/ui/tag-group/index.js +1 -1
  114. package/dist/components/ui/tag-group/index.js.map +4 -4
  115. package/dist/components/ui/tag-group/tag-group.d.ts +14 -5
  116. package/dist/components/ui/tag-group/tag-group.script.d.ts +51 -5
  117. package/dist/components/ui/textarea/index.js +1 -1
  118. package/dist/components/ui/textarea/index.js.map +2 -2
  119. package/dist/components/ui/toast/index.js +1 -1
  120. package/dist/components/ui/toast/index.js.map +4 -4
  121. package/dist/components/ui/toast/toast.script.d.ts +16 -31
  122. package/dist/components/ui/toast/toaster.script.d.ts +19 -13
  123. package/dist/components/ui/toc/toc.script.d.ts +19 -8
  124. package/dist/components/ui/toolbar/toolbar.d.ts +5 -0
  125. package/dist/components/ui/toolbar/toolbar.script.d.ts +24 -4
  126. package/dist/components/ui/tooltip/index.js +1 -1
  127. package/dist/components/ui/tooltip/index.js.map +2 -2
  128. package/dist/components/ui/tooltip/tooltip.d.ts +7 -0
  129. package/dist/components/ui/tooltip/tooltip.script.d.ts +27 -5
  130. package/dist/components/ui/tree/tree.d.ts +4 -3
  131. package/dist/components/ui/tree/tree.script.d.ts +28 -15
  132. package/dist/components/ui/treegrid/treegrid.d.ts +5 -3
  133. package/dist/components/ui/treegrid/treegrid.script.d.ts +33 -14
  134. package/dist/components/ui/window-splitter/window-splitter.d.ts +9 -0
  135. package/dist/components/ui/window-splitter/window-splitter.script.d.ts +22 -8
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.js +1 -1
  138. package/dist/index.js.map +4 -4
  139. package/dist/lib/icons/check.d.ts +3 -0
  140. package/dist/lib/icons/index.d.ts +2 -0
  141. package/dist/lib/icons/x.d.ts +5 -0
  142. package/dist/styles/primitives.css +4 -4
  143. package/dist/styles/radiant-ui.css +0 -8
  144. package/dist/styles/style-dependencies.json +20 -7
  145. package/dist/styles/styles.css +31 -8
  146. package/dist/styles/tailwind.css +0 -8
  147. package/package.json +10 -6
package/README.md CHANGED
@@ -33,8 +33,8 @@ Useful scripts:
33
33
  ```bash
34
34
  pnpm run test # Vitest (storybook + unit browser projects)
35
35
  pnpm run test:storybook # Story interaction/render tests (CI)
36
- pnpm run test:ssr:smoke # Local SSR smoke (6 stories × client/ssr-static/ssr-hydrate)
37
- pnpm run test:ssr # Full Components/* SSR matrix (nightly)
36
+ pnpm run test:ssr:smoke # SSR smoke (6 stories × client/ssr-static/ssr-hydrate; runs on PRs)
37
+ pnpm run test:ssr # Full Components/* SSR matrix (run on demand)
38
38
  pnpm run typecheck
39
39
  pnpm run lint
40
40
  pnpm run build:lib # generate exports + build JS/types + compile CSS
@@ -30,12 +30,10 @@ export type RuiAlertDescriptionProps = JsxElementProps<HTMLDivElement>;
30
30
  export declare function RuiAlertDescription({ children, class: className, ...props }: RuiAlertDescriptionProps): import("@ecopages/jsx").JsxRenderable;
31
31
  export type RuiAlertComponentProps = JsxElementProps<HTMLDivElement> & RuiAlertProps;
32
32
  /**
33
- * Status alert with optional dismiss control.
33
+ * Status alert with optional dismiss control. Stamps `<rui-alert>` and the inner
34
+ * `role="alert"` surface; appends `[data-alert-close]` when `dismissible`.
34
35
  *
35
36
  * @remarks
36
- * Importable JSX helper around `<rui-alert>`. Owns the `role="alert"` surface and
37
- * BEM classes; the host owns dismiss (`rui-close` / `dismiss()`).
38
- *
39
37
  * Variant tones map to semantic theme roles (`info`, `success`, `warning`, `error`)
40
38
  * via `.rui-alert--*` — not palette steps. See `alert.css` and DESIGN.md status roles.
41
39
  *
@@ -23,16 +23,25 @@ export type RuiAlertCloseDetail = {
23
23
  reason: 'dismiss';
24
24
  };
25
25
  /**
26
- * `<rui-alert>` — a brief, important message that attracts attention
27
- * without interrupting the user's task.
26
+ * `<rui-alert>` — status message host with optional dismiss.
28
27
  *
29
- * Compose with the `RuiAlert` view (surface + optional dismiss control) and
30
- * `RuiAlertIcon` / `RuiAlertTitle` / `RuiAlertDescription` as needed.
28
+ * The custom element is a behavior host: it does not render the composed tree.
29
+ * Import the script and place light-DOM children that match the contract below,
30
+ * or use the `RuiAlert` view helpers which stamp the same targets.
31
31
  *
32
32
  * Prefer injecting or revealing alerts at the moment they become relevant;
33
33
  * static copy that is always present should not use `role="alert"`.
34
34
  *
35
- * @summary Status message host; optional dismiss removes the element.
35
+ * ## Light-DOM contract
36
+ *
37
+ * Optional:
38
+ * - `[data-alert-close]` — dismiss control. Click calls `dismiss()` when `dismissible` is set.
39
+ *
40
+ * The host does not query alert content or the `role="alert"` surface. Authors own
41
+ * that markup (or use `RuiAlert`, which stamps it). Do not rely on BEM class names
42
+ * for behavior.
43
+ *
44
+ * Nested hosts: none.
36
45
  *
37
46
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/alert/
38
47
  *
@@ -40,22 +49,23 @@ export type RuiAlertCloseDetail = {
40
49
  *
41
50
  * @attr {('info'|'success'|'warning'|'error')} variant - Visual tone. Default: `info`.
42
51
  * @attr {('inline'|'banner')} layout - Layout mode. Default: `inline`.
43
- * @attr {boolean} dismissible - Show dismiss control (via the view). Default: `false`.
52
+ * @attr {boolean} dismissible - Show dismiss control. Default: `false`.
44
53
  * @attr {string} close-label - Accessible name for dismiss. Default: `Dismiss`.
45
54
  *
46
- * @slot - Alert content. Prefer the `RuiAlert` view so the `role="alert"` surface
47
- * and BEM classes stay in sync with `variant` / `layout` / `dismissible`.
48
- *
49
55
  * @fires rui-close - Emitted when the alert is dismissed; then the host is removed.
50
56
  *
51
57
  * @remarks
52
- * Styling classes live on the JSX view helpers (`@cssclass`). This element owns
53
- * dismiss behavior — default `render()` is a passthrough slot so prop updates do
54
- * not rebuild the composed light-DOM surface.
58
+ * Minimum headless tree with dismiss:
59
+ *
60
+ * ```html
61
+ * <rui-alert dismissible close-label="Dismiss">
62
+ * <div role="alert">Your session will expire soon.</div>
63
+ * <button type="button" data-alert-close aria-label="Dismiss"></button>
64
+ * </rui-alert>
65
+ * ```
55
66
  *
56
- * **Why a custom element?** Dismiss emits `rui-close` and removes the host from
57
- * the DOM without re-projecting slot content. A presentational-only wrapper would
58
- * need equivalent lifecycle wiring; the CE keeps that behavior self-contained.
67
+ * BEM classes are presentation-only; see view `@cssclass`. Dismiss emits `rui-close`
68
+ * and removes the host without re-building the composed surface.
59
69
  */
60
70
  export declare class RuiAlert extends RadiantElement {
61
71
  variant: RuiAlertVariant;
@@ -5,21 +5,26 @@ export type RuiAutocompleteInputProps = JsxElementProps<HTMLInputElement> & {
5
5
  placeholder?: string;
6
6
  disabled?: boolean;
7
7
  };
8
- /** Search field paired with `RuiAutocomplete` via `data-autocomplete-input`.
8
+ /** Search field paired with `RuiAutocomplete`. Stamps `[data-autocomplete-input]`.
9
9
  *
10
10
  * @cssclass rui-autocomplete__input - Bordered search input.
11
11
  */
12
12
  export declare function RuiAutocompleteInput({ placeholder, class: className, disabled, ...props }: RuiAutocompleteInputProps): JsxRenderable;
13
13
  export type RuiAutocompleteCollectionProps = JsxElementProps<HTMLDivElement>;
14
- /** Wrapper around the filterable collection inside `RuiAutocomplete`.
14
+ /** Wrapper around the filterable collection. Stamps `[data-autocomplete-collection]`.
15
15
  *
16
16
  * @cssclass rui-autocomplete__collection - Scrollable filterable region.
17
17
  */
18
18
  export declare function RuiAutocompleteCollection({ children, class: className, ...props }: RuiAutocompleteCollectionProps): JsxRenderable;
19
19
  export type RuiAutocompleteEmptyProps = JsxElementProps<HTMLDivElement>;
20
- /** Shown when filtering yields no visible items.
20
+ /** No-results state. Stamps `[data-autocomplete-empty]`; host toggles `hidden`.
21
21
  *
22
22
  * @cssclass rui-autocomplete__empty - No-results state.
23
23
  */
24
24
  export declare function RuiAutocompleteEmpty({ children, class: className, ...props }: RuiAutocompleteEmptyProps): JsxRenderable;
25
+ /**
26
+ * Filter host view. Wraps children in `[data-ref="root"]` (presentation only).
27
+ *
28
+ * @cssclass rui-autocomplete - Filter host root.
29
+ */
25
30
  export declare function RuiAutocomplete({ children, ...props }: JsxCustomElementAttributes<RuiAutocompleteElement, RuiAutocompleteProps>): JsxRenderable;
@@ -9,9 +9,32 @@ export type RuiAutocompleteProps = {
9
9
  /**
10
10
  * `<rui-autocomplete>` — filters a composed collection from a text input.
11
11
  *
12
- * Wrap a search field (`data-autocomplete-input`) and a collection
13
- * (`data-autocomplete-collection` or default slot) containing `[role="option"]`,
14
- * `[role="menuitem"]`, or `[data-tag]` items.
12
+ * The custom element is a behavior host: it does not render filter markup.
13
+ * Import the script and place light-DOM children that match the contract below,
14
+ * or use `RuiAutocomplete` and its helpers, which stamp the same targets.
15
+ *
16
+ * ## Light-DOM contract
17
+ *
18
+ * Required (one of):
19
+ * - `[data-autocomplete-input]` — search field inside this host. Host listens for `input`.
20
+ * - External `[data-autocomplete-input]` on an ancestor `rui-combobox` or `rui-select`
21
+ * when this host does not contain the input.
22
+ *
23
+ * Collection (one of):
24
+ * - `[data-autocomplete-collection]` — wrapper around filterable items.
25
+ * - The host element itself — when no collection wrapper is provided.
26
+ *
27
+ * Per item inside the collection:
28
+ * - `[role="option"]`, `[role="menuitem"]`, or `[data-tag]` — filterable rows. Host
29
+ * toggles `hidden` based on the query. Text match uses `data-label` or trimmed
30
+ * `textContent`.
31
+ *
32
+ * Optional:
33
+ * - `[data-autocomplete-empty]` — no-results state. Host toggles `hidden` when matches exist.
34
+ * - `[data-label]` on items — filter text; falls back to trimmed `textContent`.
35
+ *
36
+ * Nested hosts: filterable items are often `rui-listbox` options or `rui-tag` chips;
37
+ * this host only queries the role / data-tag selectors above, not listbox internals.
15
38
  *
16
39
  * @remarks When nested in `rui-combobox`, the combobox input acts as the filter
17
40
  * field. `rui-select` uses a dedicated search input inside the popup instead.
@@ -23,7 +46,9 @@ export type RuiAutocompleteProps = {
23
46
  * @attr {string} sensitivity - Filter sensitivity: `base` (case-insensitive contains), `case`, or `accent`. Default: `base`.
24
47
  * @attr {string} input-value - Controlled filter query; when unset, reads from the composed input. Default: `''`.
25
48
  *
26
- * @cssclass rui-autocomplete - Filter host.
49
+ * @remarks
50
+ * `[data-ref="root"]` on the view is presentation only; the host does not query it.
51
+ * BEM classes live on the view; the host never queries them.
27
52
  */
28
53
  export declare class RuiAutocomplete extends RadiantElement {
29
54
  sensitivity: TextFilterSensitivity;
@@ -3,23 +3,23 @@ import type { RuiBreadcrumb as RuiBreadcrumbElement, RuiBreadcrumbProps } from '
3
3
  import './breadcrumb.script';
4
4
  export type RuiBreadcrumbViewProps = JsxCustomElementAttributes<RuiBreadcrumbElement, RuiBreadcrumbProps>;
5
5
  /**
6
- * Landmark wrapper for a breadcrumb trail. Set `separator` once here (e.g. `/`
7
- * or `>`); empty `RuiBreadcrumbSeparator` nodes pick it up via CSS — no context.
8
- * Pass children into a separator to override for that instance.
6
+ * Landmark wrapper for a breadcrumb trail. Stamps `<nav class="rui-breadcrumb">`.
9
7
  *
10
8
  * @cssclass rui-breadcrumb - `<nav>` landmark root.
9
+ *
10
+ * @remarks `separator` sets `--rui-breadcrumb-separator` for empty separators.
11
11
  */
12
12
  export declare function RuiBreadcrumb({ children, label, separator, ...props }: RuiBreadcrumbViewProps): import("@ecopages/jsx").JsxRenderable;
13
13
  export type RuiBreadcrumbListProps = JsxElementProps<HTMLOListElement>;
14
14
  /**
15
- * Ordered list of breadcrumb items and separators.
15
+ * Ordered list of breadcrumb items and separators. Stamps `<ol class="rui-breadcrumb__list">`.
16
16
  *
17
17
  * @cssclass rui-breadcrumb__list - Ordered list row.
18
18
  */
19
19
  export declare function RuiBreadcrumbList({ children, class: className, ...props }: RuiBreadcrumbListProps): import("@ecopages/jsx").JsxRenderable;
20
20
  export type RuiBreadcrumbItemProps = JsxElementProps<HTMLLIElement>;
21
21
  /**
22
- * Single crumb (`<li>`).
22
+ * Single crumb list item. Stamps `<li class="rui-breadcrumb__item">`.
23
23
  *
24
24
  * @cssclass rui-breadcrumb__item - List item wrapping a crumb link/page.
25
25
  */
@@ -28,25 +28,25 @@ export type RuiBreadcrumbLinkProps = JsxElementProps<HTMLAnchorElement> & {
28
28
  href: string;
29
29
  };
30
30
  /**
31
- * Linked ancestor page.
31
+ * Linked ancestor page. Stamps `<a class="rui-breadcrumb__link">`.
32
32
  *
33
33
  * @cssclass rui-breadcrumb__link - Crumb link.
34
34
  */
35
35
  export declare function RuiBreadcrumbLink({ children, href, class: className, ...props }: RuiBreadcrumbLinkProps): import("@ecopages/jsx").JsxRenderable;
36
36
  export type RuiBreadcrumbPageProps = JsxElementProps<HTMLSpanElement>;
37
37
  /**
38
- * Current page (non-link).
38
+ * Current page (non-link). Stamps `<span class="rui-breadcrumb__page" aria-current="page">`.
39
39
  *
40
40
  * @cssclass rui-breadcrumb__page - Current page span (`aria-current="page"`).
41
41
  */
42
42
  export declare function RuiBreadcrumbPage({ children, class: className, ...props }: RuiBreadcrumbPageProps): import("@ecopages/jsx").JsxRenderable;
43
43
  export type RuiBreadcrumbSeparatorProps = JsxElementProps<HTMLLIElement>;
44
44
  /**
45
- * Visual separator between crumbs. Renders as a presentational list item.
46
- * With no children, uses the glyph from `RuiBreadcrumb`’s `separator` prop
47
- * (CSS custom property). With children, those replace the default glyph.
45
+ * Visual separator between crumbs. Stamps presentational `<li class="rui-breadcrumb__separator">`.
48
46
  *
49
47
  * @cssclass rui-breadcrumb__separator - Presentational separator (`aria-hidden`).
48
+ *
49
+ * @remarks With no children, uses the glyph from `RuiBreadcrumb`'s `separator` prop.
50
50
  */
51
51
  export declare function RuiBreadcrumbSeparator({ children, class: className, ...props }: RuiBreadcrumbSeparatorProps): import("@ecopages/jsx").JsxRenderable;
52
52
  export type RuiBreadcrumbEllipsisProps = JsxElementProps<HTMLSpanElement> & {
@@ -54,7 +54,7 @@ export type RuiBreadcrumbEllipsisProps = JsxElementProps<HTMLSpanElement> & {
54
54
  label?: string;
55
55
  };
56
56
  /**
57
- * Collapsed middle segment indicator.
57
+ * Collapsed middle segment indicator. Stamps `<span class="rui-breadcrumb__ellipsis">`.
58
58
  *
59
59
  * @cssclass rui-breadcrumb__ellipsis - Collapsed segment indicator (`aria-hidden`).
60
60
  * @cssclass rui-breadcrumb__ellipsis-label - Screen-reader label for the collapsed segment.
@@ -10,20 +10,20 @@ export type RuiBreadcrumbProps = {
10
10
  separator?: string;
11
11
  };
12
12
  /**
13
- * `<rui-breadcrumb>` — a trail of links to ancestor pages in hierarchical order.
13
+ * `<rui-breadcrumb>` — navigation landmark for a hierarchical page trail.
14
14
  *
15
- * Implements the WAI-ARIA APG Breadcrumb pattern: a `<nav>` landmark containing
16
- * an ordered list of links, with `aria-current="page"` on the current page item.
17
- *
18
- * Compose with the JSX helpers (`RuiBreadcrumbList`, `RuiBreadcrumbItem`,
19
- * `RuiBreadcrumbLink`, `RuiBreadcrumbPage`, `RuiBreadcrumbSeparator`,
20
- * `RuiBreadcrumbEllipsis`).
15
+ * The custom element holds `label` and `separator` props; it does not query
16
+ * authored children. Use `RuiBreadcrumb` and the breadcrumb helpers, which stamp
17
+ * the `<nav>` landmark and list structure.
21
18
  *
22
19
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/
23
- *
24
- * Keyboard interaction: standard link navigation (`Tab`, `Enter`).
25
- *
26
20
  * @element rui-breadcrumb
21
+ * @attr {string} label - Accessible name for the navigation landmark. Default: `Breadcrumb`.
22
+ * @attr {string} separator - Glyph for empty `RuiBreadcrumbSeparator` nodes (CSS custom property). Default: `/`.
23
+ *
24
+ * @remarks
25
+ * No light-DOM query contract — keyboard interaction is standard link navigation.
26
+ * BEM classes live on the view helpers.
27
27
  */
28
28
  export declare class RuiBreadcrumb extends RadiantElement {
29
29
  label: string;
@@ -30,15 +30,34 @@ type MonthPanel = {
30
30
  /**
31
31
  * `<rui-calendar>` — locale-aware month grid(s) for picking dates.
32
32
  *
33
+ * Derived Tree: the host `render()` paints the month grid. Authored children are
34
+ * not the inner calendar. Parent hosts (`rui-date-field`, `rui-date-range-picker`)
35
+ * embed `<rui-calendar>` and query day targets when opening the popup.
36
+ *
33
37
  * Supports single, multiple, and range selection. Value format:
34
38
  * - single: `YYYY-MM-DD`
35
39
  * - multiple: comma-separated ISO dates
36
40
  * - range: `YYYY-MM-DD/YYYY-MM-DD`
37
41
  *
38
- * @see https://react-aria.adobe.com/Calendar
42
+ * ## Light-DOM contract
39
43
  *
40
- * @element rui-calendar
44
+ * Generated by `render()` (do not author manually):
45
+ * - `[data-ref="root"]` — application root. Host sets `role="application"`,
46
+ * `aria-label`, and `aria-multiselectable` when `selection-mode="multiple"`.
47
+ * - `[data-calendar-prev-month]` / `[data-calendar-next-month]` — paging controls.
48
+ * - `[data-calendar-grid]` — month grid (`role="grid"`).
49
+ * - `[data-calendar-day]` — day buttons. Host sets `data-iso`, roving `tabIndex`,
50
+ * `aria-selected`, `aria-current`, `disabled`, and range `data-range-*` attrs.
51
+ * - `[data-calendar-today]` — jump to today.
52
+ *
53
+ * Parent-queried on nested calendars:
54
+ * - `[data-calendar-day][data-iso="…"]` — focus target when a date-field popup opens.
55
+ * - `[data-calendar-day][tabindex="0"]` — roving focus fallback.
56
+ *
57
+ * Nested hosts: none.
41
58
  *
59
+ * @see https://react-aria.adobe.com/Calendar
60
+ * @element rui-calendar
42
61
  * @attr {string} value - Selected date(s) in the mode-specific ISO format. Default: `''`.
43
62
  * @attr {string} min - Earliest selectable ISO date. Default: `''`.
44
63
  * @attr {string} max - Latest selectable ISO date. Default: `''`.
@@ -47,29 +66,12 @@ type MonthPanel = {
47
66
  * @attr {('single'|'multiple'|'range')} selection-mode - Selection mode. Default: `single`.
48
67
  * @attr {number} visible-months - Month grids shown side by side. Default: `1`.
49
68
  * @attr {('visible'|'single')} page-behavior - Whether paging moves by all visible months or one month. Default: `visible`.
50
- *
51
69
  * @fires rui-change - Emitted when the selection changes; detail carries `value`, plus `start` / `end` for ranges.
52
70
  *
53
- * @cssclass rui-calendar - Root surface (`role="application"`).
54
- * @cssclass rui-calendar--multi - Multi-month root modifier.
55
- * @cssclass rui-calendar__months - Row of month panels.
56
- * @cssclass rui-calendar__month-panel - Single month grid column.
57
- * @cssclass rui-calendar__header - Month title row with paging controls.
58
- * @cssclass rui-calendar__nav - Prev / next month button.
59
- * @cssclass rui-calendar__nav-spacer - Placeholder where a nav button is absent.
60
- * @cssclass rui-calendar__month - Month title.
61
- * @cssclass rui-calendar__weekdays - Weekday header row.
62
- * @cssclass rui-calendar__weekday - Weekday label.
63
- * @cssclass rui-calendar__grid - Month grid (`role="grid"`).
64
- * @cssclass rui-calendar__week - Grid row.
65
- * @cssclass rui-calendar__day - Day cell button (`role="gridcell"`).
66
- * @cssclass rui-calendar__footer - Footer row with the today button.
67
- * @cssclass rui-calendar__today - "Today" jump button.
68
- *
69
71
  * @remarks
70
72
  * Arrow keys move the focused day, PageUp / PageDown page the months (Shift
71
- * adds ±12), and Enter / Space select the focused day. Disabled or out-of-range
72
- * days are skipped while navigating.
73
+ * adds ±12), and Enter / Space select the focused day. BEM classes are
74
+ * presentation-only; behavior keys off the `data-calendar-*` targets above.
73
75
  */
74
76
  export declare class RuiCalendar extends RadiantElement {
75
77
  value: string;
@@ -9,9 +9,11 @@ export type RuiCarouselSlideProps = Omit<JsxElementProps<HTMLDivElement>, 'id'>
9
9
  id: string;
10
10
  };
11
11
  /**
12
- * Slide in the carousel track (APG `group` / `tabpanel` roles are applied by the host).
12
+ * Slide in the carousel track. Host applies `group` / `tabpanel` roles and visibility.
13
13
  *
14
14
  * @cssclass rui-carousel__slide - Slide surface.
15
+ *
16
+ * @remarks Stamps `[data-slide]` with the slide `id`.
15
17
  */
16
18
  export declare function RuiCarouselSlide({ id, children, class: className, ...props }: RuiCarouselSlideProps): JsxRenderable;
17
19
  export type RuiCarouselControlProps = JsxElementProps<HTMLButtonElement> & {
@@ -23,14 +25,16 @@ export type RuiCarouselControlProps = JsxElementProps<HTMLButtonElement> & {
23
25
  * Previous carousel control.
24
26
  *
25
27
  * @cssclass rui-carousel__nav - Prev nav button (composed with `rui-button`).
28
+ *
29
+ * @remarks Stamps `[data-carousel-action="prev"]` and `data-ref="prev"`.
26
30
  */
27
31
  export declare function RuiCarouselPrev({ children, class: className, disabled, overlay, aria, ...props }: RuiCarouselControlProps): JsxRenderable;
28
- /** Next carousel control. */
32
+ /** Next carousel control. Stamps `[data-carousel-action="next"]` and `data-ref="next"`. */
29
33
  export declare function RuiCarouselNext({ children, class: className, disabled, overlay, aria, ...props }: RuiCarouselControlProps): JsxRenderable;
30
34
  export type RuiCarouselRotationProps = JsxElementProps<HTMLButtonElement> & {
31
35
  overlay?: boolean;
32
36
  };
33
- /** Play/pause rotation control when `autoplay` or `show-rotation-control` is set. */
37
+ /** Play/pause rotation control. Stamps `[data-carousel-action="rotation"]` and `data-ref="rotation"`. */
34
38
  export declare function RuiCarouselRotation({ children, class: className, overlay, aria, ...props }: RuiCarouselRotationProps): JsxRenderable;
35
39
  export declare function RuiCarousel({ slides, children, prev, next, rotation, label, transition, controlsVariant, showIndicators, showRotationControl, autoplay, ...props }: JsxCustomElementAttributes<RuiCarouselElement, RuiCarouselProps & {
36
40
  slides?: RuiCarouselSlideData[];
@@ -27,16 +27,41 @@ export type RuiCarouselProps = {
27
27
  loop?: boolean;
28
28
  /** When true, prev/next wrap and controls stay enabled at the ends. Default: true. */
29
29
  wrap?: boolean;
30
- /** Authored slide count for render-time control state before slot projection. */
30
+ /** Authored slide count for render-time control state before the view paints slides. */
31
31
  slideCount?: number;
32
32
  };
33
33
  /**
34
34
  * `<rui-carousel>` — sequentially displays one slide at a time.
35
35
  *
36
+ * The custom element is a behavior host: it does not render the composed tree.
37
+ * Import the script and place light-DOM children that match the contract below,
38
+ * or use the `RuiCarousel` view helpers which stamp the same targets.
39
+ *
36
40
  * Implements the [APG Carousel pattern](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/):
37
41
  * labeled `carousel` region, slide groups or tab panels, optional tabbed pickers,
38
42
  * rotation control when autoplay is enabled, and `aria-live` on the slide container.
39
43
  *
44
+ * ## Light-DOM contract
45
+ *
46
+ * Required:
47
+ * - `[data-ref="root"]` — carousel region. View seeds `aria-roledescription="carousel"` and `aria-label`.
48
+ * - `[data-ref="viewport"]` — slide window. Host sets `aria-live` and `aria-atomic`; swipe target.
49
+ * - `[data-ref="track"]` — slide track. Host sets `--rui-carousel-index` when `transition="slide"`.
50
+ * - `[data-slide]` — one slide per panel. Host sets `role`, `aria-*`, `aria-hidden`, `data-active`,
51
+ * `hidden` (when `transition="none"`), and `id`.
52
+ *
53
+ * Optional:
54
+ * - `[data-carousel-action="prev"]` / `[data-carousel-action="next"]` — navigation buttons.
55
+ * Host toggles `disabled` at the ends when `wrap` is false.
56
+ * - `[data-carousel-action="rotation"]` — play/pause when `autoplay` or `show-rotation-control`.
57
+ * Host sets `aria-pressed` and `aria-label`.
58
+ * - `[data-ref="indicators"]` — tablist container when `show-indicators`. Host creates or updates
59
+ * `[data-carousel-indicator]` buttons inside.
60
+ *
61
+ * Do not set `role`, `aria-hidden`, `aria-selected`, or `tabIndex` on slides or indicators — the host owns those.
62
+ *
63
+ * Nested hosts: none.
64
+ *
40
65
  * @summary Region that cycles slides; optional autoplay, transitions, and chrome.
41
66
  *
42
67
  * @element rui-carousel
@@ -53,33 +78,10 @@ export type RuiCarouselProps = {
53
78
  * @attr {boolean} wrap - Keep controls enabled at the ends. Default: `true`.
54
79
  * @attr {number} slide-count - Authored slide count for render-time control state. Default: `0`.
55
80
  *
56
- * @cssclass rui-carousel - Root region (`aria-roledescription="carousel"`).
57
- * @cssclass rui-carousel--none - No animation between slides.
58
- * @cssclass rui-carousel--slide - Horizontal slide transition.
59
- * @cssclass rui-carousel--fade - Cross-fade transition.
60
- * @cssclass rui-carousel--controls-toolbar - Controls below the viewport.
61
- * @cssclass rui-carousel--controls-overlay - Controls overlaid on the viewport.
62
- * @cssclass rui-carousel__stage - Viewport wrapper.
63
- * @cssclass rui-carousel__viewport - Overflow-hidden slide window (`aria-live`).
64
- * @cssclass rui-carousel__track - Slide track.
65
- * @cssclass rui-carousel__footer - Controls row below the viewport (`toolbar`).
66
- * @cssclass rui-carousel__toolbar - Toolbar grid.
67
- * @cssclass rui-carousel__toolbar-rotation - Rotation control cell.
68
- * @cssclass rui-carousel__toolbar-center - Indicators cell.
69
- * @cssclass rui-carousel__toolbar-side--start - Prev control cell.
70
- * @cssclass rui-carousel__toolbar-side--end - Next control cell.
71
- * @cssclass rui-carousel__overlay-chrome - Absolute overlay layer over the viewport.
72
- * @cssclass rui-carousel__overlay-rotation - Rotation control overlay position.
73
- * @cssclass rui-carousel__controls--overlay - Prev/next overlay row.
74
- * @cssclass rui-carousel__indicators - Indicator tablist.
75
- * @cssclass rui-carousel__indicators--overlay - Overlay pill indicator tablist.
76
- * @cssclass rui-carousel__indicator - Indicator button (`role="tab"`).
77
- *
78
81
  * @remarks
79
82
  * Autoplay pauses on hover, pointer interaction, focus, and hidden tabs, and
80
83
  * respects `prefers-reduced-motion`. `aria-live` flips to `off` while rotating.
81
- * Prev/next and rotation chrome classes are authored by the `RuiCarouselPrev` /
82
- * `RuiCarouselNext` / `RuiCarouselRotation` view helpers for custom placement.
84
+ * BEM classes live on the view; the host queries `[data-ref="track"]` for slide transitions.
83
85
  */
84
86
  export declare class RuiCarousel extends RadiantElement {
85
87
  label: string;
@@ -93,6 +95,9 @@ export declare class RuiCarousel extends RadiantElement {
93
95
  loop: boolean;
94
96
  wrap: boolean;
95
97
  slideCount: number;
98
+ trackTarget: HTMLElement;
99
+ indicatorsTarget: HTMLElement;
100
+ viewportTarget: HTMLElement;
96
101
  private timer;
97
102
  private paused;
98
103
  /** User explicitly resumed rotation (e.g. via rotation control) despite reduced motion. */
@@ -1,2 +1,2 @@
1
- import{RadiantElement as Dt,customElement as Yt,onEvent as _,onUpdated as Z,prop as x}from"@ecopages/radiant";var ct,dt,ht,pt,ft,yt,bt,_t,vt,mt,gt,wt,xt,At,St,It,Ct,Rt,Pt,Et,Vt,Lt,Tt,kt;function Wt(i,t,e,o,r,s){var c,n,d,v,y,I,m,L=Symbol.metadata||Symbol.for("Symbol.metadata"),P=Object.defineProperty,j=Object.create,z=[j(null),j(null)],N=t.length;function W(a,A,g){return function(l,h){A&&(h=l,l=i);for(var S=0;S<a.length;S++)h=a[S].apply(l,g?[h]:[]);return g?h:l}}function E(a,A,g,l){if(typeof a!="function"&&(l||a!==void 0))throw new TypeError(A+" must "+(g||"be")+" a function"+(l?"":" or undefined"));return a}function tt(a,A,g,l,h,S,T,w,C,R,it){function F(f){if(!it(f))throw new TypeError("Attempted to access private element on non-instance")}var G=[].concat(A[0]),rt=A[3],H=!T,O=h===1,ot=h===3,nt=h===4,$=h===2;function B(f,U,lt){return function(Y,ut){return U&&(ut=Y,Y=a),lt&&lt(Y),p[f].call(Y,ut)}}if(!H){var p={},J=[],V=ot?"get":nt||O?"set":"value";if(C?(R||O?p={get:Mt(function(){return rt(this)},l,"get"),set:function(f){A[4](this,f)}}:p[V]=rt,R||Mt(p[V],l,$?"":V)):R||(p=Object.getOwnPropertyDescriptor(a,l)),!R&&!C){if((n=z[+w][l])&&(n^h)!==7)throw Error("Decorating two elements with the same name ("+p[V].name+") is not supported yet");z[+w][l]=h<3?1:h}}for(var b=a,X=G.length-1;X>=0;X-=g?2:1){var at=E(G[X],"A decorator","be",!0),st=g?G[X-1]:void 0,Q={},q={kind:["field","accessor","method","getter","setter","class"][h],name:l,metadata:c,addInitializer:function(f,U){if(f.v)throw new TypeError("attempted to call addInitializer after decoration was finished");E(U,"An initializer","be",!0),S.push(U)}.bind(null,Q)};if(H)n=at.call(st,b,q),Q.v=1,E(n,"class decorators","return")&&(b=n);else if(q.static=w,q.private=C,n=q.access={has:C?it.bind():function(f){return l in f}},nt||(n.get=C?$?function(f){return F(f),p.value}:B("get",0,F):function(f){return f[l]}),$||ot||(n.set=C?B("set",0,F):function(f,U){f[l]=U}),b=at.call(st,O?{get:p.get,set:p.set}:p[V],q),Q.v=1,O){if(typeof b=="object"&&b)(n=E(b.get,"accessor.get"))&&(p.get=n),(n=E(b.set,"accessor.set"))&&(p.set=n),(n=E(b.init,"accessor.init"))&&J.unshift(n);else if(b!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else E(b,(R?"field":"method")+" decorators","return")&&(R?J.unshift(b):p[V]=b)}return h<2&&T.push(W(J,w,1),W(S,w,0)),R||H||(C?O?T.splice(-1,0,B("get",w),B("set",w)):T.push($?p[V]:E.call.bind(p[V])):P(a,l,p)),b}function et(a){return P(a,L,{configurable:!0,enumerable:!0,value:c})}return s!==void 0&&(c=s[L]),c=j(c??null),y=[],I=function(a){a&&y.push(W(a))},m=function(a,A){for(var g=0;g<e.length;g++){var l=e[g],h=l[1],S=7&h;if((8&h)==a&&!S==A){var T=l[2],w=!!l[3],C=16&h;tt(a?i:i.prototype,l,C,w?"#"+T:$t(T),S,S<2?[]:a?v=v||[]:d=d||[],y,!!a,w,A,a&&w?function(R){return Xt(R)===i}:r)}}},m(8,0),m(0,0),m(8,1),m(0,1),I(d),I(v),n=y,N||et(i),{e:n,get c(){var a=[];return N&&[et(i=tt(i,[t],o,i.name,5,a)),W(a,1)]}}}function $t(i){var t=Bt(i,"string");return typeof t=="symbol"?t:t+""}function Bt(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var o=e.call(i,t||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Mt(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 Xt(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 k={label:"Carousel",transition:"none",controlsVariant:"toolbar"},Kt=48,Ut,jt=class extends Dt{static{({e:[ht,pt,ft,yt,bt,_t,vt,mt,gt,wt,xt,At,St,It,Ct,Rt,Pt,Et,Vt,Lt,Tt,kt,ct],c:[Ut,dt]}=Wt(this,[Yt("rui-carousel")],[[x({type:String,defaultValue:k.label}),0,"label"],[x({type:Number,reflect:!0,defaultValue:0}),0,"index"],[x({type:Boolean,reflect:!0,defaultValue:!1}),0,"autoplay"],[x({type:Number,defaultValue:4e3}),0,"interval"],[x({type:String,defaultValue:k.transition}),0,"transition"],[x({type:String,defaultValue:k.controlsVariant,attribute:"controls-variant"}),0,"controlsVariant"],[x({type:Boolean,defaultValue:!1}),0,"showIndicators"],[x({type:Boolean,defaultValue:!1}),0,"showRotationControl"],[x({type:Boolean,defaultValue:!0}),0,"loop"],[x({type:Boolean,defaultValue:!0}),0,"wrap"],[x({type:Number,defaultValue:0}),0,"slideCount"],[Z(["index","transition","loop","wrap","controlsVariant"]),2,"onSlideStateUpdated"],[Z(["autoplay","showRotationControl","interval"]),2,"onAutoplayUpdated"],[Z(["showIndicators"]),2,"onIndicatorsUpdated"],[_({selector:'[data-carousel-action="prev"]',type:"click"}),2,"prev"],[_({selector:'[data-carousel-action="next"]',type:"click"}),2,"next"],[_({selector:'[data-carousel-action="rotation"]',type:"click"}),2,"toggleRotation"],[_({selector:"[data-carousel-indicator]",type:"click"}),2,"onIndicatorClick"],[_({selector:"[data-carousel-indicator]",type:"keydown"}),2,"onIndicatorKeydown"],[_({ref:"root",type:"pointerenter"}),2,"onRootPointerEnter"],[_({ref:"root",type:"pointerleave"}),2,"onRootPointerLeave"],[_({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[_({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[_({ref:"viewport",type:"pointerdown"}),2,"onViewportPointerDown"],[_({ref:"viewport",type:"pointermove"}),2,"onViewportPointerMove"],[_({ref:"viewport",type:"pointerup"}),2,"onViewportPointerUp"],[_({ref:"viewport",type:"pointercancel"}),2,"onViewportPointerCancel"]],0,void 0,Dt))}label=(ct(this),ht(this));index=(pt(this),ft(this));autoplay=(yt(this),bt(this));interval=(_t(this),vt(this));transition=(mt(this),gt(this));controlsVariant=(wt(this),xt(this));showIndicators=(At(this),St(this));showRotationControl=(It(this),Ct(this));loop=(Rt(this),Pt(this));wrap=(Et(this),Vt(this));slideCount=(Lt(this),Tt(this));timer=(kt(this),null);paused=!1;userOverrideReducedMotion=!1;swipePointerId=null;swipeStartX=0;swipeStartY=0;onConnected(){this.autoplay&&this.prefersReducedMotion()&&(this.paused=!0),this.sync(),this.syncAutoplay(),this.syncIndicators(),this.syncAriaLive()}disconnectedCallback(){this.stop(),super.disconnectedCallback()}onSlideStateUpdated(){this.sync(),this.syncIndicators(),this.syncAutoplay()}onAutoplayUpdated(){this.syncAutoplay(),this.syncRotationControl()}onIndicatorsUpdated(){this.syncIndicators()}prefersReducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}getCarouselId(){return this.id||"rui-carousel"}slidePanelId(t,e){let o=t.getAttribute("data-slide")??String(e),r=`${this.getCarouselId()}-panel-${o}`;return t.id=r,r}tabId(t){return`${this.getCarouselId()}-tab-${t}`}syncSlideAccessibility(t,e){let o=t.length;t.forEach((r,s)=>{let c=s===e,n=`${s+1} of ${o}`;this.showIndicators?(this.slidePanelId(r,s),r.setAttribute("role","tabpanel"),r.setAttribute("aria-labelledby",this.tabId(s)),r.setAttribute("aria-label",n),r.removeAttribute("aria-roledescription")):(r.setAttribute("role","group"),r.setAttribute("aria-roledescription","slide"),r.setAttribute("aria-label",n),r.removeAttribute("aria-labelledby"),r.removeAttribute("tabindex")),this.transition==="none"?r.hidden=!c:r.hidden=!1,r.setAttribute("aria-hidden",String(!c)),r.setAttribute("data-active",c?"true":"false")})}getSlides(){return Array.from(this.querySelectorAll("[data-slide]"))}get shouldWrap(){return this.wrap&&this.loop}normalizeIndex(t,e){return e<=0?0:this.shouldWrap?(t%e+e)%e:Math.min(Math.max(t,0),e-1)}sync(){let t=this.getSlides();if(!t.length)return;let e=this.normalizeIndex(this.index,t.length);e!==this.index&&(this.index=e);let o=this.querySelector(".rui-carousel__track");o&&this.transition==="slide"&&o.style.setProperty("--rui-carousel-index",String(e)),this.syncSlideAccessibility(t,e),this.syncPrevNextDisabled(t.length,e)}syncPrevNextDisabled(t,e){let o=!this.shouldWrap&&t>0&&e<=0,r=!this.shouldWrap&&t>0&&e>=t-1;for(let s of this.querySelectorAll('[data-carousel-action="prev"]'))this.shouldWrap?s.removeAttribute("disabled"):s.disabled=o;for(let s of this.querySelectorAll('[data-carousel-action="next"]'))this.shouldWrap?s.removeAttribute("disabled"):s.disabled=r}syncIndicators(){let t=this.querySelector('[data-ref="indicators"]');if(!t)return;let e=this.getSlides(),o=this.normalizeIndex(this.index,e.length);Array.from(t.querySelectorAll("[data-carousel-indicator]")).length!==e.length&&t.replaceChildren(...e.map((c,n)=>{let d=document.createElement("button");return d.type="button",d.className="rui-carousel__indicator",d.id=this.tabId(n),d.setAttribute("role","tab"),d.setAttribute("data-carousel-indicator",String(n)),d.setAttribute("aria-controls",this.slidePanelId(c,n)),d.setAttribute("aria-label",`Slide ${n+1}`),d})),Array.from(t.querySelectorAll("[data-carousel-indicator]")).forEach((c,n)=>{let d=n===o,v=e[n];v&&(c.id=this.tabId(n),c.setAttribute("aria-controls",this.slidePanelId(v,n))),c.setAttribute("aria-selected",String(d)),c.tabIndex=d?0:-1})}syncRotationControl(){for(let t of this.querySelectorAll('[data-carousel-action="rotation"]')){let e=this.autoplay&&!this.paused;t.setAttribute("aria-pressed",String(e)),t.setAttribute("aria-label",e?"Pause rotation":"Start rotation")}}syncAriaLive(){let t=this.querySelector('[data-ref="viewport"]');if(!t)return;let e=this.autoplay&&!this.paused&&this.timer!==null;t.setAttribute("aria-live",e?"off":"polite"),t.setAttribute("aria-atomic","false")}canAutoplayRotate(){return!(!this.autoplay||this.paused||this.prefersReducedMotion()&&!this.userOverrideReducedMotion)}syncAutoplay(){this.canAutoplayRotate()?this.start():this.stop(),this.syncRotationControl(),this.syncAriaLive()}start(){let t=this.getSlides();if(!t.length)return;if(!this.shouldWrap&&this.index>=t.length-1){this.stop();return}this.stop();let e=Math.max(0,this.interval);this.timer=setInterval(()=>{let o=this.getSlides();if(o.length){if(!this.shouldWrap&&this.index>=o.length-1){this.stop(),this.syncAriaLive();return}this.goTo(this.index+1)}},e),this.syncAriaLive()}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.syncAriaLive()}goTo(t){let e=this.getSlides();e.length&&(this.index=this.normalizeIndex(t,e.length),this.sync(),this.syncIndicators())}userNavigate(t){this.paused=!0,this.stop(),this.goTo(this.index+t)}isSwipeExcludedTarget(t){return t instanceof Element?!!t.closest("button, a, input, textarea, select, [data-carousel-indicator], [data-carousel-action]"):!1}prev(){this.userNavigate(-1)}next(){this.userNavigate(1)}toggleRotation(){this.autoplay?(this.paused=!this.paused,this.paused||(this.userOverrideReducedMotion=!0)):(this.autoplay=!0,this.paused=!1,this.userOverrideReducedMotion=!0),this.syncAutoplay()}onIndicatorClick(t){let e=t.target.closest("[data-carousel-indicator]");if(!e)return;let o=Number(e.getAttribute("data-carousel-indicator"));Number.isFinite(o)&&(this.paused=!0,this.stop(),this.goTo(o),e.focus())}onIndicatorKeydown(t){let e=this.getSlides();if(!e.length)return;let o=t.target.closest("[data-carousel-indicator]");if(!o)return;let r=Number(o.getAttribute("data-carousel-indicator"));if(!Number.isFinite(r))return;if(t.key==="ArrowRight")r=this.normalizeIndex(r+1,e.length);else if(t.key==="ArrowLeft")r=this.normalizeIndex(r-1,e.length);else if(t.key==="Home")r=0;else if(t.key==="End")r=e.length-1;else if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.paused=!0,this.stop(),this.goTo(r);return}else return;t.preventDefault(),this.paused=!0,this.stop(),this.goTo(r),Array.from(this.querySelectorAll('[data-ref="indicators"] [data-carousel-indicator]'))[r]?.focus()}onRootPointerEnter(t){this.autoplay&&t.pointerType==="mouse"&&this.stop()}onRootPointerLeave(t){this.autoplay&&!this.paused&&t.pointerType==="mouse"&&this.syncAutoplay()}onRootFocusIn(){this.autoplay&&this.stop()}onRootFocusOut(t){let e=t.relatedTarget;e&&this.contains(e)||this.autoplay&&!this.paused&&this.syncAutoplay()}onViewportPointerDown(t){t.button!==0||this.isSwipeExcludedTarget(t.target)||(this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY)}onViewportPointerMove(t){this.swipePointerId,t.pointerId}onViewportPointerUp(t){if(this.swipePointerId!==t.pointerId)return;let e=t.clientX-this.swipeStartX,o=t.clientY-this.swipeStartY;this.swipePointerId=null,!(Math.abs(e)<Kt||Math.abs(e)<=Math.abs(o))&&(e<0?this.next():this.prev())}onViewportPointerCancel(t){this.swipePointerId===t.pointerId&&(this.swipePointerId=null)}static{dt()}};import{jsx as u,jsxs as D}from"@ecopages/jsx/jsx-runtime";function K(i,t){return t===void 0||i?.label!==void 0?i:{...i,label:t}}function M(...i){return i.filter(Boolean).join(" ")}function Ot({id:i,children:t,class:e,...o}){return u("div",{...o,class:M("rui-carousel__slide",e),"data-slide":i,children:t})}function Ft(){return D("span",{class:"rui-carousel__nav-label",children:[u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})}function Gt(){return D("span",{class:"rui-carousel__nav-label",children:["Next",u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})}function qt({children:i,class:t,disabled:e,overlay:o,aria:r,...s}){return u("button",{...s,aria:K(r,"Previous slide"),type:"button","data-carousel-action":"prev","data-ref":"prev",class:M("rui-carousel__nav rui-button rui-button--outline rui-button--sm",o?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",t),disabled:e,children:i??(o?u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):Ft())})}function zt({children:i,class:t,disabled:e,overlay:o,aria:r,...s}){return u("button",{...s,aria:K(r,"Next slide"),type:"button","data-carousel-action":"next","data-ref":"next",class:M("rui-carousel__nav rui-button rui-button--outline rui-button--sm",o?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",t),disabled:e,children:i??(o?u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):Gt())})}function Nt({children:i,class:t,overlay:e,aria:o,...r}){return u("button",{...r,aria:K(o,"Start rotation"),type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:M("rui-carousel__rotation rui-button rui-button--ghost rui-button--sm",e&&"rui-carousel__rotation--overlay",t),"aria-pressed":!1,children:i??"Play"})}function Ht({autoplay:i,children:t,controlsVariant:e,label:o,next:r,prev:s,rotation:c,showIndicators:n,showRotationControl:d,transition:v}){let y=e==="overlay",I=i||d,m=s??u(qt,{overlay:y}),L=r??u(zt,{overlay:y}),P=I?c??u(Nt,{overlay:y}):null,j=n?u("div",{class:M("rui-carousel__indicators",y&&"rui-carousel__indicators--overlay"),"data-ref":"indicators",role:"tablist","aria-label":"Choose slide to display"}):null,z=D("div",{class:"rui-carousel__toolbar",children:[I?u("div",{class:"rui-carousel__toolbar-rotation",children:P}):null,u("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--start",children:m}),u("div",{class:"rui-carousel__toolbar-center",children:j}),u("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--end",children:L})]}),N=y?D("div",{class:"rui-carousel__overlay-chrome",children:[I?u("div",{class:"rui-carousel__overlay-rotation",children:P}):null,D("div",{class:"rui-carousel__controls rui-carousel__controls--overlay",children:[m,L]}),j]}):null;return D("section",{class:M("rui-carousel",`rui-carousel--${v}`,`rui-carousel--controls-${e}`),"data-ref":"root","aria-roledescription":"carousel","aria-label":o,children:[u("div",{class:"rui-carousel__stage",children:D("div",{class:"rui-carousel__viewport","data-ref":"viewport",children:[u("div",{class:"rui-carousel__track",children:t}),N]})}),y?null:u("div",{class:"rui-carousel__footer",children:z})]})}function Jt({slides:i,children:t,prev:e,next:o,rotation:r,label:s=k.label,transition:c=k.transition,controlsVariant:n=k.controlsVariant,showIndicators:d,showRotationControl:v,autoplay:y,...I}){let m=i??[],L=i!=null?m.map(P=>u(Ot,{id:P.id,children:P.children})):t;return u("rui-carousel",{...I,label:s,transition:c,controlsVariant:n,showIndicators:d,showRotationControl:v,autoplay:y,slideCount:m.length,children:u(Ht,{autoplay:y,controlsVariant:n,label:s,next:o,prev:e,rotation:r,showIndicators:d,showRotationControl:v,transition:c,children:L})})}export{Jt as RuiCarousel,Ut as RuiCarouselElement,zt as RuiCarouselNext,qt as RuiCarouselPrev,Nt as RuiCarouselRotation,Ot as RuiCarouselSlide};
1
+ import{RadiantElement as $t,customElement as Zt,onEvent as b,onUpdated as Z,prop as x,query as tt}from"@ecopages/radiant";var dt,ht,pt,ft,yt,_t,bt,vt,gt,mt,wt,xt,At,It,St,Ct,Rt,Tt,Pt,Et,Vt,kt,Lt,Mt,Dt,jt,Ut,Ot,zt,Nt;function Gt(i,t,e,o,r,s){var c,a,d,v,y,S,g,V=Symbol.metadata||Symbol.for("Symbol.metadata"),T=Object.defineProperty,j=Object.create,N=[j(null),j(null)],W=t.length;function $(n,A,m){return function(l,h){A&&(h=l,l=i);for(var I=0;I<n.length;I++)h=n[I].apply(l,m?[h]:[]);return m?h:l}}function P(n,A,m,l){if(typeof n!="function"&&(l||n!==void 0))throw new TypeError(A+" must "+(m||"be")+" a function"+(l?"":" or undefined"));return n}function et(n,A,m,l,h,I,k,w,C,R,rt){function F(f){if(!rt(f))throw new TypeError("Attempted to access private element on non-instance")}var G=[].concat(A[0]),ot=A[3],H=!k,O=h===1,at=h===3,nt=h===4,q=h===2;function B(f,U,ut){return function(Y,ct){return U&&(ct=Y,Y=n),ut&&ut(Y),p[f].call(Y,ct)}}if(!H){var p={},J=[],E=at?"get":nt||O?"set":"value";if(C?(R||O?p={get:Wt(function(){return ot(this)},l,"get"),set:function(f){A[4](this,f)}}:p[E]=ot,R||Wt(p[E],l,q?"":E)):R||(p=Object.getOwnPropertyDescriptor(n,l)),!R&&!C){if((a=N[+w][l])&&(a^h)!==7)throw Error("Decorating two elements with the same name ("+p[E].name+") is not supported yet");N[+w][l]=h<3?1:h}}for(var _=n,X=G.length-1;X>=0;X-=m?2:1){var st=P(G[X],"A decorator","be",!0),lt=m?G[X-1]:void 0,Q={},z={kind:["field","accessor","method","getter","setter","class"][h],name:l,metadata:c,addInitializer:function(f,U){if(f.v)throw new TypeError("attempted to call addInitializer after decoration was finished");P(U,"An initializer","be",!0),I.push(U)}.bind(null,Q)};if(H)a=st.call(lt,_,z),Q.v=1,P(a,"class decorators","return")&&(_=a);else if(z.static=w,z.private=C,a=z.access={has:C?rt.bind():function(f){return l in f}},nt||(a.get=C?q?function(f){return F(f),p.value}:B("get",0,F):function(f){return f[l]}),q||at||(a.set=C?B("set",0,F):function(f,U){f[l]=U}),_=st.call(lt,O?{get:p.get,set:p.set}:p[E],z),Q.v=1,O){if(typeof _=="object"&&_)(a=P(_.get,"accessor.get"))&&(p.get=a),(a=P(_.set,"accessor.set"))&&(p.set=a),(a=P(_.init,"accessor.init"))&&J.unshift(a);else if(_!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else P(_,(R?"field":"method")+" decorators","return")&&(R?J.unshift(_):p[E]=_)}return h<2&&k.push($(J,w,1),$(I,w,0)),R||H||(C?O?k.splice(-1,0,B("get",w),B("set",w)):k.push(q?p[E]:P.call.bind(p[E])):T(n,l,p)),_}function it(n){return T(n,V,{configurable:!0,enumerable:!0,value:c})}return s!==void 0&&(c=s[V]),c=j(c??null),y=[],S=function(n){n&&y.push($(n))},g=function(n,A){for(var m=0;m<e.length;m++){var l=e[m],h=l[1],I=7&h;if((8&h)==n&&!I==A){var k=l[2],w=!!l[3],C=16&h;et(n?i:i.prototype,l,C,w?"#"+k:Ht(k),I,I<2?[]:n?v=v||[]:d=d||[],y,!!n,w,A,n&&w?function(R){return Qt(R)===i}:r)}}},g(8,0),g(0,0),g(8,1),g(0,1),S(d),S(v),a=y,W||it(i),{e:a,get c(){var n=[];return W&&[it(i=et(i,[t],o,i.name,5,n)),$(n,1)]}}}function Ht(i){var t=Jt(i,"string");return typeof t=="symbol"?t:t+""}function Jt(i,t){if(typeof i!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var o=e.call(i,t||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Wt(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 Qt(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 L={label:"Carousel",transition:"none",controlsVariant:"toolbar"},te=48,Bt,qt=class extends $t{static{({e:[pt,ft,yt,_t,bt,vt,gt,mt,wt,xt,At,It,St,Ct,Rt,Tt,Pt,Et,Vt,kt,Lt,Mt,Dt,jt,Ut,Ot,zt,Nt,dt],c:[Bt,ht]}=Gt(this,[Zt("rui-carousel")],[[x({type:String,defaultValue:L.label}),0,"label"],[x({type:Number,reflect:!0,defaultValue:0}),0,"index"],[x({type:Boolean,reflect:!0,defaultValue:!1}),0,"autoplay"],[x({type:Number,defaultValue:4e3}),0,"interval"],[x({type:String,defaultValue:L.transition}),0,"transition"],[x({type:String,defaultValue:L.controlsVariant,attribute:"controls-variant"}),0,"controlsVariant"],[x({type:Boolean,defaultValue:!1}),0,"showIndicators"],[x({type:Boolean,defaultValue:!1}),0,"showRotationControl"],[x({type:Boolean,defaultValue:!0}),0,"loop"],[x({type:Boolean,defaultValue:!0}),0,"wrap"],[x({type:Number,defaultValue:0}),0,"slideCount"],[tt({ref:"track"}),0,"trackTarget"],[tt({ref:"indicators"}),0,"indicatorsTarget"],[tt({ref:"viewport"}),0,"viewportTarget"],[Z(["index","transition","loop","wrap","controlsVariant"]),2,"onSlideStateUpdated"],[Z(["autoplay","showRotationControl","interval"]),2,"onAutoplayUpdated"],[Z(["showIndicators"]),2,"onIndicatorsUpdated"],[b({selector:'[data-carousel-action="prev"]',type:"click"}),2,"prev"],[b({selector:'[data-carousel-action="next"]',type:"click"}),2,"next"],[b({selector:'[data-carousel-action="rotation"]',type:"click"}),2,"toggleRotation"],[b({selector:"[data-carousel-indicator]",type:"click"}),2,"onIndicatorClick"],[b({selector:"[data-carousel-indicator]",type:"keydown"}),2,"onIndicatorKeydown"],[b({ref:"root",type:"pointerenter"}),2,"onRootPointerEnter"],[b({ref:"root",type:"pointerleave"}),2,"onRootPointerLeave"],[b({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[b({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[b({ref:"viewport",type:"pointerdown"}),2,"onViewportPointerDown"],[b({ref:"viewport",type:"pointermove"}),2,"onViewportPointerMove"],[b({ref:"viewport",type:"pointerup"}),2,"onViewportPointerUp"],[b({ref:"viewport",type:"pointercancel"}),2,"onViewportPointerCancel"]],0,void 0,$t))}label=(dt(this),pt(this));index=(ft(this),yt(this));autoplay=(_t(this),bt(this));interval=(vt(this),gt(this));transition=(mt(this),wt(this));controlsVariant=(xt(this),At(this));showIndicators=(It(this),St(this));showRotationControl=(Ct(this),Rt(this));loop=(Tt(this),Pt(this));wrap=(Et(this),Vt(this));slideCount=(kt(this),Lt(this));trackTarget=(Mt(this),Dt(this));indicatorsTarget=(jt(this),Ut(this));viewportTarget=(Ot(this),zt(this));timer=(Nt(this),null);paused=!1;userOverrideReducedMotion=!1;swipePointerId=null;swipeStartX=0;swipeStartY=0;onConnected(){this.autoplay&&this.prefersReducedMotion()&&(this.paused=!0),this.sync(),this.syncAutoplay(),this.syncIndicators(),this.syncAriaLive()}disconnectedCallback(){this.stop(),super.disconnectedCallback()}onSlideStateUpdated(){this.sync(),this.syncIndicators(),this.syncAutoplay()}onAutoplayUpdated(){this.syncAutoplay(),this.syncRotationControl()}onIndicatorsUpdated(){this.syncIndicators()}prefersReducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}getCarouselId(){return this.id||"rui-carousel"}slidePanelId(t,e){let o=t.getAttribute("data-slide")??String(e),r=`${this.getCarouselId()}-panel-${o}`;return t.id=r,r}tabId(t){return`${this.getCarouselId()}-tab-${t}`}syncSlideAccessibility(t,e){let o=t.length;t.forEach((r,s)=>{let c=s===e,a=`${s+1} of ${o}`;this.showIndicators?(this.slidePanelId(r,s),r.setAttribute("role","tabpanel"),r.setAttribute("aria-labelledby",this.tabId(s)),r.setAttribute("aria-label",a),r.removeAttribute("aria-roledescription")):(r.setAttribute("role","group"),r.setAttribute("aria-roledescription","slide"),r.setAttribute("aria-label",a),r.removeAttribute("aria-labelledby"),r.removeAttribute("tabindex")),this.transition==="none"?r.hidden=!c:r.hidden=!1,r.setAttribute("aria-hidden",String(!c)),r.setAttribute("data-active",c?"true":"false")})}getSlides(){return Array.from(this.querySelectorAll("[data-slide]"))}get shouldWrap(){return this.wrap&&this.loop}normalizeIndex(t,e){return e<=0?0:this.shouldWrap?(t%e+e)%e:Math.min(Math.max(t,0),e-1)}sync(){let t=this.getSlides();if(!t.length)return;let e=this.normalizeIndex(this.index,t.length);e!==this.index&&(this.index=e);let o=this.trackTarget;o&&this.transition==="slide"&&o.style.setProperty("--rui-carousel-index",String(e)),this.syncSlideAccessibility(t,e),this.syncPrevNextDisabled(t.length,e)}syncPrevNextDisabled(t,e){let o=!this.shouldWrap&&t>0&&e<=0,r=!this.shouldWrap&&t>0&&e>=t-1;for(let s of this.querySelectorAll('[data-carousel-action="prev"]'))this.shouldWrap?s.removeAttribute("disabled"):s.disabled=o;for(let s of this.querySelectorAll('[data-carousel-action="next"]'))this.shouldWrap?s.removeAttribute("disabled"):s.disabled=r}syncIndicators(){let t=this.indicatorsTarget;if(!t)return;let e=this.getSlides(),o=this.normalizeIndex(this.index,e.length);Array.from(t.querySelectorAll("[data-carousel-indicator]")).length!==e.length&&t.replaceChildren(...e.map((c,a)=>{let d=document.createElement("button");return d.type="button",d.className="rui-carousel__indicator",d.id=this.tabId(a),d.setAttribute("role","tab"),d.setAttribute("data-carousel-indicator",String(a)),d.setAttribute("aria-controls",this.slidePanelId(c,a)),d.setAttribute("aria-label",`Slide ${a+1}`),d})),Array.from(t.querySelectorAll("[data-carousel-indicator]")).forEach((c,a)=>{let d=a===o,v=e[a];v&&(c.id=this.tabId(a),c.setAttribute("aria-controls",this.slidePanelId(v,a))),c.setAttribute("aria-selected",String(d)),c.tabIndex=d?0:-1})}syncRotationControl(){for(let t of this.querySelectorAll('[data-carousel-action="rotation"]')){let e=this.autoplay&&!this.paused;t.setAttribute("aria-pressed",String(e)),t.setAttribute("aria-label",e?"Pause rotation":"Start rotation")}}syncAriaLive(){let t=this.viewportTarget;if(!t)return;let e=this.autoplay&&!this.paused&&this.timer!==null;t.setAttribute("aria-live",e?"off":"polite"),t.setAttribute("aria-atomic","false")}canAutoplayRotate(){return!(!this.autoplay||this.paused||this.prefersReducedMotion()&&!this.userOverrideReducedMotion)}syncAutoplay(){this.canAutoplayRotate()?this.start():this.stop(),this.syncRotationControl(),this.syncAriaLive()}start(){let t=this.getSlides();if(!t.length)return;if(!this.shouldWrap&&this.index>=t.length-1){this.stop();return}this.stop();let e=Math.max(0,this.interval);this.timer=setInterval(()=>{let o=this.getSlides();if(o.length){if(!this.shouldWrap&&this.index>=o.length-1){this.stop(),this.syncAriaLive();return}this.goTo(this.index+1)}},e),this.syncAriaLive()}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.syncAriaLive()}goTo(t){let e=this.getSlides();e.length&&(this.index=this.normalizeIndex(t,e.length),this.sync(),this.syncIndicators())}userNavigate(t){this.paused=!0,this.stop(),this.goTo(this.index+t)}isSwipeExcludedTarget(t){return t instanceof Element?!!t.closest("button, a, input, textarea, select, [data-carousel-indicator], [data-carousel-action]"):!1}prev(){this.userNavigate(-1)}next(){this.userNavigate(1)}toggleRotation(){this.autoplay?(this.paused=!this.paused,this.paused||(this.userOverrideReducedMotion=!0)):(this.autoplay=!0,this.paused=!1,this.userOverrideReducedMotion=!0),this.syncAutoplay()}onIndicatorClick(t){let e=t.target.closest("[data-carousel-indicator]");if(!e)return;let o=Number(e.getAttribute("data-carousel-indicator"));Number.isFinite(o)&&(this.paused=!0,this.stop(),this.goTo(o),e.focus())}onIndicatorKeydown(t){let e=this.getSlides();if(!e.length)return;let o=t.target.closest("[data-carousel-indicator]");if(!o)return;let r=Number(o.getAttribute("data-carousel-indicator"));if(!Number.isFinite(r))return;if(t.key==="ArrowRight")r=this.normalizeIndex(r+1,e.length);else if(t.key==="ArrowLeft")r=this.normalizeIndex(r-1,e.length);else if(t.key==="Home")r=0;else if(t.key==="End")r=e.length-1;else if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.paused=!0,this.stop(),this.goTo(r);return}else return;t.preventDefault(),this.paused=!0,this.stop(),this.goTo(r),Array.from(this.indicatorsTarget?.querySelectorAll("[data-carousel-indicator]")??[])[r]?.focus()}onRootPointerEnter(t){this.autoplay&&t.pointerType==="mouse"&&this.stop()}onRootPointerLeave(t){this.autoplay&&!this.paused&&t.pointerType==="mouse"&&this.syncAutoplay()}onRootFocusIn(){this.autoplay&&this.stop()}onRootFocusOut(t){let e=t.relatedTarget;e&&this.contains(e)||this.autoplay&&!this.paused&&this.syncAutoplay()}onViewportPointerDown(t){t.button!==0||this.isSwipeExcludedTarget(t.target)||(this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY)}onViewportPointerMove(t){this.swipePointerId,t.pointerId}onViewportPointerUp(t){if(this.swipePointerId!==t.pointerId)return;let e=t.clientX-this.swipeStartX,o=t.clientY-this.swipeStartY;this.swipePointerId=null,!(Math.abs(e)<te||Math.abs(e)<=Math.abs(o))&&(e<0?this.next():this.prev())}onViewportPointerCancel(t){this.swipePointerId===t.pointerId&&(this.swipePointerId=null)}static{ht()}};import{jsx as u,jsxs as D}from"@ecopages/jsx/jsx-runtime";function K(i,t){return t===void 0||i?.label!==void 0?i:{...i,label:t}}function M(...i){return i.filter(Boolean).join(" ")}function Xt({id:i,children:t,class:e,...o}){return u("div",{...o,class:M("rui-carousel__slide",e),"data-slide":i,children:t})}function ee(){return D("span",{class:"rui-carousel__nav-label",children:[u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})}function ie(){return D("span",{class:"rui-carousel__nav-label",children:["Next",u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})}function Yt({children:i,class:t,disabled:e,overlay:o,aria:r,...s}){return u("button",{...s,aria:K(r,"Previous slide"),type:"button","data-carousel-action":"prev","data-ref":"prev",class:M("rui-carousel__nav rui-button rui-button--outline rui-button--sm",o?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",t),disabled:e,children:i??(o?u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):ee())})}function Kt({children:i,class:t,disabled:e,overlay:o,aria:r,...s}){return u("button",{...s,aria:K(r,"Next slide"),type:"button","data-carousel-action":"next","data-ref":"next",class:M("rui-carousel__nav rui-button rui-button--outline rui-button--sm",o?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",t),disabled:e,children:i??(o?u("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):ie())})}function Ft({children:i,class:t,overlay:e,aria:o,...r}){return u("button",{...r,aria:K(o,"Start rotation"),type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:M("rui-carousel__rotation rui-button rui-button--ghost rui-button--sm",e&&"rui-carousel__rotation--overlay",t),"aria-pressed":!1,children:i??"Play"})}function re({autoplay:i,children:t,controlsVariant:e,label:o,next:r,prev:s,rotation:c,showIndicators:a,showRotationControl:d,transition:v}){let y=e==="overlay",S=i||d,g=s??u(Yt,{overlay:y}),V=r??u(Kt,{overlay:y}),T=S?c??u(Ft,{overlay:y}):null,j=a?u("div",{class:M("rui-carousel__indicators",y&&"rui-carousel__indicators--overlay"),"data-ref":"indicators",role:"tablist","aria-label":"Choose slide to display"}):null,N=D("div",{class:"rui-carousel__toolbar",children:[S?u("div",{class:"rui-carousel__toolbar-rotation",children:T}):null,u("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--start",children:g}),u("div",{class:"rui-carousel__toolbar-center",children:j}),u("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--end",children:V})]}),W=y?D("div",{class:"rui-carousel__overlay-chrome",children:[S?u("div",{class:"rui-carousel__overlay-rotation",children:T}):null,D("div",{class:"rui-carousel__controls rui-carousel__controls--overlay",children:[g,V]}),j]}):null;return D("section",{class:M("rui-carousel",`rui-carousel--${v}`,`rui-carousel--controls-${e}`),"data-ref":"root","aria-roledescription":"carousel","aria-label":o,children:[u("div",{class:"rui-carousel__stage",children:D("div",{class:"rui-carousel__viewport","data-ref":"viewport",children:[u("div",{class:"rui-carousel__track","data-ref":"track",children:t}),W]})}),y?null:u("div",{class:"rui-carousel__footer",children:N})]})}function oe({slides:i,children:t,prev:e,next:o,rotation:r,label:s=L.label,transition:c=L.transition,controlsVariant:a=L.controlsVariant,showIndicators:d,showRotationControl:v,autoplay:y,...S}){let g=i??[],V=i!=null?g.map(T=>u(Xt,{id:T.id,children:T.children})):t;return u("rui-carousel",{...S,label:s,transition:c,controlsVariant:a,showIndicators:d,showRotationControl:v,autoplay:y,slideCount:g.length,children:u(re,{autoplay:y,controlsVariant:a,label:s,next:o,prev:e,rotation:r,showIndicators:d,showRotationControl:v,transition:c,children:V})})}export{oe as RuiCarousel,Bt as RuiCarouselElement,Kt as RuiCarouselNext,Yt as RuiCarouselPrev,Ft as RuiCarouselRotation,Xt as RuiCarouselSlide};
2
2
  //# sourceMappingURL=index.js.map