@lax-wp/design-system 0.3.57 → 0.3.59

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.
@@ -1,5 +1,6 @@
1
- import type { GroupBase, SingleValue, MultiValue, ActionMeta, Props as ReactSelectProps, SelectInstance } from "react-select";
2
- import type { components } from "react-select";
1
+ import CreatableSelect from "react-select/creatable";
2
+ import type { LabelType } from "../../data-display/label/Label";
3
+ import type { ComponentProps } from "react";
3
4
  /**
4
5
  * Option type for the CreatableSelect component
5
6
  */
@@ -14,67 +15,58 @@ export interface SelectOption {
14
15
  data?: Record<string, unknown>;
15
16
  }
16
17
  /**
17
- * Props for the CreatableSelect component
18
+ * Props for the CreatableSelectField component
19
+ * Matches the lax-web-portal implementation for drop-in replacement
18
20
  */
19
- export interface CreatableSelectProps {
21
+ export type TProps = {
20
22
  /** Unique identifier for the select */
21
23
  id: string;
22
24
  /** Label text to display above the select */
23
- label?: string;
25
+ label: string;
24
26
  /** Placeholder text for the select */
25
27
  placeholder?: string;
26
28
  /** Current value for single select */
27
- value?: SelectOption | null;
28
- /** Current values for multi select */
29
- selectedValues?: SelectOption[];
29
+ value?: any;
30
30
  /** Callback function called when selection changes */
31
- onChange: (value: SingleValue<SelectOption> | MultiValue<SelectOption>, actionMeta: ActionMeta<SelectOption>) => void;
32
- /** Callback function called when selection changes (legacy) */
33
- onColorChange?: (data: SelectOption | SelectOption[] | null) => void;
31
+ onChange(data: any): void;
32
+ /** Error message to display below the select */
33
+ errorMessage?: string;
34
34
  /** Array of available options */
35
- selectOptions: SelectOption[];
35
+ selectOptions: any[];
36
36
  /** Whether the select is in loading state */
37
37
  loading?: boolean;
38
38
  /** Whether multiple selections are allowed */
39
39
  multiSelect?: boolean;
40
+ /** Current values for multi select */
41
+ selectedValues?: any[];
42
+ /** Custom filter function for options */
43
+ filterOption?: any;
44
+ /** Whether to preserve original case in the label */
45
+ originalCase?: boolean;
40
46
  /** Whether the select is disabled */
41
47
  disabled?: boolean;
42
48
  /** Whether the select is clearable */
43
49
  isClearable?: boolean;
44
50
  /** Whether the field is required */
45
51
  required?: boolean;
46
- /** Message to display below the select */
47
- message?: string;
48
- /** Type of message to display */
49
- messageType?: "success" | "error" | "info" | "default";
50
- /** Whether to preserve original case in the label */
51
- originalCase?: boolean;
52
- /** Additional CSS classes for the wrapper container */
53
- wrapperClassName?: string;
54
- /** Additional CSS classes for the select */
55
- selectClassName?: string;
56
- /** Additional CSS classes for the label */
57
- labelClassName?: string;
58
- /** Help text to display below the label */
59
- helpText?: string;
60
- /** Size variant for the select */
61
- size?: "small" | "medium" | "large";
62
- /** Custom filter function for options */
63
- filterOption?: ReactSelectProps<SelectOption, boolean, GroupBase<SelectOption>>["filterOption"];
64
- /** Additional props to pass to the react-select component */
65
- selectProps?: Partial<ReactSelectProps<SelectOption, boolean, GroupBase<SelectOption>>>;
66
- /** Custom components to override defaults */
67
- components?: Partial<typeof components>;
68
- /** Array of tags for categorization */
69
- tags?: string[];
70
- /** Tooltip text */
52
+ /** Tags/labels to display next to the label */
53
+ tags?: (string | LabelType)[];
54
+ /** Tooltip text for the help icon */
71
55
  tooltip?: string;
72
- }
56
+ /** Additional CSS classes for the wrapper */
57
+ className?: string;
58
+ /** Whether the component is in dark mode */
59
+ isDarkMode?: boolean;
60
+ };
61
+ export type CreatableSelectProps = TProps & ComponentProps<typeof CreatableSelect>;
73
62
  /**
74
- * A highly customizable creatable select component with label, validation, and styling support.
63
+ * A creatable select component with label, validation, and styling support.
75
64
  * Features dark mode support, accessibility enhancements, and comprehensive prop support.
76
65
  * Built on top of react-select/creatable for advanced functionality.
77
66
  *
67
+ * This component is designed as a drop-in replacement for the lax-web-portal
68
+ * CreatableSelectField component.
69
+ *
78
70
  * @example
79
71
  * ```tsx
80
72
  * <CreatableSelectField
@@ -88,5 +80,7 @@ export interface CreatableSelectProps {
88
80
  * />
89
81
  * ```
90
82
  */
91
- export declare const CreatableSelectField: import("react").ForwardRefExoticComponent<CreatableSelectProps & import("react").RefAttributes<SelectInstance<SelectOption, boolean, GroupBase<SelectOption>>>>;
92
- export type TProps = CreatableSelectProps;
83
+ export declare const CreatableSelectField: {
84
+ ({ id, label, errorMessage, selectOptions, loading, isClearable, multiSelect, selectedValues, disabled, required, value, className, tooltip, tags, originalCase, onChange, filterOption, placeholder, isDarkMode, ...props }: TProps & ComponentProps<typeof CreatableSelect>): import("react/jsx-runtime").JSX.Element;
85
+ displayName: string;
86
+ };