@microsoft/fabric-slicers 3.1.0 → 4.0.0

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.
package/CHANGELOG CHANGED
@@ -5,6 +5,10 @@ All notable changes to `@microsoft/fabric-slicers` will be documented in this fi
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 4.0.0 - 2026-10-21
9
+
10
+ - BREAKING: Emit `fieldId` and tagged `InteractionValue` objects instead of `name` and raw values from public interaction callbacks.
11
+
8
12
  ## 3.1.0 - 2026-10-09
9
13
 
10
14
  - Use shared slicers for DataGrid column filtering
package/README.md CHANGED
@@ -31,7 +31,7 @@ Import components and types from `@microsoft/fabric-slicers`. All three componen
31
31
 
32
32
  `DataTable`, `VisualTheme`, and `InteractionEventCallback` come from `@microsoft/fabric-visuals-core`.
33
33
  `SlicerValue` supports strings, finite numbers, booleans, valid dates, `null`, and `undefined`.
34
- `isSlicerValue` validates untyped data cells or interaction values against that contract.
34
+ `isSlicerValue` validates untyped data cells against that contract.
35
35
  Table column formats apply to displayed values.
36
36
 
37
37
  ## List slicer
@@ -162,18 +162,25 @@ Keep selection arrays immutable and retain their reference on unrelated rerender
162
162
 
163
163
  Optional `onInteraction` uses `InteractionEventCallback` from `@microsoft/fabric-visuals-core`.
164
164
  List and Dropdown slicers emit one `select` event per checkbox or search-scoped Select all change,
165
- with a `set` predicate containing `column` as its name and the complete raw selected values.
165
+ with a `set` predicate whose `fieldId` is `column` and whose values are the complete selection as
166
+ `InteractionValue`s: `{ kind: 'value', value }` for raw values and `{ kind: 'blank' }` for blanks.
166
167
  An empty array selects nothing. Selecting all values or clearing emits `[{ action: 'clear' }]`.
168
+ Standalone list and dropdown slicers preserve valid `Date` objects in emitted values. Interaction
169
+ Manager requires semantic-model dates and datetimes as their original normalized strings and rejects
170
+ `Date` objects at that boundary.
167
171
 
168
172
  Range slicers emit `select` on drag release, keyboard changes, or valid input commits (Enter/blur).
169
173
  Unchanged, invalid, or cancelled edits do not emit.
170
174
 
171
- Range selections contain one inclusive `range` predicate using `column` and raw numeric bounds.
172
- Domain endpoints emit `min: -Infinity` or `max: Infinity` to leave that side unbounded.
173
- Encode infinities explicitly when serializing; `JSON.stringify` converts them to `null`.
175
+ Range selections contain one inclusive `range` predicate whose `fieldId` is `column`. Each bound is a
176
+ `RangeBoundary` (`{ kind: 'value', value }`). A bound at the data domain's edge is omitted to leave
177
+ that side unbounded.
174
178
 
175
179
  Clear or returning to the full range emits `[{ action: 'clear' }]`.
176
180
 
181
+ With Interaction Manager, slicers only report selections. They do not accept managed `selections`,
182
+ so a slicer does not show selections made by other sources.
183
+
177
184
  ## Theming
178
185
 
179
186
  Without `theme`, slicers use shared design tokens and host token overrides.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { getString as getString3 } from "@microsoft/fabric-visuals-core";
5
5
 
6
6
  // src/hooks/use-list-slicer.ts
7
7
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
- import { formatString, formatValue, getString, isDataTable } from "@microsoft/fabric-visuals-core";
8
+ import { formatString, formatValue, getString, isDataTable, toInteractionValue } from "@microsoft/fabric-visuals-core";
9
9
 
10
10
  // src/utils/slicer-value.ts
11
11
  function isSlicerValue(value) {
@@ -100,7 +100,13 @@ function useListSlicer({ data, column, title, selection, onInteraction }) {
100
100
  if (!onInteraction) return;
101
101
  const event = normalized === "all" ? { action: "clear" } : {
102
102
  action: "select",
103
- selections: [{ predicates: [{ type: "set", name: column, values: [...normalized.values()] }] }]
103
+ selections: [{
104
+ predicates: [{
105
+ type: "set",
106
+ fieldId: column,
107
+ values: [...normalized.values()].map(toInteractionValue)
108
+ }]
109
+ }]
104
110
  };
105
111
  onInteraction([event]);
106
112
  }, [column, onInteraction, prepared.items]);
@@ -524,7 +530,8 @@ function ListSlicerContent({
524
530
  const hideHeader = displayOptions?.hideHeader ?? false;
525
531
  const scrollRef = useRef3(null);
526
532
  const scrollStyle = useMemo2(
527
- () => ({ maxHeight: maxVisibleItems * ROW_HEIGHT }),
533
+ // Include Select all without reducing the initial number of visible values.
534
+ () => ({ maxHeight: (maxVisibleItems + 1) * ROW_HEIGHT }),
528
535
  [maxVisibleItems]
529
536
  );
530
537
  const [search, setSearch] = useState3("");
@@ -552,6 +559,7 @@ function ListSlicerContent({
552
559
  getScrollElement: () => scrollRef.current,
553
560
  estimateSize: () => ROW_HEIGHT,
554
561
  getItemKey: (index) => items[index].key,
562
+ scrollMargin: ROW_HEIGHT,
555
563
  overscan: 5,
556
564
  rangeExtractor: navigation.rangeExtractor,
557
565
  enabled: virtual
@@ -570,7 +578,7 @@ function ListSlicerContent({
570
578
  };
571
579
  const observer = new ResizeObserver(updateFade);
572
580
  observer.observe(scroll);
573
- if (scroll.firstElementChild) observer.observe(scroll.firstElementChild);
581
+ if (scroll.lastElementChild) observer.observe(scroll.lastElementChild);
574
582
  scroll.addEventListener("scroll", updateFade, { passive: true });
575
583
  updateFade();
576
584
  return () => {
@@ -619,33 +627,35 @@ function ListSlicerContent({
619
627
  }
620
628
  )
621
629
  ] }),
622
- /* @__PURE__ */ jsx4(
623
- ListSlicerRow,
624
- {
625
- className: styles.selectAll,
626
- label: getString3("Slicer_SelectAll"),
627
- checked,
628
- onToggle: toggleAll,
629
- disabled: items.length === 0,
630
- navigationIndex: -1,
631
- tabIndex: navigation.activeIndex === -1 && items.length > 0 ? 0 : -1
632
- }
633
- ),
634
- /* @__PURE__ */ jsx4("div", { ref: scrollRef, tabIndex: -1, className: mergeClasses(styles.scroll, hasMoreBelow && styles.scrollFade), style: scrollStyle, children: items.length === 0 ? /* @__PURE__ */ jsx4("div", { role: "status", className: styles.message, children: getString3(state.items.length === 0 ? "Slicer_NoData" : "Slicer_NoResults") }) : /* @__PURE__ */ jsx4("ul", { className: styles.list, style: listStyle, "aria-label": state.title, children: virtual ? virtualizer.getVirtualItems().map((row) => /* @__PURE__ */ jsx4("li", { "data-slicer-index": row.index, style: virtualRowStyle(row.start), "aria-posinset": row.index + 1, "aria-setsize": items.length, children: /* @__PURE__ */ jsx4(
635
- ItemRow,
636
- {
637
- item: items[row.index],
638
- state,
639
- tabIndex: row.index === navigation.activeIndex ? 0 : -1
640
- }
641
- ) }, row.key)) : items.map((item, index) => /* @__PURE__ */ jsx4("li", { "data-slicer-index": index, children: /* @__PURE__ */ jsx4(
642
- ItemRow,
643
- {
644
- item,
645
- state,
646
- tabIndex: index === navigation.activeIndex ? 0 : -1
647
- }
648
- ) }, item.key)) }) })
630
+ /* @__PURE__ */ jsxs3("div", { ref: scrollRef, tabIndex: -1, className: mergeClasses(styles.scroll, hasMoreBelow && styles.scrollFade), style: scrollStyle, children: [
631
+ /* @__PURE__ */ jsx4(
632
+ ListSlicerRow,
633
+ {
634
+ className: styles.selectAll,
635
+ label: getString3("Slicer_SelectAll"),
636
+ checked,
637
+ onToggle: toggleAll,
638
+ disabled: items.length === 0,
639
+ navigationIndex: -1,
640
+ tabIndex: navigation.activeIndex === -1 && items.length > 0 ? 0 : -1
641
+ }
642
+ ),
643
+ items.length === 0 ? /* @__PURE__ */ jsx4("div", { role: "status", className: styles.message, children: getString3(state.items.length === 0 ? "Slicer_NoData" : "Slicer_NoResults") }) : /* @__PURE__ */ jsx4("ul", { className: styles.list, style: listStyle, "aria-label": state.title, children: virtual ? virtualizer.getVirtualItems().map((row) => /* @__PURE__ */ jsx4("li", { "data-slicer-index": row.index, style: virtualRowStyle(row.start - ROW_HEIGHT), "aria-posinset": row.index + 1, "aria-setsize": items.length, children: /* @__PURE__ */ jsx4(
644
+ ItemRow,
645
+ {
646
+ item: items[row.index],
647
+ state,
648
+ tabIndex: row.index === navigation.activeIndex ? 0 : -1
649
+ }
650
+ ) }, row.key)) : items.map((item, index) => /* @__PURE__ */ jsx4("li", { "data-slicer-index": index, children: /* @__PURE__ */ jsx4(
651
+ ItemRow,
652
+ {
653
+ item,
654
+ state,
655
+ tabIndex: index === navigation.activeIndex ? 0 : -1
656
+ }
657
+ ) }, item.key)) })
658
+ ] })
649
659
  ] })
650
660
  }
651
661
  )
@@ -1301,9 +1311,9 @@ function useRangeSelection(domain, column, onInteraction, selection) {
1301
1311
  selections: [{
1302
1312
  predicates: [{
1303
1313
  type: "range",
1304
- name: column,
1305
- min: isLowerBoundAtDomainMinimum ? -Infinity : values[0],
1306
- max: isUpperBoundAtDomainMaximum ? Infinity : values[1]
1314
+ fieldId: column,
1315
+ ...isLowerBoundAtDomainMinimum ? {} : { min: { kind: "value", value: values[0] } },
1316
+ ...isUpperBoundAtDomainMaximum ? {} : { max: { kind: "value", value: values[1] } }
1307
1317
  }]
1308
1318
  }]
1309
1319
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/fabric-slicers",
3
3
  "description": "Slicer components for Fabric Apps - Analytics",
4
- "version": "3.1.0",
4
+ "version": "4.0.0",
5
5
  "author": "Microsoft",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -27,6 +27,6 @@
27
27
  "@tanstack/react-virtual": "^3.13.23",
28
28
  "radix-ui": "^1.6.7",
29
29
  "@radix-ui/react-slider": "^1.2.0",
30
- "@microsoft/fabric-visuals-core": "4.4.0"
30
+ "@microsoft/fabric-visuals-core": "5.0.0"
31
31
  }
32
32
  }