Skip to content

Commit d3e8905

Browse files
committed
[refactor] upgrade List Group, Button Group & Toggle Button components
[optimize] Module folder structure
1 parent d5ce2ac commit d3e8905

30 files changed

+184
-257
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "boot-cell",
3-
"version": "2.0.0-beta.26",
3+
"version": "2.0.0-beta.28",
44
"license": "LGPL-3.0",
55
"author": "shiy2008@gmail.com",
66
"description": "Web Components UI library based on WebCell v3, BootStrap v5, BootStrap Icon v1 & FontAwesome v6",
@@ -26,7 +26,7 @@
2626
"dependencies": {
2727
"@swc/helpers": "^0.5.11",
2828
"classnames": "^2.5.1",
29-
"dom-renderer": "^2.1.7",
29+
"dom-renderer": "^2.1.8",
3030
"mobx": "^6.12.4",
3131
"regenerator-runtime": "^0.14.1",
3232
"web-cell": "^3.0.0-rc.16",
@@ -64,10 +64,10 @@
6464
"open-cli": "^8.0.0",
6565
"parcel": "~2.12.0",
6666
"prettier": "^3.3.2",
67-
"ts-jest": "^29.1.4",
67+
"ts-jest": "^29.1.5",
6868
"ts-node": "^10.9.2",
6969
"typedoc": "^0.25.13",
70-
"typedoc-plugin-mdn-links": "^3.1.29",
70+
"typedoc-plugin-mdn-links": "^3.1.30",
7171
"typescript": "~5.4.5"
7272
},
7373
"scripts": {

pnpm-lock.yaml

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { computed, observable } from 'mobx';
22
import { WebCell, attribute, component, observer } from 'web-cell';
33

4-
import { Status } from './type';
4+
import { Status } from '../type';
55

66
interface TimeUnit {
77
scale: number;
@@ -101,7 +101,7 @@ export class CountDown extends HTMLElement implements WebCell<CountDownProps> {
101101
<ol className="list-inline text-white">
102102
{this.timeSections.map(({ value, label }, index) => (
103103
<li
104-
key={value}
104+
key={label}
105105
className={`list-inline-item fs-1 bg-${colors[index]} d-inline-flex align-items-center justify-content-center rounded-4`}
106106
style={{ width: '5.5rem', height: '5.5rem' }}
107107
>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {
1010
splitArray
1111
} from 'web-utility';
1212

13-
import { Badge } from './Reminder';
14-
import { Button, ButtonProps } from './Button';
15-
import { Table, TableProps } from './Content';
13+
import { Badge } from '../Reminder';
14+
import { Button, ButtonProps } from '../Form/Button';
15+
import { Table, TableProps } from '../Content';
1616

1717
export interface DateData {
1818
date: TimeData;

source/Content/Accordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
reaction
1111
} from 'web-cell';
1212

13-
import { CollapseProps, Collapse } from './Collapse';
13+
import { CollapseProps, Collapse } from '../Layout/Collapse';
1414

1515
export const AccordionItem: FC<WebCellProps<HTMLDivElement>> = ({
1616
className = '',

source/Content/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames';
22
import { FC, WebCellProps } from 'web-cell';
33

4-
import { Image, ImageProps } from '../Image';
4+
import { Image, ImageProps } from '../Media/Image';
55
import { TextColor, PositionY } from '../type';
66

77
export interface CardProps extends WebCellProps<HTMLDivElement> {

source/Content/Jumbotron.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { JsxChildren } from 'dom-renderer';
33
import { FC } from 'web-cell';
44

55
import { BackgroundColor } from '../type';
6-
import { Container, ContainerProps } from '../Grid';
6+
import { Container, ContainerProps } from '../Layout/Grid';
77

88
export interface JumbotronProps
99
extends Omit<ContainerProps, 'title'>,

source/Content/ListGroup.tsx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import classNames from 'classnames';
2+
import { FC, WebCellProps } from 'web-cell';
3+
4+
import { Size, Status, Theme } from '../type';
5+
6+
export interface ListGroupProps extends WebCellProps<HTMLDivElement> {
7+
variant?: 'flush';
8+
numbered?: boolean;
9+
horizontal?: true | Size;
10+
}
11+
12+
export const ListGroup: FC<ListGroupProps> = ({
13+
className = '',
14+
variant,
15+
numbered,
16+
horizontal,
17+
children,
18+
...props
19+
}) => (
20+
<div
21+
className={classNames(
22+
'list-group',
23+
variant && `list-group-${variant}`,
24+
numbered && `list-group-numbered`,
25+
horizontal &&
26+
`list-group-horizontal${horizontal === true ? '' : `-${horizontal}`}`,
27+
className
28+
)}
29+
{...props}
30+
>
31+
{children}
32+
</div>
33+
);
34+
35+
export interface ListGroupItemProps
36+
extends WebCellProps<HTMLAnchorElement>,
37+
Partial<Record<'active' | 'disabled', boolean>> {
38+
variant?: keyof typeof Status | keyof typeof Theme;
39+
}
40+
41+
export const ListGroupItem: FC<ListGroupItemProps> = ({
42+
className = '',
43+
variant,
44+
href,
45+
active,
46+
disabled,
47+
children,
48+
...props
49+
}) => (
50+
<a
51+
className={classNames(
52+
'list-group-item',
53+
variant && `list-group-item-${variant}`,
54+
href && 'list-group-item-action',
55+
{ active, disabled },
56+
disabled && 'pe-none',
57+
className
58+
)}
59+
ariaCurrent={active ? 'true' : undefined}
60+
ariaDisabled={disabled ? 'true' : undefined}
61+
{...{ href, ...props }}
62+
>
63+
{children}
64+
</a>
65+
);

source/Content/Tabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
reaction
1010
} from 'web-cell';
1111

12-
import { Nav, NavLink } from '../Nav';
12+
import { Nav, NavLink } from '../Navigator/Nav';
1313

1414
export interface TabProps {
1515
caption: JsxChildren;

source/Content/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
export * from './ListGroup';
12
export * from './Table';
23
export * from './Jumbotron';
34
export * from './Card';
45
export * from './MediaObject';
5-
export * from './ScrollBoundary';
6-
export * from './Collapse';
76
export * from './Accordion';
87
export * from './Tabs';

0 commit comments

Comments
 (0)