lucent-ui 0.7.0 → 0.9.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.ts CHANGED
@@ -203,6 +203,46 @@ export declare interface CollapsibleProps {
203
203
  style?: CSSProperties;
204
204
  }
205
205
 
206
+ export declare const COLOR_PICKER_MANIFEST: ComponentManifest;
207
+
208
+ export declare const COLOR_SWATCH_MANIFEST: ComponentManifest;
209
+
210
+ export declare function ColorPicker({ value, onChange, label, disabled, presetGroups, id, style, }: ColorPickerProps): JSX_2.Element;
211
+
212
+ export declare namespace ColorPicker {
213
+ var displayName: string;
214
+ }
215
+
216
+ export declare interface ColorPickerProps {
217
+ value?: string;
218
+ onChange?: (hex: string) => void;
219
+ label?: string;
220
+ disabled?: boolean;
221
+ presetGroups?: ColorPresetGroup[];
222
+ id?: string;
223
+ style?: CSSProperties;
224
+ }
225
+
226
+ export declare interface ColorPresetGroup {
227
+ label: string;
228
+ colors: string[];
229
+ }
230
+
231
+ export declare const ColorSwatch: ForwardRefExoticComponent<ColorSwatchProps & RefAttributes<HTMLButtonElement>>;
232
+
233
+ export declare interface ColorSwatchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
234
+ color: string;
235
+ size?: ColorSwatchSize;
236
+ shape?: ColorSwatchShape;
237
+ /** Show a checkerboard underneath — use when color may have transparency */
238
+ showCheckerboard?: boolean;
239
+ selected?: boolean;
240
+ }
241
+
242
+ export declare type ColorSwatchShape = 'circle' | 'square';
243
+
244
+ export declare type ColorSwatchSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
245
+
206
246
  export declare const COMMAND_PALETTE_MANIFEST: ComponentManifest;
207
247
 
208
248
  export declare interface CommandItem {
@@ -283,8 +323,9 @@ export declare interface ComponentManifest {
283
323
  * - block: Page-section-level composition (PageHeader, SidebarNav…)
284
324
  * - flow: Multi-step or stateful sequences (Wizard, Onboarding…)
285
325
  * - overlay: Layers above page content (Modal, Drawer, Tooltip…)
326
+ * - provider: Root configuration wrapper (LucentProvider…)
286
327
  */
287
- export declare type ComponentTier = 'atom' | 'molecule' | 'block' | 'flow' | 'overlay';
328
+ export declare type ComponentTier = 'atom' | 'molecule' | 'block' | 'flow' | 'overlay' | 'provider';
288
329
 
289
330
  export declare interface CompositionNode {
290
331
  /** Component id this node refers to */
@@ -297,6 +338,35 @@ export declare interface CompositionNode {
297
338
  required: boolean;
298
339
  }
299
340
 
341
+ /**
342
+ * Build a complete `LucentTokens` object from a minimal set of anchor colors.
343
+ *
344
+ * Variant tokens (hover, active, subtle, text, border, etc.) are derived
345
+ * automatically — you only need to specify the 9 anchor colors. The result
346
+ * can be passed directly to `<LucentProvider tokens={...}>`, or use the
347
+ * `anchors` prop shorthand to skip this call entirely.
348
+ *
349
+ * @param anchors - The 9 brand/semantic anchor colors.
350
+ * @param theme - Target theme; defaults to `'light'`.
351
+ * @returns A fully-resolved `LucentTokens` ready for `LucentProvider`.
352
+ *
353
+ * @example
354
+ * const tokens = createTheme({
355
+ * bgBase: '#ffffff',
356
+ * surface: '#f9fafb',
357
+ * borderDefault: '#e5e7eb',
358
+ * textPrimary: '#111827',
359
+ * accentDefault: '#6366f1',
360
+ * successDefault: '#22c55e',
361
+ * warningDefault: '#f59e0b',
362
+ * dangerDefault: '#ef4444',
363
+ * infoDefault: '#3b82f6',
364
+ * });
365
+ *
366
+ * // <LucentProvider tokens={tokens}>...</LucentProvider>
367
+ */
368
+ export declare function createTheme(anchors: ThemeAnchors, theme?: Theme): LucentTokens;
369
+
300
370
  export declare const darkTokens: LucentTokens;
301
371
 
302
372
  export declare const DATA_TABLE_MANIFEST: ComponentManifest;
@@ -368,6 +438,43 @@ export declare interface DateRangePickerProps {
368
438
  style?: CSSProperties;
369
439
  }
370
440
 
441
+ /**
442
+ * Derives a complete dark-mode token set from a light-mode token set.
443
+ *
444
+ * Non-color tokens (typography, spacing, radius, motion) are inherited
445
+ * unchanged. Each semantic color group is mapped with a calibrated
446
+ * lightness inversion so the result is visually consistent with a
447
+ * hand-crafted dark theme.
448
+ *
449
+ * @example
450
+ * // Replacing the hardcoded dark.ts:
451
+ * export const darkTokens = deriveDarkFromLight(lightTokens);
452
+ *
453
+ * // Generating a dark theme from any custom light palette:
454
+ * const myDark = deriveDarkFromLight({ ...lightTokens, bgBase: '#f0f4ff' });
455
+ */
456
+ export declare function deriveDarkFromLight(light: LucentTokens): LucentTokens;
457
+
458
+ /**
459
+ * Derive variant tokens from anchor overrides.
460
+ *
461
+ * When the user provides an anchor token (e.g. `borderDefault`) without
462
+ * providing its variants (e.g. `borderSubtle`, `borderStrong`), this
463
+ * function computes those variants automatically using theme-calibrated
464
+ * lightness deltas.
465
+ *
466
+ * Rules:
467
+ * - Derivation only runs when the anchor is present in `overrides`.
468
+ * - A variant is only filled when it is absent from `overrides`.
469
+ * - Uses `'key' in overrides` (not truthiness) to respect
470
+ * `exactOptionalPropertyTypes: true`.
471
+ *
472
+ * @param overrides - Raw `tokens` prop from the consumer.
473
+ * @param merged - Base theme tokens already merged with overrides.
474
+ * @param theme - Current theme; determines lightness delta direction.
475
+ */
476
+ export declare function deriveTokens(overrides: Partial<LucentTokens>, merged: LucentTokens, theme: Theme): Partial<LucentTokens>;
477
+
371
478
  export declare function Divider({ orientation, label, spacing, style }: DividerProps): JSX_2.Element;
372
479
 
373
480
  export declare const DividerManifest: ComponentManifest;
@@ -458,15 +565,24 @@ export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes
458
565
 
459
566
  export declare const InputManifest: ComponentManifest;
460
567
 
461
- export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
568
+ export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
462
569
  type?: InputType;
570
+ size?: InputSize;
463
571
  label?: string;
464
572
  helperText?: string;
465
573
  errorText?: string;
574
+ /** Icon/element floated inside the left edge — does not resize the field */
466
575
  leftElement?: ReactNode;
576
+ /** Icon/element floated inside the right edge — does not resize the field */
467
577
  rightElement?: ReactNode;
578
+ /** Inset label attached to the left of the field (e.g. "$", "https://") */
579
+ prefix?: ReactNode;
580
+ /** Inset label attached to the right of the field (e.g. "kg", ".com") */
581
+ suffix?: ReactNode;
468
582
  }
469
583
 
584
+ declare type InputSize = 'sm' | 'md' | 'lg';
585
+
470
586
  export declare type InputType = 'text' | 'number' | 'password' | 'email' | 'tel' | 'url' | 'search' | 'color';
471
587
 
472
588
  export declare function isValidPropDescriptor(prop: unknown): prop is PropDescriptor;
@@ -486,15 +602,34 @@ declare interface LucentContextValue {
486
602
  * styles are applied synchronously before first paint.
487
603
  *
488
604
  * @example
489
- * <LucentProvider theme="dark">
605
+ * // Minimal: 9 anchor colors → full theme
606
+ * <LucentProvider anchors={{ bgBase: '#fff', accentDefault: '#6366f1', ... }}>
607
+ * <App />
608
+ * </LucentProvider>
609
+ *
610
+ * @example
611
+ * // Full control via partial overrides
612
+ * <LucentProvider theme="dark" tokens={{ accentDefault: '#f59e0b' }}>
490
613
  * <App />
491
614
  * </LucentProvider>
492
615
  */
493
- export declare function LucentProvider({ theme, tokens: tokenOverrides, children, }: LucentProviderProps): JSX_2.Element;
616
+ export declare function LucentProvider({ theme, tokens: tokenOverrides, anchors, children, }: LucentProviderProps): JSX_2.Element;
617
+
618
+ export declare const LucentProviderManifest: ComponentManifest;
494
619
 
495
620
  export declare interface LucentProviderProps {
496
621
  theme?: Theme;
622
+ /**
623
+ * Full or partial token overrides. Individual tokens can be set here and
624
+ * any missing variant tokens will be derived automatically.
625
+ */
497
626
  tokens?: Partial<LucentTokens>;
627
+ /**
628
+ * Shorthand for specifying only the 9 anchor colors and letting the library
629
+ * derive the full token set automatically. When provided, `tokens` is ignored.
630
+ * Equivalent to passing `tokens={createTheme(anchors, theme)}`.
631
+ */
632
+ anchors?: ThemeAnchors;
498
633
  children: ReactNode;
499
634
  }
500
635
 
@@ -665,6 +800,38 @@ export declare interface SearchResult {
665
800
  label: string;
666
801
  }
667
802
 
803
+ export declare const SEGMENTED_CONTROL_MANIFEST: ComponentManifest;
804
+
805
+ export declare function SegmentedControl({ options, value, defaultValue, onChange, size, disabled, fullWidth, id, style, }: SegmentedControlProps): JSX_2.Element;
806
+
807
+ export declare namespace SegmentedControl {
808
+ var displayName: string;
809
+ }
810
+
811
+ export declare interface SegmentedControlProps {
812
+ options: SegmentedOption[];
813
+ /** Controlled selected value */
814
+ value?: string;
815
+ /** Initial value for uncontrolled usage */
816
+ defaultValue?: string;
817
+ onChange?: (value: string) => void;
818
+ size?: SegmentedControlSize;
819
+ /** Disabled all options */
820
+ disabled?: boolean;
821
+ /** Stretch to fill available width */
822
+ fullWidth?: boolean;
823
+ id?: string;
824
+ style?: CSSProperties;
825
+ }
826
+
827
+ export declare type SegmentedControlSize = 'sm' | 'md' | 'lg';
828
+
829
+ export declare interface SegmentedOption {
830
+ value: string;
831
+ label: ReactNode;
832
+ disabled?: boolean;
833
+ }
834
+
668
835
  export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
669
836
 
670
837
  export declare const SelectManifest: ComponentManifest;
@@ -689,9 +856,9 @@ export declare type SelectSize = 'sm' | 'md' | 'lg';
689
856
  declare interface SemanticColorTokens {
690
857
  bgBase: string;
691
858
  bgSubtle: string;
692
- bgMuted: string;
693
859
  bgOverlay: string;
694
- surfaceDefault: string;
860
+ surface: string;
861
+ surfaceSecondary: string;
695
862
  surfaceRaised: string;
696
863
  surfaceOverlay: string;
697
864
  borderDefault: string;
@@ -903,6 +1070,44 @@ export declare type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
903
1070
 
904
1071
  export declare type Theme = 'light' | 'dark';
905
1072
 
1073
+ /**
1074
+ * The minimal set of color tokens needed to produce a complete theme.
1075
+ * Pass these to `createTheme()` or `<LucentProvider anchors={...}>` and
1076
+ * all variant tokens (hover, active, subtle, text, etc.) are derived
1077
+ * automatically.
1078
+ *
1079
+ * @example
1080
+ * const myTheme = createTheme({
1081
+ * bgBase: '#ffffff',
1082
+ * surface: '#f9fafb',
1083
+ * borderDefault: '#e5e7eb',
1084
+ * textPrimary: '#111827',
1085
+ * accentDefault: '#6366f1',
1086
+ * successDefault: '#22c55e',
1087
+ * warningDefault: '#f59e0b',
1088
+ * dangerDefault: '#ef4444',
1089
+ * infoDefault: '#3b82f6',
1090
+ * });
1091
+ */
1092
+ export declare type ThemeAnchors = Pick<LucentTokens, 'bgBase' | 'surface' | 'borderDefault' | 'textPrimary' | 'accentDefault' | 'successDefault' | 'warningDefault' | 'dangerDefault' | 'infoDefault'>;
1093
+
1094
+ /**
1095
+ * Semantic guidance for each ThemeAnchors key.
1096
+ *
1097
+ * An LLM reading this can translate a brand brief or hex palette directly
1098
+ * into a valid ThemeAnchors object without needing to know internal token
1099
+ * names or the derivation system. Each entry describes:
1100
+ * - what the token controls visually
1101
+ * - what range of colors is appropriate
1102
+ * - which variant tokens are automatically derived from it
1103
+ */
1104
+ export declare const ThemeAnchorsSpec: Record<keyof ThemeAnchors, {
1105
+ description: string;
1106
+ lightGuidance: string;
1107
+ darkGuidance: string;
1108
+ derives: string[];
1109
+ }>;
1110
+
906
1111
  export declare function Timeline({ items, style }: TimelineProps): JSX_2.Element;
907
1112
 
908
1113
  export declare const TIMELINE_MANIFEST: ComponentManifest;