@unpunnyfuns/swatchbook-blocks 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -226,6 +226,66 @@ declare function ColorPalette({
226
226
  sortDir
227
227
  }: ColorPaletteProps): ReactElement;
228
228
  //#endregion
229
+ //#region src/ColorTable.d.ts
230
+ interface ColorTableProps {
231
+ /**
232
+ * Token-path filter. Defaults to every `$type: color` token. `"color.*"`
233
+ * scopes to the semantic layer; `"color.palette.blue.*"` to a single ramp.
234
+ */
235
+ filter?: string;
236
+ /** Override the table caption. */
237
+ caption?: string;
238
+ /**
239
+ * Sort order.
240
+ * - `'path'` (default) — lexicographic on the dot-path.
241
+ * - `'value'` — perceptual (oklch L → C → H). Ramps read light→dark, then
242
+ * warm→cool within each lightness band.
243
+ * - `'none'` — preserve project iteration order.
244
+ */
245
+ sortBy?: SortBy;
246
+ /** `'asc'` (default) or `'desc'`. */
247
+ sortDir?: SortDir;
248
+ /**
249
+ * Render a fuzzy-search input above the table (case-insensitive,
250
+ * single-char typo tolerance, out-of-order terms, matches across path +
251
+ * any format value). Defaults to `true`.
252
+ */
253
+ searchable?: boolean;
254
+ /**
255
+ * Called with the clicked row's dot-path. When set, the built-in
256
+ * `<TokenDetail>` drawer is suppressed — the consumer owns follow-up UI.
257
+ */
258
+ onSelect?(path: string): void;
259
+ /**
260
+ * Map from a display label to a suffix matched against each token's
261
+ * trailing path segment. A row whose leaf matches one of the suffixes
262
+ * gets the corresponding label rendered as a pill after the token name.
263
+ *
264
+ * Accepts both DTCG-idiomatic and Backmarket-style conventions:
265
+ * - **Dot segment** (`color.bg.hi.disabled`): the last dot-segment equals
266
+ * the suffix exactly (`suffix === 'disabled'`).
267
+ * - **Hyphen tail** (`color.bg.hi-d`): the last dot-segment ends in
268
+ * `-<suffix>` (`suffix === 'd'`).
269
+ *
270
+ * Longest-suffix-wins: `{ hover: 'h', hoverDark: 'h-dark' }` picks
271
+ * `hoverDark` for a path ending in `-h-dark`. The hyphen-tail form
272
+ * requires an actual hyphen boundary — suffix `0` does not match
273
+ * `neutral-900`. Tokens that don't match any suffix render with no pill.
274
+ *
275
+ * Empty map (default) → no pills; the block behaves exactly as before.
276
+ */
277
+ variants?: Record<string, string>;
278
+ }
279
+ declare function ColorTable({
280
+ filter,
281
+ caption,
282
+ sortBy,
283
+ sortDir,
284
+ searchable,
285
+ onSelect,
286
+ variants
287
+ }: ColorTableProps): ReactElement;
288
+ //#endregion
229
289
  //#region src/Diagnostics.d.ts
230
290
  interface DiagnosticsProps {
231
291
  /** Override the section caption. Defaults to a severity summary. */
@@ -605,11 +665,12 @@ interface TokenNavigatorProps {
605
665
  */
606
666
  initiallyExpanded?: number;
607
667
  /**
608
- * Render a runtime search input above the tree. Matches are
609
- * case-insensitive substrings against a leaf's token path; groups
610
- * that contain no matching leaves collapse out, and every group on
611
- * the path to a match auto-expands so hits are visible without
612
- * clicking. Defaults to `true`.
668
+ * Render a runtime search input above the tree. Matches are fuzzy
669
+ * (case-insensitive, out-of-order terms, single-character typo
670
+ * tolerance) against a leaf's token path; groups that contain no
671
+ * matching leaves collapse out, and every group on the path to a
672
+ * match auto-expands so hits are visible without clicking. Defaults
673
+ * to `true`.
613
674
  */
614
675
  searchable?: boolean;
615
676
  /**
@@ -652,10 +713,11 @@ interface TokenTableProps {
652
713
  sortDir?: SortDir;
653
714
  /**
654
715
  * Render a runtime search input above the table that narrows rows by
655
- * case-insensitive substring against the token path, type, or value.
656
- * Defaults to `true` because browsing a multi-hundred-token reference
657
- * without search is painful. Pass `false` to hide the input (the
658
- * `filter` / `type` props still apply at authoring time).
716
+ * fuzzy match (case-insensitive, out-of-order terms, single-character
717
+ * typo tolerance) against the token path, type, or value. Defaults to
718
+ * `true` because browsing a multi-hundred-token reference without
719
+ * search is painful. Pass `false` to hide the input (the `filter` /
720
+ * `type` props still apply at authoring time).
659
721
  */
660
722
  searchable?: boolean;
661
723
  /**
@@ -703,5 +765,5 @@ declare function TypographyScale({
703
765
  sortDir
704
766
  }: TypographyScaleProps): ReactElement;
705
767
  //#endregion
706
- export { AliasChain, type AliasChainProps, AliasedBy, type AliasedByProps, AxesContext, AxisVariance, type AxisVarianceProps, BorderPreview, type BorderPreviewProps, BorderSample, type BorderSampleProps, COLOR_FORMATS, type ColorFormat, ColorFormatContext, ColorPalette, type ColorPaletteProps, CompositeBreakdown, type CompositeBreakdownProps, CompositePreview, type CompositePreviewProps, ConsumerOutput, type ConsumerOutputProps, Diagnostics, type DiagnosticsProps, DimensionBar, type DimensionBarProps, type DimensionKind, DimensionScale, type DimensionScaleProps, FontFamilySample, type FontFamilySampleProps, FontWeightScale, type FontWeightScaleProps, type FormatColorResult, GradientPalette, type GradientPaletteProps, MotionPreview, type MotionPreviewProps, MotionSample, type MotionSampleProps, type MotionSpeed, type NormalizedColor, type ProjectSnapshot, ShadowPreview, type ShadowPreviewProps, ShadowSample, type ShadowSampleProps, StrokeStyleSample, type StrokeStyleSampleProps, SwatchbookContext, SwatchbookProvider, type SwatchbookProviderProps, ThemeContext, TokenDetail, type TokenDetailProps, TokenHeader, type TokenHeaderProps, TokenNavigator, type TokenNavigatorProps, TokenTable, type TokenTableProps, TokenUsageSnippet, type TokenUsageSnippetProps, TypographyScale, type TypographyScaleProps, type VirtualAxisShape as VirtualAxis, type VirtualAxisShape, type VirtualDiagnosticShape as VirtualDiagnostic, type VirtualDiagnosticShape, type VirtualPresetShape as VirtualPreset, type VirtualPresetShape, type VirtualThemeShape as VirtualTheme, type VirtualThemeShape, type VirtualTokenShape as VirtualToken, type VirtualTokenShape, formatColor, useActiveAxes, useActiveTheme, useColorFormat, useOptionalSwatchbookData, useSwatchbookData };
768
+ export { AliasChain, type AliasChainProps, AliasedBy, type AliasedByProps, AxesContext, AxisVariance, type AxisVarianceProps, BorderPreview, type BorderPreviewProps, BorderSample, type BorderSampleProps, COLOR_FORMATS, type ColorFormat, ColorFormatContext, ColorPalette, type ColorPaletteProps, ColorTable, type ColorTableProps, CompositeBreakdown, type CompositeBreakdownProps, CompositePreview, type CompositePreviewProps, ConsumerOutput, type ConsumerOutputProps, Diagnostics, type DiagnosticsProps, DimensionBar, type DimensionBarProps, type DimensionKind, DimensionScale, type DimensionScaleProps, FontFamilySample, type FontFamilySampleProps, FontWeightScale, type FontWeightScaleProps, type FormatColorResult, GradientPalette, type GradientPaletteProps, MotionPreview, type MotionPreviewProps, MotionSample, type MotionSampleProps, type MotionSpeed, type NormalizedColor, type ProjectSnapshot, ShadowPreview, type ShadowPreviewProps, ShadowSample, type ShadowSampleProps, StrokeStyleSample, type StrokeStyleSampleProps, SwatchbookContext, SwatchbookProvider, type SwatchbookProviderProps, ThemeContext, TokenDetail, type TokenDetailProps, TokenHeader, type TokenHeaderProps, TokenNavigator, type TokenNavigatorProps, TokenTable, type TokenTableProps, TokenUsageSnippet, type TokenUsageSnippetProps, TypographyScale, type TypographyScaleProps, type VirtualAxisShape as VirtualAxis, type VirtualAxisShape, type VirtualDiagnosticShape as VirtualDiagnostic, type VirtualDiagnosticShape, type VirtualPresetShape as VirtualPreset, type VirtualPresetShape, type VirtualThemeShape as VirtualTheme, type VirtualThemeShape, type VirtualTokenShape as VirtualToken, type VirtualTokenShape, formatColor, useActiveAxes, useActiveTheme, useColorFormat, useOptionalSwatchbookData, useSwatchbookData };
707
769
  //# sourceMappingURL=index.d.mts.map