@traefik-labs/faency 13.3.0 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/components/Alert/Alert.cjs.map +1 -1
  2. package/dist/components/Alert/Alert.js.map +1 -1
  3. package/dist/components/AriaTable/AriaTable.cjs +15 -5
  4. package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
  5. package/dist/components/AriaTable/AriaTable.js +16 -6
  6. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  7. package/dist/components/Badge/Badge.vanilla.css.cjs.map +1 -1
  8. package/dist/components/Badge/Badge.vanilla.css.js.map +1 -1
  9. package/dist/components/Card/Card.cjs.map +1 -1
  10. package/dist/components/Card/Card.js.map +1 -1
  11. package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
  12. package/dist/components/CodeBlock/CodeBlock.js +2 -2
  13. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +3 -3
  14. package/dist/components/CodeBlock/CodeBlock.vanilla.js +3 -3
  15. package/dist/components/Combobox/Combobox.vanilla.cjs +170 -0
  16. package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -0
  17. package/dist/components/Combobox/Combobox.vanilla.css.cjs +33 -0
  18. package/dist/components/Combobox/Combobox.vanilla.css.cjs.map +1 -0
  19. package/dist/components/Combobox/Combobox.vanilla.css.js +29 -0
  20. package/dist/components/Combobox/Combobox.vanilla.css.js.map +1 -0
  21. package/dist/components/Combobox/Combobox.vanilla.js +167 -0
  22. package/dist/components/Combobox/Combobox.vanilla.js.map +1 -0
  23. package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
  24. package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
  25. package/dist/components/Dialog/Dialog.cjs +1 -1
  26. package/dist/components/Dialog/Dialog.js +1 -1
  27. package/dist/components/Field/Field.cjs +80 -33
  28. package/dist/components/Field/Field.cjs.map +1 -1
  29. package/dist/components/Field/Field.js +80 -33
  30. package/dist/components/Field/Field.js.map +1 -1
  31. package/dist/components/Field/Field.vanilla.cjs +62 -32
  32. package/dist/components/Field/Field.vanilla.cjs.map +1 -1
  33. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  34. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
  35. package/dist/components/Field/Field.vanilla.css.js +4 -1
  36. package/dist/components/Field/Field.vanilla.css.js.map +1 -1
  37. package/dist/components/Field/Field.vanilla.js +63 -33
  38. package/dist/components/Field/Field.vanilla.js.map +1 -1
  39. package/dist/components/Field/FieldContext.cjs +48 -10
  40. package/dist/components/Field/FieldContext.cjs.map +1 -1
  41. package/dist/components/Field/FieldContext.js +48 -10
  42. package/dist/components/Field/FieldContext.js.map +1 -1
  43. package/dist/components/List/List.cjs +1 -1
  44. package/dist/components/List/List.js +1 -1
  45. package/dist/components/Meter/Meter.vanilla.cjs +74 -0
  46. package/dist/components/Meter/Meter.vanilla.cjs.map +1 -0
  47. package/dist/components/Meter/Meter.vanilla.css.cjs +26 -0
  48. package/dist/components/Meter/Meter.vanilla.css.cjs.map +1 -0
  49. package/dist/components/Meter/Meter.vanilla.css.js +21 -0
  50. package/dist/components/Meter/Meter.vanilla.css.js.map +1 -0
  51. package/dist/components/Meter/Meter.vanilla.js +72 -0
  52. package/dist/components/Meter/Meter.vanilla.js.map +1 -0
  53. package/dist/components/NavigationTree/NavigationTreeItem.cjs +2 -2
  54. package/dist/components/NavigationTree/NavigationTreeItem.js +2 -2
  55. package/dist/components/RowLink/RowLink.cjs +35 -12
  56. package/dist/components/RowLink/RowLink.cjs.map +1 -1
  57. package/dist/components/RowLink/RowLink.js +34 -12
  58. package/dist/components/RowLink/RowLink.js.map +1 -1
  59. package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +57 -0
  60. package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -0
  61. package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.cjs +35 -0
  62. package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.cjs.map +1 -0
  63. package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.js +34 -0
  64. package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.js.map +1 -0
  65. package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +53 -0
  66. package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -0
  67. package/dist/components/Select/Select.cjs +1 -1
  68. package/dist/components/Select/Select.js +1 -1
  69. package/dist/components/Spinner/Spinner.vanilla.cjs +50 -0
  70. package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -0
  71. package/dist/components/Spinner/Spinner.vanilla.css.cjs +21 -0
  72. package/dist/components/Spinner/Spinner.vanilla.css.cjs.map +1 -0
  73. package/dist/components/Spinner/Spinner.vanilla.css.js +19 -0
  74. package/dist/components/Spinner/Spinner.vanilla.css.js.map +1 -0
  75. package/dist/components/Spinner/Spinner.vanilla.js +48 -0
  76. package/dist/components/Spinner/Spinner.vanilla.js.map +1 -0
  77. package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +214 -0
  78. package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -0
  79. package/dist/components/SplitLayout/SplitLayout.vanilla.css.cjs +14 -0
  80. package/dist/components/SplitLayout/SplitLayout.vanilla.css.cjs.map +1 -0
  81. package/dist/components/SplitLayout/SplitLayout.vanilla.css.js +10 -0
  82. package/dist/components/SplitLayout/SplitLayout.vanilla.css.js.map +1 -0
  83. package/dist/components/SplitLayout/SplitLayout.vanilla.js +210 -0
  84. package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -0
  85. package/dist/components/Table/Table.cjs +13 -4
  86. package/dist/components/Table/Table.cjs.map +1 -1
  87. package/dist/components/Table/Table.js +13 -4
  88. package/dist/components/Table/Table.js.map +1 -1
  89. package/dist/components/TextField/TextField.cjs +1 -1
  90. package/dist/components/TextField/TextField.js +1 -1
  91. package/dist/components/TextField/TextField.vanilla.cjs +1 -1
  92. package/dist/components/TextField/TextField.vanilla.js +1 -1
  93. package/dist/components/Textarea/Textarea.cjs +2 -2
  94. package/dist/components/Textarea/Textarea.js +2 -2
  95. package/dist/components/Textarea/Textarea.vanilla.cjs +2 -2
  96. package/dist/components/Textarea/Textarea.vanilla.js +2 -2
  97. package/dist/components/Toast/Toast.vanilla.cjs +96 -0
  98. package/dist/components/Toast/Toast.vanilla.cjs.map +1 -0
  99. package/dist/components/Toast/Toast.vanilla.css.cjs +44 -0
  100. package/dist/components/Toast/Toast.vanilla.css.cjs.map +1 -0
  101. package/dist/components/Toast/Toast.vanilla.css.js +37 -0
  102. package/dist/components/Toast/Toast.vanilla.css.js.map +1 -0
  103. package/dist/components/Toast/Toast.vanilla.js +90 -0
  104. package/dist/components/Toast/Toast.vanilla.js.map +1 -0
  105. package/dist/components/Toast/ToastProvider.vanilla.cjs +98 -0
  106. package/dist/components/Toast/ToastProvider.vanilla.cjs.map +1 -0
  107. package/dist/components/Toast/ToastProvider.vanilla.js +94 -0
  108. package/dist/components/Toast/ToastProvider.vanilla.js.map +1 -0
  109. package/dist/faency.css +3315 -2335
  110. package/dist/index.cjs +55 -32
  111. package/dist/index.d.ts +809 -14
  112. package/dist/index.js +41 -33
  113. package/dist/styles/cssProps.cjs +3 -10
  114. package/dist/styles/cssProps.cjs.map +1 -1
  115. package/dist/styles/cssProps.js +3 -10
  116. package/dist/styles/cssProps.js.map +1 -1
  117. package/dist/styles/resolveColor.cjs +18 -0
  118. package/dist/styles/resolveColor.cjs.map +1 -0
  119. package/dist/styles/resolveColor.js +18 -0
  120. package/dist/styles/resolveColor.js.map +1 -0
  121. package/dist/styles/themes.css.cjs.map +1 -1
  122. package/dist/styles/themes.css.js.map +1 -1
  123. package/dist/styles/tokens.css.cjs +484 -0
  124. package/dist/styles/tokens.css.cjs.map +1 -0
  125. package/dist/styles/tokens.css.js +484 -0
  126. package/dist/styles/tokens.css.js.map +1 -0
  127. package/dist/utils/warnOnce.cjs +13 -0
  128. package/dist/utils/warnOnce.cjs.map +1 -0
  129. package/dist/utils/warnOnce.js +13 -0
  130. package/dist/utils/warnOnce.js.map +1 -0
  131. package/package.json +12 -25
@@ -0,0 +1,170 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_cssProps = require("../../styles/cssProps.cjs");
3
+ const require_themeContext = require("../../styles/themeContext.cjs");
4
+ const require_Input_vanilla = require("../Input/Input.vanilla.cjs");
5
+ const require_Combobox_vanilla_css = require("./Combobox.vanilla.css.cjs");
6
+ let react = require("react");
7
+ react = require_runtime.__toESM(react, 1);
8
+ let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let _radix_ui_react_popover = require("@radix-ui/react-popover");
11
+ _radix_ui_react_popover = require_runtime.__toESM(_radix_ui_react_popover, 1);
12
+ // components/Combobox/Combobox.vanilla.tsx
13
+ var joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
14
+ var defaultFilter = (suggestion, query) => suggestion.toLowerCase().includes(query.toLowerCase());
15
+ var ComboboxVanilla = (0, react.forwardRef)(({ value: valueProp, defaultValue = "", onValueChange, suggestions, emptyText, filter = defaultFilter, openOnFocus = true, id: idProp, size, disabled, readOnly, className, style, css, onFocus, onBlur, onKeyDown, ...props }, ref) => {
16
+ const { colors } = require_themeContext.useVanillaExtractTheme();
17
+ const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
18
+ const autoId = (0, react.useId)();
19
+ const id = idProp ?? autoId;
20
+ const listId = `${id}-listbox`;
21
+ const optionId = (index) => `${id}-option-${index}`;
22
+ const anchorRef = (0, react.useRef)(null);
23
+ const [innerValue, setInnerValue] = (0, react.useState)(defaultValue);
24
+ const value = valueProp ?? innerValue;
25
+ const [open, setOpen] = (0, react.useState)(false);
26
+ const [query, setQuery] = (0, react.useState)("");
27
+ const [highlighted, setHighlighted] = (0, react.useState)(-1);
28
+ const shown = query ? suggestions.filter((s) => filter(s, query)) : suggestions;
29
+ const showEmpty = emptyText != null && suggestions.length === 0;
30
+ const popupOpen = open && (shown.length > 0 || showEmpty);
31
+ const listOpen = popupOpen && shown.length > 0;
32
+ const active = listOpen && highlighted < shown.length ? highlighted : -1;
33
+ (0, react.useEffect)(() => {
34
+ if (active >= 0) document.getElementById(`${id}-option-${active}`)?.scrollIntoView?.({ block: "nearest" });
35
+ }, [active, id]);
36
+ const setValue = (next) => {
37
+ if (valueProp === void 0) setInnerValue(next);
38
+ onValueChange?.(next);
39
+ };
40
+ const close = () => {
41
+ setOpen(false);
42
+ setQuery("");
43
+ setHighlighted(-1);
44
+ };
45
+ const choose = (suggestion) => {
46
+ setValue(suggestion);
47
+ close();
48
+ };
49
+ const interactive = !disabled && !readOnly;
50
+ const handleKeyDown = (e) => {
51
+ onKeyDown?.(e);
52
+ if (e.defaultPrevented || !interactive) return;
53
+ const last = shown.length - 1;
54
+ switch (e.key) {
55
+ case "ArrowDown":
56
+ e.preventDefault();
57
+ if (!open) {
58
+ setOpen(true);
59
+ setHighlighted(e.altKey ? -1 : 0);
60
+ } else if (!e.altKey) setHighlighted(active >= last ? 0 : active + 1);
61
+ break;
62
+ case "ArrowUp":
63
+ e.preventDefault();
64
+ if (!open) {
65
+ setOpen(true);
66
+ setHighlighted(last);
67
+ } else setHighlighted(active <= 0 ? last : active - 1);
68
+ break;
69
+ case "Enter":
70
+ if (active >= 0) {
71
+ e.preventDefault();
72
+ choose(shown[active]);
73
+ }
74
+ break;
75
+ case "Escape": if (popupOpen) {
76
+ e.preventDefault();
77
+ close();
78
+ }
79
+ }
80
+ };
81
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_popover.Root, {
82
+ open: popupOpen,
83
+ onOpenChange: (next) => !next && close(),
84
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Anchor, {
85
+ asChild: true,
86
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
87
+ ref: anchorRef,
88
+ className: joinClassNames(require_Combobox_vanilla_css.comboboxAnchor, className),
89
+ style: {
90
+ ...cssStyles,
91
+ ...style,
92
+ ...(0, _vanilla_extract_dynamic.assignInlineVars)(vars)
93
+ },
94
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input_vanilla.InputVanilla, {
95
+ ref,
96
+ id,
97
+ role: "combobox",
98
+ "aria-autocomplete": "list",
99
+ "aria-expanded": listOpen,
100
+ "aria-controls": listOpen ? listId : void 0,
101
+ "aria-activedescendant": active >= 0 ? optionId(active) : void 0,
102
+ autoComplete: "off",
103
+ size,
104
+ disabled,
105
+ readOnly,
106
+ value,
107
+ onChange: (e) => {
108
+ setValue(e.target.value);
109
+ setQuery(e.target.value);
110
+ setOpen(true);
111
+ setHighlighted(-1);
112
+ },
113
+ onFocus: (e) => {
114
+ onFocus?.(e);
115
+ if (openOnFocus && interactive) {
116
+ setOpen(true);
117
+ setQuery("");
118
+ setHighlighted(-1);
119
+ }
120
+ },
121
+ onBlur: (e) => {
122
+ onBlur?.(e);
123
+ close();
124
+ },
125
+ onKeyDown: handleKeyDown,
126
+ ...props
127
+ })
128
+ })
129
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Content, {
130
+ role: void 0,
131
+ id: void 0,
132
+ className: require_Combobox_vanilla_css.comboboxContent,
133
+ side: "bottom",
134
+ align: "start",
135
+ sideOffset: 4,
136
+ collisionPadding: 8,
137
+ onOpenAutoFocus: (e) => e.preventDefault(),
138
+ onCloseAutoFocus: (e) => e.preventDefault(),
139
+ onInteractOutside: (e) => {
140
+ if (anchorRef.current?.contains(e.target)) e.preventDefault();
141
+ },
142
+ onMouseDown: (e) => e.preventDefault(),
143
+ children: listOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
144
+ id: listId,
145
+ role: "listbox",
146
+ "aria-label": props["aria-labelledby"] ? void 0 : props["aria-label"] ?? "Suggestions",
147
+ "aria-labelledby": props["aria-labelledby"],
148
+ className: require_Combobox_vanilla_css.comboboxListbox,
149
+ children: shown.map((suggestion, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
150
+ id: optionId(index),
151
+ role: "option",
152
+ "aria-selected": index === active,
153
+ "data-highlighted": index === active ? "" : void 0,
154
+ className: require_Combobox_vanilla_css.comboboxOptionRecipe({ size }),
155
+ onMouseMove: () => index !== active && setHighlighted(index),
156
+ onClick: () => choose(suggestion),
157
+ children: suggestion
158
+ }, optionId(index)))
159
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
160
+ role: "status",
161
+ className: require_Combobox_vanilla_css.comboboxEmptyRecipe({ size }),
162
+ children: emptyText
163
+ })
164
+ }) })]
165
+ });
166
+ });
167
+ ComboboxVanilla.displayName = "ComboboxVanilla";
168
+ exports.ComboboxVanilla = ComboboxVanilla;
169
+
170
+ //# sourceMappingURL=Combobox.vanilla.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","useId","useRef","useState","PopoverPrimitive","comboboxAnchor","assignInlineVars","InputVanilla","comboboxContent","comboboxListbox","comboboxOptionRecipe","comboboxEmptyRecipe"],"sources":["../../../components/Combobox/Combobox.vanilla.tsx"],"sourcesContent":["import * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef, useEffect, useId, useRef, useState } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input/Input.vanilla';\nimport {\n comboboxAnchor,\n comboboxContent,\n comboboxEmptyRecipe,\n comboboxListbox,\n comboboxOptionRecipe,\n} from './Combobox.vanilla.css';\n\nconst joinClassNames = (...classNames: (string | undefined)[]) =>\n classNames.filter(Boolean).join(' ');\n\nconst defaultFilter = (suggestion: string, query: string) =>\n suggestion.toLowerCase().includes(query.toLowerCase());\n\nexport interface ComboboxVanillaProps\n extends\n Omit<InputVanillaProps, 'value' | 'defaultValue' | 'onChange' | 'type' | 'role' | 'css'>,\n CSSProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n suggestions: string[];\n emptyText?: React.ReactNode;\n filter?: (suggestion: string, query: string) => boolean;\n openOnFocus?: boolean;\n}\n\nexport const ComboboxVanilla = forwardRef<InputVanillaHandle, ComboboxVanillaProps>(\n (\n {\n value: valueProp,\n defaultValue = '',\n onValueChange,\n suggestions,\n emptyText,\n filter = defaultFilter,\n openOnFocus = true,\n id: idProp,\n size,\n disabled,\n readOnly,\n className,\n style,\n css,\n onFocus,\n onBlur,\n onKeyDown,\n ...props\n },\n ref,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const autoId = useId();\n const id = idProp ?? autoId;\n const listId = `${id}-listbox`;\n const optionId = (index: number) => `${id}-option-${index}`;\n\n const anchorRef = useRef<HTMLDivElement>(null);\n const [innerValue, setInnerValue] = useState(defaultValue);\n const value = valueProp ?? innerValue;\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [highlighted, setHighlighted] = useState(-1);\n\n const shown = query ? suggestions.filter((s) => filter(s, query)) : suggestions;\n const showEmpty = emptyText != null && suggestions.length === 0;\n const popupOpen = open && (shown.length > 0 || showEmpty);\n const listOpen = popupOpen && shown.length > 0;\n const active = listOpen && highlighted < shown.length ? highlighted : -1;\n\n useEffect(() => {\n if (active >= 0) {\n document.getElementById(`${id}-option-${active}`)?.scrollIntoView?.({ block: 'nearest' });\n }\n }, [active, id]);\n\n const setValue = (next: string) => {\n if (valueProp === undefined) setInnerValue(next);\n onValueChange?.(next);\n };\n\n const close = () => {\n setOpen(false);\n setQuery('');\n setHighlighted(-1);\n };\n\n const choose = (suggestion: string) => {\n setValue(suggestion);\n close();\n };\n\n const interactive = !disabled && !readOnly;\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented || !interactive) return;\n\n const last = shown.length - 1;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) {\n setOpen(true);\n setHighlighted(e.altKey ? -1 : 0);\n } else if (!e.altKey) {\n setHighlighted(active >= last ? 0 : active + 1);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) {\n setOpen(true);\n setHighlighted(last);\n } else {\n setHighlighted(active <= 0 ? last : active - 1);\n }\n break;\n case 'Enter':\n if (active >= 0) {\n e.preventDefault();\n choose(shown[active]);\n }\n break;\n case 'Escape':\n if (popupOpen) {\n e.preventDefault();\n close();\n }\n break;\n default:\n break;\n }\n };\n\n return (\n <PopoverPrimitive.Root open={popupOpen} onOpenChange={(next) => !next && close()}>\n <PopoverPrimitive.Anchor asChild>\n <div\n ref={anchorRef}\n className={joinClassNames(comboboxAnchor, className)}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n >\n <InputVanilla\n ref={ref}\n id={id}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={listOpen}\n aria-controls={listOpen ? listId : undefined}\n aria-activedescendant={active >= 0 ? optionId(active) : undefined}\n autoComplete=\"off\"\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n setQuery(e.target.value);\n setOpen(true);\n setHighlighted(-1);\n }}\n onFocus={(e: React.FocusEvent<HTMLInputElement>) => {\n onFocus?.(e);\n if (openOnFocus && interactive) {\n setOpen(true);\n setQuery('');\n setHighlighted(-1);\n }\n }}\n onBlur={(e: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(e);\n close();\n }}\n onKeyDown={handleKeyDown}\n {...props}\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n role={undefined}\n id={undefined}\n className={comboboxContent}\n side=\"bottom\"\n align=\"start\"\n sideOffset={4}\n collisionPadding={8}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n if (anchorRef.current?.contains(e.target as Node)) e.preventDefault();\n }}\n // Keeps the focus in the input, so a click on an option does not blur it.\n onMouseDown={(e) => e.preventDefault()}\n >\n {listOpen ? (\n <ul\n id={listId}\n role=\"listbox\"\n aria-label={\n props['aria-labelledby'] ? undefined : (props['aria-label'] ?? 'Suggestions')\n }\n aria-labelledby={props['aria-labelledby']}\n className={comboboxListbox}\n >\n {shown.map((suggestion, index) => (\n <li\n key={optionId(index)}\n id={optionId(index)}\n role=\"option\"\n aria-selected={index === active}\n data-highlighted={index === active ? '' : undefined}\n className={comboboxOptionRecipe({ size })}\n onMouseMove={() => index !== active && setHighlighted(index)}\n onClick={() => choose(suggestion)}\n >\n {suggestion}\n </li>\n ))}\n </ul>\n ) : (\n <div role=\"status\" className={comboboxEmptyRecipe({ size })}>\n {emptyText}\n </div>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n },\n);\n\nComboboxVanilla.displayName = 'ComboboxVanilla';\n"],"mappings":";;;;;;;;;;;;AAeA,IAAM,kBAAkB,GAAG,eACzB,WAAW,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AAErC,IAAM,iBAAiB,YAAoB,UACzC,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,YAAY,CAAC;AAevD,IAAa,mBAAA,GAAkBA,MAAAA,WAAAA,EAE3B,EACE,OAAO,WACP,eAAe,IACf,eACA,aACA,WACA,SAAS,eACT,cAAc,MACd,IAAI,QACJ,MACA,UACA,UACA,WACA,OACA,KACA,SACA,QACA,WACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS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GACC,CAAA,IAEJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,MAAK;IAAS,WAAWC,6BAAAA,oBAAoB,EAAE,KAAK,CAAC;IACvD,UAAA;GACE,CAAA;EAEiB,CAAA,EACH,CAAA,CACJ;;AAE3B,CACF;AAEA,gBAAgB,cAAc"}
@@ -0,0 +1,33 @@
1
+ ;/* empty css */
2
+ let _vanilla_extract_recipes_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
3
+ // components/Combobox/Combobox.vanilla.css.ts
4
+ var comboboxAnchor = "_1lyxi2i0";
5
+ var comboboxContent = "_1lyxi2i1";
6
+ var comboboxListbox = "_1lyxi2i2";
7
+ var comboboxOptionRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
8
+ defaultClassName: "_1lyxi2i3",
9
+ variantClassNames: { size: {
10
+ small: "_1lyxi2i4",
11
+ medium: "_1lyxi2i5",
12
+ large: "_1lyxi2i6"
13
+ } },
14
+ defaultVariants: { size: "medium" },
15
+ compoundVariants: []
16
+ });
17
+ var comboboxEmptyRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
18
+ defaultClassName: "_1lyxi2i7",
19
+ variantClassNames: { size: {
20
+ small: "_1lyxi2i8",
21
+ medium: "_1lyxi2i9",
22
+ large: "_1lyxi2ia"
23
+ } },
24
+ defaultVariants: { size: "medium" },
25
+ compoundVariants: []
26
+ });
27
+ exports.comboboxAnchor = comboboxAnchor;
28
+ exports.comboboxContent = comboboxContent;
29
+ exports.comboboxEmptyRecipe = comboboxEmptyRecipe;
30
+ exports.comboboxListbox = comboboxListbox;
31
+ exports.comboboxOptionRecipe = comboboxOptionRecipe;
32
+
33
+ //# sourceMappingURL=Combobox.vanilla.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Combobox/Combobox.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nexport const comboboxAnchor = style({\n width: '100%',\n});\n\nexport const comboboxContent = style({\n boxSizing: 'border-box',\n width: 'var(--radix-popover-trigger-width)',\n maxHeight: 'min(240px, var(--radix-popover-content-available-height))',\n overflowY: 'auto',\n padding: tokens.space['1'],\n backgroundColor: tokens.colors.cardBackground,\n border: `1px solid ${tokens.colors.comboboxContentBorder}`,\n borderRadius: tokens.radii['3'],\n fontFamily: tokens.fonts.rubik,\n outline: 'none',\n});\n\nexport const comboboxListbox = style({\n margin: 0,\n padding: 0,\n listStyle: 'none',\n});\n\nexport const comboboxOptionRecipe = recipe({\n base: {\n paddingBlock: tokens.space['2'],\n paddingInline: tokens.space['2'],\n borderRadius: tokens.radii['2'],\n color: tokens.colors.hiContrast,\n lineHeight: 1.3,\n overflowWrap: 'anywhere',\n cursor: 'pointer',\n\n selectors: {\n '&[data-highlighted]': {\n backgroundColor: tokens.colors.comboboxOptionHighlightBg,\n },\n },\n },\n\n variants: {\n size: {\n small: { fontSize: tokens.fontSizes['1'] },\n medium: { fontSize: tokens.fontSizes['3'] },\n large: { fontSize: tokens.fontSizes['3'] },\n },\n },\n\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport const comboboxEmptyRecipe = recipe({\n base: {\n paddingBlock: tokens.space['2'],\n paddingInline: tokens.space['2'],\n color: tokens.colors.textSubtle,\n lineHeight: 1.3,\n },\n\n variants: {\n size: {\n small: { fontSize: tokens.fontSizes['1'] },\n medium: { fontSize: tokens.fontSizes['3'] },\n large: { fontSize: tokens.fontSizes['3'] },\n },\n },\n\n defaultVariants: {\n size: 'medium',\n },\n});\n"],"mappings":""}
@@ -0,0 +1,29 @@
1
+ /* empty css */
2
+ import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
3
+ // components/Combobox/Combobox.vanilla.css.ts
4
+ var comboboxAnchor = "_1lyxi2i0";
5
+ var comboboxContent = "_1lyxi2i1";
6
+ var comboboxListbox = "_1lyxi2i2";
7
+ var comboboxOptionRecipe = createRuntimeFn({
8
+ defaultClassName: "_1lyxi2i3",
9
+ variantClassNames: { size: {
10
+ small: "_1lyxi2i4",
11
+ medium: "_1lyxi2i5",
12
+ large: "_1lyxi2i6"
13
+ } },
14
+ defaultVariants: { size: "medium" },
15
+ compoundVariants: []
16
+ });
17
+ var comboboxEmptyRecipe = createRuntimeFn({
18
+ defaultClassName: "_1lyxi2i7",
19
+ variantClassNames: { size: {
20
+ small: "_1lyxi2i8",
21
+ medium: "_1lyxi2i9",
22
+ large: "_1lyxi2ia"
23
+ } },
24
+ defaultVariants: { size: "medium" },
25
+ compoundVariants: []
26
+ });
27
+ export { comboboxAnchor, comboboxContent, comboboxEmptyRecipe, comboboxListbox, comboboxOptionRecipe };
28
+
29
+ //# sourceMappingURL=Combobox.vanilla.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Combobox/Combobox.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nexport const comboboxAnchor = style({\n width: '100%',\n});\n\nexport const comboboxContent = style({\n boxSizing: 'border-box',\n width: 'var(--radix-popover-trigger-width)',\n maxHeight: 'min(240px, var(--radix-popover-content-available-height))',\n overflowY: 'auto',\n padding: tokens.space['1'],\n backgroundColor: tokens.colors.cardBackground,\n border: `1px solid ${tokens.colors.comboboxContentBorder}`,\n borderRadius: tokens.radii['3'],\n fontFamily: tokens.fonts.rubik,\n outline: 'none',\n});\n\nexport const comboboxListbox = style({\n margin: 0,\n padding: 0,\n listStyle: 'none',\n});\n\nexport const comboboxOptionRecipe = recipe({\n base: {\n paddingBlock: tokens.space['2'],\n paddingInline: tokens.space['2'],\n borderRadius: tokens.radii['2'],\n color: tokens.colors.hiContrast,\n lineHeight: 1.3,\n overflowWrap: 'anywhere',\n cursor: 'pointer',\n\n selectors: {\n '&[data-highlighted]': {\n backgroundColor: tokens.colors.comboboxOptionHighlightBg,\n },\n },\n },\n\n variants: {\n size: {\n small: { fontSize: tokens.fontSizes['1'] },\n medium: { fontSize: tokens.fontSizes['3'] },\n large: { fontSize: tokens.fontSizes['3'] },\n },\n },\n\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport const comboboxEmptyRecipe = recipe({\n base: {\n paddingBlock: tokens.space['2'],\n paddingInline: tokens.space['2'],\n color: tokens.colors.textSubtle,\n lineHeight: 1.3,\n },\n\n variants: {\n size: {\n small: { fontSize: tokens.fontSizes['1'] },\n medium: { fontSize: tokens.fontSizes['3'] },\n large: { fontSize: tokens.fontSizes['3'] },\n },\n },\n\n defaultVariants: {\n size: 'medium',\n },\n});\n"],"mappings":""}
@@ -0,0 +1,167 @@
1
+ import { processCSSProp } from "../../styles/cssProps.js";
2
+ import { useVanillaExtractTheme } from "../../styles/themeContext.js";
3
+ import { InputVanilla } from "../Input/Input.vanilla.js";
4
+ import { comboboxAnchor, comboboxContent, comboboxEmptyRecipe, comboboxListbox, comboboxOptionRecipe } from "./Combobox.vanilla.css.js";
5
+ import { forwardRef, useEffect, useId, useRef, useState } from "react";
6
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
9
+ // components/Combobox/Combobox.vanilla.tsx
10
+ var joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
11
+ var defaultFilter = (suggestion, query) => suggestion.toLowerCase().includes(query.toLowerCase());
12
+ var ComboboxVanilla = forwardRef(({ value: valueProp, defaultValue = "", onValueChange, suggestions, emptyText, filter = defaultFilter, openOnFocus = true, id: idProp, size, disabled, readOnly, className, style, css, onFocus, onBlur, onKeyDown, ...props }, ref) => {
13
+ const { colors } = useVanillaExtractTheme();
14
+ const { style: cssStyles, vars } = processCSSProp(css, colors);
15
+ const autoId = useId();
16
+ const id = idProp ?? autoId;
17
+ const listId = `${id}-listbox`;
18
+ const optionId = (index) => `${id}-option-${index}`;
19
+ const anchorRef = useRef(null);
20
+ const [innerValue, setInnerValue] = useState(defaultValue);
21
+ const value = valueProp ?? innerValue;
22
+ const [open, setOpen] = useState(false);
23
+ const [query, setQuery] = useState("");
24
+ const [highlighted, setHighlighted] = useState(-1);
25
+ const shown = query ? suggestions.filter((s) => filter(s, query)) : suggestions;
26
+ const showEmpty = emptyText != null && suggestions.length === 0;
27
+ const popupOpen = open && (shown.length > 0 || showEmpty);
28
+ const listOpen = popupOpen && shown.length > 0;
29
+ const active = listOpen && highlighted < shown.length ? highlighted : -1;
30
+ useEffect(() => {
31
+ if (active >= 0) document.getElementById(`${id}-option-${active}`)?.scrollIntoView?.({ block: "nearest" });
32
+ }, [active, id]);
33
+ const setValue = (next) => {
34
+ if (valueProp === void 0) setInnerValue(next);
35
+ onValueChange?.(next);
36
+ };
37
+ const close = () => {
38
+ setOpen(false);
39
+ setQuery("");
40
+ setHighlighted(-1);
41
+ };
42
+ const choose = (suggestion) => {
43
+ setValue(suggestion);
44
+ close();
45
+ };
46
+ const interactive = !disabled && !readOnly;
47
+ const handleKeyDown = (e) => {
48
+ onKeyDown?.(e);
49
+ if (e.defaultPrevented || !interactive) return;
50
+ const last = shown.length - 1;
51
+ switch (e.key) {
52
+ case "ArrowDown":
53
+ e.preventDefault();
54
+ if (!open) {
55
+ setOpen(true);
56
+ setHighlighted(e.altKey ? -1 : 0);
57
+ } else if (!e.altKey) setHighlighted(active >= last ? 0 : active + 1);
58
+ break;
59
+ case "ArrowUp":
60
+ e.preventDefault();
61
+ if (!open) {
62
+ setOpen(true);
63
+ setHighlighted(last);
64
+ } else setHighlighted(active <= 0 ? last : active - 1);
65
+ break;
66
+ case "Enter":
67
+ if (active >= 0) {
68
+ e.preventDefault();
69
+ choose(shown[active]);
70
+ }
71
+ break;
72
+ case "Escape": if (popupOpen) {
73
+ e.preventDefault();
74
+ close();
75
+ }
76
+ }
77
+ };
78
+ return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, {
79
+ open: popupOpen,
80
+ onOpenChange: (next) => !next && close(),
81
+ children: [/* @__PURE__ */ jsx(PopoverPrimitive.Anchor, {
82
+ asChild: true,
83
+ children: /* @__PURE__ */ jsx("div", {
84
+ ref: anchorRef,
85
+ className: joinClassNames(comboboxAnchor, className),
86
+ style: {
87
+ ...cssStyles,
88
+ ...style,
89
+ ...assignInlineVars(vars)
90
+ },
91
+ children: /* @__PURE__ */ jsx(InputVanilla, {
92
+ ref,
93
+ id,
94
+ role: "combobox",
95
+ "aria-autocomplete": "list",
96
+ "aria-expanded": listOpen,
97
+ "aria-controls": listOpen ? listId : void 0,
98
+ "aria-activedescendant": active >= 0 ? optionId(active) : void 0,
99
+ autoComplete: "off",
100
+ size,
101
+ disabled,
102
+ readOnly,
103
+ value,
104
+ onChange: (e) => {
105
+ setValue(e.target.value);
106
+ setQuery(e.target.value);
107
+ setOpen(true);
108
+ setHighlighted(-1);
109
+ },
110
+ onFocus: (e) => {
111
+ onFocus?.(e);
112
+ if (openOnFocus && interactive) {
113
+ setOpen(true);
114
+ setQuery("");
115
+ setHighlighted(-1);
116
+ }
117
+ },
118
+ onBlur: (e) => {
119
+ onBlur?.(e);
120
+ close();
121
+ },
122
+ onKeyDown: handleKeyDown,
123
+ ...props
124
+ })
125
+ })
126
+ }), /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
127
+ role: void 0,
128
+ id: void 0,
129
+ className: comboboxContent,
130
+ side: "bottom",
131
+ align: "start",
132
+ sideOffset: 4,
133
+ collisionPadding: 8,
134
+ onOpenAutoFocus: (e) => e.preventDefault(),
135
+ onCloseAutoFocus: (e) => e.preventDefault(),
136
+ onInteractOutside: (e) => {
137
+ if (anchorRef.current?.contains(e.target)) e.preventDefault();
138
+ },
139
+ onMouseDown: (e) => e.preventDefault(),
140
+ children: listOpen ? /* @__PURE__ */ jsx("ul", {
141
+ id: listId,
142
+ role: "listbox",
143
+ "aria-label": props["aria-labelledby"] ? void 0 : props["aria-label"] ?? "Suggestions",
144
+ "aria-labelledby": props["aria-labelledby"],
145
+ className: comboboxListbox,
146
+ children: shown.map((suggestion, index) => /* @__PURE__ */ jsx("li", {
147
+ id: optionId(index),
148
+ role: "option",
149
+ "aria-selected": index === active,
150
+ "data-highlighted": index === active ? "" : void 0,
151
+ className: comboboxOptionRecipe({ size }),
152
+ onMouseMove: () => index !== active && setHighlighted(index),
153
+ onClick: () => choose(suggestion),
154
+ children: suggestion
155
+ }, optionId(index)))
156
+ }) : /* @__PURE__ */ jsx("div", {
157
+ role: "status",
158
+ className: comboboxEmptyRecipe({ size }),
159
+ children: emptyText
160
+ })
161
+ }) })]
162
+ });
163
+ });
164
+ ComboboxVanilla.displayName = "ComboboxVanilla";
165
+ export { ComboboxVanilla };
166
+
167
+ //# sourceMappingURL=Combobox.vanilla.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.vanilla.js","names":[],"sources":["../../../components/Combobox/Combobox.vanilla.tsx"],"sourcesContent":["import * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef, useEffect, useId, useRef, useState } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input/Input.vanilla';\nimport {\n comboboxAnchor,\n comboboxContent,\n comboboxEmptyRecipe,\n comboboxListbox,\n comboboxOptionRecipe,\n} from './Combobox.vanilla.css';\n\nconst joinClassNames = (...classNames: (string | undefined)[]) =>\n classNames.filter(Boolean).join(' ');\n\nconst defaultFilter = (suggestion: string, query: string) =>\n suggestion.toLowerCase().includes(query.toLowerCase());\n\nexport interface ComboboxVanillaProps\n extends\n Omit<InputVanillaProps, 'value' | 'defaultValue' | 'onChange' | 'type' | 'role' | 'css'>,\n CSSProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n suggestions: string[];\n emptyText?: React.ReactNode;\n filter?: (suggestion: string, query: string) => boolean;\n openOnFocus?: boolean;\n}\n\nexport const ComboboxVanilla = forwardRef<InputVanillaHandle, ComboboxVanillaProps>(\n (\n {\n value: valueProp,\n defaultValue = '',\n onValueChange,\n suggestions,\n emptyText,\n filter = defaultFilter,\n openOnFocus = true,\n id: idProp,\n size,\n disabled,\n readOnly,\n className,\n style,\n css,\n onFocus,\n onBlur,\n onKeyDown,\n ...props\n },\n ref,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const autoId = useId();\n const id = idProp ?? autoId;\n const listId = `${id}-listbox`;\n const optionId = (index: number) => `${id}-option-${index}`;\n\n const anchorRef = useRef<HTMLDivElement>(null);\n const [innerValue, setInnerValue] = useState(defaultValue);\n const value = valueProp ?? innerValue;\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [highlighted, setHighlighted] = useState(-1);\n\n const shown = query ? suggestions.filter((s) => filter(s, query)) : suggestions;\n const showEmpty = emptyText != null && suggestions.length === 0;\n const popupOpen = open && (shown.length > 0 || showEmpty);\n const listOpen = popupOpen && shown.length > 0;\n const active = listOpen && highlighted < shown.length ? highlighted : -1;\n\n useEffect(() => {\n if (active >= 0) {\n document.getElementById(`${id}-option-${active}`)?.scrollIntoView?.({ block: 'nearest' });\n }\n }, [active, id]);\n\n const setValue = (next: string) => {\n if (valueProp === undefined) setInnerValue(next);\n onValueChange?.(next);\n };\n\n const close = () => {\n setOpen(false);\n setQuery('');\n setHighlighted(-1);\n };\n\n const choose = (suggestion: string) => {\n setValue(suggestion);\n close();\n };\n\n const interactive = !disabled && !readOnly;\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented || !interactive) return;\n\n const last = shown.length - 1;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) {\n setOpen(true);\n setHighlighted(e.altKey ? -1 : 0);\n } else if (!e.altKey) {\n setHighlighted(active >= last ? 0 : active + 1);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) {\n setOpen(true);\n setHighlighted(last);\n } else {\n setHighlighted(active <= 0 ? last : active - 1);\n }\n break;\n case 'Enter':\n if (active >= 0) {\n e.preventDefault();\n choose(shown[active]);\n }\n break;\n case 'Escape':\n if (popupOpen) {\n e.preventDefault();\n close();\n }\n break;\n default:\n break;\n }\n };\n\n return (\n <PopoverPrimitive.Root open={popupOpen} onOpenChange={(next) => !next && close()}>\n <PopoverPrimitive.Anchor asChild>\n <div\n ref={anchorRef}\n className={joinClassNames(comboboxAnchor, className)}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n >\n <InputVanilla\n ref={ref}\n id={id}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={listOpen}\n aria-controls={listOpen ? listId : undefined}\n aria-activedescendant={active >= 0 ? optionId(active) : undefined}\n autoComplete=\"off\"\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n setQuery(e.target.value);\n setOpen(true);\n setHighlighted(-1);\n }}\n onFocus={(e: React.FocusEvent<HTMLInputElement>) => {\n onFocus?.(e);\n if (openOnFocus && interactive) {\n setOpen(true);\n setQuery('');\n setHighlighted(-1);\n }\n }}\n onBlur={(e: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(e);\n close();\n }}\n onKeyDown={handleKeyDown}\n {...props}\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n role={undefined}\n id={undefined}\n className={comboboxContent}\n side=\"bottom\"\n align=\"start\"\n sideOffset={4}\n collisionPadding={8}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n if (anchorRef.current?.contains(e.target as Node)) e.preventDefault();\n }}\n // Keeps the focus in the input, so a click on an option does not blur it.\n onMouseDown={(e) => e.preventDefault()}\n >\n {listOpen ? (\n <ul\n id={listId}\n role=\"listbox\"\n aria-label={\n props['aria-labelledby'] ? undefined : (props['aria-label'] ?? 'Suggestions')\n }\n aria-labelledby={props['aria-labelledby']}\n className={comboboxListbox}\n >\n {shown.map((suggestion, index) => (\n <li\n key={optionId(index)}\n id={optionId(index)}\n role=\"option\"\n aria-selected={index === active}\n data-highlighted={index === active ? '' : undefined}\n className={comboboxOptionRecipe({ size })}\n onMouseMove={() => index !== active && setHighlighted(index)}\n onClick={() => choose(suggestion)}\n >\n {suggestion}\n </li>\n ))}\n </ul>\n ) : (\n <div role=\"status\" className={comboboxEmptyRecipe({ size })}>\n {emptyText}\n </div>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n },\n);\n\nComboboxVanilla.displayName = 'ComboboxVanilla';\n"],"mappings":";;;;;;;;;AAeA,IAAM,kBAAkB,GAAG,eACzB,WAAW,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AAErC,IAAM,iBAAiB,YAAoB,UACzC,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,YAAY,CAAC;AAevD,IAAa,kBAAkB,YAE3B,EACE,OAAO,WACP,eAAe,IACf,eACA,aACA,WACA,SAAS,eACT,cAAc,MACd,IAAI,QACJ,MACA,UACA,UACA,WACA,OACA,KACA,SACA,QACA,WACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAE7D,MAAM,SAAS,MAAM;CACrB,MAAM,KAAK,UAAU;CACrB,MAAM,SAAS,GAAG,GAAG;CACrB,MAAM,YAAY,UAAkB,GAAG,GAAG,UAAU;CAEpD,MAAM,YAAY,OAAuB,IAAI;C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kBAAkB;GAClB,kBAAkB,MAAM,EAAE,eAAe;GACzC,mBAAmB,MAAM,EAAE,eAAe;GAC1C,oBAAoB,MAAM;IACxB,IAAI,UAAU,SAAS,SAAS,EAAE,MAAc,GAAG,EAAE,eAAe;GACtE;GAEA,cAAc,MAAM,EAAE,eAAe;GAEpC,UAAA,WACC,oBAAC,MAAD;IACE,IAAI;IACJ,MAAK;IACL,cACE,MAAM,qBAAqB,KAAA,IAAa,MAAM,iBAAiB;IAEjE,mBAAiB,MAAM;IACvB,WAAW;IAEV,UAAA,MAAM,KAAK,YAAY,UACtB,oBAAC,MAAD;KAEE,IAAI,SAAS,KAAK;KAClB,MAAK;KACL,iBAAe,UAAU;KACzB,oBAAkB,UAAU,SAAS,KAAK,KAAA;KAC1C,WAAW,qBAAqB,EAAE,KAAK,CAAC;KACxC,mBAAmB,UAAU,UAAU,eAAe,KAAK;KAC3D,eAAe,OAAO,UAAU;KAE/B,UAAA;IACC,GAVG,SAAS,KAAK,CAUjB,CACL;GACC,CAAA,IAEJ,oBAAC,OAAD;IAAK,MAAK;IAAS,WAAW,oBAAoB,EAAE,KAAK,CAAC;IACvD,UAAA;GACE,CAAA;EAEiB,CAAA,EACH,CAAA,CACJ;;AAE3B,CACF;AAEA,gBAAgB,cAAc"}
@@ -1,9 +1,9 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
3
  const require_Box = require("../Box/Box.cjs");
4
+ const require_Button = require("../Button/Button.cjs");
4
5
  const require_Flex = require("../Flex/Flex.cjs");
5
6
  const require_Text = require("../Text/Text.cjs");
6
- const require_Button = require("../Button/Button.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
8
8
  let react = require("react");
9
9
  react = require_runtime.__toESM(react, 1);
@@ -1,8 +1,8 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { Box } from "../Box/Box.js";
3
+ import { Button } from "../Button/Button.js";
3
4
  import { Flex } from "../Flex/Flex.js";
4
5
  import { Text } from "../Text/Text.js";
5
- import { Button } from "../Button/Button.js";
6
6
  import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
7
7
  import React, { useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
- const require_Elevation = require("../Elevation/Elevation.cjs");
4
3
  const require_Card = require("../Card/Card.cjs");
4
+ const require_Elevation = require("../Elevation/Elevation.cjs");
5
5
  const require_IconButton = require("../IconButton/IconButton.cjs");
6
6
  const require_Overlay = require("../Overlay.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
@@ -1,6 +1,6 @@
1
1
  import { styled } from "../../stitches.config.js";
2
- import { elevationVariants } from "../Elevation/Elevation.js";
3
2
  import { Card } from "../Card/Card.js";
3
+ import { elevationVariants } from "../Elevation/Elevation.js";
4
4
  import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { overlayStyles } from "../Overlay.js";
6
6
  import { Cross1Icon } from "@radix-ui/react-icons";