@sewadah/selaras 0.3.0 → 0.3.2

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 (172) hide show
  1. package/README.md +4 -1
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +21 -6
  4. package/dist/runtime/components/AlertDialog.d.vue.ts +5 -3
  5. package/dist/runtime/components/AlertDialog.vue +17 -9
  6. package/dist/runtime/components/AlertDialog.vue.d.ts +5 -3
  7. package/dist/runtime/components/App.vue +2 -0
  8. package/dist/runtime/components/Autocomplete.d.vue.ts +2 -2
  9. package/dist/runtime/components/Autocomplete.vue +4 -2
  10. package/dist/runtime/components/Autocomplete.vue.d.ts +2 -2
  11. package/dist/runtime/components/Button.d.vue.ts +7 -5
  12. package/dist/runtime/components/Button.vue +14 -3
  13. package/dist/runtime/components/Button.vue.d.ts +7 -5
  14. package/dist/runtime/components/Calendar.d.vue.ts +69 -0
  15. package/dist/runtime/components/Calendar.vue +163 -0
  16. package/dist/runtime/components/Calendar.vue.d.ts +69 -0
  17. package/dist/runtime/components/Callout.vue +12 -1
  18. package/dist/runtime/components/CodeGroup.vue +13 -3
  19. package/dist/runtime/components/CodeTree.d.vue.ts +2 -0
  20. package/dist/runtime/components/CodeTree.vue +52 -1
  21. package/dist/runtime/components/CodeTree.vue.d.ts +2 -0
  22. package/dist/runtime/components/ColorModeSwitch.d.vue.ts +18 -0
  23. package/dist/runtime/components/ColorModeSwitch.vue +59 -0
  24. package/dist/runtime/components/ColorModeSwitch.vue.d.ts +18 -0
  25. package/dist/runtime/components/ColorPicker.d.vue.ts +8 -0
  26. package/dist/runtime/components/ColorPicker.vue +66 -45
  27. package/dist/runtime/components/ColorPicker.vue.d.ts +8 -0
  28. package/dist/runtime/components/Column.js +1 -1
  29. package/dist/runtime/components/CommandPalette.d.vue.ts +3 -1
  30. package/dist/runtime/components/CommandPalette.vue +5 -0
  31. package/dist/runtime/components/CommandPalette.vue.d.ts +3 -1
  32. package/dist/runtime/components/ConfirmRenderer.d.vue.ts +3 -0
  33. package/dist/runtime/components/ConfirmRenderer.vue +39 -0
  34. package/dist/runtime/components/ConfirmRenderer.vue.d.ts +3 -0
  35. package/dist/runtime/components/ContentNavigation.d.vue.ts +8 -1
  36. package/dist/runtime/components/ContentNavigation.vue +9 -2
  37. package/dist/runtime/components/ContentNavigation.vue.d.ts +8 -1
  38. package/dist/runtime/components/ContextMenu.d.vue.ts +8 -1
  39. package/dist/runtime/components/ContextMenu.vue +20 -6
  40. package/dist/runtime/components/ContextMenu.vue.d.ts +8 -1
  41. package/dist/runtime/components/DatePicker.d.vue.ts +10 -3
  42. package/dist/runtime/components/DatePicker.vue +24 -16
  43. package/dist/runtime/components/DatePicker.vue.d.ts +10 -3
  44. package/dist/runtime/components/Drawer.vue +3 -2
  45. package/dist/runtime/components/Dropdown.d.vue.ts +33 -6
  46. package/dist/runtime/components/Dropdown.vue +146 -12
  47. package/dist/runtime/components/Dropdown.vue.d.ts +33 -6
  48. package/dist/runtime/components/FileTree.d.vue.ts +2 -0
  49. package/dist/runtime/components/FileTree.vue +8 -4
  50. package/dist/runtime/components/FileTree.vue.d.ts +2 -0
  51. package/dist/runtime/components/FormField.d.vue.ts +4 -0
  52. package/dist/runtime/components/FormField.vue +19 -4
  53. package/dist/runtime/components/FormField.vue.d.ts +4 -0
  54. package/dist/runtime/components/Input.vue +3 -2
  55. package/dist/runtime/components/Kbd.vue +12 -2
  56. package/dist/runtime/components/Modal.vue +3 -2
  57. package/dist/runtime/components/NavigationMenu.d.vue.ts +10 -10
  58. package/dist/runtime/components/NavigationMenu.vue +13 -9
  59. package/dist/runtime/components/NavigationMenu.vue.d.ts +10 -10
  60. package/dist/runtime/components/NavigationMenuAccordionItem.vue +5 -1
  61. package/dist/runtime/components/NavigationMenuFlyoutList.vue +7 -4
  62. package/dist/runtime/components/Popover.d.vue.ts +8 -2
  63. package/dist/runtime/components/Popover.vue +13 -6
  64. package/dist/runtime/components/Popover.vue.d.ts +8 -2
  65. package/dist/runtime/components/ProsePre.d.vue.ts +2 -0
  66. package/dist/runtime/components/ProsePre.vue +2 -1
  67. package/dist/runtime/components/ProsePre.vue.d.ts +2 -0
  68. package/dist/runtime/components/Select.d.vue.ts +8 -4
  69. package/dist/runtime/components/Select.vue +4 -2
  70. package/dist/runtime/components/Select.vue.d.ts +8 -4
  71. package/dist/runtime/components/Slideover.vue +3 -2
  72. package/dist/runtime/components/SplitterPanel.d.vue.ts +2 -2
  73. package/dist/runtime/components/SplitterPanel.vue.d.ts +2 -2
  74. package/dist/runtime/components/Table.vue +95 -26
  75. package/dist/runtime/components/Tabs.d.vue.ts +44 -4
  76. package/dist/runtime/components/Tabs.vue +171 -18
  77. package/dist/runtime/components/Tabs.vue.d.ts +44 -4
  78. package/dist/runtime/components/Textarea.vue +3 -2
  79. package/dist/runtime/components/Timeline.d.vue.ts +19 -0
  80. package/dist/runtime/components/Timeline.vue +99 -0
  81. package/dist/runtime/components/Timeline.vue.d.ts +19 -0
  82. package/dist/runtime/components/Toast.d.vue.ts +10 -1
  83. package/dist/runtime/components/Toast.vue +94 -8
  84. package/dist/runtime/components/Toast.vue.d.ts +10 -1
  85. package/dist/runtime/components/Tooltip.d.vue.ts +8 -2
  86. package/dist/runtime/components/Tooltip.vue +13 -6
  87. package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
  88. package/dist/runtime/composables/use-confirm.d.ts +14 -0
  89. package/dist/runtime/composables/use-confirm.js +28 -0
  90. package/dist/runtime/composables/use-form-field.d.ts +1 -0
  91. package/dist/runtime/composables/use-table.d.ts +3 -0
  92. package/dist/runtime/composables/use-table.js +10 -4
  93. package/dist/runtime/composables/use-toast.js +5 -1
  94. package/dist/runtime/directives/hotkey.d.ts +13 -0
  95. package/dist/runtime/directives/hotkey.js +107 -0
  96. package/dist/runtime/directives/index.d.ts +2 -0
  97. package/dist/runtime/directives/index.js +2 -0
  98. package/dist/runtime/directives/mask.d.ts +30 -0
  99. package/dist/runtime/directives/mask.js +165 -0
  100. package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +41 -36
  101. package/dist/runtime/internal/ComboboxSelectBase.vue +119 -26
  102. package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +41 -36
  103. package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +23 -17
  104. package/dist/runtime/internal/ComboboxSelectBody.vue +50 -11
  105. package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +23 -17
  106. package/dist/runtime/internal/DatePickerCalendarBody.vue +1 -1
  107. package/dist/runtime/internal/DatePickerRangeCalendarBody.vue +1 -1
  108. package/dist/runtime/internal/ShortcutHint.d.vue.ts +6 -0
  109. package/dist/runtime/internal/ShortcutHint.vue +13 -0
  110. package/dist/runtime/internal/ShortcutHint.vue.d.ts +6 -0
  111. package/dist/runtime/internal/ToastItemRenderer.d.vue.ts +9 -1
  112. package/dist/runtime/internal/ToastItemRenderer.vue +55 -8
  113. package/dist/runtime/internal/ToastItemRenderer.vue.d.ts +9 -1
  114. package/dist/runtime/internal/combobox-select.d.ts +19 -18
  115. package/dist/runtime/internal/combobox-select.js +38 -15
  116. package/dist/runtime/internal/programmatic-services.d.ts +13 -0
  117. package/dist/runtime/internal/programmatic-services.js +9 -0
  118. package/dist/runtime/internal/toast-stack.d.ts +36 -0
  119. package/dist/runtime/internal/toast-stack.js +36 -0
  120. package/dist/runtime/structural.css +1 -1
  121. package/dist/runtime/table.d.ts +1 -1
  122. package/dist/runtime/theme/alert-dialog.js +1 -1
  123. package/dist/runtime/theme/badge.d.ts +9 -0
  124. package/dist/runtime/theme/badge.js +2 -1
  125. package/dist/runtime/theme/button.d.ts +18 -0
  126. package/dist/runtime/theme/button.js +4 -1
  127. package/dist/runtime/theme/calendar.d.ts +86 -0
  128. package/dist/runtime/theme/calendar.js +19 -0
  129. package/dist/runtime/theme/callout.d.ts +0 -12
  130. package/dist/runtime/theme/callout.js +8 -8
  131. package/dist/runtime/theme/code-tree.js +1 -1
  132. package/dist/runtime/theme/command-palette.js +1 -1
  133. package/dist/runtime/theme/content-navigation.d.ts +3 -0
  134. package/dist/runtime/theme/content-navigation.js +1 -0
  135. package/dist/runtime/theme/drawer.js +1 -1
  136. package/dist/runtime/theme/dropdown.d.ts +21 -0
  137. package/dist/runtime/theme/dropdown.js +15 -2
  138. package/dist/runtime/theme/file-tree.js +1 -1
  139. package/dist/runtime/theme/form-field.d.ts +18 -0
  140. package/dist/runtime/theme/form-field.js +6 -1
  141. package/dist/runtime/theme/modal.js +1 -1
  142. package/dist/runtime/theme/slideover.js +1 -1
  143. package/dist/runtime/theme/table.d.ts +27 -0
  144. package/dist/runtime/theme/table.js +11 -2
  145. package/dist/runtime/theme/tabs.d.ts +87 -3
  146. package/dist/runtime/theme/tabs.js +46 -22
  147. package/dist/runtime/theme/timeline.d.ts +251 -0
  148. package/dist/runtime/theme/timeline.js +84 -0
  149. package/dist/runtime/theme/toast.d.ts +92 -0
  150. package/dist/runtime/theme/toast.js +29 -7
  151. package/dist/runtime/theme-config.d.ts +13 -2
  152. package/dist/runtime/types/index.d.ts +10 -2
  153. package/dist/runtime/utils/arrow.d.ts +21 -0
  154. package/dist/runtime/utils/arrow.js +10 -0
  155. package/dist/runtime/utils/autocomplete-contracts.d.ts +4 -4
  156. package/dist/runtime/utils/file-icons.js +3 -0
  157. package/dist/runtime/utils/icons.d.ts +2 -0
  158. package/dist/runtime/utils/icons.js +2 -0
  159. package/dist/runtime/utils/messages.d.ts +7 -0
  160. package/dist/runtime/utils/messages.js +7 -0
  161. package/dist/runtime/utils/navigation-menu.d.ts +7 -0
  162. package/dist/runtime/utils/navigation-menu.js +3 -0
  163. package/dist/runtime/utils/overlay.d.ts +17 -0
  164. package/dist/runtime/utils/overlay.js +7 -0
  165. package/dist/runtime/utils/select-contracts.d.ts +25 -11
  166. package/dist/runtime/utils/table-columns.js +1 -1
  167. package/dist/runtime/utils/table-contracts.d.ts +9 -1
  168. package/dist/runtime/utils/timeline-contracts.d.ts +42 -0
  169. package/dist/runtime/utils/timeline-contracts.js +0 -0
  170. package/dist/runtime/utils/ui.d.ts +11 -0
  171. package/dist/runtime/utils/ui.js +54 -1
  172. package/package.json +6 -5
@@ -106,6 +106,9 @@ export const defaultFileIcons = {
106
106
  "git": "vscode-icons:file-type-git",
107
107
  "gitignore": "vscode-icons:file-type-git",
108
108
  "npm": "vscode-icons:file-type-npm",
109
+ "pnpm": "vscode-icons:file-type-pnpm",
110
+ "yarn": "vscode-icons:file-type-yarn",
111
+ "bun": "vscode-icons:file-type-bun",
109
112
  "nuxt": "vscode-icons:file-type-nuxt",
110
113
  "ansible": "vscode-icons:file-type-ansible",
111
114
  "bicep": "vscode-icons:file-type-bicep"
@@ -10,8 +10,10 @@ export interface IconRegistry {
10
10
  chevronsRight: string;
11
11
  loading: string;
12
12
  search: string;
13
+ sortUnsorted: string;
13
14
  sortAscending: string;
14
15
  sortDescending: string;
16
+ filter: string;
15
17
  columns: string;
16
18
  copy: string;
17
19
  lightMode: string;
@@ -16,10 +16,12 @@ export const defaultIcons = {
16
16
  chevronsRight: "hugeicons:next",
17
17
  loading: "hugeicons:loading-02",
18
18
  search: "hugeicons:search-01",
19
+ sortUnsorted: "hugeicons:sorting-05",
19
20
  // "arrow-*-02" (shaft + arrowhead) - kept visually distinct from the
20
21
  // plain chevrons above, matching the original caret-vs-arrow split.
21
22
  sortAscending: "hugeicons:arrow-up-02",
22
23
  sortDescending: "hugeicons:arrow-down-02",
24
+ filter: "hugeicons:filter",
23
25
  columns: "hugeicons:table-columns-split",
24
26
  copy: "hugeicons:copy",
25
27
  lightMode: "hugeicons:sun-01",
@@ -3,6 +3,7 @@ export interface MessageRegistry {
3
3
  clear: string;
4
4
  close: string;
5
5
  cancel: string;
6
+ confirmation: string;
6
7
  continue: string;
7
8
  colorModeToggle: string;
8
9
  colorPicker: string;
@@ -11,11 +12,14 @@ export interface MessageRegistry {
11
12
  searchDescription: string;
12
13
  columns: string;
13
14
  filterPlaceholder: string;
15
+ filterColumn: (column: string) => string;
14
16
  previous: string;
15
17
  next: string;
16
18
  first: string;
17
19
  last: string;
18
20
  pagination: string;
21
+ scrollTabsLeft: string;
22
+ scrollTabsRight: string;
19
23
  datePicker: string;
20
24
  datePickerDescription: string;
21
25
  dateRangePicker: string;
@@ -39,6 +43,7 @@ export interface MessageRegistry {
39
43
  decrement: string;
40
44
  noOptions: string;
41
45
  noResultsFound: string;
46
+ createOption: (value: string) => string;
42
47
  noData: string;
43
48
  expandRow: string;
44
49
  collapseRow: string;
@@ -62,6 +67,8 @@ export interface MessageRegistry {
62
67
  showHiddenBreadcrumbItems: string;
63
68
  commandPalette: string;
64
69
  commandPaletteDescription: string;
70
+ dropdownMenu: string;
71
+ dropdownMenuDescription: string;
65
72
  navigate: string;
66
73
  select: string;
67
74
  onThisPage: string;
@@ -3,6 +3,7 @@ export const defaultMessages = {
3
3
  clear: "Clear",
4
4
  close: "Close",
5
5
  cancel: "Cancel",
6
+ confirmation: "Confirm action",
6
7
  continue: "Continue",
7
8
  colorModeToggle: "Toggle color mode",
8
9
  colorPicker: "Color picker",
@@ -11,11 +12,14 @@ export const defaultMessages = {
11
12
  searchDescription: "Type to filter, then use arrow keys and enter to select",
12
13
  columns: "Columns",
13
14
  filterPlaceholder: "Filter...",
15
+ filterColumn: (column) => `Filter ${column}`,
14
16
  previous: "Previous",
15
17
  next: "Next",
16
18
  first: "First",
17
19
  last: "Last",
18
20
  pagination: "Pagination",
21
+ scrollTabsLeft: "Scroll tabs left",
22
+ scrollTabsRight: "Scroll tabs right",
19
23
  datePicker: "Date picker",
20
24
  datePickerDescription: "Use arrow keys to navigate days, enter to select",
21
25
  dateRangePicker: "Date range picker",
@@ -39,6 +43,7 @@ export const defaultMessages = {
39
43
  decrement: "Decrement",
40
44
  noOptions: "No options",
41
45
  noResultsFound: "No results found",
46
+ createOption: (value) => `Create "${value}"`,
42
47
  noData: "No data",
43
48
  expandRow: "Expand row",
44
49
  collapseRow: "Collapse row",
@@ -61,6 +66,8 @@ export const defaultMessages = {
61
66
  showHiddenBreadcrumbItems: "Show hidden breadcrumb items",
62
67
  commandPalette: "Command palette",
63
68
  commandPaletteDescription: "Search for a command and press enter",
69
+ dropdownMenu: "Actions",
70
+ dropdownMenuDescription: "Choose an action",
64
71
  navigate: "Navigate",
65
72
  select: "Select",
66
73
  onThisPage: "On this page",
@@ -1,3 +1,4 @@
1
+ import type { HotkeyOptions } from '../directives/hotkey.js';
1
2
  export interface NavigationMenuItem {
2
3
  label: string;
3
4
  icon?: string;
@@ -11,6 +12,10 @@ export interface NavigationMenuItem {
11
12
  /** One level for horizontal (Reka's own real limit for its shared-viewport flyout); arbitrary depth for vertical, which falls back to a recursive accordion instead. */
12
13
  children?: NavigationMenuItem[];
13
14
  onSelect?: (event: Event) => void;
15
+ /** Display a keyboard shortcut hint beside this item's label. */
16
+ shortcut?: string;
17
+ /** Bind `shortcut` page-wide, so the key activates this item from anywhere except while typing in a field. */
18
+ hotkey?: boolean;
14
19
  /** Targets this item's own named slots (`#{slot}`, `#{slot}-leading`, `#{slot}-label`, `#{slot}-trailing`, `#{slot}-content`) ahead of the generic `#item`/`#item-leading`/etc, when the named one is actually provided. */
15
20
  slot?: string;
16
21
  /**
@@ -33,3 +38,5 @@ export interface NavigationMenuItem {
33
38
  description?: string;
34
39
  }
35
40
  export declare function isNavigationMenuItemActive(item: NavigationMenuItem, currentPath: string): boolean;
41
+ /** The v-hotkey binding for an item that opts in with `hotkey: true`. */
42
+ export declare function navigationMenuHotkey(item: NavigationMenuItem): HotkeyOptions | undefined;
@@ -3,3 +3,6 @@ export function isNavigationMenuItemActive(item, currentPath) {
3
3
  return item.active;
4
4
  return item.to !== void 0 && item.to === currentPath;
5
5
  }
6
+ export function navigationMenuHotkey(item) {
7
+ return item.hotkey && item.shortcut && !item.disabled ? { keys: item.shortcut } : void 0;
8
+ }
@@ -0,0 +1,17 @@
1
+ import type { ContextMenuContentProps, PopoverContentProps } from 'reka-ui';
2
+ /** Positioning options shared by Selaras's anchored panels. Visual styling stays in `ui.content`. */
3
+ export type OverlayPositioning = Pick<PopoverContentProps, 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'avoidCollisions' | 'collisionBoundary' | 'collisionPadding' | 'arrowPadding' | 'sticky' | 'hideWhenDetached' | 'positionStrategy'>;
4
+ /** A context menu is anchored to the pointer, so it does not accept side or alignment. */
5
+ export type ContextMenuPositioning = Pick<ContextMenuContentProps, 'alignOffset' | 'avoidCollisions' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'hideWhenDetached' | 'positionStrategy'>;
6
+ /** `false` renders inline; a selector or element chooses a teleport target. */
7
+ export type OverlayPortal = boolean | string | HTMLElement;
8
+ export declare function overlayPortalProps(portal: OverlayPortal | undefined): {
9
+ disabled: boolean;
10
+ to?: undefined;
11
+ } | {
12
+ to: string | HTMLElement;
13
+ disabled?: undefined;
14
+ } | {
15
+ disabled?: undefined;
16
+ to?: undefined;
17
+ };
@@ -0,0 +1,7 @@
1
+ export function overlayPortalProps(portal) {
2
+ if (portal === false)
3
+ return { disabled: true };
4
+ if (typeof portal === "string" || typeof HTMLElement !== "undefined" && portal instanceof HTMLElement)
5
+ return { to: portal };
6
+ return {};
7
+ }
@@ -1,21 +1,29 @@
1
1
  import type { VariantProps } from 'tailwind-variants';
2
2
  import type { selectTheme, SelectThemeSlots } from '../theme/select.js';
3
+ import type { RoundedArrowConfig } from './arrow.js';
3
4
  import type { ColorRole } from './color-registry.js';
5
+ import type { OverlayPortal, OverlayPositioning } from './overlay.js';
4
6
  import type { UiProp } from './ui.js';
5
7
  export type SelectValue = string | number;
6
- export interface SelectGroup<Item extends object> {
8
+ export type SelectModelValue = SelectValue | object;
9
+ export type SelectEntry = SelectValue | object;
10
+ export interface SelectGroup<Item extends SelectEntry> {
7
11
  label: string;
8
12
  items: readonly Item[];
9
13
  }
10
14
  /** Infer options from the entry array before unwrapping one group level. */
11
15
  export type SelectEntryItem<Entry> = Entry extends SelectGroup<infer Item> ? Item : Entry;
12
- export type SelectEntryGroup<Entry> = Extract<Entry, SelectGroup<object>>;
13
- export type SelectIdentityKeys<Item> = {
14
- [Key in keyof Item]-?: Item[Key] extends SelectValue ? Key : never;
15
- }[keyof Item] & string;
16
- export type SelectIdentity<Entry, Key extends string> = SelectEntryItem<Entry>[Key & keyof SelectEntryItem<Entry>] & SelectValue;
16
+ export type SelectEntryGroup<Entry> = Extract<Entry, SelectGroup<SelectEntry>>;
17
+ export type SelectIdentityKeys<Item> = [Item] extends [object] ? {
18
+ [Key in keyof Item]-?: Item[Key] extends SelectModelValue ? Key : never;
19
+ }[keyof Item] & string : never;
20
+ type DefaultObjectIdentity<Item extends object> = 'value' extends keyof Item ? Item extends {
21
+ value: infer Value;
22
+ } ? Value : NonNullable<Item['value' & keyof Item]> | Item : Item;
23
+ type ItemIdentity<Item, Key extends string> = Item extends SelectValue ? Item : Key extends 'value' ? Item extends object ? DefaultObjectIdentity<Item> : never : Key extends keyof Item ? Item[Key] : never;
24
+ export type SelectIdentity<Entry, Key extends string = 'value'> = ItemIdentity<SelectEntryItem<Entry>, Key>;
17
25
  export type SelectModel<Value, Multiple extends boolean> = Multiple extends true ? Value[] : Value | undefined;
18
- type ValidEntry<Entry, Key extends string> = Entry extends SelectGroup<infer Item> ? SelectGroup<Item & Record<Key, SelectValue>> : Entry & Record<Key, SelectValue>;
26
+ type ValidEntry<Entry, Key extends string> = Entry extends SelectGroup<infer Item> ? SelectGroup<Item extends SelectValue ? Item : Key extends 'value' ? Item : Item & Record<Key, SelectModelValue>> : Entry extends SelectValue ? Entry : Key extends 'value' ? Entry : Entry & Record<Key, SelectModelValue>;
19
27
  export interface SelectResolvedOption<Entry, Key extends string = 'value'> {
20
28
  value: SelectIdentity<Entry, Key>;
21
29
  label: string;
@@ -23,7 +31,7 @@ export interface SelectResolvedOption<Entry, Key extends string = 'value'> {
23
31
  /** Undefined while a selected identity is absent from the current options. */
24
32
  raw: SelectEntryItem<Entry> | undefined;
25
33
  }
26
- export interface SelectProps<Entry extends object = {
34
+ export interface SelectProps<Entry extends SelectEntry = {
27
35
  value: SelectValue;
28
36
  label?: string;
29
37
  disabled?: boolean;
@@ -33,7 +41,9 @@ export interface SelectProps<Entry extends object = {
33
41
  /** ID of an associated form outside the component's ancestors. */
34
42
  form?: string;
35
43
  items: readonly Entry[] & NoInfer<readonly ValidEntry<Entry, Key>[]>;
44
+ /** Uses an option's `value` field by default, or the whole object if absent. */
36
45
  valueKey?: Key & SelectIdentityKeys<SelectEntryItem<Entry>>;
46
+ /** Object field used for display; defaults to `label`. */
37
47
  labelKey?: keyof SelectEntryItem<Entry> & string;
38
48
  open?: boolean;
39
49
  /** Initial uncontrolled open state. */
@@ -62,7 +72,11 @@ export interface SelectProps<Entry extends object = {
62
72
  searchTerm?: string;
63
73
  resetSearchTermOnBlur?: boolean;
64
74
  resetSearchTermOnSelect?: boolean;
65
- arrow?: boolean;
75
+ arrow?: boolean | RoundedArrowConfig;
76
+ /** Positioning of the anchored list (the adaptive Select modal uses its own layout). */
77
+ positioning?: OverlayPositioning;
78
+ /** Teleport target for the anchored list, or `false` to render it inline. */
79
+ portal?: OverlayPortal;
66
80
  /**
67
81
  * Opts into the control's accessible small-screen presentation. Select uses
68
82
  * a centered modal; Autocomplete keeps its editable combobox in a wider
@@ -72,14 +86,14 @@ export interface SelectProps<Entry extends object = {
72
86
  adaptive?: boolean;
73
87
  ui?: UiProp<SelectThemeSlots>;
74
88
  }
75
- export interface SelectEmits<Entry extends object = {
89
+ export interface SelectEmits<Entry extends SelectEntry = {
76
90
  value: SelectValue;
77
91
  }, Key extends string = 'value', Multiple extends boolean = false> {
78
92
  'update:open': [value: boolean];
79
93
  'update:modelValue': [value: SelectModel<SelectIdentity<Entry, Key>, Multiple>];
80
94
  'update:searchTerm': [value: string];
81
95
  }
82
- export interface SelectSlots<Entry extends object, Key extends string = 'value'> {
96
+ export interface SelectSlots<Entry extends SelectEntry, Key extends string = 'value'> {
83
97
  'item'?: (props: {
84
98
  item: SelectEntryItem<Entry>;
85
99
  }) => any;
@@ -54,7 +54,7 @@ export function convertChildrenToColumns(vnodes) {
54
54
  accessorKey: props.field,
55
55
  header: buildHeaderOrFooter(slots.header, props.header ?? props.field),
56
56
  footer: buildHeaderOrFooter(slots.footer, props.footer),
57
- enableSorting: toBooleanProp(props.sortable, true),
57
+ enableSorting: toBooleanProp(props.sortable, false),
58
58
  sortFn: "alphanumeric",
59
59
  enableColumnFilter: toBooleanProp(props.filterable, false),
60
60
  filterFn: "includesString",
@@ -1,5 +1,5 @@
1
1
  import type { RowData } from '@tanstack/vue-table';
2
- import type { TableColumnDef, TableColumnVisibilityState, TableExpandedState, TableGetRowId, TableRowSelectionState, TableSortingState } from '../composables/use-table.js';
2
+ import type { TableColumnDef, TableColumnVisibilityState, TableExpandedState, TableGetRowId, TableGetSubRows, TableRowSelectionState, TableSortingState } from '../composables/use-table.js';
3
3
  import type { TableThemeSlots } from '../theme/table.js';
4
4
  import type { ColorRole } from './color-registry.js';
5
5
  import type { UiProp } from './ui.js';
@@ -7,6 +7,10 @@ export interface TableProps<TData extends RowData = RowData> {
7
7
  data: TData[];
8
8
  columns?: TableColumnDef<TData>[];
9
9
  selectable?: boolean;
10
+ /** Highlights body rows on hover. @default false */
11
+ rowHover?: boolean;
12
+ /** Toggles selection when a selectable body row is clicked. Interactive controls inside cells are ignored. @default false */
13
+ selectOnRowClick?: boolean;
10
14
  pageSize?: number;
11
15
  loading?: boolean;
12
16
  sorting?: TableSortingState;
@@ -20,6 +24,10 @@ export interface TableProps<TData extends RowData = RowData> {
20
24
  gridlines?: boolean;
21
25
  striped?: boolean;
22
26
  expandable?: boolean;
27
+ /** Displays hierarchical rows from `subRows` by default. Set `getSubRows` to read children from another field. @default false */
28
+ tree?: boolean;
29
+ /** Returns a row's child rows when `tree` is enabled. Defaults to `row.subRows`. */
30
+ getSubRows?: TableGetSubRows<TData>;
23
31
  expanded?: TableExpandedState;
24
32
  columnVisibility?: TableColumnVisibilityState;
25
33
  columnToggle?: boolean;
@@ -0,0 +1,42 @@
1
+ import type { TimelineThemeSlots } from '../theme/timeline.js';
2
+ import type { ColorRole } from './color-registry.js';
3
+ import type { UiProp } from './ui.js';
4
+ export interface TimelineItem {
5
+ id?: string | number;
6
+ class?: string;
7
+ date?: string;
8
+ /** ISO-8601 value for the semantic `<time datetime>` attribute. */
9
+ datetime?: string;
10
+ title?: string;
11
+ description?: string;
12
+ icon?: string;
13
+ color?: ColorRole;
14
+ /** Selects a named slot for this item, replacing its default content. */
15
+ slot?: string;
16
+ /** Per-item styling overrides, resolved against the component's theme. */
17
+ ui?: UiProp<TimelineThemeSlots>;
18
+ /** Additional application data is passed unchanged to scoped slots. */
19
+ [key: string]: unknown;
20
+ }
21
+ export interface TimelineProps<TItem extends TimelineItem = TimelineItem> {
22
+ items: TItem[];
23
+ orientation?: 'vertical' | 'horizontal';
24
+ align?: 'start' | 'end' | 'alternate';
25
+ size?: 'sm' | 'md' | 'lg';
26
+ color?: ColorRole;
27
+ ui?: UiProp<TimelineThemeSlots>;
28
+ }
29
+ export interface TimelineSlotProps<TItem extends TimelineItem = TimelineItem> {
30
+ item: TItem;
31
+ index: number;
32
+ }
33
+ export interface TimelineSlots<TItem extends TimelineItem = TimelineItem> {
34
+ marker?: (props: TimelineSlotProps<TItem>) => any;
35
+ connector?: (props: TimelineSlotProps<TItem>) => any;
36
+ date?: (props: TimelineSlotProps<TItem>) => any;
37
+ title?: (props: TimelineSlotProps<TItem>) => any;
38
+ description?: (props: TimelineSlotProps<TItem>) => any;
39
+ content?: (props: TimelineSlotProps<TItem>) => any;
40
+ item?: (props: TimelineSlotProps<TItem>) => any;
41
+ [name: string]: ((props: TimelineSlotProps<TItem>) => any) | undefined;
42
+ }
File without changes
@@ -107,6 +107,10 @@ export declare function useRootProps<T extends AnySlotFn>(slotFn: () => T, overr
107
107
  }): ComputedRef<{
108
108
  [x: string]: unknown;
109
109
  }>;
110
+ /** Routes fallthrough attrs to a chosen non-root target without theme bindings. */
111
+ export declare function useFallthroughProps(override?: () => UiSlotValue | undefined): ComputedRef<{
112
+ [x: string]: unknown;
113
+ }>;
110
114
  /**
111
115
  * Returns fallthrough attributes selected for a component's real interactive
112
116
  * element. Wrapped controls use this alongside useRootProps: layout and
@@ -124,6 +128,13 @@ export declare function useFallthroughAttrs(select: (key: string) => boolean): C
124
128
  * to the base theme untouched when neither exists.
125
129
  */
126
130
  export declare function useComponentTheme<T extends (...args: any[]) => any>(key: string, base: T): ComputedRef<T>;
131
+ /**
132
+ * Tailwind Variants drops the classes for an axis when its supplied value is
133
+ * unknown. Keep malformed runtime props usable by resolving them to the
134
+ * active theme's own default, and report the mistake once in development.
135
+ * Theme-configured variant values and compound-variant values stay valid.
136
+ */
137
+ export declare function withVariantFallback<T extends (...args: any[]) => any>(theme: T, key: string): T;
127
138
  /**
128
139
  * The nearest (chain-merged) STheme `defaults.<key>` override, if any - a
129
140
  * component reads this as its own prop's fallback, one level below its
@@ -53,6 +53,13 @@ export function useRootProps(slotFn, override, options) {
53
53
  resolveSlot(slotFn(), withFallthroughClass(options?.includeClass === false ? void 0 : fallthroughClass.value, override()))
54
54
  ));
55
55
  }
56
+ export function useFallthroughProps(override) {
57
+ const { fallthroughClass, attrsWithoutClass } = useRootFallthrough();
58
+ return computed(() => mergeProps(
59
+ attrsWithoutClass.value,
60
+ resolveSlot((options) => options?.class ?? "", withFallthroughClass(fallthroughClass.value, override?.()))
61
+ ));
62
+ }
56
63
  export function useFallthroughAttrs(select) {
57
64
  const attrs = useAttrs();
58
65
  return computed(() => Object.fromEntries(
@@ -78,7 +85,53 @@ export function useComponentTheme(key, base) {
78
85
  result = tv({ extend: result, ...globalOverride });
79
86
  for (const override of collectThemeChain(themeContext?.value, (c) => c.ui, key))
80
87
  result = tv({ extend: result, ...override });
81
- return result;
88
+ return withVariantFallback(result, key);
89
+ });
90
+ }
91
+ const warnedThemeValues = /* @__PURE__ */ new Set();
92
+ export function withVariantFallback(theme, key) {
93
+ return new Proxy(theme, {
94
+ apply(target, thisArg, args) {
95
+ const supplied = args[0];
96
+ if (!supplied || typeof supplied !== "object")
97
+ return Reflect.apply(target, thisArg, args);
98
+ let resolved;
99
+ for (const axis of ["variant", "size"]) {
100
+ const value = supplied[axis];
101
+ if (value === void 0)
102
+ continue;
103
+ const values = target.variants?.[axis];
104
+ if (!values)
105
+ continue;
106
+ const accepted = new Set(Object.keys(values));
107
+ for (const compound of target.compoundVariants ?? []) {
108
+ const condition = compound[axis];
109
+ if (Array.isArray(condition)) {
110
+ for (const entry of condition)
111
+ accepted.add(String(entry));
112
+ } else if (condition !== void 0) {
113
+ accepted.add(String(condition));
114
+ }
115
+ }
116
+ if (accepted.has(String(value)))
117
+ continue;
118
+ const defaults = target.defaultVariants;
119
+ const fallback = defaults?.[axis];
120
+ resolved ??= { ...supplied };
121
+ resolved[axis] = fallback;
122
+ if (import.meta.dev) {
123
+ const signature = `${key}:${axis}:${String(value)}`;
124
+ if (!warnedThemeValues.has(signature)) {
125
+ warnedThemeValues.add(signature);
126
+ const component = `${key[0]?.toUpperCase() ?? ""}${key.slice(1)}`;
127
+ const values2 = [...accepted].join(", ");
128
+ const fallbackMessage = fallback === void 0 ? "the default styling" : `"${String(fallback)}"`;
129
+ console.warn(`[Selaras ${component}] Unknown ${axis} "${String(value)}"; using ${fallbackMessage}. Valid values: ${values2}.`);
130
+ }
131
+ }
132
+ }
133
+ return Reflect.apply(target, thisArg, resolved ? [resolved, ...args.slice(1)] : args);
134
+ }
82
135
  });
83
136
  }
84
137
  export function useThemeProps(key) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sewadah/selaras",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
5
5
  "description": "A UI component library for Nuxt, built on Reka UI and Tailwind v4",
6
6
  "author": "Wicaksana Pratama <wicaksanapratama@gmail.com>",
7
7
  "license": "MIT",
@@ -45,6 +45,7 @@
45
45
  "import": "./dist/runtime/theme-api.js"
46
46
  },
47
47
  "./components/DrawerRenderer*": {},
48
+ "./components/ConfirmRenderer*": {},
48
49
  "./components/ModalRenderer*": {},
49
50
  "./components/NavigationMenuAccordionItem*": {},
50
51
  "./components/NavigationMenuFlyoutList*": {},
@@ -76,6 +77,7 @@
76
77
  "./dist/runtime/theme-api.d.ts"
77
78
  ],
78
79
  "components/DrawerRenderer*": [],
80
+ "components/ConfirmRenderer*": [],
79
81
  "components/ModalRenderer*": [],
80
82
  "components/NavigationMenuAccordionItem*": [],
81
83
  "components/NavigationMenuFlyoutList*": [],
@@ -98,18 +100,16 @@
98
100
  ],
99
101
  "scripts": {
100
102
  "prepack": "nuxt-module-build build",
101
- "dev": "bun run docs:dev",
103
+ "dev": "bun run docs:prepare && nuxt dev docs",
102
104
  "dev:build": "bun run docs:build",
103
105
  "dev:generate": "bun run docs:generate",
104
106
  "dev:preview": "bunx nuxt preview docs",
105
107
  "dev:prepare": "bun run docs:prepare",
106
108
  "docs:build": "nuxt build docs",
107
- "docs:dev": "bun run docs:prepare && nuxt dev docs",
109
+ "docs:dev": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare packages/docs/preview && nuxt dev packages/docs/preview",
108
110
  "docs:generate": "nuxt generate docs",
109
111
  "docs:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare docs && bun run scripts/sync-workspace-dist.mjs",
110
112
  "docs:types": "cd docs && vue-tsc --noEmit",
111
- "docs-template:dev": "bun run docs-template:prepare && nuxt dev packages/docs/preview",
112
- "docs-template:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare packages/docs/preview",
113
113
  "release": "bun run release:both",
114
114
  "release:both": "bun run release:selaras && bun run release:docs",
115
115
  "release:selaras": "bun run lint && bun run test && (if [ -n \"$RELEASE_VERSION\" ]; then npx changelogen --bump -r \"$RELEASE_VERSION\"; elif [ \"${RELEASE_BUMP:-auto}\" = \"auto\" ]; then npx changelogen --bump; else npx changelogen --bump \"--$RELEASE_BUMP\"; fi) && bun run test:release && npm publish --access public && bash scripts/tag-and-push-release.sh selaras && changelogen gh release",
@@ -140,6 +140,7 @@
140
140
  "@tanstack/vue-table": "^9.1.2",
141
141
  "@tanstack/vue-virtual": "^3.13.36",
142
142
  "reka-ui": "^2.2.0",
143
+ "shiki": "^4.4.3",
143
144
  "tailwind-merge": "^3.6.0",
144
145
  "tailwind-variants": "^3.3.1",
145
146
  "tw-animate-css": "^1.4.0"