@aic-kits/react 0.29.6 → 0.29.11

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.
@@ -1,6 +1,6 @@
1
1
  import { Theme } from '../../theme';
2
2
  import { ConfigType } from './config';
3
- import { CustomBoxProps, CSSStyleProps, StyleProps } from './types';
3
+ import { CustomBoxProps, CSSStyleProps, StyleProps, BoxProps } from './types';
4
4
  export declare const getThemeValue: (theme: Theme, key: keyof StyleProps, props: StyleProps) => {
5
5
  [x: string]: import('../..').WithResponsiveValue<string>;
6
6
  } | {
@@ -9,4 +9,4 @@ export declare const getThemeValue: (theme: Theme, key: keyof StyleProps, props:
9
9
  export declare const mapStylePropToThemeValue: (theme: Theme, props: StyleProps) => {};
10
10
  export declare const configKeys: Array<keyof ConfigType>;
11
11
  export declare const genBoxStyle: (theme: Theme, props: StyleProps & CSSStyleProps & CustomBoxProps) => import('styled-components').RuleSet<object>;
12
- 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 & import('../..').WithResponsive<Pick<import('react').CSSProperties, "filter" | "opacity" | "width" | "height" | "minWidth" | "maxWidth" | "minHeight" | "maxHeight" | "display" | "alignItems" | "alignContent" | "justifyContent" | "flexWrap" | "flexDirection" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "alignSelf" | "position" | "top" | "right" | "bottom" | "left" | "overflow" | "cursor" | "transition" | "transform" | "animation" | "willChange" | "pointerEvents" | "userSelect" | "resize" | "boxShadow" | "textShadow" | "backdropFilter" | "mixBlendMode" | "isolation" | "zIndex" | "marginInline" | "marginBlock" | "paddingInline" | "paddingBlock" | "whiteSpace" | "textOverflow" | "overflowY" | "overflowX">> & CustomBoxProps>> & string;
12
+ 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 & import('../..').WithResponsive<Pick<import('react').CSSProperties, "filter" | "opacity" | "width" | "height" | "minWidth" | "maxWidth" | "minHeight" | "maxHeight" | "display" | "alignItems" | "alignContent" | "justifyContent" | "flexWrap" | "flexDirection" | "flex" | "flexGrow" | "flexShrink" | "flexBasis" | "alignSelf" | "position" | "top" | "right" | "bottom" | "left" | "overflow" | "cursor" | "transition" | "transform" | "animation" | "willChange" | "pointerEvents" | "userSelect" | "resize" | "boxShadow" | "textShadow" | "backdropFilter" | "mixBlendMode" | "isolation" | "zIndex" | "marginInline" | "marginBlock" | "paddingInline" | "paddingBlock" | "whiteSpace" | "textOverflow" | "overflowY" | "overflowX">> & CustomBoxProps & BoxProps>> & string;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, HTMLAttributes } from 'react';
1
+ import { CSSProperties, HTMLAttributes, AnchorHTMLAttributes, ElementType } from 'react';
2
2
  import { BorderWidth, Color, Radius, Space } from '../../theme';
3
3
  import { WithResponsive, WithResponsiveValue } from '../../utils';
4
4
  import { ConfigType, CSSPropsKeyType } from './config';
@@ -37,7 +37,10 @@ export interface CustomBoxProps extends WithResponsive<{
37
37
  fh?: boolean;
38
38
  }> {
39
39
  }
40
- export interface BoxHTMLProps extends HTMLAttributes<HTMLDivElement> {
40
+ /**
41
+ * Base props that are common to all Box variants
42
+ */
43
+ export interface BaseBoxProps {
41
44
  /**
42
45
  * Box's content.
43
46
  */
@@ -51,6 +54,20 @@ export interface BoxHTMLProps extends HTMLAttributes<HTMLDivElement> {
51
54
  */
52
55
  'data-testid'?: string;
53
56
  }
54
- export interface BoxProps extends StyleProps, CSSStyleProps, CustomBoxProps, BoxHTMLProps {
57
+ /**
58
+ * Complete Box component props (div by default, anchor optional)
59
+ */
60
+ export interface BoxProps extends StyleProps, CSSStyleProps, CustomBoxProps, BaseBoxProps, Omit<HTMLAttributes<HTMLElement>, keyof BaseBoxProps>, Partial<AnchorHTMLAttributes<HTMLElement>> {
61
+ /**
62
+ * Tell `Box` to render a different underlying element (e.g. `'a'`).
63
+ * By default, it renders a `<div>`.
64
+ */
65
+ as?: string | ElementType;
55
66
  }
67
+ export type BoxDivProps = Omit<BoxProps, keyof AnchorHTMLAttributes<HTMLElement>>;
68
+ export type BoxAnchorProps = BoxProps & {
69
+ as: 'a';
70
+ href: string;
71
+ };
72
+ export type BoxElementProps = BoxDivProps | BoxAnchorProps;
56
73
  export {};
@@ -2,7 +2,7 @@ import { Icon } from '@phosphor-icons/react';
2
2
  import { default as React } from 'react';
3
3
  import { ButtonCorner, ButtonSize, ButtonVariant, Color } from '../../theme';
4
4
  import { BoxProps } from '../Box';
5
- interface ButtonBaseProps extends BoxProps {
5
+ interface ButtonSpecificProps {
6
6
  /**
7
7
  * Disable state of button.
8
8
  */
@@ -57,6 +57,19 @@ interface ButtonBaseProps extends BoxProps {
57
57
  * Testing id of the component.
58
58
  */
59
59
  'data-testid'?: string;
60
+ /**
61
+ * When provided, the button will render as an anchor link (`<a>`),
62
+ * delegating the behavior to the underlying `Touchable` component.
63
+ */
64
+ href?: string;
65
+ /**
66
+ * Target attribute for the anchor tag (e.g., `_blank`). Only used when `href` is provided.
67
+ */
68
+ target?: string;
69
+ /**
70
+ * Rel attribute for the anchor tag (e.g., `noopener noreferrer`). Only used when `href` is provided.
71
+ */
72
+ rel?: string;
60
73
  }
61
74
  type ButtonContentProps = {
62
75
  icon: Icon;
@@ -65,5 +78,6 @@ type ButtonContentProps = {
65
78
  icon?: Icon;
66
79
  text: React.ReactNode;
67
80
  };
81
+ type ButtonBaseProps = BoxProps & ButtonSpecificProps;
68
82
  export type ButtonProps = ButtonBaseProps & ButtonContentProps;
69
83
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Icon } from '@phosphor-icons/react';
2
2
  import { default as React } from 'react';
3
3
  import { Color } from '../../theme';
4
- export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
4
+ interface BaseInputProps {
5
5
  /**
6
6
  * The value of the input field
7
7
  */
@@ -47,8 +47,16 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
47
47
  */
48
48
  bgColor?: Color;
49
49
  }
50
+ export type InputProps = BaseInputProps & ((Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> & {
51
+ multiline?: false;
52
+ rows?: never;
53
+ }) | (Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> & {
54
+ multiline: true;
55
+ rows?: number;
56
+ }));
50
57
  export interface InputHandle {
51
58
  focus: () => void;
52
59
  blur: () => void;
53
60
  value: string;
54
61
  }
62
+ export {};
@@ -1,2 +1,2 @@
1
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;
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, searchable, }: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,8 @@ interface SelectDropdownProps<T extends string | number> {
9
9
  onClose: () => void;
10
10
  size: SelectSize;
11
11
  borderRadius: string;
12
+ searchable?: boolean;
13
+ placeholder?: string;
12
14
  }
13
- export declare function SelectDropdown<T extends string | number>({ anchorElement, isOpen, options, onSelect, selectedValue, onClose, size, borderRadius, }: SelectDropdownProps<T>): import('react').ReactPortal | null;
15
+ export declare function SelectDropdown<T extends string | number>({ anchorElement, isOpen, options, onSelect, selectedValue, onClose, size, borderRadius, searchable, placeholder, }: SelectDropdownProps<T>): import('react').ReactPortal | null;
14
16
  export {};
@@ -71,4 +71,9 @@ export interface SelectProps<T extends string | number> {
71
71
  * The test ID for targeting in tests.
72
72
  */
73
73
  'data-testid'?: string;
74
+ /**
75
+ * Whether the select should have a search input to filter options.
76
+ * @default false
77
+ */
78
+ searchable?: boolean;
74
79
  }
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef } from 'react';
2
2
  import { TouchableProps } from './types';
3
- declare function PlainTouchable({ children, onClick, style, useScaleAnimation, useOpacityAnimation, 'data-testid': testId, ...props }: TouchableProps, ref: ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
3
+ declare function PlainTouchable({ children, onClick, style, useScaleAnimation, useOpacityAnimation, href, target, rel, 'data-testid': testId, ...props }: TouchableProps, ref: ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
4
4
  export declare const Touchable: (props: TouchableProps & {
5
5
  ref?: ForwardedRef<HTMLDivElement>;
6
6
  }) => ReturnType<typeof PlainTouchable>;
@@ -1,14 +1,14 @@
1
- import { default as React } from 'react';
1
+ import { ReactNode, CSSProperties } from 'react';
2
2
  import { BoxProps } from '../Box';
3
- export interface TouchableProps extends React.HTMLAttributes<HTMLDivElement>, BoxProps {
3
+ export type TouchableProps = BoxProps & {
4
4
  /**
5
5
  * Touchable's content.
6
6
  */
7
- children?: React.ReactNode;
7
+ children?: ReactNode;
8
8
  /**
9
9
  * Additional styles.
10
10
  */
11
- style?: React.CSSProperties;
11
+ style?: CSSProperties;
12
12
  /**
13
13
  * Testing id of the component.
14
14
  */
@@ -23,4 +23,19 @@ export interface TouchableProps extends React.HTMLAttributes<HTMLDivElement>, Bo
23
23
  * @default true
24
24
  */
25
25
  useOpacityAnimation?: boolean;
26
- }
26
+ /**
27
+ * URL to navigate to when the touchable is clicked.
28
+ * When provided, renders as an anchor tag.
29
+ */
30
+ href?: string;
31
+ /**
32
+ * Target attribute for the anchor tag.
33
+ * Only used when href is provided.
34
+ */
35
+ target?: string;
36
+ /**
37
+ * Rel attribute for the anchor tag.
38
+ * Only used when href is provided.
39
+ */
40
+ rel?: string;
41
+ };