@akin2unde/flowui-core 1.0.0 → 1.0.2

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.cjs CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  AsyncLabelStore: () => AsyncLabelStore,
24
24
  clampNumber: () => clampNumber,
25
25
  createAsyncLabelStore: () => createAsyncLabelStore,
26
+ createNotificationTimer: () => createNotificationTimer,
26
27
  createTheme: () => createTheme,
27
28
  defaultTheme: () => defaultTheme,
28
29
  enabledSelectableDescendants: () => enabledSelectableDescendants,
@@ -33,6 +34,8 @@ __export(index_exports, {
33
34
  flattenTree: () => flattenTree,
34
35
  flowClass: () => flowClass,
35
36
  formatLocalDateTime: () => formatLocalDateTime,
37
+ notificationDuration: () => notificationDuration,
38
+ numericInputError: () => numericInputError,
36
39
  resolveColorValue: () => resolveColorValue,
37
40
  resolveFlowStyle: () => resolveFlowStyle,
38
41
  resolveTooltipLocation: () => resolveTooltipLocation,
@@ -328,6 +331,13 @@ var responsiveProperties = {
328
331
  borderStyle: "border-style",
329
332
  borderColor: "border-color",
330
333
  cornerRadius: "border-radius",
334
+ iconColor: "--fui-control-icon",
335
+ placeholderColor: "--fui-control-placeholder",
336
+ panelBackgroundColor: "--fui-panel-background",
337
+ panelTextColor: "--fui-panel-text",
338
+ optionHoverBackgroundColor: "--fui-option-hover-background",
339
+ selectedOptionBackgroundColor: "--fui-option-selected-background",
340
+ selectedOptionTextColor: "--fui-option-selected-text",
331
341
  backgroundColor: "background-color",
332
342
  opacity: "opacity",
333
343
  shadow: "box-shadow",
@@ -341,10 +351,12 @@ var responsiveProperties = {
341
351
  function responsiveCSS(theme) {
342
352
  const output = [];
343
353
  for (const [prop, css] of Object.entries(responsiveProperties)) {
344
- output.push(`.fui-r-${prop}-default{${css}:var(--fui-${prop}-default)}`);
354
+ output.push(
355
+ `.fui-r-${prop}-default{${css}:var(--fui-${prop}-default)${prop === "backgroundColor" ? ";--fui-control-background:var(--fui-backgroundColor-default)" : prop === "textColor" ? ";--fui-control-text:var(--fui-textColor-default)" : ""}}`
356
+ );
345
357
  for (const [breakpoint, width] of Object.entries(theme.breakpoints)) {
346
358
  output.push(
347
- `@media(min-width:${width}){.fui-r-${prop}-${breakpoint}{${css}:var(--fui-${prop}-${breakpoint})}}`
359
+ `@media(min-width:${width}){.fui-r-${prop}-${breakpoint}{${css}:var(--fui-${prop}-${breakpoint})${prop === "backgroundColor" ? `;--fui-control-background:var(--fui-backgroundColor-${breakpoint})` : prop === "textColor" ? `;--fui-control-text:var(--fui-textColor-${breakpoint})` : ""}}}`
348
360
  );
349
361
  }
350
362
  }
@@ -450,6 +462,22 @@ var propertyMap = {
450
462
  css: "borderRadius",
451
463
  resolve: ((v, t) => v in t.radius ? `var(--fui-radius-${v})` : length(v))
452
464
  },
465
+ iconColor: { css: "--fui-control-icon", resolve: color },
466
+ placeholderColor: { css: "--fui-control-placeholder", resolve: color },
467
+ panelBackgroundColor: { css: "--fui-panel-background", resolve: color },
468
+ panelTextColor: { css: "--fui-panel-text", resolve: color },
469
+ optionHoverBackgroundColor: {
470
+ css: "--fui-option-hover-background",
471
+ resolve: color
472
+ },
473
+ selectedOptionBackgroundColor: {
474
+ css: "--fui-option-selected-background",
475
+ resolve: color
476
+ },
477
+ selectedOptionTextColor: {
478
+ css: "--fui-option-selected-text",
479
+ resolve: color
480
+ },
453
481
  backgroundColor: { css: "backgroundColor", resolve: color },
454
482
  opacity: { css: "opacity", resolve: String },
455
483
  shadow: {
@@ -511,6 +539,10 @@ function resolveFlowStyle(props, theme) {
511
539
  style["--fui-field-focus-border"] = "var(--fui-color-borderStrong)";
512
540
  style["--fui-field-focus-shadow"] = "none";
513
541
  }
542
+ if (style.backgroundColor !== void 0)
543
+ style["--fui-control-background"] = String(style.backgroundColor);
544
+ if (style.color !== void 0)
545
+ style["--fui-control-text"] = String(style.color);
514
546
  Object.assign(style, userStyle);
515
547
  return { classNames, style };
516
548
  }
@@ -551,6 +583,20 @@ function sanitizeInputValue(value, mode = "text") {
551
583
  function clampNumber(value, min, max) {
552
584
  return Math.min(max, Math.max(min, value));
553
585
  }
586
+ function numericInputError(value, min, max, step) {
587
+ if (String(value).trim() === "") return;
588
+ const number = Number(value);
589
+ if (!Number.isFinite(number)) return "Enter a valid number.";
590
+ if (min !== void 0 && number < Number(min))
591
+ return `Enter a value of at least ${min}.`;
592
+ if (max !== void 0 && number > Number(max))
593
+ return `Enter a value no greater than ${max}.`;
594
+ if (step !== void 0 && step !== "any" && Number(step) > 0) {
595
+ const count = (number - Number(min ?? 0)) / Number(step);
596
+ if (Math.abs(count - Math.round(count)) > 1e-8)
597
+ return `Use increments of ${step}.`;
598
+ }
599
+ }
554
600
 
555
601
  // src/table-export.ts
556
602
  function cellText(row, column) {
@@ -993,11 +1039,54 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
993
1039
  const required = preferred === "top" || preferred === "bottom" ? tooltip.height + gap : tooltip.width + gap;
994
1040
  return available[preferred] < required && available[opposite[preferred]] > available[preferred] ? opposite[preferred] : preferred;
995
1041
  }
1042
+
1043
+ // src/notification.ts
1044
+ var defaultDurations = {
1045
+ success: 4e3,
1046
+ info: 5e3,
1047
+ warning: 7e3,
1048
+ error: 8e3
1049
+ };
1050
+ function notificationDuration(type, duration, defaultDuration) {
1051
+ if (type === "decision") return 0;
1052
+ if (!(typeof duration === "number" && Number.isFinite(duration) && duration > 0))
1053
+ duration = defaultDuration;
1054
+ return typeof duration === "number" && Number.isFinite(duration) && duration > 0 ? Math.min(duration, 2147483647) : defaultDurations[type];
1055
+ }
1056
+ function createNotificationTimer(duration, onElapsed) {
1057
+ let remaining = duration;
1058
+ let started = 0;
1059
+ let timer;
1060
+ let done = false;
1061
+ return {
1062
+ resume() {
1063
+ if (done || timer !== void 0 || duration === 0) return;
1064
+ started = Date.now();
1065
+ timer = setTimeout(() => {
1066
+ timer = void 0;
1067
+ done = true;
1068
+ onElapsed();
1069
+ }, remaining);
1070
+ },
1071
+ pause() {
1072
+ if (timer === void 0) return;
1073
+ clearTimeout(timer);
1074
+ timer = void 0;
1075
+ remaining = Math.max(0, remaining - (Date.now() - started));
1076
+ },
1077
+ dispose() {
1078
+ done = true;
1079
+ clearTimeout(timer);
1080
+ timer = void 0;
1081
+ }
1082
+ };
1083
+ }
996
1084
  // Annotate the CommonJS export names for ESM import in node:
997
1085
  0 && (module.exports = {
998
1086
  AsyncLabelStore,
999
1087
  clampNumber,
1000
1088
  createAsyncLabelStore,
1089
+ createNotificationTimer,
1001
1090
  createTheme,
1002
1091
  defaultTheme,
1003
1092
  enabledSelectableDescendants,
@@ -1008,6 +1097,8 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
1008
1097
  flattenTree,
1009
1098
  flowClass,
1010
1099
  formatLocalDateTime,
1100
+ notificationDuration,
1101
+ numericInputError,
1011
1102
  resolveColorValue,
1012
1103
  resolveFlowStyle,
1013
1104
  resolveTooltipLocation,
package/dist/index.d.cts CHANGED
@@ -96,6 +96,14 @@ interface BorderProps {
96
96
  cornerRadius?: ResponsiveValue<RadiusValue>;
97
97
  }
98
98
  interface VisualProps {
99
+ textColor?: ResponsiveValue<ColorValue>;
100
+ iconColor?: ResponsiveValue<ColorValue>;
101
+ placeholderColor?: ResponsiveValue<ColorValue>;
102
+ panelBackgroundColor?: ResponsiveValue<ColorValue>;
103
+ panelTextColor?: ResponsiveValue<ColorValue>;
104
+ optionHoverBackgroundColor?: ResponsiveValue<ColorValue>;
105
+ selectedOptionBackgroundColor?: ResponsiveValue<ColorValue>;
106
+ selectedOptionTextColor?: ResponsiveValue<ColorValue>;
99
107
  backgroundColor?: ResponsiveValue<ColorValue>;
100
108
  opacity?: ResponsiveValue<number>;
101
109
  shadow?: ResponsiveValue<"none" | "xs" | "sm" | "md" | "lg" | "xl">;
@@ -213,6 +221,8 @@ interface ButtonProps extends BaseUIProps, TypographyProps, DisableableProps, Lo
213
221
  iconPosition?: "left" | "right" | "center";
214
222
  badge?: string | number;
215
223
  ariaLabel?: string;
224
+ /** Label for a self-closing button. Children/content take precedence. */
225
+ text?: string;
216
226
  }
217
227
  interface ButtonGroupProps extends BaseUIProps {
218
228
  orientation?: Orientation;
@@ -223,6 +233,11 @@ interface ButtonGroupProps extends BaseUIProps {
223
233
  }
224
234
  interface InputProps extends BaseUIProps, TypographyProps, DisableableProps, ReadOnlyProps, RequiredProps, FocusableProps {
225
235
  name?: string;
236
+ min?: string | number;
237
+ max?: string | number;
238
+ step?: string | number;
239
+ minLength?: number;
240
+ maxLength?: number;
226
241
  value?: string | number;
227
242
  placeholder?: string;
228
243
  /** Controls which characters FlowUI accepts without changing the visual input type. */
@@ -442,7 +457,7 @@ interface BreadcrumbProps extends BaseUIProps {
442
457
  items: BreadcrumbItem[];
443
458
  separatorIcon?: string;
444
459
  }
445
- type NotificationType = "success" | "error" | "warning" | "info";
460
+ type NotificationType = "success" | "error" | "warning" | "info" | "decision";
446
461
  type NotificationHorizontal = "left" | "center" | "right";
447
462
  type NotificationVertical = "top" | "bottom";
448
463
  interface NotificationProps extends BaseUIProps {
@@ -451,6 +466,7 @@ interface NotificationProps extends BaseUIProps {
451
466
  horizontal?: NotificationHorizontal;
452
467
  vertical?: NotificationVertical;
453
468
  duration?: number;
469
+ defaultDuration?: number;
454
470
  dismissible?: boolean;
455
471
  }
456
472
  interface KnobProps extends BaseUIProps, DisableableProps {
@@ -517,6 +533,8 @@ type FlowInputMode = NonNullable<InputProps["inputMode"]>;
517
533
  /** Keeps only characters allowed by the selected FlowUI input mode. */
518
534
  declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
519
535
  declare function clampNumber(value: number, min: number, max: number): number;
536
+ /** Validate numeric bounds without silently clamping user-entered text. */
537
+ declare function numericInputError(value: string | number, min?: string | number, max?: string | number, step?: string | number): string | undefined;
520
538
 
521
539
  declare function tableToCsv<T>(data: readonly T[], columns: readonly TableColumn<T>[]): string;
522
540
  declare function exportTableToCsv<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
@@ -623,4 +641,15 @@ declare function resolveTooltipLocation(preferred: TooltipLocation, anchor: {
623
641
  height: number;
624
642
  }, gap?: number): TooltipLocation;
625
643
 
626
- export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
644
+ declare function notificationDuration(type: NotificationType, duration?: number, defaultDuration?: number): number;
645
+ declare function createNotificationTimer(duration: number, onElapsed: () => void): {
646
+ resume(): void;
647
+ pause(): void;
648
+ dispose(): void;
649
+ };
650
+ interface NotificationAction {
651
+ label: string;
652
+ onClick: () => void | Promise<void>;
653
+ }
654
+
655
+ export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationAction, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createNotificationTimer, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, notificationDuration, numericInputError, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
package/dist/index.d.ts CHANGED
@@ -96,6 +96,14 @@ interface BorderProps {
96
96
  cornerRadius?: ResponsiveValue<RadiusValue>;
97
97
  }
98
98
  interface VisualProps {
99
+ textColor?: ResponsiveValue<ColorValue>;
100
+ iconColor?: ResponsiveValue<ColorValue>;
101
+ placeholderColor?: ResponsiveValue<ColorValue>;
102
+ panelBackgroundColor?: ResponsiveValue<ColorValue>;
103
+ panelTextColor?: ResponsiveValue<ColorValue>;
104
+ optionHoverBackgroundColor?: ResponsiveValue<ColorValue>;
105
+ selectedOptionBackgroundColor?: ResponsiveValue<ColorValue>;
106
+ selectedOptionTextColor?: ResponsiveValue<ColorValue>;
99
107
  backgroundColor?: ResponsiveValue<ColorValue>;
100
108
  opacity?: ResponsiveValue<number>;
101
109
  shadow?: ResponsiveValue<"none" | "xs" | "sm" | "md" | "lg" | "xl">;
@@ -213,6 +221,8 @@ interface ButtonProps extends BaseUIProps, TypographyProps, DisableableProps, Lo
213
221
  iconPosition?: "left" | "right" | "center";
214
222
  badge?: string | number;
215
223
  ariaLabel?: string;
224
+ /** Label for a self-closing button. Children/content take precedence. */
225
+ text?: string;
216
226
  }
217
227
  interface ButtonGroupProps extends BaseUIProps {
218
228
  orientation?: Orientation;
@@ -223,6 +233,11 @@ interface ButtonGroupProps extends BaseUIProps {
223
233
  }
224
234
  interface InputProps extends BaseUIProps, TypographyProps, DisableableProps, ReadOnlyProps, RequiredProps, FocusableProps {
225
235
  name?: string;
236
+ min?: string | number;
237
+ max?: string | number;
238
+ step?: string | number;
239
+ minLength?: number;
240
+ maxLength?: number;
226
241
  value?: string | number;
227
242
  placeholder?: string;
228
243
  /** Controls which characters FlowUI accepts without changing the visual input type. */
@@ -442,7 +457,7 @@ interface BreadcrumbProps extends BaseUIProps {
442
457
  items: BreadcrumbItem[];
443
458
  separatorIcon?: string;
444
459
  }
445
- type NotificationType = "success" | "error" | "warning" | "info";
460
+ type NotificationType = "success" | "error" | "warning" | "info" | "decision";
446
461
  type NotificationHorizontal = "left" | "center" | "right";
447
462
  type NotificationVertical = "top" | "bottom";
448
463
  interface NotificationProps extends BaseUIProps {
@@ -451,6 +466,7 @@ interface NotificationProps extends BaseUIProps {
451
466
  horizontal?: NotificationHorizontal;
452
467
  vertical?: NotificationVertical;
453
468
  duration?: number;
469
+ defaultDuration?: number;
454
470
  dismissible?: boolean;
455
471
  }
456
472
  interface KnobProps extends BaseUIProps, DisableableProps {
@@ -517,6 +533,8 @@ type FlowInputMode = NonNullable<InputProps["inputMode"]>;
517
533
  /** Keeps only characters allowed by the selected FlowUI input mode. */
518
534
  declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
519
535
  declare function clampNumber(value: number, min: number, max: number): number;
536
+ /** Validate numeric bounds without silently clamping user-entered text. */
537
+ declare function numericInputError(value: string | number, min?: string | number, max?: string | number, step?: string | number): string | undefined;
520
538
 
521
539
  declare function tableToCsv<T>(data: readonly T[], columns: readonly TableColumn<T>[]): string;
522
540
  declare function exportTableToCsv<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
@@ -623,4 +641,15 @@ declare function resolveTooltipLocation(preferred: TooltipLocation, anchor: {
623
641
  height: number;
624
642
  }, gap?: number): TooltipLocation;
625
643
 
626
- export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
644
+ declare function notificationDuration(type: NotificationType, duration?: number, defaultDuration?: number): number;
645
+ declare function createNotificationTimer(duration: number, onElapsed: () => void): {
646
+ resume(): void;
647
+ pause(): void;
648
+ dispose(): void;
649
+ };
650
+ interface NotificationAction {
651
+ label: string;
652
+ onClick: () => void | Promise<void>;
653
+ }
654
+
655
+ export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationAction, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createNotificationTimer, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, notificationDuration, numericInputError, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
package/dist/index.js CHANGED
@@ -281,6 +281,13 @@ var responsiveProperties = {
281
281
  borderStyle: "border-style",
282
282
  borderColor: "border-color",
283
283
  cornerRadius: "border-radius",
284
+ iconColor: "--fui-control-icon",
285
+ placeholderColor: "--fui-control-placeholder",
286
+ panelBackgroundColor: "--fui-panel-background",
287
+ panelTextColor: "--fui-panel-text",
288
+ optionHoverBackgroundColor: "--fui-option-hover-background",
289
+ selectedOptionBackgroundColor: "--fui-option-selected-background",
290
+ selectedOptionTextColor: "--fui-option-selected-text",
284
291
  backgroundColor: "background-color",
285
292
  opacity: "opacity",
286
293
  shadow: "box-shadow",
@@ -294,10 +301,12 @@ var responsiveProperties = {
294
301
  function responsiveCSS(theme) {
295
302
  const output = [];
296
303
  for (const [prop, css] of Object.entries(responsiveProperties)) {
297
- output.push(`.fui-r-${prop}-default{${css}:var(--fui-${prop}-default)}`);
304
+ output.push(
305
+ `.fui-r-${prop}-default{${css}:var(--fui-${prop}-default)${prop === "backgroundColor" ? ";--fui-control-background:var(--fui-backgroundColor-default)" : prop === "textColor" ? ";--fui-control-text:var(--fui-textColor-default)" : ""}}`
306
+ );
298
307
  for (const [breakpoint, width] of Object.entries(theme.breakpoints)) {
299
308
  output.push(
300
- `@media(min-width:${width}){.fui-r-${prop}-${breakpoint}{${css}:var(--fui-${prop}-${breakpoint})}}`
309
+ `@media(min-width:${width}){.fui-r-${prop}-${breakpoint}{${css}:var(--fui-${prop}-${breakpoint})${prop === "backgroundColor" ? `;--fui-control-background:var(--fui-backgroundColor-${breakpoint})` : prop === "textColor" ? `;--fui-control-text:var(--fui-textColor-${breakpoint})` : ""}}}`
301
310
  );
302
311
  }
303
312
  }
@@ -403,6 +412,22 @@ var propertyMap = {
403
412
  css: "borderRadius",
404
413
  resolve: ((v, t) => v in t.radius ? `var(--fui-radius-${v})` : length(v))
405
414
  },
415
+ iconColor: { css: "--fui-control-icon", resolve: color },
416
+ placeholderColor: { css: "--fui-control-placeholder", resolve: color },
417
+ panelBackgroundColor: { css: "--fui-panel-background", resolve: color },
418
+ panelTextColor: { css: "--fui-panel-text", resolve: color },
419
+ optionHoverBackgroundColor: {
420
+ css: "--fui-option-hover-background",
421
+ resolve: color
422
+ },
423
+ selectedOptionBackgroundColor: {
424
+ css: "--fui-option-selected-background",
425
+ resolve: color
426
+ },
427
+ selectedOptionTextColor: {
428
+ css: "--fui-option-selected-text",
429
+ resolve: color
430
+ },
406
431
  backgroundColor: { css: "backgroundColor", resolve: color },
407
432
  opacity: { css: "opacity", resolve: String },
408
433
  shadow: {
@@ -464,6 +489,10 @@ function resolveFlowStyle(props, theme) {
464
489
  style["--fui-field-focus-border"] = "var(--fui-color-borderStrong)";
465
490
  style["--fui-field-focus-shadow"] = "none";
466
491
  }
492
+ if (style.backgroundColor !== void 0)
493
+ style["--fui-control-background"] = String(style.backgroundColor);
494
+ if (style.color !== void 0)
495
+ style["--fui-control-text"] = String(style.color);
467
496
  Object.assign(style, userStyle);
468
497
  return { classNames, style };
469
498
  }
@@ -504,6 +533,20 @@ function sanitizeInputValue(value, mode = "text") {
504
533
  function clampNumber(value, min, max) {
505
534
  return Math.min(max, Math.max(min, value));
506
535
  }
536
+ function numericInputError(value, min, max, step) {
537
+ if (String(value).trim() === "") return;
538
+ const number = Number(value);
539
+ if (!Number.isFinite(number)) return "Enter a valid number.";
540
+ if (min !== void 0 && number < Number(min))
541
+ return `Enter a value of at least ${min}.`;
542
+ if (max !== void 0 && number > Number(max))
543
+ return `Enter a value no greater than ${max}.`;
544
+ if (step !== void 0 && step !== "any" && Number(step) > 0) {
545
+ const count = (number - Number(min ?? 0)) / Number(step);
546
+ if (Math.abs(count - Math.round(count)) > 1e-8)
547
+ return `Use increments of ${step}.`;
548
+ }
549
+ }
507
550
 
508
551
  // src/table-export.ts
509
552
  function cellText(row, column) {
@@ -946,10 +989,53 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
946
989
  const required = preferred === "top" || preferred === "bottom" ? tooltip.height + gap : tooltip.width + gap;
947
990
  return available[preferred] < required && available[opposite[preferred]] > available[preferred] ? opposite[preferred] : preferred;
948
991
  }
992
+
993
+ // src/notification.ts
994
+ var defaultDurations = {
995
+ success: 4e3,
996
+ info: 5e3,
997
+ warning: 7e3,
998
+ error: 8e3
999
+ };
1000
+ function notificationDuration(type, duration, defaultDuration) {
1001
+ if (type === "decision") return 0;
1002
+ if (!(typeof duration === "number" && Number.isFinite(duration) && duration > 0))
1003
+ duration = defaultDuration;
1004
+ return typeof duration === "number" && Number.isFinite(duration) && duration > 0 ? Math.min(duration, 2147483647) : defaultDurations[type];
1005
+ }
1006
+ function createNotificationTimer(duration, onElapsed) {
1007
+ let remaining = duration;
1008
+ let started = 0;
1009
+ let timer;
1010
+ let done = false;
1011
+ return {
1012
+ resume() {
1013
+ if (done || timer !== void 0 || duration === 0) return;
1014
+ started = Date.now();
1015
+ timer = setTimeout(() => {
1016
+ timer = void 0;
1017
+ done = true;
1018
+ onElapsed();
1019
+ }, remaining);
1020
+ },
1021
+ pause() {
1022
+ if (timer === void 0) return;
1023
+ clearTimeout(timer);
1024
+ timer = void 0;
1025
+ remaining = Math.max(0, remaining - (Date.now() - started));
1026
+ },
1027
+ dispose() {
1028
+ done = true;
1029
+ clearTimeout(timer);
1030
+ timer = void 0;
1031
+ }
1032
+ };
1033
+ }
949
1034
  export {
950
1035
  AsyncLabelStore,
951
1036
  clampNumber,
952
1037
  createAsyncLabelStore,
1038
+ createNotificationTimer,
953
1039
  createTheme,
954
1040
  defaultTheme,
955
1041
  enabledSelectableDescendants,
@@ -960,6 +1046,8 @@ export {
960
1046
  flattenTree,
961
1047
  flowClass,
962
1048
  formatLocalDateTime,
1049
+ notificationDuration,
1050
+ numericInputError,
963
1051
  resolveColorValue,
964
1052
  resolveFlowStyle,
965
1053
  resolveTooltipLocation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akin2unde/flowui-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Framework-independent contracts, themes and style resolution for FlowUI.",
5
5
  "author": "Akintunde Morakinyo",
6
6
  "repository": {