@hybr1d-tech/charizard 0.6.68 → 0.6.70

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.
@@ -0,0 +1,329 @@
1
+ import { TooltipV2Props } from '../tooltip-v2/TooltipV2';
2
+
3
+ /**
4
+ * Enum representing the different components within the input system.
5
+ * This can be used to identify and manage the different subcomponents
6
+ * of a more complex and nested input structure.
7
+ */
8
+ export declare enum INPUT_COMPONENTS {
9
+ INPUT = "input",
10
+ TEXTAREA = "textarea",
11
+ CONTROL = "control",
12
+ LABEL = "label",
13
+ GROUP = "group",
14
+ LEFT_ICON = "leftIcon",
15
+ RIGHT_ICON = "rightIcon",
16
+ LEFT_ADORNMENT = "leftAdornment",
17
+ RIGHT_ADORNMENT = "rightAdornment",
18
+ COUNT = "count",
19
+ NUMBER = "number",
20
+ NUMBER_ADORNMENT = "numberAdornment"
21
+ }
22
+ /**
23
+ * Props for the InputV2 component, which extends the standard HTML input element
24
+ * with additional styling and error handling.
25
+ *
26
+ * @interface InputV2Props
27
+ * @extends {React.InputHTMLAttributes<HTMLInputElement>}
28
+ *
29
+ * @property {string} [errorMsg] - Error message to display below the input if there is a validation error.
30
+ * @property {string} [containerClassName] - Additional class name(s) for the input container div.
31
+ * @property {never} [inputStyles] - Used for internal styling when grouping it with multiple components. use className for styling input.
32
+ * @property {never} [containerStyles] - Used for internal styling when grouping it with multiple components. use containerClassName for styling input container.
33
+ *
34
+ * @example
35
+ * <InputV2
36
+ * placeholder="Enter"
37
+ * errorMsg="This field is required"
38
+ * />
39
+ * @example
40
+ * with formik
41
+ * <InputV2
42
+ * {...formik.getFieldProps(key)}
43
+ * placeholder="Enter"
44
+ * errorMsg="This field is required"
45
+ * />
46
+ */
47
+ export interface InputV2Props extends React.InputHTMLAttributes<HTMLInputElement> {
48
+ errorMsg?: string;
49
+ containerClassName?: string;
50
+ inputStyles?: never;
51
+ containerStyles?: never;
52
+ }
53
+ /**
54
+ * Props for the TextareaV2 component, which extends the standard HTML textarea element
55
+ * with additional styling and error handling.
56
+ *
57
+ * @interface InputV2Props
58
+ * @extends {React.TextareaHTMLAttributes<HTMLTextAreaElement>}
59
+ *
60
+ *
61
+ * @property {string} [errorMsg] - Error message to display below the textarea if there is a validation error.
62
+ * @property {string} [containerClassName] - Additional class name(s) for the textarea container div.
63
+ * @property {never} [inputStyles] - Used for internal styling when grouping it with multiple components. use className for styling textarea.
64
+ * @property {never} [containerStyles] - Used for internal styling when grouping it with multiple components. use containerClassName for styling textarea container.
65
+ *
66
+ * @example
67
+ * <TextareaV2
68
+ * placeholder="Enter"
69
+ * errorMsg="This field is required"
70
+ * />
71
+ * @example
72
+ * with formik
73
+ * <TextareaV2
74
+ * {...formik.getFieldProps(key)}
75
+ * placeholder="Enter"
76
+ * errorMsg="This field is required"
77
+ * />
78
+ */
79
+ export interface TextareaV2Props extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
80
+ errorMsg?: string;
81
+ containerClassName?: string;
82
+ inputStyles?: never;
83
+ containerStyles?: never;
84
+ }
85
+ /**
86
+ * Props for the InputControl component, used as a wrapper to group multiple input-related components.
87
+ *
88
+ * @interface InputControlPropsV2
89
+ * @extends {React.HTMLAttributes<HTMLDivElement>}
90
+ *
91
+ * @property {React.ReactNode} children - The elements that will be rendered inside the control.
92
+ *
93
+ * @example
94
+ * <InputControlV2>
95
+ * <LabelV2>Username</LabelV2>
96
+ * <InputV2
97
+ * placeholder="Enter"
98
+ * errorMsg="This field is required"
99
+ * />
100
+ * </InputControlV2>
101
+ */
102
+ export interface InputControlPropsV2 extends React.HTMLAttributes<HTMLDivElement> {
103
+ children: React.ReactNode;
104
+ }
105
+ /**
106
+ * Props for the Label component, used to provide descriptive text for form inputs.
107
+ *
108
+ * @interface LabelPropsV2
109
+ * @extends {React.LabelHTMLAttributes<HTMLLabelElement>}
110
+ *
111
+ * @property {React.ReactNode} children - The text or elements inside the label.
112
+ * @property {string} [info] - Additional info to display, such as help text in tooltip.
113
+ * @property {boolean} [disabled] - Whether the associated input is disabled.
114
+ * @property {boolean} [required] - Whether the field is required (red * will be shown beside label).
115
+ * @property {Partial<TooltipV2Props>} [tooltipProps] - Props for the tooltip, if additional information is provided and want to customize tooltip styles.
116
+ *
117
+ * @example
118
+ * <LabelV2 info="Your full name">Name</LabelV2>
119
+ */
120
+ export interface LabelPropsV2 extends React.LabelHTMLAttributes<HTMLLabelElement> {
121
+ children: React.ReactNode;
122
+ info?: string;
123
+ disabled?: boolean;
124
+ required?: boolean;
125
+ tooltipProps?: Partial<TooltipV2Props>;
126
+ }
127
+ /**
128
+ * Props for the InputGroup component, which groups input icons and adornments elements together.
129
+ *
130
+ * @interface InputGroupPropsV2
131
+ * @extends {React.HTMLAttributes<HTMLDivElement>}
132
+ *
133
+ * @property {React.ReactNode} children - The elements to be grouped together.
134
+ *
135
+ * @example
136
+ * <InputGroupV2>
137
+ * <InputLeftAdornment>+</InputLeftAdornment>
138
+ * <InputV2 />
139
+ * <InputRightAdornment>-</InputRightAdornment>
140
+ * </InputGroupV2>
141
+ * @example
142
+ * with label
143
+ * <InputControlV2>
144
+ * <LabelV2>Username</LabelV2>
145
+ * <InputGroupV2>
146
+ * <InputLeftAdornment>+</InputLeftAdornment>
147
+ * <InputV2 />
148
+ * <InputRightAdornment>-</InputRightAdornment>
149
+ * </InputGroupV2>
150
+ * </InputControlV2>
151
+ */
152
+ export interface InputGroupPropsV2 extends React.HTMLAttributes<HTMLDivElement> {
153
+ children: React.ReactNode;
154
+ }
155
+ /**
156
+ * Props for the InputIcon component, which is used to display an icon within an input field. It can be left, right or both.
157
+ *
158
+ * @interface InputIconProps
159
+ *
160
+ * @property {string} icon - The icon to display.
161
+ * @property {() => void} [onClick] - Optional click handler for the icon.
162
+ * @property {never} [iconStyles] - Used for internal styling when grouping it with multiple components. use className for styling icon if clickable.
163
+ * @property {boolean} [disabled] - Whether the icon should be disabled with input.
164
+ * @property {string} [className] - Additional classNames for the icon if it is clickable.
165
+ *
166
+ * @example
167
+ * <InputGroupV2>
168
+ * <InputLeftIcon icon={...} />
169
+ * <InputV2 />
170
+ * <InputRightIcon icon={...} />
171
+ * </InputGroupV2>
172
+ */
173
+ export interface InputIconProps {
174
+ icon: string;
175
+ onClick?: () => void;
176
+ iconStyles?: never;
177
+ disabled?: boolean;
178
+ className?: string;
179
+ }
180
+ /**
181
+ * Represents an option in a dropdown menu for adornment.
182
+ *
183
+ * @interface DropdownOption
184
+ *
185
+ * @property {string} value - The value associated with the dropdown option.
186
+ * @property {string} label - The label displayed for the dropdown option.
187
+ *
188
+ * @example
189
+ * const options: DropdownOption[] = [
190
+ * { value: '1', label: 'Option 1' },
191
+ * { value: '2', label: 'Option 2' },
192
+ * ];
193
+ */
194
+ export interface DropdownOption {
195
+ value: string;
196
+ label: string;
197
+ }
198
+ /**
199
+ * Base props for input adornment components. It can be dropdown or non actionable
200
+ *
201
+ * @interface BaseInputAdornmentProps
202
+ *
203
+ * @property {React.ReactNode} children - The elements or text inside the adornment.
204
+ * @property {boolean} [disabled] - Whether the adornment is disabled.
205
+ */
206
+ export interface BaseInputAdornmentProps {
207
+ children: React.ReactNode;
208
+ disabled?: boolean;
209
+ }
210
+ /**
211
+ * Props for a dropdown adornment.
212
+ *
213
+ * @interface DropdownProps
214
+ * @extends {BaseInputAdornmentProps}
215
+ *
216
+ * @property {true} isDropdown - Indicates this adornment is a dropdown.
217
+ * @property {DropdownOption[]} options - List of options available in the dropdown.
218
+ * @property {(value: string) => void} onOptionSelect - Callback function when an option is selected.
219
+ * @property {boolean} [hideSearch] - Whether to hide the search bar within the dropdown.
220
+ * @property {boolean} [isLoading] - Whether the dropdown is currently loading options.
221
+ *
222
+ * @example
223
+ * <InputGroupV2>
224
+ * <InputLeftAdornment isDropdown options={options} onOptionSelect={handleSelect}>...</InputLeftAdornment>
225
+ * <InputV2 />
226
+ * </InputGroupV2>
227
+ */
228
+ export interface DropdownProps extends BaseInputAdornmentProps {
229
+ isDropdown: true;
230
+ options: DropdownOption[];
231
+ onOptionSelect: (value: string) => void;
232
+ hideSearch?: boolean;
233
+ isLoading?: boolean;
234
+ }
235
+ /**
236
+ * Props for a non-dropdown adornment within an input field, such as an icon.
237
+ *
238
+ * @interface NonDropdownProps
239
+ * @extends {BaseInputAdornmentProps}
240
+ *
241
+ * @property {false} [isDropdown] - Indicates this adornment is not a dropdown.
242
+ * @property {never} [options] - Options are not applicable to non-dropdown adornments.
243
+ * @property {never} [hideSearch] - Search hiding is not applicable to non-dropdown adornments.
244
+ * @property {never} [onOptionSelect] - Option selection is not applicable to non-dropdown adornments.
245
+ * @property {never} [isLoading] - Loading state is not applicable to non-dropdown adornments.
246
+ *
247
+ * @example
248
+ * @example
249
+ * <InputGroupV2>
250
+ * <InputV2 />
251
+ * <InputRightAdornment>...</InputRightAdornment>
252
+ * </InputGroupV2>
253
+ */
254
+ export interface NonDropdownProps extends BaseInputAdornmentProps {
255
+ isDropdown?: false;
256
+ options?: never;
257
+ hideSearch?: never;
258
+ onOptionSelect?: never;
259
+ isLoading?: never;
260
+ }
261
+ /**
262
+ * Type representing the possible props for input adornments, which can either be a dropdown or non actionable.
263
+ */
264
+ export type InputAdornmentProps = DropdownProps | NonDropdownProps;
265
+ /**
266
+ * Props for an input field which can be use as counter i.e. product count.
267
+ *
268
+ * @interface InputCountProps
269
+ * @extends {InputV2Props}
270
+ *
271
+ * @property {(value: number) => void} onCountChange - Callback when the count changes.
272
+ * @property {never} [onChange] - `onChange` is disabled for this component; use `onCountChange`.
273
+ * @property {number} [min] - Minimum allowable value for the count (by default Infinity).
274
+ * @property {number} [max] - Maximum allowable value for the count (by default Infinity).
275
+ * @property {number} [count] - Current count value (enable for two way binding).
276
+ * @property {string} [countContainerClassName] - Additional className for the count container.
277
+ *
278
+ * @example
279
+ * <InputCount onCountChange={(value) => ...} count={10} min={0} max={100} />
280
+ */
281
+ export interface InputCountProps extends InputV2Props {
282
+ onCountChange: (value: number) => void;
283
+ onChange?: never;
284
+ min?: number;
285
+ max?: number;
286
+ count?: number;
287
+ countContainerClassName?: string;
288
+ }
289
+ /**
290
+ * Props for an input field designed to accept numeric values.
291
+ *
292
+ * @interface InputNumberProps
293
+ * @extends {InputV2Props}
294
+ *
295
+ * @property {(value: number) => void} onCountChange - Callback when the numeric value changes.
296
+ * @property {never} [onChange] - `onChange` is disabled for this component; use `onCountChange`.
297
+ * @property {number} [min] - Minimum allowable value for the input (by default Infinity)
298
+ * @property {number} [max] - Maximum allowable value for the input (by default Infinity)
299
+ * @property {number} [count] - Current numeric value (enable for two way binding).
300
+ * @property {string} [countContainerClassName] -Additional className for the count container.
301
+ *
302
+ * @example
303
+ * <InputNumber onCountChange={(value) => ...)} count={5} min={0} max={10} />
304
+ */
305
+ export interface InputNumberProps extends InputV2Props {
306
+ onCountChange: (value: number) => void;
307
+ onChange?: never;
308
+ min?: number;
309
+ max?: number;
310
+ count?: number;
311
+ countContainerClassName?: string;
312
+ }
313
+ /**
314
+ * Props for a number increment/decrement adornment in an InputNumber field.
315
+ *
316
+ * @interface NumberAdornmentProps
317
+ *
318
+ * @property {() => void} onIncrement - Callback when the increment button is clicked.
319
+ * @property {() => void} onDecrement - Callback when the decrement button is clicked.
320
+ * @property {boolean} [disabled] - Whether the increment/decrement buttons are disabled.
321
+ *
322
+ * @example
323
+ * <NumberAdornment onIncrement={() => increment()} onDecrement={() => decrement()} />
324
+ */
325
+ export interface NumberAdornmentProps {
326
+ onIncrement: () => void;
327
+ onDecrement: () => void;
328
+ disabled?: boolean;
329
+ }
@@ -0,0 +1,20 @@
1
+ import { SearchV2Props } from './types';
2
+
3
+ /**
4
+ * SearchV2 is a customizable search input component that integrates with the `InputV2` component.
5
+ * It includes search and clear icons, and supports controlled and uncontrolled modes for managing the search input value.
6
+ *
7
+ * @param {SearchV2Props} props - The properties for the SearchV2 component.
8
+ * @param {string} [props.search=''] - The current search term value (used in uncontrolled mode).
9
+ * @param {React.Dispatch<React.SetStateAction<string>>} [props.setSearch] - Function to update the search term (used in controlled mode).
10
+ * @param {InputV2Props} [props] - Additional properties to pass to the `InputV2` component.
11
+ * @returns {JSX.Element} The rendered SearchV2 component.
12
+ *
13
+ * @example
14
+ * <SearchV2
15
+ * search={searchTerm}
16
+ * setSearch={setSearchTerm}
17
+ * placeholder="Search..."
18
+ * />
19
+ */
20
+ export declare function SearchV2({ search, setSearch, ...props }: SearchV2Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Search';
@@ -0,0 +1,6 @@
1
+ import { InputV2Props } from '../input-v2/types';
2
+
3
+ export interface SearchV2Props extends InputV2Props {
4
+ search?: string;
5
+ setSearch?: React.Dispatch<React.SetStateAction<string>>;
6
+ }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- interface TooltipV2Props {
2
+ export interface TooltipV2Props {
3
3
  id: string;
4
4
  placement?: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
5
5
  trigger: React.ReactNode;
@@ -12,4 +12,3 @@ interface TooltipV2Props {
12
12
  contentMaxLength?: number;
13
13
  }
14
14
  export declare function TooltipV2({ id, placement, trigger, content, variant, customStyle, portalId, portalClass, contentMaxLength, }: TooltipV2Props): import("react/jsx-runtime").JSX.Element;
15
- export {};