react-better-html 1.1.216 → 1.1.218

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
@@ -1,7 +1,9 @@
1
- import { WebTarget } from 'styled-components';
1
+ import { Color, BetterCoreProviderConfig, DeepPartialRecord, BetterCoreConfig, OmitProps, IconName, AnyOtherString, PartialRecord, AssetName, LoaderName, PickValue, Country } from 'react-better-core';
2
+ export { AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateRandomString, getPluralWord, lightenColor, loaderControls, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
2
3
  import * as react from 'react';
3
4
  import { ComponentProps, ReactNode } from 'react';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { WebTarget } from 'styled-components';
5
7
  import { useNavigate, useLocation, useInRouterContext, useSearchParams, createSearchParams } from 'react-router-dom';
6
8
 
7
9
  type PluginName = "alerts" | "react-router-dom" | "localStorage";
@@ -22,21 +24,263 @@ type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
22
24
  ref?: React.Ref<ComponentRef>;
23
25
  };
24
26
 
25
- /** Removes the given props from type */
26
- type OmitProps<T, K extends keyof T> = Omit<T, K>;
27
- /** Removes the given options from type */
28
- type ExcludeOptions<T, K extends T> = Exclude<T, K>;
29
- /** Picks only the selected values */
30
- type PickValue<T, K extends T> = K;
31
- /** Makes all object props optional (On the root) */
32
- type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
33
- /** Makes all object props optional (On the root and nested) */
34
- type DeepPartialRecord<T> = {
35
- [K in keyof T]?: T[K] extends object ? DeepPartialRecord<T[K]> : T[K];
36
- };
37
- /** returns only the required props */
38
- type PickAllRequired<T, K extends keyof T> = Required<Pick<T, K>>;
39
- type AnyOtherString = Omit<string & {}, "">;
27
+ type ComponentStyleConfig<Subcomponents extends string> = {
28
+ [key in Subcomponents]?: ComponentStyle & ComponentHoverStyle;
29
+ };
30
+ type ComponentTagReplacementConfig<Subcomponents extends string> = {
31
+ [key in Subcomponents]?: React.ElementType;
32
+ };
33
+ type AppConfig = {
34
+ contentMaxWidth: number;
35
+ };
36
+ type BetterHtmlConfig = {
37
+ app: AppConfig;
38
+ sideMenuIsCollapsed: boolean;
39
+ sideMenuIsOpenMobile: boolean;
40
+ components: {
41
+ button?: {
42
+ style?: ComponentStyleConfig<"default" | "secondary" | "destructive" | "icon" | "upload">;
43
+ tagReplacement?: ComponentTagReplacementConfig<"buttonComponent" | "linkComponent">;
44
+ };
45
+ sideMenu?: {
46
+ /** @default 300 */
47
+ width?: number;
48
+ };
49
+ };
50
+ };
51
+
52
+ type AlertType = "info" | "success" | "warning" | "error";
53
+ type AlertDuration = number | "auto";
54
+ type AlertDisplay = "default" | "prominent";
55
+ type Alert = {
56
+ id: string;
57
+ type: AlertType;
58
+ /** @default "default" */
59
+ display?: AlertDisplay;
60
+ title?: string;
61
+ message?: string;
62
+ /** @default "auto" */
63
+ duration?: AlertDuration;
64
+ onClose?: (alert: Alert) => void;
65
+ };
66
+
67
+ type TabGroup = {
68
+ name: string;
69
+ selectedTab: string;
70
+ };
71
+ type TabsProps = {
72
+ tabs: string[];
73
+ name?: string;
74
+ accentColor?: Color;
75
+ style?: "default" | "borderRadiusTop" | "box";
76
+ onChange?: (tab: string) => void;
77
+ children?: React.ReactNode;
78
+ } & ComponentMarginProps;
79
+ type TabsRef = {
80
+ selectedTab: string;
81
+ selectTab: (tab: string) => void;
82
+ };
83
+ type TabsComponent = {
84
+ (props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
85
+ content: (props: TabsContentProps) => React.ReactElement;
86
+ };
87
+ declare const TabsComponent: TabsComponent;
88
+ type TabsContentProps = {
89
+ tab: string;
90
+ tabWithDot?: boolean;
91
+ tabsGroupName?: string;
92
+ isInitialTab?: boolean;
93
+ children?: React.ReactNode;
94
+ };
95
+ declare const Tabs: typeof TabsComponent & {
96
+ content: typeof TabsComponent.content;
97
+ };
98
+
99
+ declare const useBetterHtmlContext: () => BetterHtmlConfig & BetterCoreConfig;
100
+ declare const useAlertControls: () => {
101
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
102
+ removeAlert: (alertId: string) => void;
103
+ };
104
+ type BetterHtmlProviderInternalConfig = DeepPartialRecord<BetterHtmlConfig>;
105
+ type BetterProviderCommonProps = {
106
+ plugins?: BetterHtmlPlugin[];
107
+ children?: React.ReactNode;
108
+ };
109
+ type BetterHtmlProviderConfig = BetterCoreProviderConfig & BetterHtmlProviderInternalConfig;
110
+ type BetterHtmlProviderProps = BetterProviderCommonProps & {
111
+ config?: BetterHtmlProviderConfig;
112
+ };
113
+ declare function BetterHtmlProvider({ config, ...props }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
114
+ declare const _default$5: react.MemoExoticComponent<typeof BetterHtmlProvider>;
115
+
116
+ declare const isMobileDevice: boolean;
117
+
118
+ type BrowserName = "firefox" | "chrome" | "safari" | "edge" | "opera";
119
+
120
+ type InputFieldProps = {
121
+ label?: string;
122
+ labelColor?: string;
123
+ errorText?: string;
124
+ infoText?: string;
125
+ leftIcon?: IconName | AnyOtherString;
126
+ rightIcon?: IconName | AnyOtherString;
127
+ prefix?: React.ReactNode;
128
+ prefixBackgroundColor?: string;
129
+ suffix?: React.ReactNode;
130
+ suffixBackgroundColor?: string;
131
+ insideInputFieldBeforeComponent?: React.ReactNode;
132
+ insideInputFieldAfterComponent?: React.ReactNode;
133
+ /** @default false */
134
+ withDebounce?: boolean;
135
+ /** @default 0.5s */
136
+ debounceDelay?: number;
137
+ onChangeValue?: (value: string) => void;
138
+ onClickRightIcon?: () => void;
139
+ holderRef?: React.ForwardedRef<HTMLDivElement>;
140
+ } & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
141
+ type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
142
+ type InputFieldComponentType = {
143
+ (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
144
+ multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
145
+ email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
146
+ password: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "autoComplete"> & {
147
+ /** @default "current-password" */
148
+ autoComplete?: React.ComponentProps<"input">["autoComplete"];
149
+ }>) => React.ReactElement;
150
+ search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
151
+ phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
152
+ date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
153
+ minDate?: Date;
154
+ maxDate?: Date;
155
+ }>) => React.ReactElement;
156
+ dateTime: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
157
+ minDate?: Date;
158
+ maxDate?: Date;
159
+ /** @default today */
160
+ defaultDateAfterTimePick?: `${number}-${number}-${number}`;
161
+ /** @default "00:00" */
162
+ defaultTimeAfterDatePick?: `${number}:${number}`;
163
+ }>) => React.ReactElement;
164
+ time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
165
+ color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
166
+ };
167
+ declare const InputFieldComponent: InputFieldComponentType;
168
+ declare const InputField: typeof InputFieldComponent & {
169
+ multiline: typeof InputFieldComponent.multiline;
170
+ email: typeof InputFieldComponent.email;
171
+ password: typeof InputFieldComponent.password;
172
+ search: typeof InputFieldComponent.search;
173
+ phoneNumber: typeof InputFieldComponent.phoneNumber;
174
+ date: typeof InputFieldComponent.date;
175
+ dateTime: typeof InputFieldComponent.dateTime;
176
+ time: typeof InputFieldComponent.time;
177
+ color: typeof InputFieldComponent.color;
178
+ };
179
+
180
+ type ToggleInputRef = {};
181
+ type InternalToggleInputProps<Value> = {
182
+ label?: string;
183
+ labelColor?: string;
184
+ text?: string;
185
+ textAdvanced?: React.ReactNode;
186
+ errorText?: string;
187
+ infoText?: string;
188
+ value?: Value;
189
+ onChange?: (checked: boolean, value?: Value) => void;
190
+ } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange"> & ComponentStyle & ComponentHoverStyle;
191
+ type ToggleInputProps<Value> = ComponentPropWithRef<ToggleInputRef, OmitProps<InternalToggleInputProps<Value>, "type">>;
192
+ type ToggleInputComponentType = <Value>(props: ToggleInputProps<Value>) => React.ReactElement;
193
+ declare const _default$4: {
194
+ checkbox: ToggleInputComponentType;
195
+ radiobutton: ToggleInputComponentType;
196
+ switch: ToggleInputComponentType;
197
+ };
198
+
199
+ declare function usePageResize(): {
200
+ width: number;
201
+ height: number;
202
+ };
203
+ declare function usePageScroll(): {
204
+ scrollX: number;
205
+ scrollY: number;
206
+ };
207
+ declare function useMediaQuery(): {
208
+ screenWidth: number;
209
+ size320: boolean;
210
+ size400: boolean;
211
+ size500: boolean;
212
+ size600: boolean;
213
+ size700: boolean;
214
+ size800: boolean;
215
+ size900: boolean;
216
+ size1000: boolean;
217
+ size1100: boolean;
218
+ size1200: boolean;
219
+ size1300: boolean;
220
+ size1400: boolean;
221
+ size1500: boolean;
222
+ size1600: boolean;
223
+ };
224
+ type FormFieldValue = string | number | boolean;
225
+ declare function useForm<FormFields extends Record<string | number, FormFieldValue | FormFieldValue[] | undefined>>(options: {
226
+ defaultValues: FormFields;
227
+ requiredFields?: (keyof FormFields)[];
228
+ onSubmit?: (values: FormFields) => void | Promise<void>;
229
+ validate?: (values: FormFields) => PartialRecord<keyof FormFields, string>;
230
+ }): {
231
+ values: FormFields;
232
+ errors: Partial<Record<keyof FormFields, string>>;
233
+ isSubmitting: boolean;
234
+ setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
235
+ setFieldsValue: (values: Partial<FormFields>) => void;
236
+ getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLInputElement, InputFieldProps>;
237
+ getTextAreaProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>;
238
+ getDropdownFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => any;
239
+ getCheckboxProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
240
+ getRadioButtonProps: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName]) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
241
+ getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
242
+ focusField: (field: keyof FormFields) => void;
243
+ inputFieldRefs: Record<keyof FormFields, HTMLInputElement | undefined>;
244
+ textAreaRefs: Record<keyof FormFields, HTMLTextAreaElement | undefined>;
245
+ dropdownRefs: Record<keyof FormFields, HTMLDivElement | undefined>;
246
+ toggleInputRefs: Record<keyof FormFields, ToggleInputRef | undefined>;
247
+ validate: () => {};
248
+ onSubmit: (event?: React.FormEvent<HTMLFormElement>) => Promise<void>;
249
+ reset: () => void;
250
+ requiredFields: (keyof FormFields)[] | undefined;
251
+ isDirty: boolean;
252
+ isValid: boolean;
253
+ canSubmit: boolean;
254
+ };
255
+ declare function useUrlQuery(): {
256
+ setQuery: (query: Record<string, string | number>, keepHistory?: boolean) => void;
257
+ getQuery: (name: string) => string | null;
258
+ removeQuery: (name: string, keepHistory?: boolean) => void;
259
+ };
260
+
261
+ declare const getBrowser: () => BrowserName | undefined;
262
+ declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
263
+
264
+ declare const alertControls: {
265
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
266
+ removeAlert: (alertId: string) => void;
267
+ };
268
+ declare const sideMenuControls: {
269
+ expand: () => void;
270
+ collapse: () => void;
271
+ toggleExpanded: () => void;
272
+ open: () => void;
273
+ close: () => void;
274
+ toggleOpened: () => void;
275
+ };
276
+ declare const filterHover: () => Record<"z05" | "z1" | "z2" | "z3", React.CSSProperties["filter"]>;
277
+
278
+ declare function generateLocalStorage<LocalStorage extends object>(): {
279
+ setItem: <StorageName extends keyof LocalStorage>(name: StorageName, value: LocalStorage[StorageName]) => void;
280
+ getItem: <StorageName extends keyof LocalStorage>(name: StorageName) => LocalStorage[StorageName] | undefined;
281
+ removeItem: (name: keyof LocalStorage) => void;
282
+ removeAllItems: () => void;
283
+ };
40
284
 
41
285
  type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label";
42
286
  type TextProps<As extends TextAs = "p"> = {
@@ -56,8 +300,12 @@ declare const Text: typeof TextComponent & {
56
300
  };
57
301
 
58
302
  type PageHeaderProps = {
303
+ icon?: IconName | AnyOtherString;
304
+ image?: AssetName | AnyOtherString;
59
305
  imageUrl?: string;
60
306
  imageSize?: number;
307
+ /** @default false */
308
+ imageAzProfileImage?: boolean;
61
309
  title?: string;
62
310
  /** @default "h1" */
63
311
  titleAs?: TextAs;
@@ -111,26 +359,6 @@ declare const Div: typeof DivComponent & {
111
359
  box: typeof DivComponent.box;
112
360
  };
113
361
 
114
- type Color = `#${string}` | "transparent";
115
- type ColorName = "textPrimary" | "textSecondary" | "textLink" | "label" | "primary" | "secondary" | "accent" | "success" | "info" | "warn" | "error" | "base" | "backgroundBase" | "backgroundSecondary" | "backgroundContent" | "border";
116
- type ColorTheme = "light" | "dark";
117
- type Styles = {
118
- space: number;
119
- gap: number;
120
- borderRadius: number;
121
- fontFamily: string;
122
- transition: string;
123
- };
124
- type Colors = Record<ColorName, Color>;
125
- type Theme = {
126
- styles: Styles;
127
- colors: Colors;
128
- };
129
- type ThemeConfig = {
130
- styles: Styles;
131
- colors: Record<ColorTheme, Colors>;
132
- };
133
-
134
362
  type LoaderProps = {
135
363
  /** @default textPrimary */
136
364
  color?: Color;
@@ -162,18 +390,6 @@ declare const Loader: typeof LoaderComponent & {
162
390
  text: typeof LoaderComponent.text;
163
391
  };
164
392
 
165
- type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "chevronLeft" | "chevronRight" | "doubleChevronLeft" | "doubleChevronRight" | "eye" | "eyeDashed" | "magnifyingGlass" | "check" | "infoI" | "warningTriangle" | "filter";
166
- type IconData = {
167
- width: number;
168
- height: number;
169
- paths: (React.ComponentProps<"path"> & {
170
- type: "fill" | "stroke";
171
- })[];
172
- };
173
- type IconsConfig = Record<IconName, IconData> & {
174
- [key: string]: IconData;
175
- };
176
-
177
393
  type IconProps = {
178
394
  name: IconName | AnyOtherString;
179
395
  /** @default 16 */
@@ -182,12 +398,7 @@ type IconProps = {
182
398
  type IconComponent = {
183
399
  (props: ComponentPropWithRef<SVGSVGElement, IconProps>): React.ReactElement;
184
400
  };
185
- declare const _default$5: IconComponent;
186
-
187
- type AssetName = "logo";
188
- type AssetsConfig = Record<AssetName, string> & {
189
- [key: string]: string;
190
- };
401
+ declare const _default$3: IconComponent;
191
402
 
192
403
  type ImageProps = {
193
404
  name?: AssetName | AnyOtherString;
@@ -202,15 +413,10 @@ type ImageComponent = {
202
413
  }>) => React.ReactElement;
203
414
  };
204
415
  declare const Image: ImageComponent;
205
- declare const _default$4: ImageComponent & {
416
+ declare const _default$2: ImageComponent & {
206
417
  profileImage: typeof Image.profileImage;
207
418
  };
208
419
 
209
- type LoaderName = "";
210
- type LoaderConfig = Record<LoaderName, boolean | undefined> & {
211
- [key: string]: boolean | undefined;
212
- };
213
-
214
420
  type ButtonProps<Value> = {
215
421
  text?: string;
216
422
  value?: Value;
@@ -290,7 +496,7 @@ type DividerComponentType = {
290
496
  vertical: (props: ComponentPropWithRef<HTMLDivElement, VerticalDividerProps>) => React.ReactElement;
291
497
  horizontal: (props: ComponentPropWithRef<HTMLDivElement, HorizontalDividerProps>) => React.ReactElement;
292
498
  };
293
- declare const _default$3: {
499
+ declare const _default$1: {
294
500
  vertical: DividerComponentType["vertical"];
295
501
  horizontal: DividerComponentType["horizontal"];
296
502
  };
@@ -302,10 +508,12 @@ type ModalProps = {
302
508
  * @default 30% smaller than app.contentMaxWidth
303
509
  * */
304
510
  maxWidth?: number;
511
+ icon?: IconName | AnyOtherString;
305
512
  title?: string;
306
513
  titleColor?: React.CSSProperties["color"];
307
514
  description?: string;
308
515
  descriptionColor?: React.CSSProperties["color"];
516
+ headerTextAlign?: PickValue<NonNullable<React.CSSProperties["textAlign"]>, "left" | "center">;
309
517
  headerBackgroundColor?: React.CSSProperties["backgroundColor"];
310
518
  backgroundColor?: React.CSSProperties["backgroundColor"];
311
519
  /** @requires ReactRouterDomPlugin */
@@ -348,125 +556,57 @@ declare const Modal: typeof ModalComponent & {
348
556
  destructive: typeof ModalComponent.destructive;
349
557
  };
350
558
 
351
- type PageHolderProps = {
352
- /** @default false */
353
- noMaxContentWidth?: boolean;
354
- backgroundColor?: React.CSSProperties["backgroundColor"];
355
- backgroundImage?: React.CSSProperties["backgroundImage"];
356
- children?: React.ReactNode;
357
- } & ComponentPaddingProps;
358
- type PageHolderComponentType = {
359
- (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps>): React.ReactElement;
360
- center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
361
- pageBackgroundColor?: React.CSSProperties["backgroundColor"];
362
- pageBackgroundImage?: React.CSSProperties["backgroundImage"];
363
- contentMaxWidth?: React.CSSProperties["maxWidth"];
364
- /** @default true */
365
- contentInsideBox?: boolean;
366
- behindComponent?: React.ReactNode;
367
- sideComponent?: React.ReactNode;
368
- /** @default "right" */
369
- sideComponentPosition?: "left" | "right";
370
- }>) => React.ReactElement;
371
- };
372
- declare const PageHolderComponent: PageHolderComponentType;
373
- declare const PageHolder: typeof PageHolderComponent & {
374
- center: typeof PageHolderComponent.center;
375
- };
376
-
377
- type ChipProps<Value = unknown> = {
378
- text: string;
379
- /** @default theme.colors.textPrimary */
380
- color?: string;
381
- /** @default backgroundSecondary */
382
- backgroundColor?: string;
383
- /** @default theme.styles.borderRadius / 1.3 */
384
- borderRadius?: number;
385
- /** @default false */
386
- isCircle?: boolean;
387
- value?: Value;
388
- onClick?: (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => void;
389
- onClickWithValue?: (value: Value) => void;
390
- } & Pick<DivProps, "border" | "borderColor" | "borderWidth" | "borderStyle"> & Pick<TextProps, "fontFamily" | "fontSize" | "fontWeight" | "fontStyle">;
391
- type ChipComponentType = {
392
- <Value>(props: ComponentPropWithRef<HTMLDivElement, ChipProps<Value>>): React.ReactElement;
393
- colored: <Value>(props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps<Value>, "color" | "backgroundColor"> & {
394
- color?: string;
395
- /** @default false */
396
- withWhiteBackground?: boolean;
397
- }>) => React.ReactElement;
398
- };
399
- declare const ChipComponent: ChipComponentType;
400
- declare const Chip: typeof ChipComponent & {
401
- colored: typeof ChipComponent.colored;
402
- };
403
-
404
- type InputFieldProps = {
405
- label?: string;
406
- labelColor?: string;
407
- errorText?: string;
408
- infoText?: string;
409
- leftIcon?: IconName | AnyOtherString;
410
- rightIcon?: IconName | AnyOtherString;
411
- prefix?: React.ReactNode;
412
- prefixBackgroundColor?: string;
413
- suffix?: React.ReactNode;
414
- suffixBackgroundColor?: string;
415
- insideInputFieldBeforeComponent?: React.ReactNode;
416
- insideInputFieldAfterComponent?: React.ReactNode;
417
- /** @default false */
418
- withDebounce?: boolean;
419
- /** @default 0.5s */
420
- debounceDelay?: number;
421
- onChangeValue?: (value: string) => void;
422
- onClickRightIcon?: () => void;
423
- holderRef?: React.ForwardedRef<HTMLDivElement>;
424
- } & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
425
- type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
426
- type InputFieldComponentType = {
427
- (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
428
- multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
429
- email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
430
- password: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "autoComplete"> & {
431
- /** @default "current-password" */
432
- autoComplete?: React.ComponentProps<"input">["autoComplete"];
433
- }>) => React.ReactElement;
434
- search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
435
- phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
436
- date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
437
- minDate?: Date;
438
- maxDate?: Date;
439
- }>) => React.ReactElement;
440
- dateTime: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
441
- minDate?: Date;
442
- maxDate?: Date;
443
- /** @default today */
444
- defaultDateAfterTimePick?: `${number}-${number}-${number}`;
445
- /** @default "00:00" */
446
- defaultTimeAfterDatePick?: `${number}:${number}`;
559
+ type PageHolderProps = {
560
+ /** @default false */
561
+ noMaxContentWidth?: boolean;
562
+ backgroundColor?: React.CSSProperties["backgroundColor"];
563
+ backgroundImage?: React.CSSProperties["backgroundImage"];
564
+ children?: React.ReactNode;
565
+ } & ComponentPaddingProps;
566
+ type PageHolderComponentType = {
567
+ (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps>): React.ReactElement;
568
+ center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
569
+ pageBackgroundColor?: React.CSSProperties["backgroundColor"];
570
+ pageBackgroundImage?: React.CSSProperties["backgroundImage"];
571
+ contentMaxWidth?: React.CSSProperties["maxWidth"];
572
+ /** @default true */
573
+ contentInsideBox?: boolean;
574
+ behindComponent?: React.ReactNode;
575
+ sideComponent?: React.ReactNode;
576
+ /** @default "right" */
577
+ sideComponentPosition?: "left" | "right";
447
578
  }>) => React.ReactElement;
448
- time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
449
- color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
450
579
  };
451
- declare const InputFieldComponent: InputFieldComponentType;
452
- declare const InputField: typeof InputFieldComponent & {
453
- multiline: typeof InputFieldComponent.multiline;
454
- email: typeof InputFieldComponent.email;
455
- password: typeof InputFieldComponent.password;
456
- search: typeof InputFieldComponent.search;
457
- phoneNumber: typeof InputFieldComponent.phoneNumber;
458
- date: typeof InputFieldComponent.date;
459
- dateTime: typeof InputFieldComponent.dateTime;
460
- time: typeof InputFieldComponent.time;
461
- color: typeof InputFieldComponent.color;
580
+ declare const PageHolderComponent: PageHolderComponentType;
581
+ declare const PageHolder: typeof PageHolderComponent & {
582
+ center: typeof PageHolderComponent.center;
462
583
  };
463
584
 
464
- type Country = {
465
- code: string;
466
- name: string;
467
- timeZone: string;
468
- phoneNumberExtension: string;
469
- phoneNumberFormat?: string;
585
+ type ChipProps<Value = unknown> = {
586
+ text: string;
587
+ /** @default theme.colors.textPrimary */
588
+ color?: string;
589
+ /** @default backgroundSecondary */
590
+ backgroundColor?: string;
591
+ /** @default theme.styles.borderRadius / 1.3 */
592
+ borderRadius?: number;
593
+ /** @default false */
594
+ isCircle?: boolean;
595
+ value?: Value;
596
+ onClick?: (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => void;
597
+ onClickWithValue?: (value: Value) => void;
598
+ } & Pick<DivProps, "border" | "borderColor" | "borderWidth" | "borderStyle"> & Pick<TextProps, "fontFamily" | "fontSize" | "fontWeight" | "fontStyle">;
599
+ type ChipComponentType = {
600
+ <Value>(props: ComponentPropWithRef<HTMLDivElement, ChipProps<Value>>): React.ReactElement;
601
+ colored: <Value>(props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps<Value>, "color" | "backgroundColor"> & {
602
+ color?: string;
603
+ /** @default false */
604
+ withWhiteBackground?: boolean;
605
+ }>) => React.ReactElement;
606
+ };
607
+ declare const ChipComponent: ChipComponentType;
608
+ declare const Chip: typeof ChipComponent & {
609
+ colored: typeof ChipComponent.colored;
470
610
  };
471
611
 
472
612
  type DropdownOption<Value, Data = unknown> = {
@@ -535,97 +675,6 @@ declare const Dropdown: typeof DropdownComponent & {
535
675
  countries: typeof DropdownComponent.countries;
536
676
  };
537
677
 
538
- type ToggleInputRef = {};
539
- type InternalToggleInputProps<Value> = {
540
- label?: string;
541
- labelColor?: string;
542
- text?: string;
543
- textAdvanced?: React.ReactNode;
544
- errorText?: string;
545
- infoText?: string;
546
- value?: Value;
547
- onChange?: (checked: boolean, value?: Value) => void;
548
- } & OmitProps<React.ComponentProps<"input">, "style" | "value" | "ref" | "onChange"> & ComponentStyle & ComponentHoverStyle;
549
- type ToggleInputProps<Value> = ComponentPropWithRef<ToggleInputRef, OmitProps<InternalToggleInputProps<Value>, "type">>;
550
- type ToggleInputComponentType = <Value>(props: ToggleInputProps<Value>) => React.ReactElement;
551
- declare const _default$2: {
552
- checkbox: ToggleInputComponentType;
553
- radiobutton: ToggleInputComponentType;
554
- switch: ToggleInputComponentType;
555
- };
556
-
557
- declare function usePageResize(): {
558
- width: number;
559
- height: number;
560
- };
561
- declare function usePageScroll(): {
562
- scrollX: number;
563
- scrollY: number;
564
- };
565
- declare function useMediaQuery(): {
566
- screenWidth: number;
567
- size320: boolean;
568
- size400: boolean;
569
- size500: boolean;
570
- size600: boolean;
571
- size700: boolean;
572
- size800: boolean;
573
- size900: boolean;
574
- size1000: boolean;
575
- size1100: boolean;
576
- size1200: boolean;
577
- size1300: boolean;
578
- size1400: boolean;
579
- size1500: boolean;
580
- size1600: boolean;
581
- };
582
- declare function useBooleanState(initialValue?: boolean): [
583
- state: boolean,
584
- actions: {
585
- setState: React.Dispatch<React.SetStateAction<boolean>>;
586
- setTrue: () => void;
587
- setFalse: () => void;
588
- toggle: () => void;
589
- }
590
- ];
591
- declare function useDebounceState<Value>(initialValue: Value, delay?: number): [value: Value, debouncedValue: Value, setValue: React.Dispatch<React.SetStateAction<Value>>, isLoading: boolean];
592
- type FormFieldValue = string | number | boolean;
593
- declare function useForm<FormFields extends Record<string | number, FormFieldValue | FormFieldValue[] | undefined>>(options: {
594
- defaultValues: FormFields;
595
- requiredFields?: (keyof FormFields)[];
596
- onSubmit?: (values: FormFields) => void | Promise<void>;
597
- validate?: (values: FormFields) => PartialRecord<keyof FormFields, string>;
598
- }): {
599
- values: FormFields;
600
- errors: Partial<Record<keyof FormFields, string>>;
601
- isSubmitting: boolean;
602
- setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
603
- setFieldsValue: (values: Partial<FormFields>) => void;
604
- getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLInputElement, InputFieldProps>;
605
- getTextAreaProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>;
606
- getDropdownFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => any;
607
- getCheckboxProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
608
- getRadioButtonProps: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName]) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
609
- getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
610
- focusField: (field: keyof FormFields) => void;
611
- inputFieldRefs: Record<keyof FormFields, HTMLInputElement | undefined>;
612
- textAreaRefs: Record<keyof FormFields, HTMLTextAreaElement | undefined>;
613
- dropdownRefs: Record<keyof FormFields, HTMLDivElement | undefined>;
614
- toggleInputRefs: Record<keyof FormFields, ToggleInputRef | undefined>;
615
- validate: () => {};
616
- onSubmit: (event?: React.FormEvent<HTMLFormElement>) => Promise<void>;
617
- reset: () => void;
618
- requiredFields: (keyof FormFields)[] | undefined;
619
- isDirty: boolean;
620
- isValid: boolean;
621
- canSubmit: boolean;
622
- };
623
- declare function useUrlQuery(): {
624
- setQuery: (query: Record<string, string | number>, keepHistory?: boolean) => void;
625
- getQuery: (name: string) => string | null;
626
- removeQuery: (name: string, keepHistory?: boolean) => void;
627
- };
628
-
629
678
  type FormProps = {
630
679
  form?: OmitProps<ReturnType<typeof useForm>, "focusField">;
631
680
  name?: string;
@@ -669,7 +718,7 @@ type LabelProps = {
669
718
  htmlFor?: string;
670
719
  };
671
720
  declare function Label({ text, required, isError, color, htmlFor }: LabelProps): react_jsx_runtime.JSX.Element;
672
- declare const _default$1: react.MemoExoticComponent<typeof Label>;
721
+ declare const _default: react.MemoExoticComponent<typeof Label>;
673
722
 
674
723
  type FormRowProps = {
675
724
  oneItemOnly?: boolean;
@@ -903,38 +952,6 @@ declare const Tooltip: typeof TooltipComponent & {
903
952
  sectionTitle: typeof TooltipComponent.sectionTitle;
904
953
  };
905
954
 
906
- type TabGroup = {
907
- name: string;
908
- selectedTab: string;
909
- };
910
- type TabsProps = {
911
- tabs: string[];
912
- name?: string;
913
- accentColor?: Color;
914
- style?: "default" | "borderRadiusTop" | "box";
915
- onChange?: (tab: string) => void;
916
- children?: React.ReactNode;
917
- } & ComponentMarginProps;
918
- type TabsRef = {
919
- selectedTab: string;
920
- selectTab: (tab: string) => void;
921
- };
922
- type TabsComponent = {
923
- (props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
924
- content: (props: TabsContentProps) => React.ReactElement;
925
- };
926
- declare const TabsComponent: TabsComponent;
927
- type TabsContentProps = {
928
- tab: string;
929
- tabWithDot?: boolean;
930
- tabsGroupName?: string;
931
- isInitialTab?: boolean;
932
- children?: React.ReactNode;
933
- };
934
- declare const Tabs: typeof TabsComponent & {
935
- content: typeof TabsComponent.content;
936
- };
937
-
938
955
  type FoldableProps = {
939
956
  isOpen?: boolean;
940
957
  defaultOpen?: boolean;
@@ -1031,127 +1048,6 @@ type PaginationComponentType = {
1031
1048
  declare const PaginationComponent: PaginationComponentType;
1032
1049
  declare const Pagination: typeof PaginationComponent & {};
1033
1050
 
1034
- type AppConfig = {
1035
- contentMaxWidth: number;
1036
- };
1037
- type ComponentStyleConfig<Subcomponents extends string> = {
1038
- [key in Subcomponents]?: ComponentStyle & ComponentHoverStyle;
1039
- };
1040
- type ComponentTagReplacementConfig<Subcomponents extends string> = {
1041
- [key in Subcomponents]?: React.ElementType;
1042
- };
1043
- type BetterHtmlConfig = {
1044
- app: AppConfig;
1045
- theme: ThemeConfig;
1046
- colorTheme: ColorTheme;
1047
- icons: Partial<IconsConfig>;
1048
- assets: Partial<AssetsConfig>;
1049
- loaders: Partial<LoaderConfig>;
1050
- sideMenuIsCollapsed: boolean;
1051
- sideMenuIsOpenMobile: boolean;
1052
- components: {
1053
- button?: {
1054
- style?: ComponentStyleConfig<"default" | "secondary" | "destructive" | "icon" | "upload">;
1055
- tagReplacement?: ComponentTagReplacementConfig<"buttonComponent" | "linkComponent">;
1056
- };
1057
- sideMenu?: {
1058
- /** @default 300 */
1059
- width?: number;
1060
- };
1061
- };
1062
- };
1063
-
1064
- type AlertType = "info" | "success" | "warning" | "error";
1065
- type AlertDuration = number | "auto";
1066
- type Alert = {
1067
- id: string;
1068
- type: AlertType;
1069
- title?: string;
1070
- message?: string;
1071
- duration?: AlertDuration;
1072
- onClose?: (alert: Alert) => void;
1073
- };
1074
-
1075
- declare const useBetterHtmlContext: () => BetterHtmlConfig;
1076
- declare const useTheme: () => {
1077
- colors: Colors;
1078
- styles: Styles;
1079
- };
1080
- declare const useLoader: (loaderName?: LoaderName | AnyOtherString) => boolean;
1081
- declare const useLoaderControls: () => {
1082
- startLoading: (loaderName: LoaderName | AnyOtherString) => void;
1083
- stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
1084
- };
1085
- declare const useAlertControls: () => {
1086
- createAlert: (alert: OmitProps<Alert, "id">) => Alert;
1087
- removeAlert: (alertId: string) => void;
1088
- };
1089
- type BetterHtmlProviderConfig = DeepPartialRecord<BetterHtmlConfig>;
1090
- type BetterHtmlProviderProps = {
1091
- config?: BetterHtmlProviderConfig;
1092
- plugins?: BetterHtmlPlugin[];
1093
- children?: React.ReactNode;
1094
- };
1095
- declare function BetterHtmlProvider({ config, plugins, children }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
1096
- declare const _default: typeof BetterHtmlProvider;
1097
-
1098
- type BrowserName = "firefox" | "chrome" | "safari" | "edge" | "opera";
1099
-
1100
- declare const generateRandomString: (stringLength: number, options?: {
1101
- /** @default true */
1102
- includeCapitalLetters?: boolean;
1103
- /** @default true */
1104
- includeLowerLetters?: boolean;
1105
- /** @default true */
1106
- includeNumbers?: boolean;
1107
- /** @default 1 */
1108
- dashSections?: number;
1109
- }) => string;
1110
- declare const getBrowser: () => BrowserName | undefined;
1111
- declare const formatPhoneNumber: (phoneNumber: string) => string;
1112
- declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
1113
- declare const eventPreventDefault: (event: React.MouseEvent) => void;
1114
- declare const eventStopPropagation: (event: React.MouseEvent) => void;
1115
- declare const eventPreventStop: (event: React.MouseEvent) => void;
1116
- declare const getPluralWord: (word: string, count: number) => string;
1117
-
1118
- declare const lightenColor: (hexColor: string, amount: number) => string;
1119
- declare const darkenColor: (hexColor: string, amount: number) => string;
1120
- declare const saturateColor: (hexColor: string, amount: number) => string;
1121
- declare const desaturateColor: (hexColor: string, amount: number) => string;
1122
-
1123
- declare const loaderControls: {
1124
- startLoading: (loaderName: LoaderName | AnyOtherString) => void;
1125
- stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
1126
- };
1127
- declare const alertControls: {
1128
- createAlert: (alert: OmitProps<Alert, "id">) => Alert;
1129
- removeAlert: (alertId: string) => void;
1130
- };
1131
- declare const sideMenuControls: {
1132
- expand: () => void;
1133
- collapse: () => void;
1134
- toggleExpanded: () => void;
1135
- open: () => void;
1136
- close: () => void;
1137
- toggleOpened: () => void;
1138
- };
1139
- declare const colorThemeControls: {
1140
- toggleTheme: (theme?: ColorTheme) => void;
1141
- };
1142
- declare const filterHover: () => Record<"z05" | "z1" | "z2" | "z3", React.CSSProperties["filter"]>;
1143
-
1144
- declare function generateLocalStorage<LocalStorage extends object>(): {
1145
- setItem: <StorageName extends keyof LocalStorage>(name: StorageName, value: LocalStorage[StorageName]) => void;
1146
- getItem: <StorageName extends keyof LocalStorage>(name: StorageName) => LocalStorage[StorageName] | undefined;
1147
- removeItem: (name: keyof LocalStorage) => void;
1148
- removeAllItems: () => void;
1149
- };
1150
-
1151
- declare const countries: Country[];
1152
-
1153
- declare const isMobileDevice: boolean;
1154
-
1155
1051
  type AlertsPluginOptions = {
1156
1052
  /** @default "bottom" */
1157
1053
  position?: "top" | "bottom";
@@ -1193,4 +1089,4 @@ type LocalStoragePluginOptions = {
1193
1089
  declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
1194
1090
  declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
1195
1091
 
1196
- export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type Styles, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, filterHover, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, getPluralWord, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, sideMenuControls, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
1092
+ export { type Alert, type AlertDisplay, type AlertDuration, type AlertType, type AlertsPluginOptions, type AppConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default$5 as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, ColorThemeSwitch, type ColorThemeSwitchProps, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, Div, type DivProps, _default$1 as Divider, Dropdown, type DropdownOption, type DropdownProps, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$3 as Icon, type IconProps, _default$2 as Image, type ImageProps, InputField, type InputFieldProps, _default as Label, type LabelProps, Loader, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, Pagination, type PluginName, type ReactRouterDomPluginOptions, SideMenu, type SideMenuItem, type TabGroup, Table, type TableColumn, type TableFilterData, type TableListFilterListItem, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, _default$4 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, filterHover, generateLocalStorage, getBrowser, getFormErrorObject, isMobileDevice, localStoragePlugin, reactRouterDomPlugin, sideMenuControls, useAlertControls, useBetterHtmlContext, useForm, useMediaQuery, usePageResize, usePageScroll, useUrlQuery };