plass-ui 1.5.0 → 1.7.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 (183) hide show
  1. package/CHANGELOG.md +336 -0
  2. package/README.md +29 -7
  3. package/dist/components/accordion/PlAccordion.d.ts +13 -0
  4. package/dist/components/accordion/PlAccordion.js +1 -1
  5. package/dist/components/accordion/index.d.ts +1 -1
  6. package/dist/components/alert/PlAlert.js +1 -1
  7. package/dist/components/animate-counter/PlAnimateCounter.js +1 -1
  8. package/dist/components/animate-float/PlAnimateFloat.js +1 -1
  9. package/dist/components/animate-headline/PlAnimateHeadline.d.ts +10 -1
  10. package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +11 -1
  11. package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -1
  12. package/dist/components/animate-scramble/PlAnimateScramble.js +1 -1
  13. package/dist/components/animate-split/PlAnimateSplit.js +1 -1
  14. package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
  15. package/dist/components/app-logo/PlAppLogo.js +1 -1
  16. package/dist/components/area-chart/PlAreaChart.d.ts +35 -6
  17. package/dist/components/area-chart/PlAreaChart.js +1 -1
  18. package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
  19. package/dist/components/avatar/PlAvatar.js +1 -1
  20. package/dist/components/back-top/PlBackTop.d.ts +6 -0
  21. package/dist/components/back-top/PlBackTop.js +1 -1
  22. package/dist/components/badge/PlBadge.js +1 -1
  23. package/dist/components/bar-chart/PlBarChart.d.ts +54 -2
  24. package/dist/components/bar-chart/PlBarChart.js +1 -1
  25. package/dist/components/blockquote/PlBlockquote.d.ts +2 -2
  26. package/dist/components/blockquote/PlBlockquote.js +1 -1
  27. package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -1
  28. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  29. package/dist/components/button/PlButton.d.ts +7 -0
  30. package/dist/components/button/PlButton.js +1 -1
  31. package/dist/components/calendar/PlCalendar.js +1 -1
  32. package/dist/components/card/PlCard.d.ts +7 -4
  33. package/dist/components/carousel/PlCarousel.d.ts +14 -4
  34. package/dist/components/carousel/PlCarousel.js +1 -1
  35. package/dist/components/chat-bubble/PlChatBubble.js +1 -1
  36. package/dist/components/checkbox/PlCheckbox.js +1 -1
  37. package/dist/components/chip/PlChip.d.ts +2 -1
  38. package/dist/components/chip/PlChip.js +1 -1
  39. package/dist/components/collapsible/PlCollapsible.d.ts +11 -0
  40. package/dist/components/collapsible/PlCollapsible.js +1 -1
  41. package/dist/components/color-picker/PlColorPicker.d.ts +21 -2
  42. package/dist/components/color-picker/PlColorPicker.js +1 -1
  43. package/dist/components/combobox/PlCombobox.d.ts +18 -6
  44. package/dist/components/combobox/PlCombobox.js +1 -1
  45. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  46. package/dist/components/confirm/PlConfirmProvider.js +1 -1
  47. package/dist/components/data-table/PlDataTable.d.ts +13 -2
  48. package/dist/components/data-table/PlDataTable.js +1 -1
  49. package/dist/components/date-picker/PlDatePicker.js +1 -1
  50. package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
  51. package/dist/components/drawer/PlDrawer.js +1 -1
  52. package/dist/components/empty/PlEmpty.js +1 -1
  53. package/dist/components/fieldset/PlFieldset.js +1 -1
  54. package/dist/components/file-picker/PlFilePicker.d.ts +20 -2
  55. package/dist/components/file-picker/PlFilePicker.js +1 -1
  56. package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +5 -0
  57. package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -1
  58. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
  59. package/dist/components/footer/PlFooter.d.ts +3 -1
  60. package/dist/components/gallery/PlGallery.js +1 -1
  61. package/dist/components/gauge-chart/PlGaugeChart.js +1 -1
  62. package/dist/components/header/PlHeader.d.ts +4 -2
  63. package/dist/components/header/PlHeader.js +1 -1
  64. package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -1
  65. package/dist/components/highlight/PlHighlight.d.ts +10 -3
  66. package/dist/components/hover-card/PlHoverCard.js +1 -1
  67. package/dist/components/how-to-steps/PlHowToSteps.js +1 -1
  68. package/dist/components/image/PlImage.js +1 -1
  69. package/dist/components/line-chart/PlLineChart.d.ts +32 -6
  70. package/dist/components/line-chart/PlLineChart.js +1 -1
  71. package/dist/components/list/PlList.js +1 -1
  72. package/dist/components/menu/PlMenu.js +1 -1
  73. package/dist/components/mockup/PlMockup.d.ts +5 -0
  74. package/dist/components/mockup/PlMockup.js +1 -1
  75. package/dist/components/modal/PlModal.js +1 -1
  76. package/dist/components/navigation-menu/PlNavigationMenu.d.ts +4 -3
  77. package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
  78. package/dist/components/number-field/PlNumberField.d.ts +14 -4
  79. package/dist/components/number-field/PlNumberField.js +1 -1
  80. package/dist/components/otp-field/PlOtpField.d.ts +9 -1
  81. package/dist/components/otp-field/PlOtpField.js +1 -1
  82. package/dist/components/overlay/PlOverlay.js +1 -1
  83. package/dist/components/page-layout/PlPageLayout.d.ts +14 -3
  84. package/dist/components/page-layout/PlPageLayout.js +1 -1
  85. package/dist/components/pagination/PlPagination.js +1 -1
  86. package/dist/components/panes/PlPanes.js +1 -1
  87. package/dist/components/pie-chart/PlPieChart.d.ts +26 -1
  88. package/dist/components/pie-chart/PlPieChart.js +1 -1
  89. package/dist/components/pill/PlPill.js +1 -1
  90. package/dist/components/popconfirm/PlPopconfirm.d.ts +8 -1
  91. package/dist/components/popconfirm/PlPopconfirm.js +1 -1
  92. package/dist/components/popover/PlPopover.js +1 -1
  93. package/dist/components/progress-box/PlProgressBox.js +1 -1
  94. package/dist/components/progress-circular/PlProgressCircular.js +1 -1
  95. package/dist/components/progress-linear/PlProgressLinear.js +1 -1
  96. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  97. package/dist/components/rating/PlRating.js +1 -1
  98. package/dist/components/scatter-chart/PlScatterChart.js +1 -1
  99. package/dist/components/scroll-area/PlScrollArea.js +1 -1
  100. package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
  101. package/dist/components/select/PlSelect.d.ts +11 -2
  102. package/dist/components/select/PlSelect.js +1 -1
  103. package/dist/components/sidebar/PlSidebar.js +1 -1
  104. package/dist/components/slider/PlSlider.js +1 -1
  105. package/dist/components/sparkline/PlSparkline.js +1 -1
  106. package/dist/components/stepper/PlStepper.js +1 -1
  107. package/dist/components/switch/PlSwitch.js +1 -1
  108. package/dist/components/table/PlTable.d.ts +11 -1
  109. package/dist/components/table/PlTable.js +1 -1
  110. package/dist/components/tabs/PlTabs.d.ts +18 -1
  111. package/dist/components/tabs/PlTabs.js +1 -1
  112. package/dist/components/text-field/PlTextField.d.ts +13 -5
  113. package/dist/components/text-field/PlTextField.js +1 -1
  114. package/dist/components/text-link/PlTextLink.js +1 -1
  115. package/dist/components/timeline/PlTimeline.js +1 -1
  116. package/dist/components/timeline-chart/PlTimelineChart.js +1 -1
  117. package/dist/components/toast/PlToast.js +1 -1
  118. package/dist/components/toggle/PlToggle.js +1 -1
  119. package/dist/components/tooltip/PlTooltip.d.ts +4 -0
  120. package/dist/components/tooltip/PlTooltip.js +1 -1
  121. package/dist/components/tour/PlTour.js +1 -1
  122. package/dist/components/transfer/PlTransfer.d.ts +5 -2
  123. package/dist/components/transfer/PlTransfer.js +1 -1
  124. package/dist/components/tree/PlTree.js +1 -1
  125. package/dist/components/tree-select/PlTreeSelect.js +1 -1
  126. package/dist/components/typography/PlTypography.js +1 -1
  127. package/dist/components/window-pane/PlWindowPane.d.ts +16 -6
  128. package/dist/components/window-pane/PlWindowPane.js +1 -1
  129. package/dist/internal/animate.d.ts +0 -25
  130. package/dist/internal/animate.js +1 -1
  131. package/dist/internal/bottom-bar.d.ts +29 -0
  132. package/dist/internal/bottom-bar.js +1 -0
  133. package/dist/internal/calendar.js +1 -1
  134. package/dist/internal/chart-frame.d.ts +90 -27
  135. package/dist/internal/chart-frame.js +1 -1
  136. package/dist/internal/chart-line.d.ts +11 -6
  137. package/dist/internal/chart-line.js +1 -1
  138. package/dist/internal/chart.d.ts +158 -1
  139. package/dist/internal/chart.js +1 -1
  140. package/dist/internal/defaults.d.ts +14 -1
  141. package/dist/internal/focusable.d.ts +10 -0
  142. package/dist/internal/focusable.js +1 -1
  143. package/dist/internal/form.d.ts +29 -0
  144. package/dist/internal/form.js +1 -1
  145. package/dist/internal/glow.d.ts +47 -1
  146. package/dist/internal/glow.js +1 -1
  147. package/dist/internal/icons.d.ts +24 -0
  148. package/dist/internal/icons.js +1 -1
  149. package/dist/internal/labels.d.ts +35 -0
  150. package/dist/internal/labels.js +1 -1
  151. package/dist/internal/loading.d.ts +13 -0
  152. package/dist/internal/loading.js +1 -0
  153. package/dist/internal/mockup.js +1 -1
  154. package/dist/internal/notch.d.ts +137 -0
  155. package/dist/internal/notch.js +1 -0
  156. package/dist/internal/picker.d.ts +15 -3
  157. package/dist/internal/picker.js +1 -1
  158. package/dist/internal/progress.d.ts +17 -6
  159. package/dist/internal/progress.js +1 -1
  160. package/dist/internal/sizer.d.ts +12 -11
  161. package/dist/internal/sizer.js +1 -1
  162. package/dist/internal/steps.d.ts +0 -15
  163. package/dist/internal/steps.js +1 -1
  164. package/dist/internal/styles.d.ts +135 -8
  165. package/dist/internal/styles.js +1 -1
  166. package/dist/internal/table-scroll.d.ts +42 -0
  167. package/dist/internal/table-scroll.js +1 -0
  168. package/dist/internal/table.js +1 -1
  169. package/dist/internal/text.d.ts +8 -5
  170. package/dist/internal/window.js +1 -1
  171. package/dist/locales/de.js +1 -1
  172. package/dist/locales/es.js +1 -1
  173. package/dist/locales/fr.js +1 -1
  174. package/dist/locales/ja.js +1 -1
  175. package/dist/locales/ko.js +1 -1
  176. package/dist/locales/zh-Hans.js +1 -1
  177. package/dist/provider/PlassProvider.d.ts +4 -3
  178. package/dist/provider/PlassProvider.js +1 -1
  179. package/dist/styles.css +1 -1
  180. package/dist/tailwind.css +461 -46
  181. package/dist/tokens.css +461 -46
  182. package/dist/types.d.ts +270 -11
  183. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -131,6 +131,65 @@ export type PlassOverscroll = 'auto' | 'contain';
131
131
  * a caller spell `{ vertical: 'left' }`.
132
132
  */
133
133
  export type PlassCorner = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
134
+ /**
135
+ * Where a **field-shaped** control puts the name of what it holds.
136
+ *
137
+ * The placements a box has to offer, which are not the placements a tick has:
138
+ * a PlCheckbox, a PlRadio and a PlSwitch put their label beside themselves and
139
+ * take `labelPlacement` out of `PlassAlign` instead — same question, same prop
140
+ * name, the answers each shape actually has. See `PlSwitchLabelPlacement`.
141
+ *
142
+ * - `top` — above the control, on its own line. The default, and the one that
143
+ * is always safe: the label is a block of text in the layout, it can wrap, it
144
+ * can be as long as it needs to be, and nothing about the control's edge has
145
+ * to make room for it.
146
+ * - `notch` — in the control's own top edge, with the hairline cut away behind
147
+ * it. The label stops being a line of the form and becomes part of the field,
148
+ * which buys back a row of vertical space and ties the name to the box rather
149
+ * than to whatever is above it.
150
+ * - `float` — inside the control, where its value would be written, while the
151
+ * control is empty and nothing in it has the focus; it rises into the notch
152
+ * the moment either stops being true, and comes back down when both are true
153
+ * again. At rest it is set as the placeholder it stands in for is — the
154
+ * control's text size, the regular weight and the muted ink — and the
155
+ * placeholder waits until the label has risen.
156
+ *
157
+ * A `float` label moves on its position, its font size and its weight and
158
+ * never on a `transform`: it is set again at every size on the way, so no
159
+ * frame of it is a scaled picture of the word. A control that draws something at its start —
160
+ * a `startIcon`, a picker's glyph, a number field's split steppers — keeps a
161
+ * `float` label in the notch, because the place it would rest is taken, and so
162
+ * does a `PlFilePicker`, whose box has words of its own there.
163
+ *
164
+ * The cut is a real one — a `<legend>` in a `<fieldset>`, which is the only way
165
+ * to take a segment out of a border without knowing what is behind it. Nothing
166
+ * here paints over the line with the page's colour, because a library that does
167
+ * not paint the page cannot know what colour that is, and a Plass field is
168
+ * translucent besides.
169
+ *
170
+ * Two things follow from the label sitting on the edge, and both are deliberate:
171
+ *
172
+ * - **Focus is the edge thickening rather than a ring.** An outline is a
173
+ * rectangle and would run straight through the label. The edge that is
174
+ * already there goes to 2px and takes the family's colour instead, which is
175
+ * what the flush ring was drawn to look like anyway.
176
+ * - **The label no longer widens the control.** It is out of the flow, so a
177
+ * label longer than a narrow field runs past its end. Give the field
178
+ * `fullWidth`, or keep the word short — a notch is a place for "Email", not
179
+ * for a sentence.
180
+ *
181
+ * Only `glass` has a hairline to cut. On `solid` and `ghost` the label sits in
182
+ * the same place and there is simply nothing there to take out, so a form that
183
+ * mixes the three keeps one baseline for its labels.
184
+ *
185
+ * **`PlOtpField` is the one labelled field that does not take this**, and the
186
+ * reason is the same one that decides everything above: a notch is a segment
187
+ * taken out of one continuous edge, and a row of separate boxes with gaps
188
+ * between them has no such edge. Cutting only the first box leaves the word
189
+ * lying across the two after it, which is worse than the label above the row
190
+ * that it keeps.
191
+ */
192
+ export type PlassFieldLabelPlacement = 'top' | 'notch' | 'float';
134
193
  /**
135
194
  * What a surface is made of. This is the library's own name, and the two
136
195
  * materials in it are the whole design language.
@@ -254,7 +313,7 @@ export type PlassColorSlot = 'accent' | 'fill' | 'line' | 'line-hover' | 'on-sol
254
313
  * sets one is setting the answer rather than the question. `color`, `variant`
255
314
  * and `elevation` are the props that decide them.
256
315
  */
257
- export type PlassToken = `--plass-${PlassColor}-${PlassColorSlot}` | `--plass-radius-${PlassSize}` | `--plass-shadow-${0 | 1 | 2 | 3 | 4}` | `--plass-chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}` | `--plass-chart-seq-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-div-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-seq-on-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-div-on-${1 | 2 | 3 | 4 | 5}` | '--plass-chart-grid' | '--plass-chart-axis' | '--plass-chart-baseline' | '--plass-chart-gap' | '--plass-shadow-ambient' | '--plass-bg-from' | '--plass-bg-to' | '--plass-blur' | '--plass-border' | '--plass-breakpoint-sm' | '--plass-breakpoint-md' | '--plass-breakpoint-lg' | '--plass-breakpoint-xl' | '--plass-divider' | '--plass-duration' | '--plass-duration-slow' | '--plass-ease' | '--plass-fg' | '--plass-flash-on-fill' | '--plass-glass' | '--plass-glass-hover' | '--plass-glass-line' | '--plass-glass-press' | '--plass-gloss-glass' | '--plass-glow-angle' | '--plass-glow-on-fill' | '--plass-muted-fg' | '--plass-scrim' | '--plass-stripe' | '--plass-surface' | '--plass-tint-strength' | '--plass-track' | '--plass-well' | '--plass-z-portal';
316
+ export type PlassToken = `--plass-${PlassColor}-${PlassColorSlot}` | `--plass-radius-${PlassSize}` | `--plass-shadow-${0 | 1 | 2 | 3 | 4}` | `--plass-chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}` | `--plass-chart-seq-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-div-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-seq-on-${1 | 2 | 3 | 4 | 5}` | `--plass-chart-div-on-${1 | 2 | 3 | 4 | 5}` | '--plass-chart-grid' | '--plass-chart-axis' | '--plass-chart-baseline' | '--plass-chart-gap' | '--plass-shadow-ambient' | '--plass-bg-from' | '--plass-bg-to' | '--plass-blur' | '--plass-border' | '--plass-bottom-navigation-height' | '--plass-breakpoint-sm' | '--plass-breakpoint-md' | '--plass-breakpoint-lg' | '--plass-breakpoint-xl' | '--plass-divider' | '--plass-duration' | '--plass-duration-slow' | '--plass-ease' | '--plass-fg' | '--plass-flash-on-fill' | '--plass-glass' | '--plass-glass-hover' | '--plass-glass-line' | '--plass-glass-press' | '--plass-gloss-glass' | '--plass-glow-angle' | '--plass-glow-field-strength' | '--plass-glow-on-fill' | '--plass-muted-fg' | '--plass-scrim' | '--plass-stripe' | '--plass-surface' | '--plass-tint-strength' | '--plass-track' | '--plass-well' | '--plass-z-portal';
258
317
  /**
259
318
  * A set of token overrides, on its own.
260
319
  *
@@ -512,6 +571,17 @@ export interface PlassChartSeries {
512
571
  * the reader cannot identify.
513
572
  */
514
573
  name?: string;
574
+ /**
575
+ * What the chart knows it by from one render to the next, for a series whose
576
+ * name is not enough: one that shares its name with another, or one whose
577
+ * name changes.
578
+ *
579
+ * Its legend entry, whether the legend has it switched off, the pointer
580
+ * resting on that entry and a mark of it being read are held by it. Without
581
+ * one, a series is known by its name and how many series before it have that
582
+ * name, or by its place in the array when it has no name.
583
+ */
584
+ id?: string;
515
585
  /** The values, in category order. */
516
586
  data: readonly PlassChartDatum[];
517
587
  /**
@@ -531,6 +601,16 @@ export interface PlassChartSeries {
531
601
  * @default false
532
602
  */
533
603
  hidden?: boolean;
604
+ /**
605
+ * Draws the line dashed — a forecast, a target, a last year.
606
+ *
607
+ * Only a line has a line to dash, so it does nothing on a bar, and nothing on
608
+ * a stacked area either, where the band's fill *is* the mark and there is no
609
+ * stroke along its top. Where the line is dashed, its legend entry is a short
610
+ * dashed rule rather than a square.
611
+ * @default false
612
+ */
613
+ dashed?: boolean;
534
614
  }
535
615
  /**
536
616
  * One span on a `PlTimelineChart` — a stretch of time with two ends.
@@ -574,6 +654,27 @@ export interface PlassTimelineSeries {
574
654
  }
575
655
  /** How a line gets from one point to the next. */
576
656
  export type PlassChartCurve = 'linear' | 'smooth' | 'step';
657
+ /**
658
+ * What a gap in a series does to the line drawn through it.
659
+ *
660
+ * A `null` in the data means *nothing was measured*, which is a different claim
661
+ * from *nothing happened*, and the three answers here are the three ways a
662
+ * chart can respond to it. Picking the wrong one is how a chart comes to say
663
+ * something the data did not.
664
+ *
665
+ * - `gap` — the line stops at the last reading and starts again at the next
666
+ * one. The default, and the only answer that adds nothing: the blank says the
667
+ * month is missing, which is what the data says.
668
+ * - `connect` — the two sides are joined by one straight segment. Right when the
669
+ * gap is an artefact of how the data was collected — a sensor that missed a
670
+ * reading, a day the export skipped — and wrong otherwise, because the line
671
+ * between the two ends is a number the chart made up.
672
+ * - `zero` — the gap is read as a zero, on the axis, in the tooltip and in the
673
+ * table as well as under the line. Right when a missing row genuinely means
674
+ * none: no orders that day, no errors that hour. It moves the scale, which is
675
+ * the point — a zero is a value, and it has to be somewhere on the axis.
676
+ */
677
+ export type PlassChartNulls = 'gap' | 'connect' | 'zero';
577
678
  /**
578
679
  * Which values are written onto the marks themselves.
579
680
  *
@@ -584,19 +685,56 @@ export type PlassChartCurve = 'linear' | 'smooth' | 'step';
584
685
  */
585
686
  export type PlassChartValueLabels = 'none' | 'last' | 'extremes' | 'all';
586
687
  /**
587
- * What the pointer uncovers.
588
- *
589
- * - `index` — every series at the category under the pointer, with a crosshair.
590
- * The default on anything with a shared x axis, because the question a line
591
- * chart is asked is "what happened in March", not "what is this pixel".
592
- * - `item` — the one mark being pointed at.
593
- * - `none` — no tooltip. The values still have to be readable some other way.
594
- */
595
- export type PlassChartTooltipMode = 'index' | 'item' | 'none';
688
+ * What colour the numbers written on the marks are.
689
+ *
690
+ * - `series` — each label in the colour of the line or the bar it is sitting
691
+ * on. The default: a plot with four labelled series says which number belongs
692
+ * to which mark without the reader tracing it back.
693
+ * - `ink` — the page's own foreground, for every label. The palette clears 4:1
694
+ * against the sheet, which is the floor a chart *mark* is held to rather than
695
+ * the 4.5:1 body text wants, so this is the answer for a chart whose labels
696
+ * have to meet the text contrast rule on their own.
697
+ */
698
+ export type PlassChartLabelColor = 'series' | 'ink';
699
+ /**
700
+ * Which way a chart's categories are put in order.
701
+ *
702
+ * A bar chart is the one shape whose categories can be shuffled without losing
703
+ * anything — that is the test for reaching for it over a line chart — so
704
+ * sorting them is free, and it is what turns a wall of bars into a ranking a
705
+ * reader can scan down. `none` leaves them in the order they were given, which
706
+ * is right wherever that order already means something: months, sizes, a
707
+ * funnel's steps.
708
+ */
709
+ export type PlassChartSort = 'none' | 'ascending' | 'descending';
710
+ /**
711
+ * How much of a chart a pointer summons.
712
+ *
713
+ * - `index` — every series at the category the pointer is over, with a
714
+ * crosshair down the column to say which one that is. The default on a chart
715
+ * whose marks sit in a grid, and the right answer when the reader is
716
+ * comparing series *at* a moment.
717
+ * - `item` — the same column narrowed to the one series the pointer is nearest
718
+ * along the value axis. For a plot with more series than a panel can hold.
719
+ * - `nearest` — the one **mark** the pointer is nearest, measured in both
720
+ * directions rather than down a column. It is what a scatter has always done,
721
+ * and on a line or an area it is the answer when two series cross and the
722
+ * reader is pointing at one of them rather than at the month they share.
723
+ * There is no crosshair with it: a crosshair says "these numbers all belong
724
+ * to this column", and there is no column. It measures to the mark, which on
725
+ * a bar is the bar's data end.
726
+ * - `none` — no tooltip at all. The table under the chart still has every
727
+ * number.
728
+ */
729
+ export type PlassChartTooltipMode = 'index' | 'item' | 'nearest' | 'none';
596
730
  /** One series' answer at the category the pointer is on. */
597
731
  export interface PlassChartTooltipItem {
598
732
  /** Its place in the `series` array — the same index its colour came from. */
599
733
  seriesIndex: number;
734
+ /**
735
+ * The series' name. On a `PlTimelineChart`, whose `category` is the row, it
736
+ * is the span's own `label` in words, and absent for a span with none.
737
+ */
600
738
  name?: string;
601
739
  color: string;
602
740
  value: number | null;
@@ -645,8 +783,69 @@ export interface PlassChartAxis {
645
783
  max?: number;
646
784
  /** Roughly how many ticks. The scale still rounds to clean numbers. */
647
785
  tickCount?: number;
648
- /** How a tick is written, overriding the chart's own `format`. */
786
+ /**
787
+ * Whether the axis steps by adding or by multiplying.
788
+ *
789
+ * `log` is the one scale in the library that changes what a distance on the
790
+ * plot means: the same length becomes the same **ratio** rather than the same
791
+ * number of units, so the gap from 10 to 100 is the gap from 100 to 1,000.
792
+ * It is the only way a series that runs from 3 to 3,000,000 can be drawn with
793
+ * the small end still legible, and it has to be labelled as what it is — a
794
+ * reader who takes it for linear reads every shape on it wrong.
795
+ *
796
+ * There is no zero on it, and nothing below one either. An axis whose data
797
+ * reaches either floors at the smallest positive power of ten it needs, or
798
+ * three decades under the top when the data offers none, and those values are
799
+ * drawn on that floor. A bar is the wrong mark for it for the same reason a
800
+ * bar's axis cannot be cropped: what a bar encodes is a length, and on a log
801
+ * axis a bar twice as long is not twice as much.
802
+ *
803
+ * Read on the **value** axis, and on a category axis only where that axis is
804
+ * a second value axis — a `PlScatterChart`'s. A band of categories has no
805
+ * arithmetic to do, and a time axis has its own.
806
+ * @default 'linear'
807
+ */
808
+ scale?: 'linear' | 'log';
809
+ /**
810
+ * How a tick is written, overriding the chart's own `format`.
811
+ *
812
+ * An element it returns is written as the words in it, so `<b>12</b>` puts
813
+ * `12` on the axis: a tick is SVG text, which holds words and no markup.
814
+ */
649
815
  tickFormat?: (value: PlassChartCategory, index: number) => React.ReactNode;
816
+ /**
817
+ * Turns the labels, in degrees, so long names fit without being cut.
818
+ *
819
+ * An axis runs out of room across and not down, so a name wider than its slot
820
+ * is cut to it — and past about four characters a cut stops telling two names
821
+ * apart, which is when this is the answer instead. A turned label takes one
822
+ * line of text across the axis however long it is, and spends the room under
823
+ * the plot, where a chart usually has some.
824
+ *
825
+ * `-45` is the one to reach for: it reads at a glance, and the negative sign
826
+ * runs the text up towards the right, the way every chart that does this
827
+ * draws it. `-90` stands it on end, which fits the most labels in the least
828
+ * width and is the one that has to be read with a tilted head. A positive
829
+ * angle leans the other way, down to the right.
830
+ *
831
+ * `'auto'` asks the axis: it stays upright while every name fits its slot,
832
+ * and turns to `-45` as soon as one of them would be cut. Upright is the best
833
+ * an axis can do when there is room for it, and a diagonal beats a cut at
834
+ * every width — so this is the setting for a chart whose categories are the
835
+ * caller's data rather than the caller's choice. It settles on one of those
836
+ * two angles and never on a third: an angle fitted to the longest name would
837
+ * be a different angle on every chart on a dashboard, and would change under
838
+ * the reader as the window is dragged.
839
+ *
840
+ * The band under the plot grows to hold whatever is asked for, up to about
841
+ * two fifths of the chart's height; a name longer than that is still cut, and
842
+ * the tooltip and the table still have all of it. Only the **category** axis
843
+ * turns — a value axis' ticks are numbers already rounded to be short — and
844
+ * only where that axis runs along the bottom, so it does nothing on a
845
+ * horizontal bar chart, whose category names are already one to a row.
846
+ * @default 0
847
+ */
848
+ tickAngle?: number | 'auto';
650
849
  /**
651
850
  * How much room the axis keeps for its ticks and its label, in pixels.
652
851
  * Measured from the ticks themselves otherwise; set it when a long category
@@ -655,6 +854,50 @@ export interface PlassChartAxis {
655
854
  */
656
855
  thickness?: number;
657
856
  }
857
+ /**
858
+ * A line drawn across the plot at one value — a target, an average, a limit.
859
+ *
860
+ * It is **not data**, and it is drawn as if it knows that: dashed by default,
861
+ * in the muted ink rather than in a palette slot, under the marks rather than
862
+ * over them. A reference that looks like a series is a reference a reader will
863
+ * try to read a value off.
864
+ *
865
+ * It sits on the **value** axis, which means it runs across a vertical chart
866
+ * and down a horizontal one — the same line, drawn on whichever axis the values
867
+ * are on. A marker on the category axis is a different thing and is not this:
868
+ * a band of categories has no value to put a line at, and a column a reader
869
+ * should be looking at is a column that wants its own colour rather than a rule
870
+ * beside it.
871
+ *
872
+ * Every reference is also written into the description a screen reader is given
873
+ * with the chart, because a target is a fact about the picture rather than
874
+ * decoration on it.
875
+ */
876
+ export interface PlassChartReference {
877
+ /** Where it sits, read on the value axis. */
878
+ value: number;
879
+ /**
880
+ * A short word set at the end of the line — "Target", "Last year". Left out,
881
+ * the line is drawn and says nothing, which is right when the page around the
882
+ * chart has already named it.
883
+ */
884
+ label?: string;
885
+ /**
886
+ * Overrides the muted ink it is otherwise drawn in. A `PlassColor` family
887
+ * name, or any CSS colour.
888
+ *
889
+ * Reach for it where the line means something the page already has a colour
890
+ * for — a `danger` limit, a `success` target — and not to make it louder: a
891
+ * reference that outshouts the data has inverted the chart.
892
+ */
893
+ color?: PlassColor | (string & {});
894
+ /**
895
+ * Whether the line is dashed. On, because a solid rule across a plot is what
896
+ * a gridline is, and the two must not be confused.
897
+ * @default true
898
+ */
899
+ dashed?: boolean;
900
+ }
658
901
  /** Where the legend sits, and whether it does anything when clicked. */
659
902
  export interface PlassChartLegend {
660
903
  /** Which edge of the plot. @default 'bottom' */
@@ -668,4 +911,20 @@ export interface PlassChartLegend {
668
911
  interactive?: boolean;
669
912
  /** Draws each series' current value beside its name. @default false */
670
913
  showValue?: boolean;
914
+ /**
915
+ * Shows this many entries and folds the rest behind a button that opens them.
916
+ *
917
+ * A legend is a key, and a key of twelve names wrapped over four rows is a
918
+ * paragraph the reader has to search — on a card, it is also four rows the
919
+ * plot no longer has. Folding keeps the legend one or two rows tall and
920
+ * leaves the rest one press away, which is the right trade whenever the
921
+ * reader is looking up *one* series rather than reading the list.
922
+ *
923
+ * The entries kept are the first ones, in the order the series were passed,
924
+ * because that is the order their colours were handed out in and the order
925
+ * the reader has already learned. Nothing is hidden from a screen reader by
926
+ * it: the fold is a real button that says how many are behind it, and every
927
+ * series is in the table under the chart either way.
928
+ */
929
+ maxEntries?: number;
671
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plass-ui",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "A React UI component library made of glass and gradients — smooth tinted surfaces, shadows in their own colour, and light that follows the pointer. Accessible and themeable, ESM only, types included, dark mode built in.",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",