webcoreui 0.0.10 → 0.0.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.
- package/README.md +2 -0
- package/astro.d.ts +4 -0
- package/astro.js +4 -0
- package/components/Input/Input.astro +52 -0
- package/components/Input/Input.svelte +52 -0
- package/components/Input/Input.tsx +59 -0
- package/components/Input/input.scss +83 -0
- package/components/Input/input.ts +44 -0
- package/components/Table/Table.astro +60 -0
- package/components/Table/Table.svelte +54 -0
- package/components/Table/Table.tsx +63 -0
- package/components/Table/table.scss +65 -0
- package/components/Table/table.ts +10 -0
- package/package.json +1 -1
- package/react.d.ts +4 -0
- package/react.js +4 -0
- package/svelte.d.ts +4 -0
- package/svelte.js +4 -0
package/README.md
CHANGED
|
@@ -144,11 +144,13 @@ import { Accordion } from 'webcoreui/react'
|
|
|
144
144
|
- [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
|
|
145
145
|
- [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
|
|
146
146
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
147
|
+
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
147
148
|
- [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
|
|
148
149
|
- [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
|
|
149
150
|
- [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
|
|
150
151
|
- [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
|
|
151
152
|
- [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
|
|
153
|
+
- [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
|
|
152
154
|
- [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
|
|
153
155
|
- [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
|
|
154
156
|
- [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
|
package/astro.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ import type { CardProps } from './components/Card/card'
|
|
|
7
7
|
import type { CheckboxProps } from './components/Checkbox/checkbox'
|
|
8
8
|
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
9
|
import type { IconProps } from './components/Icon/icon'
|
|
10
|
+
import type { InputProps } from './components/Input/input'
|
|
10
11
|
import type { ProgressProps } from './components/Progress/progress'
|
|
11
12
|
import type { RadioProps } from './components/Radio/radio'
|
|
12
13
|
import type { RatingProps } from './components/Rating/rating'
|
|
13
14
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
14
15
|
import type { SwitchProps } from './components/Switch/switch'
|
|
16
|
+
import type { TableProps } from './components/Table/table'
|
|
15
17
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
16
18
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
17
19
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
@@ -27,11 +29,13 @@ declare module 'webcoreui/astro' {
|
|
|
27
29
|
export function Checkbox(_props: CheckboxProps): any
|
|
28
30
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
29
31
|
export function Icon(_props: IconProps): any
|
|
32
|
+
export function Input(_props: InputProps): any
|
|
30
33
|
export function Progress(_props: ProgressProps): any
|
|
31
34
|
export function Radio(_props: RadioProps): any
|
|
32
35
|
export function Rating(_props: RatingProps): any
|
|
33
36
|
export function Spinner(_props: SpinnerProps): any
|
|
34
37
|
export function Switch(_props: SwitchProps): any
|
|
38
|
+
export function Table(_props: TableProps): any
|
|
35
39
|
export function Tabs(_props: TabsProps): any
|
|
36
40
|
export function Timeline(_props: TimelineProps): any
|
|
37
41
|
export function TimelineItem(_props: TimelineItemProps): any
|
package/astro.js
CHANGED
|
@@ -7,11 +7,13 @@ import CardComponent from './components/Card/Card.astro'
|
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.astro'
|
|
8
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
9
9
|
import IconComponent from './components/Icon/Icon.astro'
|
|
10
|
+
import InputComponent from './components/Input/Input.astro'
|
|
10
11
|
import ProgressComponent from './components/Progress/Progress.astro'
|
|
11
12
|
import RadioComponent from './components/Radio/Radio.astro'
|
|
12
13
|
import RatingComponent from './components/Rating/Rating.astro'
|
|
13
14
|
import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
14
15
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
16
|
+
import TableComponent from './components/Table/Table.astro'
|
|
15
17
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
16
18
|
import TimelineComponent from './components/Timeline/Timeline.astro'
|
|
17
19
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
|
|
@@ -26,11 +28,13 @@ export const Card = CardComponent
|
|
|
26
28
|
export const Checkbox = CheckboxComponent
|
|
27
29
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
28
30
|
export const Icon = IconComponent
|
|
31
|
+
export const Input = InputComponent
|
|
29
32
|
export const Progress = ProgressComponent
|
|
30
33
|
export const Radio = RadioComponent
|
|
31
34
|
export const Rating = RatingComponent
|
|
32
35
|
export const Spinner = SpinnerComponent
|
|
33
36
|
export const Switch = SwitchComponent
|
|
37
|
+
export const Table = TableComponent
|
|
34
38
|
export const Tabs = TabsComponent
|
|
35
39
|
export const Timeline = TimelineComponent
|
|
36
40
|
export const TimelineItem = TimelineItemComponent
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { InputProps } from './input'
|
|
3
|
+
import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
|
+
|
|
5
|
+
import './input.scss'
|
|
6
|
+
|
|
7
|
+
interface Props extends InputProps {}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
type = 'text',
|
|
11
|
+
theme,
|
|
12
|
+
label,
|
|
13
|
+
subText,
|
|
14
|
+
fill,
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
} = Astro.props
|
|
18
|
+
|
|
19
|
+
const classes = [
|
|
20
|
+
'w-input',
|
|
21
|
+
theme,
|
|
22
|
+
fill && 'fill',
|
|
23
|
+
className
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
const useLabel = !!(label || subText || Astro.slots.has('icon'))
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<ConditionalWrapper condition={useLabel}>
|
|
30
|
+
<label slot="wrapper" class="w-input-label">
|
|
31
|
+
{label && (
|
|
32
|
+
<div class="label">{label}</div>
|
|
33
|
+
)}
|
|
34
|
+
<ConditionalWrapper condition={Astro.slots.has('icon')}>
|
|
35
|
+
<div class="input-wrapper" slot="wrapper">
|
|
36
|
+
children
|
|
37
|
+
</div>
|
|
38
|
+
<slot name="icon" />
|
|
39
|
+
children
|
|
40
|
+
</ConditionalWrapper>
|
|
41
|
+
{subText && (
|
|
42
|
+
<div class="subtext">
|
|
43
|
+
<Fragment set:html={subText} />
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
</label>
|
|
47
|
+
<input
|
|
48
|
+
type={type}
|
|
49
|
+
class:list={classes}
|
|
50
|
+
{...rest}
|
|
51
|
+
/>
|
|
52
|
+
</ConditionalWrapper>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputProps } from './input'
|
|
3
|
+
import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
+
import './input.scss'
|
|
5
|
+
|
|
6
|
+
export let type: InputProps['type'] = 'text'
|
|
7
|
+
export let theme: InputProps['theme'] = null
|
|
8
|
+
export let label: InputProps['label'] = ''
|
|
9
|
+
export let subText: InputProps['subText'] = ''
|
|
10
|
+
export let fill: InputProps['fill'] = false
|
|
11
|
+
export let className: InputProps['className'] = ''
|
|
12
|
+
export let onChange: (e: any) => any = () => {}
|
|
13
|
+
export let onKeyUp: (e: any) => any = () => {}
|
|
14
|
+
|
|
15
|
+
const classes = [
|
|
16
|
+
'w-input',
|
|
17
|
+
theme,
|
|
18
|
+
fill && 'fill',
|
|
19
|
+
className
|
|
20
|
+
].filter(Boolean).join(' ')
|
|
21
|
+
|
|
22
|
+
const useLabel = !!(label || subText || $$slots.icon)
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<ConditionalWrapper
|
|
26
|
+
condition={useLabel}
|
|
27
|
+
element="label"
|
|
28
|
+
class="w-input-label"
|
|
29
|
+
>
|
|
30
|
+
{#if label}
|
|
31
|
+
<div class="label">{label}</div>
|
|
32
|
+
{/if}
|
|
33
|
+
<ConditionalWrapper
|
|
34
|
+
condition={$$slots.icon}
|
|
35
|
+
element="div"
|
|
36
|
+
class="input-wrapper"
|
|
37
|
+
>
|
|
38
|
+
<slot name="icon" />
|
|
39
|
+
<input
|
|
40
|
+
type={type}
|
|
41
|
+
class={classes}
|
|
42
|
+
on:change={onChange}
|
|
43
|
+
on:keyup={onKeyUp}
|
|
44
|
+
{...$$restProps}
|
|
45
|
+
/>
|
|
46
|
+
</ConditionalWrapper>
|
|
47
|
+
{#if label}
|
|
48
|
+
<div class="subtext">
|
|
49
|
+
{@html subText}
|
|
50
|
+
</div>
|
|
51
|
+
{/if}
|
|
52
|
+
</ConditionalWrapper>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactInputProps } from './input'
|
|
3
|
+
import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.tsx'
|
|
4
|
+
|
|
5
|
+
import './input.scss'
|
|
6
|
+
|
|
7
|
+
const Input = ({
|
|
8
|
+
type = 'text',
|
|
9
|
+
theme,
|
|
10
|
+
label,
|
|
11
|
+
subText,
|
|
12
|
+
fill,
|
|
13
|
+
icon,
|
|
14
|
+
value,
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
}: ReactInputProps) => {
|
|
18
|
+
const classes = [
|
|
19
|
+
'w-input',
|
|
20
|
+
theme,
|
|
21
|
+
fill && 'fill',
|
|
22
|
+
className
|
|
23
|
+
].filter(Boolean).join(' ')
|
|
24
|
+
|
|
25
|
+
const useLabel = !!(label || subText || icon)
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ConditionalWrapper condition={useLabel} wrapper={children => (
|
|
29
|
+
<label className="w-input-label">
|
|
30
|
+
{children}
|
|
31
|
+
</label>
|
|
32
|
+
)}>
|
|
33
|
+
{label && (
|
|
34
|
+
<div className="label">{label}</div>
|
|
35
|
+
)}
|
|
36
|
+
<ConditionalWrapper condition={!!icon} wrapper={children => (
|
|
37
|
+
<div className="input-wrapper">
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
)}>
|
|
41
|
+
{icon && icon}
|
|
42
|
+
<input
|
|
43
|
+
type={type}
|
|
44
|
+
className={classes}
|
|
45
|
+
defaultValue={value}
|
|
46
|
+
{...rest}
|
|
47
|
+
/>
|
|
48
|
+
</ConditionalWrapper>
|
|
49
|
+
{subText && (
|
|
50
|
+
<div
|
|
51
|
+
className="subtext"
|
|
52
|
+
dangerouslySetInnerHTML={{ __html: subText }}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</ConditionalWrapper>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default Input
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-input {
|
|
4
|
+
border-radius: 2px;
|
|
5
|
+
padding: 5px 10px;
|
|
6
|
+
border: 1px solid #252525;
|
|
7
|
+
background: transparent;
|
|
8
|
+
font-family: Regular;
|
|
9
|
+
color: #FFF;
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
color-scheme: dark;
|
|
13
|
+
|
|
14
|
+
&[disabled] {
|
|
15
|
+
cursor: no-drop;
|
|
16
|
+
color: #555;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&::file-selector-button {
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: 0;
|
|
22
|
+
color: #FFF;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&[type="color"] {
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.info {
|
|
30
|
+
border-color: #48dbfb;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.success {
|
|
34
|
+
border-color: #1dd1a1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.warning {
|
|
38
|
+
border-color: #f7aa61;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.alert {
|
|
42
|
+
border-color: #ee5253;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.fill {
|
|
46
|
+
background: #252525;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.w-input-label {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
|
|
54
|
+
.label {
|
|
55
|
+
font-size: 16px;
|
|
56
|
+
color: #BBB;
|
|
57
|
+
margin-bottom: 5px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.input-wrapper {
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 10px;
|
|
63
|
+
align-items: center;
|
|
64
|
+
position: relative;
|
|
65
|
+
|
|
66
|
+
input {
|
|
67
|
+
padding-left: 40px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
svg {
|
|
71
|
+
position: absolute;
|
|
72
|
+
left: 10px;
|
|
73
|
+
width: 20px;
|
|
74
|
+
height: 20px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.subtext {
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
color: #555;
|
|
81
|
+
margin-top: 5px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type InputProps = {
|
|
2
|
+
type?: 'text'
|
|
3
|
+
| 'email'
|
|
4
|
+
| 'password'
|
|
5
|
+
| 'number'
|
|
6
|
+
| 'tel'
|
|
7
|
+
| 'url'
|
|
8
|
+
| 'search'
|
|
9
|
+
| 'file'
|
|
10
|
+
| 'date'
|
|
11
|
+
| 'datetime-local'
|
|
12
|
+
| 'month'
|
|
13
|
+
| 'week'
|
|
14
|
+
| 'time'
|
|
15
|
+
| 'color'
|
|
16
|
+
theme?: 'info'
|
|
17
|
+
| 'success'
|
|
18
|
+
| 'warning'
|
|
19
|
+
| 'alert'
|
|
20
|
+
| null
|
|
21
|
+
value?: string | number
|
|
22
|
+
name?: string
|
|
23
|
+
placeholder?: string
|
|
24
|
+
label?: string
|
|
25
|
+
disabled?: boolean
|
|
26
|
+
subText?: string
|
|
27
|
+
fill?: boolean
|
|
28
|
+
maxLength?: number
|
|
29
|
+
min?: number
|
|
30
|
+
max?: number
|
|
31
|
+
step?: number
|
|
32
|
+
multiple?: boolean
|
|
33
|
+
pattern?: string
|
|
34
|
+
required?: boolean
|
|
35
|
+
autofocus?: boolean
|
|
36
|
+
autocomplete?: 'on' | 'off'
|
|
37
|
+
className?: string
|
|
38
|
+
[key: string]: any
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ReactInputProps = {
|
|
42
|
+
icon?: string
|
|
43
|
+
children?: React.ReactNode
|
|
44
|
+
} & InputProps
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { TableProps } from './table'
|
|
3
|
+
import './table.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends TableProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
headings,
|
|
9
|
+
footer,
|
|
10
|
+
data,
|
|
11
|
+
hover,
|
|
12
|
+
striped,
|
|
13
|
+
offsetStripe,
|
|
14
|
+
compact,
|
|
15
|
+
className
|
|
16
|
+
} = Astro.props
|
|
17
|
+
|
|
18
|
+
const classes = [
|
|
19
|
+
'w-table',
|
|
20
|
+
hover && 'hover',
|
|
21
|
+
striped && `striped-${striped}s`,
|
|
22
|
+
offsetStripe && 'offset',
|
|
23
|
+
compact && 'compact',
|
|
24
|
+
className
|
|
25
|
+
]
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<div class:list={classes}>
|
|
29
|
+
<table>
|
|
30
|
+
{headings?.length && (
|
|
31
|
+
<thead>
|
|
32
|
+
<tr>
|
|
33
|
+
{headings.map(heading => (
|
|
34
|
+
<th>{heading}</th>
|
|
35
|
+
))}
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
)}
|
|
39
|
+
<tbody>
|
|
40
|
+
{data.map(row => (
|
|
41
|
+
<tr>
|
|
42
|
+
{row.map(column => (
|
|
43
|
+
<td>
|
|
44
|
+
<Fragment set:html={column} />
|
|
45
|
+
</td>
|
|
46
|
+
))}
|
|
47
|
+
</tr>
|
|
48
|
+
))}
|
|
49
|
+
</tbody>
|
|
50
|
+
{footer?.length && (
|
|
51
|
+
<tfoot>
|
|
52
|
+
<tr>
|
|
53
|
+
{footer.map(data => (
|
|
54
|
+
<td>{data}</td>
|
|
55
|
+
))}
|
|
56
|
+
</tr>
|
|
57
|
+
</tfoot>
|
|
58
|
+
)}
|
|
59
|
+
</table>
|
|
60
|
+
</div>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableProps } from './table'
|
|
3
|
+
import './table.scss'
|
|
4
|
+
|
|
5
|
+
export let headings: TableProps['headings'] = []
|
|
6
|
+
export let footer: TableProps['footer'] = []
|
|
7
|
+
export let data: TableProps['data'] = []
|
|
8
|
+
export let hover: TableProps['hover'] = false
|
|
9
|
+
export let striped: TableProps['striped'] = null
|
|
10
|
+
export let offsetStripe: TableProps['offsetStripe'] = false
|
|
11
|
+
export let compact: TableProps['compact'] = false
|
|
12
|
+
export let className: TableProps['className'] = ''
|
|
13
|
+
|
|
14
|
+
const classes = [
|
|
15
|
+
'w-table',
|
|
16
|
+
hover && 'hover',
|
|
17
|
+
striped && `striped-${striped}s`,
|
|
18
|
+
offsetStripe && 'offset',
|
|
19
|
+
compact && 'compact',
|
|
20
|
+
className
|
|
21
|
+
].filter(Boolean).join(' ')
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class={classes}>
|
|
25
|
+
<table>
|
|
26
|
+
{#if headings?.length}
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
{#each headings as heading}
|
|
30
|
+
<th>{heading}</th>
|
|
31
|
+
{/each}
|
|
32
|
+
</tr>
|
|
33
|
+
</thead>
|
|
34
|
+
{/if}
|
|
35
|
+
<tbody>
|
|
36
|
+
{#each data as row}
|
|
37
|
+
<tr>
|
|
38
|
+
{#each row as column}
|
|
39
|
+
<td>{@html column}</td>
|
|
40
|
+
{/each}
|
|
41
|
+
</tr>
|
|
42
|
+
{/each}
|
|
43
|
+
</tbody>
|
|
44
|
+
{#if footer?.length}
|
|
45
|
+
<tfoot>
|
|
46
|
+
<tr>
|
|
47
|
+
{#each footer as data}
|
|
48
|
+
<td>{data}</td>
|
|
49
|
+
{/each}
|
|
50
|
+
</tr>
|
|
51
|
+
</tfoot>
|
|
52
|
+
{/if}
|
|
53
|
+
</table>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { TableProps } from './table'
|
|
3
|
+
|
|
4
|
+
import './table.scss'
|
|
5
|
+
|
|
6
|
+
const Table = ({
|
|
7
|
+
headings,
|
|
8
|
+
footer,
|
|
9
|
+
data,
|
|
10
|
+
hover,
|
|
11
|
+
striped,
|
|
12
|
+
offsetStripe,
|
|
13
|
+
compact,
|
|
14
|
+
className
|
|
15
|
+
}: TableProps) => {
|
|
16
|
+
const classes = [
|
|
17
|
+
'w-table',
|
|
18
|
+
hover && 'hover',
|
|
19
|
+
striped && `striped-${striped}s`,
|
|
20
|
+
offsetStripe && 'offset',
|
|
21
|
+
compact && 'compact',
|
|
22
|
+
className
|
|
23
|
+
].filter(Boolean).join(' ')
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={classes}>
|
|
27
|
+
<table>
|
|
28
|
+
{headings?.length && (
|
|
29
|
+
<thead>
|
|
30
|
+
<tr>
|
|
31
|
+
{headings.map((heading, index) => (
|
|
32
|
+
<th key={index}>{heading}</th>
|
|
33
|
+
))}
|
|
34
|
+
</tr>
|
|
35
|
+
</thead>
|
|
36
|
+
)}
|
|
37
|
+
<tbody>
|
|
38
|
+
{data.map((row, rowIndex) => (
|
|
39
|
+
<tr key={rowIndex}>
|
|
40
|
+
{row.map((column, columnIndex) => (
|
|
41
|
+
<td
|
|
42
|
+
key={columnIndex}
|
|
43
|
+
dangerouslySetInnerHTML={{ __html: column }}
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</tr>
|
|
47
|
+
))}
|
|
48
|
+
</tbody>
|
|
49
|
+
{footer?.length && (
|
|
50
|
+
<tfoot>
|
|
51
|
+
<tr>
|
|
52
|
+
{footer.map((data, index) => (
|
|
53
|
+
<td key={index}>{data}</td>
|
|
54
|
+
))}
|
|
55
|
+
</tr>
|
|
56
|
+
</tfoot>
|
|
57
|
+
)}
|
|
58
|
+
</table>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default Table
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-table {
|
|
4
|
+
overflow-x: auto;
|
|
5
|
+
|
|
6
|
+
table {
|
|
7
|
+
width: 100%;
|
|
8
|
+
border-collapse: collapse;
|
|
9
|
+
text-align: left;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
thead,
|
|
14
|
+
tfoot {
|
|
15
|
+
font-family: Bold;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
th,
|
|
19
|
+
td {
|
|
20
|
+
padding: 5px 10px;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
thead,
|
|
25
|
+
tr {
|
|
26
|
+
border-bottom: 1px solid #252525;
|
|
27
|
+
|
|
28
|
+
&:last-child {
|
|
29
|
+
border-bottom: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
a {
|
|
34
|
+
text-decoration: underline;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
tfoot,
|
|
38
|
+
&.hover tr:hover,
|
|
39
|
+
&.striped-rows tbody tr:nth-child(odd),
|
|
40
|
+
&.striped-rows.offset tbody tr:nth-child(even),
|
|
41
|
+
&.striped-columns td:nth-child(odd),
|
|
42
|
+
&.striped-columns.offset td:nth-child(even) {
|
|
43
|
+
background: #111;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.striped-rows tr,
|
|
47
|
+
&.striped-rows thead,
|
|
48
|
+
&.striped-columns tr,
|
|
49
|
+
&.striped-columns thead {
|
|
50
|
+
border-bottom: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.striped-rows.offset tbody tr:nth-child(odd),
|
|
54
|
+
&.striped-rows.offset tfoot,
|
|
55
|
+
&.striped-columns.offset td:nth-child(odd),
|
|
56
|
+
&.striped-columns tfoot {
|
|
57
|
+
background: transparent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.compact {
|
|
61
|
+
th, td {
|
|
62
|
+
padding: 3px 10px;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
package/package.json
CHANGED
package/react.d.ts
CHANGED
|
@@ -8,11 +8,13 @@ import type { ReactCardProps } from './components/Card/card'
|
|
|
8
8
|
import type { ReactCheckboxProps } from './components/Checkbox/checkbox'
|
|
9
9
|
import type { ReactConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
10
10
|
import type { IconProps } from './components/Icon/icon'
|
|
11
|
+
import type { ReactInputProps } from './components/Input/input'
|
|
11
12
|
import type { ProgressProps } from './components/Progress/progress'
|
|
12
13
|
import type { ReactRadioProps } from './components/Radio/radio'
|
|
13
14
|
import type { RatingProps } from './components/Rating/rating'
|
|
14
15
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
15
16
|
import type { ReactSwitchProps } from './components/Switch/switch'
|
|
17
|
+
import type { TableProps } from './components/Table/table'
|
|
16
18
|
import type { ReactTabsProps } from './components/Tabs/tabs'
|
|
17
19
|
import type { ReactTimelineProps } from './components/Timeline/timeline'
|
|
18
20
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
@@ -28,11 +30,13 @@ declare module 'webcoreui/react' {
|
|
|
28
30
|
export const Checkbox: FC<ReactCheckboxProps>
|
|
29
31
|
export const ConditionalWrapper: FC<ReactConditionalWrapperProps>
|
|
30
32
|
export const Icon: FC<IconProps>
|
|
33
|
+
export const Input: FC<ReactInputProps>
|
|
31
34
|
export const Progress: FC<ProgressProps>
|
|
32
35
|
export const Radio: FC<ReactRadioProps>
|
|
33
36
|
export const Rating: FC<RatingProps>
|
|
34
37
|
export const Spinner: FC<SpinnerProps>
|
|
35
38
|
export const Switch: FC<ReactSwitchProps>
|
|
39
|
+
export const Table: FC<TableProps>
|
|
36
40
|
export const Tabs: FC<ReactTabsProps>
|
|
37
41
|
export const Timeline: FC<ReactTimelineProps>
|
|
38
42
|
export const TimelineItem: FC<TimelineItemProps>
|
package/react.js
CHANGED
|
@@ -7,11 +7,13 @@ import CardComponent from './components/Card/Card.tsx'
|
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.tsx'
|
|
8
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.tsx'
|
|
9
9
|
import IconComponent from './components/Icon/Icon.tsx'
|
|
10
|
+
import InputComponent from './components/Input/Input.tsx'
|
|
10
11
|
import ProgressComponent from './components/Progress/Progress.tsx'
|
|
11
12
|
import RadioComponent from './components/Radio/Radio.tsx'
|
|
12
13
|
import RatingComponent from './components/Rating/Rating.tsx'
|
|
13
14
|
import SpinnerComponent from './components/Spinner/Spinner.tsx'
|
|
14
15
|
import SwitchComponent from './components/Switch/Switch.tsx'
|
|
16
|
+
import TableComponent from './components/Table/Table.tsx'
|
|
15
17
|
import TabsComponent from './components/Tabs/Tabs.tsx'
|
|
16
18
|
import TimelineComponent from './components/Timeline/Timeline.tsx'
|
|
17
19
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.tsx'
|
|
@@ -26,11 +28,13 @@ export const Card = CardComponent
|
|
|
26
28
|
export const Checkbox = CheckboxComponent
|
|
27
29
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
28
30
|
export const Icon = IconComponent
|
|
31
|
+
export const Input = InputComponent
|
|
29
32
|
export const Progress = ProgressComponent
|
|
30
33
|
export const Radio = RadioComponent
|
|
31
34
|
export const Rating = RatingComponent
|
|
32
35
|
export const Spinner = SpinnerComponent
|
|
33
36
|
export const Switch = SwitchComponent
|
|
37
|
+
export const Table = TableComponent
|
|
34
38
|
export const Tabs = TabsComponent
|
|
35
39
|
export const Timeline = TimelineComponent
|
|
36
40
|
export const TimelineItem = TimelineItemComponent
|
package/svelte.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ import type { CardProps } from './components/Card/card'
|
|
|
7
7
|
import type { CheckboxProps } from './components/Checkbox/checkbox'
|
|
8
8
|
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
9
|
import type { IconProps } from './components/Icon/icon'
|
|
10
|
+
import type { InputProps } from './components/Input/input'
|
|
10
11
|
import type { ProgressProps } from './components/Progress/progress'
|
|
11
12
|
import type { RadioProps } from './components/Radio/radio'
|
|
12
13
|
import type { RatingProps } from './components/Rating/rating'
|
|
13
14
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
14
15
|
import type { SwitchProps } from './components/Switch/switch'
|
|
16
|
+
import type { TableProps } from './components/Table/table'
|
|
15
17
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
16
18
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
17
19
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
@@ -27,11 +29,13 @@ declare module 'webcoreui/svelte' {
|
|
|
27
29
|
export function Checkbox(_props: CheckboxProps): any
|
|
28
30
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
29
31
|
export function Icon(_props: IconProps): any
|
|
32
|
+
export function Input(_props: InputProps): any
|
|
30
33
|
export function Progress(_props: ProgressProps): any
|
|
31
34
|
export function Radio(_props: RadioProps): any
|
|
32
35
|
export function Rating(_props: RatingProps): any
|
|
33
36
|
export function Spinner(_props: SpinnerProps): any
|
|
34
37
|
export function Switch(_props: SwitchProps): any
|
|
38
|
+
export function Table(_props: TableProps): any
|
|
35
39
|
export function Tabs(_props: TabsProps): any
|
|
36
40
|
export function Timeline(_props: TimelineProps): any
|
|
37
41
|
export function TimelineItem(_props: TimelineItemProps): any
|
package/svelte.js
CHANGED
|
@@ -7,11 +7,13 @@ import CardComponent from './components/Card/Card.svelte'
|
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.svelte'
|
|
8
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
|
|
9
9
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
10
|
+
import InputComponent from './components/Input/Input.svelte'
|
|
10
11
|
import ProgressComponent from './components/Progress/Progress.svelte'
|
|
11
12
|
import RadioComponent from './components/Radio/Radio.svelte'
|
|
12
13
|
import RatingComponent from './components/Rating/Rating.svelte'
|
|
13
14
|
import SpinnerComponent from './components/Spinner/Spinner.svelte'
|
|
14
15
|
import SwitchComponent from './components/Switch/Switch.svelte'
|
|
16
|
+
import TableComponent from './components/Table/Table.svelte'
|
|
15
17
|
import TabsComponent from './components/Tabs/Tabs.svelte'
|
|
16
18
|
import TimelineComponent from './components/Timeline/Timeline.svelte'
|
|
17
19
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.svelte'
|
|
@@ -26,11 +28,13 @@ export const Card = CardComponent
|
|
|
26
28
|
export const Checkbox = CheckboxComponent
|
|
27
29
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
28
30
|
export const Icon = IconComponent
|
|
31
|
+
export const Input = InputComponent
|
|
29
32
|
export const Progress = ProgressComponent
|
|
30
33
|
export const Radio = RadioComponent
|
|
31
34
|
export const Rating = RatingComponent
|
|
32
35
|
export const Spinner = SpinnerComponent
|
|
33
36
|
export const Switch = SwitchComponent
|
|
37
|
+
export const Table = TableComponent
|
|
34
38
|
export const Tabs = TabsComponent
|
|
35
39
|
export const Timeline = TimelineComponent
|
|
36
40
|
export const TimelineItem = TimelineItemComponent
|