@ecopages/radiant-ui 0.1.0-beta.3 → 0.1.0-beta.5
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/dist/components/ui/autocomplete/autocomplete.css +135 -0
- package/dist/components/ui/autocomplete/autocomplete.d.ts +21 -0
- package/dist/components/ui/autocomplete/autocomplete.script.d.ts +42 -0
- package/dist/components/ui/autocomplete/index.d.ts +2 -0
- package/dist/components/ui/autocomplete/index.js +2 -0
- package/dist/components/ui/autocomplete/index.js.map +7 -0
- package/dist/components/ui/avatar/avatar.css +58 -0
- package/dist/components/ui/avatar/avatar.d.ts +13 -0
- package/dist/components/ui/avatar/index.d.ts +1 -0
- package/dist/components/ui/avatar/index.js +2 -0
- package/dist/components/ui/avatar/index.js.map +7 -0
- package/dist/components/ui/button-group/button-group.css +16 -0
- package/dist/components/ui/button-group/button-group.d.ts +10 -0
- package/dist/components/ui/button-group/index.d.ts +1 -0
- package/dist/components/ui/button-group/index.js +2 -0
- package/dist/components/ui/button-group/index.js.map +7 -0
- package/dist/components/ui/calendar/calendar.css +318 -0
- package/dist/components/ui/calendar/calendar.d.ts +5 -0
- package/dist/components/ui/calendar/calendar.script.d.ts +89 -0
- package/dist/components/ui/calendar/index.d.ts +2 -0
- package/dist/components/ui/calendar/index.js +2 -0
- package/dist/components/ui/calendar/index.js.map +7 -0
- package/dist/components/ui/chip/chip.css +47 -0
- package/dist/components/ui/chip/chip.d.ts +11 -0
- package/dist/components/ui/chip/index.d.ts +1 -0
- package/dist/components/ui/chip/index.js +2 -0
- package/dist/components/ui/chip/index.js.map +7 -0
- package/dist/components/ui/chip-list/chip-list.css +15 -0
- package/dist/components/ui/chip-list/chip-list.d.ts +10 -0
- package/dist/components/ui/chip-list/index.d.ts +1 -0
- package/dist/components/ui/chip-list/index.js +2 -0
- package/dist/components/ui/chip-list/index.js.map +7 -0
- package/dist/components/ui/combobox/combobox.css +42 -80
- package/dist/components/ui/combobox/combobox.d.ts +12 -20
- package/dist/components/ui/combobox/combobox.script.d.ts +15 -14
- package/dist/components/ui/combobox/index.d.ts +2 -1
- package/dist/components/ui/combobox/index.js +1 -1
- package/dist/components/ui/combobox/index.js.map +4 -4
- package/dist/components/ui/date-field/date-field.css +184 -0
- package/dist/components/ui/date-field/date-field.d.ts +10 -0
- package/dist/components/ui/date-field/date-field.script.d.ts +108 -0
- package/dist/components/ui/date-field/index.d.ts +2 -0
- package/dist/components/ui/date-field/index.js +2 -0
- package/dist/components/ui/date-field/index.js.map +7 -0
- package/dist/components/ui/date-range-picker/date-range-picker.css +194 -0
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts +10 -0
- package/dist/components/ui/date-range-picker/date-range-picker.script.d.ts +99 -0
- package/dist/components/ui/date-range-picker/index.d.ts +2 -0
- package/dist/components/ui/date-range-picker/index.js +2 -0
- package/dist/components/ui/date-range-picker/index.js.map +7 -0
- package/dist/components/ui/dialog/dialog.css +1 -1
- package/dist/components/ui/feed/feed.css +169 -5
- package/dist/components/ui/feed/feed.d.ts +54 -11
- package/dist/components/ui/feed/index.d.ts +1 -2
- package/dist/components/ui/feed/index.js +1 -1
- package/dist/components/ui/feed/index.js.map +4 -4
- package/dist/components/ui/field/index.js +1 -1
- package/dist/components/ui/field/index.js.map +3 -3
- package/dist/components/ui/form/form-field.test.d.ts +1 -0
- package/dist/components/ui/form/index.js +1 -1
- package/dist/components/ui/form/index.js.map +3 -3
- package/dist/components/ui/heading/heading.css +107 -0
- package/dist/components/ui/heading/heading.d.ts +30 -0
- package/dist/components/ui/heading/index.d.ts +1 -0
- package/dist/components/ui/heading/index.js +2 -0
- package/dist/components/ui/heading/index.js.map +7 -0
- package/dist/components/ui/headline/headline.css +43 -0
- package/dist/components/ui/headline/headline.d.ts +16 -0
- package/dist/components/ui/headline/index.d.ts +1 -0
- package/dist/components/ui/headline/index.js +2 -0
- package/dist/components/ui/headline/index.js.map +7 -0
- 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.d.ts +8 -1
- package/dist/components/ui/label/index.js +1 -1
- package/dist/components/ui/label/index.js.map +2 -2
- package/dist/components/ui/listbox/index.d.ts +1 -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 +34 -10
- package/dist/components/ui/listbox/listbox.d.ts +12 -4
- package/dist/components/ui/listbox/listbox.script.d.ts +12 -0
- 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 +24 -8
- package/dist/components/ui/menu-button/menu-button.script.d.ts +3 -4
- 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 +40 -22
- package/dist/components/ui/menubar/menubar.script.d.ts +6 -1
- package/dist/components/ui/number-field/index.d.ts +2 -0
- package/dist/components/ui/number-field/index.js +2 -0
- package/dist/components/ui/number-field/index.js.map +7 -0
- package/dist/components/ui/number-field/number-field.css +185 -0
- package/dist/components/ui/number-field/number-field.d.ts +43 -0
- package/dist/components/ui/number-field/number-field.script.d.ts +104 -0
- package/dist/components/ui/popover/index.d.ts +4 -0
- package/dist/components/ui/popover/index.js +2 -0
- package/dist/components/ui/popover/index.js.map +7 -0
- package/dist/components/ui/popover/popover.css +132 -0
- package/dist/components/ui/popover/popover.d.ts +15 -0
- package/dist/components/ui/popover/popover.script.d.ts +85 -0
- package/dist/components/ui/select/index.d.ts +3 -0
- package/dist/components/ui/select/index.js +2 -0
- package/dist/components/ui/select/index.js.map +7 -0
- package/dist/components/ui/select/select.css +216 -0
- package/dist/components/ui/select/select.d.ts +54 -0
- package/dist/components/ui/select/select.script.d.ts +106 -0
- package/dist/components/ui/shared/collection-navigation.d.ts +8 -0
- package/dist/components/ui/shared/collection-navigation.test.d.ts +1 -0
- package/dist/components/ui/shared/control-toggle.css +132 -0
- package/dist/components/ui/shared/field-label.d.ts +9 -0
- package/dist/components/ui/shared/floating-position.d.ts +13 -2
- package/dist/components/ui/shared/listbox-popover-behavior.d.ts +47 -0
- package/dist/components/ui/shared/listbox-popover-behavior.test.d.ts +1 -0
- package/dist/components/ui/shared/multi-value.d.ts +4 -0
- package/dist/components/ui/shared/popover-controller.d.ts +35 -0
- package/dist/components/ui/shared/popover-controller.test.d.ts +1 -0
- package/dist/components/ui/shared/popover.css +123 -0
- package/dist/components/ui/shared/portal.d.ts +7 -0
- package/dist/components/ui/shared/portal.test.d.ts +1 -0
- package/dist/components/ui/slider/index.js +1 -1
- package/dist/components/ui/slider/index.js.map +3 -3
- package/dist/components/ui/slider/slider.script.d.ts +5 -12
- package/dist/components/ui/tag-group/index.d.ts +2 -0
- package/dist/components/ui/tag-group/index.js +2 -0
- package/dist/components/ui/tag-group/index.js.map +7 -0
- package/dist/components/ui/tag-group/tag-group.css +184 -0
- package/dist/components/ui/tag-group/tag-group.d.ts +28 -0
- package/dist/components/ui/tag-group/tag-group.script.d.ts +65 -0
- package/dist/components/ui/textarea/index.js +1 -1
- package/dist/components/ui/textarea/index.js.map +2 -2
- package/dist/components/ui/toc/toc.css +1 -1
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/components/ui/tooltip/index.js.map +3 -3
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/icons/calendar.d.ts +3 -0
- package/dist/lib/icons/chevron-down.d.ts +3 -0
- package/dist/lib/icons/index.d.ts +3 -0
- package/dist/lib/icons/types.d.ts +4 -0
- package/dist/lib/intl/locale.d.ts +3 -0
- package/dist/lib/intl-date/calendar.d.ts +25 -0
- package/dist/lib/intl-date/formatters.d.ts +13 -0
- package/dist/lib/intl-date/index.d.ts +12 -0
- package/dist/lib/intl-date/iso.d.ts +6 -0
- package/dist/lib/intl-date/months.d.ts +12 -0
- package/dist/lib/intl-date/parts.d.ts +15 -0
- package/dist/lib/intl-date/parts.test.d.ts +1 -0
- package/dist/lib/intl-date/segments.d.ts +32 -0
- package/dist/lib/intl-date/segments.test.d.ts +1 -0
- package/dist/lib/intl-date/selection.d.ts +39 -0
- package/dist/lib/intl-date/selection.test.d.ts +1 -0
- package/dist/lib/intl-date/types.d.ts +17 -0
- package/dist/lib/intl-number/format.d.ts +9 -0
- package/dist/lib/intl-number/index.d.ts +2 -0
- package/dist/lib/intl-number/range.d.ts +3 -0
- package/dist/lib/intrinsic.d.ts +13 -0
- package/dist/lib/mask/date-mask.d.ts +29 -0
- package/dist/lib/mask/date-mask.test.d.ts +1 -0
- package/dist/lib/mask/index.d.ts +4 -0
- package/dist/lib/mask/input-mask.d.ts +52 -0
- package/dist/lib/mask/input-mask.test.d.ts +1 -0
- package/dist/lib/text-filter.d.ts +7 -0
- package/dist/lib/text-filter.test.d.ts +1 -0
- package/dist/styles/radiant-ui-core.css +131 -1
- package/dist/styles/radiant-ui.css +142 -1
- package/dist/styles/styles.css +4504 -2395
- package/dist/styles/tailwind.css +142 -1
- package/dist/styles/tokens/typography/default.css +8 -0
- package/package.json +106 -15
- package/dist/components/ui/feed/feed.script.d.ts +0 -22
- package/dist/components/ui/spinbutton/index.d.ts +0 -2
- package/dist/components/ui/spinbutton/index.js +0 -2
- package/dist/components/ui/spinbutton/index.js.map +0 -7
- package/dist/components/ui/spinbutton/spinbutton.css +0 -69
- package/dist/components/ui/spinbutton/spinbutton.d.ts +0 -5
- package/dist/components/ui/spinbutton/spinbutton.script.d.ts +0 -64
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer components {
|
|
4
|
+
.rui-chip {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
border-radius: var(--radius-pill, var(--radius-pill));
|
|
8
|
+
padding-inline: var(--spacing-2, var(--space-2));
|
|
9
|
+
padding-block: calc(var(--spacing, 0.25rem) * 0.5);
|
|
10
|
+
font-size: var(--text-xs, var(--text-xs));
|
|
11
|
+
line-height: var(--tw-leading, var(--text-xs--line-height, calc(1 / 0.75)));
|
|
12
|
+
--tw-font-weight: var(--font-weight-medium, var(--weight-medium));
|
|
13
|
+
font-weight: var(--font-weight-medium, var(--weight-medium));
|
|
14
|
+
}
|
|
15
|
+
.rui-chip--default {
|
|
16
|
+
border-style: var(--tw-border-style);
|
|
17
|
+
border-width: 1px;
|
|
18
|
+
border-color: var(--color-border, var(--border));
|
|
19
|
+
background-color: var(--color-surface-container-low, var(--surface-container-low));
|
|
20
|
+
color: var(--color-on-surface, var(--on-surface));
|
|
21
|
+
}
|
|
22
|
+
.rui-chip--muted {
|
|
23
|
+
background-color: var(--color-surface-container, var(--surface-container));
|
|
24
|
+
color: var(--color-on-surface, var(--on-surface));
|
|
25
|
+
}
|
|
26
|
+
.rui-chip--primary {
|
|
27
|
+
background-color: var(--color-primary-container, var(--primary-container));
|
|
28
|
+
color: var(--color-on-primary-container, var(--on-primary-container));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
@property --tw-font-weight {
|
|
32
|
+
syntax: "*";
|
|
33
|
+
inherits: false;
|
|
34
|
+
}
|
|
35
|
+
@property --tw-border-style {
|
|
36
|
+
syntax: "*";
|
|
37
|
+
inherits: false;
|
|
38
|
+
initial-value: solid;
|
|
39
|
+
}
|
|
40
|
+
@layer properties {
|
|
41
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
42
|
+
*, ::before, ::after, ::backdrop {
|
|
43
|
+
--tw-font-weight: initial;
|
|
44
|
+
--tw-border-style: solid;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JsxHtmlPropsWithChildren } from '@ecopages/jsx';
|
|
2
|
+
export type RuiChipVariant = 'default' | 'muted' | 'primary';
|
|
3
|
+
export type RuiChipProps = JsxHtmlPropsWithChildren<{
|
|
4
|
+
variant?: RuiChipVariant;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Presentational category chip.
|
|
8
|
+
*
|
|
9
|
+
* @remarks For removable / selectable tags use `RuiTagGroup` instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function RuiChip({ children, variant, class: className, ...props }: RuiChipProps): import("@ecopages/jsx").JsxRenderable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuiChip, type RuiChipProps, type RuiChipVariant } from './chip';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as c}from"@ecopages/jsx/jsx-runtime";function n(...o){return o.filter(Boolean).join(" ")}var a=Symbol.for("@ecopages/storybook-radiant.viewModule");function e(o,i,t){let r=o;return r[a]=t,o}function s({children:o,variant:i="default",class:t,...r}){return c("span",{...r,class:n("rui-chip",`rui-chip--${i}`,t),children:o})}e(s,["./chip.css"],import.meta.url);export{s as RuiChip};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ui/chip/chip.tsx", "../../../../src/lib/cx.ts", "../../../../src/lib/radiant-view.ts"],
|
|
4
|
+
"sourcesContent": ["import { jsx } from \"@ecopages/jsx/jsx-runtime\";\nimport { cx } from \"@/lib/cx\";\nimport { attachRadiantStylesheets } from \"@/lib/radiant-view\";\nexport function RuiChip({\n children,\n variant = \"default\",\n class: className,\n ...props\n}) {\n return /* @__PURE__ */jsx(\"span\", {\n ...props,\n class: cx(\"rui-chip\", `rui-chip--${variant}`, className),\n children\n });\n}\nattachRadiantStylesheets(RuiChip, [\"./chip.css\"], import.meta.url);", "export function cx(...parts) {\n return parts.filter(Boolean).join(\" \");\n}", "const RADIANT_VIEW_ELEMENT = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.viewElement\");\nconst RADIANT_SCRIPT_MODULE = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.scriptModule\");\nconst RADIANT_SCRIPT_EXPORT = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.scriptExport\");\nconst RADIANT_VIEW_MODULE = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.viewModule\");\nfunction linkViewToElement(view, element) {\n view[RADIANT_VIEW_ELEMENT] = element;\n const ssrModule = element[RADIANT_SCRIPT_MODULE];\n if (ssrModule) {\n view[RADIANT_SCRIPT_MODULE] = ssrModule;\n view[RADIANT_SCRIPT_EXPORT] = element[RADIANT_SCRIPT_EXPORT] ?? element.name;\n }\n}\nexport function defineRadiantView(element, render, _options) {\n const view = args => render(args);\n linkViewToElement(view, element);\n return view;\n}\nexport function attachRadiantStylesheets(target, _stylesheets, moduleUrl) {\n const view = target;\n view[RADIANT_VIEW_MODULE] = moduleUrl;\n return target;\n}\nexport function syncRadiantViewMetadata(view) {\n const element = view[RADIANT_VIEW_ELEMENT];\n if (element) {\n linkViewToElement(view, element);\n }\n}"],
|
|
5
|
+
"mappings": "AAAA,OAAS,OAAAA,MAAW,4BCAb,SAASC,KAAMC,EAAO,CAC3B,OAAOA,EAAM,OAAO,OAAO,EAAE,KAAK,GAAG,CACvC,CCCA,IAAMC,EAAqC,OAAO,IAAI,wCAAwC,EAcvF,SAASC,EAAyBC,EAAQC,EAAcC,EAAW,CACxE,IAAMC,EAAOH,EACb,OAAAG,EAAKC,CAAmB,EAAIF,EACrBF,CACT,CFlBO,SAASK,EAAQ,CACtB,SAAAC,EACA,QAAAC,EAAU,UACV,MAAOC,EACP,GAAGC,CACL,EAAG,CACD,OAAsBC,EAAI,OAAQ,CAChC,GAAGD,EACH,MAAOE,EAAG,WAAY,aAAaJ,CAAO,GAAIC,CAAS,EACvD,SAAAF,CACF,CAAC,CACH,CACAM,EAAyBP,EAAS,CAAC,YAAY,EAAG,YAAY,GAAG",
|
|
6
|
+
"names": ["jsx", "cx", "parts", "RADIANT_VIEW_MODULE", "attachRadiantStylesheets", "target", "_stylesheets", "moduleUrl", "view", "RADIANT_VIEW_MODULE", "RuiChip", "children", "variant", "className", "props", "jsx", "cx", "attachRadiantStylesheets"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer components {
|
|
3
|
+
.rui-chip-list {
|
|
4
|
+
margin: 0px;
|
|
5
|
+
display: flex;
|
|
6
|
+
list-style-type: none;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
gap: var(--spacing-inline, var(--space-inline));
|
|
9
|
+
padding: 0px;
|
|
10
|
+
}
|
|
11
|
+
.rui-chip-list__item {
|
|
12
|
+
margin: 0px;
|
|
13
|
+
padding: 0px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsxHtmlPropsWithChildren } from '@ecopages/jsx';
|
|
2
|
+
export type RuiChipListProps = JsxHtmlPropsWithChildren<{
|
|
3
|
+
'aria-label'?: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** Horizontal wrap list for presentational chips. */
|
|
7
|
+
export declare function RuiChipList({ children, class: className, 'aria-label': ariaLabel, ...props }: RuiChipListProps): import("@ecopages/jsx").JsxRenderable;
|
|
8
|
+
export type RuiChipListItemProps = JsxHtmlPropsWithChildren;
|
|
9
|
+
/** List item wrapper for a chip. */
|
|
10
|
+
export declare function RuiChipListItem({ children, class: className, ...props }: RuiChipListItemProps): import("@ecopages/jsx").JsxRenderable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuiChipList, RuiChipListItem, type RuiChipListItemProps, type RuiChipListProps } from './chip-list';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as n}from"@ecopages/jsx/jsx-runtime";function r(...t){return t.filter(Boolean).join(" ")}var c=Symbol.for("@ecopages/storybook-radiant.viewModule");function e(t,i,o){let s=t;return s[c]=o,t}function a({children:t,class:i,"aria-label":o,...s}){return n("ul",{...s,class:r("rui-chip-list",i),"aria-label":o,children:t})}function l({children:t,class:i,...o}){return n("li",{...o,class:r("rui-chip-list__item",i),children:t})}e(a,["./chip-list.css"],import.meta.url);export{a as RuiChipList,l as RuiChipListItem};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ui/chip-list/chip-list.tsx", "../../../../src/lib/cx.ts", "../../../../src/lib/radiant-view.ts"],
|
|
4
|
+
"sourcesContent": ["import { jsx } from \"@ecopages/jsx/jsx-runtime\";\nimport { cx } from \"@/lib/cx\";\nimport { attachRadiantStylesheets } from \"@/lib/radiant-view\";\nexport function RuiChipList({\n children,\n class: className,\n \"aria-label\": ariaLabel,\n ...props\n}) {\n return /* @__PURE__ */jsx(\"ul\", {\n ...props,\n class: cx(\"rui-chip-list\", className),\n \"aria-label\": ariaLabel,\n children\n });\n}\nexport function RuiChipListItem({\n children,\n class: className,\n ...props\n}) {\n return /* @__PURE__ */jsx(\"li\", {\n ...props,\n class: cx(\"rui-chip-list__item\", className),\n children\n });\n}\nattachRadiantStylesheets(RuiChipList, [\"./chip-list.css\"], import.meta.url);", "export function cx(...parts) {\n return parts.filter(Boolean).join(\" \");\n}", "const RADIANT_VIEW_ELEMENT = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.viewElement\");\nconst RADIANT_SCRIPT_MODULE = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.scriptModule\");\nconst RADIANT_SCRIPT_EXPORT = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.scriptExport\");\nconst RADIANT_VIEW_MODULE = /* @__PURE__ */Symbol.for(\"@ecopages/storybook-radiant.viewModule\");\nfunction linkViewToElement(view, element) {\n view[RADIANT_VIEW_ELEMENT] = element;\n const ssrModule = element[RADIANT_SCRIPT_MODULE];\n if (ssrModule) {\n view[RADIANT_SCRIPT_MODULE] = ssrModule;\n view[RADIANT_SCRIPT_EXPORT] = element[RADIANT_SCRIPT_EXPORT] ?? element.name;\n }\n}\nexport function defineRadiantView(element, render, _options) {\n const view = args => render(args);\n linkViewToElement(view, element);\n return view;\n}\nexport function attachRadiantStylesheets(target, _stylesheets, moduleUrl) {\n const view = target;\n view[RADIANT_VIEW_MODULE] = moduleUrl;\n return target;\n}\nexport function syncRadiantViewMetadata(view) {\n const element = view[RADIANT_VIEW_ELEMENT];\n if (element) {\n linkViewToElement(view, element);\n }\n}"],
|
|
5
|
+
"mappings": "AAAA,OAAS,OAAAA,MAAW,4BCAb,SAASC,KAAMC,EAAO,CAC3B,OAAOA,EAAM,OAAO,OAAO,EAAE,KAAK,GAAG,CACvC,CCCA,IAAMC,EAAqC,OAAO,IAAI,wCAAwC,EAcvF,SAASC,EAAyBC,EAAQC,EAAcC,EAAW,CACxE,IAAMC,EAAOH,EACb,OAAAG,EAAKC,CAAmB,EAAIF,EACrBF,CACT,CFlBO,SAASK,EAAY,CAC1B,SAAAC,EACA,MAAOC,EACP,aAAcC,EACd,GAAGC,CACL,EAAG,CACD,OAAsBC,EAAI,KAAM,CAC9B,GAAGD,EACH,MAAOE,EAAG,gBAAiBJ,CAAS,EACpC,aAAcC,EACd,SAAAF,CACF,CAAC,CACH,CACO,SAASM,EAAgB,CAC9B,SAAAN,EACA,MAAOC,EACP,GAAGE,CACL,EAAG,CACD,OAAsBC,EAAI,KAAM,CAC9B,GAAGD,EACH,MAAOE,EAAG,sBAAuBJ,CAAS,EAC1C,SAAAD,CACF,CAAC,CACH,CACAO,EAAyBR,EAAa,CAAC,iBAAiB,EAAG,YAAY,GAAG",
|
|
6
|
+
"names": ["jsx", "cx", "parts", "RADIANT_VIEW_MODULE", "attachRadiantStylesheets", "target", "_stylesheets", "moduleUrl", "view", "RADIANT_VIEW_MODULE", "RuiChipList", "children", "className", "ariaLabel", "props", "jsx", "cx", "RuiChipListItem", "attachRadiantStylesheets"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
|
+
@layer components {
|
|
4
|
+
.rui-floating {
|
|
5
|
+
position: fixed;
|
|
6
|
+
visibility: hidden;
|
|
7
|
+
}
|
|
8
|
+
.rui-popover {
|
|
9
|
+
z-index: var(--z-index-popover, var(--z-popover));
|
|
10
|
+
overflow: auto;
|
|
11
|
+
border-radius: var(--radius-container, var(--radius-container));
|
|
12
|
+
border-style: var(--tw-border-style);
|
|
13
|
+
border-width: 1px;
|
|
14
|
+
border-color: var(--color-border, var(--border));
|
|
15
|
+
background-color: var(--color-background, var(--background));
|
|
16
|
+
--tw-shadow: var(--shadow-overlay);
|
|
17
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
18
|
+
}
|
|
19
|
+
.rui-popover--listbox {
|
|
20
|
+
display: flex;
|
|
21
|
+
width: 100%;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
padding: 0px;
|
|
25
|
+
}
|
|
26
|
+
.rui-popover[hidden] {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
.rui-popover-trigger {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
3
33
|
rui-combobox {
|
|
4
34
|
position: relative;
|
|
5
35
|
display: inline-flex;
|
|
@@ -13,14 +43,17 @@ rui-combobox {
|
|
|
13
43
|
line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
|
|
14
44
|
}
|
|
15
45
|
.rui-combobox__control {
|
|
16
|
-
position: relative;
|
|
17
46
|
display: flex;
|
|
18
|
-
|
|
19
|
-
|
|
47
|
+
width: 100%;
|
|
48
|
+
min-width: 0px;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: var(--spacing-1, var(--space-1));
|
|
51
|
+
border-radius: var(--radius-control, var(--radius-control));
|
|
20
52
|
border-style: var(--tw-border-style);
|
|
21
53
|
border-width: 1px;
|
|
22
54
|
border-color: var(--color-border, var(--border));
|
|
23
55
|
background-color: var(--color-background, var(--background));
|
|
56
|
+
padding-inline: var(--spacing-1, var(--space-1));
|
|
24
57
|
}
|
|
25
58
|
.rui-combobox__control:focus-within {
|
|
26
59
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
@@ -33,96 +66,25 @@ rui-combobox {
|
|
|
33
66
|
border-style: var(--tw-border-style);
|
|
34
67
|
border-width: 0px;
|
|
35
68
|
background-color: transparent;
|
|
36
|
-
padding-inline: var(--spacing-3, var(--space-3));
|
|
37
|
-
padding-block: var(--spacing-2, var(--space-2));
|
|
38
69
|
color: var(--color-on-background, var(--on-background));
|
|
39
70
|
--tw-outline-style: none;
|
|
40
71
|
outline-style: none;
|
|
72
|
+
padding-inline: var(--space-control-x);
|
|
73
|
+
padding-block: var(--space-control-y);
|
|
74
|
+
font-size: var(--text-control, 0.875rem);
|
|
41
75
|
}
|
|
42
76
|
.rui-combobox__input:disabled {
|
|
43
77
|
cursor: not-allowed;
|
|
44
78
|
opacity: var(--opacity-muted, var(--opacity-muted));
|
|
45
79
|
}
|
|
46
|
-
.rui-combobox__trigger {
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
flex-shrink: 0;
|
|
49
|
-
align-items: center;
|
|
50
|
-
justify-content: center;
|
|
51
|
-
border-style: var(--tw-border-style);
|
|
52
|
-
border-width: 0px;
|
|
53
|
-
border-left-style: var(--tw-border-style);
|
|
54
|
-
border-left-width: 1px;
|
|
55
|
-
border-color: var(--color-border, var(--border));
|
|
56
|
-
background-color: transparent;
|
|
57
|
-
padding-inline: var(--spacing-2, var(--space-2));
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
color: var(--color-on-surface, var(--on-surface));
|
|
60
|
-
}
|
|
61
|
-
.rui-combobox__trigger:disabled {
|
|
62
|
-
cursor: not-allowed;
|
|
63
|
-
opacity: var(--opacity-muted, var(--opacity-muted));
|
|
64
|
-
}
|
|
65
|
-
.rui-combobox__trigger:focus-visible {
|
|
66
|
-
background-color: var(--color-surface, var(--surface));
|
|
67
|
-
--tw-outline-style: none;
|
|
68
|
-
outline-style: none;
|
|
69
|
-
}
|
|
70
80
|
.rui-combobox__listbox {
|
|
71
|
-
|
|
72
|
-
top: 100%;
|
|
73
|
-
z-index: var(--z-index-popover, var(--z-popover));
|
|
74
|
-
margin-top: var(--spacing-1, var(--space-1));
|
|
75
|
-
max-height: calc(var(--spacing, 0.25rem) * 48);
|
|
76
|
-
width: 100%;
|
|
77
|
-
overflow: auto;
|
|
78
|
-
border-radius: var(--radius-container, var(--radius-container));
|
|
79
|
-
border-style: var(--tw-border-style);
|
|
80
|
-
border-width: 1px;
|
|
81
|
-
border-color: var(--color-border, var(--border));
|
|
82
|
-
background-color: var(--color-background, var(--background));
|
|
83
|
-
@media (forced-colors: active) {
|
|
84
|
-
background-image: none;
|
|
85
|
-
}
|
|
86
|
-
background-image: var(--sheen-image);
|
|
87
|
-
@media (forced-colors: active) {
|
|
88
|
-
background-image: none;
|
|
89
|
-
}
|
|
90
|
-
padding: var(--spacing-1, var(--space-1));
|
|
91
|
-
--tw-shadow: var(--shadow-overlay);
|
|
92
|
-
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
81
|
+
min-width: 0px;
|
|
93
82
|
}
|
|
94
83
|
.rui-combobox__listbox[hidden] {
|
|
95
84
|
display: none;
|
|
96
85
|
}
|
|
97
|
-
.rui-
|
|
98
|
-
|
|
99
|
-
border-radius: var(--radius-control, var(--radius-control));
|
|
100
|
-
padding-inline: var(--spacing-3, var(--space-3));
|
|
101
|
-
padding-block: var(--spacing-2, var(--space-2));
|
|
102
|
-
color: var(--color-on-background, var(--on-background));
|
|
103
|
-
}
|
|
104
|
-
.rui-combobox__option[aria-disabled='true'] {
|
|
105
|
-
cursor: not-allowed;
|
|
106
|
-
opacity: var(--opacity-muted, var(--opacity-muted));
|
|
107
|
-
}
|
|
108
|
-
.rui-combobox__option:hover {
|
|
109
|
-
background-color: var(--color-surface, var(--surface));
|
|
110
|
-
--tw-outline-style: none;
|
|
111
|
-
outline-style: none;
|
|
112
|
-
}
|
|
113
|
-
.rui-combobox__option[data-active],
|
|
114
|
-
.rui-combobox__option[aria-selected='true'] {
|
|
115
|
-
background-color: var(--color-primary, var(--primary));
|
|
116
|
-
@media (forced-colors: active) {
|
|
117
|
-
background-image: none;
|
|
118
|
-
}
|
|
119
|
-
background-image: var(--sheen-image);
|
|
120
|
-
@media (forced-colors: active) {
|
|
121
|
-
background-image: none;
|
|
122
|
-
}
|
|
123
|
-
color: var(--color-on-primary, var(--on-primary));
|
|
124
|
-
--tw-outline-style: none;
|
|
125
|
-
outline-style: none;
|
|
86
|
+
.rui-combobox__listbox > rui-listbox {
|
|
87
|
+
min-width: 0px;
|
|
126
88
|
}
|
|
127
89
|
}
|
|
128
90
|
@property --tw-border-style {
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import type { JsxHtmlProps, JsxHtmlPropsWithChildren
|
|
1
|
+
import type { JsxHtmlProps, JsxHtmlPropsWithChildren } from '@ecopages/jsx';
|
|
2
|
+
import { RuiListboxOption, type RuiListboxOptionData } from '../listbox';
|
|
2
3
|
import type { RuiComboboxProps } from './combobox.script';
|
|
3
4
|
export type RuiComboboxControlProps = JsxHtmlPropsWithChildren<{
|
|
4
5
|
slot?: string;
|
|
5
6
|
}>;
|
|
6
|
-
/** Input row wrapper for the combobox input and
|
|
7
|
-
export declare function RuiComboboxControl({ children, slot, class: className, ...props }: RuiComboboxControlProps): JsxRenderable;
|
|
7
|
+
/** Input row wrapper for the combobox input and toggle button. */
|
|
8
|
+
export declare function RuiComboboxControl({ children, slot, class: className, ...props }: RuiComboboxControlProps): import("@ecopages/jsx").JsxRenderable;
|
|
8
9
|
export type RuiComboboxInputProps = JsxHtmlProps<{
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
}>;
|
|
12
13
|
/** Text input with `role="combobox"`. Place inside `RuiComboboxControl`. */
|
|
13
|
-
export declare function RuiComboboxInput({ placeholder, disabled, class: className, ...props }: RuiComboboxInputProps): JsxRenderable;
|
|
14
|
+
export declare function RuiComboboxInput({ placeholder, disabled, class: className, ...props }: RuiComboboxInputProps): import("@ecopages/jsx").JsxRenderable;
|
|
14
15
|
export type RuiComboboxTriggerProps = JsxHtmlPropsWithChildren<{
|
|
15
16
|
'aria-label'?: string;
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
}>;
|
|
18
|
-
/**
|
|
19
|
-
export declare function RuiComboboxTrigger({ children, class: className, 'aria-label': ariaLabel, disabled, ...props }: RuiComboboxTriggerProps): JsxRenderable;
|
|
19
|
+
/** Toggle button for opening the listbox popup. */
|
|
20
|
+
export declare function RuiComboboxTrigger({ children, class: className, 'aria-label': ariaLabel, disabled, ...props }: RuiComboboxTriggerProps): import("@ecopages/jsx").JsxRenderable;
|
|
20
21
|
export type RuiComboboxListboxProps = JsxHtmlPropsWithChildren<{
|
|
21
22
|
slot?: string;
|
|
22
23
|
}>;
|
|
23
|
-
/** Popup
|
|
24
|
-
export declare function RuiComboboxListbox({ children, slot, class: className, ...props }: RuiComboboxListboxProps): JsxRenderable;
|
|
25
|
-
export type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
label?: string;
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
}>;
|
|
31
|
-
/** Listbox option placed inside `RuiComboboxListbox`. */
|
|
32
|
-
export declare function RuiComboboxOption({ value, label, children, class: className, disabled, ...props }: RuiComboboxOptionProps): JsxRenderable;
|
|
33
|
-
export type RuiComboboxOptionData = {
|
|
34
|
-
value: string;
|
|
35
|
-
label: JsxRenderable;
|
|
36
|
-
};
|
|
24
|
+
/** Popup shell slotted into `listbox`. Place an embedded `RuiListbox` inside. */
|
|
25
|
+
export declare function RuiComboboxListbox({ children, slot, class: className, ...props }: RuiComboboxListboxProps): import("@ecopages/jsx").JsxRenderable;
|
|
26
|
+
export type RuiComboboxOptionData = RuiListboxOptionData;
|
|
27
|
+
/** @deprecated Use `RuiListboxOption` */
|
|
28
|
+
export declare const RuiComboboxOption: typeof RuiListboxOption;
|
|
37
29
|
/**
|
|
38
30
|
* Combobox view. Pair with `RuiLabel` (sibling or via `RuiField`) for the visible name —
|
|
39
31
|
* do not nest a combobox-specific label.
|
|
@@ -25,13 +25,13 @@ export type RuiComboboxChangeDetail = {
|
|
|
25
25
|
*
|
|
26
26
|
* Pair with `RuiLabel` (sibling, or via `RuiField`) for the visible name.
|
|
27
27
|
* Compose with `data-combobox-input`, optional `data-combobox-trigger`,
|
|
28
|
-
* `data-combobox-listbox
|
|
28
|
+
* `data-combobox-listbox` (popup shell), and an embedded `RuiListbox`.
|
|
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
|
* @element rui-combobox
|
|
33
33
|
* @slot control - Input row (`RuiComboboxControl` with input and trigger).
|
|
34
|
-
* @slot listbox - Popup
|
|
34
|
+
* @slot listbox - Popup shell (`RuiComboboxListbox`) containing an embedded `RuiListbox`.
|
|
35
35
|
* @fires rui-change
|
|
36
36
|
*/
|
|
37
37
|
export declare class RuiCombobox extends RadiantElement {
|
|
@@ -42,48 +42,49 @@ export declare class RuiCombobox extends RadiantElement {
|
|
|
42
42
|
openOnFocus: boolean;
|
|
43
43
|
changeEvent: EventEmitter<RuiComboboxChangeDetail>;
|
|
44
44
|
private open;
|
|
45
|
-
/** True when visual focus is in the listbox (aria-activedescendant is set). */
|
|
46
|
-
private listboxHasVisualFocus;
|
|
47
|
-
private activeIndex;
|
|
48
45
|
private skipNextFocusOpen;
|
|
49
46
|
private readonly uid;
|
|
47
|
+
private readonly listboxBehavior;
|
|
48
|
+
rootTarget: HTMLElement;
|
|
50
49
|
private get listboxId();
|
|
51
50
|
private get inputId();
|
|
52
51
|
private getInput;
|
|
53
52
|
private getTrigger;
|
|
53
|
+
private getListboxPopup;
|
|
54
54
|
private getListbox;
|
|
55
|
+
private getListboxHost;
|
|
55
56
|
private getOptions;
|
|
56
|
-
private getVisibleOptions;
|
|
57
57
|
private getOptionLabel;
|
|
58
58
|
private ensureOptionIds;
|
|
59
59
|
private getAccessibleName;
|
|
60
60
|
private isComboboxInput;
|
|
61
|
-
/** Prefer `RuiLabel` as a previous sibling or Field-managed label. */
|
|
62
|
-
private findAssociatedLabel;
|
|
63
61
|
private syncLabel;
|
|
64
62
|
private syncTrigger;
|
|
65
63
|
private syncInput;
|
|
66
|
-
private
|
|
67
|
-
private
|
|
64
|
+
private syncListboxHost;
|
|
65
|
+
private syncOptionSelection;
|
|
68
66
|
private setVisualFocusCombobox;
|
|
69
67
|
private setOpen;
|
|
70
|
-
private
|
|
68
|
+
private getAutocomplete;
|
|
69
|
+
private syncAutocompleteFilter;
|
|
70
|
+
/** Restores the unfiltered collection when arrow navigation has no match to enter. */
|
|
71
|
+
private showAllOptions;
|
|
72
|
+
private syncFilter;
|
|
71
73
|
private select;
|
|
72
74
|
private syncFromValue;
|
|
73
75
|
private initialize;
|
|
74
76
|
connectedCallback(): void;
|
|
77
|
+
disconnectedCallback(): void;
|
|
75
78
|
onPropsUpdated(): void;
|
|
76
79
|
onRootFocusIn(event: FocusEvent): void;
|
|
77
80
|
onRootInput(event: Event): void;
|
|
78
81
|
onRootKeydown(event: KeyboardEvent): void;
|
|
79
|
-
/** Filter, open, and move the active option by one step (wrapping) toward `direction`. */
|
|
80
|
-
private moveActive;
|
|
81
82
|
private handleInputKeydown;
|
|
82
83
|
onTriggerClick(event: Event): void;
|
|
83
84
|
onOptionPointerOver(event: Event): void;
|
|
84
85
|
onOptionMouseDown(event: Event): void;
|
|
85
86
|
onOptionClick(event: Event): void;
|
|
86
87
|
onFocusOut(event: FocusEvent): void;
|
|
87
|
-
|
|
88
|
+
onDocumentPointerDown(event: PointerEvent): void;
|
|
88
89
|
render(): import("@ecopages/jsx").JsxRenderable;
|
|
89
90
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { RuiCombobox as RuiComboboxElement, type RuiComboboxProps, type RuiComboboxChangeDetail, } from './combobox.script';
|
|
2
|
-
export { RuiCombobox, RuiComboboxControl, RuiComboboxInput, RuiComboboxListbox,
|
|
2
|
+
export { RuiCombobox, RuiComboboxControl, RuiComboboxInput, RuiComboboxListbox, RuiComboboxTrigger, RuiComboboxOption, type RuiComboboxOptionData, } from './combobox';
|
|
3
|
+
export { RuiListbox, RuiListboxOption } from '../listbox';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as It,jsxs as Kt}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as At,customElement as qt,event as $t,onEvent as O,onUpdated as Ut,prop as k}from"@ecopages/radiant";var at,lt,ut,ct,bt,pt,ht,dt,ft,mt,gt,xt,vt,yt;function Tt(o,t,e,i,s,m){var p,l,K,q,S,$,w,P=Symbol.metadata||Symbol.for("Symbol.metadata"),X=Object.defineProperty,U=Object.create,G=[U(null),U(null)],J=t.length;function F(n,g,h){return function(r,a){g&&(a=r,r=o);for(var x=0;x<n.length;x++)a=n[x].apply(r,h?[a]:[]);return h?a:r}}function I(n,g,h,r){if(typeof n!="function"&&(r||n!==void 0))throw new TypeError(g+" must "+(h||"be")+" a function"+(r?"":" or undefined"));return n}function Q(n,g,h,r,a,x,_,d,v,y,Z){function H(c){if(!Z(c))throw new TypeError("Attempted to access private element on non-instance")}var z=[].concat(g[0]),tt=g[3],B=!_,R=a===1,et=a===3,it=a===4,L=a===2;function T(c,C,nt){return function(j,rt){return C&&(rt=j,j=n),nt&&nt(j),u[c].call(j,rt)}}if(!B){var u={},N=[],A=et?"get":it||R?"set":"value";if(v?(y||R?u={get:Ot(function(){return tt(this)},r,"get"),set:function(c){g[4](this,c)}}:u[A]=tt,y||Ot(u[A],r,L?"":A)):y||(u=Object.getOwnPropertyDescriptor(n,r)),!y&&!v){if((l=G[+d][r])&&(l^a)!==7)throw Error("Decorating two elements with the same name ("+u[A].name+") is not supported yet");G[+d][r]=a<3?1:a}}for(var b=n,D=z.length-1;D>=0;D-=h?2:1){var ot=I(z[D],"A decorator","be",!0),st=h?z[D-1]:void 0,W={},V={kind:["field","accessor","method","getter","setter","class"][a],name:r,metadata:p,addInitializer:function(c,C){if(c.v)throw new TypeError("attempted to call addInitializer after decoration was finished");I(C,"An initializer","be",!0),x.push(C)}.bind(null,W)};if(B)l=ot.call(st,b,V),W.v=1,I(l,"class decorators","return")&&(b=l);else if(V.static=d,V.private=v,l=V.access={has:v?Z.bind():function(c){return r in c}},it||(l.get=v?L?function(c){return H(c),u.value}:T("get",0,H):function(c){return c[r]}),L||et||(l.set=v?T("set",0,H):function(c,C){c[r]=C}),b=ot.call(st,R?{get:u.get,set:u.set}:u[A],V),W.v=1,R){if(typeof b=="object"&&b)(l=I(b.get,"accessor.get"))&&(u.get=l),(l=I(b.set,"accessor.set"))&&(u.set=l),(l=I(b.init,"accessor.init"))&&N.unshift(l);else if(b!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else I(b,(y?"field":"method")+" decorators","return")&&(y?N.unshift(b):u[A]=b)}return a<2&&_.push(F(N,d,1),F(x,d,0)),y||B||(v?R?_.splice(-1,0,T("get",d),T("set",d)):_.push(L?u[A]:I.call.bind(u[A])):X(n,r,u)),b}function Y(n){return X(n,P,{configurable:!0,enumerable:!0,value:p})}return m!==void 0&&(p=m[P]),p=U(p??null),S=[],$=function(n){n&&S.push(F(n))},w=function(n,g){for(var h=0;h<e.length;h++){var r=e[h],a=r[1],x=7&a;if((8&a)==n&&!x==g){var _=r[2],d=!!r[3],v=16&a;Q(n?o:o.prototype,r,v,d?"#"+_:Dt(_),x,x<2?[]:n?q=q||[]:K=K||[],S,!!n,d,g,n&&d?function(y){return Mt(y)===o}:s)}}},w(8,0),w(0,0),w(8,1),w(0,1),$(K),$(q),l=S,J||Y(o),{e:l,get c(){var n=[];return J&&[Y(o=Q(o,[t],i,o.name,5,n)),F(n,1)]}}}function Dt(o){var t=jt(o,"string");return typeof t=="symbol"?t:t+""}function jt(o,t){if(typeof o!="object"||!o)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var i=e.call(o,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}function Ot(o,t,e){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(o,"name",{configurable:!0,value:e?e+" "+t:t})}catch{}return o}function Mt(o){if(Object(o)!==o)throw TypeError("right-hand side of 'in' should be an object, got "+(o!==null?typeof o:"null"));return o}var M,_t=class extends At{static{({e:[ut,ct,bt,pt,ht,dt,ft,mt,gt,xt,vt,yt,at],c:[M,lt]}=Tt(this,[qt("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"],[$t({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Ut(["value","label","placeholder","disabled","openOnFocus"]),2,"onPropsUpdated"],[O({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[O({ref:"root",type:"input"}),2,"onRootInput"],[O({ref:"root",type:"keydown",options:{capture:!0}}),2,"onRootKeydown"],[O({selector:"[data-combobox-trigger]",type:"click"}),2,"onTriggerClick"],[O({selector:"[data-combobox-option]",type:"pointerover"}),2,"onOptionPointerOver"],[O({selector:"[data-combobox-option]",type:"mousedown"}),2,"onOptionMouseDown"],[O({selector:"[data-combobox-option]",type:"click"}),2,"onOptionClick"],[O({ref:"root",type:"focusout"}),2,"onFocusOut"],[O({document:!0,type:"click"}),2,"onDocumentClick"]],0,void 0,At))}value=(at(this),ut(this));label=(ct(this),bt(this));placeholder=(pt(this),ht(this));disabled=(dt(this),ft(this));openOnFocus=(mt(this),gt(this));changeEvent=(xt(this),vt(this));open=(yt(this),!1);listboxHasVisualFocus=!1;activeIndex=-1;skipNextFocusOpen=!1;uid=Math.random().toString(36).slice(2,9);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]")}getListbox(){return this.querySelector("[data-combobox-listbox]")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll("[data-combobox-option]")):[]}getVisibleOptions(){return this.getOptions().filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureOptionIds(){this.getOptions().forEach((t,e)=>{t.id||(t.id=`rui-combobox-option-${this.uid}-${e}`)})}getAccessibleName(){return this.findAssociatedLabel()?.textContent?.trim()||this.label||"Suggestions"}isComboboxInput(t){return t instanceof HTMLInputElement&&t.hasAttribute("data-combobox-input")}findAssociatedLabel(){let t=this.previousElementSibling;if(t?.tagName.toLowerCase()==="label")return t;let e=this.parentElement;if(e){let i=e.querySelector("[data-rui-field-label], label.rui-label");if(i)return i}return null}syncLabel(){let t=this.getInput();if(!t||t.hasAttribute("data-rui-field-managed"))return;let e=this.findAssociatedLabel();if(e){e.id||(e.id=`rui-combobox-label-${this.uid}`),e.htmlFor||(e.htmlFor=this.inputId),t.setAttribute("aria-labelledby",e.id),t.removeAttribute("aria-label");return}if(this.label){t.setAttribute("aria-label",this.label),t.removeAttribute("aria-labelledby");return}t.removeAttribute("aria-label"),t.removeAttribute("aria-labelledby")}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();!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("role","listbox"),e.setAttribute("aria-label",this.getAccessibleName()),this.placeholder&&!t.placeholder&&(t.placeholder=this.placeholder),this.disabled&&(t.disabled=!0),this.syncTrigger())}clearActiveOption(){this.activeIndex=-1,this.listboxHasVisualFocus=!1,this.getInput()?.removeAttribute("aria-activedescendant");for(let e of this.getOptions())e.removeAttribute("data-active"),e.removeAttribute("aria-selected")}setActiveOption(t){let e=this.getVisibleOptions();if(t<0||t>=e.length){this.clearActiveOption();return}this.activeIndex=t,this.listboxHasVisualFocus=!0;for(let m of this.getOptions())m.removeAttribute("data-active"),m.removeAttribute("aria-selected");let i=e[t],s=this.getInput();!i||!s||(i.id||(i.id=`rui-combobox-option-${this.uid}-${t}`),i.setAttribute("data-active","true"),i.setAttribute("aria-selected","true"),s.setAttribute("aria-activedescendant",i.id),i.scrollIntoView({block:"nearest"}))}setVisualFocusCombobox(){this.clearActiveOption()}setOpen(t,e={}){let i=e.activate??"none";this.open=t;let s=this.getInput(),m=this.getListbox();if(!(!s||!m)){if(s.setAttribute("aria-expanded",String(t)),m.hidden=!t,this.syncTrigger(),!t){this.clearActiveOption();return}if(this.ensureOptionIds(),i==="first"){let p=this.getVisibleOptions();this.setActiveOption(p.length?0:-1);return}if(i==="last"){let p=this.getVisibleOptions();this.setActiveOption(p.length?p.length-1:-1);return}this.clearActiveOption()}}filterOptions(t){let e=t.trim().toLowerCase();for(let i of this.getOptions()){let s=this.getOptionLabel(i).toLowerCase();i.hidden=e!==""&&!s.startsWith(e)}}select(t){if(t.getAttribute("aria-disabled")==="true")return;let e=t.getAttribute("data-value")||this.getOptionLabel(t),i=this.getOptionLabel(t)||e;this.value=e;let s=this.getInput();s&&(s.value=i),this.changeEvent.emit({value:e}),this.skipNextFocusOpen=!0,this.setOpen(!1),s?.focus()}syncFromValue(){let t=this.getInput();if(!t)return;let e=this.getOptions().find(s=>s.getAttribute("data-value")===this.value),i=e?this.getOptionLabel(e):this.value||"";t.value=i}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncInput(),this.syncFromValue(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncFromValue()}onRootFocusIn(t){if(this.isComboboxInput(t.target)){if(this.skipNextFocusOpen){this.skipNextFocusOpen=!1;return}this.openOnFocus&&(this.filterOptions(this.getInput()?.value??""),this.setOpen(!0),this.setVisualFocusCombobox())}}onRootInput(t){if(!this.isComboboxInput(t.target))return;let e=t.target;this.filterOptions(e.value),e.value.trim()!==""&&this.getVisibleOptions().length?this.setOpen(!0):e.value.trim()===""&&this.openOnFocus?this.setOpen(!0):(e.value.trim()===""||!this.getVisibleOptions().length)&&this.setOpen(!1),this.setVisualFocusCombobox()}onRootKeydown(t){this.isComboboxInput(t.target)&&this.handleInputKeydown(t)}moveActive(t){this.filterOptions(this.getInput()?.value??""),this.getVisibleOptions().length||this.filterOptions("");let e=this.getVisibleOptions();if(e.length){if(!this.open){this.setOpen(!0,{activate:t===1?"first":"last"});return}if(this.listboxHasVisualFocus){let i=t===1?this.activeIndex>=e.length-1?0:this.activeIndex+1:this.activeIndex<=0?e.length-1:this.activeIndex-1;this.setActiveOption(i);return}this.setActiveOption(t===1?0:e.length-1)}}handleInputKeydown(t){if(t.ctrlKey||t.shiftKey||t.metaKey)return;let e=t.altKey;if(t.key==="ArrowDown"){if(t.preventDefault(),t.stopPropagation(),e){this.open||(this.filterOptions(this.getInput()?.value??""),this.setOpen(!0));return}this.moveActive(1);return}if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),e){this.open&&this.setOpen(!1);return}this.moveActive(-1);return}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 s=i.value.length;i.setSelectionRange(s,s),this.setVisualFocusCombobox();return}if(t.key==="Escape"){if(t.preventDefault(),this.open){this.setOpen(!1);return}let i=this.getInput();i&&i.value&&(i.value="",this.value="",this.changeEvent.emit({value:""}),this.filterOptions(""));return}if(t.key==="Enter"){let i=this.getVisibleOptions();if(this.open&&this.listboxHasVisualFocus&&i[this.activeIndex]){t.preventDefault(),this.select(i[this.activeIndex]);return}this.open&&(t.preventDefault(),this.setOpen(!1));return}if(t.key==="Tab"&&this.open){let i=this.getVisibleOptions();if(this.listboxHasVisualFocus&&i[this.activeIndex]){this.select(i[this.activeIndex]);return}this.setOpen(!1)}}onTriggerClick(t){t.preventDefault();let e=this.getInput();!e||e.disabled||(this.open?(this.skipNextFocusOpen=!0,this.setOpen(!1)):(this.filterOptions(e.value),this.setOpen(!0),this.setVisualFocusCombobox()),e.focus())}onOptionPointerOver(t){if(!this.open)return;let e=t.target.closest("[data-combobox-option]");if(!e||e.getAttribute("aria-disabled")==="true"||e.hidden)return;let s=this.getVisibleOptions().indexOf(e);s>=0&&this.setActiveOption(s)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let e=t.target.closest("[data-combobox-option]");e&&this.select(e)}onFocusOut(t){let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.setOpen(!1)}onDocumentClick(t){this.contains(t.target)||this.setOpen(!1)}render(){return Kt("div",{class:"rui-combobox","data-ref":"root",children:[It("slot",{name:"control"}),It("slot",{name:"listbox"})]})}static{lt()}};import{jsx as f,jsxs as Rt}from"@ecopages/jsx/jsx-runtime";function E(...o){return o.filter(Boolean).join(" ")}var Ht=Symbol.for("@ecopages/storybook-radiant.viewElement"),Ct=Symbol.for("@ecopages/storybook-radiant.scriptModule"),Et=Symbol.for("@ecopages/storybook-radiant.scriptExport");function zt(o,t){o[Ht]=t;let e=t[Ct];e&&(o[Ct]=e,o[Et]=t[Et]??t.name)}function wt(o,t,e){let i=s=>t(s);return zt(i,o),i}function Vt({children:o,slot:t="control",class:e,...i}){return f("div",{...i,slot:t,class:E("rui-combobox__control",e),children:o})}function kt({placeholder:o,disabled:t,class:e,...i}){return f("input",{...i,type:"text","data-combobox-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:E("rui-combobox__input",e),placeholder:o,disabled:t,autocomplete:"off"})}function St({children:o,class:t,"aria-label":e="Show suggestions",disabled:i,...s}){return f("button",{...s,type:"button","data-combobox-trigger":!0,class:E("rui-combobox__trigger",t),"aria-label":e,disabled:i,tabIndex:-1,children:o??f("span",{"aria-hidden":"true",children:"\u25BE"})})}function Ft({children:o,slot:t="listbox",class:e,...i}){return f("div",{...i,slot:t,"data-combobox-listbox":!0,class:E("rui-combobox__listbox",e),hidden:!0,children:o})}function Lt({value:o,label:t,children:e,class:i,disabled:s,...m}){return f("div",{...m,role:"option","data-combobox-option":!0,"data-value":o,"data-label":t,class:E("rui-combobox__option",i),"aria-disabled":s?"true":void 0,children:e})}var Bt=wt(M,({options:o,children:t,...e})=>o!=null?Rt("rui-combobox",{...e,children:[Rt(Vt,{children:[f(kt,{placeholder:e.placeholder,disabled:e.disabled}),f(St,{})]}),f(Ft,{children:o.map(i=>f(Lt,{value:i.value,label:typeof i.label=="string"?i.label:void 0,children:i.label}))})]}):f("rui-combobox",{...e,children:t}),{stylesheets:["./combobox.css"]});export{Bt as RuiCombobox,Vt as RuiComboboxControl,M as RuiComboboxElement,kt as RuiComboboxInput,Ft as RuiComboboxListbox,Lt as RuiComboboxOption,St as RuiComboboxTrigger};
|
|
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};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|