webcoreui 0.0.9 → 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.
Files changed (67) hide show
  1. package/README.md +8 -10
  2. package/astro.d.ts +26 -16
  3. package/astro.js +13 -1
  4. package/components/Alert/Alert.tsx +1 -8
  5. package/components/Alert/alert.scss +1 -0
  6. package/components/Alert/alert.ts +6 -0
  7. package/components/Avatar/Avatar.tsx +1 -0
  8. package/components/Badge/Badge.astro +3 -2
  9. package/components/Badge/Badge.svelte +1 -1
  10. package/components/Badge/Badge.tsx +3 -7
  11. package/components/Badge/badge.ts +4 -0
  12. package/components/Button/Button.tsx +1 -5
  13. package/components/Button/button.scss +0 -1
  14. package/components/Button/button.ts +5 -1
  15. package/components/Card/Card.tsx +1 -7
  16. package/components/Card/card.scss +1 -0
  17. package/components/Card/card.ts +6 -0
  18. package/components/Checkbox/Checkbox.tsx +2 -6
  19. package/components/Checkbox/checkbox.ts +4 -0
  20. package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
  21. package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
  22. package/components/Progress/Progress.astro +40 -0
  23. package/components/Progress/Progress.svelte +38 -0
  24. package/components/Progress/Progress.tsx +47 -0
  25. package/components/Progress/progress.scss +66 -0
  26. package/components/Progress/progress.ts +12 -0
  27. package/components/Radio/Radio.tsx +2 -6
  28. package/components/Radio/radio.ts +4 -0
  29. package/components/Spinner/Spinner.astro +42 -0
  30. package/components/Spinner/Spinner.svelte +38 -0
  31. package/components/Spinner/Spinner.tsx +44 -0
  32. package/components/Spinner/spinner.scss +41 -0
  33. package/components/Spinner/spinner.ts +7 -0
  34. package/components/Switch/Switch.tsx +2 -6
  35. package/components/Switch/switch.ts +4 -0
  36. package/components/Tabs/Tabs.astro +76 -0
  37. package/components/Tabs/Tabs.svelte +54 -0
  38. package/components/Tabs/Tabs.tsx +69 -0
  39. package/components/Tabs/tabs.scss +134 -0
  40. package/components/Tabs/tabs.ts +16 -0
  41. package/components/Timeline/Timeline.astro +34 -0
  42. package/components/Timeline/Timeline.svelte +30 -0
  43. package/components/Timeline/Timeline.tsx +37 -0
  44. package/components/Timeline/timeline.scss +71 -0
  45. package/components/Timeline/timeline.ts +61 -0
  46. package/components/TimelineItem/TimelineItem.astro +26 -0
  47. package/components/TimelineItem/TimelineItem.svelte +22 -0
  48. package/components/TimelineItem/TimelineItem.tsx +32 -0
  49. package/components/TimelineItem/timelineitem.scss +31 -0
  50. package/components/TimelineItem/timelineitem.ts +5 -0
  51. package/components/Toast/Toast.astro +30 -0
  52. package/components/Toast/Toast.svelte +21 -0
  53. package/components/Toast/Toast.tsx +28 -0
  54. package/components/Toast/toast.scss +43 -0
  55. package/components/Toast/toast.ts +11 -0
  56. package/index.js +1 -0
  57. package/package.json +3 -1
  58. package/react.d.ts +38 -27
  59. package/react.js +13 -1
  60. package/scss/global/tooltip.scss +133 -0
  61. package/scss/global/utility.scss +17 -0
  62. package/scss/global.scss +1 -0
  63. package/scss/resets.scss +4 -0
  64. package/scss/setup.scss +20 -1
  65. package/svelte.d.ts +26 -16
  66. package/svelte.js +13 -1
  67. package/utils/toast.ts +65 -0
package/svelte.d.ts CHANGED
@@ -1,18 +1,23 @@
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 { AvatarProps } from './components/Avatar/avatar'
6
- import type { BadgeProps } from './components/Badge/badge'
7
- import type { ButtonProps } from './components/Button/button'
8
- import type { CardProps } from './components/Card/card'
9
- import type { CheckboxProps } from './components/Checkbox/checkbox'
10
- import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
11
- import type { IconProps } from './components/Icon/icon'
12
- import type { RadioProps } from './components/Radio/radio'
13
- import type { RatingProps } from './components/Rating/rating'
14
- import type { SwitchProps } from './components/Switch/switch'
15
-
16
21
  export function Accordion(_props: AccordionProps): any
17
22
  export function Alert(_props: AlertProps): any
18
23
  export function Avatar(_props: AvatarProps): any
@@ -22,8 +27,13 @@ declare module 'webcoreui/svelte' {
22
27
  export function Checkbox(_props: CheckboxProps): any
23
28
  export function ConditionalWrapper(_props: ConditionalWrapperProps): any
24
29
  export function Icon(_props: IconProps): any
30
+ export function Progress(_props: ProgressProps): any
25
31
  export function Radio(_props: RadioProps): any
26
32
  export function Rating(_props: RatingProps): any
33
+ export function Spinner(_props: SpinnerProps): any
27
34
  export function Switch(_props: SwitchProps): any
28
- }
29
-
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
@@ -7,9 +7,15 @@ 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 ProgressComponent from './components/Progress/Progress.svelte'
10
11
  import RadioComponent from './components/Radio/Radio.svelte'
11
12
  import RatingComponent from './components/Rating/Rating.svelte'
13
+ import SpinnerComponent from './components/Spinner/Spinner.svelte'
12
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'
13
19
 
14
20
  export const Accordion = AccordionComponent
15
21
  export const Alert = AlertComponent
@@ -20,6 +26,12 @@ export const Card = CardComponent
20
26
  export const Checkbox = CheckboxComponent
21
27
  export const ConditionalWrapper = ConditionalWrapperComponent
22
28
  export const Icon = IconComponent
29
+ export const Progress = ProgressComponent
23
30
  export const Radio = RadioComponent
24
31
  export const Rating = RatingComponent
25
- export const Switch = SwitchComponent
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
+ }