webcoreui 0.6.1 → 0.7.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 (46) hide show
  1. package/README.md +30 -1
  2. package/astro.d.ts +15 -0
  3. package/astro.js +10 -0
  4. package/components/Accordion/Accordion.astro +32 -20
  5. package/components/Accordion/Accordion.svelte +22 -4
  6. package/components/Accordion/Accordion.tsx +29 -7
  7. package/components/Accordion/accordion.module.scss +12 -0
  8. package/components/Accordion/accordion.ts +4 -0
  9. package/components/AspectRatio/AspectRatio.astro +21 -0
  10. package/components/AspectRatio/AspectRatio.svelte +19 -0
  11. package/components/AspectRatio/AspectRatio.tsx +28 -0
  12. package/components/AspectRatio/aspect-ratio.module.scss +10 -0
  13. package/components/AspectRatio/aspectratio.ts +8 -0
  14. package/components/Banner/Banner.astro +56 -0
  15. package/components/Banner/Banner.svelte +47 -0
  16. package/components/Banner/Banner.tsx +54 -0
  17. package/components/Banner/banner.module.scss +57 -0
  18. package/components/Banner/banner.ts +12 -0
  19. package/components/Icon/map.ts +2 -0
  20. package/components/Kbd/Kbd.astro +20 -0
  21. package/components/Kbd/Kbd.svelte +18 -0
  22. package/components/Kbd/Kbd.tsx +27 -0
  23. package/components/Kbd/kbd.module.scss +8 -0
  24. package/components/Kbd/kbd.ts +26 -0
  25. package/components/Kbd/keyMap.ts +21 -0
  26. package/components/Spoiler/Spoiler.astro +50 -0
  27. package/components/Spoiler/Spoiler.svelte +45 -0
  28. package/components/Spoiler/Spoiler.tsx +50 -0
  29. package/components/Spoiler/spoiler.module.scss +40 -0
  30. package/components/Spoiler/spoiler.ts +11 -0
  31. package/components/Stepper/Stepper.astro +61 -0
  32. package/components/Stepper/Stepper.svelte +59 -0
  33. package/components/Stepper/Stepper.tsx +60 -0
  34. package/components/Stepper/stepper.module.scss +102 -0
  35. package/components/Stepper/stepper.ts +17 -0
  36. package/icons/close.svg +1 -1
  37. package/icons/plus.svg +3 -0
  38. package/icons.d.ts +1 -0
  39. package/icons.js +1 -0
  40. package/package.json +4 -4
  41. package/react.d.ts +15 -0
  42. package/react.js +10 -0
  43. package/scss/global/utility.scss +4 -0
  44. package/scss/resets.scss +5 -0
  45. package/svelte.d.ts +15 -0
  46. package/svelte.js +10 -0
package/README.md CHANGED
@@ -58,7 +58,7 @@ Webcore components use Sass for styling. To use the component library, you must
58
58
  Depending on your project setup, you'll also need the following packages:
59
59
 
60
60
  - **For Astro projects**
61
- - [Astro](https://www.npmjs.com/package/astro) - `v4.10` and above
61
+ - [Astro](https://www.npmjs.com/package/astro) - `v4.16` and above
62
62
  - **For Svelte projects**
63
63
  - [Svelte](https://www.npmjs.com/package/svelte) - `v4.2` and above
64
64
  - **For React projects**
@@ -110,6 +110,9 @@ html body {
110
110
  // Avatar component
111
111
  --w-avatar-border: var(--w-color-primary-70);
112
112
 
113
+ // Banner component
114
+ --w-banner-top: 0;
115
+
113
116
  // Checkbox component
114
117
  --w-checkbox-color: var(--w-color-primary);
115
118
 
@@ -151,6 +154,14 @@ html body {
151
154
  --w-spinner-size: 30px;
152
155
  --w-spinner-dash: 8;
153
156
 
157
+ // Spoiler component
158
+ --w-spoiler-color: var(--w-color-primary);
159
+
160
+ // Stepper component
161
+ --w-stepper-color-border: var(--w-color-primary-50);
162
+ --w-stepper-color-active: var(--w-color-info);
163
+ --w-stepper-color-complete: var(--w-color-success);
164
+
154
165
  // Switch component
155
166
  --w-switch-off-color: var(--w-color-primary-50);
156
167
  --w-switch-on-color: var(--w-color-primary);
@@ -199,8 +210,10 @@ import { Accordion } from 'webcoreui/react'
199
210
 
200
211
  - [Accordion](https://github.com/Frontendland/webcoreui/tree/main/src/components/Accordion)
201
212
  - [Alert](https://github.com/Frontendland/webcoreui/tree/main/src/components/Alert)
213
+ - [AspectRatio](https://github.com/Frontendland/webcoreui/tree/main/src/components/AspectRatio)
202
214
  - [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
203
215
  - [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
216
+ - [Banner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Banner)
204
217
  - [Breadcrumb](https://github.com/Frontendland/webcoreui/tree/main/src/components/Breadcrumb)
205
218
  - [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
206
219
  - [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
@@ -213,6 +226,7 @@ import { Accordion } from 'webcoreui/react'
213
226
  - [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
214
227
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
215
228
  - [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
229
+ - [Kbd](https://github.com/Frontendland/webcoreui/tree/main/src/components/Kbd)
216
230
  - [List](https://github.com/Frontendland/webcoreui/tree/main/src/components/List)
217
231
  - [Masonry](https://github.com/Frontendland/webcoreui/tree/main/src/components/Masonry)
218
232
  - [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
@@ -227,6 +241,8 @@ import { Accordion } from 'webcoreui/react'
227
241
  - [Sidebar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sidebar)
228
242
  - [Slider](https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider)
229
243
  - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
244
+ - [Spoiler](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spoiler)
245
+ - [Stepper](https://github.com/Frontendland/webcoreui/tree/main/src/components/Stepper)
230
246
  - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
231
247
  - [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
232
248
  - [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
@@ -235,3 +251,16 @@ import { Accordion } from 'webcoreui/react'
235
251
  - [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
236
252
  - [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
237
253
  - [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
254
+
255
+ ## Blocks
256
+
257
+ - [BlogCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/BlogCard)
258
+ - [ErrorPage](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ErrorPage)
259
+ - [FAQ](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/FAQ)
260
+ - [Hero](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Hero)
261
+ - [IconList](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/IconList)
262
+ - [SettingCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SettingCard)
263
+ - [SignUp](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SignUp)
264
+ - [SocialProof](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SocialProof)
265
+ - [Tiles](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Tiles)
266
+ - [User](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/User)
package/astro.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { AccordionProps as WAccordionProps } from './components/Accordion/accordion'
2
2
  import type { AlertProps as WAlertProps } from './components/Alert/alert'
3
+ import type { AspectRatioProps as WAspectRatioProps } from './components/AspectRatio/aspectratio'
3
4
  import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
4
5
  import type { BadgeProps as WBadgeProps } from './components/Badge/badge'
6
+ import type { BannerProps as WBannerProps } from './components/Banner/banner'
5
7
  import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
6
8
  import type { ButtonProps as WButtonProps } from './components/Button/button'
7
9
  import type { CardProps as WCardProps } from './components/Card/card'
@@ -14,6 +16,7 @@ import type { FooterProps as WFooterProps } from './components/Footer/footer'
14
16
  import type { GroupProps as WGroupProps } from './components/Group/group'
15
17
  import type { IconProps as WIconProps } from './components/Icon/icon'
16
18
  import type { InputProps as WInputProps } from './components/Input/input'
19
+ import type { KbdProps as WKbdProps } from './components/Kbd/kbd'
17
20
  import type { ListProps as WListProps } from './components/List/list'
18
21
  import type { MasonryProps as WMasonryProps } from './components/Masonry/masonry'
19
22
  import type { MenuProps as WMenuProps } from './components/Menu/menu'
@@ -28,6 +31,8 @@ import type { SheetProps as WSheetProps } from './components/Sheet/sheet'
28
31
  import type { SidebarProps as WSidebarProps } from './components/Sidebar/sidebar'
29
32
  import type { SliderProps as WSliderProps } from './components/Slider/slider'
30
33
  import type { SpinnerProps as WSpinnerProps } from './components/Spinner/spinner'
34
+ import type { SpoilerProps as WSpoilerProps } from './components/Spoiler/spoiler'
35
+ import type { StepperProps as WStepperProps } from './components/Stepper/stepper'
31
36
  import type { SwitchProps as WSwitchProps } from './components/Switch/switch'
32
37
  import type { TableProps as WTableProps } from './components/Table/table'
33
38
  import type { TabsProps as WTabsProps } from './components/Tabs/tabs'
@@ -40,8 +45,10 @@ import type { ToastProps as WToastProps } from './components/Toast/toast'
40
45
  declare module 'webcoreui/astro' {
41
46
  export function Accordion(_props: WAccordionProps): any
42
47
  export function Alert(_props: WAlertProps): any
48
+ export function AspectRatio(_props: WAspectRatioProps): any
43
49
  export function Avatar(_props: WAvatarProps): any
44
50
  export function Badge(_props: WBadgeProps): any
51
+ export function Banner(_props: WBannerProps): any
45
52
  export function Breadcrumb(_props: WBreadcrumbProps): any
46
53
  export function Button(_props: WButtonProps): any
47
54
  export function Card(_props: WCardProps): any
@@ -54,6 +61,7 @@ declare module 'webcoreui/astro' {
54
61
  export function Group(_props: WGroupProps): any
55
62
  export function Icon(_props: WIconProps): any
56
63
  export function Input(_props: WInputProps): any
64
+ export function Kbd(_props: WKbdProps): any
57
65
  export function List(_props: WListProps): any
58
66
  export function Masonry(_props: WMasonryProps): any
59
67
  export function Menu(_props: WMenuProps): any
@@ -68,6 +76,8 @@ declare module 'webcoreui/astro' {
68
76
  export function Sidebar(_props: WSidebarProps): any
69
77
  export function Slider(_props: WSliderProps): any
70
78
  export function Spinner(_props: WSpinnerProps): any
79
+ export function Spoiler(_props: WSpoilerProps): any
80
+ export function Stepper(_props: WStepperProps): any
71
81
  export function Switch(_props: WSwitchProps): any
72
82
  export function Table(_props: WTableProps): any
73
83
  export function Tabs(_props: WTabsProps): any
@@ -79,8 +89,10 @@ declare module 'webcoreui/astro' {
79
89
 
80
90
  export type AccordionProps = WAccordionProps
81
91
  export type AlertProps = WAlertProps
92
+ export type AspectRatioProps = WAspectRatioProps
82
93
  export type AvatarProps = WAvatarProps
83
94
  export type BadgeProps = WBadgeProps
95
+ export type BannerProps = WBannerProps
84
96
  export type BreadcrumbProps = WBreadcrumbProps
85
97
  export type ButtonProps = WButtonProps
86
98
  export type CardProps = WCardProps
@@ -93,6 +105,7 @@ declare module 'webcoreui/astro' {
93
105
  export type GroupProps = WGroupProps
94
106
  export type IconProps = WIconProps
95
107
  export type InputProps = WInputProps
108
+ export type KbdProps = WKbdProps
96
109
  export type ListProps = WListProps
97
110
  export type MasonryProps = WMasonryProps
98
111
  export type MenuProps = WMenuProps
@@ -107,6 +120,8 @@ declare module 'webcoreui/astro' {
107
120
  export type SidebarProps = WSidebarProps
108
121
  export type SliderProps = WSliderProps
109
122
  export type SpinnerProps = WSpinnerProps
123
+ export type SpoilerProps = WSpoilerProps
124
+ export type StepperProps = WStepperProps
110
125
  export type SwitchProps = WSwitchProps
111
126
  export type TableProps = WTableProps
112
127
  export type TabsProps = WTabsProps
package/astro.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import AccordionComponent from './components/Accordion/Accordion.astro'
2
2
  import AlertComponent from './components/Alert/Alert.astro'
3
+ import AspectRatioComponent from './components/AspectRatio/AspectRatio.astro'
3
4
  import AvatarComponent from './components/Avatar/Avatar.astro'
4
5
  import BadgeComponent from './components/Badge/Badge.astro'
6
+ import BannerComponent from './components/Banner/Banner.astro'
5
7
  import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.astro'
6
8
  import ButtonComponent from './components/Button/Button.astro'
7
9
  import CardComponent from './components/Card/Card.astro'
@@ -14,6 +16,7 @@ import FooterComponent from './components/Footer/Footer.astro'
14
16
  import GroupComponent from './components/Group/Group.astro'
15
17
  import IconComponent from './components/Icon/Icon.astro'
16
18
  import InputComponent from './components/Input/Input.astro'
19
+ import KbdComponent from './components/Kbd/Kbd.astro'
17
20
  import ListComponent from './components/List/List.astro'
18
21
  import MasonryComponent from './components/Masonry/Masonry.astro'
19
22
  import MenuComponent from './components/Menu/Menu.astro'
@@ -28,6 +31,8 @@ import SheetComponent from './components/Sheet/Sheet.astro'
28
31
  import SidebarComponent from './components/Sidebar/Sidebar.astro'
29
32
  import SliderComponent from './components/Slider/Slider.astro'
30
33
  import SpinnerComponent from './components/Spinner/Spinner.astro'
34
+ import SpoilerComponent from './components/Spoiler/Spoiler.astro'
35
+ import StepperComponent from './components/Stepper/Stepper.astro'
31
36
  import SwitchComponent from './components/Switch/Switch.astro'
32
37
  import TableComponent from './components/Table/Table.astro'
33
38
  import TabsComponent from './components/Tabs/Tabs.astro'
@@ -39,8 +44,10 @@ import ToastComponent from './components/Toast/Toast.astro'
39
44
 
40
45
  export const Accordion = AccordionComponent
41
46
  export const Alert = AlertComponent
47
+ export const AspectRatio = AspectRatioComponent
42
48
  export const Avatar = AvatarComponent
43
49
  export const Badge = BadgeComponent
50
+ export const Banner = BannerComponent
44
51
  export const Breadcrumb = BreadcrumbComponent
45
52
  export const Button = ButtonComponent
46
53
  export const Card = CardComponent
@@ -53,6 +60,7 @@ export const Footer = FooterComponent
53
60
  export const Group = GroupComponent
54
61
  export const Icon = IconComponent
55
62
  export const Input = InputComponent
63
+ export const Kbd = KbdComponent
56
64
  export const List = ListComponent
57
65
  export const Masonry = MasonryComponent
58
66
  export const Menu = MenuComponent
@@ -67,6 +75,8 @@ export const Sheet = SheetComponent
67
75
  export const Sidebar = SidebarComponent
68
76
  export const Slider = SliderComponent
69
77
  export const Spinner = SpinnerComponent
78
+ export const Spoiler = SpoilerComponent
79
+ export const Stepper = StepperComponent
70
80
  export const Switch = SwitchComponent
71
81
  export const Table = TableComponent
72
82
  export const Tabs = TabsComponent
@@ -2,44 +2,56 @@
2
2
  import type { AccordionProps } from './accordion'
3
3
 
4
4
  import ArrowDown from '../../icons/arrow-down.svg?raw'
5
+ import Plus from '../../icons/plus.svg?raw'
5
6
 
6
7
  import styles from './accordion.module.scss'
7
8
 
8
9
  interface Props extends AccordionProps {}
9
10
 
10
11
  const {
11
- items
12
+ items,
13
+ icon,
14
+ reverse,
15
+ className
12
16
  } = Astro.props
17
+
18
+ const classes = [
19
+ styles.accordion,
20
+ reverse && styles.reverse,
21
+ icon === 'plus' && styles.plus,
22
+ className
23
+ ]
13
24
  ---
14
25
 
15
- <ul class={styles.accordion} data-id="w-accordion">
26
+ <ul class:list={classes} data-id="w-accordion">
16
27
  {items.map((item: AccordionProps['items'][0]) => (
17
28
  <li>
18
- <button class={styles.title} data-toggle="true">
29
+ <button
30
+ class:list={[styles.title, item.reverse && styles.reverse]}
31
+ data-toggle="true"
32
+ >
19
33
  {item.title}
20
- <Fragment set:html={ArrowDown} />
34
+ {icon !== 'none' && (
35
+ <Fragment set:html={icon === 'plus' ? Plus : ArrowDown} />
36
+ )}
21
37
  </button>
22
38
  <div class={styles.wrapper}>
23
- <div class={styles.content}>
24
- <Fragment set:html={item.content} />
25
- </div>
39
+ <div class={styles.content} set:html={item.content} />
26
40
  </div>
27
41
  </li>
28
42
  ))}
29
43
  </ul>
30
44
 
31
45
  <script>
32
- const accordions = document.querySelectorAll('[data-id="w-accordion"]')
33
-
34
- Array.from(accordions).forEach(element => {
35
- element.addEventListener('click', event => {
36
- const target = event.target as HTMLDivElement
37
-
38
- if (target.dataset.toggle) {
39
- target.dataset.open = target.dataset.open === 'true'
40
- ? 'false'
41
- : 'true'
42
- }
43
- })
44
- })
46
+ import { on } from '../../utils/DOMUtils'
47
+
48
+ on('[data-id="w-accordion"]', 'click', (event: Event) => {
49
+ const target = event.target as HTMLDivElement
50
+
51
+ if (target.dataset.toggle) {
52
+ target.dataset.open = target.dataset.open === 'true'
53
+ ? 'false'
54
+ : 'true'
55
+ }
56
+ }, true)
45
57
  </script>
@@ -1,11 +1,17 @@
1
1
  <script lang="ts">
2
2
  import type { AccordionProps } from './accordion'
3
3
 
4
+ import { classNames } from '../../utils/classNames'
5
+
4
6
  import ArrowDown from '../../icons/arrow-down.svg?raw'
7
+ import Plus from '../../icons/plus.svg?raw'
5
8
 
6
9
  import styles from './accordion.module.scss'
7
10
 
8
- export let items: AccordionProps['items']
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'] = ''
9
15
 
10
16
  let state = Array(items.length).fill(false)
11
17
 
@@ -15,18 +21,30 @@
15
21
  : state[i]
16
22
  )
17
23
  }
24
+
25
+ const classes = classNames([
26
+ styles.accordion,
27
+ reverse && styles.reverse,
28
+ icon === 'plus' && styles.plus,
29
+ className
30
+ ])
18
31
  </script>
19
32
 
20
- <ul class={styles.accordion}>
33
+ <ul class={classes}>
21
34
  {#each items as item, index}
22
35
  <li>
23
36
  <button
24
- class={styles.title}
37
+ class={classNames([
38
+ styles.title,
39
+ item.reverse && styles.reverse
40
+ ])}
25
41
  data-open={state[index]}
26
42
  on:click={() => toggle(index)}
27
43
  >
28
44
  {item.title}
29
- {@html ArrowDown}
45
+ {#if icon !== 'none'}
46
+ {@html icon === 'plus' ? Plus : ArrowDown}
47
+ {/if}
30
48
  </button>
31
49
  <div class={styles.wrapper}>
32
50
  <div class={styles.content}>
@@ -1,11 +1,19 @@
1
1
  import React, { useState } from 'react'
2
2
  import type { AccordionProps } from './accordion'
3
3
 
4
+ import { classNames } from '../../utils/classNames'
5
+
4
6
  import ArrowDown from '../../icons/arrow-down.svg?raw'
7
+ import Plus from '../../icons/plus.svg?raw'
5
8
 
6
9
  import styles from './accordion.module.scss'
7
10
 
8
- const Accordion = ({ items }: AccordionProps) => {
11
+ const Accordion = ({
12
+ items,
13
+ icon,
14
+ reverse,
15
+ className
16
+ }: AccordionProps) => {
9
17
  const [state, setState] = useState(Array(items.length).fill(false))
10
18
 
11
19
  const toggle = (index: number) => {
@@ -15,20 +23,34 @@ const Accordion = ({ items }: AccordionProps) => {
15
23
  ))
16
24
  }
17
25
 
26
+ const classes = classNames([
27
+ styles.accordion,
28
+ reverse && styles.reverse,
29
+ icon === 'plus' && styles.plus,
30
+ className
31
+ ])
32
+
18
33
  return (
19
- <ul className={styles.accordion}>
34
+ <ul className={classes}>
20
35
  {items.map((item, index) => (
21
36
  <li key={index}>
22
37
  <button
23
- className={styles.title}
24
38
  data-open={state[index]}
25
39
  onClick={() => toggle(index)}
26
- dangerouslySetInnerHTML={{ __html: `${item.title} ${ArrowDown}` }}
40
+ className={classNames([
41
+ styles.title,
42
+ item.reverse && styles.reverse
43
+ ])}
44
+ dangerouslySetInnerHTML={{ __html: icon === 'none'
45
+ ? item.title
46
+ : `${item.title} ${icon === 'plus' ? Plus : ArrowDown}`
47
+ }}
27
48
  />
28
49
  <div className={styles.wrapper}>
29
- <div className={styles.content}>
30
- <div dangerouslySetInnerHTML={{ __html: item.content }} />
31
- </div>
50
+ <div
51
+ className={styles.content}
52
+ dangerouslySetInnerHTML={{ __html: item.content }}
53
+ />
32
54
  </div>
33
55
  </li>
34
56
  ))}
@@ -4,6 +4,14 @@
4
4
  @include spacing(0);
5
5
  list-style-type: none;
6
6
 
7
+ &.reverse .title {
8
+ @include layout(row-reverse, h-end);
9
+ }
10
+
11
+ &.plus .title[data-open="true"] svg {
12
+ transform: rotate(135deg);
13
+ }
14
+
7
15
  li {
8
16
  @include border(primary-50, bottom);
9
17
  @include spacing(py-sm, px-none, m0);
@@ -27,6 +35,10 @@
27
35
  background: transparent;
28
36
  cursor: pointer;
29
37
 
38
+ &.reverse {
39
+ @include layout(row-reverse);
40
+ }
41
+
30
42
  svg {
31
43
  @include transition(transform);
32
44
  @include size(15px);
@@ -2,5 +2,9 @@ export type AccordionProps = {
2
2
  items: {
3
3
  title: string
4
4
  content: string
5
+ reverse?: boolean
5
6
  }[]
7
+ icon?: 'plus' | 'none' | undefined | null
8
+ reverse?: boolean
9
+ className?: string
6
10
  }
@@ -0,0 +1,21 @@
1
+ ---
2
+ import type { AspectRatioProps } from './aspectratio'
3
+
4
+ import styles from './aspect-ratio.module.scss'
5
+
6
+ interface Props extends AspectRatioProps {}
7
+
8
+ const {
9
+ ratio,
10
+ className
11
+ } = Astro.props
12
+
13
+ const classes = [
14
+ styles.ratio,
15
+ className
16
+ ]
17
+ ---
18
+
19
+ <div class:list={classes} style={`aspect-ratio: ${ratio.replace(':', '/')};`}>
20
+ <slot />
21
+ </div>
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import type { AspectRatioProps } from './aspectratio'
3
+
4
+ import { classNames } from '../../utils/classNames'
5
+
6
+ import styles from './aspect-ratio.module.scss'
7
+
8
+ export let ratio: AspectRatioProps['ratio'] = ''
9
+ export let className: AspectRatioProps['className'] = ''
10
+
11
+ const classes = classNames([
12
+ styles.ratio,
13
+ className
14
+ ])
15
+ </script>
16
+
17
+ <div class={classes} style={`aspect-ratio: ${ratio.replace(':', '/')};`}>
18
+ <slot />
19
+ </div>
@@ -0,0 +1,28 @@
1
+ import React from 'react'
2
+ import type { ReactAspectRatioProps } from './aspectratio'
3
+
4
+ import { classNames } from '../../utils/classNames'
5
+
6
+ import styles from './aspect-ratio.module.scss'
7
+
8
+ const AspectRatio = ({
9
+ ratio,
10
+ children,
11
+ className
12
+ }: ReactAspectRatioProps) => {
13
+ const classes = classNames([
14
+ styles.ratio,
15
+ className
16
+ ])
17
+
18
+ return (
19
+ <div
20
+ className={classes}
21
+ style={{ aspectRatio: ratio.replace(':', '/') }}
22
+ >
23
+ {children}
24
+ </div>
25
+ )
26
+ }
27
+
28
+ export default AspectRatio
@@ -0,0 +1,10 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ div.ratio[style] {
4
+ @include layout(flex);
5
+ @include size('w100%');
6
+
7
+ * {
8
+ @include size(100%);
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ export type AspectRatioProps = {
2
+ ratio: string
3
+ className?: string
4
+ }
5
+
6
+ export type ReactAspectRatioProps = {
7
+ children: React.ReactNode
8
+ } & AspectRatioProps
@@ -0,0 +1,56 @@
1
+ ---
2
+ import type { BannerProps } from './banner'
3
+
4
+ import Button from '../Button/Button.astro'
5
+
6
+ import closeIcon from '../../icons/close.svg?raw'
7
+
8
+ import styles from './banner.module.scss'
9
+
10
+ interface Props extends BannerProps {}
11
+
12
+ const {
13
+ top,
14
+ bottom,
15
+ closeable,
16
+ padded,
17
+ sticky = true,
18
+ className
19
+ } = Astro.props
20
+
21
+ const classes = [
22
+ styles.banner,
23
+ bottom && styles.bottom,
24
+ closeable && styles.closeable,
25
+ padded && styles.padded,
26
+ !sticky && styles.relative,
27
+ className
28
+ ]
29
+
30
+ const style = top
31
+ ? `--w-banner-top: ${top}px;`
32
+ : null
33
+ ---
34
+
35
+ <div class:list={classes} style={style}>
36
+ <slot />
37
+ {closeable && (
38
+ <Button
39
+ theme="flat"
40
+ className={styles.close}
41
+ data-id="w-banner-close"
42
+ >
43
+ <Fragment set:html={closeIcon} />
44
+ </Button>
45
+ )}
46
+ </div>
47
+
48
+ <script>
49
+ import { on } from '../../utils/DOMUtils'
50
+
51
+ on('[data-id="w-banner-close"]', 'click', (event: Event) => {
52
+ const target = event.currentTarget as HTMLDivElement
53
+
54
+ target.parentElement?.remove()
55
+ }, true)
56
+ </script>
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import type { BannerProps } from './banner'
3
+
4
+ import Button from '../Button/Button.svelte'
5
+
6
+ import { classNames } from '../../utils/classNames'
7
+
8
+ import closeIcon from '../../icons/close.svg?raw'
9
+
10
+ import styles from './banner.module.scss'
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
20
+
21
+ const classes = classNames([
22
+ styles.banner,
23
+ bottom && styles.bottom,
24
+ padded && styles.padded,
25
+ !sticky && styles.relative,
26
+ className
27
+ ])
28
+
29
+ const style = top
30
+ ? `--w-banner-top: ${top}px;`
31
+ : null
32
+ </script>
33
+
34
+ {#if visible}
35
+ <div class={classes} style={style}>
36
+ <slot />
37
+ {#if closeable}
38
+ <Button
39
+ theme="flat"
40
+ className={styles.close}
41
+ onClick={() => visible = false}
42
+ >
43
+ {@html closeIcon}
44
+ </Button>
45
+ {/if}
46
+ </div>
47
+ {/if}