@qasa/qds-ui 0.10.0-next.12 → 0.10.0-next.13
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/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/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 +24 -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'
|
|
@@ -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'
|
|
@@ -2653,7 +2659,7 @@ interface HeadingOptions {
|
|
|
2653
2659
|
*
|
|
2654
2660
|
* @default 'md'
|
|
2655
2661
|
*/
|
|
2656
|
-
size?: HeadingSize
|
|
2662
|
+
size?: ResponsiveProp<HeadingSize>;
|
|
2657
2663
|
/**
|
|
2658
2664
|
* Sets the color of the heading
|
|
2659
2665
|
* @default 'default'
|
|
@@ -3563,7 +3569,7 @@ interface IconButtonOptions {
|
|
|
3563
3569
|
/**
|
|
3564
3570
|
* Defines the size of the button
|
|
3565
3571
|
*/
|
|
3566
|
-
size?: IconButtonSize
|
|
3572
|
+
size?: ResponsiveProp<IconButtonSize>;
|
|
3567
3573
|
/**
|
|
3568
3574
|
* Sets the style variant of the button
|
|
3569
3575
|
*/
|
|
@@ -3719,9 +3725,6 @@ declare const getSizeStyles$2: (theme: {
|
|
|
3719
3725
|
blue60: string;
|
|
3720
3726
|
blue50: string;
|
|
3721
3727
|
blue40: string;
|
|
3722
|
-
/**
|
|
3723
|
-
* Size of the label
|
|
3724
|
-
*/
|
|
3725
3728
|
blue30: string;
|
|
3726
3729
|
blue20: string;
|
|
3727
3730
|
blue10: string;
|
|
@@ -3866,7 +3869,10 @@ declare const getSizeStyles$2: (theme: {
|
|
|
3866
3869
|
lg: {
|
|
3867
3870
|
fontFamily: string;
|
|
3868
3871
|
fontWeight: string;
|
|
3869
|
-
fontSize: string;
|
|
3872
|
+
fontSize: string; /**
|
|
3873
|
+
* Sets the color of the label
|
|
3874
|
+
* @default 'default'
|
|
3875
|
+
*/
|
|
3870
3876
|
lineHeight: string;
|
|
3871
3877
|
letterSpacing: string;
|
|
3872
3878
|
fontFeatureSettings: string;
|
|
@@ -4048,7 +4054,7 @@ interface LabelOptions {
|
|
|
4048
4054
|
/**
|
|
4049
4055
|
* Size of the label
|
|
4050
4056
|
*/
|
|
4051
|
-
size?: LabelSize
|
|
4057
|
+
size?: ResponsiveProp<LabelSize>;
|
|
4052
4058
|
/**
|
|
4053
4059
|
* Sets the color of the label
|
|
4054
4060
|
* @default 'default'
|
|
@@ -4481,7 +4487,7 @@ declare const getSizeStyles$1: (theme: {
|
|
|
4481
4487
|
};
|
|
4482
4488
|
declare type LoadingDotsSize = VariantProps<typeof getSizeStyles$1>;
|
|
4483
4489
|
interface LoadingDotsOptions {
|
|
4484
|
-
size?: LoadingDotsSize
|
|
4490
|
+
size?: ResponsiveProp<LoadingDotsSize>;
|
|
4485
4491
|
}
|
|
4486
4492
|
interface LoadingDotsProps extends HTMLQdsProps<'span'>, LoadingDotsOptions {
|
|
4487
4493
|
}
|
|
@@ -4733,7 +4739,10 @@ declare const getSizeStyles: (theme: {
|
|
|
4733
4739
|
md: {
|
|
4734
4740
|
fontFamily: string;
|
|
4735
4741
|
fontWeight: string;
|
|
4736
|
-
fontSize: string;
|
|
4742
|
+
fontSize: string; /**
|
|
4743
|
+
* Sets the visual size of the text
|
|
4744
|
+
* @default 'md'
|
|
4745
|
+
*/
|
|
4737
4746
|
lineHeight: string;
|
|
4738
4747
|
letterSpacing: string;
|
|
4739
4748
|
fontFeatureSettings: string;
|
|
@@ -4929,7 +4938,7 @@ interface ParagraphOptions {
|
|
|
4929
4938
|
* Sets the visual size of the text
|
|
4930
4939
|
* @default 'md'
|
|
4931
4940
|
*/
|
|
4932
|
-
size?: ParagraphSize
|
|
4941
|
+
size?: ResponsiveProp<ParagraphSize>;
|
|
4933
4942
|
/**
|
|
4934
4943
|
* Sets the color of the text
|
|
4935
4944
|
* @default 'normal'
|
|
@@ -5129,7 +5138,7 @@ interface StackOptions {
|
|
|
5129
5138
|
* The direction of the stack.
|
|
5130
5139
|
* @default 'column'
|
|
5131
5140
|
*/
|
|
5132
|
-
direction?: FlexDirection
|
|
5141
|
+
direction?: ResponsiveProp<FlexDirection>;
|
|
5133
5142
|
/**
|
|
5134
5143
|
* The CSS `justify-content` property.
|
|
5135
5144
|
* Controls the alignment of items on the main axis.
|
|
@@ -5149,7 +5158,7 @@ interface StackOptions {
|
|
|
5149
5158
|
/**
|
|
5150
5159
|
* The gap between each child element.
|
|
5151
5160
|
*/
|
|
5152
|
-
gap?: GapProp
|
|
5161
|
+
gap?: ResponsiveProp<GapProp>;
|
|
5153
5162
|
/**
|
|
5154
5163
|
* A divider element to be rendered between each child element.
|
|
5155
5164
|
*
|