webcoreui 0.2.0 → 0.4.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.
- package/README.md +12 -1
- package/astro.d.ts +15 -1
- package/astro.js +14 -0
- package/components/Accordion/Accordion.astro +2 -0
- package/components/Accordion/Accordion.svelte +2 -0
- package/components/Accordion/Accordion.tsx +2 -0
- package/components/Alert/Alert.astro +3 -2
- package/components/Alert/Alert.svelte +4 -3
- package/components/Alert/Alert.tsx +7 -3
- package/components/Avatar/Avatar.astro +2 -1
- package/components/Avatar/Avatar.svelte +2 -1
- package/components/Avatar/Avatar.tsx +3 -3
- package/components/Avatar/avatar.module.scss +2 -0
- package/components/Badge/Badge.astro +1 -0
- package/components/Badge/Badge.svelte +3 -2
- package/components/Badge/Badge.tsx +2 -1
- package/components/Button/Button.astro +4 -5
- package/components/Button/Button.svelte +2 -1
- package/components/Button/Button.tsx +2 -1
- package/components/Button/button.ts +1 -1
- package/components/Card/Card.astro +11 -3
- package/components/Card/Card.svelte +5 -2
- package/components/Card/Card.tsx +5 -2
- package/components/Card/card.ts +1 -0
- package/components/Checkbox/Checkbox.astro +1 -0
- package/components/Checkbox/Checkbox.svelte +7 -5
- package/components/Checkbox/Checkbox.tsx +4 -2
- package/components/Collapsible/Collapsible.astro +64 -0
- package/components/Collapsible/Collapsible.svelte +49 -0
- package/components/Collapsible/Collapsible.tsx +55 -0
- package/components/Collapsible/collapsible.module.scss +29 -0
- package/components/Collapsible/collapsible.ts +14 -0
- package/components/ConditionalWrapper/ConditionalWrapper.astro +2 -1
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +1 -2
- package/components/Group/Group.astro +22 -0
- package/components/Group/Group.svelte +20 -0
- package/components/Group/Group.tsx +22 -0
- package/components/Group/group.module.scss +43 -0
- package/components/Group/group.ts +8 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +8 -1
- package/components/Input/Input.svelte +15 -3
- package/components/Input/Input.tsx +10 -3
- package/components/Input/input.module.scss +4 -1
- package/components/Input/input.ts +9 -4
- package/components/List/List.astro +169 -0
- package/components/List/List.svelte +147 -0
- package/components/List/List.tsx +168 -0
- package/components/List/list.module.scss +91 -0
- package/components/List/list.ts +37 -0
- package/components/Menu/Menu.astro +2 -1
- package/components/Menu/Menu.svelte +7 -5
- package/components/Menu/Menu.tsx +116 -113
- package/components/Modal/Modal.astro +6 -4
- package/components/Modal/Modal.svelte +8 -6
- package/components/Modal/Modal.tsx +79 -76
- package/components/Modal/modal.module.scss +1 -1
- package/components/Modal/modal.ts +1 -0
- package/components/Popover/Popover.astro +26 -0
- package/components/Popover/Popover.svelte +23 -0
- package/components/Popover/Popover.tsx +55 -0
- package/components/Popover/popover.module.scss +52 -0
- package/components/Popover/popover.ts +10 -0
- package/components/Progress/Progress.astro +2 -1
- package/components/Progress/Progress.svelte +2 -1
- package/components/Progress/Progress.tsx +3 -2
- package/components/Radio/Radio.astro +1 -0
- package/components/Radio/Radio.svelte +4 -2
- package/components/Radio/Radio.tsx +3 -2
- package/components/Rating/Rating.astro +3 -1
- package/components/Rating/Rating.svelte +9 -7
- package/components/Rating/Rating.tsx +4 -2
- package/components/Select/Select.astro +135 -0
- package/components/Select/Select.svelte +122 -0
- package/components/Select/Select.tsx +142 -0
- package/components/Select/select.module.scss +25 -0
- package/components/Select/select.ts +21 -0
- package/components/Sheet/Sheet.astro +30 -0
- package/components/Sheet/Sheet.svelte +25 -0
- package/components/Sheet/Sheet.tsx +33 -0
- package/components/Sheet/sheet.module.scss +68 -0
- package/components/Sheet/sheet.ts +10 -0
- package/components/Slider/Slider.astro +2 -1
- package/components/Slider/Slider.svelte +2 -1
- package/components/Slider/Slider.tsx +49 -48
- package/components/Spinner/Spinner.astro +4 -3
- package/components/Spinner/Spinner.svelte +3 -2
- package/components/Spinner/Spinner.tsx +4 -3
- package/components/Switch/Switch.astro +2 -1
- package/components/Switch/Switch.svelte +5 -4
- package/components/Switch/Switch.tsx +2 -2
- package/components/Switch/switch.module.scss +1 -1
- package/components/Table/Table.astro +1 -0
- package/components/Table/Table.svelte +2 -1
- package/components/Table/Table.tsx +2 -1
- package/components/Tabs/Tabs.astro +2 -1
- package/components/Tabs/Tabs.svelte +2 -1
- package/components/Tabs/Tabs.tsx +4 -3
- package/components/Textarea/Textarea.astro +45 -0
- package/components/Textarea/Textarea.svelte +47 -0
- package/components/Textarea/Textarea.tsx +52 -0
- package/components/Textarea/textarea.module.scss +36 -0
- package/components/Textarea/textarea.ts +18 -0
- package/components/ThemeSwitcher/ThemeSwitcher.astro +108 -107
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +5 -4
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +91 -90
- package/components/Timeline/Timeline.astro +3 -2
- package/components/Timeline/Timeline.svelte +3 -2
- package/components/Timeline/Timeline.tsx +3 -2
- package/components/TimelineItem/TimelineItem.svelte +2 -1
- package/components/TimelineItem/TimelineItem.tsx +2 -1
- package/components/Toast/Toast.astro +3 -1
- package/components/Toast/Toast.svelte +14 -7
- package/components/Toast/Toast.tsx +3 -1
- package/icons/moon.svg +1 -1
- package/icons/search.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +99 -0
- package/index.js +2 -0
- package/package.json +23 -4
- package/react.d.ts +14 -0
- package/react.js +14 -0
- package/scss/config/mixins.scss +12 -10
- package/scss/config/variables.scss +1 -0
- package/scss/config.scss +1 -0
- package/scss/global/utility.scss +2 -0
- package/svelte.d.ts +15 -1
- package/svelte.js +14 -0
- package/utils/cookies.ts +4 -4
- package/utils/debounce.ts +24 -0
- package/utils/event.ts +2 -2
- package/utils/interpolate.ts +5 -5
- package/utils/modal.ts +90 -27
- package/utils/popover.ts +223 -0
- package/utils/toast.ts +6 -8
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ yarn add webcoreui
|
|
|
79
79
|
|
|
80
80
|
### Setup
|
|
81
81
|
|
|
82
|
-
Create an empty `webcore.config.scss` 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:
|
|
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
85
|
@import 'webcoreui/styles';
|
|
@@ -113,6 +113,10 @@ html body {
|
|
|
113
113
|
// Checkbox component
|
|
114
114
|
--w-checkbox-color: var(--w-color-primary);
|
|
115
115
|
|
|
116
|
+
// Collapsible component
|
|
117
|
+
--w-collapsible-initial-height: 0;
|
|
118
|
+
--w-collapsible-max-height: 100%;
|
|
119
|
+
|
|
116
120
|
// Progress component
|
|
117
121
|
--w-progress-color: var(--w-color-primary);
|
|
118
122
|
--w-progress-background: var(--w-color-primary-50);
|
|
@@ -197,19 +201,26 @@ import { Accordion } from 'webcoreui/react'
|
|
|
197
201
|
- [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
|
|
198
202
|
- [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
|
|
199
203
|
- [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
|
|
204
|
+
- [Collapsible](https://github.com/Frontendland/webcoreui/tree/main/src/components/Collapsible)
|
|
200
205
|
- [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
|
|
206
|
+
- [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
|
|
201
207
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
202
208
|
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
209
|
+
- [List](https://github.com/Frontendland/webcoreui/tree/main/src/components/List)
|
|
203
210
|
- [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
|
|
204
211
|
- [Modal](https://github.com/Frontendland/webcoreui/tree/main/src/components/Modal)
|
|
212
|
+
- [Popover](https://github.com/Frontendland/webcoreui/tree/main/src/components/Popover)
|
|
205
213
|
- [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
|
|
206
214
|
- [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
|
|
207
215
|
- [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
|
|
216
|
+
- [Select](https://github.com/Frontendland/webcoreui/tree/main/src/components/Select)
|
|
217
|
+
- [Sheet](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sheet)
|
|
208
218
|
- [Slider](https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider)
|
|
209
219
|
- [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
|
|
210
220
|
- [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
|
|
211
221
|
- [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
|
|
212
222
|
- [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
|
|
223
|
+
- [Textarea](https://github.com/Frontendland/webcoreui/tree/main/src/components/Textarea)
|
|
213
224
|
- [ThemeSwitcher](https://github.com/Frontendland/webcoreui/tree/main/src/components/ThemeSwitcher)
|
|
214
225
|
- [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
|
|
215
226
|
- [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
|
package/astro.d.ts
CHANGED
|
@@ -5,24 +5,31 @@ import type { BadgeProps } from './components/Badge/badge'
|
|
|
5
5
|
import type { ButtonProps } from './components/Button/button'
|
|
6
6
|
import type { CardProps } from './components/Card/card'
|
|
7
7
|
import type { CheckboxProps } from './components/Checkbox/checkbox'
|
|
8
|
+
import type { CollapsibleProps } from './components/Collapsible/collapsible'
|
|
8
9
|
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
10
|
+
import type { GroupProps } from './components/Group/group'
|
|
9
11
|
import type { IconProps } from './components/Icon/icon'
|
|
10
12
|
import type { InputProps } from './components/Input/input'
|
|
13
|
+
import type { ListProps } from './components/List/list'
|
|
11
14
|
import type { MenuProps } from './components/Menu/menu'
|
|
12
15
|
import type { ModalProps } from './components/Modal/modal'
|
|
16
|
+
import type { PopoverProps } from './components/Popover/popover'
|
|
13
17
|
import type { ProgressProps } from './components/Progress/progress'
|
|
14
18
|
import type { RadioProps } from './components/Radio/radio'
|
|
15
19
|
import type { RatingProps } from './components/Rating/rating'
|
|
20
|
+
import type { SelectProps } from './components/Select/select'
|
|
21
|
+
import type { SheetProps } from './components/Sheet/sheet'
|
|
16
22
|
import type { SliderProps } from './components/Slider/slider'
|
|
17
23
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
18
24
|
import type { SwitchProps } from './components/Switch/switch'
|
|
19
25
|
import type { TableProps } from './components/Table/table'
|
|
20
26
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
27
|
+
import type { TextareaProps } from './components/Textarea/textarea'
|
|
21
28
|
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
22
29
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
23
30
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
24
31
|
import type { ToastProps } from './components/Toast/toast'
|
|
25
|
-
|
|
32
|
+
|
|
26
33
|
declare module 'webcoreui/astro' {
|
|
27
34
|
export function Accordion(_props: AccordionProps): any
|
|
28
35
|
export function Alert(_props: AlertProps): any
|
|
@@ -31,19 +38,26 @@ declare module 'webcoreui/astro' {
|
|
|
31
38
|
export function Button(_props: ButtonProps): any
|
|
32
39
|
export function Card(_props: CardProps): any
|
|
33
40
|
export function Checkbox(_props: CheckboxProps): any
|
|
41
|
+
export function Collapsible(_props: CollapsibleProps): any
|
|
34
42
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
43
|
+
export function Group(_props: GroupProps): any
|
|
35
44
|
export function Icon(_props: IconProps): any
|
|
36
45
|
export function Input(_props: InputProps): any
|
|
46
|
+
export function List(_props: ListProps): any
|
|
37
47
|
export function Menu(_props: MenuProps): any
|
|
38
48
|
export function Modal(_props: ModalProps): any
|
|
49
|
+
export function Popover(_props: PopoverProps): any
|
|
39
50
|
export function Progress(_props: ProgressProps): any
|
|
40
51
|
export function Radio(_props: RadioProps): any
|
|
41
52
|
export function Rating(_props: RatingProps): any
|
|
53
|
+
export function Select(_props: SelectProps): any
|
|
54
|
+
export function Sheet(_props: SheetProps): any
|
|
42
55
|
export function Slider(_props: SliderProps): any
|
|
43
56
|
export function Spinner(_props: SpinnerProps): any
|
|
44
57
|
export function Switch(_props: SwitchProps): any
|
|
45
58
|
export function Table(_props: TableProps): any
|
|
46
59
|
export function Tabs(_props: TabsProps): any
|
|
60
|
+
export function Textarea(_props: TextareaProps): any
|
|
47
61
|
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
48
62
|
export function Timeline(_props: TimelineProps): any
|
|
49
63
|
export function TimelineItem(_props: TimelineItemProps): any
|
package/astro.js
CHANGED
|
@@ -5,19 +5,26 @@ import BadgeComponent from './components/Badge/Badge.astro'
|
|
|
5
5
|
import ButtonComponent from './components/Button/Button.astro'
|
|
6
6
|
import CardComponent from './components/Card/Card.astro'
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.astro'
|
|
8
|
+
import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
|
|
8
9
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
10
|
+
import GroupComponent from './components/Group/Group.astro'
|
|
9
11
|
import IconComponent from './components/Icon/Icon.astro'
|
|
10
12
|
import InputComponent from './components/Input/Input.astro'
|
|
13
|
+
import ListComponent from './components/List/List.astro'
|
|
11
14
|
import MenuComponent from './components/Menu/Menu.astro'
|
|
12
15
|
import ModalComponent from './components/Modal/Modal.astro'
|
|
16
|
+
import PopoverComponent from './components/Popover/Popover.astro'
|
|
13
17
|
import ProgressComponent from './components/Progress/Progress.astro'
|
|
14
18
|
import RadioComponent from './components/Radio/Radio.astro'
|
|
15
19
|
import RatingComponent from './components/Rating/Rating.astro'
|
|
20
|
+
import SelectComponent from './components/Select/Select.astro'
|
|
21
|
+
import SheetComponent from './components/Sheet/Sheet.astro'
|
|
16
22
|
import SliderComponent from './components/Slider/Slider.astro'
|
|
17
23
|
import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
18
24
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
19
25
|
import TableComponent from './components/Table/Table.astro'
|
|
20
26
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
27
|
+
import TextareaComponent from './components/Textarea/Textarea.astro'
|
|
21
28
|
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.astro'
|
|
22
29
|
import TimelineComponent from './components/Timeline/Timeline.astro'
|
|
23
30
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
|
|
@@ -30,19 +37,26 @@ export const Badge = BadgeComponent
|
|
|
30
37
|
export const Button = ButtonComponent
|
|
31
38
|
export const Card = CardComponent
|
|
32
39
|
export const Checkbox = CheckboxComponent
|
|
40
|
+
export const Collapsible = CollapsibleComponent
|
|
33
41
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
42
|
+
export const Group = GroupComponent
|
|
34
43
|
export const Icon = IconComponent
|
|
35
44
|
export const Input = InputComponent
|
|
45
|
+
export const List = ListComponent
|
|
36
46
|
export const Menu = MenuComponent
|
|
37
47
|
export const Modal = ModalComponent
|
|
48
|
+
export const Popover = PopoverComponent
|
|
38
49
|
export const Progress = ProgressComponent
|
|
39
50
|
export const Radio = RadioComponent
|
|
40
51
|
export const Rating = RatingComponent
|
|
52
|
+
export const Select = SelectComponent
|
|
53
|
+
export const Sheet = SheetComponent
|
|
41
54
|
export const Slider = SliderComponent
|
|
42
55
|
export const Spinner = SpinnerComponent
|
|
43
56
|
export const Switch = SwitchComponent
|
|
44
57
|
export const Table = TableComponent
|
|
45
58
|
export const Tabs = TabsComponent
|
|
59
|
+
export const Textarea = TextareaComponent
|
|
46
60
|
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
47
61
|
export const Timeline = TimelineComponent
|
|
48
62
|
export const TimelineItem = TimelineItemComponent
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { AlertProps } from './alert'
|
|
3
|
+
|
|
3
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import alert from '../../icons/alert.svg?raw'
|
|
6
7
|
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
+
import info from '../../icons/info.svg?raw'
|
|
7
9
|
import warning from '../../icons/warning.svg?raw'
|
|
8
|
-
import alert from '../../icons/alert.svg?raw'
|
|
9
10
|
|
|
10
11
|
import styles from './alert.module.scss'
|
|
11
12
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AlertProps } from './alert'
|
|
3
|
+
|
|
3
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import alert from '../../icons/alert.svg?raw'
|
|
6
7
|
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
+
import info from '../../icons/info.svg?raw'
|
|
7
9
|
import warning from '../../icons/warning.svg?raw'
|
|
8
|
-
import alert from '../../icons/alert.svg?raw'
|
|
9
10
|
|
|
10
11
|
import styles from './alert.module.scss'
|
|
11
12
|
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
{#if !hasCustomIcon && theme}
|
|
41
42
|
{@html iconMap[theme]}
|
|
42
43
|
{/if}
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
<ConditionalWrapper
|
|
45
46
|
condition={!!(hasCustomIcon || theme)}
|
|
46
47
|
element="div"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactAlertProps } from './alert'
|
|
3
|
+
|
|
3
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import alert from '../../icons/alert.svg?raw'
|
|
6
7
|
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
+
import info from '../../icons/info.svg?raw'
|
|
7
9
|
import warning from '../../icons/warning.svg?raw'
|
|
8
|
-
import alert from '../../icons/alert.svg?raw'
|
|
9
10
|
|
|
10
11
|
import styles from './alert.module.scss'
|
|
11
12
|
|
|
@@ -38,7 +39,10 @@ const Alert = ({
|
|
|
38
39
|
return (
|
|
39
40
|
<Element className={classes} {...rest}>
|
|
40
41
|
{icon && icon}
|
|
41
|
-
{!icon && theme && <div
|
|
42
|
+
{!icon && theme && <div
|
|
43
|
+
dangerouslySetInnerHTML={{ __html: iconMap[theme] }}
|
|
44
|
+
style={{ height: '20px' }}
|
|
45
|
+
/>}
|
|
42
46
|
|
|
43
47
|
<ConditionalWrapper condition={!!(icon || theme)} wrapper={children => (
|
|
44
48
|
<div className={styles.wrapper}>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
|
+
|
|
3
4
|
import styles from './avatar.module.scss'
|
|
4
5
|
|
|
5
6
|
interface Props extends AvatarProps {}
|
|
@@ -12,7 +13,7 @@ const {
|
|
|
12
13
|
borderColor,
|
|
13
14
|
borderless,
|
|
14
15
|
reverse,
|
|
15
|
-
className
|
|
16
|
+
className
|
|
16
17
|
} = Astro.props
|
|
17
18
|
|
|
18
19
|
const classes = [
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
3
|
|
|
4
|
-
import styles from './avatar.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './avatar.module.scss'
|
|
7
|
+
|
|
7
8
|
export let img: AvatarProps['img'] = ''
|
|
8
9
|
export let alt: AvatarProps['alt'] = 'Avatar'
|
|
9
10
|
export let size: AvatarProps['size'] = 40
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
3
|
|
|
4
|
-
import styles from './avatar.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './avatar.module.scss'
|
|
7
|
+
|
|
7
8
|
const Avatar = ({
|
|
8
9
|
img,
|
|
9
10
|
alt = 'Avatar',
|
|
@@ -12,7 +13,7 @@ const Avatar = ({
|
|
|
12
13
|
borderColor,
|
|
13
14
|
borderless,
|
|
14
15
|
reverse,
|
|
15
|
-
className
|
|
16
|
+
className
|
|
16
17
|
}: AvatarProps) => {
|
|
17
18
|
const classes = classNames([
|
|
18
19
|
styles.avatar,
|
|
@@ -60,7 +61,6 @@ const Avatar = ({
|
|
|
60
61
|
style={borderColorStyle}
|
|
61
62
|
/>
|
|
62
63
|
)
|
|
63
|
-
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export default Avatar
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { SvelteBadgeProps } from './badge'
|
|
3
3
|
|
|
4
|
-
import styles from './badge.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
import styles from './badge.module.scss'
|
|
7
|
+
|
|
7
8
|
export let theme: SvelteBadgeProps['theme'] = null
|
|
8
9
|
export let onClick: SvelteBadgeProps['onClick'] = null
|
|
9
10
|
export let hover: SvelteBadgeProps['hover'] = false
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactBadgeProps } from './badge'
|
|
3
3
|
|
|
4
|
-
import styles from './badge.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './badge.module.scss'
|
|
7
|
+
|
|
7
8
|
const Badge = ({
|
|
8
9
|
theme,
|
|
9
10
|
onClick,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { ButtonProps } from './button'
|
|
3
3
|
|
|
4
4
|
import styles from './button.module.scss'
|
|
5
|
-
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
7
6
|
interface Props extends ButtonProps {}
|
|
8
7
|
|
|
@@ -13,19 +12,19 @@ const {
|
|
|
13
12
|
...rest
|
|
14
13
|
} = Astro.props
|
|
15
14
|
|
|
16
|
-
const classes =
|
|
15
|
+
const classes = [
|
|
17
16
|
styles.button,
|
|
18
17
|
theme && styles[theme],
|
|
19
18
|
className
|
|
20
|
-
]
|
|
19
|
+
]
|
|
21
20
|
---
|
|
22
21
|
|
|
23
22
|
{href ? (
|
|
24
|
-
<a {...rest} href={href} class={classes
|
|
23
|
+
<a {...rest} href={href} class:list={classes}>
|
|
25
24
|
<slot />
|
|
26
25
|
</a>
|
|
27
26
|
) : (
|
|
28
|
-
<button {...rest} class={classes
|
|
27
|
+
<button {...rest} class:list={classes}>
|
|
29
28
|
<slot />
|
|
30
29
|
</button>
|
|
31
30
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { SvelteButtonProps } from './button'
|
|
3
3
|
|
|
4
|
-
import styles from './button.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './button.module.scss'
|
|
7
|
+
|
|
7
8
|
export let theme: SvelteButtonProps['theme'] = null
|
|
8
9
|
export let href: SvelteButtonProps['href'] = ''
|
|
9
10
|
export let className: SvelteButtonProps['className'] = ''
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactButtonProps } from './button'
|
|
3
3
|
|
|
4
|
-
import styles from './button.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './button.module.scss'
|
|
7
|
+
|
|
7
8
|
const Button = ({
|
|
8
9
|
theme,
|
|
9
10
|
href,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { CardProps } from './card'
|
|
3
|
+
|
|
3
4
|
import styles from './card.module.scss'
|
|
4
5
|
|
|
5
6
|
interface Props extends CardProps {}
|
|
@@ -10,6 +11,7 @@ const {
|
|
|
10
11
|
titleTag = 'span',
|
|
11
12
|
compact,
|
|
12
13
|
className,
|
|
14
|
+
bodyClassName,
|
|
13
15
|
secondary,
|
|
14
16
|
...rest
|
|
15
17
|
} = Astro.props
|
|
@@ -17,8 +19,14 @@ const {
|
|
|
17
19
|
const classes = [
|
|
18
20
|
styles.card,
|
|
19
21
|
secondary && styles.secondary,
|
|
20
|
-
className
|
|
21
|
-
]
|
|
22
|
+
className
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const bodyClasses = [
|
|
26
|
+
styles.body,
|
|
27
|
+
compact && styles.compact,
|
|
28
|
+
bodyClassName
|
|
29
|
+
]
|
|
22
30
|
|
|
23
31
|
const Component = element
|
|
24
32
|
const Title = titleTag
|
|
@@ -28,7 +36,7 @@ const Title = titleTag
|
|
|
28
36
|
{title && (
|
|
29
37
|
<Title class:list={styles.title}>{title}</Title>
|
|
30
38
|
)}
|
|
31
|
-
<div class:list={
|
|
39
|
+
<div class:list={bodyClasses}>
|
|
32
40
|
<slot />
|
|
33
41
|
</div>
|
|
34
42
|
</Component>
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { CardProps } from './card'
|
|
3
3
|
|
|
4
|
-
import styles from './card.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './card.module.scss'
|
|
7
|
+
|
|
7
8
|
export let element: CardProps['element'] = 'section'
|
|
8
9
|
export let title: CardProps['title'] = ''
|
|
9
10
|
export let titleTag: CardProps['titleTag'] = 'span'
|
|
10
11
|
export let compact: CardProps['compact'] = false
|
|
11
12
|
export let className: CardProps['className'] = ''
|
|
13
|
+
export let bodyClassName: CardProps['bodyClassName'] = ''
|
|
12
14
|
export let secondary: CardProps['secondary'] = false
|
|
13
15
|
|
|
14
16
|
const classes = classNames([
|
|
@@ -19,7 +21,8 @@
|
|
|
19
21
|
|
|
20
22
|
const bodyClasses = classNames([
|
|
21
23
|
styles.body,
|
|
22
|
-
compact && styles.compact
|
|
24
|
+
compact && styles.compact,
|
|
25
|
+
bodyClassName
|
|
23
26
|
])
|
|
24
27
|
</script>
|
|
25
28
|
|
package/components/Card/Card.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactCardProps } from './card'
|
|
3
3
|
|
|
4
|
-
import styles from './card.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './card.module.scss'
|
|
7
|
+
|
|
7
8
|
const Card = ({
|
|
8
9
|
Element = 'section',
|
|
9
10
|
title,
|
|
10
11
|
TitleTag = 'span',
|
|
11
12
|
compact,
|
|
12
13
|
className,
|
|
14
|
+
bodyClassName,
|
|
13
15
|
secondary,
|
|
14
16
|
children,
|
|
15
17
|
...rest
|
|
@@ -22,7 +24,8 @@ const Card = ({
|
|
|
22
24
|
|
|
23
25
|
const bodyClasses = classNames([
|
|
24
26
|
styles.body,
|
|
25
|
-
compact && styles.compact
|
|
27
|
+
compact && styles.compact,
|
|
28
|
+
bodyClassName
|
|
26
29
|
])
|
|
27
30
|
|
|
28
31
|
return (
|
package/components/Card/card.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { SvelteCheckboxProps } from './checkbox'
|
|
3
|
+
|
|
3
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
5
8
|
import check from '../../icons/check.svg?raw'
|
|
6
|
-
|
|
9
|
+
|
|
7
10
|
import styles from './checkbox.module.scss'
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
|
|
10
12
|
export let checked: SvelteCheckboxProps['checked'] = false
|
|
11
13
|
export let label: SvelteCheckboxProps['label'] = ''
|
|
12
14
|
export let subText: SvelteCheckboxProps['subText'] = ''
|
|
@@ -20,7 +22,7 @@
|
|
|
20
22
|
label && subText && styles.col,
|
|
21
23
|
className
|
|
22
24
|
])
|
|
23
|
-
|
|
25
|
+
|
|
24
26
|
const style = color
|
|
25
27
|
? `--w-checkbox-color: ${color};`
|
|
26
28
|
: null
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactCheckboxProps } from './checkbox'
|
|
3
|
+
|
|
3
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
4
5
|
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
5
8
|
import check from '../../icons/check.svg?raw'
|
|
6
9
|
|
|
7
10
|
import styles from './checkbox.module.scss'
|
|
8
|
-
import { classNames } from '../../utils/classNames'
|
|
9
11
|
|
|
10
12
|
const Checkbox = ({
|
|
11
13
|
checked,
|
|
@@ -21,7 +23,7 @@ const Checkbox = ({
|
|
|
21
23
|
label && subText && styles.col,
|
|
22
24
|
className
|
|
23
25
|
])
|
|
24
|
-
|
|
26
|
+
|
|
25
27
|
const style = color
|
|
26
28
|
? { '--w-checkbox-color': color } as React.CSSProperties
|
|
27
29
|
: undefined
|