@noix-dev/brix-vue 0.0.0-stage → 0.2.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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -2
  3. package/package.json +117 -3
  4. package/src/components/address-field/AddressField.vue +337 -0
  5. package/src/components/address-field/index.ts +1 -0
  6. package/src/components/appearance-picker/AppearancePicker.vue +502 -0
  7. package/src/components/appearance-picker/AppearanceSegment.vue +175 -0
  8. package/src/components/appearance-picker/index.ts +44 -0
  9. package/src/components/autofill/AutoFillDialog.vue +264 -0
  10. package/src/components/autofill/index.ts +1 -0
  11. package/src/components/badge/Badge.vue +23 -0
  12. package/src/components/badge/index.ts +106 -0
  13. package/src/components/build-stamp/BuildStamp.vue +62 -0
  14. package/src/components/build-stamp/index.ts +1 -0
  15. package/src/components/button/Button.vue +31 -0
  16. package/src/components/button/index.ts +122 -0
  17. package/src/components/card/Card.vue +29 -0
  18. package/src/components/card/CardAction.vue +17 -0
  19. package/src/components/card/CardContent.vue +14 -0
  20. package/src/components/card/CardDescription.vue +14 -0
  21. package/src/components/card/CardFooter.vue +22 -0
  22. package/src/components/card/CardHeader.vue +22 -0
  23. package/src/components/card/CardTitle.vue +29 -0
  24. package/src/components/card/index.ts +47 -0
  25. package/src/components/chart/BarChart.vue +123 -0
  26. package/src/components/chart/StackedBarChart.vue +149 -0
  27. package/src/components/chart/appearanceRevision.ts +22 -0
  28. package/src/components/chart/chartColor.ts +59 -0
  29. package/src/components/chart/index.ts +6 -0
  30. package/src/components/checkbox/Checkbox.vue +61 -0
  31. package/src/components/checkbox/index.ts +1 -0
  32. package/src/components/code-editor/CodeEditor.vue +352 -0
  33. package/src/components/code-editor/index.ts +9 -0
  34. package/src/components/code-editor/syntaxTheme.ts +110 -0
  35. package/src/components/colour-picker/ColourPicker.vue +421 -0
  36. package/src/components/colour-picker/index.ts +1 -0
  37. package/src/components/combobox/Combobox.vue +337 -0
  38. package/src/components/combobox/index.ts +1 -0
  39. package/src/components/comments/CommentComposer.vue +302 -0
  40. package/src/components/comments/CommentMessage.vue +259 -0
  41. package/src/components/comments/CommentThread.vue +250 -0
  42. package/src/components/comments/commentBody.ts +185 -0
  43. package/src/components/comments/commentLevels.ts +139 -0
  44. package/src/components/comments/commentNode.ts +35 -0
  45. package/src/components/comments/composer.ts +20 -0
  46. package/src/components/comments/index.ts +29 -0
  47. package/src/components/confirm-dialog/ConfirmDialog.vue +153 -0
  48. package/src/components/confirm-dialog/index.ts +1 -0
  49. package/src/components/containers/Box.vue +42 -0
  50. package/src/components/containers/Section.vue +88 -0
  51. package/src/components/containers/SectionAction.vue +17 -0
  52. package/src/components/containers/SectionContent.vue +14 -0
  53. package/src/components/containers/SectionDescription.vue +14 -0
  54. package/src/components/containers/SectionHeader.vue +22 -0
  55. package/src/components/containers/SectionTitle.vue +17 -0
  56. package/src/components/containers/index.ts +9 -0
  57. package/src/components/data-table/ColumnMenu.vue +241 -0
  58. package/src/components/data-table/DataTable.vue +447 -0
  59. package/src/components/data-table/ExpandCaret.vue +34 -0
  60. package/src/components/data-table/SortableHead.vue +184 -0
  61. package/src/components/data-table/TableLoadingRow.vue +13 -0
  62. package/src/components/data-table/TableProgressRow.vue +26 -0
  63. package/src/components/data-table/columns.ts +13 -0
  64. package/src/components/data-table/index.ts +3 -0
  65. package/src/components/data-table/pinned.ts +19 -0
  66. package/src/components/data-table/rowActivation.ts +14 -0
  67. package/src/components/data-table/sort.ts +13 -0
  68. package/src/components/data-table/types.ts +23 -0
  69. package/src/components/date-picker/CalendarPanel.vue +432 -0
  70. package/src/components/date-picker/DateField.vue +293 -0
  71. package/src/components/date-picker/DatePicker.vue +147 -0
  72. package/src/components/date-picker/UntilDatePicker.vue +96 -0
  73. package/src/components/date-picker/dateFieldGuard.ts +87 -0
  74. package/src/components/date-picker/index.ts +4 -0
  75. package/src/components/date-picker/useDateField.ts +37 -0
  76. package/src/components/date-range-picker/DateRangePicker.vue +247 -0
  77. package/src/components/date-range-picker/index.ts +1 -0
  78. package/src/components/date-time-picker/DateTimePicker.vue +291 -0
  79. package/src/components/date-time-picker/index.ts +1 -0
  80. package/src/components/dialog/Dialog.vue +250 -0
  81. package/src/components/dialog/DialogSurface.vue +214 -0
  82. package/src/components/dialog/dialogEdges.ts +65 -0
  83. package/src/components/dialog/dialogSizes.ts +35 -0
  84. package/src/components/dialog/index.ts +12 -0
  85. package/src/components/dialog/toastHost.ts +18 -0
  86. package/src/components/dropdown/Dropdown.vue +101 -0
  87. package/src/components/dropdown/DropdownItems.vue +154 -0
  88. package/src/components/dropdown/dropdown.ts +64 -0
  89. package/src/components/dropdown/index.ts +2 -0
  90. package/src/components/file-preview/FilePreview.vue +78 -0
  91. package/src/components/file-preview/index.ts +1 -0
  92. package/src/components/file-upload/FileUpload.vue +234 -0
  93. package/src/components/file-upload/index.ts +1 -0
  94. package/src/components/filter-check-menu/FilterCheckMenu.vue +562 -0
  95. package/src/components/filter-check-menu/filterCheckOption.ts +10 -0
  96. package/src/components/filter-check-menu/index.ts +2 -0
  97. package/src/components/form-field/FormField.vue +74 -0
  98. package/src/components/form-field/index.ts +2 -0
  99. package/src/components/form-field/types.ts +5 -0
  100. package/src/components/frames/FrameCentred.vue +137 -0
  101. package/src/components/frames/FrameSidebar.vue +113 -0
  102. package/src/components/frames/FrameSplit.vue +109 -0
  103. package/src/components/frames/index.ts +3 -0
  104. package/src/components/icon/BellIcon.vue +27 -0
  105. package/src/components/icon/BoldIcon.vue +31 -0
  106. package/src/components/icon/CalendarDaysIcon.vue +33 -0
  107. package/src/components/icon/CheckIcon.vue +31 -0
  108. package/src/components/icon/ChevronDownIcon.vue +30 -0
  109. package/src/components/icon/ChevronLeftIcon.vue +31 -0
  110. package/src/components/icon/ChevronRightIcon.vue +31 -0
  111. package/src/components/icon/ChevronUpIcon.vue +30 -0
  112. package/src/components/icon/CircleAlertIcon.vue +29 -0
  113. package/src/components/icon/ClockIcon.vue +31 -0
  114. package/src/components/icon/Columns3Icon.vue +32 -0
  115. package/src/components/icon/FlipHorizontalIcon.vue +29 -0
  116. package/src/components/icon/ItalicIcon.vue +28 -0
  117. package/src/components/icon/LinkIcon.vue +27 -0
  118. package/src/components/icon/ListIcon.vue +29 -0
  119. package/src/components/icon/ListOrderedIcon.vue +28 -0
  120. package/src/components/icon/PenLineIcon.vue +31 -0
  121. package/src/components/icon/PlusIcon.vue +28 -0
  122. package/src/components/icon/RotateCcwIcon.vue +28 -0
  123. package/src/components/icon/RotateCwIcon.vue +28 -0
  124. package/src/components/icon/SearchIcon.vue +31 -0
  125. package/src/components/icon/StarIcon.vue +29 -0
  126. package/src/components/icon/TriangleAlertIcon.vue +29 -0
  127. package/src/components/icon/UnderlineIcon.vue +27 -0
  128. package/src/components/icon/Undo2Icon.vue +28 -0
  129. package/src/components/icon/XIcon.vue +31 -0
  130. package/src/components/icon/ZoomInIcon.vue +30 -0
  131. package/src/components/icon/ZoomOutIcon.vue +29 -0
  132. package/src/components/icon/index.ts +37 -0
  133. package/src/components/icon-picker/IconPicker.vue +560 -0
  134. package/src/components/icon-picker/index.ts +1 -0
  135. package/src/components/image-crop-dialog/CropRatioRow.vue +132 -0
  136. package/src/components/image-crop-dialog/CropVariantStrip.vue +277 -0
  137. package/src/components/image-crop-dialog/ImageCropDialog.vue +1541 -0
  138. package/src/components/image-crop-dialog/index.ts +16 -0
  139. package/src/components/image-upload/ImageUpload.vue +345 -0
  140. package/src/components/image-upload/index.ts +2 -0
  141. package/src/components/input/Input.vue +48 -0
  142. package/src/components/input/index.ts +1 -0
  143. package/src/components/keycap/Keycap.vue +49 -0
  144. package/src/components/keycap/index.ts +1 -0
  145. package/src/components/label/Label.vue +26 -0
  146. package/src/components/label/index.ts +1 -0
  147. package/src/components/menu/MenuCheckboxItem.vue +63 -0
  148. package/src/components/menu/MenuContent.vue +45 -0
  149. package/src/components/menu/MenuGroup.vue +22 -0
  150. package/src/components/menu/MenuItem.vue +34 -0
  151. package/src/components/menu/MenuLabel.vue +22 -0
  152. package/src/components/menu/MenuRadioGroup.vue +22 -0
  153. package/src/components/menu/MenuRadioItem.vue +50 -0
  154. package/src/components/menu/MenuRoot.vue +25 -0
  155. package/src/components/menu/MenuSeparator.vue +27 -0
  156. package/src/components/menu/MenuSub.vue +29 -0
  157. package/src/components/menu/MenuSubContent.vue +48 -0
  158. package/src/components/menu/MenuSubTrigger.vue +49 -0
  159. package/src/components/menu/MenuTrigger.vue +22 -0
  160. package/src/components/menu/index.ts +20 -0
  161. package/src/components/menu/menuClasses.ts +74 -0
  162. package/src/components/morph-select/MorphSelect.vue +150 -0
  163. package/src/components/morph-select/index.ts +1 -0
  164. package/src/components/nav/NavFlyout.vue +343 -0
  165. package/src/components/nav/NavGroup.vue +306 -0
  166. package/src/components/nav/NavItem.vue +243 -0
  167. package/src/components/nav/NavNodes.ts +66 -0
  168. package/src/components/nav/NavSection.vue +105 -0
  169. package/src/components/nav/NavSidebar.vue +137 -0
  170. package/src/components/nav/index.ts +5 -0
  171. package/src/components/nav/navChain.ts +112 -0
  172. package/src/components/nav/navClasses.ts +229 -0
  173. package/src/components/nav/navNode.ts +10 -0
  174. package/src/components/nav/navRegistry.ts +24 -0
  175. package/src/components/notification-list/NotificationList.vue +314 -0
  176. package/src/components/notification-list/index.ts +2 -0
  177. package/src/components/notification-list/notifications.ts +21 -0
  178. package/src/components/pagination/Pagination.vue +296 -0
  179. package/src/components/pagination/index.ts +1 -0
  180. package/src/components/pin-field/PinField.vue +332 -0
  181. package/src/components/pin-field/index.ts +1 -0
  182. package/src/components/popover-panel/PopoverPanel.vue +115 -0
  183. package/src/components/popover-panel/index.ts +5 -0
  184. package/src/components/rating/Rating.vue +201 -0
  185. package/src/components/rating/index.ts +1 -0
  186. package/src/components/record-avatar/RecordAvatar.vue +76 -0
  187. package/src/components/record-avatar/index.ts +1 -0
  188. package/src/components/result-window/ResultWindow.vue +399 -0
  189. package/src/components/result-window/index.ts +2 -0
  190. package/src/components/result-window/results.ts +75 -0
  191. package/src/components/rich-editor/RichEditor.vue +370 -0
  192. package/src/components/rich-editor/RichEditorLinkDialog.vue +133 -0
  193. package/src/components/rich-editor/index.ts +8 -0
  194. package/src/components/row-actions/RowActions.vue +262 -0
  195. package/src/components/row-actions/index.ts +2 -0
  196. package/src/components/row-actions/rowActions.ts +44 -0
  197. package/src/components/search-select/SearchSelect.vue +599 -0
  198. package/src/components/search-select/index.ts +2 -0
  199. package/src/components/search-select/types.ts +14 -0
  200. package/src/components/segmented-choice/SegmentedChoice.vue +136 -0
  201. package/src/components/segmented-choice/index.ts +2 -0
  202. package/src/components/segmented-choice/segmentedOption.ts +6 -0
  203. package/src/components/select/Select.vue +18 -0
  204. package/src/components/select/SelectContent.vue +73 -0
  205. package/src/components/select/SelectGroup.vue +21 -0
  206. package/src/components/select/SelectItem.vue +47 -0
  207. package/src/components/select/SelectItemText.vue +12 -0
  208. package/src/components/select/SelectLabel.vue +17 -0
  209. package/src/components/select/SelectScrollDownButton.vue +36 -0
  210. package/src/components/select/SelectScrollUpButton.vue +36 -0
  211. package/src/components/select/SelectSeparator.vue +19 -0
  212. package/src/components/select/SelectTrigger.vue +52 -0
  213. package/src/components/select/SelectValue.vue +12 -0
  214. package/src/components/select/index.ts +11 -0
  215. package/src/components/session/IdleTimer.vue +71 -0
  216. package/src/components/session/SessionDialogs.vue +177 -0
  217. package/src/components/session/index.ts +2 -0
  218. package/src/components/split-button/SplitButton.vue +122 -0
  219. package/src/components/split-button/index.ts +2 -0
  220. package/src/components/split-button/splitButtonItem.ts +7 -0
  221. package/src/components/switch/Switch.vue +60 -0
  222. package/src/components/switch/index.ts +1 -0
  223. package/src/components/table/Table.vue +51 -0
  224. package/src/components/table/TableBody.vue +14 -0
  225. package/src/components/table/TableCaption.vue +17 -0
  226. package/src/components/table/TableCell.vue +22 -0
  227. package/src/components/table/TableEmpty.vue +72 -0
  228. package/src/components/table/TableFooter.vue +17 -0
  229. package/src/components/table/TableHead.vue +22 -0
  230. package/src/components/table/TableHeader.vue +14 -0
  231. package/src/components/table/TableRow.vue +22 -0
  232. package/src/components/table/index.ts +9 -0
  233. package/src/components/tabs/Tabs.vue +173 -0
  234. package/src/components/tabs/index.ts +2 -0
  235. package/src/components/tabs/tabItem.ts +12 -0
  236. package/src/components/textarea/LimitedTextarea.vue +81 -0
  237. package/src/components/textarea/TextLimitCounter.vue +107 -0
  238. package/src/components/textarea/Textarea.vue +42 -0
  239. package/src/components/textarea/index.ts +4 -0
  240. package/src/components/textarea/textLimit.ts +43 -0
  241. package/src/components/time-picker/TimePicker.vue +522 -0
  242. package/src/components/time-picker/index.ts +1 -0
  243. package/src/components/toast/ToastHost.vue +276 -0
  244. package/src/components/toast/index.ts +1 -0
  245. package/src/components/update-notice/UpdateNotice.vue +103 -0
  246. package/src/components/update-notice/index.ts +1 -0
  247. package/src/components/user-menu/UserMenu.vue +154 -0
  248. package/src/components/user-menu/index.ts +1 -0
  249. package/src/index.ts +182 -0
  250. package/src/lib/cn.ts +21 -0
  251. package/src/lib/panelFocus.ts +65 -0
  252. package/src/lib/sessionMonitor.ts +390 -0
  253. package/src/lib/slotContent.ts +17 -0
  254. package/src/lib/updateCheck.ts +133 -0
  255. package/src/styles.css +82 -0
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuLabelProps } from 'reka-ui';
3
+ import { DropdownMenuLabel, useForwardProps } from 'reka-ui';
4
+
5
+ /**
6
+ * A heading for a group of rows inside a `MenuContent`. It is not a row: the arrow keys skip it
7
+ * and it is never chosen. It carries no styling of its own, so give it a `class` for the type
8
+ * and spacing a heading needs in your menu.
9
+ *
10
+ * This is a thin wrapper over the underlying library's label and exists so the package owns its
11
+ * own surface. It adds no styling and no behaviour; every prop passes through.
12
+ */
13
+ const props = defineProps<DropdownMenuLabelProps>();
14
+
15
+ const forwarded = useForwardProps(props);
16
+ </script>
17
+
18
+ <template>
19
+ <DropdownMenuLabel v-bind="forwarded">
20
+ <slot />
21
+ </DropdownMenuLabel>
22
+ </template>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuRadioGroupEmits, DropdownMenuRadioGroupProps } from 'reka-ui';
3
+ import { DropdownMenuRadioGroup, useForwardPropsEmits } from 'reka-ui';
4
+
5
+ /**
6
+ * The set a `MenuRadioItem` belongs to: it holds the chosen value (`v-model`) and nothing else,
7
+ * and draws nothing. A radio item outside one has no group to report its choice to.
8
+ *
9
+ * This is a thin wrapper over the underlying library's radio group and exists so the package
10
+ * owns its own surface. It adds no styling and no behaviour; every prop and event passes through.
11
+ */
12
+ const props = defineProps<DropdownMenuRadioGroupProps>();
13
+ const emits = defineEmits<DropdownMenuRadioGroupEmits>();
14
+
15
+ const forwarded = useForwardPropsEmits(props, emits);
16
+ </script>
17
+
18
+ <template>
19
+ <DropdownMenuRadioGroup v-bind="forwarded">
20
+ <slot />
21
+ </DropdownMenuRadioGroup>
22
+ </template>
@@ -0,0 +1,50 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuRadioItemEmits, DropdownMenuRadioItemProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DropdownMenuItemIndicator, DropdownMenuRadioItem, useForwardPropsEmits } from 'reka-ui';
6
+ import { cn } from '../../lib/cn';
7
+ import { CheckIcon } from '../icon';
8
+ import { menuRowClass, menuTickLayoutClass } from './menuClasses';
9
+
10
+ /**
11
+ * One choice of a set, inside a `MenuRadioGroup`: the label, and a tick at the right of the
12
+ * chosen one. The tick is `indicator-icon`, a named slot (ADR 0013) that defaults to the
13
+ * package's own glyph, and the default slot's scope is `{ checked }` — so a row can draw its
14
+ * own label differently when it is the chosen one. `MenuCheckboxItem` is the sibling row, for
15
+ * a choice that stands on its own; it hands over the same state under two names, because the
16
+ * library does.
17
+ */
18
+ defineOptions({ inheritAttrs: false });
19
+
20
+ const props = defineProps<DropdownMenuRadioItemProps & { class?: HTMLAttributes['class'] }>();
21
+ const emits = defineEmits<DropdownMenuRadioItemEmits>();
22
+
23
+ defineSlots<{
24
+ /** The choice's label, with whether this is the chosen one as `{ checked }`. */
25
+ default?: (props: { checked: boolean }) => unknown;
26
+ /** The tick drawn beside the chosen choice. Defaults to the package's own glyph. */
27
+ 'indicator-icon'?: () => unknown;
28
+ }>();
29
+
30
+ const delegatedProps = reactiveOmit(props, 'class');
31
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
32
+ </script>
33
+
34
+ <template>
35
+ <DropdownMenuRadioItem
36
+ v-slot="{ checked }"
37
+ data-slot="menu-radio-item"
38
+ v-bind="{ ...$attrs, ...forwarded }"
39
+ :class="cn(menuRowClass, menuTickLayoutClass, props.class)"
40
+ >
41
+ <span class="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
42
+ <DropdownMenuItemIndicator>
43
+ <slot name="indicator-icon">
44
+ <CheckIcon />
45
+ </slot>
46
+ </DropdownMenuItemIndicator>
47
+ </span>
48
+ <slot v-bind="{ checked }" />
49
+ </DropdownMenuRadioItem>
50
+ </template>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuRootEmits, DropdownMenuRootProps } from 'reka-ui';
3
+ import { DropdownMenuRoot, useForwardPropsEmits } from 'reka-ui';
4
+
5
+ /**
6
+ * The root of a dropdown menu: it owns the open state and nothing else, and draws nothing.
7
+ * Compose a `MenuTrigger` and a `MenuContent` inside it. `v-model:open` drives it from outside,
8
+ * and the default slot's scope is `{ open }`. `modal` (default `true`) decides whether the
9
+ * page behind the open menu is inert.
10
+ *
11
+ * This is a thin wrapper over the underlying library's root and exists so the package owns its
12
+ * own surface: a consumer imports the whole menu from here and reads this documentation, not
13
+ * the library's. It adds no styling and no behaviour; every prop and event passes through.
14
+ */
15
+ const props = defineProps<DropdownMenuRootProps>();
16
+ const emits = defineEmits<DropdownMenuRootEmits>();
17
+
18
+ const forwarded = useForwardPropsEmits(props, emits);
19
+ </script>
20
+
21
+ <template>
22
+ <DropdownMenuRoot v-slot="{ open }" v-bind="forwarded">
23
+ <slot :open="open" />
24
+ </DropdownMenuRoot>
25
+ </template>
@@ -0,0 +1,27 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuSeparatorProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DropdownMenuSeparator } from 'reka-ui';
6
+ import { cn } from '../../lib/cn';
7
+
8
+ /**
9
+ * A hairline between two groups of rows. It is not a row: reka gives it `role="separator"`
10
+ * and the arrow keys step over it.
11
+ *
12
+ * `--border` is decoration here (1.2 to 1.5 against the panel, never a boundary a reader
13
+ * depends on): the groups are named by their rows' own text. It runs to the panel's edge
14
+ * (`-mx-1` cancels the panel's `p-1`) the way `SelectSeparator` does.
15
+ */
16
+ const props = defineProps<DropdownMenuSeparatorProps & { class?: HTMLAttributes['class'] }>();
17
+
18
+ const delegatedProps = reactiveOmit(props, 'class');
19
+ </script>
20
+
21
+ <template>
22
+ <DropdownMenuSeparator
23
+ data-slot="menu-separator"
24
+ v-bind="delegatedProps"
25
+ :class="cn('bg-border -mx-1 my-1 h-px', props.class)"
26
+ />
27
+ </template>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuSubEmits, DropdownMenuSubProps } from 'reka-ui';
3
+ import { DropdownMenuSub, useForwardPropsEmits } from 'reka-ui';
4
+
5
+ /**
6
+ * A sub-menu inside a `MenuContent`: it owns one sub-panel's open state and nothing else, and
7
+ * draws nothing. Compose a `MenuSubTrigger` and a `MenuSubContent` inside it, in that order,
8
+ * and nest another `MenuSub` inside that content for a further level. `v-model:open` drives it
9
+ * from outside, and the default slot's scope is `{ open }`.
10
+ *
11
+ * Its open state is held by the menu around it, not only by itself: when that menu closes,
12
+ * every sub-menu in it closes with it. A sub-menu held from outside therefore has to be told,
13
+ * which is why the `update:open` event is forwarded and not only the props.
14
+ *
15
+ * This is a thin wrapper over the underlying library's sub-root and exists so the package owns
16
+ * its own surface: a consumer imports the whole menu from here and reads this documentation,
17
+ * not the library's. It adds no styling and no behaviour; every prop and event passes through.
18
+ */
19
+ const props = defineProps<DropdownMenuSubProps>();
20
+ const emits = defineEmits<DropdownMenuSubEmits>();
21
+
22
+ const forwarded = useForwardPropsEmits(props, emits);
23
+ </script>
24
+
25
+ <template>
26
+ <DropdownMenuSub v-slot="{ open }" v-bind="forwarded">
27
+ <slot :open="open" />
28
+ </DropdownMenuSub>
29
+ </template>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuSubContentEmits, DropdownMenuSubContentProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DropdownMenuPortal, DropdownMenuSubContent, useForwardPropsEmits } from 'reka-ui';
6
+ import { cn } from '../../lib/cn';
7
+ import { menuPanelClass } from './menuClasses';
8
+
9
+ /**
10
+ * The panel of a sub-menu, inside a `MenuSub` and after its `MenuSubTrigger`. It carries the
11
+ * same look, the same height cap and the same `min-w-*` floor as `MenuContent`, and a `class`
12
+ * replaces the floor the same way.
13
+ *
14
+ * It takes no `side` and no `align`, because the library does not offer them here: a sub-panel
15
+ * goes beside its trigger, towards the reading direction, with its top at the trigger's.
16
+ * `sideOffset` is the library's 0, so the panel sits against its trigger rather than across a
17
+ * gap the pointer has to cross; `MenuContent`'s four pixels are for a panel standing off a
18
+ * button, which is a different thing.
19
+ *
20
+ * THE PORTAL IS LOAD-BEARING AT THE THIRD LEVEL, which is not why `MenuContent` carries one.
21
+ * Without it a sub-panel renders inside the panel that holds its trigger, and the library closes
22
+ * a sub-panel on ArrowLeft without stopping that key event: it goes on bubbling, the enclosing
23
+ * panel's handler reads it as its own ArrowLeft, and one press closes two levels. The portal
24
+ * lands each panel on `document.body` instead, so a level only ever closes itself. Measured in
25
+ * the cascade case of `Menu.test.ts`, which is why that case is three levels and not two.
26
+ * Returning the focus to whatever opened the menu survives the move: the panel's focus scope is
27
+ * nested by the component tree, which a portal does not change.
28
+ */
29
+ defineOptions({ inheritAttrs: false });
30
+
31
+ const props = defineProps<DropdownMenuSubContentProps & { class?: HTMLAttributes['class'] }>();
32
+ const emits = defineEmits<DropdownMenuSubContentEmits>();
33
+
34
+ const delegatedProps = reactiveOmit(props, 'class');
35
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
36
+ </script>
37
+
38
+ <template>
39
+ <DropdownMenuPortal>
40
+ <DropdownMenuSubContent
41
+ data-slot="menu-sub-content"
42
+ v-bind="{ ...$attrs, ...forwarded }"
43
+ :class="cn(menuPanelClass, props.class)"
44
+ >
45
+ <slot />
46
+ </DropdownMenuSubContent>
47
+ </DropdownMenuPortal>
48
+ </template>
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuSubTriggerProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DropdownMenuSubTrigger, useForwardProps } from 'reka-ui';
6
+ import { cn } from '../../lib/cn';
7
+ import { ChevronRightIcon } from '../icon';
8
+ import { menuItemLayoutClass, menuRowClass } from './menuClasses';
9
+
10
+ /**
11
+ * The row that opens a sub-menu, first inside a `MenuSub`. It looks like a `MenuItem` and the
12
+ * arrow keys treat it as one, but it chooses nothing: Enter, Space and ArrowRight open the
13
+ * sub-panel and move the focus into it, and ArrowLeft inside that panel closes it and comes
14
+ * back here. `disabled` fades it and opens nothing.
15
+ *
16
+ * The glyph pointing at the sub-panel is `indicator-icon`, a named slot (ADR 0013) that
17
+ * defaults to the package's own chevron. The row's layout is `MenuItem`'s — label and glyph at
18
+ * either end, no wrapping — and a `class` replaces it the same way.
19
+ *
20
+ * `graceDuration` is how long the pointer is given to cross from this row to the sub-panel
21
+ * before hovering another row closes it; the library's default is 300ms.
22
+ */
23
+ defineOptions({ inheritAttrs: false });
24
+
25
+ const props = defineProps<DropdownMenuSubTriggerProps & { class?: HTMLAttributes['class'] }>();
26
+
27
+ defineSlots<{
28
+ /** The row's label. */
29
+ default?: () => unknown;
30
+ /** The glyph pointing at the sub-panel. Defaults to the package's own chevron. */
31
+ 'indicator-icon'?: () => unknown;
32
+ }>();
33
+
34
+ const delegatedProps = reactiveOmit(props, 'class');
35
+ const forwarded = useForwardProps(delegatedProps);
36
+ </script>
37
+
38
+ <template>
39
+ <DropdownMenuSubTrigger
40
+ data-slot="menu-sub-trigger"
41
+ v-bind="{ ...$attrs, ...forwarded }"
42
+ :class="cn(menuRowClass, menuItemLayoutClass, props.class)"
43
+ >
44
+ <slot />
45
+ <slot name="indicator-icon">
46
+ <ChevronRightIcon />
47
+ </slot>
48
+ </DropdownMenuSubTrigger>
49
+ </template>
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import type { DropdownMenuTriggerProps } from 'reka-ui';
3
+ import { DropdownMenuTrigger, useForwardProps } from 'reka-ui';
4
+
5
+ /**
6
+ * The element that opens a menu, inside a `MenuRoot`. Pass `as-child` to make your own button
7
+ * the trigger instead of wrapping it in a second one; it then carries the menu's `aria-haspopup`
8
+ * and `aria-expanded`, and the menu anchors to it.
9
+ *
10
+ * This is a thin wrapper over the underlying library's trigger and exists so the package owns
11
+ * its own surface. It adds no styling and no behaviour; every prop passes through.
12
+ */
13
+ const props = defineProps<DropdownMenuTriggerProps>();
14
+
15
+ const forwarded = useForwardProps(props);
16
+ </script>
17
+
18
+ <template>
19
+ <DropdownMenuTrigger v-bind="forwarded">
20
+ <slot />
21
+ </DropdownMenuTrigger>
22
+ </template>
@@ -0,0 +1,20 @@
1
+ // The parts a dropdown menu is built from: the root and trigger (thin wrappers, so a consumer
2
+ // never reads the underlying library's documentation), the panel, the action row, the group and
3
+ // its heading, the radio group and row, the tickable row, the hairline between groups, and the
4
+ // three parts of a sub-menu — its own root, the row that opens it and the panel it opens.
5
+ // Families that draw a menu compose them as `../menu`, and a consumer does the same from the
6
+ // package barrel.
7
+ export { default as MenuCheckboxItem } from './MenuCheckboxItem.vue';
8
+ export { default as MenuContent } from './MenuContent.vue';
9
+ export { default as MenuGroup } from './MenuGroup.vue';
10
+ export { default as MenuItem } from './MenuItem.vue';
11
+ export { default as MenuLabel } from './MenuLabel.vue';
12
+ export { default as MenuRadioGroup } from './MenuRadioGroup.vue';
13
+ export { default as MenuRadioItem } from './MenuRadioItem.vue';
14
+ export { default as MenuRoot } from './MenuRoot.vue';
15
+ export { default as MenuSeparator } from './MenuSeparator.vue';
16
+ export { default as MenuSub } from './MenuSub.vue';
17
+ export { default as MenuSubContent } from './MenuSubContent.vue';
18
+ export { default as MenuSubTrigger } from './MenuSubTrigger.vue';
19
+ export { default as MenuTrigger } from './MenuTrigger.vue';
20
+ export { menuItemHintClass, menuLabelClass } from './menuClasses';
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The class strings that make a menu look like this package's menu. The two panels
3
+ * (`MenuContent` and `MenuSubContent`) and the four rows (`MenuItem`, `MenuSubTrigger`,
4
+ * `MenuRadioItem` and `MenuCheckboxItem`) read their own and impose them. Two are exported
5
+ * instead and imposed by nobody — the hint, which a family puts inside its own row content,
6
+ * and the heading, which a family passes to `MenuLabel`'s `class`. Both are a look offered
7
+ * rather than a rule: `MenuLabel` carries no styling of its own on purpose, so a menu whose
8
+ * heading is not a quiet caps line can simply not take this.
9
+ *
10
+ * THE PANEL is `--popover` on a 1px `ring-foreground/10`, which is what `Dialog` and
11
+ * `SelectContent` already draw. In dark the popover is *lighter* than the page in every theme,
12
+ * so every ink figure for a row is taken against the popover, not the page. It carries no
13
+ * enter or leave animation: an opacity animation is read by the contrast walk as a half-faded
14
+ * surface, and reka unmounts the panel on close, so nothing is lost but the fade.
15
+ *
16
+ * `min-w-64` is a default floor for a label-and-hint menu, not a rule: it is in the same
17
+ * `tailwind-merge` group as any `min-w-*` a consumer passes, so a menu of three short numbers
18
+ * says `min-w-24` and gets it.
19
+ *
20
+ * THE HEIGHT CAP is `max-h-(--reka-dropdown-menu-content-available-height)`, and
21
+ * `overflow-y-auto` is worthless without it. reka's `DropdownMenuContent` only *publishes*
22
+ * that variable — floating-ui's `size` middleware writes `--reka-popper-available-height` onto
23
+ * the panel's own inline style and the dropdown aliases it — and applies no height itself, so
24
+ * a panel with no cap grows to its content and runs off the viewport. Collision handling does
25
+ * not cover this: flip and shift move a panel, and neither can make one *shorter* than its
26
+ * rows. The modal menu also locks body scroll, so the overflowing rows are then unreachable by
27
+ * pointer **and** by keyboard. `SelectContent` carries the same pair for the same reason, which
28
+ * is the model this follows.
29
+ *
30
+ * THE ROW. A highlighted row is the focus indicator of a menu (reka moves real focus onto it
31
+ * and marks it `data-highlighted`), so it takes the recipe's *listbox exception*: `ring-2
32
+ * ring-inset ring-ring`, no offset. An outset ring would clip at the panel's edge, and the
33
+ * wash behind it (`--accent` on `--popover`) is only 1.09-1.27 against the panel, which is
34
+ * exactly why the ring is there. The highlighted ink is `--accent-foreground` for the same
35
+ * reason `SelectItem` takes it, and a row's quiet hint switches to it while highlighted
36
+ * (`group/item` + `group-data-highlighted/item:`) because `--muted-foreground` on the wash is
37
+ * 4.34 in kingfisher light, under the 4.5 an 11px hint needs.
38
+ *
39
+ * The row's layout (`justify-between`, `whitespace-nowrap`) is the label-and-hint use, kept
40
+ * apart from the row's look so a tickable row, which wants a tick and no hint, does not take it.
41
+ * A sub-menu's trigger does take it: its chevron sits where a hint would.
42
+ *
43
+ * Disabled is the recipe's `opacity-50`, with `pointer-events-none` so a fade is not the only
44
+ * thing saying no.
45
+ */
46
+ export const menuPanelClass =
47
+ 'bg-popover text-popover-foreground ring-foreground/10 z-50 max-h-(--reka-dropdown-menu-content-available-height) min-w-64 overflow-x-hidden overflow-y-auto rounded-lg p-1 shadow-md ring-1 outline-none';
48
+
49
+ /** The look of any row: shape, ink, the highlighted wash and ring, the disabled fade. */
50
+ export const menuRowClass =
51
+ 'group/item relative flex cursor-default items-center gap-4 rounded-md px-2.5 py-2 text-[12.5px] outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-highlighted:ring-2 data-highlighted:ring-inset data-highlighted:ring-ring data-disabled:pointer-events-none data-disabled:opacity-50';
52
+
53
+ /** An action row's layout: a label and, apart from it, a hint. A consumer class can undo it. */
54
+ export const menuItemLayoutClass = 'justify-between whitespace-nowrap';
55
+
56
+ /** A tickable row's layout, radio or checkbox: the label, with room on the right for the tick. */
57
+ export const menuTickLayoutClass = 'pr-8 whitespace-nowrap';
58
+
59
+ /** The quiet text beside a row's label. */
60
+ export const menuItemHintClass =
61
+ 'text-muted-foreground group-data-highlighted/item:text-accent-foreground text-[11px]';
62
+
63
+ /**
64
+ * The look of a section heading, for a `MenuLabel` inside a `MenuGroup`: a quiet caps line,
65
+ * indented to the rows' own text and tighter under the heading than over it.
66
+ *
67
+ * It is exported because the same seven utilities were written out three times — the sort
68
+ * head's menu and both labelled menus on the family's page, two of them on the page a
69
+ * consumer copies from — and section headings composed from these parts are the next slice's
70
+ * subject, which would have made it four. `menuItemHintClass` is the precedent: a look
71
+ * exported without being imposed.
72
+ */
73
+ export const menuLabelClass =
74
+ 'text-muted-foreground px-2.5 pt-1.5 pb-1 text-[10px] font-bold tracking-[0.1em] uppercase';
@@ -0,0 +1,150 @@
1
+ <script setup lang="ts">
2
+ import { useUiLabels } from '@noix-dev/brix-core';
3
+ import { computed, ref, useAttrs, watch } from 'vue';
4
+ import type { HTMLAttributes } from 'vue';
5
+ import { Combobox } from '../combobox';
6
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../select';
7
+
8
+ /**
9
+ * Two controls that make one value: a type, then an entry of that type. Choosing a type
10
+ * clears the entry and loads the new type's list through `search`.
11
+ *
12
+ * Both halves are keyboard-operable: the type is a `Select` (Tab to it, Enter or ArrowDown to
13
+ * open, arrows and Enter to choose), the entry is a `Combobox` (see its keyboard notes). `id`
14
+ * and `aria-describedby` — what a `FormField` hands its control — land on the type trigger,
15
+ * the first control, which is what the field's label should point at. `class` stays on the
16
+ * outer box.
17
+ */
18
+ defineOptions({ inheritAttrs: false });
19
+
20
+ const props = defineProps<{
21
+ modelValue: { type: string; id: number } | null;
22
+ types: { value: string; label: string }[];
23
+ search: (type: string, q: string) => Promise<{ id: number; label: string }[]>;
24
+ /** Placeholder for the type select. Overrides the label contract's `typePlaceholder`. */
25
+ placeholder?: string;
26
+ /** Placeholder for the entity Combobox, once a type is selected. */
27
+ entityPlaceholder?: string;
28
+ /** Accessible name of the entry combobox, which a `FormField` label cannot also name. */
29
+ entityLabel?: string;
30
+ /** Preloaded label for the current `modelValue`, so the Combobox doesn't render empty until a search runs (e.g. edit-form population). */
31
+ initialOption?: { id: number; label: string };
32
+ }>();
33
+ const emit = defineEmits<{
34
+ (e: 'update:modelValue', value: { type: string; id: number } | null): void;
35
+ }>();
36
+
37
+ const labels = useUiLabels();
38
+ const attrs = useAttrs();
39
+ const rootAttrs = computed(() => ({ class: attrs.class, style: attrs.style }));
40
+ const triggerAttrs = computed(() =>
41
+ Object.fromEntries(Object.entries(attrs).filter(([key]) => key !== 'class' && key !== 'style')),
42
+ );
43
+ /**
44
+ * Two controls make one value, so one invalid field marks both halves. `id` and
45
+ * `aria-describedby` go to the type trigger alone — they name a single control — but a
46
+ * `FormField`'s `aria-invalid` is about the value, and a red edge on the type with a plain
47
+ * edge on the entry beside it reads as "the type is wrong".
48
+ */
49
+ const ariaInvalid = computed(() => attrs['aria-invalid'] as HTMLAttributes['aria-invalid']);
50
+
51
+ const type = ref<string>(props.modelValue?.type ?? '');
52
+ const entityId = ref<number | null>(props.modelValue?.id ?? null);
53
+ const options = ref<{ id: number; label: string }[]>([]);
54
+ const loading = ref(false);
55
+
56
+ // Seeds `options` from `initialOption` so the Combobox's `selectedLabel` lookup
57
+ // resolves without a search. A real search (fetchOptions) still replaces `options`
58
+ // for the active type, and this never overwrites an already-loaded matching option.
59
+ function seedInitialOption(): void {
60
+ if (props.modelValue === null || props.initialOption === undefined) {
61
+ return;
62
+ }
63
+ const { id, label } = props.initialOption;
64
+ if (id !== props.modelValue.id || options.value.some((o) => o.id === id)) {
65
+ return;
66
+ }
67
+ options.value = [{ id, label }];
68
+ }
69
+ seedInitialOption();
70
+
71
+ async function fetchOptions(q: string): Promise<void> {
72
+ if (!type.value) {
73
+ options.value = [];
74
+ return;
75
+ }
76
+ loading.value = true;
77
+ try {
78
+ options.value = await props.search(type.value, q);
79
+ } finally {
80
+ loading.value = false;
81
+ }
82
+ }
83
+
84
+ async function onTypeChange(next: string): Promise<void> {
85
+ type.value = next;
86
+ entityId.value = null;
87
+ emit('update:modelValue', null);
88
+ await fetchOptions('');
89
+ }
90
+
91
+ function onEntityChange(id: number | null): void {
92
+ entityId.value = id;
93
+ emit('update:modelValue', id === null ? null : { type: type.value, id });
94
+ }
95
+
96
+ // Keep in sync if the parent resets the model (e.g. form load). A null model
97
+ // only clears the entity, never the type: `onTypeChange` emits null by design
98
+ // (a type change clears the previous entity), and a parent that binds the
99
+ // model round-trips that null straight back here — resetting `type` on a null
100
+ // model would wipe the type the user just picked before they get to choose
101
+ // an entity for it.
102
+ watch(
103
+ () => props.modelValue,
104
+ (v) => {
105
+ if (v) {
106
+ type.value = v.type;
107
+ entityId.value = v.id;
108
+ } else {
109
+ entityId.value = null;
110
+ }
111
+ seedInitialOption();
112
+ },
113
+ );
114
+
115
+ defineSlots<{
116
+ /** The glyph on the entry's clear button. Defaults to the package's own cross. */
117
+ 'clear-icon'?: () => unknown;
118
+ }>();
119
+ </script>
120
+
121
+ <template>
122
+ <div v-bind="rootAttrs" class="flex gap-2">
123
+ <Select :model-value="type" @update:model-value="(v) => onTypeChange(v as string)">
124
+ <SelectTrigger v-bind="triggerAttrs" class="w-44" data-testid="morph-type"
125
+ ><SelectValue :placeholder="placeholder ?? labels.typePlaceholder"
126
+ /></SelectTrigger>
127
+ <SelectContent>
128
+ <SelectItem v-for="t in types" :key="t.value" :value="t.value">{{
129
+ t.label
130
+ }}</SelectItem>
131
+ </SelectContent>
132
+ </Select>
133
+ <div class="flex-1">
134
+ <Combobox
135
+ :model-value="entityId"
136
+ :options="options"
137
+ :loading="loading"
138
+ :placeholder="entityPlaceholder ?? labels.entryPlaceholder"
139
+ :aria-label="entityLabel ?? labels.entryLabel"
140
+ :aria-invalid="ariaInvalid"
141
+ @update:model-value="onEntityChange"
142
+ @search="fetchOptions"
143
+ >
144
+ <template v-if="$slots['clear-icon']" #clear-icon
145
+ ><slot name="clear-icon"
146
+ /></template>
147
+ </Combobox>
148
+ </div>
149
+ </div>
150
+ </template>
@@ -0,0 +1 @@
1
+ export { default as MorphSelect } from './MorphSelect.vue';