@microsoft/fabric-slicers 4.1.0 → 4.2.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.
Files changed (3) hide show
  1. package/CHANGELOG +7 -0
  2. package/dist/index.js +60 -42
  3. package/package.json +2 -2
package/CHANGELOG CHANGED
@@ -5,6 +5,13 @@ 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.2.0 - 2026-11-05
9
+
10
+ - Update date slicer dropdown formatting and preset labels
11
+ - [Slicers] Use browser-style focus for controls and rows
12
+ - [Slicers] Bug fix for drop down slicer frameless prop
13
+ - Upgrade jsdom to 30.1.3 to resolve undici TLS renegotiation DoS
14
+
8
15
  ## 4.1.0 - 2026-10-28
9
16
 
10
17
  - Add month and year range selection to DateSlicer
package/dist/index.js CHANGED
@@ -253,11 +253,7 @@ var useSlicerStyles = makeStyles(inVisualsLayer({
253
253
  fontWeight: `var(--slicer-weight, ${tokens.fontWeightRegular})`,
254
254
  color: `var(--slicer-foreground, ${tokens.colorForeground})`,
255
255
  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
- }
256
+ "& button, & input": { fontFamily: "inherit", fontSize: "inherit" }
261
257
  },
262
258
  root: { display: "flex", flexDirection: "column", gap: "8px", minWidth: 0, minHeight: 0, width: "100%" },
263
259
  fillHeight: { height: "100%", maxHeight: "100%" },
@@ -280,10 +276,6 @@ var useSlicerStyles = makeStyles(inVisualsLayer({
280
276
  fontFamily: "inherit",
281
277
  fontSize: "12px",
282
278
  flexShrink: 0,
283
- ":focus-visible": {
284
- outline: `2px solid var(--slicer-link, ${tokens.colorBrandForeground})`,
285
- outlineOffset: "2px"
286
- },
287
279
  ":disabled": { opacity: 0.5, cursor: "default" }
288
280
  },
289
281
  clearHidden: { visibility: "hidden" },
@@ -412,6 +404,12 @@ function CalendarIcon({ className }) {
412
404
  // src/components/list-slicer/list-slicer-styles.ts
413
405
  import { makeStyles as makeStyles3 } from "@griffel/react";
414
406
  import { inVisualsLayer as inVisualsLayer3, tokens as tokens3 } from "@microsoft/fabric-visuals-core";
407
+ var nativeFocusOutline = {
408
+ outline: "1px auto",
409
+ outlineColor: "-webkit-focus-ring-color",
410
+ // Wrappers otherwise receive CanvasText instead of the control's system focus color.
411
+ "@media (forced-colors: active)": { outlineColor: "Highlight" }
412
+ };
415
413
  var useListSlicerStyles = makeStyles3(inVisualsLayer3({
416
414
  // Without panel padding, outward focus rings need visible overflow; the value list owns scrolling.
417
415
  frameless: { border: 0, borderRadius: 0, padding: 0, backgroundColor: "transparent", overflow: "visible" },
@@ -426,10 +424,10 @@ var useListSlicerStyles = makeStyles3(inVisualsLayer3({
426
424
  padding: "4px 8px",
427
425
  marginBottom: "4px",
428
426
  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" }
427
+ // Draw the browser's focus ring around the icon and input without adding a Tab stop.
428
+ ":has(> input:focus-visible)": {
429
+ ...nativeFocusOutline,
430
+ "& > input": { outline: "none" }
433
431
  }
434
432
  },
435
433
  input: {
@@ -485,6 +483,12 @@ var useListSlicerStyles = makeStyles3(inVisualsLayer3({
485
483
  minWidth: 0,
486
484
  position: "relative",
487
485
  ":hover": { backgroundColor: `var(--slicer-hover, ${tokens3.colorHover})` },
486
+ ':has(> [role="checkbox"]:focus-visible)': {
487
+ ...nativeFocusOutline,
488
+ // Keep the full checkbox-and-label ring inside the scrolling viewport.
489
+ outlineOffset: "-2px",
490
+ '& > [role="checkbox"]': { outline: "none" }
491
+ },
488
492
  "&:hover > [data-slicer-only], &:has(:focus-visible) > [data-slicer-only]": { position: "static", opacity: 1, pointerEvents: "auto" }
489
493
  },
490
494
  selectAll: { flexShrink: 0, fontWeight: 600 },
@@ -753,6 +757,7 @@ var usePopoverStyles = makeStyles4(inVisualsLayer4({
753
757
  outline: "none",
754
758
  zIndex: 1e3,
755
759
  borderRadius: `var(--slicer-radius, ${tokens4.radiusXl})`,
760
+ backgroundColor: `var(--slicer-background, ${tokens4.colorBackground})`,
756
761
  boxShadow: "0 2px 6px rgba(0, 0, 0, 0.16)"
757
762
  }
758
763
  }));
@@ -1157,7 +1162,16 @@ import { compareCalendarDates as compareCalendarDates2 } from "@microsoft/fabric
1157
1162
 
1158
1163
  // src/components/date-slicer/date-slicer-utils.ts
1159
1164
  import { UTCDate } from "@date-fns/utc";
1160
- import { compareCalendarDates, formatCalendarDate, formatString as formatString6, getString as getString6, isValidCalendarDate, parseCalendarDate } from "@microsoft/fabric-visuals-core";
1165
+ import { compareCalendarDates, formatCalendarDate, formatString as formatString6, formatValue as formatValue2, getString as getString6, isValidCalendarDate, parseCalendarDate } from "@microsoft/fabric-visuals-core";
1166
+ var dateSlicerPresetLabels = {
1167
+ last7Days: "DateSlicer_Last7Days",
1168
+ last30Days: "DateSlicer_Last30Days",
1169
+ monthToDate: "DateSlicer_MonthToDate",
1170
+ lastMonth: "DateSlicer_LastMonth",
1171
+ quarterToDate: "DateSlicer_QuarterToDate",
1172
+ lastQuarter: "DateSlicer_LastQuarter",
1173
+ yearToDate: "DateSlicer_YearToDate"
1174
+ };
1161
1175
  function isValidRange(range) {
1162
1176
  return range.every((date) => isValidCalendarDate(date.year, date.month, date.day)) && compareCalendarDates(range[0], range[1]) <= 0;
1163
1177
  }
@@ -1200,7 +1214,17 @@ function datePeriodRange(date, period) {
1200
1214
  normalizeCalendarDate(date.year, lastMonth + 1, 0)
1201
1215
  ];
1202
1216
  }
1203
- function dateSummary(day) {
1217
+ function dateSummary(day, columnFormat) {
1218
+ if (columnFormat?.trim()) {
1219
+ const normalizedFormat = columnFormat.trim().toLowerCase();
1220
+ let dateFormat = columnFormat;
1221
+ if (normalizedFormat === "short date" || normalizedFormat === "general date") {
1222
+ dateFormat = "m/d/yyyy";
1223
+ } else if (normalizedFormat === "long date") {
1224
+ dateFormat = "dddd, mmmm d, yyyy";
1225
+ }
1226
+ return String(formatValue2(toDayPickerDate(day), dateFormat));
1227
+ }
1204
1228
  return formatString6("DateSlicer_DateSummary", day.month, day.day, String(day.year).padStart(4, "0"));
1205
1229
  }
1206
1230
  function parseSelectionDate(value) {
@@ -1685,13 +1709,13 @@ import { useCallback as useCallback7, useState as useState6 } from "react";
1685
1709
  import { getString as getString9 } from "@microsoft/fabric-visuals-core";
1686
1710
  import { jsx as jsx10 } from "react/jsx-runtime";
1687
1711
  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" }
1712
+ "last7Days",
1713
+ "last30Days",
1714
+ "monthToDate",
1715
+ "lastMonth",
1716
+ "quarterToDate",
1717
+ "lastQuarter",
1718
+ "yearToDate"
1695
1719
  ];
1696
1720
  function DateSlicerPresetButton({ id, label, isDisabled, isSelected, onSelect }) {
1697
1721
  const styles = useDateSlicerDropdownStyles();
@@ -1717,15 +1741,15 @@ function DateSlicerPresetList({ domain, committedRange, selectedPreset, onSelect
1717
1741
  const range = resolveDatePreset(id, currentToday, domain);
1718
1742
  if (range) onSelect(id, range);
1719
1743
  }, [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 }) => {
1744
+ const hasApplicablePreset = presets.some((id) => resolveDatePreset(id, today, domain) !== void 0);
1745
+ return hasApplicablePreset ? /* @__PURE__ */ jsx10("div", { className: styles.presets, role: "group", "aria-label": getString9("DateSlicer_Presets"), children: presets.map((id) => {
1722
1746
  const range = resolveDatePreset(id, today, domain);
1723
1747
  const isSelected = id === selectedPreset && range !== void 0 && dateRangesEqual(range, committedRange);
1724
1748
  return /* @__PURE__ */ jsx10(
1725
1749
  DateSlicerPresetButton,
1726
1750
  {
1727
1751
  id,
1728
- label,
1752
+ label: dateSlicerPresetLabels[id],
1729
1753
  isDisabled: !range,
1730
1754
  isSelected,
1731
1755
  onSelect: selectPreset
@@ -1871,7 +1895,11 @@ function DateSlicerContent({
1871
1895
  const hideHeader = displayOptions?.hideHeader ?? false;
1872
1896
  const showPresets = displayOptions?.showPresets ?? true;
1873
1897
  const displayTitle = title ?? slicerData.title;
1874
- const summary = committedRange ? formatString9("DateSlicer_RangeSummary", dateSummary(committedRange[0]), dateSummary(committedRange[1])) : getString10("DateSlicer_AllDates");
1898
+ const summary = committedRange ? selectedPreset ? getString10(dateSlicerPresetLabels[selectedPreset]) : formatString9(
1899
+ "DateSlicer_RangeSummary",
1900
+ dateSummary(committedRange[0], slicerData.format),
1901
+ dateSummary(committedRange[1], slicerData.format)
1902
+ ) : getString10("DateSlicer_AllDates");
1875
1903
  const handleOpenChange = useCallback9((open) => {
1876
1904
  setIsOpen(open);
1877
1905
  if (!open) cancelDraft();
@@ -1949,7 +1977,7 @@ function DateSlicerContent({
1949
1977
  // src/components/range-slicer/range-slicer.tsx
1950
1978
  import { useCallback as useCallback13, useId as useId6, useMemo as useMemo10 } from "react";
1951
1979
  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";
1980
+ import { formatNumericInput, formatString as formatString14, formatValue as formatValue3, getString as getString11, parseNumericInput } from "@microsoft/fabric-visuals-core";
1953
1981
 
1954
1982
  // src/components/range-slicer/range-slicer-data.ts
1955
1983
  import { formatString as formatString10, isDataTable as isDataTable2 } from "@microsoft/fabric-visuals-core";
@@ -2119,7 +2147,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2119
2147
  width: spacing3.xxl,
2120
2148
  height: spacing3.xxl,
2121
2149
  borderRadius: borderRadius3.circular,
2122
- outline: "none",
2123
2150
  forcedColorAdjust: "none",
2124
2151
  // Draw a small visible handle while retaining a larger pointer target.
2125
2152
  "::before": {
@@ -2132,10 +2159,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2132
2159
  },
2133
2160
  ":hover::before": {
2134
2161
  borderWidth: "2px"
2135
- },
2136
- ":focus-visible": {
2137
- outline: "2px solid var(--range-accent)",
2138
- outlineOffset: "1px"
2139
2162
  }
2140
2163
  },
2141
2164
  inputs: {
@@ -2157,10 +2180,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2157
2180
  fontFamily: "inherit",
2158
2181
  fontSize: "inherit",
2159
2182
  fontVariantNumeric: "tabular-nums",
2160
- ":focus-visible": {
2161
- outline: "2px solid var(--range-accent)",
2162
- outlineOffset: "1px"
2163
- },
2164
2183
  ":disabled": {
2165
2184
  color: "var(--range-secondary)",
2166
2185
  cursor: "not-allowed"
@@ -2168,7 +2187,6 @@ var useRangeSlicerStyles = makeStyles8(inVisualsLayer8({
2168
2187
  '&[aria-invalid="true"]': {
2169
2188
  ...shorthands2.borderColor("var(--range-error)"),
2170
2189
  color: "var(--range-error)",
2171
- outlineColor: "var(--range-error)",
2172
2190
  boxShadow: "0 0 0 3px color-mix(in srgb, var(--range-error) 20%, transparent)"
2173
2191
  }
2174
2192
  },
@@ -2206,7 +2224,7 @@ function RangeValueInput({
2206
2224
  max,
2207
2225
  disabled,
2208
2226
  descriptionId,
2209
- formatValue: formatValue3,
2227
+ formatValue: formatValue4,
2210
2228
  parseValue,
2211
2229
  onCommit
2212
2230
  }) {
@@ -2227,9 +2245,9 @@ function RangeValueInput({
2227
2245
  setDraft(void 0);
2228
2246
  setError(void 0);
2229
2247
  } else {
2230
- setError(formatString11("RangeSlicer_InvalidValue", formatValue3(min), formatValue3(max)));
2248
+ setError(formatString11("RangeSlicer_InvalidValue", formatValue4(min), formatValue4(max)));
2231
2249
  }
2232
- }, [draft, min, max, formatValue3, parseValue, onCommit]);
2250
+ }, [draft, min, max, formatValue4, parseValue, onCommit]);
2233
2251
  const handleKeyDown = useCallback10((event) => {
2234
2252
  if (event.key === "Enter") {
2235
2253
  event.preventDefault();
@@ -2251,7 +2269,7 @@ function RangeValueInput({
2251
2269
  "aria-describedby": error ? `${descriptionId} ${errorId}` : descriptionId,
2252
2270
  "aria-invalid": Boolean(error),
2253
2271
  disabled,
2254
- value: draft ?? formatValue3(value),
2272
+ value: draft ?? formatValue4(value),
2255
2273
  onChange: handleChange,
2256
2274
  onBlur: handleBlur,
2257
2275
  onKeyDown: handleKeyDown
@@ -2556,7 +2574,7 @@ function RangeSlicer({
2556
2574
  "--range-stroke": theme.stroke,
2557
2575
  fontFamily: theme.typography?.label?.family
2558
2576
  } : {}, [theme]);
2559
- const formatBound = useCallback13((value) => String(formatValue2(value, slicerData.format)), [slicerData.format]);
2577
+ const formatBound = useCallback13((value) => String(formatValue3(value, slicerData.format)), [slicerData.format]);
2560
2578
  const formatInput = useCallback13((value) => formatNumericInput(value, slicerData.format), [slicerData.format]);
2561
2579
  const parseInput = useCallback13((text) => parseNumericInput(text, slicerData.format), [slicerData.format]);
2562
2580
  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.2.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.2.0"
34
34
  }
35
35
  }