webcoreui 1.4.0 → 1.5.0-beta.1
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.
- package/README.md +15 -1
- package/astro.d.ts +62 -56
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -1
- package/components/Accordion/Accordion.svelte +60 -58
- package/components/Accordion/Accordion.tsx +3 -1
- package/components/Alert/Alert.astro +2 -1
- package/components/Alert/Alert.svelte +12 -5
- package/components/Alert/Alert.tsx +10 -3
- package/components/Alert/alert.ts +2 -18
- package/components/AspectRatio/AspectRatio.astro +1 -1
- package/components/AspectRatio/AspectRatio.svelte +27 -22
- package/components/AspectRatio/AspectRatio.tsx +6 -3
- package/components/AspectRatio/aspectratio.ts +0 -10
- package/components/Avatar/Avatar.astro +1 -1
- package/components/Avatar/Avatar.svelte +7 -5
- package/components/Avatar/Avatar.tsx +3 -2
- package/components/Avatar/avatar.module.scss +3 -5
- package/components/Badge/Badge.astro +2 -1
- package/components/Badge/Badge.svelte +11 -4
- package/components/Badge/Badge.tsx +8 -3
- package/components/Badge/badge.module.scss +5 -6
- package/components/Badge/badge.ts +11 -13
- package/components/Banner/Banner.astro +1 -1
- package/components/Banner/Banner.svelte +11 -5
- package/components/Banner/Banner.tsx +6 -2
- package/components/Banner/banner.module.scss +4 -6
- package/components/Banner/banner.ts +0 -10
- package/components/BottomNavigation/BottomNavigation.astro +1 -1
- package/components/BottomNavigation/BottomNavigation.svelte +7 -4
- package/components/BottomNavigation/BottomNavigation.tsx +3 -2
- package/components/BottomNavigation/bottomnavigation.module.scss +68 -70
- package/components/Breadcrumb/Breadcrumb.astro +1 -1
- package/components/Breadcrumb/Breadcrumb.svelte +5 -3
- package/components/Breadcrumb/Breadcrumb.tsx +3 -1
- package/components/Button/Button.astro +2 -1
- package/components/Button/Button.svelte +11 -4
- package/components/Button/Button.tsx +7 -2
- package/components/Button/button.module.scss +9 -12
- package/components/Button/button.ts +23 -20
- package/components/Card/Card.astro +9 -2
- package/components/Card/Card.svelte +21 -8
- package/components/Card/Card.tsx +23 -6
- package/components/Card/card.module.scss +12 -9
- package/components/Card/card.ts +3 -16
- package/components/Carousel/Carousel.astro +3 -3
- package/components/Carousel/Carousel.svelte +24 -19
- package/components/Carousel/Carousel.tsx +9 -4
- package/components/Carousel/carousel.module.scss +3 -5
- package/components/Carousel/carousel.ts +0 -12
- package/components/CarouselItem/CarouselItem.astro +14 -0
- package/components/CarouselItem/CarouselItem.svelte +18 -0
- package/components/CarouselItem/CarouselItem.tsx +18 -0
- package/components/CarouselItem/carouselItem.ts +4 -0
- package/components/Checkbox/Checkbox.astro +3 -6
- package/components/Checkbox/Checkbox.svelte +13 -10
- package/components/Checkbox/Checkbox.tsx +8 -5
- package/components/Checkbox/checkbox.module.scss +4 -6
- package/components/Checkbox/checkbox.ts +2 -17
- package/components/Collapsible/Collapsible.astro +1 -1
- package/components/Collapsible/Collapsible.svelte +13 -6
- package/components/Collapsible/Collapsible.tsx +8 -2
- package/components/Collapsible/collapsible.module.scss +5 -5
- package/components/Collapsible/collapsible.ts +0 -15
- package/components/ConditionalWrapper/ConditionalWrapper.astro +1 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +8 -2
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +7 -2
- package/components/ConditionalWrapper/conditionalwrapper.ts +2 -14
- package/components/ContextMenu/ContextMenu.astro +2 -1
- package/components/ContextMenu/ContextMenu.svelte +17 -9
- package/components/ContextMenu/ContextMenu.tsx +8 -2
- package/components/ContextMenu/contextmenu.ts +2 -17
- package/components/Copy/Copy.astro +2 -2
- package/components/Copy/Copy.svelte +10 -5
- package/components/Copy/Copy.tsx +7 -3
- package/components/Copy/copy.ts +2 -12
- package/components/Counter/Counter.astro +3 -2
- package/components/Counter/Counter.svelte +16 -10
- package/components/Counter/Counter.tsx +11 -7
- package/components/Counter/counter.module.scss +3 -5
- package/components/Counter/counter.ts +2 -11
- package/components/DataTable/DataTable.astro +1 -1
- package/components/DataTable/DataTable.svelte +23 -15
- package/components/DataTable/DataTable.tsx +7 -2
- package/components/DataTable/datatable.ts +0 -12
- package/components/Flex/Flex.astro +2 -1
- package/components/Flex/Flex.svelte +12 -6
- package/components/Flex/Flex.tsx +8 -3
- package/components/Flex/flex.ts +2 -15
- package/components/Footer/Footer.astro +1 -1
- package/components/Footer/Footer.svelte +13 -8
- package/components/Footer/Footer.tsx +6 -2
- package/components/Footer/footer.ts +0 -10
- package/components/Grid/Grid.astro +2 -1
- package/components/Grid/Grid.svelte +12 -6
- package/components/Grid/Grid.tsx +8 -3
- package/components/Grid/grid.ts +2 -15
- package/components/Group/Group.astro +1 -1
- package/components/Group/Group.svelte +9 -4
- package/components/Group/Group.tsx +6 -2
- package/components/Group/group.ts +0 -10
- package/components/Icon/Icon.astro +1 -1
- package/components/Icon/Icon.svelte +16 -9
- package/components/Icon/Icon.tsx +3 -2
- package/components/Image/Image.astro +2 -1
- package/components/Image/Image.svelte +54 -51
- package/components/Image/Image.tsx +3 -1
- package/components/Image/image.ts +2 -3
- package/components/ImageLoader/ImageLoader.astro +1 -1
- package/components/ImageLoader/ImageLoader.svelte +5 -3
- package/components/ImageLoader/ImageLoader.tsx +3 -1
- package/components/Input/Input.astro +3 -2
- package/components/Input/Input.svelte +19 -9
- package/components/Input/Input.tsx +11 -3
- package/components/Input/input.ts +26 -53
- package/components/Kbd/Kbd.astro +1 -1
- package/components/Kbd/Kbd.svelte +9 -4
- package/components/Kbd/Kbd.tsx +6 -2
- package/components/Kbd/kbd.ts +0 -10
- package/components/List/List.astro +1 -1
- package/components/List/List.svelte +13 -9
- package/components/List/List.tsx +10 -6
- package/components/List/list.ts +0 -8
- package/components/Masonry/Masonry.astro +1 -1
- package/components/Masonry/Masonry.svelte +14 -9
- package/components/Masonry/Masonry.tsx +7 -3
- package/components/Masonry/masonry.module.scss +4 -6
- package/components/Masonry/masonry.ts +2 -13
- package/components/Menu/Menu.astro +1 -1
- package/components/Menu/Menu.svelte +13 -7
- package/components/Menu/Menu.tsx +6 -2
- package/components/Menu/menu.ts +0 -10
- package/components/Modal/Modal.astro +2 -3
- package/components/Modal/Modal.svelte +12 -8
- package/components/Modal/Modal.tsx +6 -4
- package/components/Modal/modal.module.scss +5 -5
- package/components/Modal/modal.ts +2 -14
- package/components/OTPInput/OTPInput.astro +3 -5
- package/components/OTPInput/OTPInput.svelte +10 -10
- package/components/OTPInput/OTPInput.tsx +10 -8
- package/components/OTPInput/otpinput.module.scss +0 -12
- package/components/OTPInput/otpinput.ts +2 -4
- package/components/Pagination/Pagination.astro +1 -1
- package/components/Pagination/Pagination.svelte +8 -4
- package/components/Pagination/Pagination.tsx +6 -2
- package/components/Pagination/pagination.ts +0 -8
- package/components/Popover/Popover.astro +3 -7
- package/components/Popover/Popover.svelte +11 -10
- package/components/Popover/Popover.tsx +9 -12
- package/components/Popover/popover.ts +2 -15
- package/components/Progress/Progress.astro +1 -1
- package/components/Progress/Progress.svelte +8 -6
- package/components/Progress/Progress.tsx +3 -1
- package/components/Progress/progress.module.scss +15 -17
- package/components/Radio/Radio.astro +4 -4
- package/components/Radio/Radio.svelte +15 -8
- package/components/Radio/Radio.tsx +8 -5
- package/components/Radio/radio.module.scss +4 -6
- package/components/Radio/radio.ts +3 -14
- package/components/RangeSlider/RangeSlider.astro +5 -2
- package/components/RangeSlider/RangeSlider.svelte +20 -35
- package/components/RangeSlider/RangeSlider.tsx +11 -4
- package/components/RangeSlider/rangeslider.module.scss +14 -16
- package/components/RangeSlider/rangeslider.ts +1 -9
- package/components/Rating/Rating.astro +1 -1
- package/components/Rating/Rating.svelte +10 -7
- package/components/Rating/Rating.tsx +3 -1
- package/components/Rating/rating.module.scss +13 -15
- package/components/Ribbon/Ribbon.astro +1 -1
- package/components/Ribbon/Ribbon.svelte +9 -4
- package/components/Ribbon/Ribbon.tsx +6 -2
- package/components/Ribbon/ribbon.module.scss +9 -11
- package/components/Ribbon/ribbon.ts +0 -10
- package/components/Select/Select.astro +3 -1
- package/components/Select/Select.svelte +179 -171
- package/components/Select/Select.tsx +11 -4
- package/components/Select/select.ts +2 -12
- package/components/Sheet/Sheet.astro +2 -1
- package/components/Sheet/Sheet.svelte +7 -5
- package/components/Sheet/Sheet.tsx +5 -4
- package/components/Sheet/sheet.ts +3 -10
- package/components/Sidebar/Sidebar.astro +1 -1
- package/components/Sidebar/Sidebar.svelte +9 -4
- package/components/Sidebar/Sidebar.tsx +6 -2
- package/components/Sidebar/sidebar.ts +0 -10
- package/components/Skeleton/Skeleton.astro +1 -1
- package/components/Skeleton/Skeleton.svelte +7 -5
- package/components/Skeleton/Skeleton.tsx +3 -1
- package/components/Skeleton/skeleton.module.scss +6 -9
- package/components/Slider/Slider.astro +7 -5
- package/components/Slider/Slider.svelte +18 -10
- package/components/Slider/Slider.tsx +12 -6
- package/components/Slider/slider.module.scss +12 -14
- package/components/Slider/slider.ts +3 -12
- package/components/SpeedDial/SpeedDial.astro +1 -1
- package/components/SpeedDial/SpeedDial.svelte +6 -4
- package/components/SpeedDial/SpeedDial.tsx +4 -2
- package/components/SpeedDial/speeddial.module.scss +4 -6
- package/components/Spinner/Spinner.astro +1 -1
- package/components/Spinner/Spinner.svelte +7 -5
- package/components/Spinner/Spinner.tsx +3 -1
- package/components/Spinner/spinner.module.scss +13 -14
- package/components/Spoiler/Spoiler.astro +1 -1
- package/components/Spoiler/Spoiler.svelte +11 -5
- package/components/Spoiler/Spoiler.tsx +6 -2
- package/components/Spoiler/spoiler.module.scss +3 -5
- package/components/Spoiler/spoiler.ts +0 -10
- package/components/Stepper/Stepper.astro +1 -1
- package/components/Stepper/Stepper.svelte +7 -5
- package/components/Stepper/Stepper.tsx +3 -1
- package/components/Stepper/stepper.defaults.scss +5 -0
- package/components/Stepper/stepper.module.scss +11 -13
- package/components/Switch/Switch.astro +7 -2
- package/components/Switch/Switch.svelte +17 -8
- package/components/Switch/Switch.tsx +8 -4
- package/components/Switch/switch.module.scss +5 -7
- package/components/Switch/switch.ts +2 -16
- package/components/Tab/Tab.astro +25 -0
- package/components/Tab/Tab.svelte +28 -0
- package/components/Tab/Tab.tsx +30 -0
- package/components/Tab/tab.ts +6 -0
- package/components/Table/Table.astro +1 -1
- package/components/Table/Table.svelte +5 -3
- package/components/Table/Table.tsx +3 -1
- package/components/Tabs/Tabs.astro +58 -25
- package/components/Tabs/Tabs.svelte +47 -14
- package/components/Tabs/Tabs.tsx +42 -11
- package/components/Tabs/tabs.module.scss +7 -6
- package/components/Tabs/tabs.ts +0 -10
- package/components/Textarea/Textarea.astro +3 -6
- package/components/Textarea/Textarea.svelte +13 -10
- package/components/Textarea/Textarea.tsx +9 -7
- package/components/Textarea/textarea.ts +2 -17
- package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -1
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -8
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +7 -2
- package/components/ThemeSwitcher/themeswitcher.module.scss +10 -12
- package/components/ThemeSwitcher/themeswitcher.ts +0 -13
- package/components/Timeline/Timeline.astro +1 -1
- package/components/Timeline/Timeline.svelte +11 -6
- package/components/Timeline/Timeline.tsx +6 -2
- package/components/Timeline/timeline.module.scss +6 -8
- package/components/Timeline/timeline.ts +0 -10
- package/components/TimelineItem/TimelineItem.astro +1 -1
- package/components/TimelineItem/TimelineItem.svelte +9 -4
- package/components/TimelineItem/TimelineItem.tsx +8 -3
- package/components/TimelineItem/timelineitem.module.scss +4 -4
- package/components/TimelineItem/timelineitem.ts +0 -12
- package/components/Toast/Toast.astro +2 -1
- package/components/Toast/Toast.svelte +9 -7
- package/components/Toast/Toast.tsx +5 -4
- package/components/Toast/toast.ts +3 -11
- package/package.json +19 -19
- package/react.d.ts +145 -138
- package/react.js +4 -0
- package/scss/config/functions.scss +41 -0
- package/scss/config/mixins.scss +65 -0
- package/scss/config.scss +1 -0
- package/scss/global/theme.scss +209 -194
- package/scss/setup.scss +6 -3
- package/svelte.d.ts +145 -138
- package/svelte.js +4 -0
package/README.md
CHANGED
|
@@ -123,6 +123,9 @@ export default defineConfig({
|
|
|
123
123
|
})
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
> [!TIP]
|
|
127
|
+
> We also recommend adding [`astro-purgecss`](https://www.npmjs.com/package/astro-purgecss) to improve your CSS bundle size.
|
|
128
|
+
|
|
126
129
|
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:
|
|
127
130
|
|
|
128
131
|
```scss
|
|
@@ -146,7 +149,9 @@ The `setup` mixin can also accept the following options:
|
|
|
146
149
|
| `includeUtilities` | `true` | Adds utility classes for CSS. Read more about the available utility classes [here](https://webcoreui.dev/docs/layout). |
|
|
147
150
|
| `includeTooltip` | `true` | Adds styles for using tooltips.
|
|
148
151
|
| `includeScrollbarStyles` | `true` | Adds styles for scrollbars.
|
|
149
|
-
| `includeBreakpoints` | `true` | Exposes breakpoint variables in CSS for JS. Used by components for responsiveness.
|
|
152
|
+
| `includeBreakpoints` | `true` | Exposes breakpoint variables in CSS for JS. Used by components for responsiveness. |
|
|
153
|
+
| `theme` | `dark` | Sets the default theme. Read more about available themes [here](https://webcoreui.dev/docs/themes). |
|
|
154
|
+
| `themes` | `()` | Pass a map to enable multiple themes. Values can be arbitrary CSS selectors that actives the theme. |
|
|
150
155
|
|
|
151
156
|
Default component styles can be changed by overriding the following CSS variables:
|
|
152
157
|
|
|
@@ -253,6 +258,15 @@ html body {
|
|
|
253
258
|
}
|
|
254
259
|
```
|
|
255
260
|
|
|
261
|
+
Depending on your installed blocks, you can also use the following variables to override default block styles:
|
|
262
|
+
|
|
263
|
+
```scss
|
|
264
|
+
html body {
|
|
265
|
+
// Error page
|
|
266
|
+
--w-error-page-type-color: var(--w-color-info);
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
256
270
|
### Using Components
|
|
257
271
|
|
|
258
272
|
Start using Webcore components in your code by importing them:
|
package/astro.d.ts
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type {
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
29
|
-
import type {
|
|
30
|
-
import type {
|
|
31
|
-
import type {
|
|
32
|
-
import type {
|
|
33
|
-
import type {
|
|
34
|
-
import type {
|
|
35
|
-
import type {
|
|
36
|
-
import type {
|
|
37
|
-
import type {
|
|
38
|
-
import type {
|
|
39
|
-
import type {
|
|
40
|
-
import type {
|
|
41
|
-
import type {
|
|
42
|
-
import type {
|
|
43
|
-
import type {
|
|
44
|
-
import type {
|
|
45
|
-
import type {
|
|
46
|
-
import type {
|
|
47
|
-
import type {
|
|
48
|
-
import type {
|
|
49
|
-
import type {
|
|
50
|
-
import type {
|
|
51
|
-
import type {
|
|
52
|
-
import type {
|
|
53
|
-
import type {
|
|
54
|
-
import type {
|
|
55
|
-
import type {
|
|
56
|
-
import type {
|
|
1
|
+
import type { Props as WAccordionProps } from './components/Accordion/Accordion.astro'
|
|
2
|
+
import type { Props as WAlertProps } from './components/Alert/Alert.astro'
|
|
3
|
+
import type { Props as WAspectRatioProps } from './components/AspectRatio/AspectRatio.astro'
|
|
4
|
+
import type { Props as WAvatarProps } from './components/Avatar/Avatar.astro'
|
|
5
|
+
import type { Props as WBadgeProps } from './components/Badge/Badge.astro'
|
|
6
|
+
import type { Props as WBannerProps } from './components/Banner/Banner.astro'
|
|
7
|
+
import type { Props as WBottomNavigationProps } from './components/BottomNavigation/BottomNavigation.astro'
|
|
8
|
+
import type { Props as WBreadcrumbProps } from './components/Breadcrumb/Breadcrumb.astro'
|
|
9
|
+
import type { Props as WButtonProps } from './components/Button/Button.astro'
|
|
10
|
+
import type { Props as WCardProps } from './components/Card/Card.astro'
|
|
11
|
+
import type { Props as WCarouselProps } from './components/Carousel/Carousel.astro'
|
|
12
|
+
import type { Props as WCarouselItemProps } from './components/CarouselItem/CarouselItem.astro'
|
|
13
|
+
import type { Props as WCheckboxProps } from './components/Checkbox/Checkbox.astro'
|
|
14
|
+
import type { Props as WCollapsibleProps } from './components/Collapsible/Collapsible.astro'
|
|
15
|
+
import type { Props as WConditionalWrapperProps } from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
16
|
+
import type { Props as WContextMenuProps } from './components/ContextMenu/ContextMenu.astro'
|
|
17
|
+
import type { Props as WCopyProps } from './components/Copy/Copy.astro'
|
|
18
|
+
import type { Props as WCounterProps } from './components/Counter/Counter.astro'
|
|
19
|
+
import type { Props as WDataTableProps } from './components/DataTable/DataTable.astro'
|
|
20
|
+
import type { Props as WFlexProps } from './components/Flex/Flex.astro'
|
|
21
|
+
import type { Props as WFooterProps } from './components/Footer/Footer.astro'
|
|
22
|
+
import type { Props as WGridProps } from './components/Grid/Grid.astro'
|
|
23
|
+
import type { Props as WGroupProps } from './components/Group/Group.astro'
|
|
24
|
+
import type { Props as WIconProps } from './components/Icon/Icon.astro'
|
|
25
|
+
import type { Props as WImageProps } from './components/Image/Image.astro'
|
|
26
|
+
import type { Props as WImageLoaderProps } from './components/ImageLoader/ImageLoader.astro'
|
|
27
|
+
import type { Props as WInputProps } from './components/Input/Input.astro'
|
|
28
|
+
import type { Props as WKbdProps } from './components/Kbd/Kbd.astro'
|
|
29
|
+
import type { Props as WListProps } from './components/List/List.astro'
|
|
30
|
+
import type { Props as WMasonryProps } from './components/Masonry/Masonry.astro'
|
|
31
|
+
import type { Props as WMenuProps } from './components/Menu/Menu.astro'
|
|
32
|
+
import type { Props as WModalProps } from './components/Modal/Modal.astro'
|
|
33
|
+
import type { Props as WOTPInputProps } from './components/OTPInput/OTPInput.astro'
|
|
34
|
+
import type { Props as WPaginationProps } from './components/Pagination/Pagination.astro'
|
|
35
|
+
import type { Props as WPopoverProps } from './components/Popover/Popover.astro'
|
|
36
|
+
import type { Props as WProgressProps } from './components/Progress/Progress.astro'
|
|
37
|
+
import type { Props as WRadioProps } from './components/Radio/Radio.astro'
|
|
38
|
+
import type { Props as WRangeSliderProps } from './components/RangeSlider/RangeSlider.astro'
|
|
39
|
+
import type { Props as WRatingProps } from './components/Rating/Rating.astro'
|
|
40
|
+
import type { Props as WRibbonProps } from './components/Ribbon/Ribbon.astro'
|
|
41
|
+
import type { Props as WSelectProps } from './components/Select/Select.astro'
|
|
42
|
+
import type { Props as WSheetProps } from './components/Sheet/Sheet.astro'
|
|
43
|
+
import type { Props as WSidebarProps } from './components/Sidebar/Sidebar.astro'
|
|
44
|
+
import type { Props as WSkeletonProps } from './components/Skeleton/Skeleton.astro'
|
|
45
|
+
import type { Props as WSliderProps } from './components/Slider/Slider.astro'
|
|
46
|
+
import type { Props as WSpeedDialProps } from './components/SpeedDial/SpeedDial.astro'
|
|
47
|
+
import type { Props as WSpinnerProps } from './components/Spinner/Spinner.astro'
|
|
48
|
+
import type { Props as WSpoilerProps } from './components/Spoiler/Spoiler.astro'
|
|
49
|
+
import type { Props as WStepperProps } from './components/Stepper/Stepper.astro'
|
|
50
|
+
import type { Props as WSwitchProps } from './components/Switch/Switch.astro'
|
|
51
|
+
import type { Props as WTabProps } from './components/Tab/Tab.astro'
|
|
52
|
+
import type { Props as WTableProps } from './components/Table/Table.astro'
|
|
53
|
+
import type { Props as WTabsProps } from './components/Tabs/Tabs.astro'
|
|
54
|
+
import type { Props as WTextareaProps } from './components/Textarea/Textarea.astro'
|
|
55
|
+
import type { Props as WThemeSwitcherProps } from './components/ThemeSwitcher/ThemeSwitcher.astro'
|
|
56
|
+
import type { Props as WTimelineProps } from './components/Timeline/Timeline.astro'
|
|
57
|
+
import type { Props as WTimelineItemProps } from './components/TimelineItem/TimelineItem.astro'
|
|
58
|
+
import type { Props as WToastProps } from './components/Toast/Toast.astro'
|
|
57
59
|
|
|
58
60
|
import type { DataTableEventType as WDataTableEventType, HeadingObject as WHeadingObject } from './components/DataTable/datatable.ts'
|
|
59
61
|
import type { ListEventType as WListEventType } from './components/List/list.ts'
|
|
@@ -73,6 +75,7 @@ declare module 'webcoreui/astro' {
|
|
|
73
75
|
export function Button(_props: WButtonProps): any
|
|
74
76
|
export function Card(_props: WCardProps): any
|
|
75
77
|
export function Carousel(_props: WCarouselProps): any
|
|
78
|
+
export function CarouselItem(_props: WCarouselItemProps): any
|
|
76
79
|
export function Checkbox(_props: WCheckboxProps): any
|
|
77
80
|
export function Collapsible(_props: WCollapsibleProps): any
|
|
78
81
|
export function ConditionalWrapper(_props: WConditionalWrapperProps): any
|
|
@@ -111,6 +114,7 @@ declare module 'webcoreui/astro' {
|
|
|
111
114
|
export function Spoiler(_props: WSpoilerProps): any
|
|
112
115
|
export function Stepper(_props: WStepperProps): any
|
|
113
116
|
export function Switch(_props: WSwitchProps): any
|
|
117
|
+
export function Tab(_props: WTabProps): any
|
|
114
118
|
export function Table(_props: WTableProps): any
|
|
115
119
|
export function Tabs(_props: WTabsProps): any
|
|
116
120
|
export function Textarea(_props: WTextareaProps): any
|
|
@@ -130,6 +134,7 @@ declare module 'webcoreui/astro' {
|
|
|
130
134
|
export type ButtonProps = WButtonProps
|
|
131
135
|
export type CardProps = WCardProps
|
|
132
136
|
export type CarouselProps = WCarouselProps
|
|
137
|
+
export type CarouselItemProps = WCarouselItemProps
|
|
133
138
|
export type CheckboxProps = WCheckboxProps
|
|
134
139
|
export type CollapsibleProps = WCollapsibleProps
|
|
135
140
|
export type ConditionalWrapperProps = WConditionalWrapperProps
|
|
@@ -168,6 +173,7 @@ declare module 'webcoreui/astro' {
|
|
|
168
173
|
export type SpoilerProps = WSpoilerProps
|
|
169
174
|
export type StepperProps = WStepperProps
|
|
170
175
|
export type SwitchProps = WSwitchProps
|
|
176
|
+
export type TabProps = WTabProps
|
|
171
177
|
export type TableProps = WTableProps
|
|
172
178
|
export type TabsProps = WTabsProps
|
|
173
179
|
export type TextareaProps = WTextareaProps
|
package/astro.js
CHANGED
|
@@ -9,6 +9,7 @@ import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.astro'
|
|
|
9
9
|
import ButtonComponent from './components/Button/Button.astro'
|
|
10
10
|
import CardComponent from './components/Card/Card.astro'
|
|
11
11
|
import CarouselComponent from './components/Carousel/Carousel.astro'
|
|
12
|
+
import CarouselItemComponent from './components/CarouselItem/CarouselItem.astro'
|
|
12
13
|
import CheckboxComponent from './components/Checkbox/Checkbox.astro'
|
|
13
14
|
import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
|
|
14
15
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
@@ -47,6 +48,7 @@ import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
|
47
48
|
import SpoilerComponent from './components/Spoiler/Spoiler.astro'
|
|
48
49
|
import StepperComponent from './components/Stepper/Stepper.astro'
|
|
49
50
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
51
|
+
import TabComponent from './components/Tab/Tab.astro'
|
|
50
52
|
import TableComponent from './components/Table/Table.astro'
|
|
51
53
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
52
54
|
import TextareaComponent from './components/Textarea/Textarea.astro'
|
|
@@ -66,6 +68,7 @@ export const Breadcrumb = BreadcrumbComponent
|
|
|
66
68
|
export const Button = ButtonComponent
|
|
67
69
|
export const Card = CardComponent
|
|
68
70
|
export const Carousel = CarouselComponent
|
|
71
|
+
export const CarouselItem = CarouselItemComponent
|
|
69
72
|
export const Checkbox = CheckboxComponent
|
|
70
73
|
export const Collapsible = CollapsibleComponent
|
|
71
74
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
@@ -104,6 +107,7 @@ export const Spinner = SpinnerComponent
|
|
|
104
107
|
export const Spoiler = SpoilerComponent
|
|
105
108
|
export const Stepper = StepperComponent
|
|
106
109
|
export const Switch = SwitchComponent
|
|
110
|
+
export const Tab = TabComponent
|
|
107
111
|
export const Table = TableComponent
|
|
108
112
|
export const Tabs = TabsComponent
|
|
109
113
|
export const Textarea = TextareaComponent
|
|
@@ -1,58 +1,60 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { AccordionProps } from './accordion'
|
|
3
|
-
|
|
4
|
-
import { classNames } from '../../utils/classNames'
|
|
5
|
-
|
|
6
|
-
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
7
|
-
import Plus from '../../icons/plus.svg?raw'
|
|
8
|
-
|
|
9
|
-
import styles from './accordion.module.scss'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AccordionProps } from './accordion'
|
|
3
|
+
|
|
4
|
+
import { classNames } from '../../utils/classNames'
|
|
5
|
+
|
|
6
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
7
|
+
import Plus from '../../icons/plus.svg?raw'
|
|
8
|
+
|
|
9
|
+
import styles from './accordion.module.scss'
|
|
10
|
+
|
|
11
|
+
export type Props = AccordionProps
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
items,
|
|
15
|
+
icon,
|
|
16
|
+
reverse,
|
|
17
|
+
className
|
|
18
|
+
}: Props = $props()
|
|
19
|
+
|
|
20
|
+
let toggleState = $derived(items.map(item => item.expanded ?? false))
|
|
21
|
+
|
|
22
|
+
const toggle = (index: number) => {
|
|
23
|
+
toggleState = toggleState.map((_, i) => index === i
|
|
24
|
+
? !toggleState[i]
|
|
25
|
+
: toggleState[i]
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const classes = $derived(classNames([
|
|
30
|
+
styles.accordion,
|
|
31
|
+
reverse && styles.reverse,
|
|
32
|
+
icon === 'plus' && styles.plus,
|
|
33
|
+
className
|
|
34
|
+
]))
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<ul class={classes}>
|
|
38
|
+
{#each items as item, index}
|
|
39
|
+
<li>
|
|
40
|
+
<button
|
|
41
|
+
class={classNames([
|
|
42
|
+
styles.title,
|
|
43
|
+
item.reverse && styles.reverse
|
|
44
|
+
])}
|
|
45
|
+
data-open={toggleState[index]}
|
|
46
|
+
onclick={() => toggle(index)}
|
|
47
|
+
>
|
|
48
|
+
{item.title}
|
|
49
|
+
{#if icon !== 'none'}
|
|
50
|
+
{@html icon === 'plus' ? Plus : ChevronDown}
|
|
51
|
+
{/if}
|
|
52
|
+
</button>
|
|
53
|
+
<div class={styles.wrapper}>
|
|
54
|
+
<div class={styles.content}>
|
|
55
|
+
{@html item.content}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</li>
|
|
59
|
+
{/each}
|
|
60
|
+
</ul>
|
|
@@ -7,13 +7,15 @@ 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
|
+
|
|
11
|
+
export type Props = AccordionProps
|
|
10
12
|
|
|
11
13
|
const Accordion = ({
|
|
12
14
|
items,
|
|
13
15
|
icon,
|
|
14
16
|
reverse,
|
|
15
17
|
className
|
|
16
|
-
}:
|
|
18
|
+
}: Props) => {
|
|
17
19
|
const [state, setState] = useState(items.map(item => item.expanded ?? false))
|
|
18
20
|
|
|
19
21
|
const toggle = (index: number) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { AlertProps } from './alert'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
@@ -10,7 +11,7 @@ import warning from '../../icons/warning.svg?raw'
|
|
|
10
11
|
|
|
11
12
|
import styles from './alert.module.scss'
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
export type Props = AlertProps<HTMLAttributes<'section'>>
|
|
14
15
|
|
|
15
16
|
const iconMap = {
|
|
16
17
|
info,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
import type { AlertProps } from './alert'
|
|
3
5
|
|
|
4
6
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
7
|
|
|
@@ -10,6 +12,11 @@
|
|
|
10
12
|
|
|
11
13
|
import styles from './alert.module.scss'
|
|
12
14
|
|
|
15
|
+
export type Props = AlertProps<HTMLAttributes<HTMLElement>> & {
|
|
16
|
+
icon?: Snippet
|
|
17
|
+
children: Snippet
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
const {
|
|
14
21
|
element = 'section',
|
|
15
22
|
title,
|
|
@@ -21,7 +28,7 @@
|
|
|
21
28
|
icon,
|
|
22
29
|
children,
|
|
23
30
|
...rest
|
|
24
|
-
}:
|
|
31
|
+
}: Props = $props()
|
|
25
32
|
|
|
26
33
|
const iconMap = {
|
|
27
34
|
info,
|
|
@@ -30,14 +37,14 @@
|
|
|
30
37
|
alert
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
const hasCustomIcon = icon
|
|
40
|
+
const hasCustomIcon = $derived(icon)
|
|
34
41
|
|
|
35
|
-
const classes = [
|
|
42
|
+
const classes = $derived([
|
|
36
43
|
styles['w-alert'],
|
|
37
44
|
(!hasCustomIcon && !theme) && styles.col,
|
|
38
45
|
theme && styles[theme],
|
|
39
46
|
className
|
|
40
|
-
].filter(Boolean).join(' ')
|
|
47
|
+
].filter(Boolean).join(' '))
|
|
41
48
|
</script>
|
|
42
49
|
|
|
43
50
|
<svelte:element this={element} class={classes} {...rest}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type {
|
|
1
|
+
import React, { type JSX } from 'react'
|
|
2
|
+
import type { AlertProps } from './alert'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
|
|
@@ -10,6 +10,13 @@ import warning from '../../icons/warning.svg?raw'
|
|
|
10
10
|
|
|
11
11
|
import styles from './alert.module.scss'
|
|
12
12
|
|
|
13
|
+
export type Props = Omit<AlertProps, 'titleTag' | 'element'> & {
|
|
14
|
+
Element?: keyof JSX.IntrinsicElements
|
|
15
|
+
TitleTag?: keyof JSX.IntrinsicElements
|
|
16
|
+
icon?: React.ReactNode
|
|
17
|
+
children: React.ReactNode
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
const iconMap = {
|
|
14
21
|
info,
|
|
15
22
|
success,
|
|
@@ -28,7 +35,7 @@ const Alert = ({
|
|
|
28
35
|
children,
|
|
29
36
|
icon,
|
|
30
37
|
...rest
|
|
31
|
-
}:
|
|
38
|
+
}: Props) => {
|
|
32
39
|
const classes = [
|
|
33
40
|
styles['w-alert'],
|
|
34
41
|
(!icon && !theme) && styles.col,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Snippet } from 'svelte'
|
|
3
|
-
|
|
4
|
-
export type AlertProps = {
|
|
1
|
+
export type AlertProps<T extends object = object> = {
|
|
5
2
|
element?: string
|
|
6
3
|
title?: string
|
|
7
4
|
titleTag?: string
|
|
@@ -12,17 +9,4 @@ export type AlertProps = {
|
|
|
12
9
|
| 'success'
|
|
13
10
|
| 'warning'
|
|
14
11
|
| 'alert'
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type SvelteAlertProps = {
|
|
19
|
-
icon?: Snippet
|
|
20
|
-
children: Snippet
|
|
21
|
-
} & AlertProps
|
|
22
|
-
|
|
23
|
-
export type ReactAlertProps = {
|
|
24
|
-
Element?: keyof JSX.IntrinsicElements
|
|
25
|
-
TitleTag?: keyof JSX.IntrinsicElements
|
|
26
|
-
icon?: React.ReactNode
|
|
27
|
-
children: React.ReactNode
|
|
28
|
-
} & Omit<AlertProps, 'titleTag' | 'element'>
|
|
12
|
+
} & T
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { AspectRatioProps } from './aspectratio'
|
|
4
|
+
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
import styles from './aspect-ratio.module.scss'
|
|
8
|
+
|
|
9
|
+
export type Props = AspectRatioProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
ratio,
|
|
15
|
+
className,
|
|
16
|
+
children
|
|
17
|
+
}: Props = $props()
|
|
18
|
+
|
|
19
|
+
const classes = $derived(classNames([
|
|
20
|
+
styles.ratio,
|
|
21
|
+
className
|
|
22
|
+
]))
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class={classes} style={`aspect-ratio: ${ratio.replace(':', '/')};`}>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</div>
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ReactAspectRatioProps } from './aspectratio'
|
|
1
|
+
import type { AspectRatioProps } from './aspectratio'
|
|
3
2
|
|
|
4
3
|
import { classNames } from '../../utils/classNames'
|
|
5
4
|
|
|
6
5
|
import styles from './aspect-ratio.module.scss'
|
|
7
6
|
|
|
7
|
+
export type Props = AspectRatioProps & {
|
|
8
|
+
children: React.ReactNode
|
|
9
|
+
}
|
|
10
|
+
|
|
8
11
|
const AspectRatio = ({
|
|
9
12
|
ratio,
|
|
10
13
|
children,
|
|
11
14
|
className
|
|
12
|
-
}:
|
|
15
|
+
}: Props) => {
|
|
13
16
|
const classes = classNames([
|
|
14
17
|
styles.ratio,
|
|
15
18
|
className
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type AspectRatioProps = {
|
|
4
2
|
ratio: string
|
|
5
3
|
className?: string
|
|
6
4
|
}
|
|
7
|
-
|
|
8
|
-
export type SvelteAspectRatioProps = {
|
|
9
|
-
children: Snippet
|
|
10
|
-
} & AspectRatioProps
|
|
11
|
-
|
|
12
|
-
export type ReactAspectRatioProps = {
|
|
13
|
-
children: React.ReactNode
|
|
14
|
-
} & AspectRatioProps
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
8
|
import styles from './avatar.module.scss'
|
|
9
|
+
|
|
10
|
+
export type Props = AvatarProps
|
|
9
11
|
|
|
10
12
|
const {
|
|
11
13
|
img,
|
|
@@ -17,19 +19,19 @@
|
|
|
17
19
|
reverse,
|
|
18
20
|
className,
|
|
19
21
|
groupClassName
|
|
20
|
-
}:
|
|
22
|
+
}: Props = $props()
|
|
21
23
|
|
|
22
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
23
25
|
styles.avatar,
|
|
24
26
|
borderless && styles.borderless,
|
|
25
27
|
className
|
|
26
|
-
])
|
|
28
|
+
]))
|
|
27
29
|
|
|
28
|
-
const groupStyles = classNames([
|
|
30
|
+
const groupStyles = $derived(classNames([
|
|
29
31
|
styles.group,
|
|
30
32
|
reverse && styles.reverse,
|
|
31
33
|
groupClassName
|
|
32
|
-
])
|
|
34
|
+
]))
|
|
33
35
|
</script>
|
|
34
36
|
|
|
35
37
|
{#if Array.isArray(img)}
|