webcoreui 0.2.0 → 0.3.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 +8 -0
- package/astro.d.ts +8 -0
- package/astro.js +8 -0
- package/components/Alert/Alert.tsx +4 -1
- package/components/Avatar/avatar.module.scss +2 -0
- package/components/Collapsible/Collapsible.astro +63 -0
- package/components/Collapsible/Collapsible.svelte +48 -0
- package/components/Collapsible/Collapsible.tsx +54 -0
- package/components/Collapsible/collapsible.module.scss +29 -0
- package/components/Collapsible/collapsible.ts +14 -0
- package/components/Modal/modal.module.scss +1 -1
- package/components/Popover/Popover.astro +23 -0
- package/components/Popover/Popover.svelte +21 -0
- package/components/Popover/Popover.tsx +27 -0
- package/components/Popover/popover.module.scss +51 -0
- package/components/Popover/popover.ts +8 -0
- package/components/Sheet/Sheet.astro +29 -0
- package/components/Sheet/Sheet.svelte +24 -0
- package/components/Sheet/Sheet.tsx +32 -0
- package/components/Sheet/sheet.module.scss +68 -0
- package/components/Sheet/sheet.ts +10 -0
- package/components/Textarea/Textarea.astro +44 -0
- package/components/Textarea/Textarea.svelte +45 -0
- package/components/Textarea/Textarea.tsx +50 -0
- package/components/Textarea/textarea.module.scss +36 -0
- package/components/Textarea/textarea.ts +18 -0
- package/components/Toast/Toast.svelte +11 -6
- package/index.d.ts +69 -0
- package/index.js +2 -0
- package/package.json +2 -1
- package/react.d.ts +8 -0
- package/react.js +8 -0
- package/svelte.d.ts +8 -0
- package/svelte.js +8 -0
- package/utils/debounce.ts +24 -0
- package/utils/popover.ts +201 -0
- package/utils/toast.ts +0 -6
package/README.md
CHANGED
|
@@ -113,6 +113,10 @@ html body {
|
|
|
113
113
|
// Checkbox component
|
|
114
114
|
--w-checkbox-color: var(--w-color-primary);
|
|
115
115
|
|
|
116
|
+
// Collapsible
|
|
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,23 @@ 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)
|
|
201
206
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
202
207
|
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
203
208
|
- [Menu](https://github.com/Frontendland/webcoreui/tree/main/src/components/Menu)
|
|
204
209
|
- [Modal](https://github.com/Frontendland/webcoreui/tree/main/src/components/Modal)
|
|
210
|
+
- [Popover](https://github.com/Frontendland/webcoreui/tree/main/src/components/Popover)
|
|
205
211
|
- [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
|
|
206
212
|
- [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
|
|
207
213
|
- [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
|
|
214
|
+
- [Sheet](https://github.com/Frontendland/webcoreui/tree/main/src/components/Sheet)
|
|
208
215
|
- [Slider](https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider)
|
|
209
216
|
- [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
|
|
210
217
|
- [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
|
|
211
218
|
- [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
|
|
212
219
|
- [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
|
|
220
|
+
- [Textarea](https://github.com/Frontendland/webcoreui/tree/main/src/components/Textarea)
|
|
213
221
|
- [ThemeSwitcher](https://github.com/Frontendland/webcoreui/tree/main/src/components/ThemeSwitcher)
|
|
214
222
|
- [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
|
|
215
223
|
- [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
|
package/astro.d.ts
CHANGED
|
@@ -5,19 +5,23 @@ 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'
|
|
9
10
|
import type { IconProps } from './components/Icon/icon'
|
|
10
11
|
import type { InputProps } from './components/Input/input'
|
|
11
12
|
import type { MenuProps } from './components/Menu/menu'
|
|
12
13
|
import type { ModalProps } from './components/Modal/modal'
|
|
14
|
+
import type { PopoverProps } from './components/Popover/popover'
|
|
13
15
|
import type { ProgressProps } from './components/Progress/progress'
|
|
14
16
|
import type { RadioProps } from './components/Radio/radio'
|
|
15
17
|
import type { RatingProps } from './components/Rating/rating'
|
|
18
|
+
import type { SheetProps } from './components/Sheet/sheet'
|
|
16
19
|
import type { SliderProps } from './components/Slider/slider'
|
|
17
20
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
18
21
|
import type { SwitchProps } from './components/Switch/switch'
|
|
19
22
|
import type { TableProps } from './components/Table/table'
|
|
20
23
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
24
|
+
import type { TextareaProps } from './components/Textarea/textarea'
|
|
21
25
|
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
22
26
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
23
27
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
@@ -31,19 +35,23 @@ declare module 'webcoreui/astro' {
|
|
|
31
35
|
export function Button(_props: ButtonProps): any
|
|
32
36
|
export function Card(_props: CardProps): any
|
|
33
37
|
export function Checkbox(_props: CheckboxProps): any
|
|
38
|
+
export function Collapsible(_props: CollapsibleProps): any
|
|
34
39
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
35
40
|
export function Icon(_props: IconProps): any
|
|
36
41
|
export function Input(_props: InputProps): any
|
|
37
42
|
export function Menu(_props: MenuProps): any
|
|
38
43
|
export function Modal(_props: ModalProps): any
|
|
44
|
+
export function Popover(_props: PopoverProps): any
|
|
39
45
|
export function Progress(_props: ProgressProps): any
|
|
40
46
|
export function Radio(_props: RadioProps): any
|
|
41
47
|
export function Rating(_props: RatingProps): any
|
|
48
|
+
export function Sheet(_props: SheetProps): any
|
|
42
49
|
export function Slider(_props: SliderProps): any
|
|
43
50
|
export function Spinner(_props: SpinnerProps): any
|
|
44
51
|
export function Switch(_props: SwitchProps): any
|
|
45
52
|
export function Table(_props: TableProps): any
|
|
46
53
|
export function Tabs(_props: TabsProps): any
|
|
54
|
+
export function Textarea(_props: TextareaProps): any
|
|
47
55
|
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
48
56
|
export function Timeline(_props: TimelineProps): any
|
|
49
57
|
export function TimelineItem(_props: TimelineItemProps): any
|
package/astro.js
CHANGED
|
@@ -5,19 +5,23 @@ 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'
|
|
9
10
|
import IconComponent from './components/Icon/Icon.astro'
|
|
10
11
|
import InputComponent from './components/Input/Input.astro'
|
|
11
12
|
import MenuComponent from './components/Menu/Menu.astro'
|
|
12
13
|
import ModalComponent from './components/Modal/Modal.astro'
|
|
14
|
+
import PopoverComponent from './components/Popover/Popover.astro'
|
|
13
15
|
import ProgressComponent from './components/Progress/Progress.astro'
|
|
14
16
|
import RadioComponent from './components/Radio/Radio.astro'
|
|
15
17
|
import RatingComponent from './components/Rating/Rating.astro'
|
|
18
|
+
import SheetComponent from './components/Sheet/Sheet.astro'
|
|
16
19
|
import SliderComponent from './components/Slider/Slider.astro'
|
|
17
20
|
import SpinnerComponent from './components/Spinner/Spinner.astro'
|
|
18
21
|
import SwitchComponent from './components/Switch/Switch.astro'
|
|
19
22
|
import TableComponent from './components/Table/Table.astro'
|
|
20
23
|
import TabsComponent from './components/Tabs/Tabs.astro'
|
|
24
|
+
import TextareaComponent from './components/Textarea/Textarea.astro'
|
|
21
25
|
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.astro'
|
|
22
26
|
import TimelineComponent from './components/Timeline/Timeline.astro'
|
|
23
27
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
|
|
@@ -30,19 +34,23 @@ export const Badge = BadgeComponent
|
|
|
30
34
|
export const Button = ButtonComponent
|
|
31
35
|
export const Card = CardComponent
|
|
32
36
|
export const Checkbox = CheckboxComponent
|
|
37
|
+
export const Collapsible = CollapsibleComponent
|
|
33
38
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
34
39
|
export const Icon = IconComponent
|
|
35
40
|
export const Input = InputComponent
|
|
36
41
|
export const Menu = MenuComponent
|
|
37
42
|
export const Modal = ModalComponent
|
|
43
|
+
export const Popover = PopoverComponent
|
|
38
44
|
export const Progress = ProgressComponent
|
|
39
45
|
export const Radio = RadioComponent
|
|
40
46
|
export const Rating = RatingComponent
|
|
47
|
+
export const Sheet = SheetComponent
|
|
41
48
|
export const Slider = SliderComponent
|
|
42
49
|
export const Spinner = SpinnerComponent
|
|
43
50
|
export const Switch = SwitchComponent
|
|
44
51
|
export const Table = TableComponent
|
|
45
52
|
export const Tabs = TabsComponent
|
|
53
|
+
export const Textarea = TextareaComponent
|
|
46
54
|
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
47
55
|
export const Timeline = TimelineComponent
|
|
48
56
|
export const TimelineItem = TimelineItemComponent
|
|
@@ -38,7 +38,10 @@ const Alert = ({
|
|
|
38
38
|
return (
|
|
39
39
|
<Element className={classes} {...rest}>
|
|
40
40
|
{icon && icon}
|
|
41
|
-
{!icon && theme && <div
|
|
41
|
+
{!icon && theme && <div
|
|
42
|
+
dangerouslySetInnerHTML={{ __html: iconMap[theme] }}
|
|
43
|
+
style={{ height: '20px' }}
|
|
44
|
+
/>}
|
|
42
45
|
|
|
43
46
|
<ConditionalWrapper condition={!!(icon || theme)} wrapper={children => (
|
|
44
47
|
<div className={styles.wrapper}>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CollapsibleProps } from './collapsible'
|
|
3
|
+
|
|
4
|
+
import styles from './collapsible.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
interface Props extends CollapsibleProps {}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
initialHeight,
|
|
11
|
+
maxHeight,
|
|
12
|
+
toggled,
|
|
13
|
+
className,
|
|
14
|
+
togglesClassName
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
styles.collapsible,
|
|
19
|
+
maxHeight && styles.animated,
|
|
20
|
+
className
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const styleVariables = classNames([
|
|
24
|
+
initialHeight && `--w-collapsible-initial-height: ${initialHeight};`,
|
|
25
|
+
maxHeight && `--w-collapsible-max-height: ${maxHeight};`
|
|
26
|
+
])
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
class:list={classes}
|
|
31
|
+
data-toggled={toggled ? 'true' : undefined}
|
|
32
|
+
data-id="w-collapsible"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class={styles.wrapper}
|
|
36
|
+
style={styleVariables}
|
|
37
|
+
>
|
|
38
|
+
<slot />
|
|
39
|
+
</div>
|
|
40
|
+
<div class:list={togglesClassName}>
|
|
41
|
+
<div data-toggle-on="true"><slot name="on" /></div>
|
|
42
|
+
<div data-toggle-off="true"><slot name="off" /></div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
const collapsibles = document.querySelectorAll('[data-id="w-collapsible"]')
|
|
48
|
+
|
|
49
|
+
Array.from(collapsibles).forEach(element => {
|
|
50
|
+
element.addEventListener('click', event => {
|
|
51
|
+
const collapsible = event.currentTarget as HTMLDivElement
|
|
52
|
+
const target = event.target as HTMLDivElement
|
|
53
|
+
|
|
54
|
+
if (target.parentElement?.dataset.toggleOn) {
|
|
55
|
+
collapsible.dataset.toggled = 'true'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (target.parentElement?.dataset.toggleOff) {
|
|
59
|
+
collapsible.dataset.toggled = 'false'
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CollapsibleProps } from './collapsible'
|
|
3
|
+
|
|
4
|
+
import styles from './collapsible.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
export let initialHeight: CollapsibleProps['initialHeight'] = ''
|
|
8
|
+
export let maxHeight: CollapsibleProps['maxHeight'] = ''
|
|
9
|
+
export let toggled: CollapsibleProps['toggled'] = false
|
|
10
|
+
export let className: CollapsibleProps['className'] = ''
|
|
11
|
+
export let togglesClassName: CollapsibleProps['togglesClassName'] = ''
|
|
12
|
+
|
|
13
|
+
const classes = classNames([
|
|
14
|
+
styles.collapsible,
|
|
15
|
+
maxHeight && styles.animated,
|
|
16
|
+
className
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const styleVariables = classNames([
|
|
20
|
+
initialHeight && `--w-collapsible-initial-height: ${initialHeight};`,
|
|
21
|
+
maxHeight && `--w-collapsible-max-height: ${maxHeight};`
|
|
22
|
+
])
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class={classes}
|
|
27
|
+
data-toggled={toggled ? 'true' : undefined}
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class={styles.wrapper}
|
|
31
|
+
style={styleVariables}
|
|
32
|
+
>
|
|
33
|
+
<slot />
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
on:click={() => toggled = !toggled}
|
|
37
|
+
on:keyup={() => toggled = !toggled}
|
|
38
|
+
role="button"
|
|
39
|
+
tabindex={0}
|
|
40
|
+
class={togglesClassName}
|
|
41
|
+
>
|
|
42
|
+
{#if toggled}
|
|
43
|
+
<slot name="off" />
|
|
44
|
+
{:else}
|
|
45
|
+
<slot name="on" />
|
|
46
|
+
{/if}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import type { ReactCollapsibleProps } from './collapsible'
|
|
3
|
+
|
|
4
|
+
import styles from './collapsible.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
const Collapsible = ({
|
|
8
|
+
initialHeight,
|
|
9
|
+
maxHeight,
|
|
10
|
+
toggled,
|
|
11
|
+
on,
|
|
12
|
+
off,
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
togglesClassName
|
|
16
|
+
}: ReactCollapsibleProps) => {
|
|
17
|
+
const [toggle, setToggled] = useState(toggled)
|
|
18
|
+
|
|
19
|
+
const classes = classNames([
|
|
20
|
+
styles.collapsible,
|
|
21
|
+
maxHeight && styles.animated,
|
|
22
|
+
className
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
const styleVariables = {
|
|
26
|
+
...(initialHeight && { '--w-collapsible-initial-height': initialHeight }),
|
|
27
|
+
...(maxHeight && { '--w-collapsible-max-height': maxHeight })
|
|
28
|
+
} as React.CSSProperties
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className={classes}
|
|
33
|
+
data-toggled={toggle ? 'true' : undefined}
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
className={styles.wrapper}
|
|
37
|
+
style={styleVariables}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
<div
|
|
42
|
+
onClick={() => setToggled(!toggle)}
|
|
43
|
+
onKeyUp={() => setToggled(!toggle)}
|
|
44
|
+
role="button"
|
|
45
|
+
tabIndex={0}
|
|
46
|
+
className={togglesClassName}
|
|
47
|
+
>
|
|
48
|
+
{toggle ? off : on}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default Collapsible
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
body {
|
|
4
|
+
--w-collapsible-initial-height: 0;
|
|
5
|
+
--w-collapsible-max-height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.collapsible {
|
|
9
|
+
@include layout(flex, column, xs);
|
|
10
|
+
|
|
11
|
+
&:not([data-toggled="true"]) [data-toggle-off],
|
|
12
|
+
&[data-toggled="true"] [data-toggle-on] {
|
|
13
|
+
@include visibility(none);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&[data-toggled="true"] .wrapper {
|
|
17
|
+
max-height: var(--w-collapsible-max-height);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.animated .wrapper {
|
|
21
|
+
@include transition(max-height, .5s);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.wrapper {
|
|
25
|
+
@include visibility(hidden);
|
|
26
|
+
|
|
27
|
+
max-height: var(--w-collapsible-initial-height);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type CollapsibleProps = {
|
|
2
|
+
initialHeight?: string
|
|
3
|
+
maxHeight?: string
|
|
4
|
+
toggled?: boolean
|
|
5
|
+
className?: string
|
|
6
|
+
togglesClassName?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type ReactCollapsibleProps = {
|
|
10
|
+
on: React.ReactNode
|
|
11
|
+
off: React.ReactNode
|
|
12
|
+
children?: React.ReactNode
|
|
13
|
+
} & CollapsibleProps
|
|
14
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PopoverProps } from './popover'
|
|
3
|
+
import styles from './popover.module.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends PopoverProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
id,
|
|
9
|
+
className
|
|
10
|
+
} = Astro.props
|
|
11
|
+
|
|
12
|
+
const classes = [
|
|
13
|
+
styles.popover,
|
|
14
|
+
className
|
|
15
|
+
]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<dialog
|
|
19
|
+
class:list={classes}
|
|
20
|
+
id={id}
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</dialog>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PopoverProps } from './popover'
|
|
3
|
+
|
|
4
|
+
import styles from './popover.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
export let id: PopoverProps['id'] = ''
|
|
8
|
+
export let className: PopoverProps['className'] = ''
|
|
9
|
+
|
|
10
|
+
const classes = classNames([
|
|
11
|
+
styles.popover,
|
|
12
|
+
className
|
|
13
|
+
])
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<dialog
|
|
17
|
+
class={classes}
|
|
18
|
+
id={id}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</dialog>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactPopoverProps } from './popover'
|
|
3
|
+
|
|
4
|
+
import styles from './popover.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
const Popover = ({
|
|
8
|
+
id,
|
|
9
|
+
className,
|
|
10
|
+
children
|
|
11
|
+
}: ReactPopoverProps) => {
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.popover,
|
|
14
|
+
className
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<dialog
|
|
19
|
+
className={classes}
|
|
20
|
+
id={id}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</dialog>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Popover
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.popover {
|
|
4
|
+
@include spacing(m0, p-default);
|
|
5
|
+
@include layer(modal);
|
|
6
|
+
@include visibility(block, 0);
|
|
7
|
+
@include border(primary-50);
|
|
8
|
+
@include background(primary-70);
|
|
9
|
+
@include typography(primary);
|
|
10
|
+
@include border-radius(md);
|
|
11
|
+
@include size(w300px);
|
|
12
|
+
|
|
13
|
+
transform: translateY(-5px);
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
|
|
16
|
+
&[data-show] {
|
|
17
|
+
@include transition();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&[data-show="true"] {
|
|
21
|
+
@include visibility(1);
|
|
22
|
+
|
|
23
|
+
transform: translateY(0);
|
|
24
|
+
pointer-events: all;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&[data-position="top"] {
|
|
28
|
+
transform: translateY(5px);
|
|
29
|
+
|
|
30
|
+
&[data-show="true"] {
|
|
31
|
+
transform: translate(0);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[data-position="left"] {
|
|
36
|
+
transform: translateY(0) translateX(5px);
|
|
37
|
+
|
|
38
|
+
&[data-show="true"] {
|
|
39
|
+
transform: translate(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
&[data-position="right"] {
|
|
45
|
+
transform: translateY(0) translateX(-5px);
|
|
46
|
+
|
|
47
|
+
&[data-show="true"] {
|
|
48
|
+
transform: translate(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { SheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.astro'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
interface Props extends SheetProps {}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
position,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.sheet,
|
|
19
|
+
position && styles[position],
|
|
20
|
+
className
|
|
21
|
+
])
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Modal
|
|
25
|
+
className={classes}
|
|
26
|
+
{...rest}
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</Modal>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.svelte'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
export let position: SheetProps['position'] = null
|
|
10
|
+
export let className: SheetProps['className'] = ''
|
|
11
|
+
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.sheet,
|
|
14
|
+
position && styles[position],
|
|
15
|
+
className
|
|
16
|
+
])
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Modal
|
|
20
|
+
className={classes}
|
|
21
|
+
{...$$restProps}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</Modal>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactSheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.tsx'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
const Sheet = ({
|
|
10
|
+
position,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: ReactSheetProps) => {
|
|
15
|
+
const classes = classNames([
|
|
16
|
+
styles.sheet,
|
|
17
|
+
position && styles[position],
|
|
18
|
+
className
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Modal
|
|
23
|
+
className={classes}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</Modal>
|
|
28
|
+
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Sheet
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.sheet {
|
|
4
|
+
@include position(t0, 'r-100%', lauto);
|
|
5
|
+
@include visibility(1);
|
|
6
|
+
@include border-radius(none);
|
|
7
|
+
@include size(100%);
|
|
8
|
+
@include border(0);
|
|
9
|
+
@include border(left, primary-50);
|
|
10
|
+
|
|
11
|
+
transform: none;
|
|
12
|
+
|
|
13
|
+
&[data-show="true"] {
|
|
14
|
+
@include position(r0);
|
|
15
|
+
|
|
16
|
+
transform: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.left {
|
|
20
|
+
@include position('l-100%', rauto);
|
|
21
|
+
@include border(0);
|
|
22
|
+
@include border(right, primary-50);
|
|
23
|
+
|
|
24
|
+
&[data-show="true"] {
|
|
25
|
+
@include position(l0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.top {
|
|
30
|
+
@include position(t0, l0);
|
|
31
|
+
@include size(hauto);
|
|
32
|
+
@include border(0);
|
|
33
|
+
@include border(bottom, primary-50);
|
|
34
|
+
|
|
35
|
+
transform: translateY(-100%);
|
|
36
|
+
min-width: 100%;
|
|
37
|
+
|
|
38
|
+
&[data-show="true"] {
|
|
39
|
+
transform: translateY(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.bottom {
|
|
44
|
+
@include position(b0, l0);
|
|
45
|
+
@include size(hauto);
|
|
46
|
+
@include border(0);
|
|
47
|
+
@include border(top, primary-50);
|
|
48
|
+
|
|
49
|
+
transform: translateY(100%);
|
|
50
|
+
top: auto;
|
|
51
|
+
min-width: 100%;
|
|
52
|
+
|
|
53
|
+
&[data-show="true"] {
|
|
54
|
+
transform: translateY(0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include media(xs) {
|
|
60
|
+
.sheet {
|
|
61
|
+
@include position(r-500px);
|
|
62
|
+
@include size(w500px);
|
|
63
|
+
|
|
64
|
+
&.left {
|
|
65
|
+
@include position(l-500px);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|