@illinois-grad/grad-vue 7.2.8 → 7.2.9

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.
@@ -1554,6 +1554,36 @@
1554
1554
  },
1555
1555
  "optional": false
1556
1556
  },
1557
+ {
1558
+ "kind": "field",
1559
+ "name": "actions",
1560
+ "type": {
1561
+ "text": "GSearchAction[]"
1562
+ },
1563
+ "optional": true,
1564
+ "description": "Actions shown in their own group after search results",
1565
+ "default": "() => []"
1566
+ },
1567
+ {
1568
+ "kind": "field",
1569
+ "name": "actionsLabel",
1570
+ "type": {
1571
+ "text": "string"
1572
+ },
1573
+ "optional": true,
1574
+ "description": "Group label for actions",
1575
+ "default": "\"Actions\""
1576
+ },
1577
+ {
1578
+ "kind": "field",
1579
+ "name": "actionIcon",
1580
+ "type": {
1581
+ "text": "string | false"
1582
+ },
1583
+ "optional": true,
1584
+ "description": "Default icon classes for a decorative leading icon on actions, or `false` to hide it. Overridden per action by `action.icon` or by the `action-icon` slot.",
1585
+ "default": "undefined"
1586
+ },
1557
1587
  {
1558
1588
  "kind": "field",
1559
1589
  "name": "placeholder",
@@ -1614,6 +1644,18 @@
1614
1644
  "type": {
1615
1645
  "text": "CustomEvent"
1616
1646
  }
1647
+ },
1648
+ {
1649
+ "name": "action",
1650
+ "type": {
1651
+ "text": "CustomEvent"
1652
+ }
1653
+ },
1654
+ {
1655
+ "name": "close",
1656
+ "type": {
1657
+ "text": "CustomEvent"
1658
+ }
1617
1659
  }
1618
1660
  ]
1619
1661
  }
@@ -112,8 +112,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
112
112
  }>, {
113
113
  label: string;
114
114
  required: boolean;
115
- name: string;
116
115
  radio: boolean;
116
+ name: string;
117
117
  instructions: string;
118
118
  errors: string[];
119
119
  formKey: string;
@@ -71,8 +71,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
71
71
  "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
72
72
  }>, {
73
73
  action: string;
74
- method: string;
75
74
  formKey: string;
75
+ method: string;
76
76
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
77
77
  default?: (props: {
78
78
  isSubmitting: boolean;
@@ -3,6 +3,15 @@ export interface GSearchGroup<R> {
3
3
  label: string;
4
4
  items: R[];
5
5
  }
6
+ export interface GSearchAction {
7
+ id: string | number;
8
+ label: string;
9
+ /**
10
+ * Optional icon classes to render a decorative leading icon before the label
11
+ * (e.g., `"fa-solid fa-magnifying-glass"`), or `false` to hide the icon.
12
+ */
13
+ icon?: string | false;
14
+ }
6
15
  /**
7
16
  * A combobox-style search that shows a list of results as an auto
8
17
  * complete dropdown.
@@ -13,9 +22,11 @@ export interface GSearchGroup<R> {
13
22
  *
14
23
  * **Events**:
15
24
  *
16
- * - `submit` event is emitted when a search should be performed.
17
- * - `select` event is submitted when a user makes a selection
18
- * in the dropdown.
25
+ * - `submit` event is emitted with `string | null` when a search should be performed.
26
+ * - `select` event is emitted when a user selects a result in the dropdown.
27
+ * - `action` event is emitted with the chosen `GSearchAction` when a user
28
+ * activates an action in the dropdown, leaving the query and dropdown open.
29
+ * - `close` event is emitted when the results dropdown closes.
19
30
  *
20
31
  * > [!NOTE]
21
32
  * > The `v-model` value should *not* be used to trigger a search,
@@ -27,13 +38,28 @@ export interface GSearchGroup<R> {
27
38
  * - Pass an array of objects that extend `{ id: string | number; title: string; }`.
28
39
  * - Pass an array of `GSearchGroup<T>` objects, where the `items` property extends the above type.
29
40
  * In this case the results are grouped.
41
+ * - `actions` renders additional `GSearchAction` items
42
+ * (`{ id: string | number; label: string; icon?: string | false }`) in their own shaded
43
+ * group after the results with a decorative leading icon. They are reachable with the
44
+ * arrow keys, excluded from the result count, and announced to screen readers via a
45
+ * polite status region.
46
+ * - `actionsLabel` customizes the label of the actions group (defaults to `"Actions"`).
47
+ * - `actionIcon` sets default icon classes (e.g., `"fa-solid fa-arrow-right"`) for the
48
+ * decorative leading icon on actions, or `false` to hide it. Overridden per action by
49
+ * `action.icon` or by the `action-icon` slot.
30
50
  * - `auto` makes search submit on user input. Defaults to `true`.
31
51
  * if `false`, submission happens on Enter or clicking the search button.
32
52
  * - `loading` shows a loading indicator. Use if the search may take longer.
33
53
  *
34
- * **Slot**: `option` customizes how an option is rendered.
54
+ * **Slot**: `option` customizes how a result option is rendered.
35
55
  * It receives the current item as `option`.
36
56
  *
57
+ * **Slot**: `action` customizes how an action option is rendered.
58
+ * It receives the current action as `action`.
59
+ *
60
+ * **Slot**: `action-icon` customizes the decorative leading icon for an action.
61
+ * It receives the current action as `action`.
62
+ *
37
63
  * **Slot**: `group` customizes the group label for each group.
38
64
  *
39
65
  * Here is a minimal implementation:
@@ -52,9 +78,10 @@ export interface GSearchGroup<R> {
52
78
  * ]);
53
79
  * const searchResults = ref<SearchResult[]>([]);
54
80
  *
55
- * function submit(query: string) {
81
+ * function submit(query: string | null) {
82
+ * const q = (query ?? "").toLowerCase();
56
83
  * searchResults.value = searchData.value.filter((result) =>
57
- * result.title.toLowerCase().includes(query.toLowerCase()),
84
+ * result.title.toLowerCase().includes(q),
58
85
  * );
59
86
  * }
60
87
  * function selected(item: SearchResult) {
@@ -78,6 +105,20 @@ declare const __VLS_export: <T extends {
78
105
  }>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
79
106
  props: import("vue").PublicProps & __VLS_PrettifyLocal<({
80
107
  results: GSearchGroup<T>[] | T[];
108
+ /**
109
+ * Actions shown in their own group after search results
110
+ */
111
+ actions?: GSearchAction[];
112
+ /**
113
+ * Group label for actions
114
+ * @demo
115
+ */
116
+ actionsLabel?: string;
117
+ /**
118
+ * Default icon classes for a decorative leading icon on actions, or `false` to hide it.
119
+ * Overridden per action by `action.icon` or by the `action-icon` slot.
120
+ */
121
+ actionIcon?: string | false;
81
122
  /**
82
123
  * Placeholder
83
124
  * @demo
@@ -101,8 +142,10 @@ declare const __VLS_export: <T extends {
101
142
  } & {
102
143
  modelValue?: string | null;
103
144
  }) & {
104
- onSelect?: ((...args: any[]) => any) | undefined;
105
- onSubmit?: ((...args: any[]) => any) | undefined;
145
+ onSelect?: ((result: T) => any) | undefined;
146
+ onSubmit?: ((query: string | null) => any) | undefined;
147
+ onAction?: ((action: GSearchAction) => any) | undefined;
148
+ onClose?: (() => any) | undefined;
106
149
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
107
150
  }> & (typeof globalThis extends {
108
151
  __VLS_PROPS_FALLBACK: infer P;
@@ -110,19 +153,20 @@ declare const __VLS_export: <T extends {
110
153
  expose: (exposed: {}) => void;
111
154
  attrs: any;
112
155
  slots: {
113
- group?: (props: {
114
- group: GSearchGroup<T>;
115
- }) => any;
116
- } & {
117
156
  option?: (props: {
118
157
  option: T;
119
158
  }) => any;
120
- } & {
121
- option?: (props: {
122
- option: T;
159
+ action?: (props: {
160
+ action: GSearchAction;
161
+ }) => any;
162
+ "action-icon"?: (props: {
163
+ action: GSearchAction;
164
+ }) => any;
165
+ group?: (props: {
166
+ group: GSearchGroup<T>;
123
167
  }) => any;
124
168
  };
125
- emit: ((event: "select" | "submit", ...args: any[]) => void) & ((event: "update:modelValue", value: string | null) => void);
169
+ emit: (((evt: "select", result: T) => void) & ((evt: "submit", query: string | null) => void) & ((evt: "action", action: GSearchAction) => void) & ((evt: "close") => void)) & ((event: "update:modelValue", value: string | null) => void);
126
170
  }>) => import("vue").VNode & {
127
171
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
128
172
  };