webcoreui 0.8.1 → 0.10.0

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 (175) hide show
  1. package/README.md +36 -6
  2. package/astro.d.ts +23 -0
  3. package/astro.js +8 -0
  4. package/components/Accordion/Accordion.astro +15 -10
  5. package/components/Accordion/Accordion.svelte +14 -12
  6. package/components/Accordion/Accordion.tsx +2 -2
  7. package/components/Accordion/accordion.module.scss +1 -0
  8. package/components/Alert/Alert.svelte +17 -12
  9. package/components/Alert/Alert.tsx +1 -1
  10. package/components/Alert/alert.ts +10 -3
  11. package/components/AspectRatio/AspectRatio.svelte +7 -4
  12. package/components/AspectRatio/aspectratio.ts +6 -0
  13. package/components/Avatar/Avatar.svelte +11 -9
  14. package/components/Badge/Badge.svelte +14 -10
  15. package/components/Badge/badge.ts +3 -2
  16. package/components/Banner/Banner.astro +10 -4
  17. package/components/Banner/Banner.svelte +14 -10
  18. package/components/Banner/Banner.tsx +1 -0
  19. package/components/Banner/banner.ts +6 -0
  20. package/components/BottomNavigation/BottomNavigation.astro +51 -0
  21. package/components/BottomNavigation/BottomNavigation.svelte +47 -0
  22. package/components/BottomNavigation/BottomNavigation.tsx +63 -0
  23. package/components/BottomNavigation/bottomnavigation.module.scss +70 -0
  24. package/components/BottomNavigation/bottomnavigation.ts +16 -0
  25. package/components/Breadcrumb/Breadcrumb.astro +1 -1
  26. package/components/Breadcrumb/Breadcrumb.svelte +8 -6
  27. package/components/Breadcrumb/Breadcrumb.tsx +2 -2
  28. package/components/Button/Button.svelte +12 -8
  29. package/components/Button/Button.tsx +2 -2
  30. package/components/Button/button.ts +2 -3
  31. package/components/Card/Card.svelte +14 -10
  32. package/components/Card/card.module.scss +1 -0
  33. package/components/Card/card.ts +6 -0
  34. package/components/Carousel/Carousel.astro +46 -41
  35. package/components/Carousel/carousel.ts +3 -0
  36. package/components/Checkbox/Checkbox.astro +8 -2
  37. package/components/Checkbox/Checkbox.svelte +12 -8
  38. package/components/Checkbox/Checkbox.tsx +3 -1
  39. package/components/Checkbox/checkbox.module.scss +4 -0
  40. package/components/Checkbox/checkbox.ts +1 -0
  41. package/components/Collapsible/Collapsible.astro +8 -5
  42. package/components/Collapsible/Collapsible.svelte +54 -49
  43. package/components/Collapsible/collapsible.ts +8 -0
  44. package/components/ConditionalWrapper/ConditionalWrapper.svelte +10 -6
  45. package/components/ConditionalWrapper/conditionalwrapper.ts +6 -0
  46. package/components/Copy/Copy.astro +80 -0
  47. package/components/Copy/Copy.svelte +68 -0
  48. package/components/Copy/Copy.tsx +74 -0
  49. package/components/Copy/copy.module.scss +37 -0
  50. package/components/Copy/copy.ts +20 -0
  51. package/components/DataTable/DataTable.astro +103 -93
  52. package/components/DataTable/DataTable.svelte +276 -272
  53. package/components/DataTable/datatable.ts +5 -2
  54. package/components/Flex/Flex.astro +34 -0
  55. package/components/Flex/Flex.svelte +31 -0
  56. package/components/Flex/Flex.tsx +30 -0
  57. package/components/Flex/flex.ts +28 -0
  58. package/components/Footer/Footer.svelte +12 -9
  59. package/components/Footer/footer.ts +6 -0
  60. package/components/Grid/Grid.astro +32 -0
  61. package/components/Grid/Grid.svelte +29 -0
  62. package/components/Grid/Grid.tsx +28 -0
  63. package/components/Grid/grid.ts +24 -0
  64. package/components/Group/Group.svelte +7 -4
  65. package/components/Group/group.ts +6 -0
  66. package/components/Icon/Icon.astro +19 -5
  67. package/components/Icon/Icon.svelte +23 -7
  68. package/components/Icon/Icon.tsx +19 -5
  69. package/components/Icon/icon.ts +10 -3
  70. package/components/Icon/map.ts +10 -10
  71. package/components/Input/Input.astro +1 -1
  72. package/components/Input/Input.svelte +26 -20
  73. package/components/Input/Input.tsx +4 -1
  74. package/components/Input/input.ts +10 -3
  75. package/components/Kbd/Kbd.svelte +7 -4
  76. package/components/Kbd/kbd.ts +6 -0
  77. package/components/List/List.astro +65 -60
  78. package/components/List/List.svelte +149 -147
  79. package/components/List/List.tsx +1 -1
  80. package/components/List/list.module.scss +3 -0
  81. package/components/Masonry/Masonry.svelte +12 -10
  82. package/components/Menu/Menu.astro +8 -3
  83. package/components/Menu/Menu.svelte +19 -10
  84. package/components/Menu/Menu.tsx +3 -1
  85. package/components/Menu/menu.ts +6 -0
  86. package/components/Modal/Modal.astro +1 -0
  87. package/components/Modal/Modal.svelte +18 -13
  88. package/components/Modal/Modal.tsx +2 -1
  89. package/components/Modal/modal.ts +6 -1
  90. package/components/Pagination/Pagination.astro +75 -69
  91. package/components/Pagination/Pagination.svelte +30 -26
  92. package/components/Pagination/Pagination.tsx +5 -4
  93. package/components/Pagination/pagination.module.scss +4 -0
  94. package/components/Popover/Popover.svelte +10 -6
  95. package/components/Popover/popover.ts +6 -0
  96. package/components/Progress/Progress.svelte +12 -10
  97. package/components/Progress/progress.ts +1 -1
  98. package/components/Radio/Radio.astro +3 -1
  99. package/components/Radio/Radio.svelte +14 -10
  100. package/components/Radio/Radio.tsx +5 -3
  101. package/components/Radio/radio.ts +5 -2
  102. package/components/Rating/Rating.svelte +16 -14
  103. package/components/Ribbon/Ribbon.svelte +9 -6
  104. package/components/Ribbon/ribbon.ts +6 -0
  105. package/components/Select/Select.astro +85 -42
  106. package/components/Select/Select.svelte +62 -21
  107. package/components/Select/Select.tsx +41 -7
  108. package/components/Select/select.ts +4 -1
  109. package/components/Sheet/Sheet.svelte +9 -5
  110. package/components/Sheet/sheet.ts +6 -2
  111. package/components/Sidebar/Sidebar.svelte +7 -4
  112. package/components/Sidebar/sidebar.ts +6 -0
  113. package/components/Skeleton/Skeleton.astro +2 -2
  114. package/components/Skeleton/Skeleton.svelte +11 -9
  115. package/components/Skeleton/Skeleton.tsx +2 -2
  116. package/components/Slider/Slider.svelte +15 -13
  117. package/components/Slider/slider.module.scss +4 -0
  118. package/components/Slider/slider.ts +4 -2
  119. package/components/Spinner/Spinner.svelte +7 -5
  120. package/components/Spoiler/Spoiler.astro +13 -8
  121. package/components/Spoiler/Spoiler.svelte +13 -10
  122. package/components/Spoiler/spoiler.ts +6 -0
  123. package/components/Stepper/Stepper.svelte +9 -7
  124. package/components/Switch/Switch.astro +3 -2
  125. package/components/Switch/Switch.svelte +15 -11
  126. package/components/Switch/Switch.tsx +3 -1
  127. package/components/Switch/switch.ts +1 -0
  128. package/components/Table/Table.svelte +11 -9
  129. package/components/Table/table.ts +1 -1
  130. package/components/Tabs/Tabs.astro +8 -5
  131. package/components/Tabs/Tabs.svelte +14 -11
  132. package/components/Tabs/tabs.ts +7 -1
  133. package/components/Textarea/Textarea.astro +3 -1
  134. package/components/Textarea/Textarea.svelte +51 -47
  135. package/components/Textarea/textarea.ts +24 -18
  136. package/components/ThemeSwitcher/ThemeSwitcher.astro +43 -37
  137. package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -10
  138. package/components/ThemeSwitcher/themeswitcher.ts +7 -0
  139. package/components/Timeline/Timeline.svelte +12 -9
  140. package/components/Timeline/timeline.ts +7 -2
  141. package/components/TimelineItem/TimelineItem.svelte +8 -5
  142. package/components/TimelineItem/timelineitem.ts +6 -0
  143. package/components/Toast/Toast.svelte +18 -10
  144. package/components/Toast/toast.ts +6 -1
  145. package/icons/alert.svg +2 -2
  146. package/icons/check.svg +2 -2
  147. package/icons/chevron-down.svg +3 -0
  148. package/icons/chevron-left.svg +3 -0
  149. package/icons/chevron-right.svg +3 -0
  150. package/icons/chevron-up.svg +3 -0
  151. package/icons/circle-check.svg +3 -3
  152. package/icons/copy.svg +3 -0
  153. package/icons/info.svg +3 -3
  154. package/icons.d.ts +5 -5
  155. package/icons.js +5 -5
  156. package/index.d.ts +75 -2
  157. package/index.js +2 -0
  158. package/package.json +31 -22
  159. package/react.d.ts +23 -0
  160. package/react.js +8 -0
  161. package/scss/global/utility.scss +48 -3
  162. package/svelte.d.ts +111 -88
  163. package/svelte.js +8 -0
  164. package/utils/DOMUtils.ts +2 -2
  165. package/utils/bodyFreeze.ts +13 -0
  166. package/utils/classNames.ts +1 -1
  167. package/utils/getLayoutClasses.ts +141 -0
  168. package/utils/modal.ts +16 -4
  169. package/utils/popover.ts +30 -4
  170. package/icons/arrow-down.svg +0 -3
  171. package/icons/arrow-left.svg +0 -3
  172. package/icons/arrow-right.svg +0 -3
  173. package/icons/components.svg +0 -3
  174. package/icons/file.svg +0 -3
  175. package/scss/webcore.config.scss +0 -0
package/README.md CHANGED
@@ -20,6 +20,18 @@
20
20
  alt="License"
21
21
  />
22
22
  </a>
23
+ <a href="https://github.com/Frontendland/webcoreui/actions">
24
+ <img
25
+ src="https://img.shields.io/github/actions/workflow/status/Frontendland/webcoreui/checks.yml"
26
+ alt="Build"
27
+ />
28
+ </a>
29
+ <a href="https://www.npmjs.com/package/webcoreui">
30
+ <img
31
+ src="https://img.shields.io/npm/d18m/webcoreui.svg?color=black"
32
+ alt="NPM"
33
+ />
34
+ </a>
23
35
  </p>
24
36
 
25
37
  > [!IMPORTANT]
@@ -52,18 +64,18 @@ Webcore can be used as a standalone project, or it can be integrated into your e
52
64
 
53
65
  Webcore components use Sass for styling. To use the component library, you must have the following packages installed:
54
66
 
55
- - [Sass](https://www.npmjs.com/package/sass) - `v1.80`
56
- - [TypeScript](https://www.npmjs.com/package/typescript) - `v5.4`
67
+ - [Sass](https://www.npmjs.com/package/sass) - `v1.83`
68
+ - [TypeScript](https://www.npmjs.com/package/typescript) - `v5.7`
57
69
 
58
70
  Depending on your project setup, you'll also need the following packages:
59
71
 
60
72
  - **For Astro projects**
61
- - [Astro](https://www.npmjs.com/package/astro) - `v4.16`
73
+ - [Astro](https://www.npmjs.com/package/astro) - `v5.1`
62
74
  - **For Svelte projects**
63
- - [Svelte](https://www.npmjs.com/package/svelte) - `v4.2`
75
+ - [Svelte](https://www.npmjs.com/package/svelte) - `v5.19`
64
76
  - **For React projects**
65
- - [React](https://www.npmjs.com/package/react) - `v18.3`
66
- - [React DOM](https://www.npmjs.com/package/react-dom) -`v18.3`
77
+ - [React](https://www.npmjs.com/package/react) - `v19.0`
78
+ - [React DOM](https://www.npmjs.com/package/react-dom) -`v19.0`
67
79
 
68
80
  ### Installation
69
81
 
@@ -113,6 +125,9 @@ html body {
113
125
  // Banner component
114
126
  --w-banner-top: 0;
115
127
 
128
+ // BottomNavigation component
129
+ --w-bottom-navigation-max-width: auto;
130
+
116
131
  // Checkbox component
117
132
  --w-checkbox-color: var(--w-color-primary);
118
133
 
@@ -222,6 +237,7 @@ import { Accordion } from 'webcoreui/react'
222
237
  - [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
223
238
  - [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
224
239
  - [Banner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Banner)
240
+ - [BottomNavigation](https://github.com/Frontendland/webcoreui/tree/main/src/components/BottomNavigation)
225
241
  - [Breadcrumb](https://github.com/Frontendland/webcoreui/tree/main/src/components/Breadcrumb)
226
242
  - [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
227
243
  - [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
@@ -229,8 +245,11 @@ import { Accordion } from 'webcoreui/react'
229
245
  - [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
230
246
  - [Collapsible](https://github.com/Frontendland/webcoreui/tree/main/src/components/Collapsible)
231
247
  - [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
248
+ - [Copy](https://github.com/Frontendland/webcoreui/tree/main/src/components/Copy)
232
249
  - [DataTable](https://github.com/Frontendland/webcoreui/tree/main/src/components/DataTable)
250
+ - [Flex](https://github.com/Frontendland/webcoreui/tree/main/src/components/Flex)
233
251
  - [Footer](https://github.com/Frontendland/webcoreui/tree/main/src/components/Footer)
252
+ - [Grid](https://github.com/Frontendland/webcoreui/tree/main/src/components/Grid)
234
253
  - [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
235
254
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
236
255
  - [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
@@ -265,12 +284,23 @@ import { Accordion } from 'webcoreui/react'
265
284
  ## Blocks
266
285
 
267
286
  - [BlogCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/BlogCard)
287
+ - [ComponentMap](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ComponentMap)
288
+ - [DeviceMockup](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/DeviceMockup)
268
289
  - [ErrorPage](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ErrorPage)
269
290
  - [FAQ](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/FAQ)
291
+ - [GridWithIcons](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/GridWithIcons)
270
292
  - [Hero](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Hero)
293
+ - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Icon)
271
294
  - [IconList](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/IconList)
295
+ - [Layout](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Layout)
296
+ - [SEO](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SEO)
272
297
  - [SettingCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SettingCard)
273
298
  - [SignUp](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SignUp)
274
299
  - [SocialProof](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SocialProof)
275
300
  - [Tiles](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Tiles)
276
301
  - [User](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/User)
302
+
303
+ ## Templates
304
+
305
+ - [Portfolio](https://github.com/Frontendland/webcoreui/tree/main/src/templates/Portfolio)
306
+ - [ProductPage](https://github.com/Frontendland/webcoreui/tree/main/src/templates/ProductPage)
package/astro.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { AspectRatioProps as WAspectRatioProps } from './components/AspectR
4
4
  import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
5
5
  import type { BadgeProps as WBadgeProps } from './components/Badge/badge'
6
6
  import type { BannerProps as WBannerProps } from './components/Banner/banner'
7
+ import type { BottomNavigationProps as WBottomNavigationProps } from './components/BottomNavigation/bottomnavigation'
7
8
  import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
8
9
  import type { ButtonProps as WButtonProps } from './components/Button/button'
9
10
  import type { CardProps as WCardProps } from './components/Card/card'
@@ -11,8 +12,11 @@ import type { CarouselProps as WCarouselProps } from './components/Carousel/caro
11
12
  import type { CheckboxProps as WCheckboxProps } from './components/Checkbox/checkbox'
12
13
  import type { CollapsibleProps as WCollapsibleProps } from './components/Collapsible/collapsible'
13
14
  import type { ConditionalWrapperProps as WConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
15
+ import type { CopyProps as WCopyProps } from './components/Copy/copy'
14
16
  import type { DataTableProps as WDataTableProps } from './components/DataTable/datatable'
17
+ import type { FlexProps as WFlexProps } from './components/Flex/flex'
15
18
  import type { FooterProps as WFooterProps } from './components/Footer/footer'
19
+ import type { GridProps as WGridProps } from './components/Grid/grid'
16
20
  import type { GroupProps as WGroupProps } from './components/Group/group'
17
21
  import type { IconProps as WIconProps } from './components/Icon/icon'
18
22
  import type { InputProps as WInputProps } from './components/Input/input'
@@ -44,6 +48,11 @@ import type { TimelineProps as WTimelineProps } from './components/Timeline/time
44
48
  import type { TimelineItemProps as WTimelineItemProps } from './components/TimelineItem/timelineitem'
45
49
  import type { ToastProps as WToastProps } from './components/Toast/toast'
46
50
 
51
+ import type { DataTableEventType as WDataTableEventType, HeadingObject as WHeadingObject } from './components/DataTable/datatable.ts'
52
+ import type { ListEventType as WListEventType } from './components/List/list.ts'
53
+ import type { PaginationEventType as WPaginationEventType } from './components/Pagination/pagination.ts'
54
+ import type { SelectEventType as WSelectEventType } from './components/Select/select.ts'
55
+
47
56
  declare module 'webcoreui/astro' {
48
57
  export function Accordion(_props: WAccordionProps): any
49
58
  export function Alert(_props: WAlertProps): any
@@ -51,6 +60,7 @@ declare module 'webcoreui/astro' {
51
60
  export function Avatar(_props: WAvatarProps): any
52
61
  export function Badge(_props: WBadgeProps): any
53
62
  export function Banner(_props: WBannerProps): any
63
+ export function BottomNavigation(_props: WBottomNavigationProps): any
54
64
  export function Breadcrumb(_props: WBreadcrumbProps): any
55
65
  export function Button(_props: WButtonProps): any
56
66
  export function Card(_props: WCardProps): any
@@ -58,8 +68,11 @@ declare module 'webcoreui/astro' {
58
68
  export function Checkbox(_props: WCheckboxProps): any
59
69
  export function Collapsible(_props: WCollapsibleProps): any
60
70
  export function ConditionalWrapper(_props: WConditionalWrapperProps): any
71
+ export function Copy(_props: WCopyProps): any
61
72
  export function DataTable(_props: WDataTableProps): any
73
+ export function Flex(_props: WFlexProps): any
62
74
  export function Footer(_props: WFooterProps): any
75
+ export function Grid(_props: WGridProps): any
63
76
  export function Group(_props: WGroupProps): any
64
77
  export function Icon(_props: WIconProps): any
65
78
  export function Input(_props: WInputProps): any
@@ -97,6 +110,7 @@ declare module 'webcoreui/astro' {
97
110
  export type AvatarProps = WAvatarProps
98
111
  export type BadgeProps = WBadgeProps
99
112
  export type BannerProps = WBannerProps
113
+ export type BottomNavigationProps = WBottomNavigationProps
100
114
  export type BreadcrumbProps = WBreadcrumbProps
101
115
  export type ButtonProps = WButtonProps
102
116
  export type CardProps = WCardProps
@@ -104,8 +118,11 @@ declare module 'webcoreui/astro' {
104
118
  export type CheckboxProps = WCheckboxProps
105
119
  export type CollapsibleProps = WCollapsibleProps
106
120
  export type ConditionalWrapperProps = WConditionalWrapperProps
121
+ export type CopyProps = WCopyProps
107
122
  export type DataTableProps = WDataTableProps
123
+ export type FlexProps = WFlexProps
108
124
  export type FooterProps = WFooterProps
125
+ export type GridProps = WGridProps
109
126
  export type GroupProps = WGroupProps
110
127
  export type IconProps = WIconProps
111
128
  export type InputProps = WInputProps
@@ -136,4 +153,10 @@ declare module 'webcoreui/astro' {
136
153
  export type TimelineProps = WTimelineProps
137
154
  export type TimelineItemProps = WTimelineItemProps
138
155
  export type ToastProps = WToastProps
156
+
157
+ export type DataTableEventType = WDataTableEventType
158
+ export type HeadingObject = WHeadingObject
159
+ export type ListEventType = WListEventType
160
+ export type PaginationEventType = WPaginationEventType
161
+ export type SelectEventType = WSelectEventType
139
162
  }
package/astro.js CHANGED
@@ -4,6 +4,7 @@ import AspectRatioComponent from './components/AspectRatio/AspectRatio.astro'
4
4
  import AvatarComponent from './components/Avatar/Avatar.astro'
5
5
  import BadgeComponent from './components/Badge/Badge.astro'
6
6
  import BannerComponent from './components/Banner/Banner.astro'
7
+ import BottomNavigationComponent from './components/BottomNavigation/BottomNavigation.astro'
7
8
  import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.astro'
8
9
  import ButtonComponent from './components/Button/Button.astro'
9
10
  import CardComponent from './components/Card/Card.astro'
@@ -11,8 +12,11 @@ import CarouselComponent from './components/Carousel/Carousel.astro'
11
12
  import CheckboxComponent from './components/Checkbox/Checkbox.astro'
12
13
  import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
13
14
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
15
+ import CopyComponent from './components/Copy/Copy.astro'
14
16
  import DataTableComponent from './components/DataTable/DataTable.astro'
17
+ import FlexComponent from './components/Flex/Flex.astro'
15
18
  import FooterComponent from './components/Footer/Footer.astro'
19
+ import GridComponent from './components/Grid/Grid.astro'
16
20
  import GroupComponent from './components/Group/Group.astro'
17
21
  import IconComponent from './components/Icon/Icon.astro'
18
22
  import InputComponent from './components/Input/Input.astro'
@@ -50,6 +54,7 @@ export const AspectRatio = AspectRatioComponent
50
54
  export const Avatar = AvatarComponent
51
55
  export const Badge = BadgeComponent
52
56
  export const Banner = BannerComponent
57
+ export const BottomNavigation = BottomNavigationComponent
53
58
  export const Breadcrumb = BreadcrumbComponent
54
59
  export const Button = ButtonComponent
55
60
  export const Card = CardComponent
@@ -57,8 +62,11 @@ export const Carousel = CarouselComponent
57
62
  export const Checkbox = CheckboxComponent
58
63
  export const Collapsible = CollapsibleComponent
59
64
  export const ConditionalWrapper = ConditionalWrapperComponent
65
+ export const Copy = CopyComponent
60
66
  export const DataTable = DataTableComponent
67
+ export const Flex = FlexComponent
61
68
  export const Footer = FooterComponent
69
+ export const Grid = GridComponent
62
70
  export const Group = GroupComponent
63
71
  export const Icon = IconComponent
64
72
  export const Input = InputComponent
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { AccordionProps } from './accordion'
3
3
 
4
- import ArrowDown from '../../icons/arrow-down.svg?raw'
4
+ import ChevronDown from '../../icons/chevron-down.svg?raw'
5
5
  import Plus from '../../icons/plus.svg?raw'
6
6
 
7
7
  import styles from './accordion.module.scss'
@@ -32,7 +32,7 @@ const classes = [
32
32
  >
33
33
  {item.title}
34
34
  {icon !== 'none' && (
35
- <Fragment set:html={icon === 'plus' ? Plus : ArrowDown} />
35
+ <Fragment set:html={icon === 'plus' ? Plus : ChevronDown} />
36
36
  )}
37
37
  </button>
38
38
  <div class={styles.wrapper}>
@@ -45,13 +45,18 @@ const classes = [
45
45
  <script>
46
46
  import { on } from '../../utils/DOMUtils'
47
47
 
48
- on('[data-id="w-accordion"]', 'click', (event: Event) => {
49
- const target = event.target as HTMLDivElement
48
+ const addEventListeners = () => {
49
+ on('[data-id="w-accordion"]', 'click', (event: Event) => {
50
+ const target = event.target as HTMLDivElement
50
51
 
51
- if (target.dataset.toggle) {
52
- target.dataset.open = target.dataset.open === 'true'
53
- ? 'false'
54
- : 'true'
55
- }
56
- }, true)
52
+ if (target.dataset.toggle) {
53
+ target.dataset.open = target.dataset.open === 'true'
54
+ ? 'false'
55
+ : 'true'
56
+ }
57
+ }, true)
58
+ }
59
+
60
+ on(document, 'astro:after-swap', addEventListeners)
61
+ addEventListeners()
57
62
  </script>
@@ -3,22 +3,24 @@
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
 
6
- import ArrowDown from '../../icons/arrow-down.svg?raw'
6
+ import ChevronDown from '../../icons/chevron-down.svg?raw'
7
7
  import Plus from '../../icons/plus.svg?raw'
8
8
 
9
9
  import styles from './accordion.module.scss'
10
10
 
11
- export let items: AccordionProps['items'] = []
12
- export let icon: AccordionProps['icon'] = null
13
- export let reverse: AccordionProps['reverse'] = false
14
- export let className: AccordionProps['className'] = ''
11
+ const {
12
+ items,
13
+ icon,
14
+ reverse,
15
+ className
16
+ }: AccordionProps = $props()
15
17
 
16
- let state = Array(items.length).fill(false)
18
+ let toggleState = $state(Array(items.length).fill(false))
17
19
 
18
20
  const toggle = (index: number) => {
19
- state = state.map((_, i) => index === i
20
- ? !state[i]
21
- : state[i]
21
+ toggleState = toggleState.map((_, i) => index === i
22
+ ? !toggleState[i]
23
+ : toggleState[i]
22
24
  )
23
25
  }
24
26
 
@@ -38,12 +40,12 @@
38
40
  styles.title,
39
41
  item.reverse && styles.reverse
40
42
  ])}
41
- data-open={state[index]}
42
- on:click={() => toggle(index)}
43
+ data-open={toggleState[index]}
44
+ onclick={() => toggle(index)}
43
45
  >
44
46
  {item.title}
45
47
  {#if icon !== 'none'}
46
- {@html icon === 'plus' ? Plus : ArrowDown}
48
+ {@html icon === 'plus' ? Plus : ChevronDown}
47
49
  {/if}
48
50
  </button>
49
51
  <div class={styles.wrapper}>
@@ -3,7 +3,7 @@ import type { AccordionProps } from './accordion'
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
 
6
- import ArrowDown from '../../icons/arrow-down.svg?raw'
6
+ import ChevronDown from '../../icons/chevron-down.svg?raw'
7
7
  import Plus from '../../icons/plus.svg?raw'
8
8
 
9
9
  import styles from './accordion.module.scss'
@@ -43,7 +43,7 @@ const Accordion = ({
43
43
  ])}
44
44
  dangerouslySetInnerHTML={{ __html: icon === 'none'
45
45
  ? item.title
46
- : `${item.title} ${icon === 'plus' ? Plus : ArrowDown}`
46
+ : `${item.title} ${icon === 'plus' ? Plus : ChevronDown}`
47
47
  }}
48
48
  />
49
49
  <div className={styles.wrapper}>
@@ -44,6 +44,7 @@
44
44
  @include size(15px);
45
45
  @include typography(primary-20);
46
46
  pointer-events: none;
47
+ min-width: 15px;
47
48
  }
48
49
 
49
50
  &[data-open="true"] {
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { AlertProps } from './alert'
2
+ import type { SvelteAlertProps } from './alert'
3
3
 
4
4
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
5
5
 
@@ -10,13 +10,18 @@
10
10
 
11
11
  import styles from './alert.module.scss'
12
12
 
13
- export let element: AlertProps['element'] = 'section'
14
- export let title: AlertProps['title'] = null
15
- export let titleTag: AlertProps['title'] = 'strong'
16
- export let titleProps: AlertProps['titleProps'] = null
17
- export let bodyProps: AlertProps['bodyProps'] = null
18
- export let className: AlertProps['className'] = null
19
- export let theme: AlertProps['theme'] = null
13
+ const {
14
+ element = 'section',
15
+ title,
16
+ titleTag = 'strong',
17
+ titleProps,
18
+ bodyProps,
19
+ className,
20
+ theme,
21
+ icon,
22
+ children,
23
+ ...rest
24
+ }: SvelteAlertProps = $props()
20
25
 
21
26
  const iconMap = {
22
27
  info,
@@ -25,7 +30,7 @@
25
30
  alert
26
31
  }
27
32
 
28
- const hasCustomIcon = $$slots.icon
33
+ const hasCustomIcon = icon
29
34
 
30
35
  const classes = [
31
36
  styles['w-alert'],
@@ -35,8 +40,8 @@
35
40
  ].filter(Boolean).join(' ')
36
41
  </script>
37
42
 
38
- <svelte:element this={element} class={classes} {...$$restProps}>
39
- <slot name="icon" />
43
+ <svelte:element this={element} class={classes} {...rest}>
44
+ {@render icon?.()}
40
45
 
41
46
  {#if !hasCustomIcon && theme}
42
47
  {@html iconMap[theme]}
@@ -53,7 +58,7 @@
53
58
  </svelte:element>
54
59
  {/if}
55
60
  <div class={styles.body} {...bodyProps}>
56
- <slot />
61
+ {@render children?.()}
57
62
  </div>
58
63
  </ConditionalWrapper>
59
64
  </svelte:element>
@@ -40,7 +40,7 @@ const Alert = ({
40
40
  <Element className={classes} {...rest}>
41
41
  {icon && icon}
42
42
  {!icon && theme && <div
43
- dangerouslySetInnerHTML={{ __html: iconMap[theme] }}
43
+ dangerouslySetInnerHTML={{ __html: iconMap[theme as keyof typeof iconMap] }}
44
44
  style={{ height: '20px' }}
45
45
  />}
46
46
 
@@ -1,17 +1,24 @@
1
+ import type { Snippet } from 'svelte'
2
+
1
3
  export type AlertProps = {
2
4
  element?: string
3
- title?: string | null
5
+ title?: string
4
6
  titleTag?: string
5
7
  titleProps?: any
6
8
  bodyProps?: any
7
- className?: string | null
9
+ className?: string
8
10
  theme?: 'info'
9
11
  | 'success'
10
12
  | 'warning'
11
13
  | 'alert'
12
- | null
14
+ [key: string]: any
13
15
  }
14
16
 
17
+ export type SvelteAlertProps = {
18
+ icon?: Snippet
19
+ children: Snippet
20
+ } & AlertProps
21
+
15
22
  export type ReactAlertProps = {
16
23
  Element?: keyof JSX.IntrinsicElements
17
24
  TitleTag?: keyof JSX.IntrinsicElements
@@ -1,12 +1,15 @@
1
1
  <script lang="ts">
2
- import type { AspectRatioProps } from './aspectratio'
2
+ import type { SvelteAspectRatioProps } from './aspectratio'
3
3
 
4
4
  import { classNames } from '../../utils/classNames'
5
5
 
6
6
  import styles from './aspect-ratio.module.scss'
7
7
 
8
- export let ratio: AspectRatioProps['ratio'] = ''
9
- export let className: AspectRatioProps['className'] = ''
8
+ const {
9
+ ratio,
10
+ className,
11
+ children
12
+ }: SvelteAspectRatioProps = $props()
10
13
 
11
14
  const classes = classNames([
12
15
  styles.ratio,
@@ -15,5 +18,5 @@
15
18
  </script>
16
19
 
17
20
  <div class={classes} style={`aspect-ratio: ${ratio.replace(':', '/')};`}>
18
- <slot />
21
+ {@render children?.()}
19
22
  </div>
@@ -1,8 +1,14 @@
1
+ import type { Snippet } from 'svelte'
2
+
1
3
  export type AspectRatioProps = {
2
4
  ratio: string
3
5
  className?: string
4
6
  }
5
7
 
8
+ export type SvelteAspectRatioProps = {
9
+ children: Snippet
10
+ } & AspectRatioProps
11
+
6
12
  export type ReactAspectRatioProps = {
7
13
  children: React.ReactNode
8
14
  } & AspectRatioProps
@@ -5,15 +5,17 @@
5
5
 
6
6
  import styles from './avatar.module.scss'
7
7
 
8
- export let img: AvatarProps['img'] = ''
9
- export let alt: AvatarProps['alt'] = 'Avatar'
10
- export let size: AvatarProps['size'] = 40
11
- export let lazy: AvatarProps['lazy'] = true
12
- export let borderColor: AvatarProps['borderColor'] = ''
13
- export let borderless: AvatarProps['borderless'] = false
14
- export let reverse: AvatarProps['reverse'] = false
15
- export let className: AvatarProps['className'] = ''
16
- export let groupClassName: AvatarProps['groupClassName'] = ''
8
+ const {
9
+ img,
10
+ alt = 'Avatar',
11
+ size = 40,
12
+ lazy = true,
13
+ borderColor,
14
+ borderless,
15
+ reverse,
16
+ className,
17
+ groupClassName
18
+ }: AvatarProps = $props()
17
19
 
18
20
  const classes = classNames([
19
21
  styles.avatar,
@@ -5,12 +5,16 @@
5
5
 
6
6
  import styles from './badge.module.scss'
7
7
 
8
- export let theme: SvelteBadgeProps['theme'] = null
9
- export let hover: SvelteBadgeProps['hover'] = false
10
- export let small: SvelteBadgeProps['small'] = false
11
- export let rounded: SvelteBadgeProps['rounded'] = false
12
- export let className: SvelteBadgeProps['className'] = ''
13
- export let onClick: SvelteBadgeProps['onClick'] = () => {}
8
+ const {
9
+ theme,
10
+ hover,
11
+ small,
12
+ rounded,
13
+ className,
14
+ onClick,
15
+ children,
16
+ ...rest
17
+ }: SvelteBadgeProps = $props()
14
18
 
15
19
  const classes = classNames([
16
20
  styles.badge,
@@ -23,12 +27,12 @@
23
27
  </script>
24
28
 
25
29
  {#if onClick}
26
- <button class={classes} on:click={onClick} {...$$restProps}>
27
- <slot />
30
+ <button class={classes} onclick={onClick} {...rest}>
31
+ {@render children?.()}
28
32
  </button>
29
33
  {:else}
30
- <span class={classes} {...$$restProps}>
31
- <slot />
34
+ <span class={classes} {...rest}>
35
+ {@render children?.()}
32
36
  </span>
33
37
  {/if}
34
38
 
@@ -1,3 +1,4 @@
1
+ import type { Snippet } from 'svelte'
1
2
  import type { MouseEventHandler } from 'svelte/elements'
2
3
 
3
4
  export type BadgeProps = {
@@ -8,7 +9,6 @@ export type BadgeProps = {
8
9
  | 'success'
9
10
  | 'warning'
10
11
  | 'alert'
11
- | null
12
12
  hover?: boolean
13
13
  small?: boolean
14
14
  rounded?: boolean
@@ -17,7 +17,8 @@ export type BadgeProps = {
17
17
  }
18
18
 
19
19
  export type SvelteBadgeProps = {
20
- onClick?: MouseEventHandler<HTMLButtonElement>
20
+ onClick?: MouseEventHandler<HTMLButtonElement> | null
21
+ children?: Snippet
21
22
  } & BadgeProps
22
23
 
23
24
  export type ReactBadgeProps = {
@@ -39,6 +39,7 @@ const style = top
39
39
  theme="flat"
40
40
  className={styles.close}
41
41
  data-id="w-banner-close"
42
+ aria-label="close"
42
43
  >
43
44
  <Fragment set:html={closeIcon} />
44
45
  </Button>
@@ -48,9 +49,14 @@ const style = top
48
49
  <script>
49
50
  import { on } from '../../utils/DOMUtils'
50
51
 
51
- on('[data-id="w-banner-close"]', 'click', (event: Event) => {
52
- const target = event.currentTarget as HTMLDivElement
52
+ const addEventListeners = () => {
53
+ on('[data-id="w-banner-close"]', 'click', (event: Event) => {
54
+ const target = event.currentTarget as HTMLDivElement
53
55
 
54
- target.parentElement?.remove()
55
- }, true)
56
+ target.parentElement?.remove()
57
+ }, true)
58
+ }
59
+
60
+ on(document, 'astro:after-swap', addEventListeners)
61
+ addEventListeners()
56
62
  </script>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { BannerProps } from './banner'
2
+ import type { SvelteBannerProps } from './banner'
3
3
 
4
4
  import Button from '../Button/Button.svelte'
5
5
 
@@ -9,14 +9,15 @@
9
9
 
10
10
  import styles from './banner.module.scss'
11
11
 
12
- export let top: BannerProps['top'] = 0
13
- export let bottom: BannerProps['bottom'] = false
14
- export let closeable: BannerProps['closeable'] = false
15
- export let padded: BannerProps['padded'] = false
16
- export let sticky: BannerProps['sticky'] = true
17
- export let className: BannerProps['className'] = ''
18
-
19
- let visible = true
12
+ const {
13
+ top,
14
+ bottom,
15
+ closeable,
16
+ padded,
17
+ sticky = true,
18
+ className,
19
+ children
20
+ }: SvelteBannerProps = $props()
20
21
 
21
22
  const classes = classNames([
22
23
  styles.banner,
@@ -29,16 +30,19 @@
29
30
  const style = top
30
31
  ? `--w-banner-top: ${top}px;`
31
32
  : null
33
+
34
+ let visible = $state(true)
32
35
  </script>
33
36
 
34
37
  {#if visible}
35
38
  <div class={classes} style={style}>
36
- <slot />
39
+ {@render children?.()}
37
40
  {#if closeable}
38
41
  <Button
39
42
  theme="flat"
40
43
  className={styles.close}
41
44
  onClick={() => visible = false}
45
+ aria-label="close"
42
46
  >
43
47
  {@html closeIcon}
44
48
  </Button>