webcoreui 0.0.10 → 0.0.12
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 +35 -7
- package/astro.d.ts +8 -0
- package/astro.js +8 -0
- package/components/Accordion/Accordion.astro +10 -8
- package/components/Accordion/Accordion.svelte +8 -8
- package/components/Accordion/Accordion.tsx +7 -6
- package/components/Accordion/{accordion.scss → accordion.module.scss} +18 -10
- package/components/Alert/Alert.astro +11 -7
- package/components/Alert/Alert.svelte +9 -7
- package/components/Alert/Alert.tsx +11 -7
- package/components/Alert/alert.module.scss +54 -0
- package/components/Alert/alert.ts +3 -1
- package/components/Avatar/Avatar.astro +4 -4
- package/components/Avatar/Avatar.svelte +13 -7
- package/components/Avatar/Avatar.tsx +11 -9
- package/components/Avatar/{avatar.scss → avatar.module.scss} +2 -2
- package/components/Badge/Badge.astro +8 -8
- package/components/Badge/Badge.svelte +25 -13
- package/components/Badge/Badge.tsx +26 -8
- package/components/Badge/badge.module.scss +89 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +10 -6
- package/components/Button/Button.svelte +15 -11
- package/components/Button/Button.tsx +11 -7
- package/components/Button/button.module.scss +94 -0
- package/components/Button/button.ts +6 -1
- package/components/Card/Card.astro +7 -15
- package/components/Card/Card.svelte +16 -13
- package/components/Card/Card.tsx +15 -11
- package/components/Card/card.module.scss +33 -0
- package/components/Checkbox/Checkbox.astro +10 -10
- package/components/Checkbox/Checkbox.svelte +19 -18
- package/components/Checkbox/Checkbox.tsx +12 -11
- package/components/Checkbox/{checkbox.scss → checkbox.module.scss} +16 -17
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.svelte +1 -8
- package/components/Icon/Icon.tsx +1 -8
- package/components/Icon/map.ts +23 -0
- package/components/Input/Input.astro +50 -0
- package/components/Input/Input.svelte +52 -0
- package/components/Input/Input.tsx +59 -0
- package/components/Input/input.module.scss +87 -0
- package/components/Input/input.ts +50 -0
- package/components/Menu/Menu.astro +107 -0
- package/components/Menu/Menu.svelte +88 -0
- package/components/Menu/Menu.tsx +107 -0
- package/components/Menu/menu.module.scss +144 -0
- package/components/Menu/menu.ts +21 -0
- package/components/Progress/Progress.astro +42 -40
- package/components/Progress/Progress.svelte +40 -38
- package/components/Progress/Progress.tsx +48 -47
- package/components/Progress/{progress.scss → progress.module.scss} +66 -66
- package/components/Radio/Radio.astro +57 -57
- package/components/Radio/Radio.svelte +58 -56
- package/components/Radio/Radio.tsx +69 -68
- package/components/Radio/{radio.scss → radio.module.scss} +92 -92
- package/components/Radio/radio.ts +4 -0
- package/components/Rating/Rating.astro +13 -10
- package/components/Rating/Rating.svelte +15 -15
- package/components/Rating/Rating.tsx +22 -11
- package/components/Rating/{rating.scss → rating.module.scss} +10 -9
- package/components/Rating/rating.ts +1 -1
- package/components/Spinner/Spinner.astro +44 -42
- package/components/Spinner/Spinner.svelte +40 -38
- package/components/Spinner/Spinner.tsx +45 -44
- package/components/Spinner/{spinner.scss → spinner.module.scss} +41 -41
- package/components/Switch/Switch.astro +13 -11
- package/components/Switch/Switch.svelte +26 -24
- package/components/Switch/Switch.tsx +14 -12
- package/components/Switch/{switch.scss → switch.module.scss} +4 -4
- package/components/Switch/switch.ts +8 -4
- package/components/Table/Table.astro +60 -0
- package/components/Table/Table.svelte +56 -0
- package/components/Table/Table.tsx +64 -0
- package/components/Table/table.module.scss +64 -0
- package/components/Table/table.ts +10 -0
- package/components/Tabs/Tabs.astro +77 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/{tabs.scss → tabs.module.scss} +30 -31
- package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
- package/components/ThemeSwitcher/themeswitcher.module.scss +74 -0
- package/components/ThemeSwitcher/themeswitcher.ts +13 -0
- package/components/Timeline/Timeline.astro +36 -34
- package/components/Timeline/Timeline.svelte +32 -30
- package/components/Timeline/Timeline.tsx +38 -37
- package/components/Timeline/{timeline.scss → timeline.module.scss} +71 -71
- package/components/TimelineItem/TimelineItem.astro +27 -26
- package/components/TimelineItem/TimelineItem.svelte +24 -22
- package/components/TimelineItem/TimelineItem.tsx +33 -32
- package/components/TimelineItem/{timelineitem.scss → timelineitem.module.scss} +31 -31
- package/components/Toast/Toast.astro +41 -30
- package/components/Toast/Toast.svelte +32 -21
- package/components/Toast/Toast.tsx +38 -28
- package/components/Toast/{toast.scss → toast.module.scss} +44 -43
- package/components/Toast/toast.ts +3 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/index.js +3 -0
- package/package.json +3 -1
- package/react.d.ts +8 -0
- package/react.js +8 -0
- package/scss/global/elements.scss +1 -1
- package/scss/global/scrollbar.scss +21 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +8 -5
- package/scss/global/utility.scss +29 -0
- package/scss/global.scss +2 -0
- package/scss/resets.scss +5 -5
- package/scss/setup.scss +39 -18
- package/svelte.d.ts +18 -10
- package/svelte.js +8 -0
- package/utils/classNames.ts +4 -0
- package/utils/cookies.ts +28 -0
- package/utils/event.ts +17 -0
- package/utils/toast.ts +12 -9
- package/components/Alert/alert.scss +0 -53
- package/components/Badge/badge.scss +0 -85
- package/components/Button/button.scss +0 -91
- package/components/Card/card.scss +0 -37
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
25
|
> [!IMPORTANT]
|
|
26
|
-
> This library is still in early development. New changes can break existing functionality, and no functionality should be considered final. The library will be considered stable once it reaches v1.0.
|
|
26
|
+
> This library is still in early development. New changes can break existing functionality, and no functionality should be considered final at this stage. The library will be considered stable once it reaches v1.0.
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
## Table of Contents
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
## Documentation
|
|
41
41
|
|
|
42
|
-
Full documentation
|
|
42
|
+
Full documentation available on [webcoreui.dev](https://webcoreui.dev).
|
|
43
43
|
|
|
44
44
|
## Getting Started
|
|
45
45
|
|
|
@@ -101,15 +101,39 @@ The `Setup` mixin can also accept the following options:
|
|
|
101
101
|
| `includeResets` | `true` | Include reset styles. Set to `false` if you want to use your own CSS resets. |
|
|
102
102
|
| `includeHelperClasses` | `true` | Adds global helper classes for CSS. All global helper classes are defined [here](https://github.com/Frontendland/webcoreui/tree/main/src/scss/global). |
|
|
103
103
|
| `includeElementStyles` | `true` | Adds styles for native HTML elements, such as `code`, `pre`, or `ul`.
|
|
104
|
+
| `includeTooltip` | `true` | Adds styles for using tooltips.
|
|
105
|
+
| `includeScrollbarStyles` | `true` | Adds styles for scrollbars.
|
|
104
106
|
|
|
105
|
-
Default component styles can
|
|
107
|
+
Default component styles can be changed by overriding the following CSS variables:
|
|
106
108
|
|
|
107
109
|
```css
|
|
108
|
-
|
|
109
|
-
--w-avatar-border:
|
|
110
|
-
--w-
|
|
111
|
-
--w-
|
|
110
|
+
body {
|
|
111
|
+
--w-avatar-border: var(--w-color-primary-70);
|
|
112
|
+
--w-checkbox-color: var(--w-color-primary);
|
|
113
|
+
--w-progress-color: var(--w-color-primary);
|
|
114
|
+
--w-progress-background: var(--w-color-primary-50);
|
|
115
|
+
--w-progress-stripe-light: var(--w-color-primary);
|
|
116
|
+
--w-progress-stripe-dark: var(--w-color-primary-10);
|
|
117
|
+
--w-radio-color: var(--w-color-primary);
|
|
118
|
+
--w-rating-color: var(--w-color-primary);
|
|
119
|
+
--w-rating-empty-color: var(--w-color-primary);
|
|
120
|
+
--w-rating-empty-background: var(--w-color-primary-70);
|
|
112
121
|
--w-rating-size: 18px;
|
|
122
|
+
--w-scrollbar-bg: var(--w-color-primary-60);
|
|
123
|
+
--w-scrollbar-fg: var(--w-color-primary-50);
|
|
124
|
+
--w-spinner-color: var(--w-color-primary);
|
|
125
|
+
--w-spinner-width: 2px;
|
|
126
|
+
--w-spinner-speed: 2s;
|
|
127
|
+
--w-spinner-size: 30px;
|
|
128
|
+
--w-spinner-dash: 8;
|
|
129
|
+
--w-switch-off-color: var(--w-color-primary-50);
|
|
130
|
+
--w-switch-on-color: var(--w-color-primary);
|
|
131
|
+
--w-theme-switcher-size: 20px;
|
|
132
|
+
--w-timeline-color: var(--w-color-primary-50);
|
|
133
|
+
--w-timeline-text-color: var(--w-color-primary);
|
|
134
|
+
--w-timeline-counter: decimal;
|
|
135
|
+
--w-tooltip-background: var(--w-color-primary);
|
|
136
|
+
--w-tooltip-color: var(--w-color-primary-70);
|
|
113
137
|
}
|
|
114
138
|
```
|
|
115
139
|
|
|
@@ -144,12 +168,16 @@ import { Accordion } from 'webcoreui/react'
|
|
|
144
168
|
- [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
|
|
145
169
|
- [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
|
|
146
170
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
171
|
+
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
172
|
+
- [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
|
|
147
173
|
- [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
|
|
148
174
|
- [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
|
|
149
175
|
- [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
|
|
150
176
|
- [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
|
|
151
177
|
- [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
|
|
178
|
+
- [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
|
|
152
179
|
- [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
|
|
180
|
+
- [ThemeSwitcher](https://github.com/Frontendland/webcoreui/tree/main/src/components/ThemeSwitcher)
|
|
153
181
|
- [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
|
|
154
182
|
- [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
|
|
155
183
|
- [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
|
package/astro.d.ts
CHANGED
|
@@ -7,12 +7,16 @@ import type { CardProps } from './components/Card/card'
|
|
|
7
7
|
import type { CheckboxProps } from './components/Checkbox/checkbox'
|
|
8
8
|
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
9
|
import type { IconProps } from './components/Icon/icon'
|
|
10
|
+
import type { InputProps } from './components/Input/input'
|
|
11
|
+
import type { MenuProps } from './components/Menu/menu'
|
|
10
12
|
import type { ProgressProps } from './components/Progress/progress'
|
|
11
13
|
import type { RadioProps } from './components/Radio/radio'
|
|
12
14
|
import type { RatingProps } from './components/Rating/rating'
|
|
13
15
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
14
16
|
import type { SwitchProps } from './components/Switch/switch'
|
|
17
|
+
import type { TableProps } from './components/Table/table'
|
|
15
18
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
19
|
+
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
16
20
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
17
21
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
18
22
|
import type { ToastProps } from './components/Toast/toast'
|
|
@@ -27,12 +31,16 @@ declare module 'webcoreui/astro' {
|
|
|
27
31
|
export function Checkbox(_props: CheckboxProps): any
|
|
28
32
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
29
33
|
export function Icon(_props: IconProps): any
|
|
34
|
+
export function Input(_props: InputProps): any
|
|
35
|
+
export function Menu(_props: MenuProps): any
|
|
30
36
|
export function Progress(_props: ProgressProps): any
|
|
31
37
|
export function Radio(_props: RadioProps): any
|
|
32
38
|
export function Rating(_props: RatingProps): any
|
|
33
39
|
export function Spinner(_props: SpinnerProps): any
|
|
34
40
|
export function Switch(_props: SwitchProps): any
|
|
41
|
+
export function Table(_props: TableProps): any
|
|
35
42
|
export function Tabs(_props: TabsProps): any
|
|
43
|
+
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
36
44
|
export function Timeline(_props: TimelineProps): any
|
|
37
45
|
export function TimelineItem(_props: TimelineItemProps): any
|
|
38
46
|
export function Toast(_props: ToastProps): any
|
package/astro.js
CHANGED
|
@@ -7,12 +7,16 @@ import CardComponent from './components/Card/Card.astro'
|
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.astro'
|
|
8
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
9
9
|
import IconComponent from './components/Icon/Icon.astro'
|
|
10
|
+
import InputComponent from './components/Input/Input.astro'
|
|
11
|
+
import MenuComponent from './components/Menu/Menu.astro'
|
|
10
12
|
import ProgressComponent from './components/Progress/Progress.astro'
|
|
11
13
|
import RadioComponent from './components/Radio/Radio.astro'
|
|
12
14
|
import RatingComponent from './components/Rating/Rating.astro'
|
|
13
15
|
import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
14
16
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
17
|
+
import TableComponent from './components/Table/Table.astro'
|
|
15
18
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
19
|
+
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.astro'
|
|
16
20
|
import TimelineComponent from './components/Timeline/Timeline.astro'
|
|
17
21
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
|
|
18
22
|
import ToastComponent from './components/Toast/Toast.astro'
|
|
@@ -26,12 +30,16 @@ export const Card = CardComponent
|
|
|
26
30
|
export const Checkbox = CheckboxComponent
|
|
27
31
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
28
32
|
export const Icon = IconComponent
|
|
33
|
+
export const Input = InputComponent
|
|
34
|
+
export const Menu = MenuComponent
|
|
29
35
|
export const Progress = ProgressComponent
|
|
30
36
|
export const Radio = RadioComponent
|
|
31
37
|
export const Rating = RatingComponent
|
|
32
38
|
export const Spinner = SpinnerComponent
|
|
33
39
|
export const Switch = SwitchComponent
|
|
40
|
+
export const Table = TableComponent
|
|
34
41
|
export const Tabs = TabsComponent
|
|
42
|
+
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
35
43
|
export const Timeline = TimelineComponent
|
|
36
44
|
export const TimelineItem = TimelineItemComponent
|
|
37
45
|
export const Toast = ToastComponent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { AccordionProps } from './accordion'
|
|
3
3
|
import ArrowDown from '../../icons/arrow-down.svg?raw'
|
|
4
|
-
import './accordion.scss'
|
|
4
|
+
import styles from './accordion.module.scss'
|
|
5
5
|
|
|
6
6
|
interface Props extends AccordionProps {}
|
|
7
7
|
|
|
@@ -10,15 +10,15 @@ const {
|
|
|
10
10
|
} = Astro.props
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
<ul class=
|
|
13
|
+
<ul class={styles.accordion} data-id="w-accordion">
|
|
14
14
|
{items.map((item: AccordionProps['items'][0]) => (
|
|
15
15
|
<li>
|
|
16
|
-
<
|
|
16
|
+
<button class={styles.title} data-toggle="true">
|
|
17
17
|
{item.title}
|
|
18
18
|
<Fragment set:html={ArrowDown} />
|
|
19
|
-
</
|
|
20
|
-
<div class=
|
|
21
|
-
<div class=
|
|
19
|
+
</button>
|
|
20
|
+
<div class={styles.wrapper}>
|
|
21
|
+
<div class={styles.content}>
|
|
22
22
|
<Fragment set:html={item.content} />
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
@@ -33,8 +33,10 @@ const {
|
|
|
33
33
|
element.addEventListener('click', event => {
|
|
34
34
|
const target = event.target as HTMLDivElement
|
|
35
35
|
|
|
36
|
-
if (target.
|
|
37
|
-
target.
|
|
36
|
+
if (target.dataset.toggle) {
|
|
37
|
+
target.dataset.open = target.dataset.open === 'true'
|
|
38
|
+
? 'false'
|
|
39
|
+
: 'true'
|
|
38
40
|
}
|
|
39
41
|
})
|
|
40
42
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AccordionProps } from './accordion'
|
|
3
3
|
import ArrowDown from '../../icons/arrow-down.svg?raw'
|
|
4
|
-
import './accordion.scss'
|
|
4
|
+
import styles from './accordion.module.scss'
|
|
5
5
|
|
|
6
6
|
export let items: AccordionProps['items']
|
|
7
7
|
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<ul class=
|
|
18
|
+
<ul class={styles.accordion}>
|
|
19
19
|
{#each items as item, index}
|
|
20
20
|
<li>
|
|
21
|
-
<
|
|
22
|
-
class=
|
|
23
|
-
|
|
21
|
+
<button
|
|
22
|
+
class={styles.title}
|
|
23
|
+
data-open={state[index]}
|
|
24
24
|
on:click={() => toggle(index)}
|
|
25
25
|
>
|
|
26
26
|
{item.title}
|
|
27
27
|
{@html ArrowDown}
|
|
28
|
-
</
|
|
29
|
-
<div class=
|
|
30
|
-
<div class=
|
|
28
|
+
</button>
|
|
29
|
+
<div class={styles.wrapper}>
|
|
30
|
+
<div class={styles.content}>
|
|
31
31
|
{@html item.content}
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import type { AccordionProps } from './accordion'
|
|
3
3
|
import ArrowDown from '../../icons/arrow-down.svg?raw'
|
|
4
|
-
import './accordion.scss'
|
|
4
|
+
import styles from './accordion.module.scss'
|
|
5
5
|
|
|
6
6
|
const Accordion = ({ items }: AccordionProps) => {
|
|
7
7
|
const [state, setState] = useState(Array(items.length).fill(false))
|
|
@@ -14,16 +14,17 @@ const Accordion = ({ items }: AccordionProps) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<ul className=
|
|
17
|
+
<ul className={styles.accordion}>
|
|
18
18
|
{items.map((item, index) => (
|
|
19
19
|
<li key={index}>
|
|
20
|
-
<
|
|
21
|
-
className={
|
|
20
|
+
<button
|
|
21
|
+
className={styles.title}
|
|
22
|
+
data-open={state[index]}
|
|
22
23
|
onClick={() => toggle(index)}
|
|
23
24
|
dangerouslySetInnerHTML={{ __html: `${item.title} ${ArrowDown}` }}
|
|
24
25
|
/>
|
|
25
|
-
<div className=
|
|
26
|
-
<div className=
|
|
26
|
+
<div className={styles.wrapper}>
|
|
27
|
+
<div className={styles.content}>
|
|
27
28
|
<div dangerouslySetInnerHTML={{ __html: item.content }} />
|
|
28
29
|
</div>
|
|
29
30
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
@import '../../scss/config.scss';
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.accordion {
|
|
4
4
|
margin: 0;
|
|
5
5
|
padding: 0;
|
|
6
6
|
list-style-type: none;
|
|
7
7
|
|
|
8
8
|
li {
|
|
9
|
-
border-bottom: 1px solid
|
|
9
|
+
border-bottom: 1px solid var(--w-color-primary-50);
|
|
10
10
|
padding: 10px 0;
|
|
11
11
|
font-size: 16px;
|
|
12
12
|
|
|
@@ -19,45 +19,53 @@
|
|
|
19
19
|
padding-bottom: 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.title {
|
|
23
23
|
display: flex;
|
|
24
24
|
justify-content: space-between;
|
|
25
25
|
align-items: center;
|
|
26
|
+
gap: 10px;
|
|
27
|
+
width: 100%;
|
|
28
|
+
background: transparent;
|
|
29
|
+
border: 0;
|
|
30
|
+
color: var(--w-color-primary);
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
padding: 0;
|
|
26
33
|
cursor: pointer;
|
|
34
|
+
text-align: left;
|
|
27
35
|
|
|
28
36
|
svg {
|
|
29
37
|
@include Transition(transform);
|
|
30
|
-
color:
|
|
38
|
+
color: var(--w-color-primary-20);
|
|
31
39
|
width: 15px;
|
|
32
40
|
height: 15px;
|
|
33
41
|
pointer-events: none;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
&[data-open="true"] {
|
|
37
45
|
svg {
|
|
38
46
|
transform: rotate(180deg);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
+ .
|
|
49
|
+
+ .wrapper {
|
|
42
50
|
grid-template-rows: 1fr;
|
|
43
51
|
|
|
44
|
-
.
|
|
52
|
+
.content {
|
|
45
53
|
padding: 10px 0;
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
|
|
51
|
-
.
|
|
59
|
+
.wrapper {
|
|
52
60
|
@include Transition(grid-template-rows);
|
|
53
61
|
display: grid;
|
|
54
62
|
grid-template-rows: 0fr;
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
.
|
|
65
|
+
.content {
|
|
58
66
|
@include Transition();
|
|
59
67
|
overflow: hidden;
|
|
60
|
-
color:
|
|
68
|
+
color: var(--w-color-primary-20);
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
}
|
|
@@ -7,7 +7,7 @@ import success from '../../icons/circle-check.svg?raw'
|
|
|
7
7
|
import warning from '../../icons/warning.svg?raw'
|
|
8
8
|
import alert from '../../icons/alert.svg?raw'
|
|
9
9
|
|
|
10
|
-
import './alert.scss'
|
|
10
|
+
import styles from './alert.module.scss'
|
|
11
11
|
|
|
12
12
|
interface Props extends AlertProps {}
|
|
13
13
|
|
|
@@ -22,6 +22,8 @@ const {
|
|
|
22
22
|
element = 'section',
|
|
23
23
|
title,
|
|
24
24
|
titleTag = 'strong',
|
|
25
|
+
titleProps,
|
|
26
|
+
bodyProps,
|
|
25
27
|
className,
|
|
26
28
|
theme,
|
|
27
29
|
...rest
|
|
@@ -32,9 +34,9 @@ const Title = titleTag
|
|
|
32
34
|
const hasCustomIcon = Astro.slots.has('icon')
|
|
33
35
|
|
|
34
36
|
const classes = [
|
|
35
|
-
'w-alert',
|
|
36
|
-
(!hasCustomIcon && !theme) &&
|
|
37
|
-
theme,
|
|
37
|
+
styles['w-alert'],
|
|
38
|
+
(!hasCustomIcon && !theme) && styles.col,
|
|
39
|
+
theme && styles[theme],
|
|
38
40
|
className
|
|
39
41
|
].filter(Boolean).join(' ')
|
|
40
42
|
|
|
@@ -49,13 +51,15 @@ const props = {
|
|
|
49
51
|
{!hasCustomIcon && theme && <Fragment set:html={iconMap[theme]} />}
|
|
50
52
|
|
|
51
53
|
<ConditionalWrapper condition={!!(hasCustomIcon || theme)}>
|
|
52
|
-
<div class=
|
|
54
|
+
<div class={styles.wrapper} slot="wrapper">
|
|
53
55
|
children
|
|
54
56
|
</div>
|
|
55
57
|
{title && (
|
|
56
|
-
<Title class:list=
|
|
58
|
+
<Title class:list={styles.title} {...titleProps}>
|
|
59
|
+
{title}
|
|
60
|
+
</Title>
|
|
57
61
|
)}
|
|
58
|
-
<div class=
|
|
62
|
+
<div class={styles.body} {...bodyProps}>
|
|
59
63
|
<slot />
|
|
60
64
|
</div>
|
|
61
65
|
</ConditionalWrapper>
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
import warning from '../../icons/warning.svg?raw'
|
|
8
8
|
import alert from '../../icons/alert.svg?raw'
|
|
9
9
|
|
|
10
|
-
import './alert.scss'
|
|
10
|
+
import styles from './alert.module.scss'
|
|
11
11
|
|
|
12
12
|
export let element: AlertProps['element'] = 'section'
|
|
13
13
|
export let title: AlertProps['title'] = null
|
|
14
14
|
export let titleTag: AlertProps['title'] = 'strong'
|
|
15
|
+
export let titleProps: AlertProps['titleProps'] = null
|
|
16
|
+
export let bodyProps: AlertProps['bodyProps'] = null
|
|
15
17
|
export let className: AlertProps['className'] = null
|
|
16
18
|
export let theme: AlertProps['theme'] = null
|
|
17
19
|
|
|
@@ -25,9 +27,9 @@
|
|
|
25
27
|
const hasCustomIcon = $$slots.icon
|
|
26
28
|
|
|
27
29
|
const classes = [
|
|
28
|
-
'w-alert',
|
|
29
|
-
(!hasCustomIcon && !theme) &&
|
|
30
|
-
theme,
|
|
30
|
+
styles['w-alert'],
|
|
31
|
+
(!hasCustomIcon && !theme) && styles.col,
|
|
32
|
+
theme && styles[theme],
|
|
31
33
|
className
|
|
32
34
|
].filter(Boolean).join(' ')
|
|
33
35
|
</script>
|
|
@@ -42,14 +44,14 @@
|
|
|
42
44
|
<ConditionalWrapper
|
|
43
45
|
condition={!!(hasCustomIcon || theme)}
|
|
44
46
|
element="div"
|
|
45
|
-
class=
|
|
47
|
+
class={styles.wrapper}
|
|
46
48
|
>
|
|
47
49
|
{#if title}
|
|
48
|
-
<svelte:element this={titleTag} class=
|
|
50
|
+
<svelte:element this={titleTag} class={styles.title} {...titleProps}>
|
|
49
51
|
{title}
|
|
50
52
|
</svelte:element>
|
|
51
53
|
{/if}
|
|
52
|
-
<div class=
|
|
54
|
+
<div class={styles.body} {...bodyProps}>
|
|
53
55
|
<slot />
|
|
54
56
|
</div>
|
|
55
57
|
</ConditionalWrapper>
|
|
@@ -7,7 +7,7 @@ import success from '../../icons/circle-check.svg?raw'
|
|
|
7
7
|
import warning from '../../icons/warning.svg?raw'
|
|
8
8
|
import alert from '../../icons/alert.svg?raw'
|
|
9
9
|
|
|
10
|
-
import './alert.scss'
|
|
10
|
+
import styles from './alert.module.scss'
|
|
11
11
|
|
|
12
12
|
const iconMap = {
|
|
13
13
|
info,
|
|
@@ -20,6 +20,8 @@ const Alert = ({
|
|
|
20
20
|
Element = 'section',
|
|
21
21
|
title,
|
|
22
22
|
TitleTag = 'strong',
|
|
23
|
+
titleProps,
|
|
24
|
+
bodyProps,
|
|
23
25
|
className,
|
|
24
26
|
theme,
|
|
25
27
|
children,
|
|
@@ -27,9 +29,9 @@ const Alert = ({
|
|
|
27
29
|
...rest
|
|
28
30
|
}: ReactAlertProps) => {
|
|
29
31
|
const classes = [
|
|
30
|
-
'w-alert',
|
|
31
|
-
(!icon && !theme) &&
|
|
32
|
-
theme,
|
|
32
|
+
styles['w-alert'],
|
|
33
|
+
(!icon && !theme) && styles.col,
|
|
34
|
+
theme && styles[theme],
|
|
33
35
|
className
|
|
34
36
|
].filter(Boolean).join(' ')
|
|
35
37
|
|
|
@@ -39,14 +41,16 @@ const Alert = ({
|
|
|
39
41
|
{!icon && theme && <div dangerouslySetInnerHTML={{ __html: iconMap[theme] }} />}
|
|
40
42
|
|
|
41
43
|
<ConditionalWrapper condition={!!(icon || theme)} wrapper={children => (
|
|
42
|
-
<div className=
|
|
44
|
+
<div className={styles.wrapper}>
|
|
43
45
|
{children}
|
|
44
46
|
</div>
|
|
45
47
|
)}>
|
|
46
48
|
{title && (
|
|
47
|
-
<TitleTag className=
|
|
49
|
+
<TitleTag className={styles.title} {...titleProps}>
|
|
50
|
+
{title}
|
|
51
|
+
</TitleTag>
|
|
48
52
|
)}
|
|
49
|
-
<div className=
|
|
53
|
+
<div className={styles.body} {...bodyProps}>
|
|
50
54
|
{children}
|
|
51
55
|
</div>
|
|
52
56
|
</ConditionalWrapper>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-alert {
|
|
4
|
+
border: 1px solid var(--w-color-primary-50);
|
|
5
|
+
border-radius: 5px;
|
|
6
|
+
padding: 15px;
|
|
7
|
+
display: flex;
|
|
8
|
+
|
|
9
|
+
&.col {
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:not(.col) {
|
|
14
|
+
gap: 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.info {
|
|
18
|
+
border: 1px solid var(--w-color-info);
|
|
19
|
+
color: var(--w-color-info);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.success {
|
|
23
|
+
border: 1px solid var(--w-color-success);
|
|
24
|
+
color: var(--w-color-success);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.warning {
|
|
28
|
+
border: 1px solid var(--w-color-warning);
|
|
29
|
+
color: var(--w-color-warning);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.alert {
|
|
33
|
+
border: 1px solid var(--w-color-alert);
|
|
34
|
+
color: var(--w-color-alert);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
svg {
|
|
38
|
+
width: 20px;
|
|
39
|
+
height: 20px;
|
|
40
|
+
min-width: 20px;
|
|
41
|
+
margin-top: 1px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title {
|
|
45
|
+
display: block;
|
|
46
|
+
margin-bottom: 5px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.body {
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
color: var(--w-color-primary-20);
|
|
52
|
+
line-height: 1.5;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -2,7 +2,8 @@ export type AlertProps = {
|
|
|
2
2
|
element?: string
|
|
3
3
|
title?: string | null
|
|
4
4
|
titleTag?: string
|
|
5
|
-
|
|
5
|
+
titleProps?: any
|
|
6
|
+
bodyProps?: any
|
|
6
7
|
className?: string | null
|
|
7
8
|
theme?: 'info'
|
|
8
9
|
| 'success'
|
|
@@ -14,5 +15,6 @@ export type AlertProps = {
|
|
|
14
15
|
export type ReactAlertProps = {
|
|
15
16
|
Element?: keyof JSX.IntrinsicElements
|
|
16
17
|
TitleTag?: keyof JSX.IntrinsicElements
|
|
18
|
+
icon?: React.ReactNode
|
|
17
19
|
children: React.ReactNode
|
|
18
20
|
} & Omit<AlertProps, 'titleTag' | 'element'>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
|
-
import './avatar.scss'
|
|
3
|
+
import styles from './avatar.module.scss'
|
|
4
4
|
|
|
5
5
|
interface Props extends AvatarProps {}
|
|
6
6
|
|
|
@@ -16,14 +16,14 @@ const {
|
|
|
16
16
|
} = Astro.props
|
|
17
17
|
|
|
18
18
|
const classes = [
|
|
19
|
-
|
|
20
|
-
borderless &&
|
|
19
|
+
styles.avatar,
|
|
20
|
+
borderless && styles.borderless,
|
|
21
21
|
className
|
|
22
22
|
]
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
{Array.isArray(img) ? (
|
|
26
|
-
<div class:list={[
|
|
26
|
+
<div class:list={[styles.group, reverse && styles.reverse]}
|
|
27
27
|
style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
|
|
28
28
|
>
|
|
29
29
|
{img.map((img, index) => (
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './avatar.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
export let img: AvatarProps['img'] = ''
|
|
6
8
|
export let alt: AvatarProps['alt'] = 'Avatar'
|
|
@@ -11,16 +13,20 @@
|
|
|
11
13
|
export let reverse: AvatarProps['reverse'] = false
|
|
12
14
|
export let className: AvatarProps['className'] = ''
|
|
13
15
|
|
|
14
|
-
const classes = [
|
|
15
|
-
|
|
16
|
-
borderless &&
|
|
16
|
+
const classes = classNames([
|
|
17
|
+
styles.avatar,
|
|
18
|
+
borderless && styles.borderless,
|
|
17
19
|
className
|
|
18
|
-
]
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
const groupStyles = classNames([
|
|
23
|
+
styles.group,
|
|
24
|
+
reverse && styles.reverse
|
|
25
|
+
])
|
|
19
26
|
</script>
|
|
20
27
|
|
|
21
28
|
{#if Array.isArray(img)}
|
|
22
|
-
<div class=
|
|
23
|
-
class:reverse
|
|
29
|
+
<div class={groupStyles}
|
|
24
30
|
style={borderColor ? `--w-avatar-border: ${borderColor};` : null}
|
|
25
31
|
>
|
|
26
32
|
{#each img as img, index}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { AvatarProps } from './avatar'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './avatar.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
const Avatar = ({
|
|
6
8
|
img,
|
|
@@ -12,16 +14,16 @@ const Avatar = ({
|
|
|
12
14
|
reverse,
|
|
13
15
|
className,
|
|
14
16
|
}: AvatarProps) => {
|
|
15
|
-
const classes = [
|
|
16
|
-
|
|
17
|
-
borderless &&
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.avatar,
|
|
19
|
+
borderless && styles.borderless,
|
|
18
20
|
className
|
|
19
|
-
]
|
|
21
|
+
])
|
|
20
22
|
|
|
21
|
-
const groupStyles = [
|
|
22
|
-
|
|
23
|
-
reverse &&
|
|
24
|
-
]
|
|
23
|
+
const groupStyles = classNames([
|
|
24
|
+
styles.group,
|
|
25
|
+
reverse && styles.reverse
|
|
26
|
+
])
|
|
25
27
|
|
|
26
28
|
const borderColorStyle = borderColor
|
|
27
29
|
? { '--w-avatar-border': borderColor } as React.CSSProperties
|