@salmonui/dropdowns 0.0.0-stage → 0.3.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 (173) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -2
  3. package/dist/combobox/Combobox.d.ts +54 -0
  4. package/dist/combobox/Combobox.d.ts.map +1 -0
  5. package/dist/combobox/Combobox.js +485 -0
  6. package/dist/combobox/Combobox.js.map +1 -0
  7. package/dist/combobox/ComboboxField.d.ts +9 -0
  8. package/dist/combobox/ComboboxField.d.ts.map +1 -0
  9. package/dist/combobox/ComboboxField.js +13 -0
  10. package/dist/combobox/ComboboxField.js.map +1 -0
  11. package/dist/combobox/columns-grid.d.ts +20 -0
  12. package/dist/combobox/columns-grid.d.ts.map +1 -0
  13. package/dist/combobox/columns-grid.js +106 -0
  14. package/dist/combobox/columns-grid.js.map +1 -0
  15. package/dist/combobox/columns.d.ts +45 -0
  16. package/dist/combobox/columns.d.ts.map +1 -0
  17. package/dist/combobox/columns.js +42 -0
  18. package/dist/combobox/columns.js.map +1 -0
  19. package/dist/combobox.css +706 -0
  20. package/dist/combobox.d.ts +6 -0
  21. package/dist/combobox.d.ts.map +1 -0
  22. package/dist/combobox.js +10 -0
  23. package/dist/combobox.js.map +1 -0
  24. package/dist/dropdown/core.d.ts +178 -0
  25. package/dist/dropdown/core.d.ts.map +1 -0
  26. package/dist/dropdown/core.js +591 -0
  27. package/dist/dropdown/core.js.map +1 -0
  28. package/dist/dropdown/field.d.ts +19 -0
  29. package/dist/dropdown/field.d.ts.map +1 -0
  30. package/dist/dropdown/field.js +48 -0
  31. package/dist/dropdown/field.js.map +1 -0
  32. package/dist/dropdown/locale.d.ts +3 -0
  33. package/dist/dropdown/locale.d.ts.map +1 -0
  34. package/dist/dropdown/locale.js +23 -0
  35. package/dist/dropdown/locale.js.map +1 -0
  36. package/dist/dropdown/overlay.d.ts +14 -0
  37. package/dist/dropdown/overlay.d.ts.map +1 -0
  38. package/dist/dropdown/overlay.js +46 -0
  39. package/dist/dropdown/overlay.js.map +1 -0
  40. package/dist/dropdown/popup.d.ts +44 -0
  41. package/dist/dropdown/popup.d.ts.map +1 -0
  42. package/dist/dropdown/popup.js +183 -0
  43. package/dist/dropdown/popup.js.map +1 -0
  44. package/dist/dropdown/types.d.ts +197 -0
  45. package/dist/dropdown/types.d.ts.map +1 -0
  46. package/dist/dropdown/types.js +4 -0
  47. package/dist/dropdown/types.js.map +1 -0
  48. package/dist/internal/caret.d.ts +18 -0
  49. package/dist/internal/caret.d.ts.map +1 -0
  50. package/dist/internal/caret.js +73 -0
  51. package/dist/internal/caret.js.map +1 -0
  52. package/dist/internal/collection/collection.d.ts +53 -0
  53. package/dist/internal/collection/collection.d.ts.map +1 -0
  54. package/dist/internal/collection/collection.js +161 -0
  55. package/dist/internal/collection/collection.js.map +1 -0
  56. package/dist/internal/collection/fold.d.ts +15 -0
  57. package/dist/internal/collection/fold.d.ts.map +1 -0
  58. package/dist/internal/collection/fold.js +33 -0
  59. package/dist/internal/collection/fold.js.map +1 -0
  60. package/dist/internal/collection/remote.d.ts +76 -0
  61. package/dist/internal/collection/remote.d.ts.map +1 -0
  62. package/dist/internal/collection/remote.js +261 -0
  63. package/dist/internal/collection/remote.js.map +1 -0
  64. package/dist/internal/collection/search.d.ts +28 -0
  65. package/dist/internal/collection/search.d.ts.map +1 -0
  66. package/dist/internal/collection/search.js +119 -0
  67. package/dist/internal/collection/search.js.map +1 -0
  68. package/dist/internal/collection/selection.d.ts +33 -0
  69. package/dist/internal/collection/selection.d.ts.map +1 -0
  70. package/dist/internal/collection/selection.js +82 -0
  71. package/dist/internal/collection/selection.js.map +1 -0
  72. package/dist/internal/collection/view.d.ts +22 -0
  73. package/dist/internal/collection/view.d.ts.map +1 -0
  74. package/dist/internal/collection/view.js +83 -0
  75. package/dist/internal/collection/view.js.map +1 -0
  76. package/dist/internal/select.d.ts +2 -0
  77. package/dist/internal/select.d.ts.map +1 -0
  78. package/dist/internal/select.js +7 -0
  79. package/dist/internal/select.js.map +1 -0
  80. package/dist/listbox/Listbox.d.ts +8 -0
  81. package/dist/listbox/Listbox.d.ts.map +1 -0
  82. package/dist/listbox/Listbox.js +887 -0
  83. package/dist/listbox/Listbox.js.map +1 -0
  84. package/dist/listbox/drag-types.d.ts +50 -0
  85. package/dist/listbox/drag-types.d.ts.map +1 -0
  86. package/dist/listbox/drag-types.js +6 -0
  87. package/dist/listbox/drag-types.js.map +1 -0
  88. package/dist/listbox/drag.d.ts +33 -0
  89. package/dist/listbox/drag.d.ts.map +1 -0
  90. package/dist/listbox/drag.js +201 -0
  91. package/dist/listbox/drag.js.map +1 -0
  92. package/dist/listbox/grid.d.ts +28 -0
  93. package/dist/listbox/grid.d.ts.map +1 -0
  94. package/dist/listbox/grid.js +165 -0
  95. package/dist/listbox/grid.js.map +1 -0
  96. package/dist/listbox/locale.d.ts +30 -0
  97. package/dist/listbox/locale.d.ts.map +1 -0
  98. package/dist/listbox/locale.js +25 -0
  99. package/dist/listbox/locale.js.map +1 -0
  100. package/dist/listbox/move.d.ts +16 -0
  101. package/dist/listbox/move.d.ts.map +1 -0
  102. package/dist/listbox/move.js +70 -0
  103. package/dist/listbox/move.js.map +1 -0
  104. package/dist/listbox/types.d.ts +210 -0
  105. package/dist/listbox/types.d.ts.map +1 -0
  106. package/dist/listbox/types.js +2 -0
  107. package/dist/listbox/types.js.map +1 -0
  108. package/dist/listbox.css +330 -0
  109. package/dist/listbox.d.ts +6 -0
  110. package/dist/listbox.d.ts.map +1 -0
  111. package/dist/listbox.js +7 -0
  112. package/dist/listbox.js.map +1 -0
  113. package/dist/mention/Mention.d.ts +5 -0
  114. package/dist/mention/Mention.d.ts.map +1 -0
  115. package/dist/mention/Mention.js +530 -0
  116. package/dist/mention/Mention.js.map +1 -0
  117. package/dist/mention/query.d.ts +27 -0
  118. package/dist/mention/query.d.ts.map +1 -0
  119. package/dist/mention/query.js +53 -0
  120. package/dist/mention/query.js.map +1 -0
  121. package/dist/mention/store.d.ts +22 -0
  122. package/dist/mention/store.d.ts.map +1 -0
  123. package/dist/mention/store.js +25 -0
  124. package/dist/mention/store.js.map +1 -0
  125. package/dist/mention/types.d.ts +183 -0
  126. package/dist/mention/types.d.ts.map +1 -0
  127. package/dist/mention/types.js +2 -0
  128. package/dist/mention/types.js.map +1 -0
  129. package/dist/mention.css +116 -0
  130. package/dist/mention.d.ts +3 -0
  131. package/dist/mention.d.ts.map +1 -0
  132. package/dist/mention.js +7 -0
  133. package/dist/mention.js.map +1 -0
  134. package/dist/select/Select.d.ts +31 -0
  135. package/dist/select/Select.d.ts.map +1 -0
  136. package/dist/select/Select.js +362 -0
  137. package/dist/select/Select.js.map +1 -0
  138. package/dist/select/SelectField.d.ts +9 -0
  139. package/dist/select/SelectField.d.ts.map +1 -0
  140. package/dist/select/SelectField.js +13 -0
  141. package/dist/select/SelectField.js.map +1 -0
  142. package/dist/select.css +536 -0
  143. package/dist/select.d.ts +5 -0
  144. package/dist/select.d.ts.map +1 -0
  145. package/dist/select.js +9 -0
  146. package/dist/select.js.map +1 -0
  147. package/dist/styles.css +1590 -0
  148. package/dist/tree-select/TreeSelect.d.ts +69 -0
  149. package/dist/tree-select/TreeSelect.d.ts.map +1 -0
  150. package/dist/tree-select/TreeSelect.js +597 -0
  151. package/dist/tree-select/TreeSelect.js.map +1 -0
  152. package/dist/tree-select/filter.d.ts +24 -0
  153. package/dist/tree-select/filter.d.ts.map +1 -0
  154. package/dist/tree-select/filter.js +74 -0
  155. package/dist/tree-select/filter.js.map +1 -0
  156. package/dist/tree-select/locale.d.ts +3 -0
  157. package/dist/tree-select/locale.d.ts.map +1 -0
  158. package/dist/tree-select/locale.js +8 -0
  159. package/dist/tree-select/locale.js.map +1 -0
  160. package/dist/tree-select/popup.d.ts +19 -0
  161. package/dist/tree-select/popup.d.ts.map +1 -0
  162. package/dist/tree-select/popup.js +418 -0
  163. package/dist/tree-select/popup.js.map +1 -0
  164. package/dist/tree-select/types.d.ts +152 -0
  165. package/dist/tree-select/types.d.ts.map +1 -0
  166. package/dist/tree-select/types.js +4 -0
  167. package/dist/tree-select/types.js.map +1 -0
  168. package/dist/tree-select.css +601 -0
  169. package/dist/tree-select.d.ts +5 -0
  170. package/dist/tree-select.d.ts.map +1 -0
  171. package/dist/tree-select.js +10 -0
  172. package/dist/tree-select.js.map +1 -0
  173. package/package.json +65 -4
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Field parts of Select and Combobox (`DropdownFieldProps`): the public `Select` / `Combobox` render the bare
4
+ // control through `FieldParts`, so packages that import the bare control
5
+ // (`@salmonui/dropdowns/internal/select`, `.../internal/combobox`) and label it
6
+ // themselves carry none of this code.
7
+ import { useId, useState } from 'react';
8
+ import { requiredBy, useFormField } from '@salmonui/core/internal/field/form-field';
9
+ // Pressing the label focuses the control, as a native <label for> does; the popup listbox lives in a portal.
10
+ const focusControl = (event) => event.currentTarget.parentElement?.querySelector('[role="combobox"]')?.focus();
11
+ /**
12
+ * Renders `control` (the field ARIA, then every other prop) inside
13
+ * `.salmon-dropdown-field` with the label, description and error parts, or
14
+ * alone when none of them is set. Inside a `Form`, `validation` runs there
15
+ * like a TextField's: the control gets an id, its value is tracked and its
16
+ * blur reported.
17
+ */
18
+ export function FieldParts(props) {
19
+ const { label, description, errorMessage, invalid, validation, control: Control, ...rest } = props;
20
+ const own = rest;
21
+ const base = useId();
22
+ const id = own.id ?? `${base}c`;
23
+ const [inner, setInner] = useState(own.defaultValue);
24
+ const [errors, blur] = useFormField({ name: validation ? own.name : undefined, value: own.value !== undefined ? own.value : inner, validation, disabled: own.disabled, element: () => document.getElementById(id) });
25
+ const bad = invalid || errors.length > 0;
26
+ const message = bad ? (errorMessage ?? errors[0]) : null;
27
+ const error = message != null;
28
+ const control = (_jsx(Control, { "aria-labelledby": label != null ? `${base}l` : undefined, "aria-describedby": [description != null && `${base}d`, error && `${base}e`].filter(Boolean).join(' ') || undefined, "aria-invalid": bad || undefined, ...rest, ...(validation
29
+ ? {
30
+ id,
31
+ required: own.required || requiredBy(validation),
32
+ onValueChange: (value, event) => {
33
+ setInner(value);
34
+ own.onValueChange?.(value, event);
35
+ },
36
+ // Focus moving into the popup (a search field) stays inside the field.
37
+ onBlur: (event) => {
38
+ own.onBlur?.(event);
39
+ if (!event.relatedTarget?.closest('.salmon-dropdown-popup'))
40
+ blur();
41
+ },
42
+ }
43
+ : null) }));
44
+ if (label == null && description == null && !error)
45
+ return control;
46
+ return (_jsxs("div", { className: "salmon-dropdown-field", children: [label != null && (_jsx("label", { className: "salmon-dropdown-field-label", id: `${base}l`, onClick: focusControl, children: label })), control, description != null && (_jsx("div", { className: "salmon-dropdown-field-description", id: `${base}d`, children: description })), error && (_jsx("div", { className: "salmon-dropdown-field-error", id: `${base}e`, children: message }))] }));
47
+ }
48
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/dropdown/field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,8GAA8G;AAC9G,yEAAyE;AACzE,gFAAgF;AAChF,sCAAsC;AAEtC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAwE,MAAM,OAAO,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAUpF,6GAA6G;AAC7G,MAAM,YAAY,GAAG,CAAC,KAA8B,EAAQ,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,aAAa,CAAc,mBAAmB,CAAC,EAAE,KAAK,EAAE,CAAC;AAc3J;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAmB,KAAsE;IACjH,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACnG,MA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b,CAAC,CAAC;gBACE,EAAE;gBACF,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,UAAU,CAAC,UAAU,CAAC;gBAChD,aAAa,EAAE,CAAC,KAAc,EAAE,KAAc,EAAE,EAAE;oBAChD,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAChB,GAAG,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACpC,CAAC;gBACD,uEAAuE;gBACvE,MAAM,EAAE,CAAC,KAA8B,EAAE,EAAE;oBACzC,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;oBACpB,IAAI,CAAE,KAAK,CAAC,aAAgC,EAAE,OAAO,CAAC,wBAAwB,CAAC;wBAAE,IAAI,EAAE,CAAC;gBAC1F,CAAC;aACF;YACH,CAAC,CAAC,IAAI,CAAC,GACT,CACH,CAAC;IACF,IAAI,KAAK,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IACnE,OAAO,CACL,eAAK,SAAS,EAAC,uBAAuB,aACnC,KAAK,IAAI,IAAI,IAAI,CAChB,gBAAO,SAAS,EAAC,6BAA6B,EAAC,EAAE,EAAE,GAAG,IAAI,GAAG,EAAE,OAAO,EAAE,YAAY,YACjF,KAAK,GACA,CACT,EACA,OAAO,EACP,WAAW,IAAI,IAAI,IAAI,CACtB,cAAK,SAAS,EAAC,mCAAmC,EAAC,EAAE,EAAE,GAAG,IAAI,GAAG,YAC9D,WAAW,GACR,CACP,EACA,KAAK,IAAI,CACR,cAAK,SAAS,EAAC,6BAA6B,EAAC,EAAE,EAAE,GAAG,IAAI,GAAG,YACxD,OAAO,GACJ,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DropdownLocaleText } from './types.js';
2
+ export declare const DROPDOWN_DEFAULT_LOCALE_TEXT: DropdownLocaleText;
3
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/dropdown/locale.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,4BAA4B,EAAE,kBAmBzC,CAAC"}
@@ -0,0 +1,23 @@
1
+ // Default static texts of the dropdowns. Plural forms come from
2
+ // `Intl.PluralRules` of the `locale` prop.
3
+ export const DROPDOWN_DEFAULT_LOCALE_TEXT = Object.freeze({
4
+ noResults: 'No results found',
5
+ noData: 'No options',
6
+ loading: 'Loading…',
7
+ loadError: 'Request failed',
8
+ retry: 'Retry',
9
+ selectAll: 'Select all',
10
+ deselectAll: 'Deselect all',
11
+ clear: 'Clear',
12
+ removeValue: (label) => `Remove ${label}`,
13
+ selectedCount: (count, plural) => `${count} ${plural === 'one' ? 'item' : 'items'} selected`,
14
+ moreValues: (count) => `+${count}`,
15
+ resultCount: (count, plural) => (count === 0 ? 'No results' : `${count} ${plural === 'one' ? 'result' : 'results'}`),
16
+ limitReached: (max) => `Selection limit of ${max} reached`,
17
+ search: 'Search',
18
+ close: 'Close',
19
+ toggle: 'Show options',
20
+ selectedValues: 'Selected values',
21
+ create: (text) => `Add “${text}”`,
22
+ });
23
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/dropdown/locale.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2CAA2C;AAI3C,MAAM,CAAC,MAAM,4BAA4B,GAAuB,MAAM,CAAC,MAAM,CAAC;IAC5E,SAAS,EAAE,kBAAkB;IAC7B,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,YAAY;IACvB,WAAW,EAAE,cAAc;IAC3B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,UAAU,KAAK,EAAE;IACjD,aAAa,EAAE,CAAC,KAAa,EAAE,MAA2B,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,WAAW;IACzH,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE;IAC1C,WAAW,EAAE,CAAC,KAAa,EAAE,MAA2B,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACjJ,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,sBAAsB,GAAG,UAAU;IAClE,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,cAAc;IACtB,cAAc,EAAE,iBAAiB;IACjC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,IAAI,GAAG;CAC1C,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type CSSProperties, type ReactNode, type RefObject } from 'react';
2
+ import type { PopupContext } from './core.js';
3
+ export interface PopupProps {
4
+ readonly anchorRef: RefObject<HTMLElement | null>;
5
+ readonly context: PopupContext;
6
+ readonly className: string;
7
+ readonly style?: CSSProperties | undefined;
8
+ readonly onOutsidePress: () => void;
9
+ readonly children: ReactNode;
10
+ readonly role?: 'dialog' | undefined;
11
+ readonly 'aria-label'?: string | undefined;
12
+ }
13
+ export declare function Popup(props: PopupProps): import("react").ReactPortal;
14
+ //# sourceMappingURL=overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/dropdown/overlay.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAID,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAuCtC"}
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ // Popup overlay of Select and Combobox on the shared overlay primitives
4
+ // (`useTopLayer`, `useOverlayPosition`, `useDismiss` from internal/): a portal
5
+ // into the theme scope (rendered only after a user action, never on the
6
+ // server), top layer, `bottom-start` placement with flip and shift measured in
7
+ // one layout effect, repositioned at most once per frame on scroll / resize
8
+ // while open, and outside-press dismissal through the shared dismiss stack.
9
+ // Focus stays on the trigger or input, so Escape is handled there. A closed
10
+ // dropdown renders none of this, so it has no listeners.
11
+ // `mode="sheet"` is the full-screen dialog of the adaptive popup:
12
+ // CSS fills the screen and overrides the placement transform.
13
+ import { useLayoutEffect, useRef } from 'react';
14
+ import { createPortal } from 'react-dom';
15
+ import { useDismiss } from '@salmonui/core/internal/dismiss';
16
+ import { useOverlayPosition, useTopLayer } from '@salmonui/core/internal/overlay';
17
+ const BOX = Object.freeze({ position: 'fixed', top: 0, left: 0, right: 'auto', bottom: 'auto', margin: 0 });
18
+ export function Popup(props) {
19
+ const { context, anchorRef } = props;
20
+ const sheet = context.mode === 'sheet';
21
+ const ref = useRef(null);
22
+ // Order matters: top layer (makes the box measurable), then placement.
23
+ useTopLayer(ref);
24
+ const place = useOverlayPosition(ref, anchorRef, { placement: 'bottom-start', offset: 2, rtl: context.rtl, autoUpdate: !sheet });
25
+ // Content that changes size after the first placement (a lazy grid popup, remote rows, a search
26
+ // narrowing the list) is placed again, at most once per resize notification.
27
+ useLayoutEffect(() => {
28
+ const el = ref.current;
29
+ const RO = el?.ownerDocument.defaultView?.ResizeObserver;
30
+ if (!el || !RO || sheet)
31
+ return;
32
+ const observer = new RO(() => place());
33
+ observer.observe(el);
34
+ return () => observer.disconnect();
35
+ }, [place, sheet]);
36
+ useDismiss(ref, {
37
+ onDismiss: (reason) => {
38
+ if (reason === 'outside')
39
+ props.onOutsidePress();
40
+ },
41
+ insideRefs: [anchorRef],
42
+ escape: false,
43
+ });
44
+ return createPortal(_jsx("div", { ref: ref, className: props.className, style: props.style ? { ...BOX, ...props.style } : BOX, "data-mode": context.mode, role: props.role, "aria-modal": props.role === 'dialog' ? true : undefined, "aria-label": props['aria-label'], dir: context.rtl ? 'rtl' : undefined, children: props.children }), context.container);
45
+ }
46
+ //# sourceMappingURL=overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../src/dropdown/overlay.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,wEAAwE;AACxE,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AACzD,kEAAkE;AAClE,8DAA8D;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAsD,MAAM,OAAO,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAA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C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACnB,UAAU,CAAC,GAAG,EAAE;QACd,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YACpB,IAAI,MAAM,KAAK,SAAS;gBAAE,KAAK,CAAC,cAAc,EAAE,CAAC;QACnD,CAAC;QACD,UAAU,EAAE,CAAC,SAAS,CAAC;QACvB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IACH,OAAO,YAAY,CACjB,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,eAC1C,OAAO,CAAC,IAAI,EACvB,IAAI,EAAE,KAAK,CAAC,IAAI,gBACJ,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,gBAC1C,KAAK,CAAC,YAAY,CAAC,EAC/B,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,YAEnC,KAAK,CAAC,QAAQ,GACX,EACN,OAAO,CAAC,SAAS,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { type MouseEvent as ReactMouseEvent, type ReactNode, type RefObject } from 'react';
2
+ import { type DropdownController, type PopupContext } from './core.js';
3
+ export interface DropdownPopupProps<Item> {
4
+ readonly ctl: DropdownController<Item>;
5
+ readonly base: string;
6
+ readonly anchorRef: RefObject<HTMLElement | null>;
7
+ readonly context: PopupContext;
8
+ readonly onOutsidePress: () => void;
9
+ /** Chooses a row with the pointer (keeps focus on the trigger or input). */
10
+ readonly onChoose: (row: number, event: ReactMouseEvent) => void;
11
+ /** Search input (Select `searchable`) rendered above the list. */
12
+ readonly search?: ReactNode;
13
+ /** Accessible name of the sheet dialog (`popupMode="sheet"`). */
14
+ readonly sheetTitle?: string | undefined;
15
+ /** Extra rows after the list (Combobox "create" option). */
16
+ readonly after?: ReactNode;
17
+ readonly labelledBy?: string | undefined;
18
+ readonly label?: string | undefined;
19
+ /** Replaces the listbox (Combobox `columns` grid popup). */
20
+ readonly body?: ReactNode;
21
+ }
22
+ export declare function DropdownPopup<Item>(props: DropdownPopupProps<Item>): import("react").JSX.Element;
23
+ /**
24
+ * The mounted window `[first, last)` and the item height from the store.
25
+ * The height is measured once per open from the first rendered option
26
+ * (CSS controls it); a remote list requests the window plus one
27
+ * overscan when it moves. Shared by the listbox and the grid popup.
28
+ */
29
+ export declare function useWindow<Item>(ctl: DropdownController<Item>, fixedHeight?: number): {
30
+ first: number;
31
+ last: number;
32
+ h: number;
33
+ };
34
+ /** Check mark or checkbox of an option, drawn in CSS (`data-state`). */
35
+ export declare function Indicator({ kind, state }: {
36
+ readonly kind: 'check' | 'checkbox';
37
+ readonly state: 'all' | 'some' | 'none';
38
+ }): import("react").JSX.Element;
39
+ /** Label with `<mark>` around the matched ranges. */
40
+ export declare function Highlighted({ label, matches }: {
41
+ readonly label: string;
42
+ readonly matches: readonly (readonly [number, number])[];
43
+ }): import("react").JSX.Element;
44
+ //# sourceMappingURL=popup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../src/dropdown/popup.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAgF,KAAK,UAAU,IAAI,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzK,OAAO,EAAmF,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAQxJ,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACtC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,S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CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAA;CAAE,+BAenI"}
@@ -0,0 +1,183 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Popup content of Select and Combobox, a lazy chunk (core.tsx
4
+ // `usePopupModule`): the listbox with its fixed-height window on the shared
5
+ // virtual math, options with `aria-activedescendant` focus, group headers
6
+ // and the sticky group, the select-all option, empty / loading / error
7
+ // states and the polite live region, placed by the shared overlay.
8
+ import { useEffect, useLayoutEffect, useRef, useSyncExternalStore } from 'react';
9
+ import { windowRange } from '@salmonui/core/internal/collection/virtual';
10
+ import { OVERSCAN, partClass, partStyle, preventFocusLoss, SELECT_ALL_ROW, useStoreField } from './core.js';
11
+ import { Popup } from './overlay.js';
12
+ export function DropdownPopup(props) {
13
+ const { ctl, base, context } = props;
14
+ const p = ctl.props;
15
+ const sheet = context.mode === 'sheet';
16
+ const liveRef = useRef(null);
17
+ // Announcements: result count after a search, the selection limit. DOM write, no render.
18
+ const resultCount = ctl.view.itemCount;
19
+ const searching = ctl.searchText !== '';
20
+ const { text, limitReached, loading } = ctl;
21
+ const locale = ctl.locale ?? 'en-US';
22
+ useEffect(() => {
23
+ const el = liveRef.current;
24
+ if (!el || !searching || loading)
25
+ return;
26
+ const timer = setTimeout(() => {
27
+ el.textContent = text.resultCount(resultCount, new Intl.PluralRules(locale).select(resultCount));
28
+ }, 150);
29
+ return () => clearTimeout(timer);
30
+ }, [searching, resultCount, loading, text, locale]);
31
+ useEffect(() => {
32
+ const el = liveRef.current;
33
+ if (el && limitReached && p.maxSelected !== undefined)
34
+ el.textContent = text.limitReached(p.maxSelected);
35
+ }, [limitReached, text, p.maxSelected]);
36
+ const empty = !loading && ctl.count === 0 && ctl.remoteState.status !== 'error';
37
+ return (_jsxs(Popup, { anchorRef: props.anchorRef, context: context, className: partClass(`${base}-popup salmon-dropdown-popup`, p, 'popup'), style: partStyle(p, 'popup'), onOutsidePress: props.onOutsidePress, role: sheet ? 'dialog' : undefined, "aria-label": sheet ? props.sheetTitle : undefined, children: [props.search, p.popupHeader !== undefined ? _jsx("div", { className: "salmon-dropdown-popup-header", children: p.popupHeader }) : null, props.body ?? _jsx(ListBody, { ctl: ctl, base: base, onChoose: props.onChoose, labelledBy: props.labelledBy, label: props.label }), props.after, empty ? _jsx("div", { className: "salmon-dropdown-empty", children: p.renderEmpty ? p.renderEmpty({ reason: ctl.searchText ? 'noMatch' : 'noData' }) : ctl.searchText ? text.noResults : text.noData }) : null, loading && (ctl.count === 0 || p.loading === true) ? (_jsx("div", { className: "salmon-dropdown-loading", role: "status", children: p.renderLoading ? p.renderLoading() : (_jsxs(_Fragment, { children: [_jsx("span", { className: "salmon-dropdown-spinner", "aria-hidden": "true" }), text.loading] })) })) : null, ctl.remoteState.status === 'error' ? (_jsx("div", { className: "salmon-dropdown-error", role: "alert", children: p.renderError ? p.renderError({ error: ctl.remoteState.error, retry: () => ctl.remote?.retry() }) : (_jsxs(_Fragment, { children: [_jsx("span", { children: text.loadError }), _jsx("button", { type: "button", className: "salmon-dropdown-retry", onPointerDown: preventFocusLoss, onClick: () => ctl.remote?.retry(), children: text.retry })] })) })) : null, p.popupFooter !== undefined ? _jsx("div", { className: "salmon-dropdown-popup-footer", children: p.popupFooter }) : null, _jsx("div", { ref: liveRef, className: "salmon-dropdown-live", "aria-live": "polite", "aria-atomic": "true" })] }));
38
+ }
39
+ function ListBody(props) {
40
+ const { ctl, base, onChoose } = props;
41
+ const { store, count, virtual, maxVisible, listRef } = ctl;
42
+ const p = ctl.props;
43
+ const { first, last, h } = useWindow(ctl);
44
+ const start = virtual ? first : 0;
45
+ const end = virtual ? last : count;
46
+ // The active row when it is outside the mounted window, else -1: a move inside the window does not re-render the list.
47
+ const outside = useSyncExternalStore(store.subscribe, () => {
48
+ const a = store.getState().active;
49
+ return virtual && a >= 0 && a < count && (a < start || a >= end) ? a : -1;
50
+ }, () => -1);
51
+ const outsideInfo = outside >= 0 ? ctl.rowInfo(outside) : null;
52
+ const remote = ctl.remote;
53
+ const onScroll = () => {
54
+ const el = listRef.current;
55
+ if (el && virtual)
56
+ ctl.scrolled(el.scrollTop);
57
+ };
58
+ const rows = [];
59
+ let groupRun = null;
60
+ let groupLabel = '';
61
+ let runKey = 0;
62
+ const flush = () => {
63
+ if (groupRun) {
64
+ rows.push(_jsx("div", { role: "group", "aria-label": groupLabel, className: partClass(`${base}-group salmon-dropdown-group`, p, 'group'), style: partStyle(p, 'group'), children: groupRun }, `g${runKey++}`));
65
+ groupRun = null;
66
+ }
67
+ };
68
+ const grouped = !remote && ctl.collection.grouped;
69
+ if (grouped && start > 0) {
70
+ // The window starts inside a group: open its run.
71
+ for (let r = start; r >= 0; r--) {
72
+ const info = ctl.rowInfo(r);
73
+ if (info.kind === 'group') {
74
+ groupLabel = info.group ?? '';
75
+ groupRun = [];
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ for (let r = start; r < end; r++) {
81
+ const info = ctl.rowInfo(r);
82
+ if (info.kind === 'group') {
83
+ flush();
84
+ groupLabel = info.group ?? '';
85
+ groupRun = [_jsx(GroupHeader, { ctl: ctl, row: r, group: groupLabel }, `h${r}`)];
86
+ continue;
87
+ }
88
+ const node = info.kind === 'pending' ? (_jsx("div", { id: ctl.optionId(r), role: "option", "aria-selected": false, "aria-disabled": true, "aria-setsize": ctl.count, "aria-posinset": r + 1, "data-row": r, "data-pending": "", className: "salmon-dropdown-option", children: _jsx("span", { className: "salmon-dropdown-skeleton", "aria-hidden": "true" }) }, r)) : (_jsx(Option, { ctl: ctl, row: r, item: info.item, position: info.position, onChoose: onChoose }, r));
89
+ if (groupRun)
90
+ groupRun.push(node);
91
+ else
92
+ rows.push(node);
93
+ }
94
+ flush();
95
+ const listStyle = { maxBlockSize: maxVisible * h, ...partStyle(p, 'list') };
96
+ return (_jsxs(_Fragment, { children: [ctl.showSelectAll ? _jsx(SelectAllOption, { ctl: ctl, base: base, onChoose: onChoose }) : null, _jsx("div", { ref: listRef, id: ctl.listId, role: "listbox", "aria-multiselectable": ctl.multiple ? true : undefined, "aria-owns": ctl.showSelectAll ? ctl.optionId(SELECT_ALL_ROW) : undefined, "aria-labelledby": props.labelledBy, "aria-label": props.labelledBy ? undefined : props.label, "aria-busy": ctl.loading ? true : undefined, className: partClass(`${base}-list salmon-dropdown-list`, p, 'list'), style: listStyle, "data-virtual": virtual ? '' : undefined, onScroll: virtual ? onScroll : undefined, onPointerDown: preventFocusLoss, children: virtual ? (_jsxs("div", { className: "salmon-dropdown-sizer", style: { blockSize: count * h }, children: [grouped ? _jsx(StickyGroup, { ctl: ctl }) : null, _jsx("div", { className: "salmon-dropdown-window", style: { transform: `translateY(${start * h}px)` }, children: rows }), outside >= 0 && outsideInfo?.kind === 'item' ? (_jsx("div", { className: "salmon-dropdown-window", role: "presentation", style: { transform: `translateY(${outside * h}px)` }, children: _jsx(Option, { ctl: ctl, row: outside, item: outsideInfo.item, position: outsideInfo.position, onChoose: onChoose }) })) : null] })) : (rows) })] }));
97
+ }
98
+ /**
99
+ * The mounted window `[first, last)` and the item height from the store.
100
+ * The height is measured once per open from the first rendered option
101
+ * (CSS controls it); a remote list requests the window plus one
102
+ * overscan when it moves. Shared by the listbox and the grid popup.
103
+ */
104
+ export function useWindow(ctl, fixedHeight) {
105
+ const { store, count, virtual, maxVisible, listRef, remote } = ctl;
106
+ const h = useStoreField(store, 'itemHeight');
107
+ const stored = { first: useStoreField(store, 'first'), last: useStoreField(store, 'last') };
108
+ // A new count (search, data) starts from the stored window clamped to it.
109
+ const range = virtual ? (stored.last > stored.first && stored.last <= count ? stored : windowRange(count, Math.min(stored.first, count), maxVisible)) : { first: 0, last: count };
110
+ useLayoutEffect(() => {
111
+ const el = listRef.current?.querySelector('[data-row]');
112
+ const measured = fixedHeight ?? el?.offsetHeight ?? 0;
113
+ if (measured > 0 && Math.abs(measured - store.getState().itemHeight) > 0.5)
114
+ store.set({ itemHeight: measured });
115
+ }, [listRef, store, fixedHeight, count > 0]);
116
+ useEffect(() => {
117
+ remote?.ensure(range.first, range.last + OVERSCAN);
118
+ }, [remote, range.first, range.last, ctl.remoteState.total]);
119
+ return { first: range.first, last: range.last, h };
120
+ }
121
+ /** Sticky header of a windowed grouped list: the group of the first visible row. */
122
+ function StickyGroup({ ctl }) {
123
+ const group = useStoreField(ctl.store, 'sticky') ?? (ctl.count ? (ctl.view.group(0) ?? '') : '');
124
+ const p = ctl.props;
125
+ return (_jsx("div", { className: "salmon-dropdown-sticky-group", "aria-hidden": "true", children: p.renderGroupHeader ? p.renderGroupHeader({ group }) : group }));
126
+ }
127
+ function GroupHeader({ ctl, row, group }) {
128
+ const p = ctl.props;
129
+ const content = p.renderGroupHeader ? p.renderGroupHeader({ group }) : group;
130
+ // Tri-state group header option.
131
+ if (ctl.multiple && p.groupSelection)
132
+ return _jsx(TriOption, { ctl: ctl, row: row, state: ctl.groupState(group), label: content, className: "salmon-dropdown-group-header", onClick: () => ctl.toggleGroup(group, 'pointer') });
133
+ return (_jsx("div", { role: "presentation", "aria-hidden": "true", "data-row": row, "data-group-header": "", className: "salmon-dropdown-group-header", children: content }));
134
+ }
135
+ function SelectAllOption({ ctl, base, onChoose }) {
136
+ const state = ctl.allState();
137
+ return _jsx(TriOption, { ctl: ctl, row: SELECT_ALL_ROW, state: state, label: state === 'all' ? ctl.text.deselectAll : ctl.text.selectAll, className: `${base}-select-all salmon-dropdown-select-all`, onClick: (event) => onChoose(SELECT_ALL_ROW, event) });
138
+ }
139
+ /** A tri-state option (select all, a selectable group header): `aria-checked` carries `mixed`. */
140
+ function TriOption(props) {
141
+ const { ctl, row, state } = props;
142
+ const active = useSyncExternalStore(ctl.store.subscribe, () => ctl.store.getState().active === row, () => false);
143
+ return (_jsxs("div", { id: ctl.optionId(row), role: "option", "aria-selected": state === 'all', "aria-checked": state === 'all' ? true : state === 'some' ? 'mixed' : false, className: `${props.className} salmon-dropdown-option`, "data-row": row >= 0 ? row : undefined, "data-active": active ? '' : undefined, "data-state": state, onPointerDown: preventFocusLoss, onClick: props.onClick, children: [_jsx(Indicator, { kind: "checkbox", state: state }), _jsx("span", { className: "salmon-dropdown-option-label", children: props.label })] }));
144
+ }
145
+ /** Check mark or checkbox of an option, drawn in CSS (`data-state`). */
146
+ export function Indicator({ kind, state }) {
147
+ return _jsx("span", { className: `salmon-dropdown-${kind}`, "data-state": state === 'all' ? 'checked' : state === 'some' ? 'mixed' : 'unchecked', "aria-hidden": "true" });
148
+ }
149
+ function Option({ ctl, row, item, position, onChoose }) {
150
+ // Only the old and the new active option re-render on a move.
151
+ const active = useSyncExternalStore(ctl.store.subscribe, () => ctl.store.getState().active === row, () => false);
152
+ const p = ctl.props;
153
+ const value = ctl.valueOf(item);
154
+ const label = ctl.labelOf(item);
155
+ const selected = ctl.selected.has(value);
156
+ const disabled = ctl.isDisabled(item) || (ctl.limitReached && !selected);
157
+ const matches = ctl.searchText && ctl.matchRanges && (p.highlightMatches || p.renderItem) ? ctl.matchRanges(label, ctl.searchText, ctl.operator, { matchCase: p.matchCase, ignoreAccents: p.ignoreAccents }) : NO_MATCHES;
158
+ const extra = p.getItemProps?.(item);
159
+ const indicator = p.indicator ?? 'check';
160
+ const icon = p.getItemIcon?.(item);
161
+ const content = p.renderItem ? p.renderItem({ item, label, selected, active, disabled, matches }) : p.highlightMatches ? _jsx(Highlighted, { label: label, matches: matches }) : label;
162
+ const className = partClass(`salmon-${ctl.kind}-option salmon-dropdown-option`, p, 'option');
163
+ const { className: extraClass, style: extraStyle, ...dataProps } = (extra ?? {});
164
+ return (_jsxs("div", { ...dataProps, id: ctl.optionId(row), role: "option", "aria-selected": selected, "aria-disabled": disabled ? true : undefined, "aria-setsize": ctl.view.itemCount, "aria-posinset": position, "data-row": row, "data-active": active ? '' : undefined, "data-selected": selected ? '' : undefined, "data-disabled": disabled ? '' : undefined, className: extraClass ? `${className} ${extraClass}` : className, style: extraStyle || p.styles?.option ? { ...p.styles?.option, ...extraStyle } : undefined, onClick: disabled ? undefined : (event) => onChoose(row, event), onPointerMove: disabled || active ? undefined : () => ctl.store.set({ active: row }), children: [ctl.multiple || indicator === 'checkbox' ? _jsx(Indicator, { kind: indicator, state: selected ? 'all' : 'none' }) : null, icon != null ? (_jsx("span", { className: "salmon-dropdown-option-icon", "aria-hidden": "true", children: icon })) : null, _jsx("span", { className: "salmon-dropdown-option-label", children: content }), !ctl.multiple && indicator === 'check' ? _jsx(Indicator, { kind: "check", state: selected ? 'all' : 'none' }) : null] }));
165
+ }
166
+ const NO_MATCHES = Object.freeze([]);
167
+ /** Label with `<mark>` around the matched ranges. */
168
+ export function Highlighted({ label, matches }) {
169
+ if (!matches.length)
170
+ return _jsx(_Fragment, { children: label });
171
+ const out = [];
172
+ let at = 0;
173
+ for (const [s, e] of matches) {
174
+ if (s > at)
175
+ out.push(label.slice(at, s));
176
+ out.push(_jsx("mark", { className: "salmon-dropdown__match", children: label.slice(s, e) }, s));
177
+ at = e;
178
+ }
179
+ if (at < label.length)
180
+ out.push(label.slice(at));
181
+ return _jsx(_Fragment, { children: out });
182
+ }
183
+ //# sourceMappingURL=popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popup.js","sourceRoot":"","sources":["../../src/dropdown/popup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+DAA+D;AAC/D,4EAA4E;AAC5E,0EAA0E;AAC1E,uEAAuE;AACvE,mEAAmE;AAEnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,oBAAoB,EAA0F,MAAM,OAAO,CAAC;AACzK,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,a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