idea-react 3.0.0-rc.0 → 3.0.0-rc.1
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/AGENTS.md +12 -15
- package/dist/index.d.mts +48 -12
- package/dist/index.d.ts +48 -12
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/package.json +2 -8
- package/source/Base/Accordion.tsx +1 -1
- package/source/Base/Breadcrumb.tsx +15 -3
- package/source/Base/Button.tsx +5 -1
- package/source/Base/Carousel/index.tsx +2 -12
- package/source/Base/Collapse.tsx +17 -2
- package/source/Base/Fade.tsx +15 -0
- package/source/Base/ListGroup.tsx +12 -2
- package/source/Base/Menu.tsx +1 -7
- package/source/Base/Nav.tsx +3 -1
- package/source/Base/NavOverflow/index.tsx +1 -1
- package/source/Base/Navbar.tsx +19 -13
- package/source/Base/index.ts +1 -0
- package/source/Content/Figure.tsx +26 -0
- package/source/Content/index.ts +1 -0
- package/source/Extension/Icon.tsx +15 -2
- package/source/Extension/ScrollNav/index.tsx +4 -2
- package/source/Extension/UserRank/index.tsx +6 -5
- package/source/Form/Chip.tsx +1 -1
- package/source/Form/ChipInput.tsx +1 -1
- package/source/Form/Combobox.tsx +3 -7
- package/source/Form/DatePicker.tsx +1 -1
- package/source/Form/Primitives.tsx +0 -8
- package/source/Form/Radio.tsx +13 -3
- package/source/Layout/Grid.tsx +35 -25
- package/source/Layout/Ratio.tsx +29 -0
- package/source/Layout/index.ts +1 -0
- package/source/types.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idea-react",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
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.",
|
|
@@ -51,8 +51,6 @@
|
|
|
51
51
|
"react-element-to-jsx-string": ">=15"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@cspell/eslint-plugin": "^10.4.1",
|
|
55
|
-
"@eslint/js": "^10.0.1",
|
|
56
54
|
"@parcel/config-default": "~2.16.4",
|
|
57
55
|
"@parcel/packager-ts": "~2.16.4",
|
|
58
56
|
"@parcel/transformer-less": "2.16.4",
|
|
@@ -69,10 +67,7 @@
|
|
|
69
67
|
"@types/react-dom": "^19.3.0",
|
|
70
68
|
"buffer": "^6.0.3",
|
|
71
69
|
"eslint": "^10.14.0",
|
|
72
|
-
"eslint-
|
|
73
|
-
"eslint-plugin-react": "^7.37.5",
|
|
74
|
-
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
75
|
-
"globals": "^17.14.0",
|
|
70
|
+
"eslint-idea2app-next-js": "^0.1.1",
|
|
76
71
|
"happy-dom": "^21.0.4",
|
|
77
72
|
"husky": "^9.1.7",
|
|
78
73
|
"jiti": "^2.7.0",
|
|
@@ -95,7 +90,6 @@
|
|
|
95
90
|
"typedoc": "^0.28.20",
|
|
96
91
|
"typedoc-plugin-mdn-links": "^5.1.1",
|
|
97
92
|
"typescript": "~6.0.3",
|
|
98
|
-
"typescript-eslint": "^8.72.1",
|
|
99
93
|
"unplugin-swc": "^2.0.0",
|
|
100
94
|
"unrun": "^0.3.1"
|
|
101
95
|
},
|
|
@@ -53,7 +53,7 @@ export const AccordionHeader = polymorphic<AccordionHeaderProps>(
|
|
|
53
53
|
({ as: Root = 'summary', icon = 'chevron-down', className, children, ...props }) => (
|
|
54
54
|
<Root {...props} className={classNames('accordion-header', className)}>
|
|
55
55
|
{children}
|
|
56
|
-
{icon && <Icon name={icon} className="accordion-icon"
|
|
56
|
+
{icon && <Icon name={icon} className="accordion-icon" />}
|
|
57
57
|
</Root>
|
|
58
58
|
)
|
|
59
59
|
);
|
|
@@ -10,9 +10,21 @@ export const Breadcrumb = polymorphic<ComponentPropsWithRef<'ol'>>(
|
|
|
10
10
|
);
|
|
11
11
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export type BreadcrumbItemProps = ComponentPropsWithRef<'li'> & { active?: boolean };
|
|
14
|
+
|
|
15
|
+
export const BreadcrumbItem = polymorphic<BreadcrumbItemProps>(
|
|
16
|
+
({
|
|
17
|
+
as: Root = 'li',
|
|
18
|
+
active,
|
|
19
|
+
className,
|
|
20
|
+
'aria-current': current = active ? 'page' : undefined,
|
|
21
|
+
...props
|
|
22
|
+
}) => (
|
|
23
|
+
<Root
|
|
24
|
+
{...props}
|
|
25
|
+
className={classNames('breadcrumb-item', { active }, className)}
|
|
26
|
+
aria-current={current}
|
|
27
|
+
/>
|
|
16
28
|
)
|
|
17
29
|
);
|
|
18
30
|
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
package/source/Base/Button.tsx
CHANGED
|
@@ -26,7 +26,9 @@ interface ButtonStyleProps {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
type ButtonLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
|
|
29
|
+
|
|
29
30
|
type ButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
|
|
31
|
+
|
|
30
32
|
type ButtonElementAttributes = ButtonAttributes | ButtonLinkAttributes;
|
|
31
33
|
|
|
32
34
|
export type ButtonProps = ButtonStyleProps & ButtonElementAttributes;
|
|
@@ -42,6 +44,7 @@ export const Button = polymorphic<ButtonProps>(
|
|
|
42
44
|
const link = isButtonLink(attributes);
|
|
43
45
|
const Root = RootAs ?? (link ? 'a' : 'button');
|
|
44
46
|
const nativeButton = Root === 'button';
|
|
47
|
+
const role = attributes.role ?? 'button';
|
|
45
48
|
const onClick =
|
|
46
49
|
!nativeButton && disabled
|
|
47
50
|
? typeof Root === 'string'
|
|
@@ -60,12 +63,13 @@ export const Button = polymorphic<ButtonProps>(
|
|
|
60
63
|
<Root
|
|
61
64
|
{...attributes}
|
|
62
65
|
className={classes}
|
|
66
|
+
role={role}
|
|
63
67
|
type={nativeButton ? attributes.type || 'button' : attributes.type}
|
|
64
68
|
href={disabled ? undefined : attributes.href}
|
|
65
69
|
disabled={nativeButton || typeof Root !== 'string' ? disabled : undefined}
|
|
66
70
|
aria-disabled={(!nativeButton && disabled) || undefined}
|
|
67
71
|
aria-pressed={
|
|
68
|
-
!link ||
|
|
72
|
+
!link || role === 'button'
|
|
69
73
|
? (active ?? attributes['aria-pressed'])
|
|
70
74
|
: attributes['aria-pressed']
|
|
71
75
|
}
|
|
@@ -264,7 +264,6 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
264
264
|
|
|
265
265
|
return (
|
|
266
266
|
<Button
|
|
267
|
-
type="button"
|
|
268
267
|
variant={overlay ? 'subtle' : undefined}
|
|
269
268
|
theme={overlay ? 'secondary' : undefined}
|
|
270
269
|
size="sm"
|
|
@@ -273,11 +272,7 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
273
272
|
disabled={ends === 'stop' && atEnd}
|
|
274
273
|
icon
|
|
275
274
|
>
|
|
276
|
-
<Icon
|
|
277
|
-
name={previous ? 'chevron-left' : 'chevron-right'}
|
|
278
|
-
size={1}
|
|
279
|
-
aria-hidden="true"
|
|
280
|
-
/>
|
|
275
|
+
<Icon name={previous ? 'chevron-left' : 'chevron-right'} size={1} />
|
|
281
276
|
<span className="visually-hidden">{label}</span>
|
|
282
277
|
</Button>
|
|
283
278
|
);
|
|
@@ -304,7 +299,6 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
304
299
|
renderPlayPause = () =>
|
|
305
300
|
(this.props.playPause || this.props.autoplay) && (
|
|
306
301
|
<Button
|
|
307
|
-
type="button"
|
|
308
302
|
className={classNames('carousel-control-play-pause', {
|
|
309
303
|
paused: !this.store.playing
|
|
310
304
|
})}
|
|
@@ -313,11 +307,7 @@ export class Carousel<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
313
307
|
aria-label={this.store.playing ? 'Pause' : 'Play'}
|
|
314
308
|
icon
|
|
315
309
|
>
|
|
316
|
-
<Icon
|
|
317
|
-
name={this.store.playing ? 'pause-fill' : 'play-fill'}
|
|
318
|
-
size={1}
|
|
319
|
-
aria-hidden="true"
|
|
320
|
-
/>
|
|
310
|
+
<Icon name={this.store.playing ? 'pause-fill' : 'play-fill'} size={1} />
|
|
321
311
|
</Button>
|
|
322
312
|
);
|
|
323
313
|
|
package/source/Base/Collapse.tsx
CHANGED
|
@@ -134,6 +134,7 @@ export interface CollapseToggleProps
|
|
|
134
134
|
target: string;
|
|
135
135
|
href?: string;
|
|
136
136
|
type?: 'button' | 'submit' | 'reset';
|
|
137
|
+
navbarToggler?: boolean;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
@observer
|
|
@@ -201,16 +202,28 @@ export class CollapseToggle<T extends ElementType | undefined = 'button'> extend
|
|
|
201
202
|
disabled,
|
|
202
203
|
icon,
|
|
203
204
|
styled,
|
|
205
|
+
navbarToggler,
|
|
204
206
|
className,
|
|
207
|
+
children,
|
|
205
208
|
...props
|
|
206
209
|
} = this.componentProps;
|
|
207
210
|
const Root: ElementType = RootAs ?? (href ? 'a' : 'button');
|
|
208
211
|
const nativeButton = Root === 'button';
|
|
212
|
+
const content = navbarToggler ? (
|
|
213
|
+
<span className="navbar-toggler-icon" aria-hidden="true" />
|
|
214
|
+
) : (
|
|
215
|
+
children
|
|
216
|
+
);
|
|
209
217
|
const rootClassName = classNames(
|
|
210
218
|
variant === false ? undefined : variant ? `btn-${variant}` : icon ? undefined : 'btn',
|
|
211
219
|
theme && `theme-${theme}`,
|
|
212
220
|
size && `btn-${size}`,
|
|
213
|
-
{
|
|
221
|
+
{
|
|
222
|
+
'btn-icon': icon || navbarToggler,
|
|
223
|
+
'btn-styled': styled,
|
|
224
|
+
disabled,
|
|
225
|
+
'navbar-toggler': navbarToggler
|
|
226
|
+
},
|
|
214
227
|
className
|
|
215
228
|
);
|
|
216
229
|
|
|
@@ -227,7 +240,9 @@ export class CollapseToggle<T extends ElementType | undefined = 'button'> extend
|
|
|
227
240
|
aria-controls={this.controls || undefined}
|
|
228
241
|
aria-expanded={this.expanded}
|
|
229
242
|
onClick={this.handleClick}
|
|
230
|
-
|
|
243
|
+
>
|
|
244
|
+
{content}
|
|
245
|
+
</Root>
|
|
231
246
|
);
|
|
232
247
|
}
|
|
233
248
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { cloneElement, FC, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface FadeProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
in?: boolean;
|
|
7
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
8
|
+
children: ReactElement<{ className?: string }>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Fade: FC<FadeProps> = ({ children, in: show = false, className = '' }) =>
|
|
12
|
+
cloneElement(children, {
|
|
13
|
+
className: classNames('fade', className, children.props.className, show && 'show')
|
|
14
|
+
});
|
|
15
|
+
Fade.displayName = 'Fade';
|
|
@@ -8,6 +8,8 @@ import type { ComponentTheme } from './Button';
|
|
|
8
8
|
export type ListGroupHorizontal = boolean | Breakpoint;
|
|
9
9
|
|
|
10
10
|
interface ListGroupStyleProps {
|
|
11
|
+
radio?: boolean;
|
|
12
|
+
checkable?: boolean;
|
|
11
13
|
flush?: boolean;
|
|
12
14
|
numbered?: boolean;
|
|
13
15
|
horizontal?: ListGroupHorizontal;
|
|
@@ -21,10 +23,15 @@ export type ListGroupProps = ListGroupStyleProps &
|
|
|
21
23
|
);
|
|
22
24
|
|
|
23
25
|
export const ListGroup = polymorphic<ListGroupStyleProps & ComponentPropsWithRef<'ul'>>(
|
|
24
|
-
({ as: Root = 'ul', flush, numbered, horizontal, className, ...props }) => {
|
|
26
|
+
({ as: Root = 'ul', flush, numbered, horizontal, checkable, radio, className, ...props }) => {
|
|
25
27
|
const classes = classNames(
|
|
26
28
|
'list-group',
|
|
27
|
-
{
|
|
29
|
+
{
|
|
30
|
+
'list-group-checkable': checkable,
|
|
31
|
+
'list-group-radio': radio,
|
|
32
|
+
'list-group-flush': flush,
|
|
33
|
+
'list-group-numbered': numbered
|
|
34
|
+
},
|
|
28
35
|
horizontal &&
|
|
29
36
|
(horizontal === true
|
|
30
37
|
? 'list-group-horizontal'
|
|
@@ -45,8 +52,11 @@ interface ListGroupItemStyleProps {
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
type ListGroupItemLinkAttributes = ComponentPropsWithRef<'a'> & { href: string };
|
|
55
|
+
|
|
48
56
|
type ListGroupItemButtonAttributes = ComponentPropsWithRef<'button'> & { href?: never };
|
|
57
|
+
|
|
49
58
|
type ListGroupItemAttributes = ComponentPropsWithRef<'li'> & { href?: never; type?: never };
|
|
59
|
+
|
|
50
60
|
type ListGroupItemElementAttributes =
|
|
51
61
|
ListGroupItemLinkAttributes | ListGroupItemButtonAttributes | ListGroupItemAttributes;
|
|
52
62
|
|
package/source/Base/Menu.tsx
CHANGED
|
@@ -60,12 +60,7 @@ export const MenuPanel = polymorphic<MenuPanelProps>(
|
|
|
60
60
|
MenuPanel.displayName = 'MenuPanel';
|
|
61
61
|
|
|
62
62
|
export const MenuItemIcon = polymorphic<IconProps>(({ as: RootAs, className, ...props }) => (
|
|
63
|
-
<Icon
|
|
64
|
-
as={RootAs}
|
|
65
|
-
aria-hidden="true"
|
|
66
|
-
{...props}
|
|
67
|
-
className={classNames('menu-item-icon', className)}
|
|
68
|
-
/>
|
|
63
|
+
<Icon as={RootAs} {...props} className={classNames('menu-item-icon', className)} />
|
|
69
64
|
));
|
|
70
65
|
MenuItemIcon.displayName = 'MenuItemIcon';
|
|
71
66
|
|
|
@@ -73,7 +68,6 @@ export const MenuItemCheck = polymorphic<Omit<IconProps, 'name'>>(
|
|
|
73
68
|
({ as: RootAs, className, ...props }) => (
|
|
74
69
|
<Icon
|
|
75
70
|
as={RootAs}
|
|
76
|
-
aria-hidden="true"
|
|
77
71
|
{...props}
|
|
78
72
|
name="check"
|
|
79
73
|
className={classNames('menu-item-check', className)}
|
package/source/Base/Nav.tsx
CHANGED
|
@@ -8,6 +8,7 @@ export interface NavProps extends ComponentPropsWithRef<'nav'> {
|
|
|
8
8
|
vertical?: boolean;
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
justified?: boolean;
|
|
11
|
+
flush?: boolean;
|
|
11
12
|
cardHeader?: boolean;
|
|
12
13
|
navbar?: boolean;
|
|
13
14
|
}
|
|
@@ -19,6 +20,7 @@ export const Nav = polymorphic<NavProps>(
|
|
|
19
20
|
vertical,
|
|
20
21
|
fill,
|
|
21
22
|
justified,
|
|
23
|
+
flush,
|
|
22
24
|
cardHeader,
|
|
23
25
|
navbar,
|
|
24
26
|
className,
|
|
@@ -32,7 +34,7 @@ export const Nav = polymorphic<NavProps>(
|
|
|
32
34
|
variant && `nav-${variant}`,
|
|
33
35
|
cardHeader && variant === 'tabs' && 'card-header-tabs',
|
|
34
36
|
vertical && (variant === 'pills' ? 'nav-pills-vertical' : 'flex-column'),
|
|
35
|
-
{ 'nav-fill': fill, 'nav-justified': justified },
|
|
37
|
+
{ 'nav-fill': fill, 'nav-justified': justified, 'nav-flush': flush },
|
|
36
38
|
className
|
|
37
39
|
)}
|
|
38
40
|
/>
|
|
@@ -255,7 +255,7 @@ export class NavOverflow<T extends ElementType | undefined = 'div'> extends Comp
|
|
|
255
255
|
: vertical === 'left'
|
|
256
256
|
? ['end-100', horizontal === 'end' ? 'bottom-0' : 'top-0']
|
|
257
257
|
: ['start-100', horizontal === 'end' ? 'bottom-0' : 'top-0'];
|
|
258
|
-
const icon = moreIcon ?? <Icon name="three-dots"
|
|
258
|
+
const icon = moreIcon ?? <Icon name="three-dots" />;
|
|
259
259
|
const text = moreText === false ? null : moreText;
|
|
260
260
|
|
|
261
261
|
return (
|
package/source/Base/Navbar.tsx
CHANGED
|
@@ -68,6 +68,8 @@ export interface NavbarTogglerProps extends Omit<
|
|
|
68
68
|
'children' | 'type'
|
|
69
69
|
> {
|
|
70
70
|
expanded?: boolean;
|
|
71
|
+
commandfor?: string;
|
|
72
|
+
command?: string;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export const NavbarToggler = polymorphic<NavbarTogglerProps>(
|
|
@@ -77,18 +79,22 @@ export const NavbarToggler = polymorphic<NavbarTogglerProps>(
|
|
|
77
79
|
className,
|
|
78
80
|
'aria-label': ariaLabel = 'Toggle navigation',
|
|
79
81
|
...props
|
|
80
|
-
}) =>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
}) => {
|
|
83
|
+
const icon = <span className="navbar-toggler-icon" aria-hidden="true" />;
|
|
84
|
+
const togglerClassName = classNames('navbar-toggler', className);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Button
|
|
88
|
+
as={RootAs}
|
|
89
|
+
{...props}
|
|
90
|
+
className={togglerClassName}
|
|
91
|
+
aria-label={ariaLabel}
|
|
92
|
+
aria-expanded={expanded}
|
|
93
|
+
icon
|
|
94
|
+
>
|
|
95
|
+
{icon}
|
|
96
|
+
</Button>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
93
99
|
);
|
|
94
100
|
NavbarToggler.displayName = 'NavbarToggler';
|
package/source/Base/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
import { Image, ImageProps } from './Images';
|
|
6
|
+
|
|
7
|
+
export type FigureProps = ComponentPropsWithRef<'figure'>;
|
|
8
|
+
|
|
9
|
+
export const Figure = polymorphic<FigureProps>(({ as: Root = 'figure', className, ...props }) => (
|
|
10
|
+
<Root {...props} className={classNames('figure', className)} />
|
|
11
|
+
));
|
|
12
|
+
Figure.displayName = 'Figure';
|
|
13
|
+
|
|
14
|
+
export const FigureImage = polymorphic<ImageProps>(
|
|
15
|
+
({ as: Root = 'img', fluid = true, ...props }) => <Image as={Root} {...props} fluid={fluid} />
|
|
16
|
+
);
|
|
17
|
+
FigureImage.displayName = 'FigureImage';
|
|
18
|
+
|
|
19
|
+
export type FigureCaptionProps = ComponentPropsWithRef<'figcaption'>;
|
|
20
|
+
|
|
21
|
+
export const FigureCaption = polymorphic<FigureCaptionProps>(
|
|
22
|
+
({ as: Root = 'figcaption', className, ...props }) => (
|
|
23
|
+
<Root {...props} className={classNames('figure-caption', className)} />
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
FigureCaption.displayName = 'FigureCaption';
|
package/source/Content/index.ts
CHANGED
|
@@ -8,11 +8,24 @@ export type IconProps = ComponentPropsWithRef<'span'> & {
|
|
|
8
8
|
size?: number;
|
|
9
9
|
};
|
|
10
10
|
export const Icon = polymorphic<IconProps>(
|
|
11
|
-
({
|
|
11
|
+
({
|
|
12
|
+
as: Root = 'span',
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
name,
|
|
16
|
+
size,
|
|
17
|
+
'aria-hidden': ariaHidden,
|
|
18
|
+
'aria-label': ariaLabel,
|
|
19
|
+
'aria-labelledby': ariaLabelledBy,
|
|
20
|
+
...props
|
|
21
|
+
}) => (
|
|
12
22
|
<Root
|
|
23
|
+
{...props}
|
|
13
24
|
className={classNames(`bi-${name}`, className)}
|
|
14
25
|
style={{ fontSize: size && `${size}rem`, ...style }}
|
|
15
|
-
{
|
|
26
|
+
aria-hidden={ariaHidden ?? (ariaLabel || ariaLabelledBy ? undefined : true)}
|
|
27
|
+
aria-label={ariaLabel}
|
|
28
|
+
aria-labelledby={ariaLabelledBy}
|
|
16
29
|
/>
|
|
17
30
|
)
|
|
18
31
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
1
2
|
import { ElementType } from 'react';
|
|
2
3
|
|
|
3
4
|
import { Nav, NavProps } from '../../Base/Nav';
|
|
4
5
|
import { polymorphic } from '../../Helper/Polymorphic';
|
|
5
6
|
import { ScrollNavScroller } from './Scroller';
|
|
6
7
|
|
|
7
|
-
export type ScrollNavProps = NavProps;
|
|
8
|
+
export type ScrollNavProps = NavProps & { navClassName?: string };
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* A horizontal scrolling navigation bar based on Bootstrap's `nav-scroller` pattern.
|
|
@@ -16,6 +17,7 @@ export const ScrollNav = polymorphic<ScrollNavProps>(
|
|
|
16
17
|
({
|
|
17
18
|
as: RootAs,
|
|
18
19
|
className = '',
|
|
20
|
+
navClassName,
|
|
19
21
|
children,
|
|
20
22
|
ref,
|
|
21
23
|
variant,
|
|
@@ -35,7 +37,7 @@ export const ScrollNav = polymorphic<ScrollNavProps>(
|
|
|
35
37
|
<Nav
|
|
36
38
|
{...(RootAs ? {} : props)}
|
|
37
39
|
ref={RootAs ? undefined : ref}
|
|
38
|
-
className=
|
|
40
|
+
className={classNames('flex-nowrap', navClassName)}
|
|
39
41
|
{...{ variant, vertical, fill, justified, cardHeader, navbar }}
|
|
40
42
|
>
|
|
41
43
|
{children}
|
|
@@ -24,7 +24,7 @@ export interface UserRankViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
export const UserRankView = polymorphic<UserRankViewProps>(
|
|
25
25
|
({ as: RootAs, className = '', title, rank = [], linkOf, ...props }) => {
|
|
26
26
|
const renderMedal = (user: UserRank) => (
|
|
27
|
-
<
|
|
27
|
+
<Col key={user.id} as="li">
|
|
28
28
|
<div className={`shadow-lg overflow-hidden rounded-circle m-auto ${style.image}`}>
|
|
29
29
|
<Image src={user.avatar} alt={user.name} loading="lazy" fluid />
|
|
30
30
|
</div>
|
|
@@ -38,7 +38,7 @@ export const UserRankView = polymorphic<UserRankViewProps>(
|
|
|
38
38
|
</div>
|
|
39
39
|
<UserAddress {...user} />
|
|
40
40
|
</div>
|
|
41
|
-
</
|
|
41
|
+
</Col>
|
|
42
42
|
);
|
|
43
43
|
const renderRow = (user: UserRank, index: number, { length }: UserRank[]) => (
|
|
44
44
|
<tr key={user.id} className="position-relative">
|
|
@@ -87,11 +87,12 @@ export const UserRankView = polymorphic<UserRankViewProps>(
|
|
|
87
87
|
{title}
|
|
88
88
|
</h3>
|
|
89
89
|
</div>
|
|
90
|
-
<
|
|
91
|
-
|
|
90
|
+
<Row
|
|
91
|
+
as="ul"
|
|
92
|
+
className={`mt-2 g-0 align-items-end text-center ps-0 pt-2 list-unstyled ${style.topUsers}`}
|
|
92
93
|
>
|
|
93
94
|
{rank.slice(0, 3).map(renderMedal)}
|
|
94
|
-
</
|
|
95
|
+
</Row>
|
|
95
96
|
</Col>
|
|
96
97
|
<Col xs={12} lg={5}>
|
|
97
98
|
<Table className={`my-3 pt-2 ${style.restUsers}`} responsive>
|
package/source/Form/Chip.tsx
CHANGED
|
@@ -44,7 +44,7 @@ export const ChipDismiss = polymorphic<ComponentPropsWithRef<'button'>>(
|
|
|
44
44
|
aria-label={label}
|
|
45
45
|
className={classNames('chip-dismiss', className)}
|
|
46
46
|
>
|
|
47
|
-
{children ?? <Icon name="x-lg"
|
|
47
|
+
{children ?? <Icon name="x-lg" />}
|
|
48
48
|
</Root>
|
|
49
49
|
)
|
|
50
50
|
);
|
|
@@ -58,7 +58,7 @@ class ChipInputComponent extends FormPlugin<ChipInputComponentProps, Pick<Chips,
|
|
|
58
58
|
createOnBlur,
|
|
59
59
|
dismissible,
|
|
60
60
|
placeholder,
|
|
61
|
-
dismissIcon: renderToStaticMarkup(<Icon name="x-lg"
|
|
61
|
+
dismissIcon: renderToStaticMarkup(<Icon name="x-lg" />)
|
|
62
62
|
});
|
|
63
63
|
element.addEventListener('change.bs.chips', this.handleValuesChange);
|
|
64
64
|
|
package/source/Form/Combobox.tsx
CHANGED
|
@@ -53,7 +53,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
53
53
|
data-label={optionText(children)}
|
|
54
54
|
data-option-hidden={props.hidden || undefined}
|
|
55
55
|
>
|
|
56
|
-
{icon && <Icon name={icon} className="menu-item-icon"
|
|
56
|
+
{icon && <Icon name={icon} className="menu-item-icon" />}
|
|
57
57
|
{description ? (
|
|
58
58
|
<MenuItemContent>
|
|
59
59
|
{children}
|
|
@@ -62,7 +62,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
62
62
|
) : (
|
|
63
63
|
children
|
|
64
64
|
)}
|
|
65
|
-
{checkedIcon && <Icon name="check-lg" className="menu-item-check"
|
|
65
|
+
{checkedIcon && <Icon name="check-lg" className="menu-item-check" />}
|
|
66
66
|
</Root>
|
|
67
67
|
)
|
|
68
68
|
);
|
|
@@ -335,11 +335,7 @@ export class Combobox<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
335
335
|
>
|
|
336
336
|
{hasSelection ? label : placeholder}
|
|
337
337
|
</span>
|
|
338
|
-
<Icon
|
|
339
|
-
name="chevron-down"
|
|
340
|
-
className="combobox-caret"
|
|
341
|
-
aria-hidden="true"
|
|
342
|
-
/>
|
|
338
|
+
<Icon name="chevron-down" className="combobox-caret" />
|
|
343
339
|
</>
|
|
344
340
|
}
|
|
345
341
|
toggleProps={{
|
|
@@ -163,7 +163,7 @@ class DatePickerComponent extends FormPlugin<
|
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
165
|
<Button as={as} {...buttonProps} {...attributes} ref={this.setRef}>
|
|
166
|
-
{leadingIcon && <Icon name={leadingIcon}
|
|
166
|
+
{leadingIcon && <Icon name={leadingIcon} />}
|
|
167
167
|
<span data-bs-datepicker-display="">{children}</span>
|
|
168
168
|
</Button>
|
|
169
169
|
);
|
|
@@ -14,14 +14,6 @@ export const Form = polymorphic<FormProps>(
|
|
|
14
14
|
);
|
|
15
15
|
Form.displayName = 'Form';
|
|
16
16
|
|
|
17
|
-
export type FormFieldsetProps = ComponentPropsWithRef<'fieldset'>;
|
|
18
|
-
|
|
19
|
-
export const FormFieldset = polymorphic<FormFieldsetProps>(
|
|
20
|
-
({ as: Root = 'fieldset', ...props }) => <Root {...props} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
FormFieldset.displayName = 'FormFieldset';
|
|
24
|
-
|
|
25
17
|
export type FormFieldProps = ComponentPropsWithRef<'div'> & {
|
|
26
18
|
card?: boolean;
|
|
27
19
|
};
|
package/source/Form/Radio.tsx
CHANGED
|
@@ -33,14 +33,24 @@ Radio.displayName = 'Radio';
|
|
|
33
33
|
export type FormCheckProps = CheckboxProps &
|
|
34
34
|
Pick<ComponentPropsWithRef<'input'>, 'ref'> & {
|
|
35
35
|
type?: 'checkbox' | 'radio';
|
|
36
|
+
listGroup?: boolean;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const FormCheck = polymorphic<FormCheckProps>(
|
|
39
|
-
({ as: RootAs, type = 'checkbox', indeterminate, ...props }) =>
|
|
40
|
+
({ as: RootAs, type = 'checkbox', indeterminate, listGroup, className, ...props }) =>
|
|
40
41
|
type === 'checkbox' ? (
|
|
41
|
-
<Checkbox
|
|
42
|
+
<Checkbox
|
|
43
|
+
as={RootAs}
|
|
44
|
+
{...props}
|
|
45
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
46
|
+
indeterminate={indeterminate}
|
|
47
|
+
/>
|
|
42
48
|
) : (
|
|
43
|
-
<Radio
|
|
49
|
+
<Radio
|
|
50
|
+
as={RootAs}
|
|
51
|
+
{...props}
|
|
52
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
53
|
+
/>
|
|
44
54
|
)
|
|
45
55
|
);
|
|
46
56
|
FormCheck.displayName = 'FormCheck';
|