webcoreui 0.0.11 → 0.1.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 +42 -11
- package/astro.d.ts +4 -0
- package/astro.js +4 -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.module.scss +65 -0
- 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 +51 -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} +11 -8
- 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 +86 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +9 -7
- package/components/Button/Button.svelte +13 -11
- package/components/Button/Button.tsx +10 -8
- package/components/Button/button.module.scss +87 -0
- package/components/Button/button.ts +6 -2
- 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 +38 -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.module.scss +70 -0
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.astro +2 -2
- 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 -52
- package/components/Input/Input.svelte +52 -52
- package/components/Input/Input.tsx +59 -59
- package/components/Input/input.module.scss +79 -0
- package/components/Input/input.ts +8 -2
- 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 +141 -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.module.scss +70 -0
- 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.module.scss +84 -0
- 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.module.scss +45 -0
- 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} +50 -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.module.scss +82 -0
- package/components/Switch/switch.ts +8 -4
- package/components/Table/Table.astro +60 -60
- package/components/Table/Table.svelte +56 -54
- package/components/Table/Table.tsx +64 -63
- package/components/Table/{table.scss → table.module.scss} +60 -65
- package/components/Tabs/Tabs.astro +76 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/tabs.module.scss +125 -0
- 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 +76 -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} +76 -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.module.scss +29 -0
- 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.module.scss +40 -0
- package/components/Toast/toast.ts +8 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/icons.d.ts +11 -0
- package/icons.js +9 -0
- package/index.js +3 -0
- package/package.json +5 -1
- package/react.d.ts +4 -0
- package/react.js +4 -0
- package/scss/config/color-palette.scss +23 -0
- package/scss/config/css-values.scss +44 -0
- package/scss/config/layout.scss +41 -0
- package/scss/config/mixins.scss +395 -9
- package/scss/config/typography.scss +66 -0
- package/scss/config.scss +6 -1
- package/scss/global/elements.scss +22 -2
- package/scss/global/scrollbar.scss +24 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +47 -39
- package/scss/global/utility.scss +33 -4
- package/scss/global.scss +2 -1
- package/scss/resets.scss +64 -11
- package/scss/setup.scss +25 -31
- package/svelte.d.ts +16 -12
- package/svelte.js +4 -0
- package/utils/classNames.ts +4 -0
- package/utils/cookies.ts +28 -0
- package/utils/event.ts +17 -0
- package/utils/toast.ts +15 -11
- package/components/Accordion/accordion.scss +0 -63
- 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/components/Checkbox/checkbox.scss +0 -85
- package/components/Input/input.scss +0 -83
- package/components/Progress/progress.scss +0 -66
- package/components/Radio/radio.scss +0 -92
- package/components/Rating/rating.scss +0 -37
- package/components/Switch/switch.scss +0 -84
- package/components/Tabs/tabs.scss +0 -134
- package/components/TimelineItem/timelineitem.scss +0 -31
- package/components/Toast/toast.scss +0 -43
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
|
|
|
@@ -79,11 +79,11 @@ yarn add webcoreui
|
|
|
79
79
|
|
|
80
80
|
### Setup
|
|
81
81
|
|
|
82
|
-
Setup default styles and fonts by calling the following in your global SCSS file:
|
|
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:
|
|
83
83
|
|
|
84
84
|
```scss
|
|
85
85
|
@import 'webcoreui/styles';
|
|
86
|
-
@include
|
|
86
|
+
@include setup((
|
|
87
87
|
// Define paths for your fonts
|
|
88
88
|
fontRegular: '/fonts/Inter-Regular.woff2',
|
|
89
89
|
fontBold: '/fonts/Inter-Bold.woff2'
|
|
@@ -100,16 +100,45 @@ The `Setup` mixin can also accept the following options:
|
|
|
100
100
|
|-----------|---------------|---------|
|
|
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
|
+
| `includeTooltip` | `true` | Adds styles for using tooltips.
|
|
104
|
+
| `includeScrollbarStyles` | `true` | Adds styles for scrollbars.
|
|
104
105
|
|
|
105
|
-
Default component styles can
|
|
106
|
+
Default component styles can be changed by overriding the following CSS variables:
|
|
106
107
|
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
--w-avatar-border:
|
|
110
|
-
--w-
|
|
111
|
-
--w-
|
|
108
|
+
```scss
|
|
109
|
+
html body {
|
|
110
|
+
--w-avatar-border: var(--w-color-primary-70);
|
|
111
|
+
--w-checkbox-color: var(--w-color-primary);
|
|
112
|
+
--w-progress-color: var(--w-color-primary);
|
|
113
|
+
--w-progress-background: var(--w-color-primary-50);
|
|
114
|
+
--w-progress-stripe-light: var(--w-color-primary);
|
|
115
|
+
--w-progress-stripe-dark: var(--w-color-primary-10);
|
|
116
|
+
--w-radio-color: var(--w-color-primary);
|
|
117
|
+
--w-rating-color: var(--w-color-primary);
|
|
118
|
+
--w-rating-empty-color: var(--w-color-primary);
|
|
119
|
+
--w-rating-empty-background: var(--w-color-primary-70);
|
|
112
120
|
--w-rating-size: 18px;
|
|
121
|
+
--w-scrollbar-bg: var(--w-color-primary-60);
|
|
122
|
+
--w-scrollbar-fg: var(--w-color-primary-50);
|
|
123
|
+
--w-spinner-color: var(--w-color-primary);
|
|
124
|
+
--w-spinner-width: 2px;
|
|
125
|
+
--w-spinner-speed: 2s;
|
|
126
|
+
--w-spinner-size: 30px;
|
|
127
|
+
--w-spinner-dash: 8;
|
|
128
|
+
--w-switch-off-color: var(--w-color-primary-50);
|
|
129
|
+
--w-switch-on-color: var(--w-color-primary);
|
|
130
|
+
--w-theme-switcher-size: 20px;
|
|
131
|
+
--w-timeline-color: var(--w-color-primary-50);
|
|
132
|
+
--w-timeline-text-color: var(--w-color-primary);
|
|
133
|
+
--w-timeline-counter: decimal;
|
|
134
|
+
--w-tooltip-background: var(--w-color-primary);
|
|
135
|
+
--w-tooltip-color: var(--w-color-primary-70);
|
|
136
|
+
|
|
137
|
+
// Override border-radius
|
|
138
|
+
--w-sm-radius: 2px;
|
|
139
|
+
--w-md-radius: 5px;
|
|
140
|
+
--w-lg-radius: 10px;
|
|
141
|
+
--w-xl-radius: 15px;
|
|
113
142
|
}
|
|
114
143
|
```
|
|
115
144
|
|
|
@@ -145,6 +174,7 @@ import { Accordion } from 'webcoreui/react'
|
|
|
145
174
|
- [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
|
|
146
175
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
147
176
|
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
177
|
+
- [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
|
|
148
178
|
- [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
|
|
149
179
|
- [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
|
|
150
180
|
- [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
|
|
@@ -152,6 +182,7 @@ import { Accordion } from 'webcoreui/react'
|
|
|
152
182
|
- [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
|
|
153
183
|
- [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
|
|
154
184
|
- [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
|
|
185
|
+
- [ThemeSwitcher](https://github.com/Frontendland/webcoreui/tree/main/src/components/ThemeSwitcher)
|
|
155
186
|
- [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
|
|
156
187
|
- [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
|
|
157
188
|
- [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
|
package/astro.d.ts
CHANGED
|
@@ -8,6 +8,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
10
|
import type { InputProps } from './components/Input/input'
|
|
11
|
+
import type { MenuProps } from './components/Menu/menu'
|
|
11
12
|
import type { ProgressProps } from './components/Progress/progress'
|
|
12
13
|
import type { RadioProps } from './components/Radio/radio'
|
|
13
14
|
import type { RatingProps } from './components/Rating/rating'
|
|
@@ -15,6 +16,7 @@ import type { SpinnerProps } from './components/Spinner/spinner'
|
|
|
15
16
|
import type { SwitchProps } from './components/Switch/switch'
|
|
16
17
|
import type { TableProps } from './components/Table/table'
|
|
17
18
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
19
|
+
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
18
20
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
19
21
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
20
22
|
import type { ToastProps } from './components/Toast/toast'
|
|
@@ -30,6 +32,7 @@ declare module 'webcoreui/astro' {
|
|
|
30
32
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
31
33
|
export function Icon(_props: IconProps): any
|
|
32
34
|
export function Input(_props: InputProps): any
|
|
35
|
+
export function Menu(_props: MenuProps): any
|
|
33
36
|
export function Progress(_props: ProgressProps): any
|
|
34
37
|
export function Radio(_props: RadioProps): any
|
|
35
38
|
export function Rating(_props: RatingProps): any
|
|
@@ -37,6 +40,7 @@ declare module 'webcoreui/astro' {
|
|
|
37
40
|
export function Switch(_props: SwitchProps): any
|
|
38
41
|
export function Table(_props: TableProps): any
|
|
39
42
|
export function Tabs(_props: TabsProps): any
|
|
43
|
+
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
40
44
|
export function Timeline(_props: TimelineProps): any
|
|
41
45
|
export function TimelineItem(_props: TimelineItemProps): any
|
|
42
46
|
export function Toast(_props: ToastProps): any
|
package/astro.js
CHANGED
|
@@ -8,6 +8,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
10
|
import InputComponent from './components/Input/Input.astro'
|
|
11
|
+
import MenuComponent from './components/Menu/Menu.astro'
|
|
11
12
|
import ProgressComponent from './components/Progress/Progress.astro'
|
|
12
13
|
import RadioComponent from './components/Radio/Radio.astro'
|
|
13
14
|
import RatingComponent from './components/Rating/Rating.astro'
|
|
@@ -15,6 +16,7 @@ import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
|
15
16
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
16
17
|
import TableComponent from './components/Table/Table.astro'
|
|
17
18
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
19
|
+
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.astro'
|
|
18
20
|
import TimelineComponent from './components/Timeline/Timeline.astro'
|
|
19
21
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
|
|
20
22
|
import ToastComponent from './components/Toast/Toast.astro'
|
|
@@ -29,6 +31,7 @@ export const Checkbox = CheckboxComponent
|
|
|
29
31
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
30
32
|
export const Icon = IconComponent
|
|
31
33
|
export const Input = InputComponent
|
|
34
|
+
export const Menu = MenuComponent
|
|
32
35
|
export const Progress = ProgressComponent
|
|
33
36
|
export const Radio = RadioComponent
|
|
34
37
|
export const Rating = RatingComponent
|
|
@@ -36,6 +39,7 @@ export const Spinner = SpinnerComponent
|
|
|
36
39
|
export const Switch = SwitchComponent
|
|
37
40
|
export const Table = TableComponent
|
|
38
41
|
export const Tabs = TabsComponent
|
|
42
|
+
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
39
43
|
export const Timeline = TimelineComponent
|
|
40
44
|
export const TimelineItem = TimelineItemComponent
|
|
41
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>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
.accordion {
|
|
4
|
+
@include spacing(0);
|
|
5
|
+
list-style-type: none;
|
|
6
|
+
|
|
7
|
+
li {
|
|
8
|
+
@include border(primary-50, bottom);
|
|
9
|
+
@include spacing(py-sm, px-none, m0);
|
|
10
|
+
@include typography(md);
|
|
11
|
+
|
|
12
|
+
&:first-child {
|
|
13
|
+
padding-top: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:last-child {
|
|
17
|
+
@include border(bottom, 0);
|
|
18
|
+
padding-bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title {
|
|
22
|
+
@include layout(flex, h-between, v-center, sm);
|
|
23
|
+
@include typography(md, primary, left);
|
|
24
|
+
@include size('w100%');
|
|
25
|
+
@include spacing(p0);
|
|
26
|
+
@include border(0);
|
|
27
|
+
|
|
28
|
+
background: transparent;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
svg {
|
|
32
|
+
@include transition(transform);
|
|
33
|
+
@include size(15px);
|
|
34
|
+
@include typography(primary-20);
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&[data-open="true"] {
|
|
39
|
+
svg {
|
|
40
|
+
transform: rotate(180deg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+ .wrapper {
|
|
44
|
+
grid-template-rows: 1fr;
|
|
45
|
+
|
|
46
|
+
.content {
|
|
47
|
+
@include spacing(py-sm, px-none);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.wrapper {
|
|
54
|
+
@include transition(grid-template-rows);
|
|
55
|
+
@include layout(grid);
|
|
56
|
+
grid-template-rows: 0fr;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.content {
|
|
60
|
+
@include transition();
|
|
61
|
+
@include visibility(hidden);
|
|
62
|
+
@include typography(primary-20);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -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,51 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
.w-alert {
|
|
4
|
+
@include border(primary-50);
|
|
5
|
+
@include border-radius(md);
|
|
6
|
+
@include spacing(p-md);
|
|
7
|
+
@include layout(flex);
|
|
8
|
+
|
|
9
|
+
&.col {
|
|
10
|
+
@include layout(column);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:not(.col) {
|
|
14
|
+
@include layout(sm);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.info {
|
|
18
|
+
@include border(info);
|
|
19
|
+
@include typography(info);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.success {
|
|
23
|
+
@include border(success);
|
|
24
|
+
@include typography(success);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.warning {
|
|
28
|
+
@include border(warning);
|
|
29
|
+
@include typography(warning);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.alert {
|
|
33
|
+
@include border(alert);
|
|
34
|
+
@include typography(alert);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
svg {
|
|
38
|
+
@include size(20px);
|
|
39
|
+
min-width: 20px;
|
|
40
|
+
margin-top: 1px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.title {
|
|
44
|
+
@include spacing(mb-xs);
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.body {
|
|
49
|
+
@include typography(primary-20, md, hmd);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -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
|