@persona/design-system 0.10.12 → 0.10.14

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 (157) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/{CheckboxGroupField-XSVAmESI.d.mts → CheckboxGroupField-tBvP22Bo.d.mts} +2 -2
  3. package/dist/CheckboxGroupField.d.mts +1 -1
  4. package/dist/{Combobox-BNjYEAmv.mjs → Combobox-DmFQ5cAy.mjs} +63 -51
  5. package/dist/Combobox-DmFQ5cAy.mjs.map +1 -0
  6. package/dist/{Combobox-DbcSss15.d.mts → Combobox-RX4DfO5L.d.mts} +3 -3
  7. package/dist/Combobox.d.mts +2 -2
  8. package/dist/{ComboboxBase-CrFweFGi.d.mts → ComboboxBase-VIGR58Uc.d.mts} +2 -2
  9. package/dist/ComboboxBase.d.mts +1 -1
  10. package/dist/{ComboboxMultiSelect-Cp5GBGQj.d.mts → ComboboxMultiSelect-D5TWGGKZ.d.mts} +2 -2
  11. package/dist/ComboboxMultiSelect.d.mts +1 -1
  12. package/dist/{ComboboxSingleSelect-u7fK3Yvy.d.mts → ComboboxSingleSelect-D9It8t6W.d.mts} +3 -3
  13. package/dist/ComboboxSingleSelect.d.mts +1 -1
  14. package/dist/{CompactBar-BLZZWtIE.d.mts → CompactBar-tNtY2EhN.d.mts} +2 -2
  15. package/dist/CompactBar.d.mts +1 -1
  16. package/dist/{ControlBar-B3Jn8G0k.d.mts → ControlBar-CDb6b1_6.d.mts} +5 -3
  17. package/dist/ControlBar.d.mts +1 -1
  18. package/dist/{DataTable-C1mdfmQa.d.mts → DataTable-0nhT5_Fe.d.mts} +31 -7
  19. package/dist/{DataTable-DdSY9mzT.mjs → DataTable-6t5ryaEq.mjs} +146 -77
  20. package/dist/DataTable-6t5ryaEq.mjs.map +1 -0
  21. package/dist/DataTable.d.mts +1 -1
  22. package/dist/{DatePicker-DiilpYQg.mjs → DatePicker-CHVYVKB-.mjs} +2 -2
  23. package/dist/{DatePicker-DiilpYQg.mjs.map → DatePicker-CHVYVKB-.mjs.map} +1 -1
  24. package/dist/DropdownButton.d.mts +1 -1
  25. package/dist/{DropdownMenu-CQR0U-zM.d.mts → DropdownMenu-Db6N6ZNB.d.mts} +2 -2
  26. package/dist/DropdownMenu.d.mts +1 -1
  27. package/dist/{FloatingActionBar-BUgSKimy.d.mts → FloatingActionBar-CfgjHs81.d.mts} +5 -1
  28. package/dist/FloatingActionBar.d.mts +1 -1
  29. package/dist/{FormField-yYJFkJ6R.mjs → FormField-BfVrDOY0.mjs} +4 -4
  30. package/dist/{FormField-yYJFkJ6R.mjs.map → FormField-BfVrDOY0.mjs.map} +1 -1
  31. package/dist/{HoverCopyableField-X2XfKTTh.mjs → HoverCopyableField-CJ_p3llp.mjs} +2 -2
  32. package/dist/{HoverCopyableField-X2XfKTTh.mjs.map → HoverCopyableField-CJ_p3llp.mjs.map} +1 -1
  33. package/dist/IndexTableLayout.d.mts +3 -3
  34. package/dist/InlineCombobox.d.mts +1 -1
  35. package/dist/InlineInput.d.mts +1 -1
  36. package/dist/{Link-B29ZMN6m.mjs → Link-Df3zJrj2.mjs} +1 -1
  37. package/dist/{Link-B29ZMN6m.mjs.map → Link-Df3zJrj2.mjs.map} +1 -1
  38. package/dist/{ListBox-4rTgr3IJ.mjs → ListBox-BRgjgUSp.mjs} +2 -2
  39. package/dist/{ListBox-4rTgr3IJ.mjs.map → ListBox-BRgjgUSp.mjs.map} +1 -1
  40. package/dist/{ListBox-ZDaitaXR.d.mts → ListBox-l47zUDj4.d.mts} +2 -2
  41. package/dist/ListBox.d.mts +1 -1
  42. package/dist/{ListBoxField-CGvVWKyL.d.mts → ListBoxField-Di_6uD3S.d.mts} +4 -4
  43. package/dist/ListBoxField.d.mts +1 -1
  44. package/dist/{LogicRow-Bzp5o1sL.d.mts → LogicRow-7f17CKrW.d.mts} +2 -2
  45. package/dist/LogicRow.d.mts +1 -1
  46. package/dist/MaskedInput.d.mts +1 -1
  47. package/dist/{Menu-DviYNrFd.d.mts → Menu-DvzoR8e7.d.mts} +2 -2
  48. package/dist/Menu.d.mts +1 -1
  49. package/dist/{Modal-CiPFqr0L.mjs → Modal-C_vSgqgl.mjs} +20 -16
  50. package/dist/Modal-C_vSgqgl.mjs.map +1 -0
  51. package/dist/{Modal-CujB7DuB.d.mts → Modal-IVXc4p8Y.d.mts} +7 -2
  52. package/dist/Modal.d.mts +1 -1
  53. package/dist/{Pii-jSYND7Cn.mjs → Pii-BYPkrBuT.mjs} +1 -1
  54. package/dist/{Pii-jSYND7Cn.mjs.map → Pii-BYPkrBuT.mjs.map} +1 -1
  55. package/dist/{Popover-CVX-dfYb.mjs → Popover-DP9DXReH.mjs} +1 -1
  56. package/dist/{Popover-CVX-dfYb.mjs.map → Popover-DP9DXReH.mjs.map} +1 -1
  57. package/dist/{Select-DsVeAyZy.d.mts → Select-boZ6XP8k.d.mts} +2 -2
  58. package/dist/Select.d.mts +1 -1
  59. package/dist/SmartTextInputField.d.mts +2 -2
  60. package/dist/SmartTextInputListbox.d.mts +8 -3
  61. package/dist/{TableBox-D9NA-s9l.mjs → TableBox-RxpwflEb.mjs} +3 -3
  62. package/dist/{TableBox-D9NA-s9l.mjs.map → TableBox-RxpwflEb.mjs.map} +1 -1
  63. package/dist/TableBox.d.mts +1 -1
  64. package/dist/{TableBoxCell-CQOL30et.d.mts → TableBoxCell-B6Z23mby.d.mts} +4 -4
  65. package/dist/TableBoxCell.d.mts +1 -1
  66. package/dist/{TableBoxField-z0GIFeQw.d.mts → TableBoxField-6qAOW8t9.d.mts} +5 -5
  67. package/dist/TableBoxField.d.mts +1 -1
  68. package/dist/{TableBoxRow-tb9-KMr9.d.mts → TableBoxRow-CpgNWdLS.d.mts} +2 -2
  69. package/dist/TableBoxRow.d.mts +1 -1
  70. package/dist/{TableBoxRowActions-BZwulsFP.d.mts → TableBoxRowActions-BDx5naRj.d.mts} +2 -2
  71. package/dist/TableBoxRowActions.d.mts +1 -1
  72. package/dist/{TableControls-DE6eHq8h.d.mts → TableControls-BGKL7_zF.d.mts} +4 -4
  73. package/dist/{TableControls-BXykbUBf.mjs → TableControls-BwZl4TjJ.mjs} +31 -12
  74. package/dist/TableControls-BwZl4TjJ.mjs.map +1 -0
  75. package/dist/TableControls.d.mts +1 -1
  76. package/dist/{TableControlsContext-C2_2EuMh.d.mts → TableControlsContext-DhABbtVY.d.mts} +2 -2
  77. package/dist/TableControlsContext.d.mts +1 -1
  78. package/dist/{TableViewConfigurationDropdown-DE9HFXYY.d.mts → TableViewConfigurationDropdown-D76ApJ_-.d.mts} +2 -2
  79. package/dist/TableViewConfigurationDropdown.d.mts +1 -1
  80. package/dist/WizardModal.d.mts +1 -1
  81. package/dist/{clientFilterUtils-2TBUC31K.d.mts → clientFilterUtils-WH_Dqtv4.d.mts} +2 -2
  82. package/dist/clientFilterUtils.d.mts +1 -1
  83. package/dist/components/Combobox/index.d.mts +4 -4
  84. package/dist/components/Combobox/index.mjs +1 -1
  85. package/dist/components/DataTable/TableControls/index.d.mts +7 -7
  86. package/dist/components/DataTable/TableControls/index.mjs +1 -1
  87. package/dist/components/DataTable/index.d.mts +6 -6
  88. package/dist/components/DataTable/index.mjs +1 -1
  89. package/dist/components/DataTable/types.d.mts +1 -1
  90. package/dist/components/DatePicker/index.mjs +1 -1
  91. package/dist/components/DropdownMenu/index.d.mts +1 -1
  92. package/dist/components/FormField/index.d.mts +4 -4
  93. package/dist/components/FormField/index.mjs +1 -1
  94. package/dist/components/HoverCopyableField/index.mjs +1 -1
  95. package/dist/components/Link/index.mjs +1 -1
  96. package/dist/components/ListBox/index.d.mts +3 -3
  97. package/dist/components/ListBox/index.mjs +1 -1
  98. package/dist/components/Menu/index.d.mts +1 -1
  99. package/dist/components/Modal/index.d.mts +1 -1
  100. package/dist/components/Modal/index.mjs +1 -1
  101. package/dist/components/Pii/index.mjs +1 -1
  102. package/dist/components/Popover/index.mjs +1 -1
  103. package/dist/components/RichTextEditor/index.mjs +2 -2
  104. package/dist/components/Select/index.d.mts +1 -1
  105. package/dist/components/SmartTextInput/index.mjs +128 -59
  106. package/dist/components/SmartTextInput/index.mjs.map +1 -1
  107. package/dist/components/TableBox/index.d.mts +1 -1
  108. package/dist/components/TableBox/index.mjs +1 -1
  109. package/dist/components/VersionHistory/index.mjs +1 -1
  110. package/dist/fieldPickerOptions.d.mts +1 -1
  111. package/dist/{filters-DW7pqWv3.d.mts → filters-BXtKuft3.d.mts} +2 -2
  112. package/dist/filters.d.mts +1 -1
  113. package/dist/{helpers-BTD2kXLs.d.mts → helpers-gpO42h8t.d.mts} +5 -3
  114. package/dist/helpers.d.mts +1 -1
  115. package/dist/{index-B4tE0RxY.d.mts → index-bkzLg85W.d.mts} +3 -3
  116. package/dist/{inputFields-DnBb3NhK.d.mts → inputFields-B7parF2l.d.mts} +4 -4
  117. package/dist/inputFields.d.mts +1 -1
  118. package/dist/lib/PDSProvider.d.mts +2 -1
  119. package/dist/lib/PDSProvider.mjs +8 -3
  120. package/dist/lib/PDSProvider.mjs.map +1 -1
  121. package/dist/lib/colorMode.d.mts +18 -7
  122. package/dist/lib/colorMode.mjs +47 -13
  123. package/dist/lib/colorMode.mjs.map +1 -1
  124. package/dist/lib/schemaOptions.mjs +1 -1
  125. package/dist/lib/schemaOptions.mjs.map +1 -1
  126. package/dist/patterns/IndexTableLayout/index.mjs +1 -1
  127. package/dist/patterns/WizardModal/index.mjs +1 -1
  128. package/dist/{types-NO2GRlM-.d.mts → types-BvaXqjUm.d.mts} +2 -2
  129. package/dist/{types-Dws2XDz2.d.mts → types-CuH-sUJ2.d.mts} +6 -4
  130. package/dist/types5.d.mts +1 -1
  131. package/dist/useColumnConfiguration.d.mts +2 -2
  132. package/dist/useComboboxFooterAction.d.mts +1 -1
  133. package/dist/{useTableColumns-tITjHasE.d.mts → useTableColumns-I7StvoRs.d.mts} +17 -2
  134. package/dist/useTableColumns.d.mts +1 -1
  135. package/dist/useTruncation.d.mts +1 -1
  136. package/dist/utils4.d.mts +1 -1
  137. package/dist/withDisabledReason.d.mts +19 -0
  138. package/llms.txt +4 -3
  139. package/package.json +4 -12
  140. package/skills/ui-authoring/COMPONENTS.md +0 -1
  141. package/skills/ui-authoring/PATTERNS.md +0 -64
  142. package/skills/ui-authoring/TOKENS.md +14 -25
  143. package/dist/ChartFrame.d.mts +0 -61
  144. package/dist/ChartLegend.d.mts +0 -60
  145. package/dist/ChartPopover.d.mts +0 -155
  146. package/dist/Combobox-BNjYEAmv.mjs.map +0 -1
  147. package/dist/DataTable-DdSY9mzT.mjs.map +0 -1
  148. package/dist/Modal-CiPFqr0L.mjs.map +0 -1
  149. package/dist/TableControls-BXykbUBf.mjs.map +0 -1
  150. package/dist/chartColors.d.mts +0 -92
  151. package/dist/chartFrameLayout.d.mts +0 -46
  152. package/dist/components/Chart/index.d.mts +0 -9
  153. package/dist/components/Chart/index.mjs +0 -680
  154. package/dist/components/Chart/index.mjs.map +0 -1
  155. package/dist/useChartColors.d.mts +0 -30
  156. package/dist/useChartSeriesVisibility.d.mts +0 -22
  157. package/dist/useChartStyles.d.mts +0 -108
@@ -11,7 +11,6 @@ Which pattern to use, and for what. Patterns with a dedicated doc link to
11
11
  | [Forms](../../patterns/Forms/Forms.mdx) | Labeled fields in a `Modal`, `RightPanel`, or page. Unlabeled controls (search, toolbars) stay as `Input` |
12
12
  | Stack / HStack | A heading above content, a cancel/save pair, a title next to an add button, or a wrapping row of tags |
13
13
  | EmptyStates | A list, table, or card has no items yet and you want to invite adding one |
14
- | Charting | Build charts with `recharts` and the experimental `@persona/design-system/components/Chart` pieces; colour series from the chart palettes, never hex |
15
14
  | Indicators | A record’s open, pending, completed, or failed state next to other content. An in-page notice the user shouldn’t miss (success, warning, error). Use `Toast` if it can auto-dismiss |
16
15
  | [SingleColumnLayout](../../patterns/PageLayout/SingleColumnLayout.mdx) | One page column under `PageHeader`, with optional tabs and a page notice. `width="wide"` uses the fluid grid |
17
16
  | [SplitColumnLayout](../../patterns/PageLayout/SplitColumnLayout.mdx) | An 8:4 main and aside page. Same optional regions. Stacks main then aside below 768px |
@@ -298,66 +297,3 @@ Message-only (no CTA):
298
297
 
299
298
  For `ListBox`, pass `emptyText="No items"` prop directly.
300
299
  For `Card.Section`, pass `empty={true}` to show the built-in empty state.
301
-
302
-
303
-
304
- ## Charting
305
-
306
- Experimental (beta). Build charts with `recharts` (an optional peer, 2.x or 3.x) and the pieces in
307
- `@persona/design-system/components/Chart`. Full usage guidance comes later; until then see Storybook
308
- **Charts → Design** (Chart frame, Elements, Themes) and **Charts → Chart types** (Bar chart, Line
309
- chart).
310
-
311
- - `ChartFrame`: legend and plot layout, full width, 300px plot height by default.
312
- - `ChartLegend`: series key; with `onToggle` (and `useChartSeriesVisibility`) it shows and hides series.
313
- - `ChartPopover`: the content of a Recharts `<Tooltip>`.
314
- - `useChartStyles()`: PDS props for Recharts' grid, axes and tooltip cursor in a hand-built chart.
315
- - `useChartColors()` / `resolveSeriesColors()`: series colours from a chart palette.
316
-
317
- ```tsx
318
- import {
319
- ChartFrame,
320
- ChartLegend,
321
- ChartPopover,
322
- CHART_PLOT_MARGIN,
323
- useChartColors,
324
- useChartStyles,
325
- } from '@persona/design-system/components/Chart';
326
- import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
327
-
328
- const colors = useChartColors().resolve(series); // { [series.key]: Color }
329
- const styles = useChartStyles();
330
- const items = series.map((s) => ({ ...s, color: colors[s.key] }));
331
-
332
- <ChartFrame aria-label='Tickets by status' legend={<ChartLegend items={items} />}>
333
- <ResponsiveContainer width='100%' height='100%'>
334
- <BarChart data={data} margin={CHART_PLOT_MARGIN}>
335
- <Tooltip cursor={styles.barCursor} content={<ChartPopover series={items} />} />
336
- <CartesianGrid {...styles.grid} />
337
- <XAxis dataKey='month' {...styles.xAxis} />
338
- <YAxis {...styles.yAxis} />
339
- {items.map((s) => <Bar key={s.key} dataKey={s.key} name={s.label} fill={s.color} />)}
340
- </BarChart>
341
- </ResponsiveContainer>
342
- </ChartFrame>
343
- ```
344
-
345
- ### Palettes
346
-
347
- | Data | Palette (`useChartColors(palette)`) | Colours |
348
- |------|-------------------------------------|---------|
349
- | Distinct, unordered series (default) | `'qualitative'` | 12 |
350
- | Ordered magnitude in one hue | `'sequentialMono'` | 8 |
351
- | Values diverging around a midpoint | `'sequentialDivergent'` | 10 |
352
-
353
- Take Qualitative colours in palette order: the order is tuned for readability. Override a series
354
- only with a Persona token, `chartColor(Color.X)` or a `{ light, dark }` pair of tokens; never hex.
355
-
356
- **Legacy:** `ChartingColors.Sequential` and `ChartingColors.Categorical` from
357
- `@persona/design-tokens` are deprecated for new charts. Existing charts may keep them until they
358
- move to the palettes above.
359
-
360
- **Anti-patterns:**
361
- - Hardcoding hex values for series colours
362
- - Picking Qualitative colours out of order
363
- - Using `'sequentialMono'` for unordered categories
@@ -490,7 +490,8 @@ Apps embedded in the dashboard follow its mode with
490
490
  `<PDSProvider colorMode={readDocumentColorMode()}>` (`@persona/design-system/lib/colorMode`). That
491
491
  installs the semantic palette for PDS components and publishes it as `--pds-*` CSS variables
492
492
  (`FgPrimary` -> `var(--pds-fg-primary)`) for plain stylesheets. Wrap a subtree in
493
- `<ColorModeScope mode='dark'>` to render it in the other mode. Plain CSS inside a portaled overlay
493
+ `<ColorModeScope mode='dark'>` to render it in the other mode, and read the mode in effect (for
494
+ iframes, canvases or charts) with `useColorMode()`. Plain CSS inside a portaled overlay
494
495
  reads the `:root` variables, not the scope's. Don't copy these helpers into an app. See
495
496
  `tokens/README.md` ("Colour mode in apps").
496
497
 
@@ -702,35 +703,23 @@ const Menu = styled.div`
702
703
 
703
704
  ## Charts
704
705
 
705
- Experimental (beta). Colour chart series with the chart palettes from
706
- `@persona/design-system/components/Chart`: `useChartColors(palette)` (follows the PDS colour mode)
707
- or `resolveSeriesColors()`. See the Charting section of [PATTERNS.md](PATTERNS.md) and Storybook
708
- **Charts → Design → Themes**.
706
+ Experimental (beta). Colour chart series with the chart palette tokens: `ChartingColors` from
707
+ `@persona/design-tokens` (light), or `chartingLight` / `chartingDark` from
708
+ `@persona/design-system/variables/charting`. `chartingColors(theme)` from
709
+ `@persona/design-system/lib/semanticColor` returns the palettes for the theme's colour mode.
709
710
 
710
- | Need | Palette | Token palette | Colours |
711
- |------|---------|---------------|---------|
712
- | Distinct, unordered series (default) | `'qualitative'` | `ChartingColors.Qualitative` | 12 |
713
- | Ordered magnitude in one hue | `'sequentialMono'` | `ChartingColors.SequentialMono` | 8 |
714
- | Values diverging around a midpoint | `'sequentialDivergent'` | `ChartingColors.SequentialDivergent` | 10 |
711
+ | Need | Token palette | Colours |
712
+ |------|---------------|---------|
713
+ | Distinct, unordered series (default) | `ChartingColors.Qualitative` | 12 |
714
+ | Ordered magnitude in one hue | `ChartingColors.SequentialMono` | 8 |
715
+ | Values diverging around a midpoint | `ChartingColors.SequentialDivergent` | 10 |
715
716
 
716
717
  - Take Qualitative colours in order; the order is tuned for readability.
717
- - Override a series only with a Persona token: `chartColor(Color.X)` or a `{ light, dark }` pair.
718
- Never hex: `ChartColor` does not accept a hex string, and the `pds/semantic-color` lint rule
719
- rejects it.
720
-
721
- ```tsx
722
- import { useChartColors } from '@persona/design-system/components/Chart';
723
-
724
- const colors = useChartColors().resolve([
725
- { key: 'approved', label: 'Approved' },
726
- { key: 'declined', label: 'Declined' },
727
- ]);
728
- <Bar dataKey='approved' fill={colors.approved} />;
729
- ```
718
+ - Override a series only with a Persona token, never hex; the `pds/semantic-color` lint rule
719
+ rejects hex.
730
720
 
731
721
  **Legacy (deprecated for new charts):** `ChartingColors.Sequential` (8) and
732
- `ChartingColors.Categorical` (14), also exposed under a colour mode through `chartingColors(theme)`
733
- from `@persona/design-system/lib/semanticColor`. Existing charts may keep them until they move to
722
+ `ChartingColors.Categorical` (14), also exposed under a colour mode through `chartingColors(theme)`. Existing charts may keep them until they move to
734
723
  the palettes above.
735
724
 
736
725
  ## Token Verification
@@ -1,61 +0,0 @@
1
- import { ChartLegendPosition } from "./chartFrameLayout.mjs";
2
- import { ChartLegendProps } from "./ChartLegend.mjs";
3
- import { ReactElement } from "react";
4
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
-
6
- //#region src/components/Chart/ChartFrame.d.ts
7
- type ChartFrameLabel = {
8
- 'aria-label': string;
9
- 'aria-labelledby'?: never;
10
- } | {
11
- 'aria-labelledby': string;
12
- 'aria-label'?: never;
13
- };
14
- /** @experimental */
15
- type ChartFrameProps = ChartFrameLabel & {
16
- /**
17
- * The chart's legend. Pass `null` to omit it, e.g. for a single-series chart whose surrounding
18
- * heading already names the series.
19
- */
20
- legend: ReactElement<ChartLegendProps> | null;
21
- /**
22
- * `'stack'` (default) puts the legend left-aligned above the plot; `'right'` puts it inline to
23
- * the right of the plot, as wide as its longest label up to 200px (longer labels end in an
24
- * ellipsis). The legend and plot are `Spacing[4]` apart when stacked and `Spacing[3]` apart inline.
25
- */
26
- legendPosition?: ChartLegendPosition;
27
- /**
28
- * Plot area height in px. Defaults to 300 (`CHART_DEFAULT_HEIGHT`). The plot always fills 100%
29
- * of the frame's width, and the frame fills its container.
30
- */
31
- height?: number;
32
- /**
33
- * The plot: a Recharts chart, sized by the frame (e.g. wrapped in `ResponsiveContainer`). Give it
34
- * `margin={CHART_PLOT_MARGIN}` so the frame's spacing is the only gap around the plot.
35
- */
36
- children: ReactElement; /** Applied to the root `<figure>`, e.g. to position or size the frame. */
37
- className?: string;
38
- };
39
- /**
40
- * Lays out a chart: its legend and the plot area, `Spacing[4]` apart stacked (`Spacing[3]` inline), with the legend left-aligned
41
- * above the plot (`legendPosition='stack'`, the default) or inline on its right (`'right'`). The
42
- * frame has no header, border or surface of its own: titles, descriptions and controls belong to
43
- * the surrounding container (for example a `CardV2`), which also names the chart via
44
- * `aria-labelledby`.
45
- *
46
- * Size: the chart fills 100% of its container's width, and the plot is 300px tall
47
- * (`CHART_DEFAULT_HEIGHT`) unless `height` overrides it.
48
- *
49
- * @experimental Part of the in-progress PDS charting components; the API may change.
50
- */
51
- declare function ChartFrame({
52
- legend,
53
- legendPosition,
54
- height,
55
- children,
56
- className,
57
- ...label
58
- }: ChartFrameProps): _$react_jsx_runtime0.JSX.Element;
59
- //#endregion
60
- export { ChartFrame, ChartFrame as default, ChartFrameProps };
61
- //# sourceMappingURL=ChartFrame.d.mts.map
@@ -1,60 +0,0 @@
1
- import { Color } from "@persona/design-tokens";
2
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
-
4
- //#region src/components/Chart/ChartLegend.d.ts
5
- /** One series in a {@link ChartLegend}. @experimental */
6
- interface ChartLegendItem<K extends string = string> {
7
- key: K;
8
- label: string;
9
- /** The series colour, from `useChartColors().resolve(...)` or `resolveSeriesColors(...)`. */
10
- color: Color;
11
- }
12
- /** A titled set of legend items, e.g. the series sharing an axis. @experimental */
13
- interface ChartLegendGroup<K extends string = string> {
14
- key: string;
15
- /** Shown above the group's items in uppercase mono text. */
16
- label: string;
17
- items: readonly ChartLegendItem<K>[];
18
- }
19
- /** Either flat `items` or titled `groups`; groups are optional. @experimental */
20
- type ChartLegendContent<K extends string = string> = {
21
- items: readonly ChartLegendItem<K>[];
22
- groups?: never;
23
- } | {
24
- groups: readonly ChartLegendGroup<K>[];
25
- items?: never;
26
- };
27
- /** @experimental */
28
- type ChartLegendProps<K extends string = string> = ChartLegendContent<K> & {
29
- /** Keys of the series currently hidden. Pair with {@link useChartSeriesVisibility}. */hidden?: readonly K[];
30
- /**
31
- * Called with a series key when its legend item is clicked. When set, every item is a toggle
32
- * button (`aria-pressed` is true while the series is shown); when omitted, the legend is static.
33
- * Every series may be hidden.
34
- */
35
- onToggle?: (key: K) => void; /** Names the legend for assistive tech. Defaults to "Chart legend". */
36
- 'aria-label'?: string; /** Applied to the legend's root element (the list, or the group wrapper with `groups`). */
37
- className?: string;
38
- };
39
- /**
40
- * The series key for a chart: a square colour swatch and a `TextMedium` label per series, laid out
41
- * in a row that wraps (a column when it sits right of the plot in a `ChartFrame`). With `onToggle`,
42
- * each item toggles its series; a hidden series keeps a filled swatch at 65% opacity and gets a
43
- * muted label.
44
- *
45
- * Pass `groups` instead of `items` for a grouped legend: groups stack `Spacing[2]` apart, each with
46
- * an uppercase mono title `Spacing[1]` above its row of items.
47
- *
48
- * @experimental Part of the in-progress PDS charting components; the API may change.
49
- */
50
- declare function ChartLegend<K extends string>({
51
- items,
52
- groups,
53
- hidden,
54
- onToggle,
55
- 'aria-label': ariaLabel,
56
- className
57
- }: ChartLegendProps<K>): _$react_jsx_runtime0.JSX.Element;
58
- //#endregion
59
- export { ChartLegend, ChartLegend as default, ChartLegendContent, ChartLegendGroup, ChartLegendItem, ChartLegendProps };
60
- //# sourceMappingURL=ChartLegend.d.mts.map
@@ -1,155 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { Color } from "@persona/design-tokens";
3
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
-
5
- //#region src/components/Chart/ChartPopover.d.ts
6
- /**
7
- * The popover density. `'default'` is the standalone chart popover (256px wide). `'condensed'` is
8
- * for small charts inside table cells (210px wide): the same text, tighter padding and row gaps,
9
- * and never a total row.
10
- *
11
- * @experimental Part of the in-progress PDS charting components; the API may change.
12
- */
13
- type ChartPopoverSize = 'default' | 'condensed';
14
- /**
15
- * One series the popover may list. `series` sets the row order, the label and the swatch colour; a
16
- * Recharts payload entry is matched to a series by its `dataKey`.
17
- *
18
- * @experimental
19
- */
20
- interface ChartPopoverSeries<K extends string = string> {
21
- key: K;
22
- label: ReactNode;
23
- /** The series colour token, e.g. from `useChartColors().resolve(...)`. Falls back to the payload colour. */
24
- color?: Color;
25
- }
26
- /**
27
- * One Recharts tooltip payload entry, typed structurally so the same component accepts the
28
- * payloads of Recharts 2 (`TooltipProps`) and Recharts 3 (`TooltipContentProps`).
29
- *
30
- * @experimental
31
- */
32
- interface ChartPopoverPayloadEntry {
33
- dataKey?: unknown;
34
- name?: unknown;
35
- value?: unknown;
36
- color?: string;
37
- fill?: string;
38
- stroke?: string;
39
- /** Set by Recharts 3 for a series rendered with `hide`. */
40
- hide?: boolean;
41
- /** Set for legend-inactive series. */
42
- inactive?: boolean;
43
- /** `'none'` marks an entry Recharts itself keeps out of its tooltip. */
44
- type?: string;
45
- payload?: unknown;
46
- }
47
- /** One rendered row. @experimental */
48
- interface ChartPopoverRow {
49
- key: string;
50
- label: ReactNode;
51
- /** The swatch colour: a Persona chart colour token. */
52
- color?: string;
53
- value: number | string | null | undefined;
54
- }
55
- interface ChartPopoverPanelOwnProps<K extends string = string> {
56
- /** The header, e.g. the formatted x-axis category. Omitted when empty. */
57
- label?: ReactNode;
58
- /** The rows, top to bottom. */
59
- rows: readonly ChartPopoverRow[];
60
- /** Formats each row value and the total. Defaults to locale number formatting. */
61
- valueFormatter?: (value: number | string, seriesKey: K | 'total') => ReactNode;
62
- /** Appends a total row summing the numeric values of the visible rows. Ignored when `condensed`. */
63
- showTotal?: boolean;
64
- /** Overrides the computed total. */
65
- total?: number;
66
- /** Label of the total row. Defaults to `'Total'`. */
67
- totalLabel?: ReactNode;
68
- /** Defaults to `'default'`. */
69
- size?: ChartPopoverSize;
70
- /**
71
- * Popover width in px. Defaults to 256 (`'default'`) or 210 (`'condensed'`); pass a larger number
72
- * for long series names. The height always follows the rows. Series names that still do not fit
73
- * are truncated with an ellipsis; values never truncate or wrap.
74
- */
75
- width?: number;
76
- /**
77
- * The series the pointer is on (`useChartActiveSeries().activeSeries`). Its row stays at full
78
- * strength and the other series rows drop to 65% opacity; the total row is unaffected.
79
- */
80
- activeSeries?: K;
81
- className?: string;
82
- }
83
- /** @experimental */
84
- type ChartPopoverPanelProps<K extends string = string> = ChartPopoverPanelOwnProps<K>;
85
- /** @experimental */
86
- interface ChartPopoverProps<K extends string = string> extends Omit<ChartPopoverPanelOwnProps<K>, 'rows' | 'label'> {
87
- /** Injected by Recharts `<Tooltip>`. */
88
- active?: boolean;
89
- /** Injected by Recharts `<Tooltip>`. */
90
- payload?: readonly ChartPopoverPayloadEntry[];
91
- /** Injected by Recharts `<Tooltip>`: the hovered category. */
92
- label?: unknown;
93
- /**
94
- * The chart's series, in display order. Rows follow this order and only series listed here are
95
- * shown. Without it, rows follow the payload order and use the payload's names and colours.
96
- */
97
- series?: readonly ChartPopoverSeries<K>[];
98
- /** Series keys hidden by the legend; they get no row. */
99
- hiddenSeries?: Iterable<K>;
100
- /** Formats the header from the hovered category. Defaults to the category as is. */
101
- labelFormatter?: (label: unknown, payload: readonly ChartPopoverPayloadEntry[]) => ReactNode;
102
- }
103
- /** Default popover widths in px (Figma). @experimental */
104
- declare const CHART_POPOVER_WIDTH: Record<ChartPopoverSize, number>;
105
- /**
106
- * The chart popover body: an optional header, one row per series (swatch, name, right-aligned
107
- * value) and an optional total row. Use it directly for a popover drawn outside Recharts; inside a
108
- * Recharts chart use {@link ChartPopover}.
109
- *
110
- * @experimental Part of the in-progress PDS charting components; the API may change.
111
- */
112
- declare function ChartPopoverPanel<K extends string = string>({
113
- label,
114
- rows,
115
- valueFormatter,
116
- showTotal,
117
- total,
118
- totalLabel,
119
- size,
120
- width,
121
- activeSeries,
122
- className
123
- }: ChartPopoverPanelProps<K>): _$react_jsx_runtime0.JSX.Element;
124
- /**
125
- * Builds the popover rows from a Recharts tooltip payload: drops hidden and inactive series, then
126
- * orders, labels and colours the rest by `series` (or keeps the payload order without it).
127
- *
128
- * @experimental
129
- */
130
- declare function chartPopoverRows<K extends string>(payload: readonly ChartPopoverPayloadEntry[], series?: readonly ChartPopoverSeries<K>[], hiddenSeries?: Iterable<K>): ChartPopoverRow[];
131
- /**
132
- * Chart popover (tooltip) content for Recharts 2 and 3. Pass it to `<Tooltip content={...} />`;
133
- * Recharts injects `active`, `payload` and `label`.
134
- *
135
- * ```tsx
136
- * const series = [{ key: 'approved', label: 'Approved', color: colors.approved }, ...];
137
- * <Tooltip cursor={false} content={<ChartPopover series={series} hiddenSeries={hidden} />} />
138
- * ```
139
- *
140
- * Renders nothing while inactive or when every series is hidden.
141
- *
142
- * @experimental Part of the in-progress PDS charting components; the API may change.
143
- */
144
- declare function ChartPopover<K extends string = string>({
145
- active,
146
- payload,
147
- label,
148
- series,
149
- hiddenSeries,
150
- labelFormatter,
151
- ...panelProps
152
- }: ChartPopoverProps<K>): _$react_jsx_runtime0.JSX.Element | null;
153
- //#endregion
154
- export { CHART_POPOVER_WIDTH, ChartPopover, ChartPopoverPanel, ChartPopoverPanelProps, ChartPopoverPayloadEntry, ChartPopoverProps, ChartPopoverRow, ChartPopoverSeries, ChartPopoverSize, chartPopoverRows };
155
- //# sourceMappingURL=ChartPopover.d.mts.map