webcoreui 1.5.0-0 → 1.5.0-beta.2

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 (228) hide show
  1. package/astro.d.ts +62 -56
  2. package/astro.js +4 -0
  3. package/components/Accordion/Accordion.astro +1 -1
  4. package/components/Accordion/Accordion.svelte +60 -58
  5. package/components/Accordion/Accordion.tsx +4 -2
  6. package/components/Alert/Alert.astro +2 -1
  7. package/components/Alert/Alert.svelte +9 -2
  8. package/components/Alert/Alert.tsx +10 -3
  9. package/components/Alert/alert.ts +2 -18
  10. package/components/AspectRatio/AspectRatio.astro +1 -1
  11. package/components/AspectRatio/AspectRatio.svelte +7 -2
  12. package/components/AspectRatio/AspectRatio.tsx +6 -3
  13. package/components/AspectRatio/aspectratio.ts +0 -10
  14. package/components/Avatar/Avatar.astro +1 -1
  15. package/components/Avatar/Avatar.svelte +3 -1
  16. package/components/Avatar/Avatar.tsx +3 -2
  17. package/components/Badge/Badge.astro +2 -1
  18. package/components/Badge/Badge.svelte +9 -2
  19. package/components/Badge/Badge.tsx +8 -3
  20. package/components/Badge/badge.ts +11 -13
  21. package/components/Banner/Banner.astro +1 -1
  22. package/components/Banner/Banner.svelte +7 -2
  23. package/components/Banner/Banner.tsx +6 -2
  24. package/components/Banner/banner.ts +0 -10
  25. package/components/BottomNavigation/BottomNavigation.astro +1 -1
  26. package/components/BottomNavigation/BottomNavigation.svelte +3 -1
  27. package/components/BottomNavigation/BottomNavigation.tsx +3 -2
  28. package/components/Breadcrumb/Breadcrumb.astro +1 -1
  29. package/components/Breadcrumb/Breadcrumb.svelte +3 -1
  30. package/components/Breadcrumb/Breadcrumb.tsx +3 -1
  31. package/components/Button/Button.astro +2 -1
  32. package/components/Button/Button.svelte +9 -2
  33. package/components/Button/Button.tsx +7 -2
  34. package/components/Button/button.ts +23 -20
  35. package/components/Card/Card.astro +9 -2
  36. package/components/Card/Card.svelte +17 -4
  37. package/components/Card/Card.tsx +23 -6
  38. package/components/Card/card.module.scss +11 -4
  39. package/components/Card/card.ts +3 -16
  40. package/components/Carousel/Carousel.astro +1 -1
  41. package/components/Carousel/Carousel.svelte +8 -3
  42. package/components/Carousel/Carousel.tsx +7 -2
  43. package/components/Carousel/carousel.ts +0 -12
  44. package/components/CarouselItem/CarouselItem.astro +14 -0
  45. package/components/CarouselItem/CarouselItem.svelte +18 -0
  46. package/components/CarouselItem/CarouselItem.tsx +18 -0
  47. package/components/CarouselItem/carouselItem.ts +4 -0
  48. package/components/Checkbox/Checkbox.astro +3 -6
  49. package/components/Checkbox/Checkbox.svelte +9 -7
  50. package/components/Checkbox/Checkbox.tsx +8 -5
  51. package/components/Checkbox/checkbox.ts +2 -17
  52. package/components/Collapsible/Collapsible.astro +1 -1
  53. package/components/Collapsible/Collapsible.svelte +9 -2
  54. package/components/Collapsible/Collapsible.tsx +8 -2
  55. package/components/Collapsible/collapsible.ts +0 -15
  56. package/components/ConditionalWrapper/ConditionalWrapper.astro +1 -1
  57. package/components/ConditionalWrapper/ConditionalWrapper.svelte +8 -2
  58. package/components/ConditionalWrapper/ConditionalWrapper.tsx +7 -2
  59. package/components/ConditionalWrapper/conditionalwrapper.ts +2 -14
  60. package/components/ContextMenu/ContextMenu.astro +2 -1
  61. package/components/ContextMenu/ContextMenu.svelte +9 -3
  62. package/components/ContextMenu/ContextMenu.tsx +8 -2
  63. package/components/ContextMenu/contextmenu.ts +2 -17
  64. package/components/Copy/Copy.astro +2 -2
  65. package/components/Copy/Copy.svelte +8 -3
  66. package/components/Copy/Copy.tsx +7 -3
  67. package/components/Copy/copy.ts +2 -12
  68. package/components/Counter/Counter.astro +3 -2
  69. package/components/Counter/Counter.svelte +10 -5
  70. package/components/Counter/Counter.tsx +11 -7
  71. package/components/Counter/counter.ts +2 -11
  72. package/components/DataTable/DataTable.astro +1 -1
  73. package/components/DataTable/DataTable.svelte +8 -2
  74. package/components/DataTable/DataTable.tsx +7 -2
  75. package/components/DataTable/datatable.ts +0 -12
  76. package/components/Flex/Flex.astro +2 -1
  77. package/components/Flex/Flex.svelte +8 -2
  78. package/components/Flex/Flex.tsx +8 -3
  79. package/components/Flex/flex.ts +2 -15
  80. package/components/Footer/Footer.astro +1 -1
  81. package/components/Footer/Footer.svelte +7 -2
  82. package/components/Footer/Footer.tsx +6 -2
  83. package/components/Footer/footer.ts +0 -10
  84. package/components/Grid/Grid.astro +2 -1
  85. package/components/Grid/Grid.svelte +8 -2
  86. package/components/Grid/Grid.tsx +8 -3
  87. package/components/Grid/grid.ts +2 -15
  88. package/components/Group/Group.astro +1 -1
  89. package/components/Group/Group.svelte +7 -2
  90. package/components/Group/Group.tsx +6 -2
  91. package/components/Group/group.ts +0 -10
  92. package/components/Icon/Icon.astro +1 -1
  93. package/components/Icon/Icon.svelte +3 -1
  94. package/components/Icon/Icon.tsx +3 -2
  95. package/components/Image/Image.astro +2 -1
  96. package/components/Image/Image.svelte +4 -1
  97. package/components/Image/Image.tsx +3 -1
  98. package/components/Image/image.ts +2 -3
  99. package/components/ImageLoader/ImageLoader.astro +1 -1
  100. package/components/ImageLoader/ImageLoader.svelte +3 -1
  101. package/components/ImageLoader/ImageLoader.tsx +4 -2
  102. package/components/Input/Input.astro +3 -2
  103. package/components/Input/Input.svelte +14 -4
  104. package/components/Input/Input.tsx +11 -3
  105. package/components/Input/input.ts +26 -53
  106. package/components/Kbd/Kbd.astro +1 -1
  107. package/components/Kbd/Kbd.svelte +7 -2
  108. package/components/Kbd/Kbd.tsx +6 -2
  109. package/components/Kbd/kbd.ts +0 -10
  110. package/components/List/List.astro +1 -1
  111. package/components/List/List.svelte +6 -2
  112. package/components/List/List.tsx +8 -4
  113. package/components/List/list.ts +0 -8
  114. package/components/Masonry/Masonry.astro +1 -1
  115. package/components/Masonry/Masonry.svelte +7 -2
  116. package/components/Masonry/Masonry.tsx +7 -3
  117. package/components/Masonry/masonry.ts +2 -13
  118. package/components/Menu/Menu.astro +1 -1
  119. package/components/Menu/Menu.svelte +7 -2
  120. package/components/Menu/Menu.tsx +6 -2
  121. package/components/Menu/menu.ts +0 -10
  122. package/components/Modal/Modal.astro +2 -3
  123. package/components/Modal/Modal.svelte +8 -4
  124. package/components/Modal/Modal.tsx +6 -4
  125. package/components/Modal/modal.ts +2 -14
  126. package/components/OTPInput/OTPInput.astro +3 -5
  127. package/components/OTPInput/OTPInput.svelte +6 -6
  128. package/components/OTPInput/OTPInput.tsx +10 -8
  129. package/components/OTPInput/otpinput.ts +2 -4
  130. package/components/Pagination/Pagination.astro +1 -1
  131. package/components/Pagination/Pagination.svelte +6 -2
  132. package/components/Pagination/Pagination.tsx +6 -2
  133. package/components/Pagination/pagination.ts +0 -8
  134. package/components/Popover/Popover.astro +3 -7
  135. package/components/Popover/Popover.svelte +9 -8
  136. package/components/Popover/Popover.tsx +9 -12
  137. package/components/Popover/popover.ts +2 -15
  138. package/components/Progress/Progress.astro +1 -1
  139. package/components/Progress/Progress.svelte +3 -1
  140. package/components/Progress/Progress.tsx +3 -1
  141. package/components/Radio/Radio.astro +3 -4
  142. package/components/Radio/Radio.svelte +10 -5
  143. package/components/Radio/Radio.tsx +7 -5
  144. package/components/Radio/radio.ts +2 -14
  145. package/components/RangeSlider/RangeSlider.astro +1 -1
  146. package/components/RangeSlider/RangeSlider.svelte +6 -2
  147. package/components/RangeSlider/RangeSlider.tsx +7 -3
  148. package/components/RangeSlider/rangeslider.ts +0 -9
  149. package/components/Rating/Rating.astro +1 -1
  150. package/components/Rating/Rating.svelte +3 -1
  151. package/components/Rating/Rating.tsx +3 -1
  152. package/components/Ribbon/Ribbon.astro +1 -1
  153. package/components/Ribbon/Ribbon.svelte +7 -2
  154. package/components/Ribbon/Ribbon.tsx +6 -2
  155. package/components/Ribbon/ribbon.ts +0 -10
  156. package/components/Select/Select.astro +1 -1
  157. package/components/Select/Select.svelte +9 -4
  158. package/components/Select/Select.tsx +9 -4
  159. package/components/Select/select.ts +1 -12
  160. package/components/Sheet/Sheet.astro +2 -1
  161. package/components/Sheet/Sheet.svelte +5 -3
  162. package/components/Sheet/Sheet.tsx +5 -4
  163. package/components/Sheet/sheet.ts +3 -10
  164. package/components/Sidebar/Sidebar.astro +1 -1
  165. package/components/Sidebar/Sidebar.svelte +7 -2
  166. package/components/Sidebar/Sidebar.tsx +6 -2
  167. package/components/Sidebar/sidebar.ts +0 -10
  168. package/components/Skeleton/Skeleton.astro +1 -1
  169. package/components/Skeleton/Skeleton.svelte +3 -1
  170. package/components/Skeleton/Skeleton.tsx +3 -1
  171. package/components/Slider/Slider.astro +1 -1
  172. package/components/Slider/Slider.svelte +8 -2
  173. package/components/Slider/Slider.tsx +6 -2
  174. package/components/Slider/slider.ts +0 -10
  175. package/components/SpeedDial/SpeedDial.astro +1 -1
  176. package/components/SpeedDial/SpeedDial.svelte +3 -1
  177. package/components/SpeedDial/SpeedDial.tsx +4 -2
  178. package/components/Spinner/Spinner.astro +1 -1
  179. package/components/Spinner/Spinner.svelte +3 -1
  180. package/components/Spinner/Spinner.tsx +3 -1
  181. package/components/Spoiler/Spoiler.astro +1 -1
  182. package/components/Spoiler/Spoiler.svelte +7 -2
  183. package/components/Spoiler/Spoiler.tsx +6 -2
  184. package/components/Spoiler/spoiler.ts +0 -10
  185. package/components/Stepper/Stepper.astro +1 -1
  186. package/components/Stepper/Stepper.svelte +3 -1
  187. package/components/Stepper/Stepper.tsx +3 -1
  188. package/components/Switch/Switch.astro +7 -2
  189. package/components/Switch/Switch.svelte +13 -4
  190. package/components/Switch/Switch.tsx +8 -4
  191. package/components/Switch/switch.ts +2 -16
  192. package/components/Tab/Tab.astro +25 -0
  193. package/components/Tab/Tab.svelte +28 -0
  194. package/components/Tab/Tab.tsx +30 -0
  195. package/components/Tab/tab.ts +6 -0
  196. package/components/Table/Table.astro +1 -1
  197. package/components/Table/Table.svelte +3 -1
  198. package/components/Table/Table.tsx +3 -1
  199. package/components/Tabs/Tabs.astro +58 -25
  200. package/components/Tabs/Tabs.svelte +45 -12
  201. package/components/Tabs/Tabs.tsx +42 -11
  202. package/components/Tabs/tabs.module.scss +7 -6
  203. package/components/Tabs/tabs.ts +0 -10
  204. package/components/Textarea/Textarea.astro +3 -6
  205. package/components/Textarea/Textarea.svelte +10 -7
  206. package/components/Textarea/Textarea.tsx +9 -7
  207. package/components/Textarea/textarea.ts +2 -17
  208. package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -1
  209. package/components/ThemeSwitcher/ThemeSwitcher.svelte +9 -3
  210. package/components/ThemeSwitcher/ThemeSwitcher.tsx +7 -2
  211. package/components/ThemeSwitcher/themeswitcher.ts +0 -13
  212. package/components/Timeline/Timeline.astro +1 -1
  213. package/components/Timeline/Timeline.svelte +7 -2
  214. package/components/Timeline/Timeline.tsx +6 -2
  215. package/components/Timeline/timeline.ts +0 -10
  216. package/components/TimelineItem/TimelineItem.astro +1 -1
  217. package/components/TimelineItem/TimelineItem.svelte +7 -2
  218. package/components/TimelineItem/TimelineItem.tsx +8 -3
  219. package/components/TimelineItem/timelineitem.ts +0 -12
  220. package/components/Toast/Toast.astro +2 -1
  221. package/components/Toast/Toast.svelte +5 -3
  222. package/components/Toast/Toast.tsx +5 -4
  223. package/components/Toast/toast.ts +3 -11
  224. package/package.json +19 -19
  225. package/react.d.ts +145 -138
  226. package/react.js +4 -0
  227. package/svelte.d.ts +145 -138
  228. package/svelte.js +4 -0
@@ -1,7 +1,7 @@
1
1
  import type { ButtonProps } from '../Button/button'
2
2
  import type { IconProps } from '../Icon/icon'
3
3
 
4
- export type CounterProps = {
4
+ export type CounterProps<T extends object = object> = {
5
5
  type?: 'compact' | 'buttons' | 'separated'
6
6
  theme?: ButtonProps['theme']
7
7
  rounded?: boolean
@@ -9,13 +9,4 @@ export type CounterProps = {
9
9
  maxIcon?: IconProps['type'] | string
10
10
  width?: string
11
11
  className?: string
12
- [key: string]: any
13
- }
14
-
15
- export type SvelteCounterProps = {
16
- onChange?: (value: number) => void
17
- } & CounterProps
18
-
19
- export type ReactCounterProps = {
20
- onChange?: (value: number) => void
21
- } & CounterProps
12
+ } & T
@@ -14,7 +14,7 @@ import searchIcon from '../../icons/search.svg?raw'
14
14
 
15
15
  import styles from './datatable.module.scss'
16
16
 
17
- interface Props extends DataTableProps {}
17
+ export type Props = DataTableProps
18
18
 
19
19
  const {
20
20
  headings,
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import type { HeadingObject, SvelteDataTableProps } from './datatable'
2
+ import type { Snippet } from 'svelte'
3
+ import type { DataTableEventType, DataTableProps, HeadingObject } from './datatable'
3
4
 
4
5
  import Button from '../Button/Button.svelte'
5
6
  import Input from '../Input/Input.svelte'
@@ -17,6 +18,11 @@
17
18
 
18
19
  import type { ListEventType } from '../List/list'
19
20
 
21
+ export type Props = DataTableProps & {
22
+ onFilter?: (event: DataTableEventType) => void
23
+ children?: Snippet
24
+ }
25
+
20
26
  const {
21
27
  headings,
22
28
  filterPlaceholder = 'Filter entries',
@@ -36,7 +42,7 @@
36
42
  id,
37
43
  onFilter,
38
44
  children
39
- }: SvelteDataTableProps = $props()
45
+ }: Props = $props()
40
46
 
41
47
  let filteredData: any = $derived(data)
42
48
  let toggledData: any = $derived(data)
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import type { HeadingObject, ReactDataTableProps } from './datatable'
2
+ import type { DataTableEventType, DataTableProps, HeadingObject } from './datatable'
3
3
 
4
4
  import Button from '../Button/Button.tsx'
5
5
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
@@ -18,6 +18,11 @@ import styles from './datatable.module.scss'
18
18
 
19
19
  import type { ListEventType } from '../List/list'
20
20
 
21
+ export type Props = DataTableProps & {
22
+ onFilter?: (event: DataTableEventType) => void
23
+ children?: React.ReactNode
24
+ }
25
+
21
26
  const DataTable = ({
22
27
  headings,
23
28
  filterPlaceholder = 'Filter entries',
@@ -38,7 +43,7 @@ const DataTable = ({
38
43
  onFilter,
39
44
  children
40
45
  // eslint-disable-next-line complexity
41
- }: ReactDataTableProps) => {
46
+ }: Props) => {
42
47
  const [filteredData, setFilteredData] = useState<any>(data)
43
48
  const [toggledData, setToggledData] = useState(filteredData)
44
49
  const [filteredHeadings, setFilteredHeadings] = useState<any>(headings)
@@ -1,5 +1,3 @@
1
- import type { Snippet } from 'svelte'
2
-
3
1
  import type { PaginationProps } from '../Pagination/pagination'
4
2
 
5
3
  export type DataTableEventType = {
@@ -32,13 +30,3 @@ export type DataTableProps = {
32
30
  className?: string
33
31
  id?: string
34
32
  }
35
-
36
- export type SvelteDataTableProps = {
37
- onFilter?: (event: DataTableEventType) => void
38
- children?: Snippet
39
- } & DataTableProps
40
-
41
- export type ReactDataTableProps = {
42
- onFilter?: (event: DataTableEventType) => void
43
- children?: React.ReactNode
44
- } & DataTableProps
@@ -1,10 +1,11 @@
1
1
  ---
2
+ import type { HTMLAttributes } from 'astro/types'
2
3
  import type { FlexProps } from './flex'
3
4
 
4
5
  import { classNames } from '../../utils/classNames'
5
6
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
7
 
7
- interface Props extends FlexProps {}
8
+ export type Props = FlexProps<HTMLAttributes<'div'>>
8
9
 
9
10
  const {
10
11
  element = 'div',
@@ -1,9 +1,15 @@
1
1
  <script lang="ts">
2
- import type { SvelteFlexProps } from './flex'
2
+ import type { Snippet } from 'svelte'
3
+ import type { HTMLAttributes } from 'svelte/elements'
4
+ import type { FlexProps } from './flex'
3
5
 
4
6
  import { classNames } from '../../utils/classNames'
5
7
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
8
 
9
+ export type Props = FlexProps<HTMLAttributes<HTMLElement>> & {
10
+ children: Snippet
11
+ }
12
+
7
13
  const {
8
14
  element = 'div',
9
15
  gap,
@@ -13,7 +19,7 @@
13
19
  className,
14
20
  children,
15
21
  ...rest
16
- }: SvelteFlexProps = $props()
22
+ }: Props = $props()
17
23
 
18
24
  const classes = $derived(classNames([
19
25
  'flex',
@@ -1,9 +1,14 @@
1
- import React from 'react'
2
- import type { ReactFlexProps } from './flex'
1
+ import React, { type JSX } from 'react'
2
+ import type { FlexProps } from './flex'
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
6
 
7
+ export type Props = Omit<FlexProps, 'element'> & {
8
+ Element?: keyof JSX.IntrinsicElements
9
+ children: React.ReactNode
10
+ }
11
+
7
12
  const Flex = ({
8
13
  Element = 'div',
9
14
  gap,
@@ -13,7 +18,7 @@ const Flex = ({
13
18
  className,
14
19
  children,
15
20
  ...rest
16
- }: ReactFlexProps) => {
21
+ }: Props) => {
17
22
  const classes = classNames([
18
23
  'flex',
19
24
  getLayoutClasses({ gap, alignment, direction, wrap }),
@@ -1,6 +1,3 @@
1
- import type { JSX } from 'react'
2
- import type { Snippet } from 'svelte'
3
-
4
1
  import type {
5
2
  Alignment,
6
3
  Direction,
@@ -9,21 +6,11 @@ import type {
9
6
  Wrap
10
7
  } from '../../utils/getLayoutClasses'
11
8
 
12
- export type FlexProps = {
9
+ export type FlexProps<T extends object = object> = {
13
10
  element?: string
14
11
  gap?: Responsive<Gap>
15
12
  alignment?: Responsive<Alignment>
16
13
  direction?: Responsive<Direction>
17
14
  wrap?: Responsive<Wrap>
18
15
  className?: string
19
- [key: string]: any
20
- }
21
-
22
- export type SvelteFlexProps = {
23
- children: Snippet
24
- } & FlexProps
25
-
26
- export type ReactFlexProps = {
27
- Element?: keyof JSX.IntrinsicElements
28
- children: React.ReactNode
29
- } & Omit<FlexProps, 'element'>
16
+ } & T
@@ -5,7 +5,7 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
5
5
 
6
6
  import styles from './footer.module.scss'
7
7
 
8
- interface Props extends FooterProps {}
8
+ export type Props = FooterProps
9
9
 
10
10
  const {
11
11
  logo,
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import type { SvelteFooterProps } from './footer'
2
+ import type { Snippet } from 'svelte'
3
+ import type { FooterProps } from './footer'
3
4
 
4
5
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
5
6
 
@@ -7,6 +8,10 @@
7
8
 
8
9
  import styles from './footer.module.scss'
9
10
 
11
+ export type Props = FooterProps & {
12
+ children?: Snippet
13
+ }
14
+
10
15
  const {
11
16
  logo,
12
17
  columns,
@@ -15,7 +20,7 @@
15
20
  wrapperClassName,
16
21
  subTextClassName,
17
22
  children
18
- }: SvelteFooterProps = $props()
23
+ }: Props = $props()
19
24
 
20
25
  const classes = $derived(classNames([
21
26
  styles.footer,
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { ReactFooterProps } from './footer'
2
+ import type { FooterProps } from './footer'
3
3
 
4
4
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
5
 
@@ -7,6 +7,10 @@ import { classNames } from '../../utils/classNames'
7
7
 
8
8
  import styles from './footer.module.scss'
9
9
 
10
+ export type Props = FooterProps & {
11
+ children?: React.ReactNode
12
+ }
13
+
10
14
  const Footer = ({
11
15
  logo,
12
16
  columns,
@@ -15,7 +19,7 @@ const Footer = ({
15
19
  wrapperClassName,
16
20
  subTextClassName,
17
21
  children
18
- }: ReactFooterProps) => {
22
+ }: Props) => {
19
23
  const classes = classNames([
20
24
  styles.footer,
21
25
  className
@@ -1,5 +1,3 @@
1
- import type { Snippet } from 'svelte'
2
-
3
1
  import type { ButtonProps } from '../Button/button'
4
2
 
5
3
  export type FooterProps = {
@@ -25,11 +23,3 @@ export type FooterProps = {
25
23
  wrapperClassName?: string
26
24
  subTextClassName?: string
27
25
  }
28
-
29
- export type SvelteFooterProps = {
30
- children?: Snippet
31
- } & FooterProps
32
-
33
- export type ReactFooterProps = {
34
- children?: React.ReactNode
35
- } & FooterProps
@@ -1,10 +1,11 @@
1
1
  ---
2
+ import type { HTMLAttributes } from 'astro/types'
2
3
  import type { GridProps } from './grid'
3
4
 
4
5
  import { classNames } from '../../utils/classNames'
5
6
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
7
 
7
- interface Props extends GridProps {}
8
+ export type Props = GridProps<HTMLAttributes<'div'>>
8
9
 
9
10
  const {
10
11
  element = 'div',
@@ -1,9 +1,15 @@
1
1
  <script lang="ts">
2
- import type { SvelteGridProps } from './grid'
2
+ import type { Snippet } from 'svelte'
3
+ import type { HTMLAttributes } from 'svelte/elements'
4
+ import type { GridProps } from './grid'
3
5
 
4
6
  import { classNames } from '../../utils/classNames'
5
7
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
8
 
9
+ export type Props = GridProps<HTMLAttributes<HTMLElement>> & {
10
+ children: Snippet
11
+ }
12
+
7
13
  const {
8
14
  element = 'div',
9
15
  gap,
@@ -11,7 +17,7 @@
11
17
  className,
12
18
  children,
13
19
  ...rest
14
- }: SvelteGridProps = $props()
20
+ }: Props = $props()
15
21
 
16
22
  const classes = $derived(classNames([
17
23
  'grid',
@@ -1,9 +1,14 @@
1
- import React from 'react'
2
- import type { ReactGridProps } from './grid'
1
+ import React, { type JSX } from 'react'
2
+ import type { GridProps } from './grid'
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
  import { getLayoutClasses } from '../../utils/getLayoutClasses'
6
6
 
7
+ export type Props = Omit<GridProps, 'element'> & {
8
+ Element?: keyof JSX.IntrinsicElements
9
+ children: React.ReactNode
10
+ }
11
+
7
12
  const Grid = ({
8
13
  Element = 'div',
9
14
  gap,
@@ -11,7 +16,7 @@ const Grid = ({
11
16
  className,
12
17
  children,
13
18
  ...rest
14
- }: ReactGridProps) => {
19
+ }: Props) => {
15
20
  const classes = classNames([
16
21
  'grid',
17
22
  getLayoutClasses({ gap, column }),
@@ -1,25 +1,12 @@
1
- import type { JSX } from 'react'
2
- import type { Snippet } from 'svelte'
3
-
4
1
  import type {
5
2
  Column,
6
3
  Gap,
7
4
  Responsive
8
5
  } from '../../utils/getLayoutClasses'
9
6
 
10
- export type GridProps = {
7
+ export type GridProps<T extends object = object> = {
11
8
  element?: string
12
9
  gap?: Responsive<Gap>
13
10
  column?: Responsive<Column>
14
11
  className?: string
15
- [key: string]: any
16
- }
17
-
18
- export type SvelteGridProps = {
19
- children: Snippet
20
- } & GridProps
21
-
22
- export type ReactGridProps = {
23
- Element?: keyof JSX.IntrinsicElements
24
- children: React.ReactNode
25
- } & Omit<GridProps, 'element'>
12
+ } & T
@@ -3,7 +3,7 @@ import type { GroupProps } from './group'
3
3
 
4
4
  import styles from './group.module.scss'
5
5
 
6
- interface Props extends GroupProps {}
6
+ export type Props = GroupProps
7
7
 
8
8
  const {
9
9
  withSeparator,
@@ -1,15 +1,20 @@
1
1
  <script lang="ts">
2
- import type { SvelteGroupProps } from './group'
2
+ import type { Snippet } from 'svelte'
3
+ import type { GroupProps } from './group'
3
4
 
4
5
  import { classNames } from '../../utils/classNames'
5
6
 
6
7
  import styles from './group.module.scss'
7
8
 
9
+ export type Props = GroupProps & {
10
+ children: Snippet
11
+ }
12
+
8
13
  const {
9
14
  withSeparator,
10
15
  className,
11
16
  children
12
- }: SvelteGroupProps = $props()
17
+ }: Props = $props()
13
18
 
14
19
  const classes = $derived(classNames([
15
20
  styles.group,
@@ -1,15 +1,19 @@
1
1
  import React from 'react'
2
- import type { ReactGroupProps } from './group'
2
+ import type { GroupProps } from './group'
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
 
6
6
  import styles from './group.module.scss'
7
7
 
8
+ export type Props = GroupProps & {
9
+ children: React.ReactNode
10
+ }
11
+
8
12
  const Group = ({
9
13
  withSeparator,
10
14
  className,
11
15
  children
12
- }: ReactGroupProps) => {
16
+ }: Props) => {
13
17
  const classes = classNames([
14
18
  styles.group,
15
19
  withSeparator && styles.separator,
@@ -1,14 +1,4 @@
1
- import type { Snippet } from 'svelte'
2
-
3
1
  export type GroupProps = {
4
2
  withSeparator?: boolean
5
3
  className?: string
6
4
  }
7
-
8
- export type SvelteGroupProps = {
9
- children: Snippet
10
- } & GroupProps
11
-
12
- export type ReactGroupProps = {
13
- children: React.ReactNode
14
- } & GroupProps
@@ -2,7 +2,7 @@
2
2
  import type { IconProps } from './icon'
3
3
  import iconMap from './map'
4
4
 
5
- interface Props extends IconProps {}
5
+ export type Props = IconProps
6
6
 
7
7
  const {
8
8
  type,
@@ -1,6 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { IconProps } from './icon'
3
3
  import iconMap from './map'
4
+
5
+ export type Props = IconProps
4
6
 
5
7
  const {
6
8
  type,
@@ -8,7 +10,7 @@
8
10
  color,
9
11
  theme,
10
12
  iconSet
11
- }: IconProps = $props()
13
+ }: Props = $props()
12
14
 
13
15
  const icons = $derived({
14
16
  ...iconMap,
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
1
  import type { IconProps } from './icon'
3
2
  import iconMap from './map'
3
+
4
+ export type Props = IconProps
4
5
 
5
6
  const Icon = ({
6
7
  type,
@@ -8,7 +9,7 @@ const Icon = ({
8
9
  color,
9
10
  theme,
10
11
  iconSet
11
- }: IconProps) => {
12
+ }: Props) => {
12
13
  const icons = {
13
14
  ...iconMap,
14
15
  ...(iconSet || {})
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import type { HTMLAttributes } from 'astro/types'
2
3
  import type { ImageProps } from './image'
3
4
 
4
5
  import AspectRatio from '../AspectRatio/AspectRatio.astro'
@@ -6,7 +7,7 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
6
7
 
7
8
  import styles from './image.module.scss'
8
9
 
9
- interface Props extends ImageProps {}
10
+ export type Props = ImageProps<HTMLAttributes<'img'>>
10
11
 
11
12
  const {
12
13
  src,
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import type { HTMLImgAttributes } from 'svelte/elements'
2
3
  import type { ImageProps } from './image'
3
4
 
4
5
  import AspectRatio from '../AspectRatio/AspectRatio.svelte'
@@ -7,6 +8,8 @@
7
8
 
8
9
  import styles from './image.module.scss'
9
10
 
11
+ export type Props = ImageProps<HTMLImgAttributes>
12
+
10
13
  const {
11
14
  src,
12
15
  alt,
@@ -19,7 +22,7 @@
19
22
  rounded,
20
23
  className,
21
24
  ...rest
22
- }: ImageProps = $props()
25
+ }: Props = $props()
23
26
 
24
27
  const classes = $derived(classNames([
25
28
  styles.img,
@@ -8,6 +8,8 @@ import { classNames } from '../../utils/classNames'
8
8
 
9
9
  import styles from './image.module.scss'
10
10
 
11
+ export type Props = ImageProps<React.ImgHTMLAttributes<HTMLImageElement>>
12
+
11
13
  const Image = ({
12
14
  src,
13
15
  alt,
@@ -20,7 +22,7 @@ const Image = ({
20
22
  rounded,
21
23
  className,
22
24
  ...rest
23
- }: ImageProps) => {
25
+ }: Props) => {
24
26
  const classes = classNames([
25
27
  styles.img,
26
28
  center && styles.center,
@@ -1,4 +1,4 @@
1
- export type ImageProps = {
1
+ export type ImageProps<T extends object = object> = {
2
2
  src: string
3
3
  alt: string
4
4
  width: number | string
@@ -9,5 +9,4 @@ export type ImageProps = {
9
9
  full?: 'width' | 'height' | 'both'
10
10
  rounded?: 'top' | 'bottom' | 'left' | 'right' | 'diagonal' | 'reverse-diagonal' | 'none'
11
11
  className?: string
12
- [key: string]: any
13
- }
12
+ } & T
@@ -8,7 +8,7 @@ import { classNames } from '../../utils/classNames'
8
8
 
9
9
  import styles from './imageloader.module.scss'
10
10
 
11
- interface Props extends ImageLoaderProps {}
11
+ export type Props = ImageLoaderProps
12
12
 
13
13
  const {
14
14
  fallback,
@@ -9,6 +9,8 @@
9
9
 
10
10
  import styles from './imageloader.module.scss'
11
11
 
12
+ export type Props = ImageLoaderProps
13
+
12
14
  const {
13
15
  fallback,
14
16
  animate,
@@ -19,7 +21,7 @@
19
21
  waveColor,
20
22
  className,
21
23
  ...rest
22
- }: ImageLoaderProps = $props()
24
+ }: Props = $props()
23
25
 
24
26
  let container: HTMLDivElement
25
27
 
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef } from 'react'
1
+ import { useEffect, useRef } from 'react'
2
2
  import type { ImageLoaderProps } from './imageloader'
3
3
 
4
4
  import Image from '../Image/Image.tsx'
@@ -6,6 +6,8 @@ import Skeleton from '../Skeleton/Skeleton.tsx'
6
6
 
7
7
  import styles from './imageloader.module.scss'
8
8
 
9
+ export type Props = ImageLoaderProps
10
+
9
11
  const ImageLoader = ({
10
12
  fallback,
11
13
  animate,
@@ -16,7 +18,7 @@ const ImageLoader = ({
16
18
  waveColor,
17
19
  className,
18
20
  ...rest
19
- }: ImageLoaderProps) => {
21
+ }: Props) => {
20
22
  const containerRef = useRef<HTMLDivElement>(null)
21
23
  const styleVariables = {
22
24
  width,
@@ -1,11 +1,12 @@
1
1
  ---
2
+ import type { HTMLAttributes } from 'astro/types'
2
3
  import type { InputProps } from './input'
3
4
 
4
5
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
5
6
 
6
7
  import styles from './input.module.scss'
7
8
 
8
- interface Props extends InputProps {}
9
+ export type Props = InputProps<HTMLAttributes<'input'>>
9
10
 
10
11
  const {
11
12
  type = 'text',
@@ -50,8 +51,8 @@ const useLabel = !!(label || subText || Astro.slots.has('default'))
50
51
  )}
51
52
  </label>
52
53
  <input
54
+ {...rest}
53
55
  type={type}
54
56
  class:list={classes}
55
- {...rest}
56
57
  />
57
58
  </ConditionalWrapper>