webcoreui 0.8.0 → 0.9.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 +16 -0
- package/astro.d.ts +23 -0
- package/astro.js +8 -0
- package/components/Accordion/accordion.module.scss +1 -0
- package/components/Badge/Badge.svelte +1 -1
- package/components/Badge/badge.ts +1 -1
- package/components/BottomNavigation/BottomNavigation.astro +51 -0
- package/components/BottomNavigation/BottomNavigation.svelte +45 -0
- package/components/BottomNavigation/BottomNavigation.tsx +63 -0
- package/components/BottomNavigation/bottomnavigation.module.scss +70 -0
- package/components/BottomNavigation/bottomnavigation.ts +16 -0
- package/components/Card/card.module.scss +1 -0
- package/components/Checkbox/Checkbox.astro +8 -2
- package/components/Checkbox/Checkbox.svelte +1 -0
- package/components/Checkbox/Checkbox.tsx +3 -1
- package/components/Checkbox/checkbox.ts +1 -0
- package/components/Copy/Copy.astro +74 -0
- package/components/Copy/Copy.svelte +61 -0
- package/components/Copy/Copy.tsx +73 -0
- package/components/Copy/copy.module.scss +37 -0
- package/components/Copy/copy.ts +14 -0
- package/components/DataTable/DataTable.astro +1 -1
- package/components/Flex/Flex.astro +34 -0
- package/components/Flex/Flex.svelte +27 -0
- package/components/Flex/Flex.tsx +30 -0
- package/components/Flex/flex.ts +22 -0
- package/components/Grid/Grid.astro +32 -0
- package/components/Grid/Grid.svelte +25 -0
- package/components/Grid/Grid.tsx +28 -0
- package/components/Grid/grid.ts +18 -0
- package/components/Icon/icon.ts +1 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +1 -1
- package/components/Input/Input.svelte +4 -2
- package/components/Input/Input.tsx +4 -1
- package/components/List/list.module.scss +3 -0
- package/components/Menu/Menu.svelte +5 -1
- package/components/Pagination/Pagination.svelte +1 -0
- package/components/Radio/Radio.astro +3 -1
- package/components/Radio/Radio.svelte +3 -2
- package/components/Radio/Radio.tsx +5 -3
- package/components/Radio/radio.ts +1 -0
- package/components/Select/Select.astro +34 -1
- package/components/Select/Select.svelte +40 -4
- package/components/Select/Select.tsx +33 -1
- package/components/Select/select.ts +4 -1
- package/components/Skeleton/Skeleton.astro +2 -2
- package/components/Skeleton/Skeleton.svelte +2 -2
- package/components/Skeleton/Skeleton.tsx +2 -2
- package/components/Switch/Switch.astro +3 -2
- package/components/Switch/Switch.svelte +1 -0
- package/components/Switch/Switch.tsx +3 -1
- package/components/Switch/switch.ts +1 -0
- package/components/Textarea/Textarea.astro +3 -1
- package/components/Textarea/Textarea.svelte +48 -47
- package/components/Textarea/textarea.ts +19 -18
- package/icons/copy.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +74 -2
- package/index.js +1 -0
- package/package.json +24 -15
- package/react.d.ts +23 -0
- package/react.js +8 -0
- package/scss/config/color-palette.scss +1 -1
- package/scss/config/css-values.scss +1 -1
- package/scss/config/layout.scss +1 -1
- package/scss/config/mixins.scss +1 -1
- package/scss/config/typography.scss +1 -1
- package/scss/config/variables.scss +1 -1
- package/scss/config.scss +1 -1
- package/scss/global/utility.scss +48 -3
- package/svelte.d.ts +23 -0
- package/svelte.js +8 -0
- package/utils/DOMUtils.ts +2 -2
- package/utils/classNames.ts +1 -1
- package/utils/getLayoutClasses.ts +141 -0
- package/utils/modal.ts +4 -4
- package/utils/popover.ts +30 -4
package/README.md
CHANGED
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
alt="License"
|
|
21
21
|
/>
|
|
22
22
|
</a>
|
|
23
|
+
<a href="https://github.com/Frontendland/webcoreui/actions">
|
|
24
|
+
<img
|
|
25
|
+
src="https://img.shields.io/github/actions/workflow/status/Frontendland/webcoreui/checks.yml"
|
|
26
|
+
alt="Build"
|
|
27
|
+
/>
|
|
28
|
+
</a>
|
|
23
29
|
</p>
|
|
24
30
|
|
|
25
31
|
> [!IMPORTANT]
|
|
@@ -113,6 +119,9 @@ html body {
|
|
|
113
119
|
// Banner component
|
|
114
120
|
--w-banner-top: 0;
|
|
115
121
|
|
|
122
|
+
// BottomNavigation component
|
|
123
|
+
--w-bottom-navigation-max-width: auto;
|
|
124
|
+
|
|
116
125
|
// Checkbox component
|
|
117
126
|
--w-checkbox-color: var(--w-color-primary);
|
|
118
127
|
|
|
@@ -222,6 +231,7 @@ import { Accordion } from 'webcoreui/react'
|
|
|
222
231
|
- [Avatar](https://github.com/Frontendland/webcoreui/tree/main/src/components/Avatar)
|
|
223
232
|
- [Badge](https://github.com/Frontendland/webcoreui/tree/main/src/components/Badge)
|
|
224
233
|
- [Banner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Banner)
|
|
234
|
+
- [BottomNavigation](https://github.com/Frontendland/webcoreui/tree/main/src/components/BottomNavigation)
|
|
225
235
|
- [Breadcrumb](https://github.com/Frontendland/webcoreui/tree/main/src/components/Breadcrumb)
|
|
226
236
|
- [Button](https://github.com/Frontendland/webcoreui/tree/main/src/components/Button)
|
|
227
237
|
- [Card](https://github.com/Frontendland/webcoreui/tree/main/src/components/Card)
|
|
@@ -229,8 +239,11 @@ import { Accordion } from 'webcoreui/react'
|
|
|
229
239
|
- [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
|
|
230
240
|
- [Collapsible](https://github.com/Frontendland/webcoreui/tree/main/src/components/Collapsible)
|
|
231
241
|
- [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
|
|
242
|
+
- [Copy](https://github.com/Frontendland/webcoreui/tree/main/src/components/Copy)
|
|
232
243
|
- [DataTable](https://github.com/Frontendland/webcoreui/tree/main/src/components/DataTable)
|
|
244
|
+
- [Flex](https://github.com/Frontendland/webcoreui/tree/main/src/components/Flex)
|
|
233
245
|
- [Footer](https://github.com/Frontendland/webcoreui/tree/main/src/components/Footer)
|
|
246
|
+
- [Grid](https://github.com/Frontendland/webcoreui/tree/main/src/components/Grid)
|
|
234
247
|
- [Group](https://github.com/Frontendland/webcoreui/tree/main/src/components/Group)
|
|
235
248
|
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
|
|
236
249
|
- [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
|
|
@@ -265,8 +278,11 @@ import { Accordion } from 'webcoreui/react'
|
|
|
265
278
|
## Blocks
|
|
266
279
|
|
|
267
280
|
- [BlogCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/BlogCard)
|
|
281
|
+
- [ComponentMap](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ComponentMap)
|
|
282
|
+
- [DeviceMockup](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/DeviceMockup)
|
|
268
283
|
- [ErrorPage](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ErrorPage)
|
|
269
284
|
- [FAQ](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/FAQ)
|
|
285
|
+
- [GridWithIcons](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/GridWithIcons)
|
|
270
286
|
- [Hero](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Hero)
|
|
271
287
|
- [IconList](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/IconList)
|
|
272
288
|
- [SettingCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SettingCard)
|
package/astro.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { AspectRatioProps as WAspectRatioProps } from './components/AspectR
|
|
|
4
4
|
import type { AvatarProps as WAvatarProps } from './components/Avatar/avatar'
|
|
5
5
|
import type { BadgeProps as WBadgeProps } from './components/Badge/badge'
|
|
6
6
|
import type { BannerProps as WBannerProps } from './components/Banner/banner'
|
|
7
|
+
import type { BottomNavigationProps as WBottomNavigationProps } from './components/BottomNavigation/bottomnavigation'
|
|
7
8
|
import type { BreadcrumbProps as WBreadcrumbProps } from './components/Breadcrumb/breadcrumb'
|
|
8
9
|
import type { ButtonProps as WButtonProps } from './components/Button/button'
|
|
9
10
|
import type { CardProps as WCardProps } from './components/Card/card'
|
|
@@ -11,8 +12,11 @@ import type { CarouselProps as WCarouselProps } from './components/Carousel/caro
|
|
|
11
12
|
import type { CheckboxProps as WCheckboxProps } from './components/Checkbox/checkbox'
|
|
12
13
|
import type { CollapsibleProps as WCollapsibleProps } from './components/Collapsible/collapsible'
|
|
13
14
|
import type { ConditionalWrapperProps as WConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
15
|
+
import type { CopyProps as WCopyProps } from './components/Copy/copy'
|
|
14
16
|
import type { DataTableProps as WDataTableProps } from './components/DataTable/datatable'
|
|
17
|
+
import type { FlexProps as WFlexProps } from './components/Flex/flex'
|
|
15
18
|
import type { FooterProps as WFooterProps } from './components/Footer/footer'
|
|
19
|
+
import type { GridProps as WGridProps } from './components/Grid/grid'
|
|
16
20
|
import type { GroupProps as WGroupProps } from './components/Group/group'
|
|
17
21
|
import type { IconProps as WIconProps } from './components/Icon/icon'
|
|
18
22
|
import type { InputProps as WInputProps } from './components/Input/input'
|
|
@@ -44,6 +48,11 @@ import type { TimelineProps as WTimelineProps } from './components/Timeline/time
|
|
|
44
48
|
import type { TimelineItemProps as WTimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
45
49
|
import type { ToastProps as WToastProps } from './components/Toast/toast'
|
|
46
50
|
|
|
51
|
+
import type { DataTableEventType as WDataTableEventType, HeadingObject as WHeadingObject } from './components/DataTable/datatable.ts'
|
|
52
|
+
import type { ListEventType as WListEventType } from './components/List/list.ts'
|
|
53
|
+
import type { PaginationEventType as WPaginationEventType } from './components/Pagination/pagination.ts'
|
|
54
|
+
import type { SelectEventType as WSelectEventType } from './components/Select/select.ts'
|
|
55
|
+
|
|
47
56
|
declare module 'webcoreui/astro' {
|
|
48
57
|
export function Accordion(_props: WAccordionProps): any
|
|
49
58
|
export function Alert(_props: WAlertProps): any
|
|
@@ -51,6 +60,7 @@ declare module 'webcoreui/astro' {
|
|
|
51
60
|
export function Avatar(_props: WAvatarProps): any
|
|
52
61
|
export function Badge(_props: WBadgeProps): any
|
|
53
62
|
export function Banner(_props: WBannerProps): any
|
|
63
|
+
export function BottomNavigation(_props: WBottomNavigationProps): any
|
|
54
64
|
export function Breadcrumb(_props: WBreadcrumbProps): any
|
|
55
65
|
export function Button(_props: WButtonProps): any
|
|
56
66
|
export function Card(_props: WCardProps): any
|
|
@@ -58,8 +68,11 @@ declare module 'webcoreui/astro' {
|
|
|
58
68
|
export function Checkbox(_props: WCheckboxProps): any
|
|
59
69
|
export function Collapsible(_props: WCollapsibleProps): any
|
|
60
70
|
export function ConditionalWrapper(_props: WConditionalWrapperProps): any
|
|
71
|
+
export function Copy(_props: WCopyProps): any
|
|
61
72
|
export function DataTable(_props: WDataTableProps): any
|
|
73
|
+
export function Flex(_props: WFlexProps): any
|
|
62
74
|
export function Footer(_props: WFooterProps): any
|
|
75
|
+
export function Grid(_props: WGridProps): any
|
|
63
76
|
export function Group(_props: WGroupProps): any
|
|
64
77
|
export function Icon(_props: WIconProps): any
|
|
65
78
|
export function Input(_props: WInputProps): any
|
|
@@ -97,6 +110,7 @@ declare module 'webcoreui/astro' {
|
|
|
97
110
|
export type AvatarProps = WAvatarProps
|
|
98
111
|
export type BadgeProps = WBadgeProps
|
|
99
112
|
export type BannerProps = WBannerProps
|
|
113
|
+
export type BottomNavigationProps = WBottomNavigationProps
|
|
100
114
|
export type BreadcrumbProps = WBreadcrumbProps
|
|
101
115
|
export type ButtonProps = WButtonProps
|
|
102
116
|
export type CardProps = WCardProps
|
|
@@ -104,8 +118,11 @@ declare module 'webcoreui/astro' {
|
|
|
104
118
|
export type CheckboxProps = WCheckboxProps
|
|
105
119
|
export type CollapsibleProps = WCollapsibleProps
|
|
106
120
|
export type ConditionalWrapperProps = WConditionalWrapperProps
|
|
121
|
+
export type CopyProps = WCopyProps
|
|
107
122
|
export type DataTableProps = WDataTableProps
|
|
123
|
+
export type FlexProps = WFlexProps
|
|
108
124
|
export type FooterProps = WFooterProps
|
|
125
|
+
export type GridProps = WGridProps
|
|
109
126
|
export type GroupProps = WGroupProps
|
|
110
127
|
export type IconProps = WIconProps
|
|
111
128
|
export type InputProps = WInputProps
|
|
@@ -136,4 +153,10 @@ declare module 'webcoreui/astro' {
|
|
|
136
153
|
export type TimelineProps = WTimelineProps
|
|
137
154
|
export type TimelineItemProps = WTimelineItemProps
|
|
138
155
|
export type ToastProps = WToastProps
|
|
156
|
+
|
|
157
|
+
export type DataTableEventType = WDataTableEventType
|
|
158
|
+
export type HeadingObject = WHeadingObject
|
|
159
|
+
export type ListEventType = WListEventType
|
|
160
|
+
export type PaginationEventType = WPaginationEventType
|
|
161
|
+
export type SelectEventType = WSelectEventType
|
|
139
162
|
}
|
package/astro.js
CHANGED
|
@@ -4,6 +4,7 @@ import AspectRatioComponent from './components/AspectRatio/AspectRatio.astro'
|
|
|
4
4
|
import AvatarComponent from './components/Avatar/Avatar.astro'
|
|
5
5
|
import BadgeComponent from './components/Badge/Badge.astro'
|
|
6
6
|
import BannerComponent from './components/Banner/Banner.astro'
|
|
7
|
+
import BottomNavigationComponent from './components/BottomNavigation/BottomNavigation.astro'
|
|
7
8
|
import BreadcrumbComponent from './components/Breadcrumb/Breadcrumb.astro'
|
|
8
9
|
import ButtonComponent from './components/Button/Button.astro'
|
|
9
10
|
import CardComponent from './components/Card/Card.astro'
|
|
@@ -11,8 +12,11 @@ import CarouselComponent from './components/Carousel/Carousel.astro'
|
|
|
11
12
|
import CheckboxComponent from './components/Checkbox/Checkbox.astro'
|
|
12
13
|
import CollapsibleComponent from './components/Collapsible/Collapsible.astro'
|
|
13
14
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
|
|
15
|
+
import CopyComponent from './components/Copy/Copy.astro'
|
|
14
16
|
import DataTableComponent from './components/DataTable/DataTable.astro'
|
|
17
|
+
import FlexComponent from './components/Flex/Flex.astro'
|
|
15
18
|
import FooterComponent from './components/Footer/Footer.astro'
|
|
19
|
+
import GridComponent from './components/Grid/Grid.astro'
|
|
16
20
|
import GroupComponent from './components/Group/Group.astro'
|
|
17
21
|
import IconComponent from './components/Icon/Icon.astro'
|
|
18
22
|
import InputComponent from './components/Input/Input.astro'
|
|
@@ -50,6 +54,7 @@ export const AspectRatio = AspectRatioComponent
|
|
|
50
54
|
export const Avatar = AvatarComponent
|
|
51
55
|
export const Badge = BadgeComponent
|
|
52
56
|
export const Banner = BannerComponent
|
|
57
|
+
export const BottomNavigation = BottomNavigationComponent
|
|
53
58
|
export const Breadcrumb = BreadcrumbComponent
|
|
54
59
|
export const Button = ButtonComponent
|
|
55
60
|
export const Card = CardComponent
|
|
@@ -57,8 +62,11 @@ export const Carousel = CarouselComponent
|
|
|
57
62
|
export const Checkbox = CheckboxComponent
|
|
58
63
|
export const Collapsible = CollapsibleComponent
|
|
59
64
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
65
|
+
export const Copy = CopyComponent
|
|
60
66
|
export const DataTable = DataTableComponent
|
|
67
|
+
export const Flex = FlexComponent
|
|
61
68
|
export const Footer = FooterComponent
|
|
69
|
+
export const Grid = GridComponent
|
|
62
70
|
export const Group = GroupComponent
|
|
63
71
|
export const Icon = IconComponent
|
|
64
72
|
export const Input = InputComponent
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export let small: SvelteBadgeProps['small'] = false
|
|
11
11
|
export let rounded: SvelteBadgeProps['rounded'] = false
|
|
12
12
|
export let className: SvelteBadgeProps['className'] = ''
|
|
13
|
-
export let onClick: SvelteBadgeProps['onClick'] =
|
|
13
|
+
export let onClick: SvelteBadgeProps['onClick'] = null
|
|
14
14
|
|
|
15
15
|
const classes = classNames([
|
|
16
16
|
styles.badge,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { BottomNavigationProps } from './bottomnavigation'
|
|
3
|
+
|
|
4
|
+
import Icon from '../Icon/Icon.astro'
|
|
5
|
+
|
|
6
|
+
import styles from './bottomnavigation.module.scss'
|
|
7
|
+
|
|
8
|
+
import type { IconProps } from '../Icon/icon'
|
|
9
|
+
|
|
10
|
+
interface Props extends BottomNavigationProps {}
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
items,
|
|
14
|
+
separated,
|
|
15
|
+
floating,
|
|
16
|
+
maxWidth,
|
|
17
|
+
className
|
|
18
|
+
} = Astro.props
|
|
19
|
+
|
|
20
|
+
const classes = [
|
|
21
|
+
styles.nav,
|
|
22
|
+
separated && styles.separated,
|
|
23
|
+
maxWidth && styles.bordered,
|
|
24
|
+
floating && styles.floating,
|
|
25
|
+
className
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const styleVariable = maxWidth
|
|
29
|
+
? `--w-bottom-navigation-max-width: ${maxWidth};`
|
|
30
|
+
: null
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<nav class:list={classes} style={styleVariable}>
|
|
34
|
+
<ul>
|
|
35
|
+
{items?.map(item => ({ ...item, element: item.href ? 'a' : 'div' })).map(item => (
|
|
36
|
+
<li data-tooltip={item.tooltip} class:list={[item.icon && styles['with-icon']]}>
|
|
37
|
+
<item.element {...{ href: item.href, target: item.target, class: styles.item }}>
|
|
38
|
+
{item.icon && (
|
|
39
|
+
<Fragment>
|
|
40
|
+
{item.icon?.startsWith('<svg')
|
|
41
|
+
? <Fragment set:html={item.icon} />
|
|
42
|
+
: <Icon type={item.icon as IconProps['type']} />
|
|
43
|
+
}
|
|
44
|
+
</Fragment>
|
|
45
|
+
)}
|
|
46
|
+
{item.name}
|
|
47
|
+
</item.element>
|
|
48
|
+
</li>
|
|
49
|
+
))}
|
|
50
|
+
</ul>
|
|
51
|
+
</nav>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BottomNavigationProps } from './bottomnavigation'
|
|
3
|
+
|
|
4
|
+
import { classNames } from '../../utils/classNames'
|
|
5
|
+
|
|
6
|
+
import styles from './bottomnavigation.module.scss'
|
|
7
|
+
|
|
8
|
+
export let items: BottomNavigationProps['items'] = []
|
|
9
|
+
export let separated: BottomNavigationProps['separated'] = false
|
|
10
|
+
export let floating: BottomNavigationProps['floating'] = false
|
|
11
|
+
export let maxWidth: BottomNavigationProps['maxWidth'] = ''
|
|
12
|
+
export let className: BottomNavigationProps['className'] = ''
|
|
13
|
+
|
|
14
|
+
const classes = classNames([
|
|
15
|
+
styles.nav,
|
|
16
|
+
separated && styles.separated,
|
|
17
|
+
maxWidth && styles.bordered,
|
|
18
|
+
floating && styles.floating,
|
|
19
|
+
className
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
const styleVariable = maxWidth
|
|
23
|
+
? `--w-bottom-navigation-max-width: ${maxWidth};`
|
|
24
|
+
: null
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<nav class={classes} style={styleVariable}>
|
|
28
|
+
<ul>
|
|
29
|
+
{#each items as item}
|
|
30
|
+
<li data-tooltip={item.tooltip} class={classNames([item.icon && styles['with-icon']])}>
|
|
31
|
+
<svelte:element
|
|
32
|
+
this={item.href ? 'a' : 'div'}
|
|
33
|
+
href={item.href}
|
|
34
|
+
target={item.target}
|
|
35
|
+
class={styles.item}
|
|
36
|
+
>
|
|
37
|
+
{#if item.icon}
|
|
38
|
+
{@html item.icon}
|
|
39
|
+
{/if}
|
|
40
|
+
{item.name}
|
|
41
|
+
</svelte:element>
|
|
42
|
+
</li>
|
|
43
|
+
{/each}
|
|
44
|
+
</ul>
|
|
45
|
+
</nav>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { BottomNavigationProps } from './bottomnavigation'
|
|
3
|
+
|
|
4
|
+
import { classNames } from '../../utils/classNames'
|
|
5
|
+
|
|
6
|
+
import styles from './bottomnavigation.module.scss'
|
|
7
|
+
|
|
8
|
+
type ElementType = BottomNavigationProps['items'][0] & {
|
|
9
|
+
className: string
|
|
10
|
+
dangerouslySetInnerHTML: {
|
|
11
|
+
__html: string
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const BottomNavigation = ({
|
|
16
|
+
items,
|
|
17
|
+
separated,
|
|
18
|
+
floating,
|
|
19
|
+
maxWidth,
|
|
20
|
+
className
|
|
21
|
+
}: BottomNavigationProps) => {
|
|
22
|
+
const classes = classNames([
|
|
23
|
+
styles.nav,
|
|
24
|
+
separated && styles.separated,
|
|
25
|
+
maxWidth && styles.bordered,
|
|
26
|
+
floating && styles.floating,
|
|
27
|
+
className
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
const styleVariable = maxWidth
|
|
31
|
+
? { '--w-bottom-navigation-max-width': maxWidth } as React.CSSProperties
|
|
32
|
+
: undefined
|
|
33
|
+
|
|
34
|
+
const Element = ({ href, ...rest }: ElementType) => href
|
|
35
|
+
? <a {...rest} />
|
|
36
|
+
: <div {...rest} />
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<nav className={classes} style={styleVariable}>
|
|
40
|
+
<ul>
|
|
41
|
+
{items?.map((item, index) => (
|
|
42
|
+
<li
|
|
43
|
+
key={index}
|
|
44
|
+
data-tooltip={item.tooltip}
|
|
45
|
+
className={classNames([item.icon && styles['with-icon']])}
|
|
46
|
+
>
|
|
47
|
+
<Element
|
|
48
|
+
href={item.href}
|
|
49
|
+
target={item.target}
|
|
50
|
+
className={styles.item}
|
|
51
|
+
dangerouslySetInnerHTML={{ __html: item.icon
|
|
52
|
+
? `${item.icon} ${item.name}`
|
|
53
|
+
: (item.name || '')
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
</li>
|
|
57
|
+
))}
|
|
58
|
+
</ul>
|
|
59
|
+
</nav>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default BottomNavigation
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
body {
|
|
4
|
+
--w-bottom-navigation-max-width: auto;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.nav {
|
|
8
|
+
@include background(primary-60);
|
|
9
|
+
@include position(fixed, b0, l0, r0);
|
|
10
|
+
@include layer(header);
|
|
11
|
+
@include border(top, primary-50);
|
|
12
|
+
|
|
13
|
+
&.separated ul li:not(:last-child) {
|
|
14
|
+
@include border(right, primary-50);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.separated.bordered ul {
|
|
18
|
+
@include border(left, primary-50);
|
|
19
|
+
@include border(right, primary-50);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.floating {
|
|
23
|
+
@include position(l20px, r20px, b20px);
|
|
24
|
+
@include border-radius(xl);
|
|
25
|
+
@include border(0);
|
|
26
|
+
|
|
27
|
+
&:not(.bordered) {
|
|
28
|
+
li:first-child .item {
|
|
29
|
+
@include border-radius(xl, left);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
li:last-child .item {
|
|
33
|
+
@include border-radius(xl, right);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ul {
|
|
39
|
+
@include spacing(none-auto, p0);
|
|
40
|
+
@include layout(flex, h-center);
|
|
41
|
+
|
|
42
|
+
max-width: var(--w-bottom-navigation-max-width);
|
|
43
|
+
list-style-type: none;
|
|
44
|
+
|
|
45
|
+
li {
|
|
46
|
+
@include spacing(mb-0);
|
|
47
|
+
|
|
48
|
+
flex: 1;
|
|
49
|
+
|
|
50
|
+
&.with-icon .item {
|
|
51
|
+
@include spacing(pt-sm, pb-xs);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.item {
|
|
55
|
+
@include layout(flex, column, center, xs);
|
|
56
|
+
@include spacing(py-sm);
|
|
57
|
+
@include size('h100%');
|
|
58
|
+
@include transition(background);
|
|
59
|
+
@include typography(md, primary-10, none);
|
|
60
|
+
|
|
61
|
+
user-select: none;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
@include background(primary-50);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonProps } from '../Button/button'
|
|
2
|
+
import type { IconProps } from '../Icon/icon'
|
|
3
|
+
|
|
4
|
+
export type BottomNavigationProps = {
|
|
5
|
+
items: {
|
|
6
|
+
name?: string
|
|
7
|
+
href?: string
|
|
8
|
+
target?: ButtonProps['target']
|
|
9
|
+
icon?: IconProps['type'] | string
|
|
10
|
+
tooltip?: string
|
|
11
|
+
}[]
|
|
12
|
+
separated?: boolean
|
|
13
|
+
floating?: boolean
|
|
14
|
+
maxWidth?: string
|
|
15
|
+
className?: string
|
|
16
|
+
}
|
|
@@ -15,7 +15,8 @@ const {
|
|
|
15
15
|
subText,
|
|
16
16
|
disabled,
|
|
17
17
|
color,
|
|
18
|
-
className
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
19
20
|
} = Astro.props
|
|
20
21
|
|
|
21
22
|
const classes = [
|
|
@@ -34,7 +35,12 @@ const style = color
|
|
|
34
35
|
<div class={styles.wrapper} slot="wrapper">
|
|
35
36
|
children
|
|
36
37
|
</div>
|
|
37
|
-
<input
|
|
38
|
+
<input
|
|
39
|
+
type="checkbox"
|
|
40
|
+
checked={checked}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
{...rest}
|
|
43
|
+
/>
|
|
38
44
|
<span class={styles.check}>
|
|
39
45
|
<Fragment set:html={check} />
|
|
40
46
|
</span>
|
|
@@ -16,7 +16,8 @@ const Checkbox = ({
|
|
|
16
16
|
disabled,
|
|
17
17
|
color,
|
|
18
18
|
className,
|
|
19
|
-
onClick
|
|
19
|
+
onClick,
|
|
20
|
+
...rest
|
|
20
21
|
}: ReactCheckboxProps) => {
|
|
21
22
|
const classes = classNames([
|
|
22
23
|
styles.checkbox,
|
|
@@ -43,6 +44,7 @@ const Checkbox = ({
|
|
|
43
44
|
defaultChecked={checked}
|
|
44
45
|
disabled={disabled}
|
|
45
46
|
onClick={onClick}
|
|
47
|
+
{...rest}
|
|
46
48
|
/>
|
|
47
49
|
<span
|
|
48
50
|
className={styles.check}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CopyProps } from './copy'
|
|
3
|
+
|
|
4
|
+
import Badge from '../Badge/Badge.astro'
|
|
5
|
+
import Icon from '../Icon/Icon.astro'
|
|
6
|
+
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
import styles from './copy.module.scss'
|
|
10
|
+
|
|
11
|
+
import type { IconProps } from '../Icon/icon'
|
|
12
|
+
|
|
13
|
+
interface Props extends CopyProps {}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
tooltip,
|
|
17
|
+
tooltipPosition,
|
|
18
|
+
copyIcon = 'copy',
|
|
19
|
+
copiedIcon = 'circle-check',
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
} = Astro.props
|
|
23
|
+
|
|
24
|
+
const classes = classNames([
|
|
25
|
+
styles.copy,
|
|
26
|
+
className
|
|
27
|
+
])
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<Badge
|
|
31
|
+
{...rest}
|
|
32
|
+
className={classes}
|
|
33
|
+
data-tooltip={tooltip}
|
|
34
|
+
data-position={tooltipPosition}
|
|
35
|
+
>
|
|
36
|
+
<slot />
|
|
37
|
+
<div class={styles.icons}>
|
|
38
|
+
<button
|
|
39
|
+
class={styles['copy-icon']}
|
|
40
|
+
data-id="w-copy"
|
|
41
|
+
>
|
|
42
|
+
{copyIcon?.startsWith('<svg')
|
|
43
|
+
? <Fragment set:html={copyIcon} />
|
|
44
|
+
: <Icon type={copyIcon as IconProps['type']} />
|
|
45
|
+
}
|
|
46
|
+
</button>
|
|
47
|
+
<span class={styles.copied}>
|
|
48
|
+
{copiedIcon?.startsWith('<svg')
|
|
49
|
+
? <Fragment set:html={copiedIcon} />
|
|
50
|
+
: <Icon type={copiedIcon as IconProps['type']} />
|
|
51
|
+
}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
</Badge>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import { on } from '../../utils/DOMUtils'
|
|
58
|
+
|
|
59
|
+
on('[data-id="w-copy"]', 'click', (event: Event) => {
|
|
60
|
+
const copy = event.currentTarget as HTMLButtonElement
|
|
61
|
+
const copied = copy.nextElementSibling as HTMLSpanElement
|
|
62
|
+
const badge = copy.parentElement?.parentElement as HTMLElement
|
|
63
|
+
|
|
64
|
+
const text = copy.parentElement?.previousSibling?.textContent?.trim()
|
|
65
|
+
|
|
66
|
+
copy.style.opacity = '0'
|
|
67
|
+
copy.style.pointerEvents = 'none'
|
|
68
|
+
|
|
69
|
+
copied.style.opacity = '1'
|
|
70
|
+
badge.removeAttribute('data-tooltip')
|
|
71
|
+
|
|
72
|
+
navigator.clipboard.writeText(text as string)
|
|
73
|
+
}, true)
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CopyProps } from './copy'
|
|
3
|
+
|
|
4
|
+
import Badge from '../Badge/Badge.svelte'
|
|
5
|
+
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
import circleCheck from '../../icons/circle-check.svg?raw'
|
|
9
|
+
import copy from '../../icons/copy.svg?raw'
|
|
10
|
+
|
|
11
|
+
import styles from './copy.module.scss'
|
|
12
|
+
|
|
13
|
+
export let tooltip: CopyProps['tooltip'] = ''
|
|
14
|
+
export let tooltipPosition: CopyProps['tooltipPosition'] = null
|
|
15
|
+
export let copyIcon: CopyProps['copyIcon'] = ''
|
|
16
|
+
export let copiedIcon: CopyProps['copiedIcon'] = ''
|
|
17
|
+
export let className: CopyProps['className'] = ''
|
|
18
|
+
|
|
19
|
+
const classes = classNames([
|
|
20
|
+
styles.copy,
|
|
21
|
+
className
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
let copyButton: HTMLButtonElement
|
|
25
|
+
let copiedButton: HTMLSpanElement
|
|
26
|
+
|
|
27
|
+
const copyText = () => {
|
|
28
|
+
const text = copyButton.parentElement?.previousSibling?.textContent?.trim()
|
|
29
|
+
|| (copyButton.parentElement?.previousSibling as Text)?.wholeText?.trim()
|
|
30
|
+
|| copyButton.parentElement?.previousElementSibling?.textContent?.trim()
|
|
31
|
+
|
|
32
|
+
copyButton.style.opacity = '0'
|
|
33
|
+
copyButton.style.pointerEvents = 'none'
|
|
34
|
+
|
|
35
|
+
copiedButton.style.opacity = '1'
|
|
36
|
+
tooltip = ''
|
|
37
|
+
|
|
38
|
+
navigator.clipboard.writeText(text as string)
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Badge
|
|
43
|
+
{...$$restProps}
|
|
44
|
+
className={classes}
|
|
45
|
+
data-tooltip={tooltip || undefined}
|
|
46
|
+
data-position={tooltipPosition}
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
<div class={styles.icons}>
|
|
50
|
+
<button
|
|
51
|
+
class={styles['copy-icon']}
|
|
52
|
+
bind:this={copyButton}
|
|
53
|
+
on:click={copyText}
|
|
54
|
+
>
|
|
55
|
+
{@html copyIcon || copy}
|
|
56
|
+
</button>
|
|
57
|
+
<span class={styles.copied} bind:this={copiedButton}>
|
|
58
|
+
{@html copiedIcon || circleCheck}
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
</Badge>
|