@sewadah/selaras 0.3.0 → 0.3.1

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 (141) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +14 -1
  3. package/dist/runtime/components/Autocomplete.vue +3 -1
  4. package/dist/runtime/components/Calendar.d.vue.ts +69 -0
  5. package/dist/runtime/components/Calendar.vue +163 -0
  6. package/dist/runtime/components/Calendar.vue.d.ts +69 -0
  7. package/dist/runtime/components/Callout.vue +12 -1
  8. package/dist/runtime/components/CodeGroup.vue +13 -3
  9. package/dist/runtime/components/CodeTree.d.vue.ts +2 -0
  10. package/dist/runtime/components/CodeTree.vue +52 -1
  11. package/dist/runtime/components/CodeTree.vue.d.ts +2 -0
  12. package/dist/runtime/components/ColorPicker.d.vue.ts +8 -0
  13. package/dist/runtime/components/ColorPicker.vue +66 -45
  14. package/dist/runtime/components/ColorPicker.vue.d.ts +8 -0
  15. package/dist/runtime/components/Column.js +1 -1
  16. package/dist/runtime/components/CommandPalette.d.vue.ts +3 -1
  17. package/dist/runtime/components/CommandPalette.vue +5 -0
  18. package/dist/runtime/components/CommandPalette.vue.d.ts +3 -1
  19. package/dist/runtime/components/ContentNavigation.d.vue.ts +8 -1
  20. package/dist/runtime/components/ContentNavigation.vue +9 -2
  21. package/dist/runtime/components/ContentNavigation.vue.d.ts +8 -1
  22. package/dist/runtime/components/ContextMenu.d.vue.ts +8 -1
  23. package/dist/runtime/components/ContextMenu.vue +16 -4
  24. package/dist/runtime/components/ContextMenu.vue.d.ts +8 -1
  25. package/dist/runtime/components/DatePicker.d.vue.ts +10 -3
  26. package/dist/runtime/components/DatePicker.vue +24 -16
  27. package/dist/runtime/components/DatePicker.vue.d.ts +10 -3
  28. package/dist/runtime/components/Dropdown.d.vue.ts +33 -6
  29. package/dist/runtime/components/Dropdown.vue +143 -11
  30. package/dist/runtime/components/Dropdown.vue.d.ts +33 -6
  31. package/dist/runtime/components/FileTree.d.vue.ts +2 -0
  32. package/dist/runtime/components/FileTree.vue +8 -4
  33. package/dist/runtime/components/FileTree.vue.d.ts +2 -0
  34. package/dist/runtime/components/FormField.d.vue.ts +4 -0
  35. package/dist/runtime/components/FormField.vue +19 -4
  36. package/dist/runtime/components/FormField.vue.d.ts +4 -0
  37. package/dist/runtime/components/Input.vue +3 -2
  38. package/dist/runtime/components/Kbd.vue +12 -2
  39. package/dist/runtime/components/NavigationMenu.d.vue.ts +10 -10
  40. package/dist/runtime/components/NavigationMenu.vue +13 -9
  41. package/dist/runtime/components/NavigationMenu.vue.d.ts +10 -10
  42. package/dist/runtime/components/NavigationMenuAccordionItem.vue +5 -1
  43. package/dist/runtime/components/NavigationMenuFlyoutList.vue +7 -4
  44. package/dist/runtime/components/Popover.d.vue.ts +8 -2
  45. package/dist/runtime/components/Popover.vue +9 -4
  46. package/dist/runtime/components/Popover.vue.d.ts +8 -2
  47. package/dist/runtime/components/ProsePre.d.vue.ts +2 -0
  48. package/dist/runtime/components/ProsePre.vue +2 -1
  49. package/dist/runtime/components/ProsePre.vue.d.ts +2 -0
  50. package/dist/runtime/components/Select.vue +3 -1
  51. package/dist/runtime/components/SplitterPanel.d.vue.ts +2 -2
  52. package/dist/runtime/components/SplitterPanel.vue.d.ts +2 -2
  53. package/dist/runtime/components/Table.vue +95 -26
  54. package/dist/runtime/components/Tabs.d.vue.ts +44 -4
  55. package/dist/runtime/components/Tabs.vue +171 -18
  56. package/dist/runtime/components/Tabs.vue.d.ts +44 -4
  57. package/dist/runtime/components/Textarea.vue +3 -2
  58. package/dist/runtime/components/Timeline.d.vue.ts +19 -0
  59. package/dist/runtime/components/Timeline.vue +99 -0
  60. package/dist/runtime/components/Timeline.vue.d.ts +19 -0
  61. package/dist/runtime/components/Toast.d.vue.ts +10 -1
  62. package/dist/runtime/components/Toast.vue +94 -8
  63. package/dist/runtime/components/Toast.vue.d.ts +10 -1
  64. package/dist/runtime/components/Tooltip.d.vue.ts +8 -2
  65. package/dist/runtime/components/Tooltip.vue +9 -4
  66. package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
  67. package/dist/runtime/composables/use-form-field.d.ts +1 -0
  68. package/dist/runtime/composables/use-table.d.ts +3 -0
  69. package/dist/runtime/composables/use-table.js +10 -4
  70. package/dist/runtime/composables/use-toast.js +5 -1
  71. package/dist/runtime/directives/hotkey.d.ts +13 -0
  72. package/dist/runtime/directives/hotkey.js +107 -0
  73. package/dist/runtime/directives/index.d.ts +2 -0
  74. package/dist/runtime/directives/index.js +2 -0
  75. package/dist/runtime/directives/mask.d.ts +30 -0
  76. package/dist/runtime/directives/mask.js +165 -0
  77. package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +29 -25
  78. package/dist/runtime/internal/ComboboxSelectBase.vue +103 -19
  79. package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +29 -25
  80. package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +16 -11
  81. package/dist/runtime/internal/ComboboxSelectBody.vue +49 -10
  82. package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +16 -11
  83. package/dist/runtime/internal/DatePickerCalendarBody.vue +1 -1
  84. package/dist/runtime/internal/DatePickerRangeCalendarBody.vue +1 -1
  85. package/dist/runtime/internal/ShortcutHint.d.vue.ts +6 -0
  86. package/dist/runtime/internal/ShortcutHint.vue +13 -0
  87. package/dist/runtime/internal/ShortcutHint.vue.d.ts +6 -0
  88. package/dist/runtime/internal/ToastItemRenderer.d.vue.ts +9 -1
  89. package/dist/runtime/internal/ToastItemRenderer.vue +55 -8
  90. package/dist/runtime/internal/ToastItemRenderer.vue.d.ts +9 -1
  91. package/dist/runtime/internal/combobox-select.js +2 -1
  92. package/dist/runtime/internal/programmatic-services.d.ts +2 -0
  93. package/dist/runtime/internal/programmatic-services.js +8 -0
  94. package/dist/runtime/internal/toast-stack.d.ts +36 -0
  95. package/dist/runtime/internal/toast-stack.js +36 -0
  96. package/dist/runtime/structural.css +1 -1
  97. package/dist/runtime/table.d.ts +1 -1
  98. package/dist/runtime/theme/alert-dialog.js +1 -1
  99. package/dist/runtime/theme/calendar.d.ts +86 -0
  100. package/dist/runtime/theme/calendar.js +19 -0
  101. package/dist/runtime/theme/callout.d.ts +0 -12
  102. package/dist/runtime/theme/callout.js +8 -8
  103. package/dist/runtime/theme/code-tree.js +1 -1
  104. package/dist/runtime/theme/command-palette.js +1 -1
  105. package/dist/runtime/theme/content-navigation.d.ts +3 -0
  106. package/dist/runtime/theme/content-navigation.js +1 -0
  107. package/dist/runtime/theme/drawer.js +1 -1
  108. package/dist/runtime/theme/dropdown.d.ts +21 -0
  109. package/dist/runtime/theme/dropdown.js +15 -2
  110. package/dist/runtime/theme/file-tree.js +1 -1
  111. package/dist/runtime/theme/form-field.d.ts +18 -0
  112. package/dist/runtime/theme/form-field.js +6 -1
  113. package/dist/runtime/theme/modal.js +1 -1
  114. package/dist/runtime/theme/slideover.js +1 -1
  115. package/dist/runtime/theme/table.d.ts +27 -0
  116. package/dist/runtime/theme/table.js +11 -2
  117. package/dist/runtime/theme/tabs.d.ts +87 -3
  118. package/dist/runtime/theme/tabs.js +46 -22
  119. package/dist/runtime/theme/timeline.d.ts +251 -0
  120. package/dist/runtime/theme/timeline.js +84 -0
  121. package/dist/runtime/theme/toast.d.ts +92 -0
  122. package/dist/runtime/theme/toast.js +29 -7
  123. package/dist/runtime/theme-config.d.ts +12 -1
  124. package/dist/runtime/types/index.d.ts +6 -1
  125. package/dist/runtime/utils/arrow.d.ts +21 -0
  126. package/dist/runtime/utils/arrow.js +10 -0
  127. package/dist/runtime/utils/file-icons.js +2 -0
  128. package/dist/runtime/utils/icons.d.ts +2 -0
  129. package/dist/runtime/utils/icons.js +2 -0
  130. package/dist/runtime/utils/messages.d.ts +6 -0
  131. package/dist/runtime/utils/messages.js +6 -0
  132. package/dist/runtime/utils/navigation-menu.d.ts +7 -0
  133. package/dist/runtime/utils/navigation-menu.js +3 -0
  134. package/dist/runtime/utils/overlay.d.ts +17 -0
  135. package/dist/runtime/utils/overlay.js +7 -0
  136. package/dist/runtime/utils/select-contracts.d.ts +7 -1
  137. package/dist/runtime/utils/table-columns.js +1 -1
  138. package/dist/runtime/utils/table-contracts.d.ts +9 -1
  139. package/dist/runtime/utils/timeline-contracts.d.ts +42 -0
  140. package/dist/runtime/utils/timeline-contracts.js +0 -0
  141. package/package.json +2 -1
@@ -11,11 +11,14 @@ export interface MessageRegistry {
11
11
  searchDescription: string;
12
12
  columns: string;
13
13
  filterPlaceholder: string;
14
+ filterColumn: (column: string) => string;
14
15
  previous: string;
15
16
  next: string;
16
17
  first: string;
17
18
  last: string;
18
19
  pagination: string;
20
+ scrollTabsLeft: string;
21
+ scrollTabsRight: string;
19
22
  datePicker: string;
20
23
  datePickerDescription: string;
21
24
  dateRangePicker: string;
@@ -39,6 +42,7 @@ export interface MessageRegistry {
39
42
  decrement: string;
40
43
  noOptions: string;
41
44
  noResultsFound: string;
45
+ createOption: (value: string) => string;
42
46
  noData: string;
43
47
  expandRow: string;
44
48
  collapseRow: string;
@@ -62,6 +66,8 @@ export interface MessageRegistry {
62
66
  showHiddenBreadcrumbItems: string;
63
67
  commandPalette: string;
64
68
  commandPaletteDescription: string;
69
+ dropdownMenu: string;
70
+ dropdownMenuDescription: string;
65
71
  navigate: string;
66
72
  select: string;
67
73
  onThisPage: string;
@@ -11,11 +11,14 @@ export const defaultMessages = {
11
11
  searchDescription: "Type to filter, then use arrow keys and enter to select",
12
12
  columns: "Columns",
13
13
  filterPlaceholder: "Filter...",
14
+ filterColumn: (column) => `Filter ${column}`,
14
15
  previous: "Previous",
15
16
  next: "Next",
16
17
  first: "First",
17
18
  last: "Last",
18
19
  pagination: "Pagination",
20
+ scrollTabsLeft: "Scroll tabs left",
21
+ scrollTabsRight: "Scroll tabs right",
19
22
  datePicker: "Date picker",
20
23
  datePickerDescription: "Use arrow keys to navigate days, enter to select",
21
24
  dateRangePicker: "Date range picker",
@@ -39,6 +42,7 @@ export const defaultMessages = {
39
42
  decrement: "Decrement",
40
43
  noOptions: "No options",
41
44
  noResultsFound: "No results found",
45
+ createOption: (value) => `Create "${value}"`,
42
46
  noData: "No data",
43
47
  expandRow: "Expand row",
44
48
  collapseRow: "Collapse row",
@@ -61,6 +65,8 @@ export const defaultMessages = {
61
65
  showHiddenBreadcrumbItems: "Show hidden breadcrumb items",
62
66
  commandPalette: "Command palette",
63
67
  commandPaletteDescription: "Search for a command and press enter",
68
+ dropdownMenu: "Actions",
69
+ dropdownMenuDescription: "Choose an action",
64
70
  navigate: "Navigate",
65
71
  select: "Select",
66
72
  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,6 +1,8 @@
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
8
  export interface SelectGroup<Item extends object> {
@@ -62,7 +64,11 @@ export interface SelectProps<Entry extends object = {
62
64
  searchTerm?: string;
63
65
  resetSearchTermOnBlur?: boolean;
64
66
  resetSearchTermOnSelect?: boolean;
65
- arrow?: boolean;
67
+ arrow?: boolean | RoundedArrowConfig;
68
+ /** Positioning of the anchored list (the adaptive Select modal uses its own layout). */
69
+ positioning?: OverlayPositioning;
70
+ /** Teleport target for the anchored list, or `false` to render it inline. */
71
+ portal?: OverlayPortal;
66
72
  /**
67
73
  * Opts into the control's accessible small-screen presentation. Select uses
68
74
  * a centered modal; Autocomplete keeps its editable combobox in a wider
@@ -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
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.1",
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",
@@ -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"