@akin2unde/flowui-core 1.0.1 → 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 +47 -2
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +46 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
flowClass: () => flowClass,
|
|
36
36
|
formatLocalDateTime: () => formatLocalDateTime,
|
|
37
37
|
notificationDuration: () => notificationDuration,
|
|
38
|
+
numericInputError: () => numericInputError,
|
|
38
39
|
resolveColorValue: () => resolveColorValue,
|
|
39
40
|
resolveFlowStyle: () => resolveFlowStyle,
|
|
40
41
|
resolveTooltipLocation: () => resolveTooltipLocation,
|
|
@@ -330,6 +331,13 @@ var responsiveProperties = {
|
|
|
330
331
|
borderStyle: "border-style",
|
|
331
332
|
borderColor: "border-color",
|
|
332
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",
|
|
333
341
|
backgroundColor: "background-color",
|
|
334
342
|
opacity: "opacity",
|
|
335
343
|
shadow: "box-shadow",
|
|
@@ -343,10 +351,12 @@ var responsiveProperties = {
|
|
|
343
351
|
function responsiveCSS(theme) {
|
|
344
352
|
const output = [];
|
|
345
353
|
for (const [prop, css] of Object.entries(responsiveProperties)) {
|
|
346
|
-
output.push(
|
|
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
|
+
);
|
|
347
357
|
for (const [breakpoint, width] of Object.entries(theme.breakpoints)) {
|
|
348
358
|
output.push(
|
|
349
|
-
`@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})` : ""}}}`
|
|
350
360
|
);
|
|
351
361
|
}
|
|
352
362
|
}
|
|
@@ -452,6 +462,22 @@ var propertyMap = {
|
|
|
452
462
|
css: "borderRadius",
|
|
453
463
|
resolve: ((v, t) => v in t.radius ? `var(--fui-radius-${v})` : length(v))
|
|
454
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
|
+
},
|
|
455
481
|
backgroundColor: { css: "backgroundColor", resolve: color },
|
|
456
482
|
opacity: { css: "opacity", resolve: String },
|
|
457
483
|
shadow: {
|
|
@@ -513,6 +539,10 @@ function resolveFlowStyle(props, theme) {
|
|
|
513
539
|
style["--fui-field-focus-border"] = "var(--fui-color-borderStrong)";
|
|
514
540
|
style["--fui-field-focus-shadow"] = "none";
|
|
515
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);
|
|
516
546
|
Object.assign(style, userStyle);
|
|
517
547
|
return { classNames, style };
|
|
518
548
|
}
|
|
@@ -553,6 +583,20 @@ function sanitizeInputValue(value, mode = "text") {
|
|
|
553
583
|
function clampNumber(value, min, max) {
|
|
554
584
|
return Math.min(max, Math.max(min, value));
|
|
555
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
|
+
}
|
|
556
600
|
|
|
557
601
|
// src/table-export.ts
|
|
558
602
|
function cellText(row, column) {
|
|
@@ -1054,6 +1098,7 @@ function createNotificationTimer(duration, onElapsed) {
|
|
|
1054
1098
|
flowClass,
|
|
1055
1099
|
formatLocalDateTime,
|
|
1056
1100
|
notificationDuration,
|
|
1101
|
+
numericInputError,
|
|
1057
1102
|
resolveColorValue,
|
|
1058
1103
|
resolveFlowStyle,
|
|
1059
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. */
|
|
@@ -518,6 +533,8 @@ type FlowInputMode = NonNullable<InputProps["inputMode"]>;
|
|
|
518
533
|
/** Keeps only characters allowed by the selected FlowUI input mode. */
|
|
519
534
|
declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
|
|
520
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;
|
|
521
538
|
|
|
522
539
|
declare function tableToCsv<T>(data: readonly T[], columns: readonly TableColumn<T>[]): string;
|
|
523
540
|
declare function exportTableToCsv<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
|
|
@@ -635,4 +652,4 @@ interface NotificationAction {
|
|
|
635
652
|
onClick: () => void | Promise<void>;
|
|
636
653
|
}
|
|
637
654
|
|
|
638
|
-
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, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
|
|
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. */
|
|
@@ -518,6 +533,8 @@ type FlowInputMode = NonNullable<InputProps["inputMode"]>;
|
|
|
518
533
|
/** Keeps only characters allowed by the selected FlowUI input mode. */
|
|
519
534
|
declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
|
|
520
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;
|
|
521
538
|
|
|
522
539
|
declare function tableToCsv<T>(data: readonly T[], columns: readonly TableColumn<T>[]): string;
|
|
523
540
|
declare function exportTableToCsv<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
|
|
@@ -635,4 +652,4 @@ interface NotificationAction {
|
|
|
635
652
|
onClick: () => void | Promise<void>;
|
|
636
653
|
}
|
|
637
654
|
|
|
638
|
-
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, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
|
|
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(
|
|
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) {
|
|
@@ -1004,6 +1047,7 @@ export {
|
|
|
1004
1047
|
flowClass,
|
|
1005
1048
|
formatLocalDateTime,
|
|
1006
1049
|
notificationDuration,
|
|
1050
|
+
numericInputError,
|
|
1007
1051
|
resolveColorValue,
|
|
1008
1052
|
resolveFlowStyle,
|
|
1009
1053
|
resolveTooltipLocation,
|