webcoreui 0.0.8 → 0.0.10
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 +26 -11
- package/astro.d.ts +31 -11
- package/astro.js +23 -1
- package/components/Alert/Alert.astro +3 -5
- package/components/Alert/Alert.svelte +3 -5
- package/components/Alert/Alert.tsx +3 -3
- package/components/Alert/alert.scss +1 -0
- package/components/Alert/alert.ts +6 -1
- package/components/Avatar/Avatar.astro +51 -0
- package/components/Avatar/Avatar.svelte +48 -0
- package/components/Avatar/Avatar.tsx +64 -0
- package/components/Avatar/avatar.scss +35 -0
- package/components/Avatar/avatar.ts +10 -0
- package/components/Badge/Badge.astro +4 -7
- package/components/Badge/Badge.svelte +2 -5
- package/components/Badge/Badge.tsx +3 -3
- package/components/Badge/badge.ts +4 -1
- package/components/Button/Button.astro +1 -4
- package/components/Button/Button.svelte +1 -4
- package/components/Button/Button.tsx +2 -2
- package/components/Button/button.scss +0 -1
- package/components/Button/button.ts +4 -0
- package/components/Card/Card.astro +2 -5
- package/components/Card/Card.svelte +1 -4
- package/components/Card/Card.tsx +2 -2
- package/components/Card/card.scss +1 -0
- package/components/Card/card.ts +7 -0
- package/components/Checkbox/Checkbox.astro +51 -0
- package/components/Checkbox/Checkbox.svelte +52 -0
- package/components/Checkbox/Checkbox.tsx +65 -0
- package/components/Checkbox/checkbox.scss +85 -0
- package/components/Checkbox/checkbox.ts +12 -0
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
- package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
- package/components/Progress/Progress.astro +40 -0
- package/components/Progress/Progress.svelte +38 -0
- package/components/Progress/Progress.tsx +47 -0
- package/components/Progress/progress.scss +66 -0
- package/components/Progress/progress.ts +12 -0
- package/components/Radio/Radio.astro +57 -0
- package/components/Radio/Radio.svelte +56 -0
- package/components/Radio/Radio.tsx +68 -0
- package/components/Radio/radio.scss +92 -0
- package/components/Radio/radio.ts +17 -0
- package/components/Rating/Rating.astro +66 -0
- package/components/Rating/Rating.svelte +70 -0
- package/components/Rating/Rating.tsx +67 -0
- package/components/Rating/rating.scss +37 -0
- package/components/Rating/rating.ts +16 -0
- package/components/Spinner/Spinner.astro +42 -0
- package/components/Spinner/Spinner.svelte +38 -0
- package/components/Spinner/Spinner.tsx +44 -0
- package/components/Spinner/spinner.scss +41 -0
- package/components/Spinner/spinner.ts +7 -0
- package/components/Switch/Switch.astro +38 -0
- package/components/Switch/Switch.svelte +42 -0
- package/components/Switch/Switch.tsx +46 -0
- package/components/Switch/switch.scss +84 -0
- package/components/Switch/switch.ts +15 -0
- package/components/Tabs/Tabs.astro +76 -0
- package/components/Tabs/Tabs.svelte +54 -0
- package/components/Tabs/Tabs.tsx +69 -0
- package/components/Tabs/tabs.scss +134 -0
- package/components/Tabs/tabs.ts +16 -0
- package/components/Timeline/Timeline.astro +34 -0
- package/components/Timeline/Timeline.svelte +30 -0
- package/components/Timeline/Timeline.tsx +37 -0
- package/components/Timeline/timeline.scss +71 -0
- package/components/Timeline/timeline.ts +61 -0
- package/components/TimelineItem/TimelineItem.astro +26 -0
- package/components/TimelineItem/TimelineItem.svelte +22 -0
- package/components/TimelineItem/TimelineItem.tsx +32 -0
- package/components/TimelineItem/timelineitem.scss +31 -0
- package/components/TimelineItem/timelineitem.ts +5 -0
- package/components/Toast/Toast.astro +30 -0
- package/components/Toast/Toast.svelte +21 -0
- package/components/Toast/Toast.tsx +28 -0
- package/components/Toast/toast.scss +43 -0
- package/components/Toast/toast.ts +11 -0
- package/icons/check.svg +1 -2
- package/icons/circle-check.svg +4 -0
- package/index.js +1 -0
- package/package.json +5 -2
- package/react.d.ts +38 -17
- package/react.js +23 -1
- package/scss/global/tooltip.scss +133 -0
- package/scss/global/utility.scss +17 -0
- package/scss/global.scss +1 -0
- package/scss/resets.scss +4 -0
- package/scss/setup.scss +31 -1
- package/svelte.d.ts +31 -11
- package/svelte.js +23 -1
- package/utils/toast.ts +65 -0
package/scss/setup.scss
CHANGED
|
@@ -3,9 +3,35 @@
|
|
|
3
3
|
$config: (
|
|
4
4
|
includeResets: true,
|
|
5
5
|
includeHelperClasses: true,
|
|
6
|
-
includeElementStyles: true
|
|
6
|
+
includeElementStyles: true,
|
|
7
|
+
includeTooltip: true
|
|
7
8
|
);
|
|
8
9
|
|
|
10
|
+
:root {
|
|
11
|
+
--w-avatar-border: #000;
|
|
12
|
+
--w-rating-color: #FFF;
|
|
13
|
+
--w-rating-empty-color: #BBB;
|
|
14
|
+
--w-rating-size: 18px;
|
|
15
|
+
--w-switch-off-color: #252525;
|
|
16
|
+
--w-switch-on-color: #FFF;
|
|
17
|
+
--w-checkbox-color: #FFF;
|
|
18
|
+
--w-radio-color: #FFF;
|
|
19
|
+
--w-spinner-color: #FFF;
|
|
20
|
+
--w-spinner-width: 2px;
|
|
21
|
+
--w-spinner-speed: 2s;
|
|
22
|
+
--w-spinner-size: 30px;
|
|
23
|
+
--w-spinner-dash: 8;
|
|
24
|
+
--w-tooltip-background: #FFF;
|
|
25
|
+
--w-tooltip-color: #000;
|
|
26
|
+
--w-timeline-color: #252525;
|
|
27
|
+
--w-timeline-text-color: #FFF;
|
|
28
|
+
--w-timeline-counter: decimal;
|
|
29
|
+
--w-progress-color: #FFF;
|
|
30
|
+
--w-progress-background: #252525;
|
|
31
|
+
--w-progress-stripe-light: #FFF;
|
|
32
|
+
--w-progress-stripe-dark: #DDD;
|
|
33
|
+
}
|
|
34
|
+
|
|
9
35
|
@function config($key) {
|
|
10
36
|
@return map.get($config, $key);
|
|
11
37
|
}
|
|
@@ -24,4 +50,8 @@ $config: (
|
|
|
24
50
|
@if (config('includeElementStyles')) {
|
|
25
51
|
@include Elements();
|
|
26
52
|
}
|
|
53
|
+
|
|
54
|
+
@if (config('includeTooltip')) {
|
|
55
|
+
@include Tooltip();
|
|
56
|
+
}
|
|
27
57
|
}
|
package/svelte.d.ts
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AccordionProps } from './components/Accordion/accordion'
|
|
2
|
+
import type { AlertProps } from './components/Alert/alert'
|
|
3
|
+
import type { AvatarProps } from './components/Avatar/avatar'
|
|
4
|
+
import type { BadgeProps } from './components/Badge/badge'
|
|
5
|
+
import type { ButtonProps } from './components/Button/button'
|
|
6
|
+
import type { CardProps } from './components/Card/card'
|
|
7
|
+
import type { CheckboxProps } from './components/Checkbox/checkbox'
|
|
8
|
+
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
|
+
import type { IconProps } from './components/Icon/icon'
|
|
10
|
+
import type { ProgressProps } from './components/Progress/progress'
|
|
11
|
+
import type { RadioProps } from './components/Radio/radio'
|
|
12
|
+
import type { RatingProps } from './components/Rating/rating'
|
|
13
|
+
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
14
|
+
import type { SwitchProps } from './components/Switch/switch'
|
|
15
|
+
import type { TabsProps } from './components/Tabs/tabs'
|
|
16
|
+
import type { TimelineProps } from './components/Timeline/timeline'
|
|
17
|
+
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
18
|
+
import type { ToastProps } from './components/Toast/toast'
|
|
19
|
+
|
|
2
20
|
declare module 'webcoreui/svelte' {
|
|
3
|
-
import type { AccordionProps } from './components/Accordion/accordion'
|
|
4
|
-
import type { AlertProps } from './components/Alert/alert'
|
|
5
|
-
import type { BadgeProps } from './components/Badge/badge'
|
|
6
|
-
import type { ButtonProps } from './components/Button/button'
|
|
7
|
-
import type { CardProps } from './components/Card/card'
|
|
8
|
-
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
|
-
import type { IconProps } from './components/Icon/icon'
|
|
10
|
-
|
|
11
21
|
export function Accordion(_props: AccordionProps): any
|
|
12
22
|
export function Alert(_props: AlertProps): any
|
|
23
|
+
export function Avatar(_props: AvatarProps): any
|
|
13
24
|
export function Badge(_props: BadgeProps): any
|
|
14
25
|
export function Button(_props: ButtonProps): any
|
|
15
26
|
export function Card(_props: CardProps): any
|
|
27
|
+
export function Checkbox(_props: CheckboxProps): any
|
|
16
28
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
17
29
|
export function Icon(_props: IconProps): any
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
export function Progress(_props: ProgressProps): any
|
|
31
|
+
export function Radio(_props: RadioProps): any
|
|
32
|
+
export function Rating(_props: RatingProps): any
|
|
33
|
+
export function Spinner(_props: SpinnerProps): any
|
|
34
|
+
export function Switch(_props: SwitchProps): any
|
|
35
|
+
export function Tabs(_props: TabsProps): any
|
|
36
|
+
export function Timeline(_props: TimelineProps): any
|
|
37
|
+
export function TimelineItem(_props: TimelineItemProps): any
|
|
38
|
+
export function Toast(_props: ToastProps): any
|
|
39
|
+
}
|
package/svelte.js
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
import AccordionComponent from './components/Accordion/Accordion.svelte'
|
|
2
2
|
import AlertComponent from './components/Alert/Alert.svelte'
|
|
3
|
+
import AvatarComponent from './components/Avatar/Avatar.svelte'
|
|
3
4
|
import BadgeComponent from './components/Badge/Badge.svelte'
|
|
4
5
|
import ButtonComponent from './components/Button/Button.svelte'
|
|
5
6
|
import CardComponent from './components/Card/Card.svelte'
|
|
7
|
+
import CheckboxComponent from './components/Checkbox/Checkbox.svelte'
|
|
6
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
|
|
7
9
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
10
|
+
import ProgressComponent from './components/Progress/Progress.svelte'
|
|
11
|
+
import RadioComponent from './components/Radio/Radio.svelte'
|
|
12
|
+
import RatingComponent from './components/Rating/Rating.svelte'
|
|
13
|
+
import SpinnerComponent from './components/Spinner/Spinner.svelte'
|
|
14
|
+
import SwitchComponent from './components/Switch/Switch.svelte'
|
|
15
|
+
import TabsComponent from './components/Tabs/Tabs.svelte'
|
|
16
|
+
import TimelineComponent from './components/Timeline/Timeline.svelte'
|
|
17
|
+
import TimelineItemComponent from './components/TimelineItem/TimelineItem.svelte'
|
|
18
|
+
import ToastComponent from './components/Toast/Toast.svelte'
|
|
8
19
|
|
|
9
20
|
export const Accordion = AccordionComponent
|
|
10
21
|
export const Alert = AlertComponent
|
|
22
|
+
export const Avatar = AvatarComponent
|
|
11
23
|
export const Badge = BadgeComponent
|
|
12
24
|
export const Button = ButtonComponent
|
|
13
25
|
export const Card = CardComponent
|
|
26
|
+
export const Checkbox = CheckboxComponent
|
|
14
27
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
15
|
-
export const Icon = IconComponent
|
|
28
|
+
export const Icon = IconComponent
|
|
29
|
+
export const Progress = ProgressComponent
|
|
30
|
+
export const Radio = RadioComponent
|
|
31
|
+
export const Rating = RatingComponent
|
|
32
|
+
export const Spinner = SpinnerComponent
|
|
33
|
+
export const Switch = SwitchComponent
|
|
34
|
+
export const Tabs = TabsComponent
|
|
35
|
+
export const Timeline = TimelineComponent
|
|
36
|
+
export const TimelineItem = TimelineItemComponent
|
|
37
|
+
export const Toast = ToastComponent
|
package/utils/toast.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { AlertProps } from '../components/Alert/alert'
|
|
2
|
+
|
|
3
|
+
type Toast = {
|
|
4
|
+
element: string
|
|
5
|
+
timeout?: number
|
|
6
|
+
title?: AlertProps['title']
|
|
7
|
+
content?: string
|
|
8
|
+
theme?: AlertProps['theme']
|
|
9
|
+
position?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let defaultTimeout = 5000
|
|
13
|
+
|
|
14
|
+
export let setDefaultTimeout = (time: number) => defaultTimeout = time
|
|
15
|
+
|
|
16
|
+
export const toast = (config: Toast | string) => {
|
|
17
|
+
const element = typeof config === 'string'
|
|
18
|
+
? config
|
|
19
|
+
: config.element
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
timeout,
|
|
23
|
+
title,
|
|
24
|
+
content,
|
|
25
|
+
theme,
|
|
26
|
+
position
|
|
27
|
+
} = (typeof config === 'string' ? {} : config) as Toast
|
|
28
|
+
|
|
29
|
+
const htmlElement = document.querySelector(element)
|
|
30
|
+
|
|
31
|
+
if (htmlElement) {
|
|
32
|
+
if (theme) {
|
|
33
|
+
htmlElement.classList.add(theme)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (position) {
|
|
37
|
+
htmlElement.classList.add(position, 'no-anim')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (title) {
|
|
41
|
+
const titleElement = htmlElement.querySelector('.alert-title')
|
|
42
|
+
|
|
43
|
+
titleElement ? titleElement.innerHTML = title : null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (content) {
|
|
47
|
+
const contentElement = htmlElement.querySelector('.alert-body')
|
|
48
|
+
|
|
49
|
+
contentElement ? contentElement.innerHTML = content : null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
htmlElement.classList.remove('no-anim')
|
|
54
|
+
htmlElement.classList.add('show')
|
|
55
|
+
}, 0)
|
|
56
|
+
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
htmlElement.classList.remove('show')
|
|
59
|
+
}, timeout || defaultTimeout)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const hideToast = (element: string) => {
|
|
64
|
+
document.querySelector(element)?.classList.remove('show')
|
|
65
|
+
}
|