@qasa/qds-ui 0.10.0-next.12 → 0.10.0-next.14
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/avatar/avatar.d.ts +2 -1
- package/dist/cjs/types/components/button/button-types.d.ts +2 -1
- package/dist/cjs/types/components/checkbox/checkbox.d.ts +8 -0
- package/dist/cjs/types/components/display-text/display-text.d.ts +2 -1
- package/dist/cjs/types/components/heading/heading.d.ts +2 -1
- package/dist/cjs/types/components/icon-button/icon-button.d.ts +2 -1
- package/dist/cjs/types/components/label/label.d.ts +6 -5
- package/dist/cjs/types/components/loading-dots/loading-dots.d.ts +2 -1
- package/dist/cjs/types/components/paragraph/paragraph.d.ts +6 -2
- package/dist/cjs/types/components/stack/stack.d.ts +3 -2
- package/dist/cjs/types/hooks/use-responsive-prop.d.ts +16 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/avatar/avatar.d.ts +2 -1
- package/dist/esm/types/components/button/button-types.d.ts +2 -1
- package/dist/esm/types/components/checkbox/checkbox.d.ts +8 -0
- package/dist/esm/types/components/display-text/display-text.d.ts +2 -1
- package/dist/esm/types/components/heading/heading.d.ts +2 -1
- package/dist/esm/types/components/icon-button/icon-button.d.ts +2 -1
- package/dist/esm/types/components/label/label.d.ts +6 -5
- package/dist/esm/types/components/loading-dots/loading-dots.d.ts +2 -1
- package/dist/esm/types/components/paragraph/paragraph.d.ts +6 -2
- package/dist/esm/types/components/stack/stack.d.ts +3 -2
- package/dist/esm/types/hooks/use-responsive-prop.d.ts +16 -0
- package/dist/index.d.ts +32 -15
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HTMLQdsProps } from '../../types';
|
|
3
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
3
4
|
declare const SIZE_MAP: {
|
|
4
5
|
xs: number;
|
|
5
6
|
sm: number;
|
|
@@ -23,7 +24,7 @@ interface AvatarOptions {
|
|
|
23
24
|
* Size of the avatar
|
|
24
25
|
* @default 'md'
|
|
25
26
|
*/
|
|
26
|
-
size?: AvatarSize
|
|
27
|
+
size?: ResponsiveProp<AvatarSize>;
|
|
27
28
|
}
|
|
28
29
|
export interface AvatarProps extends HTMLQdsProps<'span'>, AvatarOptions {
|
|
29
30
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ElementType } from 'react';
|
|
2
2
|
import type { IconProps } from '../icon';
|
|
3
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
3
4
|
import type { ButtonSize, ButtonVariant } from './button-styles';
|
|
4
5
|
export interface ButtonOptions {
|
|
5
6
|
/**
|
|
6
7
|
* Sets the size of the button
|
|
7
8
|
* @default 'md'
|
|
8
9
|
*/
|
|
9
|
-
size?: ButtonSize
|
|
10
|
+
size?: ResponsiveProp<ButtonSize>;
|
|
10
11
|
/**
|
|
11
12
|
* Sets the style variant of the button
|
|
12
13
|
* @default 'secondary'
|
|
@@ -21,6 +21,10 @@ interface CheckboxOptions {
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
label: string | ReactElement<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Text that provides additional guidance to the user
|
|
26
|
+
*/
|
|
27
|
+
helperText?: string;
|
|
24
28
|
/**
|
|
25
29
|
* The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
|
|
26
30
|
*/
|
|
@@ -46,6 +50,10 @@ interface CheckboxOptions {
|
|
|
46
50
|
* @default false
|
|
47
51
|
*/
|
|
48
52
|
isInvalid?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The error message to display if `isInvalid` is `true`
|
|
55
|
+
*/
|
|
56
|
+
errorMessage?: string;
|
|
49
57
|
/**
|
|
50
58
|
* If `true` it prevents the user from interacting with the checkbox.
|
|
51
59
|
* @default false
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
2
2
|
import type { Theme } from '../../theme';
|
|
3
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
3
4
|
declare type DisplaySize = keyof Theme['typography']['display'];
|
|
4
5
|
declare type DisplayTextAlign = 'left' | 'center' | 'right';
|
|
5
6
|
declare type DisplayTextWrap = 'pretty' | 'balance' | 'wrap' | 'nowrap' | 'stable';
|
|
@@ -10,7 +11,7 @@ interface DisplayTextOptions {
|
|
|
10
11
|
*
|
|
11
12
|
* @default 'md'
|
|
12
13
|
*/
|
|
13
|
-
size?: DisplaySize
|
|
14
|
+
size?: ResponsiveProp<DisplaySize>;
|
|
14
15
|
/**
|
|
15
16
|
* Sets the text alignment
|
|
16
17
|
* @default 'left'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
2
2
|
import type { Theme } from '../../theme';
|
|
3
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
3
4
|
declare type HeadingSize = keyof Theme['typography']['title'];
|
|
4
5
|
declare type HeadingColor = keyof Theme['colors']['text'];
|
|
5
6
|
interface HeadingOptions {
|
|
@@ -9,7 +10,7 @@ interface HeadingOptions {
|
|
|
9
10
|
*
|
|
10
11
|
* @default 'md'
|
|
11
12
|
*/
|
|
12
|
-
size?: HeadingSize
|
|
13
|
+
size?: ResponsiveProp<HeadingSize>;
|
|
13
14
|
/**
|
|
14
15
|
* Sets the color of the heading
|
|
15
16
|
* @default 'default'
|
|
@@ -2,6 +2,7 @@ import type { ElementType } from 'react';
|
|
|
2
2
|
import type { VariantProps } from '../../styles';
|
|
3
3
|
import type { IconProps } from '../icon';
|
|
4
4
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
5
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
5
6
|
import { getSizeStyles, getVariantStyles } from './icon-button-styles';
|
|
6
7
|
declare type IconButtonSize = VariantProps<typeof getSizeStyles>;
|
|
7
8
|
declare type IconButtonVariant = VariantProps<typeof getVariantStyles>;
|
|
@@ -15,7 +16,7 @@ interface IconButtonOptions {
|
|
|
15
16
|
/**
|
|
16
17
|
* Defines the size of the button
|
|
17
18
|
*/
|
|
18
|
-
size?: IconButtonSize
|
|
19
|
+
size?: ResponsiveProp<IconButtonSize>;
|
|
19
20
|
/**
|
|
20
21
|
* Sets the style variant of the button
|
|
21
22
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VariantProps } from '../../styles';
|
|
2
2
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
3
3
|
import type { Theme } from '../../theme';
|
|
4
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
4
5
|
declare const getSizeStyles: (theme: {
|
|
5
6
|
mediaQueries: {
|
|
6
7
|
readonly smUp: "@media(min-width: 480px)";
|
|
@@ -95,9 +96,6 @@ declare const getSizeStyles: (theme: {
|
|
|
95
96
|
blue60: string;
|
|
96
97
|
blue50: string;
|
|
97
98
|
blue40: string;
|
|
98
|
-
/**
|
|
99
|
-
* Size of the label
|
|
100
|
-
*/
|
|
101
99
|
blue30: string;
|
|
102
100
|
blue20: string;
|
|
103
101
|
blue10: string;
|
|
@@ -242,7 +240,10 @@ declare const getSizeStyles: (theme: {
|
|
|
242
240
|
lg: {
|
|
243
241
|
fontFamily: string;
|
|
244
242
|
fontWeight: string;
|
|
245
|
-
fontSize: string;
|
|
243
|
+
fontSize: string; /**
|
|
244
|
+
* Sets the color of the label
|
|
245
|
+
* @default 'default'
|
|
246
|
+
*/
|
|
246
247
|
lineHeight: string;
|
|
247
248
|
letterSpacing: string;
|
|
248
249
|
fontFeatureSettings: string;
|
|
@@ -424,7 +425,7 @@ interface LabelOptions {
|
|
|
424
425
|
/**
|
|
425
426
|
* Size of the label
|
|
426
427
|
*/
|
|
427
|
-
size?: LabelSize
|
|
428
|
+
size?: ResponsiveProp<LabelSize>;
|
|
428
429
|
/**
|
|
429
430
|
* Sets the color of the label
|
|
430
431
|
* @default 'default'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { VariantProps } from '../../styles';
|
|
3
3
|
import type { HTMLQdsProps } from '../../types';
|
|
4
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
4
5
|
declare const getSizeStyles: (theme: {
|
|
5
6
|
mediaQueries: {
|
|
6
7
|
readonly smUp: "@media(min-width: 480px)";
|
|
@@ -409,7 +410,7 @@ declare const getSizeStyles: (theme: {
|
|
|
409
410
|
};
|
|
410
411
|
declare type LoadingDotsSize = VariantProps<typeof getSizeStyles>;
|
|
411
412
|
interface LoadingDotsOptions {
|
|
412
|
-
size?: LoadingDotsSize
|
|
413
|
+
size?: ResponsiveProp<LoadingDotsSize>;
|
|
413
414
|
}
|
|
414
415
|
export interface LoadingDotsProps extends HTMLQdsProps<'span'>, LoadingDotsOptions {
|
|
415
416
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VariantProps } from '../../styles';
|
|
2
2
|
import type { Theme } from '../../theme';
|
|
3
3
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
4
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
4
5
|
declare const getSizeStyles: (theme: {
|
|
5
6
|
mediaQueries: {
|
|
6
7
|
readonly smUp: "@media(min-width: 480px)";
|
|
@@ -247,7 +248,10 @@ declare const getSizeStyles: (theme: {
|
|
|
247
248
|
md: {
|
|
248
249
|
fontFamily: string;
|
|
249
250
|
fontWeight: string;
|
|
250
|
-
fontSize: string;
|
|
251
|
+
fontSize: string; /**
|
|
252
|
+
* Sets the visual size of the text
|
|
253
|
+
* @default 'md'
|
|
254
|
+
*/
|
|
251
255
|
lineHeight: string;
|
|
252
256
|
letterSpacing: string;
|
|
253
257
|
fontFeatureSettings: string;
|
|
@@ -443,7 +447,7 @@ interface ParagraphOptions {
|
|
|
443
447
|
* Sets the visual size of the text
|
|
444
448
|
* @default 'md'
|
|
445
449
|
*/
|
|
446
|
-
size?: ParagraphSize
|
|
450
|
+
size?: ResponsiveProp<ParagraphSize>;
|
|
447
451
|
/**
|
|
448
452
|
* Sets the color of the text
|
|
449
453
|
* @default 'normal'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Theme } from '../../theme';
|
|
3
3
|
import type * as Polymorphic from '../../utils/polymorphic';
|
|
4
|
+
import { type ResponsiveProp } from '../../hooks/use-responsive-prop';
|
|
4
5
|
import type { AlignItems, FlexDirection, JustifyContent, FlexWrap } from './stack.types';
|
|
5
6
|
declare type GapProp = keyof Theme['spacing'];
|
|
6
7
|
interface StackOptions {
|
|
@@ -8,7 +9,7 @@ interface StackOptions {
|
|
|
8
9
|
* The direction of the stack.
|
|
9
10
|
* @default 'column'
|
|
10
11
|
*/
|
|
11
|
-
direction?: FlexDirection
|
|
12
|
+
direction?: ResponsiveProp<FlexDirection>;
|
|
12
13
|
/**
|
|
13
14
|
* The CSS `justify-content` property.
|
|
14
15
|
* Controls the alignment of items on the main axis.
|
|
@@ -28,7 +29,7 @@ interface StackOptions {
|
|
|
28
29
|
/**
|
|
29
30
|
* The gap between each child element.
|
|
30
31
|
*/
|
|
31
|
-
gap?: GapProp
|
|
32
|
+
gap?: ResponsiveProp<GapProp>;
|
|
32
33
|
/**
|
|
33
34
|
* A divider element to be rendered between each child element.
|
|
34
35
|
*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Theme } from '../theme';
|
|
2
|
+
import { type PartialRecord } from '../types';
|
|
3
|
+
declare type Breakpoints = Theme['breakpoints'];
|
|
4
|
+
declare type BreakpointsConfig<T> = PartialRecord<keyof Breakpoints, T> & {
|
|
5
|
+
base: T;
|
|
6
|
+
};
|
|
7
|
+
export declare type ResponsiveProp<T> = T | BreakpointsConfig<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Hook for responsive props that returns correct value for current breakpoint or static value
|
|
10
|
+
* if user didn't input responsive options
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const size = useResponsiveProp({ base: 'sm', md: 'lg' })
|
|
14
|
+
*/
|
|
15
|
+
export declare function useResponsiveProp<T>(prop: ResponsiveProp<T>): T | (undefined & T);
|
|
16
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -840,6 +840,12 @@ interface QdsProviderProps {
|
|
|
840
840
|
}
|
|
841
841
|
declare function QdsProvider({ children, themeOverrides, cacheOptions, locale }: QdsProviderProps): JSX.Element;
|
|
842
842
|
|
|
843
|
+
declare type Breakpoints$1 = Theme['breakpoints'];
|
|
844
|
+
declare type BreakpointsConfig$1<T> = PartialRecord<keyof Breakpoints$1, T> & {
|
|
845
|
+
base: T;
|
|
846
|
+
};
|
|
847
|
+
declare type ResponsiveProp<T> = T | BreakpointsConfig$1<T>;
|
|
848
|
+
|
|
843
849
|
declare const SIZE_MAP: {
|
|
844
850
|
xs: number;
|
|
845
851
|
sm: number;
|
|
@@ -863,7 +869,7 @@ interface AvatarOptions {
|
|
|
863
869
|
* Size of the avatar
|
|
864
870
|
* @default 'md'
|
|
865
871
|
*/
|
|
866
|
-
size?: AvatarSize
|
|
872
|
+
size?: ResponsiveProp<AvatarSize>;
|
|
867
873
|
}
|
|
868
874
|
interface AvatarProps extends HTMLQdsProps<'span'>, AvatarOptions {
|
|
869
875
|
}
|
|
@@ -2381,7 +2387,7 @@ interface ButtonOptions {
|
|
|
2381
2387
|
* Sets the size of the button
|
|
2382
2388
|
* @default 'md'
|
|
2383
2389
|
*/
|
|
2384
|
-
size?: ButtonSize
|
|
2390
|
+
size?: ResponsiveProp<ButtonSize>;
|
|
2385
2391
|
/**
|
|
2386
2392
|
* Sets the style variant of the button
|
|
2387
2393
|
* @default 'secondary'
|
|
@@ -2431,7 +2437,7 @@ interface DisplayTextOptions {
|
|
|
2431
2437
|
*
|
|
2432
2438
|
* @default 'md'
|
|
2433
2439
|
*/
|
|
2434
|
-
size?: DisplaySize
|
|
2440
|
+
size?: ResponsiveProp<DisplaySize>;
|
|
2435
2441
|
/**
|
|
2436
2442
|
* Sets the text alignment
|
|
2437
2443
|
* @default 'left'
|
|
@@ -2469,6 +2475,10 @@ interface CheckboxOptions {
|
|
|
2469
2475
|
* ```
|
|
2470
2476
|
*/
|
|
2471
2477
|
label: string | ReactElement<unknown>;
|
|
2478
|
+
/**
|
|
2479
|
+
* Text that provides additional guidance to the user
|
|
2480
|
+
*/
|
|
2481
|
+
helperText?: string;
|
|
2472
2482
|
/**
|
|
2473
2483
|
* The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
|
|
2474
2484
|
*/
|
|
@@ -2494,6 +2504,10 @@ interface CheckboxOptions {
|
|
|
2494
2504
|
* @default false
|
|
2495
2505
|
*/
|
|
2496
2506
|
isInvalid?: boolean;
|
|
2507
|
+
/**
|
|
2508
|
+
* The error message to display if `isInvalid` is `true`
|
|
2509
|
+
*/
|
|
2510
|
+
errorMessage?: string;
|
|
2497
2511
|
/**
|
|
2498
2512
|
* If `true` it prevents the user from interacting with the checkbox.
|
|
2499
2513
|
* @default false
|
|
@@ -2653,7 +2667,7 @@ interface HeadingOptions {
|
|
|
2653
2667
|
*
|
|
2654
2668
|
* @default 'md'
|
|
2655
2669
|
*/
|
|
2656
|
-
size?: HeadingSize
|
|
2670
|
+
size?: ResponsiveProp<HeadingSize>;
|
|
2657
2671
|
/**
|
|
2658
2672
|
* Sets the color of the heading
|
|
2659
2673
|
* @default 'default'
|
|
@@ -3563,7 +3577,7 @@ interface IconButtonOptions {
|
|
|
3563
3577
|
/**
|
|
3564
3578
|
* Defines the size of the button
|
|
3565
3579
|
*/
|
|
3566
|
-
size?: IconButtonSize
|
|
3580
|
+
size?: ResponsiveProp<IconButtonSize>;
|
|
3567
3581
|
/**
|
|
3568
3582
|
* Sets the style variant of the button
|
|
3569
3583
|
*/
|
|
@@ -3719,9 +3733,6 @@ declare const getSizeStyles$2: (theme: {
|
|
|
3719
3733
|
blue60: string;
|
|
3720
3734
|
blue50: string;
|
|
3721
3735
|
blue40: string;
|
|
3722
|
-
/**
|
|
3723
|
-
* Size of the label
|
|
3724
|
-
*/
|
|
3725
3736
|
blue30: string;
|
|
3726
3737
|
blue20: string;
|
|
3727
3738
|
blue10: string;
|
|
@@ -3866,7 +3877,10 @@ declare const getSizeStyles$2: (theme: {
|
|
|
3866
3877
|
lg: {
|
|
3867
3878
|
fontFamily: string;
|
|
3868
3879
|
fontWeight: string;
|
|
3869
|
-
fontSize: string;
|
|
3880
|
+
fontSize: string; /**
|
|
3881
|
+
* Sets the color of the label
|
|
3882
|
+
* @default 'default'
|
|
3883
|
+
*/
|
|
3870
3884
|
lineHeight: string;
|
|
3871
3885
|
letterSpacing: string;
|
|
3872
3886
|
fontFeatureSettings: string;
|
|
@@ -4048,7 +4062,7 @@ interface LabelOptions {
|
|
|
4048
4062
|
/**
|
|
4049
4063
|
* Size of the label
|
|
4050
4064
|
*/
|
|
4051
|
-
size?: LabelSize
|
|
4065
|
+
size?: ResponsiveProp<LabelSize>;
|
|
4052
4066
|
/**
|
|
4053
4067
|
* Sets the color of the label
|
|
4054
4068
|
* @default 'default'
|
|
@@ -4481,7 +4495,7 @@ declare const getSizeStyles$1: (theme: {
|
|
|
4481
4495
|
};
|
|
4482
4496
|
declare type LoadingDotsSize = VariantProps<typeof getSizeStyles$1>;
|
|
4483
4497
|
interface LoadingDotsOptions {
|
|
4484
|
-
size?: LoadingDotsSize
|
|
4498
|
+
size?: ResponsiveProp<LoadingDotsSize>;
|
|
4485
4499
|
}
|
|
4486
4500
|
interface LoadingDotsProps extends HTMLQdsProps<'span'>, LoadingDotsOptions {
|
|
4487
4501
|
}
|
|
@@ -4733,7 +4747,10 @@ declare const getSizeStyles: (theme: {
|
|
|
4733
4747
|
md: {
|
|
4734
4748
|
fontFamily: string;
|
|
4735
4749
|
fontWeight: string;
|
|
4736
|
-
fontSize: string;
|
|
4750
|
+
fontSize: string; /**
|
|
4751
|
+
* Sets the visual size of the text
|
|
4752
|
+
* @default 'md'
|
|
4753
|
+
*/
|
|
4737
4754
|
lineHeight: string;
|
|
4738
4755
|
letterSpacing: string;
|
|
4739
4756
|
fontFeatureSettings: string;
|
|
@@ -4929,7 +4946,7 @@ interface ParagraphOptions {
|
|
|
4929
4946
|
* Sets the visual size of the text
|
|
4930
4947
|
* @default 'md'
|
|
4931
4948
|
*/
|
|
4932
|
-
size?: ParagraphSize
|
|
4949
|
+
size?: ResponsiveProp<ParagraphSize>;
|
|
4933
4950
|
/**
|
|
4934
4951
|
* Sets the color of the text
|
|
4935
4952
|
* @default 'normal'
|
|
@@ -5129,7 +5146,7 @@ interface StackOptions {
|
|
|
5129
5146
|
* The direction of the stack.
|
|
5130
5147
|
* @default 'column'
|
|
5131
5148
|
*/
|
|
5132
|
-
direction?: FlexDirection
|
|
5149
|
+
direction?: ResponsiveProp<FlexDirection>;
|
|
5133
5150
|
/**
|
|
5134
5151
|
* The CSS `justify-content` property.
|
|
5135
5152
|
* Controls the alignment of items on the main axis.
|
|
@@ -5149,7 +5166,7 @@ interface StackOptions {
|
|
|
5149
5166
|
/**
|
|
5150
5167
|
* The gap between each child element.
|
|
5151
5168
|
*/
|
|
5152
|
-
gap?: GapProp
|
|
5169
|
+
gap?: ResponsiveProp<GapProp>;
|
|
5153
5170
|
/**
|
|
5154
5171
|
* A divider element to be rendered between each child element.
|
|
5155
5172
|
*
|