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.
Files changed (93) hide show
  1. package/README.md +26 -11
  2. package/astro.d.ts +31 -11
  3. package/astro.js +23 -1
  4. package/components/Alert/Alert.astro +3 -5
  5. package/components/Alert/Alert.svelte +3 -5
  6. package/components/Alert/Alert.tsx +3 -3
  7. package/components/Alert/alert.scss +1 -0
  8. package/components/Alert/alert.ts +6 -1
  9. package/components/Avatar/Avatar.astro +51 -0
  10. package/components/Avatar/Avatar.svelte +48 -0
  11. package/components/Avatar/Avatar.tsx +64 -0
  12. package/components/Avatar/avatar.scss +35 -0
  13. package/components/Avatar/avatar.ts +10 -0
  14. package/components/Badge/Badge.astro +4 -7
  15. package/components/Badge/Badge.svelte +2 -5
  16. package/components/Badge/Badge.tsx +3 -3
  17. package/components/Badge/badge.ts +4 -1
  18. package/components/Button/Button.astro +1 -4
  19. package/components/Button/Button.svelte +1 -4
  20. package/components/Button/Button.tsx +2 -2
  21. package/components/Button/button.scss +0 -1
  22. package/components/Button/button.ts +4 -0
  23. package/components/Card/Card.astro +2 -5
  24. package/components/Card/Card.svelte +1 -4
  25. package/components/Card/Card.tsx +2 -2
  26. package/components/Card/card.scss +1 -0
  27. package/components/Card/card.ts +7 -0
  28. package/components/Checkbox/Checkbox.astro +51 -0
  29. package/components/Checkbox/Checkbox.svelte +52 -0
  30. package/components/Checkbox/Checkbox.tsx +65 -0
  31. package/components/Checkbox/checkbox.scss +85 -0
  32. package/components/Checkbox/checkbox.ts +12 -0
  33. package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
  34. package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
  35. package/components/Progress/Progress.astro +40 -0
  36. package/components/Progress/Progress.svelte +38 -0
  37. package/components/Progress/Progress.tsx +47 -0
  38. package/components/Progress/progress.scss +66 -0
  39. package/components/Progress/progress.ts +12 -0
  40. package/components/Radio/Radio.astro +57 -0
  41. package/components/Radio/Radio.svelte +56 -0
  42. package/components/Radio/Radio.tsx +68 -0
  43. package/components/Radio/radio.scss +92 -0
  44. package/components/Radio/radio.ts +17 -0
  45. package/components/Rating/Rating.astro +66 -0
  46. package/components/Rating/Rating.svelte +70 -0
  47. package/components/Rating/Rating.tsx +67 -0
  48. package/components/Rating/rating.scss +37 -0
  49. package/components/Rating/rating.ts +16 -0
  50. package/components/Spinner/Spinner.astro +42 -0
  51. package/components/Spinner/Spinner.svelte +38 -0
  52. package/components/Spinner/Spinner.tsx +44 -0
  53. package/components/Spinner/spinner.scss +41 -0
  54. package/components/Spinner/spinner.ts +7 -0
  55. package/components/Switch/Switch.astro +38 -0
  56. package/components/Switch/Switch.svelte +42 -0
  57. package/components/Switch/Switch.tsx +46 -0
  58. package/components/Switch/switch.scss +84 -0
  59. package/components/Switch/switch.ts +15 -0
  60. package/components/Tabs/Tabs.astro +76 -0
  61. package/components/Tabs/Tabs.svelte +54 -0
  62. package/components/Tabs/Tabs.tsx +69 -0
  63. package/components/Tabs/tabs.scss +134 -0
  64. package/components/Tabs/tabs.ts +16 -0
  65. package/components/Timeline/Timeline.astro +34 -0
  66. package/components/Timeline/Timeline.svelte +30 -0
  67. package/components/Timeline/Timeline.tsx +37 -0
  68. package/components/Timeline/timeline.scss +71 -0
  69. package/components/Timeline/timeline.ts +61 -0
  70. package/components/TimelineItem/TimelineItem.astro +26 -0
  71. package/components/TimelineItem/TimelineItem.svelte +22 -0
  72. package/components/TimelineItem/TimelineItem.tsx +32 -0
  73. package/components/TimelineItem/timelineitem.scss +31 -0
  74. package/components/TimelineItem/timelineitem.ts +5 -0
  75. package/components/Toast/Toast.astro +30 -0
  76. package/components/Toast/Toast.svelte +21 -0
  77. package/components/Toast/Toast.tsx +28 -0
  78. package/components/Toast/toast.scss +43 -0
  79. package/components/Toast/toast.ts +11 -0
  80. package/icons/check.svg +1 -2
  81. package/icons/circle-check.svg +4 -0
  82. package/index.js +1 -0
  83. package/package.json +5 -2
  84. package/react.d.ts +38 -17
  85. package/react.js +23 -1
  86. package/scss/global/tooltip.scss +133 -0
  87. package/scss/global/utility.scss +17 -0
  88. package/scss/global.scss +1 -0
  89. package/scss/resets.scss +4 -0
  90. package/scss/setup.scss +31 -1
  91. package/svelte.d.ts +31 -11
  92. package/svelte.js +23 -1
  93. package/utils/toast.ts +65 -0
package/README.md CHANGED
@@ -43,7 +43,7 @@ Full documentation coming soon on [webcoreui.dev/docs](https://webcoreui.dev/doc
43
43
 
44
44
  ## Getting Started
45
45
 
46
- Webcore can be used as a standalone project, or it can be integrated into your existing Astro, Svelte, or React ecosystems.
46
+ Webcore can be used as a standalone project, or it can be integrated into your existing Astro, Svelte, or React ecosystems. The easiest way to get started is to clone the repository and run `npm run dev` to start building your pages with the components available.
47
47
 
48
48
  ### Prerequisites
49
49
 
@@ -79,15 +79,7 @@ yarn add webcoreui
79
79
 
80
80
  ### Setup
81
81
 
82
- 1. Add the following to your `tsconfig.json` to include TypeScript types:
83
-
84
- ```json
85
- {
86
- "include": ["webcoreui"]
87
- }
88
- ```
89
-
90
- 2. Setup default styles and fonts by calling the following in your global SCSS file:
82
+ Setup default styles and fonts by calling the following in your global SCSS file:
91
83
 
92
84
  ```scss
93
85
  @import 'webcoreui/styles';
@@ -108,6 +100,18 @@ The `Setup` mixin can also accept the following options:
108
100
  |-----------|---------------|---------|
109
101
  | `includeResets` | `true` | Include reset styles. Set to `false` if you want to use your own CSS resets. |
110
102
  | `includeHelperClasses` | `true` | Adds global helper classes for CSS. All global helper classes are defined [here](https://github.com/Frontendland/webcoreui/tree/main/src/scss/global). |
103
+ | `includeElementStyles` | `true` | Adds styles for native HTML elements, such as `code`, `pre`, or `ul`.
104
+
105
+ Default component styles can also be changed by overriding the following CSS variables:
106
+
107
+ ```css
108
+ :root {
109
+ --w-avatar-border: #000;
110
+ --w-rating-color: #FFF;
111
+ --w-rating-empty-color: #BBB;
112
+ --w-rating-size: 18px;
113
+ }
114
+ ```
111
115
 
112
116
  ### Using Components
113
117
 
@@ -133,8 +137,19 @@ import { Accordion } from 'webcoreui/react'
133
137
 
134
138
  - [Accordion](https://github.com/Frontendland/webcoreui/tree/main/src/components/Accordion)
135
139
  - [Alert](https://github.com/Frontendland/webcoreui/tree/main/src/components/Alert)
136
- - [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
140
+ - [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
137
141
  - [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
138
142
  - [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
139
143
  - [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
144
+ - [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
145
+ - [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
140
146
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
147
+ - [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
148
+ - [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
149
+ - [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
150
+ - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
151
+ - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
152
+ - [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
153
+ - [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
154
+ - [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
155
+ - [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
package/astro.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/astro' {
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/astro.js CHANGED
@@ -1,15 +1,37 @@
1
1
  import AccordionComponent from './components/Accordion/Accordion.astro'
2
2
  import AlertComponent from './components/Alert/Alert.astro'
3
+ import AvatarComponent from './components/Avatar/Avatar.astro'
3
4
  import BadgeComponent from './components/Badge/Badge.astro'
4
5
  import ButtonComponent from './components/Button/Button.astro'
5
6
  import CardComponent from './components/Card/Card.astro'
7
+ import CheckboxComponent from './components/Checkbox/Checkbox.astro'
6
8
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
7
9
  import IconComponent from './components/Icon/Icon.astro'
10
+ import ProgressComponent from './components/Progress/Progress.astro'
11
+ import RadioComponent from './components/Radio/Radio.astro'
12
+ import RatingComponent from './components/Rating/Rating.astro'
13
+ import SpinnerComponent from './components/Spinner/Spinner.astro'
14
+ import SwitchComponent from './components/Switch/Switch.astro'
15
+ import TabsComponent from './components/Tabs/Tabs.astro'
16
+ import TimelineComponent from './components/Timeline/Timeline.astro'
17
+ import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
18
+ import ToastComponent from './components/Toast/Toast.astro'
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
@@ -3,10 +3,12 @@ import type { AlertProps } from './alert'
3
3
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
4
4
 
5
5
  import info from '../../icons/info.svg?raw'
6
- import success from '../../icons/check.svg?raw'
6
+ import success from '../../icons/circle-check.svg?raw'
7
7
  import warning from '../../icons/warning.svg?raw'
8
8
  import alert from '../../icons/alert.svg?raw'
9
9
 
10
+ import './alert.scss'
11
+
10
12
  interface Props extends AlertProps {}
11
13
 
12
14
  const iconMap = {
@@ -58,7 +60,3 @@ const props = {
58
60
  </div>
59
61
  </ConditionalWrapper>
60
62
  </Component>
61
-
62
- <style lang="scss">
63
- @import './alert.scss';
64
- </style>
@@ -3,10 +3,12 @@
3
3
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
4
4
 
5
5
  import info from '../../icons/info.svg?raw'
6
- import success from '../../icons/check.svg?raw'
6
+ import success from '../../icons/circle-check.svg?raw'
7
7
  import warning from '../../icons/warning.svg?raw'
8
8
  import alert from '../../icons/alert.svg?raw'
9
9
 
10
+ import './alert.scss'
11
+
10
12
  export let element: AlertProps['element'] = 'section'
11
13
  export let title: AlertProps['title'] = null
12
14
  export let titleTag: AlertProps['title'] = 'strong'
@@ -52,7 +54,3 @@
52
54
  </div>
53
55
  </ConditionalWrapper>
54
56
  </svelte:element>
55
-
56
- <style lang="scss">
57
- @import './alert.scss';
58
- </style>
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
- import type { AlertProps } from './alert'
2
+ import type { ReactAlertProps } from './alert'
3
3
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
4
4
 
5
5
  import info from '../../icons/info.svg?raw'
6
- import success from '../../icons/check.svg?raw'
6
+ import success from '../../icons/circle-check.svg?raw'
7
7
  import warning from '../../icons/warning.svg?raw'
8
8
  import alert from '../../icons/alert.svg?raw'
9
9
 
@@ -25,7 +25,7 @@ const Alert = ({
25
25
  children,
26
26
  icon,
27
27
  ...rest
28
- }: AlertProps & { icon?: any }) => {
28
+ }: ReactAlertProps) => {
29
29
  const classes = [
30
30
  'w-alert',
31
31
  (!icon && !theme) && 'col',
@@ -48,5 +48,6 @@
48
48
  .alert-body {
49
49
  font-size: 16px;
50
50
  color: #BBB;
51
+ line-height: 1.5;
51
52
  }
52
53
  }
@@ -9,5 +9,10 @@ export type AlertProps = {
9
9
  | 'warning'
10
10
  | 'alert'
11
11
  | null
12
- [key: string]: any
13
12
  }
13
+
14
+ export type ReactAlertProps = {
15
+ Element?: keyof JSX.IntrinsicElements
16
+ TitleTag?: keyof JSX.IntrinsicElements
17
+ children: React.ReactNode
18
+ } & Omit<AlertProps, 'titleTag' | 'element'>
@@ -0,0 +1,51 @@
1
+ ---
2
+ import type { AvatarProps } from './avatar'
3
+ import './avatar.scss'
4
+
5
+ interface Props extends AvatarProps {}
6
+
7
+ const {
8
+ img,
9
+ alt = 'Avatar',
10
+ size = 40,
11
+ lazy = true,
12
+ borderColor,
13
+ borderless,
14
+ reverse,
15
+ className,
16
+ } = Astro.props
17
+
18
+ const classes = [
19
+ 'w-avatar',
20
+ borderless && 'borderless',
21
+ className
22
+ ]
23
+ ---
24
+
25
+ {Array.isArray(img) ? (
26
+ <div class:list={['w-avatar-group', reverse && 'reverse']}
27
+ style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
28
+ >
29
+ {img.map((img, index) => (
30
+ <img
31
+ src={img}
32
+ alt={Array.isArray(alt) ? alt[index] : alt}
33
+ width={Array.isArray(size) ? size[index] : size}
34
+ height={Array.isArray(size) ? size[index] : size}
35
+ loading={lazy ? 'lazy' : null}
36
+ class:list={classes}
37
+ style={Array.isArray(size) ? `--w-avatar-index: ${size[index]}` : null}
38
+ />
39
+ ))}
40
+ </div>
41
+ ) : (
42
+ <img
43
+ src={img}
44
+ alt={Array.isArray(alt) ? alt[0] : alt}
45
+ width={Array.isArray(size) ? size[0] : size}
46
+ height={Array.isArray(size) ? size[0] : size}
47
+ class:list={classes}
48
+ loading={lazy ? 'lazy' : null}
49
+ style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
50
+ />
51
+ )}
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import type { AvatarProps } from './avatar'
3
+ import './avatar.scss'
4
+
5
+ export let img: AvatarProps['img'] = ''
6
+ export let alt: AvatarProps['alt'] = 'Avatar'
7
+ export let size: AvatarProps['size'] = 40
8
+ export let lazy: AvatarProps['lazy'] = true
9
+ export let borderColor: AvatarProps['borderColor'] = ''
10
+ export let borderless: AvatarProps['borderless'] = false
11
+ export let reverse: AvatarProps['reverse'] = false
12
+ export let className: AvatarProps['className'] = ''
13
+
14
+ const classes = [
15
+ 'w-avatar',
16
+ borderless && 'borderless',
17
+ className
18
+ ].filter(Boolean).join(' ')
19
+ </script>
20
+
21
+ {#if Array.isArray(img)}
22
+ <div class="w-avatar-group"
23
+ class:reverse
24
+ style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
25
+ >
26
+ {#each img as img, index}
27
+ <img
28
+ src={img}
29
+ alt={Array.isArray(alt) ? alt[index] : alt}
30
+ width={Array.isArray(size) ? size[index] : size}
31
+ height={Array.isArray(size) ? size[index] : size}
32
+ loading={lazy ? 'lazy' : null}
33
+ class={classes}
34
+ style={Array.isArray(size) ? `--w-avatar-index: ${size[index]}` : null}
35
+ />
36
+ {/each}
37
+ </div>
38
+ {:else}
39
+ <img
40
+ src={img}
41
+ alt={Array.isArray(alt) ? alt[0] : alt}
42
+ width={Array.isArray(size) ? size[0] : size}
43
+ height={Array.isArray(size) ? size[0] : size}
44
+ class={classes}
45
+ loading={lazy ? 'lazy' : null}
46
+ style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
47
+ />
48
+ {/if}
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import type { AvatarProps } from './avatar'
3
+ import './avatar.scss'
4
+
5
+ const Avatar = ({
6
+ img,
7
+ alt = 'Avatar',
8
+ size = 40,
9
+ lazy = true,
10
+ borderColor,
11
+ borderless,
12
+ reverse,
13
+ className,
14
+ }: AvatarProps) => {
15
+ const classes = [
16
+ 'w-avatar',
17
+ borderless && 'borderless',
18
+ className
19
+ ].filter(Boolean).join(' ')
20
+
21
+ const groupStyles = [
22
+ 'w-avatar-group',
23
+ reverse && 'reverse'
24
+ ].filter(Boolean).join(' ')
25
+
26
+ const borderColorStyle = borderColor
27
+ ? { '--w-avatar-border': borderColor } as React.CSSProperties
28
+ : undefined
29
+
30
+ return Array.isArray(img) ? (
31
+ <div className={groupStyles}
32
+ style={borderColorStyle}
33
+ >
34
+ {img.map((img, index) => (
35
+ <img
36
+ key={index}
37
+ src={img}
38
+ alt={Array.isArray(alt) ? alt[index] : alt}
39
+ width={Array.isArray(size) ? size[index] : size}
40
+ height={Array.isArray(size) ? size[index] : size}
41
+ loading={lazy ? 'lazy' : undefined}
42
+ className={classes}
43
+ style={Array.isArray(size)
44
+ ? { '--w-avatar-index': size[index] } as React.CSSProperties
45
+ : undefined
46
+ }
47
+ />
48
+ ))}
49
+ </div>
50
+ ) : (
51
+ <img
52
+ src={img}
53
+ alt={Array.isArray(alt) ? alt[0] : alt}
54
+ width={Array.isArray(size) ? size[0] : size}
55
+ height={Array.isArray(size) ? size[0] : size}
56
+ className={classes}
57
+ loading={lazy ? 'lazy' : undefined}
58
+ style={borderColorStyle}
59
+ />
60
+ )
61
+
62
+ }
63
+
64
+ export default Avatar
@@ -0,0 +1,35 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .w-avatar {
4
+ border-radius: 100%;
5
+
6
+ &:not(.borderless) {
7
+ border: 3px solid var(--w-avatar-border);
8
+ }
9
+ }
10
+
11
+ .w-avatar-group {
12
+ display: inline-flex;
13
+ align-items: center;
14
+
15
+ &.reverse {
16
+ flex-direction: row-reverse;
17
+
18
+ img {
19
+ z-index: 1;
20
+ }
21
+
22
+ img:not(:first-child) {
23
+ margin-right: -10px;
24
+ margin-left: 0;
25
+ }
26
+ }
27
+
28
+ img:not(:first-child) {
29
+ margin-left: -10px;
30
+ }
31
+
32
+ img {
33
+ z-index: var(--w-avatar-index);
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ export type AvatarProps = {
2
+ img: string | string[]
3
+ alt?: string | string[]
4
+ size?: number | number[]
5
+ lazy?: boolean
6
+ borderColor?: string
7
+ borderless?: boolean
8
+ reverse?: boolean
9
+ className?: string
10
+ }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { BadgeProps } from './badge'
3
+ import './badge.scss'
3
4
 
4
5
  interface Props extends BadgeProps {
5
6
  interactive?: boolean
@@ -7,7 +8,8 @@ interface Props extends BadgeProps {
7
8
 
8
9
  const {
9
10
  theme,
10
- interactive
11
+ interactive,
12
+ ...rest
11
13
  } = Astro.props
12
14
 
13
15
  const classes = [
@@ -17,11 +19,6 @@ const classes = [
17
19
  ]
18
20
  ---
19
21
 
20
- <span class:list={classes}>
22
+ <span class:list={classes} {...rest}>
21
23
  <slot />
22
24
  </span>
23
-
24
-
25
- <style lang="scss">
26
- @import './badge.scss';
27
- </style>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { BadgeProps } from './badge'
3
+ import './badge.scss'
3
4
 
4
5
  export let theme: BadgeProps['theme'] = null
5
6
  export let onClick: BadgeProps['onClick'] = () => {}
@@ -11,10 +12,6 @@
11
12
  ].filter(Boolean).join(' ')
12
13
  </script>
13
14
 
14
- <span class={classes} on:click={onClick}>
15
+ <span class={classes} on:click={onClick} {...$$restProps}>
15
16
  <slot />
16
17
  </span>
17
-
18
- <style lang="scss">
19
- @import './badge.scss';
20
- </style>
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
- import type { BadgeProps } from './badge'
2
+ import type { ReactBadgeProps } from './badge'
3
3
  import './badge.scss'
4
4
 
5
- const Badge = ({ theme, onClick, children }: BadgeProps) => {
5
+ const Badge = ({ theme, onClick, children, ...rest }: ReactBadgeProps) => {
6
6
  const classes = [
7
7
  'w-badge',
8
8
  theme || null,
@@ -10,7 +10,7 @@ const Badge = ({ theme, onClick, children }: BadgeProps) => {
10
10
  ].filter(Boolean).join(' ')
11
11
 
12
12
  return (
13
- <span className={classes} onClick={onClick}>
13
+ <span className={classes} onClick={onClick} {...rest}>
14
14
  {children}
15
15
  </span>
16
16
  )
@@ -8,5 +8,8 @@ export type BadgeProps = {
8
8
  | 'alert'
9
9
  | null
10
10
  onClick?: () => any
11
- [key: string]: any
12
11
  }
12
+
13
+ export type ReactBadgeProps = {
14
+ children: React.ReactNode
15
+ } & BadgeProps
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { ButtonProps } from './button'
3
+ import './button.scss'
3
4
 
4
5
  interface Props extends ButtonProps {}
5
6
 
@@ -26,7 +27,3 @@ const classes = [
26
27
  <slot />
27
28
  </button>
28
29
  )}
29
-
30
- <style lang="scss">
31
- @import './button.scss';
32
- </style>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { ButtonProps } from './button'
3
+ import './button.scss'
3
4
 
4
5
  export let theme: ButtonProps['theme'] = null
5
6
  export let bold: ButtonProps['bold'] = false
@@ -23,7 +24,3 @@
23
24
  <slot />
24
25
  </button>
25
26
  {/if}
26
-
27
- <style lang="scss">
28
- @import './button.scss';
29
- </style>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { ButtonProps } from './button'
2
+ import type { ReactButtonProps } from './button'
3
3
  import './button.scss'
4
4
 
5
5
  const Button = ({
@@ -9,7 +9,7 @@ const Button = ({
9
9
  children,
10
10
  onClick,
11
11
  ...rest
12
- }: ButtonProps) => {
12
+ }: ReactButtonProps) => {
13
13
  const classes = [
14
14
  'w-button',
15
15
  bold && 'bold',
@@ -9,7 +9,6 @@
9
9
  align-items: center;
10
10
  gap: 5px;
11
11
  font-size: 16px;
12
- font-family: Regular;
13
12
  cursor: pointer;
14
13
  border: 0;
15
14
  background: #FFF;
@@ -12,3 +12,7 @@ export type ButtonProps = {
12
12
  onClick?: () => any
13
13
  [key: string]: any
14
14
  }
15
+
16
+ export type ReactButtonProps = {
17
+ children: React.ReactNode
18
+ } & ButtonProps
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { CardProps } from './card'
3
+ import './card.scss'
3
4
 
4
5
  interface Props extends CardProps {}
5
6
 
@@ -29,7 +30,7 @@ const Title = titleTag
29
30
 
30
31
  <Component {...props} {...rest}>
31
32
  {title && (
32
- <Title class="card-title">{title}</Title>
33
+ <Title class:list="card-title">{title}</Title>
33
34
  )}
34
35
  <div class="card-body" class:list={[compact && 'compact']}>
35
36
  {compact && !secondary ? (
@@ -39,7 +40,3 @@ const Title = titleTag
39
40
  )}
40
41
  </div>
41
42
  </Component>
42
-
43
- <style lang="scss">
44
- @import './card.scss';
45
- </style>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { CardProps } from './card'
3
+ import './card.scss'
3
4
 
4
5
  export let element: CardProps['element'] = 'section'
5
6
  export let title: CardProps['title'] = ''
@@ -29,7 +30,3 @@
29
30
  {/if}
30
31
  </div>
31
32
  </svelte:element>
32
-
33
- <style lang="scss">
34
- @import './card.scss';
35
- </style>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { CardProps } from './card'
2
+ import type { ReactCardProps } from './card'
3
3
  import './card.scss'
4
4
 
5
5
  const Card = ({
@@ -11,7 +11,7 @@ const Card = ({
11
11
  secondary,
12
12
  children,
13
13
  ...rest
14
- }: CardProps) => {
14
+ }: ReactCardProps) => {
15
15
  const classes = [
16
16
  'w-card',
17
17
  className,
@@ -22,6 +22,7 @@
22
22
  .card-body {
23
23
  padding: 20px;
24
24
  height: 100%;
25
+ position: relative;
25
26
 
26
27
  &.compact {
27
28
  background: #111;