@aic-kits/react 0.12.3 → 0.13.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/Box/StyledBox.d.ts +4 -0
- package/dist/components/Box/config.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/types.d.ts +40 -0
- package/dist/components/Input/index.d.ts +2 -53
- package/dist/components/Input/types.d.ts +54 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/SelectDropdown.d.ts +14 -0
- package/dist/components/Select/SelectDropdownItem.d.ts +13 -0
- package/dist/components/Select/SelectInputDisplay.d.ts +25 -0
- package/dist/components/Select/hooks.d.ts +18 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/types.d.ts +74 -0
- package/dist/components/Select/utils.d.ts +19 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.cjs +74 -72
- package/dist/index.js +4304 -3560
- package/dist/theme/common/spaces.d.ts +1 -1
- package/dist/theme/components/checkbox.d.ts +28 -0
- package/dist/theme/components/index.d.ts +7 -0
- package/dist/theme/components/input.d.ts +21 -6
- package/dist/theme/components/select.d.ts +68 -0
- package/package.json +2 -2
|
@@ -52,5 +52,9 @@ export declare const genBoxStyle: (theme: Theme, props: StyleProps & CSSStylePro
|
|
|
52
52
|
marginBlock?: import("csstype").Property.MarginBlock<string | number> | undefined;
|
|
53
53
|
paddingInline?: import("csstype").Property.PaddingInline<string | number> | undefined;
|
|
54
54
|
paddingBlock?: import("csstype").Property.PaddingBlock<string | number> | undefined;
|
|
55
|
+
whiteSpace?: import("csstype").Property.WhiteSpace | undefined;
|
|
56
|
+
textOverflow?: import("csstype").Property.TextOverflow | undefined;
|
|
57
|
+
overflowY?: import("csstype").Property.OverflowY | undefined;
|
|
58
|
+
overflowX?: import("csstype").Property.OverflowX | undefined;
|
|
55
59
|
};
|
|
56
60
|
export declare const StyledBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyleProps & CSSStyleProps & CustomBoxProps>> & string;
|
|
@@ -465,7 +465,7 @@ declare const config: {
|
|
|
465
465
|
readonly scale: "colors";
|
|
466
466
|
};
|
|
467
467
|
};
|
|
468
|
-
export declare const cssPropsKey: readonly ["alignContent", "alignItems", "alignSelf", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "justifyContent", "position", "top", "right", "bottom", "left", "overflow", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "opacity", "cursor", "transition", "transform", "animation", "willChange", "pointerEvents", "userSelect", "resize", "boxShadow", "textShadow", "filter", "backdropFilter", "mixBlendMode", "isolation", "zIndex", "marginInline", "marginBlock", "paddingInline", "paddingBlock", "willChange"];
|
|
468
|
+
export declare const cssPropsKey: readonly ["alignContent", "alignItems", "alignSelf", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "justifyContent", "position", "top", "right", "bottom", "left", "overflow", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "opacity", "cursor", "transition", "transform", "animation", "willChange", "pointerEvents", "userSelect", "resize", "boxShadow", "textShadow", "filter", "backdropFilter", "mixBlendMode", "isolation", "zIndex", "marginInline", "marginBlock", "paddingInline", "paddingBlock", "willChange", "whiteSpace", "textOverflow", "overflowY", "overflowX"];
|
|
469
469
|
export declare const customBoxPropsKey: readonly ["absoluteFill", "fullWidth", "fullHeight", "fw", "fh"];
|
|
470
470
|
export type ColorPropsKeyType = keyof typeof colors;
|
|
471
471
|
export type SpacePropsKeyType = keyof typeof spaces;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Color } from '../../theme';
|
|
3
|
+
import { CheckboxSize } from '../../theme/components/checkbox';
|
|
4
|
+
export interface CheckboxProps {
|
|
5
|
+
/**
|
|
6
|
+
* The label text for the checkbox.
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The state of the checkbox.
|
|
11
|
+
*/
|
|
12
|
+
checked: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback fired when the checkbox state changes.
|
|
15
|
+
*/
|
|
16
|
+
onChange: (checked: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the checkbox is disabled.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The base color scheme for the checked state.
|
|
24
|
+
* @default 'primary' (from theme)
|
|
25
|
+
*/
|
|
26
|
+
color?: Color;
|
|
27
|
+
/**
|
|
28
|
+
* The size of the checkbox and its label.
|
|
29
|
+
* @default 'md' (from theme)
|
|
30
|
+
*/
|
|
31
|
+
size?: CheckboxSize;
|
|
32
|
+
/**
|
|
33
|
+
* Additional styles to apply to the container.
|
|
34
|
+
*/
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* The test ID for targeting in tests.
|
|
38
|
+
*/
|
|
39
|
+
'data-testid'?: string;
|
|
40
|
+
}
|
|
@@ -1,54 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* The value of the input field
|
|
6
|
-
*/
|
|
7
|
-
value?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Callback when the input value changes
|
|
10
|
-
*/
|
|
11
|
-
onChange?: (text: string) => void;
|
|
12
|
-
/**
|
|
13
|
-
* The placeholder text
|
|
14
|
-
*/
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Whether the input is disabled
|
|
18
|
-
*/
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Error message to display
|
|
22
|
-
*/
|
|
23
|
-
error?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Label text to display above the input
|
|
26
|
-
*/
|
|
27
|
-
label?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Helper text to display below the input
|
|
30
|
-
*/
|
|
31
|
-
helperText?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Icon to display on the left side of the input
|
|
34
|
-
*/
|
|
35
|
-
leftIcon?: React.ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* Icon to display on the right side of the input
|
|
38
|
-
*/
|
|
39
|
-
rightIcon?: React.ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* Border color when focused
|
|
42
|
-
*/
|
|
43
|
-
borderColor?: Color;
|
|
44
|
-
/**
|
|
45
|
-
* Background color
|
|
46
|
-
*/
|
|
47
|
-
bgColor?: Color;
|
|
48
|
-
}
|
|
49
|
-
export interface InputRef {
|
|
50
|
-
focus: () => void;
|
|
51
|
-
blur: () => void;
|
|
52
|
-
value: string;
|
|
53
|
-
}
|
|
54
|
-
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
|
|
2
|
+
import { InputHandle, InputProps } from './types';
|
|
3
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputHandle>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Icon } from '@phosphor-icons/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { Color } from '../../theme';
|
|
4
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* The value of the input field
|
|
7
|
+
*/
|
|
8
|
+
value?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Callback when the input value changes
|
|
11
|
+
*/
|
|
12
|
+
onChange?: (text: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* The placeholder text
|
|
15
|
+
*/
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the input is disabled
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Error message to display
|
|
23
|
+
*/
|
|
24
|
+
error?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Label text to display above the input
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Helper text to display below the input
|
|
31
|
+
*/
|
|
32
|
+
helperText?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Icon to display on the left side of the input
|
|
35
|
+
*/
|
|
36
|
+
leftIcon?: Icon;
|
|
37
|
+
/**
|
|
38
|
+
* Icon to display on the right side of the input
|
|
39
|
+
*/
|
|
40
|
+
rightIcon?: Icon;
|
|
41
|
+
/**
|
|
42
|
+
* Border color when focused
|
|
43
|
+
*/
|
|
44
|
+
borderColor?: Color;
|
|
45
|
+
/**
|
|
46
|
+
* Background color
|
|
47
|
+
*/
|
|
48
|
+
bgColor?: Color;
|
|
49
|
+
}
|
|
50
|
+
export interface InputHandle {
|
|
51
|
+
focus: () => void;
|
|
52
|
+
blur: () => void;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SelectProps } from './types';
|
|
2
|
+
export declare const Select: <T extends string | number>({ options, value, onChange, placeholder, label, helperText, error, disabled, variant, color: colorProp, size: sizeProp, corner: cornerProp, style, "data-testid": testId, }: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SelectSize } from '../../theme/components/select';
|
|
2
|
+
import { SelectOption } from './types';
|
|
3
|
+
interface SelectDropdownProps<T extends string | number> {
|
|
4
|
+
anchorElement: HTMLElement;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
options: SelectOption<T>[];
|
|
7
|
+
onSelect: (option: SelectOption<T>) => void;
|
|
8
|
+
selectedValue?: T;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
size: SelectSize;
|
|
11
|
+
borderRadius: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function SelectDropdown<T extends string | number>({ anchorElement, isOpen, options, onSelect, selectedValue, onClose, size, borderRadius, }: SelectDropdownProps<T>): import('react').ReactPortal | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SelectSize, SelectThemeConfig } from '../../theme/components/select';
|
|
2
|
+
import { SelectOption } from './types';
|
|
3
|
+
interface SelectDropdownItemProps<T extends string | number> {
|
|
4
|
+
option: SelectOption<T>;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
onSelect: (option: SelectOption<T>) => void;
|
|
8
|
+
sizeConfig: SelectThemeConfig['sizes'][SelectSize];
|
|
9
|
+
themeSelect: SelectThemeConfig;
|
|
10
|
+
animation: SelectThemeConfig['animation'];
|
|
11
|
+
}
|
|
12
|
+
export declare function SelectDropdownItem<T extends string | number>({ option, isSelected, isDisabled, onSelect, sizeConfig, themeSelect, animation, }: SelectDropdownItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Color, BorderWidth, SelectSize, SelectThemeConfig } from '../../theme';
|
|
3
|
+
interface SelectInputDisplayProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
selectedValue?: string | number;
|
|
7
|
+
selectedOptionLabel?: string;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
handleToggle: () => void;
|
|
11
|
+
iconSizePx: number | string;
|
|
12
|
+
inputBorderRadius: string;
|
|
13
|
+
sizeConfig: SelectThemeConfig['sizes'][SelectSize];
|
|
14
|
+
animation: SelectThemeConfig['animation'];
|
|
15
|
+
currentBgColor: Color;
|
|
16
|
+
currentBorderColor: Color;
|
|
17
|
+
baseBorderWidthKey: BorderWidth;
|
|
18
|
+
insetBoxShadow: string;
|
|
19
|
+
textColor: Color;
|
|
20
|
+
iconColor: Color;
|
|
21
|
+
testId?: string;
|
|
22
|
+
setIsHovering: (isHovering: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const SelectInputDisplay: React.FC<SelectInputDisplayProps>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SelectOption } from './types';
|
|
2
|
+
interface UseSelectStateParams<T extends string | number> {
|
|
3
|
+
value?: T;
|
|
4
|
+
onChange?: (value: T) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useSelectState<T extends string | number>({ value, onChange, disabled, }: UseSelectStateParams<T>): {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
setIsOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
10
|
+
isHovering: boolean;
|
|
11
|
+
setIsHovering: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
12
|
+
selectedValue: T | undefined;
|
|
13
|
+
selectRef: import('react').RefObject<HTMLDivElement | null>;
|
|
14
|
+
handleToggle: () => void;
|
|
15
|
+
handleSelect: (option: SelectOption<T>) => void;
|
|
16
|
+
handleClose: () => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Color, SelectSize, SelectVariant } from '../../theme';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single option in the Select component.
|
|
5
|
+
*/
|
|
6
|
+
export interface SelectOption<T = string | number> {
|
|
7
|
+
value: T;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectProps<T extends string | number> {
|
|
12
|
+
/**
|
|
13
|
+
* Array of options to display.
|
|
14
|
+
*/
|
|
15
|
+
options: SelectOption<T>[];
|
|
16
|
+
/**
|
|
17
|
+
* The currently selected value.
|
|
18
|
+
*/
|
|
19
|
+
value?: T;
|
|
20
|
+
/**
|
|
21
|
+
* Callback fired when the value changes.
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (value: T) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Placeholder text when no value is selected.
|
|
26
|
+
* @default 'Select an option'
|
|
27
|
+
*/
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Label text to display above the select input.
|
|
31
|
+
*/
|
|
32
|
+
label?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Helper text to display below the select input.
|
|
35
|
+
*/
|
|
36
|
+
helperText?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Error message to display below the select input (takes precedence over helperText).
|
|
39
|
+
*/
|
|
40
|
+
error?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the select is disabled.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The visual variant of the select input.
|
|
48
|
+
* @default 'outlined'
|
|
49
|
+
*/
|
|
50
|
+
variant?: SelectVariant;
|
|
51
|
+
/**
|
|
52
|
+
* The base color scheme for the select input (affects border/background based on variant).
|
|
53
|
+
* @default 'primary' (from theme)
|
|
54
|
+
*/
|
|
55
|
+
color?: Color;
|
|
56
|
+
/**
|
|
57
|
+
* The size of the select input and its label/options.
|
|
58
|
+
* @default 'md' (from theme)
|
|
59
|
+
*/
|
|
60
|
+
size?: SelectSize;
|
|
61
|
+
/**
|
|
62
|
+
* Corner style of the select input.
|
|
63
|
+
* @default 'circle'
|
|
64
|
+
*/
|
|
65
|
+
corner?: 'circle' | 'rounded';
|
|
66
|
+
/**
|
|
67
|
+
* Additional styles to apply to the container.
|
|
68
|
+
*/
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
/**
|
|
71
|
+
* The test ID for targeting in tests.
|
|
72
|
+
*/
|
|
73
|
+
'data-testid'?: string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme, Color, BorderWidth, SelectVariant, SelectThemeConfig } from '../../theme';
|
|
2
|
+
interface SelectStyleParams {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
themeSelect: SelectThemeConfig;
|
|
5
|
+
variant: SelectVariant;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
isErrored: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
isHovering: boolean;
|
|
10
|
+
focusColor: Color;
|
|
11
|
+
}
|
|
12
|
+
interface SelectStyleResult {
|
|
13
|
+
backgroundColor: Color;
|
|
14
|
+
borderColor: Color;
|
|
15
|
+
borderWidth: BorderWidth;
|
|
16
|
+
insetBoxShadow: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function getSelectStyles({ theme, themeSelect, variant, isDisabled, isErrored, isOpen, isHovering, focusColor, }: SelectStyleParams): SelectStyleResult;
|
|
19
|
+
export {};
|