@qasa/qds-ui 0.10.0-next.9 → 0.10.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/cjs/index.js +1322 -1322
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/_internal/form-parts.d.ts +3 -3
- package/dist/cjs/types/components/avatar/avatar.d.ts +3 -2
- package/dist/cjs/types/components/button/button-icon.d.ts +1 -1
- package/dist/cjs/types/components/button/button-styles.d.ts +4 -2
- package/dist/cjs/types/components/button/button-types.d.ts +2 -1
- package/dist/cjs/types/components/button/button.d.ts +2 -2
- package/dist/cjs/types/components/checkbox/checkbox.d.ts +9 -1
- package/dist/cjs/types/components/display-text/display-text.d.ts +7 -6
- package/dist/cjs/types/components/dropdown-menu/dropdown-menu-content.d.ts +1 -1
- package/dist/cjs/types/components/dropdown-menu/dropdown-menu-divider.d.ts +2 -2
- package/dist/cjs/types/components/dropdown-menu/dropdown-menu-trigger.d.ts +2 -2
- package/dist/cjs/types/components/dropdown-menu/dropdown-menu.d.ts +3 -3
- package/dist/cjs/types/components/heading/heading.d.ts +6 -5
- package/dist/cjs/types/components/hint-box/hint-box.d.ts +4 -4
- package/dist/cjs/types/components/icon/icon.types.d.ts +3 -3
- package/dist/cjs/types/components/icon-button/icon-button-styles.d.ts +2 -0
- package/dist/cjs/types/components/icon-button/icon-button.d.ts +6 -5
- package/dist/cjs/types/components/index.d.ts +2 -0
- package/dist/cjs/types/components/label/label.d.ts +11 -9
- package/dist/cjs/types/components/link/link.d.ts +2 -2
- package/dist/cjs/types/components/loading-dots/loading-dots.d.ts +4 -2
- package/dist/cjs/types/components/paragraph/paragraph.d.ts +11 -6
- package/dist/cjs/types/components/primitives/input-base/input-base.d.ts +1 -1
- package/dist/cjs/types/components/primitives/select-base/select-base.d.ts +1 -1
- package/dist/cjs/types/components/primitives/textarea-base/textarea-base.d.ts +3 -3
- package/dist/cjs/types/components/radio-group/radio-group-context.d.ts +1 -1
- package/dist/cjs/types/components/radio-group/radio-group-label.d.ts +2 -2
- package/dist/cjs/types/components/radio-group/radio-group.d.ts +1 -1
- package/dist/cjs/types/components/radio-group/radio-indicator.d.ts +1 -1
- package/dist/cjs/types/components/select/select-option.d.ts +1 -1
- package/dist/cjs/types/components/select/select.d.ts +1 -1
- package/dist/cjs/types/components/spacer/spacer.d.ts +2 -1
- package/dist/cjs/types/components/stack/stack.d.ts +6 -5
- package/dist/cjs/types/components/stack/stack.types.d.ts +4 -4
- package/dist/cjs/types/components/switch/index.d.ts +1 -0
- package/dist/cjs/types/components/switch/switch.d.ts +35 -0
- package/dist/cjs/types/components/text-field/text-field.d.ts +1 -1
- package/dist/cjs/types/components/textarea/textarea.d.ts +1 -1
- package/dist/cjs/types/components/toast/toast-provider.d.ts +1 -1
- package/dist/cjs/types/components/toast/toast-store.d.ts +2 -2
- package/dist/cjs/types/components/toast/toast-styles.d.ts +2 -1
- package/dist/cjs/types/components/toast/toast.d.ts +2 -3
- package/dist/cjs/types/hooks/use-breakpoint-value.d.ts +3 -3
- package/dist/cjs/types/hooks/use-form-field.d.ts +4 -4
- package/dist/cjs/types/hooks/use-image.d.ts +1 -1
- package/dist/cjs/types/hooks/use-responsive-prop.d.ts +16 -0
- package/dist/cjs/types/i18n/locale-context.d.ts +1 -1
- package/dist/cjs/types/i18n/locales.d.ts +1 -1
- package/dist/cjs/types/i18n/use-translation.d.ts +1 -1
- package/dist/cjs/types/qds-provider.d.ts +1 -1
- package/dist/cjs/types/styles/common-styles.d.ts +1 -0
- package/dist/cjs/types/styles/css-reset.d.ts +1 -2
- package/dist/cjs/types/styles/css-utils.d.ts +3 -3
- package/dist/cjs/types/styles/global-styles.d.ts +1 -2
- package/dist/cjs/types/theme/foundations/index.d.ts +1 -0
- package/dist/cjs/types/theme/foundations/radius.d.ts +3 -1
- package/dist/cjs/types/theme/theme-tools.d.ts +3 -2
- package/dist/cjs/types/theme/theme.d.ts +2 -1
- package/dist/cjs/types/types.d.ts +4 -4
- package/dist/cjs/types/utils/html-attributes.d.ts +1 -1
- package/dist/cjs/types/utils/merge-refs.d.ts +2 -2
- package/dist/cjs/types/utils/polymorphic.d.ts +4 -4
- package/dist/esm/index.js +1322 -1322
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/_internal/form-parts.d.ts +3 -3
- package/dist/esm/types/components/avatar/avatar.d.ts +3 -2
- package/dist/esm/types/components/button/button-icon.d.ts +1 -1
- package/dist/esm/types/components/button/button-styles.d.ts +4 -2
- package/dist/esm/types/components/button/button-types.d.ts +2 -1
- package/dist/esm/types/components/button/button.d.ts +2 -2
- package/dist/esm/types/components/checkbox/checkbox.d.ts +9 -1
- package/dist/esm/types/components/display-text/display-text.d.ts +7 -6
- package/dist/esm/types/components/dropdown-menu/dropdown-menu-content.d.ts +1 -1
- package/dist/esm/types/components/dropdown-menu/dropdown-menu-divider.d.ts +2 -2
- package/dist/esm/types/components/dropdown-menu/dropdown-menu-trigger.d.ts +2 -2
- package/dist/esm/types/components/dropdown-menu/dropdown-menu.d.ts +3 -3
- package/dist/esm/types/components/heading/heading.d.ts +6 -5
- package/dist/esm/types/components/hint-box/hint-box.d.ts +4 -4
- package/dist/esm/types/components/icon/icon.types.d.ts +3 -3
- package/dist/esm/types/components/icon-button/icon-button-styles.d.ts +2 -0
- package/dist/esm/types/components/icon-button/icon-button.d.ts +6 -5
- package/dist/esm/types/components/index.d.ts +2 -0
- package/dist/esm/types/components/label/label.d.ts +11 -9
- package/dist/esm/types/components/link/link.d.ts +2 -2
- package/dist/esm/types/components/loading-dots/loading-dots.d.ts +4 -2
- package/dist/esm/types/components/paragraph/paragraph.d.ts +11 -6
- package/dist/esm/types/components/primitives/input-base/input-base.d.ts +1 -1
- package/dist/esm/types/components/primitives/select-base/select-base.d.ts +1 -1
- package/dist/esm/types/components/primitives/textarea-base/textarea-base.d.ts +3 -3
- package/dist/esm/types/components/radio-group/radio-group-context.d.ts +1 -1
- package/dist/esm/types/components/radio-group/radio-group-label.d.ts +2 -2
- package/dist/esm/types/components/radio-group/radio-group.d.ts +1 -1
- package/dist/esm/types/components/radio-group/radio-indicator.d.ts +1 -1
- package/dist/esm/types/components/select/select-option.d.ts +1 -1
- package/dist/esm/types/components/select/select.d.ts +1 -1
- package/dist/esm/types/components/spacer/spacer.d.ts +2 -1
- package/dist/esm/types/components/stack/stack.d.ts +6 -5
- package/dist/esm/types/components/stack/stack.types.d.ts +4 -4
- package/dist/esm/types/components/switch/index.d.ts +1 -0
- package/dist/esm/types/components/switch/switch.d.ts +35 -0
- package/dist/esm/types/components/text-field/text-field.d.ts +1 -1
- package/dist/esm/types/components/textarea/textarea.d.ts +1 -1
- package/dist/esm/types/components/toast/toast-provider.d.ts +1 -1
- package/dist/esm/types/components/toast/toast-store.d.ts +2 -2
- package/dist/esm/types/components/toast/toast-styles.d.ts +2 -1
- package/dist/esm/types/components/toast/toast.d.ts +2 -3
- package/dist/esm/types/hooks/use-breakpoint-value.d.ts +3 -3
- package/dist/esm/types/hooks/use-form-field.d.ts +4 -4
- package/dist/esm/types/hooks/use-image.d.ts +1 -1
- package/dist/esm/types/hooks/use-responsive-prop.d.ts +16 -0
- package/dist/esm/types/i18n/locale-context.d.ts +1 -1
- package/dist/esm/types/i18n/locales.d.ts +1 -1
- package/dist/esm/types/i18n/use-translation.d.ts +1 -1
- package/dist/esm/types/qds-provider.d.ts +1 -1
- package/dist/esm/types/styles/common-styles.d.ts +1 -0
- package/dist/esm/types/styles/css-reset.d.ts +1 -2
- package/dist/esm/types/styles/css-utils.d.ts +3 -3
- package/dist/esm/types/styles/global-styles.d.ts +1 -2
- package/dist/esm/types/theme/foundations/index.d.ts +1 -0
- package/dist/esm/types/theme/foundations/radius.d.ts +3 -1
- package/dist/esm/types/theme/theme-tools.d.ts +3 -2
- package/dist/esm/types/theme/theme.d.ts +2 -1
- package/dist/esm/types/types.d.ts +4 -4
- package/dist/esm/types/utils/html-attributes.d.ts +1 -1
- package/dist/esm/types/utils/merge-refs.d.ts +2 -2
- package/dist/esm/types/utils/polymorphic.d.ts +4 -4
- package/dist/index.d.ts +187 -98
- package/package.json +22 -24
|
@@ -1,14 +1,15 @@
|
|
|
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
|
+
type GapProp = keyof Theme['spacing'];
|
|
6
7
|
interface StackOptions {
|
|
7
8
|
/**
|
|
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
|
*
|
|
@@ -37,7 +38,7 @@ interface StackOptions {
|
|
|
37
38
|
*/
|
|
38
39
|
divider?: ReactNode;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
export
|
|
41
|
+
type StackComponent = Polymorphic.ForwardRefComponent<'div', StackOptions>;
|
|
42
|
+
export type StackProps = Polymorphic.PropsOf<StackComponent>;
|
|
42
43
|
export declare const Stack: StackComponent;
|
|
43
44
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export type AlignItems = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
|
2
|
+
export type JustifyContent = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
3
|
+
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
4
|
+
export type FlexWrap = 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './switch';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
3
|
+
interface SwitchOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The label for the switch
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The text that appears below the label
|
|
10
|
+
* to provide additional guidance to the user
|
|
11
|
+
*/
|
|
12
|
+
helperText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
|
|
15
|
+
*/
|
|
16
|
+
isDefaultChecked?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* If `true`, the switch will be checked
|
|
19
|
+
*/
|
|
20
|
+
isChecked?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If `true`, the switch will be disabled and
|
|
23
|
+
* cannot be interacted with
|
|
24
|
+
*/
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, indicates that the switch is required
|
|
28
|
+
*/
|
|
29
|
+
isRequired?: boolean;
|
|
30
|
+
onCheckedChange?: (isChecked: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
interface SwitchProps extends Omit<RadixSwitch.SwitchProps, 'asChild' | keyof SwitchOptions>, SwitchOptions {
|
|
33
|
+
}
|
|
34
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
export {};
|
|
@@ -25,7 +25,7 @@ interface TextFieldOptions extends InputBaseOptions {
|
|
|
25
25
|
*/
|
|
26
26
|
suffix?: string;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
type OmittedProps = 'children' | 'readOnly' | 'size';
|
|
29
29
|
export interface TextFieldProps extends Omit<HTMLQdsProps<'input'>, OmittedProps>, TextFieldOptions {
|
|
30
30
|
}
|
|
31
31
|
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -15,7 +15,7 @@ interface TextareaOptions extends TextareaBaseOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
helperText?: string;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
type OmittedProps = 'children' | 'readOnly' | 'size';
|
|
19
19
|
export interface TextareaProps extends Omit<HTMLQdsProps<'textarea'>, OmittedProps>, TextareaOptions {
|
|
20
20
|
}
|
|
21
21
|
export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToastVariant } from './toast-styles';
|
|
2
|
-
|
|
2
|
+
type Id = number | string;
|
|
3
3
|
interface Toast {
|
|
4
4
|
id: Id;
|
|
5
5
|
/**
|
|
@@ -20,7 +20,7 @@ interface ToastOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
id?: Id;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
type Subscriber = () => void;
|
|
24
24
|
declare class ToastStore {
|
|
25
25
|
toasts: Toast[];
|
|
26
26
|
subscribers: Subscriber[];
|
|
@@ -199,6 +199,7 @@ export declare const getVariantStyles: (theme: {
|
|
|
199
199
|
md: string;
|
|
200
200
|
lg: string;
|
|
201
201
|
xl: string;
|
|
202
|
+
'2xl': string;
|
|
202
203
|
full: string;
|
|
203
204
|
};
|
|
204
205
|
shadows: {
|
|
@@ -407,4 +408,4 @@ export declare const getVariantStyles: (theme: {
|
|
|
407
408
|
color: string;
|
|
408
409
|
};
|
|
409
410
|
};
|
|
410
|
-
export
|
|
411
|
+
export type ToastVariant = VariantProps<typeof getVariantStyles>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
3
2
|
import type { HTMLQdsProps } from '../../types';
|
|
4
3
|
import type { ToastVariant } from './toast-styles';
|
|
@@ -6,8 +5,8 @@ interface ToastOptions {
|
|
|
6
5
|
text: string;
|
|
7
6
|
variant?: ToastVariant;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
type OmittedProps = 'children';
|
|
10
9
|
interface ToastProps extends Omit<HTMLQdsProps<'div'>, OmittedProps>, ToastOptions {
|
|
11
10
|
}
|
|
12
|
-
export declare function Toast(props: ToastProps & ToastPrimitive.ToastProps): JSX.Element;
|
|
11
|
+
export declare function Toast(props: ToastProps & ToastPrimitive.ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Theme } from '../theme';
|
|
2
2
|
import type { PartialRecord } from '../types';
|
|
3
3
|
import type { UseBreakpointOptions } from './use-breakpoint';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type Breakpoints = Theme['breakpoints'];
|
|
5
|
+
type BreakpointsConfig<T> = PartialRecord<keyof Breakpoints, T> & {
|
|
6
6
|
base: T;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type UseBreakpointValueProps<T> = BreakpointsConfig<T>;
|
|
9
9
|
/**
|
|
10
10
|
* Hook for getting a value based on the current breakpoint.
|
|
11
11
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementType } from 'react';
|
|
2
2
|
import type { HTMLQdsProps, LegitimateAny } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type FormFieldElement = 'input' | 'select' | 'textarea';
|
|
4
|
+
type PropGetter<T extends ElementType = LegitimateAny> = (props?: HTMLQdsProps<T>) => Record<string, unknown>;
|
|
5
5
|
interface FormFieldOptions {
|
|
6
6
|
/**
|
|
7
7
|
* The label for the form field
|
|
@@ -28,8 +28,8 @@ interface FormFieldOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
isRequired?: boolean;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
export
|
|
31
|
+
type OmittedProps = 'children' | 'readOnly' | 'size';
|
|
32
|
+
export type UseFormFieldProps<T extends FormFieldElement> = Omit<HTMLQdsProps<T>, OmittedProps> & FormFieldOptions;
|
|
33
33
|
/**
|
|
34
34
|
* Custom hook that returns props for a form field's label, input, helper text and error message.
|
|
35
35
|
* Meant to be used in conjunction with the `Input`, `Select` or `Textarea` component.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLQdsProps } from '../types';
|
|
2
|
-
|
|
2
|
+
type LoadingStatus = 'loading' | 'loaded' | 'error' | 'pending';
|
|
3
3
|
export interface UseImageProps {
|
|
4
4
|
src?: string;
|
|
5
5
|
loading?: HTMLQdsProps<'img'>['loading'];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Theme } from '../theme';
|
|
2
|
+
import { type PartialRecord } from '../types';
|
|
3
|
+
type Breakpoints = Theme['breakpoints'];
|
|
4
|
+
type BreakpointsConfig<T> = PartialRecord<keyof Breakpoints, T> & {
|
|
5
|
+
base: T;
|
|
6
|
+
};
|
|
7
|
+
export 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 {};
|
|
@@ -7,6 +7,6 @@ interface LocaleProviderProps {
|
|
|
7
7
|
language: LanguageCode;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare function LocaleProvider({ language, children }: LocaleProviderProps): JSX.Element;
|
|
10
|
+
export declare function LocaleProvider({ language, children }: LocaleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare function useLocale(): LocaleContextValue;
|
|
12
12
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const SUPPORTED_LANGUAGE_CODES: readonly ["en", "sv", "fi", "fr"];
|
|
2
|
-
export
|
|
2
|
+
export type LanguageCode = (typeof SUPPORTED_LANGUAGE_CODES)[number];
|
|
3
3
|
export interface Resource {
|
|
4
4
|
close: string;
|
|
5
5
|
optional: string;
|
|
@@ -8,5 +8,5 @@ interface QdsProviderProps {
|
|
|
8
8
|
cacheOptions?: Partial<EmotionCacheOptions>;
|
|
9
9
|
locale: LanguageCode;
|
|
10
10
|
}
|
|
11
|
-
export declare function QdsProvider({ children, themeOverrides, cacheOptions, locale }: QdsProviderProps): JSX.Element;
|
|
11
|
+
export declare function QdsProvider({ children, themeOverrides, cacheOptions, locale }: QdsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSSObject } from '@emotion/react';
|
|
2
2
|
import type { Theme } from '../theme';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type NamedStyles = Record<string, CSSObject>;
|
|
4
|
+
type StyleInterpolation<T> = (theme: Theme) => T;
|
|
5
5
|
/**
|
|
6
6
|
* Creates a collection of named style rules.
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export declare function createStyleVariants<T extends NamedStyles>(styles: Style
|
|
|
10
10
|
* Create a style object. Useful for creating styles that depend on the theme.
|
|
11
11
|
*/
|
|
12
12
|
export declare function createStyle<T extends CSSObject>(styles: StyleInterpolation<T>): (theme: Theme) => T;
|
|
13
|
-
export
|
|
13
|
+
export type VariantProps<T extends ReturnType<typeof createStyle | typeof createStyleVariants>> = keyof ReturnType<T>;
|
|
14
14
|
/**
|
|
15
15
|
* Converts css `px` unit to `rem`.
|
|
16
16
|
* Assumes the root font size is 16px.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const radii: {
|
|
2
2
|
/** 0px */
|
|
3
3
|
none: string;
|
|
4
|
-
/**
|
|
4
|
+
/** 6px */
|
|
5
5
|
'2xs': string;
|
|
6
6
|
/** 8px */
|
|
7
7
|
xs: string;
|
|
@@ -13,6 +13,8 @@ export declare const radii: {
|
|
|
13
13
|
lg: string;
|
|
14
14
|
/** 32px */
|
|
15
15
|
xl: string;
|
|
16
|
+
/** 48px */
|
|
17
|
+
'2xl': string;
|
|
16
18
|
/** 9999px */
|
|
17
19
|
full: string;
|
|
18
20
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { PartialRecord } from '../types';
|
|
2
2
|
import type { Theme } from './theme';
|
|
3
|
-
|
|
3
|
+
type DeepPartial<T> = {
|
|
4
4
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
5
5
|
};
|
|
6
6
|
interface TypographyOverride {
|
|
7
7
|
fontFamily?: string;
|
|
8
8
|
fontWeight?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
type TypographyOverrides = PartialRecord<keyof Theme['typography'], TypographyOverride>;
|
|
11
11
|
export interface ThemeOverrides {
|
|
12
12
|
colors?: DeepPartial<Theme['colors']>;
|
|
13
13
|
typography?: TypographyOverrides;
|
|
@@ -401,6 +401,7 @@ export declare const overrideTheme: (overrides: ThemeOverrides) => {
|
|
|
401
401
|
md: string;
|
|
402
402
|
lg: string;
|
|
403
403
|
xl: string;
|
|
404
|
+
'2xl': string;
|
|
404
405
|
full: string;
|
|
405
406
|
};
|
|
406
407
|
shadows: {
|
|
@@ -198,6 +198,7 @@ export declare const theme: {
|
|
|
198
198
|
md: string;
|
|
199
199
|
lg: string;
|
|
200
200
|
xl: string;
|
|
201
|
+
'2xl': string;
|
|
201
202
|
full: string;
|
|
202
203
|
};
|
|
203
204
|
shadows: {
|
|
@@ -397,4 +398,4 @@ export declare const theme: {
|
|
|
397
398
|
};
|
|
398
399
|
};
|
|
399
400
|
};
|
|
400
|
-
export
|
|
401
|
+
export type Theme = typeof theme;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ElementType } from 'react';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
2
|
+
export type LegitimateAny = any;
|
|
3
|
+
export type PartialRecord<K extends string | number | symbol, T> = Partial<Record<K, T>>;
|
|
4
|
+
export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
|
|
5
|
+
export type HTMLQdsProps<T extends ElementType> = ComponentPropsWithoutRef<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type Booleanish = boolean | 'true' | 'false';
|
|
2
2
|
export declare const dataAttr: (condition: boolean | undefined) => Booleanish;
|
|
3
3
|
export declare const ariaAttr: (condition: boolean | undefined) => Booleanish;
|
|
4
4
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MutableRefObject, RefCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type ReactRef<T> = RefCallback<T> | MutableRefObject<T>;
|
|
3
|
+
type Maybe<T> = T | null | undefined;
|
|
4
4
|
export declare const mergeRefs: <T>(...refs: Maybe<ReactRef<T>>[]) => (node: T | null) => void;
|
|
5
5
|
export {};
|
|
@@ -9,12 +9,12 @@ import type { Merge } from '../types';
|
|
|
9
9
|
/**
|
|
10
10
|
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};
|
|
13
13
|
/**
|
|
14
14
|
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ? I : never;
|
|
17
|
+
type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
|
|
18
18
|
as?: E;
|
|
19
19
|
}>>;
|
|
20
20
|
interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
|
|
@@ -37,5 +37,5 @@ interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends For
|
|
|
37
37
|
/**
|
|
38
38
|
* Infers the props of a React component
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
type PropsOf<E> = E extends React.ComponentType<infer P> ? P : never;
|
|
41
41
|
export type { ForwardRefComponent, OwnProps, IntrinsicElement, PropsOf };
|