@cscfi/csc-ui 4.0.0-alpha.12 → 4.0.0-alpha.13

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@cscfi/csc-ui",
4
- "version": "4.0.0-alpha.12",
4
+ "version": "4.0.0-alpha.13",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -252,7 +252,7 @@
252
252
  },
253
253
  {
254
254
  "name": "c-autocomplete",
255
- "description": "A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options.\n---\n\n\n### **Events:**\n - **change** - Native change event (no detail) dispatched whenever a selection is\ncommitted or cleared; bubbles through the shadow boundary for\nform-style listeners.\n- **change:query** - Fired whenever the query changes — on every keystroke in the search\ninput, and with an empty string when the panel opens. Carries the query\nstring. With `external`, drive your data source from this (debounce on\nyour side) and feed the results back via `items`.\n- **changeValue** - Fired when the selected value changes (an option is committed or the\nselection is cleared), carrying the new value — the option's value, or\nthe whole `{ name, value }` item when `return-object` is set; `null`\nwhen cleared. In `multiple` mode the whole array of picked values, in\npick order (`[]` when cleared). Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event dispatched alongside every value change so a\nplain `v-model` stays in sync. Carries no detail.\n- **update:value** - Fired alongside `changeValue` with the same detail — the `v-model`\ncontract.\n\n### **Methods:**\n - **reset()** - Reset autocomplete state\n\n### **Slots:**\n - **pre** - Content placed before the value field inside the input row\n- **default** - The c-option elements used as the data source (never rendered in place)\n- **post** - Content placed after the value field inside the input row\n\n### **CSS Parts:**\n - **panel** - The top-layer popover container anchored below the field\n- **card** - The elevated surface inside the panel holding the search row and the list\n- **search** - The search-input row at the top of the panel\n- **list** - The scrollable options listbox\n- **item** - One option row in the list\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`\n- **match** - A run of an option's label equal to the query, in the row; underlined in the primary colour, text inherits the row\n- **info** - The info row: loading while `loading` with an empty list, otherwise no-results when the query matches no options\n- **tags** - The row of selected-value tags inside the field (`multiple` mode)\n- **tag** - One selected-value tag: the `c-tag` host, including the overflow tag\n- **tag-root** - The pill box inside each tag (the `c-tag` `root` part), for colours and borders",
255
+ "description": "A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options.\n---\n\n\n### **Events:**\n - **change** - Native change event (no detail) dispatched whenever a selection is\ncommitted or cleared; bubbles through the shadow boundary for\nform-style listeners.\n- **change:query** - Fired whenever the query changes — on every keystroke in the search\ninput, and with an empty string when the panel opens. Carries the query\nstring. With `external`, drive your data source from this (debounce on\nyour side) and feed the results back via `items`.\n- **changeValue** - Fired when the selected value changes (an option is committed or the\nselection is cleared), carrying the new value — the option's value, or\nthe whole `{ name, value }` item when `return-object` is set; `null`\nwhen cleared. In `multiple` mode the whole array of picked values, in\npick order (`[]` when cleared). Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event dispatched alongside every value change so a\nplain `v-model` stays in sync. Carries no detail.\n- **update:value** - Fired alongside `changeValue` with the same detail — the `v-model`\ncontract.\n\n### **Methods:**\n - **reset()** - Reset autocomplete state\n\n### **Slots:**\n - **pre** - Content placed before the value field inside the input row\n- **default** - The c-option elements used as the data source (never rendered in place)\n- **post** - Content placed after the value field inside the input row\n\n### **CSS Parts:**\n - **panel** - The top-layer popover container anchored below the field\n- **card** - The elevated surface inside the panel holding the search row and the list\n- **search** - The search-input row at the top of the panel\n- **list** - The scrollable options listbox\n- **item** - One option row in the list\n- **select-all** - The pinned select-all row at the top of the list (`multiple` mode with `select-all`); carries the same indicator / mark parts as an option row\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`\n- **match** - A run of an option's label equal to the query, in the row; underlined in the primary colour, text inherits the row\n- **info** - The info row: loading while `loading` with an empty list, otherwise no-results when the query matches no options\n- **tags** - The row of selected-value tags inside the field (`multiple` mode)\n- **tag** - One selected-value tag: the `c-tag` host, including the overflow tag\n- **tag-root** - The pill box inside each tag (the `c-tag` `root` part), for colours and borders",
256
256
  "doc-url": "",
257
257
  "attributes": [
258
258
  {
@@ -340,6 +340,11 @@
340
340
  "description": "Return object instead of value",
341
341
  "value": { "type": "boolean", "default": "false" }
342
342
  },
343
+ {
344
+ "name": "select-all",
345
+ "description": "In `multiple` mode, pin a select-all row at the top of the list. Its\ncheckbox shows whether none, some or all enabled options currently listed\n— the matches while a query is typed, the given `items` with `external` —\nare selected; activating it selects them all, or, when all are selected,\nunselects them. Ignored in single mode",
346
+ "value": { "type": "boolean", "default": "false" }
347
+ },
343
348
  {
344
349
  "name": "shadow",
345
350
  "description": "Shadow variant",
@@ -494,6 +499,11 @@
494
499
  "description": "Return object instead of value",
495
500
  "type": "boolean"
496
501
  },
502
+ {
503
+ "name": "selectAll",
504
+ "description": "In `multiple` mode, pin a select-all row at the top of the list. Its\ncheckbox shows whether none, some or all enabled options currently listed\n— the matches while a query is typed, the given `items` with `external` —\nare selected; activating it selects them all, or, when all are selected,\nunselects them. Ignored in single mode",
505
+ "type": "boolean"
506
+ },
497
507
  {
498
508
  "name": "shadow",
499
509
  "description": "Shadow variant",
@@ -1459,7 +1469,7 @@
1459
1469
  },
1460
1470
  {
1461
1471
  "name": "c-dropdown",
1462
- "description": "\n---\n\n\n### **Events:**\n - **dropdownStateChange** - Fired when the dropdown menu opens or closes; the detail is the new open\nstate. Also dispatched as `dropdown-state-change` — bind that name in Vue templates.\n- **selectOption** - Fired when the user selects an option row, carrying the option's name\nand value for the parent (c-select) to commit. Also dispatched as `select-option` — bind that name in Vue templates.\n\n### **Methods:**\n - **close()** - Close dropdown\n- **open()** - Open dropdown\n- **selectItem()** - Select item\n- **updateList()** - Update list items\n\n### **Slots:**\n - **default** - The anchor c-input of the parent select / autocomplete, rendered inline while the menu is closed\n- **input-top** - Target the c-input is moved into when the menu opens below the field\n- **input-bottom** - Target the c-input is moved into when the menu opens above the field\n\n### **CSS Parts:**\n - **menu** - The positioned dialog surface holding the field and the list\n- **list** - The scrolling listbox\n- **item** - One option row\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`",
1472
+ "description": "\n---\n\n\n### **Events:**\n - **dropdownStateChange** - Fired when the dropdown menu opens or closes; the detail is the new open\nstate. Also dispatched as `dropdown-state-change` — bind that name in Vue templates.\n- **selectOption** - Fired when the user selects an option row, carrying the option's name\nand value for the parent (c-select) to commit. Also dispatched as `select-option` — bind that name in Vue templates.\n- **selectall** - Fired when the select-all row is activated; the parent (c-select) toggles\nevery listed enabled option.\n\n### **Methods:**\n - **close()** - Close dropdown\n- **open()** - Open dropdown\n- **selectItem()** - Select item\n- **updateList()** - Update list items\n\n### **Slots:**\n - **default** - The anchor c-input of the parent select / autocomplete, rendered inline while the menu is closed\n- **input-top** - Target the c-input is moved into when the menu opens below the field\n- **input-bottom** - Target the c-input is moved into when the menu opens above the field\n\n### **CSS Parts:**\n - **menu** - The positioned dialog surface holding the field and the list\n- **list** - The scrolling listbox\n- **item** - One option row\n- **select-all** - The pinned select-all row at the top of the list in `multiple` mode; carries the same indicator / mark parts as an option row\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`",
1463
1473
  "doc-url": "",
1464
1474
  "attributes": [
1465
1475
  {
@@ -1474,7 +1484,7 @@
1474
1484
  },
1475
1485
  {
1476
1486
  "name": "index",
1477
- "description": "Current highlighted index",
1487
+ "description": "Current highlighted index; `-1` (`SELECT_ALL_INDEX`) is the select-all row",
1478
1488
  "value": { "type": "null | number", "default": "null" }
1479
1489
  },
1480
1490
  {
@@ -1500,6 +1510,14 @@
1500
1510
  "description": "Dropdown parent (the c-select / c-autocomplete host element)",
1501
1511
  "value": { "type": "HTMLElement | null", "default": "null" }
1502
1512
  },
1513
+ {
1514
+ "name": "select-all-row",
1515
+ "description": "The select-all row in `multiple` mode, as the parent computes it (label,\ntri-state, counts for the live region); `null` renders no row",
1516
+ "value": {
1517
+ "type": "CDropdownSelectAllRow | null",
1518
+ "default": "null"
1519
+ }
1520
+ },
1503
1521
  {
1504
1522
  "name": "type",
1505
1523
  "description": "Parent type — drives autocomplete-only behaviour (highlight, messages)",
@@ -1533,6 +1551,11 @@
1533
1551
  "name": "selectOption",
1534
1552
  "type": "CustomEvent<{ name: string; value: number | string }>",
1535
1553
  "description": "Fired when the user selects an option row, carrying the option's name\nand value for the parent (c-select) to commit. Also dispatched as `select-option` — bind that name in Vue templates."
1554
+ },
1555
+ {
1556
+ "name": "selectall",
1557
+ "type": "CustomEvent<void>",
1558
+ "description": "Fired when the select-all row is activated; the parent (c-select) toggles\nevery listed enabled option."
1536
1559
  }
1537
1560
  ],
1538
1561
  "js": {
@@ -1549,7 +1572,7 @@
1549
1572
  },
1550
1573
  {
1551
1574
  "name": "index",
1552
- "description": "Current highlighted index",
1575
+ "description": "Current highlighted index; `-1` (`SELECT_ALL_INDEX`) is the select-all row",
1553
1576
  "type": "null | number"
1554
1577
  },
1555
1578
  {
@@ -1572,6 +1595,11 @@
1572
1595
  "description": "Dropdown parent (the c-select / c-autocomplete host element)",
1573
1596
  "type": "HTMLElement | null"
1574
1597
  },
1598
+ {
1599
+ "name": "selectAllRow",
1600
+ "description": "The select-all row in `multiple` mode, as the parent computes it (label,\ntri-state, counts for the live region); `null` renders no row",
1601
+ "type": "CDropdownSelectAllRow | null"
1602
+ },
1575
1603
  {
1576
1604
  "name": "selected",
1577
1605
  "description": "Values of the currently selected items in `multiple` mode; drives each\nrow's `aria-selected` and its indicator",
@@ -1593,6 +1621,11 @@
1593
1621
  "name": "selectOption",
1594
1622
  "type": "CustomEvent<{ name: string; value: number | string }>",
1595
1623
  "description": "Fired when the user selects an option row, carrying the option's name\nand value for the parent (c-select) to commit. Also dispatched as `select-option` — bind that name in Vue templates."
1624
+ },
1625
+ {
1626
+ "name": "selectall",
1627
+ "type": "CustomEvent<void>",
1628
+ "description": "Fired when the select-all row is activated; the parent (c-select) toggles\nevery listed enabled option."
1596
1629
  }
1597
1630
  ]
1598
1631
  }
@@ -3517,7 +3550,7 @@
3517
3550
  },
3518
3551
  {
3519
3552
  "name": "c-select",
3520
- "description": "A value-selection field: a readonly field that opens a listbox of options — slotted `c-option` elements or an `items` array — and holds the picked value, emitting the value events that back `v-model`.\n---\n\n\n### **Events:**\n - **changeValue** - Fired when the selection changes (an option is picked or the value is\ncleared), carrying the new value — the option's value, or the whole\n`{ name, value }` item when `return-object` is set; `null` when cleared.\nIn `multiple` mode the whole array of picked values, in pick order\n(`[]` when cleared). Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event dispatched alongside every value change so a\nplain `v-model` stays in sync. Carries no detail.\n- **update:value** - Fired alongside `changeValue` with the same detail — the `v-model`\ncontract.\n\n### **Methods:**\n - **reset()** - Reset select state\n\n### **Slots:**\n - **default** - Use c-option elements only\n- **pre** - Leading content forwarded to the inner c-input, rendered before the select's value\n- **post** - Trailing content forwarded to the inner c-input, rendered after the select's controls\n\n### **CSS Parts:**\n - **menu** - The dropdown surface (the positioned dialog) holding the field and the list\n- **list** - The scrolling listbox of options\n- **item** - One option row in the list. Any `part` attribute set on content inside a slotted `<c-option>` is exported too, so `c-select::part(<name>)` reaches the consumer's own option markup\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`\n- **tags** - The row of selected-value tags inside the field (`multiple` mode)\n- **tag** - One selected-value tag: the `c-tag` host, including the overflow tag\n- **tag-root** - The pill box inside each tag (the `c-tag` `root` part), for colours and borders",
3553
+ "description": "A value-selection field: a readonly field that opens a listbox of options — slotted `c-option` elements or an `items` array — and holds the picked value, emitting the value events that back `v-model`.\n---\n\n\n### **Events:**\n - **changeValue** - Fired when the selection changes (an option is picked or the value is\ncleared), carrying the new value — the option's value, or the whole\n`{ name, value }` item when `return-object` is set; `null` when cleared.\nIn `multiple` mode the whole array of picked values, in pick order\n(`[]` when cleared). Also dispatched as `change-value` — bind that name in Vue templates.\n- **input** - Native bubbling input event dispatched alongside every value change so a\nplain `v-model` stays in sync. Carries no detail.\n- **update:value** - Fired alongside `changeValue` with the same detail — the `v-model`\ncontract.\n\n### **Methods:**\n - **reset()** - Reset select state\n\n### **Slots:**\n - **default** - Use c-option elements only\n- **pre** - Leading content forwarded to the inner c-input, rendered before the select's value\n- **post** - Trailing content forwarded to the inner c-input, rendered after the select's controls\n\n### **CSS Parts:**\n - **menu** - The dropdown surface (the positioned dialog) holding the field and the list\n- **list** - The scrolling listbox of options\n- **item** - One option row in the list. Any `part` attribute set on content inside a slotted `<c-option>` is exported too, so `c-select::part(<name>)` reaches the consumer's own option markup\n- **select-all** - The pinned select-all row at the top of the list (`multiple` mode with `select-all`); carries the same indicator / mark parts as an option row\n- **indicator** - The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)\n- **mark** - The check glyph inside a row indicator; draws with `currentColor`\n- **tags** - The row of selected-value tags inside the field (`multiple` mode)\n- **tag** - One selected-value tag: the `c-tag` host, including the overflow tag\n- **tag-root** - The pill box inside each tag (the `c-tag` `root` part), for colours and borders",
3521
3554
  "doc-url": "",
3522
3555
  "attributes": [
3523
3556
  {
@@ -3605,6 +3638,11 @@
3605
3638
  "description": "Return object instead of value",
3606
3639
  "value": { "type": "boolean", "default": "false" }
3607
3640
  },
3641
+ {
3642
+ "name": "select-all",
3643
+ "description": "In `multiple` mode, pin a select-all row at the top of the list. Its\ncheckbox shows whether none, some or all enabled options are selected;\nactivating it selects every enabled option — or, when all are selected,\nunselects them. Ignored in single mode",
3644
+ "value": { "type": "boolean", "default": "false" }
3645
+ },
3608
3646
  {
3609
3647
  "name": "shadow",
3610
3648
  "description": "Shadow variant",
@@ -3741,6 +3779,11 @@
3741
3779
  "description": "Return object instead of value",
3742
3780
  "type": "boolean"
3743
3781
  },
3782
+ {
3783
+ "name": "selectAll",
3784
+ "description": "In `multiple` mode, pin a select-all row at the top of the list. Its\ncheckbox shows whether none, some or all enabled options are selected;\nactivating it selects every enabled option — or, when all are selected,\nunselects them. Ignored in single mode",
3785
+ "type": "boolean"
3786
+ },
3744
3787
  {
3745
3788
  "name": "shadow",
3746
3789
  "description": "Shadow variant",
@@ -5564,6 +5607,10 @@
5564
5607
  "description": "The scrollable options listbox"
5565
5608
  },
5566
5609
  { "name": "part(item)", "description": "One option row in the list" },
5610
+ {
5611
+ "name": "part(select-all)",
5612
+ "description": "The pinned select-all row at the top of the list (`multiple` mode with `select-all`); carries the same indicator / mark parts as an option row"
5613
+ },
5567
5614
  {
5568
5615
  "name": "part(indicator)",
5569
5616
  "description": "The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)"
@@ -5732,6 +5779,10 @@
5732
5779
  },
5733
5780
  { "name": "part(list)", "description": "The scrolling listbox" },
5734
5781
  { "name": "part(item)", "description": "One option row" },
5782
+ {
5783
+ "name": "part(select-all)",
5784
+ "description": "The pinned select-all row at the top of the list in `multiple` mode; carries the same indicator / mark parts as an option row"
5785
+ },
5735
5786
  {
5736
5787
  "name": "part(indicator)",
5737
5788
  "description": "The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together"
@@ -6022,6 +6073,10 @@
6022
6073
  "name": "part(item)",
6023
6074
  "description": "One option row in the list. Any `part` attribute set on content inside a slotted `<c-option>` is exported too, so `c-select::part(<name>)` reaches the consumer's own option markup"
6024
6075
  },
6076
+ {
6077
+ "name": "part(select-all)",
6078
+ "description": "The pinned select-all row at the top of the list (`multiple` mode with `select-all`); carries the same indicator / mark parts as an option row"
6079
+ },
6025
6080
  {
6026
6081
  "name": "part(indicator)",
6027
6082
  "description": "The decorative checkbox box on an option row in `multiple` mode; border, fill and glyph draw with `currentColor`, so `color` recolours them together (the c-checkbox recipe)"
@@ -102,6 +102,14 @@ export interface CAutocompleteProps {
102
102
  required?: boolean;
103
103
  /** Return object instead of value */
104
104
  returnObject?: boolean;
105
+ /**
106
+ * In `multiple` mode, pin a select-all row at the top of the list. Its
107
+ * checkbox shows whether none, some or all enabled options currently listed
108
+ * — the matches while a query is typed, the given `items` with `external` —
109
+ * are selected; activating it selects them all, or, when all are selected,
110
+ * unselects them. Ignored in single mode
111
+ */
112
+ selectAll?: boolean;
105
113
  /** Shadow variant */
106
114
  shadow?: boolean;
107
115
  /** Field height: the 44px default or the 36px `small` box */
@@ -142,6 +150,11 @@ export interface CAutocompleteTexts {
142
150
  remove?: (label: string) => string;
143
151
  /** Placeholder of the search input when the `placeholder` prop is empty. */
144
152
  searchPlaceholder?: string;
153
+ /**
154
+ * Label of the select-all row; receives the number of enabled options
155
+ * listed.
156
+ */
157
+ selectAll?: (count: number) => string;
145
158
  /**
146
159
  * Field text when `max-tags="0"` shows no tags; receives the selection
147
160
  * count.
@@ -182,6 +195,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CAutoc
182
195
  placeholder: string;
183
196
  required: boolean;
184
197
  returnObject: boolean;
198
+ selectAll: boolean;
185
199
  shadow: boolean;
186
200
  size: CFieldSize;
187
201
  texts: CAutocompleteTexts;
@@ -9,7 +9,7 @@ interface CDropdownProps {
9
9
  * @freeform
10
10
  */
11
11
  hostId?: string;
12
- /** Current highlighted index */
12
+ /** Current highlighted index; `-1` (`SELECT_ALL_INDEX`) is the select-all row */
13
13
  index?: null | number;
14
14
  /** Dropdown options: a NodeList of <c-option> or an array of items */
15
15
  items?: ArrayLike<DropdownItem>;
@@ -22,6 +22,11 @@ interface CDropdownProps {
22
22
  multiple?: boolean;
23
23
  /** Dropdown parent (the c-select / c-autocomplete host element) */
24
24
  parent?: HTMLElement | null;
25
+ /**
26
+ * The select-all row in `multiple` mode, as the parent computes it (label,
27
+ * tri-state, counts for the live region); `null` renders no row
28
+ */
29
+ selectAllRow?: CDropdownSelectAllRow | null;
25
30
  /**
26
31
  * Values of the currently selected items in `multiple` mode; drives each
27
32
  * row's `aria-selected` and its indicator
@@ -37,13 +42,23 @@ type DropdownItem = {
37
42
  selected?: boolean;
38
43
  value: number | string;
39
44
  };
40
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_15: {};
45
+ /**
46
+ * The select-all row as the parent computes it (ADR-0046): the label, the
47
+ * indicator's tri-state and the counts the live region speaks.
48
+ */
49
+ interface CDropdownSelectAllRow {
50
+ label: string;
51
+ selected: number;
52
+ state: 'all' | 'none' | 'some';
53
+ total: number;
54
+ }
55
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_20: {};
41
56
  type __VLS_Slots = {} & {
42
57
  default?: (props: typeof __VLS_1) => any;
43
58
  } & {
44
59
  'input-top'?: (props: typeof __VLS_3) => any;
45
60
  } & {
46
- 'input-bottom'?: (props: typeof __VLS_15) => any;
61
+ 'input-bottom'?: (props: typeof __VLS_20) => any;
47
62
  };
48
63
  declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
49
64
  close: () => void;
@@ -62,6 +77,7 @@ declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
62
77
  dropdownItemType: CDropdownItemType;
63
78
  index: null | number;
64
79
  parent: HTMLElement | null;
80
+ selectAllRow: CDropdownSelectAllRow | null;
65
81
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
66
82
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
67
83
  declare const _default: typeof __VLS_export;
@@ -70,6 +70,13 @@ export interface CSelectProps {
70
70
  required?: boolean;
71
71
  /** Return object instead of value */
72
72
  returnObject?: boolean;
73
+ /**
74
+ * In `multiple` mode, pin a select-all row at the top of the list. Its
75
+ * checkbox shows whether none, some or all enabled options are selected;
76
+ * activating it selects every enabled option — or, when all are selected,
77
+ * unselects them. Ignored in single mode
78
+ */
79
+ selectAll?: boolean;
73
80
  /** Shadow variant */
74
81
  shadow?: boolean;
75
82
  /** Field height: the 44px default or the 36px `small` box */
@@ -101,6 +108,11 @@ export interface CSelectTexts {
101
108
  more?: (count: number) => string;
102
109
  /** Accessible label of a tag's remove button; receives the option label. */
103
110
  remove?: (label: string) => string;
111
+ /**
112
+ * Label of the select-all row; receives the number of enabled options
113
+ * listed.
114
+ */
115
+ selectAll?: (count: number) => string;
104
116
  /**
105
117
  * Field text when `max-tags="0"` shows no tags; receives the selection
106
118
  * count.
@@ -139,6 +151,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CSelec
139
151
  placeholder: string;
140
152
  required: boolean;
141
153
  returnObject: boolean;
154
+ selectAll: boolean;
142
155
  shadow: boolean;
143
156
  size: CFieldSize;
144
157
  texts: CSelectTexts;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The select-all row (CONTEXT.md, ADR-0046): the selection maths `c-select`
3
+ * and `c-autocomplete` share in `multiple` mode.
4
+ *
5
+ * `listed` is the enabled options currently in the list, in list order —
6
+ * every option in c-select, the current matches in c-autocomplete; callers
7
+ * filter disabled options out first. Duplicate option values collapse in the
8
+ * Set maths, exactly as they do when a single row is toggled.
9
+ */
10
+ /** `c-select` ↔ `c-dropdown` `index` contract: the select-all row is highlighted. */
11
+ export declare const SELECT_ALL_INDEX = -1;
12
+ export type SelectAllState = 'all' | 'none' | 'some';
13
+ export interface SelectAllListedOption {
14
+ label: string;
15
+ value: number | string;
16
+ }
17
+ /** What the row's indicator shows: none, some (indeterminate) or all listed selected. */
18
+ export declare const selectAllState: (listed: readonly (number | string)[], selected: ReadonlySet<number | string>) => SelectAllState;
19
+ /**
20
+ * The next selection after the row is activated. Every listed option already
21
+ * selected → drop the listed values (the others keep their order); otherwise
22
+ * append the unselected listed options in list order (selection order,
23
+ * ADR-0044). `added` / `removed` let a caller keep per-value bookkeeping.
24
+ */
25
+ export declare const toggleAllValues: <T>(current: readonly T[], listed: readonly SelectAllListedOption[], valueOf: (v: T) => number | string, make: (o: SelectAllListedOption) => T) => {
26
+ added: SelectAllListedOption[];
27
+ next: T[];
28
+ removed: (number | string)[];
29
+ };
@@ -15,6 +15,12 @@ import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.v
15
15
  import type { CSelectItem, CToastMessage } from './types';
16
16
  type AccordionPrimitive = number | string;
17
17
  type AccordionValue = AccordionPrimitive | AccordionPrimitive[] | null;
18
+ interface CDropdownSelectAllRow {
19
+ label: string;
20
+ selected: number;
21
+ state: 'all' | 'none' | 'some';
22
+ total: number;
23
+ }
18
24
  type DropdownItem = {
19
25
  disabled?: boolean | string;
20
26
  name: string;
@@ -150,7 +156,7 @@ export interface CAutocompleteElementEventMap {
150
156
  'update:value': CustomEvent<CAutocompleteValue>;
151
157
  }
152
158
  /** A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options. */
153
- export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
159
+ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'placeholder' | 'required' | 'returnObject' | 'selectAll' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
154
160
  /** Make the selected value clearable */
155
161
  clearable?: boolean;
156
162
  /** Disable the input */
@@ -203,6 +209,14 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
203
209
  required?: boolean;
204
210
  /** Return object instead of value */
205
211
  returnObject?: boolean;
212
+ /**
213
+ * In `multiple` mode, pin a select-all row at the top of the list. Its
214
+ * checkbox shows whether none, some or all enabled options currently listed
215
+ * — the matches while a query is typed, the given `items` with `external` —
216
+ * are selected; activating it selects them all, or, when all are selected,
217
+ * unselects them. Ignored in single mode
218
+ */
219
+ selectAll?: boolean;
206
220
  /** Shadow variant */
207
221
  shadow?: boolean;
208
222
  /** Field height: the 44px default or the 36px `small` box */
@@ -516,13 +530,18 @@ export interface CDropdownElementEventMap {
516
530
  name: string;
517
531
  value: number | string;
518
532
  }>;
533
+ /**
534
+ * Fired when the select-all row is activated; the parent (c-select) toggles
535
+ * every listed enabled option.
536
+ */
537
+ selectall: CustomEvent<void>;
519
538
  }
520
- export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selected' | 'type'> {
539
+ export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selectAllRow' | 'selected' | 'type'> {
521
540
  /** Whether items are <c-option> elements or plain objects */
522
541
  dropdownItemType?: 'item' | 'option';
523
542
  /** Id used to build option/announce element ids */
524
543
  hostId?: string;
525
- /** Current highlighted index */
544
+ /** Current highlighted index; `-1` (`SELECT_ALL_INDEX`) is the select-all row */
526
545
  index?: null | number;
527
546
  /** Dropdown options: a NodeList of <c-option> or an array of items */
528
547
  items?: ArrayLike<DropdownItem>;
@@ -535,6 +554,11 @@ export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' |
535
554
  multiple?: boolean;
536
555
  /** Dropdown parent (the c-select / c-autocomplete host element) */
537
556
  parent?: HTMLElement | null;
557
+ /**
558
+ * The select-all row in `multiple` mode, as the parent computes it (label,
559
+ * tri-state, counts for the live region); `null` renders no row
560
+ */
561
+ selectAllRow?: CDropdownSelectAllRow | null;
538
562
  /**
539
563
  * Values of the currently selected items in `multiple` mode; drives each
540
564
  * row's `aria-selected` and its indicator
@@ -1091,7 +1115,7 @@ export interface CSelectElementEventMap {
1091
1115
  'update:value': CustomEvent<CSelectValue>;
1092
1116
  }
1093
1117
  /** A value-selection field: a readonly field that opens a listbox of options — slotted `c-option` elements or an `items` array — and holds the picked value, emitting the value events that back `v-model`. */
1094
- export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
1118
+ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'selectAll' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
1095
1119
  /** Make the selected value clearable */
1096
1120
  clearable?: boolean;
1097
1121
  /** Disable the input */
@@ -1138,6 +1162,13 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
1138
1162
  required?: boolean;
1139
1163
  /** Return object instead of value */
1140
1164
  returnObject?: boolean;
1165
+ /**
1166
+ * In `multiple` mode, pin a select-all row at the top of the list. Its
1167
+ * checkbox shows whether none, some or all enabled options are selected;
1168
+ * activating it selects every enabled option — or, when all are selected,
1169
+ * unselects them. Ignored in single mode
1170
+ */
1171
+ selectAll?: boolean;
1141
1172
  /** Shadow variant */
1142
1173
  shadow?: boolean;
1143
1174
  /** Field height: the 44px default or the 36px `small` box */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cscfi/csc-ui",
3
- "version": "4.0.0-alpha.12",
3
+ "version": "4.0.0-alpha.13",
4
4
  "description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/csc-ui.js",