idea-react 3.0.0-rc.1 → 3.0.0-rc.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idea-react",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.2",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "author": "shiy2008@gmail.com",
6
6
  "description": "A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.",
@@ -36,7 +36,7 @@
36
36
  "html2canvas": "^1.4.1",
37
37
  "iterable-observer": "^1.1.1",
38
38
  "lodash": "^4.18.1",
39
- "marked": "^18.1.3",
39
+ "marked": "^18.2.0",
40
40
  "mobx-react-helper": "^0.5.4",
41
41
  "react-live": "^5.0.1",
42
42
  "shiki": "^4.6.0",
@@ -74,11 +74,11 @@
74
74
  "koapache": "^3.0.0",
75
75
  "less": "^4.9.1",
76
76
  "lint-staged": "^17.6.0",
77
- "mobx": "^7.1.5",
77
+ "mobx": "^7.1.6",
78
78
  "mobx-react": "^10.0.3",
79
79
  "parcel": "~2.16.4",
80
80
  "postcss": "^8.5.32",
81
- "prettier": "^3.9.10",
81
+ "prettier": "^3.10.0",
82
82
  "prettier-plugin-css-order": "^2.2.0",
83
83
  "process": "^0.11.10",
84
84
  "prop-types": "15.8.1",
@@ -44,7 +44,7 @@ export const Button = polymorphic<ButtonProps>(
44
44
  const link = isButtonLink(attributes);
45
45
  const Root = RootAs ?? (link ? 'a' : 'button');
46
46
  const nativeButton = Root === 'button';
47
- const role = attributes.role ?? 'button';
47
+ const role = attributes.role ?? (link ? 'link' : 'button');
48
48
  const onClick =
49
49
  !nativeButton && disabled
50
50
  ? typeof Root === 'string'
@@ -26,45 +26,31 @@ export const Placeholder = polymorphic<PlaceholderProps>(
26
26
  <Root
27
27
  {...props}
28
28
  className={classNames(
29
- 'placeholder',
30
- size && `placeholder-${size}`,
31
- animation && `placeholder-${animation}`,
32
- theme && `bg-${theme}`,
29
+ animation ? `placeholder-${animation}` : 'placeholder',
30
+ !animation && size && `placeholder-${size}`,
31
+ !animation && theme && `bg-${theme}`,
33
32
  className
34
33
  )}
35
- style={{ width, ...style }}
34
+ style={{ width: animation ? undefined : width, ...style }}
36
35
  aria-hidden={hidden}
37
36
  />
38
37
  )
39
38
  );
40
39
  Placeholder.displayName = 'Placeholder';
41
40
 
42
- export interface PlaceholderAnimationProps extends ComponentPropsWithRef<'div'> {
43
- animation?: PlaceholderProps['animation'];
44
- }
45
-
46
- export const PlaceholderAnimation = polymorphic<PlaceholderAnimationProps>(
47
- ({ as: Root = 'div', animation = 'wave', className, ...props }) => (
48
- <Root
49
- {...props}
50
- className={classNames(`placeholder-${animation}`, className)}
51
- aria-hidden="true"
52
- />
53
- )
54
- );
55
- PlaceholderAnimation.displayName = 'PlaceholderAnimation';
56
-
57
41
  export type PlaceholderButtonProps = ButtonProps;
58
42
 
59
43
  export const PlaceholderButton = polymorphic<PlaceholderButtonProps>(
60
- ({ as: RootAs, className, ...props }) => (
44
+ ({ as: RootAs, className, children = '\u00a0', ...props }) => (
61
45
  <Button
62
46
  as={RootAs}
63
47
  {...props}
64
48
  className={classNames('placeholder', className)}
65
49
  aria-hidden="true"
66
50
  disabled
67
- />
51
+ >
52
+ {children}
53
+ </Button>
68
54
  )
69
55
  );
70
56
  PlaceholderButton.displayName = 'PlaceholderButton';
@@ -10,26 +10,35 @@ export interface TableProps extends ComponentPropsWithRef<'table'> {
10
10
  hover?: boolean;
11
11
  bordered?: boolean;
12
12
  borderless?: boolean;
13
+ card?: boolean;
13
14
  small?: boolean;
14
15
  responsive?: boolean | Breakpoint;
16
+ stacked?: boolean | Breakpoint;
17
+ verticalAlign?: 'baseline' | 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom';
18
+ captionTop?: boolean;
15
19
  }
16
20
 
17
21
  export const Table = polymorphic<TableProps>(
18
22
  ({
19
23
  as: RootAs,
24
+ className,
25
+ children,
20
26
  striped,
21
27
  stripedColumns,
22
28
  hover,
23
29
  bordered,
24
30
  borderless,
31
+ card,
25
32
  small,
26
33
  responsive,
27
- className,
28
- children,
34
+ stacked,
35
+ verticalAlign,
36
+ captionTop,
29
37
  ...props
30
38
  }) => {
31
39
  const Root = RootAs ?? 'div';
32
40
  const TableRoot = !responsive && RootAs ? RootAs : 'table';
41
+ const hasWrapper = !!responsive || !!card;
33
42
 
34
43
  const table = (
35
44
  <TableRoot
@@ -44,6 +53,10 @@ export const Table = polymorphic<TableProps>(
44
53
  'table-borderless': borderless,
45
54
  'table-sm': small
46
55
  },
56
+ stacked === true && 'table-stacked',
57
+ typeof stacked === 'string' && `${stacked}:table-stacked`,
58
+ verticalAlign && `align-${verticalAlign}`,
59
+ captionTop && 'caption-top',
47
60
  responsive && RootAs ? undefined : className
48
61
  )}
49
62
  >
@@ -51,15 +64,16 @@ export const Table = polymorphic<TableProps>(
51
64
  </TableRoot>
52
65
  );
53
66
 
54
- return !responsive ? (
67
+ return !hasWrapper ? (
55
68
  table
56
69
  ) : (
57
70
  <Root
58
- {...(RootAs ? props : {})}
71
+ {...(responsive && RootAs ? props : {})}
59
72
  className={classNames(
60
- 'table-responsive',
61
- responsive !== true && `${responsive}:table-responsive`,
62
- RootAs && className
73
+ responsive && 'table-responsive',
74
+ responsive && responsive !== true && `${responsive}:table-responsive`,
75
+ card && 'table-card',
76
+ responsive && RootAs && className
63
77
  )}
64
78
  >
65
79
  {table}
@@ -5,18 +5,19 @@ import { ComponentTheme } from '../Base/Button';
5
5
  import { Icon, IconProps } from '../Extension/Icon';
6
6
  import { polymorphic } from '../Helper/Polymorphic';
7
7
 
8
- export type ChipProps = ComponentPropsWithRef<'button'> & {
8
+ export type ChipProps = ComponentPropsWithRef<'span'> & {
9
9
  active?: boolean;
10
10
  theme?: ComponentTheme;
11
+ type?: ComponentPropsWithRef<'button'>['type'];
11
12
  };
12
13
 
13
14
  export const Chip = polymorphic<ChipProps>(
14
- ({ as: Root = 'button', className, active, theme, type = 'button', ...props }) => (
15
+ ({ as: Root = 'span', className, active, theme, type = 'button', ...props }) => (
15
16
  <Root
16
17
  {...props}
17
18
  className={classNames('chip', { active }, theme && `theme-${theme}`, className)}
18
19
  type={Root === 'button' ? type : undefined}
19
- aria-pressed={active}
20
+ aria-pressed={Root === 'button' ? active : undefined}
20
21
  />
21
22
  )
22
23
  );
@@ -49,16 +50,3 @@ export const ChipDismiss = polymorphic<ComponentPropsWithRef<'button'>>(
49
50
  )
50
51
  );
51
52
  ChipDismiss.displayName = 'ChipDismiss';
52
-
53
- export type ChipTokenProps = ComponentPropsWithRef<'span'> & Pick<ChipProps, 'active' | 'theme'>;
54
-
55
- export const ChipToken = polymorphic<ChipTokenProps>(
56
- ({ as: Root = 'span', className, active, theme, ...props }) => (
57
- <Root
58
- {...props}
59
- tabIndex={props.tabIndex ?? 0}
60
- className={classNames('chip', { active }, theme && `theme-${theme}`, className)}
61
- />
62
- )
63
- );
64
- ChipToken.displayName = 'ChipToken';