Skip to content

Commit d5ce2ac

Browse files
authored
[refactor] Progress Bar, Modal & Dialog components (#23)
1 parent 18ef29d commit d5ce2ac

30 files changed

+273
-260
lines changed

package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "boot-cell",
3-
"version": "2.0.0-beta.23",
3+
"version": "2.0.0-beta.26",
44
"license": "LGPL-3.0",
55
"author": "[email protected]",
66
"description": "Web Components UI library based on WebCell v3, BootStrap v5, BootStrap Icon v1 & FontAwesome v6",
@@ -27,9 +27,9 @@
2727
"@swc/helpers": "^0.5.11",
2828
"classnames": "^2.5.1",
2929
"dom-renderer": "^2.1.7",
30-
"mobx": "^6.12.3",
30+
"mobx": "^6.12.4",
3131
"regenerator-runtime": "^0.14.1",
32-
"web-cell": "^3.0.0-rc.15",
32+
"web-cell": "^3.0.0-rc.16",
3333
"web-utility": "^4.4.0"
3434
},
3535
"peerDependencies": {
@@ -49,7 +49,6 @@
4949
"@parcel/transformer-typescript-types": "~2.12.0",
5050
"@peculiar/webcrypto": "^1.5.0",
5151
"@tech_query/snabbdom-looks-like": "^2.0.1",
52-
"@types/classnames": "^2.3.1",
5352
"@types/jest": "^29.5.12",
5453
"@types/resize-observer-browser": "^0.1.11",
5554
"@types/turndown": "^5.0.4",
@@ -60,7 +59,7 @@
6059
"iterable-observer": "^1.0.1",
6160
"jest": "^29.7.0",
6261
"less": "^4.2.0",
63-
"lint-staged": "^15.2.6",
62+
"lint-staged": "^15.2.7",
6463
"markdown-area-element": "^0.2.3",
6564
"open-cli": "^8.0.0",
6665
"parcel": "~2.12.0",

pnpm-lock.yaml

+16-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/Button.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { FC, WebCellProps } from 'web-cell';
44

55
import { FormControlProps } from './Form';
66
import { Icon, IconProps } from './Reminder';
7-
import { Color } from './type';
7+
import { TextColor } from './type';
88

99
export interface ButtonProps
1010
extends WebCellProps<HTMLButtonElement>,
1111
Omit<WebCellProps<HTMLAnchorElement>, 'type'>,
1212
Pick<FormControlProps<'input'>, 'size'> {
13-
variant?: Color | `outline-${Color}` | 'link';
13+
variant?: TextColor | `outline-${TextColor}` | 'link';
1414
active?: boolean;
1515
}
1616

source/Carousel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class Carousel extends HTMLElement implements WebCell<CarouselProps> {
178178
<>
179179
<link
180180
rel="stylesheet"
181-
href="https://unpkg.com/[email protected].2/dist/css/bootstrap.min.css"
181+
href="https://unpkg.com/[email protected].3/dist/css/bootstrap.min.css"
182182
/>
183183
{this.renderContent()}
184184
</>
File renamed without changes.

source/Card.tsx source/Content/Card.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import classNames from 'classnames';
22
import { FC, WebCellProps } from 'web-cell';
33

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

77
export interface CardProps extends WebCellProps<HTMLDivElement> {
8-
bg?: Color;
9-
text?: Color | 'white' | 'muted';
10-
border?: Color;
8+
bg?: TextColor;
9+
text?: TextColor | 'white' | 'muted';
10+
border?: TextColor;
1111
body?: boolean;
1212
}
1313

File renamed without changes.

source/Jumbotron.tsx source/Content/Jumbotron.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import classNames from 'classnames';
22
import { JsxChildren } from 'dom-renderer';
33
import { FC } from 'web-cell';
44

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

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

source/MediaObject.tsx source/Content/MediaObject.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const MediaObject: FC<MediaObjectProps> = ({
1717
image,
1818
imageRow = 'start',
1919
imageColumn = 'start',
20-
defaultSlot,
20+
children,
2121
...rest
2222
}) => {
2323
const start = imageColumn === 'start';
@@ -39,7 +39,7 @@ export const MediaObject: FC<MediaObjectProps> = ({
3939
</div>
4040
<div className={`flex-grow-1 ${start ? 'ms-3' : 'me-3'}`}>
4141
<h5 className="mt-0">{title}</h5>
42-
{defaultSlot}
42+
{children}
4343
</div>
4444
</>
4545
);
File renamed without changes.

source/Table.tsx source/Content/Table.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import classNames from 'classnames';
22
import { FC, WebCellProps } from 'web-cell';
33

4-
import { Color, Size } from './type';
4+
import { TextColor, Size } from '../type';
55

66
export interface TableProps extends WebCellProps<HTMLTableElement> {
7-
variant?: Color;
7+
variant?: TextColor;
88
size?: 'sm';
99
responsive?: boolean | Size;
1010
striped?: boolean | 'columns';

source/Tabs.tsx source/Content/Tabs.tsx

+2-2
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 '../Nav';
1313

1414
export interface TabProps {
1515
caption: JsxChildren;
@@ -108,7 +108,7 @@ export class Tabs extends HTMLElement implements WebCell {
108108
<>
109109
<link
110110
rel="stylesheet"
111-
href="https://unpkg.com/[email protected].2/dist/css/bootstrap.min.css"
111+
href="https://unpkg.com/[email protected].3/dist/css/bootstrap.min.css"
112112
/>
113113
{this.renderContent()}
114114
</>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
export * from './ListGroup';
21
export * from './Table';
32
export * from './Jumbotron';
43
export * from './Card';
54
export * from './MediaObject';
6-
export * from './EdgeDetector';
5+
export * from './ScrollBoundary';
76
export * from './Collapse';
87
export * from './Accordion';
9-
export * from './TabView';
8+
export * from './Tabs';

source/Dropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class DropdownButton extends HTMLElement {
111111
<>
112112
<link
113113
rel="stylesheet"
114-
href="https://unpkg.com/[email protected].2/dist/css/bootstrap.min.css"
114+
href="https://unpkg.com/[email protected].3/dist/css/bootstrap.min.css"
115115
/>
116116
<style>
117117
{`:host {

source/MonthCalendar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212

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

1717
export interface DateData {
1818
date: TimeData;

source/Navbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class OffcanvasNavbar extends HTMLElement implements WebCell {
198198
<>
199199
<link
200200
rel="stylesheet"
201-
href="https://unpkg.com/[email protected].2/dist/css/bootstrap.min.css"
201+
href="https://unpkg.com/[email protected].3/dist/css/bootstrap.min.css"
202202
/>
203203
{this.renderContent()}
204204
</>

source/Prompt/Dialog.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Defer } from 'iterable-observer';
2+
import { observable } from 'mobx';
3+
import { FC, observer } from 'web-cell';
4+
5+
export class DialogClose extends Error {
6+
constructor(message = 'Dialog closed') {
7+
super(message);
8+
}
9+
}
10+
11+
export interface DialogProps<T = any> {
12+
defer?: Defer<T>;
13+
}
14+
15+
export class Dialog<T = any> {
16+
@observable
17+
accessor defer: Defer<T> | undefined;
18+
19+
Component: FC;
20+
21+
constructor(Factory: FC<DialogProps<T>>) {
22+
this.Component = observer(() => <Factory defer={this.defer} />);
23+
}
24+
25+
open() {
26+
this.defer = new Defer();
27+
28+
this.defer.promise.finally(() => (this.defer = undefined));
29+
30+
return this.defer.promise;
31+
}
32+
}

0 commit comments

Comments
 (0)