@microsoft/fabric-slicers 4.1.0 → 4.3.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,18 @@ 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.3.0 - 2026-11-11
9
+
10
+ - Fix duplicate slicer search focus indicators
11
+ - Identify list and dropdown slicer items by group-on keys
12
+
13
+ ## 4.2.0 - 2026-11-05
14
+
15
+ - Update date slicer dropdown formatting and preset labels
16
+ - [Slicers] Use browser-style focus for controls and rows
17
+ - [Slicers] Bug fix for drop down slicer frameless prop
18
+ - Upgrade jsdom to 30.1.3 to resolve undici TLS renegotiation DoS
19
+
8
20
  ## 4.1.0 - 2026-10-28
9
21
 
10
22
  - Add month and year range selection to DateSlicer
package/dist/index.d.ts CHANGED
@@ -34,12 +34,28 @@ interface ListSlicerDisplayOptions extends SlicerDisplayOptions {
34
34
  interface ListSlicerInputParams extends SlicerInputParams {
35
35
  displayOptions?: ListSlicerDisplayOptions;
36
36
  /**
37
- * Raw selected values to restore or synchronize without emitting events.
37
+ * DataTable columns that identify an item, such as the group-on keys from InteractionManager.getIdentityFields([column]).
38
+ * An item is one combination of the `column` value and these columns' values, so two items can share a label.
39
+ * Each selected item is emitted as its own selection with one value for `column` and for each key column.
40
+ * Omitted, empty, or only `column` keeps one item per value. Changing it resets local selection.
41
+ */
42
+ keyColumns?: readonly string[];
43
+ /**
44
+ * Selected values to restore or synchronize without emitting events.
38
45
  * Null resets to all, including future values. An empty array selects none.
39
46
  * Selected values absent from refreshed data are retained until changed or cleared.
40
47
  * Omitted leaves selection locally managed; supplying values does not disable local edits.
48
+ * With key columns, pass keyed items; raw values throw, since a label alone can't identify one item.
49
+ * Keyed items given to a slicer without key columns select by `label`.
41
50
  */
42
- selection?: readonly SlicerValue[] | null;
51
+ selection?: readonly SlicerValue[] | readonly SlicerKeyedItem[] | null;
52
+ }
53
+ /** One selected item of a list or dropdown slicer with key columns. */
54
+ interface SlicerKeyedItem {
55
+ /** Values of the key columns other than the slicer's `column`, by column name. Other entries are ignored. */
56
+ readonly keys: Readonly<Record<string, SlicerValue>>;
57
+ /** Value of the slicer's `column`. It is emitted with the keys, including while the item is absent from the data. */
58
+ readonly label: SlicerValue;
43
59
  }
44
60
  /** Inputs for the dropdown slicer. */
45
61
  interface DropdownSlicerInputParams extends ListSlicerInputParams {
@@ -108,4 +124,4 @@ declare function RangeSlicer({ data, column, title, theme, step, disabled, displ
108
124
  /** Narrows unvalidated data cells and interaction values to supported slicer values. */
109
125
  declare function isSlicerValue(value: DataTable['rows'][number][number]): value is SlicerValue;
110
126
 
111
- export { type CalendarDateRange, DateSlicer, type DateSlicerDisplayOptions, type DateSlicerInputParams, DropdownSlicer, type DropdownSlicerInputParams, ListSlicer, type ListSlicerDisplayOptions, type ListSlicerInputParams, RangeSlicer, type RangeSlicerDisplayOptions, type RangeSlicerInputParams, type SlicerDisplayOptions, type SlicerInputParams, type SlicerRange, type SlicerValue, isSlicerValue };
127
+ export { type CalendarDateRange, DateSlicer, type DateSlicerDisplayOptions, type DateSlicerInputParams, DropdownSlicer, type DropdownSlicerInputParams, ListSlicer, type ListSlicerDisplayOptions, type ListSlicerInputParams, RangeSlicer, type RangeSlicerDisplayOptions, type RangeSlicerInputParams, type SlicerDisplayOptions, type SlicerInputParams, type SlicerKeyedItem, type SlicerRange, type SlicerValue, isSlicerValue };
package/dist/index.js CHANGED
@@ -13,26 +13,53 @@ function isSlicerValue(value) {
13
13
  }
14
14
 
15
15
  // src/hooks/use-list-slicer.ts
16
+ var noKeyValues = Object.freeze([]);
17
+ var invalidSelectionMessage = "Slicer selection must contain text, finite numbers, booleans, valid dates, or blanks.";
16
18
  function valueKey(value) {
17
19
  if (value == null) return "blank";
18
20
  if (value instanceof Date) return `date:${value.getTime()}`;
19
21
  return `${typeof value}:${String(value)}`;
20
22
  }
21
- function prepareListSlicerData({ data, column, title }) {
23
+ function itemKey(value, keyValues) {
24
+ if (keyValues.length === 0) return valueKey(value);
25
+ return JSON.stringify([value, ...keyValues].map(valueKey));
26
+ }
27
+ function getListSlicerIdentityKey({ column, keyColumns }) {
28
+ return JSON.stringify([column, keyColumns ?? []]);
29
+ }
30
+ function getOtherKeyColumns(column, serializedKeyColumns) {
31
+ const keyColumns = JSON.parse(serializedKeyColumns);
32
+ return [...new Set(keyColumns)].filter((keyColumn) => keyColumn !== column);
33
+ }
34
+ function prepareListSlicerData({ data, column, title }, otherKeyColumns) {
22
35
  let resolvedTitle = title ?? column;
23
36
  let format;
24
37
  let valueCount;
25
38
  let valueAt;
39
+ let keyValuesAt = () => noKeyValues;
26
40
  if (isDataTable(data)) {
27
41
  const columnIndex = data.columns.findIndex((candidate) => candidate.name === column);
28
42
  if (columnIndex < 0) {
29
43
  return { title: resolvedTitle, items: [], error: formatString("Slicer_MissingColumn", column) };
30
44
  }
31
45
  resolvedTitle = title ?? data.columns[columnIndex].displayName ?? column;
46
+ const keyIndexes = otherKeyColumns.map(
47
+ (keyColumn) => data.columns.findIndex((candidate) => candidate.name === keyColumn)
48
+ );
49
+ const missingKeyIndex = keyIndexes.indexOf(-1);
50
+ if (missingKeyIndex >= 0) {
51
+ return { title: resolvedTitle, items: [], error: formatString("Slicer_MissingColumn", otherKeyColumns[missingKeyIndex]) };
52
+ }
32
53
  format = data.columns[columnIndex].format;
33
54
  valueCount = data.rows.length;
34
55
  valueAt = (index) => data.rows[index][columnIndex];
56
+ if (keyIndexes.length > 0) {
57
+ keyValuesAt = (index) => keyIndexes.map((keyIndex) => data.rows[index][keyIndex]);
58
+ }
35
59
  } else if (Array.isArray(data)) {
60
+ if (otherKeyColumns.length > 0) {
61
+ return { title: resolvedTitle, items: [], error: formatString("Slicer_MissingColumn", otherKeyColumns[0]) };
62
+ }
36
63
  valueCount = data.length;
37
64
  valueAt = (index) => data[index];
38
65
  } else {
@@ -42,41 +69,84 @@ function prepareListSlicerData({ data, column, title }) {
42
69
  const seenKeys = /* @__PURE__ */ new Set();
43
70
  for (let index = 0; index < valueCount; index++) {
44
71
  const value = valueAt(index);
45
- if (!isSlicerValue(value)) {
72
+ const keyValues = keyValuesAt(index);
73
+ if (!isSlicerValue(value) || !keyValues.every(isSlicerValue)) {
46
74
  return { title: resolvedTitle, items: [], error: getString("Slicer_InvalidData") };
47
75
  }
48
- const key = valueKey(value);
76
+ const key = itemKey(value, keyValues);
49
77
  if (seenKeys.has(key)) continue;
50
78
  seenKeys.add(key);
51
79
  const label = value == null || value === "" ? getString("Slicer_Blank") : String(formatValue(value, format));
52
- items.push({ key, value, label });
80
+ items.push({ key, value, keyValues, label });
53
81
  }
54
82
  return { title: resolvedTitle, items };
55
83
  }
56
- function useListSlicer({ data, column, title, selection, onInteraction }) {
84
+ function resolveKeyedItem(entry, otherKeyColumns) {
85
+ if (typeof entry !== "object" || entry instanceof Date || !isSlicerValue(entry.label)) {
86
+ throw new Error(invalidSelectionMessage);
87
+ }
88
+ const keyValues = otherKeyColumns.map((keyColumn) => {
89
+ if (!Object.hasOwn(entry.keys, keyColumn)) {
90
+ throw new Error(`Slicer selection item is missing key column ${JSON.stringify(keyColumn)}.`);
91
+ }
92
+ const keyValue = entry.keys[keyColumn];
93
+ if (!isSlicerValue(keyValue)) throw new Error(invalidSelectionMessage);
94
+ return keyValue;
95
+ });
96
+ return { value: entry.label, keyValues };
97
+ }
98
+ function resolveHostSelection(selection, otherKeyColumns) {
99
+ const resolved = /* @__PURE__ */ new Map();
100
+ for (const entry of selection) {
101
+ let selected;
102
+ if (isSlicerValue(entry)) {
103
+ if (otherKeyColumns.length > 0) {
104
+ throw new Error("Slicer selection must contain keyed items, not raw values, when the slicer has key columns.");
105
+ }
106
+ selected = { value: entry, keyValues: noKeyValues };
107
+ } else {
108
+ selected = resolveKeyedItem(entry, otherKeyColumns);
109
+ }
110
+ const key = itemKey(selected.value, selected.keyValues);
111
+ if (!resolved.has(key)) resolved.set(key, selected);
112
+ }
113
+ return resolved;
114
+ }
115
+ function toSemanticSelections(column, otherKeyColumns, selected) {
116
+ const items = [...selected.values()];
117
+ if (otherKeyColumns.length === 0) {
118
+ return [{ predicates: [{ type: "set", fieldId: column, values: items.map((item) => toInteractionValue(item.value)) }] }];
119
+ }
120
+ return items.map((item) => ({
121
+ predicates: [
122
+ { type: "set", fieldId: column, values: [toInteractionValue(item.value)] },
123
+ ...otherKeyColumns.map((keyColumn, index) => ({
124
+ type: "set",
125
+ fieldId: keyColumn,
126
+ values: [toInteractionValue(item.keyValues[index])]
127
+ }))
128
+ ]
129
+ }));
130
+ }
131
+ function useListSlicer({ data, column, title, keyColumns, selection, onInteraction }) {
132
+ const serializedKeyColumns = JSON.stringify(keyColumns ?? []);
133
+ const otherKeyColumns = useMemo(
134
+ () => getOtherKeyColumns(column, serializedKeyColumns),
135
+ [column, serializedKeyColumns]
136
+ );
57
137
  const prepared = useMemo(
58
- () => prepareListSlicerData({ data, column, title }),
59
- [data, column, title]
138
+ () => prepareListSlicerData({ data, column, title }, otherKeyColumns),
139
+ [data, column, title, otherKeyColumns]
60
140
  );
61
- const valuesByKey = useMemo(
62
- () => new Map(prepared.items.map((item) => [item.key, item.value])),
141
+ const itemsByKey = useMemo(
142
+ () => new Map(prepared.items.map((item) => [item.key, item])),
63
143
  [prepared.items]
64
144
  );
65
145
  const resolvedSelection = useMemo(() => {
66
- if (selection !== void 0) {
67
- if (selection === null) return "all";
68
- if (!selection.every(isSlicerValue)) {
69
- throw new Error("Slicer selection must contain text, finite numbers, booleans, valid dates, or blanks.");
70
- }
71
- const resolved = /* @__PURE__ */ new Map();
72
- for (const value of selection) {
73
- const key = valueKey(value);
74
- if (!resolved.has(key)) resolved.set(key, value);
75
- }
76
- return resolved;
77
- }
78
- return void 0;
79
- }, [selection]);
146
+ if (selection === void 0) return void 0;
147
+ if (selection === null) return "all";
148
+ return resolveHostSelection(selection, otherKeyColumns);
149
+ }, [selection, otherKeyColumns]);
80
150
  const [localSelection, setLocalSelection] = useState(resolvedSelection ?? "all");
81
151
  const selectionRef = useRef(resolvedSelection ?? "all");
82
152
  useEffect(() => {
@@ -97,42 +167,35 @@ function useListSlicer({ data, column, title, selection, onInteraction }) {
97
167
  selectionRef.current = next;
98
168
  setLocalSelection(next);
99
169
  if (!onInteraction) return;
100
- const event = next === "all" || next.size === 0 ? { action: "clear" } : {
101
- action: "select",
102
- selections: [{
103
- predicates: [{
104
- type: "set",
105
- fieldId: column,
106
- values: [...next.values()].map(toInteractionValue)
107
- }]
108
- }]
109
- };
170
+ const event = next === "all" || next.size === 0 ? { action: "clear" } : { action: "select", selections: toSemanticSelections(column, otherKeyColumns, next) };
110
171
  onInteraction([event]);
111
- }, [column, onInteraction]);
172
+ }, [column, otherKeyColumns, onInteraction]);
112
173
  const updateSelection = useCallback((next) => {
113
174
  const normalized = next !== "all" && prepared.items.length > 0 && next.size >= prepared.items.length && prepared.items.every((item) => next.has(item.key)) ? "all" : next;
114
175
  commitSelection(normalized);
115
176
  }, [commitSelection, prepared.items]);
116
177
  const selectOnly = useCallback((key) => {
117
- if (!valuesByKey.has(key)) throw new Error(`Cannot update an unknown slicer key: ${key}`);
178
+ const item = itemsByKey.get(key);
179
+ if (item === void 0) throw new Error(`Cannot update an unknown slicer key: ${key}`);
118
180
  const previous = selectionRef.current;
119
181
  if (previous !== "all" && previous.size === 1 && previous.has(key)) return;
120
- commitSelection(/* @__PURE__ */ new Map([[key, valuesByKey.get(key)]]));
121
- }, [valuesByKey, commitSelection]);
182
+ commitSelection(/* @__PURE__ */ new Map([[key, item]]));
183
+ }, [itemsByKey, commitSelection]);
122
184
  const clear = useCallback(() => {
123
185
  if (selectionRef.current !== "all") updateSelection("all");
124
186
  }, [updateSelection]);
125
187
  const toggle = useCallback((key, checked) => {
126
- if (!valuesByKey.has(key)) throw new Error(`Cannot update an unknown slicer key: ${key}`);
188
+ const item = itemsByKey.get(key);
189
+ if (item === void 0) throw new Error(`Cannot update an unknown slicer key: ${key}`);
127
190
  const previous = selectionRef.current;
128
191
  if ((previous === "all" || previous.has(key)) === checked) return;
129
- const next = new Map(previous === "all" ? valuesByKey : previous);
130
- if (checked) next.set(key, valuesByKey.get(key));
192
+ const next = new Map(previous === "all" ? itemsByKey : previous);
193
+ if (checked) next.set(key, item);
131
194
  else next.delete(key);
132
195
  updateSelection(next);
133
- }, [valuesByKey, updateSelection]);
196
+ }, [itemsByKey, updateSelection]);
134
197
  const toggleAll = useCallback((checked, keys) => {
135
- if (valuesByKey.size === 0 || keys?.length === 0) return;
198
+ if (itemsByKey.size === 0 || keys?.length === 0) return;
136
199
  if (keys === void 0 && checked) {
137
200
  clear();
138
201
  return;
@@ -143,15 +206,16 @@ function useListSlicer({ data, column, title, selection, onInteraction }) {
143
206
  return;
144
207
  }
145
208
  let next;
146
- for (const key of keys ?? valuesByKey.keys()) {
147
- if (!valuesByKey.has(key)) throw new Error(`Cannot update an unknown slicer key: ${key}`);
209
+ for (const key of keys ?? itemsByKey.keys()) {
210
+ const item = itemsByKey.get(key);
211
+ if (item === void 0) throw new Error(`Cannot update an unknown slicer key: ${key}`);
148
212
  if ((previous === "all" || previous.has(key)) === checked) continue;
149
- next ??= new Map(previous === "all" ? valuesByKey : previous);
150
- if (checked) next.set(key, valuesByKey.get(key));
213
+ next ??= new Map(previous === "all" ? itemsByKey : previous);
214
+ if (checked) next.set(key, item);
151
215
  else next.delete(key);
152
216
  }
153
217
  if (next) updateSelection(next);
154
- }, [valuesByKey, clear, updateSelection]);
218
+ }, [itemsByKey, clear, updateSelection]);
155
219
  return {
156
220
  ...prepared,
157
221
  selectedItems,
@@ -253,11 +317,7 @@ var useSlicerStyles = makeStyles(inVisualsLayer({
253
317
  fontWeight: `var(--slicer-weight, ${tokens.fontWeightRegular})`,
254
318
  color: `var(--slicer-foreground, ${tokens.colorForeground})`,
255
319
  lineHeight: "20px",
256
- "& button, & input": { fontFamily: "inherit", fontSize: "inherit" },
257
- "& button:focus-visible, & input:focus-visible": {
258
- outline: `2px solid var(--slicer-link, ${tokens.colorBrandForeground})`,
259
- outlineOffset: "2px"
260
- }
320
+ "& button, & input": { fontFamily: "inherit", fontSize: "inherit" }
261
321
  },
262
322
  root: { display: "flex", flexDirection: "column", gap: "8px", minWidth: 0, minHeight: 0, width: "100%" },
263
323
  fillHeight: { height: "100%", maxHeight: "100%" },
@@ -280,10 +340,6 @@ var useSlicerStyles = makeStyles(inVisualsLayer({
280
340
  fontFamily: "inherit",
281
341
  fontSize: "12px",
282
342
  flexShrink: 0,
283
- ":focus-visible": {
284
- outline: `2px solid var(--slicer-link, ${tokens.colorBrandForeground})`,
285
- outlineOffset: "2px"
286
- },
287
343
  ":disabled": { opacity: 0.5, cursor: "default" }
288
344
  },
289
345
  clearHidden: { visibility: "hidden" },
@@ -412,6 +468,12 @@ function CalendarIcon({ className }) {
412
468
  // src/components/list-slicer/list-slicer-styles.ts
413
469
  import { makeStyles as makeStyles3 } from "@griffel/react";
414
470
  import { inVisualsLayer as inVisualsLayer3, tokens as tokens3 } from "@microsoft/fabric-visuals-core";
471
+ var nativeFocusOutline = {
472
+ outline: "1px auto",
473
+ outlineColor: "-webkit-focus-ring-color",
474
+ // Wrappers otherwise receive CanvasText instead of the control's system focus color.
475
+ "@media (forced-colors: active)": { outlineColor: "Highlight" }
476
+ };
415
477
  var useListSlicerStyles = makeStyles3(inVisualsLayer3({
416
478
  // Without panel padding, outward focus rings need visible overflow; the value list owns scrolling.
417
479
  frameless: { border: 0, borderRadius: 0, padding: 0, backgroundColor: "transparent", overflow: "visible" },
@@ -426,10 +488,11 @@ var useListSlicerStyles = makeStyles3(inVisualsLayer3({
426
488
  padding: "4px 8px",
427
489
  marginBottom: "4px",
428
490
  color: `var(--slicer-secondary, ${tokens3.colorMutedForeground})`,
429
- ":focus-within": {
430
- outline: `2px solid var(--slicer-link, ${tokens3.colorBrandForeground})`,
431
- outlineOffset: "1px",
432
- "& > input:focus-visible": { outline: "none" }
491
+ // Draw the browser's focus ring around the icon and input without adding a Tab stop.
492
+ ":has(> input:focus-visible)": {
493
+ ...nativeFocusOutline,
494
+ // The wrapper owns focus; host focus rules must not add an inner outline or shadow ring.
495
+ "& > input": { outline: "none !important", boxShadow: "none !important" }
433
496
  }
434
497
  },
435
498
  input: {
@@ -485,6 +548,12 @@ var useListSlicerStyles = makeStyles3(inVisualsLayer3({
485
548
  minWidth: 0,
486
549
  position: "relative",
487
550
  ":hover": { backgroundColor: `var(--slicer-hover, ${tokens3.colorHover})` },
551
+ ':has(> [role="checkbox"]:focus-visible)': {
552
+ ...nativeFocusOutline,
553
+ // Keep the full checkbox-and-label ring inside the scrolling viewport.
554
+ outlineOffset: "-2px",
555
+ '& > [role="checkbox"]': { outline: "none" }
556
+ },
488
557
  "&:hover > [data-slicer-only], &:has(:focus-visible) > [data-slicer-only]": { position: "static", opacity: 1, pointerEvents: "auto" }
489
558
  },
490
559
  selectAll: { flexShrink: 0, fontWeight: 600 },
@@ -580,7 +649,7 @@ function virtualRowStyle(start) {
580
649
  return { position: "absolute", top: 0, left: 0, width: "100%", height: ROW_HEIGHT, transform: `translateY(${start}px)` };
581
650
  }
582
651
  function ListSlicer(props) {
583
- return /* @__PURE__ */ jsx4(StatefulListSlicer, { ...props }, props.column);
652
+ return /* @__PURE__ */ jsx4(StatefulListSlicer, { ...props }, getListSlicerIdentityKey(props));
584
653
  }
585
654
  function StatefulListSlicer(props) {
586
655
  const state = useListSlicer(props);
@@ -753,6 +822,7 @@ var usePopoverStyles = makeStyles4(inVisualsLayer4({
753
822
  outline: "none",
754
823
  zIndex: 1e3,
755
824
  borderRadius: `var(--slicer-radius, ${tokens4.radiusXl})`,
825
+ backgroundColor: `var(--slicer-background, ${tokens4.colorBackground})`,
756
826
  boxShadow: "0 2px 6px rgba(0, 0, 0, 0.16)"
757
827
  }
758
828
  }));
@@ -800,7 +870,7 @@ var useDropdownStyles = makeStyles5(inVisualsLayer5({
800
870
  // src/components/dropdown-slicer/dropdown-slicer.tsx
801
871
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
802
872
  function DropdownSlicer(props) {
803
- return /* @__PURE__ */ jsx6(DropdownSlicerContent, { ...props }, props.column);
873
+ return /* @__PURE__ */ jsx6(DropdownSlicerContent, { ...props }, getListSlicerIdentityKey(props));
804
874
  }
805
875
  function DropdownSlicerContent(props) {
806
876
  const state = useListSlicer(props);
@@ -1157,7 +1227,16 @@ import { compareCalendarDates as compareCalendarDates2 } from "@microsoft/fabric
1157
1227
 
1158
1228
  // src/components/date-slicer/date-slicer-utils.ts
1159
1229
  import { UTCDate } from "@date-fns/utc";
1160
- import { compareCalendarDates, formatCalendarDate, formatString as formatString6, getString as getString6, isValidCalendarDate, parseCalendarDate } from "@microsoft/fabric-visuals-core";
1230
+ import { compareCalendarDates, formatCalendarDate, formatString as formatString6, formatValue as formatValue2, getString as getString6, isValidCalendarDate, parseCalendarDate } from "@microsoft/fabric-visuals-core";
1231
+ var dateSlicerPresetLabels = {
1232
+ last7Days: "DateSlicer_Last7Days",
1233
+ last30Days: "DateSlicer_Last30Days",
1234
+ monthToDate: "DateSlicer_MonthToDate",
1235
+ lastMonth: "DateSlicer_LastMonth",
1236
+ quarterToDate: "DateSlicer_QuarterToDate",
1237
+ lastQuarter: "DateSlicer_LastQuarter",
1238
+ yearToDate: "DateSlicer_YearToDate"
1239
+ };
1161
1240
  function isValidRange(range) {
1162
1241
  return range.every((date) => isValidCalendarDate(date.year, date.month, date.day)) && compareCalendarDates(range[0], range[1]) <= 0;
1163
1242
  }
@@ -1200,7 +1279,17 @@ function datePeriodRange(date, period) {
1200
1279
  normalizeCalendarDate(date.year, lastMonth + 1, 0)
1201
1280
  ];
1202
1281
  }
1203
- function dateSummary(day) {
1282
+ function dateSummary(day, columnFormat) {
1283
+ if (columnFormat?.trim()) {
1284
+ const normalizedFormat = columnFormat.trim().toLowerCase();
1285
+ let dateFormat = columnFormat;
1286
+ if (normalizedFormat === "short date" || normalizedFormat === "general date") {
1287
+ dateFormat = "m/d/yyyy";
1288
+ } else if (normalizedFormat === "long date") {
1289
+ dateFormat = "dddd, mmmm d, yyyy";
1290
+ }
1291
+ return String(formatValue2(toDayPickerDate(day), dateFormat));
1292
+ }
1204
1293
  return formatString6("DateSlicer_DateSummary", day.month, day.day, String(day.year).padStart(4, "0"));
1205
1294
  }
1206
1295
  function parseSelectionDate(value) {
@@ -1685,13 +1774,13 @@ import { useCallback as useCallback7, useState as useState6 } from "react";
1685
1774
  import { getString as getString9 } from "@microsoft/fabric-visuals-core";
1686
1775
  import { jsx as jsx10 } from "react/jsx-runtime";
1687
1776
  var presets = [
1688
- { id: "last7Days", label: "DateSlicer_Last7Days" },
1689
- { id: "last30Days", label: "DateSlicer_Last30Days" },
1690
- { id: "monthToDate", label: "DateSlicer_MonthToDate" },
1691
- { id: "lastMonth", label: "DateSlicer_LastMonth" },
1692
- { id: "quarterToDate", label: "DateSlicer_QuarterToDate" },
1693
- { id: "lastQuarter", label: "DateSlicer_LastQuarter" },
1694
- { id: "yearToDate", label: "DateSlicer_YearToDate" }
1777
+ "last7Days",
1778
+ "last30Days",
1779
+ "monthToDate",
1780
+ "lastMonth",
1781
+ "quarterToDate",
1782
+ "lastQuarter",
1783
+ "yearToDate"
1695
1784
  ];
1696
1785
  function DateSlicerPresetButton({ id, label, isDisabled, isSelected, onSelect }) {
1697
1786
  const styles = useDateSlicerDropdownStyles();
@@ -1717,15 +1806,15 @@ function DateSlicerPresetList({ domain, committedRange, selectedPreset, onSelect
1717
1806
  const range = resolveDatePreset(id, currentToday, domain);
1718
1807
  if (range) onSelect(id, range);
1719
1808
  }, [domain, onSelect]);
1720
- const hasApplicablePreset = presets.some(({ id }) => resolveDatePreset(id, today, domain) !== void 0);
1721
- return hasApplicablePreset ? /* @__PURE__ */ jsx10("div", { className: styles.presets, role: "group", "aria-label": getString9("DateSlicer_Presets"), children: presets.map(({ id, label }) => {
1809
+ const hasApplicablePreset = presets.some((id) => resolveDatePreset(id, today, domain) !== void 0);
1810
+ return hasApplicablePreset ? /* @__PURE__ */ jsx10("div", { className: styles.presets, role: "group", "aria-label": getString9("DateSlicer_Presets"), children: presets.map((id) => {
1722
1811
  const range = resolveDatePreset(id, today, domain);
1723
1812
  const isSelected = id === selectedPreset && range !== void 0 && dateRangesEqual(range, committedRange);
1724
1813
  return /* @__PURE__ */ jsx10(
1725
1814
  DateSlicerPresetButton,
1726
1815
  {
1727
1816
  id,
1728
- label,
1817
+ label: dateSlicerPresetLabels[id],
1729
1818
  isDisabled: !range,
1730
1819
  isSelected,
1731
1820
  onSelect: selectPreset
@@ -1871,7 +1960,11 @@ function DateSlicerContent({
1871
1960
  const hideHeader = displayOptions?.hideHeader ?? false;
1872
1961
  const showPresets = displayOptions?.showPresets ?? true;
1873
1962
  const displayTitle = title ?? slicerData.title;
1874
- const summary = committedRange ? formatString9("DateSlicer_RangeSummary", dateSummary(committedRange[0]), dateSummary(committedRange[1])) : getString10("DateSlicer_AllDates");
1963
+ const summary = committedRange ? selectedPreset ? getString10(dateSlicerPresetLabels[selectedPreset]) : formatString9(
1964
+ "DateSlicer_RangeSummary",
1965
+ dateSummary(committedRange[0], slicerData.format),
1966
+ dateSummary(committedRange[1], slicerData.format)
1967
+ ) : getString10("DateSlicer_AllDates");
1875
1968
  const handleOpenChange = useCallback9((open) => {
1876
1969
  setIsOpen(open);
1877
1970
  if (!open) cancelDraft();
@@ -1949,7 +2042,7 @@ function DateSlicerContent({
1949
2042
  // src/components/range-slicer/range-slicer.tsx
1950
2043
  import { useCallback as useCallback13, useId as useId6, useMemo as useMemo10 } from "react";
1951
2044
  import { mergeClasses as mergeClasses3 } from "@griffel/react";
1952
- import { formatNumericInput, formatString as formatString14, formatValue as formatValue2, getString as getString11, parseNumericInput } from "@microsoft/fabric-visuals-core";
2045
+ import { formatNumericInput, formatString as formatString14, formatValue as formatValue3, getString as getString11, parseNumericInput } from "@microsoft/fabric-visuals-core";
1953
2046
 
1954
2047
  // src/components/range-slicer/range-slicer-data.ts
1955
2048
  import { formatString as formatString10, isDataTable as isDataTable2 } from "@microsoft/fabric-visuals-core";
@@ -2119,7 +2212,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2119
2212
  width: spacing3.xxl,
2120
2213
  height: spacing3.xxl,
2121
2214
  borderRadius: borderRadius3.circular,
2122
- outline: "none",
2123
2215
  forcedColorAdjust: "none",
2124
2216
  // Draw a small visible handle while retaining a larger pointer target.
2125
2217
  "::before": {
@@ -2132,10 +2224,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2132
2224
  },
2133
2225
  ":hover::before": {
2134
2226
  borderWidth: "2px"
2135
- },
2136
- ":focus-visible": {
2137
- outline: "2px solid var(--range-accent)",
2138
- outlineOffset: "1px"
2139
2227
  }
2140
2228
  },
2141
2229
  inputs: {
@@ -2157,10 +2245,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2157
2245
  fontFamily: "inherit",
2158
2246
  fontSize: "inherit",
2159
2247
  fontVariantNumeric: "tabular-nums",
2160
- ":focus-visible": {
2161
- outline: "2px solid var(--range-accent)",
2162
- outlineOffset: "1px"
2163
- },
2164
2248
  ":disabled": {
2165
2249
  color: "var(--range-secondary)",
2166
2250
  cursor: "not-allowed"
@@ -2168,7 +2252,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2168
2252
  '&[aria-invalid="true"]': {
2169
2253
  ...shorthands2.borderColor("var(--range-error)"),
2170
2254
  color: "var(--range-error)",
2171
- outlineColor: "var(--range-error)",
2172
2255
  boxShadow: "0 0 0 3px color-mix(in srgb, var(--range-error) 20%, transparent)"
2173
2256
  }
2174
2257
  },
@@ -2206,7 +2289,7 @@ function RangeValueInput({
2206
2289
  max,
2207
2290
  disabled,
2208
2291
  descriptionId,
2209
- formatValue: formatValue3,
2292
+ formatValue: formatValue4,
2210
2293
  parseValue,
2211
2294
  onCommit
2212
2295
  }) {
@@ -2227,9 +2310,9 @@ function RangeValueInput({
2227
2310
  setDraft(void 0);
2228
2311
  setError(void 0);
2229
2312
  } else {
2230
- setError(formatString11("RangeSlicer_InvalidValue", formatValue3(min), formatValue3(max)));
2313
+ setError(formatString11("RangeSlicer_InvalidValue", formatValue4(min), formatValue4(max)));
2231
2314
  }
2232
- }, [draft, min, max, formatValue3, parseValue, onCommit]);
2315
+ }, [draft, min, max, formatValue4, parseValue, onCommit]);
2233
2316
  const handleKeyDown = useCallback10((event) => {
2234
2317
  if (event.key === "Enter") {
2235
2318
  event.preventDefault();
@@ -2251,7 +2334,7 @@ function RangeValueInput({
2251
2334
  "aria-describedby": error ? `${descriptionId} ${errorId}` : descriptionId,
2252
2335
  "aria-invalid": Boolean(error),
2253
2336
  disabled,
2254
- value: draft ?? formatValue3(value),
2337
+ value: draft ?? formatValue4(value),
2255
2338
  onChange: handleChange,
2256
2339
  onBlur: handleBlur,
2257
2340
  onKeyDown: handleKeyDown
@@ -2556,7 +2639,7 @@ function RangeSlicer({
2556
2639
  "--range-stroke": theme.stroke,
2557
2640
  fontFamily: theme.typography?.label?.family
2558
2641
  } : {}, [theme]);
2559
- const formatBound = useCallback13((value) => String(formatValue2(value, slicerData.format)), [slicerData.format]);
2642
+ const formatBound = useCallback13((value) => String(formatValue3(value, slicerData.format)), [slicerData.format]);
2560
2643
  const formatInput = useCallback13((value) => formatNumericInput(value, slicerData.format), [slicerData.format]);
2561
2644
  const parseInput = useCallback13((text) => parseNumericInput(text, slicerData.format), [slicerData.format]);
2562
2645
  const handleLowerCommit = useCallback13((value) => {
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": "4.1.0",
4
+ "version": "4.3.0",
5
5
  "author": "Microsoft",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -30,6 +30,6 @@
30
30
  "@tanstack/react-virtual": "^3.13.23",
31
31
  "lodash.debounce": "^4.0.8",
32
32
  "radix-ui": "^1.6.7",
33
- "@microsoft/fabric-visuals-core": "5.1.0"
33
+ "@microsoft/fabric-visuals-core": "5.3.0"
34
34
  }
35
35
  }