@locus-ui/components 0.0.12 → 0.0.13

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
@@ -21,6 +21,11 @@ type StringPropDef = {
21
21
  className?: string;
22
22
  cssProperty?: string;
23
23
  };
24
+ type NumberPropDef = {
25
+ type: "number";
26
+ default?: number;
27
+ required?: boolean;
28
+ };
24
29
  type ReactNodePropDef<T = React.ReactNode> = {
25
30
  type: "reactNode";
26
31
  required?: boolean;
@@ -40,6 +45,7 @@ type EnumOrStringPropDef<T extends string> = {
40
45
  required?: boolean;
41
46
  className?: string;
42
47
  dataAttr?: string;
48
+ transform?: (value: string) => string;
43
49
  };
44
50
  type ValueOrArrayPropDef<T> = {
45
51
  type: "value | array";
@@ -51,11 +57,11 @@ type FunctionPropDef<T extends (...args: any[]) => any = (...args: any[]) => any
51
57
  type: "function";
52
58
  required?: boolean;
53
59
  };
54
- type BasePropDef<T = any> = BooleanPropDef | StringPropDef | ReactNodePropDef<T> | EnumPropDef<T> | EnumOrStringPropDef<T & string> | ValueOrArrayPropDef<T> | FunctionPropDef<T & ((...args: any[]) => any)>;
60
+ type BasePropDef<T = any> = BooleanPropDef | StringPropDef | NumberPropDef | ReactNodePropDef<T> | EnumPropDef<T> | EnumOrStringPropDef<T & string> | ValueOrArrayPropDef<T> | FunctionPropDef<T & ((...args: any[]) => any)>;
55
61
  type ResponsivePropDef<T = any> = BasePropDef<T> & {
56
62
  responsive: true;
57
63
  };
58
- type GetPropDefType<Def> = Def extends BooleanPropDef ? Def extends ResponsivePropDef ? Responsive<boolean> : boolean : Def extends StringPropDef ? Def extends ResponsivePropDef ? Responsive<string> : string : Def extends ReactNodePropDef<infer Type> ? Type : Def extends FunctionPropDef<infer Fn> ? Fn : Def extends EnumOrStringPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Union<string, Type> : Def extends ValueOrArrayPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type | Type[]> : Type | Type[] : Def extends EnumPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type : never;
64
+ type GetPropDefType<Def> = Def extends BooleanPropDef ? Def extends ResponsivePropDef ? Responsive<boolean> : boolean : Def extends StringPropDef ? Def extends ResponsivePropDef ? Responsive<string> : string : Def extends NumberPropDef ? Def extends ResponsivePropDef ? Responsive<number> : number : Def extends ReactNodePropDef<infer Type> ? Type : Def extends FunctionPropDef<infer Fn> ? Fn : Def extends EnumOrStringPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Union<string, Type> : Def extends ValueOrArrayPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type | Type[]> : Type | Type[] : Def extends EnumPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type : never;
59
65
  type GetPropDefTypes<P> = {
60
66
  [K in keyof P]?: GetPropDefType<P[K]>;
61
67
  };
@@ -72,17 +78,36 @@ declare const AlignPropDef: {
72
78
  };
73
79
  type AlignProp = GetPropDefTypes<typeof AlignPropDef>;
74
80
 
81
+ /**
82
+ * Parses a color string (hex, rgb, or raw r,g,b) into a raw "r, g, b" string
83
+ * suitable for use with CSS rgba().
84
+ *
85
+ * Supported formats:
86
+ * - Hex: "#7BEB34", "#7beb34", "#abc"
87
+ * - RGB function: "rgb(125, 235, 52)"
88
+ * - Raw: "125, 235, 52"
89
+ *
90
+ * Returns the original string unchanged if parsing fails.
91
+ */
92
+ declare function parseColor(value: string): string;
93
+
75
94
  declare const ColorPropDef: {
76
95
  /**
77
96
  * Sets the color of the component.
78
97
  *
98
+ * Uses predefined theme colors ("primary", "secondary", etc.) or accepts custom color values in hex, rgb, or raw rgb formats.
99
+ *
79
100
  * @example color="primary" // primary color
101
+ * @example color="#7BEB34" // hex color
102
+ * @example color="rgb(125, 235, 52)" // rgb color
103
+ * @example color="125, 235, 52" // raw rgb values
80
104
  */
81
105
  color: {
82
106
  type: "enum | string";
83
107
  values: readonly ["primary", "secondary", "tertiary", "accent", "success", "warning", "danger", "info"];
84
108
  dataAttr: string;
85
109
  className: string;
110
+ transform: typeof parseColor;
86
111
  };
87
112
  };
88
113
  type ColorProp = GetPropDefTypes<typeof ColorPropDef>;
@@ -650,6 +675,13 @@ type StrictChildren<AllowedChildProps> = {
650
675
  type WithStrictChildren<Props extends {
651
676
  children?: React$1.ReactNode;
652
677
  }, AllowedChildProps> = Omit<Props, "children"> & StrictChildren<AllowedChildProps>;
678
+ /**
679
+ * Like WithStrictChildren, but children are optional.
680
+ * When provided, children are still restricted to the allowed types.
681
+ */
682
+ type WithOptionalStrictChildren<Props extends {
683
+ children?: React$1.ReactNode;
684
+ }, AllowedChildProps> = Omit<Props, "children"> & Partial<StrictChildren<AllowedChildProps>>;
653
685
 
654
686
  declare const AccordionRootPropsDefs: {
655
687
  /**
@@ -900,6 +932,24 @@ declare const Container: React$1.ForwardRefExoticComponent<{} & {
900
932
  direction?: "row" | "column" | undefined;
901
933
  } & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
902
934
 
935
+ interface PanelExternalProps extends MarginProps, PaddingProps, SpacingProp, RadiusProps, RoundnessProp {
936
+ }
937
+ /**
938
+ * A versatile container used to provide layout and styling capabilities.
939
+ */
940
+ declare const Panel: React$1.ForwardRefExoticComponent<GetPropDefTypes<{
941
+ readonly variant: {
942
+ type: "enum";
943
+ values: readonly ["solid", "outlined", "muted"];
944
+ dataAttr: string;
945
+ };
946
+ readonly blur: {
947
+ type: "string";
948
+ default: string;
949
+ cssProperty: string;
950
+ };
951
+ }> & PanelExternalProps & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
952
+
903
953
  declare const variants: readonly ["clear", "shadow", "blurred"];
904
954
  type PortalBackdropInternalProps = {
905
955
  /**
@@ -1014,6 +1064,61 @@ declare const Portal: {
1014
1064
  Backdrop: React$1.ForwardRefExoticComponent<AllPortalBackdropProps & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
1015
1065
  };
1016
1066
 
1067
+ declare const ProgressBarFillPropsDefs: {
1068
+ /**
1069
+ * The value of the progress bar (filled state).
1070
+ * Should be a number between 0 and 1 representing the percentage of completion.
1071
+ */
1072
+ readonly value: {
1073
+ type: "number";
1074
+ };
1075
+ };
1076
+ type ProgressBarFillInternalProps = GetPropDefTypes<typeof ProgressBarFillPropsDefs>;
1077
+
1078
+ interface AllProgressBarFillProps extends ProgressBarFillInternalProps, ColorProp, MarginProps, SizeProp {
1079
+ }
1080
+ /**
1081
+ * A ProgressBarFill.
1082
+ */
1083
+ type ProgressBarFillProps = AllProgressBarFillProps & HTMLAttributes<HTMLDivElement>;
1084
+
1085
+ declare const ProgressBarRootPropsDefs: {
1086
+ /**
1087
+ * Sets the variant style of the progress bar ("solid", "outlined", or "muted").
1088
+ */
1089
+ readonly variant: {
1090
+ type: "enum";
1091
+ values: readonly ["solid", "outlined", "muted"];
1092
+ dataAttr: string;
1093
+ };
1094
+ /**
1095
+ * The value of the progress bar (filled state).
1096
+ * Should be a number between 0 and 1 representing the percentage of completion.
1097
+ */
1098
+ readonly value: {
1099
+ type: "number";
1100
+ };
1101
+ };
1102
+ type ProgressBarRootInternalProps = GetPropDefTypes<typeof ProgressBarRootPropsDefs>;
1103
+
1104
+ interface AllProgressBarRootProps extends ProgressBarRootInternalProps, ColorProp, MarginProps, SizeProp {
1105
+ }
1106
+ type ProgressBarRootProps = AllProgressBarRootProps & WithOptionalStrictChildren<HTMLAttributes<HTMLDivElement>, ProgressBarFillProps>;
1107
+
1108
+ /**
1109
+ * A Progress Bar component to display single or stacked progress bars.
1110
+ */
1111
+ declare const ProgressBar: React$1.FC<ProgressBarRootProps> & {
1112
+ /**
1113
+ * The root component for the Progress Bar.
1114
+ */
1115
+ Root: React$1.FC<ProgressBarRootProps>;
1116
+ /**
1117
+ * The fill component for the Progress Bar, representing the filled portion.
1118
+ */
1119
+ Fill: React$1.FC<ProgressBarFillProps>;
1120
+ };
1121
+
1017
1122
  interface SelectSeparatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
1018
1123
  }
1019
1124
 
@@ -1248,6 +1353,10 @@ interface ThemeContextValue extends ThemeChangeHandlers {
1248
1353
  }
1249
1354
  declare function useTheme(): ThemeContextValue;
1250
1355
 
1251
- declare function ThemeControl(): react_jsx_runtime.JSX.Element;
1356
+ declare const ThemeControlPosition: readonly ["tl", "top", "tr", "left", "center", "right", "bl", "bottom", "br"];
1357
+ interface ThemeControlProps {
1358
+ position?: (typeof ThemeControlPosition)[number];
1359
+ }
1360
+ declare function ThemeControl({ position }: ThemeControlProps): react_jsx_runtime.JSX.Element;
1252
1361
 
1253
- export { Accordion, Badge, Box, Button, Checkbox, Container, Portal, Select, Separator, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
1362
+ export { Accordion, Badge, Box, Button, Checkbox, Container, Panel, Portal, ProgressBar, Select, Separator, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
package/dist/index.d.ts CHANGED
@@ -21,6 +21,11 @@ type StringPropDef = {
21
21
  className?: string;
22
22
  cssProperty?: string;
23
23
  };
24
+ type NumberPropDef = {
25
+ type: "number";
26
+ default?: number;
27
+ required?: boolean;
28
+ };
24
29
  type ReactNodePropDef<T = React.ReactNode> = {
25
30
  type: "reactNode";
26
31
  required?: boolean;
@@ -40,6 +45,7 @@ type EnumOrStringPropDef<T extends string> = {
40
45
  required?: boolean;
41
46
  className?: string;
42
47
  dataAttr?: string;
48
+ transform?: (value: string) => string;
43
49
  };
44
50
  type ValueOrArrayPropDef<T> = {
45
51
  type: "value | array";
@@ -51,11 +57,11 @@ type FunctionPropDef<T extends (...args: any[]) => any = (...args: any[]) => any
51
57
  type: "function";
52
58
  required?: boolean;
53
59
  };
54
- type BasePropDef<T = any> = BooleanPropDef | StringPropDef | ReactNodePropDef<T> | EnumPropDef<T> | EnumOrStringPropDef<T & string> | ValueOrArrayPropDef<T> | FunctionPropDef<T & ((...args: any[]) => any)>;
60
+ type BasePropDef<T = any> = BooleanPropDef | StringPropDef | NumberPropDef | ReactNodePropDef<T> | EnumPropDef<T> | EnumOrStringPropDef<T & string> | ValueOrArrayPropDef<T> | FunctionPropDef<T & ((...args: any[]) => any)>;
55
61
  type ResponsivePropDef<T = any> = BasePropDef<T> & {
56
62
  responsive: true;
57
63
  };
58
- type GetPropDefType<Def> = Def extends BooleanPropDef ? Def extends ResponsivePropDef ? Responsive<boolean> : boolean : Def extends StringPropDef ? Def extends ResponsivePropDef ? Responsive<string> : string : Def extends ReactNodePropDef<infer Type> ? Type : Def extends FunctionPropDef<infer Fn> ? Fn : Def extends EnumOrStringPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Union<string, Type> : Def extends ValueOrArrayPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type | Type[]> : Type | Type[] : Def extends EnumPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type : never;
64
+ type GetPropDefType<Def> = Def extends BooleanPropDef ? Def extends ResponsivePropDef ? Responsive<boolean> : boolean : Def extends StringPropDef ? Def extends ResponsivePropDef ? Responsive<string> : string : Def extends NumberPropDef ? Def extends ResponsivePropDef ? Responsive<number> : number : Def extends ReactNodePropDef<infer Type> ? Type : Def extends FunctionPropDef<infer Fn> ? Fn : Def extends EnumOrStringPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Union<string, Type> : Def extends ValueOrArrayPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type | Type[]> : Type | Type[] : Def extends EnumPropDef<infer Type> ? Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type : never;
59
65
  type GetPropDefTypes<P> = {
60
66
  [K in keyof P]?: GetPropDefType<P[K]>;
61
67
  };
@@ -72,17 +78,36 @@ declare const AlignPropDef: {
72
78
  };
73
79
  type AlignProp = GetPropDefTypes<typeof AlignPropDef>;
74
80
 
81
+ /**
82
+ * Parses a color string (hex, rgb, or raw r,g,b) into a raw "r, g, b" string
83
+ * suitable for use with CSS rgba().
84
+ *
85
+ * Supported formats:
86
+ * - Hex: "#7BEB34", "#7beb34", "#abc"
87
+ * - RGB function: "rgb(125, 235, 52)"
88
+ * - Raw: "125, 235, 52"
89
+ *
90
+ * Returns the original string unchanged if parsing fails.
91
+ */
92
+ declare function parseColor(value: string): string;
93
+
75
94
  declare const ColorPropDef: {
76
95
  /**
77
96
  * Sets the color of the component.
78
97
  *
98
+ * Uses predefined theme colors ("primary", "secondary", etc.) or accepts custom color values in hex, rgb, or raw rgb formats.
99
+ *
79
100
  * @example color="primary" // primary color
101
+ * @example color="#7BEB34" // hex color
102
+ * @example color="rgb(125, 235, 52)" // rgb color
103
+ * @example color="125, 235, 52" // raw rgb values
80
104
  */
81
105
  color: {
82
106
  type: "enum | string";
83
107
  values: readonly ["primary", "secondary", "tertiary", "accent", "success", "warning", "danger", "info"];
84
108
  dataAttr: string;
85
109
  className: string;
110
+ transform: typeof parseColor;
86
111
  };
87
112
  };
88
113
  type ColorProp = GetPropDefTypes<typeof ColorPropDef>;
@@ -650,6 +675,13 @@ type StrictChildren<AllowedChildProps> = {
650
675
  type WithStrictChildren<Props extends {
651
676
  children?: React$1.ReactNode;
652
677
  }, AllowedChildProps> = Omit<Props, "children"> & StrictChildren<AllowedChildProps>;
678
+ /**
679
+ * Like WithStrictChildren, but children are optional.
680
+ * When provided, children are still restricted to the allowed types.
681
+ */
682
+ type WithOptionalStrictChildren<Props extends {
683
+ children?: React$1.ReactNode;
684
+ }, AllowedChildProps> = Omit<Props, "children"> & Partial<StrictChildren<AllowedChildProps>>;
653
685
 
654
686
  declare const AccordionRootPropsDefs: {
655
687
  /**
@@ -900,6 +932,24 @@ declare const Container: React$1.ForwardRefExoticComponent<{} & {
900
932
  direction?: "row" | "column" | undefined;
901
933
  } & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
902
934
 
935
+ interface PanelExternalProps extends MarginProps, PaddingProps, SpacingProp, RadiusProps, RoundnessProp {
936
+ }
937
+ /**
938
+ * A versatile container used to provide layout and styling capabilities.
939
+ */
940
+ declare const Panel: React$1.ForwardRefExoticComponent<GetPropDefTypes<{
941
+ readonly variant: {
942
+ type: "enum";
943
+ values: readonly ["solid", "outlined", "muted"];
944
+ dataAttr: string;
945
+ };
946
+ readonly blur: {
947
+ type: "string";
948
+ default: string;
949
+ cssProperty: string;
950
+ };
951
+ }> & PanelExternalProps & React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
952
+
903
953
  declare const variants: readonly ["clear", "shadow", "blurred"];
904
954
  type PortalBackdropInternalProps = {
905
955
  /**
@@ -1014,6 +1064,61 @@ declare const Portal: {
1014
1064
  Backdrop: React$1.ForwardRefExoticComponent<AllPortalBackdropProps & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
1015
1065
  };
1016
1066
 
1067
+ declare const ProgressBarFillPropsDefs: {
1068
+ /**
1069
+ * The value of the progress bar (filled state).
1070
+ * Should be a number between 0 and 1 representing the percentage of completion.
1071
+ */
1072
+ readonly value: {
1073
+ type: "number";
1074
+ };
1075
+ };
1076
+ type ProgressBarFillInternalProps = GetPropDefTypes<typeof ProgressBarFillPropsDefs>;
1077
+
1078
+ interface AllProgressBarFillProps extends ProgressBarFillInternalProps, ColorProp, MarginProps, SizeProp {
1079
+ }
1080
+ /**
1081
+ * A ProgressBarFill.
1082
+ */
1083
+ type ProgressBarFillProps = AllProgressBarFillProps & HTMLAttributes<HTMLDivElement>;
1084
+
1085
+ declare const ProgressBarRootPropsDefs: {
1086
+ /**
1087
+ * Sets the variant style of the progress bar ("solid", "outlined", or "muted").
1088
+ */
1089
+ readonly variant: {
1090
+ type: "enum";
1091
+ values: readonly ["solid", "outlined", "muted"];
1092
+ dataAttr: string;
1093
+ };
1094
+ /**
1095
+ * The value of the progress bar (filled state).
1096
+ * Should be a number between 0 and 1 representing the percentage of completion.
1097
+ */
1098
+ readonly value: {
1099
+ type: "number";
1100
+ };
1101
+ };
1102
+ type ProgressBarRootInternalProps = GetPropDefTypes<typeof ProgressBarRootPropsDefs>;
1103
+
1104
+ interface AllProgressBarRootProps extends ProgressBarRootInternalProps, ColorProp, MarginProps, SizeProp {
1105
+ }
1106
+ type ProgressBarRootProps = AllProgressBarRootProps & WithOptionalStrictChildren<HTMLAttributes<HTMLDivElement>, ProgressBarFillProps>;
1107
+
1108
+ /**
1109
+ * A Progress Bar component to display single or stacked progress bars.
1110
+ */
1111
+ declare const ProgressBar: React$1.FC<ProgressBarRootProps> & {
1112
+ /**
1113
+ * The root component for the Progress Bar.
1114
+ */
1115
+ Root: React$1.FC<ProgressBarRootProps>;
1116
+ /**
1117
+ * The fill component for the Progress Bar, representing the filled portion.
1118
+ */
1119
+ Fill: React$1.FC<ProgressBarFillProps>;
1120
+ };
1121
+
1017
1122
  interface SelectSeparatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
1018
1123
  }
1019
1124
 
@@ -1248,6 +1353,10 @@ interface ThemeContextValue extends ThemeChangeHandlers {
1248
1353
  }
1249
1354
  declare function useTheme(): ThemeContextValue;
1250
1355
 
1251
- declare function ThemeControl(): react_jsx_runtime.JSX.Element;
1356
+ declare const ThemeControlPosition: readonly ["tl", "top", "tr", "left", "center", "right", "bl", "bottom", "br"];
1357
+ interface ThemeControlProps {
1358
+ position?: (typeof ThemeControlPosition)[number];
1359
+ }
1360
+ declare function ThemeControl({ position }: ThemeControlProps): react_jsx_runtime.JSX.Element;
1252
1361
 
1253
- export { Accordion, Badge, Box, Button, Checkbox, Container, Portal, Select, Separator, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };
1362
+ export { Accordion, Badge, Box, Button, Checkbox, Container, Panel, Portal, ProgressBar, Select, Separator, Text, Theme, type ThemeAppearance, ThemeControl, type ThemeRadius, type ThemeRoundness, type ThemeSpacing, useTheme };