dhre-component-lib 0.8.32 → 0.9.0
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/components/Button/ButtonV2.d.ts +60 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -0
- package/dist/components/Modal/ModalV2.d.ts +25 -0
- package/dist/components/Search/SearchV2.d.ts +29 -0
- package/dist/components/Typography/Typography.d.ts +18 -2
- package/dist/index.d.ts +128 -3
- package/dist/index.esm.js +187 -48
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +188 -46
- package/dist/index.js.map +1 -1
- package/dist/theme/colors/colors.scss +62 -58
- package/package.json +71 -71
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./ButtonV2.module.scss";
|
|
3
|
+
/**
|
|
4
|
+
* `primary` / `secondary` → text buttons (Buttons/Regular)
|
|
5
|
+
* `dark` / `light` / `blur` / `outlined` → icon-only buttons (Buttons/Icon)
|
|
6
|
+
*
|
|
7
|
+
* The icon-only variants are only meaningful when `iconOnly` is true.
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonV2Variant = "primary" | "secondary" | "dark" | "light" | "blur" | "outlined";
|
|
10
|
+
/** `xsmall` is only valid in `iconOnly` mode. Text buttons stop at `small`. */
|
|
11
|
+
export type ButtonV2Size = "large" | "medium" | "small" | "xsmall";
|
|
12
|
+
export interface ButtonV2Props extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
|
13
|
+
/** Visible label. If you need richer markup, use `children` instead. Ignored when `iconOnly`. */
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Visual style.
|
|
17
|
+
* - Text buttons: `primary` (filled) | `secondary` (outlined). Defaults to `primary`.
|
|
18
|
+
* - Icon-only buttons (when `iconOnly` is true): `dark` | `light` | `blur` | `outlined`.
|
|
19
|
+
* If `iconOnly` is set and no variant is provided, defaults to `dark`.
|
|
20
|
+
*/
|
|
21
|
+
variant?: ButtonV2Variant;
|
|
22
|
+
/**
|
|
23
|
+
* Height tier.
|
|
24
|
+
* - Text buttons: large (48) / medium (40) / small (32). Defaults to `large`.
|
|
25
|
+
* - Icon-only buttons: large (64) / medium (48) / small (32) / xsmall (20).
|
|
26
|
+
*/
|
|
27
|
+
size?: ButtonV2Size;
|
|
28
|
+
/** When true, renders a spinner and blocks interaction. */
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/** Standard HTML disabled. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Stretches the button to 100% of its container, always. Ignored when `iconOnly`. */
|
|
33
|
+
fullWidth?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Text mode: stretches to 100% on viewports <= 600px (mobile-only).
|
|
36
|
+
* Icon-only mode: steps the button down to the next-smaller size on viewports <= 600px
|
|
37
|
+
* (Large → Medium, Medium → Small). Use to honor the "scales with breakpoint" spec.
|
|
38
|
+
*/
|
|
39
|
+
responsiveFullWidth?: boolean;
|
|
40
|
+
/** Optional leading icon (start-side, auto-flips in RTL). Ignored when `iconOnly`. */
|
|
41
|
+
leadIcon?: React.ReactNode;
|
|
42
|
+
/** Optional trailing icon (end-side, auto-flips in RTL). Ignored when `iconOnly`. */
|
|
43
|
+
trailIcon?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Required when `iconOnly` is true — the single icon rendered centered in the
|
|
46
|
+
* circular button. Ignored in text mode.
|
|
47
|
+
*/
|
|
48
|
+
icon?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Switches the button to icon-only mode: square, fully circular, no label.
|
|
51
|
+
* Pair with one of the icon-only variants (`dark` / `light` / `blur` / `outlined`)
|
|
52
|
+
* and pass an `aria-label` for accessibility.
|
|
53
|
+
*/
|
|
54
|
+
iconOnly?: boolean;
|
|
55
|
+
/** HTML button type. Renamed from native `type` to avoid clashing with `variant`. */
|
|
56
|
+
buttonType?: "button" | "submit" | "reset";
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const ButtonV2: React.ForwardRefExoticComponent<ButtonV2Props & React.RefAttributes<HTMLButtonElement>>;
|
|
60
|
+
export default ButtonV2;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./ModalV2.module.scss";
|
|
3
|
+
export interface ModalV2Props {
|
|
4
|
+
/** Controls modal visibility */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Callback fired when overlay or close button is clicked */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Modal heading content.
|
|
10
|
+
* Figma: H5/MEDIUM on desktop (24px / lh 32px), H6/MEDIUM on mobile (20px / lh 28px).
|
|
11
|
+
* The consumer should pass a Typography component with the correct variant.
|
|
12
|
+
*/
|
|
13
|
+
title?: React.ReactNode;
|
|
14
|
+
/** Body content rendered inside the scrollable content area */
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Close icon element (e.g. an SVG wrapped in BrandedSvg).
|
|
18
|
+
* Rendered inline in the header row alongside the title.
|
|
19
|
+
*/
|
|
20
|
+
crossIcon: React.ReactNode;
|
|
21
|
+
/** Optional extra className applied to the modal container for consumer overrides */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const ModalV2: React.FC<ModalV2Props>;
|
|
25
|
+
export default ModalV2;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SearchV2.module.scss";
|
|
3
|
+
export type SearchV2Size = "large" | "small";
|
|
4
|
+
export type SearchV2Suggestion = {
|
|
5
|
+
id: string | number;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export interface SearchV2Props<T extends SearchV2Suggestion = SearchV2Suggestion> {
|
|
9
|
+
placeholder: string;
|
|
10
|
+
searchIcon: React.ReactNode;
|
|
11
|
+
crossIcon: React.ReactNode;
|
|
12
|
+
onSearch: (query: string) => void;
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
size?: SearchV2Size;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
suggestions?: T[] | null;
|
|
18
|
+
onSelectSuggestion?: (suggestion: T | null) => void;
|
|
19
|
+
shouldShowAll?: boolean;
|
|
20
|
+
noResultFoundText?: string;
|
|
21
|
+
debounceMs?: number;
|
|
22
|
+
className?: string;
|
|
23
|
+
inputClassName?: string;
|
|
24
|
+
suggestionClassName?: string;
|
|
25
|
+
onSearchIconClick?: () => void;
|
|
26
|
+
onHandleClear?: () => void;
|
|
27
|
+
}
|
|
28
|
+
declare function SearchV2<T extends SearchV2Suggestion = SearchV2Suggestion>({ placeholder, searchIcon, crossIcon, onSearch, value: controlledValue, defaultValue, size, disabled, suggestions, onSelectSuggestion, shouldShowAll, noResultFoundText, debounceMs, className, inputClassName, suggestionClassName, onSearchIconClick, onHandleClear, }: SearchV2Props<T>): React.JSX.Element;
|
|
29
|
+
export default SearchV2;
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '../../theme/Typography/typography.scss';
|
|
3
|
+
import '../../theme/Typography/lifestyle-lib-typography.scss';
|
|
4
|
+
/**
|
|
5
|
+
* Weight values and what they mean per brand:
|
|
6
|
+
*
|
|
7
|
+
* | Prop | Meraas/DP/Nakheel | Lifestyle (Inter) |
|
|
8
|
+
* |-----------|-------------------|-------------------|
|
|
9
|
+
* | BOLD | 700 | 700 (Inter-Bold) |
|
|
10
|
+
* | SEMI_BOLD | 400 | 500 (Inter-Medium)|
|
|
11
|
+
* | MEDIUM | 300 | 500 (Inter-Light) |
|
|
12
|
+
* | REGULAR | 400 | 400 (Inter-Regular|
|
|
13
|
+
* | LIGHT | 300 | 300 (Inter-Light) |
|
|
14
|
+
*
|
|
15
|
+
* No runtime brand detection needed — CSS handles switching via body.Lifestyle class.
|
|
16
|
+
*/
|
|
17
|
+
type TypographyVariant = 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'H7' | 'H8' | 'B1' | 'B2' | 'B3' | 'B4' | 'L1' | 'L2' | 'L3';
|
|
18
|
+
type TypographyWeight = 'BOLD' | 'SEMI_BOLD' | 'MEDIUM' | 'REGULAR' | 'LIGHT';
|
|
3
19
|
interface TypographyProps {
|
|
4
|
-
variant?:
|
|
5
|
-
weight?:
|
|
20
|
+
variant?: TypographyVariant;
|
|
21
|
+
weight?: TypographyWeight;
|
|
6
22
|
children: React.ReactNode;
|
|
7
23
|
className?: string;
|
|
8
24
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,64 @@ type ButtonProps = {
|
|
|
47
47
|
};
|
|
48
48
|
declare const Button: React.FC<ButtonProps>;
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* `primary` / `secondary` → text buttons (Buttons/Regular)
|
|
52
|
+
* `dark` / `light` / `blur` / `outlined` → icon-only buttons (Buttons/Icon)
|
|
53
|
+
*
|
|
54
|
+
* The icon-only variants are only meaningful when `iconOnly` is true.
|
|
55
|
+
*/
|
|
56
|
+
type ButtonV2Variant = "primary" | "secondary" | "dark" | "light" | "blur" | "outlined";
|
|
57
|
+
/** `xsmall` is only valid in `iconOnly` mode. Text buttons stop at `small`. */
|
|
58
|
+
type ButtonV2Size = "large" | "medium" | "small" | "xsmall";
|
|
59
|
+
interface ButtonV2Props extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
|
60
|
+
/** Visible label. If you need richer markup, use `children` instead. Ignored when `iconOnly`. */
|
|
61
|
+
label?: React.ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Visual style.
|
|
64
|
+
* - Text buttons: `primary` (filled) | `secondary` (outlined). Defaults to `primary`.
|
|
65
|
+
* - Icon-only buttons (when `iconOnly` is true): `dark` | `light` | `blur` | `outlined`.
|
|
66
|
+
* If `iconOnly` is set and no variant is provided, defaults to `dark`.
|
|
67
|
+
*/
|
|
68
|
+
variant?: ButtonV2Variant;
|
|
69
|
+
/**
|
|
70
|
+
* Height tier.
|
|
71
|
+
* - Text buttons: large (48) / medium (40) / small (32). Defaults to `large`.
|
|
72
|
+
* - Icon-only buttons: large (64) / medium (48) / small (32) / xsmall (20).
|
|
73
|
+
*/
|
|
74
|
+
size?: ButtonV2Size;
|
|
75
|
+
/** When true, renders a spinner and blocks interaction. */
|
|
76
|
+
loading?: boolean;
|
|
77
|
+
/** Standard HTML disabled. */
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
/** Stretches the button to 100% of its container, always. Ignored when `iconOnly`. */
|
|
80
|
+
fullWidth?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Text mode: stretches to 100% on viewports <= 600px (mobile-only).
|
|
83
|
+
* Icon-only mode: steps the button down to the next-smaller size on viewports <= 600px
|
|
84
|
+
* (Large → Medium, Medium → Small). Use to honor the "scales with breakpoint" spec.
|
|
85
|
+
*/
|
|
86
|
+
responsiveFullWidth?: boolean;
|
|
87
|
+
/** Optional leading icon (start-side, auto-flips in RTL). Ignored when `iconOnly`. */
|
|
88
|
+
leadIcon?: React.ReactNode;
|
|
89
|
+
/** Optional trailing icon (end-side, auto-flips in RTL). Ignored when `iconOnly`. */
|
|
90
|
+
trailIcon?: React.ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Required when `iconOnly` is true — the single icon rendered centered in the
|
|
93
|
+
* circular button. Ignored in text mode.
|
|
94
|
+
*/
|
|
95
|
+
icon?: React.ReactNode;
|
|
96
|
+
/**
|
|
97
|
+
* Switches the button to icon-only mode: square, fully circular, no label.
|
|
98
|
+
* Pair with one of the icon-only variants (`dark` / `light` / `blur` / `outlined`)
|
|
99
|
+
* and pass an `aria-label` for accessibility.
|
|
100
|
+
*/
|
|
101
|
+
iconOnly?: boolean;
|
|
102
|
+
/** HTML button type. Renamed from native `type` to avoid clashing with `variant`. */
|
|
103
|
+
buttonType?: "button" | "submit" | "reset";
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
declare const ButtonV2: React.ForwardRefExoticComponent<ButtonV2Props & React.RefAttributes<HTMLButtonElement>>;
|
|
107
|
+
|
|
50
108
|
interface AvatarProps {
|
|
51
109
|
src: string;
|
|
52
110
|
alt: string;
|
|
@@ -221,9 +279,24 @@ interface OTPInputProps {
|
|
|
221
279
|
}
|
|
222
280
|
declare const OTPInput: React.FC<OTPInputProps>;
|
|
223
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Weight values and what they mean per brand:
|
|
284
|
+
*
|
|
285
|
+
* | Prop | Meraas/DP/Nakheel | Lifestyle (Inter) |
|
|
286
|
+
* |-----------|-------------------|-------------------|
|
|
287
|
+
* | BOLD | 700 | 700 (Inter-Bold) |
|
|
288
|
+
* | SEMI_BOLD | 400 | 500 (Inter-Medium)|
|
|
289
|
+
* | MEDIUM | 300 | 500 (Inter-Light) |
|
|
290
|
+
* | REGULAR | 400 | 400 (Inter-Regular|
|
|
291
|
+
* | LIGHT | 300 | 300 (Inter-Light) |
|
|
292
|
+
*
|
|
293
|
+
* No runtime brand detection needed — CSS handles switching via body.Lifestyle class.
|
|
294
|
+
*/
|
|
295
|
+
type TypographyVariant = 'H1' | 'H2' | 'H3' | 'H4' | 'H5' | 'H6' | 'H7' | 'H8' | 'B1' | 'B2' | 'B3' | 'B4' | 'L1' | 'L2' | 'L3';
|
|
296
|
+
type TypographyWeight = 'BOLD' | 'SEMI_BOLD' | 'MEDIUM' | 'REGULAR' | 'LIGHT';
|
|
224
297
|
interface TypographyProps {
|
|
225
|
-
variant?:
|
|
226
|
-
weight?:
|
|
298
|
+
variant?: TypographyVariant;
|
|
299
|
+
weight?: TypographyWeight;
|
|
227
300
|
children: React.ReactNode;
|
|
228
301
|
className?: string;
|
|
229
302
|
}
|
|
@@ -257,6 +330,33 @@ interface CustomSearchFieldProps {
|
|
|
257
330
|
}
|
|
258
331
|
declare const Search: React.FC<CustomSearchFieldProps>;
|
|
259
332
|
|
|
333
|
+
type SearchV2Size = "large" | "small";
|
|
334
|
+
type SearchV2Suggestion = {
|
|
335
|
+
id: string | number;
|
|
336
|
+
title: string;
|
|
337
|
+
};
|
|
338
|
+
interface SearchV2Props<T extends SearchV2Suggestion = SearchV2Suggestion> {
|
|
339
|
+
placeholder: string;
|
|
340
|
+
searchIcon: React.ReactNode;
|
|
341
|
+
crossIcon: React.ReactNode;
|
|
342
|
+
onSearch: (query: string) => void;
|
|
343
|
+
value?: string;
|
|
344
|
+
defaultValue?: string;
|
|
345
|
+
size?: SearchV2Size;
|
|
346
|
+
disabled?: boolean;
|
|
347
|
+
suggestions?: T[] | null;
|
|
348
|
+
onSelectSuggestion?: (suggestion: T | null) => void;
|
|
349
|
+
shouldShowAll?: boolean;
|
|
350
|
+
noResultFoundText?: string;
|
|
351
|
+
debounceMs?: number;
|
|
352
|
+
className?: string;
|
|
353
|
+
inputClassName?: string;
|
|
354
|
+
suggestionClassName?: string;
|
|
355
|
+
onSearchIconClick?: () => void;
|
|
356
|
+
onHandleClear?: () => void;
|
|
357
|
+
}
|
|
358
|
+
declare function SearchV2<T extends SearchV2Suggestion = SearchV2Suggestion>({ placeholder, searchIcon, crossIcon, onSearch, value: controlledValue, defaultValue, size, disabled, suggestions, onSelectSuggestion, shouldShowAll, noResultFoundText, debounceMs, className, inputClassName, suggestionClassName, onSearchIconClick, onHandleClear, }: SearchV2Props<T>): React.JSX.Element;
|
|
359
|
+
|
|
260
360
|
interface ModalProps {
|
|
261
361
|
isOpen: boolean;
|
|
262
362
|
onClose: () => void;
|
|
@@ -267,6 +367,29 @@ interface ModalProps {
|
|
|
267
367
|
}
|
|
268
368
|
declare const Modal: React.FC<ModalProps>;
|
|
269
369
|
|
|
370
|
+
interface ModalV2Props {
|
|
371
|
+
/** Controls modal visibility */
|
|
372
|
+
isOpen: boolean;
|
|
373
|
+
/** Callback fired when overlay or close button is clicked */
|
|
374
|
+
onClose: () => void;
|
|
375
|
+
/**
|
|
376
|
+
* Modal heading content.
|
|
377
|
+
* Figma: H5/MEDIUM on desktop (24px / lh 32px), H6/MEDIUM on mobile (20px / lh 28px).
|
|
378
|
+
* The consumer should pass a Typography component with the correct variant.
|
|
379
|
+
*/
|
|
380
|
+
title?: React.ReactNode;
|
|
381
|
+
/** Body content rendered inside the scrollable content area */
|
|
382
|
+
children: React.ReactNode;
|
|
383
|
+
/**
|
|
384
|
+
* Close icon element (e.g. an SVG wrapped in BrandedSvg).
|
|
385
|
+
* Rendered inline in the header row alongside the title.
|
|
386
|
+
*/
|
|
387
|
+
crossIcon: React.ReactNode;
|
|
388
|
+
/** Optional extra className applied to the modal container for consumer overrides */
|
|
389
|
+
className?: string;
|
|
390
|
+
}
|
|
391
|
+
declare const ModalV2: React.FC<ModalV2Props>;
|
|
392
|
+
|
|
270
393
|
type AccordionProps = {
|
|
271
394
|
icon?: React.ReactNode;
|
|
272
395
|
title: React.ReactNode;
|
|
@@ -313,6 +436,7 @@ interface DropdownProps {
|
|
|
313
436
|
searchPlaceholder?: string;
|
|
314
437
|
noResultsText?: string;
|
|
315
438
|
searchClearIcon?: React.ReactNode;
|
|
439
|
+
isLifestyle?: boolean;
|
|
316
440
|
}
|
|
317
441
|
declare function Dropdown(props: DropdownProps): React.JSX.Element;
|
|
318
442
|
|
|
@@ -432,4 +556,5 @@ interface StepperInterface {
|
|
|
432
556
|
}
|
|
433
557
|
declare const Stepper: React.FC<StepperInterface>;
|
|
434
558
|
|
|
435
|
-
export { Accordion as Accordian, Avatar, Badge, Breadcrumb as BreadCrumb, Button, ButtonCategory, Carousel, Checkbox, CircularProgress, GetDirectionAction as Directions, CustomDivider as Divider, Drawer, Dropdown, MapComponent as GoogleMap, HoverOptionsWrapper, CustomInputField as InputTextField, Link, MediaType, Menu, Modal, OTPInput as OtpInput, Progress, CustomRadioButton as RadioButton, RangeSlider, Search, Stepper, Tabs, TextArea, Toast, ToastStatus, ToggleSwitch, Typography, PdfView as default };
|
|
559
|
+
export { Accordion as Accordian, Avatar, Badge, Breadcrumb as BreadCrumb, Button, ButtonCategory, ButtonV2, Carousel, Checkbox, CircularProgress, GetDirectionAction as Directions, CustomDivider as Divider, Drawer, Dropdown, MapComponent as GoogleMap, HoverOptionsWrapper, CustomInputField as InputTextField, Link, MediaType, Menu, Modal, ModalV2, OTPInput as OtpInput, Progress, CustomRadioButton as RadioButton, RangeSlider, Search, SearchV2, Stepper, Tabs, TextArea, Toast, ToastStatus, ToggleSwitch, Typography, PdfView as default };
|
|
560
|
+
export type { ButtonV2Props, ButtonV2Size, ButtonV2Variant, ModalV2Props, SearchV2Props, SearchV2Size, SearchV2Suggestion };
|