@lax-wp/design-system 0.3.32 → 0.3.34

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,68 +1,103 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { TToggleDirection } from "../../../constants/toggle";
2
3
  /**
3
- * Toggle label direction options
4
+ * Label type for tags
4
5
  */
5
- export type ToggleDirection = "top" | "left" | "right";
6
+ export type LabelType = {
7
+ label: string;
8
+ color?: string;
9
+ };
6
10
  /**
7
11
  * Props for the Toggle component
8
12
  */
9
13
  export interface ToggleProps {
14
+ /** Whether this is a GTN (Global Term Name) field */
15
+ isGTN?: boolean;
10
16
  /** Unique identifier for the toggle */
11
17
  id?: string;
12
18
  /** Whether the toggle is checked */
13
- checked: boolean;
19
+ isChecked: boolean;
14
20
  /** Callback function called when toggle state changes */
15
- onChange: (checked: boolean) => void;
21
+ onChange: (val: boolean) => void;
16
22
  /** Label text or element to display */
17
23
  label?: ReactNode;
24
+ /** Whether to preserve original case in the label */
25
+ originalCase?: boolean;
18
26
  /** Whether the field is required */
19
27
  required?: boolean;
20
- /** Whether the toggle is disabled */
21
- disabled?: boolean;
22
- /** Message to display below the toggle */
23
- message?: string;
24
- /** Type of message to display */
25
- messageType?: "success" | "error" | "info" | "default";
26
- /** Additional CSS classes for the wrapper container */
27
- wrapperClassName?: string;
28
- /** Additional CSS classes for the toggle */
29
- toggleClassName?: string;
30
- /** Additional CSS classes for the label */
31
- labelClassName?: string;
32
- /** Help text to display below the label */
33
- helpText?: string;
34
- /** Size variant for the toggle */
35
- size?: "small" | "medium" | "large";
36
- /** Label direction relative to toggle */
37
- labelDirection?: ToggleDirection;
28
+ /** Whether the required indicator shows as conditional (yellow instead of red) */
29
+ isRequiredConditional?: boolean;
30
+ /** Tags/labels to display next to the label */
31
+ tags?: (string | LabelType)[];
38
32
  /** Whether to hide the status text (Yes/No) */
39
33
  hideStatus?: boolean;
34
+ /** Label direction relative to toggle */
35
+ labelDirection?: TToggleDirection;
40
36
  /** Custom status text instead of Yes/No */
41
37
  statusText?: string;
42
38
  /** Whether to show icons in the toggle */
43
39
  withIcon?: boolean;
40
+ /** Whether the value was AI extracted */
41
+ isAiExtracted?: boolean;
42
+ /** Tooltip text to display */
43
+ tooltip?: string;
44
+ /** Additional CSS classes for the toggle input */
45
+ className?: string;
46
+ /** Whether the toggle is disabled */
47
+ isDisabled?: boolean;
44
48
  /** Custom icons for checked/unchecked states */
45
49
  icon?: {
46
50
  checkedIcon: ReactNode;
47
51
  uncheckedIcon: ReactNode;
48
52
  };
49
- /** Visual variant for the toggle */
50
- variant?: "primary" | "secondary";
51
- /** Whether to preserve original case in the label */
52
- originalCase?: boolean;
53
53
  /** Whether to stop click propagation */
54
54
  stopClickPropagation?: boolean;
55
+ /** GTN field name for document integration */
56
+ gtnName?: any;
57
+ /** Visual variant for the toggle */
58
+ variant?: 'primary' | 'secondary';
59
+ /** Additional CSS classes for the label */
60
+ labelClassName?: string;
61
+ /** Whether this is a live field */
62
+ isLiveField?: boolean;
63
+ /** Message to display below the toggle */
64
+ message?: string;
65
+ /** Type of message to display */
66
+ messageType?: "success" | "error" | "info" | "default";
67
+ /** Additional CSS classes for the wrapper container */
68
+ wrapperClassName?: string;
69
+ /** Help text to display below the label */
70
+ helpText?: string;
71
+ /** Size variant for the toggle */
72
+ size?: "small" | "medium" | "large";
73
+ /** Custom render function for AI extracted indicator */
74
+ renderAiExtractedIndicator?: () => ReactNode;
75
+ /** Custom render function for labels/tags */
76
+ renderLabels?: (labels?: (string | LabelType)[]) => ReactNode;
77
+ /** Custom render function for required indicator */
78
+ renderRequired?: (isConditional: boolean) => ReactNode;
79
+ /** Custom render function for tooltip */
80
+ renderTooltip?: (tooltip: string) => ReactNode;
81
+ /** Custom render function for live field icon */
82
+ renderLiveFieldIcon?: () => ReactNode;
83
+ /** Custom render function for GTN add to document button */
84
+ renderGTNAddButton?: (onClick: () => void) => ReactNode;
85
+ /** Handler for adding GTN to document */
86
+ onAddGTNToDocument?: (keyValuePair: {
87
+ key: string;
88
+ value: string;
89
+ }) => void;
55
90
  }
56
91
  /**
57
92
  * A highly customizable toggle component with label, validation, and styling support.
58
- * Features multiple sizes, variants, icon support, and comprehensive prop support.
93
+ * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.
59
94
  *
60
95
  * @example
61
96
  * ```tsx
62
97
  * <Toggle
63
98
  * id="notifications"
64
99
  * label="Enable Notifications"
65
- * checked={notificationsEnabled}
100
+ * isChecked={notificationsEnabled}
66
101
  * onChange={(checked) => setNotificationsEnabled(checked)}
67
102
  * required
68
103
  * />
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Toggle label direction options
3
+ */
4
+ export declare enum TOGGLE_LABEL_DIRECTION {
5
+ LEFT = "left",
6
+ RIGHT = "right",
7
+ TOP = "top"
8
+ }
9
+ /**
10
+ * Type derived from TOGGLE_LABEL_DIRECTION enum
11
+ */
12
+ export type TToggleDirection = `${TOGGLE_LABEL_DIRECTION}`;
package/dist/index.d.ts CHANGED
@@ -21,7 +21,9 @@ export type { DebounceInputFieldProps } from "./components/forms/debounce-input/
21
21
  export { PercentageInputField } from "./components/forms/percentage-input/PercentageInputField";
22
22
  export type { PercentageInputFieldProps } from "./components/forms/percentage-input/PercentageInputField";
23
23
  export { Toggle } from "./components/forms/toggle/Toggle";
24
- export type { ToggleProps, ToggleDirection, } from "./components/forms/toggle/Toggle";
24
+ export type { ToggleProps } from "./components/forms/toggle/Toggle";
25
+ export { TOGGLE_LABEL_DIRECTION } from "./constants/toggle";
26
+ export type { TToggleDirection } from "./constants/toggle";
25
27
  export { MdInput } from "./components/forms/md-input/MdInput";
26
28
  export type { MdInputProps } from "./components/forms/md-input/MdInput";
27
29
  export { MultiFileUpload } from "./components/forms/multi-file-upload/MultiFileUpload";