@ecopages/radiant-ui 0.1.0-beta.7 → 0.1.0-beta.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.
- package/README.md +1 -1
- package/dist/components/ui/alert/alert.css +88 -50
- package/dist/components/ui/alert/alert.d.ts +43 -5
- package/dist/components/ui/alert/alert.script.d.ts +51 -4
- package/dist/components/ui/alert/index.d.ts +2 -2
- package/dist/components/ui/alert/index.js +1 -1
- package/dist/components/ui/alert/index.js.map +4 -4
- package/dist/components/ui/autocomplete/autocomplete.css +4 -4
- package/dist/components/ui/autocomplete/autocomplete.d.ts +15 -5
- package/dist/components/ui/autocomplete/autocomplete.script.d.ts +9 -0
- package/dist/components/ui/autocomplete/index.js +1 -1
- package/dist/components/ui/autocomplete/index.js.map +4 -4
- package/dist/components/ui/avatar/avatar.d.ts +15 -1
- package/dist/components/ui/avatar/index.js +1 -1
- package/dist/components/ui/avatar/index.js.map +4 -4
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +32 -6
- package/dist/components/ui/breadcrumb/index.js +1 -1
- package/dist/components/ui/breadcrumb/index.js.map +4 -4
- package/dist/{styles/components → components/ui/button}/button.css +45 -31
- package/dist/components/ui/button/button.d.ts +21 -4
- package/dist/components/ui/button-group/button-group.d.ts +7 -1
- package/dist/components/ui/button-group/index.js +1 -1
- package/dist/components/ui/button-group/index.js.map +4 -4
- package/dist/components/ui/calendar/calendar.css +7 -7
- package/dist/components/ui/calendar/calendar.d.ts +3 -2
- package/dist/components/ui/calendar/calendar.script.d.ts +39 -1
- package/dist/components/ui/calendar/index.js +1 -1
- package/dist/components/ui/calendar/index.js.map +4 -4
- package/dist/components/ui/carousel/carousel.d.ts +32 -6
- package/dist/components/ui/carousel/carousel.script.d.ts +44 -0
- package/dist/components/ui/carousel/index.js +1 -1
- package/dist/components/ui/carousel/index.js.map +4 -4
- package/dist/components/ui/checkbox/checkbox.css +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +3 -2
- package/dist/components/ui/checkbox/checkbox.script.d.ts +4 -0
- package/dist/components/ui/checkbox/index.js +1 -1
- package/dist/components/ui/checkbox/index.js.map +4 -4
- package/dist/components/ui/chip/chip.d.ts +8 -0
- package/dist/components/ui/chip/index.js +1 -1
- package/dist/components/ui/chip/index.js.map +4 -4
- package/dist/components/ui/chip-list/chip-list.d.ts +10 -2
- package/dist/components/ui/chip-list/index.js +1 -1
- package/dist/components/ui/chip-list/index.js.map +4 -4
- package/dist/components/ui/combobox/combobox.css +39 -1
- package/dist/components/ui/combobox/combobox.d.ts +15 -5
- package/dist/components/ui/combobox/combobox.script.d.ts +13 -1
- package/dist/components/ui/combobox/index.js +1 -1
- package/dist/components/ui/combobox/index.js.map +4 -4
- package/dist/components/ui/cycle-toggle/cycle-toggle.css +15 -0
- package/dist/components/ui/cycle-toggle/cycle-toggle.d.ts +29 -0
- package/dist/components/ui/cycle-toggle/cycle-toggle.script.d.ts +61 -0
- package/dist/components/ui/cycle-toggle/index.d.ts +5 -0
- package/dist/components/ui/cycle-toggle/index.js +2 -0
- package/dist/components/ui/cycle-toggle/index.js.map +7 -0
- package/dist/components/ui/cycle-toggle/theme-preference-icons.d.ts +12 -0
- package/dist/components/ui/date-field/date-field.css +37 -0
- package/dist/components/ui/date-field/date-field.d.ts +22 -3
- package/dist/components/ui/date-field/date-field.script.d.ts +29 -5
- package/dist/components/ui/date-field/index.d.ts +1 -1
- package/dist/components/ui/date-field/index.js +1 -1
- package/dist/components/ui/date-field/index.js.map +4 -4
- package/dist/components/ui/date-range-picker/date-range-picker.css +37 -0
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +37 -4
- package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +31 -5
- package/dist/components/ui/date-range-picker/index.d.ts +1 -1
- package/dist/components/ui/date-range-picker/index.js +1 -1
- package/dist/components/ui/date-range-picker/index.js.map +4 -4
- package/dist/components/ui/dialog/dialog.css +1 -1
- package/dist/components/ui/dialog/dialog.d.ts +30 -5
- package/dist/components/ui/dialog/dialog.script.d.ts +3 -0
- package/dist/components/ui/dialog/index.js +1 -1
- package/dist/components/ui/dialog/index.js.map +4 -4
- package/dist/components/ui/disclosure/disclosure-group.css +1 -1
- package/dist/components/ui/disclosure/disclosure-group.script.d.ts +6 -0
- package/dist/components/ui/disclosure/disclosure.d.ts +26 -7
- package/dist/components/ui/disclosure/disclosure.script.d.ts +5 -0
- package/dist/components/ui/disclosure/index.js +1 -1
- package/dist/components/ui/disclosure/index.js.map +4 -4
- package/dist/components/ui/feed/feed.d.ts +37 -7
- package/dist/components/ui/feed/index.js +1 -1
- package/dist/components/ui/feed/index.js.map +4 -4
- package/dist/components/ui/field/field-description.d.ts +5 -1
- package/dist/components/ui/field/field-error.d.ts +5 -0
- package/dist/components/ui/field/field.d.ts +8 -1
- package/dist/components/ui/field/field.script.d.ts +35 -0
- package/dist/components/ui/field/index.js +1 -1
- package/dist/components/ui/field/index.js.map +4 -4
- package/dist/components/ui/form/control-protocol.d.ts +6 -0
- package/dist/components/ui/form/form.d.ts +2 -1
- package/dist/components/ui/form/form.script.d.ts +16 -1
- package/dist/components/ui/form/index.d.ts +1 -1
- package/dist/components/ui/form/index.js +1 -1
- package/dist/components/ui/form/index.js.map +4 -4
- package/dist/components/ui/grid/grid.d.ts +12 -2
- package/dist/components/ui/grid/grid.script.d.ts +14 -0
- package/dist/components/ui/grid/index.js +1 -1
- package/dist/components/ui/grid/index.js.map +4 -4
- package/dist/components/ui/heading/heading.d.ts +26 -4
- package/dist/components/ui/heading/index.js +1 -1
- package/dist/components/ui/heading/index.js.map +4 -4
- package/dist/components/ui/headline/headline.d.ts +9 -1
- package/dist/components/ui/headline/index.js +1 -1
- package/dist/components/ui/headline/index.js.map +4 -4
- package/dist/components/ui/input/index.d.ts +1 -1
- package/dist/components/ui/input/index.js +1 -1
- package/dist/components/ui/input/index.js.map +4 -4
- package/dist/components/ui/input/input.css +2 -7
- package/dist/components/ui/input/input.d.ts +7 -2
- package/dist/components/ui/label/index.js +1 -1
- package/dist/components/ui/label/index.js.map +4 -4
- package/dist/components/ui/label/label.d.ts +8 -1
- package/dist/components/ui/listbox/index.js +1 -1
- package/dist/components/ui/listbox/index.js.map +4 -4
- package/dist/components/ui/listbox/listbox.css +2 -5
- package/dist/components/ui/listbox/listbox.d.ts +7 -3
- package/dist/components/ui/listbox/listbox.script.d.ts +14 -1
- package/dist/components/ui/menu-button/index.d.ts +1 -1
- package/dist/components/ui/menu-button/index.js +1 -1
- package/dist/components/ui/menu-button/index.js.map +4 -4
- package/dist/components/ui/menu-button/menu-button.css +2 -2
- package/dist/components/ui/menu-button/menu-button.d.ts +27 -5
- package/dist/components/ui/menu-button/menu-button.script.d.ts +8 -3
- package/dist/components/ui/menubar/index.js +1 -1
- package/dist/components/ui/menubar/index.js.map +4 -4
- package/dist/components/ui/menubar/menubar.css +4 -4
- package/dist/components/ui/menubar/menubar.d.ts +14 -2
- package/dist/components/ui/menubar/menubar.script.d.ts +10 -1
- package/dist/components/ui/meter/index.js +1 -1
- package/dist/components/ui/meter/index.js.map +4 -4
- package/dist/components/ui/meter/meter.css +1 -1
- package/dist/components/ui/meter/meter.d.ts +7 -2
- package/dist/components/ui/meter/meter.script.d.ts +21 -0
- package/dist/components/ui/navigation-menu/index.js +1 -1
- package/dist/components/ui/navigation-menu/index.js.map +4 -4
- package/dist/components/ui/navigation-menu/navigation-menu.css +2 -2
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +3 -2
- package/dist/components/ui/navigation-menu/navigation-menu.script.d.ts +4 -0
- package/dist/components/ui/number-field/index.d.ts +1 -1
- package/dist/components/ui/number-field/index.js +1 -1
- package/dist/components/ui/number-field/index.js.map +4 -4
- package/dist/components/ui/number-field/number-field.css +18 -3
- package/dist/components/ui/number-field/number-field.d.ts +36 -8
- package/dist/components/ui/number-field/number-field.script.d.ts +28 -1
- package/dist/components/ui/popover/index.js +1 -1
- package/dist/components/ui/popover/index.js.map +4 -4
- package/dist/components/ui/popover/popover.d.ts +5 -4
- package/dist/components/ui/popover/popover.script.d.ts +4 -0
- package/dist/components/ui/radio-group/index.d.ts +1 -1
- package/dist/components/ui/radio-group/index.js +1 -1
- package/dist/components/ui/radio-group/index.js.map +4 -4
- package/dist/components/ui/radio-group/radio-group.d.ts +29 -4
- package/dist/components/ui/radio-group/radio-group.script.d.ts +14 -9
- package/dist/components/ui/select/index.js +1 -1
- package/dist/components/ui/select/index.js.map +4 -4
- package/dist/components/ui/select/select.css +48 -6
- package/dist/components/ui/select/select.d.ts +29 -8
- package/dist/components/ui/select/select.script.d.ts +7 -0
- package/dist/components/ui/sidebar/index.js +1 -1
- package/dist/components/ui/sidebar/index.js.map +4 -4
- package/dist/components/ui/sidebar/sidebar-trigger.script.d.ts +4 -0
- package/dist/components/ui/sidebar/sidebar.css +41 -24
- package/dist/components/ui/sidebar/sidebar.d.ts +68 -14
- package/dist/components/ui/sidebar/sidebar.docs.css +5 -2
- package/dist/components/ui/sidebar/sidebar.script.d.ts +9 -0
- package/dist/components/ui/slider/index.js +1 -1
- package/dist/components/ui/slider/index.js.map +4 -4
- package/dist/components/ui/slider/slider.d.ts +2 -1
- package/dist/components/ui/slider/slider.script.d.ts +29 -1
- package/dist/components/ui/switch/index.js +1 -1
- package/dist/components/ui/switch/index.js.map +4 -4
- package/dist/components/ui/switch/switch.css +3 -3
- package/dist/components/ui/switch/switch.d.ts +11 -2
- package/dist/components/ui/switch/switch.script.d.ts +5 -0
- package/dist/components/ui/tabs/index.js +1 -1
- package/dist/components/ui/tabs/index.js.map +4 -4
- package/dist/components/ui/tabs/tabs.css +9 -10
- package/dist/components/ui/tabs/tabs.d.ts +30 -9
- package/dist/components/ui/tag-group/index.js +1 -1
- package/dist/components/ui/tag-group/index.js.map +4 -4
- package/dist/components/ui/tag-group/tag-group.css +2 -11
- package/dist/components/ui/tag-group/tag-group.d.ts +18 -5
- package/dist/components/ui/tag-group/tag-group.script.d.ts +9 -2
- package/dist/components/ui/textarea/index.d.ts +1 -1
- package/dist/components/ui/textarea/index.js +1 -1
- package/dist/components/ui/textarea/index.js.map +4 -4
- package/dist/components/ui/textarea/textarea.d.ts +7 -2
- package/dist/components/ui/toast/index.d.ts +1 -1
- package/dist/components/ui/toast/index.js +1 -1
- package/dist/components/ui/toast/index.js.map +4 -4
- package/dist/components/ui/toast/stack-layout.d.ts +18 -0
- package/dist/components/ui/toast/toast-context.d.ts +10 -0
- package/dist/components/ui/toast/toast.css +30 -9
- package/dist/components/ui/toast/toast.d.ts +12 -2
- package/dist/components/ui/toast/toast.script.d.ts +60 -4
- package/dist/components/ui/toast/toaster.script.d.ts +71 -2
- package/dist/components/ui/toc/index.js +1 -1
- package/dist/components/ui/toc/index.js.map +4 -4
- package/dist/components/ui/toc/toc.css +3 -0
- package/dist/components/ui/toc/toc.d.ts +2 -1
- package/dist/components/ui/toc/toc.script.d.ts +15 -0
- package/dist/components/ui/toolbar/index.js +1 -1
- package/dist/components/ui/toolbar/index.js.map +4 -4
- package/dist/components/ui/toolbar/toolbar.d.ts +3 -2
- package/dist/components/ui/toolbar/toolbar.script.d.ts +8 -0
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/components/ui/tooltip/index.js.map +4 -4
- package/dist/components/ui/tooltip/tooltip.d.ts +3 -2
- package/dist/components/ui/tooltip/tooltip.script.d.ts +3 -0
- package/dist/components/ui/tree/index.js +1 -1
- package/dist/components/ui/tree/index.js.map +4 -4
- package/dist/components/ui/tree/tree.d.ts +12 -2
- package/dist/components/ui/tree/tree.script.d.ts +18 -1
- package/dist/components/ui/treegrid/index.js +1 -1
- package/dist/components/ui/treegrid/index.js.map +4 -4
- package/dist/components/ui/treegrid/treegrid.d.ts +15 -2
- package/dist/components/ui/treegrid/treegrid.script.d.ts +22 -1
- package/dist/components/ui/window-splitter/index.js +1 -1
- package/dist/components/ui/window-splitter/index.js.map +4 -4
- package/dist/components/ui/window-splitter/window-splitter.css +1 -1
- package/dist/components/ui/window-splitter/window-splitter.d.ts +3 -2
- package/dist/components/ui/window-splitter/window-splitter.script.d.ts +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/cycle-value.d.ts +8 -0
- package/dist/lib/intl-number/range.d.ts +8 -0
- package/dist/styles/radiant-ui-core.css +110 -341
- package/dist/styles/radiant-ui.css +413 -377
- package/dist/styles/styles.css +839 -2731
- package/dist/styles/tailwind.css +626 -530
- package/dist/styles/tokens/colors/aurora.css +2 -2
- package/dist/styles/tokens/colors/basalt.css +2 -1
- package/dist/styles/tokens/colors/glacier.css +2 -1
- package/dist/styles/tokens/presets/colors/aurora.css +42 -14
- package/dist/styles/tokens/presets/colors/basalt.css +28 -0
- package/dist/styles/tokens/presets/colors/ember.css +28 -0
- package/dist/styles/tokens/presets/colors/glacier.css +28 -0
- package/dist/styles/tokens/semantic.css +22 -2
- package/dist/styles/tokens/spacing/compact.css +12 -12
- package/package.json +21 -8
- package/dist/components/ui/dialog/dialog-registry.test.d.ts +0 -1
- package/dist/components/ui/field/field-ssr-hydration.test.d.ts +0 -1
- package/dist/components/ui/form/form-field.test.d.ts +0 -4
- package/dist/components/ui/form/form-store.test.d.ts +0 -1
- package/dist/components/ui/shared/collection-navigation.test.d.ts +0 -1
- package/dist/components/ui/shared/floating-position.test.d.ts +0 -1
- package/dist/components/ui/shared/listbox-popover-behavior.test.d.ts +0 -1
- package/dist/components/ui/shared/popover-controller.test.d.ts +0 -1
- package/dist/components/ui/shared/portal.test.d.ts +0 -1
- package/dist/components/ui/sidebar/sidebar.ssr.test.d.ts +0 -2
- package/dist/components/ui/sidebar/sidebar.test.d.ts +0 -1
- package/dist/components/ui/toast/toast.test.d.ts +0 -2
- package/dist/components/ui/toc/toc-helpers.test.d.ts +0 -1
- package/dist/components/ui/toc/toc.ssr.test.d.ts +0 -1
- package/dist/components/ui/toc/toc.test.d.ts +0 -1
- package/dist/lib/intl-date/parts.test.d.ts +0 -1
- package/dist/lib/intl-date/segments.test.d.ts +0 -1
- package/dist/lib/intl-date/selection.test.d.ts +0 -1
- package/dist/lib/mask/date-mask.test.d.ts +0 -1
- package/dist/lib/mask/input-mask.test.d.ts +0 -1
- package/dist/lib/radiant-view.d.ts +0 -43
- package/dist/lib/text-filter.test.d.ts +0 -1
- package/dist/styles/tokens/presets/radius.css +0 -45
- package/dist/styles/tokens/presets/spacing.css +0 -57
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer components {
|
|
4
|
+
.rui-icon {
|
|
5
|
+
width: var(--size-icon-sm);
|
|
6
|
+
height: var(--size-icon-sm);
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
.rui-icon--md {
|
|
10
|
+
width: var(--size-icon-md);
|
|
11
|
+
height: var(--size-icon-md);
|
|
12
|
+
}
|
|
13
|
+
.rui-control-toggle {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
height: var(--spacing-8, var(--space-8));
|
|
16
|
+
width: var(--spacing-8, var(--space-8));
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
21
|
+
border-style: var(--tw-border-style);
|
|
22
|
+
border-width: 0px;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
color: var(--color-on-surface, var(--on-surface));
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
.rui-control-toggle:hover:not(:disabled) {
|
|
28
|
+
background-color: var(--color-surface-container-low, var(--surface-container-low));
|
|
29
|
+
}
|
|
30
|
+
.rui-control-toggle:focus-visible {
|
|
31
|
+
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
32
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
33
|
+
--tw-ring-color: var(--color-focus-ring, var(--focus-ring));
|
|
34
|
+
--tw-outline-style: none;
|
|
35
|
+
outline-style: none;
|
|
36
|
+
}
|
|
37
|
+
.rui-control-toggle:disabled {
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
opacity: var(--opacity-muted, var(--opacity-muted));
|
|
40
|
+
}
|
|
4
41
|
.rui-floating {
|
|
5
42
|
position: fixed;
|
|
6
43
|
visibility: hidden;
|
|
@@ -33,12 +70,13 @@
|
|
|
33
70
|
rui-combobox {
|
|
34
71
|
position: relative;
|
|
35
72
|
display: inline-flex;
|
|
73
|
+
width: 100%;
|
|
36
74
|
flex-direction: column;
|
|
37
75
|
}
|
|
38
76
|
@layer components {
|
|
39
77
|
.rui-combobox {
|
|
40
78
|
position: relative;
|
|
41
|
-
width:
|
|
79
|
+
width: 100%;
|
|
42
80
|
font-size: var(--text-sm, var(--text-sm));
|
|
43
81
|
line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
|
|
44
82
|
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import type { JsxHtmlProps, JsxHtmlPropsWithChildren } from '@ecopages/jsx';
|
|
2
2
|
import { RuiListboxOption, type RuiListboxOptionData } from '../listbox';
|
|
3
3
|
import type { RuiComboboxProps } from './combobox.script';
|
|
4
|
+
import './combobox.script';
|
|
4
5
|
export type RuiComboboxControlProps = JsxHtmlPropsWithChildren<{
|
|
5
6
|
slot?: string;
|
|
6
7
|
}>;
|
|
7
|
-
/** Input row wrapper for the combobox input and toggle button.
|
|
8
|
+
/** Input row wrapper for the combobox input and toggle button.
|
|
9
|
+
*
|
|
10
|
+
* @cssclass rui-combobox__control - Bordered control-height row.
|
|
11
|
+
*/
|
|
8
12
|
export declare function RuiComboboxControl({ children, slot, class: className, ...props }: RuiComboboxControlProps): import("@ecopages/jsx").JsxRenderable;
|
|
9
13
|
export type RuiComboboxInputProps = JsxHtmlProps<{
|
|
10
14
|
placeholder?: string;
|
|
11
15
|
disabled?: boolean;
|
|
12
16
|
}>;
|
|
13
|
-
/** Text input with `role="combobox"`. Place inside `RuiComboboxControl`.
|
|
17
|
+
/** Text input with `role="combobox"`. Place inside `RuiComboboxControl`.
|
|
18
|
+
*
|
|
19
|
+
* @cssclass rui-combobox__input - Combobox text input.
|
|
20
|
+
*/
|
|
14
21
|
export declare function RuiComboboxInput({ placeholder, disabled, class: className, ...props }: RuiComboboxInputProps): import("@ecopages/jsx").JsxRenderable;
|
|
15
22
|
export type RuiComboboxTriggerProps = JsxHtmlPropsWithChildren<{
|
|
16
23
|
'aria-label'?: string;
|
|
@@ -21,7 +28,10 @@ export declare function RuiComboboxTrigger({ children, class: className, 'aria-l
|
|
|
21
28
|
export type RuiComboboxListboxProps = JsxHtmlPropsWithChildren<{
|
|
22
29
|
slot?: string;
|
|
23
30
|
}>;
|
|
24
|
-
/** Popup shell slotted into `listbox`. Place an embedded `RuiListbox` inside.
|
|
31
|
+
/** Popup shell slotted into `listbox`. Place an embedded `RuiListbox` inside.
|
|
32
|
+
*
|
|
33
|
+
* @cssclass rui-combobox__listbox - Popup shell (adds `rui-popover rui-popover--listbox rui-floating`).
|
|
34
|
+
*/
|
|
25
35
|
export declare function RuiComboboxListbox({ children, slot, class: className, ...props }: RuiComboboxListboxProps): import("@ecopages/jsx").JsxRenderable;
|
|
26
36
|
export type RuiComboboxOptionData = RuiListboxOptionData;
|
|
27
37
|
/** @deprecated Use `RuiListboxOption` */
|
|
@@ -30,7 +40,7 @@ export declare const RuiComboboxOption: typeof RuiListboxOption;
|
|
|
30
40
|
* Combobox view. Pair with `RuiLabel` (sibling or via `RuiField`) for the visible name —
|
|
31
41
|
* do not nest a combobox-specific label.
|
|
32
42
|
*/
|
|
33
|
-
export declare
|
|
43
|
+
export declare function RuiCombobox({ options, children, ...props }: JsxHtmlPropsWithChildren<RuiComboboxProps & {
|
|
34
44
|
slot?: string;
|
|
35
45
|
options?: RuiComboboxOptionData[];
|
|
36
|
-
}
|
|
46
|
+
}>): import("@ecopages/jsx").JsxRenderable;
|
|
@@ -29,10 +29,21 @@ export type RuiComboboxChangeDetail = {
|
|
|
29
29
|
*
|
|
30
30
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
31
31
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/
|
|
32
|
+
*
|
|
32
33
|
* @element rui-combobox
|
|
34
|
+
*
|
|
35
|
+
* @attr {string} value - Selected option value. Default: `''`.
|
|
36
|
+
* @attr {string} label - Accessible name when there is no visible `RuiLabel`. Default: `''`.
|
|
37
|
+
* @attr {string} placeholder - Placeholder text for the input. Default: `''`.
|
|
38
|
+
* @attr {boolean} disabled - Disable the input and trigger. Default: `false`.
|
|
39
|
+
* @attr {boolean} open-on-focus - Open the listbox when the input gains focus. Default: `false`.
|
|
40
|
+
*
|
|
33
41
|
* @slot control - Input row (`RuiComboboxControl` with input and trigger).
|
|
34
42
|
* @slot listbox - Popup shell (`RuiComboboxListbox`) containing an embedded `RuiListbox`.
|
|
35
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* @fires rui-change - Emitted when an option is selected; detail carries `value`.
|
|
45
|
+
*
|
|
46
|
+
* @cssclass rui-combobox - Root surface.
|
|
36
47
|
*/
|
|
37
48
|
export declare class RuiCombobox extends RadiantElement {
|
|
38
49
|
value: string;
|
|
@@ -77,6 +88,7 @@ export declare class RuiCombobox extends RadiantElement {
|
|
|
77
88
|
disconnectedCallback(): void;
|
|
78
89
|
onPropsUpdated(): void;
|
|
79
90
|
onRootFocusIn(event: FocusEvent): void;
|
|
91
|
+
/** @remarks Typing returns visual focus to the textbox. */
|
|
80
92
|
onRootInput(event: Event): void;
|
|
81
93
|
onRootKeydown(event: KeyboardEvent): void;
|
|
82
94
|
private handleInputKeydown;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as te,jsxs as Ne}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ee,customElement as ti,event as ei,onEvent as z,onUpdated as ii,prop as st,query as oi}from"@ecopages/radiant";function ut(e,t,i="base"){if(!t)return!0;if(i==="case")return e.includes(t);let o=new Intl.Collator(void 0,{sensitivity:i==="accent"?"accent":"base",usage:"search"});for(let n=0;n<=e.length-t.length;n+=1){let c=e.slice(n,n+t.length);if(o.compare(c,t)===0)return!0}return!1}function bt(e){let t=e.previousElementSibling;return t?.tagName.toLowerCase()==="label"?t:e.parentElement?.querySelector("[data-rui-field-label], label.rui-label")??null}function Et(e,t,i){if(!t||t.hasAttribute("data-rui-field-managed"))return;let o=bt(e);if(o){o.id||(o.id=i.labelId),o.htmlFor||(o.htmlFor=i.controlId),t.setAttribute("aria-labelledby",o.id),t.removeAttribute("aria-label");return}if(i.label){t.setAttribute("aria-label",i.label),t.removeAttribute("aria-labelledby");return}t.removeAttribute("aria-label"),t.removeAttribute("aria-labelledby")}var Ue={top:"bottom",bottom:"top",left:"right",right:"left"},We=8;function Ke(e){let t=e.indexOf("-");if(t===-1)return{side:e,align:"center"};let i=e.slice(0,t),o=e.slice(t+1);return{side:i,align:o==="start"||o==="end"?o:"center"}}function St(e){return e==="top"||e==="bottom"?"y":"x"}function Ct(e,t,i,o,n){let{width:c,height:a}=t,l=0,v=0;switch(i){case"top":v=e.top-a-n;break;case"bottom":v=e.bottom+n;break;case"left":l=e.left-c-n;break;case"right":l=e.right+n;break}return St(i)==="y"?o==="start"?l=e.left:o==="end"?l=e.right-c:l=e.left+(e.width-c)/2:o==="start"?v=e.top:o==="end"?v=e.bottom-a:v=e.top+(e.height-a)/2,{x:l,y:v}}function $e(e,t,i,o){let{padding:n,width:c,height:a}=o;return i==="top"?Math.max(0,n-e.y):i==="bottom"?Math.max(0,e.y+t.height-(a-n)):i==="left"?Math.max(0,n-e.x):Math.max(0,e.x+t.width-(c-n))}function Rt(e,t,i,o){let{padding:n,width:c,height:a}=o;return i==="top"?e.top-n-t.height:i==="bottom"?a-n-t.height-e.bottom:i==="left"?e.left-n-t.width:c-n-t.width-e.right}function He(e,t){return t==="center"?e:`${e}-${t}`}function ze(e,t,i,o){let{padding:n,width:c,height:a}=o;if(St(i)==="y"){let v=Math.max(n,c-n-t.width);return{x:Math.min(Math.max(e.x,n),v),y:e.y}}let l=Math.max(n,a-n-t.height);return{x:e.x,y:Math.min(Math.max(e.y,n),l)}}function Qe(e,t,i,o,n={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:We}){let{side:c,align:a}=Ke(i),l=Ct(e,t,c,a,o),v=$e(l,t,c,n),E=c,C=l;if(v>0){let F=Ue[c],I=Ct(e,t,F,a,o),$=Rt(e,t,c,n);Rt(e,t,F,n)>$&&(E=F,C=I)}return{coords:ze(C,t,E,n),placement:He(E,a)}}function Xe(e,t,i,o,n={}){let{coords:c,placement:a}=Qe(e.getBoundingClientRect(),{width:t.offsetWidth,height:t.offsetHeight},i,o);return Object.assign(t.style,{position:"fixed",left:`${c.x}px`,top:`${c.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),n.matchAnchorWidth&&(t.style.width=`${e.offsetWidth}px`),t.setAttribute("data-placement",a),a}function Ft({anchor:e,floating:t,getPlacement:i,gap:o,matchAnchorWidth:n}){let c=()=>{t.hidden||Xe(e,t,i(),o,{matchAnchorWidth:n})};c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0);let a=new ResizeObserver(c);return a.observe(e),a.observe(t),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0),a.disconnect()}}function Dt(e,t=document.body){let i=e.parentNode;if(!i)return{unmount:()=>{}};let o=document.createComment("rui-portal");return i.insertBefore(o,e),t.appendChild(e),{unmount:()=>{let n=o.parentNode;n&&(n.insertBefore(e,o),o.remove())}}}function mt(e,t,i){return i?!!(e?.contains(i)||t?.contains(i)):!1}function Lt(e,t,i){return i instanceof Node?!mt(e,t,i):!0}function kt(e,t,i){return!mt(e,t,i)}var ct=class{config;cleanupFloating=null;portalHandle=null;floatingElement=null;constructor(t){this.config=t}updateConfig(t){this.config={...this.config,...t}}sync(){let t=this.resolveFloating();if(!t)return;if(!this.config.getOpen()){this.teardown(),t.hidden=!0;return}let o=this.config.getAnchor();if(!o)return;t.hidden=!1,this.config.portal!==!1?this.portalHandle||(this.portalHandle=Dt(t,this.config.portalContainer??document.body)):this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null),this.teardownFloating(),this.cleanupFloating=Ft({anchor:o,floating:t,getPlacement:this.config.getPlacement,gap:this.config.gap??8,matchAnchorWidth:this.config.matchAnchorWidth})}contains(t){return mt(this.config.getAnchor(),this.resolveFloating(),t)}getFloatingElement(){return this.resolveFloating()}teardown(){this.teardownFloating(),this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null)}destroy(){this.teardown(),this.floatingElement=null}resolveFloating(){let t=this.config.getFloating();return t&&(this.floatingElement=t),t??this.floatingElement}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}};function Vt(e){return e.filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}function Tt(e,t,i){return i===0?-1:t===1?e>=i-1?0:e+1:e<=0?i-1:e-1}function gt(e,t){t?.removeAttribute("aria-activedescendant");for(let i of e)i.removeAttribute("data-active")}function jt(e,t,i,o,n){gt(e,o);let c=t[i];return!c||!o?null:(c.id||(c.id=`${n}-${i}`),c.setAttribute("data-active","true"),o.setAttribute("aria-activedescendant",c.id),c.scrollIntoView({block:"nearest"}),c)}var pt=class{config;popoverController;activeIndex=-1;visualFocus=!1;constructor(t){this.config=t,this.popoverController=new ct({getAnchor:t.getAnchor,getFloating:t.getFloating,getOpen:t.getOpen,getPlacement:()=>"bottom-start",gap:4,portal:!1,matchAnchorWidth:!0})}get activeOptionIndex(){return this.activeIndex}get hasVisualFocus(){return this.visualFocus}ensureOptionIds(){this.config.getOptions().forEach((t,i)=>{t.id||(t.id=`${this.config.getOptionIdPrefix()}-${i}`)})}getVisibleOptions(){return Vt(this.config.getOptions())}clearActiveOption(){this.activeIndex=-1,this.visualFocus=!1,gt(this.config.getOptions(),this.config.getActiveDescendantHost())}setActiveOption(t){let i=this.getVisibleOptions();if(t<0||t>=i.length){this.clearActiveOption();return}this.activeIndex=t,this.visualFocus=!0,jt(this.config.getOptions(),i,t,this.config.getActiveDescendantHost(),this.config.getOptionIdPrefix())}moveActive(t,i){let o=this.getVisibleOptions();if(o.length){if(!this.config.getOpen()){i(t===1?"first":"last");return}if(this.visualFocus){this.setActiveOption(Tt(this.activeIndex,t,o.length));return}this.setActiveOption(t===1?0:o.length-1)}}handleKeydown(t,i){if(!(t.ctrlKey||t.shiftKey||t.metaKey)){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();let o=t.key==="ArrowDown"?1:-1;if(t.altKey){o===1&&!i.isOpen?i.onOpen():o===-1&&i.isOpen&&i.onClose("arrow");return}this.moveActive(o,n=>i.onOpen(n));return}if(t.key==="Escape"){t.preventDefault(),i.isOpen?i.onClose("escape"):i.onEscapeWhenClosed?.();return}if(t.key==="Enter"||t.key===" "&&i.canUseSpace){if(!i.isOpen&&i.enterWhenClosed==="open"){t.preventDefault(),i.onOpen();return}let o=this.getVisibleOptions();i.isOpen&&this.visualFocus&&o[this.activeIndex]?(t.preventDefault(),i.onSelectActive()):t.key==="Enter"&&i.isOpen&&i.enterWithoutActive==="close"&&(t.preventDefault(),i.onClose("enter"));return}if(t.key==="Tab"&&i.isOpen){let o=this.getVisibleOptions();if(this.visualFocus&&o[this.activeIndex]&&i.closesOnTab){i.onSelectActive();return}i.onClose("tab")}}}syncPopoverPosition(){this.popoverController.sync()}shouldDismissFocus(t){return Lt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}shouldDismissPointer(t){return kt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}destroy(){this.popoverController.destroy()}};var Bt,Pt,Mt,qt,Ut,Wt,Kt,$t,Ht,zt,Qt,Xt,Gt,Yt,Jt,Zt;function Ge(e,t,i,o,n,c){var a,l,v,E,C,F,I,$=Symbol.metadata||Symbol.for("Symbol.metadata"),H=Object.defineProperty,P=Object.create,Q=[P(null),P(null)],X=t.length;function D(r,m,f){return function(s,u){m&&(u=s,s=e);for(var g=0;g<r.length;g++)u=r[g].apply(s,f?[u]:[]);return f?u:s}}function w(r,m,f,s){if(typeof r!="function"&&(s||r!==void 0))throw new TypeError(m+" must "+(f||"be")+" a function"+(s?"":" or undefined"));return r}function G(r,m,f,s,u,g,A,b,x,y,J){function M(d){if(!J(d))throw new TypeError("Attempted to access private element on non-instance")}var q=[].concat(m[0]),Z=m[3],U=!A,R=u===1,N=u===3,tt=u===4,L=u===2;function k(d,_,ot){return function(T,nt){return _&&(nt=T,T=r),ot&&ot(T),p[d].call(T,nt)}}if(!U){var p={},W=[],O=N?"get":tt||R?"set":"value";if(x?(y||R?p={get:Nt(function(){return Z(this)},s,"get"),set:function(d){m[4](this,d)}}:p[O]=Z,y||Nt(p[O],s,L?"":O)):y||(p=Object.getOwnPropertyDescriptor(r,s)),!y&&!x){if((l=Q[+b][s])&&(l^u)!==7)throw Error("Decorating two elements with the same name ("+p[O].name+") is not supported yet");Q[+b][s]=u<3?1:u}}for(var h=r,V=q.length-1;V>=0;V-=f?2:1){var et=w(q[V],"A decorator","be",!0),it=f?q[V-1]:void 0,K={},S={kind:["field","accessor","method","getter","setter","class"][u],name:s,metadata:a,addInitializer:function(d,_){if(d.v)throw new TypeError("attempted to call addInitializer after decoration was finished");w(_,"An initializer","be",!0),g.push(_)}.bind(null,K)};if(U)l=et.call(it,h,S),K.v=1,w(l,"class decorators","return")&&(h=l);else if(S.static=b,S.private=x,l=S.access={has:x?J.bind():function(d){return s in d}},tt||(l.get=x?L?function(d){return M(d),p.value}:k("get",0,M):function(d){return d[s]}),L||N||(l.set=x?k("set",0,M):function(d,_){d[s]=_}),h=et.call(it,R?{get:p.get,set:p.set}:p[O],S),K.v=1,R){if(typeof h=="object"&&h)(l=w(h.get,"accessor.get"))&&(p.get=l),(l=w(h.set,"accessor.set"))&&(p.set=l),(l=w(h.init,"accessor.init"))&&W.unshift(l);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else w(h,(y?"field":"method")+" decorators","return")&&(y?W.unshift(h):p[O]=h)}return u<2&&A.push(D(W,b,1),D(g,b,0)),y||U||(x?R?A.splice(-1,0,k("get",b),k("set",b)):A.push(L?p[O]:w.call.bind(p[O])):H(r,s,p)),h}function Y(r){return H(r,$,{configurable:!0,enumerable:!0,value:a})}return c!==void 0&&(a=c[$]),a=P(a??null),C=[],F=function(r){r&&C.push(D(r))},I=function(r,m){for(var f=0;f<i.length;f++){var s=i[f],u=s[1],g=7&u;if((8&u)==r&&!g==m){var A=s[2],b=!!s[3],x=16&u;G(r?e:e.prototype,s,x,b?"#"+A:Ye(A),g,g<2?[]:r?E=E||[]:v=v||[],C,!!r,b,m,r&&b?function(y){return Ze(y)===e}:n)}}},I(8,0),I(0,0),I(8,1),I(0,1),F(v),F(E),l=C,X||Y(e),{e:l,get c(){var r=[];return X&&[Y(e=G(e,[t],o,e.name,5,r)),D(r,1)]}}}function Ye(e){var t=Je(e,"string");return typeof t=="symbol"?t:t+""}function Je(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var o=i.call(e,t||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nt(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 Ze(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 dt,ie=class extends ee{static{({e:[Mt,qt,Ut,Wt,Kt,$t,Ht,zt,Qt,Xt,Gt,Yt,Jt,Zt,Bt],c:[dt,Pt]}=Ge(this,[ti("rui-combobox")],[[st({type:String,reflect:!0,defaultValue:""}),0,"value"],[st({type:String,defaultValue:""}),0,"label"],[st({type:String,defaultValue:""}),0,"placeholder"],[st({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[st({type:Boolean,reflect:!0,defaultValue:!1}),0,"openOnFocus"],[ei({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[oi({ref:"root"}),0,"rootTarget"],[ii(["value","label","placeholder","disabled","openOnFocus"]),2,"onPropsUpdated"],[z({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[z({ref:"root",type:"input"}),2,"onRootInput"],[z({ref:"root",type:"keydown",options:{capture:!0}}),2,"onRootKeydown"],[z({selector:"[data-combobox-trigger]",type:"click"}),2,"onTriggerClick"],[z({selector:'[data-combobox-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[z({selector:'[data-combobox-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[z({selector:'[data-combobox-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[z({ref:"root",type:"focusout"}),2,"onFocusOut"],[z({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,ee))}constructor(...t){super(...t),Zt(this)}value=(Bt(this),Mt(this));label=(qt(this),Ut(this));placeholder=(Wt(this),Kt(this));disabled=($t(this),Ht(this));openOnFocus=(zt(this),Qt(this));changeEvent=(Xt(this),Gt(this));open=(Yt(this),!1);skipNextFocusOpen=!1;uid=Math.random().toString(36).slice(2,9);listboxBehavior=new pt({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getInput(),getOptionIdPrefix:()=>`rui-combobox-option-${this.uid}`});rootTarget=Jt(this);get listboxId(){return`rui-combobox-list-${this.uid}`}get inputId(){return`rui-combobox-input-${this.uid}`}getInput(){return this.querySelector("[data-combobox-input]")}getTrigger(){return this.querySelector("[data-combobox-trigger]")}getListboxPopup(){return this.querySelector("[data-combobox-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t instanceof HTMLElement?t.querySelector('[role="listbox"]')??t:this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return bt(this)?.textContent?.trim()||this.label||"Suggestions"}isComboboxInput(t){return t instanceof HTMLInputElement&&t.hasAttribute("data-combobox-input")}syncLabel(){let t=this.getInput();Et(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-combobox-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),i=this.getListbox();!t||!i||(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",i.id||this.listboxId),t.tabIndex=-1,this.disabled&&(t.disabled=!0))}syncInput(){let t=this.getInput(),i=this.getListbox(),o=this.getListboxPopup();!t||!i||(t.id||(t.id=this.inputId),i.id||(i.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),i.setAttribute("aria-label",this.getAccessibleName()),o&&(o.removeAttribute("role"),o.removeAttribute("aria-label")),this.placeholder&&!t.placeholder&&(t.placeholder=this.placeholder),this.disabled&&(t.disabled=!0),this.syncTrigger())}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,t.value=this.value)}syncOptionSelection(){for(let t of this.getOptions()){let o=(t.getAttribute("data-value")||this.getOptionLabel(t))===this.value&&this.value!=="";t.setAttribute("aria-selected",String(o))}}setVisualFocusCombobox(){this.listboxBehavior.clearActiveOption(),this.syncOptionSelection()}setOpen(t,i={}){let o=i.activate??"none";this.open=t;let n=this.getInput(),c=this.getListboxPopup();if(!(!n||!c)){if(n.setAttribute("aria-expanded",String(t)),c.hidden=!t,this.syncTrigger(),!t){this.listboxBehavior.clearActiveOption(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.listboxBehavior.syncPopoverPosition(),o==="first"){let a=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(a.length?0:-1);return}if(o==="last"){let a=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(a.length?a.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}getAutocomplete(){return this.querySelector("rui-autocomplete")}syncAutocompleteFilter(){let t=this.getAutocomplete();if(t){t.syncFilter();return}let i=this.getInput()?.value??"";for(let o of this.getOptions()){let n=ut(this.getOptionLabel(o),i,"base");o.hidden=i.trim()!==""&&!n}}showAllOptions(){for(let t of this.getOptions())t.hidden=!1}syncFilter(){this.syncAutocompleteFilter()}select(t){if(t.getAttribute("aria-disabled")==="true")return;let i=t.getAttribute("data-value")||this.getOptionLabel(t),o=this.getOptionLabel(t)||i;this.value=i;let n=this.getInput();n&&(n.value=o),this.changeEvent.emit({value:i}),this.syncOptionSelection(),this.skipNextFocusOpen=!0,this.setOpen(!1),n?.focus()}syncFromValue(){let t=this.getInput();if(!t)return;let i=this.getOptions().find(n=>n.getAttribute("data-value")===this.value),o=i?this.getOptionLabel(i):this.value||"";t.value=o}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection()}onRootFocusIn(t){if(this.isComboboxInput(t.target)){if(this.skipNextFocusOpen){this.skipNextFocusOpen=!1;return}this.openOnFocus&&(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox())}}onRootInput(t){if(!this.isComboboxInput(t.target))return;let i=t.target;this.syncFilter(),i.value.trim()!==""&&this.listboxBehavior.getVisibleOptions().length?this.setOpen(!0):i.value.trim()===""&&this.openOnFocus?this.setOpen(!0):(i.value.trim()===""||!this.listboxBehavior.getVisibleOptions().length)&&this.setOpen(!1),this.setVisualFocusCombobox()}onRootKeydown(t){this.isComboboxInput(t.target)&&this.handleInputKeydown(t)}handleInputKeydown(t){if(t.key==="Home"){let i=this.getInput();if(!i)return;t.preventDefault(),i.setSelectionRange(0,0),this.setVisualFocusCombobox();return}if(t.key==="End"){let i=this.getInput();if(!i)return;t.preventDefault();let o=i.value.length;i.setSelectionRange(o,o),this.setVisualFocusCombobox();return}(t.key==="ArrowDown"||t.key==="ArrowUp")&&(this.syncFilter(),this.listboxBehavior.getVisibleOptions().length||this.showAllOptions()),this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!1,closesOnTab:!0,enterWhenClosed:"ignore",enterWithoutActive:"close",onOpen:(i="none")=>{this.syncFilter(),this.setOpen(!0,{activate:i})},onClose:()=>this.setOpen(!1),onSelectActive:()=>{let i=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];i&&this.select(i)},onEscapeWhenClosed:()=>{let i=this.getInput();i&&i.value&&(i.value="",this.value="",this.changeEvent.emit({value:""}),this.syncFilter())}})}onTriggerClick(t){t.preventDefault();let i=this.getInput();!i||i.disabled||(this.open?(this.skipNextFocusOpen=!0,this.setOpen(!1)):(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox()),i.focus())}onOptionPointerOver(t){if(!this.open)return;let i=t.target.closest('[role="option"]');if(!i||i.getAttribute("aria-disabled")==="true"||i.hidden)return;let n=this.listboxBehavior.getVisibleOptions().indexOf(i);n>=0&&this.listboxBehavior.setActiveOption(n)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let i=t.target.closest('[role="option"]');i&&this.select(i)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return Ne("div",{class:"rui-combobox","data-ref":"root",children:[te("slot",{name:"control"}),te("slot",{name:"listbox"})]})}static{Pt()}};import{jsx as B,jsxs as It}from"@ecopages/jsx/jsx-runtime";function j(...e){return e.filter(Boolean).join(" ")}import{jsx as oe}from"@ecopages/jsx/jsx-runtime";function vt({class:e,size:t="sm",...i}){return oe("svg",{...i,class:j("rui-icon",t==="md"&&"rui-icon--md",e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:oe("path",{d:"m6 9 6 6 6-6"})})}var ni=Symbol.for("@ecopages/storybook-radiant.viewElement"),ne=Symbol.for("@ecopages/storybook-radiant.scriptModule"),re=Symbol.for("@ecopages/storybook-radiant.scriptExport");function ri(e,t){e[ni]=t;let i=t[ne];i&&(e[ne]=i,e[re]=t[re]??t.name)}function rt(e,t,i){let o=n=>t(n);return ri(o,e),o}import{jsx as he,jsxs as ci}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as fe,customElement as pi,onEvent as di,onUpdated as hi,prop as be}from"@ecopages/radiant";var se,le,ae,ue,ce,pe;function si(e,t,i,o,n,c){var a,l,v,E,C,F,I,$=Symbol.metadata||Symbol.for("Symbol.metadata"),H=Object.defineProperty,P=Object.create,Q=[P(null),P(null)],X=t.length;function D(r,m,f){return function(s,u){m&&(u=s,s=e);for(var g=0;g<r.length;g++)u=r[g].apply(s,f?[u]:[]);return f?u:s}}function w(r,m,f,s){if(typeof r!="function"&&(s||r!==void 0))throw new TypeError(m+" must "+(f||"be")+" a function"+(s?"":" or undefined"));return r}function G(r,m,f,s,u,g,A,b,x,y,J){function M(d){if(!J(d))throw new TypeError("Attempted to access private element on non-instance")}var q=[].concat(m[0]),Z=m[3],U=!A,R=u===1,N=u===3,tt=u===4,L=u===2;function k(d,_,ot){return function(T,nt){return _&&(nt=T,T=r),ot&&ot(T),p[d].call(T,nt)}}if(!U){var p={},W=[],O=N?"get":tt||R?"set":"value";if(x?(y||R?p={get:de(function(){return Z(this)},s,"get"),set:function(d){m[4](this,d)}}:p[O]=Z,y||de(p[O],s,L?"":O)):y||(p=Object.getOwnPropertyDescriptor(r,s)),!y&&!x){if((l=Q[+b][s])&&(l^u)!==7)throw Error("Decorating two elements with the same name ("+p[O].name+") is not supported yet");Q[+b][s]=u<3?1:u}}for(var h=r,V=q.length-1;V>=0;V-=f?2:1){var et=w(q[V],"A decorator","be",!0),it=f?q[V-1]:void 0,K={},S={kind:["field","accessor","method","getter","setter","class"][u],name:s,metadata:a,addInitializer:function(d,_){if(d.v)throw new TypeError("attempted to call addInitializer after decoration was finished");w(_,"An initializer","be",!0),g.push(_)}.bind(null,K)};if(U)l=et.call(it,h,S),K.v=1,w(l,"class decorators","return")&&(h=l);else if(S.static=b,S.private=x,l=S.access={has:x?J.bind():function(d){return s in d}},tt||(l.get=x?L?function(d){return M(d),p.value}:k("get",0,M):function(d){return d[s]}),L||N||(l.set=x?k("set",0,M):function(d,_){d[s]=_}),h=et.call(it,R?{get:p.get,set:p.set}:p[O],S),K.v=1,R){if(typeof h=="object"&&h)(l=w(h.get,"accessor.get"))&&(p.get=l),(l=w(h.set,"accessor.set"))&&(p.set=l),(l=w(h.init,"accessor.init"))&&W.unshift(l);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else w(h,(y?"field":"method")+" decorators","return")&&(y?W.unshift(h):p[O]=h)}return u<2&&A.push(D(W,b,1),D(g,b,0)),y||U||(x?R?A.splice(-1,0,k("get",b),k("set",b)):A.push(L?p[O]:w.call.bind(p[O])):H(r,s,p)),h}function Y(r){return H(r,$,{configurable:!0,enumerable:!0,value:a})}return c!==void 0&&(a=c[$]),a=P(a??null),C=[],F=function(r){r&&C.push(D(r))},I=function(r,m){for(var f=0;f<i.length;f++){var s=i[f],u=s[1],g=7&u;if((8&u)==r&&!g==m){var A=s[2],b=!!s[3],x=16&u;G(r?e:e.prototype,s,x,b?"#"+A:li(A),g,g<2?[]:r?E=E||[]:v=v||[],C,!!r,b,m,r&&b?function(y){return ui(y)===e}:n)}}},I(8,0),I(0,0),I(8,1),I(0,1),F(v),F(E),l=C,X||Y(e),{e:l,get c(){var r=[];return X&&[Y(e=G(e,[t],o,e.name,5,r)),D(r,1)]}}}function li(e){var t=ai(e,"string");return typeof t=="symbol"?t:t+""}function ai(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var o=i.call(e,t||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function de(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 ui(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 xt,me=class extends fe{static{({e:[ae,ue,ce,pe,se],c:[xt,le]}=si(this,[pi("rui-autocomplete")],[[be({type:String,defaultValue:"base"}),0,"sensitivity"],[be({type:String,attribute:"input-value",defaultValue:""}),0,"inputValue"],[hi(["sensitivity","inputValue"]),2,"onPropsUpdated"],[di({selector:"[data-autocomplete-input]",type:"input"}),2,"onInput"]],0,void 0,fe))}sensitivity=(se(this),ae(this));inputValue=(ue(this),ce(this));externalInput=(pe(this),null);onExternalInput=()=>{this.applyFilter()};getInput(){let t=this.querySelector("[data-autocomplete-input]");return t||(this.closest("rui-combobox, rui-select")?.querySelector("[data-autocomplete-input]")??null)}bindExternalInput(){this.unbindExternalInput();let t=this.getInput();!t||this.contains(t)||(this.externalInput=t,t.addEventListener("input",this.onExternalInput))}unbindExternalInput(){this.externalInput?.removeEventListener("input",this.onExternalInput),this.externalInput=null}syncFilter(){this.applyFilter()}getCollection(){return this.querySelector("[data-autocomplete-collection]")??this}getFilterableItems(){let t=this.getCollection();return t?Array.from(t.querySelectorAll('[role="option"], [data-tag], [role="menuitem"]')).filter(o=>this.contains(o)||t.contains(o)):[]}getItemText(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}getQuery(){return this.inputValue?this.inputValue:this.getInput()?.value??""}applyFilter(){let t=this.getQuery(),i=this.getFilterableItems(),o=0;for(let c of i){let a=ut(this.getItemText(c),t,this.sensitivity);c.hidden=!a,a&&(o+=1)}let n=this.querySelector("[data-autocomplete-empty]");n&&(n.hidden=o>0)}initialize(){this.applyFilter()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.bindExternalInput(),this.initialize()})}disconnectedCallback(){this.unbindExternalInput(),super.disconnectedCallback()}onPropsUpdated(){this.applyFilter()}onInput(){this.applyFilter()}render(){return ci("div",{class:"rui-autocomplete","data-ref":"root",children:[he("slot",{name:"input"}),he("slot",{})]})}static{le()}};import{jsx as yt}from"@ecopages/jsx/jsx-runtime";function wt({children:e,class:t,...i}){return yt("div",{...i,"data-autocomplete-collection":!0,class:j("rui-autocomplete__collection",t),children:e})}function Ot({children:e,class:t,...i}){return yt("div",{...i,"data-autocomplete-empty":!0,class:j("rui-autocomplete__empty",t),hidden:!0,children:e})}var At=rt(xt,({children:e,...t})=>yt("rui-autocomplete",{...t,children:e}),{stylesheets:["./autocomplete.css"]});import{jsx as ke}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ve,customElement as wi,event as Oi,onEvent as Te,onUpdated as Ai,prop as lt}from"@ecopages/radiant";function fi(e,t){e.forEach((i,o)=>{i.tabIndex=o===t?0:-1})}function bi(e,t){if(!e.length)return null;let i=Math.max(0,Math.min(e.length-1,t));return fi(e,i),e[i]?.focus(),e[i]??null}function mi(e,t){return e==="Home"?"first":e==="End"?"last":t==="horizontal"?e==="ArrowRight"?"next":e==="ArrowLeft"?"prev":null:e==="ArrowDown"?"next":e==="ArrowUp"?"prev":null}function ge(e){let{items:t,current:i,key:o,orientation:n="horizontal",wrap:c=!0}=e;if(!t.length||!i)return{handled:!1};let a=t.indexOf(i);if(a<0)return{handled:!1};let l=mi(o,n);if(!l)return{handled:!1};let v=a;l==="first"?v=0:l==="last"?v=t.length-1:l==="next"?v=c?(a+1)%t.length:Math.min(t.length-1,a+1):v=c?(a-1+t.length)%t.length:Math.max(0,a-1);let E=bi(t,v);return E?{handled:!0,index:v,item:E}:{handled:!1}}var ve,xe,ye,we,Oe,Ae,_e,Ie,Ee,Ce,Re,Se,Fe,De;function gi(e,t,i,o,n,c){var a,l,v,E,C,F,I,$=Symbol.metadata||Symbol.for("Symbol.metadata"),H=Object.defineProperty,P=Object.create,Q=[P(null),P(null)],X=t.length;function D(r,m,f){return function(s,u){m&&(u=s,s=e);for(var g=0;g<r.length;g++)u=r[g].apply(s,f?[u]:[]);return f?u:s}}function w(r,m,f,s){if(typeof r!="function"&&(s||r!==void 0))throw new TypeError(m+" must "+(f||"be")+" a function"+(s?"":" or undefined"));return r}function G(r,m,f,s,u,g,A,b,x,y,J){function M(d){if(!J(d))throw new TypeError("Attempted to access private element on non-instance")}var q=[].concat(m[0]),Z=m[3],U=!A,R=u===1,N=u===3,tt=u===4,L=u===2;function k(d,_,ot){return function(T,nt){return _&&(nt=T,T=r),ot&&ot(T),p[d].call(T,nt)}}if(!U){var p={},W=[],O=N?"get":tt||R?"set":"value";if(x?(y||R?p={get:Le(function(){return Z(this)},s,"get"),set:function(d){m[4](this,d)}}:p[O]=Z,y||Le(p[O],s,L?"":O)):y||(p=Object.getOwnPropertyDescriptor(r,s)),!y&&!x){if((l=Q[+b][s])&&(l^u)!==7)throw Error("Decorating two elements with the same name ("+p[O].name+") is not supported yet");Q[+b][s]=u<3?1:u}}for(var h=r,V=q.length-1;V>=0;V-=f?2:1){var et=w(q[V],"A decorator","be",!0),it=f?q[V-1]:void 0,K={},S={kind:["field","accessor","method","getter","setter","class"][u],name:s,metadata:a,addInitializer:function(d,_){if(d.v)throw new TypeError("attempted to call addInitializer after decoration was finished");w(_,"An initializer","be",!0),g.push(_)}.bind(null,K)};if(U)l=et.call(it,h,S),K.v=1,w(l,"class decorators","return")&&(h=l);else if(S.static=b,S.private=x,l=S.access={has:x?J.bind():function(d){return s in d}},tt||(l.get=x?L?function(d){return M(d),p.value}:k("get",0,M):function(d){return d[s]}),L||N||(l.set=x?k("set",0,M):function(d,_){d[s]=_}),h=et.call(it,R?{get:p.get,set:p.set}:p[O],S),K.v=1,R){if(typeof h=="object"&&h)(l=w(h.get,"accessor.get"))&&(p.get=l),(l=w(h.set,"accessor.set"))&&(p.set=l),(l=w(h.init,"accessor.init"))&&W.unshift(l);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else w(h,(y?"field":"method")+" decorators","return")&&(y?W.unshift(h):p[O]=h)}return u<2&&A.push(D(W,b,1),D(g,b,0)),y||U||(x?R?A.splice(-1,0,k("get",b),k("set",b)):A.push(L?p[O]:w.call.bind(p[O])):H(r,s,p)),h}function Y(r){return H(r,$,{configurable:!0,enumerable:!0,value:a})}return c!==void 0&&(a=c[$]),a=P(a??null),C=[],F=function(r){r&&C.push(D(r))},I=function(r,m){for(var f=0;f<i.length;f++){var s=i[f],u=s[1],g=7&u;if((8&u)==r&&!g==m){var A=s[2],b=!!s[3],x=16&u;G(r?e:e.prototype,s,x,b?"#"+A:vi(A),g,g<2?[]:r?E=E||[]:v=v||[],C,!!r,b,m,r&&b?function(y){return yi(y)===e}:n)}}},I(8,0),I(0,0),I(8,1),I(0,1),F(v),F(E),l=C,X||Y(e),{e:l,get c(){var r=[];return X&&[Y(e=G(e,[t],o,e.name,5,r)),D(r,1)]}}}function vi(e){var t=xi(e,"string");return typeof t=="symbol"?t:t+""}function xi(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var o=i.call(e,t||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Le(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 yi(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 _t,je=class extends Ve{static{({e:[ye,we,Oe,Ae,_e,Ie,Ee,Ce,Re,Se,Fe,De,ve],c:[_t,xe]}=gi(this,[wi("rui-listbox")],[[lt({type:String,reflect:!0,defaultValue:""}),0,"value"],[lt({type:String,defaultValue:""}),0,"label"],[lt({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[lt({type:Boolean,reflect:!0,defaultValue:!1}),0,"embedded"],[lt({type:Boolean,reflect:!0}),0,"bordered"],[Oi({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Ai(["value","disabled","embedded","bordered"]),2,"onPropsUpdated"],[Te({selector:'[role="option"]',type:"click"}),2,"onOptionClick"],[Te({selector:'[role="option"]',type:"keydown"}),2,"onOptionKeydown"]],0,void 0,Ve))}value=(ve(this),ye(this));label=(we(this),Oe(this));disabled=(Ae(this),_e(this));embedded=(Ie(this),Ee(this));bordered=(Ce(this),Re(this));changeEvent=(Se(this),Fe(this));resolvedAriaLabel=(De(this),this.$.label.map(t=>t||void 0));resolvedAriaDisabled=this.$.disabled.map(t=>t?"true":void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.sync(),this.syncPresentation()})}onPropsUpdated(){this.sync(),this.syncPresentation()}getOptions(){return Array.from(this.querySelectorAll('[role="option"]'))}sync(){let t=this.getOptions();for(let i of t){let o=i.getAttribute("data-value")===this.value;i.setAttribute("aria-selected",String(o)),i.tabIndex=this.embedded?-1:o||!this.value&&i===t[0]?0:-1}}select(t){this.disabled||t.getAttribute("aria-disabled")==="true"||(this.value=t.getAttribute("data-value")||t.textContent?.trim()||"",this.sync(),this.changeEvent.emit({value:this.value}),t.focus())}onOptionClick(t){if(this.embedded)return;let i=t.target.closest('[role="option"]');i&&this.contains(i)&&this.select(i)}onOptionKeydown(t){if(this.embedded)return;let i=this.getOptions(),o=t.target.closest('[role="option"]');if(!o)return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.select(o);return}let n=ge({items:i,current:o,key:t.key,orientation:"vertical"});n.handled&&(t.preventDefault(),this.select(n.item))}isBordered(){return this.bordered!=null?this.bordered:!this.embedded}syncPresentation(){let t=this.querySelector(".rui-listbox");t&&t.classList.toggle("rui-listbox--bordered",this.isBordered())}render(){let t=this.isBordered();return ke("div",{class:`rui-listbox${t?" rui-listbox--bordered":""}`,role:"listbox","data-rui-control":!0,"data-rui-control-type":"text","aria-label":this.resolvedAriaLabel,"aria-disabled":this.resolvedAriaDisabled,children:ke("slot",{})})}static{xe()}};import{jsx as ht}from"@ecopages/jsx/jsx-runtime";function at({value:e,label:t,children:i,class:o,disabled:n,...c}){return ht("div",{...c,class:j("rui-listbox__option",o),role:"option","data-value":e,"data-label":t,"aria-disabled":n?"true":void 0,tabindex:-1,children:i})}var ft=rt(_t,({options:e,children:t,...i})=>e!=null?ht("rui-listbox",{...i,children:e.map(o=>ht(at,{value:o.value,label:typeof o.label=="string"?o.label:void 0,disabled:o.disabled,children:o.label}))}):ht("rui-listbox",{...i,children:t}),{stylesheets:["./listbox.css"]});function Be({children:e,slot:t="control",class:i,...o}){return B("div",{...o,slot:t,class:j("rui-combobox__control",i),children:e})}function Pe({placeholder:e,disabled:t,class:i,...o}){return B("input",{...o,type:"text","data-combobox-input":!0,"data-autocomplete-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:j("rui-combobox__input",i),placeholder:e,disabled:t,autocomplete:"off"})}function Me({children:e,class:t,"aria-label":i="Show suggestions",disabled:o,...n}){return B("button",{...n,type:"button","data-combobox-trigger":!0,class:j("rui-control-toggle",t),"aria-label":i,disabled:o,tabIndex:-1,children:e??B(vt,{})})}function qe({children:e,slot:t="listbox",class:i,...o}){return B("div",{...o,slot:t,"data-combobox-listbox":!0,class:j("rui-combobox__listbox rui-popover rui-popover--listbox rui-floating",i),hidden:!0,children:e})}var _i=at,Ii=rt(dt,({options:e,children:t,...i})=>e!=null?It("rui-combobox",{...i,children:[It(Be,{children:[B(Pe,{placeholder:i.placeholder,disabled:i.disabled}),B(Me,{})]}),B(qe,{children:B(At,{children:It(wt,{children:[B(ft,{embedded:!0,options:e}),B(Ot,{children:"No results found."})]})})})]}):B("rui-combobox",{...i,children:t}),{stylesheets:["./combobox.css","../shared/control-toggle.css","../../../lib/icons/icons.css"]});export{Ii as RuiCombobox,Be as RuiComboboxControl,dt as RuiComboboxElement,Pe as RuiComboboxInput,qe as RuiComboboxListbox,_i as RuiComboboxOption,Me as RuiComboboxTrigger,ft as RuiListbox,at as RuiListboxOption};
|
|
1
|
+
import{jsx as Yt,jsxs as me}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Jt,customElement as ge,event as xe,onEvent as w,onUpdated as ve,prop as k,query as ye}from"@ecopages/radiant";function yt(i,t,e="base"){if(!t)return!0;if(e==="case")return i.includes(t);let o=new Intl.Collator(void 0,{sensitivity:e==="accent"?"accent":"base",usage:"search"});for(let n=0;n<=i.length-t.length;n+=1){let r=i.slice(n,n+t.length);if(o.compare(r,t)===0)return!0}return!1}function z(i){let t=i.previousElementSibling;return t?.tagName.toLowerCase()==="label"?t:i.parentElement?.querySelector("[data-rui-field-label], label.rui-label")??null}function Ot(i,t,e){if(!t||t.hasAttribute("data-rui-field-managed"))return;let o=z(i);if(o){o.id||(o.id=e.labelId),o.htmlFor||(o.htmlFor=e.controlId),t.setAttribute("aria-labelledby",o.id),t.removeAttribute("aria-label");return}if(e.label){t.setAttribute("aria-label",e.label),t.removeAttribute("aria-labelledby");return}t.removeAttribute("aria-label"),t.removeAttribute("aria-labelledby")}var ne={top:"bottom",bottom:"top",left:"right",right:"left"},re=8;function se(i){let t=i.indexOf("-");if(t===-1)return{side:i,align:"center"};let e=i.slice(0,t),o=i.slice(t+1);return{side:e,align:o==="start"||o==="end"?o:"center"}}function Ct(i){return i==="top"||i==="bottom"?"y":"x"}function At(i,t,e,o,n){let{width:r,height:s}=t,l=0,d=0;switch(e){case"top":d=i.top-s-n;break;case"bottom":d=i.bottom+n;break;case"left":l=i.left-r-n;break;case"right":l=i.right+n;break}return Ct(e)==="y"?o==="start"?l=i.left:o==="end"?l=i.right-r:l=i.left+(i.width-r)/2:o==="start"?d=i.top:o==="end"?d=i.bottom-s:d=i.top+(i.height-s)/2,{x:l,y:d}}function le(i,t,e,o){let{padding:n,width:r,height:s}=o;return e==="top"?Math.max(0,n-i.y):e==="bottom"?Math.max(0,i.y+t.height-(s-n)):e==="left"?Math.max(0,n-i.x):Math.max(0,i.x+t.width-(r-n))}function wt(i,t,e,o){let{padding:n,width:r,height:s}=o;return e==="top"?i.top-n-t.height:e==="bottom"?s-n-t.height-i.bottom:e==="left"?i.left-n-t.width:r-n-t.width-i.right}function ae(i,t){return t==="center"?i:`${i}-${t}`}function ue(i,t,e,o){let{padding:n,width:r,height:s}=o;if(Ct(e)==="y"){let d=Math.max(n,r-n-t.width);return{x:Math.min(Math.max(i.x,n),d),y:i.y}}let l=Math.max(n,s-n-t.height);return{x:i.x,y:Math.min(Math.max(i.y,n),l)}}function ce(i,t,e,o,n={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:re}){let{side:r,align:s}=se(e),l=At(i,t,r,s,o),d=le(l,t,r,n),I=r,_=l;if(d>0){let R=ne[r],E=At(i,t,R,s,o),B=wt(i,t,r,n);wt(i,t,R,n)>B&&(I=R,_=E)}return{coords:ue(_,t,I,n),placement:ae(I,s)}}function pe(i,t,e,o,n={}){let{coords:r,placement:s}=ce(i.getBoundingClientRect(),{width:t.offsetWidth,height:t.offsetHeight},e,o);return Object.assign(t.style,{position:"fixed",left:`${r.x}px`,top:`${r.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),n.matchAnchorWidth&&(t.style.width=`${i.offsetWidth}px`),t.setAttribute("data-placement",s),s}function Ft({anchor:i,floating:t,getPlacement:e,gap:o,matchAnchorWidth:n}){let r=()=>{t.hidden||pe(i,t,e(),o,{matchAnchorWidth:n})};r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0);let s=new ResizeObserver(r);return s.observe(i),s.observe(t),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0),s.disconnect()}}function It(i,t=document.body){let e=i.parentNode;if(!e)return{unmount:()=>{}};let o=document.createComment("rui-portal");return e.insertBefore(o,i),t.appendChild(i),{unmount:()=>{let n=o.parentNode;n&&(n.insertBefore(i,o),o.remove())}}}function tt(i,t,e){return e?!!(i?.contains(e)||t?.contains(e)):!1}function _t(i,t,e){return e instanceof Node?!tt(i,t,e):!0}function Rt(i,t,e){return!tt(i,t,e)}var $=class{config;cleanupFloating=null;portalHandle=null;floatingElement=null;constructor(t){this.config=t}updateConfig(t){this.config={...this.config,...t}}sync(){let t=this.resolveFloating();if(!t)return;if(!this.config.getOpen()){this.teardown(),t.hidden=!0;return}let o=this.config.getAnchor();if(!o)return;t.hidden=!1,this.config.portal!==!1?this.portalHandle||(this.portalHandle=It(t,this.config.portalContainer??document.body)):this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null),this.teardownFloating(),this.cleanupFloating=Ft({anchor:o,floating:t,getPlacement:this.config.getPlacement,gap:this.config.gap??8,matchAnchorWidth:this.config.matchAnchorWidth})}contains(t){return tt(this.config.getAnchor(),this.resolveFloating(),t)}getFloatingElement(){return this.resolveFloating()}teardown(){this.teardownFloating(),this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null)}destroy(){this.teardown(),this.floatingElement=null}resolveFloating(){let t=this.config.getFloating();return t&&(this.floatingElement=t),t??this.floatingElement}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}};function Et(i){return i.filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}function Lt(i,t,e){return e===0?-1:t===1?i>=e-1?0:i+1:i<=0?e-1:i-1}function et(i,t){t?.removeAttribute("aria-activedescendant");for(let e of i)e.removeAttribute("data-active")}function St(i,t,e,o,n){et(i,o);let r=t[e];return!r||!o?null:(r.id||(r.id=`${n}-${e}`),r.setAttribute("data-active","true"),o.setAttribute("aria-activedescendant",r.id),r.scrollIntoView({block:"nearest"}),r)}var K=class{config;popoverController;activeIndex=-1;visualFocus=!1;constructor(t){this.config=t,this.popoverController=new $({getAnchor:t.getAnchor,getFloating:t.getFloating,getOpen:t.getOpen,getPlacement:()=>"bottom-start",gap:4,portal:!1,matchAnchorWidth:!0})}get activeOptionIndex(){return this.activeIndex}get hasVisualFocus(){return this.visualFocus}ensureOptionIds(){this.config.getOptions().forEach((t,e)=>{t.id||(t.id=`${this.config.getOptionIdPrefix()}-${e}`)})}getVisibleOptions(){return Et(this.config.getOptions())}clearActiveOption(){this.activeIndex=-1,this.visualFocus=!1,et(this.config.getOptions(),this.config.getActiveDescendantHost())}setActiveOption(t){let e=this.getVisibleOptions();if(t<0||t>=e.length){this.clearActiveOption();return}this.activeIndex=t,this.visualFocus=!0,St(this.config.getOptions(),e,t,this.config.getActiveDescendantHost(),this.config.getOptionIdPrefix())}moveActive(t,e){let o=this.getVisibleOptions();if(o.length){if(!this.config.getOpen()){e(t===1?"first":"last");return}if(this.visualFocus){this.setActiveOption(Lt(this.activeIndex,t,o.length));return}this.setActiveOption(t===1?0:o.length-1)}}handleKeydown(t,e){if(!(t.ctrlKey||t.shiftKey||t.metaKey)){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();let o=t.key==="ArrowDown"?1:-1;if(t.altKey){o===1&&!e.isOpen?e.onOpen():o===-1&&e.isOpen&&e.onClose("arrow");return}this.moveActive(o,n=>e.onOpen(n));return}if(t.key==="Escape"){t.preventDefault(),e.isOpen?e.onClose("escape"):e.onEscapeWhenClosed?.();return}if(t.key==="Enter"||t.key===" "&&e.canUseSpace){if(!e.isOpen&&e.enterWhenClosed==="open"){t.preventDefault(),e.onOpen();return}let o=this.getVisibleOptions();e.isOpen&&this.visualFocus&&o[this.activeIndex]?(t.preventDefault(),e.onSelectActive()):t.key==="Enter"&&e.isOpen&&e.enterWithoutActive==="close"&&(t.preventDefault(),e.onClose("enter"));return}if(t.key==="Tab"&&e.isOpen){let o=this.getVisibleOptions();if(this.visualFocus&&o[this.activeIndex]&&e.closesOnTab){e.onSelectActive();return}e.onClose("tab")}}}syncPopoverPosition(){this.popoverController.sync()}shouldDismissFocus(t){return _t(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}shouldDismissPointer(t){return Rt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}destroy(){this.popoverController.destroy()}};var Dt,Pt,kt,Vt,Bt,Tt,jt,Ht,Mt,Wt,$t,Kt,qt,Ut,Nt,Gt;function he(i,t,e,o,n,r){var s,l,d,I,_,R,E,B=Symbol.metadata||Symbol.for("Symbol.metadata"),N=Object.defineProperty,G=Object.create,at=[G(null),G(null)],ut=t.length;function T(a,v,g){return function(u,c){v&&(c=u,u=i);for(var y=0;y<a.length;y++)c=a[y].apply(u,g?[c]:[]);return g?c:u}}function C(a,v,g,u){if(typeof a!="function"&&(u||a!==void 0))throw new TypeError(v+" must "+(g||"be")+" a function"+(u?"":" or undefined"));return a}function ct(a,v,g,u,c,y,L,x,O,A,ht){function X(h){if(!ht(h))throw new TypeError("Attempted to access private element on non-instance")}var Y=[].concat(v[0]),dt=v[3],J=!L,D=c===1,ft=c===3,bt=c===4,j=c===2;function H(h,S,xt){return function(W,vt){return S&&(vt=W,W=a),xt&&xt(W),p[h].call(W,vt)}}if(!J){var p={},Q=[],F=ft?"get":bt||D?"set":"value";if(O?(A||D?p={get:Xt(function(){return dt(this)},u,"get"),set:function(h){v[4](this,h)}}:p[F]=dt,A||Xt(p[F],u,j?"":F)):A||(p=Object.getOwnPropertyDescriptor(a,u)),!A&&!O){if((l=at[+x][u])&&(l^c)!==7)throw Error("Decorating two elements with the same name ("+p[F].name+") is not supported yet");at[+x][u]=c<3?1:c}}for(var f=a,M=Y.length-1;M>=0;M-=g?2:1){var mt=C(Y[M],"A decorator","be",!0),gt=g?Y[M-1]:void 0,Z={},P={kind:["field","accessor","method","getter","setter","class"][c],name:u,metadata:s,addInitializer:function(h,S){if(h.v)throw new TypeError("attempted to call addInitializer after decoration was finished");C(S,"An initializer","be",!0),y.push(S)}.bind(null,Z)};if(J)l=mt.call(gt,f,P),Z.v=1,C(l,"class decorators","return")&&(f=l);else if(P.static=x,P.private=O,l=P.access={has:O?ht.bind():function(h){return u in h}},bt||(l.get=O?j?function(h){return X(h),p.value}:H("get",0,X):function(h){return h[u]}),j||ft||(l.set=O?H("set",0,X):function(h,S){h[u]=S}),f=mt.call(gt,D?{get:p.get,set:p.set}:p[F],P),Z.v=1,D){if(typeof f=="object"&&f)(l=C(f.get,"accessor.get"))&&(p.get=l),(l=C(f.set,"accessor.set"))&&(p.set=l),(l=C(f.init,"accessor.init"))&&Q.unshift(l);else if(f!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else C(f,(A?"field":"method")+" decorators","return")&&(A?Q.unshift(f):p[F]=f)}return c<2&&L.push(T(Q,x,1),T(y,x,0)),A||J||(O?D?L.splice(-1,0,H("get",x),H("set",x)):L.push(j?p[F]:C.call.bind(p[F])):N(a,u,p)),f}function pt(a){return N(a,B,{configurable:!0,enumerable:!0,value:s})}return r!==void 0&&(s=r[B]),s=G(s??null),_=[],R=function(a){a&&_.push(T(a))},E=function(a,v){for(var g=0;g<e.length;g++){var u=e[g],c=u[1],y=7&c;if((8&c)==a&&!y==v){var L=u[2],x=!!u[3],O=16&c;ct(a?i:i.prototype,u,O,x?"#"+L:de(L),y,y<2?[]:a?I=I||[]:d=d||[],_,!!a,x,v,a&&x?function(A){return be(A)===i}:n)}}},E(8,0),E(0,0),E(8,1),E(0,1),R(d),R(I),l=_,ut||pt(i),{e:l,get c(){var a=[];return ut&&[pt(i=ct(i,[t],o,i.name,5,a)),T(a,1)]}}}function de(i){var t=fe(i,"string");return typeof t=="symbol"?t:t+""}function fe(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 Xt(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 be(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 Zt,Qt=class extends Jt{static{({e:[kt,Vt,Bt,Tt,jt,Ht,Mt,Wt,$t,Kt,qt,Ut,Nt,Gt,Dt],c:[Zt,Pt]}=he(this,[ge("rui-combobox")],[[k({type:String,reflect:!0,defaultValue:""}),0,"value"],[k({type:String,defaultValue:""}),0,"label"],[k({type:String,defaultValue:""}),0,"placeholder"],[k({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[k({type:Boolean,reflect:!0,defaultValue:!1}),0,"openOnFocus"],[xe({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[ye({ref:"root"}),0,"rootTarget"],[ve(["value","label","placeholder","disabled","openOnFocus"]),2,"onPropsUpdated"],[w({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[w({ref:"root",type:"input"}),2,"onRootInput"],[w({ref:"root",type:"keydown",options:{capture:!0}}),2,"onRootKeydown"],[w({selector:"[data-combobox-trigger]",type:"click"}),2,"onTriggerClick"],[w({selector:'[data-combobox-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[w({selector:'[data-combobox-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[w({selector:'[data-combobox-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[w({ref:"root",type:"focusout"}),2,"onFocusOut"],[w({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,Jt))}constructor(...t){super(...t),Gt(this)}value=(Dt(this),kt(this));label=(Vt(this),Bt(this));placeholder=(Tt(this),jt(this));disabled=(Ht(this),Mt(this));openOnFocus=(Wt(this),$t(this));changeEvent=(Kt(this),qt(this));open=(Ut(this),!1);skipNextFocusOpen=!1;uid=Math.random().toString(36).slice(2,9);listboxBehavior=new K({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getInput(),getOptionIdPrefix:()=>`rui-combobox-option-${this.uid}`});rootTarget=Nt(this);get listboxId(){return`rui-combobox-list-${this.uid}`}get inputId(){return`rui-combobox-input-${this.uid}`}getInput(){return this.querySelector("[data-combobox-input]")}getTrigger(){return this.querySelector("[data-combobox-trigger]")}getListboxPopup(){return this.querySelector("[data-combobox-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t instanceof HTMLElement?t.querySelector('[role="listbox"]')??t:this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return z(this)?.textContent?.trim()||this.label||"Suggestions"}isComboboxInput(t){return t instanceof HTMLElement&&t.localName==="input"&&t.hasAttribute("data-combobox-input")}syncLabel(){let t=this.getInput();Ot(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-combobox-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),e=this.getListbox();!t||!e||(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",e.id||this.listboxId),t.tabIndex=-1,this.disabled&&(t.disabled=!0))}syncInput(){let t=this.getInput(),e=this.getListbox(),o=this.getListboxPopup();!t||!e||(t.id||(t.id=this.inputId),e.id||(e.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),e.setAttribute("aria-label",this.getAccessibleName()),o&&(o.removeAttribute("role"),o.removeAttribute("aria-label")),this.placeholder&&!t.placeholder&&(t.placeholder=this.placeholder),this.disabled&&(t.disabled=!0),this.syncTrigger())}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,t.value=this.value)}syncOptionSelection(){for(let t of this.getOptions()){let o=(t.getAttribute("data-value")||this.getOptionLabel(t))===this.value&&this.value!=="";t.setAttribute("aria-selected",String(o))}}setVisualFocusCombobox(){this.listboxBehavior.clearActiveOption(),this.syncOptionSelection()}setOpen(t,e={}){let o=e.activate??"none";this.open=t;let n=this.getInput(),r=this.getListboxPopup();if(!(!n||!r)){if(n.setAttribute("aria-expanded",String(t)),r.hidden=!t,this.syncTrigger(),!t){this.listboxBehavior.clearActiveOption(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.listboxBehavior.syncPopoverPosition(),o==="first"){let s=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(s.length?0:-1);return}if(o==="last"){let s=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(s.length?s.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}getAutocomplete(){return this.querySelector("rui-autocomplete")}syncAutocompleteFilter(){let t=this.getAutocomplete();if(t){t.syncFilter();return}let e=this.getInput()?.value??"";for(let o of this.getOptions()){let n=yt(this.getOptionLabel(o),e,"base");o.hidden=e.trim()!==""&&!n}}showAllOptions(){for(let t of this.getOptions())t.hidden=!1}syncFilter(){this.syncAutocompleteFilter()}select(t){if(t.getAttribute("aria-disabled")==="true")return;let e=t.getAttribute("data-value")||this.getOptionLabel(t),o=this.getOptionLabel(t)||e;this.value=e;let n=this.getInput();n&&(n.value=o),this.changeEvent.emit({value:e}),this.syncOptionSelection(),this.skipNextFocusOpen=!0,this.setOpen(!1),n?.focus()}syncFromValue(){let t=this.getInput();if(!t)return;let e=this.getOptions().find(n=>n.getAttribute("data-value")===this.value),o=e?this.getOptionLabel(e):this.value||"";t.value=o}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection()}onRootFocusIn(t){if(this.isComboboxInput(t.target)){if(this.skipNextFocusOpen){this.skipNextFocusOpen=!1;return}this.openOnFocus&&(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox())}}onRootInput(t){if(!this.isComboboxInput(t.target))return;let e=t.target;this.syncFilter(),e.value.trim()!==""&&this.listboxBehavior.getVisibleOptions().length?this.setOpen(!0):e.value.trim()===""&&this.openOnFocus?this.setOpen(!0):(e.value.trim()===""||!this.listboxBehavior.getVisibleOptions().length)&&this.setOpen(!1),this.setVisualFocusCombobox()}onRootKeydown(t){this.isComboboxInput(t.target)&&this.handleInputKeydown(t)}handleInputKeydown(t){if(t.key==="Home"){let e=this.getInput();if(!e)return;t.preventDefault(),e.setSelectionRange(0,0),this.setVisualFocusCombobox();return}if(t.key==="End"){let e=this.getInput();if(!e)return;t.preventDefault();let o=e.value.length;e.setSelectionRange(o,o),this.setVisualFocusCombobox();return}(t.key==="ArrowDown"||t.key==="ArrowUp")&&(this.syncFilter(),this.listboxBehavior.getVisibleOptions().length||this.showAllOptions()),this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!1,closesOnTab:!0,enterWhenClosed:"ignore",enterWithoutActive:"close",onOpen:(e="none")=>{this.syncFilter(),this.setOpen(!0,{activate:e})},onClose:()=>this.setOpen(!1),onSelectActive:()=>{let e=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];e&&this.select(e)},onEscapeWhenClosed:()=>{let e=this.getInput();e&&e.value&&(e.value="",this.value="",this.changeEvent.emit({value:""}),this.syncFilter())}})}onTriggerClick(t){t.preventDefault();let e=this.getInput();!e||e.disabled||(this.open?(this.skipNextFocusOpen=!0,this.setOpen(!1)):(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox()),e.focus())}onOptionPointerOver(t){if(!this.open)return;let e=t.target.closest('[role="option"]');if(!e||e.getAttribute("aria-disabled")==="true"||e.hidden)return;let n=this.listboxBehavior.getVisibleOptions().indexOf(e);n>=0&&this.listboxBehavior.setActiveOption(n)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let e=t.target.closest('[role="option"]');e&&this.select(e)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return me("div",{class:"rui-combobox","data-ref":"root",children:[Yt("slot",{name:"control"}),Yt("slot",{name:"listbox"})]})}static{Pt()}};import{jsx as m,jsxs as lt}from"@ecopages/jsx/jsx-runtime";function b(...i){return i.filter(Boolean).join(" ")}import{jsx as zt}from"@ecopages/jsx/jsx-runtime";function it({class:i,size:t="sm",...e}){return zt("svg",{...e,class:b("rui-icon",t==="md"&&"rui-icon--md",i),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:zt("path",{d:"m6 9 6 6 6-6"})})}import{jsx as ot}from"@ecopages/jsx/jsx-runtime";function nt({children:i,class:t,...e}){return ot("div",{...e,"data-autocomplete-collection":!0,class:b("rui-autocomplete__collection",t),children:i})}function rt({children:i,class:t,...e}){return ot("div",{...e,"data-autocomplete-empty":!0,class:b("rui-autocomplete__empty",t),hidden:!0,children:i})}function st({children:i,...t}){return ot("rui-autocomplete",{...t,children:i})}import{jsx as q}from"@ecopages/jsx/jsx-runtime";function V({value:i,label:t,children:e,class:o,disabled:n,...r}){return q("div",{...r,class:b("rui-listbox__option",o),role:"option","data-value":i,"data-label":t,"aria-disabled":n?"true":void 0,tabindex:-1,children:e})}function U({options:i,children:t,...e}){return i!=null?q("rui-listbox",{...e,children:i.map(o=>q(V,{value:o.value,label:typeof o.label=="string"?o.label:void 0,disabled:o.disabled,children:o.label}))}):q("rui-listbox",{...e,children:t})}function te({children:i,slot:t="control",class:e,...o}){return m("div",{...o,slot:t,class:b("rui-combobox__control",e),children:i})}function ee({placeholder:i,disabled:t,class:e,...o}){return m("input",{...o,type:"text","data-combobox-input":!0,"data-autocomplete-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:b("rui-combobox__input",e),placeholder:i,disabled:t,autocomplete:"off"})}function ie({children:i,class:t,"aria-label":e="Show suggestions",disabled:o,...n}){return m("button",{...n,type:"button","data-combobox-trigger":!0,class:b("rui-control-toggle",t),"aria-label":e,disabled:o,tabIndex:-1,children:i??m(it,{})})}function oe({children:i,slot:t="listbox",class:e,...o}){return m("div",{...o,slot:t,"data-combobox-listbox":!0,class:b("rui-combobox__listbox rui-popover rui-popover--listbox rui-floating",e),hidden:!0,children:i})}var Oe=V;function Ae({options:i,children:t,...e}){return i!=null?lt("rui-combobox",{...e,children:[lt(te,{children:[m(ee,{placeholder:e.placeholder,disabled:e.disabled}),m(ie,{})]}),m(oe,{children:m(st,{children:lt(nt,{children:[m(U,{embedded:!0,options:i}),m(rt,{children:"No results found."})]})})})]}):m("rui-combobox",{...e,children:t})}export{Ae as RuiCombobox,te as RuiComboboxControl,Zt as RuiComboboxElement,ee as RuiComboboxInput,oe as RuiComboboxListbox,Oe as RuiComboboxOption,ie as RuiComboboxTrigger,U as RuiListbox,V as RuiListboxOption};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|