webcoreui 0.6.1 → 0.8.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 (85) hide show
  1. package/README.md +46 -7
  2. package/astro.d.ts +21 -0
  3. package/astro.js +14 -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/Breadcrumb/breadcrumb.module.scss +26 -26
  20. package/components/Button/button.module.scss +4 -0
  21. package/components/Carousel/carousel.module.scss +1 -1
  22. package/components/Collapsible/collapsible.module.scss +29 -29
  23. package/components/ConditionalWrapper/conditionalwrapper.ts +1 -0
  24. package/components/DataTable/datatable.module.scss +102 -102
  25. package/components/Footer/footer.module.scss +61 -61
  26. package/components/Group/group.module.scss +43 -43
  27. package/components/Icon/map.ts +2 -0
  28. package/components/Kbd/Kbd.astro +20 -0
  29. package/components/Kbd/Kbd.svelte +18 -0
  30. package/components/Kbd/Kbd.tsx +27 -0
  31. package/components/Kbd/kbd.module.scss +8 -0
  32. package/components/Kbd/kbd.ts +26 -0
  33. package/components/Kbd/keyMap.ts +21 -0
  34. package/components/List/list.module.scss +91 -91
  35. package/components/Masonry/masonry.module.scss +1 -1
  36. package/components/Modal/modal.module.scss +110 -110
  37. package/components/Pagination/pagination.module.scss +1 -1
  38. package/components/Popover/popover.module.scss +52 -52
  39. package/components/Ribbon/Ribbon.astro +28 -0
  40. package/components/Ribbon/Ribbon.svelte +26 -0
  41. package/components/Ribbon/Ribbon.tsx +33 -0
  42. package/components/Ribbon/ribbon.module.scss +84 -0
  43. package/components/Ribbon/ribbon.ts +16 -0
  44. package/components/Select/select.module.scss +25 -25
  45. package/components/Sheet/sheet.module.scss +68 -68
  46. package/components/Sidebar/sidebar.module.scss +43 -43
  47. package/components/Skeleton/Skeleton.astro +35 -0
  48. package/components/Skeleton/Skeleton.svelte +31 -0
  49. package/components/Skeleton/Skeleton.tsx +34 -0
  50. package/components/Skeleton/skeleton.module.scss +68 -0
  51. package/components/Skeleton/skeleton.ts +9 -0
  52. package/components/Slider/slider.module.scss +68 -68
  53. package/components/Spoiler/Spoiler.astro +50 -0
  54. package/components/Spoiler/Spoiler.svelte +45 -0
  55. package/components/Spoiler/Spoiler.tsx +50 -0
  56. package/components/Spoiler/spoiler.module.scss +40 -0
  57. package/components/Spoiler/spoiler.ts +11 -0
  58. package/components/Stepper/Stepper.astro +61 -0
  59. package/components/Stepper/Stepper.svelte +59 -0
  60. package/components/Stepper/Stepper.tsx +60 -0
  61. package/components/Stepper/stepper.module.scss +102 -0
  62. package/components/Stepper/stepper.ts +17 -0
  63. package/components/Table/Table.tsx +1 -1
  64. package/components/Textarea/textarea.module.scss +36 -36
  65. package/icons/close.svg +1 -1
  66. package/icons/plus.svg +3 -0
  67. package/icons.d.ts +1 -0
  68. package/icons.js +1 -0
  69. package/package.json +5 -5
  70. package/react.d.ts +21 -0
  71. package/react.js +14 -0
  72. package/scss/config/color-palette.scss +2 -0
  73. package/scss/config/css-values.scss +2 -0
  74. package/scss/config/layout.scss +2 -0
  75. package/scss/config/mixins.scss +7 -0
  76. package/scss/config/typography.scss +2 -0
  77. package/scss/config/variables.scss +2 -0
  78. package/scss/config.scss +7 -7
  79. package/scss/global/utility.scss +4 -0
  80. package/scss/global.scss +4 -4
  81. package/scss/index.scss +3 -3
  82. package/scss/resets.scss +10 -5
  83. package/scss/setup.scss +7 -1
  84. package/svelte.d.ts +21 -0
  85. package/svelte.js +14 -0
package/README.md CHANGED
@@ -52,18 +52,18 @@ Webcore can be used as a standalone project, or it can be integrated into your e
52
52
 
53
53
  Webcore components use Sass for styling. To use the component library, you must have the following packages installed:
54
54
 
55
- - [Sass](https://www.npmjs.com/package/sass) - `v1.77` and above
56
- - [TypeScript](https://www.npmjs.com/package/typescript) - `v5.4` and above
55
+ - [Sass](https://www.npmjs.com/package/sass) - `v1.80`
56
+ - [TypeScript](https://www.npmjs.com/package/typescript) - `v5.4`
57
57
 
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`
62
62
  - **For Svelte projects**
63
- - [Svelte](https://www.npmjs.com/package/svelte) - `v4.2` and above
63
+ - [Svelte](https://www.npmjs.com/package/svelte) - `v4.2`
64
64
  - **For React projects**
65
- - [React](https://www.npmjs.com/package/react) - `v18.3` and above
66
- - [React DOM](https://www.npmjs.com/package/react-dom) -`v18.3` and above
65
+ - [React](https://www.npmjs.com/package/react) - `v18.3`
66
+ - [React DOM](https://www.npmjs.com/package/react-dom) -`v18.3`
67
67
 
68
68
  ### Installation
69
69
 
@@ -82,7 +82,7 @@ yarn add webcoreui
82
82
  Create an empty [`webcore.config.scss`](https://webcoreui.dev/docs/css-configuration#webcoreconfigscss) file at the root of your project to setup CSS configurations. Setup default styles and fonts by calling the following in your global SCSS file:
83
83
 
84
84
  ```scss
85
- @import 'webcoreui/styles';
85
+ @use 'webcoreui/styles' as *;
86
86
  @include setup((
87
87
  // Define paths for your fonts
88
88
  fontRegular: '/fonts/Inter-Regular.woff2',
@@ -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
 
@@ -135,10 +138,18 @@ html body {
135
138
  --w-rating-empty-background: var(--w-color-primary-70);
136
139
  --w-rating-size: 18px;
137
140
 
141
+ // Ribbon component
142
+ --w-ribbon-offset: 20px;
143
+ --w-ribbon-folded-offset: 10px;
144
+
138
145
  // Scrollbars
139
146
  --w-scrollbar-bg: var(--w-color-primary-60);
140
147
  --w-scrollbar-fg: var(--w-color-primary-50);
141
148
 
149
+ // Skeleton component
150
+ --w-skeleton-color: var(--w-color-primary-60);
151
+ --w-skeleton-wave-color: var(--w-color-primary-50);
152
+
142
153
  // Slider component
143
154
  --w-slider-background: var(--w-color-primary-50);
144
155
  --w-slider-color: var(--w-color-primary);
@@ -151,6 +162,14 @@ html body {
151
162
  --w-spinner-size: 30px;
152
163
  --w-spinner-dash: 8;
153
164
 
165
+ // Spoiler component
166
+ --w-spoiler-color: var(--w-color-primary);
167
+
168
+ // Stepper component
169
+ --w-stepper-color-border: var(--w-color-primary-50);
170
+ --w-stepper-color-active: var(--w-color-info);
171
+ --w-stepper-color-complete: var(--w-color-success);
172
+
154
173
  // Switch component
155
174
  --w-switch-off-color: var(--w-color-primary-50);
156
175
  --w-switch-on-color: var(--w-color-primary);
@@ -199,8 +218,10 @@ import { Accordion } from 'webcoreui/react'
199
218
 
200
219
  - [Accordion](https://github.com/Frontendland/webcoreui/tree/main/src/components/Accordion)
201
220
  - [Alert](https://github.com/Frontendland/webcoreui/tree/main/src/components/Alert)
221
+ - [AspectRatio](https://github.com/Frontendland/webcoreui/tree/main/src/components/AspectRatio)
202
222
  - [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
203
223
  - [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
224
+ - [Banner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Banner)
204
225
  - [Breadcrumb](https://github.com/Frontendland/webcoreui/tree/main/src/components/Breadcrumb)
205
226
  - [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
206
227
  - [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
@@ -213,6 +234,7 @@ import { Accordion } from 'webcoreui/react'
213
234
  - [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
214
235
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
215
236
  - [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
237
+ - [Kbd](https://github.com/Frontendland/webcoreui/tree/main/src/components/Kbd)
216
238
  - [List](https://github.com/Frontendland/webcoreui/tree/main/src/components/List)
217
239
  - [Masonry](https://github.com/Frontendland/webcoreui/tree/main/src/components/Masonry)
218
240
  - [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
@@ -222,11 +244,15 @@ import { Accordion } from 'webcoreui/react'
222
244
  - [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
223
245
  - [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
224
246
  - [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
247
+ - [Ribbon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Ribbon)
225
248
  - [Select](https://github.com/Frontendland/webcoreui/tree/main/src/components/Select)
226
249
  - [Sheet](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sheet)
227
250
  - [Sidebar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sidebar)
251
+ - [Skeleton](https://github.com/Frontendland/webcoreui/tree/main/src/components/Skeleton)
228
252
  - [Slider](https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider)
229
253
  - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
254
+ - [Spoiler](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spoiler)
255
+ - [Stepper](https://github.com/Frontendland/webcoreui/tree/main/src/components/Stepper)
230
256
  - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
231
257
  - [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
232
258
  - [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
@@ -235,3 +261,16 @@ import { Accordion } from 'webcoreui/react'
235
261
  - [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
236
262
  - [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
237
263
  - [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
264
+
265
+ ## Blocks
266
+
267
+ - [BlogCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/BlogCard)
268
+ - [ErrorPage](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ErrorPage)
269
+ - [FAQ](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/FAQ)
270
+ - [Hero](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Hero)
271
+ - [IconList](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/IconList)
272
+ - [SettingCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SettingCard)
273
+ - [SignUp](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SignUp)
274
+ - [SocialProof](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SocialProof)
275
+ - [Tiles](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Tiles)
276
+ - [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'
@@ -23,11 +26,15 @@ import type { PopoverProps as WPopoverProps } from './components/Popover/popover
23
26
  import type { ProgressProps as WProgressProps } from './components/Progress/progress'
24
27
  import type { RadioProps as WRadioProps } from './components/Radio/radio'
25
28
  import type { RatingProps as WRatingProps } from './components/Rating/rating'
29
+ import type { RibbonProps as WRibbonProps } from './components/Ribbon/ribbon'
26
30
  import type { SelectProps as WSelectProps } from './components/Select/select'
27
31
  import type { SheetProps as WSheetProps } from './components/Sheet/sheet'
28
32
  import type { SidebarProps as WSidebarProps } from './components/Sidebar/sidebar'
33
+ import type { SkeletonProps as WSkeletonProps } from './components/Skeleton/skeleton'
29
34
  import type { SliderProps as WSliderProps } from './components/Slider/slider'
30
35
  import type { SpinnerProps as WSpinnerProps } from './components/Spinner/spinner'
36
+ import type { SpoilerProps as WSpoilerProps } from './components/Spoiler/spoiler'
37
+ import type { StepperProps as WStepperProps } from './components/Stepper/stepper'
31
38
  import type { SwitchProps as WSwitchProps } from './components/Switch/switch'
32
39
  import type { TableProps as WTableProps } from './components/Table/table'
33
40
  import type { TabsProps as WTabsProps } from './components/Tabs/tabs'
@@ -40,8 +47,10 @@ import type { ToastProps as WToastProps } from './components/Toast/toast'
40
47
  declare module 'webcoreui/astro' {
41
48
  export function Accordion(_props: WAccordionProps): any
42
49
  export function Alert(_props: WAlertProps): any
50
+ export function AspectRatio(_props: WAspectRatioProps): any
43
51
  export function Avatar(_props: WAvatarProps): any
44
52
  export function Badge(_props: WBadgeProps): any
53
+ export function Banner(_props: WBannerProps): any
45
54
  export function Breadcrumb(_props: WBreadcrumbProps): any
46
55
  export function Button(_props: WButtonProps): any
47
56
  export function Card(_props: WCardProps): any
@@ -54,6 +63,7 @@ declare module 'webcoreui/astro' {
54
63
  export function Group(_props: WGroupProps): any
55
64
  export function Icon(_props: WIconProps): any
56
65
  export function Input(_props: WInputProps): any
66
+ export function Kbd(_props: WKbdProps): any
57
67
  export function List(_props: WListProps): any
58
68
  export function Masonry(_props: WMasonryProps): any
59
69
  export function Menu(_props: WMenuProps): any
@@ -63,11 +73,15 @@ declare module 'webcoreui/astro' {
63
73
  export function Progress(_props: WProgressProps): any
64
74
  export function Radio(_props: WRadioProps): any
65
75
  export function Rating(_props: WRatingProps): any
76
+ export function Ribbon(_props: WRibbonProps): any
66
77
  export function Select(_props: WSelectProps): any
67
78
  export function Sheet(_props: WSheetProps): any
68
79
  export function Sidebar(_props: WSidebarProps): any
80
+ export function Skeleton(_props: WSkeletonProps): any
69
81
  export function Slider(_props: WSliderProps): any
70
82
  export function Spinner(_props: WSpinnerProps): any
83
+ export function Spoiler(_props: WSpoilerProps): any
84
+ export function Stepper(_props: WStepperProps): any
71
85
  export function Switch(_props: WSwitchProps): any
72
86
  export function Table(_props: WTableProps): any
73
87
  export function Tabs(_props: WTabsProps): any
@@ -79,8 +93,10 @@ declare module 'webcoreui/astro' {
79
93
 
80
94
  export type AccordionProps = WAccordionProps
81
95
  export type AlertProps = WAlertProps
96
+ export type AspectRatioProps = WAspectRatioProps
82
97
  export type AvatarProps = WAvatarProps
83
98
  export type BadgeProps = WBadgeProps
99
+ export type BannerProps = WBannerProps
84
100
  export type BreadcrumbProps = WBreadcrumbProps
85
101
  export type ButtonProps = WButtonProps
86
102
  export type CardProps = WCardProps
@@ -93,6 +109,7 @@ declare module 'webcoreui/astro' {
93
109
  export type GroupProps = WGroupProps
94
110
  export type IconProps = WIconProps
95
111
  export type InputProps = WInputProps
112
+ export type KbdProps = WKbdProps
96
113
  export type ListProps = WListProps
97
114
  export type MasonryProps = WMasonryProps
98
115
  export type MenuProps = WMenuProps
@@ -102,11 +119,15 @@ declare module 'webcoreui/astro' {
102
119
  export type ProgressProps = WProgressProps
103
120
  export type RadioProps = WRadioProps
104
121
  export type RatingProps = WRatingProps
122
+ export type RibbonProps = WRibbonProps
105
123
  export type SelectProps = WSelectProps
106
124
  export type SheetProps = WSheetProps
107
125
  export type SidebarProps = WSidebarProps
126
+ export type SkeletonProps = WSkeletonProps
108
127
  export type SliderProps = WSliderProps
109
128
  export type SpinnerProps = WSpinnerProps
129
+ export type SpoilerProps = WSpoilerProps
130
+ export type StepperProps = WStepperProps
110
131
  export type SwitchProps = WSwitchProps
111
132
  export type TableProps = WTableProps
112
133
  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'
@@ -23,11 +26,15 @@ import PopoverComponent from './components/Popover/Popover.astro'
23
26
  import ProgressComponent from './components/Progress/Progress.astro'
24
27
  import RadioComponent from './components/Radio/Radio.astro'
25
28
  import RatingComponent from './components/Rating/Rating.astro'
29
+ import RibbonComponent from './components/Ribbon/Ribbon.astro'
26
30
  import SelectComponent from './components/Select/Select.astro'
27
31
  import SheetComponent from './components/Sheet/Sheet.astro'
28
32
  import SidebarComponent from './components/Sidebar/Sidebar.astro'
33
+ import SkeletonComponent from './components/Skeleton/Skeleton.astro'
29
34
  import SliderComponent from './components/Slider/Slider.astro'
30
35
  import SpinnerComponent from './components/Spinner/Spinner.astro'
36
+ import SpoilerComponent from './components/Spoiler/Spoiler.astro'
37
+ import StepperComponent from './components/Stepper/Stepper.astro'
31
38
  import SwitchComponent from './components/Switch/Switch.astro'
32
39
  import TableComponent from './components/Table/Table.astro'
33
40
  import TabsComponent from './components/Tabs/Tabs.astro'
@@ -39,8 +46,10 @@ import ToastComponent from './components/Toast/Toast.astro'
39
46
 
40
47
  export const Accordion = AccordionComponent
41
48
  export const Alert = AlertComponent
49
+ export const AspectRatio = AspectRatioComponent
42
50
  export const Avatar = AvatarComponent
43
51
  export const Badge = BadgeComponent
52
+ export const Banner = BannerComponent
44
53
  export const Breadcrumb = BreadcrumbComponent
45
54
  export const Button = ButtonComponent
46
55
  export const Card = CardComponent
@@ -53,6 +62,7 @@ export const Footer = FooterComponent
53
62
  export const Group = GroupComponent
54
63
  export const Icon = IconComponent
55
64
  export const Input = InputComponent
65
+ export const Kbd = KbdComponent
56
66
  export const List = ListComponent
57
67
  export const Masonry = MasonryComponent
58
68
  export const Menu = MenuComponent
@@ -62,11 +72,15 @@ export const Popover = PopoverComponent
62
72
  export const Progress = ProgressComponent
63
73
  export const Radio = RadioComponent
64
74
  export const Rating = RatingComponent
75
+ export const Ribbon = RibbonComponent
65
76
  export const Select = SelectComponent
66
77
  export const Sheet = SheetComponent
67
78
  export const Sidebar = SidebarComponent
79
+ export const Skeleton = SkeletonComponent
68
80
  export const Slider = SliderComponent
69
81
  export const Spinner = SpinnerComponent
82
+ export const Spoiler = SpoilerComponent
83
+ export const Stepper = StepperComponent
70
84
  export const Switch = SwitchComponent
71
85
  export const Table = TableComponent
72
86
  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
+ @use '../../scss/config.scss' as *;
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