@illinois-grad/grad-vue 2.5.2 → 2.5.4

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.
@@ -1140,6 +1140,119 @@
1140
1140
  }
1141
1141
  ]
1142
1142
  },
1143
+ {
1144
+ "kind": "javascript-module",
1145
+ "path": "dist/web-components.js",
1146
+ "declarations": [
1147
+ {
1148
+ "kind": "custom-element",
1149
+ "name": "GMultiSelectElement",
1150
+ "tagName": "g-multi-select",
1151
+ "members": [
1152
+ {
1153
+ "kind": "field",
1154
+ "name": "options",
1155
+ "type": {
1156
+ "text": "Array<string | SelectOption>"
1157
+ },
1158
+ "optional": false,
1159
+ "description": "List of options to choose from"
1160
+ },
1161
+ {
1162
+ "kind": "field",
1163
+ "name": "label",
1164
+ "type": {
1165
+ "text": "string"
1166
+ },
1167
+ "optional": false,
1168
+ "description": "Accessible label"
1169
+ },
1170
+ {
1171
+ "kind": "field",
1172
+ "name": "hiddenLabel",
1173
+ "type": {
1174
+ "text": "boolean"
1175
+ },
1176
+ "optional": true,
1177
+ "description": "Hide the label visually",
1178
+ "default": "false"
1179
+ },
1180
+ {
1181
+ "kind": "field",
1182
+ "name": "placeholder",
1183
+ "type": {
1184
+ "text": "string"
1185
+ },
1186
+ "optional": true,
1187
+ "description": "Placeholder text shown when no values are selected"
1188
+ },
1189
+ {
1190
+ "kind": "field",
1191
+ "name": "disabled",
1192
+ "type": {
1193
+ "text": "boolean"
1194
+ },
1195
+ "optional": true,
1196
+ "description": "Disabled",
1197
+ "default": "false"
1198
+ },
1199
+ {
1200
+ "kind": "field",
1201
+ "name": "name",
1202
+ "type": {
1203
+ "text": "string"
1204
+ },
1205
+ "optional": true,
1206
+ "description": "Name for form registration"
1207
+ },
1208
+ {
1209
+ "kind": "field",
1210
+ "name": "errors",
1211
+ "type": {
1212
+ "text": "string[]"
1213
+ },
1214
+ "optional": true,
1215
+ "description": "Error messages array (supports multiple validation errors)",
1216
+ "default": "() => []"
1217
+ },
1218
+ {
1219
+ "kind": "field",
1220
+ "name": "instructions",
1221
+ "type": {
1222
+ "text": "string"
1223
+ },
1224
+ "optional": true,
1225
+ "description": "Instructions shown below the label"
1226
+ },
1227
+ {
1228
+ "kind": "field",
1229
+ "name": "formKey",
1230
+ "type": {
1231
+ "text": "string"
1232
+ },
1233
+ "optional": true,
1234
+ "description": "Form channel key for custom elements mode"
1235
+ },
1236
+ {
1237
+ "kind": "field",
1238
+ "name": "modelValue",
1239
+ "type": {
1240
+ "text": "Array<string | number>"
1241
+ },
1242
+ "optional": true
1243
+ }
1244
+ ],
1245
+ "events": [
1246
+ {
1247
+ "name": "change",
1248
+ "type": {
1249
+ "text": "CustomEvent"
1250
+ }
1251
+ }
1252
+ ]
1253
+ }
1254
+ ]
1255
+ },
1143
1256
  {
1144
1257
  "kind": "javascript-module",
1145
1258
  "path": "dist/web-components.js",
@@ -1375,7 +1488,7 @@
1375
1488
  "kind": "field",
1376
1489
  "name": "options",
1377
1490
  "type": {
1378
- "text": "Array<string | OptionType>"
1491
+ "text": "Array<string | SelectOption>"
1379
1492
  },
1380
1493
  "optional": false,
1381
1494
  "description": "List of options to choose from"
@@ -1424,8 +1537,7 @@
1424
1537
  "text": "string"
1425
1538
  },
1426
1539
  "optional": true,
1427
- "description": "Name for form registration",
1428
- "default": "undefined"
1540
+ "description": "Name for form registration"
1429
1541
  },
1430
1542
  {
1431
1543
  "kind": "field",
@@ -1473,8 +1585,7 @@
1473
1585
  "text": "string"
1474
1586
  },
1475
1587
  "optional": true,
1476
- "description": "Form channel key for custom elements mode",
1477
- "default": "undefined"
1588
+ "description": "Form channel key for custom elements mode"
1478
1589
  },
1479
1590
  {
1480
1591
  "kind": "field",
@@ -2665,7 +2776,7 @@
2665
2776
  "text": "\"ul\" | \"ol\""
2666
2777
  },
2667
2778
  "optional": true,
2668
- "description": "List element type use `ol` for numbered hierarchies like book chapters",
2779
+ "description": "List element type - use `ol` for numbered hierarchies like book chapters",
2669
2780
  "default": "\"ul\""
2670
2781
  },
2671
2782
  {
@@ -0,0 +1,125 @@
1
+ import { type SelectOption } from "../compose/useSelectDropdown.ts";
2
+ /**
3
+ * A multi-select combobox that allows selecting multiple values with
4
+ * optional search/filter support.
5
+ *
6
+ * Selected values are displayed as removable chips inside the control.
7
+ * The dropdown listbox shows all (or filtered) options with a checkmark
8
+ * next to each selected option.
9
+ *
10
+ * The `options` prop accepts an array of strings or `{ label, value }`
11
+ * objects. The `v-model` binds to an array of `string | number` values.
12
+ *
13
+ * In standard Vue usage, this registers with the nearest parent `GForm` via
14
+ * injection. In custom-elements mode, use matching `form-key` values to pair
15
+ * with a `GForm`.
16
+ *
17
+ * Keyboard navigation:
18
+ * - `Down Arrow` / `Up Arrow`: move through options (opens menu if closed)
19
+ * - `Enter`: toggle the focused option
20
+ * - `Space`: toggle the focused option when the search field is empty
21
+ * - `Escape`: close the dropdown
22
+ * - `Home` / `End`: jump to first / last option
23
+ * - `Backspace`: remove the last chip when the search field is empty
24
+ */
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ declare const __VLS_export: import("vue").DefineComponent<{
28
+ /**
29
+ * List of options to choose from
30
+ */
31
+ options: Array<string | SelectOption>;
32
+ /**
33
+ * Accessible label
34
+ * @demo Select Fruits
35
+ */
36
+ label: string;
37
+ /**
38
+ * Hide the label visually
39
+ * @demo
40
+ */
41
+ hiddenLabel?: boolean;
42
+ /**
43
+ * Placeholder text shown when no values are selected
44
+ * @demo
45
+ */
46
+ placeholder?: string;
47
+ /**
48
+ * Disabled
49
+ * @demo
50
+ */
51
+ disabled?: boolean;
52
+ /**
53
+ * Name for form registration
54
+ */
55
+ name?: string;
56
+ /**
57
+ * Error messages array (supports multiple validation errors)
58
+ */
59
+ errors?: string[];
60
+ /**
61
+ * Instructions shown below the label
62
+ * @demo
63
+ */
64
+ instructions?: string;
65
+ /**
66
+ * Form channel key for custom elements mode
67
+ */
68
+ formKey?: string;
69
+ } & {
70
+ modelValue?: Array<string | number>;
71
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
72
+ "update:modelValue": (value: (string | number)[]) => any;
73
+ change: (value: (string | number)[]) => any;
74
+ }, string, import("vue").PublicProps, Readonly<{
75
+ /**
76
+ * List of options to choose from
77
+ */
78
+ options: Array<string | SelectOption>;
79
+ /**
80
+ * Accessible label
81
+ * @demo Select Fruits
82
+ */
83
+ label: string;
84
+ /**
85
+ * Hide the label visually
86
+ * @demo
87
+ */
88
+ hiddenLabel?: boolean;
89
+ /**
90
+ * Placeholder text shown when no values are selected
91
+ * @demo
92
+ */
93
+ placeholder?: string;
94
+ /**
95
+ * Disabled
96
+ * @demo
97
+ */
98
+ disabled?: boolean;
99
+ /**
100
+ * Name for form registration
101
+ */
102
+ name?: string;
103
+ /**
104
+ * Error messages array (supports multiple validation errors)
105
+ */
106
+ errors?: string[];
107
+ /**
108
+ * Instructions shown below the label
109
+ * @demo
110
+ */
111
+ instructions?: string;
112
+ /**
113
+ * Form channel key for custom elements mode
114
+ */
115
+ formKey?: string;
116
+ } & {
117
+ modelValue?: Array<string | number>;
118
+ }> & Readonly<{
119
+ "onUpdate:modelValue"?: ((value: (string | number)[]) => any) | undefined;
120
+ onChange?: ((value: (string | number)[]) => any) | undefined;
121
+ }>, {
122
+ errors: string[];
123
+ disabled: boolean;
124
+ hiddenLabel: boolean;
125
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,3 +1,4 @@
1
+ import { type SelectOption } from "../compose/useSelectDropdown.ts";
1
2
  /**
2
3
  * By default, this component behaves like a normal select element with
3
4
  * custom styling.
@@ -19,10 +20,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
19
20
  /**
20
21
  * List of options to choose from
21
22
  */
22
- options: Array<string | {
23
- label: string;
24
- value: string | number;
25
- }>;
23
+ options: Array<string | SelectOption>;
26
24
  /**
27
25
  * Accessible label
28
26
  * @demo Select Option
@@ -81,10 +79,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
81
79
  /**
82
80
  * List of options to choose from
83
81
  */
84
- options: Array<string | {
85
- label: string;
86
- value: string | number;
87
- }>;
82
+ options: Array<string | SelectOption>;
88
83
  /**
89
84
  * Accessible label
90
85
  * @demo Select Option
@@ -140,18 +135,13 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
140
135
  "onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
141
136
  onChange?: ((...args: any[]) => any) | undefined;
142
137
  }>, {
143
- name: string;
144
138
  errors: string[];
145
- formKey: string;
146
139
  disabled: boolean;
147
140
  searchable: boolean;
148
141
  compact: boolean;
149
142
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
150
143
  option?: (props: {
151
- option: {
152
- label: string;
153
- value: string | number;
154
- };
144
+ option: SelectOption;
155
145
  selected: boolean;
156
146
  index: number;
157
147
  }) => any;
@@ -6,23 +6,23 @@ import type { TreeMenuItem } from "./tree-menu/GTreeMenuList.vue";
6
6
  *
7
7
  * **Props**:
8
8
  *
9
- * - `title` optional heading and accessible name for the nav landmark.
10
- * - `items` array of `TreeMenuItem` objects. Each item may have:
11
- * - `label` display text (required).
12
- * - `href` or `to` link destination. When `to` is provided and `vue-router`
9
+ * - `title` - optional heading and accessible name for the nav landmark.
10
+ * - `items` - array of `TreeMenuItem` objects. Each item may have:
11
+ * - `label` - display text (required).
12
+ * - `href` or `to` - link destination. When `to` is provided and `vue-router`
13
13
  * is present the link is rendered as a `<router-link>`.
14
- * - `children` nested `TreeMenuItem[]` for sub-levels (unlimited depth).
15
- * - `listType` `ul` (default) or `ol`. Use `ol` for numbered
14
+ * - `children` - nested `TreeMenuItem[]` for sub-levels (unlimited depth).
15
+ * - `listType` - `ul` (default) or `ol`. Use `ol` for numbered
16
16
  * hierarchies such as book chapters.
17
- * - `theme` `light` (default) or `dark`.
17
+ * - `theme` - `light` (default) or `dark`.
18
18
  *
19
19
  * **Keyboard navigation** (tree-view style):
20
20
  *
21
- * - `↑` / `↓` move between visible menu items.
22
- * - `→` expand a collapsed item; if already expanded, move to its first child.
23
- * - `←` collapse an expanded item; if already collapsed, move focus to its
21
+ * - `Up Arrow` / `Down Arrow` - move between visible menu items.
22
+ * - `Right Arrow` - expand a collapsed item; if already expanded, move to its first child.
23
+ * - `Left Arrow` - collapse an expanded item; if already collapsed, move focus to its
24
24
  * parent.
25
- * - `Home` / `End` jump to the first or last visible item.
25
+ * - `Home` / `End` - jump to the first or last visible item.
26
26
  */
27
27
  declare const _default: typeof __VLS_export;
28
28
  export default _default;
@@ -37,7 +37,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
37
37
  */
38
38
  items: TreeMenuItem[];
39
39
  /**
40
- * List element type use `ol` for numbered hierarchies like book chapters
40
+ * List element type - use `ol` for numbered hierarchies like book chapters
41
41
  * @demo
42
42
  */
43
43
  listType?: "ul" | "ol";
@@ -57,7 +57,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
57
57
  */
58
58
  items: TreeMenuItem[];
59
59
  /**
60
- * List element type use `ol` for numbered hierarchies like book chapters
60
+ * List element type - use `ol` for numbered hierarchies like book chapters
61
61
  * @demo
62
62
  */
63
63
  listType?: "ul" | "ol";
@@ -0,0 +1,56 @@
1
+ import { type Ref } from "vue";
2
+ /**
3
+ * A normalized select option with a label and a value.
4
+ * Both GSelect and GMultiSelect accept `Array<string | SelectOption>` and
5
+ * normalize the strings to this shape internally.
6
+ */
7
+ export type SelectOption = {
8
+ label: string;
9
+ value: string | number;
10
+ };
11
+ /**
12
+ * Normalizes a mixed `Array<string | SelectOption>` into a uniform
13
+ * `SelectOption[]`. Strings are converted to `{ label: s, value: s }`.
14
+ */
15
+ export declare function normalizeSelectOptions(options: Array<string | SelectOption>): SelectOption[];
16
+ export interface UseSelectDropdownOptions {
17
+ /** Reactive flag that is `true` when the dropdown is visible. */
18
+ open: Ref<boolean>;
19
+ /**
20
+ * The element whose bounding rect is used to decide whether the dropdown
21
+ * opens above or below (the trigger / combobox control).
22
+ */
23
+ anchorRef: Ref<HTMLElement | null>;
24
+ /** The listbox element – used to measure its natural scroll-height. */
25
+ listboxRef: Ref<HTMLElement | null>;
26
+ /**
27
+ * A stable unique id that doubles as the overlay-stack entry and the
28
+ * prefix for option element ids (`${baseId}-option-${index}`).
29
+ */
30
+ baseId: string;
31
+ /** The currently-highlighted option index, used by scrollOptionIntoView. */
32
+ activeIndex: Ref<number>;
33
+ }
34
+ export interface UseSelectDropdownReturn {
35
+ /** Current placement of the dropdown relative to the anchor. */
36
+ menuPlacement: Ref<"below" | "above">;
37
+ /** Inline styles to apply to the listbox element. */
38
+ menuStyle: Readonly<Ref<Record<string, string>>>;
39
+ /**
40
+ * Whether this overlay is topmost in the global stack.
41
+ * Use this to guard Escape-key handling.
42
+ */
43
+ isTop: Ref<boolean>;
44
+ /** Scrolls the currently-active option into view. */
45
+ scrollOptionIntoView: () => void;
46
+ }
47
+ /**
48
+ * Shared dropdown behaviour for GSelect and GMultiSelect.
49
+ *
50
+ * Manages:
51
+ * - Menu placement (above / below) and max-height constraints
52
+ * - window resize / scroll listeners (added when open, removed when closed)
53
+ * - Overlay-stack registration (push on open, pop on close / unmount)
54
+ * - Scrolling the active option into view
55
+ */
56
+ export declare function useSelectDropdown({ open, anchorRef, listboxRef, baseId, activeIndex, }: UseSelectDropdownOptions): UseSelectDropdownReturn;