@persona/design-system 0.10.12 → 0.10.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.
- package/CHANGELOG.md +31 -0
- package/dist/{CheckboxGroupField-XSVAmESI.d.mts → CheckboxGroupField-BW_BcW3L.d.mts} +2 -2
- package/dist/CheckboxGroupField.d.mts +1 -1
- package/dist/{Combobox-DbcSss15.d.mts → Combobox-DgYwerwd.d.mts} +3 -3
- package/dist/{Combobox-BNjYEAmv.mjs → Combobox-DmFQ5cAy.mjs} +63 -51
- package/dist/Combobox-DmFQ5cAy.mjs.map +1 -0
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-CrFweFGi.d.mts → ComboboxBase-DoKiRjgS.d.mts} +2 -2
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-Cp5GBGQj.d.mts → ComboboxMultiSelect-DsoIMJiZ.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-u7fK3Yvy.d.mts → ComboboxSingleSelect-CKsqOAGB.d.mts} +3 -3
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/{CompactBar-BLZZWtIE.d.mts → CompactBar-tNtY2EhN.d.mts} +2 -2
- package/dist/CompactBar.d.mts +1 -1
- package/dist/{ControlBar-B3Jn8G0k.d.mts → ControlBar-CDb6b1_6.d.mts} +5 -3
- package/dist/ControlBar.d.mts +1 -1
- package/dist/{DataTable-DdSY9mzT.mjs → DataTable-DZ0B2Zm9.mjs} +146 -77
- package/dist/DataTable-DZ0B2Zm9.mjs.map +1 -0
- package/dist/{DataTable-C1mdfmQa.d.mts → DataTable-on3vGhyi.d.mts} +31 -7
- package/dist/DataTable.d.mts +1 -1
- package/dist/{DatePicker-DiilpYQg.mjs → DatePicker-CHVYVKB-.mjs} +2 -2
- package/dist/{DatePicker-DiilpYQg.mjs.map → DatePicker-CHVYVKB-.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +1 -1
- package/dist/{DropdownMenu-CQR0U-zM.d.mts → DropdownMenu-eVY-Yjpq.d.mts} +2 -2
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{FloatingActionBar-BUgSKimy.d.mts → FloatingActionBar-CfgjHs81.d.mts} +5 -1
- package/dist/FloatingActionBar.d.mts +1 -1
- package/dist/{FormField-yYJFkJ6R.mjs → FormField-BfVrDOY0.mjs} +4 -4
- package/dist/{FormField-yYJFkJ6R.mjs.map → FormField-BfVrDOY0.mjs.map} +1 -1
- package/dist/{HoverCopyableField-X2XfKTTh.mjs → HoverCopyableField-CJ_p3llp.mjs} +2 -2
- package/dist/{HoverCopyableField-X2XfKTTh.mjs.map → HoverCopyableField-CJ_p3llp.mjs.map} +1 -1
- package/dist/IndexTableLayout.d.mts +3 -3
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Link-B29ZMN6m.mjs → Link-Df3zJrj2.mjs} +1 -1
- package/dist/{Link-B29ZMN6m.mjs.map → Link-Df3zJrj2.mjs.map} +1 -1
- package/dist/{ListBox-4rTgr3IJ.mjs → ListBox-BRgjgUSp.mjs} +2 -2
- package/dist/{ListBox-4rTgr3IJ.mjs.map → ListBox-BRgjgUSp.mjs.map} +1 -1
- package/dist/{ListBox-ZDaitaXR.d.mts → ListBox-Bgug8YZF.d.mts} +2 -2
- package/dist/ListBox.d.mts +1 -1
- package/dist/{ListBoxField-CGvVWKyL.d.mts → ListBoxField-Cc1sX2bo.d.mts} +4 -4
- package/dist/ListBoxField.d.mts +1 -1
- package/dist/{LogicRow-Bzp5o1sL.d.mts → LogicRow-B1_35ZJT.d.mts} +2 -2
- package/dist/LogicRow.d.mts +1 -1
- package/dist/{Menu-DviYNrFd.d.mts → Menu-keVl-eKm.d.mts} +2 -2
- package/dist/Menu.d.mts +1 -1
- package/dist/{Modal-CiPFqr0L.mjs → Modal-SnCo7ecm.mjs} +3 -2
- package/dist/Modal-SnCo7ecm.mjs.map +1 -0
- package/dist/{Pii-jSYND7Cn.mjs → Pii-BYPkrBuT.mjs} +1 -1
- package/dist/{Pii-jSYND7Cn.mjs.map → Pii-BYPkrBuT.mjs.map} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs → Popover-DP9DXReH.mjs} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs.map → Popover-DP9DXReH.mjs.map} +1 -1
- package/dist/{Select-DsVeAyZy.d.mts → Select-CiofH5-f.d.mts} +2 -2
- package/dist/Select.d.mts +1 -1
- package/dist/SmartTextInputField.d.mts +2 -2
- package/dist/SmartTextInputListbox.d.mts +8 -3
- package/dist/{TableBox-D9NA-s9l.mjs → TableBox-RxpwflEb.mjs} +3 -3
- package/dist/{TableBox-D9NA-s9l.mjs.map → TableBox-RxpwflEb.mjs.map} +1 -1
- package/dist/TableBox.d.mts +1 -1
- package/dist/{TableBoxCell-CQOL30et.d.mts → TableBoxCell-C65YFYqj.d.mts} +4 -4
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/{TableBoxField-z0GIFeQw.d.mts → TableBoxField-CHpClgsE.d.mts} +5 -5
- package/dist/TableBoxField.d.mts +1 -1
- package/dist/{TableBoxRow-tb9-KMr9.d.mts → TableBoxRow-CK-b79uD.d.mts} +2 -2
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-BZwulsFP.d.mts → TableBoxRowActions-CRaabjaY.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableControls-BXykbUBf.mjs → TableControls-DM4RddQ_.mjs} +31 -12
- package/dist/TableControls-DM4RddQ_.mjs.map +1 -0
- package/dist/{TableControls-DE6eHq8h.d.mts → TableControls-v1NmlFTW.d.mts} +4 -4
- package/dist/TableControls.d.mts +1 -1
- package/dist/{TableControlsContext-C2_2EuMh.d.mts → TableControlsContext-DHYICXxy.d.mts} +2 -2
- package/dist/TableControlsContext.d.mts +1 -1
- package/dist/{TableViewConfigurationDropdown-DE9HFXYY.d.mts → TableViewConfigurationDropdown-1nT8wneI.d.mts} +2 -2
- package/dist/TableViewConfigurationDropdown.d.mts +1 -1
- package/dist/{clientFilterUtils-2TBUC31K.d.mts → clientFilterUtils-CaF2QZBy.d.mts} +2 -2
- package/dist/clientFilterUtils.d.mts +1 -1
- package/dist/components/Combobox/index.d.mts +4 -4
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/DataTable/TableControls/index.d.mts +7 -7
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.d.mts +6 -6
- package/dist/components/DataTable/index.mjs +1 -1
- package/dist/components/DataTable/types.d.mts +1 -1
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/FormField/index.d.mts +4 -4
- package/dist/components/FormField/index.mjs +1 -1
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/Link/index.mjs +1 -1
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Modal/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/Popover/index.mjs +1 -1
- package/dist/components/RichTextEditor/index.mjs +2 -2
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/SmartTextInput/index.mjs +104 -48
- package/dist/components/SmartTextInput/index.mjs.map +1 -1
- package/dist/components/TableBox/index.d.mts +1 -1
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/VersionHistory/index.mjs +1 -1
- package/dist/fieldPickerOptions.d.mts +1 -1
- package/dist/{filters-DW7pqWv3.d.mts → filters-CShP0Jag.d.mts} +2 -2
- package/dist/filters.d.mts +1 -1
- package/dist/{helpers-BTD2kXLs.d.mts → helpers-Bbi1LyMW.d.mts} +5 -3
- package/dist/helpers.d.mts +1 -1
- package/dist/{index-B4tE0RxY.d.mts → index-3-eDlpcj.d.mts} +3 -3
- package/dist/{inputFields-DnBb3NhK.d.mts → inputFields-Dobwb4kT.d.mts} +4 -4
- package/dist/inputFields.d.mts +1 -1
- package/dist/lib/PDSProvider.d.mts +2 -1
- package/dist/lib/PDSProvider.mjs +8 -3
- package/dist/lib/PDSProvider.mjs.map +1 -1
- package/dist/lib/colorMode.d.mts +18 -7
- package/dist/lib/colorMode.mjs +47 -13
- package/dist/lib/colorMode.mjs.map +1 -1
- package/dist/lib/schemaOptions.mjs +1 -1
- package/dist/lib/schemaOptions.mjs.map +1 -1
- package/dist/patterns/IndexTableLayout/index.mjs +1 -1
- package/dist/patterns/WizardModal/index.mjs +1 -1
- package/dist/{types-NO2GRlM-.d.mts → types-BTaKBrxG.d.mts} +2 -2
- package/dist/{types-Dws2XDz2.d.mts → types-CUnL8JJj.d.mts} +6 -4
- package/dist/types5.d.mts +1 -1
- package/dist/useColumnConfiguration.d.mts +2 -2
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/{useTableColumns-tITjHasE.d.mts → useTableColumns-BuxN7Usm.d.mts} +17 -2
- package/dist/useTableColumns.d.mts +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/dist/utils4.d.mts +1 -1
- package/dist/withDisabledReason.d.mts +19 -0
- package/llms.txt +4 -3
- package/package.json +4 -12
- package/skills/ui-authoring/COMPONENTS.md +0 -1
- package/skills/ui-authoring/PATTERNS.md +0 -64
- package/skills/ui-authoring/TOKENS.md +14 -25
- package/dist/ChartFrame.d.mts +0 -61
- package/dist/ChartLegend.d.mts +0 -60
- package/dist/ChartPopover.d.mts +0 -155
- package/dist/Combobox-BNjYEAmv.mjs.map +0 -1
- package/dist/DataTable-DdSY9mzT.mjs.map +0 -1
- package/dist/Modal-CiPFqr0L.mjs.map +0 -1
- package/dist/TableControls-BXykbUBf.mjs.map +0 -1
- package/dist/chartColors.d.mts +0 -92
- package/dist/chartFrameLayout.d.mts +0 -46
- package/dist/components/Chart/index.d.mts +0 -9
- package/dist/components/Chart/index.mjs +0 -680
- package/dist/components/Chart/index.mjs.map +0 -1
- package/dist/useChartColors.d.mts +0 -30
- package/dist/useChartSeriesVisibility.d.mts +0 -22
- 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
|
|
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
|
|
706
|
-
`@persona/design-
|
|
707
|
-
|
|
708
|
-
|
|
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 |
|
|
711
|
-
|
|
712
|
-
| Distinct, unordered series (default) | `
|
|
713
|
-
| Ordered magnitude in one hue | `
|
|
714
|
-
| Values diverging around a midpoint | `
|
|
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
|
|
718
|
-
|
|
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
|
package/dist/ChartFrame.d.mts
DELETED
|
@@ -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
|
package/dist/ChartLegend.d.mts
DELETED
|
@@ -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
|
package/dist/ChartPopover.d.mts
DELETED
|
@@ -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
|